summaryrefslogtreecommitdiffstats
path: root/generic/tclMain.c
Commit message (Expand)AuthorAgeFilesLines
* Micro-optimization: Use TclGetStringFromObj in stead of Tcl_GetStringFromObj ...jan.nijtmans2016-07-081-4/+4
* Remove Tcl_Main() function, since it's no longer being used: It has been a ma...jan.nijtmans2016-06-291-18/+5
* Tcl_SetVar -> Tcl_SetVar2 and comparable replacements, eliminating functions ...jan.nijtmans2016-06-291-2/+4
* Align comment. Remove some end-of-line spacing. No functional changes.jan.nijtmans2015-09-281-2/+2
|\
* \ Fix [00189c4afcb9e2586301d711f71383e48817a72d|00189c4afc]: Allow semi-static ...jan.nijtmans2015-08-191-0/+3
|\ \ | |/
| * Fix [00189c4afcb9e2586301d711f71383e48817a72d|00189c4afc]: Allow semi-static ...jan.nijtmans2015-08-191-0/+3
* | Eliminate all usage of WIN32 and __WIN32__ macros: Some compilers (e.g. Clang...jan.nijtmans2014-02-101-1/+1
* | Bug [9b2e636361]: Tcl_CreateInterp() needs initialized encodings.jan.nijtmans2013-06-271-1/+3
|\ \ | |/
| * Proposed solution for [9b2e636361]jan.nijtmans2013-06-261-2/+3
* | eliminate unnecessary TEXT() macrosjan.nijtmans2012-09-231-2/+2
* | Minor changes to improve style (C89 declarations, consistent indentation,dkf2012-08-071-46/+52
* | * generic/tclUtil.c (TclDStringToObj): Added internal function to makedkf2012-04-251-10/+13
* | [RFE 1711975]: Tcl_MainEx() (like Tk_MainEx())jan.nijtmans2011-09-061-4/+5
|\ \
| * | Tcl_MainEx() (like Tk_MainEx())rfe_1711975jan.nijtmans2011-08-301-1/+2
|/ /
* | Fixed the C99/C++ comments introduced by [8d3f0fb215] which break strict C89 ...andreask2011-08-161-2/+2
* | compiler error on Windows: there should be only one TclFullFinalizationReques...jan.nijtmans2011-08-101-1/+1
* | [Bug 2919042] Restore "valgrindability" of Tcl that was lost by the streamlin...ferrieux2011-08-091-15/+72
* | [Patch #3124683]: platform specific stuff in (tcl|tk)Main.cjan.nijtmans2011-03-171-155/+130
* | Adjust ckalloc/ckfree macros to greatly reduce number of explicit casts indkf2011-03-121-3/+2
* | Now that we're no longer using SCM based on RCS, the RCS Keyword linesdgp2011-03-021-2/+0
|\ \ | |/
| * Now that we're no longer using SCM based on RCS, the RCS Keyword lines causedgp2011-03-021-2/+0
| |\
| | * Now that we're no longer using SCM based on RCS, the RCS Keyword lines causedgp2011-03-011-2/+0
| | * * generic/tclMain.c (Tcl_Main): Corrected flaw that requireddgp2006-05-051-67/+67
| | * * generic/tclBasic.c:Miguel Sofer2005-10-231-3/+9
| | * * generic/tclMain.c: Separate encoding conversion of command linedgp2005-09-301-26/+23
| * | * generic/tclCmdAH.c: Fix cases where value returned bydgp2010-09-231-1/+2
* | | reverted previous commit: it has effect on the Windows consolenijtmans2010-11-151-23/+33
* | | Eliminate use of the function Tcl_WinTCharToUtf in generic codenijtmans2010-11-151-33/+23
* | | fix TCL_ASCII_MAIN usage, as the name suggestsnijtmans2010-11-051-5/+7
* | | * generic/tclMain.c: Added missing conditional on _WIN32 around codeKevin B Kenny2010-11-041-2/+2
* | | [FRQ 491789]: "setargv() doesn't support a unicode cmdline" implemented for T...nijtmans2010-11-041-10/+26
* | | tclMain.c: make compilable with -DUNICODE as wellnijtmans2010-09-291-24/+72
* | | * generic/tclCmdAH.c: Fix cases where value returned bydgp2010-09-231-1/+2
* | | Unnecessary TCL_STORAGE_CLASS re-definition.nijtmans2010-04-301-4/+1
* | | * generic/tclMain.c (Tcl_Main): [Bug 801429]: Factor out the holding of thedkf2010-02-271-34/+70
* | | Pure whitespace changes, changing to follow Engineering Manual style.dkf2010-02-241-11/+11
* | | TIP #338 IMPLEMENTATIONdgp2008-12-151-118/+29
* | | Reduce the number of (pointless) type-casts.dkf2008-10-021-38/+39
* | | Get rid of pre-C89-isms (esp. CONST vs const).dkf2008-04-271-11/+13
|/ /
* | merge stable branch onto HEADdgp2007-12-131-1/+1
* | * generic/tclMain.c: Corrected the logic of dropping the lastdgp2007-08-211-17/+27
* | corrected botched indentsdgp2007-04-241-38/+38
* | Handle creation of Tcl_Objs from constant strings better (easier to use, moredkf2007-04-101-3/+3
* | whitespacedas2006-11-231-5/+5
* | TIP#270 IMPLEMENTATIONdgp2006-11-151-2/+2
* | * generic/tclBasic.c: Further revised TclAppendPrintToObj() anddgp2006-11-021-2/+2
* | * generic/tclBasic.c: Refactored and renamed the routinesdgp2006-10-311-3/+2
* | * generic/tclMain.c (Tcl_Main): Corrected flaw that requireddgp2006-05-051-111/+111
* | ANSIfy. Also converted some deeply nested code to a less nested form for easi...dkf2005-11-011-46/+43
* | * generic/tcl.h: Fix for bug #1256937 - correctly decoratepatthoyts2005-10-141-2/+2
s/h5_subset.c?h=zzz-gitlab-ci&id=b2d661b508a7fc7a2592c13bc6bdc175551f075d'>examples/h5_subset.c131
-rw-r--r--examples/h5_vds-eiger.c221
-rw-r--r--examples/h5_vds-exc.c296
-rw-r--r--examples/h5_vds-exclim.c287
-rw-r--r--examples/h5_vds-percival-unlim-maxmin.c376
-rw-r--r--examples/h5_vds-percival-unlim.c426
-rw-r--r--examples/h5_vds-percival.c280
-rw-r--r--examples/h5_vds-simpleIO.c167
-rw-r--r--examples/h5_vds.c217
-rw-r--r--examples/h5_write.c38
-rw-r--r--examples/ph5example.c866
-rw-r--r--fortran/src/H5Af.c694
-rw-r--r--fortran/src/H5Df.c1307
-rw-r--r--fortran/src/H5Ef.c98
-rw-r--r--fortran/src/H5Ff.c576
-rw-r--r--fortran/src/H5Gf.c516
-rw-r--r--fortran/src/H5If.c189
-rw-r--r--fortran/src/H5Lf.c516
-rw-r--r--fortran/src/H5Of.c911
-rw-r--r--fortran/src/H5Pf.c3994
-rw-r--r--fortran/src/H5Rf.c270
-rw-r--r--fortran/src/H5Sf.c987
-rw-r--r--fortran/src/H5Tf.c1610
-rw-r--r--fortran/src/H5Zf.c68
-rw-r--r--fortran/src/H5_f.c729
-rw-r--r--fortran/src/H5f90.h6
-rw-r--r--fortran/src/H5f90i.h5
-rw-r--r--fortran/src/H5f90kit.c25
-rw-r--r--fortran/src/H5f90proto.h734
-rw-r--r--fortran/src/H5match_types.c578
-rw-r--r--fortran/test/t.c110
-rw-r--r--fortran/test/t.h22
-rw-r--r--hl/c++/examples/ptExampleFL.cpp51
-rw-r--r--hl/c++/src/H5PacketTable.cpp512
-rw-r--r--hl/c++/src/H5PacketTable.h52
-rw-r--r--hl/c++/test/ptableTest.cpp552
-rw-r--r--hl/examples/ex_ds1.c176
-rw-r--r--hl/examples/ex_image1.c85
-rw-r--r--hl/examples/ex_image2.c274
-rw-r--r--hl/examples/ex_lite1.c27
-rw-r--r--hl/examples/ex_lite2.c50
-rw-r--r--hl/examples/ex_lite3.c70
-rw-r--r--hl/examples/ex_table_01.c189
-rw-r--r--hl/examples/ex_table_02.c180
-rw-r--r--hl/examples/ex_table_03.c187
-rw-r--r--hl/examples/ex_table_04.c246
-rw-r--r--hl/examples/ex_table_05.c242
-rw-r--r--hl/examples/ex_table_06.c123
-rw-r--r--hl/examples/ex_table_07.c155
-rw-r--r--hl/examples/ex_table_08.c205
-rw-r--r--hl/examples/ex_table_09.c210
-rw-r--r--hl/examples/ex_table_10.c196
-rw-r--r--hl/examples/ex_table_11.c164
-rw-r--r--hl/examples/ex_table_12.c148
-rw-r--r--hl/examples/pal_rgb.h7
-rw-r--r--hl/examples/ptExampleFL.c88
-rw-r--r--hl/fortran/src/H5DSfc.c510
-rw-r--r--hl/fortran/src/H5IMcc.c565
-rw-r--r--hl/fortran/src/H5IMcc.h34
-rw-r--r--hl/fortran/src/H5IMfc.c809
-rw-r--r--hl/fortran/src/H5LTf90proto.h494
-rw-r--r--hl/fortran/src/H5LTfc.c1004
-rw-r--r--hl/fortran/src/H5TBfc.c719
-rw-r--r--hl/src/H5DO.c147
-rw-r--r--hl/src/H5DOpublic.h13
-rw-r--r--hl/src/H5DS.c1254
-rw-r--r--hl/src/H5DSprivate.h10
-rw-r--r--hl/src/H5DSpublic.h48
-rw-r--r--hl/src/H5HLprivate2.h1
-rw-r--r--hl/src/H5IM.c1297
-rw-r--r--hl/src/H5IMprivate.h10
-rw-r--r--hl/src/H5IMpublic.h85
-rw-r--r--hl/src/H5LD.c526
-rw-r--r--hl/src/H5LDprivate.h5
-rw-r--r--hl/src/H5LDpublic.h5
-rw-r--r--hl/src/H5LT.c4390
-rw-r--r--hl/src/H5LTanalyze.c3486
-rw-r--r--hl/src/H5LTparse.c3076
-rw-r--r--hl/src/H5LTparse.h139
-rw-r--r--hl/src/H5LTprivate.h23
-rw-r--r--hl/src/H5LTpublic.h349
-rw-r--r--hl/src/H5PT.c885
-rw-r--r--hl/src/H5PTprivate.h1
-rw-r--r--hl/src/H5PTpublic.h28
-rw-r--r--hl/src/H5TB.c3247
-rw-r--r--hl/src/H5TBprivate.h27
-rw-r--r--hl/src/H5TBpublic.h195
-rw-r--r--hl/src/hdf5_hl.h1
-rw-r--r--hl/test/gen_test_ds.c393
-rw-r--r--hl/test/gen_test_ld.c430
-rw-r--r--hl/test/h5hltest.h19
-rw-r--r--hl/test/pal_rgb.h7
-rw-r--r--hl/test/test_ds.c3979
-rw-r--r--hl/test/test_dset_append.c869
-rw-r--r--hl/test/test_file_image.c180
-rw-r--r--hl/test/test_h5do_compat.c90
-rw-r--r--hl/test/test_image.c746
-rw-r--r--hl/test/test_ld.c1268
-rw-r--r--hl/test/test_lite.c2044
-rw-r--r--hl/test/test_packet.c776
-rw-r--r--hl/test/test_packet_vlen.c1068
-rw-r--r--hl/test/test_table.c1815
-rw-r--r--hl/tools/gif2h5/decompress.c176
-rw-r--r--hl/tools/gif2h5/gif.h81
-rw-r--r--hl/tools/gif2h5/gif2hdf.c46
-rw-r--r--hl/tools/gif2h5/gif2mem.c181
-rw-r--r--hl/tools/gif2h5/gifread.c311
-rw-r--r--hl/tools/gif2h5/h52gifgentst.c66
-rw-r--r--hl/tools/gif2h5/hdf2gif.c229
-rw-r--r--hl/tools/gif2h5/hdfgifwr.c217
-rw-r--r--hl/tools/gif2h5/writehdf.c57
-rw-r--r--hl/tools/h5watch/extend_dset.c292
-rw-r--r--hl/tools/h5watch/h5watch.c556
-rw-r--r--hl/tools/h5watch/h5watchgentest.c275
-rw-r--r--hl/tools/h5watch/swmr_check_compat_vfd.c8
-rw-r--r--java/src/jni/exceptionImp.c135
-rw-r--r--java/src/jni/exceptionImp.h25
-rw-r--r--java/src/jni/h5Constants.c3264
-rw-r--r--java/src/jni/h5Imp.c44
-rw-r--r--java/src/jni/h5Imp.h33
-rw-r--r--java/src/jni/h5aImp.c594
-rw-r--r--java/src/jni/h5aImp.h220
-rw-r--r--java/src/jni/h5dImp.c662
-rw-r--r--java/src/jni/h5dImp.h182
-rw-r--r--java/src/jni/h5eImp.c112
-rw-r--r--java/src/jni/h5eImp.h70
-rw-r--r--java/src/jni/h5fImp.c165
-rw-r--r--java/src/jni/h5fImp.h122
-rw-r--r--java/src/jni/h5gImp.c68
-rw-r--r--java/src/jni/h5gImp.h44
-rw-r--r--java/src/jni/h5iImp.c65
-rw-r--r--java/src/jni/h5iImp.h60
-rw-r--r--java/src/jni/h5jni.h498
-rw-r--r--java/src/jni/h5lImp.c283
-rw-r--r--java/src/jni/h5lImp.h90
-rw-r--r--java/src/jni/h5oImp.c324
-rw-r--r--java/src/jni/h5oImp.h116
-rw-r--r--java/src/jni/h5pDAPLImp.c93
-rw-r--r--java/src/jni/h5pDAPLImp.h39
-rw-r--r--java/src/jni/h5pDCPLImp.c470
-rw-r--r--java/src/jni/h5pDCPLImp.h174
-rw-r--r--java/src/jni/h5pDXPLImp.c110
-rw-r--r--java/src/jni/h5pDXPLImp.h60
-rw-r--r--java/src/jni/h5pFAPLImp.c515
-rw-r--r--java/src/jni/h5pFAPLImp.h210
-rw-r--r--java/src/jni/h5pFCPLImp.c174
-rw-r--r--java/src/jni/h5pFCPLImp.h87
-rw-r--r--java/src/jni/h5pGCPLImp.c54
-rw-r--r--java/src/jni/h5pGCPLImp.h32
-rw-r--r--java/src/jni/h5pImp.c371
-rw-r--r--java/src/jni/h5pImp.h111
-rw-r--r--java/src/jni/h5pLAPLImp.c45
-rw-r--r--java/src/jni/h5pLAPLImp.h32
-rw-r--r--java/src/jni/h5pOCPLImp.c38
-rw-r--r--java/src/jni/h5pOCPLImp.h33
-rw-r--r--java/src/jni/h5pOCpyPLImp.c6
-rw-r--r--java/src/jni/h5pOCpyPLImp.h8
-rw-r--r--java/src/jni/h5pStrCPLImp.c6
-rw-r--r--java/src/jni/h5pStrCPLImp.h8
-rw-r--r--java/src/jni/h5plImp.c53
-rw-r--r--java/src/jni/h5plImp.h36
-rw-r--r--java/src/jni/h5rImp.c274
-rw-r--r--java/src/jni/h5rImp.h86
-rw-r--r--java/src/jni/h5sImp.c458
-rw-r--r--java/src/jni/h5sImp.h133
-rw-r--r--java/src/jni/h5tImp.c423
-rw-r--r--java/src/jni/h5tImp.h277
-rw-r--r--java/src/jni/h5util.c1351
-rw-r--r--java/src/jni/h5util.h78
-rw-r--r--java/src/jni/h5vlImp.c59
-rw-r--r--java/src/jni/h5vlImp.h43
-rw-r--r--java/src/jni/h5zImp.c12
-rw-r--r--java/src/jni/h5zImp.h12
-rw-r--r--java/src/jni/nativeData.c486
-rw-r--r--java/src/jni/nativeData.h95
-rw-r--r--src/H5.c527
-rw-r--r--src/H5A.c691
-rw-r--r--src/H5AC.c1102
-rw-r--r--src/H5ACdbg.c63
-rw-r--r--src/H5ACmodule.h7
-rw-r--r--src/H5ACmpio.c768
-rw-r--r--src/H5ACpkg.h87
-rw-r--r--src/H5ACprivate.h311
-rw-r--r--src/H5ACproxy_entry.c222
-rw-r--r--src/H5ACpublic.h86
-rw-r--r--src/H5Abtree2.c182
-rw-r--r--src/H5Adense.c1051
-rw-r--r--src/H5Adeprec.c158
-rw-r--r--src/H5Aint.c1115
-rw-r--r--src/H5Amodule.h7
-rw-r--r--src/H5Apkg.h202
-rw-r--r--src/H5Aprivate.h39
-rw-r--r--src/H5Apublic.h93
-rw-r--r--src/H5Atest.c51
-rw-r--r--src/H5B.c1207
-rw-r--r--src/H5B2.c757
-rw-r--r--src/H5B2cache.c537
-rw-r--r--src/H5B2dbg.c186
-rw-r--r--src/H5B2hdr.c284
-rw-r--r--src/H5B2int.c1298
-rw-r--r--src/H5B2internal.c837
-rw-r--r--src/H5B2leaf.c505
-rw-r--r--src/H5B2module.h8
-rw-r--r--src/H5B2pkg.h451
-rw-r--r--src/H5B2private.h122
-rw-r--r--src/H5B2stat.c33
-rw-r--r--src/H5B2test.c201
-rw-r--r--src/H5Bcache.c145
-rw-r--r--src/H5Bdbg.c152
-rw-r--r--src/H5Bmodule.h7
-rw-r--r--src/H5Bpkg.h36
-rw-r--r--src/H5Bprivate.h127
-rw-r--r--src/H5C.c11252
-rw-r--r--src/H5CS.c84
-rw-r--r--src/H5CSprivate.h9
-rw-r--r--src/H5CX.c1265
-rw-r--r--src/H5CXmodule.h7
-rw-r--r--src/H5CXprivate.h71
-rw-r--r--src/H5Cdbg.c1028
-rw-r--r--src/H5Cepoch.c110
-rw-r--r--src/H5Cimage.c1811
-rw-r--r--src/H5Clog.c276
-rw-r--r--src/H5Clog.h99
-rw-r--r--src/H5Clog_json.c506
-rw-r--r--src/H5Clog_trace.c390
-rw-r--r--src/H5Cmodule.h7
-rw-r--r--src/H5Cmpio.c767
-rw-r--r--src/H5Cpkg.h1
-rw-r--r--src/H5Cprefetched.c141
-rw-r--r--src/H5Cprivate.h618
-rw-r--r--src/H5Cpublic.h15
-rw-r--r--src/H5Cquery.c148
-rw-r--r--src/H5Ctag.c269
-rw-r--r--src/H5Ctest.c52
-rw-r--r--src/H5D.c405
-rw-r--r--src/H5Dbtree.c616
-rw-r--r--src/H5Dbtree2.c641
-rw-r--r--src/H5Dchunk.c3988
-rw-r--r--src/H5Dcompact.c276
-rw-r--r--src/H5Dcontig.c813
-rw-r--r--src/H5Ddbg.c37
-rw-r--r--src/H5Ddeprec.c139
-rw-r--r--src/H5Dearray.c683
-rw-r--r--src/H5Defl.c265
-rw-r--r--src/H5Dfarray.c611
-rw-r--r--src/H5Dfill.c305
-rw-r--r--src/H5Dint.c1890
-rw-r--r--src/H5Dio.c675
-rw-r--r--src/H5Dlayout.c303
-rw-r--r--src/H5Dmodule.h7
-rw-r--r--src/H5Dmpio.c1856
-rw-r--r--src/H5Dnone.c158
-rw-r--r--src/H5Doh.c198
-rw-r--r--src/H5Dpkg.h791
-rw-r--r--src/H5Dprivate.h166
-rw-r--r--src/H5Dpublic.h176
-rw-r--r--src/H5Dscatgath.c623
-rw-r--r--src/H5Dselect.c179
-rw-r--r--src/H5Dsingle.c194
-rw-r--r--src/H5Dtest.c84
-rw-r--r--src/H5Dvirtual.c1848
-rw-r--r--src/H5E.c551
-rw-r--r--src/H5EA.c1327
-rw-r--r--src/H5EAcache.c2681
-rw-r--r--src/H5EAdbg.c631
-rw-r--r--src/H5EAdblkpage.c311
-rw-r--r--src/H5EAdblock.c551
-rw-r--r--src/H5EAhdr.c755
-rw-r--r--src/H5EAiblock.c562
-rw-r--r--src/H5EAint.c59
-rw-r--r--src/H5EAmodule.h7
-rw-r--r--src/H5EApkg.h467
-rw-r--r--src/H5EAprivate.h97
-rw-r--r--src/H5EAsblock.c467
-rw-r--r--src/H5EAstat.c44
-rw-r--r--src/H5EAtest.c377
-rw-r--r--src/H5ESpublic.h12
-rw-r--r--src/H5Edeprec.c130
-rw-r--r--src/H5Eint.c388
-rw-r--r--src/H5Emodule.h8
-rw-r--r--src/H5Epkg.h80
-rw-r--r--src/H5Eprivate.h142
-rw-r--r--src/H5Epublic.h195
-rw-r--r--src/H5F.c695
-rw-r--r--src/H5FA.c931
-rw-r--r--src/H5FAcache.c1425
-rw-r--r--src/H5FAdbg.c358
-rw-r--r--src/H5FAdblkpage.c290
-rw-r--r--src/H5FAdblock.c483
-rw-r--r--src/H5FAhdr.c503
-rw-r--r--src/H5FAint.c59
-rw-r--r--src/H5FAmodule.h7
-rw-r--r--src/H5FApkg.h268
-rw-r--r--src/H5FAprivate.h82
-rw-r--r--src/H5FAstat.c44
-rw-r--r--src/H5FAtest.c286
-rw-r--r--src/H5FD.c548
-rw-r--r--src/H5FDcore.c851
-rw-r--r--src/H5FDcore.h11
-rw-r--r--src/H5FDdirect.c954
-rw-r--r--src/H5FDdirect.h20
-rw-r--r--src/H5FDdrvr_module.h7
-rw-r--r--src/H5FDfamily.c661
-rw-r--r--src/H5FDfamily.h11
-rw-r--r--src/H5FDhdfs.c554
-rw-r--r--src/H5FDhdfs.h11
-rw-r--r--src/H5FDint.c146
-rw-r--r--src/H5FDlog.c1006
-rw-r--r--src/H5FDlog.h53
-rw-r--r--src/H5FDmirror.c727
-rw-r--r--src/H5FDmirror.h9
-rw-r--r--src/H5FDmirror_priv.h36
-rw-r--r--src/H5FDmodule.h7
-rw-r--r--src/H5FDmpi.c89
-rw-r--r--src/H5FDmpi.h9
-rw-r--r--src/H5FDmpio.c790
-rw-r--r--src/H5FDmpio.h12
-rw-r--r--src/H5FDmulti.c1354
-rw-r--r--src/H5FDmulti.h20
-rw-r--r--src/H5FDpkg.h11
-rw-r--r--src/H5FDprivate.h130
-rw-r--r--src/H5FDpublic.h437
-rw-r--r--src/H5FDros3.c511
-rw-r--r--src/H5FDros3.h17
-rw-r--r--src/H5FDs3comms.c1198
-rw-r--r--src/H5FDs3comms.h148
-rw-r--r--src/H5FDsec2.c516
-rw-r--r--src/H5FDsec2.h5
-rw-r--r--src/H5FDspace.c153
-rw-r--r--src/H5FDsplitter.c538
-rw-r--r--src/H5FDsplitter.h15
-rw-r--r--src/H5FDstdio.c615
-rw-r--r--src/H5FDstdio.h4
-rw-r--r--src/H5FDtest.c19
-rw-r--r--src/H5FDwindows.c28
-rw-r--r--src/H5FDwindows.h3
-rw-r--r--src/H5FL.c871
-rw-r--r--src/H5FLmodule.h7
-rw-r--r--src/H5FLprivate.h301
-rw-r--r--src/H5FO.c138
-rw-r--r--src/H5FOprivate.h29
-rw-r--r--src/H5FS.c572
-rw-r--r--src/H5FScache.c524
-rw-r--r--src/H5FSdbg.c132
-rw-r--r--src/H5FSint.c35
-rw-r--r--src/H5FSmodule.h7
-rw-r--r--src/H5FSpkg.h197
-rw-r--r--src/H5FSprivate.h242
-rw-r--r--src/H5FSsection.c1122
-rw-r--r--src/H5FSstat.c35
-rw-r--r--src/H5FStest.c50
-rw-r--r--src/H5Faccum.c534
-rw-r--r--src/H5Fcwfs.c132
-rw-r--r--src/H5Fdbg.c89
-rw-r--r--src/H5Fdeprec.c72
-rw-r--r--src/H5Fefc.c343
-rw-r--r--src/H5Ffake.c32
-rw-r--r--src/H5Fint.c1592
-rw-r--r--src/H5Fio.c128
-rw-r--r--src/H5Fmodule.h7
-rw-r--r--src/H5Fmount.c351
-rw-r--r--src/H5Fmpi.c87
-rw-r--r--src/H5Fpkg.h498
-rw-r--r--src/H5Fprivate.h1175
-rw-r--r--src/H5Fpublic.h295
-rw-r--r--src/H5Fquery.c111
-rw-r--r--src/H5Fsfile.c53
-rw-r--r--src/H5Fspace.c50
-rw-r--r--src/H5Fsuper.c839
-rw-r--r--src/H5Fsuper_cache.c542
-rw-r--r--src/H5Ftest.c93
-rw-r--r--src/H5G.c298
-rw-r--r--src/H5Gbtree2.c153
-rw-r--r--src/H5Gcache.c111
-rw-r--r--src/H5Gcompact.c205
-rw-r--r--src/H5Gdense.c803
-rw-r--r--src/H5Gdeprec.c544
-rw-r--r--src/H5Gent.c197
-rw-r--r--src/H5Gint.c558
-rw-r--r--src/H5Glink.c187
-rw-r--r--src/H5Gloc.c431
-rw-r--r--src/H5Gmodule.h7
-rw-r--r--src/H5Gname.c585
-rw-r--r--src/H5Gnode.c662
-rw-r--r--src/H5Gobj.c570
-rw-r--r--src/H5Goh.c176
-rw-r--r--src/H5Gpkg.h382
-rw-r--r--src/H5Gprivate.h229
-rw-r--r--src/H5Gpublic.h135
-rw-r--r--src/H5Groot.c200
-rw-r--r--src/H5Gstab.c439
-rw-r--r--src/H5Gtest.c383
-rw-r--r--src/H5Gtraverse.c446
-rw-r--r--src/H5HF.c301
-rw-r--r--src/H5HFbtree2.c271
-rw-r--r--src/H5HFcache.c1377
-rw-r--r--src/H5HFdbg.c499
-rw-r--r--src/H5HFdblock.c334
-rw-r--r--src/H5HFdtable.c120
-rw-r--r--src/H5HFhdr.c628
-rw-r--r--src/H5HFhuge.c437
-rw-r--r--src/H5HFiblock.c909
-rw-r--r--src/H5HFiter.c229
-rw-r--r--src/H5HFman.c262
-rw-r--r--src/H5HFmodule.h7
-rw-r--r--src/H5HFpkg.h869
-rw-r--r--src/H5HFprivate.h113
-rw-r--r--src/H5HFsection.c1897
-rw-r--r--src/H5HFspace.c177
-rw-r--r--src/H5HFstat.c74
-rw-r--r--src/H5HFtest.c122
-rw-r--r--src/H5HFtiny.c102
-rw-r--r--src/H5HG.c330
-rw-r--r--src/H5HGcache.c154
-rw-r--r--src/H5HGdbg.c125
-rw-r--r--src/H5HGmodule.h7
-rw-r--r--src/H5HGpkg.h71
-rw-r--r--src/H5HGprivate.h38
-rw-r--r--src/H5HGquery.c21
-rw-r--r--src/H5HL.c1286
-rw-r--r--src/H5HLcache.c313
-rw-r--r--src/H5HLdbg.c150
-rw-r--r--src/H5HLdblk.c273
-rw-r--r--src/H5HLint.c138
-rw-r--r--src/H5HLmodule.h7
-rw-r--r--src/H5HLpkg.h96
-rw-r--r--src/H5HLprfx.c96
-rw-r--r--src/H5HLprivate.h28
-rw-r--r--src/H5HP.c395
-rw-r--r--src/H5HPprivate.h23
-rw-r--r--src/H5I.c763
-rw-r--r--src/H5Imodule.h7
-rw-r--r--src/H5Ipkg.h14
-rw-r--r--src/H5Iprivate.h63
-rw-r--r--src/H5Ipublic.h77
-rw-r--r--src/H5Itest.c51
-rw-r--r--src/H5L.c1630
-rw-r--r--src/H5Ldeprec.c312
-rw-r--r--src/H5Lexternal.c309
-rw-r--r--src/H5Lmodule.h8
-rw-r--r--src/H5Lpkg.h53
-rw-r--r--src/H5Lprivate.h77
-rw-r--r--src/H5Lpublic.h236
-rw-r--r--src/H5M.c364
-rw-r--r--src/H5MF.c1606
-rw-r--r--src/H5MFaggr.c1361
-rw-r--r--src/H5MFdbg.c158
-rw-r--r--src/H5MFmodule.h7
-rw-r--r--src/H5MFpkg.h141
-rw-r--r--src/H5MFprivate.h20
-rw-r--r--src/H5MFsection.c454
-rw-r--r--src/H5MM.c204
-rw-r--r--src/H5MMprivate.h27
-rw-r--r--src/H5MMpublic.h1
-rw-r--r--src/H5MP.c186
-rw-r--r--src/H5MPmodule.h7
-rw-r--r--src/H5MPpkg.h45
-rw-r--r--src/H5MPprivate.h15
-rw-r--r--src/H5MPtest.c42
-rw-r--r--src/H5Mmodule.h8
-rw-r--r--src/H5Mpkg.h4
-rw-r--r--src/H5Mprivate.h33
-rw-r--r--src/H5Mpublic.h75
-rw-r--r--src/H5O.c619
-rw-r--r--src/H5Oainfo.c221
-rw-r--r--src/H5Oalloc.c1457
-rw-r--r--src/H5Oattr.c412
-rw-r--r--src/H5Oattribute.c902
-rw-r--r--src/H5Obogus.c134
-rw-r--r--src/H5Obtreek.c120
-rw-r--r--src/H5Ocache.c668
-rw-r--r--src/H5Ocache_image.c147
-rw-r--r--src/H5Ochunk.c131
-rw-r--r--src/H5Ocont.c109
-rw-r--r--src/H5Ocopy.c859
-rw-r--r--src/H5Ocopy_ref.c299
-rw-r--r--src/H5Odbg.c319
-rw-r--r--src/H5Odeprec.c543
-rw-r--r--src/H5Odrvinfo.c132
-rw-r--r--src/H5Odtype.c1319
-rw-r--r--src/H5Oefl.c316
-rw-r--r--src/H5Ofill.c535
-rw-r--r--src/H5Oflush.c187
-rw-r--r--src/H5Ofsinfo.c216
-rw-r--r--src/H5Oginfo.c171
-rw-r--r--src/H5Oint.c1099
-rw-r--r--src/H5Olayout.c606
-rw-r--r--src/H5Olinfo.c271
-rw-r--r--src/H5Olink.c421
-rw-r--r--src/H5Omessage.c735
-rw-r--r--src/H5Omodule.h7
-rw-r--r--src/H5Omtime.c217
-rw-r--r--src/H5Oname.c121
-rw-r--r--src/H5Onull.c49
-rw-r--r--src/H5Opkg.h560
-rw-r--r--src/H5Opline.c410
-rw-r--r--src/H5Oprivate.h872
-rw-r--r--src/H5Opublic.h284
-rw-r--r--src/H5Orefcount.c125
-rw-r--r--src/H5Osdspace.c311
-rw-r--r--src/H5Oshared.c278
-rw-r--r--src/H5Oshared.h135
-rw-r--r--src/H5Oshmesg.c99
-rw-r--r--src/H5Ostab.c184
-rw-r--r--src/H5Otest.c376
-rw-r--r--src/H5Ounknown.c54
-rw-r--r--src/H5P.c531
-rw-r--r--src/H5PB.c738
-rw-r--r--src/H5PBmodule.h6
-rw-r--r--src/H5PBpkg.h17
-rw-r--r--src/H5PBprivate.h59
-rw-r--r--src/H5PL.c66
-rw-r--r--src/H5PLextern.h11
-rw-r--r--src/H5PLint.c102
-rw-r--r--src/H5PLmodule.h8
-rw-r--r--src/H5PLpath.c164
-rw-r--r--src/H5PLpkg.h106
-rw-r--r--src/H5PLplugin_cache.c89
-rw-r--r--src/H5PLprivate.h15
-rw-r--r--src/H5PLpublic.h35
-rw-r--r--src/H5Pacpl.c32
-rw-r--r--src/H5Pdapl.c649
-rw-r--r--src/H5Pdcpl.c2023
-rw-r--r--src/H5Pdeprec.c184
-rw-r--r--src/H5Pdxpl.c906
-rw-r--r--src/H5Pencdec.c228
-rw-r--r--src/H5Pfapl.c2615
-rw-r--r--src/H5Pfcpl.c695
-rw-r--r--src/H5Pfmpl.c65
-rw-r--r--src/H5Pgcpl.c252
-rw-r--r--src/H5Pint.c2375
-rw-r--r--src/H5Plapl.c529
-rw-r--r--src/H5Plcpl.c92
-rw-r--r--src/H5Pmapl.c120
-rw-r--r--src/H5Pmcpl.c55
-rw-r--r--src/H5Pmodule.h7
-rw-r--r--src/H5Pocpl.c748
-rw-r--r--src/H5Pocpypl.c364
-rw-r--r--src/H5Ppkg.h163
-rw-r--r--src/H5Pprivate.h170
-rw-r--r--src/H5Ppublic.h561
-rw-r--r--src/H5Pstrcpl.c104
-rw-r--r--src/H5Ptest.c36
-rw-r--r--src/H5R.c501
-rw-r--r--src/H5RS.c70
-rw-r--r--src/H5RSprivate.h13
-rw-r--r--src/H5Rdeprec.c413
-rw-r--r--src/H5Rint.c625
-rw-r--r--src/H5Rmodule.h7
-rw-r--r--src/H5Rpkg.h99
-rw-r--r--src/H5Rprivate.h8
-rw-r--r--src/H5Rpublic.h61
-rw-r--r--src/H5S.c647
-rw-r--r--src/H5SL.c1232
-rw-r--r--src/H5SLmodule.h7
-rw-r--r--src/H5SLprivate.h40
-rw-r--r--src/H5SM.c1310
-rw-r--r--src/H5SMbtree2.c77
-rw-r--r--src/H5SMcache.c261
-rw-r--r--src/H5SMmessage.c111
-rw-r--r--src/H5SMmodule.h7
-rw-r--r--src/H5SMpkg.h177
-rw-r--r--src/H5SMprivate.h36
-rw-r--r--src/H5SMtest.c45
-rw-r--r--src/H5ST.c186
-rw-r--r--src/H5STprivate.h35
-rw-r--r--src/H5Sall.c187
-rw-r--r--src/H5Sdbg.c34
-rw-r--r--src/H5Sdeprec.c34
-rw-r--r--src/H5Shyper.c5545
-rw-r--r--src/H5Smodule.h7
-rw-r--r--src/H5Smpio.c925
-rw-r--r--src/H5Snone.c170
-rw-r--r--src/H5Spkg.h265
-rw-r--r--src/H5Spoint.c781
-rw-r--r--src/H5Sprivate.h344
-rw-r--r--src/H5Spublic.h247
-rw-r--r--src/H5Sselect.c1030
-rw-r--r--src/H5Stest.c136
-rw-r--r--src/H5T.c3736
-rw-r--r--src/H5TS.c98
-rw-r--r--src/H5TSprivate.h110
-rw-r--r--src/H5Tarray.c146
-rw-r--r--src/H5Tbit.c138
-rw-r--r--src/H5Tcommit.c512
-rw-r--r--src/H5Tcompound.c231
-rw-r--r--src/H5Tconv.c6330
-rw-r--r--src/H5Tcset.c49
-rw-r--r--src/H5Tdbg.c106
-rw-r--r--src/H5Tdeprec.c85
-rw-r--r--src/H5Tenum.c304
-rw-r--r--src/H5Tfields.c350
-rw-r--r--src/H5Tfixed.c42
-rw-r--r--src/H5Tfloat.c202
-rw-r--r--src/H5Tmodule.h7
-rw-r--r--src/H5Tnative.c1013
-rw-r--r--src/H5Toffset.c89
-rw-r--r--src/H5Toh.c88
-rw-r--r--src/H5Topaque.c35
-rw-r--r--src/H5Torder.c117
-rw-r--r--src/H5Tpad.c33
-rw-r--r--src/H5Tpkg.h1472
-rw-r--r--src/H5Tprecis.c95
-rw-r--r--src/H5Tprivate.h124
-rw-r--r--src/H5Tpublic.h586
-rw-r--r--src/H5Tref.c604
-rw-r--r--src/H5Tstrpad.c37
-rw-r--r--src/H5Tvisit.c60
-rw-r--r--src/H5Tvlen.c349
-rw-r--r--src/H5UC.c26
-rw-r--r--src/H5UCprivate.h14
-rw-r--r--src/H5VL.c238
-rw-r--r--src/H5VLcallback.c3223
-rw-r--r--src/H5VLconnector.h382
-rw-r--r--src/H5VLconnector_passthru.h193
-rw-r--r--src/H5VLint.c830
-rw-r--r--src/H5VLmodule.h7
-rw-r--r--src/H5VLnative.c322
-rw-r--r--src/H5VLnative.h112
-rw-r--r--src/H5VLnative_attr.c626
-rw-r--r--src/H5VLnative_blob.c171
-rw-r--r--src/H5VLnative_dataset.c710
-rw-r--r--src/H5VLnative_datatype.c154
-rw-r--r--src/H5VLnative_file.c1065
-rw-r--r--src/H5VLnative_group.c296
-rw-r--r--src/H5VLnative_introspect.c10
-rw-r--r--src/H5VLnative_link.c480
-rw-r--r--src/H5VLnative_object.c790
-rw-r--r--src/H5VLnative_private.h148
-rw-r--r--src/H5VLnative_token.c34
-rw-r--r--src/H5VLpassthru.c1277
-rw-r--r--src/H5VLpassthru.h16
-rw-r--r--src/H5VLpkg.h35
-rw-r--r--src/H5VLprivate.h212
-rw-r--r--src/H5VLpublic.h70
-rw-r--r--src/H5VM.c701
-rw-r--r--src/H5VMprivate.h313
-rw-r--r--src/H5WB.c63
-rw-r--r--src/H5WBprivate.h10
-rw-r--r--src/H5Z.c564
-rw-r--r--src/H5Zdeflate.c169
-rw-r--r--src/H5Zfletcher32.c93
-rw-r--r--src/H5Zmodule.h7
-rw-r--r--src/H5Znbit.c1302
-rw-r--r--src/H5Zpkg.h3
-rw-r--r--src/H5Zprivate.h80
-rw-r--r--src/H5Zpublic.h132
-rw-r--r--src/H5Zscaleoffset.c2190
-rw-r--r--src/H5Zshuffle.c308
-rw-r--r--src/H5Zszip.c217
-rw-r--r--src/H5Ztrans.c1358
-rw-r--r--src/H5api_adpt.h325
-rw-r--r--src/H5checksum.c210
-rw-r--r--src/H5dbg.c45
-rw-r--r--src/H5detect.c1135
-rw-r--r--src/H5make_libsettings.c96
-rw-r--r--src/H5mpi.c137
-rw-r--r--src/H5private.h2630
-rw-r--r--src/H5public.h367
-rw-r--r--src/H5system.c400
-rw-r--r--src/H5timer.c148
-rw-r--r--src/H5trace.c1379
-rw-r--r--src/H5win32defs.h245
-rw-r--r--src/hdf5.h68
-rw-r--r--test/H5srcdir.h1
-rw-r--r--test/accum.c1352
-rw-r--r--test/accum_swmr_reader.c72
-rw-r--r--test/app_ref.c122
-rw-r--r--test/atomic_reader.c121
-rw-r--r--test/atomic_writer.c63
-rw-r--r--test/big.c497
-rw-r--r--test/bittests.c1205
-rw-r--r--test/btree2.c6008
-rw-r--r--test/cache.c36105
-rw-r--r--test/cache_api.c1833
-rw-r--r--test/cache_common.c3889
-rw-r--r--test/cache_common.h1209
-rw-r--r--test/cache_image.c4115
-rw-r--r--test/cache_logging.c101
-rw-r--r--test/cache_tagging.c3034
-rw-r--r--test/chunk_info.c1312
-rw-r--r--test/cmpd_dset.c1952
-rw-r--r--test/cork.c1471
-rw-r--r--test/cross_read.c189
-rw-r--r--test/dangle.c392
-rw-r--r--test/del_many_dense_attrs.c96
-rw-r--r--test/direct_chunk.c1585
-rw-r--r--test/dsets.c12383
-rw-r--r--test/dt_arith.c5414
-rw-r--r--test/dtransform.c960
-rw-r--r--test/dtypes.c6286
-rw-r--r--test/earray.c1475
-rw-r--r--test/efc.c2718
-rw-r--r--test/enc_dec_plist.c452
-rw-r--r--test/enc_dec_plist_cross_platform.c101
-rw-r--r--test/enum.c710
-rw-r--r--test/err_compat.c241
-rw-r--r--test/error_test.c215
-rw-r--r--test/evict_on_close.c515
-rw-r--r--test/extend.c261
-rw-r--r--test/external.c935
-rw-r--r--test/external_common.c49
-rw-r--r--test/external_common.h9
-rw-r--r--test/external_env.c117
-rw-r--r--test/external_fname.h12
-rw-r--r--test/farray.c771
-rw-r--r--test/fheap.c9929
-rw-r--r--test/file_image.c634
-rw-r--r--test/filenotclosed.c65
-rw-r--r--test/fillval.c2434
-rw-r--r--test/filter_fail.c279
-rw-r--r--test/filter_plugin.c328
-rw-r--r--test/filter_plugin1_dsets.c47
-rw-r--r--test/filter_plugin2_dsets.c46
-rw-r--r--test/filter_plugin3_dsets.c55
-rw-r--r--test/filter_plugin4_groups.c56
-rw-r--r--test/flush1.c183
-rw-r--r--test/flush2.c209
-rw-r--r--test/flushrefresh.c1067
-rw-r--r--test/freespace.c1947
-rw-r--r--test/gen_bad_compound.c22
-rw-r--r--test/gen_bad_offset.c69
-rw-r--r--test/gen_bad_ohdr.c66
-rw-r--r--test/gen_bogus.c107
-rw-r--r--test/gen_bounds.c764
-rw-r--r--test/gen_cross.c672
-rw-r--r--test/gen_deflate.c61
-rw-r--r--test/gen_file_image.c44
-rw-r--r--test/gen_filespace.c79
-rw-r--r--test/gen_filters.c180
-rw-r--r--test/gen_mergemsg.c50
-rw-r--r--test/gen_new_array.c68
-rw-r--r--test/gen_new_fill.c87
-rw-r--r--test/gen_new_group.c76
-rw-r--r--test/gen_new_mtime.c13
-rw-r--r--test/gen_new_super.c16
-rw-r--r--test/gen_noencoder.c29
-rw-r--r--test/gen_nullspace.c20
-rw-r--r--test/gen_old_array.c71
-rw-r--r--test/gen_old_group.c26
-rw-r--r--test/gen_old_layout.c30
-rw-r--r--test/gen_old_mtime.c14
-rw-r--r--test/gen_plist.c383
-rw-r--r--test/gen_sizes_lheap.c15
-rw-r--r--test/gen_specmetaread.c26
-rw-r--r--test/gen_udlinks.c104
-rw-r--r--test/genall5.c1189
-rw-r--r--test/genall5.h4
-rw-r--r--test/getname.c3369
-rw-r--r--test/gheap.c317
-rw-r--r--test/h5test.c834
-rw-r--r--test/h5test.h271
-rw-r--r--test/hdfs.c754
-rw-r--r--test/hyperslab.c863
-rw-r--r--test/istore.c512
-rw-r--r--test/lheap.c103
-rw-r--r--test/links.c18310
-rw-r--r--test/links_env.c108
-rw-r--r--test/mf.c4637
-rw-r--r--test/mirror_vfd.c1213
-rw-r--r--test/mount.c3241
-rw-r--r--test/mtime.c117
-rw-r--r--test/ntypes.c2230
-rw-r--r--test/null_vol_connector.c210
-rw-r--r--test/null_vol_connector.h5
-rw-r--r--test/objcopy.c13502
-rw-r--r--test/objcopy_ref.c1584
-rw-r--r--test/ohdr.c1575
-rw-r--r--test/page_buffer.c1294
-rw-r--r--test/pool.c368
-rw-r--r--test/reserved.c363
-rw-r--r--test/ros3.c882
-rw-r--r--test/s3comms.c1661
-rw-r--r--test/set_extent.c1886
-rw-r--r--test/space_overflow.c15
-rw-r--r--test/stab.c1093
-rw-r--r--test/swmr.c4235
-rw-r--r--test/swmr_addrem_writer.c182
-rw-r--r--test/swmr_check_compat_vfd.c7
-rw-r--r--test/swmr_common.c87
-rw-r--r--test/swmr_common.h32
-rw-r--r--test/swmr_generator.c173
-rw-r--r--test/swmr_reader.c240
-rw-r--r--test/swmr_remove_reader.c227
-rw-r--r--test/swmr_remove_writer.c150
-rw-r--r--test/swmr_sparse_reader.c188
-rw-r--r--test/swmr_sparse_writer.c194
-rw-r--r--test/swmr_start_write.c253
-rw-r--r--test/swmr_writer.c186
-rw-r--r--test/tarray.c1164
-rw-r--r--test/tattr.c3760
-rw-r--r--test/tcheck_version.c70
-rw-r--r--test/tchecksum.c44
-rw-r--r--test/tconfig.c47
-rw-r--r--test/tcoords.c392
-rw-r--r--test/testframe.c331
-rw-r--r--test/testhdf5.c45
-rw-r--r--test/testhdf5.h274
-rw-r--r--test/testmeta.c108
-rw-r--r--test/tfile.c2620
-rw-r--r--test/tgenprop.c783
-rw-r--r--test/th5o.c400
-rw-r--r--test/th5s.c1283
-rw-r--r--test/theap.c516
-rw-r--r--test/thread_id.c56
-rw-r--r--test/tid.c365
-rw-r--r--test/timer.c151
-rw-r--r--test/titerate.c560
-rw-r--r--test/tmeta.c106
-rw-r--r--test/tmisc.c2169
-rw-r--r--test/trefer.c949
-rw-r--r--test/trefer_deprec.c627
-rw-r--r--test/trefer_shutdown.c2
-rw-r--r--test/trefstr.c167
-rw-r--r--test/tselect.c12065
-rw-r--r--test/tskiplist.c1007
-rw-r--r--test/tsohm.c1459
-rw-r--r--test/ttime.c96
-rw-r--r--test/ttsafe.c42
-rw-r--r--test/ttsafe.h26
-rw-r--r--test/ttsafe_acreate.c72
-rw-r--r--test/ttsafe_attr_vlen.c53
-rw-r--r--test/ttsafe_cancel.c117
-rw-r--r--test/ttsafe_dcreate.c82
-rw-r--r--test/ttsafe_error.c68
-rw-r--r--test/ttst.c220
-rw-r--r--test/tunicode.c1128
-rw-r--r--test/tvlstr.c382
-rw-r--r--test/tvltypes.c1793
-rw-r--r--test/twriteorder.c237
-rw-r--r--test/unlink.c2406
-rw-r--r--test/unregister.c182
-rw-r--r--test/use.h66
-rw-r--r--test/use_append_chunk.c51
-rw-r--r--test/use_append_chunk_mirror.c74
-rw-r--r--test/use_append_mchunks.c57
-rw-r--r--test/use_common.c306
-rw-r--r--test/use_disable_mdc_flushes.c483
-rw-r--r--test/vds.c8414
-rw-r--r--test/vds_env.c234
-rw-r--r--test/vds_swmr.h20
-rw-r--r--test/vds_swmr_gen.c157
-rw-r--r--test/vds_swmr_reader.c98
-rw-r--r--test/vds_swmr_writer.c98
-rw-r--r--test/vfd.c1686
-rw-r--r--test/vol.c485
-rw-r--r--test/vol_plugin.c167
-rw-r--r--testpar/t_2Gio.c2758
-rw-r--r--testpar/t_bigio.c1801
-rw-r--r--testpar/t_cache.c5147
-rw-r--r--testpar/t_cache_image.c2460
-rw-r--r--testpar/t_chunk_alloc.c243
-rw-r--r--testpar/t_coll_chunk.c1191
-rw-r--r--testpar/t_coll_md_read.c211
-rw-r--r--testpar/t_dset.c2481
-rw-r--r--testpar/t_file.c474
-rw-r--r--testpar/t_file_image.c285
-rw-r--r--testpar/t_filter_read.c406
-rw-r--r--testpar/t_filters_parallel.c3533
-rw-r--r--testpar/t_filters_parallel.h301
-rw-r--r--testpar/t_init_term.c31
-rw-r--r--testpar/t_mdset.c1675
-rw-r--r--testpar/t_mpi.c618
-rw-r--r--testpar/t_pflush1.c105
-rw-r--r--testpar/t_pflush2.c115
-rw-r--r--testpar/t_ph5basic.c28
-rw-r--r--testpar/t_pread.c1105
-rw-r--r--testpar/t_prestart.c89
-rw-r--r--testpar/t_prop.c179
-rw-r--r--testpar/t_pshutdown.c76
-rw-r--r--testpar/t_shapesame.c3309
-rw-r--r--testpar/t_span_tree.c2661
-rw-r--r--testpar/testpar.h97
-rw-r--r--testpar/testphdf5.c514
-rw-r--r--testpar/testphdf5.h297
-rw-r--r--tools/lib/h5diff.c1223
-rw-r--r--tools/lib/h5diff.h155
-rw-r--r--tools/lib/h5diff_array.c2365
-rw-r--r--tools/lib/h5diff_attr.c334
-rw-r--r--tools/lib/h5diff_dset.c608
-rw-r--r--tools/lib/h5diff_util.c327
-rw-r--r--tools/lib/h5tools.c836
-rw-r--r--tools/lib/h5tools.h416
-rw-r--r--tools/lib/h5tools_dump.c3116
-rw-r--r--tools/lib/h5tools_dump.h100
-rw-r--r--tools/lib/h5tools_error.h262
-rw-r--r--tools/lib/h5tools_filters.c182
-rw-r--r--tools/lib/h5tools_ref.c99
-rw-r--r--tools/lib/h5tools_ref.h1
-rw-r--r--tools/lib/h5tools_str.c1024
-rw-r--r--tools/lib/h5tools_str.h45
-rw-r--r--tools/lib/h5tools_type.c10
-rw-r--r--tools/lib/h5tools_utils.c411
-rw-r--r--tools/lib/h5tools_utils.h96
-rw-r--r--tools/lib/h5trav.c542
-rw-r--r--tools/lib/h5trav.h94
-rw-r--r--tools/lib/io_timer.c116
-rw-r--r--tools/lib/io_timer.h46
-rw-r--r--tools/lib/ph5diff.h33
-rw-r--r--tools/libtest/h5tools_test_utils.c768
-rw-r--r--tools/src/h5copy/h5copy.c338
-rw-r--r--tools/src/h5diff/h5diff_common.c914
-rw-r--r--tools/src/h5diff/h5diff_common.h5
-rw-r--r--tools/src/h5diff/h5diff_main.c54
-rw-r--r--tools/src/h5diff/ph5diff_main.c120
-rw-r--r--tools/src/h5dump/h5dump.c1416
-rw-r--r--tools/src/h5dump/h5dump.h102
-rw-r--r--tools/src/h5dump/h5dump_ddl.c1500
-rw-r--r--tools/src/h5dump/h5dump_ddl.h29
-rw-r--r--tools/src/h5dump/h5dump_defines.h57
-rw-r--r--tools/src/h5dump/h5dump_extern.h97
-rw-r--r--tools/src/h5dump/h5dump_xml.c3038
-rw-r--r--tools/src/h5dump/h5dump_xml.h18
-rw-r--r--tools/src/h5format_convert/h5format_convert.c259
-rw-r--r--tools/src/h5import/h5import.c4932
-rw-r--r--tools/src/h5import/h5import.h196
-rw-r--r--tools/src/h5jam/h5jam.c313
-rw-r--r--tools/src/h5jam/h5unjam.c201
-rw-r--r--tools/src/h5ls/h5ls.c1227
-rw-r--r--tools/src/h5repack/h5repack.c225
-rw-r--r--tools/src/h5repack/h5repack.h199
-rw-r--r--tools/src/h5repack/h5repack_copy.c1485
-rw-r--r--tools/src/h5repack/h5repack_filters.c311
-rw-r--r--tools/src/h5repack/h5repack_main.c410
-rw-r--r--tools/src/h5repack/h5repack_opttable.c106
-rw-r--r--tools/src/h5repack/h5repack_parse.c314
-rw-r--r--tools/src/h5repack/h5repack_refs.c546
-rw-r--r--tools/src/h5repack/h5repack_verify.c366
-rw-r--r--tools/src/h5stat/h5stat.c1107
-rw-r--r--tools/src/misc/h5clear.c196
-rw-r--r--tools/src/misc/h5debug.c487
-rw-r--r--tools/src/misc/h5mkgrp.c126
-rw-r--r--tools/src/misc/h5repart.c334
-rw-r--r--tools/test/h5copy/dynlib_copy.c54
-rw-r--r--tools/test/h5copy/h5copygentest.c465
-rw-r--r--tools/test/h5diff/dynlib_diff.c54
-rw-r--r--tools/test/h5diff/h5diffgentest.c3663
-rw-r--r--tools/test/h5dump/binread.c21
-rw-r--r--tools/test/h5dump/dynlib_dump.c54
-rw-r--r--tools/test/h5dump/h5dumpgentest.c6449
-rw-r--r--tools/test/h5format_convert/h5fc_chk_idx.c53
-rw-r--r--tools/test/h5format_convert/h5fc_gentest.c587
-rw-r--r--tools/test/h5import/h5importtest.c505
-rw-r--r--tools/test/h5jam/getub.c73
-rw-r--r--tools/test/h5jam/h5jamgentest.c395
-rw-r--r--tools/test/h5jam/tellub.c62
-rw-r--r--tools/test/h5ls/dynlib_ls.c54
-rw-r--r--tools/test/h5repack/dynlib_rpk.c58
-rw-r--r--tools/test/h5repack/dynlib_vrpk.c73
-rw-r--r--tools/test/h5repack/h5repackgentest.c183
-rw-r--r--tools/test/h5repack/h5repacktst.c3900
-rw-r--r--tools/test/h5repack/testh5repack_detect_szip.c9
-rw-r--r--tools/test/h5stat/h5stat_gentest.c337
-rw-r--r--tools/test/misc/clear_open_chk.c10
-rw-r--r--tools/test/misc/h5clear_gentest.c312
-rw-r--r--tools/test/misc/h5perf_gentest.c654
-rw-r--r--tools/test/misc/h5repart_gentest.c50
-rw-r--r--tools/test/misc/repart_test.c50
-rw-r--r--tools/test/misc/talign.c114
-rw-r--r--tools/test/misc/vds/UC_1.h55
-rw-r--r--tools/test/misc/vds/UC_1_one_dim_gen.c177
-rw-r--r--tools/test/misc/vds/UC_2.h72
-rw-r--r--tools/test/misc/vds/UC_2_two_dims_gen.c192
-rw-r--r--tools/test/misc/vds/UC_3.h42
-rw-r--r--tools/test/misc/vds/UC_3_gaps_gen.c146
-rw-r--r--tools/test/misc/vds/UC_4.h38
-rw-r--r--tools/test/misc/vds/UC_4_printf_gen.c138
-rw-r--r--tools/test/misc/vds/UC_5.h31
-rw-r--r--tools/test/misc/vds/UC_5_stride_gen.c153
-rw-r--r--tools/test/misc/vds/UC_common.h19
-rw-r--r--tools/test/perform/chunk.c578
-rw-r--r--tools/test/perform/chunk_cache.c313
-rw-r--r--tools/test/perform/direct_write_perf.c430
-rw-r--r--tools/test/perform/iopipe.c188
-rw-r--r--tools/test/perform/overhead.c306
-rw-r--r--tools/test/perform/perf.c391
-rw-r--r--tools/test/perform/perf_meta.c618
-rw-r--r--tools/test/perform/pio_engine.c3628
-rw-r--r--tools/test/perform/pio_perf.c1079
-rw-r--r--tools/test/perform/pio_perf.h86
-rw-r--r--tools/test/perform/pio_standalone.c114
-rw-r--r--tools/test/perform/pio_standalone.h676
-rw-r--r--tools/test/perform/sio_engine.c1166
-rw-r--r--tools/test/perform/sio_perf.c1038
-rw-r--r--tools/test/perform/sio_perf.h74
-rw-r--r--tools/test/perform/sio_standalone.c63
-rw-r--r--tools/test/perform/sio_standalone.h696
-rw-r--r--tools/test/perform/zip_perf.c342
-rw-r--r--utils/mirror_vfd/mirror_remote.c82
-rw-r--r--utils/mirror_vfd/mirror_remote.h23
-rw-r--r--utils/mirror_vfd/mirror_server.c197
-rw-r--r--utils/mirror_vfd/mirror_server_stop.c66
-rw-r--r--utils/mirror_vfd/mirror_writer.c314
1118 files changed, 322123 insertions, 319927 deletions
diff --git a/c++/examples/chunks.cpp b/c++/examples/chunks.cpp
index 03e2855..fdcb6d3 100644
--- a/c++/examples/chunks.cpp
+++ b/c++/examples/chunks.cpp
@@ -28,20 +28,20 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "SDSextendible.h5" );
-const H5std_string DATASET_NAME( "ExtendibleArray" );
-const int NX = 10;
-const int NY = 5;
-const int RANK = 2;
-const int RANKC = 1;
-
-int main (void)
+const H5std_string FILE_NAME("SDSextendible.h5");
+const H5std_string DATASET_NAME("ExtendibleArray");
+const int NX = 10;
+const int NY = 5;
+const int RANK = 2;
+const int RANKC = 1;
+
+int
+main(void)
{
- hsize_t i, j;
+ hsize_t i, j;
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
/*
* Turn off the auto-printing when failure occurs so that we can
* handle the errors appropriately
@@ -51,8 +51,8 @@ int main (void)
/*
* Open the file and the dataset.
*/
- H5File file( FILE_NAME, H5F_ACC_RDONLY );
- DataSet dataset = file.openDataSet( DATASET_NAME );
+ H5File file(FILE_NAME, H5F_ACC_RDONLY);
+ DataSet dataset = file.openDataSet(DATASET_NAME);
/*
* Get filespace for rank and dimension
@@ -67,10 +67,9 @@ int main (void)
/*
* Get and print the dimension sizes of the file dataspace
*/
- hsize_t dims[2]; // dataset dimensions
- rank = filespace.getSimpleExtentDims( dims );
- cout << "dataset rank = " << rank << ", dimensions "
- << (unsigned long)(dims[0]) << " x "
+ hsize_t dims[2]; // dataset dimensions
+ rank = filespace.getSimpleExtentDims(dims);
+ cout << "dataset rank = " << rank << ", dimensions " << (unsigned long)(dims[0]) << " x "
<< (unsigned long)(dims[1]) << endl;
/*
@@ -81,13 +80,12 @@ int main (void)
/*
* Read dataset back and display.
*/
- int data_out[NX][NY]; // buffer for dataset to be read
- dataset.read( data_out, PredType::NATIVE_INT, mspace1, filespace );
+ int data_out[NX][NY]; // buffer for dataset to be read
+ dataset.read(data_out, PredType::NATIVE_INT, mspace1, filespace);
cout << "\n";
cout << "Dataset: \n";
- for (j = 0; j < dims[0]; j++)
- {
+ for (j = 0; j < dims[0]; j++) {
for (i = 0; i < dims[1]; i++)
cout << data_out[j][i] << " ";
cout << endl;
@@ -117,20 +115,20 @@ int main (void)
*/
hsize_t col_dims[1];
col_dims[0] = 10;
- DataSpace mspace2( RANKC, col_dims );
+ DataSpace mspace2(RANKC, col_dims);
/*
* Define the column (hyperslab) to read.
*/
- hsize_t offset[2] = { 0, 2 };
- hsize_t count[2] = { 10, 1 };
- int column[10]; // buffer for column to be read
+ hsize_t offset[2] = {0, 2};
+ hsize_t count[2] = {10, 1};
+ int column[10]; // buffer for column to be read
/*
* Define hyperslab and read.
*/
- filespace.selectHyperslab( H5S_SELECT_SET, count, offset );
- dataset.read( column, PredType::NATIVE_INT, mspace2, filespace );
+ filespace.selectHyperslab(H5S_SELECT_SET, count, offset);
+ dataset.read(column, PredType::NATIVE_INT, mspace2, filespace);
cout << endl;
cout << "Third column: " << endl;
@@ -161,20 +159,18 @@ int main (void)
*/
hsize_t chunk_dims[2];
int rank_chunk;
- if( H5D_CHUNKED == cparms.getLayout() )
- {
+ if (H5D_CHUNKED == cparms.getLayout()) {
/*
* Get chunking information: rank and dimensions
*/
- rank_chunk = cparms.getChunk( 2, chunk_dims);
- cout << "chunk rank " << rank_chunk << "dimensions "
- << (unsigned long)(chunk_dims[0]) << " x "
- << (unsigned long)(chunk_dims[1]) << endl;
+ rank_chunk = cparms.getChunk(2, chunk_dims);
+ cout << "chunk rank " << rank_chunk << "dimensions " << (unsigned long)(chunk_dims[0]) << " x "
+ << (unsigned long)(chunk_dims[1]) << endl;
/*
* Define the memory space to read a chunk.
*/
- DataSpace mspace3( rank_chunk, chunk_dims );
+ DataSpace mspace3(rank_chunk, chunk_dims);
/*
* Define chunk in the file (hyperslab) to read.
@@ -183,17 +179,16 @@ int main (void)
offset[1] = 0;
count[0] = chunk_dims[0];
count[1] = chunk_dims[1];
- filespace.selectHyperslab( H5S_SELECT_SET, count, offset );
+ filespace.selectHyperslab(H5S_SELECT_SET, count, offset);
/*
* Read chunk back and display.
*/
- int chunk_out[2][5]; // buffer for chunk to be read
- dataset.read( chunk_out, PredType::NATIVE_INT, mspace3, filespace );
+ int chunk_out[2][5]; // buffer for chunk to be read
+ dataset.read(chunk_out, PredType::NATIVE_INT, mspace3, filespace);
cout << endl;
cout << "Chunk:" << endl;
- for (j = 0; j < chunk_dims[0]; j++)
- {
+ for (j = 0; j < chunk_dims[0]; j++) {
for (i = 0; i < chunk_dims[1]; i++)
cout << chunk_out[j][i] << " ";
cout << endl;
@@ -204,25 +199,22 @@ int main (void)
* 2 0 0 0 0
*/
}
- } // end of try block
+ } // end of try block
// catch failure caused by the H5File operations
- catch( FileIException error )
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSpace operations
- catch( DataSpaceIException error )
- {
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
}
diff --git a/c++/examples/compound.cpp b/c++/examples/compound.cpp
index 4b116e0..45b001e 100644
--- a/c++/examples/compound.cpp
+++ b/c++/examples/compound.cpp
@@ -29,175 +29,170 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "SDScompound.h5" );
-const H5std_string DATASET_NAME( "ArrayOfStructures" );
-const H5std_string MEMBER1( "a_name" );
-const H5std_string MEMBER2( "b_name" );
-const H5std_string MEMBER3( "c_name" );
-const int LENGTH = 10;
-const int RANK = 1;
-
-int main(void)
+const H5std_string FILE_NAME("SDScompound.h5");
+const H5std_string DATASET_NAME("ArrayOfStructures");
+const H5std_string MEMBER1("a_name");
+const H5std_string MEMBER2("b_name");
+const H5std_string MEMBER3("c_name");
+const int LENGTH = 10;
+const int RANK = 1;
+
+int
+main(void)
{
- /* First structure and dataset*/
- typedef struct s1_t {
+ /* First structure and dataset*/
+ typedef struct s1_t {
int a;
float b;
double c;
- } s1_t;
+ } s1_t;
- /* Second structure (subset of s1_t) and dataset*/
- typedef struct s2_t {
+ /* Second structure (subset of s1_t) and dataset*/
+ typedef struct s2_t {
double c;
int a;
- } s2_t;
-
- // Try block to detect exceptions raised by any of the calls inside it
- try
- {
- /*
- * Initialize the data
- */
- int i;
- s1_t s1[LENGTH];
- for (i = 0; i< LENGTH; i++)
- {
- s1[i].a = i;
- s1[i].b = i*i;
- s1[i].c = 1./(i+1);
- }
-
- /*
- * Turn off the auto-printing when failure occurs so that we can
- * handle the errors appropriately
- */
- Exception::dontPrint();
-
- /*
- * Create the data space.
- */
- hsize_t dim[] = {LENGTH}; /* Dataspace dimensions */
- DataSpace space( RANK, dim );
-
- /*
- * Create the file.
- */
- H5File* file = new H5File( FILE_NAME, H5F_ACC_TRUNC );
-
- /*
- * Create the memory datatype.
- */
- CompType mtype1( sizeof(s1_t) );
- mtype1.insertMember( MEMBER1, HOFFSET(s1_t, a), PredType::NATIVE_INT);
- mtype1.insertMember( MEMBER3, HOFFSET(s1_t, c), PredType::NATIVE_DOUBLE);
- mtype1.insertMember( MEMBER2, HOFFSET(s1_t, b), PredType::NATIVE_FLOAT);
-
- /*
- * Create the dataset.
- */
- DataSet* dataset;
- dataset = new DataSet(file->createDataSet(DATASET_NAME, mtype1, space));
-
- /*
- * Write data to the dataset;
- */
- dataset->write( s1, mtype1 );
-
- /*
- * Release resources
- */
- delete dataset;
- delete file;
-
- /*
- * Open the file and the dataset.
- */
- file = new H5File( FILE_NAME, H5F_ACC_RDONLY );
- dataset = new DataSet (file->openDataSet( DATASET_NAME ));
-
- /*
- * Create a datatype for s2
- */
- CompType mtype2( sizeof(s2_t) );
-
- mtype2.insertMember( MEMBER3, HOFFSET(s2_t, c), PredType::NATIVE_DOUBLE);
- mtype2.insertMember( MEMBER1, HOFFSET(s2_t, a), PredType::NATIVE_INT);
-
- /*
- * Read two fields c and a from s1 dataset. Fields in the file
- * are found by their names "c_name" and "a_name".
- */
- s2_t s2[LENGTH];
- dataset->read( s2, mtype2 );
-
- /*
- * Display the fields
- */
- cout << endl << "Field c : " << endl;
- for( i = 0; i < LENGTH; i++)
- cout << s2[i].c << " ";
- cout << endl;
-
- cout << endl << "Field a : " << endl;
- for( i = 0; i < LENGTH; i++)
- cout << s2[i].a << " ";
- cout << endl;
-
- /*
- * Create a datatype for s3.
- */
- CompType mtype3( sizeof(float) );
-
- mtype3.insertMember( MEMBER2, 0, PredType::NATIVE_FLOAT);
-
- /*
- * Read field b from s1 dataset. Field in the file is found by its name.
- */
- float s3[LENGTH]; // Third "structure" - used to read float field of s1
- dataset->read( s3, mtype3 );
-
- /*
- * Display the field
- */
- cout << endl << "Field b : " << endl;
- for( i = 0; i < LENGTH; i++)
- cout << s3[i] << " ";
- cout << endl;
-
- /*
- * Release resources
- */
- delete dataset;
- delete file;
- } // end of try block
-
- // catch failure caused by the H5File operations
- catch( FileIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSpace operations
- catch( DataSpaceIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSpace operations
- catch( DataTypeIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- return 0;
+ } s2_t;
+
+ // Try block to detect exceptions raised by any of the calls inside it
+ try {
+ /*
+ * Initialize the data
+ */
+ int i;
+ s1_t s1[LENGTH];
+ for (i = 0; i < LENGTH; i++) {
+ s1[i].a = i;
+ s1[i].b = i * i;
+ s1[i].c = 1. / (i + 1);
+ }
+
+ /*
+ * Turn off the auto-printing when failure occurs so that we can
+ * handle the errors appropriately
+ */
+ Exception::dontPrint();
+
+ /*
+ * Create the data space.
+ */
+ hsize_t dim[] = {LENGTH}; /* Dataspace dimensions */
+ DataSpace space(RANK, dim);
+
+ /*
+ * Create the file.
+ */
+ H5File *file = new H5File(FILE_NAME, H5F_ACC_TRUNC);
+
+ /*
+ * Create the memory datatype.
+ */
+ CompType mtype1(sizeof(s1_t));
+ mtype1.insertMember(MEMBER1, HOFFSET(s1_t, a), PredType::NATIVE_INT);
+ mtype1.insertMember(MEMBER3, HOFFSET(s1_t, c), PredType::NATIVE_DOUBLE);
+ mtype1.insertMember(MEMBER2, HOFFSET(s1_t, b), PredType::NATIVE_FLOAT);
+
+ /*
+ * Create the dataset.
+ */
+ DataSet *dataset;
+ dataset = new DataSet(file->createDataSet(DATASET_NAME, mtype1, space));
+
+ /*
+ * Write data to the dataset;
+ */
+ dataset->write(s1, mtype1);
+
+ /*
+ * Release resources
+ */
+ delete dataset;
+ delete file;
+
+ /*
+ * Open the file and the dataset.
+ */
+ file = new H5File(FILE_NAME, H5F_ACC_RDONLY);
+ dataset = new DataSet(file->openDataSet(DATASET_NAME));
+
+ /*
+ * Create a datatype for s2
+ */
+ CompType mtype2(sizeof(s2_t));
+
+ mtype2.insertMember(MEMBER3, HOFFSET(s2_t, c), PredType::NATIVE_DOUBLE);
+ mtype2.insertMember(MEMBER1, HOFFSET(s2_t, a), PredType::NATIVE_INT);
+
+ /*
+ * Read two fields c and a from s1 dataset. Fields in the file
+ * are found by their names "c_name" and "a_name".
+ */
+ s2_t s2[LENGTH];
+ dataset->read(s2, mtype2);
+
+ /*
+ * Display the fields
+ */
+ cout << endl << "Field c : " << endl;
+ for (i = 0; i < LENGTH; i++)
+ cout << s2[i].c << " ";
+ cout << endl;
+
+ cout << endl << "Field a : " << endl;
+ for (i = 0; i < LENGTH; i++)
+ cout << s2[i].a << " ";
+ cout << endl;
+
+ /*
+ * Create a datatype for s3.
+ */
+ CompType mtype3(sizeof(float));
+
+ mtype3.insertMember(MEMBER2, 0, PredType::NATIVE_FLOAT);
+
+ /*
+ * Read field b from s1 dataset. Field in the file is found by its name.
+ */
+ float s3[LENGTH]; // Third "structure" - used to read float field of s1
+ dataset->read(s3, mtype3);
+
+ /*
+ * Display the field
+ */
+ cout << endl << "Field b : " << endl;
+ for (i = 0; i < LENGTH; i++)
+ cout << s3[i] << " ";
+ cout << endl;
+
+ /*
+ * Release resources
+ */
+ delete dataset;
+ delete file;
+ } // end of try block
+
+ // catch failure caused by the H5File operations
+ catch (FileIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSet operations
+ catch (DataSetIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSpace operations
+ catch (DataSpaceIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSpace operations
+ catch (DataTypeIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ return 0;
}
diff --git a/c++/examples/create.cpp b/c++/examples/create.cpp
index 06b981b..968c897 100644
--- a/c++/examples/create.cpp
+++ b/c++/examples/create.cpp
@@ -25,105 +25,99 @@
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "SDS.h5" );
-const H5std_string DATASET_NAME( "IntArray" );
-const int NX = 5; // dataset dimensions
-const int NY = 6;
-const int RANK = 2;
-
-int main (void)
+const H5std_string FILE_NAME("SDS.h5");
+const H5std_string DATASET_NAME("IntArray");
+const int NX = 5; // dataset dimensions
+const int NY = 6;
+const int RANK = 2;
+
+int
+main(void)
{
- /*
- * Data initialization.
- */
- int i, j;
- int data[NX][NY]; // buffer for data to write
- for (j = 0; j < NX; j++)
- {
- for (i = 0; i < NY; i++)
- data[j][i] = i + j;
- }
- /*
- * 0 1 2 3 4 5
- * 1 2 3 4 5 6
- * 2 3 4 5 6 7
- * 3 4 5 6 7 8
- * 4 5 6 7 8 9
- */
-
- // Try block to detect exceptions raised by any of the calls inside it
- try
- {
- /*
- * Turn off the auto-printing when failure occurs so that we can
- * handle the errors appropriately
- */
- Exception::dontPrint();
-
- /*
- * Create a new file using H5F_ACC_TRUNC access,
- * default file creation properties, and default file
- * access properties.
- */
- H5File file( FILE_NAME, H5F_ACC_TRUNC );
-
- /*
- * Define the size of the array and create the data space for fixed
- * size dataset.
- */
- hsize_t dimsf[2]; // dataset dimensions
- dimsf[0] = NX;
- dimsf[1] = NY;
- DataSpace dataspace( RANK, dimsf );
-
- /*
- * Define datatype for the data in the file.
- * We will store little endian INT numbers.
- */
- IntType datatype( PredType::NATIVE_INT );
- datatype.setOrder( H5T_ORDER_LE );
-
- /*
- * Create a new dataset within the file using defined dataspace and
- * datatype and default dataset creation properties.
- */
- DataSet dataset = file.createDataSet( DATASET_NAME, datatype, dataspace );
-
- /*
- * Write the data to the dataset using default memory space, file
- * space, and transfer properties.
- */
- dataset.write( data, PredType::NATIVE_INT );
- } // end of try block
-
- // catch failure caused by the H5File operations
- catch( FileIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSpace operations
- catch( DataSpaceIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSpace operations
- catch( DataTypeIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- return 0; // successfully terminated
+ /*
+ * Data initialization.
+ */
+ int i, j;
+ int data[NX][NY]; // buffer for data to write
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++)
+ data[j][i] = i + j;
+ }
+ /*
+ * 0 1 2 3 4 5
+ * 1 2 3 4 5 6
+ * 2 3 4 5 6 7
+ * 3 4 5 6 7 8
+ * 4 5 6 7 8 9
+ */
+
+ // Try block to detect exceptions raised by any of the calls inside it
+ try {
+ /*
+ * Turn off the auto-printing when failure occurs so that we can
+ * handle the errors appropriately
+ */
+ Exception::dontPrint();
+
+ /*
+ * Create a new file using H5F_ACC_TRUNC access,
+ * default file creation properties, and default file
+ * access properties.
+ */
+ H5File file(FILE_NAME, H5F_ACC_TRUNC);
+
+ /*
+ * Define the size of the array and create the data space for fixed
+ * size dataset.
+ */
+ hsize_t dimsf[2]; // dataset dimensions
+ dimsf[0] = NX;
+ dimsf[1] = NY;
+ DataSpace dataspace(RANK, dimsf);
+
+ /*
+ * Define datatype for the data in the file.
+ * We will store little endian INT numbers.
+ */
+ IntType datatype(PredType::NATIVE_INT);
+ datatype.setOrder(H5T_ORDER_LE);
+
+ /*
+ * Create a new dataset within the file using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
+ DataSet dataset = file.createDataSet(DATASET_NAME, datatype, dataspace);
+
+ /*
+ * Write the data to the dataset using default memory space, file
+ * space, and transfer properties.
+ */
+ dataset.write(data, PredType::NATIVE_INT);
+ } // end of try block
+
+ // catch failure caused by the H5File operations
+ catch (FileIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSet operations
+ catch (DataSetIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSpace operations
+ catch (DataSpaceIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSpace operations
+ catch (DataTypeIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ return 0; // successfully terminated
}
-
diff --git a/c++/examples/extend_ds.cpp b/c++/examples/extend_ds.cpp
index 9e005c6..9145088 100644
--- a/c++/examples/extend_ds.cpp
+++ b/c++/examples/extend_ds.cpp
@@ -32,201 +32,195 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "SDSextendible.h5" );
-const H5std_string DATASET_NAME( "ExtendibleArray" );
-const int NX = 10;
-const int NY = 5;
-const int RANK = 2;
-
-int main (void)
+const H5std_string FILE_NAME("SDSextendible.h5");
+const H5std_string DATASET_NAME("ExtendibleArray");
+const int NX = 10;
+const int NY = 5;
+const int RANK = 2;
+
+int
+main(void)
{
- /*
- * Try block to detect exceptions raised by any of the calls inside it
- */
- try
- {
- /*
- * Turn off the auto-printing when failure occurs so that we can
- * handle the errors appropriately
- */
- Exception::dontPrint();
-
- /*
- * Create the data space with unlimited dimensions.
- */
- hsize_t dims[2] = { 3, 3}; // dataset dimensions at creation
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- DataSpace mspace1( RANK, dims, maxdims);
-
- /*
- * Create a new file. If file exists its contents will be overwritten.
- */
- H5File file( FILE_NAME, H5F_ACC_TRUNC );
-
- /*
- * Modify dataset creation properties, i.e. enable chunking.
- */
- DSetCreatPropList cparms;
-
- hsize_t chunk_dims[2] ={2, 5};
- cparms.setChunk( RANK, chunk_dims );
-
- /*
- * Set fill value for the dataset
- */
- int fill_val = 0;
- cparms.setFillValue( PredType::NATIVE_INT, &fill_val);
-
- /*
- * Create a new dataset within the file using cparms
- * creation properties.
- */
- DataSet dataset = file.createDataSet( DATASET_NAME, PredType::NATIVE_INT, mspace1, cparms);
-
- /*
- * Extend the dataset. This call assures that dataset is at least 3 x 3.
- */
- hsize_t size[2];
- size[0] = 3;
- size[1] = 3;
- dataset.extend( size );
-
- /*
- * Select a hyperslab.
- */
- DataSpace fspace1 = dataset.getSpace ();
- hsize_t offset[2];
- offset[0] = 0;
- offset[1] = 0;
- hsize_t dims1[2] = { 3, 3}; /* data1 dimensions */
- fspace1.selectHyperslab( H5S_SELECT_SET, dims1, offset );
-
- /*
- * Write the data to the hyperslab.
- */
- int data1[3][3] = { {1, 1, 1}, /* data to write */
- {1, 1, 1},
- {1, 1, 1} };
- dataset.write( data1, PredType::NATIVE_INT, mspace1, fspace1 );
-
- /*
- * Extend the dataset. Dataset becomes 10 x 3.
- */
- hsize_t dims2[2] = { 7, 1}; /* data2 dimensions */
- dims[0] = dims1[0] + dims2[0];
- size[0] = dims[0];
- size[1] = dims[1];
- dataset.extend( size );
-
- /*
- * Select a hyperslab.
- */
- DataSpace fspace2 = dataset.getSpace ();
- offset[0] = 3;
- offset[1] = 0;
- fspace2.selectHyperslab( H5S_SELECT_SET, dims2, offset );
-
- /*
- * Define memory space
- */
- DataSpace mspace2( RANK, dims2 );
-
- /*
- * Write the data to the hyperslab.
- */
- int data2[7] = { 2, 2, 2, 2, 2, 2, 2};
- dataset.write( data2, PredType::NATIVE_INT, mspace2, fspace2 );
-
- /*
- * Extend the dataset. Dataset becomes 10 x 5.
- */
- hsize_t dims3[2] = { 2, 2}; /* data3 dimensions */
- dims[1] = dims1[1] + dims3[1];
- size[0] = dims[0];
- size[1] = dims[1];
- dataset.extend( size );
-
- /*
- * Select a hyperslab
- */
- DataSpace fspace3 = dataset.getSpace ();
- offset[0] = 0;
- offset[1] = 3;
- fspace3.selectHyperslab( H5S_SELECT_SET, dims3, offset );
-
- /*
- * Define memory space.
- */
- DataSpace mspace3( RANK, dims3 );
-
- /*
- * Write the data to the hyperslab.
- */
- int data3[2][2] = { {3, 3}, {3, 3} };
- dataset.write( data3, PredType::NATIVE_INT, mspace3, fspace3 );
-
- /*
- * Read the data from this dataset and display it.
- */
- int i, j;
- int data_out[NX][NY];
- for (i = 0; i < NX; i++)
- {
- for (j = 0; j < NY; j++)
- data_out[i][j] = 0;
- }
- dataset.read( data_out, PredType::NATIVE_INT );
- /*
- * Resulting dataset
- *
- * 1 1 1 3 3
- * 1 1 1 3 3
- * 1 1 1 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- */
- /*
- * Display the result.
- */
- for (i=0; i < NX; i++)
- {
- for(j=0; j < NY; j++)
- cout << data_out[i][j] << " ";
- cout << endl;
- }
- } // end of try block
-
- // catch failure caused by the H5File operations
- catch( FileIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSpace operations
- catch( DataSpaceIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSpace operations
- catch( DataTypeIException error )
- {
- error.printErrorStack();
- return -1;
- }
- return 0;
+ /*
+ * Try block to detect exceptions raised by any of the calls inside it
+ */
+ try {
+ /*
+ * Turn off the auto-printing when failure occurs so that we can
+ * handle the errors appropriately
+ */
+ Exception::dontPrint();
+
+ /*
+ * Create the data space with unlimited dimensions.
+ */
+ hsize_t dims[2] = {3, 3}; // dataset dimensions at creation
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ DataSpace mspace1(RANK, dims, maxdims);
+
+ /*
+ * Create a new file. If file exists its contents will be overwritten.
+ */
+ H5File file(FILE_NAME, H5F_ACC_TRUNC);
+
+ /*
+ * Modify dataset creation properties, i.e. enable chunking.
+ */
+ DSetCreatPropList cparms;
+
+ hsize_t chunk_dims[2] = {2, 5};
+ cparms.setChunk(RANK, chunk_dims);
+
+ /*
+ * Set fill value for the dataset
+ */
+ int fill_val = 0;
+ cparms.setFillValue(PredType::NATIVE_INT, &fill_val);
+
+ /*
+ * Create a new dataset within the file using cparms
+ * creation properties.
+ */
+ DataSet dataset = file.createDataSet(DATASET_NAME, PredType::NATIVE_INT, mspace1, cparms);
+
+ /*
+ * Extend the dataset. This call assures that dataset is at least 3 x 3.
+ */
+ hsize_t size[2];
+ size[0] = 3;
+ size[1] = 3;
+ dataset.extend(size);
+
+ /*
+ * Select a hyperslab.
+ */
+ DataSpace fspace1 = dataset.getSpace();
+ hsize_t offset[2];
+ offset[0] = 0;
+ offset[1] = 0;
+ hsize_t dims1[2] = {3, 3}; /* data1 dimensions */
+ fspace1.selectHyperslab(H5S_SELECT_SET, dims1, offset);
+
+ /*
+ * Write the data to the hyperslab.
+ */
+ int data1[3][3] = {{1, 1, 1}, /* data to write */
+ {1, 1, 1},
+ {1, 1, 1}};
+ dataset.write(data1, PredType::NATIVE_INT, mspace1, fspace1);
+
+ /*
+ * Extend the dataset. Dataset becomes 10 x 3.
+ */
+ hsize_t dims2[2] = {7, 1}; /* data2 dimensions */
+ dims[0] = dims1[0] + dims2[0];
+ size[0] = dims[0];
+ size[1] = dims[1];
+ dataset.extend(size);
+
+ /*
+ * Select a hyperslab.
+ */
+ DataSpace fspace2 = dataset.getSpace();
+ offset[0] = 3;
+ offset[1] = 0;
+ fspace2.selectHyperslab(H5S_SELECT_SET, dims2, offset);
+
+ /*
+ * Define memory space
+ */
+ DataSpace mspace2(RANK, dims2);
+
+ /*
+ * Write the data to the hyperslab.
+ */
+ int data2[7] = {2, 2, 2, 2, 2, 2, 2};
+ dataset.write(data2, PredType::NATIVE_INT, mspace2, fspace2);
+
+ /*
+ * Extend the dataset. Dataset becomes 10 x 5.
+ */
+ hsize_t dims3[2] = {2, 2}; /* data3 dimensions */
+ dims[1] = dims1[1] + dims3[1];
+ size[0] = dims[0];
+ size[1] = dims[1];
+ dataset.extend(size);
+
+ /*
+ * Select a hyperslab
+ */
+ DataSpace fspace3 = dataset.getSpace();
+ offset[0] = 0;
+ offset[1] = 3;
+ fspace3.selectHyperslab(H5S_SELECT_SET, dims3, offset);
+
+ /*
+ * Define memory space.
+ */
+ DataSpace mspace3(RANK, dims3);
+
+ /*
+ * Write the data to the hyperslab.
+ */
+ int data3[2][2] = {{3, 3}, {3, 3}};
+ dataset.write(data3, PredType::NATIVE_INT, mspace3, fspace3);
+
+ /*
+ * Read the data from this dataset and display it.
+ */
+ int i, j;
+ int data_out[NX][NY];
+ for (i = 0; i < NX; i++) {
+ for (j = 0; j < NY; j++)
+ data_out[i][j] = 0;
+ }
+ dataset.read(data_out, PredType::NATIVE_INT);
+ /*
+ * Resulting dataset
+ *
+ * 1 1 1 3 3
+ * 1 1 1 3 3
+ * 1 1 1 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ */
+ /*
+ * Display the result.
+ */
+ for (i = 0; i < NX; i++) {
+ for (j = 0; j < NY; j++)
+ cout << data_out[i][j] << " ";
+ cout << endl;
+ }
+ } // end of try block
+
+ // catch failure caused by the H5File operations
+ catch (FileIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSet operations
+ catch (DataSetIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSpace operations
+ catch (DataSpaceIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSpace operations
+ catch (DataTypeIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+ return 0;
}
diff --git a/c++/examples/h5group.cpp b/c++/examples/h5group.cpp
index 271c538..3d2c6d9 100644
--- a/c++/examples/h5group.cpp
+++ b/c++/examples/h5group.cpp
@@ -32,22 +32,21 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "Group.h5" );
+const H5std_string FILE_NAME("Group.h5");
const int RANK = 2;
// Operator function
-extern "C" herr_t file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo,
- void *opdata);
+extern "C" herr_t file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata);
-int main(void)
+int
+main(void)
{
- hsize_t dims[2];
- hsize_t cdims[2];
+ hsize_t dims[2];
+ hsize_t cdims[2];
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
/*
* Turn off the auto-printing when failure occurs so that we can
* handle the errors appropriately
@@ -58,12 +57,12 @@ int main(void)
* Create the named file, truncating the existing one if any,
* using default create and access property lists.
*/
- H5File *file = new H5File( FILE_NAME, H5F_ACC_TRUNC );
+ H5File *file = new H5File(FILE_NAME, H5F_ACC_TRUNC);
/*
* Create a group in the file
*/
- Group* group = new Group( file->createGroup( "/Data" ));
+ Group *group = new Group(file->createGroup("/Data"));
/*
* Create dataset "Compressed Data" in the group using absolute
@@ -71,21 +70,20 @@ int main(void)
* GZIP compression with the compression effort set to 6.
* Note that compression can be used only when dataset is chunked.
*/
- dims[0] = 1000;
- dims[1] = 20;
- cdims[0] = 20;
- cdims[1] = 20;
- DataSpace *dataspace = new DataSpace(RANK, dims); // create new dspace
- DSetCreatPropList ds_creatplist; // create dataset creation prop list
- ds_creatplist.setChunk( 2, cdims ); // then modify it for compression
- ds_creatplist.setDeflate( 6 );
+ dims[0] = 1000;
+ dims[1] = 20;
+ cdims[0] = 20;
+ cdims[1] = 20;
+ DataSpace * dataspace = new DataSpace(RANK, dims); // create new dspace
+ DSetCreatPropList ds_creatplist; // create dataset creation prop list
+ ds_creatplist.setChunk(2, cdims); // then modify it for compression
+ ds_creatplist.setDeflate(6);
/*
* Create the first dataset.
*/
- DataSet* dataset = new DataSet(file->createDataSet(
- "/Data/Compressed_Data", PredType::NATIVE_INT,
- *dataspace, ds_creatplist ));
+ DataSet *dataset = new DataSet(
+ file->createDataSet("/Data/Compressed_Data", PredType::NATIVE_INT, *dataspace, ds_creatplist));
/*
* Close the first dataset.
@@ -96,11 +94,10 @@ int main(void)
/*
* Create the second dataset.
*/
- dims[0] = 500;
- dims[1] = 20;
+ dims[0] = 500;
+ dims[1] = 20;
dataspace = new DataSpace(RANK, dims); // create second dspace
- dataset = new DataSet(file->createDataSet("/Data/Float_Data",
- PredType::NATIVE_FLOAT, *dataspace));
+ dataset = new DataSet(file->createDataSet("/Data/Float_Data", PredType::NATIVE_FLOAT, *dataspace));
delete dataset;
delete dataspace;
@@ -110,16 +107,16 @@ int main(void)
/*
* Now reopen the file and group in the file.
*/
- file = new H5File(FILE_NAME, H5F_ACC_RDWR);
+ file = new H5File(FILE_NAME, H5F_ACC_RDWR);
group = new Group(file->openGroup("Data"));
/*
* Access "Compressed_Data" dataset in the group.
*/
- try { // to determine if the dataset exists in the group
- dataset = new DataSet( group->openDataSet( "Compressed_Data" ));
+ try { // to determine if the dataset exists in the group
+ dataset = new DataSet(group->openDataSet("Compressed_Data"));
}
- catch( GroupIException not_found_error ) {
+ catch (GroupIException not_found_error) {
cout << " Dataset is not found." << endl;
}
cout << "dataset \"/Data/Compressed_Data\" is open" << endl;
@@ -132,17 +129,16 @@ int main(void)
/*
* Create hard link to the Data group.
*/
- file->link( H5L_TYPE_HARD, "Data", "Data_new" );
+ file->link(H5L_TYPE_HARD, "Data", "Data_new");
/*
* We can access "Compressed_Data" dataset using created
* hard link "Data_new".
*/
- try { // to determine if the dataset exists in the file
- dataset = new DataSet(file->openDataSet( "/Data_new/Compressed_Data" ));
+ try { // to determine if the dataset exists in the file
+ dataset = new DataSet(file->openDataSet("/Data_new/Compressed_Data"));
}
- catch( FileIException not_found_error )
- {
+ catch (FileIException not_found_error) {
cout << " Dataset is not found." << endl;
}
cout << "dataset \"/Data_new/Compressed_Data\" is open" << endl;
@@ -165,11 +161,10 @@ int main(void)
* of the objects in the file root direvtory.
*/
cout << "Unlinking..." << endl;
- try { // attempt to unlink the dataset
- file->unlink( "Data" );
+ try { // attempt to unlink the dataset
+ file->unlink("Data");
}
- catch( FileIException unlink_error )
- {
+ catch (FileIException unlink_error) {
cout << " unlink failed." << endl;
}
cout << "\"Data\" is unlinked" << endl;
@@ -183,32 +178,28 @@ int main(void)
*/
delete group;
delete file;
- } // end of try block
+ } // end of try block
// catch failure caused by the H5File operations
- catch( FileIException error )
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSpace operations
- catch( DataSpaceIException error )
- {
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the Attribute operations
- catch( AttributeIException error )
- {
+ catch (AttributeIException error) {
error.printErrorStack();
return -1;
}
@@ -236,4 +227,3 @@ file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata
H5Gclose(group);
return 0;
}
-
diff --git a/c++/examples/h5tutr_cmprss.cpp b/c++/examples/h5tutr_cmprss.cpp
index e3cf978..23a7aba 100644
--- a/c++/examples/h5tutr_cmprss.cpp
+++ b/c++/examples/h5tutr_cmprss.cpp
@@ -24,20 +24,20 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME("h5tutr_cmprss.h5");
-const H5std_string DATASET_NAME("Compressed_Data");
-const int DIM0 = 100;
-const int DIM1 = 20;
+const H5std_string FILE_NAME("h5tutr_cmprss.h5");
+const H5std_string DATASET_NAME("Compressed_Data");
+const int DIM0 = 100;
+const int DIM1 = 20;
-int main (void)
+int
+main(void)
{
- hsize_t dims[2] = { DIM0, DIM1 }; // dataset dimensions
- hsize_t chunk_dims[2] = { 20, 20 }; // chunk dimensions
- int i,j, buf[DIM0][DIM1];
+ hsize_t dims[2] = {DIM0, DIM1}; // dataset dimensions
+ hsize_t chunk_dims[2] = {20, 20}; // chunk dimensions
+ int i, j, buf[DIM0][DIM1];
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately
Exception::dontPrint();
@@ -49,7 +49,7 @@ int main (void)
DataSpace *dataspace = new DataSpace(2, dims);
// Modify dataset creation property to enable chunking
- DSetCreatPropList *plist = new DSetCreatPropList;
+ DSetCreatPropList *plist = new DSetCreatPropList;
plist->setChunk(2, chunk_dims);
// Set ZLIB (DEFLATE) Compression using level 6.
@@ -62,12 +62,12 @@ int main (void)
// plist->setSzip(szip_options_mask, szip_pixels_per_block);
// Create the dataset.
- DataSet *dataset = new DataSet(file.createDataSet( DATASET_NAME,
- PredType::STD_I32BE, *dataspace, *plist) );
+ DataSet *dataset =
+ new DataSet(file.createDataSet(DATASET_NAME, PredType::STD_I32BE, *dataspace, *plist));
- for (i = 0; i< DIM0; i++)
- for (j=0; j<DIM1; j++)
- buf[i][j] = i+j;
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ buf[i][j] = i + j;
// Write data to dataset.
dataset->write(buf, PredType::NATIVE_INT);
@@ -83,41 +83,41 @@ int main (void)
// information for dataset and read the data back.
// -----------------------------------------------
- int rbuf[DIM0][DIM1];
- int numfilt;
- size_t nelmts={1}, namelen={1};
- unsigned flags, filter_info, cd_values[1], idx;
- char name[1];
+ int rbuf[DIM0][DIM1];
+ int numfilt;
+ size_t nelmts = {1}, namelen = {1};
+ unsigned flags, filter_info, cd_values[1], idx;
+ char name[1];
H5Z_filter_t filter_type;
// Open the file and the dataset in the file.
file.openFile(FILE_NAME, H5F_ACC_RDONLY);
- dataset = new DataSet(file.openDataSet( DATASET_NAME));
+ dataset = new DataSet(file.openDataSet(DATASET_NAME));
// Get the create property list of the dataset.
- plist = new DSetCreatPropList(dataset->getCreatePlist ());
+ plist = new DSetCreatPropList(dataset->getCreatePlist());
// Get the number of filters associated with the dataset.
numfilt = plist->getNfilters();
cout << "Number of filters associated with dataset: " << numfilt << endl;
- for (idx=0; idx < numfilt; idx++) {
+ for (idx = 0; idx < numfilt; idx++) {
nelmts = 0;
- filter_type = plist->getFilter(idx, flags, nelmts, cd_values, namelen, name , filter_info);
+ filter_type = plist->getFilter(idx, flags, nelmts, cd_values, namelen, name, filter_info);
cout << "Filter Type: ";
switch (filter_type) {
- case H5Z_FILTER_DEFLATE:
- cout << "H5Z_FILTER_DEFLATE" << endl;
- break;
- case H5Z_FILTER_SZIP:
- cout << "H5Z_FILTER_SZIP" << endl;
- break;
- default:
- cout << "Other filter type included." << endl;
- }
+ case H5Z_FILTER_DEFLATE:
+ cout << "H5Z_FILTER_DEFLATE" << endl;
+ break;
+ case H5Z_FILTER_SZIP:
+ cout << "H5Z_FILTER_SZIP" << endl;
+ break;
+ default:
+ cout << "Other filter type included." << endl;
+ }
}
// Read data.
@@ -125,31 +125,27 @@ int main (void)
delete plist;
delete dataset;
- file.close(); // can be skipped
+ file.close(); // can be skipped
- } // end of try block
+ } // end of try block
// catch failure caused by the H5File operations
- catch(FileIException error)
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSet operations
- catch(DataSetIException error)
- {
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSpace operations
- catch(DataSpaceIException error)
- {
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
}
- return 0; // successfully terminated
+ return 0; // successfully terminated
}
-
diff --git a/c++/examples/h5tutr_crtatt.cpp b/c++/examples/h5tutr_crtatt.cpp
index 409bd62..fdedadf 100644
--- a/c++/examples/h5tutr_crtatt.cpp
+++ b/c++/examples/h5tutr_crtatt.cpp
@@ -21,69 +21,62 @@
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "h5tutr_dset.h5" );
-const H5std_string DATASET_NAME( "dset" );
-const H5std_string ATTR_NAME( "Units" );
+const H5std_string FILE_NAME("h5tutr_dset.h5");
+const H5std_string DATASET_NAME("dset");
+const H5std_string ATTR_NAME("Units");
-const int DIM1 = 2;
+const int DIM1 = 2;
-int main (void)
+int
+main(void)
{
- int attr_data[2] = { 100, 200};
- hsize_t dims[1] = { DIM1 };
+ int attr_data[2] = {100, 200};
+ hsize_t dims[1] = {DIM1};
-
- // Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ // Try block to detect exceptions raised by any of the calls inside it
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately
Exception::dontPrint();
// Open an existing file and dataset.
- H5File file( FILE_NAME, H5F_ACC_RDWR );
- DataSet dataset = file.openDataSet( DATASET_NAME );
+ H5File file(FILE_NAME, H5F_ACC_RDWR);
+ DataSet dataset = file.openDataSet(DATASET_NAME);
// Create the data space for the attribute.
- DataSpace attr_dataspace = DataSpace (1, dims );
+ DataSpace attr_dataspace = DataSpace(1, dims);
// Create a dataset attribute.
- Attribute attribute = dataset.createAttribute( ATTR_NAME, PredType::STD_I32BE,
- attr_dataspace);
+ Attribute attribute = dataset.createAttribute(ATTR_NAME, PredType::STD_I32BE, attr_dataspace);
// Write the attribute data.
- attribute.write( PredType::NATIVE_INT, attr_data);
+ attribute.write(PredType::NATIVE_INT, attr_data);
- } // end of try block
+ } // end of try block
- // catch failure caused by the H5File operations
- catch( DataSpaceIException error )
- {
+ // catch failure caused by the H5File operations
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
- }
+ }
- // catch failure caused by the H5File operations
- catch( AttributeIException error )
- {
+ // catch failure caused by the H5File operations
+ catch (AttributeIException error) {
error.printErrorStack();
return -1;
- }
+ }
- // catch failure caused by the H5File operations
- catch( FileIException error )
- {
+ // catch failure caused by the H5File operations
+ catch (FileIException error) {
error.printErrorStack();
return -1;
- }
+ }
- // catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
+ // catch failure caused by the DataSet operations
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
- }
+ }
- return 0; // successfully terminated
+ return 0; // successfully terminated
}
-
diff --git a/c++/examples/h5tutr_crtdat.cpp b/c++/examples/h5tutr_crtdat.cpp
index 3257223..aef78d9 100644
--- a/c++/examples/h5tutr_crtdat.cpp
+++ b/c++/examples/h5tutr_crtdat.cpp
@@ -22,17 +22,17 @@
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME("h5tutr_dset.h5");
-const H5std_string DATASET_NAME("dset");
-const int NX = 4; // dataset dimensions
-const int NY = 6;
-const int RANK = 2;
+const H5std_string FILE_NAME("h5tutr_dset.h5");
+const H5std_string DATASET_NAME("dset");
+const int NX = 4; // dataset dimensions
+const int NY = 6;
+const int RANK = 2;
-int main (void)
+int
+main(void)
{
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately
Exception::dontPrint();
@@ -41,7 +41,7 @@ int main (void)
H5File file(FILE_NAME, H5F_ACC_TRUNC);
// Create the data space for the dataset.
- hsize_t dims[2]; // dataset dimensions
+ hsize_t dims[2]; // dataset dimensions
dims[0] = NX;
dims[1] = NY;
DataSpace dataspace(RANK, dims);
@@ -49,29 +49,25 @@ int main (void)
// Create the dataset.
DataSet dataset = file.createDataSet(DATASET_NAME, PredType::STD_I32BE, dataspace);
- } // end of try block
+ } // end of try block
// catch failure caused by the H5File operations
- catch(FileIException error)
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSet operations
- catch(DataSetIException error)
- {
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSpace operations
- catch(DataSpaceIException error)
- {
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
}
- return 0; // successfully terminated
+ return 0; // successfully terminated
}
-
diff --git a/c++/examples/h5tutr_crtgrp.cpp b/c++/examples/h5tutr_crtgrp.cpp
index 43af08a..8e48eec 100644
--- a/c++/examples/h5tutr_crtgrp.cpp
+++ b/c++/examples/h5tutr_crtgrp.cpp
@@ -26,11 +26,11 @@ using namespace H5;
const H5std_string FILE_NAME("h5tutr_group.h5");
-int main(void)
+int
+main(void)
{
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately
Exception::dontPrint();
@@ -46,14 +46,12 @@ int main(void)
} // end of try block
// catch failure caused by the H5File operations
- catch(FileIException error)
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the Group operations
- catch(GroupIException error)
- {
+ catch (GroupIException error) {
error.printErrorStack();
return -1;
}
diff --git a/c++/examples/h5tutr_crtgrpar.cpp b/c++/examples/h5tutr_crtgrpar.cpp
index 15cf1df..3414cee 100644
--- a/c++/examples/h5tutr_crtgrpar.cpp
+++ b/c++/examples/h5tutr_crtgrpar.cpp
@@ -26,12 +26,12 @@ using namespace H5;
const H5std_string FILE_NAME("h5tutr_groups.h5");
-int main(void)
+int
+main(void)
{
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately.
@@ -44,7 +44,7 @@ int main(void)
// Create group "MyGroup" in the root group using an absolute name.
- Group group1(file.createGroup( "/MyGroup"));
+ Group group1(file.createGroup("/MyGroup"));
// Create group "Group_A" in group "MyGroup" using an
// absolute name.
@@ -54,7 +54,7 @@ int main(void)
// Create group "Group_B" in group "MyGroup" using a
// relative name.
- Group group3(group1.createGroup ("Group_B"));
+ Group group3(group1.createGroup("Group_B"));
// Close the groups and file.
@@ -66,20 +66,16 @@ int main(void)
} // end of try block
// catch failure caused by the File operations
- catch(FileIException error)
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the Group operations
- catch(GroupIException error)
- {
+ catch (GroupIException error) {
error.printErrorStack();
return -1;
}
return 0;
}
-
-
diff --git a/c++/examples/h5tutr_crtgrpd.cpp b/c++/examples/h5tutr_crtgrpd.cpp
index c28b666..8ada706 100644
--- a/c++/examples/h5tutr_crtgrpd.cpp
+++ b/c++/examples/h5tutr_crtgrpd.cpp
@@ -27,20 +27,20 @@ using namespace H5;
const H5std_string FILE_NAME("h5tutr_groups.h5");
const H5std_string DATASET_NAME1("/MyGroup/dset1");
const H5std_string DATASET_NAME2("dset2");
-const int RANK = 2;
-const int D1DIM1 = 3;
-const int D1DIM2 = 3;
-const int D2DIM1 = 2;
-const int D2DIM2 = 10;
-
-int main(void)
+const int RANK = 2;
+const int D1DIM1 = 3;
+const int D1DIM2 = 3;
+const int D2DIM1 = 2;
+const int D2DIM2 = 10;
+
+int
+main(void)
{
int dset1_data[D1DIM1][D1DIM2], dset2_data[D2DIM1][D2DIM2]; // data buffers
int i, j;
// Try block to catch exceptions raised by any of the calls inside it
- try
- {
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately
Exception::dontPrint();
@@ -48,12 +48,12 @@ int main(void)
// Initialize the first dataset.
for (i = 0; i < D1DIM1; i++)
for (j = 0; j < D1DIM2; j++)
- dset1_data[i][j] = j + 1;
+ dset1_data[i][j] = j + 1;
// Initialize the second dataset.
for (i = 0; i < D2DIM1; i++)
- for (j = 0; j < D2DIM2; j++)
- dset2_data[i][j] = j + 1;
+ for (j = 0; j < D2DIM2; j++)
+ dset2_data[i][j] = j + 1;
// Open an existing file and dataset.
H5File file(FILE_NAME, H5F_ACC_RDWR);
@@ -62,15 +62,14 @@ int main(void)
// pointer for the instance 'dataspace'. It can be deleted and
// used again later for another data space. An HDF5 identifier is
// closed by the destructor or the method 'close()'.
- hsize_t dims[RANK]; // dataset dimensions
- dims[0] = D1DIM1;
- dims[1] = D1DIM2;
- DataSpace *dataspace = new DataSpace (RANK, dims);
+ hsize_t dims[RANK]; // dataset dimensions
+ dims[0] = D1DIM1;
+ dims[1] = D1DIM2;
+ DataSpace *dataspace = new DataSpace(RANK, dims);
// Create the dataset in group "MyGroup". Same note as for the
// dataspace above.
- DataSet *dataset = new DataSet (file.createDataSet(DATASET_NAME1,
- PredType::STD_I32BE, *dataspace));
+ DataSet *dataset = new DataSet(file.createDataSet(DATASET_NAME1, PredType::STD_I32BE, *dataspace));
// Write the data to the dataset using default memory space, file
// space, and transfer properties.
@@ -81,16 +80,15 @@ int main(void)
delete dataspace;
// Create the data space for the second dataset.
- dims[0] = D2DIM1;
- dims[1] = D2DIM2;
- dataspace = new DataSpace (RANK, dims);
+ dims[0] = D2DIM1;
+ dims[1] = D2DIM2;
+ dataspace = new DataSpace(RANK, dims);
// Create group "Group_A" in group "MyGroup".
Group group(file.openGroup("/MyGroup/Group_A"));
// Create the second dataset in group "Group_A".
- dataset = new DataSet (group.createDataSet(DATASET_NAME2,
- PredType::STD_I32BE, *dataspace));
+ dataset = new DataSet(group.createDataSet(DATASET_NAME2, PredType::STD_I32BE, *dataspace));
// Write the data to the dataset using default memory space, file
// space, and transfer properties.
@@ -104,31 +102,27 @@ int main(void)
} // end of try block
// catch failure caused by the H5File operations
- catch(FileIException error)
- {
- error.printErrorStack();
- return -1;
+ catch (FileIException error) {
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSet operations
- catch(DataSetIException error)
- {
- error.printErrorStack();
- return -1;
+ catch (DataSetIException error) {
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSpace operations
- catch(DataSpaceIException error)
- {
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the Group operations
- catch(GroupIException error)
- {
+ catch (GroupIException error) {
error.printErrorStack();
return -1;
}
- return 0;
+ return 0;
}
diff --git a/c++/examples/h5tutr_extend.cpp b/c++/examples/h5tutr_extend.cpp
index 94e9acf..71a8ffb 100644
--- a/c++/examples/h5tutr_extend.cpp
+++ b/c++/examples/h5tutr_extend.cpp
@@ -24,34 +24,28 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME("h5tutr_extend.h5");
-const H5std_string DATASETNAME("ExtendibleArray");
+const H5std_string FILE_NAME("h5tutr_extend.h5");
+const H5std_string DATASETNAME("ExtendibleArray");
-int main (void)
+int
+main(void)
{
- hsize_t dims[2] = {3,3}; // dataset dimensions at creation
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] ={2, 5};
- int data[3][3] = { {1, 1, 1}, // data to write
- {1, 1, 1},
- {1, 1, 1} };
-
- // Variables used in extending and writing to the extended portion of dataset
-
- hsize_t size[2];
- hsize_t offset[2];
- hsize_t dimsext[2] = {7, 3}; // extend dimensions
- int dataext[7][3] = { {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4} };
+ hsize_t dims[2] = {3, 3}; // dataset dimensions at creation
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims[2] = {2, 5};
+ int data[3][3] = {{1, 1, 1}, // data to write
+ {1, 1, 1},
+ {1, 1, 1}};
+
+ // Variables used in extending and writing to the extended portion of dataset
+
+ hsize_t size[2];
+ hsize_t offset[2];
+ hsize_t dimsext[2] = {7, 3}; // extend dimensions
+ int dataext[7][3] = {{2, 3, 4}, {2, 3, 4}, {2, 3, 4}, {2, 3, 4}, {2, 3, 4}, {2, 3, 4}, {2, 3, 4}};
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately
Exception::dontPrint();
@@ -63,15 +57,15 @@ int main (void)
// for the instance 'dataspace'. It can be deleted and used again
// later for another dataspace. An HDF5 identifier can be closed
// by the destructor or the method 'close()'.
- DataSpace *dataspace = new DataSpace (2, dims, maxdims);
+ DataSpace *dataspace = new DataSpace(2, dims, maxdims);
// Modify dataset creation property to enable chunking
DSetCreatPropList prop;
prop.setChunk(2, chunk_dims);
// Create the chunked dataset. Note the use of pointer.
- DataSet *dataset = new DataSet(file.createDataSet( DATASETNAME,
- PredType::STD_I32BE, *dataspace, prop) );
+ DataSet *dataset =
+ new DataSet(file.createDataSet(DATASETNAME, PredType::STD_I32BE, *dataspace, prop));
// Write data to dataset.
dataset->write(data, PredType::NATIVE_INT);
@@ -82,9 +76,9 @@ int main (void)
dataset->extend(size);
// Select a hyperslab in extended portion of the dataset.
- DataSpace *filespace = new DataSpace(dataset->getSpace ());
- offset[0] = 3;
- offset[1] = 0;
+ DataSpace *filespace = new DataSpace(dataset->getSpace());
+ offset[0] = 3;
+ offset[1] = 0;
filespace->selectHyperslab(H5S_SELECT_SET, dimsext, offset);
// Define memory space.
@@ -105,25 +99,26 @@ int main (void)
// Re-open the file and read the data back
// ---------------------------------------
- int rdata[10][3];
- int i,j, rank, rank_chunk;
- hsize_t chunk_dimsr[2], dimsr[2];
+ int rdata[10][3];
+ int i, j, rank, rank_chunk;
+ hsize_t chunk_dimsr[2], dimsr[2];
// Open the file and dataset.
file.openFile(FILE_NAME, H5F_ACC_RDONLY);
- dataset = new DataSet(file.openDataSet( DATASETNAME));
+ dataset = new DataSet(file.openDataSet(DATASETNAME));
// Get the dataset's dataspace and creation property list.
filespace = new DataSpace(dataset->getSpace());
- prop = dataset->getCreatePlist();
+ prop = dataset->getCreatePlist();
// Get information to obtain memory dataspace.
- rank = filespace->getSimpleExtentNdims();
+ rank = filespace->getSimpleExtentNdims();
herr_t status_n = filespace->getSimpleExtentDims(dimsr);
if (H5D_CHUNKED == prop.getLayout())
- rank_chunk = prop.getChunk(rank, chunk_dimsr);
- cout << "rank chunk = " << rank_chunk << endl;;
+ rank_chunk = prop.getChunk(rank, chunk_dimsr);
+ cout << "rank chunk = " << rank_chunk << endl;
+ ;
memspace = new DataSpace(rank, dimsr, NULL);
dataset->read(rdata, PredType::NATIVE_INT, *memspace, *filespace);
@@ -131,7 +126,7 @@ int main (void)
cout << endl;
for (j = 0; j < dimsr[0]; j++) {
for (i = 0; i < dimsr[1]; i++)
- cout << " " << rdata[j][i];
+ cout << " " << rdata[j][i];
cout << endl;
}
@@ -142,29 +137,25 @@ int main (void)
delete dataset;
file.close();
- } // end of try block
+ } // end of try block
// catch failure caused by the H5File operations
- catch(FileIException error)
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSet operations
- catch(DataSetIException error)
- {
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSpace operations
- catch(DataSpaceIException error)
- {
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
}
- return 0; // successfully terminated
+ return 0; // successfully terminated
}
-
diff --git a/c++/examples/h5tutr_rdwt.cpp b/c++/examples/h5tutr_rdwt.cpp
index e9b76ad..4d265cd 100644
--- a/c++/examples/h5tutr_rdwt.cpp
+++ b/c++/examples/h5tutr_rdwt.cpp
@@ -21,53 +21,51 @@
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME("h5tutr_dset.h5");
-const H5std_string DATASET_NAME("dset");
-const int DIM0 = 4; // dataset dimensions
-const int DIM1 = 6;
+const H5std_string FILE_NAME("h5tutr_dset.h5");
+const H5std_string DATASET_NAME("dset");
+const int DIM0 = 4; // dataset dimensions
+const int DIM1 = 6;
-int main (void)
+int
+main(void)
{
// Data initialization.
int i, j;
- int data[DIM0][DIM1]; // buffer for data to write
+ int data[DIM0][DIM1]; // buffer for data to write
for (j = 0; j < DIM0; j++)
for (i = 0; i < DIM1; i++)
- data[j][i] = i * 6 + j + 1;
+ data[j][i] = i * 6 + j + 1;
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately
Exception::dontPrint();
// Open an existing file and dataset.
- H5File file(FILE_NAME, H5F_ACC_RDWR);
+ H5File file(FILE_NAME, H5F_ACC_RDWR);
DataSet dataset = file.openDataSet(DATASET_NAME);
// Write the data to the dataset using default memory space, file
// space, and transfer properties.
dataset.write(data, PredType::NATIVE_INT);
- } // end of try block
+ } // end of try block
// catch failure caused by the H5File operations
- catch(FileIException error)
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSet operations
- catch(DataSetIException error)
- {
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
}
- return 0; // successfully terminated
+ return 0; // successfully terminated
}
diff --git a/c++/examples/h5tutr_subset.cpp b/c++/examples/h5tutr_subset.cpp
index f7d0513..d4b77c3 100644
--- a/c++/examples/h5tutr_subset.cpp
+++ b/c++/examples/h5tutr_subset.cpp
@@ -24,23 +24,23 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME("h5tutr_subset.h5");
-const H5std_string DATASET_NAME("IntArray");
+const H5std_string FILE_NAME("h5tutr_subset.h5");
+const H5std_string DATASET_NAME("IntArray");
-const int RANK = 2;
-const int DIM0_SUB = 3; // subset dimensions
-const int DIM1_SUB = 4;
-const int DIM0 = 8; // size of dataset
-const int DIM1 = 10;
+const int RANK = 2;
+const int DIM0_SUB = 3; // subset dimensions
+const int DIM1_SUB = 4;
+const int DIM0 = 8; // size of dataset
+const int DIM1 = 10;
-int main (void)
+int
+main(void)
{
- int i,j;
- int data[DIM0][DIM1], sdata[DIM0_SUB][DIM1_SUB], rdata[DIM0][DIM1];
+ int i, j;
+ int data[DIM0][DIM1], sdata[DIM0_SUB][DIM1_SUB], rdata[DIM0][DIM1];
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately
Exception::dontPrint();
@@ -54,28 +54,26 @@ int main (void)
H5File file(FILE_NAME, H5F_ACC_TRUNC);
hsize_t dims[2];
- dims[0] = DIM0;
- dims[1] = DIM1;
- DataSpace dataspace = DataSpace (RANK, dims);
-
- DataSet dataset(file.createDataSet( DATASET_NAME,
- PredType::STD_I32BE, dataspace) );
+ dims[0] = DIM0;
+ dims[1] = DIM1;
+ DataSpace dataspace = DataSpace(RANK, dims);
+ DataSet dataset(file.createDataSet(DATASET_NAME, PredType::STD_I32BE, dataspace));
for (j = 0; j < DIM0; j++) {
- for (i = 0; i < DIM1; i++)
- if (i< (DIM1/2))
+ for (i = 0; i < DIM1; i++)
+ if (i < (DIM1 / 2))
data[j][i] = 1;
- else
+ else
data[j][i] = 2;
- }
+ }
dataset.write(data, PredType::NATIVE_INT);
cout << endl << "Data Written to File:" << endl;
for (j = 0; j < DIM0; j++) {
for (i = 0; i < DIM1; i++)
- cout << " " << data[j][i];
+ cout << " " << data[j][i];
cout << endl;
}
@@ -99,8 +97,8 @@ int main (void)
offset[0] = 1;
offset[1] = 2;
- count[0] = DIM0_SUB;
- count[1] = DIM1_SUB;
+ count[0] = DIM0_SUB;
+ count[1] = DIM1_SUB;
stride[0] = 1;
stride[1] = 1;
@@ -126,17 +124,16 @@ int main (void)
cout << " offset=1x2 stride=1x1 count=3x4 block=1x1" << endl;
for (j = 0; j < DIM0_SUB; j++) {
for (i = 0; i < DIM1_SUB; i++)
- sdata[j][i] = 5;
+ sdata[j][i] = 5;
}
dataset.write(sdata, PredType::NATIVE_INT, memspace, dataspace);
dataset.read(rdata, PredType::NATIVE_INT);
-
cout << endl << "Data in File after Subset is Written:" << endl;
for (i = 0; i < DIM0; i++) {
for (j = 0; j < DIM1; j++)
- cout << " " << rdata[i][j];
+ cout << " " << rdata[i][j];
cout << endl;
}
cout << endl;
@@ -148,29 +145,25 @@ int main (void)
dataset.close();
file.close();
- } // end of try block
+ } // end of try block
// catch failure caused by the H5File operations
- catch(FileIException error)
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSet operations
- catch(DataSetIException error)
- {
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSpace operations
- catch(DataSpaceIException error)
- {
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
}
- return 0; // successfully terminated
+ return 0; // successfully terminated
}
-
diff --git a/c++/examples/readdata.cpp b/c++/examples/readdata.cpp
index 3df8191..e088cce 100644
--- a/c++/examples/readdata.cpp
+++ b/c++/examples/readdata.cpp
@@ -29,184 +29,174 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "SDS.h5" );
-const H5std_string DATASET_NAME( "IntArray" );
-const int NX_SUB = 3; // hyperslab dimensions
-const int NY_SUB = 4;
-const int NX = 7; // output buffer dimensions
-const int NY = 7;
-const int NZ = 3;
-const int RANK_OUT = 3;
-
-int main (void)
+const H5std_string FILE_NAME("SDS.h5");
+const H5std_string DATASET_NAME("IntArray");
+const int NX_SUB = 3; // hyperslab dimensions
+const int NY_SUB = 4;
+const int NX = 7; // output buffer dimensions
+const int NY = 7;
+const int NZ = 3;
+const int RANK_OUT = 3;
+
+int
+main(void)
{
- /*
- * Output buffer initialization.
- */
- int i, j, k;
- int data_out[NX][NY][NZ ]; /* output buffer */
- for (j = 0; j < NX; j++)
- {
- for (i = 0; i < NY; i++)
- {
- for (k = 0; k < NZ ; k++)
- data_out[j][i][k] = 0;
- }
- }
-
- /*
- * Try block to detect exceptions raised by any of the calls inside it
- */
- try
- {
- /*
- * Turn off the auto-printing when failure occurs so that we can
- * handle the errors appropriately
- */
- Exception::dontPrint();
-
- /*
- * Open the specified file and the specified dataset in the file.
- */
- H5File file( FILE_NAME, H5F_ACC_RDONLY );
- DataSet dataset = file.openDataSet( DATASET_NAME );
-
- /*
- * Get the class of the datatype that is used by the dataset.
- */
- H5T_class_t type_class = dataset.getTypeClass();
-
- /*
- * Get class of datatype and print message if it's an integer.
- */
- if( type_class == H5T_INTEGER )
- {
- cout << "Data set has INTEGER type" << endl;
-
- /*
- * Get the integer datatype
- */
- IntType intype = dataset.getIntType();
-
- /*
- * Get order of datatype and print message if it's a little endian.
- */
- H5std_string order_string;
- H5T_order_t order = intype.getOrder( order_string );
- cout << order_string << endl;
-
- /*
- * Get size of the data element stored in file and print it.
- */
- size_t size = intype.getSize();
- cout << "Data size is " << size << endl;
- }
-
- /*
- * Get dataspace of the dataset.
- */
- DataSpace dataspace = dataset.getSpace();
-
- /*
- * Get the number of dimensions in the dataspace.
- */
- int rank = dataspace.getSimpleExtentNdims();
-
- /*
- * Get the dimension size of each dimension in the dataspace and
- * display them.
- */
- hsize_t dims_out[2];
- int ndims = dataspace.getSimpleExtentDims( dims_out, NULL);
- cout << "rank " << rank << ", dimensions " <<
- (unsigned long)(dims_out[0]) << " x " <<
- (unsigned long)(dims_out[1]) << endl;
-
- /*
- * Define hyperslab in the dataset; implicitly giving strike and
- * block NULL.
- */
- hsize_t offset[2]; // hyperslab offset in the file
- hsize_t count[2]; // size of the hyperslab in the file
- offset[0] = 1;
- offset[1] = 2;
- count[0] = NX_SUB;
- count[1] = NY_SUB;
- dataspace.selectHyperslab( H5S_SELECT_SET, count, offset );
-
- /*
- * Define the memory dataspace.
- */
- hsize_t dimsm[3]; /* memory space dimensions */
- dimsm[0] = NX;
- dimsm[1] = NY;
- dimsm[2] = NZ ;
- DataSpace memspace( RANK_OUT, dimsm );
-
- /*
- * Define memory hyperslab.
- */
- hsize_t offset_out[3]; // hyperslab offset in memory
- hsize_t count_out[3]; // size of the hyperslab in memory
- offset_out[0] = 3;
- offset_out[1] = 0;
- offset_out[2] = 0;
- count_out[0] = NX_SUB;
- count_out[1] = NY_SUB;
- count_out[2] = 1;
- memspace.selectHyperslab( H5S_SELECT_SET, count_out, offset_out );
-
- /*
- * Read data from hyperslab in the file into the hyperslab in
- * memory and display the data.
- */
- dataset.read( data_out, PredType::NATIVE_INT, memspace, dataspace );
-
- for (j = 0; j < NX; j++)
- {
- for (i = 0; i < NY; i++)
- cout << data_out[j][i][0] << " ";
- cout << endl;
- }
- /*
- * 0 0 0 0 0 0 0
- * 0 0 0 0 0 0 0
- * 0 0 0 0 0 0 0
- * 3 4 5 6 0 0 0
- * 4 5 6 7 0 0 0
- * 5 6 7 8 0 0 0
- * 0 0 0 0 0 0 0
- */
- } // end of try block
-
- // catch failure caused by the H5File operations
- catch( FileIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSpace operations
- catch( DataSpaceIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSpace operations
- catch( DataTypeIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- return 0; // successfully terminated
+ /*
+ * Output buffer initialization.
+ */
+ int i, j, k;
+ int data_out[NX][NY][NZ]; /* output buffer */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++) {
+ for (k = 0; k < NZ; k++)
+ data_out[j][i][k] = 0;
+ }
+ }
+
+ /*
+ * Try block to detect exceptions raised by any of the calls inside it
+ */
+ try {
+ /*
+ * Turn off the auto-printing when failure occurs so that we can
+ * handle the errors appropriately
+ */
+ Exception::dontPrint();
+
+ /*
+ * Open the specified file and the specified dataset in the file.
+ */
+ H5File file(FILE_NAME, H5F_ACC_RDONLY);
+ DataSet dataset = file.openDataSet(DATASET_NAME);
+
+ /*
+ * Get the class of the datatype that is used by the dataset.
+ */
+ H5T_class_t type_class = dataset.getTypeClass();
+
+ /*
+ * Get class of datatype and print message if it's an integer.
+ */
+ if (type_class == H5T_INTEGER) {
+ cout << "Data set has INTEGER type" << endl;
+
+ /*
+ * Get the integer datatype
+ */
+ IntType intype = dataset.getIntType();
+
+ /*
+ * Get order of datatype and print message if it's a little endian.
+ */
+ H5std_string order_string;
+ H5T_order_t order = intype.getOrder(order_string);
+ cout << order_string << endl;
+
+ /*
+ * Get size of the data element stored in file and print it.
+ */
+ size_t size = intype.getSize();
+ cout << "Data size is " << size << endl;
+ }
+
+ /*
+ * Get dataspace of the dataset.
+ */
+ DataSpace dataspace = dataset.getSpace();
+
+ /*
+ * Get the number of dimensions in the dataspace.
+ */
+ int rank = dataspace.getSimpleExtentNdims();
+
+ /*
+ * Get the dimension size of each dimension in the dataspace and
+ * display them.
+ */
+ hsize_t dims_out[2];
+ int ndims = dataspace.getSimpleExtentDims(dims_out, NULL);
+ cout << "rank " << rank << ", dimensions " << (unsigned long)(dims_out[0]) << " x "
+ << (unsigned long)(dims_out[1]) << endl;
+
+ /*
+ * Define hyperslab in the dataset; implicitly giving strike and
+ * block NULL.
+ */
+ hsize_t offset[2]; // hyperslab offset in the file
+ hsize_t count[2]; // size of the hyperslab in the file
+ offset[0] = 1;
+ offset[1] = 2;
+ count[0] = NX_SUB;
+ count[1] = NY_SUB;
+ dataspace.selectHyperslab(H5S_SELECT_SET, count, offset);
+
+ /*
+ * Define the memory dataspace.
+ */
+ hsize_t dimsm[3]; /* memory space dimensions */
+ dimsm[0] = NX;
+ dimsm[1] = NY;
+ dimsm[2] = NZ;
+ DataSpace memspace(RANK_OUT, dimsm);
+
+ /*
+ * Define memory hyperslab.
+ */
+ hsize_t offset_out[3]; // hyperslab offset in memory
+ hsize_t count_out[3]; // size of the hyperslab in memory
+ offset_out[0] = 3;
+ offset_out[1] = 0;
+ offset_out[2] = 0;
+ count_out[0] = NX_SUB;
+ count_out[1] = NY_SUB;
+ count_out[2] = 1;
+ memspace.selectHyperslab(H5S_SELECT_SET, count_out, offset_out);
+
+ /*
+ * Read data from hyperslab in the file into the hyperslab in
+ * memory and display the data.
+ */
+ dataset.read(data_out, PredType::NATIVE_INT, memspace, dataspace);
+
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++)
+ cout << data_out[j][i][0] << " ";
+ cout << endl;
+ }
+ /*
+ * 0 0 0 0 0 0 0
+ * 0 0 0 0 0 0 0
+ * 0 0 0 0 0 0 0
+ * 3 4 5 6 0 0 0
+ * 4 5 6 7 0 0 0
+ * 5 6 7 8 0 0 0
+ * 0 0 0 0 0 0 0
+ */
+ } // end of try block
+
+ // catch failure caused by the H5File operations
+ catch (FileIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSet operations
+ catch (DataSetIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSpace operations
+ catch (DataSpaceIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSpace operations
+ catch (DataTypeIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ return 0; // successfully terminated
}
-
diff --git a/c++/examples/writedata.cpp b/c++/examples/writedata.cpp
index eada2ed..61cd43a 100644
--- a/c++/examples/writedata.cpp
+++ b/c++/examples/writedata.cpp
@@ -32,31 +32,31 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "Select.h5" );
-const H5std_string DATASET_NAME( "Matrix in file" );
-const int MSPACE1_RANK = 1; // Rank of the first dataset in memory
-const int MSPACE1_DIM = 50; // Dataset size in memory
-const int MSPACE2_RANK = 1; // Rank of the second dataset in memory
-const int MSPACE2_DIM = 4; // Dataset size in memory
-const int FSPACE_RANK = 2; // Dataset rank as it is stored in the file
-const int FSPACE_DIM1 = 8; // Dimension sizes of the dataset as it is
-const int FSPACE_DIM2 = 12; // stored in the file
-const int MSPACE_RANK = 2; // Rank of the first dataset in memory
-const int MSPACE_DIM1 = 8; // We will read dataset back from the file
-const int MSPACE_DIM2 = 9; // to the dataset in memory with these
- // dataspace parameters
-const int NPOINTS = 4; // Number of points that will be selected
- // and overwritten
-
-int main (void)
+const H5std_string FILE_NAME("Select.h5");
+const H5std_string DATASET_NAME("Matrix in file");
+const int MSPACE1_RANK = 1; // Rank of the first dataset in memory
+const int MSPACE1_DIM = 50; // Dataset size in memory
+const int MSPACE2_RANK = 1; // Rank of the second dataset in memory
+const int MSPACE2_DIM = 4; // Dataset size in memory
+const int FSPACE_RANK = 2; // Dataset rank as it is stored in the file
+const int FSPACE_DIM1 = 8; // Dimension sizes of the dataset as it is
+const int FSPACE_DIM2 = 12; // stored in the file
+const int MSPACE_RANK = 2; // Rank of the first dataset in memory
+const int MSPACE_DIM1 = 8; // We will read dataset back from the file
+const int MSPACE_DIM2 = 9; // to the dataset in memory with these
+ // dataspace parameters
+const int NPOINTS = 4; // Number of points that will be selected
+ // and overwritten
+
+int
+main(void)
{
- int i,j; // loop indices */
+ int i, j; // loop indices */
/*
* Try block to detect exceptions raised by any of the calls inside it
*/
- try
- {
+ try {
/*
* Turn off the auto-printing when failure occurs so that we can
* handle the errors appropriately
@@ -66,47 +66,51 @@ int main (void)
/*
* Create a file.
*/
- H5File* file = new H5File( FILE_NAME, H5F_ACC_TRUNC );
+ H5File *file = new H5File(FILE_NAME, H5F_ACC_TRUNC);
/*
- * Create property list for a dataset and set up fill values.
- */
- int fillvalue = 0; /* Fill value for the dataset */
+ * Create property list for a dataset and set up fill values.
+ */
+ int fillvalue = 0; /* Fill value for the dataset */
DSetCreatPropList plist;
plist.setFillValue(PredType::NATIVE_INT, &fillvalue);
/*
* Create dataspace for the dataset in the file.
*/
- hsize_t fdim[] = {FSPACE_DIM1, FSPACE_DIM2}; // dim sizes of ds (on disk)
- DataSpace fspace( FSPACE_RANK, fdim );
+ hsize_t fdim[] = {FSPACE_DIM1, FSPACE_DIM2}; // dim sizes of ds (on disk)
+ DataSpace fspace(FSPACE_RANK, fdim);
/*
* Create dataset and write it into the file.
*/
- DataSet* dataset = new DataSet(file->createDataSet(
- DATASET_NAME, PredType::NATIVE_INT, fspace, plist));
+ DataSet *dataset =
+ new DataSet(file->createDataSet(DATASET_NAME, PredType::NATIVE_INT, fspace, plist));
/*
* Select hyperslab for the dataset in the file, using 3x2 blocks,
* (4,3) stride and (2,4) count starting at the position (0,1).
*/
- hsize_t start[2]; // Start of hyperslab
+ hsize_t start[2]; // Start of hyperslab
hsize_t stride[2]; // Stride of hyperslab
hsize_t count[2]; // Block count
hsize_t block[2]; // Block sizes
- start[0] = 0; start[1] = 1;
- stride[0] = 4; stride[1] = 3;
- count[0] = 2; count[1] = 4;
- block[0] = 3; block[1] = 2;
- fspace.selectHyperslab( H5S_SELECT_SET, count, start, stride, block);
+ start[0] = 0;
+ start[1] = 1;
+ stride[0] = 4;
+ stride[1] = 3;
+ count[0] = 2;
+ count[1] = 4;
+ block[0] = 3;
+ block[1] = 2;
+ fspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
/*
* Create dataspace for the first dataset.
*/
- hsize_t dim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset
- (in memory) */
- DataSpace mspace1( MSPACE1_RANK, dim1 );
+ hsize_t dim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset
+ (in memory) */
+ DataSpace mspace1(MSPACE1_RANK, dim1);
/*
* Select hyperslab.
@@ -117,7 +121,7 @@ int main (void)
stride[0] = 1;
count[0] = 48;
block[0] = 1;
- mspace1.selectHyperslab( H5S_SELECT_SET, count, start, stride, block);
+ mspace1.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
/*
* Write selection from the vector buffer to the dataset in the file.
@@ -132,7 +136,7 @@ int main (void)
* 0 41 42 0 43 44 0 45 46 0 47 48
* 0 0 0 0 0 0 0 0 0 0 0 0
*/
- int vector[MSPACE1_DIM]; // vector buffer for dset
+ int vector[MSPACE1_DIM]; // vector buffer for dset
/*
* Buffer initialization.
@@ -141,7 +145,7 @@ int main (void)
for (i = 1; i < MSPACE1_DIM - 1; i++)
vector[i] = i;
- dataset->write( vector, PredType::NATIVE_INT, mspace1, fspace );
+ dataset->write(vector, PredType::NATIVE_INT, mspace1, fspace);
/*
* Reset the selection for the file dataspace fid.
@@ -151,27 +155,31 @@ int main (void)
/*
* Create dataspace for the second dataset.
*/
- hsize_t dim2[] = {MSPACE2_DIM}; /* Dimension size of the second dataset
- (in memory */
- DataSpace mspace2( MSPACE2_RANK, dim2 );
+ hsize_t dim2[] = {MSPACE2_DIM}; /* Dimension size of the second dataset
+ (in memory */
+ DataSpace mspace2(MSPACE2_RANK, dim2);
/*
* Select sequence of NPOINTS points in the file dataspace.
*/
hsize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points
from the file dataspace */
- coord[0][0] = 0; coord[0][1] = 0;
- coord[1][0] = 3; coord[1][1] = 3;
- coord[2][0] = 3; coord[2][1] = 5;
- coord[3][0] = 5; coord[3][1] = 6;
+ coord[0][0] = 0;
+ coord[0][1] = 0;
+ coord[1][0] = 3;
+ coord[1][1] = 3;
+ coord[2][0] = 3;
+ coord[2][1] = 5;
+ coord[3][0] = 5;
+ coord[3][1] = 6;
- fspace.selectElements( H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord);
+ fspace.selectElements(H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord);
/*
* Write new selection of points to the dataset.
*/
- int values[] = {53, 59, 61, 67}; /* New values to be written */
- dataset->write( values, PredType::NATIVE_INT, mspace2, fspace );
+ int values[] = {53, 59, 61, 67}; /* New values to be written */
+ dataset->write(values, PredType::NATIVE_INT, mspace2, fspace);
/*
* File dataset should look like this:
@@ -195,12 +203,12 @@ int main (void)
/*
* Open the file.
*/
- file = new H5File( FILE_NAME, H5F_ACC_RDONLY );
+ file = new H5File(FILE_NAME, H5F_ACC_RDONLY);
/*
* Open the dataset.
*/
- dataset = new DataSet( file->openDataSet( DATASET_NAME ));
+ dataset = new DataSet(file->openDataSet(DATASET_NAME));
/*
* Get dataspace of the dataset.
@@ -215,10 +223,14 @@ int main (void)
* 0 59 0 61
*
*/
- start[0] = 1; start[1] = 2;
- block[0] = 1; block[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 3; count[1] = 4;
+ start[0] = 1;
+ start[1] = 2;
+ block[0] = 1;
+ block[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 3;
+ count[1] = 4;
fspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
/*
@@ -234,10 +246,14 @@ int main (void)
* 19 20
* 0 61
*/
- start[0] = 2; start[1] = 4;
- block[0] = 1; block[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 6; count[1] = 5;
+ start[0] = 2;
+ start[1] = 4;
+ block[0] = 1;
+ block[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 6;
+ count[1] = 5;
fspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block);
/*
@@ -253,15 +269,23 @@ int main (void)
* Select two hyperslabs in memory. Hyperslabs has the same
* size and shape as the selected hyperslabs for the file dataspace.
*/
- start[0] = 0; start[1] = 0;
- block[0] = 1; block[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 3; count[1] = 4;
+ start[0] = 0;
+ start[1] = 0;
+ block[0] = 1;
+ block[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 3;
+ count[1] = 4;
mspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
- start[0] = 1; start[1] = 2;
- block[0] = 1; block[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 6; count[1] = 5;
+ start[0] = 1;
+ start[1] = 2;
+ block[0] = 1;
+ block[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 6;
+ count[1] = 5;
mspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block);
/*
@@ -289,9 +313,8 @@ int main (void)
* 0 0 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0 0 0
*/
- for (i=0; i < MSPACE_DIM1; i++)
- {
- for(j=0; j < MSPACE_DIM2; j++)
+ for (i = 0; i < MSPACE_DIM1; i++) {
+ for (j = 0; j < MSPACE_DIM2; j++)
cout << matrix_out[i][j] << " ";
cout << endl;
}
@@ -301,28 +324,25 @@ int main (void)
*/
delete dataset;
delete file;
- } // end of try block
+ } // end of try block
- // catch failure caused by the H5File operations
- catch( FileIException error )
- {
+ // catch failure caused by the H5File operations
+ catch (FileIException error) {
error.printErrorStack();
return -1;
- }
+ }
- // catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
+ // catch failure caused by the DataSet operations
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
- }
+ }
- // catch failure caused by the DataSpace operations
- catch( DataSpaceIException error )
- {
+ // catch failure caused by the DataSpace operations
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
- }
+ }
- return 0;
+ return 0;
}
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp
index d59a3cb..da06f05 100644
--- a/c++/src/H5AbstractDs.cpp
+++ b/c++/src/H5AbstractDs.cpp
@@ -38,7 +38,7 @@ namespace H5 {
///\brief Default constructor
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-AbstractDs::AbstractDs(){}
+AbstractDs::AbstractDs() {}
//--------------------------------------------------------------------------
// Function: AbstractDs default constructor
@@ -61,19 +61,20 @@ AbstractDs::AbstractDs(){}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_class_t AbstractDs::getTypeClass() const
+H5T_class_t
+AbstractDs::getTypeClass() const
{
// Gets the datatype used by this dataset or attribute.
// p_get_type calls either H5Dget_type or H5Aget_type depending on
// which object invokes getTypeClass
hid_t datatype_id;
try {
- datatype_id = p_get_type(); // returned value is already validated
+ datatype_id = p_get_type(); // returned value is already validated
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getTypeClass", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getTypeClass", E.getDetailMsg());
}
@@ -82,8 +83,7 @@ H5T_class_t AbstractDs::getTypeClass() const
// Close temporary datatype_id
herr_t ret_value = H5Tclose(datatype_id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
if (fromClass() == "DataSet")
throw DataTypeIException("DataSet::getTypeClass", "H5Tclose failed");
else if (fromClass() == "Attribute")
@@ -91,14 +91,13 @@ H5T_class_t AbstractDs::getTypeClass() const
}
// Check on the returned type_class
- if (type_class == H5T_NO_CLASS)
- {
+ if (type_class == H5T_NO_CLASS) {
if (fromClass() == "DataSet")
throw DataTypeIException("DataSet::getTypeClass", "H5Tget_class returns H5T_NO_CLASS");
else if (fromClass() == "Attribute")
throw DataTypeIException("Attribute::getTypeClass", "H5Tget_class returns H5T_NO_CLASS");
}
- return(type_class);
+ return (type_class);
}
//--------------------------------------------------------------------------
@@ -109,7 +108,8 @@ H5T_class_t AbstractDs::getTypeClass() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType AbstractDs::getDataType() const
+DataType
+AbstractDs::getDataType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
@@ -118,12 +118,12 @@ DataType AbstractDs::getDataType() const
try {
DataType datatype;
f_DataType_setId(&datatype, p_get_type());
- return(datatype);
+ return (datatype);
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getDataType", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getDataType", E.getDetailMsg());
}
}
@@ -136,7 +136,8 @@ DataType AbstractDs::getDataType() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-ArrayType AbstractDs::getArrayType() const
+ArrayType
+AbstractDs::getArrayType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
@@ -147,12 +148,12 @@ ArrayType AbstractDs::getArrayType() const
// problem described in the JIRA issue HDFFV-7947
ArrayType arraytype;
f_DataType_setId(&arraytype, p_get_type());
- return(arraytype);
+ return (arraytype);
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getArrayType", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getArrayType", E.getDetailMsg());
}
}
@@ -165,7 +166,8 @@ ArrayType AbstractDs::getArrayType() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType AbstractDs::getCompType() const
+CompType
+AbstractDs::getCompType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
@@ -174,12 +176,12 @@ CompType AbstractDs::getCompType() const
try {
CompType comptype;
f_DataType_setId(&comptype, p_get_type());
- return(comptype);
+ return (comptype);
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getCompType", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getCompType", E.getDetailMsg());
}
}
@@ -192,7 +194,8 @@ CompType AbstractDs::getCompType() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType AbstractDs::getEnumType() const
+EnumType
+AbstractDs::getEnumType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
@@ -201,12 +204,12 @@ EnumType AbstractDs::getEnumType() const
try {
EnumType enumtype;
f_DataType_setId(&enumtype, p_get_type());
- return(enumtype);
+ return (enumtype);
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getEnumType", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getEnumType", E.getDetailMsg());
}
}
@@ -219,7 +222,8 @@ EnumType AbstractDs::getEnumType() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType AbstractDs::getIntType() const
+IntType
+AbstractDs::getIntType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
@@ -228,12 +232,12 @@ IntType AbstractDs::getIntType() const
try {
IntType inttype;
f_DataType_setId(&inttype, p_get_type());
- return(inttype);
+ return (inttype);
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getIntType", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getIntType", E.getDetailMsg());
}
}
@@ -246,7 +250,8 @@ IntType AbstractDs::getIntType() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType AbstractDs::getFloatType() const
+FloatType
+AbstractDs::getFloatType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
@@ -255,12 +260,12 @@ FloatType AbstractDs::getFloatType() const
try {
FloatType floatype;
f_DataType_setId(&floatype, p_get_type());
- return(floatype);
+ return (floatype);
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getFloatType", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getFloatType", E.getDetailMsg());
}
}
@@ -273,7 +278,8 @@ FloatType AbstractDs::getFloatType() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType AbstractDs::getStrType() const
+StrType
+AbstractDs::getStrType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
@@ -282,12 +288,12 @@ StrType AbstractDs::getStrType() const
try {
StrType strtype;
f_DataType_setId(&strtype, p_get_type());
- return(strtype);
+ return (strtype);
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getStrType", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getStrType", E.getDetailMsg());
}
}
@@ -300,7 +306,8 @@ StrType AbstractDs::getStrType() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-VarLenType AbstractDs::getVarLenType() const
+VarLenType
+AbstractDs::getVarLenType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
@@ -309,12 +316,12 @@ VarLenType AbstractDs::getVarLenType() const
try {
VarLenType varlentype;
f_DataType_setId(&varlentype, p_get_type());
- return(varlentype);
+ return (varlentype);
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getVarLenType", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getVarLenType", E.getDetailMsg());
}
}
@@ -326,4 +333,4 @@ VarLenType AbstractDs::getVarLenType() const
//--------------------------------------------------------------------------
AbstractDs::~AbstractDs() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h
index 399e033..0c66845 100644
--- a/c++/src/H5AbstractDs.h
+++ b/c++/src/H5AbstractDs.h
@@ -34,49 +34,49 @@ class DataSpace;
and DataSet.
*/
class H5_DLLCPP AbstractDs {
- public:
- // Gets a copy the datatype of that this abstract dataset uses.
- // Note that this datatype is a generic one and can only be accessed
- // via generic member functions, i.e., member functions belong
- // to DataType. To get specific datatype, i.e. EnumType, FloatType,
- // etc..., use the specific functions, that follow, instead.
- DataType getDataType() const;
-
- // Gets a copy of the specific datatype of this abstract dataset.
- ArrayType getArrayType() const;
- CompType getCompType() const;
- EnumType getEnumType() const;
- IntType getIntType() const;
- FloatType getFloatType() const;
- StrType getStrType() const;
- VarLenType getVarLenType() const;
-
- ///\brief Gets the size in memory of this abstract dataset.
- virtual size_t getInMemDataSize() const = 0;
-
- ///\brief Gets the dataspace of this abstract dataset - pure virtual.
- virtual DataSpace getSpace() const = 0;
-
- // Gets the class of the datatype that is used by this abstract
- // dataset.
- H5T_class_t getTypeClass() const;
-
- ///\brief Returns the amount of storage size required - pure virtual.
- virtual hsize_t getStorageSize() const = 0;
-
- // Returns this class name - pure virtual.
- virtual H5std_string fromClass() const = 0;
-
- // Destructor
- virtual ~AbstractDs();
-
- protected:
- // Default constructor
- AbstractDs();
-
- private:
- // This member function is implemented by DataSet and Attribute - pure virtual.
- virtual hid_t p_get_type() const = 0;
+ public:
+ // Gets a copy the datatype of that this abstract dataset uses.
+ // Note that this datatype is a generic one and can only be accessed
+ // via generic member functions, i.e., member functions belong
+ // to DataType. To get specific datatype, i.e. EnumType, FloatType,
+ // etc..., use the specific functions, that follow, instead.
+ DataType getDataType() const;
+
+ // Gets a copy of the specific datatype of this abstract dataset.
+ ArrayType getArrayType() const;
+ CompType getCompType() const;
+ EnumType getEnumType() const;
+ IntType getIntType() const;
+ FloatType getFloatType() const;
+ StrType getStrType() const;
+ VarLenType getVarLenType() const;
+
+ ///\brief Gets the size in memory of this abstract dataset.
+ virtual size_t getInMemDataSize() const = 0;
+
+ ///\brief Gets the dataspace of this abstract dataset - pure virtual.
+ virtual DataSpace getSpace() const = 0;
+
+ // Gets the class of the datatype that is used by this abstract
+ // dataset.
+ H5T_class_t getTypeClass() const;
+
+ ///\brief Returns the amount of storage size required - pure virtual.
+ virtual hsize_t getStorageSize() const = 0;
+
+ // Returns this class name - pure virtual.
+ virtual H5std_string fromClass() const = 0;
+
+ // Destructor
+ virtual ~AbstractDs();
+
+ protected:
+ // Default constructor
+ AbstractDs();
+
+ private:
+ // This member function is implemented by DataSet and Attribute - pure virtual.
+ virtual hid_t p_get_type() const = 0;
}; // end of AbstractDs
} // namespace H5
diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp
index 0dab8ef..877be13 100644
--- a/c++/src/H5ArrayType.cpp
+++ b/c++/src/H5ArrayType.cpp
@@ -50,7 +50,7 @@ ArrayType::ArrayType(const hid_t existing_id) : DataType(existing_id) {}
///\brief Copy constructor: same HDF5 object as \a original
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
-ArrayType::ArrayType(const ArrayType& original) : DataType(original) {}
+ArrayType::ArrayType(const ArrayType &original) : DataType(original) {}
//--------------------------------------------------------------------------
// Function: ArrayType overloaded constructor
@@ -62,7 +62,7 @@ ArrayType::ArrayType(const ArrayType& original) : DataType(original) {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
-ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims) : DataType()
+ArrayType::ArrayType(const DataType &base_type, int ndims, const hsize_t *dims) : DataType()
{
// Call C API to create an array data type
hid_t new_type_id = H5Tarray_create2(base_type.getId(), ndims, dims);
@@ -87,7 +87,7 @@ ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims)
// improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-ArrayType::ArrayType(const H5Location& loc, const char *dtype_name) : DataType()
+ArrayType::ArrayType(const H5Location &loc, const char *dtype_name) : DataType()
{
id = p_opentype(loc, dtype_name);
}
@@ -106,7 +106,7 @@ ArrayType::ArrayType(const H5Location& loc, const char *dtype_name) : DataType()
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-ArrayType::ArrayType(const H5Location& loc, const H5std_string& dtype_name) : DataType()
+ArrayType::ArrayType(const H5Location &loc, const H5std_string &dtype_name) : DataType()
{
id = p_opentype(loc, dtype_name.c_str());
}
@@ -122,21 +122,21 @@ ArrayType::ArrayType(const H5Location& loc, const H5std_string& dtype_name) : Da
// each data member from the rhs object. (Issue HDFFV-9562)
// Programmer Binh-Minh Ribler - Mar 2016
//--------------------------------------------------------------------------
-ArrayType& ArrayType::operator=(const ArrayType& rhs)
+ArrayType &
+ArrayType::operator=(const ArrayType &rhs)
{
- if (this != &rhs)
- {
+ if (this != &rhs) {
// handling references to this id
try {
setId(rhs.id);
// Note: a = b, so there are two objects with the same hdf5 id
// that's why incRefCount is needed, and it is called by setId
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw DataTypeIException(inMemFunc("operator="), close_error.getDetailMsg());
}
}
- return(*this);
+ return (*this);
}
//--------------------------------------------------------------------------
@@ -147,7 +147,8 @@ ArrayType& ArrayType::operator=(const ArrayType& rhs)
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-DataType* ArrayType::decode() const
+DataType *
+ArrayType::decode() const
{
hid_t encoded_arrtype_id = H5I_INVALID_HID;
try {
@@ -158,7 +159,7 @@ DataType* ArrayType::decode() const
}
ArrayType *encoded_arrtype = new ArrayType;
encoded_arrtype->p_setId(encoded_arrtype_id);
- return(encoded_arrtype);
+ return (encoded_arrtype);
}
//--------------------------------------------------------------------------
@@ -168,16 +169,16 @@ DataType* ArrayType::decode() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
-int ArrayType::getArrayNDims() const
+int
+ArrayType::getArrayNDims() const
{
// Get the rank of the array type specified by id from the C API
int ndims = H5Tget_array_ndims(id);
- if (ndims < 0)
- {
+ if (ndims < 0) {
throw DataTypeIException("ArrayType::getArrayNDims", "H5Tget_array_ndims failed");
}
- return(ndims);
+ return (ndims);
}
//--------------------------------------------------------------------------
@@ -188,7 +189,8 @@ int ArrayType::getArrayNDims() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
-int ArrayType::getArrayDims(hsize_t* dims) const
+int
+ArrayType::getArrayDims(hsize_t *dims) const
{
// Get the dimensions
int ndims = H5Tget_array_dims2(id, dims);
@@ -196,7 +198,7 @@ int ArrayType::getArrayDims(hsize_t* dims) const
throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed");
// Return the number of dimensions
- return(ndims);
+ return (ndims);
}
//--------------------------------------------------------------------------
@@ -206,4 +208,4 @@ int ArrayType::getArrayDims(hsize_t* dims) const
//--------------------------------------------------------------------------
ArrayType::~ArrayType() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h
index d99b936..09f1592 100644
--- a/c++/src/H5ArrayType.h
+++ b/c++/src/H5ArrayType.h
@@ -23,44 +23,48 @@ namespace H5 {
*/
// Inheritance: DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP ArrayType : public DataType {
- public:
- // Constructor that creates a new array data type based on the
- // specified base type.
- ArrayType(const DataType& base_type, int ndims, const hsize_t* dims);
+ public:
+ // Constructor that creates a new array data type based on the
+ // specified base type.
+ ArrayType(const DataType &base_type, int ndims, const hsize_t *dims);
- // Assignment operator
- ArrayType& operator=(const ArrayType& rhs);
+ // Assignment operator
+ ArrayType &operator=(const ArrayType &rhs);
- // Constructors that open an array datatype, given a location.
- ArrayType(const H5Location& loc, const char* name);
- ArrayType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open an array datatype, given a location.
+ ArrayType(const H5Location &loc, const char *name);
+ ArrayType(const H5Location &loc, const H5std_string &name);
- // Returns an ArrayType object via DataType* by decoding the
- // binary object description of this type.
- virtual DataType* decode() const;
+ // Returns an ArrayType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType *decode() const;
- // Returns the number of dimensions of this array datatype.
- int getArrayNDims() const;
- //int getArrayNDims(); // removed 1.8.18 and 1.10.1
+ // Returns the number of dimensions of this array datatype.
+ int getArrayNDims() const;
+ // int getArrayNDims(); // removed 1.8.18 and 1.10.1
- // Returns the sizes of dimensions of this array datatype.
- int getArrayDims(hsize_t* dims) const;
- //int getArrayDims(hsize_t* dims); // removed 1.8.18 and 1.10.1
+ // Returns the sizes of dimensions of this array datatype.
+ int getArrayDims(hsize_t *dims) const;
+ // int getArrayDims(hsize_t* dims); // removed 1.8.18 and 1.10.1
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("ArrayType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("ArrayType");
+ }
- // Copy constructor: same as the original ArrayType.
- ArrayType(const ArrayType& original);
+ // Copy constructor: same as the original ArrayType.
+ ArrayType(const ArrayType &original);
- // Constructor that takes an existing id
- ArrayType(const hid_t existing_id);
+ // Constructor that takes an existing id
+ ArrayType(const hid_t existing_id);
- // Noop destructor
- virtual ~ArrayType();
+ // Noop destructor
+ virtual ~ArrayType();
- // Default constructor
- ArrayType();
+ // Default constructor
+ ArrayType();
}; // end of ArrayType
} // namespace H5
diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp
index 9408452..abebc3b 100644
--- a/c++/src/H5AtomType.cpp
+++ b/c++/src/H5AtomType.cpp
@@ -51,7 +51,7 @@ AtomType::AtomType(const hid_t existing_id) : DataType(existing_id) {}
///\brief Copy constructor: same HDF5 object as \a original
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-AtomType::AtomType(const AtomType& original) : DataType(original) {}
+AtomType::AtomType(const AtomType &original) : DataType(original) {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
@@ -61,12 +61,12 @@ AtomType::AtomType(const AtomType& original) : DataType(original) {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::setSize(size_t size) const
+void
+AtomType::setSize(size_t size) const
{
// Call C routine H5Tset_size to set the total size
herr_t ret_value = H5Tset_size(id, size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("setSize"), "H5Tset_size failed");
}
}
@@ -81,18 +81,17 @@ void AtomType::setSize(size_t size) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
-H5T_order_t AtomType::getOrder() const
+H5T_order_t
+AtomType::getOrder() const
{
// Call C routine to get the byte ordering
H5T_order_t type_order = H5Tget_order(id);
// return a byte order constant if successful
- if (type_order == H5T_ORDER_ERROR)
- {
- throw DataTypeIException(inMemFunc("getOrder"),
- "H5Tget_order returns H5T_ORDER_ERROR");
+ if (type_order == H5T_ORDER_ERROR) {
+ throw DataTypeIException(inMemFunc("getOrder"), "H5Tget_order returns H5T_ORDER_ERROR");
}
- return(type_order);
+ return (type_order);
}
//--------------------------------------------------------------------------
@@ -112,7 +111,8 @@ H5T_order_t AtomType::getOrder() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_order_t AtomType::getOrder(H5std_string& order_string) const
+H5T_order_t
+AtomType::getOrder(H5std_string &order_string) const
{
// Call the overloaded to get the type order without text
H5T_order_t type_order = getOrder();
@@ -124,7 +124,7 @@ H5T_order_t AtomType::getOrder(H5std_string& order_string) const
order_string = "Big endian byte ordering (1)";
else if (type_order == H5T_ORDER_VAX)
order_string = "VAX mixed byte ordering (2)";
- return(type_order);
+ return (type_order);
}
//--------------------------------------------------------------------------
@@ -137,12 +137,12 @@ H5T_order_t AtomType::getOrder(H5std_string& order_string) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::setOrder(H5T_order_t order) const
+void
+AtomType::setOrder(H5T_order_t order) const
{
// Call C routine to set the byte ordering
herr_t ret_value = H5Tset_order(id, order);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("setOrder"), "H5Tset_order failed");
}
}
@@ -158,17 +158,17 @@ void AtomType::setOrder(H5T_order_t order) const
/// value returned by \c DataType::getSize().
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-size_t AtomType::getPrecision() const
+size_t
+AtomType::getPrecision() const
{
- size_t num_signi_bits = H5Tget_precision(id); // C routine
+ size_t num_signi_bits = H5Tget_precision(id); // C routine
// returns number of significant bits if successful
- if (num_signi_bits == 0)
- {
+ if (num_signi_bits == 0) {
throw DataTypeIException(inMemFunc("getPrecision"),
- "H5Tget_precision returns invalid number of significant bits");
+ "H5Tget_precision returns invalid number of significant bits");
}
- return(num_signi_bits);
+ return (num_signi_bits);
}
//--------------------------------------------------------------------------
@@ -181,12 +181,12 @@ size_t AtomType::getPrecision() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::setPrecision(size_t precision) const
+void
+AtomType::setPrecision(size_t precision) const
{
// Call C routine to set the datatype precision
herr_t ret_value = H5Tset_precision(id, precision);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("setPrecision"), "H5Tset_precision failed");
}
}
@@ -205,17 +205,16 @@ void AtomType::setPrecision(size_t precision) const
// - return type changed from size_t to int
// - offset = -1 when failure occurs vs. 0
//--------------------------------------------------------------------------
-int AtomType::getOffset() const
+int
+AtomType::getOffset() const
{
- int offset = H5Tget_offset(id); // C routine
+ int offset = H5Tget_offset(id); // C routine
// returns a non-negative offset value if successful
- if (offset == -1)
- {
- throw DataTypeIException(inMemFunc("getOffset"),
- "H5Tget_offset returns a negative offset value");
+ if (offset == -1) {
+ throw DataTypeIException(inMemFunc("getOffset"), "H5Tget_offset returns a negative offset value");
}
- return(offset);
+ return (offset);
}
//--------------------------------------------------------------------------
@@ -228,12 +227,12 @@ int AtomType::getOffset() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::setOffset(size_t offset) const
+void
+AtomType::setOffset(size_t offset) const
{
// Call C routine to set the bit offset
herr_t ret_value = H5Tset_offset(id, offset);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("setOffset"), "H5Tset_offset failed");
}
}
@@ -252,12 +251,12 @@ void AtomType::setOffset(size_t offset) const
/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::getPad(H5T_pad_t& lsb, H5T_pad_t& msb) const
+void
+AtomType::getPad(H5T_pad_t &lsb, H5T_pad_t &msb) const
{
// Call C routine to get the padding type
herr_t ret_value = H5Tget_pad(id, &lsb, &msb);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("getPad"), "H5Tget_pad failed");
}
}
@@ -275,12 +274,12 @@ void AtomType::getPad(H5T_pad_t& lsb, H5T_pad_t& msb) const
/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::setPad(H5T_pad_t lsb, H5T_pad_t msb) const
+void
+AtomType::setPad(H5T_pad_t lsb, H5T_pad_t msb) const
{
// Call C routine to set the padding type
herr_t ret_value = H5Tset_pad(id, lsb, msb);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("setPad"), "H5Tset_pad failed");
}
}
@@ -294,4 +293,4 @@ void AtomType::setPad(H5T_pad_t lsb, H5T_pad_t msb) const
AtomType::~AtomType() {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h
index 80271ac..337aca6 100644
--- a/c++/src/H5AtomType.h
+++ b/c++/src/H5AtomType.h
@@ -26,54 +26,58 @@ namespace H5 {
*/
// Inheritance: DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP AtomType : public DataType {
- public:
- // Returns the byte order of an atomic datatype.
- H5T_order_t getOrder() const;
- H5T_order_t getOrder(H5std_string& order_string) const;
+ public:
+ // Returns the byte order of an atomic datatype.
+ H5T_order_t getOrder() const;
+ H5T_order_t getOrder(H5std_string &order_string) const;
- // Sets the byte ordering of an atomic datatype.
- void setOrder(H5T_order_t order) const;
+ // Sets the byte ordering of an atomic datatype.
+ void setOrder(H5T_order_t order) const;
- // Retrieves the bit offset of the first significant bit.
- // 12/05/00 - changed return type to int from size_t - C API
- int getOffset() const;
+ // Retrieves the bit offset of the first significant bit.
+ // 12/05/00 - changed return type to int from size_t - C API
+ int getOffset() const;
- // Sets the bit offset of the first significant bit.
- void setOffset(size_t offset) const;
+ // Sets the bit offset of the first significant bit.
+ void setOffset(size_t offset) const;
- // Retrieves the padding type of the least and most-significant bit padding.
- void getPad(H5T_pad_t& lsb, H5T_pad_t& msb) const;
+ // Retrieves the padding type of the least and most-significant bit padding.
+ void getPad(H5T_pad_t &lsb, H5T_pad_t &msb) const;
- // Sets the least and most-significant bits padding types
- void setPad(H5T_pad_t lsb, H5T_pad_t msb) const;
+ // Sets the least and most-significant bits padding types
+ void setPad(H5T_pad_t lsb, H5T_pad_t msb) const;
- // Returns the precision of an atomic datatype.
- size_t getPrecision() const;
+ // Returns the precision of an atomic datatype.
+ size_t getPrecision() const;
- // Sets the precision of an atomic datatype.
- void setPrecision(size_t precision) const;
+ // Sets the precision of an atomic datatype.
+ void setPrecision(size_t precision) const;
- // Sets the total size for an atomic datatype.
- void setSize(size_t size) const;
+ // Sets the total size for an atomic datatype.
+ void setSize(size_t size) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("AtomType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("AtomType");
+ }
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Copy constructor: same as the original AtomType.
- AtomType(const AtomType& original);
+ // Copy constructor: same as the original AtomType.
+ AtomType(const AtomType &original);
- // Noop destructor
- virtual ~AtomType();
+ // Noop destructor
+ virtual ~AtomType();
#endif // DOXYGEN_SHOULD_SKIP_THIS
- protected:
+ protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Default constructor
- AtomType();
+ // Default constructor
+ AtomType();
- // Constructor that takes an existing id
- AtomType(const hid_t existing_id);
+ // Constructor that takes an existing id
+ AtomType(const hid_t existing_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
}; // end of AtomType
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index 33f992a..131ce92 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -18,7 +18,7 @@
#endif
#include <string>
-#include "H5private.h" // for HDfree
+#include "H5private.h" // for HDfree
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -41,7 +41,7 @@ namespace H5 {
using std::cerr;
using std::endl;
-class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate
+class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate
//--------------------------------------------------------------------------
// Function: Attribute default constructor
@@ -56,7 +56,7 @@ Attribute::Attribute() : AbstractDs(), H5Location(), id(H5I_INVALID_HID) {}
///\param original - IN: Original Attribute object to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute::Attribute(const Attribute& original) : AbstractDs(), H5Location(), id(original.id)
+Attribute::Attribute(const Attribute &original) : AbstractDs(), H5Location(), id(original.id)
{
incRefCount(); // increment number of references to this id
}
@@ -82,11 +82,11 @@ Attribute::Attribute(const hid_t existing_id) : AbstractDs(), H5Location(), id(e
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Attribute::write(const DataType& mem_type, const void *buf) const
+void
+Attribute::write(const DataType &mem_type, const void *buf) const
{
- herr_t ret_value = H5Awrite(id, mem_type.getId(), buf);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Awrite(id, mem_type.getId(), buf);
+ if (ret_value < 0) {
throw AttributeIException("Attribute::write", "H5Awrite failed");
}
}
@@ -100,32 +100,29 @@ void Attribute::write(const DataType& mem_type, const void *buf) const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - Apr, 2003
//--------------------------------------------------------------------------
-void Attribute::write(const DataType& mem_type, const H5std_string& strg) const
+void
+Attribute::write(const DataType &mem_type, const H5std_string &strg) const
{
// Check if this attribute has variable-len string or fixed-len string and
// proceed appropriately.
htri_t is_variable_len = H5Tis_variable_str(mem_type.getId());
- if (is_variable_len < 0)
- {
+ if (is_variable_len < 0) {
throw AttributeIException("Attribute::write", "H5Tis_variable_str failed");
}
// Convert string to C-string
- const char* strg_C;
- strg_C = strg.c_str(); // strg_C refers to the contents of strg as a C-str
+ const char *strg_C;
+ strg_C = strg.c_str(); // strg_C refers to the contents of strg as a C-str
herr_t ret_value = 0;
// Pass string in differently depends on variable or fixed length
- if (!is_variable_len)
- {
+ if (!is_variable_len) {
ret_value = H5Awrite(id, mem_type.getId(), strg_C);
}
- else
- {
+ else {
// passing third argument by address
ret_value = H5Awrite(id, mem_type.getId(), &strg_C);
}
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw AttributeIException("Attribute::write", "H5Awrite failed");
}
}
@@ -138,11 +135,11 @@ void Attribute::write(const DataType& mem_type, const H5std_string& strg) const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Attribute::read(const DataType& mem_type, void *buf) const
+void
+Attribute::read(const DataType &mem_type, void *buf) const
{
- herr_t ret_value = H5Aread(id, mem_type.getId(), buf);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Aread(id, mem_type.getId(), buf);
+ if (ret_value < 0) {
throw AttributeIException("Attribute::read", "H5Aread failed");
}
}
@@ -167,22 +164,21 @@ void Attribute::read(const DataType& mem_type, void *buf) const
// variable-len string data: p_read_fixed_len and
// p_read_variable_len. This should improve readability. -BMR
//--------------------------------------------------------------------------
-void Attribute::read(const DataType& mem_type, H5std_string& strg) const
+void
+Attribute::read(const DataType &mem_type, H5std_string &strg) const
{
// Check if this attribute has variable-len string or fixed-len string and
// proceed appropriately.
htri_t is_variable_len = H5Tis_variable_str(mem_type.getId());
- if (is_variable_len < 0)
- {
+ if (is_variable_len < 0) {
throw AttributeIException("Attribute::read", "H5Tis_variable_str failed");
}
- if (!is_variable_len) // only allocate for fixed-len string
+ if (!is_variable_len) // only allocate for fixed-len string
{
p_read_fixed_len(mem_type, strg);
}
- else
- {
+ else {
p_read_variable_len(mem_type, strg);
}
}
@@ -194,62 +190,55 @@ void Attribute::read(const DataType& mem_type, H5std_string& strg) const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - Apr 2009
//--------------------------------------------------------------------------
-size_t Attribute::getInMemDataSize() const
+size_t
+Attribute::getInMemDataSize() const
{
const char *func = "Attribute::getInMemDataSize";
// Get the data type of this attribute
hid_t mem_type_id = H5Aget_type(id);
- if (mem_type_id < 0)
- {
+ if (mem_type_id < 0) {
throw AttributeIException(func, "H5Aget_type failed");
}
// Get the data type's size by first getting its native type then getting
// the native type's size.
hid_t native_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT);
- if (native_type < 0)
- {
+ if (native_type < 0) {
throw AttributeIException(func, "H5Tget_native_type failed");
}
size_t type_size = H5Tget_size(native_type);
- if (type_size == 0)
- {
+ if (type_size == 0) {
throw AttributeIException(func, "H5Tget_size failed");
}
// Close the native type and the datatype of this attribute.
- if (H5Tclose(native_type) < 0)
- {
+ if (H5Tclose(native_type) < 0) {
throw DataSetIException(func, "H5Tclose(native_type) failed");
}
- if (H5Tclose(mem_type_id) < 0)
- {
+ if (H5Tclose(mem_type_id) < 0) {
throw DataSetIException(func, "H5Tclose(mem_type_id) failed");
}
// Get number of elements of the attribute by first getting its dataspace
// then getting the number of elements in the dataspace
hid_t space_id = H5Aget_space(id);
- if (space_id < 0)
- {
+ if (space_id < 0) {
throw AttributeIException(func, "H5Aget_space failed");
}
hssize_t num_elements = H5Sget_simple_extent_npoints(space_id);
- if (num_elements < 0)
- {
+ if (num_elements < 0) {
throw AttributeIException(func, "H5Sget_simple_extent_npoints failed");
}
// Close the dataspace
- if (H5Sclose(space_id) < 0)
- {
+ if (H5Sclose(space_id) < 0) {
throw DataSetIException(func, "H5Sclose failed");
}
// Calculate and return the size of the data
size_t data_size = type_size * num_elements;
- return(data_size);
+ return (data_size);
}
//--------------------------------------------------------------------------
@@ -259,20 +248,19 @@ size_t Attribute::getInMemDataSize() const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSpace Attribute::getSpace() const
+DataSpace
+Attribute::getSpace() const
{
- // Calls C function H5Aget_space to get the id of the dataspace
- hid_t dataspace_id = H5Aget_space(id);
+ // Calls C function H5Aget_space to get the id of the dataspace
+ hid_t dataspace_id = H5Aget_space(id);
- // If the dataspace id is valid, create and return the DataSpace object
- if (dataspace_id > 0)
- {
+ // If the dataspace id is valid, create and return the DataSpace object
+ if (dataspace_id > 0) {
DataSpace dataspace;
f_DataSpace_setId(&dataspace, dataspace_id);
- return(dataspace);
+ return (dataspace);
}
- else
- {
+ else {
throw AttributeIException("Attribute::getSpace", "H5Aget_space failed");
}
}
@@ -294,22 +282,21 @@ DataSpace Attribute::getSpace() const
/// first argument and ignore the second argument.
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-ssize_t Attribute::getName(char* attr_name, size_t buf_size) const
+ssize_t
+Attribute::getName(char *attr_name, size_t buf_size) const
{
// H5Aget_name will get buf_size-1 chars of the name to null terminate it
ssize_t name_size = H5Aget_name(id, buf_size, attr_name);
// If H5Aget_name returns a negative value, raise an exception
- if (name_size < 0)
- {
+ if (name_size < 0) {
throw AttributeIException("Attribute::getName", "H5Aget_name failed");
}
- else if (name_size == 0)
- {
+ else if (name_size == 0) {
throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0");
}
// Return length of the name
- return(name_size);
+ return (name_size);
}
//--------------------------------------------------------------------------
@@ -322,7 +309,8 @@ ssize_t Attribute::getName(char* attr_name, size_t buf_size) const
// Mar 2014 - BMR
// Revised to use the modified getName() above
//--------------------------------------------------------------------------
-H5std_string Attribute::getName() const
+H5std_string
+Attribute::getName() const
{
H5std_string attr_name(""); // attribute name to return
@@ -330,32 +318,28 @@ H5std_string Attribute::getName() const
ssize_t name_size = H5Aget_name(id, static_cast<size_t>(0), NULL);
// If H5Aget_name failed, throw exception
- if (name_size < 0)
- {
+ if (name_size < 0) {
throw AttributeIException("Attribute::getName", "H5Aget_name failed");
}
- else if (name_size == 0)
- {
+ else if (name_size == 0) {
throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0");
}
// Attribute's name exists, retrieve it
- else if (name_size > 0)
- {
- char* name_C = new char[name_size+1]; // temporary C-string
- HDmemset(name_C, 0, name_size+1); // clear buffer
+ else if (name_size > 0) {
+ char *name_C = new char[name_size + 1]; // temporary C-string
+ HDmemset(name_C, 0, name_size + 1); // clear buffer
// Use overloaded function
- name_size = getName(name_C, name_size+1);
+ name_size = getName(name_C, name_size + 1);
// Convert the C attribute name to return
attr_name = name_C;
// Clean up resource
- delete []name_C;
-
+ delete[] name_C;
}
// Return attribute's name
- return(attr_name);
+ return (attr_name);
}
//--------------------------------------------------------------------------
@@ -371,14 +355,15 @@ H5std_string Attribute::getName() const
// Mar 2014 - BMR
// Revised to use the new getName() below
//--------------------------------------------------------------------------
-H5std_string Attribute::getName(size_t len) const
+H5std_string
+Attribute::getName(size_t len) const
{
H5std_string attr_name;
- ssize_t name_size = getName(attr_name, len);
+ ssize_t name_size = getName(attr_name, len);
if (name_size < 0)
- return("");
+ return ("");
else
- return(attr_name);
+ return (attr_name);
}
//--------------------------------------------------------------------------
@@ -398,35 +383,34 @@ H5std_string Attribute::getName(size_t len) const
// Added to replace getName(size_t, H5std_string&) so that it'll
// allow the argument "len" to be skipped.
//--------------------------------------------------------------------------
-ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const
+ssize_t
+Attribute::getName(H5std_string &attr_name, size_t len) const
{
ssize_t name_size = 0;
// If no length is provided, get the entire attribute name
- if (len == 0)
- {
+ if (len == 0) {
attr_name = getName();
name_size = attr_name.length();
}
// If length is provided, get that number of characters in name
- else
- {
- char* name_C = new char[len+1]; // temporary C-string
- HDmemset(name_C, 0, len+1); // clear buffer
+ else {
+ char *name_C = new char[len + 1]; // temporary C-string
+ HDmemset(name_C, 0, len + 1); // clear buffer
// Use overloaded function
- name_size = getName(name_C, len+1);
+ name_size = getName(name_C, len + 1);
// Convert the C attribute name to return
attr_name = name_C;
// Clean up resource
- delete []name_C;
+ delete[] name_C;
}
// Otherwise, keep attr_name intact
// Return name size
- return(name_size);
+ return (name_size);
}
//--------------------------------------------------------------------------
@@ -444,7 +428,7 @@ ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//ssize_t Attribute::getName(size_t len, H5std_string& attr_name) const
+// ssize_t Attribute::getName(size_t len, H5std_string& attr_name) const
//{
// return (getName(attr_name, len));
//}
@@ -458,10 +442,11 @@ ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const
// function should have no failure. (from SLU)
// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
-hsize_t Attribute::getStorageSize() const
+hsize_t
+Attribute::getStorageSize() const
{
- hsize_t storage_size = H5Aget_storage_size(id);
- return (storage_size);
+ hsize_t storage_size = H5Aget_storage_size(id);
+ return (storage_size);
}
//--------------------------------------------------------------------------
@@ -480,9 +465,10 @@ hsize_t Attribute::getStorageSize() const
// an attribute id can be used to specify a location in HDF5
// library.
//--------------------------------------------------------------------------
-hid_t Attribute::getId() const
+hid_t
+Attribute::getId() const
{
- return(id);
+ return (id);
}
//--------------------------------------------------------------------------
@@ -494,13 +480,13 @@ hid_t Attribute::getId() const
// This private function is used in AbstractDs.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-hid_t Attribute::p_get_type() const
+hid_t
+Attribute::p_get_type() const
{
hid_t type_id = H5Aget_type(id);
if (type_id > 0)
- return(type_id);
- else
- {
+ return (type_id);
+ else {
throw AttributeIException("", "H5Aget_type failed");
}
}
@@ -517,7 +503,8 @@ hid_t Attribute::p_get_type() const
// Separated the fixed length case from the original
// Attribute::read
//--------------------------------------------------------------------------
-void Attribute::p_read_fixed_len(const DataType& mem_type, H5std_string& strg) const
+void
+Attribute::p_read_fixed_len(const DataType &mem_type, H5std_string &strg) const
{
// Only allocate for fixed-len string.
@@ -525,19 +512,17 @@ void Attribute::p_read_fixed_len(const DataType& mem_type, H5std_string& strg) c
size_t attr_size = getInMemDataSize();
// If there is data, allocate buffer and read it.
- if (attr_size > 0)
- {
- char *strg_C = new char[attr_size+1];
+ if (attr_size > 0) {
+ char * strg_C = new char[attr_size + 1];
herr_t ret_value = H5Aread(id, mem_type.getId(), strg_C);
- if (ret_value < 0)
- {
- delete []strg_C; // de-allocate for fixed-len string
+ if (ret_value < 0) {
+ delete[] strg_C; // de-allocate for fixed-len string
throw AttributeIException("Attribute::read", "H5Aread failed");
}
// Get string from the C char* and release resource allocated locally
strg_C[attr_size] = '\0';
- strg = strg_C;
- delete []strg_C;
+ strg = strg_C;
+ delete[] strg_C;
}
}
@@ -553,7 +538,8 @@ void Attribute::p_read_fixed_len(const DataType& mem_type, H5std_string& strg) c
// Separated the variable length case from the original
// Attribute::read. -BMR
//--------------------------------------------------------------------------
-void Attribute::p_read_variable_len(const DataType& mem_type, H5std_string& strg) const
+void
+Attribute::p_read_variable_len(const DataType &mem_type, H5std_string &strg) const
{
// Prepare and call C API to read attribute.
char *strg_C;
@@ -561,8 +547,7 @@ void Attribute::p_read_variable_len(const DataType& mem_type, H5std_string& strg
// Read attribute, no allocation for variable-len string; C library will
herr_t ret_value = H5Aread(id, mem_type.getId(), &strg_C);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw AttributeIException("Attribute::read", "H5Aread failed");
}
@@ -584,13 +569,14 @@ void Attribute::p_read_variable_len(const DataType& mem_type, H5std_string& strg
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Attribute::p_setId(const hid_t new_id)
+void
+Attribute::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw AttributeIException("Attribute::p_setId", close_error.getDetailMsg());
}
// reset object's id to the given id
@@ -605,13 +591,12 @@ void Attribute::p_setId(const hid_t new_id)
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
-void Attribute::close()
+void
+Attribute::close()
{
- if (p_valid_id(id))
- {
+ if (p_valid_id(id)) {
herr_t ret_value = H5Aclose(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw AttributeIException("Attribute::close", "H5Aclose failed");
}
// reset the id
@@ -634,9 +619,9 @@ Attribute::~Attribute()
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
cerr << "Attribute::~Attribute - " << close_error.getDetailMsg() << endl;
}
}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h
index c6fdaec..8783c00 100644
--- a/c++/src/H5Attribute.h
+++ b/c++/src/H5Attribute.h
@@ -27,76 +27,79 @@ namespace H5 {
*/
// Inheritance: multiple H5Location/AbstractDs -> IdComponent
class H5_DLLCPP Attribute : public AbstractDs, public H5Location {
- public:
+ public:
+ // Copy constructor: same as the original Attribute.
+ Attribute(const Attribute &original);
- // Copy constructor: same as the original Attribute.
- Attribute(const Attribute& original);
+ // Default constructor
+ Attribute();
- // Default constructor
- Attribute();
+ // Creates a copy of an existing attribute using the attribute id
+ Attribute(const hid_t attr_id);
- // Creates a copy of an existing attribute using the attribute id
- Attribute(const hid_t attr_id);
+ // Closes this attribute.
+ virtual void close();
- // Closes this attribute.
- virtual void close();
+ // Gets the name of this attribute.
+ ssize_t getName(char *attr_name, size_t buf_size = 0) const;
+ H5std_string getName(size_t len) const;
+ H5std_string getName() const;
+ ssize_t getName(H5std_string &attr_name, size_t len = 0) const;
+ // The overloaded function below is replaced by the one above and it
+ // is kept for backward compatibility purpose.
+ ssize_t getName(size_t buf_size, H5std_string &attr_name) const;
- // Gets the name of this attribute.
- ssize_t getName(char* attr_name, size_t buf_size = 0) const;
- H5std_string getName(size_t len) const;
- H5std_string getName() const;
- ssize_t getName(H5std_string& attr_name, size_t len = 0) const;
- // The overloaded function below is replaced by the one above and it
- // is kept for backward compatibility purpose.
- ssize_t getName(size_t buf_size, H5std_string& attr_name) const;
+ // Gets a copy of the dataspace for this attribute.
+ virtual DataSpace getSpace() const;
- // Gets a copy of the dataspace for this attribute.
- virtual DataSpace getSpace() const;
+ // Returns the amount of storage size required for this attribute.
+ virtual hsize_t getStorageSize() const;
- // Returns the amount of storage size required for this attribute.
- virtual hsize_t getStorageSize() const;
+ // Returns the in memory size of this attribute's data.
+ virtual size_t getInMemDataSize() const;
- // Returns the in memory size of this attribute's data.
- virtual size_t getInMemDataSize() const;
+ // Reads data from this attribute.
+ void read(const DataType &mem_type, void *buf) const;
+ void read(const DataType &mem_type, H5std_string &strg) const;
- // Reads data from this attribute.
- void read(const DataType& mem_type, void *buf) const;
- void read(const DataType& mem_type, H5std_string& strg) const;
+ // Writes data to this attribute.
+ void write(const DataType &mem_type, const void *buf) const;
+ void write(const DataType &mem_type, const H5std_string &strg) const;
- // Writes data to this attribute.
- void write(const DataType& mem_type, const void *buf) const;
- void write(const DataType& mem_type, const H5std_string& strg) const;
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("Attribute");
+ }
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("Attribute"); }
+ // Gets the attribute id.
+ virtual hid_t getId() const;
- // Gets the attribute id.
- virtual hid_t getId() const;
-
- // Destructor: properly terminates access to this attribute.
- virtual ~Attribute();
+ // Destructor: properly terminates access to this attribute.
+ virtual ~Attribute();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- protected:
- // Sets the attribute id.
- virtual void p_setId(const hid_t new_id);
+ protected:
+ // Sets the attribute id.
+ virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
- private:
- hid_t id; // HDF5 attribute id
+ private:
+ hid_t id; // HDF5 attribute id
- // This function contains the common code that is used by
- // getTypeClass and various API functions getXxxType
- // defined in AbstractDs for generic datatype and specific
- // sub-types
- virtual hid_t p_get_type() const;
+ // This function contains the common code that is used by
+ // getTypeClass and various API functions getXxxType
+ // defined in AbstractDs for generic datatype and specific
+ // sub-types
+ virtual hid_t p_get_type() const;
- // Reads variable or fixed len strings from this attribute.
- void p_read_variable_len(const DataType& mem_type, H5std_string& strg) const;
- void p_read_fixed_len(const DataType& mem_type, H5std_string& strg) const;
+ // Reads variable or fixed len strings from this attribute.
+ void p_read_variable_len(const DataType &mem_type, H5std_string &strg) const;
+ void p_read_fixed_len(const DataType &mem_type, H5std_string &strg) const;
- // Friend function to set Attribute id. For library use only.
- friend void f_Attribute_setId(Attribute* attr, hid_t new_id);
+ // Friend function to set Attribute id. For library use only.
+ friend void f_Attribute_setId(Attribute *attr, hid_t new_id);
}; // end of Attribute
} // namespace H5
diff --git a/c++/src/H5Classes.h b/c++/src/H5Classes.h
index 8b1e6ed..618b46c 100644
--- a/c++/src/H5Classes.h
+++ b/c++/src/H5Classes.h
@@ -16,31 +16,31 @@
#define __H5Classes_H
namespace H5 {
- class Exception;
- class IdComponent;
- class H5Location;
- class H5Object;
- class PropList;
- class FileCreatPropList;
- class FileAccPropList;
- class LinkAccPropList;
- class DSetCreatPropList;
- class DSetMemXferPropList;
- class DTypePropList;
- class DataType;
- class DataSpace;
- class AtomType;
- class PredType;
- class IntType;
- class FloatType;
- class StrType;
- class EnumType;
- class CompType;
- class AbstractDs;
- class DataSet;
- class Group;
- class H5File;
- class Attribute;
- class H5Library;
-}
+class Exception;
+class IdComponent;
+class H5Location;
+class H5Object;
+class PropList;
+class FileCreatPropList;
+class FileAccPropList;
+class LinkAccPropList;
+class DSetCreatPropList;
+class DSetMemXferPropList;
+class DTypePropList;
+class DataType;
+class DataSpace;
+class AtomType;
+class PredType;
+class IntType;
+class FloatType;
+class StrType;
+class EnumType;
+class CompType;
+class AbstractDs;
+class DataSet;
+class Group;
+class H5File;
+class Attribute;
+class H5Library;
+} // namespace H5
#endif // __H5Classes_H
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index 6c5fdca..3390980 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -13,7 +13,7 @@
#include <string>
-#include "H5private.h" // for HDstrcpy
+#include "H5private.h" // for HDstrcpy
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -55,7 +55,8 @@ namespace H5 {
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType CommonFG::openDataType(const char* name) const
+DataType
+CommonFG::openDataType(const char *name) const
{
// Call C function H5Topen2 to open the named datatype in this group,
// given either the file or group id
@@ -68,7 +69,7 @@ DataType CommonFG::openDataType(const char* name) const
// No failure, create and return the DataType object
DataType data_type;
f_DataType_setId(&data_type, type_id);
- return(data_type);
+ return (data_type);
}
//--------------------------------------------------------------------------
@@ -78,9 +79,10 @@ DataType CommonFG::openDataType(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType CommonFG::openDataType(const H5std_string& name) const
+DataType
+CommonFG::openDataType(const H5std_string &name) const
{
- return(openDataType(name.c_str()));
+ return (openDataType(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -91,7 +93,8 @@ DataType CommonFG::openDataType(const H5std_string& name) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-ArrayType CommonFG::openArrayType(const char* name) const
+ArrayType
+CommonFG::openArrayType(const char *name) const
{
// Call C function H5Topen2 to open the named datatype in this group,
// given either the file or group id
@@ -104,7 +107,7 @@ ArrayType CommonFG::openArrayType(const char* name) const
// No failure, create and return the ArrayType object
ArrayType array_type;
f_DataType_setId(&array_type, type_id);
- return(array_type);
+ return (array_type);
}
//--------------------------------------------------------------------------
@@ -114,9 +117,10 @@ ArrayType CommonFG::openArrayType(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-ArrayType CommonFG::openArrayType(const H5std_string& name) const
+ArrayType
+CommonFG::openArrayType(const H5std_string &name) const
{
- return(openArrayType(name.c_str()));
+ return (openArrayType(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -127,7 +131,8 @@ ArrayType CommonFG::openArrayType(const H5std_string& name) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType CommonFG::openCompType(const char* name) const
+CompType
+CommonFG::openCompType(const char *name) const
{
// Call C function H5Topen2 to open the named datatype in this group,
// given either the file or group id
@@ -140,7 +145,7 @@ CompType CommonFG::openCompType(const char* name) const
// No failure, create and return the CompType object
CompType comp_type;
f_DataType_setId(&comp_type, type_id);
- return(comp_type);
+ return (comp_type);
}
//--------------------------------------------------------------------------
@@ -150,9 +155,10 @@ CompType CommonFG::openCompType(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType CommonFG::openCompType(const H5std_string& name) const
+CompType
+CommonFG::openCompType(const H5std_string &name) const
{
- return(openCompType(name.c_str()));
+ return (openCompType(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -163,7 +169,8 @@ CompType CommonFG::openCompType(const H5std_string& name) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType CommonFG::openEnumType(const char* name) const
+EnumType
+CommonFG::openEnumType(const char *name) const
{
// Call C function H5Topen2 to open the named datatype in this group,
// given either the file or group id
@@ -176,7 +183,7 @@ EnumType CommonFG::openEnumType(const char* name) const
// No failure, create and return the EnumType object
EnumType enum_type;
f_DataType_setId(&enum_type, type_id);
- return(enum_type);
+ return (enum_type);
}
//--------------------------------------------------------------------------
@@ -186,9 +193,10 @@ EnumType CommonFG::openEnumType(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType CommonFG::openEnumType(const H5std_string& name) const
+EnumType
+CommonFG::openEnumType(const H5std_string &name) const
{
- return(openEnumType(name.c_str()));
+ return (openEnumType(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -199,7 +207,8 @@ EnumType CommonFG::openEnumType(const H5std_string& name) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType CommonFG::openIntType(const char* name) const
+IntType
+CommonFG::openIntType(const char *name) const
{
// Call C function H5Topen2 to open the named datatype in this group,
// given either the file or group id
@@ -212,7 +221,7 @@ IntType CommonFG::openIntType(const char* name) const
// No failure, create and return the IntType object
IntType int_type;
f_DataType_setId(&int_type, type_id);
- return(int_type);
+ return (int_type);
}
//--------------------------------------------------------------------------
@@ -222,9 +231,10 @@ IntType CommonFG::openIntType(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType CommonFG::openIntType(const H5std_string& name) const
+IntType
+CommonFG::openIntType(const H5std_string &name) const
{
- return(openIntType(name.c_str()));
+ return (openIntType(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -235,7 +245,8 @@ IntType CommonFG::openIntType(const H5std_string& name) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType CommonFG::openFloatType(const char* name) const
+FloatType
+CommonFG::openFloatType(const char *name) const
{
// Call C function H5Topen2 to open the named datatype in this group,
// given either the file or group id
@@ -248,7 +259,7 @@ FloatType CommonFG::openFloatType(const char* name) const
// No failure, create and return the FloatType object
FloatType float_type;
f_DataType_setId(&float_type, type_id);
- return(float_type);
+ return (float_type);
}
//--------------------------------------------------------------------------
@@ -258,9 +269,10 @@ FloatType CommonFG::openFloatType(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType CommonFG::openFloatType(const H5std_string& name) const
+FloatType
+CommonFG::openFloatType(const H5std_string &name) const
{
- return(openFloatType(name.c_str()));
+ return (openFloatType(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -271,7 +283,8 @@ FloatType CommonFG::openFloatType(const H5std_string& name) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType CommonFG::openStrType(const char* name) const
+StrType
+CommonFG::openStrType(const char *name) const
{
// Call C function H5Topen2 to open the named datatype in this group,
// given either the file or group id
@@ -284,7 +297,7 @@ StrType CommonFG::openStrType(const char* name) const
// No failure, create and return the StrType object
StrType str_type;
f_DataType_setId(&str_type, type_id);
- return(str_type);
+ return (str_type);
}
//--------------------------------------------------------------------------
@@ -294,9 +307,10 @@ StrType CommonFG::openStrType(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType CommonFG::openStrType(const H5std_string& name) const
+StrType
+CommonFG::openStrType(const H5std_string &name) const
{
- return(openStrType(name.c_str()));
+ return (openStrType(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -307,7 +321,8 @@ StrType CommonFG::openStrType(const H5std_string& name) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-VarLenType CommonFG::openVarLenType(const char* name) const
+VarLenType
+CommonFG::openVarLenType(const char *name) const
{
// Call C function H5Topen2 to open the named datatype in this group,
// given either the file or group id
@@ -320,7 +335,7 @@ VarLenType CommonFG::openVarLenType(const char* name) const
// No failure, create and return the VarLenType object
VarLenType varlen_type;
f_DataType_setId(&varlen_type, type_id);
- return(varlen_type);
+ return (varlen_type);
}
//--------------------------------------------------------------------------
@@ -330,9 +345,10 @@ VarLenType CommonFG::openVarLenType(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-VarLenType CommonFG::openVarLenType(const H5std_string& name) const
+VarLenType
+CommonFG::openVarLenType(const H5std_string &name) const
{
- return(openVarLenType(name.c_str()));
+ return (openVarLenType(name.c_str()));
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -360,7 +376,8 @@ CommonFG::~CommonFG() {}
// param new_id - IN: New id to set
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void f_DataType_setId(DataType* dtype, hid_t new_id)
+void
+f_DataType_setId(DataType *dtype, hid_t new_id)
{
dtype->p_setId(new_id);
}
@@ -375,11 +392,12 @@ void f_DataType_setId(DataType* dtype, hid_t new_id)
// param new_id - IN: New id to set
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void f_DataSet_setId(DataSet* dset, hid_t new_id)
+void
+f_DataSet_setId(DataSet *dset, hid_t new_id)
{
dset->p_setId(new_id);
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h
index 68e3f19..c3aef41 100644
--- a/c++/src/H5CommonFG.h
+++ b/c++/src/H5CommonFG.h
@@ -28,56 +28,55 @@ class VarLenType;
*/
/* Note: This class is being deprecated gradually. */
class H5_DLLCPP CommonFG {
- public:
- // Opens a generic named datatype in this location.
- DataType openDataType(const char* name) const;
- DataType openDataType(const H5std_string& name) const;
+ public:
+ // Opens a generic named datatype in this location.
+ DataType openDataType(const char *name) const;
+ DataType openDataType(const H5std_string &name) const;
- // Opens a named array datatype in this location.
- ArrayType openArrayType(const char* name) const;
- ArrayType openArrayType(const H5std_string& name) const;
+ // Opens a named array datatype in this location.
+ ArrayType openArrayType(const char *name) const;
+ ArrayType openArrayType(const H5std_string &name) const;
- // Opens a named compound datatype in this location.
- CompType openCompType(const char* name) const;
- CompType openCompType(const H5std_string& name) const;
+ // Opens a named compound datatype in this location.
+ CompType openCompType(const char *name) const;
+ CompType openCompType(const H5std_string &name) const;
- // Opens a named enumeration datatype in this location.
- EnumType openEnumType(const char* name) const;
- EnumType openEnumType(const H5std_string& name) const;
+ // Opens a named enumeration datatype in this location.
+ EnumType openEnumType(const char *name) const;
+ EnumType openEnumType(const H5std_string &name) const;
- // Opens a named integer datatype in this location.
- IntType openIntType(const char* name) const;
- IntType openIntType(const H5std_string& name) const;
+ // Opens a named integer datatype in this location.
+ IntType openIntType(const char *name) const;
+ IntType openIntType(const H5std_string &name) const;
- // Opens a named floating-point datatype in this location.
- FloatType openFloatType(const char* name) const;
- FloatType openFloatType(const H5std_string& name) const;
+ // Opens a named floating-point datatype in this location.
+ FloatType openFloatType(const char *name) const;
+ FloatType openFloatType(const H5std_string &name) const;
- // Opens a named string datatype in this location.
- StrType openStrType(const char* name) const;
- StrType openStrType(const H5std_string& name) const;
+ // Opens a named string datatype in this location.
+ StrType openStrType(const char *name) const;
+ StrType openStrType(const H5std_string &name) const;
- // Opens a named variable length datatype in this location.
- VarLenType openVarLenType(const char* name) const;
- VarLenType openVarLenType(const H5std_string& name) const;
+ // Opens a named variable length datatype in this location.
+ VarLenType openVarLenType(const char *name) const;
+ VarLenType openVarLenType(const H5std_string &name) const;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- /// For subclasses, H5File and Group, to return the correct
- /// object id, i.e. file or group id.
- virtual hid_t getLocId() const = 0;
+ /// For subclasses, H5File and Group, to return the correct
+ /// object id, i.e. file or group id.
+ virtual hid_t getLocId() const = 0;
+ /// For subclasses, H5File and Group, to throw appropriate exception.
+ virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const = 0;
- /// For subclasses, H5File and Group, to throw appropriate exception.
- virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const = 0;
+ // Default constructor.
+ CommonFG();
- // Default constructor.
- CommonFG();
+ // Noop destructor.
+ virtual ~CommonFG();
- // Noop destructor.
- virtual ~CommonFG();
-
- protected:
- virtual void p_setId(const hid_t new_id) = 0;
+ protected:
+ virtual void p_setId(const hid_t new_id) = 0;
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index fe96bb0..58ce83c 100644
--- a/c++/src/H5CompType.cpp
+++ b/c++/src/H5CompType.cpp
@@ -45,7 +45,7 @@ CompType::CompType() : DataType() {}
///\param original - IN: Original CompType instance
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType::CompType(const CompType& original) : DataType(original) {}
+CompType::CompType(const CompType &original) : DataType(original) {}
//--------------------------------------------------------------------------
// Function: CompType overloaded constructor
@@ -75,14 +75,13 @@ CompType::CompType(size_t size) : DataType(H5T_COMPOUND, size) {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType::CompType(const DataSet& dataset) : DataType()
+CompType::CompType(const DataSet &dataset) : DataType()
{
// Calls C function H5Dget_type to get the id of the datatype
id = H5Dget_type(dataset.getId());
// If the datatype id is invalid, throw exception
- if (id < 0)
- {
+ if (id < 0) {
throw DataSetIException("CompType constructor", "H5Dget_type failed");
}
}
@@ -101,7 +100,7 @@ CompType::CompType(const DataSet& dataset) : DataType()
// improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-CompType::CompType(const H5Location& loc, const char *dtype_name) : DataType()
+CompType::CompType(const H5Location &loc, const char *dtype_name) : DataType()
{
id = p_opentype(loc, dtype_name);
}
@@ -120,7 +119,7 @@ CompType::CompType(const H5Location& loc, const char *dtype_name) : DataType()
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-CompType::CompType(const H5Location& loc, const H5std_string& dtype_name) : DataType()
+CompType::CompType(const H5Location &loc, const H5std_string &dtype_name) : DataType()
{
id = p_opentype(loc, dtype_name.c_str());
}
@@ -133,7 +132,8 @@ CompType::CompType(const H5Location& loc, const H5std_string& dtype_name) : Data
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-DataType* CompType::decode() const
+DataType *
+CompType::decode() const
{
hid_t encoded_cmptype_id = H5I_INVALID_HID;
try {
@@ -144,7 +144,7 @@ DataType* CompType::decode() const
}
CompType *encoded_cmptype = new CompType;
encoded_cmptype->p_setId(encoded_cmptype_id);
- return(encoded_cmptype);
+ return (encoded_cmptype);
}
//--------------------------------------------------------------------------
@@ -154,15 +154,15 @@ DataType* CompType::decode() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int CompType::getNmembers() const
+int
+CompType::getNmembers() const
{
int num_members = H5Tget_nmembers(id);
- if (num_members < 0)
- {
+ if (num_members < 0) {
throw DataTypeIException("CompType::getNmembers",
- "H5Tget_nmembers returns negative number of members");
+ "H5Tget_nmembers returns negative number of members");
}
- return(num_members);
+ return (num_members);
}
//--------------------------------------------------------------------------
@@ -173,17 +173,18 @@ int CompType::getNmembers() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string CompType::getMemberName(unsigned member_num) const
+H5std_string
+CompType::getMemberName(unsigned member_num) const
{
- char* member_name_C = H5Tget_member_name(id, member_num);
- if (member_name_C == NULL) // NULL means failure
+ char *member_name_C = H5Tget_member_name(id, member_num);
+ if (member_name_C == NULL) // NULL means failure
{
throw DataTypeIException("CompType::getMemberName",
- "H5Tget_member_name returns NULL for member name");
+ "H5Tget_member_name returns NULL for member name");
}
H5std_string member_name = H5std_string(member_name_C); // convert C string to string
- H5free_memory(member_name_C); // free the C string
- return(member_name); // return the member name string
+ H5free_memory(member_name_C); // free the C string
+ return (member_name); // return the member name string
}
//--------------------------------------------------------------------------
@@ -198,19 +199,19 @@ H5std_string CompType::getMemberName(unsigned member_num) const
/// function \c CompType::getNmembers.
// Programmer Binh-Minh Ribler - May 16, 2002
//--------------------------------------------------------------------------
-int CompType::getMemberIndex(const char* name) const
+int
+CompType::getMemberIndex(const char *name) const
{
int member_index = H5Tget_member_index(id, name);
- if (member_index < 0)
- {
- throw DataTypeIException("CompType::getMemberIndex",
- "H5Tget_member_index returns negative value");
+ if (member_index < 0) {
+ throw DataTypeIException("CompType::getMemberIndex", "H5Tget_member_index returns negative value");
}
- return(member_index);
+ return (member_index);
}
-int CompType::getMemberIndex(const H5std_string& name) const
+int
+CompType::getMemberIndex(const H5std_string &name) const
{
- return(getMemberIndex(name.c_str()));
+ return (getMemberIndex(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -228,10 +229,11 @@ int CompType::getMemberIndex(const H5std_string& name) const
// Note that byte offset being returned as 0 doesn't indicate
// a failure. (According to Quincey)
//--------------------------------------------------------------------------
-size_t CompType::getMemberOffset(unsigned member_num) const
+size_t
+CompType::getMemberOffset(unsigned member_num) const
{
size_t offset = H5Tget_member_offset(id, member_num);
- return(offset);
+ return (offset);
}
//--------------------------------------------------------------------------
@@ -244,29 +246,28 @@ size_t CompType::getMemberOffset(unsigned member_num) const
// Modification
// Modified to use H5Tget_member_class instead. - Jul, 2005
//--------------------------------------------------------------------------
-H5T_class_t CompType::getMemberClass(unsigned member_num) const
+H5T_class_t
+CompType::getMemberClass(unsigned member_num) const
{
H5T_class_t member_class = H5Tget_member_class(id, member_num);
- if (member_class == H5T_NO_CLASS)
- {
- throw DataTypeIException("CompType::getMemberClass",
- "H5Tget_member_class returns H5T_NO_CLASS");
+ if (member_class == H5T_NO_CLASS) {
+ throw DataTypeIException("CompType::getMemberClass", "H5Tget_member_class returns H5T_NO_CLASS");
}
- return(member_class);
+ return (member_class);
}
// This private member function calls the C API to get the identifier
// of the specified member. It provides the id to construct appropriate
// sub-types in the functions getMemberXxxType below, where Xxx indicates
// the sub-types.
-hid_t CompType::p_get_member_type(unsigned member_num) const
+hid_t
+CompType::p_get_member_type(unsigned member_num) const
{
// get the id of the specified member first
hid_t member_type_id = H5Tget_member_type(id, member_num);
if (member_type_id > 0)
- return(member_type_id);
- else
- {
+ return (member_type_id);
+ else {
// p_get_member_type is private, caller will catch this exception
// then throw another with appropriate API name
throw DataTypeIException("", "H5Tget_member_type failed");
@@ -282,14 +283,15 @@ hid_t CompType::p_get_member_type(unsigned member_num) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType CompType::getMemberDataType(unsigned member_num) const
+DataType
+CompType::getMemberDataType(unsigned member_num) const
{
try {
DataType datatype;
f_DataType_setId(&datatype, p_get_member_type(member_num));
- return(datatype);
+ return (datatype);
}
- catch (DataTypeIException& E) {
+ catch (DataTypeIException &E) {
throw DataTypeIException("CompType::getMemberDataType", E.getDetailMsg());
}
}
@@ -303,14 +305,15 @@ DataType CompType::getMemberDataType(unsigned member_num) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-ArrayType CompType::getMemberArrayType(unsigned member_num) const
+ArrayType
+CompType::getMemberArrayType(unsigned member_num) const
{
try {
ArrayType arraytype;
f_DataType_setId(&arraytype, p_get_member_type(member_num));
- return(arraytype);
+ return (arraytype);
}
- catch (DataTypeIException& E) {
+ catch (DataTypeIException &E) {
throw DataTypeIException("CompType::getMemberArrayType", E.getDetailMsg());
}
}
@@ -324,14 +327,15 @@ ArrayType CompType::getMemberArrayType(unsigned member_num) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType CompType::getMemberCompType(unsigned member_num) const
+CompType
+CompType::getMemberCompType(unsigned member_num) const
{
try {
CompType comptype;
f_DataType_setId(&comptype, p_get_member_type(member_num));
- return(comptype);
+ return (comptype);
}
- catch (DataTypeIException& E) {
+ catch (DataTypeIException &E) {
throw DataTypeIException("CompType::getMemberCompType", E.getDetailMsg());
}
}
@@ -345,14 +349,15 @@ CompType CompType::getMemberCompType(unsigned member_num) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType CompType::getMemberEnumType(unsigned member_num) const
+EnumType
+CompType::getMemberEnumType(unsigned member_num) const
{
try {
EnumType enumtype;
f_DataType_setId(&enumtype, p_get_member_type(member_num));
- return(enumtype);
+ return (enumtype);
}
- catch (DataTypeIException& E) {
+ catch (DataTypeIException &E) {
throw DataTypeIException("CompType::getMemberEnumType", E.getDetailMsg());
}
}
@@ -366,14 +371,15 @@ EnumType CompType::getMemberEnumType(unsigned member_num) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType CompType::getMemberIntType(unsigned member_num) const
+IntType
+CompType::getMemberIntType(unsigned member_num) const
{
try {
IntType inttype;
f_DataType_setId(&inttype, p_get_member_type(member_num));
- return(inttype);
+ return (inttype);
}
- catch (DataTypeIException& E) {
+ catch (DataTypeIException &E) {
throw DataTypeIException("CompType::getMemberIntType", E.getDetailMsg());
}
}
@@ -387,14 +393,15 @@ IntType CompType::getMemberIntType(unsigned member_num) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType CompType::getMemberFloatType(unsigned member_num) const
+FloatType
+CompType::getMemberFloatType(unsigned member_num) const
{
try {
FloatType floatype;
f_DataType_setId(&floatype, p_get_member_type(member_num));
- return(floatype);
+ return (floatype);
}
- catch (DataTypeIException& E) {
+ catch (DataTypeIException &E) {
throw DataTypeIException("CompType::getMemberFloatType", E.getDetailMsg());
}
}
@@ -408,14 +415,15 @@ FloatType CompType::getMemberFloatType(unsigned member_num) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType CompType::getMemberStrType(unsigned member_num) const
+StrType
+CompType::getMemberStrType(unsigned member_num) const
{
try {
StrType strtype;
f_DataType_setId(&strtype, p_get_member_type(member_num));
- return(strtype);
+ return (strtype);
}
- catch (DataTypeIException& E) {
+ catch (DataTypeIException &E) {
throw DataTypeIException("CompType::getMemberStrType", E.getDetailMsg());
}
}
@@ -429,14 +437,15 @@ StrType CompType::getMemberStrType(unsigned member_num) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-VarLenType CompType::getMemberVarLenType(unsigned member_num) const
+VarLenType
+CompType::getMemberVarLenType(unsigned member_num) const
{
try {
VarLenType varlentype;
f_DataType_setId(&varlentype, p_get_member_type(member_num));
- return(varlentype);
+ return (varlentype);
}
- catch (DataTypeIException& E) {
+ catch (DataTypeIException &E) {
throw DataTypeIException("CompType::getMemberVarLenType", E.getDetailMsg());
}
}
@@ -483,18 +492,18 @@ void CompType::getMemberType(unsigned member_num, StrType& strtype) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void CompType::insertMember(const H5std_string& name, size_t offset, const DataType& new_member) const
+void
+CompType::insertMember(const H5std_string &name, size_t offset, const DataType &new_member) const
{
// Convert string to C-string
- const char* name_C;
- name_C = name.c_str(); // name_C refers to the contents of name as a C-str
+ const char *name_C;
+ name_C = name.c_str(); // name_C refers to the contents of name as a C-str
- hid_t new_member_id = new_member.getId(); // get new_member id for C API
+ hid_t new_member_id = new_member.getId(); // get new_member id for C API
// Call C routine H5Tinsert to add the new member
herr_t ret_value = H5Tinsert(id, name_C, offset, new_member_id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("CompType::insertMember", "H5Tinsert failed");
}
}
@@ -506,12 +515,12 @@ void CompType::insertMember(const H5std_string& name, size_t offset, const DataT
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void CompType::pack() const
+void
+CompType::pack() const
{
// Calls C routine H5Tpack to remove padding
herr_t ret_value = H5Tpack(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("CompType::pack", "H5Tpack failed");
}
}
@@ -525,12 +534,12 @@ void CompType::pack() const
// H5Tset_size works on atom datatypes and compound datatypes only
// Programmer Binh-Minh Ribler - 2014
//--------------------------------------------------------------------------
-void CompType::setSize(size_t size) const
+void
+CompType::setSize(size_t size) const
{
// Call C routine H5Tset_size to set the total size
herr_t ret_value = H5Tset_size(id, size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("CompType::setSize", "H5Tset_size failed");
}
}
@@ -542,4 +551,4 @@ void CompType::setSize(size_t size) const
//--------------------------------------------------------------------------
CompType::~CompType() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h
index d85e2ed..66392d9 100644
--- a/c++/src/H5CompType.h
+++ b/c++/src/H5CompType.h
@@ -23,99 +23,103 @@ namespace H5 {
*/
// Inheritance: DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP CompType : public DataType {
- public:
- // Default constructor
- CompType();
+ public:
+ // Default constructor
+ CompType();
- // Creates a compound datatype using an existing id
- CompType(const hid_t existing_id);
+ // Creates a compound datatype using an existing id
+ CompType(const hid_t existing_id);
- // Creates a new compound datatype, given the type's size
- CompType(size_t size); // H5Tcreate
+ // Creates a new compound datatype, given the type's size
+ CompType(size_t size); // H5Tcreate
- // Gets the compound datatype of the specified dataset
- CompType(const DataSet& dataset); // H5Dget_type
+ // Gets the compound datatype of the specified dataset
+ CompType(const DataSet &dataset); // H5Dget_type
- // Copy constructor - same as the original CompType.
- CompType(const CompType& original);
+ // Copy constructor - same as the original CompType.
+ CompType(const CompType &original);
- // Constructors that open a compound datatype, given a location.
- CompType(const H5Location& loc, const char* name);
- CompType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open a compound datatype, given a location.
+ CompType(const H5Location &loc, const char *name);
+ CompType(const H5Location &loc, const H5std_string &name);
- // Returns a CompType object via DataType* by decoding the binary
- // object description of this type.
- virtual DataType* decode() const;
+ // Returns a CompType object via DataType* by decoding the binary
+ // object description of this type.
+ virtual DataType *decode() const;
- // Returns the type class of the specified member of this compound
- // datatype. It provides to the user a way of knowing what type
- // to create another datatype of the same class
- H5T_class_t getMemberClass(unsigned member_num) const;
+ // Returns the type class of the specified member of this compound
+ // datatype. It provides to the user a way of knowing what type
+ // to create another datatype of the same class
+ H5T_class_t getMemberClass(unsigned member_num) const;
- // Returns the index of a member in this compound data type.
- int getMemberIndex(const char* name) const;
- int getMemberIndex(const H5std_string& name) const;
+ // Returns the index of a member in this compound data type.
+ int getMemberIndex(const char *name) const;
+ int getMemberIndex(const H5std_string &name) const;
- // Returns the offset of a member of this compound datatype.
- size_t getMemberOffset(unsigned memb_no) const;
+ // Returns the offset of a member of this compound datatype.
+ size_t getMemberOffset(unsigned memb_no) const;
- // Returns the name of a member of this compound datatype.
- H5std_string getMemberName(unsigned member_num) const;
+ // Returns the name of a member of this compound datatype.
+ H5std_string getMemberName(unsigned member_num) const;
- // Returns the generic datatype of the specified member in
- // this compound datatype.
- DataType getMemberDataType(unsigned member_num) const;
+ // Returns the generic datatype of the specified member in
+ // this compound datatype.
+ DataType getMemberDataType(unsigned member_num) const;
- // Returns the array datatype of the specified member in
- // this compound datatype.
- ArrayType getMemberArrayType(unsigned member_num) const;
+ // Returns the array datatype of the specified member in
+ // this compound datatype.
+ ArrayType getMemberArrayType(unsigned member_num) const;
- // Returns the compound datatype of the specified member in
- // this compound datatype.
- CompType getMemberCompType(unsigned member_num) const;
+ // Returns the compound datatype of the specified member in
+ // this compound datatype.
+ CompType getMemberCompType(unsigned member_num) const;
- // Returns the enumeration datatype of the specified member in
- // this compound datatype.
- EnumType getMemberEnumType(unsigned member_num) const;
+ // Returns the enumeration datatype of the specified member in
+ // this compound datatype.
+ EnumType getMemberEnumType(unsigned member_num) const;
- // Returns the integer datatype of the specified member in
- // this compound datatype.
- IntType getMemberIntType(unsigned member_num) const;
+ // Returns the integer datatype of the specified member in
+ // this compound datatype.
+ IntType getMemberIntType(unsigned member_num) const;
- // Returns the floating-point datatype of the specified member in
- // this compound datatype.
- FloatType getMemberFloatType(unsigned member_num) const;
+ // Returns the floating-point datatype of the specified member in
+ // this compound datatype.
+ FloatType getMemberFloatType(unsigned member_num) const;
- // Returns the string datatype of the specified member in
- // this compound datatype.
- StrType getMemberStrType(unsigned member_num) const;
+ // Returns the string datatype of the specified member in
+ // this compound datatype.
+ StrType getMemberStrType(unsigned member_num) const;
- // Returns the variable length datatype of the specified member in
- // this compound datatype.
- VarLenType getMemberVarLenType(unsigned member_num) const;
+ // Returns the variable length datatype of the specified member in
+ // this compound datatype.
+ VarLenType getMemberVarLenType(unsigned member_num) const;
- // Returns the number of members in this compound datatype.
- int getNmembers() const;
+ // Returns the number of members in this compound datatype.
+ int getNmembers() const;
- // Adds a new member to this compound datatype.
- void insertMember(const H5std_string& name, size_t offset, const DataType& new_member) const;
+ // Adds a new member to this compound datatype.
+ void insertMember(const H5std_string &name, size_t offset, const DataType &new_member) const;
- // Recursively removes padding from within this compound datatype.
- void pack() const;
+ // Recursively removes padding from within this compound datatype.
+ void pack() const;
- // Sets the total size for this compound datatype.
- void setSize(size_t size) const;
+ // Sets the total size for this compound datatype.
+ void setSize(size_t size) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("CompType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("CompType");
+ }
- // Noop destructor.
- virtual ~CompType();
+ // Noop destructor.
+ virtual ~CompType();
- private:
- // Contains common code that is used by the member functions
- // getMemberXxxType
- hid_t p_get_member_type(unsigned member_num) const;
+ private:
+ // Contains common code that is used by the member functions
+ // getMemberXxxType
+ hid_t p_get_member_type(unsigned member_num) const;
}; // end of CompType
} // namespace H5
diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h
index 01fae45..e614d69 100644
--- a/c++/src/H5Cpp.h
+++ b/c++/src/H5Cpp.h
@@ -53,9 +53,9 @@
*/
#ifndef H5_CXX_HAVE_OFFSETOF
#ifdef HOFFSET
- #undef HOFFSET
+#undef HOFFSET
#endif
-#define HOFFSET(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#define HOFFSET(TYPE, MEMBER) ((size_t) & ((TYPE *)0)->MEMBER)
#endif
#endif // __H5Cpp_H
diff --git a/c++/src/H5DaccProp.cpp b/c++/src/H5DaccProp.cpp
index c6ff705..1c01b9b 100644
--- a/c++/src/H5DaccProp.cpp
+++ b/c++/src/H5DaccProp.cpp
@@ -29,7 +29,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-DSetAccPropList* DSetAccPropList::DEFAULT_ = 0;
+DSetAccPropList *DSetAccPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: DSetAccPropList::getConstant
@@ -43,13 +43,13 @@ DSetAccPropList* DSetAccPropList::DEFAULT_ = 0;
// not happen.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-DSetAccPropList* DSetAccPropList::getConstant()
+DSetAccPropList *
+DSetAccPropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -58,8 +58,9 @@ DSetAccPropList* DSetAccPropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new DSetAccPropList(H5P_DATASET_ACCESS);
else
- throw PropListIException("DSetAccPropList::getConstant", "DSetAccPropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException("DSetAccPropList::getConstant",
+ "DSetAccPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -68,7 +69,8 @@ DSetAccPropList* DSetAccPropList::getConstant()
// points to.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void DSetAccPropList::deleteConstants()
+void
+DSetAccPropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -77,7 +79,7 @@ void DSetAccPropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose Constant for dataset creation default property
//--------------------------------------------------------------------------
-const DSetAccPropList& DSetAccPropList::DEFAULT = *getConstant();
+const DSetAccPropList &DSetAccPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -94,7 +96,7 @@ DSetAccPropList::DSetAccPropList() : LinkAccPropList(H5P_DATASET_ACCESS) {}
/// DSetAccPropList object
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DSetAccPropList::DSetAccPropList(const DSetAccPropList& orig) : LinkAccPropList(orig) {}
+DSetAccPropList::DSetAccPropList(const DSetAccPropList &orig) : LinkAccPropList(orig) {}
//--------------------------------------------------------------------------
// Function: DSetAccPropList overloaded constructor
@@ -122,11 +124,11 @@ DSetAccPropList::DSetAccPropList(const hid_t plist_id) : LinkAccPropList(plist_i
/// the HDF5 C Reference Manual.
// July 2018
//--------------------------------------------------------------------------
-void DSetAccPropList::setChunkCache(size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) const
+void
+DSetAccPropList::setChunkCache(size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) const
{
herr_t ret_value = H5Pset_chunk_cache(id, rdcc_nslots, rdcc_nbytes, rdcc_w0);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("DSetAccPropList::setChunkCache", "H5Pset_chunk_cache failed");
}
}
@@ -143,11 +145,11 @@ void DSetAccPropList::setChunkCache(size_t rdcc_nslots, size_t rdcc_nbytes, doub
/// the HDF5 C Reference Manual.
// July 2018
//--------------------------------------------------------------------------
-void DSetAccPropList::getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double &rdcc_w0) const
+void
+DSetAccPropList::getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double &rdcc_w0) const
{
herr_t ret_value = H5Pget_chunk_cache(id, &rdcc_nslots, &rdcc_nbytes, &rdcc_w0);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("DSetAccPropList::getChunkCache", "H5Pget_chunk_cache failed");
}
}
@@ -159,4 +161,4 @@ void DSetAccPropList::getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, d
//--------------------------------------------------------------------------
DSetAccPropList::~DSetAccPropList() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5DaccProp.h b/c++/src/H5DaccProp.h
index 111b4f5..a467fac 100644
--- a/c++/src/H5DaccProp.h
+++ b/c++/src/H5DaccProp.h
@@ -23,42 +23,46 @@ namespace H5 {
*/
// Inheritance: LinkAccPropList -> PropList -> IdComponent
class H5_DLLCPP DSetAccPropList : public LinkAccPropList {
- public:
- ///\brief Default dataset creation property list.
- static const DSetAccPropList& DEFAULT;
+ public:
+ ///\brief Default dataset creation property list.
+ static const DSetAccPropList &DEFAULT;
- // Creates a dataset creation property list.
- DSetAccPropList();
+ // Creates a dataset creation property list.
+ DSetAccPropList();
- // Sets the raw data chunk cache parameters.
- void setChunkCache(size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) const;
+ // Sets the raw data chunk cache parameters.
+ void setChunkCache(size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) const;
- // Retrieves the raw data chunk cache parameters.
- void getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double &rdcc_w0) const;
+ // Retrieves the raw data chunk cache parameters.
+ void getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double &rdcc_w0) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DSetAccPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("DSetAccPropList");
+ }
- // Copy constructor - same as the original DSetAccPropList.
- DSetAccPropList(const DSetAccPropList& orig);
+ // Copy constructor - same as the original DSetAccPropList.
+ DSetAccPropList(const DSetAccPropList &orig);
- // Creates a copy of an existing dataset creation property list
- // using the property list id.
- DSetAccPropList(const hid_t plist_id);
+ // Creates a copy of an existing dataset creation property list
+ // using the property list id.
+ DSetAccPropList(const hid_t plist_id);
- // Noop destructor.
- virtual ~DSetAccPropList();
+ // Noop destructor.
+ virtual ~DSetAccPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
- private:
- static DSetAccPropList* DEFAULT_;
+ private:
+ static DSetAccPropList *DEFAULT_;
- // Creates the global constant, should only be used by the library
- static DSetAccPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static DSetAccPropList *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index a071289..7720011 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -18,7 +18,7 @@
#endif
#include <string>
-#include "H5private.h" // for HDfree
+#include "H5private.h" // for HDfree
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -73,7 +73,7 @@ DataSet::DataSet(const hid_t existing_id) : H5Object(), AbstractDs(), id(existin
///\param original - IN: DataSet instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSet::DataSet(const DataSet& original) : H5Object(), AbstractDs(), id(original.id)
+DataSet::DataSet(const DataSet &original) : H5Object(), AbstractDs(), id(original.id)
{
incRefCount(); // increment number of references to this id
}
@@ -93,7 +93,8 @@ DataSet::DataSet(const DataSet& original) : H5Object(), AbstractDs(), id(origina
/// is a datatype that has been named by DataType::commit.
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
+DataSet::DataSet(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist)
+ : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
{
id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereferenced");
}
@@ -109,7 +110,8 @@ DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, co
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
+DataSet::DataSet(const Attribute &attr, const void *ref, H5R_type_t ref_type, const PropList &plist)
+ : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
{
id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference");
}
@@ -121,32 +123,32 @@ DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, co
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSpace DataSet::getSpace() const
+DataSpace
+DataSet::getSpace() const
{
// Calls C function H5Dget_space to get the id of the dataspace
hid_t dataspace_id = H5Dget_space(id);
// If the dataspace id is invalid, throw an exception
- if (dataspace_id < 0)
- {
+ if (dataspace_id < 0) {
throw DataSetIException("DataSet::getSpace", "H5Dget_space failed");
}
- //create dataspace object using the existing id then return the object
+ // create dataspace object using the existing id then return the object
DataSpace data_space;
f_DataSpace_setId(&data_space, dataspace_id);
- return(data_space);
+ return (data_space);
}
// This private member function calls the C API to get the identifier
// of the datatype that is used by this dataset. It is used
// by the various AbstractDs functions to get the specific datatype.
-hid_t DataSet::p_get_type() const
+hid_t
+DataSet::p_get_type() const
{
hid_t type_id = H5Dget_type(id);
if (type_id > 0)
- return(type_id);
- else
- {
+ return (type_id);
+ else {
throw DataSetIException("", "H5Dget_type failed");
}
}
@@ -158,18 +160,18 @@ hid_t DataSet::p_get_type() const
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DSetCreatPropList DataSet::getCreatePlist() const
+DSetCreatPropList
+DataSet::getCreatePlist() const
{
hid_t create_plist_id = H5Dget_create_plist(id);
- if (create_plist_id < 0)
- {
+ if (create_plist_id < 0) {
throw DataSetIException("DataSet::getCreatePlist", "H5Dget_create_plist failed");
}
// create and return the DSetCreatPropList object
DSetCreatPropList create_plist;
f_PropList_setId(&create_plist, create_plist_id);
- return(create_plist);
+ return (create_plist);
}
//--------------------------------------------------------------------------
@@ -179,18 +181,18 @@ DSetCreatPropList DataSet::getCreatePlist() const
///\exception H5::DataSetIException
// July 2018
//--------------------------------------------------------------------------
-DSetAccPropList DataSet::getAccessPlist() const
+DSetAccPropList
+DataSet::getAccessPlist() const
{
hid_t access_plist_id = H5Dget_access_plist(id);
- if (access_plist_id < 0)
- {
+ if (access_plist_id < 0) {
throw DataSetIException("DataSet::getAccessPlist", "H5Dget_access_plist failed");
}
// create and return the DSetCreatPropList object
DSetAccPropList access_plist;
f_PropList_setId(&access_plist, access_plist_id);
- return(access_plist);
+ return (access_plist);
}
//--------------------------------------------------------------------------
@@ -202,10 +204,11 @@ DSetAccPropList DataSet::getAccessPlist() const
// function should have no failure. (from SLU)
// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
-hsize_t DataSet::getStorageSize() const
+hsize_t
+DataSet::getStorageSize() const
{
hsize_t storage_size = H5Dget_storage_size(id);
- return(storage_size);
+ return (storage_size);
}
//--------------------------------------------------------------------------
@@ -215,62 +218,55 @@ hsize_t DataSet::getStorageSize() const
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - Apr 2009
//--------------------------------------------------------------------------
-size_t DataSet::getInMemDataSize() const
+size_t
+DataSet::getInMemDataSize() const
{
const char *func = "DataSet::getInMemDataSize";
// Get the data type of this dataset
hid_t mem_type_id = H5Dget_type(id);
- if (mem_type_id < 0)
- {
+ if (mem_type_id < 0) {
throw DataSetIException(func, "H5Dget_type failed");
}
// Get the data type's size by first getting its native type then getting
// the native type's size.
hid_t native_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT);
- if (native_type < 0)
- {
+ if (native_type < 0) {
throw DataSetIException(func, "H5Tget_native_type failed");
}
size_t type_size = H5Tget_size(native_type);
- if (type_size == 0)
- {
+ if (type_size == 0) {
throw DataSetIException(func, "H5Tget_size failed");
}
// Close the native type and the datatype of this dataset.
- if (H5Tclose(native_type) < 0)
- {
+ if (H5Tclose(native_type) < 0) {
throw DataSetIException(func, "H5Tclose(native_type) failed");
}
- if (H5Tclose(mem_type_id) < 0)
- {
+ if (H5Tclose(mem_type_id) < 0) {
throw DataSetIException(func, "H5Tclose(mem_type_id) failed");
}
// Get number of elements of the dataset by first getting its dataspace,
// then getting the number of elements in the dataspace
hid_t space_id = H5Dget_space(id);
- if (space_id < 0)
- {
+ if (space_id < 0) {
throw DataSetIException(func, "H5Dget_space failed");
}
hssize_t num_elements = H5Sget_simple_extent_npoints(space_id);
- if (num_elements < 0)
- {
+ if (num_elements < 0) {
throw DataSetIException(func, "H5Sget_simple_extent_npoints failed");
}
// Close the dataspace
- if (H5Sclose(space_id) < 0)
- {
+ if (H5Sclose(space_id) < 0) {
throw DataSetIException(func, "H5Sclose failed");
}
// Calculate and return the size of the data
size_t data_size = type_size * num_elements;
- return(data_size);
+ return (data_size);
}
//--------------------------------------------------------------------------
@@ -280,16 +276,16 @@ size_t DataSet::getInMemDataSize() const
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-haddr_t DataSet::getOffset() const
+haddr_t
+DataSet::getOffset() const
{
haddr_t ds_addr; // for address of dataset
ds_addr = H5Dget_offset(id);
- if (ds_addr == HADDR_UNDEF)
- {
+ if (ds_addr == HADDR_UNDEF) {
throw DataSetIException("DataSet::getOffset", "H5Dget_offset returned HADDR_UNDEF");
}
- return(ds_addr);
+ return (ds_addr);
}
//--------------------------------------------------------------------------
@@ -299,11 +295,11 @@ haddr_t DataSet::getOffset() const
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::getSpaceStatus(H5D_space_status_t& status) const
+void
+DataSet::getSpaceStatus(H5D_space_status_t &status) const
{
herr_t ret_value = H5Dget_space_status(id, &status);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::getSpaceStatus", "H5Dget_space_status failed");
}
}
@@ -317,20 +313,20 @@ void DataSet::getSpaceStatus(H5D_space_status_t& status) const
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-hsize_t DataSet::getVlenBufSize(const DataType& type, const DataSpace& space) const
+hsize_t
+DataSet::getVlenBufSize(const DataType &type, const DataSpace &space) const
{
// Obtain identifiers for C API
- hid_t type_id = type.getId();
+ hid_t type_id = type.getId();
hid_t space_id = space.getId();
hsize_t size; // for amount of storage
herr_t ret_value = H5Dvlen_get_buf_size(id, type_id, space_id, &size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::getVlenBufSize", "H5Dvlen_get_buf_size failed");
}
- return(size);
+ return (size);
}
//--------------------------------------------------------------------------
@@ -346,7 +342,7 @@ hsize_t DataSet::getVlenBufSize(const DataType& type, const DataSpace& space) co
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//hsize_t DataSet::getVlenBufSize(DataType& type, DataSpace& space) const
+// hsize_t DataSet::getVlenBufSize(DataType& type, DataSpace& space) const
//{
// return(getVlenBufSize(type, space));
//}
@@ -362,16 +358,17 @@ hsize_t DataSet::getVlenBufSize(const DataType& type, const DataSpace& space) co
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf)
+void
+DataSet::vlenReclaim(const DataType &type, const DataSpace &space, const DSetMemXferPropList &xfer_plist,
+ void *buf)
{
// Obtain identifiers for C API
- hid_t type_id = type.getId();
- hid_t space_id = space.getId();
+ hid_t type_id = type.getId();
+ hid_t space_id = space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
herr_t ret_value = H5Treclaim(type_id, space_id, xfer_plist_id, buf);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::vlenReclaim", "H5Treclaim failed");
}
}
@@ -390,16 +387,17 @@ void DataSet::vlenReclaim(const DataType& type, const DataSpace& space, const DS
// This function has better prototype for the users than the
// other, which might be removed at some point. BMR - 2006/12/20
//--------------------------------------------------------------------------
-void DataSet::vlenReclaim(void* buf, const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist)
+void
+DataSet::vlenReclaim(void *buf, const DataType &type, const DataSpace &space,
+ const DSetMemXferPropList &xfer_plist)
{
// Obtain identifiers for C API
- hid_t type_id = type.getId();
- hid_t space_id = space.getId();
+ hid_t type_id = type.getId();
+ hid_t space_id = space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
herr_t ret_value = H5Treclaim(type_id, space_id, xfer_plist_id, buf);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::vlenReclaim", "H5Treclaim failed");
}
}
@@ -419,17 +417,18 @@ void DataSet::vlenReclaim(void* buf, const DataType& type, const DataSpace& spac
/// to memory datatype \a mem_type and dataspace \a mem_space.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::read(void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const
+void
+DataSet::read(void *buf, const DataType &mem_type, const DataSpace &mem_space, const DataSpace &file_space,
+ const DSetMemXferPropList &xfer_plist) const
{
// Obtain identifiers for C API
- hid_t mem_type_id = mem_type.getId();
- hid_t mem_space_id = mem_space.getId();
+ hid_t mem_type_id = mem_type.getId();
+ hid_t mem_space_id = mem_space.getId();
hid_t file_space_id = file_space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::read", "H5Dread failed");
}
}
@@ -453,28 +452,28 @@ void DataSet::read(void* buf, const DataType& mem_type, const DataSpace& mem_spa
// DataSet::p_read_fixed_len and
// DataSet::p_read_variable_len
//--------------------------------------------------------------------------
-void DataSet::read(H5std_string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const
+void
+DataSet::read(H5std_string &strg, const DataType &mem_type, const DataSpace &mem_space,
+ const DataSpace &file_space, const DSetMemXferPropList &xfer_plist) const
{
// Check if this dataset has variable-len string or fixed-len string and
// proceed appropriately.
htri_t is_variable_len = H5Tis_variable_str(mem_type.getId());
- if (is_variable_len < 0)
- {
+ if (is_variable_len < 0) {
throw DataSetIException("DataSet::read", "H5Tis_variable_str failed");
}
// Obtain identifiers for C API
- hid_t mem_type_id = mem_type.getId();
- hid_t mem_space_id = mem_space.getId();
+ hid_t mem_type_id = mem_type.getId();
+ hid_t mem_space_id = mem_space.getId();
hid_t file_space_id = file_space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
- if (!is_variable_len) // only allocate for fixed-len string
+ if (!is_variable_len) // only allocate for fixed-len string
{
p_read_fixed_len(mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg);
}
- else
- {
+ else {
p_read_variable_len(mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg);
}
}
@@ -495,17 +494,18 @@ void DataSet::read(H5std_string& strg, const DataType& mem_type, const DataSpace
/// and dataspace.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::write(const void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const
+void
+DataSet::write(const void *buf, const DataType &mem_type, const DataSpace &mem_space,
+ const DataSpace &file_space, const DSetMemXferPropList &xfer_plist) const
{
// Obtain identifiers for C API
- hid_t mem_type_id = mem_type.getId();
- hid_t mem_space_id = mem_space.getId();
+ hid_t mem_type_id = mem_type.getId();
+ hid_t mem_space_id = mem_space.getId();
hid_t file_space_id = file_space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
herr_t ret_value = H5Dwrite(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::write", "H5Dwrite failed");
}
}
@@ -520,39 +520,37 @@ void DataSet::write(const void* buf, const DataType& mem_type, const DataSpace&
// Modified to pass the buffer into H5Dwrite properly depending
// whether the dataset has variable- or fixed-length string.
//--------------------------------------------------------------------------
-void DataSet::write(const H5std_string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const
+void
+DataSet::write(const H5std_string &strg, const DataType &mem_type, const DataSpace &mem_space,
+ const DataSpace &file_space, const DSetMemXferPropList &xfer_plist) const
{
// Check if this attribute has variable-len string or fixed-len string and
// proceed appropriately.
htri_t is_variable_len = H5Tis_variable_str(mem_type.getId());
- if (is_variable_len < 0)
- {
+ if (is_variable_len < 0) {
throw DataSetIException("DataSet::write", "H5Tis_variable_str failed");
}
// Obtain identifiers for C API
- hid_t mem_type_id = mem_type.getId();
- hid_t mem_space_id = mem_space.getId();
+ hid_t mem_type_id = mem_type.getId();
+ hid_t mem_space_id = mem_space.getId();
hid_t file_space_id = file_space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
// Convert string to C-string
- const char* strg_C;
- strg_C = strg.c_str(); // strg_C refers to the contents of strg as a C-str
+ const char *strg_C;
+ strg_C = strg.c_str(); // strg_C refers to the contents of strg as a C-str
herr_t ret_value = 0;
// Pass string in differently depends on variable or fixed length
- if (!is_variable_len)
- {
+ if (!is_variable_len) {
ret_value = H5Dwrite(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C);
}
- else
- {
+ else {
// passing string argument by address
ret_value = H5Dwrite(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, &strg_C);
}
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::write", "H5Dwrite failed");
}
}
@@ -574,15 +572,17 @@ void DataSet::write(const H5std_string& strg, const DataType& mem_type, const Da
/// under development.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int DataSet::iterateElems(void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data)
+int
+DataSet::iterateElems(void *buf, const DataType &type, const DataSpace &space, H5D_operator_t op,
+ void *op_data)
{
// Obtain identifiers for C API
- hid_t type_id = type.getId();
- hid_t space_id = space.getId();
+ hid_t type_id = type.getId();
+ hid_t space_id = space.getId();
herr_t ret_value = H5Diterate(buf, type_id, space_id, op, op_data);
if (ret_value >= 0)
- return(ret_value);
- else // raise exception when H5Diterate returns a negative value
+ return (ret_value);
+ else // raise exception when H5Diterate returns a negative value
{
throw DataSetIException("DataSet::iterateElems", "H5Diterate failed");
}
@@ -598,10 +598,11 @@ int DataSet::iterateElems(void* buf, const DataType& type, const DataSpace& spac
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::extend(const hsize_t* size) const
+void
+DataSet::extend(const hsize_t *size) const
{
herr_t ret_value = H5Dset_extent(id, size);
- if (ret_value < 0) // raise exception when H5Dset_extent returns a neg value
+ if (ret_value < 0) // raise exception when H5Dset_extent returns a neg value
throw DataSetIException("DataSet::extend", "H5Dset_extent failed");
}
@@ -616,14 +617,15 @@ void DataSet::extend(const hsize_t* size) const
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2014
//--------------------------------------------------------------------------
-void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const
+void
+DataSet::fillMemBuf(const void *fill, const DataType &fill_type, void *buf, const DataType &buf_type,
+ const DataSpace &space) const
{
- hid_t fill_type_id = fill_type.getId();
- hid_t buf_type_id = buf_type.getId();
- hid_t space_id = space.getId();
- herr_t ret_value = H5Dfill(fill, fill_type_id, buf, buf_type_id, space_id);
- if (ret_value < 0)
- {
+ hid_t fill_type_id = fill_type.getId();
+ hid_t buf_type_id = buf_type.getId();
+ hid_t space_id = space.getId();
+ herr_t ret_value = H5Dfill(fill, fill_type_id, buf, buf_type_id, space_id);
+ if (ret_value < 0) {
throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed");
}
}
@@ -645,7 +647,8 @@ void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf,
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space)
+// void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace&
+// space)
//{
// fillMemBuf(fill, (const DataType)fill_type, buf, (const DataType)buf_type, (const DataSpace)space);
//}
@@ -659,13 +662,13 @@ void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf,
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& space) const
+void
+DataSet::fillMemBuf(void *buf, const DataType &buf_type, const DataSpace &space) const
{
- hid_t buf_type_id = buf_type.getId();
- hid_t space_id = space.getId();
- herr_t ret_value = H5Dfill(NULL, buf_type_id, buf, buf_type_id, space_id);
- if (ret_value < 0)
- {
+ hid_t buf_type_id = buf_type.getId();
+ hid_t space_id = space.getId();
+ herr_t ret_value = H5Dfill(NULL, buf_type_id, buf, buf_type_id, space_id);
+ if (ret_value < 0) {
throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed");
}
}
@@ -685,7 +688,7 @@ void DataSet::fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& s
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
+// void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
//{
// fillMemBuf(buf, (const DataType)buf_type, (const DataSpace)space);
//}
@@ -701,9 +704,10 @@ void DataSet::fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& s
// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
-hid_t DataSet::getId() const
+hid_t
+DataSet::getId() const
{
- return(id);
+ return (id);
}
//--------------------------------------------------------------------------
@@ -717,7 +721,9 @@ hid_t DataSet::getId() const
// Jul 2009
// Added in follow to the change in Attribute::read
//--------------------------------------------------------------------------
-void DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const
+void
+DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id,
+ const hid_t xfer_plist_id, H5std_string &strg) const
{
// Only allocate for fixed-len string.
@@ -725,22 +731,20 @@ void DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id
size_t data_size = getInMemDataSize();
// If there is data, allocate buffer and read it.
- if (data_size > 0)
- {
- char *strg_C = new char [data_size+1];
- HDmemset(strg_C, 0, data_size+1); // clear buffer
+ if (data_size > 0) {
+ char *strg_C = new char[data_size + 1];
+ HDmemset(strg_C, 0, data_size + 1); // clear buffer
herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C);
- if (ret_value < 0)
- {
- delete []strg_C; // de-allocate for fixed-len string
+ if (ret_value < 0) {
+ delete[] strg_C; // de-allocate for fixed-len string
throw DataSetIException("DataSet::read", "H5Dread failed for fixed length string");
}
// Get string from the C char* and release resource allocated locally
strg = strg_C;
- delete []strg_C;
+ delete[] strg_C;
}
}
@@ -755,7 +759,9 @@ void DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id
// Jul 2009
// Added in follow to the change in Attribute::read
//--------------------------------------------------------------------------
-void DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const
+void
+DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id,
+ const hid_t xfer_plist_id, H5std_string &strg) const
{
// Prepare and call C API to read dataset.
char *strg_C;
@@ -763,8 +769,7 @@ void DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space
// Read dataset, no allocation for variable-len string; C library will
herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, &strg_C);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::read", "H5Dread failed for variable length string");
}
@@ -786,17 +791,18 @@ void DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::p_setId(const hid_t new_id)
+void
+DataSet::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw DataSetIException(inMemFunc("p_setId"), close_error.getDetailMsg());
}
- // reset object's id to the given id
- id = new_id;
+ // reset object's id to the given id
+ id = new_id;
}
//--------------------------------------------------------------------------
@@ -809,7 +815,8 @@ void DataSet::p_setId(const hid_t new_id)
// param new_id - IN: New id to set
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void f_PropList_setId(PropList* plist, hid_t new_id)
+void
+f_PropList_setId(PropList *plist, hid_t new_id)
{
plist->p_setId(new_id);
}
@@ -823,13 +830,12 @@ void f_PropList_setId(PropList* plist, hid_t new_id)
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
-void DataSet::close()
+void
+DataSet::close()
{
- if (p_valid_id(id))
- {
+ if (p_valid_id(id)) {
herr_t ret_value = H5Dclose(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::close", "H5Dclose failed");
}
// reset the id
@@ -852,9 +858,9 @@ DataSet::~DataSet()
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
cerr << "DataSet::~DataSet - " << close_error.getDetailMsg() << endl;
}
}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h
index a0a962e..0bf7589 100644
--- a/c++/src/H5DataSet.h
+++ b/c++/src/H5DataSet.h
@@ -26,109 +26,129 @@ namespace H5 {
*/
// Inheritance: multiple H5Object/AbstractDs -> H5Location -> IdComponent
class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
- public:
-
- // Close this dataset.
- virtual void close();
-
- // Extends the dataset with unlimited dimension.
- void extend(const hsize_t* size) const;
-
- // Fills a selection in memory with a value
- void fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const;
- //void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
-
- // Fills a selection in memory with zero
- void fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& space) const;
- //void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
-
- // Gets the creation property list of this dataset.
- DSetCreatPropList getCreatePlist() const;
-
- // Gets the access property list of this dataset.
- DSetAccPropList getAccessPlist() const;
-
- // Returns the address of this dataset in the file.
- haddr_t getOffset() const;
-
- // Gets the dataspace of this dataset.
- virtual DataSpace getSpace() const;
-
- // Determines whether space has been allocated for a dataset.
- void getSpaceStatus(H5D_space_status_t& status) const;
-
- // Returns the amount of storage size required for this dataset.
- virtual hsize_t getStorageSize() const;
-
- // Returns the in memory size of this attribute's data.
- virtual size_t getInMemDataSize() const;
-
- // Returns the number of bytes required to store VL data.
- hsize_t getVlenBufSize(const DataType& type, const DataSpace& space) const;
- //hsize_t getVlenBufSize(DataType& type, DataSpace& space) const; // removed from 1.8.18 and 1.10.1
-
- // Reclaims VL datatype memory buffers.
- static void vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf);
- static void vlenReclaim(void *buf, const DataType& type, const DataSpace& space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT);
-
- // Reads the data of this dataset and stores it in the provided buffer.
- // The memory and file dataspaces and the transferring property list
- // can be defaults.
- void read(void* buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT) const;
- void read(H5std_string& buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT) const;
-
- // Writes the buffered data to this dataset.
- // The memory and file dataspaces and the transferring property list
- // can be defaults.
- void write(const void* buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT) const;
- void write(const H5std_string& buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT) const;
-
- // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet
- int iterateElems(void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL);
-
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DataSet"); }
-
- // Creates a dataset by way of dereference.
- DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
- DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
-
- // Default constructor.
- DataSet();
-
- // Copy constructor - same as the original DataSet.
- DataSet(const DataSet& original);
-
- // Creates a copy of an existing DataSet using its id.
- DataSet(const hid_t existing_id);
-
- // Gets the dataset id.
- virtual hid_t getId() const;
-
- // Destructor: properly terminates access to this dataset.
- virtual ~DataSet();
-
- protected:
+ public:
+ // Close this dataset.
+ virtual void close();
+
+ // Extends the dataset with unlimited dimension.
+ void extend(const hsize_t *size) const;
+
+ // Fills a selection in memory with a value
+ void fillMemBuf(const void *fill, const DataType &fill_type, void *buf, const DataType &buf_type,
+ const DataSpace &space) const;
+ // void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace&
+ // space); // removed from 1.8.18 and 1.10.1
+
+ // Fills a selection in memory with zero
+ void fillMemBuf(void *buf, const DataType &buf_type, const DataSpace &space) const;
+ // void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
+
+ // Gets the creation property list of this dataset.
+ DSetCreatPropList getCreatePlist() const;
+
+ // Gets the access property list of this dataset.
+ DSetAccPropList getAccessPlist() const;
+
+ // Returns the address of this dataset in the file.
+ haddr_t getOffset() const;
+
+ // Gets the dataspace of this dataset.
+ virtual DataSpace getSpace() const;
+
+ // Determines whether space has been allocated for a dataset.
+ void getSpaceStatus(H5D_space_status_t &status) const;
+
+ // Returns the amount of storage size required for this dataset.
+ virtual hsize_t getStorageSize() const;
+
+ // Returns the in memory size of this attribute's data.
+ virtual size_t getInMemDataSize() const;
+
+ // Returns the number of bytes required to store VL data.
+ hsize_t getVlenBufSize(const DataType &type, const DataSpace &space) const;
+ // hsize_t getVlenBufSize(DataType& type, DataSpace& space) const; // removed from 1.8.18 and 1.10.1
+
+ // Reclaims VL datatype memory buffers.
+ static void vlenReclaim(const DataType &type, const DataSpace &space,
+ const DSetMemXferPropList &xfer_plist, void *buf);
+ static void vlenReclaim(void *buf, const DataType &type, const DataSpace &space = DataSpace::ALL,
+ const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT);
+
+ // Reads the data of this dataset and stores it in the provided buffer.
+ // The memory and file dataspaces and the transferring property list
+ // can be defaults.
+ void read(void *buf, const DataType &mem_type, const DataSpace &mem_space = DataSpace::ALL,
+ const DataSpace & file_space = DataSpace::ALL,
+ const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT) const;
+ void read(H5std_string &buf, const DataType &mem_type, const DataSpace &mem_space = DataSpace::ALL,
+ const DataSpace & file_space = DataSpace::ALL,
+ const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT) const;
+
+ // Writes the buffered data to this dataset.
+ // The memory and file dataspaces and the transferring property list
+ // can be defaults.
+ void write(const void *buf, const DataType &mem_type, const DataSpace &mem_space = DataSpace::ALL,
+ const DataSpace & file_space = DataSpace::ALL,
+ const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT) const;
+ void write(const H5std_string &buf, const DataType &mem_type, const DataSpace &mem_space = DataSpace::ALL,
+ const DataSpace & file_space = DataSpace::ALL,
+ const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT) const;
+
+ // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet
+ int iterateElems(void *buf, const DataType &type, const DataSpace &space, H5D_operator_t op,
+ void *op_data = NULL);
+
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("DataSet");
+ }
+
+ // Creates a dataset by way of dereference.
+ DataSet(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT,
+ const PropList &plist = PropList::DEFAULT);
+ DataSet(const Attribute &attr, const void *ref, H5R_type_t ref_type = H5R_OBJECT,
+ const PropList &plist = PropList::DEFAULT);
+
+ // Default constructor.
+ DataSet();
+
+ // Copy constructor - same as the original DataSet.
+ DataSet(const DataSet &original);
+
+ // Creates a copy of an existing DataSet using its id.
+ DataSet(const hid_t existing_id);
+
+ // Gets the dataset id.
+ virtual hid_t getId() const;
+
+ // Destructor: properly terminates access to this dataset.
+ virtual ~DataSet();
+
+ protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Sets the dataset id.
- virtual void p_setId(const hid_t new_id);
+ // Sets the dataset id.
+ virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
- private:
- hid_t id; // HDF5 dataset id
+ private:
+ hid_t id; // HDF5 dataset id
- // This function contains the common code that is used by
- // getTypeClass and various API functions getXxxType
- // defined in AbstractDs for generic datatype and specific
- // sub-types
- virtual hid_t p_get_type() const;
+ // This function contains the common code that is used by
+ // getTypeClass and various API functions getXxxType
+ // defined in AbstractDs for generic datatype and specific
+ // sub-types
+ virtual hid_t p_get_type() const;
- // Reads variable or fixed len strings from this dataset.
- void p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const;
- void p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const;
+ // Reads variable or fixed len strings from this dataset.
+ void p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id,
+ const hid_t xfer_plist_id, H5std_string &strg) const;
+ void p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id,
+ const hid_t xfer_plist_id, H5std_string &strg) const;
- // Friend function to set DataSet id. For library use only.
- friend void f_DataSet_setId(DataSet* dset, hid_t new_id);
+ // Friend function to set DataSet id. For library use only.
+ friend void f_DataSet_setId(DataSet *dset, hid_t new_id);
}; // end of DataSet
} // namespace H5
diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp
index e8e5712..47fdbbc 100644
--- a/c++/src/H5DataSpace.cpp
+++ b/c++/src/H5DataSpace.cpp
@@ -33,7 +33,7 @@ using std::endl;
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-DataSpace* DataSpace::ALL_ = 0;
+DataSpace *DataSpace::ALL_ = 0;
//--------------------------------------------------------------------------
// Function: DataSpace::getConstant
@@ -45,13 +45,13 @@ DataSpace* DataSpace::ALL_ = 0;
// a DataSpaceIException. This scenario should not happen.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-DataSpace* DataSpace::getConstant()
+DataSpace *
+DataSpace::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -60,8 +60,9 @@ DataSpace* DataSpace::getConstant()
if (ALL_ == 0)
ALL_ = new DataSpace(H5S_ALL);
else
- throw DataSpaceIException("DataSpace::getConstant", "DataSpace::getConstant is being invoked on an allocated ALL_");
- return(ALL_);
+ throw DataSpaceIException("DataSpace::getConstant",
+ "DataSpace::getConstant is being invoked on an allocated ALL_");
+ return (ALL_);
}
//--------------------------------------------------------------------------
@@ -69,7 +70,8 @@ DataSpace* DataSpace::getConstant()
// Purpose: Deletes the constant object that DataSpace::ALL_ points to
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void DataSpace::deleteConstants()
+void
+DataSpace::deleteConstants()
{
if (ALL_ != 0)
delete ALL_;
@@ -78,7 +80,7 @@ void DataSpace::deleteConstants()
//--------------------------------------------------------------------------
// Purpose Constant for default dataspace.
//--------------------------------------------------------------------------
-const DataSpace& DataSpace::ALL = *getConstant();
+const DataSpace &DataSpace::ALL = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -94,8 +96,7 @@ const DataSpace& DataSpace::ALL = *getConstant();
DataSpace::DataSpace(H5S_class_t type) : IdComponent()
{
id = H5Screate(type);
- if (id < 0)
- {
+ if (id < 0) {
throw DataSpaceIException("DataSpace constructor", "H5Screate failed");
}
}
@@ -109,11 +110,10 @@ DataSpace::DataSpace(H5S_class_t type) : IdComponent()
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSpace::DataSpace(int rank, const hsize_t * dims, const hsize_t * maxdims) : IdComponent()
+DataSpace::DataSpace(int rank, const hsize_t *dims, const hsize_t *maxdims) : IdComponent()
{
id = H5Screate_simple(rank, dims, maxdims);
- if (id < 0)
- {
+ if (id < 0) {
throw DataSpaceIException("DataSpace constructor", "H5Screate_simple failed");
}
}
@@ -137,7 +137,7 @@ DataSpace::DataSpace(const hid_t existing_id) : IdComponent(), id(existing_id)
///\param original - IN: DataSpace object to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSpace::DataSpace(const DataSpace& original) : IdComponent(), id(original.id)
+DataSpace::DataSpace(const DataSpace &original) : IdComponent(), id(original.id)
{
incRefCount(); // increment number of references to this id
}
@@ -154,17 +154,18 @@ DataSpace::DataSpace(const DataSpace& original) : IdComponent(), id(original.id)
// - Replaced decRefCount with close() to let the C library
// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
-void DataSpace::copy(const DataSpace& like_space)
+void
+DataSpace::copy(const DataSpace &like_space)
{
// If this object has an hdf5 valid id, close it
if (id != H5S_ALL) {
try {
close();
}
- catch (Exception& close_error) {
- throw DataSpaceIException("DataSpace::copy", close_error.getDetailMsg());
+ catch (Exception &close_error) {
+ throw DataSpaceIException("DataSpace::copy", close_error.getDetailMsg());
}
- } // end if
+ } // end if
// call C routine to copy the dataspace
id = H5Scopy(like_space.getId());
@@ -184,11 +185,12 @@ void DataSpace::copy(const DataSpace& like_space)
// the new id in the left hand side object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSpace& DataSpace::operator=(const DataSpace& rhs)
+DataSpace &
+DataSpace::operator=(const DataSpace &rhs)
{
if (this != &rhs)
copy(rhs);
- return(*this);
+ return (*this);
}
//--------------------------------------------------------------------------
@@ -199,17 +201,16 @@ DataSpace& DataSpace::operator=(const DataSpace& rhs)
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool DataSpace::isSimple () const
+bool
+DataSpace::isSimple() const
{
htri_t simple = H5Sis_simple(id);
if (simple > 0)
return true;
else if (simple == 0)
return false;
- else
- {
- throw DataSpaceIException("DataSpace::isSimple",
- "H5Sis_simple returns negative value");
+ else {
+ throw DataSpaceIException("DataSpace::isSimple", "H5Sis_simple returns negative value");
}
}
@@ -225,11 +226,11 @@ bool DataSpace::isSimple () const
/// it to be re-defined.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::offsetSimple (const hssize_t* offset) const
+void
+DataSpace::offsetSimple(const hssize_t *offset) const
{
herr_t ret_value = H5Soffset_simple(id, offset);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSpaceIException("DataSpace::offsetSimple", "H5Soffset_simple failed");
}
}
@@ -244,15 +245,15 @@ void DataSpace::offsetSimple (const hssize_t* offset) const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int DataSpace::getSimpleExtentDims (hsize_t *dims, hsize_t *maxdims) const
+int
+DataSpace::getSimpleExtentDims(hsize_t *dims, hsize_t *maxdims) const
{
int ndims = H5Sget_simple_extent_dims(id, dims, maxdims);
- if (ndims < 0)
- {
+ if (ndims < 0) {
throw DataSpaceIException("DataSpace::getSimpleExtentDims",
- "H5Sget_simple_extent_dims returns negative number of dimensions");
+ "H5Sget_simple_extent_dims returns negative number of dimensions");
}
- return(ndims);
+ return (ndims);
}
//--------------------------------------------------------------------------
@@ -262,15 +263,16 @@ int DataSpace::getSimpleExtentDims (hsize_t *dims, hsize_t *maxdims) const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int DataSpace::getSimpleExtentNdims () const
+int
+DataSpace::getSimpleExtentNdims() const
{
int ndims = H5Sget_simple_extent_ndims(id);
- if (ndims < 0)
- {
- throw DataSpaceIException("DataSpace::getSimpleExtentNdims",
+ if (ndims < 0) {
+ throw DataSpaceIException(
+ "DataSpace::getSimpleExtentNdims",
"H5Sget_simple_extent_ndims returns negative value for dimensionality of the dataspace");
}
- return(ndims);
+ return (ndims);
}
//--------------------------------------------------------------------------
@@ -284,15 +286,16 @@ int DataSpace::getSimpleExtentNdims () const
// num_elements = -1 when failure occurs vs. 0
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-hssize_t DataSpace::getSimpleExtentNpoints () const
+hssize_t
+DataSpace::getSimpleExtentNpoints() const
{
hssize_t num_elements = H5Sget_simple_extent_npoints(id);
if (num_elements > -1)
- return(num_elements);
- else
- {
+ return (num_elements);
+ else {
throw DataSpaceIException("DataSpace::getSimpleExtentNpoints",
- "H5Sget_simple_extent_npoints returns negative value for the number of elements in the dataspace");
+ "H5Sget_simple_extent_npoints returns negative value for the number of "
+ "elements in the dataspace");
}
}
@@ -303,15 +306,15 @@ hssize_t DataSpace::getSimpleExtentNpoints () const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5S_class_t DataSpace::getSimpleExtentType () const
+H5S_class_t
+DataSpace::getSimpleExtentType() const
{
H5S_class_t class_name = H5Sget_simple_extent_type(id);
- if (class_name == H5S_NO_CLASS)
- {
+ if (class_name == H5S_NO_CLASS) {
throw DataSpaceIException("DataSpace::getSimpleExtentType",
- "H5Sget_simple_extent_type returns H5S_NO_CLASS");
+ "H5Sget_simple_extent_type returns H5S_NO_CLASS");
}
- return(class_name);
+ return (class_name);
}
//--------------------------------------------------------------------------
@@ -321,12 +324,12 @@ H5S_class_t DataSpace::getSimpleExtentType () const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::extentCopy (const DataSpace& dest_space) const
+void
+DataSpace::extentCopy(const DataSpace &dest_space) const
{
- hid_t dest_space_id = dest_space.getId();
- herr_t ret_value = H5Sextent_copy(dest_space_id, id);
- if (ret_value < 0)
- {
+ hid_t dest_space_id = dest_space.getId();
+ herr_t ret_value = H5Sextent_copy(dest_space_id, id);
+ if (ret_value < 0) {
throw DataSpaceIException("DataSpace::extentCopy", "H5Sextent_copy failed");
}
}
@@ -344,7 +347,7 @@ void DataSpace::extentCopy (const DataSpace& dest_space) const
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//void DataSpace::extentCopy(DataSpace& dest_space) const
+// void DataSpace::extentCopy(DataSpace& dest_space) const
//{
// extentCopy(dest_space);
//}
@@ -358,12 +361,12 @@ void DataSpace::extentCopy (const DataSpace& dest_space) const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::setExtentSimple(int rank, const hsize_t *current_size, const hsize_t *maximum_size) const
+void
+DataSpace::setExtentSimple(int rank, const hsize_t *current_size, const hsize_t *maximum_size) const
{
herr_t ret_value;
ret_value = H5Sset_extent_simple(id, rank, current_size, maximum_size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSpaceIException("DataSpace::setExtentSimple", "H5Sset_extent_simple failed");
}
}
@@ -375,11 +378,11 @@ void DataSpace::setExtentSimple(int rank, const hsize_t *current_size, const hsi
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::setExtentNone () const
+void
+DataSpace::setExtentNone() const
{
herr_t ret_value = H5Sset_extent_none(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSpaceIException("DataSpace::setExtentNone", "H5Sset_extent_none failed");
}
}
@@ -391,15 +394,16 @@ void DataSpace::setExtentNone () const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-hssize_t DataSpace::getSelectNpoints () const
+hssize_t
+DataSpace::getSelectNpoints() const
{
hssize_t num_elements = H5Sget_select_npoints(id);
- if (num_elements < 0)
- {
- throw DataSpaceIException("DataSpace::getSelectNpoints",
+ if (num_elements < 0) {
+ throw DataSpaceIException(
+ "DataSpace::getSelectNpoints",
"H5Sget_select_npoints returns negative value for number of elements in the dataspace selection");
}
- return(num_elements);
+ return (num_elements);
}
//--------------------------------------------------------------------------
@@ -409,15 +413,16 @@ hssize_t DataSpace::getSelectNpoints () const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-hssize_t DataSpace::getSelectHyperNblocks () const
+hssize_t
+DataSpace::getSelectHyperNblocks() const
{
hssize_t num_blocks = H5Sget_select_hyper_nblocks(id);
- if (num_blocks < 0)
- {
- throw DataSpaceIException("DataSpace::getSelectHyperNblocks",
+ if (num_blocks < 0) {
+ throw DataSpaceIException(
+ "DataSpace::getSelectHyperNblocks",
"H5Sget_select_hyper_nblocks returns negative value for the number of hyperslab blocks");
}
- return(num_blocks);
+ return (num_blocks);
}
//--------------------------------------------------------------------------
@@ -429,14 +434,14 @@ hssize_t DataSpace::getSelectHyperNblocks () const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_t *buf) const
+void
+DataSpace::getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_t *buf) const
{
herr_t ret_value;
ret_value = H5Sget_select_hyper_blocklist(id, startblock, numblocks, buf);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSpaceIException("DataSpace::getSelectHyperBlocklist",
- "H5Sget_select_hyper_blocklist failed");
+ "H5Sget_select_hyper_blocklist failed");
}
}
@@ -447,15 +452,14 @@ void DataSpace::getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, h
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-hssize_t DataSpace::getSelectElemNpoints () const
+hssize_t
+DataSpace::getSelectElemNpoints() const
{
hssize_t num_points = H5Sget_select_elem_npoints(id);
- if (num_points < 0)
- {
- throw DataSpaceIException("DataSpace::getSelectElemNpoints",
- "H5Sget_select_elem_npoints failed");
+ if (num_points < 0) {
+ throw DataSpaceIException("DataSpace::getSelectElemNpoints", "H5Sget_select_elem_npoints failed");
}
- return(num_points);
+ return (num_points);
}
//--------------------------------------------------------------------------
@@ -470,14 +474,13 @@ hssize_t DataSpace::getSelectElemNpoints () const
/// H5Sget_select_elem_pointlist in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::getSelectElemPointlist (hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const
+void
+DataSpace::getSelectElemPointlist(hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const
{
herr_t ret_value;
ret_value = H5Sget_select_elem_pointlist(id, startpoint, numpoints, buf);
- if (ret_value < 0)
- {
- throw DataSpaceIException("DataSpace::getSelectElemPointlist",
- "H5Sget_select_elem_pointlist failed");
+ if (ret_value < 0) {
+ throw DataSpaceIException("DataSpace::getSelectElemPointlist", "H5Sget_select_elem_pointlist failed");
}
}
@@ -493,13 +496,12 @@ void DataSpace::getSelectElemPointlist (hsize_t startpoint, hsize_t numpoints, h
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::getSelectBounds (hsize_t* start, hsize_t* end) const
+void
+DataSpace::getSelectBounds(hsize_t *start, hsize_t *end) const
{
herr_t ret_value = H5Sget_select_bounds(id, start, end);
- if (ret_value < 0)
- {
- throw DataSpaceIException("DataSpace::getSelectBounds",
- "H5Sget_select_bounds failed");
+ if (ret_value < 0) {
+ throw DataSpaceIException("DataSpace::getSelectBounds", "H5Sget_select_bounds failed");
}
}
@@ -518,14 +520,13 @@ void DataSpace::getSelectBounds (hsize_t* start, hsize_t* end) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::selectElements (H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const
+void
+DataSpace::selectElements(H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const
{
herr_t ret_value;
ret_value = H5Sselect_elements(id, op, num_elements, coord);
- if (ret_value < 0)
- {
- throw DataSpaceIException("DataSpace::selectElements",
- "H5Sselect_elements failed");
+ if (ret_value < 0) {
+ throw DataSpaceIException("DataSpace::selectElements", "H5Sselect_elements failed");
}
}
@@ -536,11 +537,11 @@ void DataSpace::selectElements (H5S_seloper_t op, const size_t num_elements, con
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::selectAll () const
+void
+DataSpace::selectAll() const
{
herr_t ret_value = H5Sselect_all(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSpaceIException("DataSpace::selectAll", "H5Sselect_all failed");
}
}
@@ -552,13 +553,12 @@ void DataSpace::selectAll () const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::selectNone () const
+void
+DataSpace::selectNone() const
{
herr_t ret_value = H5Sselect_none(id);
- if (ret_value < 0)
- {
- throw DataSpaceIException("DataSpace::selectNone",
- "H5Sselect_none failed");
+ if (ret_value < 0) {
+ throw DataSpaceIException("DataSpace::selectNone", "H5Sselect_none failed");
}
}
@@ -571,17 +571,16 @@ void DataSpace::selectNone () const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool DataSpace::selectValid () const
+bool
+DataSpace::selectValid() const
{
htri_t ret_value = H5Sselect_valid(id);
if (ret_value > 0)
return true;
else if (ret_value == 0)
return false;
- else
- {
- throw DataSpaceIException("DataSpace::selectValid",
- "H5Sselect_valid returns negative value");
+ else {
+ throw DataSpaceIException("DataSpace::selectValid", "H5Sselect_valid returns negative value");
}
}
@@ -599,14 +598,14 @@ bool DataSpace::selectValid () const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride, const hsize_t *block) const
+void
+DataSpace::selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start,
+ const hsize_t *stride, const hsize_t *block) const
{
herr_t ret_value;
ret_value = H5Sselect_hyperslab(id, op, start, stride, count, block);
- if (ret_value < 0)
- {
- throw DataSpaceIException("DataSpace::selectHyperslab",
- "H5Sselect_hyperslab failed");
+ if (ret_value < 0) {
+ throw DataSpaceIException("DataSpace::selectHyperslab", "H5Sselect_hyperslab failed");
}
}
@@ -622,9 +621,10 @@ void DataSpace::selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hs
// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
-hid_t DataSpace::getId() const
+hid_t
+DataSpace::getId() const
{
- return(id);
+ return (id);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -640,13 +640,14 @@ hid_t DataSpace::getId() const
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::p_setId(const hid_t new_id)
+void
+DataSpace::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw DataSpaceIException(inMemFunc("p_setId"), close_error.getDetailMsg());
}
// reset object's id to the given id
@@ -661,14 +662,13 @@ void DataSpace::p_setId(const hid_t new_id)
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
-void DataSpace::close()
+void
+DataSpace::close()
{
// check if id is a valid hdf5 object id before trying to close it
- if (p_valid_id(id))
- {
+ if (p_valid_id(id)) {
herr_t ret_value = H5Sclose(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSpaceIException("DataSpace::close", "H5Sclose failed");
}
// reset the id
@@ -690,9 +690,10 @@ DataSpace::~DataSpace()
{
try {
close();
- } catch (Exception& close_error) {
+ }
+ catch (Exception &close_error) {
cerr << "DataSpace::~DataSpace - " << close_error.getDetailMsg() << endl;
}
}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h
index 54c68ac..b5e92bc 100644
--- a/c++/src/H5DataSpace.h
+++ b/c++/src/H5DataSpace.h
@@ -23,127 +23,132 @@ namespace H5 {
*/
// Inheritance: IdComponent
class H5_DLLCPP DataSpace : public IdComponent {
- public:
- ///\brief Default DataSpace objects
- static const DataSpace& ALL;
+ public:
+ ///\brief Default DataSpace objects
+ static const DataSpace &ALL;
- // Creates a dataspace object given the space type
- DataSpace(H5S_class_t type = H5S_SCALAR);
+ // Creates a dataspace object given the space type
+ DataSpace(H5S_class_t type = H5S_SCALAR);
- // Creates a simple dataspace
- DataSpace(int rank, const hsize_t * dims, const hsize_t * maxdims = NULL);
+ // Creates a simple dataspace
+ DataSpace(int rank, const hsize_t *dims, const hsize_t *maxdims = NULL);
- // Creates a DataSpace object using an existing dataspace id.
- DataSpace(const hid_t space_id);
+ // Creates a DataSpace object using an existing dataspace id.
+ DataSpace(const hid_t space_id);
- // Copy constructor - same as the original DataSpace.
- DataSpace(const DataSpace& original);
+ // Copy constructor - same as the original DataSpace.
+ DataSpace(const DataSpace &original);
- // Assignment operator
- DataSpace& operator=(const DataSpace& rhs);
+ // Assignment operator
+ DataSpace &operator=(const DataSpace &rhs);
- // Closes this dataspace.
- virtual void close();
+ // Closes this dataspace.
+ virtual void close();
- // Makes copy of an existing dataspace.
- void copy(const DataSpace& like_space);
+ // Makes copy of an existing dataspace.
+ void copy(const DataSpace &like_space);
- // Copies the extent of this dataspace.
- void extentCopy(const DataSpace& dest_space) const;
- // removed from 1.8.18 and 1.10.1
- //void extentCopy(DataSpace& dest_space) const;
+ // Copies the extent of this dataspace.
+ void extentCopy(const DataSpace &dest_space) const;
+ // removed from 1.8.18 and 1.10.1
+ // void extentCopy(DataSpace& dest_space) const;
- // Gets the bounding box containing the current selection.
- void getSelectBounds(hsize_t* start, hsize_t* end) const;
+ // Gets the bounding box containing the current selection.
+ void getSelectBounds(hsize_t *start, hsize_t *end) const;
- // Gets the number of element points in the current selection.
- hssize_t getSelectElemNpoints() const;
+ // Gets the number of element points in the current selection.
+ hssize_t getSelectElemNpoints() const;
- // Retrieves the list of element points currently selected.
- void getSelectElemPointlist(hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const;
+ // Retrieves the list of element points currently selected.
+ void getSelectElemPointlist(hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const;
- // Gets the list of hyperslab blocks currently selected.
- void getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_t *buf) const;
+ // Gets the list of hyperslab blocks currently selected.
+ void getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_t *buf) const;
- // Get number of hyperslab blocks.
- hssize_t getSelectHyperNblocks() const;
+ // Get number of hyperslab blocks.
+ hssize_t getSelectHyperNblocks() const;
- // Gets the number of elements in this dataspace selection.
- hssize_t getSelectNpoints() const;
+ // Gets the number of elements in this dataspace selection.
+ hssize_t getSelectNpoints() const;
- // Retrieves dataspace dimension size and maximum size.
- int getSimpleExtentDims(hsize_t *dims, hsize_t *maxdims = NULL) const;
+ // Retrieves dataspace dimension size and maximum size.
+ int getSimpleExtentDims(hsize_t *dims, hsize_t *maxdims = NULL) const;
- // Gets the dimensionality of this dataspace.
- int getSimpleExtentNdims() const;
+ // Gets the dimensionality of this dataspace.
+ int getSimpleExtentNdims() const;
- // Gets the number of elements in this dataspace.
- // 12/05/00 - changed return type to hssize_t from hsize_t - C API
- hssize_t getSimpleExtentNpoints() const;
+ // Gets the number of elements in this dataspace.
+ // 12/05/00 - changed return type to hssize_t from hsize_t - C API
+ hssize_t getSimpleExtentNpoints() const;
- // Gets the current class of this dataspace.
- H5S_class_t getSimpleExtentType() const;
+ // Gets the current class of this dataspace.
+ H5S_class_t getSimpleExtentType() const;
- // Determines if this dataspace is a simple one.
- bool isSimple() const;
+ // Determines if this dataspace is a simple one.
+ bool isSimple() const;
- // Sets the offset of this simple dataspace.
- void offsetSimple(const hssize_t* offset) const;
+ // Sets the offset of this simple dataspace.
+ void offsetSimple(const hssize_t *offset) const;
- // Selects the entire dataspace.
- void selectAll() const;
+ // Selects the entire dataspace.
+ void selectAll() const;
- // Selects array elements to be included in the selection for
- // this dataspace.
- void selectElements(H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const;
+ // Selects array elements to be included in the selection for
+ // this dataspace.
+ void selectElements(H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const;
- // Selects a hyperslab region to add to the current selected region.
- void selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride = NULL, const hsize_t *block = NULL) const;
+ // Selects a hyperslab region to add to the current selected region.
+ void selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start,
+ const hsize_t *stride = NULL, const hsize_t *block = NULL) const;
- // Resets the selection region to include no elements.
- void selectNone() const;
+ // Resets the selection region to include no elements.
+ void selectNone() const;
- // Verifies that the selection is within the extent of the dataspace.
- bool selectValid() const;
+ // Verifies that the selection is within the extent of the dataspace.
+ bool selectValid() const;
- // Removes the extent from this dataspace.
- void setExtentNone() const;
+ // Removes the extent from this dataspace.
+ void setExtentNone() const;
- // Sets or resets the size of this dataspace.
- void setExtentSimple(int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL) const;
+ // Sets or resets the size of this dataspace.
+ void setExtentSimple(int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DataSpace"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("DataSpace");
+ }
- // Gets the dataspace id.
- virtual hid_t getId() const;
+ // Gets the dataspace id.
+ virtual hid_t getId() const;
- // Deletes the global constant
- static void deleteConstants();
+ // Deletes the global constant
+ static void deleteConstants();
- // Destructor: properly terminates access to this dataspace.
- virtual ~DataSpace();
+ // Destructor: properly terminates access to this dataspace.
+ virtual ~DataSpace();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- protected:
- // Sets the dataspace id.
- virtual void p_setId(const hid_t new_id);
+ protected:
+ // Sets the dataspace id.
+ virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
- private:
- hid_t id; // HDF5 dataspace id
+ private:
+ hid_t id; // HDF5 dataspace id
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- static DataSpace* ALL_;
+ static DataSpace *ALL_;
- // Creates the global constant
- static DataSpace* getConstant();
+ // Creates the global constant
+ static DataSpace *getConstant();
- // Friend function to set DataSpace id. For library use only.
- friend void f_DataSpace_setId(DataSpace *dspace, hid_t new_id);
+ // Friend function to set DataSpace id. For library use only.
+ friend void f_DataSpace_setId(DataSpace *dspace, hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index 0472975..565fb9a 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -82,8 +82,7 @@ DataType::DataType(const H5T_class_t type_class, size_t size) : H5Object(), enco
{
// Call C routine to create the new datatype
id = H5Tcreate(type_class, size);
- if (id < 0)
- {
+ if (id < 0) {
throw DataTypeIException("DataType constructor", "H5Tcreate failed");
}
}
@@ -99,7 +98,8 @@ DataType::DataType(const H5T_class_t type_class, size_t size) : H5Object(), enco
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), encoded_buf(NULL), buf_size(0)
+DataType::DataType(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist)
+ : H5Object(), encoded_buf(NULL), buf_size(0)
{
id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference");
}
@@ -118,18 +118,19 @@ DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type,
// Jul, 2008
// Added for application convenience.
//--------------------------------------------------------------------------
- /* DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID), encoded_buf(NULL), buf_size(0)
+/* DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) :
+H5Object(), id(H5I_INVALID_HID), encoded_buf(NULL), buf_size(0)
{
- id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference");
+ id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference");
}
- */
+*/
//--------------------------------------------------------------------------
// Function: DataType copy constructor
///\brief Copy constructor: same HDF5 object as \a original
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType::DataType(const DataType& original) : H5Object(), id(original.id), encoded_buf(NULL), buf_size(0)
+DataType::DataType(const DataType &original) : H5Object(), id(original.id), encoded_buf(NULL), buf_size(0)
{
incRefCount(); // increment number of references to this id
}
@@ -147,7 +148,7 @@ DataType::DataType(const DataType& original) : H5Object(), id(original.id), enco
// unnecessarily and will produce undefined behavior.
// -BMR, Apr 2015
//--------------------------------------------------------------------------
-DataType::DataType(const PredType& pred_type) : H5Object(), encoded_buf(NULL), buf_size(0)
+DataType::DataType(const PredType &pred_type) : H5Object(), encoded_buf(NULL), buf_size(0)
{
// Call C routine to copy the datatype
id = H5Tcopy(pred_type.getId());
@@ -169,7 +170,7 @@ DataType::DataType(const PredType& pred_type) : H5Object(), encoded_buf(NULL), b
// improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-DataType::DataType(const H5Location& loc, const char *dtype_name) : H5Object(), encoded_buf(NULL), buf_size(0)
+DataType::DataType(const H5Location &loc, const char *dtype_name) : H5Object(), encoded_buf(NULL), buf_size(0)
{
id = p_opentype(loc, dtype_name);
}
@@ -188,7 +189,8 @@ DataType::DataType(const H5Location& loc, const char *dtype_name) : H5Object(),
// improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-DataType::DataType(const H5Location& loc, const H5std_string& dtype_name) : H5Object(), encoded_buf(NULL), buf_size(0)
+DataType::DataType(const H5Location &loc, const H5std_string &dtype_name)
+ : H5Object(), encoded_buf(NULL), buf_size(0)
{
id = p_opentype(loc, dtype_name.c_str());
}
@@ -205,13 +207,14 @@ DataType::DataType(const H5Location& loc, const H5std_string& dtype_name) : H5Ob
// - Replaced decRefCount with close() to let the C library
// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
-void DataType::copy(const DataType& like_type)
+void
+DataType::copy(const DataType &like_type)
{
// close the current data type before copying like_type to this object
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw DataTypeIException(inMemFunc("copy"), close_error.getDetailMsg());
}
@@ -230,13 +233,14 @@ void DataType::copy(const DataType& like_type)
///\par Description
/// The resulted dataset will be transient and modifiable.
//--------------------------------------------------------------------------
-void DataType::copy(const DataSet& dset)
+void
+DataType::copy(const DataSet &dset)
{
// close the current data type before copying dset's datatype to this object
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw DataTypeIException(inMemFunc("copy"), close_error.getDetailMsg());
}
@@ -254,11 +258,11 @@ void DataType::copy(const DataSet& dset)
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-hid_t DataType::p_decode() const
+hid_t
+DataType::p_decode() const
{
// Make sure that the buffer can be decoded
- if (encoded_buf == NULL)
- {
+ if (encoded_buf == NULL) {
throw DataTypeIException("DataType::p_decode", "No encoded buffer");
}
@@ -266,13 +270,11 @@ hid_t DataType::p_decode() const
hid_t encoded_dtype_id = H5Tdecode(encoded_buf);
// If H5Tdecode fails, raise exception
- if (encoded_dtype_id < 0)
- {
+ if (encoded_dtype_id < 0) {
throw DataTypeIException("DataType::p_decode", "H5Tdecode failed");
}
- else
- {
- return(encoded_dtype_id);
+ else {
+ return (encoded_dtype_id);
}
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -285,7 +287,8 @@ hid_t DataType::p_decode() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-DataType* DataType::decode() const
+DataType *
+DataType::decode() const
{
hid_t encoded_dtype_id = H5I_INVALID_HID;
try {
@@ -296,7 +299,7 @@ DataType* DataType::decode() const
}
DataType *encoded_dtype = new DataType;
encoded_dtype->p_setId(encoded_dtype_id);
- return(encoded_dtype);
+ return (encoded_dtype);
}
//--------------------------------------------------------------------------
@@ -306,27 +309,24 @@ DataType* DataType::decode() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-void DataType::encode()
+void
+DataType::encode()
{
// Call H5Tencode passing in null to determine the size of the buffer
herr_t ret_value = H5Tencode(id, NULL, &buf_size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("DataType::encode", "Failed to get buf_size");
}
// Allocate buffer and call C function again to encode
- if (buf_size > 0)
- {
+ if (buf_size > 0) {
encoded_buf = (unsigned char *)HDcalloc((size_t)1, buf_size);
- ret_value = H5Tencode(id, encoded_buf, &buf_size);
- if (ret_value < 0)
- {
+ ret_value = H5Tencode(id, encoded_buf, &buf_size);
+ if (ret_value < 0) {
throw DataTypeIException("DataType::encode", "H5Tencode failed");
}
}
- else
- {
+ else {
throw DataTypeIException("DataType::encode", "Failed to allocate buffer for encoding");
}
}
@@ -339,7 +339,8 @@ void DataType::encode()
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-bool DataType::hasBinaryDesc() const
+bool
+DataType::hasBinaryDesc() const
{
if (encoded_buf != NULL)
return true;
@@ -366,13 +367,13 @@ bool DataType::hasBinaryDesc() const
// transient datatype.
// BMR - Mar, 2015
//--------------------------------------------------------------------------
-DataType& DataType::operator=(const DataType& rhs)
+DataType &
+DataType::operator=(const DataType &rhs)
{
- if (this != &rhs)
- {
+ if (this != &rhs) {
setId(rhs.id);
}
- return(*this);
+ return (*this);
}
//--------------------------------------------------------------------------
@@ -384,7 +385,8 @@ DataType& DataType::operator=(const DataType& rhs)
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool DataType::operator==(const DataType& compared_type) const
+bool
+DataType::operator==(const DataType &compared_type) const
{
// Call C routine H5Tequal to determines whether two datatype
// identifiers refer to the same datatype
@@ -393,8 +395,7 @@ bool DataType::operator==(const DataType& compared_type) const
return true;
else if (ret_value == 0)
return false;
- else
- {
+ else {
throw DataTypeIException(inMemFunc("operator=="), "H5Tequal returns negative value");
}
}
@@ -408,7 +409,8 @@ bool DataType::operator==(const DataType& compared_type) const
///\exception H5::DataTypeIException
// July, 2018
//--------------------------------------------------------------------------
-bool DataType::operator!=(const DataType& compared_type) const
+bool
+DataType::operator!=(const DataType &compared_type) const
{
return !operator==(compared_type);
}
@@ -427,7 +429,8 @@ bool DataType::operator!=(const DataType& compared_type) const
// to be commonly used by several overloads of DataType::commit.
// BMR - Jan, 2007
//--------------------------------------------------------------------------
-void DataType::p_commit(hid_t loc_id, const char* name)
+void
+DataType::p_commit(hid_t loc_id, const char *name)
{
// Call C routine to commit the transient datatype
herr_t ret_value = H5Tcommit2(loc_id, name, id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -444,7 +447,8 @@ void DataType::p_commit(hid_t loc_id, const char* name)
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Jan, 2007
//--------------------------------------------------------------------------
-void DataType::commit(const H5Location& loc, const char* name)
+void
+DataType::commit(const H5Location &loc, const char *name)
{
p_commit(loc.getId(), name);
}
@@ -463,7 +467,7 @@ void DataType::commit(const H5Location& loc, const char* name)
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//void DataType::commit(H5Location& loc, const char* name)
+// void DataType::commit(H5Location& loc, const char* name)
//{
// p_commit(loc.getId(), name);
//}
@@ -475,7 +479,8 @@ void DataType::commit(const H5Location& loc, const char* name)
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::commit(const H5Location& loc, const H5std_string& name)
+void
+DataType::commit(const H5Location &loc, const H5std_string &name)
{
p_commit(loc.getId(), name.c_str());
}
@@ -494,7 +499,7 @@ void DataType::commit(const H5Location& loc, const H5std_string& name)
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//void DataType::commit(H5Location& loc, const H5std_string& name)
+// void DataType::commit(H5Location& loc, const H5std_string& name)
//{
// p_commit(loc.getId(), name.c_str());
//}
@@ -508,7 +513,8 @@ void DataType::commit(const H5Location& loc, const H5std_string& name)
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool DataType::committed() const
+bool
+DataType::committed() const
{
// Call C function to determine if a datatype is a named one
htri_t is_committed = H5Tcommitted(id);
@@ -516,8 +522,7 @@ bool DataType::committed() const
return true;
else if (is_committed == 0)
return false;
- else
- {
+ else {
throw DataTypeIException(inMemFunc("committed"), "H5Tcommitted return negative value");
}
}
@@ -532,15 +537,15 @@ bool DataType::committed() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_conv_t DataType::find(const DataType& dest, H5T_cdata_t **pcdata) const
+H5T_conv_t
+DataType::find(const DataType &dest, H5T_cdata_t **pcdata) const
{
// Call C routine to find the conversion function
H5T_conv_t func = H5Tfind(id, dest.getId(), pcdata);
- if (func == NULL)
- {
+ if (func == NULL) {
throw DataTypeIException(inMemFunc("find"), "H5Tfind returns a NULL function");
}
- return(func);
+ return (func);
}
//--------------------------------------------------------------------------
@@ -556,17 +561,18 @@ H5T_conv_t DataType::find(const DataType& dest, H5T_cdata_t **pcdata) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::convert(const DataType& dest, size_t nelmts, void *buf, void *background, const PropList& plist) const
+void
+DataType::convert(const DataType &dest, size_t nelmts, void *buf, void *background,
+ const PropList &plist) const
{
// Get identifiers for C API
- hid_t dest_id = dest.getId();
+ hid_t dest_id = dest.getId();
hid_t plist_id = plist.getId();
// Call C routine H5Tconvert to convert the data
herr_t ret_value;
ret_value = H5Tconvert(id, dest_id, nelmts, buf, background, plist_id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("convert"), "H5Tconvert failed");
}
}
@@ -585,12 +591,12 @@ void DataType::convert(const DataType& dest, size_t nelmts, void *buf, void *bac
/// the entire library is closed.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::lock() const
+void
+DataType::lock() const
{
// Call C routine to lock the datatype
herr_t ret_value = H5Tlock(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("lock"), "H5Tlock failed");
}
}
@@ -602,16 +608,16 @@ void DataType::lock() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_class_t DataType::getClass() const
+H5T_class_t
+DataType::getClass() const
{
H5T_class_t type_class = H5Tget_class(id);
// Return datatype class identifier if successful
- if (type_class == H5T_NO_CLASS)
- {
+ if (type_class == H5T_NO_CLASS) {
throw DataTypeIException(inMemFunc("getClass"), "H5Tget_class returns H5T_NO_CLASS");
}
- return(type_class);
+ return (type_class);
}
//--------------------------------------------------------------------------
@@ -621,15 +627,16 @@ H5T_class_t DataType::getClass() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-size_t DataType::getSize() const
+size_t
+DataType::getSize() const
{
// Call C routine to get the datatype size
size_t type_size = H5Tget_size(id);
- if (type_size <= 0) // valid data types are never zero size
+ if (type_size <= 0) // valid data types are never zero size
{
throw DataTypeIException(inMemFunc("getSize"), "H5Tget_size returns invalid datatype size");
}
- return(type_size);
+ return (type_size);
}
//--------------------------------------------------------------------------
@@ -639,7 +646,8 @@ size_t DataType::getSize() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType DataType::getSuper() const
+DataType
+DataType::getSuper() const
{
// Call C routine to get the base datatype from which the specified
// datatype is derived.
@@ -647,14 +655,12 @@ DataType DataType::getSuper() const
// If H5Tget_super returns a valid datatype id, create and return
// the base type, otherwise, raise exception
- if (base_type_id > 0)
- {
+ if (base_type_id > 0) {
DataType base_type;
base_type.p_setId(base_type_id);
- return(base_type);
+ return (base_type);
}
- else
- {
+ else {
throw DataTypeIException(inMemFunc("getSuper"), "H5Tget_super failed");
}
}
@@ -675,14 +681,14 @@ DataType DataType::getSuper() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::registerFunc(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const
+void
+DataType::registerFunc(H5T_pers_t pers, const char *name, const DataType &dest, H5T_conv_t func) const
{
- hid_t dest_id = dest.getId(); // get id of the destination datatype
+ hid_t dest_id = dest.getId(); // get id of the destination datatype
// Call C routine H5Tregister to register the conversion function
herr_t ret_value = H5Tregister(pers, name, id, dest_id, func);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("registerFunc"), "H5Tregister failed");
}
}
@@ -694,7 +700,8 @@ void DataType::registerFunc(H5T_pers_t pers, const char* name, const DataType& d
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::registerFunc(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func) const
+void
+DataType::registerFunc(H5T_pers_t pers, const H5std_string &name, const DataType &dest, H5T_conv_t func) const
{
registerFunc(pers, name.c_str(), dest, func);
}
@@ -712,14 +719,14 @@ void DataType::registerFunc(H5T_pers_t pers, const H5std_string& name, const Dat
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::unregister(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const
+void
+DataType::unregister(H5T_pers_t pers, const char *name, const DataType &dest, H5T_conv_t func) const
{
- hid_t dest_id = dest.getId(); // get id of the dest datatype for C API
+ hid_t dest_id = dest.getId(); // get id of the dest datatype for C API
// Call C routine H5Tunregister to remove the conversion function
herr_t ret_value = H5Tunregister(pers, name, id, dest_id, func);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("unregister"), "H5Tunregister failed");
}
}
@@ -731,7 +738,8 @@ void DataType::unregister(H5T_pers_t pers, const char* name, const DataType& des
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::unregister(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func) const
+void
+DataType::unregister(H5T_pers_t pers, const H5std_string &name, const DataType &dest, H5T_conv_t func) const
{
unregister(pers, name.c_str(), dest, func);
}
@@ -744,12 +752,12 @@ void DataType::unregister(H5T_pers_t pers, const H5std_string& name, const DataT
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::setTag(const char* tag) const
+void
+DataType::setTag(const char *tag) const
{
// Call C routine H5Tset_tag to tag an opaque datatype.
herr_t ret_value = H5Tset_tag(id, tag);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("setTag"), "H5Tset_tag failed");
}
}
@@ -761,7 +769,8 @@ void DataType::setTag(const char* tag) const
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::setTag(const H5std_string& tag) const
+void
+DataType::setTag(const H5std_string &tag) const
{
setTag(tag.c_str());
}
@@ -773,20 +782,19 @@ void DataType::setTag(const H5std_string& tag) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string DataType::getTag() const
+H5std_string
+DataType::getTag() const
{
- char* tag_Cstr = H5Tget_tag(id);
+ char *tag_Cstr = H5Tget_tag(id);
// if the tag C-string returned is not NULL, convert it to C++ string
// and return it, otherwise, raise an exception
- if (tag_Cstr != NULL)
- {
+ if (tag_Cstr != NULL) {
H5std_string tag = H5std_string(tag_Cstr); // C string to string object
- H5free_memory(tag_Cstr); // free the C string
- return (tag); // return the tag
+ H5free_memory(tag_Cstr); // free the C string
+ return (tag); // return the tag
}
- else
- {
+ else {
throw DataTypeIException(inMemFunc("getTag"), "H5Tget_tag returns NULL for tag");
}
}
@@ -800,17 +808,16 @@ H5std_string DataType::getTag() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-bool DataType::detectClass(H5T_class_t cls) const
+bool
+DataType::detectClass(H5T_class_t cls) const
{
htri_t ret_value = H5Tdetect_class(id, cls);
if (ret_value > 0)
return true;
else if (ret_value == 0)
return false;
- else
- {
- throw DataTypeIException(inMemFunc("detectClass"),
- "H5Tdetect_class returns negative value");
+ else {
+ throw DataTypeIException(inMemFunc("detectClass"), "H5Tdetect_class returns negative value");
}
}
@@ -822,17 +829,16 @@ bool DataType::detectClass(H5T_class_t cls) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - August, 2017
//--------------------------------------------------------------------------
-bool DataType::detectClass(const PredType& pred_type, H5T_class_t cls)
+bool
+DataType::detectClass(const PredType &pred_type, H5T_class_t cls)
{
htri_t ret_value = H5Tdetect_class(pred_type.getId(), cls);
if (ret_value > 0)
return true;
else if (ret_value == 0)
return false;
- else
- {
- throw DataTypeIException("detectClass on PredType",
- "H5Tdetect_class returns negative value");
+ else {
+ throw DataTypeIException("detectClass on PredType", "H5Tdetect_class returns negative value");
}
}
@@ -844,17 +850,16 @@ bool DataType::detectClass(const PredType& pred_type, H5T_class_t cls)
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-bool DataType::isVariableStr() const
+bool
+DataType::isVariableStr() const
{
htri_t is_varlen_str = H5Tis_variable_str(id);
if (is_varlen_str == 1)
return true;
else if (is_varlen_str == 0)
return false;
- else
- {
- throw DataTypeIException(inMemFunc("isVariableStr"),
- "H5Tis_variable_str returns negative value");
+ else {
+ throw DataTypeIException(inMemFunc("isVariableStr"), "H5Tis_variable_str returns negative value");
}
}
@@ -869,18 +874,17 @@ bool DataType::isVariableStr() const
// Currently, there is no datatype creation property list class
// in the C++ API because there is no associated functionality.
//--------------------------------------------------------------------------
-PropList DataType::getCreatePlist() const
+PropList
+DataType::getCreatePlist() const
{
hid_t create_plist_id = H5Tget_create_plist(id);
- if (create_plist_id < 0)
- {
- throw DataTypeIException(inMemFunc("getCreatePlist"),
- "H5Tget_create_plist returns negative value");
+ if (create_plist_id < 0) {
+ throw DataTypeIException(inMemFunc("getCreatePlist"), "H5Tget_create_plist returns negative value");
}
// create and return the DSetCreatPropList object
PropList create_plist;
f_PropList_setId(&create_plist, create_plist_id);
- return(create_plist);
+ return (create_plist);
}
//--------------------------------------------------------------------------
@@ -895,9 +899,10 @@ PropList DataType::getCreatePlist() const
// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
-hid_t DataType::getId() const
+hid_t
+DataType::getId() const
{
- return(id);
+ return (id);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -912,13 +917,14 @@ hid_t DataType::getId() const
// This function was introduced in 1.10.1 to be used by the new
// XxxType constructors that open a datatype. -BMR, Dec 2016
//--------------------------------------------------------------------------
-hid_t DataType::p_opentype(const H5Location& loc, const char *dtype_name) const
+hid_t
+DataType::p_opentype(const H5Location &loc, const char *dtype_name) const
{
// Call C function to open the named datatype at this location
hid_t ret_value = H5Topen2(loc.getId(), dtype_name, H5P_DEFAULT);
if (ret_value < 0)
throw DataTypeIException(inMemFunc("constructor"), "H5Topen2 failed");
- return(ret_value);
+ return (ret_value);
}
//--------------------------------------------------------------------------
@@ -933,13 +939,14 @@ hid_t DataType::p_opentype(const H5Location& loc, const char *dtype_name) const
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::p_setId(const hid_t new_id)
+void
+DataType::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw DataTypeIException(inMemFunc("p_setId"), close_error.getDetailMsg());
}
// reset object's id to the given id
@@ -954,21 +961,19 @@ void DataType::p_setId(const hid_t new_id)
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
-void DataType::close()
+void
+DataType::close()
{
- if (p_valid_id(id))
- {
+ if (p_valid_id(id)) {
herr_t ret_value = H5Tclose(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("close"), "H5Tclose failed");
}
// Reset the id
id = H5I_INVALID_HID;
// Free and reset buffer of encoded object description if it's been used
- if (encoded_buf != NULL)
- {
+ if (encoded_buf != NULL) {
HDfree(encoded_buf);
buf_size = 0;
}
@@ -995,13 +1000,12 @@ void DataType::close()
//--------------------------------------------------------------------------
DataType::~DataType()
{
- try
- {
+ try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
cerr << inMemFunc("~DataType - ") << close_error.getDetailMsg() << endl;
}
}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h
index e4d9e4b..32badfe 100644
--- a/c++/src/H5DataType.h
+++ b/c++/src/H5DataType.h
@@ -26,152 +26,159 @@ namespace H5 {
*/
// Inheritance: DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP DataType : public H5Object {
- public:
- // Creates a datatype given its class and size
- DataType(const H5T_class_t type_class, size_t size);
+ public:
+ // Creates a datatype given its class and size
+ DataType(const H5T_class_t type_class, size_t size);
- // Copy constructor - same as the original DataType.
- DataType(const DataType& original);
+ // Copy constructor - same as the original DataType.
+ DataType(const DataType &original);
- // Creates a copy of a predefined type
- DataType(const PredType& pred_type);
+ // Creates a copy of a predefined type
+ DataType(const PredType &pred_type);
- // Constructors to open a generic named datatype at a given location.
- DataType(const H5Location& loc, const char* name);
- DataType(const H5Location& loc, const H5std_string& name);
+ // Constructors to open a generic named datatype at a given location.
+ DataType(const H5Location &loc, const char *name);
+ DataType(const H5Location &loc, const H5std_string &name);
- // Creates a datatype by way of dereference.
- DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
-// DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
+ // Creates a datatype by way of dereference.
+ DataType(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT,
+ const PropList &plist = PropList::DEFAULT);
+ // DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const
+ // PropList& plist = PropList::DEFAULT);
- // Closes this datatype.
- virtual void close();
+ // Closes this datatype.
+ virtual void close();
- // Copies an existing datatype to this datatype object.
- void copy(const DataType& like_type);
+ // Copies an existing datatype to this datatype object.
+ void copy(const DataType &like_type);
- // Copies the datatype of dset to this datatype object.
- void copy(const DataSet& dset);
+ // Copies the datatype of dset to this datatype object.
+ void copy(const DataSet &dset);
- // Returns a DataType instance by decoding the binary object
- // description of this datatype.
- virtual DataType* decode() const;
+ // Returns a DataType instance by decoding the binary object
+ // description of this datatype.
+ virtual DataType *decode() const;
- // Creates a binary object description of this datatype.
- void encode();
+ // Creates a binary object description of this datatype.
+ void encode();
- // Returns the datatype class identifier.
- H5T_class_t getClass() const;
+ // Returns the datatype class identifier.
+ H5T_class_t getClass() const;
- // Commits a transient datatype to a file; this datatype becomes
- // a named datatype which can be accessed from the location.
- void commit(const H5Location& loc, const char* name);
- void commit(const H5Location& loc, const H5std_string& name);
+ // Commits a transient datatype to a file; this datatype becomes
+ // a named datatype which can be accessed from the location.
+ void commit(const H5Location &loc, const char *name);
+ void commit(const H5Location &loc, const H5std_string &name);
- // These two overloaded functions are kept for backward compatibility
- // only; they missed the const - removed from 1.8.18 and 1.10.1
- //void commit(H5Location& loc, const char* name);
- //void commit(H5Location& loc, const H5std_string& name);
+ // These two overloaded functions are kept for backward compatibility
+ // only; they missed the const - removed from 1.8.18 and 1.10.1
+ // void commit(H5Location& loc, const char* name);
+ // void commit(H5Location& loc, const H5std_string& name);
- // Determines whether this datatype is a named datatype or
- // a transient datatype.
- bool committed() const;
+ // Determines whether this datatype is a named datatype or
+ // a transient datatype.
+ bool committed() const;
- // Finds a conversion function that can handle the conversion
- // this datatype to the given datatype, dest.
- H5T_conv_t find(const DataType& dest, H5T_cdata_t **pcdata) const;
+ // Finds a conversion function that can handle the conversion
+ // this datatype to the given datatype, dest.
+ H5T_conv_t find(const DataType &dest, H5T_cdata_t **pcdata) const;
- // Converts data from between specified datatypes.
- void convert(const DataType& dest, size_t nelmts, void *buf, void *background, const PropList& plist=PropList::DEFAULT) const;
+ // Converts data from between specified datatypes.
+ void convert(const DataType &dest, size_t nelmts, void *buf, void *background,
+ const PropList &plist = PropList::DEFAULT) const;
- // Assignment operator
- DataType& operator=(const DataType& rhs);
+ // Assignment operator
+ DataType &operator=(const DataType &rhs);
- // Determines whether two datatypes are the same.
- bool operator==(const DataType& compared_type) const;
+ // Determines whether two datatypes are the same.
+ bool operator==(const DataType &compared_type) const;
- // Determines whether two datatypes are not the same.
- bool operator!=(const DataType& compared_type) const;
+ // Determines whether two datatypes are not the same.
+ bool operator!=(const DataType &compared_type) const;
- // Locks a datatype.
- void lock() const;
+ // Locks a datatype.
+ void lock() const;
- // Returns the size of a datatype.
- size_t getSize() const;
+ // Returns the size of a datatype.
+ size_t getSize() const;
- // Returns the base datatype from which a datatype is derived.
- // Note: not quite right for specific types yet???
- DataType getSuper() const;
+ // Returns the base datatype from which a datatype is derived.
+ // Note: not quite right for specific types yet???
+ DataType getSuper() const;
- // Registers a conversion function.
- void registerFunc(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const;
- void registerFunc(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func) const;
+ // Registers a conversion function.
+ void registerFunc(H5T_pers_t pers, const char *name, const DataType &dest, H5T_conv_t func) const;
+ void registerFunc(H5T_pers_t pers, const H5std_string &name, const DataType &dest, H5T_conv_t func) const;
- // Removes a conversion function from all conversion paths.
- void unregister(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const;
- void unregister(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func) const;
+ // Removes a conversion function from all conversion paths.
+ void unregister(H5T_pers_t pers, const char *name, const DataType &dest, H5T_conv_t func) const;
+ void unregister(H5T_pers_t pers, const H5std_string &name, const DataType &dest, H5T_conv_t func) const;
- // Tags an opaque datatype.
- void setTag(const char* tag) const;
- void setTag(const H5std_string& tag) const;
+ // Tags an opaque datatype.
+ void setTag(const char *tag) const;
+ void setTag(const H5std_string &tag) const;
- // Gets the tag associated with an opaque datatype.
- H5std_string getTag() const;
+ // Gets the tag associated with an opaque datatype.
+ H5std_string getTag() const;
- // Checks whether this datatype contains (or is) a certain type class.
- bool detectClass(H5T_class_t cls) const;
- static bool detectClass(const PredType& pred_type, H5T_class_t cls);
+ // Checks whether this datatype contains (or is) a certain type class.
+ bool detectClass(H5T_class_t cls) const;
+ static bool detectClass(const PredType &pred_type, H5T_class_t cls);
- // Checks whether this datatype is a variable-length string.
- bool isVariableStr() const;
+ // Checks whether this datatype is a variable-length string.
+ bool isVariableStr() const;
- // Returns a copy of the creation property list of a datatype.
- PropList getCreatePlist() const;
+ // Returns a copy of the creation property list of a datatype.
+ PropList getCreatePlist() const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DataType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("DataType");
+ }
- // Creates a copy of an existing DataType using its id
- DataType(const hid_t type_id);
+ // Creates a copy of an existing DataType using its id
+ DataType(const hid_t type_id);
- // Default constructor
- DataType();
+ // Default constructor
+ DataType();
- // Determines whether this datatype has a binary object description.
- bool hasBinaryDesc() const;
+ // Determines whether this datatype has a binary object description.
+ bool hasBinaryDesc() const;
- // Gets the datatype id.
- virtual hid_t getId() const;
+ // Gets the datatype id.
+ virtual hid_t getId() const;
- // Destructor: properly terminates access to this datatype.
- virtual ~DataType();
+ // Destructor: properly terminates access to this datatype.
+ virtual ~DataType();
- protected:
+ protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- hid_t id; // HDF5 datatype id
+ hid_t id; // HDF5 datatype id
- // Returns an id of a type by decoding the binary object
- // description of this datatype.
- hid_t p_decode() const;
+ // Returns an id of a type by decoding the binary object
+ // description of this datatype.
+ hid_t p_decode() const;
- // Sets the datatype id.
- virtual void p_setId(const hid_t new_id);
+ // Sets the datatype id.
+ virtual void p_setId(const hid_t new_id);
- // Opens a datatype and returns the id.
- hid_t p_opentype(const H5Location& loc, const char* dtype_name) const;
+ // Opens a datatype and returns the id.
+ hid_t p_opentype(const H5Location &loc, const char *dtype_name) const;
#endif // DOXYGEN_SHOULD_SKIP_THIS
- private:
- // Buffer for binary object description of this datatype, allocated
- // in DataType::encode and used in DataType::decode
- unsigned char *encoded_buf;
- size_t buf_size;
+ private:
+ // Buffer for binary object description of this datatype, allocated
+ // in DataType::encode and used in DataType::decode
+ unsigned char *encoded_buf;
+ size_t buf_size;
- // Friend function to set DataType id. For library use only.
- friend void f_DataType_setId(DataType* dtype, hid_t new_id);
+ // Friend function to set DataType id. For library use only.
+ friend void f_DataType_setId(DataType *dtype, hid_t new_id);
- void p_commit(hid_t loc_id, const char* name);
+ void p_commit(hid_t loc_id, const char *name);
}; // end of DataType
} // namespace H5
diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp
index 79ff100..7163434 100644
--- a/c++/src/H5DcreatProp.cpp
+++ b/c++/src/H5DcreatProp.cpp
@@ -35,7 +35,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-DSetCreatPropList* DSetCreatPropList::DEFAULT_ = 0;
+DSetCreatPropList *DSetCreatPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::getConstant
@@ -49,13 +49,13 @@ DSetCreatPropList* DSetCreatPropList::DEFAULT_ = 0;
// not happen.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-DSetCreatPropList* DSetCreatPropList::getConstant()
+DSetCreatPropList *
+DSetCreatPropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -64,8 +64,9 @@ DSetCreatPropList* DSetCreatPropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new DSetCreatPropList(H5P_DATASET_CREATE);
else
- throw PropListIException("DSetCreatPropList::getConstant", "DSetCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException("DSetCreatPropList::getConstant",
+ "DSetCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -74,7 +75,8 @@ DSetCreatPropList* DSetCreatPropList::getConstant()
// points to.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void DSetCreatPropList::deleteConstants()
+void
+DSetCreatPropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -83,7 +85,7 @@ void DSetCreatPropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose Constant for dataset creation default property
//--------------------------------------------------------------------------
-const DSetCreatPropList& DSetCreatPropList::DEFAULT = *getConstant();
+const DSetCreatPropList &DSetCreatPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -100,7 +102,7 @@ DSetCreatPropList::DSetCreatPropList() : ObjCreatPropList(H5P_DATASET_CREATE) {}
/// DSetCreatPropList object
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DSetCreatPropList::DSetCreatPropList(const DSetCreatPropList& orig) : ObjCreatPropList(orig) {}
+DSetCreatPropList::DSetCreatPropList(const DSetCreatPropList &orig) : ObjCreatPropList(orig) {}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList overloaded constructor
@@ -125,11 +127,11 @@ DSetCreatPropList::DSetCreatPropList(const hid_t plist_id) : ObjCreatPropList(pl
/// changed to \c H5D_CHUNKED, if it is not so already.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setChunk(int ndims, const hsize_t* dim) const
+void
+DSetCreatPropList::setChunk(int ndims, const hsize_t *dim) const
{
herr_t ret_value = H5Pset_chunk(id, ndims, dim);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("DSetCreatPropList::setChunk", "H5Pset_chunk failed");
}
}
@@ -143,15 +145,14 @@ void DSetCreatPropList::setChunk(int ndims, const hsize_t* dim) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int DSetCreatPropList::getChunk(int max_ndims, hsize_t* dim) const
+int
+DSetCreatPropList::getChunk(int max_ndims, hsize_t *dim) const
{
int chunk_size = H5Pget_chunk(id, max_ndims, dim);
- if (chunk_size < 0)
- {
- throw PropListIException("DSetCreatPropList::getChunk",
- "H5Pget_chunk returns negative chunk size");
+ if (chunk_size < 0) {
+ throw PropListIException("DSetCreatPropList::getChunk", "H5Pget_chunk returns negative chunk size");
}
- return(chunk_size);
+ return (chunk_size);
}
//--------------------------------------------------------------------------
@@ -164,13 +165,12 @@ int DSetCreatPropList::getChunk(int max_ndims, hsize_t* dim) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setLayout(H5D_layout_t layout) const
+void
+DSetCreatPropList::setLayout(H5D_layout_t layout) const
{
herr_t ret_value = H5Pset_layout(id, layout);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setLayout",
- "H5Pset_layout failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setLayout", "H5Pset_layout failed");
}
}
@@ -190,15 +190,14 @@ void DSetCreatPropList::setLayout(H5D_layout_t layout) const
///\par Description
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5D_layout_t DSetCreatPropList::getLayout() const
+H5D_layout_t
+DSetCreatPropList::getLayout() const
{
H5D_layout_t layout = H5Pget_layout(id);
- if (layout == H5D_LAYOUT_ERROR)
- {
- throw PropListIException("DSetCreatPropList::getLayout",
- "H5Pget_layout returns H5D_LAYOUT_ERROR");
+ if (layout == H5D_LAYOUT_ERROR) {
+ throw PropListIException("DSetCreatPropList::getLayout", "H5Pget_layout returns H5D_LAYOUT_ERROR");
}
- return(layout);
+ return (layout);
}
//--------------------------------------------------------------------------
@@ -213,13 +212,12 @@ H5D_layout_t DSetCreatPropList::getLayout() const
/// less compression.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setDeflate(int level) const
+void
+DSetCreatPropList::setDeflate(int level) const
{
herr_t ret_value = H5Pset_deflate(id, level);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setDeflate",
- "H5Pset_deflate failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setDeflate", "H5Pset_deflate failed");
}
}
@@ -239,13 +237,12 @@ void DSetCreatPropList::setDeflate(int level) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - Jan, 2007
//--------------------------------------------------------------------------
-void DSetCreatPropList::setSzip(unsigned int options_mask, unsigned int pixels_per_block) const
+void
+DSetCreatPropList::setSzip(unsigned int options_mask, unsigned int pixels_per_block) const
{
herr_t ret_value = H5Pset_szip(id, options_mask, pixels_per_block);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setSzip",
- "H5Pset_szip failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setSzip", "H5Pset_szip failed");
}
}
@@ -261,13 +258,12 @@ void DSetCreatPropList::setSzip(unsigned int options_mask, unsigned int pixels_p
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - Apr, 2016
//--------------------------------------------------------------------------
-void DSetCreatPropList::setNbit() const
+void
+DSetCreatPropList::setNbit() const
{
herr_t ret_value = H5Pset_nbit(id);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setNbit",
- "H5Pset_nbit failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setNbit", "H5Pset_nbit failed");
}
}
@@ -288,13 +284,12 @@ void DSetCreatPropList::setNbit() const
/// H5Pset_fill_value API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setFillValue(const DataType& fvalue_type, const void* value) const
+void
+DSetCreatPropList::setFillValue(const DataType &fvalue_type, const void *value) const
{
herr_t ret_value = H5Pset_fill_value(id, fvalue_type.getId(), value);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setFillValue",
- "H5Pset_fill_value failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setFillValue", "H5Pset_fill_value failed");
}
}
@@ -311,13 +306,12 @@ void DSetCreatPropList::setFillValue(const DataType& fvalue_type, const void* va
/// specified by \a fvalue_type.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::getFillValue(const DataType& fvalue_type, void* value) const
+void
+DSetCreatPropList::getFillValue(const DataType &fvalue_type, void *value) const
{
herr_t ret_value = H5Pget_fill_value(id, fvalue_type.getId(), value);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::getFillValue",
- "H5Pget_fill_value failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::getFillValue", "H5Pget_fill_value failed");
}
}
@@ -331,14 +325,14 @@ void DSetCreatPropList::getFillValue(const DataType& fvalue_type, void* value) c
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5D_fill_value_t DSetCreatPropList::isFillValueDefined() const
+H5D_fill_value_t
+DSetCreatPropList::isFillValueDefined() const
{
H5D_fill_value_t status;
- herr_t ret_value = H5Pfill_value_defined(id, &status);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pfill_value_defined(id, &status);
+ if (ret_value < 0) {
throw PropListIException("DSetCreatPropList::isFillValueDefined",
- "H5Pfill_value_defined returned H5D_FILL_VALUE_ERROR (-1)");
+ "H5Pfill_value_defined returned H5D_FILL_VALUE_ERROR (-1)");
}
else
return (status);
@@ -364,14 +358,13 @@ H5D_fill_value_t DSetCreatPropList::isFillValueDefined() const
/// and the filter fails then the entire I/O operation fails.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setFilter(H5Z_filter_t filter_id, unsigned int flags,
- size_t cd_nelmts, const unsigned int cd_values[]) const
+void
+DSetCreatPropList::setFilter(H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts,
+ const unsigned int cd_values[]) const
{
herr_t ret_value = H5Pset_filter(id, filter_id, flags, cd_nelmts, cd_values);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setFilter",
- "H5Pset_filter failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setFilter", "H5Pset_filter failed");
}
}
@@ -385,13 +378,12 @@ void DSetCreatPropList::setFilter(H5Z_filter_t filter_id, unsigned int flags,
/// deletes all filters if \a filter_id is \c H5Z_FILTER_NONE.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::removeFilter(H5Z_filter_t filter_id) const
+void
+DSetCreatPropList::removeFilter(H5Z_filter_t filter_id) const
{
herr_t ret_value = H5Premove_filter(id, filter_id);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::removeFilter",
- "H5Premove_filter failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::removeFilter", "H5Premove_filter failed");
}
}
@@ -402,16 +394,16 @@ void DSetCreatPropList::removeFilter(H5Z_filter_t filter_id) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int DSetCreatPropList::getNfilters() const
+int
+DSetCreatPropList::getNfilters() const
{
int num_filters = H5Pget_nfilters(id);
- if (num_filters < 0)
- {
+ if (num_filters < 0) {
throw PropListIException("DSetCreatPropList::getNfilters",
- "H5Pget_nfilters returned negative number of filters");
+ "H5Pget_nfilters returned negative number of filters");
}
else
- return(num_filters);
+ return (num_filters);
}
//--------------------------------------------------------------------------
@@ -434,18 +426,18 @@ int DSetCreatPropList::getNfilters() const
// of unsigned int, but for backward compatibility, it cannot be
// changed. -BMR (2014/04/15)
//--------------------------------------------------------------------------
-H5Z_filter_t DSetCreatPropList::getFilter(int filter_number,
- unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values,
- size_t namelen, char name[], unsigned int& filter_config) const
+H5Z_filter_t
+DSetCreatPropList::getFilter(int filter_number, unsigned int &flags, size_t &cd_nelmts,
+ unsigned int *cd_values, size_t namelen, char name[],
+ unsigned int &filter_config) const
{
H5Z_filter_t filter_id;
- filter_id = H5Pget_filter2(id, filter_number, &flags, &cd_nelmts,
- cd_values, namelen, name, &filter_config);
+ filter_id =
+ H5Pget_filter2(id, filter_number, &flags, &cd_nelmts, cd_values, namelen, name, &filter_config);
if (filter_id == H5Z_FILTER_ERROR)
- throw PropListIException("DSetCreatPropList::getFilter",
- "H5Pget_filter2 returned H5Z_FILTER_ERROR");
+ throw PropListIException("DSetCreatPropList::getFilter", "H5Pget_filter2 returned H5Z_FILTER_ERROR");
else
- return(filter_id);
+ return (filter_id);
}
//--------------------------------------------------------------------------
@@ -463,15 +455,15 @@ H5Z_filter_t DSetCreatPropList::getFilter(int filter_number,
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::getFilterById(H5Z_filter_t filter_id,
- unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values,
- size_t namelen, char name[], unsigned int &filter_config) const
+void
+DSetCreatPropList::getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts,
+ unsigned int *cd_values, size_t namelen, char name[],
+ unsigned int &filter_config) const
{
- herr_t ret_value = H5Pget_filter_by_id2(id, filter_id, &flags, &cd_nelmts,
- cd_values, namelen, name, &filter_config);
+ herr_t ret_value =
+ H5Pget_filter_by_id2(id, filter_id, &flags, &cd_nelmts, cd_values, namelen, name, &filter_config);
if (ret_value < 0)
- throw PropListIException("DSetCreatPropList::getFilterById",
- "H5Pget_filter_by_id2 failed");
+ throw PropListIException("DSetCreatPropList::getFilterById", "H5Pget_filter_by_id2 failed");
}
//--------------------------------------------------------------------------
@@ -495,14 +487,13 @@ void DSetCreatPropList::getFilterById(H5Z_filter_t filter_id,
/// and the filter fails then the entire I/O operation fails.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::modifyFilter(H5Z_filter_t filter_id, unsigned int
- flags, size_t cd_nelmts, const unsigned int cd_values[]) const
+void
+DSetCreatPropList::modifyFilter(H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts,
+ const unsigned int cd_values[]) const
{
herr_t ret_value = H5Pmodify_filter(id, filter_id, flags, cd_nelmts, cd_values);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::modifyFilter",
- "H5Pmodify_filter failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::modifyFilter", "H5Pmodify_filter failed");
}
}
@@ -515,7 +506,8 @@ void DSetCreatPropList::modifyFilter(H5Z_filter_t filter_id, unsigned int
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool DSetCreatPropList::allFiltersAvail() const
+bool
+DSetCreatPropList::allFiltersAvail() const
{
htri_t ret_value = H5Pall_filters_avail(id);
if (ret_value > 0)
@@ -524,7 +516,8 @@ bool DSetCreatPropList::allFiltersAvail() const
return false;
else // Raise exception when H5Pall_filters_avail returns a negative value
{
- throw PropListIException("DSetCreatPropList::allFiltersAvail", "H5Pall_filters_avail returned negative value");
+ throw PropListIException("DSetCreatPropList::allFiltersAvail",
+ "H5Pall_filters_avail returned negative value");
}
}
@@ -538,13 +531,12 @@ bool DSetCreatPropList::allFiltersAvail() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setShuffle() const
+void
+DSetCreatPropList::setShuffle() const
{
herr_t ret_value = H5Pset_shuffle(id);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setShuffle",
- "H5Pset_shuffle failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setShuffle", "H5Pset_shuffle failed");
}
}
@@ -562,14 +554,13 @@ void DSetCreatPropList::setShuffle() const
/// \li \c H5D_ALLOC_TIME_INCR
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5D_alloc_time_t DSetCreatPropList::getAllocTime() const
+H5D_alloc_time_t
+DSetCreatPropList::getAllocTime() const
{
H5D_alloc_time_t alloc_time;
- herr_t ret_value = H5Pget_alloc_time(id, &alloc_time);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::getAllocTime",
- "H5Pget_alloc_time failed");
+ herr_t ret_value = H5Pget_alloc_time(id, &alloc_time);
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::getAllocTime", "H5Pget_alloc_time failed");
}
else
return (alloc_time);
@@ -586,14 +577,13 @@ H5D_alloc_time_t DSetCreatPropList::getAllocTime() const
/// \li \c H5D_FILL_TIME_ALLOC.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5D_fill_time_t DSetCreatPropList::getFillTime() const
+H5D_fill_time_t
+DSetCreatPropList::getFillTime() const
{
H5D_fill_time_t fill_time;
- herr_t ret_value = H5Pget_fill_time(id, &fill_time);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::getFillTime",
- "H5Pget_fill_time failed");
+ herr_t ret_value = H5Pget_fill_time(id, &fill_time);
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::getFillTime", "H5Pget_fill_time failed");
}
else
return (fill_time);
@@ -612,13 +602,12 @@ H5D_fill_time_t DSetCreatPropList::getFillTime() const
/// \li \c H5D_ALLOC_TIME_INCR
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time) const
+void
+DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time) const
{
herr_t ret_value = H5Pset_alloc_time(id, alloc_time);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setAllocTime",
- "H5Pset_alloc_time failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setAllocTime", "H5Pset_alloc_time failed");
}
}
@@ -633,13 +622,12 @@ void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time) const
/// \li \c H5D_FILL_TIME_ALLOC.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time) const
+void
+DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time) const
{
herr_t ret_value = H5Pset_fill_time(id, fill_time);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setFillTime",
- "H5Pset_fill_time failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setFillTime", "H5Pset_fill_time failed");
}
}
@@ -650,13 +638,12 @@ void DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setFletcher32() const
+void
+DSetCreatPropList::setFletcher32() const
{
herr_t ret_value = H5Pset_fletcher32(id);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setFletcher32",
- "H5Pset_fletcher32 failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setFletcher32", "H5Pset_fletcher32 failed");
}
}
@@ -676,13 +663,12 @@ void DSetCreatPropList::setFletcher32() const
/// the extending).
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setExternal(const char* name, off_t offset, hsize_t size) const
+void
+DSetCreatPropList::setExternal(const char *name, off_t offset, hsize_t size) const
{
herr_t ret_value = H5Pset_external(id, name, offset, size);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setExternal",
- "H5Pset_external failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setExternal", "H5Pset_external failed");
}
}
@@ -693,16 +679,16 @@ void DSetCreatPropList::setExternal(const char* name, off_t offset, hsize_t size
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int DSetCreatPropList::getExternalCount() const
+int
+DSetCreatPropList::getExternalCount() const
{
int num_ext_files = H5Pget_external_count(id);
- if (num_ext_files < 0)
- {
+ if (num_ext_files < 0) {
throw PropListIException("DSetCreatPropList::getExternalCount",
- "H5Pget_external_count returns negative number of external files");
+ "H5Pget_external_count returns negative number of external files");
}
else
- return(num_ext_files);
+ return (num_ext_files);
}
//--------------------------------------------------------------------------
@@ -727,13 +713,12 @@ int DSetCreatPropList::getExternalCount() const
/// will not be returned.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size) const
+void
+DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char *name, off_t &offset, hsize_t &size) const
{
herr_t ret_value = H5Pget_external(id, idx, name_size, name, &offset, &size);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::getExternal",
- "H5Pget_external failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::getExternal", "H5Pget_external failed");
}
}
@@ -755,13 +740,13 @@ void DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char* name,
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - Mar, 2017
//--------------------------------------------------------------------------
-void DSetCreatPropList::setVirtual(const DataSpace& vspace, const char *src_fname, const char *src_dsname, const DataSpace& sspace) const
+void
+DSetCreatPropList::setVirtual(const DataSpace &vspace, const char *src_fname, const char *src_dsname,
+ const DataSpace &sspace) const
{
herr_t ret_value = H5Pset_virtual(id, vspace.getId(), src_fname, src_dsname, sspace.getId());
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setVirtual",
- "H5Pset_virtual failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setVirtual", "H5Pset_virtual failed");
}
}
@@ -783,7 +768,9 @@ void DSetCreatPropList::setVirtual(const DataSpace& vspace, const char *src_fnam
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - Mar, 2017
//--------------------------------------------------------------------------
-void DSetCreatPropList::setVirtual(const DataSpace& vspace, const H5std_string src_fname, const H5std_string src_dsname, const DataSpace& sspace) const
+void
+DSetCreatPropList::setVirtual(const DataSpace &vspace, const H5std_string src_fname,
+ const H5std_string src_dsname, const DataSpace &sspace) const
{
setVirtual(vspace, src_fname.c_str(), src_dsname.c_str(), sspace);
}
@@ -795,4 +782,4 @@ void DSetCreatPropList::setVirtual(const DataSpace& vspace, const H5std_string s
//--------------------------------------------------------------------------
DSetCreatPropList::~DSetCreatPropList() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h
index 9f54e8d..e73ec32 100644
--- a/c++/src/H5DcreatProp.h
+++ b/c++/src/H5DcreatProp.h
@@ -27,121 +27,132 @@ class DataSpace;
*/
// Inheritance: ObjCreatPropList -> PropList -> IdComponent
class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList {
- public:
- ///\brief Default dataset creation property list.
- static const DSetCreatPropList& DEFAULT;
+ public:
+ ///\brief Default dataset creation property list.
+ static const DSetCreatPropList &DEFAULT;
- // Creates a dataset creation property list.
- DSetCreatPropList();
+ // Creates a dataset creation property list.
+ DSetCreatPropList();
- // Queries whether all the filters set in this property list are
- // available currently.
- bool allFiltersAvail() const;
+ // Queries whether all the filters set in this property list are
+ // available currently.
+ bool allFiltersAvail() const;
- // Get space allocation time for this property.
- H5D_alloc_time_t getAllocTime() const;
+ // Get space allocation time for this property.
+ H5D_alloc_time_t getAllocTime() const;
- // Set space allocation time for dataset during creation.
- void setAllocTime(H5D_alloc_time_t alloc_time) const;
+ // Set space allocation time for dataset during creation.
+ void setAllocTime(H5D_alloc_time_t alloc_time) const;
- // Retrieves the size of the chunks used to store a chunked layout dataset.
- int getChunk(int max_ndims, hsize_t* dim) const;
+ // Retrieves the size of the chunks used to store a chunked layout dataset.
+ int getChunk(int max_ndims, hsize_t *dim) const;
- // Sets the size of the chunks used to store a chunked layout dataset.
- void setChunk(int ndims, const hsize_t* dim) const;
+ // Sets the size of the chunks used to store a chunked layout dataset.
+ void setChunk(int ndims, const hsize_t *dim) const;
- // Returns information about an external file.
- void getExternal(unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size) const;
+ // Returns information about an external file.
+ void getExternal(unsigned idx, size_t name_size, char *name, off_t &offset, hsize_t &size) const;
- // Returns the number of external files for a dataset.
- int getExternalCount() const;
+ // Returns the number of external files for a dataset.
+ int getExternalCount() const;
- // Gets fill value writing time.
- H5D_fill_time_t getFillTime() const;
+ // Gets fill value writing time.
+ H5D_fill_time_t getFillTime() const;
- // Sets fill value writing time for dataset.
- void setFillTime(H5D_fill_time_t fill_time) const;
+ // Sets fill value writing time for dataset.
+ void setFillTime(H5D_fill_time_t fill_time) const;
- // Retrieves a dataset fill value.
- void getFillValue(const DataType& fvalue_type, void* value) const;
+ // Retrieves a dataset fill value.
+ void getFillValue(const DataType &fvalue_type, void *value) const;
- // Sets a dataset fill value.
- void setFillValue(const DataType& fvalue_type, const void* value) const;
+ // Sets a dataset fill value.
+ void setFillValue(const DataType &fvalue_type, const void *value) const;
- // Returns information about a filter in a pipeline.
- H5Z_filter_t getFilter(int filter_number, unsigned int& flags, size_t& cd_nelmts, unsigned int* cd_values, size_t namelen, char name[], unsigned int &filter_config) const;
+ // Returns information about a filter in a pipeline.
+ H5Z_filter_t getFilter(int filter_number, unsigned int &flags, size_t &cd_nelmts, unsigned int *cd_values,
+ size_t namelen, char name[], unsigned int &filter_config) const;
- // Returns information about a filter in a pipeline given the filter id.
- void getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values, size_t namelen, char name[], unsigned int &filter_config) const;
+ // Returns information about a filter in a pipeline given the filter id.
+ void getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts,
+ unsigned int *cd_values, size_t namelen, char name[],
+ unsigned int &filter_config) const;
- // Gets the layout of the raw data storage of the data that uses this
- // property list.
- H5D_layout_t getLayout() const;
+ // Gets the layout of the raw data storage of the data that uses this
+ // property list.
+ H5D_layout_t getLayout() const;
- // Sets the type of storage used to store the raw data for the
- // dataset that uses this property list.
- void setLayout(H5D_layout_t layout) const;
+ // Sets the type of storage used to store the raw data for the
+ // dataset that uses this property list.
+ void setLayout(H5D_layout_t layout) const;
- // Returns the number of filters in the pipeline.
- int getNfilters() const;
+ // Returns the number of filters in the pipeline.
+ int getNfilters() const;
- // Checks if fill value has been defined for this property.
- H5D_fill_value_t isFillValueDefined() const;
+ // Checks if fill value has been defined for this property.
+ H5D_fill_value_t isFillValueDefined() const;
- // Modifies the specified filter.
- void modifyFilter(H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[]) const;
+ // Modifies the specified filter.
+ void modifyFilter(H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts,
+ const unsigned int cd_values[]) const;
- // Remove one or all filters from the filter pipeline.
- void removeFilter(H5Z_filter_t filter_id) const;
+ // Remove one or all filters from the filter pipeline.
+ void removeFilter(H5Z_filter_t filter_id) const;
- // Sets compression method and compression level.
- void setDeflate(int level) const;
+ // Sets compression method and compression level.
+ void setDeflate(int level) const;
- // Adds an external file to the list of external files.
- void setExternal(const char* name, off_t offset, hsize_t size) const;
+ // Adds an external file to the list of external files.
+ void setExternal(const char *name, off_t offset, hsize_t size) const;
- // Adds a filter to the filter pipeline.
- void setFilter(H5Z_filter_t filter, unsigned int flags = 0, size_t cd_nelmts = 0, const unsigned int cd_values[] = NULL) const;
+ // Adds a filter to the filter pipeline.
+ void setFilter(H5Z_filter_t filter, unsigned int flags = 0, size_t cd_nelmts = 0,
+ const unsigned int cd_values[] = NULL) const;
- // Sets Fletcher32 checksum of EDC for this property list.
- void setFletcher32() const;
+ // Sets Fletcher32 checksum of EDC for this property list.
+ void setFletcher32() const;
- // Sets method of the shuffle filter.
- void setShuffle() const;
+ // Sets method of the shuffle filter.
+ void setShuffle() const;
- // Sets SZIP compression method.
- void setSzip(unsigned int options_mask, unsigned int pixels_per_block) const;
+ // Sets SZIP compression method.
+ void setSzip(unsigned int options_mask, unsigned int pixels_per_block) const;
- // Sets N-bit compression method.
- void setNbit() const;
+ // Sets N-bit compression method.
+ void setNbit() const;
- // Maps elements of a virtual dataset to elements of the source dataset.
- void setVirtual(const DataSpace& vspace, const char *src_fname, const char *src_dsname, const DataSpace& sspace) const;
- void setVirtual(const DataSpace& vspace, const H5std_string src_fname, const H5std_string src_dsname, const DataSpace& sspace) const;
+ // Maps elements of a virtual dataset to elements of the source dataset.
+ void setVirtual(const DataSpace &vspace, const char *src_fname, const char *src_dsname,
+ const DataSpace &sspace) const;
+ void setVirtual(const DataSpace &vspace, const H5std_string src_fname, const H5std_string src_dsname,
+ const DataSpace &sspace) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DSetCreatPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("DSetCreatPropList");
+ }
- // Copy constructor - same as the original DSetCreatPropList.
- DSetCreatPropList(const DSetCreatPropList& orig);
+ // Copy constructor - same as the original DSetCreatPropList.
+ DSetCreatPropList(const DSetCreatPropList &orig);
- // Creates a copy of an existing dataset creation property list
- // using the property list id.
- DSetCreatPropList(const hid_t plist_id);
+ // Creates a copy of an existing dataset creation property list
+ // using the property list id.
+ DSetCreatPropList(const hid_t plist_id);
- // Noop destructor.
- virtual ~DSetCreatPropList();
+ // Noop destructor.
+ virtual ~DSetCreatPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
- private:
- static DSetCreatPropList* DEFAULT_;
+ private:
+ static DSetCreatPropList *DEFAULT_;
- // Creates the global constant, should only be used by the library
- static DSetCreatPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static DSetCreatPropList *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp
index 9cc6961..00dba7e 100644
--- a/c++/src/H5DxferProp.cpp
+++ b/c++/src/H5DxferProp.cpp
@@ -13,7 +13,7 @@
#include <string>
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -28,7 +28,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-DSetMemXferPropList* DSetMemXferPropList::DEFAULT_ = 0;
+DSetMemXferPropList *DSetMemXferPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::getConstant
@@ -42,13 +42,13 @@ DSetMemXferPropList* DSetMemXferPropList::DEFAULT_ = 0;
// happen.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-DSetMemXferPropList* DSetMemXferPropList::getConstant()
+DSetMemXferPropList *
+DSetMemXferPropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -57,8 +57,10 @@ DSetMemXferPropList* DSetMemXferPropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new DSetMemXferPropList(H5P_DATASET_XFER);
else
- throw PropListIException("DSetMemXferPropList::getConstant", "DSetMemXferPropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException(
+ "DSetMemXferPropList::getConstant",
+ "DSetMemXferPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -67,7 +69,8 @@ DSetMemXferPropList* DSetMemXferPropList::getConstant()
// points to.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void DSetMemXferPropList::deleteConstants()
+void
+DSetMemXferPropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -76,7 +79,7 @@ void DSetMemXferPropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose Constant for default dataset memory and transfer property list.
//--------------------------------------------------------------------------
-const DSetMemXferPropList& DSetMemXferPropList::DEFAULT = *getConstant();
+const DSetMemXferPropList &DSetMemXferPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -94,7 +97,7 @@ DSetMemXferPropList::DSetMemXferPropList() : PropList(H5P_DATASET_XFER) {}
/// expression.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DSetMemXferPropList::DSetMemXferPropList(const char* exp) : PropList(H5P_DATASET_XFER)
+DSetMemXferPropList::DSetMemXferPropList(const char *exp) : PropList(H5P_DATASET_XFER)
{
setDataTransform(exp);
}
@@ -107,7 +110,7 @@ DSetMemXferPropList::DSetMemXferPropList(const char* exp) : PropList(H5P_DATASET
/// list object to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DSetMemXferPropList::DSetMemXferPropList(const DSetMemXferPropList& original) : PropList(original ) {}
+DSetMemXferPropList::DSetMemXferPropList(const DSetMemXferPropList &original) : PropList(original) {}
//--------------------------------------------------------------------------
// Function DSetMemXferPropList overloaded constructor
@@ -128,13 +131,12 @@ DSetMemXferPropList::DSetMemXferPropList(const hid_t plist_id) : PropList(plist_
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setBuffer(size_t size, void* tconv, void* bkg) const
+void
+DSetMemXferPropList::setBuffer(size_t size, void *tconv, void *bkg) const
{
herr_t ret_value = H5Pset_buffer(id, size, tconv, bkg);
- if(ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setBuffer",
- "H5Pset_buffer failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::setBuffer", "H5Pset_buffer failed");
}
}
@@ -147,15 +149,15 @@ void DSetMemXferPropList::setBuffer(size_t size, void* tconv, void* bkg) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-size_t DSetMemXferPropList::getBuffer(void** tconv, void** bkg) const
+size_t
+DSetMemXferPropList::getBuffer(void **tconv, void **bkg) const
{
size_t buffer_size = H5Pget_buffer(id, tconv, bkg);
- if(buffer_size == 0)
- {
+ if (buffer_size == 0) {
throw PropListIException("DSetMemXferPropList::getBuffer",
- "H5Pget_buffer returned 0 for buffer size - failure");
+ "H5Pget_buffer returned 0 for buffer size - failure");
}
- return(buffer_size);
+ return (buffer_size);
}
//--------------------------------------------------------------------------
@@ -165,13 +167,12 @@ size_t DSetMemXferPropList::getBuffer(void** tconv, void** bkg) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setPreserve(bool status) const
+void
+DSetMemXferPropList::setPreserve(bool status) const
{
- herr_t ret_value = H5Pset_preserve(id, (hbool_t) status);
- if(ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setPreserve",
- "H5Pset_preserve failed");
+ herr_t ret_value = H5Pset_preserve(id, (hbool_t)status);
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::setPreserve", "H5Pset_preserve failed");
}
}
@@ -182,17 +183,17 @@ void DSetMemXferPropList::setPreserve(bool status) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool DSetMemXferPropList::getPreserve() const
+bool
+DSetMemXferPropList::getPreserve() const
{
int ret_value = H5Pget_preserve(id);
- if(ret_value > 0)
+ if (ret_value > 0)
return true;
- else if(ret_value == 0)
+ else if (ret_value == 0)
return false;
- else
- {
+ else {
throw PropListIException("DSetMemXferPropList::getPreserve",
- "H5Pget_preserve returned negative value for status");
+ "H5Pget_preserve returned negative value for status");
}
}
@@ -205,13 +206,12 @@ bool DSetMemXferPropList::getPreserve() const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setBtreeRatios(double left, double middle, double right) const
+void
+DSetMemXferPropList::setBtreeRatios(double left, double middle, double right) const
{
herr_t ret_value = H5Pset_btree_ratios(id, left, middle, right);
- if(ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setBtreeRatios",
- "H5Pset_btree_ratios failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::setBtreeRatios", "H5Pset_btree_ratios failed");
}
}
@@ -224,13 +224,12 @@ void DSetMemXferPropList::setBtreeRatios(double left, double middle, double righ
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::getBtreeRatios(double& left, double& middle, double& right) const
+void
+DSetMemXferPropList::getBtreeRatios(double &left, double &middle, double &right) const
{
herr_t ret_value = H5Pget_btree_ratios(id, &left, &middle, &right);
- if(ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::getBtreeRatios",
- "H5Pget_btree_ratios failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::getBtreeRatios", "H5Pget_btree_ratios failed");
}
}
@@ -241,13 +240,12 @@ void DSetMemXferPropList::getBtreeRatios(double& left, double& middle, double& r
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setDataTransform(const char* expression) const
+void
+DSetMemXferPropList::setDataTransform(const char *expression) const
{
herr_t ret_value = H5Pset_data_transform(id, expression);
- if(ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setDataTransform",
- "H5Pset_data_transform failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::setDataTransform", "H5Pset_data_transform failed");
}
}
@@ -259,7 +257,8 @@ void DSetMemXferPropList::setDataTransform(const char* expression) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setDataTransform(const H5std_string& expression) const
+void
+DSetMemXferPropList::setDataTransform(const H5std_string &expression) const
{
setDataTransform(expression.c_str());
}
@@ -273,7 +272,8 @@ void DSetMemXferPropList::setDataTransform(const H5std_string& expression) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const
+ssize_t
+DSetMemXferPropList::getDataTransform(char *exp, size_t buf_size) const
{
// H5Pget_data_transform will get buf_size characters of the expression
// including the null terminator
@@ -281,10 +281,8 @@ ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const
exp_len = H5Pget_data_transform(id, exp, buf_size);
// H5Pget_data_transform returns a negative value, raise an exception
- if (exp_len < 0)
- {
- throw PropListIException("DSetMemXferPropList::getDataTransform",
- "H5Pget_data_transform failed");
+ if (exp_len < 0) {
+ throw PropListIException("DSetMemXferPropList::getDataTransform", "H5Pget_data_transform failed");
}
// H5Pget_data_transform will put a null terminator at the end of the
@@ -292,7 +290,7 @@ ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const
// of the buffer.
// Return the expression length, which might be different from buf_size
- return(exp_len);
+ return (exp_len);
}
//--------------------------------------------------------------------------
@@ -303,7 +301,8 @@ ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-H5std_string DSetMemXferPropList::getDataTransform() const
+H5std_string
+DSetMemXferPropList::getDataTransform() const
{
// Initialize string to "", so that if there is no expression, the returned
// string will be empty
@@ -313,29 +312,27 @@ H5std_string DSetMemXferPropList::getDataTransform() const
ssize_t exp_len = H5Pget_data_transform(id, NULL, (size_t)0);
// If H5Pget_data_transform returns a negative value, raise an exception
- if (exp_len < 0)
- {
+ if (exp_len < 0) {
throw PropListIException("DSetMemXferPropList::getDataTransform", "H5Pget_data_transform failed");
}
// If expression exists, calls C routine again to get it
- else if (exp_len > 0)
- {
+ else if (exp_len > 0) {
// Temporary buffer for char* expression
- char* exp_C = new char[exp_len+1];
- HDmemset(exp_C, 0, exp_len+1); // clear buffer
+ char *exp_C = new char[exp_len + 1];
+ HDmemset(exp_C, 0, exp_len + 1); // clear buffer
// Used overloaded function
- exp_len = getDataTransform(exp_C, exp_len+1);
+ exp_len = getDataTransform(exp_C, exp_len + 1);
// Convert the C expression to return
expression = exp_C;
// Clean up resource
- delete []exp_C;
+ delete[] exp_C;
}
// Return the string expression
- return(expression);
+ return (expression);
}
//--------------------------------------------------------------------------
@@ -347,13 +344,12 @@ H5std_string DSetMemXferPropList::getDataTransform() const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setTypeConvCB(H5T_conv_except_func_t op, void *user_data) const
+void
+DSetMemXferPropList::setTypeConvCB(H5T_conv_except_func_t op, void *user_data) const
{
herr_t ret_value = H5Pset_type_conv_cb(id, op, user_data);
- if(ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setTypeConvCB",
- "H5Pset_type_conv_cb failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::setTypeConvCB", "H5Pset_type_conv_cb failed");
}
}
@@ -365,13 +361,12 @@ void DSetMemXferPropList::setTypeConvCB(H5T_conv_except_func_t op, void *user_da
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) const
+void
+DSetMemXferPropList::getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) const
{
herr_t ret_value = H5Pget_type_conv_cb(id, op, user_data);
- if(ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::getTypeConvCB",
- "H5Pget_type_conv_cb failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::getTypeConvCB", "H5Pget_type_conv_cb failed");
}
}
@@ -385,14 +380,13 @@ void DSetMemXferPropList::getTypeConvCB(H5T_conv_except_func_t *op, void **user_
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setVlenMemManager(H5MM_allocate_t alloc_func, void* alloc_info, H5MM_free_t free_func, void* free_info) const
+void
+DSetMemXferPropList::setVlenMemManager(H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func,
+ void *free_info) const
{
- herr_t ret_value = H5Pset_vlen_mem_manager(id, alloc_func, alloc_info,
- free_func, free_info);
- if(ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setVlenMemManager",
- "H5Pset_vlen_mem_manager failed");
+ herr_t ret_value = H5Pset_vlen_mem_manager(id, alloc_func, alloc_info, free_func, free_info);
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::setVlenMemManager", "H5Pset_vlen_mem_manager failed");
}
}
@@ -404,9 +398,10 @@ void DSetMemXferPropList::setVlenMemManager(H5MM_allocate_t alloc_func, void* al
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setVlenMemManager() const
+void
+DSetMemXferPropList::setVlenMemManager() const
{
- setVlenMemManager(NULL, NULL, NULL, NULL);
+ setVlenMemManager(NULL, NULL, NULL, NULL);
}
//--------------------------------------------------------------------------
@@ -419,13 +414,13 @@ void DSetMemXferPropList::setVlenMemManager() const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::getVlenMemManager(H5MM_allocate_t& alloc_func, void** alloc_info, H5MM_free_t& free_func, void** free_info) const
+void
+DSetMemXferPropList::getVlenMemManager(H5MM_allocate_t &alloc_func, void **alloc_info, H5MM_free_t &free_func,
+ void **free_info) const
{
herr_t ret_value = H5Pget_vlen_mem_manager(id, &alloc_func, alloc_info, &free_func, free_info);
- if (ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::getVlenMemManager",
- "H5Pget_vlen_mem_manager failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::getVlenMemManager", "H5Pget_vlen_mem_manager failed");
}
}
@@ -439,13 +434,13 @@ void DSetMemXferPropList::getVlenMemManager(H5MM_allocate_t& alloc_func, void**
/// API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size) const
+void
+DSetMemXferPropList::setSmallDataBlockSize(hsize_t size) const
{
herr_t ret_value = H5Pset_small_data_block_size(id, size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("DSetMemXferPropList::setSmallDataBlockSize",
- "H5Pset_small_data_block_size failed");
+ "H5Pset_small_data_block_size failed");
}
}
@@ -456,16 +451,16 @@ void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-hsize_t DSetMemXferPropList::getSmallDataBlockSize() const
+hsize_t
+DSetMemXferPropList::getSmallDataBlockSize() const
{
hsize_t size;
- herr_t ret_value = H5Pget_small_data_block_size(id, &size);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pget_small_data_block_size(id, &size);
+ if (ret_value < 0) {
throw PropListIException("DSetMemXferPropList::getSmallDataBlockSize",
- "H5Pget_small_data_block_size failed");
+ "H5Pget_small_data_block_size failed");
}
- return(size);
+ return (size);
}
//--------------------------------------------------------------------------
@@ -478,13 +473,13 @@ hsize_t DSetMemXferPropList::getSmallDataBlockSize() const
/// API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setHyperVectorSize(size_t vector_size) const
+void
+DSetMemXferPropList::setHyperVectorSize(size_t vector_size) const
{
herr_t ret_value = H5Pset_hyper_vector_size(id, vector_size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("DSetMemXferPropList::setHyperVectorSize",
- "H5Pset_hyper_vector_size failed");
+ "H5Pset_hyper_vector_size failed");
}
}
@@ -496,16 +491,16 @@ void DSetMemXferPropList::setHyperVectorSize(size_t vector_size) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-size_t DSetMemXferPropList::getHyperVectorSize() const
+size_t
+DSetMemXferPropList::getHyperVectorSize() const
{
size_t vector_size;
herr_t ret_value = H5Pget_hyper_vector_size(id, &vector_size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("DSetMemXferPropList::getHyperVectorSize",
- "H5Pget_hyper_vector_size failed");
+ "H5Pget_hyper_vector_size failed");
}
- return(vector_size);
+ return (vector_size);
}
//--------------------------------------------------------------------------
@@ -526,13 +521,12 @@ size_t DSetMemXferPropList::getHyperVectorSize() const
/// \li \c H5Z_DISABLE_EDC
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check) const
+void
+DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check) const
{
herr_t ret_value = H5Pset_edc_check(id, check);
- if (ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setEDCCheck",
- "H5Pset_edc_check failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::setEDCCheck", "H5Pset_edc_check failed");
}
}
@@ -543,15 +537,14 @@ void DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-H5Z_EDC_t DSetMemXferPropList::getEDCCheck() const
+H5Z_EDC_t
+DSetMemXferPropList::getEDCCheck() const
{
H5Z_EDC_t check = H5Pget_edc_check(id);
- if (check < 0)
- {
- throw PropListIException("DSetMemXferPropList::getEDCCheck",
- "H5Pget_edc_check failed");
+ if (check < 0) {
+ throw PropListIException("DSetMemXferPropList::getEDCCheck", "H5Pget_edc_check failed");
}
- return(check);
+ return (check);
}
//--------------------------------------------------------------------------
@@ -561,5 +554,4 @@ H5Z_EDC_t DSetMemXferPropList::getEDCCheck() const
//--------------------------------------------------------------------------
DSetMemXferPropList::~DSetMemXferPropList() {}
-} // end namespace
-
+} // namespace H5
diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h
index e53a03b..59ece6f 100644
--- a/c++/src/H5DxferProp.h
+++ b/c++/src/H5DxferProp.h
@@ -23,105 +23,108 @@ namespace H5 {
*/
// Inheritance: PropList -> IdComponent
class H5_DLLCPP DSetMemXferPropList : public PropList {
- public:
- ///\brief Default dataset memory and transfer property list.
- static const DSetMemXferPropList& DEFAULT;
+ public:
+ ///\brief Default dataset memory and transfer property list.
+ static const DSetMemXferPropList &DEFAULT;
- // Creates a dataset memory and transfer property list.
- DSetMemXferPropList();
+ // Creates a dataset memory and transfer property list.
+ DSetMemXferPropList();
- // Creates a dataset transform property list.
- DSetMemXferPropList(const char* expression);
+ // Creates a dataset transform property list.
+ DSetMemXferPropList(const char *expression);
- // Sets type conversion and background buffers.
- void setBuffer(size_t size, void* tconv, void* bkg) const;
+ // Sets type conversion and background buffers.
+ void setBuffer(size_t size, void *tconv, void *bkg) const;
- // Reads buffer settings.
- size_t getBuffer(void** tconv, void** bkg) const;
+ // Reads buffer settings.
+ size_t getBuffer(void **tconv, void **bkg) const;
- // Sets B-tree split ratios for a dataset transfer property list.
- void setBtreeRatios(double left, double middle, double right) const;
+ // Sets B-tree split ratios for a dataset transfer property list.
+ void setBtreeRatios(double left, double middle, double right) const;
- // Gets B-tree split ratios for a dataset transfer property list.
- void getBtreeRatios(double& left, double& middle, double& right) const;
+ // Gets B-tree split ratios for a dataset transfer property list.
+ void getBtreeRatios(double &left, double &middle, double &right) const;
- // Sets data transform expression.
- void setDataTransform(const char* expression) const;
- void setDataTransform(const H5std_string& expression) const;
+ // Sets data transform expression.
+ void setDataTransform(const char *expression) const;
+ void setDataTransform(const H5std_string &expression) const;
- // Gets data transform expression.
- ssize_t getDataTransform(char* exp, size_t buf_size=0) const;
- H5std_string getDataTransform() const;
+ // Gets data transform expression.
+ ssize_t getDataTransform(char *exp, size_t buf_size = 0) const;
+ H5std_string getDataTransform() const;
- // Sets the dataset transfer property list status to TRUE or FALSE.
- void setPreserve(bool status) const;
+ // Sets the dataset transfer property list status to TRUE or FALSE.
+ void setPreserve(bool status) const;
- // Checks status of the dataset transfer property list.
- bool getPreserve() const;
+ // Checks status of the dataset transfer property list.
+ bool getPreserve() const;
- // Sets an exception handling callback for datatype conversion.
- void setTypeConvCB(H5T_conv_except_func_t op, void *user_data) const;
+ // Sets an exception handling callback for datatype conversion.
+ void setTypeConvCB(H5T_conv_except_func_t op, void *user_data) const;
- // Gets the exception handling callback for datatype conversion.
- void getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) const;
+ // Gets the exception handling callback for datatype conversion.
+ void getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) const;
- // Sets the memory manager for variable-length datatype
- // allocation in H5Dread and H5Treclaim.
- void setVlenMemManager(H5MM_allocate_t alloc, void* alloc_info,
- H5MM_free_t free, void* free_info) const;
+ // Sets the memory manager for variable-length datatype
+ // allocation in H5Dread and H5Treclaim.
+ void setVlenMemManager(H5MM_allocate_t alloc, void *alloc_info, H5MM_free_t free, void *free_info) const;
- // alloc and free are set to NULL, indicating that system
- // malloc and free are to be used.
- void setVlenMemManager() const;
+ // alloc and free are set to NULL, indicating that system
+ // malloc and free are to be used.
+ void setVlenMemManager() const;
- // Gets the memory manager for variable-length datatype
- // allocation in H5Dread and H5Treclaim.
- void getVlenMemManager(H5MM_allocate_t& alloc, void** alloc_info,
- H5MM_free_t& free, void** free_info) const;
+ // Gets the memory manager for variable-length datatype
+ // allocation in H5Dread and H5Treclaim.
+ void getVlenMemManager(H5MM_allocate_t &alloc, void **alloc_info, H5MM_free_t &free,
+ void **free_info) const;
- // Sets the size of a contiguous block reserved for small data.
- void setSmallDataBlockSize(hsize_t size) const;
+ // Sets the size of a contiguous block reserved for small data.
+ void setSmallDataBlockSize(hsize_t size) const;
- // Returns the current small data block size setting.
- hsize_t getSmallDataBlockSize() const;
+ // Returns the current small data block size setting.
+ hsize_t getSmallDataBlockSize() const;
- // Sets number of I/O vectors to be read/written in hyperslab I/O.
- void setHyperVectorSize(size_t vector_size) const;
+ // Sets number of I/O vectors to be read/written in hyperslab I/O.
+ void setHyperVectorSize(size_t vector_size) const;
- // Returns the number of I/O vectors to be read/written in
- // hyperslab I/O.
- size_t getHyperVectorSize() const;
+ // Returns the number of I/O vectors to be read/written in
+ // hyperslab I/O.
+ size_t getHyperVectorSize() const;
- // Enables or disables error-detecting for a dataset reading
- // process.
- void setEDCCheck(H5Z_EDC_t check) const;
+ // Enables or disables error-detecting for a dataset reading
+ // process.
+ void setEDCCheck(H5Z_EDC_t check) const;
- // Determines whether error-detection is enabled for dataset reads.
- H5Z_EDC_t getEDCCheck() const;
+ // Determines whether error-detection is enabled for dataset reads.
+ H5Z_EDC_t getEDCCheck() const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DSetMemXferPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("DSetMemXferPropList");
+ }
- // Copy constructor - same as the original DSetMemXferPropList.
- DSetMemXferPropList(const DSetMemXferPropList& orig);
+ // Copy constructor - same as the original DSetMemXferPropList.
+ DSetMemXferPropList(const DSetMemXferPropList &orig);
- // Creates a copy of an existing dataset memory and transfer
- // property list using the property list id.
- DSetMemXferPropList(const hid_t plist_id);
+ // Creates a copy of an existing dataset memory and transfer
+ // property list using the property list id.
+ DSetMemXferPropList(const hid_t plist_id);
- // Noop destructor
- virtual ~DSetMemXferPropList();
+ // Noop destructor
+ virtual ~DSetMemXferPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
- private:
- static DSetMemXferPropList* DEFAULT_;
+ private:
+ static DSetMemXferPropList *DEFAULT_;
- // Creates the global constant, should only be used by the library
- static DSetMemXferPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static DSetMemXferPropList *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp
index f9adc47..07cff07 100644
--- a/c++/src/H5EnumType.cpp
+++ b/c++/src/H5EnumType.cpp
@@ -13,7 +13,7 @@
#include <string>
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -50,14 +50,14 @@ EnumType::EnumType() : DataType() {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType::EnumType(const hid_t existing_id) : DataType( existing_id ) {}
+EnumType::EnumType(const hid_t existing_id) : DataType(existing_id) {}
//--------------------------------------------------------------------------
// Function: EnumType copy constructor
///\brief Copy constructor: same HDF5 object as \a original
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType::EnumType(const EnumType& original) : DataType( original ) {}
+EnumType::EnumType(const EnumType &original) : DataType(original) {}
//--------------------------------------------------------------------------
// Function: EnumType overloaded constructor
@@ -69,7 +69,7 @@ EnumType::EnumType(const EnumType& original) : DataType( original ) {}
// the enum datatype.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType::EnumType(size_t size) : DataType( H5T_ENUM, size ) {}
+EnumType::EnumType(size_t size) : DataType(H5T_ENUM, size) {}
//--------------------------------------------------------------------------
// Function: EnumType overloaded constructor
@@ -78,14 +78,13 @@ EnumType::EnumType(size_t size) : DataType( H5T_ENUM, size ) {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType::EnumType(const DataSet& dataset) : DataType()
+EnumType::EnumType(const DataSet &dataset) : DataType()
{
// Calls C function H5Dget_type to get the id of the datatype
id = H5Dget_type(dataset.getId());
// If the datatype id is not valid, throw an exception
- if (id < 0)
- {
+ if (id < 0) {
throw DataSetIException("EnumType constructor", "H5Dget_type failed");
}
}
@@ -97,14 +96,13 @@ EnumType::EnumType(const DataSet& dataset) : DataType()
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType::EnumType(const IntType& data_type) : DataType()
+EnumType::EnumType(const IntType &data_type) : DataType()
{
// Calls C function H5Tenum_create to get the id of the datatype
id = H5Tenum_create(data_type.getId());
// If the datatype id is not valid, throw an exception
- if (id < 0)
- {
+ if (id < 0) {
throw DataSetIException("EnumType constructor", "H5Tenum_create failed");
}
}
@@ -123,7 +121,7 @@ EnumType::EnumType(const IntType& data_type) : DataType()
// improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-EnumType::EnumType(const H5Location& loc, const char *dtype_name) : DataType()
+EnumType::EnumType(const H5Location &loc, const char *dtype_name) : DataType()
{
id = p_opentype(loc, dtype_name);
}
@@ -142,7 +140,7 @@ EnumType::EnumType(const H5Location& loc, const char *dtype_name) : DataType()
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-EnumType::EnumType(const H5Location& loc, const H5std_string& dtype_name) : DataType()
+EnumType::EnumType(const H5Location &loc, const H5std_string &dtype_name) : DataType()
{
id = p_opentype(loc, dtype_name.c_str());
}
@@ -155,7 +153,8 @@ EnumType::EnumType(const H5Location& loc, const H5std_string& dtype_name) : Data
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-DataType* EnumType::decode() const
+DataType *
+EnumType::decode() const
{
hid_t encoded_enumtype_id = H5I_INVALID_HID;
try {
@@ -166,7 +165,7 @@ DataType* EnumType::decode() const
}
EnumType *encoded_enumtype = new EnumType;
encoded_enumtype->p_setId(encoded_enumtype_id);
- return(encoded_enumtype);
+ return (encoded_enumtype);
}
//--------------------------------------------------------------------------
@@ -177,12 +176,12 @@ DataType* EnumType::decode() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void EnumType::insert(const char* name, void *value) const
+void
+EnumType::insert(const char *name, void *value) const
{
// Calls C routine H5Tenum_insert to insert the new enum datatype member.
herr_t ret_value = H5Tenum_insert(id, name, value);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("EnumType::insert", "H5Tenum_insert failed");
}
}
@@ -194,7 +193,8 @@ void EnumType::insert(const char* name, void *value) const
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void EnumType::insert(const H5std_string& name, void *value) const
+void
+EnumType::insert(const H5std_string &name, void *value) const
{
insert(name.c_str(), value);
}
@@ -208,24 +208,24 @@ void EnumType::insert(const H5std_string& name, void *value) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string EnumType::nameOf(void *value, size_t size) const
+H5std_string
+EnumType::nameOf(void *value, size_t size) const
{
- char* name_C = new char[size+1]; // temporary C-string for C API
- HDmemset(name_C, 0, size+1); // clear buffer
+ char *name_C = new char[size + 1]; // temporary C-string for C API
+ HDmemset(name_C, 0, size + 1); // clear buffer
// Calls C routine H5Tenum_nameof to get the name of the specified enum type
herr_t ret_value = H5Tenum_nameof(id, value, name_C, size);
// If H5Tenum_nameof returns a negative value, raise an exception,
- if (ret_value < 0)
- {
- delete []name_C;
+ if (ret_value < 0) {
+ delete[] name_C;
throw DataTypeIException("EnumType::nameOf", "H5Tenum_nameof failed");
}
// otherwise, create the string to hold the datatype name and return it
H5std_string name(name_C);
- delete []name_C;
- return(name);
+ delete[] name_C;
+ return (name);
}
//--------------------------------------------------------------------------
@@ -237,12 +237,12 @@ H5std_string EnumType::nameOf(void *value, size_t size) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void EnumType::valueOf(const char* name, void *value) const
+void
+EnumType::valueOf(const char *name, void *value) const
{
// Calls C routine H5Tenum_valueof to get the enum datatype value
herr_t ret_value = H5Tenum_valueof(id, name, value);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("EnumType::valueOf", "H5Tenum_valueof failed");
}
}
@@ -254,7 +254,8 @@ void EnumType::valueOf(const char* name, void *value) const
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void EnumType::valueOf(const H5std_string& name, void *value) const
+void
+EnumType::valueOf(const H5std_string &name, void *value) const
{
valueOf(name.c_str(), value);
}
@@ -269,15 +270,14 @@ void EnumType::valueOf(const H5std_string& name, void *value) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 16, 2002
//--------------------------------------------------------------------------
-int EnumType::getMemberIndex(const char *name) const
+int
+EnumType::getMemberIndex(const char *name) const
{
int member_index = H5Tget_member_index(id, name);
- if (member_index < 0)
- {
- throw DataTypeIException("EnumType::getMemberIndex",
- "H5Tget_member_index returns negative value");
+ if (member_index < 0) {
+ throw DataTypeIException("EnumType::getMemberIndex", "H5Tget_member_index returns negative value");
}
- return(member_index);
+ return (member_index);
}
//--------------------------------------------------------------------------
@@ -287,9 +287,10 @@ int EnumType::getMemberIndex(const char *name) const
/// argument \a name.
// Programmer Binh-Minh Ribler - May 16, 2002
//--------------------------------------------------------------------------
-int EnumType::getMemberIndex(const H5std_string& name) const
+int
+EnumType::getMemberIndex(const H5std_string &name) const
{
- return(EnumType::getMemberIndex(name.c_str()));
+ return (EnumType::getMemberIndex(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -299,15 +300,15 @@ int EnumType::getMemberIndex(const H5std_string& name) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-int EnumType::getNmembers() const
+int
+EnumType::getNmembers() const
{
int num_members = H5Tget_nmembers(id);
- if (num_members < 0)
- {
+ if (num_members < 0) {
throw DataTypeIException("EnumType::getNmembers",
- "H5Tget_nmembers returns negative number of members");
+ "H5Tget_nmembers returns negative number of members");
}
- return(num_members);
+ return (num_members);
}
//--------------------------------------------------------------------------
@@ -319,12 +320,12 @@ int EnumType::getNmembers() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void EnumType::getMemberValue(unsigned memb_no, void *value) const
+void
+EnumType::getMemberValue(unsigned memb_no, void *value) const
{
// Call C routine H5Tget_member_value to get the datatype member's value
hid_t ret_value = H5Tget_member_value(id, memb_no, value);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("EnumType::getMemberValue", "H5Tget_member_value failed");
}
}
@@ -336,4 +337,4 @@ void EnumType::getMemberValue(unsigned memb_no, void *value) const
//--------------------------------------------------------------------------
EnumType::~EnumType() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h
index 4797ee7..e3d9a50 100644
--- a/c++/src/H5EnumType.h
+++ b/c++/src/H5EnumType.h
@@ -24,61 +24,65 @@ namespace H5 {
// Inheritance: DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP EnumType : public DataType {
- public:
- // Creates an empty enumeration datatype based on a native signed
- // integer type, whose size is given by size.
- EnumType(size_t size);
+ public:
+ // Creates an empty enumeration datatype based on a native signed
+ // integer type, whose size is given by size.
+ EnumType(size_t size);
- // Gets the enum datatype of the specified dataset
- EnumType(const DataSet& dataset); // H5Dget_type
+ // Gets the enum datatype of the specified dataset
+ EnumType(const DataSet &dataset); // H5Dget_type
- // Creates a new enum datatype based on an integer datatype
- EnumType(const IntType& data_type); // H5Tenum_create
+ // Creates a new enum datatype based on an integer datatype
+ EnumType(const IntType &data_type); // H5Tenum_create
- // Constructors that open an enum datatype, given a location.
- EnumType(const H5Location& loc, const char* name);
- EnumType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open an enum datatype, given a location.
+ EnumType(const H5Location &loc, const char *name);
+ EnumType(const H5Location &loc, const H5std_string &name);
- // Returns an EnumType object via DataType* by decoding the
- // binary object description of this type.
- virtual DataType* decode() const;
+ // Returns an EnumType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType *decode() const;
- // Returns the number of members in this enumeration datatype.
- int getNmembers () const;
+ // Returns the number of members in this enumeration datatype.
+ int getNmembers() const;
- // Returns the index of a member in this enumeration data type.
- int getMemberIndex(const char* name) const;
- int getMemberIndex(const H5std_string& name) const;
+ // Returns the index of a member in this enumeration data type.
+ int getMemberIndex(const char *name) const;
+ int getMemberIndex(const H5std_string &name) const;
- // Returns the value of an enumeration datatype member
- void getMemberValue(unsigned memb_no, void *value) const;
+ // Returns the value of an enumeration datatype member
+ void getMemberValue(unsigned memb_no, void *value) const;
- // Inserts a new member to this enumeration type.
- void insert(const char* name, void *value) const;
- void insert(const H5std_string& name, void *value) const;
+ // Inserts a new member to this enumeration type.
+ void insert(const char *name, void *value) const;
+ void insert(const H5std_string &name, void *value) const;
- // Returns the symbol name corresponding to a specified member
- // of this enumeration datatype.
- H5std_string nameOf(void *value, size_t size) const;
+ // Returns the symbol name corresponding to a specified member
+ // of this enumeration datatype.
+ H5std_string nameOf(void *value, size_t size) const;
- // Returns the value corresponding to a specified member of this
- // enumeration datatype.
- void valueOf(const char* name, void *value) const;
- void valueOf(const H5std_string& name, void *value) const;
+ // Returns the value corresponding to a specified member of this
+ // enumeration datatype.
+ void valueOf(const char *name, void *value) const;
+ void valueOf(const H5std_string &name, void *value) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("EnumType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("EnumType");
+ }
- // Default constructor
- EnumType();
+ // Default constructor
+ EnumType();
- // Creates an enumeration datatype using an existing id
- EnumType(const hid_t existing_id);
+ // Creates an enumeration datatype using an existing id
+ EnumType(const hid_t existing_id);
- // Copy constructor: same as the original EnumType.
- EnumType(const EnumType& original);
+ // Copy constructor: same as the original EnumType.
+ EnumType(const EnumType &original);
- virtual ~EnumType();
+ virtual ~EnumType();
}; // end of EnumType
} // namespace H5
diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp
index 7431e6c..5fcd1cf 100644
--- a/c++/src/H5Exception.cpp
+++ b/c++/src/H5Exception.cpp
@@ -35,7 +35,10 @@ Exception::Exception() : detail_message(""), func_name("") {}
///\param message - IN: Message on the failure
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Exception::Exception(const H5std_string& func, const H5std_string& message) : detail_message(message), func_name(func) {}
+Exception::Exception(const H5std_string &func, const H5std_string &message)
+ : detail_message(message), func_name(func)
+{
+}
//--------------------------------------------------------------------------
// Function: Exception copy constructor
@@ -43,7 +46,9 @@ Exception::Exception(const H5std_string& func, const H5std_string& message) : de
///\param orig - IN: Exception instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Exception::Exception(const Exception& orig) : detail_message(orig.detail_message), func_name(orig.func_name) {}
+Exception::Exception(const Exception &orig) : detail_message(orig.detail_message), func_name(orig.func_name)
+{
+}
//--------------------------------------------------------------------------
// Function: Exception::getMajorString
@@ -56,32 +61,30 @@ Exception::Exception(const Exception& orig) : detail_message(orig.detail_message
/// will be returned.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string Exception::getMajorString(hid_t err_major) const
+H5std_string
+Exception::getMajorString(hid_t err_major) const
{
// Preliminary call to H5Eget_msg() to get the length of the message
ssize_t mesg_size = H5Eget_msg(err_major, NULL, NULL, 0);
// If H5Eget_msg() returns a negative value, raise an exception,
if (mesg_size < 0)
- throw IdComponentException("Exception::getMajorString",
- "H5Eget_msg failed");
+ throw IdComponentException("Exception::getMajorString", "H5Eget_msg failed");
// Call H5Eget_msg again to get the actual message
- char* mesg_C = new char[mesg_size+1]; // temporary C-string for C API
- mesg_size = H5Eget_msg(err_major, NULL, mesg_C, mesg_size+1);
+ char *mesg_C = new char[mesg_size + 1]; // temporary C-string for C API
+ mesg_size = H5Eget_msg(err_major, NULL, mesg_C, mesg_size + 1);
// Check for failure again
- if (mesg_size < 0)
- {
- delete []mesg_C;
- throw IdComponentException("Exception::getMajorString",
- "H5Eget_msg failed");
+ if (mesg_size < 0) {
+ delete[] mesg_C;
+ throw IdComponentException("Exception::getMajorString", "H5Eget_msg failed");
}
// Convert the C error description and return
H5std_string major_str(mesg_C);
- delete []mesg_C;
- return(major_str);
+ delete[] mesg_C;
+ return (major_str);
}
//--------------------------------------------------------------------------
@@ -95,32 +98,30 @@ H5std_string Exception::getMajorString(hid_t err_major) const
/// will be returned.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string Exception::getMinorString(hid_t err_minor) const
+H5std_string
+Exception::getMinorString(hid_t err_minor) const
{
// Preliminary call to H5Eget_msg() to get the length of the message
ssize_t mesg_size = H5Eget_msg(err_minor, NULL, NULL, 0);
// If H5Eget_msg() returns a negative value, raise an exception,
if (mesg_size < 0)
- throw IdComponentException("Exception::getMinorString",
- "H5Eget_msg failed");
+ throw IdComponentException("Exception::getMinorString", "H5Eget_msg failed");
// Call H5Eget_msg again to get the actual message
- char* mesg_C = new char[mesg_size+1]; // temporary C-string for C API
- mesg_size = H5Eget_msg(err_minor, NULL, mesg_C, mesg_size+1);
+ char *mesg_C = new char[mesg_size + 1]; // temporary C-string for C API
+ mesg_size = H5Eget_msg(err_minor, NULL, mesg_C, mesg_size + 1);
// Check for failure again
- if (mesg_size < 0)
- {
- delete []mesg_C;
- throw IdComponentException("Exception::getMinorString",
- "H5Eget_msg failed");
+ if (mesg_size < 0) {
+ delete[] mesg_C;
+ throw IdComponentException("Exception::getMinorString", "H5Eget_msg failed");
}
// Convert the C error description and return
H5std_string minor_str(mesg_C);
- delete []mesg_C;
- return(minor_str);
+ delete[] mesg_C;
+ return (minor_str);
}
//--------------------------------------------------------------------------
@@ -139,7 +140,8 @@ H5std_string Exception::getMinorString(hid_t err_minor) const
/// handlers
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Exception::setAutoPrint(H5E_auto2_t& func, void* client_data)
+void
+Exception::setAutoPrint(H5E_auto2_t &func, void *client_data)
{
// calls the C API routine H5Eset_auto to set the auto printing to
// the specified function.
@@ -153,7 +155,8 @@ void Exception::setAutoPrint(H5E_auto2_t& func, void* client_data)
///\brief Turns off the automatic error printing from the C library.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Exception::dontPrint()
+void
+Exception::dontPrint()
{
// calls the C API routine H5Eset_auto with NULL parameters to turn
// off the automatic error printing.
@@ -172,7 +175,8 @@ void Exception::dontPrint()
/// the error function
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Exception::getAutoPrint(H5E_auto2_t& func, void** client_data)
+void
+Exception::getAutoPrint(H5E_auto2_t &func, void **client_data)
{
// calls the C API routine H5Eget_auto to get the current setting of
// the automatic error printing
@@ -189,7 +193,8 @@ void Exception::getAutoPrint(H5E_auto2_t& func, void** client_data)
/// called, with certain exceptions (for instance, \c H5Eprint).
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Exception::clearErrorStack()
+void
+Exception::clearErrorStack()
{
// calls the C API routine H5Eclear to clear the error stack
herr_t ret_value = H5Eclear2(H5E_DEFAULT);
@@ -238,7 +243,8 @@ void Exception::clearErrorStack()
///\endcode
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Exception::walkErrorStack(H5E_direction_t direction, H5E_walk2_t func, void* client_data)
+void
+Exception::walkErrorStack(H5E_direction_t direction, H5E_walk2_t func, void *client_data)
{
// calls the C API routine H5Ewalk to walk the error stack
herr_t ret_value = H5Ewalk2(H5E_DEFAULT, direction, func, client_data);
@@ -253,9 +259,10 @@ void Exception::walkErrorStack(H5E_direction_t direction, H5E_walk2_t func, void
///\return Text message - \c H5std_string
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string Exception::getDetailMsg() const
+H5std_string
+Exception::getDetailMsg() const
{
- return(detail_message);
+ return (detail_message);
}
//--------------------------------------------------------------------------
@@ -265,9 +272,10 @@ H5std_string Exception::getDetailMsg() const
///\return Text message - \c char pointer
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-const char* Exception::getCDetailMsg() const
+const char *
+Exception::getCDetailMsg() const
{
- return(detail_message.c_str());
+ return (detail_message.c_str());
}
//--------------------------------------------------------------------------
@@ -276,9 +284,10 @@ const char* Exception::getCDetailMsg() const
///\return Text message - \c H5std_string
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string Exception::getFuncName() const
+H5std_string
+Exception::getFuncName() const
{
- return(func_name);
+ return (func_name);
}
//--------------------------------------------------------------------------
@@ -287,9 +296,10 @@ H5std_string Exception::getFuncName() const
///\return Text message - \c char pointer
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-const char* Exception::getCFuncName() const
+const char *
+Exception::getCFuncName() const
{
- return(func_name.c_str());
+ return (func_name.c_str());
}
//--------------------------------------------------------------------------
@@ -299,7 +309,8 @@ const char* Exception::getCFuncName() const
///\param err_stack - IN: Error stack ID, default to H5E_DEFAULT(0)
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Exception::printErrorStack(FILE* stream, hid_t err_stack)
+void
+Exception::printErrorStack(FILE *stream, hid_t err_stack)
{
herr_t ret_value = H5Eprint2(err_stack, stream);
if (ret_value < 0)
@@ -319,7 +330,7 @@ void Exception::printErrorStack(FILE* stream, hid_t err_stack)
// Removed from documentation. -BMR, 2016/03/23
// Removed from code. -BMR, 2017/08/11 1.8.20 and 1.10.2
//--------------------------------------------------------------------------
-//void Exception::printError(FILE* stream) const
+// void Exception::printError(FILE* stream) const
//{
// Exception::printErrorStack(stream, H5E_DEFAULT);
//}
@@ -339,7 +350,7 @@ Exception::~Exception() throw() {}
// Function: FileIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-FileIException::FileIException():Exception(){}
+FileIException::FileIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: FileIException overloaded constructor
///\brief Creates a FileIException with the name of the function,
@@ -347,7 +358,10 @@ FileIException::FileIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-FileIException::FileIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+FileIException::FileIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: FileIException destructor
///\brief Noop destructor.
@@ -362,7 +376,7 @@ FileIException::~FileIException() throw() {}
// Function: GroupIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-GroupIException::GroupIException():Exception(){}
+GroupIException::GroupIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: GroupIException overloaded constructor
///\brief Creates a GroupIException with the name of the function,
@@ -370,7 +384,10 @@ GroupIException::GroupIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-GroupIException::GroupIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+GroupIException::GroupIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: GroupIException destructor
///\brief Noop destructor.
@@ -385,7 +402,7 @@ GroupIException::~GroupIException() throw() {}
// Function: DataSpaceIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-DataSpaceIException::DataSpaceIException():Exception(){}
+DataSpaceIException::DataSpaceIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: DataSpaceIException overloaded constructor
///\brief Creates a DataSpaceIException with the name of the function,
@@ -393,7 +410,10 @@ DataSpaceIException::DataSpaceIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-DataSpaceIException::DataSpaceIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+DataSpaceIException::DataSpaceIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: DataSpaceIException destructor
///\brief Noop destructor.
@@ -408,7 +428,7 @@ DataSpaceIException::~DataSpaceIException() throw() {}
// Function: DataTypeIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-DataTypeIException::DataTypeIException():Exception(){}
+DataTypeIException::DataTypeIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: DataTypeIException overloaded constructor
///\brief Creates a DataTypeIException with the name of the function,
@@ -416,7 +436,10 @@ DataTypeIException::DataTypeIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-DataTypeIException::DataTypeIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+DataTypeIException::DataTypeIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: DataTypeIException destructor
///\brief Noop destructor.
@@ -431,7 +454,7 @@ DataTypeIException::~DataTypeIException() throw() {}
// Function: ObjHeaderIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-ObjHeaderIException::ObjHeaderIException():Exception(){}
+ObjHeaderIException::ObjHeaderIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: ObjHeaderIException overloaded constructor
///\brief Creates an ObjHeaderIException with the name of the function,
@@ -439,7 +462,10 @@ ObjHeaderIException::ObjHeaderIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-ObjHeaderIException::ObjHeaderIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+ObjHeaderIException::ObjHeaderIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: ObjHeaderIException destructor
///\brief Noop destructor.
@@ -454,7 +480,7 @@ ObjHeaderIException::~ObjHeaderIException() throw() {}
// Function: PropListIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-PropListIException::PropListIException():Exception(){}
+PropListIException::PropListIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: PropListIException overloaded constructor
///\brief Creates a PropListIException with the name of the function,
@@ -462,7 +488,10 @@ PropListIException::PropListIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-PropListIException::PropListIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+PropListIException::PropListIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: PropListIException destructor
///\brief Noop destructor.
@@ -477,7 +506,7 @@ PropListIException::~PropListIException() throw() {}
// Function: DataSetIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-DataSetIException::DataSetIException():Exception(){}
+DataSetIException::DataSetIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: DataSetIException overloaded constructor
///\brief Creates a DataSetIException with the name of the function,
@@ -485,7 +514,10 @@ DataSetIException::DataSetIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-DataSetIException::DataSetIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+DataSetIException::DataSetIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: DataSetIException destructor
///\brief Noop destructor.
@@ -500,7 +532,7 @@ DataSetIException::~DataSetIException() throw() {}
// Function: AttributeIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-AttributeIException::AttributeIException():Exception(){}
+AttributeIException::AttributeIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: AttributeIException overloaded constructor
///\brief Creates an AttributeIException with the name of the function,
@@ -508,7 +540,10 @@ AttributeIException::AttributeIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-AttributeIException::AttributeIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+AttributeIException::AttributeIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: AttributeIException destructor
///\brief Noop destructor.
@@ -523,7 +558,7 @@ AttributeIException::~AttributeIException() throw() {}
// Function: ReferenceException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-ReferenceException::ReferenceException():Exception(){}
+ReferenceException::ReferenceException() : Exception() {}
//--------------------------------------------------------------------------
// Function: ReferenceException overloaded constructor
///\brief Creates a ReferenceException with the name of the function,
@@ -531,7 +566,10 @@ ReferenceException::ReferenceException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-ReferenceException::ReferenceException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+ReferenceException::ReferenceException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: ReferenceException destructor
///\brief Noop destructor.
@@ -546,7 +584,7 @@ ReferenceException::~ReferenceException() throw() {}
// Function: LibraryIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-LibraryIException::LibraryIException():Exception(){}
+LibraryIException::LibraryIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: LibraryIException overloaded constructor
///\brief Creates a LibraryIException with the name of the function,
@@ -554,7 +592,10 @@ LibraryIException::LibraryIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-LibraryIException::LibraryIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+LibraryIException::LibraryIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: LibraryIException destructor
///\brief Noop destructor.
@@ -569,7 +610,7 @@ LibraryIException::~LibraryIException() throw() {}
// Function: LocationException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-LocationException::LocationException():Exception(){}
+LocationException::LocationException() : Exception() {}
//--------------------------------------------------------------------------
// Function: LocationException overloaded constructor
///\brief Creates a LocationException with the name of the function,
@@ -577,7 +618,10 @@ LocationException::LocationException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-LocationException::LocationException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+LocationException::LocationException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: LocationException destructor
///\brief Noop destructor.
@@ -592,7 +636,7 @@ LocationException::~LocationException() throw() {}
// Function: IdComponentException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-IdComponentException::IdComponentException(): Exception() {}
+IdComponentException::IdComponentException() : Exception() {}
//--------------------------------------------------------------------------
// Function: IdComponentException overloaded constructor
///\brief Creates a IdComponentException with the name of the function,
@@ -600,11 +644,14 @@ IdComponentException::IdComponentException(): Exception() {}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-IdComponentException::IdComponentException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+IdComponentException::IdComponentException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: IdComponentException destructor
///\brief Noop destructor.
//--------------------------------------------------------------------------
IdComponentException::~IdComponentException() throw() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h
index cb14a4c..44edac2 100644
--- a/c++/src/H5Exception.h
+++ b/c++/src/H5Exception.h
@@ -19,9 +19,9 @@
namespace H5 {
#ifdef H5_NO_STD
- #define H5std_string ::string
+#define H5std_string ::string
#else
- #define H5std_string std::string
+#define H5std_string std::string
#endif
/*! \class Exception
@@ -30,150 +30,148 @@ namespace H5 {
Many classes are derived from Exception for specific HDF5 C interfaces.
*/
class H5_DLLCPP Exception {
- public:
- // Creates an exception with a function name where the failure occurs
- // and an optional detailed message
- Exception(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
-
- // Returns a character string that describes the error specified by
- // a major error number.
- H5std_string getMajorString(hid_t err_major_id) const;
-
- // Returns a character string that describes the error specified by
- // a minor error number.
- H5std_string getMinorString(hid_t err_minor_id) const;
-
- // Returns the detailed message set at the time the exception is thrown
- H5std_string getDetailMsg() const;
- const char* getCDetailMsg() const; // C string of detailed message
- H5std_string getFuncName() const; // function name as a string object
- const char* getCFuncName() const; // function name as a char string
-
- // Turns on the automatic error printing.
- static void setAutoPrint(H5E_auto2_t& func, void* client_data);
-
- // Turns off the automatic error printing.
- static void dontPrint();
-
- // Retrieves the current settings for the automatic error stack
- // traversal function and its data.
- static void getAutoPrint(H5E_auto2_t& func, void** client_data);
-
- // Clears the error stack for the current thread.
- static void clearErrorStack();
-
- // Walks the error stack for the current thread, calling the
- // specified function.
- static void walkErrorStack(H5E_direction_t direction,
- H5E_walk2_t func, void* client_data);
-
- // Prints the error stack in a default manner.
- static void printErrorStack(FILE* stream = stderr,
- hid_t err_stack = H5E_DEFAULT);
- // Deprecated in favor of printErrorStack.
- // Removed from code. -BMR, 2017/08/11 1.8.20 and 1.10.2
- // virtual void printError(FILE* stream = NULL) const;
-
- // Default constructor
- Exception();
-
- // copy constructor
- Exception(const Exception& orig);
-
- // virtual Destructor
- virtual ~Exception() throw();
-
- protected:
- // Default value for detail_message
- static const char DEFAULT_MSG[];
-
- private:
- H5std_string detail_message;
- H5std_string func_name;
+ public:
+ // Creates an exception with a function name where the failure occurs
+ // and an optional detailed message
+ Exception(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+
+ // Returns a character string that describes the error specified by
+ // a major error number.
+ H5std_string getMajorString(hid_t err_major_id) const;
+
+ // Returns a character string that describes the error specified by
+ // a minor error number.
+ H5std_string getMinorString(hid_t err_minor_id) const;
+
+ // Returns the detailed message set at the time the exception is thrown
+ H5std_string getDetailMsg() const;
+ const char * getCDetailMsg() const; // C string of detailed message
+ H5std_string getFuncName() const; // function name as a string object
+ const char * getCFuncName() const; // function name as a char string
+
+ // Turns on the automatic error printing.
+ static void setAutoPrint(H5E_auto2_t &func, void *client_data);
+
+ // Turns off the automatic error printing.
+ static void dontPrint();
+
+ // Retrieves the current settings for the automatic error stack
+ // traversal function and its data.
+ static void getAutoPrint(H5E_auto2_t &func, void **client_data);
+
+ // Clears the error stack for the current thread.
+ static void clearErrorStack();
+
+ // Walks the error stack for the current thread, calling the
+ // specified function.
+ static void walkErrorStack(H5E_direction_t direction, H5E_walk2_t func, void *client_data);
+
+ // Prints the error stack in a default manner.
+ static void printErrorStack(FILE *stream = stderr, hid_t err_stack = H5E_DEFAULT);
+ // Deprecated in favor of printErrorStack.
+ // Removed from code. -BMR, 2017/08/11 1.8.20 and 1.10.2
+ // virtual void printError(FILE* stream = NULL) const;
+
+ // Default constructor
+ Exception();
+
+ // copy constructor
+ Exception(const Exception &orig);
+
+ // virtual Destructor
+ virtual ~Exception() throw();
+
+ protected:
+ // Default value for detail_message
+ static const char DEFAULT_MSG[];
+
+ private:
+ H5std_string detail_message;
+ H5std_string func_name;
};
class H5_DLLCPP FileIException : public Exception {
- public:
- FileIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- FileIException();
- virtual ~FileIException() throw();
+ public:
+ FileIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ FileIException();
+ virtual ~FileIException() throw();
};
class H5_DLLCPP GroupIException : public Exception {
- public:
- GroupIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- GroupIException();
- virtual ~GroupIException() throw();
+ public:
+ GroupIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ GroupIException();
+ virtual ~GroupIException() throw();
};
class H5_DLLCPP DataSpaceIException : public Exception {
- public:
- DataSpaceIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- DataSpaceIException();
- virtual ~DataSpaceIException() throw();
+ public:
+ DataSpaceIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ DataSpaceIException();
+ virtual ~DataSpaceIException() throw();
};
class H5_DLLCPP DataTypeIException : public Exception {
- public:
- DataTypeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- DataTypeIException();
- virtual ~DataTypeIException() throw();
+ public:
+ DataTypeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ DataTypeIException();
+ virtual ~DataTypeIException() throw();
};
class H5_DLLCPP ObjHeaderIException : public Exception {
- public:
- ObjHeaderIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- ObjHeaderIException();
- virtual ~ObjHeaderIException() throw();
+ public:
+ ObjHeaderIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ ObjHeaderIException();
+ virtual ~ObjHeaderIException() throw();
};
class H5_DLLCPP PropListIException : public Exception {
- public:
- PropListIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- PropListIException();
- virtual ~PropListIException() throw();
+ public:
+ PropListIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ PropListIException();
+ virtual ~PropListIException() throw();
};
class H5_DLLCPP DataSetIException : public Exception {
- public:
- DataSetIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- DataSetIException();
- virtual ~DataSetIException() throw();
+ public:
+ DataSetIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ DataSetIException();
+ virtual ~DataSetIException() throw();
};
class H5_DLLCPP AttributeIException : public Exception {
- public:
- AttributeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- AttributeIException();
- virtual ~AttributeIException() throw();
+ public:
+ AttributeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ AttributeIException();
+ virtual ~AttributeIException() throw();
};
class H5_DLLCPP ReferenceException : public Exception {
- public:
- ReferenceException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- ReferenceException();
- virtual ~ReferenceException() throw();
+ public:
+ ReferenceException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ ReferenceException();
+ virtual ~ReferenceException() throw();
};
class H5_DLLCPP LibraryIException : public Exception {
- public:
- LibraryIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- LibraryIException();
- virtual ~LibraryIException() throw();
+ public:
+ LibraryIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ LibraryIException();
+ virtual ~LibraryIException() throw();
};
class H5_DLLCPP LocationException : public Exception {
- public:
- LocationException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- LocationException();
- virtual ~LocationException() throw();
+ public:
+ LocationException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ LocationException();
+ virtual ~LocationException() throw();
};
class H5_DLLCPP IdComponentException : public Exception {
- public:
- IdComponentException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- IdComponentException();
- virtual ~IdComponentException() throw();
+ public:
+ IdComponentException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ IdComponentException();
+ virtual ~IdComponentException() throw();
}; // end of IdComponentException
} // namespace H5
diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp
index a028e00..78a4a74 100644
--- a/c++/src/H5FaccProp.cpp
+++ b/c++/src/H5FaccProp.cpp
@@ -37,7 +37,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-FileAccPropList* FileAccPropList::DEFAULT_ = 0;
+FileAccPropList *FileAccPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: FileAccPropList::getConstant
@@ -50,13 +50,13 @@ FileAccPropList* FileAccPropList::DEFAULT_ = 0;
// happen.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-FileAccPropList* FileAccPropList::getConstant()
+FileAccPropList *
+FileAccPropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -65,8 +65,9 @@ FileAccPropList* FileAccPropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new FileAccPropList(H5P_FILE_ACCESS);
else
- throw PropListIException("FileAccPropList::getConstant", "FileAccPropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException("FileAccPropList::getConstant",
+ "FileAccPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -76,7 +77,8 @@ FileAccPropList* FileAccPropList::getConstant()
// exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void FileAccPropList::deleteConstants()
+void
+FileAccPropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -85,7 +87,7 @@ void FileAccPropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose Constant for default property
//--------------------------------------------------------------------------
-const FileAccPropList& FileAccPropList::DEFAULT = *getConstant();
+const FileAccPropList &FileAccPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -102,7 +104,7 @@ FileAccPropList::FileAccPropList() : PropList(H5P_FILE_ACCESS) {}
///\param original - IN: FileAccPropList instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FileAccPropList::FileAccPropList(const FileAccPropList& original) : PropList(original) {}
+FileAccPropList::FileAccPropList(const FileAccPropList &original) : PropList(original) {}
//--------------------------------------------------------------------------
// Function: FileAccPropList overloaded constructor
@@ -119,11 +121,11 @@ FileAccPropList::FileAccPropList(const hid_t plist_id) : PropList(plist_id) {}
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setStdio() const
+void
+FileAccPropList::setStdio() const
{
herr_t ret_value = H5Pset_fapl_stdio(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setStdio", "H5Pset_fapl_stdio failed");
}
}
@@ -139,14 +141,14 @@ void FileAccPropList::setStdio() const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-hid_t FileAccPropList::getDriver() const
+hid_t
+FileAccPropList::getDriver() const
{
hid_t driver = H5Pget_driver(id);
- if (driver < 0)
- {
+ if (driver < 0) {
throw PropListIException("FileAccPropList::getDriver", "H5Pget_driver failed");
}
- return(driver);
+ return (driver);
}
//--------------------------------------------------------------------------
@@ -160,11 +162,11 @@ hid_t FileAccPropList::getDriver() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setDriver(hid_t new_driver_id, const void *new_driver_info) const
+void
+FileAccPropList::setDriver(hid_t new_driver_id, const void *new_driver_info) const
{
herr_t ret_value = H5Pset_driver(id, new_driver_id, new_driver_info);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setDriver", "H5Pset_driver failed");
}
}
@@ -176,11 +178,11 @@ void FileAccPropList::setDriver(hid_t new_driver_id, const void *new_driver_info
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setFamilyOffset(hsize_t offset) const
+void
+FileAccPropList::setFamilyOffset(hsize_t offset) const
{
herr_t ret_value = H5Pset_family_offset(id, offset);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setFamilyOffset", "H5Pset_family_offset failed");
}
}
@@ -192,15 +194,15 @@ void FileAccPropList::setFamilyOffset(hsize_t offset) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-hsize_t FileAccPropList::getFamilyOffset() const
+hsize_t
+FileAccPropList::getFamilyOffset() const
{
hsize_t offset;
- herr_t ret_value = H5Pget_family_offset(id, &offset);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pget_family_offset(id, &offset);
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getFamilyOffset", "H5Pget_family_offset failed");
}
- return(offset);
+ return (offset);
}
//--------------------------------------------------------------------------
@@ -217,12 +219,12 @@ hsize_t FileAccPropList::getFamilyOffset() const
/// refer to the H5Pset_fapl_core API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setCore (size_t increment, hbool_t backing_store) const
+void
+FileAccPropList::setCore(size_t increment, hbool_t backing_store) const
{
- herr_t ret_value = H5Pset_fapl_core (id, increment, backing_store);
- if (ret_value < 0)
- {
- throw PropListIException ("FileAccPropList::setCore", "H5Pset_fapl_core failed");
+ herr_t ret_value = H5Pset_fapl_core(id, increment, backing_store);
+ if (ret_value < 0) {
+ throw PropListIException("FileAccPropList::setCore", "H5Pset_fapl_core failed");
}
}
@@ -235,11 +237,11 @@ void FileAccPropList::setCore (size_t increment, hbool_t backing_store) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::getCore (size_t& increment, hbool_t& backing_store) const
+void
+FileAccPropList::getCore(size_t &increment, hbool_t &backing_store) const
{
herr_t ret_value = H5Pget_fapl_core(id, &increment, &backing_store);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getCore", "H5Pget_fapl_core failed");
}
}
@@ -255,11 +257,11 @@ void FileAccPropList::getCore (size_t& increment, hbool_t& backing_store) const
/// Note that \a memb_size is used only when creating a new file.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setFamily(hsize_t memb_size, const FileAccPropList& memb_plist) const
+void
+FileAccPropList::setFamily(hsize_t memb_size, const FileAccPropList &memb_plist) const
{
- herr_t ret_value = H5Pset_fapl_family (id, memb_size, memb_plist.getId());
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pset_fapl_family(id, memb_size, memb_plist.getId());
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setFamily", "H5Pset_fapl_family failed");
}
}
@@ -274,12 +276,12 @@ void FileAccPropList::setFamily(hsize_t memb_size, const FileAccPropList& memb_p
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::getFamily(hsize_t& memb_size, FileAccPropList& memb_plist) const
+void
+FileAccPropList::getFamily(hsize_t &memb_size, FileAccPropList &memb_plist) const
{
- hid_t memb_plist_id;
+ hid_t memb_plist_id;
herr_t ret_value = H5Pget_fapl_family(id, &memb_size, &memb_plist_id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed");
}
memb_plist.p_setId(memb_plist_id);
@@ -295,16 +297,16 @@ void FileAccPropList::getFamily(hsize_t& memb_size, FileAccPropList& memb_plist)
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-FileAccPropList FileAccPropList::getFamily(hsize_t& memb_size) const
+FileAccPropList
+FileAccPropList::getFamily(hsize_t &memb_size) const
{
- hid_t memb_plist_id;
+ hid_t memb_plist_id;
herr_t ret_value = H5Pget_fapl_family(id, &memb_size, &memb_plist_id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed");
}
FileAccPropList memb_plist(memb_plist_id);
- return(memb_plist);
+ return (memb_plist);
}
//--------------------------------------------------------------------------
@@ -321,13 +323,14 @@ FileAccPropList FileAccPropList::getFamily(hsize_t& memb_size) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext) const
+void
+FileAccPropList::setSplit(const FileAccPropList &meta_plist, const FileAccPropList &raw_plist,
+ const char *meta_ext, const char *raw_ext) const
{
- hid_t meta_pid = meta_plist.getId();
- hid_t raw_pid = raw_plist.getId();
+ hid_t meta_pid = meta_plist.getId();
+ hid_t raw_pid = raw_plist.getId();
herr_t ret_value = H5Pset_fapl_split(id, meta_ext, meta_pid, raw_ext, raw_pid);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setSplit", "H5Pset_fapl_split failed");
}
}
@@ -343,7 +346,9 @@ void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccP
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const H5std_string& meta_ext, const H5std_string& raw_ext) const
+void
+FileAccPropList::setSplit(const FileAccPropList &meta_plist, const FileAccPropList &raw_plist,
+ const H5std_string &meta_ext, const H5std_string &raw_ext) const
{
setSplit(meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str());
}
@@ -360,15 +365,15 @@ void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccP
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-size_t FileAccPropList::getSieveBufSize() const
+size_t
+FileAccPropList::getSieveBufSize() const
{
size_t bufsize;
herr_t ret_value = H5Pget_sieve_buf_size(id, &bufsize);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed");
}
- return(bufsize);
+ return (bufsize);
}
//--------------------------------------------------------------------------
@@ -381,11 +386,11 @@ size_t FileAccPropList::getSieveBufSize() const
/// API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setSieveBufSize(size_t bufsize) const
+void
+FileAccPropList::setSieveBufSize(size_t bufsize) const
{
herr_t ret_value = H5Pset_sieve_buf_size(id, bufsize);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed");
}
}
@@ -401,11 +406,11 @@ void FileAccPropList::setSieveBufSize(size_t bufsize) const
/// API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setMetaBlockSize(hsize_t &block_size) const
+void
+FileAccPropList::setMetaBlockSize(hsize_t &block_size) const
{
herr_t ret_value = H5Pset_meta_block_size(id, block_size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setMetaBlockSize", "H5Pset_meta_block_size failed");
}
}
@@ -417,15 +422,15 @@ void FileAccPropList::setMetaBlockSize(hsize_t &block_size) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-hsize_t FileAccPropList::getMetaBlockSize() const
+hsize_t
+FileAccPropList::getMetaBlockSize() const
{
hsize_t block_size;
- herr_t ret_value = H5Pget_meta_block_size(id, &block_size);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pget_meta_block_size(id, &block_size);
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getMetaBlockSize", "H5Pget_meta_block_size failed");
}
- return(block_size);
+ return (block_size);
}
//--------------------------------------------------------------------------
@@ -441,11 +446,11 @@ hsize_t FileAccPropList::getMetaBlockSize() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setLog(const char *logfile, unsigned flags, size_t buf_size) const
+void
+FileAccPropList::setLog(const char *logfile, unsigned flags, size_t buf_size) const
{
herr_t ret_value = H5Pset_fapl_log(id, logfile, flags, buf_size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setLog", "H5Pset_fapl_log failed");
}
}
@@ -460,7 +465,8 @@ void FileAccPropList::setLog(const char *logfile, unsigned flags, size_t buf_siz
///\param buf_size - IN: Size of the logging buffer
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setLog(const H5std_string& logfile, unsigned flags, size_t buf_size) const
+void
+FileAccPropList::setLog(const H5std_string &logfile, unsigned flags, size_t buf_size) const
{
setLog(logfile.c_str(), flags, buf_size);
}
@@ -473,11 +479,11 @@ void FileAccPropList::setLog(const H5std_string& logfile, unsigned flags, size_t
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setSec2() const
+void
+FileAccPropList::setSec2() const
{
herr_t ret_value = H5Pset_fapl_sec2(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setSec2", "H5Pset_fapl_sec2 failed");
}
}
@@ -498,11 +504,11 @@ void FileAccPropList::setSec2() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileAccPropList::setAlignment(hsize_t threshold, hsize_t alignment) const
+void
+FileAccPropList::setAlignment(hsize_t threshold, hsize_t alignment) const
{
herr_t ret_value = H5Pset_alignment(id, threshold, alignment);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setAlignment", "H5Pset_alignment failed");
}
}
@@ -516,11 +522,11 @@ void FileAccPropList::setAlignment(hsize_t threshold, hsize_t alignment) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileAccPropList::getAlignment(hsize_t &threshold, hsize_t &alignment) const
+void
+FileAccPropList::getAlignment(hsize_t &threshold, hsize_t &alignment) const
{
herr_t ret_value = H5Pget_alignment(id, &threshold, &alignment);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getAlignment", "H5Pget_alignment failed");
}
}
@@ -535,11 +541,11 @@ void FileAccPropList::getAlignment(hsize_t &threshold, hsize_t &alignment) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setMultiType(H5FD_mem_t dtype) const
+void
+FileAccPropList::setMultiType(H5FD_mem_t dtype) const
{
herr_t ret_value = H5Pset_multi_type(id, dtype);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setMultiType", "H5Pset_multi_type failed");
}
}
@@ -554,15 +560,15 @@ void FileAccPropList::setMultiType(H5FD_mem_t dtype) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-H5FD_mem_t FileAccPropList::getMultiType() const
+H5FD_mem_t
+FileAccPropList::getMultiType() const
{
H5FD_mem_t dtype;
- herr_t ret_value = H5Pget_multi_type(id, &dtype);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pget_multi_type(id, &dtype);
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getMultiType", "H5Pget_multi_type failed");
}
- return(dtype);
+ return (dtype);
}
//--------------------------------------------------------------------------
@@ -582,11 +588,11 @@ H5FD_mem_t FileAccPropList::getMultiType() const
/// means fully read chunks are always preempted before other chunks.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileAccPropList::setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0) const
+void
+FileAccPropList::setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0) const
{
herr_t ret_value = H5Pset_cache(id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setCache", "H5Pset_cache failed");
}
}
@@ -601,11 +607,11 @@ void FileAccPropList::setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_n
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileAccPropList::getCache(int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0) const
+void
+FileAccPropList::getCache(int &mdc_nelmts, size_t &rdcc_nelmts, size_t &rdcc_nbytes, double &rdcc_w0) const
{
herr_t ret_value = H5Pget_cache(id, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getCache", "H5Pget_cache failed");
}
}
@@ -617,11 +623,11 @@ void FileAccPropList::getCache(int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdc
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setFcloseDegree(H5F_close_degree_t degree) const
+void
+FileAccPropList::setFcloseDegree(H5F_close_degree_t degree) const
{
herr_t ret_value = H5Pset_fclose_degree(id, degree);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setFcloseDegree", "H5Pset_fclose_degree failed");
}
}
@@ -633,15 +639,15 @@ void FileAccPropList::setFcloseDegree(H5F_close_degree_t degree) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-H5F_close_degree_t FileAccPropList::getFcloseDegree() const
+H5F_close_degree_t
+FileAccPropList::getFcloseDegree() const
{
H5F_close_degree_t degree;
- herr_t ret_value = H5Pget_fclose_degree(id, &degree);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pget_fclose_degree(id, &degree);
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getFcloseDegree", "H5Pget_fclose_degree failed");
}
- return(degree);
+ return (degree);
}
//--------------------------------------------------------------------------
@@ -655,11 +661,11 @@ H5F_close_degree_t FileAccPropList::getFcloseDegree() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileAccPropList::setGcReferences(unsigned gc_ref) const
+void
+FileAccPropList::setGcReferences(unsigned gc_ref) const
{
herr_t ret_value = H5Pset_gc_references(id, gc_ref);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setGcReferences", "H5Pset_gc_references failed");
}
}
@@ -671,17 +677,17 @@ void FileAccPropList::setGcReferences(unsigned gc_ref) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-unsigned FileAccPropList::getGcReferences() const
+unsigned
+FileAccPropList::getGcReferences() const
{
unsigned gc_ref;
// the name of this routine will be changed to H5Pget_gc_references???
herr_t ret_value = H5Pget_gc_references(id, &gc_ref);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getGcReferences", "H5Pget_gc_references failed");
}
- return(gc_ref);
+ return (gc_ref);
}
//--------------------------------------------------------------------------
@@ -697,12 +703,12 @@ unsigned FileAccPropList::getGcReferences() const
/// the HDF5 C Reference Manual.
// Programmer Dana Robinson - 2020
//--------------------------------------------------------------------------
-void FileAccPropList::setFileLocking(hbool_t use_file_locking, hbool_t ignore_when_disabled) const
+void
+FileAccPropList::setFileLocking(hbool_t use_file_locking, hbool_t ignore_when_disabled) const
{
herr_t ret_value = H5Pset_file_locking(id, use_file_locking, ignore_when_disabled);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setFileLocking", "H5Pset_file_locking failed");
}
}
@@ -720,17 +726,16 @@ void FileAccPropList::setFileLocking(hbool_t use_file_locking, hbool_t ignore_wh
/// the HDF5 C Reference Manual.
// Programmer Dana Robinson - 2020
//--------------------------------------------------------------------------
-void FileAccPropList::getFileLocking(hbool_t& use_file_locking, hbool_t& ignore_when_disabled) const
+void
+FileAccPropList::getFileLocking(hbool_t &use_file_locking, hbool_t &ignore_when_disabled) const
{
herr_t ret_value = H5Pget_file_locking(id, &use_file_locking, &ignore_when_disabled);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getFileLocking", "H5Pget_file_locking failed");
}
}
-
//--------------------------------------------------------------------------
// Function: FileAccPropList::setLibverBounds
///\brief Sets bounds on versions of library format to be used when creating
@@ -759,11 +764,11 @@ void FileAccPropList::getFileLocking(hbool_t& use_file_locking, hbool_t& ignore_
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - March, 2015
//--------------------------------------------------------------------------
-void FileAccPropList::setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const
+void
+FileAccPropList::setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const
{
herr_t ret_value = H5Pset_libver_bounds(id, libver_low, libver_high);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setLibverBounds", "H5Pset_libver_bounds failed");
}
}
@@ -795,11 +800,11 @@ void FileAccPropList::setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libv
/// \li \c H5F_LIBVER_LATEST
// Programmer Binh-Minh Ribler - March, 2015
//--------------------------------------------------------------------------
-void FileAccPropList::getLibverBounds(H5F_libver_t& libver_low, H5F_libver_t& libver_high) const
+void
+FileAccPropList::getLibverBounds(H5F_libver_t &libver_low, H5F_libver_t &libver_high) const
{
herr_t ret_value = H5Pget_libver_bounds(id, &libver_low, &libver_high);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getLibverBounds", "H5Pget_libver_bounds failed");
}
}
@@ -811,4 +816,4 @@ void FileAccPropList::getLibverBounds(H5F_libver_t& libver_low, H5F_libver_t& li
//--------------------------------------------------------------------------
FileAccPropList::~FileAccPropList() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h
index ee90fa4..10bf728 100644
--- a/c++/src/H5FaccProp.h
+++ b/c++/src/H5FaccProp.h
@@ -23,145 +23,145 @@ namespace H5 {
*/
// Inheritance: PropList -> IdComponent
class H5_DLLCPP FileAccPropList : public PropList {
- public:
- ///\brief Default file access property list.
- static const FileAccPropList& DEFAULT;
+ public:
+ ///\brief Default file access property list.
+ static const FileAccPropList &DEFAULT;
- // Creates a file access property list.
- FileAccPropList();
+ // Creates a file access property list.
+ FileAccPropList();
- // Modifies this property list to use the H5FD_STDIO driver
- void setStdio() const;
+ // Modifies this property list to use the H5FD_STDIO driver
+ void setStdio() const;
- // Set file driver for this property list
- void setDriver(hid_t new_driver_id, const void *new_driver_info) const;
+ // Set file driver for this property list
+ void setDriver(hid_t new_driver_id, const void *new_driver_info) const;
- // Returns a low-level file driver identifier.
- hid_t getDriver() const;
+ // Returns a low-level file driver identifier.
+ hid_t getDriver() const;
- // Sets offset for family driver.
- void setFamilyOffset(hsize_t offset) const;
+ // Sets offset for family driver.
+ void setFamilyOffset(hsize_t offset) const;
- // Gets offset for family driver.
- hsize_t getFamilyOffset() const;
+ // Gets offset for family driver.
+ hsize_t getFamilyOffset() const;
- // Modifies this file access property list to use the sec2 driver.
- void setSec2() const;
+ // Modifies this file access property list to use the sec2 driver.
+ void setSec2() const;
- // Modifies this file access property list to use the H5FD_CORE
- // driver.
- void setCore (size_t increment, hbool_t backing_store) const;
+ // Modifies this file access property list to use the H5FD_CORE
+ // driver.
+ void setCore(size_t increment, hbool_t backing_store) const;
- // Queries H5FD_CORE driver properties.
- void getCore (size_t& increment, hbool_t& backing_store) const;
+ // Queries H5FD_CORE driver properties.
+ void getCore(size_t &increment, hbool_t &backing_store) const;
- // Sets this file access properties list to the family driver.
- void setFamily(hsize_t memb_size, const FileAccPropList& memb_plist) const;
+ // Sets this file access properties list to the family driver.
+ void setFamily(hsize_t memb_size, const FileAccPropList &memb_plist) const;
- // Returns information about the family file access property list.
- void getFamily(hsize_t& memb_size, FileAccPropList& memb_plist) const;
- FileAccPropList getFamily(hsize_t& memb_size) const;
+ // Returns information about the family file access property list.
+ void getFamily(hsize_t &memb_size, FileAccPropList &memb_plist) const;
+ FileAccPropList getFamily(hsize_t &memb_size) const;
- // Emulates the old split file driver,
- void setSplit(const FileAccPropList& meta_plist,
- const FileAccPropList& raw_plist,
- const char* meta_ext = ".meta",
- const char* raw_ext = ".raw") const;
- void setSplit(const FileAccPropList& meta_plist,
- const FileAccPropList& raw_plist,
- const H5std_string& meta_ext = ".meta",
- const H5std_string& raw_ext = ".raw") const;
+ // Emulates the old split file driver,
+ void setSplit(const FileAccPropList &meta_plist, const FileAccPropList &raw_plist,
+ const char *meta_ext = ".meta", const char *raw_ext = ".raw") const;
+ void setSplit(const FileAccPropList &meta_plist, const FileAccPropList &raw_plist,
+ const H5std_string &meta_ext = ".meta", const H5std_string &raw_ext = ".raw") const;
- // Sets the maximum size of the data sieve buffer.
- void setSieveBufSize(size_t bufsize) const;
+ // Sets the maximum size of the data sieve buffer.
+ void setSieveBufSize(size_t bufsize) const;
- // Returns the current settings for the data sieve buffer size
- // property
- size_t getSieveBufSize() const;
+ // Returns the current settings for the data sieve buffer size
+ // property
+ size_t getSieveBufSize() const;
- // Sets the minimum size of metadata block allocations.
- void setMetaBlockSize(hsize_t &block_size) const;
+ // Sets the minimum size of metadata block allocations.
+ void setMetaBlockSize(hsize_t &block_size) const;
- // Returns the current metadata block size setting.
- hsize_t getMetaBlockSize() const;
+ // Returns the current metadata block size setting.
+ hsize_t getMetaBlockSize() const;
- // Modifies this file access property list to use the logging driver.
- void setLog(const char *logfile, unsigned flags, size_t buf_size) const;
- void setLog(const H5std_string& logfile, unsigned flags, size_t buf_size) const;
+ // Modifies this file access property list to use the logging driver.
+ void setLog(const char *logfile, unsigned flags, size_t buf_size) const;
+ void setLog(const H5std_string &logfile, unsigned flags, size_t buf_size) const;
- // Sets alignment properties of this file access property list
- void setAlignment(hsize_t threshold = 1, hsize_t alignment = 1) const;
+ // Sets alignment properties of this file access property list
+ void setAlignment(hsize_t threshold = 1, hsize_t alignment = 1) const;
- // Retrieves the current settings for alignment properties from
- // this property list.
- void getAlignment(hsize_t& threshold, hsize_t& alignment) const;
+ // Retrieves the current settings for alignment properties from
+ // this property list.
+ void getAlignment(hsize_t &threshold, hsize_t &alignment) const;
- // Sets data type for multi driver.
- void setMultiType(H5FD_mem_t dtype) const;
+ // Sets data type for multi driver.
+ void setMultiType(H5FD_mem_t dtype) const;
- // Returns the data type property for MULTI driver.
- H5FD_mem_t getMultiType() const;
+ // Returns the data type property for MULTI driver.
+ H5FD_mem_t getMultiType() const;
- // Sets the meta data cache and raw data chunk cache parameters.
- void setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0) const;
+ // Sets the meta data cache and raw data chunk cache parameters.
+ void setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0) const;
- // Queries the meta data cache and raw data chunk cache parameters.
- void getCache(int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0) const;
+ // Queries the meta data cache and raw data chunk cache parameters.
+ void getCache(int &mdc_nelmts, size_t &rdcc_nelmts, size_t &rdcc_nbytes, double &rdcc_w0) const;
- // Sets the degree for the file close behavior.
- void setFcloseDegree(H5F_close_degree_t degree) const;
+ // Sets the degree for the file close behavior.
+ void setFcloseDegree(H5F_close_degree_t degree) const;
- // Returns the degree for the file close behavior.
- H5F_close_degree_t getFcloseDegree() const;
+ // Returns the degree for the file close behavior.
+ H5F_close_degree_t getFcloseDegree() const;
- // Sets file access property list to use the H5FD_DIRECT driver.
- void setFileAccDirect(size_t boundary, size_t block_size, size_t cbuf_size) const;
+ // Sets file access property list to use the H5FD_DIRECT driver.
+ void setFileAccDirect(size_t boundary, size_t block_size, size_t cbuf_size) const;
- // Retrieves information about the direct file access property list.
- void getFileAccDirect(size_t &boundary, size_t &block_size, size_t &cbuf_size) const;
+ // Retrieves information about the direct file access property list.
+ void getFileAccDirect(size_t &boundary, size_t &block_size, size_t &cbuf_size) const;
- // Sets garbage collecting references flag.
- void setGcReferences(unsigned gc_ref = 0) const;
+ // Sets garbage collecting references flag.
+ void setGcReferences(unsigned gc_ref = 0) const;
- // Returns garbage collecting references setting.
- unsigned getGcReferences() const;
+ // Returns garbage collecting references setting.
+ unsigned getGcReferences() const;
- // Sets file locking parameters.
- void setFileLocking(hbool_t use_file_locking, hbool_t ignore_when_disabled) const;
+ // Sets file locking parameters.
+ void setFileLocking(hbool_t use_file_locking, hbool_t ignore_when_disabled) const;
- // Gets file locking parameters.
- void getFileLocking(hbool_t& use_file_locking, hbool_t& ignore_when_disabled) const;
+ // Gets file locking parameters.
+ void getFileLocking(hbool_t &use_file_locking, hbool_t &ignore_when_disabled) const;
- // Sets bounds on versions of library format to be used when creating
- // or writing objects.
- void setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const;
+ // Sets bounds on versions of library format to be used when creating
+ // or writing objects.
+ void setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const;
- // Gets the current settings for the library version format bounds.
- void getLibverBounds(H5F_libver_t& libver_low, H5F_libver_t& libver_high) const;
+ // Gets the current settings for the library version format bounds.
+ void getLibverBounds(H5F_libver_t &libver_low, H5F_libver_t &libver_high) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("FileAccPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("FileAccPropList");
+ }
- // Copy constructor: same as the original FileAccPropList.
- FileAccPropList(const FileAccPropList& original);
+ // Copy constructor: same as the original FileAccPropList.
+ FileAccPropList(const FileAccPropList &original);
- // Creates a copy of an existing file access property list
- // using the property list id.
- FileAccPropList (const hid_t plist_id);
+ // Creates a copy of an existing file access property list
+ // using the property list id.
+ FileAccPropList(const hid_t plist_id);
- // Noop destructor
- virtual ~FileAccPropList();
+ // Noop destructor
+ virtual ~FileAccPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
- private:
- static FileAccPropList* DEFAULT_;
+ private:
+ static FileAccPropList *DEFAULT_;
- // Creates the global constant, should only be used by the library
- static FileAccPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static FileAccPropList *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp
index 9b0fecc..4bbebfd 100644
--- a/c++/src/H5FcreatProp.cpp
+++ b/c++/src/H5FcreatProp.cpp
@@ -27,7 +27,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-FileCreatPropList* FileCreatPropList::DEFAULT_ = 0;
+FileCreatPropList *FileCreatPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: FileCreatPropList::getConstant
@@ -39,13 +39,13 @@ FileCreatPropList* FileCreatPropList::DEFAULT_ = 0;
// object, throw a PropListIException. This scenario should not happen.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-FileCreatPropList* FileCreatPropList::getConstant()
+FileCreatPropList *
+FileCreatPropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -54,8 +54,9 @@ FileCreatPropList* FileCreatPropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new FileCreatPropList(H5P_FILE_CREATE);
else
- throw PropListIException("FileCreatPropList::getConstant", "FileCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException("FileCreatPropList::getConstant",
+ "FileCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -64,7 +65,8 @@ FileCreatPropList* FileCreatPropList::getConstant()
// points to.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void FileCreatPropList::deleteConstants()
+void
+FileCreatPropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -73,7 +75,7 @@ void FileCreatPropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose Constant for default property
//--------------------------------------------------------------------------
-const FileCreatPropList& FileCreatPropList::DEFAULT = *getConstant();
+const FileCreatPropList &FileCreatPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -91,7 +93,7 @@ FileCreatPropList::FileCreatPropList() : PropList(H5P_FILE_CREATE) {}
///\param original - IN: FileCreatPropList instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FileCreatPropList::FileCreatPropList(const FileCreatPropList& original) : PropList( original ) {}
+FileCreatPropList::FileCreatPropList(const FileCreatPropList &original) : PropList(original) {}
//--------------------------------------------------------------------------
// Function: FileCreatPropList overloaded constructor
@@ -115,13 +117,12 @@ FileCreatPropList::FileCreatPropList(const hid_t plist_id) : PropList(plist_id)
/// Any (or even all) of the output arguments can be null pointers.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::getVersion(unsigned& super, unsigned& freelist, unsigned& stab, unsigned& shhdr) const
+void
+FileCreatPropList::getVersion(unsigned &super, unsigned &freelist, unsigned &stab, unsigned &shhdr) const
{
herr_t ret_value = H5Pget_version(id, &super, &freelist, &stab, &shhdr);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::getVersion",
- "H5Pget_version failed");
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::getVersion", "H5Pget_version failed");
}
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -136,13 +137,12 @@ void FileCreatPropList::getVersion(unsigned& super, unsigned& freelist, unsigned
/// of 2 equal to 512 or greater (512, 1024, 2048, etc.)
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::setUserblock(hsize_t size) const
+void
+FileCreatPropList::setUserblock(hsize_t size) const
{
herr_t ret_value = H5Pset_userblock(id, size);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::setUserblock",
- "H5Pset_userblock failed");
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::setUserblock", "H5Pset_userblock failed");
}
}
@@ -153,16 +153,15 @@ void FileCreatPropList::setUserblock(hsize_t size) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-hsize_t FileCreatPropList::getUserblock() const
+hsize_t
+FileCreatPropList::getUserblock() const
{
hsize_t userblock_size;
- herr_t ret_value = H5Pget_userblock(id, &userblock_size);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::getUserblock",
- "H5Pget_userblock failed");
+ herr_t ret_value = H5Pget_userblock(id, &userblock_size);
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::getUserblock", "H5Pget_userblock failed");
}
- return(userblock_size);
+ return (userblock_size);
}
//--------------------------------------------------------------------------
@@ -177,13 +176,12 @@ hsize_t FileCreatPropList::getUserblock() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::setSizes(size_t sizeof_addr, size_t sizeof_size) const
+void
+FileCreatPropList::setSizes(size_t sizeof_addr, size_t sizeof_size) const
{
herr_t ret_value = H5Pset_sizes(id, sizeof_addr, sizeof_size);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::setSizes",
- "H5Pset_sizes failed");
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::setSizes", "H5Pset_sizes failed");
}
}
@@ -195,13 +193,12 @@ void FileCreatPropList::setSizes(size_t sizeof_addr, size_t sizeof_size) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::getSizes(size_t& sizeof_addr, size_t& sizeof_size) const
+void
+FileCreatPropList::getSizes(size_t &sizeof_addr, size_t &sizeof_size) const
{
herr_t ret_value = H5Pget_sizes(id, &sizeof_addr, &sizeof_size);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::getSizes",
- "H5Pget_sizes failed");
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::getSizes", "H5Pget_sizes failed");
}
}
@@ -217,13 +214,12 @@ void FileCreatPropList::getSizes(size_t& sizeof_addr, size_t& sizeof_size) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::setSymk(unsigned ik, unsigned lk) const
+void
+FileCreatPropList::setSymk(unsigned ik, unsigned lk) const
{
herr_t ret_value = H5Pset_sym_k(id, ik, lk);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::setSymk",
- "H5Pset_sym_k failed");
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::setSymk", "H5Pset_sym_k failed");
}
}
@@ -238,13 +234,12 @@ void FileCreatPropList::setSymk(unsigned ik, unsigned lk) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::getSymk(unsigned& ik, unsigned& lk) const
+void
+FileCreatPropList::getSymk(unsigned &ik, unsigned &lk) const
{
herr_t ret_value = H5Pget_sym_k(id, &ik, &lk);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::getSymk",
- "H5Pget_sym_k failed");
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::getSymk", "H5Pget_sym_k failed");
}
}
@@ -259,13 +254,12 @@ void FileCreatPropList::getSymk(unsigned& ik, unsigned& lk) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::setIstorek(unsigned ik) const
+void
+FileCreatPropList::setIstorek(unsigned ik) const
{
herr_t ret_value = H5Pset_istore_k(id, ik);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::setIstorek",
- "H5Pset_istore_k failed");
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::setIstorek", "H5Pset_istore_k failed");
}
}
@@ -279,16 +273,15 @@ void FileCreatPropList::setIstorek(unsigned ik) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-unsigned FileCreatPropList::getIstorek() const
+unsigned
+FileCreatPropList::getIstorek() const
{
unsigned ik;
- herr_t ret_value = H5Pget_istore_k(id, &ik);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::getIstorek",
- "H5Pget_istore_k failed");
+ herr_t ret_value = H5Pget_istore_k(id, &ik);
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::getIstorek", "H5Pget_istore_k failed");
}
- return(ik);
+ return (ik);
}
//--------------------------------------------------------------------------
@@ -309,13 +302,14 @@ unsigned FileCreatPropList::getIstorek() const
/// API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
-void FileCreatPropList::setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold) const
+void
+FileCreatPropList::setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist,
+ hsize_t threshold) const
{
herr_t ret_value = H5Pset_file_space_strategy(id, strategy, persist, threshold);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileCreatPropList::setFileSpaceStrategy",
- "H5Pset_file_space_strategy failed");
+ "H5Pset_file_space_strategy failed");
}
}
@@ -329,13 +323,14 @@ void FileCreatPropList::setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbo
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
-void FileCreatPropList::getFileSpaceStrategy(H5F_fspace_strategy_t& strategy, hbool_t& persist, hsize_t& threshold) const
+void
+FileCreatPropList::getFileSpaceStrategy(H5F_fspace_strategy_t &strategy, hbool_t &persist,
+ hsize_t &threshold) const
{
herr_t ret_value = H5Pget_file_space_strategy(id, &strategy, &persist, &threshold);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileCreatPropList::getFileSpaceStrategy",
- "H5Pget_file_space_strategy failed");
+ "H5Pget_file_space_strategy failed");
}
}
@@ -346,13 +341,13 @@ void FileCreatPropList::getFileSpaceStrategy(H5F_fspace_strategy_t& strategy, hb
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
-void FileCreatPropList::setFileSpacePagesize(hsize_t fsp_psize) const
+void
+FileCreatPropList::setFileSpacePagesize(hsize_t fsp_psize) const
{
herr_t ret_value = H5Pset_file_space_page_size(id, fsp_psize);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileCreatPropList::setFileSpacePagesize",
- "H5Pset_file_space_page_size failed");
+ "H5Pset_file_space_page_size failed");
}
}
@@ -364,16 +359,16 @@ void FileCreatPropList::setFileSpacePagesize(hsize_t fsp_psize) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
-hsize_t FileCreatPropList::getFileSpacePagesize() const
+hsize_t
+FileCreatPropList::getFileSpacePagesize() const
{
hsize_t fsp_psize = 0;
- herr_t ret_value = H5Pget_file_space_page_size(id, &fsp_psize);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pget_file_space_page_size(id, &fsp_psize);
+ if (ret_value < 0) {
throw PropListIException("FileCreatPropList::getFileSpacePagesize",
- "H5Pget_file_space_page_size failed");
+ "H5Pget_file_space_page_size failed");
}
- return(fsp_psize);
+ return (fsp_psize);
}
//--------------------------------------------------------------------------
@@ -383,4 +378,4 @@ hsize_t FileCreatPropList::getFileSpacePagesize() const
//--------------------------------------------------------------------------
FileCreatPropList::~FileCreatPropList() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h
index cc28920..d19b60d 100644
--- a/c++/src/H5FcreatProp.h
+++ b/c++/src/H5FcreatProp.h
@@ -23,82 +23,86 @@ namespace H5 {
*/
// Inheritance: PropList -> IdComponent
class H5_DLLCPP FileCreatPropList : public PropList {
- public:
- ///\brief Default file creation property list.
- static const FileCreatPropList& DEFAULT;
+ public:
+ ///\brief Default file creation property list.
+ static const FileCreatPropList &DEFAULT;
- // Creates a file create property list.
- FileCreatPropList();
+ // Creates a file create property list.
+ FileCreatPropList();
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Retrieves version information for various parts of a file.
- void getVersion(unsigned& super, unsigned& freelist, unsigned& stab, unsigned& shhdr) const;
+ // Retrieves version information for various parts of a file.
+ void getVersion(unsigned &super, unsigned &freelist, unsigned &stab, unsigned &shhdr) const;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- // Sets the userblock size field of a file creation property list.
- void setUserblock(hsize_t size) const;
+ // Sets the userblock size field of a file creation property list.
+ void setUserblock(hsize_t size) const;
- // Gets the size of a user block in this file creation property list.
- hsize_t getUserblock() const;
+ // Gets the size of a user block in this file creation property list.
+ hsize_t getUserblock() const;
- // Retrieves the size-of address and size quantities stored in a
- // file according to this file creation property list.
- void getSizes(size_t& sizeof_addr, size_t& sizeof_size) const;
+ // Retrieves the size-of address and size quantities stored in a
+ // file according to this file creation property list.
+ void getSizes(size_t &sizeof_addr, size_t &sizeof_size) const;
- // Sets file size-of addresses and sizes.
- void setSizes(size_t sizeof_addr = 4, size_t sizeof_size = 4) const;
+ // Sets file size-of addresses and sizes.
+ void setSizes(size_t sizeof_addr = 4, size_t sizeof_size = 4) const;
- // Retrieves the size of the symbol table B-tree 1/2 rank and the
- // symbol table leaf node 1/2 size.
- void getSymk(unsigned& int_nodes_k, unsigned& leaf_nodes_k) const;
+ // Retrieves the size of the symbol table B-tree 1/2 rank and the
+ // symbol table leaf node 1/2 size.
+ void getSymk(unsigned &int_nodes_k, unsigned &leaf_nodes_k) const;
- // Sets the size of parameters used to control the symbol table nodes.
- void setSymk(unsigned int_nodes_k, unsigned leaf_nodes_k) const;
+ // Sets the size of parameters used to control the symbol table nodes.
+ void setSymk(unsigned int_nodes_k, unsigned leaf_nodes_k) const;
- // Returns the 1/2 rank of an indexed storage B-tree.
- unsigned getIstorek() const;
+ // Returns the 1/2 rank of an indexed storage B-tree.
+ unsigned getIstorek() const;
- // Sets the size of parameter used to control the B-trees for
- // indexing chunked datasets.
- void setIstorek(unsigned ik) const;
+ // Sets the size of parameter used to control the B-trees for
+ // indexing chunked datasets.
+ void setIstorek(unsigned ik) const;
- // Sets the strategy and the threshold value that the library will
- // will employ in managing file space.
- void setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold) const;
+ // Sets the strategy and the threshold value that the library will
+ // will employ in managing file space.
+ void setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold) const;
- // Returns the strategy that the library uses in managing file space.
- void getFileSpaceStrategy(H5F_fspace_strategy_t& strategy, hbool_t& persist, hsize_t& threshold) const;
+ // Returns the strategy that the library uses in managing file space.
+ void getFileSpaceStrategy(H5F_fspace_strategy_t &strategy, hbool_t &persist, hsize_t &threshold) const;
- // Sets the file space page size for paged aggregation.
- void setFileSpacePagesize(hsize_t fsp_psize) const;
+ // Sets the file space page size for paged aggregation.
+ void setFileSpacePagesize(hsize_t fsp_psize) const;
- // Returns the threshold value that the library uses in tracking free
- // space sections.
- hsize_t getFileSpacePagesize() const;
+ // Returns the threshold value that the library uses in tracking free
+ // space sections.
+ hsize_t getFileSpacePagesize() const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass() const { return("FileCreatPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("FileCreatPropList");
+ }
- // Copy constructor: same as the original FileCreatPropList.
- FileCreatPropList(const FileCreatPropList& orig);
+ // Copy constructor: same as the original FileCreatPropList.
+ FileCreatPropList(const FileCreatPropList &orig);
- // Creates a copy of an existing file create property list
- // using the property list id.
- FileCreatPropList(const hid_t plist_id);
+ // Creates a copy of an existing file create property list
+ // using the property list id.
+ FileCreatPropList(const hid_t plist_id);
- // Noop destructor
- virtual ~FileCreatPropList();
+ // Noop destructor
+ virtual ~FileCreatPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
- private:
- static FileCreatPropList* DEFAULT_;
+ private:
+ static FileCreatPropList *DEFAULT_;
- // Creates the global constant, should only be used by the library
- static FileCreatPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static FileCreatPropList *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index b9ecded..2ed3508 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -41,8 +41,8 @@
#include "H5Alltypes.h"
namespace H5 {
- using std::cerr;
- using std::endl;
+using std::cerr;
+using std::endl;
//--------------------------------------------------------------------------
// Function H5File default constructor
@@ -81,11 +81,14 @@ H5File::H5File() : Group(), id(H5I_INVALID_HID) {}
// block here to catch then re-throw it. -BMR 2013/03/21
// December 2000
//--------------------------------------------------------------------------
-H5File::H5File(const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist) : Group(), id(H5I_INVALID_HID)
+H5File::H5File(const char *name, unsigned int flags, const FileCreatPropList &create_plist,
+ const FileAccPropList &access_plist)
+ : Group(), id(H5I_INVALID_HID)
{
try {
p_get_file(name, flags, create_plist, access_plist);
- } catch (FileIException& open_file) {
+ }
+ catch (FileIException &open_file) {
throw open_file;
}
}
@@ -106,11 +109,14 @@ H5File::H5File(const char* name, unsigned int flags, const FileCreatPropList& cr
// block here to catch then re-throw it. -BMR 2013/03/21
// December 2000
//--------------------------------------------------------------------------
-H5File::H5File(const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist) : Group(), id(H5I_INVALID_HID)
+H5File::H5File(const H5std_string &name, unsigned int flags, const FileCreatPropList &create_plist,
+ const FileAccPropList &access_plist)
+ : Group(), id(H5I_INVALID_HID)
{
try {
p_get_file(name.c_str(), flags, create_plist, access_plist);
- } catch (FileIException& open_file) {
+ }
+ catch (FileIException &open_file) {
throw open_file;
}
}
@@ -123,26 +129,26 @@ H5File::H5File(const H5std_string& name, unsigned int flags, const FileCreatProp
// - removed H5F_ACC_CREAT because H5Fcreate will fail with
// H5F_ACC_CREAT. - BMR, Sep 17, 2014
//--------------------------------------------------------------------------
-void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist)
+void
+H5File::p_get_file(const char *name, unsigned int flags, const FileCreatPropList &create_plist,
+ const FileAccPropList &access_plist)
{
// These bits only set for creation, so if any of them are set,
// create the file.
- if (flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC))
- {
+ if (flags & (H5F_ACC_EXCL | H5F_ACC_TRUNC)) {
hid_t create_plist_id = create_plist.getId();
hid_t access_plist_id = access_plist.getId();
- id = H5Fcreate(name, flags, create_plist_id, access_plist_id);
- if (id < 0) // throw an exception when open/create fail
+ id = H5Fcreate(name, flags, create_plist_id, access_plist_id);
+ if (id < 0) // throw an exception when open/create fail
{
throw FileIException("H5File constructor", "H5Fcreate failed");
}
}
// Open the file if none of the bits above are set.
- else
- {
+ else {
hid_t access_plist_id = access_plist.getId();
- id = H5Fopen(name, flags, access_plist_id);
- if (id < 0) // throw an exception when open/create fail
+ id = H5Fopen(name, flags, access_plist_id);
+ if (id < 0) // throw an exception when open/create fail
{
throw FileIException("H5File constructor", "H5Fopen failed");
}
@@ -176,7 +182,7 @@ H5File::H5File(hid_t existing_id) : Group()
///\param original - IN: H5File instance to copy
// December 2000
//--------------------------------------------------------------------------
-H5File::H5File(const H5File& original) : Group()
+H5File::H5File(const H5File &original) : Group()
{
id = original.getId();
incRefCount(); // increment number of references to this id
@@ -190,7 +196,8 @@ H5File::H5File(const H5File& original) : Group()
///\exception H5::FileIException
// December 2000
//--------------------------------------------------------------------------
-bool H5File::isHdf5(const char* name)
+bool
+H5File::isHdf5(const char *name)
{
// Calls C routine H5Fis_accessible to determine whether the file is in
// HDF5 format. It returns positive value, 0, or negative value
@@ -213,9 +220,10 @@ bool H5File::isHdf5(const char* name)
///\param name - IN: Name of the file - \c H5std_string
// December 2000
//--------------------------------------------------------------------------
-bool H5File::isHdf5(const H5std_string& name)
+bool
+H5File::isHdf5(const H5std_string &name)
{
- return(isHdf5( name.c_str()));
+ return (isHdf5(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -228,12 +236,13 @@ bool H5File::isHdf5(const H5std_string& name)
///\exception H5::FileIException
// September 2018
//--------------------------------------------------------------------------
-bool H5File::isAccessible(const char* name, const FileAccPropList& access_plist)
+bool
+H5File::isAccessible(const char *name, const FileAccPropList &access_plist)
{
// Calls C routine H5Fis_accessible to determine whether the file is in
// HDF5 format. It returns positive value, 0, or negative value
- hid_t access_plist_id = access_plist.getId();
- htri_t ret_value = H5Fis_accessible(name, access_plist_id);
+ hid_t access_plist_id = access_plist.getId();
+ htri_t ret_value = H5Fis_accessible(name, access_plist_id);
if (ret_value > 0)
return true;
else if (ret_value == 0)
@@ -253,9 +262,10 @@ bool H5File::isAccessible(const char* name, const FileAccPropList& access_plist)
/// FileAccPropList::DEFAULT
// September 2018
//--------------------------------------------------------------------------
-bool H5File::isAccessible(const H5std_string& name, const FileAccPropList& access_plist)
+bool
+H5File::isAccessible(const H5std_string &name, const FileAccPropList &access_plist)
{
- return(isAccessible(name.c_str(), access_plist));
+ return (isAccessible(name.c_str(), access_plist));
}
//--------------------------------------------------------------------------
@@ -276,18 +286,19 @@ bool H5File::isAccessible(const H5std_string& name, const FileAccPropList& acces
///
// October 2005
//--------------------------------------------------------------------------
-void H5File::openFile(const char* name, unsigned int flags, const FileAccPropList& access_plist)
+void
+H5File::openFile(const char *name, unsigned int flags, const FileAccPropList &access_plist)
{
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw FileIException("H5File::openFile", close_error.getDetailMsg());
}
hid_t access_plist_id = access_plist.getId();
- id = H5Fopen (name, flags, access_plist_id);
- if (id < 0) // throw an exception when open fails
+ id = H5Fopen(name, flags, access_plist_id);
+ if (id < 0) // throw an exception when open fails
{
throw FileIException("H5File::openFile", "H5Fopen failed");
}
@@ -303,7 +314,8 @@ void H5File::openFile(const char* name, unsigned int flags, const FileAccPropLis
/// FileAccPropList::DEFAULT
// December 2000
//--------------------------------------------------------------------------
-void H5File::openFile(const H5std_string& name, unsigned int flags, const FileAccPropList& access_plist)
+void
+H5File::openFile(const H5std_string &name, unsigned int flags, const FileAccPropList &access_plist)
{
openFile(name.c_str(), flags, access_plist);
}
@@ -324,12 +336,13 @@ void H5File::openFile(const H5std_string& name, unsigned int flags, const FileAc
// - Replaced decRefCount with close() to let the C library
// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
-void H5File::reOpen()
+void
+H5File::reOpen()
{
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw FileIException("H5File::reOpen", close_error.getDetailMsg());
}
@@ -347,19 +360,18 @@ void H5File::reOpen()
///\exception H5::FileIException
// December 2000
//--------------------------------------------------------------------------
-FileCreatPropList H5File::getCreatePlist() const
+FileCreatPropList
+H5File::getCreatePlist() const
{
hid_t create_plist_id = H5Fget_create_plist(id);
// if H5Fget_create_plist returns a valid id, create and return
// the FileCreatPropList object for this property list
- if (create_plist_id > 0)
- {
- FileCreatPropList create_plist(create_plist_id);
- return(create_plist);
+ if (create_plist_id > 0) {
+ FileCreatPropList create_plist(create_plist_id);
+ return (create_plist);
}
- else
- {
+ else {
throw FileIException("H5File::getCreatePlist", "H5Fget_create_plist failed");
}
}
@@ -371,16 +383,16 @@ FileCreatPropList H5File::getCreatePlist() const
///\exception H5::FileIException
// December 2000
//--------------------------------------------------------------------------
-FileAccPropList H5File::getAccessPlist() const
+FileAccPropList
+H5File::getAccessPlist() const
{
hid_t access_plist_id = H5Fget_access_plist(id);
// if H5Fget_access_plist returns a valid id, create and return
// the FileAccPropList object for this property list
- if (access_plist_id > 0)
- {
- FileAccPropList access_plist(access_plist_id);
- return access_plist;
+ if (access_plist_id > 0) {
+ FileAccPropList access_plist(access_plist_id);
+ return access_plist;
}
else // Raise an exception
{
@@ -398,11 +410,11 @@ FileAccPropList H5File::getAccessPlist() const
/// superblock extension, free space management, and shared object
// February 2017
//--------------------------------------------------------------------------
-void H5File::getFileInfo(H5F_info2_t& file_info) const
+void
+H5File::getFileInfo(H5F_info2_t &file_info) const
{
herr_t ret_value = H5Fget_info2(id, &file_info);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw FileIException("H5File::getFileInfo", "H5Fget_info2 failed");
}
}
@@ -414,17 +426,16 @@ void H5File::getFileInfo(H5F_info2_t& file_info) const
///\exception H5::FileIException
// May 2004
//--------------------------------------------------------------------------
-hssize_t H5File::getFreeSpace() const
+hssize_t
+H5File::getFreeSpace() const
{
hssize_t free_space = H5Fget_freespace(id);
- if (free_space < 0)
- {
+ if (free_space < 0) {
throw FileIException("H5File::getFreeSpace", "H5Fget_freespace failed");
}
return (free_space);
}
-
//--------------------------------------------------------------------------
// Function: H5File::getObjCount
///\brief Returns the number of opened object IDs (files, datasets,
@@ -446,11 +457,11 @@ hssize_t H5File::getFreeSpace() const
/// Multiple object types can be combined with the logical OR operator (|).
// May 2004
//--------------------------------------------------------------------------
-ssize_t H5File::getObjCount(unsigned types) const
+ssize_t
+H5File::getObjCount(unsigned types) const
{
ssize_t num_objs = H5Fget_obj_count(id, types);
- if (num_objs < 0)
- {
+ if (num_objs < 0) {
throw FileIException("H5File::getObjCount", "H5Fget_obj_count failed");
}
return (num_objs);
@@ -481,11 +492,11 @@ ssize_t H5File::getObjCount(unsigned types) const
// Notes: will do the overload for this one after hearing from Quincey???
// May 2004
//--------------------------------------------------------------------------
-void H5File::getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const
+void
+H5File::getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const
{
ssize_t ret_value = H5Fget_obj_ids(id, types, max_objs, oid_list);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw FileIException("H5File::getObjIDs", "H5Fget_obj_ids failed");
}
}
@@ -509,12 +520,12 @@ void H5File::getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const
/// closed and reopened or opened during a subsequent session.
// May 2004
//--------------------------------------------------------------------------
-void H5File::getVFDHandle(const FileAccPropList& fapl, void **file_handle) const
+void
+H5File::getVFDHandle(const FileAccPropList &fapl, void **file_handle) const
{
- hid_t fapl_id = fapl.getId();
+ hid_t fapl_id = fapl.getId();
herr_t ret_value = H5Fget_vfd_handle(id, fapl_id, file_handle);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw FileIException("H5File::getVFDHandle", "H5Fget_vfd_handle failed");
}
}
@@ -534,7 +545,7 @@ void H5File::getVFDHandle(const FileAccPropList& fapl, void **file_handle) const
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//void H5File::getVFDHandle(FileAccPropList& fapl, void **file_handle) const
+// void H5File::getVFDHandle(FileAccPropList& fapl, void **file_handle) const
//{
// getVFDHandle((const FileAccPropList)fapl, file_handle);
//}
@@ -549,11 +560,11 @@ void H5File::getVFDHandle(const FileAccPropList& fapl, void **file_handle) const
///\exception H5::FileIException
// May 2004
//--------------------------------------------------------------------------
-void H5File::getVFDHandle(void **file_handle) const
+void
+H5File::getVFDHandle(void **file_handle) const
{
herr_t ret_value = H5Fget_vfd_handle(id, H5P_DEFAULT, file_handle);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw FileIException("H5File::getVFDHandle", "H5Fget_vfd_handle failed");
}
}
@@ -568,12 +579,12 @@ void H5File::getVFDHandle(void **file_handle) const
/// order to learn the true size of the underlying file.
// Programmer Raymond Lu - June 24, 2004
//--------------------------------------------------------------------------
-hsize_t H5File::getFileSize() const
+hsize_t
+H5File::getFileSize() const
{
hsize_t file_size;
- herr_t ret_value = H5Fget_filesize(id, &file_size);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Fget_filesize(id, &file_size);
+ if (ret_value < 0) {
throw FileIException("H5File::getFileSize", "H5Fget_filesize failed");
}
return (file_size);
@@ -589,12 +600,12 @@ hsize_t H5File::getFileSize() const
/// order to retrieve the unique 'file number' for the file.
// Programmer Quincey Koziol - April 13, 2019
//--------------------------------------------------------------------------
-unsigned long H5File::getFileNum() const
+unsigned long
+H5File::getFileNum() const
{
- unsigned long fileno = 0;
- herr_t ret_value = H5Fget_fileno(id, &fileno);
- if (ret_value < 0)
- {
+ unsigned long fileno = 0;
+ herr_t ret_value = H5Fget_fileno(id, &fileno);
+ if (ret_value < 0) {
throw FileIException("H5File::getFileNum", "H5Fget_fileno failed");
}
return (fileno);
@@ -612,9 +623,10 @@ unsigned long H5File::getFileNum() const
// IdComponent::getId now becomes pure virtual function.
// May, 2008
//--------------------------------------------------------------------------
-hid_t H5File::getId() const
+hid_t
+H5File::getId() const
{
- return(id);
+ return (id);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -626,7 +638,8 @@ hid_t H5File::getId() const
// This function is replaced by the above function reOpen.
// December 2000
//--------------------------------------------------------------------------
-void H5File::reopen()
+void
+H5File::reopen()
{
H5File::reOpen();
}
@@ -643,9 +656,10 @@ void H5File::reopen()
// After HDFFV-9920, the Group's methods can use getId() and
// getLocId() is kept for backward compatibility.
//--------------------------------------------------------------------------
-hid_t H5File::getLocId() const
+hid_t
+H5File::getLocId() const
{
- return(getId());
+ return (getId());
}
//--------------------------------------------------------------------------
@@ -660,13 +674,14 @@ hid_t H5File::getLocId() const
// Then the object's id is reset to the new id.
// December 2000
//--------------------------------------------------------------------------
-void H5File::p_setId(const hid_t new_id)
+void
+H5File::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
- catch (Exception& E) {
+ catch (Exception &E) {
throw FileIException("H5File::p_setId", E.getDetailMsg());
}
// reset object's id to the given id
@@ -681,13 +696,12 @@ void H5File::p_setId(const hid_t new_id)
///\exception H5::FileIException
// March 2005
//--------------------------------------------------------------------------
-void H5File::close()
+void
+H5File::close()
{
- if (p_valid_id(id))
- {
+ if (p_valid_id(id)) {
herr_t ret_value = H5Fclose(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw FileIException("H5File::close", "H5Fclose failed");
}
// reset the id
@@ -708,7 +722,8 @@ void H5File::close()
// an implementation of H5File.
// December 2000
//--------------------------------------------------------------------------
-void H5File::throwException(const H5std_string& func_name, const H5std_string& msg) const
+void
+H5File::throwException(const H5std_string &func_name, const H5std_string &msg) const
{
H5std_string full_name = func_name;
full_name.insert(0, "H5File::");
@@ -729,9 +744,10 @@ H5File::~H5File()
{
try {
close();
- } catch (Exception& close_error) {
+ }
+ catch (Exception &close_error) {
cerr << "H5File::~H5File - " << close_error.getDetailMsg() << endl;
}
}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index 1b1227f..9231d5f 100644
--- a/c++/src/H5File.h
+++ b/c++/src/H5File.h
@@ -23,111 +23,117 @@ namespace H5 {
*/
// Inheritance: Group -> CommonFG/H5Object -> H5Location -> IdComponent
class H5_DLLCPP H5File : public Group {
- public:
- // Creates or opens an HDF5 file.
- H5File(const char* name, unsigned int flags,
- const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT,
- const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
- H5File(const H5std_string& name, unsigned int flags,
- const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT,
- const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
+ public:
+ // Creates or opens an HDF5 file.
+ H5File(const char *name, unsigned int flags,
+ const FileCreatPropList &create_plist = FileCreatPropList::DEFAULT,
+ const FileAccPropList & access_plist = FileAccPropList::DEFAULT);
+ H5File(const H5std_string &name, unsigned int flags,
+ const FileCreatPropList &create_plist = FileCreatPropList::DEFAULT,
+ const FileAccPropList & access_plist = FileAccPropList::DEFAULT);
- // Open the file
- void openFile(const H5std_string& name, unsigned int flags,
- const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
- void openFile(const char* name, unsigned int flags,
- const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
+ // Open the file
+ void openFile(const H5std_string &name, unsigned int flags,
+ const FileAccPropList &access_plist = FileAccPropList::DEFAULT);
+ void openFile(const char *name, unsigned int flags,
+ const FileAccPropList &access_plist = FileAccPropList::DEFAULT);
- // Close this file.
- virtual void close();
+ // Close this file.
+ virtual void close();
- // Gets a copy of the access property list of this file.
- FileAccPropList getAccessPlist() const;
+ // Gets a copy of the access property list of this file.
+ FileAccPropList getAccessPlist() const;
- // Gets a copy of the creation property list of this file.
- FileCreatPropList getCreatePlist() const;
+ // Gets a copy of the creation property list of this file.
+ FileCreatPropList getCreatePlist() const;
- // Gets general information about this file.
- void getFileInfo(H5F_info2_t& file_info) const;
+ // Gets general information about this file.
+ void getFileInfo(H5F_info2_t &file_info) const;
- // Returns the amount of free space in the file.
- hssize_t getFreeSpace() const;
+ // Returns the amount of free space in the file.
+ hssize_t getFreeSpace() const;
- // Returns the number of opened object IDs (files, datasets, groups
- // and datatypes) in the same file.
- ssize_t getObjCount(unsigned types = H5F_OBJ_ALL) const;
+ // Returns the number of opened object IDs (files, datasets, groups
+ // and datatypes) in the same file.
+ ssize_t getObjCount(unsigned types = H5F_OBJ_ALL) const;
- // Retrieves a list of opened object IDs (files, datasets, groups
- // and datatypes) in the same file.
- void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const;
+ // Retrieves a list of opened object IDs (files, datasets, groups
+ // and datatypes) in the same file.
+ void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const;
- // Returns the pointer to the file handle of the low-level file driver.
- void getVFDHandle(void **file_handle) const;
- void getVFDHandle(const FileAccPropList& fapl, void **file_handle) const;
- //void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; // removed from 1.8.18 and 1.10.1
+ // Returns the pointer to the file handle of the low-level file driver.
+ void getVFDHandle(void **file_handle) const;
+ void getVFDHandle(const FileAccPropList &fapl, void **file_handle) const;
+ // void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; // removed from 1.8.18 and 1.10.1
- // Returns the file size of the HDF5 file.
- hsize_t getFileSize() const;
+ // Returns the file size of the HDF5 file.
+ hsize_t getFileSize() const;
- // Returns the 'file number' of the HDF5 file.
- unsigned long getFileNum() const;
+ // Returns the 'file number' of the HDF5 file.
+ unsigned long getFileNum() const;
- // Determines if a file, specified by its name, is in HDF5 format
- static bool isHdf5(const char* name);
- static bool isHdf5(const H5std_string& name);
+ // Determines if a file, specified by its name, is in HDF5 format
+ static bool isHdf5(const char *name);
+ static bool isHdf5(const H5std_string &name);
- // Determines if a file, specified by its name, can be accessed as HDF5
- static bool isAccessible(const char* name, const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
- static bool isAccessible(const H5std_string& name, const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
+ // Determines if a file, specified by its name, can be accessed as HDF5
+ static bool isAccessible(const char * name,
+ const FileAccPropList &access_plist = FileAccPropList::DEFAULT);
+ static bool isAccessible(const H5std_string & name,
+ const FileAccPropList &access_plist = FileAccPropList::DEFAULT);
- // Reopens this file.
- void reOpen(); // added for better name
+ // Reopens this file.
+ void reOpen(); // added for better name
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- void reopen(); // obsolete in favor of reOpen()
+ void reopen(); // obsolete in favor of reOpen()
- // Creates an H5File using an existing file id. Not recommended
- // in applications.
- H5File(hid_t existing_id);
+ // Creates an H5File using an existing file id. Not recommended
+ // in applications.
+ H5File(hid_t existing_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("H5File"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("H5File");
+ }
- // Throw file exception.
- virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
+ // Throw file exception.
+ virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const;
- // For CommonFG to get the file id.
- virtual hid_t getLocId() const;
+ // For CommonFG to get the file id.
+ virtual hid_t getLocId() const;
- // Default constructor
- H5File();
+ // Default constructor
+ H5File();
- // Copy constructor: same as the original H5File.
- H5File(const H5File& original);
+ // Copy constructor: same as the original H5File.
+ H5File(const H5File &original);
- // Gets the HDF5 file id.
- virtual hid_t getId() const;
+ // Gets the HDF5 file id.
+ virtual hid_t getId() const;
- // H5File destructor.
- virtual ~H5File();
+ // H5File destructor.
+ virtual ~H5File();
- protected:
+ protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Sets the HDF5 file id.
- virtual void p_setId(const hid_t new_id);
+ // Sets the HDF5 file id.
+ virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
- private:
- hid_t id; // HDF5 file id
+ private:
+ hid_t id; // HDF5 file id
- // This function is private and contains common code between the
- // constructors taking a string or a char*
- void p_get_file(const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist);
+ // This function is private and contains common code between the
+ // constructors taking a string or a char*
+ void p_get_file(const char *name, unsigned int flags, const FileCreatPropList &create_plist,
+ const FileAccPropList &access_plist);
}; // end of H5File
} // namespace H5
#endif // __H5File_H
-
diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp
index aba826e..7979cfa 100644
--- a/c++/src/H5FloatType.cpp
+++ b/c++/src/H5FloatType.cpp
@@ -49,7 +49,7 @@ FloatType::FloatType() {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType::FloatType(const PredType& pred_type) : AtomType()
+FloatType::FloatType(const PredType &pred_type) : AtomType()
{
// use DataType::copy to make a copy of this predefined type
copy(pred_type);
@@ -63,14 +63,14 @@ FloatType::FloatType(const PredType& pred_type) : AtomType()
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType::FloatType(const hid_t existing_id) : AtomType( existing_id ) {}
+FloatType::FloatType(const hid_t existing_id) : AtomType(existing_id) {}
//--------------------------------------------------------------------------
// Function: FloatType copy constructor
///\brief Copy constructor: same HDF5 object as \a original
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType::FloatType(const FloatType& original) : AtomType( original ){}
+FloatType::FloatType(const FloatType &original) : AtomType(original) {}
//--------------------------------------------------------------------------
// Function: FloatType overloaded constructor
@@ -80,13 +80,12 @@ FloatType::FloatType(const FloatType& original) : AtomType( original ){}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType::FloatType(const DataSet& dataset) : AtomType()
+FloatType::FloatType(const DataSet &dataset) : AtomType()
{
// Calls C function H5Dget_type to get the id of the datatype
id = H5Dget_type(dataset.getId());
- if (id < 0)
- {
+ if (id < 0) {
throw DataSetIException("FloatType constructor", "H5Dget_type failed");
}
}
@@ -105,7 +104,7 @@ FloatType::FloatType(const DataSet& dataset) : AtomType()
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-FloatType::FloatType(const H5Location& loc, const char *dtype_name) : AtomType()
+FloatType::FloatType(const H5Location &loc, const char *dtype_name) : AtomType()
{
id = p_opentype(loc, dtype_name);
}
@@ -124,7 +123,7 @@ FloatType::FloatType(const H5Location& loc, const char *dtype_name) : AtomType()
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-FloatType::FloatType(const H5Location& loc, const H5std_string& dtype_name) : AtomType()
+FloatType::FloatType(const H5Location &loc, const H5std_string &dtype_name) : AtomType()
{
id = p_opentype(loc, dtype_name.c_str());
}
@@ -137,7 +136,8 @@ FloatType::FloatType(const H5Location& loc, const H5std_string& dtype_name) : At
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-DataType* FloatType::decode() const
+DataType *
+FloatType::decode() const
{
hid_t encoded_flttype_id = H5I_INVALID_HID;
try {
@@ -148,7 +148,7 @@ DataType* FloatType::decode() const
}
FloatType *encoded_flttype = new FloatType;
encoded_flttype->p_setId(encoded_flttype_id);
- return(encoded_flttype);
+ return (encoded_flttype);
}
//--------------------------------------------------------------------------
@@ -162,11 +162,11 @@ DataType* FloatType::decode() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FloatType::getFields(size_t& spos, size_t& epos, size_t& esize, size_t& mpos, size_t& msize) const
+void
+FloatType::getFields(size_t &spos, size_t &epos, size_t &esize, size_t &mpos, size_t &msize) const
{
herr_t ret_value = H5Tget_fields(id, &spos, &epos, &esize, &mpos, &msize);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("FloatType::getFields", "H5Tget_fields failed");
}
}
@@ -183,11 +183,11 @@ void FloatType::getFields(size_t& spos, size_t& epos, size_t& esize, size_t& mpo
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FloatType::setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const
+void
+FloatType::setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const
{
herr_t ret_value = H5Tset_fields(id, spos, epos, esize, mpos, msize);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("FloatType::setFields", "H5Tset_fields failed");
}
}
@@ -199,15 +199,15 @@ void FloatType::setFields(size_t spos, size_t epos, size_t esize, size_t mpos, s
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-size_t FloatType::getEbias() const
+size_t
+FloatType::getEbias() const
{
size_t ebias = H5Tget_ebias(id);
// Returns the bias if successful
- if (ebias == 0)
- {
+ if (ebias == 0) {
throw DataTypeIException("FloatType::getEbias", "H5Tget_ebias failed - returned exponent bias as 0");
}
- return(ebias);
+ return (ebias);
}
//--------------------------------------------------------------------------
@@ -217,11 +217,11 @@ size_t FloatType::getEbias() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FloatType::setEbias(size_t ebias) const
+void
+FloatType::setEbias(size_t ebias) const
{
herr_t ret_value = H5Tset_ebias(id, ebias);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("FloatType::setEbias", "H5Tset_ebias failed");
}
}
@@ -241,12 +241,12 @@ void FloatType::setEbias(size_t ebias) const
/// \a norm_string.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_norm_t FloatType::getNorm(H5std_string& norm_string) const
+H5T_norm_t
+FloatType::getNorm(H5std_string &norm_string) const
{
- H5T_norm_t norm = H5Tget_norm(id); // C routine
+ H5T_norm_t norm = H5Tget_norm(id); // C routine
// Returns a valid normalization type if successful
- if (norm == H5T_NORM_ERROR)
- {
+ if (norm == H5T_NORM_ERROR) {
throw DataTypeIException("FloatType::getNorm", "H5Tget_norm failed - returned H5T_NORM_ERROR");
}
if (norm == H5T_NORM_IMPLIED)
@@ -255,7 +255,7 @@ H5T_norm_t FloatType::getNorm(H5std_string& norm_string) const
norm_string = "H5T_NORM_MSBSET (1)";
else if (norm == H5T_NORM_NONE)
norm_string = "H5T_NORM_NONE (2)";
- return(norm);
+ return (norm);
}
//--------------------------------------------------------------------------
@@ -270,11 +270,11 @@ H5T_norm_t FloatType::getNorm(H5std_string& norm_string) const
/// \li \c H5T_NORM_NONE (2) - Mantissa is not normalized
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FloatType::setNorm(H5T_norm_t norm) const
+void
+FloatType::setNorm(H5T_norm_t norm) const
{
herr_t ret_value = H5Tset_norm(id, norm);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("FloatType::setNorm", "H5Tset_norm failed");
}
}
@@ -294,12 +294,12 @@ void FloatType::setNorm(H5T_norm_t norm) const
/// \a pad_string.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_pad_t FloatType::getInpad(H5std_string& pad_string) const
+H5T_pad_t
+FloatType::getInpad(H5std_string &pad_string) const
{
H5T_pad_t pad_type = H5Tget_inpad(id);
// Returns a valid padding type if successful
- if (pad_type == H5T_PAD_ERROR)
- {
+ if (pad_type == H5T_PAD_ERROR) {
throw DataTypeIException("FloatType::getInpad", "H5Tget_inpad failed - returned H5T_PAD_ERROR");
}
if (pad_type == H5T_PAD_ZERO)
@@ -308,7 +308,7 @@ H5T_pad_t FloatType::getInpad(H5std_string& pad_string) const
pad_string = "H5T_PAD_ONE (1)";
else if (pad_type == H5T_PAD_BACKGROUND)
pad_string = "H5T_PAD_BACKGROUD (2)";
- return(pad_type);
+ return (pad_type);
}
//--------------------------------------------------------------------------
@@ -328,11 +328,11 @@ H5T_pad_t FloatType::getInpad(H5std_string& pad_string) const
/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FloatType::setInpad(H5T_pad_t inpad) const
+void
+FloatType::setInpad(H5T_pad_t inpad) const
{
herr_t ret_value = H5Tset_inpad(id, inpad);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("FloatType::setInpad", "H5Tset_inpad failed");
}
}
@@ -344,4 +344,4 @@ void FloatType::setInpad(H5T_pad_t inpad) const
//--------------------------------------------------------------------------
FloatType::~FloatType() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h
index f74a9ae..2368113 100644
--- a/c++/src/H5FloatType.h
+++ b/c++/src/H5FloatType.h
@@ -23,59 +23,63 @@ namespace H5 {
*/
// Inheritance: AtomType -> DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP FloatType : public AtomType {
- public:
- // Creates a floating-point type using a predefined type.
- FloatType(const PredType& pred_type);
+ public:
+ // Creates a floating-point type using a predefined type.
+ FloatType(const PredType &pred_type);
- // Gets the floating-point datatype of the specified dataset.
- FloatType(const DataSet& dataset);
+ // Gets the floating-point datatype of the specified dataset.
+ FloatType(const DataSet &dataset);
- // Constructors that open an HDF5 float datatype, given a location.
- FloatType(const H5Location& loc, const char* name);
- FloatType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open an HDF5 float datatype, given a location.
+ FloatType(const H5Location &loc, const char *name);
+ FloatType(const H5Location &loc, const H5std_string &name);
- // Returns an FloatType object via DataType* by decoding the
- // binary object description of this type.
- virtual DataType* decode() const;
+ // Returns an FloatType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType *decode() const;
- // Retrieves the exponent bias of a floating-point type.
- size_t getEbias() const;
+ // Retrieves the exponent bias of a floating-point type.
+ size_t getEbias() const;
- // Sets the exponent bias of a floating-point type.
- void setEbias(size_t ebias) const;
+ // Sets the exponent bias of a floating-point type.
+ void setEbias(size_t ebias) const;
- // Retrieves floating point datatype bit field information.
- void getFields(size_t& spos, size_t& epos, size_t& esize, size_t& mpos, size_t& msize) const;
+ // Retrieves floating point datatype bit field information.
+ void getFields(size_t &spos, size_t &epos, size_t &esize, size_t &mpos, size_t &msize) const;
- // Sets locations and sizes of floating point bit fields.
- void setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const;
+ // Sets locations and sizes of floating point bit fields.
+ void setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const;
- // Retrieves the internal padding type for unused bits in floating-point datatypes.
- H5T_pad_t getInpad(H5std_string& pad_string) const;
+ // Retrieves the internal padding type for unused bits in floating-point datatypes.
+ H5T_pad_t getInpad(H5std_string &pad_string) const;
- // Fills unused internal floating point bits.
- void setInpad(H5T_pad_t inpad) const;
+ // Fills unused internal floating point bits.
+ void setInpad(H5T_pad_t inpad) const;
- // Retrieves mantissa normalization of a floating-point datatype.
- H5T_norm_t getNorm(H5std_string& norm_string) const;
+ // Retrieves mantissa normalization of a floating-point datatype.
+ H5T_norm_t getNorm(H5std_string &norm_string) const;
- // Sets the mantissa normalization of a floating-point datatype.
- void setNorm(H5T_norm_t norm) const;
+ // Sets the mantissa normalization of a floating-point datatype.
+ void setNorm(H5T_norm_t norm) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("FloatType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("FloatType");
+ }
- // Default constructor
- FloatType();
+ // Default constructor
+ FloatType();
- // Creates a floating-point datatype using an existing id.
- FloatType(const hid_t existing_id);
+ // Creates a floating-point datatype using an existing id.
+ FloatType(const hid_t existing_id);
- // Copy constructor: same as the original FloatType.
- FloatType(const FloatType& original);
+ // Copy constructor: same as the original FloatType.
+ FloatType(const FloatType &original);
- // Noop destructor.
- virtual ~FloatType();
+ // Noop destructor.
+ virtual ~FloatType();
}; // end of FloatType
} // namespace H5
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index 7132bdf..a1f7dcd 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -42,8 +42,8 @@
#include "H5Alltypes.h"
namespace H5 {
- using std::cerr;
- using std::endl;
+using std::cerr;
+using std::endl;
//--------------------------------------------------------------------------
// Function: Group default constructor
@@ -58,7 +58,7 @@ Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) {}
///\param original - IN: Original group to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id)
+Group::Group(const Group &original) : H5Object(), CommonFG(), id(original.id)
{
incRefCount(); // increment number of references to this id
}
@@ -70,11 +70,11 @@ Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id)
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - March, 2017
//--------------------------------------------------------------------------
-void Group::closeObjId(hid_t obj_id) const
+void
+Group::closeObjId(hid_t obj_id) const
{
herr_t ret_value = H5Oclose(obj_id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throwException("Group::closeObjId", "H5Oclose failed");
}
}
@@ -91,9 +91,10 @@ void Group::closeObjId(hid_t obj_id) const
// After HDFFV-9920, the Group's methods can use getId() and
// getLocId() is kept for backward compatibility.
//--------------------------------------------------------------------------
-hid_t Group::getLocId() const
+hid_t
+Group::getLocId() const
{
- return(getId());
+ return (getId());
}
//--------------------------------------------------------------------------
@@ -120,7 +121,8 @@ Group::Group(const hid_t existing_id) : H5Object(), CommonFG(), id(existing_id)
/// is a datatype that has been named by DataType::commit.
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), CommonFG(), id(H5I_INVALID_HID)
+Group::Group(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist)
+ : H5Object(), CommonFG(), id(H5I_INVALID_HID)
{
id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference");
}
@@ -132,12 +134,13 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
-hsize_t Group::getNumObjs() const
+hsize_t
+Group::getNumObjs() const
{
- H5G_info_t ginfo; // Group information
+ H5G_info_t ginfo; // Group information
herr_t ret_value = H5Gget_info(getId(), &ginfo);
- if(ret_value < 0)
+ if (ret_value < 0)
throwException("getNumObjs", "H5Gget_info failed");
return (ginfo.nlinks);
}
@@ -155,14 +158,14 @@ hsize_t Group::getNumObjs() const
/// the object's type.
// Programmer Binh-Minh Ribler - March, 2017
//--------------------------------------------------------------------------
-hid_t Group::getObjId(const char* obj_name, const PropList& plist) const
+hid_t
+Group::getObjId(const char *obj_name, const PropList &plist) const
{
hid_t ret_value = H5Oopen(getId(), obj_name, plist.getId());
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throwException("Group::getObjId", "H5Oopen failed");
}
- return(ret_value);
+ return (ret_value);
}
//--------------------------------------------------------------------------
@@ -175,9 +178,10 @@ hid_t Group::getObjId(const char* obj_name, const PropList& plist) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - March, 2017
//--------------------------------------------------------------------------
-hid_t Group::getObjId(const H5std_string& obj_name, const PropList& plist) const
+hid_t
+Group::getObjId(const H5std_string &obj_name, const PropList &plist) const
{
- return(getObjId(obj_name.c_str(), plist));
+ return (getObjId(obj_name.c_str(), plist));
}
//--------------------------------------------------------------------------
@@ -192,9 +196,10 @@ hid_t Group::getObjId(const H5std_string& obj_name, const PropList& plist) const
// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
-hid_t Group::getId() const
+hid_t
+Group::getId() const
{
- return(id);
+ return (id);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -210,13 +215,14 @@ hid_t Group::getId() const
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Group::p_setId(const hid_t new_id)
+void
+Group::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throwException("Group::p_setId", close_error.getDetailMsg());
}
// reset object's id to the given id
@@ -231,13 +237,12 @@ void Group::p_setId(const hid_t new_id)
///\exception H5::GroupIException
// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
-void Group::close()
+void
+Group::close()
{
- if (p_valid_id(id))
- {
+ if (p_valid_id(id)) {
herr_t ret_value = H5Gclose(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throwException("Group::close", "H5Gclose failed");
}
// reset the id
@@ -258,7 +263,8 @@ void Group::close()
// an implementation of Group.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Group::throwException(const H5std_string& func_name, const H5std_string& msg) const
+void
+Group::throwException(const H5std_string &func_name, const H5std_string &msg) const
{
H5std_string full_name = func_name;
full_name.insert(0, "Group::");
@@ -280,9 +286,9 @@ Group::~Group()
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
cerr << "Group::~Group - " << close_error.getDetailMsg() << endl;
}
}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h
index 70b6bff..7b9dc54 100644
--- a/c++/src/H5Group.h
+++ b/c++/src/H5Group.h
@@ -22,57 +22,63 @@ namespace H5 {
*/
// Inheritance: CommonFG/H5Object -> H5Location -> IdComponent
class H5_DLLCPP Group : public H5Object, public CommonFG {
- public:
- // Close this group.
- virtual void close();
+ public:
+ // Close this group.
+ virtual void close();
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("Group"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("Group");
+ }
- // Throw group exception.
- virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
+ // Throw group exception.
+ virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const;
- // for CommonFG to get the file id.
- virtual hid_t getLocId() const;
+ // for CommonFG to get the file id.
+ virtual hid_t getLocId() const;
- // Creates a group by way of dereference.
- Group(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
- // Removed in 1.10.1, because H5Location is baseclass
-// Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
+ // Creates a group by way of dereference.
+ Group(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT,
+ const PropList &plist = PropList::DEFAULT);
+ // Removed in 1.10.1, because H5Location is baseclass
+ // Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList&
+ // plist = PropList::DEFAULT);
- // Returns the number of objects in this group.
- hsize_t getNumObjs() const;
+ // Returns the number of objects in this group.
+ hsize_t getNumObjs() const;
- // Opens an object within a group or a file, i.e., root group.
- hid_t getObjId(const char* name, const PropList& plist = PropList::DEFAULT) const;
- hid_t getObjId(const H5std_string& name, const PropList& plist = PropList::DEFAULT) const;
+ // Opens an object within a group or a file, i.e., root group.
+ hid_t getObjId(const char *name, const PropList &plist = PropList::DEFAULT) const;
+ hid_t getObjId(const H5std_string &name, const PropList &plist = PropList::DEFAULT) const;
- // Closes an object opened by getObjId().
- void closeObjId(hid_t obj_id) const;
+ // Closes an object opened by getObjId().
+ void closeObjId(hid_t obj_id) const;
- // default constructor
- Group();
+ // default constructor
+ Group();
- // Copy constructor: same as the original Group.
- Group(const Group& original);
+ // Copy constructor: same as the original Group.
+ Group(const Group &original);
- // Gets the group id.
- virtual hid_t getId() const;
+ // Gets the group id.
+ virtual hid_t getId() const;
- // Destructor
- virtual ~Group();
+ // Destructor
+ virtual ~Group();
- // Creates a copy of an existing group using its id.
- Group(const hid_t group_id);
+ // Creates a copy of an existing group using its id.
+ Group(const hid_t group_id);
- protected:
+ protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Sets the group id.
- virtual void p_setId(const hid_t new_id);
+ // Sets the group id.
+ virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
- private:
- hid_t id; // HDF5 group id
+ private:
+ hid_t id; // HDF5 group id
}; // end of Group
} // namespace H5
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index 40520aa..ca54551 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -13,7 +13,7 @@
#include <string>
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5Library.h"
@@ -38,7 +38,8 @@ bool IdComponent::H5dontAtexit_called = false;
///\brief Increment reference counter for a given id.
// Programmer Binh-Minh Ribler - May 2005
//--------------------------------------------------------------------------
-void IdComponent::incRefCount(const hid_t obj_id) const
+void
+IdComponent::incRefCount(const hid_t obj_id) const
{
if (p_valid_id(obj_id))
if (H5Iinc_ref(obj_id) < 0)
@@ -50,7 +51,8 @@ void IdComponent::incRefCount(const hid_t obj_id) const
///\brief Increment reference counter for the id of this object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void IdComponent::incRefCount() const
+void
+IdComponent::incRefCount() const
{
incRefCount(getId());
}
@@ -63,17 +65,15 @@ void IdComponent::incRefCount() const
// Added the check for ref counter to give a little more info
// on why H5Idec_ref fails in some cases - BMR 5/19/2005
//--------------------------------------------------------------------------
-void IdComponent::decRefCount(const hid_t obj_id) const
+void
+IdComponent::decRefCount(const hid_t obj_id) const
{
if (p_valid_id(obj_id))
- if (H5Idec_ref(obj_id) < 0)
- {
+ if (H5Idec_ref(obj_id) < 0) {
if (H5Iget_ref(obj_id) <= 0)
- throw IdComponentException(inMemFunc("decRefCount"),
- "object ref count is 0 or negative");
+ throw IdComponentException(inMemFunc("decRefCount"), "object ref count is 0 or negative");
else
- throw IdComponentException(inMemFunc("decRefCount"),
- "decrementing object ref count failed");
+ throw IdComponentException(inMemFunc("decRefCount"), "decrementing object ref count failed");
}
}
@@ -82,7 +82,8 @@ void IdComponent::decRefCount(const hid_t obj_id) const
///\brief Decrement reference counter for the id of this object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void IdComponent::decRefCount() const
+void
+IdComponent::decRefCount() const
{
decRefCount(getId());
}
@@ -93,14 +94,15 @@ void IdComponent::decRefCount() const
///\return Reference count
// Programmer Binh-Minh Ribler - May 2005
//--------------------------------------------------------------------------
-int IdComponent::getCounter(const hid_t obj_id) const
+int
+IdComponent::getCounter(const hid_t obj_id) const
{
int counter = 0;
- if (p_valid_id(obj_id))
- {
+ if (p_valid_id(obj_id)) {
counter = H5Iget_ref(obj_id);
if (counter < 0)
- throw IdComponentException(inMemFunc("incRefCount"), "getting object ref count failed - negative");
+ throw IdComponentException(inMemFunc("incRefCount"),
+ "getting object ref count failed - negative");
}
return (counter);
}
@@ -111,7 +113,8 @@ int IdComponent::getCounter(const hid_t obj_id) const
///\return Reference count
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int IdComponent::getCounter() const
+int
+IdComponent::getCounter() const
{
return (getCounter(getId()));
}
@@ -130,7 +133,8 @@ int IdComponent::getCounter() const
/// input object id is invalid.
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-H5I_type_t IdComponent::getHDFObjType(const hid_t obj_id)
+H5I_type_t
+IdComponent::getHDFObjType(const hid_t obj_id)
{
if (obj_id <= 0)
return H5I_BADID; // invalid
@@ -156,9 +160,10 @@ H5I_type_t IdComponent::getHDFObjType(const hid_t obj_id)
/// input object id is invalid.
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-H5I_type_t IdComponent::getHDFObjType() const
+H5I_type_t
+IdComponent::getHDFObjType() const
{
- return(getHDFObjType(getId()));
+ return (getHDFObjType(getId()));
}
//--------------------------------------------------------------------------
@@ -183,14 +188,15 @@ H5I_type_t IdComponent::getHDFObjType() const
/// \li \c H5I_ERROR_STACK
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
-hsize_t IdComponent::getNumMembers(H5I_type_t type)
+hsize_t
+IdComponent::getNumMembers(H5I_type_t type)
{
- hsize_t nmembers = 0;
- herr_t ret_value = H5Inmembers(type, &nmembers);
+ hsize_t nmembers = 0;
+ herr_t ret_value = H5Inmembers(type, &nmembers);
if (ret_value < 0)
throw IdComponentException("getNumMembers", "H5Inmembers failed");
else
- return(nmembers);
+ return (nmembers);
}
//--------------------------------------------------------------------------
@@ -202,7 +208,8 @@ hsize_t IdComponent::getNumMembers(H5I_type_t type)
/// reference count of at least 1.
// Programmer Binh-Minh Ribler - Mar 1, 2017
//--------------------------------------------------------------------------
-bool IdComponent::isValid(hid_t an_id)
+bool
+IdComponent::isValid(hid_t an_id)
{
// Call C function
htri_t ret_value = H5Iis_valid(an_id);
@@ -236,7 +243,8 @@ bool IdComponent::isValid(hid_t an_id)
/// \li \c H5I_ERROR_STACK
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
-bool IdComponent::typeExists(H5I_type_t type)
+bool
+IdComponent::typeExists(H5I_type_t type)
{
// Call C function
htri_t ret_value = H5Itype_exists(type);
@@ -266,17 +274,17 @@ bool IdComponent::typeExists(H5I_type_t type)
// care of close() and setId takes care incRefCount().
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IdComponent& IdComponent::operator=(const IdComponent& rhs)
+IdComponent &
+IdComponent::operator=(const IdComponent &rhs)
{
- if (this != &rhs)
- {
+ if (this != &rhs) {
// handling references to this id
try {
setId(rhs.getId());
// Note: a = b, so there are two objects with the same hdf5 id
// that's why incRefCount is needed, and it is called by setId
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw FileIException(inMemFunc("operator="), close_error.getDetailMsg());
}
}
@@ -304,7 +312,8 @@ IdComponent& IdComponent::operator=(const IdComponent& rhs)
// the id passed to setId is that of another C++ API object, so
// setId must call incRefCount.
//--------------------------------------------------------------------------
-void IdComponent::setId(const hid_t new_id)
+void
+IdComponent::setId(const hid_t new_id)
{
// set to new_id
p_setId(new_id);
@@ -338,7 +347,8 @@ IdComponent::~IdComponent() {}
/// an exception is thrown.
// Programmer Binh-Minh Ribler - Aug 6, 2005
//--------------------------------------------------------------------------
-H5std_string IdComponent::inMemFunc(const char* func_name) const
+H5std_string
+IdComponent::inMemFunc(const char *func_name) const
{
H5std_string full_name = func_name;
full_name.insert(0, "::");
@@ -355,8 +365,7 @@ IdComponent::IdComponent()
{
// initH5cpp will register the terminating functions with atexit().
// This should only be done once.
- if (!H5cppinit)
- {
+ if (!H5cppinit) {
H5Library::initH5cpp();
H5cppinit = true;
}
@@ -374,7 +383,8 @@ IdComponent::IdComponent()
// inherits from H5Location.
// Programmer Binh-Minh Ribler - Jul, 2004
//--------------------------------------------------------------------------
-H5std_string IdComponent::p_get_file_name() const
+H5std_string
+IdComponent::p_get_file_name() const
{
hid_t temp_id = getId();
@@ -382,28 +392,26 @@ H5std_string IdComponent::p_get_file_name() const
ssize_t name_size = H5Fget_name(temp_id, NULL, 0);
// If H5Aget_name returns a negative value, raise an exception,
- if (name_size < 0)
- {
+ if (name_size < 0) {
throw IdComponentException("", "H5Fget_name failed");
}
// Call H5Fget_name again to get the actual file name
- char* name_C = new char[name_size+1]; // temporary C-string for C API
- HDmemset(name_C, 0, name_size+1); // clear buffer
+ char *name_C = new char[name_size + 1]; // temporary C-string for C API
+ HDmemset(name_C, 0, name_size + 1); // clear buffer
- name_size = H5Fget_name(temp_id, name_C, name_size+1);
+ name_size = H5Fget_name(temp_id, name_C, name_size + 1);
// Check for failure again
- if (name_size < 0)
- {
- delete []name_C;
+ if (name_size < 0) {
+ delete[] name_C;
throw IdComponentException("", "H5Fget_name failed");
}
// Convert the C file name and return
H5std_string file_name(name_C);
- delete []name_C;
- return(file_name);
+ delete[] name_C;
+ return (file_name);
}
//
@@ -417,7 +425,8 @@ H5std_string IdComponent::p_get_file_name() const
// Return true if id is valid, false, otherwise
// Programmer Binh-Minh Ribler - May, 2005
//--------------------------------------------------------------------------
-bool IdComponent::p_valid_id(const hid_t obj_id)
+bool
+IdComponent::p_valid_id(const hid_t obj_id)
{
if (obj_id <= 0)
return false;
@@ -439,4 +448,4 @@ bool IdComponent::p_valid_id(const hid_t obj_id)
#endif // DOXYGEN_SHOULD_SKIP_THIS
-}
+} // namespace H5
diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h
index b4070b0..8db1af2 100644
--- a/c++/src/H5IdComponent.h
+++ b/c++/src/H5IdComponent.h
@@ -25,85 +25,88 @@ namespace H5 {
rarely needs them.
*/
class H5_DLLCPP IdComponent {
- public:
+ public:
+ // Increment reference counter.
+ void incRefCount(const hid_t obj_id) const;
+ void incRefCount() const;
- // Increment reference counter.
- void incRefCount(const hid_t obj_id) const;
- void incRefCount() const;
+ // Decrement reference counter.
+ void decRefCount(const hid_t obj_id) const;
+ void decRefCount() const;
- // Decrement reference counter.
- void decRefCount(const hid_t obj_id) const;
- void decRefCount() const;
+ // Get the reference counter to this identifier.
+ int getCounter(const hid_t obj_id) const;
+ int getCounter() const;
- // Get the reference counter to this identifier.
- int getCounter(const hid_t obj_id) const;
- int getCounter() const;
+ // Returns an HDF5 object type, given the object id.
+ static H5I_type_t getHDFObjType(const hid_t obj_id);
- // Returns an HDF5 object type, given the object id.
- static H5I_type_t getHDFObjType(const hid_t obj_id);
+ // Returns an HDF5 object type of this object.
+ H5I_type_t getHDFObjType() const;
- // Returns an HDF5 object type of this object.
- H5I_type_t getHDFObjType() const;
+ // Returns the number of members in a type.
+ static hsize_t getNumMembers(H5I_type_t type);
- // Returns the number of members in a type.
- static hsize_t getNumMembers(H5I_type_t type);
+ // Checks if the given ID is valid.
+ static bool isValid(hid_t an_id);
- // Checks if the given ID is valid.
- static bool isValid(hid_t an_id);
+ // Determines if an type exists.
+ static bool typeExists(H5I_type_t type);
- // Determines if an type exists.
- static bool typeExists(H5I_type_t type);
+ // Assignment operator.
+ IdComponent &operator=(const IdComponent &rhs);
- // Assignment operator.
- IdComponent& operator=(const IdComponent& rhs);
-
- // Sets the identifier of this object to a new value.
- void setId(const hid_t new_id);
+ // Sets the identifier of this object to a new value.
+ void setId(const hid_t new_id);
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Gets the identifier of this object.
- virtual hid_t getId () const = 0;
+ // Gets the identifier of this object.
+ virtual hid_t getId() const = 0;
- // Pure virtual function for there are various H5*close for the
- // subclasses.
- virtual void close() = 0;
+ // Pure virtual function for there are various H5*close for the
+ // subclasses.
+ virtual void close() = 0;
- // Makes and returns the string "<class-name>::<func_name>";
- // <class-name> is returned by fromClass().
- H5std_string inMemFunc(const char* func_name) const;
+ // Makes and returns the string "<class-name>::<func_name>";
+ // <class-name> is returned by fromClass().
+ H5std_string inMemFunc(const char *func_name) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass() const { return("IdComponent");}
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("IdComponent");
+ }
#endif // DOXYGEN_SHOULD_SKIP_THIS
- // Destructor
- virtual ~IdComponent();
+ // Destructor
+ virtual ~IdComponent();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- protected:
- // Default constructor.
- IdComponent();
+ protected:
+ // Default constructor.
+ IdComponent();
- // Gets the name of the file, in which an HDF5 object belongs.
- H5std_string p_get_file_name() const;
+ // Gets the name of the file, in which an HDF5 object belongs.
+ H5std_string p_get_file_name() const;
- // Verifies that the given id is valid.
- static bool p_valid_id(const hid_t obj_id);
+ // Verifies that the given id is valid.
+ static bool p_valid_id(const hid_t obj_id);
- // Sets the identifier of this object to a new value. - this one
- // doesn't increment reference count
- virtual void p_setId(const hid_t new_id) = 0;
+ // Sets the identifier of this object to a new value. - this one
+ // doesn't increment reference count
+ virtual void p_setId(const hid_t new_id) = 0;
- // This flag is used to decide whether H5dont_atexit should be called
- static bool H5dontAtexit_called;
+ // This flag is used to decide whether H5dont_atexit should be called
+ static bool H5dontAtexit_called;
- private:
- // This flag indicates whether H5Library::initH5cpp has been called
- // to register various terminating functions with atexit()
- static bool H5cppinit;
+ private:
+ // This flag indicates whether H5Library::initH5cpp has been called
+ // to register various terminating functions with atexit()
+ static bool H5cppinit;
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5Include.h b/c++/src/H5Include.h
index a180430..c26ba33 100644
--- a/c++/src/H5Include.h
+++ b/c++/src/H5Include.h
@@ -23,18 +23,17 @@
#undef true
#endif
typedef int bool;
-const bool false = 0;
-const bool true = 1;
+const bool false = 0;
+const bool true = 1;
#endif
// These are defined in H5Opkg.h, which should not be included in the C++ API,
// so re-define them here for now.
/* Initial version of the object header format */
-#define H5O_VERSION_1 1
+#define H5O_VERSION_1 1
/* Revised version - leaves out reserved bytes and alignment padding, and adds
* magic number as prefix and checksum as suffix for all chunks.
*/
-#define H5O_VERSION_2 2
-
+#define H5O_VERSION_2 2
diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp
index 01c20e9..7f3bcb5 100644
--- a/c++/src/H5IntType.cpp
+++ b/c++/src/H5IntType.cpp
@@ -47,7 +47,7 @@ IntType::IntType() {}
///\brief Copy constructor: same HDF5 object as \a original
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType::IntType(const IntType& original) : AtomType( original ) {}
+IntType::IntType(const IntType &original) : AtomType(original) {}
//--------------------------------------------------------------------------
// Function: IntType overloaded constructor
@@ -56,7 +56,7 @@ IntType::IntType(const IntType& original) : AtomType( original ) {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType::IntType(const PredType& pred_type) : AtomType()
+IntType::IntType(const PredType &pred_type) : AtomType()
{
// use DataType::copy to make a copy of this predefined type
copy(pred_type);
@@ -70,7 +70,7 @@ IntType::IntType(const PredType& pred_type) : AtomType()
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType::IntType(const hid_t existing_id) : AtomType( existing_id ) {}
+IntType::IntType(const hid_t existing_id) : AtomType(existing_id) {}
//--------------------------------------------------------------------------
// Function: IntType overloaded constructor
@@ -79,13 +79,12 @@ IntType::IntType(const hid_t existing_id) : AtomType( existing_id ) {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType::IntType(const DataSet& dataset) : AtomType()
+IntType::IntType(const DataSet &dataset) : AtomType()
{
// Calls C function H5Dget_type to get the id of the datatype
id = H5Dget_type(dataset.getId());
- if (id < 0)
- {
+ if (id < 0) {
throw DataSetIException("IntType constructor", "H5Dget_type failed");
}
}
@@ -104,7 +103,7 @@ IntType::IntType(const DataSet& dataset) : AtomType()
// improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-IntType::IntType(const H5Location& loc, const char *dtype_name) : AtomType()
+IntType::IntType(const H5Location &loc, const char *dtype_name) : AtomType()
{
id = p_opentype(loc, dtype_name);
}
@@ -123,7 +122,7 @@ IntType::IntType(const H5Location& loc, const char *dtype_name) : AtomType()
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-IntType::IntType(const H5Location& loc, const H5std_string& dtype_name) : AtomType()
+IntType::IntType(const H5Location &loc, const H5std_string &dtype_name) : AtomType()
{
id = p_opentype(loc, dtype_name.c_str());
}
@@ -136,7 +135,8 @@ IntType::IntType(const H5Location& loc, const H5std_string& dtype_name) : AtomTy
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-DataType* IntType::decode() const
+DataType *
+IntType::decode() const
{
hid_t encoded_inttype_id = H5I_INVALID_HID;
try {
@@ -147,7 +147,7 @@ DataType* IntType::decode() const
}
IntType *encoded_inttype = new IntType;
encoded_inttype->p_setId(encoded_inttype_id);
- return(encoded_inttype);
+ return (encoded_inttype);
}
//--------------------------------------------------------------------------
@@ -157,17 +157,17 @@ DataType* IntType::decode() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_sign_t IntType::getSign() const
+H5T_sign_t
+IntType::getSign() const
{
- H5T_sign_t type_sign = H5Tget_sign(id); // C routine
+ H5T_sign_t type_sign = H5Tget_sign(id); // C routine
// Returns a valid sign type if no errors
- if (type_sign == H5T_SGN_ERROR)
- {
+ if (type_sign == H5T_SGN_ERROR) {
throw DataTypeIException("IntType::getSign",
- "H5Tget_sign failed - returned H5T_SGN_ERROR for the sign type");
+ "H5Tget_sign failed - returned H5T_SGN_ERROR for the sign type");
}
- return(type_sign);
+ return (type_sign);
}
//--------------------------------------------------------------------------
@@ -177,12 +177,12 @@ H5T_sign_t IntType::getSign() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void IntType::setSign(H5T_sign_t sign) const
+void
+IntType::setSign(H5T_sign_t sign) const
{
// Call C routine to set the sign property
herr_t ret_value = H5Tset_sign(id, sign);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("IntType::setSign", "H5Tset_sign failed");
}
}
@@ -194,4 +194,4 @@ void IntType::setSign(H5T_sign_t sign) const
//--------------------------------------------------------------------------
IntType::~IntType() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h
index 496872b..e8bccca 100644
--- a/c++/src/H5IntType.h
+++ b/c++/src/H5IntType.h
@@ -23,41 +23,45 @@ namespace H5 {
*/
// Inheritance: AtomType -> DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP IntType : public AtomType {
- public:
- // Creates an integer type using a predefined type
- IntType(const PredType& pred_type);
+ public:
+ // Creates an integer type using a predefined type
+ IntType(const PredType &pred_type);
- // Gets the integer datatype of the specified dataset
- IntType(const DataSet& dataset);
+ // Gets the integer datatype of the specified dataset
+ IntType(const DataSet &dataset);
- // Constructors that open an HDF5 integer datatype, given a location.
- IntType(const H5Location& loc, const char* name);
- IntType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open an HDF5 integer datatype, given a location.
+ IntType(const H5Location &loc, const char *name);
+ IntType(const H5Location &loc, const H5std_string &name);
- // Returns an IntType object via DataType* by decoding the
- // binary object description of this type.
- virtual DataType* decode() const;
+ // Returns an IntType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType *decode() const;
- // Retrieves the sign type for an integer type
- H5T_sign_t getSign() const;
+ // Retrieves the sign type for an integer type
+ H5T_sign_t getSign() const;
- // Sets the sign proprety for an integer type.
- void setSign(H5T_sign_t sign) const;
+ // Sets the sign proprety for an integer type.
+ void setSign(H5T_sign_t sign) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("IntType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("IntType");
+ }
- // Default constructor
- IntType();
+ // Default constructor
+ IntType();
- // Creates a integer datatype using an existing id
- IntType(const hid_t existing_id);
+ // Creates a integer datatype using an existing id
+ IntType(const hid_t existing_id);
- // Copy constructor: same as the original IntType.
- IntType(const IntType& original);
+ // Copy constructor: same as the original IntType.
+ IntType(const IntType &original);
- // Noop destructor.
- virtual ~IntType();
+ // Noop destructor.
+ virtual ~IntType();
}; // end of IntType
} // namespace H5
diff --git a/c++/src/H5LaccProp.cpp b/c++/src/H5LaccProp.cpp
index 1905cce..bd9cd1b 100644
--- a/c++/src/H5LaccProp.cpp
+++ b/c++/src/H5LaccProp.cpp
@@ -27,7 +27,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-LinkAccPropList* LinkAccPropList::DEFAULT_ = 0;
+LinkAccPropList *LinkAccPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: LinkAccPropList::getConstant
@@ -40,13 +40,13 @@ LinkAccPropList* LinkAccPropList::DEFAULT_ = 0;
// happen.
// Programmer Binh-Minh Ribler - December, 2016
//--------------------------------------------------------------------------
-LinkAccPropList* LinkAccPropList::getConstant()
+LinkAccPropList *
+LinkAccPropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -55,8 +55,9 @@ LinkAccPropList* LinkAccPropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new LinkAccPropList(H5P_LINK_ACCESS);
else
- throw PropListIException("LinkAccPropList::getConstant", "LinkAccPropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException("LinkAccPropList::getConstant",
+ "LinkAccPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -66,7 +67,8 @@ LinkAccPropList* LinkAccPropList::getConstant()
// exception H5::PropListIException
// Programmer Binh-Minh Ribler - December, 2016
//--------------------------------------------------------------------------
-void LinkAccPropList::deleteConstants()
+void
+LinkAccPropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -75,7 +77,7 @@ void LinkAccPropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose: Constant for default property
//--------------------------------------------------------------------------
-const LinkAccPropList& LinkAccPropList::DEFAULT = *getConstant();
+const LinkAccPropList &LinkAccPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -92,7 +94,7 @@ LinkAccPropList::LinkAccPropList() : PropList(H5P_LINK_ACCESS) {}
///\param original - IN: LinkAccPropList instance to copy
// Programmer Binh-Minh Ribler - December, 2016
//--------------------------------------------------------------------------
-LinkAccPropList::LinkAccPropList(const LinkAccPropList& original) : PropList(original) {}
+LinkAccPropList::LinkAccPropList(const LinkAccPropList &original) : PropList(original) {}
//--------------------------------------------------------------------------
// Function: LinkAccPropList overloaded constructor
@@ -111,12 +113,12 @@ LinkAccPropList::LinkAccPropList(const hid_t plist_id) : PropList(plist_id) {}
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - March 1, 2017
//--------------------------------------------------------------------------
-void LinkAccPropList::setNumLinks(size_t nlinks) const
+void
+LinkAccPropList::setNumLinks(size_t nlinks) const
{
herr_t ret_value = H5Pset_nlinks(id, nlinks);
// Throw exception if H5Pset_nlinks returns failure
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("setNumLinks", "H5Pset_nlinks failed");
}
}
@@ -129,16 +131,16 @@ void LinkAccPropList::setNumLinks(size_t nlinks) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - March 1, 2017
//--------------------------------------------------------------------------
-size_t LinkAccPropList::getNumLinks() const
+size_t
+LinkAccPropList::getNumLinks() const
{
- size_t nlinks = 0;
+ size_t nlinks = 0;
herr_t ret_value = H5Pget_nlinks(id, &nlinks);
// Throw exception if H5Pget_nlinks returns failure
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("getNumLinks", "H5Pget_nlinks failed");
}
- return(nlinks);
+ return (nlinks);
}
//--------------------------------------------------------------------------
@@ -148,4 +150,4 @@ size_t LinkAccPropList::getNumLinks() const
//--------------------------------------------------------------------------
LinkAccPropList::~LinkAccPropList() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5LaccProp.h b/c++/src/H5LaccProp.h
index ec5e54f..337f0b7 100644
--- a/c++/src/H5LaccProp.h
+++ b/c++/src/H5LaccProp.h
@@ -23,43 +23,47 @@ namespace H5 {
*/
// Inheritance: PropList -> IdComponent
class H5_DLLCPP LinkAccPropList : public PropList {
- public:
- ///\brief Default link access property list.
- static const LinkAccPropList& DEFAULT;
+ public:
+ ///\brief Default link access property list.
+ static const LinkAccPropList &DEFAULT;
- // Creates a link access property list.
- LinkAccPropList();
+ // Creates a link access property list.
+ LinkAccPropList();
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("LinkAccPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("LinkAccPropList");
+ }
- // Copy constructor: same as the original LinkAccPropList.
- LinkAccPropList(const LinkAccPropList& original);
+ // Copy constructor: same as the original LinkAccPropList.
+ LinkAccPropList(const LinkAccPropList &original);
- // Creates a copy of an existing link access property list
- // using the property list id.
- LinkAccPropList (const hid_t plist_id);
+ // Creates a copy of an existing link access property list
+ // using the property list id.
+ LinkAccPropList(const hid_t plist_id);
- // Sets the number of soft or user-defined links that can be
- // traversed before a failure occurs.
- void setNumLinks(size_t nlinks) const;
+ // Sets the number of soft or user-defined links that can be
+ // traversed before a failure occurs.
+ void setNumLinks(size_t nlinks) const;
- // Gets the number of soft or user-defined link traversals allowed
- size_t getNumLinks() const;
+ // Gets the number of soft or user-defined link traversals allowed
+ size_t getNumLinks() const;
- // Noop destructor
- virtual ~LinkAccPropList();
+ // Noop destructor
+ virtual ~LinkAccPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
- private:
- static LinkAccPropList* DEFAULT_;
+ private:
+ static LinkAccPropList *DEFAULT_;
- // Creates the global constant, should only be used by the library
- static LinkAccPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static LinkAccPropList *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5LcreatProp.cpp b/c++/src/H5LcreatProp.cpp
index bde9339..e40d6ba 100644
--- a/c++/src/H5LcreatProp.cpp
+++ b/c++/src/H5LcreatProp.cpp
@@ -27,7 +27,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-LinkCreatPropList* LinkCreatPropList::DEFAULT_ = 0;
+LinkCreatPropList *LinkCreatPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: LinkCreatPropList::getConstant
@@ -40,13 +40,13 @@ LinkCreatPropList* LinkCreatPropList::DEFAULT_ = 0;
// happen.
// December, 2016
//--------------------------------------------------------------------------
-LinkCreatPropList* LinkCreatPropList::getConstant()
+LinkCreatPropList *
+LinkCreatPropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -55,8 +55,9 @@ LinkCreatPropList* LinkCreatPropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new LinkCreatPropList(H5P_LINK_CREATE);
else
- throw PropListIException("LinkCreatPropList::getConstant", "LinkCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException("LinkCreatPropList::getConstant",
+ "LinkCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -66,7 +67,8 @@ LinkCreatPropList* LinkCreatPropList::getConstant()
// exception H5::PropListIException
// December, 2016
//--------------------------------------------------------------------------
-void LinkCreatPropList::deleteConstants()
+void
+LinkCreatPropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -75,7 +77,7 @@ void LinkCreatPropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose: Constant for default property
//--------------------------------------------------------------------------
-const LinkCreatPropList& LinkCreatPropList::DEFAULT = *getConstant();
+const LinkCreatPropList &LinkCreatPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -92,7 +94,7 @@ LinkCreatPropList::LinkCreatPropList() : PropList(H5P_LINK_CREATE) {}
///\param original - IN: LinkCreatPropList instance to copy
// December, 2016
//--------------------------------------------------------------------------
-LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList& original) : PropList(original) {}
+LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList &original) : PropList(original) {}
//--------------------------------------------------------------------------
// Function: LinkCreatPropList overloaded constructor
@@ -111,12 +113,12 @@ LinkCreatPropList::LinkCreatPropList(const hid_t plist_id) : PropList(plist_id)
///\exception H5::PropListIException
// April, 2019
//--------------------------------------------------------------------------
-void LinkCreatPropList::setCreateIntermediateGroup(bool crt_intmd_group) const
+void
+LinkCreatPropList::setCreateIntermediateGroup(bool crt_intmd_group) const
{
herr_t ret_value = H5Pset_create_intermediate_group(id, (unsigned)crt_intmd_group);
// Throw exception if H5Pset_create_intermediate_group returns failure
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("setCreateIntermediateGroup", "H5Pset_create_intermediate_group failed");
}
}
@@ -129,17 +131,17 @@ void LinkCreatPropList::setCreateIntermediateGroup(bool crt_intmd_group) const
///\exception H5::PropListIException
// April, 2019
//--------------------------------------------------------------------------
-bool LinkCreatPropList::getCreateIntermediateGroup() const
+bool
+LinkCreatPropList::getCreateIntermediateGroup() const
{
unsigned crt_intmd_group;
- herr_t ret_value = H5Pget_create_intermediate_group(id, &crt_intmd_group);
+ herr_t ret_value = H5Pget_create_intermediate_group(id, &crt_intmd_group);
// Throw exception if H5Pget_create_intermediate_group returns failure
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("getCreateIntermediateGroup", "H5Pget_create_intermediate_group failed");
}
- return((bool)crt_intmd_group);
+ return ((bool)crt_intmd_group);
}
//--------------------------------------------------------------------------
@@ -149,12 +151,12 @@ bool LinkCreatPropList::getCreateIntermediateGroup() const
///\exception H5::PropListIException
// March, 2018
//--------------------------------------------------------------------------
-void LinkCreatPropList::setCharEncoding(H5T_cset_t encoding) const
+void
+LinkCreatPropList::setCharEncoding(H5T_cset_t encoding) const
{
herr_t ret_value = H5Pset_char_encoding(id, encoding);
// Throw exception if H5Pset_char_encoding returns failure
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("setCharEncoding", "H5Pset_char_encoding failed");
}
}
@@ -166,16 +168,16 @@ void LinkCreatPropList::setCharEncoding(H5T_cset_t encoding) const
///\exception H5::PropListIException
// March, 2018
//--------------------------------------------------------------------------
-H5T_cset_t LinkCreatPropList::getCharEncoding() const
+H5T_cset_t
+LinkCreatPropList::getCharEncoding() const
{
H5T_cset_t encoding;
- herr_t ret_value = H5Pget_char_encoding(id, &encoding);
+ herr_t ret_value = H5Pget_char_encoding(id, &encoding);
// Throw exception if H5Pget_char_encoding returns failure
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("getCharEncoding", "H5Pget_char_encoding failed");
}
- return(encoding);
+ return (encoding);
}
//--------------------------------------------------------------------------
@@ -185,4 +187,4 @@ H5T_cset_t LinkCreatPropList::getCharEncoding() const
//--------------------------------------------------------------------------
LinkCreatPropList::~LinkCreatPropList() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5LcreatProp.h b/c++/src/H5LcreatProp.h
index 908ef63..7194bdc 100644
--- a/c++/src/H5LcreatProp.h
+++ b/c++/src/H5LcreatProp.h
@@ -23,50 +23,54 @@ namespace H5 {
*/
// Inheritance: PropList -> IdComponent
class H5_DLLCPP LinkCreatPropList : public PropList {
- public:
- ///\brief Default link creation property list.
- static const LinkCreatPropList& DEFAULT;
+ public:
+ ///\brief Default link creation property list.
+ static const LinkCreatPropList &DEFAULT;
- // Creates a link creation property list.
- LinkCreatPropList();
+ // Creates a link creation property list.
+ LinkCreatPropList();
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("LinkCreatPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("LinkCreatPropList");
+ }
- // Copy constructor: same as the original LinkCreatPropList.
- LinkCreatPropList(const LinkCreatPropList& original);
+ // Copy constructor: same as the original LinkCreatPropList.
+ LinkCreatPropList(const LinkCreatPropList &original);
- // Creates a copy of an existing link creation property list
- // using the property list id.
- LinkCreatPropList (const hid_t plist_id);
+ // Creates a copy of an existing link creation property list
+ // using the property list id.
+ LinkCreatPropList(const hid_t plist_id);
- // Specifies in property list whether to create missing
- // intermediate groups
- void setCreateIntermediateGroup(bool crt_intmd_group) const;
+ // Specifies in property list whether to create missing
+ // intermediate groups
+ void setCreateIntermediateGroup(bool crt_intmd_group) const;
- // Determines whether property is set to enable creating missing
- // intermediate groups
- bool getCreateIntermediateGroup() const;
+ // Determines whether property is set to enable creating missing
+ // intermediate groups
+ bool getCreateIntermediateGroup() const;
- // Sets the character encoding of the string.
- void setCharEncoding(H5T_cset_t encoding) const;
+ // Sets the character encoding of the string.
+ void setCharEncoding(H5T_cset_t encoding) const;
- // Gets the character encoding of the string.
- H5T_cset_t getCharEncoding() const;
+ // Gets the character encoding of the string.
+ H5T_cset_t getCharEncoding() const;
- // Noop destructor
- virtual ~LinkCreatPropList();
+ // Noop destructor
+ virtual ~LinkCreatPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
- private:
- static LinkCreatPropList* DEFAULT_;
+ private:
+ static LinkCreatPropList *DEFAULT_;
- // Creates the global constant, should only be used by the library
- static LinkCreatPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static LinkCreatPropList *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp
index fde5599..8b8d7ba 100644
--- a/c++/src/H5Library.cpp
+++ b/c++/src/H5Library.cpp
@@ -14,7 +14,7 @@
#include <string>
#include <cstdlib>
-#include "H5CppDoc.h" // included only for Doxygen to generate part of RM
+#include "H5CppDoc.h" // included only for Doxygen to generate part of RM
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -44,11 +44,11 @@ namespace H5 {
///\exception H5::LibraryIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Library::open()
+void
+H5Library::open()
{
herr_t ret_value = H5open();
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw LibraryIException("H5Library::open", "H5open failed");
}
}
@@ -60,11 +60,11 @@ void H5Library::open()
///\exception H5::LibraryIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Library::close()
+void
+H5Library::close()
{
herr_t ret_value = H5close();
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw LibraryIException("H5Library::close", "H5close failed");
}
}
@@ -79,9 +79,10 @@ void H5Library::close()
// Removed the check for failure returned from H5dont_atexit.
// will be fixed to not fail (HDFFV-9540)
//--------------------------------------------------------------------------
-void H5Library::dontAtExit()
+void
+H5Library::dontAtExit()
{
- (void)H5dont_atexit();
+ (void)H5dont_atexit();
}
//--------------------------------------------------------------------------
@@ -93,11 +94,11 @@ void H5Library::dontAtExit()
///\exception H5::LibraryIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Library::getLibVersion(unsigned& majnum, unsigned& minnum, unsigned& relnum)
+void
+H5Library::getLibVersion(unsigned &majnum, unsigned &minnum, unsigned &relnum)
{
herr_t ret_value = H5get_libversion(&majnum, &minnum, &relnum);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw LibraryIException("H5Library::getLibVersion", "H5get_libversion failed");
}
}
@@ -115,11 +116,11 @@ void H5Library::getLibVersion(unsigned& majnum, unsigned& minnum, unsigned& reln
/// the H5check_version API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum)
+void
+H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum)
{
herr_t ret_value = H5check_version(majnum, minnum, relnum);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw LibraryIException("H5Library::checkVersion", "H5check_version failed");
}
}
@@ -144,11 +145,11 @@ void H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum)
/// lists when the application ends.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-void H5Library::garbageCollect()
+void
+H5Library::garbageCollect()
{
herr_t ret_value = H5garbage_collect();
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw LibraryIException("H5Library::garbageCollect", "H5garbage_collect failed");
}
}
@@ -168,12 +169,13 @@ void H5Library::garbageCollect()
//
// Programmer Binh-Minh Ribler - September, 2015
//--------------------------------------------------------------------------
-void H5Library::initH5cpp()
+void
+H5Library::initH5cpp()
{
// Register terminating functions with atexit(); they will be invoked in
// the reversed order
int ret_value = 0;
- ret_value = std::atexit(termH5cpp);
+ ret_value = std::atexit(termH5cpp);
if (ret_value != 0)
throw LibraryIException("H5Library::initH5cpp", "Registering termH5cpp failed");
@@ -187,35 +189,43 @@ void H5Library::initH5cpp()
ret_value = std::atexit(DSetAccPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registering DSetAccPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp",
+ "Registering DSetAccPropList::deleteConstants failed");
ret_value = std::atexit(LinkAccPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registering LinkAccPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp",
+ "Registering LinkAccPropList::deleteConstants failed");
ret_value = std::atexit(LinkCreatPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registering LinkCreatPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp",
+ "Registering LinkCreatPropList::deleteConstants failed");
ret_value = std::atexit(FileAccPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registering FileAccPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp",
+ "Registering FileAccPropList::deleteConstants failed");
ret_value = std::atexit(FileCreatPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registering FileCreatPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp",
+ "Registering FileCreatPropList::deleteConstants failed");
ret_value = std::atexit(DSetMemXferPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registering DSetMemXferPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp",
+ "Registering DSetMemXferPropList::deleteConstants failed");
ret_value = std::atexit(DSetCreatPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registering DSetCreatPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp",
+ "Registering DSetCreatPropList::deleteConstants failed");
ret_value = std::atexit(ObjCreatPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registering ObjCreatPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp",
+ "Registering ObjCreatPropList::deleteConstants failed");
ret_value = std::atexit(DataSpace::deleteConstants);
if (ret_value != 0)
@@ -229,7 +239,8 @@ void H5Library::initH5cpp()
/// If the C library fails to terminate, exit with a failure.
// Programmer Binh-Minh Ribler - September, 2015
//--------------------------------------------------------------------------
-void H5Library::termH5cpp()
+void
+H5Library::termH5cpp()
{
// Close the C library
herr_t ret_value = H5close();
@@ -253,13 +264,13 @@ void H5Library::termH5cpp()
/// the H5set_free_list_limits API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim,
- int arr_global_lim, int arr_list_lim, int blk_global_lim,
- int blk_list_lim)
+void
+H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim, int arr_global_lim, int arr_list_lim,
+ int blk_global_lim, int blk_list_lim)
{
- herr_t ret_value = H5set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim, blk_global_lim, blk_list_lim);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim,
+ blk_global_lim, blk_list_lim);
+ if (ret_value < 0) {
throw LibraryIException("H5Library::setFreeListLimits", "H5set_free_list_limits failed");
}
}
@@ -270,14 +281,14 @@ void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim,
///\brief Default constructor: Creates a stub H5Library object
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5Library::H5Library(){}
+H5Library::H5Library() {}
//--------------------------------------------------------------------------
// Function: H5Library destructor
///\brief Noop destructor
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5Library::~H5Library(){}
+H5Library::~H5Library() {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5Library.h b/c++/src/H5Library.h
index b9be3d0..d3f2831 100644
--- a/c++/src/H5Library.h
+++ b/c++/src/H5Library.h
@@ -24,47 +24,46 @@ namespace H5 {
methods.
*/
class H5_DLLCPP H5Library {
- public:
- // Initializes the HDF5 library.
- static void open();
+ public:
+ // Initializes the HDF5 library.
+ static void open();
- // Flushes all data to disk, closes files, and cleans up memory.
- static void close();
+ // Flushes all data to disk, closes files, and cleans up memory.
+ static void close();
- // Instructs library not to install atexit cleanup routine
- static void dontAtExit();
+ // Instructs library not to install atexit cleanup routine
+ static void dontAtExit();
- // Returns the HDF library release number.
- static void getLibVersion(unsigned& majnum, unsigned& minnum, unsigned& relnum);
+ // Returns the HDF library release number.
+ static void getLibVersion(unsigned &majnum, unsigned &minnum, unsigned &relnum);
- // Verifies that the arguments match the version numbers compiled
- // into the library
- static void checkVersion(unsigned majnum, unsigned minnum, unsigned relnum);
+ // Verifies that the arguments match the version numbers compiled
+ // into the library
+ static void checkVersion(unsigned majnum, unsigned minnum, unsigned relnum);
- // Walks through all the garbage collection routines for the library,
- // which are supposed to free any unused memory they have allocated.
- static void garbageCollect();
+ // Walks through all the garbage collection routines for the library,
+ // which are supposed to free any unused memory they have allocated.
+ static void garbageCollect();
- // Sets limits on the different kinds of free lists.
- static void setFreeListLimits(int reg_global_lim, int reg_list_lim, int
- arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim);
+ // Sets limits on the different kinds of free lists.
+ static void setFreeListLimits(int reg_global_lim, int reg_list_lim, int arr_global_lim, int arr_list_lim,
+ int blk_global_lim, int blk_list_lim);
- // Initializes C++ library and registers terminating functions at exit.
- // Only for the library functions, not for user-defined functions.
- static void initH5cpp(void);
+ // Initializes C++ library and registers terminating functions at exit.
+ // Only for the library functions, not for user-defined functions.
+ static void initH5cpp(void);
- // Sends request for terminating the HDF5 library.
- static void termH5cpp(void);
+ // Sends request for terminating the HDF5 library.
+ static void termH5cpp(void);
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- private:
+ private:
+ // Default constructor - no instance ever created from outsiders
+ H5Library();
- // Default constructor - no instance ever created from outsiders
- H5Library();
-
- // Destructor
- ~H5Library();
+ // Destructor
+ ~H5Library();
#endif // DOXYGEN_SHOULD_SKIP_THIS
}; // end of H5Library
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index 89a7890..687ff5b 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -15,7 +15,7 @@
#include <iostream>
using namespace std;
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -88,7 +88,8 @@ H5Location::H5Location() : IdComponent() {}
// Modification
// Renamed from exists() in 1.10.2 -BMR
//--------------------------------------------------------------------------
-bool H5Location::nameExists(const char* name, const LinkAccPropList& lapl) const
+bool
+H5Location::nameExists(const char *name, const LinkAccPropList &lapl) const
{
htri_t ret_value = H5Lexists(getId(), name, lapl.getId());
if (ret_value > 0)
@@ -110,9 +111,10 @@ bool H5Location::nameExists(const char* name, const LinkAccPropList& lapl) const
// Modification
// Renamed from exists() in 1.10.2 -BMR
//--------------------------------------------------------------------------
-bool H5Location::nameExists(const H5std_string& name, const LinkAccPropList& lapl) const
+bool
+H5Location::nameExists(const H5std_string &name, const LinkAccPropList &lapl) const
{
- return(nameExists(name.c_str(), lapl));
+ return (nameExists(name.c_str(), lapl));
}
//--------------------------------------------------------------------------
@@ -126,9 +128,10 @@ bool H5Location::nameExists(const H5std_string& name, const LinkAccPropList& lap
// Modification
// Renamed to nameExists() in 1.10.2 -BMR
//--------------------------------------------------------------------------
-bool H5Location::exists(const char* name, const LinkAccPropList& lapl) const
+bool
+H5Location::exists(const char *name, const LinkAccPropList &lapl) const
{
- return(nameExists(name, lapl));
+ return (nameExists(name, lapl));
}
//--------------------------------------------------------------------------
@@ -142,9 +145,10 @@ bool H5Location::exists(const char* name, const LinkAccPropList& lapl) const
// Modification
// Renamed to nameExists() in 1.10.2 -BMR
//--------------------------------------------------------------------------
-bool H5Location::exists(const H5std_string& name, const LinkAccPropList& lapl) const
+bool
+H5Location::exists(const H5std_string &name, const LinkAccPropList &lapl) const
{
- return(nameExists(name.c_str(), lapl));
+ return (nameExists(name.c_str(), lapl));
}
//--------------------------------------------------------------------------
@@ -162,11 +166,11 @@ bool H5Location::exists(const H5std_string& name, const LinkAccPropList& lapl) c
// Sep 2012 - BMR
// Moved from H5File/H5Object
//--------------------------------------------------------------------------
-void H5Location::flush(H5F_scope_t scope) const
+void
+H5Location::flush(H5F_scope_t scope) const
{
herr_t ret_value = H5Fflush(getId(), scope);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw LocationException(inMemFunc("flush"), "H5Fflush failed");
}
}
@@ -179,12 +183,13 @@ void H5Location::flush(H5F_scope_t scope) const
///\exception H5::LocationException
// Programmer Binh-Minh Ribler - Jul, 2004
//--------------------------------------------------------------------------
-H5std_string H5Location::getFileName() const
+H5std_string
+H5Location::getFileName() const
{
try {
- return(p_get_file_name());
+ return (p_get_file_name());
}
- catch (IdComponentException& E) {
+ catch (IdComponentException &E) {
throw LocationException(inMemFunc("getFileName"), E.getDetailMsg());
}
}
@@ -209,7 +214,8 @@ H5std_string H5Location::getFileName() const
// to another class to accommodate attribute, dataset, and named
// datatype. - BMR
//--------------------------------------------------------------------------
-void H5Location::setComment(const char* name, const char* comment) const
+void
+H5Location::setComment(const char *name, const char *comment) const
{
herr_t ret_value = H5Oset_comment_by_name(getId(), name, comment, H5P_DEFAULT);
if (ret_value < 0)
@@ -223,7 +229,8 @@ void H5Location::setComment(const char* name, const char* comment) const
/// \c H5std_string for \a name and \a comment.
// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
//--------------------------------------------------------------------------
-void H5Location::setComment(const H5std_string& name, const H5std_string& comment) const
+void
+H5Location::setComment(const H5std_string &name, const H5std_string &comment) const
{
setComment(name.c_str(), comment.c_str());
}
@@ -235,7 +242,8 @@ void H5Location::setComment(const H5std_string& name, const H5std_string& commen
/// an object name.
// Programmer Binh-Minh Ribler - Sep 2013
//--------------------------------------------------------------------------
-void H5Location::setComment(const char* comment) const
+void
+H5Location::setComment(const char *comment) const
{
herr_t ret_value = H5Oset_comment_by_name(getId(), ".", comment, H5P_DEFAULT);
if (ret_value < 0)
@@ -249,7 +257,8 @@ void H5Location::setComment(const char* comment) const
/// \c H5std_string for \a comment.
// Programmer Binh-Minh Ribler - Sep 2013
//--------------------------------------------------------------------------
-void H5Location::setComment(const H5std_string& comment) const
+void
+H5Location::setComment(const H5std_string &comment) const
{
setComment(comment.c_str());
}
@@ -265,7 +274,8 @@ void H5Location::setComment(const H5std_string& comment) const
// to another class to accommodate attribute, dataset, and named
// datatype. - BMR
//--------------------------------------------------------------------------
-void H5Location::removeComment(const char* name) const
+void
+H5Location::removeComment(const char *name) const
{
herr_t ret_value = H5Oset_comment_by_name(getId(), name, NULL, H5P_DEFAULT);
if (ret_value < 0)
@@ -279,9 +289,10 @@ void H5Location::removeComment(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013)
//--------------------------------------------------------------------------
-void H5Location::removeComment(const H5std_string& name) const
+void
+H5Location::removeComment(const H5std_string &name) const
{
- removeComment (name.c_str());
+ removeComment(name.c_str());
}
//--------------------------------------------------------------------------
@@ -299,7 +310,8 @@ void H5Location::removeComment(const H5std_string& name) const
/// will be truncated to accommodate the null terminator.
// Programmer Binh-Minh Ribler - Mar 2014
//--------------------------------------------------------------------------
-ssize_t H5Location::getComment(const char* name, size_t buf_size, char* comment) const
+ssize_t
+H5Location::getComment(const char *name, size_t buf_size, char *comment) const
{
// H5Oget_comment_by_name will get buf_size chars of the comment including
// the null terminator
@@ -307,17 +319,16 @@ ssize_t H5Location::getComment(const char* name, size_t buf_size, char* comment)
comment_len = H5Oget_comment_by_name(getId(), name, comment, buf_size, H5P_DEFAULT);
// If H5Oget_comment_by_name returns a negative value, raise an exception
- if (comment_len < 0)
- {
+ if (comment_len < 0) {
throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed");
}
// If the comment is longer than the provided buffer size, the C library
// will not null terminate it
if (static_cast<size_t>(comment_len) >= buf_size)
- comment[buf_size-1] = '\0';
+ comment[buf_size - 1] = '\0';
// Return the actual comment length, which might be different from buf_size
- return(comment_len);
+ return (comment_len);
}
//--------------------------------------------------------------------------
@@ -330,7 +341,8 @@ ssize_t H5Location::getComment(const char* name, size_t buf_size, char* comment)
///\exception H5::LocationException
// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
//--------------------------------------------------------------------------
-H5std_string H5Location::getComment(const char* name, size_t buf_size) const
+H5std_string
+H5Location::getComment(const char *name, size_t buf_size) const
{
// Initialize string to "", so that if there is no comment, the returned
// string will be empty
@@ -340,14 +352,12 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const
ssize_t comment_len = H5Oget_comment_by_name(getId(), name, NULL, (size_t)0, H5P_DEFAULT);
// If H5Oget_comment_by_name returns a negative value, raise an exception
- if (comment_len < 0)
- {
+ if (comment_len < 0) {
throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed");
}
// If comment exists, calls C routine again to get it
- else if (comment_len > 0)
- {
+ else if (comment_len > 0) {
size_t tmp_len = buf_size;
// If buffer size is not provided, use comment length
@@ -355,14 +365,13 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const
tmp_len = comment_len;
// Temporary buffer for char* comment
- char* comment_C = new char[tmp_len+1];
- HDmemset(comment_C, 0, tmp_len+1); // clear buffer
+ char *comment_C = new char[tmp_len + 1];
+ HDmemset(comment_C, 0, tmp_len + 1); // clear buffer
// Used overloaded function
- ssize_t temp_len = getComment(name, tmp_len+1, comment_C);
- if (temp_len < 0)
- {
- delete []comment_C;
+ ssize_t temp_len = getComment(name, tmp_len + 1, comment_C);
+ if (temp_len < 0) {
+ delete[] comment_C;
throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed");
}
@@ -370,11 +379,11 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const
comment = comment_C;
// Clean up resource
- delete []comment_C;
+ delete[] comment_C;
}
// Return the string comment
- return(comment);
+ return (comment);
}
//--------------------------------------------------------------------------
@@ -384,9 +393,10 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
//--------------------------------------------------------------------------
-H5std_string H5Location::getComment(const H5std_string& name, size_t buf_size) const
+H5std_string
+H5Location::getComment(const H5std_string &name, size_t buf_size) const
{
- return(getComment(name.c_str(), buf_size));
+ return (getComment(name.c_str(), buf_size));
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -400,11 +410,11 @@ H5std_string H5Location::getComment(const H5std_string& name, size_t buf_size) c
// Exception H5::ReferenceException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const
+void
+H5Location::p_reference(void *ref, const char *name, hid_t space_id, H5R_type_t ref_type) const
{
herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw ReferenceException(inMemFunc("reference"), "H5Rcreate failed");
}
}
@@ -425,12 +435,13 @@ void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_ty
///\note This method is more suitable for a dataset region reference.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-void H5Location::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const
+void
+H5Location::reference(void *ref, const char *name, const DataSpace &dataspace, H5R_type_t ref_type) const
{
try {
p_reference(ref, name, dataspace.getId(), ref_type);
}
- catch (ReferenceException& E) {
+ catch (ReferenceException &E) {
throw ReferenceException(inMemFunc("reference"), E.getDetailMsg());
}
}
@@ -451,12 +462,14 @@ void H5Location::reference(void* ref, const char* name, const DataSpace& dataspa
///\note This method is more suitable for a dataset region reference.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-void H5Location::reference(void* ref, const H5std_string& name, const DataSpace& dataspace, H5R_type_t ref_type) const
+void
+H5Location::reference(void *ref, const H5std_string &name, const DataSpace &dataspace,
+ H5R_type_t ref_type) const
{
try {
p_reference(ref, name.c_str(), dataspace.getId(), ref_type);
}
- catch (ReferenceException& E) {
+ catch (ReferenceException &E) {
throw ReferenceException(inMemFunc("reference"), E.getDetailMsg());
}
}
@@ -475,12 +488,13 @@ void H5Location::reference(void* ref, const H5std_string& name, const DataSpace&
///\note This method is more suitable for an object reference.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-void H5Location::reference(void* ref, const char* name, H5R_type_t ref_type) const
+void
+H5Location::reference(void *ref, const char *name, H5R_type_t ref_type) const
{
try {
p_reference(ref, name, -1, ref_type);
}
- catch (ReferenceException& E) {
+ catch (ReferenceException &E) {
throw ReferenceException(inMemFunc("reference"), E.getDetailMsg());
}
}
@@ -498,9 +512,10 @@ void H5Location::reference(void* ref, const char* name, H5R_type_t ref_type) con
///\note This method is more suitable for an object reference.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_type) const
+void
+H5Location::reference(void *ref, const H5std_string &name, H5R_type_t ref_type) const
{
- reference(ref, name.c_str(), ref_type);
+ reference(ref, name.c_str(), ref_type);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -517,7 +532,9 @@ void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_t
// Exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist, const char* from_func)
+hid_t
+H5Location::p_dereference(hid_t loc_id, const void *ref, H5R_type_t ref_type, const PropList &plist,
+ const char *from_func)
{
hid_t plist_id;
if (p_valid_id(plist.getId()))
@@ -526,12 +543,11 @@ hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_ty
plist_id = H5P_DEFAULT;
hid_t temp_id = H5Rdereference2(loc_id, plist_id, ref_type, ref);
- if (temp_id < 0)
- {
+ if (temp_id < 0) {
throw ReferenceException(inMemFunc(from_func), "H5Rdereference2 failed");
}
- return(temp_id);
+ return (temp_id);
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -545,7 +561,8 @@ hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_ty
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist)
+void
+H5Location::dereference(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist)
{
p_setId(p_dereference(loc.getId(), ref, ref_type, plist, "dereference"));
}
@@ -564,11 +581,12 @@ void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t
// Removed in 1.10.1 because H5Location is Attribute's baseclass
// now. -BMR
//--------------------------------------------------------------------------
- /* void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist)
+/* void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList&
+plist)
{
- p_setId(p_dereference(attr.getId(), ref, ref_type, plist, "dereference"));
+ p_setId(p_dereference(attr.getId(), ref, ref_type, plist, "dereference"));
}
- */
+*/
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
@@ -590,12 +608,13 @@ void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t
// Modification
// Sep 2012: Moved up from H5File, Group, DataSet, and DataType
//--------------------------------------------------------------------------
-H5G_obj_t H5Location::getObjType(void *ref, H5R_type_t ref_type) const
+H5G_obj_t
+H5Location::getObjType(void *ref, H5R_type_t ref_type) const
{
try {
- return(p_get_obj_type(ref, ref_type));
+ return (p_get_obj_type(ref, ref_type));
}
- catch (ReferenceException& E) {
+ catch (ReferenceException &E) {
throw ReferenceException(inMemFunc("getObjType"), E.getDetailMsg());
}
}
@@ -617,14 +636,14 @@ H5G_obj_t H5Location::getObjType(void *ref, H5R_type_t ref_type) const
// Exception H5::ReferenceException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const
+H5G_obj_t
+H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const
{
- H5G_obj_t obj_type = H5Rget_obj_type1(getId(), ref_type, ref);
- if (obj_type == H5G_UNKNOWN)
- {
+ H5G_obj_t obj_type = H5Rget_obj_type1(getId(), ref_type, ref);
+ if (obj_type == H5G_UNKNOWN) {
throw ReferenceException(inMemFunc("getObjType"), "H5Rget_obj_type1 failed");
}
- return(obj_type);
+ return (obj_type);
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -645,12 +664,13 @@ H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const
+H5O_type_t
+H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const
{
try {
- return(p_get_ref_obj_type(ref, ref_type));
+ return (p_get_ref_obj_type(ref, ref_type));
}
- catch (ReferenceException& E) {
+ catch (ReferenceException &E) {
throw ReferenceException(inMemFunc("getRefObjType"), E.getDetailMsg());
}
}
@@ -671,22 +691,20 @@ H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const
// Exception H5::ReferenceException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const
+H5O_type_t
+H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const
{
- H5O_type_t obj_type = H5O_TYPE_UNKNOWN;
- herr_t ret_value = H5Rget_obj_type2(getId(), ref_type, ref, &obj_type);
- if (ret_value < 0)
- {
+ H5O_type_t obj_type = H5O_TYPE_UNKNOWN;
+ herr_t ret_value = H5Rget_obj_type2(getId(), ref_type, ref, &obj_type);
+ if (ret_value < 0) {
throw ReferenceException(inMemFunc("getRefObjType"), "H5Rget_obj_type2 failed");
}
- if (obj_type == H5O_TYPE_UNKNOWN || obj_type >= H5O_TYPE_NTYPES)
- {
+ if (obj_type == H5O_TYPE_UNKNOWN || obj_type >= H5O_TYPE_NTYPES) {
throw ReferenceException(inMemFunc("getRefObjType"), "H5Rget_obj_type2 returned invalid type");
}
- return(obj_type);
+ return (obj_type);
}
-
//--------------------------------------------------------------------------
// Function: H5Location::getRegion
///\brief Retrieves a dataspace with the region pointed to selected.
@@ -703,24 +721,23 @@ H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const
// ref count, as a work-around for a problem described in the JIRA
// issue HDFFV-7947. -BMR
//--------------------------------------------------------------------------
-DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const
+DataSpace
+H5Location::getRegion(void *ref, H5R_type_t ref_type) const
{
hid_t space_id = H5Rget_region(getId(), ref_type, ref);
- if (space_id < 0)
- {
+ if (space_id < 0) {
throw ReferenceException(inMemFunc("getRegion"), "H5Rget_region failed");
}
try {
DataSpace dataspace;
f_DataSpace_setId(&dataspace, space_id);
- return(dataspace);
+ return (dataspace);
}
- catch (DataSpaceIException& E) {
+ catch (DataSpaceIException &E) {
throw ReferenceException(inMemFunc("getRegion"), E.getDetailMsg());
}
}
-
// From H5CommonFG.cpp
// Notes with "***Updated" are new and for Group.cpp
// Original notes are from December 2000
@@ -768,7 +785,8 @@ DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const
/// then a default size is chosen.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group H5Location::createGroup(const char* name, const LinkCreatPropList& lcpl) const
+Group
+H5Location::createGroup(const char *name, const LinkCreatPropList &lcpl) const
{
// Call C routine H5Gcreate2 to create the named group, giving the
// location id which can be a file id or a group id
@@ -779,10 +797,10 @@ Group H5Location::createGroup(const char* name, const LinkCreatPropList& lcpl) c
throwException("createGroup", "H5Gcreate2 failed");
// No failure, create and return the Group object
- Group group;
+ Group group;
H5Location *ptr = &group;
ptr->p_setId(group_id);
- return(group);
+ return (group);
}
//--------------------------------------------------------------------------
@@ -792,9 +810,10 @@ Group H5Location::createGroup(const char* name, const LinkCreatPropList& lcpl) c
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group H5Location::createGroup(const H5std_string& name, const LinkCreatPropList& lcpl) const
+Group
+H5Location::createGroup(const H5std_string &name, const LinkCreatPropList &lcpl) const
{
- return(createGroup( name.c_str(), lcpl));
+ return (createGroup(name.c_str(), lcpl));
}
//--------------------------------------------------------------------------
@@ -813,22 +832,22 @@ Group H5Location::createGroup(const H5std_string& name, const LinkCreatPropList&
/// then a default size is chosen.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group H5Location::createGroup(const char* name, size_t size_hint) const
+Group
+H5Location::createGroup(const char *name, size_t size_hint) const
{
// Group creation property list for size hint
hid_t gcpl_id = 0;
// Set the local heap size hint
- if (size_hint > 0)
- {
- // If the creation of the property list failed, throw an exception
- if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
- throwException("createGroup", "H5Pcreate failed");
-
- if (H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) {
- H5Pclose(gcpl_id);
- throwException("createGroup", "H5Pset_local_heap_size_hint failed");
- }
+ if (size_hint > 0) {
+ // If the creation of the property list failed, throw an exception
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ throwException("createGroup", "H5Pcreate failed");
+
+ if (H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) {
+ H5Pclose(gcpl_id);
+ throwException("createGroup", "H5Pset_local_heap_size_hint failed");
+ }
}
// Call C routine H5Gcreate2 to create the named group, giving the
@@ -836,18 +855,18 @@ Group H5Location::createGroup(const char* name, size_t size_hint) const
hid_t group_id = H5Gcreate2(getId(), name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT);
// Close the group creation property list, if necessary
- if(gcpl_id > 0)
- H5Pclose(gcpl_id);
+ if (gcpl_id > 0)
+ H5Pclose(gcpl_id);
// If the creation of the group failed, throw an exception
if (group_id < 0)
throwException("createGroup", "H5Gcreate2 failed");
// No failure, create and return the Group object
- Group group;
+ Group group;
H5Location *ptr = &group;
ptr->p_setId(group_id);
- return(group);
+ return (group);
}
//--------------------------------------------------------------------------
@@ -857,9 +876,10 @@ Group H5Location::createGroup(const char* name, size_t size_hint) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group H5Location::createGroup(const H5std_string& name, size_t size_hint) const
+Group
+H5Location::createGroup(const H5std_string &name, size_t size_hint) const
{
- return(createGroup( name.c_str(), size_hint));
+ return (createGroup(name.c_str(), size_hint));
}
//--------------------------------------------------------------------------
@@ -871,7 +891,8 @@ Group H5Location::createGroup(const H5std_string& name, size_t size_hint) const
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group H5Location::openGroup(const char* name) const
+Group
+H5Location::openGroup(const char *name) const
{
// Call C routine H5Gopen2 to open the named group, giving the
// location id which can be a file id or a group id
@@ -883,10 +904,10 @@ Group H5Location::openGroup(const char* name) const
// No failure, create and return the Group object
Group group;
- //group.p_setId(group_id);
+ // group.p_setId(group_id);
H5Location *ptr = &group;
ptr->p_setId(group_id);
- return(group);
+ return (group);
}
//--------------------------------------------------------------------------
@@ -896,9 +917,10 @@ Group H5Location::openGroup(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group H5Location::openGroup(const H5std_string& name) const
+Group
+H5Location::openGroup(const H5std_string &name) const
{
- return(openGroup( name.c_str()));
+ return (openGroup(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -919,14 +941,17 @@ Group H5Location::openGroup(const H5std_string& name) const
// follow the order in the C function: lcpl, dcpl, dapl, to
// accommodate the existing createDataSet calls.
//--------------------------------------------------------------------------
-DataSet H5Location::createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& dcpl, const DSetAccPropList& dapl, const LinkCreatPropList& lcpl) const
+DataSet
+H5Location::createDataSet(const char *name, const DataType &data_type, const DataSpace &data_space,
+ const DSetCreatPropList &dcpl, const DSetAccPropList &dapl,
+ const LinkCreatPropList &lcpl) const
{
- // Obtain identifiers for C API
- hid_t type_id = data_type.getId();
+ // Obtain identifiers for C API
+ hid_t type_id = data_type.getId();
hid_t space_id = data_space.getId();
- hid_t dcpl_id = dcpl.getId();
- hid_t lcpl_id = lcpl.getId();
- hid_t dapl_id = dapl.getId();
+ hid_t dcpl_id = dcpl.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t dapl_id = dapl.getId();
// Call C routine H5Dcreate2 to create the named dataset
hid_t dataset_id = H5Dcreate2(getId(), name, type_id, space_id, lcpl_id, dcpl_id, dapl_id);
@@ -938,7 +963,7 @@ DataSet H5Location::createDataSet(const char* name, const DataType& data_type, c
// No failure, create and return the DataSet object
DataSet dataset;
f_DataSet_setId(&dataset, dataset_id);
- return(dataset);
+ return (dataset);
}
//--------------------------------------------------------------------------
@@ -953,9 +978,12 @@ DataSet H5Location::createDataSet(const char* name, const DataType& data_type, c
// follow the order in the C function: lcpl, dcpl, dapl, to
// accommodate the existing createDataSet calls.
//--------------------------------------------------------------------------
-DataSet H5Location::createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& dcpl, const DSetAccPropList& dapl, const LinkCreatPropList& lcpl) const
+DataSet
+H5Location::createDataSet(const H5std_string &name, const DataType &data_type, const DataSpace &data_space,
+ const DSetCreatPropList &dcpl, const DSetAccPropList &dapl,
+ const LinkCreatPropList &lcpl) const
{
- return(createDataSet(name.c_str(), data_type, data_space, dcpl, dapl, lcpl));
+ return (createDataSet(name.c_str(), data_type, data_space, dcpl, dapl, lcpl));
}
//--------------------------------------------------------------------------
@@ -969,21 +997,22 @@ DataSet H5Location::createDataSet(const H5std_string& name, const DataType& data
// Jul 2018
// Added DSetAccPropList argument
//--------------------------------------------------------------------------
-DataSet H5Location::openDataSet(const char* name, const DSetAccPropList& dapl) const
+DataSet
+H5Location::openDataSet(const char *name, const DSetAccPropList &dapl) const
{
// Call C function H5Dopen2 to open the specified dataset, giving
// the location id and the dataset's name
- hid_t dapl_id = dapl.getId();
+ hid_t dapl_id = dapl.getId();
hid_t dataset_id = H5Dopen2(getId(), name, dapl_id);
// If the dataset's opening failed, throw an exception
- if(dataset_id < 0)
+ if (dataset_id < 0)
throwException("openDataSet", "H5Dopen2 failed");
// No failure, create and return the DataSet object
DataSet dataset;
f_DataSet_setId(&dataset, dataset_id);
- return(dataset);
+ return (dataset);
}
//--------------------------------------------------------------------------
@@ -996,9 +1025,10 @@ DataSet H5Location::openDataSet(const char* name, const DSetAccPropList& dapl) c
// Jul 2018
// Added DSetAccPropList argument
//--------------------------------------------------------------------------
-DataSet H5Location::openDataSet(const H5std_string& name, const DSetAccPropList& dapl) const
+DataSet
+H5Location::openDataSet(const H5std_string &name, const DSetAccPropList &dapl) const
{
- return(openDataSet(name.c_str(), dapl));
+ return (openDataSet(name.c_str(), dapl));
}
//--------------------------------------------------------------------------
@@ -1016,12 +1046,13 @@ DataSet H5Location::openDataSet(const H5std_string& name, const DSetAccPropList&
/// H5Lcreate_soft APIs in the HDF5 C Reference Manual.
// March 2018
//--------------------------------------------------------------------------
-void H5Location::link(const char *target_name, const char *link_name,
- const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::link(const char *target_name, const char *link_name, const LinkCreatPropList &lcpl,
+ const LinkAccPropList &lapl) const
{
herr_t ret_value = -1;
- hid_t lcpl_id = lcpl.getId();
- hid_t lapl_id = lapl.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
ret_value = H5Lcreate_soft(target_name, getId(), link_name, lcpl_id, lapl_id);
if (ret_value < 0)
@@ -1036,8 +1067,9 @@ void H5Location::link(const char *target_name, const char *link_name,
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::link(const H5std_string& target_name, const H5std_string&
- link_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::link(const H5std_string &target_name, const H5std_string &link_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
link(target_name.c_str(), link_name.c_str(), lcpl, lapl);
}
@@ -1058,16 +1090,17 @@ void H5Location::link(const H5std_string& target_name, const H5std_string&
/// H5Lcreate_hard APIs in the HDF5 C Reference Manual.
// March 2018
//--------------------------------------------------------------------------
-void H5Location::link(const char *curr_name, const Group& new_loc,
- const char *new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::link(const char *curr_name, const Group &new_loc, const char *new_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
- herr_t ret_value = -1;
- hid_t new_loc_id = new_loc.getId();
- hid_t lcpl_id = lcpl.getId();
- hid_t lapl_id = lapl.getId();
+ herr_t ret_value = -1;
+ hid_t new_loc_id = new_loc.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
ret_value = H5Lcreate_hard(getId(), curr_name, new_loc_id, new_name, lcpl_id, lapl_id);
- if (ret_value < 0)
+ if (ret_value < 0)
throwException("link", "creating link failed");
}
@@ -1079,8 +1112,9 @@ void H5Location::link(const char *curr_name, const Group& new_loc,
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::link(const H5std_string& curr_name, const Group& new_loc,
- const H5std_string& new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::link(const H5std_string &curr_name, const Group &new_loc, const H5std_string &new_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
link(curr_name.c_str(), new_loc, new_name.c_str(), lcpl, lapl);
}
@@ -1102,15 +1136,17 @@ void H5Location::link(const H5std_string& curr_name, const Group& new_loc,
/// H5Lcreate_hard APIs in the HDF5 C Reference Manual.
// March 2018
//--------------------------------------------------------------------------
-void H5Location::link(const char *curr_name, const hid_t same_loc, const char *new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::link(const char *curr_name, const hid_t same_loc, const char *new_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
herr_t ret_value = -1;
- hid_t lcpl_id = lcpl.getId();
- hid_t lapl_id = lapl.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
ret_value = H5Lcreate_hard(getId(), curr_name, same_loc, new_name, lcpl_id, lapl_id);
- if (ret_value < 0)
+ if (ret_value < 0)
throwException("link", "creating link failed");
}
@@ -1122,8 +1158,9 @@ void H5Location::link(const char *curr_name, const hid_t same_loc, const char *n
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::link(const H5std_string& curr_name, const hid_t same_loc,
- const H5std_string& new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::link(const H5std_string &curr_name, const hid_t same_loc, const H5std_string &new_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
link(curr_name.c_str(), same_loc, new_name.c_str(), lcpl, lapl);
}
@@ -1152,17 +1189,18 @@ void H5Location::link(const H5std_string& curr_name, const hid_t same_loc,
// H5L_SAME_LOC. This function will be retired in favor of
// its replacement. - BMR
//--------------------------------------------------------------------------
-void H5Location::link(H5L_type_t link_type, const char* curr_name, const char* new_name) const
+void
+H5Location::link(H5L_type_t link_type, const char *curr_name, const char *new_name) const
{
herr_t ret_value = -1;
- switch(link_type) {
+ switch (link_type) {
case H5L_TYPE_HARD:
ret_value = H5Lcreate_hard(getId(), curr_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT);
break;
case H5L_TYPE_SOFT:
- ret_value = H5Lcreate_soft(curr_name,getId(), new_name, H5P_DEFAULT, H5P_DEFAULT);
+ ret_value = H5Lcreate_soft(curr_name, getId(), new_name, H5P_DEFAULT, H5P_DEFAULT);
break;
case H5L_TYPE_ERROR:
@@ -1173,7 +1211,7 @@ void H5Location::link(H5L_type_t link_type, const char* curr_name, const char* n
break;
} /* end switch */
- if (ret_value < 0)
+ if (ret_value < 0)
throwException("link", "creating link failed");
}
@@ -1184,7 +1222,8 @@ void H5Location::link(H5L_type_t link_type, const char* curr_name, const char* n
/// \c H5std_string for \a curr_name and \a new_name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const
+void
+H5Location::link(H5L_type_t link_type, const H5std_string &curr_name, const H5std_string &new_name) const
{
link(link_type, curr_name.c_str(), new_name.c_str());
}
@@ -1200,17 +1239,17 @@ void H5Location::link(H5L_type_t link_type, const H5std_string& curr_name, const
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::copyLink(const char *src_name,
- const Group& dst, const char *dst_name, const LinkCreatPropList& lcpl,
- const LinkAccPropList& lapl) const
+void
+H5Location::copyLink(const char *src_name, const Group &dst, const char *dst_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
herr_t ret_value;
- hid_t dst_id = dst.getId();
- hid_t lcpl_id = lcpl.getId();
- hid_t lapl_id = lapl.getId();
+ hid_t dst_id = dst.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
ret_value = H5Lcopy(getId(), src_name, dst_id, dst_name, lcpl_id, lapl_id);
- if(ret_value < 0)
+ if (ret_value < 0)
throwException("copyLink", "H5Lcopy failed");
}
@@ -1222,9 +1261,9 @@ void H5Location::copyLink(const char *src_name,
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::copyLink(const H5std_string& src_name,
- const Group& dst, const H5std_string& dst_name, const LinkCreatPropList& lcpl,
- const LinkAccPropList& lapl) const
+void
+H5Location::copyLink(const H5std_string &src_name, const Group &dst, const H5std_string &dst_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
copyLink(src_name.c_str(), dst, dst_name.c_str(), lcpl, lapl);
}
@@ -1239,16 +1278,16 @@ void H5Location::copyLink(const H5std_string& src_name,
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::copyLink(const char *src_name,
- const char *dst_name, const LinkCreatPropList& lcpl,
- const LinkAccPropList& lapl) const
+void
+H5Location::copyLink(const char *src_name, const char *dst_name, const LinkCreatPropList &lcpl,
+ const LinkAccPropList &lapl) const
{
herr_t ret_value;
- hid_t lcpl_id = lcpl.getId();
- hid_t lapl_id = lapl.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
ret_value = H5Lcopy(getId(), src_name, H5L_SAME_LOC, dst_name, lcpl_id, lapl_id);
- if(ret_value < 0)
+ if (ret_value < 0)
throwException("copyLink", "H5Lcopy H5L_SAME_LOC failed");
}
@@ -1260,9 +1299,9 @@ void H5Location::copyLink(const char *src_name,
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::copyLink(const H5std_string& src_name,
- const H5std_string& dst_name, const LinkCreatPropList& lcpl,
- const LinkAccPropList& lapl) const
+void
+H5Location::copyLink(const H5std_string &src_name, const H5std_string &dst_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
copyLink(src_name.c_str(), dst_name.c_str(), lcpl, lapl);
}
@@ -1282,12 +1321,14 @@ void H5Location::copyLink(const H5std_string& src_name,
/// to the Group Interface in the HDF5 User's Guide for details.
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::moveLink(const char* src_name, const Group& dst, const char* dst_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::moveLink(const char *src_name, const Group &dst, const char *dst_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
herr_t ret_value;
- hid_t dst_id = dst.getId();
- hid_t lcpl_id = lcpl.getId();
- hid_t lapl_id = lapl.getId();
+ hid_t dst_id = dst.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
ret_value = H5Lmove(getId(), src_name, dst_id, dst_name, lcpl_id, lapl_id);
if (ret_value < 0)
@@ -1302,7 +1343,9 @@ void H5Location::moveLink(const char* src_name, const Group& dst, const char* ds
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::moveLink(const H5std_string& src_name, const Group& dst, const H5std_string& dst_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::moveLink(const H5std_string &src_name, const Group &dst, const H5std_string &dst_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
moveLink(src_name.c_str(), dst, dst_name.c_str(), lcpl, lapl);
}
@@ -1321,11 +1364,13 @@ void H5Location::moveLink(const H5std_string& src_name, const Group& dst, const
/// to the Group Interface in the HDF5 User's Guide for details.
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::moveLink(const char* src_name, const char* dst_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::moveLink(const char *src_name, const char *dst_name, const LinkCreatPropList &lcpl,
+ const LinkAccPropList &lapl) const
{
herr_t ret_value;
- hid_t lcpl_id = lcpl.getId();
- hid_t lapl_id = lapl.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
ret_value = H5Lmove(getId(), src_name, H5L_SAME_LOC, dst_name, lcpl_id, lapl_id);
if (ret_value < 0)
@@ -1340,7 +1385,9 @@ void H5Location::moveLink(const char* src_name, const char* dst_name, const Link
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::moveLink(const H5std_string& src_name, const H5std_string& dst_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::moveLink(const H5std_string &src_name, const H5std_string &dst_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
moveLink(src_name.c_str(), dst_name.c_str(), lcpl, lapl);
}
@@ -1359,7 +1406,8 @@ void H5Location::moveLink(const H5std_string& src_name, const H5std_string& dst_
// 2007: QAK modified to use H5L APIs - BMR
// 2018: Will be replaced by H5Location::moveLink() -BMR
//--------------------------------------------------------------------------
-void H5Location::move(const char* src, const char* dst) const
+void
+H5Location::move(const char *src, const char *dst) const
{
moveLink(src, dst, LinkCreatPropList::DEFAULT, LinkAccPropList::DEFAULT);
}
@@ -1372,7 +1420,8 @@ void H5Location::move(const char* src, const char* dst) const
// Modification
// 2018: Will be replaced by H5Location::moveLink() -BMR
//--------------------------------------------------------------------------
-void H5Location::move(const H5std_string& src, const H5std_string& dst) const
+void
+H5Location::move(const H5std_string &src, const H5std_string &dst) const
{
moveLink(src.c_str(), dst.c_str(), LinkCreatPropList::DEFAULT, LinkAccPropList::DEFAULT);
}
@@ -1384,7 +1433,8 @@ void H5Location::move(const H5std_string& src, const H5std_string& dst) const
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::unlink(const char* name, const LinkAccPropList& lapl) const
+void
+H5Location::unlink(const char *name, const LinkAccPropList &lapl) const
{
herr_t ret_value = H5Ldelete(getId(), name, lapl.getId());
if (ret_value < 0)
@@ -1398,7 +1448,8 @@ void H5Location::unlink(const char* name, const LinkAccPropList& lapl) const
/// \c H5std_string for \a name.
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::unlink(const H5std_string& name, const LinkAccPropList& lapl) const
+void
+H5Location::unlink(const H5std_string &name, const LinkAccPropList &lapl) const
{
unlink(name.c_str(), lapl);
}
@@ -1415,7 +1466,8 @@ void H5Location::unlink(const H5std_string& name, const LinkAccPropList& lapl) c
/// \li \c H5O_INFO_ALL
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getNativeObjinfo(H5O_native_info_t& objinfo, unsigned fields) const
+void
+H5Location::getNativeObjinfo(H5O_native_info_t &objinfo, unsigned fields) const
{
// Use C API to get information of the object
@@ -1441,7 +1493,9 @@ void H5Location::getNativeObjinfo(H5O_native_info_t& objinfo, unsigned fields) c
/// \li \c H5O_INFO_ALL
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getNativeObjinfo(const char* name, H5O_native_info_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const
+void
+H5Location::getNativeObjinfo(const char *name, H5O_native_info_t &objinfo, unsigned fields,
+ const LinkAccPropList &lapl) const
{
// Use C API to get information of the object
herr_t ret_value = H5Oget_native_info_by_name(getId(), name, &objinfo, fields, lapl.getId());
@@ -1463,7 +1517,9 @@ void H5Location::getNativeObjinfo(const char* name, H5O_native_info_t& objinfo,
///\param lapl - IN: Link access property list
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getNativeObjinfo(const H5std_string& name, H5O_native_info_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const
+void
+H5Location::getNativeObjinfo(const H5std_string &name, H5O_native_info_t &objinfo, unsigned fields,
+ const LinkAccPropList &lapl) const
{
getNativeObjinfo(name.c_str(), objinfo, fields, lapl);
}
@@ -1486,13 +1542,13 @@ void H5Location::getNativeObjinfo(const H5std_string& name, H5O_native_info_t& o
/// \li \c H5O_INFO_ALL
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getNativeObjinfo(const char* grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_native_info_t& objinfo, unsigned fields,
- const LinkAccPropList& lapl) const
+void
+H5Location::getNativeObjinfo(const char *grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
+ H5O_native_info_t &objinfo, unsigned fields, const LinkAccPropList &lapl) const
{
// Use C API to get information of the object
- herr_t ret_value = H5Oget_native_info_by_idx(getId(), grp_name, idx_type, order,
- idx, &objinfo, fields, lapl.getId());
+ herr_t ret_value =
+ H5Oget_native_info_by_idx(getId(), grp_name, idx_type, order, idx, &objinfo, fields, lapl.getId());
// Throw exception if C API returns failure
if (ret_value < 0)
@@ -1511,9 +1567,10 @@ void H5Location::getNativeObjinfo(const char* grp_name, H5_index_t idx_type,
///\param lapl - IN: Link access property list
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getNativeObjinfo(const H5std_string& grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_native_info_t& objinfo, unsigned fields,
- const LinkAccPropList& lapl) const
+void
+H5Location::getNativeObjinfo(const H5std_string &grp_name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t idx, H5O_native_info_t &objinfo, unsigned fields,
+ const LinkAccPropList &lapl) const
{
getNativeObjinfo(grp_name.c_str(), idx_type, order, idx, objinfo, fields, lapl);
}
@@ -1533,7 +1590,8 @@ void H5Location::getNativeObjinfo(const H5std_string& grp_name, H5_index_t idx_t
/// \li \c H5O_INFO_ALL
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(H5O_info2_t& objinfo, unsigned fields) const
+void
+H5Location::getObjinfo(H5O_info2_t &objinfo, unsigned fields) const
{
// Use C API to get information of the object
@@ -1562,7 +1620,9 @@ void H5Location::getObjinfo(H5O_info2_t& objinfo, unsigned fields) const
/// \li \c H5O_INFO_ALL
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(const char* name, H5O_info2_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const
+void
+H5Location::getObjinfo(const char *name, H5O_info2_t &objinfo, unsigned fields,
+ const LinkAccPropList &lapl) const
{
// Use C API to get information of the object
herr_t ret_value = H5Oget_info_by_name3(getId(), name, &objinfo, fields, lapl.getId());
@@ -1584,7 +1644,9 @@ void H5Location::getObjinfo(const char* name, H5O_info2_t& objinfo, unsigned fie
///\param lapl - IN: Link access property list
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(const H5std_string& name, H5O_info2_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const
+void
+H5Location::getObjinfo(const H5std_string &name, H5O_info2_t &objinfo, unsigned fields,
+ const LinkAccPropList &lapl) const
{
getObjinfo(name.c_str(), objinfo, fields, lapl);
}
@@ -1610,13 +1672,13 @@ void H5Location::getObjinfo(const H5std_string& name, H5O_info2_t& objinfo, unsi
/// \li \c H5O_INFO_ALL
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(const char* grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_info2_t& objinfo, unsigned fields,
- const LinkAccPropList& lapl) const
+void
+H5Location::getObjinfo(const char *grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
+ H5O_info2_t &objinfo, unsigned fields, const LinkAccPropList &lapl) const
{
// Use C API to get information of the object
- herr_t ret_value = H5Oget_info_by_idx3(getId(), grp_name, idx_type, order,
- idx, &objinfo, fields, lapl.getId());
+ herr_t ret_value =
+ H5Oget_info_by_idx3(getId(), grp_name, idx_type, order, idx, &objinfo, fields, lapl.getId());
// Throw exception if C API returns failure
if (ret_value < 0)
@@ -1635,9 +1697,9 @@ void H5Location::getObjinfo(const char* grp_name, H5_index_t idx_type,
///\param lapl - IN: Link access property list
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(const H5std_string& grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_info2_t& objinfo, unsigned fields,
- const LinkAccPropList& lapl) const
+void
+H5Location::getObjinfo(const H5std_string &grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
+ H5O_info2_t &objinfo, unsigned fields, const LinkAccPropList &lapl) const
{
getObjinfo(grp_name.c_str(), idx_type, order, idx, objinfo, fields, lapl);
}
@@ -1655,7 +1717,8 @@ void H5Location::getObjinfo(const H5std_string& grp_name, H5_index_t idx_type,
/// the HDF5 C Reference Manual.
// 2000
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const
+void
+H5Location::getObjinfo(const char *name, hbool_t follow_link, H5G_stat_t &statbuf) const
{
herr_t ret_value = H5Gget_objinfo(getId(), name, follow_link, &statbuf);
if (ret_value < 0)
@@ -1669,7 +1732,8 @@ void H5Location::getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& s
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const
+void
+H5Location::getObjinfo(const H5std_string &name, hbool_t follow_link, H5G_stat_t &statbuf) const
{
getObjinfo(name.c_str(), follow_link, statbuf);
}
@@ -1681,7 +1745,8 @@ void H5Location::getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_s
/// the paramemter \a follow_link.
// Nov, 2005
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(const char* name, H5G_stat_t& statbuf) const
+void
+H5Location::getObjinfo(const char *name, H5G_stat_t &statbuf) const
{
herr_t ret_value = H5Gget_objinfo(getId(), name, 0, &statbuf);
if (ret_value < 0)
@@ -1695,7 +1760,8 @@ void H5Location::getObjinfo(const char* name, H5G_stat_t& statbuf) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - Nov, 2005
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const
+void
+H5Location::getObjinfo(const H5std_string &name, H5G_stat_t &statbuf) const
{
getObjinfo(name.c_str(), statbuf);
}
@@ -1711,7 +1777,8 @@ void H5Location::getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// 2000
//--------------------------------------------------------------------------
-H5L_info2_t H5Location::getLinkInfo(const char* link_name, const LinkAccPropList& lapl) const
+H5L_info2_t
+H5Location::getLinkInfo(const char *link_name, const LinkAccPropList &lapl) const
{
H5L_info2_t linkinfo; // link info structure
@@ -1719,7 +1786,7 @@ H5L_info2_t H5Location::getLinkInfo(const char* link_name, const LinkAccPropList
if (ret_value < 0)
throwException("getLinkInfo", "H5Lget_info to find buffer size failed");
- return(linkinfo);
+ return (linkinfo);
}
//--------------------------------------------------------------------------
@@ -1728,9 +1795,10 @@ H5L_info2_t H5Location::getLinkInfo(const char* link_name, const LinkAccPropList
/// It differs from the above function in that it takes an
/// \c H5std_string for \a link_name.
//--------------------------------------------------------------------------
-H5L_info2_t H5Location::getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl) const
+H5L_info2_t
+H5Location::getLinkInfo(const H5std_string &link_name, const LinkAccPropList &lapl) const
{
- return(getLinkInfo(link_name.c_str(), lapl));
+ return (getLinkInfo(link_name.c_str(), lapl));
}
//--------------------------------------------------------------------------
@@ -1742,17 +1810,17 @@ H5L_info2_t H5Location::getLinkInfo(const H5std_string& link_name, const LinkAcc
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// 2000
//--------------------------------------------------------------------------
-H5std_string H5Location::getLinkval(const char* name, size_t size) const
+H5std_string
+H5Location::getLinkval(const char *name, size_t size) const
{
- H5L_info2_t linkinfo;
- char *value_C; // value in C string
- size_t val_size = size;
- H5std_string value = "";
- herr_t ret_value;
+ H5L_info2_t linkinfo;
+ char * value_C; // value in C string
+ size_t val_size = size;
+ H5std_string value = "";
+ herr_t ret_value;
// if user doesn't provide buffer size, determine it
- if (size == 0)
- {
+ if (size == 0) {
ret_value = H5Lget_info2(getId(), name, &linkinfo, H5P_DEFAULT);
if (ret_value < 0)
throwException("getLinkval", "H5Lget_info to find buffer size failed");
@@ -1761,22 +1829,20 @@ H5std_string H5Location::getLinkval(const char* name, size_t size) const
}
// if link has value, retrieve the value, otherwise, return null string
- if (val_size > 0)
- {
- value_C = new char[val_size+1]; // temporary C-string for C API
- HDmemset(value_C, 0, val_size+1); // clear buffer
+ if (val_size > 0) {
+ value_C = new char[val_size + 1]; // temporary C-string for C API
+ HDmemset(value_C, 0, val_size + 1); // clear buffer
ret_value = H5Lget_val(getId(), name, value_C, val_size, H5P_DEFAULT);
- if (ret_value < 0)
- {
- delete []value_C;
+ if (ret_value < 0) {
+ delete[] value_C;
throwException("getLinkval", "H5Lget_val failed");
}
value = H5std_string(value_C);
- delete []value_C;
+ delete[] value_C;
}
- return(value);
+ return (value);
}
//--------------------------------------------------------------------------
@@ -1786,9 +1852,10 @@ H5std_string H5Location::getLinkval(const char* name, size_t size) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string H5Location::getLinkval(const H5std_string& name, size_t size) const
+H5std_string
+H5Location::getLinkval(const H5std_string &name, size_t size) const
{
- return(getLinkval( name.c_str(), size));
+ return (getLinkval(name.c_str(), size));
}
//--------------------------------------------------------------------------
@@ -1800,7 +1867,8 @@ H5std_string H5Location::getLinkval(const H5std_string& name, size_t size) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - 2014 (original 2000)
//--------------------------------------------------------------------------
-void H5Location::mount(const char* name, const H5File& child, const PropList& plist) const
+void
+H5Location::mount(const char *name, const H5File &child, const PropList &plist) const
{
// Obtain identifiers for C API
hid_t plist_id = plist.getId();
@@ -1829,7 +1897,7 @@ void H5Location::mount(const char* name, const H5File& child, const PropList& pl
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//void H5Location::mount(const char* name, H5File& child, PropList& plist) const
+// void H5Location::mount(const char* name, H5File& child, PropList& plist) const
//{
// mount(name, child, plist);
//}
@@ -1840,7 +1908,8 @@ void H5Location::mount(const char* name, const H5File& child, const PropList& pl
/// It takes an \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::mount(const H5std_string& name, const H5File& child, const PropList& plist) const
+void
+H5Location::mount(const H5std_string &name, const H5File &child, const PropList &plist) const
{
mount(name.c_str(), child, plist);
}
@@ -1856,7 +1925,7 @@ void H5Location::mount(const H5std_string& name, const H5File& child, const Prop
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//void H5Location::mount(const H5std_string& name, H5File& child, PropList& plist) const
+// void H5Location::mount(const H5std_string& name, H5File& child, PropList& plist) const
//{
// mount(name.c_str(), child, plist);
//}
@@ -1868,7 +1937,8 @@ void H5Location::mount(const H5std_string& name, const H5File& child, const Prop
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::unmount(const char* name) const
+void
+H5Location::unmount(const char *name) const
{
// Call C routine H5Fmount to do the mouting
herr_t ret_value = H5Funmount(getId(), name);
@@ -1885,7 +1955,8 @@ void H5Location::unmount(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::unmount(const H5std_string& name) const
+void
+H5Location::unmount(const H5std_string &name) const
{
unmount(name.c_str());
}
@@ -1904,14 +1975,14 @@ void H5Location::unmount(const H5std_string& name) const
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int H5Location::iterateElems(const char* name, int *idx, H5G_iterate_t op , void* op_data)
+int
+H5Location::iterateElems(const char *name, int *idx, H5G_iterate_t op, void *op_data)
{
int ret_value = H5Giterate(getId(), name, idx, op, op_data);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throwException("iterateElems", "H5Giterate failed");
}
- return(ret_value);
+ return (ret_value);
}
//--------------------------------------------------------------------------
@@ -1921,9 +1992,10 @@ int H5Location::iterateElems(const char* name, int *idx, H5G_iterate_t op , void
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int H5Location::iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op , void* op_data)
+int
+H5Location::iterateElems(const H5std_string &name, int *idx, H5G_iterate_t op, void *op_data)
{
- return(iterateElems( name.c_str(), idx, op, op_data));
+ return (iterateElems(name.c_str(), idx, op, op_data));
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -1934,12 +2006,13 @@ int H5Location::iterateElems(const H5std_string& name, int *idx, H5G_iterate_t o
///\exception Deprecated
// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
-hsize_t H5Location::getNumObjs() const
+hsize_t
+H5Location::getNumObjs() const
{
- H5G_info_t ginfo; // Group information
+ H5G_info_t ginfo; // Group information
herr_t ret_value = H5Gget_info(getId(), &ginfo);
- if(ret_value < 0)
+ if (ret_value < 0)
throwException("getNumObjs", "H5Gget_info failed");
return (ginfo.nlinks);
}
@@ -1959,28 +2032,30 @@ hsize_t H5Location::getNumObjs() const
/// each time the group is opened.
// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
-H5std_string H5Location::getObjnameByIdx(hsize_t idx) const
+H5std_string
+H5Location::getObjnameByIdx(hsize_t idx) const
{
// call H5Lget_name_by_idx with name as NULL to get its length
- ssize_t name_len = H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, NULL, 0, H5P_DEFAULT);
- if(name_len < 0)
+ ssize_t name_len =
+ H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, NULL, 0, H5P_DEFAULT);
+ if (name_len < 0)
throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
// now, allocate C buffer to get the name
- char* name_C = new char[name_len+1];
- HDmemset(name_C, 0, name_len+1); // clear buffer
+ char *name_C = new char[name_len + 1];
+ HDmemset(name_C, 0, name_len + 1); // clear buffer
- name_len = H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, name_len+1, H5P_DEFAULT);
+ name_len =
+ H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, name_len + 1, H5P_DEFAULT);
- if (name_len < 0)
- {
- delete []name_C;
+ if (name_len < 0) {
+ delete[] name_C;
throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
}
// clean up and return the string
H5std_string name = H5std_string(name_C);
- delete []name_C;
+ delete[] name_C;
return (name);
}
@@ -2001,10 +2076,12 @@ H5std_string H5Location::getObjnameByIdx(hsize_t idx) const
/// each time the group is opened.
// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
-ssize_t H5Location::getObjnameByIdx(hsize_t idx, char* name, size_t size) const
+ssize_t
+H5Location::getObjnameByIdx(hsize_t idx, char *name, size_t size) const
{
- ssize_t name_len = H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5P_DEFAULT);
- if(name_len < 0)
+ ssize_t name_len =
+ H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5P_DEFAULT);
+ if (name_len < 0)
throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
return (name_len);
@@ -2017,22 +2094,22 @@ ssize_t H5Location::getObjnameByIdx(hsize_t idx, char* name, size_t size) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
-ssize_t H5Location::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const
+ssize_t
+H5Location::getObjnameByIdx(hsize_t idx, H5std_string &name, size_t size) const
{
- char* name_C = new char[size+1]; // temporary C-string for object name
- HDmemset(name_C, 0, size+1); // clear buffer
+ char *name_C = new char[size + 1]; // temporary C-string for object name
+ HDmemset(name_C, 0, size + 1); // clear buffer
// call overloaded function to get the name
- ssize_t name_len = getObjnameByIdx(idx, name_C, size+1);
- if(name_len < 0)
- {
- delete []name_C;
+ ssize_t name_len = getObjnameByIdx(idx, name_C, size + 1);
+ if (name_len < 0) {
+ delete[] name_C;
throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
}
// clean up and return the string
name = H5std_string(name_C);
- delete []name_C;
+ delete[] name_C;
return (name_len);
}
@@ -2054,10 +2131,11 @@ ssize_t H5Location::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size
/// - object type is not one of the valid values above
// Programmer Binh-Minh Ribler - April, 2014
//--------------------------------------------------------------------------
-H5O_type_t H5Location::childObjType(const char* objname) const
+H5O_type_t
+H5Location::childObjType(const char *objname) const
{
H5O_info2_t objinfo;
- H5O_type_t objtype = H5O_TYPE_UNKNOWN;
+ H5O_type_t objtype = H5O_TYPE_UNKNOWN;
// Use C API to get information of the object
herr_t ret_value = H5Oget_info_by_name3(getId(), objname, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT);
@@ -2067,19 +2145,18 @@ H5O_type_t H5Location::childObjType(const char* objname) const
throwException("childObjType", "H5Oget_info_by_name failed");
// Return a valid type or throw an exception for unknown type
else
- switch (objinfo.type)
- {
- case H5O_TYPE_GROUP:
- case H5O_TYPE_DATASET:
- case H5O_TYPE_NAMED_DATATYPE:
- objtype = objinfo.type;
- break;
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- throwException("childObjType", "Unknown type of object");
+ switch (objinfo.type) {
+ case H5O_TYPE_GROUP:
+ case H5O_TYPE_DATASET:
+ case H5O_TYPE_NAMED_DATATYPE:
+ objtype = objinfo.type;
+ break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ throwException("childObjType", "Unknown type of object");
}
- return(objtype);
+ return (objtype);
}
//--------------------------------------------------------------------------
@@ -2092,11 +2169,12 @@ H5O_type_t H5Location::childObjType(const char* objname) const
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// Programmer Binh-Minh Ribler - April, 2014
//--------------------------------------------------------------------------
-H5O_type_t H5Location::childObjType(const H5std_string& objname) const
+H5O_type_t
+H5Location::childObjType(const H5std_string &objname) const
{
// Use overloaded function
H5O_type_t objtype = childObjType(objname.c_str());
- return(objtype);
+ return (objtype);
}
//--------------------------------------------------------------------------
@@ -2128,33 +2206,35 @@ H5O_type_t H5Location::childObjType(const H5std_string& objname) const
// can be added later when needed.
// Programmer Binh-Minh Ribler - April, 2014
//--------------------------------------------------------------------------
-H5O_type_t H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_iter_order_t order, const char* objname) const
+H5O_type_t
+H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_iter_order_t order,
+ const char *objname) const
{
- herr_t ret_value;
+ herr_t ret_value;
H5O_info2_t objinfo;
- H5O_type_t objtype = H5O_TYPE_UNKNOWN;
+ H5O_type_t objtype = H5O_TYPE_UNKNOWN;
// Use C API to get information of the object
- ret_value = H5Oget_info_by_idx3(getId(), objname, index_type, order, index, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret_value = H5Oget_info_by_idx3(getId(), objname, index_type, order, index, &objinfo, H5O_INFO_BASIC,
+ H5P_DEFAULT);
// Throw exception if C API returns failure
if (ret_value < 0)
throwException("childObjType", "H5Oget_info_by_idx failed");
// Return a valid type or throw an exception for unknown type
else
- switch (objinfo.type)
- {
- case H5O_TYPE_GROUP:
- case H5O_TYPE_DATASET:
- case H5O_TYPE_NAMED_DATATYPE:
- objtype = objinfo.type;
- break;
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- throwException("childObjType", "Unknown type of object");
+ switch (objinfo.type) {
+ case H5O_TYPE_GROUP:
+ case H5O_TYPE_DATASET:
+ case H5O_TYPE_NAMED_DATATYPE:
+ objtype = objinfo.type;
+ break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ throwException("childObjType", "Unknown type of object");
}
- return(objtype);
+ return (objtype);
}
//--------------------------------------------------------------------------
@@ -2171,25 +2251,26 @@ H5O_type_t H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_ite
/// - version number is not one of the valid values above
// Programmer Binh-Minh Ribler - April, 2014
//--------------------------------------------------------------------------
-unsigned H5Location::childObjVersion(const char* objname) const
+unsigned
+H5Location::childObjVersion(const char *objname) const
{
H5O_native_info_t objinfo;
- unsigned version = 0;
+ unsigned version = 0;
// Use C API to get information of the object
- herr_t ret_value = H5Oget_native_info_by_name(getId(), objname, &objinfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+ herr_t ret_value =
+ H5Oget_native_info_by_name(getId(), objname, &objinfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
// Throw exception if C API returns failure
if (ret_value < 0)
throwException("childObjVersion", "H5Oget_info_by_name failed");
// Return a valid version or throw an exception for invalid value
- else
- {
+ else {
version = objinfo.hdr.version;
if (version != H5O_VERSION_1 && version != H5O_VERSION_2)
throwException("childObjVersion", "Invalid version for object");
}
- return(version);
+ return (version);
}
//--------------------------------------------------------------------------
@@ -2202,11 +2283,12 @@ unsigned H5Location::childObjVersion(const char* objname) const
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// Programmer Binh-Minh Ribler - April, 2014
//--------------------------------------------------------------------------
-unsigned H5Location::childObjVersion(const H5std_string& objname) const
+unsigned
+H5Location::childObjVersion(const H5std_string &objname) const
{
// Use overloaded function
unsigned version = childObjVersion(objname.c_str());
- return(version);
+ return (version);
}
#ifndef H5_NO_DEPRECATED_SYMBOLS
@@ -2220,13 +2302,14 @@ unsigned H5Location::childObjVersion(const H5std_string& objname) const
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
-H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx) const
+H5G_obj_t
+H5Location::getObjTypeByIdx(hsize_t idx) const
{
- H5G_obj_t obj_type = H5Gget_objtype_by_idx(getId(), idx);
- if (obj_type == H5G_UNKNOWN)
+ H5G_obj_t obj_type = H5Gget_objtype_by_idx(getId(), idx);
+ if (obj_type == H5G_UNKNOWN)
throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
- return (obj_type);
+ return (obj_type);
}
//--------------------------------------------------------------------------
@@ -2242,10 +2325,11 @@ H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx) const
// Modification
// Modified to use the other function. -BMR, 2016/03/07
//--------------------------------------------------------------------------
-H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, char* type_name) const
+H5G_obj_t
+H5Location::getObjTypeByIdx(hsize_t idx, char *type_name) const
{
H5std_string stype_name(type_name);
- return(getObjTypeByIdx(idx, stype_name));
+ return (getObjTypeByIdx(idx, stype_name));
}
//--------------------------------------------------------------------------
// Function: H5Location::getObjTypeByIdx
@@ -2258,22 +2342,30 @@ H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, char* type_name) const
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
-H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const
+H5G_obj_t
+H5Location::getObjTypeByIdx(hsize_t idx, H5std_string &type_name) const
{
H5G_obj_t obj_type = H5Gget_objtype_by_idx(getId(), idx);
- switch (obj_type)
- {
- case H5G_LINK: type_name = H5std_string("symbolic link"); break;
- case H5G_GROUP: type_name = H5std_string("group"); break;
- case H5G_DATASET: type_name = H5std_string("dataset"); break;
- case H5G_TYPE: type_name = H5std_string("datatype"); break;
- case H5G_UNKNOWN:
- case H5G_UDLINK:
- case H5G_RESERVED_5:
- case H5G_RESERVED_6:
- case H5G_RESERVED_7:
- default:
- throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
+ switch (obj_type) {
+ case H5G_LINK:
+ type_name = H5std_string("symbolic link");
+ break;
+ case H5G_GROUP:
+ type_name = H5std_string("group");
+ break;
+ case H5G_DATASET:
+ type_name = H5std_string("dataset");
+ break;
+ case H5G_TYPE:
+ type_name = H5std_string("datatype");
+ break;
+ case H5G_UNKNOWN:
+ case H5G_UDLINK:
+ case H5G_RESERVED_5:
+ case H5G_RESERVED_6:
+ case H5G_RESERVED_7:
+ default:
+ throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
}
return (obj_type);
}
@@ -2294,7 +2386,8 @@ H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) cons
// maintain backward compatibility. For other subclasses, throw
// LocationException.
//--------------------------------------------------------------------------
-void H5Location::throwException(const H5std_string& func_name, const H5std_string& msg) const
+void
+H5Location::throwException(const H5std_string &func_name, const H5std_string &msg) const
{
throw LocationException(inMemFunc(func_name.c_str()), msg);
}
@@ -2325,7 +2418,8 @@ void H5Location::throwException(const H5std_string& func_name, const H5std_strin
// param new_id - IN: New id to set
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void f_DataSpace_setId(DataSpace* dspace, hid_t new_id)
+void
+f_DataSpace_setId(DataSpace *dspace, hid_t new_id)
{
dspace->p_setId(new_id);
}
@@ -2339,4 +2433,4 @@ H5Location::~H5Location() {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
index 3c30715..3ea58cd 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -15,7 +15,7 @@
#ifndef __H5Location_H
#define __H5Location_H
-#include "H5Classes.h" // constains forward class declarations
+#include "H5Classes.h" // constains forward class declarations
namespace H5 {
@@ -29,319 +29,312 @@ namespace H5 {
*/
// Inheritance: IdComponent
class H5_DLLCPP H5Location : public IdComponent {
- public:
- // Checks if a link of a given name exists in a location
- bool nameExists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- bool nameExists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ public:
+ // Checks if a link of a given name exists in a location
+ bool nameExists(const char *name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+ bool nameExists(const H5std_string &name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
- // Checks if a link of a given name exists in a location
- // Deprecated in favor of nameExists for better name.
- bool exists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- bool exists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ // Checks if a link of a given name exists in a location
+ // Deprecated in favor of nameExists for better name.
+ bool exists(const char *name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+ bool exists(const H5std_string &name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
- // Flushes all buffers associated with this location to disk.
- void flush(H5F_scope_t scope) const;
+ // Flushes all buffers associated with this location to disk.
+ void flush(H5F_scope_t scope) const;
- // Gets the name of the file, specified by this location.
- H5std_string getFileName() const;
+ // Gets the name of the file, specified by this location.
+ H5std_string getFileName() const;
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Retrieves the type of object that an object reference points to.
- H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
+ // Retrieves the type of object that an object reference points to.
+ H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- // Retrieves the type of object that an object reference points to.
- H5O_type_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
- // Note: getRefObjType deprecates getObjType, but getObjType's name is
- // misleading, so getRefObjType is used in the new function instead.
-
- // Sets the comment for an HDF5 object specified by its name.
- void setComment(const char* name, const char* comment) const;
- void setComment(const H5std_string& name, const H5std_string& comment) const;
- void setComment(const char* comment) const;
- void setComment(const H5std_string& comment) const;
-
- // Retrieves comment for the HDF5 object specified by its name.
- ssize_t getComment(const char* name, size_t buf_size, char* comment) const;
- H5std_string getComment(const char* name, size_t buf_size=0) const;
- H5std_string getComment(const H5std_string& name, size_t buf_size=0) const;
-
- // Removes the comment for the HDF5 object specified by its name.
- void removeComment(const char* name) const;
- void removeComment(const H5std_string& name) const;
-
- // Creates a reference to a named object or to a dataset region
- // in this object.
- void reference(void* ref, const char* name,
- H5R_type_t ref_type = H5R_OBJECT) const;
- void reference(void* ref, const H5std_string& name,
- H5R_type_t ref_type = H5R_OBJECT) const;
- void reference(void* ref, const char* name, const DataSpace& dataspace,
- H5R_type_t ref_type = H5R_DATASET_REGION) const;
- void reference(void* ref, const H5std_string& name, const DataSpace& dataspace,
- H5R_type_t ref_type = H5R_DATASET_REGION) const;
-
- // Open a referenced object whose location is specified by either
- // a file, an HDF5 object, or an attribute.
- void dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
- // Removed in 1.10.1, because H5Location is baseclass
- //void dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
-
- // Retrieves a dataspace with the region pointed to selected.
- DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
-
- // Create a new group with using link create property list.
- Group createGroup(const char* name, const LinkCreatPropList& lcpl) const;
- Group createGroup(const H5std_string& name, const LinkCreatPropList& lcpl) const;
-
-// From CommonFG
- // Creates a new group at this location which can be a file
- // or another group.
- Group createGroup(const char* name, size_t size_hint = 0) const;
- Group createGroup(const H5std_string& name, size_t size_hint = 0) const;
-
- // Opens an existing group in a location which can be a file
- // or another group.
- Group openGroup(const char* name) const;
- Group openGroup(const H5std_string& name) const;
-
- // Creates a new dataset in this location.
- DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT, const DSetAccPropList& dapl = DSetAccPropList::DEFAULT, const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT) const;
- DataSet createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT, const DSetAccPropList& dapl = DSetAccPropList::DEFAULT, const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT) const;
-
- // Deprecated to add LinkCreatPropList and DSetAccPropList - 1.10.3
- // DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
- // DataSet createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
-
- // Opens an existing dataset at this location.
- // DSetAccPropList is added - 1.10.3
- DataSet openDataSet(const char* name, const DSetAccPropList& dapl = DSetAccPropList::DEFAULT) const;
- DataSet openDataSet(const H5std_string& name, const DSetAccPropList& dapl = DSetAccPropList::DEFAULT) const;
-
- H5L_info2_t getLinkInfo(const char* link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- H5L_info2_t getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Returns the value of a symbolic link.
- H5std_string getLinkval(const char* link_name, size_t size=0) const;
- H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
-
- // Returns the number of objects in this group.
- // Deprecated - moved to H5::Group in 1.10.2.
- hsize_t getNumObjs() const;
-
- // Retrieves the name of an object in this group, given the
- // object's index.
- H5std_string getObjnameByIdx(hsize_t idx) const;
- ssize_t getObjnameByIdx(hsize_t idx, char* name, size_t size) const;
- ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const;
-
- // Retrieves the type of an object in this file or group, given the
- // object's name
- H5O_type_t childObjType(const H5std_string& objname) const;
- H5O_type_t childObjType(const char* objname) const;
- H5O_type_t childObjType(hsize_t index, H5_index_t index_type=H5_INDEX_NAME, H5_iter_order_t order=H5_ITER_INC, const char* objname=".") const;
-
- // Returns the object header version of an object in this file or group,
- // given the object's name.
- unsigned childObjVersion(const char* objname) const;
- unsigned childObjVersion(const H5std_string& objname) const;
-
- // Retrieves information about an HDF5 object.
- void getObjinfo(H5O_info2_t& objinfo, unsigned fields = H5O_INFO_BASIC) const;
-
- // Retrieves information about an HDF5 object, given its name.
- void getObjinfo(const char* name, H5O_info2_t& objinfo,
- unsigned fields = H5O_INFO_BASIC,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void getObjinfo(const H5std_string& name, H5O_info2_t& objinfo,
- unsigned fields = H5O_INFO_BASIC,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Retrieves information about an HDF5 object, given its index.
- void getObjinfo(const char* grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_info2_t& objinfo,
- unsigned fields = H5O_INFO_BASIC,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void getObjinfo(const H5std_string& grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_info2_t& objinfo,
- unsigned fields = H5O_INFO_BASIC,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Retrieves native native information about an HDF5 object.
- void getNativeObjinfo(H5O_native_info_t& objinfo, unsigned fields = H5O_NATIVE_INFO_HDR) const;
-
- // Retrieves native information about an HDF5 object, given its name.
- void getNativeObjinfo(const char* name, H5O_native_info_t& objinfo,
- unsigned fields = H5O_NATIVE_INFO_HDR,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void getNativeObjinfo(const H5std_string& name, H5O_native_info_t& objinfo,
- unsigned fields = H5O_NATIVE_INFO_HDR,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Retrieves native information about an HDF5 object, given its index.
- void getNativeObjinfo(const char* grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_native_info_t& objinfo,
- unsigned fields = H5O_NATIVE_INFO_HDR,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void getNativeObjinfo(const H5std_string& grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_native_info_t& objinfo,
- unsigned fields = H5O_NATIVE_INFO_HDR,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ // Retrieves the type of object that an object reference points to.
+ H5O_type_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
+ // Note: getRefObjType deprecates getObjType, but getObjType's name is
+ // misleading, so getRefObjType is used in the new function instead.
+
+ // Sets the comment for an HDF5 object specified by its name.
+ void setComment(const char *name, const char *comment) const;
+ void setComment(const H5std_string &name, const H5std_string &comment) const;
+ void setComment(const char *comment) const;
+ void setComment(const H5std_string &comment) const;
+
+ // Retrieves comment for the HDF5 object specified by its name.
+ ssize_t getComment(const char *name, size_t buf_size, char *comment) const;
+ H5std_string getComment(const char *name, size_t buf_size = 0) const;
+ H5std_string getComment(const H5std_string &name, size_t buf_size = 0) const;
+
+ // Removes the comment for the HDF5 object specified by its name.
+ void removeComment(const char *name) const;
+ void removeComment(const H5std_string &name) const;
+
+ // Creates a reference to a named object or to a dataset region
+ // in this object.
+ void reference(void *ref, const char *name, H5R_type_t ref_type = H5R_OBJECT) const;
+ void reference(void *ref, const H5std_string &name, H5R_type_t ref_type = H5R_OBJECT) const;
+ void reference(void *ref, const char *name, const DataSpace &dataspace,
+ H5R_type_t ref_type = H5R_DATASET_REGION) const;
+ void reference(void *ref, const H5std_string &name, const DataSpace &dataspace,
+ H5R_type_t ref_type = H5R_DATASET_REGION) const;
+
+ // Open a referenced object whose location is specified by either
+ // a file, an HDF5 object, or an attribute.
+ void dereference(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT,
+ const PropList &plist = PropList::DEFAULT);
+ // Removed in 1.10.1, because H5Location is baseclass
+ // void dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const
+ // PropList& plist = PropList::DEFAULT);
+
+ // Retrieves a dataspace with the region pointed to selected.
+ DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
+
+ // Create a new group with using link create property list.
+ Group createGroup(const char *name, const LinkCreatPropList &lcpl) const;
+ Group createGroup(const H5std_string &name, const LinkCreatPropList &lcpl) const;
+
+ // From CommonFG
+ // Creates a new group at this location which can be a file
+ // or another group.
+ Group createGroup(const char *name, size_t size_hint = 0) const;
+ Group createGroup(const H5std_string &name, size_t size_hint = 0) const;
+
+ // Opens an existing group in a location which can be a file
+ // or another group.
+ Group openGroup(const char *name) const;
+ Group openGroup(const H5std_string &name) const;
+
+ // Creates a new dataset in this location.
+ DataSet createDataSet(const char *name, const DataType &data_type, const DataSpace &data_space,
+ const DSetCreatPropList &create_plist = DSetCreatPropList::DEFAULT,
+ const DSetAccPropList & dapl = DSetAccPropList::DEFAULT,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT) const;
+ DataSet createDataSet(const H5std_string &name, const DataType &data_type, const DataSpace &data_space,
+ const DSetCreatPropList &create_plist = DSetCreatPropList::DEFAULT,
+ const DSetAccPropList & dapl = DSetAccPropList::DEFAULT,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT) const;
+
+ // Deprecated to add LinkCreatPropList and DSetAccPropList - 1.10.3
+ // DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const
+ // DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const; DataSet createDataSet(const
+ // H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList&
+ // create_plist = DSetCreatPropList::DEFAULT) const;
+
+ // Opens an existing dataset at this location.
+ // DSetAccPropList is added - 1.10.3
+ DataSet openDataSet(const char *name, const DSetAccPropList &dapl = DSetAccPropList::DEFAULT) const;
+ DataSet openDataSet(const H5std_string & name,
+ const DSetAccPropList &dapl = DSetAccPropList::DEFAULT) const;
+
+ H5L_info2_t getLinkInfo(const char * link_name,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+ H5L_info2_t getLinkInfo(const H5std_string & link_name,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+
+ // Returns the value of a symbolic link.
+ H5std_string getLinkval(const char *link_name, size_t size = 0) const;
+ H5std_string getLinkval(const H5std_string &link_name, size_t size = 0) const;
+
+ // Returns the number of objects in this group.
+ // Deprecated - moved to H5::Group in 1.10.2.
+ hsize_t getNumObjs() const;
+
+ // Retrieves the name of an object in this group, given the
+ // object's index.
+ H5std_string getObjnameByIdx(hsize_t idx) const;
+ ssize_t getObjnameByIdx(hsize_t idx, char *name, size_t size) const;
+ ssize_t getObjnameByIdx(hsize_t idx, H5std_string &name, size_t size) const;
+
+ // Retrieves the type of an object in this file or group, given the
+ // object's name
+ H5O_type_t childObjType(const H5std_string &objname) const;
+ H5O_type_t childObjType(const char *objname) const;
+ H5O_type_t childObjType(hsize_t index, H5_index_t index_type = H5_INDEX_NAME,
+ H5_iter_order_t order = H5_ITER_INC, const char *objname = ".") const;
+
+ // Returns the object header version of an object in this file or group,
+ // given the object's name.
+ unsigned childObjVersion(const char *objname) const;
+ unsigned childObjVersion(const H5std_string &objname) const;
+
+ // Retrieves information about an HDF5 object.
+ void getObjinfo(H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC) const;
+
+ // Retrieves information about an HDF5 object, given its name.
+ void getObjinfo(const char *name, H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+ void getObjinfo(const H5std_string &name, H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+
+ // Retrieves information about an HDF5 object, given its index.
+ void getObjinfo(const char *grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
+ H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+ void getObjinfo(const H5std_string &grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
+ H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+
+ // Retrieves native native information about an HDF5 object.
+ void getNativeObjinfo(H5O_native_info_t &objinfo, unsigned fields = H5O_NATIVE_INFO_HDR) const;
+
+ // Retrieves native information about an HDF5 object, given its name.
+ void getNativeObjinfo(const char *name, H5O_native_info_t &objinfo, unsigned fields = H5O_NATIVE_INFO_HDR,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+ void getNativeObjinfo(const H5std_string &name, H5O_native_info_t &objinfo,
+ unsigned fields = H5O_NATIVE_INFO_HDR,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+
+ // Retrieves native information about an HDF5 object, given its index.
+ void getNativeObjinfo(const char *grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
+ H5O_native_info_t &objinfo, unsigned fields = H5O_NATIVE_INFO_HDR,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+ void getNativeObjinfo(const H5std_string &grp_name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t idx, H5O_native_info_t &objinfo, unsigned fields = H5O_NATIVE_INFO_HDR,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Returns the type of an object in this group, given the
- // object's index.
- H5G_obj_t getObjTypeByIdx(hsize_t idx) const;
- H5G_obj_t getObjTypeByIdx(hsize_t idx, char* type_name) const;
- H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const;
-
- // Returns information about an HDF5 object, given by its name,
- // at this location. - Deprecated
- void getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const;
- void getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const;
- void getObjinfo(const char* name, H5G_stat_t& statbuf) const;
- void getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const;
-
- // Iterates over the elements of this group - not implemented in
- // C++ style yet.
- int iterateElems(const char* name, int *idx, H5G_iterate_t op, void *op_data);
- int iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op, void *op_data);
+ // Returns the type of an object in this group, given the
+ // object's index.
+ H5G_obj_t getObjTypeByIdx(hsize_t idx) const;
+ H5G_obj_t getObjTypeByIdx(hsize_t idx, char *type_name) const;
+ H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string &type_name) const;
+
+ // Returns information about an HDF5 object, given by its name,
+ // at this location. - Deprecated
+ void getObjinfo(const char *name, hbool_t follow_link, H5G_stat_t &statbuf) const;
+ void getObjinfo(const H5std_string &name, hbool_t follow_link, H5G_stat_t &statbuf) const;
+ void getObjinfo(const char *name, H5G_stat_t &statbuf) const;
+ void getObjinfo(const H5std_string &name, H5G_stat_t &statbuf) const;
+
+ // Iterates over the elements of this group - not implemented in
+ // C++ style yet.
+ int iterateElems(const char *name, int *idx, H5G_iterate_t op, void *op_data);
+ int iterateElems(const H5std_string &name, int *idx, H5G_iterate_t op, void *op_data);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- // Creates a soft link from link_name to target_name.
- void link(const char *target_name, const char *link_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void link(const H5std_string& target_name,
- const H5std_string& link_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Creates a hard link from new_name to curr_name.
- void link(const char *curr_name,
- const Group& new_loc, const char *new_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void link(const H5std_string& curr_name,
- const Group& new_loc, const H5std_string& new_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Creates a hard link from new_name to curr_name in same location.
- void link(const char *curr_name,
- const hid_t same_loc, const char *new_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void link(const H5std_string& curr_name,
- const hid_t same_loc, const H5std_string& new_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Creates a link of the specified type from new_name to current_name;
- // both names are interpreted relative to the specified location id.
- // Deprecated due to inadequate functionality.
- void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const;
- void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const;
-
- // Removes the specified link from this location.
- void unlink(const char *link_name,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void unlink(const H5std_string& link_name,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Mounts the file 'child' onto this location.
- void mount(const char* name, const H5File& child, const PropList& plist) const;
- void mount(const H5std_string& name, const H5File& child, const PropList& plist) const;
-
- // Unmounts the file named 'name' from this parent location.
- void unmount(const char* name) const;
- void unmount(const H5std_string& name) const;
-
- // Copies a link from a group to another.
- void copyLink(const char *src_name,
- const Group& dst, const char *dst_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void copyLink(const H5std_string& src_name,
- const Group& dst, const H5std_string& dst_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Makes a copy of a link in the same group.
- void copyLink(const char *src_name, const char *dst_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void copyLink(const H5std_string& src_name,
- const H5std_string& dst_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Renames a link in this group and moves to a new location.
- void moveLink(const char* src_name,
- const Group& dst, const char* dst_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void moveLink(const H5std_string& src_name,
- const Group& dst, const H5std_string& dst_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Renames a link in this group.
- void moveLink(const char* src_name, const char* dst_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void moveLink(const H5std_string& src_name,
- const H5std_string& dst_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Renames an object at this location.
- // Deprecated due to inadequate functionality.
- void move(const char* src, const char* dst) const;
- void move(const H5std_string& src, const H5std_string& dst) const;
-
-// end From CommonFG
-
- /// For subclasses, H5File and Group, to throw appropriate exception.
- virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
-
- // Default constructor
- H5Location();
-
- protected:
+ // Creates a soft link from link_name to target_name.
+ void link(const char *target_name, const char *link_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+ void link(const H5std_string &target_name, const H5std_string &link_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+
+ // Creates a hard link from new_name to curr_name.
+ void link(const char *curr_name, const Group &new_loc, const char *new_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+ void link(const H5std_string &curr_name, const Group &new_loc, const H5std_string &new_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+
+ // Creates a hard link from new_name to curr_name in same location.
+ void link(const char *curr_name, const hid_t same_loc, const char *new_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+ void link(const H5std_string &curr_name, const hid_t same_loc, const H5std_string &new_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+
+ // Creates a link of the specified type from new_name to current_name;
+ // both names are interpreted relative to the specified location id.
+ // Deprecated due to inadequate functionality.
+ void link(H5L_type_t link_type, const char *curr_name, const char *new_name) const;
+ void link(H5L_type_t link_type, const H5std_string &curr_name, const H5std_string &new_name) const;
+
+ // Removes the specified link from this location.
+ void unlink(const char *link_name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+ void unlink(const H5std_string &link_name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+
+ // Mounts the file 'child' onto this location.
+ void mount(const char *name, const H5File &child, const PropList &plist) const;
+ void mount(const H5std_string &name, const H5File &child, const PropList &plist) const;
+
+ // Unmounts the file named 'name' from this parent location.
+ void unmount(const char *name) const;
+ void unmount(const H5std_string &name) const;
+
+ // Copies a link from a group to another.
+ void copyLink(const char *src_name, const Group &dst, const char *dst_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+ void copyLink(const H5std_string &src_name, const Group &dst, const H5std_string &dst_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+
+ // Makes a copy of a link in the same group.
+ void copyLink(const char *src_name, const char *dst_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+ void copyLink(const H5std_string &src_name, const H5std_string &dst_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+
+ // Renames a link in this group and moves to a new location.
+ void moveLink(const char *src_name, const Group &dst, const char *dst_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+ void moveLink(const H5std_string &src_name, const Group &dst, const H5std_string &dst_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+
+ // Renames a link in this group.
+ void moveLink(const char *src_name, const char *dst_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+ void moveLink(const H5std_string &src_name, const H5std_string &dst_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+
+ // Renames an object at this location.
+ // Deprecated due to inadequate functionality.
+ void move(const char *src, const char *dst) const;
+ void move(const H5std_string &src, const H5std_string &dst) const;
+
+ // end From CommonFG
+
+ /// For subclasses, H5File and Group, to throw appropriate exception.
+ virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const;
+
+ // Default constructor
+ H5Location();
+
+ protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // *** Deprecation warning ***
- // The following two constructors are no longer appropriate after the
- // data member "id" had been moved to the sub-classes.
- // The copy constructor is a noop and is removed in 1.8.15 and the
- // other will be removed from 1.10 release, and then from 1.8 if its
- // removal does not raise any problems in two 1.10 releases.
+ // *** Deprecation warning ***
+ // The following two constructors are no longer appropriate after the
+ // data member "id" had been moved to the sub-classes.
+ // The copy constructor is a noop and is removed in 1.8.15 and the
+ // other will be removed from 1.10 release, and then from 1.8 if its
+ // removal does not raise any problems in two 1.10 releases.
- // Creates a copy of an existing object giving the location id.
- // H5Location(const hid_t loc_id);
+ // Creates a copy of an existing object giving the location id.
+ // H5Location(const hid_t loc_id);
- // Creates a reference to an HDF5 object or a dataset region.
- void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const;
+ // Creates a reference to an HDF5 object or a dataset region.
+ void p_reference(void *ref, const char *name, hid_t space_id, H5R_type_t ref_type) const;
- // Dereferences a ref into an HDF5 id.
- hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist, const char* from_func);
+ // Dereferences a ref into an HDF5 id.
+ hid_t p_dereference(hid_t loc_id, const void *ref, H5R_type_t ref_type, const PropList &plist,
+ const char *from_func);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Retrieves the type of object that an object reference points to.
- H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const;
+ // Retrieves the type of object that an object reference points to.
+ H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- // Retrieves the type of object that an object reference points to.
- H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const;
+ // Retrieves the type of object that an object reference points to.
+ H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const;
- // Sets the identifier of this object to a new value. - this one
- // doesn't increment reference count
- //virtual void p_setId(const hid_t new_id);
+ // Sets the identifier of this object to a new value. - this one
+ // doesn't increment reference count
+ // virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
- // Noop destructor.
- virtual ~H5Location();
+ // Noop destructor.
+ virtual ~H5Location();
}; // end of H5Location
} // namespace H5
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 081cab7..3feed51 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -13,7 +13,7 @@
#include <string>
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -42,23 +42,23 @@ namespace H5 {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// userAttrOpWrpr interfaces between the user's function and the
// C library function H5Aiterate2
-extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name,
- const H5A_info_t *ainfo, void *op_data)
+extern "C" herr_t
+userAttrOpWrpr(hid_t loc_id, const char *attr_name, const H5A_info_t *ainfo, void *op_data)
{
- H5std_string s_attr_name = H5std_string(attr_name);
- UserData4Aiterate* myData = reinterpret_cast<UserData4Aiterate *> (op_data);
+ H5std_string s_attr_name = H5std_string(attr_name);
+ UserData4Aiterate *myData = reinterpret_cast<UserData4Aiterate *>(op_data);
myData->op(*myData->location, s_attr_name, myData->opData);
return 0;
}
// userVisitOpWrpr interfaces between the user's function and the
// C library function H5Ovisit3
-extern "C" herr_t userVisitOpWrpr(hid_t obj_id, const char *attr_name,
- const H5O_info2_t *obj_info, void *op_data)
+extern "C" herr_t
+userVisitOpWrpr(hid_t obj_id, const char *attr_name, const H5O_info2_t *obj_info, void *op_data)
{
- H5std_string s_attr_name = H5std_string(attr_name);
- UserData4Visit* myData = reinterpret_cast<UserData4Visit *> (op_data);
- int status = myData->op(*myData->obj, s_attr_name, obj_info, myData->opData);
+ H5std_string s_attr_name = H5std_string(attr_name);
+ UserData4Visit *myData = reinterpret_cast<UserData4Visit *>(op_data);
+ int status = myData->op(*myData->obj, s_attr_name, obj_info, myData->opData);
return status;
}
@@ -78,7 +78,8 @@ H5Object::H5Object() : H5Location() {}
// param new_id - IN: New id to set
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void f_Attribute_setId(Attribute* attr, hid_t new_id)
+void
+f_Attribute_setId(Attribute *attr, hid_t new_id)
{
attr->p_setId(new_id);
}
@@ -105,19 +106,20 @@ void f_Attribute_setId(Attribute* attr, hid_t new_id)
/// recreate it with this function.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute H5Object::createAttribute(const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist) const
+Attribute
+H5Object::createAttribute(const char *name, const DataType &data_type, const DataSpace &data_space,
+ const PropList &create_plist) const
{
- hid_t type_id = data_type.getId();
+ hid_t type_id = data_type.getId();
hid_t space_id = data_space.getId();
hid_t plist_id = create_plist.getId();
- hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT);
+ hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT);
// If the attribute id is valid, create and return the Attribute object
- if (attr_id > 0)
- {
+ if (attr_id > 0) {
Attribute attr;
f_Attribute_setId(&attr, attr_id);
- return(attr);
+ return (attr);
}
else
throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed");
@@ -130,9 +132,11 @@ Attribute H5Object::createAttribute(const char* name, const DataType& data_type,
/// a reference to an \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute H5Object::createAttribute(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist) const
+Attribute
+H5Object::createAttribute(const H5std_string &name, const DataType &data_type, const DataSpace &data_space,
+ const PropList &create_plist) const
{
- return(createAttribute(name.c_str(), data_type, data_space, create_plist));
+ return (createAttribute(name.c_str(), data_type, data_space, create_plist));
}
//--------------------------------------------------------------------------
@@ -143,17 +147,16 @@ Attribute H5Object::createAttribute(const H5std_string& name, const DataType& da
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute H5Object::openAttribute(const char* name) const
+Attribute
+H5Object::openAttribute(const char *name) const
{
hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT);
- if (attr_id > 0)
- {
+ if (attr_id > 0) {
Attribute attr;
f_Attribute_setId(&attr, attr_id);
- return(attr);
+ return (attr);
}
- else
- {
+ else {
throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed");
}
}
@@ -165,9 +168,10 @@ Attribute H5Object::openAttribute(const char* name) const
/// a reference to an \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute H5Object::openAttribute(const H5std_string& name) const
+Attribute
+H5Object::openAttribute(const H5std_string &name) const
{
- return(openAttribute(name.c_str()));
+ return (openAttribute(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -178,18 +182,17 @@ Attribute H5Object::openAttribute(const H5std_string& name) const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute H5Object::openAttribute(const unsigned int idx) const
+Attribute
+H5Object::openAttribute(const unsigned int idx) const
{
- hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER,
- H5_ITER_INC, static_cast<hsize_t>(idx), H5P_DEFAULT, H5P_DEFAULT);
- if (attr_id > 0)
- {
+ hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, static_cast<hsize_t>(idx),
+ H5P_DEFAULT, H5P_DEFAULT);
+ if (attr_id > 0) {
Attribute attr;
f_Attribute_setId(&attr, attr_id);
- return(attr);
+ return (attr);
}
- else
- {
+ else {
throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed");
}
}
@@ -209,18 +212,19 @@ Attribute H5Object::openAttribute(const unsigned int idx) const
/// void (*)(H5::H5Location&, H5std_string, void*).
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_data)
+int
+H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_data)
{
// store the user's function and data
- UserData4Aiterate* userData = new UserData4Aiterate;
- userData->opData = op_data;
- userData->op = user_op;
- userData->location = this;
+ UserData4Aiterate *userData = new UserData4Aiterate;
+ userData->opData = op_data;
+ userData->op = user_op;
+ userData->location = this;
// call the C library routine H5Aiterate2 to iterate the attributes
hsize_t idx = _idx ? static_cast<hsize_t>(*_idx) : 0;
- int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx,
- userAttrOpWrpr, static_cast<void *>(userData));
+ int ret_value =
+ H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, userAttrOpWrpr, static_cast<void *>(userData));
// release memory
delete userData;
@@ -229,9 +233,9 @@ int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_dat
/* Pass back update index value to calling code */
if (_idx)
*_idx = static_cast<unsigned>(idx);
- return(ret_value);
+ return (ret_value);
}
- else // raise exception when H5Aiterate returns a negative value
+ else // raise exception when H5Aiterate returns a negative value
throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed");
}
@@ -268,16 +272,19 @@ int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_dat
/// C Reference Manual.
// Programmer Binh-Minh Ribler - Feb, 2019
//--------------------------------------------------------------------------
-void H5Object::visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data, unsigned int fields)
+void
+H5Object::visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data,
+ unsigned int fields)
{
// Store the user's function and data
- UserData4Visit* userData = new UserData4Visit;
- userData->opData = op_data;
- userData->op = user_op;
- userData->obj = this;
+ UserData4Visit *userData = new UserData4Visit;
+ userData->opData = op_data;
+ userData->op = user_op;
+ userData->obj = this;
// Call the C API passing in op wrapper and info
- herr_t ret_value = H5Ovisit3(getId(), idx_type, order, userVisitOpWrpr, static_cast<void *>(userData), fields);
+ herr_t ret_value =
+ H5Ovisit3(getId(), idx_type, order, userVisitOpWrpr, static_cast<void *>(userData), fields);
// Release memory
delete userData;
@@ -300,10 +307,11 @@ void H5Object::visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_
/// - version number is not one of the valid values above
// Programmer Binh-Minh Ribler - December, 2016
//--------------------------------------------------------------------------
-unsigned H5Object::objVersion() const
+unsigned
+H5Object::objVersion() const
{
H5O_native_info_t objinfo;
- unsigned version = 0;
+ unsigned version = 0;
// Use C API to get information of the object
herr_t ret_value = H5Oget_native_info(getId(), &objinfo, H5O_NATIVE_INFO_HDR);
@@ -312,13 +320,12 @@ unsigned H5Object::objVersion() const
if (ret_value < 0)
throw Exception(inMemFunc("objVersion"), "H5Oget_native_info failed");
// Return a valid version or throw an exception for invalid value
- else
- {
+ else {
version = objinfo.hdr.version;
if (version != H5O_VERSION_1 && version != H5O_VERSION_2)
throw ObjHeaderIException("objVersion", "Invalid version for object");
}
- return(version);
+ return (version);
}
//--------------------------------------------------------------------------
@@ -328,14 +335,15 @@ unsigned H5Object::objVersion() const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int H5Object::getNumAttrs() const
+int
+H5Object::getNumAttrs() const
{
- H5O_info2_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
- if(H5Oget_info3(getId(), &oinfo, H5O_INFO_NUM_ATTRS) < 0)
+ if (H5Oget_info3(getId(), &oinfo, H5O_INFO_NUM_ATTRS) < 0)
throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed");
else
- return(static_cast<int>(oinfo.num_attrs));
+ return (static_cast<int>(oinfo.num_attrs));
}
//--------------------------------------------------------------------------
@@ -345,7 +353,8 @@ int H5Object::getNumAttrs() const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2013
//--------------------------------------------------------------------------
-bool H5Object::attrExists(const char* name) const
+bool
+H5Object::attrExists(const char *name) const
{
// Call C routine H5Aexists to determine whether an attribute exists
// at this location, which could be specified by a file, group, dataset,
@@ -353,7 +362,7 @@ bool H5Object::attrExists(const char* name) const
herr_t ret_value = H5Aexists(getId(), name);
if (ret_value > 0)
return true;
- else if(ret_value == 0)
+ else if (ret_value == 0)
return false;
else // Raise exception when H5Aexists returns a negative value
throw AttributeIException(inMemFunc("attrExists"), "H5Aexists failed");
@@ -366,9 +375,10 @@ bool H5Object::attrExists(const char* name) const
/// a reference to an \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool H5Object::attrExists(const H5std_string& name) const
+bool
+H5Object::attrExists(const H5std_string &name) const
{
- return(attrExists(name.c_str()));
+ return (attrExists(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -378,7 +388,8 @@ bool H5Object::attrExists(const H5std_string& name) const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Object::removeAttr(const char* name) const
+void
+H5Object::removeAttr(const char *name) const
{
herr_t ret_value = H5Adelete(getId(), name);
if (ret_value < 0)
@@ -392,7 +403,8 @@ void H5Object::removeAttr(const char* name) const
/// a reference to an \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Object::removeAttr(const H5std_string& name) const
+void
+H5Object::removeAttr(const H5std_string &name) const
{
removeAttr(name.c_str());
}
@@ -405,7 +417,8 @@ void H5Object::removeAttr(const H5std_string& name) const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
-void H5Object::renameAttr(const char* oldname, const char* newname) const
+void
+H5Object::renameAttr(const char *oldname, const char *newname) const
{
herr_t ret_value = H5Arename(getId(), oldname, newname);
if (ret_value < 0)
@@ -419,9 +432,10 @@ void H5Object::renameAttr(const char* oldname, const char* newname) const
/// a reference to an \c H5std_string for the names.
// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
-void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newname) const
+void
+H5Object::renameAttr(const H5std_string &oldname, const H5std_string &newname) const
{
- renameAttr (oldname.c_str(), newname.c_str());
+ renameAttr(oldname.c_str(), newname.c_str());
}
//--------------------------------------------------------------------------
@@ -430,22 +444,21 @@ void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newna
///\return The name of the object
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-ssize_t H5Object::getObjName(char *obj_name, size_t buf_size) const
+ssize_t
+H5Object::getObjName(char *obj_name, size_t buf_size) const
{
// H5Iget_name will get buf_size-1 chars of the name to null terminate it
ssize_t name_size = H5Iget_name(getId(), obj_name, buf_size);
// If H5Iget_name returns a negative value, raise an exception
- if (name_size < 0)
- {
+ if (name_size < 0) {
throw Exception(inMemFunc("getObjName"), "H5Iget_name failed");
}
- else if (name_size == 0)
- {
+ else if (name_size == 0) {
throw Exception(inMemFunc("getObjName"), "Object must have a name, but name length is 0");
}
// Return length of the name
- return(name_size);
+ return (name_size);
}
//--------------------------------------------------------------------------
@@ -455,7 +468,8 @@ ssize_t H5Object::getObjName(char *obj_name, size_t buf_size) const
///\exception H5::Exception
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-H5std_string H5Object::getObjName() const
+H5std_string
+H5Object::getObjName() const
{
H5std_string obj_name(""); // object name to return
@@ -463,31 +477,28 @@ H5std_string H5Object::getObjName() const
ssize_t name_size = H5Iget_name(getId(), NULL, static_cast<size_t>(0));
// If H5Iget_name failed, throw exception
- if (name_size < 0)
- {
+ if (name_size < 0) {
throw Exception(inMemFunc("getObjName"), "H5Iget_name failed");
}
- else if (name_size == 0)
- {
+ else if (name_size == 0) {
throw Exception(inMemFunc("getObjName"), "Object must have a name, but name length is 0");
}
// Object's name exists, retrieve it
- else if (name_size > 0)
- {
- char* name_C = new char[name_size+1]; // temporary C-string
- HDmemset(name_C, 0, name_size+1); // clear buffer
+ else if (name_size > 0) {
+ char *name_C = new char[name_size + 1]; // temporary C-string
+ HDmemset(name_C, 0, name_size + 1); // clear buffer
// Use overloaded function
- name_size = getObjName(name_C, name_size+1);
+ name_size = getObjName(name_C, name_size + 1);
// Convert the C object name to return
obj_name = name_C;
// Clean up resource
- delete []name_C;
+ delete[] name_C;
}
// Return object's name
- return(obj_name);
+ return (obj_name);
}
//--------------------------------------------------------------------------
@@ -503,35 +514,34 @@ H5std_string H5Object::getObjName() const
/// which case the entire name will be retrieved.
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-ssize_t H5Object::getObjName(H5std_string& obj_name, size_t len) const
+ssize_t
+H5Object::getObjName(H5std_string &obj_name, size_t len) const
{
ssize_t name_size = 0;
// If no length is provided, get the entire object name
- if (len == 0)
- {
- obj_name = getObjName();
+ if (len == 0) {
+ obj_name = getObjName();
name_size = obj_name.length();
}
// If length is provided, get that number of characters in name
- else
- {
- char* name_C = new char[len+1]; // temporary C-string
- HDmemset(name_C, 0, len+1); // clear buffer
+ else {
+ char *name_C = new char[len + 1]; // temporary C-string
+ HDmemset(name_C, 0, len + 1); // clear buffer
// Use overloaded function
- name_size = getObjName(name_C, len+1);
+ name_size = getObjName(name_C, len + 1);
// Convert the C object name to return
obj_name = name_C;
// Clean up resource
- delete []name_C;
+ delete[] name_C;
}
// Otherwise, keep obj_name intact
// Return name size
- return(name_size);
+ return (name_size);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -543,4 +553,4 @@ ssize_t H5Object::getObjName(H5std_string& obj_name, size_t len) const
H5Object::~H5Object() {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h
index a63229c..104e2a5 100644
--- a/c++/src/H5Object.h
+++ b/c++/src/H5Object.h
@@ -40,94 +40,92 @@ namespace H5 {
// Inheritance: H5Location -> IdComponent
// Define the operator function pointer for H5Aiterate().
-typedef void (*attr_operator_t)(H5Object& loc,
- const H5std_string attr_name,
- void *operator_data);
+typedef void (*attr_operator_t)(H5Object &loc, const H5std_string attr_name, void *operator_data);
// Define the operator function pointer for H5Ovisit3().
-typedef int (*visit_operator_t)(H5Object& obj,
- const H5std_string attr_name,
- const H5O_info2_t *oinfo,
- void *operator_data);
+typedef int (*visit_operator_t)(H5Object &obj, const H5std_string attr_name, const H5O_info2_t *oinfo,
+ void *operator_data);
// User data for attribute iteration
class UserData4Aiterate {
- public:
- attr_operator_t op;
- void* opData;
- H5Object* location; // Consider changing to H5Location
+ public:
+ attr_operator_t op;
+ void * opData;
+ H5Object * location; // Consider changing to H5Location
};
// User data for visit iteration
class UserData4Visit {
- public:
- visit_operator_t op;
- void* opData;
- H5Object* obj;
+ public:
+ visit_operator_t op;
+ void * opData;
+ H5Object * obj;
};
class H5_DLLCPP H5Object : public H5Location {
- public:
- // Creates an attribute for the specified object
- // PropList is currently not used, so always be default.
- Attribute createAttribute(const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
- Attribute createAttribute(const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
+ public:
+ // Creates an attribute for the specified object
+ // PropList is currently not used, so always be default.
+ Attribute createAttribute(const char *name, const DataType &type, const DataSpace &space,
+ const PropList &create_plist = PropList::DEFAULT) const;
+ Attribute createAttribute(const H5std_string &name, const DataType &type, const DataSpace &space,
+ const PropList &create_plist = PropList::DEFAULT) const;
- // Given its name, opens the attribute that belongs to an object at
- // this location.
- Attribute openAttribute(const char* name) const;
- Attribute openAttribute(const H5std_string& name) const;
+ // Given its name, opens the attribute that belongs to an object at
+ // this location.
+ Attribute openAttribute(const char *name) const;
+ Attribute openAttribute(const H5std_string &name) const;
- // Given its index, opens the attribute that belongs to an object at
- // this location.
- Attribute openAttribute(const unsigned int idx) const;
+ // Given its index, opens the attribute that belongs to an object at
+ // this location.
+ Attribute openAttribute(const unsigned int idx) const;
- // Iterate user's function over the attributes of this object.
- int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL);
+ // Iterate user's function over the attributes of this object.
+ int iterateAttrs(attr_operator_t user_op, unsigned *idx = NULL, void *op_data = NULL);
- // Recursively visit elements reachable from this object.
- void visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data, unsigned int fields);
+ // Recursively visit elements reachable from this object.
+ void visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data,
+ unsigned int fields);
- // Returns the object header version of an object
- unsigned objVersion() const;
+ // Returns the object header version of an object
+ unsigned objVersion() const;
- // Determines the number of attributes belong to this object.
- int getNumAttrs() const;
+ // Determines the number of attributes belong to this object.
+ int getNumAttrs() const;
- // Checks whether the named attribute exists for this object.
- bool attrExists(const char* name) const;
- bool attrExists(const H5std_string& name) const;
+ // Checks whether the named attribute exists for this object.
+ bool attrExists(const char *name) const;
+ bool attrExists(const H5std_string &name) const;
- // Renames the named attribute to a new name.
- void renameAttr(const char* oldname, const char* newname) const;
- void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
+ // Renames the named attribute to a new name.
+ void renameAttr(const char *oldname, const char *newname) const;
+ void renameAttr(const H5std_string &oldname, const H5std_string &newname) const;
- // Removes the named attribute from this object.
- void removeAttr(const char* name) const;
- void removeAttr(const H5std_string& name) const;
+ // Removes the named attribute from this object.
+ void removeAttr(const char *name) const;
+ void removeAttr(const H5std_string &name) const;
- // Returns an identifier.
- virtual hid_t getId() const = 0;
-
- // Gets the name of this HDF5 object, i.e., Group, DataSet, or
- // DataType.
- ssize_t getObjName(char *obj_name, size_t buf_size = 0) const;
- ssize_t getObjName(H5std_string& obj_name, size_t len = 0) const;
- H5std_string getObjName() const;
+ // Returns an identifier.
+ virtual hid_t getId() const = 0;
+ // Gets the name of this HDF5 object, i.e., Group, DataSet, or
+ // DataType.
+ ssize_t getObjName(char *obj_name, size_t buf_size = 0) const;
+ ssize_t getObjName(H5std_string &obj_name, size_t len = 0) const;
+ H5std_string getObjName() const;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- protected:
- // Default constructor
- H5Object();
+ protected:
+ // Default constructor
+ H5Object();
- // Sets the identifier of this object to a new value. - this one
- // doesn't increment reference count
- virtual void p_setId(const hid_t new_id) = 0;
+ // Sets the identifier of this object to a new value. - this one
+ // doesn't increment reference count
+ virtual void p_setId(const hid_t new_id) = 0;
- // Noop destructor.
- virtual ~H5Object();
+ // Noop destructor.
+ virtual ~H5Object();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5OcreatProp.cpp b/c++/src/H5OcreatProp.cpp
index 0542d5e..a5af9df 100644
--- a/c++/src/H5OcreatProp.cpp
+++ b/c++/src/H5OcreatProp.cpp
@@ -27,7 +27,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-ObjCreatPropList* ObjCreatPropList::DEFAULT_ = 0;
+ObjCreatPropList *ObjCreatPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: ObjCreatPropList::getConstant
@@ -40,13 +40,13 @@ ObjCreatPropList* ObjCreatPropList::DEFAULT_ = 0;
// happen.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-ObjCreatPropList* ObjCreatPropList::getConstant()
+ObjCreatPropList *
+ObjCreatPropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -55,8 +55,9 @@ ObjCreatPropList* ObjCreatPropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new ObjCreatPropList(H5P_OBJECT_CREATE);
else
- throw PropListIException("ObjCreatPropList::getConstant", "ObjCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException("ObjCreatPropList::getConstant",
+ "ObjCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -66,7 +67,8 @@ ObjCreatPropList* ObjCreatPropList::getConstant()
// exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void ObjCreatPropList::deleteConstants()
+void
+ObjCreatPropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -75,7 +77,7 @@ void ObjCreatPropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose: Constant for default property
//--------------------------------------------------------------------------
-const ObjCreatPropList& ObjCreatPropList::DEFAULT = *getConstant();
+const ObjCreatPropList &ObjCreatPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -92,7 +94,7 @@ ObjCreatPropList::ObjCreatPropList() : PropList(H5P_OBJECT_CREATE) {}
///\param original - IN: ObjCreatPropList instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-ObjCreatPropList::ObjCreatPropList(const ObjCreatPropList& original) : PropList(original) {}
+ObjCreatPropList::ObjCreatPropList(const ObjCreatPropList &original) : PropList(original) {}
//--------------------------------------------------------------------------
// Function: ObjCreatPropList overloaded constructor
@@ -116,11 +118,11 @@ ObjCreatPropList::ObjCreatPropList(const hid_t plist_id) : PropList(plist_id) {}
/// H5Pset_attr_phase_change API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
-void ObjCreatPropList::setAttrPhaseChange(unsigned max_compact, unsigned min_dense) const
+void
+ObjCreatPropList::setAttrPhaseChange(unsigned max_compact, unsigned min_dense) const
{
herr_t ret_value = H5Pset_attr_phase_change(id, max_compact, min_dense);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("ObjCreatPropList::setAttrPhaseChange", "H5Pset_attr_phase_change failed");
}
}
@@ -139,12 +141,12 @@ void ObjCreatPropList::setAttrPhaseChange(unsigned max_compact, unsigned min_den
/// H5Pget_attr_phase_change API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
-void ObjCreatPropList::getAttrPhaseChange(unsigned& max_compact, unsigned& min_dense) const
+void
+ObjCreatPropList::getAttrPhaseChange(unsigned &max_compact, unsigned &min_dense) const
{
herr_t ret_value;
ret_value = H5Pget_attr_phase_change(id, &max_compact, &min_dense);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("ObjCreatPropList::getAttrPhaseChange", "H5Pget_attr_phase_change failed");
}
}
@@ -168,11 +170,11 @@ void ObjCreatPropList::getAttrPhaseChange(unsigned& max_compact, unsigned& min_d
/// in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
-void ObjCreatPropList::setAttrCrtOrder(unsigned crt_order_flags) const
+void
+ObjCreatPropList::setAttrCrtOrder(unsigned crt_order_flags) const
{
herr_t ret_value = H5Pset_attr_creation_order(id, crt_order_flags);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("ObjCreatPropList::setAttrCrtOrder", "H5Pset_attr_creation_order failed");
}
}
@@ -190,16 +192,16 @@ void ObjCreatPropList::setAttrCrtOrder(unsigned crt_order_flags) const
/// in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
-unsigned ObjCreatPropList::getAttrCrtOrder() const
+unsigned
+ObjCreatPropList::getAttrCrtOrder() const
{
- herr_t ret_value;
+ herr_t ret_value;
unsigned crt_order_flags = 0;
- ret_value = H5Pget_attr_creation_order(id, &crt_order_flags);
- if (ret_value < 0)
- {
+ ret_value = H5Pget_attr_creation_order(id, &crt_order_flags);
+ if (ret_value < 0) {
throw PropListIException("ObjCreatPropList::getAttrCrtOrder", "H5Pget_attr_creation_order failed");
}
- return(crt_order_flags);
+ return (crt_order_flags);
}
//--------------------------------------------------------------------------
@@ -209,4 +211,4 @@ unsigned ObjCreatPropList::getAttrCrtOrder() const
//--------------------------------------------------------------------------
ObjCreatPropList::~ObjCreatPropList() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5OcreatProp.h b/c++/src/H5OcreatProp.h
index 1d5dd55..ffafd44 100644
--- a/c++/src/H5OcreatProp.h
+++ b/c++/src/H5OcreatProp.h
@@ -23,49 +23,52 @@ namespace H5 {
*/
// Inheritance: PropList -> IdComponent
class H5_DLLCPP ObjCreatPropList : public PropList {
- public:
- ///\brief Default object creation property list.
- static const ObjCreatPropList& DEFAULT;
+ public:
+ ///\brief Default object creation property list.
+ static const ObjCreatPropList &DEFAULT;
- // Creates a object creation property list.
- ObjCreatPropList();
+ // Creates a object creation property list.
+ ObjCreatPropList();
- // Sets attribute storage phase change thresholds.
- void setAttrPhaseChange(unsigned max_compact = 8, unsigned min_dense = 6) const;
+ // Sets attribute storage phase change thresholds.
+ void setAttrPhaseChange(unsigned max_compact = 8, unsigned min_dense = 6) const;
- // Gets attribute storage phase change thresholds.
- void getAttrPhaseChange(unsigned& max_compact, unsigned& min_dense) const;
+ // Gets attribute storage phase change thresholds.
+ void getAttrPhaseChange(unsigned &max_compact, unsigned &min_dense) const;
- // Sets tracking and indexing of attribute creation order.
- void setAttrCrtOrder(unsigned crt_order_flags) const;
+ // Sets tracking and indexing of attribute creation order.
+ void setAttrCrtOrder(unsigned crt_order_flags) const;
- // Gets tracking and indexing settings for attribute creation order.
- unsigned getAttrCrtOrder() const;
+ // Gets tracking and indexing settings for attribute creation order.
+ unsigned getAttrCrtOrder() const;
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("ObjCreatPropList");
+ }
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("ObjCreatPropList"); }
+ // Copy constructor: same as the original ObjCreatPropList.
+ ObjCreatPropList(const ObjCreatPropList &original);
- // Copy constructor: same as the original ObjCreatPropList.
- ObjCreatPropList(const ObjCreatPropList& original);
+ // Creates a copy of an existing object creation property list
+ // using the property list id.
+ ObjCreatPropList(const hid_t plist_id);
- // Creates a copy of an existing object creation property list
- // using the property list id.
- ObjCreatPropList (const hid_t plist_id);
-
- // Noop destructor
- virtual ~ObjCreatPropList();
+ // Noop destructor
+ virtual ~ObjCreatPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
- private:
- static ObjCreatPropList* DEFAULT_;
+ private:
+ static ObjCreatPropList *DEFAULT_;
- // Creates the global constant, should only be used by the library
- static ObjCreatPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static ObjCreatPropList *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp
index 57ba5e5..0339f4e 100644
--- a/c++/src/H5PredType.cpp
+++ b/c++/src/H5PredType.cpp
@@ -41,10 +41,7 @@ namespace H5 {
// the provided HDF5 predefined datatype.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PredType::PredType(const hid_t predtype_id) : AtomType(predtype_id)
-{
- id = H5Tcopy(predtype_id);
-}
+PredType::PredType(const hid_t predtype_id) : AtomType(predtype_id) { id = H5Tcopy(predtype_id); }
//--------------------------------------------------------------------------
// Function: PredType default constructor
@@ -60,7 +57,7 @@ PredType::PredType() : AtomType() {}
///\param original - IN: PredType instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PredType::PredType(const PredType& original) : AtomType(original) {}
+PredType::PredType(const PredType &original) : AtomType(original) {}
//--------------------------------------------------------------------------
// Function: PredType::operator=
@@ -73,29 +70,35 @@ PredType::PredType(const PredType& original) : AtomType(original) {}
// the new id in the left hand side object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PredType& PredType::operator=(const PredType& rhs)
+PredType &
+PredType::operator=(const PredType &rhs)
{
if (this != &rhs)
copy(rhs);
- return(*this);
+ return (*this);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// These dummy functions do not inherit from DataType - they'll
// throw an DataTypeIException if invoked.
-void PredType::commit(H5Location& loc, const char* name)
+void
+PredType::commit(H5Location &loc, const char *name)
{
- throw DataTypeIException("PredType::commit", "Error: Attempted to commit a predefined datatype. Invalid operation!");
+ throw DataTypeIException("PredType::commit",
+ "Error: Attempted to commit a predefined datatype. Invalid operation!");
}
-void PredType::commit(H5Location& loc, const H5std_string& name)
+void
+PredType::commit(H5Location &loc, const H5std_string &name)
{
commit(loc, name.c_str());
}
-bool PredType::committed()
+bool
+PredType::committed()
{
- throw DataTypeIException("PredType::committed", "Error: Attempting to check for commit status on a predefined datatype.");
+ throw DataTypeIException("PredType::committed",
+ "Error: Attempting to check for commit status on a predefined datatype.");
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -115,180 +118,180 @@ PredType::~PredType() {}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// Definition pointers for the constants
-PredType* PredType::PREDTYPE_CONST_ = 0; //dummy
-PredType* PredType::STD_I8BE_;
-PredType* PredType::STD_I8LE_;
-PredType* PredType::STD_I16BE_;
-PredType* PredType::STD_I16LE_;
-PredType* PredType::STD_I32BE_;
-PredType* PredType::STD_I32LE_;
-PredType* PredType::STD_I64BE_;
-PredType* PredType::STD_I64LE_;
-PredType* PredType::STD_U8BE_;
-PredType* PredType::STD_U8LE_;
-PredType* PredType::STD_U16BE_;
-PredType* PredType::STD_U16LE_;
-PredType* PredType::STD_U32BE_;
-PredType* PredType::STD_U32LE_;
-PredType* PredType::STD_U64BE_;
-PredType* PredType::STD_U64LE_;
-PredType* PredType::STD_B8BE_;
-PredType* PredType::STD_B8LE_;
-PredType* PredType::STD_B16BE_;
-PredType* PredType::STD_B16LE_;
-PredType* PredType::STD_B32BE_;
-PredType* PredType::STD_B32LE_;
-PredType* PredType::STD_B64BE_;
-PredType* PredType::STD_B64LE_;
-PredType* PredType::STD_REF_OBJ_;
-PredType* PredType::STD_REF_DSETREG_;
-
-PredType* PredType::C_S1_;
-PredType* PredType::FORTRAN_S1_;
-
-PredType* PredType::IEEE_F32BE_;
-PredType* PredType::IEEE_F32LE_;
-PredType* PredType::IEEE_F64BE_;
-PredType* PredType::IEEE_F64LE_;
-
-PredType* PredType::UNIX_D32BE_;
-PredType* PredType::UNIX_D32LE_;
-PredType* PredType::UNIX_D64BE_;
-PredType* PredType::UNIX_D64LE_;
-
-PredType* PredType::INTEL_I8_;
-PredType* PredType::INTEL_I16_;
-PredType* PredType::INTEL_I32_;
-PredType* PredType::INTEL_I64_;
-PredType* PredType::INTEL_U8_;
-PredType* PredType::INTEL_U16_;
-PredType* PredType::INTEL_U32_;
-PredType* PredType::INTEL_U64_;
-PredType* PredType::INTEL_B8_;
-PredType* PredType::INTEL_B16_;
-PredType* PredType::INTEL_B32_;
-PredType* PredType::INTEL_B64_;
-PredType* PredType::INTEL_F32_;
-PredType* PredType::INTEL_F64_;
-
-PredType* PredType::ALPHA_I8_;
-PredType* PredType::ALPHA_I16_;
-PredType* PredType::ALPHA_I32_;
-PredType* PredType::ALPHA_I64_;
-PredType* PredType::ALPHA_U8_;
-PredType* PredType::ALPHA_U16_;
-PredType* PredType::ALPHA_U32_;
-PredType* PredType::ALPHA_U64_;
-PredType* PredType::ALPHA_B8_;
-PredType* PredType::ALPHA_B16_;
-PredType* PredType::ALPHA_B32_;
-PredType* PredType::ALPHA_B64_;
-PredType* PredType::ALPHA_F32_;
-PredType* PredType::ALPHA_F64_;
-
-PredType* PredType::MIPS_I8_;
-PredType* PredType::MIPS_I16_;
-PredType* PredType::MIPS_I32_;
-PredType* PredType::MIPS_I64_;
-PredType* PredType::MIPS_U8_;
-PredType* PredType::MIPS_U16_;
-PredType* PredType::MIPS_U32_;
-PredType* PredType::MIPS_U64_;
-PredType* PredType::MIPS_B8_;
-PredType* PredType::MIPS_B16_;
-PredType* PredType::MIPS_B32_;
-PredType* PredType::MIPS_B64_;
-PredType* PredType::MIPS_F32_;
-PredType* PredType::MIPS_F64_;
-
-PredType* PredType::NATIVE_CHAR_;
-PredType* PredType::NATIVE_SCHAR_;
-PredType* PredType::NATIVE_UCHAR_;
-PredType* PredType::NATIVE_SHORT_;
-PredType* PredType::NATIVE_USHORT_;
-PredType* PredType::NATIVE_INT_;
-PredType* PredType::NATIVE_UINT_;
-PredType* PredType::NATIVE_LONG_;
-PredType* PredType::NATIVE_ULONG_;
-PredType* PredType::NATIVE_LLONG_;
-PredType* PredType::NATIVE_ULLONG_;
-PredType* PredType::NATIVE_FLOAT_;
-PredType* PredType::NATIVE_DOUBLE_;
-PredType* PredType::NATIVE_LDOUBLE_;
-PredType* PredType::NATIVE_B8_;
-PredType* PredType::NATIVE_B16_;
-PredType* PredType::NATIVE_B32_;
-PredType* PredType::NATIVE_B64_;
-PredType* PredType::NATIVE_OPAQUE_;
-PredType* PredType::NATIVE_HSIZE_;
-PredType* PredType::NATIVE_HSSIZE_;
-PredType* PredType::NATIVE_HERR_;
-PredType* PredType::NATIVE_HBOOL_;
-
-PredType* PredType::NATIVE_INT8_;
-PredType* PredType::NATIVE_UINT8_;
-PredType* PredType::NATIVE_INT16_;
-PredType* PredType::NATIVE_UINT16_;
-PredType* PredType::NATIVE_INT32_;
-PredType* PredType::NATIVE_UINT32_;
-PredType* PredType::NATIVE_INT64_;
-PredType* PredType::NATIVE_UINT64_;
+PredType *PredType::PREDTYPE_CONST_ = 0; // dummy
+PredType *PredType::STD_I8BE_;
+PredType *PredType::STD_I8LE_;
+PredType *PredType::STD_I16BE_;
+PredType *PredType::STD_I16LE_;
+PredType *PredType::STD_I32BE_;
+PredType *PredType::STD_I32LE_;
+PredType *PredType::STD_I64BE_;
+PredType *PredType::STD_I64LE_;
+PredType *PredType::STD_U8BE_;
+PredType *PredType::STD_U8LE_;
+PredType *PredType::STD_U16BE_;
+PredType *PredType::STD_U16LE_;
+PredType *PredType::STD_U32BE_;
+PredType *PredType::STD_U32LE_;
+PredType *PredType::STD_U64BE_;
+PredType *PredType::STD_U64LE_;
+PredType *PredType::STD_B8BE_;
+PredType *PredType::STD_B8LE_;
+PredType *PredType::STD_B16BE_;
+PredType *PredType::STD_B16LE_;
+PredType *PredType::STD_B32BE_;
+PredType *PredType::STD_B32LE_;
+PredType *PredType::STD_B64BE_;
+PredType *PredType::STD_B64LE_;
+PredType *PredType::STD_REF_OBJ_;
+PredType *PredType::STD_REF_DSETREG_;
+
+PredType *PredType::C_S1_;
+PredType *PredType::FORTRAN_S1_;
+
+PredType *PredType::IEEE_F32BE_;
+PredType *PredType::IEEE_F32LE_;
+PredType *PredType::IEEE_F64BE_;
+PredType *PredType::IEEE_F64LE_;
+
+PredType *PredType::UNIX_D32BE_;
+PredType *PredType::UNIX_D32LE_;
+PredType *PredType::UNIX_D64BE_;
+PredType *PredType::UNIX_D64LE_;
+
+PredType *PredType::INTEL_I8_;
+PredType *PredType::INTEL_I16_;
+PredType *PredType::INTEL_I32_;
+PredType *PredType::INTEL_I64_;
+PredType *PredType::INTEL_U8_;
+PredType *PredType::INTEL_U16_;
+PredType *PredType::INTEL_U32_;
+PredType *PredType::INTEL_U64_;
+PredType *PredType::INTEL_B8_;
+PredType *PredType::INTEL_B16_;
+PredType *PredType::INTEL_B32_;
+PredType *PredType::INTEL_B64_;
+PredType *PredType::INTEL_F32_;
+PredType *PredType::INTEL_F64_;
+
+PredType *PredType::ALPHA_I8_;
+PredType *PredType::ALPHA_I16_;
+PredType *PredType::ALPHA_I32_;
+PredType *PredType::ALPHA_I64_;
+PredType *PredType::ALPHA_U8_;
+PredType *PredType::ALPHA_U16_;
+PredType *PredType::ALPHA_U32_;
+PredType *PredType::ALPHA_U64_;
+PredType *PredType::ALPHA_B8_;
+PredType *PredType::ALPHA_B16_;
+PredType *PredType::ALPHA_B32_;
+PredType *PredType::ALPHA_B64_;
+PredType *PredType::ALPHA_F32_;
+PredType *PredType::ALPHA_F64_;
+
+PredType *PredType::MIPS_I8_;
+PredType *PredType::MIPS_I16_;
+PredType *PredType::MIPS_I32_;
+PredType *PredType::MIPS_I64_;
+PredType *PredType::MIPS_U8_;
+PredType *PredType::MIPS_U16_;
+PredType *PredType::MIPS_U32_;
+PredType *PredType::MIPS_U64_;
+PredType *PredType::MIPS_B8_;
+PredType *PredType::MIPS_B16_;
+PredType *PredType::MIPS_B32_;
+PredType *PredType::MIPS_B64_;
+PredType *PredType::MIPS_F32_;
+PredType *PredType::MIPS_F64_;
+
+PredType *PredType::NATIVE_CHAR_;
+PredType *PredType::NATIVE_SCHAR_;
+PredType *PredType::NATIVE_UCHAR_;
+PredType *PredType::NATIVE_SHORT_;
+PredType *PredType::NATIVE_USHORT_;
+PredType *PredType::NATIVE_INT_;
+PredType *PredType::NATIVE_UINT_;
+PredType *PredType::NATIVE_LONG_;
+PredType *PredType::NATIVE_ULONG_;
+PredType *PredType::NATIVE_LLONG_;
+PredType *PredType::NATIVE_ULLONG_;
+PredType *PredType::NATIVE_FLOAT_;
+PredType *PredType::NATIVE_DOUBLE_;
+PredType *PredType::NATIVE_LDOUBLE_;
+PredType *PredType::NATIVE_B8_;
+PredType *PredType::NATIVE_B16_;
+PredType *PredType::NATIVE_B32_;
+PredType *PredType::NATIVE_B64_;
+PredType *PredType::NATIVE_OPAQUE_;
+PredType *PredType::NATIVE_HSIZE_;
+PredType *PredType::NATIVE_HSSIZE_;
+PredType *PredType::NATIVE_HERR_;
+PredType *PredType::NATIVE_HBOOL_;
+
+PredType *PredType::NATIVE_INT8_;
+PredType *PredType::NATIVE_UINT8_;
+PredType *PredType::NATIVE_INT16_;
+PredType *PredType::NATIVE_UINT16_;
+PredType *PredType::NATIVE_INT32_;
+PredType *PredType::NATIVE_UINT32_;
+PredType *PredType::NATIVE_INT64_;
+PredType *PredType::NATIVE_UINT64_;
// LEAST types
#if H5_SIZEOF_INT_LEAST8_T != 0
-PredType* PredType::NATIVE_INT_LEAST8_;
+PredType *PredType::NATIVE_INT_LEAST8_;
#endif /* H5_SIZEOF_INT_LEAST8_T */
#if H5_SIZEOF_UINT_LEAST8_T != 0
-PredType* PredType::NATIVE_UINT_LEAST8_;
+PredType *PredType::NATIVE_UINT_LEAST8_;
#endif /* H5_SIZEOF_UINT_LEAST8_T */
#if H5_SIZEOF_INT_LEAST16_T != 0
-PredType* PredType::NATIVE_INT_LEAST16_;
+PredType *PredType::NATIVE_INT_LEAST16_;
#endif /* H5_SIZEOF_INT_LEAST16_T */
#if H5_SIZEOF_UINT_LEAST16_T != 0
-PredType* PredType::NATIVE_UINT_LEAST16_;
+PredType *PredType::NATIVE_UINT_LEAST16_;
#endif /* H5_SIZEOF_UINT_LEAST16_T */
#if H5_SIZEOF_INT_LEAST32_T != 0
-PredType* PredType::NATIVE_INT_LEAST32_;
+PredType *PredType::NATIVE_INT_LEAST32_;
#endif /* H5_SIZEOF_INT_LEAST32_T */
#if H5_SIZEOF_UINT_LEAST32_T != 0
-PredType* PredType::NATIVE_UINT_LEAST32_;
+PredType *PredType::NATIVE_UINT_LEAST32_;
#endif /* H5_SIZEOF_UINT_LEAST32_T */
#if H5_SIZEOF_INT_LEAST64_T != 0
-PredType* PredType::NATIVE_INT_LEAST64_;
+PredType *PredType::NATIVE_INT_LEAST64_;
#endif /* H5_SIZEOF_INT_LEAST64_T */
#if H5_SIZEOF_UINT_LEAST64_T != 0
-PredType* PredType::NATIVE_UINT_LEAST64_;
+PredType *PredType::NATIVE_UINT_LEAST64_;
#endif /* H5_SIZEOF_UINT_LEAST64_T */
// FAST types
#if H5_SIZEOF_INT_FAST8_T != 0
-PredType* PredType::NATIVE_INT_FAST8_;
+PredType *PredType::NATIVE_INT_FAST8_;
#endif /* H5_SIZEOF_INT_FAST8_T */
#if H5_SIZEOF_UINT_FAST8_T != 0
-PredType* PredType::NATIVE_UINT_FAST8_;
+PredType *PredType::NATIVE_UINT_FAST8_;
#endif /* H5_SIZEOF_UINT_FAST8_T */
#if H5_SIZEOF_INT_FAST16_T != 0
-PredType* PredType::NATIVE_INT_FAST16_;
+PredType *PredType::NATIVE_INT_FAST16_;
#endif /* H5_SIZEOF_INT_FAST16_T */
#if H5_SIZEOF_UINT_FAST16_T != 0
-PredType* PredType::NATIVE_UINT_FAST16_;
+PredType *PredType::NATIVE_UINT_FAST16_;
#endif /* H5_SIZEOF_UINT_FAST16_T */
#if H5_SIZEOF_INT_FAST32_T != 0
-PredType* PredType::NATIVE_INT_FAST32_;
+PredType *PredType::NATIVE_INT_FAST32_;
#endif /* H5_SIZEOF_INT_FAST32_T */
#if H5_SIZEOF_UINT_FAST32_T != 0
-PredType* PredType::NATIVE_UINT_FAST32_;
+PredType *PredType::NATIVE_UINT_FAST32_;
#endif /* H5_SIZEOF_UINT_FAST32_T */
#if H5_SIZEOF_INT_FAST64_T != 0
-PredType* PredType::NATIVE_INT_FAST64_;
+PredType *PredType::NATIVE_INT_FAST64_;
#endif /* H5_SIZEOF_INT_FAST64_T */
#if H5_SIZEOF_UINT_FAST64_T != 0
-PredType* PredType::NATIVE_UINT_FAST64_;
+PredType *PredType::NATIVE_UINT_FAST64_;
#endif /* H5_SIZEOF_UINT_FAST64_T */
//--------------------------------------------------------------------------
@@ -305,13 +308,13 @@ PredType* PredType::NATIVE_UINT_FAST64_;
//
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
-PredType* PredType::getPredTypes()
+PredType *
+PredType::getPredTypes()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -320,7 +323,9 @@ PredType* PredType::getPredTypes()
if (PREDTYPE_CONST_ == 0)
makePredTypes();
else
- throw H5::DataTypeIException("PredType::getPredTypes", "PredType::getPredTypes is being invoked on an allocated PREDTYPE_CONST_");
+ throw H5::DataTypeIException(
+ "PredType::getPredTypes",
+ "PredType::getPredTypes is being invoked on an allocated PREDTYPE_CONST_");
return PREDTYPE_CONST_;
}
@@ -329,38 +334,39 @@ PredType* PredType::getPredTypes()
// Purpose Allocate all PredType constants.
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
-void PredType::makePredTypes()
+void
+PredType::makePredTypes()
{
PREDTYPE_CONST_ = new PredType;
- C_S1_ = new PredType(H5T_C_S1);
- FORTRAN_S1_ = new PredType(H5T_FORTRAN_S1);
+ C_S1_ = new PredType(H5T_C_S1);
+ FORTRAN_S1_ = new PredType(H5T_FORTRAN_S1);
- STD_I8BE_ = new PredType(H5T_STD_I8BE);
- STD_I8LE_ = new PredType(H5T_STD_I8LE);
+ STD_I8BE_ = new PredType(H5T_STD_I8BE);
+ STD_I8LE_ = new PredType(H5T_STD_I8LE);
STD_I16BE_ = new PredType(H5T_STD_I16BE);
STD_I16LE_ = new PredType(H5T_STD_I16LE);
STD_I32BE_ = new PredType(H5T_STD_I32BE);
STD_I32LE_ = new PredType(H5T_STD_I32LE);
STD_I64BE_ = new PredType(H5T_STD_I64BE);
STD_I64LE_ = new PredType(H5T_STD_I64LE);
- STD_U8BE_ = new PredType(H5T_STD_U8BE);
- STD_U8LE_ = new PredType(H5T_STD_U8LE);
+ STD_U8BE_ = new PredType(H5T_STD_U8BE);
+ STD_U8LE_ = new PredType(H5T_STD_U8LE);
STD_U16BE_ = new PredType(H5T_STD_U16BE);
STD_U16LE_ = new PredType(H5T_STD_U16LE);
STD_U32BE_ = new PredType(H5T_STD_U32BE);
STD_U32LE_ = new PredType(H5T_STD_U32LE);
STD_U64BE_ = new PredType(H5T_STD_U64BE);
STD_U64LE_ = new PredType(H5T_STD_U64LE);
- STD_B8BE_ = new PredType(H5T_STD_B8BE);
- STD_B8LE_ = new PredType(H5T_STD_B8LE);
-
- STD_B16BE_ = new PredType(H5T_STD_B16BE);
- STD_B16LE_ = new PredType(H5T_STD_B16LE);
- STD_B32BE_ = new PredType(H5T_STD_B32BE);
- STD_B32LE_ = new PredType(H5T_STD_B32LE);
- STD_B64BE_ = new PredType(H5T_STD_B64BE);
- STD_B64LE_ = new PredType(H5T_STD_B64LE);
- STD_REF_OBJ_ = new PredType(H5T_STD_REF_OBJ);
+ STD_B8BE_ = new PredType(H5T_STD_B8BE);
+ STD_B8LE_ = new PredType(H5T_STD_B8LE);
+
+ STD_B16BE_ = new PredType(H5T_STD_B16BE);
+ STD_B16LE_ = new PredType(H5T_STD_B16LE);
+ STD_B32BE_ = new PredType(H5T_STD_B32BE);
+ STD_B32LE_ = new PredType(H5T_STD_B32LE);
+ STD_B64BE_ = new PredType(H5T_STD_B64BE);
+ STD_B64LE_ = new PredType(H5T_STD_B64LE);
+ STD_REF_OBJ_ = new PredType(H5T_STD_REF_OBJ);
STD_REF_DSETREG_ = new PredType(H5T_STD_REF_DSETREG);
IEEE_F32BE_ = new PredType(H5T_IEEE_F32BE);
@@ -373,84 +379,84 @@ void PredType::makePredTypes()
UNIX_D64BE_ = new PredType(H5T_UNIX_D64BE);
UNIX_D64LE_ = new PredType(H5T_UNIX_D64LE);
- INTEL_I8_ = new PredType(H5T_INTEL_I8);
+ INTEL_I8_ = new PredType(H5T_INTEL_I8);
INTEL_I16_ = new PredType(H5T_INTEL_I16);
INTEL_I32_ = new PredType(H5T_INTEL_I32);
INTEL_I64_ = new PredType(H5T_INTEL_I64);
- INTEL_U8_ = new PredType(H5T_INTEL_U8);
+ INTEL_U8_ = new PredType(H5T_INTEL_U8);
INTEL_U16_ = new PredType(H5T_INTEL_U16);
INTEL_U32_ = new PredType(H5T_INTEL_U32);
INTEL_U64_ = new PredType(H5T_INTEL_U64);
- INTEL_B8_ = new PredType(H5T_INTEL_B8);
+ INTEL_B8_ = new PredType(H5T_INTEL_B8);
INTEL_B16_ = new PredType(H5T_INTEL_B16);
INTEL_B32_ = new PredType(H5T_INTEL_B32);
INTEL_B64_ = new PredType(H5T_INTEL_B64);
INTEL_F32_ = new PredType(H5T_INTEL_F32);
INTEL_F64_ = new PredType(H5T_INTEL_F64);
- ALPHA_I8_ = new PredType(H5T_ALPHA_I8);
+ ALPHA_I8_ = new PredType(H5T_ALPHA_I8);
ALPHA_I16_ = new PredType(H5T_ALPHA_I16);
ALPHA_I32_ = new PredType(H5T_ALPHA_I32);
ALPHA_I64_ = new PredType(H5T_ALPHA_I64);
- ALPHA_U8_ = new PredType(H5T_ALPHA_U8);
+ ALPHA_U8_ = new PredType(H5T_ALPHA_U8);
ALPHA_U16_ = new PredType(H5T_ALPHA_U16);
ALPHA_U32_ = new PredType(H5T_ALPHA_U32);
ALPHA_U64_ = new PredType(H5T_ALPHA_U64);
- ALPHA_B8_ = new PredType(H5T_ALPHA_B8);
+ ALPHA_B8_ = new PredType(H5T_ALPHA_B8);
ALPHA_B16_ = new PredType(H5T_ALPHA_B16);
ALPHA_B32_ = new PredType(H5T_ALPHA_B32);
ALPHA_B64_ = new PredType(H5T_ALPHA_B64);
ALPHA_F32_ = new PredType(H5T_ALPHA_F32);
ALPHA_F64_ = new PredType(H5T_ALPHA_F64);
- MIPS_I8_ = new PredType(H5T_MIPS_I8);
+ MIPS_I8_ = new PredType(H5T_MIPS_I8);
MIPS_I16_ = new PredType(H5T_MIPS_I16);
MIPS_I32_ = new PredType(H5T_MIPS_I32);
MIPS_I64_ = new PredType(H5T_MIPS_I64);
- MIPS_U8_ = new PredType(H5T_MIPS_U8);
+ MIPS_U8_ = new PredType(H5T_MIPS_U8);
MIPS_U16_ = new PredType(H5T_MIPS_U16);
MIPS_U32_ = new PredType(H5T_MIPS_U32);
MIPS_U64_ = new PredType(H5T_MIPS_U64);
- MIPS_B8_ = new PredType(H5T_MIPS_B8);
+ MIPS_B8_ = new PredType(H5T_MIPS_B8);
MIPS_B16_ = new PredType(H5T_MIPS_B16);
MIPS_B32_ = new PredType(H5T_MIPS_B32);
MIPS_B64_ = new PredType(H5T_MIPS_B64);
MIPS_F32_ = new PredType(H5T_MIPS_F32);
MIPS_F64_ = new PredType(H5T_MIPS_F64);
- NATIVE_CHAR_ = new PredType(H5T_NATIVE_CHAR);
- NATIVE_INT_ = new PredType(H5T_NATIVE_INT);
- NATIVE_FLOAT_ = new PredType(H5T_NATIVE_FLOAT);
- NATIVE_SCHAR_ = new PredType(H5T_NATIVE_SCHAR);
- NATIVE_UCHAR_ = new PredType(H5T_NATIVE_UCHAR);
- NATIVE_SHORT_ = new PredType(H5T_NATIVE_SHORT);
+ NATIVE_CHAR_ = new PredType(H5T_NATIVE_CHAR);
+ NATIVE_INT_ = new PredType(H5T_NATIVE_INT);
+ NATIVE_FLOAT_ = new PredType(H5T_NATIVE_FLOAT);
+ NATIVE_SCHAR_ = new PredType(H5T_NATIVE_SCHAR);
+ NATIVE_UCHAR_ = new PredType(H5T_NATIVE_UCHAR);
+ NATIVE_SHORT_ = new PredType(H5T_NATIVE_SHORT);
NATIVE_USHORT_ = new PredType(H5T_NATIVE_USHORT);
- NATIVE_UINT_ = new PredType(H5T_NATIVE_UINT);
- NATIVE_LONG_ = new PredType(H5T_NATIVE_LONG);
- NATIVE_ULONG_ = new PredType(H5T_NATIVE_ULONG);
- NATIVE_LLONG_ = new PredType(H5T_NATIVE_LLONG);
+ NATIVE_UINT_ = new PredType(H5T_NATIVE_UINT);
+ NATIVE_LONG_ = new PredType(H5T_NATIVE_LONG);
+ NATIVE_ULONG_ = new PredType(H5T_NATIVE_ULONG);
+ NATIVE_LLONG_ = new PredType(H5T_NATIVE_LLONG);
NATIVE_ULLONG_ = new PredType(H5T_NATIVE_ULLONG);
NATIVE_DOUBLE_ = new PredType(H5T_NATIVE_DOUBLE);
-#if H5_SIZEOF_LONG_DOUBLE !=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
NATIVE_LDOUBLE_ = new PredType(H5T_NATIVE_LDOUBLE);
#endif
- NATIVE_B8_ = new PredType(H5T_NATIVE_B8);
- NATIVE_B16_ = new PredType(H5T_NATIVE_B16);
- NATIVE_B32_ = new PredType(H5T_NATIVE_B32);
- NATIVE_B64_ = new PredType(H5T_NATIVE_B64);
+ NATIVE_B8_ = new PredType(H5T_NATIVE_B8);
+ NATIVE_B16_ = new PredType(H5T_NATIVE_B16);
+ NATIVE_B32_ = new PredType(H5T_NATIVE_B32);
+ NATIVE_B64_ = new PredType(H5T_NATIVE_B64);
NATIVE_OPAQUE_ = new PredType(H5T_NATIVE_OPAQUE);
- NATIVE_HSIZE_ = new PredType(H5T_NATIVE_HSIZE);
+ NATIVE_HSIZE_ = new PredType(H5T_NATIVE_HSIZE);
NATIVE_HSSIZE_ = new PredType(H5T_NATIVE_HSSIZE);
- NATIVE_HERR_ = new PredType(H5T_NATIVE_HERR);
- NATIVE_HBOOL_ = new PredType(H5T_NATIVE_HBOOL);
+ NATIVE_HERR_ = new PredType(H5T_NATIVE_HERR);
+ NATIVE_HBOOL_ = new PredType(H5T_NATIVE_HBOOL);
- NATIVE_INT8_ = new PredType(H5T_NATIVE_INT8);
- NATIVE_UINT8_ = new PredType(H5T_NATIVE_UINT8);
- NATIVE_INT16_ = new PredType(H5T_NATIVE_INT16);
+ NATIVE_INT8_ = new PredType(H5T_NATIVE_INT8);
+ NATIVE_UINT8_ = new PredType(H5T_NATIVE_UINT8);
+ NATIVE_INT16_ = new PredType(H5T_NATIVE_INT16);
NATIVE_UINT16_ = new PredType(H5T_NATIVE_UINT16);
- NATIVE_INT32_ = new PredType(H5T_NATIVE_INT32);
+ NATIVE_INT32_ = new PredType(H5T_NATIVE_INT32);
NATIVE_UINT32_ = new PredType(H5T_NATIVE_UINT32);
- NATIVE_INT64_ = new PredType(H5T_NATIVE_INT64);
+ NATIVE_INT64_ = new PredType(H5T_NATIVE_INT64);
NATIVE_UINT64_ = new PredType(H5T_NATIVE_UINT64);
// LEAST types
@@ -513,13 +519,13 @@ void PredType::makePredTypes()
} // makePredTypes
-
//--------------------------------------------------------------------------
// Function: PredType::deleteConstants
// Purpose Deletes all PredType constant pointers.
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
-void PredType::deleteConstants()
+void
+PredType::deleteConstants()
{
delete STD_I8BE_;
delete STD_I8LE_;
@@ -709,186 +715,186 @@ void PredType::deleteConstants()
// PredType constants. Note that, there is a similar function to getPredTypes()
// in other classes, that have global constants, is called getConstant().
-const PredType& PredType::PREDTYPE_CONST = *PredType::getPredTypes();
-const PredType& PredType::STD_I8BE = *STD_I8BE_;
-const PredType& PredType::STD_I8LE = *STD_I8LE_;
-const PredType& PredType::STD_I16BE = *STD_I16BE_;
-const PredType& PredType::STD_I16LE = *STD_I16LE_;
-const PredType& PredType::STD_I32BE = *STD_I32BE_;
-const PredType& PredType::STD_I32LE = *STD_I32LE_;
-const PredType& PredType::STD_I64BE = *STD_I64BE_;
-const PredType& PredType::STD_I64LE = *STD_I64LE_;
-const PredType& PredType::STD_U8BE = *STD_U8BE_;
-const PredType& PredType::STD_U8LE = *STD_U8LE_;
-const PredType& PredType::STD_U16BE = *STD_U16BE_;
-const PredType& PredType::STD_U16LE = *STD_U16LE_;
-const PredType& PredType::STD_U32BE = *STD_U32BE_;
-const PredType& PredType::STD_U32LE = *STD_U32LE_;
-const PredType& PredType::STD_U64BE = *STD_U64BE_;
-const PredType& PredType::STD_U64LE = *STD_U64LE_;
-const PredType& PredType::STD_B8BE = *STD_B8BE_;
-const PredType& PredType::STD_B8LE = *STD_B8LE_;
-const PredType& PredType::STD_B16BE = *STD_B16BE_;
-const PredType& PredType::STD_B16LE = *STD_B16LE_;
-const PredType& PredType::STD_B32BE = *STD_B32BE_;
-const PredType& PredType::STD_B32LE = *STD_B32LE_;
-const PredType& PredType::STD_B64BE = *STD_B64BE_;
-const PredType& PredType::STD_B64LE = *STD_B64LE_;
-const PredType& PredType::STD_REF_OBJ = *STD_REF_OBJ_;
-const PredType& PredType::STD_REF_DSETREG = *STD_REF_DSETREG_;
-
-const PredType& PredType::C_S1 = *C_S1_;
-const PredType& PredType::FORTRAN_S1 = *FORTRAN_S1_;
-
-const PredType& PredType::IEEE_F32BE = *IEEE_F32BE_;
-const PredType& PredType::IEEE_F32LE = *IEEE_F32LE_;
-const PredType& PredType::IEEE_F64BE = *IEEE_F64BE_;
-const PredType& PredType::IEEE_F64LE = *IEEE_F64LE_;
-
-const PredType& PredType::UNIX_D32BE = *UNIX_D32BE_;
-const PredType& PredType::UNIX_D32LE = *UNIX_D32LE_;
-const PredType& PredType::UNIX_D64BE = *UNIX_D64BE_;
-const PredType& PredType::UNIX_D64LE = *UNIX_D64LE_;
-
-const PredType& PredType::INTEL_I8 = *INTEL_I8_;
-const PredType& PredType::INTEL_I16 = *INTEL_I16_;
-const PredType& PredType::INTEL_I32 = *INTEL_I32_;
-const PredType& PredType::INTEL_I64 = *INTEL_I64_;
-const PredType& PredType::INTEL_U8 = *INTEL_U8_;
-const PredType& PredType::INTEL_U16 = *INTEL_U16_;
-const PredType& PredType::INTEL_U32 = *INTEL_U32_;
-const PredType& PredType::INTEL_U64 = *INTEL_U64_;
-const PredType& PredType::INTEL_B8 = *INTEL_B8_;
-const PredType& PredType::INTEL_B16 = *INTEL_B16_;
-const PredType& PredType::INTEL_B32 = *INTEL_B32_;
-const PredType& PredType::INTEL_B64 = *INTEL_B64_;
-const PredType& PredType::INTEL_F32 = *INTEL_F32_;
-const PredType& PredType::INTEL_F64 = *INTEL_F64_;
-
-const PredType& PredType::ALPHA_I8 = *ALPHA_I8_;
-const PredType& PredType::ALPHA_I16 = *ALPHA_I16_;
-const PredType& PredType::ALPHA_I32 = *ALPHA_I32_;
-const PredType& PredType::ALPHA_I64 = *ALPHA_I64_;
-const PredType& PredType::ALPHA_U8 = *ALPHA_U8_;
-const PredType& PredType::ALPHA_U16 = *ALPHA_U16_;
-const PredType& PredType::ALPHA_U32 = *ALPHA_U32_;
-const PredType& PredType::ALPHA_U64 = *ALPHA_U64_;
-const PredType& PredType::ALPHA_B8 = *ALPHA_B8_;
-const PredType& PredType::ALPHA_B16 = *ALPHA_B16_;
-const PredType& PredType::ALPHA_B32 = *ALPHA_B32_;
-const PredType& PredType::ALPHA_B64 = *ALPHA_B64_;
-const PredType& PredType::ALPHA_F32 = *ALPHA_F32_;
-const PredType& PredType::ALPHA_F64 = *ALPHA_F64_;
-
-const PredType& PredType::MIPS_I8 = *MIPS_I8_;
-const PredType& PredType::MIPS_I16 = *MIPS_I16_;
-const PredType& PredType::MIPS_I32 = *MIPS_I32_;
-const PredType& PredType::MIPS_I64 = *MIPS_I64_;
-const PredType& PredType::MIPS_U8 = *MIPS_U8_;
-const PredType& PredType::MIPS_U16 = *MIPS_U16_;
-const PredType& PredType::MIPS_U32 = *MIPS_U32_;
-const PredType& PredType::MIPS_U64 = *MIPS_U64_;
-const PredType& PredType::MIPS_B8 = *MIPS_B8_;
-const PredType& PredType::MIPS_B16 = *MIPS_B16_;
-const PredType& PredType::MIPS_B32 = *MIPS_B32_;
-const PredType& PredType::MIPS_B64 = *MIPS_B64_;
-const PredType& PredType::MIPS_F32 = *MIPS_F32_;
-const PredType& PredType::MIPS_F64 = *MIPS_F64_;
-
-const PredType& PredType::NATIVE_CHAR = *NATIVE_CHAR_;
-const PredType& PredType::NATIVE_SCHAR = *NATIVE_SCHAR_;
-const PredType& PredType::NATIVE_UCHAR = *NATIVE_UCHAR_;
-const PredType& PredType::NATIVE_SHORT = *NATIVE_SHORT_;
-const PredType& PredType::NATIVE_USHORT = *NATIVE_USHORT_;
-const PredType& PredType::NATIVE_INT = *NATIVE_INT_;
-const PredType& PredType::NATIVE_UINT = *NATIVE_UINT_;
-const PredType& PredType::NATIVE_LONG = *NATIVE_LONG_;
-const PredType& PredType::NATIVE_ULONG = *NATIVE_ULONG_;
-const PredType& PredType::NATIVE_LLONG = *NATIVE_LLONG_;
-const PredType& PredType::NATIVE_ULLONG = *NATIVE_ULLONG_;
-const PredType& PredType::NATIVE_FLOAT = *NATIVE_FLOAT_;
-const PredType& PredType::NATIVE_DOUBLE = *NATIVE_DOUBLE_;
-const PredType& PredType::NATIVE_LDOUBLE = *NATIVE_LDOUBLE_;
-const PredType& PredType::NATIVE_B8 = *NATIVE_B8_;
-const PredType& PredType::NATIVE_B16 = *NATIVE_B16_;
-const PredType& PredType::NATIVE_B32 = *NATIVE_B32_;
-const PredType& PredType::NATIVE_B64 = *NATIVE_B64_;
-const PredType& PredType::NATIVE_OPAQUE = *NATIVE_OPAQUE_;
-const PredType& PredType::NATIVE_HSIZE = *NATIVE_HSIZE_;
-const PredType& PredType::NATIVE_HSSIZE = *NATIVE_HSSIZE_;
-const PredType& PredType::NATIVE_HERR = *NATIVE_HERR_;
-const PredType& PredType::NATIVE_HBOOL = *NATIVE_HBOOL_;
-
-const PredType& PredType::NATIVE_INT8 = *NATIVE_INT8_;
-const PredType& PredType::NATIVE_UINT8 = *NATIVE_UINT8_;
-const PredType& PredType::NATIVE_INT16 = *NATIVE_INT16_;
-const PredType& PredType::NATIVE_UINT16 = *NATIVE_UINT16_;
-const PredType& PredType::NATIVE_INT32 = *NATIVE_INT32_;
-const PredType& PredType::NATIVE_UINT32 = *NATIVE_UINT32_;
-const PredType& PredType::NATIVE_INT64 = *NATIVE_INT64_;
-const PredType& PredType::NATIVE_UINT64 = *NATIVE_UINT64_;
+const PredType &PredType::PREDTYPE_CONST = *PredType::getPredTypes();
+const PredType &PredType::STD_I8BE = *STD_I8BE_;
+const PredType &PredType::STD_I8LE = *STD_I8LE_;
+const PredType &PredType::STD_I16BE = *STD_I16BE_;
+const PredType &PredType::STD_I16LE = *STD_I16LE_;
+const PredType &PredType::STD_I32BE = *STD_I32BE_;
+const PredType &PredType::STD_I32LE = *STD_I32LE_;
+const PredType &PredType::STD_I64BE = *STD_I64BE_;
+const PredType &PredType::STD_I64LE = *STD_I64LE_;
+const PredType &PredType::STD_U8BE = *STD_U8BE_;
+const PredType &PredType::STD_U8LE = *STD_U8LE_;
+const PredType &PredType::STD_U16BE = *STD_U16BE_;
+const PredType &PredType::STD_U16LE = *STD_U16LE_;
+const PredType &PredType::STD_U32BE = *STD_U32BE_;
+const PredType &PredType::STD_U32LE = *STD_U32LE_;
+const PredType &PredType::STD_U64BE = *STD_U64BE_;
+const PredType &PredType::STD_U64LE = *STD_U64LE_;
+const PredType &PredType::STD_B8BE = *STD_B8BE_;
+const PredType &PredType::STD_B8LE = *STD_B8LE_;
+const PredType &PredType::STD_B16BE = *STD_B16BE_;
+const PredType &PredType::STD_B16LE = *STD_B16LE_;
+const PredType &PredType::STD_B32BE = *STD_B32BE_;
+const PredType &PredType::STD_B32LE = *STD_B32LE_;
+const PredType &PredType::STD_B64BE = *STD_B64BE_;
+const PredType &PredType::STD_B64LE = *STD_B64LE_;
+const PredType &PredType::STD_REF_OBJ = *STD_REF_OBJ_;
+const PredType &PredType::STD_REF_DSETREG = *STD_REF_DSETREG_;
+
+const PredType &PredType::C_S1 = *C_S1_;
+const PredType &PredType::FORTRAN_S1 = *FORTRAN_S1_;
+
+const PredType &PredType::IEEE_F32BE = *IEEE_F32BE_;
+const PredType &PredType::IEEE_F32LE = *IEEE_F32LE_;
+const PredType &PredType::IEEE_F64BE = *IEEE_F64BE_;
+const PredType &PredType::IEEE_F64LE = *IEEE_F64LE_;
+
+const PredType &PredType::UNIX_D32BE = *UNIX_D32BE_;
+const PredType &PredType::UNIX_D32LE = *UNIX_D32LE_;
+const PredType &PredType::UNIX_D64BE = *UNIX_D64BE_;
+const PredType &PredType::UNIX_D64LE = *UNIX_D64LE_;
+
+const PredType &PredType::INTEL_I8 = *INTEL_I8_;
+const PredType &PredType::INTEL_I16 = *INTEL_I16_;
+const PredType &PredType::INTEL_I32 = *INTEL_I32_;
+const PredType &PredType::INTEL_I64 = *INTEL_I64_;
+const PredType &PredType::INTEL_U8 = *INTEL_U8_;
+const PredType &PredType::INTEL_U16 = *INTEL_U16_;
+const PredType &PredType::INTEL_U32 = *INTEL_U32_;
+const PredType &PredType::INTEL_U64 = *INTEL_U64_;
+const PredType &PredType::INTEL_B8 = *INTEL_B8_;
+const PredType &PredType::INTEL_B16 = *INTEL_B16_;
+const PredType &PredType::INTEL_B32 = *INTEL_B32_;
+const PredType &PredType::INTEL_B64 = *INTEL_B64_;
+const PredType &PredType::INTEL_F32 = *INTEL_F32_;
+const PredType &PredType::INTEL_F64 = *INTEL_F64_;
+
+const PredType &PredType::ALPHA_I8 = *ALPHA_I8_;
+const PredType &PredType::ALPHA_I16 = *ALPHA_I16_;
+const PredType &PredType::ALPHA_I32 = *ALPHA_I32_;
+const PredType &PredType::ALPHA_I64 = *ALPHA_I64_;
+const PredType &PredType::ALPHA_U8 = *ALPHA_U8_;
+const PredType &PredType::ALPHA_U16 = *ALPHA_U16_;
+const PredType &PredType::ALPHA_U32 = *ALPHA_U32_;
+const PredType &PredType::ALPHA_U64 = *ALPHA_U64_;
+const PredType &PredType::ALPHA_B8 = *ALPHA_B8_;
+const PredType &PredType::ALPHA_B16 = *ALPHA_B16_;
+const PredType &PredType::ALPHA_B32 = *ALPHA_B32_;
+const PredType &PredType::ALPHA_B64 = *ALPHA_B64_;
+const PredType &PredType::ALPHA_F32 = *ALPHA_F32_;
+const PredType &PredType::ALPHA_F64 = *ALPHA_F64_;
+
+const PredType &PredType::MIPS_I8 = *MIPS_I8_;
+const PredType &PredType::MIPS_I16 = *MIPS_I16_;
+const PredType &PredType::MIPS_I32 = *MIPS_I32_;
+const PredType &PredType::MIPS_I64 = *MIPS_I64_;
+const PredType &PredType::MIPS_U8 = *MIPS_U8_;
+const PredType &PredType::MIPS_U16 = *MIPS_U16_;
+const PredType &PredType::MIPS_U32 = *MIPS_U32_;
+const PredType &PredType::MIPS_U64 = *MIPS_U64_;
+const PredType &PredType::MIPS_B8 = *MIPS_B8_;
+const PredType &PredType::MIPS_B16 = *MIPS_B16_;
+const PredType &PredType::MIPS_B32 = *MIPS_B32_;
+const PredType &PredType::MIPS_B64 = *MIPS_B64_;
+const PredType &PredType::MIPS_F32 = *MIPS_F32_;
+const PredType &PredType::MIPS_F64 = *MIPS_F64_;
+
+const PredType &PredType::NATIVE_CHAR = *NATIVE_CHAR_;
+const PredType &PredType::NATIVE_SCHAR = *NATIVE_SCHAR_;
+const PredType &PredType::NATIVE_UCHAR = *NATIVE_UCHAR_;
+const PredType &PredType::NATIVE_SHORT = *NATIVE_SHORT_;
+const PredType &PredType::NATIVE_USHORT = *NATIVE_USHORT_;
+const PredType &PredType::NATIVE_INT = *NATIVE_INT_;
+const PredType &PredType::NATIVE_UINT = *NATIVE_UINT_;
+const PredType &PredType::NATIVE_LONG = *NATIVE_LONG_;
+const PredType &PredType::NATIVE_ULONG = *NATIVE_ULONG_;
+const PredType &PredType::NATIVE_LLONG = *NATIVE_LLONG_;
+const PredType &PredType::NATIVE_ULLONG = *NATIVE_ULLONG_;
+const PredType &PredType::NATIVE_FLOAT = *NATIVE_FLOAT_;
+const PredType &PredType::NATIVE_DOUBLE = *NATIVE_DOUBLE_;
+const PredType &PredType::NATIVE_LDOUBLE = *NATIVE_LDOUBLE_;
+const PredType &PredType::NATIVE_B8 = *NATIVE_B8_;
+const PredType &PredType::NATIVE_B16 = *NATIVE_B16_;
+const PredType &PredType::NATIVE_B32 = *NATIVE_B32_;
+const PredType &PredType::NATIVE_B64 = *NATIVE_B64_;
+const PredType &PredType::NATIVE_OPAQUE = *NATIVE_OPAQUE_;
+const PredType &PredType::NATIVE_HSIZE = *NATIVE_HSIZE_;
+const PredType &PredType::NATIVE_HSSIZE = *NATIVE_HSSIZE_;
+const PredType &PredType::NATIVE_HERR = *NATIVE_HERR_;
+const PredType &PredType::NATIVE_HBOOL = *NATIVE_HBOOL_;
+
+const PredType &PredType::NATIVE_INT8 = *NATIVE_INT8_;
+const PredType &PredType::NATIVE_UINT8 = *NATIVE_UINT8_;
+const PredType &PredType::NATIVE_INT16 = *NATIVE_INT16_;
+const PredType &PredType::NATIVE_UINT16 = *NATIVE_UINT16_;
+const PredType &PredType::NATIVE_INT32 = *NATIVE_INT32_;
+const PredType &PredType::NATIVE_UINT32 = *NATIVE_UINT32_;
+const PredType &PredType::NATIVE_INT64 = *NATIVE_INT64_;
+const PredType &PredType::NATIVE_UINT64 = *NATIVE_UINT64_;
// LEAST types
#if H5_SIZEOF_INT_LEAST8_T != 0
-const PredType& PredType::NATIVE_INT_LEAST8 = *NATIVE_INT_LEAST8_;
+const PredType &PredType::NATIVE_INT_LEAST8 = *NATIVE_INT_LEAST8_;
#endif /* H5_SIZEOF_INT_LEAST8_T */
#if H5_SIZEOF_UINT_LEAST8_T != 0
-const PredType& PredType::NATIVE_UINT_LEAST8 = *NATIVE_UINT_LEAST8_;
+const PredType &PredType::NATIVE_UINT_LEAST8 = *NATIVE_UINT_LEAST8_;
#endif /* H5_SIZEOF_UINT_LEAST8_T */
#if H5_SIZEOF_INT_LEAST16_T != 0
-const PredType& PredType::NATIVE_INT_LEAST16 = *NATIVE_INT_LEAST16_;
+const PredType &PredType::NATIVE_INT_LEAST16 = *NATIVE_INT_LEAST16_;
#endif /* H5_SIZEOF_INT_LEAST16_T */
#if H5_SIZEOF_UINT_LEAST16_T != 0
-const PredType& PredType::NATIVE_UINT_LEAST16 = *NATIVE_UINT_LEAST16_;
+const PredType &PredType::NATIVE_UINT_LEAST16 = *NATIVE_UINT_LEAST16_;
#endif /* H5_SIZEOF_UINT_LEAST16_T */
#if H5_SIZEOF_INT_LEAST32_T != 0
-const PredType& PredType::NATIVE_INT_LEAST32 = *NATIVE_INT_LEAST32_;
+const PredType &PredType::NATIVE_INT_LEAST32 = *NATIVE_INT_LEAST32_;
#endif /* H5_SIZEOF_INT_LEAST32_T */
#if H5_SIZEOF_UINT_LEAST32_T != 0
-const PredType& PredType::NATIVE_UINT_LEAST32 = *NATIVE_UINT_LEAST32_;
+const PredType &PredType::NATIVE_UINT_LEAST32 = *NATIVE_UINT_LEAST32_;
#endif /* H5_SIZEOF_UINT_LEAST32_T */
#if H5_SIZEOF_INT_LEAST64_T != 0
-const PredType& PredType::NATIVE_INT_LEAST64 = *NATIVE_INT_LEAST64_;
+const PredType &PredType::NATIVE_INT_LEAST64 = *NATIVE_INT_LEAST64_;
#endif /* H5_SIZEOF_INT_LEAST64_T */
#if H5_SIZEOF_UINT_LEAST64_T != 0
-const PredType& PredType::NATIVE_UINT_LEAST64 = *NATIVE_UINT_LEAST64_;
+const PredType &PredType::NATIVE_UINT_LEAST64 = *NATIVE_UINT_LEAST64_;
#endif /* H5_SIZEOF_UINT_LEAST64_T */
// FAST types
#if H5_SIZEOF_INT_FAST8_T != 0
-const PredType& PredType::NATIVE_INT_FAST8 = *NATIVE_INT_FAST8_;
+const PredType &PredType::NATIVE_INT_FAST8 = *NATIVE_INT_FAST8_;
#endif /* H5_SIZEOF_INT_FAST8_T */
#if H5_SIZEOF_UINT_FAST8_T != 0
-const PredType& PredType::NATIVE_UINT_FAST8 = *NATIVE_UINT_FAST8_;
+const PredType &PredType::NATIVE_UINT_FAST8 = *NATIVE_UINT_FAST8_;
#endif /* H5_SIZEOF_UINT_FAST8_T */
#if H5_SIZEOF_INT_FAST16_T != 0
-const PredType& PredType::NATIVE_INT_FAST16 = *NATIVE_INT_FAST16_;
+const PredType &PredType::NATIVE_INT_FAST16 = *NATIVE_INT_FAST16_;
#endif /* H5_SIZEOF_INT_FAST16_T */
#if H5_SIZEOF_UINT_FAST16_T != 0
-const PredType& PredType::NATIVE_UINT_FAST16 = *NATIVE_UINT_FAST16_;
+const PredType &PredType::NATIVE_UINT_FAST16 = *NATIVE_UINT_FAST16_;
#endif /* H5_SIZEOF_UINT_FAST16_T */
#if H5_SIZEOF_INT_FAST32_T != 0
-const PredType& PredType::NATIVE_INT_FAST32 = *NATIVE_INT_FAST32_;
+const PredType &PredType::NATIVE_INT_FAST32 = *NATIVE_INT_FAST32_;
#endif /* H5_SIZEOF_INT_FAST32_T */
#if H5_SIZEOF_UINT_FAST32_T != 0
-const PredType& PredType::NATIVE_UINT_FAST32 = *NATIVE_UINT_FAST32_;
+const PredType &PredType::NATIVE_UINT_FAST32 = *NATIVE_UINT_FAST32_;
#endif /* H5_SIZEOF_UINT_FAST32_T */
#if H5_SIZEOF_INT_FAST64_T != 0
-const PredType& PredType::NATIVE_INT_FAST64 = *NATIVE_INT_FAST64_;
+const PredType &PredType::NATIVE_INT_FAST64 = *NATIVE_INT_FAST64_;
#endif /* H5_SIZEOF_INT_FAST64_T */
#if H5_SIZEOF_UINT_FAST64_T != 0
-const PredType& PredType::NATIVE_UINT_FAST64 = *NATIVE_UINT_FAST64_;
+const PredType &PredType::NATIVE_UINT_FAST64 = *NATIVE_UINT_FAST64_;
#endif /* H5_SIZEOF_UINT_FAST64_T */
#endif // DOXYGEN_SHOULD_SKIP_THIS
-} // end namespace
+} // namespace H5
/***************************************************************************
Design Note
@@ -1102,4 +1108,3 @@ September 2015:
using PropList's because of the class types and in favor of clarity.
****************************************************************************/
-
diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h
index 0978384..2d1185b 100644
--- a/c++/src/H5PredType.h
+++ b/c++/src/H5PredType.h
@@ -26,412 +26,416 @@ namespace H5 {
*/
// Inheritance: AtomType -> DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP PredType : public AtomType {
- public:
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("PredType"); }
-
- // Makes a copy of the predefined type and stores the new
- // id in the left hand side object.
- PredType& operator=(const PredType& rhs);
-
- // Copy constructor: same as the original PredType.
- PredType(const PredType& original);
-
- // Noop destructor
- virtual ~PredType();
-
- /*! \brief This dummy function do not inherit from DataType - it will
- throw a DataTypeIException if invoked.
- */
- void commit(H5Location& loc, const H5std_string& name);
- /*! \brief This dummy function do not inherit from DataType - it will
- throw a DataTypeIException if invoked.
- */
- void commit(H5Location& loc, const char* name);
- /*! \brief This dummy function do not inherit from DataType - it will
- throw a DataTypeIException if invoked.
- */
- bool committed();
-
- ///\brief PredType constants
- static const PredType& STD_I8BE;
- static const PredType& STD_I8LE;
- static const PredType& STD_I16BE;
- static const PredType& STD_I16LE;
- static const PredType& STD_I32BE;
- static const PredType& STD_I32LE;
- static const PredType& STD_I64BE;
- static const PredType& STD_I64LE;
- static const PredType& STD_U8BE;
- static const PredType& STD_U8LE;
- static const PredType& STD_U16BE;
- static const PredType& STD_U16LE;
- static const PredType& STD_U32BE;
- static const PredType& STD_U32LE;
- static const PredType& STD_U64BE;
- static const PredType& STD_U64LE;
- static const PredType& STD_B8BE;
- static const PredType& STD_B8LE;
- static const PredType& STD_B16BE;
- static const PredType& STD_B16LE;
- static const PredType& STD_B32BE;
- static const PredType& STD_B32LE;
- static const PredType& STD_B64BE;
- static const PredType& STD_B64LE;
- static const PredType& STD_REF_OBJ;
- static const PredType& STD_REF_DSETREG;
-
- static const PredType& C_S1;
- static const PredType& FORTRAN_S1;
-
- static const PredType& IEEE_F32BE;
- static const PredType& IEEE_F32LE;
- static const PredType& IEEE_F64BE;
- static const PredType& IEEE_F64LE;
-
- static const PredType& UNIX_D32BE;
- static const PredType& UNIX_D32LE;
- static const PredType& UNIX_D64BE;
- static const PredType& UNIX_D64LE;
-
- static const PredType& INTEL_I8;
- static const PredType& INTEL_I16;
- static const PredType& INTEL_I32;
- static const PredType& INTEL_I64;
- static const PredType& INTEL_U8;
- static const PredType& INTEL_U16;
- static const PredType& INTEL_U32;
- static const PredType& INTEL_U64;
- static const PredType& INTEL_B8;
- static const PredType& INTEL_B16;
- static const PredType& INTEL_B32;
- static const PredType& INTEL_B64;
- static const PredType& INTEL_F32;
- static const PredType& INTEL_F64;
-
- static const PredType& ALPHA_I8;
- static const PredType& ALPHA_I16;
- static const PredType& ALPHA_I32;
- static const PredType& ALPHA_I64;
- static const PredType& ALPHA_U8;
- static const PredType& ALPHA_U16;
- static const PredType& ALPHA_U32;
- static const PredType& ALPHA_U64;
- static const PredType& ALPHA_B8;
- static const PredType& ALPHA_B16;
- static const PredType& ALPHA_B32;
- static const PredType& ALPHA_B64;
- static const PredType& ALPHA_F32;
- static const PredType& ALPHA_F64;
-
- static const PredType& MIPS_I8;
- static const PredType& MIPS_I16;
- static const PredType& MIPS_I32;
- static const PredType& MIPS_I64;
- static const PredType& MIPS_U8;
- static const PredType& MIPS_U16;
- static const PredType& MIPS_U32;
- static const PredType& MIPS_U64;
- static const PredType& MIPS_B8;
- static const PredType& MIPS_B16;
- static const PredType& MIPS_B32;
- static const PredType& MIPS_B64;
- static const PredType& MIPS_F32;
- static const PredType& MIPS_F64;
-
- static const PredType& NATIVE_CHAR;
- static const PredType& NATIVE_SCHAR;
- static const PredType& NATIVE_UCHAR;
- static const PredType& NATIVE_SHORT;
- static const PredType& NATIVE_USHORT;
- static const PredType& NATIVE_INT;
- static const PredType& NATIVE_UINT;
- static const PredType& NATIVE_LONG;
- static const PredType& NATIVE_ULONG;
- static const PredType& NATIVE_LLONG;
- static const PredType& NATIVE_ULLONG;
- static const PredType& NATIVE_FLOAT;
- static const PredType& NATIVE_DOUBLE;
- static const PredType& NATIVE_LDOUBLE;
- static const PredType& NATIVE_B8;
- static const PredType& NATIVE_B16;
- static const PredType& NATIVE_B32;
- static const PredType& NATIVE_B64;
- static const PredType& NATIVE_OPAQUE;
- static const PredType& NATIVE_HSIZE;
- static const PredType& NATIVE_HSSIZE;
- static const PredType& NATIVE_HERR;
- static const PredType& NATIVE_HBOOL;
-
- static const PredType& NATIVE_INT8;
- static const PredType& NATIVE_UINT8;
- static const PredType& NATIVE_INT16;
- static const PredType& NATIVE_UINT16;
- static const PredType& NATIVE_INT32;
- static const PredType& NATIVE_UINT32;
- static const PredType& NATIVE_INT64;
- static const PredType& NATIVE_UINT64;
+ public:
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("PredType");
+ }
+
+ // Makes a copy of the predefined type and stores the new
+ // id in the left hand side object.
+ PredType &operator=(const PredType &rhs);
+
+ // Copy constructor: same as the original PredType.
+ PredType(const PredType &original);
+
+ // Noop destructor
+ virtual ~PredType();
+
+ /*! \brief This dummy function do not inherit from DataType - it will
+ throw a DataTypeIException if invoked.
+ */
+ void commit(H5Location &loc, const H5std_string &name);
+ /*! \brief This dummy function do not inherit from DataType - it will
+ throw a DataTypeIException if invoked.
+ */
+ void commit(H5Location &loc, const char *name);
+ /*! \brief This dummy function do not inherit from DataType - it will
+ throw a DataTypeIException if invoked.
+ */
+ bool committed();
+
+ ///\brief PredType constants
+ static const PredType &STD_I8BE;
+ static const PredType &STD_I8LE;
+ static const PredType &STD_I16BE;
+ static const PredType &STD_I16LE;
+ static const PredType &STD_I32BE;
+ static const PredType &STD_I32LE;
+ static const PredType &STD_I64BE;
+ static const PredType &STD_I64LE;
+ static const PredType &STD_U8BE;
+ static const PredType &STD_U8LE;
+ static const PredType &STD_U16BE;
+ static const PredType &STD_U16LE;
+ static const PredType &STD_U32BE;
+ static const PredType &STD_U32LE;
+ static const PredType &STD_U64BE;
+ static const PredType &STD_U64LE;
+ static const PredType &STD_B8BE;
+ static const PredType &STD_B8LE;
+ static const PredType &STD_B16BE;
+ static const PredType &STD_B16LE;
+ static const PredType &STD_B32BE;
+ static const PredType &STD_B32LE;
+ static const PredType &STD_B64BE;
+ static const PredType &STD_B64LE;
+ static const PredType &STD_REF_OBJ;
+ static const PredType &STD_REF_DSETREG;
+
+ static const PredType &C_S1;
+ static const PredType &FORTRAN_S1;
+
+ static const PredType &IEEE_F32BE;
+ static const PredType &IEEE_F32LE;
+ static const PredType &IEEE_F64BE;
+ static const PredType &IEEE_F64LE;
+
+ static const PredType &UNIX_D32BE;
+ static const PredType &UNIX_D32LE;
+ static const PredType &UNIX_D64BE;
+ static const PredType &UNIX_D64LE;
+
+ static const PredType &INTEL_I8;
+ static const PredType &INTEL_I16;
+ static const PredType &INTEL_I32;
+ static const PredType &INTEL_I64;
+ static const PredType &INTEL_U8;
+ static const PredType &INTEL_U16;
+ static const PredType &INTEL_U32;
+ static const PredType &INTEL_U64;
+ static const PredType &INTEL_B8;
+ static const PredType &INTEL_B16;
+ static const PredType &INTEL_B32;
+ static const PredType &INTEL_B64;
+ static const PredType &INTEL_F32;
+ static const PredType &INTEL_F64;
+
+ static const PredType &ALPHA_I8;
+ static const PredType &ALPHA_I16;
+ static const PredType &ALPHA_I32;
+ static const PredType &ALPHA_I64;
+ static const PredType &ALPHA_U8;
+ static const PredType &ALPHA_U16;
+ static const PredType &ALPHA_U32;
+ static const PredType &ALPHA_U64;
+ static const PredType &ALPHA_B8;
+ static const PredType &ALPHA_B16;
+ static const PredType &ALPHA_B32;
+ static const PredType &ALPHA_B64;
+ static const PredType &ALPHA_F32;
+ static const PredType &ALPHA_F64;
+
+ static const PredType &MIPS_I8;
+ static const PredType &MIPS_I16;
+ static const PredType &MIPS_I32;
+ static const PredType &MIPS_I64;
+ static const PredType &MIPS_U8;
+ static const PredType &MIPS_U16;
+ static const PredType &MIPS_U32;
+ static const PredType &MIPS_U64;
+ static const PredType &MIPS_B8;
+ static const PredType &MIPS_B16;
+ static const PredType &MIPS_B32;
+ static const PredType &MIPS_B64;
+ static const PredType &MIPS_F32;
+ static const PredType &MIPS_F64;
+
+ static const PredType &NATIVE_CHAR;
+ static const PredType &NATIVE_SCHAR;
+ static const PredType &NATIVE_UCHAR;
+ static const PredType &NATIVE_SHORT;
+ static const PredType &NATIVE_USHORT;
+ static const PredType &NATIVE_INT;
+ static const PredType &NATIVE_UINT;
+ static const PredType &NATIVE_LONG;
+ static const PredType &NATIVE_ULONG;
+ static const PredType &NATIVE_LLONG;
+ static const PredType &NATIVE_ULLONG;
+ static const PredType &NATIVE_FLOAT;
+ static const PredType &NATIVE_DOUBLE;
+ static const PredType &NATIVE_LDOUBLE;
+ static const PredType &NATIVE_B8;
+ static const PredType &NATIVE_B16;
+ static const PredType &NATIVE_B32;
+ static const PredType &NATIVE_B64;
+ static const PredType &NATIVE_OPAQUE;
+ static const PredType &NATIVE_HSIZE;
+ static const PredType &NATIVE_HSSIZE;
+ static const PredType &NATIVE_HERR;
+ static const PredType &NATIVE_HBOOL;
+
+ static const PredType &NATIVE_INT8;
+ static const PredType &NATIVE_UINT8;
+ static const PredType &NATIVE_INT16;
+ static const PredType &NATIVE_UINT16;
+ static const PredType &NATIVE_INT32;
+ static const PredType &NATIVE_UINT32;
+ static const PredType &NATIVE_INT64;
+ static const PredType &NATIVE_UINT64;
// LEAST types
#if H5_SIZEOF_INT_LEAST8_T != 0
- static const PredType& NATIVE_INT_LEAST8;
+ static const PredType &NATIVE_INT_LEAST8;
#endif /* H5_SIZEOF_INT_LEAST8_T */
#if H5_SIZEOF_UINT_LEAST8_T != 0
- static const PredType& NATIVE_UINT_LEAST8;
+ static const PredType &NATIVE_UINT_LEAST8;
#endif /* H5_SIZEOF_UINT_LEAST8_T */
#if H5_SIZEOF_INT_LEAST16_T != 0
- static const PredType& NATIVE_INT_LEAST16;
+ static const PredType &NATIVE_INT_LEAST16;
#endif /* H5_SIZEOF_INT_LEAST16_T */
#if H5_SIZEOF_UINT_LEAST16_T != 0
- static const PredType& NATIVE_UINT_LEAST16;
+ static const PredType &NATIVE_UINT_LEAST16;
#endif /* H5_SIZEOF_UINT_LEAST16_T */
#if H5_SIZEOF_INT_LEAST32_T != 0
- static const PredType& NATIVE_INT_LEAST32;
+ static const PredType &NATIVE_INT_LEAST32;
#endif /* H5_SIZEOF_INT_LEAST32_T */
#if H5_SIZEOF_UINT_LEAST32_T != 0
- static const PredType& NATIVE_UINT_LEAST32;
+ static const PredType &NATIVE_UINT_LEAST32;
#endif /* H5_SIZEOF_UINT_LEAST32_T */
#if H5_SIZEOF_INT_LEAST64_T != 0
- static const PredType& NATIVE_INT_LEAST64;
+ static const PredType &NATIVE_INT_LEAST64;
#endif /* H5_SIZEOF_INT_LEAST64_T */
#if H5_SIZEOF_UINT_LEAST64_T != 0
- static const PredType& NATIVE_UINT_LEAST64;
+ static const PredType &NATIVE_UINT_LEAST64;
#endif /* H5_SIZEOF_UINT_LEAST64_T */
// FAST types
#if H5_SIZEOF_INT_FAST8_T != 0
- static const PredType& NATIVE_INT_FAST8;
+ static const PredType &NATIVE_INT_FAST8;
#endif /* H5_SIZEOF_INT_FAST8_T */
#if H5_SIZEOF_UINT_FAST8_T != 0
- static const PredType& NATIVE_UINT_FAST8;
+ static const PredType &NATIVE_UINT_FAST8;
#endif /* H5_SIZEOF_UINT_FAST8_T */
#if H5_SIZEOF_INT_FAST16_T != 0
- static const PredType& NATIVE_INT_FAST16;
+ static const PredType &NATIVE_INT_FAST16;
#endif /* H5_SIZEOF_INT_FAST16_T */
#if H5_SIZEOF_UINT_FAST16_T != 0
- static const PredType& NATIVE_UINT_FAST16;
+ static const PredType &NATIVE_UINT_FAST16;
#endif /* H5_SIZEOF_UINT_FAST16_T */
#if H5_SIZEOF_INT_FAST32_T != 0
- static const PredType& NATIVE_INT_FAST32;
+ static const PredType &NATIVE_INT_FAST32;
#endif /* H5_SIZEOF_INT_FAST32_T */
#if H5_SIZEOF_UINT_FAST32_T != 0
- static const PredType& NATIVE_UINT_FAST32;
+ static const PredType &NATIVE_UINT_FAST32;
#endif /* H5_SIZEOF_UINT_FAST32_T */
#if H5_SIZEOF_INT_FAST64_T != 0
- static const PredType& NATIVE_INT_FAST64;
+ static const PredType &NATIVE_INT_FAST64;
#endif /* H5_SIZEOF_INT_FAST64_T */
#if H5_SIZEOF_UINT_FAST64_T != 0
- static const PredType& NATIVE_UINT_FAST64;
+ static const PredType &NATIVE_UINT_FAST64;
#endif /* H5_SIZEOF_UINT_FAST64_T */
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the PredType global constants
- static void deleteConstants();
-
- // Dummy constant
- static const PredType& PREDTYPE_CONST; // dummy constant
-
- protected:
- // Default constructor
- PredType();
-
- // Creates a pre-defined type using an HDF5 pre-defined constant
- PredType(const hid_t predtype_id); // used by the library only
-
- private:
- // Activates the creation of the PredType global constants
- static PredType* getPredTypes();
-
- // Dynamically allocates PredType global constants
- static void makePredTypes();
-
- // Dummy constant
- static PredType* PREDTYPE_CONST_;
-
- // Declaration of pointers to constants
- static PredType* STD_I8BE_;
- static PredType* STD_I8LE_;
- static PredType* STD_I16BE_;
- static PredType* STD_I16LE_;
- static PredType* STD_I32BE_;
- static PredType* STD_I32LE_;
- static PredType* STD_I64BE_;
- static PredType* STD_I64LE_;
- static PredType* STD_U8BE_;
- static PredType* STD_U8LE_;
- static PredType* STD_U16BE_;
- static PredType* STD_U16LE_;
- static PredType* STD_U32BE_;
- static PredType* STD_U32LE_;
- static PredType* STD_U64BE_;
- static PredType* STD_U64LE_;
- static PredType* STD_B8BE_;
- static PredType* STD_B8LE_;
- static PredType* STD_B16BE_;
- static PredType* STD_B16LE_;
- static PredType* STD_B32BE_;
- static PredType* STD_B32LE_;
- static PredType* STD_B64BE_;
- static PredType* STD_B64LE_;
- static PredType* STD_REF_OBJ_;
- static PredType* STD_REF_DSETREG_;
-
- static PredType* C_S1_;
- static PredType* FORTRAN_S1_;
-
- static PredType* IEEE_F32BE_;
- static PredType* IEEE_F32LE_;
- static PredType* IEEE_F64BE_;
- static PredType* IEEE_F64LE_;
-
- static PredType* UNIX_D32BE_;
- static PredType* UNIX_D32LE_;
- static PredType* UNIX_D64BE_;
- static PredType* UNIX_D64LE_;
-
- static PredType* INTEL_I8_;
- static PredType* INTEL_I16_;
- static PredType* INTEL_I32_;
- static PredType* INTEL_I64_;
- static PredType* INTEL_U8_;
- static PredType* INTEL_U16_;
- static PredType* INTEL_U32_;
- static PredType* INTEL_U64_;
- static PredType* INTEL_B8_;
- static PredType* INTEL_B16_;
- static PredType* INTEL_B32_;
- static PredType* INTEL_B64_;
- static PredType* INTEL_F32_;
- static PredType* INTEL_F64_;
-
- static PredType* ALPHA_I8_;
- static PredType* ALPHA_I16_;
- static PredType* ALPHA_I32_;
- static PredType* ALPHA_I64_;
- static PredType* ALPHA_U8_;
- static PredType* ALPHA_U16_;
- static PredType* ALPHA_U32_;
- static PredType* ALPHA_U64_;
- static PredType* ALPHA_B8_;
- static PredType* ALPHA_B16_;
- static PredType* ALPHA_B32_;
- static PredType* ALPHA_B64_;
- static PredType* ALPHA_F32_;
- static PredType* ALPHA_F64_;
-
- static PredType* MIPS_I8_;
- static PredType* MIPS_I16_;
- static PredType* MIPS_I32_;
- static PredType* MIPS_I64_;
- static PredType* MIPS_U8_;
- static PredType* MIPS_U16_;
- static PredType* MIPS_U32_;
- static PredType* MIPS_U64_;
- static PredType* MIPS_B8_;
- static PredType* MIPS_B16_;
- static PredType* MIPS_B32_;
- static PredType* MIPS_B64_;
- static PredType* MIPS_F32_;
- static PredType* MIPS_F64_;
-
- static PredType* NATIVE_CHAR_;
- static PredType* NATIVE_SCHAR_;
- static PredType* NATIVE_UCHAR_;
- static PredType* NATIVE_SHORT_;
- static PredType* NATIVE_USHORT_;
- static PredType* NATIVE_INT_;
- static PredType* NATIVE_UINT_;
- static PredType* NATIVE_LONG_;
- static PredType* NATIVE_ULONG_;
- static PredType* NATIVE_LLONG_;
- static PredType* NATIVE_ULLONG_;
- static PredType* NATIVE_FLOAT_;
- static PredType* NATIVE_DOUBLE_;
- static PredType* NATIVE_LDOUBLE_;
- static PredType* NATIVE_B8_;
- static PredType* NATIVE_B16_;
- static PredType* NATIVE_B32_;
- static PredType* NATIVE_B64_;
- static PredType* NATIVE_OPAQUE_;
- static PredType* NATIVE_HSIZE_;
- static PredType* NATIVE_HSSIZE_;
- static PredType* NATIVE_HERR_;
- static PredType* NATIVE_HBOOL_;
-
- static PredType* NATIVE_INT8_;
- static PredType* NATIVE_UINT8_;
- static PredType* NATIVE_INT16_;
- static PredType* NATIVE_UINT16_;
- static PredType* NATIVE_INT32_;
- static PredType* NATIVE_UINT32_;
- static PredType* NATIVE_INT64_;
- static PredType* NATIVE_UINT64_;
+ // Deletes the PredType global constants
+ static void deleteConstants();
+
+ // Dummy constant
+ static const PredType &PREDTYPE_CONST; // dummy constant
+
+ protected:
+ // Default constructor
+ PredType();
+
+ // Creates a pre-defined type using an HDF5 pre-defined constant
+ PredType(const hid_t predtype_id); // used by the library only
+
+ private:
+ // Activates the creation of the PredType global constants
+ static PredType *getPredTypes();
+
+ // Dynamically allocates PredType global constants
+ static void makePredTypes();
+
+ // Dummy constant
+ static PredType *PREDTYPE_CONST_;
+
+ // Declaration of pointers to constants
+ static PredType *STD_I8BE_;
+ static PredType *STD_I8LE_;
+ static PredType *STD_I16BE_;
+ static PredType *STD_I16LE_;
+ static PredType *STD_I32BE_;
+ static PredType *STD_I32LE_;
+ static PredType *STD_I64BE_;
+ static PredType *STD_I64LE_;
+ static PredType *STD_U8BE_;
+ static PredType *STD_U8LE_;
+ static PredType *STD_U16BE_;
+ static PredType *STD_U16LE_;
+ static PredType *STD_U32BE_;
+ static PredType *STD_U32LE_;
+ static PredType *STD_U64BE_;
+ static PredType *STD_U64LE_;
+ static PredType *STD_B8BE_;
+ static PredType *STD_B8LE_;
+ static PredType *STD_B16BE_;
+ static PredType *STD_B16LE_;
+ static PredType *STD_B32BE_;
+ static PredType *STD_B32LE_;
+ static PredType *STD_B64BE_;
+ static PredType *STD_B64LE_;
+ static PredType *STD_REF_OBJ_;
+ static PredType *STD_REF_DSETREG_;
+
+ static PredType *C_S1_;
+ static PredType *FORTRAN_S1_;
+
+ static PredType *IEEE_F32BE_;
+ static PredType *IEEE_F32LE_;
+ static PredType *IEEE_F64BE_;
+ static PredType *IEEE_F64LE_;
+
+ static PredType *UNIX_D32BE_;
+ static PredType *UNIX_D32LE_;
+ static PredType *UNIX_D64BE_;
+ static PredType *UNIX_D64LE_;
+
+ static PredType *INTEL_I8_;
+ static PredType *INTEL_I16_;
+ static PredType *INTEL_I32_;
+ static PredType *INTEL_I64_;
+ static PredType *INTEL_U8_;
+ static PredType *INTEL_U16_;
+ static PredType *INTEL_U32_;
+ static PredType *INTEL_U64_;
+ static PredType *INTEL_B8_;
+ static PredType *INTEL_B16_;
+ static PredType *INTEL_B32_;
+ static PredType *INTEL_B64_;
+ static PredType *INTEL_F32_;
+ static PredType *INTEL_F64_;
+
+ static PredType *ALPHA_I8_;
+ static PredType *ALPHA_I16_;
+ static PredType *ALPHA_I32_;
+ static PredType *ALPHA_I64_;
+ static PredType *ALPHA_U8_;
+ static PredType *ALPHA_U16_;
+ static PredType *ALPHA_U32_;
+ static PredType *ALPHA_U64_;
+ static PredType *ALPHA_B8_;
+ static PredType *ALPHA_B16_;
+ static PredType *ALPHA_B32_;
+ static PredType *ALPHA_B64_;
+ static PredType *ALPHA_F32_;
+ static PredType *ALPHA_F64_;
+
+ static PredType *MIPS_I8_;
+ static PredType *MIPS_I16_;
+ static PredType *MIPS_I32_;
+ static PredType *MIPS_I64_;
+ static PredType *MIPS_U8_;
+ static PredType *MIPS_U16_;
+ static PredType *MIPS_U32_;
+ static PredType *MIPS_U64_;
+ static PredType *MIPS_B8_;
+ static PredType *MIPS_B16_;
+ static PredType *MIPS_B32_;
+ static PredType *MIPS_B64_;
+ static PredType *MIPS_F32_;
+ static PredType *MIPS_F64_;
+
+ static PredType *NATIVE_CHAR_;
+ static PredType *NATIVE_SCHAR_;
+ static PredType *NATIVE_UCHAR_;
+ static PredType *NATIVE_SHORT_;
+ static PredType *NATIVE_USHORT_;
+ static PredType *NATIVE_INT_;
+ static PredType *NATIVE_UINT_;
+ static PredType *NATIVE_LONG_;
+ static PredType *NATIVE_ULONG_;
+ static PredType *NATIVE_LLONG_;
+ static PredType *NATIVE_ULLONG_;
+ static PredType *NATIVE_FLOAT_;
+ static PredType *NATIVE_DOUBLE_;
+ static PredType *NATIVE_LDOUBLE_;
+ static PredType *NATIVE_B8_;
+ static PredType *NATIVE_B16_;
+ static PredType *NATIVE_B32_;
+ static PredType *NATIVE_B64_;
+ static PredType *NATIVE_OPAQUE_;
+ static PredType *NATIVE_HSIZE_;
+ static PredType *NATIVE_HSSIZE_;
+ static PredType *NATIVE_HERR_;
+ static PredType *NATIVE_HBOOL_;
+
+ static PredType *NATIVE_INT8_;
+ static PredType *NATIVE_UINT8_;
+ static PredType *NATIVE_INT16_;
+ static PredType *NATIVE_UINT16_;
+ static PredType *NATIVE_INT32_;
+ static PredType *NATIVE_UINT32_;
+ static PredType *NATIVE_INT64_;
+ static PredType *NATIVE_UINT64_;
// LEAST types
#if H5_SIZEOF_INT_LEAST8_T != 0
- static PredType* NATIVE_INT_LEAST8_;
+ static PredType *NATIVE_INT_LEAST8_;
#endif /* H5_SIZEOF_INT_LEAST8_T */
#if H5_SIZEOF_UINT_LEAST8_T != 0
- static PredType* NATIVE_UINT_LEAST8_;
+ static PredType *NATIVE_UINT_LEAST8_;
#endif /* H5_SIZEOF_UINT_LEAST8_T */
#if H5_SIZEOF_INT_LEAST16_T != 0
- static PredType* NATIVE_INT_LEAST16_;
+ static PredType *NATIVE_INT_LEAST16_;
#endif /* H5_SIZEOF_INT_LEAST16_T */
#if H5_SIZEOF_UINT_LEAST16_T != 0
- static PredType* NATIVE_UINT_LEAST16_;
+ static PredType *NATIVE_UINT_LEAST16_;
#endif /* H5_SIZEOF_UINT_LEAST16_T */
#if H5_SIZEOF_INT_LEAST32_T != 0
- static PredType* NATIVE_INT_LEAST32_;
+ static PredType *NATIVE_INT_LEAST32_;
#endif /* H5_SIZEOF_INT_LEAST32_T */
#if H5_SIZEOF_UINT_LEAST32_T != 0
- static PredType* NATIVE_UINT_LEAST32_;
+ static PredType *NATIVE_UINT_LEAST32_;
#endif /* H5_SIZEOF_UINT_LEAST32_T */
#if H5_SIZEOF_INT_LEAST64_T != 0
- static PredType* NATIVE_INT_LEAST64_;
+ static PredType *NATIVE_INT_LEAST64_;
#endif /* H5_SIZEOF_INT_LEAST64_T */
#if H5_SIZEOF_UINT_LEAST64_T != 0
- static PredType* NATIVE_UINT_LEAST64_;
+ static PredType *NATIVE_UINT_LEAST64_;
#endif /* H5_SIZEOF_UINT_LEAST64_T */
// FAST types
#if H5_SIZEOF_INT_FAST8_T != 0
- static PredType* NATIVE_INT_FAST8_;
+ static PredType *NATIVE_INT_FAST8_;
#endif /* H5_SIZEOF_INT_FAST8_T */
#if H5_SIZEOF_UINT_FAST8_T != 0
- static PredType* NATIVE_UINT_FAST8_;
+ static PredType *NATIVE_UINT_FAST8_;
#endif /* H5_SIZEOF_UINT_FAST8_T */
#if H5_SIZEOF_INT_FAST16_T != 0
- static PredType* NATIVE_INT_FAST16_;
+ static PredType *NATIVE_INT_FAST16_;
#endif /* H5_SIZEOF_INT_FAST16_T */
#if H5_SIZEOF_UINT_FAST16_T != 0
- static PredType* NATIVE_UINT_FAST16_;
+ static PredType *NATIVE_UINT_FAST16_;
#endif /* H5_SIZEOF_UINT_FAST16_T */
#if H5_SIZEOF_INT_FAST32_T != 0
- static PredType* NATIVE_INT_FAST32_;
+ static PredType *NATIVE_INT_FAST32_;
#endif /* H5_SIZEOF_INT_FAST32_T */
#if H5_SIZEOF_UINT_FAST32_T != 0
- static PredType* NATIVE_UINT_FAST32_;
+ static PredType *NATIVE_UINT_FAST32_;
#endif /* H5_SIZEOF_UINT_FAST32_T */
#if H5_SIZEOF_INT_FAST64_T != 0
- static PredType* NATIVE_INT_FAST64_;
+ static PredType *NATIVE_INT_FAST64_;
#endif /* H5_SIZEOF_INT_FAST64_T */
#if H5_SIZEOF_UINT_FAST64_T != 0
- static PredType* NATIVE_UINT_FAST64_;
+ static PredType *NATIVE_UINT_FAST64_;
#endif /* H5_SIZEOF_UINT_FAST64_T */
- // End of Declaration of pointers
+ // End of Declaration of pointers
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp
index a01878c..c64ecf8 100644
--- a/c++/src/H5PropList.cpp
+++ b/c++/src/H5PropList.cpp
@@ -19,16 +19,15 @@
#include <string>
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
-
namespace H5 {
- using std::cerr;
- using std::endl;
+using std::cerr;
+using std::endl;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control
@@ -36,7 +35,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-PropList* PropList::DEFAULT_ = 0;
+PropList *PropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: PropList::getConstant
@@ -48,13 +47,13 @@ PropList* PropList::DEFAULT_ = 0;
// throw a PropListIException. This scenario should not happen.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-PropList* PropList::getConstant()
+PropList *
+PropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -63,8 +62,9 @@ PropList* PropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new PropList(H5P_DEFAULT);
else
- throw PropListIException("PropList::getConstant", "PropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException("PropList::getConstant",
+ "PropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -72,7 +72,8 @@ PropList* PropList::getConstant()
// Purpose Deletes the constant object that PropList::DEFAULT_ points to.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void PropList::deleteConstants()
+void
+PropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -81,7 +82,7 @@ void PropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose Constant for default property.
//--------------------------------------------------------------------------
-const PropList& PropList::DEFAULT = *getConstant();
+const PropList &PropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -98,7 +99,7 @@ PropList::PropList() : IdComponent(), id(H5P_DEFAULT) {}
///\param original - IN: The original property list to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PropList::PropList(const PropList& original) : IdComponent(), id(original.id)
+PropList::PropList(const PropList &original) : IdComponent(), id(original.id)
{
incRefCount(); // increment number of references to this id
}
@@ -123,21 +124,19 @@ PropList::PropList(const hid_t plist_id) : IdComponent()
H5I_type_t id_type = H5Iget_type(plist_id);
switch (id_type) {
case H5I_GENPROP_CLS:
- // call C routine to create a new property from the given prop class
- id = H5Pcreate(plist_id);
- if (id < 0)
- {
- throw PropListIException("PropList constructor", "H5Pcreate failed");
- }
- break;
+ // call C routine to create a new property from the given prop class
+ id = H5Pcreate(plist_id);
+ if (id < 0) {
+ throw PropListIException("PropList constructor", "H5Pcreate failed");
+ }
+ break;
case H5I_GENPROP_LST:
- // call C routine to make a copy of the given property list
- id = H5Pcopy(plist_id);
- if (id < 0)
- {
- throw PropListIException("PropList constructor", "H5Pcopy failed");
- }
- break;
+ // call C routine to make a copy of the given property list
+ id = H5Pcopy(plist_id);
+ if (id < 0) {
+ throw PropListIException("PropList constructor", "H5Pcopy failed");
+ }
+ break;
/* These should really be error cases, but changing that breaks
* the stated behavior and causes test failures.
* (DER, July 2017)
@@ -157,8 +156,8 @@ PropList::PropList(const hid_t plist_id) : IdComponent()
case H5I_NTYPES:
case H5I_UNINIT:
default:
- id = H5P_DEFAULT;
- break;
+ id = H5P_DEFAULT;
+ break;
}
}
@@ -174,14 +173,15 @@ PropList::PropList(const hid_t plist_id) : IdComponent()
// - Replaced decRefCount with close() to let the C library
// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
-void PropList::copy(const PropList& like_plist)
+void
+PropList::copy(const PropList &like_plist)
{
// If this object is representing an hdf5 object, close it before
// copying like_plist to it
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw PropListIException(inMemFunc("copy"), close_error.getDetailMsg());
}
@@ -202,11 +202,12 @@ void PropList::copy(const PropList& like_plist)
// and stores the new id in the left hand side object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PropList& PropList::operator=(const PropList& rhs)
+PropList &
+PropList::operator=(const PropList &rhs)
{
if (this != &rhs)
copy(rhs);
- return(*this);
+ return (*this);
}
//--------------------------------------------------------------------------
@@ -217,12 +218,12 @@ PropList& PropList::operator=(const PropList& rhs)
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-void PropList::copyProp(PropList& dest, const char *name) const
+void
+PropList::copyProp(PropList &dest, const char *name) const
{
- hid_t dst_id = dest.getId();
+ hid_t dst_id = dest.getId();
herr_t ret_value = H5Pcopy_prop(dst_id, id, name);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("copyProp"), "H5Pcopy_prop failed");
}
}
@@ -236,7 +237,8 @@ void PropList::copyProp(PropList& dest, const char *name) const
///\param name - IN: Name of the property to copy - \c H5std_string
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-void PropList::copyProp(PropList& dest, const H5std_string& name) const
+void
+PropList::copyProp(PropList &dest, const H5std_string &name) const
{
copyProp(dest, name.c_str());
}
@@ -251,16 +253,15 @@ void PropList::copyProp(PropList& dest, const H5std_string& name) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void PropList::copyProp(PropList& dest, PropList& src, const char *name) const
+void
+PropList::copyProp(PropList &dest, PropList &src, const char *name) const
{
- hid_t dst_id = dest.getId();
- hid_t src_id = src.getId();
+ hid_t dst_id = dest.getId();
+ hid_t src_id = src.getId();
herr_t ret_value = H5Pcopy_prop(dst_id, src_id, name);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("copyProp"), "H5Pcopy_prop failed");
}
-
}
//--------------------------------------------------------------------------
@@ -273,7 +274,8 @@ void PropList::copyProp(PropList& dest, PropList& src, const char *name) const
///\param name - IN: Name of the property to copy - \c H5std_string
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void PropList::copyProp(PropList& dest, PropList& src, const H5std_string& name) const
+void
+PropList::copyProp(PropList &dest, PropList &src, const H5std_string &name) const
{
copyProp(dest, src, name.c_str());
}
@@ -289,9 +291,10 @@ void PropList::copyProp(PropList& dest, PropList& src, const H5std_string& name)
// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
-hid_t PropList::getId() const
+hid_t
+PropList::getId() const
{
- return(id);
+ return (id);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -307,17 +310,18 @@ hid_t PropList::getId() const
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void PropList::p_setId(const hid_t new_id)
+void
+PropList::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw PropListIException(inMemFunc("p_setId"), close_error.getDetailMsg());
}
- // reset object's id to the given id
- id = new_id;
+ // reset object's id to the given id
+ id = new_id;
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -329,13 +333,12 @@ void PropList::p_setId(const hid_t new_id)
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
-void PropList::close()
+void
+PropList::close()
{
- if (p_valid_id(id))
- {
+ if (p_valid_id(id)) {
herr_t ret_value = H5Pclose(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("close"), "H5Pclose failed");
}
// reset the id
@@ -350,15 +353,14 @@ void PropList::close()
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-hid_t PropList::getClass() const
+hid_t
+PropList::getClass() const
{
hid_t plist_class = H5Pget_class(id);
- if (plist_class == H5P_ROOT)
- {
- throw PropListIException(inMemFunc("getClass"),
- "H5Pget_class failed - returned H5P_ROOT");
+ if (plist_class == H5P_ROOT) {
+ throw PropListIException(inMemFunc("getClass"), "H5Pget_class failed - returned H5P_ROOT");
}
- return(plist_class);
+ return (plist_class);
}
//--------------------------------------------------------------------------
@@ -373,7 +375,8 @@ hid_t PropList::getClass() const
/// list or class.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-bool PropList::propExist(const char* name) const
+bool
+PropList::propExist(const char *name) const
{
// Calls C routine H5Pexist to determine whether a property exists
// within a property list or class. It returns a positive value, 0,
@@ -396,9 +399,10 @@ bool PropList::propExist(const char* name) const
///\param name - IN: Name of property to check for - \c H5std_string
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-bool PropList::propExist(const H5std_string& name) const
+bool
+PropList::propExist(const H5std_string &name) const
{
- return(propExist( name.c_str()));
+ return (propExist(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -411,11 +415,11 @@ bool PropList::propExist(const H5std_string& name) const
/// list class hierarchy.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::closeClass() const
+void
+PropList::closeClass() const
{
herr_t ret_value = H5Pclose_class(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("closeClass"), "H5Pclose_class failed");
}
}
@@ -432,11 +436,11 @@ void PropList::closeClass() const
/// throw an exception.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::getProperty(const char* name, void* value) const
+void
+PropList::getProperty(const char *name, void *value) const
{
herr_t ret_value = H5Pget(id, name, value);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("getProperty"), "H5Pget failed");
}
}
@@ -450,27 +454,27 @@ void PropList::getProperty(const char* name, void* value) const
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-H5std_string PropList::getProperty(const char* name) const
+H5std_string
+PropList::getProperty(const char *name) const
{
// Get property size first
size_t size = getPropSize(name);
// Allocate buffer then get the property
- char* prop_strg_C = new char[size+1]; // temporary C-string for C API
- HDmemset(prop_strg_C, 0, size+1); // clear buffer
+ char *prop_strg_C = new char[size + 1]; // temporary C-string for C API
+ HDmemset(prop_strg_C, 0, size + 1); // clear buffer
herr_t ret_value = H5Pget(id, name, prop_strg_C); // call C API
// Throw exception if H5Pget returns failure
- if (ret_value < 0)
- {
- delete []prop_strg_C;
+ if (ret_value < 0) {
+ delete[] prop_strg_C;
throw PropListIException(inMemFunc("getProperty"), "H5Pget failed");
}
// Return property value as a string after deleting temp C-string
H5std_string prop_strg(prop_strg_C);
- delete []prop_strg_C;
+ delete[] prop_strg_C;
return (prop_strg);
}
//--------------------------------------------------------------------------
@@ -482,7 +486,8 @@ H5std_string PropList::getProperty(const char* name) const
///\param value - OUT: Pointer to the buffer for the property value
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::getProperty(const H5std_string& name, void* value) const
+void
+PropList::getProperty(const H5std_string &name, void *value) const
{
getProperty(name.c_str(), value);
}
@@ -495,7 +500,8 @@ void PropList::getProperty(const H5std_string& name, void* value) const
///\return The property that is a \c H5std_string.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-H5std_string PropList::getProperty(const H5std_string& name) const
+H5std_string
+PropList::getProperty(const H5std_string &name) const
{
return (getProperty(name.c_str()));
}
@@ -513,15 +519,15 @@ H5std_string PropList::getProperty(const H5std_string& name) const
/// lists and classes.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-size_t PropList::getPropSize(const char *name) const
+size_t
+PropList::getPropSize(const char *name) const
{
size_t prop_size;
herr_t ret_value = H5Pget_size(id, name, &prop_size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("getPropSize"), "H5Pget_size failed");
}
- return(prop_size);
+ return (prop_size);
}
//--------------------------------------------------------------------------
// Function: PropList::getPropSize
@@ -532,7 +538,8 @@ size_t PropList::getPropSize(const char *name) const
///
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-size_t PropList::getPropSize(const H5std_string& name) const
+size_t
+PropList::getPropSize(const H5std_string &name) const
{
return (getPropSize(name.c_str()));
}
@@ -544,15 +551,15 @@ size_t PropList::getPropSize(const H5std_string& name) const
/// a NULL string.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-H5std_string PropList::getClassName() const
+H5std_string
+PropList::getClassName() const
{
- char* temp_str;
+ char *temp_str;
temp_str = H5Pget_class_name(id);
- if (temp_str != NULL)
- {
+ if (temp_str != NULL) {
H5std_string class_name(temp_str);
H5free_memory(temp_str);
- return(class_name);
+ return (class_name);
}
else
return 0;
@@ -564,12 +571,12 @@ H5std_string PropList::getClassName() const
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-size_t PropList::getNumProps() const
+size_t
+PropList::getNumProps() const
{
size_t nprops;
- herr_t ret_value = H5Pget_nprops (id, &nprops);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pget_nprops(id, &nprops);
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("getNumProps"), "H5Pget_nprops failed");
}
return (nprops);
@@ -586,11 +593,11 @@ size_t PropList::getNumProps() const
// the non-const setProperty.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::setProperty(const char* name, const void* value) const
+void
+PropList::setProperty(const char *name, const void *value) const
{
herr_t ret_value = H5Pset(id, name, value);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("setProperty"), "H5Pset failed");
}
}
@@ -602,11 +609,11 @@ void PropList::setProperty(const char* name, const void* value) const
// Modification
// Planned for removal. -BMR, 2017/03/17 1.10.1
//--------------------------------------------------------------------------
-void PropList::setProperty(const char* name, void* value) const
+void
+PropList::setProperty(const char *name, void *value) const
{
herr_t ret_value = H5Pset(id, name, value);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("setProperty"), "H5Pset failed");
}
}
@@ -623,11 +630,11 @@ void PropList::setProperty(const char* name, void* value) const
// the non-const setProperty.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::setProperty(const char* name, const char* charptr) const
+void
+PropList::setProperty(const char *name, const char *charptr) const
{
- herr_t ret_value = H5Pset(id, name, (const void*)charptr);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pset(id, name, (const void *)charptr);
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("setProperty"), "H5Pset failed");
}
}
@@ -640,7 +647,8 @@ void PropList::setProperty(const char* name, const char* charptr) const
///\param strg - IN: Value for the property is a \c H5std_string
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::setProperty(const char* name, const H5std_string& strg) const
+void
+PropList::setProperty(const char *name, const H5std_string &strg) const
{
setProperty(name, strg.c_str());
}
@@ -652,7 +660,8 @@ void PropList::setProperty(const char* name, const H5std_string& strg) const
// Modification
// Planned for removal. -BMR, 2017/03/17 1.10.1
//--------------------------------------------------------------------------
-void PropList::setProperty(const char* name, H5std_string& strg) const
+void
+PropList::setProperty(const char *name, H5std_string &strg) const
{
setProperty(name, strg.c_str());
}
@@ -666,7 +675,8 @@ void PropList::setProperty(const char* name, H5std_string& strg) const
///\param value - IN: Void pointer to the value for the property
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::setProperty(const H5std_string& name, const void* value) const
+void
+PropList::setProperty(const H5std_string &name, const void *value) const
{
setProperty(name.c_str(), value);
}
@@ -678,7 +688,8 @@ void PropList::setProperty(const H5std_string& name, const void* value) const
// Modification
// Planned for removal. -BMR, 2017/03/17 1.10.1
//--------------------------------------------------------------------------
-void PropList::setProperty(const H5std_string& name, void* value) const
+void
+PropList::setProperty(const H5std_string &name, void *value) const
{
setProperty(name.c_str(), value);
}
@@ -692,7 +703,8 @@ void PropList::setProperty(const H5std_string& name, void* value) const
///\param strg - IN: Value for the property is a \c H5std_string
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::setProperty(const H5std_string& name, const H5std_string& strg) const
+void
+PropList::setProperty(const H5std_string &name, const H5std_string &strg) const
{
setProperty(name.c_str(), strg.c_str());
}
@@ -704,7 +716,8 @@ void PropList::setProperty(const H5std_string& name, const H5std_string& strg) c
// Modification
// Planned for removal. -BMR, 2017/03/17 1.10.1
//--------------------------------------------------------------------------
-void PropList::setProperty(const H5std_string& name, H5std_string& strg) const
+void
+PropList::setProperty(const H5std_string &name, H5std_string &strg) const
{
setProperty(name.c_str(), strg.c_str());
}
@@ -718,7 +731,8 @@ void PropList::setProperty(const H5std_string& name, H5std_string& strg) const
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-bool PropList::isAClass(const PropList& prop_class) const
+bool
+PropList::isAClass(const PropList &prop_class) const
{
htri_t ret_value = H5Pisa_class(id, prop_class.getId());
if (ret_value > 0)
@@ -738,11 +752,11 @@ bool PropList::isAClass(const PropList& prop_class) const
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::removeProp(const char *name) const
+void
+PropList::removeProp(const char *name) const
{
herr_t ret_value = H5Premove(id, name);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("removeProp"), "H5Premove failed");
}
}
@@ -755,7 +769,8 @@ void PropList::removeProp(const char *name) const
///\param name - IN: Name of property to remove - \c H5std_string
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::removeProp(const H5std_string& name) const
+void
+PropList::removeProp(const H5std_string &name) const
{
removeProp(name.c_str());
}
@@ -769,7 +784,8 @@ void PropList::removeProp(const H5std_string& name) const
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-bool PropList::operator==(const PropList& rhs) const
+bool
+PropList::operator==(const PropList &rhs) const
{
htri_t ret_value = H5Pequal(id, rhs.getId());
if (ret_value > 0)
@@ -789,15 +805,15 @@ bool PropList::operator==(const PropList& rhs) const
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-PropList PropList::getClassParent() const
+PropList
+PropList::getClassParent() const
{
hid_t class_id = H5Pget_class_parent(id);
- if (class_id < 0)
- {
+ if (class_id < 0) {
throw PropListIException(inMemFunc("getClassParent"), "H5Pget_class_parent failed");
}
PropList pclass(class_id);
- return(pclass);
+ return (pclass);
}
//--------------------------------------------------------------------------
@@ -815,9 +831,9 @@ PropList::~PropList()
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
cerr << "PropList::~PropList - " << close_error.getDetailMsg() << endl;
}
}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h
index d704775..805f6da 100644
--- a/c++/src/H5PropList.h
+++ b/c++/src/H5PropList.h
@@ -23,121 +23,125 @@ namespace H5 {
*/
// Inheritance: IdComponent
class H5_DLLCPP PropList : public IdComponent {
- public:
- ///\brief Default property list
- static const PropList& DEFAULT;
+ public:
+ ///\brief Default property list
+ static const PropList &DEFAULT;
- // Creates a property list of a given type or creates a copy of an
- // existing property list giving the property list id.
- PropList(const hid_t plist_id);
+ // Creates a property list of a given type or creates a copy of an
+ // existing property list giving the property list id.
+ PropList(const hid_t plist_id);
- // Make a copy of the given property list using assignment statement
- PropList& operator=(const PropList& rhs);
+ // Make a copy of the given property list using assignment statement
+ PropList &operator=(const PropList &rhs);
- // Compares this property list or class against the given list or class.
- bool operator==(const PropList& rhs) const;
+ // Compares this property list or class against the given list or class.
+ bool operator==(const PropList &rhs) const;
- // Close this property list.
- virtual void close();
+ // Close this property list.
+ virtual void close();
- // Close a property list class.
- void closeClass() const;
+ // Close a property list class.
+ void closeClass() const;
- // Makes a copy of the given property list.
- void copy(const PropList& like_plist);
+ // Makes a copy of the given property list.
+ void copy(const PropList &like_plist);
- // Copies a property from this property list or class to another
- void copyProp(PropList& dest, const char* name) const;
- void copyProp(PropList& dest, const H5std_string& name) const;
+ // Copies a property from this property list or class to another
+ void copyProp(PropList &dest, const char *name) const;
+ void copyProp(PropList &dest, const H5std_string &name) const;
- // Copies a property from one property list or property class to another
- void copyProp(PropList& dest, PropList& src, const char* name) const;
- void copyProp(PropList& dest, PropList& src, const H5std_string& name) const;
+ // Copies a property from one property list or property class to another
+ void copyProp(PropList &dest, PropList &src, const char *name) const;
+ void copyProp(PropList &dest, PropList &src, const H5std_string &name) const;
- // Gets the class of this property list, i.e. H5P_FILE_CREATE,
- // H5P_FILE_ACCESS, ...
- hid_t getClass() const;
+ // Gets the class of this property list, i.e. H5P_FILE_CREATE,
+ // H5P_FILE_ACCESS, ...
+ hid_t getClass() const;
- // Return the name of a generic property list class.
- H5std_string getClassName() const;
+ // Return the name of a generic property list class.
+ H5std_string getClassName() const;
- // Returns the parent class of a generic property class.
- PropList getClassParent() const;
+ // Returns the parent class of a generic property class.
+ PropList getClassParent() const;
- // Returns the number of properties in this property list or class.
- size_t getNumProps() const;
+ // Returns the number of properties in this property list or class.
+ size_t getNumProps() const;
- // Query the value of a property in a property list.
- void getProperty(const char* name, void* value) const;
- void getProperty(const H5std_string& name, void* value) const;
- H5std_string getProperty(const char* name) const;
- H5std_string getProperty(const H5std_string& name) const;
+ // Query the value of a property in a property list.
+ void getProperty(const char *name, void *value) const;
+ void getProperty(const H5std_string &name, void *value) const;
+ H5std_string getProperty(const char *name) const;
+ H5std_string getProperty(const H5std_string &name) const;
- // Set a property's value in a property list.
- void setProperty(const char* name, const char* charptr) const;
- void setProperty(const char* name, const void* value) const;
- void setProperty(const char* name, const H5std_string& strg) const;
- void setProperty(const H5std_string& name, const void* value) const;
- void setProperty(const H5std_string& name, const H5std_string& strg) const;
- // Deprecated after 1.10.1, missing const
- void setProperty(const char* name, void* value) const;
- void setProperty(const char* name, H5std_string& strg) const;
- void setProperty(const H5std_string& name, void* value) const;
- void setProperty(const H5std_string& name, H5std_string& strg) const;
+ // Set a property's value in a property list.
+ void setProperty(const char *name, const char *charptr) const;
+ void setProperty(const char *name, const void *value) const;
+ void setProperty(const char *name, const H5std_string &strg) const;
+ void setProperty(const H5std_string &name, const void *value) const;
+ void setProperty(const H5std_string &name, const H5std_string &strg) const;
+ // Deprecated after 1.10.1, missing const
+ void setProperty(const char *name, void *value) const;
+ void setProperty(const char *name, H5std_string &strg) const;
+ void setProperty(const H5std_string &name, void *value) const;
+ void setProperty(const H5std_string &name, H5std_string &strg) const;
- // Query the size of a property in a property list or class.
- size_t getPropSize(const char *name) const;
- size_t getPropSize(const H5std_string& name) const;
+ // Query the size of a property in a property list or class.
+ size_t getPropSize(const char *name) const;
+ size_t getPropSize(const H5std_string &name) const;
- // Determines whether a property list is a certain class.
- bool isAClass(const PropList& prop_class) const;
+ // Determines whether a property list is a certain class.
+ bool isAClass(const PropList &prop_class) const;
- /// Query the existence of a property in a property object.
- bool propExist(const char* name) const;
- bool propExist(const H5std_string& name) const;
+ /// Query the existence of a property in a property object.
+ bool propExist(const char *name) const;
+ bool propExist(const H5std_string &name) const;
- // Removes a property from a property list.
- void removeProp(const char *name) const;
- void removeProp(const H5std_string& name) const;
+ // Removes a property from a property list.
+ void removeProp(const char *name) const;
+ void removeProp(const H5std_string &name) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("PropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("PropList");
+ }
- // Default constructor: creates a stub PropList object.
- PropList();
+ // Default constructor: creates a stub PropList object.
+ PropList();
- // Copy constructor: same as the original PropList.
- PropList(const PropList& original);
+ // Copy constructor: same as the original PropList.
+ PropList(const PropList &original);
- // Gets the property list id.
- virtual hid_t getId() const;
+ // Gets the property list id.
+ virtual hid_t getId() const;
- // Destructor: properly terminates access to this property list.
- virtual ~PropList();
+ // Destructor: properly terminates access to this property list.
+ virtual ~PropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the PropList global constant
- static void deleteConstants();
+ // Deletes the PropList global constant
+ static void deleteConstants();
- protected:
- hid_t id; // HDF5 property list id
+ protected:
+ hid_t id; // HDF5 property list id
- // Sets the property list id.
- virtual void p_setId(const hid_t new_id);
+ // Sets the property list id.
+ virtual void p_setId(const hid_t new_id);
- private:
- static PropList* DEFAULT_;
+ private:
+ static PropList *DEFAULT_;
- // Dynamically allocates the PropList global constant
- static PropList* getConstant();
+ // Dynamically allocates the PropList global constant
+ static PropList *getConstant();
- // Friend function to set PropList id. For library use only.
- friend void f_PropList_setId(PropList* plist, hid_t new_id);
+ // Friend function to set PropList id. For library use only.
+ friend void f_PropList_setId(PropList *plist, hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
}; // end of PropList
} // namespace H5
-#endif // __H5PropList_H
+#endif // __H5PropList_H
diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp
index f5b65e4..c246933 100644
--- a/c++/src/H5StrType.cpp
+++ b/c++/src/H5StrType.cpp
@@ -49,7 +49,7 @@ StrType::StrType() : AtomType() {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType::StrType(const PredType& pred_type) : AtomType()
+StrType::StrType(const PredType &pred_type) : AtomType()
{
// use DataType::copy to make a copy of this predefined type
copy(pred_type);
@@ -78,7 +78,7 @@ StrType::StrType(const PredType& pred_type) : AtomType()
// Planned for removal. -BMR, 2005/12/02
// Removed from documentation. -BMR, 2016/03/07
//--------------------------------------------------------------------------
-StrType::StrType(const PredType& pred_type, const size_t& size) : AtomType()
+StrType::StrType(const PredType &pred_type, const size_t &size) : AtomType()
{
// use DataType::copy to make a copy of the string predefined type
// then set its length
@@ -102,7 +102,7 @@ StrType::StrType(const PredType& pred_type, const size_t& size) : AtomType()
// This constructor replaced the previous one.
// Programmer Binh-Minh Ribler - Nov 28, 2005
//--------------------------------------------------------------------------
-StrType::StrType(const int dummy, const size_t& size) : AtomType()
+StrType::StrType(const int dummy, const size_t &size) : AtomType()
{
// use DataType::copy to make a copy of the string predefined type
// then set its length
@@ -117,14 +117,14 @@ StrType::StrType(const int dummy, const size_t& size) : AtomType()
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType::StrType(const hid_t existing_id) : AtomType( existing_id ) {}
+StrType::StrType(const hid_t existing_id) : AtomType(existing_id) {}
//--------------------------------------------------------------------------
// Function: StrType copy constructor
///\brief Copy constructor: same HDF5 object as \a original
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType::StrType(const StrType& original) : AtomType ( original ) {}
+StrType::StrType(const StrType &original) : AtomType(original) {}
//--------------------------------------------------------------------------
// Function: StrType overloaded constructor
@@ -133,13 +133,12 @@ StrType::StrType(const StrType& original) : AtomType ( original ) {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType::StrType(const DataSet& dataset) : AtomType ()
+StrType::StrType(const DataSet &dataset) : AtomType()
{
// Calls C function H5Dget_type to get the id of the datatype
id = H5Dget_type(dataset.getId());
- if (id < 0)
- {
+ if (id < 0) {
throw DataSetIException("StrType constructor", "H5Dget_type failed");
}
}
@@ -158,7 +157,7 @@ StrType::StrType(const DataSet& dataset) : AtomType ()
// improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-StrType::StrType(const H5Location& loc, const char *dtype_name) : AtomType()
+StrType::StrType(const H5Location &loc, const char *dtype_name) : AtomType()
{
id = p_opentype(loc, dtype_name);
}
@@ -177,7 +176,7 @@ StrType::StrType(const H5Location& loc, const char *dtype_name) : AtomType()
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-StrType::StrType(const H5Location& loc, const H5std_string& dtype_name) : AtomType()
+StrType::StrType(const H5Location &loc, const H5std_string &dtype_name) : AtomType()
{
id = p_opentype(loc, dtype_name.c_str());
}
@@ -190,7 +189,8 @@ StrType::StrType(const H5Location& loc, const H5std_string& dtype_name) : AtomTy
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-DataType* StrType::decode() const
+DataType *
+StrType::decode() const
{
hid_t encoded_strtype_id = H5I_INVALID_HID;
try {
@@ -201,7 +201,7 @@ DataType* StrType::decode() const
}
StrType *encoded_strtype = new StrType;
encoded_strtype->p_setId(encoded_strtype_id);
- return(encoded_strtype);
+ return (encoded_strtype);
}
//--------------------------------------------------------------------------
@@ -219,16 +219,16 @@ DataType* StrType::decode() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_cset_t StrType::getCset() const
+H5T_cset_t
+StrType::getCset() const
{
H5T_cset_t cset = H5Tget_cset(id);
// Returns a valid character set type if successful
- if (cset == H5T_CSET_ERROR)
- {
+ if (cset == H5T_CSET_ERROR) {
throw DataTypeIException("StrType::getCset", "H5Tget_cset failed");
}
- return(cset);
+ return (cset);
}
//--------------------------------------------------------------------------
@@ -246,11 +246,11 @@ H5T_cset_t StrType::getCset() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void StrType::setCset(H5T_cset_t cset) const
+void
+StrType::setCset(H5T_cset_t cset) const
{
herr_t ret_value = H5Tset_cset(id, cset);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("StrType::setCset", "H5Tset_cset failed");
}
}
@@ -265,17 +265,16 @@ void StrType::setCset(H5T_cset_t cset) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_str_t StrType::getStrpad() const
+H5T_str_t
+StrType::getStrpad() const
{
H5T_str_t strpad = H5Tget_strpad(id);
// Returns a valid string padding type if successful
- if (strpad == H5T_STR_ERROR)
- {
- throw DataTypeIException("StrType::getStrpad",
- "H5Tget_strpad failed - returned H5T_STR_ERROR");
+ if (strpad == H5T_STR_ERROR) {
+ throw DataTypeIException("StrType::getStrpad", "H5Tget_strpad failed - returned H5T_STR_ERROR");
}
- return(strpad);
+ return (strpad);
}
//--------------------------------------------------------------------------
@@ -288,11 +287,11 @@ H5T_str_t StrType::getStrpad() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void StrType::setStrpad(H5T_str_t strpad) const
+void
+StrType::setStrpad(H5T_str_t strpad) const
{
herr_t ret_value = H5Tset_strpad(id, strpad);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("StrType::setStrpad", "H5Tset_strpad failed");
}
}
@@ -304,4 +303,4 @@ void StrType::setStrpad(H5T_str_t strpad) const
//--------------------------------------------------------------------------
StrType::~StrType() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h
index 38974da..d442bc4 100644
--- a/c++/src/H5StrType.h
+++ b/c++/src/H5StrType.h
@@ -23,53 +23,57 @@ namespace H5 {
*/
// Inheritance: AtomType -> DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP StrType : public AtomType {
- public:
- // Creates a string type using a predefined type
- StrType(const PredType& pred_type);
+ public:
+ // Creates a string type using a predefined type
+ StrType(const PredType &pred_type);
- // Creates a string type with specified length - may be obsolete
- StrType(const PredType& pred_type, const size_t& size);
+ // Creates a string type with specified length - may be obsolete
+ StrType(const PredType &pred_type, const size_t &size);
- // Creates a string type with specified length
- StrType(const int dummy, const size_t& size);
+ // Creates a string type with specified length
+ StrType(const int dummy, const size_t &size);
- // Gets the string datatype of the specified dataset
- StrType(const DataSet& dataset);
+ // Gets the string datatype of the specified dataset
+ StrType(const DataSet &dataset);
- // Constructors that open an HDF5 string datatype, given a location.
- StrType(const H5Location& loc, const char* name);
- StrType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open an HDF5 string datatype, given a location.
+ StrType(const H5Location &loc, const char *name);
+ StrType(const H5Location &loc, const H5std_string &name);
- // Returns an StrType object via DataType* by decoding the
- // binary object description of this type.
- virtual DataType* decode() const;
+ // Returns an StrType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType *decode() const;
- // Retrieves the character set type of this string datatype.
- H5T_cset_t getCset() const;
+ // Retrieves the character set type of this string datatype.
+ H5T_cset_t getCset() const;
- // Sets character set to be used.
- void setCset(H5T_cset_t cset) const;
+ // Sets character set to be used.
+ void setCset(H5T_cset_t cset) const;
- // Retrieves the string padding method for this string datatype.
- H5T_str_t getStrpad() const;
+ // Retrieves the string padding method for this string datatype.
+ H5T_str_t getStrpad() const;
- // Defines the storage mechanism for character strings.
- void setStrpad(H5T_str_t strpad) const;
+ // Defines the storage mechanism for character strings.
+ void setStrpad(H5T_str_t strpad) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("StrType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("StrType");
+ }
- // default constructor
- StrType();
+ // default constructor
+ StrType();
- // Creates a string datatype using an existing id
- StrType(const hid_t existing_id);
+ // Creates a string datatype using an existing id
+ StrType(const hid_t existing_id);
- // Copy constructor: same as the original StrType.
- StrType(const StrType& original);
+ // Copy constructor: same as the original StrType.
+ StrType(const StrType &original);
- // Noop destructor.
- virtual ~StrType();
+ // Noop destructor.
+ virtual ~StrType();
}; // end of StrType
} // namespace H5
diff --git a/c++/src/H5VarLenType.cpp b/c++/src/H5VarLenType.cpp
index 094af61..cb2478e 100644
--- a/c++/src/H5VarLenType.cpp
+++ b/c++/src/H5VarLenType.cpp
@@ -49,7 +49,7 @@ VarLenType::VarLenType(const hid_t existing_id) : DataType(existing_id) {}
///\brief Copy constructor: same HDF5 object as \a original
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-VarLenType::VarLenType(const VarLenType& original) : DataType(original) {}
+VarLenType::VarLenType(const VarLenType &original) : DataType(original) {}
//--------------------------------------------------------------------------
// Function: VarLenType overloaded constructor
@@ -63,13 +63,11 @@ VarLenType::VarLenType(const VarLenType& original) : DataType(original) {}
// -BMR, Sep, 2017
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-VarLenType::VarLenType(const DataType* base_type) : DataType()
+VarLenType::VarLenType(const DataType *base_type) : DataType()
{
id = H5Tvlen_create(base_type->getId());
- if (id < 0)
- {
- throw DataTypeIException("VarLenType constructor",
- "H5Tvlen_create returns negative value");
+ if (id < 0) {
+ throw DataTypeIException("VarLenType constructor", "H5Tvlen_create returns negative value");
}
}
@@ -81,13 +79,11 @@ VarLenType::VarLenType(const DataType* base_type) : DataType()
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-VarLenType::VarLenType(const DataType& base_type) : DataType()
+VarLenType::VarLenType(const DataType &base_type) : DataType()
{
id = H5Tvlen_create(base_type.getId());
- if (id < 0)
- {
- throw DataTypeIException("VarLenType constructor",
- "H5Tvlen_create returns negative value");
+ if (id < 0) {
+ throw DataTypeIException("VarLenType constructor", "H5Tvlen_create returns negative value");
}
}
@@ -105,7 +101,7 @@ VarLenType::VarLenType(const DataType& base_type) : DataType()
// improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-VarLenType::VarLenType(const H5Location& loc, const char *dtype_name) : DataType()
+VarLenType::VarLenType(const H5Location &loc, const char *dtype_name) : DataType()
{
id = p_opentype(loc, dtype_name);
}
@@ -124,7 +120,7 @@ VarLenType::VarLenType(const H5Location& loc, const char *dtype_name) : DataType
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-VarLenType::VarLenType(const H5Location& loc, const H5std_string& dtype_name) : DataType()
+VarLenType::VarLenType(const H5Location &loc, const H5std_string &dtype_name) : DataType()
{
id = p_opentype(loc, dtype_name.c_str());
}
@@ -137,7 +133,8 @@ VarLenType::VarLenType(const H5Location& loc, const H5std_string& dtype_name) :
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-DataType* VarLenType::decode() const
+DataType *
+VarLenType::decode() const
{
hid_t encoded_vltype_id = H5I_INVALID_HID;
try {
@@ -148,7 +145,7 @@ DataType* VarLenType::decode() const
}
VarLenType *encoded_vltype = new VarLenType;
encoded_vltype->p_setId(encoded_vltype_id);
- return(encoded_vltype);
+ return (encoded_vltype);
}
//--------------------------------------------------------------------------
@@ -158,4 +155,4 @@ DataType* VarLenType::decode() const
//--------------------------------------------------------------------------
VarLenType::~VarLenType() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h
index ab3c14c..56c699b 100644
--- a/c++/src/H5VarLenType.h
+++ b/c++/src/H5VarLenType.h
@@ -23,36 +23,40 @@ namespace H5 {
*/
// Inheritance: DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP VarLenType : public DataType {
- public:
- // Constructor that creates a variable-length datatype based
- // on the specified base type.
- VarLenType(const DataType& base_type);
+ public:
+ // Constructor that creates a variable-length datatype based
+ // on the specified base type.
+ VarLenType(const DataType &base_type);
- // Deprecated - will be removed after 1.10.2
- VarLenType(const DataType* base_type);
+ // Deprecated - will be removed after 1.10.2
+ VarLenType(const DataType *base_type);
- // Returns an VarLenType object via DataType* by decoding the
- // binary object description of this type.
- virtual DataType* decode() const;
+ // Returns an VarLenType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType *decode() const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("VarLenType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("VarLenType");
+ }
- // Copy constructor: same as the original VarLenType.
- VarLenType(const VarLenType& original);
+ // Copy constructor: same as the original VarLenType.
+ VarLenType(const VarLenType &original);
- // Constructor that takes an existing id
- VarLenType(const hid_t existing_id);
+ // Constructor that takes an existing id
+ VarLenType(const hid_t existing_id);
- // Constructors that open a variable-length datatype, given a location.
- VarLenType(const H5Location& loc, const char* name);
- VarLenType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open a variable-length datatype, given a location.
+ VarLenType(const H5Location &loc, const char *name);
+ VarLenType(const H5Location &loc, const H5std_string &name);
- // Noop destructor
- virtual ~VarLenType();
+ // Noop destructor
+ virtual ~VarLenType();
- // Default constructor
- VarLenType();
+ // Default constructor
+ VarLenType();
}; // end of VarLenType
} // namespace H5
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 76e4424..0116d6c 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -32,29 +32,28 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
-const H5std_string FILE1("dataset.h5");
-const H5std_string DSET_DEFAULT_NAME("default");
-const H5std_string DSET_DEFAULT_NAME_PATH("/default");
-const H5std_string DSET_CHUNKED_NAME("chunked");
-const H5std_string DSET_SIMPLE_IO_NAME("simple_io");
-const H5std_string DSET_TCONV_NAME("tconv");
-const H5std_string DSET_COMPRESS_NAME("compressed");
-const H5std_string DSET_BOGUS_NAME("bogus");
+const H5std_string FILE1("dataset.h5");
+const H5std_string DSET_DEFAULT_NAME("default");
+const H5std_string DSET_DEFAULT_NAME_PATH("/default");
+const H5std_string DSET_CHUNKED_NAME("chunked");
+const H5std_string DSET_SIMPLE_IO_NAME("simple_io");
+const H5std_string DSET_TCONV_NAME("tconv");
+const H5std_string DSET_COMPRESS_NAME("compressed");
+const H5std_string DSET_BOGUS_NAME("bogus");
/* Temporary filter IDs used for testing */
const int H5Z_FILTER_BOGUS = 305;
-static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf);
// H5_ATTR_UNUSED variables caused warning, but taking them out caused failure.
-
/*-------------------------------------------------------------------------
* Function: test_create
*
@@ -68,7 +67,8 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
* Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
-static herr_t test_create( H5File& file)
+static herr_t
+test_create(H5File &file)
{
SUBTEST("Create, open, close");
@@ -76,19 +76,17 @@ static herr_t test_create( H5File& file)
DataSet *dataset = NULL;
try {
// Create a data space
- hsize_t dims[2];
+ hsize_t dims[2];
dims[0] = 256;
dims[1] = 512;
- DataSpace space (2, dims, NULL);
+ DataSpace space(2, dims, NULL);
// Create a dataset using the default dataset creation properties.
// We're not sure what they are, so we won't check.
- dataset = new DataSet (file.createDataSet
- (DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
-
+ dataset = new DataSet(file.createDataSet(DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
// Add a comment to the dataset
- file.setComment (DSET_DEFAULT_NAME, "This is a dataset");
+ file.setComment(DSET_DEFAULT_NAME, "This is a dataset");
// Close the dataset
delete dataset;
@@ -98,18 +96,19 @@ static herr_t test_create( H5File& file)
// dataset can only be created once. If an exception is not thrown for
// this action by createDataSet, then throw an invalid action exception.
try {
- dataset = new DataSet (file.createDataSet
- (DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
+ dataset = new DataSet(file.createDataSet(DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
// continuation here, that means no exception has been thrown
- throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset");
+ throw InvalidActionException("H5File::createDataSet",
+ "Library allowed overwrite of existing dataset");
}
- catch (FileIException& E) // catching invalid creating dataset
- {} // do nothing, exception expected
+ catch (FileIException &E) // catching invalid creating dataset
+ {
+ } // do nothing, exception expected
// Open the dataset we created above and then close it. This is one
// way to open an existing dataset for accessing.
- dataset = new DataSet (file.openDataSet (DSET_DEFAULT_NAME));
+ dataset = new DataSet(file.openDataSet(DSET_DEFAULT_NAME));
// Get and verify the name of this dataset, using
// H5std_string getObjName()
@@ -125,30 +124,31 @@ static herr_t test_create( H5File& file)
delete dataset;
// This is another way to open an existing dataset for accessing.
- DataSet another_dataset(file.openDataSet (DSET_DEFAULT_NAME));
+ DataSet another_dataset(file.openDataSet(DSET_DEFAULT_NAME));
// Try opening a non-existent dataset. This should fail so if an
// exception is not thrown for this action by openDataSet, then
// display failure information and throw an exception.
try {
- dataset = new DataSet (file.openDataSet( "does_not_exist" ));
+ dataset = new DataSet(file.openDataSet("does_not_exist"));
// continuation here, that means no exception has been thrown
throw InvalidActionException("H5File::openDataSet", "Attempted to open a non-existent dataset");
}
- catch (FileIException& E ) // catching creating non-existent dataset
- {} // do nothing, exception expected
+ catch (FileIException &E) // catching creating non-existent dataset
+ {
+ } // do nothing, exception expected
// Create a new dataset that uses chunked storage instead of the default
// layout.
DSetCreatPropList create_parms;
- hsize_t csize[2];
+ hsize_t csize[2];
csize[0] = 5;
csize[1] = 100;
- create_parms.setChunk( 2, csize );
+ create_parms.setChunk(2, csize);
- dataset = new DataSet (file.createDataSet(DSET_CHUNKED_NAME,
- PredType::NATIVE_DOUBLE, space, create_parms));
+ dataset =
+ new DataSet(file.createDataSet(DSET_CHUNKED_NAME, PredType::NATIVE_DOUBLE, space, create_parms));
// Note: this one has no error message in C when failure occurs?
// clean up and return with success
@@ -156,10 +156,9 @@ static herr_t test_create( H5File& file)
PASSED();
return 0;
- } // outer most try block
+ } // outer most try block
- catch (InvalidActionException& E)
- {
+ catch (InvalidActionException &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
@@ -169,8 +168,7 @@ static herr_t test_create( H5File& file)
return -1;
}
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_create", __LINE__, __FILE__);
// clean up and return with failure
@@ -178,9 +176,8 @@ static herr_t test_create( H5File& file)
delete dataset;
return -1;
}
-} // test_create
+} // test_create
-
/*-------------------------------------------------------------------------
* Function: test_simple_io
*
@@ -196,75 +193,72 @@ static herr_t test_create( H5File& file)
* Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
-static herr_t test_simple_io( H5File& file)
+static herr_t
+test_simple_io(H5File &file)
{
SUBTEST("Simple I/O");
- int points[100][200];
- int check[100][200];
+ int points[100][200];
+ int check[100][200];
int i, j, n;
// Initialize the dataset
- for (i = n = 0; i < 100; i++)
- {
+ for (i = n = 0; i < 100; i++) {
for (j = 0; j < 200; j++) {
points[i][j] = n++;
}
}
- char* tconv_buf = new char [1000];
- try
- {
+ char *tconv_buf = new char[1000];
+ try {
// Create the data space
hsize_t dims[2];
dims[0] = 100;
dims[1] = 200;
- DataSpace space (2, dims, NULL);
+ DataSpace space(2, dims, NULL);
// Create a small conversion buffer to test strip mining
DSetMemXferPropList xfer;
- xfer.setBuffer (1000, tconv_buf, NULL);
+ xfer.setBuffer(1000, tconv_buf, NULL);
// Create the dataset
- DataSet dataset (file.createDataSet (DSET_SIMPLE_IO_NAME, PredType::NATIVE_INT, space));
+ DataSet dataset(file.createDataSet(DSET_SIMPLE_IO_NAME, PredType::NATIVE_INT, space));
// Write the data to the dataset
- dataset.write(static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset.write(static_cast<void *>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL,
+ xfer);
// Read the dataset back
- dataset.read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset.read(static_cast<void *>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
// Check that the values read are the same as the values written
for (i = 0; i < 100; i++)
- for (j = 0; j < 200; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
+ for (j = 0; j < 200; j++) {
+ int status = check_values(i, j, points[i][j], check[i][j]);
if (status == -1)
throw Exception("DataSet::read");
}
// clean up and return with success
- delete [] tconv_buf;
+ delete[] tconv_buf;
PASSED();
return 0;
- } // end try
+ } // end try
// catch all dataset, space, plist exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
// clean up and return with failure
if (tconv_buf)
- delete [] tconv_buf;
+ delete[] tconv_buf;
return -1;
}
-} // test_simple_io
+} // test_simple_io
-
/*-------------------------------------------------------------------------
* Function: test_datasize
*
@@ -278,25 +272,24 @@ static herr_t test_simple_io( H5File& file)
* Thursday, March 22, 2012
*-------------------------------------------------------------------------
*/
-static herr_t test_datasize(FileAccPropList &fapl)
+static herr_t
+test_datasize(FileAccPropList &fapl)
{
SUBTEST("DataSet::getInMemDataSize()");
- try
- {
+ try {
// Open FILE1.
H5File file(FILE1, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl);
// Open dataset DSET_SIMPLE_IO_NAME.
- DataSet dset = file.openDataSet (DSET_SIMPLE_IO_NAME);
+ DataSet dset = file.openDataSet(DSET_SIMPLE_IO_NAME);
// Get the dataset's dataspace to calculate the size for verification.
DataSpace space(dset.getSpace());
// Get the dimension sizes.
hsize_t dims[2];
- int n_dims = space.getSimpleExtentDims(dims);
- if (n_dims < 0)
- {
+ int n_dims = space.getSimpleExtentDims(dims);
+ if (n_dims < 0) {
throw Exception("test_compression", "DataSpace::getSimpleExtentDims() failed");
}
@@ -308,8 +301,7 @@ static herr_t test_datasize(FileAccPropList &fapl)
size_t ds_size = dset.getInMemDataSize();
// Verify the data size.
- if (ds_size != expected_size)
- {
+ if (ds_size != expected_size) {
H5_FAILED();
cerr << " Expected data size = " << expected_size;
cerr << " but dset.getInMemDataSize() returned " << ds_size << endl;
@@ -318,19 +310,17 @@ static herr_t test_datasize(FileAccPropList &fapl)
PASSED();
return 0;
- } // end try
+ } // end try
// catch all dataset, space, plist exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
return -1;
}
-} // test_datasize
+} // test_datasize
-
/*-------------------------------------------------------------------------
* Function: test_tconv
*
@@ -344,84 +334,79 @@ static herr_t test_datasize(FileAccPropList &fapl)
* Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
-static herr_t test_tconv(H5File& file)
+static herr_t
+test_tconv(H5File &file)
{
// Prepare buffers for input/output
- char *out=NULL, *in=NULL;
- out = new char [4*1000000];
+ char *out = NULL, *in = NULL;
+ out = new char[4 * 1000000];
// assert (out); - should use exception handler for new - BMR
- in = new char [4*1000000];
- //assert (in);
+ in = new char[4 * 1000000];
+ // assert (in);
SUBTEST("Data type conversion");
// Initialize the dataset
for (int i = 0; i < 1000000; i++) {
- out[i*4+0] = 0x11;
- out[i*4+1] = 0x22;
- out[i*4+2] = 0x33;
- out[i*4+3] = 0x44;
+ out[i * 4 + 0] = 0x11;
+ out[i * 4 + 1] = 0x22;
+ out[i * 4 + 2] = 0x33;
+ out[i * 4 + 3] = 0x44;
}
- try
- {
+ try {
// Create the data space
hsize_t dims[1];
dims[0] = 1000000;
- DataSpace space (1, dims, NULL);
+ DataSpace space(1, dims, NULL);
// Create the data set
- DataSet dataset (file.createDataSet (DSET_TCONV_NAME, PredType::STD_I32LE, space));
+ DataSet dataset(file.createDataSet(DSET_TCONV_NAME, PredType::STD_I32LE, space));
// Write the data to the dataset
- dataset.write (static_cast<void*>(out), PredType::STD_I32LE);
+ dataset.write(static_cast<void *>(out), PredType::STD_I32LE);
// Read data with byte order conversion
- dataset.read (static_cast<void*>(in), PredType::STD_I32BE);
+ dataset.read(static_cast<void *>(in), PredType::STD_I32BE);
// Check
for (int i = 0; i < 1000000; i++) {
- if (in[4*i+0]!=out[4*i+3] ||
- in[4*i+1]!=out[4*i+2] ||
- in[4*i+2]!=out[4*i+1] ||
- in[4*i+3]!=out[4*i+0])
- {
+ if (in[4 * i + 0] != out[4 * i + 3] || in[4 * i + 1] != out[4 * i + 2] ||
+ in[4 * i + 2] != out[4 * i + 1] || in[4 * i + 3] != out[4 * i + 0]) {
throw Exception("DataSet::read", "Read with byte order conversion failed");
}
}
// clean up and return with success
- delete [] out;
- delete [] in;
+ delete[] out;
+ delete[] in;
PASSED();
return 0;
- } // end try
+ } // end try
// catch all dataset and space exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
// clean up and return with failure
- delete [] out;
- delete [] in;
+ delete[] out;
+ delete[] in;
return -1;
}
-} // test_tconv
+} // test_tconv
/* This message derives from H5Z */
const H5Z_class2_t H5Z_BOGUS[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version number */
- H5Z_FILTER_BOGUS, /* Filter id number */
- 1, 1, /* Encode and decode enabled */
- "bogus", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)filter_bogus, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version number */
+ H5Z_FILTER_BOGUS, /* Filter id number */
+ 1, 1, /* Encode and decode enabled */
+ "bogus", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)filter_bogus, /* The actual filter function */
}};
-
/*-------------------------------------------------------------------------
* Function: bogus
*
@@ -435,15 +420,14 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{
* Tuesday, April 21, 1998
*-------------------------------------------------------------------------
*/
-static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
- const unsigned int cd_values[], size_t nbytes,
- size_t *buf_size, void **buf)
+static size_t
+filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], size_t nbytes,
+ size_t *buf_size, void **buf)
// H5_ATTR_UNUSED variables caused warning, but taking them out caused failure.
{
return nbytes;
}
-
/*-------------------------------------------------------------------------
* Function: test_compression
*
@@ -460,28 +444,27 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
* Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
-static herr_t test_compression(H5File& file)
+static herr_t
+test_compression(H5File &file)
{
#ifndef H5_HAVE_FILTER_DEFLATE
const char *not_supported;
not_supported = " Deflate compression is not enabled.";
#endif /* H5_HAVE_FILTER_DEFLATE */
- int points[100][200];
- int check[100][200];
- hsize_t i, j, n;
+ int points[100][200];
+ int check[100][200];
+ hsize_t i, j, n;
// Initialize the dataset
- for (i = n = 0; i < 100; i++)
- {
+ for (i = n = 0; i < 100; i++) {
for (j = 0; j < 200; j++) {
points[i][j] = static_cast<int>(n++);
}
}
- char* tconv_buf = new char [1000];
- DataSet* dataset = NULL;
- try
- {
+ char * tconv_buf = new char[1000];
+ DataSet *dataset = NULL;
+ try {
const hsize_t size[2] = {100, 200};
// Create the data space
DataSpace space1(2, size, NULL);
@@ -489,39 +472,39 @@ static herr_t test_compression(H5File& file)
// Create a small conversion buffer to test strip mining
DSetMemXferPropList xfer;
- xfer.setBuffer (1000, tconv_buf, NULL);
+ xfer.setBuffer(1000, tconv_buf, NULL);
// Use chunked storage with compression
DSetCreatPropList dscreatplist;
const hsize_t chunk_size[2] = {2, 25};
- dscreatplist.setChunk (2, chunk_size);
- dscreatplist.setDeflate (6);
+ dscreatplist.setChunk(2, chunk_size);
+ dscreatplist.setDeflate(6);
#ifdef H5_HAVE_FILTER_DEFLATE
SUBTEST("Compression (setup)");
// Create the dataset
- dataset = new DataSet (file.createDataSet
- (DSET_COMPRESS_NAME, PredType::NATIVE_INT, space1, dscreatplist));
+ dataset =
+ new DataSet(file.createDataSet(DSET_COMPRESS_NAME, PredType::NATIVE_INT, space1, dscreatplist));
PASSED();
/*----------------------------------------------------------------------
- * STEP 1: Read uninitialized data. It should be zero.
- *----------------------------------------------------------------------
- */
+ * STEP 1: Read uninitialized data. It should be zero.
+ *----------------------------------------------------------------------
+ */
SUBTEST("Compression (uninitialized read)");
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset->read(static_cast<void *>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
- for (i=0; i<size[0]; i++) {
- for (j=0; j<size[1]; j++) {
- if (0!=check[i][j]) {
+ for (i = 0; i < size[0]; i++) {
+ for (j = 0; j < size[1]; j++) {
+ if (0 != check[i][j]) {
H5_FAILED();
cerr << " Read a non-zero value." << endl;
- cerr << " At index " << static_cast<unsigned long>(i)
- << "," << static_cast<unsigned long>(j) << endl;
+ cerr << " At index " << static_cast<unsigned long>(i) << ","
+ << static_cast<unsigned long>(j) << endl;
throw Exception("test_compression", "Failed in uninitialized read");
}
}
@@ -529,38 +512,36 @@ static herr_t test_compression(H5File& file)
PASSED();
/*----------------------------------------------------------------------
- * STEP 2: Test compression by setting up a chunked dataset and writing
- * to it.
- *----------------------------------------------------------------------
- */
+ * STEP 2: Test compression by setting up a chunked dataset and writing
+ * to it.
+ *----------------------------------------------------------------------
+ */
SUBTEST("Compression (write)");
- for (i=n=0; i<size[0]; i++)
- {
- for (j=0; j<size[1]; j++)
- {
+ for (i = n = 0; i < size[0]; i++) {
+ for (j = 0; j < size[1]; j++) {
points[i][j] = static_cast<int>(n++);
}
}
- dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset->write(static_cast<void *>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL,
+ xfer);
PASSED();
/*----------------------------------------------------------------------
- * STEP 3: Try to read the data we just wrote.
- *----------------------------------------------------------------------
- */
+ * STEP 3: Try to read the data we just wrote.
+ *----------------------------------------------------------------------
+ */
SUBTEST("Compression (read)");
// Read the dataset back
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset->read(static_cast<void *>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
// Check that the values read are the same as the values written
for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
+ for (j = 0; j < size[1]; j++) {
+ int status = check_values(i, j, points[i][j], check[i][j]);
if (status == -1)
throw Exception("test_compression", "Failed in read");
}
@@ -568,31 +549,29 @@ static herr_t test_compression(H5File& file)
PASSED();
/*----------------------------------------------------------------------
- * STEP 4: Write new data over the top of the old data. The new data is
- * random thus not very compressible, and will cause the chunks to move
- * around as they grow. We only change values for the left half of the
- * dataset although we rewrite the whole thing.
- *----------------------------------------------------------------------
- */
+ * STEP 4: Write new data over the top of the old data. The new data is
+ * random thus not very compressible, and will cause the chunks to move
+ * around as they grow. We only change values for the left half of the
+ * dataset although we rewrite the whole thing.
+ *----------------------------------------------------------------------
+ */
SUBTEST("Compression (modify)");
- for (i=0; i<size[0]; i++)
- {
- for (j=0; j<size[1]/2; j++)
- {
- points[i][j] = rand ();
+ for (i = 0; i < size[0]; i++) {
+ for (j = 0; j < size[1] / 2; j++) {
+ points[i][j] = rand();
}
}
- dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset->write(static_cast<void *>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL,
+ xfer);
// Read the dataset back and check it
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset->read(static_cast<void *>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
// Check that the values read are the same as the values written
for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
+ for (j = 0; j < size[1]; j++) {
+ int status = check_values(i, j, points[i][j], check[i][j]);
if (status == -1)
throw Exception("test_compression", "Failed in modify");
}
@@ -600,66 +579,65 @@ static herr_t test_compression(H5File& file)
PASSED();
/*----------------------------------------------------------------------
- * STEP 5: Close the dataset and then open it and read it again. This
- * insures that the compression message is picked up properly from the
- * object header.
- *----------------------------------------------------------------------
- */
+ * STEP 5: Close the dataset and then open it and read it again. This
+ * insures that the compression message is picked up properly from the
+ * object header.
+ *----------------------------------------------------------------------
+ */
SUBTEST("Compression (re-open)");
// close this dataset to reuse the var
delete dataset;
- dataset = new DataSet (file.openDataSet (DSET_COMPRESS_NAME));
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset = new DataSet(file.openDataSet(DSET_COMPRESS_NAME));
+ dataset->read(static_cast<void *>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
// Check that the values read are the same as the values written
for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
+ for (j = 0; j < size[1]; j++) {
+ int status = check_values(i, j, points[i][j], check[i][j]);
if (status == -1)
throw Exception("test_compression", "Failed in re-open");
}
PASSED();
-
/*----------------------------------------------------------------------
- * STEP 6: Test partial I/O by writing to and then reading from a
- * hyperslab of the dataset. The hyperslab does not line up on chunk
- * boundaries (we know that case already works from above tests).
- *----------------------------------------------------------------------
- */
+ * STEP 6: Test partial I/O by writing to and then reading from a
+ * hyperslab of the dataset. The hyperslab does not line up on chunk
+ * boundaries (we know that case already works from above tests).
+ *----------------------------------------------------------------------
+ */
SUBTEST("Compression (partial I/O)");
- const hsize_t hs_size[2] = {4, 50};
+ const hsize_t hs_size[2] = {4, 50};
const hsize_t hs_offset[2] = {7, 30};
for (i = 0; i < hs_size[0]; i++) {
for (j = 0; j < hs_size[1]; j++) {
- points[hs_offset[0]+i][hs_offset[1]+j] = rand ();
+ points[hs_offset[0] + i][hs_offset[1] + j] = rand();
}
}
- space1.selectHyperslab( H5S_SELECT_SET, hs_size, hs_offset );
- dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, space1, space1, xfer);
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, space1, space1, xfer);
+ space1.selectHyperslab(H5S_SELECT_SET, hs_size, hs_offset);
+ dataset->write(static_cast<void *>(points), PredType::NATIVE_INT, space1, space1, xfer);
+ dataset->read(static_cast<void *>(check), PredType::NATIVE_INT, space1, space1, xfer);
// Check that the values read are the same as the values written
- for (i=0; i<hs_size[0]; i++) {
- for (j=0; j<hs_size[1]; j++) {
- if (points[hs_offset[0]+i][hs_offset[1]+j] !=
- check[hs_offset[0]+i][hs_offset[1]+j]) {
- H5_FAILED();
- cerr << " Read different values than written.\n" << endl;
- cerr << " At index " << static_cast<unsigned long>((hs_offset[0]+i)) <<
- "," << static_cast<unsigned long>((hs_offset[1]+j)) << endl;
-
- cerr << " At original: " << static_cast<int>(points[hs_offset[0]+i][hs_offset[1]+j]) << endl;
- cerr << " At returned: " << static_cast<int>(check[hs_offset[0]+i][hs_offset[1]+j]) << endl;
- throw Exception("test_compression", "Failed in partial I/O");
- }
- } // for j
- } // for i
+ for (i = 0; i < hs_size[0]; i++) {
+ for (j = 0; j < hs_size[1]; j++) {
+ if (points[hs_offset[0] + i][hs_offset[1] + j] != check[hs_offset[0] + i][hs_offset[1] + j]) {
+ H5_FAILED();
+ cerr << " Read different values than written.\n" << endl;
+ cerr << " At index " << static_cast<unsigned long>((hs_offset[0] + i)) << ","
+ << static_cast<unsigned long>((hs_offset[1] + j)) << endl;
+
+ cerr << " At original: "
+ << static_cast<int>(points[hs_offset[0] + i][hs_offset[1] + j]) << endl;
+ cerr << " At returned: " << static_cast<int>(check[hs_offset[0] + i][hs_offset[1] + j])
+ << endl;
+ throw Exception("test_compression", "Failed in partial I/O");
+ }
+ } // for j
+ } // for i
delete dataset;
dataset = NULL;
@@ -673,29 +651,30 @@ static herr_t test_compression(H5File& file)
#endif
/*----------------------------------------------------------------------
- * STEP 7: Register an application-defined compression method and use it
- * to write and then read the dataset.
- *----------------------------------------------------------------------
- */
+ * STEP 7: Register an application-defined compression method and use it
+ * to write and then read the dataset.
+ *----------------------------------------------------------------------
+ */
SUBTEST("Compression (app-defined method)");
- if (H5Zregister (H5Z_BOGUS)<0)
- throw Exception("test_compression", "Failed in app-defined method");
- if (H5Pset_filter (dscreatplist.getId(), H5Z_FILTER_BOGUS, 0, 0, NULL)<0)
+ if (H5Zregister(H5Z_BOGUS) < 0)
+ throw Exception("test_compression", "Failed in app-defined method");
+ if (H5Pset_filter(dscreatplist.getId(), H5Z_FILTER_BOGUS, 0, 0, NULL) < 0)
throw Exception("test_compression", "Failed in app-defined method");
- dscreatplist.setFilter (H5Z_FILTER_BOGUS, 0, 0, NULL);
+ dscreatplist.setFilter(H5Z_FILTER_BOGUS, 0, 0, NULL);
- DataSpace space2 (2, size, NULL);
- dataset = new DataSet (file.createDataSet (DSET_BOGUS_NAME, PredType::NATIVE_INT, space2, dscreatplist));
+ DataSpace space2(2, size, NULL);
+ dataset =
+ new DataSet(file.createDataSet(DSET_BOGUS_NAME, PredType::NATIVE_INT, space2, dscreatplist));
- dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset->write(static_cast<void *>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL,
+ xfer);
+ dataset->read(static_cast<void *>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
// Check that the values read are the same as the values written
for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
+ for (j = 0; j < size[1]; j++) {
+ int status = check_values(i, j, points[i][j], check[i][j]);
if (status == -1)
throw Exception("test_compression", "Failed in app-defined method");
}
@@ -703,17 +682,16 @@ static herr_t test_compression(H5File& file)
PASSED();
/*----------------------------------------------------------------------
- * Cleanup
- *----------------------------------------------------------------------
- */
+ * Cleanup
+ *----------------------------------------------------------------------
+ */
delete dataset;
- delete [] tconv_buf;
+ delete[] tconv_buf;
return 0;
} // end try
// catch all dataset, file, space, and plist exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
@@ -721,12 +699,11 @@ static herr_t test_compression(H5File& file)
if (dataset != NULL)
delete dataset;
if (tconv_buf)
- delete [] tconv_buf;
+ delete[] tconv_buf;
return -1;
}
-} // test_compression
+} // test_compression
-
/*-------------------------------------------------------------------------
* Function: test_nbit_methods
*
@@ -742,18 +719,19 @@ static herr_t test_compression(H5File& file)
*-------------------------------------------------------------------------
*/
const H5std_string DSET_NBIT_NAME("nbit_dataset");
-const hsize_t DIM1 = 2;
-const hsize_t DIM2 = 5;
+const hsize_t DIM1 = 2;
+const hsize_t DIM2 = 5;
-static herr_t test_nbit_compression(H5File& file)
+static herr_t
+test_nbit_compression(H5File &file)
{
typedef struct {
- int i;
- char c;
+ int i;
+ char c;
short s;
} s1_t;
- const hsize_t size[2] = {DIM1, DIM2};
+ const hsize_t size[2] = {DIM1, DIM2};
const hsize_t chunk_size[2] = {DIM1, DIM2};
s1_t orig_data[DIM1][DIM2];
s1_t new_data[DIM1][DIM2];
@@ -761,8 +739,7 @@ static herr_t test_nbit_compression(H5File& file)
SUBTEST("N-bit compression (setup)");
- try
- {
+ try {
// Define datatypes of members of compound datatype
IntType i_type(PredType::NATIVE_INT);
IntType c_type(PredType::NATIVE_CHAR);
@@ -781,7 +758,7 @@ static herr_t test_nbit_compression(H5File& file)
mem_cmpd.insertMember("s", HOFFSET(s1_t, s), s_type);
// Set order of dataset compound datatype
- //cmpd.setOrder(H5T_ORDER_BE); only for atomic type?
+ // cmpd.setOrder(H5T_ORDER_BE); only for atomic type?
// Create the data space
DataSpace space(2, size);
@@ -796,36 +773,33 @@ static herr_t test_nbit_compression(H5File& file)
// Initialize data, assuming size of long long >= size of member datatypes
for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
+ for (j = 0; j < size[1]; j++) {
orig_data[i][j].i = static_cast<int>(i * j);
orig_data[i][j].c = static_cast<char>('a' + i);
orig_data[i][j].s = static_cast<short>(i + j);
// Some even-numbered integer values are negative
- if ((i*size[1]+j+1)%2 == 0) {
+ if ((i * size[1] + j + 1) % 2 == 0) {
orig_data[i][j].i = -orig_data[i][j].i;
orig_data[i][j].s = static_cast<short>(-orig_data[i][j].s);
}
}
// Write to the dataset
- dataset.write(static_cast<void*>(orig_data), mem_cmpd);
+ dataset.write(static_cast<void *>(orig_data), mem_cmpd);
// Read the dataset back */
- dataset.read(static_cast<void*>(new_data), mem_cmpd);
+ dataset.read(static_cast<void *>(new_data), mem_cmpd);
// Check that the values read are the same as the values written.
for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- if((new_data[i][j].i != orig_data[i][j].i) ||
- (new_data[i][j].c != orig_data[i][j].c) ||
- (new_data[i][j].s != orig_data[i][j].s))
- {
+ for (j = 0; j < size[1]; j++) {
+ if ((new_data[i][j].i != orig_data[i][j].i) || (new_data[i][j].c != orig_data[i][j].c) ||
+ (new_data[i][j].s != orig_data[i][j].s)) {
H5_FAILED();
printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", static_cast<unsigned long>(i), static_cast<unsigned long>(j));
+ printf(" At index %lu,%lu\n", static_cast<unsigned long>(i),
+ static_cast<unsigned long>(j));
}
}
@@ -834,8 +808,7 @@ static herr_t test_nbit_compression(H5File& file)
} // end try block
// catch all dataset, file, space, and plist exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
@@ -843,7 +816,6 @@ static herr_t test_nbit_compression(H5File& file)
}
} // test_nbit_compression
-
/*-------------------------------------------------------------------------
* Function: test_multiopen
*
@@ -860,12 +832,13 @@ static herr_t test_nbit_compression(H5File& file)
* Saturday, February 17, 2001
*-------------------------------------------------------------------------
*/
-static herr_t test_multiopen (H5File& file)
+static herr_t
+test_multiopen(H5File &file)
{
SUBTEST("Multi-open with extending");
- DataSpace* space = NULL;
+ DataSpace *space = NULL;
try {
// Create a dataset creation property list
@@ -873,17 +846,17 @@ static herr_t test_multiopen (H5File& file)
// Set chunk size to given size
hsize_t cur_size[1] = {10};
- dcpl.setChunk (1, cur_size);
+ dcpl.setChunk(1, cur_size);
// Create a simple data space with unlimited size
hsize_t max_size[1] = {H5S_UNLIMITED};
- space = new DataSpace (1, cur_size, max_size);
+ space = new DataSpace(1, cur_size, max_size);
// Create first dataset
- DataSet dset1 = file.createDataSet ("multiopen", PredType::NATIVE_INT, *space, dcpl);
+ DataSet dset1 = file.createDataSet("multiopen", PredType::NATIVE_INT, *space, dcpl);
// Open again the first dataset from the file to another DataSet object.
- DataSet dset2 = file.openDataSet ("multiopen");
+ DataSet dset2 = file.openDataSet("multiopen");
// Relieve the dataspace
delete space;
@@ -891,18 +864,16 @@ static herr_t test_multiopen (H5File& file)
// Extend the dimensionality of the first dataset
cur_size[0] = 20;
- dset1.extend (cur_size);
+ dset1.extend(cur_size);
// Get the size from the second handle
- space = new DataSpace (dset2.getSpace());
+ space = new DataSpace(dset2.getSpace());
hsize_t tmp_size[1];
- space->getSimpleExtentDims (tmp_size);
- if (cur_size[0]!=tmp_size[0])
- {
- cerr << " Got " << static_cast<int>(tmp_size[0])
- << " instead of " << static_cast<int>(cur_size[0])
- << "!" << endl;
+ space->getSimpleExtentDims(tmp_size);
+ if (cur_size[0] != tmp_size[0]) {
+ cerr << " Got " << static_cast<int>(tmp_size[0]) << " instead of "
+ << static_cast<int>(cur_size[0]) << "!" << endl;
throw Exception("test_multiopen", "Failed in multi-open with extending");
}
@@ -913,8 +884,7 @@ static herr_t test_multiopen (H5File& file)
} // end try block
// catch all dataset, file, space, and plist exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
@@ -923,9 +893,8 @@ static herr_t test_multiopen (H5File& file)
delete space;
return -1;
}
-} // test_multiopen
+} // test_multiopen
-
/*-------------------------------------------------------------------------
* Function: test_types
*
@@ -939,24 +908,25 @@ static herr_t test_multiopen (H5File& file)
* February 17, 2001
*-------------------------------------------------------------------------
*/
-static herr_t test_types(H5File& file)
+static herr_t
+test_types(H5File &file)
{
SUBTEST("Various datatypes");
- size_t i;
- DataSet* dset = NULL;
+ size_t i;
+ DataSet *dset = NULL;
try {
// Create a group in the file that was passed in from the caller
- Group grp = file.createGroup ("typetests");
+ Group grp = file.createGroup("typetests");
/* bitfield_1 */
unsigned char buf[32];
- hsize_t nelmts = sizeof(buf);
- DataType type;
+ hsize_t nelmts = sizeof(buf);
+ DataType type;
try { // block of bitfield_1
// test copying a predefined type
- type.copy (PredType::STD_B8LE);
+ type.copy(PredType::STD_B8LE);
// Test copying a user-defined type using DataType::copy
DataType copied_type;
@@ -967,7 +937,7 @@ static herr_t test_types(H5File& file)
another_copied_type = type;
// Test copying a user-defined int type using DataType::operator=
- IntType orig_int(PredType::STD_B8LE);
+ IntType orig_int(PredType::STD_B8LE);
DataType generic_type;
generic_type = orig_int;
@@ -978,45 +948,45 @@ static herr_t test_types(H5File& file)
IntType another_int_type;
another_int_type = new_int_type;
- DataSpace space (1, &nelmts);
+ DataSpace space(1, &nelmts);
dset = new DataSet(grp.createDataSet("bitfield_1", type, space));
// Fill buffer
- for (i=0; i<sizeof buf; i++)
- buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
+ for (i = 0; i < sizeof buf; i++)
+ buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
// Write data from buf using all default dataspaces and property list
- dset->write (buf, type);
+ dset->write(buf, type);
// no failure in bitfield_1, close this dataset
delete dset;
} // end try block of bitfield_1
// catch exceptions thrown in try block of bitfield_1
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
- cerr << " <<< " << "bitfield_1: " << E.getFuncName()
- << " - " << E.getDetailMsg() << " >>>" << endl << endl;
+ cerr << " <<< "
+ << "bitfield_1: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl
+ << endl;
if (dset != NULL)
delete dset;
return -1;
}
/* bitfield_2 */
- nelmts = sizeof(buf)/2;
+ nelmts = sizeof(buf) / 2;
try { // bitfield_2 block
- type.copy (PredType::STD_B16LE);
- DataSpace space (1, &nelmts);
+ type.copy(PredType::STD_B16LE);
+ DataSpace space(1, &nelmts);
dset = new DataSet(grp.createDataSet("bitfield_2", type, space));
// Fill buffer
- for (i=0; i<sizeof(buf); i++)
+ for (i = 0; i < sizeof(buf); i++)
buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
// Write data from buf using all default dataspaces and property
// list; if writing fails, deallocate dset and return.
- dset->write (buf, type);
+ dset->write(buf, type);
// no failure in bitfield_2, close this dataset and reset for
// variable reuse
@@ -1025,44 +995,46 @@ static herr_t test_types(H5File& file)
} // end try block of bitfield_2
// catch exceptions thrown in try block of bitfield_2
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
- cerr << " <<< " << "bitfield_2: " << E.getFuncName()
- << " - " << E.getDetailMsg() << " >>>" << endl << endl;
+ cerr << " <<< "
+ << "bitfield_2: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl
+ << endl;
if (dset != NULL)
delete dset;
throw E; // propagate the exception
}
/* opaque_1 */
- DataType* optype = NULL;
+ DataType *optype = NULL;
try { // opaque_1 block
optype = new DataType(H5T_OPAQUE, 1);
nelmts = sizeof(buf);
- DataSpace space (1, &nelmts);
- optype->setTag ("testing 1-byte opaque type");
+ DataSpace space(1, &nelmts);
+ optype->setTag("testing 1-byte opaque type");
dset = new DataSet(grp.createDataSet("opaque_1", *optype, space));
// Fill buffer
- for (i=0; i<sizeof buf; i++)
+ for (i = 0; i < sizeof buf; i++)
buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
// Write data from buf using all default dataspaces and property
// list; if writing fails, deallocate dset and return.
- dset->write (buf, *optype);
+ dset->write(buf, *optype);
// no failure in opaque_1
- delete dset; dset = NULL;
- delete optype; optype = NULL;
+ delete dset;
+ dset = NULL;
+ delete optype;
+ optype = NULL;
} // end try block of opaque_1
// catch exceptions thrown in try block of opaque_1
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
- cerr << " <<< " << "opaque_1: " << E.getFuncName()
- << " - " << E.getDetailMsg() << " >>>" << endl << endl;
+ cerr << " <<< "
+ << "opaque_1: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl
+ << endl;
if (dset != NULL)
delete dset;
if (optype != NULL)
@@ -1072,31 +1044,33 @@ static herr_t test_types(H5File& file)
/* opaque_2 */
try { // block opaque_2
- nelmts = sizeof(buf)/4;
- DataSpace space (1, &nelmts);
+ nelmts = sizeof(buf) / 4;
+ DataSpace space(1, &nelmts);
optype = new DataType(H5T_OPAQUE, 4);
- optype->setTag ("testing 4-byte opaque type");
+ optype->setTag("testing 4-byte opaque type");
dset = new DataSet(grp.createDataSet("opaque_2", *optype, space));
// Fill buffer
- for (i=0; i<sizeof(buf); i++)
+ for (i = 0; i < sizeof(buf); i++)
buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
// Write data from buf using all default dataspaces and property
// list; if writing fails, deallocate dset and return.
- dset->write (buf, *optype);
+ dset->write(buf, *optype);
// no failure in opaque_1
- delete dset; dset = NULL;
- delete optype; optype = NULL;
- } //end try block of opaque_2
+ delete dset;
+ dset = NULL;
+ delete optype;
+ optype = NULL;
+ } // end try block of opaque_2
// catch exceptions thrown in try block of opaque_2
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
- cerr << " <<< " << "opaque_2: " << E.getFuncName()
- << " - " << E.getDetailMsg() << " >>>" << endl << endl;
+ cerr << " <<< "
+ << "opaque_2: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl
+ << endl;
if (dset != NULL)
delete dset;
if (optype != NULL)
@@ -1108,13 +1082,11 @@ static herr_t test_types(H5File& file)
return 0;
} // end top try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
return -1;
}
-} // test_types
+} // test_types
-
/*-------------------------------------------------------------------------
* Function: test_getNativeObjinfo
*
@@ -1126,16 +1098,17 @@ static herr_t test_types(H5File& file)
* July, 2018
*-------------------------------------------------------------------------
*/
-static herr_t test_getnativeinfo(H5File& file)
+static herr_t
+test_getnativeinfo(H5File &file)
{
SUBTEST("Getting object information");
try {
// Create a data space
- hsize_t dims[2];
+ hsize_t dims[2];
dims[0] = 256;
dims[1] = 512;
- DataSpace space (2, dims, NULL);
+ DataSpace space(2, dims, NULL);
// Create a dataset using the default dataset creation properties.
// We're not sure what they are, so we won't check.
@@ -1158,23 +1131,20 @@ static herr_t test_getnativeinfo(H5File& file)
PASSED();
return 0;
- } // outer most try block
+ } // outer most try block
- catch (InvalidActionException& E)
- {
+ catch (InvalidActionException &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
return -1;
}
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_getnativeinfo", __LINE__, __FILE__);
return -1;
}
-} // test_getnativeinfo
+} // test_getnativeinfo
-
/*-------------------------------------------------------------------------
* Function: test_chunk_cache
*
@@ -1187,10 +1157,11 @@ static herr_t test_getnativeinfo(H5File& file)
* July 2018
*-------------------------------------------------------------------------
*/
-const int RANK1 = 1;
+const int RANK1 = 1;
const H5std_string FILE_ACCPLIST("test_accplist.h5");
-static herr_t test_chunk_cache(FileAccPropList fapl)
+static herr_t
+test_chunk_cache(FileAccPropList fapl)
{
SUBTEST("DSetAccPropList::set/getChunkCache");
@@ -1200,14 +1171,14 @@ static herr_t test_chunk_cache(FileAccPropList fapl)
DSetAccPropList dapl;
// Verify that chunk cache parameters are the same
- int mdc_nelmts = 0;
+ int mdc_nelmts = 0;
size_t nslots_1 = 0, nslots_4 = 0, nbytes_1 = 0, nbytes_4 = 0;
double w0_1 = 0.0F, w0_4 = 0.0F;
fapl_def.getCache(mdc_nelmts, nslots_1, nbytes_1, w0_1);
dapl.getChunkCache(nslots_4, nbytes_4, w0_4);
- verify_val(nslots_1, nslots_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
- verify_val(nbytes_1, nbytes_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
- verify_val(w0_1, w0_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
+ verify_val(nslots_1, nslots_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
+ verify_val(nbytes_1, nbytes_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
+ verify_val(w0_1, w0_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
// Set a link access property on dapl to verify property list inheritance
dapl.setNumLinks((size_t)134);
@@ -1220,7 +1191,7 @@ static herr_t test_chunk_cache(FileAccPropList fapl)
// Set new rdcc settings on fapl local
size_t nslots_2 = nslots_1 * 2;
size_t nbytes_2 = nbytes_1 * 2;
- double w0_2 = w0_1 / (double)2.0F;
+ double w0_2 = w0_1 / (double)2.0F;
fapl_local.getCache(mdc_nelmts, nslots_2, nbytes_2, w0_2);
// Create a new file using default fcpl and the passed-in fapl
@@ -1247,17 +1218,16 @@ static herr_t test_chunk_cache(FileAccPropList fapl)
// Retrieve and verify the raw data chunk cache parameters
nslots_4 = nbytes_4 = 0;
- w0_4 = 0.0F;
+ w0_4 = 0.0F;
dapl2.getChunkCache(nslots_4, nbytes_4, w0_4);
verify_val(nslots_2, nslots_4, "DSetCreatPropList::getChunkCache", __LINE__, __FILE__);
verify_val(nbytes_2, nbytes_4, "DSetCreatPropList::getChunkCache", __LINE__, __FILE__);
verify_val(H5_DBL_ABS_EQUAL(w0_2, w0_4), 1, "DSetCreatPropList::getChunkCache", __LINE__, __FILE__);
-
// Set new values on original dapl
size_t nslots_3 = nslots_1 * 2;
size_t nbytes_3 = H5D_CHUNK_CACHE_NBYTES_DEFAULT;
- double w0_3 = w0_2 / 2;
+ double w0_3 = w0_2 / 2;
dapl.getChunkCache(nslots_3, nbytes_3, w0_3);
// Close dataset
@@ -1275,18 +1245,15 @@ static herr_t test_chunk_cache(FileAccPropList fapl)
verify_val(nbytes_3, nbytes_4, "DSetCreatPropList::getLayout", __LINE__, __FILE__);
verify_val(H5_DBL_ABS_EQUAL(w0_3, w0_4), 1, "DSetCreatPropList::getLayout", __LINE__, __FILE__);
-
PASSED();
return 0;
} // end top try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
return -1;
}
} // test_chunk_cache
-
/*-------------------------------------------------------------------------
* Function: test_virtual
*
@@ -1303,7 +1270,8 @@ static herr_t test_chunk_cache(FileAccPropList fapl)
*/
const int RANK = 2;
-static herr_t test_virtual()
+static herr_t
+test_virtual()
{
SUBTEST("DSetCreatPropList::setVirtual");
@@ -1338,8 +1306,8 @@ static herr_t test_virtual()
dims[1] = 6;
DataSpace vspace(RANK, dims, mdims);
- hsize_t start[RANK]; // Hyperslab start
- hsize_t count[RANK]; // Hyperslab count
+ hsize_t start[RANK]; // Hyperslab start
+ hsize_t count[RANK]; // Hyperslab count
start[0] = start[1] = 3;
count[0] = count[1] = 3;
vspace.selectHyperslab(H5S_SELECT_SET, count, start);
@@ -1358,13 +1326,11 @@ static herr_t test_virtual()
return 0;
} // end top try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
return -1;
}
} // test_virtual
-
/*-------------------------------------------------------------------------
* Function: test_dset
*
@@ -1387,15 +1353,14 @@ static herr_t test_virtual()
*
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_dset()
+extern "C" void
+test_dset()
{
hid_t fapl_id;
- fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
- int nerrors=0; // keep track of number of failures occur
+ fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
+ int nerrors = 0; // keep track of number of failures occur
- try
- {
+ try {
// Use the file access template id to create a file access prop.
// list object to pass in H5File::H5File
FileAccPropList fapl(fapl_id);
@@ -1403,19 +1368,19 @@ void test_dset()
H5File file(FILE1, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
// Cause the library to emit initial messages
- Group grp = file.createGroup( "emit diagnostics", 0);
+ Group grp = file.createGroup("emit diagnostics", 0);
grp.setComment("Causes diagnostic messages to be emitted");
- nerrors += test_create(file) < 0 ? 1:0;
- nerrors += test_simple_io(file) < 0 ? 1:0;
- nerrors += test_getnativeinfo(file) < 0 ? 1:0;
- nerrors += test_tconv(file) < 0 ? 1:0;
- nerrors += test_compression(file) < 0 ? 1:0;
- nerrors += test_nbit_compression(file) < 0 ? 1:0;
- nerrors += test_multiopen (file) < 0 ? 1:0;
- nerrors += test_types(file) < 0 ? 1:0;
- nerrors += test_virtual() < 0 ? 1:0;
- nerrors += test_chunk_cache(fapl) < 0 ? 1:0;
+ nerrors += test_create(file) < 0 ? 1 : 0;
+ nerrors += test_simple_io(file) < 0 ? 1 : 0;
+ nerrors += test_getnativeinfo(file) < 0 ? 1 : 0;
+ nerrors += test_tconv(file) < 0 ? 1 : 0;
+ nerrors += test_compression(file) < 0 ? 1 : 0;
+ nerrors += test_nbit_compression(file) < 0 ? 1 : 0;
+ nerrors += test_multiopen(file) < 0 ? 1 : 0;
+ nerrors += test_types(file) < 0 ? 1 : 0;
+ nerrors += test_virtual() < 0 ? 1 : 0;
+ nerrors += test_chunk_cache(fapl) < 0 ? 1 : 0;
// Close group "emit diagnostics".
grp.close();
@@ -1423,18 +1388,16 @@ void test_dset()
// Close the file before testing data size.
file.close();
- nerrors += test_datasize(fapl) <0 ? 1:0;
+ nerrors += test_datasize(fapl) < 0 ? 1 : 0;
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
test_report(nerrors, H5std_string(" Dataset"));
}
// Clean up data file
cleanup_dsets();
-} // test_dset
+} // test_dset
-
/*-------------------------------------------------------------------------
* Function: cleanup_dsets
*
@@ -1445,9 +1408,8 @@ void test_dset()
* Programmer (use C version)
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_dsets()
+extern "C" void
+cleanup_dsets()
{
HDremove(FILE1.c_str());
} // cleanup_dsets
-
diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp
index f271eed..b93f136 100644
--- a/c++/test/h5cpputil.cpp
+++ b/c++/test/h5cpputil.cpp
@@ -28,11 +28,11 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
/*-------------------------------------------------------------------------
* Function: test_report
@@ -49,24 +49,21 @@ using namespace H5;
* Friday, February 6, 2001
*-------------------------------------------------------------------------
*/
-int test_report( int nerrors, const H5std_string& testname )
+int
+test_report(int nerrors, const H5std_string &testname)
{
- if (nerrors)
- {
- nerrors = MAX(1, nerrors);
+ if (nerrors) {
+ nerrors = MAX(1, nerrors);
if (1 == nerrors)
- cerr << "***** " << nerrors << testname
- << " TEST FAILED! *****" << endl;
+ cerr << "***** " << nerrors << testname << " TEST FAILED! *****" << endl;
else
- cerr << "***** " << nerrors << testname
- << " TESTS FAILED! *****" << endl;
- return 1;
- }
- else
- {
- cerr << "All" << testname << " tests passed." << endl;
- return 0;
- }
+ cerr << "***** " << nerrors << testname << " TESTS FAILED! *****" << endl;
+ return 1;
+ }
+ else {
+ cerr << "All" << testname << " tests passed." << endl;
+ return 0;
+ }
}
/*-------------------------------------------------------------------------
@@ -81,14 +78,14 @@ int test_report( int nerrors, const H5std_string& testname )
*
*-------------------------------------------------------------------------
*/
-void issue_fail_msg(const char* where, int line, const char* file_name,
- const char* message)
+void
+issue_fail_msg(const char *where, int line, const char *file_name, const char *message)
{
- if (GetTestVerbosity()>=VERBO_HI)
- {
+ if (GetTestVerbosity() >= VERBO_HI) {
cerr << endl;
- cerr << ">>> FAILED in " << where << " at line " << line
- << " in " << file_name << " - " << message << endl << endl;
+ cerr << ">>> FAILED in " << where << " at line " << line << " in " << file_name << " - " << message
+ << endl
+ << endl;
}
}
@@ -104,15 +101,15 @@ void issue_fail_msg(const char* where, int line, const char* file_name,
*
*-------------------------------------------------------------------------
*/
-void issue_fail_msg(const char* where, int line, const char* file_name,
- const char* func_name, const char* message)
+void
+issue_fail_msg(const char *where, int line, const char *file_name, const char *func_name, const char *message)
{
- if (GetTestVerbosity()>=VERBO_HI)
- {
+ if (GetTestVerbosity() >= VERBO_HI) {
cerr << endl;
- cerr << ">>> FAILED in " << where << ": " << func_name << endl <<
- " at line " << line << " in " << file_name << endl <<
- " C library detail: " << message << endl << endl;
+ cerr << ">>> FAILED in " << where << ": " << func_name << endl
+ << " at line " << line << " in " << file_name << endl
+ << " C library detail: " << message << endl
+ << endl;
}
}
@@ -134,13 +131,13 @@ void issue_fail_msg(const char* where, int line, const char* file_name,
* Friday, February 6, 2001
*-------------------------------------------------------------------------
*/
-int check_values (hsize_t i, hsize_t j, int apoint, int acheck)
+int
+check_values(hsize_t i, hsize_t j, int apoint, int acheck)
{
- if (apoint != acheck)
- {
+ if (apoint != acheck) {
cerr << " Read different values than written.\n" << endl;
- cerr << " At index " << static_cast<unsigned long>(i) << "," <<
- static_cast<unsigned long>(j) << endl;
+ cerr << " At index " << static_cast<unsigned long>(i) << "," << static_cast<unsigned long>(j)
+ << endl;
return -1;
}
return 0;
@@ -161,10 +158,10 @@ int check_values (hsize_t i, hsize_t j, int apoint, int acheck)
*
*-------------------------------------------------------------------------
*/
-void check_values(const char *value, const char* msg, int line, const char* file_name)
+void
+check_values(const char *value, const char *msg, int line, const char *file_name)
{
- if (value == NULL)
- {
+ if (value == NULL) {
cerr << endl;
cerr << "*** ERROR: " << msg << ", at line " << line << endl;
IncTestNumErrs();
@@ -187,21 +184,19 @@ void check_values(const char *value, const char* msg, int line, const char* file
* May 2, 2010
*-------------------------------------------------------------------------
*/
-void verify_val(const char* x, const char* value, const char* where, int line, const char* file_name)
+void
+verify_val(const char *x, const char *value, const char *where, int line, const char *file_name)
{
- if (GetTestVerbosity()>=VERBO_HI)
- {
+ if (GetTestVerbosity() >= VERBO_HI) {
cerr << endl;
- cerr << " Call to routine: " << where << " at line " << line
- << " in " << file_name << " had value " << x << endl;
+ cerr << " Call to routine: " << where << " at line " << line << " in " << file_name << " had value "
+ << x << endl;
}
- if (strcmp(x, value) != 0)
- {
+ if (strcmp(x, value) != 0) {
cerr << endl;
- cerr << "*** UNEXPECTED VALUE from " << where << " should be "
- << value << ", but is " << x << " at line " << line
- << " in " << file_name << endl;
- //IncTestNumErrs();
+ cerr << "*** UNEXPECTED VALUE from " << where << " should be " << value << ", but is " << x
+ << " at line " << line << " in " << file_name << endl;
+ // IncTestNumErrs();
throw TestFailedException(where, "");
}
}
@@ -209,7 +204,7 @@ void verify_val(const char* x, const char* value, const char* where, int line, c
//--------------------------------------------------------------------------
// Function: InvalidActionException default constructor
//--------------------------------------------------------------------------
-InvalidActionException::InvalidActionException():Exception(){}
+InvalidActionException::InvalidActionException() : Exception() {}
//--------------------------------------------------------------------------
// Function: InvalidActionException overloaded constructor
@@ -221,7 +216,10 @@ InvalidActionException::InvalidActionException():Exception(){}
// func - IN: Name of the function where failure should occur
// message - IN: Message
//--------------------------------------------------------------------------
-InvalidActionException::InvalidActionException(const H5std_string func, const H5std_string message) : Exception(func, message) {}
+InvalidActionException::InvalidActionException(const H5std_string func, const H5std_string message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: InvalidActionException destructor
@@ -231,7 +229,7 @@ InvalidActionException::~InvalidActionException() throw() {}
//--------------------------------------------------------------------------
// Function: TestFailedException default constructor
//--------------------------------------------------------------------------
-TestFailedException::TestFailedException():Exception(){}
+TestFailedException::TestFailedException() : Exception() {}
//--------------------------------------------------------------------------
// Function: TestFailedException overloaded constructor
@@ -243,10 +241,12 @@ TestFailedException::TestFailedException():Exception(){}
// func - IN: Name of the function where failure should occur
// message - IN: Message
//--------------------------------------------------------------------------
-TestFailedException::TestFailedException(const H5std_string func, const H5std_string message) : Exception(func, message) {}
+TestFailedException::TestFailedException(const H5std_string func, const H5std_string message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: TestFailedException destructor
//--------------------------------------------------------------------------
TestFailedException::~TestFailedException() throw() {}
-
diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h
index 6664d0c..97ed00b 100644
--- a/c++/test/h5cpputil.h
+++ b/c++/test/h5cpputil.h
@@ -28,94 +28,97 @@ using namespace H5;
using std::cerr;
using std::endl;
-#define MESSAGE(V,A) {if (HDGetTestVerbosity()>(V)) print_func A;}
-#define SUBTEST(TEST) {printf(" Subtest: %-52s",TEST); fflush(stdout);}
+#define MESSAGE(V, A) \
+ { \
+ if (HDGetTestVerbosity() > (V)) \
+ print_func A; \
+ }
+#define SUBTEST(TEST) \
+ { \
+ printf(" Subtest: %-52s", TEST); \
+ fflush(stdout); \
+ }
-int check_values (hsize_t i, hsize_t j, int apoint, int acheck);
-void check_values(const char *value, const char* msg, int line, const char* file_name);
-int test_report (int, const H5std_string&);
-void issue_fail_msg(const char* where, int line, const char* file_name,
- const char* message="");
-void issue_fail_msg(const char* where, int line, const char* file_name,
- const char* func_name, const char* message);
+int check_values(hsize_t i, hsize_t j, int apoint, int acheck);
+void check_values(const char *value, const char *msg, int line, const char *file_name);
+int test_report(int, const H5std_string &);
+void issue_fail_msg(const char *where, int line, const char *file_name, const char *message = "");
+void issue_fail_msg(const char *where, int line, const char *file_name, const char *func_name,
+ const char *message);
class InvalidActionException : public Exception {
- public:
- InvalidActionException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG);
- InvalidActionException();
- virtual ~InvalidActionException() throw();
+ public:
+ InvalidActionException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG);
+ InvalidActionException();
+ virtual ~InvalidActionException() throw();
};
class TestFailedException : public Exception {
- public:
- TestFailedException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG);
- TestFailedException();
- virtual ~TestFailedException() throw();
+ public:
+ TestFailedException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG);
+ TestFailedException();
+ virtual ~TestFailedException() throw();
};
// Overloaded/Template functions to verify values and display proper info
// Verifies
-void verify_val(const char* x, const char* value, const char* where, int line, const char* file_name);
+void verify_val(const char *x, const char *value, const char *where, int line, const char *file_name);
template <class Type1, class Type2>
- void verify_val(Type1 x, Type2 value, const char* where, int line, const char* file_name)
+void
+verify_val(Type1 x, Type2 value, const char *where, int line, const char *file_name)
{
- if (GetTestVerbosity()>=VERBO_HI)
- {
+ if (GetTestVerbosity() >= VERBO_HI) {
cerr << endl;
- cerr << " Call to routine: " << where << " at line " << line
- << " in " << file_name << " had value " << x << endl;
+ cerr << " Call to routine: " << where << " at line " << line << " in " << file_name << " had value "
+ << x << endl;
}
- if (x != value)
- {
+ if (x != value) {
cerr << endl;
- cerr << "*** UNEXPECTED VALUE from " << where << " should be "
- << value << ", but is " << x << " at line " << line
- << " in " << file_name << endl;
+ cerr << "*** UNEXPECTED VALUE from " << where << " should be " << value << ", but is " << x
+ << " at line " << line << " in " << file_name << endl;
IncTestNumErrs();
throw TestFailedException(where, "");
}
}
template <class Type1, class Type2>
- void verify_val(Type1 x, Type2 value, const char* msg, const char* file_name, int line)
+void
+verify_val(Type1 x, Type2 value, const char *msg, const char *file_name, int line)
{
- if (x != value)
- {
+ if (x != value) {
cerr << endl;
- cerr << "*** UNEXPECTED VALUE: " << file_name << ":line " << line
- << ": " << msg << " different: " << x << ", should be " << value
- << endl;
+ cerr << "*** UNEXPECTED VALUE: " << file_name << ":line " << line << ": " << msg
+ << " different: " << x << ", should be " << value << endl;
IncTestNumErrs();
throw TestFailedException(file_name, msg);
}
}
template <class Type1, class Type2>
- void verify_val_noteq(Type1 x, Type2 value, const char* where, int line, const char* file_name)
+void
+verify_val_noteq(Type1 x, Type2 value, const char *where, int line, const char *file_name)
{
- if (GetTestVerbosity()>=VERBO_HI)
- {
+ if (GetTestVerbosity() >= VERBO_HI) {
cerr << endl;
- cerr << " Call to routine: " << where << " at line " << line
- << " in " << file_name << " had value " << x << endl;
+ cerr << " Call to routine: " << where << " at line " << line << " in " << file_name << " had value "
+ << x << endl;
}
- if (x == value)
- {
+ if (x == value) {
cerr << endl;
- cerr << "*** UNEXPECTED VALUE from " << where << " should not be "
- << value << " at line " << line << " in " << file_name << endl;
+ cerr << "*** UNEXPECTED VALUE from " << where << " should not be " << value << " at line " << line
+ << " in " << file_name << endl;
IncTestNumErrs();
throw TestFailedException(where, "");
}
}
template <class Type1, class Type2>
- void CHECK(Type1 x, Type2 value, const char* msg, int line, const char* file_name)
+void
+CHECK(Type1 x, Type2 value, const char *msg, int line, const char *file_name)
{
- if (x == value)
- {
+ if (x == value) {
cerr << endl;
cerr << "*** Function " << msg << " FAILED at line " << line << endl;
IncTestNumErrs();
@@ -124,14 +127,13 @@ template <class Type1, class Type2>
}
template <class Type1, class Type2>
- void verify_val(Type1 x, Type2 value, float epsilon, const char* msg, int line, const char* file_name)
+void
+verify_val(Type1 x, Type2 value, float epsilon, const char *msg, int line, const char *file_name)
{
- if (x == value)
- {
+ if (x == value) {
cerr << endl;
- cerr << "*** UNEXPECTED FLOAT VALUE: " << file_name << ":line " << line
- << ": " << msg << " different: " << x << ", should be " << value
- << " (epsilon=" << epsilon << ")" << endl;
+ cerr << "*** UNEXPECTED FLOAT VALUE: " << file_name << ":line " << line << ": " << msg
+ << " different: " << x << ", should be " << value << " (epsilon=" << epsilon << ")" << endl;
IncTestNumErrs();
throw TestFailedException(file_name, msg);
}
diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp
index d80de16..dc7ea71 100644
--- a/c++/test/tarray.cpp
+++ b/c++/test/tarray.cpp
@@ -25,29 +25,35 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
-const H5std_string FILENAME("tarray.h5");
-const H5std_string ARRAYTYPE_NAME("/Array type 1");
-const int SPACE1_RANK = 1;
-const hsize_t SPACE1_DIM1 = 4;
-const int ARRAY1_RANK = 1;
-const hsize_t ARRAY1_DIM1 = 4;
+const H5std_string FILENAME("tarray.h5");
+const H5std_string ARRAYTYPE_NAME("/Array type 1");
+const int SPACE1_RANK = 1;
+const hsize_t SPACE1_DIM1 = 4;
+const int ARRAY1_RANK = 1;
+const hsize_t ARRAY1_DIM1 = 4;
-typedef enum flt_t {
- FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE, FLT_OTHER
-} flt_t;
+typedef enum flt_t { FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE, FLT_OTHER } flt_t;
typedef enum int_t {
- INT_CHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT,
- INT_LONG, INT_ULONG, INT_LLONG, INT_ULLONG, INT_OTHER
+ INT_CHAR,
+ INT_UCHAR,
+ INT_SHORT,
+ INT_USHORT,
+ INT_INT,
+ INT_UINT,
+ INT_LONG,
+ INT_ULONG,
+ INT_LLONG,
+ INT_ULLONG,
+ INT_OTHER
} int_t;
-
/*-------------------------------------------------------------------------
* Function: test_array_compound_array
*
@@ -59,29 +65,29 @@ typedef enum int_t {
* January, 2016
*-------------------------------------------------------------------------
*/
-static void test_array_compound_array()
+static void
+test_array_compound_array()
{
SUBTEST("ArrayType::getArrayNDims & ArrayType::getArrayDims");
- typedef struct { // Typedef for compound datatype */
- int i;
+ typedef struct { // Typedef for compound datatype */
+ int i;
float f[ARRAY1_DIM1];
} s1_t;
- s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information to write
- s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information read in
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int nmemb; // Number of compound members
- int ii; // counting variables
- hsize_t idxi, idxj, idxk; // dimension indicing variables
- H5T_class_t mclass; // Datatype class for field
+ s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information to write
+ s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information read in
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int nmemb; // Number of compound members
+ int ii; // counting variables
+ hsize_t idxi, idxj, idxk; // dimension indicing variables
+ H5T_class_t mclass; // Datatype class for field
// Initialize array data to write
- for (idxi =0; idxi < SPACE1_DIM1; idxi++)
+ for (idxi = 0; idxi < SPACE1_DIM1; idxi++)
for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
wdata[idxi][idxj].i = idxi * 10 + idxj;
- for(idxk = 0; idxk < ARRAY1_DIM1; idxk++)
- {
- float temp = idxi * 10.0 + idxj * 2.5 + idxk;
+ for (idxk = 0; idxk < ARRAY1_DIM1; idxk++) {
+ float temp = idxi * 10.0 + idxj * 2.5 + idxk;
wdata[idxi][idxj].f[idxk] = temp;
}
} // end for
@@ -157,8 +163,8 @@ static void test_array_compound_array()
// Verify that it is an array of compounds
DataType dstype = dataset.getDataType();
- mclass = dstype.getClass();
- verify_val(mclass==H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
+ mclass = dstype.getClass();
+ verify_val(mclass == H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
dstype.close();
@@ -174,11 +180,12 @@ static void test_array_compound_array()
atype_check.getArrayDims(rdims1);
// Check the array dimensions
- for (ii =0; ii <ndims; ii++)
- if (rdims1[ii]!=tdims1[ii]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n", ii, rdims1[ii], ii, tdims1[ii]);
- continue;
- } // end if
+ for (ii = 0; ii < ndims; ii++)
+ if (rdims1[ii] != tdims1[ii]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n",
+ ii, rdims1[ii], ii, tdims1[ii]);
+ continue;
+ } // end if
// Test ArrayType::ArrayType(const hid_t existing_id)
ArrayType new_arrtype(atype_check.getId());
@@ -193,9 +200,10 @@ static void test_array_compound_array()
// Check the array dimensions
for (ii = 0; ii < ndims; ii++)
if (rdims1[ii] != tdims1[ii]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n", ii, rdims1[ii], ii, tdims1[ii]);
- continue;
- } // end if
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n",
+ ii, rdims1[ii], ii, tdims1[ii]);
+ continue;
+ } // end if
/*
* Check the compound datatype and the array of floats datatype
@@ -204,8 +212,8 @@ static void test_array_compound_array()
// Get the compound datatype, which is the base datatype of the
// array datatype atype_check.
DataType base_type = atype_check.getSuper();
- mclass = base_type.getClass();
- verify_val(mclass==H5T_COMPOUND, true, "atype_check.getClass", __LINE__, __FILE__);
+ mclass = base_type.getClass();
+ verify_val(mclass == H5T_COMPOUND, true, "atype_check.getClass", __LINE__, __FILE__);
// Verify the compound datatype info
CompType ctype_check(base_type.getId());
@@ -217,15 +225,15 @@ static void test_array_compound_array()
// Check the 2nd field's name
H5std_string field2_name = ctype_check.getMemberName(1);
- if (HDstrcmp(field2_name.c_str(),"f") != 0)
- TestErrPrintf("Compound field name doesn't match!, field2_name=%s\n",field2_name.c_str());
+ if (HDstrcmp(field2_name.c_str(), "f") != 0)
+ TestErrPrintf("Compound field name doesn't match!, field2_name=%s\n", field2_name.c_str());
// Get the 2nd field's datatype
DataType f2_type = ctype_check.getMemberDataType(1);
// Get the 2nd field's class, this 2nd field should have an array type
mclass = f2_type.getClass();
- verify_val(mclass==H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
+ verify_val(mclass == H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
f2_type.close();
// Get the 2nd field, array of floats datatype, to check
@@ -242,7 +250,8 @@ static void test_array_compound_array()
// Check the array dimensions
for (ii = 0; ii < ndims; ii++)
if (rdims1[ii] != tdims1[ii]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n", ii, rdims1[ii], ii, tdims1[ii]);
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n",
+ ii, rdims1[ii], ii, tdims1[ii]);
continue;
} // end if
@@ -257,33 +266,34 @@ static void test_array_compound_array()
for (idxi = 0; idxi < SPACE1_DIM1; idxi++) {
for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
if (wdata[idxi][idxj].i != rdata[idxi][idxj].i) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n",idxi,idxj,wdata[idxi][idxj].i,idxi,idxj,rdata[idxi][idxj].i);
+ TestErrPrintf(
+ "Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n",
+ idxi, idxj, wdata[idxi][idxj].i, idxi, idxj, rdata[idxi][idxj].i);
continue;
} // end if
- } // end for
- } // end for
+ } // end for
+ } // end for
// Close all
atype_check.close();
dataset.close();
file1.close();
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_array_compound_array", __LINE__, __FILE__, E.getCDetailMsg());
}
} // end test_array_compound_array()
-
/*
* Helper routine to demonstrate the issue in HDFFV-9562
*/
-H5::DataType getArr()
+H5::DataType
+getArr()
{
hsize_t *dims = new hsize_t;
- *dims = 5;
+ *dims = 5;
H5::ArrayType ret;
ret = H5::ArrayType(H5::PredType::NATIVE_INT, 1, dims);
delete dims;
@@ -304,7 +314,8 @@ H5::DataType getArr()
* Used user's sample code in HDFFV-9562
*-------------------------------------------------------------------------
*/
-static void test_array_assignment()
+static void
+test_array_assignment()
{
hsize_t sdims1[] = {SPACE1_DIM1};
SUBTEST("ArrayType::operator=");
@@ -341,14 +352,12 @@ static void test_array_assignment()
file1.close();
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_array_assignment", __LINE__, __FILE__, E.getCDetailMsg());
}
} // end test_array_assignment()
-
/*-------------------------------------------------------------------------
* Function: test_array_info
*
@@ -360,27 +369,27 @@ static void test_array_assignment()
* April, 2016
*-------------------------------------------------------------------------
*/
-static void test_array_info()
+static void
+test_array_info()
{
SUBTEST("ArrayType Const Methods");
- typedef struct { // Typedef for compound datatype */
- int i;
+ typedef struct { // Typedef for compound datatype */
+ int i;
float f[ARRAY1_DIM1];
} s1_t;
- s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information to write
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ii; // counting variables
- hsize_t idxi, idxj, idxk; // dimension indicing variables
- H5T_class_t mclass; // Datatype class for field
+ s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information to write
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ii; // counting variables
+ hsize_t idxi, idxj, idxk; // dimension indicing variables
+ H5T_class_t mclass; // Datatype class for field
// Initialize array data to write
- for (idxi =0; idxi < SPACE1_DIM1; idxi++)
+ for (idxi = 0; idxi < SPACE1_DIM1; idxi++)
for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
wdata[idxi][idxj].i = idxi * 10 + idxj;
- for(idxk = 0; idxk < ARRAY1_DIM1; idxk++)
- {
- float temp = idxi * 10.0 + idxj * 2.5 + idxk;
+ for (idxk = 0; idxk < ARRAY1_DIM1; idxk++) {
+ float temp = idxi * 10.0 + idxj * 2.5 + idxk;
wdata[idxi][idxj].f[idxk] = temp;
}
} // end for
@@ -429,44 +438,44 @@ static void test_array_info()
// Verify that it is an array of compounds
DataType dstype = dataset.getDataType();
- mclass = dstype.getClass();
- verify_val(mclass==H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
+ mclass = dstype.getClass();
+ verify_val(mclass == H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
dstype.close();
{ // Let atype_check go out of scope
- // Get the array datatype, declared as const
- const ArrayType atype_check = dataset.getArrayType();
-
- // Check the array rank with the const method
- int ndims = atype_check.getArrayNDims();
- verify_val(ndims, ARRAY1_RANK, "atype_check.getArrayNDims", __LINE__, __FILE__);
-
- // Get the array dimensions with the const method
- hsize_t rdims1[H5S_MAX_RANK];
- atype_check.getArrayDims(rdims1);
-
- // Check the array dimensions
- for (ii =0; ii <ndims; ii++)
- if (rdims1[ii]!=tdims1[ii]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n", ii, rdims1[ii], ii, tdims1[ii]);
- continue;
- } // end if
+ // Get the array datatype, declared as const
+ const ArrayType atype_check = dataset.getArrayType();
+
+ // Check the array rank with the const method
+ int ndims = atype_check.getArrayNDims();
+ verify_val(ndims, ARRAY1_RANK, "atype_check.getArrayNDims", __LINE__, __FILE__);
+
+ // Get the array dimensions with the const method
+ hsize_t rdims1[H5S_MAX_RANK];
+ atype_check.getArrayDims(rdims1);
+
+ // Check the array dimensions
+ for (ii = 0; ii < ndims; ii++)
+ if (rdims1[ii] != tdims1[ii]) {
+ TestErrPrintf(
+ "Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n", ii,
+ rdims1[ii], ii, tdims1[ii]);
+ continue;
+ } // end if
}
// Close all
dataset.close();
file1.close();
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_array_info", __LINE__, __FILE__, E.getCDetailMsg());
}
} // end test_array_info()
-
/*-------------------------------------------------------------------------
* Function: test_array
*
@@ -475,8 +484,8 @@ static void test_array_info()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_array()
+extern "C" void
+test_array()
{
// Output message about test being performed
MESSAGE(5, ("Testing Array Datatypes\n"));
@@ -490,9 +499,8 @@ void test_array()
// Test const functions (HDFFV-9725)
test_array_info();
-} // test_array()
+} // test_array()
-
/*-------------------------------------------------------------------------
* Function: cleanup_array
*
@@ -504,8 +512,8 @@ void test_array()
* January, 2016
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_array()
+extern "C" void
+cleanup_array()
{
HDremove(FILENAME.c_str());
-} // cleanup_array
+} // cleanup_array
diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp
index f432723..2290fff 100644
--- a/c++/test/tattr.cpp
+++ b/c++/test/tattr.cpp
@@ -26,11 +26,11 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
const H5std_string FILE_BASIC("tattr_basic.h5");
const H5std_string FILE_COMPOUND("tattr_compound.h5");
@@ -39,10 +39,10 @@ const H5std_string FILE_MULTI("tattr_multi.h5");
const H5std_string FILE_DTYPE("tattr_dtype.h5");
const H5std_string ATTR_TMP_NAME("temp_attr_name");
const H5std_string FATTR_TMP_NAME("temp_fattr_name");
-const size_t ATTR_MAX_DIMS = 7;
+const size_t ATTR_MAX_DIMS = 7;
/* 3-D dataset with fixed dimensions */
-const int SPACE1_RANK = 3;
+const int SPACE1_RANK = 3;
const hsize_t SPACE1_DIM1 = 3;
const hsize_t SPACE1_DIM2 = 15;
const hsize_t SPACE1_DIM3 = 13;
@@ -54,54 +54,55 @@ const H5std_string TYPE1_NAME("/Type");
/* Attribute Rank & Dimensions */
const H5std_string ATTR1_NAME("Attr1");
-const int ATTR1_RANK = 1;
-const hsize_t ATTR1_DIM1 = 3;
-int attr_data1[ATTR1_DIM1]={512,-234,98123}; /* Test data for 1st attribute */
+const int ATTR1_RANK = 1;
+const hsize_t ATTR1_DIM1 = 3;
+int attr_data1[ATTR1_DIM1] = {512, -234, 98123}; /* Test data for 1st attribute */
// File attribute, using the same rank and dimensions as ATTR1_NAME's
const H5std_string FATTR1_NAME("File Attr1");
const H5std_string FATTR2_NAME("File Attr2");
const H5std_string ATTR2_NAME("Attr2");
-const int ATTR2_RANK = 2;
-const hsize_t ATTR2_DIM1 = 2;
-const hsize_t ATTR2_DIM2 = 2;
-int attr_data2[ATTR2_DIM1][ATTR2_DIM2]={{7614,-416},{197814,-3}}; /* Test data for 2nd attribute */
+const int ATTR2_RANK = 2;
+const hsize_t ATTR2_DIM1 = 2;
+const hsize_t ATTR2_DIM2 = 2;
+int attr_data2[ATTR2_DIM1][ATTR2_DIM2] = {{7614, -416}, {197814, -3}}; /* Test data for 2nd attribute */
const H5std_string ATTR3_NAME("Attr3");
-const int ATTR3_RANK = 3;
-const hsize_t ATTR3_DIM1 = 2;
-const hsize_t ATTR3_DIM2 = 2;
-const hsize_t ATTR3_DIM3 = 2;
-double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{2.3,-26.1},{0.123,-10.0}},{{981724.2,-0.91827},{2.0,23.0}}}; /* Test data for 3rd attribute */
+const int ATTR3_RANK = 3;
+const hsize_t ATTR3_DIM1 = 2;
+const hsize_t ATTR3_DIM2 = 2;
+const hsize_t ATTR3_DIM3 = 2;
+double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {
+ {{2.3, -26.1}, {0.123, -10.0}}, {{981724.2, -0.91827}, {2.0, 23.0}}}; /* Test data for 3rd attribute */
const H5std_string ATTR4_NAME("Attr4");
-const int ATTR4_RANK = 2;
-const hsize_t ATTR4_DIM1 = 2;
-const hsize_t ATTR4_DIM2 = 2;
+const int ATTR4_RANK = 2;
+const hsize_t ATTR4_DIM1 = 2;
+const hsize_t ATTR4_DIM2 = 2;
const H5std_string ATTR4_FIELDNAME1("i");
const H5std_string ATTR4_FIELDNAME2("d");
const H5std_string ATTR4_FIELDNAME3("c");
-size_t attr4_field1_off=0;
-size_t attr4_field2_off=0;
-size_t attr4_field3_off=0;
+size_t attr4_field1_off = 0;
+size_t attr4_field2_off = 0;
+size_t attr4_field3_off = 0;
struct attr4_struct {
- int i;
+ int i;
double d;
- char c;
- } attr_data4[ATTR4_DIM1][ATTR4_DIM2]={{{3,-26.1,'d'},{-100000, 0.123,'3'}},
- {{-23,981724.2,'Q'},{0,2.0,'\n'}}}; // Test data for 4th attribute
+ char c;
+} attr_data4[ATTR4_DIM1][ATTR4_DIM2] = {
+ {{3, -26.1, 'd'}, {-100000, 0.123, '3'}},
+ {{-23, 981724.2, 'Q'}, {0, 2.0, '\n'}}}; // Test data for 4th attribute
const H5std_string ATTR5_NAME("Attr5");
-const int ATTR5_RANK = 0;
-float attr_data5 = (float)-5.123; // Test data for 5th attribute
+const int ATTR5_RANK = 0;
+float attr_data5 = (float)-5.123; // Test data for 5th attribute
/* Info for another attribute */
const H5std_string ATTR1A_NAME("Attr1_a");
-int attr_data1a[ATTR1_DIM1]={256,11945,-22107};
+int attr_data1a[ATTR1_DIM1] = {256, 11945, -22107};
-
/*-------------------------------------------------------------------------
* Function: test_attr_basic_write
*
@@ -110,12 +111,13 @@ int attr_data1a[ATTR1_DIM1]={256,11945,-22107};
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_basic_write()
+static void
+test_attr_basic_write()
{
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {ATTR1_DIM1};
- hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2};
- int read_data1[ATTR1_DIM1]={0}; // Buffer for reading 1st attribute
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {ATTR1_DIM1};
+ hsize_t dims3[] = {ATTR2_DIM1, ATTR2_DIM2};
+ int read_data1[ATTR1_DIM1] = {0}; // Buffer for reading 1st attribute
hsize_t i;
// Output message about test being performed
@@ -123,10 +125,10 @@ static void test_attr_basic_write()
try {
// Create file
- H5File fid1 (FILE_BASIC, H5F_ACC_TRUNC);
+ H5File fid1(FILE_BASIC, H5F_ACC_TRUNC);
// Create dataspace for dataset
- DataSpace ds_space (SPACE1_RANK, dims1);
+ DataSpace ds_space(SPACE1_RANK, dims1);
/*
* Test attribute with dataset
@@ -136,55 +138,59 @@ static void test_attr_basic_write()
DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space);
// Create dataspace for attribute
- DataSpace att_space (ATTR1_RANK, dims2);
+ DataSpace att_space(ATTR1_RANK, dims2);
// Create a file attribute
- Attribute file_attr2 = fid1.createAttribute (FATTR1_NAME, PredType::NATIVE_INT, att_space);
+ Attribute file_attr2 = fid1.createAttribute(FATTR1_NAME, PredType::NATIVE_INT, att_space);
// Create a file attribute
- Attribute file_attr1 = fid1.createAttribute (FATTR2_NAME, PredType::NATIVE_INT, att_space);
+ Attribute file_attr1 = fid1.createAttribute(FATTR2_NAME, PredType::NATIVE_INT, att_space);
// Create an attribute for the dataset
- Attribute ds_attr1 = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space);
+ Attribute ds_attr1 = dataset.createAttribute(ATTR1_NAME, PredType::NATIVE_INT, att_space);
// Try creating an attribute that already exists. This should fail
// since two attributes cannot have the same name. If an exception
// is not thrown for this action by createAttribute, then throw an
// invalid action exception.
try {
- Attribute invalid_attr = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space);
+ Attribute invalid_attr = dataset.createAttribute(ATTR1_NAME, PredType::NATIVE_INT, att_space);
// continuation here, that means no exception has been thrown
- throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset");
+ throw InvalidActionException("H5File::createDataSet",
+ "Library allowed overwrite of existing dataset");
}
- catch (AttributeIException& E) // catching invalid creating attribute
- {} // do nothing, exception expected
+ catch (AttributeIException &E) // catching invalid creating attribute
+ {
+ } // do nothing, exception expected
// Write attribute information
- ds_attr1.write (PredType::NATIVE_INT, attr_data1);
+ ds_attr1.write(PredType::NATIVE_INT, attr_data1);
// Read attribute information immediately, without closing attribute
- ds_attr1.read (PredType::NATIVE_INT, read_data1);
+ ds_attr1.read(PredType::NATIVE_INT, read_data1);
// Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n", __LINE__,
+ i, attr_data1[i], i, read_data1[i]);
// Create two more attributes for this dataset, but only write to one.
- Attribute ds_attr2 = dataset.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, att_space);
- Attribute ds_attr3 = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_INT, att_space);
+ Attribute ds_attr2 = dataset.createAttribute(ATTR2_NAME, PredType::NATIVE_INT, att_space);
+ Attribute ds_attr3 = dataset.createAttribute(ATTR3_NAME, PredType::NATIVE_INT, att_space);
// Write attribute information
- ds_attr2.write (PredType::NATIVE_INT, attr_data1a);
+ ds_attr2.write(PredType::NATIVE_INT, attr_data1a);
// Read attribute information immediately, without closing attribute
- ds_attr2.read (PredType::NATIVE_INT, read_data1);
+ ds_attr2.read(PredType::NATIVE_INT, read_data1);
// Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1a[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1a[i],i,read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1a[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",
+ __LINE__, i, attr_data1a[i], i, read_data1[i]);
// Close both attributes
ds_attr1.close();
@@ -196,47 +202,46 @@ static void test_attr_basic_write()
*/
// Create group in file fid1
- Group group = fid1.createGroup (GROUP1_NAME);
+ Group group = fid1.createGroup(GROUP1_NAME);
// Create dataspace for attribute
DataSpace sid3(ATTR2_RANK, dims3);
// Create an attribute for the group
- Attribute gr_attr = group.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, sid3);
+ Attribute gr_attr = group.createAttribute(ATTR2_NAME, PredType::NATIVE_INT, sid3);
// Check storage size for attribute
hsize_t attr_size = gr_attr.getStorageSize();
- verify_val((long)attr_size, (long)(ATTR2_DIM1*ATTR2_DIM2*sizeof(int)),
- "Attribute::getStorageSize",__LINE__,__FILE__);
+ verify_val((long)attr_size, (long)(ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)),
+ "Attribute::getStorageSize", __LINE__, __FILE__);
// Try to create the same attribute again (should fail)
try {
- Attribute invalid_attr = group.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, sid3);
+ Attribute invalid_attr = group.createAttribute(ATTR2_NAME, PredType::NATIVE_INT, sid3);
// continuation here, that means no exception has been thrown
throw InvalidActionException("H5Group::createAttribute",
- "Attempting to create an existing attribute");
+ "Attempting to create an existing attribute");
}
- catch (AttributeIException& E) // catching invalid creating attribute
- {} // do nothing, exception expected
+ catch (AttributeIException &E) // catching invalid creating attribute
+ {
+ } // do nothing, exception expected
// Write attribute information
- gr_attr.write (PredType::NATIVE_INT, attr_data2);
+ gr_attr.write(PredType::NATIVE_INT, attr_data2);
// Check storage size for attribute
attr_size = gr_attr.getStorageSize();
- verify_val((long)attr_size, (long)(ATTR2_DIM1*ATTR2_DIM2*sizeof(int)),
- "Attribute::getStorageSize", __LINE__, __FILE__);
+ verify_val((long)attr_size, (long)(ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)),
+ "Attribute::getStorageSize", __LINE__, __FILE__);
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_basic_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_basic_write()
+} // test_attr_basic_write()
-
/*-------------------------------------------------------------------------
* Function: test_attr_getname
*
@@ -264,7 +269,8 @@ static void test_attr_basic_write()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_getname()
+static void
+test_attr_getname()
{
// Output message about test being performed
SUBTEST("Testing all overloads of Attribute::getName");
@@ -290,36 +296,37 @@ static void test_attr_getname()
// using different buffer sizes and verify against FATTR1_NAME (3 cases)
// 1. With arbitrary buf_size that is larger than the name size
- size_t buf_size = FATTR1_NAME.length() + 10;
- char* fattr1_name = new char[buf_size+1];
- HDmemset(fattr1_name, 0, buf_size+1);
+ size_t buf_size = FATTR1_NAME.length() + 10;
+ char * fattr1_name = new char[buf_size + 1];
+ HDmemset(fattr1_name, 0, buf_size + 1);
ssize_t name_size = 0; // actual length of attribute name
- name_size = fattr1.getName(fattr1_name, buf_size+1);
+ name_size = fattr1.getName(fattr1_name, buf_size + 1);
CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
verify_val((size_t)name_size, FATTR1_NAME.length(), "Attribute::getName", __LINE__, __FILE__);
- verify_val((const char*)fattr1_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
- delete []fattr1_name;
+ verify_val((const char *)fattr1_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
+ delete[] fattr1_name;
// 2. With arbitrary buf_size that is smaller than the name's length.
// Let's try 4 first characters in the name.
- buf_size = 4;
+ buf_size = 4;
char short_name[5] = "File"; // to verify the read name
- fattr1_name = new char[buf_size+1];
- HDmemset(fattr1_name, 0, buf_size+1);
- name_size = fattr1.getName(fattr1_name, buf_size+1);
+ fattr1_name = new char[buf_size + 1];
+ HDmemset(fattr1_name, 0, buf_size + 1);
+ name_size = fattr1.getName(fattr1_name, buf_size + 1);
CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
verify_val((size_t)name_size, FATTR1_NAME.size(), "Attribute::getName", __LINE__, __FILE__);
- verify_val((const char*)fattr1_name, (const char*)short_name, "Attribute::getName", __LINE__, __FILE__);
- delete []fattr1_name;
+ verify_val((const char *)fattr1_name, (const char *)short_name, "Attribute::getName", __LINE__,
+ __FILE__);
+ delete[] fattr1_name;
// 3. With a buf_size that equals the name's length.
- buf_size = FATTR1_NAME.length();
- fattr1_name = new char[buf_size+1];
- HDmemset(fattr1_name, 0, buf_size+1);
- name_size = fattr1.getName(fattr1_name, buf_size+1);
+ buf_size = FATTR1_NAME.length();
+ fattr1_name = new char[buf_size + 1];
+ HDmemset(fattr1_name, 0, buf_size + 1);
+ name_size = fattr1.getName(fattr1_name, buf_size + 1);
CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
verify_val(fattr1_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
- delete []fattr1_name;
+ delete[] fattr1_name;
// B. Get attribute name with
// ssize_t Attribute::getName(H5std_string& attr_name, size_t buf_size)
@@ -357,7 +364,7 @@ static void test_attr_getname()
// Open attribute
Attribute attr1(dataset.openAttribute(ATTR1_NAME));
- size_t len = 4;
+ size_t len = 4;
H5std_string dattr_name1 = attr1.getName(len);
verify_val(dattr_name1, "Attr", "Attribute::getName", __LINE__, __FILE__);
@@ -370,13 +377,11 @@ static void test_attr_getname()
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_getname()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_getname()
+} // test_attr_getname()
-
/*-------------------------------------------------------------------------
* Function: test_attr_rename
*
@@ -385,9 +390,10 @@ static void test_attr_getname()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_rename()
+static void
+test_attr_rename()
{
- int read_data1[ATTR1_DIM1]={0}; // Buffer for reading the attribute
+ int read_data1[ATTR1_DIM1] = {0}; // Buffer for reading the attribute
hsize_t i;
// Output message about test being performed
@@ -441,15 +447,16 @@ static void test_attr_rename()
verify_val(attr_name, ATTR_TMP_NAME, "Attribute::getName", __LINE__, __FILE__);
// Read attribute information immediately, without closing attribute
- attr1.read (PredType::NATIVE_INT, read_data1);
+ attr1.read(PredType::NATIVE_INT, read_data1);
// Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n", __LINE__,
+ i, attr_data1[i], i, read_data1[i]);
// Close attribute
- attr1.close();
+ attr1.close();
// Check for existence of second attribute
attr_exists = dataset.attrExists(ATTR2_NAME);
@@ -464,12 +471,13 @@ static void test_attr_rename()
verify_val(attr2_name, ATTR2_NAME, "Attribute::getName", __LINE__, __FILE__);
// Read attribute information immediately, without closing attribute
- attr2.read (PredType::NATIVE_INT, read_data1);
+ attr2.read(PredType::NATIVE_INT, read_data1);
// Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1a[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1a[i],i,read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1a[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",
+ __LINE__, i, attr_data1a[i], i, read_data1[i]);
// Close attribute
attr2.close();
@@ -485,13 +493,11 @@ static void test_attr_rename()
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_rename()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_rename()
+} // test_attr_rename()
-
/*-------------------------------------------------------------------------
* Function: test_attr_basic_read
*
@@ -500,7 +506,8 @@ static void test_attr_rename()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_basic_read()
+static void
+test_attr_basic_read()
{
hsize_t i, j;
@@ -525,16 +532,17 @@ static void test_attr_basic_read()
verify_val(oinfo.num_attrs, 3, "DataSet::getObjinfo", __LINE__, __FILE__);
// Open an attribute for the dataset
- Attribute ds_attr=dataset.openAttribute(ATTR1_NAME);
+ Attribute ds_attr = dataset.openAttribute(ATTR1_NAME);
// Read attribute information
- int read_data1[ATTR1_DIM1]={0}; // Buffer for reading 1st attribute
+ int read_data1[ATTR1_DIM1] = {0}; // Buffer for reading 1st attribute
ds_attr.read(PredType::NATIVE_INT, &read_data1);
// Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",
+ __LINE__, i, attr_data1[i], i, read_data1[i]);
/*
* Test attribute with group
@@ -555,27 +563,27 @@ static void test_attr_basic_read()
Attribute gr_attr = group.openAttribute(ATTR2_NAME);
// Buffer for reading 2nd attribute
- int read_data2[ATTR2_DIM1][ATTR2_DIM2]={{0}};
+ int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}};
// Read attribute information
gr_attr.read(PredType::NATIVE_INT, read_data2);
// Verify values read in
- for(i=0; i<ATTR2_DIM1; i++)
- for(j=0; j<ATTR2_DIM2; j++)
- if(attr_data2[i][j]!=read_data2[i][j]) {
- TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",__LINE__, i,j,attr_data2[i][j],i,j,read_data2[i][j]);
+ for (i = 0; i < ATTR2_DIM1; i++)
+ for (j = 0; j < ATTR2_DIM2; j++)
+ if (attr_data2[i][j] != read_data2[i][j]) {
+ TestErrPrintf(
+ "%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",
+ __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]);
}
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_basic_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_basic_read()
+} // test_attr_basic_read()
-
/*-------------------------------------------------------------------------
* Function: test_attr_compound_write
*
@@ -584,10 +592,11 @@ static void test_attr_basic_read()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_compound_write()
+static void
+test_attr_compound_write()
{
- // Output message about test being performed
+ // Output message about test being performed
SUBTEST("Multiple Attribute Functions");
try {
@@ -595,11 +604,11 @@ static void test_attr_compound_write()
H5File fid1(FILE_COMPOUND.c_str(), H5F_ACC_TRUNC);
// Create dataspace for dataset
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
DataSpace sid1(SPACE1_RANK, dims1);
// Create a dataset
- DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR,sid1);
+ DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, sid1);
// Create the attribute datatype.
CompType comp_type(sizeof(struct attr4_struct));
@@ -614,7 +623,7 @@ static void test_attr_compound_write()
comp_type.insertMember(ATTR4_FIELDNAME3, attr4_field3_off, PredType::NATIVE_SCHAR);
// Create dataspace for 1st attribute
- hsize_t dims2[] = {ATTR4_DIM1,ATTR4_DIM2};
+ hsize_t dims2[] = {ATTR4_DIM1, ATTR4_DIM2};
DataSpace sid2(ATTR4_RANK, dims2);
// Create complex attribute for the dataset
@@ -622,10 +631,11 @@ static void test_attr_compound_write()
// Try to create the same attribute again (should fail)
try {
- Attribute invalid_attr = dataset.createAttribute (ATTR4_NAME, comp_type, sid2);
+ Attribute invalid_attr = dataset.createAttribute(ATTR4_NAME, comp_type, sid2);
}
- catch (AttributeIException& E) // catching invalid creating attribute
- {} // do nothing, exception expected
+ catch (AttributeIException &E) // catching invalid creating attribute
+ {
+ } // do nothing, exception expected
// Write complex attribute data
attr.write(comp_type, attr_data4);
@@ -633,13 +643,11 @@ static void test_attr_compound_write()
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_compound_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_compound_write()
+} // test_attr_compound_write()
-
/*-------------------------------------------------------------------------
* Function: test_attr_compound_read
*
@@ -648,11 +656,12 @@ static void test_attr_compound_write()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_compound_read()
+static void
+test_attr_compound_read()
{
- hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions
- size_t size; // Attribute datatype size as stored in file
- size_t offset; // Attribute datatype field offset
+ hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions
+ size_t size; // Attribute datatype size as stored in file
+ size_t offset; // Attribute datatype field offset
struct attr4_struct read_data4[ATTR4_DIM1][ATTR4_DIM2]; // Buffer for reading 4th attribute
// Output message about test being performed
@@ -690,8 +699,8 @@ static void test_attr_compound_read()
// Get the dims of the dataspace and verify them
int ndims = space.getSimpleExtentDims(dims);
verify_val(ndims, ATTR4_RANK, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
- verify_val((long)dims[0], (long)ATTR4_DIM1, "DataSpace::getSimpleExtentDims",__LINE__, __FILE__);
- verify_val((long)dims[1], (long)ATTR4_DIM2, "DataSpace::getSimpleExtentDims",__LINE__, __FILE__);
+ verify_val((long)dims[0], (long)ATTR4_DIM1, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ verify_val((long)dims[1], (long)ATTR4_DIM2, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
// Get the class of the datatype that is used by attr
H5T_class_t type_class = attr.getTypeClass();
@@ -709,13 +718,11 @@ static void test_attr_compound_read()
// Verify that the fields have the same names as when the type
// was created
int j;
- for(j=0; j<fields; j++)
- {
+ for (j = 0; j < fields; j++) {
H5std_string fieldname = datatype.getMemberName(j);
- if(!((fieldname == ATTR4_FIELDNAME1) ||
- (fieldname == ATTR4_FIELDNAME2) ||
- (fieldname == ATTR4_FIELDNAME3)))
- TestErrPrintf("%d:invalid field name for field #%d: %s\n",__LINE__,j,fieldname.c_str());
+ if (!((fieldname == ATTR4_FIELDNAME1) || (fieldname == ATTR4_FIELDNAME2) ||
+ (fieldname == ATTR4_FIELDNAME3)))
+ TestErrPrintf("%d:invalid field name for field #%d: %s\n", __LINE__, j, fieldname.c_str());
} /* end for */
offset = datatype.getMemberOffset(0);
@@ -733,8 +740,8 @@ static void test_attr_compound_read()
type_class = datatype.getMemberClass(0);
verify_val(type_class, H5T_INTEGER, "DataType::getMemberClass", __LINE__, __FILE__);
// Get and verify the order of this member's type
- IntType i_type = datatype.getMemberIntType(0);
- H5T_order_t order = i_type.getOrder();
+ IntType i_type = datatype.getMemberIntType(0);
+ H5T_order_t order = i_type.getOrder();
verify_val(order, PredType::NATIVE_INT.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
// Get and verify the size of this member's type
@@ -745,7 +752,7 @@ static void test_attr_compound_read()
type_class = datatype.getMemberClass(1);
verify_val(type_class, H5T_FLOAT, "DataType::getMemberClass", __LINE__, __FILE__);
FloatType f_type = datatype.getMemberFloatType(1);
- order = f_type.getOrder();
+ order = f_type.getOrder();
verify_val(order, PredType::NATIVE_DOUBLE.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
size = f_type.getSize();
verify_val(size, PredType::NATIVE_DOUBLE.getSize(), "DataType::getSize", __LINE__, __FILE__);
@@ -756,7 +763,7 @@ static void test_attr_compound_read()
// Note: H5T_INTEGER is correct here!
StrType s_type = datatype.getMemberStrType(2);
- order = s_type.getOrder();
+ order = s_type.getOrder();
verify_val(order, PredType::NATIVE_SCHAR.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
size = s_type.getSize();
verify_val(size, PredType::NATIVE_SCHAR.getSize(), "DataType::getSize", __LINE__, __FILE__);
@@ -766,26 +773,30 @@ static void test_attr_compound_read()
// Verify values read in
hsize_t ii, jj;
- for(ii=0; ii<ATTR4_DIM1; ii++)
- for(jj=0; jj<ATTR4_DIM2; jj++)
- if(HDmemcmp(&attr_data4[ii][jj],&read_data4[ii][jj],sizeof(struct attr4_struct))) {
- TestErrPrintf("%d:attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n",__LINE__,ii,jj,attr_data4[ii][jj].i,ii,jj,read_data4[ii][jj].i);
- TestErrPrintf("%d:attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n",__LINE__,ii,jj,attr_data4[ii][jj].d,ii,jj,read_data4[ii][jj].d);
- TestErrPrintf("%d:attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n",__LINE__,ii,jj,attr_data4[ii][jj].c,ii,jj,read_data4[ii][jj].c);
- } /* end if */
+ for (ii = 0; ii < ATTR4_DIM1; ii++)
+ for (jj = 0; jj < ATTR4_DIM2; jj++)
+ if (HDmemcmp(&attr_data4[ii][jj], &read_data4[ii][jj], sizeof(struct attr4_struct))) {
+ TestErrPrintf(
+ "%d:attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n",
+ __LINE__, ii, jj, attr_data4[ii][jj].i, ii, jj, read_data4[ii][jj].i);
+ TestErrPrintf(
+ "%d:attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n",
+ __LINE__, ii, jj, attr_data4[ii][jj].d, ii, jj, read_data4[ii][jj].d);
+ TestErrPrintf(
+ "%d:attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n",
+ __LINE__, ii, jj, attr_data4[ii][jj].c, ii, jj, read_data4[ii][jj].c);
+ } /* end if */
// Verify name
H5std_string attr_name = attr.getName();
verify_val(attr_name, ATTR4_NAME, "Attribute::getName", __LINE__, __FILE__);
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_compound_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
- try
- {
+ try {
// Now, try truncating the file to make sure reference counting is good.
// If any references to ids in the previous block are left unterminated,
// the truncating will fail, because the file will not be closed in
@@ -795,13 +806,12 @@ static void test_attr_compound_read()
PASSED();
} // end try block
- catch (FileIException& E)
- {
- issue_fail_msg("test_attr_compound_read()", __LINE__, __FILE__, "Unable to truncate file, possibly because some objects are left opened");
+ catch (FileIException &E) {
+ issue_fail_msg("test_attr_compound_read()", __LINE__, __FILE__,
+ "Unable to truncate file, possibly because some objects are left opened");
}
-} // test_attr_compound_read()
+} // test_attr_compound_read()
-
/*-------------------------------------------------------------------------
* Function: test_attr_scalar_write
*
@@ -810,7 +820,8 @@ static void test_attr_compound_read()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_scalar_write()
+static void
+test_attr_scalar_write()
{
// Output message about test being performed
SUBTEST("Basic Scalar Attribute Writing Functions");
@@ -820,11 +831,11 @@ static void test_attr_scalar_write()
H5File fid1(FILE_SCALAR, H5F_ACC_TRUNC);
// Create dataspace for dataset
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
DataSpace sid1(SPACE1_RANK, dims1);
// Create a dataset
- DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR,sid1);
+ DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, sid1);
// Close dataset's dataspace
sid1.close();
@@ -833,34 +844,34 @@ static void test_attr_scalar_write()
DataSpace att_space(ATTR5_RANK, NULL);
// Create an attribute for the dataset
- Attribute ds_attr = dataset.createAttribute (ATTR5_NAME, PredType::NATIVE_FLOAT, att_space);
+ Attribute ds_attr = dataset.createAttribute(ATTR5_NAME, PredType::NATIVE_FLOAT, att_space);
// Try creating an attribute that already exists. This should fail
// since two attributes cannot have the same name. If an exception
// is not thrown for this action by createAttribute, then throw an
// invalid action exception.
try {
- Attribute invalid_attr = dataset.createAttribute (ATTR5_NAME, PredType::NATIVE_FLOAT, att_space);
+ Attribute invalid_attr = dataset.createAttribute(ATTR5_NAME, PredType::NATIVE_FLOAT, att_space);
// continuation here, that means no exception has been thrown
- throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset");
+ throw InvalidActionException("H5File::createDataSet",
+ "Library allowed overwrite of existing dataset");
}
- catch (AttributeIException& E) // catching invalid creating attribute
- {} // do nothing, exception expected
+ catch (AttributeIException &E) // catching invalid creating attribute
+ {
+ } // do nothing, exception expected
// Write attribute information
- ds_attr.write (PredType::NATIVE_FLOAT, &attr_data5);
+ ds_attr.write(PredType::NATIVE_FLOAT, &attr_data5);
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_scalar_write()
+} // test_attr_scalar_write()
-
/*-------------------------------------------------------------------------
* Function: test_attr_scalar_read
*
@@ -872,7 +883,8 @@ static void test_attr_scalar_write()
/* Epsilon for floating-point comparisons */
#define FP_EPSILON 0.000001F
-static void test_attr_scalar_read()
+static void
+test_attr_scalar_read()
{
// Output message about test being performed
SUBTEST("Basic Scalar Attribute Reading Functions");
@@ -889,11 +901,11 @@ static void test_attr_scalar_read()
verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__);
// Open an attribute for the dataset
- Attribute ds_attr=dataset.openAttribute(ATTR5_NAME);
+ Attribute ds_attr = dataset.openAttribute(ATTR5_NAME);
// Read attribute information
- float read_data2=0.0; // Buffer for reading 1st attribute
- ds_attr.read(PredType::NATIVE_FLOAT,&read_data2);
+ float read_data2 = 0.0; // Buffer for reading 1st attribute
+ ds_attr.read(PredType::NATIVE_FLOAT, &read_data2);
if (HDfabs(read_data2 - attr_data5) > FP_EPSILON)
verify_val(read_data2, attr_data5, FP_EPSILON, "Attribute::read", __LINE__, __FILE__);
@@ -907,13 +919,11 @@ static void test_attr_scalar_read()
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_scalar_read()
+} // test_attr_scalar_read()
-
/*-------------------------------------------------------------------------
* Function: test_attr_mult_write
*
@@ -922,75 +932,76 @@ static void test_attr_scalar_read()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_mult_write()
+static void
+test_attr_mult_write()
{
// Output message about test being performed
SUBTEST("Multiple Attribute Writing Functions");
try {
// Create file
- H5File fid1 (FILE_MULTI, H5F_ACC_TRUNC);
+ H5File fid1(FILE_MULTI, H5F_ACC_TRUNC);
// Create dataspace for dataset
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- DataSpace ds_space (SPACE1_RANK, dims1);
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ DataSpace ds_space(SPACE1_RANK, dims1);
// Create a dataset
DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space);
// Create dataspace for 1st attribute
- hsize_t dims2[] = {ATTR1_DIM1};
- DataSpace att_space (ATTR1_RANK, dims2);
+ hsize_t dims2[] = {ATTR1_DIM1};
+ DataSpace att_space(ATTR1_RANK, dims2);
// Create 1st attribute for the dataset
- Attribute ds_attr = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space);
+ Attribute ds_attr = dataset.createAttribute(ATTR1_NAME, PredType::NATIVE_INT, att_space);
// Write attribute information
- ds_attr.write (PredType::NATIVE_INT, attr_data1);
+ ds_attr.write(PredType::NATIVE_INT, attr_data1);
// Create dataspace for 2nd attribute
- hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2};
- DataSpace att2_space (ATTR2_RANK, dims3);
+ hsize_t dims3[] = {ATTR2_DIM1, ATTR2_DIM2};
+ DataSpace att2_space(ATTR2_RANK, dims3);
// Create 2nd attribute for the dataset
- Attribute ds_attr2 = dataset.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, att2_space);
+ Attribute ds_attr2 = dataset.createAttribute(ATTR2_NAME, PredType::NATIVE_INT, att2_space);
// Write 2nd attribute information
- ds_attr2.write (PredType::NATIVE_INT, attr_data2);
+ ds_attr2.write(PredType::NATIVE_INT, attr_data2);
// Create dataspace for 3rd attribute
- hsize_t dims4[] = {ATTR3_DIM1,ATTR3_DIM2,ATTR3_DIM3};
- DataSpace att3_space (ATTR3_RANK, dims4);
+ hsize_t dims4[] = {ATTR3_DIM1, ATTR3_DIM2, ATTR3_DIM3};
+ DataSpace att3_space(ATTR3_RANK, dims4);
// Create 3rd attribute for the dataset
- Attribute ds_attr3 = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space);
+ Attribute ds_attr3 = dataset.createAttribute(ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space);
// Try creating an attribute that already exists. This should fail
// since two attributes cannot have the same name. If an exception
// is not thrown for this action by createAttribute, then throw an
// invalid action exception.
try {
- Attribute invalid_attr = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space);
+ Attribute invalid_attr = dataset.createAttribute(ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space);
// continuation here, that means no exception has been thrown
- throw InvalidActionException("DataSet::createAttribute", "Attempting to create a duplicate attribute");
+ throw InvalidActionException("DataSet::createAttribute",
+ "Attempting to create a duplicate attribute");
}
- catch (AttributeIException& E) // catching invalid creating attribute
- {} // do nothing, exception expected
+ catch (AttributeIException &E) // catching invalid creating attribute
+ {
+ } // do nothing, exception expected
// Write 3rd attribute information
- ds_attr3.write (PredType::NATIVE_DOUBLE, attr_data3);
+ ds_attr3.write(PredType::NATIVE_DOUBLE, attr_data3);
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_mult_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_mult_write()
+} // test_attr_mult_write()
-
/*-------------------------------------------------------------------------
* Function: test_attr_mult_read
*
@@ -999,14 +1010,15 @@ static void test_attr_mult_write()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_mult_read()
+static void
+test_attr_mult_read()
{
- int read_data1[ATTR1_DIM1]={0}; // Buffer for reading 1st attribute
- int read_data2[ATTR2_DIM1][ATTR2_DIM2]={{0}}; // Buffer for reading 2nd attribute
- double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{0}}}; // Buffer for reading 3rd attribute
- hsize_t i,j,k;
+ int read_data1[ATTR1_DIM1] = {0}; // Buffer for reading 1st attribute
+ int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; // Buffer for reading 2nd attribute
+ double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {{{0}}}; // Buffer for reading 3rd attribute
+ hsize_t i, j, k;
- // Output message about test being performed
+ // Output message about test being performed
SUBTEST("Multiple Attribute Reading Functions");
try {
@@ -1033,10 +1045,11 @@ static void test_attr_mult_read()
verify_val(rank, ATTR1_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
// Get the dims of the dataspace and verify them
- hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions
- int ndims = space.getSimpleExtentDims(dims);
+ hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions
+ int ndims = space.getSimpleExtentDims(dims);
if ((long)dims[0] != (long)ATTR1_DIM1)
- TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %d\n",__LINE__,(int)dims[0],ATTR1_DIM1);
+ TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %d\n", __LINE__,
+ (int)dims[0], ATTR1_DIM1);
/* Verify Datatype */
@@ -1046,7 +1059,7 @@ static void test_attr_mult_read()
// Verify that the type is of integer datatype
verify_val(type_class, H5T_INTEGER, "Attribute::getTypeClass", __LINE__, __FILE__);
- // Get the integer datatype
+ // Get the integer datatype
IntType i_type1 = attr.getIntType();
// Get and verify the order of this type
@@ -1061,9 +1074,10 @@ static void test_attr_mult_read()
attr.read(PredType::NATIVE_INT, read_data1);
// Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n", __LINE__,
+ i, attr_data1[i], i, read_data1[i]);
// Verify Name
H5std_string attr_name = attr.getName();
@@ -1087,8 +1101,8 @@ static void test_attr_mult_read()
// Get the dims of the dataspace and verify them
ndims = space.getSimpleExtentDims(dims);
- verify_val((long)dims[0], (long)ATTR2_DIM1, "DataSpace::getSimpleExtentDims",__LINE__, __FILE__);
- verify_val((long)dims[1], (long)ATTR2_DIM2, "DataSpace::getSimpleExtentDims",__LINE__, __FILE__);
+ verify_val((long)dims[0], (long)ATTR2_DIM1, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ verify_val((long)dims[1], (long)ATTR2_DIM2, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
/* Verify Datatype */
@@ -1098,7 +1112,7 @@ static void test_attr_mult_read()
// Verify that the type is of integer datatype
verify_val(type_class, H5T_INTEGER, "Attribute::getTypeClass", __LINE__, __FILE__);
- // Get the integer datatype
+ // Get the integer datatype
IntType i_type2 = attr.getIntType();
// Get and verify the order of this type
@@ -1111,13 +1125,15 @@ static void test_attr_mult_read()
// Read attribute information
attr.read(PredType::NATIVE_INT, read_data2);
- //attr.read(i_type, read_data2);
+ // attr.read(i_type, read_data2);
// Verify values read in
- for(i=0; i<ATTR2_DIM1; i++)
- for(j=0; j<ATTR2_DIM2; j++)
- if(attr_data2[i][j]!=read_data2[i][j])
- TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",__LINE__,i,j,attr_data2[i][j],i,j,read_data2[i][j]);
+ for (i = 0; i < ATTR2_DIM1; i++)
+ for (j = 0; j < ATTR2_DIM2; j++)
+ if (attr_data2[i][j] != read_data2[i][j])
+ TestErrPrintf(
+ "%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",
+ __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]);
// Verify Name
attr_name = attr.getName();
@@ -1139,9 +1155,9 @@ static void test_attr_mult_read()
// Get the dims of the dataspace and verify them
ndims = space.getSimpleExtentDims(dims);
- verify_val((long)dims[0],(long)ATTR3_DIM1,"attribute dimensions",__FILE__,__LINE__);
- verify_val((long)dims[1],(long)ATTR3_DIM2,"attribute dimensions",__FILE__,__LINE__);
- verify_val((long)dims[2],(long)ATTR3_DIM3,"attribute dimensions",__FILE__,__LINE__);
+ verify_val((long)dims[0], (long)ATTR3_DIM1, "attribute dimensions", __FILE__, __LINE__);
+ verify_val((long)dims[1], (long)ATTR3_DIM2, "attribute dimensions", __FILE__, __LINE__);
+ verify_val((long)dims[2], (long)ATTR3_DIM3, "attribute dimensions", __FILE__, __LINE__);
/* Verify Datatype */
@@ -1151,7 +1167,7 @@ static void test_attr_mult_read()
// Verify that the type is of compound datatype
verify_val(type_class, H5T_FLOAT, "Attribute::getTypeClass", __LINE__, __FILE__);
- // Get the double datatype
+ // Get the double datatype
FloatType f_type = attr.getFloatType();
// Get and verify the order of this type
@@ -1166,11 +1182,13 @@ static void test_attr_mult_read()
attr.read(PredType::NATIVE_DOUBLE, read_data3);
// Verify values read in
- for(i=0; i<ATTR3_DIM1; i++)
- for(j=0; j<ATTR3_DIM2; j++)
- for(k=0; k<ATTR3_DIM3; k++)
- if(attr_data3[i][j][k]!=read_data3[i][j][k])
- TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, read_data3[%d][%d][%d]=%f\n",__LINE__,i,j,k,attr_data3[i][j][k],i,j,k,read_data3[i][j][k]);
+ for (i = 0; i < ATTR3_DIM1; i++)
+ for (j = 0; j < ATTR3_DIM2; j++)
+ for (k = 0; k < ATTR3_DIM3; k++)
+ if (attr_data3[i][j][k] != read_data3[i][j][k])
+ TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, "
+ "read_data3[%d][%d][%d]=%f\n",
+ __LINE__, i, j, k, attr_data3[i][j][k], i, j, k, read_data3[i][j][k]);
// Verify Name
attr_name = attr.getName();
@@ -1179,13 +1197,11 @@ static void test_attr_mult_read()
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_mult_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_mult_read()
+} // test_attr_mult_read()
-
/*-------------------------------------------------------------------------
* Function: test_attr_delete
*
@@ -1194,9 +1210,10 @@ static void test_attr_mult_read()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_delete()
+static void
+test_attr_delete()
{
- H5std_string attr_name; // Buffer for attribute names
+ H5std_string attr_name; // Buffer for attribute names
// Output message about test being performed
SUBTEST("Removing Attribute Function");
@@ -1218,7 +1235,7 @@ static void test_attr_delete()
// Verify the name of the only file attribute left
Attribute fattr = fid1.openAttribute((unsigned)0);
- attr_name = fattr.getName();
+ attr_name = fattr.getName();
verify_val(attr_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
fattr.close();
@@ -1236,10 +1253,12 @@ static void test_attr_delete()
dataset.removeAttr("Bogus");
// continuation here, that means no exception has been thrown
- throw InvalidActionException("DataSet::removeAttr", "Attempting to remove non-existing attribute");
+ throw InvalidActionException("DataSet::removeAttr",
+ "Attempting to remove non-existing attribute");
}
- catch (AttributeIException& E) // catching invalid removing attribute
- {} // do nothing, exception expected
+ catch (AttributeIException &E) // catching invalid removing attribute
+ {
+ } // do nothing, exception expected
// Test deleting dataset's attributes
@@ -1299,13 +1318,11 @@ static void test_attr_delete()
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_delete()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_delete()
+} // test_attr_delete()
-
/*-------------------------------------------------------------------------
* Function: test_attr_dtype_shared
*
@@ -1314,14 +1331,15 @@ static void test_attr_delete()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_dtype_shared()
+static void
+test_attr_dtype_shared()
{
- int data=8; // Data to write
- int rdata=0; // Data read in
+ int data = 8; // Data to write
+ int rdata = 0; // Data read in
#ifndef H5_NO_DEPRECATED_SYMBOLS
- H5G_stat_t statbuf; // Object's information
+ H5G_stat_t statbuf; // Object's information
#endif
- h5_stat_size_t filesize; // Size of file after modifications
+ h5_stat_size_t filesize; // Size of file after modifications
// Output message about test being performed
SUBTEST("Shared Datatypes with Attributes");
@@ -1334,7 +1352,7 @@ static void test_attr_dtype_shared()
fid1.close();
// Get size of file
- h5_stat_size_t empty_filesize; // Size of empty file
+ h5_stat_size_t empty_filesize; // Size of empty file
empty_filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT);
if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
@@ -1347,67 +1365,68 @@ static void test_attr_dtype_shared()
// scope, causing incorrect number of ref counts.
{ // First enclosed block
- // Create a datatype to commit and use
- IntType dtype(PredType::NATIVE_INT);
+ // Create a datatype to commit and use
+ IntType dtype(PredType::NATIVE_INT);
- // Commit datatype to file
- dtype.commit(fid1, TYPE1_NAME);
+ // Commit datatype to file
+ dtype.commit(fid1, TYPE1_NAME);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 1, "DataType::getObjinfo", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 1, "DataType::getObjinfo", __LINE__, __FILE__);
#endif
- // Create dataspace for dataset
- DataSpace dspace;
+ // Create dataspace for dataset
+ DataSpace dspace;
- DataSet dset = fid1.createDataSet(DSET1_NAME, dtype, dspace);
+ DataSet dset = fid1.createDataSet(DSET1_NAME, dtype, dspace);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 2, "H5File::getObjinfo", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 2, "H5File::getObjinfo", __LINE__, __FILE__);
#endif
- // Create attribute on dataset
- Attribute attr = dset.createAttribute(ATTR1_NAME,dtype,dspace);
+ // Create attribute on dataset
+ Attribute attr = dset.createAttribute(ATTR1_NAME, dtype, dspace);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 3, "DataSet::getObjinfo", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 3, "DataSet::getObjinfo", __LINE__, __FILE__);
#endif
- // Close attribute
- attr.close();
+ // Close attribute
+ attr.close();
- // Delete attribute
- dset.removeAttr(ATTR1_NAME);
+ // Delete attribute
+ dset.removeAttr(ATTR1_NAME);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 2, "DataSet::getObjinfo after DataSet::removeAttr", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 2, "DataSet::getObjinfo after DataSet::removeAttr", __LINE__,
+ __FILE__);
#endif
- // Create attribute on dataset
- attr = dset.createAttribute(ATTR1_NAME,dtype,dspace);
+ // Create attribute on dataset
+ attr = dset.createAttribute(ATTR1_NAME, dtype, dspace);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 3, "DataSet::createAttribute", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 3, "DataSet::createAttribute", __LINE__, __FILE__);
#endif
- // Write data into the attribute
- attr.write(PredType::NATIVE_INT,&data);
+ // Write data into the attribute
+ attr.write(PredType::NATIVE_INT, &data);
- // Close attribute, dataset, dataspace, datatype, and file
- attr.close();
- dset.close();
- dspace.close();
- dtype.close();
+ // Close attribute, dataset, dataspace, datatype, and file
+ attr.close();
+ dset.close();
+ dspace.close();
+ dtype.close();
} // end of first enclosing
fid1.close();
@@ -1417,24 +1436,24 @@ static void test_attr_dtype_shared()
{ // Second enclosed block...
- // Open dataset
- DataSet *dset2 = new DataSet (fid1.openDataSet(DSET1_NAME));
+ // Open dataset
+ DataSet *dset2 = new DataSet(fid1.openDataSet(DSET1_NAME));
- // Open attribute
- Attribute *attr2 = new Attribute (dset2->openAttribute(ATTR1_NAME));
+ // Open attribute
+ Attribute *attr2 = new Attribute(dset2->openAttribute(ATTR1_NAME));
- // Read data from the attribute
- attr2->read(PredType::NATIVE_INT, &rdata);
- verify_val(data, rdata, "Attribute::read", __LINE__, __FILE__);
+ // Read data from the attribute
+ attr2->read(PredType::NATIVE_INT, &rdata);
+ verify_val(data, rdata, "Attribute::read", __LINE__, __FILE__);
- // Close attribute and dataset
- delete attr2;
- delete dset2;
+ // Close attribute and dataset
+ delete attr2;
+ delete dset2;
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 3, "DataSet::openAttribute", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 3, "DataSet::openAttribute", __LINE__, __FILE__);
#endif
} // end of second enclosing
@@ -1458,15 +1477,13 @@ static void test_attr_dtype_shared()
verify_val((long)filesize, (long)empty_filesize, "Checking file size", __LINE__, __FILE__);
PASSED();
- } // end try block
+ } // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_dtype_shared()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_dtype_shared()
+} // test_attr_dtype_shared()
-
/*-------------------------------------------------------------------------
* Function: test_string_attr
*
@@ -1480,9 +1497,10 @@ const H5std_string ATTR1_FL_STR_NAME("String_attr 1");
const H5std_string ATTR2_FL_STR_NAME("String_attr 2");
const H5std_string ATTR_VL_STR_NAME("String_attr");
const H5std_string ATTRSTR_DATA("String Attribute");
-const int ATTR_LEN = 17;
+const int ATTR_LEN = 17;
-static void test_string_attr()
+static void
+test_string_attr()
{
// Output message about test being performed
SUBTEST("I/O on FL and VL String Attributes");
@@ -1501,7 +1519,7 @@ static void test_string_attr()
Group root = fid1.openGroup("/");
// Create dataspace for the attribute.
- DataSpace att_space (H5S_SCALAR);
+ DataSpace att_space(H5S_SCALAR);
/* Test Attribute::write(...,const void *buf) with Fixed len string */
@@ -1524,18 +1542,20 @@ static void test_string_attr()
// Read and verify the attribute string as a string of chars.
char flstring_att_check[ATTR_LEN];
gr_flattr1.read(fls_type, flstring_att_check);
- if(HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), flstring_att_check);
+ if (HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str()) != 0)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",
+ __LINE__, ATTRSTR_DATA.c_str(), flstring_att_check);
// Read and verify the attribute string as a string of chars; buffer
// is dynamically allocated.
size_t attr_size = gr_flattr1.getInMemDataSize();
- char *fl_dyn_string_att_check;
- fl_dyn_string_att_check = new char[attr_size+1];
+ char * fl_dyn_string_att_check;
+ fl_dyn_string_att_check = new char[attr_size + 1];
gr_flattr1.read(fls_type, fl_dyn_string_att_check);
- if(HDstrcmp(fl_dyn_string_att_check, ATTRSTR_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), fl_dyn_string_att_check);
- delete []fl_dyn_string_att_check;
+ if (HDstrcmp(fl_dyn_string_att_check, ATTRSTR_DATA.c_str()) != 0)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",
+ __LINE__, ATTRSTR_DATA.c_str(), fl_dyn_string_att_check);
+ delete[] fl_dyn_string_att_check;
/* Test Attribute::read(...,H5std_string& strg) with FL string */
@@ -1543,13 +1563,15 @@ static void test_string_attr()
H5std_string read_flstr1;
gr_flattr1.read(fls_type, read_flstr1);
if (read_flstr1 != ATTRSTR_DATA)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_flstr1=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_flstr1.c_str());
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_flstr1=%s\n", __LINE__,
+ ATTRSTR_DATA.c_str(), read_flstr1.c_str());
// Read and verify the attribute string as a string of chars.
HDstrcpy(flstring_att_check, "");
gr_flattr2.read(fls_type, flstring_att_check);
- if(HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), flstring_att_check);
+ if (HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str()) != 0)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",
+ __LINE__, ATTRSTR_DATA.c_str(), flstring_att_check);
/* Test Attribute::read(...,H5std_string& strg) with FL string */
@@ -1557,7 +1579,8 @@ static void test_string_attr()
H5std_string read_flstr2;
gr_flattr2.read(fls_type, read_flstr2);
if (read_flstr2 != ATTRSTR_DATA)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_flstr2=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_flstr2.c_str());
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_flstr2=%s\n", __LINE__,
+ ATTRSTR_DATA.c_str(), read_flstr2.c_str());
//
// Variable-lenth string attributes
@@ -1575,8 +1598,9 @@ static void test_string_attr()
// Read and verify the attribute string as a string of chars.
char *string_att_check;
gr_vlattr.read(vls_type, &string_att_check);
- if(HDstrcmp(string_att_check, ATTRSTR_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), string_att_check);
+ if (HDstrcmp(string_att_check, ATTRSTR_DATA.c_str()) != 0)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n",
+ __LINE__, ATTRSTR_DATA.c_str(), string_att_check);
HDfree(string_att_check);
/* Test Attribute::read(...,H5std_string& strg) with VL string */
@@ -1584,17 +1608,16 @@ static void test_string_attr()
H5std_string read_str;
gr_vlattr.read(vls_type, read_str);
if (read_str != ATTRSTR_DATA)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_str=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_str.c_str());
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_str=%s\n", __LINE__,
+ ATTRSTR_DATA.c_str(), read_str.c_str());
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_string_attr()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_string_attr()
+} // test_string_attr()
-
/*-------------------------------------------------------------------------
* Function: test_attr_exists
*
@@ -1606,7 +1629,8 @@ static void test_string_attr()
* Additional attrExists tests are in test_attr_rename().
*-------------------------------------------------------------------------
*/
-static void test_attr_exists()
+static void
+test_attr_exists()
{
// Output message about test being performed
SUBTEST("Check Attribute Existence");
@@ -1621,12 +1645,14 @@ static void test_attr_exists()
// Check for existence of attribute
bool attr_exists = fid1.attrExists(ATTR1_FL_STR_NAME);
if (attr_exists == false)
- throw InvalidActionException("H5File::attrExists", "fid1, ATTR1_FL_STR_NAMEAttribute should exist but does not");
+ throw InvalidActionException("H5File::attrExists",
+ "fid1, ATTR1_FL_STR_NAMEAttribute should exist but does not");
// Check for existence of attribute
attr_exists = fid1.attrExists(FATTR1_NAME);
if (attr_exists == false)
- throw InvalidActionException("H5File::attrExists", "fid1,FATTR2_NAMEAttribute should exist but does not");
+ throw InvalidActionException("H5File::attrExists",
+ "fid1,FATTR2_NAMEAttribute should exist but does not");
// Open a group.
Group group = fid1.openGroup(GROUP1_NAME);
@@ -1634,22 +1660,20 @@ static void test_attr_exists()
// Check for existence of attribute
attr_exists = group.attrExists(ATTR2_NAME);
if (attr_exists == false)
- throw InvalidActionException("H5File::attrExists", "group, ATTR2_NAMEAttribute should exist but does not");
+ throw InvalidActionException("H5File::attrExists",
+ "group, ATTR2_NAMEAttribute should exist but does not");
PASSED();
} // end try block
- catch (InvalidActionException& E)
- {
+ catch (InvalidActionException &E) {
issue_fail_msg("test_attr_exists()", __LINE__, __FILE__, E.getCDetailMsg());
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_exists()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_exists()
+} // test_attr_exists()
-
/*-------------------------------------------------------------------------
* Function: test_attr_dense_create
*
@@ -1659,25 +1683,25 @@ static void test_attr_exists()
*-------------------------------------------------------------------------
*/
const H5std_string FILE_CRTPROPS("tattr_crt_properties.h5");
-const int NAME_BUF_SIZE = 1024;
-const unsigned MAX_COMPACT_DEF = 8;
-const unsigned MIN_DENSE_DEF = 6;
+const int NAME_BUF_SIZE = 1024;
+const unsigned MAX_COMPACT_DEF = 8;
+const unsigned MIN_DENSE_DEF = 6;
-static void test_attr_dense_create(FileCreatPropList& fcpl,
- FileAccPropList& fapl)
+static void
+test_attr_dense_create(FileCreatPropList &fcpl, FileAccPropList &fapl)
{
// Output message about test being performed
SUBTEST("Dense Attribute Storage Creation");
try {
// Create file
- H5File fid1 (FILE_CRTPROPS, H5F_ACC_TRUNC, fcpl, fapl);
+ H5File fid1(FILE_CRTPROPS, H5F_ACC_TRUNC, fcpl, fapl);
// Close file
fid1.close();
// Get size of file
- h5_stat_size_t empty_filesize; // Size of empty file
+ h5_stat_size_t empty_filesize; // Size of empty file
empty_filesize = h5_get_file_size(FILE_CRTPROPS.c_str(), fapl.getId());
if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
@@ -1698,16 +1722,18 @@ static void test_attr_dense_create(FileCreatPropList& fcpl,
// Retrieve limits for compact/dense attribute storage
dcpl.getAttrPhaseChange(max_compact, min_dense);
- verify_val(max_compact, MAX_COMPACT_DEF, "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__);
- verify_val(min_dense, MIN_DENSE_DEF, "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__);
+ verify_val(max_compact, MAX_COMPACT_DEF, "DSetCreatPropList::getAttrPhaseChange", __LINE__, __FILE__);
+ verify_val(min_dense, MIN_DENSE_DEF, "DSetCreatPropList::getAttrPhaseChange", __LINE__, __FILE__);
// Set new compact/dense attribute storage limits to some random numbers
dcpl.setAttrPhaseChange(7, 5);
// Retrieve limits for compact/dense attribute storage and verify them
dcpl.getAttrPhaseChange(max_compact, min_dense);
- verify_val(max_compact, static_cast<unsigned>(7), "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__);
- verify_val(min_dense, static_cast<unsigned>(5), "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__);
+ verify_val(max_compact, static_cast<unsigned>(7), "DSetCreatPropList::getAttrPhaseChange", __LINE__,
+ __FILE__);
+ verify_val(min_dense, static_cast<unsigned>(5), "DSetCreatPropList::getAttrPhaseChange", __LINE__,
+ __FILE__);
// Close property list
dcpl.close();
@@ -1715,10 +1741,9 @@ static void test_attr_dense_create(FileCreatPropList& fcpl,
// H5O__is_attr_dense_test - un-usable
// Add attributes, until just before converting to dense storage
- char attr_name[NAME_BUF_SIZE];
+ char attr_name[NAME_BUF_SIZE];
unsigned attr_num;
- for (attr_num = 0; attr_num < max_compact; attr_num++)
- {
+ for (attr_num = 0; attr_num < max_compact; attr_num++) {
// Create attribute
sprintf(attr_name, "attr %02u", attr_num);
Attribute attr = dataset.createAttribute(attr_name, PredType::NATIVE_UINT, ds_space);
@@ -1740,28 +1765,27 @@ static void test_attr_dense_create(FileCreatPropList& fcpl,
}
// Attempt to add attribute again, which should fail
- try
- {
+ try {
// Create another attribute
sprintf(attr_name, "attr %02u", attr_num);
Attribute attr = dataset.createAttribute(attr_name, PredType::NATIVE_UINT, ds_space);
// continuation here, that means no exception has been thrown
- throw InvalidActionException("DataSet::createAttribute", "Maximum number of attributes has been reached");
+ throw InvalidActionException("DataSet::createAttribute",
+ "Maximum number of attributes has been reached");
}
- catch (AttributeIException& E) // catching invalid action
- {} // do nothing, exception expected
+ catch (AttributeIException &E) // catching invalid action
+ {
+ } // do nothing, exception expected
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_dense_create()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_dense_create()
+} // test_attr_dense_create()
-
/*-------------------------------------------------------------------------
* Function: test_attr_corder_create_basic
*
@@ -1770,23 +1794,23 @@ static void test_attr_dense_create(FileCreatPropList& fcpl,
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_corder_create_basic(FileCreatPropList& fcpl,
- FileAccPropList& fapl)
+static void
+test_attr_corder_create_basic(FileCreatPropList &fcpl, FileAccPropList &fapl)
{
// Output message about test being performed
SUBTEST("Basic Code for Attributes with Creation Order Info");
try {
// Create file
- H5File fid1 (FILE_CRTPROPS, H5F_ACC_TRUNC, fcpl, fapl);
+ H5File fid1(FILE_CRTPROPS, H5F_ACC_TRUNC, fcpl, fapl);
// Create dataset creation property list.
DSetCreatPropList dcpl;
// Get creation order indexing on object
unsigned crt_order_flags = 0;
- crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, (unsigned)0, "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
+ crt_order_flags = dcpl.getAttrCrtOrder();
+ verify_val(crt_order_flags, (unsigned)0, "DSetCreatPropList::getAttrCrtOrder", __LINE__, __FILE__);
// Setting invalid combination of a attribute order creation order
// indexing on should fail
@@ -1794,16 +1818,19 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl,
dcpl.setAttrCrtOrder(H5P_CRT_ORDER_INDEXED);
// continuation here, that means no exception has been thrown
- throw InvalidActionException("DSetCreatPropList::getAttrCrtOrder", "Indexing cannot be set alone, order tracking is required");
+ throw InvalidActionException("DSetCreatPropList::getAttrCrtOrder",
+ "Indexing cannot be set alone, order tracking is required");
}
- catch (PropListIException& E) // catching invalid action
- {} // do nothing, exception expected
+ catch (PropListIException &E) // catching invalid action
+ {
+ } // do nothing, exception expected
// Set attribute creation order tracking & indexing for object then
// verify them
dcpl.setAttrCrtOrder(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED);
crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
+ verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED),
+ "DSetCreatPropList::getAttrCrtOrder", __LINE__, __FILE__);
// Create dataspace for dataset
DataSpace ds_space(H5S_SCALAR);
@@ -1838,18 +1865,17 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl,
// Query the attribute creation properties
crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
+ verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED),
+ "DSetCreatPropList::getAttrCrtOrder", __LINE__, __FILE__);
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_corder_create_basic()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_corder_create_basic()
+} // test_attr_corder_create_basic()
-
/*-------------------------------------------------------------------------
* Function: test_attr
*
@@ -1858,14 +1884,13 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl,
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_attr()
+extern "C" void
+test_attr()
{
// Output message about test being performed
MESSAGE(5, ("Testing Attributes\n"));
- try
- {
+ try {
// Create a default file access property list
FileAccPropList fapl;
@@ -1887,45 +1912,41 @@ void test_attr()
// Loop over using new group format
unsigned new_format;
- for (new_format = FALSE; new_format <= TRUE; new_format++)
- {
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
FileAccPropList curr_fapl;
// Set the file access proplist for the type of format
- if (new_format)
- {
+ if (new_format) {
MESSAGE(7, ("testing with new file format\n"));
curr_fapl = fapl_new;
}
- else
- {
+ else {
MESSAGE(7, ("testing with old file format\n"));
curr_fapl = fapl;
}
- test_attr_basic_write(); // Test basic H5A writing code
- test_attr_getname(); // Test overloads of Attribute::getName
- test_attr_rename(); // Test renaming attribute
- test_attr_basic_read(); // Test basic H5A reading code
+ test_attr_basic_write(); // Test basic H5A writing code
+ test_attr_getname(); // Test overloads of Attribute::getName
+ test_attr_rename(); // Test renaming attribute
+ test_attr_basic_read(); // Test basic H5A reading code
test_attr_compound_write(); // Test complex datatype H5A writing code
test_attr_compound_read(); // Test complex datatype H5A reading code
- test_attr_scalar_write(); // Test scalar dataspace H5A writing code
- test_attr_scalar_read(); // Test scalar dataspace H5A reading code
+ test_attr_scalar_write(); // Test scalar dataspace H5A writing code
+ test_attr_scalar_read(); // Test scalar dataspace H5A reading code
- test_attr_mult_write(); // Test writing multiple attributes
- test_attr_mult_read(); // Test reading multiple attributes
- test_attr_delete(); // Test deleting attributes
+ test_attr_mult_write(); // Test writing multiple attributes
+ test_attr_mult_read(); // Test reading multiple attributes
+ test_attr_delete(); // Test deleting attributes
- test_attr_dtype_shared(); // Test using shared datatypes in attributes
+ test_attr_dtype_shared(); // Test using shared datatypes in attributes
- test_string_attr(); // Test read/write string attribute
- test_attr_exists(); // Test H5Location::attrExists
+ test_string_attr(); // Test read/write string attribute
+ test_attr_exists(); // Test H5Location::attrExists
// Test with new format
- if (new_format)
- {
+ if (new_format) {
// Test dense attribute storage creation
test_attr_dense_create(fcpl, curr_fapl);
@@ -1933,15 +1954,13 @@ void test_attr()
test_attr_corder_create_basic(fcpl, curr_fapl);
}
} // end for
- } // end try block
+ } // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr()
+} // test_attr()
-
/*-------------------------------------------------------------------------
* Function: cleanup_attr
*
@@ -1950,8 +1969,8 @@ void test_attr()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_attr()
+extern "C" void
+cleanup_attr()
{
HDremove(FILE_BASIC.c_str());
HDremove(FILE_COMPOUND.c_str());
@@ -1960,4 +1979,3 @@ void cleanup_attr()
HDremove(FILE_DTYPE.c_str());
HDremove(FILE_CRTPROPS.c_str());
}
-
diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp
index ec8adf0..7b48a78 100644
--- a/c++/test/tcompound.cpp
+++ b/c++/test/tcompound.cpp
@@ -25,21 +25,20 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
/* Number of elements in each test */
#define NTESTELEM 100000
typedef struct complex_t {
- double re;
- double im;
+ double re;
+ double im;
} complex_t;
-
/*-------------------------------------------------------------------------
* Function: test_compound_1
*
@@ -51,7 +50,8 @@ typedef struct complex_t {
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_compound_1()
+static void
+test_compound_1()
{
// Output message about test being performed
SUBTEST("Compound Data Types");
@@ -63,15 +63,13 @@ static void test_compound_1()
complex_type.insertMember("real", HOFFSET(complex_t, re), PredType::NATIVE_DOUBLE);
complex_type.insertMember("imaginary", HOFFSET(complex_t, im), PredType::NATIVE_DOUBLE);
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_compound_1()
+} // test_compound_1()
-
/*-------------------------------------------------------------------------
* Function: test_compound_2
*
@@ -85,7 +83,8 @@ static void test_compound_1()
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_compound_2()
+static void
+test_compound_2()
{
typedef struct {
int a, b, c[4], d, e;
@@ -94,33 +93,33 @@ static void test_compound_2()
int e, d, c[4], b, a;
} dst_typ_t;
- src_typ_t *s_ptr;
- dst_typ_t *d_ptr;
- const int nelmts = NTESTELEM;
- const hsize_t four = 4;
- int i;
+ src_typ_t * s_ptr;
+ dst_typ_t * d_ptr;
+ const int nelmts = NTESTELEM;
+ const hsize_t four = 4;
+ int i;
unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
- ArrayType *array_dt = NULL;
+ ArrayType * array_dt = NULL;
// Output message about test being performed
SUBTEST("Compound Element Reordering");
try {
// Sizes should be the same, but be careful just in case
- buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- s_ptr->c[0] = i*8+2;
- s_ptr->c[1] = i*8+3;
- s_ptr->c[2] = i*8+4;
- s_ptr->c[3] = i*8+5;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
+ buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
+ bkg = (unsigned char *)HDmalloc(nelmts * sizeof(dst_typ_t));
+ orig = (unsigned char *)HDmalloc(nelmts * sizeof(src_typ_t));
+ for (i = 0; i < nelmts; i++) {
+ s_ptr = ((src_typ_t *)orig) + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = i * 8 + 1;
+ s_ptr->c[0] = i * 8 + 2;
+ s_ptr->c[1] = i * 8 + 3;
+ s_ptr->c[2] = i * 8 + 4;
+ s_ptr->c[3] = i * 8 + 5;
+ s_ptr->d = i * 8 + 6;
+ s_ptr->e = i * 8 + 7;
}
- memcpy(buf, orig, nelmts*sizeof(src_typ_t));
+ memcpy(buf, orig, nelmts * sizeof(src_typ_t));
// Build hdf5 datatypes
array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
@@ -150,29 +149,22 @@ static void test_compound_2()
st.convert(dt, (size_t)nelmts, buf, bkg);
// Compare results
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- d_ptr = ((dst_typ_t*)buf) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->b != d_ptr->b ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->d != d_ptr->d ||
- s_ptr->e != d_ptr->e) {
+ for (i = 0; i < nelmts; i++) {
+ s_ptr = ((src_typ_t *)orig) + i;
+ d_ptr = ((dst_typ_t *)buf) + i;
+ if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] ||
+ s_ptr->c[1] != d_ptr->c[1] || s_ptr->c[2] != d_ptr->c[2] || s_ptr->c[3] != d_ptr->c[3] ||
+ s_ptr->d != d_ptr->d || s_ptr->e != d_ptr->e) {
H5_FAILED();
cerr << " i=" << i << endl;
- cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b
- << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << ","
- << s_ptr->c[2] << "," << s_ptr->c[3] << ", d="
- << s_ptr->d << ", e=" << s_ptr->e << "}" << endl;
- cerr << " dst={a=" << s_ptr->a << ", b=" << s_ptr->b
- << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << ","
- << s_ptr->c[2] << "," << s_ptr->c[3] << ", d="
- << s_ptr->d << ", e=" << s_ptr->e << "}" << endl;
- }
+ cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b << "c=[" << s_ptr->c[0] << ","
+ << s_ptr->c[1] << "," << s_ptr->c[2] << "," << s_ptr->c[3] << ", d=" << s_ptr->d
+ << ", e=" << s_ptr->e << "}" << endl;
+ cerr << " dst={a=" << s_ptr->a << ", b=" << s_ptr->b << "c=[" << s_ptr->c[0] << ","
+ << s_ptr->c[1] << "," << s_ptr->c[2] << "," << s_ptr->c[3] << ", d=" << s_ptr->d
+ << ", e=" << s_ptr->e << "}" << endl;
}
+ }
// Release resources
HDfree(buf);
HDfree(bkg);
@@ -182,18 +174,16 @@ static void test_compound_2()
st.close();
dt.close();
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
- if(array_dt)
+ if (array_dt)
delete array_dt;
-} // test_compound_2()
+} // test_compound_2()
-
/*-------------------------------------------------------------------------
* Function: test_compound_3
*
@@ -207,42 +197,43 @@ static void test_compound_2()
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_compound_3()
+static void
+test_compound_3()
{
typedef struct {
int a, b, c[4], d, e;
} src_typ_t;
typedef struct {
- int a, c[4], e;
+ int a, c[4], e;
} dst_typ_t;
- src_typ_t *s_ptr;
- dst_typ_t *d_ptr;
- int i;
- const int nelmts = NTESTELEM;
- const hsize_t four = 4;
+ src_typ_t * s_ptr;
+ dst_typ_t * d_ptr;
+ int i;
+ const int nelmts = NTESTELEM;
+ const hsize_t four = 4;
unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
- ArrayType* array_dt = NULL;
+ ArrayType * array_dt = NULL;
// Output message about test being performed
SUBTEST("Compound Datatype Subset Conversions");
try {
/* Initialize */
- buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- s_ptr->c[0] = i*8+2;
- s_ptr->c[1] = i*8+3;
- s_ptr->c[2] = i*8+4;
- s_ptr->c[3] = i*8+5;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
+ buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
+ bkg = (unsigned char *)HDmalloc(nelmts * sizeof(dst_typ_t));
+ orig = (unsigned char *)HDmalloc(nelmts * sizeof(src_typ_t));
+ for (i = 0; i < nelmts; i++) {
+ s_ptr = ((src_typ_t *)orig) + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = i * 8 + 1;
+ s_ptr->c[0] = i * 8 + 2;
+ s_ptr->c[1] = i * 8 + 3;
+ s_ptr->c[2] = i * 8 + 4;
+ s_ptr->c[3] = i * 8 + 5;
+ s_ptr->d = i * 8 + 6;
+ s_ptr->e = i * 8 + 7;
}
- memcpy(buf, orig, nelmts*sizeof(src_typ_t));
+ memcpy(buf, orig, nelmts * sizeof(src_typ_t));
/* Build hdf5 datatypes */
array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
@@ -270,27 +261,20 @@ static void test_compound_3()
st.convert(dt, (size_t)nelmts, buf, bkg);
/* Compare results */
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- d_ptr = ((dst_typ_t*)buf) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->e != d_ptr->e) {
+ for (i = 0; i < nelmts; i++) {
+ s_ptr = ((src_typ_t *)orig) + i;
+ d_ptr = ((dst_typ_t *)buf) + i;
+ if (s_ptr->a != d_ptr->a || s_ptr->c[0] != d_ptr->c[0] || s_ptr->c[1] != d_ptr->c[1] ||
+ s_ptr->c[2] != d_ptr->c[2] || s_ptr->c[3] != d_ptr->c[3] || s_ptr->e != d_ptr->e) {
H5_FAILED();
cerr << " i=" << i << endl;
- cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b
- << ", c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << ","
- << s_ptr->c[2] << "," << s_ptr->c[3] << "], d="
- << s_ptr->d << ", e=" << s_ptr->e << "}" << endl;
- cerr << " dst={a=" << d_ptr->a
- << ", c=[" << d_ptr->c[0] << "," << d_ptr->c[1] << ","
- << d_ptr->c[2] << "," << d_ptr->c[3] << "], e="
- << d_ptr->e << "}" << endl;
+ cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b << ", c=[" << s_ptr->c[0] << ","
+ << s_ptr->c[1] << "," << s_ptr->c[2] << "," << s_ptr->c[3] << "], d=" << s_ptr->d
+ << ", e=" << s_ptr->e << "}" << endl;
+ cerr << " dst={a=" << d_ptr->a << ", c=[" << d_ptr->c[0] << "," << d_ptr->c[1] << ","
+ << d_ptr->c[2] << "," << d_ptr->c[3] << "], e=" << d_ptr->e << "}" << endl;
} // if
- } // for
+ } // for
/* Release resources */
HDfree(buf);
@@ -301,18 +285,16 @@ static void test_compound_3()
st.close();
dt.close();
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
- if(array_dt)
+ if (array_dt)
delete array_dt;
-} // test_compound_3()
+} // test_compound_3()
-
/*-------------------------------------------------------------------------
* Function: test_compound_4
*
@@ -326,7 +308,8 @@ static void test_compound_3()
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_compound_4()
+static void
+test_compound_4()
{
typedef struct {
@@ -335,38 +318,38 @@ static void test_compound_4()
typedef struct {
short b;
- int a, c[4];
+ int a, c[4];
short d;
- int e;
+ int e;
} dst_typ_t;
- src_typ_t *s_ptr;
- dst_typ_t *d_ptr;
- int i;
- const int nelmts = NTESTELEM;
- const hsize_t four = 4;
+ src_typ_t * s_ptr;
+ dst_typ_t * d_ptr;
+ int i;
+ const int nelmts = NTESTELEM;
+ const hsize_t four = 4;
unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
- ArrayType* array_dt = NULL;
+ ArrayType * array_dt = NULL;
// Output message about test being performed
SUBTEST("Compound Element Shrinking & Reordering");
try {
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- s_ptr->a = i*8+0;
- s_ptr->b = (i*8+1) & 0x7fff;
- s_ptr->c[0] = i*8+2;
- s_ptr->c[1] = i*8+3;
- s_ptr->c[2] = i*8+4;
- s_ptr->c[3] = i*8+5;
- s_ptr->d = (i*8+6) & 0x7fff;
- s_ptr->e = i*8+7;
+ buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
+ bkg = (unsigned char *)HDmalloc(nelmts * sizeof(dst_typ_t));
+ orig = (unsigned char *)HDmalloc(nelmts * sizeof(src_typ_t));
+ for (i = 0; i < nelmts; i++) {
+ s_ptr = ((src_typ_t *)orig) + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = (i * 8 + 1) & 0x7fff;
+ s_ptr->c[0] = i * 8 + 2;
+ s_ptr->c[1] = i * 8 + 3;
+ s_ptr->c[2] = i * 8 + 4;
+ s_ptr->c[3] = i * 8 + 5;
+ s_ptr->d = (i * 8 + 6) & 0x7fff;
+ s_ptr->e = i * 8 + 7;
}
- memcpy(buf, orig, nelmts*sizeof(src_typ_t));
+ memcpy(buf, orig, nelmts * sizeof(src_typ_t));
/* Build hdf5 datatypes */
array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
@@ -396,30 +379,22 @@ static void test_compound_4()
st.convert(dt, (size_t)nelmts, buf, bkg);
/* Compare results */
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- d_ptr = ((dst_typ_t*)buf) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->b != d_ptr->b ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->d != d_ptr->d ||
- s_ptr->e != d_ptr->e)
- {
+ for (i = 0; i < nelmts; i++) {
+ s_ptr = ((src_typ_t *)orig) + i;
+ d_ptr = ((dst_typ_t *)buf) + i;
+ if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] ||
+ s_ptr->c[1] != d_ptr->c[1] || s_ptr->c[2] != d_ptr->c[2] || s_ptr->c[3] != d_ptr->c[3] ||
+ s_ptr->d != d_ptr->d || s_ptr->e != d_ptr->e) {
H5_FAILED();
cerr << " i=" << i << endl;
- cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b
- << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << ","
- << s_ptr->c[2] << "," << s_ptr->c[3] << ", d="
- << s_ptr->d << ", e=" << s_ptr->e << "}" << endl;
- cerr << " dst={a=" << d_ptr->a << ", b=" << d_ptr->b
- << "c=[" << d_ptr->c[0] << "," << d_ptr->c[1] << ","
- << d_ptr->c[2] << "," << d_ptr->c[3] << ", d="
- << d_ptr->d << ", e=" << d_ptr->e << "}" << endl;
+ cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b << "c=[" << s_ptr->c[0] << ","
+ << s_ptr->c[1] << "," << s_ptr->c[2] << "," << s_ptr->c[3] << ", d=" << s_ptr->d
+ << ", e=" << s_ptr->e << "}" << endl;
+ cerr << " dst={a=" << d_ptr->a << ", b=" << d_ptr->b << "c=[" << d_ptr->c[0] << ","
+ << d_ptr->c[1] << "," << d_ptr->c[2] << "," << d_ptr->c[3] << ", d=" << d_ptr->d
+ << ", e=" << d_ptr->e << "}" << endl;
} // if
- } // for
+ } // for
/* Release resources */
HDfree(buf);
@@ -430,18 +405,16 @@ static void test_compound_4()
st.close();
dt.close();
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
- if(array_dt)
+ if (array_dt)
delete array_dt;
-} // test_compound_4()
+} // test_compound_4()
-
/*-------------------------------------------------------------------------
* Function: test_compound_5
*
@@ -456,27 +429,27 @@ static void test_compound_4()
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_compound_5()
+static void
+test_compound_5()
{
typedef struct {
- char name[16];
- short tdim;
- short coll_ids[4];
+ char name[16];
+ short tdim;
+ short coll_ids[4];
} src_typ_t;
typedef struct {
- char name[16];
- short tdim;
- int coll_ids[4];
+ char name[16];
+ short tdim;
+ int coll_ids[4];
} dst_typ_t;
- hsize_t dims[1] = {4};
- src_typ_t src[2] = {{"one", 102, {104, 105, 106, 107}},
- {"two", 202, {204, 205, 206, 207}}};
- dst_typ_t *dst;
- void *buf = HDcalloc(2, sizeof(dst_typ_t));
- void *bkg = HDcalloc(2, sizeof(dst_typ_t));
- ArrayType* array_dt = NULL;
+ hsize_t dims[1] = {4};
+ src_typ_t src[2] = {{"one", 102, {104, 105, 106, 107}}, {"two", 202, {204, 205, 206, 207}}};
+ dst_typ_t *dst;
+ void * buf = HDcalloc(2, sizeof(dst_typ_t));
+ void * bkg = HDcalloc(2, sizeof(dst_typ_t));
+ ArrayType *array_dt = NULL;
// Output message about test being performed
SUBTEST("Optimized Struct Converter");
@@ -484,17 +457,17 @@ static void test_compound_5()
/* Build datatypes */
array_dt = new ArrayType(PredType::NATIVE_SHORT, 1, dims);
- CompType short_array(4*sizeof(short));
+ CompType short_array(4 * sizeof(short));
short_array.insertMember("_", 0, *array_dt);
array_dt->close();
delete array_dt;
- CompType int_array(4*sizeof(int));
+ CompType int_array(4 * sizeof(int));
array_dt = new ArrayType(PredType::NATIVE_INT, 1, dims);
int_array.insertMember("_", 0, *array_dt);
array_dt->close();
- StrType strg(PredType::C_S1, 16);
+ StrType strg(PredType::C_S1, 16);
CompType src_type(sizeof(src_typ_t));
src_type.insertMember("name", HOFFSET(src_typ_t, name), strg);
src_type.insertMember("tdim", HOFFSET(src_typ_t, tdim), PredType::NATIVE_SHORT);
@@ -508,7 +481,7 @@ static void test_compound_5()
/* Convert data */
memcpy(buf, src, sizeof(src));
src_type.convert(dst_type, (size_t)2, buf, bkg);
- dst = (dst_typ_t*)buf;
+ dst = (dst_typ_t *)buf;
/* Cleanup */
src_type.close();
@@ -518,31 +491,27 @@ static void test_compound_5()
int_array.close();
/* Check results */
- if (memcmp(src[1].name, dst[1].name, sizeof(src[1].name)) ||
- src[1].tdim!=dst[1].tdim ||
- src[1].coll_ids[0]!=dst[1].coll_ids[0] ||
- src[1].coll_ids[1]!=dst[1].coll_ids[1] ||
- src[1].coll_ids[2]!=dst[1].coll_ids[2] ||
- src[1].coll_ids[3]!=dst[1].coll_ids[3])
- { H5_FAILED(); }
+ if (memcmp(src[1].name, dst[1].name, sizeof(src[1].name)) || src[1].tdim != dst[1].tdim ||
+ src[1].coll_ids[0] != dst[1].coll_ids[0] || src[1].coll_ids[1] != dst[1].coll_ids[1] ||
+ src[1].coll_ids[2] != dst[1].coll_ids[2] || src[1].coll_ids[3] != dst[1].coll_ids[3]) {
+ H5_FAILED();
+ }
/* Free memory buffers */
HDfree(buf);
HDfree(bkg);
dst = NULL;
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
- if(array_dt)
+ if (array_dt)
delete array_dt;
-} // test_compound_5()
+} // test_compound_5()
-
/*-------------------------------------------------------------------------
* Function: test_compound_6
*
@@ -556,7 +525,8 @@ static void test_compound_5()
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_compound_6()
+static void
+test_compound_6()
{
typedef struct {
short b;
@@ -568,25 +538,25 @@ static void test_compound_6()
long d;
} dst_typ_t;
- src_typ_t *s_ptr;
- dst_typ_t *d_ptr;
- int i;
- const int nelmts = NTESTELEM;
- unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
+ src_typ_t * s_ptr;
+ dst_typ_t * d_ptr;
+ int i;
+ const int nelmts = NTESTELEM;
+ unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
// Output message about test being performed
SUBTEST("Compound Element Growing");
try {
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- s_ptr->b = (i*8+1) & 0x7fff;
- s_ptr->d = (i*8+6) & 0x7fff;
+ buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
+ bkg = (unsigned char *)HDmalloc(nelmts * sizeof(dst_typ_t));
+ orig = (unsigned char *)HDmalloc(nelmts * sizeof(src_typ_t));
+ for (i = 0; i < nelmts; i++) {
+ s_ptr = ((src_typ_t *)orig) + i;
+ s_ptr->b = (i * 8 + 1) & 0x7fff;
+ s_ptr->d = (i * 8 + 6) & 0x7fff;
}
- memcpy(buf, orig, nelmts*sizeof(src_typ_t));
+ memcpy(buf, orig, nelmts * sizeof(src_typ_t));
/* Build hdf5 datatypes */
CompType st(sizeof(src_typ_t));
@@ -601,20 +571,16 @@ static void test_compound_6()
st.convert(dt, (size_t)nelmts, buf, bkg);
/* Compare results */
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- d_ptr = ((dst_typ_t*)buf) + i;
- if (s_ptr->b != d_ptr->b ||
- s_ptr->d != d_ptr->d)
- {
+ for (i = 0; i < nelmts; i++) {
+ s_ptr = ((src_typ_t *)orig) + i;
+ d_ptr = ((dst_typ_t *)buf) + i;
+ if (s_ptr->b != d_ptr->b || s_ptr->d != d_ptr->d) {
H5_FAILED();
cerr << " i=" << i << endl;
- cerr << " src={b=" << s_ptr->b << ", d=" << s_ptr->d
- << "}" << endl;
- cerr << " dst={b=" << d_ptr->b << ", d=" << d_ptr->d
- << "}" << endl;
+ cerr << " src={b=" << s_ptr->b << ", d=" << s_ptr->d << "}" << endl;
+ cerr << " dst={b=" << d_ptr->b << ", d=" << d_ptr->d << "}" << endl;
} // if
- } // for
+ } // for
/* Release resources */
HDfree(buf);
@@ -625,15 +591,13 @@ static void test_compound_6()
st.close();
dt.close();
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_compound_6()
+} // test_compound_6()
-
/*-------------------------------------------------------------------------
* Function: test_compound_7
*
@@ -646,18 +610,19 @@ static void test_compound_6()
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_compound_7()
+static void
+test_compound_7()
{
typedef struct {
- int a;
+ int a;
float b;
- long c;
+ long c;
} s1_typ_t;
typedef struct {
- int a;
- float b;
- long c;
+ int a;
+ float b;
+ long c;
double d;
} s2_typ_t;
@@ -666,9 +631,9 @@ static void test_compound_7()
try {
CompType tid1(sizeof(s1_typ_t));
- tid1.insertMember("a", HOFFSET(s1_typ_t,a),PredType::NATIVE_INT);
- tid1.insertMember("b", HOFFSET(s1_typ_t,b),PredType::NATIVE_FLOAT);
- tid1.insertMember("c", HOFFSET(s1_typ_t,c),PredType::NATIVE_LONG);
+ tid1.insertMember("a", HOFFSET(s1_typ_t, a), PredType::NATIVE_INT);
+ tid1.insertMember("b", HOFFSET(s1_typ_t, b), PredType::NATIVE_FLOAT);
+ tid1.insertMember("c", HOFFSET(s1_typ_t, c), PredType::NATIVE_LONG);
size_t type_size = tid1.getSize();
verify_val(type_size, sizeof(s1_typ_t), "DataType::getSize", __LINE__, __FILE__);
@@ -683,22 +648,23 @@ static void test_compound_7()
try {
tid2.insertMember("d", HOFFSET(s2_typ_t, d), PredType::NATIVE_DOUBLE);
// Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("CompType::insertMember", "Attempted to insert field past end of compound data type.");
- } catch (DataTypeIException& err) {}
+ throw InvalidActionException("CompType::insertMember",
+ "Attempted to insert field past end of compound data type.");
+ }
+ catch (DataTypeIException &err) {
+ }
/* Release resources */
tid1.close();
tid2.close();
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_compound_7()
+} // test_compound_7()
-
/*-------------------------------------------------------------------------
* Function: test_compound_set_size
*
@@ -712,7 +678,8 @@ static void test_compound_7()
*/
const H5std_string COMPFILE("tcompound_types.h5");
-static void test_compound_set_size()
+static void
+test_compound_set_size()
{
typedef struct {
int a, b, c[4], d, e;
@@ -779,15 +746,13 @@ static void test_compound_set_size()
file.close();
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_compound_set_size()
+} // test_compound_set_size()
-
/*-------------------------------------------------------------------------
* Function: test_compound
*
@@ -799,23 +764,22 @@ static void test_compound_set_size()
* January 2007
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_compound()
+extern "C" void
+test_compound()
{
// Output message about test being performed
MESSAGE(5, ("Testing Compound Data Type operations\n"));
- test_compound_1(); // various things about compound data types
- test_compound_2(); // compound element reordering
- test_compound_3(); // compound datatype subset conversions
- test_compound_4(); // compound element shrinking & reordering
- test_compound_5(); // optimized struct converter
- test_compound_6(); // compound element growing
- test_compound_7(); // compound element insertion
- test_compound_set_size(); // set size on compound data types
-} // test_compound()
-
-
+ test_compound_1(); // various things about compound data types
+ test_compound_2(); // compound element reordering
+ test_compound_3(); // compound datatype subset conversions
+ test_compound_4(); // compound element shrinking & reordering
+ test_compound_5(); // optimized struct converter
+ test_compound_6(); // compound element growing
+ test_compound_7(); // compound element insertion
+ test_compound_set_size(); // set size on compound data types
+} // test_compound()
+
/*-------------------------------------------------------------------------
* Function: cleanup_compound
*
@@ -824,8 +788,8 @@ void test_compound()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_compound()
+extern "C" void
+cleanup_compound()
{
HDremove(COMPFILE.c_str());
-} // cleanup_file
+} // cleanup_file
diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp
index 438f385..4cdf408 100644
--- a/c++/test/tdspl.cpp
+++ b/c++/test/tdspl.cpp
@@ -26,20 +26,21 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
const H5std_string FILENAME("tdatatransform.h5");
-static void test_transfplist()
+static void
+test_transfplist()
{
- const char* c_to_f = "(9/5.0)*x + 32";
- const char* simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
+ const char *c_to_f = "(9/5.0)*x + 32";
+ const char *simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
/* inverses the utrans transform in init_test to get back original array */
- const char* utrans_inv = "(x/3)*4 - 100";
+ const char *utrans_inv = "(x/3)*4 - 100";
SUBTEST("DSetMemXferPropList::set/getDataTransform()");
try {
@@ -63,12 +64,12 @@ static void test_transfplist()
// Find out the length of the transform expression, allocate the buffer
// for it, then read and verify the expression from the copied plist
- ssize_t tran_len = dxpl_c_to_f_copy.getDataTransform(NULL);
- char *c_to_f_read = (char *)HDmalloc(tran_len+1);
- HDmemset(c_to_f_read, 0, tran_len+1);
- dxpl_c_to_f_copy.getDataTransform(c_to_f_read, tran_len+1);
- verify_val((const char*)c_to_f_read, (const char*)c_to_f,
- "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
+ ssize_t tran_len = dxpl_c_to_f_copy.getDataTransform(NULL);
+ char * c_to_f_read = (char *)HDmalloc(tran_len + 1);
+ HDmemset(c_to_f_read, 0, tran_len + 1);
+ dxpl_c_to_f_copy.getDataTransform(c_to_f_read, tran_len + 1);
+ verify_val((const char *)c_to_f_read, (const char *)c_to_f, "DSetMemXferPropList::getDataTransform",
+ __LINE__, __FILE__);
HDfree(c_to_f_read);
//
@@ -78,39 +79,37 @@ static void test_transfplist()
// Get and verify the expression with:
// ssize_t getDataTransform(char* exp, const size_t buf_size [default=0])
- tran_len = dxpl_c_to_f.getDataTransform(NULL);
- c_to_f_read = (char *)HDmalloc(tran_len+1);
- HDmemset(c_to_f_read, 0, tran_len+1);
- dxpl_c_to_f.getDataTransform(c_to_f_read, tran_len+1);
- verify_val((const char*)c_to_f_read, (const char*)c_to_f,
- "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
+ tran_len = dxpl_c_to_f.getDataTransform(NULL);
+ c_to_f_read = (char *)HDmalloc(tran_len + 1);
+ HDmemset(c_to_f_read, 0, tran_len + 1);
+ dxpl_c_to_f.getDataTransform(c_to_f_read, tran_len + 1);
+ verify_val((const char *)c_to_f_read, (const char *)c_to_f, "DSetMemXferPropList::getDataTransform",
+ __LINE__, __FILE__);
HDfree(c_to_f_read);
// Get and verify the expression with:
// H5std_string DSetMemXferPropList::getDataTransform()
H5std_string simple_read = dxpl_simple.getDataTransform();
- verify_val((const char*)simple_read.c_str(), (const char*)simple,
- "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
+ verify_val((const char *)simple_read.c_str(), (const char *)simple,
+ "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
// Get and verify the expression with:
// ssize_t getDataTransform(char* exp, const size_t buf_size)
- tran_len = dxpl_utrans_inv.getDataTransform(NULL, 0);
- char *utrans_inv_read = (char *)HDmalloc(tran_len+1);
- HDmemset(utrans_inv_read, 0, tran_len+1);
- dxpl_utrans_inv.getDataTransform(utrans_inv_read, tran_len+1);
- verify_val((const char*)utrans_inv_read, (const char*)utrans_inv,
- "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
+ tran_len = dxpl_utrans_inv.getDataTransform(NULL, 0);
+ char *utrans_inv_read = (char *)HDmalloc(tran_len + 1);
+ HDmemset(utrans_inv_read, 0, tran_len + 1);
+ dxpl_utrans_inv.getDataTransform(utrans_inv_read, tran_len + 1);
+ verify_val((const char *)utrans_inv_read, (const char *)utrans_inv,
+ "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
HDfree(utrans_inv_read);
PASSED();
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_transfplist", __LINE__, __FILE__, E.getCDetailMsg());
}
}
-
/*-------------------------------------------------------------------------
* Function: test_dsproplist
*
@@ -119,17 +118,16 @@ static void test_transfplist()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_dsproplist()
+extern "C" void
+test_dsproplist()
{
// Output message about test being performed
MESSAGE(5, ("Testing Generic Dataset Property Lists\n"));
test_transfplist(); // test set/getDataTransform()
-} // test_dsproplist()
+} // test_dsproplist()
-
/*-------------------------------------------------------------------------
* Function: cleanup_dsproplist
*
@@ -138,8 +136,8 @@ void test_dsproplist()
* Return none
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_dsproplist()
+extern "C" void
+cleanup_dsproplist()
{
HDremove(FILENAME.c_str());
}
diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp
index a2a0867..a38d36d 100644
--- a/c++/test/testhdf5.cpp
+++ b/c++/test/testhdf5.cpp
@@ -47,17 +47,16 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
int
main(int argc, char *argv[])
{
- try
- {
+ try {
// Turn of the auto-printing when failure occurs so that we can
// handle the errors appropriately since sometime failures are
// caused deliberately and expected.
@@ -70,39 +69,38 @@ main(int argc, char *argv[])
// testing dataset functionalities in dset.cpp
AddTest("dsets", test_dset, cleanup_dsets, "Dataset I/O Operations", NULL);
// testing dataspace functionalities in th5s.cpp
- AddTest("th5s", test_h5s, cleanup_h5s, "Dataspaces", NULL);
+ AddTest("th5s", test_h5s, cleanup_h5s, "Dataspaces", NULL);
// testing attribute functionalities in tattr.cpp
- AddTest("tattr", test_attr, cleanup_attr, "Attributes", NULL);
+ AddTest("tattr", test_attr, cleanup_attr, "Attributes", NULL);
// testing object functionalities in tobject.cpp
- AddTest("tobject", test_object, cleanup_object, "Objects", NULL);
+ AddTest("tobject", test_object, cleanup_object, "Objects", NULL);
// testing reference functionalities in trefer.cpp
- AddTest("trefer", test_reference, cleanup_reference, "References", NULL);
+ AddTest("trefer", test_reference, cleanup_reference, "References", NULL);
// testing variable-length strings in tvlstr.cpp
- AddTest("tvlstr", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL);
- AddTest("ttypes", test_types, cleanup_types, "Generic Data Types", NULL);
- AddTest("tarray", test_array, cleanup_array, "Array Datatypes", NULL);
- AddTest("tcompound", test_compound, cleanup_compound, "Compound Data Types", NULL);
- AddTest("tdspl", test_dsproplist, cleanup_dsproplist, "Dataset Property List", NULL);
- AddTest("tfilter", test_filters, cleanup_filters, "Various Filters", NULL);
- AddTest("tlinks", test_links, cleanup_links, "Various Links", NULL);
-/* Comment out tests that are not done yet. - BMR, Feb 2001
- AddTest("select", test_select, cleanup_select, "Selections", NULL);
- AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL);
- AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL);
-*/
- AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL);
-/*
- AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL);
- AddTest("id", test_ids, NULL, "User-Created Identifiers", NULL);
-
-Comment out tests that are not done yet */
-
-/* Tentative - BMR 2007/1/12
- AddTest("enum", test_enum, cleanup_enum, "Enum Data Types", NULL);
-*/
+ AddTest("tvlstr", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL);
+ AddTest("ttypes", test_types, cleanup_types, "Generic Data Types", NULL);
+ AddTest("tarray", test_array, cleanup_array, "Array Datatypes", NULL);
+ AddTest("tcompound", test_compound, cleanup_compound, "Compound Data Types", NULL);
+ AddTest("tdspl", test_dsproplist, cleanup_dsproplist, "Dataset Property List", NULL);
+ AddTest("tfilter", test_filters, cleanup_filters, "Various Filters", NULL);
+ AddTest("tlinks", test_links, cleanup_links, "Various Links", NULL);
+ /* Comment out tests that are not done yet. - BMR, Feb 2001
+ AddTest("select", test_select, cleanup_select, "Selections", NULL);
+ AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL);
+ AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL);
+ */
+ AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL);
+ /*
+ AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL);
+ AddTest("id", test_ids, NULL, "User-Created Identifiers", NULL);
+
+ Comment out tests that are not done yet */
+
+ /* Tentative - BMR 2007/1/12
+ AddTest("enum", test_enum, cleanup_enum, "Enum Data Types", NULL);
+ */
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("Tests failed", __LINE__, __FILE__, E.getCDetailMsg());
}
@@ -110,7 +108,7 @@ Comment out tests that are not done yet */
TestInfo(argv[0]);
/* Parse command line arguments */
- TestParseCmdLine(argc,argv);
+ TestParseCmdLine(argc, argv);
/* Perform requested testing */
PerformTests();
@@ -128,4 +126,3 @@ Comment out tests that are not done yet */
return (GetTestNumErrs());
}
-
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp
index f5625a3..b4e5da5 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -29,38 +29,37 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
-
-const hsize_t F1_USERBLOCK_SIZE = (hsize_t)0;
-const size_t F1_OFFSET_SIZE = sizeof(haddr_t);
-const size_t F1_LENGTH_SIZE = sizeof(hsize_t);
-const unsigned F1_SYM_LEAF_K = 4;
-const unsigned F1_SYM_INTERN_K = 16;
-const H5std_string FILE1("tfile1.h5");
-
-const hsize_t F2_USERBLOCK_SIZE = (hsize_t)512;
-const size_t F2_OFFSET_SIZE = 8;
-const size_t F2_LENGTH_SIZE = 8;
-const unsigned F2_SYM_LEAF_K = 8;
-const unsigned F2_SYM_INTERN_K = 32;
-const unsigned F2_ISTORE = 64;
-const H5std_string FILE2("tfile2.h5");
-
-const hsize_t F3_USERBLOCK_SIZE = (hsize_t)0;
-const size_t F3_OFFSET_SIZE = F2_OFFSET_SIZE;
-const size_t F3_LENGTH_SIZE = F2_LENGTH_SIZE;
-const unsigned F3_SYM_LEAF_K = F2_SYM_LEAF_K;
-const unsigned F3_SYM_INTERN_K = F2_SYM_INTERN_K;
-const H5std_string FILE3("tfile3.h5");
-
-const int KB = 1024;
-const H5std_string FILE4("tfile4.h5");
-
-
+#include "h5cpputil.h" // C++ utilility header file
+
+const hsize_t F1_USERBLOCK_SIZE = (hsize_t)0;
+const size_t F1_OFFSET_SIZE = sizeof(haddr_t);
+const size_t F1_LENGTH_SIZE = sizeof(hsize_t);
+const unsigned F1_SYM_LEAF_K = 4;
+const unsigned F1_SYM_INTERN_K = 16;
+const H5std_string FILE1("tfile1.h5");
+
+const hsize_t F2_USERBLOCK_SIZE = (hsize_t)512;
+const size_t F2_OFFSET_SIZE = 8;
+const size_t F2_LENGTH_SIZE = 8;
+const unsigned F2_SYM_LEAF_K = 8;
+const unsigned F2_SYM_INTERN_K = 32;
+const unsigned F2_ISTORE = 64;
+const H5std_string FILE2("tfile2.h5");
+
+const hsize_t F3_USERBLOCK_SIZE = (hsize_t)0;
+const size_t F3_OFFSET_SIZE = F2_OFFSET_SIZE;
+const size_t F3_LENGTH_SIZE = F2_LENGTH_SIZE;
+const unsigned F3_SYM_LEAF_K = F2_SYM_LEAF_K;
+const unsigned F3_SYM_INTERN_K = F2_SYM_INTERN_K;
+const H5std_string FILE3("tfile3.h5");
+
+const int KB = 1024;
+const H5std_string FILE4("tfile4.h5");
+
/*-------------------------------------------------------------------------
* Function: test_file_create
*
@@ -80,7 +79,8 @@ const H5std_string FILE4("tfile4.h5");
* with a special routine.
*-------------------------------------------------------------------------
*/
-static void test_file_create()
+static void
+test_file_create()
{
// Output message about test being performed
SUBTEST("File Creation I/O");
@@ -93,21 +93,22 @@ static void test_file_create()
remove(FILE1.c_str());
// Setting this to NULL for cleaning up in failure situations
- H5File* file1 = NULL;
+ H5File *file1 = NULL;
try {
// Create file FILE1
- file1 = new H5File (FILE1, H5F_ACC_EXCL);
+ file1 = new H5File(FILE1, H5F_ACC_EXCL);
// Try to create the same file with H5F_ACC_TRUNC. This should fail
// because file1 is the same file and is currently open.
try {
- H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E
+ H5File file2(FILE1, H5F_ACC_TRUNC); // should throw E
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("H5File constructor", "Attempted to create an existing file.");
}
- catch (FileIException& E) // catch truncating existing file
- {} // do nothing, FAIL expected
+ catch (FileIException &E) // catch truncating existing file
+ {
+ } // do nothing, FAIL expected
// Close file1
delete file1;
@@ -116,52 +117,56 @@ static void test_file_create()
// Try again with H5F_ACC_EXCL. This should fail because the file
// already exists from the previous steps.
try {
- H5File file2(FILE1, H5F_ACC_EXCL); // should throw E
+ H5File file2(FILE1, H5F_ACC_EXCL); // should throw E
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("H5File constructor", "File already exists.");
}
- catch (FileIException& E) // catching creating existing file
- {} // do nothing, FAIL expected
+ catch (FileIException &E) // catching creating existing file
+ {
+ } // do nothing, FAIL expected
- // Test create with H5F_ACC_TRUNC. This will truncate the existing file.
- file1 = new H5File (FILE1, H5F_ACC_TRUNC);
+ // Test create with H5F_ACC_TRUNC. This will truncate the existing file.
+ file1 = new H5File(FILE1, H5F_ACC_TRUNC);
// Try to create first file again. This should fail because file1
// is the same file and is currently open.
- try {
- H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E
+ try {
+ H5File file2(FILE1, H5F_ACC_TRUNC); // should throw E
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("H5File constructor", "H5F_ACC_TRUNC attempt on an opened file.");
}
- catch (FileIException& E) // catching truncating opened file
- {} // do nothing, FAIL expected
+ catch (FileIException &E) // catching truncating opened file
+ {
+ } // do nothing, FAIL expected
- // Try with H5F_ACC_EXCL. This should fail too because the file already
- // exists.
- try {
- H5File file3 (FILE1, H5F_ACC_EXCL); // should throw E
+ // Try with H5F_ACC_EXCL. This should fail too because the file already
+ // exists.
+ try {
+ H5File file3(FILE1, H5F_ACC_EXCL); // should throw E
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("H5File constructor", "H5F_ACC_EXCL attempt on an existing file.");
- }
- catch (FileIException& E) // catching H5F_ACC_EXCL on existing file
- {} // do nothing, FAIL expected
+ }
+ catch (FileIException &E) // catching H5F_ACC_EXCL on existing file
+ {
+ } // do nothing, FAIL expected
- // Get the file-creation template
+ // Get the file-creation template
FileCreatPropList tmpl1 = file1->getCreatePlist();
hsize_t ublock = tmpl1.getUserblock();
- verify_val((long)ublock, (long)F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
+ verify_val((long)ublock, (long)F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__,
+ __FILE__);
- size_t parm1, parm2; // file-creation parameters
- tmpl1.getSizes( parm1, parm2);
+ size_t parm1, parm2; // file-creation parameters
+ tmpl1.getSizes(parm1, parm2);
verify_val(parm1, F1_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
verify_val(parm2, F1_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- unsigned iparm1,iparm2; // file-creation parameters
- tmpl1.getSymk( iparm1, iparm2);
+ unsigned iparm1, iparm2; // file-creation parameters
+ tmpl1.getSymk(iparm1, iparm2);
verify_val(iparm1, F1_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
verify_val(iparm2, F1_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
@@ -171,85 +176,84 @@ static void test_file_create()
// Close first file
delete file1;
}
- catch (InvalidActionException& E)
- {
+ catch (InvalidActionException &E) {
cerr << " *FAILED*" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
if (file1 != NULL) // clean up
delete file1;
}
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg());
if (file1 != NULL) // clean up
delete file1;
}
// Setting this to NULL for cleaning up in failure situations
- FileCreatPropList* tmpl1 = NULL;
- try
- {
- // Create a new file with a non-standard file-creation template
+ FileCreatPropList *tmpl1 = NULL;
+ try {
+ // Create a new file with a non-standard file-creation template
tmpl1 = new FileCreatPropList;
- // Set the new file-creation parameters
- tmpl1->setUserblock (F2_USERBLOCK_SIZE);
- tmpl1->setSizes( F2_OFFSET_SIZE, F2_LENGTH_SIZE );
- tmpl1->setSymk( F2_SYM_INTERN_K, F2_SYM_LEAF_K );
+ // Set the new file-creation parameters
+ tmpl1->setUserblock(F2_USERBLOCK_SIZE);
+ tmpl1->setSizes(F2_OFFSET_SIZE, F2_LENGTH_SIZE);
+ tmpl1->setSymk(F2_SYM_INTERN_K, F2_SYM_LEAF_K);
- // Try to create second file, with non-standard file-creation template
- // params.
- H5File file2( FILE2, H5F_ACC_TRUNC, *tmpl1 );
+ // Try to create second file, with non-standard file-creation template
+ // params.
+ H5File file2(FILE2, H5F_ACC_TRUNC, *tmpl1);
- // Release file-creation template
+ // Release file-creation template
delete tmpl1;
tmpl1 = NULL;
// Get the file-creation template
- tmpl1 = new FileCreatPropList (file2.getCreatePlist());
+ tmpl1 = new FileCreatPropList(file2.getCreatePlist());
// Get the file-creation parameters
hsize_t ublock = tmpl1->getUserblock();
- verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
+ verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__,
+ __FILE__);
size_t parm1, parm2; // file-creation parameters
- tmpl1->getSizes( parm1, parm2);
+ tmpl1->getSizes(parm1, parm2);
verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- unsigned iparm1,iparm2; // file-creation parameters
- tmpl1->getSymk( iparm1, iparm2);
+ unsigned iparm1, iparm2; // file-creation parameters
+ tmpl1->getSymk(iparm1, iparm2);
verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
verify_val(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
// Clone the file-creation template
FileCreatPropList tmpl2;
- tmpl2.copy (*tmpl1);
+ tmpl2.copy(*tmpl1);
// Release file-creation template
delete tmpl1;
tmpl1 = NULL;
// Set the new file-creation parameter
- tmpl2.setUserblock( F3_USERBLOCK_SIZE );
+ tmpl2.setUserblock(F3_USERBLOCK_SIZE);
// Try to create second file, with non-standard file-creation template
// params
- H5File file3( FILE3, H5F_ACC_TRUNC, tmpl2 );
+ H5File file3(FILE3, H5F_ACC_TRUNC, tmpl2);
// Get the file-creation template
- tmpl1 = new FileCreatPropList (file3.getCreatePlist());
+ tmpl1 = new FileCreatPropList(file3.getCreatePlist());
// Get the file-creation parameters
ublock = tmpl1->getUserblock();
- verify_val((long)ublock, (long)F3_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
+ verify_val((long)ublock, (long)F3_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__,
+ __FILE__);
- tmpl1->getSizes( parm1, parm2);
+ tmpl1->getSizes(parm1, parm2);
verify_val(parm1, F3_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
verify_val(parm2, F3_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- tmpl1->getSymk( iparm1, iparm2);
+ tmpl1->getSymk(iparm1, iparm2);
verify_val(iparm1, F3_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
verify_val(iparm2, F3_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
@@ -258,15 +262,13 @@ static void test_file_create()
PASSED();
}
// catch all exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg());
- if (tmpl1 != NULL) // clean up
+ if (tmpl1 != NULL) // clean up
delete tmpl1;
}
-} // test_file_create()
+} // test_file_create()
-
/*-------------------------------------------------------------------------
* Function: test_file_open
*
@@ -286,7 +288,8 @@ static void test_file_create()
* with a special routine.
*-------------------------------------------------------------------------
*/
-static void test_file_open()
+static void
+test_file_open()
{
// Output message about test being performed
SUBTEST("File Opening I/O");
@@ -294,22 +297,23 @@ static void test_file_open()
try {
// Open first file
- H5File file1 (FILE2, H5F_ACC_RDWR );
+ H5File file1(FILE2, H5F_ACC_RDWR);
// Get the file-creation template
FileCreatPropList tmpl1 = file1.getCreatePlist();
// Get the file-creation parameters
hsize_t ublock = tmpl1.getUserblock();
- verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
+ verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__,
+ __FILE__);
- size_t parm1, parm2; // file-creation parameters
- tmpl1.getSizes( parm1, parm2);
+ size_t parm1, parm2; // file-creation parameters
+ tmpl1.getSizes(parm1, parm2);
verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- unsigned iparm1,iparm2; // file-creation parameters
- tmpl1.getSymk( iparm1, iparm2);
+ unsigned iparm1, iparm2; // file-creation parameters
+ tmpl1.getSymk(iparm1, iparm2);
verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
verify_val(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
@@ -319,14 +323,15 @@ static void test_file_open()
// Try truncating the file, and it should fail because the file is
// still opened with file2.
- try {
- H5File file3 (FILE2, H5F_ACC_TRUNC); // should throw E
+ try {
+ H5File file3(FILE2, H5F_ACC_TRUNC); // should throw E
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("H5File constructor", "Attempt truncating an opened file.");
- }
- catch (FileIException& E) // catching H5F_ACC_TRUNC on opened file
- {} // do nothing, FAIL expected
+ }
+ catch (FileIException &E) // catching H5F_ACC_TRUNC on opened file
+ {
+ } // do nothing, FAIL expected
// Now, really close the file.
file2.close();
@@ -340,15 +345,13 @@ static void test_file_open()
H5File file4(FILE2, H5F_ACC_TRUNC);
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_file_open()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_file_open()
+} // test_file_open()
-
/*-------------------------------------------------------------------------
* Function: test_file_size
*
@@ -360,12 +363,13 @@ static void test_file_open()
* June, 2004
*-------------------------------------------------------------------------
*/
-static void test_file_size()
+static void
+test_file_size()
{
// Output message about test being performed
SUBTEST("File Size");
- hid_t fapl_id;
+ hid_t fapl_id;
fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
try {
@@ -373,33 +377,34 @@ static void test_file_size()
// list object to pass in H5File::H5File
FileAccPropList fapl(fapl_id);
- // Set to sec2 driver. Do we want to test other file drivers?
+ // Set to sec2 driver. Do we want to test other file drivers?
// They're not tested in C++.
// File drivers seem not implemented.
// fapl.setSec2();
// Create a file
- H5File file4( FILE4, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+ H5File file4(FILE4, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
// Get file size
hsize_t file_size = file4.getFileSize();
// Check if file size is reasonable. It's supposed to be 2KB now.
- if (file_size < 1*KB || file_size > 4*KB)
- issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFileSize() returned unreasonable value");
+ if (file_size < 1 * KB || file_size > 4 * KB)
+ issue_fail_msg("test_file_size()", __LINE__, __FILE__,
+ "getFileSize() returned unreasonable value");
// Get the amount of free space in the file
hssize_t free_space = file4.getFreeSpace();
// Check if it's reasonable. It's 0 now.
- if (free_space < 0 || free_space > 4*KB)
- issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFreeSpace returned unreasonable value");
+ if (free_space < 0 || free_space > 4 * KB)
+ issue_fail_msg("test_file_size()", __LINE__, __FILE__,
+ "getFreeSpace returned unreasonable value");
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_file_size()", __LINE__, __FILE__, E.getCDetailMsg());
}
@@ -408,9 +413,8 @@ static void test_file_size()
if (ret < 0)
issue_fail_msg("test_file_size()", __LINE__, __FILE__, "H5Pclose failed");
-} // test_file_size()
+} // test_file_size()
-
/*-------------------------------------------------------------------------
* Function: test_file_num
*
@@ -422,12 +426,13 @@ static void test_file_size()
* April, 2019
*-------------------------------------------------------------------------
*/
-static void test_file_num()
+static void
+test_file_num()
{
// Output message about test being performed
SUBTEST("File Number");
- hid_t fapl_id;
+ hid_t fapl_id;
fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
try {
@@ -454,10 +459,9 @@ static void test_file_num()
issue_fail_msg("test_file_num()", __LINE__, __FILE__, "getFileNum() returned wrong value");
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_file_num()", __LINE__, __FILE__, E.getCDetailMsg());
}
@@ -466,9 +470,8 @@ static void test_file_num()
if (ret < 0)
issue_fail_msg("test_file_num()", __LINE__, __FILE__, "H5Pclose failed");
-} // test_file_num()
+} // test_file_num()
-
/*-------------------------------------------------------------------------
* Function: test_file_name
*
@@ -480,14 +483,14 @@ static void test_file_num()
* July, 2004
*-------------------------------------------------------------------------
*/
-const int RANK = 2;
-const int NX = 4;
-const int NY = 5;
-const H5std_string GROUPNAME ("group");
-const H5std_string DSETNAME ("dataset");
-const H5std_string DATTRNAME ("dataset attribute");
-const H5std_string FATTRNAME ("file attribute");
-const H5std_string DTYPENAME ("compound");
+const int RANK = 2;
+const int NX = 4;
+const int NY = 5;
+const H5std_string GROUPNAME("group");
+const H5std_string DSETNAME("dataset");
+const H5std_string DATTRNAME("dataset attribute");
+const H5std_string FATTRNAME("file attribute");
+const H5std_string DTYPENAME("compound");
// Compound datatype
typedef struct s1_t {
@@ -495,7 +498,8 @@ typedef struct s1_t {
float b;
} s1_t;
-static void test_file_name()
+static void
+test_file_name()
{
// Output message about test being performed.
SUBTEST("File Name");
@@ -517,11 +521,11 @@ static void test_file_name()
verify_val(file_name, FILE4, "Group::getFileName", __LINE__, __FILE__);
// Create the data space.
- hsize_t dims[RANK] = {NX, NY};
+ hsize_t dims[RANK] = {NX, NY};
DataSpace space(RANK, dims);
// Create a new dataset.
- DataSet dataset(file4.createDataSet (DSETNAME, PredType::NATIVE_INT, space));
+ DataSet dataset(file4.createDataSet(DSETNAME, PredType::NATIVE_INT, space));
// Get and verify file name via a dataset.
file_name = dataset.getFileName();
@@ -535,7 +539,7 @@ static void test_file_name()
verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__);
// Create a compound datatype.
- CompType comp_type (sizeof(s1_t));
+ CompType comp_type(sizeof(s1_t));
// Insert fields.
comp_type.insertMember("a", HOFFSET(s1_t, a), PredType::NATIVE_INT);
@@ -548,15 +552,13 @@ static void test_file_name()
comp_type.getFileName();
verify_val(file_name, FILE4, "CompType::getFileName", __LINE__, __FILE__);
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_file_name()
+} // test_file_name()
-
/*-------------------------------------------------------------------------
*
* Function: test_file_attribute
@@ -566,15 +568,16 @@ static void test_file_name()
* Return None
*-------------------------------------------------------------------------
*/
-const int RANK1 = 1;
-const int ATTR1_DIM1 = 3;
-const H5std_string FILE5("tfattrs.h5");
-const H5std_string FATTR1_NAME ("file attribute 1");
-const H5std_string FATTR2_NAME ("file attribute 2");
-int fattr_data[ATTR1_DIM1]={512,-234,98123}; // Test data for file attribute
-int dattr_data[ATTR1_DIM1]={256,-123,1000}; // Test data for dataset attribute
-
-static void test_file_attribute()
+const int RANK1 = 1;
+const int ATTR1_DIM1 = 3;
+const H5std_string FILE5("tfattrs.h5");
+const H5std_string FATTR1_NAME("file attribute 1");
+const H5std_string FATTR2_NAME("file attribute 2");
+int fattr_data[ATTR1_DIM1] = {512, -234, 98123}; // Test data for file attribute
+int dattr_data[ATTR1_DIM1] = {256, -123, 1000}; // Test data for dataset attribute
+
+static void
+test_file_attribute()
{
int rdata[ATTR1_DIM1];
int i;
@@ -588,7 +591,7 @@ static void test_file_attribute()
H5File file5(FILE5, H5F_ACC_TRUNC);
// Create the data space
- hsize_t dims[RANK1] = {ATTR1_DIM1};
+ hsize_t dims[RANK1] = {ATTR1_DIM1};
DataSpace space(RANK1, dims);
// Create two attributes for the file
@@ -601,13 +604,15 @@ static void test_file_attribute()
// Try to create the same attribute again (should fail)
Attribute fattr_dup(file5.createAttribute(FATTR2_NAME, PredType::NATIVE_INT, space));
// Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("H5File createAttribute", "Attempted to create an existing attribute.");
+ throw InvalidActionException("H5File createAttribute",
+ "Attempted to create an existing attribute.");
}
- catch (AttributeIException& E) // catch creating existing attribute
- {} // do nothing, FAIL expected
+ catch (AttributeIException &E) // catch creating existing attribute
+ {
+ } // do nothing, FAIL expected
// Create a new dataset
- DataSet dataset(file5.createDataSet (DSETNAME, PredType::NATIVE_INT, space));
+ DataSet dataset(file5.createDataSet(DSETNAME, PredType::NATIVE_INT, space));
// Create an attribute for the dataset
Attribute dattr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space));
@@ -663,20 +668,18 @@ static void test_file_attribute()
if (rdata[i] != dattr_data[i]) {
H5_FAILED();
cerr << endl;
- cerr << "element [" << i << "] is " << rdata[i] <<
- "but should have been " << dattr_data[i] << endl;
- }
+ cerr << "element [" << i << "] is " << rdata[i] << "but should have been " << dattr_data[i]
+ << endl;
}
+ }
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_file_attribute()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_file_attribute()
+} // test_file_attribute()
-
/*-------------------------------------------------------------------------
* Function: test_libver_bounds_real
*
@@ -690,94 +693,92 @@ static void test_file_attribute()
* March, 2015
*-------------------------------------------------------------------------
*/
-const H5std_string FILE6("tfile5.h5");
-const H5std_string ROOTGROUP("/");
-const H5std_string GROUP1("/G1");
-const H5std_string SUBGROUP3("/G1/G3");
-
-static void test_libver_bounds_real(
- H5F_libver_t libver_create, unsigned oh_vers_create,
- H5F_libver_t libver_mod, unsigned oh_vers_mod)
+const H5std_string FILE6("tfile5.h5");
+const H5std_string ROOTGROUP("/");
+const H5std_string GROUP1("/G1");
+const H5std_string SUBGROUP3("/G1/G3");
+
+static void
+test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, H5F_libver_t libver_mod,
+ unsigned oh_vers_mod)
{
try {
- /*
- * Create a new file using the default creation property and access property
- * with latest library version.
- */
- FileAccPropList fapl;
- fapl.setLibverBounds(libver_create, H5F_LIBVER_LATEST);
- H5File file(FILE6, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+ /*
+ * Create a new file using the default creation property and access property
+ * with latest library version.
+ */
+ FileAccPropList fapl;
+ fapl.setLibverBounds(libver_create, H5F_LIBVER_LATEST);
+ H5File file(FILE6, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
- /*
- * Make sure the root group has the correct object header version
- */
- unsigned obj_version = file.childObjVersion(ROOTGROUP);
- verify_val(obj_version, oh_vers_create, "H5File::childObjVersion", __LINE__, __FILE__);
-
- // Verify object header version another way
- H5O_native_info_t ninfo;
- HDmemset(&ninfo, 0, sizeof(ninfo));
- file.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR);
- verify_val(ninfo.hdr.version, oh_vers_create, "H5File::getNativeObjinfo", __LINE__, __FILE__);
-
- /*
- * Reopen the file and make sure the root group still has the correct
- * version
- */
- file.close();
+ /*
+ * Make sure the root group has the correct object header version
+ */
+ unsigned obj_version = file.childObjVersion(ROOTGROUP);
+ verify_val(obj_version, oh_vers_create, "H5File::childObjVersion", __LINE__, __FILE__);
- fapl.setLibverBounds(libver_mod, H5F_LIBVER_LATEST);
+ // Verify object header version another way
+ H5O_native_info_t ninfo;
+ HDmemset(&ninfo, 0, sizeof(ninfo));
+ file.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR);
+ verify_val(ninfo.hdr.version, oh_vers_create, "H5File::getNativeObjinfo", __LINE__, __FILE__);
- file.openFile(FILE6, H5F_ACC_RDWR, fapl);
+ /*
+ * Reopen the file and make sure the root group still has the correct
+ * version
+ */
+ file.close();
- obj_version = file.childObjVersion(ROOTGROUP);
- verify_val(obj_version, oh_vers_create, "H5File::childObjVersion", __LINE__, __FILE__);
+ fapl.setLibverBounds(libver_mod, H5F_LIBVER_LATEST);
- /*
- * Create a group named "/G1" in the file, and make sure it has the correct
- * object header version
- */
- Group group = file.createGroup(GROUP1);
+ file.openFile(FILE6, H5F_ACC_RDWR, fapl);
- obj_version = group.objVersion();
- verify_val(obj_version, oh_vers_mod, "Group::objVersion", __LINE__, __FILE__);
+ obj_version = file.childObjVersion(ROOTGROUP);
+ verify_val(obj_version, oh_vers_create, "H5File::childObjVersion", __LINE__, __FILE__);
- // Verify object header version another way
- HDmemset(&ninfo, 0, sizeof(ninfo));
- group.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR);
- verify_val(ninfo.hdr.version, oh_vers_mod, "Group::getNativeObjinfo", __LINE__, __FILE__);
+ /*
+ * Create a group named "/G1" in the file, and make sure it has the correct
+ * object header version
+ */
+ Group group = file.createGroup(GROUP1);
- group.close(); // close "/G1"
+ obj_version = group.objVersion();
+ verify_val(obj_version, oh_vers_mod, "Group::objVersion", __LINE__, __FILE__);
- /*
- * Create a group named "/G1/G3" in the file, and make sure it has the
- * correct object header version
- */
- group = file.createGroup(SUBGROUP3);
+ // Verify object header version another way
+ HDmemset(&ninfo, 0, sizeof(ninfo));
+ group.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR);
+ verify_val(ninfo.hdr.version, oh_vers_mod, "Group::getNativeObjinfo", __LINE__, __FILE__);
- obj_version = group.objVersion();
- verify_val(obj_version, oh_vers_mod, "Group::objVersion", __LINE__, __FILE__);
+ group.close(); // close "/G1"
- group.close(); // close "/G1/G3"
+ /*
+ * Create a group named "/G1/G3" in the file, and make sure it has the
+ * correct object header version
+ */
+ group = file.createGroup(SUBGROUP3);
- /*
- * Make sure the root group still has the correct object header version
- */
- obj_version = file.childObjVersion(ROOTGROUP);
- verify_val(obj_version, oh_vers_create, "H5File::childObjVersion", __LINE__, __FILE__);
+ obj_version = group.objVersion();
+ verify_val(obj_version, oh_vers_mod, "Group::objVersion", __LINE__, __FILE__);
- // Everything should be closed as they go out of scope
- } // end of try block
+ group.close(); // close "/G1/G3"
- catch (Exception& E)
- {
+ /*
+ * Make sure the root group still has the correct object header version
+ */
+ obj_version = file.childObjVersion(ROOTGROUP);
+ verify_val(obj_version, oh_vers_create, "H5File::childObjVersion", __LINE__, __FILE__);
+
+ // Everything should be closed as they go out of scope
+ } // end of try block
+
+ catch (Exception &E) {
issue_fail_msg("test_libver_bounds_real()", __LINE__, __FILE__, E.getCDetailMsg());
}
} /* end test_libver_bounds_real() */
-
/*-------------------------------------------------------------------------
*
* Function: test_libver_bounds
@@ -791,7 +792,8 @@ static void test_libver_bounds_real(
* March 2015
*-------------------------------------------------------------------------
*/
-static void test_libver_bounds()
+static void
+test_libver_bounds()
{
// Output message about test being performed
SUBTEST("Setting library version bounds");
@@ -802,7 +804,6 @@ static void test_libver_bounds()
PASSED();
} /* end test_libver_bounds() */
-
/*-------------------------------------------------------------------------
* Function: test_commonfg
*
@@ -814,7 +815,8 @@ static void test_libver_bounds()
* March, 2015
*-------------------------------------------------------------------------
*/
-static void test_commonfg()
+static void
+test_commonfg()
{
// Output message about test being performed
SUBTEST("Root group");
@@ -830,11 +832,11 @@ static void test_commonfg()
Group group(rootgroup.createGroup(GROUPNAME, 0));
// Create the data space.
- hsize_t dims[RANK] = {NX, NY};
+ hsize_t dims[RANK] = {NX, NY};
DataSpace space(RANK, dims);
// Create a new dataset.
- DataSet dataset(group.createDataSet (DSETNAME, PredType::NATIVE_INT, space));
+ DataSet dataset(group.createDataSet(DSETNAME, PredType::NATIVE_INT, space));
// Get and verify file name via a dataset.
H5std_string file_name = dataset.getFileName();
@@ -855,16 +857,14 @@ static void test_commonfg()
verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__);
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_commonfg()", __LINE__, __FILE__, E.getCDetailMsg());
}
} /* end test_commonfg() */
-
/*-------------------------------------------------------------------------
* Function: test_file_info
*
@@ -879,16 +879,17 @@ static void test_commonfg()
*-------------------------------------------------------------------------
*/
const H5std_string FILE7("tfile7.h5");
-const hsize_t FSP_SIZE_DEF = 4096;
-const hsize_t FSP_SIZE512 = 512;
+const hsize_t FSP_SIZE_DEF = 4096;
+const hsize_t FSP_SIZE512 = 512;
-static void test_file_info()
+static void
+test_file_info()
{
// Output message about test being performed
SUBTEST("File general information");
- hsize_t out_threshold = 0; // Free space section threshold to get
- hbool_t out_persist = FALSE;// Persist free-space read
+ hsize_t out_threshold = 0; // Free space section threshold to get
+ hbool_t out_persist = FALSE; // Persist free-space read
// File space handling strategy
H5F_fspace_strategy_t out_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
@@ -919,7 +920,8 @@ static void test_file_info()
/* Retrieve file space page size */
hsize_t out_fsp_psize = fcpl.getFileSpacePagesize();
- verify_val(out_fsp_psize, FSP_SIZE_DEF, "FileCreatPropList::getFileSpacePagesize", __LINE__, __FILE__);
+ verify_val(out_fsp_psize, FSP_SIZE_DEF, "FileCreatPropList::getFileSpacePagesize", __LINE__,
+ __FILE__);
// Set various file information.
fcpl.setUserblock(F2_USERBLOCK_SIZE);
@@ -927,9 +929,9 @@ static void test_file_info()
fcpl.setSymk(F2_SYM_INTERN_K, F2_SYM_LEAF_K);
fcpl.setIstorek(F2_ISTORE);
- hsize_t threshold = 5; // Free space section threshold to set
- hbool_t persist = TRUE; // Persist free-space to set
- H5F_fspace_strategy_t strategy = H5F_FSPACE_STRATEGY_PAGE;
+ hsize_t threshold = 5; // Free space section threshold to set
+ hbool_t persist = TRUE; // Persist free-space to set
+ H5F_fspace_strategy_t strategy = H5F_FSPACE_STRATEGY_PAGE;
fcpl.setFileSpaceStrategy(strategy, persist, threshold);
fcpl.setFileSpacePagesize(FSP_SIZE512);
@@ -981,10 +983,10 @@ static void test_file_info()
unsigned istore_ik = fcpl2.getIstorek();
verify_val(istore_ik, F2_ISTORE, "FileCreatPropList::getIstorek", __LINE__, __FILE__);
- /* ret=H5Pget_shared_mesg_nindexes(fcpl2,&nindexes);
- CHECK(ret, FAIL, "H5Pget_shared_mesg_nindexes");
- VERIFY(nindexes, MISC11_NINDEXES, "H5Pget_shared_mesg_nindexes");
- */
+ /* ret=H5Pget_shared_mesg_nindexes(fcpl2,&nindexes);
+ CHECK(ret, FAIL, "H5Pget_shared_mesg_nindexes");
+ VERIFY(nindexes, MISC11_NINDEXES, "H5Pget_shared_mesg_nindexes");
+ */
// Get and verify the file space info from the creation property list */
fcpl2.getFileSpaceStrategy(out_strategy, out_persist, out_threshold);
@@ -996,14 +998,12 @@ static void test_file_info()
verify_val(out_fsp_psize, FSP_SIZE512, "FileCreatPropList::getFileSpacePagesize", __LINE__, __FILE__);
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_filespace_info()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} /* test_file_info() */
+} /* test_file_info() */
-
/*-------------------------------------------------------------------------
* Function: test_file
*
@@ -1015,24 +1015,23 @@ static void test_file_info()
* January 2001
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_file()
+extern "C" void
+test_file()
{
// Output message about test being performed
MESSAGE(5, ("Testing File I/O Operations\n"));
- test_file_create(); // Test file creation (also creation templates)
- test_file_open(); // Test file opening
- test_file_size(); // Test file size
- test_file_num(); // Test file number
- test_file_name(); // Test getting file's name
- test_file_attribute(); // Test file attribute feature
- test_libver_bounds(); // Test format version
- test_commonfg(); // Test H5File as a root group
- test_file_info(); // Test various file info
-} // test_file()
-
-
+ test_file_create(); // Test file creation (also creation templates)
+ test_file_open(); // Test file opening
+ test_file_size(); // Test file size
+ test_file_num(); // Test file number
+ test_file_name(); // Test getting file's name
+ test_file_attribute(); // Test file attribute feature
+ test_libver_bounds(); // Test format version
+ test_commonfg(); // Test H5File as a root group
+ test_file_info(); // Test various file info
+} // test_file()
+
/*-------------------------------------------------------------------------
* Function: cleanup_file
*
@@ -1044,7 +1043,8 @@ void test_file()
#ifdef __cplusplus
extern "C"
#endif
-void cleanup_file()
+ void
+ cleanup_file()
{
HDremove(FILE1.c_str());
HDremove(FILE2.c_str());
@@ -1053,4 +1053,4 @@ void cleanup_file()
HDremove(FILE5.c_str());
HDremove(FILE6.c_str());
HDremove(FILE7.c_str());
-} // cleanup_file
+} // cleanup_file
diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp
index 5a493ac..e7788e5 100644
--- a/c++/test/tfilter.cpp
+++ b/c++/test/tfilter.cpp
@@ -25,14 +25,14 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
-#define DSET_DIM1 100
-#define DSET_DIM2 200
+#define DSET_DIM1 100
+#define DSET_DIM2 200
#define FILTER_CHUNK_DIM1 2
#define FILTER_CHUNK_DIM2 25
@@ -56,16 +56,15 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
static size_t filter_bogus(size_t nbytes);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_BOGUS[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_BOGUS, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "bogus", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)filter_bogus, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_BOGUS, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "bogus", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)filter_bogus, /* The actual filter function */
}};
-
/*-------------------------------------------------------------------------
* Function: filter_bogus
*
@@ -90,7 +89,6 @@ filter_bogus(size_t nbytes)
return nbytes;
}
-
/*-------------------------------------------------------------------------
* Function: test_null_filter
*
@@ -107,25 +105,26 @@ filter_bogus(size_t nbytes)
*/
const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2};
-static void test_null_filter()
+static void
+test_null_filter()
{
// Output message about test being performed
SUBTEST("'Null' filter");
try {
- //hsize_t null_size; // Size of dataset with null filter
+ // hsize_t null_size; // Size of dataset with null filter
// Prepare dataset create property list
DSetCreatPropList dsplist;
dsplist.setChunk(2, chunk_size);
- if (H5Zregister (H5Z_BOGUS)<0)
+ if (H5Zregister(H5Z_BOGUS) < 0)
throw Exception("test_null_filter", "H5Zregister failed");
// Set some pretent filter
dsplist.setFilter(H5Z_FILTER_BOGUS);
// this function is just a stub right now; will work on it later - BMR
- //if(test_filter_internal(file,DSET_BOGUS_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&null_size)<0)
+ // if(test_filter_internal(file,DSET_BOGUS_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&null_size)<0)
// throw Exception("test_null_filter", "test_filter_internal failed");
// Close objects.
@@ -134,13 +133,11 @@ static void test_null_filter()
} // end of try
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_null_filter()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_null_filter
+} // test_null_filter
-
/*-------------------------------------------------------------------------
* Function: test_szip_filter
*
@@ -157,28 +154,29 @@ static void test_null_filter()
*/
const H5std_string DSET_SZIP_NAME("szipped dataset");
-static void test_szip_filter(H5File& file1)
+static void
+test_szip_filter(H5File &file1)
{
#ifdef H5_HAVE_FILTER_SZIP
int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2];
- unsigned szip_options_mask=H5_SZIP_NN_OPTION_MASK;
- unsigned szip_pixels_per_block=4;
+ unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK;
+ unsigned szip_pixels_per_block = 4;
// Output message about test being performed
SUBTEST("szip filter (with encoder)");
- if ( h5_szip_can_encode() == 1) {
- char* tconv_buf = new char [1000];
+ if (h5_szip_can_encode() == 1) {
+ char *tconv_buf = new char[1000];
try {
- const hsize_t size[2] = {DSET_DIM1, DSET_DIM2};
+ const hsize_t size[2] = {DSET_DIM1, DSET_DIM2};
// Create the data space
DataSpace space1(2, size, NULL);
// Create a small conversion buffer to test strip mining (?)
DSetMemXferPropList xfer;
- xfer.setBuffer (1000, tconv_buf, NULL);
+ xfer.setBuffer(1000, tconv_buf, NULL);
// Prepare dataset create property list
DSetCreatPropList dsplist;
@@ -188,27 +186,24 @@ static void test_szip_filter(H5File& file1)
dsplist.setSzip(szip_options_mask, szip_pixels_per_block);
// Create a dataset with szip compression
- DataSpace space2 (2, size, NULL);
- DataSet dataset(file1.createDataSet (DSET_SZIP_NAME, PredType::NATIVE_INT, space2, dsplist));
+ DataSpace space2(2, size, NULL);
+ DataSet dataset(file1.createDataSet(DSET_SZIP_NAME, PredType::NATIVE_INT, space2, dsplist));
hsize_t i, j, n;
- for (i=n=0; i<size[0]; i++)
- {
- for (j=0; j<size[1]; j++)
- {
+ for (i = n = 0; i < size[0]; i++) {
+ for (j = 0; j < size[1]; j++) {
points[i][j] = (int)n++;
}
}
// Write to the dataset then read back the values
- dataset.write ((void*)points, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
- dataset.read ((void*)check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset.write((void *)points, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset.read((void *)check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
// Check that the values read are the same as the values written
for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
+ for (j = 0; j < size[1]; j++) {
+ int status = check_values(i, j, points[i][j], check[i][j]);
if (status == -1)
throw Exception("test_szip_filter", "Failed in testing szip method");
}
@@ -217,8 +212,7 @@ static void test_szip_filter(H5File& file1)
} // end of try
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_szip_filter()", __LINE__, __FILE__, E.getCDetailMsg());
}
@@ -228,15 +222,14 @@ static void test_szip_filter(H5File& file1)
SKIPPED();
}
-#else /* H5_HAVE_FILTER_SZIP */
+#else /* H5_HAVE_FILTER_SZIP */
SUBTEST("szip filter");
SKIPPED();
H5std_string fname = file1.getFileName();
cerr << " Szip filter not enabled for file '" << fname << "'" << endl;
#endif /* H5_HAVE_FILTER_SZIP */
-} // test_szip_filter
+} // test_szip_filter
-
/*-------------------------------------------------------------------------
* Function: test_filters
*
@@ -245,18 +238,17 @@ static void test_szip_filter(H5File& file1)
* Return None
*-------------------------------------------------------------------------
*/
-const H5std_string FILE1("tfilters.h5");
-extern "C"
-void test_filters()
+const H5std_string FILE1("tfilters.h5");
+extern "C" void
+test_filters()
{
// Output message about test being performed
MESSAGE(5, ("Testing Various Filters\n"));
- hid_t fapl_id;
+ hid_t fapl_id;
fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
- try
- {
+ try {
// Use the file access template id to create a file access prop. list
FileAccPropList fapl(fapl_id);
@@ -266,13 +258,11 @@ void test_filters()
test_null_filter();
test_szip_filter(file1);
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_filters()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_filters()
+} // test_filters()
-
/*-------------------------------------------------------------------------
* Function: cleanup_filters
*
@@ -281,8 +271,8 @@ void test_filters()
* Return none
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_filters()
+extern "C" void
+cleanup_filters()
{
HDremove(FILE1.c_str());
}
diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp
index d4853da..8709c25 100644
--- a/c++/test/th5s.cpp
+++ b/c++/test/th5s.cpp
@@ -28,39 +28,39 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
-#include "H5srcdir.h" // srcdir querying header file
+#include "h5cpputil.h" // C++ utilility header file
+#include "H5srcdir.h" // srcdir querying header file
-const H5std_string TESTFILE("th5s.h5");
-const H5std_string DATAFILE("th5s1.h5");
+const H5std_string TESTFILE("th5s.h5");
+const H5std_string DATAFILE("th5s1.h5");
/* 3-D dataset with fixed dimensions */
const H5std_string SPACE1_NAME("Space1");
-const int SPACE1_RANK = 3;
-const int SPACE1_DIM1 = 3;
-const int SPACE1_DIM2 = 15;
-const int SPACE1_DIM3 = 13;
+const int SPACE1_RANK = 3;
+const int SPACE1_DIM1 = 3;
+const int SPACE1_DIM2 = 15;
+const int SPACE1_DIM3 = 13;
/* 4-D dataset with one unlimited dimension */
const H5std_string SPACE2_NAME("Space2");
-const int SPACE2_RANK = 4;
-const int SPACE2_DIM1 = 0;
-const int SPACE2_DIM2 = 15;
-const int SPACE2_DIM3 = 13;
-const int SPACE2_DIM4 = 23;
-const hsize_t SPACE2_MAX1 = H5S_UNLIMITED;
-const hsize_t SPACE2_MAX2 = 15;
-const hsize_t SPACE2_MAX3 = 13;
-const hsize_t SPACE2_MAX4 = 23;
+const int SPACE2_RANK = 4;
+const int SPACE2_DIM1 = 0;
+const int SPACE2_DIM2 = 15;
+const int SPACE2_DIM3 = 13;
+const int SPACE2_DIM4 = 23;
+const hsize_t SPACE2_MAX1 = H5S_UNLIMITED;
+const hsize_t SPACE2_MAX2 = 15;
+const hsize_t SPACE2_MAX3 = 13;
+const hsize_t SPACE2_MAX4 = 23;
/* Scalar dataset with simple datatype */
const H5std_string SPACE3_NAME("Scalar1");
-const int SPACE3_RANK = 0;
-unsigned space3_data=65;
+const int SPACE3_RANK = 0;
+unsigned space3_data = 65;
/* Scalar dataset with compound datatype */
const H5std_string SPACE4_NAME("Scalar2");
@@ -68,21 +68,20 @@ const H5std_string SPACE4_FIELDNAME1("c1");
const H5std_string SPACE4_FIELDNAME2("u");
const H5std_string SPACE4_FIELDNAME3("f");
const H5std_string SPACE4_FIELDNAME4("c2");
-size_t space4_field1_off=0;
-size_t space4_field2_off=0;
-size_t space4_field3_off=0;
-size_t space4_field4_off=0;
+size_t space4_field1_off = 0;
+size_t space4_field2_off = 0;
+size_t space4_field3_off = 0;
+size_t space4_field4_off = 0;
struct space4_struct {
- char c1;
+ char c1;
unsigned u;
- float f;
- char c2;
- } space4_data={'v',987123,(float)-3.14,'g'}; /* Test data for 4th dataspace */
+ float f;
+ char c2;
+} space4_data = {'v', 987123, (float)-3.14, 'g'}; /* Test data for 4th dataspace */
/* Null dataspace */
int space5_data = 7;
-
/*-------------------------------------------------------------------------
* Function: test_h5s_basic
*
@@ -105,11 +104,12 @@ int space5_data = 7;
* size to be zero. So I took out the test against it.
*-------------------------------------------------------------------------
*/
-static void test_h5s_basic()
+static void
+test_h5s_basic()
{
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3, SPACE2_DIM4};
- hsize_t dims3[H5S_MAX_RANK+1];
+ hsize_t dims3[H5S_MAX_RANK + 1];
hsize_t tmax[4];
// Output message about test being performed
@@ -117,13 +117,13 @@ static void test_h5s_basic()
try {
// Create simple dataspace sid1
- DataSpace sid1 (SPACE1_RANK, dims1 );
+ DataSpace sid1(SPACE1_RANK, dims1);
// Get simple extent npoints of the dataspace sid1 and verify it
hssize_t n; // Number of dataspace elements
n = sid1.getSimpleExtentNpoints();
verify_val((long)n, (long)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3),
- "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of dataspace sid1 and verify it
int rank; // Logical rank of dataspace
@@ -131,21 +131,21 @@ static void test_h5s_basic()
verify_val(rank, SPACE1_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
// Retrieves dimension size of dataspace sid1 and verify it
- int ndims; // Number of dimensions
+ int ndims; // Number of dimensions
hsize_t tdims[4]; // Dimension array to test with
- ndims = sid1.getSimpleExtentDims( tdims );
+ ndims = sid1.getSimpleExtentDims(tdims);
verify_val(ndims, SPACE1_RANK, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
verify_val(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(unsigned)), 0,
- "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
// Create simple dataspace sid2
- hsize_t max2[] = {SPACE2_MAX1, SPACE2_MAX2, SPACE2_MAX3, SPACE2_MAX4};
- DataSpace sid2 (SPACE2_RANK, dims2, max2);
+ hsize_t max2[] = {SPACE2_MAX1, SPACE2_MAX2, SPACE2_MAX3, SPACE2_MAX4};
+ DataSpace sid2(SPACE2_RANK, dims2, max2);
// Get simple extent npoints of dataspace sid2 and verify it
n = sid2.getSimpleExtentNpoints();
verify_val((long)n, (long)(SPACE2_DIM1 * SPACE2_DIM2 * SPACE2_DIM3 * SPACE2_DIM4),
- "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of dataspace sid2 and verify it
rank = sid2.getSimpleExtentNdims();
@@ -153,34 +153,36 @@ static void test_h5s_basic()
// Retrieves dimension size and max size of dataspace sid2 and
// verify them
- ndims = sid2.getSimpleExtentDims( tdims, tmax );
+ ndims = sid2.getSimpleExtentDims(tdims, tmax);
verify_val(HDmemcmp(tdims, dims2, SPACE2_RANK * sizeof(unsigned)), 0,
- "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
- verify_val(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(unsigned)), 0,
- "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ verify_val(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(unsigned)), 0, "DataSpace::getSimpleExtentDims",
+ __LINE__, __FILE__);
// Check to be sure we can't create a simple data space that has too
// many dimensions.
try {
- DataSpace manydims_ds(H5S_MAX_RANK+1, dims3, NULL);
+ DataSpace manydims_ds(H5S_MAX_RANK + 1, dims3, NULL);
// Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("DataSpace constructor", "Library allowed overwrite of existing dataset");
+ throw InvalidActionException("DataSpace constructor",
+ "Library allowed overwrite of existing dataset");
}
- catch (DataSpaceIException& E) // Simple data space with too many dims
- {} // do nothing, exception expected
-
- /*
- * Try reading a file that has been prepared that has a dataset with a
- * higher dimensionality than what the library can handle.
- *
- * If this test fails and the H5S_MAX_RANK variable has changed, follow
- * the instructions in space_overflow.c for regenating the th5s.h5 file.
- */
- char *tmp_str = new char[TESTFILE.length()+1];
+ catch (DataSpaceIException &E) // Simple data space with too many dims
+ {
+ } // do nothing, exception expected
+
+ /*
+ * Try reading a file that has been prepared that has a dataset with a
+ * higher dimensionality than what the library can handle.
+ *
+ * If this test fails and the H5S_MAX_RANK variable has changed, follow
+ * the instructions in space_overflow.c for regenating the th5s.h5 file.
+ */
+ char *tmp_str = new char[TESTFILE.length() + 1];
strcpy(tmp_str, TESTFILE.c_str());
const char *testfile = H5_get_srcdir_filename(tmp_str);
- delete []tmp_str;
+ delete[] tmp_str;
// Create file
H5File fid1(testfile, H5F_ACC_RDONLY);
@@ -188,33 +190,33 @@ static void test_h5s_basic()
// Try to open the dataset that has higher dimensionality than
// what the library can handle and this operation should fail.
try {
- DataSet dset1 = fid1.openDataSet( "dset" );
+ DataSet dset1 = fid1.openDataSet("dset");
// Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("H5File::openDataSet", "Opening a dataset with higher dimensionality than what the library can handle");
+ throw InvalidActionException(
+ "H5File::openDataSet",
+ "Opening a dataset with higher dimensionality than what the library can handle");
}
- catch (FileIException& E) // catching higher dimensionality dataset
- {} // do nothing, exception expected
+ catch (FileIException &E) // catching higher dimensionality dataset
+ {
+ } // do nothing, exception expected
- // CHECK_I(ret, "H5Fclose"); // leave this here, later, fake a failure
- // in the p_close see how this will handle it. - BMR
+ // CHECK_I(ret, "H5Fclose"); // leave this here, later, fake a failure
+ // in the p_close see how this will handle it. - BMR
PASSED();
- } // end of try block
+ } // end of try block
- catch (InvalidActionException& E)
- {
+ catch (InvalidActionException &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
}
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_h5s_basic()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_h5s_basic()
+} // test_h5s_basic()
-
/*-------------------------------------------------------------------------
* Function: test_h5s_scalar_write
*
@@ -234,7 +236,8 @@ static void test_h5s_basic()
* with a special routine.
*-------------------------------------------------------------------------
*/
-static void test_h5s_scalar_write()
+static void
+test_h5s_scalar_write()
{
// Output message about test being performed
SUBTEST("Scalar Dataspace Writing");
@@ -246,7 +249,7 @@ static void test_h5s_scalar_write()
// Create scalar dataspace
DataSpace sid1(SPACE3_RANK, NULL);
- //n = H5Sget_simple_extent_npoints(sid1);
+ // n = H5Sget_simple_extent_npoints(sid1);
hssize_t n; // Number of dataspace elements
n = sid1.getSimpleExtentNpoints();
verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
@@ -256,9 +259,9 @@ static void test_h5s_scalar_write()
verify_val(rank, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
// Retrieves dimension size of dataspace sid1 and verify it
- int ndims; // Number of dimensions
+ int ndims; // Number of dimensions
hsize_t tdims[4]; // Dimension array to test with
- ndims = sid1.getSimpleExtentDims( tdims );
+ ndims = sid1.getSimpleExtentDims(tdims);
verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
// Verify extent type
@@ -267,18 +270,16 @@ static void test_h5s_scalar_write()
verify_val(ext_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__);
// Create and write a dataset
- DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1);
+ DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT, sid1);
dataset.write(&space3_data, PredType::NATIVE_UINT);
PASSED();
} // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_h5s_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_h5s_scalar_write()
+} // test_h5s_scalar_write()
-
/*-------------------------------------------------------------------------
* Function: test_h5s_scalar_read
*
@@ -298,7 +299,8 @@ static void test_h5s_scalar_write()
* with a special routine.
*-------------------------------------------------------------------------
*/
-static void test_h5s_scalar_read()
+static void
+test_h5s_scalar_read()
{
hsize_t tdims[4]; // Dimension array to test with
@@ -331,16 +333,14 @@ static void test_h5s_scalar_read()
verify_val(rdata, space3_data, "DataSet::read", __LINE__, __FILE__);
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
// all the exceptions caused by negative returned values by C APIs
issue_fail_msg("test_h5s_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_h5s_scalar_read()
+} // test_h5s_scalar_read()
-
/*-------------------------------------------------------------------------
* Function: test_h5s_null
*
@@ -360,7 +360,8 @@ static void test_h5s_scalar_read()
* with a special routine.
*-------------------------------------------------------------------------
*/
-static void test_h5s_null()
+static void
+test_h5s_null()
{
// Output message about test being performed
SUBTEST("Null Dataspace Writing");
@@ -377,7 +378,7 @@ static void test_h5s_null()
verify_val((long)n, 0, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Create a dataset
- DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1);
+ DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT, sid1);
// Try to write nothing to the dataset
dataset.write(&space5_data, PredType::NATIVE_INT);
@@ -388,13 +389,11 @@ static void test_h5s_null()
PASSED();
} // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_h5s_null()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_h5s_null()
+} // test_h5s_null()
-
/*-------------------------------------------------------------------------
* Function: test_h5s_compound_scalar_write
*
@@ -415,7 +414,8 @@ static void test_h5s_null()
* with a special routine.
*-------------------------------------------------------------------------
*/
-static void test_h5s_compound_scalar_write()
+static void
+test_h5s_compound_scalar_write()
{
// Output message about test being performed
SUBTEST("Compound Dataspace Writing");
@@ -426,18 +426,14 @@ static void test_h5s_compound_scalar_write()
// Create the compound datatype.
CompType tid1(sizeof(struct space4_struct));
- space4_field1_off=HOFFSET(struct space4_struct, c1);
- tid1.insertMember(SPACE4_FIELDNAME1, space4_field1_off,
- PredType::NATIVE_SCHAR);
- space4_field2_off=HOFFSET(struct space4_struct, u);
- tid1.insertMember(SPACE4_FIELDNAME2, space4_field2_off,
- PredType::NATIVE_UINT);
- space4_field3_off=HOFFSET(struct space4_struct, f);
- tid1.insertMember(SPACE4_FIELDNAME3, space4_field3_off,
- PredType::NATIVE_FLOAT);
- space4_field4_off=HOFFSET(struct space4_struct, c2);
- tid1.insertMember(SPACE4_FIELDNAME4, space4_field4_off,
- PredType::NATIVE_SCHAR);
+ space4_field1_off = HOFFSET(struct space4_struct, c1);
+ tid1.insertMember(SPACE4_FIELDNAME1, space4_field1_off, PredType::NATIVE_SCHAR);
+ space4_field2_off = HOFFSET(struct space4_struct, u);
+ tid1.insertMember(SPACE4_FIELDNAME2, space4_field2_off, PredType::NATIVE_UINT);
+ space4_field3_off = HOFFSET(struct space4_struct, f);
+ tid1.insertMember(SPACE4_FIELDNAME3, space4_field3_off, PredType::NATIVE_FLOAT);
+ space4_field4_off = HOFFSET(struct space4_struct, c2);
+ tid1.insertMember(SPACE4_FIELDNAME4, space4_field4_off, PredType::NATIVE_SCHAR);
// Create scalar dataspace
DataSpace sid1(SPACE3_RANK, NULL);
@@ -459,15 +455,13 @@ static void test_h5s_compound_scalar_write()
dataset.write(&space4_data, tid1);
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
// all the exceptions caused by negative returned values by C APIs
issue_fail_msg("test_h5s_compound_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_h5s_compound_scalar_write()
+} // test_h5s_compound_scalar_write()
-
/*-------------------------------------------------------------------------
* Function: test_h5s_compound_scalar_read
*
@@ -488,7 +482,8 @@ static void test_h5s_compound_scalar_write()
* with a special routine.
*-------------------------------------------------------------------------
*/
-static void test_h5s_compound_scalar_read()
+static void
+test_h5s_compound_scalar_read()
{
hsize_t tdims[4]; // Dimension array to test with
@@ -521,27 +516,24 @@ static void test_h5s_compound_scalar_read()
dataset.read(&rdata, type);
// Verify read data
- if(HDmemcmp(&space4_data,&rdata,sizeof(struct space4_struct)))
- {
- cerr << "scalar data different: space4_data.c1="
- << space4_data.c1 << ", read_data4.c1=" << rdata.c1 << endl;
- cerr << "scalar data different: space4_data.u="
- << space4_data.u << ", read_data4.u=" << rdata.u << endl;
- cerr << "scalar data different: space4_data.f="
- << space4_data.f << ", read_data4.f=" << rdata.f << endl;
- TestErrPrintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n",
- space4_data.c1, rdata.c2);
+ if (HDmemcmp(&space4_data, &rdata, sizeof(struct space4_struct))) {
+ cerr << "scalar data different: space4_data.c1=" << space4_data.c1
+ << ", read_data4.c1=" << rdata.c1 << endl;
+ cerr << "scalar data different: space4_data.u=" << space4_data.u << ", read_data4.u=" << rdata.u
+ << endl;
+ cerr << "scalar data different: space4_data.f=" << space4_data.f << ", read_data4.f=" << rdata.f
+ << endl;
+ TestErrPrintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n", space4_data.c1,
+ rdata.c2);
} // end if
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
// all the exceptions caused by negative returned values by C APIs
issue_fail_msg("test_h5s_compound_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_h5s_compound_scalar_read()
+} // test_h5s_compound_scalar_read()
-
/*-------------------------------------------------------------------------
* Function: test_h5s
*
@@ -553,21 +545,20 @@ static void test_h5s_compound_scalar_read()
* Mar 2001
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_h5s()
+extern "C" void
+test_h5s()
{
// Output message about test being performed
MESSAGE(5, ("Testing Dataspaces\n"));
- test_h5s_basic(); // Test basic H5S code
- test_h5s_scalar_write(); // Test scalar H5S writing code
- test_h5s_scalar_read(); // Test scalar H5S reading code
- test_h5s_null(); // Test null H5S code
- test_h5s_compound_scalar_write(); // Test compound datatype scalar H5S writing code
- test_h5s_compound_scalar_read(); // Test compound datatype scalar H5S reading code
-} // test_h5s()
+ test_h5s_basic(); // Test basic H5S code
+ test_h5s_scalar_write(); // Test scalar H5S writing code
+ test_h5s_scalar_read(); // Test scalar H5S reading code
+ test_h5s_null(); // Test null H5S code
+ test_h5s_compound_scalar_write(); // Test compound datatype scalar H5S writing code
+ test_h5s_compound_scalar_read(); // Test compound datatype scalar H5S reading code
+} // test_h5s()
-
/*-------------------------------------------------------------------------
* Function: cleanup_h5s
*
@@ -576,9 +567,8 @@ void test_h5s()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_h5s()
+extern "C" void
+cleanup_h5s()
{
HDremove(DATAFILE.c_str());
-} // cleanup_h5s
-
+} // cleanup_h5s
diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp
index d69e8d2..83229b9 100644
--- a/c++/test/titerate.cpp
+++ b/c++/test/titerate.cpp
@@ -25,11 +25,11 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
/* Number of datasets for group iteration test */
#define NDATASETS 50
@@ -41,53 +41,48 @@ using namespace H5;
//#define ITER_NGROUPS 150
/* General maximum length of names used */
-#define NAMELEN 80
+#define NAMELEN 80
/* 1-D dataset with fixed dimensions */
//#define SPACE1_RANK 1
//#define SPACE1_DIM1 4
-const H5std_string FILE_ITERATE("titerate.h5");
-const H5std_string GROUP1("Top Group");
-const H5std_string GROUP1_PATH("/Top Group");
-const H5std_string GROUP1_1("Sub-Group 1.1");
-const H5std_string GROUP1_1_PATH("/Top Group/Sub-Group 1.1");
-const H5std_string GROUP1_2("Sub-Group 1.2");
-const H5std_string GROUP1_2_PATH("/Top Group/Sub-Group 1.2");
-const H5std_string DSET_DEFAULT_NAME("default");
-const H5std_string DSET_IN_FILE("Dataset in File");
-const H5std_string DSET_IN_FILE_PATH("/Dataset in File");
-const H5std_string DSET_IN_GRP1("Dataset in Group 1");
-const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset in Group 1");
-const H5std_string DSET_IN_GRP1_2("Dataset in Group 1.2");
-const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset in Group 1.2");
-
-typedef enum {
- RET_ZERO,
- RET_TWO,
- RET_CHANGE,
- RET_CHANGE2
-} iter_enum;
+const H5std_string FILE_ITERATE("titerate.h5");
+const H5std_string GROUP1("Top Group");
+const H5std_string GROUP1_PATH("/Top Group");
+const H5std_string GROUP1_1("Sub-Group 1.1");
+const H5std_string GROUP1_1_PATH("/Top Group/Sub-Group 1.1");
+const H5std_string GROUP1_2("Sub-Group 1.2");
+const H5std_string GROUP1_2_PATH("/Top Group/Sub-Group 1.2");
+const H5std_string DSET_DEFAULT_NAME("default");
+const H5std_string DSET_IN_FILE("Dataset in File");
+const H5std_string DSET_IN_FILE_PATH("/Dataset in File");
+const H5std_string DSET_IN_GRP1("Dataset in Group 1");
+const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset in Group 1");
+const H5std_string DSET_IN_GRP1_2("Dataset in Group 1.2");
+const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset in Group 1.2");
+
+typedef enum { RET_ZERO, RET_TWO, RET_CHANGE, RET_CHANGE2 } iter_enum;
/* Custom group iteration callback data */
typedef struct {
- char name[NAMELEN]; /* The name of the object */
- H5O_type_t type; /* The type of the object */
- iter_enum command; /* The type of return value */
+ char name[NAMELEN]; /* The name of the object */
+ H5O_type_t type; /* The type of the object */
+ iter_enum command; /* The type of return value */
} iter_info;
int iter_strcmp(const void *s1, const void *s2);
-
/*-------------------------------------------------------------------------
* Function: iter_strcmp
*
* Purpose String comparison routine for qsort
*-------------------------------------------------------------------------
*/
-int iter_strcmp(const void *s1, const void *s2)
+int
+iter_strcmp(const void *s1, const void *s2)
{
- return(HDstrcmp(*(const char * const *)s1,*(const char * const *)s2));
+ return (HDstrcmp(*(const char *const *)s1, *(const char *const *)s2));
}
/*-------------------------------------------------------------------------
@@ -96,36 +91,37 @@ int iter_strcmp(const void *s1, const void *s2)
* Purpose Custom link iteration callback routine
*-------------------------------------------------------------------------
*/
-static herr_t liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info, void *op_data)
+static herr_t
+liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info,
+ void *op_data)
{
- iter_info *info = (iter_info *)op_data;
- static int count = 0;
+ iter_info *info = (iter_info *)op_data;
+ static int count = 0;
static int count2 = 0;
HDstrcpy(info->name, name);
- switch(info->command) {
+ switch (info->command) {
case RET_ZERO:
- return(0);
+ return (0);
case RET_TWO:
- return(2);
+ return (2);
case RET_CHANGE:
count++;
- return(count > 10 ? 1 : 0);
+ return (count > 10 ? 1 : 0);
case RET_CHANGE2:
count2++;
- return(count2 > 10 ? 1 : 0);
+ return (count2 > 10 ? 1 : 0);
default:
printf("invalid iteration command");
- return(-1);
+ return (-1);
} /* end switch */
} /* end liter_cb() */
-
/*-------------------------------------------------------------------------
* Function: test_iter_group
*
@@ -138,14 +134,15 @@ static herr_t liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_i
* Friday, September 9, 2016
*-------------------------------------------------------------------------
*/
-static void test_iter_group(FileAccPropList& fapl)
+static void
+test_iter_group(FileAccPropList &fapl)
{
- int i; /* counting variable */
- hsize_t idx; /* Index in the group */
- char name[NAMELEN]; /* temporary name buffer */
- char *lnames[NDATASETS + 2];/* Names of the links created */
- iter_info info; /* Custom iteration information */
- herr_t ret; /* Generic return value */
+ int i; /* counting variable */
+ hsize_t idx; /* Index in the group */
+ char name[NAMELEN]; /* temporary name buffer */
+ char * lnames[NDATASETS + 2]; /* Names of the links created */
+ iter_info info; /* Custom iteration information */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
SUBTEST("Group Iteration");
@@ -157,8 +154,8 @@ static void test_iter_group(FileAccPropList& fapl)
/* Test iterating over empty group */
info.command = RET_ZERO;
- idx = 0;
- ret = H5Literate2(file.getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
+ idx = 0;
+ ret = H5Literate2(file.getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
verify_val(ret, SUCCEED, "H5Literate", __LINE__, __FILE__);
DataType datatype(PredType::NATIVE_INT);
@@ -166,16 +163,15 @@ static void test_iter_group(FileAccPropList& fapl)
// Create a scalar file space
DataSpace filespace;
- for (i=0; i< NDATASETS; i++)
- {
- sprintf(name, "Dataset %d", i);
+ for (i = 0; i < NDATASETS; i++) {
+ sprintf(name, "Dataset %d", i);
- // Create a dataset in the file
- DataSet dataset = file.createDataSet(name, datatype, filespace);
+ // Create a dataset in the file
+ DataSet dataset = file.createDataSet(name, datatype, filespace);
- /* Keep a copy of the dataset names */
- lnames[i] = HDstrdup(name);
- check_values(lnames[i], "HDstrdup returns NULL", __LINE__, __FILE__);
+ /* Keep a copy of the dataset names */
+ lnames[i] = HDstrdup(name);
+ check_values(lnames[i], "HDstrdup returns NULL", __LINE__, __FILE__);
} /* end for */
@@ -191,7 +187,6 @@ static void test_iter_group(FileAccPropList& fapl)
/* Sort the dataset names */
HDqsort(lnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp);
-
/* Iterate through the datasets in the root group in various ways */
// Open data file to read
@@ -205,15 +200,16 @@ static void test_iter_group(FileAccPropList& fapl)
verify_val(nobjs, (hsize_t)(NDATASETS + 2), "H5Gget_info", __LINE__, __FILE__);
H5std_string obj_name;
- for (i = 0; i < nobjs; i++)
- {
- //H5O_info2_t oinfo; /* Object info */
+ for (i = 0; i < nobjs; i++) {
+ // H5O_info2_t oinfo; /* Object info */
obj_name = root_group.getObjnameByIdx(i);
- //ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
+ // ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i,
+ // dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
- //oinfo = root_group.childObjType((hsize_t)i, H5_INDEX_NAME, H5_ITER_INC, ".");
- //ret = H5Oget_info_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5P_DEFAULT);
+ // oinfo = root_group.childObjType((hsize_t)i, H5_INDEX_NAME, H5_ITER_INC, ".");
+ // ret = H5Oget_info_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo,
+ // H5P_DEFAULT);
} /* end for */
// Attempted to iterate with invalid index, should fail
@@ -223,63 +219,69 @@ static void test_iter_group(FileAccPropList& fapl)
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with invalid index");
}
- catch (GroupIException& invalid_action) // invalid index
- {} // do nothing, exception expected
+ catch (GroupIException &invalid_action) // invalid index
+ {
+ } // do nothing, exception expected
// Attempted to iterate with negative index, should fail
try {
info.command = RET_ZERO;
- idx = (hsize_t)-1;
- obj_name = root_group.getObjnameByIdx(idx);
+ idx = (hsize_t)-1;
+ obj_name = root_group.getObjnameByIdx(idx);
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index");
}
- catch (FileIException& invalid_action) // invalid index
- {} // do nothing, exception expected
- catch (GroupIException& invalid_action) // invalid index
- {} // do nothing, exception expected
+ catch (FileIException &invalid_action) // invalid index
+ {
+ } // do nothing, exception expected
+ catch (GroupIException &invalid_action) // invalid index
+ {
+ } // do nothing, exception expected
/* Test skipping exactly as many entries as in the group */
try {
info.command = RET_ZERO;
- idx = NDATASETS + 2;
- obj_name = root_group.getObjnameByIdx(idx);
+ idx = NDATASETS + 2;
+ obj_name = root_group.getObjnameByIdx(idx);
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index");
}
- catch (FileIException& invalid_action) // invalid index
- {} // do nothing, exception expected
- catch (GroupIException& invalid_action) // invalid index
- {} // do nothing, exception expected
+ catch (FileIException &invalid_action) // invalid index
+ {
+ } // do nothing, exception expected
+ catch (GroupIException &invalid_action) // invalid index
+ {
+ } // do nothing, exception expected
/* Test skipping more entries than are in the group */
try {
info.command = RET_ZERO;
- idx = NDATASETS + 3;
- obj_name = root_group.getObjnameByIdx(idx);
+ idx = NDATASETS + 3;
+ obj_name = root_group.getObjnameByIdx(idx);
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index");
}
- catch (FileIException& invalid_action) // invalid index
- {} // do nothing, exception expected
- catch (GroupIException& invalid_action) // invalid index
- {} // do nothing, exception expected
+ catch (FileIException &invalid_action) // invalid index
+ {
+ } // do nothing, exception expected
+ catch (GroupIException &invalid_action) // invalid index
+ {
+ } // do nothing, exception expected
/* Free the dataset names */
- for(i = 0; i< (NDATASETS + 2); i++)
+ for (i = 0; i < (NDATASETS + 2); i++)
HDfree(lnames[i]);
// Everything will be closed as they go out of scope
PASSED();
- } // try block
+ } // try block
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_iter_group", __LINE__, __FILE__);
}
@@ -348,7 +350,6 @@ static void test_iter_group(FileAccPropList& fapl)
#endif
} /* test_iter_group() */
-
/*-------------------------------------------------------------------------
* Function: printelems
*
@@ -362,31 +363,29 @@ const H5std_string GDATASET_NAME("group dset");
const H5std_string ATTR_NAME("Units");
const H5std_string FATTR_NAME("F attr");
const H5std_string GATTR_NAME("G attr");
-const int DIM1 = 2;
-void printelems(const Group& group, const H5std_string& dsname, const H5std_string& atname)
+const int DIM1 = 2;
+void
+printelems(const Group &group, const H5std_string &dsname, const H5std_string &atname)
{
- try
- {
- DataSet d1(group.openDataSet(dsname));
+ try {
+ DataSet d1(group.openDataSet(dsname));
DataSpace s1 = d1.getSpace();
s1.close();
d1.close();
- unsigned idx = 0;
- Attribute a1(group.openAttribute(idx));
+ unsigned idx = 0;
+ Attribute a1(group.openAttribute(idx));
H5std_string aname = a1.getName();
verify_val(aname, atname, "printelems", __LINE__, __FILE__);
a1.close();
- }
+ }
// Catch all exceptions and rethrow so caller can handle
- catch (Exception& E)
- {
+ catch (Exception &E) {
throw;
}
}
-
/*-------------------------------------------------------------------------
* Function: test_HDFFV_9920
*
@@ -396,33 +395,31 @@ void printelems(const Group& group, const H5std_string& dsname, const H5std_stri
* Friday, September 9, 2016
*-------------------------------------------------------------------------
*/
-static void test_HDFFV_9920()
+static void
+test_HDFFV_9920()
{
- int attr_data[2] = { 100, 200};
- hsize_t dims[1] = { DIM1 };
+ int attr_data[2] = {100, 200};
+ hsize_t dims[1] = {DIM1};
- try
- {
+ try {
// Create a new file and a group in it
- H5File file( FILE_NAME, H5F_ACC_TRUNC );
+ H5File file(FILE_NAME, H5F_ACC_TRUNC);
Group gr1(file.createGroup(GRP_NAME));
// Create the data space for the attribute.
- DataSpace dspace = DataSpace (1, dims );
+ DataSpace dspace = DataSpace(1, dims);
DataSet fds = file.createDataSet(FDATASET_NAME, PredType::STD_I32BE, dspace);
DataSet gds = gr1.createDataSet(GDATASET_NAME, PredType::STD_I32BE, dspace);
// Create a file attribute and a group attribute.
- Attribute fa1 = file.createAttribute(FATTR_NAME, PredType::STD_I32BE,
- dspace);
- Attribute ga1 = gr1.createAttribute(GATTR_NAME, PredType::STD_I32BE,
- dspace);
+ Attribute fa1 = file.createAttribute(FATTR_NAME, PredType::STD_I32BE, dspace);
+ Attribute ga1 = gr1.createAttribute(GATTR_NAME, PredType::STD_I32BE, dspace);
// Write the attribute data.
- fa1.write( PredType::NATIVE_INT, attr_data);
- ga1.write( PredType::NATIVE_INT, attr_data);
+ fa1.write(PredType::NATIVE_INT, attr_data);
+ ga1.write(PredType::NATIVE_INT, attr_data);
fa1.close();
ga1.close();
@@ -433,16 +430,14 @@ static void test_HDFFV_9920()
printelems(file, FDATASET_NAME, FATTR_NAME);
printelems(gr1, GDATASET_NAME, GATTR_NAME);
- } // end of try block
+ } // end of try block
// Catch all failures for handling in the same way
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_HDFFV_9920()", __LINE__, __FILE__, E.getCDetailMsg());
}
}
-
/*-------------------------------------------------------------------------
* Function: test_iterate
*
@@ -455,8 +450,8 @@ static void test_HDFFV_9920()
* Tuesday, September 6, 2016
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_iterate()
+extern "C" void
+test_iterate()
{
// Output message about test being performed
MESSAGE(5, ("Testing Iterate Feature\n"));
@@ -465,13 +460,12 @@ void test_iterate()
FileAccPropList fapl;
fapl.setLibverBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
- test_iter_group(fapl); // Test iterating groups
- test_HDFFV_9920(); // Test the fix of HDFFV-9920
- //test_iter_attr(fapl); // Test iterating attributes
+ test_iter_group(fapl); // Test iterating groups
+ test_HDFFV_9920(); // Test the fix of HDFFV-9920
+ // test_iter_attr(fapl); // Test iterating attributes
-} // test_iterate
+} // test_iterate
-
/*-------------------------------------------------------------------------
* Function: cleanup_iterate
*
@@ -480,8 +474,8 @@ void test_iterate()
* Return none
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_iterate()
+extern "C" void
+cleanup_iterate()
{
HDremove(FILE_ITERATE.c_str());
} // cleanup_iterate
diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp
index 1bdd442..8690ac2 100644
--- a/c++/test/tlinks.cpp
+++ b/c++/test/tlinks.cpp
@@ -25,37 +25,30 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
-#define NAME_BUF_SIZE 1024
-#define H5L_DIM1 100
-#define H5L_DIM2 100
+#define NAME_BUF_SIZE 1024
+#define H5L_DIM1 100
+#define H5L_DIM2 100
// Object visit structs
typedef struct {
- const char *path; /* Path to object */
- H5O_type_t type; /* Type of object */
+ const char *path; /* Path to object */
+ H5O_type_t type; /* Type of object */
} obj_visit_t;
// User data for callback function
typedef struct {
- unsigned idx; /* Index in object visit structure */
- const obj_visit_t *info; /* Pointer to the object visit structure to use */
+ unsigned idx; /* Index in object visit structure */
+ const obj_visit_t *info; /* Pointer to the object visit structure to use */
} ovisit_ud_t;
-static const char *FILENAME[] = {
- "link0",
- "link1.h5",
- "link2.h5",
- "visit",
- NULL
-};
+static const char *FILENAME[] = {"link0", "link1.h5", "link2.h5", "visit", NULL};
-
/*-------------------------------------------------------------------------
* Function: test_basic_links
*
@@ -67,17 +60,17 @@ static const char *FILENAME[] = {
* October 16, 2009
*-------------------------------------------------------------------------
*/
-static void test_basic_links(hid_t fapl_id, hbool_t new_format)
+static void
+test_basic_links(hid_t fapl_id, hbool_t new_format)
{
hsize_t size[1] = {1};
- char filename[NAME_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
// Use the file access template id to create a file access prop. list.
FileAccPropList fapl(fapl_id);
- try
- {
- if(new_format)
+ try {
+ if (new_format)
SUBTEST("Link creation (w/new group format)")
else
SUBTEST("Link creation")
@@ -86,7 +79,7 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format)
H5File file(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
// Create simple dataspace
- DataSpace scalar (1, size, size);
+ DataSpace scalar(1, size, size);
// Create a group then close it by letting the object go out of scope
{
@@ -103,25 +96,19 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format)
// Because these are not implemented in the C++ API yet, they are
// used so CommonFG::getLinkval can be tested.
// Create a hard link
- if(H5Lcreate_hard(
- file_id, "dset1", H5L_SAME_LOC, "grp1/hard1",
- H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_hard(file_id, "dset1", H5L_SAME_LOC, "grp1/hard1", H5P_DEFAULT, H5P_DEFAULT) < 0)
throw Exception("test_basic_links", "H5Lcreate_hard failed");
// Create a symbolic link
- if(H5Lcreate_soft(
- "/dset1", file_id, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_soft("/dset1", file_id, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
throw Exception("test_basic_links", "H5Lcreate_soft failed");
// Create a symbolic link to something that doesn't exist
- if(H5Lcreate_soft(
- "foobar", file_id, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_soft("foobar", file_id, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0)
throw Exception("test_basic_links", "H5Lcreate_soft failed");
// Create a recursive symbolic link
- if(H5Lcreate_soft(
- "/grp1/recursive", file_id, "/grp1/recursive",
- H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_soft("/grp1/recursive", file_id, "/grp1/recursive", H5P_DEFAULT, H5P_DEFAULT) < 0)
throw Exception("test_basic_links", "H5Lcreate_soft failed");
// Verify link values before closing the file
@@ -136,26 +123,24 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format)
verify_val(reclink_val, "/grp1/recursive", "H5File::getLinkval grp1/recursive", __LINE__, __FILE__);
} // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_basic_links()", __LINE__, __FILE__, E.getCDetailMsg());
}
// Open the file and check on the links in it
- try
- {
+ try {
// Open the file above
H5File file(filename, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl);
// Verify link existence
- if(file.nameExists("dset1", LinkAccPropList::DEFAULT) != TRUE)
+ if (file.nameExists("dset1", LinkAccPropList::DEFAULT) != TRUE)
throw InvalidActionException("H5File::nameExists", "dset1 doesn't exist");
- if(file.nameExists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE)
+ if (file.nameExists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE)
throw InvalidActionException("H5File::nameExists", "grp1/soft doesn't exist");
// Deprecated
- if(file.exists("dset1", LinkAccPropList::DEFAULT) != TRUE)
+ if (file.exists("dset1", LinkAccPropList::DEFAULT) != TRUE)
throw InvalidActionException("H5File::exists", "dset1 doesn't exist");
- if(file.exists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE)
+ if (file.exists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE)
throw InvalidActionException("H5File::exists", "grp1/soft doesn't exist");
// Verify link values
@@ -167,13 +152,11 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format)
PASSED();
} // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_basic_links()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_basic_links
-
/*-------------------------------------------------------------------------
* Function: test_lcpl
*
@@ -191,16 +174,15 @@ static void
test_lcpl(hid_t fapl_id, hbool_t new_format)
{
H5L_info2_t linfo;
- char filename[1024];
- hsize_t dims[2];
+ char filename[1024];
+ hsize_t dims[2];
- if(new_format)
+ if (new_format)
SUBTEST("Link creation property lists (w/new group format)")
else
SUBTEST("Link creation property lists")
- try
- {
+ try {
FileAccPropList fapl(fapl_id);
// Create a new file.
@@ -213,7 +195,7 @@ test_lcpl(hid_t fapl_id, hbool_t new_format)
// Check that its character encoding is the default.
linfo = file.getLinkInfo(GROUP1NAME);
- if(linfo.cset != H5T_CSET_ASCII)
+ if (linfo.cset != H5T_CSET_ASCII)
throw InvalidActionException("H5Lget_info", "Character encoding is not default");
// Create and commit a datatype with the default LCPL.
@@ -228,7 +210,7 @@ test_lcpl(hid_t fapl_id, hbool_t new_format)
// Create a simple dataspace.
dims[0] = H5L_DIM1;
dims[1] = H5L_DIM2;
- DataSpace dspace(2 ,dims);
+ DataSpace dspace(2, dims);
// Create a dataset using the default LCPL.
DataSet dset(file.createDataSet("/dataset", PredType::NATIVE_INT, dspace));
@@ -252,13 +234,11 @@ test_lcpl(hid_t fapl_id, hbool_t new_format)
PASSED();
} // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_lcpl()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // end test_lcpl()
-
/*-------------------------------------------------------------------------
* Function: test_move
*
@@ -272,15 +252,14 @@ test_lcpl(hid_t fapl_id, hbool_t new_format)
static void
test_move(hid_t fapl_id, hbool_t new_format)
{
- char filename[1024];
+ char filename[1024];
- if(new_format)
+ if (new_format)
SUBTEST("Group::moveLink (w/new group format)")
else
SUBTEST("Group::moveLink")
- try
- {
+ try {
FileAccPropList fapl(fapl_id);
// Create two new files
@@ -303,15 +282,16 @@ test_move(hid_t fapl_id, hbool_t new_format)
grp_1.moveLink("group_move", file_b, "group_new_name");
// Should throw an exception but didn't
- H5_FAILED();
- cerr << " Group group_move should not be moved across files" << endl;
- } catch (Exception& E) {
+ H5_FAILED();
+ cerr << " Group group_move should not be moved across files" << endl;
+ }
+ catch (Exception &E) {
// expected
}
// Move a soft link across files, should succeed
grp_2.moveLink("soft", file_b, "soft_new_name");
- if(file_b.exists("soft_new_name") != TRUE)
+ if (file_b.exists("soft_new_name") != TRUE)
throw InvalidActionException("H5File::exists", "grp1/soft doesn't exist");
// Move a group across groups in the same file while renaming it
@@ -326,9 +306,10 @@ test_move(hid_t fapl_id, hbool_t new_format)
moved_grp = grp_1.openGroup("group_move");
// Should throw an exception but didn't
- H5_FAILED();
- cerr << " Group group_move should not be in original location" << endl;
- } catch (Exception& E) {
+ H5_FAILED();
+ cerr << " Group group_move should not be in original location" << endl;
+ }
+ catch (Exception &E) {
// expected
}
@@ -360,46 +341,49 @@ test_move(hid_t fapl_id, hbool_t new_format)
moved_grp = grp_1.openGroup("group_newer_name");
moved_grp.close();
- H5_FAILED(); // Should throw an exception but didn't
- cerr << " Group group_newer_name should not be in GROUP1NAME" << endl;
- } catch (Exception& E) {
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_newer_name should not be in GROUP1NAME" << endl;
+ }
+ catch (Exception &E) {
// expected
}
try {
moved_grp = grp_2.openGroup("group_newer_name");
moved_grp.close();
- H5_FAILED(); // Should throw an exception but didn't
- cerr << " Group group_newer_name should not be in GROUP2NAME" << endl;
- } catch (Exception& E) {
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_newer_name should not be in GROUP2NAME" << endl;
+ }
+ catch (Exception &E) {
// expected
}
try {
moved_grp = grp_2.openGroup("group_new_name");
moved_grp.close();
- H5_FAILED(); // Should throw an exception but didn't
- cerr << " Group group_new_name should not be in GROUP2NAME" << endl;
- } catch (Exception& E) {
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_new_name should not be in GROUP2NAME" << endl;
+ }
+ catch (Exception &E) {
// expected
}
try {
moved_grp = grp_1.openGroup("group_copy");
moved_grp.close();
- H5_FAILED(); // Should throw an exception but didn't
- cerr << " Group group_copy should not be in GROUP1NAME" << endl;
- } catch (Exception& E) {
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_copy should not be in GROUP1NAME" << endl;
+ }
+ catch (Exception &E) {
// expected
}
PASSED();
} // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_move()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_move
-
+
/*-------------------------------------------------------------------------
* Function: test_copy
*
@@ -410,17 +394,17 @@ test_move(hid_t fapl_id, hbool_t new_format)
* March, 2018
*-------------------------------------------------------------------------
*/
-static void test_copy(hid_t fapl_id, hbool_t new_format)
+static void
+test_copy(hid_t fapl_id, hbool_t new_format)
{
char filename[1024];
- if(new_format)
+ if (new_format)
SUBTEST("Group::copyLink (w/new group format)")
else
SUBTEST("Group::copyLink")
- try
- {
+ try {
// Create two new files
h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename);
H5File file_a(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl_id);
@@ -439,7 +423,8 @@ static void test_copy(hid_t fapl_id, hbool_t new_format)
// Copy a group across files, should fail
try {
grp_1.copyLink("group_copy", file_b, "group_new_name");
- } catch (Exception& E) {
+ }
+ catch (Exception &E) {
// expected
}
@@ -509,9 +494,10 @@ static void test_copy(hid_t fapl_id, hbool_t new_format)
moved_grp = grp_2.openGroup("group_newer_name");
moved_grp.close();
- H5_FAILED(); // Should throw an exception but didn't
- cerr << " Group group_newer_name should not be in GROUP2NAME" << endl;
- } catch (Exception& E) {
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_newer_name should not be in GROUP2NAME" << endl;
+ }
+ catch (Exception &E) {
// expected
}
@@ -521,21 +507,20 @@ static void test_copy(hid_t fapl_id, hbool_t new_format)
moved_grp = grp_1.openGroup("group_copy");
moved_grp.close();
- H5_FAILED(); // Should throw an exception but didn't
- cerr << " Group group_copy should not be in GROUP1NAME" << endl;
- } catch (Exception& E) {
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_copy should not be in GROUP1NAME" << endl;
+ }
+ catch (Exception &E) {
// expected
}
PASSED();
} // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_copy()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_copy
-
/*-------------------------------------------------------------------------
* Function: test_num_links
*
@@ -547,17 +532,17 @@ static void test_copy(hid_t fapl_id, hbool_t new_format)
* October 16, 2009
*-------------------------------------------------------------------------
*/
-static void test_num_links(hid_t fapl_id, hbool_t new_format)
+static void
+test_num_links(hid_t fapl_id, hbool_t new_format)
{
char filename[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
SUBTEST("Setting number of links (w/new group format)")
else
SUBTEST("Setting number of links")
- try
- {
+ try {
// Use the file access template id to create a file access prop. list.
FileAccPropList fapl(fapl_id);
@@ -565,7 +550,7 @@ static void test_num_links(hid_t fapl_id, hbool_t new_format)
H5File file(filename, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl);
LinkAccPropList lapl;
- size_t nlinks = 5;
+ size_t nlinks = 5;
lapl.setNumLinks(nlinks);
// Read it back and verify
@@ -574,13 +559,11 @@ static void test_num_links(hid_t fapl_id, hbool_t new_format)
PASSED();
} // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_num_links()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_num_links
-
// Data for visit on the file
static const obj_visit_t file_visit[] = {
{".", H5O_TYPE_GROUP},
@@ -600,22 +583,25 @@ const H5std_string FILE_NAME("tvisit.h5");
const H5std_string GROUP_NAME("/Data");
const H5std_string DSET1_NAME("/Data/Compressed_Data");
const H5std_string DSET2_NAME("/Data/Float_Data");
-const int RANK = 2;
-const int DIM1 = 2;
+const int RANK = 2;
+const int DIM1 = 2;
// Operator function
-static int visit_obj_cb(H5Object& obj, const H5std_string name, const H5O_info2_t *oinfo, void *_op_data)
+static int
+visit_obj_cb(H5Object &obj, const H5std_string name, const H5O_info2_t *oinfo, void *_op_data)
{
- ovisit_ud_t *op_data = static_cast <ovisit_ud_t *>(_op_data);
+ ovisit_ud_t *op_data = static_cast<ovisit_ud_t *>(_op_data);
// Check for correct object information
- if(strcmp(op_data->info[op_data->idx].path, name.c_str())) return(H5_ITER_ERROR);
- if(op_data->info[op_data->idx].type != oinfo->type) return(H5_ITER_ERROR);
+ if (strcmp(op_data->info[op_data->idx].path, name.c_str()))
+ return (H5_ITER_ERROR);
+ if (op_data->info[op_data->idx].type != oinfo->type)
+ return (H5_ITER_ERROR);
// Advance to next location
op_data->idx++;
- return(H5_ITER_CONT);
+ return (H5_ITER_CONT);
}
/*-------------------------------------------------------------------------
@@ -628,93 +614,90 @@ static int visit_obj_cb(H5Object& obj, const H5std_string name, const H5O_info2_
* February 8, 2019
*-------------------------------------------------------------------------
*/
-static void test_visit(hid_t fapl_id, hbool_t new_format)
+static void
+test_visit(hid_t fapl_id, hbool_t new_format)
{
- hsize_t dims[2];
- hsize_t cdims[2];
- char filename[NAME_BUF_SIZE];
+ hsize_t dims[2];
+ hsize_t cdims[2];
+ char filename[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
SUBTEST("H5Object::visit (w/new group format)")
else
SUBTEST("H5Object::visit")
- try
- {
+ try {
// Use the file access template id to create a file access prop. list
FileAccPropList fapl(fapl_id);
// Build the hdf5 file name and create the file
h5_fixname(FILENAME[3], fapl_id, filename, sizeof filename);
- H5File *file = new H5File(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+ H5File *file = new H5File(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
// Create a group
- Group* group = new Group(file->createGroup(GROUP_NAME));
+ Group *group = new Group(file->createGroup(GROUP_NAME));
// Create a chunked/compressed dataset within this group specified by path
- dims[0] = 20;
- dims[1] = 2;
- cdims[0] = 2;
- cdims[1] = 2;
- DataSpace *dataspace = new DataSpace(RANK, dims); // create new dspace
- DSetCreatPropList ds_creatplist; // create dataset creation prop list
- ds_creatplist.setChunk(2, cdims); // then modify it for compression
- ds_creatplist.setDeflate(6);
-
- DataSet* dataset = new DataSet(file->createDataSet(DSET1_NAME,
- PredType::NATIVE_INT, *dataspace, ds_creatplist));
-
- delete dataset;
- delete dataspace;
-
- // Create another dataset
- dims[0] = 5;
- dims[1] = 2;
- dataspace = new DataSpace(RANK, dims); // create second dspace
- dataset = new DataSet(file->createDataSet(DSET2_NAME,
- PredType::NATIVE_FLOAT, *dataspace));
+ dims[0] = 20;
+ dims[1] = 2;
+ cdims[0] = 2;
+ cdims[1] = 2;
+ DataSpace * dataspace = new DataSpace(RANK, dims); // create new dspace
+ DSetCreatPropList ds_creatplist; // create dataset creation prop list
+ ds_creatplist.setChunk(2, cdims); // then modify it for compression
+ ds_creatplist.setDeflate(6);
+
+ DataSet *dataset =
+ new DataSet(file->createDataSet(DSET1_NAME, PredType::NATIVE_INT, *dataspace, ds_creatplist));
+
+ delete dataset;
+ delete dataspace;
+
+ // Create another dataset
+ dims[0] = 5;
+ dims[1] = 2;
+ dataspace = new DataSpace(RANK, dims); // create second dspace
+ dataset = new DataSet(file->createDataSet(DSET2_NAME, PredType::NATIVE_FLOAT, *dataspace));
// Close everything
- delete dataset;
- delete dataspace;
- delete group;
- delete file;
+ delete dataset;
+ delete dataspace;
+ delete group;
+ delete file;
- // Reopen the file and group in the file.
- file = new H5File(filename, H5F_ACC_RDWR);
- group = new Group(file->openGroup("Data"));
+ // Reopen the file and group in the file.
+ file = new H5File(filename, H5F_ACC_RDWR);
+ group = new Group(file->openGroup("Data"));
// Open the group
- dataset = new DataSet(group->openDataSet(DSET2_NAME));
+ dataset = new DataSet(group->openDataSet(DSET2_NAME));
delete dataset;
// Visit objects in the file
- ovisit_ud_t udata; /* User-data for visiting */
- udata.idx = 0;
+ ovisit_ud_t udata; /* User-data for visiting */
+ udata.idx = 0;
udata.info = file_visit;
file->visit(H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC);
// Visit objects in the group
- udata.idx = 0;
+ udata.idx = 0;
udata.info = group_visit;
group->visit(H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC);
- // Close the group and file.
- delete group;
- delete file;
+ // Close the group and file.
+ delete group;
+ delete file;
PASSED();
} // end of try block
- catch (Exception& E)
- {
- cerr << "in catch" << endl;
+ catch (Exception &E) {
+ cerr << "in catch" << endl;
issue_fail_msg("test_visit()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_visit()
-
/*-------------------------------------------------------------------------
* Function: test_links
*
@@ -725,35 +708,33 @@ static void test_visit(hid_t fapl_id, hbool_t new_format)
* October 16, 2009
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_links()
+extern "C" void
+test_links()
{
- hid_t fapl_id, fapl2_id; /* File access property lists */
- unsigned new_format; /* Whether to use the new format or not */
+ hid_t fapl_id, fapl2_id; /* File access property lists */
+ unsigned new_format; /* Whether to use the new format or not */
- if((fapl_id = h5_fileaccess()) < 0)
+ if ((fapl_id = h5_fileaccess()) < 0)
throw Exception("test_links", "Unable to get file access property list");
// Output message about test being performed
MESSAGE(5, ("Testing Various Links\n"));
- try
- {
+ try {
/* Copy the file access property list */
- if((fapl2_id = H5Pcopy(fapl_id)) < 0)
+ if ((fapl2_id = H5Pcopy(fapl_id)) < 0)
throw Exception("test_links", "H5Pcopy failed");
/* Set the "use the latest version of the format" bounds for creating
objects in the file */
- if(H5Pset_libver_bounds(fapl2_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl2_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
throw Exception("test_links", "H5Pset_libver_bounds failed");
/* Loop over using new group format */
- for(new_format = FALSE; new_format <= TRUE; new_format++)
- {
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
hid_t my_fapl_id;
/* Check for FAPL to use */
- if(new_format)
+ if (new_format)
my_fapl_id = fapl2_id;
else
my_fapl_id = fapl_id;
@@ -773,13 +754,11 @@ void test_links()
h5_clean_files(FILENAME, fapl_id);
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_links()", __LINE__, __FILE__, E.getCDetailMsg());
}
}
-
/*-------------------------------------------------------------------------
* Function: cleanup_links
*
@@ -788,8 +767,8 @@ void test_links()
* Return none
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_links()
+extern "C" void
+cleanup_links()
{
HDremove(FILENAME[0]);
HDremove(FILENAME[1]);
diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp
index 9b5dd68..991df3f 100644
--- a/c++/test/tobject.cpp
+++ b/c++/test/tobject.cpp
@@ -23,29 +23,28 @@
#endif
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
-
-const H5std_string FILE_OBJECTS("tobjects.h5");
-const H5std_string FILE_OBJHDR("tobject_header.h5");
-const H5std_string GROUP1("Top Group");
-const H5std_string GROUP1_PATH("/Top Group");
-const H5std_string GROUP1_1("Sub-Group 1.1");
-const H5std_string GROUP1_1_PATH("/Top Group/Sub-Group 1.1");
-const H5std_string GROUP1_2("Sub-Group 1.2");
-const H5std_string GROUP1_2_PATH("/Top Group/Sub-Group 1.2");
-const H5std_string DSET_DEFAULT_NAME("default");
-const H5std_string DSET_IN_FILE("Dataset in File");
-const H5std_string DSET_IN_FILE_PATH("/Dataset in File");
-const H5std_string DSET_IN_GRP1("Dataset_in_Group_1");
-const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset_in_Group_1");
-const H5std_string DSET_IN_GRP1_2("Dataset_in_Group_1.2");
-const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_in_Group_1.2");
-
-
+#include "h5cpputil.h" // C++ utilility header file
+
+const H5std_string FILE_OBJECTS("tobjects.h5");
+const H5std_string FILE_OBJHDR("tobject_header.h5");
+const H5std_string GROUP1("Top Group");
+const H5std_string GROUP1_PATH("/Top Group");
+const H5std_string GROUP1_1("Sub-Group 1.1");
+const H5std_string GROUP1_1_PATH("/Top Group/Sub-Group 1.1");
+const H5std_string GROUP1_2("Sub-Group 1.2");
+const H5std_string GROUP1_2_PATH("/Top Group/Sub-Group 1.2");
+const H5std_string DSET_DEFAULT_NAME("default");
+const H5std_string DSET_IN_FILE("Dataset in File");
+const H5std_string DSET_IN_FILE_PATH("/Dataset in File");
+const H5std_string DSET_IN_GRP1("Dataset_in_Group_1");
+const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset_in_Group_1");
+const H5std_string DSET_IN_GRP1_2("Dataset_in_Group_1.2");
+const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_in_Group_1.2");
+
/*-------------------------------------------------------------------------
* Function: test_get_objname
*
@@ -68,7 +67,8 @@ const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_
* Friday, March 4, 2014
*-------------------------------------------------------------------------
*/
-static void test_get_objname()
+static void
+test_get_objname()
{
SUBTEST("H5Object::getObjName on Groups and Datasets");
@@ -77,7 +77,7 @@ static void test_get_objname()
H5File file(FILE_OBJECTS, H5F_ACC_TRUNC);
// Create a top group and 2 subgroups
- Group grp1 = file.createGroup(GROUP1, 0);
+ Group grp1 = file.createGroup(GROUP1, 0);
Group grp1_1 = grp1.createGroup(GROUP1_1, 0);
Group grp1_2 = grp1.createGroup(GROUP1_2, 0);
@@ -88,27 +88,24 @@ static void test_get_objname()
ssize_t name_len = grp1.getObjName(NULL);
// Random length is 4
- if (name_len > 4)
- {
- char* grp1_name = new char[5];
- name_len = grp1.getObjName(grp1_name, 5);
- verify_val((const char*)grp1_name, "/Top", "Group::getObjName", __LINE__, __FILE__);
- delete []grp1_name;
+ if (name_len > 4) {
+ char *grp1_name = new char[5];
+ name_len = grp1.getObjName(grp1_name, 5);
+ verify_val((const char *)grp1_name, "/Top", "Group::getObjName", __LINE__, __FILE__);
+ delete[] grp1_name;
}
// Create a data space
- hsize_t dims[2];
+ hsize_t dims[2];
dims[0] = 2;
dims[1] = 5;
- DataSpace space (2, dims, NULL);
+ DataSpace space(2, dims, NULL);
// Create a dataset in the file
- DataSet dsinfile = file.createDataSet(DSET_IN_FILE,
- PredType::NATIVE_DOUBLE, space);
+ DataSet dsinfile = file.createDataSet(DSET_IN_FILE, PredType::NATIVE_DOUBLE, space);
// Create a dataset in the group
- DataSet dsingrp = grp1.createDataSet(DSET_IN_GRP1,
- PredType::NATIVE_INT, space);
+ DataSet dsingrp = grp1.createDataSet(DSET_IN_GRP1, PredType::NATIVE_INT, space);
// Get and verify the name of each dataset, using
// H5std_string getObjName() and
@@ -135,23 +132,21 @@ static void test_get_objname()
// Reopen that same dataset then check the name again with another
// overload: ssize_t getObjName(H5std_string& obj_name, size_t len = 0)
- dsingrp = grp1_2.openDataSet(DSET_IN_GRP1_2);
+ dsingrp = grp1_2.openDataSet(DSET_IN_GRP1_2);
name_len = dsingrp.getObjName(ds_name);
verify_val(ds_name, DSET_IN_GRP1_2_PATH, "DataSet::getObjName", __LINE__, __FILE__);
// Everything will be closed as they go out of scope
PASSED();
- } // try block
+ } // try block
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_get_objname", __LINE__, __FILE__);
}
-} // test_get_objname
+} // test_get_objname
-
/*-------------------------------------------------------------------------
* Function: test_existance
*
@@ -174,7 +169,8 @@ static void test_get_objname()
* Friday, March 4, 2014
*-------------------------------------------------------------------------
*/
-static void test_existance()
+static void
+test_existance()
{
SUBTEST("H5File::exists and Group::exists");
@@ -222,7 +218,7 @@ static void test_existance()
// Check if a dataset exists given dataset as location with full path name
DataSet dset1 = file.openDataSet(DSET_IN_FILE);
- exists = dset1.nameExists("/Top Group/Dataset_in_Group_1");
+ exists = dset1.nameExists("/Top Group/Dataset_in_Group_1");
verify_val(exists, TRUE, "Group::nameExists given dataset with full path name", __LINE__, __FILE__);
exists = grp1_2.nameExists(DSET_IN_GRP1);
@@ -236,16 +232,14 @@ static void test_existance()
// Everything will be closed as they go out of scope
PASSED();
- } // try block
+ } // try block
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_existance", __LINE__, __FILE__);
}
-} // test_existance
+} // test_existance
-
/*-------------------------------------------------------------------------
* Function: test_get_objname_ontypes
*
@@ -258,7 +252,8 @@ static void test_existance()
* March 4, 2014
*-------------------------------------------------------------------------
*/
-static void test_get_objname_ontypes()
+static void
+test_get_objname_ontypes()
{
SUBTEST("H5Object::getObjName on Committed Datatypes");
@@ -267,7 +262,7 @@ static void test_get_objname_ontypes()
H5File file(FILE_OBJECTS, H5F_ACC_RDWR);
// Create a group
- Group grp = file.createGroup ("typetests");
+ Group grp = file.createGroup("typetests");
// Create a datatype and save it
IntType inttype(PredType::STD_B8LE);
@@ -326,7 +321,8 @@ static void test_get_objname_ontypes()
// Name this datatype
new_int_type.commit(grp, "IntType NATIVE_INT");
ssize_t name_len = new_int_type.getObjName(type_name); // default len
- verify_val(name_len, (ssize_t)HDstrlen("/typetests/IntType NATIVE_INT"), "DataType::getObjName", __LINE__, __FILE__);
+ verify_val(name_len, (ssize_t)HDstrlen("/typetests/IntType NATIVE_INT"), "DataType::getObjName",
+ __LINE__, __FILE__);
verify_val(type_name, "/typetests/IntType NATIVE_INT", "DataType::getObjName", __LINE__, __FILE__);
// Close everything or they can be closed when objects go out of scope
@@ -338,13 +334,11 @@ static void test_get_objname_ontypes()
PASSED();
} // end top try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_get_objname_ontypes", __LINE__, __FILE__);
}
-} // test_get_objname_ontypes
+} // test_get_objname_ontypes
-
/*-------------------------------------------------------------------------
* Function: test_get_objtype
*
@@ -357,7 +351,8 @@ static void test_get_objname_ontypes()
* Friday, March 4, 2014
*-------------------------------------------------------------------------
*/
-static void test_get_objtype()
+static void
+test_get_objtype()
{
SUBTEST("H5File::childObjType and H5Group::childObjType");
@@ -398,16 +393,14 @@ static void test_get_objtype()
// Everything will be closed as they go out of scope
PASSED();
- } // try block
+ } // try block
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_get_objtype", __LINE__, __FILE__);
}
-} // test_get_objtype
+} // test_get_objtype
-
/*-------------------------------------------------------------------------
* Function: test_open_object_header
*
@@ -427,9 +420,10 @@ const H5std_string DSETNAME("dataset");
#define DIM0 5
#define DIM1 10
-static void test_open_object_header()
+static void
+test_open_object_header()
{
- hsize_t dims[2];
+ hsize_t dims[2];
// Output message about test being performed
SUBTEST("Group::getObjId");
@@ -452,16 +446,16 @@ static void test_open_object_header()
dims[0] = DIM0;
dims[1] = DIM1;
DataSpace dspace(RANK, dims);
- DataSet dset(file1.createDataSet(DSETNAME, PredType::NATIVE_INT, dspace));
+ DataSet dset(file1.createDataSet(DSETNAME, PredType::NATIVE_INT, dspace));
// Close dataset and dataspace
dset.close();
dspace.close();
// Now make sure that getObjId can open all three types of objects
- hid_t obj_grp = file1.getObjId(GROUPNAME);
+ hid_t obj_grp = file1.getObjId(GROUPNAME);
hid_t obj_dtype = file1.getObjId(DTYPENAME);
- hid_t obj_dset = file1.getObjId(DSETNAME);
+ hid_t obj_dset = file1.getObjId(DSETNAME);
// Make sure that each is the right kind of ID
H5I_type_t id_type = IdComponent::getHDFObjType(obj_grp);
@@ -473,7 +467,7 @@ static void test_open_object_header()
/* Do something more complex with each of the IDs to make sure */
- Group grp2(obj_grp);
+ Group grp2(obj_grp);
hsize_t num_objs = grp2.getNumObjs();
verify_val(num_objs, 1, "H5Gget_info", __LINE__, __FILE__);
// There should be one object, the datatype
@@ -482,7 +476,7 @@ static void test_open_object_header()
file1.closeObjId(obj_dtype);
dset.setId(obj_dset);
- dspace = dset.getSpace();
+ dspace = dset.getSpace();
bool is_simple = dspace.isSimple();
verify_val(is_simple, true, "isSimple", __LINE__, __FILE__);
dspace.close();
@@ -509,23 +503,20 @@ static void test_open_object_header()
grp2.close();
PASSED();
- } // end of try block
+ } // end of try block
// catch invalid action exception
- catch (InvalidActionException& E)
- {
+ catch (InvalidActionException &E) {
cerr << " in InvalidActionException" << endl;
cerr << " *FAILED*" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
}
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " in Exception" << endl;
issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_open_object_header
+} // test_open_object_header
-
/*-------------------------------------------------------------------------
* Function: test_getobjectinfo_same_file
*
@@ -540,9 +531,10 @@ static void test_open_object_header()
const H5std_string FILE_OBJINFO("tobject_getinfo.h5");
const H5std_string GROUP1NAME("group1");
const H5std_string GROUP2NAME("group2");
-static void test_getobjectinfo_same_file()
+static void
+test_getobjectinfo_same_file()
{
- H5O_info2_t oinfo1, oinfo2; /* Object info structs */
+ H5O_info2_t oinfo1, oinfo2; /* Object info structs */
// Output message about test being performed
SUBTEST("Group::getObjinfo");
@@ -588,7 +580,6 @@ static void test_getobjectinfo_same_file()
grp2.getObjinfo(oinfo2);
verify_val(oinfo1.fileno, oinfo2.fileno, "file number from getObjinfo", __LINE__, __FILE__);
-
// Reset object info
HDmemset(&oinfo1, 0, sizeof(oinfo1));
HDmemset(&oinfo2, 0, sizeof(oinfo2));
@@ -604,16 +595,15 @@ static void test_getobjectinfo_same_file()
file2.close();
PASSED();
- } // end of try block
+ } // end of try block
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " in Exception " << E.getCFuncName() << "detail: " << E.getCDetailMsg() << endl;
issue_fail_msg("test_getobjectinfo_same_file()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_getobjectinfo_same_file
-
+} // test_getobjectinfo_same_file
+
/*-------------------------------------------------------------------------
* Function: test_intermediate_groups
*
@@ -636,7 +626,8 @@ const H5std_string GROUP20NAME("/group20");
const H5std_string GROUP21NAME("/group20/group21");
const H5std_string GROUP22NAME("group21/group22");
const H5std_string GROUP22FULLNAME("/group20/group21/group22");
-static void test_intermediate_groups()
+static void
+test_intermediate_groups()
{
// Output message about test being performed
SUBTEST("Group::set/getCreateIntermediateGroup");
@@ -663,7 +654,9 @@ static void test_intermediate_groups()
// fail because group GROUP13NAME is missing
try {
Group grp14_nopl(file.createGroup(GROUP14NAME));
- } catch (FileIException& expected1) {} // Failure is ignored
+ }
+ catch (FileIException &expected1) {
+ } // Failure is ignored
// Create GROUP14NAME with the flag to create missing groups set
// to FALSE, should fail because group GROUP13NAME is missing
@@ -677,14 +670,15 @@ static void test_intermediate_groups()
try {
Group grp14_false(file.createGroup(GROUP14NAME, lcpl));
- } catch (FileIException& expected2) {} // Failure is ignored
+ }
+ catch (FileIException &expected2) {
+ } // Failure is ignored
// Set the flag to create missing groups set to TRUE
lcpl.setCreateIntermediateGroup(true);
crt_int_grps = lcpl.getCreateIntermediateGroup();
verify_val(crt_int_grps, true, "LinkCreatPropList::getCreateIntermediateGroup", __LINE__, __FILE__);
-
// Create GROUP14NAME with the use of link create plist
Group grp14(file.createGroup(GROUP14NAME, lcpl));
@@ -715,16 +709,15 @@ static void test_intermediate_groups()
Group grp22fromfile(file.openGroup(GROUP22FULLNAME));
PASSED();
- } // end of try block
+ } // end of try block
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " in Exception " << E.getCFuncName() << "detail: " << E.getCDetailMsg() << endl;
issue_fail_msg("test_intermediate_groups()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_intermediate_groups
-
+} // test_intermediate_groups
+
/*-------------------------------------------------------------------------
* Function: test_object
*
@@ -736,8 +729,8 @@ static void test_intermediate_groups()
* March 4, 2014
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_object()
+extern "C" void
+test_object()
{
// Output message about test being performed
MESSAGE(5, ("Testing Object Functions\n"));
@@ -750,9 +743,8 @@ void test_object()
test_getobjectinfo_same_file(); // Test object info in same file
test_intermediate_groups(); // Test intermediate group property
-} // test_object
+} // test_object
-
/*-------------------------------------------------------------------------
* Function: cleanup_objects
*
@@ -761,8 +753,8 @@ void test_object()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_object()
+extern "C" void
+cleanup_object()
{
HDremove(FILE_OBJECTS.c_str());
} // cleanup_objects
diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp
index b46ae29..beba36a 100644
--- a/c++/test/trefer.cpp
+++ b/c++/test/trefer.cpp
@@ -26,22 +26,22 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
-const H5std_string FILE1("trefer1.h5");
-const H5std_string FILE2("trefer2.h5");
+const H5std_string FILE1("trefer1.h5");
+const H5std_string FILE2("trefer2.h5");
// Dataset 1
-const H5std_string DSET1_NAME("Dataset1");
-const H5std_string DSET2_NAME("Dataset2");
+const H5std_string DSET1_NAME("Dataset1");
+const H5std_string DSET2_NAME("Dataset2");
-const H5std_string MEMBER1( "a_name" );
-const H5std_string MEMBER2( "b_name" );
-const H5std_string MEMBER3( "c_name" );
+const H5std_string MEMBER1("a_name");
+const H5std_string MEMBER2("b_name");
+const H5std_string MEMBER3("c_name");
// 1-D dataset with fixed dimensions
const int SPACE1_RANK = 1;
@@ -58,10 +58,9 @@ const int POINT1_NPOINTS = 10;
typedef struct s1_t {
unsigned int a;
unsigned int b;
- float c;
+ float c;
} s1_t;
-
/*-------------------------------------------------------------------------
* Function: test_reference_params
*
@@ -70,30 +69,31 @@ typedef struct s1_t {
* Return None
*-------------------------------------------------------------------------
*/
-static void test_reference_params()
+static void
+test_reference_params()
{
const char *write_comment = "Foo!"; /* Comments for group */
// Output message about test being performed
SUBTEST("Object Reference Parameters");
- H5File* file1 = NULL;
+ H5File *file1 = NULL;
try {
- hobj_ref_t *wbuf, // buffer to write to disk
- *rbuf, // buffer read from disk
- *tbuf; // temp. buffer read from disk
+ hobj_ref_t *wbuf, // buffer to write to disk
+ *rbuf, // buffer read from disk
+ *tbuf; // temp. buffer read from disk
// Allocate write & read buffers
- int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t));
- wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
- rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
- tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
+ int temp_size = MAX(sizeof(unsigned), sizeof(hobj_ref_t));
+ wbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
+ rbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
+ tbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
// Create file FILE1
- file1 = new H5File (FILE1, H5F_ACC_TRUNC);
+ file1 = new H5File(FILE1, H5F_ACC_TRUNC);
// Create dataspace for datasets
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
DataSpace sid1(SPACE1_RANK, dims1);
// Create a group
@@ -105,10 +105,10 @@ static void test_reference_params()
// Create a dataset (inside /Group1)
DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1);
- unsigned *tu32; // Temporary pointer to uint32 data
- int i;
- for (tu32=(unsigned *)wbuf, i=0; i<SPACE1_DIM1; i++)
- *tu32++=i*3; // from C test
+ unsigned *tu32; // Temporary pointer to uint32 data
+ int i;
+ for (tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
+ *tu32++ = i * 3; // from C test
// Write selection to disk
dataset.write(wbuf, PredType::NATIVE_UINT);
@@ -143,19 +143,29 @@ static void test_reference_params()
/* Test parameters to H5Location::reference */
try {
file1->reference(NULL, "/Group1/Dataset1");
- } catch (ReferenceException& E) {} // We expect this to fail
+ }
+ catch (ReferenceException &E) {
+ } // We expect this to fail
try {
file1->reference(&wbuf[0], NULL);
- } catch (ReferenceException& E) {} // We expect this to fail
+ }
+ catch (ReferenceException &E) {
+ } // We expect this to fail
try {
file1->reference(&wbuf[0], "");
- } catch (ReferenceException& E) {} // We expect this to fail
+ }
+ catch (ReferenceException &E) {
+ } // We expect this to fail
try {
file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_MAXTYPE);
- } catch (ReferenceException& E) {} // We expect this to fail
+ }
+ catch (ReferenceException &E) {
+ } // We expect this to fail
try {
file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_DATASET_REGION);
- } catch (ReferenceException& E) {} // We expect this to fail
+ }
+ catch (ReferenceException &E) {
+ } // We expect this to fail
// Close resources
dataset.close();
@@ -169,17 +179,14 @@ static void test_reference_params()
PASSED();
} // end try
- catch (Exception& E)
- {
- issue_fail_msg("test_reference_param()",__LINE__,__FILE__,
- E.getCFuncName(), E.getCDetailMsg());
+ catch (Exception &E) {
+ issue_fail_msg("test_reference_param()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg());
}
- if(file1)
+ if (file1)
delete file1;
-} /* test_reference_param() */
+} /* test_reference_param() */
-
/*-------------------------------------------------------------------------
* Function: test_reference_obj
*
@@ -189,31 +196,32 @@ static void test_reference_params()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_reference_obj()
+static void
+test_reference_obj()
{
- int i; // counting variables
- const H5std_string write_comment="Foo!"; // Comments for group
+ int i; // counting variables
+ const H5std_string write_comment = "Foo!"; // Comments for group
// Output message about test being performed
SUBTEST("Object Reference Functions");
- H5File* file1 = NULL;
+ H5File *file1 = NULL;
try {
- hobj_ref_t *wbuf, // buffer to write to disk
- *rbuf, // buffer read from disk
- *tbuf; // temp. buffer read from disk
+ hobj_ref_t *wbuf, // buffer to write to disk
+ *rbuf, // buffer read from disk
+ *tbuf; // temp. buffer read from disk
// Allocate write & read buffers
- int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t));
- wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
- rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
- tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
+ int temp_size = MAX(sizeof(unsigned), sizeof(hobj_ref_t));
+ wbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
+ rbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
+ tbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
// Create file FILE1
- file1 = new H5File (FILE1, H5F_ACC_TRUNC);
+ file1 = new H5File(FILE1, H5F_ACC_TRUNC);
// Create dataspace for datasets
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
DataSpace sid1(SPACE1_RANK, dims1);
// Create dataset access property list
@@ -228,9 +236,9 @@ static void test_reference_obj()
// Create a dataset (inside /Group1)
DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1);
- unsigned *tu32; // Temporary pointer to uint32 data
+ unsigned *tu32; // Temporary pointer to uint32 data
for (tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++=i*3; // from C test
+ *tu32++ = i * 3; // from C test
// Write selection to disk
dataset.write(wbuf, PredType::NATIVE_UINT);
@@ -265,22 +273,22 @@ static void test_reference_obj()
// Create reference to dataset and test getRefObjType
file1->reference(&wbuf[0], "/Group1/Dataset1");
H5O_type_t refobj_type = dataset.getRefObjType(&wbuf[0], H5R_OBJECT);
- verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__);
+ verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__);
// Create reference to dataset and test getRefObjType
file1->reference(&wbuf[1], "/Group1/Dataset2");
refobj_type = dataset.getRefObjType(&wbuf[1], H5R_OBJECT);
- verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__);
+ verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__);
// Create reference to group
file1->reference(&wbuf[2], "/Group1");
refobj_type = dataset.getRefObjType(&wbuf[2], H5R_OBJECT);
- verify_val(refobj_type, H5O_TYPE_GROUP, "DataSet::getRefObjType",__LINE__,__FILE__);
+ verify_val(refobj_type, H5O_TYPE_GROUP, "DataSet::getRefObjType", __LINE__, __FILE__);
// Create reference to named datatype
file1->reference(&wbuf[3], "/Group1/Datatype1");
refobj_type = dataset.getRefObjType(&wbuf[3], H5R_OBJECT);
- verify_val(refobj_type, H5O_TYPE_NAMED_DATATYPE, "DataSet::getRefObjType",__LINE__,__FILE__);
+ verify_val(refobj_type, H5O_TYPE_NAMED_DATATYPE, "DataSet::getRefObjType", __LINE__, __FILE__);
// Write selection to disk
dataset.write(wbuf, PredType::STD_REF_OBJ);
@@ -304,15 +312,15 @@ static void test_reference_obj()
DataSet dset2(dataset, &rbuf[0], H5R_OBJECT, dapl);
// Check information in the referenced dataset
- sid1 = dset2.getSpace();
+ sid1 = dset2.getSpace();
hssize_t n_elements = sid1.getSimpleExtentNpoints();
- verify_val((long)n_elements, 4, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
+ verify_val((long)n_elements, 4, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Read from disk
dset2.read(tbuf, PredType::NATIVE_UINT);
- for(tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
- verify_val(*tu32, (uint32_t)(i*3), "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
+ for (tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
+ verify_val(*tu32, (uint32_t)(i * 3), "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Close dereferenced dataset
dset2.close();
@@ -323,18 +331,19 @@ static void test_reference_obj()
// Get group's comment using
// H5std_string getComment(const char* name, <buf_size=0 by default>)
H5std_string read_comment1 = group.getComment(".", 10);
- verify_val(read_comment1.c_str(), write_comment, "Group::getComment",__LINE__,__FILE__);
+ verify_val(read_comment1.c_str(), write_comment, "Group::getComment", __LINE__, __FILE__);
// Test with the old default value
read_comment1 = group.getComment(".", 256);
- verify_val(read_comment1.c_str(), write_comment, "Group::getComment",__LINE__,__FILE__);
+ verify_val(read_comment1.c_str(), write_comment, "Group::getComment", __LINE__, __FILE__);
// Test that getComment handles failures gracefully, using
// H5std_string getComment(const char* name, <buf_size=0 by default>)
try {
H5std_string read_comment_tmp = group.getComment(NULL);
}
- catch (Exception& E) {} // We expect this to fail
+ catch (Exception &E) {
+ } // We expect this to fail
// Close group
group.close();
@@ -349,9 +358,9 @@ static void test_reference_obj()
H5T_class_t tclass;
tclass = dtype1.getClass();
- verify_val(tclass, H5T_COMPOUND, "DataType::getClass",__LINE__,__FILE__);
+ verify_val(tclass, H5T_COMPOUND, "DataType::getClass", __LINE__, __FILE__);
int n_members = dtype1.getNmembers();
- verify_val(n_members, 3, "CompType::getNmembers",__LINE__,__FILE__);
+ verify_val(n_members, 3, "CompType::getNmembers", __LINE__, __FILE__);
// Close all objects and file
dtype1.close();
@@ -365,17 +374,14 @@ static void test_reference_obj()
PASSED();
} // end try
- catch (Exception& E)
- {
- issue_fail_msg("test_reference_obj()",__LINE__,__FILE__,
- E.getCFuncName(), E.getCDetailMsg());
+ catch (Exception &E) {
+ issue_fail_msg("test_reference_obj()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg());
}
- if(file1)
+ if (file1)
delete file1;
-} // test_reference_obj()
+} // test_reference_obj()
-
/*-------------------------------------------------------------------------
* Function: test_reference_group
*
@@ -384,23 +390,24 @@ static void test_reference_obj()
* Return None
*-------------------------------------------------------------------------
*/
-#define GROUPNAME "/group"
-#define GROUPNAME2 "group2"
-#define GROUPNAME3 "group3"
-#define DSETNAME "/dset"
-#define DSETNAME2 "dset2"
-#define NAME_SIZE 16
-
-static void test_reference_group()
+#define GROUPNAME "/group"
+#define GROUPNAME2 "group2"
+#define GROUPNAME3 "group3"
+#define DSETNAME "/dset"
+#define DSETNAME2 "dset2"
+#define NAME_SIZE 16
+
+static void
+test_reference_group()
{
- hobj_ref_t wref; /* Reference to write */
- hobj_ref_t rref; /* Reference to read */
- const H5std_string write_comment="Foo!"; // Comments for group
+ hobj_ref_t wref; /* Reference to write */
+ hobj_ref_t rref; /* Reference to read */
+ const H5std_string write_comment = "Foo!"; // Comments for group
// Output message about test being performed
SUBTEST("Object Reference to Group");
- H5File* file1 = NULL;
+ H5File *file1 = NULL;
try {
/*
* Create file with a group and a dataset containing an object
@@ -408,7 +415,7 @@ static void test_reference_group()
*/
// Create file FILE1
- file1 = new H5File (FILE1, H5F_ACC_TRUNC);
+ file1 = new H5File(FILE1, H5F_ACC_TRUNC);
// Create scalar dataspace
DataSpace sid1;
@@ -467,25 +474,25 @@ static void test_reference_group()
// Check number of objects in the group dereferenced by constructor
hsize_t nobjs = refgroup.getNumObjs();
- verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs",__LINE__,__FILE__);
+ verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs", __LINE__, __FILE__);
// Check number of objects in the group dereferenced by ::reference
nobjs = group.getNumObjs();
- verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs",__LINE__,__FILE__);
+ verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs", __LINE__, __FILE__);
// Check getting file name given the group dereferenced via constructor
H5std_string fname = refgroup.getFileName();
- verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__);
+ verify_val(fname, FILE1, "H5Group::getFileName", __LINE__, __FILE__);
// Check getting file name given the group dereferenced by ::reference
fname = group.getFileName();
- verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__);
+ verify_val(fname, FILE1, "H5Group::getFileName", __LINE__, __FILE__);
// Check object type using Group::getObjinfo()
H5O_info2_t oinfo;
HDmemset(&oinfo, 0, sizeof(oinfo));
group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, oinfo);
- verify_val(oinfo.type, H5O_TYPE_DATASET, "Group::getObjinfo",__LINE__,__FILE__);
+ verify_val(oinfo.type, H5O_TYPE_DATASET, "Group::getObjinfo", __LINE__, __FILE__);
// Check for out of bound query by index
try {
@@ -494,12 +501,14 @@ static void test_reference_group()
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("Group::getObjinfo", "Out of bound index.");
- } catch (Exception& err) {} // do nothing, failure expected
+ }
+ catch (Exception &err) {
+ } // do nothing, failure expected
// Unlink one of the objects in the dereferenced group, and re-check
refgroup.unlink(GROUPNAME2);
nobjs = refgroup.getNumObjs();
- verify_val(nobjs, (hsize_t)2, "H5Group::getNumObjs",__LINE__,__FILE__);
+ verify_val(nobjs, (hsize_t)2, "H5Group::getNumObjs", __LINE__, __FILE__);
// Close resources
group.close();
@@ -509,17 +518,14 @@ static void test_reference_group()
PASSED();
} // end try
- catch (Exception& E)
- {
- issue_fail_msg("test_reference_group()",__LINE__,__FILE__,
- E.getCFuncName(), E.getCDetailMsg());
+ catch (Exception &E) {
+ issue_fail_msg("test_reference_group()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg());
}
- if(file1)
+ if (file1)
delete file1;
-} /* test_reference_group() */
+} /* test_reference_group() */
-
/*-------------------------------------------------------------------------
* Function: test_reference_region_1D
*
@@ -528,30 +534,31 @@ static void test_reference_group()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_reference_region_1D()
+static void
+test_reference_region_1D()
{
- hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
- hsize_t * coords; /* Coordinate buffer */
- hsize_t low[SPACE3_RANK]; /* Selection bounds */
- hsize_t high[SPACE3_RANK]; /* Selection bounds */
- int i; /* counting variables */
+ hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ hsize_t *coords; /* Coordinate buffer */
+ hsize_t low[SPACE3_RANK]; /* Selection bounds */
+ hsize_t high[SPACE3_RANK]; /* Selection bounds */
+ int i; /* counting variables */
// Output message about test being performed
SUBTEST("1-D Dataset Region Reference Functions");
try {
- hdset_reg_ref_t *wbuf, // buffer to write to disk
- *rbuf; // buffer read from disk
- uint8_t *dwbuf, // Buffer for writing numeric data to disk
- *drbuf; // Buffer for reading numeric data from disk
+ hdset_reg_ref_t *wbuf, // buffer to write to disk
+ *rbuf; // buffer read from disk
+ uint8_t *dwbuf, // Buffer for writing numeric data to disk
+ *drbuf; // Buffer for reading numeric data from disk
// Allocate write & read buffers
- wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
- rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1);
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
@@ -559,7 +566,7 @@ static void test_reference_region_1D()
H5File file1(FILE2, H5F_ACC_TRUNC);
// Create dataspace for datasets
- hsize_t dims3[] = {SPACE3_DIM1};
+ hsize_t dims3[] = {SPACE3_DIM1};
DataSpace sid3(SPACE3_RANK, dims3);
// Create dataset access property list
@@ -568,7 +575,7 @@ static void test_reference_region_1D()
// Create a dataset
DataSet dset3 = file1.createDataSet(DSET2_NAME, PredType::STD_U8LE, sid3);
- uint8_t *tu8; // Temporary pointer to uint8 data
+ uint8_t *tu8; // Temporary pointer to uint8 data
for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
*tu8++ = i * 3; // from C test
@@ -579,7 +586,7 @@ static void test_reference_region_1D()
dset3.close();
// Create dataspace for datasets
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
DataSpace sid1(SPACE1_RANK, dims1);
// Create a dataset
@@ -590,24 +597,24 @@ static void test_reference_region_1D()
*/
/* Select 15 2x1 hyperslabs for first reference */
- start[0] = 2;
+ start[0] = 2;
stride[0] = 5;
- count[0] = 15;
- block[0] = 2;
+ count[0] = 15;
+ block[0] = 2;
// Select a hyperslab region to add to the current selected region
sid3.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
// Get and verify the number of elements in a dataspace selection
hssize_t nelms = sid3.getSelectNpoints();
- verify_val(nelms, 30, "DataSet::getRefObjType",__LINE__,__FILE__);
+ verify_val(nelms, 30, "DataSet::getRefObjType", __LINE__, __FILE__);
// Store first dataset region
file1.reference(&wbuf[0], "/Dataset2", sid3);
// Get and verify object type
H5O_type_t obj_type = dset1.getRefObjType(&wbuf[0], H5R_DATASET_REGION);
- verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__);
+ verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__);
/* Select sequence of ten points for second reference */
coord1[0][0] = 16;
@@ -626,7 +633,7 @@ static void test_reference_region_1D()
// Get and verify the number of elements in a dataspace selection
nelms = sid3.getSelectNpoints();
- verify_val(nelms, 10, "DataSet::getRefObjType",__LINE__,__FILE__);
+ verify_val(nelms, 10, "DataSet::getRefObjType", __LINE__, __FILE__);
// Store first dataset region
file1.reference(&wbuf[1], "/Dataset2", sid3);
@@ -658,12 +665,12 @@ static void test_reference_region_1D()
// Get and verify object type
obj_type = dset1.getRefObjType(&rbuf[0], H5R_DATASET_REGION);
- verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__);
+ verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__);
// Get dataspace of dset3 the verify number of elements
- sid1 = dset3.getSpace();
+ sid1 = dset3.getSpace();
nelms = sid1.getSimpleExtentNpoints();
- verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
+ verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
} // End of test DataSet::dereference
{ // Test DataSet constructor -by dereference
@@ -672,9 +679,9 @@ static void test_reference_region_1D()
DataSet newds(dset1, &rbuf[0], H5R_DATASET_REGION, dapl);
// Get dataspace of newds then verify number of elements
- sid1 = newds.getSpace();
+ sid1 = newds.getSpace();
nelms = sid1.getSimpleExtentNpoints();
- verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
+ verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Close objects for this mini test
newds.close();
@@ -684,8 +691,8 @@ static void test_reference_region_1D()
// Read from disk
dset3.read(drbuf, PredType::STD_U8LE);
- for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++)
- verify_val(*tu8, (uint8_t)(i * 3), "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
+ for (tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++)
+ verify_val(*tu8, (uint8_t)(i * 3), "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
/*
* Test getting the referenced region
@@ -696,11 +703,11 @@ static void test_reference_region_1D()
// Get and verify number of elements in a dataspace selection
nelms = reg_sp.getSelectNpoints();
- verify_val((long)nelms, 30, "DataSpace::getSelectNpoints",__LINE__,__FILE__);
+ verify_val((long)nelms, 30, "DataSpace::getSelectNpoints", __LINE__, __FILE__);
// Get and verify number of hyperslab blocks
nelms = reg_sp.getSelectHyperNblocks();
- verify_val((long)nelms, 15, "DataSpace::getSelectNpoints",__LINE__,__FILE__);
+ verify_val((long)nelms, 15, "DataSpace::getSelectNpoints", __LINE__, __FILE__);
/* Allocate space for the hyperslab blocks */
coords = (hsize_t *)HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2);
@@ -709,43 +716,43 @@ static void test_reference_region_1D()
reg_sp.getSelectHyperBlocklist((hsize_t)0, (hsize_t)nelms, coords);
// Verify values in the list
- verify_val(coords[0], (hsize_t)2, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[1], (hsize_t)3, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[2], (hsize_t)7, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[3], (hsize_t)8, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[4],(hsize_t)12, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[5],(hsize_t)13, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[6],(hsize_t)17, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[7],(hsize_t)18, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[8],(hsize_t)22, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[9],(hsize_t)23, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[10],(hsize_t)27, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[11],(hsize_t)28, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[12],(hsize_t)32, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[13],(hsize_t)33, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[14],(hsize_t)37, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[15],(hsize_t)38, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[16],(hsize_t)42, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[17],(hsize_t)43, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[18],(hsize_t)47, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[19],(hsize_t)48, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[20],(hsize_t)52, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[21],(hsize_t)53, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[22],(hsize_t)57, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[23],(hsize_t)58, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[24],(hsize_t)62, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[25],(hsize_t)63, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[26],(hsize_t)67, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[27],(hsize_t)68, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[28],(hsize_t)72, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[29],(hsize_t)73, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[0], (hsize_t)2, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[1], (hsize_t)3, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[2], (hsize_t)7, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[3], (hsize_t)8, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[4], (hsize_t)12, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[5], (hsize_t)13, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[6], (hsize_t)17, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[7], (hsize_t)18, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[8], (hsize_t)22, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[9], (hsize_t)23, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[10], (hsize_t)27, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[11], (hsize_t)28, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[12], (hsize_t)32, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[13], (hsize_t)33, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[14], (hsize_t)37, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[15], (hsize_t)38, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[16], (hsize_t)42, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[17], (hsize_t)43, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[18], (hsize_t)47, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[19], (hsize_t)48, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[20], (hsize_t)52, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[21], (hsize_t)53, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[22], (hsize_t)57, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[23], (hsize_t)58, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[24], (hsize_t)62, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[25], (hsize_t)63, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[26], (hsize_t)67, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[27], (hsize_t)68, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[28], (hsize_t)72, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[29], (hsize_t)73, "Hyperslab Coordinates", __LINE__, __FILE__);
HDfree(coords);
// Check boundaries
reg_sp.getSelectBounds(low, high);
- verify_val(low[0],(hsize_t)2, "DataSpace::getSelectBounds",__LINE__,__FILE__);
- verify_val(high[0],(hsize_t)73, "DataSpace::getSelectBounds",__LINE__,__FILE__);
+ verify_val(low[0], (hsize_t)2, "DataSpace::getSelectBounds", __LINE__, __FILE__);
+ verify_val(high[0], (hsize_t)73, "DataSpace::getSelectBounds", __LINE__, __FILE__);
/* Close region space */
reg_sp.close();
@@ -759,7 +766,7 @@ static void test_reference_region_1D()
// Get and verify number of element points in the current selection
hssize_t nelmspts = elm_sp.getSelectElemNpoints();
- verify_val((long)nelmspts, 10, "DataSpace::getSelectNpoints",__LINE__,__FILE__);
+ verify_val((long)nelmspts, 10, "DataSpace::getSelectNpoints", __LINE__, __FILE__);
/* Allocate space for the hyperslab blocks */
coords = (hsize_t *)HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t));
@@ -768,23 +775,23 @@ static void test_reference_region_1D()
elm_sp.getSelectElemPointlist((hsize_t)0, (hsize_t)nelmspts, coords);
// Verify points
- verify_val(coords[0], coord1[0][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[1], coord1[1][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[2], coord1[2][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[3], coord1[3][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[4], coord1[4][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[5], coord1[5][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[6], coord1[6][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[7], coord1[7][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[8], coord1[8][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[9], coord1[9][0], "Element Coordinates",__LINE__,__FILE__);
+ verify_val(coords[0], coord1[0][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[1], coord1[1][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[2], coord1[2][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[3], coord1[3][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[4], coord1[4][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[5], coord1[5][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[6], coord1[6][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[7], coord1[7][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[8], coord1[8][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[9], coord1[9][0], "Element Coordinates", __LINE__, __FILE__);
HDfree(coords);
// Check boundaries
elm_sp.getSelectBounds(low, high);
- verify_val(low[0],(hsize_t)3, "DataSpace::getSelectBounds",__LINE__,__FILE__);
- verify_val(high[0],(hsize_t)97, "DataSpace::getSelectBounds",__LINE__,__FILE__);
+ verify_val(low[0], (hsize_t)3, "DataSpace::getSelectBounds", __LINE__, __FILE__);
+ verify_val(high[0], (hsize_t)97, "DataSpace::getSelectBounds", __LINE__, __FILE__);
// Close element space
elm_sp.close();
@@ -803,12 +810,10 @@ static void test_reference_region_1D()
PASSED();
} // end try
- catch (Exception& E)
- {
- issue_fail_msg("test_reference_region_1D()",__LINE__,__FILE__,
- E.getCFuncName(), E.getCDetailMsg());
+ catch (Exception &E) {
+ issue_fail_msg("test_reference_region_1D()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg());
}
-} /* test_reference_region_1D() */
+} /* test_reference_region_1D() */
/*-------------------------------------------------------------------------
*
@@ -816,8 +821,8 @@ static void test_reference_region_1D()
*
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_reference()
+extern "C" void
+test_reference()
{
// Output message about test being performed
MESSAGE(5, ("Testing References\n"));
@@ -827,9 +832,8 @@ void test_reference()
test_reference_group(); // Test group reference functionality
test_reference_region_1D(); // Test 1-D reference functionality
-} // test_reference()
+} // test_reference()
-
/*-------------------------------------------------------------------------
* Function: cleanup_reference
*
@@ -838,10 +842,9 @@ void test_reference()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_reference()
+extern "C" void
+cleanup_reference()
{
HDremove(FILE1.c_str());
HDremove(FILE2.c_str());
}
-
diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp
index b8846f4..7411e37 100644
--- a/c++/test/ttypes.cpp
+++ b/c++/test/ttypes.cpp
@@ -25,17 +25,17 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
/*
* Offset from alinged memory returned by malloc(). This can be used to test
* that type conversions handle non-aligned buffers correctly.
*/
-#define ALIGNMENT 1
+#define ALIGNMENT 1
/*
* Define if you want to test alignment code on a machine that doesn't
@@ -50,35 +50,34 @@ using namespace H5;
#define H5T_FRIEND
#include "H5Tpkg.h"
#endif
-#define SET_ALIGNMENT(TYPE,VAL) \
- H5T_NATIVE_##TYPE##_ALIGN_g=MAX(H5T_NATIVE_##TYPE##_ALIGN_g, VAL)
+#define SET_ALIGNMENT(TYPE, VAL) H5T_NATIVE_##TYPE##_ALIGN_g = MAX(H5T_NATIVE_##TYPE##_ALIGN_g, VAL)
#endif
- /* #include "H5Tpkg.h"
+/* #include "H5Tpkg.h"
*/
-const char *FILENAME[] = {
- "dtypes1.h5",
- "dtypes2.h5",
- "dtypes3.h5",
- "dtypes4.h5",
- NULL
-};
+const char *FILENAME[] = {"dtypes1.h5", "dtypes2.h5", "dtypes3.h5", "dtypes4.h5", NULL};
/*
* Count up or down depending on whether the machine is big endian or little
* endian. If local variable `endian' is H5T_ORDER_BE then the result will
* be I, otherwise the result will be Z-(I+1).
*/
-#define ENDIAN(Z,I) (H5T_ORDER_BE==endian?(I):(Z)-((I)+1))
+#define ENDIAN(Z, I) (H5T_ORDER_BE == endian ? (I) : (Z) - ((I) + 1))
-
-typedef enum flt_t {
- FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE, FLT_OTHER
-} flt_t;
+typedef enum flt_t { FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE, FLT_OTHER } flt_t;
typedef enum int_t {
- INT_CHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT,
- INT_LONG, INT_ULONG, INT_LLONG, INT_ULLONG, INT_OTHER
+ INT_CHAR,
+ INT_UCHAR,
+ INT_SHORT,
+ INT_USHORT,
+ INT_INT,
+ INT_UINT,
+ INT_LONG,
+ INT_ULONG,
+ INT_LLONG,
+ INT_ULLONG,
+ INT_OTHER
} int_t;
typedef struct {
@@ -88,7 +87,6 @@ typedef struct {
double d;
} src_typ_t;
-
/*-------------------------------------------------------------------------
* Function: test_classes
*
@@ -100,7 +98,8 @@ typedef struct {
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_classes()
+static void
+test_classes()
{
SUBTEST("PredType::getClass()");
try {
@@ -108,24 +107,23 @@ static void test_classes()
// PredType::NATIVE_INT should be in H5T_INTEGER class
H5T_class_t tcls = PredType::NATIVE_INT.getClass();
- if (H5T_INTEGER!=tcls) {
+ if (H5T_INTEGER != tcls) {
puts(" Invalid type class for H5T_NATIVE_INT");
}
// PredType::NATIVE_DOUBLE should be in H5T_FLOAT class
tcls = PredType::NATIVE_DOUBLE.getClass();
- if (H5T_FLOAT!=tcls) {
- verify_val(tcls, H5T_FLOAT, "test_class: invalid type class for NATIVE_DOUBLE -", __LINE__, __FILE__);
+ if (H5T_FLOAT != tcls) {
+ verify_val(tcls, H5T_FLOAT, "test_class: invalid type class for NATIVE_DOUBLE -", __LINE__,
+ __FILE__);
}
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_classes", __LINE__, __FILE__, E.getCDetailMsg());
}
}
-
/*-------------------------------------------------------------------------
* Function: test_copy
*
@@ -137,7 +135,8 @@ static void test_classes()
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_copy()
+static void
+test_copy()
{
SUBTEST("DataType::copy() and DataType::operator=");
@@ -148,7 +147,7 @@ static void test_copy()
// Test copying a predefined type using DataType::copy
DataType copied_type;
- copied_type.copy (PredType::STD_B8LE);
+ copied_type.copy(PredType::STD_B8LE);
// Test copying a user-defined type using DataType::operator=
DataType assigned_usertype;
@@ -159,7 +158,7 @@ static void test_copy()
copied_usertype.copy(copied_type);
// Test copying a user-defined int type using DataType::operator=
- IntType orig_int(PredType::STD_B8LE);
+ IntType orig_int(PredType::STD_B8LE);
DataType generic_type;
generic_type = orig_int;
@@ -172,13 +171,11 @@ static void test_copy()
PASSED();
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_copy", __LINE__, __FILE__, E.getCDetailMsg());
}
}
-
/*-------------------------------------------------------------------------
* Function: test_detect_type_class
*
@@ -190,29 +187,30 @@ static void test_copy()
* August, 2017
*-------------------------------------------------------------------------
*/
-typedef struct { /* Struct with atomic fields */
- int i;
- float f;
- char c;
- double d;
- short s;
+typedef struct { /* Struct with atomic fields */
+ int i;
+ float f;
+ char c;
+ double d;
+ short s;
} atomic_typ_t;
-typedef struct { /* Struct with complex fields */
- hobj_ref_t arr_r[3][3];
- int i;
- hvl_t vl_f;
- hvl_t vl_s;
- char c;
- short s;
+typedef struct { /* Struct with complex fields */
+ hobj_ref_t arr_r[3][3];
+ int i;
+ hvl_t vl_f;
+ hvl_t vl_s;
+ char c;
+ short s;
} complex_typ_t;
-static void test_detect_type_class()
+static void
+test_detect_type_class()
{
SUBTEST("DataType::detectClass()");
try {
- bool in_class = false; // indicates whether a datatype is in a class
+ bool in_class = false; // indicates whether a datatype is in a class
/*
* Test class of some atomic types.
@@ -260,8 +258,8 @@ static void test_detect_type_class()
*/
// Create an array datatype with an atomic base type
- unsigned rank = 2; // Rank for array datatype
- hsize_t dims[2] = {3,3}; // Dimensions for array datatype
+ unsigned rank = 2; // Rank for array datatype
+ hsize_t dims[2] = {3, 3}; // Dimensions for array datatype
ArrayType atom_arr(PredType::STD_REF_OBJ, rank, dims);
// Make certain that the correct classes can be detected
@@ -367,13 +365,11 @@ static void test_detect_type_class()
PASSED();
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_detect_type_class", __LINE__, __FILE__, E.getCDetailMsg());
}
}
-
/*-------------------------------------------------------------------------
* Function: test_vltype
*
@@ -385,12 +381,12 @@ static void test_detect_type_class()
* August, 2017
*-------------------------------------------------------------------------
*/
-static void test_vltype()
+static void
+test_vltype()
{
// Output message about test being performed
SUBTEST("VarLenType functions");
- try
- {
+ try {
VarLenType vltype(PredType::NATIVE_INT);
bool in_class = vltype.detectClass(H5T_VLEN);
@@ -408,9 +404,11 @@ static void test_vltype()
in_class = vltype2.detectClass(H5T_VLEN);
verify_val(in_class, true, "VarLenType::detectClass() with H5T_VLEN for vltype2", __LINE__, __FILE__);
in_class = vltype2.detectClass(H5T_INTEGER);
- verify_val(in_class, true, "VarLenType::detectClass() with H5T_INTEGER for vltype2", __LINE__, __FILE__);
+ verify_val(in_class, true, "VarLenType::detectClass() with H5T_INTEGER for vltype2", __LINE__,
+ __FILE__);
in_class = vltype2.detectClass(H5T_FLOAT);
- verify_val(in_class, false, "VarLenType::detectClass() with H5T_FLOAT for vltype2", __LINE__, __FILE__);
+ verify_val(in_class, false, "VarLenType::detectClass() with H5T_FLOAT for vltype2", __LINE__,
+ __FILE__);
// Create a new file to use in this test
H5File file(FILENAME[3], H5F_ACC_TRUNC);
@@ -435,17 +433,16 @@ static void test_vltype()
in_class = vltype2.detectClass(H5T_VLEN);
verify_val(in_class, true, "VarLenType::detectClass() with H5T_VLEN for vltype2", __LINE__, __FILE__);
in_class = first_vlt_again.detectClass(H5T_FLOAT);
- verify_val(in_class, true, "VarLenType::detectClass() with H5T_FLOAT for first_vlt_again", __LINE__, __FILE__);
+ verify_val(in_class, true, "VarLenType::detectClass() with H5T_FLOAT for first_vlt_again", __LINE__,
+ __FILE__);
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_vltype", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_vltype
+} // test_vltype
-
/*-------------------------------------------------------------------------
* Function: test_query
*
@@ -460,14 +457,14 @@ static void test_vltype()
const H5std_string CompT_NAME("Compound_type");
const H5std_string EnumT_NAME("Enum_type");
-static void test_query()
+static void
+test_query()
{
- short enum_val;
+ short enum_val;
// Output message about test being performed
SUBTEST("Query functions of compound and enumeration types");
- try
- {
+ try {
// Create File
H5File file(FILENAME[2], H5F_ACC_TRUNC);
@@ -482,11 +479,11 @@ static void test_query()
// Create a enumerate datatype
EnumType tid2(sizeof(short));
- tid2.insert("RED", (enum_val=0,&enum_val));
- tid2.insert("GREEN", (enum_val=1,&enum_val));
- tid2.insert("BLUE", (enum_val=2,&enum_val));
- tid2.insert("ORANGE", (enum_val=3,&enum_val));
- tid2.insert("YELLOW", (enum_val=4,&enum_val));
+ tid2.insert("RED", (enum_val = 0, &enum_val));
+ tid2.insert("GREEN", (enum_val = 1, &enum_val));
+ tid2.insert("BLUE", (enum_val = 2, &enum_val));
+ tid2.insert("ORANGE", (enum_val = 3, &enum_val));
+ tid2.insert("YELLOW", (enum_val = 4, &enum_val));
// Query member number and member index by name, for compound type
int nmembs = tid1.getNmembers();
@@ -506,10 +503,10 @@ static void test_query()
// prop list, then close it
tid1.commit(file, CompT_NAME);
PropList tcpl = tid1.getCreatePlist();
- if (!IdComponent::isValid(tcpl.getId()))
- {
+ if (!IdComponent::isValid(tcpl.getId())) {
// Throw an invalid action exception
- throw InvalidActionException("H5Object::createAttribute", "Datatype creation property list is not valid");
+ throw InvalidActionException("H5Object::createAttribute",
+ "Datatype creation property list is not valid");
}
tcpl.close();
tid1.close();
@@ -518,10 +515,10 @@ static void test_query()
// prop list, then close it
tid2.commit(file, EnumT_NAME);
tcpl = tid2.getCreatePlist();
- if (!IdComponent::isValid(tcpl.getId()))
- {
+ if (!IdComponent::isValid(tcpl.getId())) {
// Throw an invalid action exception
- throw InvalidActionException("H5Object::createAttribute", "Datatype creation property list is not valid");
+ throw InvalidActionException("H5Object::createAttribute",
+ "Datatype creation property list is not valid");
}
tcpl.close();
tid2.close();
@@ -560,14 +557,12 @@ static void test_query()
H5File file1(FILENAME[2], H5F_ACC_TRUNC);
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_query", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_query
+} // test_query
-
/*-------------------------------------------------------------------------
* Function: test_transient
*
@@ -579,17 +574,18 @@ static void test_query()
* January, 2007
*-------------------------------------------------------------------------
*/
-const char* filename1 = "dtypes1.h5";
+const char *filename1 = "dtypes1.h5";
-static void test_transient ()
+static void
+test_transient()
{
- static hsize_t ds_size[2] = {10, 20};
+ static hsize_t ds_size[2] = {10, 20};
SUBTEST("Transient datatypes");
try {
// Create the file and the dataspace.
- H5File file(filename1, H5F_ACC_TRUNC);
+ H5File file(filename1, H5F_ACC_TRUNC);
DataSpace space(2, ds_size, ds_size);
// Copying a predefined type results in a modifiable copy
@@ -600,8 +596,11 @@ static void test_transient ()
try {
Attribute attr(type.createAttribute("attr1", PredType::NATIVE_INT, space));
// Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("H5Object::createAttribute", "Attempted to commit a predefined datatype.");
- } catch (AttributeIException& err) {} // do nothing, failure expected
+ throw InvalidActionException("H5Object::createAttribute",
+ "Attempted to commit a predefined datatype.");
+ }
+ catch (AttributeIException &err) {
+ } // do nothing, failure expected
// Create a dataset from a transient datatype
// type.close(); - put trace in H5Tclose to make sure it's closed
@@ -614,8 +613,11 @@ static void test_transient ()
itype.setPrecision(256);
// Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("PredType::setPrecision", "Dataset datatypes should not be modifiable!");
- } catch (DataTypeIException& err) {}
+ throw InvalidActionException("PredType::setPrecision",
+ "Dataset datatypes should not be modifiable!");
+ }
+ catch (DataTypeIException &err) {
+ }
itype.close();
// Get a copy of the dataset's datatype by applying DataType::copy()
@@ -635,14 +637,12 @@ static void test_transient ()
type.close();
space.close();
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_transient", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_transient
+} // test_transient
-
/*-------------------------------------------------------------------------
* Function: test_named
*
@@ -656,12 +656,13 @@ static void test_transient ()
*/
const H5std_string filename2("dtypes2.h5");
-static void test_named ()
+static void
+test_named()
{
static hsize_t ds_size[2] = {10, 20};
- hsize_t i;
- unsigned attr_data[10][20];
- DataType *ds_type = NULL;
+ hsize_t i;
+ unsigned attr_data[10][20];
+ DataType * ds_type = NULL;
SUBTEST("Named datatypes");
try {
@@ -678,15 +679,16 @@ static void test_named ()
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("PredType::commit", "Attempted to commit a predefined datatype.");
- } catch (DataTypeIException& err) {}
+ }
+ catch (DataTypeIException &err) {
+ }
// Copy a predefined datatype and commit the copy.
IntType itype(PredType::NATIVE_INT);
itype.commit(file, "native-int");
// Test commit passing in const H5File& for prototype with const
- try
- {
+ try {
// Create random char type
IntType atype(PredType::NATIVE_UCHAR);
@@ -696,9 +698,8 @@ static void test_named ()
// Commit type passing in const group; compilation would fail if
// no matching prototype
atype.commit(const_grp, "random uchar");
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_named", __LINE__, __FILE__, "Commit at const group");
}
@@ -708,11 +709,14 @@ static void test_named ()
// We should not be able to modify a type after it has been committed.
try {
- itype.setPrecision(256); // attempt an invalid action...
+ itype.setPrecision(256); // attempt an invalid action...
// Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("IntType::setPrecision", "Attempted to modify a committed datatype.");
- } catch (DataTypeIException& err) {}
+ throw InvalidActionException("IntType::setPrecision",
+ "Attempted to modify a committed datatype.");
+ }
+ catch (DataTypeIException &err) {
+ }
// We should not be able to re-commit a committed type
try {
@@ -720,12 +724,14 @@ static void test_named ()
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("IntType::commit", "Attempted to re-commit a committed datatype.");
- } catch (DataTypeIException& err) {} // do nothing, failure expected
+ }
+ catch (DataTypeIException &err) {
+ } // do nothing, failure expected
// It should be possible to define an attribute for the named type
Attribute attr1 = itype.createAttribute("attr1", PredType::NATIVE_UCHAR, space);
- for (i=0; i<ds_size[0]*ds_size[1]; i++)
- attr_data[0][i] = (int)i;/*tricky*/
+ for (i = 0; i < ds_size[0] * ds_size[1]; i++)
+ attr_data[0][i] = (int)i; /*tricky*/
attr1.write(PredType::NATIVE_UINT, attr_data);
attr1.close();
@@ -734,13 +740,15 @@ static void test_named ()
IntType trans_type;
trans_type.copy(itype);
bool iscommitted = trans_type.committed();
- verify_val(iscommitted, 0, "DataType::committed() - Copying a named type should result in a transient type!", __LINE__, __FILE__);
+ verify_val(iscommitted, 0,
+ "DataType::committed() - Copying a named type should result in a transient type!",
+ __LINE__, __FILE__);
trans_type.setPrecision(256);
trans_type.close();
// Close the committed type and reopen it. It should be a named type.
itype.close();
- itype = file.openIntType("native-int");
+ itype = file.openIntType("native-int");
iscommitted = itype.committed();
if (!iscommitted)
throw InvalidActionException("IntType::committed()", "Opened named types should be named types!");
@@ -748,8 +756,8 @@ static void test_named ()
// Create a dataset that uses the named type, then get the dataset's
// datatype and make sure it's a named type.
DataSet dset = file.createDataSet("dset1", itype, space);
- ds_type = new DataType(dset.getDataType());
- iscommitted = ds_type->committed();
+ ds_type = new DataType(dset.getDataType());
+ iscommitted = ds_type->committed();
if (!iscommitted)
throw InvalidActionException("IntType::committed()", "Dataset type should be named type!");
dset.close();
@@ -758,8 +766,8 @@ static void test_named ()
// Reopen the dataset and its type, then make sure the type is
// a named type.
- dset = file.openDataSet("dset1");
- ds_type = new DataType(dset.getDataType());
+ dset = file.openDataSet("dset1");
+ ds_type = new DataType(dset.getDataType());
iscommitted = ds_type->committed();
if (!iscommitted)
throw InvalidActionException("IntType::committed()", "Dataset type should be named type!");
@@ -773,8 +781,8 @@ static void test_named ()
delete ds_type;
// Reopen the second dataset and make sure the type is shared
- dset = file.openDataSet("dset2");
- ds_type = new DataType(dset.getDataType());
+ dset = file.openDataSet("dset2");
+ ds_type = new DataType(dset.getDataType());
iscommitted = ds_type->committed();
if (!iscommitted)
throw InvalidActionException("DataType::iscommitted()", "Dataset type should be named type!");
@@ -793,17 +801,15 @@ static void test_named ()
space.close();
file.close();
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_named", __LINE__, __FILE__, E.getCDetailMsg());
}
- if(ds_type)
+ if (ds_type)
delete ds_type;
-} // test_named
+} // test_named
-
/*-------------------------------------------------------------------------
* Function: test_encode_decode
*
@@ -816,12 +822,13 @@ static void test_named ()
*-------------------------------------------------------------------------
*/
const H5std_string filename3("encode_decode.h5");
-const int ARRAY1_RANK = 1;
-const int ARRAY1_DIM = 10;
+const int ARRAY1_RANK = 1;
+const int ARRAY1_DIM = 10;
-static void test_encode_decode()
+static void
+test_encode_decode()
{
- short enum_val;
+ short enum_val;
SUBTEST("DataType::encode() and DataType::decode()");
try {
@@ -847,7 +854,7 @@ static void test_encode_decode()
verify_val(cmptyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
// Decode compound type's buffer to a new CompType
- CompType* decoded_cmp_ptr(static_cast<CompType *>(cmptyp.decode()));
+ CompType *decoded_cmp_ptr(static_cast<CompType *>(cmptyp.decode()));
// Verify that the datatype was copied exactly via encoding/decoding
verify_val(cmptyp == *decoded_cmp_ptr, true, "DataType::decode", __LINE__, __FILE__);
@@ -871,11 +878,11 @@ static void test_encode_decode()
// Create a enumerate datatype
EnumType enumtyp(sizeof(short));
- enumtyp.insert("RED", (enum_val=0,&enum_val));
- enumtyp.insert("GREEN", (enum_val=1,&enum_val));
- enumtyp.insert("BLUE", (enum_val=2,&enum_val));
- enumtyp.insert("ORANGE", (enum_val=3,&enum_val));
- enumtyp.insert("YELLOW", (enum_val=4,&enum_val));
+ enumtyp.insert("RED", (enum_val = 0, &enum_val));
+ enumtyp.insert("GREEN", (enum_val = 1, &enum_val));
+ enumtyp.insert("BLUE", (enum_val = 2, &enum_val));
+ enumtyp.insert("ORANGE", (enum_val = 3, &enum_val));
+ enumtyp.insert("YELLOW", (enum_val = 4, &enum_val));
// Encode compound type in a buffer
enumtyp.encode();
@@ -884,7 +891,7 @@ static void test_encode_decode()
verify_val(enumtyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
// Decode enumeration type's buffer to a new EnumType
- EnumType* decoded_enum_ptr(static_cast<EnumType *>(enumtyp.decode()));
+ EnumType *decoded_enum_ptr(static_cast<EnumType *>(enumtyp.decode()));
// Verify that the datatype was copied exactly via encoding/decoding
verify_val(enumtyp == *decoded_enum_ptr, true, "DataType::decode", __LINE__, __FILE__);
@@ -916,7 +923,7 @@ static void test_encode_decode()
verify_val(vlsttyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
// Decode the variable-length type's buffer to a new StrType
- StrType* decoded_str_ptr(static_cast<StrType *>(vlsttyp.decode()));
+ StrType *decoded_str_ptr(static_cast<StrType *>(vlsttyp.decode()));
verify_val(vlsttyp == *decoded_str_ptr, true, "DataType::decode", __LINE__, __FILE__);
verify_val(decoded_str_ptr->isVariableStr(), true, "DataType::decode", __LINE__, __FILE__);
@@ -926,7 +933,7 @@ static void test_encode_decode()
// Test decoding the type by way of DataType*
// Decode variable-length string type to a new DataType
- DataType* decoded_vlstr_ptr(vlsttyp.decode());
+ DataType *decoded_vlstr_ptr(vlsttyp.decode());
// Create a StrType instance from the DataType object and verify it
StrType decoded_vlsttyp(decoded_vlstr_ptr->getId());
@@ -951,7 +958,7 @@ static void test_encode_decode()
verify_val(arrtyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
// Create an ArrayType instance from the decoded pointer and verify it
- ArrayType* decoded_arr_ptr(static_cast<ArrayType *>(arrtyp.decode()));
+ ArrayType *decoded_arr_ptr(static_cast<ArrayType *>(arrtyp.decode()));
verify_val(arrtyp == *decoded_arr_ptr, true, "DataType::decode", __LINE__, __FILE__);
@@ -983,7 +990,7 @@ static void test_encode_decode()
verify_val(inttyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
// Create an IntType instance from the decoded pointer and verify it
- IntType* decoded_int_ptr(static_cast<IntType *>(inttyp.decode()));
+ IntType * decoded_int_ptr(static_cast<IntType *>(inttyp.decode()));
H5T_sign_t int_sign = decoded_int_ptr->getSign();
verify_val(int_sign, H5T_SGN_NONE, "DataType::decode", __LINE__, __FILE__);
verify_val(inttyp == *decoded_int_ptr, true, "DataType::decode", __LINE__, __FILE__);
@@ -1004,27 +1011,25 @@ static void test_encode_decode()
verify_val(flttyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
// Decode the array type's buffer
- DataType* decoded_flt_ptr(flttyp.decode());
+ DataType *decoded_flt_ptr(flttyp.decode());
// Create a IntType instance from the decoded pointer and verify it
FloatType decoded_flttyp(decoded_flt_ptr->getId());
verify_val(flttyp == decoded_flttyp, true, "DataType::decode", __LINE__, __FILE__);
- //H5std_string norm_string;
- //H5T_norm_t mant_norm = decoded_flttyp.getNorm(norm_string);
- //verify_val(decoded_flttyp.isVariableStr(), true, "DataType::decode", __LINE__, __FILE__);
+ // H5std_string norm_string;
+ // H5T_norm_t mant_norm = decoded_flttyp.getNorm(norm_string);
+ // verify_val(decoded_flttyp.isVariableStr(), true, "DataType::decode", __LINE__, __FILE__);
delete decoded_flt_ptr;
PASSED();
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_encode_decode", __LINE__, __FILE__, E.getCDetailMsg());
}
}
-
/*-------------------------------------------------------------------------
* Function: test_operators
*
@@ -1038,9 +1043,10 @@ static void test_encode_decode()
*/
const H5std_string filename4("h5_type_operators.h5");
-static void test_operators()
+static void
+test_operators()
{
- short enum_val;
+ short enum_val;
SUBTEST("DataType::operator== and DataType::operator!=");
try {
@@ -1073,9 +1079,9 @@ static void test_operators()
// Create an enumerate datatype
EnumType enumtyp(sizeof(short));
- enumtyp.insert("RED", (enum_val=0,&enum_val));
- enumtyp.insert("GREEN", (enum_val=1,&enum_val));
- enumtyp.insert("BLUE", (enum_val=2,&enum_val));
+ enumtyp.insert("RED", (enum_val = 0, &enum_val));
+ enumtyp.insert("GREEN", (enum_val = 1, &enum_val));
+ enumtyp.insert("BLUE", (enum_val = 2, &enum_val));
// Verify that operator== and operator!= work properly
verify_val(cmptyp == enumtyp, false, "DataType::operator==", __LINE__, __FILE__);
@@ -1086,7 +1092,7 @@ static void test_operators()
//
// Create random atomic datatypes
- IntType inttyp(PredType::NATIVE_INT);
+ IntType inttyp(PredType::NATIVE_INT);
FloatType flttyp(PredType::NATIVE_FLOAT);
// Get the NATIVE_INT member from the compound datatype above
@@ -1106,13 +1112,11 @@ static void test_operators()
PASSED();
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_operators", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_operators
+} // test_operators
-
/*-------------------------------------------------------------------------
* Function: test_types
*
@@ -1121,8 +1125,8 @@ static void test_operators()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_types()
+extern "C" void
+test_types()
{
// Output message about test being performed
MESSAGE(5, ("Testing Generic Data Types\n"));
@@ -1138,9 +1142,8 @@ void test_types()
test_encode_decode();
test_operators();
-} // test_types()
+} // test_types()
-
/*-------------------------------------------------------------------------
* Function: cleanup_types
*
@@ -1149,9 +1152,9 @@ void test_types()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_types()
+extern "C" void
+cleanup_types()
{
for (int i = 0; i < 3; i++)
HDremove(FILENAME[i]);
-} // cleanup_types
+} // cleanup_types
diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp
index 2421a87..8f0c0ab 100644
--- a/c++/test/tvlstr.cpp
+++ b/c++/test/tvlstr.cpp
@@ -27,17 +27,17 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
// Data file used in most test functions
const H5std_string FILENAME("tvlstr.h5");
// 1-D dataset with fixed dimensions
-const int SPACE1_RANK = 1;
+const int SPACE1_RANK = 1;
const hsize_t SPACE1_DIM1 = 4;
/*-------------------------------------------------------------------------
@@ -137,10 +137,11 @@ static void test_vlstr_free_custom(void *_mem, void *info)
const H5std_string DSET1_NAME("String_ds");
const H5std_string DSET1_DATA("String Dataset");
-static void test_vlstring_dataset()
+static void
+test_vlstring_dataset()
{
char *dynstring_ds_write = NULL;
- char *string_ds_check = NULL;
+ char *string_ds_check = NULL;
// Output message about test being performed
SUBTEST("VL String on Datasets");
@@ -156,7 +157,7 @@ static void test_vlstring_dataset()
Group root = file1.openGroup("/");
// Create dataspace for the dataset.
- DataSpace ds_space (H5S_SCALAR);
+ DataSpace ds_space(H5S_SCALAR);
// Create an dataset in the root group.
DataSet dset1 = root.createDataSet(DSET1_NAME, vlst, ds_space);
@@ -166,17 +167,19 @@ static void test_vlstring_dataset()
// Read and verify the dataset string as a string of chars.
dset1.read(&string_ds_check, vlst);
- if(HDstrcmp(string_ds_check, DSET1_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,string_ds_check=%s\n",__LINE__, DSET1_DATA.c_str(), string_ds_check);
+ if (HDstrcmp(string_ds_check, DSET1_DATA.c_str()) != 0)
+ TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,string_ds_check=%s\n", __LINE__,
+ DSET1_DATA.c_str(), string_ds_check);
- HDfree(string_ds_check); // note: no need for std::string test
+ HDfree(string_ds_check); // note: no need for std::string test
string_ds_check = NULL;
// Read and verify the dataset string as an std::string.
H5std_string read_str;
dset1.read(read_str, vlst);
if (read_str != DSET1_DATA)
- TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,read_str=%s\n",__LINE__, DSET1_DATA.c_str(), read_str.c_str());
+ TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,read_str=%s\n", __LINE__,
+ DSET1_DATA.c_str(), read_str.c_str());
// Close the dataset.
dset1.close();
@@ -184,7 +187,7 @@ static void test_vlstring_dataset()
// Test scalar type dataset with 1 value.
dset1 = root.createDataSet("test_scalar_small", vlst, ds_space);
- dynstring_ds_write = (char*)HDcalloc(1, sizeof(char));
+ dynstring_ds_write = (char *)HDcalloc(1, sizeof(char));
HDmemset(dynstring_ds_write, 'A', 1);
// Write data to the dataset, then read it back.
@@ -192,8 +195,9 @@ static void test_vlstring_dataset()
dset1.read(&string_ds_check, vlst);
// Verify data read.
- if(HDstrcmp(string_ds_check,dynstring_ds_write)!=0)
- TestErrPrintf("VL string datasets don't match!, dynstring_ds_write=%s, string_ds_check=%s\n",dynstring_ds_write,string_ds_check);
+ if (HDstrcmp(string_ds_check, dynstring_ds_write) != 0)
+ TestErrPrintf("VL string datasets don't match!, dynstring_ds_write=%s, string_ds_check=%s\n",
+ dynstring_ds_write, string_ds_check);
HDfree(string_ds_check);
string_ds_check = NULL;
dset1.close();
@@ -209,16 +213,15 @@ static void test_vlstring_dataset()
} // end try block
// Catch all exceptions.
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_vlstring_dataset()", __LINE__, __FILE__, E.getCDetailMsg());
}
- if(dynstring_ds_write)
+ if (dynstring_ds_write)
HDfree(dynstring_ds_write);
- if(string_ds_check)
+ if (string_ds_check)
HDfree(string_ds_check);
-} // test_vlstring_dataset()
+} // test_vlstring_dataset()
/*-------------------------------------------------------------------------
* Function: test_vlstring_array_dataset
@@ -234,22 +237,22 @@ static void test_vlstring_dataset()
*/
const H5std_string DSSTRARR_NAME("StringArray_dset");
-static void test_vlstring_array_dataset()
+static void
+test_vlstring_array_dataset()
{
- const char *string_ds_array[SPACE1_DIM1]= {
- "Line 1", "Line 2", "Line 3", "Line 4"
- }; // Information to write
+ const char *string_ds_array[SPACE1_DIM1] = {"Line 1", "Line 2", "Line 3",
+ "Line 4"}; // Information to write
// Output message about test being performed
SUBTEST("VL String Array on Datasets");
- H5File* file1 = NULL;
+ H5File *file1 = NULL;
try {
// Create file.
file1 = new H5File(FILENAME, H5F_ACC_RDWR);
// Create dataspace for datasets.
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
DataSpace ds_space(SPACE1_RANK, dims1);
// Create a datatype to refer to.
@@ -265,10 +268,10 @@ static void test_vlstring_array_dataset()
dataset.read(string_ds_check, vlst);
hsize_t ii;
- for (ii = 0; ii < SPACE1_DIM1; ii++)
- {
- if(HDstrcmp(string_ds_check[ii], string_ds_array[ii])!=0)
- TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n",__LINE__, string_ds_array[ii], string_ds_check[ii]);
+ for (ii = 0; ii < SPACE1_DIM1; ii++) {
+ if (HDstrcmp(string_ds_check[ii], string_ds_array[ii]) != 0)
+ TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n", __LINE__,
+ string_ds_array[ii], string_ds_check[ii]);
HDfree(string_ds_check[ii]);
}
@@ -286,14 +289,14 @@ static void test_vlstring_array_dataset()
// Create and write another dataset.
DataSet dataset2(file1->createDataSet("Dataset2", vlst, scalar_space));
- char *wdata2 = (char*)HDcalloc(65534, sizeof(char));
+ char * wdata2 = (char *)HDcalloc(65534, sizeof(char));
HDmemset(wdata2, 'A', 65533);
dataset2.write(&wdata2, vlst);
char *rdata2;
dataset2.read(&rdata2, vlst);
- if (HDstrcmp(wdata2, rdata2)!=0)
- TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n",__LINE__, wdata2, rdata2);
+ if (HDstrcmp(wdata2, rdata2) != 0)
+ TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n", __LINE__, wdata2, rdata2);
// Release resources from second dataset operation.
scalar_space.close();
@@ -310,12 +313,11 @@ static void test_vlstring_array_dataset()
} // end try
// Catch all exceptions.
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_vlstring_array_dataset()", __LINE__, __FILE__, E.getCDetailMsg());
}
- if(file1)
+ if (file1)
delete file1;
} // end test_vlstring_array_dataset()
@@ -332,11 +334,12 @@ static void test_vlstring_array_dataset()
*
*-------------------------------------------------------------------------
*/
-static void test_vlstrings_special()
+static void
+test_vlstrings_special()
{
- const char *wdata[SPACE1_DIM1] = {"one", "two", "", "four"};
+ const char *wdata[SPACE1_DIM1] = {"one", "two", "", "four"};
const char *wdata2[SPACE1_DIM1] = {NULL, NULL, NULL, NULL};
- char *rdata[SPACE1_DIM1]; // Information read in
+ char * rdata[SPACE1_DIM1]; // Information read in
// Output message about test being performed.
SUBTEST("Special VL Strings");
@@ -346,7 +349,7 @@ static void test_vlstrings_special()
H5File file1(FILENAME, H5F_ACC_TRUNC);
// Create dataspace for datasets.
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
DataSpace sid1(SPACE1_RANK, dims1);
// Create a datatype to refer to.
@@ -360,30 +363,29 @@ static void test_vlstrings_special()
// Check data read in.
hsize_t ii; // counting variable
- for (ii=0; ii<SPACE1_DIM1; ii++)
- if(rdata[ii]!=NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
+ for (ii = 0; ii < SPACE1_DIM1; ii++)
+ if (rdata[ii] != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)ii, rdata[ii]);
// Write dataset to disk, then read it back.
dataset.write(wdata, vlst);
dataset.read(rdata, vlst);
// Compare data read in.
- for (ii = 0; ii < SPACE1_DIM1; ii++)
- {
+ for (ii = 0; ii < SPACE1_DIM1; ii++) {
size_t wlen = HDstrlen(wdata[ii]);
size_t rlen = HDstrlen(rdata[ii]);
- if(wlen != rlen)
- {
- TestErrPrintf("VL data lengths don't match!, strlen(wdata[%d])=%u, strlen(rdata[%d])=%u\n", (int)ii, (unsigned)wlen, (int)ii, (unsigned)rlen);
+ if (wlen != rlen) {
+ TestErrPrintf("VL data lengths don't match!, strlen(wdata[%d])=%u, strlen(rdata[%d])=%u\n",
+ (int)ii, (unsigned)wlen, (int)ii, (unsigned)rlen);
continue;
} // end if
- if(HDstrcmp(wdata[ii],rdata[ii]) != 0)
- {
- TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)ii, wdata[ii], (int)ii, rdata[ii]);
+ if (HDstrcmp(wdata[ii], rdata[ii]) != 0) {
+ TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)ii, wdata[ii],
+ (int)ii, rdata[ii]);
continue;
} // end if
- } // end for
+ } // end for
// Reclaim the read VL data.
DataSet::vlenReclaim((void *)rdata, vlst, sid1);
@@ -398,7 +400,7 @@ static void test_vlstrings_special()
// Create the property list and set the fill value for the second
// dataset.
DSetCreatPropList dcpl;
- char *fill = NULL; // Fill value
+ char * fill = NULL; // Fill value
dcpl.setFillValue(vlst, &fill);
dataset = file1.createDataSet("Dataset4", vlst, sid1, dcpl);
@@ -409,9 +411,9 @@ static void test_vlstrings_special()
dataset.read(rdata, vlst);
// Check data read in.
- for (ii=0; ii<SPACE1_DIM1; ii++)
- if(rdata[ii]!=NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
+ for (ii = 0; ii < SPACE1_DIM1; ii++)
+ if (rdata[ii] != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)ii, rdata[ii]);
// Try to write nil strings to disk.
dataset.write(wdata2, vlst);
@@ -420,9 +422,9 @@ static void test_vlstrings_special()
dataset.read(rdata, vlst);
// Check data read in.
- for (ii=0; ii<SPACE1_DIM1; ii++)
- if(rdata[ii]!=NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
+ for (ii = 0; ii < SPACE1_DIM1; ii++)
+ if (rdata[ii] != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)ii, rdata[ii]);
// Close objects and file.
dataset.close();
@@ -434,8 +436,7 @@ static void test_vlstrings_special()
} // end try
// Catch all exceptions.
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_vlstrings_special()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_vlstrings_special
@@ -452,14 +453,15 @@ static void test_vlstrings_special()
*
*-------------------------------------------------------------------------
*/
-const H5std_string VLSTR_TYPE("vl_string_type");
+const H5std_string VLSTR_TYPE("vl_string_type");
-static void test_vlstring_type()
+static void
+test_vlstring_type()
{
// Output message about test being performed.
SUBTEST("VL String Type");
- H5File* file1 = NULL;
+ H5File *file1 = NULL;
try {
// Open file.
file1 = new H5File(FILENAME, H5F_ACC_RDWR);
@@ -525,12 +527,11 @@ static void test_vlstring_type()
} // end try block
// Catch all exceptions.
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_vlstring_type()", __LINE__, __FILE__, E.getCDetailMsg());
}
- if(file1)
+ if (file1)
delete file1;
} // end test_vlstring_type()
@@ -546,7 +547,8 @@ static void test_vlstring_type()
*
*-------------------------------------------------------------------------
*/
-static void test_compact_vlstring()
+static void
+test_compact_vlstring()
{
// Output message about test being performed
SUBTEST("VL Strings on Compact Dataset");
@@ -556,7 +558,7 @@ static void test_compact_vlstring()
H5File file1(FILENAME, H5F_ACC_TRUNC);
// Create dataspace for datasets
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
DataSpace sid1(SPACE1_RANK, dims1);
// Create a datatype to refer to
@@ -574,21 +576,23 @@ static void test_compact_vlstring()
dataset.write(wdata, vlst);
// Read dataset from disk
- char *rdata[SPACE1_DIM1]; // Information read in
+ char *rdata[SPACE1_DIM1]; // Information read in
dataset.read(rdata, vlst);
// Compare data read in
hsize_t i;
- for (i=0; i<SPACE1_DIM1; i++) {
- if (HDstrlen(wdata[i])!=strlen(rdata[i])) {
- TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (HDstrlen(wdata[i]) != strlen(rdata[i])) {
+ TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",
+ (int)i, (int)strlen(wdata[i]), (int)i, (int)strlen(rdata[i]));
continue;
} // end if
- if (HDstrcmp(wdata[i],rdata[i]) != 0) {
- TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
+ if (HDstrcmp(wdata[i], rdata[i]) != 0) {
+ TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i],
+ (int)i, rdata[i]);
continue;
} // end if
- } // end for
+ } // end for
// Reclaim the read VL data
DataSet::vlenReclaim((void *)rdata, vlst, sid1);
@@ -604,11 +608,10 @@ static void test_compact_vlstring()
} // end try
// Catch all exceptions.
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_compact_vlstrings()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_compact_vlstrings
+} // test_compact_vlstrings
/*-------------------------------------------------------------------------
* Function: test_vlstring_attribute
@@ -622,11 +625,12 @@ static void test_compact_vlstring()
*
*-------------------------------------------------------------------------
*/
-static char *string_att_write=NULL;
+static char * string_att_write = NULL;
const H5std_string ATTRSTR_NAME("String_attr");
const H5std_string ATTRSTR_DATA("String Attribute");
-static void test_vlstring_attribute()
+static void
+test_vlstring_attribute()
{
// Output message about test being performed
SUBTEST("VL String on Attributes");
@@ -642,7 +646,7 @@ static void test_vlstring_attribute()
Group root = file1.openGroup("/");
// Create dataspace for the attribute.
- DataSpace att_space (H5S_SCALAR);
+ DataSpace att_space(H5S_SCALAR);
// Create an attribute for the root group.
Attribute gr_attr = root.createAttribute(ATTRSTR_NAME, vlst, att_space);
@@ -653,16 +657,18 @@ static void test_vlstring_attribute()
// Read and verify the attribute string as a string of chars.
char *string_att_check;
gr_attr.read(vlst, &string_att_check);
- if(HDstrcmp(string_att_check, ATTRSTR_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), string_att_check);
+ if (HDstrcmp(string_att_check, ATTRSTR_DATA.c_str()) != 0)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n",
+ __LINE__, ATTRSTR_DATA.c_str(), string_att_check);
- HDfree(string_att_check); // note: no need for std::string test
+ HDfree(string_att_check); // note: no need for std::string test
// Read and verify the attribute string as an std::string.
H5std_string read_str;
gr_attr.read(vlst, read_str);
if (read_str != ATTRSTR_DATA)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_str=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_str.c_str());
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_str=%s\n", __LINE__,
+ ATTRSTR_DATA.c_str(), read_str.c_str());
// Close group's attribute.
gr_attr.close();
@@ -670,7 +676,7 @@ static void test_vlstring_attribute()
// Test creating a "large" sized string attribute
gr_attr = root.createAttribute("test_scalar_large", vlst, att_space);
- string_att_write = (char*)HDcalloc(8192, sizeof(char));
+ string_att_write = (char *)HDcalloc(8192, sizeof(char));
HDmemset(string_att_write, 'A', 8191);
// Write data to the attribute, then read it back.
@@ -678,8 +684,9 @@ static void test_vlstring_attribute()
gr_attr.read(vlst, &string_att_check);
// Verify data read.
- if(HDstrcmp(string_att_check,string_att_write)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
+ if (HDstrcmp(string_att_check, string_att_write) != 0)
+ TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",
+ string_att_write, string_att_check);
// Release resources.
HDfree(string_att_check);
@@ -691,11 +698,10 @@ static void test_vlstring_attribute()
} // end try block
// Catch all exceptions.
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_vlstring_attribute()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_vlstring_attribute()
+} // test_vlstring_attribute()
#if 0
/*-------------------------------------------------------------------------
@@ -774,11 +780,11 @@ static void test_read_vl_string_attribute()
*/
const H5std_string ATTRSTRARR_NAME("StringArray_attr");
-static void test_vlstring_array_attribute()
+static void
+test_vlstring_array_attribute()
{
- const char *string_att_array[SPACE1_DIM1]= {
- "Line 1", "Line 2", "Line 3", "Line 4"
- }; // Information to write
+ const char *string_att_array[SPACE1_DIM1] = {"Line 1", "Line 2", "Line 3",
+ "Line 4"}; // Information to write
// Output message about test being performed
SUBTEST("VL String Array on Attributes");
@@ -794,7 +800,7 @@ static void test_vlstring_array_attribute()
Group root = file1.openGroup("/");
// Create dataspace for datasets.
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
DataSpace att_space(SPACE1_RANK, dims1);
// Create an attribute for the root group.
@@ -809,12 +815,12 @@ static void test_vlstring_array_attribute()
gr_attr.read(vlst, &string_att_check);
hsize_t ii;
- for (ii = 0; ii < SPACE1_DIM1; ii++)
- {
- if(HDstrcmp(string_att_check[ii], string_att_array[ii])!=0)
- TestErrPrintf("Line %d: Attribute data different: written=%s,read=%s\n",__LINE__, string_att_check[ii], string_att_check[ii]);
+ for (ii = 0; ii < SPACE1_DIM1; ii++) {
+ if (HDstrcmp(string_att_check[ii], string_att_array[ii]) != 0)
+ TestErrPrintf("Line %d: Attribute data different: written=%s,read=%s\n", __LINE__,
+ string_att_check[ii], string_att_check[ii]);
- HDfree(string_att_check[ii]); // note: no need for std::string test
+ HDfree(string_att_check[ii]); // note: no need for std::string test
}
// Close group's attribute.
@@ -825,15 +831,14 @@ static void test_vlstring_array_attribute()
} // end try block
// Catch all exceptions.
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_vlstring_array_attribute()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_vlstring_array_attribute()
+} // test_vlstring_array_attribute()
/* Helper routine for test_vl_rewrite() */
-static void write_scalar_dset(H5File& file, DataType& type, DataSpace& space,
- char *name, char *data)
+static void
+write_scalar_dset(H5File &file, DataType &type, DataSpace &space, char *name, char *data)
{
DataSet dset;
try {
@@ -841,34 +846,34 @@ static void write_scalar_dset(H5File& file, DataType& type, DataSpace& space,
dset.write(&data, type, space, space);
dset.close();
} // end try
- catch (FileIException& ferr) {
+ catch (FileIException &ferr) {
throw;
}
- catch (DataSetIException& derr) {
+ catch (DataSetIException &derr) {
throw;
}
}
/* Helper routine for test_vl_rewrite() */
-static void read_scalar_dset(H5File& file, DataType& type, DataSpace& space,
- char *name, char *data)
+static void
+read_scalar_dset(H5File &file, DataType &type, DataSpace &space, char *name, char *data)
{
- char *data_read;
+ char * data_read;
DataSet dset;
try {
dset = file.openDataSet(name);
dset.read(&data_read, type, space, space);
dset.close();
- if(HDstrcmp(data, data_read))
+ if (HDstrcmp(data, data_read))
TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read);
HDfree(data_read);
} // end try
- catch (FileIException& ferr) {
+ catch (FileIException &ferr) {
throw;
}
- catch (DataSetIException& derr) {
+ catch (DataSetIException &derr) {
throw;
}
}
@@ -887,9 +892,10 @@ static void read_scalar_dset(H5File& file, DataType& type, DataSpace& space,
*-------------------------------------------------------------------------
*/
const H5std_string FILENAME2("tvlstr2.h5");
-const int REWRITE_NDATASETS = 32;
+const int REWRITE_NDATASETS = 32;
-static void test_vl_rewrite()
+static void
+test_vl_rewrite()
{
// Output message about test being performed
SUBTEST("I/O on VL strings with link/unlink");
@@ -903,37 +909,37 @@ static void test_vl_rewrite()
StrType type(0, H5T_VARIABLE);
// Create dataspace for the attribute.
- DataSpace space (H5S_SCALAR);
+ DataSpace space(H5S_SCALAR);
// Create in file 1.
- int i;
+ int i;
char name[256]; // Buffer for names & data
- for (i=0; i<REWRITE_NDATASETS; i++) {
+ for (i = 0; i < REWRITE_NDATASETS; i++) {
sprintf(name, "/set_%d", i);
write_scalar_dset(file1, type, space, name, name);
}
// Effectively copy data from file 1 to 2.
- for (i=0; i<REWRITE_NDATASETS; i++) {
+ for (i = 0; i < REWRITE_NDATASETS; i++) {
sprintf(name, "/set_%d", i);
read_scalar_dset(file1, type, space, name, name);
write_scalar_dset(file2, type, space, name, name);
}
// Read back from file 2.
- for (i=0; i<REWRITE_NDATASETS; i++) {
+ for (i = 0; i < REWRITE_NDATASETS; i++) {
sprintf(name, "/set_%d", i);
read_scalar_dset(file2, type, space, name, name);
}
// Remove from file 2.
- for (i=0; i<REWRITE_NDATASETS; i++) {
+ for (i = 0; i < REWRITE_NDATASETS; i++) {
sprintf(name, "/set_%d", i);
file2.unlink(name);
}
// Effectively copy from file 1 to file 2.
- for (i=0; i<REWRITE_NDATASETS; i++) {
+ for (i = 0; i < REWRITE_NDATASETS; i++) {
sprintf(name, "/set_%d", i);
read_scalar_dset(file1, type, space, name, name);
write_scalar_dset(file2, type, space, name, name);
@@ -949,8 +955,7 @@ static void test_vl_rewrite()
} // end try
// Catch all exceptions.
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_vl_rewrite()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // end test_vl_rewrite()
@@ -967,8 +972,8 @@ static void test_vl_rewrite()
*
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_vlstrings()
+extern "C" void
+test_vlstrings()
{
// Output message about test being performed
MESSAGE(5, ("Testing Variable-Length Strings"));
@@ -990,9 +995,8 @@ void test_vlstrings()
// Test writing VL datasets in files with lots of unlinking
test_vl_rewrite();
-} // test_vlstrings()
+} // test_vlstrings()
-
/*-------------------------------------------------------------------------
* Function: cleanup_vlstrings
*
@@ -1001,10 +1005,9 @@ void test_vlstrings()
* Return none
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_vlstrings()
+extern "C" void
+cleanup_vlstrings()
{
HDremove(FILENAME.c_str());
HDremove(FILENAME2.c_str());
}
-
diff --git a/examples/h5_attribute.c b/examples/h5_attribute.c
index 0e275c7..7a619f9 100644
--- a/examples/h5_attribute.c
+++ b/examples/h5_attribute.c
@@ -29,193 +29,192 @@
#define H5FILE_NAME "Attributes.h5"
-#define RANK 1 /* Rank and size of the dataset */
-#define SIZE 7
+#define RANK 1 /* Rank and size of the dataset */
+#define SIZE 7
-#define ARANK 2 /* Rank and dimension sizes of the first dataset attribute */
+#define ARANK 2 /* Rank and dimension sizes of the first dataset attribute */
#define ADIM1 2
#define ADIM2 3
-#define ANAME "Float attribute" /* Name of the array attribute */
+#define ANAME "Float attribute" /* Name of the array attribute */
#define ANAMES "Character attribute" /* Name of the string attribute */
static herr_t attr_info(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *opdata);
- /* Operator function */
+/* Operator function */
int
-main (void)
+main(void)
{
- hid_t file, dataset; /* File and dataset identifiers */
-
- hid_t fid; /* Dataspace identifier */
- hid_t attr1, attr2, attr3; /* Attribute identifiers */
- hid_t attr;
- hid_t aid1, aid2, aid3; /* Attribute dataspace identifiers */
- hid_t atype, atype_mem; /* Attribute type */
- H5T_class_t type_class;
-
- hsize_t fdim[] = {SIZE};
- hsize_t adim[] = {ADIM1, ADIM2}; /* Dimensions of the first attribute */
-
- float matrix[ADIM1][ADIM2]; /* Attribute data */
-
- herr_t ret; /* Return value */
- H5O_info2_t oinfo; /* Object info */
- unsigned i, j; /* Counters */
- char string_out[80]; /* Buffer to read string attribute back */
- int point_out; /* Buffer to read scalar attribute back */
-
- /*
- * Data initialization.
- */
- int vector[] = {1, 2, 3, 4, 5, 6, 7}; /* Dataset data */
- int point = 1; /* Value of the scalar attribute */
- char string[] = "ABCD"; /* Value of the string attribute */
-
-
- for (i=0; i < ADIM1; i++) { /* Values of the array attribute */
- for (j=0; j < ADIM2; j++)
- matrix[i][j] = -1.;
- }
-
- /*
- * Create a file.
- */
- file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
- /*
- * Create the dataspace for the dataset in the file.
- */
- fid = H5Screate(H5S_SIMPLE);
- ret = H5Sset_extent_simple(fid, RANK, fdim, NULL);
-
- /*
- * Create the dataset in the file.
- */
- dataset = H5Dcreate2(file, "Dataset", H5T_NATIVE_INT, fid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-
- /*
- * Write data to the dataset.
- */
- ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT, vector);
-
- /*
- * Create dataspace for the first attribute.
- */
- aid1 = H5Screate(H5S_SIMPLE);
- ret = H5Sset_extent_simple(aid1, ARANK, adim, NULL);
-
- /*
- * Create array attribute.
- */
- attr1 = H5Acreate2(dataset, ANAME, H5T_NATIVE_FLOAT, aid1, H5P_DEFAULT, H5P_DEFAULT);
-
- /*
- * Write array attribute.
- */
- ret = H5Awrite(attr1, H5T_NATIVE_FLOAT, matrix);
-
- /*
- * Create scalar attribute.
- */
- aid2 = H5Screate(H5S_SCALAR);
- attr2 = H5Acreate2(dataset, "Integer attribute", H5T_NATIVE_INT, aid2,
- H5P_DEFAULT, H5P_DEFAULT);
-
- /*
- * Write scalar attribute.
- */
- ret = H5Awrite(attr2, H5T_NATIVE_INT, &point);
-
- /*
- * Create string attribute.
- */
- aid3 = H5Screate(H5S_SCALAR);
- atype = H5Tcopy(H5T_C_S1);
- H5Tset_size(atype, 5);
- H5Tset_strpad(atype,H5T_STR_NULLTERM);
- attr3 = H5Acreate2(dataset, ANAMES, atype, aid3, H5P_DEFAULT, H5P_DEFAULT);
-
- /*
- * Write string attribute.
- */
- ret = H5Awrite(attr3, atype, string);
-
- /*
- * Close attribute and file dataspaces, and datatype.
- */
- ret = H5Sclose(aid1);
- ret = H5Sclose(aid2);
- ret = H5Sclose(aid3);
- ret = H5Sclose(fid);
- ret = H5Tclose(atype);
-
- /*
- * Close the attributes.
- */
- ret = H5Aclose(attr1);
- ret = H5Aclose(attr2);
- ret = H5Aclose(attr3);
-
- /*
- * Close the dataset.
- */
- ret = H5Dclose(dataset);
-
- /*
- * Close the file.
- */
- ret = H5Fclose(file);
-
- /*
- * Reopen the file.
- */
- file = H5Fopen(H5FILE_NAME, H5F_ACC_RDONLY, H5P_DEFAULT);
-
- /*
- * Open the dataset.
- */
- dataset = H5Dopen2(file, "Dataset", H5P_DEFAULT);
-
- /*
- * Attach to the scalar attribute using attribute name, then read and
- * display its value.
- */
- attr = H5Aopen(dataset, "Integer attribute", H5P_DEFAULT);
- ret = H5Aread(attr, H5T_NATIVE_INT, &point_out);
- printf("The value of the attribute \"Integer attribute\" is %d \n", point_out);
- ret = H5Aclose(attr);
-
- /*
- * Find string attribute by iterating through all attributes
- */
- ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- for(i = 0; i < (unsigned)oinfo.num_attrs; i++) {
- attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT, H5P_DEFAULT);
- atype = H5Aget_type(attr);
- type_class = H5Tget_class(atype);
- if (type_class == H5T_STRING) {
- atype_mem = H5Tget_native_type(atype, H5T_DIR_ASCEND);
- ret = H5Aread(attr, atype_mem, string_out);
- printf("Found string attribute; its index is %d , value = %s \n", i, string_out);
- ret = H5Tclose(atype_mem);
- }
- ret = H5Aclose(attr);
- ret = H5Tclose(atype);
+ hid_t file, dataset; /* File and dataset identifiers */
+
+ hid_t fid; /* Dataspace identifier */
+ hid_t attr1, attr2, attr3; /* Attribute identifiers */
+ hid_t attr;
+ hid_t aid1, aid2, aid3; /* Attribute dataspace identifiers */
+ hid_t atype, atype_mem; /* Attribute type */
+ H5T_class_t type_class;
+
+ hsize_t fdim[] = {SIZE};
+ hsize_t adim[] = {ADIM1, ADIM2}; /* Dimensions of the first attribute */
+
+ float matrix[ADIM1][ADIM2]; /* Attribute data */
+
+ herr_t ret; /* Return value */
+ H5O_info2_t oinfo; /* Object info */
+ unsigned i, j; /* Counters */
+ char string_out[80]; /* Buffer to read string attribute back */
+ int point_out; /* Buffer to read scalar attribute back */
+
+ /*
+ * Data initialization.
+ */
+ int vector[] = {1, 2, 3, 4, 5, 6, 7}; /* Dataset data */
+ int point = 1; /* Value of the scalar attribute */
+ char string[] = "ABCD"; /* Value of the string attribute */
+
+ for (i = 0; i < ADIM1; i++) { /* Values of the array attribute */
+ for (j = 0; j < ADIM2; j++)
+ matrix[i][j] = -1.;
+ }
+
+ /*
+ * Create a file.
+ */
+ file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create the dataspace for the dataset in the file.
+ */
+ fid = H5Screate(H5S_SIMPLE);
+ ret = H5Sset_extent_simple(fid, RANK, fdim, NULL);
+
+ /*
+ * Create the dataset in the file.
+ */
+ dataset = H5Dcreate2(file, "Dataset", H5T_NATIVE_INT, fid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Write data to the dataset.
+ */
+ ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, vector);
+
+ /*
+ * Create dataspace for the first attribute.
+ */
+ aid1 = H5Screate(H5S_SIMPLE);
+ ret = H5Sset_extent_simple(aid1, ARANK, adim, NULL);
+
+ /*
+ * Create array attribute.
+ */
+ attr1 = H5Acreate2(dataset, ANAME, H5T_NATIVE_FLOAT, aid1, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Write array attribute.
+ */
+ ret = H5Awrite(attr1, H5T_NATIVE_FLOAT, matrix);
+
+ /*
+ * Create scalar attribute.
+ */
+ aid2 = H5Screate(H5S_SCALAR);
+ attr2 = H5Acreate2(dataset, "Integer attribute", H5T_NATIVE_INT, aid2, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Write scalar attribute.
+ */
+ ret = H5Awrite(attr2, H5T_NATIVE_INT, &point);
+
+ /*
+ * Create string attribute.
+ */
+ aid3 = H5Screate(H5S_SCALAR);
+ atype = H5Tcopy(H5T_C_S1);
+ H5Tset_size(atype, 5);
+ H5Tset_strpad(atype, H5T_STR_NULLTERM);
+ attr3 = H5Acreate2(dataset, ANAMES, atype, aid3, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Write string attribute.
+ */
+ ret = H5Awrite(attr3, atype, string);
+
+ /*
+ * Close attribute and file dataspaces, and datatype.
+ */
+ ret = H5Sclose(aid1);
+ ret = H5Sclose(aid2);
+ ret = H5Sclose(aid3);
+ ret = H5Sclose(fid);
+ ret = H5Tclose(atype);
+
+ /*
+ * Close the attributes.
+ */
+ ret = H5Aclose(attr1);
+ ret = H5Aclose(attr2);
+ ret = H5Aclose(attr3);
+
+ /*
+ * Close the dataset.
+ */
+ ret = H5Dclose(dataset);
+
+ /*
+ * Close the file.
+ */
+ ret = H5Fclose(file);
+
+ /*
+ * Reopen the file.
+ */
+ file = H5Fopen(H5FILE_NAME, H5F_ACC_RDONLY, H5P_DEFAULT);
+
+ /*
+ * Open the dataset.
+ */
+ dataset = H5Dopen2(file, "Dataset", H5P_DEFAULT);
+
+ /*
+ * Attach to the scalar attribute using attribute name, then read and
+ * display its value.
+ */
+ attr = H5Aopen(dataset, "Integer attribute", H5P_DEFAULT);
+ ret = H5Aread(attr, H5T_NATIVE_INT, &point_out);
+ printf("The value of the attribute \"Integer attribute\" is %d \n", point_out);
+ ret = H5Aclose(attr);
+
+ /*
+ * Find string attribute by iterating through all attributes
+ */
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ for (i = 0; i < (unsigned)oinfo.num_attrs; i++) {
+ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT,
+ H5P_DEFAULT);
+ atype = H5Aget_type(attr);
+ type_class = H5Tget_class(atype);
+ if (type_class == H5T_STRING) {
+ atype_mem = H5Tget_native_type(atype, H5T_DIR_ASCEND);
+ ret = H5Aread(attr, atype_mem, string_out);
+ printf("Found string attribute; its index is %d , value = %s \n", i, string_out);
+ ret = H5Tclose(atype_mem);
+ }
+ ret = H5Aclose(attr);
+ ret = H5Tclose(atype);
}
- /*
- * Get attribute info using iteration function.
- */
+ /*
+ * Get attribute info using iteration function.
+ */
ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_info, NULL);
- /*
- * Close the dataset and the file.
- */
- H5Dclose(dataset);
- H5Fclose(file);
+ /*
+ * Close the dataset and the file.
+ */
+ H5Dclose(dataset);
+ H5Fclose(file);
- return 0;
+ return 0;
}
/*
@@ -224,13 +223,13 @@ main (void)
static herr_t
attr_info(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *opdata)
{
- hid_t attr, atype, aspace; /* Attribute, datatype and dataspace identifiers */
- int rank;
+ hid_t attr, atype, aspace; /* Attribute, datatype and dataspace identifiers */
+ int rank;
hsize_t sdim[64];
- herr_t ret;
- int i;
- size_t npoints; /* Number of elements in the array attribute. */
- float *float_array; /* Pointer to the array attribute. */
+ herr_t ret;
+ int i;
+ size_t npoints; /* Number of elements in the array attribute. */
+ float * float_array; /* Pointer to the array attribute. */
/* avoid warnings */
opdata = opdata;
@@ -250,17 +249,17 @@ attr_info(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *opdata)
*/
atype = H5Aget_type(attr);
aspace = H5Aget_space(attr);
- rank = H5Sget_simple_extent_ndims(aspace);
- ret = H5Sget_simple_extent_dims(aspace, sdim, NULL);
+ rank = H5Sget_simple_extent_ndims(aspace);
+ ret = H5Sget_simple_extent_dims(aspace, sdim, NULL);
/*
* Display rank and dimension sizes for the array attribute.
*/
- if(rank > 0) {
+ if (rank > 0) {
printf("Rank : %d \n", rank);
printf("Dimension sizes : ");
- for (i=0; i< rank; i++)
+ for (i = 0; i < rank; i++)
printf("%d ", (int)sdim[i]);
printf("\n");
}
@@ -271,11 +270,11 @@ attr_info(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *opdata)
if (H5T_FLOAT == H5Tget_class(atype)) {
printf("Type : FLOAT \n");
- npoints = H5Sget_simple_extent_npoints(aspace);
- float_array = (float *)malloc(sizeof(float)*(int)npoints);
- ret = H5Aread(attr, atype, float_array);
+ npoints = H5Sget_simple_extent_npoints(aspace);
+ float_array = (float *)malloc(sizeof(float) * (int)npoints);
+ ret = H5Aread(attr, atype, float_array);
printf("Values : ");
- for( i = 0; i < (int)npoints; i++)
+ for (i = 0; i < (int)npoints; i++)
printf("%f ", float_array[i]);
printf("\n");
free(float_array);
@@ -290,4 +289,3 @@ attr_info(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *opdata)
return 0;
}
-
diff --git a/examples/h5_chunk_read.c b/examples/h5_chunk_read.c
index c3455f4..01e8c5d 100644
--- a/examples/h5_chunk_read.c
+++ b/examples/h5_chunk_read.c
@@ -18,68 +18,66 @@
#include "hdf5.h"
-#define H5FILE_NAME "SDSextendible.h5"
+#define H5FILE_NAME "SDSextendible.h5"
#define DATASETNAME "ExtendibleArray"
-#define RANK 2
-#define RANKC 1
-#define NX 10
-#define NY 5
+#define RANK 2
+#define RANKC 1
+#define NX 10
+#define NY 5
int
-main (void)
+main(void)
{
- hid_t file; /* handles */
- hid_t dataset;
- hid_t filespace;
- hid_t memspace;
- hid_t cparms;
- hsize_t dims[2]; /* dataset and chunk dimensions*/
- hsize_t chunk_dims[2];
- hsize_t col_dims[1];
- hsize_t count[2];
- hsize_t offset[2];
-
- herr_t status, status_n;
-
- int data_out[NX][NY]; /* buffer for dataset to be read */
- int chunk_out[2][5]; /* buffer for chunk to be read */
- int column[10]; /* buffer for column to be read */
- int rank, rank_chunk;
- int i, j;
-
-
+ hid_t file; /* handles */
+ hid_t dataset;
+ hid_t filespace;
+ hid_t memspace;
+ hid_t cparms;
+ hsize_t dims[2]; /* dataset and chunk dimensions*/
+ hsize_t chunk_dims[2];
+ hsize_t col_dims[1];
+ hsize_t count[2];
+ hsize_t offset[2];
+
+ herr_t status, status_n;
+
+ int data_out[NX][NY]; /* buffer for dataset to be read */
+ int chunk_out[2][5]; /* buffer for chunk to be read */
+ int column[10]; /* buffer for column to be read */
+ int rank, rank_chunk;
+ int i, j;
/*
* Open the file and the dataset.
*/
- file = H5Fopen(H5FILE_NAME, H5F_ACC_RDONLY, H5P_DEFAULT);
+ file = H5Fopen(H5FILE_NAME, H5F_ACC_RDONLY, H5P_DEFAULT);
dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT);
/*
* Get dataset rank and dimension.
*/
- filespace = H5Dget_space(dataset); /* Get filespace handle first. */
+ filespace = H5Dget_space(dataset); /* Get filespace handle first. */
rank = H5Sget_simple_extent_ndims(filespace);
status_n = H5Sget_simple_extent_dims(filespace, dims, NULL);
- printf("dataset rank %d, dimensions %lu x %lu\n",
- rank, (unsigned long)(dims[0]), (unsigned long)(dims[1]));
+ printf("dataset rank %d, dimensions %lu x %lu\n", rank, (unsigned long)(dims[0]),
+ (unsigned long)(dims[1]));
/*
* Define the memory space to read dataset.
*/
- memspace = H5Screate_simple(RANK,dims,NULL);
+ memspace = H5Screate_simple(RANK, dims, NULL);
/*
* Read dataset back and display.
*/
- status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace,
- H5P_DEFAULT, data_out);
+ status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, data_out);
printf("\n");
printf("Dataset: \n");
for (j = 0; j < dims[0]; j++) {
- for (i = 0; i < dims[1]; i++) printf("%d ", data_out[j][i]);
- printf("\n");
+ for (i = 0; i < dims[1]; i++)
+ printf("%d ", data_out[j][i]);
+ printf("\n");
}
/*
@@ -110,7 +108,7 @@ main (void)
* and read it into column array.
*/
col_dims[0] = 10;
- memspace = H5Screate_simple(RANKC, col_dims, NULL);
+ memspace = H5Screate_simple(RANKC, col_dims, NULL);
/*
* Define the column (hyperslab) to read.
@@ -119,14 +117,12 @@ main (void)
offset[1] = 2;
count[0] = 10;
count[1] = 1;
- status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
- count, NULL);
- status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace,
- H5P_DEFAULT, column);
+ status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, count, NULL);
+ status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, column);
printf("\n");
printf("Third column: \n");
for (i = 0; i < 10; i++) {
- printf("%d \n", column[i]);
+ printf("%d \n", column[i]);
}
/*
@@ -153,19 +149,19 @@ main (void)
*/
cparms = H5Dget_create_plist(dataset); /* Get properties handle first. */
- if (H5D_CHUNKED == H5Pget_layout(cparms)) {
+ if (H5D_CHUNKED == H5Pget_layout(cparms)) {
- /*
- * Get chunking information: rank and dimensions
- */
- rank_chunk = H5Pget_chunk(cparms, 2, chunk_dims);
- printf("chunk rank %d, dimensions %lu x %lu\n", rank_chunk,
- (unsigned long)(chunk_dims[0]), (unsigned long)(chunk_dims[1]));
+ /*
+ * Get chunking information: rank and dimensions
+ */
+ rank_chunk = H5Pget_chunk(cparms, 2, chunk_dims);
+ printf("chunk rank %d, dimensions %lu x %lu\n", rank_chunk, (unsigned long)(chunk_dims[0]),
+ (unsigned long)(chunk_dims[1]));
/*
* Define the memory space to read a chunk.
*/
- memspace = H5Screate_simple(rank_chunk,chunk_dims,NULL);
+ memspace = H5Screate_simple(rank_chunk, chunk_dims, NULL);
/*
* Define chunk in the file (hyperslab) to read.
@@ -174,18 +170,17 @@ main (void)
offset[1] = 0;
count[0] = chunk_dims[0];
count[1] = chunk_dims[1];
- status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
- count, NULL);
+ status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, count, NULL);
/*
* Read chunk back and display.
*/
- status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace,
- H5P_DEFAULT, chunk_out);
+ status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, chunk_out);
printf("\n");
printf("Chunk: \n");
for (j = 0; j < chunk_dims[0]; j++) {
- for (i = 0; i < chunk_dims[1]; i++) printf("%d ", chunk_out[j][i]);
+ for (i = 0; i < chunk_dims[1]; i++)
+ printf("%d ", chunk_out[j][i]);
printf("\n");
}
/*
diff --git a/examples/h5_cmprss.c b/examples/h5_cmprss.c
index 97f6567..bb77e28 100644
--- a/examples/h5_cmprss.c
+++ b/examples/h5_cmprss.c
@@ -18,27 +18,29 @@
#include "hdf5.h"
-#define FILE "cmprss.h5"
-#define RANK 2
-#define DIM0 100
-#define DIM1 20
+#define FILE "cmprss.h5"
+#define RANK 2
+#define DIM0 100
+#define DIM1 20
-int main () {
+int
+main()
+{
- hid_t file_id, dataset_id, dataspace_id; /* identifiers */
- hid_t plist_id;
+ hid_t file_id, dataset_id, dataspace_id; /* identifiers */
+ hid_t plist_id;
- size_t nelmts;
- unsigned flags, filter_info;
+ size_t nelmts;
+ unsigned flags, filter_info;
H5Z_filter_t filter_type;
- herr_t status;
- hsize_t dims[2];
- hsize_t cdims[2];
+ herr_t status;
+ hsize_t dims[2];
+ hsize_t cdims[2];
- int i,j, numfilt;
- int buf[DIM0][DIM1];
- int rbuf [DIM0][DIM1];
+ int i, j, numfilt;
+ int buf[DIM0][DIM1];
+ int rbuf[DIM0][DIM1];
/* Uncomment these variables to use SZIP compression
unsigned szip_options_mask;
@@ -46,25 +48,24 @@ int main () {
*/
/* Create a file. */
- file_id = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
+ file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Create dataset "Compressed Data" in the group using absolute name. */
- dims[0] = DIM0;
- dims[1] = DIM1;
- dataspace_id = H5Screate_simple (RANK, dims, NULL);
+ dims[0] = DIM0;
+ dims[1] = DIM1;
+ dataspace_id = H5Screate_simple(RANK, dims, NULL);
- plist_id = H5Pcreate (H5P_DATASET_CREATE);
+ plist_id = H5Pcreate(H5P_DATASET_CREATE);
/* Dataset must be chunked for compression */
cdims[0] = 20;
cdims[1] = 20;
- status = H5Pset_chunk (plist_id, 2, cdims);
+ status = H5Pset_chunk(plist_id, 2, cdims);
/* Set ZLIB / DEFLATE Compression using compression level 6.
* To use SZIP Compression comment out these lines.
- */
- status = H5Pset_deflate (plist_id, 6);
+ */
+ status = H5Pset_deflate(plist_id, 6);
/* Uncomment these lines to set SZIP Compression
szip_options_mask = H5_SZIP_NN_OPTION_MASK;
@@ -72,51 +73,49 @@ int main () {
status = H5Pset_szip (plist_id, szip_options_mask, szip_pixels_per_block);
*/
- dataset_id = H5Dcreate2 (file_id, "Compressed_Data", H5T_STD_I32BE,
- dataspace_id, H5P_DEFAULT, plist_id, H5P_DEFAULT);
+ dataset_id = H5Dcreate2(file_id, "Compressed_Data", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, plist_id,
+ H5P_DEFAULT);
- for (i = 0; i< DIM0; i++)
- for (j=0; j<DIM1; j++)
- buf[i][j] = i+j;
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ buf[i][j] = i + j;
- status = H5Dwrite (dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- status = H5Sclose (dataspace_id);
- status = H5Dclose (dataset_id);
- status = H5Pclose (plist_id);
- status = H5Fclose (file_id);
+ status = H5Sclose(dataspace_id);
+ status = H5Dclose(dataset_id);
+ status = H5Pclose(plist_id);
+ status = H5Fclose(file_id);
/* Now reopen the file and dataset in the file. */
- file_id = H5Fopen (FILE, H5F_ACC_RDWR, H5P_DEFAULT);
- dataset_id = H5Dopen2 (file_id, "Compressed_Data", H5P_DEFAULT);
+ file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ dataset_id = H5Dopen2(file_id, "Compressed_Data", H5P_DEFAULT);
/* Retrieve filter information. */
- plist_id = H5Dget_create_plist (dataset_id);
-
- numfilt = H5Pget_nfilters (plist_id);
- printf ("Number of filters associated with dataset: %i\n", numfilt);
-
- for (i=0; i<numfilt; i++) {
- nelmts = 0;
- filter_type = H5Pget_filter2 (plist_id, i, &flags, &nelmts, NULL, 0, NULL,
- &filter_info);
- printf ("Filter Type: ");
- switch (filter_type) {
- case H5Z_FILTER_DEFLATE:
- printf ("H5Z_FILTER_DEFLATE\n");
- break;
- case H5Z_FILTER_SZIP:
- printf ("H5Z_FILTER_SZIP\n");
- break;
- default:
- printf ("Other filter type included.\n");
- }
+ plist_id = H5Dget_create_plist(dataset_id);
+
+ numfilt = H5Pget_nfilters(plist_id);
+ printf("Number of filters associated with dataset: %i\n", numfilt);
+
+ for (i = 0; i < numfilt; i++) {
+ nelmts = 0;
+ filter_type = H5Pget_filter2(plist_id, i, &flags, &nelmts, NULL, 0, NULL, &filter_info);
+ printf("Filter Type: ");
+ switch (filter_type) {
+ case H5Z_FILTER_DEFLATE:
+ printf("H5Z_FILTER_DEFLATE\n");
+ break;
+ case H5Z_FILTER_SZIP:
+ printf("H5Z_FILTER_SZIP\n");
+ break;
+ default:
+ printf("Other filter type included.\n");
+ }
}
- status = H5Dread (dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, rbuf);
+ status = H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
- status = H5Dclose (dataset_id);
- status = H5Pclose (plist_id);
- status = H5Fclose (file_id);
+ status = H5Dclose(dataset_id);
+ status = H5Pclose(plist_id);
+ status = H5Fclose(file_id);
}
diff --git a/examples/h5_compound.c b/examples/h5_compound.c
index b3b3a4a..6b4888e 100644
--- a/examples/h5_compound.c
+++ b/examples/h5_compound.c
@@ -19,10 +19,10 @@
#include "hdf5.h"
-#define H5FILE_NAME "SDScompound.h5"
-#define DATASETNAME "ArrayOfStructures"
-#define LENGTH 10
-#define RANK 1
+#define H5FILE_NAME "SDScompound.h5"
+#define DATASETNAME "ArrayOfStructures"
+#define LENGTH 10
+#define RANK 1
int
main(void)
@@ -30,38 +30,37 @@ main(void)
/* First structure and dataset*/
typedef struct s1_t {
- int a;
- float b;
- double c;
+ int a;
+ float b;
+ double c;
} s1_t;
- s1_t s1[LENGTH];
- hid_t s1_tid; /* File datatype identifier */
+ s1_t s1[LENGTH];
+ hid_t s1_tid; /* File datatype identifier */
/* Second structure (subset of s1_t) and dataset*/
typedef struct s2_t {
- double c;
- int a;
+ double c;
+ int a;
} s2_t;
- s2_t s2[LENGTH];
- hid_t s2_tid; /* Memory datatype handle */
+ s2_t s2[LENGTH];
+ hid_t s2_tid; /* Memory datatype handle */
/* Third "structure" ( will be used to read float field of s1) */
- hid_t s3_tid; /* Memory datatype handle */
- float s3[LENGTH];
-
- int i;
- hid_t file, dataset, space; /* Handles */
- herr_t status;
- hsize_t dim[] = {LENGTH}; /* Dataspace dimensions */
+ hid_t s3_tid; /* Memory datatype handle */
+ float s3[LENGTH];
+ int i;
+ hid_t file, dataset, space; /* Handles */
+ herr_t status;
+ hsize_t dim[] = {LENGTH}; /* Dataspace dimensions */
/*
* Initialize the data
*/
- for (i = 0; i< LENGTH; i++) {
+ for (i = 0; i < LENGTH; i++) {
s1[i].a = i;
- s1[i].b = i*i;
- s1[i].c = 1./(i+1);
+ s1[i].b = i * i;
+ s1[i].c = 1. / (i + 1);
}
/*
@@ -77,7 +76,7 @@ main(void)
/*
* Create the memory data type.
*/
- s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t));
+ s1_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
H5Tinsert(s1_tid, "a_name", HOFFSET(s1_t, a), H5T_NATIVE_INT);
H5Tinsert(s1_tid, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE);
H5Tinsert(s1_tid, "b_name", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT);
@@ -126,12 +125,14 @@ main(void)
*/
printf("\n");
printf("Field c : \n");
- for( i = 0; i < LENGTH; i++) printf("%.4f ", s2[i].c);
+ for (i = 0; i < LENGTH; i++)
+ printf("%.4f ", s2[i].c);
printf("\n");
printf("\n");
printf("Field a : \n");
- for( i = 0; i < LENGTH; i++) printf("%d ", s2[i].a);
+ for (i = 0; i < LENGTH; i++)
+ printf("%d ", s2[i].a);
printf("\n");
/*
@@ -151,7 +152,8 @@ main(void)
*/
printf("\n");
printf("Field b : \n");
- for( i = 0; i < LENGTH; i++) printf("%.4f ", s3[i]);
+ for (i = 0; i < LENGTH; i++)
+ printf("%.4f ", s3[i]);
printf("\n");
/*
diff --git a/examples/h5_crtatt.c b/examples/h5_crtatt.c
index aa997e7..dbce4bb 100644
--- a/examples/h5_crtatt.c
+++ b/examples/h5_crtatt.c
@@ -19,43 +19,44 @@
#include "hdf5.h"
#define FILE "dset.h5"
-int main() {
+int
+main()
+{
- hid_t file_id, dataset_id, attribute_id, dataspace_id; /* identifiers */
- hsize_t dims;
- int attr_data[2];
- herr_t status;
+ hid_t file_id, dataset_id, attribute_id, dataspace_id; /* identifiers */
+ hsize_t dims;
+ int attr_data[2];
+ herr_t status;
- /* Initialize the attribute data. */
- attr_data[0] = 100;
- attr_data[1] = 200;
+ /* Initialize the attribute data. */
+ attr_data[0] = 100;
+ attr_data[1] = 200;
- /* Open an existing file. */
- file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ /* Open an existing file. */
+ file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);
- /* Open an existing dataset. */
- dataset_id = H5Dopen2(file_id, "/dset", H5P_DEFAULT);
+ /* Open an existing dataset. */
+ dataset_id = H5Dopen2(file_id, "/dset", H5P_DEFAULT);
- /* Create the data space for the attribute. */
- dims = 2;
- dataspace_id = H5Screate_simple(1, &dims, NULL);
+ /* Create the data space for the attribute. */
+ dims = 2;
+ dataspace_id = H5Screate_simple(1, &dims, NULL);
- /* Create a dataset attribute. */
- attribute_id = H5Acreate2 (dataset_id, "Units", H5T_STD_I32BE, dataspace_id,
- H5P_DEFAULT, H5P_DEFAULT);
+ /* Create a dataset attribute. */
+ attribute_id = H5Acreate2(dataset_id, "Units", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT);
- /* Write the attribute data. */
- status = H5Awrite(attribute_id, H5T_NATIVE_INT, attr_data);
+ /* Write the attribute data. */
+ status = H5Awrite(attribute_id, H5T_NATIVE_INT, attr_data);
- /* Close the attribute. */
- status = H5Aclose(attribute_id);
+ /* Close the attribute. */
+ status = H5Aclose(attribute_id);
- /* Close the dataspace. */
- status = H5Sclose(dataspace_id);
+ /* Close the dataspace. */
+ status = H5Sclose(dataspace_id);
- /* Close to the dataset. */
- status = H5Dclose(dataset_id);
+ /* Close to the dataset. */
+ status = H5Dclose(dataset_id);
- /* Close the file. */
- status = H5Fclose(file_id);
+ /* Close the file. */
+ status = H5Fclose(file_id);
}
diff --git a/examples/h5_crtdat.c b/examples/h5_crtdat.c
index 9fcb186..d1c9e9c 100644
--- a/examples/h5_crtdat.c
+++ b/examples/h5_crtdat.c
@@ -19,31 +19,32 @@
#include "hdf5.h"
#define FILE "dset.h5"
-int main() {
+int
+main()
+{
- hid_t file_id, dataset_id, dataspace_id; /* identifiers */
- hsize_t dims[2];
- herr_t status;
+ hid_t file_id, dataset_id, dataspace_id; /* identifiers */
+ hsize_t dims[2];
+ herr_t status;
- /* Create a new file using default properties. */
- file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create a new file using default properties. */
+ file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- /* Create the data space for the dataset. */
- dims[0] = 4;
- dims[1] = 6;
- dataspace_id = H5Screate_simple(2, dims, NULL);
+ /* Create the data space for the dataset. */
+ dims[0] = 4;
+ dims[1] = 6;
+ dataspace_id = H5Screate_simple(2, dims, NULL);
- /* Create the dataset. */
- dataset_id = H5Dcreate2(file_id, "/dset", H5T_STD_I32BE, dataspace_id,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create the dataset. */
+ dataset_id =
+ H5Dcreate2(file_id, "/dset", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- /* End access to the dataset and release resources used by it. */
- status = H5Dclose(dataset_id);
+ /* End access to the dataset and release resources used by it. */
+ status = H5Dclose(dataset_id);
- /* Terminate access to the data space. */
- status = H5Sclose(dataspace_id);
+ /* Terminate access to the data space. */
+ status = H5Sclose(dataspace_id);
- /* Close the file. */
- status = H5Fclose(file_id);
+ /* Close the file. */
+ status = H5Fclose(file_id);
}
-
diff --git a/examples/h5_crtgrp.c b/examples/h5_crtgrp.c
index 1b110c2..065f595 100644
--- a/examples/h5_crtgrp.c
+++ b/examples/h5_crtgrp.c
@@ -19,20 +19,22 @@
#include "hdf5.h"
#define FILE "group.h5"
-int main() {
+int
+main()
+{
- hid_t file_id, group_id; /* identifiers */
- herr_t status;
+ hid_t file_id, group_id; /* identifiers */
+ herr_t status;
- /* Create a new file using default properties. */
- file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create a new file using default properties. */
+ file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- /* Create a group named "/MyGroup" in the file. */
- group_id = H5Gcreate2(file_id, "/MyGroup", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create a group named "/MyGroup" in the file. */
+ group_id = H5Gcreate2(file_id, "/MyGroup", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- /* Close the group. */
- status = H5Gclose(group_id);
+ /* Close the group. */
+ status = H5Gclose(group_id);
- /* Terminate access to the file. */
- status = H5Fclose(file_id);
+ /* Terminate access to the file. */
+ status = H5Fclose(file_id);
}
diff --git a/examples/h5_crtgrpar.c b/examples/h5_crtgrpar.c
index 21a37c5..edc9f7b 100644
--- a/examples/h5_crtgrpar.c
+++ b/examples/h5_crtgrpar.c
@@ -19,28 +19,30 @@
#include "hdf5.h"
#define FILE "groups.h5"
-int main() {
+int
+main()
+{
- hid_t file_id, group1_id, group2_id, group3_id; /* identifiers */
- herr_t status;
+ hid_t file_id, group1_id, group2_id, group3_id; /* identifiers */
+ herr_t status;
- /* Create a new file using default properties. */
- file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create a new file using default properties. */
+ file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- /* Create group "MyGroup" in the root group using absolute name. */
- group1_id = H5Gcreate2(file_id, "/MyGroup", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create group "MyGroup" in the root group using absolute name. */
+ group1_id = H5Gcreate2(file_id, "/MyGroup", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- /* Create group "Group_A" in group "MyGroup" using absolute name. */
- group2_id = H5Gcreate2(file_id, "/MyGroup/Group_A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create group "Group_A" in group "MyGroup" using absolute name. */
+ group2_id = H5Gcreate2(file_id, "/MyGroup/Group_A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- /* Create group "Group_B" in group "MyGroup" using relative name. */
- group3_id = H5Gcreate2(group1_id, "Group_B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create group "Group_B" in group "MyGroup" using relative name. */
+ group3_id = H5Gcreate2(group1_id, "Group_B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- /* Close groups. */
- status = H5Gclose(group1_id);
- status = H5Gclose(group2_id);
- status = H5Gclose(group3_id);
+ /* Close groups. */
+ status = H5Gclose(group1_id);
+ status = H5Gclose(group2_id);
+ status = H5Gclose(group3_id);
- /* Close the file. */
- status = H5Fclose(file_id);
+ /* Close the file. */
+ status = H5Fclose(file_id);
}
diff --git a/examples/h5_crtgrpd.c b/examples/h5_crtgrpd.c
index d0d535b..05de517 100644
--- a/examples/h5_crtgrpd.c
+++ b/examples/h5_crtgrpd.c
@@ -19,71 +19,70 @@
#include "hdf5.h"
#define FILE "groups.h5"
-int main() {
+int
+main()
+{
- hid_t file_id, group_id, dataset_id, dataspace_id; /* identifiers */
- hsize_t dims[2];
- herr_t status;
- int i, j, dset1_data[3][3], dset2_data[2][10];
+ hid_t file_id, group_id, dataset_id, dataspace_id; /* identifiers */
+ hsize_t dims[2];
+ herr_t status;
+ int i, j, dset1_data[3][3], dset2_data[2][10];
- /* Initialize the first dataset. */
- for (i = 0; i < 3; i++)
- for (j = 0; j < 3; j++)
- dset1_data[i][j] = j + 1;
+ /* Initialize the first dataset. */
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 3; j++)
+ dset1_data[i][j] = j + 1;
- /* Initialize the second dataset. */
- for (i = 0; i < 2; i++)
- for (j = 0; j < 10; j++)
- dset2_data[i][j] = j + 1;
+ /* Initialize the second dataset. */
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 10; j++)
+ dset2_data[i][j] = j + 1;
- /* Open an existing file. */
- file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ /* Open an existing file. */
+ file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);
- /* Create the data space for the first dataset. */
- dims[0] = 3;
- dims[1] = 3;
- dataspace_id = H5Screate_simple(2, dims, NULL);
+ /* Create the data space for the first dataset. */
+ dims[0] = 3;
+ dims[1] = 3;
+ dataspace_id = H5Screate_simple(2, dims, NULL);
- /* Create a dataset in group "MyGroup". */
- dataset_id = H5Dcreate2(file_id, "/MyGroup/dset1", H5T_STD_I32BE, dataspace_id,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create a dataset in group "MyGroup". */
+ dataset_id = H5Dcreate2(file_id, "/MyGroup/dset1", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
- /* Write the first dataset. */
- status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- dset1_data);
+ /* Write the first dataset. */
+ status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1_data);
- /* Close the data space for the first dataset. */
- status = H5Sclose(dataspace_id);
+ /* Close the data space for the first dataset. */
+ status = H5Sclose(dataspace_id);
- /* Close the first dataset. */
- status = H5Dclose(dataset_id);
+ /* Close the first dataset. */
+ status = H5Dclose(dataset_id);
- /* Open an existing group of the specified file. */
- group_id = H5Gopen2(file_id, "/MyGroup/Group_A", H5P_DEFAULT);
+ /* Open an existing group of the specified file. */
+ group_id = H5Gopen2(file_id, "/MyGroup/Group_A", H5P_DEFAULT);
- /* Create the data space for the second dataset. */
- dims[0] = 2;
- dims[1] = 10;
- dataspace_id = H5Screate_simple(2, dims, NULL);
+ /* Create the data space for the second dataset. */
+ dims[0] = 2;
+ dims[1] = 10;
+ dataspace_id = H5Screate_simple(2, dims, NULL);
- /* Create the second dataset in group "Group_A". */
- dataset_id = H5Dcreate2(group_id, "dset2", H5T_STD_I32BE, dataspace_id,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create the second dataset in group "Group_A". */
+ dataset_id =
+ H5Dcreate2(group_id, "dset2", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- /* Write the second dataset. */
- status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- dset2_data);
+ /* Write the second dataset. */
+ status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_data);
- /* Close the data space for the second dataset. */
- status = H5Sclose(dataspace_id);
+ /* Close the data space for the second dataset. */
+ status = H5Sclose(dataspace_id);
- /* Close the second dataset */
- status = H5Dclose(dataset_id);
+ /* Close the second dataset */
+ status = H5Dclose(dataset_id);
- /* Close the group. */
- status = H5Gclose(group_id);
+ /* Close the group. */
+ status = H5Gclose(group_id);
- /* Close the file. */
- status = H5Fclose(file_id);
+ /* Close the file. */
+ status = H5Fclose(file_id);
}
-
diff --git a/examples/h5_debug_trace.c b/examples/h5_debug_trace.c
index 5da55ed..0f0ec97 100644
--- a/examples/h5_debug_trace.c
+++ b/examples/h5_debug_trace.c
@@ -12,7 +12,7 @@
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
+
/* This example demonstrates debug trace output.
*
* Debug/trace/performance output is not tested as a regular part of our
@@ -42,33 +42,33 @@
* fast machines, these numbers may be 0.0. Adjust the loop variables in
* the program as needed to generate reasonable output.
*/
-
+
#include <stdio.h>
#include <stdlib.h>
-
+
#include "hdf5.h"
-
-#define BUF_SIZE 1048576
-#define N_LOOPS 64
-
+
+#define BUF_SIZE 1048576
+#define N_LOOPS 64
+
#define TESTFILE "h5_debug_trace_out.h5"
-
+
int
main(int argc, char **argv)
{
- int i, j;
+ int i, j;
int *data;
-
- hid_t fid;
- hid_t pid;
- hid_t did;
- hid_t sid;
-
- hsize_t dims[1] = { BUF_SIZE };
- hsize_t chunk_sizes[1] = { 1024 };
-
+
+ hid_t fid;
+ hid_t pid;
+ hid_t did;
+ hid_t sid;
+
+ hsize_t dims[1] = {BUF_SIZE};
+ hsize_t chunk_sizes[1] = {1024};
+
herr_t err;
-
+
/*************************************************************************/
/* Warn the user about trace deluge to come */
@@ -82,55 +82,52 @@ main(int argc, char **argv)
fflush(stdout);
/* This will emit H5Tconvert() performance information */
-
- for(i = 0; i < N_LOOPS; i++) {
-
+
+ for (i = 0; i < N_LOOPS; i++) {
+
/* The buffer has to be large enough to hold the conversion output */
data = (int *)malloc(BUF_SIZE * sizeof(double));
-
- for(j = 0; j < BUF_SIZE; j++) {
+
+ for (j = 0; j < BUF_SIZE; j++) {
data[j] = j;
}
-
- err = H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_DOUBLE, BUF_SIZE, data,
- NULL, H5P_DEFAULT);
-
- if(err < 0) {
+
+ err = H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_DOUBLE, BUF_SIZE, data, NULL, H5P_DEFAULT);
+
+ if (err < 0) {
fprintf(stderr, "ERROR: Conversion failed\n");
free(data);
return err;
}
-
+
free(data);
-
}
-
-
+
/* This will emit H5Z performance information */
-
+
data = (int *)malloc(BUF_SIZE * sizeof(int));
-
- for(i = 0; i < BUF_SIZE; i++) {
+
+ for (i = 0; i < BUF_SIZE; i++) {
data[i] = i;
}
-
+
fid = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
+
pid = H5Pcreate(H5P_DATASET_CREATE);
err = H5Pset_chunk(pid, 1, chunk_sizes);
err = H5Pset_shuffle(pid);
-
+
sid = H5Screate_simple(1, dims, dims);
did = H5Dcreate2(fid, "somedata", H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT);
err = H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data);
-
+
H5Sclose(sid);
H5Dclose(did);
H5Pclose(pid);
H5Fclose(fid);
-
+
free(data);
-
+
/* Finished */
fflush(stdout);
printf("\n");
@@ -138,7 +135,6 @@ main(int argc, char **argv)
printf("\n");
remove(TESTFILE);
-
+
return 0;
}
-
diff --git a/examples/h5_drivers.c b/examples/h5_drivers.c
index 43c1fc7..486cf3b 100644
--- a/examples/h5_drivers.c
+++ b/examples/h5_drivers.c
@@ -22,13 +22,12 @@
#include "stdlib.h"
/* global variables */
-int cleanup_g = -1; /* whether to clean. Init to not set. */
+int cleanup_g = -1; /* whether to clean. Init to not set. */
/* prototypes */
void cleanup(const char *);
void split_file(void);
-
/*
* Cleanup a file unless $HDF5_NOCLEANUP is set.
*/
@@ -36,12 +35,11 @@ void
cleanup(const char *filename)
{
if (cleanup_g == -1)
- cleanup_g = getenv("HDF5_NOCLEANUP") ? 0 : 1;
+ cleanup_g = getenv("HDF5_NOCLEANUP") ? 0 : 1;
if (cleanup_g)
- remove(filename);
+ remove(filename);
}
-
/*
* This shows how to use the split file driver.
*/
@@ -55,7 +53,7 @@ split_file(void)
/* the metadata and rawdata files. */
fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT);
- fid=H5Fcreate("Station1",H5F_ACC_TRUNC,H5P_DEFAULT,fapl);
+ fid = H5Fcreate("Station1", H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
/* using the file ... */
H5Fclose(fid);
H5Pclose(fapl);
@@ -68,7 +66,7 @@ split_file(void)
/* the metadata and rawdata files. */
fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "/tmp/%s-r.h5", H5P_DEFAULT);
- fid=H5Fcreate("PointA",H5F_ACC_TRUNC,H5P_DEFAULT,fapl);
+ fid = H5Fcreate("PointA", H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
/* using the file ... */
H5Fclose(fid);
H5Pclose(fapl);
@@ -81,7 +79,7 @@ split_file(void)
/* the metadata and rawdata files. */
fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_split(fapl, NULL, H5P_DEFAULT, NULL, H5P_DEFAULT);
- fid=H5Fcreate("Measure",H5F_ACC_TRUNC,H5P_DEFAULT,fapl);
+ fid = H5Fcreate("Measure", H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
/* using the file ... */
H5Fclose(fid);
H5Pclose(fapl);
@@ -90,13 +88,12 @@ split_file(void)
cleanup("Measure.raw");
}
-
/* Main Body */
int
-main (void)
+main(void)
{
split_file();
- return(0);
+ return (0);
}
diff --git a/examples/h5_dtransform.c b/examples/h5_dtransform.c
index 99cc48e..c36a3dd 100644
--- a/examples/h5_dtransform.c
+++ b/examples/h5_dtransform.c
@@ -33,8 +33,8 @@
#include "hdf5.h"
-#define ROWS 12
-#define COLS 18
+#define ROWS 12
+#define COLS 18
/* clang-format off */
const float windchillF[ROWS][COLS] =
@@ -53,32 +53,28 @@ const float windchillF[ROWS][COLS] =
};
/* clang-format on */
-#define PRINT(array) \
-{ \
- for(i=0; i<ROWS; i++) \
- { \
- for(j=0; j<COLS; j++) \
- printf("%6.2f ", array[i][j]); \
- printf("\n"); \
- } \
-}
-
-
-
+#define PRINT(array) \
+ { \
+ for (i = 0; i < ROWS; i++) { \
+ for (j = 0; j < COLS; j++) \
+ printf("%6.2f ", array[i][j]); \
+ printf("\n"); \
+ } \
+ }
int
-main (void)
+main(void)
{
- hid_t file, dataset; /* file and dataset handles */
- hid_t dataspace; /* handles */
- hsize_t dimsf[2]; /* dataset dimensions */
+ hid_t file, dataset; /* file and dataset handles */
+ hid_t dataspace; /* handles */
+ hsize_t dimsf[2]; /* dataset dimensions */
herr_t status;
- hid_t dxpl_id_f_to_c, dxpl_id_c_to_f; /* data transform handles */
- const char* f_to_c = "(5/9.0)*(x-32)";
- const char* c_to_f = "(9/5.0)*x + 32";
- char* transform;
- float windchillC[ROWS][COLS];
- int i,j, transform_size;
+ hid_t dxpl_id_f_to_c, dxpl_id_c_to_f; /* data transform handles */
+ const char *f_to_c = "(5/9.0)*(x-32)";
+ const char *c_to_f = "(9/5.0)*x + 32";
+ char * transform;
+ float windchillC[ROWS][COLS];
+ int i, j, transform_size;
/*
* Create a new file using H5F_ACC_TRUNC access,
@@ -91,28 +87,25 @@ main (void)
* Describe the size of the array and create the data space for fixed
* size dataset.
*/
- dimsf[0] = ROWS;
- dimsf[1] = COLS;
+ dimsf[0] = ROWS;
+ dimsf[1] = COLS;
dataspace = H5Screate_simple(2, dimsf, NULL);
/*
* Create a new dataset within the file using defined dataspace and
* datatype and default dataset creation properties.
*/
- dataset = H5Dcreate2(file, "data_no_trans", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset =
+ H5Dcreate2(file, "data_no_trans", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
printf("\nOriginal Data: \n");
PRINT(windchillF);
-
-
-
-/**************** PART 1 **************/
+ /**************** PART 1 **************/
/*
* Write the data to the dataset using default transfer properties (ie, no transform set)
*/
- status = H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, windchillF);
+ status = H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, windchillF);
/* Create the dataset transfer property list */
dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER);
@@ -127,13 +120,11 @@ main (void)
printf("\nData with no write transform, but a read transform: \n");
PRINT(windchillC);
-
-/**************** PART 2 **************/
+ /**************** PART 2 **************/
/*
* Write the data to the dataset with the f_to_c transform set
*/
- status = H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
- dxpl_id_f_to_c, windchillF);
+ status = H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillF);
/* Read out the data with the default transfer list (ie, no transform set) */
H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, windchillC);
@@ -142,8 +133,7 @@ main (void)
printf("\nData with write transform, but no read transform: \n");
PRINT(windchillC);
-/************** PART 3 ***************/
-
+ /************** PART 3 ***************/
/* Create the dataset transfer property list */
dxpl_id_c_to_f = H5Pcreate(H5P_DATASET_XFER);
@@ -151,12 +141,10 @@ main (void)
/* Set the data transform to be used on the read*/
H5Pset_data_transform(dxpl_id_c_to_f, c_to_f);
-
/*
* Write the data to the dataset using the f_to_c transform
*/
- status = H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
- dxpl_id_f_to_c, windchillF);
+ status = H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillF);
/* Read the data with the c_to_f data transform */
H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillC);
@@ -165,10 +153,10 @@ main (void)
printf("\nData with both read and write data transform: \n");
PRINT(windchillC);
-/************** PART 4 **************/
+ /************** PART 4 **************/
transform_size = H5Pget_data_transform(dxpl_id_f_to_c, NULL, 0);
- transform = (char*) malloc(transform_size+1);
- H5Pget_data_transform(dxpl_id_f_to_c, transform, transform_size+1);
+ transform = (char *)malloc(transform_size + 1);
+ H5Pget_data_transform(dxpl_id_f_to_c, transform, transform_size + 1);
printf("\nTransform string (from dxpl_id_f_to_c) is: %s\n", transform);
diff --git a/examples/h5_elink_unix2win.c b/examples/h5_elink_unix2win.c
index c29e7db..44986cb 100644
--- a/examples/h5_elink_unix2win.c
+++ b/examples/h5_elink_unix2win.c
@@ -27,7 +27,6 @@
#include <stdlib.h>
#include <string.h>
-
/* "Windows to Unix" traversal function for external links
*
* Translates a filename stored in Unix format to Windows format by replacing
@@ -37,45 +36,44 @@
* Note that this may not be necessary on your system; many Windows systems can
* understand Unix paths.
*/
-static hid_t elink_unix2win_trav(const char *link_name, hid_t cur_group,
- const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id)
+static hid_t
+elink_unix2win_trav(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size,
+ hid_t lapl_id, hid_t dxpl_id)
{
- hid_t fid;
- const char *file_name;
- const char *obj_name;
- char *new_fname = NULL; /* Buffer allocated to hold Unix file path */
- ssize_t prefix_len; /* External link prefix length */
- size_t fname_len;
- size_t start_pos; /* Initial position in new_fname buffer */
- size_t x; /* Counter variable */
- hid_t ret_value = -1;
+ hid_t fid;
+ const char *file_name;
+ const char *obj_name;
+ char * new_fname = NULL; /* Buffer allocated to hold Unix file path */
+ ssize_t prefix_len; /* External link prefix length */
+ size_t fname_len;
+ size_t start_pos; /* Initial position in new_fname buffer */
+ size_t x; /* Counter variable */
+ hid_t ret_value = -1;
printf("Converting Unix path to Windows path.\n");
- if(H5Lunpack_elink_val(udata, udata_size, NULL, &file_name, &obj_name) < 0)
+ if (H5Lunpack_elink_val(udata, udata_size, NULL, &file_name, &obj_name) < 0)
goto error;
fname_len = strlen(file_name);
/* See if the external link prefix property is set */
- if((prefix_len = H5Pget_elink_prefix(lapl_id, NULL, 0)) < 0)
+ if ((prefix_len = H5Pget_elink_prefix(lapl_id, NULL, 0)) < 0)
goto error;
/* If so, prepend it to the filename. We assume that the prefix
* is in the correct format for the current file system.
*/
- if(prefix_len > 0)
- {
+ if (prefix_len > 0) {
/* Allocate a buffer to hold the filename plus prefix */
new_fname = malloc(prefix_len + fname_len + 1);
/* Copy the prefix into the buffer */
- if(H5Pget_elink_prefix(lapl_id, new_fname, (size_t)(prefix_len + 1)) < 0)
+ if (H5Pget_elink_prefix(lapl_id, new_fname, (size_t)(prefix_len + 1)) < 0)
goto error;
start_pos = prefix_len;
}
- else
- {
+ else {
/* Allocate a buffer to hold just the filename */
new_fname = malloc(fname_len + 1);
start_pos = 0;
@@ -84,9 +82,8 @@ static hid_t elink_unix2win_trav(const char *link_name, hid_t cur_group,
/* We should now copy file_name into new_fname starting at position pos.
* We'll convert '/' characters into '\' characters as we go.
*/
- for(x=0; file_name[x] != '\0'; x++)
- {
- if(file_name[x] == '/')
+ for (x = 0; file_name[x] != '\0'; x++) {
+ if (file_name[x] == '/')
new_fname[x + start_pos] = '\\';
else
new_fname[x + start_pos] = file_name[x];
@@ -94,38 +91,37 @@ static hid_t elink_unix2win_trav(const char *link_name, hid_t cur_group,
new_fname[x + start_pos] = '\0';
/* Now open the file and object within it */
- if((fid = H5Fopen(new_fname, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(new_fname, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
goto error;
ret_value = H5Oopen(fid, obj_name, lapl_id); /* If this fails, our return value will be negative. */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto error;
/* Free file name if it's been allocated */
- if(new_fname)
+ if (new_fname)
free(new_fname);
return ret_value;
error:
/* Free file name if it's been allocated */
- if(new_fname)
+ if (new_fname)
free(new_fname);
return -1;
}
const H5L_class_t elink_unix2win_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
- H5L_TYPE_EXTERNAL, /* Link type id number */
- "unix2win external link", /* Link class name for debugging */
- NULL, /* Creation callback */
- NULL, /* Move callback */
- NULL, /* Copy callback */
- elink_unix2win_trav, /* The actual traversal function */
- NULL, /* Deletion callback */
- NULL /* Query callback */
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ H5L_TYPE_EXTERNAL, /* Link type id number */
+ "unix2win external link", /* Link class name for debugging */
+ NULL, /* Creation callback */
+ NULL, /* Move callback */
+ NULL, /* Copy callback */
+ elink_unix2win_trav, /* The actual traversal function */
+ NULL, /* Deletion callback */
+ NULL /* Query callback */
}};
-
/* The example function.
* Creates a file named "unix2win.h5" with an external link pointing to
* the file "u2w/u2w_target.h5".
@@ -136,55 +132,65 @@ const H5L_class_t elink_unix2win_class[1] = {{
static int
unix2win_example(void)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
/* Create the target file. */
#ifdef H5_HAVE_WIN32_API
- if((fid=H5Fcreate("u2w\\u2w_target.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) goto error;
+ if ((fid = H5Fcreate("u2w\\u2w_target.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
#else
- if((fid=H5Fcreate("u2w/u2w_target.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) goto error;
+ if ((fid = H5Fcreate("u2w/u2w_target.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
#endif
- if(H5Fclose(fid) < 0) goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
/* Create the source file with an external link in Windows format */
- if((fid=H5Fcreate("unix2win.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) goto error;
+ if ((fid = H5Fcreate("unix2win.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
/* Create the external link */
- if(H5Lcreate_external("u2w/../u2w/u2w_target.h5", "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) goto error;
+ if (H5Lcreate_external("u2w/../u2w/u2w_target.h5", "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto error;
- /* If we are not on Windows, assume we are on a Unix-y filesystem and
- * follow the external link normally.
- * If we are on Windows, register the unix2win traversal function so
- * that external links can be traversed.
- */
+ /* If we are not on Windows, assume we are on a Unix-y filesystem and
+ * follow the external link normally.
+ * If we are on Windows, register the unix2win traversal function so
+ * that external links can be traversed.
+ */
#ifdef H5_HAVE_WIN32_API
/* Register the elink_unix2win class defined above to replace default
* external links
*/
- if(H5Lregister(elink_unix2win_class) < 0) goto error;
+ if (H5Lregister(elink_unix2win_class) < 0)
+ goto error;
#endif
/* Now follow the link */
- if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) goto error;
+ if ((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0)
+ goto error;
printf("Successfully followed external link.\n");
/* Close the group and the file */
- if(H5Gclose(gid) <0) goto error;
- if(H5Fclose(fid) <0) goto error;
+ if (H5Gclose(gid) < 0)
+ goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
return 0;
- error:
+error:
printf("Error!\n");
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
return -1;
}
-
/* Main function
*
@@ -193,12 +199,10 @@ unix2win_example(void)
int
main(void)
{
- int ret;
+ int ret;
printf("Testing unix2win external links.\n");
ret = unix2win_example();
return ret;
}
-
-
diff --git a/examples/h5_extend.c b/examples/h5_extend.c
index 6018e65..749a73a 100644
--- a/examples/h5_extend.c
+++ b/examples/h5_extend.c
@@ -18,127 +18,114 @@
* It is used in the HDF5 Tutorial.
*/
-
#include "hdf5.h"
#define FILENAME "extend.h5"
#define DATASETNAME "ExtendibleArray"
-#define RANK 2
+#define RANK 2
int
-main (void)
+main(void)
{
- hid_t file; /* handles */
- hid_t dataspace, dataset;
- hid_t filespace, memspace;
- hid_t prop;
-
- hsize_t dims[2] = {3, 3}; /* dataset dimensions at creation time */
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- herr_t status;
- hsize_t chunk_dims[2] = {2, 5};
- int data[3][3] = { {1, 1, 1}, /* data to write */
- {1, 1, 1},
- {1, 1, 1} };
+ hid_t file; /* handles */
+ hid_t dataspace, dataset;
+ hid_t filespace, memspace;
+ hid_t prop;
+
+ hsize_t dims[2] = {3, 3}; /* dataset dimensions at creation time */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ herr_t status;
+ hsize_t chunk_dims[2] = {2, 5};
+ int data[3][3] = {{1, 1, 1}, /* data to write */
+ {1, 1, 1},
+ {1, 1, 1}};
/* Variables used in extending and writing to the extended portion of dataset */
- hsize_t size[2];
- hsize_t offset[2];
- hsize_t dimsext[2] = {7, 3}; /* extend dimensions */
- int dataext[7][3] = { {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4} };
+ hsize_t size[2];
+ hsize_t offset[2];
+ hsize_t dimsext[2] = {7, 3}; /* extend dimensions */
+ int dataext[7][3] = {{2, 3, 4}, {2, 3, 4}, {2, 3, 4}, {2, 3, 4}, {2, 3, 4}, {2, 3, 4}, {2, 3, 4}};
/* Variables used in reading data back */
- hsize_t chunk_dimsr[2];
- hsize_t dimsr[2];
- hsize_t i, j;
- int rdata[10][3];
- herr_t status_n;
- int rank, rank_chunk;
+ hsize_t chunk_dimsr[2];
+ hsize_t dimsr[2];
+ hsize_t i, j;
+ int rdata[10][3];
+ herr_t status_n;
+ int rank, rank_chunk;
/* Create the data space with unlimited dimensions. */
- dataspace = H5Screate_simple (RANK, dims, maxdims);
+ dataspace = H5Screate_simple(RANK, dims, maxdims);
/* Create a new file. If file exists its contents will be overwritten. */
- file = H5Fcreate (FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Modify dataset creation properties, i.e. enable chunking */
- prop = H5Pcreate (H5P_DATASET_CREATE);
- status = H5Pset_chunk (prop, RANK, chunk_dims);
+ prop = H5Pcreate(H5P_DATASET_CREATE);
+ status = H5Pset_chunk(prop, RANK, chunk_dims);
/* Create a new dataset within the file using chunk
creation properties. */
- dataset = H5Dcreate2 (file, DATASETNAME, H5T_NATIVE_INT, dataspace,
- H5P_DEFAULT, prop, H5P_DEFAULT);
+ dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, prop, H5P_DEFAULT);
/* Write data to dataset */
- status = H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, data);
+ status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
/* Extend the dataset. Dataset becomes 10 x 3 */
- size[0] = dims[0]+ dimsext[0];
+ size[0] = dims[0] + dimsext[0];
size[1] = dims[1];
- status = H5Dset_extent (dataset, size);
+ status = H5Dset_extent(dataset, size);
/* Select a hyperslab in extended portion of dataset */
- filespace = H5Dget_space (dataset);
+ filespace = H5Dget_space(dataset);
offset[0] = 3;
offset[1] = 0;
- status = H5Sselect_hyperslab (filespace, H5S_SELECT_SET, offset, NULL,
- dimsext, NULL);
+ status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dimsext, NULL);
/* Define memory space */
- memspace = H5Screate_simple (RANK, dimsext, NULL);
+ memspace = H5Screate_simple(RANK, dimsext, NULL);
/* Write the data to the extended portion of dataset */
- status = H5Dwrite (dataset, H5T_NATIVE_INT, memspace, filespace,
- H5P_DEFAULT, dataext);
+ status = H5Dwrite(dataset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, dataext);
/* Close resources */
- status = H5Dclose (dataset);
- status = H5Pclose (prop);
- status = H5Sclose (dataspace);
- status = H5Sclose (memspace);
- status = H5Sclose (filespace);
- status = H5Fclose (file);
+ status = H5Dclose(dataset);
+ status = H5Pclose(prop);
+ status = H5Sclose(dataspace);
+ status = H5Sclose(memspace);
+ status = H5Sclose(filespace);
+ status = H5Fclose(file);
/********************************************
* Re-open the file and read the data back. *
********************************************/
- file = H5Fopen (FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
- dataset = H5Dopen2 (file, DATASETNAME, H5P_DEFAULT);
+ file = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT);
- filespace = H5Dget_space (dataset);
- rank = H5Sget_simple_extent_ndims (filespace);
- status_n = H5Sget_simple_extent_dims (filespace, dimsr, NULL);
+ filespace = H5Dget_space(dataset);
+ rank = H5Sget_simple_extent_ndims(filespace);
+ status_n = H5Sget_simple_extent_dims(filespace, dimsr, NULL);
- prop = H5Dget_create_plist (dataset);
+ prop = H5Dget_create_plist(dataset);
- if (H5D_CHUNKED == H5Pget_layout (prop))
- rank_chunk = H5Pget_chunk (prop, rank, chunk_dimsr);
+ if (H5D_CHUNKED == H5Pget_layout(prop))
+ rank_chunk = H5Pget_chunk(prop, rank, chunk_dimsr);
- memspace = H5Screate_simple (rank, dimsr, NULL);
- status = H5Dread (dataset, H5T_NATIVE_INT, memspace, filespace,
- H5P_DEFAULT, rdata);
+ memspace = H5Screate_simple(rank, dimsr, NULL);
+ status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, rdata);
printf("\n");
printf("Dataset: \n");
- for (j = 0; j < dimsr[0]; j++)
- {
- for (i = 0; i < dimsr[1]; i++)
- printf("%d ", rdata[j][i]);
- printf("\n");
+ for (j = 0; j < dimsr[0]; j++) {
+ for (i = 0; i < dimsr[1]; i++)
+ printf("%d ", rdata[j][i]);
+ printf("\n");
}
- status = H5Pclose (prop);
- status = H5Dclose (dataset);
- status = H5Sclose (filespace);
- status = H5Sclose (memspace);
- status = H5Fclose (file);
+ status = H5Pclose(prop);
+ status = H5Dclose(dataset);
+ status = H5Sclose(filespace);
+ status = H5Sclose(memspace);
+ status = H5Fclose(file);
}
diff --git a/examples/h5_extend_write.c b/examples/h5_extend_write.c
index 4abda30..ad7ef50 100644
--- a/examples/h5_extend_write.c
+++ b/examples/h5_extend_write.c
@@ -20,43 +20,42 @@
#include "hdf5.h"
-#define H5FILE_NAME "SDSextendible.h5"
+#define H5FILE_NAME "SDSextendible.h5"
#define DATASETNAME "ExtendibleArray"
-#define RANK 2
-#define NX 10
-#define NY 5
+#define RANK 2
+#define NX 10
+#define NY 5
int
-main (void)
+main(void)
{
- hid_t file; /* handles */
- hid_t dataspace, dataset;
- hid_t filespace;
- hid_t cparms;
- hsize_t dims[2] = { 3, 3}; /*
- * dataset dimensions
- * at the creation time
- */
- hsize_t dims1[2] = { 3, 3}; /* data1 dimensions */
- hsize_t dims2[2] = { 7, 1}; /* data2 dimensions */
- hsize_t dims3[2] = { 2, 2}; /* data3 dimensions */
+ hid_t file; /* handles */
+ hid_t dataspace, dataset;
+ hid_t filespace;
+ hid_t cparms;
+ hsize_t dims[2] = {3, 3}; /*
+ * dataset dimensions
+ * at the creation time
+ */
+ hsize_t dims1[2] = {3, 3}; /* data1 dimensions */
+ hsize_t dims2[2] = {7, 1}; /* data2 dimensions */
+ hsize_t dims3[2] = {2, 2}; /* data3 dimensions */
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] ={2, 5};
- hsize_t size[2];
- hsize_t offset[2];
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims[2] = {2, 5};
+ hsize_t size[2];
+ hsize_t offset[2];
- herr_t status;
+ herr_t status;
- int data1[3][3] = { {1, 1, 1}, /* data to write */
- {1, 1, 1},
- {1, 1, 1} };
+ int data1[3][3] = {{1, 1, 1}, /* data to write */
+ {1, 1, 1},
+ {1, 1, 1}};
- int data2[7] = { 2, 2, 2, 2, 2, 2, 2};
+ int data2[7] = {2, 2, 2, 2, 2, 2, 2};
- int data3[2][2] = { {3, 3},
- {3, 3} };
- int fillvalue = 0;
+ int data3[2][2] = {{3, 3}, {3, 3}};
+ int fillvalue = 0;
/*
* Create the data space with unlimited dimensions.
@@ -72,22 +71,21 @@ main (void)
* Modify dataset creation properties, i.e. enable chunking.
*/
cparms = H5Pcreate(H5P_DATASET_CREATE);
- status = H5Pset_chunk( cparms, RANK, chunk_dims);
- status = H5Pset_fill_value (cparms, H5T_NATIVE_INT, &fillvalue );
+ status = H5Pset_chunk(cparms, RANK, chunk_dims);
+ status = H5Pset_fill_value(cparms, H5T_NATIVE_INT, &fillvalue);
/*
* Create a new dataset within the file using cparms
* creation properties.
*/
- dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT);
+ dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
/*
* Extend the dataset. This call assures that dataset is at least 3 x 3.
*/
- size[0] = 3;
- size[1] = 3;
- status = H5Dset_extent(dataset, size);
+ size[0] = 3;
+ size[1] = 3;
+ status = H5Dset_extent(dataset, size);
/*
* Select a hyperslab.
@@ -95,22 +93,20 @@ main (void)
filespace = H5Dget_space(dataset);
offset[0] = 0;
offset[1] = 0;
- status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
- dims1, NULL);
+ status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dims1, NULL);
/*
* Write the data to the hyperslab.
*/
- status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace,
- H5P_DEFAULT, data1);
+ status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace, H5P_DEFAULT, data1);
/*
* Extend the dataset. Dataset becomes 10 x 3.
*/
- dims[0] = dims1[0] + dims2[0];
- size[0] = dims[0];
- size[1] = dims[1];
- status = H5Dset_extent(dataset, size);
+ dims[0] = dims1[0] + dims2[0];
+ size[0] = dims[0];
+ size[1] = dims[1];
+ status = H5Dset_extent(dataset, size);
/*
* Select a hyperslab.
@@ -118,8 +114,7 @@ main (void)
filespace = H5Dget_space(dataset);
offset[0] = 3;
offset[1] = 0;
- status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
- dims2, NULL);
+ status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dims2, NULL);
/*
* Define memory space
@@ -129,16 +124,15 @@ main (void)
/*
* Write the data to the hyperslab.
*/
- status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace,
- H5P_DEFAULT, data2);
+ status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace, H5P_DEFAULT, data2);
/*
* Extend the dataset. Dataset becomes 10 x 5.
*/
- dims[1] = dims1[1] + dims3[1];
- size[0] = dims[0];
- size[1] = dims[1];
- status = H5Dset_extent(dataset, size);
+ dims[1] = dims1[1] + dims3[1];
+ size[0] = dims[0];
+ size[1] = dims[1];
+ status = H5Dset_extent(dataset, size);
/*
* Select a hyperslab
@@ -146,8 +140,7 @@ main (void)
filespace = H5Dget_space(dataset);
offset[0] = 0;
offset[1] = 3;
- status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
- dims3, NULL);
+ status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dims3, NULL);
/*
* Define memory space.
@@ -157,8 +150,7 @@ main (void)
/*
* Write the data to the hyperslab.
*/
- status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace,
- H5P_DEFAULT, data3);
+ status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace, H5P_DEFAULT, data3);
/*
* Resulting dataset
diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c
index fea1fa2..15f76fb 100644
--- a/examples/h5_extlink.c
+++ b/examples/h5_extlink.c
@@ -26,37 +26,36 @@
#define PREFIX_SOURCE_FILE "extlink_prefix_source.h5"
-#define SOFT_LINK_FILE "soft_link.h5"
-#define SOFT_LINK_NAME "soft_link_to_group"
+#define SOFT_LINK_FILE "soft_link.h5"
+#define SOFT_LINK_NAME "soft_link_to_group"
#define UD_SOFT_LINK_NAME "ud_soft_link"
-#define TARGET_GROUP "target_group"
+#define TARGET_GROUP "target_group"
#define UD_SOFT_CLASS 65
-#define HARD_LINK_FILE "hard_link.h5"
-#define HARD_LINK_NAME "hard_link_to_group"
+#define HARD_LINK_FILE "hard_link.h5"
+#define HARD_LINK_NAME "hard_link_to_group"
#define UD_HARD_LINK_NAME "ud_hard_link"
#define UD_HARD_CLASS 66
#define PLIST_LINK_PROP "plist_link_prop"
-#define UD_PLIST_CLASS 66
+#define UD_PLIST_CLASS 66
-
-
/* Basic external link example
*
* Creates two files and uses an external link to access an object in the
* second file from the first file.
*/
-static void extlink_example(void)
+static void
+extlink_example(void)
{
hid_t source_file_id, targ_file_id;
hid_t group_id, group2_id;
/* Create two files, a source and a target */
source_file_id = H5Fcreate(SOURCE_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- targ_file_id = H5Fcreate(TARGET_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ targ_file_id = H5Fcreate(TARGET_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Create a group in the target file for the external link to point to. */
group_id = H5Gcreate2(targ_file_id, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -96,7 +95,6 @@ static void extlink_example(void)
*/
}
-
/* External link prefix example
*
* Uses a group access property list to set a "prefix" for the filenames
@@ -109,7 +107,8 @@ static void extlink_example(void)
* where it is run (so to run this example on Unix, first mkdir red and mkdir
* blue).
*/
-static void extlink_prefix_example(void)
+static void
+extlink_prefix_example(void)
{
hid_t source_file_id, red_file_id, blue_file_id;
hid_t group_id, group2_id;
@@ -119,14 +118,15 @@ static void extlink_prefix_example(void)
* the same name, but one will be located in the red directory and one will
* be located in the blue directory */
source_file_id = H5Fcreate(PREFIX_SOURCE_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- red_file_id = H5Fcreate("red/prefix_target.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- blue_file_id = H5Fcreate("blue/prefix_target.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ red_file_id = H5Fcreate("red/prefix_target.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ blue_file_id = H5Fcreate("blue/prefix_target.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* This test needs a red and a blue directory in the filesystem. If they're not present,
* trying to create the files above will fail.
*/
- if(red_file_id < 0 || blue_file_id < 0)
- printf("This test requires directories named 'red' and 'blue' to exist. Did you forget to create them?\n");
+ if (red_file_id < 0 || blue_file_id < 0)
+ printf("This test requires directories named 'red' and 'blue' to exist. Did you forget to create "
+ "them?\n");
/* Create an external link in the source file pointing to the root group of
* a file named prefix_target.h5. This file doesn't exist in the current
@@ -163,7 +163,7 @@ static void extlink_prefix_example(void)
* directory.
*/
H5Pset_elink_prefix(gapl_id, "blue/");
- group_id = H5Gopen2(source_file_id, "ext_link", gapl_id);
+ group_id = H5Gopen2(source_file_id, "ext_link", gapl_id);
group2_id = H5Gcreate2(group_id, "sky blue", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Close both groups. */
@@ -171,7 +171,7 @@ static void extlink_prefix_example(void)
H5Gclose(group_id);
/* Each file has had a group created inside it using the same external link. */
- group_id = H5Gopen2(red_file_id, "pink", H5P_DEFAULT);
+ group_id = H5Gopen2(red_file_id, "pink", H5P_DEFAULT);
group2_id = H5Gopen2(blue_file_id, "sky blue", H5P_DEFAULT);
/* Clean up our open IDs */
@@ -189,7 +189,6 @@ static void extlink_prefix_example(void)
*/
}
-
/* Soft Link example
*
* Create a new class of user-defined links that behave like HDF5's built-in
@@ -207,10 +206,11 @@ static void extlink_prefix_example(void)
* We might also have wanted to supply a creation callback that checks
* that a path was supplied in the udata.
*/
-static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group,
- const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id);
+static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size,
+ hid_t lapl_id, hid_t dxpl_id);
-static void soft_link_example(void)
+static void
+soft_link_example(void)
{
hid_t file_id;
hid_t group_id;
@@ -220,27 +220,26 @@ static void soft_link_example(void)
* callback.
*/
const H5L_class_t UD_soft_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* Version number for this struct.
- * This field is always H5L_LINK_CLASS_T_VERS */
- (H5L_type_t)UD_SOFT_CLASS, /* Link class id number. This can be any
- * value between H5L_TYPE_UD_MIN (64) and
- * H5L_TYPE_MAX (255). It should be a
- * value that isn't already being used by
- * another kind of link. We'll use 65. */
- "UD_soft_link", /* Link class name for debugging */
- NULL, /* Creation callback */
- NULL, /* Move callback */
- NULL, /* Copy callback */
- UD_soft_traverse, /* The actual traversal function */
- NULL, /* Deletion callback */
- NULL /* Query callback */
+ H5L_LINK_CLASS_T_VERS, /* Version number for this struct.
+ * This field is always H5L_LINK_CLASS_T_VERS */
+ (H5L_type_t)UD_SOFT_CLASS, /* Link class id number. This can be any
+ * value between H5L_TYPE_UD_MIN (64) and
+ * H5L_TYPE_MAX (255). It should be a
+ * value that isn't already being used by
+ * another kind of link. We'll use 65. */
+ "UD_soft_link", /* Link class name for debugging */
+ NULL, /* Creation callback */
+ NULL, /* Move callback */
+ NULL, /* Copy callback */
+ UD_soft_traverse, /* The actual traversal function */
+ NULL, /* Deletion callback */
+ NULL /* Query callback */
}};
-
/* First, create a file and an object within the file for the link to
* point to.
*/
- file_id = H5Fcreate(SOFT_LINK_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file_id = H5Fcreate(SOFT_LINK_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
group_id = H5Gcreate2(file_id, TARGET_GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Gclose(group_id);
@@ -275,12 +274,13 @@ static void soft_link_example(void)
* The actual traversal function simply needs to open the correct object by
* name and return its ID.
*/
-
-static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group,
- const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id)
+
+static hid_t
+UD_soft_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size, hid_t lapl_id,
+ hid_t dxpl_id)
{
- const char *target = (const char *) udata;
- hid_t ret_value;
+ const char *target = (const char *)udata;
+ hid_t ret_value;
/* Pass the udata straight through to HDF5. If it's invalid, let HDF5
* return an error.
@@ -289,7 +289,6 @@ static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group,
return ret_value;
}
-
/* Hard Link example
*
* Create a new class of user-defined links that behave like HDF5's built-in
@@ -305,17 +304,17 @@ static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group,
* To keep the example simple, these links don't have a query callback.
* Generally, real link classes should always be query-able.
*/
-static herr_t UD_hard_create(const char *link_name, hid_t loc_group,
- const void *udata, size_t udata_size, hid_t lcpl_id);
-static herr_t UD_hard_delete(const char *link_name, hid_t loc_group,
- const void *udata, size_t udata_size);
-static hid_t UD_hard_traverse(const char *link_name, hid_t cur_group,
- const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id);
-
-static void hard_link_example(void)
+static herr_t UD_hard_create(const char *link_name, hid_t loc_group, const void *udata, size_t udata_size,
+ hid_t lcpl_id);
+static herr_t UD_hard_delete(const char *link_name, hid_t loc_group, const void *udata, size_t udata_size);
+static hid_t UD_hard_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size,
+ hid_t lapl_id, hid_t dxpl_id);
+
+static void
+hard_link_example(void)
{
- hid_t file_id;
- hid_t group_id;
+ hid_t file_id;
+ hid_t group_id;
H5L_info2_t li;
/* Define the link class that we'll use to register "user-defined hard
* links" using the callbacks we defined above.
@@ -323,27 +322,26 @@ static void hard_link_example(void)
* callback.
*/
const H5L_class_t UD_hard_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* Version number for this struct.
- * This field is always H5L_LINK_CLASS_T_VERS */
- (H5L_type_t)UD_HARD_CLASS, /* Link class id number. This can be any
- * value between H5L_TYPE_UD_MIN (64) and
- * H5L_TYPE_MAX (255). It should be a
- * value that isn't already being used by
- * another kind of link. We'll use 66. */
- "UD_hard_link", /* Link class name for debugging */
- UD_hard_create, /* Creation callback */
- NULL, /* Move callback */
- NULL, /* Copy callback */
- UD_hard_traverse, /* The actual traversal function */
- UD_hard_delete, /* Deletion callback */
- NULL /* Query callback */
+ H5L_LINK_CLASS_T_VERS, /* Version number for this struct.
+ * This field is always H5L_LINK_CLASS_T_VERS */
+ (H5L_type_t)UD_HARD_CLASS, /* Link class id number. This can be any
+ * value between H5L_TYPE_UD_MIN (64) and
+ * H5L_TYPE_MAX (255). It should be a
+ * value that isn't already being used by
+ * another kind of link. We'll use 66. */
+ "UD_hard_link", /* Link class name for debugging */
+ UD_hard_create, /* Creation callback */
+ NULL, /* Move callback */
+ NULL, /* Copy callback */
+ UD_hard_traverse, /* The actual traversal function */
+ UD_hard_delete, /* Deletion callback */
+ NULL /* Query callback */
}};
-
/* First, create a file and an object within the file for the link to
* point to.
*/
- file_id = H5Fcreate(HARD_LINK_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file_id = H5Fcreate(HARD_LINK_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
group_id = H5Gcreate2(file_id, TARGET_GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Gclose(group_id);
@@ -366,8 +364,8 @@ static void hard_link_example(void)
/* Now create a user-defined link. We give it the group's address
* as its udata.
*/
- H5Lcreate_ud(file_id, UD_HARD_LINK_NAME, (H5L_type_t)UD_HARD_CLASS, &(li.u.token),
- sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_ud(file_id, UD_HARD_LINK_NAME, (H5L_type_t)UD_HARD_CLASS, &(li.u.token), sizeof(H5O_token_t),
+ H5P_DEFAULT, H5P_DEFAULT);
/* The UD hard link has now incremented the group's reference count
* like a normal hard link would. This means that we can unlink the
@@ -401,42 +399,39 @@ static void hard_link_example(void)
* If this function returns a negative value, the call to H5Lcreate_ud()
* will also return failure and the link will not be created.
*/
-static herr_t UD_hard_create(const char *link_name, hid_t loc_group,
- const void *udata, size_t udata_size, hid_t lcpl_id)
+static herr_t
+UD_hard_create(const char *link_name, hid_t loc_group, const void *udata, size_t udata_size, hid_t lcpl_id)
{
H5O_token_t token;
- hid_t target_obj = H5I_INVALID_HID;
- herr_t ret_value = 0;
+ hid_t target_obj = H5I_INVALID_HID;
+ herr_t ret_value = 0;
/* Make sure that the address passed in looks valid */
- if(udata_size != sizeof(H5O_token_t))
- {
- ret_value = -1;
- goto done;
+ if (udata_size != sizeof(H5O_token_t)) {
+ ret_value = -1;
+ goto done;
}
- token = *((H5O_token_t *) udata);
+ token = *((H5O_token_t *)udata);
/* Open the object this link points to so that we can increment
* its reference count. This also ensures that the token passed
* in points to a real object (although this check is not perfect!) */
target_obj = H5Oopen_by_token(loc_group, token);
- if(target_obj < 0)
- {
- ret_value = -1;
- goto done;
+ if (target_obj < 0) {
+ ret_value = -1;
+ goto done;
}
/* Increment the reference count of the target object */
- if(H5Oincr_refcount(target_obj) < 0)
- {
- ret_value = -1;
- goto done;
+ if (H5Oincr_refcount(target_obj) < 0) {
+ ret_value = -1;
+ goto done;
}
done:
/* Close the target object if we opened it */
- if(target_obj >= 0)
+ if (target_obj >= 0)
H5Oclose(target_obj);
return ret_value;
}
@@ -445,42 +440,39 @@ done:
* Since the creation function increments the object's reference count, it's
* important to decrement it again when the link is deleted.
*/
-static herr_t UD_hard_delete(const char *link_name, hid_t loc_group,
- const void *udata, size_t udata_size)
+static herr_t
+UD_hard_delete(const char *link_name, hid_t loc_group, const void *udata, size_t udata_size)
{
H5O_token_t token;
- hid_t target_obj = H5I_INVALID_HID;
- herr_t ret_value = 0;
+ hid_t target_obj = H5I_INVALID_HID;
+ herr_t ret_value = 0;
/* Sanity check; we have already verified the udata's size in the creation
* callback.
*/
- if(udata_size != sizeof(H5O_token_t))
- {
- ret_value = -1;
- goto done;
+ if (udata_size != sizeof(H5O_token_t)) {
+ ret_value = -1;
+ goto done;
}
- token = *((H5O_token_t *) udata);
+ token = *((H5O_token_t *)udata);
/* Open the object this link points to */
target_obj = H5Oopen_by_token(loc_group, token);
- if(target_obj < 0)
- {
- ret_value = -1;
- goto done;
+ if (target_obj < 0) {
+ ret_value = -1;
+ goto done;
}
/* Decrement the reference count of the target object */
- if(H5Odecr_refcount(target_obj) < 0)
- {
- ret_value = -1;
- goto done;
+ if (H5Odecr_refcount(target_obj) < 0) {
+ ret_value = -1;
+ goto done;
}
done:
/* Close the target object if we opened it */
- if(target_obj >= 0)
+ if (target_obj >= 0)
H5Oclose(target_obj);
return ret_value;
}
@@ -489,19 +481,20 @@ done:
* The actual traversal function simply needs to open the correct object and
* return its ID.
*/
-static hid_t UD_hard_traverse(const char *link_name, hid_t cur_group,
- const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id)
+static hid_t
+UD_hard_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size, hid_t lapl_id,
+ hid_t dxpl_id)
{
H5O_token_t token;
- hid_t ret_value = H5I_INVALID_HID;
+ hid_t ret_value = H5I_INVALID_HID;
/* Sanity check; we have already verified the udata's size in the creation
* callback.
*/
- if(udata_size != sizeof(H5O_token_t))
- return H5I_INVALID_HID;
+ if (udata_size != sizeof(H5O_token_t))
+ return H5I_INVALID_HID;
- token = *((H5O_token_t *) udata);
+ token = *((H5O_token_t *)udata);
/* Open the object by token. If H5Oopen_by_token fails, ret_value will
* be negative to indicate that the traversal function failed.
@@ -511,8 +504,6 @@ static hid_t UD_hard_traverse(const char *link_name, hid_t cur_group,
return ret_value;
}
-
-
/* Plist example
*
* Create a new class of user-defined links that open objects within a file
@@ -526,10 +517,11 @@ static hid_t UD_hard_traverse(const char *link_name, hid_t cur_group,
* These are defined after the example below.
* These links have no udata, so they don't need a query function.
*/
-static hid_t UD_plist_traverse(const char *link_name, hid_t cur_group,
- const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id);
+static hid_t UD_plist_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size,
+ hid_t lapl_id, hid_t dxpl_id);
-static void plist_link_example(void)
+static void
+plist_link_example(void)
{
hid_t file_id;
hid_t group_id, group2_id;
@@ -558,11 +550,10 @@ static void plist_link_example(void)
NULL /* Query callback */
}};
-
/* First, create a file and two objects within the file for the link to
* point to.
*/
- file_id = H5Fcreate(HARD_LINK_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file_id = H5Fcreate(HARD_LINK_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
group_id = H5Gcreate2(file_id, "group_1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Gclose(group_id);
group_id = H5Gcreate2(file_id, "group_1/group_2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -570,8 +561,7 @@ static void plist_link_example(void)
/* Register "plist links" and create one. It has no udata at all. */
H5Lregister(UD_plist_class);
- H5Lcreate_ud(file_id, "plist_link", (H5L_type_t)UD_PLIST_CLASS, NULL, 0,
- H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_ud(file_id, "plist_link", (H5L_type_t)UD_PLIST_CLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
/* Create a group access property list to pass in the target for the
* plist link.
@@ -617,17 +607,18 @@ static void plist_link_example(void)
/* UD_plist_traverse
* Open a path passed in through the property list.
*/
-static hid_t UD_plist_traverse(const char *link_name, hid_t cur_group,
- const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id)
+static hid_t
+UD_plist_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size, hid_t lapl_id,
+ hid_t dxpl_id)
{
- char * path;
- hid_t ret_value = H5I_INVALID_HID;
+ char *path;
+ hid_t ret_value = H5I_INVALID_HID;
/* If the link property isn't set or can't be found, traversal fails. */
- if(H5Pexist(lapl_id, PLIST_LINK_PROP) < 0)
+ if (H5Pexist(lapl_id, PLIST_LINK_PROP) < 0)
goto error;
- if(H5Pget(lapl_id, PLIST_LINK_PROP, &path) < 0)
+ if (H5Pget(lapl_id, PLIST_LINK_PROP, &path) < 0)
goto error;
/* Open the object by address. If H5Oopen_by_addr fails, ret_value will
@@ -641,13 +632,11 @@ error:
return H5I_INVALID_HID;
}
-
-
/* Main function
*
* Invokes the example functions.
*/
- int
+int
main(void)
{
printf("Testing basic external links.\n");
@@ -667,5 +656,3 @@ main(void)
return 0;
}
-
-
diff --git a/examples/h5_group.c b/examples/h5_group.c
index 75bed91..fe6405c 100644
--- a/examples/h5_group.c
+++ b/examples/h5_group.c
@@ -19,31 +19,29 @@
* in the root group and in the created group.
*/
-
#include "hdf5.h"
-
-#define H5FILE_NAME "group.h5"
-#define RANK 2
+#define H5FILE_NAME "group.h5"
+#define RANK 2
static herr_t file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo,
- void *opdata); /* Link iteration operator function */
+ void *opdata); /* Link iteration operator function */
static herr_t group_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo,
- void *opdata); /* Link iteration operator function */
+ void *opdata); /* Link iteration operator function */
int
main(void)
{
- hid_t file;
- hid_t grp;
- hid_t dataset, dataspace;
- hid_t plist;
+ hid_t file;
+ hid_t grp;
+ hid_t dataset, dataspace;
+ hid_t plist;
- herr_t status;
- hsize_t dims[2];
- hsize_t cdims[2];
+ herr_t status;
+ hsize_t dims[2];
+ hsize_t cdims[2];
- int idx_f, idx_g;
+ int idx_f, idx_g;
/*
* Create a file.
@@ -61,16 +59,16 @@ main(void)
* GZIP compression with the compression effort set to 6.
* Note that compression can be used only when dataset is chunked.
*/
- dims[0] = 1000;
- dims[1] = 20;
- cdims[0] = 20;
- cdims[1] = 20;
+ dims[0] = 1000;
+ dims[1] = 20;
+ cdims[0] = 20;
+ cdims[1] = 20;
dataspace = H5Screate_simple(RANK, dims, NULL);
plist = H5Pcreate(H5P_DATASET_CREATE);
- H5Pset_chunk(plist, 2, cdims);
- H5Pset_deflate( plist, 6);
- dataset = H5Dcreate2(file, "/Data/Compressed_Data", H5T_NATIVE_INT,
- dataspace, H5P_DEFAULT, plist, H5P_DEFAULT);
+ H5Pset_chunk(plist, 2, cdims);
+ H5Pset_deflate(plist, 6);
+ dataset =
+ H5Dcreate2(file, "/Data/Compressed_Data", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, plist, H5P_DEFAULT);
/*
* Close the first dataset .
*/
@@ -80,11 +78,11 @@ main(void)
/*
* Create the second dataset.
*/
- dims[0] = 500;
- dims[1] = 20;
+ dims[0] = 500;
+ dims[1] = 20;
dataspace = H5Screate_simple(RANK, dims, NULL);
- dataset = H5Dcreate2(file, "/Data/Float_Data", H5T_NATIVE_FLOAT,
- dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(file, "/Data/Float_Data", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
/*
*Close the second dataset and file.
@@ -105,7 +103,8 @@ main(void)
* Access "Compressed_Data" dataset in the group.
*/
dataset = H5Dopen2(grp, "Compressed_Data", H5P_DEFAULT);
- if( dataset < 0) printf(" Dataset 'Compressed-Data' is not found. \n");
+ if (dataset < 0)
+ printf(" Dataset 'Compressed-Data' is not found. \n");
printf("\"/Data/Compressed_Data\" dataset is open \n");
/*
@@ -123,7 +122,8 @@ main(void)
* hard link "Data_new".
*/
dataset = H5Dopen2(file, "/Data_new/Compressed_Data", H5P_DEFAULT);
- if( dataset < 0) printf(" Dataset is not found. \n");
+ if (dataset < 0)
+ printf(" Dataset is not found. \n");
printf("\"/Data_new/Compressed_Data\" dataset is open \n");
/*
@@ -131,7 +131,6 @@ main(void)
*/
status = H5Dclose(dataset);
-
/*
* Use iterator to see the names of the objects in the root group.
*/
@@ -141,10 +140,10 @@ main(void)
* Unlink name "Data" and use iterator to see the names
* of the objects in the file root direvtory.
*/
- if(H5Ldelete(file, "Data", H5P_DEFAULT) < 0)
- printf(" H5Ldelete failed \n");
+ if (H5Ldelete(file, "Data", H5P_DEFAULT) < 0)
+ printf(" H5Ldelete failed \n");
else
- printf("\"Data\" is unlinked \n");
+ printf("\"Data\" is unlinked \n");
idx_f = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL);
@@ -152,7 +151,8 @@ main(void)
* Use iterator to see the names of the objects in the group
* /Data_new.
*/
- idx_g = H5Literate_by_name2(grp, "/Data_new", H5_INDEX_NAME, H5_ITER_INC, NULL, group_info, NULL, H5P_DEFAULT);
+ idx_g = H5Literate_by_name2(grp, "/Data_new", H5_INDEX_NAME, H5_ITER_INC, NULL, group_info, NULL,
+ H5P_DEFAULT);
/*
* Close the file.
@@ -173,7 +173,7 @@ file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata
/* avoid compiler warnings */
loc_id = loc_id;
opdata = opdata;
- linfo = linfo;
+ linfo = linfo;
/*
* Display group name. The name is passed to the function by
@@ -184,23 +184,22 @@ file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata
return 0;
}
-
/*
* Operator function.
*/
static herr_t
group_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata)
{
- hid_t did; /* dataset identifier */
- hid_t tid; /* datatype identifier */
+ hid_t did; /* dataset identifier */
+ hid_t tid; /* datatype identifier */
H5T_class_t t_class;
- hid_t pid; /* data_property identifier */
- hsize_t chunk_dims_out[2];
- int rank_chunk;
+ hid_t pid; /* data_property identifier */
+ hsize_t chunk_dims_out[2];
+ int rank_chunk;
/* avoid warnings */
opdata = opdata;
- linfo = linfo;
+ linfo = linfo;
/*
* Open the datasets using their names.
@@ -215,38 +214,37 @@ group_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdat
/*
* Display dataset information.
*/
- tid = H5Dget_type(did); /* get datatype*/
+ tid = H5Dget_type(did); /* get datatype*/
pid = H5Dget_create_plist(did); /* get creation property list */
/*
* Check if dataset is chunked.
*/
- if(H5D_CHUNKED == H5Pget_layout(pid)) {
+ if (H5D_CHUNKED == H5Pget_layout(pid)) {
/*
* get chunking information: rank and dimensions.
*/
rank_chunk = H5Pget_chunk(pid, 2, chunk_dims_out);
- printf("chunk rank %d, dimensions %lu x %lu\n", rank_chunk,
- (unsigned long)(chunk_dims_out[0]),
- (unsigned long)(chunk_dims_out[1]));
+ printf("chunk rank %d, dimensions %lu x %lu\n", rank_chunk, (unsigned long)(chunk_dims_out[0]),
+ (unsigned long)(chunk_dims_out[1]));
}
else {
t_class = H5Tget_class(tid);
- if(t_class < 0) {
+ if (t_class < 0) {
puts(" Invalid datatype.\n");
}
else {
- if(t_class == H5T_INTEGER)
+ if (t_class == H5T_INTEGER)
puts(" Datatype is 'H5T_NATIVE_INTEGER'.\n");
- if(t_class == H5T_FLOAT)
+ if (t_class == H5T_FLOAT)
puts(" Datatype is 'H5T_NATIVE_FLOAT'.\n");
- if(t_class == H5T_STRING)
+ if (t_class == H5T_STRING)
puts(" Datatype is 'H5T_NATIVE_STRING'.\n");
- if(t_class == H5T_BITFIELD)
+ if (t_class == H5T_BITFIELD)
puts(" Datatype is 'H5T_NATIVE_BITFIELD'.\n");
- if(t_class == H5T_OPAQUE)
+ if (t_class == H5T_OPAQUE)
puts(" Datatype is 'H5T_NATIVE_OPAQUE'.\n");
- if(t_class == H5T_COMPOUND)
+ if (t_class == H5T_COMPOUND)
puts(" Datatype is 'H5T_NATIVE_COMPOUND'.\n");
}
}
@@ -256,4 +254,3 @@ group_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdat
H5Tclose(tid);
return 0;
}
-
diff --git a/examples/h5_interm_group.c b/examples/h5_interm_group.c
index 6507fd1..a103ea1 100644
--- a/examples/h5_interm_group.c
+++ b/examples/h5_interm_group.c
@@ -16,27 +16,24 @@
* all intermediate groups.
*/
-
#include "hdf5.h"
-
-#define H5FILE_NAME "interm_group.h5"
-#define TRUE 1
-#define FALSE 0
+#define H5FILE_NAME "interm_group.h5"
+#define TRUE 1
+#define FALSE 0
int
main(void)
{
- hid_t file;
- hid_t g1_id, g2_id, g3_id;
- hid_t grp_crt_plist;
+ hid_t file;
+ hid_t g1_id, g2_id, g3_id;
+ hid_t grp_crt_plist;
H5G_info_t g2_info;
- char name[3];
-
- herr_t status;
- int i;
+ char name[3];
+ herr_t status;
+ int i;
/*
* Create a file using the default properties.
@@ -59,53 +56,44 @@ main(void)
/*
* Check if group /G1 exists in the file.
*/
- if(H5Lexists(file, "/G1", H5P_DEFAULT) !=FALSE)
- printf("Group /G1 exists in the file\n");
+ if (H5Lexists(file, "/G1", H5P_DEFAULT) != FALSE)
+ printf("Group /G1 exists in the file\n");
/*
* Check that group G2/G3 exists in /G1 and if not create it using
* intermediate group creation property.
*/
g1_id = H5Gopen2(file, "/G1", H5P_DEFAULT);
-/* Next commented call causes error stack to be printed out; the next one
- * works fine; is it a bug or a feature? EIP 04-25-07
-*/
-/* if (H5Lexists(g1_id, "G2/G3", H5P_DEFAULT) !=TRUE) { */
- if (H5Lexists(g1_id, "G2", H5P_DEFAULT) !=TRUE) {
-
- grp_crt_plist = H5Pcreate(H5P_LINK_CREATE);
-
- /* Set flag for intermediate group creation */
- status = H5Pset_create_intermediate_group(grp_crt_plist, TRUE);
- g3_id = H5Gcreate2(g1_id, "G2/G3", grp_crt_plist, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(g3_id);
+ /* Next commented call causes error stack to be printed out; the next one
+ * works fine; is it a bug or a feature? EIP 04-25-07
+ */
+ /* if (H5Lexists(g1_id, "G2/G3", H5P_DEFAULT) !=TRUE) { */
+ if (H5Lexists(g1_id, "G2", H5P_DEFAULT) != TRUE) {
+
+ grp_crt_plist = H5Pcreate(H5P_LINK_CREATE);
+
+ /* Set flag for intermediate group creation */
+ status = H5Pset_create_intermediate_group(grp_crt_plist, TRUE);
+ g3_id = H5Gcreate2(g1_id, "G2/G3", grp_crt_plist, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(g3_id);
}
H5Gclose(g1_id);
-
/* Now check if group /G1/G2 exists in the file, then open it and print
* its members names
*/
if (H5Lexists(file, "/G1/G2", H5P_DEFAULT)) {
- g2_id = H5Gopen2(file, "/G1/G2", H5P_DEFAULT);
- status = H5Gget_info(g2_id, &g2_info);
- printf("Group /G1/G2 has %d member(s)\n", (int)g2_info.nlinks);
+ g2_id = H5Gopen2(file, "/G1/G2", H5P_DEFAULT);
+ status = H5Gget_info(g2_id, &g2_info);
+ printf("Group /G1/G2 has %d member(s)\n", (int)g2_info.nlinks);
- for (i=0; i < (int)g2_info.nlinks; i++) {
- H5Lget_name_by_idx(g2_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)i,
- name, 3, H5P_DEFAULT);
- printf("Object's name is %s\n", name);
-
- }
- H5Gclose(g2_id);
+ for (i = 0; i < (int)g2_info.nlinks; i++) {
+ H5Lget_name_by_idx(g2_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)i, name, 3, H5P_DEFAULT);
+ printf("Object's name is %s\n", name);
+ }
+ H5Gclose(g2_id);
}
H5Fclose(file);
return 0;
}
-
-
-
-
-
-
diff --git a/examples/h5_mount.c b/examples/h5_mount.c
index a2e16c5..c1b63cf 100644
--- a/examples/h5_mount.c
+++ b/examples/h5_mount.c
@@ -25,107 +25,105 @@
#define FILE2 "mount2.h5"
#define RANK 2
-#define NX 4
-#define NY 5
+#define NX 4
+#define NY 5
-int main(void)
+int
+main(void)
{
- hid_t fid1, fid2, gid; /* Files and group identifiers */
- hid_t did, tid, sid; /* Dataset and datatype identifiers */
-
- herr_t status;
- hsize_t dims[] = {NX,NY}; /* Dataset dimensions */
-
- int i, j;
- int bm[NX][NY], bm_out[NX][NY]; /* Data buffers */
-
- /*
- * Initialization of buffer matrix "bm"
- */
- for(i =0; i < NX; i++)
- for(j = 0; j < NY; j++)
- bm[i][j] = i + j;
-
- /*
- * Create first file and a group in it.
- */
- fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- gid = H5Gcreate2(fid1, "/G", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-
- /*
- * Close group and file
- */
- H5Gclose(gid);
- H5Fclose(fid1);
-
- /*
- * Create second file and dataset "D" in it.
- */
- fid2 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- dims[0] = NX;
- dims[1] = NY;
- sid = H5Screate_simple(RANK, dims, NULL);
- did = H5Dcreate2(fid2, "D", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-
- /*
- * Write data to the dataset.
- */
- status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, bm);
-
- /*
- * Close all identifiers.
- */
- H5Sclose(sid);
- H5Dclose(did);
- H5Fclose(fid2);
-
- /*
- * Reopen both files
- */
- fid1 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
- fid2 = H5Fopen(FILE2, H5F_ACC_RDONLY, H5P_DEFAULT);
-
- /*
- * Mount second file under G in the first file.
- */
- H5Fmount(fid1, "/G", fid2, H5P_DEFAULT);
-
- /*
- * Access dataset D in the first file under /G/D name.
- */
- did = H5Dopen2(fid1, "/G/D", H5P_DEFAULT);
- tid = H5Dget_type(did);
- status = H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, bm_out);
-
- /*
- * Print out the data.
- */
- for(i=0; i<NX; i++){
- for(j=0; j<NY; j++)
- printf(" %d", bm_out[i][j]);
- printf("\n");
- }
-
- /*
- * Close all identifers
- */
- H5Tclose(tid);
- H5Dclose(did);
-
- /*
- * Unmounting second file
- */
- H5Funmount(fid1, "/G");
-
- /*
- * Close both files
- */
- H5Fclose(fid1);
- H5Fclose(fid2);
-
- return 0;
+ hid_t fid1, fid2, gid; /* Files and group identifiers */
+ hid_t did, tid, sid; /* Dataset and datatype identifiers */
+
+ herr_t status;
+ hsize_t dims[] = {NX, NY}; /* Dataset dimensions */
+
+ int i, j;
+ int bm[NX][NY], bm_out[NX][NY]; /* Data buffers */
+
+ /*
+ * Initialization of buffer matrix "bm"
+ */
+ for (i = 0; i < NX; i++)
+ for (j = 0; j < NY; j++)
+ bm[i][j] = i + j;
+
+ /*
+ * Create first file and a group in it.
+ */
+ fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ gid = H5Gcreate2(fid1, "/G", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Close group and file
+ */
+ H5Gclose(gid);
+ H5Fclose(fid1);
+
+ /*
+ * Create second file and dataset "D" in it.
+ */
+ fid2 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = NX;
+ dims[1] = NY;
+ sid = H5Screate_simple(RANK, dims, NULL);
+ did = H5Dcreate2(fid2, "D", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Write data to the dataset.
+ */
+ status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, bm);
+
+ /*
+ * Close all identifiers.
+ */
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Fclose(fid2);
+
+ /*
+ * Reopen both files
+ */
+ fid1 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
+ fid2 = H5Fopen(FILE2, H5F_ACC_RDONLY, H5P_DEFAULT);
+
+ /*
+ * Mount second file under G in the first file.
+ */
+ H5Fmount(fid1, "/G", fid2, H5P_DEFAULT);
+
+ /*
+ * Access dataset D in the first file under /G/D name.
+ */
+ did = H5Dopen2(fid1, "/G/D", H5P_DEFAULT);
+ tid = H5Dget_type(did);
+ status = H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, bm_out);
+
+ /*
+ * Print out the data.
+ */
+ for (i = 0; i < NX; i++) {
+ for (j = 0; j < NY; j++)
+ printf(" %d", bm_out[i][j]);
+ printf("\n");
+ }
+
+ /*
+ * Close all identifers
+ */
+ H5Tclose(tid);
+ H5Dclose(did);
+
+ /*
+ * Unmounting second file
+ */
+ H5Funmount(fid1, "/G");
+
+ /*
+ * Close both files
+ */
+ H5Fclose(fid1);
+ H5Fclose(fid2);
+
+ return 0;
}
-
-
-
diff --git a/examples/h5_rdwt.c b/examples/h5_rdwt.c
index f7196c0..c576cc9 100644
--- a/examples/h5_rdwt.c
+++ b/examples/h5_rdwt.c
@@ -19,33 +19,33 @@
#include "hdf5.h"
#define FILE "dset.h5"
-int main() {
+int
+main()
+{
- hid_t file_id, dataset_id; /* identifiers */
- herr_t status;
- int i, j, dset_data[4][6];
+ hid_t file_id, dataset_id; /* identifiers */
+ herr_t status;
+ int i, j, dset_data[4][6];
- /* Initialize the dataset. */
- for (i = 0; i < 4; i++)
- for (j = 0; j < 6; j++)
- dset_data[i][j] = i * 6 + j + 1;
+ /* Initialize the dataset. */
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 6; j++)
+ dset_data[i][j] = i * 6 + j + 1;
- /* Open an existing file. */
- file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ /* Open an existing file. */
+ file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);
- /* Open an existing dataset. */
- dataset_id = H5Dopen2(file_id, "/dset", H5P_DEFAULT);
+ /* Open an existing dataset. */
+ dataset_id = H5Dopen2(file_id, "/dset", H5P_DEFAULT);
- /* Write the dataset. */
- status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- dset_data);
+ /* Write the dataset. */
+ status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data);
- status = H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- dset_data);
+ status = H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data);
- /* Close the dataset. */
- status = H5Dclose(dataset_id);
+ /* Close the dataset. */
+ status = H5Dclose(dataset_id);
- /* Close the file. */
- status = H5Fclose(file_id);
+ /* Close the file. */
+ status = H5Fclose(file_id);
}
diff --git a/examples/h5_read.c b/examples/h5_read.c
index 7fd8ad4..b3f2492 100644
--- a/examples/h5_read.c
+++ b/examples/h5_read.c
@@ -20,71 +20,73 @@
#include "hdf5.h"
-#define H5FILE_NAME "SDS.h5"
+#define H5FILE_NAME "SDS.h5"
#define DATASETNAME "IntArray"
-#define NX_SUB 3 /* hyperslab dimensions */
-#define NY_SUB 4
-#define NX 7 /* output buffer dimensions */
-#define NY 7
-#define NZ 3
-#define RANK 2
-#define RANK_OUT 3
+#define NX_SUB 3 /* hyperslab dimensions */
+#define NY_SUB 4
+#define NX 7 /* output buffer dimensions */
+#define NY 7
+#define NZ 3
+#define RANK 2
+#define RANK_OUT 3
int
-main (void)
+main(void)
{
- hid_t file, dataset; /* handles */
+ hid_t file, dataset; /* handles */
hid_t datatype, dataspace;
hid_t memspace;
- H5T_class_t t_class; /* data type class */
- H5T_order_t order; /* data order */
- size_t size; /*
- * size of the data element
- * stored in file
- */
- hsize_t dimsm[3]; /* memory space dimensions */
- hsize_t dims_out[2]; /* dataset dimensions */
- herr_t status;
-
- int data_out[NX][NY][NZ ]; /* output buffer */
-
- hsize_t count[2]; /* size of the hyperslab in the file */
- hsize_t offset[2]; /* hyperslab offset in the file */
- hsize_t count_out[3]; /* size of the hyperslab in memory */
- hsize_t offset_out[3]; /* hyperslab offset in memory */
- int i, j, k, status_n, rank;
+ H5T_class_t t_class; /* data type class */
+ H5T_order_t order; /* data order */
+ size_t size; /*
+ * size of the data element
+ * stored in file
+ */
+ hsize_t dimsm[3]; /* memory space dimensions */
+ hsize_t dims_out[2]; /* dataset dimensions */
+ herr_t status;
+
+ int data_out[NX][NY][NZ]; /* output buffer */
+
+ hsize_t count[2]; /* size of the hyperslab in the file */
+ hsize_t offset[2]; /* hyperslab offset in the file */
+ hsize_t count_out[3]; /* size of the hyperslab in memory */
+ hsize_t offset_out[3]; /* hyperslab offset in memory */
+ int i, j, k, status_n, rank;
for (j = 0; j < NX; j++) {
- for (i = 0; i < NY; i++) {
- for (k = 0; k < NZ ; k++)
- data_out[j][i][k] = 0;
- }
+ for (i = 0; i < NY; i++) {
+ for (k = 0; k < NZ; k++)
+ data_out[j][i][k] = 0;
+ }
}
/*
* Open the file and the dataset.
*/
- file = H5Fopen(H5FILE_NAME, H5F_ACC_RDONLY, H5P_DEFAULT);
+ file = H5Fopen(H5FILE_NAME, H5F_ACC_RDONLY, H5P_DEFAULT);
dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT);
/*
* Get datatype and dataspace handles and then query
* dataset class, order, size, rank and dimensions.
*/
- datatype = H5Dget_type(dataset); /* datatype handle */
- t_class = H5Tget_class(datatype);
- if (t_class == H5T_INTEGER) printf("Data set has INTEGER type \n");
- order = H5Tget_order(datatype);
- if (order == H5T_ORDER_LE) printf("Little endian order \n");
-
- size = H5Tget_size(datatype);
+ datatype = H5Dget_type(dataset); /* datatype handle */
+ t_class = H5Tget_class(datatype);
+ if (t_class == H5T_INTEGER)
+ printf("Data set has INTEGER type \n");
+ order = H5Tget_order(datatype);
+ if (order == H5T_ORDER_LE)
+ printf("Little endian order \n");
+
+ size = H5Tget_size(datatype);
printf(" Data size is %d \n", (int)size);
- dataspace = H5Dget_space(dataset); /* dataspace handle */
+ dataspace = H5Dget_space(dataset); /* dataspace handle */
rank = H5Sget_simple_extent_ndims(dataspace);
status_n = H5Sget_simple_extent_dims(dataspace, dims_out, NULL);
- printf("rank %d, dimensions %lu x %lu \n", rank,
- (unsigned long)(dims_out[0]), (unsigned long)(dims_out[1]));
+ printf("rank %d, dimensions %lu x %lu \n", rank, (unsigned long)(dims_out[0]),
+ (unsigned long)(dims_out[1]));
/*
* Define hyperslab in the dataset.
@@ -93,16 +95,15 @@ main (void)
offset[1] = 2;
count[0] = NX_SUB;
count[1] = NY_SUB;
- status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, NULL,
- count, NULL);
+ status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, NULL, count, NULL);
/*
* Define the memory dataspace.
*/
dimsm[0] = NX;
dimsm[1] = NY;
- dimsm[2] = NZ ;
- memspace = H5Screate_simple(RANK_OUT,dimsm,NULL);
+ dimsm[2] = NZ;
+ memspace = H5Screate_simple(RANK_OUT, dimsm, NULL);
/*
* Define memory hyperslab.
@@ -113,18 +114,17 @@ main (void)
count_out[0] = NX_SUB;
count_out[1] = NY_SUB;
count_out[2] = 1;
- status = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, offset_out, NULL,
- count_out, NULL);
+ status = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, offset_out, NULL, count_out, NULL);
/*
* Read data from hyperslab in the file into the hyperslab in
* memory and display.
*/
- status = H5Dread(dataset, H5T_NATIVE_INT, memspace, dataspace,
- H5P_DEFAULT, data_out);
+ status = H5Dread(dataset, H5T_NATIVE_INT, memspace, dataspace, H5P_DEFAULT, data_out);
for (j = 0; j < NX; j++) {
- for (i = 0; i < NY; i++) printf("%d ", data_out[j][i][0]);
- printf("\n");
+ for (i = 0; i < NY; i++)
+ printf("%d ", data_out[j][i][0]);
+ printf("\n");
}
/*
* 0 0 0 0 0 0 0
diff --git a/examples/h5_ref2reg_deprec.c b/examples/h5_ref2reg_deprec.c
index dc2964c..58b3095 100644
--- a/examples/h5_ref2reg_deprec.c
+++ b/examples/h5_ref2reg_deprec.c
@@ -26,33 +26,34 @@
#include "hdf5.h"
-#define filename "REF_REG.h5"
+#define filename "REF_REG.h5"
#define dsetnamev "MATRIX"
#define dsetnamer "REGION_REFERENCES"
-int main(void)
+int
+main(void)
{
- hid_t file_id; /* file identifier */
- hid_t space_id; /* dataspace identifiers */
- hid_t spacer_id;
- hid_t dsetv_id; /*dataset identifiers*/
- hid_t dsetr_id;
- hsize_t dims[2] = {2,9};
- hsize_t dimsr[1] = {2};
- int rank = 2;
- int rankr =1;
- herr_t status;
+ hid_t file_id; /* file identifier */
+ hid_t space_id; /* dataspace identifiers */
+ hid_t spacer_id;
+ hid_t dsetv_id; /*dataset identifiers*/
+ hid_t dsetr_id;
+ hsize_t dims[2] = {2, 9};
+ hsize_t dimsr[1] = {2};
+ int rank = 2;
+ int rankr = 1;
+ herr_t status;
hdset_reg_ref_t ref[2];
hdset_reg_ref_t ref_out[2];
- int data[2][9] = {{1,1,2,3,3,4,5,5,6},{1,2,2,3,4,4,5,6,6}};
- int data_out[2][9] = {{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0}};
- hsize_t start[2];
- hsize_t count[2];
- hsize_t coord[2][3] = {{0, 0, 1}, {6, 0, 8}};
- unsigned num_points = 3;
- int i, j;
- size_t name_size1, name_size2;
- char buf1[10], buf2[10];
+ int data[2][9] = {{1, 1, 2, 3, 3, 4, 5, 5, 6}, {1, 2, 2, 3, 4, 4, 5, 6, 6}};
+ int data_out[2][9] = {{0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}};
+ hsize_t start[2];
+ hsize_t count[2];
+ hsize_t coord[2][3] = {{0, 0, 1}, {6, 0, 8}};
+ unsigned num_points = 3;
+ int i, j;
+ size_t name_size1, name_size2;
+ char buf1[10], buf2[10];
/*
* Create file with default file access and file creation properties.
@@ -62,24 +63,26 @@ int main(void)
/*
* Create dataspace for datasets.
*/
- space_id = H5Screate_simple(rank, dims, NULL);
+ space_id = H5Screate_simple(rank, dims, NULL);
spacer_id = H5Screate_simple(rankr, dimsr, NULL);
/*
* Create integer dataset.
*/
- dsetv_id = H5Dcreate2(file_id, dsetnamev, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dsetv_id =
+ H5Dcreate2(file_id, dsetnamev, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
* Write data to the dataset.
*/
- status = H5Dwrite(dsetv_id, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data);
+ status = H5Dwrite(dsetv_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
status = H5Dclose(dsetv_id);
/*
* Dataset with references.
*/
- dsetr_id = H5Dcreate2(file_id, dsetnamer, H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dsetr_id =
+ H5Dcreate2(file_id, dsetnamer, H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
* Create a reference to the hyperslab.
@@ -88,8 +91,8 @@ int main(void)
start[1] = 3;
count[0] = 2;
count[1] = 3;
- status = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start, NULL, count, NULL);
- status = H5Rcreate(&ref[0], file_id, dsetnamev, H5R_DATASET_REGION, space_id);
+ status = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start, NULL, count, NULL);
+ status = H5Rcreate(&ref[0], file_id, dsetnamev, H5R_DATASET_REGION, space_id);
/*
* Create a reference to elements selection.
@@ -101,7 +104,7 @@ int main(void)
/*
* Write dataset with the references.
*/
- status = H5Dwrite(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT,ref);
+ status = H5Dwrite(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref);
/*
* Close all objects.
@@ -114,7 +117,7 @@ int main(void)
/*
* Reopen the file to read selections back.
*/
- file_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
+ file_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
/*
* Reopen the dataset with object references and read references
@@ -122,8 +125,7 @@ int main(void)
*/
dsetr_id = H5Dopen2(file_id, dsetnamer, H5P_DEFAULT);
- status = H5Dread(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, ref_out);
+ status = H5Dread(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_out);
/*
* Dereference the first reference.
@@ -133,26 +135,26 @@ int main(void)
* Get name of the dataset the first region reference points to
* using H5Rget_name
*/
- name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], (char*)buf1, 10);
- printf(" Dataset's name (returned by H5Rget_name) the reference points to is %s, name length is %d\n", buf1, (int)name_size1);
+ name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], (char *)buf1, 10);
+ printf(" Dataset's name (returned by H5Rget_name) the reference points to is %s, name length is %d\n",
+ buf1, (int)name_size1);
/*
* Get name of the dataset the first region reference points to
* using H5Iget_name
*/
- name_size2 = H5Iget_name(dsetv_id, (char*)buf2, 10);
- printf(" Dataset's name (returned by H5Iget_name) the reference points to is %s, name length is %d\n", buf2, (int)name_size2);
+ name_size2 = H5Iget_name(dsetv_id, (char *)buf2, 10);
+ printf(" Dataset's name (returned by H5Iget_name) the reference points to is %s, name length is %d\n",
+ buf2, (int)name_size2);
- space_id = H5Rget_region(dsetr_id, H5R_DATASET_REGION,&ref_out[0]);
+ space_id = H5Rget_region(dsetr_id, H5R_DATASET_REGION, &ref_out[0]);
/*
* Read and display hyperslab selection from the dataset.
*/
- status = H5Dread(dsetv_id, H5T_NATIVE_INT, H5S_ALL, space_id,
- H5P_DEFAULT, data_out);
+ status = H5Dread(dsetv_id, H5T_NATIVE_INT, H5S_ALL, space_id, H5P_DEFAULT, data_out);
printf("Selected hyperslab: ");
- for (i = 0; i <= 1; i++)
- {
+ for (i = 0; i <= 1; i++) {
printf("\n");
for (j = 0; j <= 8; j++)
printf("%d ", data_out[i][j]);
@@ -176,17 +178,15 @@ int main(void)
* Dereference the second reference.
*/
dsetv_id = H5Rdereference2(dsetr_id, H5P_DEFAULT, H5R_DATASET_REGION, &ref_out[1]);
- space_id = H5Rget_region(dsetv_id, H5R_DATASET_REGION,&ref_out[1]);
+ space_id = H5Rget_region(dsetv_id, H5R_DATASET_REGION, &ref_out[1]);
/*
* Read selected data from the dataset.
*/
- status = H5Dread(dsetv_id, H5T_NATIVE_INT, H5S_ALL, space_id,
- H5P_DEFAULT, data_out);
+ status = H5Dread(dsetv_id, H5T_NATIVE_INT, H5S_ALL, space_id, H5P_DEFAULT, data_out);
printf("Selected points: ");
- for (i = 0; i <= 1; i++)
- {
+ for (i = 0; i <= 1; i++) {
printf("\n");
for (j = 0; j <= 8; j++)
printf("%d ", data_out[i][j]);
@@ -203,6 +203,3 @@ int main(void)
return 0;
}
-
-
-
diff --git a/examples/h5_ref_compat.c b/examples/h5_ref_compat.c
index a1fbf96..a47a14b 100644
--- a/examples/h5_ref_compat.c
+++ b/examples/h5_ref_compat.c
@@ -10,12 +10,12 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
- /*
- * The example below illustrates the use of the new API with a file that was
- * written using the old-style reference API, showing how one can take
- * advantage of the automatic type conversion from old reference type to new
- * reference type.
- */
+/*
+ * The example below illustrates the use of the new API with a file that was
+ * written using the old-style reference API, showing how one can take
+ * advantage of the automatic type conversion from old reference type to new
+ * reference type.
+ */
#include <stdlib.h>
@@ -24,22 +24,23 @@
#define H5FILE_NAME "refer_deprec.h5"
-#define NDIMS 1 /* Number of dimensions */
-#define BUF_SIZE 4 /* Size of example buffer */
-#define NREFS 1 /* Number of references */
+#define NDIMS 1 /* Number of dimensions */
+#define BUF_SIZE 4 /* Size of example buffer */
+#define NREFS 1 /* Number of references */
int
-main(void) {
- hid_t file1, dset1, space1;
- hsize_t dset1_dims[NDIMS] = { BUF_SIZE };
- int dset_buf[BUF_SIZE];
-
- hid_t dset2, space2;
- hsize_t dset2_dims[NDIMS] = { NREFS };
- hobj_ref_t ref_buf[NREFS] = { 0 };
- H5R_ref_t new_ref_buf[NREFS] = { 0 };
+main(void)
+{
+ hid_t file1, dset1, space1;
+ hsize_t dset1_dims[NDIMS] = {BUF_SIZE};
+ int dset_buf[BUF_SIZE];
+
+ hid_t dset2, space2;
+ hsize_t dset2_dims[NDIMS] = {NREFS};
+ hobj_ref_t ref_buf[NREFS] = {0};
+ H5R_ref_t new_ref_buf[NREFS] = {0};
H5O_type_t obj_type;
- int i;
+ int i;
for (i = 0; i < BUF_SIZE; i++)
dset_buf[i] = i;
@@ -48,8 +49,7 @@ main(void) {
file1 = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
space1 = H5Screate_simple(NDIMS, dset1_dims, NULL);
- dset1 = H5Dcreate2(file1, "dataset1", H5T_NATIVE_INT, space1, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ dset1 = H5Dcreate2(file1, "dataset1", H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_buf);
H5Dclose(dset1);
H5Sclose(space1);
@@ -62,7 +62,7 @@ main(void) {
/* Store reference in separate dataset using deprecated reference type */
space2 = H5Screate_simple(NDIMS, dset2_dims, NULL);
- dset2 = H5Dcreate2(file1, "references", H5T_STD_REF_OBJ, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dset2 = H5Dcreate2(file1, "references", H5T_STD_REF_OBJ, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dset2, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_buf);
H5Dclose(dset2);
H5Sclose(space2);
@@ -87,4 +87,3 @@ main(void) {
assert(dset_buf[i] == i);
return 0;
}
-
diff --git a/examples/h5_ref_extern.c b/examples/h5_ref_extern.c
index 5403814..283af95 100644
--- a/examples/h5_ref_extern.c
+++ b/examples/h5_ref_extern.c
@@ -10,12 +10,12 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
- /*
- * The example below illustrates the use of the new API with files that are
- * opened read-only. Created references to the objects in that file are
- * stored into a separate file, and accessed from that file, without the user
- * explicitly opening the original file that was referenced.
- */
+/*
+ * The example below illustrates the use of the new API with files that are
+ * opened read-only. Created references to the objects in that file are
+ * stored into a separate file, and accessed from that file, without the user
+ * explicitly opening the original file that was referenced.
+ */
#include <stdlib.h>
@@ -25,30 +25,30 @@
#define H5FILE_NAME1 "refer_extern1.h5"
#define H5FILE_NAME2 "refer_extern2.h5"
-#define NDIMS 1 /* Number of dimensions */
-#define BUF_SIZE 4 /* Size of example buffer */
-#define NREFS 1 /* Number of references */
+#define NDIMS 1 /* Number of dimensions */
+#define BUF_SIZE 4 /* Size of example buffer */
+#define NREFS 1 /* Number of references */
int
-main(void) {
- hid_t file1, dset1, space1;
- hsize_t dset1_dims[NDIMS] = { BUF_SIZE };
- int dset_buf[BUF_SIZE];
-
- hid_t file2, dset2, space2;
- hsize_t dset2_dims[NDIMS] = { NREFS };
- H5R_ref_t ref_buf[NREFS] = { 0 };
+main(void)
+{
+ hid_t file1, dset1, space1;
+ hsize_t dset1_dims[NDIMS] = {BUF_SIZE};
+ int dset_buf[BUF_SIZE];
+
+ hid_t file2, dset2, space2;
+ hsize_t dset2_dims[NDIMS] = {NREFS};
+ H5R_ref_t ref_buf[NREFS] = {0};
H5O_type_t obj_type;
- int i;
+ int i;
for (i = 0; i < BUF_SIZE; i++)
dset_buf[i] = i;
/* Create file with one dataset and close it */
- file1 = H5Fcreate(H5FILE_NAME1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file1 = H5Fcreate(H5FILE_NAME1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
space1 = H5Screate_simple(NDIMS, dset1_dims, NULL);
- dset1 = H5Dcreate2(file1, "dataset1", H5T_NATIVE_INT, space1, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ dset1 = H5Dcreate2(file1, "dataset1", H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_buf);
H5Dclose(dset1);
H5Sclose(space1);
@@ -60,10 +60,9 @@ main(void) {
H5Fclose(file1);
/* Store reference in dataset in separate file "refer_extern2.h5" */
- file2 = H5Fcreate(H5FILE_NAME2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file2 = H5Fcreate(H5FILE_NAME2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
space2 = H5Screate_simple(NDIMS, dset2_dims, NULL);
- dset2 = H5Dcreate2(file2, "references", H5T_STD_REF, space2, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ dset2 = H5Dcreate2(file2, "references", H5T_STD_REF, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dset2, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_buf);
H5Dclose(dset2);
H5Sclose(space2);
@@ -91,4 +90,3 @@ main(void) {
return 0;
}
-
diff --git a/examples/h5_reference_deprec.c b/examples/h5_reference_deprec.c
index 32a5f59..457956b 100644
--- a/examples/h5_reference_deprec.c
+++ b/examples/h5_reference_deprec.c
@@ -11,15 +11,15 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
- /*
- * This program illustrates how references to objects can be used.
- * Program creates a dataset and a group in a file. It also creates
- * second dataset, and references to the first dataset and the group
- * are stored in it.
- * Program reopens the file and reads dataset with the references.
- * References are used to open the objects. Information about the
- * objects is displayed.
- */
+/*
+ * This program illustrates how references to objects can be used.
+ * Program creates a dataset and a group in a file. It also creates
+ * second dataset, and references to the first dataset and the group
+ * are stored in it.
+ * Program reopens the file and reads dataset with the references.
+ * References are used to open the objects. Information about the
+ * objects is displayed.
+ */
#include <stdlib.h>
@@ -28,120 +28,119 @@
#define H5FILE_NAME "refere.h5"
int
-main(void) {
- hid_t fid; /* File, group, datasets, datatypes */
- hid_t gid_a; /* and dataspaces identifiers */
- hid_t did_b, sid_b, tid_b;
- hid_t did_r, tid_r, sid_r;
- H5O_type_t obj_type;
- herr_t status;
-
- hobj_ref_t *wbuf; /* buffer to write to disk */
- hobj_ref_t *rbuf; /* buffer to read from disk */
-
-
- hsize_t dim_r[1];
- hsize_t dim_b[2];
-
- /*
- * Create a file using default properties.
- */
- fid = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
- /*
- * Create group "A" in the file.
- */
- gid_a = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-
- /*
- * Create dataset "B" in the file.
- */
- dim_b[0] = 2;
- dim_b[1] = 6;
- sid_b = H5Screate_simple(2, dim_b, NULL);
- did_b = H5Dcreate2(fid, "B", H5T_NATIVE_FLOAT, sid_b, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-
- /*
- * Create dataset "R" to store references to the objects "A" and "B".
- */
- dim_r[0] = 2;
- sid_r = H5Screate_simple(1, dim_r, NULL);
- tid_r = H5Tcopy(H5T_STD_REF_OBJ);
- did_r = H5Dcreate2(fid, "R", tid_r, sid_r, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-
- /*
- * Allocate write and read buffers.
- */
- wbuf = (hobj_ref_t *)malloc(sizeof(hobj_ref_t) * 2);
- rbuf = (hobj_ref_t *)malloc(sizeof(hobj_ref_t) * 2);
-
- /*
- * Create references to the group "A" and dataset "B"
- * and store them in the wbuf.
- */
- H5Rcreate(&wbuf[0], fid, "A", H5R_OBJECT, (hid_t)-1);
- H5Rcreate(&wbuf[1], fid, "B", H5R_OBJECT, (hid_t)-1);
-
- /*
- * Write dataset R using default transfer properties.
- */
- status = H5Dwrite(did_r, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
-
- /*
- * Close all objects.
- */
- H5Gclose(gid_a);
-
- H5Sclose(sid_b);
- H5Dclose(did_b);
-
- H5Tclose(tid_r);
- H5Sclose(sid_r);
- H5Dclose(did_r);
-
- H5Fclose(fid);
-
- /*
- * Reopen the file.
- */
- fid = H5Fopen(H5FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
-
- /*
- * Open and read dataset "R".
- */
- did_r = H5Dopen2(fid, "R", H5P_DEFAULT);
- status = H5Dread(did_r, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
-
- /*
- * Find the type of referenced objects.
- */
+main(void)
+{
+ hid_t fid; /* File, group, datasets, datatypes */
+ hid_t gid_a; /* and dataspaces identifiers */
+ hid_t did_b, sid_b, tid_b;
+ hid_t did_r, tid_r, sid_r;
+ H5O_type_t obj_type;
+ herr_t status;
+
+ hobj_ref_t *wbuf; /* buffer to write to disk */
+ hobj_ref_t *rbuf; /* buffer to read from disk */
+
+ hsize_t dim_r[1];
+ hsize_t dim_b[2];
+
+ /*
+ * Create a file using default properties.
+ */
+ fid = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create group "A" in the file.
+ */
+ gid_a = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataset "B" in the file.
+ */
+ dim_b[0] = 2;
+ dim_b[1] = 6;
+ sid_b = H5Screate_simple(2, dim_b, NULL);
+ did_b = H5Dcreate2(fid, "B", H5T_NATIVE_FLOAT, sid_b, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create dataset "R" to store references to the objects "A" and "B".
+ */
+ dim_r[0] = 2;
+ sid_r = H5Screate_simple(1, dim_r, NULL);
+ tid_r = H5Tcopy(H5T_STD_REF_OBJ);
+ did_r = H5Dcreate2(fid, "R", tid_r, sid_r, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Allocate write and read buffers.
+ */
+ wbuf = (hobj_ref_t *)malloc(sizeof(hobj_ref_t) * 2);
+ rbuf = (hobj_ref_t *)malloc(sizeof(hobj_ref_t) * 2);
+
+ /*
+ * Create references to the group "A" and dataset "B"
+ * and store them in the wbuf.
+ */
+ H5Rcreate(&wbuf[0], fid, "A", H5R_OBJECT, (hid_t)-1);
+ H5Rcreate(&wbuf[1], fid, "B", H5R_OBJECT, (hid_t)-1);
+
+ /*
+ * Write dataset R using default transfer properties.
+ */
+ status = H5Dwrite(did_r, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+
+ /*
+ * Close all objects.
+ */
+ H5Gclose(gid_a);
+
+ H5Sclose(sid_b);
+ H5Dclose(did_b);
+
+ H5Tclose(tid_r);
+ H5Sclose(sid_r);
+ H5Dclose(did_r);
+
+ H5Fclose(fid);
+
+ /*
+ * Reopen the file.
+ */
+ fid = H5Fopen(H5FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
+
+ /*
+ * Open and read dataset "R".
+ */
+ did_r = H5Dopen2(fid, "R", H5P_DEFAULT);
+ status = H5Dread(did_r, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
+
+ /*
+ * Find the type of referenced objects.
+ */
status = H5Rget_obj_type2(did_r, H5R_OBJECT, &rbuf[0], &obj_type);
- if(obj_type == H5O_TYPE_GROUP)
+ if (obj_type == H5O_TYPE_GROUP)
printf("First dereferenced object is a group. \n");
status = H5Rget_obj_type2(did_r, H5R_OBJECT, &rbuf[1], &obj_type);
- if(obj_type == H5O_TYPE_DATASET)
+ if (obj_type == H5O_TYPE_DATASET)
printf("Second dereferenced object is a dataset. \n");
- /*
- * Get datatype of the dataset "B"
- */
- did_b = H5Rdereference2(did_r, H5P_DEFAULT, H5R_OBJECT, &rbuf[1]);
- tid_b = H5Dget_type(did_b);
- if(H5Tequal(tid_b, H5T_NATIVE_FLOAT))
- printf("Datatype of the dataset is H5T_NATIVE_FLOAT.\n");
- printf("\n");
-
- /*
- * Close all objects and free memory buffers.
- */
- H5Dclose(did_r);
- H5Dclose(did_b);
- H5Tclose(tid_b);
- H5Fclose(fid);
- free(rbuf);
- free(wbuf);
-
- return 0;
- }
-
+ /*
+ * Get datatype of the dataset "B"
+ */
+ did_b = H5Rdereference2(did_r, H5P_DEFAULT, H5R_OBJECT, &rbuf[1]);
+ tid_b = H5Dget_type(did_b);
+ if (H5Tequal(tid_b, H5T_NATIVE_FLOAT))
+ printf("Datatype of the dataset is H5T_NATIVE_FLOAT.\n");
+ printf("\n");
+
+ /*
+ * Close all objects and free memory buffers.
+ */
+ H5Dclose(did_r);
+ H5Dclose(did_b);
+ H5Tclose(tid_b);
+ H5Fclose(fid);
+ free(rbuf);
+ free(wbuf);
+
+ return 0;
+}
diff --git a/examples/h5_select.c b/examples/h5_select.c
index bbc877c..b4aa679 100644
--- a/examples/h5_select.c
+++ b/examples/h5_select.c
@@ -26,78 +26,80 @@
#define H5FILE_NAME "Select.h5"
-#define MSPACE1_RANK 1 /* Rank of the first dataset in memory */
-#define MSPACE1_DIM 50 /* Dataset size in memory */
-
-#define MSPACE2_RANK 1 /* Rank of the second dataset in memory */
-#define MSPACE2_DIM 4 /* Dataset size in memory */
-
-#define FSPACE_RANK 2 /* Dataset rank as it is stored in the file */
-#define FSPACE_DIM1 8 /* Dimension sizes of the dataset as it is
- stored in the file */
-#define FSPACE_DIM2 12
-
- /* We will read dataset back from the file
- to the dataset in memory with these
- dataspace parameters. */
-#define MSPACE_RANK 2
-#define MSPACE_DIM1 8
-#define MSPACE_DIM2 9
-
-#define NPOINTS 4 /* Number of points that will be selected
- and overwritten */
+#define MSPACE1_RANK 1 /* Rank of the first dataset in memory */
+#define MSPACE1_DIM 50 /* Dataset size in memory */
+
+#define MSPACE2_RANK 1 /* Rank of the second dataset in memory */
+#define MSPACE2_DIM 4 /* Dataset size in memory */
+
+#define FSPACE_RANK 2 /* Dataset rank as it is stored in the file */
+#define FSPACE_DIM1 \
+ 8 /* Dimension sizes of the dataset as it is \
+ stored in the file */
+#define FSPACE_DIM2 12
+
+/* We will read dataset back from the file
+ to the dataset in memory with these
+ dataspace parameters. */
+#define MSPACE_RANK 2
+#define MSPACE_DIM1 8
+#define MSPACE_DIM2 9
+
+#define NPOINTS \
+ 4 /* Number of points that will be selected \
+ and overwritten */
int
-main (void)
+main(void)
{
- hid_t file, dataset; /* File and dataset identifiers */
- hid_t mid1, mid2, mid, fid; /* Dataspace identifiers */
- hid_t plist; /* Dataset property list identifier */
+ hid_t file, dataset; /* File and dataset identifiers */
+ hid_t mid1, mid2, mid, fid; /* Dataspace identifiers */
+ hid_t plist; /* Dataset property list identifier */
- hsize_t dim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset
+ hsize_t dim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset
(in memory) */
- hsize_t dim2[] = {MSPACE2_DIM}; /* Dimension size of the second dataset
+ hsize_t dim2[] = {MSPACE2_DIM}; /* Dimension size of the second dataset
(in memory */
- hsize_t fdim[] = {FSPACE_DIM1, FSPACE_DIM2};
- /* Dimension sizes of the dataset (on disk) */
- hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2}; /* Dimension sizes of the
- dataset in memory when we
- read selection from the
- dataset on the disk */
-
- hsize_t start[2]; /* Start of hyperslab */
- hsize_t stride[2]; /* Stride of hyperslab */
- hsize_t count[2]; /* Block count */
- hsize_t block[2]; /* Block sizes */
-
- hsize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points
- from the file dataspace */
- herr_t ret;
- unsigned i,j;
- int fillvalue = 0; /* Fill value for the dataset */
-
- int matrix_out[MSPACE_DIM1][MSPACE_DIM2]; /* Buffer to read from the
- dataset */
- int vector[MSPACE1_DIM];
- int values[] = {53, 59, 61, 67}; /* New values to be written */
-
- /*
- * Buffers' initialization.
- */
- vector[0] = vector[MSPACE1_DIM - 1] = -1;
- for(i = 1; i < MSPACE1_DIM - 1; i++)
- vector[i] = i;
-
- /*
- * Create a file.
- */
- file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
- /*
- * Create property list for a dataset and set up fill values.
- */
- plist = H5Pcreate(H5P_DATASET_CREATE);
- ret = H5Pset_fill_value(plist, H5T_NATIVE_INT, &fillvalue);
+ hsize_t fdim[] = {FSPACE_DIM1, FSPACE_DIM2};
+ /* Dimension sizes of the dataset (on disk) */
+ hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2}; /* Dimension sizes of the
+ dataset in memory when we
+ read selection from the
+ dataset on the disk */
+
+ hsize_t start[2]; /* Start of hyperslab */
+ hsize_t stride[2]; /* Stride of hyperslab */
+ hsize_t count[2]; /* Block count */
+ hsize_t block[2]; /* Block sizes */
+
+ hsize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points
+ from the file dataspace */
+ herr_t ret;
+ unsigned i, j;
+ int fillvalue = 0; /* Fill value for the dataset */
+
+ int matrix_out[MSPACE_DIM1][MSPACE_DIM2]; /* Buffer to read from the
+ dataset */
+ int vector[MSPACE1_DIM];
+ int values[] = {53, 59, 61, 67}; /* New values to be written */
+
+ /*
+ * Buffers' initialization.
+ */
+ vector[0] = vector[MSPACE1_DIM - 1] = -1;
+ for (i = 1; i < MSPACE1_DIM - 1; i++)
+ vector[i] = i;
+
+ /*
+ * Create a file.
+ */
+ file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create property list for a dataset and set up fill values.
+ */
+ plist = H5Pcreate(H5P_DATASET_CREATE);
+ ret = H5Pset_fill_value(plist, H5T_NATIVE_INT, &fillvalue);
/*
* Create dataspace for the dataset in the file.
@@ -114,11 +116,15 @@ main (void)
* Select hyperslab for the dataset in the file, using 3x2 blocks,
* (4,3) stride and (2,4) count starting at the position (0,1).
*/
- start[0] = 0; start[1] = 1;
- stride[0] = 4; stride[1] = 3;
- count[0] = 2; count[1] = 4;
- block[0] = 3; block[1] = 2;
- ret = H5Sselect_hyperslab(fid, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 0;
+ start[1] = 1;
+ stride[0] = 4;
+ stride[1] = 3;
+ count[0] = 2;
+ count[1] = 4;
+ block[0] = 3;
+ block[1] = 2;
+ ret = H5Sselect_hyperslab(fid, H5S_SELECT_SET, start, stride, count, block);
/*
* Create dataspace for the first dataset.
@@ -134,7 +140,7 @@ main (void)
stride[0] = 1;
count[0] = 48;
block[0] = 1;
- ret = H5Sselect_hyperslab(mid1, H5S_SELECT_SET, start, stride, count, block);
+ ret = H5Sselect_hyperslab(mid1, H5S_SELECT_SET, start, stride, count, block);
/*
* Write selection from the vector buffer to the dataset in the file.
@@ -149,7 +155,7 @@ main (void)
* 0 41 42 0 43 44 0 45 46 0 47 48
* 0 0 0 0 0 0 0 0 0 0 0 0
*/
- ret = H5Dwrite(dataset, H5T_NATIVE_INT, mid1, fid, H5P_DEFAULT, vector);
+ ret = H5Dwrite(dataset, H5T_NATIVE_INT, mid1, fid, H5P_DEFAULT, vector);
/*
* Reset the selection for the file dataspace fid.
@@ -164,10 +170,14 @@ main (void)
/*
* Select sequence of NPOINTS points in the file dataspace.
*/
- coord[0][0] = 0; coord[0][1] = 0;
- coord[1][0] = 3; coord[1][1] = 3;
- coord[2][0] = 3; coord[2][1] = 5;
- coord[3][0] = 5; coord[3][1] = 6;
+ coord[0][0] = 0;
+ coord[0][1] = 0;
+ coord[1][0] = 3;
+ coord[1][1] = 3;
+ coord[2][0] = 3;
+ coord[2][1] = 5;
+ coord[3][0] = 5;
+ coord[3][1] = 6;
ret = H5Sselect_elements(fid, H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord);
@@ -229,11 +239,15 @@ main (void)
* 0 59 0 61
*
*/
- start[0] = 1; start[1] = 2;
- block[0] = 1; block[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 3; count[1] = 4;
- ret = H5Sselect_hyperslab(fid, H5S_SELECT_SET, start, stride, count, block);
+ start[0] = 1;
+ start[1] = 2;
+ block[0] = 1;
+ block[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 3;
+ count[1] = 4;
+ ret = H5Sselect_hyperslab(fid, H5S_SELECT_SET, start, stride, count, block);
/*
* Add second selected hyperslab to the selection.
@@ -248,11 +262,15 @@ main (void)
* 19 20
* 0 61
*/
- start[0] = 2; start[1] = 4;
- block[0] = 1; block[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 6; count[1] = 5;
- ret = H5Sselect_hyperslab(fid, H5S_SELECT_OR, start, stride, count, block);
+ start[0] = 2;
+ start[1] = 4;
+ block[0] = 1;
+ block[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 6;
+ count[1] = 5;
+ ret = H5Sselect_hyperslab(fid, H5S_SELECT_OR, start, stride, count, block);
/*
* Create memory dataspace.
@@ -263,30 +281,37 @@ main (void)
* Select two hyperslabs in memory. Hyperslabs has the same
* size and shape as the selected hyperslabs for the file dataspace.
*/
- start[0] = 0; start[1] = 0;
- block[0] = 1; block[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 3; count[1] = 4;
- ret = H5Sselect_hyperslab(mid, H5S_SELECT_SET, start, stride, count, block);
-
- start[0] = 1; start[1] = 2;
- block[0] = 1; block[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 6; count[1] = 5;
- ret = H5Sselect_hyperslab(mid, H5S_SELECT_OR, start, stride, count, block);
+ start[0] = 0;
+ start[1] = 0;
+ block[0] = 1;
+ block[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 3;
+ count[1] = 4;
+ ret = H5Sselect_hyperslab(mid, H5S_SELECT_SET, start, stride, count, block);
+
+ start[0] = 1;
+ start[1] = 2;
+ block[0] = 1;
+ block[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 6;
+ count[1] = 5;
+ ret = H5Sselect_hyperslab(mid, H5S_SELECT_OR, start, stride, count, block);
/*
* Initialize data buffer.
*/
for (i = 0; i < MSPACE_DIM1; i++) {
- for (j = 0; j < MSPACE_DIM2; j++)
+ for (j = 0; j < MSPACE_DIM2; j++)
matrix_out[i][j] = 0;
}
/*
* Read data back to the buffer matrix_out.
*/
- ret = H5Dread(dataset, H5T_NATIVE_INT, mid, fid,
- H5P_DEFAULT, matrix_out);
+ ret = H5Dread(dataset, H5T_NATIVE_INT, mid, fid, H5P_DEFAULT, matrix_out);
/*
* Display the result. Memory dataset is:
@@ -300,8 +325,8 @@ main (void)
* 0 0 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0 0 0
*/
- for(i = 0; i < MSPACE_DIM1; i++) {
- for(j = 0; j < MSPACE_DIM2; j++)
+ for (i = 0; i < MSPACE_DIM1; i++) {
+ for (j = 0; j < MSPACE_DIM2; j++)
printf("%3d ", matrix_out[i][j]);
printf("\n");
}
@@ -329,4 +354,3 @@ main (void)
return 0;
}
-
diff --git a/examples/h5_shared_mesg.c b/examples/h5_shared_mesg.c
index 4e1f92a..cf2deb6 100644
--- a/examples/h5_shared_mesg.c
+++ b/examples/h5_shared_mesg.c
@@ -27,29 +27,13 @@
#include "hdf5.h"
#define NUM_DATASETS 40
-const char* DSETNAME[] = {
- "dataset0", "dataset1",
- "dataset2", "dataset3",
- "dataset4", "dataset5",
- "dataset6", "dataset7",
- "dataset8", "dataset9",
- "dataset10", "dataset11",
- "dataset12", "dataset13",
- "dataset14", "dataset15",
- "dataset16", "dataset17",
- "dataset18", "dataset19",
- "dataset20", "dataset21",
- "dataset22", "dataset23",
- "dataset24", "dataset25",
- "dataset26", "dataset27",
- "dataset28", "dataset29",
- "dataset30", "dataset31",
- "dataset32", "dataset33",
- "dataset34", "dataset35",
- "dataset36", "dataset37",
- "dataset38", "dataset39",
- NULL
-};
+const char *DSETNAME[] = {"dataset0", "dataset1", "dataset2", "dataset3", "dataset4", "dataset5",
+ "dataset6", "dataset7", "dataset8", "dataset9", "dataset10", "dataset11",
+ "dataset12", "dataset13", "dataset14", "dataset15", "dataset16", "dataset17",
+ "dataset18", "dataset19", "dataset20", "dataset21", "dataset22", "dataset23",
+ "dataset24", "dataset25", "dataset26", "dataset27", "dataset28", "dataset29",
+ "dataset30", "dataset31", "dataset32", "dataset33", "dataset34", "dataset35",
+ "dataset36", "dataset37", "dataset38", "dataset39", NULL};
herr_t create_standard_file(const char *filename, hid_t fcpl);
@@ -61,21 +45,24 @@ herr_t create_standard_file(const char *filename, hid_t fcpl);
*
*-------------------------------------------------------------------------
*/
-int main(void)
+int
+main(void)
{
- hid_t fcpl_id;
+ hid_t fcpl_id;
herr_t ret;
/* Create a file creation property list */
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
- if(fcpl_id < 0) goto error;
+ if (fcpl_id < 0)
+ goto error;
/* The file creation property list is the default list right now.
* Create a file using it (this is the same as creating a file with
* H5P_DEFAULT). Implicit shared messages will be disabled.
*/
ret = create_standard_file("default_file.h5", fcpl_id);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
/* There are five kinds of messages that can be shared: datatypes,
* dataspaces, attributes, fill values, and filter pipelines.
@@ -86,7 +73,8 @@ int main(void)
*/
/* To begin with, use only one index. */
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
/* Each index has a "minimum message size" for a message of that
* type to be shared. Since sharing a message creates some overhead,
@@ -111,7 +99,8 @@ int main(void)
* shared in this single index.
*/
ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, 40);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
/* The other property that can be set for shared messages is the
* list/B-tree cutoff for the indexes.
@@ -128,7 +117,8 @@ int main(void)
* second the minimum B-tree size.
*/
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 30, 20);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
/* Now create a file with this property list. After the FCPL is used,
* everything is automatic; messages will be shared and this will be
@@ -137,7 +127,8 @@ int main(void)
* written later.
*/
ret = create_standard_file("one_index_file.h5", fcpl_id);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
/* Now try some variations on this. The FCPL hasn't been closed, so
* we don't need to re-create it.
@@ -147,36 +138,42 @@ int main(void)
* overhead).
*/
ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, 1000);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
ret = create_standard_file("only_huge_mesgs_file.h5", fcpl_id);
- if(ret < 0) goto error;
-
+ if (ret < 0)
+ goto error;
/* Or, suppose we only wanted to shared dataspaces and
* attributes (which might make sense if we were going to use committed
* datatypes). We could change the flags on the index:
*/
ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_ATTR_FLAG, 40);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
ret = create_standard_file("only_dspaces_and_attrs_file.h5", fcpl_id);
- if(ret < 0) goto error;
-
+ if (ret < 0)
+ goto error;
/* We could create a second index and put attributes in it to separate them
* from datatypes and dataspaces (and then run some performance metrics to
* see whether this improved caching performance).
*/
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 2);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_DTYPE_FLAG | H5O_SHMESG_SDSPACE_FLAG, 40);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
ret = H5Pset_shared_mesg_index(fcpl_id, 1, H5O_SHMESG_ATTR_FLAG, 40);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
ret = create_standard_file("separate_indexes_file.h5", fcpl_id);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
/* We can try twiddling the "phase change" values and see what it does to
* the file size. Since there's only a few different messages (two
@@ -184,25 +181,30 @@ int main(void)
* save some space.
*/
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, 40);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 5, 0);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
ret = create_standard_file("small_lists_file.h5", fcpl_id);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
/* Or we could create indexes that are never lists, but are created as
* B-trees. We do this by setting the "maximum list size" to zero.
*/
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
ret = create_standard_file("btrees_file.h5", fcpl_id);
- if(ret < 0) goto error;
-
+ if (ret < 0)
+ goto error;
/* Obviously there are a lot more permutations of these options possible.
* Performance will often be a tradeoff of speed for space, but will
@@ -212,10 +214,10 @@ int main(void)
* Please let The HDF Group (help@hdfgroup.org) know what you find!
*/
-
/* Close the property list */
ret = H5Pclose(fcpl_id);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
return 0;
error:
@@ -238,21 +240,22 @@ error:
herr_t
create_standard_file(const char *filename, hid_t fcpl_id)
{
- hid_t file_id=-1;
- hid_t type_id=-1, temp_type_id=-1;
- hsize_t dims[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
- hid_t space_id=-1;
- hid_t attr_type_id = -1;
- hid_t attr_space_id = -1;
- int attr_data[] = {1,2,3,4,5,6,7,8,9,0};
- hid_t dset_id=-1;
- hid_t attr_id=-1;
- int x;
- herr_t ret;
+ hid_t file_id = -1;
+ hid_t type_id = -1, temp_type_id = -1;
+ hsize_t dims[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
+ hid_t space_id = -1;
+ hid_t attr_type_id = -1;
+ hid_t attr_space_id = -1;
+ int attr_data[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
+ hid_t dset_id = -1;
+ hid_t attr_id = -1;
+ int x;
+ herr_t ret;
/* Create the file */
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
- if(file_id < 0) goto error;
+ if (file_id < 0)
+ goto error;
/* Create the datatype we'll be using. Generally, sharing messages
* is most useful when the message is complex and takes more space on
@@ -260,66 +263,80 @@ create_standard_file(const char *filename, hid_t fcpl_id)
* However, any type can be shared.
*/
temp_type_id = H5Tarray_create2(H5T_NATIVE_INT, 2, dims);
- if(temp_type_id < 0) goto error;
- type_id = H5Tarray_create2(temp_type_id, 2, dims);
- if(type_id < 0) goto error;
+ if (temp_type_id < 0)
+ goto error;
+ type_id = H5Tarray_create2(temp_type_id, 2, dims);
+ if (type_id < 0)
+ goto error;
ret = H5Tclose(temp_type_id);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
/* Create the dataspace we'll be using.
* Again, create a more complex dataspace so that more space will
* be saved when we share it.
*/
space_id = H5Screate_simple(10, dims, dims);
- if(space_id < 0) goto error;
+ if (space_id < 0)
+ goto error;
/* Create a datatype and dataspace for the attributes we'll be creating.
* The datatype will be a single integer, and each attribute will hold
* 10 integers.
*/
attr_type_id = H5Tcopy(H5T_NATIVE_INT);
- if(attr_type_id < 0) goto error;
+ if (attr_type_id < 0)
+ goto error;
attr_space_id = H5Screate_simple(1, dims, dims);
- if(attr_space_id < 0) goto error;
-
+ if (attr_space_id < 0)
+ goto error;
/* Begin using the messages many times. Do this by creating datasets
* that use this datatype, dataspace, and have this attribute.
*/
- for(x = 0; x < NUM_DATASETS; ++x) {
- /* Create a dataset */
- dset_id = H5Dcreate2(file_id, DSETNAME[x], type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset_id < 0) goto error;
-
- /* Create an attribute on the dataset */
- attr_id = H5Acreate2(dset_id, "attr_name", attr_type_id, attr_space_id, H5P_DEFAULT, H5P_DEFAULT);
- if(attr_id < 0) goto error;
-
- /* Write data to the attribute */
- ret = H5Awrite(attr_id, H5T_NATIVE_INT, attr_data);
- if(ret < 0) goto error;
-
- ret = H5Aclose(attr_id);
- if(ret < 0) goto error;
- ret = H5Dclose(dset_id);
- if(ret < 0) goto error;
+ for (x = 0; x < NUM_DATASETS; ++x) {
+ /* Create a dataset */
+ dset_id = H5Dcreate2(file_id, DSETNAME[x], type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset_id < 0)
+ goto error;
+
+ /* Create an attribute on the dataset */
+ attr_id = H5Acreate2(dset_id, "attr_name", attr_type_id, attr_space_id, H5P_DEFAULT, H5P_DEFAULT);
+ if (attr_id < 0)
+ goto error;
+
+ /* Write data to the attribute */
+ ret = H5Awrite(attr_id, H5T_NATIVE_INT, attr_data);
+ if (ret < 0)
+ goto error;
+
+ ret = H5Aclose(attr_id);
+ if (ret < 0)
+ goto error;
+ ret = H5Dclose(dset_id);
+ if (ret < 0)
+ goto error;
}
/* Close all open IDs */
ret = H5Tclose(attr_type_id);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
ret = H5Sclose(attr_space_id);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
ret = H5Tclose(type_id);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
ret = H5Sclose(space_id);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
ret = H5Fclose(file_id);
- if(ret < 0) goto error;
+ if (ret < 0)
+ goto error;
return 0;
error:
return -1;
}
-
diff --git a/examples/h5_subset.c b/examples/h5_subset.c
index ad2eaba..bd680c7 100644
--- a/examples/h5_subset.c
+++ b/examples/h5_subset.c
@@ -20,34 +20,32 @@
#define FILE "subset.h5"
#define DATASETNAME "IntArray"
-#define RANK 2
+#define RANK 2
-#define DIM0_SUB 3 /* subset dimensions */
-#define DIM1_SUB 4
+#define DIM0_SUB 3 /* subset dimensions */
+#define DIM1_SUB 4
-
-#define DIM0 8 /* size of dataset */
-#define DIM1 10
+#define DIM0 8 /* size of dataset */
+#define DIM1 10
int
-main (void)
+main(void)
{
- hsize_t dims[2], dimsm[2];
- int data[DIM0][DIM1]; /* data to write */
- int sdata[DIM0_SUB][DIM1_SUB]; /* subset to write */
- int rdata[DIM0][DIM1]; /* buffer for read */
-
- hid_t file_id, dataset_id; /* handles */
- hid_t dataspace_id, memspace_id;
+ hsize_t dims[2], dimsm[2];
+ int data[DIM0][DIM1]; /* data to write */
+ int sdata[DIM0_SUB][DIM1_SUB]; /* subset to write */
+ int rdata[DIM0][DIM1]; /* buffer for read */
- herr_t status;
+ hid_t file_id, dataset_id; /* handles */
+ hid_t dataspace_id, memspace_id;
- hsize_t count[2]; /* size of subset in the file */
- hsize_t offset[2]; /* subset offset in the file */
- hsize_t stride[2];
- hsize_t block[2];
- int i, j;
+ herr_t status;
+ hsize_t count[2]; /* size of subset in the file */
+ hsize_t offset[2]; /* subset offset in the file */
+ hsize_t stride[2];
+ hsize_t block[2];
+ int i, j;
/*****************************************************************
* Create a new file with default creation and access properties.*
@@ -55,53 +53,50 @@ main (void)
* and dataset. *
*****************************************************************/
- file_id = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
- dims[0] = DIM0;
- dims[1] = DIM1;
- dataspace_id = H5Screate_simple (RANK, dims, NULL);
+ file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- dataset_id = H5Dcreate2 (file_id, DATASETNAME, H5T_STD_I32BE, dataspace_id,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = DIM0;
+ dims[1] = DIM1;
+ dataspace_id = H5Screate_simple(RANK, dims, NULL);
+ dataset_id =
+ H5Dcreate2(file_id, DATASETNAME, H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for (j = 0; j < DIM0; j++) {
- for (i = 0; i < DIM1; i++)
- if (i< (DIM1/2))
- data[j][i] = 1;
+ for (i = 0; i < DIM1; i++)
+ if (i < (DIM1 / 2))
+ data[j][i] = 1;
else
- data[j][i] = 2;
+ data[j][i] = 2;
}
- status = H5Dwrite (dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, data);
+ status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
- printf ("\nData Written to File:\n");
- for (i = 0; i<DIM0; i++){
- for (j = 0; j<DIM1; j++)
- printf (" %i", data[i][j]);
- printf ("\n");
+ printf("\nData Written to File:\n");
+ for (i = 0; i < DIM0; i++) {
+ for (j = 0; j < DIM1; j++)
+ printf(" %i", data[i][j]);
+ printf("\n");
}
- status = H5Sclose (dataspace_id);
- status = H5Dclose (dataset_id);
- status = H5Fclose (file_id);
-
+ status = H5Sclose(dataspace_id);
+ status = H5Dclose(dataset_id);
+ status = H5Fclose(file_id);
/*****************************************************
* Reopen the file and dataset and write a subset of *
* values to the dataset.
*****************************************************/
- file_id = H5Fopen (FILE, H5F_ACC_RDWR, H5P_DEFAULT);
- dataset_id = H5Dopen2 (file_id, DATASETNAME, H5P_DEFAULT);
+ file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ dataset_id = H5Dopen2(file_id, DATASETNAME, H5P_DEFAULT);
/* Specify size and shape of subset to write. */
offset[0] = 1;
offset[1] = 2;
- count[0] = DIM0_SUB;
- count[1] = DIM1_SUB;
+ count[0] = DIM0_SUB;
+ count[1] = DIM1_SUB;
stride[0] = 1;
stride[1] = 1;
@@ -112,40 +107,36 @@ main (void)
/* Create memory space with size of subset. Get file dataspace
and select subset from file dataspace. */
- dimsm[0] = DIM0_SUB;
- dimsm[1] = DIM1_SUB;
- memspace_id = H5Screate_simple (RANK, dimsm, NULL);
+ dimsm[0] = DIM0_SUB;
+ dimsm[1] = DIM1_SUB;
+ memspace_id = H5Screate_simple(RANK, dimsm, NULL);
- dataspace_id = H5Dget_space (dataset_id);
- status = H5Sselect_hyperslab (dataspace_id, H5S_SELECT_SET, offset,
- stride, count, block);
+ dataspace_id = H5Dget_space(dataset_id);
+ status = H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, stride, count, block);
/* Write a subset of data to the dataset, then read the
entire dataset back from the file. */
- printf ("\nWrite subset to file specifying:\n");
- printf (" offset=1x2 stride=1x1 count=3x4 block=1x1\n");
+ printf("\nWrite subset to file specifying:\n");
+ printf(" offset=1x2 stride=1x1 count=3x4 block=1x1\n");
for (j = 0; j < DIM0_SUB; j++) {
- for (i = 0; i < DIM1_SUB; i++)
- sdata[j][i] = 5;
+ for (i = 0; i < DIM1_SUB; i++)
+ sdata[j][i] = 5;
}
- status = H5Dwrite (dataset_id, H5T_NATIVE_INT, memspace_id,
- dataspace_id, H5P_DEFAULT, sdata);
+ status = H5Dwrite(dataset_id, H5T_NATIVE_INT, memspace_id, dataspace_id, H5P_DEFAULT, sdata);
- status = H5Dread (dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, rdata);
+ status = H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
- printf ("\nData in File after Subset is Written:\n");
- for (i = 0; i<DIM0; i++){
- for (j = 0; j<DIM1; j++)
- printf (" %i", rdata[i][j]);
- printf ("\n");
+ printf("\nData in File after Subset is Written:\n");
+ for (i = 0; i < DIM0; i++) {
+ for (j = 0; j < DIM1; j++)
+ printf(" %i", rdata[i][j]);
+ printf("\n");
}
- status = H5Sclose (memspace_id);
- status = H5Sclose (dataspace_id);
- status = H5Dclose (dataset_id);
- status = H5Fclose (file_id);
-
+ status = H5Sclose(memspace_id);
+ status = H5Sclose(dataspace_id);
+ status = H5Dclose(dataset_id);
+ status = H5Fclose(file_id);
}
diff --git a/examples/h5_vds-eiger.c b/examples/h5_vds-eiger.c
index a02f4f8..8ba01c6 100644
--- a/examples/h5_vds-eiger.c
+++ b/examples/h5_vds-eiger.c
@@ -23,85 +23,73 @@
#include <stdio.h>
#include <stdlib.h>
-#define FILE "vds-eiger.h5"
-#define DATASET "VDS-Eiger"
-#define VDSDIM0 5
-#define VDSDIM1 10
-#define VDSDIM2 10
-#define DIM0 5
-#define DIM1 10
-#define DIM2 10
-#define RANK 3
+#define FILE "vds-eiger.h5"
+#define DATASET "VDS-Eiger"
+#define VDSDIM0 5
+#define VDSDIM1 10
+#define VDSDIM2 10
+#define DIM0 5
+#define DIM1 10
+#define DIM2 10
+#define RANK 3
int
-main (void)
+main(void)
{
- hid_t file, src_space, vspace,
- dset; /* Handles */
- hid_t dcpl;
- herr_t status;
- hsize_t vdsdims[3] = {VDSDIM0, VDSDIM1, VDSDIM2},
- vdsdims_max[3] = {H5S_UNLIMITED, VDSDIM1, VDSDIM1},
- dims[3] = {DIM0, DIM1, DIM2},
- start[3], /* Hyperslab parameters */
- stride[3],
- count[3],
- block[3];
- hsize_t start_out[3], /* Hyperslab parameter out */
- stride_out[3],
- count_out[3],
- block_out[3];
+ hid_t file, src_space, vspace, dset; /* Handles */
+ hid_t dcpl;
+ herr_t status;
+ hsize_t vdsdims[3] = {VDSDIM0, VDSDIM1, VDSDIM2}, vdsdims_max[3] = {H5S_UNLIMITED, VDSDIM1, VDSDIM1},
+ dims[3] = {DIM0, DIM1, DIM2}, start[3], /* Hyperslab parameters */
+ stride[3], count[3], block[3];
+ hsize_t start_out[3], /* Hyperslab parameter out */
+ stride_out[3], count_out[3], block_out[3];
int i;
- H5D_layout_t layout; /* Storage layout */
- size_t num_map; /* Number of mappings */
- ssize_t len; /* Length of the string; also a return value */
- char *filename;
- char *dsetname;
+ H5D_layout_t layout; /* Storage layout */
+ size_t num_map; /* Number of mappings */
+ ssize_t len; /* Length of the string; also a return value */
+ char * filename;
+ char * dsetname;
-
- file = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Create VDS dataspace. */
- vspace = H5Screate_simple (RANK, vdsdims, vdsdims_max);
+ vspace = H5Screate_simple(RANK, vdsdims, vdsdims_max);
/* Create dataspaces for the source dataset. */
- src_space = H5Screate_simple (RANK, dims, NULL);
+ src_space = H5Screate_simple(RANK, dims, NULL);
/* Create VDS creation property */
- dcpl = H5Pcreate (H5P_DATASET_CREATE);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
/* Initialize hyperslab values */
- start[0] = 0;
- start[1] = 0;
- start[2] = 0;
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
stride[0] = DIM0;
stride[1] = 1;
stride[2] = 1;
- count[0] = H5S_UNLIMITED;
- count[1] = 1;
- count[2] = 1;
- block[0] = DIM0;
- block[1] = DIM1;
- block[2] = DIM2;
-
- /*
- * Build the mappings
- *
- */
- status = H5Sselect_hyperslab (vspace, H5S_SELECT_SET, start, stride, count, block);
- status = H5Pset_virtual (dcpl, vspace, "f-%b.h5", "/A", src_space);
-
+ count[0] = H5S_UNLIMITED;
+ count[1] = 1;
+ count[2] = 1;
+ block[0] = DIM0;
+ block[1] = DIM1;
+ block[2] = DIM2;
+ /*
+ * Build the mappings
+ *
+ */
+ status = H5Sselect_hyperslab(vspace, H5S_SELECT_SET, start, stride, count, block);
+ status = H5Pset_virtual(dcpl, vspace, "f-%b.h5", "/A", src_space);
- /* Create a virtual dataset */
- dset = H5Dcreate2 (file, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT,
- dcpl, H5P_DEFAULT);
- status = H5Sclose (vspace);
- status = H5Sclose (src_space);
- status = H5Dclose (dset);
- status = H5Fclose (file);
-
+ /* Create a virtual dataset */
+ dset = H5Dcreate2(file, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ status = H5Sclose(vspace);
+ status = H5Sclose(src_space);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
/*
* Now we begin the read section of this example.
@@ -110,79 +98,82 @@ main (void)
/*
* Open file and dataset using the default properties.
*/
- file = H5Fopen (FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
- dset = H5Dopen2 (file, DATASET, H5P_DEFAULT);
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen2(file, DATASET, H5P_DEFAULT);
/*
* Get creation property list and mapping properties.
*/
- dcpl = H5Dget_create_plist (dset);
+ dcpl = H5Dget_create_plist(dset);
/*
* Get storage layout.
*/
- layout = H5Pget_layout (dcpl);
+ layout = H5Pget_layout(dcpl);
if (H5D_VIRTUAL == layout)
printf(" Dataset has a virtual layout \n");
else
printf(" Wrong layout found \n");
- /*
- * Find number of mappings.
- */
- status = H5Pget_virtual_count (dcpl, &num_map);
- printf(" Number of mappings is %d\n", (int)num_map);
-
- /*
- * Get mapping parameters for each mapping.
- */
- for (i = 0; i < (int)num_map; i++) {
- printf(" Mapping %d \n", i);
- printf(" Selection in the virtual dataset \n");
- /* Get selection in the virttual dataset */
- vspace = H5Pget_virtual_vspace (dcpl, (size_t)i);
- if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) {
- if (H5Sis_regular_hyperslab(vspace)) {
- status = H5Sget_regular_hyperslab (vspace, start_out, stride_out, count_out, block_out);
- printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0], (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
- printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0], (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
- printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0], (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
- printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0], (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
- }
- }
- /* Get source file name */
- len = H5Pget_virtual_filename (dcpl, (size_t)i, NULL, 0);
- filename = (char *)malloc((size_t)len*sizeof(char)+1);
- H5Pget_virtual_filename (dcpl, (size_t)i, filename, len+1);
- printf(" Source filename %s\n", filename);
-
- /* Get source dataset name */
- len = H5Pget_virtual_dsetname (dcpl, (size_t)i, NULL, 0);
- dsetname = (char *)malloc((size_t)len*sizeof(char)+1);
- H5Pget_virtual_dsetname (dcpl, (size_t)i, dsetname, len+1);
- printf(" Source dataset name %s\n", dsetname);
-
- /* Get selection in the source dataset */
- printf(" Selection in the source dataset ");
- src_space = H5Pget_virtual_srcspace (dcpl, (size_t)i);
- if(H5Sget_select_type(src_space) == H5S_SEL_ALL) {
- printf("H5S_ALL \n");
- }
-/* EIP read data back */
- H5Sclose(vspace);
- H5Sclose(src_space);
- free(filename);
- free(dsetname);
- }
+ /*
+ * Find number of mappings.
+ */
+ status = H5Pget_virtual_count(dcpl, &num_map);
+ printf(" Number of mappings is %d\n", (int)num_map);
+
+ /*
+ * Get mapping parameters for each mapping.
+ */
+ for (i = 0; i < (int)num_map; i++) {
+ printf(" Mapping %d \n", i);
+ printf(" Selection in the virtual dataset \n");
+ /* Get selection in the virttual dataset */
+ vspace = H5Pget_virtual_vspace(dcpl, (size_t)i);
+ if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) {
+ if (H5Sis_regular_hyperslab(vspace)) {
+ status = H5Sget_regular_hyperslab(vspace, start_out, stride_out, count_out, block_out);
+ printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0],
+ (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
+ printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0],
+ (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
+ printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0],
+ (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
+ printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0],
+ (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
+ }
+ }
+ /* Get source file name */
+ len = H5Pget_virtual_filename(dcpl, (size_t)i, NULL, 0);
+ filename = (char *)malloc((size_t)len * sizeof(char) + 1);
+ H5Pget_virtual_filename(dcpl, (size_t)i, filename, len + 1);
+ printf(" Source filename %s\n", filename);
+
+ /* Get source dataset name */
+ len = H5Pget_virtual_dsetname(dcpl, (size_t)i, NULL, 0);
+ dsetname = (char *)malloc((size_t)len * sizeof(char) + 1);
+ H5Pget_virtual_dsetname(dcpl, (size_t)i, dsetname, len + 1);
+ printf(" Source dataset name %s\n", dsetname);
+
+ /* Get selection in the source dataset */
+ printf(" Selection in the source dataset ");
+ src_space = H5Pget_virtual_srcspace(dcpl, (size_t)i);
+ if (H5Sget_select_type(src_space) == H5S_SEL_ALL) {
+ printf("H5S_ALL \n");
+ }
+ /* EIP read data back */
+ H5Sclose(vspace);
+ H5Sclose(src_space);
+ free(filename);
+ free(dsetname);
+ }
/*
* Close and release resources.
*/
- status = H5Pclose (dcpl);
- status = H5Dclose (dset);
- status = H5Fclose (file);
+ status = H5Pclose(dcpl);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
return 0;
}
-
diff --git a/examples/h5_vds-exc.c b/examples/h5_vds-exc.c
index b113c36..a9ef57e 100644
--- a/examples/h5_vds-exc.c
+++ b/examples/h5_vds-exc.c
@@ -22,80 +22,55 @@
#include <stdio.h>
#include <stdlib.h>
-#define FILE "vds-exc.h5"
-#define DATASET "VDS-Excalibur"
-#define VDSDIM0 0
-#define VDSDIM1 15
-#define VDSDIM2 6
-#define KDIM0 0
-#define KDIM1 2
-#define KDIM2 6
-#define NDIM0 0
-#define NDIM1 3
-#define NDIM2 6
-#define RANK 3
-
-const char *SRC_FILE[] = {
- "a.h5",
- "b.h5",
- "c.h5",
- "d.h5",
- "e.h5",
- "f.h5"
-};
-
-const char *SRC_DATASET[] = {
- "A",
- "B",
- "C",
- "D",
- "E",
- "F"
-};
+#define FILE "vds-exc.h5"
+#define DATASET "VDS-Excalibur"
+#define VDSDIM0 0
+#define VDSDIM1 15
+#define VDSDIM2 6
+#define KDIM0 0
+#define KDIM1 2
+#define KDIM2 6
+#define NDIM0 0
+#define NDIM1 3
+#define NDIM2 6
+#define RANK 3
+
+const char *SRC_FILE[] = {"a.h5", "b.h5", "c.h5", "d.h5", "e.h5", "f.h5"};
+
+const char *SRC_DATASET[] = {"A", "B", "C", "D", "E", "F"};
int
-main (void)
+main(void)
{
- hid_t file, space, ksrc_space, nsrc_space, vspace,
- src_space,
- dset; /* Handles */
- hid_t dcpl;
- herr_t status;
- hsize_t vdsdims[3] = {VDSDIM0, VDSDIM1, VDSDIM2},
- vdsdims_max[3] = {H5S_UNLIMITED,VDSDIM1, VDSDIM2},
- kdims[3] = {KDIM0, KDIM1, KDIM2},
- kdims_max[3] = {H5S_UNLIMITED, KDIM1, KDIM2},
- ndims[3] = {NDIM0, NDIM1, NDIM2},
- ndims_max[3] = {H5S_UNLIMITED, NDIM1, NDIM2},
- start[3], /* Hyperslab parameters */
- stride[3],
- count[3],
- block[3];
- hsize_t start_out[3],
- stride_out[3],
- count_out[3],
- block_out[3];
+ hid_t file, space, ksrc_space, nsrc_space, vspace, src_space, dset; /* Handles */
+ hid_t dcpl;
+ herr_t status;
+ hsize_t vdsdims[3] = {VDSDIM0, VDSDIM1, VDSDIM2}, vdsdims_max[3] = {H5S_UNLIMITED, VDSDIM1, VDSDIM2},
+ kdims[3] = {KDIM0, KDIM1, KDIM2}, kdims_max[3] = {H5S_UNLIMITED, KDIM1, KDIM2},
+ ndims[3] = {NDIM0, NDIM1, NDIM2}, ndims_max[3] = {H5S_UNLIMITED, NDIM1, NDIM2},
+ start[3], /* Hyperslab parameters */
+ stride[3], count[3], block[3];
+ hsize_t start_out[3], stride_out[3], count_out[3], block_out[3];
int k = 2;
int n = 3;
int i;
- H5D_layout_t layout; /* Storage layout */
- size_t num_map; /* Number of mappings */
- ssize_t len; /* Length of the string; also a return value */
- char *filename;
- char *dsetname;
+ H5D_layout_t layout; /* Storage layout */
+ size_t num_map; /* Number of mappings */
+ ssize_t len; /* Length of the string; also a return value */
+ char * filename;
+ char * dsetname;
-
- file = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Create VDS dataspace. */
- space = H5Screate_simple (RANK, vdsdims, vdsdims_max);
+ space = H5Screate_simple(RANK, vdsdims, vdsdims_max);
/* Create dataspaces for A, C, and E datasets. */
- ksrc_space = H5Screate_simple (RANK, kdims, kdims_max);
+ ksrc_space = H5Screate_simple(RANK, kdims, kdims_max);
/* Create dataspaces for B, D, and F datasets. */
- nsrc_space = H5Screate_simple (RANK, ndims, ndims_max);
+ nsrc_space = H5Screate_simple(RANK, ndims, ndims_max);
/* Create VDS creation property */
- dcpl = H5Pcreate (H5P_DATASET_CREATE);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
/* Initialize hyperslab values */
@@ -109,42 +84,40 @@ main (void)
block[1] = k;
block[2] = VDSDIM2;
- /*
- * Build the mappings for A, C and E source datasets.
- * Unlimited hyperslab selection is the same in the source datasets.
- * Unlimited hyperslab selections in the virtual dataset have different offsets.
- */
- status = H5Sselect_hyperslab (ksrc_space, H5S_SELECT_SET, start, NULL, count, block);
- for (i = 0; i < 3; i++) {
- start[1] = (hsize_t)((k+n)*i);
- status = H5Sselect_hyperslab (space, H5S_SELECT_SET, start, NULL, count, block);
- status = H5Pset_virtual (dcpl, space, SRC_FILE[2*i], SRC_DATASET[2*i], ksrc_space);
- }
-
- /* Reinitialize start[1] and block[1] to build the second set of mappings. */
- start[1] = 0;
- block[1] = n;
- /*
- * Build the mappings for B, D and F source datasets.
- * Unlimited hyperslab selection is the same in the source datasets.
- * Unlimited hyperslab selections in the virtual dataset have different offsets.
- */
- status = H5Sselect_hyperslab (nsrc_space, H5S_SELECT_SET, start, NULL, count, block);
- for (i = 0; i < 3; i++) {
- start[1] = (hsize_t)(k+(k+n)*i);
- status = H5Sselect_hyperslab (space, H5S_SELECT_SET, start, NULL, count, block);
- status = H5Pset_virtual (dcpl, space, SRC_FILE[2*i+1], SRC_DATASET[2*i+1], nsrc_space);
- }
-
- /* Create a virtual dataset */
- dset = H5Dcreate2 (file, DATASET, H5T_NATIVE_INT, space, H5P_DEFAULT,
- dcpl, H5P_DEFAULT);
- status = H5Sclose (space);
- status = H5Sclose (nsrc_space);
- status = H5Sclose (ksrc_space);
- status = H5Dclose (dset);
- status = H5Fclose (file);
-
+ /*
+ * Build the mappings for A, C and E source datasets.
+ * Unlimited hyperslab selection is the same in the source datasets.
+ * Unlimited hyperslab selections in the virtual dataset have different offsets.
+ */
+ status = H5Sselect_hyperslab(ksrc_space, H5S_SELECT_SET, start, NULL, count, block);
+ for (i = 0; i < 3; i++) {
+ start[1] = (hsize_t)((k + n) * i);
+ status = H5Sselect_hyperslab(space, H5S_SELECT_SET, start, NULL, count, block);
+ status = H5Pset_virtual(dcpl, space, SRC_FILE[2 * i], SRC_DATASET[2 * i], ksrc_space);
+ }
+
+ /* Reinitialize start[1] and block[1] to build the second set of mappings. */
+ start[1] = 0;
+ block[1] = n;
+ /*
+ * Build the mappings for B, D and F source datasets.
+ * Unlimited hyperslab selection is the same in the source datasets.
+ * Unlimited hyperslab selections in the virtual dataset have different offsets.
+ */
+ status = H5Sselect_hyperslab(nsrc_space, H5S_SELECT_SET, start, NULL, count, block);
+ for (i = 0; i < 3; i++) {
+ start[1] = (hsize_t)(k + (k + n) * i);
+ status = H5Sselect_hyperslab(space, H5S_SELECT_SET, start, NULL, count, block);
+ status = H5Pset_virtual(dcpl, space, SRC_FILE[2 * i + 1], SRC_DATASET[2 * i + 1], nsrc_space);
+ }
+
+ /* Create a virtual dataset */
+ dset = H5Dcreate2(file, DATASET, H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ status = H5Sclose(space);
+ status = H5Sclose(nsrc_space);
+ status = H5Sclose(ksrc_space);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
/*
* Now we begin the read section of this example.
@@ -153,85 +126,92 @@ main (void)
/*
* Open file and dataset using the default properties.
*/
- file = H5Fopen (FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
- dset = H5Dopen2 (file, DATASET, H5P_DEFAULT);
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen2(file, DATASET, H5P_DEFAULT);
/*
* Get creation property list and mapping properties.
*/
- dcpl = H5Dget_create_plist (dset);
+ dcpl = H5Dget_create_plist(dset);
/*
* Get storage layout.
*/
- layout = H5Pget_layout (dcpl);
+ layout = H5Pget_layout(dcpl);
if (H5D_VIRTUAL == layout)
printf(" Dataset has a virtual layout \n");
else
printf("Wrong layout found \n");
- /*
- * Find number of mappings.
- */
- status = H5Pget_virtual_count (dcpl, &num_map);
- printf(" Number of mappings is %lu\n", (unsigned long)num_map);
-
- /*
- * Get mapping parameters for each mapping.
- */
- for (i = 0; i < (int)num_map; i++) {
- printf(" Mapping %d \n", i);
- printf(" Selection in the virtual dataset \n");
- /* Get selection in the virttual dataset */
- vspace = H5Pget_virtual_vspace (dcpl, (size_t)i);
- if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) {
- if (H5Sis_regular_hyperslab(vspace)) {
- status = H5Sget_regular_hyperslab (vspace, start_out, stride_out, count_out, block_out);
- printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0], (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
- printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0], (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
- printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0], (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
- printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0], (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
- }
- }
- /* Get source file name */
- len = H5Pget_virtual_filename (dcpl, (size_t)i, NULL, 0);
- filename = (char *)malloc((size_t)len*sizeof(char)+1);
- H5Pget_virtual_filename (dcpl, (size_t)i, filename, len+1);
- printf(" Source filename %s\n", filename);
-
- /* Get source dataset name */
- len = H5Pget_virtual_dsetname (dcpl, (size_t)i, NULL, 0);
- dsetname = (char *)malloc((size_t)len*sizeof(char)+1);
- H5Pget_virtual_dsetname (dcpl, (size_t)i, dsetname, len+1);
- printf(" Source dataset name %s\n", dsetname);
-
- /* Get selection in the source dataset */
- printf(" Selection in the source dataset \n");
- src_space = H5Pget_virtual_srcspace (dcpl, (size_t)i);
- if (H5Sget_select_type(src_space) == H5S_SEL_HYPERSLABS) {
- if (H5Sis_regular_hyperslab(vspace)) {
- status = H5Sget_regular_hyperslab (src_space, start_out, stride_out, count_out, block_out);
- printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0], (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
- printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0], (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
- printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0], (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
- printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0], (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
- }
- }
- H5Sclose(vspace);
- H5Sclose(src_space);
- free(filename);
- free(dsetname);
- }
-/* EIP read data back */
+ /*
+ * Find number of mappings.
+ */
+ status = H5Pget_virtual_count(dcpl, &num_map);
+ printf(" Number of mappings is %lu\n", (unsigned long)num_map);
+
+ /*
+ * Get mapping parameters for each mapping.
+ */
+ for (i = 0; i < (int)num_map; i++) {
+ printf(" Mapping %d \n", i);
+ printf(" Selection in the virtual dataset \n");
+ /* Get selection in the virttual dataset */
+ vspace = H5Pget_virtual_vspace(dcpl, (size_t)i);
+ if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) {
+ if (H5Sis_regular_hyperslab(vspace)) {
+ status = H5Sget_regular_hyperslab(vspace, start_out, stride_out, count_out, block_out);
+ printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0],
+ (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
+ printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0],
+ (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
+ printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0],
+ (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
+ printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0],
+ (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
+ }
+ }
+ /* Get source file name */
+ len = H5Pget_virtual_filename(dcpl, (size_t)i, NULL, 0);
+ filename = (char *)malloc((size_t)len * sizeof(char) + 1);
+ H5Pget_virtual_filename(dcpl, (size_t)i, filename, len + 1);
+ printf(" Source filename %s\n", filename);
+
+ /* Get source dataset name */
+ len = H5Pget_virtual_dsetname(dcpl, (size_t)i, NULL, 0);
+ dsetname = (char *)malloc((size_t)len * sizeof(char) + 1);
+ H5Pget_virtual_dsetname(dcpl, (size_t)i, dsetname, len + 1);
+ printf(" Source dataset name %s\n", dsetname);
+
+ /* Get selection in the source dataset */
+ printf(" Selection in the source dataset \n");
+ src_space = H5Pget_virtual_srcspace(dcpl, (size_t)i);
+ if (H5Sget_select_type(src_space) == H5S_SEL_HYPERSLABS) {
+ if (H5Sis_regular_hyperslab(vspace)) {
+ status = H5Sget_regular_hyperslab(src_space, start_out, stride_out, count_out, block_out);
+ printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0],
+ (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
+ printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0],
+ (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
+ printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0],
+ (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
+ printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0],
+ (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
+ }
+ }
+ H5Sclose(vspace);
+ H5Sclose(src_space);
+ free(filename);
+ free(dsetname);
+ }
+ /* EIP read data back */
/*
* Close and release resources.
*/
- status = H5Pclose (dcpl);
- status = H5Dclose (dset);
- status = H5Fclose (file);
+ status = H5Pclose(dcpl);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
return 0;
}
-
diff --git a/examples/h5_vds-exclim.c b/examples/h5_vds-exclim.c
index 152731c..559799b 100644
--- a/examples/h5_vds-exclim.c
+++ b/examples/h5_vds-exclim.c
@@ -23,77 +23,53 @@
#include <stdio.h>
#include <stdlib.h>
-#define FILE "vds-exclim.h5"
-#define DATASET "VDS-Excaliburlim"
-#define VDSDIM0 3
-#define VDSDIM1 15
-#define VDSDIM2 6
-#define KDIM0 3
-#define KDIM1 2
-#define KDIM2 6
-#define NDIM0 3
-#define NDIM1 3
-#define NDIM2 6
-#define RANK 3
-
-const char *SRC_FILE[] = {
- "a.h5",
- "b.h5",
- "c.h5",
- "d.h5",
- "e.h5",
- "f.h5"
-};
-
-const char *SRC_DATASET[] = {
- "A",
- "B",
- "C",
- "D",
- "E",
- "F"
-};
+#define FILE "vds-exclim.h5"
+#define DATASET "VDS-Excaliburlim"
+#define VDSDIM0 3
+#define VDSDIM1 15
+#define VDSDIM2 6
+#define KDIM0 3
+#define KDIM1 2
+#define KDIM2 6
+#define NDIM0 3
+#define NDIM1 3
+#define NDIM2 6
+#define RANK 3
+
+const char *SRC_FILE[] = {"a.h5", "b.h5", "c.h5", "d.h5", "e.h5", "f.h5"};
+
+const char *SRC_DATASET[] = {"A", "B", "C", "D", "E", "F"};
int
-main (void)
+main(void)
{
- hid_t file, space, ksrc_space, nsrc_space, vspace,
- src_space,
- dset; /* Handles */
- hid_t dcpl;
- herr_t status;
- hsize_t vdsdims[3] = {VDSDIM0, VDSDIM1, VDSDIM2},
- kdims[3] = {KDIM0, KDIM1, KDIM2},
- ndims[3] = {NDIM0, NDIM1, NDIM2},
- start[3], /* Hyperslab parameters */
- stride[3],
- count[3],
- block[3];
- hsize_t start_out[3],
- stride_out[3],
- count_out[3],
- block_out[3];
+ hid_t file, space, ksrc_space, nsrc_space, vspace, src_space, dset; /* Handles */
+ hid_t dcpl;
+ herr_t status;
+ hsize_t vdsdims[3] = {VDSDIM0, VDSDIM1, VDSDIM2}, kdims[3] = {KDIM0, KDIM1, KDIM2},
+ ndims[3] = {NDIM0, NDIM1, NDIM2}, start[3], /* Hyperslab parameters */
+ stride[3], count[3], block[3];
+ hsize_t start_out[3], stride_out[3], count_out[3], block_out[3];
int k = 2;
int n = 3;
int i;
- H5D_layout_t layout; /* Storage layout */
- size_t num_map; /* Number of mappings */
- ssize_t len; /* Length of the string; also a return value */
- char *filename;
- char *dsetname;
+ H5D_layout_t layout; /* Storage layout */
+ size_t num_map; /* Number of mappings */
+ ssize_t len; /* Length of the string; also a return value */
+ char * filename;
+ char * dsetname;
-
- file = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Create VDS dataspace. */
- space = H5Screate_simple (RANK, vdsdims, NULL);
+ space = H5Screate_simple(RANK, vdsdims, NULL);
/* Create dataspaces for A, C, and E datasets. */
- ksrc_space = H5Screate_simple (RANK, kdims, NULL);
+ ksrc_space = H5Screate_simple(RANK, kdims, NULL);
/* Create dataspaces for B, D, and F datasets. */
- nsrc_space = H5Screate_simple (RANK, ndims, NULL);
+ nsrc_space = H5Screate_simple(RANK, ndims, NULL);
/* Create VDS creation property */
- dcpl = H5Pcreate (H5P_DATASET_CREATE);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
/* Initialize hyperslab values */
@@ -107,40 +83,38 @@ main (void)
block[1] = k;
block[2] = VDSDIM2;
- /*
- * Build the mappings for A, C and E source datasets.
- *
- */
- status = H5Sselect_hyperslab (ksrc_space, H5S_SELECT_SET, start, NULL, count, block);
- for (i = 0; i < 3; i++) {
- start[1] = (hsize_t)((k+n)*i);
- status = H5Sselect_hyperslab (space, H5S_SELECT_SET, start, NULL, count, block);
- status = H5Pset_virtual (dcpl, space, SRC_FILE[2*i], SRC_DATASET[2*i], ksrc_space);
- }
-
- /* Reinitialize start[0] and block[1] */
- start[0] = 0;
- block[1] = n;
- /*
- * Build the mappings for B, D and F source datasets.
- *
- */
- status = H5Sselect_hyperslab (nsrc_space, H5S_SELECT_SET, start, NULL, count, block);
- for (i = 0; i < 3; i++) {
- start[1] = (hsize_t)(k+(k+n)*i);
- status = H5Sselect_hyperslab (space, H5S_SELECT_SET, start, NULL, count, block);
- status = H5Pset_virtual (dcpl, space, SRC_FILE[2*i+1], SRC_DATASET[2*i+1], nsrc_space);
- }
-
- /* Create a virtual dataset */
- dset = H5Dcreate2 (file, DATASET, H5T_NATIVE_INT, space, H5P_DEFAULT,
- dcpl, H5P_DEFAULT);
- status = H5Sclose (space);
- status = H5Sclose (nsrc_space);
- status = H5Sclose (ksrc_space);
- status = H5Dclose (dset);
- status = H5Fclose (file);
-
+ /*
+ * Build the mappings for A, C and E source datasets.
+ *
+ */
+ status = H5Sselect_hyperslab(ksrc_space, H5S_SELECT_SET, start, NULL, count, block);
+ for (i = 0; i < 3; i++) {
+ start[1] = (hsize_t)((k + n) * i);
+ status = H5Sselect_hyperslab(space, H5S_SELECT_SET, start, NULL, count, block);
+ status = H5Pset_virtual(dcpl, space, SRC_FILE[2 * i], SRC_DATASET[2 * i], ksrc_space);
+ }
+
+ /* Reinitialize start[0] and block[1] */
+ start[0] = 0;
+ block[1] = n;
+ /*
+ * Build the mappings for B, D and F source datasets.
+ *
+ */
+ status = H5Sselect_hyperslab(nsrc_space, H5S_SELECT_SET, start, NULL, count, block);
+ for (i = 0; i < 3; i++) {
+ start[1] = (hsize_t)(k + (k + n) * i);
+ status = H5Sselect_hyperslab(space, H5S_SELECT_SET, start, NULL, count, block);
+ status = H5Pset_virtual(dcpl, space, SRC_FILE[2 * i + 1], SRC_DATASET[2 * i + 1], nsrc_space);
+ }
+
+ /* Create a virtual dataset */
+ dset = H5Dcreate2(file, DATASET, H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ status = H5Sclose(space);
+ status = H5Sclose(nsrc_space);
+ status = H5Sclose(ksrc_space);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
/*
* Now we begin the read section of this example.
@@ -149,85 +123,92 @@ main (void)
/*
* Open file and dataset using the default properties.
*/
- file = H5Fopen (FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
- dset = H5Dopen2 (file, DATASET, H5P_DEFAULT);
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen2(file, DATASET, H5P_DEFAULT);
/*
* Get creation property list and mapping properties.
*/
- dcpl = H5Dget_create_plist (dset);
+ dcpl = H5Dget_create_plist(dset);
/*
* Get storage layout.
*/
- layout = H5Pget_layout (dcpl);
+ layout = H5Pget_layout(dcpl);
if (H5D_VIRTUAL == layout)
printf(" Dataset has a virtual layout \n");
else
printf("Wrong layout found \n");
- /*
- * Find number of mappings.
- */
- status = H5Pget_virtual_count (dcpl, &num_map);
- printf(" Number of mappings is %lu\n", (unsigned long)num_map);
-
- /*
- * Get mapping parameters for each mapping.
- */
- for (i = 0; i < (int)num_map; i++) {
- printf(" Mapping %d \n", i);
- printf(" Selection in the virtual dataset \n");
- /* Get selection in the virttual dataset */
- vspace = H5Pget_virtual_vspace (dcpl, (size_t)i);
- if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) {
- if (H5Sis_regular_hyperslab(vspace)) {
- status = H5Sget_regular_hyperslab (vspace, start_out, stride_out, count_out, block_out);
- printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0], (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
- printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0], (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
- printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0], (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
- printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0], (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
- }
- }
- /* Get source file name */
- len = H5Pget_virtual_filename (dcpl, (size_t)i, NULL, 0);
- filename = (char *)malloc((size_t)len*sizeof(char)+1);
- H5Pget_virtual_filename (dcpl, (size_t)i, filename, len+1);
- printf(" Source filename %s\n", filename);
-
- /* Get source dataset name */
- len = H5Pget_virtual_dsetname (dcpl, (size_t)i, NULL, 0);
- dsetname = (char *)malloc((size_t)len*sizeof(char)+1);
- H5Pget_virtual_dsetname (dcpl, (size_t)i, dsetname, len+1);
- printf(" Source dataset name %s\n", dsetname);
-
- /* Get selection in the source dataset */
- printf(" Selection in the source dataset \n");
- src_space = H5Pget_virtual_srcspace (dcpl, (size_t)i);
- if(H5Sget_select_type(src_space) == H5S_SEL_HYPERSLABS) {
- if (H5Sis_regular_hyperslab(vspace)) {
- status = H5Sget_regular_hyperslab (vspace, start_out, stride_out, count_out, block_out);
- printf(" start = [%d, %d, %d] \n", (int)start_out[0], (int)start_out[1], (int)start_out[2]);
- printf(" stride = [%d, %d, %d] \n", (int)stride_out[0], (int)stride_out[1], (int)stride_out[2]);
- printf(" count = [%d, %d, %d] \n", (int)count_out[0], (int)count_out[1], (int)count_out[2]);
- printf(" block = [%d, %d, %d] \n", (int)block_out[0], (int)block_out[1], (int)block_out[2]);
- }
- }
- H5Sclose(vspace);
- H5Sclose(src_space);
- free(filename);
- free(dsetname);
- }
-/* EIP read data back */
+ /*
+ * Find number of mappings.
+ */
+ status = H5Pget_virtual_count(dcpl, &num_map);
+ printf(" Number of mappings is %lu\n", (unsigned long)num_map);
+
+ /*
+ * Get mapping parameters for each mapping.
+ */
+ for (i = 0; i < (int)num_map; i++) {
+ printf(" Mapping %d \n", i);
+ printf(" Selection in the virtual dataset \n");
+ /* Get selection in the virttual dataset */
+ vspace = H5Pget_virtual_vspace(dcpl, (size_t)i);
+ if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) {
+ if (H5Sis_regular_hyperslab(vspace)) {
+ status = H5Sget_regular_hyperslab(vspace, start_out, stride_out, count_out, block_out);
+ printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0],
+ (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
+ printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0],
+ (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
+ printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0],
+ (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
+ printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0],
+ (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
+ }
+ }
+ /* Get source file name */
+ len = H5Pget_virtual_filename(dcpl, (size_t)i, NULL, 0);
+ filename = (char *)malloc((size_t)len * sizeof(char) + 1);
+ H5Pget_virtual_filename(dcpl, (size_t)i, filename, len + 1);
+ printf(" Source filename %s\n", filename);
+
+ /* Get source dataset name */
+ len = H5Pget_virtual_dsetname(dcpl, (size_t)i, NULL, 0);
+ dsetname = (char *)malloc((size_t)len * sizeof(char) + 1);
+ H5Pget_virtual_dsetname(dcpl, (size_t)i, dsetname, len + 1);
+ printf(" Source dataset name %s\n", dsetname);
+
+ /* Get selection in the source dataset */
+ printf(" Selection in the source dataset \n");
+ src_space = H5Pget_virtual_srcspace(dcpl, (size_t)i);
+ if (H5Sget_select_type(src_space) == H5S_SEL_HYPERSLABS) {
+ if (H5Sis_regular_hyperslab(vspace)) {
+ status = H5Sget_regular_hyperslab(vspace, start_out, stride_out, count_out, block_out);
+ printf(" start = [%d, %d, %d] \n", (int)start_out[0], (int)start_out[1],
+ (int)start_out[2]);
+ printf(" stride = [%d, %d, %d] \n", (int)stride_out[0], (int)stride_out[1],
+ (int)stride_out[2]);
+ printf(" count = [%d, %d, %d] \n", (int)count_out[0], (int)count_out[1],
+ (int)count_out[2]);
+ printf(" block = [%d, %d, %d] \n", (int)block_out[0], (int)block_out[1],
+ (int)block_out[2]);
+ }
+ }
+ H5Sclose(vspace);
+ H5Sclose(src_space);
+ free(filename);
+ free(dsetname);
+ }
+ /* EIP read data back */
/*
* Close and release resources.
*/
- status = H5Pclose (dcpl);
- status = H5Dclose (dset);
- status = H5Fclose (file);
+ status = H5Pclose(dcpl);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
return 0;
}
-
diff --git a/examples/h5_vds-percival-unlim-maxmin.c b/examples/h5_vds-percival-unlim-maxmin.c
index 7b0d532..01e41ef 100644
--- a/examples/h5_vds-percival-unlim-maxmin.c
+++ b/examples/h5_vds-percival-unlim-maxmin.c
@@ -26,185 +26,162 @@
#include <stdio.h>
#include <stdlib.h>
-#define VFILE "vds-percival-unlim-maxmin.h5"
-#define DATASET "VDS-Percival-unlim-maxmin"
-#define VDSDIM0 H5S_UNLIMITED
-#define VDSDIM1 10
-#define VDSDIM2 10
-
-#define DIM0 H5S_UNLIMITED
-#define DIM0_1 4 /* Initial size of the source datasets */
-#define DIM1 10
-#define DIM2 10
-#define RANK 3
-#define PLANE_STRIDE 4
-
-const char *SRC_FILE[] = {
- "a.h5",
- "b.h5",
- "c.h5",
- "d.h5"
-};
-
-const char *SRC_DATASET[] = {
- "A",
- "B",
- "C",
- "D"
-};
+#define VFILE "vds-percival-unlim-maxmin.h5"
+#define DATASET "VDS-Percival-unlim-maxmin"
+#define VDSDIM0 H5S_UNLIMITED
+#define VDSDIM1 10
+#define VDSDIM2 10
+
+#define DIM0 H5S_UNLIMITED
+#define DIM0_1 4 /* Initial size of the source datasets */
+#define DIM1 10
+#define DIM2 10
+#define RANK 3
+#define PLANE_STRIDE 4
+
+const char *SRC_FILE[] = {"a.h5", "b.h5", "c.h5", "d.h5"};
+
+const char *SRC_DATASET[] = {"A", "B", "C", "D"};
int
-main (void)
+main(void)
{
- hid_t vfile, file, src_space, mem_space, vspace,
- vdset, dset; /* Handles */
- hid_t dcpl, dapl;
- herr_t status;
- hsize_t vdsdims[3] = {4*DIM0_1, VDSDIM1, VDSDIM2},
- vdsdims_max[3] = {VDSDIM0, VDSDIM1, VDSDIM2},
- dims[3] = {DIM0_1, DIM1, DIM2},
- memdims[3] = {DIM0_1, DIM1, DIM2},
- extdims[3] = {0, DIM1, DIM2}, /* Dimensions of the extended source datasets */
- chunk_dims[3] = {DIM0_1, DIM1, DIM2},
- dims_max[3] = {DIM0, DIM1, DIM2},
- vdsdims_out[3],
- vdsdims_max_out[3],
- start[3], /* Hyperslab parameters */
- stride[3],
- count[3],
- src_count[3],
- block[3];
- hsize_t start_out[3], /* Hyperslab parameter out */
- stride_out[3],
- count_out[3],
- block_out[3];
+ hid_t vfile, file, src_space, mem_space, vspace, vdset, dset; /* Handles */
+ hid_t dcpl, dapl;
+ herr_t status;
+ hsize_t vdsdims[3] = {4 * DIM0_1, VDSDIM1, VDSDIM2}, vdsdims_max[3] = {VDSDIM0, VDSDIM1, VDSDIM2},
+ dims[3] = {DIM0_1, DIM1, DIM2}, memdims[3] = {DIM0_1, DIM1, DIM2},
+ extdims[3] = {0, DIM1, DIM2}, /* Dimensions of the extended source datasets */
+ chunk_dims[3] = {DIM0_1, DIM1, DIM2}, dims_max[3] = {DIM0, DIM1, DIM2}, vdsdims_out[3],
+ vdsdims_max_out[3], start[3], /* Hyperslab parameters */
+ stride[3], count[3], src_count[3], block[3];
+ hsize_t start_out[3], /* Hyperslab parameter out */
+ stride_out[3], count_out[3], block_out[3];
int i, j;
- H5D_layout_t layout; /* Storage layout */
- size_t num_map; /* Number of mappings */
- ssize_t len; /* Length of the string; also a return value */
- char *filename;
- char *dsetname;
- int wdata[DIM0_1*DIM1*DIM2];
+ H5D_layout_t layout; /* Storage layout */
+ size_t num_map; /* Number of mappings */
+ ssize_t len; /* Length of the string; also a return value */
+ char * filename;
+ char * dsetname;
+ int wdata[DIM0_1 * DIM1 * DIM2];
/*
* Create source files and datasets. This step is optional.
*/
- for (i=0; i < PLANE_STRIDE; i++) {
+ for (i = 0; i < PLANE_STRIDE; i++) {
/*
* Initialize data for i-th source dataset.
*/
- for (j = 0; j < DIM0_1*DIM1*DIM2; j++) wdata[j] = i+1;
+ for (j = 0; j < DIM0_1 * DIM1 * DIM2; j++)
+ wdata[j] = i + 1;
/*
* Create the source files and datasets. Write data to each dataset and
* close all resources.
*/
- file = H5Fcreate (SRC_FILE[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- src_space = H5Screate_simple (RANK, dims, dims_max);
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
- status = H5Pset_chunk (dcpl, RANK, chunk_dims);
- dset = H5Dcreate2 (file, SRC_DATASET[i], H5T_NATIVE_INT, src_space, H5P_DEFAULT,
- dcpl, H5P_DEFAULT);
- status = H5Dwrite (dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- wdata);
- status = H5Sclose (src_space);
- status = H5Pclose (dcpl);
- status = H5Dclose (dset);
- status = H5Fclose (file);
+ file = H5Fcreate(SRC_FILE[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ src_space = H5Screate_simple(RANK, dims, dims_max);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ status = H5Pset_chunk(dcpl, RANK, chunk_dims);
+ dset = H5Dcreate2(file, SRC_DATASET[i], H5T_NATIVE_INT, src_space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ status = H5Sclose(src_space);
+ status = H5Pclose(dcpl);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
}
- vfile = H5Fcreate (VFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ vfile = H5Fcreate(VFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Create VDS dataspace. */
- vspace = H5Screate_simple (RANK, vdsdims, vdsdims_max);
+ vspace = H5Screate_simple(RANK, vdsdims, vdsdims_max);
/* Create dataspaces for the source dataset. */
- src_space = H5Screate_simple (RANK, dims, dims_max);
+ src_space = H5Screate_simple(RANK, dims, dims_max);
/* Create VDS creation property */
- dcpl = H5Pcreate (H5P_DATASET_CREATE);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
/* Initialize hyperslab values */
- start[0] = 0;
- start[1] = 0;
- start[2] = 0;
- stride[0] = PLANE_STRIDE; /* we will select every fifth plane in VDS */
- stride[1] = 1;
- stride[2] = 1;
- count[0] = H5S_UNLIMITED;
- count[1] = 1;
- count[2] = 1;
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = PLANE_STRIDE; /* we will select every fifth plane in VDS */
+ stride[1] = 1;
+ stride[2] = 1;
+ count[0] = H5S_UNLIMITED;
+ count[1] = 1;
+ count[2] = 1;
src_count[0] = H5S_UNLIMITED;
src_count[1] = 1;
src_count[2] = 1;
- block[0] = 1;
- block[1] = DIM1;
- block[2] = DIM2;
+ block[0] = 1;
+ block[1] = DIM1;
+ block[2] = DIM2;
/*
* Build the mappings
*
*/
- status = H5Sselect_hyperslab (src_space, H5S_SELECT_SET, start, NULL, src_count, block);
- for (i=0; i < PLANE_STRIDE; i++) {
- status = H5Sselect_hyperslab (vspace, H5S_SELECT_SET, start, stride, count, block);
- status = H5Pset_virtual (dcpl, vspace, SRC_FILE[i], SRC_DATASET[i], src_space);
+ status = H5Sselect_hyperslab(src_space, H5S_SELECT_SET, start, NULL, src_count, block);
+ for (i = 0; i < PLANE_STRIDE; i++) {
+ status = H5Sselect_hyperslab(vspace, H5S_SELECT_SET, start, stride, count, block);
+ status = H5Pset_virtual(dcpl, vspace, SRC_FILE[i], SRC_DATASET[i], src_space);
start[0]++;
}
H5Sselect_none(vspace);
/* Create a virtual dataset */
- vdset = H5Dcreate2 (vfile, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT,
- dcpl, H5P_DEFAULT);
- status = H5Sclose (vspace);
- status = H5Sclose (src_space);
- status = H5Pclose (dcpl);
+ vdset = H5Dcreate2(vfile, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ status = H5Sclose(vspace);
+ status = H5Sclose(src_space);
+ status = H5Pclose(dcpl);
/* Let's add data to the source datasets and check new dimensions for VDS */
/* We will add only one plane to the first source dataset, two planes to the
second one, three to the third, and four to the forth. */
- for (i=0; i < PLANE_STRIDE; i++) {
+ for (i = 0; i < PLANE_STRIDE; i++) {
/*
* Initialize data for i-th source dataset.
*/
- for (j = 0; j < (i+1)*DIM1*DIM2; j++) wdata[j] = 10*(i+1);
+ for (j = 0; j < (i + 1) * DIM1 * DIM2; j++)
+ wdata[j] = 10 * (i + 1);
/*
* Open the source files and datasets. Appen data to each dataset and
* close all resources.
*/
- file = H5Fopen (SRC_FILE[i], H5F_ACC_RDWR, H5P_DEFAULT);
- dset = H5Dopen2 (file, SRC_DATASET[i], H5P_DEFAULT);
- extdims[0] = DIM0_1+i+1;
- status = H5Dset_extent (dset, extdims);
- src_space = H5Dget_space (dset);
- start[0] = DIM0_1;
- start[1] = 0;
- start[2] = 0;
- count[0] = 1;
- count[1] = 1;
- count[2] = 1;
- block[0] = i+1;
- block[1] = DIM1;
- block[2] = DIM2;
-
- memdims[0] = i+1;
- mem_space = H5Screate_simple(RANK, memdims, NULL);
- status = H5Sselect_hyperslab (src_space, H5S_SELECT_SET, start, NULL, count, block);
- status = H5Dwrite (dset, H5T_NATIVE_INT, mem_space, src_space, H5P_DEFAULT,
- wdata);
- status = H5Sclose (src_space);
- status = H5Dclose (dset);
- status = H5Fclose (file);
- }
-
- status = H5Dclose (vdset);
- status = H5Fclose (vfile);
+ file = H5Fopen(SRC_FILE[i], H5F_ACC_RDWR, H5P_DEFAULT);
+ dset = H5Dopen2(file, SRC_DATASET[i], H5P_DEFAULT);
+ extdims[0] = DIM0_1 + i + 1;
+ status = H5Dset_extent(dset, extdims);
+ src_space = H5Dget_space(dset);
+ start[0] = DIM0_1;
+ start[1] = 0;
+ start[2] = 0;
+ count[0] = 1;
+ count[1] = 1;
+ count[2] = 1;
+ block[0] = i + 1;
+ block[1] = DIM1;
+ block[2] = DIM2;
+
+ memdims[0] = i + 1;
+ mem_space = H5Screate_simple(RANK, memdims, NULL);
+ status = H5Sselect_hyperslab(src_space, H5S_SELECT_SET, start, NULL, count, block);
+ status = H5Dwrite(dset, H5T_NATIVE_INT, mem_space, src_space, H5P_DEFAULT, wdata);
+ status = H5Sclose(src_space);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
+ }
+
+ status = H5Dclose(vdset);
+ status = H5Fclose(vfile);
/*
* Now we begin the read section of this example.
@@ -213,108 +190,115 @@ main (void)
/*
* Open file and dataset using the default properties.
*/
- vfile = H5Fopen (VFILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ vfile = H5Fopen(VFILE, H5F_ACC_RDONLY, H5P_DEFAULT);
/*
* Open VDS using different access properties to use max or
* min extents depending on the sizes of the underlying datasets
*/
- dapl = H5Pcreate (H5P_DATASET_ACCESS);
+ dapl = H5Pcreate(H5P_DATASET_ACCESS);
- for(i = 0; i < 2; i++) {
- status = H5Pset_virtual_view (dapl, i ? H5D_VDS_LAST_AVAILABLE : H5D_VDS_FIRST_MISSING);
- vdset = H5Dopen2 (vfile, DATASET, dapl);
+ for (i = 0; i < 2; i++) {
+ status = H5Pset_virtual_view(dapl, i ? H5D_VDS_LAST_AVAILABLE : H5D_VDS_FIRST_MISSING);
+ vdset = H5Dopen2(vfile, DATASET, dapl);
/* Let's get space of the VDS and its dimension; we should get 32(or 20)x10x10 */
- vspace = H5Dget_space (vdset);
- H5Sget_simple_extent_dims (vspace, vdsdims_out, vdsdims_max_out);
- printf ("VDS dimensions, bounds = H5D_VDS_%s: ", i ? "LAST_AVAILABLE" : "FIRST_MISSING");
- for (j=0; j<RANK; j++)
- printf (" %d ", (int)vdsdims_out[j]);
- printf ("\n");
+ vspace = H5Dget_space(vdset);
+ H5Sget_simple_extent_dims(vspace, vdsdims_out, vdsdims_max_out);
+ printf("VDS dimensions, bounds = H5D_VDS_%s: ", i ? "LAST_AVAILABLE" : "FIRST_MISSING");
+ for (j = 0; j < RANK; j++)
+ printf(" %d ", (int)vdsdims_out[j]);
+ printf("\n");
/* Close */
- status = H5Dclose (vdset);
- status = H5Sclose (vspace);
+ status = H5Dclose(vdset);
+ status = H5Sclose(vspace);
}
- status = H5Pclose (dapl);
+ status = H5Pclose(dapl);
- vdset = H5Dopen2 (vfile, DATASET, H5P_DEFAULT);
+ vdset = H5Dopen2(vfile, DATASET, H5P_DEFAULT);
/*
* Get creation property list and mapping properties.
*/
- dcpl = H5Dget_create_plist (vdset);
+ dcpl = H5Dget_create_plist(vdset);
/*
* Get storage layout.
*/
- layout = H5Pget_layout (dcpl);
+ layout = H5Pget_layout(dcpl);
if (H5D_VIRTUAL == layout)
printf(" Dataset has a virtual layout \n");
else
printf(" Wrong layout found \n");
- /*
- * Find number of mappings.
- */
- status = H5Pget_virtual_count (dcpl, &num_map);
- printf(" Number of mappings is %lu\n", (unsigned long)num_map);
-
- /*
- * Get mapping parameters for each mapping.
- */
- for (i = 0; i < (int)num_map; i++) {
- printf(" Mapping %d \n", i);
- printf(" Selection in the virtual dataset \n");
- /* Get selection in the virttual dataset */
- vspace = H5Pget_virtual_vspace (dcpl, (size_t)i);
- if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) {
- if (H5Sis_regular_hyperslab(vspace)) {
- status = H5Sget_regular_hyperslab (vspace, start_out, stride_out, count_out, block_out);
- printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0], (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
- printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0], (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
- printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0], (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
- printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0], (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
- }
- }
- /* Get source file name */
- len = H5Pget_virtual_filename (dcpl, (size_t)i, NULL, 0);
- filename = (char *)malloc((size_t)len*sizeof(char)+1);
- H5Pget_virtual_filename (dcpl, (size_t)i, filename, len+1);
- printf(" Source filename %s\n", filename);
-
- /* Get source dataset name */
- len = H5Pget_virtual_dsetname (dcpl, (size_t)i, NULL, 0);
- dsetname = (char *)malloc((size_t)len*sizeof(char)+1);
- H5Pget_virtual_dsetname (dcpl, (size_t)i, dsetname, len+1);
- printf(" Source dataset name %s\n", dsetname);
-
- /* Get selection in the source dataset */
- printf(" Selection in the source dataset \n");
- src_space = H5Pget_virtual_srcspace (dcpl, (size_t)i);
- if (H5Sget_select_type(src_space) == H5S_SEL_HYPERSLABS) {
- if (H5Sis_regular_hyperslab(src_space)) {
- status = H5Sget_regular_hyperslab (src_space, start_out, stride_out, count_out, block_out);
- printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0], (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
- printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0], (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
- printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0], (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
- printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0], (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
- }
- }
- H5Sclose(vspace);
- H5Sclose(src_space);
- free(filename);
- free(dsetname);
- }
+ /*
+ * Find number of mappings.
+ */
+ status = H5Pget_virtual_count(dcpl, &num_map);
+ printf(" Number of mappings is %lu\n", (unsigned long)num_map);
+
+ /*
+ * Get mapping parameters for each mapping.
+ */
+ for (i = 0; i < (int)num_map; i++) {
+ printf(" Mapping %d \n", i);
+ printf(" Selection in the virtual dataset \n");
+ /* Get selection in the virttual dataset */
+ vspace = H5Pget_virtual_vspace(dcpl, (size_t)i);
+ if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) {
+ if (H5Sis_regular_hyperslab(vspace)) {
+ status = H5Sget_regular_hyperslab(vspace, start_out, stride_out, count_out, block_out);
+ printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0],
+ (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
+ printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0],
+ (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
+ printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0],
+ (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
+ printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0],
+ (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
+ }
+ }
+ /* Get source file name */
+ len = H5Pget_virtual_filename(dcpl, (size_t)i, NULL, 0);
+ filename = (char *)malloc((size_t)len * sizeof(char) + 1);
+ H5Pget_virtual_filename(dcpl, (size_t)i, filename, len + 1);
+ printf(" Source filename %s\n", filename);
+
+ /* Get source dataset name */
+ len = H5Pget_virtual_dsetname(dcpl, (size_t)i, NULL, 0);
+ dsetname = (char *)malloc((size_t)len * sizeof(char) + 1);
+ H5Pget_virtual_dsetname(dcpl, (size_t)i, dsetname, len + 1);
+ printf(" Source dataset name %s\n", dsetname);
+
+ /* Get selection in the source dataset */
+ printf(" Selection in the source dataset \n");
+ src_space = H5Pget_virtual_srcspace(dcpl, (size_t)i);
+ if (H5Sget_select_type(src_space) == H5S_SEL_HYPERSLABS) {
+ if (H5Sis_regular_hyperslab(src_space)) {
+ status = H5Sget_regular_hyperslab(src_space, start_out, stride_out, count_out, block_out);
+ printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0],
+ (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
+ printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0],
+ (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
+ printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0],
+ (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
+ printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0],
+ (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
+ }
+ }
+ H5Sclose(vspace);
+ H5Sclose(src_space);
+ free(filename);
+ free(dsetname);
+ }
/*
* Close and release resources.
*/
- status = H5Pclose (dcpl);
- status = H5Dclose (vdset);
- status = H5Fclose (vfile);
+ status = H5Pclose(dcpl);
+ status = H5Dclose(vdset);
+ status = H5Fclose(vfile);
return 0;
}
-
diff --git a/examples/h5_vds-percival-unlim.c b/examples/h5_vds-percival-unlim.c
index 0823f40..ff32506 100644
--- a/examples/h5_vds-percival-unlim.c
+++ b/examples/h5_vds-percival-unlim.c
@@ -24,190 +24,167 @@
#include <stdio.h>
#include <stdlib.h>
-#define VFILE "vds-percival-unlim.h5"
-#define DATASET "VDS-Percival-unlim"
-#define VDSDIM0 H5S_UNLIMITED
-#define VDSDIM1 10
-#define VDSDIM2 10
-
-#define DIM0 H5S_UNLIMITED
-#define DIM0_1 10 /* Initial size of the datasets */
-#define DIM1 10
-#define DIM2 10
-#define RANK 3
-#define PLANE_STRIDE 4
-
-const char *SRC_FILE[] = {
- "a.h5",
- "b.h5",
- "c.h5",
- "d.h5"
-};
-
-const char *SRC_DATASET[] = {
- "A",
- "B",
- "C",
- "D"
-};
+#define VFILE "vds-percival-unlim.h5"
+#define DATASET "VDS-Percival-unlim"
+#define VDSDIM0 H5S_UNLIMITED
+#define VDSDIM1 10
+#define VDSDIM2 10
+
+#define DIM0 H5S_UNLIMITED
+#define DIM0_1 10 /* Initial size of the datasets */
+#define DIM1 10
+#define DIM2 10
+#define RANK 3
+#define PLANE_STRIDE 4
+
+const char *SRC_FILE[] = {"a.h5", "b.h5", "c.h5", "d.h5"};
+
+const char *SRC_DATASET[] = {"A", "B", "C", "D"};
int
-main (void)
+main(void)
{
- hid_t vfile, file, src_space, mem_space, vspace,
- vdset, dset; /* Handles */
- hid_t dcpl;
- herr_t status;
- hsize_t vdsdims[3] = {4*DIM0_1, VDSDIM1, VDSDIM2},
- vdsdims_max[3] = {VDSDIM0, VDSDIM1, VDSDIM2},
- dims[3] = {DIM0_1, DIM1, DIM2},
- extdims[3] = {2*DIM0_1, DIM1, DIM2},
- chunk_dims[3] = {DIM0_1, DIM1, DIM2},
- dims_max[3] = {DIM0, DIM1, DIM2},
- vdsdims_out[3],
- vdsdims_max_out[3],
- start[3], /* Hyperslab parameters */
- stride[3],
- count[3],
- src_count[3],
- block[3];
- hsize_t start_out[3], /* Hyperslab parameter out */
- stride_out[3],
- count_out[3],
- block_out[3];
+ hid_t vfile, file, src_space, mem_space, vspace, vdset, dset; /* Handles */
+ hid_t dcpl;
+ herr_t status;
+ hsize_t vdsdims[3] = {4 * DIM0_1, VDSDIM1, VDSDIM2}, vdsdims_max[3] = {VDSDIM0, VDSDIM1, VDSDIM2},
+ dims[3] = {DIM0_1, DIM1, DIM2}, extdims[3] = {2 * DIM0_1, DIM1, DIM2},
+ chunk_dims[3] = {DIM0_1, DIM1, DIM2}, dims_max[3] = {DIM0, DIM1, DIM2}, vdsdims_out[3],
+ vdsdims_max_out[3], start[3], /* Hyperslab parameters */
+ stride[3], count[3], src_count[3], block[3];
+ hsize_t start_out[3], /* Hyperslab parameter out */
+ stride_out[3], count_out[3], block_out[3];
int i, j, k;
- H5D_layout_t layout; /* Storage layout */
- size_t num_map; /* Number of mappings */
- ssize_t len; /* Length of the string; also a return value */
- char *filename;
- char *dsetname;
- int wdata[DIM0_1*DIM1*DIM2];
+ H5D_layout_t layout; /* Storage layout */
+ size_t num_map; /* Number of mappings */
+ ssize_t len; /* Length of the string; also a return value */
+ char * filename;
+ char * dsetname;
+ int wdata[DIM0_1 * DIM1 * DIM2];
int rdata[80][10][10];
int a_rdata[20][10][10];
/*
* Create source files and datasets. This step is optional.
*/
- for (i=0; i < PLANE_STRIDE; i++) {
+ for (i = 0; i < PLANE_STRIDE; i++) {
/*
* Initialize data for i-th source dataset.
*/
- for (j = 0; j < DIM0_1*DIM1*DIM2; j++) wdata[j] = i+1;
+ for (j = 0; j < DIM0_1 * DIM1 * DIM2; j++)
+ wdata[j] = i + 1;
/*
* Create the source files and datasets. Write data to each dataset and
* close all resources.
*/
- file = H5Fcreate (SRC_FILE[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- src_space = H5Screate_simple (RANK, dims, dims_max);
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
- status = H5Pset_chunk (dcpl, RANK, chunk_dims);
- dset = H5Dcreate2 (file, SRC_DATASET[i], H5T_NATIVE_INT, src_space, H5P_DEFAULT,
- dcpl, H5P_DEFAULT);
- status = H5Dwrite (dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- wdata);
- status = H5Sclose (src_space);
- status = H5Pclose (dcpl);
- status = H5Dclose (dset);
- status = H5Fclose (file);
+ file = H5Fcreate(SRC_FILE[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ src_space = H5Screate_simple(RANK, dims, dims_max);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ status = H5Pset_chunk(dcpl, RANK, chunk_dims);
+ dset = H5Dcreate2(file, SRC_DATASET[i], H5T_NATIVE_INT, src_space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ status = H5Sclose(src_space);
+ status = H5Pclose(dcpl);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
}
- vfile = H5Fcreate (VFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ vfile = H5Fcreate(VFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Create VDS dataspace. */
- vspace = H5Screate_simple (RANK, vdsdims, vdsdims_max);
+ vspace = H5Screate_simple(RANK, vdsdims, vdsdims_max);
/* Create dataspaces for the source dataset. */
- src_space = H5Screate_simple (RANK, dims, dims_max);
+ src_space = H5Screate_simple(RANK, dims, dims_max);
/* Create VDS creation property */
- dcpl = H5Pcreate (H5P_DATASET_CREATE);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
/* Initialize hyperslab values */
- start[0] = 0;
- start[1] = 0;
- start[2] = 0;
- stride[0] = PLANE_STRIDE; /* we will select every fifth plane in VDS */
- stride[1] = 1;
- stride[2] = 1;
- count[0] = H5S_UNLIMITED;
- count[1] = 1;
- count[2] = 1;
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = PLANE_STRIDE; /* we will select every fifth plane in VDS */
+ stride[1] = 1;
+ stride[2] = 1;
+ count[0] = H5S_UNLIMITED;
+ count[1] = 1;
+ count[2] = 1;
src_count[0] = H5S_UNLIMITED;
src_count[1] = 1;
src_count[2] = 1;
- block[0] = 1;
- block[1] = DIM1;
- block[2] = DIM2;
+ block[0] = 1;
+ block[1] = DIM1;
+ block[2] = DIM2;
/*
* Build the mappings
*
*/
- status = H5Sselect_hyperslab (src_space, H5S_SELECT_SET, start, NULL, src_count, block);
- for (i=0; i < PLANE_STRIDE; i++) {
- status = H5Sselect_hyperslab (vspace, H5S_SELECT_SET, start, stride, count, block);
- status = H5Pset_virtual (dcpl, vspace, SRC_FILE[i], SRC_DATASET[i], src_space);
+ status = H5Sselect_hyperslab(src_space, H5S_SELECT_SET, start, NULL, src_count, block);
+ for (i = 0; i < PLANE_STRIDE; i++) {
+ status = H5Sselect_hyperslab(vspace, H5S_SELECT_SET, start, stride, count, block);
+ status = H5Pset_virtual(dcpl, vspace, SRC_FILE[i], SRC_DATASET[i], src_space);
start[0]++;
}
H5Sselect_none(vspace);
/* Create a virtual dataset */
- vdset = H5Dcreate2 (vfile, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT,
- dcpl, H5P_DEFAULT);
- status = H5Sclose (vspace);
- status = H5Sclose (src_space);
- status = H5Pclose (dcpl);
+ vdset = H5Dcreate2(vfile, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ status = H5Sclose(vspace);
+ status = H5Sclose(src_space);
+ status = H5Pclose(dcpl);
/* Let's get space of the VDS and its dimension; we should get 40x10x10 */
- vspace = H5Dget_space (vdset);
- H5Sget_simple_extent_dims (vspace, vdsdims_out, vdsdims_max_out);
- printf ("VDS dimensions first time \n");
- printf (" Current: ");
- for (i=0; i<RANK; i++)
- printf (" %d ", (int)vdsdims_out[i]);
- printf ("\n");
+ vspace = H5Dget_space(vdset);
+ H5Sget_simple_extent_dims(vspace, vdsdims_out, vdsdims_max_out);
+ printf("VDS dimensions first time \n");
+ printf(" Current: ");
+ for (i = 0; i < RANK; i++)
+ printf(" %d ", (int)vdsdims_out[i]);
+ printf("\n");
/* Let's add data to the source datasets and check new dimensions for VDS */
- for (i=0; i < PLANE_STRIDE; i++) {
+ for (i = 0; i < PLANE_STRIDE; i++) {
/*
* Initialize data for i-th source dataset.
*/
- for (j = 0; j < DIM0_1*DIM1*DIM2; j++) wdata[j] = 10*(i+1);
+ for (j = 0; j < DIM0_1 * DIM1 * DIM2; j++)
+ wdata[j] = 10 * (i + 1);
/*
* Create the source files and datasets. Write data to each dataset and
* close all resources.
*/
- file = H5Fopen (SRC_FILE[i], H5F_ACC_RDWR, H5P_DEFAULT);
- dset = H5Dopen2 (file, SRC_DATASET[i], H5P_DEFAULT);
- status = H5Dset_extent (dset, extdims);
- src_space = H5Dget_space (dset);
- start[0] = DIM0_1;
- start[1] = 0;
- start[2] = 0;
- count[0] = 1;
- count[1] = 1;
- count[2] = 1;
- block[0] = DIM0_1;
- block[1] = DIM1;
- block[2] = DIM2;
+ file = H5Fopen(SRC_FILE[i], H5F_ACC_RDWR, H5P_DEFAULT);
+ dset = H5Dopen2(file, SRC_DATASET[i], H5P_DEFAULT);
+ status = H5Dset_extent(dset, extdims);
+ src_space = H5Dget_space(dset);
+ start[0] = DIM0_1;
+ start[1] = 0;
+ start[2] = 0;
+ count[0] = 1;
+ count[1] = 1;
+ count[2] = 1;
+ block[0] = DIM0_1;
+ block[1] = DIM1;
+ block[2] = DIM2;
mem_space = H5Screate_simple(RANK, dims, NULL);
- status = H5Sselect_hyperslab (src_space, H5S_SELECT_SET, start, NULL, count, block);
- status = H5Dwrite (dset, H5T_NATIVE_INT, mem_space, src_space, H5P_DEFAULT,
- wdata);
- status = H5Sclose (src_space);
- status = H5Dclose (dset);
- status = H5Fclose (file);
- }
+ status = H5Sselect_hyperslab(src_space, H5S_SELECT_SET, start, NULL, count, block);
+ status = H5Dwrite(dset, H5T_NATIVE_INT, mem_space, src_space, H5P_DEFAULT, wdata);
+ status = H5Sclose(src_space);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
+ }
- status = H5Dclose (vdset);
- status = H5Fclose (vfile);
+ status = H5Dclose(vdset);
+ status = H5Fclose(vfile);
/*
* Now we begin the read section of this example.
@@ -216,86 +193,94 @@ main (void)
/*
* Open file and dataset using the default properties.
*/
- vfile = H5Fopen (VFILE, H5F_ACC_RDONLY, H5P_DEFAULT);
- vdset = H5Dopen2 (vfile, DATASET, H5P_DEFAULT);
+ vfile = H5Fopen(VFILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ vdset = H5Dopen2(vfile, DATASET, H5P_DEFAULT);
/*
* Get creation property list and mapping properties.
*/
- dcpl = H5Dget_create_plist (vdset);
+ dcpl = H5Dget_create_plist(vdset);
/*
* Get storage layout.
*/
- layout = H5Pget_layout (dcpl);
+ layout = H5Pget_layout(dcpl);
if (H5D_VIRTUAL == layout)
printf(" Dataset has a virtual layout \n");
else
printf(" Wrong layout found \n");
- /*
- * Find number of mappings.
- */
- status = H5Pget_virtual_count (dcpl, &num_map);
- printf(" Number of mappings is %lu\n", (unsigned long)num_map);
-
- /*
- * Get mapping parameters for each mapping.
- */
- for (i = 0; i < (int)num_map; i++) {
- printf(" Mapping %d \n", i);
- printf(" Selection in the virtual dataset \n");
- /* Get selection in the virttual dataset */
- vspace = H5Pget_virtual_vspace (dcpl, (size_t)i);
- if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) {
- if (H5Sis_regular_hyperslab(vspace)) {
- status = H5Sget_regular_hyperslab (vspace, start_out, stride_out, count_out, block_out);
- printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0], (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
- printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0], (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
- printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0], (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
- printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0], (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
- }
- }
- /* Get source file name */
- len = H5Pget_virtual_filename (dcpl, (size_t)i, NULL, 0);
- filename = (char *)malloc((size_t)len*sizeof(char)+1);
- H5Pget_virtual_filename (dcpl, (size_t)i, filename, len+1);
- printf(" Source filename %s\n", filename);
-
- /* Get source dataset name */
- len = H5Pget_virtual_dsetname (dcpl, (size_t)i, NULL, 0);
- dsetname = (char *)malloc((size_t)len*sizeof(char)+1);
- H5Pget_virtual_dsetname (dcpl, (size_t)i, dsetname, len+1);
- printf(" Source dataset name %s\n", dsetname);
-
- /* Get selection in the source dataset */
- printf(" Selection in the source dataset \n");
- src_space = H5Pget_virtual_srcspace (dcpl, (size_t)i);
- if (H5Sget_select_type(src_space) == H5S_SEL_HYPERSLABS) {
- if (H5Sis_regular_hyperslab(src_space)) {
- status = H5Sget_regular_hyperslab (src_space, start_out, stride_out, count_out, block_out);
- printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0], (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
- printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0], (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
- printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0], (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
- printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0], (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
- }
- }
- H5Sclose(vspace);
- H5Sclose(src_space);
- free(filename);
- free(dsetname);
- }
+ /*
+ * Find number of mappings.
+ */
+ status = H5Pget_virtual_count(dcpl, &num_map);
+ printf(" Number of mappings is %lu\n", (unsigned long)num_map);
+
+ /*
+ * Get mapping parameters for each mapping.
+ */
+ for (i = 0; i < (int)num_map; i++) {
+ printf(" Mapping %d \n", i);
+ printf(" Selection in the virtual dataset \n");
+ /* Get selection in the virttual dataset */
+ vspace = H5Pget_virtual_vspace(dcpl, (size_t)i);
+ if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) {
+ if (H5Sis_regular_hyperslab(vspace)) {
+ status = H5Sget_regular_hyperslab(vspace, start_out, stride_out, count_out, block_out);
+ printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0],
+ (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
+ printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0],
+ (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
+ printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0],
+ (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
+ printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0],
+ (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
+ }
+ }
+ /* Get source file name */
+ len = H5Pget_virtual_filename(dcpl, (size_t)i, NULL, 0);
+ filename = (char *)malloc((size_t)len * sizeof(char) + 1);
+ H5Pget_virtual_filename(dcpl, (size_t)i, filename, len + 1);
+ printf(" Source filename %s\n", filename);
+
+ /* Get source dataset name */
+ len = H5Pget_virtual_dsetname(dcpl, (size_t)i, NULL, 0);
+ dsetname = (char *)malloc((size_t)len * sizeof(char) + 1);
+ H5Pget_virtual_dsetname(dcpl, (size_t)i, dsetname, len + 1);
+ printf(" Source dataset name %s\n", dsetname);
+
+ /* Get selection in the source dataset */
+ printf(" Selection in the source dataset \n");
+ src_space = H5Pget_virtual_srcspace(dcpl, (size_t)i);
+ if (H5Sget_select_type(src_space) == H5S_SEL_HYPERSLABS) {
+ if (H5Sis_regular_hyperslab(src_space)) {
+ status = H5Sget_regular_hyperslab(src_space, start_out, stride_out, count_out, block_out);
+ printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0],
+ (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
+ printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0],
+ (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
+ printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0],
+ (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
+ printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0],
+ (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
+ }
+ }
+ H5Sclose(vspace);
+ H5Sclose(src_space);
+ free(filename);
+ free(dsetname);
+ }
/*
* Read data from VDS.
*/
- vspace = H5Dget_space (vdset);
- H5Sget_simple_extent_dims (vspace, vdsdims_out, vdsdims_max_out);
- printf ("VDS dimensions second time \n");
- printf (" Current: ");
- for (i=0; i<RANK; i++)
- printf (" %d ", (int)vdsdims_out[i]);
- printf ("\n");
+ vspace = H5Dget_space(vdset);
+ H5Sget_simple_extent_dims(vspace, vdsdims_out, vdsdims_max_out);
+ printf("VDS dimensions second time \n");
+ printf(" Current: ");
+ for (i = 0; i < RANK; i++)
+ printf(" %d ", (int)vdsdims_out[i]);
+ printf("\n");
/* Read all VDS data */
@@ -312,53 +297,50 @@ main (void)
block[1] = vdsdims_out[1];
block[2] = vdsdims_out[2];
- status = H5Sselect_hyperslab (vspace, H5S_SELECT_SET, start, NULL, count, block);
+ status = H5Sselect_hyperslab(vspace, H5S_SELECT_SET, start, NULL, count, block);
mem_space = H5Screate_simple(RANK, vdsdims_out, NULL);
- status = H5Dread (vdset, H5T_NATIVE_INT, mem_space, vspace, H5P_DEFAULT,
- rdata);
- printf (" All data: \n");
- for (i=0; i < (int)vdsdims_out[0]; i++) {
- for (j=0; j < (int)vdsdims_out[1]; j++) {
- printf ("(%d, %d, 0)", i, j);
- for (k=0; k < (int)vdsdims_out[2]; k++)
- printf (" %d ", rdata[i][j][k]);
- printf ("\n");
+ status = H5Dread(vdset, H5T_NATIVE_INT, mem_space, vspace, H5P_DEFAULT, rdata);
+ printf(" All data: \n");
+ for (i = 0; i < (int)vdsdims_out[0]; i++) {
+ for (j = 0; j < (int)vdsdims_out[1]; j++) {
+ printf("(%d, %d, 0)", i, j);
+ for (k = 0; k < (int)vdsdims_out[2]; k++)
+ printf(" %d ", rdata[i][j][k]);
+ printf("\n");
}
}
/* Read VDS, but only data mapeed to dataset a.h5 */
- start[0] = 0;
- start[1] = 0;
- start[2] = 0;
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
stride[0] = PLANE_STRIDE;
stride[1] = 1;
stride[2] = 1;
- count[0] = 2*DIM0_1;
- count[1] = 1;
- count[2] = 1;
- block[0] = 1;
- block[1] = vdsdims_out[1];
- block[2] = vdsdims_out[2];
- dims[0] = 2*DIM0_1;
- status = H5Sselect_hyperslab (vspace, H5S_SELECT_SET, start, stride, count, block);
- mem_space = H5Screate_simple(RANK, dims, NULL);
- status = H5Dread (vdset, H5T_NATIVE_INT, mem_space, vspace, H5P_DEFAULT,
- a_rdata);
- printf (" All data: \n");
- for (i=0; i < 2*DIM0_1; i++) {
- for (j=0; j < (int)vdsdims_out[1]; j++) {
- printf ("(%d, %d, 0)", i, j);
- for (k=0; k < (int)vdsdims_out[2]; k++)
- printf (" %d ", a_rdata[i][j][k]);
- printf ("\n");
+ count[0] = 2 * DIM0_1;
+ count[1] = 1;
+ count[2] = 1;
+ block[0] = 1;
+ block[1] = vdsdims_out[1];
+ block[2] = vdsdims_out[2];
+ dims[0] = 2 * DIM0_1;
+ status = H5Sselect_hyperslab(vspace, H5S_SELECT_SET, start, stride, count, block);
+ mem_space = H5Screate_simple(RANK, dims, NULL);
+ status = H5Dread(vdset, H5T_NATIVE_INT, mem_space, vspace, H5P_DEFAULT, a_rdata);
+ printf(" All data: \n");
+ for (i = 0; i < 2 * DIM0_1; i++) {
+ for (j = 0; j < (int)vdsdims_out[1]; j++) {
+ printf("(%d, %d, 0)", i, j);
+ for (k = 0; k < (int)vdsdims_out[2]; k++)
+ printf(" %d ", a_rdata[i][j][k]);
+ printf("\n");
}
}
/*
* Close and release resources.
*/
status = H5Sclose(mem_space);
- status = H5Pclose (dcpl);
- status = H5Dclose (vdset);
- status = H5Fclose (vfile);
+ status = H5Pclose(dcpl);
+ status = H5Dclose(vdset);
+ status = H5Fclose(vfile);
return 0;
}
-
diff --git a/examples/h5_vds-percival.c b/examples/h5_vds-percival.c
index aeca368..6d688d8 100644
--- a/examples/h5_vds-percival.c
+++ b/examples/h5_vds-percival.c
@@ -25,145 +25,126 @@
#include <stdio.h>
#include <stdlib.h>
-#define FILE "vds-percival.h5"
-#define DATASET "VDS-Percival"
+#define FILE "vds-percival.h5"
+#define DATASET "VDS-Percival"
/* later
#define VDSDIM0 H5S_UNLIMITED
*/
-#define VDSDIM0 40
-#define VDSDIM1 10
-#define VDSDIM2 10
+#define VDSDIM0 40
+#define VDSDIM1 10
+#define VDSDIM2 10
/* later
#define DIM0 H5S_UNLIMITED
*/
-#define DIM0 10
-#define DIM1 10
-#define DIM2 10
-#define RANK 3
-#define PLANE_STRIDE 4
-
-const char *SRC_FILE[] = {
- "a.h5",
- "b.h5",
- "c.h5",
- "d.h5"
-};
-
-const char *SRC_DATASET[] = {
- "A",
- "B",
- "C",
- "D"
-};
+#define DIM0 10
+#define DIM1 10
+#define DIM2 10
+#define RANK 3
+#define PLANE_STRIDE 4
+
+const char *SRC_FILE[] = {"a.h5", "b.h5", "c.h5", "d.h5"};
+
+const char *SRC_DATASET[] = {"A", "B", "C", "D"};
int
-main (void)
+main(void)
{
- hid_t file, src_space, vspace,
- dset; /* Handles */
- hid_t dcpl;
- herr_t status;
- hsize_t vdsdims[3] = {VDSDIM0, VDSDIM1, VDSDIM2},
- vdsdims_max[3] = {VDSDIM0, VDSDIM1, VDSDIM2},
- dims[3] = {DIM0, DIM1, DIM2},
- dims_max[3] = {DIM0, DIM1, DIM2},
- start[3], /* Hyperslab start parameter for VDS */
- stride[3],
- count[3],
- src_count[3],
- block[3];
- hsize_t start_out[3], /* Hyperslab parameter out */
- stride_out[3],
- count_out[3],
- block_out[3];
+ hid_t file, src_space, vspace, dset; /* Handles */
+ hid_t dcpl;
+ herr_t status;
+ hsize_t vdsdims[3] = {VDSDIM0, VDSDIM1, VDSDIM2}, vdsdims_max[3] = {VDSDIM0, VDSDIM1, VDSDIM2},
+ dims[3] = {DIM0, DIM1, DIM2}, dims_max[3] = {DIM0, DIM1, DIM2},
+ start[3], /* Hyperslab start parameter for VDS */
+ stride[3], count[3], src_count[3], block[3];
+ hsize_t start_out[3], /* Hyperslab parameter out */
+ stride_out[3], count_out[3], block_out[3];
int i, j;
- H5D_layout_t layout; /* Storage layout */
- size_t num_map; /* Number of mappings */
- ssize_t len; /* Length of the string; also a return value */
- char *filename;
- char *dsetname;
- int wdata[DIM0*DIM1*DIM2];
+ H5D_layout_t layout; /* Storage layout */
+ size_t num_map; /* Number of mappings */
+ ssize_t len; /* Length of the string; also a return value */
+ char * filename;
+ char * dsetname;
+ int wdata[DIM0 * DIM1 * DIM2];
/*
* Create source files and datasets. This step is optional.
*/
- for (i=0; i < PLANE_STRIDE; i++) {
+ for (i = 0; i < PLANE_STRIDE; i++) {
/*
* Initialize data for i-th source dataset.
*/
- for (j = 0; j < DIM0*DIM1*DIM2; j++) wdata[j] = i+1;
+ for (j = 0; j < DIM0 * DIM1 * DIM2; j++)
+ wdata[j] = i + 1;
/*
* Create the source files and datasets. Write data to each dataset and
* close all resources.
*/
- file = H5Fcreate (SRC_FILE[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- src_space = H5Screate_simple (RANK, dims, NULL);
- dset = H5Dcreate2 (file, SRC_DATASET[i], H5T_NATIVE_INT, src_space, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite (dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- wdata);
- status = H5Sclose (src_space);
- status = H5Dclose (dset);
- status = H5Fclose (file);
+ file = H5Fcreate(SRC_FILE[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ src_space = H5Screate_simple(RANK, dims, NULL);
+ dset = H5Dcreate2(file, SRC_DATASET[i], H5T_NATIVE_INT, src_space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ status = H5Sclose(src_space);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
}
- file = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Create VDS dataspace. */
- vspace = H5Screate_simple (RANK, vdsdims, vdsdims_max);
+ vspace = H5Screate_simple(RANK, vdsdims, vdsdims_max);
/* Create dataspaces for the source dataset. */
- src_space = H5Screate_simple (RANK, dims, dims_max);
+ src_space = H5Screate_simple(RANK, dims, dims_max);
/* Create VDS creation property */
- dcpl = H5Pcreate (H5P_DATASET_CREATE);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
/* Initialize hyperslab values */
- start[0] = 0;
- start[1] = 0;
- start[2] = 0;
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
stride[0] = PLANE_STRIDE; /* we will select every fifth plane in VDS */
stride[1] = 1;
stride[2] = 1;
-/* later
- count[0] = H5S_UNLIMITED;
-*/
- count[0] = VDSDIM0/4;
+ /* later
+ count[0] = H5S_UNLIMITED;
+ */
+ count[0] = VDSDIM0 / 4;
count[1] = 1;
count[2] = 1;
-/* later
- src_count[0] = H5S_UNLIMITED;
-*/
+ /* later
+ src_count[0] = H5S_UNLIMITED;
+ */
src_count[0] = DIM0;
src_count[1] = 1;
src_count[2] = 1;
- block[0] = 1;
- block[1] = DIM1;
- block[2] = DIM2;
+ block[0] = 1;
+ block[1] = DIM1;
+ block[2] = DIM2;
/*
* Build the mappings
*
*/
- status = H5Sselect_hyperslab (src_space, H5S_SELECT_SET, start, NULL, src_count, block);
- for (i=0; i < PLANE_STRIDE; i++) {
- status = H5Sselect_hyperslab (vspace, H5S_SELECT_SET, start, stride, count, block);
- status = H5Pset_virtual (dcpl, vspace, SRC_FILE[i], SRC_DATASET[i], src_space);
+ status = H5Sselect_hyperslab(src_space, H5S_SELECT_SET, start, NULL, src_count, block);
+ for (i = 0; i < PLANE_STRIDE; i++) {
+ status = H5Sselect_hyperslab(vspace, H5S_SELECT_SET, start, stride, count, block);
+ status = H5Pset_virtual(dcpl, vspace, SRC_FILE[i], SRC_DATASET[i], src_space);
start[0]++;
}
H5Sselect_none(vspace);
/* Create a virtual dataset */
- dset = H5Dcreate2 (file, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT,
- dcpl, H5P_DEFAULT);
- status = H5Sclose (vspace);
- status = H5Sclose (src_space);
- status = H5Dclose (dset);
- status = H5Fclose (file);
+ dset = H5Dcreate2(file, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ status = H5Sclose(vspace);
+ status = H5Sclose(src_space);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
/*
* Now we begin the read section of this example.
@@ -172,82 +153,89 @@ main (void)
/*
* Open file and dataset using the default properties.
*/
- file = H5Fopen (FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
- dset = H5Dopen2 (file, DATASET, H5P_DEFAULT);
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen2(file, DATASET, H5P_DEFAULT);
/*
* Get creation property list and mapping properties.
*/
- dcpl = H5Dget_create_plist (dset);
+ dcpl = H5Dget_create_plist(dset);
/*
* Get storage layout.
*/
- layout = H5Pget_layout (dcpl);
+ layout = H5Pget_layout(dcpl);
if (H5D_VIRTUAL == layout)
printf(" Dataset has a virtual layout \n");
else
printf(" Wrong layout found \n");
- /*
- * Find number of mappings.
- */
- status = H5Pget_virtual_count (dcpl, &num_map);
- printf(" Number of mappings is %lu\n", (unsigned long)num_map);
-
- /*
- * Get mapping parameters for each mapping.
- */
- for (i = 0; i < (int)num_map; i++) {
- printf(" Mapping %d \n", i);
- printf(" Selection in the virtual dataset \n");
- /* Get selection in the virttual dataset */
- vspace = H5Pget_virtual_vspace (dcpl, (size_t)i);
- if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) {
- if (H5Sis_regular_hyperslab(vspace)) {
- status = H5Sget_regular_hyperslab (vspace, start_out, stride_out, count_out, block_out);
- printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0], (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
- printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0], (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
- printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0], (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
- printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0], (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
- }
- }
- /* Get source file name */
- len = H5Pget_virtual_filename (dcpl, (size_t)i, NULL, 0);
- filename = (char *)malloc((size_t)len*sizeof(char)+1);
- H5Pget_virtual_filename (dcpl, (size_t)i, filename, len+1);
- printf(" Source filename %s\n", filename);
-
- /* Get source dataset name */
- len = H5Pget_virtual_dsetname (dcpl, (size_t)i, NULL, 0);
- dsetname = (char *)malloc((size_t)len*sizeof(char)+1);
- H5Pget_virtual_dsetname (dcpl, (size_t)i, dsetname, len+1);
- printf(" Source dataset name %s\n", dsetname);
-
- /* Get selection in the source dataset */
- printf(" Selection in the source dataset \n");
- src_space = H5Pget_virtual_srcspace (dcpl, (size_t)i);
- if (H5Sget_select_type(src_space) == H5S_SEL_HYPERSLABS) {
- if (H5Sis_regular_hyperslab(src_space)) {
- status = H5Sget_regular_hyperslab (src_space, start_out, stride_out, count_out, block_out);
- printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0], (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
- printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0], (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
- printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0], (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
- printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0], (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
- }
- }
- H5Sclose(vspace);
- H5Sclose(src_space);
- free(filename);
- free(dsetname);
- }
+ /*
+ * Find number of mappings.
+ */
+ status = H5Pget_virtual_count(dcpl, &num_map);
+ printf(" Number of mappings is %lu\n", (unsigned long)num_map);
+
+ /*
+ * Get mapping parameters for each mapping.
+ */
+ for (i = 0; i < (int)num_map; i++) {
+ printf(" Mapping %d \n", i);
+ printf(" Selection in the virtual dataset \n");
+ /* Get selection in the virttual dataset */
+ vspace = H5Pget_virtual_vspace(dcpl, (size_t)i);
+ if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) {
+ if (H5Sis_regular_hyperslab(vspace)) {
+ status = H5Sget_regular_hyperslab(vspace, start_out, stride_out, count_out, block_out);
+ printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0],
+ (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
+ printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0],
+ (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
+ printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0],
+ (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
+ printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0],
+ (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
+ }
+ }
+ /* Get source file name */
+ len = H5Pget_virtual_filename(dcpl, (size_t)i, NULL, 0);
+ filename = (char *)malloc((size_t)len * sizeof(char) + 1);
+ H5Pget_virtual_filename(dcpl, (size_t)i, filename, len + 1);
+ printf(" Source filename %s\n", filename);
+
+ /* Get source dataset name */
+ len = H5Pget_virtual_dsetname(dcpl, (size_t)i, NULL, 0);
+ dsetname = (char *)malloc((size_t)len * sizeof(char) + 1);
+ H5Pget_virtual_dsetname(dcpl, (size_t)i, dsetname, len + 1);
+ printf(" Source dataset name %s\n", dsetname);
+
+ /* Get selection in the source dataset */
+ printf(" Selection in the source dataset \n");
+ src_space = H5Pget_virtual_srcspace(dcpl, (size_t)i);
+ if (H5Sget_select_type(src_space) == H5S_SEL_HYPERSLABS) {
+ if (H5Sis_regular_hyperslab(src_space)) {
+ status = H5Sget_regular_hyperslab(src_space, start_out, stride_out, count_out, block_out);
+ printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0],
+ (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
+ printf(" stride = [%llu, %llu, %llu] \n", (unsigned long long)stride_out[0],
+ (unsigned long long)stride_out[1], (unsigned long long)stride_out[2]);
+ printf(" count = [%llu, %llu, %llu] \n", (unsigned long long)count_out[0],
+ (unsigned long long)count_out[1], (unsigned long long)count_out[2]);
+ printf(" block = [%llu, %llu, %llu] \n", (unsigned long long)block_out[0],
+ (unsigned long long)block_out[1], (unsigned long long)block_out[2]);
+ }
+ }
+ H5Sclose(vspace);
+ H5Sclose(src_space);
+ free(filename);
+ free(dsetname);
+ }
/*
* Close and release resources.
*/
- status = H5Pclose (dcpl);
- status = H5Dclose (dset);
- status = H5Fclose (file);
+ status = H5Pclose(dcpl);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
return 0;
}
-
diff --git a/examples/h5_vds-simpleIO.c b/examples/h5_vds-simpleIO.c
index 5fd5c52..f5d8901 100644
--- a/examples/h5_vds-simpleIO.c
+++ b/examples/h5_vds-simpleIO.c
@@ -27,61 +27,59 @@
#include <stdio.h>
#include <stdlib.h>
-#define FILE "vds-simpleIO.h5"
-#define DATASET "VDS"
-#define DIM1 6
-#define DIM0 4
-#define RANK 2
-
-#define SRC_FILE "a.h5"
-#define SRC_DATASET "/A"
+#define FILE "vds-simpleIO.h5"
+#define DATASET "VDS"
+#define DIM1 6
+#define DIM0 4
+#define RANK 2
+#define SRC_FILE "a.h5"
+#define SRC_DATASET "/A"
int
-main (void)
+main(void)
{
- hid_t file, space, src_space, vspace, dset; /* Handles */
- hid_t dcpl;
- herr_t status;
- hsize_t vdsdims[2] = {DIM0, DIM1}, /* Virtual dataset dimension */
- dims[2] = {DIM0, DIM1}; /* Source dataset dimensions */
- int wdata[DIM0][DIM1], /* Write buffer for source dataset */
- rdata[DIM0][DIM1], /* Read buffer for virtual dataset */
- i, j;
- H5D_layout_t layout; /* Storage layout */
- size_t num_map; /* Number of mappings */
- ssize_t len; /* Length of the string; also a return value */
- char *filename;
- char *dsetname;
+ hid_t file, space, src_space, vspace, dset; /* Handles */
+ hid_t dcpl;
+ herr_t status;
+ hsize_t vdsdims[2] = {DIM0, DIM1}, /* Virtual dataset dimension */
+ dims[2] = {DIM0, DIM1}; /* Source dataset dimensions */
+ int wdata[DIM0][DIM1], /* Write buffer for source dataset */
+ rdata[DIM0][DIM1], /* Read buffer for virtual dataset */
+ i, j;
+ H5D_layout_t layout; /* Storage layout */
+ size_t num_map; /* Number of mappings */
+ ssize_t len; /* Length of the string; also a return value */
+ char * filename;
+ char * dsetname;
/*
* Initialize data.
*/
- for (i = 0; i < DIM0; i++)
- for (j = 0; j < DIM1; j++) wdata[i][j] = i+1;
-
- /*
- * Create the source file and the dataset. Write data to the source dataset
- * and close all resources.
- */
-
- file = H5Fcreate (SRC_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- space = H5Screate_simple (RANK, dims, NULL);
- dset = H5Dcreate2 (file, SRC_DATASET, H5T_NATIVE_INT, space, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite (dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- wdata[0]);
- status = H5Sclose (space);
- status = H5Dclose (dset);
- status = H5Fclose (file);
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ wdata[i][j] = i + 1;
+
+ /*
+ * Create the source file and the dataset. Write data to the source dataset
+ * and close all resources.
+ */
+
+ file = H5Fcreate(SRC_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(RANK, dims, NULL);
+ dset = H5Dcreate2(file, SRC_DATASET, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]);
+ status = H5Sclose(space);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
/* Create file in which virtual dataset will be stored. */
- file = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Create VDS dataspace. */
- vspace = H5Screate_simple (RANK, vdsdims, NULL);
+ vspace = H5Screate_simple(RANK, vdsdims, NULL);
/* Set VDS creation property. */
- dcpl = H5Pcreate (H5P_DATASET_CREATE);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
/*
* Build the mappings.
@@ -89,16 +87,15 @@ main (void)
* In the virtual dataset we select the first, the second and the third rows
* and map each row to the data in the corresponding source dataset.
*/
- src_space = H5Screate_simple (RANK, dims, NULL);
- status = H5Pset_virtual (dcpl, vspace, SRC_FILE, SRC_DATASET, src_space);
+ src_space = H5Screate_simple(RANK, dims, NULL);
+ status = H5Pset_virtual(dcpl, vspace, SRC_FILE, SRC_DATASET, src_space);
/* Create a virtual dataset. */
- dset = H5Dcreate2 (file, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT,
- dcpl, H5P_DEFAULT);
- status = H5Sclose (vspace);
- status = H5Sclose (src_space);
- status = H5Dclose (dset);
- status = H5Fclose (file);
+ dset = H5Dcreate2(file, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ status = H5Sclose(vspace);
+ status = H5Sclose(src_space);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
/*
* Now we begin the read section of this example.
@@ -107,60 +104,60 @@ main (void)
/*
* Open the file and virtual dataset.
*/
- file = H5Fopen (FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
- dset = H5Dopen2 (file, DATASET, H5P_DEFAULT);
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen2(file, DATASET, H5P_DEFAULT);
/*
* Get creation property list and mapping properties.
*/
- dcpl = H5Dget_create_plist (dset);
+ dcpl = H5Dget_create_plist(dset);
/*
* Get storage layout.
*/
- layout = H5Pget_layout (dcpl);
+ layout = H5Pget_layout(dcpl);
if (H5D_VIRTUAL == layout)
printf(" Dataset has a virtual layout \n");
else
printf(" Wrong layout found \n");
- /*
- * Find the number of mappings.
- */
- status = H5Pget_virtual_count (dcpl, &num_map);
- printf(" Number of mappings is %lu\n", (unsigned long)num_map);
+ /*
+ * Find the number of mappings.
+ */
+ status = H5Pget_virtual_count(dcpl, &num_map);
+ printf(" Number of mappings is %lu\n", (unsigned long)num_map);
- /*
- * Get mapping parameters for each mapping.
- */
+ /*
+ * Get mapping parameters for each mapping.
+ */
for (i = 0; i < (int)num_map; i++) {
printf(" Mapping %d \n", i);
printf(" Selection in the virtual dataset ");
/* Get selection in the virttual dataset */
- vspace = H5Pget_virtual_vspace (dcpl, (size_t)i);
+ vspace = H5Pget_virtual_vspace(dcpl, (size_t)i);
/* Make sure it is ALL selection and then print selection. */
- if(H5Sget_select_type(vspace) == H5S_SEL_ALL) {
- printf("Selection is H5S_ALL \n");
+ if (H5Sget_select_type(vspace) == H5S_SEL_ALL) {
+ printf("Selection is H5S_ALL \n");
}
/* Get source file name. */
- len = H5Pget_virtual_filename (dcpl, (size_t)i, NULL, 0);
- filename = (char *)malloc((size_t)len*sizeof(char)+1);
- H5Pget_virtual_filename (dcpl, (size_t)i, filename, len+1);
+ len = H5Pget_virtual_filename(dcpl, (size_t)i, NULL, 0);
+ filename = (char *)malloc((size_t)len * sizeof(char) + 1);
+ H5Pget_virtual_filename(dcpl, (size_t)i, filename, len + 1);
printf(" Source filename %s\n", filename);
/* Get source dataset name. */
- len = H5Pget_virtual_dsetname (dcpl, (size_t)i, NULL, 0);
- dsetname = (char *)malloc((size_t)len*sizeof(char)+1);
- H5Pget_virtual_dsetname (dcpl, (size_t)i, dsetname, len+1);
+ len = H5Pget_virtual_dsetname(dcpl, (size_t)i, NULL, 0);
+ dsetname = (char *)malloc((size_t)len * sizeof(char) + 1);
+ H5Pget_virtual_dsetname(dcpl, (size_t)i, dsetname, len + 1);
printf(" Source dataset name %s\n", dsetname);
/* Get selection in the source dataset. */
printf(" Selection in the source dataset ");
- src_space = H5Pget_virtual_srcspace (dcpl, (size_t)i);
+ src_space = H5Pget_virtual_srcspace(dcpl, (size_t)i);
/* Make sure it is ALL selection and then print selection. */
- if(H5Sget_select_type(src_space) == H5S_SEL_ALL) {
- printf("Selection is H5S_ALL \n");
+ if (H5Sget_select_type(src_space) == H5S_SEL_ALL) {
+ printf("Selection is H5S_ALL \n");
}
H5Sclose(vspace);
H5Sclose(src_space);
@@ -170,26 +167,24 @@ main (void)
/*
* Read the data using the default properties.
*/
- status = H5Dread (dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- rdata[0]);
+ status = H5Dread(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]);
/*
* Output the data to the screen.
*/
- printf (" VDS Data:\n");
- for (i=0; i<DIM0; i++) {
- printf (" [");
- for (j=0; j<DIM1; j++)
- printf (" %3d", rdata[i][j]);
- printf ("]\n");
+ printf(" VDS Data:\n");
+ for (i = 0; i < DIM0; i++) {
+ printf(" [");
+ for (j = 0; j < DIM1; j++)
+ printf(" %3d", rdata[i][j]);
+ printf("]\n");
}
/*
* Close and release resources.
*/
- status = H5Pclose (dcpl);
- status = H5Dclose (dset);
- status = H5Fclose (file);
+ status = H5Pclose(dcpl);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
return 0;
}
-
diff --git a/examples/h5_vds.c b/examples/h5_vds.c
index cce7b88..ad262f7 100644
--- a/examples/h5_vds.c
+++ b/examples/h5_vds.c
@@ -35,88 +35,74 @@
#include <stdio.h>
#include <stdlib.h>
-#define FILE "vds.h5"
-#define DATASET "VDS"
-#define VDSDIM1 6
-#define VDSDIM0 4
-#define DIM0 6
-#define RANK1 1
-#define RANK2 2
-
-const char *SRC_FILE[] = {
- "a.h5",
- "b.h5",
- "c.h5"
-};
-
-const char *SRC_DATASET[] = {
- "A",
- "B",
- "C"
-};
+#define FILE "vds.h5"
+#define DATASET "VDS"
+#define VDSDIM1 6
+#define VDSDIM0 4
+#define DIM0 6
+#define RANK1 1
+#define RANK2 2
+
+const char *SRC_FILE[] = {"a.h5", "b.h5", "c.h5"};
+
+const char *SRC_DATASET[] = {"A", "B", "C"};
int
-main (void)
+main(void)
{
- hid_t file, space, src_space, vspace, dset; /* Handles */
- hid_t dcpl;
- herr_t status;
- hsize_t vdsdims[2] = {VDSDIM0, VDSDIM1}, /* Virtual datasets dimension */
- dims[1] = {DIM0}, /* Source datasets dimensions */
- start[2], /* Hyperslab parameters */
- stride[2],
- count[2],
- block[2];
- hsize_t start_out[2],
- stride_out[2],
- count_out[2],
- block_out[2];
- int wdata[DIM0], /* Write buffer for source dataset */
- rdata[VDSDIM0][VDSDIM1], /* Read buffer for virtual dataset */
- i, j, k, l;
- int fill_value = -1; /* Fill value for VDS */
- H5D_layout_t layout; /* Storage layout */
- size_t num_map; /* Number of mappings */
- ssize_t len; /* Length of the string; also a return value */
- char *filename;
- char *dsetname;
+ hid_t file, space, src_space, vspace, dset; /* Handles */
+ hid_t dcpl;
+ herr_t status;
+ hsize_t vdsdims[2] = {VDSDIM0, VDSDIM1}, /* Virtual datasets dimension */
+ dims[1] = {DIM0}, /* Source datasets dimensions */
+ start[2], /* Hyperslab parameters */
+ stride[2], count[2], block[2];
+ hsize_t start_out[2], stride_out[2], count_out[2], block_out[2];
+ int wdata[DIM0], /* Write buffer for source dataset */
+ rdata[VDSDIM0][VDSDIM1], /* Read buffer for virtual dataset */
+ i, j, k, l;
+ int fill_value = -1; /* Fill value for VDS */
+ H5D_layout_t layout; /* Storage layout */
+ size_t num_map; /* Number of mappings */
+ ssize_t len; /* Length of the string; also a return value */
+ char * filename;
+ char * dsetname;
hsize_t nblocks;
- hsize_t *buf; /* Buffer to hold hyperslab coordinates */
+ hsize_t * buf; /* Buffer to hold hyperslab coordinates */
/*
* Create source files and datasets. This step is optional.
*/
- for (i=0; i < 3; i++) {
+ for (i = 0; i < 3; i++) {
/*
* Initialize data for i-th source dataset.
*/
- for (j = 0; j < DIM0; j++) wdata[j] = i+1;
+ for (j = 0; j < DIM0; j++)
+ wdata[j] = i + 1;
/*
* Create the source files and datasets. Write data to each dataset and
* close all resources.
*/
- file = H5Fcreate (SRC_FILE[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- space = H5Screate_simple (RANK1, dims, NULL);
- dset = H5Dcreate2 (file, SRC_DATASET[i], H5T_NATIVE_INT, space, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite (dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- wdata);
- status = H5Sclose (space);
- status = H5Dclose (dset);
- status = H5Fclose (file);
+ file = H5Fcreate(SRC_FILE[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(RANK1, dims, NULL);
+ dset = H5Dcreate2(file, SRC_DATASET[i], H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ status = H5Sclose(space);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
}
/* Create file in which virtual dataset will be stored. */
- file = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Create VDS dataspace. */
- space = H5Screate_simple (RANK2, vdsdims, NULL);
+ space = H5Screate_simple(RANK2, vdsdims, NULL);
/* Set VDS creation property. */
- dcpl = H5Pcreate (H5P_DATASET_CREATE);
- status = H5Pset_fill_value (dcpl, H5T_NATIVE_INT, &fill_value);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ status = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill_value);
/* Initialize hyperslab values. */
start[0] = 0;
@@ -132,21 +118,20 @@ main (void)
* In the virtual dataset we select the first, the second and the third rows
* and map each row to the data in the corresponding source dataset.
*/
- src_space = H5Screate_simple (RANK1, dims, NULL);
+ src_space = H5Screate_simple(RANK1, dims, NULL);
for (i = 0; i < 3; i++) {
start[0] = (hsize_t)i;
/* Select i-th row in the virtual dataset; selection in the source datasets is the same. */
- status = H5Sselect_hyperslab (space, H5S_SELECT_SET, start, NULL, count, block);
- status = H5Pset_virtual (dcpl, space, SRC_FILE[i], SRC_DATASET[i], src_space);
+ status = H5Sselect_hyperslab(space, H5S_SELECT_SET, start, NULL, count, block);
+ status = H5Pset_virtual(dcpl, space, SRC_FILE[i], SRC_DATASET[i], src_space);
}
/* Create a virtual dataset. */
- dset = H5Dcreate2 (file, DATASET, H5T_NATIVE_INT, space, H5P_DEFAULT,
- dcpl, H5P_DEFAULT);
- status = H5Sclose (space);
- status = H5Sclose (src_space);
- status = H5Dclose (dset);
- status = H5Fclose (file);
+ dset = H5Dcreate2(file, DATASET, H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ status = H5Sclose(space);
+ status = H5Sclose(src_space);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
/*
* Now we begin the read section of this example.
@@ -155,80 +140,84 @@ main (void)
/*
* Open the file and virtual dataset.
*/
- file = H5Fopen (FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
- dset = H5Dopen2 (file, DATASET, H5P_DEFAULT);
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dset = H5Dopen2(file, DATASET, H5P_DEFAULT);
/*
* Get creation property list and mapping properties.
*/
- dcpl = H5Dget_create_plist (dset);
+ dcpl = H5Dget_create_plist(dset);
/*
* Get storage layout.
*/
- layout = H5Pget_layout (dcpl);
+ layout = H5Pget_layout(dcpl);
if (H5D_VIRTUAL == layout)
printf(" Dataset has a virtual layout \n");
else
printf(" Wrong layout found \n");
- /*
- * Find the number of mappings.
- */
- status = H5Pget_virtual_count (dcpl, &num_map);
- printf(" Number of mappings is %lu\n", (unsigned long)num_map);
+ /*
+ * Find the number of mappings.
+ */
+ status = H5Pget_virtual_count(dcpl, &num_map);
+ printf(" Number of mappings is %lu\n", (unsigned long)num_map);
- /*
- * Get mapping parameters for each mapping.
- */
+ /*
+ * Get mapping parameters for each mapping.
+ */
for (i = 0; i < (int)num_map; i++) {
printf(" Mapping %d \n", i);
printf(" Selection in the virtual dataset ");
/* Get selection in the virttual dataset */
- vspace = H5Pget_virtual_vspace (dcpl, (size_t)i);
+ vspace = H5Pget_virtual_vspace(dcpl, (size_t)i);
/* Make sure that this is a hyperslab selection and then print information. */
if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) {
- nblocks = H5Sget_select_hyper_nblocks (vspace);
- buf = (hsize_t *)malloc(sizeof(hsize_t)*2*RANK2*nblocks);
- status = H5Sget_select_hyper_blocklist (vspace, (hsize_t)0, nblocks, buf);
- for (l=0; l<nblocks; l++) {
+ nblocks = H5Sget_select_hyper_nblocks(vspace);
+ buf = (hsize_t *)malloc(sizeof(hsize_t) * 2 * RANK2 * nblocks);
+ status = H5Sget_select_hyper_blocklist(vspace, (hsize_t)0, nblocks, buf);
+ for (l = 0; l < nblocks; l++) {
printf("(");
- for (k=0; k<RANK2-1; k++)
+ for (k = 0; k < RANK2 - 1; k++)
printf("%d,", (int)buf[k]);
printf("%d ) - (", (int)buf[k]);
- for (k=0; k<RANK2-1; k++)
- printf("%d,", (int)buf[RANK2+k]);
- printf("%d)\n", (int)buf[RANK2+k]);
+ for (k = 0; k < RANK2 - 1; k++)
+ printf("%d,", (int)buf[RANK2 + k]);
+ printf("%d)\n", (int)buf[RANK2 + k]);
}
- /* We also can use new APIs to get start, stride, count and block */
+ /* We also can use new APIs to get start, stride, count and block */
if (H5Sis_regular_hyperslab(vspace)) {
- status = H5Sget_regular_hyperslab (vspace, start_out, stride_out, count_out, block_out);
- printf(" start = [%llu, %llu] \n", (unsigned long long)start_out[0], (unsigned long long)start_out[1]);
- printf(" stride = [%llu, %llu] \n", (unsigned long long)stride_out[0], (unsigned long long)stride_out[1]);
- printf(" count = [%llu, %llu] \n", (unsigned long long)count_out[0], (unsigned long long)count_out[1]);
- printf(" block = [%llu, %llu] \n", (unsigned long long)block_out[0], (unsigned long long)block_out[1]);
+ status = H5Sget_regular_hyperslab(vspace, start_out, stride_out, count_out, block_out);
+ printf(" start = [%llu, %llu] \n", (unsigned long long)start_out[0],
+ (unsigned long long)start_out[1]);
+ printf(" stride = [%llu, %llu] \n", (unsigned long long)stride_out[0],
+ (unsigned long long)stride_out[1]);
+ printf(" count = [%llu, %llu] \n", (unsigned long long)count_out[0],
+ (unsigned long long)count_out[1]);
+ printf(" block = [%llu, %llu] \n", (unsigned long long)block_out[0],
+ (unsigned long long)block_out[1]);
}
}
/* Get source file name. */
- len = H5Pget_virtual_filename (dcpl, (size_t)i, NULL, 0);
- filename = (char *)malloc((size_t)len*sizeof(char)+1);
- H5Pget_virtual_filename (dcpl, (size_t)i, filename, len+1);
+ len = H5Pget_virtual_filename(dcpl, (size_t)i, NULL, 0);
+ filename = (char *)malloc((size_t)len * sizeof(char) + 1);
+ H5Pget_virtual_filename(dcpl, (size_t)i, filename, len + 1);
printf(" Source filename %s\n", filename);
/* Get source dataset name. */
- len = H5Pget_virtual_dsetname (dcpl, (size_t)i, NULL, 0);
- dsetname = (char *)malloc((size_t)len*sizeof(char)+1);
- H5Pget_virtual_dsetname (dcpl, (size_t)i, dsetname, len+1);
+ len = H5Pget_virtual_dsetname(dcpl, (size_t)i, NULL, 0);
+ dsetname = (char *)malloc((size_t)len * sizeof(char) + 1);
+ H5Pget_virtual_dsetname(dcpl, (size_t)i, dsetname, len + 1);
printf(" Source dataset name %s\n", dsetname);
/* Get selection in the source dataset. */
printf(" Selection in the source dataset ");
- src_space = H5Pget_virtual_srcspace (dcpl, (size_t)i);
+ src_space = H5Pget_virtual_srcspace(dcpl, (size_t)i);
/* Make sure it is ALL selection and then print the coordinates. */
- if(H5Sget_select_type(src_space) == H5S_SEL_ALL) {
- printf("(0) - (%d) \n", DIM0-1);
+ if (H5Sget_select_type(src_space) == H5S_SEL_ALL) {
+ printf("(0) - (%d) \n", DIM0 - 1);
}
H5Sclose(vspace);
H5Sclose(src_space);
@@ -240,26 +229,24 @@ main (void)
/*
* Read the data using the default properties.
*/
- status = H5Dread (dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- rdata[0]);
+ status = H5Dread(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]);
/*
* Output the data to the screen.
*/
- printf (" VDS Data:\n");
- for (i=0; i<VDSDIM0; i++) {
- printf (" [");
- for (j=0; j<VDSDIM1; j++)
- printf (" %3d", rdata[i][j]);
- printf ("]\n");
+ printf(" VDS Data:\n");
+ for (i = 0; i < VDSDIM0; i++) {
+ printf(" [");
+ for (j = 0; j < VDSDIM1; j++)
+ printf(" %3d", rdata[i][j]);
+ printf("]\n");
}
/*
* Close and release resources.
*/
- status = H5Pclose (dcpl);
- status = H5Dclose (dset);
- status = H5Fclose (file);
+ status = H5Pclose(dcpl);
+ status = H5Dclose(dset);
+ status = H5Fclose(file);
return 0;
}
-
diff --git a/examples/h5_write.c b/examples/h5_write.c
index 1a7cfe7..13e0eca 100644
--- a/examples/h5_write.c
+++ b/examples/h5_write.c
@@ -18,28 +18,28 @@
#include "hdf5.h"
-#define H5FILE_NAME "SDS.h5"
+#define H5FILE_NAME "SDS.h5"
#define DATASETNAME "IntArray"
-#define NX 5 /* dataset dimensions */
-#define NY 6
-#define RANK 2
+#define NX 5 /* dataset dimensions */
+#define NY 6
+#define RANK 2
int
-main (void)
+main(void)
{
- hid_t file, dataset; /* file and dataset handles */
- hid_t datatype, dataspace; /* handles */
- hsize_t dimsf[2]; /* dataset dimensions */
- herr_t status;
- int data[NX][NY]; /* data to write */
- int i, j;
+ hid_t file, dataset; /* file and dataset handles */
+ hid_t datatype, dataspace; /* handles */
+ hsize_t dimsf[2]; /* dataset dimensions */
+ herr_t status;
+ int data[NX][NY]; /* data to write */
+ int i, j;
/*
* Data and output buffer initialization.
*/
- for(j = 0; j < NX; j++)
- for(i = 0; i < NY; i++)
- data[j][i] = i + j;
+ for (j = 0; j < NX; j++)
+ for (i = 0; i < NY; i++)
+ data[j][i] = i + j;
/*
* 0 1 2 3 4 5
* 1 2 3 4 5 6
@@ -59,8 +59,8 @@ main (void)
* Describe the size of the array and create the data space for fixed
* size dataset.
*/
- dimsf[0] = NX;
- dimsf[1] = NY;
+ dimsf[0] = NX;
+ dimsf[1] = NY;
dataspace = H5Screate_simple(RANK, dimsf, NULL);
/*
@@ -68,14 +68,13 @@ main (void)
* We will store little endian INT numbers.
*/
datatype = H5Tcopy(H5T_NATIVE_INT);
- status = H5Tset_order(datatype, H5T_ORDER_LE);
+ status = H5Tset_order(datatype, H5T_ORDER_LE);
/*
* Create a new dataset within the file using defined dataspace and
* datatype and default dataset creation properties.
*/
- dataset = H5Dcreate2(file, DATASETNAME, datatype, dataspace,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(file, DATASETNAME, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
* Write the data to the dataset using default transfer properties.
@@ -92,4 +91,3 @@ main (void)
return 0;
}
-
diff --git a/examples/ph5example.c b/examples/ph5example.c
index d718479..06c8919 100644
--- a/examples/ph5example.c
+++ b/examples/ph5example.c
@@ -46,69 +46,73 @@
/* Define some handy debugging shorthands, routines, ... */
/* debugging tools */
-#define MESG(x)\
- if (verbose) printf("%s\n", x);\
-
-#define MPI_BANNER(mesg)\
- {printf("--------------------------------\n");\
- printf("Proc %d: ", mpi_rank); \
- printf("*** %s\n", mesg);\
- printf("--------------------------------\n");}
+#define MESG(x) \
+ if (verbose) \
+ printf("%s\n", x);
+
+#define MPI_BANNER(mesg) \
+ { \
+ printf("--------------------------------\n"); \
+ printf("Proc %d: ", mpi_rank); \
+ printf("*** %s\n", mesg); \
+ printf("--------------------------------\n"); \
+ }
-#define SYNC(comm)\
- {MPI_BANNER("doing a SYNC"); MPI_Barrier(comm); MPI_BANNER("SYNC DONE");}
+#define SYNC(comm) \
+ { \
+ MPI_BANNER("doing a SYNC"); \
+ MPI_Barrier(comm); \
+ MPI_BANNER("SYNC DONE"); \
+ }
/* End of Define some handy debugging shorthands, routines, ... */
/* Constants definitions */
/* 24 is a multiple of 2, 3, 4, 6, 8, 12. Neat for parallel tests. */
-#define SPACE1_DIM1 24
-#define SPACE1_DIM2 24
-#define SPACE1_RANK 2
-#define DATASETNAME1 "Data1"
-#define DATASETNAME2 "Data2"
-#define DATASETNAME3 "Data3"
+#define SPACE1_DIM1 24
+#define SPACE1_DIM2 24
+#define SPACE1_RANK 2
+#define DATASETNAME1 "Data1"
+#define DATASETNAME2 "Data2"
+#define DATASETNAME3 "Data3"
/* hyperslab layout styles */
-#define BYROW 1 /* divide into slabs of rows */
-#define BYCOL 2 /* divide into blocks of columns */
-
-#define PARAPREFIX "HDF5_PARAPREFIX" /* file prefix environment variable name */
+#define BYROW 1 /* divide into slabs of rows */
+#define BYCOL 2 /* divide into blocks of columns */
+#define PARAPREFIX "HDF5_PARAPREFIX" /* file prefix environment variable name */
/* dataset data type. Int's can be easily octo dumped. */
typedef int DATATYPE;
/* global variables */
-int nerrors = 0; /* errors count */
+int nerrors = 0; /* errors count */
#ifndef PATH_MAX
-#define PATH_MAX 512
-#endif /* !PATH_MAX */
-char testfiles[2][PATH_MAX];
+#define PATH_MAX 512
+#endif /* !PATH_MAX */
+char testfiles[2][PATH_MAX];
-
-int mpi_size, mpi_rank; /* mpi variables */
+int mpi_size, mpi_rank; /* mpi variables */
/* option flags */
-int verbose = 0; /* verbose, default as no. */
-int doread=1; /* read test */
-int dowrite=1; /* write test */
-int docleanup=1; /* cleanup */
+int verbose = 0; /* verbose, default as no. */
+int doread = 1; /* read test */
+int dowrite = 1; /* write test */
+int docleanup = 1; /* cleanup */
/* Prototypes */
void slab_set(hsize_t start[], hsize_t count[], hsize_t stride[], int mode);
-void dataset_fill(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dataset);
-void dataset_print(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dataset);
-int dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE *dataset, DATATYPE *original);
+void dataset_fill(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE *dataset);
+void dataset_print(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE *dataset);
+int dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE *dataset, DATATYPE *original);
void phdf5writeInd(char *filename);
void phdf5readInd(char *filename);
void phdf5writeAll(char *filename);
void phdf5readAll(char *filename);
void test_split_comm_access(char filenames[][PATH_MAX]);
-int parse_options(int argc, char **argv);
+int parse_options(int argc, char **argv);
void usage(void);
-int mkfilenames(char *prefix);
+int mkfilenames(char *prefix);
void cleanup(void);
-
/*
* Setup the dimensions of the hyperslab.
* Two modes--by rows or by columns.
@@ -117,113 +121,110 @@ void cleanup(void);
void
slab_set(hsize_t start[], hsize_t count[], hsize_t stride[], int mode)
{
- switch (mode){
- case BYROW:
- /* Each process takes a slabs of rows. */
- stride[0] = 1;
- stride[1] = 1;
- count[0] = SPACE1_DIM1/mpi_size;
- count[1] = SPACE1_DIM2;
- start[0] = mpi_rank*count[0];
- start[1] = 0;
- break;
- case BYCOL:
- /* Each process takes a block of columns. */
- stride[0] = 1;
- stride[1] = 1;
- count[0] = SPACE1_DIM1;
- count[1] = SPACE1_DIM2/mpi_size;
- start[0] = 0;
- start[1] = mpi_rank*count[1];
- break;
- default:
- /* Unknown mode. Set it to cover the whole dataset. */
- printf("unknown slab_set mode (%d)\n", mode);
- stride[0] = 1;
- stride[1] = 1;
- count[0] = SPACE1_DIM1;
- count[1] = SPACE1_DIM2;
- start[0] = 0;
- start[1] = 0;
- break;
+ switch (mode) {
+ case BYROW:
+ /* Each process takes a slabs of rows. */
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = SPACE1_DIM1 / mpi_size;
+ count[1] = SPACE1_DIM2;
+ start[0] = mpi_rank * count[0];
+ start[1] = 0;
+ break;
+ case BYCOL:
+ /* Each process takes a block of columns. */
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = SPACE1_DIM1;
+ count[1] = SPACE1_DIM2 / mpi_size;
+ start[0] = 0;
+ start[1] = mpi_rank * count[1];
+ break;
+ default:
+ /* Unknown mode. Set it to cover the whole dataset. */
+ printf("unknown slab_set mode (%d)\n", mode);
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = SPACE1_DIM1;
+ count[1] = SPACE1_DIM2;
+ start[0] = 0;
+ start[1] = 0;
+ break;
}
}
-
/*
* Fill the dataset with trivial data for testing.
* Assume dimension rank is 2 and data is stored contiguous.
*/
void
-dataset_fill(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dataset)
+dataset_fill(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE *dataset)
{
DATATYPE *dataptr = dataset;
- hsize_t i, j;
+ hsize_t i, j;
/* put some trivial data in the data_array */
- for (i=0; i < count[0]; i++){
- for (j=0; j < count[1]; j++){
- *dataptr++ = (i*stride[0]+start[0])*100 + (j*stride[1]+start[1]+1);
- }
+ for (i = 0; i < count[0]; i++) {
+ for (j = 0; j < count[1]; j++) {
+ *dataptr++ = (i * stride[0] + start[0]) * 100 + (j * stride[1] + start[1] + 1);
+ }
}
}
-
/*
* Print the content of the dataset.
*/
-void dataset_print(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dataset)
+void
+dataset_print(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE *dataset)
{
DATATYPE *dataptr = dataset;
- hsize_t i, j;
+ hsize_t i, j;
/* print the slab read */
- for (i=0; i < count[0]; i++){
- printf("Row %lu: ", (unsigned long)(i*stride[0]+start[0]));
- for (j=0; j < count[1]; j++){
- printf("%03d ", *dataptr++);
- }
- printf("\n");
+ for (i = 0; i < count[0]; i++) {
+ printf("Row %lu: ", (unsigned long)(i * stride[0] + start[0]));
+ for (j = 0; j < count[1]; j++) {
+ printf("%03d ", *dataptr++);
+ }
+ printf("\n");
}
}
-
/*
* Print the content of the dataset.
*/
-int dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE *dataset, DATATYPE *original)
+int
+dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE *dataset, DATATYPE *original)
{
-#define MAX_ERR_REPORT 10 /* Maximum number of errors reported */
+#define MAX_ERR_REPORT 10 /* Maximum number of errors reported */
hsize_t i, j;
- int nerr;
+ int nerr;
/* print it if verbose */
if (verbose)
- dataset_print(start, count, stride, dataset);
+ dataset_print(start, count, stride, dataset);
nerr = 0;
- for (i=0; i < count[0]; i++){
- for (j=0; j < count[1]; j++){
- if (*dataset++ != *original++){
- nerr++;
- if (nerr <= MAX_ERR_REPORT){
- printf("Dataset Verify failed at [%lu][%lu](row %lu, col %lu): expect %d, got %d\n",
- (unsigned long)i, (unsigned long)j,
- (unsigned long)(i*stride[0]+start[0]), (unsigned long)(j*stride[1]+start[1]),
- *(dataset-1), *(original-1));
- }
- }
- }
+ for (i = 0; i < count[0]; i++) {
+ for (j = 0; j < count[1]; j++) {
+ if (*dataset++ != *original++) {
+ nerr++;
+ if (nerr <= MAX_ERR_REPORT) {
+ printf("Dataset Verify failed at [%lu][%lu](row %lu, col %lu): expect %d, got %d\n",
+ (unsigned long)i, (unsigned long)j, (unsigned long)(i * stride[0] + start[0]),
+ (unsigned long)(j * stride[1] + start[1]), *(dataset - 1), *(original - 1));
+ }
+ }
+ }
}
if (nerr > MAX_ERR_REPORT)
- printf("[more errors ...]\n");
+ printf("[more errors ...]\n");
if (nerr)
- printf("%d errors found in dataset_vrfy\n", nerr);
- return(nerr);
+ printf("%d errors found in dataset_vrfy\n", nerr);
+ return (nerr);
}
-
/*
* Example of using the parallel HDF5 library to create two datasets
* in one HDF5 files with parallel MPIO access support.
@@ -235,32 +236,31 @@ int dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE *d
void
phdf5writeInd(char *filename)
{
- hid_t fid1; /* HDF5 file IDs */
- hid_t acc_tpl1; /* File access templates */
- hid_t sid1; /* Dataspace ID */
- hid_t file_dataspace; /* File dataspace ID */
- hid_t mem_dataspace; /* memory dataspace ID */
- hid_t dataset1, dataset2; /* Dataset ID */
- hsize_t dims1[SPACE1_RANK] =
- {SPACE1_DIM1,SPACE1_DIM2}; /* dataspace dim sizes */
- DATATYPE data_array1[SPACE1_DIM1][SPACE1_DIM2]; /* data buffer */
+ hid_t fid1; /* HDF5 file IDs */
+ hid_t acc_tpl1; /* File access templates */
+ hid_t sid1; /* Dataspace ID */
+ hid_t file_dataspace; /* File dataspace ID */
+ hid_t mem_dataspace; /* memory dataspace ID */
+ hid_t dataset1, dataset2; /* Dataset ID */
+ hsize_t dims1[SPACE1_RANK] = {SPACE1_DIM1, SPACE1_DIM2}; /* dataspace dim sizes */
+ DATATYPE data_array1[SPACE1_DIM1][SPACE1_DIM2]; /* data buffer */
- hsize_t start[SPACE1_RANK]; /* for hyperslab setting */
- hsize_t count[SPACE1_RANK], stride[SPACE1_RANK]; /* for hyperslab setting */
+ hsize_t start[SPACE1_RANK]; /* for hyperslab setting */
+ hsize_t count[SPACE1_RANK], stride[SPACE1_RANK]; /* for hyperslab setting */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
if (verbose)
- printf("Independent write test on file %s\n", filename);
+ printf("Independent write test on file %s\n", filename);
/* -------------------
* START AN HDF5 FILE
* -------------------*/
/* setup file access template with parallel IO access. */
- acc_tpl1 = H5Pcreate (H5P_FILE_ACCESS);
+ acc_tpl1 = H5Pcreate(H5P_FILE_ACCESS);
assert(acc_tpl1 != FAIL);
MESG("H5Pcreate access succeed");
/* set Parallel access with communicator */
@@ -277,70 +277,60 @@ phdf5writeInd(char *filename)
ret = H5Pclose(acc_tpl1);
assert(ret != FAIL);
-
/* --------------------------
* Define the dimensions of the overall datasets
* and the slabs local to the MPI process.
* ------------------------- */
/* setup dimensionality object */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
- assert (sid1 != FAIL);
+ assert(sid1 != FAIL);
MESG("H5Screate_simple succeed");
-
/* create a dataset collectively */
- dataset1 = H5Dcreate2(fid1, DATASETNAME1, H5T_NATIVE_INT, sid1,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset1 = H5Dcreate2(fid1, DATASETNAME1, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(dataset1 != FAIL);
MESG("H5Dcreate2 succeed");
/* create another dataset collectively */
- dataset2 = H5Dcreate2(fid1, DATASETNAME2, H5T_NATIVE_INT, sid1,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset2 = H5Dcreate2(fid1, DATASETNAME2, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(dataset2 != FAIL);
MESG("H5Dcreate2 succeed");
-
-
/* set up dimensions of the slab this process accesses */
- start[0] = mpi_rank*SPACE1_DIM1/mpi_size;
- start[1] = 0;
- count[0] = SPACE1_DIM1/mpi_size;
- count[1] = SPACE1_DIM2;
+ start[0] = mpi_rank * SPACE1_DIM1 / mpi_size;
+ start[1] = 0;
+ count[0] = SPACE1_DIM1 / mpi_size;
+ count[1] = SPACE1_DIM2;
stride[0] = 1;
- stride[1] =1;
-if (verbose)
- printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n",
- (unsigned long)start[0], (unsigned long)start[1],
- (unsigned long)count[0], (unsigned long)count[1],
- (unsigned long)(count[0]*count[1]));
+ stride[1] = 1;
+ if (verbose)
+ printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n", (unsigned long)start[0],
+ (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1],
+ (unsigned long)(count[0] * count[1]));
/* put some trivial data in the data_array */
dataset_fill(start, count, stride, &data_array1[0][0]);
MESG("data_array initialized");
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
assert(file_dataspace != FAIL);
MESG("H5Dget_space succeed");
- ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride,
- count, NULL);
+ ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
assert(ret != FAIL);
MESG("H5Sset_hyperslab succeed");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (SPACE1_RANK, count, NULL);
- assert (mem_dataspace != FAIL);
+ mem_dataspace = H5Screate_simple(SPACE1_RANK, count, NULL);
+ assert(mem_dataspace != FAIL);
/* write data independently */
- ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, data_array1);
+ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
assert(ret != FAIL);
MESG("H5Dwrite succeed");
/* write data independently */
- ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, data_array1);
+ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
assert(ret != FAIL);
MESG("H5Dwrite succeed");
@@ -348,10 +338,10 @@ if (verbose)
H5Sclose(file_dataspace);
/* close dataset collectively */
- ret=H5Dclose(dataset1);
+ ret = H5Dclose(dataset1);
assert(ret != FAIL);
MESG("H5Dclose1 succeed");
- ret=H5Dclose(dataset2);
+ ret = H5Dclose(dataset2);
assert(ret != FAIL);
MESG("H5Dclose2 succeed");
@@ -366,39 +356,38 @@ if (verbose)
void
phdf5readInd(char *filename)
{
- hid_t fid1; /* HDF5 file IDs */
- hid_t acc_tpl1; /* File access templates */
- hid_t file_dataspace; /* File dataspace ID */
- hid_t mem_dataspace; /* memory dataspace ID */
- hid_t dataset1, dataset2; /* Dataset ID */
- DATATYPE data_array1[SPACE1_DIM1][SPACE1_DIM2]; /* data buffer */
- DATATYPE data_origin1[SPACE1_DIM1][SPACE1_DIM2]; /* expected data buffer */
+ hid_t fid1; /* HDF5 file IDs */
+ hid_t acc_tpl1; /* File access templates */
+ hid_t file_dataspace; /* File dataspace ID */
+ hid_t mem_dataspace; /* memory dataspace ID */
+ hid_t dataset1, dataset2; /* Dataset ID */
+ DATATYPE data_array1[SPACE1_DIM1][SPACE1_DIM2]; /* data buffer */
+ DATATYPE data_origin1[SPACE1_DIM1][SPACE1_DIM2]; /* expected data buffer */
- hsize_t start[SPACE1_RANK]; /* for hyperslab setting */
- hsize_t count[SPACE1_RANK], stride[SPACE1_RANK]; /* for hyperslab setting */
+ hsize_t start[SPACE1_RANK]; /* for hyperslab setting */
+ hsize_t count[SPACE1_RANK], stride[SPACE1_RANK]; /* for hyperslab setting */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
if (verbose)
- printf("Independent read test on file %s\n", filename);
+ printf("Independent read test on file %s\n", filename);
/* setup file access template */
- acc_tpl1 = H5Pcreate (H5P_FILE_ACCESS);
+ acc_tpl1 = H5Pcreate(H5P_FILE_ACCESS);
assert(acc_tpl1 != FAIL);
/* set Parallel access with communicator */
ret = H5Pset_fapl_mpio(acc_tpl1, comm, info);
assert(ret != FAIL);
-
/* open the file collectively */
- fid1=H5Fopen(filename,H5F_ACC_RDWR,acc_tpl1);
+ fid1 = H5Fopen(filename, H5F_ACC_RDWR, acc_tpl1);
assert(fid1 != FAIL);
/* Release file-access template */
- ret=H5Pclose(acc_tpl1);
+ ret = H5Pclose(acc_tpl1);
assert(ret != FAIL);
/* open the dataset1 collectively */
@@ -409,37 +398,33 @@ phdf5readInd(char *filename)
dataset2 = H5Dopen2(fid1, DATASETNAME1, H5P_DEFAULT);
assert(dataset2 != FAIL);
-
/* set up dimensions of the slab this process accesses */
- start[0] = mpi_rank*SPACE1_DIM1/mpi_size;
- start[1] = 0;
- count[0] = SPACE1_DIM1/mpi_size;
- count[1] = SPACE1_DIM2;
+ start[0] = mpi_rank * SPACE1_DIM1 / mpi_size;
+ start[1] = 0;
+ count[0] = SPACE1_DIM1 / mpi_size;
+ count[1] = SPACE1_DIM2;
stride[0] = 1;
- stride[1] =1;
-if (verbose)
- printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n",
- (unsigned long)start[0], (unsigned long)start[1],
- (unsigned long)count[0], (unsigned long)count[1],
- (unsigned long)(count[0]*count[1]));
+ stride[1] = 1;
+ if (verbose)
+ printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n", (unsigned long)start[0],
+ (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1],
+ (unsigned long)(count[0] * count[1]));
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
assert(file_dataspace != FAIL);
- ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride,
- count, NULL);
+ ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
assert(ret != FAIL);
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (SPACE1_RANK, count, NULL);
- assert (mem_dataspace != FAIL);
+ mem_dataspace = H5Screate_simple(SPACE1_RANK, count, NULL);
+ assert(mem_dataspace != FAIL);
/* fill dataset with test data */
dataset_fill(start, count, stride, &data_origin1[0][0]);
/* read data independently */
- ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, data_array1);
+ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
assert(ret != FAIL);
/* verify the read data with original expected data */
@@ -447,8 +432,7 @@ if (verbose)
assert(ret != FAIL);
/* read data independently */
- ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, data_array1);
+ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
assert(ret != FAIL);
/* verify the read data with original expected data */
@@ -456,9 +440,9 @@ if (verbose)
assert(ret == 0);
/* close dataset collectively */
- ret=H5Dclose(dataset1);
+ ret = H5Dclose(dataset1);
assert(ret != FAIL);
- ret=H5Dclose(dataset2);
+ ret = H5Dclose(dataset2);
assert(ret != FAIL);
/* release all IDs created */
@@ -468,7 +452,6 @@ if (verbose)
H5Fclose(fid1);
}
-
/*
* Example of using the parallel HDF5 library to create two datasets
* in one HDF5 file with collective parallel access support.
@@ -481,33 +464,32 @@ if (verbose)
void
phdf5writeAll(char *filename)
{
- hid_t fid1; /* HDF5 file IDs */
- hid_t acc_tpl1; /* File access templates */
- hid_t xfer_plist; /* Dataset transfer properties list */
- hid_t sid1; /* Dataspace ID */
- hid_t file_dataspace; /* File dataspace ID */
- hid_t mem_dataspace; /* memory dataspace ID */
- hid_t dataset1, dataset2; /* Dataset ID */
- hsize_t dims1[SPACE1_RANK] =
- {SPACE1_DIM1,SPACE1_DIM2}; /* dataspace dim sizes */
- DATATYPE data_array1[SPACE1_DIM1][SPACE1_DIM2]; /* data buffer */
-
- hsize_t start[SPACE1_RANK]; /* for hyperslab setting */
- hsize_t count[SPACE1_RANK], stride[SPACE1_RANK]; /* for hyperslab setting */
-
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 file IDs */
+ hid_t acc_tpl1; /* File access templates */
+ hid_t xfer_plist; /* Dataset transfer properties list */
+ hid_t sid1; /* Dataspace ID */
+ hid_t file_dataspace; /* File dataspace ID */
+ hid_t mem_dataspace; /* memory dataspace ID */
+ hid_t dataset1, dataset2; /* Dataset ID */
+ hsize_t dims1[SPACE1_RANK] = {SPACE1_DIM1, SPACE1_DIM2}; /* dataspace dim sizes */
+ DATATYPE data_array1[SPACE1_DIM1][SPACE1_DIM2]; /* data buffer */
+
+ hsize_t start[SPACE1_RANK]; /* for hyperslab setting */
+ hsize_t count[SPACE1_RANK], stride[SPACE1_RANK]; /* for hyperslab setting */
+
+ herr_t ret; /* Generic return value */
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
if (verbose)
- printf("Collective write test on file %s\n", filename);
+ printf("Collective write test on file %s\n", filename);
/* -------------------
* START AN HDF5 FILE
* -------------------*/
/* setup file access template with parallel IO access. */
- acc_tpl1 = H5Pcreate (H5P_FILE_ACCESS);
+ acc_tpl1 = H5Pcreate(H5P_FILE_ACCESS);
assert(acc_tpl1 != FAIL);
MESG("H5Pcreate access succeed");
/* set Parallel access with communicator */
@@ -516,25 +498,23 @@ phdf5writeAll(char *filename)
MESG("H5Pset_fapl_mpio succeed");
/* create the file collectively */
- fid1=H5Fcreate(filename,H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl1);
+ fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl1);
assert(fid1 != FAIL);
MESG("H5Fcreate succeed");
/* Release file-access template */
- ret=H5Pclose(acc_tpl1);
+ ret = H5Pclose(acc_tpl1);
assert(ret != FAIL);
-
/* --------------------------
* Define the dimensions of the overall datasets
* and create the dataset
* ------------------------- */
/* setup dimensionality object */
- sid1 = H5Screate_simple (SPACE1_RANK, dims1, NULL);
- assert (sid1 != FAIL);
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ assert(sid1 != FAIL);
MESG("H5Screate_simple succeed");
-
/* create a dataset collectively */
dataset1 = H5Dcreate2(fid1, DATASETNAME1, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(dataset1 != FAIL);
@@ -551,43 +531,40 @@ phdf5writeAll(char *filename)
/* Dataset1: each process takes a block of rows. */
slab_set(start, count, stride, BYROW);
-if (verbose)
- printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n",
- (unsigned long)start[0], (unsigned long)start[1],
- (unsigned long)count[0], (unsigned long)count[1],
- (unsigned long)(count[0]*count[1]));
+ if (verbose)
+ printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n", (unsigned long)start[0],
+ (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1],
+ (unsigned long)(count[0] * count[1]));
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
assert(file_dataspace != FAIL);
MESG("H5Dget_space succeed");
- ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride,
- count, NULL);
+ ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
assert(ret != FAIL);
MESG("H5Sset_hyperslab succeed");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (SPACE1_RANK, count, NULL);
- assert (mem_dataspace != FAIL);
+ mem_dataspace = H5Screate_simple(SPACE1_RANK, count, NULL);
+ assert(mem_dataspace != FAIL);
/* fill the local slab with some trivial data */
dataset_fill(start, count, stride, &data_array1[0][0]);
MESG("data_array initialized");
- if (verbose){
- MESG("data_array created");
- dataset_print(start, count, stride, &data_array1[0][0]);
+ if (verbose) {
+ MESG("data_array created");
+ dataset_print(start, count, stride, &data_array1[0][0]);
}
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
assert(xfer_plist != FAIL);
- ret=H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
+ ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
assert(ret != FAIL);
MESG("H5Pcreate xfer succeed");
/* write data collectively */
- ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
assert(ret != FAIL);
MESG("H5Dwrite succeed");
@@ -600,51 +577,48 @@ if (verbose)
/* Dataset2: each process takes a block of columns. */
slab_set(start, count, stride, BYCOL);
-if (verbose)
- printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n",
- (unsigned long)start[0], (unsigned long)start[1],
- (unsigned long)count[0], (unsigned long)count[1],
- (unsigned long)(count[0]*count[1]));
+ if (verbose)
+ printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n", (unsigned long)start[0],
+ (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1],
+ (unsigned long)(count[0] * count[1]));
/* put some trivial data in the data_array */
dataset_fill(start, count, stride, &data_array1[0][0]);
MESG("data_array initialized");
- if (verbose){
- MESG("data_array created");
- dataset_print(start, count, stride, &data_array1[0][0]);
+ if (verbose) {
+ MESG("data_array created");
+ dataset_print(start, count, stride, &data_array1[0][0]);
}
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
assert(file_dataspace != FAIL);
MESG("H5Dget_space succeed");
- ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride,
- count, NULL);
+ ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
assert(ret != FAIL);
MESG("H5Sset_hyperslab succeed");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (SPACE1_RANK, count, NULL);
- assert (mem_dataspace != FAIL);
+ mem_dataspace = H5Screate_simple(SPACE1_RANK, count, NULL);
+ assert(mem_dataspace != FAIL);
/* fill the local slab with some trivial data */
dataset_fill(start, count, stride, &data_array1[0][0]);
MESG("data_array initialized");
- if (verbose){
- MESG("data_array created");
- dataset_print(start, count, stride, &data_array1[0][0]);
+ if (verbose) {
+ MESG("data_array created");
+ dataset_print(start, count, stride, &data_array1[0][0]);
}
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
assert(xfer_plist != FAIL);
- ret=H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
+ ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
assert(ret != FAIL);
MESG("H5Pcreate xfer succeed");
/* write data independently */
- ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
assert(ret != FAIL);
MESG("H5Dwrite succeed");
@@ -653,14 +627,13 @@ if (verbose)
H5Sclose(mem_dataspace);
H5Pclose(xfer_plist);
-
/*
* All writes completed. Close datasets collectively
*/
- ret=H5Dclose(dataset1);
+ ret = H5Dclose(dataset1);
assert(ret != FAIL);
MESG("H5Dclose1 succeed");
- ret=H5Dclose(dataset2);
+ ret = H5Dclose(dataset2);
assert(ret != FAIL);
MESG("H5Dclose2 succeed");
@@ -683,31 +656,31 @@ if (verbose)
void
phdf5readAll(char *filename)
{
- hid_t fid1; /* HDF5 file IDs */
- hid_t acc_tpl1; /* File access templates */
- hid_t xfer_plist; /* Dataset transfer properties list */
- hid_t file_dataspace; /* File dataspace ID */
- hid_t mem_dataspace; /* memory dataspace ID */
- hid_t dataset1, dataset2; /* Dataset ID */
- DATATYPE data_array1[SPACE1_DIM1][SPACE1_DIM2]; /* data buffer */
- DATATYPE data_origin1[SPACE1_DIM1][SPACE1_DIM2]; /* expected data buffer */
+ hid_t fid1; /* HDF5 file IDs */
+ hid_t acc_tpl1; /* File access templates */
+ hid_t xfer_plist; /* Dataset transfer properties list */
+ hid_t file_dataspace; /* File dataspace ID */
+ hid_t mem_dataspace; /* memory dataspace ID */
+ hid_t dataset1, dataset2; /* Dataset ID */
+ DATATYPE data_array1[SPACE1_DIM1][SPACE1_DIM2]; /* data buffer */
+ DATATYPE data_origin1[SPACE1_DIM1][SPACE1_DIM2]; /* expected data buffer */
- hsize_t start[SPACE1_RANK]; /* for hyperslab setting */
- hsize_t count[SPACE1_RANK], stride[SPACE1_RANK]; /* for hyperslab setting */
+ hsize_t start[SPACE1_RANK]; /* for hyperslab setting */
+ hsize_t count[SPACE1_RANK], stride[SPACE1_RANK]; /* for hyperslab setting */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
if (verbose)
- printf("Collective read test on file %s\n", filename);
+ printf("Collective read test on file %s\n", filename);
/* -------------------
* OPEN AN HDF5 FILE
* -------------------*/
/* setup file access template with parallel IO access. */
- acc_tpl1 = H5Pcreate (H5P_FILE_ACCESS);
+ acc_tpl1 = H5Pcreate(H5P_FILE_ACCESS);
assert(acc_tpl1 != FAIL);
MESG("H5Pcreate access succeed");
/* set Parallel access with communicator */
@@ -716,15 +689,14 @@ phdf5readAll(char *filename)
MESG("H5Pset_fapl_mpio succeed");
/* open the file collectively */
- fid1=H5Fopen(filename,H5F_ACC_RDWR,acc_tpl1);
+ fid1 = H5Fopen(filename, H5F_ACC_RDWR, acc_tpl1);
assert(fid1 != FAIL);
MESG("H5Fopen succeed");
/* Release file-access template */
- ret=H5Pclose(acc_tpl1);
+ ret = H5Pclose(acc_tpl1);
assert(ret != FAIL);
-
/* --------------------------
* Open the datasets in it
* ------------------------- */
@@ -744,43 +716,40 @@ phdf5readAll(char *filename)
/* Dataset1: each process takes a block of columns. */
slab_set(start, count, stride, BYCOL);
-if (verbose)
- printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n",
- (unsigned long)start[0], (unsigned long)start[1],
- (unsigned long)count[0], (unsigned long)count[1],
- (unsigned long)(count[0]*count[1]));
+ if (verbose)
+ printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n", (unsigned long)start[0],
+ (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1],
+ (unsigned long)(count[0] * count[1]));
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
assert(file_dataspace != FAIL);
MESG("H5Dget_space succeed");
- ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride,
- count, NULL);
+ ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
assert(ret != FAIL);
MESG("H5Sset_hyperslab succeed");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (SPACE1_RANK, count, NULL);
- assert (mem_dataspace != FAIL);
+ mem_dataspace = H5Screate_simple(SPACE1_RANK, count, NULL);
+ assert(mem_dataspace != FAIL);
/* fill dataset with test data */
dataset_fill(start, count, stride, &data_origin1[0][0]);
MESG("data_array initialized");
- if (verbose){
- MESG("data_array created");
- dataset_print(start, count, stride, &data_array1[0][0]);
+ if (verbose) {
+ MESG("data_array created");
+ dataset_print(start, count, stride, &data_array1[0][0]);
}
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
assert(xfer_plist != FAIL);
- ret=H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
+ ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
assert(ret != FAIL);
MESG("H5Pcreate xfer succeed");
/* read data collectively */
- ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
assert(ret != FAIL);
MESG("H5Dread succeed");
@@ -797,43 +766,40 @@ if (verbose)
/* Dataset2: each process takes a block of rows. */
slab_set(start, count, stride, BYROW);
-if (verbose)
- printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n",
- (unsigned long)start[0], (unsigned long)start[1],
- (unsigned long)count[0], (unsigned long)count[1],
- (unsigned long)(count[0]*count[1]));
+ if (verbose)
+ printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n", (unsigned long)start[0],
+ (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1],
+ (unsigned long)(count[0] * count[1]));
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
assert(file_dataspace != FAIL);
MESG("H5Dget_space succeed");
- ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride,
- count, NULL);
+ ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
assert(ret != FAIL);
MESG("H5Sset_hyperslab succeed");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (SPACE1_RANK, count, NULL);
- assert (mem_dataspace != FAIL);
+ mem_dataspace = H5Screate_simple(SPACE1_RANK, count, NULL);
+ assert(mem_dataspace != FAIL);
/* fill dataset with test data */
dataset_fill(start, count, stride, &data_origin1[0][0]);
MESG("data_array initialized");
- if (verbose){
- MESG("data_array created");
- dataset_print(start, count, stride, &data_array1[0][0]);
+ if (verbose) {
+ MESG("data_array created");
+ dataset_print(start, count, stride, &data_array1[0][0]);
}
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
assert(xfer_plist != FAIL);
- ret=H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
+ ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
assert(ret != FAIL);
MESG("H5Pcreate xfer succeed");
/* read data independently */
- ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
assert(ret != FAIL);
MESG("H5Dread succeed");
@@ -846,14 +812,13 @@ if (verbose)
H5Sclose(mem_dataspace);
H5Pclose(xfer_plist);
-
/*
* All reads completed. Close datasets collectively
*/
- ret=H5Dclose(dataset1);
+ ret = H5Dclose(dataset1);
assert(ret != FAIL);
MESG("H5Dclose1 succeed");
- ret=H5Dclose(dataset2);
+ ret = H5Dclose(dataset2);
assert(ret != FAIL);
MESG("H5Dclose2 succeed");
@@ -877,51 +842,51 @@ test_split_comm_access(char filenames[][PATH_MAX])
{
MPI_Comm comm;
MPI_Info info = MPI_INFO_NULL;
- int color, mrc;
- int newrank, newprocs;
- hid_t fid; /* file IDs */
- hid_t acc_tpl; /* File access properties */
- herr_t ret; /* generic return value */
+ int color, mrc;
+ int newrank, newprocs;
+ hid_t fid; /* file IDs */
+ hid_t acc_tpl; /* File access properties */
+ herr_t ret; /* generic return value */
if (verbose)
- printf("Independent write test on file %s %s\n",
- filenames[0], filenames[1]);
-
- color = mpi_rank%2;
- mrc = MPI_Comm_split (MPI_COMM_WORLD, color, mpi_rank, &comm);
- assert(mrc==MPI_SUCCESS);
- MPI_Comm_size(comm,&newprocs);
- MPI_Comm_rank(comm,&newrank);
-
- if (color){
- /* odd-rank processes */
- mrc = MPI_Barrier(comm);
- assert(mrc==MPI_SUCCESS);
- }else{
- /* even-rank processes */
- /* setup file access template */
- acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
- assert(acc_tpl != FAIL);
-
- /* set Parallel access with communicator */
- ret = H5Pset_fapl_mpio(acc_tpl, comm, info);
- assert(ret != FAIL);
-
- /* create the file collectively */
- fid=H5Fcreate(filenames[color],H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl);
- assert(fid != FAIL);
- MESG("H5Fcreate succeed");
-
- /* Release file-access template */
- ret=H5Pclose(acc_tpl);
- assert(ret != FAIL);
-
- ret=H5Fclose(fid);
- assert(ret != FAIL);
+ printf("Independent write test on file %s %s\n", filenames[0], filenames[1]);
+
+ color = mpi_rank % 2;
+ mrc = MPI_Comm_split(MPI_COMM_WORLD, color, mpi_rank, &comm);
+ assert(mrc == MPI_SUCCESS);
+ MPI_Comm_size(comm, &newprocs);
+ MPI_Comm_rank(comm, &newrank);
+
+ if (color) {
+ /* odd-rank processes */
+ mrc = MPI_Barrier(comm);
+ assert(mrc == MPI_SUCCESS);
}
- if (mpi_rank == 0){
- mrc = MPI_File_delete(filenames[color], info);
- assert(mrc==MPI_SUCCESS);
+ else {
+ /* even-rank processes */
+ /* setup file access template */
+ acc_tpl = H5Pcreate(H5P_FILE_ACCESS);
+ assert(acc_tpl != FAIL);
+
+ /* set Parallel access with communicator */
+ ret = H5Pset_fapl_mpio(acc_tpl, comm, info);
+ assert(ret != FAIL);
+
+ /* create the file collectively */
+ fid = H5Fcreate(filenames[color], H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl);
+ assert(fid != FAIL);
+ MESG("H5Fcreate succeed");
+
+ /* Release file-access template */
+ ret = H5Pclose(acc_tpl);
+ assert(ret != FAIL);
+
+ ret = H5Fclose(fid);
+ assert(ret != FAIL);
+ }
+ if (mpi_rank == 0) {
+ mrc = MPI_File_delete(filenames[color], info);
+ assert(mrc == MPI_SUCCESS);
}
}
@@ -944,7 +909,6 @@ usage(void)
printf("\n");
}
-
/*
* compose the test filename with the prefix supplied.
* return code: 0 if no error
@@ -953,88 +917,93 @@ usage(void)
int
mkfilenames(char *prefix)
{
- int i, n;
+ int i, n;
size_t strsize;
/* filename will be prefix/ParaEgN.h5 where N is 0 to 9. */
/* So, string must be big enough to hold the prefix, / and 10 more chars */
/* and the terminating null. */
strsize = strlen(prefix) + 12;
- if (strsize > PATH_MAX){
- printf("File prefix too long; Use a short path name.\n");
- return(1);
+ if (strsize > PATH_MAX) {
+ printf("File prefix too long; Use a short path name.\n");
+ return (1);
}
- n = sizeof(testfiles)/sizeof(testfiles[0]);
- if (n > 9){
- printf("Warning: Too many entries in testfiles. "
- "Need to adjust the code to accommodate the large size.\n");
+ n = sizeof(testfiles) / sizeof(testfiles[0]);
+ if (n > 9) {
+ printf("Warning: Too many entries in testfiles. "
+ "Need to adjust the code to accommodate the large size.\n");
}
- for (i=0; i<n; i++){
- sprintf(testfiles[i], "%s/ParaEg%d.h5", prefix, i);
+ for (i = 0; i < n; i++) {
+ sprintf(testfiles[i], "%s/ParaEg%d.h5", prefix, i);
}
- return(0);
-
+ return (0);
}
-
/*
* parse the command line options
*/
int
-parse_options(int argc, char **argv){
+parse_options(int argc, char **argv)
+{
int i, n;
/* initialize testfiles to nulls */
- n = sizeof(testfiles)/sizeof(testfiles[0]);
- for (i=0; i<n; i++){
- testfiles[i][0] = '\0';
+ n = sizeof(testfiles) / sizeof(testfiles[0]);
+ for (i = 0; i < n; i++) {
+ testfiles[i][0] = '\0';
}
- while (--argc){
- if (**(++argv) != '-'){
- break;
- }else{
- switch(*(*argv+1)){
- case 'f': ++argv;
- if (--argc < 1){
- usage();
- nerrors++;
- return(1);
- }
- if (mkfilenames(*argv)){
- nerrors++;
- return(1);
- }
- break;
- case 'c': docleanup = 0; /* no cleanup */
- break;
- case 'r': doread = 0;
- break;
- case 'w': dowrite = 0;
- break;
- case 'v': verbose = 1;
- break;
- default: usage();
- nerrors++;
- return(1);
- }
- }
+ while (--argc) {
+ if (**(++argv) != '-') {
+ break;
+ }
+ else {
+ switch (*(*argv + 1)) {
+ case 'f':
+ ++argv;
+ if (--argc < 1) {
+ usage();
+ nerrors++;
+ return (1);
+ }
+ if (mkfilenames(*argv)) {
+ nerrors++;
+ return (1);
+ }
+ break;
+ case 'c':
+ docleanup = 0; /* no cleanup */
+ break;
+ case 'r':
+ doread = 0;
+ break;
+ case 'w':
+ dowrite = 0;
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ default:
+ usage();
+ nerrors++;
+ return (1);
+ }
+ }
}
/* check the file prefix */
- if (testfiles[0][0] == '\0'){
- /* try get it from environment variable HDF5_PARAPREFIX */
- char *env;
- char *env_default = "."; /* default to current directory */
- if ((env=getenv(PARAPREFIX))==NULL){
- env = env_default;
- }
- mkfilenames(env);
+ if (testfiles[0][0] == '\0') {
+ /* try get it from environment variable HDF5_PARAPREFIX */
+ char *env;
+ char *env_default = "."; /* default to current directory */
+ if ((env = getenv(PARAPREFIX)) == NULL) {
+ env = env_default;
+ }
+ mkfilenames(env);
}
- return(0);
+ return (0);
}
-
/*
* cleanup test files created
*/
@@ -1043,88 +1012,87 @@ cleanup(void)
{
int i, n;
- n = sizeof(testfiles)/sizeof(testfiles[0]);
- for (i=0; i<n; i++){
- MPI_File_delete(testfiles[i], MPI_INFO_NULL);
+ n = sizeof(testfiles) / sizeof(testfiles[0]);
+ for (i = 0; i < n; i++) {
+ MPI_File_delete(testfiles[i], MPI_INFO_NULL);
}
}
-
/* Main Program */
int
main(int argc, char **argv)
{
- int mpi_namelen;
+ int mpi_namelen;
char mpi_name[MPI_MAX_PROCESSOR_NAME];
- int i, n;
+ int i, n;
- MPI_Init(&argc,&argv);
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
- MPI_Get_processor_name(mpi_name,&mpi_namelen);
+ MPI_Init(&argc, &argv);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+ MPI_Get_processor_name(mpi_name, &mpi_namelen);
/* Make sure datasets can be divided into equal chunks by the processes */
- if ((SPACE1_DIM1 % mpi_size) || (SPACE1_DIM2 % mpi_size)){
- printf("DIM1(%d) and DIM2(%d) must be multiples of processes (%d)\n",
- SPACE1_DIM1, SPACE1_DIM2, mpi_size);
- nerrors++;
- goto finish;
+ if ((SPACE1_DIM1 % mpi_size) || (SPACE1_DIM2 % mpi_size)) {
+ printf("DIM1(%d) and DIM2(%d) must be multiples of processes (%d)\n", SPACE1_DIM1, SPACE1_DIM2,
+ mpi_size);
+ nerrors++;
+ goto finish;
}
if (parse_options(argc, argv) != 0)
- goto finish;
+ goto finish;
/* show test file names */
- if (mpi_rank == 0){
- n = sizeof(testfiles)/sizeof(testfiles[0]);
- printf("Parallel test files are:\n");
- for (i=0; i<n; i++){
- printf(" %s\n", testfiles[i]);
- }
+ if (mpi_rank == 0) {
+ n = sizeof(testfiles) / sizeof(testfiles[0]);
+ printf("Parallel test files are:\n");
+ for (i = 0; i < n; i++) {
+ printf(" %s\n", testfiles[i]);
+ }
}
- if (dowrite){
- MPI_BANNER("testing PHDF5 dataset using split communicators...");
- test_split_comm_access(testfiles);
- MPI_BANNER("testing PHDF5 dataset independent write...");
- phdf5writeInd(testfiles[0]);
- MPI_BANNER("testing PHDF5 dataset collective write...");
- phdf5writeAll(testfiles[1]);
+ if (dowrite) {
+ MPI_BANNER("testing PHDF5 dataset using split communicators...");
+ test_split_comm_access(testfiles);
+ MPI_BANNER("testing PHDF5 dataset independent write...");
+ phdf5writeInd(testfiles[0]);
+ MPI_BANNER("testing PHDF5 dataset collective write...");
+ phdf5writeAll(testfiles[1]);
}
- if (doread){
- MPI_BANNER("testing PHDF5 dataset independent read...");
- phdf5readInd(testfiles[0]);
- MPI_BANNER("testing PHDF5 dataset collective read...");
- phdf5readAll(testfiles[1]);
+ if (doread) {
+ MPI_BANNER("testing PHDF5 dataset independent read...");
+ phdf5readInd(testfiles[0]);
+ MPI_BANNER("testing PHDF5 dataset collective read...");
+ phdf5readAll(testfiles[1]);
}
- if (!(dowrite || doread)){
- usage();
- nerrors++;
+ if (!(dowrite || doread)) {
+ usage();
+ nerrors++;
}
finish:
- if (mpi_rank == 0){ /* only process 0 reports */
- if (nerrors)
- printf("***PHDF5 tests detected %d errors***\n", nerrors);
- else{
- printf("===================================\n");
- printf("PHDF5 tests finished with no errors\n");
- printf("===================================\n");
- }
+ if (mpi_rank == 0) { /* only process 0 reports */
+ if (nerrors)
+ printf("***PHDF5 tests detected %d errors***\n", nerrors);
+ else {
+ printf("===================================\n");
+ printf("PHDF5 tests finished with no errors\n");
+ printf("===================================\n");
+ }
}
if (docleanup)
- cleanup();
+ cleanup();
MPI_Finalize();
- return(nerrors);
+ return (nerrors);
}
-#else /* H5_HAVE_PARALLEL */
+#else /* H5_HAVE_PARALLEL */
/* dummy program since H5_HAVE_PARALLE is not configured in */
int
main(void)
{
-printf("No PHDF5 example because parallel is not configured in\n");
-return(0);
+ printf("No PHDF5 example because parallel is not configured in\n");
+ return (0);
}
#endif /* H5_HAVE_PARALLEL */
diff --git a/fortran/src/H5Af.c b/fortran/src/H5Af.c
index 5e5bcc0..b1aca7c 100644
--- a/fortran/src/H5Af.c
+++ b/fortran/src/H5Af.c
@@ -17,7 +17,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include "H5f90.h"
#include "H5Eprivate.h"
@@ -44,29 +44,30 @@
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5acreate_c(hid_t_f *obj_id, _fcd name, size_t_f *namelen, hid_t_f *type_id,
- hid_t_f *space_id, hid_t_f *crt_prp, hid_t_f *aapl, hid_t_f *attr_id)
+h5acreate_c(hid_t_f *obj_id, _fcd name, size_t_f *namelen, hid_t_f *type_id, hid_t_f *space_id,
+ hid_t_f *crt_prp, hid_t_f *aapl, hid_t_f *attr_id)
/*******/
{
- char *c_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
+ char *c_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
- /*
- * Convert FORTRAN name to C name
- */
- if(NULL == (c_name = HD5f2cstring(name, (size_t)*namelen)))
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if (NULL == (c_name = HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL);
- /*
- * Call H5Acreate2 function.
- */
- if((*attr_id = (hid_t_f)H5Acreate2((hid_t)*obj_id, c_name, (hid_t)*type_id, (hid_t)*space_id, (hid_t)*crt_prp, (hid_t)*aapl)) < 0)
+ /*
+ * Call H5Acreate2 function.
+ */
+ if ((*attr_id = (hid_t_f)H5Acreate2((hid_t)*obj_id, c_name, (hid_t)*type_id, (hid_t)*space_id,
+ (hid_t)*crt_prp, (hid_t)*aapl)) < 0)
HGOTO_DONE(FAIL);
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
}
@@ -88,28 +89,28 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5adelete_c (hid_t_f *obj_id, _fcd name, size_t_f *namelen)
+h5adelete_c(hid_t_f *obj_id, _fcd name, size_t_f *namelen)
/******/
{
- char *c_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
+ char *c_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
- /*
- * Convert FORTRAN name to C name
- */
- if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
HGOTO_DONE(FAIL);
- /*
- * Call H5Adelete function.
- */
- if(H5Adelete((hid_t)*obj_id, c_name) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Adelete function.
+ */
+ if (H5Adelete((hid_t)*obj_id, c_name) < 0)
+ HGOTO_DONE(FAIL);
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
@@ -132,25 +133,25 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5aget_num_attrs_c (hid_t_f *obj_id, int_f *attr_num)
+h5aget_num_attrs_c(hid_t_f *obj_id, int_f *attr_num)
/******/
{
- H5O_info2_t oinfo; /* Object info */
- int_f ret_value = 0; /* Return value */
+ H5O_info2_t oinfo; /* Object info */
+ int_f ret_value = 0; /* Return value */
/*
* Call H5Oget_info function.
*/
- if(H5Oget_info3((hid_t)*obj_id, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
+ if (H5Oget_info3((hid_t)*obj_id, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
HGOTO_DONE(FAIL);
/* Set number of attributes */
*attr_num = (int_f)oinfo.num_attrs;
done:
- return ret_value;
+ return ret_value;
}
/****if* H5Af/h5aget_name_c
@@ -171,40 +172,40 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5aget_name_c(hid_t_f *attr_id, size_t_f *bufsize, _fcd buf)
/******/
{
- size_t c_bufsize;
- char *c_buf=NULL; /* Buffer to hold C string */
- int_f ret_value=0; /* Return value */
+ size_t c_bufsize;
+ char * c_buf = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
- c_bufsize = (size_t)*bufsize+1;
+ c_bufsize = (size_t)*bufsize + 1;
- /*
- * Allocate buffer to hold name of an attribute
- */
- if(NULL == (c_buf = (char *)HDmalloc(c_bufsize)))
- HGOTO_DONE(FAIL);
+ /*
+ * Allocate buffer to hold name of an attribute
+ */
+ if (NULL == (c_buf = (char *)HDmalloc(c_bufsize)))
+ HGOTO_DONE(FAIL);
- /*
- * Call H5Aget_name function
- */
- if ((ret_value = (int_f)H5Aget_name((hid_t)*attr_id, c_bufsize, c_buf)) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Aget_name function
+ */
+ if ((ret_value = (int_f)H5Aget_name((hid_t)*attr_id, c_bufsize, c_buf)) < 0)
+ HGOTO_DONE(FAIL);
- /*
- * Convert C name to FORTRAN and place it in the given buffer
- */
- HD5packFstring(c_buf, _fcdtocp(buf), c_bufsize-1);
+ /*
+ * Convert C name to FORTRAN and place it in the given buffer
+ */
+ HD5packFstring(c_buf, _fcdtocp(buf), c_bufsize - 1);
done:
- if(c_buf) HDfree(c_buf);
- return ret_value;
+ if (c_buf)
+ HDfree(c_buf);
+ return ret_value;
}
-
/****if* H5Af/h5arename_by_name_c
* NAME
* h5arename_by_name_c
@@ -230,39 +231,38 @@ done:
* HISTORY
* N/A
* SOURCE
-*/
+ */
int_f
-h5arename_by_name_c( hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
- _fcd old_attr_name, size_t_f *old_attr_namelen,
- _fcd new_attr_name, size_t_f *new_attr_namelen,
- hid_t_f *lapl_id )
+h5arename_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd old_attr_name,
+ size_t_f *old_attr_namelen, _fcd new_attr_name, size_t_f *new_attr_namelen,
+ hid_t_f *lapl_id)
/******/
{
- char *c_obj_name = NULL; /* Buffer to hold C string */
- char *c_old_attr_name = NULL; /* Buffer to hold C string */
- char *c_new_attr_name = NULL; /* Buffer to hold C string */
- int_f ret_value=0; /* Return value */
- /*
- * Convert FORTRAN name to C name
- */
- if((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL)
- HGOTO_DONE(FAIL);
- if((c_old_attr_name = HD5f2cstring(old_attr_name, (size_t)*old_attr_namelen)) == NULL)
- HGOTO_DONE(FAIL);
- if((c_new_attr_name = HD5f2cstring(new_attr_name, (size_t)*new_attr_namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- if(H5Arename_by_name((hid_t)*loc_id,c_obj_name,c_old_attr_name,c_new_attr_name,(hid_t)*lapl_id) < 0)
+ char *c_obj_name = NULL; /* Buffer to hold C string */
+ char *c_old_attr_name = NULL; /* Buffer to hold C string */
+ char *c_new_attr_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+ if ((c_old_attr_name = HD5f2cstring(old_attr_name, (size_t)*old_attr_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+ if ((c_new_attr_name = HD5f2cstring(new_attr_name, (size_t)*new_attr_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ if (H5Arename_by_name((hid_t)*loc_id, c_obj_name, c_old_attr_name, c_new_attr_name, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL);
done:
- if(c_obj_name)
- HDfree(c_obj_name);
- if(c_old_attr_name)
- HDfree(c_old_attr_name);
- if(c_new_attr_name)
- HDfree(c_new_attr_name);
+ if (c_obj_name)
+ HDfree(c_obj_name);
+ if (c_old_attr_name)
+ HDfree(c_old_attr_name);
+ if (c_new_attr_name)
+ HDfree(c_new_attr_name);
return ret_value;
}
@@ -286,28 +286,28 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5aopen_c (hid_t_f *obj_id, _fcd attr_name, size_t_f *attr_namelen, hid_t_f *aapl_id, hid_t_f *attr_id)
+h5aopen_c(hid_t_f *obj_id, _fcd attr_name, size_t_f *attr_namelen, hid_t_f *aapl_id, hid_t_f *attr_id)
/******/
{
- char *c_attr_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
+ char *c_attr_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
- /*
- * Convert FORTRAN name to C name
- */
- if((c_attr_name = HD5f2cstring(attr_name, (size_t)*attr_namelen)) == NULL)
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_attr_name = HD5f2cstring(attr_name, (size_t)*attr_namelen)) == NULL)
HGOTO_DONE(FAIL);
- /*
- * Call H5Aopen function.
- */
+ /*
+ * Call H5Aopen function.
+ */
- if((*attr_id = (hid_t_f)H5Aopen((hid_t)*obj_id, c_attr_name, (hid_t)*aapl_id)) < 0)
- HGOTO_DONE(FAIL);
+ if ((*attr_id = (hid_t_f)H5Aopen((hid_t)*obj_id, c_attr_name, (hid_t)*aapl_id)) < 0)
+ HGOTO_DONE(FAIL);
done:
- if(c_attr_name)
+ if (c_attr_name)
HDfree(c_attr_name);
return ret_value;
}
@@ -334,33 +334,34 @@ done:
* HISTORY
* N/A
* SOURCE
-*/
+ */
int_f
-h5adelete_by_name_c (hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd attr_name, size_t_f *attr_namelen, hid_t_f *lapl_id)
+h5adelete_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd attr_name,
+ size_t_f *attr_namelen, hid_t_f *lapl_id)
/******/
{
- char *c_obj_name = NULL; /* Buffer to hold C string */
- char *c_attr_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
-
- /*
- * Convert FORTRAN name to C name
- */
- if((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL)
- HGOTO_DONE(FAIL);
- if((c_attr_name = HD5f2cstring(attr_name, (size_t)*attr_namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Adelete_by_name function.
- */
- if(H5Adelete_by_name((hid_t)*loc_id, c_obj_name, c_attr_name, (hid_t)*lapl_id) < 0)
- HGOTO_DONE(FAIL);
+ char *c_obj_name = NULL; /* Buffer to hold C string */
+ char *c_attr_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+ if ((c_attr_name = HD5f2cstring(attr_name, (size_t)*attr_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Adelete_by_name function.
+ */
+ if (H5Adelete_by_name((hid_t)*loc_id, c_obj_name, c_attr_name, (hid_t)*lapl_id) < 0)
+ HGOTO_DONE(FAIL);
done:
- if(c_attr_name)
+ if (c_attr_name)
HDfree(c_attr_name);
- if(c_obj_name)
+ if (c_obj_name)
HDfree(c_obj_name);
return ret_value;
}
@@ -387,29 +388,30 @@ done:
* HISTORY
* N/A
* SOURCE
-*/
+ */
int_f
-h5adelete_by_idx_c (hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
- int_f *idx_type, int_f *order, hsize_t_f *n, hid_t_f *lapl_id)
+h5adelete_by_idx_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, int_f *idx_type, int_f *order,
+ hsize_t_f *n, hid_t_f *lapl_id)
/******/
{
- char *c_obj_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
+ char *c_obj_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
- /*
- * Convert FORTRAN name to C name
- */
- if(NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)))
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if (NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)))
HGOTO_DONE(FAIL)
- /*
- * Call H5Adelete_by_name function.
- */
- if(H5Adelete_by_idx((hid_t)*loc_id, c_obj_name, (H5_index_t)*idx_type, (H5_iter_order_t)*order, (hsize_t)*n, (hid_t)*lapl_id) < 0)
+ /*
+ * Call H5Adelete_by_name function.
+ */
+ if (H5Adelete_by_idx((hid_t)*loc_id, c_obj_name, (H5_index_t)*idx_type, (H5_iter_order_t)*order,
+ (hsize_t)*n, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL)
done:
- if(c_obj_name)
+ if (c_obj_name)
HDfree(c_obj_name);
return ret_value;
@@ -457,51 +459,50 @@ done:
* HISTORY
* N/A
* SOURCE
-*/
+ */
int_f
-h5aget_name_by_idx_c (hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
- int_f *idx_type, int_f *order, hsize_t_f *n, _fcd name,
- size_t_f *size, hid_t_f *lapl_id)
+h5aget_name_by_idx_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, int_f *idx_type, int_f *order,
+ hsize_t_f *n, _fcd name, size_t_f *size, hid_t_f *lapl_id)
/******/
{
- char *c_obj_name = NULL; /* Buffer to hold C string */
+ char * c_obj_name = NULL; /* Buffer to hold C string */
ssize_t c_size;
- size_t c_buf_size;
- char *c_buf = NULL;
- int_f ret_value = 0; /* Return value */
+ size_t c_buf_size;
+ char * c_buf = NULL;
+ int_f ret_value = 0; /* Return value */
/*
* Convert FORTRAN name to C name
*/
- if(NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)))
+ if (NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)))
HGOTO_DONE(FAIL)
/*
* Allocate buffer to hold name of an attribute
*/
c_buf_size = (size_t)*size + 1;
- if(NULL == (c_buf = (char *)HDmalloc(c_buf_size)))
+ if (NULL == (c_buf = (char *)HDmalloc(c_buf_size)))
HGOTO_DONE(FAIL)
- /*
- * Call H5Aget_name_by_idx function.
- */
- c_size = H5Aget_name_by_idx((hid_t)*loc_id, c_obj_name, (H5_index_t)*idx_type, (H5_iter_order_t)*order, (hsize_t)*n, c_buf, c_buf_size,(hid_t)*lapl_id);
- if(c_size < 0)
+ /*
+ * Call H5Aget_name_by_idx function.
+ */
+ c_size = H5Aget_name_by_idx((hid_t)*loc_id, c_obj_name, (H5_index_t)*idx_type, (H5_iter_order_t)*order,
+ (hsize_t)*n, c_buf, c_buf_size, (hid_t)*lapl_id);
+ if (c_size < 0)
HGOTO_DONE(FAIL)
-
- /*
- * Convert C name to FORTRAN and place it in the given buffer
- */
- HD5packFstring(c_buf, _fcdtocp(name), c_buf_size - 1);
- *size = (size_t_f)c_size;
+ /*
+ * Convert C name to FORTRAN and place it in the given buffer
+ */
+ HD5packFstring(c_buf, _fcdtocp(name), c_buf_size - 1);
+ *size = (size_t_f)c_size;
done:
- if(c_obj_name)
- HDfree(c_obj_name);
- if(c_buf)
- HDfree(c_buf);
+ if (c_obj_name)
+ HDfree(c_obj_name);
+ if (c_buf)
+ HDfree(c_buf);
return ret_value;
}
@@ -540,29 +541,31 @@ done:
* HISTORY
* N/A
* SOURCE
-*/
+ */
int_f
-h5aopen_by_idx_c (hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
- int_f *idx_type, int_f *order, hsize_t_f *n, hid_t_f *aapl_id, hid_t_f *lapl_id, hid_t_f *attr_id )
+h5aopen_by_idx_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, int_f *idx_type, int_f *order,
+ hsize_t_f *n, hid_t_f *aapl_id, hid_t_f *lapl_id, hid_t_f *attr_id)
/******/
{
- char *c_obj_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
+ char *c_obj_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
/*
* Convert FORTRAN name to C name
*/
- if(NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)))
+ if (NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)))
HGOTO_DONE(FAIL)
- /*
- * Call H5Aopen_by_idx function.
- */
- if((*attr_id = (hid_t_f)H5Aopen_by_idx((hid_t)*loc_id, c_obj_name, (H5_index_t)*idx_type, (H5_iter_order_t)*order, (hsize_t)*n, (hid_t)*aapl_id, (hid_t)*lapl_id)) < 0)
+ /*
+ * Call H5Aopen_by_idx function.
+ */
+ if ((*attr_id = (hid_t_f)H5Aopen_by_idx((hid_t)*loc_id, c_obj_name, (H5_index_t)*idx_type,
+ (H5_iter_order_t)*order, (hsize_t)*n, (hid_t)*aapl_id,
+ (hid_t)*lapl_id)) < 0)
HGOTO_DONE(FAIL)
done:
- if(c_obj_name)
+ if (c_obj_name)
HDfree(c_obj_name);
return ret_value;
@@ -590,30 +593,29 @@ done:
* HISTORY
* N/A
* SOURCE
-*/
+ */
int_f
-h5aget_info_c (hid_t_f *loc_id, int_f *corder_valid, int_f *corder,
- int_f *cset, hsize_t_f *data_size )
+h5aget_info_c(hid_t_f *loc_id, int_f *corder_valid, int_f *corder, int_f *cset, hsize_t_f *data_size)
/******/
{
- int_f ret_value = 0; /* Return value */
+ int_f ret_value = 0; /* Return value */
H5A_info_t ainfo;
-
- /*
- * Call H5Aget_info function.
- */
- if(H5Aget_info((hid_t)*loc_id,&ainfo) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Aget_info function.
+ */
+ if (H5Aget_info((hid_t)*loc_id, &ainfo) < 0)
+ HGOTO_DONE(FAIL);
/* Unpack the structure */
*corder_valid = 0;
- if(ainfo.corder_valid > 0) *corder_valid = 1;
+ if (ainfo.corder_valid > 0)
+ *corder_valid = 1;
- *corder = (int_f)ainfo.corder;
- *cset = (int_f)ainfo.cset;
+ *corder = (int_f)ainfo.corder;
+ *cset = (int_f)ainfo.cset;
*data_size = (hsize_t_f)ainfo.data_size;
done:
@@ -659,41 +661,40 @@ done:
* HISTORY
* N/A
* SOURCE
-*/
+ */
int_f
-h5aget_info_by_idx_c (hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
- int_f *idx_type, int_f *order, hsize_t_f *n, hid_t_f *lapl_id,
- int_f *corder_valid, int_f *corder,
- int_f *cset, hsize_t_f *data_size )
+h5aget_info_by_idx_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, int_f *idx_type, int_f *order,
+ hsize_t_f *n, hid_t_f *lapl_id, int_f *corder_valid, int_f *corder, int_f *cset,
+ hsize_t_f *data_size)
/******/
{
- char *c_obj_name = NULL; /* Buffer to hold C string */
+ char * c_obj_name = NULL; /* Buffer to hold C string */
H5A_info_t ainfo;
- int_f ret_value = 0; /* Return value */
+ int_f ret_value = 0; /* Return value */
/*
* Convert FORTRAN name to C name
*/
- if(NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)))
+ if (NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)))
HGOTO_DONE(FAIL)
- /*
- * Call H5Ainfo_by_idx function.
- */
- if(H5Aget_info_by_idx((hid_t)*loc_id, c_obj_name, (H5_index_t)*idx_type, (H5_iter_order_t)*order, (hsize_t)*n,
- &ainfo, (hid_t)*lapl_id) < 0)
- HGOTO_DONE(FAIL)
+ /*
+ * Call H5Ainfo_by_idx function.
+ */
+ if (H5Aget_info_by_idx((hid_t)*loc_id, c_obj_name, (H5_index_t)*idx_type, (H5_iter_order_t)*order,
+ (hsize_t)*n, &ainfo, (hid_t)*lapl_id) < 0)
+ HGOTO_DONE(FAIL)
/* Unpack the structure */
*corder_valid = 0;
- if(ainfo.corder_valid > 0)
+ if (ainfo.corder_valid > 0)
*corder_valid = 1;
- *corder = (int_f)ainfo.corder;
- *cset = (int_f)ainfo.cset;
+ *corder = (int_f)ainfo.corder;
+ *cset = (int_f)ainfo.cset;
*data_size = (hsize_t_f)ainfo.data_size;
done:
- if(c_obj_name)
+ if (c_obj_name)
HDfree(c_obj_name);
return ret_value;
@@ -726,45 +727,44 @@ done:
* HISTORY
* N/A
* SOURCE
-*/
+ */
int_f
-h5aget_info_by_name_c (hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
- _fcd attr_name, size_t_f *attr_namelen, hid_t_f *lapl_id,
- int_f *corder_valid, int_f *corder,
- int_f *cset, hsize_t_f *data_size )
+h5aget_info_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd attr_name,
+ size_t_f *attr_namelen, hid_t_f *lapl_id, int_f *corder_valid, int_f *corder,
+ int_f *cset, hsize_t_f *data_size)
/******/
{
- char *c_obj_name = NULL; /* Buffer to hold C string */
- char *c_attr_name = NULL; /* Buffer to hold C string */
+ char * c_obj_name = NULL; /* Buffer to hold C string */
+ char * c_attr_name = NULL; /* Buffer to hold C string */
H5A_info_t ainfo;
- int_f ret_value = 0; /* Return value */
+ int_f ret_value = 0; /* Return value */
/*
* Convert FORTRAN name to C name
*/
- if(NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)))
+ if (NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)))
HGOTO_DONE(FAIL)
- if(NULL == (c_attr_name = HD5f2cstring(attr_name, (size_t)*attr_namelen)))
+ if (NULL == (c_attr_name = HD5f2cstring(attr_name, (size_t)*attr_namelen)))
HGOTO_DONE(FAIL)
- /*
- * Call H5Ainfo_by_name function.
- */
- if(H5Aget_info_by_name((hid_t)*loc_id, c_obj_name, c_attr_name, &ainfo, (hid_t)*lapl_id) < 0)
+ /*
+ * Call H5Ainfo_by_name function.
+ */
+ if (H5Aget_info_by_name((hid_t)*loc_id, c_obj_name, c_attr_name, &ainfo, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL)
/* Unpack the structure */
*corder_valid = 0;
- if(ainfo.corder_valid > 0)
+ if (ainfo.corder_valid > 0)
*corder_valid = 1;
- *corder = (int_f)ainfo.corder;
- *cset = (int_f)ainfo.cset;
+ *corder = (int_f)ainfo.corder;
+ *cset = (int_f)ainfo.cset;
*data_size = (hsize_t_f)ainfo.data_size;
done:
- if(c_obj_name)
+ if (c_obj_name)
HDfree(c_obj_name);
- if(c_attr_name)
+ if (c_attr_name)
HDfree(c_attr_name);
return ret_value;
@@ -803,37 +803,37 @@ done:
* SOURCE
*/
int_f
-h5acreate_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
- _fcd attr_name, size_t_f *attr_namelen, hid_t_f *type_id,
- hid_t_f *space_id, hid_t_f *acpl_id, hid_t_f *aapl_id,
- hid_t_f *lapl_id, hid_t_f *attr_id )
+h5acreate_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd attr_name,
+ size_t_f *attr_namelen, hid_t_f *type_id, hid_t_f *space_id, hid_t_f *acpl_id,
+ hid_t_f *aapl_id, hid_t_f *lapl_id, hid_t_f *attr_id)
/******/
{
- char *c_obj_name = NULL; /* Buffer to hold C string */
- char *c_attr_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
-
- /*
- * Convert FORTRAN name to C name
- */
- if((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL)
- HGOTO_DONE(FAIL);
- if((c_attr_name = HD5f2cstring(attr_name, (size_t)*attr_namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Acreate_by_name function.
- */
- if((*attr_id = (hid_t_f)H5Acreate_by_name((hid_t)*loc_id, c_obj_name, c_attr_name,
- (hid_t)*type_id, (hid_t)*space_id,(hid_t)*acpl_id,(hid_t)*aapl_id,(hid_t)*lapl_id )) < 0)
- HGOTO_DONE(FAIL);
+ char *c_obj_name = NULL; /* Buffer to hold C string */
+ char *c_attr_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+ if ((c_attr_name = HD5f2cstring(attr_name, (size_t)*attr_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Acreate_by_name function.
+ */
+ if ((*attr_id = (hid_t_f)H5Acreate_by_name((hid_t)*loc_id, c_obj_name, c_attr_name, (hid_t)*type_id,
+ (hid_t)*space_id, (hid_t)*acpl_id, (hid_t)*aapl_id,
+ (hid_t)*lapl_id)) < 0)
+ HGOTO_DONE(FAIL);
done:
- if(c_obj_name)
- HDfree(c_obj_name);
- if(c_attr_name)
- HDfree(c_attr_name);
- return ret_value;
+ if (c_obj_name)
+ HDfree(c_obj_name);
+ if (c_attr_name)
+ HDfree(c_attr_name);
+ return ret_value;
}
/****if* H5Af/h5aexists_c
@@ -856,28 +856,28 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5aexists_c (hid_t_f *obj_id, _fcd name, size_t_f *namelen, hid_t_f *attr_exists)
+h5aexists_c(hid_t_f *obj_id, _fcd name, size_t_f *namelen, hid_t_f *attr_exists)
/******/
{
- char *c_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
+ char *c_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
- /*
- * Convert FORTRAN name to C name
- */
- if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
- HGOTO_DONE(FAIL);
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
+ HGOTO_DONE(FAIL);
- /*
- * Call H5Aexists function.
- */
- if((*attr_exists = (hid_t_f)H5Aexists((hid_t)*obj_id, c_name)) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Aexists function.
+ */
+ if ((*attr_exists = (hid_t_f)H5Aexists((hid_t)*obj_id, c_name)) < 0)
+ HGOTO_DONE(FAIL);
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
}
@@ -904,34 +904,35 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5aexists_by_name_c (hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd attr_name, size_t_f *attr_namelen,
- hid_t_f *lapl_id, int_f *attr_exists)
+h5aexists_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd attr_name,
+ size_t_f *attr_namelen, hid_t_f *lapl_id, int_f *attr_exists)
/******/
{
- char *c_obj_name = NULL; /* Buffer to hold object name C string */
- char *c_attr_name = NULL; /* Buffer to hold attribute name C string */
- int_f ret_value = 0; /* Return value */
-
- /*
- * Convert FORTRAN name to C name
- */
- if((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL)
- HGOTO_DONE(FAIL);
- if((c_attr_name = HD5f2cstring(attr_name, (size_t)*attr_namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Aexists_by_name function.
- */
- if((*attr_exists = (int_f)H5Aexists_by_name((hid_t)*loc_id, c_obj_name, c_attr_name, (hid_t)*lapl_id)) < 0)
- HGOTO_DONE(FAIL);
+ char *c_obj_name = NULL; /* Buffer to hold object name C string */
+ char *c_attr_name = NULL; /* Buffer to hold attribute name C string */
+ int_f ret_value = 0; /* Return value */
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+ if ((c_attr_name = HD5f2cstring(attr_name, (size_t)*attr_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Aexists_by_name function.
+ */
+ if ((*attr_exists = (int_f)H5Aexists_by_name((hid_t)*loc_id, c_obj_name, c_attr_name, (hid_t)*lapl_id)) <
+ 0)
+ HGOTO_DONE(FAIL);
done:
- if(c_obj_name)
+ if (c_obj_name)
HDfree(c_obj_name);
- if(c_attr_name)
+ if (c_attr_name)
HDfree(c_attr_name);
return ret_value;
}
@@ -959,36 +960,37 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5aopen_by_name_c (hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd attr_name, size_t_f *attr_namelen,
- hid_t_f *aapl_id, hid_t_f *lapl_id, hid_t_f *attr_id)
+h5aopen_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd attr_name,
+ size_t_f *attr_namelen, hid_t_f *aapl_id, hid_t_f *lapl_id, hid_t_f *attr_id)
/******/
{
- char *c_obj_name = NULL; /* Buffer to hold object name C string */
- char *c_attr_name = NULL; /* Buffer to hold attribute name C string */
- int_f ret_value = 0; /* Return value */
-
- /*
- * Convert FORTRAN name to C name
- */
- if((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL)
- HGOTO_DONE(FAIL);
- if((c_attr_name = HD5f2cstring(attr_name, (size_t)*attr_namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Aopen function.
- */
- if((*attr_id = (hid_t_f)H5Aopen_by_name((hid_t)*loc_id, c_obj_name, c_attr_name, (hid_t)*aapl_id, (hid_t)*lapl_id)) < 0)
- HGOTO_DONE(FAIL);
-
- done:
- if(c_obj_name)
- HDfree(c_obj_name);
- if(c_attr_name)
- HDfree(c_attr_name);
- return ret_value;
+ char *c_obj_name = NULL; /* Buffer to hold object name C string */
+ char *c_attr_name = NULL; /* Buffer to hold attribute name C string */
+ int_f ret_value = 0; /* Return value */
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+ if ((c_attr_name = HD5f2cstring(attr_name, (size_t)*attr_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Aopen function.
+ */
+ if ((*attr_id = (hid_t_f)H5Aopen_by_name((hid_t)*loc_id, c_obj_name, c_attr_name, (hid_t)*aapl_id,
+ (hid_t)*lapl_id)) < 0)
+ HGOTO_DONE(FAIL);
+
+done:
+ if (c_obj_name)
+ HDfree(c_obj_name);
+ if (c_attr_name)
+ HDfree(c_attr_name);
+ return ret_value;
}
/****if* H5Af/h5arename_c
@@ -1012,33 +1014,32 @@ h5aopen_by_name_c (hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd a
* HISTORY
* N/A
* SOURCE
-*/
+ */
int_f
-h5arename_c( hid_t_f *loc_id,
- _fcd old_attr_name, size_t_f *old_attr_namelen,
- _fcd new_attr_name, size_t_f *new_attr_namelen)
+h5arename_c(hid_t_f *loc_id, _fcd old_attr_name, size_t_f *old_attr_namelen, _fcd new_attr_name,
+ size_t_f *new_attr_namelen)
/******/
{
- char *c_old_attr_name = NULL; /* Buffer to hold C string */
- char *c_new_attr_name = NULL; /* Buffer to hold C string */
- int_f ret_value=0; /* Return value */
- /*
- * Convert FORTRAN name to C name
- */
- if((c_old_attr_name = HD5f2cstring(old_attr_name, (size_t)*old_attr_namelen)) == NULL)
- HGOTO_DONE(FAIL);
- if((c_new_attr_name = HD5f2cstring(new_attr_name, (size_t)*new_attr_namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- if(H5Arename((hid_t)*loc_id,c_old_attr_name,c_new_attr_name) < 0)
+ char *c_old_attr_name = NULL; /* Buffer to hold C string */
+ char *c_new_attr_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_old_attr_name = HD5f2cstring(old_attr_name, (size_t)*old_attr_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+ if ((c_new_attr_name = HD5f2cstring(new_attr_name, (size_t)*new_attr_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ if (H5Arename((hid_t)*loc_id, c_old_attr_name, c_new_attr_name) < 0)
HGOTO_DONE(FAIL);
done:
- if(c_old_attr_name)
- HDfree(c_old_attr_name);
- if(c_new_attr_name)
- HDfree(c_new_attr_name);
+ if (c_old_attr_name)
+ HDfree(c_old_attr_name);
+ if (c_new_attr_name)
+ HDfree(c_new_attr_name);
return ret_value;
}
/****if* H5Af/h5awrite_f_c
@@ -1059,19 +1060,20 @@ done:
*
*
* SOURCE
-*/
+ */
int_f
-h5awrite_f_c (hid_t_f *attr_id, hid_t_f *mem_type_id, void *buf)
+h5awrite_f_c(hid_t_f *attr_id, hid_t_f *mem_type_id, void *buf)
/******/
{
- int ret_value = -1;
- herr_t ret;
+ int ret_value = -1;
+ herr_t ret;
- ret = H5Awrite( (hid_t)*attr_id, (hid_t)*mem_type_id, buf);
+ ret = H5Awrite((hid_t)*attr_id, (hid_t)*mem_type_id, buf);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Af/h5aread_f_c
@@ -1092,18 +1094,18 @@ h5awrite_f_c (hid_t_f *attr_id, hid_t_f *mem_type_id, void *buf)
*
*
* SOURCE
-*/
+ */
int_f
-h5aread_f_c (hid_t_f *attr_id, hid_t_f *mem_type_id, void *buf)
+h5aread_f_c(hid_t_f *attr_id, hid_t_f *mem_type_id, void *buf)
/******/
{
- int ret_value = -1;
- herr_t ret;
+ int ret_value = -1;
+ herr_t ret;
- ret = H5Aread( (hid_t)*attr_id, (hid_t)*mem_type_id, buf);
+ ret = H5Aread((hid_t)*attr_id, (hid_t)*mem_type_id, buf);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
-
diff --git a/fortran/src/H5Df.c b/fortran/src/H5Df.c
index 8ef7936..7d1ea9e 100644
--- a/fortran/src/H5Df.c
+++ b/fortran/src/H5Df.c
@@ -17,7 +17,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include "H5f90.h"
@@ -44,34 +44,34 @@
* - Added optional parameters introduced in version 1.8
* February, 2008
* SOURCE
-*/
+ */
int_f
-h5dcreate_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *space_id,
- hid_t_f *lcpl_id, hid_t_f *dcpl_id, hid_t_f *dapl_id, hid_t_f *dset_id)
+h5dcreate_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *space_id, hid_t_f *lcpl_id,
+ hid_t_f *dcpl_id, hid_t_f *dapl_id, hid_t_f *dset_id)
/******/
{
- char *c_name = NULL;
- hid_t c_dset_id;
- int ret_value = -1;
-
- /*
- * Convert FORTRAN name to C name
- */
- if(NULL == ( c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
- goto DONE;
-
- /*
- * Call H5Dcreate2 function.
- */
- if((c_dset_id = H5Dcreate2((hid_t)*loc_id, c_name, (hid_t)*type_id, (hid_t)*space_id,
- (hid_t)*lcpl_id, (hid_t)*dcpl_id, (hid_t)*dapl_id)) < 0)
- goto DONE;
- *dset_id = (hid_t_f)c_dset_id;
-
- ret_value = 0;
+ char *c_name = NULL;
+ hid_t c_dset_id;
+ int ret_value = -1;
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ goto DONE;
+
+ /*
+ * Call H5Dcreate2 function.
+ */
+ if ((c_dset_id = H5Dcreate2((hid_t)*loc_id, c_name, (hid_t)*type_id, (hid_t)*space_id, (hid_t)*lcpl_id,
+ (hid_t)*dcpl_id, (hid_t)*dapl_id)) < 0)
+ goto DONE;
+ *dset_id = (hid_t_f)c_dset_id;
+
+ ret_value = 0;
DONE:
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
}
@@ -96,34 +96,34 @@ DONE:
* HISTORY
* Added 1.8 parameter: dapl_id
* SOURCE
-*/
+ */
int_f
h5dopen_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *dapl_id, hid_t_f *dset_id)
/******/
{
- char *c_name = NULL;
- hid_t c_dset_id;
- int ret_value = -1;
+ char *c_name = NULL;
+ hid_t c_dset_id;
+ int ret_value = -1;
- /*
- * Convert FORTRAN name to C name
- */
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
- goto DONE;
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ goto DONE;
- /*
- * Call H5Dopen2 function.
- */
- if((c_dset_id = H5Dopen2((hid_t)*loc_id, c_name, (hid_t)*dapl_id)) < 0)
- goto DONE;
+ /*
+ * Call H5Dopen2 function.
+ */
+ if ((c_dset_id = H5Dopen2((hid_t)*loc_id, c_name, (hid_t)*dapl_id)) < 0)
+ goto DONE;
- *dset_id = (hid_t_f)c_dset_id;
- ret_value = 0;
+ *dset_id = (hid_t_f)c_dset_id;
+ ret_value = 0;
DONE:
- if(c_name)
- HDfree(c_name);
- return ret_value;
+ if (c_name)
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Df/h5dwrite_ref_reg_c
@@ -148,52 +148,54 @@ DONE:
* This function was added to accomodate h5dwrite_f with the
* dims argument being of INTEGER(HSIZE_T) type
* SOURCE
-*/
+ */
int_f
-h5dwrite_ref_reg_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims)
+h5dwrite_ref_reg_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id,
+ hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims)
/******/
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_dset_id;
- hid_t c_mem_type_id;
- hid_t c_mem_space_id;
- hid_t c_file_space_id;
- hid_t c_xfer_prp;
- hdset_reg_ref_t *buf_c = NULL;
- unsigned int i, n;
-
- n = (unsigned int)*dims;
- /*
- * Define transfer property
- */
- c_xfer_prp = (hid_t)*xfer_prp;
-
- /*
- * Allocate temporary buffer and copy references from Fortran.
- */
- buf_c = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t)*n);
- if ( buf_c != NULL ) {
- for (i = 0; i < n; i++) {
- HDmemcpy(&buf_c[i], buf, H5R_DSET_REG_REF_BUF_SIZE);
- buf = buf + REF_REG_BUF_LEN_F;
- }
- }
- else return ret_value;
-
-
- /*
- * Call H5Dwrite function.
- */
- c_dset_id = (hid_t)*dset_id;
- c_mem_type_id = (hid_t)*mem_type_id;
- c_mem_space_id = (hid_t)*mem_space_id;
- c_file_space_id = (hid_t)*file_space_id;
- ret = H5Dwrite(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf_c);
- HDfree(buf_c);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_dset_id;
+ hid_t c_mem_type_id;
+ hid_t c_mem_space_id;
+ hid_t c_file_space_id;
+ hid_t c_xfer_prp;
+ hdset_reg_ref_t *buf_c = NULL;
+ unsigned int i, n;
+
+ n = (unsigned int)*dims;
+ /*
+ * Define transfer property
+ */
+ c_xfer_prp = (hid_t)*xfer_prp;
+
+ /*
+ * Allocate temporary buffer and copy references from Fortran.
+ */
+ buf_c = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * n);
+ if (buf_c != NULL) {
+ for (i = 0; i < n; i++) {
+ HDmemcpy(&buf_c[i], buf, H5R_DSET_REG_REF_BUF_SIZE);
+ buf = buf + REF_REG_BUF_LEN_F;
+ }
+ }
+ else
+ return ret_value;
+
+ /*
+ * Call H5Dwrite function.
+ */
+ c_dset_id = (hid_t)*dset_id;
+ c_mem_type_id = (hid_t)*mem_type_id;
+ c_mem_space_id = (hid_t)*mem_space_id;
+ c_file_space_id = (hid_t)*file_space_id;
+ ret = H5Dwrite(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf_c);
+ HDfree(buf_c);
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Df/h5dread_ref_reg_c
@@ -218,54 +220,55 @@ h5dwrite_ref_reg_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_i
* This function was added to accomodate h5dread_f subroutine
* with the dims parameter being of INTEGER(HSIZE_T_F) size.
* SOURCE
-*/
+ */
int_f
-h5dread_ref_reg_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f * buf, hsize_t_f *dims)
+h5dread_ref_reg_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id,
+ hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims)
/******/
{
- int ret_value = -1;
- herr_t ret = -1;
- hid_t c_dset_id;
- hid_t c_mem_type_id;
- hid_t c_mem_space_id;
- hid_t c_file_space_id;
- hid_t c_xfer_prp;
- hdset_reg_ref_t *buf_c = NULL;
- hsize_t i, n;
- n = (hsize_t)*dims;
- /*
- * Define transfer property
- */
- c_xfer_prp = (hid_t)*xfer_prp;
-
- /*
- * Allocate temporary buffer.
- */
- buf_c = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t)*(size_t)n);
- if ( buf_c != NULL ) {
- /*
- * Call H5Dread function.
- */
- c_dset_id = (hid_t)*dset_id;
- c_mem_type_id = (hid_t)*mem_type_id;
- c_mem_space_id = (hid_t)*mem_space_id;
- c_file_space_id = (hid_t)*file_space_id;
- ret = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf_c);
- if (ret >=0) {
+ int ret_value = -1;
+ herr_t ret = -1;
+ hid_t c_dset_id;
+ hid_t c_mem_type_id;
+ hid_t c_mem_space_id;
+ hid_t c_file_space_id;
+ hid_t c_xfer_prp;
+ hdset_reg_ref_t *buf_c = NULL;
+ hsize_t i, n;
+ n = (hsize_t)*dims;
+ /*
+ * Define transfer property
+ */
+ c_xfer_prp = (hid_t)*xfer_prp;
+
+ /*
+ * Allocate temporary buffer.
+ */
+ buf_c = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * (size_t)n);
+ if (buf_c != NULL) {
+ /*
+ * Call H5Dread function.
+ */
+ c_dset_id = (hid_t)*dset_id;
+ c_mem_type_id = (hid_t)*mem_type_id;
+ c_mem_space_id = (hid_t)*mem_space_id;
+ c_file_space_id = (hid_t)*file_space_id;
+ ret = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf_c);
+ if (ret >= 0) {
for (i = 0; i < n; i++) {
- HDmemcpy(buf, &buf_c[i], H5R_DSET_REG_REF_BUF_SIZE);
- buf = buf + REF_REG_BUF_LEN_F;
+ HDmemcpy(buf, &buf_c[i], H5R_DSET_REG_REF_BUF_SIZE);
+ buf = buf + REF_REG_BUF_LEN_F;
}
- }
- if ( buf_c != NULL ) HDfree(buf_c);
- }
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ }
+ if (buf_c != NULL)
+ HDfree(buf_c);
+ }
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
-
-
/****if* H5Df/h5dclose_c
* NAME
* h5dclose_c
@@ -281,17 +284,18 @@ h5dread_ref_reg_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5dclose_c ( hid_t_f *dset_id )
+h5dclose_c(hid_t_f *dset_id)
/******/
{
- int ret_value = 0;
- hid_t c_dset_id;
- c_dset_id = (hid_t)*dset_id;
- if ( H5Dclose(c_dset_id) < 0 ) ret_value = -1;
- return ret_value;
+ int ret_value = 0;
+ hid_t c_dset_id;
+ c_dset_id = (hid_t)*dset_id;
+ if (H5Dclose(c_dset_id) < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Df/h5dget_space_c
@@ -311,22 +315,23 @@ h5dclose_c ( hid_t_f *dset_id )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5dget_space_c ( hid_t_f *dset_id , hid_t_f *space_id)
+h5dget_space_c(hid_t_f *dset_id, hid_t_f *space_id)
/******/
{
- int ret_value = -1;
- hid_t c_dset_id;
- hid_t c_space_id;
-
- c_dset_id = (hid_t)*dset_id;
- c_space_id = H5Dget_space(c_dset_id);
- if(c_space_id < 0 ) return ret_value;
- ret_value = 0;
- *space_id = (hid_t_f)c_space_id;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_dset_id;
+ hid_t c_space_id;
+
+ c_dset_id = (hid_t)*dset_id;
+ c_space_id = H5Dget_space(c_dset_id);
+ if (c_space_id < 0)
+ return ret_value;
+ ret_value = 0;
+ *space_id = (hid_t_f)c_space_id;
+ return ret_value;
}
/****if* H5Df/h5dget_type_c
@@ -346,24 +351,25 @@ h5dget_space_c ( hid_t_f *dset_id , hid_t_f *space_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5dget_type_c ( hid_t_f *dset_id , hid_t_f *type_id)
+h5dget_type_c(hid_t_f *dset_id, hid_t_f *type_id)
/******/
{
- int ret_value = -1;
- hid_t c_dset_id;
- hid_t c_type_id;
+ int ret_value = -1;
+ hid_t c_dset_id;
+ hid_t c_type_id;
- c_dset_id = (hid_t)*dset_id;
- c_type_id = H5Dget_type(c_dset_id);
+ c_dset_id = (hid_t)*dset_id;
+ c_type_id = H5Dget_type(c_dset_id);
- if(c_type_id < 0 ) return ret_value;
+ if (c_type_id < 0)
+ return ret_value;
- *type_id = (hid_t_f)c_type_id;
- ret_value = 0;
- return ret_value;
+ *type_id = (hid_t_f)c_type_id;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Df/h5dget_create_plist_c
@@ -384,27 +390,27 @@ h5dget_type_c ( hid_t_f *dset_id , hid_t_f *type_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5dget_create_plist_c ( hid_t_f *dset_id , hid_t_f *plist_id)
+h5dget_create_plist_c(hid_t_f *dset_id, hid_t_f *plist_id)
/******/
{
- int ret_value = -1;
- hid_t c_dset_id;
- hid_t c_plist_id;
+ int ret_value = -1;
+ hid_t c_dset_id;
+ hid_t c_plist_id;
- c_dset_id = (hid_t)*dset_id;
- c_plist_id = H5Dget_create_plist(c_dset_id);
+ c_dset_id = (hid_t)*dset_id;
+ c_plist_id = H5Dget_create_plist(c_dset_id);
- if(c_plist_id < 0 ) return ret_value;
+ if (c_plist_id < 0)
+ return ret_value;
- ret_value = 0;
- *plist_id = (hid_t_f)c_plist_id;
- return ret_value;
+ ret_value = 0;
+ *plist_id = (hid_t_f)c_plist_id;
+ return ret_value;
}
-
/****if* H5Df/h5dset_extent_c
* NAME
* h5dset_extent_c
@@ -425,37 +431,38 @@ h5dget_create_plist_c ( hid_t_f *dset_id , hid_t_f *plist_id)
* to h5dset_extent in order to match new fortran interface.
* -MSB- March 14, 2008
* SOURCE
-*/
+ */
int_f
-h5dset_extent_c ( hid_t_f *dset_id , hsize_t_f *dims)
+h5dset_extent_c(hid_t_f *dset_id, hsize_t_f *dims)
/******/
{
- hid_t c_space_id;
- hsize_t c_dims[H5S_MAX_RANK];
- int rank;
- int i;
- int status;
- int ret_value = -1;
-
- if((c_space_id = H5Dget_space((hid_t)*dset_id)) < 0) return ret_value;
-
- rank = H5Sget_simple_extent_ndims(c_space_id);
- H5Sclose(c_space_id);
- if(rank < 0 ) return ret_value;
-
-
- /*
- * Reverse dimensions due to C-FORTRAN storage order.
- */
- for(i = 0; i < rank; i++)
- c_dims[i] = (hsize_t)dims[rank - i - 1];
-
- status = H5Dset_extent((hid_t)*dset_id, c_dims);
-
- if(status >= 0)
- ret_value = 0;
- return ret_value;
+ hid_t c_space_id;
+ hsize_t c_dims[H5S_MAX_RANK];
+ int rank;
+ int i;
+ int status;
+ int ret_value = -1;
+
+ if ((c_space_id = H5Dget_space((hid_t)*dset_id)) < 0)
+ return ret_value;
+
+ rank = H5Sget_simple_extent_ndims(c_space_id);
+ H5Sclose(c_space_id);
+ if (rank < 0)
+ return ret_value;
+
+ /*
+ * Reverse dimensions due to C-FORTRAN storage order.
+ */
+ for (i = 0; i < rank; i++)
+ c_dims[i] = (hsize_t)dims[rank - i - 1];
+
+ status = H5Dset_extent((hid_t)*dset_id, c_dims);
+
+ if (status >= 0)
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Df/h5dget_storage_size_c
@@ -476,22 +483,23 @@ h5dset_extent_c ( hid_t_f *dset_id , hsize_t_f *dims)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5dget_storage_size_c ( hid_t_f *dset_id , hsize_t_f *size)
+h5dget_storage_size_c(hid_t_f *dset_id, hsize_t_f *size)
/******/
{
- int ret_value = -1;
- hsize_t c_size;
- hid_t c_dset_id;
-
- c_dset_id = (hid_t)*dset_id;
- c_size = H5Dget_storage_size(c_dset_id);
- if (c_size == 0) return ret_value;
- *size = (hsize_t_f)c_size;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hsize_t c_size;
+ hid_t c_dset_id;
+
+ c_dset_id = (hid_t)*dset_id;
+ c_size = H5Dget_storage_size(c_dset_id);
+ if (c_size == 0)
+ return ret_value;
+ *size = (hsize_t_f)c_size;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Df/h5dvlen_get_max_len_c
@@ -513,44 +521,48 @@ h5dget_storage_size_c ( hid_t_f *dset_id , hsize_t_f *size)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5dvlen_get_max_len_c ( hid_t_f *dset_id , hid_t_f *type_id, hid_t_f *space_id, size_t_f *len)
+h5dvlen_get_max_len_c(hid_t_f *dset_id, hid_t_f *type_id, hid_t_f *space_id, size_t_f *len)
/******/
{
- int ret_value = -1;
- size_t c_len;
- hid_t c_dset_id;
- hid_t c_type_id;
- hid_t c_space_id;
- hvl_t *c_buf;
- int i;
- hssize_t num_elem;
- herr_t status;
-
- c_dset_id = (hid_t)*dset_id;
- c_type_id = (hid_t)*type_id;
- c_space_id = (hid_t)*space_id;
-
- num_elem = H5Sget_select_npoints(c_space_id);
- if( num_elem < 0) return ret_value;
-
- c_buf = (hvl_t *)HDmalloc(sizeof(hvl_t)*(size_t)num_elem);
- if (c_buf == NULL) return ret_value;
- status = H5Dread(c_dset_id, c_type_id, H5S_ALL, c_space_id, H5P_DEFAULT, c_buf);
- if(status < 0) goto DONE;
-
- c_len = 0;
- for (i=0; i < num_elem; i++) c_len = H5_MAX(c_len, c_buf[i].len);
- *len = (size_t_f)c_len;
- H5Treclaim(c_type_id, c_space_id, H5P_DEFAULT, c_buf);
- ret_value = 0;
+ int ret_value = -1;
+ size_t c_len;
+ hid_t c_dset_id;
+ hid_t c_type_id;
+ hid_t c_space_id;
+ hvl_t * c_buf;
+ int i;
+ hssize_t num_elem;
+ herr_t status;
+
+ c_dset_id = (hid_t)*dset_id;
+ c_type_id = (hid_t)*type_id;
+ c_space_id = (hid_t)*space_id;
+
+ num_elem = H5Sget_select_npoints(c_space_id);
+ if (num_elem < 0)
+ return ret_value;
+
+ c_buf = (hvl_t *)HDmalloc(sizeof(hvl_t) * (size_t)num_elem);
+ if (c_buf == NULL)
+ return ret_value;
+ status = H5Dread(c_dset_id, c_type_id, H5S_ALL, c_space_id, H5P_DEFAULT, c_buf);
+ if (status < 0)
+ goto DONE;
+
+ c_len = 0;
+ for (i = 0; i < num_elem; i++)
+ c_len = H5_MAX(c_len, c_buf[i].len);
+ *len = (size_t_f)c_len;
+ H5Treclaim(c_type_id, c_space_id, H5P_DEFAULT, c_buf);
+ ret_value = 0;
DONE:
- HDfree(c_buf);
- return ret_value;
+ HDfree(c_buf);
+ return ret_value;
}
/****if* H5Df/h5dwrite_vl_integer_c
* NAME
@@ -576,53 +588,56 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5dwrite_vl_integer_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims, size_t_f *len)
+h5dwrite_vl_integer_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id,
+ hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims, size_t_f *len)
/******/
{
- int ret_value = -1;
- hid_t c_dset_id;
- hid_t c_mem_type_id;
- hid_t c_mem_space_id;
- hid_t c_file_space_id;
- hid_t c_xfer_prp;
- herr_t status;
- int_f *tmp;
- size_t max_len;
-
- hvl_t *c_buf;
- hsize_t i;
- hsize_t num_elem;
-
- max_len = (size_t)dims[0];
- num_elem = (hsize_t)dims[1];
-
- c_dset_id = (hid_t)*dset_id;
- c_mem_type_id = (hid_t)*mem_type_id;
- c_mem_space_id = (hid_t)*mem_space_id;
- c_file_space_id = (hid_t)*file_space_id;
- c_xfer_prp = (hid_t)*xfer_prp;
-
- c_buf = (hvl_t *)HDmalloc((size_t)num_elem * sizeof(hvl_t));
- if (c_buf == NULL) return ret_value;
- tmp = (int_f *)buf;
- for (i=0; i < num_elem; i++) {
- c_buf[i].len = (size_t)len[i];
- c_buf[i].p = tmp;
- tmp = tmp + max_len;
- }
- /*
- * Call H5Dwrite function.
- */
- status = H5Dwrite(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf);
-
- if( status < 0) goto DONE;
- ret_value = 0;
+ int ret_value = -1;
+ hid_t c_dset_id;
+ hid_t c_mem_type_id;
+ hid_t c_mem_space_id;
+ hid_t c_file_space_id;
+ hid_t c_xfer_prp;
+ herr_t status;
+ int_f *tmp;
+ size_t max_len;
+
+ hvl_t * c_buf;
+ hsize_t i;
+ hsize_t num_elem;
+
+ max_len = (size_t)dims[0];
+ num_elem = (hsize_t)dims[1];
+
+ c_dset_id = (hid_t)*dset_id;
+ c_mem_type_id = (hid_t)*mem_type_id;
+ c_mem_space_id = (hid_t)*mem_space_id;
+ c_file_space_id = (hid_t)*file_space_id;
+ c_xfer_prp = (hid_t)*xfer_prp;
+
+ c_buf = (hvl_t *)HDmalloc((size_t)num_elem * sizeof(hvl_t));
+ if (c_buf == NULL)
+ return ret_value;
+ tmp = (int_f *)buf;
+ for (i = 0; i < num_elem; i++) {
+ c_buf[i].len = (size_t)len[i];
+ c_buf[i].p = tmp;
+ tmp = tmp + max_len;
+ }
+ /*
+ * Call H5Dwrite function.
+ */
+ status = H5Dwrite(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf);
+
+ if (status < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- HDfree(c_buf);
- return ret_value;
+ HDfree(c_buf);
+ return ret_value;
}
/****if* H5Df/h5dread_vl_integer_c
@@ -650,51 +665,55 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5dread_vl_integer_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims, size_t_f *len)
+h5dread_vl_integer_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id,
+ hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims, size_t_f *len)
/******/
{
- int ret_value = -1;
- hid_t c_dset_id;
- hid_t c_mem_type_id;
- hid_t c_mem_space_id;
- hid_t c_file_space_id;
- hid_t c_xfer_prp;
- herr_t status;
- size_t max_len;
-
- hvl_t *c_buf;
- hsize_t i;
- hssize_t num_elem;
-
- c_dset_id = (hid_t)*dset_id;
- c_mem_type_id = (hid_t)*mem_type_id;
- c_mem_space_id = (hid_t)*mem_space_id;
- c_file_space_id = (hid_t)*file_space_id;
- c_xfer_prp = (hid_t)*xfer_prp;
-
- max_len = (size_t)dims[0];
- num_elem = H5Sget_select_npoints(c_mem_space_id);
- if(num_elem != (hssize_t)dims[1]) return ret_value;
-
- c_buf = (hvl_t *)HDmalloc((size_t)num_elem * sizeof(hvl_t));
- if (c_buf == NULL) return ret_value;
- /*
- * Call H5Dread function.
- */
- status = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf);
- if ( status < 0 ) goto DONE;
- for (i=0; i < (hsize_t)num_elem; i++) {
- len[i] = (size_t_f)c_buf[i].len;
- memcpy(&buf[i*max_len], c_buf[i].p, c_buf[i].len*sizeof(int_f));
- }
- H5Treclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf);
- ret_value = 0;
+ int ret_value = -1;
+ hid_t c_dset_id;
+ hid_t c_mem_type_id;
+ hid_t c_mem_space_id;
+ hid_t c_file_space_id;
+ hid_t c_xfer_prp;
+ herr_t status;
+ size_t max_len;
+
+ hvl_t * c_buf;
+ hsize_t i;
+ hssize_t num_elem;
+
+ c_dset_id = (hid_t)*dset_id;
+ c_mem_type_id = (hid_t)*mem_type_id;
+ c_mem_space_id = (hid_t)*mem_space_id;
+ c_file_space_id = (hid_t)*file_space_id;
+ c_xfer_prp = (hid_t)*xfer_prp;
+
+ max_len = (size_t)dims[0];
+ num_elem = H5Sget_select_npoints(c_mem_space_id);
+ if (num_elem != (hssize_t)dims[1])
+ return ret_value;
+
+ c_buf = (hvl_t *)HDmalloc((size_t)num_elem * sizeof(hvl_t));
+ if (c_buf == NULL)
+ return ret_value;
+ /*
+ * Call H5Dread function.
+ */
+ status = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf);
+ if (status < 0)
+ goto DONE;
+ for (i = 0; i < (hsize_t)num_elem; i++) {
+ len[i] = (size_t_f)c_buf[i].len;
+ memcpy(&buf[i * max_len], c_buf[i].p, c_buf[i].len * sizeof(int_f));
+ }
+ H5Treclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf);
+ ret_value = 0;
DONE:
- HDfree(c_buf);
- return ret_value;
+ HDfree(c_buf);
+ return ret_value;
}
/****if* H5Df/h5dwrite_vl_string_c
@@ -720,69 +739,73 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5dwrite_vl_string_c( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims, size_t_f *len)
+h5dwrite_vl_string_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id,
+ hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims, size_t_f *len)
/******/
{
- int ret_value = -1;
- hid_t c_dset_id;
- hid_t c_mem_type_id;
- hid_t c_mem_space_id;
- hid_t c_file_space_id;
- hid_t c_xfer_prp;
- herr_t status;
- char *tmp, *tmp_p;
- size_t max_len;
-
- char **c_buf;
- hsize_t i;
- hsize_t num_elem;
-
- max_len = (size_t)dims[0];
- num_elem = (hsize_t)dims[1];
-
- c_dset_id = (hid_t)*dset_id;
- c_mem_type_id = (hid_t)*mem_type_id;
- c_mem_space_id = (hid_t)*mem_space_id;
- c_file_space_id = (hid_t)*file_space_id;
- c_xfer_prp = (hid_t)*xfer_prp;
-
- /*
- * Allocate arra of character pointers
- */
- c_buf = (char **)HDmalloc((size_t)num_elem * sizeof(char *));
- if (c_buf == NULL) return ret_value;
-
- /* Copy data to long C string */
- tmp = (char *)HD5f2cstring(buf, (size_t)(max_len*num_elem));
- if (tmp == NULL) { HDfree(c_buf);
- return ret_value;
- }
- /*
- * Move data from temorary buffer
- */
- tmp_p = tmp;
- for (i=0; i < num_elem; i++) {
- c_buf[i] = (char *) HDmalloc((size_t)len[i]+1);
+ int ret_value = -1;
+ hid_t c_dset_id;
+ hid_t c_mem_type_id;
+ hid_t c_mem_space_id;
+ hid_t c_file_space_id;
+ hid_t c_xfer_prp;
+ herr_t status;
+ char * tmp, *tmp_p;
+ size_t max_len;
+
+ char ** c_buf;
+ hsize_t i;
+ hsize_t num_elem;
+
+ max_len = (size_t)dims[0];
+ num_elem = (hsize_t)dims[1];
+
+ c_dset_id = (hid_t)*dset_id;
+ c_mem_type_id = (hid_t)*mem_type_id;
+ c_mem_space_id = (hid_t)*mem_space_id;
+ c_file_space_id = (hid_t)*file_space_id;
+ c_xfer_prp = (hid_t)*xfer_prp;
+
+ /*
+ * Allocate arra of character pointers
+ */
+ c_buf = (char **)HDmalloc((size_t)num_elem * sizeof(char *));
+ if (c_buf == NULL)
+ return ret_value;
+
+ /* Copy data to long C string */
+ tmp = (char *)HD5f2cstring(buf, (size_t)(max_len * num_elem));
+ if (tmp == NULL) {
+ HDfree(c_buf);
+ return ret_value;
+ }
+ /*
+ * Move data from temorary buffer
+ */
+ tmp_p = tmp;
+ for (i = 0; i < num_elem; i++) {
+ c_buf[i] = (char *)HDmalloc((size_t)len[i] + 1);
memcpy(c_buf[i], tmp_p, (size_t)len[i]);
c_buf[i][len[i]] = '\0';
- tmp_p = tmp_p + max_len;
- }
+ tmp_p = tmp_p + max_len;
+ }
- /*
- * Call H5Dwrite function.
- */
- status = H5Dwrite(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf);
+ /*
+ * Call H5Dwrite function.
+ */
+ status = H5Dwrite(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf);
- if( status < 0) goto DONE;
- ret_value = 0;
+ if (status < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- H5Treclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf);
- HDfree(c_buf);
- HDfree(tmp);
- return ret_value;
+ H5Treclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf);
+ HDfree(c_buf);
+ HDfree(tmp);
+ return ret_value;
}
/****if* H5Df/h5dread_vl_string_c
* NAME
@@ -807,64 +830,68 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5dread_vl_string_c( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims, size_t_f *len)
+h5dread_vl_string_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id,
+ hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims, size_t_f *len)
/******/
{
- int ret_value = -1;
- hid_t c_dset_id;
- hid_t c_mem_type_id;
- hid_t c_mem_space_id;
- hid_t c_file_space_id;
- hid_t c_xfer_prp;
- herr_t status;
- char *tmp, *tmp_p;
- size_t max_len;
-
- char **c_buf;
- hsize_t i;
- hsize_t num_elem;
-
- max_len = (size_t)dims[0];
- num_elem = (hsize_t)dims[1];
-
- c_dset_id = (hid_t)*dset_id;
- c_mem_type_id = (hid_t)*mem_type_id;
- c_mem_space_id = (hid_t)*mem_space_id;
- c_file_space_id = (hid_t)*file_space_id;
- c_xfer_prp = (hid_t)*xfer_prp;
-
- /*
- * Allocate array of character pointers
- */
- c_buf = (char **)HDmalloc((size_t)num_elem * sizeof(char *));
- if (c_buf == NULL) return ret_value;
-
- /*
- * Call H5Dread function.
- */
- status = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf);
- if (status < 0) { HDfree(c_buf);
- return ret_value;
- }
- /* Copy data to long C string */
- tmp = (char *)HDmalloc((size_t)(max_len*num_elem) +1);
- tmp_p = tmp;
- for (i=0; i<max_len*num_elem; i++) tmp[i] = ' ';
- tmp[max_len*num_elem] = '\0';
- for (i=0; i < num_elem; i++) {
+ int ret_value = -1;
+ hid_t c_dset_id;
+ hid_t c_mem_type_id;
+ hid_t c_mem_space_id;
+ hid_t c_file_space_id;
+ hid_t c_xfer_prp;
+ herr_t status;
+ char * tmp, *tmp_p;
+ size_t max_len;
+
+ char ** c_buf;
+ hsize_t i;
+ hsize_t num_elem;
+
+ max_len = (size_t)dims[0];
+ num_elem = (hsize_t)dims[1];
+
+ c_dset_id = (hid_t)*dset_id;
+ c_mem_type_id = (hid_t)*mem_type_id;
+ c_mem_space_id = (hid_t)*mem_space_id;
+ c_file_space_id = (hid_t)*file_space_id;
+ c_xfer_prp = (hid_t)*xfer_prp;
+
+ /*
+ * Allocate array of character pointers
+ */
+ c_buf = (char **)HDmalloc((size_t)num_elem * sizeof(char *));
+ if (c_buf == NULL)
+ return ret_value;
+
+ /*
+ * Call H5Dread function.
+ */
+ status = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf);
+ if (status < 0) {
+ HDfree(c_buf);
+ return ret_value;
+ }
+ /* Copy data to long C string */
+ tmp = (char *)HDmalloc((size_t)(max_len * num_elem) + 1);
+ tmp_p = tmp;
+ for (i = 0; i < max_len * num_elem; i++)
+ tmp[i] = ' ';
+ tmp[max_len * num_elem] = '\0';
+ for (i = 0; i < num_elem; i++) {
memcpy(tmp_p, c_buf[i], strlen(c_buf[i]));
len[i] = (size_t_f)strlen(c_buf[i]);
- tmp_p = tmp_p + max_len;
- }
- HD5packFstring(tmp, _fcdtocp(buf), (size_t)(max_len*num_elem));
- ret_value = 0;
- H5Treclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf);
- HDfree(c_buf);
- HDfree(tmp);
- return ret_value;
+ tmp_p = tmp_p + max_len;
+ }
+ HD5packFstring(tmp, _fcdtocp(buf), (size_t)(max_len * num_elem));
+ ret_value = 0;
+ H5Treclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf);
+ HDfree(c_buf);
+ HDfree(tmp);
+ return ret_value;
}
/****if* H5Df/h5dwrite_vl_real_c
@@ -891,53 +918,56 @@ h5dread_vl_string_c( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_spac
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5dwrite_vl_real_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, real_f *buf, hsize_t_f *dims, size_t_f *len)
+h5dwrite_vl_real_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id,
+ hid_t_f *xfer_prp, real_f *buf, hsize_t_f *dims, size_t_f *len)
/******/
{
- int ret_value = -1;
- hid_t c_dset_id;
- hid_t c_mem_type_id;
- hid_t c_mem_space_id;
- hid_t c_file_space_id;
- hid_t c_xfer_prp;
- herr_t status;
- real_f *tmp;
- size_t max_len;
-
- hvl_t *c_buf;
- hsize_t i;
- hsize_t num_elem;
-
- max_len = (size_t)dims[0];
- num_elem = (hsize_t)dims[1];
-
- c_dset_id = (hid_t)*dset_id;
- c_mem_type_id = (hid_t)*mem_type_id;
- c_mem_space_id = (hid_t)*mem_space_id;
- c_file_space_id = (hid_t)*file_space_id;
- c_xfer_prp = (hid_t)*xfer_prp;
-
- c_buf = (hvl_t *)HDmalloc((size_t)num_elem * sizeof(hvl_t));
- if (c_buf == NULL) return ret_value;
- tmp = (real_f *)buf;
- for (i=0; i < num_elem; i++) {
- c_buf[i].len = (size_t)len[i];
- c_buf[i].p = tmp;
- tmp = tmp + max_len;
- }
- /*
- * Call H5Dwrite function.
- */
- status = H5Dwrite(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf);
-
- if( status < 0) goto DONE;
- ret_value = 0;
+ int ret_value = -1;
+ hid_t c_dset_id;
+ hid_t c_mem_type_id;
+ hid_t c_mem_space_id;
+ hid_t c_file_space_id;
+ hid_t c_xfer_prp;
+ herr_t status;
+ real_f *tmp;
+ size_t max_len;
+
+ hvl_t * c_buf;
+ hsize_t i;
+ hsize_t num_elem;
+
+ max_len = (size_t)dims[0];
+ num_elem = (hsize_t)dims[1];
+
+ c_dset_id = (hid_t)*dset_id;
+ c_mem_type_id = (hid_t)*mem_type_id;
+ c_mem_space_id = (hid_t)*mem_space_id;
+ c_file_space_id = (hid_t)*file_space_id;
+ c_xfer_prp = (hid_t)*xfer_prp;
+
+ c_buf = (hvl_t *)HDmalloc((size_t)num_elem * sizeof(hvl_t));
+ if (c_buf == NULL)
+ return ret_value;
+ tmp = (real_f *)buf;
+ for (i = 0; i < num_elem; i++) {
+ c_buf[i].len = (size_t)len[i];
+ c_buf[i].p = tmp;
+ tmp = tmp + max_len;
+ }
+ /*
+ * Call H5Dwrite function.
+ */
+ status = H5Dwrite(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf);
+
+ if (status < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- HDfree(c_buf);
- return ret_value;
+ HDfree(c_buf);
+ return ret_value;
}
/****if* H5Df/h5dread_vl_real_c
@@ -965,52 +995,56 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5dread_vl_real_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, real_f *buf, hsize_t_f *dims, size_t_f *len)
+h5dread_vl_real_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id,
+ hid_t_f *xfer_prp, real_f *buf, hsize_t_f *dims, size_t_f *len)
/******/
{
- int ret_value = -1;
- hid_t c_dset_id;
- hid_t c_mem_type_id;
- hid_t c_mem_space_id;
- hid_t c_file_space_id;
- hid_t c_xfer_prp;
- herr_t status;
- size_t max_len;
-
- hvl_t *c_buf;
- hsize_t i;
- hssize_t num_elem;
-
- c_dset_id = (hid_t)*dset_id;
- c_mem_type_id = (hid_t)*mem_type_id;
- c_mem_space_id = (hid_t)*mem_space_id;
- c_file_space_id = (hid_t)*file_space_id;
- c_xfer_prp = (hid_t)*xfer_prp;
-
- max_len = (size_t)dims[0];
- num_elem = H5Sget_select_npoints(c_mem_space_id);
- if(num_elem != (hssize_t)dims[1]) return ret_value;
-
- c_buf = (hvl_t *)HDmalloc((size_t)num_elem * sizeof(hvl_t));
- if (c_buf == NULL) return ret_value;
- /*
- * Call H5Dread function.
- */
- status = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf);
- if ( status <0 ) goto DONE;
- for (i=0; i < (hsize_t)num_elem; i++) {
- len[i] = (size_t_f)c_buf[i].len;
- memcpy(&buf[i*max_len], c_buf[i].p, c_buf[i].len*sizeof(real_f));
- }
-
- H5Treclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf);
- ret_value = 0;
+ int ret_value = -1;
+ hid_t c_dset_id;
+ hid_t c_mem_type_id;
+ hid_t c_mem_space_id;
+ hid_t c_file_space_id;
+ hid_t c_xfer_prp;
+ herr_t status;
+ size_t max_len;
+
+ hvl_t * c_buf;
+ hsize_t i;
+ hssize_t num_elem;
+
+ c_dset_id = (hid_t)*dset_id;
+ c_mem_type_id = (hid_t)*mem_type_id;
+ c_mem_space_id = (hid_t)*mem_space_id;
+ c_file_space_id = (hid_t)*file_space_id;
+ c_xfer_prp = (hid_t)*xfer_prp;
+
+ max_len = (size_t)dims[0];
+ num_elem = H5Sget_select_npoints(c_mem_space_id);
+ if (num_elem != (hssize_t)dims[1])
+ return ret_value;
+
+ c_buf = (hvl_t *)HDmalloc((size_t)num_elem * sizeof(hvl_t));
+ if (c_buf == NULL)
+ return ret_value;
+ /*
+ * Call H5Dread function.
+ */
+ status = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf);
+ if (status < 0)
+ goto DONE;
+ for (i = 0; i < (hsize_t)num_elem; i++) {
+ len[i] = (size_t_f)c_buf[i].len;
+ memcpy(&buf[i * max_len], c_buf[i].p, c_buf[i].len * sizeof(real_f));
+ }
+
+ H5Treclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf);
+ ret_value = 0;
DONE:
- HDfree(c_buf);
- return ret_value;
+ HDfree(c_buf);
+ return ret_value;
}
/****if* H5Df/h5dfill_c
@@ -1032,29 +1066,30 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5dfill_c (void * fill_value, hid_t_f *fill_type_id, hid_t_f *space_id, void * buf, hid_t_f *mem_type_id)
+h5dfill_c(void *fill_value, hid_t_f *fill_type_id, hid_t_f *space_id, void *buf, hid_t_f *mem_type_id)
/******/
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_fill_type_id;
- hid_t c_mem_type_id;
- hid_t c_space_id;
-
- c_fill_type_id = (hid_t)*fill_type_id;
- c_mem_type_id = (hid_t)*mem_type_id;
- c_space_id = (hid_t)*space_id;
-
- /*
- * Call H5Dfill function.
- */
- ret = H5Dfill(fill_value, c_fill_type_id, buf, c_mem_type_id, c_space_id);
-
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_fill_type_id;
+ hid_t c_mem_type_id;
+ hid_t c_space_id;
+
+ c_fill_type_id = (hid_t)*fill_type_id;
+ c_mem_type_id = (hid_t)*mem_type_id;
+ c_space_id = (hid_t)*space_id;
+
+ /*
+ * Call H5Dfill function.
+ */
+ ret = H5Dfill(fill_value, c_fill_type_id, buf, c_mem_type_id, c_space_id);
+
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Df/h5dget_space_status_c
@@ -1074,27 +1109,28 @@ h5dfill_c (void * fill_value, hid_t_f *fill_type_id, hid_t_f *space_id, void * b
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5dget_space_status_c ( hid_t_f *dset_id, int_f *flag)
+h5dget_space_status_c(hid_t_f *dset_id, int_f *flag)
/******/
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_dset_id;
- H5D_space_status_t c_flag;
-
- c_dset_id = (hid_t)*dset_id;
-
- /*
- * Call H5Dget_space_status
- */
- ret = H5Dget_space_status(c_dset_id, &c_flag);
-
- if (ret < 0) return ret_value;
- *flag = (int_f)c_flag;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_dset_id;
+ H5D_space_status_t c_flag;
+
+ c_dset_id = (hid_t)*dset_id;
+
+ /*
+ * Call H5Dget_space_status
+ */
+ ret = H5Dget_space_status(c_dset_id, &c_flag);
+
+ if (ret < 0)
+ return ret_value;
+ *flag = (int_f)c_flag;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Df/h5dcreate_anon_c
* NAME
@@ -1118,25 +1154,25 @@ h5dget_space_status_c ( hid_t_f *dset_id, int_f *flag)
* M. Scot Breitenfeld
* February, 2008
* SOURCE
-*/
+ */
int_f
-h5dcreate_anon_c (hid_t_f *loc_id, hid_t_f *type_id, hid_t_f *space_id,
- hid_t_f *dcpl_id, hid_t_f *dapl_id, hid_t_f *dset_id)
+h5dcreate_anon_c(hid_t_f *loc_id, hid_t_f *type_id, hid_t_f *space_id, hid_t_f *dcpl_id, hid_t_f *dapl_id,
+ hid_t_f *dset_id)
/******/
{
- int ret_value = -1;
+ int ret_value = -1;
- /*
- * Call H5Dcreate2 function.
- */
- if((*dset_id = (hid_t_f)H5Dcreate_anon((hid_t)*loc_id, (hid_t)*type_id, (hid_t)*space_id,
- (hid_t)*dcpl_id, (hid_t)*dapl_id)) < 0)
- goto DONE;
+ /*
+ * Call H5Dcreate2 function.
+ */
+ if ((*dset_id = (hid_t_f)H5Dcreate_anon((hid_t)*loc_id, (hid_t)*type_id, (hid_t)*space_id,
+ (hid_t)*dcpl_id, (hid_t)*dapl_id)) < 0)
+ goto DONE;
- ret_value = 0;
+ ret_value = 0;
- DONE:
- return ret_value;
+DONE:
+ return ret_value;
}
/****if* H5Df/h5dwrite_f_c
@@ -1160,37 +1196,38 @@ h5dcreate_anon_c (hid_t_f *loc_id, hid_t_f *type_id, hid_t_f *space_id,
*
*
* SOURCE
-*/
+ */
int_f
-h5dwrite_f_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id,
- hid_t_f *file_space_id, hid_t_f *xfer_prp, void *buf)
+h5dwrite_f_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id,
+ hid_t_f *xfer_prp, void *buf)
/******/
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_dset_id;
- hid_t c_mem_type_id;
- hid_t c_mem_space_id;
- hid_t c_file_space_id;
- hid_t c_xfer_prp;
-
- /*
- * Define transfer property
- */
- c_xfer_prp = (hid_t)*xfer_prp;
-
- /*
- * Call H5Dwrite function.
- */
- c_dset_id = (hid_t)*dset_id;
- c_mem_type_id = (hid_t)*mem_type_id;
- c_mem_space_id = (hid_t)*mem_space_id;
- c_file_space_id = (hid_t)*file_space_id;
- ret = H5Dwrite(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf);
-
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_dset_id;
+ hid_t c_mem_type_id;
+ hid_t c_mem_space_id;
+ hid_t c_file_space_id;
+ hid_t c_xfer_prp;
+
+ /*
+ * Define transfer property
+ */
+ c_xfer_prp = (hid_t)*xfer_prp;
+
+ /*
+ * Call H5Dwrite function.
+ */
+ c_dset_id = (hid_t)*dset_id;
+ c_mem_type_id = (hid_t)*mem_type_id;
+ c_mem_space_id = (hid_t)*mem_space_id;
+ c_file_space_id = (hid_t)*file_space_id;
+ ret = H5Dwrite(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf);
+
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Df/h5dread_f_c
@@ -1218,33 +1255,34 @@ h5dwrite_f_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id,
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5dread_f_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_space_id,
- hid_t_f *file_space_id, hid_t_f *xfer_prp, void *buf)
+h5dread_f_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id,
+ hid_t_f *xfer_prp, void *buf)
/******/
{
- int ret_value = -1;
- hid_t c_dset_id;
- hid_t c_mem_type_id;
- hid_t c_mem_space_id;
- hid_t c_file_space_id;
- hid_t c_xfer_prp;
- herr_t status;
-
- c_dset_id = (hid_t)*dset_id;
- c_mem_type_id = (hid_t)*mem_type_id;
- c_mem_space_id = (hid_t)*mem_space_id;
- c_file_space_id = (hid_t)*file_space_id;
- c_xfer_prp = (hid_t)*xfer_prp;
- /*
- * Call H5Dread function.
- */
- status = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf);
- if ( status < 0 ) return ret_value;
-
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_dset_id;
+ hid_t c_mem_type_id;
+ hid_t c_mem_space_id;
+ hid_t c_file_space_id;
+ hid_t c_xfer_prp;
+ herr_t status;
+
+ c_dset_id = (hid_t)*dset_id;
+ c_mem_type_id = (hid_t)*mem_type_id;
+ c_mem_space_id = (hid_t)*mem_space_id;
+ c_file_space_id = (hid_t)*file_space_id;
+ c_xfer_prp = (hid_t)*xfer_prp;
+ /*
+ * Call H5Dread function.
+ */
+ status = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf);
+ if (status < 0)
+ return ret_value;
+
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Df/h5dget_access_plist_c
* NAME
@@ -1262,22 +1300,22 @@ h5dread_f_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_space_id,
* April 13, 2009
*
* SOURCE
-*/
+ */
int_f
-h5dget_access_plist_c (hid_t_f *dset_id, hid_t_f *plist_id)
+h5dget_access_plist_c(hid_t_f *dset_id, hid_t_f *plist_id)
/******/
{
- int ret_value = -1;
- /*
- * Call H5Dget_access_plist function.
- */
- if((*plist_id = (hid_t_f)H5Dget_access_plist((hid_t)*dset_id)) < 0)
- goto DONE;
+ int ret_value = -1;
+ /*
+ * Call H5Dget_access_plist function.
+ */
+ if ((*plist_id = (hid_t_f)H5Dget_access_plist((hid_t)*dset_id)) < 0)
+ goto DONE;
- ret_value = 0;
+ ret_value = 0;
- DONE:
- return ret_value;
+DONE:
+ return ret_value;
}
/****if* H5Df/h5dvlen_reclaim_c
@@ -1298,20 +1336,21 @@ h5dget_access_plist_c (hid_t_f *dset_id, hid_t_f *plist_id)
* January 15, 2011
*
* SOURCE
-*/
+ */
int_f
h5dvlen_reclaim_c(hid_t_f *type_id, hid_t_f *space_id, hid_t_f *plist_id, void *buf)
/******/
{
- int ret_value = -1;
- herr_t status;
+ int ret_value = -1;
+ herr_t status;
- /*
- * Call H5Treclaim function.
- */
- status = H5Treclaim((hid_t)*type_id, (hid_t)*space_id, (hid_t)*plist_id, buf);
- if ( status < 0 ) return ret_value;
+ /*
+ * Call H5Treclaim function.
+ */
+ status = H5Treclaim((hid_t)*type_id, (hid_t)*space_id, (hid_t)*plist_id, buf);
+ if (status < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
diff --git a/fortran/src/H5Ef.c b/fortran/src/H5Ef.c
index 6631d3a..a8aa312 100644
--- a/fortran/src/H5Ef.c
+++ b/fortran/src/H5Ef.c
@@ -17,7 +17,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include "H5f90.h"
#include "H5Eprivate.h"
@@ -38,18 +38,18 @@
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5eclear_c(hid_t_f *estack_id )
+h5eclear_c(hid_t_f *estack_id)
/******/
{
- int_f ret_value = 0;
+ int_f ret_value = 0;
- /*
- * Call H5Eclear function.
- */
- if(H5Eclear2((hid_t)*estack_id) < 0)
- HGOTO_DONE(FAIL)
+ /*
+ * Call H5Eclear function.
+ */
+ if (H5Eclear2((hid_t)*estack_id) < 0)
+ HGOTO_DONE(FAIL)
done:
return ret_value;
@@ -74,30 +74,30 @@ done:
* Bug fix: Added call to close the file with the error messages
* EP 11/26/01
* SOURCE
-*/
+ */
int_f
-h5eprint_c1(_fcd name, int_f* namelen)
+h5eprint_c1(_fcd name, int_f *namelen)
/******/
{
- FILE *file = NULL;
- char *c_name = NULL;
+ FILE *file = NULL;
+ char *c_name = NULL;
int_f ret_value = 0;
- if(NULL == (c_name = (char*)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL)
- if(NULL == (file = HDfopen(c_name, "a")))
+ if (NULL == (file = HDfopen(c_name, "a")))
HGOTO_DONE(FAIL)
/*
* Call H5Eprint2 function.
*/
- if(H5Eprint2(H5E_DEFAULT, file) < 0)
+ if (H5Eprint2(H5E_DEFAULT, file) < 0)
HGOTO_DONE(FAIL)
done:
- if(file)
+ if (file)
HDfclose(file);
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
@@ -120,7 +120,7 @@ done:
* Wednesday, March 29, 2000
*
* SOURCE
-*/
+ */
int_f
h5eprint_c2(void)
/******/
@@ -130,7 +130,7 @@ h5eprint_c2(void)
/*
* Call H5Eprint2 function.
*/
- if(H5Eprint2(H5E_DEFAULT, NULL) < 0)
+ if (H5Eprint2(H5E_DEFAULT, NULL) < 0)
HGOTO_DONE(FAIL)
done:
@@ -155,31 +155,31 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5eget_major_c(int_f* error_no, _fcd name, size_t_f* namelen)
+h5eget_major_c(int_f *error_no, _fcd name, size_t_f *namelen)
/******/
{
- char *c_name = NULL;
+ char * c_name = NULL;
size_t c_namelen = (size_t)*namelen;
- int_f ret_value = 0;
+ int_f ret_value = 0;
- if(c_namelen > 0)
+ if (c_namelen > 0)
c_name = (char *)HDmalloc(c_namelen + 1);
- if(!c_name)
+ if (!c_name)
HGOTO_DONE(FAIL)
/*
* Call H5Eget_msg function.
*/
H5Eget_msg((hid_t)*error_no, NULL, c_name, c_namelen);
- HD5packFstring((char*)c_name, _fcdtocp(name), c_namelen);
- if(!HDstrcmp(c_name, "Invalid major error number"))
+ HD5packFstring((char *)c_name, _fcdtocp(name), c_namelen);
+ if (!HDstrcmp(c_name, "Invalid major error number"))
HGOTO_DONE(FAIL)
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
@@ -203,19 +203,19 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5eget_minor_c(int_f* error_no, _fcd name, size_t_f* namelen)
+h5eget_minor_c(int_f *error_no, _fcd name, size_t_f *namelen)
/******/
{
- char *c_name = NULL;
+ char * c_name = NULL;
size_t c_namelen = (size_t)*namelen;
- int_f ret_value = 0;
+ int_f ret_value = 0;
- if(c_namelen > 0)
+ if (c_namelen > 0)
c_name = (char *)HDmalloc(c_namelen + 1);
- if(!c_name)
+ if (!c_name)
HGOTO_DONE(FAIL)
/*
@@ -223,11 +223,11 @@ h5eget_minor_c(int_f* error_no, _fcd name, size_t_f* namelen)
*/
H5Eget_msg((hid_t)*error_no, NULL, c_name, c_namelen);
HD5packFstring((char *)c_name, _fcdtocp(name), c_namelen);
- if(!HDstrcmp(c_name, "Invalid minor error number"))
+ if (!HDstrcmp(c_name, "Invalid minor error number"))
HGOTO_DONE(FAIL)
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
@@ -249,7 +249,7 @@ done:
* M. Scot Breitenfeld
* July 22, 2009
* SOURCE
-*/
+ */
/* int_f */
/* h5eset_auto2_c(hid_t_f *estack_id, H5E_auto2_t *func, void *client_data) */
/* /\******\/ */
@@ -266,17 +266,17 @@ int_f
h5eset_auto2_c(int_f *printflag, hid_t_f *estack_id, H5E_auto2_t func, void *client_data)
/******/
{
- int ret_val = -1;
- herr_t status = -1;
+ int ret_val = -1;
+ herr_t status = -1;
- if (*printflag == 1 && *estack_id == -1)
- status = H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)H5Eprint2, stderr);
- else if (*printflag == 1)
- status = H5Eset_auto2((hid_t)*estack_id, func, client_data);
- else if (*printflag == 0)
- status = H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
- if (status >= 0) ret_val = 0;
+ if (*printflag == 1 && *estack_id == -1)
+ status = H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)H5Eprint2, stderr);
+ else if (*printflag == 1)
+ status = H5Eset_auto2((hid_t)*estack_id, func, client_data);
+ else if (*printflag == 0)
+ status = H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+ if (status >= 0)
+ ret_val = 0;
- return ret_val;
+ return ret_val;
}
-
diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c
index 7123f1d..1f1fc7b 100644
--- a/fortran/src/H5Ff.c
+++ b/fortran/src/H5Ff.c
@@ -17,7 +17,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include "H5f90.h"
#include "H5Eprivate.h"
@@ -41,54 +41,55 @@
* Elena Pourmal
* Monday, July 26, 1999
* SOURCE
-*/
+ */
int_f
-h5fcreate_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f* crt_prp, hid_t_f *acc_prp, hid_t_f *file_id)
+h5fcreate_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *crt_prp, hid_t_f *acc_prp,
+ hid_t_f *file_id)
/******/
{
- int ret_value = -1;
- char *c_name;
- int_f c_namelen;
- hid_t c_file_id;
- unsigned c_access_flags;
- hid_t c_crt_prp;
- hid_t c_acc_prp;
-
- /*
- * Define access flags
- */
- c_access_flags = (unsigned) *access_flags;
-
- /*
- * Define creation property
- */
- c_crt_prp = *crt_prp;
-
- /*
- * Define access property
- */
- c_acc_prp = *acc_prp;
-
- /*
- * Convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, (size_t)c_namelen);
- if(c_name == NULL)
- return ret_value;
-
- /*
- * Call H5Fcreate function.
- */
- c_file_id = H5Fcreate(c_name, c_access_flags, c_crt_prp, c_acc_prp);
-
- if (c_file_id >= 0) {
- ret_value = 0;
- *file_id = c_file_id;
- }
-
- HDfree(c_name);
- return ret_value;
+ int ret_value = -1;
+ char * c_name;
+ int_f c_namelen;
+ hid_t c_file_id;
+ unsigned c_access_flags;
+ hid_t c_crt_prp;
+ hid_t c_acc_prp;
+
+ /*
+ * Define access flags
+ */
+ c_access_flags = (unsigned)*access_flags;
+
+ /*
+ * Define creation property
+ */
+ c_crt_prp = *crt_prp;
+
+ /*
+ * Define access property
+ */
+ c_acc_prp = *acc_prp;
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ c_namelen = *namelen;
+ c_name = (char *)HD5f2cstring(name, (size_t)c_namelen);
+ if (c_name == NULL)
+ return ret_value;
+
+ /*
+ * Call H5Fcreate function.
+ */
+ c_file_id = H5Fcreate(c_name, c_access_flags, c_crt_prp, c_acc_prp);
+
+ if (c_file_id >= 0) {
+ ret_value = 0;
+ *file_id = c_file_id;
+ }
+
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Ff/h5fflush_c
@@ -107,31 +108,31 @@ h5fcreate_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f* crt_prp, hi
* Xiangyang Su
* Friday, November 5, 1999
* SOURCE
-*/
+ */
int_f
-h5fflush_c (hid_t_f *object_id, int_f *scope)
+h5fflush_c(hid_t_f *object_id, int_f *scope)
/******/
{
- int ret_value = -1;
- hid_t c_file_id;
- H5F_scope_t c_scope;
- htri_t status;
- c_scope = (H5F_scope_t)*scope;
+ int ret_value = -1;
+ hid_t c_file_id;
+ H5F_scope_t c_scope;
+ htri_t status;
+ c_scope = (H5F_scope_t)*scope;
- /*
- * Call H5Fflush function.
- */
+ /*
+ * Call H5Fflush function.
+ */
- c_file_id = *object_id;
+ c_file_id = *object_id;
- status = H5Fflush(c_file_id, c_scope);
+ status = H5Fflush(c_file_id, c_scope);
- if (status >= 0) ret_value = 0;
+ if (status >= 0)
+ ret_value = 0;
- return ret_value;
+ return ret_value;
}
-
/****if* H5Ff/h5fmount_c
* NAME
* h5fmount_c
@@ -149,45 +150,47 @@ h5fflush_c (hid_t_f *object_id, int_f *scope)
* Xiangyang Su
* Monday, October 25, 1999
* HISTORY
-*/
+ */
int_f
-h5fmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen, hid_t_f *file_id, hid_t_f *acc_prp)
+h5fmount_c(hid_t_f *loc_id, _fcd dsetname, int_f *namelen, hid_t_f *file_id, hid_t_f *acc_prp)
/******/
{
- int ret_value = -1;
- char *c_name;
- int_f c_namelen;
- hid_t c_loc_id;
- hid_t c_file_id;
- hid_t c_acc_prp;
- htri_t status;
-
- /*
- * Define access property
- */
- c_acc_prp = *acc_prp;
-/*
- if ( H5P_DEFAULT_F == c_acc_prp ) c_acc_prp = H5P_DEFAULT;
-*/
-
- c_loc_id = *loc_id;
- c_file_id = *file_id;
- /*
- * Convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(dsetname, (size_t)c_namelen);
- if (c_name == NULL) return ret_value;
-
- /*
- * Call H5Fmount function.
- */
- status = H5Fmount(c_loc_id, c_name, c_file_id, c_acc_prp);
-
- if (status >= 0) ret_value = 0;
-
- HDfree(c_name);
- return ret_value;
+ int ret_value = -1;
+ char * c_name;
+ int_f c_namelen;
+ hid_t c_loc_id;
+ hid_t c_file_id;
+ hid_t c_acc_prp;
+ htri_t status;
+
+ /*
+ * Define access property
+ */
+ c_acc_prp = *acc_prp;
+ /*
+ if ( H5P_DEFAULT_F == c_acc_prp ) c_acc_prp = H5P_DEFAULT;
+ */
+
+ c_loc_id = *loc_id;
+ c_file_id = *file_id;
+ /*
+ * Convert FORTRAN name to C name
+ */
+ c_namelen = *namelen;
+ c_name = (char *)HD5f2cstring(dsetname, (size_t)c_namelen);
+ if (c_name == NULL)
+ return ret_value;
+
+ /*
+ * Call H5Fmount function.
+ */
+ status = H5Fmount(c_loc_id, c_name, c_file_id, c_acc_prp);
+
+ if (status >= 0)
+ ret_value = 0;
+
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Ff/h5funmount_c
@@ -205,38 +208,38 @@ h5fmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen, hid_t_f *file_id, hi
* Xiangyang Su
* Monday, October 25, 1999
* SOURCE
-*/
+ */
int_f
-h5funmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen)
+h5funmount_c(hid_t_f *loc_id, _fcd dsetname, int_f *namelen)
/******/
{
- int ret_value = -1;
- char *c_name;
- int_f c_namelen;
- hid_t c_loc_id;
- htri_t status;
-
- c_loc_id = *loc_id;
-
- /*
- * Convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(dsetname, (size_t)c_namelen);
- if (c_name == NULL) return ret_value;
-
- /*
- * Call H5Fmount function.
- */
- status = H5Funmount(c_loc_id, c_name);
-
- if (status >= 0) ret_value = 0;
-
- HDfree(c_name);
- return ret_value;
-}
+ int ret_value = -1;
+ char * c_name;
+ int_f c_namelen;
+ hid_t c_loc_id;
+ htri_t status;
+ c_loc_id = *loc_id;
+ /*
+ * Convert FORTRAN name to C name
+ */
+ c_namelen = *namelen;
+ c_name = (char *)HD5f2cstring(dsetname, (size_t)c_namelen);
+ if (c_name == NULL)
+ return ret_value;
+
+ /*
+ * Call H5Fmount function.
+ */
+ status = H5Funmount(c_loc_id, c_name);
+
+ if (status >= 0)
+ ret_value = 0;
+
+ HDfree(c_name);
+ return ret_value;
+}
/****if* H5Ff/h5fopen_c
* NAME
@@ -256,49 +259,49 @@ h5funmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen)
* Elena Pourmal
* Tuesday, August 3, 1999
* SOURCE
-*/
+ */
int_f
-h5fopen_c (_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hid_t_f *file_id)
+h5fopen_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hid_t_f *file_id)
/******/
{
- int ret_value = -1;
- char *c_name;
- int_f c_namelen;
- hid_t c_file_id;
- unsigned c_access_flags;
- hid_t c_acc_prp;
- c_acc_prp = (hid_t)*acc_prp;
-
- /*
- * Define access flags
- */
- c_access_flags = (unsigned) *access_flags;
-
- /*
- * Define access property
- */
- c_acc_prp = *acc_prp;
-
- /*
- * Convert FORTRAN name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, (size_t)c_namelen);
- if(c_name == NULL)
- return ret_value;
-
- /*
- * Call H5Fopen function.
- */
- c_file_id = H5Fopen(c_name, c_access_flags, c_acc_prp);
-
- if(c_file_id >= 0) {
- ret_value = 0;
- *file_id = (hid_t_f)c_file_id;
- } /* end if */
-
- HDfree(c_name);
- return ret_value;
+ int ret_value = -1;
+ char * c_name;
+ int_f c_namelen;
+ hid_t c_file_id;
+ unsigned c_access_flags;
+ hid_t c_acc_prp;
+ c_acc_prp = (hid_t)*acc_prp;
+
+ /*
+ * Define access flags
+ */
+ c_access_flags = (unsigned)*access_flags;
+
+ /*
+ * Define access property
+ */
+ c_acc_prp = *acc_prp;
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ c_namelen = *namelen;
+ c_name = (char *)HD5f2cstring(name, (size_t)c_namelen);
+ if (c_name == NULL)
+ return ret_value;
+
+ /*
+ * Call H5Fopen function.
+ */
+ c_file_id = H5Fopen(c_name, c_access_flags, c_acc_prp);
+
+ if (c_file_id >= 0) {
+ ret_value = 0;
+ *file_id = (hid_t_f)c_file_id;
+ } /* end if */
+
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Ff/h5freopen_c
@@ -316,22 +319,23 @@ h5fopen_c (_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hid
* Xiangyang Su
* Wednesday, November 3, 1999
* SOURCE
-*/
+ */
int_f
-h5freopen_c (hid_t_f *file_id1, hid_t_f *file_id2)
+h5freopen_c(hid_t_f *file_id1, hid_t_f *file_id2)
/******/
{
- int ret_value = -1;
- hid_t c_file_id1, c_file_id2;
+ int ret_value = -1;
+ hid_t c_file_id1, c_file_id2;
- c_file_id1 = *file_id1;
- c_file_id2 = H5Freopen(c_file_id1);
+ c_file_id1 = *file_id1;
+ c_file_id2 = H5Freopen(c_file_id1);
- if (c_file_id2 < 0) return ret_value;
- *file_id2 = (hid_t_f)c_file_id2;
+ if (c_file_id2 < 0)
+ return ret_value;
+ *file_id2 = (hid_t_f)c_file_id2;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Ff/h5fget_create_plist_c
@@ -349,22 +353,23 @@ h5freopen_c (hid_t_f *file_id1, hid_t_f *file_id2)
* Elena Pourmal, Xiangyang Su
* Wednesday, November 3, 1999
* SOURCE
-*/
+ */
int_f
-h5fget_create_plist_c (hid_t_f *file_id, hid_t_f *prop_id)
+h5fget_create_plist_c(hid_t_f *file_id, hid_t_f *prop_id)
/******/
{
- int ret_value = -1;
- hid_t c_file_id, c_prop_id;
+ int ret_value = -1;
+ hid_t c_file_id, c_prop_id;
- c_file_id = (hid_t)*file_id;
- c_prop_id = H5Fget_create_plist(c_file_id);
+ c_file_id = (hid_t)*file_id;
+ c_prop_id = H5Fget_create_plist(c_file_id);
- if (c_prop_id < 0) return ret_value;
- *prop_id = (hid_t_f)c_prop_id;
+ if (c_prop_id < 0)
+ return ret_value;
+ *prop_id = (hid_t_f)c_prop_id;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Ff/h5fget_access_plist_c
@@ -384,22 +389,23 @@ h5fget_create_plist_c (hid_t_f *file_id, hid_t_f *prop_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5fget_access_plist_c (hid_t_f *file_id, hid_t_f *access_id)
+h5fget_access_plist_c(hid_t_f *file_id, hid_t_f *access_id)
/******/
{
- int ret_value = -1;
- hid_t c_file_id, c_access_id;
+ int ret_value = -1;
+ hid_t c_file_id, c_access_id;
- c_file_id = (hid_t)*file_id;
- c_access_id = H5Fget_access_plist(c_file_id);
+ c_file_id = (hid_t)*file_id;
+ c_access_id = H5Fget_access_plist(c_file_id);
- if (c_access_id < 0) return ret_value;
- *access_id = (hid_t_f)c_access_id;
+ if (c_access_id < 0)
+ return ret_value;
+ *access_id = (hid_t_f)c_access_id;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Ff/h5fclose_c
@@ -417,18 +423,19 @@ h5fget_access_plist_c (hid_t_f *file_id, hid_t_f *access_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5fclose_c ( hid_t_f *file_id )
+h5fclose_c(hid_t_f *file_id)
/******/
{
- int ret_value = 0;
- hid_t c_file_id;
+ int ret_value = 0;
+ hid_t c_file_id;
- c_file_id = (hid_t)*file_id;
- if ( H5Fclose(c_file_id) < 0 ) ret_value = -1;
- return ret_value;
+ c_file_id = (hid_t)*file_id;
+ if (H5Fclose(c_file_id) < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Ff/h5fget_obj_count_c
* NAME
@@ -449,23 +456,23 @@ h5fclose_c ( hid_t_f *file_id )
* Changed type of obj_count to size_t_f
* Thursday, September 25, 2008
* SOURCE
-*/
+ */
int_f
-h5fget_obj_count_c ( hid_t_f *file_id , int_f *obj_type, size_t_f * obj_count)
+h5fget_obj_count_c(hid_t_f *file_id, int_f *obj_type, size_t_f *obj_count)
/******/
{
- int ret_value = 0;
- hid_t c_file_id;
- unsigned c_obj_type;
- ssize_t c_obj_count;
-
+ int ret_value = 0;
+ hid_t c_file_id;
+ unsigned c_obj_type;
+ ssize_t c_obj_count;
- c_file_id = (hid_t)*file_id;
- c_obj_type = (unsigned) *obj_type;
- if ( (c_obj_count=H5Fget_obj_count(c_file_id, c_obj_type)) < 0 ) ret_value = -1;
- *obj_count = (size_t_f)c_obj_count;
- return ret_value;
+ c_file_id = (hid_t)*file_id;
+ c_obj_type = (unsigned)*obj_type;
+ if ((c_obj_count = H5Fget_obj_count(c_file_id, c_obj_type)) < 0)
+ ret_value = -1;
+ *obj_count = (size_t_f)c_obj_count;
+ return ret_value;
}
/****if* H5Ff/h5fget_obj_ids_c
* NAME
@@ -488,29 +495,28 @@ h5fget_obj_count_c ( hid_t_f *file_id , int_f *obj_type, size_t_f * obj_count)
* Thursday, September 25, 2008 EIP
*
* SOURCE
-*/
+ */
int_f
-h5fget_obj_ids_c ( hid_t_f *file_id , int_f *obj_type, size_t_f *max_objs,
- hid_t_f *obj_ids, size_t_f *num_objs)
+h5fget_obj_ids_c(hid_t_f *file_id, int_f *obj_type, size_t_f *max_objs, hid_t_f *obj_ids, size_t_f *num_objs)
/******/
{
- int ret_value = 0;
- hid_t c_file_id;
+ int ret_value = 0;
+ hid_t c_file_id;
unsigned c_obj_type;
- size_t u;
- size_t c_max_objs;
- ssize_t c_num_objs;
- hid_t *c_obj_ids;
+ size_t u;
+ size_t c_max_objs;
+ ssize_t c_num_objs;
+ hid_t * c_obj_ids;
- c_file_id = (hid_t)*file_id;
- c_obj_type = (unsigned) *obj_type;
+ c_file_id = (hid_t)*file_id;
+ c_obj_type = (unsigned)*obj_type;
c_max_objs = (size_t)*max_objs;
- c_obj_ids = (hid_t *)HDmalloc(sizeof(hid_t)*c_max_objs);
+ c_obj_ids = (hid_t *)HDmalloc(sizeof(hid_t) * c_max_objs);
c_num_objs = H5Fget_obj_ids(c_file_id, c_obj_type, c_max_objs, c_obj_ids);
- if(c_num_objs < 0)
+ if (c_num_objs < 0)
ret_value = -1;
- for(u = 0; u < c_max_objs; u++)
+ for (u = 0; u < c_max_objs; u++)
obj_ids[u] = (hid_t_f)c_obj_ids[u];
HDfree(c_obj_ids);
@@ -533,20 +539,21 @@ h5fget_obj_ids_c ( hid_t_f *file_id , int_f *obj_type, size_t_f *max_objs,
* Quincey Koziol
* Tuesday, October 7, 2003
* SOURCE
-*/
+ */
int_f
-h5fget_freespace_c ( hid_t_f *file_id , hssize_t_f *free_space)
+h5fget_freespace_c(hid_t_f *file_id, hssize_t_f *free_space)
/******/
{
- int ret_value = 0;
- hid_t c_file_id;
- hssize_t c_free_space;
-
- c_file_id = (hid_t)*file_id;
- if ( (c_free_space=H5Fget_freespace(c_file_id)) < 0 ) ret_value = -1;
- *free_space=(hssize_t_f)c_free_space;
- return ret_value;
+ int ret_value = 0;
+ hid_t c_file_id;
+ hssize_t c_free_space;
+
+ c_file_id = (hid_t)*file_id;
+ if ((c_free_space = H5Fget_freespace(c_file_id)) < 0)
+ ret_value = -1;
+ *free_space = (hssize_t_f)c_free_space;
+ return ret_value;
}
/****if* H5Ff/h5fget_name_c
@@ -566,36 +573,37 @@ h5fget_freespace_c ( hid_t_f *file_id , hssize_t_f *free_space)
* Elena Pourmal
* Tuesday, July 6, 2004
* SOURCE
-*/
+ */
int_f
h5fget_name_c(hid_t_f *obj_id, size_t_f *size, _fcd buf, size_t_f *buflen)
/******/
{
- char *c_buf = NULL; /* Buffer to hold C string */
- ssize_t size_c = -1;
- int_f ret_value = 0; /* Return value */
-
- /*
- * Allocate buffer to hold name of an attribute
- */
- if(NULL == (c_buf = (char *)HDmalloc((size_t)*buflen + 1)))
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Fget_name function
- */
- if ((size_c = H5Fget_name((hid_t)*obj_id, c_buf, (size_t)*buflen)) < 0)
- HGOTO_DONE(FAIL);
-
- /*
- * Convert C name to FORTRAN and place it in the given buffer
- */
- HD5packFstring(c_buf, _fcdtocp(buf), (size_t)*buflen);
+ char * c_buf = NULL; /* Buffer to hold C string */
+ ssize_t size_c = -1;
+ int_f ret_value = 0; /* Return value */
+
+ /*
+ * Allocate buffer to hold name of an attribute
+ */
+ if (NULL == (c_buf = (char *)HDmalloc((size_t)*buflen + 1)))
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Fget_name function
+ */
+ if ((size_c = H5Fget_name((hid_t)*obj_id, c_buf, (size_t)*buflen)) < 0)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Convert C name to FORTRAN and place it in the given buffer
+ */
+ HD5packFstring(c_buf, _fcdtocp(buf), (size_t)*buflen);
done:
- *size = (size_t_f)size_c;
- if(c_buf) HDfree(c_buf);
- return ret_value;
+ *size = (size_t_f)size_c;
+ if (c_buf)
+ HDfree(c_buf);
+ return ret_value;
}
/****if* H5Ff/h5fget_filesize_c
@@ -613,23 +621,23 @@ done:
* Elena Pourmal
* Wednesday, July 7, 2004
* SOURCE
-*/
+ */
int_f
h5fget_filesize_c(hid_t_f *file_id, hsize_t_f *size)
/******/
{
hsize_t size_c;
- herr_t ret_value=0; /* Return value */
+ herr_t ret_value = 0; /* Return value */
- /*
- * Call H5Fget_filesize function
- */
- if ((ret_value = H5Fget_filesize((hid_t)*file_id, &size_c)) < 0)
- HGOTO_DONE(FAIL);
- *size = (hsize_t_f)size_c;
+ /*
+ * Call H5Fget_filesize function
+ */
+ if ((ret_value = H5Fget_filesize((hid_t)*file_id, &size_c)) < 0)
+ HGOTO_DONE(FAIL);
+ *size = (hsize_t_f)size_c;
done:
- return ret_value;
+ return ret_value;
}
/****if* H5Ff/h5fget_fileno_c
@@ -647,23 +655,23 @@ done:
* Quincey Koziol
* Saturday, April 13, 2019
* SOURCE
-*/
+ */
int_f
h5fget_fileno_c(hid_t_f *file_id, int_f *fileno)
/******/
{
unsigned long fileno_c;
- herr_t ret_value=0; /* Return value */
+ herr_t ret_value = 0; /* Return value */
- /*
- * Call H5Fget_filesize function
- */
- if ((ret_value = H5Fget_fileno((hid_t)*file_id, &fileno_c)) < 0)
- HGOTO_DONE(FAIL);
- *fileno = (hsize_t_f)fileno_c;
+ /*
+ * Call H5Fget_filesize function
+ */
+ if ((ret_value = H5Fget_fileno((hid_t)*file_id, &fileno_c)) < 0)
+ HGOTO_DONE(FAIL);
+ *fileno = (hsize_t_f)fileno_c;
done:
- return ret_value;
+ return ret_value;
}
/****if* H5Ff/h5fget_file_image_c
@@ -683,22 +691,22 @@ done:
* M. Scot Breitenfeld
* November 26, 2012
* SOURCE
-*/
+ */
int_f
h5fget_file_image_c(hid_t_f *file_id, void *buf_ptr, size_t_f *buf_len, size_t_f *buf_req)
/******/
{
- herr_t ret_value=0; /* Return value */
+ herr_t ret_value = 0; /* Return value */
ssize_t c_buf_req;
/*
* Call h5fget_file_image function
*/
- if ( (c_buf_req = H5Fget_file_image((hid_t)*file_id, buf_ptr, (size_t)*buf_len)) < 0)
- HGOTO_DONE(FAIL);
+ if ((c_buf_req = H5Fget_file_image((hid_t)*file_id, buf_ptr, (size_t)*buf_len)) < 0)
+ HGOTO_DONE(FAIL);
*buf_req = (size_t_f)c_buf_req;
done:
- return ret_value;
+ return ret_value;
}
diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c
index 770752d..1e266e7 100644
--- a/fortran/src/H5Gf.c
+++ b/fortran/src/H5Gf.c
@@ -17,7 +17,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include "H5f90.h"
#include "H5Eprivate.h"
@@ -44,51 +44,52 @@
* H5Gcreate1 can be compiled out of the library
* QAK - 2007/08/23
* SOURCE
-*/
+ */
int_f
-h5gcreate_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size_hint,
- hid_t_f *grp_id, hid_t_f *lcpl_id, hid_t_f *gcpl_id, hid_t_f *gapl_id )
+h5gcreate_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size_hint, hid_t_f *grp_id,
+ hid_t_f *lcpl_id, hid_t_f *gcpl_id, hid_t_f *gapl_id)
/******/
{
- hid_t c_gcpl_id = -1; /* Group creation property list */
- char *c_name = NULL;
+ hid_t c_gcpl_id = -1; /* Group creation property list */
+ char *c_name = NULL;
hid_t c_grp_id;
int_f ret_value = -1;
/*
* Convert FORTRAN name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
goto DONE;
/*
* Call H5Gcreate function.
*/
- if(*size_hint == (size_t_f)OBJECT_NAMELEN_DEFAULT_F ){
- c_grp_id = H5Gcreate2((hid_t)*loc_id, c_name,(hid_t)*lcpl_id,(hid_t)*gcpl_id,(hid_t)*gapl_id);}
+ if (*size_hint == (size_t_f)OBJECT_NAMELEN_DEFAULT_F) {
+ c_grp_id = H5Gcreate2((hid_t)*loc_id, c_name, (hid_t)*lcpl_id, (hid_t)*gcpl_id, (hid_t)*gapl_id);
+ }
else {
- /* Create the group creation property list */
- if((c_gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
- goto DONE;
+ /* Create the group creation property list */
+ if ((c_gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ goto DONE;
- /* Set the local heap size hint */
- if(H5Pset_local_heap_size_hint(c_gcpl_id, (size_t)*size_hint) < 0)
- goto DONE;
+ /* Set the local heap size hint */
+ if (H5Pset_local_heap_size_hint(c_gcpl_id, (size_t)*size_hint) < 0)
+ goto DONE;
- /* Create the group */
- c_grp_id = H5Gcreate2((hid_t)*loc_id, c_name, H5P_DEFAULT, c_gcpl_id, H5P_DEFAULT);
+ /* Create the group */
+ c_grp_id = H5Gcreate2((hid_t)*loc_id, c_name, H5P_DEFAULT, c_gcpl_id, H5P_DEFAULT);
}
- if(c_grp_id < 0)
+ if (c_grp_id < 0)
goto DONE;
/* Everything OK, set values to return */
- *grp_id = (hid_t_f)c_grp_id;
+ *grp_id = (hid_t_f)c_grp_id;
ret_value = 0;
DONE:
- if(c_gcpl_id > 0)
+ if (c_gcpl_id > 0)
H5Pclose(c_gcpl_id);
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
}
@@ -112,35 +113,35 @@ DONE:
* Wednesday, August 5, 1999
*
* SOURCE
-*/
+ */
int_f
h5gopen_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *gapl_id, hid_t_f *grp_id)
/******/
{
- char *c_name = NULL;
- hid_t c_grp_id;
- int ret_value = -1;
-
- /*
- * Convert FORTRAN name to C name
- */
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ char *c_name = NULL;
+ hid_t c_grp_id;
+ int ret_value = -1;
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
goto DONE;
- /*
- * Call H5Gopen function.
- */
- if((c_grp_id = H5Gopen2((hid_t)*loc_id, c_name, (hid_t)*gapl_id)) < 0)
+ /*
+ * Call H5Gopen function.
+ */
+ if ((c_grp_id = H5Gopen2((hid_t)*loc_id, c_name, (hid_t)*gapl_id)) < 0)
goto DONE;
/* Everything OK, set values to return */
- *grp_id = (hid_t_f)c_grp_id;
+ *grp_id = (hid_t_f)c_grp_id;
ret_value = 0;
DONE:
- if(c_name)
- HDfree(c_name);
- return ret_value;
+ if (c_name)
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Gf/h5gget_obj_info_idx_c
@@ -164,48 +165,50 @@ DONE:
* Elena Pourmal
* Wednesday, August 5, 1999
* SOURCE
-*/
+ */
int_f
-h5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx,
- _fcd obj_name, int_f *obj_namelen, int_f *obj_type)
+h5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, _fcd obj_name,
+ int_f *obj_namelen, int_f *obj_type)
/******/
{
H5O_info2_t oinfo;
- hid_t c_loc_id = (hid_t)*loc_id;
- char *c_name = NULL;
- size_t c_obj_namelen;
- char *c_obj_name = NULL;
- hsize_t c_idx = (hsize_t)*idx;
- hid_t gid = (-1); /* Temporary group ID */
- int ret_value = -1;
+ hid_t c_loc_id = (hid_t)*loc_id;
+ char * c_name = NULL;
+ size_t c_obj_namelen;
+ char * c_obj_name = NULL;
+ hsize_t c_idx = (hsize_t)*idx;
+ hid_t gid = (-1); /* Temporary group ID */
+ int ret_value = -1;
/*
* Convert FORTRAN name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
goto DONE;
/*
* Allocate buffer to hold name of the object
*/
c_obj_namelen = (size_t)*obj_namelen;
- if(c_obj_namelen)
- if(NULL == (c_obj_name = (char *)HDmalloc(c_obj_namelen + 1)))
- goto DONE;
+ if (c_obj_namelen)
+ if (NULL == (c_obj_name = (char *)HDmalloc(c_obj_namelen + 1)))
+ goto DONE;
/* Get a temporary group ID for the group to query */
- if((gid = H5Gopen2(c_loc_id, c_name, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(c_loc_id, c_name, H5P_DEFAULT)) < 0)
goto DONE;
/* Query the object's information */
- if(H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, c_obj_name, c_obj_namelen, H5P_DEFAULT) < 0)
+ if (H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, c_obj_name, c_obj_namelen,
+ H5P_DEFAULT) < 0)
goto DONE;
- if(H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if (H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, &oinfo, H5O_INFO_BASIC,
+ H5P_DEFAULT) < 0)
goto DONE;
-/* XXX: Switch from using H5Gget_objtype_by_idx() means that this routine won't
- * work on non-hard links - QAK
- */
+ /* XXX: Switch from using H5Gget_objtype_by_idx() means that this routine won't
+ * work on non-hard links - QAK
+ */
*obj_type = oinfo.type;
/*
@@ -216,12 +219,12 @@ h5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx,
DONE:
/* Close the temporary group, if it was opened */
- if(gid > 0)
+ if (gid > 0)
H5Gclose(gid);
- if(c_obj_name)
+ if (c_obj_name)
HDfree(c_obj_name);
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
}
@@ -243,30 +246,30 @@ DONE:
* Elena Pourmal
* Wednesday, August 5, 1999
* SOURCE
-*/
+ */
int_f
h5gn_members_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *nmembers)
/******/
{
- char *c_name = NULL;
+ char * c_name = NULL;
H5G_info_t ginfo;
- int ret_value = -1;
+ int ret_value = -1;
/*
* Convert FORTRAN name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
goto DONE;
/* Call H5Gget_info_by_name() for the number of objects in the group */
- if(H5Gget_info_by_name((hid_t)*loc_id, c_name, &ginfo, H5P_DEFAULT) < 0)
+ if (H5Gget_info_by_name((hid_t)*loc_id, c_name, &ginfo, H5P_DEFAULT) < 0)
goto DONE;
*nmembers = (int_f)ginfo.nlinks;
ret_value = 0;
DONE:
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
}
@@ -284,7 +287,7 @@ DONE:
* Elena Pourmal
* Wednesday, August 5, 1999
* SOURCE
-*/
+ */
int_f
h5gclose_c(hid_t_f *grp_id)
@@ -292,12 +295,11 @@ h5gclose_c(hid_t_f *grp_id)
{
int ret_value = 0;
- if(H5Gclose((hid_t)*grp_id) < 0)
+ if (H5Gclose((hid_t)*grp_id) < 0)
ret_value = -1;
return ret_value;
}
-
/****if* H5Gf/h5glink_c
* NAME
* h5glink_c
@@ -317,67 +319,68 @@ h5gclose_c(hid_t_f *grp_id)
* Mingshi Chen
* Friday, August 6, 1999
* SOURCE
-*/
+ */
int_f
-h5glink_c(hid_t_f *loc_id, int_f *link_type, _fcd current_name,
- int_f *current_namelen, _fcd new_name, int_f *new_namelen)
+h5glink_c(hid_t_f *loc_id, int_f *link_type, _fcd current_name, int_f *current_namelen, _fcd new_name,
+ int_f *new_namelen)
/******/
{
char *c_current_name = NULL, *c_new_name = NULL;
- int ret_value = -1;
+ int ret_value = -1;
/*
- * Convert Fortran name to C name
- */
- if(NULL == (c_current_name = (char *)HD5f2cstring(current_name, (size_t)*current_namelen)))
+ * Convert Fortran name to C name
+ */
+ if (NULL == (c_current_name = (char *)HD5f2cstring(current_name, (size_t)*current_namelen)))
goto DONE;
- if(NULL == (c_new_name = (char *)HD5f2cstring(new_name, (size_t)*new_namelen)))
+ if (NULL == (c_new_name = (char *)HD5f2cstring(new_name, (size_t)*new_namelen)))
goto DONE;
/*
- * Call appropriate link creation function
- */
- switch((H5L_type_t)*link_type) {
+ * Call appropriate link creation function
+ */
+ switch ((H5L_type_t)*link_type) {
case H5L_TYPE_HARD:
- if(H5Lcreate_hard((hid_t)*loc_id, c_current_name, H5L_SAME_LOC, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_hard((hid_t)*loc_id, c_current_name, H5L_SAME_LOC, c_new_name, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
goto DONE;
break;
case H5L_TYPE_SOFT:
- if(H5Lcreate_soft(c_current_name, (hid_t)*loc_id, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_soft(c_current_name, (hid_t)*loc_id, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
goto DONE;
break;
- /* Cases below were added to remove the warnings in gcc 4.9.2 and probably other */
+ /* Cases below were added to remove the warnings in gcc 4.9.2 and probably other */
case H5L_TYPE_EXTERNAL:
ret_value = -1;
- goto DONE;
+ goto DONE;
break;
case H5L_TYPE_MAX:
ret_value = -1;
- goto DONE;
+ goto DONE;
break;
case H5L_TYPE_ERROR:
ret_value = -1;
- goto DONE;
+ goto DONE;
break;
- /* End of the warnings fix */
+ /* End of the warnings fix */
- default: /* Unknown/unhandled link type */
+ default: /* Unknown/unhandled link type */
goto DONE;
} /* end switch */
ret_value = 0;
DONE:
- if(c_current_name)
+ if (c_current_name)
HDfree(c_current_name);
- if(c_new_name)
+ if (c_new_name)
HDfree(c_new_name);
- return ret_value ;
+ return ret_value;
}
/****if* H5Gf/h5glink2_c
@@ -404,65 +407,66 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5glink2_c(hid_t_f *cur_loc_id, _fcd cur_name, int_f *cur_namelen,
- int_f *link_type, hid_t_f *new_loc_id, _fcd new_name, int_f *new_namelen)
+h5glink2_c(hid_t_f *cur_loc_id, _fcd cur_name, int_f *cur_namelen, int_f *link_type, hid_t_f *new_loc_id,
+ _fcd new_name, int_f *new_namelen)
/******/
{
char *c_cur_name = NULL, *c_new_name = NULL;
- int ret_value = -1;
+ int ret_value = -1;
/*
* Convert Fortran name to C name
*/
- if(NULL == (c_cur_name = (char *)HD5f2cstring(cur_name, (size_t)*cur_namelen)))
+ if (NULL == (c_cur_name = (char *)HD5f2cstring(cur_name, (size_t)*cur_namelen)))
goto DONE;
- if(NULL == (c_new_name = (char *)HD5f2cstring(new_name, (size_t)*new_namelen)))
+ if (NULL == (c_new_name = (char *)HD5f2cstring(new_name, (size_t)*new_namelen)))
goto DONE;
/*
- * Call appropriate link creation function
- */
- switch((H5L_type_t)*link_type) {
+ * Call appropriate link creation function
+ */
+ switch ((H5L_type_t)*link_type) {
case H5L_TYPE_HARD:
- if(H5Lcreate_hard((hid_t)*cur_loc_id, c_cur_name, (hid_t)*new_loc_id, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_hard((hid_t)*cur_loc_id, c_cur_name, (hid_t)*new_loc_id, c_new_name, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
goto DONE;
break;
case H5L_TYPE_SOFT:
- if(H5Lcreate_soft(c_cur_name, (hid_t)*new_loc_id, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_soft(c_cur_name, (hid_t)*new_loc_id, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
goto DONE;
break;
- /* Cases below were added to remove the warnings in gcc 4.9.2 and probably other */
+ /* Cases below were added to remove the warnings in gcc 4.9.2 and probably other */
case H5L_TYPE_EXTERNAL:
ret_value = -1;
- goto DONE;
+ goto DONE;
break;
case H5L_TYPE_MAX:
ret_value = -1;
- goto DONE;
+ goto DONE;
break;
case H5L_TYPE_ERROR:
ret_value = -1;
- goto DONE;
+ goto DONE;
break;
- /* End of the warnings fix */
+ /* End of the warnings fix */
- default: /* Unknown/unhandled link type */
+ default: /* Unknown/unhandled link type */
goto DONE;
} /* end switch */
ret_value = 0;
DONE:
- if(c_cur_name)
+ if (c_cur_name)
HDfree(c_cur_name);
- if(c_new_name)
+ if (c_new_name)
HDfree(c_new_name);
- return ret_value ;
+ return ret_value;
}
/****if* H5Gf/h5gunlink_c
@@ -479,30 +483,30 @@ DONE:
* Mingshi Chen
* Friday, August 6, 1999
* SOURCE
-*/
+ */
int_f
h5gunlink_c(hid_t_f *loc_id, _fcd name, int_f *namelen)
/******/
{
- char *c_name = NULL;
- int ret_value = -1;
+ char *c_name = NULL;
+ int ret_value = -1;
/*
* Convert Fortran name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
goto DONE;
/*
* Call H5Gunlink function
*/
- if(H5Ldelete((hid_t)*loc_id, c_name, H5P_DEFAULT) < 0)
+ if (H5Ldelete((hid_t)*loc_id, c_name, H5P_DEFAULT) < 0)
goto DONE;
ret_value = 0;
DONE:
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
}
@@ -524,35 +528,35 @@ DONE:
* Mingshi Chen
* Friday, August 6, 1999
* SOURCE
-*/
+ */
int_f
-h5gmove_c(hid_t_f *loc_id, _fcd src_name, int_f *src_namelen, _fcd dst_name, int_f*dst_namelen)
+h5gmove_c(hid_t_f *loc_id, _fcd src_name, int_f *src_namelen, _fcd dst_name, int_f *dst_namelen)
/******/
{
char *c_src_name = NULL, *c_dst_name = NULL;
- int ret_value = -1;
+ int ret_value = -1;
/*
* Convert Fortran name to C name
*/
- if(NULL == (c_src_name = (char *)HD5f2cstring(src_name, (size_t)*src_namelen)))
+ if (NULL == (c_src_name = (char *)HD5f2cstring(src_name, (size_t)*src_namelen)))
goto DONE;
- if(NULL == (c_dst_name = (char *)HD5f2cstring(dst_name, (size_t)*dst_namelen)))
+ if (NULL == (c_dst_name = (char *)HD5f2cstring(dst_name, (size_t)*dst_namelen)))
goto DONE;
/*
* Call H5Gmove function
*/
- if(H5Lmove((hid_t)*loc_id, c_src_name, H5L_SAME_LOC, c_dst_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lmove((hid_t)*loc_id, c_src_name, H5L_SAME_LOC, c_dst_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
goto DONE;
ret_value = 0;
DONE:
- if(c_src_name)
+ if (c_src_name)
HDfree(c_src_name);
- if(c_dst_name)
+ if (c_dst_name)
HDfree(c_dst_name);
return ret_value;
}
@@ -576,35 +580,36 @@ DONE:
* Wednesday, September 25, 2002
*
* SOURCE
-*/
+ */
int_f
-h5gmove2_c(hid_t_f *src_loc_id, _fcd src_name, int_f *src_namelen, hid_t_f *dst_loc_id, _fcd dst_name, int_f*dst_namelen)
+h5gmove2_c(hid_t_f *src_loc_id, _fcd src_name, int_f *src_namelen, hid_t_f *dst_loc_id, _fcd dst_name,
+ int_f *dst_namelen)
/******/
{
char *c_src_name = NULL, *c_dst_name = NULL;
- int ret_value = -1;
+ int ret_value = -1;
/*
* Convert Fortran name to C name
*/
- if(NULL == (c_src_name = (char *)HD5f2cstring(src_name, (size_t)*src_namelen)))
+ if (NULL == (c_src_name = (char *)HD5f2cstring(src_name, (size_t)*src_namelen)))
goto DONE;
- if(NULL == (c_dst_name = (char *)HD5f2cstring(dst_name, (size_t)*dst_namelen)))
+ if (NULL == (c_dst_name = (char *)HD5f2cstring(dst_name, (size_t)*dst_namelen)))
goto DONE;
/*
* Call H5Gmove2 function
*/
- if(H5Lmove((hid_t)*src_loc_id, c_src_name, (hid_t)*dst_loc_id, c_dst_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lmove((hid_t)*src_loc_id, c_src_name, (hid_t)*dst_loc_id, c_dst_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
goto DONE;
ret_value = 0;
DONE:
- if(c_src_name)
+ if (c_src_name)
HDfree(c_src_name);
- if(c_dst_name)
+ if (c_dst_name)
HDfree(c_dst_name);
return ret_value;
}
@@ -627,37 +632,37 @@ DONE:
* Mingshi Chen
* Friday, August 6, 1999
* SOURCE
-*/
+ */
int_f
-h5gget_linkval_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size,
- _fcd value)
+h5gget_linkval_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size, _fcd value)
/******/
{
- char *c_name = NULL;
- char *c_value = NULL;
- int ret_value = -1;
+ char *c_name = NULL;
+ char *c_value = NULL;
+ int ret_value = -1;
/*
* Convert Fortran name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
goto DONE;
/*
* Allocate buffer to hold name of the value
*/
- if(*size) c_value = (char *)HDmalloc((size_t)*size);
- if(c_value == NULL) {
- HDfree(c_name);
- return ret_value;
- }
+ if (*size)
+ c_value = (char *)HDmalloc((size_t)*size);
+ if (c_value == NULL) {
+ HDfree(c_name);
+ return ret_value;
+ }
/*
* Call H5Lget_val function
*/
- if(H5Lget_val((hid_t)*loc_id, c_name, c_value, (size_t)*size, H5P_DEFAULT) < 0)
- goto DONE;
+ if (H5Lget_val((hid_t)*loc_id, c_name, c_value, (size_t)*size, H5P_DEFAULT) < 0)
+ goto DONE;
/*
* Convert C name to FORTRAN and place it in the given buffer
@@ -666,9 +671,9 @@ h5gget_linkval_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size,
ret_value = 0;
DONE:
- if(c_value)
+ if (c_value)
HDfree(c_value);
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
}
@@ -692,34 +697,33 @@ DONE:
* HISTORY
* Elena Pourmal
* SOURCE
-*/
+ */
int_f
-h5gset_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, _fcd comment,
- int_f *commentlen)
+h5gset_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, _fcd comment, int_f *commentlen)
/******/
{
char *c_name = NULL, *c_comment = NULL;
- int ret_value = -1;
+ int ret_value = -1;
/*
* Convert Fortran name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
goto DONE;
- if(NULL == (c_comment = (char *)HD5f2cstring(comment, (size_t)*commentlen)))
+ if (NULL == (c_comment = (char *)HD5f2cstring(comment, (size_t)*commentlen)))
goto DONE;
/*
* Call H5Oset_comment_by_name function
*/
- if(H5Oset_comment_by_name((hid_t)*loc_id, c_name, c_comment, H5P_DEFAULT) < 0)
+ if (H5Oset_comment_by_name((hid_t)*loc_id, c_name, c_comment, H5P_DEFAULT) < 0)
goto DONE;
ret_value = 0;
DONE:
- if(c_name)
+ if (c_name)
HDfree(c_name);
- if(c_comment)
+ if (c_comment)
HDfree(c_comment);
return ret_value;
}
@@ -741,47 +745,46 @@ DONE:
* Mingshi Chen
* Friday, August 6, 1999
* SOURCE
-*/
+ */
int_f
-h5gget_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *bufsize,
- _fcd comment)
+h5gget_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *bufsize, _fcd comment)
/******/
{
- char *c_name = NULL, *c_comment = NULL;
+ char * c_name = NULL, *c_comment = NULL;
size_t c_bufsize;
- int ret_value = -1;
+ int ret_value = -1;
/*
* Convert Fortran name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
goto DONE;
/*
* Allocate buffer to hold the comment
*/
c_bufsize = (size_t)*bufsize;
- if(c_bufsize) {
- if(NULL == (c_comment = (char *)HDmalloc(c_bufsize + 1)))
+ if (c_bufsize) {
+ if (NULL == (c_comment = (char *)HDmalloc(c_bufsize + 1)))
goto DONE;
} /* end if */
/*
* Call H5Oget_comment_by_name function
*/
- if(H5Oget_comment_by_name((hid_t)*loc_id, c_name, c_comment, c_bufsize, H5P_DEFAULT) < 0)
+ if (H5Oget_comment_by_name((hid_t)*loc_id, c_name, c_comment, c_bufsize, H5P_DEFAULT) < 0)
goto DONE;
/*
- * Convert C name to FORTRAN and place it in the given buffer
- */
+ * Convert C name to FORTRAN and place it in the given buffer
+ */
HD5packFstring(c_comment, _fcdtocp(comment), c_bufsize);
ret_value = 0;
DONE:
- if(c_name)
+ if (c_name)
HDfree(c_name);
- if(c_comment)
+ if (c_comment)
HDfree(c_comment);
return ret_value;
}
@@ -805,16 +808,16 @@ DONE:
* M. Scot Breitenfeld
* February 15, 2008
* SOURCE
-*/
+ */
int_f
h5gcreate_anon_c(hid_t_f *loc_id, hid_t_f *gcpl_id, hid_t_f *gapl_id, hid_t_f *grp_id)
/******/
{
- int_f ret_value=0; /* Return value */
+ int_f ret_value = 0; /* Return value */
- if ((*grp_id = (hid_t_f)H5Gcreate_anon((hid_t)*loc_id,(hid_t)*gcpl_id,(hid_t)*gapl_id)) < 0)
- HGOTO_DONE(FAIL);
+ if ((*grp_id = (hid_t_f)H5Gcreate_anon((hid_t)*loc_id, (hid_t)*gcpl_id, (hid_t)*gapl_id)) < 0)
+ HGOTO_DONE(FAIL);
done:
return ret_value;
@@ -837,21 +840,20 @@ done:
* M. Scot Breitenfeld
* February 15, 2008
* SOURCE
-*/
+ */
int_f
-h5gget_create_plist_c(hid_t_f *grp_id, hid_t_f *gcpl_id )
+h5gget_create_plist_c(hid_t_f *grp_id, hid_t_f *gcpl_id)
/******/
{
- int_f ret_value=0; /* Return value */
+ int_f ret_value = 0; /* Return value */
- if ((*gcpl_id = (hid_t_f)H5Gget_create_plist((hid_t)*grp_id)) < 0)
- HGOTO_DONE(FAIL);
+ if ((*gcpl_id = (hid_t_f)H5Gget_create_plist((hid_t)*grp_id)) < 0)
+ HGOTO_DONE(FAIL);
done:
return ret_value;
}
-
/****if* H5Gf/h5gget_info_c
* NAME
* h5gget_info_c
@@ -881,34 +883,34 @@ done:
* M. Scot Breitenfeld
* July 16, 2008
* SOURCE
-*/
+ */
int_f
-h5gget_info_c (hid_t_f *group_id, int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted )
+h5gget_info_c(hid_t_f *group_id, int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted)
/******/
{
- int_f ret_value = 0; /* Return value */
+ int_f ret_value = 0; /* Return value */
H5G_info_t ginfo;
- /*
- * Call H5Gget_info function.
- */
- if(H5Gget_info((hid_t)*group_id,&ginfo) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Gget_info function.
+ */
+ if (H5Gget_info((hid_t)*group_id, &ginfo) < 0)
+ HGOTO_DONE(FAIL);
/* Unpack the structure */
*storage_type = (int_f)ginfo.storage_type;
- *nlinks = (int_f)ginfo.nlinks;
- *max_corder = (int_f)ginfo.max_corder;
- *mounted = 0;
- if(ginfo.mounted) *mounted = 1;
+ *nlinks = (int_f)ginfo.nlinks;
+ *max_corder = (int_f)ginfo.max_corder;
+ *mounted = 0;
+ if (ginfo.mounted)
+ *mounted = 1;
done:
return ret_value;
}
-
/****if* H5Gf/h5gget_info_by_idx_c
* NAME
* h5gget_info_by_idx_c
@@ -945,41 +947,42 @@ done:
* M. Scot Breitenfeld
* July 16, 2008
* SOURCE
-*/
+ */
int_f
-h5gget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
- int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *lapl_id,
- int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted )
+h5gget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, int_f *index_type,
+ int_f *order, hsize_t_f *n, hid_t_f *lapl_id, int_f *storage_type, int_f *nlinks,
+ int_f *max_corder, int_f *mounted)
/******/
{
- char *c_group_name = NULL; /* Buffer to hold group name C string */
- int_f ret_value = 0; /* Return value */
- H5G_info_t ginfo;
- /*
- * Convert FORTRAN name to C name
- */
- if((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Gget_info_by_idx function.
- */
- if(H5Gget_info_by_idx((hid_t)*loc_id,c_group_name, (H5_index_t)*index_type,(H5_iter_order_t)*order,(hsize_t)*n,
- &ginfo, (hid_t)*lapl_id) < 0)
- HGOTO_DONE(FAIL);
-
- /* Unpack the structure */
-
- *storage_type = (int_f)ginfo.storage_type;
- *nlinks = (int_f)ginfo.nlinks;
- *max_corder = (int_f)ginfo.max_corder;
- *mounted = 0;
- if(ginfo.mounted) *mounted = 1;
-
- done:
- if(c_group_name)
- HDfree(c_group_name);
- return ret_value;
+ char * c_group_name = NULL; /* Buffer to hold group name C string */
+ int_f ret_value = 0; /* Return value */
+ H5G_info_t ginfo;
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Gget_info_by_idx function.
+ */
+ if (H5Gget_info_by_idx((hid_t)*loc_id, c_group_name, (H5_index_t)*index_type, (H5_iter_order_t)*order,
+ (hsize_t)*n, &ginfo, (hid_t)*lapl_id) < 0)
+ HGOTO_DONE(FAIL);
+
+ /* Unpack the structure */
+
+ *storage_type = (int_f)ginfo.storage_type;
+ *nlinks = (int_f)ginfo.nlinks;
+ *max_corder = (int_f)ginfo.max_corder;
+ *mounted = 0;
+ if (ginfo.mounted)
+ *mounted = 1;
+
+done:
+ if (c_group_name)
+ HDfree(c_group_name);
+ return ret_value;
}
/****if* H5Gf/h5gget_info_by_name_c
@@ -1015,37 +1018,38 @@ h5gget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
* M. Scot Breitenfeld
* July 16, 2008
* SOURCE
-*/
+ */
int_f
h5gget_info_by_name_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, hid_t_f *lapl_id,
- int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted)
+ int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted)
/******/
{
- char *c_group_name = NULL; /* Buffer to hold group name C string */
- int_f ret_value = 0; /* Return value */
- H5G_info_t ginfo;
- /*
- * Convert FORTRAN name to C name
- */
- if((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Gget_info_by_name function.
- */
- if(H5Gget_info_by_name((hid_t)*loc_id, c_group_name, &ginfo, (hid_t)*lapl_id) < 0)
- HGOTO_DONE(FAIL);
-
- /* Unpack the structure */
-
- *storage_type = (int_f)ginfo.storage_type;
- *nlinks = (int_f)ginfo.nlinks;
- *max_corder = (int_f)ginfo.max_corder;
- *mounted = 0;
- if(ginfo.mounted) *mounted = 1;
-
- done:
- if(c_group_name)
- HDfree(c_group_name);
- return ret_value;
+ char * c_group_name = NULL; /* Buffer to hold group name C string */
+ int_f ret_value = 0; /* Return value */
+ H5G_info_t ginfo;
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Gget_info_by_name function.
+ */
+ if (H5Gget_info_by_name((hid_t)*loc_id, c_group_name, &ginfo, (hid_t)*lapl_id) < 0)
+ HGOTO_DONE(FAIL);
+
+ /* Unpack the structure */
+
+ *storage_type = (int_f)ginfo.storage_type;
+ *nlinks = (int_f)ginfo.nlinks;
+ *max_corder = (int_f)ginfo.max_corder;
+ *mounted = 0;
+ if (ginfo.mounted)
+ *mounted = 1;
+
+done:
+ if (c_group_name)
+ HDfree(c_group_name);
+ return ret_value;
}
diff --git a/fortran/src/H5If.c b/fortran/src/H5If.c
index 8222817..1b44924 100644
--- a/fortran/src/H5If.c
+++ b/fortran/src/H5If.c
@@ -17,7 +17,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include "H5f90.h"
#include "H5Eprivate.h"
@@ -38,24 +38,25 @@
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5iget_type_c (hid_t_f *obj_id, int_f *type)
+h5iget_type_c(hid_t_f *obj_id, int_f *type)
/******/
{
- int ret_value = -1;
- hid_t c_obj_id;
- H5I_type_t c_type;
+ int ret_value = -1;
+ hid_t c_obj_id;
+ H5I_type_t c_type;
- /*
- * Call H5Iget_type function.
- */
- c_obj_id = *obj_id;
- c_type = H5Iget_type(c_obj_id);
- if (c_type == H5I_BADID) return ret_value;
- *type = (int_f)c_type;
- ret_value = 0;
- return ret_value;
+ /*
+ * Call H5Iget_type function.
+ */
+ c_obj_id = *obj_id;
+ c_type = H5Iget_type(c_obj_id);
+ if (c_type == H5I_BADID)
+ return ret_value;
+ *type = (int_f)c_type;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5If/h5iget_name_c
* NAME
@@ -79,41 +80,43 @@ h5iget_type_c (hid_t_f *obj_id, int_f *type)
* exact size of the string (buf_size) is passed in.
* M. Scot Breitenfeld, April 21, 2008
* SOURCE
-*/
+ */
int_f
h5iget_name_c(hid_t_f *obj_id, _fcd buf, size_t_f *buf_size, size_t_f *name_size)
/******/
{
- int ret_value = -1;
- hid_t c_obj_id;
- ssize_t c_size;
- size_t c_buf_size;
- char *c_buf =NULL;
+ int ret_value = -1;
+ hid_t c_obj_id;
+ ssize_t c_size;
+ size_t c_buf_size;
+ char * c_buf = NULL;
- /*
- * Allocate buffer to hold name of an object
- */
- c_buf_size = (size_t)*buf_size +1;
- c_buf = (char *)HDmalloc(c_buf_size);
- if (c_buf == NULL) return ret_value;
+ /*
+ * Allocate buffer to hold name of an object
+ */
+ c_buf_size = (size_t)*buf_size + 1;
+ c_buf = (char *)HDmalloc(c_buf_size);
+ if (c_buf == NULL)
+ return ret_value;
- /*
- * Call H5IAget_name function
- */
- c_obj_id = (hid_t)*obj_id;
- c_size = H5Iget_name(c_obj_id, c_buf, c_buf_size);
- if (c_size < 0) goto DONE;
+ /*
+ * Call H5IAget_name function
+ */
+ c_obj_id = (hid_t)*obj_id;
+ c_size = H5Iget_name(c_obj_id, c_buf, c_buf_size);
+ if (c_size < 0)
+ goto DONE;
- /*
- * Convert C name to FORTRAN and place it in the given buffer
- */
- HD5packFstring(c_buf, _fcdtocp(buf), c_buf_size-1);
- *name_size = (size_t_f)c_size;
- ret_value = 0;
+ /*
+ * Convert C name to FORTRAN and place it in the given buffer
+ */
+ HD5packFstring(c_buf, _fcdtocp(buf), c_buf_size - 1);
+ *name_size = (size_t_f)c_size;
+ ret_value = 0;
DONE:
- HDfree(c_buf);
- return ret_value;
+ HDfree(c_buf);
+ return ret_value;
}
/****if* H5If/h5iinc_ref_c
@@ -131,25 +134,25 @@ DONE:
* Quincey Koziol
* Tuesday, December 9, 2003
* SOURCE
-*/
+ */
int_f
h5iinc_ref_c(hid_t_f *obj_id, int_f *ref_count)
/******/
{
- int ret_value;
+ int ret_value;
- /*
- * Call H5Iinc_ref function
- */
- if ((ret_value = H5Iinc_ref(*obj_id)) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Iinc_ref function
+ */
+ if ((ret_value = H5Iinc_ref(*obj_id)) < 0)
+ HGOTO_DONE(FAIL);
/* Set output & return values */
- *ref_count=ret_value;
- ret_value=0;
+ *ref_count = ret_value;
+ ret_value = 0;
done:
- return ret_value;
+ return ret_value;
}
/****if* H5If/h5idec_ref_c
@@ -167,25 +170,25 @@ done:
* Quincey Koziol
* Tuesday, December 9, 2003
* SOURCE
-*/
+ */
int_f
h5idec_ref_c(hid_t_f *obj_id, int_f *ref_count)
/******/
{
- int ret_value;
+ int ret_value;
- /*
- * Call H5Idec_ref function
- */
- if ((ret_value = H5Idec_ref(*obj_id)) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Idec_ref function
+ */
+ if ((ret_value = H5Idec_ref(*obj_id)) < 0)
+ HGOTO_DONE(FAIL);
/* Set output & return values */
- *ref_count=ret_value;
- ret_value=0;
+ *ref_count = ret_value;
+ ret_value = 0;
done:
- return ret_value;
+ return ret_value;
}
/****if* H5If/h5iget_ref_c
@@ -204,25 +207,25 @@ done:
* Tuesday, December 9, 2003
*
* SOURCE
-*/
+ */
int_f
h5iget_ref_c(hid_t_f *obj_id, int_f *ref_count)
/******/
{
- int ret_value;
+ int ret_value;
- /*
- * Call H5Iget_ref function
- */
- if ((ret_value = H5Iget_ref(*obj_id)) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Iget_ref function
+ */
+ if ((ret_value = H5Iget_ref(*obj_id)) < 0)
+ HGOTO_DONE(FAIL);
/* Set output & return values */
- *ref_count=ret_value;
- ret_value=0;
+ *ref_count = ret_value;
+ ret_value = 0;
done:
- return ret_value;
+ return ret_value;
}
/****if* H5If/h5iget_file_id_c
@@ -241,26 +244,26 @@ done:
* Tuesday, August 24, 2004
*
* SOURCE
-*/
+ */
int_f
h5iget_file_id_c(hid_t_f *obj_id, hid_t_f *file_id)
/******/
{
- int ret_value;
- hid_t c_file_id;
+ int ret_value;
+ hid_t c_file_id;
- /*
- * Call H5Iget_file_id
- */
- if ((c_file_id = H5Iget_file_id(*obj_id)) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Iget_file_id
+ */
+ if ((c_file_id = H5Iget_file_id(*obj_id)) < 0)
+ HGOTO_DONE(FAIL);
/* Set output & return values */
- *file_id=(hid_t_f)c_file_id;
- ret_value=0;
+ *file_id = (hid_t_f)c_file_id;
+ ret_value = 0;
done:
- return ret_value;
+ return ret_value;
}
/*----------------------------------------------------------------------------
@@ -276,19 +279,19 @@ done:
int_f
h5iis_valid_c(hid_t_f *obj_id, int_f *c_valid)
{
- int ret_value;
- htri_t c_ret_value;
+ int ret_value;
+ htri_t c_ret_value;
- /*
- * Call H5Iis_valid
- */
- if ((c_ret_value = H5Iis_valid(*obj_id)) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Iis_valid
+ */
+ if ((c_ret_value = H5Iis_valid(*obj_id)) < 0)
+ HGOTO_DONE(FAIL);
- /* Set output & return values */
- *c_valid = (int_f)c_ret_value;
- ret_value=0;
+ /* Set output & return values */
+ *c_valid = (int_f)c_ret_value;
+ ret_value = 0;
done:
- return ret_value;
+ return ret_value;
}
diff --git a/fortran/src/H5Lf.c b/fortran/src/H5Lf.c
index 1fee5e8..2614c10 100644
--- a/fortran/src/H5Lf.c
+++ b/fortran/src/H5Lf.c
@@ -17,7 +17,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include "H5f90.h"
#include "H5Eprivate.h"
@@ -48,40 +48,39 @@
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5lcopy_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_namelen, hid_t_f *dest_loc_id,
- _fcd dest_name, size_t_f *dest_namelen,
- hid_t_f *lcpl_id, hid_t_f *lapl_id)
+h5lcopy_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_namelen, hid_t_f *dest_loc_id, _fcd dest_name,
+ size_t_f *dest_namelen, hid_t_f *lcpl_id, hid_t_f *lapl_id)
/******/
{
- char *c_src_name = NULL;
+ char *c_src_name = NULL;
char *c_dest_name = NULL;
- int_f ret_value = 0;
+ int_f ret_value = 0;
/*
* Convert FORTRAN name to C name
*/
- if(NULL == (c_src_name = HD5f2cstring(src_name, (size_t)*src_namelen)))
+ if (NULL == (c_src_name = HD5f2cstring(src_name, (size_t)*src_namelen)))
HGOTO_DONE(FAIL)
- if(NULL == (c_dest_name = HD5f2cstring(dest_name, (size_t)*dest_namelen)))
+ if (NULL == (c_dest_name = HD5f2cstring(dest_name, (size_t)*dest_namelen)))
HGOTO_DONE(FAIL)
/*
* Call H5Lcopy function.
*/
- if(H5Lcopy((hid_t)*src_loc_id, c_src_name, (hid_t) *dest_loc_id,
- c_dest_name, (hid_t)*lcpl_id, (hid_t)*lapl_id ) < 0)
+ if (H5Lcopy((hid_t)*src_loc_id, c_src_name, (hid_t)*dest_loc_id, c_dest_name, (hid_t)*lcpl_id,
+ (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL)
done:
- if(c_src_name)
+ if (c_src_name)
HDfree(c_src_name);
- if(c_dest_name)
+ if (c_dest_name)
HDfree(c_dest_name);
- return ret_value;
+ return ret_value;
}
/****if* H5Lf/h5lcreate_external_c
@@ -105,45 +104,45 @@ done:
* M. Scot Breitenfeld
* February 29, 2008
* SOURCE
-*/
+ */
int_f
h5lcreate_external_c(_fcd file_name, size_t_f *file_namelen, _fcd obj_name, size_t_f *obj_namelen,
- hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen,
- hid_t_f *lcpl_id, hid_t_f *lapl_id)
+ hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, hid_t_f *lcpl_id,
+ hid_t_f *lapl_id)
/******/
{
- char *c_file_name = NULL;
- char *c_obj_name = NULL;
- char *c_link_name = NULL;
- int_f ret_value = 0;
-
- /*
- * Convert FORTRAN name to C name
- */
- if((c_file_name = HD5f2cstring(file_name, (size_t)*file_namelen)) == NULL)
- HGOTO_DONE(FAIL);
- if((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL)
- HGOTO_DONE(FAIL);
- if((c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Lcopy function.
- */
- if( H5Lcreate_external( c_file_name, c_obj_name, (hid_t) *link_loc_id, c_link_name,
- (hid_t) *lcpl_id, (hid_t) *lapl_id) < 0)
- HGOTO_DONE(FAIL);
+ char *c_file_name = NULL;
+ char *c_obj_name = NULL;
+ char *c_link_name = NULL;
+ int_f ret_value = 0;
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_file_name = HD5f2cstring(file_name, (size_t)*file_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+ if ((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+ if ((c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Lcopy function.
+ */
+ if (H5Lcreate_external(c_file_name, c_obj_name, (hid_t)*link_loc_id, c_link_name, (hid_t)*lcpl_id,
+ (hid_t)*lapl_id) < 0)
+ HGOTO_DONE(FAIL);
done:
- if(c_file_name)
- HDfree(c_file_name);
- if(c_obj_name)
- HDfree(c_obj_name);
- if(c_link_name)
- HDfree(c_link_name);
-
- return ret_value;
+ if (c_file_name)
+ HDfree(c_file_name);
+ if (c_obj_name)
+ HDfree(c_obj_name);
+ if (c_link_name)
+ HDfree(c_link_name);
+
+ return ret_value;
}
/****if* H5Lf/h5ldelete_c
@@ -165,29 +164,29 @@ done:
* M. Scot Breitenfeld
* January, 2008
* SOURCE
-*/
+ */
int_f
-h5ldelete_c ( hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id )
+h5ldelete_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id)
/******/
{
- char *c_name = NULL;
- int_f ret_value = 0;
+ char *c_name = NULL;
+ int_f ret_value = 0;
- /*
- * Convert FORTRAN name to C name
- */
- if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
- HGOTO_DONE(FAIL);
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
+ HGOTO_DONE(FAIL);
- /*
- * Call H5Ldelete function.
- */
- if( H5Ldelete( (hid_t)*loc_id, c_name, (hid_t)*lapl_id ) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Ldelete function.
+ */
+ if (H5Ldelete((hid_t)*loc_id, c_name, (hid_t)*lapl_id) < 0)
+ HGOTO_DONE(FAIL);
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
@@ -213,37 +212,35 @@ done:
* M. Scot Breitenfeld
* February 20, 2008
* SOURCE
-*/
+ */
int_f
-h5lcreate_soft_c(_fcd target_path, size_t_f *target_path_len,
- hid_t_f *link_loc_id,
- _fcd link_name, size_t_f *link_name_len,
- hid_t_f *lcpl_id, hid_t_f *lapl_id )
+h5lcreate_soft_c(_fcd target_path, size_t_f *target_path_len, hid_t_f *link_loc_id, _fcd link_name,
+ size_t_f *link_name_len, hid_t_f *lcpl_id, hid_t_f *lapl_id)
/******/
{
- char *c_target_path = NULL;
- char *c_link_name = NULL;
- int_f ret_value = 0;
-
- /*
- * Convert FORTRAN name to C name
- */
- if((c_target_path = HD5f2cstring(target_path, (size_t)*target_path_len)) == NULL)
- HGOTO_DONE(FAIL);
- if((c_link_name = HD5f2cstring(link_name, (size_t)*link_name_len)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Adelete function.
- */
- if ( H5Lcreate_soft(c_target_path,(hid_t)*link_loc_id, c_link_name, (hid_t)*lcpl_id, (hid_t)*lapl_id) < 0)
- HGOTO_DONE(FAIL);
-
- done:
- if(c_target_path)
+ char *c_target_path = NULL;
+ char *c_link_name = NULL;
+ int_f ret_value = 0;
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_target_path = HD5f2cstring(target_path, (size_t)*target_path_len)) == NULL)
+ HGOTO_DONE(FAIL);
+ if ((c_link_name = HD5f2cstring(link_name, (size_t)*link_name_len)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Adelete function.
+ */
+ if (H5Lcreate_soft(c_target_path, (hid_t)*link_loc_id, c_link_name, (hid_t)*lcpl_id, (hid_t)*lapl_id) < 0)
+ HGOTO_DONE(FAIL);
+
+done:
+ if (c_target_path)
HDfree(c_target_path);
- if(c_link_name)
+ if (c_link_name)
HDfree(c_link_name);
return ret_value;
@@ -271,36 +268,35 @@ h5lcreate_soft_c(_fcd target_path, size_t_f *target_path_len,
* M. Scot Breitenfeld
* February 27, 2008
* SOURCE
-*/
+ */
int_f
-h5lcreate_hard_c(hid_t_f *obj_loc_id, _fcd obj_name, size_t_f *obj_namelen,
- hid_t_f *link_loc_id,
- _fcd link_name, size_t_f *link_namelen,
- hid_t_f *lcpl_id, hid_t_f *lapl_id )
+h5lcreate_hard_c(hid_t_f *obj_loc_id, _fcd obj_name, size_t_f *obj_namelen, hid_t_f *link_loc_id,
+ _fcd link_name, size_t_f *link_namelen, hid_t_f *lcpl_id, hid_t_f *lapl_id)
/******/
{
- char *c_obj_name = NULL;
- char *c_link_name = NULL;
- int_f ret_value = 0;
-
- /*
- * Convert FORTRAN name to C name
- */
- if((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL)
- HGOTO_DONE(FAIL);
- if((c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Lcreate_hard function.
- */
- if ( H5Lcreate_hard((hid_t)*obj_loc_id, c_obj_name, (hid_t)*link_loc_id, c_link_name, (hid_t)*lcpl_id, (hid_t)*lapl_id) < 0)
- HGOTO_DONE(FAIL);
-
- done:
- if(c_obj_name)
+ char *c_obj_name = NULL;
+ char *c_link_name = NULL;
+ int_f ret_value = 0;
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+ if ((c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Lcreate_hard function.
+ */
+ if (H5Lcreate_hard((hid_t)*obj_loc_id, c_obj_name, (hid_t)*link_loc_id, c_link_name, (hid_t)*lcpl_id,
+ (hid_t)*lapl_id) < 0)
+ HGOTO_DONE(FAIL);
+
+done:
+ if (c_obj_name)
HDfree(c_obj_name);
- if(c_link_name)
+ if (c_link_name)
HDfree(c_link_name);
return ret_value;
@@ -340,34 +336,35 @@ h5lcreate_hard_c(hid_t_f *obj_loc_id, _fcd obj_name, size_t_f *obj_namelen,
* HISTORY
* N/A
* SOURCE
-*/
+ */
int_f
-h5ldelete_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
- int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id)
+h5ldelete_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, int_f *index_field,
+ int_f *order, hsize_t_f *n, hid_t_f *lapl_id)
/******/
{
- char *c_group_name = NULL; /* Buffer to hold C string */
- H5_index_t c_index_field;
+ char * c_group_name = NULL; /* Buffer to hold C string */
+ H5_index_t c_index_field;
H5_iter_order_t c_order;
- int_f ret_value = 0; /* Return value */
+ int_f ret_value = 0; /* Return value */
- /*
- * Convert FORTRAN name to C name
- */
- if((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL)
- HGOTO_DONE(FAIL);
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
c_index_field = (H5_index_t)*index_field;
- c_order = (H5_iter_order_t)*order;
+ c_order = (H5_iter_order_t)*order;
- /*
- * Call H5Ldelete_by_name function.
- */
- if(H5Ldelete_by_idx((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, (hid_t)*lapl_id) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Ldelete_by_name function.
+ */
+ if (H5Ldelete_by_idx((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, (hid_t)*lapl_id) <
+ 0)
+ HGOTO_DONE(FAIL);
done:
- if(c_group_name)
+ if (c_group_name)
HDfree(c_group_name);
return ret_value;
}
@@ -393,28 +390,28 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5lexists_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, int_f *link_exists)
+h5lexists_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, int_f *link_exists)
/******/
{
- char *c_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
+ char *c_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
- /*
- * Convert FORTRAN name to C name
- */
- if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
- HGOTO_DONE(FAIL);
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
+ HGOTO_DONE(FAIL);
- /*
- * Call H5Lexists function.
- */
- if((*link_exists = (int_f)H5Lexists((hid_t)*loc_id, c_name, (hid_t)*lapl_id)) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Lexists function.
+ */
+ if ((*link_exists = (int_f)H5Lexists((hid_t)*loc_id, c_name, (hid_t)*lapl_id)) < 0)
+ HGOTO_DONE(FAIL);
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
}
@@ -452,40 +449,40 @@ done:
* HISTORY
* N/A
* SOURCE
-*/
+ */
int_f
-h5lget_info_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen,
- int_f *cset, int_f *corder, int_f *corder_valid, int_f *link_type,
- H5O_token_t *token, size_t_f *val_size, hid_t_f *lapl_id)
+h5lget_info_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, int_f *cset, int_f *corder,
+ int_f *corder_valid, int_f *link_type, H5O_token_t *token, size_t_f *val_size, hid_t_f *lapl_id)
/******/
{
- char *c_link_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
+ char * c_link_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
H5L_info2_t link_buff;
/*
* Convert FORTRAN name to C name
*/
- if(NULL == (c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)))
+ if (NULL == (c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)))
HGOTO_DONE(FAIL);
/*
* Call H5Linfo function.
*/
- if(H5Lget_info2((hid_t)*link_loc_id, c_link_name, &link_buff, (hid_t)*lapl_id) < 0)
+ if (H5Lget_info2((hid_t)*link_loc_id, c_link_name, &link_buff, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL);
/* Unpack the structure */
- *cset = (int_f)link_buff.cset;
- *corder = (int_f)link_buff.corder;
+ *cset = (int_f)link_buff.cset;
+ *corder = (int_f)link_buff.corder;
*corder_valid = 0;
- if(link_buff.corder_valid > 0) *corder_valid = 1;
+ if (link_buff.corder_valid > 0)
+ *corder_valid = 1;
*link_type = (int_f)link_buff.type;
- *token = link_buff.u.token;
- *val_size = (size_t_f)link_buff.u.val_size;
+ *token = link_buff.u.token;
+ *val_size = (size_t_f)link_buff.u.val_size;
done:
- if(c_link_name)
+ if (c_link_name)
HDfree(c_link_name);
return ret_value;
@@ -520,45 +517,45 @@ done:
* HISTORY
* N/A
* SOURCE
-*/
+ */
int_f
-h5lget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
- int_f *index_field, int_f *order, hsize_t_f *n,
- int_f *link_type, int_f *corder_valid, int_f *corder,
- int_f *cset, H5O_token_t *token, size_t_f *val_size, hid_t_f *lapl_id)
+h5lget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, int_f *index_field,
+ int_f *order, hsize_t_f *n, int_f *link_type, int_f *corder_valid, int_f *corder,
+ int_f *cset, H5O_token_t *token, size_t_f *val_size, hid_t_f *lapl_id)
/******/
{
- char *c_group_name = NULL; /* Buffer to hold C string */
- H5_index_t c_index_field;
+ char * c_group_name = NULL; /* Buffer to hold C string */
+ H5_index_t c_index_field;
H5_iter_order_t c_order;
- int_f ret_value = 0; /* Return value */
- H5L_info2_t link_buff;
+ int_f ret_value = 0; /* Return value */
+ H5L_info2_t link_buff;
/*
* Convert FORTRAN name to C name
*/
- if((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL)
- HGOTO_DONE(FAIL);
+ if ((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
c_index_field = (H5_index_t)*index_field;
- c_order = (H5_iter_order_t)*order;
- /*
- * Call H5Linfo_by_idx function.
- */
- if(H5Lget_info_by_idx2((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n,
- &link_buff, (hid_t)*lapl_id) < 0)
- HGOTO_DONE(FAIL);
+ c_order = (H5_iter_order_t)*order;
+ /*
+ * Call H5Linfo_by_idx function.
+ */
+ if (H5Lget_info_by_idx2((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, &link_buff,
+ (hid_t)*lapl_id) < 0)
+ HGOTO_DONE(FAIL);
/* Unpack the structure */
*corder_valid = 0;
- if(link_buff.corder_valid > 0) *corder_valid = 1;
+ if (link_buff.corder_valid > 0)
+ *corder_valid = 1;
- *corder = (int_f)link_buff.corder;
- *cset = (int_f)link_buff.cset;
+ *corder = (int_f)link_buff.corder;
+ *cset = (int_f)link_buff.cset;
*link_type = (int_f)link_buff.type;
- *token = link_buff.u.token;
- *val_size = (size_t_f)link_buff.u.val_size;
+ *token = link_buff.u.token;
+ *val_size = (size_t_f)link_buff.u.val_size;
done:
return ret_value;
@@ -584,12 +581,12 @@ done:
* HISTORY
* N/A
* SOURCE
-*/
+ */
int_f
h5lis_registered_c(int_f *link_cls_id)
/******/
{
- int_f ret_value; /* Return value */
+ int_f ret_value; /* Return value */
/*
* Call H5Lis_registered
@@ -604,7 +601,6 @@ h5lis_registered_c(int_f *link_cls_id)
/* H5L_type_t c_link_cls_id; /\* User-defined link class identifier *\/ */
/* htri_t registered; /\* registration status *\/ */
-
/* c_link_cls_id = (H5L_type_t)*link_cls_id; */
/* /\* */
/* * Call H5Lis_registered */
@@ -616,7 +612,6 @@ h5lis_registered_c(int_f *link_cls_id)
/* return ret_value; */
/* } */
-
/****if* H5Lf/h5lmove_c
* NAME
* h5lmove_c
@@ -639,35 +634,35 @@ h5lis_registered_c(int_f *link_cls_id)
* M. Scot Breitenfeld
* March 3, 2008
* SOURCE
-*/
+ */
int_f
-h5lmove_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_namelen, hid_t_f *dest_loc_id,
- _fcd dest_name, size_t_f *dest_namelen, hid_t_f *lcpl_id, hid_t_f *lapl_id)
+h5lmove_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_namelen, hid_t_f *dest_loc_id, _fcd dest_name,
+ size_t_f *dest_namelen, hid_t_f *lcpl_id, hid_t_f *lapl_id)
/******/
{
- char *c_src_name = NULL; /* Buffer to hold C string */
+ char *c_src_name = NULL; /* Buffer to hold C string */
char *c_dest_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
+ int_f ret_value = 0; /* Return value */
/*
* Convert FORTRAN name to C name
*/
- if(NULL == (c_src_name = HD5f2cstring(src_name, (size_t)*src_namelen)))
+ if (NULL == (c_src_name = HD5f2cstring(src_name, (size_t)*src_namelen)))
HGOTO_DONE(FAIL)
- if(NULL == (c_dest_name = HD5f2cstring(dest_name, (size_t)*dest_namelen)))
+ if (NULL == (c_dest_name = HD5f2cstring(dest_name, (size_t)*dest_namelen)))
HGOTO_DONE(FAIL)
- /*
- * Call H5Lmove function.
- */
- if(H5Lmove((hid_t)*src_loc_id, c_src_name, (hid_t)*dest_loc_id,
- c_dest_name, (hid_t)*lcpl_id, (hid_t)*lapl_id) < 0)
+ /*
+ * Call H5Lmove function.
+ */
+ if (H5Lmove((hid_t)*src_loc_id, c_src_name, (hid_t)*dest_loc_id, c_dest_name, (hid_t)*lcpl_id,
+ (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL)
done:
- if(c_src_name)
+ if (c_src_name)
HDfree(c_src_name);
- if(c_dest_name)
+ if (c_dest_name)
HDfree(c_dest_name);
return ret_value;
@@ -697,23 +692,22 @@ done:
* M. Scot Breitenfeld
* March 10, 2008
* SOURCE
-*/
+ */
int_f
-h5lget_name_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
- int_f *index_field, int_f *order, hsize_t_f *n,
- size_t_f *size, _fcd name, hid_t_f *lapl_id)
+h5lget_name_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, int_f *index_field,
+ int_f *order, hsize_t_f *n, size_t_f *size, _fcd name, hid_t_f *lapl_id)
/******/
{
- char *c_group_name = NULL; /* Buffer to hold C string */
- char *c_name = NULL; /* Buffer to hold C string */
- size_t c_size;
+ char * c_group_name = NULL; /* Buffer to hold C string */
+ char * c_name = NULL; /* Buffer to hold C string */
+ size_t c_size;
ssize_t c_size_link;
- int_f ret_value = 0; /* Return value */
+ int_f ret_value = 0; /* Return value */
/*
* Convert FORTRAN name to C name
*/
- if(NULL == (c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)))
+ if (NULL == (c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)))
HGOTO_DONE(FAIL)
c_size = (size_t)*size + 1;
@@ -721,11 +715,12 @@ h5lget_name_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
/*
* Allocate buffer to hold name of an attribute
*/
- if(NULL == (c_name = (char *)HDmalloc(c_size)))
+ if (NULL == (c_name = (char *)HDmalloc(c_size)))
HGOTO_DONE(FAIL)
- if((c_size_link = H5Lget_name_by_idx((hid_t)*loc_id, c_group_name, (H5_index_t)*index_field,
- (H5_iter_order_t)*order, (hsize_t)*n,c_name, c_size, (hid_t)*lapl_id)) < 0)
+ if ((c_size_link =
+ H5Lget_name_by_idx((hid_t)*loc_id, c_group_name, (H5_index_t)*index_field,
+ (H5_iter_order_t)*order, (hsize_t)*n, c_name, c_size, (hid_t)*lapl_id)) < 0)
HGOTO_DONE(FAIL)
*size = (size_t_f)c_size_link;
@@ -733,19 +728,18 @@ h5lget_name_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
/*
* Convert C name to FORTRAN and place it in the given buffer
*/
- if(c_name)
+ if (c_name)
HD5packFstring(c_name, _fcdtocp(name), c_size - 1);
done:
- if(c_group_name)
+ if (c_group_name)
HDfree(c_group_name);
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
}
-
/* /\****if* H5Lf/h5lget_val_c */
/* * NAME */
/* * h5lget_val_c */
@@ -795,12 +789,10 @@ done:
/* *\/ */
/* HD5packFstring(c_buf, _fcdtocp(buf), c_bufsize-1); */
-
/* done: */
/* return ret_value; */
/* } */
-
/* /\****if* H5Lf/ */
/* * NAME */
/* * H5Lregistered_c */
@@ -934,29 +926,29 @@ done:
* M. Scot Breitenfeld
* April 11, 2008
* SOURCE
-*/
+ */
int_f
-h5lget_val_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, size_t_f *size,
- void *linkval_buff, hid_t_f *lapl_id)
+h5lget_val_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, size_t_f *size, void *linkval_buff,
+ hid_t_f *lapl_id)
/******/
{
char *c_link_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
+ int_f ret_value = 0; /* Return value */
/*
* Convert FORTRAN name to C name
*/
- if(NULL == (c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)))
+ if (NULL == (c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)))
HGOTO_DONE(FAIL)
/*
* Call H5Lget_val
*/
- if(H5Lget_val((hid_t)*link_loc_id, c_link_name, &linkval_buff, (size_t)*size, (hid_t)*lapl_id )< 0)
+ if (H5Lget_val((hid_t)*link_loc_id, c_link_name, &linkval_buff, (size_t)*size, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL)
done:
- if(c_link_name)
+ if (c_link_name)
HDfree(c_link_name);
return ret_value;
@@ -986,27 +978,29 @@ done:
* M. Scot Breitenfeld
* July 8, 2008
* SOURCE
-*/
+ */
int_f
-h5literate_c(hid_t_f *group_id, int_f *index_type, int_f *order, hsize_t_f *idx, H5L_iterate2_t op, void *op_data )
+h5literate_c(hid_t_f *group_id, int_f *index_type, int_f *order, hsize_t_f *idx, H5L_iterate2_t op,
+ void *op_data)
/******/
{
- int_f ret_value = -1; /* Return value */
- herr_t func_ret_value; /* H5Linterate return value */
- hsize_t idx_c = 0;
+ int_f ret_value = -1; /* Return value */
+ herr_t func_ret_value; /* H5Linterate return value */
+ hsize_t idx_c = 0;
- idx_c = (hsize_t)*idx;
+ idx_c = (hsize_t)*idx;
- /*
- * Call H5Linterate
- */
+ /*
+ * Call H5Linterate
+ */
- func_ret_value = H5Literate2( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, &idx_c, op, op_data);
+ func_ret_value =
+ H5Literate2((hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, &idx_c, op, op_data);
- ret_value = (int_f)func_ret_value;
- *idx = (hsize_t_f)idx_c;
+ ret_value = (int_f)func_ret_value;
+ *idx = (hsize_t_f)idx_c;
- return ret_value;
+ return ret_value;
}
/****if* H5Lf/h5literate_by_name_c
@@ -1036,35 +1030,37 @@ h5literate_c(hid_t_f *group_id, int_f *index_type, int_f *order, hsize_t_f *idx,
* M. Scot Breitenfeld
* August 18, 2008
* SOURCE
-*/
+ */
int_f
-h5literate_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, int_f *index_type, int_f *order, hsize_t_f *idx, H5L_iterate2_t op, void *op_data, hid_t_f *lapl_id)
+h5literate_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, int_f *index_type, int_f *order,
+ hsize_t_f *idx, H5L_iterate2_t op, void *op_data, hid_t_f *lapl_id)
/******/
{
- int_f ret_value = -1; /* Return value */
- herr_t func_ret_value; /* H5Linterate return value */
- hsize_t idx_c = 0;
- char *c_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = -1; /* Return value */
+ herr_t func_ret_value; /* H5Linterate return value */
+ hsize_t idx_c = 0;
+ char * c_name = NULL; /* Buffer to hold C string */
- /*
- * Convert FORTRAN name to C name
- */
- if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
- return ret_value=-1;
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
+ return ret_value = -1;
- idx_c = (hsize_t)*idx;
+ idx_c = (hsize_t)*idx;
- /*
- * Call H5Linterate
- */
+ /*
+ * Call H5Linterate
+ */
- func_ret_value = H5Literate_by_name2((hid_t)*loc_id, c_name,(H5_index_t)*index_type,(H5_iter_order_t)*order,&idx_c,op,op_data,(hid_t)*lapl_id);
+ func_ret_value = H5Literate_by_name2((hid_t)*loc_id, c_name, (H5_index_t)*index_type,
+ (H5_iter_order_t)*order, &idx_c, op, op_data, (hid_t)*lapl_id);
- ret_value = (int_f)func_ret_value;
- *idx = (hsize_t_f)idx_c;
+ ret_value = (int_f)func_ret_value;
+ *idx = (hsize_t_f)idx_c;
- if(c_name) HDfree(c_name);
+ if (c_name)
+ HDfree(c_name);
- return ret_value;
+ return ret_value;
}
-
diff --git a/fortran/src/H5Of.c b/fortran/src/H5Of.c
index edbfcbe..36dbbac 100644
--- a/fortran/src/H5Of.c
+++ b/fortran/src/H5Of.c
@@ -17,76 +17,75 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include "H5f90.h"
#include "H5Eprivate.h"
-int_f
-fill_h5o_info_t_f(H5O_info2_t Oinfo, H5O_info_t_f *object_info);
+int_f fill_h5o_info_t_f(H5O_info2_t Oinfo, H5O_info_t_f *object_info);
int_f
-fill_h5o_info_t_f(H5O_info2_t Oinfo, H5O_info_t_f *object_info) {
-
- /* This function does not used the field parameter because we want
- * this function to fill the unfilled fields with C's default values.
- */
-
- struct tm *ts;
-
- object_info->fileno = Oinfo.fileno;
- object_info->token = Oinfo.token;
-
- object_info->type = (int_f)Oinfo.type;
- object_info->rc = (int_f)Oinfo.rc;
-
- ts = HDgmtime(&Oinfo.atime);
-
- object_info->atime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */
- object_info->atime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */
- object_info->atime[2] = (int_f)ts->tm_mday;
- object_info->atime[3] = 0; /* time is expressed as UTC (or GMT timezone) */
- object_info->atime[4] = (int_f)ts->tm_hour;
- object_info->atime[5] = (int_f)ts->tm_min;
- object_info->atime[6] = (int_f)ts->tm_sec;
- object_info->atime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */
-
- ts = HDgmtime(&Oinfo.btime);
-
- object_info->btime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */
- object_info->btime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */
- object_info->btime[2] = (int_f)ts->tm_mday;
- object_info->btime[3] = 0; /* time is expressed as UTC (or GMT timezone) */
- object_info->btime[4] = (int_f)ts->tm_hour;
- object_info->btime[5] = (int_f)ts->tm_min;
- object_info->btime[6] = (int_f)ts->tm_sec;
- object_info->btime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */
-
- ts = HDgmtime(&Oinfo.ctime);
-
- object_info->ctime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */
- object_info->ctime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */
- object_info->ctime[2] = (int_f)ts->tm_mday;
- object_info->ctime[3] = 0; /* time is expressed as UTC (or GMT timezone) */
- object_info->ctime[4] = (int_f)ts->tm_hour;
- object_info->ctime[5] = (int_f)ts->tm_min;
- object_info->ctime[6] = (int_f)ts->tm_sec;
- object_info->ctime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */
-
- ts = HDgmtime(&Oinfo.mtime);
-
- object_info->mtime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */
- object_info->mtime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */
- object_info->mtime[2] = (int_f)ts->tm_mday;
- object_info->mtime[3] = 0; /* time is expressed as UTC (or GMT timezone) */
- object_info->mtime[4] = (int_f)ts->tm_hour;
- object_info->mtime[5] = (int_f)ts->tm_min;
- object_info->mtime[6] = (int_f)ts->tm_sec;
- object_info->mtime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */
-
- object_info->num_attrs = (hsize_t_f)Oinfo.num_attrs;
-
- return 0;
+fill_h5o_info_t_f(H5O_info2_t Oinfo, H5O_info_t_f *object_info)
+{
+ /* This function does not used the field parameter because we want
+ * this function to fill the unfilled fields with C's default values.
+ */
+
+ struct tm *ts;
+
+ object_info->fileno = Oinfo.fileno;
+ object_info->token = Oinfo.token;
+
+ object_info->type = (int_f)Oinfo.type;
+ object_info->rc = (int_f)Oinfo.rc;
+
+ ts = HDgmtime(&Oinfo.atime);
+
+ object_info->atime[0] = (int_f)ts->tm_year + 1900; /* year starts at 1900 */
+ object_info->atime[1] = (int_f)ts->tm_mon + 1; /* month starts at 0 in C */
+ object_info->atime[2] = (int_f)ts->tm_mday;
+ object_info->atime[3] = 0; /* time is expressed as UTC (or GMT timezone) */
+ object_info->atime[4] = (int_f)ts->tm_hour;
+ object_info->atime[5] = (int_f)ts->tm_min;
+ object_info->atime[6] = (int_f)ts->tm_sec;
+ object_info->atime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */
+
+ ts = HDgmtime(&Oinfo.btime);
+
+ object_info->btime[0] = (int_f)ts->tm_year + 1900; /* year starts at 1900 */
+ object_info->btime[1] = (int_f)ts->tm_mon + 1; /* month starts at 0 in C */
+ object_info->btime[2] = (int_f)ts->tm_mday;
+ object_info->btime[3] = 0; /* time is expressed as UTC (or GMT timezone) */
+ object_info->btime[4] = (int_f)ts->tm_hour;
+ object_info->btime[5] = (int_f)ts->tm_min;
+ object_info->btime[6] = (int_f)ts->tm_sec;
+ object_info->btime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */
+
+ ts = HDgmtime(&Oinfo.ctime);
+
+ object_info->ctime[0] = (int_f)ts->tm_year + 1900; /* year starts at 1900 */
+ object_info->ctime[1] = (int_f)ts->tm_mon + 1; /* month starts at 0 in C */
+ object_info->ctime[2] = (int_f)ts->tm_mday;
+ object_info->ctime[3] = 0; /* time is expressed as UTC (or GMT timezone) */
+ object_info->ctime[4] = (int_f)ts->tm_hour;
+ object_info->ctime[5] = (int_f)ts->tm_min;
+ object_info->ctime[6] = (int_f)ts->tm_sec;
+ object_info->ctime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */
+
+ ts = HDgmtime(&Oinfo.mtime);
+
+ object_info->mtime[0] = (int_f)ts->tm_year + 1900; /* year starts at 1900 */
+ object_info->mtime[1] = (int_f)ts->tm_mon + 1; /* month starts at 0 in C */
+ object_info->mtime[2] = (int_f)ts->tm_mday;
+ object_info->mtime[3] = 0; /* time is expressed as UTC (or GMT timezone) */
+ object_info->mtime[4] = (int_f)ts->tm_hour;
+ object_info->mtime[5] = (int_f)ts->tm_min;
+ object_info->mtime[6] = (int_f)ts->tm_sec;
+ object_info->mtime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */
+
+ object_info->num_attrs = (hsize_t_f)Oinfo.num_attrs;
+
+ return 0;
}
/****if* H5Of/h5olink_c
@@ -107,32 +106,31 @@ fill_h5o_info_t_f(H5O_info2_t Oinfo, H5O_info_t_f *object_info) {
* M. Scot Breitenfeld
* April 21, 2008
* SOURCE
-*/
+ */
int_f
-h5olink_c (hid_t_f *object_id, hid_t_f *new_loc_id, _fcd name, size_t_f *namelen,
- hid_t_f *lcpl_id, hid_t_f *lapl_id)
+h5olink_c(hid_t_f *object_id, hid_t_f *new_loc_id, _fcd name, size_t_f *namelen, hid_t_f *lcpl_id,
+ hid_t_f *lapl_id)
/******/
{
- char *c_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
-
- /*
- * Convert FORTRAN name to C name
- */
- if( (c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Olink function.
- */
- if((hid_t_f)H5Olink((hid_t)*object_id, (hid_t)*new_loc_id, c_name,
- (hid_t)*lcpl_id, (hid_t)*lapl_id) < 0)
- HGOTO_DONE(FAIL);
-
- done:
- if(c_name)
- HDfree(c_name);
- return ret_value;
+ char *c_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Olink function.
+ */
+ if ((hid_t_f)H5Olink((hid_t)*object_id, (hid_t)*new_loc_id, c_name, (hid_t)*lcpl_id, (hid_t)*lapl_id) < 0)
+ HGOTO_DONE(FAIL);
+
+done:
+ if (c_name)
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Of/h5oopen_c
@@ -153,30 +151,30 @@ h5olink_c (hid_t_f *object_id, hid_t_f *new_loc_id, _fcd name, size_t_f *namelen
* M. Scot Breitenfeld
* April 18, 2008
* SOURCE
-*/
+ */
int_f
-h5oopen_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, hid_t_f *obj_id)
+h5oopen_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, hid_t_f *obj_id)
/******/
{
- char *c_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
-
- /*
- * Convert FORTRAN name to C name
- */
- if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Oopen function.
- */
- if((*obj_id = (hid_t_f)H5Oopen((hid_t)*loc_id, c_name, (hid_t)*lapl_id)) < 0)
- HGOTO_DONE(FAIL);
-
- done:
- if(c_name)
- HDfree(c_name);
- return ret_value;
+ char *c_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Oopen function.
+ */
+ if ((*obj_id = (hid_t_f)H5Oopen((hid_t)*loc_id, c_name, (hid_t)*lapl_id)) < 0)
+ HGOTO_DONE(FAIL);
+
+done:
+ if (c_name)
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Of/h5oclose_c
* NAME
@@ -191,18 +189,18 @@ h5oopen_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, hid_
* M. Scot Breitenfeld
* December 17, 2008
* SOURCE
-*/
+ */
int_f
-h5oclose_c ( hid_t_f *object_id )
+h5oclose_c(hid_t_f *object_id)
/******/
{
- int_f ret_value=0; /* Return value */
+ int_f ret_value = 0; /* Return value */
- if (H5Oclose((hid_t)*object_id) < 0)
- HGOTO_DONE(FAIL);
+ if (H5Oclose((hid_t)*object_id) < 0)
+ HGOTO_DONE(FAIL);
- done:
- return ret_value;
+done:
+ return ret_value;
}
/****if* H5Of/h5ovisit_c
@@ -228,24 +226,25 @@ h5oclose_c ( hid_t_f *object_id )
* M. Scot Breitenfeld
* November 19, 2008
* SOURCE
-*/
+ */
int_f
-h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate2_t op,
- void *op_data, int_f *fields )
+h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate2_t op, void *op_data,
+ int_f *fields)
/******/
{
- int_f ret_value = -1; /* Return value */
- herr_t func_ret_value; /* H5Linterate return value */
+ int_f ret_value = -1; /* Return value */
+ herr_t func_ret_value; /* H5Linterate return value */
- /*
- * Call H5Ovisit
- */
+ /*
+ * Call H5Ovisit
+ */
- func_ret_value = H5Ovisit3( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data, (unsigned)*fields);
+ func_ret_value = H5Ovisit3((hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op,
+ op_data, (unsigned)*fields);
- ret_value = (int_f)func_ret_value;
+ ret_value = (int_f)func_ret_value;
- return ret_value;
+ return ret_value;
}
/****if* H5Of/h5oopen_by_token_c
@@ -266,21 +265,21 @@ h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate2_t op
* M. Scot Breitenfeld
* September 14, 2009
* SOURCE
-*/
+ */
int_f
h5oopen_by_token_c(hid_t_f *loc_id, H5O_token_t *token, hid_t_f *obj_id)
/******/
{
- int_f ret_value = 0; /* Return value */
+ int_f ret_value = 0; /* Return value */
- /*
- * Call H5Oopen_by_token function.
- */
- if((*obj_id = (hid_t_f)H5Oopen_by_token((hid_t)*loc_id, *token)) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Oopen_by_token function.
+ */
+ if ((*obj_id = (hid_t_f)H5Oopen_by_token((hid_t)*loc_id, *token)) < 0)
+ HGOTO_DONE(FAIL);
- done:
- return ret_value;
+done:
+ return ret_value;
}
/****if* H5Of/H5Oget_info_by_name_c
@@ -303,35 +302,34 @@ h5oopen_by_token_c(hid_t_f *loc_id, H5O_token_t *token, hid_t_f *obj_id)
* M. Scot Breitenfeld
* December 1, 2008
* SOURCE
-*/
+ */
int_f
-h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id,
- H5O_info_t_f *object_info, int_f *fields)
+h5oget_info_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id,
+ H5O_info_t_f *object_info, int_f *fields)
/******/
{
- char *c_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
- H5O_info2_t Oinfo;
-
- /*
- * Convert FORTRAN name to C name
- */
- if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Oinfo_by_name function.
- */
- if(H5Oget_info_by_name3((hid_t)*loc_id, c_name,
- &Oinfo, (unsigned)*fields, (hid_t)*lapl_id) < 0)
- HGOTO_DONE(FAIL);
-
- ret_value = fill_h5o_info_t_f(Oinfo, object_info);
-
- done:
- if(c_name)
- HDfree(c_name);
- return ret_value;
+ char * c_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
+ H5O_info2_t Oinfo;
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Oinfo_by_name function.
+ */
+ if (H5Oget_info_by_name3((hid_t)*loc_id, c_name, &Oinfo, (unsigned)*fields, (hid_t)*lapl_id) < 0)
+ HGOTO_DONE(FAIL);
+
+ ret_value = fill_h5o_info_t_f(Oinfo, object_info);
+
+done:
+ if (c_name)
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Of/H5Oget_info_by_idx_c
@@ -354,40 +352,40 @@ h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *l
* M. Scot Breitenfeld
* December 1, 2008
* SOURCE
-*/
+ */
int_f
-h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen,
- int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info, int_f *fields)
+h5oget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, int_f *index_field, int_f *order,
+ hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info, int_f *fields)
/******/
{
- char *c_group_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
- H5O_info2_t Oinfo;
- H5_index_t c_index_field;
- H5_iter_order_t c_order;
-
- /*
- * Convert FORTRAN name to C name
- */
- if((c_group_name = HD5f2cstring( group_name, (size_t)*namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- c_index_field = (H5_index_t)*index_field;
- c_order = (H5_iter_order_t)*order;
-
- /*
- * Call H5Oinfo_by_idx function.
- */
- if(H5Oget_info_by_idx3((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n,
- &Oinfo, (unsigned)*fields, (hid_t)*lapl_id) < 0)
- HGOTO_DONE(FAIL);
-
- ret_value = fill_h5o_info_t_f(Oinfo,object_info);
-
- done:
- if(c_group_name)
- HDfree(c_group_name);
- return ret_value;
+ char * c_group_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
+ H5O_info2_t Oinfo;
+ H5_index_t c_index_field;
+ H5_iter_order_t c_order;
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_group_name = HD5f2cstring(group_name, (size_t)*namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ c_index_field = (H5_index_t)*index_field;
+ c_order = (H5_iter_order_t)*order;
+
+ /*
+ * Call H5Oinfo_by_idx function.
+ */
+ if (H5Oget_info_by_idx3((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, &Oinfo,
+ (unsigned)*fields, (hid_t)*lapl_id) < 0)
+ HGOTO_DONE(FAIL);
+
+ ret_value = fill_h5o_info_t_f(Oinfo, object_info);
+
+done:
+ if (c_group_name)
+ HDfree(c_group_name);
+ return ret_value;
}
/****if* H5Of/H5Oget_info_c
@@ -407,24 +405,24 @@ h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen,
* M. Scot Breitenfeld
* May 16, 2012
* SOURCE
-*/
+ */
int_f
-h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info, int_f *fields)
+h5oget_info_c(hid_t_f *object_id, H5O_info_t_f *object_info, int_f *fields)
/******/
{
- int_f ret_value = 0; /* Return value */
- H5O_info2_t Oinfo;
+ int_f ret_value = 0; /* Return value */
+ H5O_info2_t Oinfo;
- /*
- * Call H5Oinfo_by_name function.
- */
- if(H5Oget_info3((hid_t)*object_id, &Oinfo, (unsigned)*fields) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Oinfo_by_name function.
+ */
+ if (H5Oget_info3((hid_t)*object_id, &Oinfo, (unsigned)*fields) < 0)
+ HGOTO_DONE(FAIL);
- ret_value = fill_h5o_info_t_f(Oinfo,object_info);
+ ret_value = fill_h5o_info_t_f(Oinfo, object_info);
- done:
- return ret_value;
+done:
+ return ret_value;
}
/* ***if* H5Of/H5Ocopy_c
@@ -448,41 +446,39 @@ h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info, int_f *fields)
* M. Scot Breitenfeld
* March 14, 2012
* SOURCE
-*/
+ */
int_f
-h5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len,
- hid_t_f *dst_loc_id, _fcd dst_name, size_t_f *dst_name_len,
- hid_t_f *ocpypl_id, hid_t_f *lcpl_id )
+h5ocopy_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, hid_t_f *dst_loc_id, _fcd dst_name,
+ size_t_f *dst_name_len, hid_t_f *ocpypl_id, hid_t_f *lcpl_id)
/******/
{
- char *c_src_name = NULL; /* Buffer to hold C string */
- char *c_dst_name = NULL; /* Buffer to hold C string */
-
- int_f ret_value = 0; /* Return value */
-
- /*
- * Convert FORTRAN name to C name
- */
- if((c_src_name = HD5f2cstring(src_name, (size_t)*src_name_len)) == NULL)
- HGOTO_DONE(FAIL);
- if((c_dst_name = HD5f2cstring(dst_name, (size_t)*dst_name_len)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Ocopy function.
- */
- if(H5Ocopy( (hid_t)*src_loc_id, c_src_name, (hid_t)*dst_loc_id, c_dst_name,
- (hid_t)*ocpypl_id, (hid_t)*lcpl_id) < 0)
- HGOTO_DONE(FAIL);
-
- done:
- if(c_src_name)
- HDfree(c_src_name);
- if(c_dst_name)
- HDfree(c_dst_name);
-
- return ret_value;
+ char *c_src_name = NULL; /* Buffer to hold C string */
+ char *c_dst_name = NULL; /* Buffer to hold C string */
+
+ int_f ret_value = 0; /* Return value */
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_src_name = HD5f2cstring(src_name, (size_t)*src_name_len)) == NULL)
+ HGOTO_DONE(FAIL);
+ if ((c_dst_name = HD5f2cstring(dst_name, (size_t)*dst_name_len)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Ocopy function.
+ */
+ if (H5Ocopy((hid_t)*src_loc_id, c_src_name, (hid_t)*dst_loc_id, c_dst_name, (hid_t)*ocpypl_id,
+ (hid_t)*lcpl_id) < 0)
+ HGOTO_DONE(FAIL);
+done:
+ if (c_src_name)
+ HDfree(c_src_name);
+ if (c_dst_name)
+ HDfree(c_dst_name);
+
+ return ret_value;
}
/****if* H5Of/h5ovisit_by_name_c
@@ -508,34 +504,34 @@ h5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len,
* M. Scot Breitenfeld
* May 16, 2012
* SOURCE
-*/
+ */
int_f
-h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order,
- H5O_iterate2_t op, void *op_data, hid_t_f *lapl_id, int_f *fields )
+h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order,
+ H5O_iterate2_t op, void *op_data, hid_t_f *lapl_id, int_f *fields)
/******/
{
- int_f ret_value = -1; /* Return value */
- herr_t func_ret_value; /* H5Linterate return value */
- char *c_object_name = NULL; /* Buffer to hold C string */
-
- /*
- * Convert FORTRAN name to C name
- */
- if( (c_object_name = HD5f2cstring(object_name, (size_t)*namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Ovisit_by_name
- */
- func_ret_value = H5Ovisit_by_name3( (hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order,
- op, op_data, (unsigned)*fields, (hid_t)*lapl_id);
- ret_value = (int_f)func_ret_value;
-
- done:
- if(c_object_name)
- HDfree(c_object_name);
- return ret_value;
+ int_f ret_value = -1; /* Return value */
+ herr_t func_ret_value; /* H5Linterate return value */
+ char * c_object_name = NULL; /* Buffer to hold C string */
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_object_name = HD5f2cstring(object_name, (size_t)*namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Ovisit_by_name
+ */
+ func_ret_value =
+ H5Ovisit_by_name3((hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order, op,
+ op_data, (unsigned)*fields, (hid_t)*lapl_id);
+ ret_value = (int_f)func_ret_value;
+done:
+ if (c_object_name)
+ HDfree(c_object_name);
+ return ret_value;
}
/****if* H5Of/h5odecr_refcount_c
@@ -551,21 +547,21 @@ h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f
* M. Scot Breitenfeld
* May 16, 2012
* SOURCE
-*/
+ */
int_f
-h5odecr_refcount_c (hid_t_f *object_id)
+h5odecr_refcount_c(hid_t_f *object_id)
/******/
{
- int_f ret_value = 0; /* Return value */
+ int_f ret_value = 0; /* Return value */
- /*
- * Call H5Odecr_refcount function.
- */
- if((hid_t_f)H5Odecr_refcount((hid_t)*object_id) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Odecr_refcount function.
+ */
+ if ((hid_t_f)H5Odecr_refcount((hid_t)*object_id) < 0)
+ HGOTO_DONE(FAIL);
- done:
- return ret_value;
+done:
+ return ret_value;
}
/****if* H5Of/h5oexists_by_name_c
@@ -585,30 +581,30 @@ h5odecr_refcount_c (hid_t_f *object_id)
* M. Scot Breitenfeld
* May 17, 2012
* SOURCE
-*/
+ */
int_f
-h5oexists_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id)
+h5oexists_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id)
/******/
{
- char *c_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
-
- /*
- * Convert FORTRAN name to C name
- */
- if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Oopen function.
- */
- if((ret_value = (int_f)H5Oexists_by_name((hid_t)*loc_id, c_name, (hid_t)*lapl_id)) < 0)
- HGOTO_DONE(FAIL);
-
- done:
- if(c_name)
- HDfree(c_name);
- return ret_value;
+ char *c_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if ((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Oopen function.
+ */
+ if ((ret_value = (int_f)H5Oexists_by_name((hid_t)*loc_id, c_name, (hid_t)*lapl_id)) < 0)
+ HGOTO_DONE(FAIL);
+
+done:
+ if (c_name)
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Of/h5oincr_refcount_c
@@ -624,21 +620,21 @@ h5oexists_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lap
* M. Scot Breitenfeld
* May 16, 2012
* SOURCE
-*/
+ */
int_f
-h5oincr_refcount_c (hid_t_f *object_id)
+h5oincr_refcount_c(hid_t_f *object_id)
/******/
{
- int_f ret_value = 0; /* Return value */
+ int_f ret_value = 0; /* Return value */
- /*
- * Call H5Oincr_refcount function.
- */
- if((hid_t_f)H5Oincr_refcount((hid_t)*object_id) < 0)
- HGOTO_DONE(FAIL);
+ /*
+ * Call H5Oincr_refcount function.
+ */
+ if ((hid_t_f)H5Oincr_refcount((hid_t)*object_id) < 0)
+ HGOTO_DONE(FAIL);
- done:
- return ret_value;
+done:
+ return ret_value;
}
/****if* H5Of/h5oset_comment_c
@@ -656,30 +652,30 @@ h5oincr_refcount_c (hid_t_f *object_id)
* M. Scot Breitenfeld
* May 17, 2012
* SOURCE
-*/
+ */
int_f
-h5oset_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentlen)
+h5oset_comment_c(hid_t_f *object_id, _fcd comment, size_t_f *commentlen)
/******/
{
- char *c_comment = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
-
- /*
- * Convert FORTRAN string to C string
- */
- if((c_comment = HD5f2cstring(comment, (size_t)*commentlen)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Oset_comment function.
- */
- if((hid_t_f)H5Oset_comment((hid_t)*object_id, c_comment) < 0)
- HGOTO_DONE(FAIL);
-
- done:
- if(c_comment)
- HDfree(c_comment);
- return ret_value;
+ char *c_comment = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
+
+ /*
+ * Convert FORTRAN string to C string
+ */
+ if ((c_comment = HD5f2cstring(comment, (size_t)*commentlen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Oset_comment function.
+ */
+ if ((hid_t_f)H5Oset_comment((hid_t)*object_id, c_comment) < 0)
+ HGOTO_DONE(FAIL);
+
+done:
+ if (c_comment)
+ HDfree(c_comment);
+ return ret_value;
}
/****if* H5Of/h5oset_comment_by_name_c
@@ -701,38 +697,39 @@ h5oset_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentlen)
* M. Scot Breitenfeld
* May 17, 2012
* SOURCE
-*/
+ */
int_f
-h5oset_comment_by_name_c (hid_t_f *object_id, _fcd name, size_t_f *namelen, _fcd comment, size_t_f *commentlen, hid_t_f *lapl_id)
+h5oset_comment_by_name_c(hid_t_f *object_id, _fcd name, size_t_f *namelen, _fcd comment, size_t_f *commentlen,
+ hid_t_f *lapl_id)
/******/
{
- char *c_comment = NULL; /* Buffer to hold C string */
- char *c_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
-
- /*
- * Convert FORTRAN string to C string
- */
- if((c_comment = HD5f2cstring(comment, (size_t)*commentlen)) == NULL)
- HGOTO_DONE(FAIL);
- /*
- * Convert FORTRAN string to C string
- */
- if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- /*
- * Call H5Oset_comment_by_name function.
- */
- if((hid_t_f)H5Oset_comment_by_name((hid_t)*object_id, c_name, c_comment, (hid_t)*lapl_id) < 0)
- HGOTO_DONE(FAIL);
-
- done:
- if(c_name)
- HDfree(c_name);
- if(c_comment)
- HDfree(c_comment);
- return ret_value;
+ char *c_comment = NULL; /* Buffer to hold C string */
+ char *c_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
+
+ /*
+ * Convert FORTRAN string to C string
+ */
+ if ((c_comment = HD5f2cstring(comment, (size_t)*commentlen)) == NULL)
+ HGOTO_DONE(FAIL);
+ /*
+ * Convert FORTRAN string to C string
+ */
+ if ((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ /*
+ * Call H5Oset_comment_by_name function.
+ */
+ if ((hid_t_f)H5Oset_comment_by_name((hid_t)*object_id, c_name, c_comment, (hid_t)*lapl_id) < 0)
+ HGOTO_DONE(FAIL);
+
+done:
+ if (c_name)
+ HDfree(c_name);
+ if (c_comment)
+ HDfree(c_comment);
+ return ret_value;
}
/****if* H5Of/h5oopen_by_idx_c
* NAME
@@ -755,36 +752,37 @@ h5oset_comment_by_name_c (hid_t_f *object_id, _fcd name, size_t_f *namelen, _fc
* M. Scot Breitenfeld
* May 17, 2012
* SOURCE
-*/
+ */
int_f
-h5oopen_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
- int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id)
+h5oopen_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, int_f *index_type, int_f *order,
+ hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id)
/******/
{
- char *c_group_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0;
- H5_index_t c_index_type;
- H5_iter_order_t c_order;
-
- /*
- * Convert FORTRAN string to C string
- */
- if((c_group_name = HD5f2cstring( group_name, (size_t)*group_namelen)) == NULL)
- HGOTO_DONE(FAIL);
-
- c_index_type = (H5_index_t)*index_type;
- c_order = (H5_iter_order_t)*order;
-
- /*
- * Call H5Oopen_by_idx function.
- */
- if((*obj_id =(hid_t_f)H5Oopen_by_idx((hid_t)*loc_id, c_group_name, c_index_type, c_order, (hsize_t)*n, (hid_t)*lapl_id)) < 0)
- HGOTO_DONE(FAIL);
-
- done:
- if(c_group_name)
- HDfree(c_group_name);
- return ret_value;
+ char * c_group_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0;
+ H5_index_t c_index_type;
+ H5_iter_order_t c_order;
+
+ /*
+ * Convert FORTRAN string to C string
+ */
+ if ((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL)
+ HGOTO_DONE(FAIL);
+
+ c_index_type = (H5_index_t)*index_type;
+ c_order = (H5_iter_order_t)*order;
+
+ /*
+ * Call H5Oopen_by_idx function.
+ */
+ if ((*obj_id = (hid_t_f)H5Oopen_by_idx((hid_t)*loc_id, c_group_name, c_index_type, c_order, (hsize_t)*n,
+ (hid_t)*lapl_id)) < 0)
+ HGOTO_DONE(FAIL);
+
+done:
+ if (c_group_name)
+ HDfree(c_group_name);
+ return ret_value;
}
/****if* H5Of/h5oget_comment_c
@@ -804,43 +802,43 @@ h5oopen_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
* M. Scot Breitenfeld
* June 24, 2012
* SOURCE
-*/
+ */
int_f
-h5oget_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentsize, hssize_t_f *bufsize)
+h5oget_comment_c(hid_t_f *object_id, _fcd comment, size_t_f *commentsize, hssize_t_f *bufsize)
/******/
{
- char *c_comment = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
- size_t c_commentsize;
+ char * c_comment = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
+ size_t c_commentsize;
- c_commentsize = (size_t)*commentsize + 1;
+ c_commentsize = (size_t)*commentsize + 1;
- /*
- * Allocate buffer to hold comment name
- */
+ /*
+ * Allocate buffer to hold comment name
+ */
- if(NULL == (c_comment = (char *)HDmalloc(c_commentsize)))
- HGOTO_DONE(FAIL);
+ if (NULL == (c_comment = (char *)HDmalloc(c_commentsize)))
+ HGOTO_DONE(FAIL);
- /*
- * Call H5Oget_comment function.
- */
+ /*
+ * Call H5Oget_comment function.
+ */
- if((*bufsize = (hssize_t_f)H5Oget_comment((hid_t)*object_id, c_comment, (size_t)*commentsize)) < 0)
- HGOTO_DONE(FAIL);
+ if ((*bufsize = (hssize_t_f)H5Oget_comment((hid_t)*object_id, c_comment, (size_t)*commentsize)) < 0)
+ HGOTO_DONE(FAIL);
- /*
- * Convert C name to FORTRAN and place it in the given buffer
- */
- if(c_comment)
- HD5packFstring(c_comment, _fcdtocp(comment), c_commentsize - 1);
- return ret_value;
+ /*
+ * Convert C name to FORTRAN and place it in the given buffer
+ */
+ if (c_comment)
+ HD5packFstring(c_comment, _fcdtocp(comment), c_commentsize - 1);
+ return ret_value;
- done:
- if(c_comment)
- HDfree(c_comment);
+done:
+ if (c_comment)
+ HDfree(c_comment);
- return ret_value;
+ return ret_value;
}
/****if* H5Of/h5oget_comment_by_name_c
@@ -860,62 +858,63 @@ h5oget_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentsize, hssi
* M. Scot Breitenfeld
* July 6, 2012
* SOURCE
-*/
+ */
int_f
-h5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size,
- _fcd comment, size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id)
+h5oget_comment_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *name_size, _fcd comment, size_t_f *commentsize,
+ size_t_f *bufsize, hid_t_f *lapl_id)
/******/
{
- char *c_comment = NULL; /* Buffer to hold C string */
- char *c_name = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
- ssize_t c_bufsize;
- size_t c_commentsize;
+ char * c_comment = NULL; /* Buffer to hold C string */
+ char * c_name = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
+ ssize_t c_bufsize;
+ size_t c_commentsize;
- /*
- * Convert FORTRAN string to C string
- */
- if((c_name = HD5f2cstring(name, (size_t)*name_size)) == NULL)
- HGOTO_DONE(FAIL);
+ /*
+ * Convert FORTRAN string to C string
+ */
+ if ((c_name = HD5f2cstring(name, (size_t)*name_size)) == NULL)
+ HGOTO_DONE(FAIL);
- c_commentsize = (size_t)*commentsize + 1;
+ c_commentsize = (size_t)*commentsize + 1;
- /*
- * Allocate buffer to hold comment name
- */
+ /*
+ * Allocate buffer to hold comment name
+ */
- if(NULL == (c_comment = (char *)HDmalloc(c_commentsize)))
- HGOTO_DONE(FAIL);
+ if (NULL == (c_comment = (char *)HDmalloc(c_commentsize)))
+ HGOTO_DONE(FAIL);
- /*
- * Call H5Oget_comment_by_name function.
- */
+ /*
+ * Call H5Oget_comment_by_name function.
+ */
- if((c_bufsize = H5Oget_comment_by_name((hid_t)*loc_id, c_name, c_comment, (size_t)*commentsize,(hid_t)*lapl_id )) < 0)
- HGOTO_DONE(FAIL);
+ if ((c_bufsize = H5Oget_comment_by_name((hid_t)*loc_id, c_name, c_comment, (size_t)*commentsize,
+ (hid_t)*lapl_id)) < 0)
+ HGOTO_DONE(FAIL);
- if(c_name)
- HDfree(c_name);
+ if (c_name)
+ HDfree(c_name);
- *bufsize = (size_t_f)c_bufsize;
+ *bufsize = (size_t_f)c_bufsize;
- /*
- * Convert C name to FORTRAN and place it in the given buffer
- */
- if(c_comment) {
- HD5packFstring(c_comment, _fcdtocp(comment), c_commentsize - 1);
- HDfree(c_comment);
- }
+ /*
+ * Convert C name to FORTRAN and place it in the given buffer
+ */
+ if (c_comment) {
+ HD5packFstring(c_comment, _fcdtocp(comment), c_commentsize - 1);
+ HDfree(c_comment);
+ }
- return ret_value;
+ return ret_value;
- done:
- if(c_comment)
- HDfree(c_comment);
- if(c_name)
- HDfree(c_name);
+done:
+ if (c_comment)
+ HDfree(c_comment);
+ if (c_name)
+ HDfree(c_name);
- return ret_value;
+ return ret_value;
}
/****if* H5Of/h5otoken_cmp_c
@@ -934,24 +933,22 @@ h5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size,
* Quincey Koziol
* January 10, 2019
* SOURCE
-*/
+ */
int_f
-h5otoken_cmp_c(hid_t_f *loc_id, H5O_token_t *token1, H5O_token_t *token2,
- int_f *cmp_value_f)
+h5otoken_cmp_c(hid_t_f *loc_id, H5O_token_t *token1, H5O_token_t *token2, int_f *cmp_value_f)
/******/
{
- int cmp_value; /* Token comparison result */
- int_f ret_value = 0; /* Return value */
+ int cmp_value; /* Token comparison result */
+ int_f ret_value = 0; /* Return value */
- /* Call H5Otoken_cmp function */
- cmp_value = 0;
- if(H5Otoken_cmp((hid_t)*loc_id, token1, token2, &cmp_value) < 0)
- HGOTO_DONE(FAIL);
+ /* Call H5Otoken_cmp function */
+ cmp_value = 0;
+ if (H5Otoken_cmp((hid_t)*loc_id, token1, token2, &cmp_value) < 0)
+ HGOTO_DONE(FAIL);
- /* Set the comparison value to return */
- *cmp_value_f = cmp_value;
+ /* Set the comparison value to return */
+ *cmp_value_f = cmp_value;
done:
- return ret_value;
+ return ret_value;
}
-
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c
index e65e60f..d52f537 100644
--- a/fortran/src/H5Pf.c
+++ b/fortran/src/H5Pf.c
@@ -17,7 +17,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include "H5f90.h"
#include "H5Eprivate.h"
@@ -55,17 +55,17 @@
* Wednesday, October 9, 2002
*
* SOURCE
-*/
+ */
int_f
-h5pcreate_c ( hid_t_f *cls, hid_t_f *prp_id )
+h5pcreate_c(hid_t_f *cls, hid_t_f *prp_id)
/******/
{
hid_t c_prp_id;
int_f ret_value = 0;
c_prp_id = H5Pcreate((hid_t)*cls);
- if(c_prp_id < 0)
+ if (c_prp_id < 0)
HGOTO_DONE(FAIL)
*prp_id = (hid_t_f)c_prp_id;
@@ -88,21 +88,20 @@ done:
* Saturday, August 14, 1999
*
* SOURCE
-*/
+ */
int_f
-h5pclose_c ( hid_t_f *prp_id )
+h5pclose_c(hid_t_f *prp_id)
/******/
{
int_f ret_value = 0;
- if(H5Pclose((hid_t)*prp_id) < 0)
+ if (H5Pclose((hid_t)*prp_id) < 0)
ret_value = -1;
return ret_value;
}
-
/****if* H5Pf/h5pcopy_c
* NAME
* h5pcopy_c
@@ -119,16 +118,16 @@ h5pclose_c ( hid_t_f *prp_id )
* Saturday, August 14, 1999
*
* SOURCE
-*/
+ */
int_f
-h5pcopy_c ( hid_t_f *prp_id , hid_t_f *new_prp_id)
+h5pcopy_c(hid_t_f *prp_id, hid_t_f *new_prp_id)
/******/
{
hid_t c_new_prp_id;
int_f ret_value = 0;
c_new_prp_id = H5Pcopy((hid_t)*prp_id);
- if(c_new_prp_id < 0)
+ if (c_new_prp_id < 0)
HGOTO_DONE(FAIL)
*new_prp_id = (hid_t_f)c_new_prp_id;
@@ -154,16 +153,16 @@ done:
* Monday, September 30, 2002
*
* SOURCE
-*/
+ */
int_f
-h5pequal_c ( hid_t_f *plist1_id , hid_t_f *plist2_id, int_f * c_flag)
+h5pequal_c(hid_t_f *plist1_id, hid_t_f *plist2_id, int_f *c_flag)
/******/
{
htri_t c_c_flag;
- int_f ret_value = 0;
+ int_f ret_value = 0;
c_c_flag = H5Pequal((hid_t)*plist1_id, (hid_t)*plist2_id);
- if(c_c_flag < 0)
+ if (c_c_flag < 0)
HGOTO_DONE(FAIL)
*c_flag = (int_f)c_c_flag;
@@ -172,7 +171,6 @@ done:
return ret_value;
}
-
/****if* H5Pf/h5pget_class_c
* NAME
* h5pget_class_c
@@ -188,17 +186,17 @@ done:
* Elena Pourmal
* Saturday, August 14, 1999
* SOURCE
-*/
+ */
int_f
-h5pget_class_c ( hid_t_f *prp_id , hid_t_f *classtype)
+h5pget_class_c(hid_t_f *prp_id, hid_t_f *classtype)
/******/
{
hid_t c_classtype;
int_f ret_value = 0;
- if( (c_classtype = H5Pget_class((hid_t)*prp_id)) < 0)
- HGOTO_DONE(FAIL)
+ if ((c_classtype = H5Pget_class((hid_t)*prp_id)) < 0)
+ HGOTO_DONE(FAIL)
*classtype = (hid_t_f)c_classtype;
@@ -221,25 +219,26 @@ done:
* Elena Pourmal
* Thursday, February 17, 2000
* SOURCE
-*/
+ */
int_f
-h5pset_preserve_c ( hid_t_f *prp_id , int_f *flag)
+h5pset_preserve_c(hid_t_f *prp_id, int_f *flag)
/******/
{
- int ret_value = 0;
- hid_t c_prp_id;
- herr_t status;
- hbool_t c_flag = 0;
+ int ret_value = 0;
+ hid_t c_prp_id;
+ herr_t status;
+ hbool_t c_flag = 0;
- if (*flag > 0) c_flag = 1;
- c_prp_id = (hid_t)*prp_id;
- status = H5Pset_preserve(c_prp_id, c_flag);
- if ( status < 0 ) ret_value = -1;
- return ret_value;
+ if (*flag > 0)
+ c_flag = 1;
+ c_prp_id = (hid_t)*prp_id;
+ status = H5Pset_preserve(c_prp_id, c_flag);
+ if (status < 0)
+ ret_value = -1;
+ return ret_value;
}
-
/****if* H5Pf/h5pget_preserve_c
* NAME
* h5pget_preserve_c
@@ -256,21 +255,22 @@ h5pset_preserve_c ( hid_t_f *prp_id , int_f *flag)
* Elena Pourmal
* Thursday, February 17, 2000
* SOURCE
-*/
+ */
int_f
-h5pget_preserve_c ( hid_t_f *prp_id , int_f *flag)
+h5pget_preserve_c(hid_t_f *prp_id, int_f *flag)
/******/
{
- int ret_value = 0;
- hid_t c_prp_id;
- int c_flag;
+ int ret_value = 0;
+ hid_t c_prp_id;
+ int c_flag;
- c_prp_id = (hid_t)*prp_id;
- c_flag = H5Pget_preserve(c_prp_id);
- if ( c_flag < 0 ) ret_value = -1;
- *flag = (int_f)c_flag;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ c_flag = H5Pget_preserve(c_prp_id);
+ if (c_flag < 0)
+ ret_value = -1;
+ *flag = (int_f)c_flag;
+ return ret_value;
}
/****if* H5Pf/h5pset_deflate_c
@@ -287,26 +287,25 @@ h5pget_preserve_c ( hid_t_f *prp_id , int_f *flag)
* Elena Pourmal
* Saturday, August 14, 1999
* SOURCE
-*/
+ */
int_f
-h5pset_deflate_c ( hid_t_f *prp_id , int_f *level)
+h5pset_deflate_c(hid_t_f *prp_id, int_f *level)
/******/
{
- int ret_value = 0;
- hid_t c_prp_id;
- unsigned c_level;
- herr_t status;
+ int ret_value = 0;
+ hid_t c_prp_id;
+ unsigned c_level;
+ herr_t status;
- c_prp_id = (hid_t)*prp_id;
- c_level = (unsigned)*level;
- status = H5Pset_deflate(c_prp_id, c_level);
- if ( status < 0 ) ret_value = -1;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ c_level = (unsigned)*level;
+ status = H5Pset_deflate(c_prp_id, c_level);
+ if (status < 0)
+ ret_value = -1;
+ return ret_value;
}
-
-
/****if* H5Pf/h5pset_chunk_c
* NAME
* h5pset_chunk_c
@@ -323,34 +322,34 @@ h5pset_deflate_c ( hid_t_f *prp_id , int_f *level)
* AUTHOR
* Elena Pourmal
* SOURCE
-*/
+ */
int_f
-h5pset_chunk_c ( hid_t_f *prp_id, int_f *rank, hsize_t_f *dims )
+h5pset_chunk_c(hid_t_f *prp_id, int_f *rank, hsize_t_f *dims)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id = (hid_t)*prp_id;
- int c_rank = (int)*rank;
- hsize_t c_dims[H5S_MAX_RANK];
- herr_t status;
- int i;
+ int ret_value = -1;
+ hid_t c_prp_id = (hid_t)*prp_id;
+ int c_rank = (int)*rank;
+ hsize_t c_dims[H5S_MAX_RANK];
+ herr_t status;
+ int i;
- /*
- * Transpose dimension arrays because of C-FORTRAN storage order
- */
- for (i = 0; i < c_rank ; i++)
- c_dims[i] = (hsize_t)dims[c_rank - i - 1];
+ /*
+ * Transpose dimension arrays because of C-FORTRAN storage order
+ */
+ for (i = 0; i < c_rank; i++)
+ c_dims[i] = (hsize_t)dims[c_rank - i - 1];
- status = H5Pset_chunk(c_prp_id, c_rank, c_dims);
- if (status < 0) goto DONE;
- ret_value = 0;
+ status = H5Pset_chunk(c_prp_id, c_rank, c_dims);
+ if (status < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- return ret_value;
+ return ret_value;
}
-
/****if* H5Pf/h5pget_chunk_c
* NAME
* h5pget_chunk_c
@@ -367,29 +366,30 @@ DONE:
* AUTHOR
* Elena Pourmal
* SOURCE
-*/
+ */
int_f
-h5pget_chunk_c ( hid_t_f *prp_id, int_f *max_rank, hsize_t_f *dims )
+h5pget_chunk_c(hid_t_f *prp_id, int_f *max_rank, hsize_t_f *dims)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id = (hid_t)*prp_id;
- hsize_t c_dims[H5S_MAX_RANK];
- int rank;
- int c_max_rank = (int)*max_rank;
- int i;
+ int ret_value = -1;
+ hid_t c_prp_id = (hid_t)*prp_id;
+ hsize_t c_dims[H5S_MAX_RANK];
+ int rank;
+ int c_max_rank = (int)*max_rank;
+ int i;
- rank = H5Pget_chunk(c_prp_id, c_max_rank, c_dims);
+ rank = H5Pget_chunk(c_prp_id, c_max_rank, c_dims);
- /*
- * Transpose dimension arrays because of C-FORTRAN storage order
- */
- for (i = 0; i < c_max_rank ; i++)
- dims[c_max_rank - i - 1] = (hsize_t_f)c_dims[i];
- if (rank < 0) return ret_value;
- ret_value = (int_f)rank;
- return ret_value;
+ /*
+ * Transpose dimension arrays because of C-FORTRAN storage order
+ */
+ for (i = 0; i < c_max_rank; i++)
+ dims[c_max_rank - i - 1] = (hsize_t_f)c_dims[i];
+ if (rank < 0)
+ return ret_value;
+ ret_value = (int_f)rank;
+ return ret_value;
}
/****if* H5Pf/h5pset_fill_value_c
@@ -407,26 +407,27 @@ h5pget_chunk_c ( hid_t_f *prp_id, int_f *max_rank, hsize_t_f *dims )
* Elena Pourmal
* Saturday, August 14, 1999
* SOURCE
-*/
+ */
int_f
-h5pset_fill_value_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue)
+h5pset_fill_value_c(hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- hid_t c_type_id;
- herr_t ret;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ hid_t c_type_id;
+ herr_t ret;
- /*
- * Call H5Pset_fill_value function.
- */
- c_prp_id = (hid_t)*prp_id;
- c_type_id = (hid_t)*type_id;
- ret = H5Pset_fill_value(c_prp_id, c_type_id, fillvalue);
+ /*
+ * Call H5Pset_fill_value function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ c_type_id = (hid_t)*type_id;
+ ret = H5Pset_fill_value(c_prp_id, c_type_id, fillvalue);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_fill_value_c
@@ -444,26 +445,27 @@ h5pset_fill_value_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue)
* Elena Pourmal
* Saturday, August 14, 1999
* SOURCE
-*/
+ */
int_f
-h5pget_fill_value_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue)
+h5pget_fill_value_c(hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- hid_t c_type_id;
- herr_t ret;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ hid_t c_type_id;
+ herr_t ret;
- /*
- * Call H5Pget_fill_value function.
- */
- c_prp_id = (hid_t)*prp_id;
- c_type_id = (hid_t)*type_id;
- ret = H5Pget_fill_value(c_prp_id, c_type_id, fillvalue);
+ /*
+ * Call H5Pget_fill_value function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ c_type_id = (hid_t)*type_id;
+ ret = H5Pget_fill_value(c_prp_id, c_type_id, fillvalue);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_version_c
@@ -487,45 +489,46 @@ h5pget_fill_value_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue)
* HISTORY
* Removed extra length parameters EP 7/6/00
* SOURCE
-*/
+ */
#ifdef H5_NO_DEPRECATED_SYMBOLS
int_f
-h5pget_version_c (hid_t_f H5_ATTR_UNUSED *prp_id, int_f * boot,int_f * freelist, int_f * stab, int_f *shhdr)
+h5pget_version_c(hid_t_f H5_ATTR_UNUSED *prp_id, int_f *boot, int_f *freelist, int_f *stab, int_f *shhdr)
/******/
{
- /*
- * Fill in fake values [since we need a file ID to call H5Fget_info :-( -QAK ]
- */
- *boot = (int_f)0;
- *freelist = (int_f)0;
- *stab = (int_f)0;
- *shhdr = (int_f)0;
+ /*
+ * Fill in fake values [since we need a file ID to call H5Fget_info :-( -QAK ]
+ */
+ *boot = (int_f)0;
+ *freelist = (int_f)0;
+ *stab = (int_f)0;
+ *shhdr = (int_f)0;
- return 0;
+ return 0;
}
-#else /* H5_NO_DEPRECATED_SYMBOLS */
+#else /* H5_NO_DEPRECATED_SYMBOLS */
int_f
-h5pget_version_c (hid_t_f *prp_id, int_f * boot,int_f * freelist, int_f * stab, int_f *shhdr)
+h5pget_version_c(hid_t_f *prp_id, int_f *boot, int_f *freelist, int_f *stab, int_f *shhdr)
/******/
{
- herr_t ret;
- unsigned c_boot;
- unsigned c_freelist;
- unsigned c_stab;
- unsigned c_shhdr;
+ herr_t ret;
+ unsigned c_boot;
+ unsigned c_freelist;
+ unsigned c_stab;
+ unsigned c_shhdr;
- /*
- * Call H5Pget_version function.
- */
- ret = H5Pget_version((hid_t)*prp_id, &c_boot, &c_freelist, &c_stab, &c_shhdr);
- if (ret < 0) return -1;
+ /*
+ * Call H5Pget_version function.
+ */
+ ret = H5Pget_version((hid_t)*prp_id, &c_boot, &c_freelist, &c_stab, &c_shhdr);
+ if (ret < 0)
+ return -1;
- *boot = (int_f)c_boot;
- *freelist = (int_f)c_freelist;
- *stab = (int_f)c_stab;
- *shhdr = (int_f)c_shhdr;
+ *boot = (int_f)c_boot;
+ *freelist = (int_f)c_freelist;
+ *stab = (int_f)c_stab;
+ *shhdr = (int_f)c_shhdr;
- return 0;
+ return 0;
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -544,27 +547,28 @@ h5pget_version_c (hid_t_f *prp_id, int_f * boot,int_f * freelist, int_f * stab,
* Xiangyang Su
* Wednesday, February 23, 2000
* SOURCE
-*/
+ */
int_f
-h5pget_userblock_c (hid_t_f *prp_id, hsize_t_f * size)
+h5pget_userblock_c(hid_t_f *prp_id, hsize_t_f *size)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- hsize_t c_size;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ hsize_t c_size;
- /*
- * Call H5Pget_userblock function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pget_userblock(c_prp_id, &c_size);
- if (ret < 0) return ret_value;
+ /*
+ * Call H5Pget_userblock function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pget_userblock(c_prp_id, &c_size);
+ if (ret < 0)
+ return ret_value;
- *size = (hsize_t_f)c_size;
- ret_value = 0;
+ *size = (hsize_t_f)c_size;
+ ret_value = 0;
- return ret_value;
+ return ret_value;
}
/****if* H5Pf/h5pset_userblock_c
@@ -582,26 +586,27 @@ h5pget_userblock_c (hid_t_f *prp_id, hsize_t_f * size)
* Xiangyang Su
* Wednesday, February 23, 2000
* SOURCE
-*/
+ */
int_f
-h5pset_userblock_c (hid_t_f *prp_id, hsize_t_f * size)
+h5pset_userblock_c(hid_t_f *prp_id, hsize_t_f *size)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- hsize_t c_size;
- c_size = (hsize_t)*size;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ hsize_t c_size;
+ c_size = (hsize_t)*size;
- /*
- * Call H5Pset_userblock function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pset_userblock(c_prp_id, c_size);
+ /*
+ * Call H5Pset_userblock function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pset_userblock(c_prp_id, c_size);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_sizes_c
@@ -622,29 +627,30 @@ h5pset_userblock_c (hid_t_f *prp_id, hsize_t_f * size)
* HISTORY
* Deleted extra length parameters. EP 6/7/00
* SOURCE
-*/
+ */
int_f
-h5pget_sizes_c (hid_t_f *prp_id, size_t_f * sizeof_addr, size_t_f * sizeof_size)
+h5pget_sizes_c(hid_t_f *prp_id, size_t_f *sizeof_addr, size_t_f *sizeof_size)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- size_t c_sizeof_addr;
- size_t c_sizeof_size;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ size_t c_sizeof_addr;
+ size_t c_sizeof_size;
- /*
- * Call H5Pget_sizes function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pget_sizes(c_prp_id, &c_sizeof_addr, &c_sizeof_size);
- if (ret < 0) return ret_value;
+ /*
+ * Call H5Pget_sizes function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pget_sizes(c_prp_id, &c_sizeof_addr, &c_sizeof_size);
+ if (ret < 0)
+ return ret_value;
- *sizeof_addr = (size_t_f)c_sizeof_addr;
- *sizeof_size = (size_t_f)c_sizeof_size;
- ret_value = 0;
+ *sizeof_addr = (size_t_f)c_sizeof_addr;
+ *sizeof_size = (size_t_f)c_sizeof_size;
+ ret_value = 0;
- return ret_value;
+ return ret_value;
}
/****if* H5Pf/h5pset_sizes_c
@@ -664,27 +670,28 @@ h5pget_sizes_c (hid_t_f *prp_id, size_t_f * sizeof_addr, size_t_f * sizeof_size)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_sizes_c (hid_t_f *prp_id, size_t_f * sizeof_addr, size_t_f * sizeof_size)
+h5pset_sizes_c(hid_t_f *prp_id, size_t_f *sizeof_addr, size_t_f *sizeof_size)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- size_t c_addr, c_size;
- c_addr = (size_t)*sizeof_addr;
- c_size = (size_t)*sizeof_size;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ size_t c_addr, c_size;
+ c_addr = (size_t)*sizeof_addr;
+ c_size = (size_t)*sizeof_size;
- /*
- * Call H5Pset_sizes function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pset_sizes(c_prp_id, c_addr, c_size);
+ /*
+ * Call H5Pset_sizes function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pset_sizes(c_prp_id, c_addr, c_size);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_sym_k_c
@@ -703,28 +710,29 @@ h5pset_sizes_c (hid_t_f *prp_id, size_t_f * sizeof_addr, size_t_f * sizeof_size)
* Xiangyang Su
* Friday, February 25, 2000
* SOURCE
-*/
+ */
int_f
-h5pset_sym_k_c (hid_t_f *prp_id, int_f* ik, int_f* lk)
+h5pset_sym_k_c(hid_t_f *prp_id, int_f *ik, int_f *lk)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- unsigned c_ik;
- unsigned c_lk;
- herr_t ret;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ unsigned c_ik;
+ unsigned c_lk;
+ herr_t ret;
- /*
- * Call H5Pset_sym_k function.
- */
- c_prp_id = (hid_t)*prp_id;
- c_ik = (unsigned)*ik;
- c_lk = (unsigned)*lk;
- ret = H5Pset_sym_k(c_prp_id, c_ik, c_lk);
+ /*
+ * Call H5Pset_sym_k function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ c_ik = (unsigned)*ik;
+ c_lk = (unsigned)*lk;
+ ret = H5Pset_sym_k(c_prp_id, c_ik, c_lk);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_sym_k_c
@@ -746,27 +754,28 @@ h5pset_sym_k_c (hid_t_f *prp_id, int_f* ik, int_f* lk)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_sym_k_c (hid_t_f *prp_id, int_f* ik, int_f* lk)
+h5pget_sym_k_c(hid_t_f *prp_id, int_f *ik, int_f *lk)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- unsigned c_ik;
- unsigned c_lk;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ unsigned c_ik;
+ unsigned c_lk;
- /*
- * Call H5Pget_sym_k function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pget_sym_k(c_prp_id, &c_ik, &c_lk);
- *ik = (int_f)c_ik;
- *lk = (int_f)c_lk;
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ /*
+ * Call H5Pget_sym_k function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pget_sym_k(c_prp_id, &c_ik, &c_lk);
+ *ik = (int_f)c_ik;
+ *lk = (int_f)c_lk;
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_istore_k_c
@@ -786,26 +795,27 @@ h5pget_sym_k_c (hid_t_f *prp_id, int_f* ik, int_f* lk)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_istore_k_c (hid_t_f *prp_id, int_f* ik)
+h5pset_istore_k_c(hid_t_f *prp_id, int_f *ik)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- unsigned c_ik;
- herr_t ret;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ unsigned c_ik;
+ herr_t ret;
- /*
- * Call H5Pset_istore_k function.
- */
- c_prp_id = (hid_t)*prp_id;
- c_ik = (unsigned)*ik;
- ret = H5Pset_istore_k(c_prp_id, c_ik);
+ /*
+ * Call H5Pset_istore_k function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ c_ik = (unsigned)*ik;
+ ret = H5Pset_istore_k(c_prp_id, c_ik);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_istore_k_c
@@ -826,25 +836,26 @@ h5pset_istore_k_c (hid_t_f *prp_id, int_f* ik)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_istore_k_c (hid_t_f *prp_id, int_f* ik)
+h5pget_istore_k_c(hid_t_f *prp_id, int_f *ik)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- unsigned c_ik;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ unsigned c_ik;
- /*
- * Call H5Pget_istore_k function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pget_istore_k(c_prp_id, &c_ik);
- *ik = (int_f)c_ik;
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ /*
+ * Call H5Pget_istore_k function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pget_istore_k(c_prp_id, &c_ik);
+ *ik = (int_f)c_ik;
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_driver_c
@@ -864,25 +875,26 @@ h5pget_istore_k_c (hid_t_f *prp_id, int_f* ik)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_driver_c (hid_t_f *prp_id, hid_t_f* driver)
+h5pget_driver_c(hid_t_f *prp_id, hid_t_f *driver)
/******/
{
- int ret_value = -1;
- hid_t c_driver;
+ int ret_value = -1;
+ hid_t c_driver;
- /*
- * Call H5Pget_driver function.
- */
- c_driver = H5Pget_driver((hid_t)*prp_id);
- if (c_driver < 0) goto DONE;
+ /*
+ * Call H5Pget_driver function.
+ */
+ c_driver = H5Pget_driver((hid_t)*prp_id);
+ if (c_driver < 0)
+ goto DONE;
- *driver = (hid_t_f) c_driver;
- ret_value = 0;
+ *driver = (hid_t_f)c_driver;
+ ret_value = 0;
DONE:
- return ret_value;
+ return ret_value;
}
/****if* H5Pf/h5pset_fapl_stdio_c
@@ -901,22 +913,23 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_fapl_stdio_c (hid_t_f *prp_id)
+h5pset_fapl_stdio_c(hid_t_f *prp_id)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret = -1;
- /*
- * Call H5Pset_fapl_stdio function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pset_fapl_stdio(c_prp_id);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret = -1;
+ /*
+ * Call H5Pset_fapl_stdio function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pset_fapl_stdio(c_prp_id);
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
#ifdef NO_SUCH_F90_FUNCTION
/****if* H5Pf/h5pget_fapl_stdio_c
@@ -938,23 +951,24 @@ h5pset_fapl_stdio_c (hid_t_f *prp_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_fapl_stdio_c (hid_t_f *prp_id, int_f* io)
+h5pget_fapl_stdio_c(hid_t_f *prp_id, int_f *io)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret = -1;
- /*
- * Call H5Pget_fapl_stdio function.
- */
- c_prp_id = *prp_id;
- ret = H5Pget_fapl_stdio(c_prp_id);
- if (ret < 0) return ret_value;
- *io = (int_f)ret;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret = -1;
+ /*
+ * Call H5Pget_fapl_stdio function.
+ */
+ c_prp_id = *prp_id;
+ ret = H5Pget_fapl_stdio(c_prp_id);
+ if (ret < 0)
+ return ret_value;
+ *io = (int_f)ret;
+ ret_value = 0;
+ return ret_value;
}
#endif /*NO_SUCH_F90_FUNCTION*/
@@ -975,22 +989,23 @@ h5pget_fapl_stdio_c (hid_t_f *prp_id, int_f* io)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_fapl_sec2_c (hid_t_f *prp_id)
+h5pset_fapl_sec2_c(hid_t_f *prp_id)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret = -1;
- /*
- * Call H5Pset_fapl_sec2 function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pset_fapl_sec2(c_prp_id);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret = -1;
+ /*
+ * Call H5Pset_fapl_sec2 function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pset_fapl_sec2(c_prp_id);
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
#ifdef NO_SUCH_F90_FUNCTION
@@ -1013,23 +1028,24 @@ h5pset_fapl_sec2_c (hid_t_f *prp_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_fapl_sec2_c (hid_t_f *prp_id, int_f* sec2)
+h5pget_fapl_sec2_c(hid_t_f *prp_id, int_f *sec2)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret = -1;
- /*
- * Call H5Pget_fapl_sec2 function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pget_fapl_sec2(c_prp_id);
- if (ret < 0) return ret_value;
- *sec2 = (int_f)ret;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret = -1;
+ /*
+ * Call H5Pget_fapl_sec2 function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pget_fapl_sec2(c_prp_id);
+ if (ret < 0)
+ return ret_value;
+ *sec2 = (int_f)ret;
+ ret_value = 0;
+ return ret_value;
}
#endif /*NO_SUCH_F90_FUNCTION*/
@@ -1051,25 +1067,26 @@ h5pget_fapl_sec2_c (hid_t_f *prp_id, int_f* sec2)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_alignment_c (hid_t_f *prp_id, hsize_t_f* threshold, hsize_t_f* alignment)
+h5pset_alignment_c(hid_t_f *prp_id, hsize_t_f *threshold, hsize_t_f *alignment)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- hsize_t c_threshold, c_alignment;
- c_threshold = (hsize_t)*threshold;
- c_alignment = (hsize_t)* alignment;
- /*
- * Call H5Pset_alignment function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pset_alignment(c_prp_id, c_threshold, c_alignment);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ hsize_t c_threshold, c_alignment;
+ c_threshold = (hsize_t)*threshold;
+ c_alignment = (hsize_t)*alignment;
+ /*
+ * Call H5Pset_alignment function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pset_alignment(c_prp_id, c_threshold, c_alignment);
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_alignment_c
@@ -1090,26 +1107,27 @@ h5pset_alignment_c (hid_t_f *prp_id, hsize_t_f* threshold, hsize_t_f* alignment)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_alignment_c (hid_t_f *prp_id, hsize_t_f* threshold, hsize_t_f* alignment)
+h5pget_alignment_c(hid_t_f *prp_id, hsize_t_f *threshold, hsize_t_f *alignment)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- hsize_t c_threshold, c_alignment;
- /*
- * Call H5Pget_alignment function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pget_alignment(c_prp_id, &c_threshold, &c_alignment);
- if (ret < 0) return ret_value;
- *threshold = (hsize_t_f)c_threshold;
- *alignment = (hsize_t_f)c_alignment;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ hsize_t c_threshold, c_alignment;
+ /*
+ * Call H5Pget_alignment function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pget_alignment(c_prp_id, &c_threshold, &c_alignment);
+ if (ret < 0)
+ return ret_value;
+ *threshold = (hsize_t_f)c_threshold;
+ *alignment = (hsize_t_f)c_alignment;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_fapl_core_c
@@ -1131,27 +1149,28 @@ h5pget_alignment_c (hid_t_f *prp_id, hsize_t_f* threshold, hsize_t_f* alignment)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_fapl_core_c (hid_t_f *prp_id, size_t_f* increment, int_f *flag)
+h5pset_fapl_core_c(hid_t_f *prp_id, size_t_f *increment, int_f *flag)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret = -1;
- size_t c_increment;
- hbool_t c_backing_store;
- c_increment = (size_t)*increment;
- c_backing_store = (hbool_t)*flag;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret = -1;
+ size_t c_increment;
+ hbool_t c_backing_store;
+ c_increment = (size_t)*increment;
+ c_backing_store = (hbool_t)*flag;
- /*
- * Call H5Pset_fapl_core function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pset_fapl_core(c_prp_id, c_increment, c_backing_store);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ /*
+ * Call H5Pset_fapl_core function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pset_fapl_core(c_prp_id, c_increment, c_backing_store);
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_fapl_core_c
@@ -1171,27 +1190,29 @@ h5pset_fapl_core_c (hid_t_f *prp_id, size_t_f* increment, int_f *flag)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_fapl_core_c (hid_t_f *prp_id, size_t_f* increment, int_f *flag)
+h5pget_fapl_core_c(hid_t_f *prp_id, size_t_f *increment, int_f *flag)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret = -1;
- size_t c_increment = 0;
- hbool_t c_backing_store;
- *flag = 0;
- /*
- * Call H5Pset_fapl_core function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pget_fapl_core(c_prp_id, &c_increment, &c_backing_store);
- if (ret < 0) return ret_value;
- *increment = (size_t_f)c_increment;
- if(c_backing_store > 0) *flag = 1;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret = -1;
+ size_t c_increment = 0;
+ hbool_t c_backing_store;
+ *flag = 0;
+ /*
+ * Call H5Pset_fapl_core function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pget_fapl_core(c_prp_id, &c_increment, &c_backing_store);
+ if (ret < 0)
+ return ret_value;
+ *increment = (size_t_f)c_increment;
+ if (c_backing_store > 0)
+ *flag = 1;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_fapl_family_c
@@ -1213,26 +1234,27 @@ h5pget_fapl_core_c (hid_t_f *prp_id, size_t_f* increment, int_f *flag)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_fapl_family_c(hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plist )
+h5pset_fapl_family_c(hid_t_f *prp_id, hsize_t_f *memb_size, hid_t_f *memb_plist)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret = -1;
- hsize_t c_memb_size;
- hid_t c_memb_plist;
- c_memb_size =(hsize_t) *memb_size;
- c_memb_plist =(hid_t) *memb_plist;
- /*
- * Call H5Pset_fapl_family function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pset_fapl_family(c_prp_id, c_memb_size, c_memb_plist);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret = -1;
+ hsize_t c_memb_size;
+ hid_t c_memb_plist;
+ c_memb_size = (hsize_t)*memb_size;
+ c_memb_plist = (hid_t)*memb_plist;
+ /*
+ * Call H5Pset_fapl_family function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pset_fapl_family(c_prp_id, c_memb_size, c_memb_plist);
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_fapl_family_c
@@ -1254,27 +1276,28 @@ h5pset_fapl_family_c(hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plist
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_fapl_family_c(hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plist)
+h5pget_fapl_family_c(hid_t_f *prp_id, hsize_t_f *memb_size, hid_t_f *memb_plist)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret = -1;
- hsize_t c_memb_size = 0;
- hid_t c_memb_plist = -1;
- /*
- * Call H5Pget_fapl_family function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pget_fapl_family(c_prp_id, &c_memb_size, &c_memb_plist);
- if (ret < 0) return ret_value;
- *memb_size = (hsize_t_f)c_memb_size;
- *memb_plist = (hid_t_f)c_memb_plist;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret = -1;
+ hsize_t c_memb_size = 0;
+ hid_t c_memb_plist = -1;
+ /*
+ * Call H5Pget_fapl_family function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pget_fapl_family(c_prp_id, &c_memb_size, &c_memb_plist);
+ if (ret < 0)
+ return ret_value;
+ *memb_size = (hsize_t_f)c_memb_size;
+ *memb_plist = (hid_t_f)c_memb_plist;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_cache_c
@@ -1299,31 +1322,33 @@ h5pget_fapl_family_c(hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plist)
* Changed the type of the rdcc_w0 parameter to be real_f EP 7/7/00
* instead of double
* SOURCE
-*/
+ */
int_f
-h5pset_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, size_t_f* rdcc_nelmts, size_t_f* rdcc_nbytes , real_f* rdcc_w0 )
+h5pset_cache_c(hid_t_f *prp_id, int_f *mdc_nelmts, size_t_f *rdcc_nelmts, size_t_f *rdcc_nbytes,
+ real_f *rdcc_w0)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- int c_mdc_nelmts;
- size_t c_rdcc_nelmts;
- size_t c_rdcc_nbytes;
- double c_rdcc_w0;
- c_rdcc_nbytes =(size_t) *rdcc_nbytes;
- c_rdcc_w0 = (double)*rdcc_w0;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ int c_mdc_nelmts;
+ size_t c_rdcc_nelmts;
+ size_t c_rdcc_nbytes;
+ double c_rdcc_w0;
+ c_rdcc_nbytes = (size_t)*rdcc_nbytes;
+ c_rdcc_w0 = (double)*rdcc_w0;
- /*
- * Call H5Pset_cache function.
- */
- c_prp_id = (hid_t)*prp_id;
- c_mdc_nelmts = (int)*mdc_nelmts;
- c_rdcc_nelmts = (size_t)*rdcc_nelmts;
- ret = H5Pset_cache(c_prp_id, c_mdc_nelmts, c_rdcc_nelmts, c_rdcc_nbytes, c_rdcc_w0 );
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ /*
+ * Call H5Pset_cache function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ c_mdc_nelmts = (int)*mdc_nelmts;
+ c_rdcc_nelmts = (size_t)*rdcc_nelmts;
+ ret = H5Pset_cache(c_prp_id, c_mdc_nelmts, c_rdcc_nelmts, c_rdcc_nbytes, c_rdcc_w0);
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_cache_c
@@ -1351,31 +1376,33 @@ h5pset_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, size_t_f* rdcc_nelmts, size_
* Changed type of the rdcc_nelmts parameter to be int_f.
* EIP October 10, 2003
* SOURCE
-*/
+ */
int_f
-h5pget_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, size_t_f* rdcc_nelmts, size_t_f* rdcc_nbytes , real_f* rdcc_w0)
+h5pget_cache_c(hid_t_f *prp_id, int_f *mdc_nelmts, size_t_f *rdcc_nelmts, size_t_f *rdcc_nbytes,
+ real_f *rdcc_w0)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- int c_mdc_nelmts;
- size_t c_rdcc_nelmts;
- size_t c_rdcc_nbytes;
- double c_rdcc_w0;
- /*
- * Call H5Pget_cache function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pget_cache(c_prp_id, &c_mdc_nelmts, &c_rdcc_nelmts, &c_rdcc_nbytes, &c_rdcc_w0);
- if (ret < 0) return ret_value;
- *mdc_nelmts = (int_f)c_mdc_nelmts;
- *rdcc_nelmts = (size_t_f)c_rdcc_nelmts;
- *rdcc_nbytes = (size_t_f)c_rdcc_nbytes;
- *rdcc_w0 = (real_f)c_rdcc_w0;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ int c_mdc_nelmts;
+ size_t c_rdcc_nelmts;
+ size_t c_rdcc_nbytes;
+ double c_rdcc_w0;
+ /*
+ * Call H5Pget_cache function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pget_cache(c_prp_id, &c_mdc_nelmts, &c_rdcc_nelmts, &c_rdcc_nbytes, &c_rdcc_w0);
+ if (ret < 0)
+ return ret_value;
+ *mdc_nelmts = (int_f)c_mdc_nelmts;
+ *rdcc_nelmts = (size_t_f)c_rdcc_nelmts;
+ *rdcc_nbytes = (size_t_f)c_rdcc_nbytes;
+ *rdcc_w0 = (real_f)c_rdcc_w0;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_fapl_split_c
@@ -1400,44 +1427,47 @@ h5pget_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, size_t_f* rdcc_nelmts, size_t
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_fapl_split_c(hid_t_f *prp_id, int_f* meta_len, _fcd meta_ext, hid_t_f* meta_plist, int_f* raw_len, _fcd raw_ext, hid_t_f * raw_plist)
+h5pset_fapl_split_c(hid_t_f *prp_id, int_f *meta_len, _fcd meta_ext, hid_t_f *meta_plist, int_f *raw_len,
+ _fcd raw_ext, hid_t_f *raw_plist)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- hid_t c_meta_plist;
- hid_t c_raw_plist;
- herr_t ret = -1;
- char* c_meta_ext;
- char* c_raw_ext;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ hid_t c_meta_plist;
+ hid_t c_raw_plist;
+ herr_t ret = -1;
+ char * c_meta_ext;
+ char * c_raw_ext;
- c_meta_ext = (char *)HD5f2cstring(meta_ext, (size_t)*meta_len);
- if (c_meta_ext == NULL) return ret_value;
- c_raw_ext = (char *)HD5f2cstring(raw_ext, (size_t)*raw_len);
- if (c_raw_ext == NULL) { HDfree(c_meta_ext);
- return ret_value;
- }
+ c_meta_ext = (char *)HD5f2cstring(meta_ext, (size_t)*meta_len);
+ if (c_meta_ext == NULL)
+ return ret_value;
+ c_raw_ext = (char *)HD5f2cstring(raw_ext, (size_t)*raw_len);
+ if (c_raw_ext == NULL) {
+ HDfree(c_meta_ext);
+ return ret_value;
+ }
- /*
- * Call H5Pset_fapl_split function.
- */
- c_prp_id = (hid_t)*prp_id;
- c_meta_plist = (hid_t)*meta_plist;
- c_raw_plist = (hid_t)*raw_plist;
- ret = H5Pset_fapl_split(c_prp_id, c_meta_ext, c_meta_plist, c_raw_ext, c_raw_plist );
+ /*
+ * Call H5Pset_fapl_split function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ c_meta_plist = (hid_t)*meta_plist;
+ c_raw_plist = (hid_t)*raw_plist;
+ ret = H5Pset_fapl_split(c_prp_id, c_meta_ext, c_meta_plist, c_raw_ext, c_raw_plist);
- if (ret < 0) goto DONE;
- ret_value = 0;
+ if (ret < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- HDfree(c_meta_ext);
- HDfree(c_raw_ext);
- return ret_value;
+ HDfree(c_meta_ext);
+ HDfree(c_raw_ext);
+ return ret_value;
}
-
#ifdef NO_SUCH_F90_FUNCTION
/****if* H5Pf/h5pget_fapl_split_c
* NAME
@@ -1464,41 +1494,45 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_fapl_split_c(hid_t_f *prp_id, size_t_f* meta_ext_size , _fcd meta_ext, hid_t_f* meta_plist, size_t_f* raw_ext_size, _fcd raw_ext, hid_t_f * raw_plist)
+h5pget_fapl_split_c(hid_t_f *prp_id, size_t_f *meta_ext_size, _fcd meta_ext, hid_t_f *meta_plist,
+ size_t_f *raw_ext_size, _fcd raw_ext, hid_t_f *raw_plist)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret = -1;
- size_t c_meta_ext_size, c_raw_ext_size;
- hid_t c_meta_plist = -1;
- hid_t c_raw_plist = -1;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret = -1;
+ size_t c_meta_ext_size, c_raw_ext_size;
+ hid_t c_meta_plist = -1;
+ hid_t c_raw_plist = -1;
- char* c_meta_ext = NULL;
- char* c_raw_ext = NULL;
+ char *c_meta_ext = NULL;
+ char *c_raw_ext = NULL;
- c_meta_ext_size = (size_t) *meta_ext_size;
- c_raw_ext_size = (size_t) *raw_ext_size;
- c_meta_ext = (char *)HDmalloc(sizeof(char) * c_meta_ext_size);
- c_raw_ext = (char *)HDmalloc(sizeof(char) * c_raw_ext_size);
- if(c_meta_ext == NULL || c_raw_ext == NULL) return ret_value;
+ c_meta_ext_size = (size_t)*meta_ext_size;
+ c_raw_ext_size = (size_t)*raw_ext_size;
+ c_meta_ext = (char *)HDmalloc(sizeof(char) * c_meta_ext_size);
+ c_raw_ext = (char *)HDmalloc(sizeof(char) * c_raw_ext_size);
+ if (c_meta_ext == NULL || c_raw_ext == NULL)
+ return ret_value;
- /*
- * Call H5Pget_fapl_split function.
- */
- c_prp_id = *prp_id;
- ret = H5Pget_fapl_split(c_prp_id, c_meta_ext_size, c_meta_ext,&c_meta_plist, c_raw_ext_size, c_raw_ext, &c_raw_plist );
+ /*
+ * Call H5Pget_fapl_split function.
+ */
+ c_prp_id = *prp_id;
+ ret = H5Pget_fapl_split(c_prp_id, c_meta_ext_size, c_meta_ext, &c_meta_plist, c_raw_ext_size, c_raw_ext,
+ &c_raw_plist);
- if (ret < 0) return ret_value;
- *meta_plist = c_meta_plist;
- *raw_plist = c_raw_plist;
- HD5packFstring(c_meta_ext, _fcdtocp(meta_ext), strlen(c_meta_ext));
- HD5packFstring(c_raw_ext, _fcdtocp(raw_ext), strlen(c_raw_ext));
+ if (ret < 0)
+ return ret_value;
+ *meta_plist = c_meta_plist;
+ *raw_plist = c_raw_plist;
+ HD5packFstring(c_meta_ext, _fcdtocp(meta_ext), strlen(c_meta_ext));
+ HD5packFstring(c_raw_ext, _fcdtocp(raw_ext), strlen(c_raw_ext));
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
#endif /*NO_SUCH_F90_FUNCTION*/
@@ -1520,26 +1554,27 @@ h5pget_fapl_split_c(hid_t_f *prp_id, size_t_f* meta_ext_size , _fcd meta_ext, hi
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_gc_references_c (hid_t_f *prp_id, int_f* gc_references)
+h5pset_gc_references_c(hid_t_f *prp_id, int_f *gc_references)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- unsigned c_gc_references;
- c_gc_references = (unsigned)*gc_references;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ unsigned c_gc_references;
+ c_gc_references = (unsigned)*gc_references;
- /*
- * Call H5Pset_gc_references function.
- */
- c_prp_id = *prp_id;
- ret = H5Pset_gc_references(c_prp_id, c_gc_references);
+ /*
+ * Call H5Pset_gc_references function.
+ */
+ c_prp_id = *prp_id;
+ ret = H5Pset_gc_references(c_prp_id, c_gc_references);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_gc_references_c
@@ -1560,24 +1595,25 @@ h5pset_gc_references_c (hid_t_f *prp_id, int_f* gc_references)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_gc_references_c (hid_t_f *prp_id, int_f* gc_references)
+h5pget_gc_references_c(hid_t_f *prp_id, int_f *gc_references)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- unsigned c_gc_references;
- herr_t ret;
- /*
- * Call H5Pget_gc_references function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pget_gc_references(c_prp_id, &c_gc_references);
- if (ret < 0) return ret_value;
- *gc_references = (int_f)c_gc_references;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ unsigned c_gc_references;
+ herr_t ret;
+ /*
+ * Call H5Pget_gc_references function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pget_gc_references(c_prp_id, &c_gc_references);
+ if (ret < 0)
+ return ret_value;
+ *gc_references = (int_f)c_gc_references;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_layout_c
@@ -1597,25 +1633,26 @@ h5pget_gc_references_c (hid_t_f *prp_id, int_f* gc_references)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_layout_c (hid_t_f *prp_id, int_f* layout)
+h5pset_layout_c(hid_t_f *prp_id, int_f *layout)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- H5D_layout_t c_layout;
- c_layout = (H5D_layout_t)*layout;
- /*
- * Call H5Pset_layout function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pset_layout(c_prp_id, c_layout);
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ H5D_layout_t c_layout;
+ c_layout = (H5D_layout_t)*layout;
+ /*
+ * Call H5Pset_layout function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pset_layout(c_prp_id, c_layout);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_layout_c
@@ -1636,23 +1673,24 @@ h5pset_layout_c (hid_t_f *prp_id, int_f* layout)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_layout_c (hid_t_f *prp_id, int_f* layout)
+h5pget_layout_c(hid_t_f *prp_id, int_f *layout)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- H5D_layout_t c_layout;
- /*
- * Call H5Pget_layout function.
- */
- c_prp_id = (hid_t)*prp_id;
- c_layout = H5Pget_layout(c_prp_id);
- if (c_layout < 0) return ret_value;
- *layout = (int_f)c_layout;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ H5D_layout_t c_layout;
+ /*
+ * Call H5Pget_layout function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ c_layout = H5Pget_layout(c_prp_id);
+ if (c_layout < 0)
+ return ret_value;
+ *layout = (int_f)c_layout;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_filter_c
@@ -1675,36 +1713,38 @@ h5pget_layout_c (hid_t_f *prp_id, int_f* layout)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values )
+h5pset_filter_c(hid_t_f *prp_id, int_f *filter, int_f *flags, size_t_f *cd_nelmts, int_f *cd_values)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id = (hid_t)*prp_id;
- herr_t ret;
- size_t c_cd_nelmts = (size_t)*cd_nelmts;
- unsigned int c_flags = (unsigned)*flags;
- H5Z_filter_t c_filter = (H5Z_filter_t)*filter;
- unsigned int * c_cd_values;
- unsigned i;
+ int ret_value = -1;
+ hid_t c_prp_id = (hid_t)*prp_id;
+ herr_t ret;
+ size_t c_cd_nelmts = (size_t)*cd_nelmts;
+ unsigned int c_flags = (unsigned)*flags;
+ H5Z_filter_t c_filter = (H5Z_filter_t)*filter;
+ unsigned int *c_cd_values;
+ unsigned i;
- c_cd_values = (unsigned int*)HDmalloc(sizeof(unsigned int) * c_cd_nelmts);
- if (!c_cd_values) return ret_value;
- for (i = 0; i < c_cd_nelmts; i++)
- c_cd_values[i] = (unsigned int)cd_values[i];
+ c_cd_values = (unsigned int *)HDmalloc(sizeof(unsigned int) * c_cd_nelmts);
+ if (!c_cd_values)
+ return ret_value;
+ for (i = 0; i < c_cd_nelmts; i++)
+ c_cd_values[i] = (unsigned int)cd_values[i];
- /*
- * Call H5Pset_filter function.
- */
- ret = H5Pset_filter(c_prp_id, c_filter, c_flags, c_cd_nelmts,c_cd_values );
+ /*
+ * Call H5Pset_filter function.
+ */
+ ret = H5Pset_filter(c_prp_id, c_filter, c_flags, c_cd_nelmts, c_cd_values);
- if (ret < 0) goto DONE;
- ret_value = 0;
+ if (ret < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- HDfree(c_cd_values);
- return ret_value;
+ HDfree(c_cd_values);
+ return ret_value;
}
/****if* H5Pf/h5pget_nfilters_c
@@ -1723,25 +1763,26 @@ DONE:
* Xiangyang Su
* Friday, February 25, 2000
* SOURCE
-*/
+ */
int_f
-h5pget_nfilters_c (hid_t_f *prp_id, int_f* nfilters)
+h5pget_nfilters_c(hid_t_f *prp_id, int_f *nfilters)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- int c_nfilters;
- /*
- * Call H5Pget_nfilters function.
- */
- c_prp_id = (hid_t)*prp_id;
- c_nfilters = H5Pget_nfilters(c_prp_id);
- if (c_nfilters < 0) return ret_value;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ int c_nfilters;
+ /*
+ * Call H5Pget_nfilters function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ c_nfilters = H5Pget_nfilters(c_prp_id);
+ if (c_nfilters < 0)
+ return ret_value;
- *nfilters = (int_f)c_nfilters;
- ret_value = 0;
+ *nfilters = (int_f)c_nfilters;
+ ret_value = 0;
- return ret_value;
+ return ret_value;
}
/*----------------------------------------------------------------------------
@@ -1768,45 +1809,47 @@ h5pget_nfilters_c (hid_t_f *prp_id, int_f* nfilters)
* MSB January 27, 2009
*---------------------------------------------------------------------------*/
int_f
-h5pget_filter_c(hid_t_f *prp_id, int_f* filter_number, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name, int_f* filter_id)
+h5pget_filter_c(hid_t_f *prp_id, int_f *filter_number, int_f *flags, size_t_f *cd_nelmts, int_f *cd_values,
+ size_t_f *namelen, _fcd name, int_f *filter_id)
/******/
{
unsigned int c_flags;
- size_t c_cd_nelmts = 0;
- H5Z_filter_t c_filter;
+ size_t c_cd_nelmts = 0;
+ H5Z_filter_t c_filter;
unsigned int *c_cd_values = NULL;
- char *c_name = NULL;
- unsigned i;
- int ret_value = -1;
+ char * c_name = NULL;
+ unsigned i;
+ int ret_value = -1;
c_cd_nelmts = (size_t)*cd_nelmts;
- if(NULL == (c_name = (char *)HDmalloc((size_t)*namelen + 1)))
+ if (NULL == (c_name = (char *)HDmalloc((size_t)*namelen + 1)))
goto DONE;
- if(NULL == (c_cd_values = (unsigned int *)HDmalloc(sizeof(unsigned int) * c_cd_nelmts)))
+ if (NULL == (c_cd_values = (unsigned int *)HDmalloc(sizeof(unsigned int) * c_cd_nelmts)))
goto DONE;
/*
* Call H5Pget_filter2 function.
*/
- if((c_filter = H5Pget_filter2((hid_t)*prp_id, (unsigned)*filter_number, &c_flags, &c_cd_nelmts, c_cd_values, (size_t)*namelen, c_name, NULL)) < 0)
+ if ((c_filter = H5Pget_filter2((hid_t)*prp_id, (unsigned)*filter_number, &c_flags, &c_cd_nelmts,
+ c_cd_values, (size_t)*namelen, c_name, NULL)) < 0)
goto DONE;
*filter_id = (int_f)c_filter;
*cd_nelmts = (size_t_f)c_cd_nelmts;
- *flags = (int_f)c_flags;
+ *flags = (int_f)c_flags;
HD5packFstring(c_name, _fcdtocp(name), strlen(c_name));
- for(i = 0; i < c_cd_nelmts; i++)
- cd_values[i] = (int_f)c_cd_values[i];
+ for (i = 0; i < c_cd_nelmts; i++)
+ cd_values[i] = (int_f)c_cd_values[i];
ret_value = 0;
DONE:
- if(c_name)
+ if (c_name)
HDfree(c_name);
- if(c_cd_values)
+ if (c_cd_values)
HDfree(c_cd_values);
return ret_value;
}
@@ -1833,37 +1876,38 @@ DONE:
* Changed type of 'offset' from int_f to off_t_f -- MSB January 9, 2012
*
* SOURCE
-*/
+ */
int_f
-h5pset_external_c (hid_t_f *prp_id, _fcd name, int_f* namelen, off_t_f* offset, hsize_t_f*bytes)
+h5pset_external_c(hid_t_f *prp_id, _fcd name, int_f *namelen, off_t_f *offset, hsize_t_f *bytes)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- hsize_t c_bytes;
- char* c_name;
- size_t c_namelen = (size_t)*namelen;
- off_t c_offset;
- c_bytes = (hsize_t) *bytes;
- c_offset = (off_t) *offset;
-
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ hsize_t c_bytes;
+ char * c_name;
+ size_t c_namelen = (size_t)*namelen;
+ off_t c_offset;
+ c_bytes = (hsize_t)*bytes;
+ c_offset = (off_t)*offset;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL) return ret_value;
+ c_name = (char *)HD5f2cstring(name, c_namelen);
+ if (c_name == NULL)
+ return ret_value;
- /*
- * Call H5Pset_external function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pset_external(c_prp_id, c_name, c_offset, c_bytes);
+ /*
+ * Call H5Pset_external function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pset_external(c_prp_id, c_name, c_offset, c_bytes);
- if (ret < 0) goto DONE;
- ret_value = 0;
+ if (ret < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- HDfree(c_name);
- return ret_value;
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Pf/h5pget_external_count_c
@@ -1884,23 +1928,24 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_external_count_c (hid_t_f *prp_id, int_f* count)
+h5pget_external_count_c(hid_t_f *prp_id, int_f *count)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- int c_count;
- /*
- * Call H5Pget_external_count function.
- */
- c_prp_id = (hid_t)*prp_id;
- c_count = H5Pget_external_count(c_prp_id);
- if (c_count < 0) return ret_value;
- *count = (int_f)c_count;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ int c_count;
+ /*
+ * Call H5Pget_external_count function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ c_count = H5Pget_external_count(c_prp_id);
+ if (c_count < 0)
+ return ret_value;
+ *count = (int_f)c_count;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_external_c
@@ -1926,93 +1971,90 @@ h5pget_external_count_c (hid_t_f *prp_id, int_f* count)
* Changed type of 'offset' from integer to off_t -- MSB January 9, 2012
*
* SOURCE
-*/
-int_f
-h5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, off_t_f* offset, hsize_t_f*bytes)
-/******/
-{
- int ret_value = -1;
- hid_t c_prp_id;
- unsigned c_idx;
- herr_t status;
- size_t c_namelen;
- char* c_name = NULL;
- off_t c_offset;
- hsize_t size;
-
- c_namelen = (size_t)*name_size;
- /*
- * Allocate memory to store the name of the external file.
- */
- if(c_namelen) c_name = (char*)HDmalloc(c_namelen + 1);
- if (c_name == NULL) return ret_value;
-
- /*
- * Call H5Pget_external function.
- */
- c_prp_id = (hid_t)*prp_id;
- c_idx = (unsigned)*idx;
- status = H5Pget_external(c_prp_id, c_idx, c_namelen+1, c_name, &c_offset, &size );
-
- if (status < 0) goto DONE;
-
- *offset = (off_t_f)c_offset;
- *bytes = (hsize_t_f)size;
- /* Note: if the size of the fortran buffer is larger then the returned string
- * from the function then we need to give HD5packFstring the fortran buffer size so
- * that it fills the remaining unused characters with blanks. MSB
- */
- HD5packFstring(c_name, _fcdtocp(name), c_namelen);
- ret_value = 0;
+ */
+int_f
+h5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f *name_size, _fcd name, off_t_f *offset,
+ hsize_t_f *bytes)
+/******/
+{
+ int ret_value = -1;
+ hid_t c_prp_id;
+ unsigned c_idx;
+ herr_t status;
+ size_t c_namelen;
+ char * c_name = NULL;
+ off_t c_offset;
+ hsize_t size;
+
+ c_namelen = (size_t)*name_size;
+ /*
+ * Allocate memory to store the name of the external file.
+ */
+ if (c_namelen)
+ c_name = (char *)HDmalloc(c_namelen + 1);
+ if (c_name == NULL)
+ return ret_value;
+
+ /*
+ * Call H5Pget_external function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ c_idx = (unsigned)*idx;
+ status = H5Pget_external(c_prp_id, c_idx, c_namelen + 1, c_name, &c_offset, &size);
+
+ if (status < 0)
+ goto DONE;
+
+ *offset = (off_t_f)c_offset;
+ *bytes = (hsize_t_f)size;
+ /* Note: if the size of the fortran buffer is larger then the returned string
+ * from the function then we need to give HD5packFstring the fortran buffer size so
+ * that it fills the remaining unused characters with blanks. MSB
+ */
+ HD5packFstring(c_name, _fcdtocp(name), c_namelen);
+ ret_value = 0;
DONE:
- HDfree(c_name);
- return ret_value;
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Pf/h5pset_btree_ratios_c
* NAME
* h5pset_btree_ratios_c
* PURPOSE
- * Call H5Pset_btree_ratios to set B-tree split ratios for B-tree split ratios for a dataset transfer property list. a
- * dataset transfer property list.
- * INPUTS
- * prp_id - property list identifier
- * left - The B-tree split ratio for left-most nodes.
- * middle - The B-tree split ratio for all other nodes
- * right - The B-tree split ratio for right-most nodes
- * and lone nodes.
- * RETURNS
- * 0 on success, -1 on failure
- * AUTHOR
- * Xiangyang Su
+ * Call H5Pset_btree_ratios to set B-tree split ratios for B-tree split ratios for a dataset transfer
+ * property list. a dataset transfer property list. INPUTS prp_id - property list identifier left - The B-tree
+ * split ratio for left-most nodes. middle - The B-tree split ratio for all other nodes right - The B-tree
+ * split ratio for right-most nodes and lone nodes. RETURNS 0 on success, -1 on failure AUTHOR Xiangyang Su
* Friday, February 25, 2000
* HISTORY
* Changed the type of the last three parameters from double to real_f
* SOURCE
-*/
+ */
int_f
-h5pset_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* right)
+h5pset_btree_ratios_c(hid_t_f *prp_id, real_f *left, real_f *middle, real_f *right)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- double c_left;
- double c_middle;
- double c_right;
- c_left = (double)*left;
- c_middle = (double)*middle;
- c_right = (double)*right;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ double c_left;
+ double c_middle;
+ double c_right;
+ c_left = (double)*left;
+ c_middle = (double)*middle;
+ c_right = (double)*right;
- /*
- * Call H5Pset_btree_ratios function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pset_btree_ratios(c_prp_id, c_left, c_middle, c_right);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ /*
+ * Call H5Pset_btree_ratios function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pset_btree_ratios(c_prp_id, c_left, c_middle, c_right);
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_btree_ratios_c
@@ -2035,27 +2077,28 @@ h5pset_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* rig
* HISTORY
* Changed the type of the last three parameters from double to real_f
* SOURCE
-*/
+ */
int_f
-h5pget_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* right)
+h5pget_btree_ratios_c(hid_t_f *prp_id, real_f *left, real_f *middle, real_f *right)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- double c_left, c_right, c_middle;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ double c_left, c_right, c_middle;
- /*
- * Call H5Pget_btree_ratios function.
- */
- c_prp_id = (hid_t)*prp_id;
- ret = H5Pget_btree_ratios(c_prp_id, &c_left, &c_middle, &c_right);
- *left = (real_f)c_left;
- *middle = (real_f)c_middle;
- *right = (real_f)c_right;
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ /*
+ * Call H5Pget_btree_ratios function.
+ */
+ c_prp_id = (hid_t)*prp_id;
+ ret = H5Pget_btree_ratios(c_prp_id, &c_left, &c_middle, &c_right);
+ *left = (real_f)c_left;
+ *middle = (real_f)c_middle;
+ *right = (real_f)c_right;
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_fclose_degree_c
* NAME
@@ -2079,22 +2122,23 @@ h5pget_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* rig
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_fclose_degree_c ( hid_t_f *fapl_id , int_f *degree)
+h5pget_fclose_degree_c(hid_t_f *fapl_id, int_f *degree)
/******/
{
- int ret_value = -1;
- hid_t c_fapl_id;
- H5F_close_degree_t c_degree;
+ int ret_value = -1;
+ hid_t c_fapl_id;
+ H5F_close_degree_t c_degree;
- c_fapl_id = (hid_t)*fapl_id;
- if( H5Pget_fclose_degree(c_fapl_id, &c_degree) < 0) return ret_value;
+ c_fapl_id = (hid_t)*fapl_id;
+ if (H5Pget_fclose_degree(c_fapl_id, &c_degree) < 0)
+ return ret_value;
- *degree = (int_f)c_degree;
- ret_value = 0;
- return ret_value;
+ *degree = (int_f)c_degree;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_fclose_degree_c
@@ -2117,22 +2161,23 @@ h5pget_fclose_degree_c ( hid_t_f *fapl_id , int_f *degree)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_fclose_degree_c ( hid_t_f *fapl_id , int_f *degree)
+h5pset_fclose_degree_c(hid_t_f *fapl_id, int_f *degree)
/******/
{
- int ret_value = -1;
- hid_t c_fapl_id;
- H5F_close_degree_t c_degree;
+ int ret_value = -1;
+ hid_t c_fapl_id;
+ H5F_close_degree_t c_degree;
- c_fapl_id = (hid_t)*fapl_id;
- c_degree = (H5F_close_degree_t)*degree;
- if( H5Pset_fclose_degree(c_fapl_id, c_degree) < 0) return ret_value;
+ c_fapl_id = (hid_t)*fapl_id;
+ c_degree = (H5F_close_degree_t)*degree;
+ if (H5Pset_fclose_degree(c_fapl_id, c_degree) < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_buffer_c
@@ -2153,20 +2198,21 @@ h5pset_fclose_degree_c ( hid_t_f *fapl_id , int_f *degree)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_buffer_c ( hid_t_f *prp_id , hsize_t_f *size)
+h5pset_buffer_c(hid_t_f *prp_id, hsize_t_f *size)
/******/
{
- int ret_value = 0;
- hid_t c_prp_id;
- size_t c_size;
+ int ret_value = 0;
+ hid_t c_prp_id;
+ size_t c_size;
- c_prp_id = (hid_t)*prp_id;
- c_size = (size_t)*size;
- if ( H5Pset_buffer(c_prp_id, c_size, NULL, NULL) < 0 ) ret_value = -1;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ c_size = (size_t)*size;
+ if (H5Pset_buffer(c_prp_id, c_size, NULL, NULL) < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Pf/h5pget_buffer_c
@@ -2186,22 +2232,23 @@ h5pset_buffer_c ( hid_t_f *prp_id , hsize_t_f *size)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_buffer_c ( hid_t_f *prp_id , hsize_t_f *size)
+h5pget_buffer_c(hid_t_f *prp_id, hsize_t_f *size)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- hsize_t c_size;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ hsize_t c_size;
- c_prp_id = (hid_t)*prp_id;
- c_size = H5Pget_buffer(c_prp_id, NULL, NULL);
- if ( c_size == 0 ) return ret_value;
- *size = (hsize_t_f)c_size;
- ret_value = 0;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ c_size = H5Pget_buffer(c_prp_id, NULL, NULL);
+ if (c_size == 0)
+ return ret_value;
+ *size = (hsize_t_f)c_size;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pfill_value_defined_c
* NAME
@@ -2220,21 +2267,22 @@ h5pget_buffer_c ( hid_t_f *prp_id , hsize_t_f *size)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pfill_value_defined_c ( hid_t_f *prp_id , int_f *flag)
+h5pfill_value_defined_c(hid_t_f *prp_id, int_f *flag)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- H5D_fill_value_t c_flag;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ H5D_fill_value_t c_flag;
- c_prp_id = (hid_t)*prp_id;
- if ( H5Pfill_value_defined(c_prp_id, &c_flag) < 0 ) return ret_value;
- *flag = (int_f)c_flag;
- ret_value = 0;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ if (H5Pfill_value_defined(c_prp_id, &c_flag) < 0)
+ return ret_value;
+ *flag = (int_f)c_flag;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_alloc_time_c
* NAME
@@ -2254,21 +2302,22 @@ h5pfill_value_defined_c ( hid_t_f *prp_id , int_f *flag)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_alloc_time_c ( hid_t_f *prp_id , int_f *flag)
+h5pget_alloc_time_c(hid_t_f *prp_id, int_f *flag)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- H5D_alloc_time_t c_flag;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ H5D_alloc_time_t c_flag;
- c_prp_id = (hid_t)*prp_id;
- if ( H5Pget_alloc_time(c_prp_id, &c_flag) < 0 ) return ret_value;
- *flag = (int_f)c_flag;
- ret_value = 0;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ if (H5Pget_alloc_time(c_prp_id, &c_flag) < 0)
+ return ret_value;
+ *flag = (int_f)c_flag;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_alloc_time_c
* NAME
@@ -2287,21 +2336,22 @@ h5pget_alloc_time_c ( hid_t_f *prp_id , int_f *flag)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_alloc_time_c ( hid_t_f *prp_id , int_f *flag)
+h5pset_alloc_time_c(hid_t_f *prp_id, int_f *flag)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- H5D_alloc_time_t c_flag;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ H5D_alloc_time_t c_flag;
- c_prp_id = (hid_t)*prp_id;
- c_flag = (H5D_alloc_time_t)*flag;
- if ( H5Pset_alloc_time(c_prp_id, c_flag) < 0 ) return ret_value;
- ret_value = 0;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ c_flag = (H5D_alloc_time_t)*flag;
+ if (H5Pset_alloc_time(c_prp_id, c_flag) < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_fill_time_c
* NAME
@@ -2321,21 +2371,22 @@ h5pset_alloc_time_c ( hid_t_f *prp_id , int_f *flag)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_fill_time_c ( hid_t_f *prp_id , int_f *flag)
+h5pget_fill_time_c(hid_t_f *prp_id, int_f *flag)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- H5D_fill_time_t c_flag;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ H5D_fill_time_t c_flag;
- c_prp_id = (hid_t)*prp_id;
- if ( H5Pget_fill_time(c_prp_id, &c_flag) < 0 ) return ret_value;
- *flag = (int_f)c_flag;
- ret_value = 0;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ if (H5Pget_fill_time(c_prp_id, &c_flag) < 0)
+ return ret_value;
+ *flag = (int_f)c_flag;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_fill_time_c
* NAME
@@ -2354,21 +2405,22 @@ h5pget_fill_time_c ( hid_t_f *prp_id , int_f *flag)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_fill_time_c ( hid_t_f *prp_id , int_f *flag)
+h5pset_fill_time_c(hid_t_f *prp_id, int_f *flag)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- H5D_fill_time_t c_flag;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ H5D_fill_time_t c_flag;
- c_prp_id = (hid_t)*prp_id;
- c_flag = (H5D_fill_time_t)*flag;
- if ( H5Pset_fill_time(c_prp_id, c_flag) < 0 ) return ret_value;
- ret_value = 0;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ c_flag = (H5D_fill_time_t)*flag;
+ if (H5Pset_fill_time(c_prp_id, c_flag) < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_meta_block_size_c
* NAME
@@ -2388,20 +2440,21 @@ h5pset_fill_time_c ( hid_t_f *prp_id , int_f *flag)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_meta_block_size_c ( hid_t_f *prp_id , hsize_t_f *size)
+h5pset_meta_block_size_c(hid_t_f *prp_id, hsize_t_f *size)
/******/
{
- int ret_value = 0;
- hid_t c_prp_id;
- hsize_t c_size;
+ int ret_value = 0;
+ hid_t c_prp_id;
+ hsize_t c_size;
- c_prp_id = (hid_t)*prp_id;
- c_size = (hsize_t)*size;
- if ( H5Pset_meta_block_size(c_prp_id, c_size) < 0 ) ret_value = -1;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ c_size = (hsize_t)*size;
+ if (H5Pset_meta_block_size(c_prp_id, c_size) < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Pf/h5pget_meta_block_size_c
* NAME
@@ -2421,20 +2474,21 @@ h5pset_meta_block_size_c ( hid_t_f *prp_id , hsize_t_f *size)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_meta_block_size_c ( hid_t_f *prp_id , hsize_t_f *size)
+h5pget_meta_block_size_c(hid_t_f *prp_id, hsize_t_f *size)
/******/
{
- int ret_value = 0;
- hid_t c_prp_id;
- hsize_t c_size;
+ int ret_value = 0;
+ hid_t c_prp_id;
+ hsize_t c_size;
- c_prp_id = (hid_t)*prp_id;
- if ( H5Pget_meta_block_size(c_prp_id, &c_size) < 0 ) ret_value = -1;
- *size = (hsize_t_f)c_size;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ if (H5Pget_meta_block_size(c_prp_id, &c_size) < 0)
+ ret_value = -1;
+ *size = (hsize_t_f)c_size;
+ return ret_value;
}
/****if* H5Pf/h5pset_sieve_buf_size_c
* NAME
@@ -2454,20 +2508,21 @@ h5pget_meta_block_size_c ( hid_t_f *prp_id , hsize_t_f *size)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_sieve_buf_size_c ( hid_t_f *prp_id , size_t_f *size)
+h5pset_sieve_buf_size_c(hid_t_f *prp_id, size_t_f *size)
/******/
{
- int ret_value = 0;
- hid_t c_prp_id;
- size_t c_size;
+ int ret_value = 0;
+ hid_t c_prp_id;
+ size_t c_size;
- c_prp_id = (hid_t)*prp_id;
- c_size = (size_t)*size;
- if ( H5Pset_sieve_buf_size(c_prp_id, c_size) < 0 ) ret_value = -1;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ c_size = (size_t)*size;
+ if (H5Pset_sieve_buf_size(c_prp_id, c_size) < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Pf/h5pget_sieve_buf_size_c
* NAME
@@ -2487,20 +2542,21 @@ h5pset_sieve_buf_size_c ( hid_t_f *prp_id , size_t_f *size)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_sieve_buf_size_c ( hid_t_f *prp_id , size_t_f *size)
+h5pget_sieve_buf_size_c(hid_t_f *prp_id, size_t_f *size)
/******/
{
- int ret_value = 0;
- hid_t c_prp_id;
- size_t c_size;
+ int ret_value = 0;
+ hid_t c_prp_id;
+ size_t c_size;
- c_prp_id = (hid_t)*prp_id;
- if ( H5Pget_sieve_buf_size(c_prp_id, &c_size) < 0 ) ret_value = -1;
- *size = (size_t_f)c_size;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ if (H5Pget_sieve_buf_size(c_prp_id, &c_size) < 0)
+ ret_value = -1;
+ *size = (size_t_f)c_size;
+ return ret_value;
}
/****if* H5Pf/h5pset_small_data_block_size_c
* NAME
@@ -2520,20 +2576,21 @@ h5pget_sieve_buf_size_c ( hid_t_f *prp_id , size_t_f *size)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_small_data_block_size_c ( hid_t_f *prp_id , hsize_t_f *size)
+h5pset_small_data_block_size_c(hid_t_f *prp_id, hsize_t_f *size)
/******/
{
- int ret_value = 0;
- hid_t c_prp_id;
- hsize_t c_size;
+ int ret_value = 0;
+ hid_t c_prp_id;
+ hsize_t c_size;
- c_prp_id = (hid_t)*prp_id;
- c_size = (hsize_t)*size;
- if ( H5Pset_small_data_block_size(c_prp_id, c_size) < 0 ) ret_value = -1;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ c_size = (hsize_t)*size;
+ if (H5Pset_small_data_block_size(c_prp_id, c_size) < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Pf/h5pget_small_data_block_size_c
* NAME
@@ -2553,20 +2610,21 @@ h5pset_small_data_block_size_c ( hid_t_f *prp_id , hsize_t_f *size)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_small_data_block_size_c ( hid_t_f *prp_id , hsize_t_f *size)
+h5pget_small_data_block_size_c(hid_t_f *prp_id, hsize_t_f *size)
/******/
{
- int ret_value = 0;
- hid_t c_prp_id;
- hsize_t c_size;
+ int ret_value = 0;
+ hid_t c_prp_id;
+ hsize_t c_size;
- c_prp_id = (hid_t)*prp_id;
- if ( H5Pget_small_data_block_size(c_prp_id, &c_size) < 0 ) ret_value = -1;
- *size = (hsize_t_f)c_size;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ if (H5Pget_small_data_block_size(c_prp_id, &c_size) < 0)
+ ret_value = -1;
+ *size = (hsize_t_f)c_size;
+ return ret_value;
}
/****if* H5Pf/h5pset_hyper_vector_size_c
* NAME
@@ -2586,20 +2644,21 @@ h5pget_small_data_block_size_c ( hid_t_f *prp_id , hsize_t_f *size)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_hyper_vector_size_c ( hid_t_f *prp_id , size_t_f *size)
+h5pset_hyper_vector_size_c(hid_t_f *prp_id, size_t_f *size)
/******/
{
- int ret_value = 0;
- hid_t c_prp_id;
- size_t c_size;
+ int ret_value = 0;
+ hid_t c_prp_id;
+ size_t c_size;
- c_prp_id = (hid_t)*prp_id;
- c_size = (size_t)*size;
- if ( H5Pset_hyper_vector_size(c_prp_id, c_size) < 0 ) ret_value = -1;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ c_size = (size_t)*size;
+ if (H5Pset_hyper_vector_size(c_prp_id, c_size) < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Pf/h5pget_hyper_vector_size_c
* NAME
@@ -2619,20 +2678,21 @@ h5pset_hyper_vector_size_c ( hid_t_f *prp_id , size_t_f *size)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_hyper_vector_size_c ( hid_t_f *prp_id , size_t_f *size)
+h5pget_hyper_vector_size_c(hid_t_f *prp_id, size_t_f *size)
/******/
{
- int ret_value = 0;
- hid_t c_prp_id;
- size_t c_size;
+ int ret_value = 0;
+ hid_t c_prp_id;
+ size_t c_size;
- c_prp_id = (hid_t)*prp_id;
- if ( H5Pget_hyper_vector_size(c_prp_id, &c_size) < 0 ) ret_value = -1;
- *size = (size_t_f)c_size;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ if (H5Pget_hyper_vector_size(c_prp_id, &c_size) < 0)
+ ret_value = -1;
+ *size = (size_t_f)c_size;
+ return ret_value;
}
/****if* H5Pf/h5pcreate_class_c
@@ -2656,33 +2716,36 @@ h5pget_hyper_vector_size_c ( hid_t_f *prp_id , size_t_f *size)
* Added the callback parameters (FORTRAN 2003 compilers only)
* M. Scot Breitenfeld, July 3, 2008
* SOURCE
-*/
+ */
int_f
-h5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *cls,
- H5P_cls_create_func_t create, void *create_data,
- H5P_cls_copy_func_t copy, void *copy_data,
- H5P_cls_close_func_t close, void *close_data)
+h5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *cls, H5P_cls_create_func_t create,
+ void *create_data, H5P_cls_copy_func_t copy, void *copy_data, H5P_cls_close_func_t close,
+ void *close_data)
/******/
{
- int ret_value = -1;
- hid_t c_class;
- char* c_name;
+ int ret_value = -1;
+ hid_t c_class;
+ char *c_name;
- c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
- if (c_name == NULL) goto DONE;
+ c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
+ if (c_name == NULL)
+ goto DONE;
- /*
- * Call H5Pcreate_class function.
- */
- c_class = H5Pcreate_class((hid_t)*parent, c_name, create, create_data, copy, copy_data, close, close_data);
+ /*
+ * Call H5Pcreate_class function.
+ */
+ c_class =
+ H5Pcreate_class((hid_t)*parent, c_name, create, create_data, copy, copy_data, close, close_data);
- if (c_class < 0) goto DONE;
- *cls = (hid_t_f)c_class;
- ret_value = 0;
+ if (c_class < 0)
+ goto DONE;
+ *cls = (hid_t_f)c_class;
+ ret_value = 0;
DONE:
- if(c_name != NULL) HDfree(c_name);
- return ret_value;
+ if (c_name != NULL)
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Pf/h5pregister_c
@@ -2704,28 +2767,28 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pregister_c(hid_t_f *cls, _fcd name, int_f *name_len, size_t_f *size, void H5_ATTR_UNUSED *value)
/******/
{
- char* c_name = NULL;
- int_f ret_value = -1;
+ char *c_name = NULL;
+ int_f ret_value = -1;
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*name_len)))
- goto DONE;
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*name_len)))
+ goto DONE;
- /*
- * Call H5Pregister2 function.
- */
- if(H5Pregister2((hid_t)*cls, c_name, (size_t)*size, value, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- goto DONE;
- ret_value = 0;
+ /*
+ * Call H5Pregister2 function.
+ */
+ if (H5Pregister2((hid_t)*cls, c_name, (size_t)*size, value, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- if(c_name != NULL)
- HDfree(c_name);
- return ret_value;
+ if (c_name != NULL)
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Pf/h5pinsert_c
@@ -2747,28 +2810,28 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pinsert_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, void H5_ATTR_UNUSED *value)
/******/
{
- char* c_name = NULL;
- int_f ret_value = -1;
+ char *c_name = NULL;
+ int_f ret_value = -1;
- if(NULL == ( c_name = (char *)HD5f2cstring(name, (size_t)*name_len)))
- goto DONE;
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*name_len)))
+ goto DONE;
- /*
- * Call H5Pinsert2 function.
- */
- if(H5Pinsert2((hid_t)*plist, c_name, (size_t)*size, value, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- goto DONE;
- ret_value = 0;
+ /*
+ * Call H5Pinsert2 function.
+ */
+ if (H5Pinsert2((hid_t)*plist, c_name, (size_t)*size, value, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- if(c_name)
- HDfree(c_name);
- return ret_value;
+ if (c_name)
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Pf/h5pexist_c
@@ -2789,29 +2852,31 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pexist_c(hid_t_f *cls, _fcd name, int_f *name_len)
/******/
{
- int_f ret_value = -1;
- hid_t c_class;
- char* c_name;
- htri_t status;
+ int_f ret_value = -1;
+ hid_t c_class;
+ char * c_name;
+ htri_t status;
- c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
- if (c_name == NULL) goto DONE;
+ c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
+ if (c_name == NULL)
+ goto DONE;
- c_class = (hid_t)*cls;
- /*
- * Call H5Pexist function.
- */
- status = H5Pexist(c_class, c_name);
- ret_value = status;
+ c_class = (hid_t)*cls;
+ /*
+ * Call H5Pexist function.
+ */
+ status = H5Pexist(c_class, c_name);
+ ret_value = status;
DONE:
- if(c_name != NULL) HDfree(c_name);
- return ret_value;
+ if (c_name != NULL)
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Pf/h5pisa_class_c
* NAME
@@ -2830,25 +2895,25 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pisa_class_c(hid_t_f *plist, hid_t_f *cls)
/******/
{
- int_f ret_value = -1;
- hid_t c_class;
- hid_t c_plist;
- htri_t status;
+ int_f ret_value = -1;
+ hid_t c_class;
+ hid_t c_plist;
+ htri_t status;
- c_class = (hid_t)*cls;
- c_plist = (hid_t)*plist;
+ c_class = (hid_t)*cls;
+ c_plist = (hid_t)*plist;
- /*
- * Call H5Pisa_class function.
- */
- status = H5Pisa_class(c_plist, c_class);
- ret_value = status;
- return ret_value;
+ /*
+ * Call H5Pisa_class function.
+ */
+ status = H5Pisa_class(c_plist, c_class);
+ ret_value = status;
+ return ret_value;
}
/****if* H5Pf/h5pget_size_c
* NAME
@@ -2869,30 +2934,33 @@ h5pisa_class_c(hid_t_f *plist, hid_t_f *cls)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pget_size_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size)
/******/
{
- int_f ret_value = -1;
- hid_t c_plist;
- char* c_name;
- size_t c_size;
+ int_f ret_value = -1;
+ hid_t c_plist;
+ char * c_name;
+ size_t c_size;
- c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
- if (c_name == NULL) goto DONE;
+ c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
+ if (c_name == NULL)
+ goto DONE;
- c_plist = (hid_t)*plist;
- /*
- * Call H5Pget_size function.
- */
- if( H5Pget_size(c_plist, c_name, &c_size) < 0) goto DONE;
- *size = (size_t_f)c_size;
- ret_value = 0;
+ c_plist = (hid_t)*plist;
+ /*
+ * Call H5Pget_size function.
+ */
+ if (H5Pget_size(c_plist, c_name, &c_size) < 0)
+ goto DONE;
+ *size = (size_t_f)c_size;
+ ret_value = 0;
DONE:
- if(c_name != NULL) HDfree(c_name);
- return ret_value;
+ if (c_name != NULL)
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Pf/h5pget_nprops_c
* NAME
@@ -2911,25 +2979,26 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pget_nprops_c(hid_t_f *plist, size_t_f *nprops)
/******/
{
- int_f ret_value = -1;
- hid_t c_plist;
- size_t c_nprops;
+ int_f ret_value = -1;
+ hid_t c_plist;
+ size_t c_nprops;
- c_plist = (hid_t)*plist;
+ c_plist = (hid_t)*plist;
- /*
- * Call H5Pget_nprops function.
- */
- if( H5Pget_nprops(c_plist, &c_nprops) < 0) return ret_value;
+ /*
+ * Call H5Pget_nprops function.
+ */
+ if (H5Pget_nprops(c_plist, &c_nprops) < 0)
+ return ret_value;
- *nprops = (size_t_f)c_nprops;
- ret_value = 0;
- return ret_value;
+ *nprops = (size_t_f)c_nprops;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_class_parent_c
* NAME
@@ -2949,26 +3018,27 @@ h5pget_nprops_c(hid_t_f *plist, size_t_f *nprops)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pget_class_parent_c(hid_t_f *prp_id, hid_t_f *parent_id)
/******/
{
- int_f ret_value = -1;
- hid_t c_prp_id;
- hid_t c_parent_id;
+ int_f ret_value = -1;
+ hid_t c_prp_id;
+ hid_t c_parent_id;
- c_prp_id = (hid_t)*prp_id;
+ c_prp_id = (hid_t)*prp_id;
- /*
- * Call H5Pget_class_parent function.
- */
- c_parent_id = H5Pget_class_parent(c_prp_id);
- if( c_parent_id < 0) return ret_value;
+ /*
+ * Call H5Pget_class_parent function.
+ */
+ c_parent_id = H5Pget_class_parent(c_prp_id);
+ if (c_parent_id < 0)
+ return ret_value;
- *parent_id =(hid_t_f)c_parent_id;
- ret_value = 0;
- return ret_value;
+ *parent_id = (hid_t_f)c_parent_id;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pcopy_prop_c
* NAME
@@ -2989,29 +3059,32 @@ h5pget_class_parent_c(hid_t_f *prp_id, hid_t_f *parent_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pcopy_prop_c(hid_t_f *dst_id, hid_t_f *src_id, _fcd name, int_f *name_len)
/******/
{
- int_f ret_value = -1;
- hid_t c_dst_id, c_src_id;
- char* c_name;
+ int_f ret_value = -1;
+ hid_t c_dst_id, c_src_id;
+ char *c_name;
- c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
- if (c_name == NULL) goto DONE;
+ c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
+ if (c_name == NULL)
+ goto DONE;
- c_dst_id = (hid_t)*dst_id;
- c_src_id = (hid_t)*src_id;
- /*
- * Call H5Pcopy_prop function.
- */
- if( H5Pcopy_prop(c_dst_id, c_src_id, c_name) < 0) goto DONE;
- ret_value = 0;
+ c_dst_id = (hid_t)*dst_id;
+ c_src_id = (hid_t)*src_id;
+ /*
+ * Call H5Pcopy_prop function.
+ */
+ if (H5Pcopy_prop(c_dst_id, c_src_id, c_name) < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- if(c_name != NULL) HDfree(c_name);
- return ret_value;
+ if (c_name != NULL)
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Pf/h5premove_c
* NAME
@@ -3030,28 +3103,31 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5premove_c(hid_t_f *plid, _fcd name, int_f *name_len)
/******/
{
- int_f ret_value = -1;
- hid_t c_plid;
- char* c_name;
+ int_f ret_value = -1;
+ hid_t c_plid;
+ char *c_name;
- c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
- if (c_name == NULL) goto DONE;
+ c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
+ if (c_name == NULL)
+ goto DONE;
- c_plid = (hid_t)*plid;
- /*
- * Call H5Premove function.
- */
- if( H5Premove(c_plid, c_name) < 0) goto DONE;
- ret_value = 0;
+ c_plid = (hid_t)*plid;
+ /*
+ * Call H5Premove function.
+ */
+ if (H5Premove(c_plid, c_name) < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- if(c_name != NULL) HDfree(c_name);
- return ret_value;
+ if (c_name != NULL)
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Pf/h5punregister_c
* NAME
@@ -3070,28 +3146,31 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5punregister_c(hid_t_f *cls, _fcd name, int_f *name_len)
/******/
{
- int_f ret_value = -1;
- hid_t c_class;
- char* c_name;
+ int_f ret_value = -1;
+ hid_t c_class;
+ char *c_name;
- c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
- if (c_name == NULL) goto DONE;
+ c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
+ if (c_name == NULL)
+ goto DONE;
- c_class = (hid_t)*cls;
- /*
- * Call H5Punregister function.
- */
- if( H5Punregister(c_class, c_name) < 0) goto DONE;
- ret_value = 0;
+ c_class = (hid_t)*cls;
+ /*
+ * Call H5Punregister function.
+ */
+ if (H5Punregister(c_class, c_name) < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- if(c_name != NULL) HDfree(c_name);
- return ret_value;
+ if (c_name != NULL)
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Pf/h5pclose_class_c
* NAME
@@ -3108,21 +3187,22 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pclose_class_c(hid_t_f *cls)
/******/
{
- int_f ret_value = -1;
- hid_t c_class;
+ int_f ret_value = -1;
+ hid_t c_class;
- c_class = (hid_t)*cls;
- /*
- * Call H5Pclose_class function.
- */
- if( H5Pclose_class(c_class) < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ c_class = (hid_t)*cls;
+ /*
+ * Call H5Pclose_class function.
+ */
+ if (H5Pclose_class(c_class) < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_class_name_c
@@ -3142,29 +3222,29 @@ h5pclose_class_c(hid_t_f *cls)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pget_class_name_c(hid_t_f *cls, _fcd name, int_f *name_len)
/******/
{
- int_f ret_value = -1;
+ int_f ret_value = -1;
- /* Buffer to return name by C function */
- char *c_name;
+ /* Buffer to return name by C function */
+ char *c_name;
- /*
- * Call H5Pget_class_name function. c_name is allocated by the library,
- * has to be freed by application.
- */
- if(NULL == (c_name = H5Pget_class_name((hid_t)*cls)))
- goto DONE;
+ /*
+ * Call H5Pget_class_name function. c_name is allocated by the library,
+ * has to be freed by application.
+ */
+ if (NULL == (c_name = H5Pget_class_name((hid_t)*cls)))
+ goto DONE;
- HD5packFstring(c_name, _fcdtocp(name), (size_t)*name_len);
- ret_value = (int_f)HDstrlen(c_name);
- H5free_memory(c_name);
+ HD5packFstring(c_name, _fcdtocp(name), (size_t)*name_len);
+ ret_value = (int_f)HDstrlen(c_name);
+ H5free_memory(c_name);
DONE:
- return ret_value;
+ return ret_value;
}
/****if* H5Pf/h5pset_c
@@ -3185,26 +3265,29 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pset_c(hid_t_f *plist, _fcd name, int_f *name_len, void *value)
/******/
{
- int_f ret_value = -1;
- char* c_name;
+ int_f ret_value = -1;
+ char *c_name;
- c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
- if (c_name == NULL) goto DONE;
+ c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
+ if (c_name == NULL)
+ goto DONE;
- /*
- * Call H5Pset function.
- */
- if( H5Pset((hid_t)*plist, c_name, value) <0) goto DONE;
- ret_value = 0;
+ /*
+ * Call H5Pset function.
+ */
+ if (H5Pset((hid_t)*plist, c_name, value) < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- if(c_name != NULL) HDfree(c_name);
- return ret_value;
+ if (c_name != NULL)
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Pf/h5pget_c
@@ -3226,26 +3309,29 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pget_c(hid_t_f *plist, _fcd name, int_f *name_len, void *value)
/******/
{
- int_f ret_value = -1;
- char* c_name;
+ int_f ret_value = -1;
+ char *c_name;
- c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
- if (c_name == NULL) goto DONE;
+ c_name = (char *)HD5f2cstring(name, (size_t)*name_len);
+ if (c_name == NULL)
+ goto DONE;
- /*
- * Call H5Pset function.
- */
- if( H5Pget((hid_t)*plist, c_name, value) <0) goto DONE;
- ret_value = 0;
+ /*
+ * Call H5Pset function.
+ */
+ if (H5Pget((hid_t)*plist, c_name, value) < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- if(c_name != NULL) HDfree(c_name);
- return ret_value;
+ if (c_name != NULL)
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Pf/h5pset_shuffle_c
@@ -3264,20 +3350,21 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_shuffle_c ( hid_t_f *prp_id )
+h5pset_shuffle_c(hid_t_f *prp_id)
/******/
{
- int_f ret_value = 0;
- hid_t c_prp_id;
- herr_t status;
+ int_f ret_value = 0;
+ hid_t c_prp_id;
+ herr_t status;
- c_prp_id = (hid_t)*prp_id;
- status = H5Pset_shuffle(c_prp_id);
- if ( status < 0 ) ret_value = -1;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ status = H5Pset_shuffle(c_prp_id);
+ if (status < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Pf/h5pset_fletcher32_c
* NAME
@@ -3294,20 +3381,21 @@ h5pset_shuffle_c ( hid_t_f *prp_id )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_fletcher32_c ( hid_t_f *prp_id )
+h5pset_fletcher32_c(hid_t_f *prp_id)
/******/
{
- int_f ret_value = 0;
- hid_t c_prp_id;
- herr_t status;
+ int_f ret_value = 0;
+ hid_t c_prp_id;
+ herr_t status;
- c_prp_id = (hid_t)*prp_id;
- status = H5Pset_fletcher32(c_prp_id);
- if ( status < 0 ) ret_value = -1;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ status = H5Pset_fletcher32(c_prp_id);
+ if (status < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Pf/h5pset_edc_check_c
@@ -3326,22 +3414,23 @@ h5pset_fletcher32_c ( hid_t_f *prp_id )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_edc_check_c ( hid_t_f *prp_id, int_f *flag )
+h5pset_edc_check_c(hid_t_f *prp_id, int_f *flag)
/******/
{
- int_f ret_value = 0;
- hid_t c_prp_id;
- H5Z_EDC_t c_flag;
- herr_t status;
+ int_f ret_value = 0;
+ hid_t c_prp_id;
+ H5Z_EDC_t c_flag;
+ herr_t status;
- c_prp_id = (hid_t)*prp_id;
- c_flag = (H5Z_EDC_t)*flag;
- status = H5Pset_edc_check(c_prp_id, c_flag);
- if ( status < 0 ) ret_value = -1;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ c_flag = (H5Z_EDC_t)*flag;
+ status = H5Pset_edc_check(c_prp_id, c_flag);
+ if (status < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Pf/h5pget_edc_check_c
@@ -3360,21 +3449,22 @@ h5pset_edc_check_c ( hid_t_f *prp_id, int_f *flag )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_edc_check_c ( hid_t_f *prp_id, int_f *flag )
+h5pget_edc_check_c(hid_t_f *prp_id, int_f *flag)
/******/
{
- int_f ret_value = 0;
- hid_t c_prp_id;
- H5Z_EDC_t c_flag;
+ int_f ret_value = 0;
+ hid_t c_prp_id;
+ H5Z_EDC_t c_flag;
- c_prp_id = (hid_t)*prp_id;
- c_flag = H5Pget_edc_check(c_prp_id);
- if ( c_flag < 0 ) ret_value = -1;
- *flag = (int_f)c_flag;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ c_flag = H5Pget_edc_check(c_prp_id);
+ if (c_flag < 0)
+ ret_value = -1;
+ *flag = (int_f)c_flag;
+ return ret_value;
}
/****if* H5Pf/h5pset_family_offset_c
* NAME
@@ -3392,22 +3482,23 @@ h5pget_edc_check_c ( hid_t_f *prp_id, int_f *flag )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_family_offset_c ( hid_t_f *prp_id , hsize_t_f *offset)
+h5pset_family_offset_c(hid_t_f *prp_id, hsize_t_f *offset)
/******/
{
- int_f ret_value = 0;
- hid_t c_prp_id;
- hsize_t c_offset;
- herr_t status;
+ int_f ret_value = 0;
+ hid_t c_prp_id;
+ hsize_t c_offset;
+ herr_t status;
- c_prp_id = (hid_t)*prp_id;
- c_offset = (hsize_t)*offset;
- status = H5Pset_family_offset(c_prp_id, c_offset);
- if ( status < 0 ) ret_value = -1;
- return ret_value;
+ c_prp_id = (hid_t)*prp_id;
+ c_offset = (hsize_t)*offset;
+ status = H5Pset_family_offset(c_prp_id, c_offset);
+ if (status < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Pf/h5pset_fapl_multi_c
@@ -3431,74 +3522,81 @@ h5pset_family_offset_c ( hid_t_f *prp_id , hsize_t_f *offset)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
/*
* h5pset_fapl_multi_c(hid_t_f *prp_id , int_f *memb_map, hid_t_f *memb_fapl, _fcd memb_name,
* int_f *len, int_f *lenmax, haddr_t_f *memb_addr, int_f *flag)
*/
-h5pset_fapl_multi_c ( hid_t_f *prp_id , int_f *memb_map, hid_t_f *memb_fapl, _fcd memb_name, int_f *len, int_f *lenmax, real_f *memb_addr, int_f *flag)
-/******/
-{
- int_f ret_value = -1;
- hid_t c_prp_id;
- H5FD_mem_t c_memb_map[H5FD_MEM_NTYPES];
- hid_t c_memb_fapl[H5FD_MEM_NTYPES];
- char *c_memb_name[H5FD_MEM_NTYPES];
- haddr_t c_memb_addr[H5FD_MEM_NTYPES];
- hbool_t relax;
- herr_t status;
- char *tmp, *tmp_p, *tmp_pp;
- int i;
- int c_lenmax;
- long double tmp_max_addr;
- c_lenmax = (int)*lenmax;
- relax = (hbool_t)*flag;
-/*
- * Check that we got correct values from Fortran for memb_addr array
- */
- for (i=0; i < H5FD_MEM_NTYPES; i++) {
- if(memb_addr[i] >= 1.0f) return ret_value;
- }
-/*
- * Take care of names array
- */
-
- tmp = (char *)HD5f2cstring(memb_name, (size_t)c_lenmax*(H5FD_MEM_NTYPES));
- if (tmp ==NULL) return ret_value;
- tmp_p = tmp;
- for (i=0; i < H5FD_MEM_NTYPES; i++) {
- c_memb_name[i] = (char *)HDmalloc((size_t)len[i] + 1);
- HDmemcpy(c_memb_name[i], tmp_p, (size_t)len[i]);
- tmp_pp = c_memb_name[i];
- tmp_pp[len[i]] = '\0';
- tmp_p = tmp_p + c_lenmax;
- }
-/*
- * Take care of othe arguments
- */
- tmp_max_addr = (long double)(HADDR_MAX);
- c_prp_id = (hid_t)*prp_id;
- for (i=0; i < H5FD_MEM_NTYPES; i++) {
- c_memb_map[i] = (H5FD_mem_t)memb_map[i];
- c_memb_fapl[i] = (hid_t)memb_fapl[i];
- if(memb_addr[i] < 0) c_memb_addr[i] = HADDR_UNDEF;
- else c_memb_addr[i] = (haddr_t)(((float)memb_addr[i])*(tmp_max_addr));
- }
-/*
- * Call H5Pset_fapl_multi function
- */
+h5pset_fapl_multi_c(hid_t_f *prp_id, int_f *memb_map, hid_t_f *memb_fapl, _fcd memb_name, int_f *len,
+ int_f *lenmax, real_f *memb_addr, int_f *flag)
+/******/
+{
+ int_f ret_value = -1;
+ hid_t c_prp_id;
+ H5FD_mem_t c_memb_map[H5FD_MEM_NTYPES];
+ hid_t c_memb_fapl[H5FD_MEM_NTYPES];
+ char * c_memb_name[H5FD_MEM_NTYPES];
+ haddr_t c_memb_addr[H5FD_MEM_NTYPES];
+ hbool_t relax;
+ herr_t status;
+ char * tmp, *tmp_p, *tmp_pp;
+ int i;
+ int c_lenmax;
+ long double tmp_max_addr;
+ c_lenmax = (int)*lenmax;
+ relax = (hbool_t)*flag;
+ /*
+ * Check that we got correct values from Fortran for memb_addr array
+ */
+ for (i = 0; i < H5FD_MEM_NTYPES; i++) {
+ if (memb_addr[i] >= 1.0f)
+ return ret_value;
+ }
+ /*
+ * Take care of names array
+ */
- status = H5Pset_fapl_multi(c_prp_id, c_memb_map, c_memb_fapl, (const char * const *)c_memb_name, c_memb_addr, relax);
- if ( status < 0 ) goto DONE;
- ret_value = 0;
+ tmp = (char *)HD5f2cstring(memb_name, (size_t)c_lenmax * (H5FD_MEM_NTYPES));
+ if (tmp == NULL)
+ return ret_value;
+ tmp_p = tmp;
+ for (i = 0; i < H5FD_MEM_NTYPES; i++) {
+ c_memb_name[i] = (char *)HDmalloc((size_t)len[i] + 1);
+ HDmemcpy(c_memb_name[i], tmp_p, (size_t)len[i]);
+ tmp_pp = c_memb_name[i];
+ tmp_pp[len[i]] = '\0';
+ tmp_p = tmp_p + c_lenmax;
+ }
+ /*
+ * Take care of othe arguments
+ */
+ tmp_max_addr = (long double)(HADDR_MAX);
+ c_prp_id = (hid_t)*prp_id;
+ for (i = 0; i < H5FD_MEM_NTYPES; i++) {
+ c_memb_map[i] = (H5FD_mem_t)memb_map[i];
+ c_memb_fapl[i] = (hid_t)memb_fapl[i];
+ if (memb_addr[i] < 0)
+ c_memb_addr[i] = HADDR_UNDEF;
+ else
+ c_memb_addr[i] = (haddr_t)(((float)memb_addr[i]) * (tmp_max_addr));
+ }
+ /*
+ * Call H5Pset_fapl_multi function
+ */
+
+ status = H5Pset_fapl_multi(c_prp_id, c_memb_map, c_memb_fapl, (const char *const *)c_memb_name,
+ c_memb_addr, relax);
+ if (status < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- HDfree(tmp);
- for (i=0; i < H5FD_MEM_NTYPES; i++)
- HDfree(c_memb_name[i]);
- return ret_value;
+ HDfree(tmp);
+ for (i = 0; i < H5FD_MEM_NTYPES; i++)
+ HDfree(c_memb_name[i]);
+ return ret_value;
}
/****if* H5Pf/h5pset_fapl_multi_sc
@@ -3516,27 +3614,28 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_fapl_multi_sc ( hid_t_f *prp_id , int_f *flag)
+h5pset_fapl_multi_sc(hid_t_f *prp_id, int_f *flag)
/******/
{
- int_f ret_value = -1;
- hid_t c_prp_id;
- hbool_t relax;
- herr_t status;
+ int_f ret_value = -1;
+ hid_t c_prp_id;
+ hbool_t relax;
+ herr_t status;
- relax = (hbool_t)*flag;
- c_prp_id = (hid_t)*prp_id;
-/*
- * Call H5Pset_fapl_multi function
- */
+ relax = (hbool_t)*flag;
+ c_prp_id = (hid_t)*prp_id;
+ /*
+ * Call H5Pset_fapl_multi function
+ */
- status = H5Pset_fapl_multi(c_prp_id, NULL, NULL, NULL, NULL, relax);
- if ( status < 0 ) return ret_value; /* error occurred */
- ret_value = 0;
- return ret_value;
+ status = H5Pset_fapl_multi(c_prp_id, NULL, NULL, NULL, NULL, relax);
+ if (status < 0)
+ return ret_value; /* error occurred */
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_fapl_multi_c
* NAME
@@ -3560,66 +3659,70 @@ h5pset_fapl_multi_sc ( hid_t_f *prp_id , int_f *flag)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_fapl_multi_c ( hid_t_f *prp_id , int_f *memb_map, hid_t_f *memb_fapl, _fcd memb_name, int_f *len, int_f *lenmax, real_f *memb_addr, int_f *flag, int_f *maxlen_out)
+h5pget_fapl_multi_c(hid_t_f *prp_id, int_f *memb_map, hid_t_f *memb_fapl, _fcd memb_name, int_f *len,
+ int_f *lenmax, real_f *memb_addr, int_f *flag, int_f *maxlen_out)
/******/
{
- int_f ret_value = -1;
- hid_t c_prp_id;
- H5FD_mem_t c_memb_map[H5FD_MEM_NTYPES];
- hid_t c_memb_fapl[H5FD_MEM_NTYPES];
- char *c_memb_name[H5FD_MEM_NTYPES];
- haddr_t c_memb_addr[H5FD_MEM_NTYPES];
- hbool_t relax;
- herr_t status;
- char *tmp, *tmp_p;
- int i;
- size_t c_lenmax;
- size_t length = 0;
- c_lenmax = (size_t)*lenmax;
+ int_f ret_value = -1;
+ hid_t c_prp_id;
+ H5FD_mem_t c_memb_map[H5FD_MEM_NTYPES];
+ hid_t c_memb_fapl[H5FD_MEM_NTYPES];
+ char * c_memb_name[H5FD_MEM_NTYPES];
+ haddr_t c_memb_addr[H5FD_MEM_NTYPES];
+ hbool_t relax;
+ herr_t status;
+ char * tmp, *tmp_p;
+ int i;
+ size_t c_lenmax;
+ size_t length = 0;
+ c_lenmax = (size_t)*lenmax;
- c_prp_id = (hid_t)*prp_id;
-/*
- * Call H5Pget_fapl_multi function
- */
+ c_prp_id = (hid_t)*prp_id;
+ /*
+ * Call H5Pget_fapl_multi function
+ */
- status = H5Pget_fapl_multi(c_prp_id, c_memb_map, c_memb_fapl, c_memb_name, c_memb_addr, &relax);
- if ( status < 0 ) return ret_value;
+ status = H5Pget_fapl_multi(c_prp_id, c_memb_map, c_memb_fapl, c_memb_name, c_memb_addr, &relax);
+ if (status < 0)
+ return ret_value;
-/*
- * Take care of names array
- */
- tmp = (char *)HDmalloc(c_lenmax*H5FD_MEM_NTYPES + 1);
- tmp_p = tmp;
- HDmemset(tmp,' ', c_lenmax*H5FD_MEM_NTYPES);
- tmp[c_lenmax*H5FD_MEM_NTYPES] = '\0';
- for (i=0; i < H5FD_MEM_NTYPES; i++) {
- memcpy(tmp_p, c_memb_name[i], strlen(c_memb_name[i]));
- len[i] = (int_f)strlen(c_memb_name[i]);
- length = H5_MAX(length, strlen(c_memb_name[i]));
- tmp_p = tmp_p + c_lenmax;
- }
-HD5packFstring(tmp, _fcdtocp(memb_name), (size_t)(c_lenmax*H5FD_MEM_NTYPES));
+ /*
+ * Take care of names array
+ */
+ tmp = (char *)HDmalloc(c_lenmax * H5FD_MEM_NTYPES + 1);
+ tmp_p = tmp;
+ HDmemset(tmp, ' ', c_lenmax * H5FD_MEM_NTYPES);
+ tmp[c_lenmax * H5FD_MEM_NTYPES] = '\0';
+ for (i = 0; i < H5FD_MEM_NTYPES; i++) {
+ memcpy(tmp_p, c_memb_name[i], strlen(c_memb_name[i]));
+ len[i] = (int_f)strlen(c_memb_name[i]);
+ length = H5_MAX(length, strlen(c_memb_name[i]));
+ tmp_p = tmp_p + c_lenmax;
+ }
+ HD5packFstring(tmp, _fcdtocp(memb_name), (size_t)(c_lenmax * H5FD_MEM_NTYPES));
-/*
- * Take care of other arguments
- */
+ /*
+ * Take care of other arguments
+ */
- for (i=0; i < H5FD_MEM_NTYPES; i++) {
- memb_map[i] = (int_f)c_memb_map[i];
- memb_fapl[i] = (hid_t_f)c_memb_fapl[i];
- if(c_memb_addr[i] == HADDR_UNDEF) memb_addr[i] = -1;
- else memb_addr[i] = (real_f) (c_memb_addr[i]/HADDR_MAX);
- }
- *flag = (int_f)relax;
- *maxlen_out = (int_f)length;
- ret_value = 0;
- HDfree(tmp);
- for (i=0; i < H5FD_MEM_NTYPES; i++)
- HDfree(c_memb_name[i]);
- return ret_value;
+ for (i = 0; i < H5FD_MEM_NTYPES; i++) {
+ memb_map[i] = (int_f)c_memb_map[i];
+ memb_fapl[i] = (hid_t_f)c_memb_fapl[i];
+ if (c_memb_addr[i] == HADDR_UNDEF)
+ memb_addr[i] = -1;
+ else
+ memb_addr[i] = (real_f)(c_memb_addr[i] / HADDR_MAX);
+ }
+ *flag = (int_f)relax;
+ *maxlen_out = (int_f)length;
+ ret_value = 0;
+ HDfree(tmp);
+ for (i = 0; i < H5FD_MEM_NTYPES; i++)
+ HDfree(c_memb_name[i]);
+ return ret_value;
}
/****if* H5Pf/h5pset_szip_c
@@ -3639,29 +3742,30 @@ HD5packFstring(tmp, _fcdtocp(memb_name), (size_t)(c_lenmax*H5FD_MEM_NTYPES));
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_szip_c ( hid_t_f *prp_id , int_f *options_mask, int_f *pixels_per_block)
+h5pset_szip_c(hid_t_f *prp_id, int_f *options_mask, int_f *pixels_per_block)
/******/
{
- int_f ret_value = -1;
- hid_t c_prp_id;
- unsigned c_options_mask;
- unsigned c_pixels_per_block;
- herr_t status;
+ int_f ret_value = -1;
+ hid_t c_prp_id;
+ unsigned c_options_mask;
+ unsigned c_pixels_per_block;
+ herr_t status;
- c_prp_id = (hid_t)*prp_id;
- c_options_mask = (unsigned)*options_mask;
- c_pixels_per_block = (unsigned)*pixels_per_block;
-/*
- * Call H5Pset_szip function
- */
+ c_prp_id = (hid_t)*prp_id;
+ c_options_mask = (unsigned)*options_mask;
+ c_pixels_per_block = (unsigned)*pixels_per_block;
+ /*
+ * Call H5Pset_szip function
+ */
- status = H5Pset_szip(c_prp_id, c_options_mask, c_pixels_per_block);
- if ( status < 0 ) return ret_value;
- ret_value = 0;
- return ret_value;
+ status = H5Pset_szip(c_prp_id, c_options_mask, c_pixels_per_block);
+ if (status < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pall_filters_avail_c
* NAME
@@ -3680,28 +3784,29 @@ h5pset_szip_c ( hid_t_f *prp_id , int_f *options_mask, int_f *pixels_per_block)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pall_filters_avail_c ( hid_t_f *prp_id , int_f *status)
+h5pall_filters_avail_c(hid_t_f *prp_id, int_f *status)
/******/
{
- int_f ret_value = -1;
- hid_t c_prp_id;
- htri_t c_status;
-
+ int_f ret_value = -1;
+ hid_t c_prp_id;
+ htri_t c_status;
- c_prp_id = (hid_t)*prp_id;
-/*
- * Call H5Pall_filters_avail function
- */
+ c_prp_id = (hid_t)*prp_id;
+ /*
+ * Call H5Pall_filters_avail function
+ */
- c_status = H5Pall_filters_avail(c_prp_id);
- if ( c_status < 0 ) return ret_value;
- *status = 0;
- if (c_status == 1) *status = 1;
- ret_value = 0;
- return ret_value;
+ c_status = H5Pall_filters_avail(c_prp_id);
+ if (c_status < 0)
+ return ret_value;
+ *status = 0;
+ if (c_status == 1)
+ *status = 1;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_filter_by_id_c
@@ -3728,44 +3833,46 @@ h5pall_filters_avail_c ( hid_t_f *prp_id , int_f *status)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_filter_by_id_c(hid_t_f *prp_id, int_f* filter_id, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name)
+h5pget_filter_by_id_c(hid_t_f *prp_id, int_f *filter_id, int_f *flags, size_t_f *cd_nelmts, int_f *cd_values,
+ size_t_f *namelen, _fcd name)
/******/
{
- unsigned int c_flags;
- size_t c_cd_nelmts = (size_t)*cd_nelmts;
- size_t c_cd_nelmts_in = (size_t)*cd_nelmts;
- unsigned int *c_cd_values = NULL;
- char *c_name = NULL;
- unsigned i;
- int_f ret_value = -1;
-
- if(NULL == (c_name = (char *)HDmalloc((size_t)*namelen + 1)))
- goto DONE;
+ unsigned int c_flags;
+ size_t c_cd_nelmts = (size_t)*cd_nelmts;
+ size_t c_cd_nelmts_in = (size_t)*cd_nelmts;
+ unsigned int *c_cd_values = NULL;
+ char * c_name = NULL;
+ unsigned i;
+ int_f ret_value = -1;
+
+ if (NULL == (c_name = (char *)HDmalloc((size_t)*namelen + 1)))
+ goto DONE;
- if(NULL == (c_cd_values = (unsigned int *)HDmalloc(sizeof(unsigned int) * c_cd_nelmts_in)))
- goto DONE;
+ if (NULL == (c_cd_values = (unsigned int *)HDmalloc(sizeof(unsigned int) * c_cd_nelmts_in)))
+ goto DONE;
- /*
- * Call H5Pget_filter_by_id2 function.
- */
- if(H5Pget_filter_by_id2((hid_t)*prp_id, (H5Z_filter_t)*filter_id, &c_flags, &c_cd_nelmts, c_cd_values, (size_t)*namelen, c_name, NULL) < 0)
- goto DONE;
+ /*
+ * Call H5Pget_filter_by_id2 function.
+ */
+ if (H5Pget_filter_by_id2((hid_t)*prp_id, (H5Z_filter_t)*filter_id, &c_flags, &c_cd_nelmts, c_cd_values,
+ (size_t)*namelen, c_name, NULL) < 0)
+ goto DONE;
- *cd_nelmts = (size_t_f)c_cd_nelmts;
- *flags = (int_f)c_flags;
- HD5packFstring(c_name, _fcdtocp(name), HDstrlen(c_name));
+ *cd_nelmts = (size_t_f)c_cd_nelmts;
+ *flags = (int_f)c_flags;
+ HD5packFstring(c_name, _fcdtocp(name), HDstrlen(c_name));
- for(i = 0; i < c_cd_nelmts_in; i++)
- cd_values[i] = (int_f)c_cd_values[i];
+ for (i = 0; i < c_cd_nelmts_in; i++)
+ cd_values[i] = (int_f)c_cd_values[i];
- ret_value = 0;
+ ret_value = 0;
DONE:
- if(c_name)
+ if (c_name)
HDfree(c_name);
- if(c_cd_values)
+ if (c_cd_values)
HDfree(c_cd_values);
return ret_value;
@@ -3791,36 +3898,38 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pmodify_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values )
+h5pmodify_filter_c(hid_t_f *prp_id, int_f *filter, int_f *flags, size_t_f *cd_nelmts, int_f *cd_values)
/******/
{
- int_f ret_value = -1;
- hid_t c_prp_id = (hid_t)*prp_id;
- herr_t ret;
- size_t c_cd_nelmts = (size_t)*cd_nelmts;
- unsigned int c_flags = (unsigned)*flags;
- H5Z_filter_t c_filter = (H5Z_filter_t)*filter;
- unsigned int * c_cd_values;
- unsigned i;
+ int_f ret_value = -1;
+ hid_t c_prp_id = (hid_t)*prp_id;
+ herr_t ret;
+ size_t c_cd_nelmts = (size_t)*cd_nelmts;
+ unsigned int c_flags = (unsigned)*flags;
+ H5Z_filter_t c_filter = (H5Z_filter_t)*filter;
+ unsigned int *c_cd_values;
+ unsigned i;
- c_cd_values = (unsigned int *)HDmalloc(sizeof(unsigned int) * c_cd_nelmts);
- if (!c_cd_values) return ret_value;
- for (i = 0; i < c_cd_nelmts; i++)
- c_cd_values[i] = (unsigned int)cd_values[i];
+ c_cd_values = (unsigned int *)HDmalloc(sizeof(unsigned int) * c_cd_nelmts);
+ if (!c_cd_values)
+ return ret_value;
+ for (i = 0; i < c_cd_nelmts; i++)
+ c_cd_values[i] = (unsigned int)cd_values[i];
- /*
- * Call H5Pmodify_filter function.
- */
- ret = H5Pmodify_filter(c_prp_id, c_filter, c_flags, c_cd_nelmts,c_cd_values );
+ /*
+ * Call H5Pmodify_filter function.
+ */
+ ret = H5Pmodify_filter(c_prp_id, c_filter, c_flags, c_cd_nelmts, c_cd_values);
- if (ret < 0) goto DONE;
- ret_value = 0;
+ if (ret < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- HDfree(c_cd_values);
- return ret_value;
+ HDfree(c_cd_values);
+ return ret_value;
}
/****if* H5Pf/h5premove_filter_c
@@ -3839,26 +3948,27 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5premove_filter_c (hid_t_f *prp_id, int_f* filter)
+h5premove_filter_c(hid_t_f *prp_id, int_f *filter)
/******/
{
- int_f ret_value = -1;
- hid_t c_prp_id;
- H5Z_filter_t c_filter;
+ int_f ret_value = -1;
+ hid_t c_prp_id;
+ H5Z_filter_t c_filter;
- c_filter = (H5Z_filter_t)*filter;
- c_prp_id = (hid_t)*prp_id;
+ c_filter = (H5Z_filter_t)*filter;
+ c_prp_id = (hid_t)*prp_id;
- /*
- * Call H5Premove_filter function.
- */
- if(H5Premove_filter(c_prp_id, c_filter) < 0) goto DONE;
- ret_value = 0;
+ /*
+ * Call H5Premove_filter function.
+ */
+ if (H5Premove_filter(c_prp_id, c_filter) < 0)
+ goto DONE;
+ ret_value = 0;
DONE:
- return ret_value;
+ return ret_value;
}
/****if* H5Pf/h5pget_attr_phase_change_c
@@ -3880,27 +3990,28 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_attr_phase_change_c(hid_t_f *ocpl_id, int_f *max_compact, int_f *min_dense )
+h5pget_attr_phase_change_c(hid_t_f *ocpl_id, int_f *max_compact, int_f *min_dense)
/******/
{
- int ret_value = -1;
- hid_t c_ocpl_id;
- unsigned c_max_compact;
- unsigned c_min_dense;
- herr_t ret;
- /*
- * Call H5Pget_attr_phase_change function.
- */
- c_ocpl_id = (hid_t)*ocpl_id;
- ret = H5Pget_attr_phase_change(c_ocpl_id, &c_max_compact,&c_min_dense);
- if (ret < 0) return ret_value;
-
- *max_compact = (int_f)c_max_compact;
- *min_dense = (int_f)c_min_dense;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_ocpl_id;
+ unsigned c_max_compact;
+ unsigned c_min_dense;
+ herr_t ret;
+ /*
+ * Call H5Pget_attr_phase_change function.
+ */
+ c_ocpl_id = (hid_t)*ocpl_id;
+ ret = H5Pget_attr_phase_change(c_ocpl_id, &c_max_compact, &c_min_dense);
+ if (ret < 0)
+ return ret_value;
+
+ *max_compact = (int_f)c_max_compact;
+ *min_dense = (int_f)c_min_dense;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_attr_creation_order_c
@@ -3921,24 +4032,25 @@ h5pget_attr_phase_change_c(hid_t_f *ocpl_id, int_f *max_compact, int_f *min_dens
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_attr_creation_order_c(hid_t_f *ocpl_id, int_f *crt_order_flags )
+h5pset_attr_creation_order_c(hid_t_f *ocpl_id, int_f *crt_order_flags)
/******/
{
- int ret_value = -1;
- unsigned c_crt_order_flags;
- herr_t ret;
- /*
- * Call h5pset_attr_creation_order function.
- */
- c_crt_order_flags = (unsigned)*crt_order_flags;
- ret = H5Pset_attr_creation_order((hid_t)*ocpl_id, c_crt_order_flags);
- if (ret < 0) return ret_value;
+ int ret_value = -1;
+ unsigned c_crt_order_flags;
+ herr_t ret;
+ /*
+ * Call h5pset_attr_creation_order function.
+ */
+ c_crt_order_flags = (unsigned)*crt_order_flags;
+ ret = H5Pset_attr_creation_order((hid_t)*ocpl_id, c_crt_order_flags);
+ if (ret < 0)
+ return ret_value;
- *crt_order_flags = (int_f)c_crt_order_flags;
- ret_value = 0;
- return ret_value;
+ *crt_order_flags = (int_f)c_crt_order_flags;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_shared_mesg_nindexes_c
@@ -3963,25 +4075,26 @@ h5pset_attr_creation_order_c(hid_t_f *ocpl_id, int_f *crt_order_flags )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_shared_mesg_nindexes_c(hid_t_f *plist_id, int_f *nindexes )
+h5pset_shared_mesg_nindexes_c(hid_t_f *plist_id, int_f *nindexes)
/******/
{
- int ret_value = -1;
- hid_t c_plist_id;
- unsigned c_nindexes;
- herr_t ret;
- /*
- * Call h5pset_shared_mesg_nindexes function.
- */
- c_plist_id = (hid_t)*plist_id;
- c_nindexes = (unsigned)*nindexes;
- ret = H5Pset_shared_mesg_nindexes(c_plist_id, c_nindexes );
- if (ret < 0) return ret_value;
+ int ret_value = -1;
+ hid_t c_plist_id;
+ unsigned c_nindexes;
+ herr_t ret;
+ /*
+ * Call h5pset_shared_mesg_nindexes function.
+ */
+ c_plist_id = (hid_t)*plist_id;
+ c_nindexes = (unsigned)*nindexes;
+ ret = H5Pset_shared_mesg_nindexes(c_plist_id, c_nindexes);
+ if (ret < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_shared_mesg_index_c
@@ -4007,21 +4120,23 @@ h5pset_shared_mesg_nindexes_c(hid_t_f *plist_id, int_f *nindexes )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pset_shared_mesg_index_c(hid_t_f *fcpl_id, int_f *index_num, int_f *mesg_type_flags, int_f *min_mesg_size)
/******/
{
- int ret_value = -1;
- herr_t ret;
- /*
- * Call h5pset_shared_mesg_index function.
- */
- ret = H5Pset_shared_mesg_index((hid_t)*fcpl_id,(unsigned)*index_num, (unsigned)*mesg_type_flags, (unsigned)*min_mesg_size);
- if (ret < 0) return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ /*
+ * Call h5pset_shared_mesg_index function.
+ */
+ ret = H5Pset_shared_mesg_index((hid_t)*fcpl_id, (unsigned)*index_num, (unsigned)*mesg_type_flags,
+ (unsigned)*min_mesg_size);
+ if (ret < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_attr_creation_order_c
@@ -4045,26 +4160,27 @@ h5pset_shared_mesg_index_c(hid_t_f *fcpl_id, int_f *index_num, int_f *mesg_type_
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pget_attr_creation_order_c(hid_t_f *ocpl_id, int_f *crt_order_flags)
/******/
{
- int ret_value = -1;
- herr_t ret;
+ int ret_value = -1;
+ herr_t ret;
- unsigned c_crt_order_flags;
- /*
- * Call h5pget_attr_creation_order function.
- */
+ unsigned c_crt_order_flags;
+ /*
+ * Call h5pget_attr_creation_order function.
+ */
- ret = H5Pget_attr_creation_order((hid_t)*ocpl_id, &c_crt_order_flags);
- if (ret < 0) return ret_value;
+ ret = H5Pget_attr_creation_order((hid_t)*ocpl_id, &c_crt_order_flags);
+ if (ret < 0)
+ return ret_value;
- *crt_order_flags = (int_f)c_crt_order_flags;
+ *crt_order_flags = (int_f)c_crt_order_flags;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_link_creation_order_c
* NAME
@@ -4085,21 +4201,22 @@ h5pget_attr_creation_order_c(hid_t_f *ocpl_id, int_f *crt_order_flags)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_link_creation_order_c(hid_t_f *gcpl_id, int_f *crt_order_flags )
+h5pset_link_creation_order_c(hid_t_f *gcpl_id, int_f *crt_order_flags)
/******/
{
- int ret_value = -1;
- herr_t ret;
- /*
- * Call H5Pset_link_creation_order function.
- */
- ret = H5Pset_link_creation_order((hid_t)*gcpl_id, (unsigned)*crt_order_flags);
- if (ret < 0) return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ /*
+ * Call H5Pset_link_creation_order function.
+ */
+ ret = H5Pset_link_creation_order((hid_t)*gcpl_id, (unsigned)*crt_order_flags);
+ if (ret < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_link_phase_change_c
@@ -4121,26 +4238,27 @@ h5pset_link_creation_order_c(hid_t_f *gcpl_id, int_f *crt_order_flags )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_link_phase_change_c(hid_t_f *gcpl_id, int_f *max_compact, int_f *min_dense )
+h5pget_link_phase_change_c(hid_t_f *gcpl_id, int_f *max_compact, int_f *min_dense)
/******/
{
- int ret_value = -1;
- unsigned c_max_compact;
- unsigned c_min_dense;
- herr_t ret;
+ int ret_value = -1;
+ unsigned c_max_compact;
+ unsigned c_min_dense;
+ herr_t ret;
- /*
- * Call H5Pget_link_phase_change function.
- */
- ret = H5Pget_link_phase_change((hid_t)*gcpl_id, &c_max_compact,&c_min_dense);
- if (ret < 0) return ret_value;
+ /*
+ * Call H5Pget_link_phase_change function.
+ */
+ ret = H5Pget_link_phase_change((hid_t)*gcpl_id, &c_max_compact, &c_min_dense);
+ if (ret < 0)
+ return ret_value;
- *max_compact = (int_f)c_max_compact;
- *min_dense = (int_f)c_min_dense;
- ret_value = 0;
- return ret_value;
+ *max_compact = (int_f)c_max_compact;
+ *min_dense = (int_f)c_min_dense;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_obj_track_times_c
@@ -4162,27 +4280,29 @@ h5pget_link_phase_change_c(hid_t_f *gcpl_id, int_f *max_compact, int_f *min_dens
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pget_obj_track_times_c(hid_t_f *plist_id, int_f *flag)
/******/
{
- int ret_value = -1;
- hbool_t c_track_times=0;
- herr_t ret;
+ int ret_value = -1;
+ hbool_t c_track_times = 0;
+ herr_t ret;
- /*
- * Call H5Pget_obj_track_times function.
- */
- ret = H5Pget_obj_track_times((hid_t)*plist_id, &c_track_times);
+ /*
+ * Call H5Pget_obj_track_times function.
+ */
+ ret = H5Pget_obj_track_times((hid_t)*plist_id, &c_track_times);
- if (ret < 0) return ret_value; /* error occurred */
+ if (ret < 0)
+ return ret_value; /* error occurred */
- *flag = 0;
- if(c_track_times > 0) *flag = 1;
- ret_value = 0;
- return ret_value;
+ *flag = 0;
+ if (c_track_times > 0)
+ *flag = 1;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_obj_track_times_c
@@ -4202,27 +4322,27 @@ h5pget_obj_track_times_c(hid_t_f *plist_id, int_f *flag)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pset_obj_track_times_c(hid_t_f *plist_id, int_f *flag)
/******/
{
- int ret_value = -1;
- hbool_t c_track_times;
- herr_t ret;
-
+ int ret_value = -1;
+ hbool_t c_track_times;
+ herr_t ret;
- c_track_times = (hbool_t)*flag;
+ c_track_times = (hbool_t)*flag;
- /*
- * Call H5Pset_obj_track_times function.
- */
- ret = H5Pset_obj_track_times((hid_t)*plist_id, c_track_times);
+ /*
+ * Call H5Pset_obj_track_times function.
+ */
+ ret = H5Pset_obj_track_times((hid_t)*plist_id, c_track_times);
- if (ret < 0) return ret_value; /* error occurred */
- ret_value = 0;
- return ret_value;
+ if (ret < 0)
+ return ret_value; /* error occurred */
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_create_inter_group_c
@@ -4245,23 +4365,24 @@ h5pset_obj_track_times_c(hid_t_f *plist_id, int_f *flag)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pset_create_inter_group_c(hid_t_f *lcpl_id, int_f *crt_intermed_group)
/******/
{
- int ret_value = -1;
- herr_t ret;
+ int ret_value = -1;
+ herr_t ret;
- /*
- * Call H5Pset_create_intermediate_group function.
- */
- ret = H5Pset_create_intermediate_group((hid_t)*lcpl_id, (unsigned)*crt_intermed_group);
+ /*
+ * Call H5Pset_create_intermediate_group function.
+ */
+ ret = H5Pset_create_intermediate_group((hid_t)*lcpl_id, (unsigned)*crt_intermed_group);
- if (ret < 0) return ret_value; /* error occurred */
- ret_value = 0;
- return ret_value;
+ if (ret < 0)
+ return ret_value; /* error occurred */
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_link_creation_order_c
@@ -4285,26 +4406,27 @@ h5pset_create_inter_group_c(hid_t_f *lcpl_id, int_f *crt_intermed_group)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pget_link_creation_order_c(hid_t_f *gcpl_id, int_f *crt_order_flags)
/******/
{
- int ret_value = -1;
- herr_t ret;
+ int ret_value = -1;
+ herr_t ret;
- unsigned c_crt_order_flags;
- /*
- * Call h5pget_link_creation_order function.
- */
+ unsigned c_crt_order_flags;
+ /*
+ * Call h5pget_link_creation_order function.
+ */
- ret = H5Pget_link_creation_order((hid_t)*gcpl_id, &c_crt_order_flags);
- if (ret < 0) return ret_value;
+ ret = H5Pget_link_creation_order((hid_t)*gcpl_id, &c_crt_order_flags);
+ if (ret < 0)
+ return ret_value;
- *crt_order_flags = (int_f)c_crt_order_flags;
+ *crt_order_flags = (int_f)c_crt_order_flags;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_char_encoding_c
@@ -4330,25 +4452,25 @@ h5pget_link_creation_order_c(hid_t_f *gcpl_id, int_f *crt_order_flags)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pset_char_encoding_c(hid_t_f *plist_id, int_f *encoding)
/******/
{
- int ret_value = -1;
- herr_t ret;
+ int ret_value = -1;
+ herr_t ret;
- /*
- * Call H5Pset_char_encoding function.
- */
- ret = H5Pset_char_encoding((hid_t)*plist_id, (H5T_cset_t)*encoding);
- if (ret < 0) return ret_value;
+ /*
+ * Call H5Pset_char_encoding function.
+ */
+ ret = H5Pset_char_encoding((hid_t)*plist_id, (H5T_cset_t)*encoding);
+ if (ret < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
-
/****if* H5Pf/h5pget_char_encoding_c
* NAME
* h5pget_char_encoding_c
@@ -4372,24 +4494,25 @@ h5pset_char_encoding_c(hid_t_f *plist_id, int_f *encoding)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pget_char_encoding_c(hid_t_f *plist_id, int_f *encoding)
/******/
{
- int ret_value = -1;
- H5T_cset_t c_encoding;
- herr_t ret;
- /*
- * Call H5Pget_char_encoding function.
- */
- ret = H5Pget_char_encoding((hid_t)*plist_id, &c_encoding);
- if (ret < 0) return ret_value;
+ int ret_value = -1;
+ H5T_cset_t c_encoding;
+ herr_t ret;
+ /*
+ * Call H5Pget_char_encoding function.
+ */
+ ret = H5Pget_char_encoding((hid_t)*plist_id, &c_encoding);
+ if (ret < 0)
+ return ret_value;
- *encoding = (int_f)c_encoding;
+ *encoding = (int_f)c_encoding;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_copy_object_c
@@ -4415,21 +4538,22 @@ h5pget_char_encoding_c(hid_t_f *plist_id, int_f *encoding)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pset_copy_object_c(hid_t_f *ocp_plist_id, int_f *copy_options)
/******/
{
- int ret_value = -1;
- herr_t ret;
- /*
- * Call H5Pset_copy_object function.
- */
- ret = H5Pset_copy_object((hid_t)*ocp_plist_id, (unsigned)*copy_options);
- if (ret < 0) return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ /*
+ * Call H5Pset_copy_object function.
+ */
+ ret = H5Pset_copy_object((hid_t)*ocp_plist_id, (unsigned)*copy_options);
+ if (ret < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_copy_object_c
@@ -4454,24 +4578,25 @@ h5pset_copy_object_c(hid_t_f *ocp_plist_id, int_f *copy_options)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pget_copy_object_c(hid_t_f *ocp_plist_id, int_f *copy_options)
/******/
{
- int ret_value = -1;
- unsigned c_copy_options;
- herr_t ret;
- /*
- * Call H5Pget_copy_object function.
- */
- ret = H5Pget_copy_object((hid_t)*ocp_plist_id, &c_copy_options);
- if (ret < 0) return ret_value;
+ int ret_value = -1;
+ unsigned c_copy_options;
+ herr_t ret;
+ /*
+ * Call H5Pget_copy_object function.
+ */
+ ret = H5Pget_copy_object((hid_t)*ocp_plist_id, &c_copy_options);
+ if (ret < 0)
+ return ret_value;
- *copy_options = (int_f)c_copy_options;
+ *copy_options = (int_f)c_copy_options;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_data_transform_c
@@ -4498,31 +4623,31 @@ h5pget_copy_object_c(hid_t_f *ocp_plist_id, int_f *copy_options)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pget_data_transform_c(hid_t_f *plist_id, _fcd expression, int_f *expression_len, size_t_f *size)
/******/
{
- char *c_expression = NULL; /* Buffer to hold C string */
- size_t c_expression_len = (size_t)*expression_len + 1;
+ char * c_expression = NULL; /* Buffer to hold C string */
+ size_t c_expression_len = (size_t)*expression_len + 1;
ssize_t ret;
- int_f ret_value = 0;
+ int_f ret_value = 0;
/*
* Allocate memory to store the expression.
*/
- if(c_expression_len) {
+ if (c_expression_len) {
c_expression = (char *)HDmalloc(c_expression_len);
- if(NULL == c_expression)
- HGOTO_DONE(FAIL)
+ if (NULL == c_expression)
+ HGOTO_DONE(FAIL)
} /* end if */
/*
* Call H5Pget_data_transform function.
*/
ret = H5Pget_data_transform((hid_t)*plist_id, c_expression, c_expression_len);
- if(ret < 0)
- HGOTO_DONE(FAIL)
+ if (ret < 0)
+ HGOTO_DONE(FAIL)
/* or strlen ? */
HD5packFstring(c_expression, _fcdtocp(expression), (size_t)*expression_len);
@@ -4530,7 +4655,7 @@ h5pget_data_transform_c(hid_t_f *plist_id, _fcd expression, int_f *expression_le
*size = (size_t_f)ret;
done:
- if(c_expression)
+ if (c_expression)
HDfree(c_expression);
return ret_value;
@@ -4560,31 +4685,31 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pset_data_transform_c(hid_t_f *plist_id, _fcd expression, int_f *expression_len)
/******/
{
- char* c_expression = NULL; /* Buffer to hold C string */
- int_f ret_value = 0; /* Return value */
+ char *c_expression = NULL; /* Buffer to hold C string */
+ int_f ret_value = 0; /* Return value */
- /*
- * Convert FORTRAN name to C name
- */
- if(NULL == (c_expression = HD5f2cstring(expression, (size_t)*expression_len)))
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if (NULL == (c_expression = HD5f2cstring(expression, (size_t)*expression_len)))
HGOTO_DONE(FAIL)
- /*
- * Call H5Pset_data_transform function.
- */
- if(H5Pset_data_transform((hid_t)*plist_id, c_expression) < 0)
+ /*
+ * Call H5Pset_data_transform function.
+ */
+ if (H5Pset_data_transform((hid_t)*plist_id, c_expression) < 0)
HGOTO_DONE(FAIL)
done:
- if(c_expression)
+ if (c_expression)
HDfree(c_expression);
- return ret_value;
+ return ret_value;
}
/****if* H5Pf/h5pget_local_heap_size_hint_c
@@ -4609,23 +4734,24 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pget_local_heap_size_hint_c(hid_t_f *gcpl_id, size_t_f *size_hint)
/******/
{
- int_f ret_value = -1; /* Return value */
- size_t c_size_hint;
- herr_t ret;
- /*
- * Call H5Pget_local_heap_size_hint function.
- */
- ret = H5Pget_local_heap_size_hint((hid_t)*gcpl_id, &c_size_hint);
- if(ret<0) return ret_value;
+ int_f ret_value = -1; /* Return value */
+ size_t c_size_hint;
+ herr_t ret;
+ /*
+ * Call H5Pget_local_heap_size_hint function.
+ */
+ ret = H5Pget_local_heap_size_hint((hid_t)*gcpl_id, &c_size_hint);
+ if (ret < 0)
+ return ret_value;
- *size_hint = (size_t_f)c_size_hint;
- ret_value = 0;
- return ret_value;
+ *size_hint = (size_t_f)c_size_hint;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_est_link_info_c
@@ -4651,26 +4777,27 @@ h5pget_local_heap_size_hint_c(hid_t_f *gcpl_id, size_t_f *size_hint)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pget_est_link_info_c(hid_t_f *gcpl_id, int_f *est_num_entries, int_f *est_name_len)
/******/
{
- int_f ret_value = -1; /* Return value */
- unsigned c_est_num_entries;
- unsigned c_est_name_len;
- herr_t ret;
- /*
- * Call h5pget_est_link_info function.
- */
- ret = H5Pget_est_link_info((hid_t)*gcpl_id, &c_est_num_entries, &c_est_name_len);
- if(ret<0) return ret_value;
+ int_f ret_value = -1; /* Return value */
+ unsigned c_est_num_entries;
+ unsigned c_est_name_len;
+ herr_t ret;
+ /*
+ * Call h5pget_est_link_info function.
+ */
+ ret = H5Pget_est_link_info((hid_t)*gcpl_id, &c_est_num_entries, &c_est_name_len);
+ if (ret < 0)
+ return ret_value;
- *est_num_entries = (int_f)c_est_num_entries;
- *est_name_len = (int_f)c_est_name_len;
+ *est_num_entries = (int_f)c_est_num_entries;
+ *est_name_len = (int_f)c_est_name_len;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_local_heap_size_hint_c
@@ -4696,21 +4823,22 @@ h5pget_est_link_info_c(hid_t_f *gcpl_id, int_f *est_num_entries, int_f *est_name
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pset_local_heap_size_hint_c(hid_t_f *gcpl_id, size_t_f *size_hint)
/******/
{
- int_f ret_value = -1; /* Return value */
- herr_t ret;
- /*
- * Call H5Pget_local_heap_size_hint function.
- */
- ret = H5Pset_local_heap_size_hint((hid_t)*gcpl_id, (size_t)*size_hint);
- if(ret<0) return ret_value;
+ int_f ret_value = -1; /* Return value */
+ herr_t ret;
+ /*
+ * Call H5Pget_local_heap_size_hint function.
+ */
+ ret = H5Pset_local_heap_size_hint((hid_t)*gcpl_id, (size_t)*size_hint);
+ if (ret < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_est_link_info_c
@@ -4736,21 +4864,22 @@ h5pset_local_heap_size_hint_c(hid_t_f *gcpl_id, size_t_f *size_hint)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pset_est_link_info_c(hid_t_f *gcpl_id, int_f *est_num_entries, int_f *est_name_len)
/******/
{
- int_f ret_value = -1; /* Return value */
- herr_t ret;
- /*
- * Call h5pset_est_link_info function.
- */
- ret = H5Pset_est_link_info((hid_t)*gcpl_id, (unsigned)*est_num_entries, (unsigned)*est_name_len);
- if(ret<0) return ret_value;
+ int_f ret_value = -1; /* Return value */
+ herr_t ret;
+ /*
+ * Call h5pset_est_link_info function.
+ */
+ ret = H5Pset_est_link_info((hid_t)*gcpl_id, (unsigned)*est_num_entries, (unsigned)*est_name_len);
+ if (ret < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_link_phase_change_c
@@ -4772,22 +4901,23 @@ h5pset_est_link_info_c(hid_t_f *gcpl_id, int_f *est_num_entries, int_f *est_name
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_link_phase_change_c(hid_t_f *gcpl_id, int_f *max_compact, int_f *min_dense )
+h5pset_link_phase_change_c(hid_t_f *gcpl_id, int_f *max_compact, int_f *min_dense)
/******/
{
- int ret_value = -1;
- herr_t ret;
+ int ret_value = -1;
+ herr_t ret;
- /*
- * Call H5Pset_link_phase_change function.
- */
- ret = H5Pset_link_phase_change((hid_t)*gcpl_id, (unsigned)*max_compact,(unsigned)*min_dense);
- if (ret < 0) return ret_value;
+ /*
+ * Call H5Pset_link_phase_change function.
+ */
+ ret = H5Pset_link_phase_change((hid_t)*gcpl_id, (unsigned)*max_compact, (unsigned)*min_dense);
+ if (ret < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_fapl_direct_c
@@ -4811,29 +4941,31 @@ h5pset_link_phase_change_c(hid_t_f *gcpl_id, int_f *max_compact, int_f *min_dens
* HISTORY
*
* SOURCE
-*/
+ */
#ifndef H5_HAVE_DIRECT
/* Only gets gcc const attribute when the direct VFD is not built. */
H5_ATTR_CONST
#endif
int_f
-h5pset_fapl_direct_c(hid_t_f H5_ATTR_UNUSED *fapl_id, size_t_f H5_ATTR_UNUSED *alignment, size_t_f H5_ATTR_UNUSED *block_size, size_t_f H5_ATTR_UNUSED *cbuf_size)
+h5pset_fapl_direct_c(hid_t_f H5_ATTR_UNUSED *fapl_id, size_t_f H5_ATTR_UNUSED *alignment,
+ size_t_f H5_ATTR_UNUSED *block_size, size_t_f H5_ATTR_UNUSED *cbuf_size)
/******/
{
- int ret_value = -1;
+ int ret_value = -1;
#ifdef H5_HAVE_DIRECT
- herr_t ret;
+ herr_t ret;
- /*
- * Call H5Pset_link_phase_change function.
- */
- ret = H5Pset_fapl_direct((hid_t)*fapl_id, (size_t)*alignment, (size_t)*block_size, (size_t)*cbuf_size );
- if (ret < 0) return ret_value;
+ /*
+ * Call H5Pset_link_phase_change function.
+ */
+ ret = H5Pset_fapl_direct((hid_t)*fapl_id, (size_t)*alignment, (size_t)*block_size, (size_t)*cbuf_size);
+ if (ret < 0)
+ return ret_value;
- ret_value = 0;
+ ret_value = 0;
#endif
- return ret_value;
+ return ret_value;
}
/****if* H5Pf/h5pget_fapl_direct_c
@@ -4858,35 +4990,37 @@ h5pset_fapl_direct_c(hid_t_f H5_ATTR_UNUSED *fapl_id, size_t_f H5_ATTR_UNUSED *a
* HISTORY
*
* SOURCE
-*/
+ */
#ifndef H5_HAVE_DIRECT
/* Only gets gcc const attribute when the direct VFD is not built. */
H5_ATTR_CONST
#endif
int_f
-h5pget_fapl_direct_c(hid_t_f H5_ATTR_UNUSED *fapl_id, size_t_f H5_ATTR_UNUSED *alignment, size_t_f H5_ATTR_UNUSED *block_size, size_t_f H5_ATTR_UNUSED *cbuf_size)
+h5pget_fapl_direct_c(hid_t_f H5_ATTR_UNUSED *fapl_id, size_t_f H5_ATTR_UNUSED *alignment,
+ size_t_f H5_ATTR_UNUSED *block_size, size_t_f H5_ATTR_UNUSED *cbuf_size)
/******/
{
- int ret_value = -1;
+ int ret_value = -1;
#ifdef H5_HAVE_DIRECT
- herr_t ret;
- size_t c_alignment;
- size_t c_block_size;
- size_t c_cbuf_size;
-
- /*
- * Call H5Pget_link_phase_change function.
- */
- ret = H5Pget_fapl_direct((hid_t)*fapl_id, &c_alignment, &c_block_size, &c_cbuf_size );
- if (ret < 0) return ret_value;
-
- *alignment = (size_t_f)c_alignment;
- *block_size = (size_t_f)c_block_size;
- *cbuf_size = (size_t_f)c_cbuf_size;
-
- ret_value = 0;
+ herr_t ret;
+ size_t c_alignment;
+ size_t c_block_size;
+ size_t c_cbuf_size;
+
+ /*
+ * Call H5Pget_link_phase_change function.
+ */
+ ret = H5Pget_fapl_direct((hid_t)*fapl_id, &c_alignment, &c_block_size, &c_cbuf_size);
+ if (ret < 0)
+ return ret_value;
+
+ *alignment = (size_t_f)c_alignment;
+ *block_size = (size_t_f)c_block_size;
+ *cbuf_size = (size_t_f)c_cbuf_size;
+
+ ret_value = 0;
#endif
- return ret_value;
+ return ret_value;
}
/****if* H5Pf/h5pset_attr_phase_change_c
@@ -4909,21 +5043,22 @@ h5pget_fapl_direct_c(hid_t_f H5_ATTR_UNUSED *fapl_id, size_t_f H5_ATTR_UNUSED *a
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_attr_phase_change_c(hid_t_f *ocpl_id, int_f *max_compact, int_f *min_dense )
+h5pset_attr_phase_change_c(hid_t_f *ocpl_id, int_f *max_compact, int_f *min_dense)
/******/
{
- int ret_value = -1;
- herr_t ret;
- /*
- * Call H5Pset_attr_phase_change function.
- */
- ret = H5Pset_attr_phase_change((hid_t)*ocpl_id, (unsigned)*max_compact,(unsigned)*min_dense);
- if (ret < 0) return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ /*
+ * Call H5Pset_attr_phase_change function.
+ */
+ ret = H5Pset_attr_phase_change((hid_t)*ocpl_id, (unsigned)*max_compact, (unsigned)*min_dense);
+ if (ret < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_nbit_c
@@ -4944,21 +5079,22 @@ h5pset_attr_phase_change_c(hid_t_f *ocpl_id, int_f *max_compact, int_f *min_dens
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_nbit_c(hid_t_f *plist_id )
+h5pset_nbit_c(hid_t_f *plist_id)
/******/
{
- int ret_value = -1;
- herr_t ret;
- /*
- * Call H5Pset_nbit_change function.
- */
- ret = H5Pset_nbit((hid_t)*plist_id);
- if (ret < 0) return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ /*
+ * Call H5Pset_nbit_change function.
+ */
+ ret = H5Pset_nbit((hid_t)*plist_id);
+ if (ret < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_scaleoffset_c
* NAME
@@ -4977,24 +5113,25 @@ h5pset_nbit_c(hid_t_f *plist_id )
* M. Scot Breitenfeld
* March 21, 2008
* SOURCE
-*/
+ */
int_f
-h5pset_scaleoffset_c(hid_t_f *plist_id, int_f *scale_type, int_f *scale_factor )
+h5pset_scaleoffset_c(hid_t_f *plist_id, int_f *scale_type, int_f *scale_factor)
/******/
{
- int ret_value = -1;
- H5Z_SO_scale_type_t c_scale_type;
- herr_t ret;
- /*
- * Call H5Pset_scaleoffset_change function.
- */
- c_scale_type = (H5Z_SO_scale_type_t)*scale_type;
+ int ret_value = -1;
+ H5Z_SO_scale_type_t c_scale_type;
+ herr_t ret;
+ /*
+ * Call H5Pset_scaleoffset_change function.
+ */
+ c_scale_type = (H5Z_SO_scale_type_t)*scale_type;
- ret = H5Pset_scaleoffset((hid_t)*plist_id, c_scale_type, (int)*scale_factor);
- if (ret < 0) return ret_value;
+ ret = H5Pset_scaleoffset((hid_t)*plist_id, c_scale_type, (int)*scale_factor);
+ if (ret < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_nlinks
@@ -5012,21 +5149,22 @@ h5pset_scaleoffset_c(hid_t_f *plist_id, int_f *scale_type, int_f *scale_factor )
* M. Scot Breitenfeld
* March 24, 2008
* SOURCE
-*/
+ */
int_f
h5pset_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks)
/******/
{
- int ret_value = -1;
- herr_t ret;
- /*
- * Call H5Pset_nlinks function.
- */
- ret = H5Pset_nlinks((hid_t)*lapl_id, (size_t)*nlinks);
- if (ret < 0) return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ /*
+ * Call H5Pset_nlinks function.
+ */
+ ret = H5Pset_nlinks((hid_t)*lapl_id, (size_t)*nlinks);
+ if (ret < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_nlinks
@@ -5051,23 +5189,24 @@ h5pset_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pget_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks)
/******/
{
- int ret_value = -1;
- herr_t ret;
- size_t c_nlinks;
- /*
- * Call H5Pget_nlinks function.
- */
- ret = H5Pget_nlinks((hid_t)*lapl_id, &c_nlinks);
- if (ret < 0) return ret_value;
+ int ret_value = -1;
+ herr_t ret;
+ size_t c_nlinks;
+ /*
+ * Call H5Pget_nlinks function.
+ */
+ ret = H5Pget_nlinks((hid_t)*lapl_id, &c_nlinks);
+ if (ret < 0)
+ return ret_value;
- *nlinks = (size_t_f)c_nlinks;
- ret_value = 0;
- return ret_value;
+ *nlinks = (size_t_f)c_nlinks;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_create_inter_group_c
@@ -5089,25 +5228,26 @@ h5pget_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5pget_create_inter_group_c(hid_t_f *lcpl_id, int_f *crt_intermed_group)
/******/
{
- int ret_value = -1;
- herr_t ret;
- unsigned c_crt_intermed_group;
+ int ret_value = -1;
+ herr_t ret;
+ unsigned c_crt_intermed_group;
- /*
- * Call H5Pget_create_intermediate_group function.
- */
- ret = H5Pget_create_intermediate_group((hid_t)*lcpl_id, &c_crt_intermed_group);
+ /*
+ * Call H5Pget_create_intermediate_group function.
+ */
+ ret = H5Pget_create_intermediate_group((hid_t)*lcpl_id, &c_crt_intermed_group);
- if (ret < 0) return ret_value; /* error occurred */
+ if (ret < 0)
+ return ret_value; /* error occurred */
- *crt_intermed_group = (int_f)c_crt_intermed_group;
- ret_value = 0;
- return ret_value;
+ *crt_intermed_group = (int_f)c_crt_intermed_group;
+ ret_value = 0;
+ return ret_value;
}
/*----------------------------------------------------------------------------
@@ -5129,16 +5269,17 @@ h5pget_create_inter_group_c(hid_t_f *lcpl_id, int_f *crt_intermed_group)
int_f
h5pset_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes, real_f *rdcc_w0)
{
- int ret_value = -1;
+ int ret_value = -1;
- /*
- * Call H5Pset_chunk_cache function.
- */
- if( (H5Pset_chunk_cache((hid_t)*dapl_id, (size_t)*rdcc_nslots, (size_t)*rdcc_nbytes, (double)*rdcc_w0)) <0 )
- return ret_value; /* error occurred */
+ /*
+ * Call H5Pset_chunk_cache function.
+ */
+ if ((H5Pset_chunk_cache((hid_t)*dapl_id, (size_t)*rdcc_nslots, (size_t)*rdcc_nbytes, (double)*rdcc_w0)) <
+ 0)
+ return ret_value; /* error occurred */
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/*----------------------------------------------------------------------------
@@ -5161,22 +5302,22 @@ h5pset_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nby
int_f
h5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes, real_f *rdcc_w0)
{
- int ret_value = -1;
- size_t c_rdcc_nslots;
- size_t c_rdcc_nbytes;
- double c_rdcc_w0;
- /*
- * Call H5Pget_chunk_cache function.
- */
- if( (H5Pget_chunk_cache((hid_t)*dapl_id, &c_rdcc_nslots, &c_rdcc_nbytes, &c_rdcc_w0)) <0 )
- return ret_value; /* error occurred */
+ int ret_value = -1;
+ size_t c_rdcc_nslots;
+ size_t c_rdcc_nbytes;
+ double c_rdcc_w0;
+ /*
+ * Call H5Pget_chunk_cache function.
+ */
+ if ((H5Pget_chunk_cache((hid_t)*dapl_id, &c_rdcc_nslots, &c_rdcc_nbytes, &c_rdcc_w0)) < 0)
+ return ret_value; /* error occurred */
- *rdcc_nslots=(size_t_f)c_rdcc_nslots;
- *rdcc_nbytes=(size_t_f)c_rdcc_nbytes;
- *rdcc_w0=(real_f)c_rdcc_w0;
+ *rdcc_nslots = (size_t_f)c_rdcc_nslots;
+ *rdcc_nbytes = (size_t_f)c_rdcc_nbytes;
+ *rdcc_w0 = (real_f)c_rdcc_w0;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/*----------------------------------------------------------------------------
@@ -5197,15 +5338,15 @@ h5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nby
int_f
h5pset_file_image_c(hid_t_f *fapl_id, void *buf_ptr, size_t_f *buf_len)
{
- int ret_value = -1;
- /*
- * Call H5Pset_file_image function.
- */
- if( (H5Pset_file_image((hid_t)*fapl_id, buf_ptr, (size_t)*buf_len)) <0 )
- return ret_value; /* error occurred */
+ int ret_value = -1;
+ /*
+ * Call H5Pset_file_image function.
+ */
+ if ((H5Pset_file_image((hid_t)*fapl_id, buf_ptr, (size_t)*buf_len)) < 0)
+ return ret_value; /* error occurred */
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/*----------------------------------------------------------------------------
@@ -5227,26 +5368,27 @@ h5pset_file_image_c(hid_t_f *fapl_id, void *buf_ptr, size_t_f *buf_len)
int_f
h5pget_file_image_c(hid_t_f *fapl_id, void **buf_ptr, size_t_f *buf_len_ptr)
{
- int ret_value = -1;
- size_t c_buf_len_ptr;
- void *c_buf_ptr = NULL;
+ int ret_value = -1;
+ size_t c_buf_len_ptr;
+ void * c_buf_ptr = NULL;
- c_buf_len_ptr = (size_t)*buf_len_ptr;
+ c_buf_len_ptr = (size_t)*buf_len_ptr;
- /*
- * Call H5Pget_file_image function.
- */
- if( (H5Pget_file_image((hid_t)*fapl_id, (void **)&c_buf_ptr, &c_buf_len_ptr)) <0 )
- return ret_value; /* error occurred */
+ /*
+ * Call H5Pget_file_image function.
+ */
+ if ((H5Pget_file_image((hid_t)*fapl_id, (void **)&c_buf_ptr, &c_buf_len_ptr)) < 0)
+ return ret_value; /* error occurred */
- HDmemcpy((void *)*buf_ptr, (void *)c_buf_ptr, c_buf_len_ptr);
+ HDmemcpy((void *)*buf_ptr, (void *)c_buf_ptr, c_buf_len_ptr);
- *buf_len_ptr=(size_t_f)c_buf_len_ptr;
+ *buf_len_ptr = (size_t_f)c_buf_len_ptr;
- ret_value = 0;
- if(c_buf_ptr) H5free_memory(c_buf_ptr);
+ ret_value = 0;
+ if (c_buf_ptr)
+ H5free_memory(c_buf_ptr);
- return ret_value;
+ return ret_value;
}
#ifdef H5_HAVE_PARALLEL
@@ -5268,27 +5410,28 @@ h5pget_file_image_c(hid_t_f *fapl_id, void **buf_ptr, size_t_f *buf_len_ptr)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_fapl_mpio_c(hid_t_f *prp_id, int_f* comm, int_f* info)
+h5pset_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- MPI_Comm c_comm;
- MPI_Info c_info;
- c_comm = MPI_Comm_f2c(*comm);
- c_info = MPI_Info_f2c(*info);
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ MPI_Comm c_comm;
+ MPI_Info c_info;
+ c_comm = MPI_Comm_f2c(*comm);
+ c_info = MPI_Info_f2c(*info);
- /*
- * Call H5Pset_mpi function.
- */
- c_prp_id = *prp_id;
- ret = H5Pset_fapl_mpio(c_prp_id, c_comm, c_info);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ /*
+ * Call H5Pset_mpi function.
+ */
+ c_prp_id = *prp_id;
+ ret = H5Pset_fapl_mpio(c_prp_id, c_comm, c_info);
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_fapl_mpio_c
* NAME
@@ -5307,27 +5450,28 @@ h5pset_fapl_mpio_c(hid_t_f *prp_id, int_f* comm, int_f* info)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_fapl_mpio_c(hid_t_f *prp_id, int_f* comm, int_f* info)
+h5pget_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- MPI_Comm c_comm;
- MPI_Info c_info;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ MPI_Comm c_comm;
+ MPI_Info c_info;
- /*
- * Call H5Pget_mpi function.
- */
- c_prp_id = *prp_id;
- ret = H5Pget_fapl_mpio(c_prp_id, &c_comm, &c_info);
- if (ret < 0) return ret_value;
- *comm = (int_f) MPI_Comm_c2f(c_comm);
- *info = (int_f) MPI_Info_c2f(c_info);
- ret_value = 0;
- return ret_value;
+ /*
+ * Call H5Pget_mpi function.
+ */
+ c_prp_id = *prp_id;
+ ret = H5Pget_fapl_mpio(c_prp_id, &c_comm, &c_info);
+ if (ret < 0)
+ return ret_value;
+ *comm = (int_f)MPI_Comm_c2f(c_comm);
+ *info = (int_f)MPI_Info_c2f(c_info);
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pset_dxpl_mpio_c
* NAME
@@ -5346,38 +5490,39 @@ h5pget_fapl_mpio_c(hid_t_f *prp_id, int_f* comm, int_f* info)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pset_dxpl_mpio_c(hid_t_f *prp_id, int_f* data_xfer_mode)
+h5pset_dxpl_mpio_c(hid_t_f *prp_id, int_f *data_xfer_mode)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- H5FD_mpio_xfer_t c_data_xfer_mode;
-/*
- switch (*data_xfer_mode) {
-
- case H5FD_MPIO_INDEPENDENT_F:
- c_data_xfer_mode = H5FD_MPIO_INDEPENDENT;
- break;
-
- case H5FD_MPIO_COLLECTIVE_F:
- c_data_xfer_mode = H5FD_MPIO_COLLECTIVE;
- break;
- default:
- return ret_value;
- }
-*/
- c_data_xfer_mode = (H5FD_mpio_xfer_t)*data_xfer_mode;
- /*
- * Call H5Pset_dxpl_mpio function.
- */
- c_prp_id = *prp_id;
- ret = H5Pset_dxpl_mpio(c_prp_id, c_data_xfer_mode);
- if (ret < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ H5FD_mpio_xfer_t c_data_xfer_mode;
+ /*
+ switch (*data_xfer_mode) {
+
+ case H5FD_MPIO_INDEPENDENT_F:
+ c_data_xfer_mode = H5FD_MPIO_INDEPENDENT;
+ break;
+
+ case H5FD_MPIO_COLLECTIVE_F:
+ c_data_xfer_mode = H5FD_MPIO_COLLECTIVE;
+ break;
+ default:
+ return ret_value;
+ }
+ */
+ c_data_xfer_mode = (H5FD_mpio_xfer_t)*data_xfer_mode;
+ /*
+ * Call H5Pset_dxpl_mpio function.
+ */
+ c_prp_id = *prp_id;
+ ret = H5Pset_dxpl_mpio(c_prp_id, c_data_xfer_mode);
+ if (ret < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_dxpl_mpio_c
@@ -5397,40 +5542,41 @@ h5pset_dxpl_mpio_c(hid_t_f *prp_id, int_f* data_xfer_mode)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5pget_dxpl_mpio_c(hid_t_f *prp_id, int_f* data_xfer_mode)
+h5pget_dxpl_mpio_c(hid_t_f *prp_id, int_f *data_xfer_mode)
/******/
{
- int ret_value = -1;
- hid_t c_prp_id;
- herr_t ret;
- H5FD_mpio_xfer_t c_data_xfer_mode;
+ int ret_value = -1;
+ hid_t c_prp_id;
+ herr_t ret;
+ H5FD_mpio_xfer_t c_data_xfer_mode;
- /*
- * Call H5Pget_xfer function.
- */
- c_prp_id = *prp_id;
- ret = H5Pget_dxpl_mpio(c_prp_id, &c_data_xfer_mode);
- if (ret < 0) return ret_value;
- *data_xfer_mode = (int_f)c_data_xfer_mode;
-/*
- switch (c_data_xfer_mode) {
+ /*
+ * Call H5Pget_xfer function.
+ */
+ c_prp_id = *prp_id;
+ ret = H5Pget_dxpl_mpio(c_prp_id, &c_data_xfer_mode);
+ if (ret < 0)
+ return ret_value;
+ *data_xfer_mode = (int_f)c_data_xfer_mode;
+ /*
+ switch (c_data_xfer_mode) {
- case H5FD_MPIO_INDEPENDENT:
- *data_xfer_mode = H5FD_MPIO_INDEPENDENT_F;
- break;
+ case H5FD_MPIO_INDEPENDENT:
+ *data_xfer_mode = H5FD_MPIO_INDEPENDENT_F;
+ break;
- case H5FD_MPIO_COLLECTIVE:
- *data_xfer_mode = H5FD_MPIO_COLLECTIVE_F;
- break;
+ case H5FD_MPIO_COLLECTIVE:
+ *data_xfer_mode = H5FD_MPIO_COLLECTIVE_F;
+ break;
- default:
- return ret_value;
- }
-*/
- ret_value = 0;
- return ret_value;
+ default:
+ return ret_value;
+ }
+ */
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Pf/h5pget_mpio_actual_io_mode_c
@@ -5450,23 +5596,23 @@ h5pget_dxpl_mpio_c(hid_t_f *prp_id, int_f* data_xfer_mode)
* M. Scot Breitenfeld
* July 27, 2012
* SOURCE
-*/
+ */
int_f
h5pget_mpio_actual_io_mode_c(hid_t_f *dxpl_id, int_f *actual_io_mode)
/******/
{
- int ret_value = -1;
- H5D_mpio_actual_io_mode_t c_actual_io_mode;
+ int ret_value = -1;
+ H5D_mpio_actual_io_mode_t c_actual_io_mode;
- /*
- * Call H5Pget_mpio_actual_io_mode_f function.
- */
- if( (H5Pget_mpio_actual_io_mode((hid_t)*dxpl_id, &c_actual_io_mode)) <0 )
- return ret_value; /* error occurred */
+ /*
+ * Call H5Pget_mpio_actual_io_mode_f function.
+ */
+ if ((H5Pget_mpio_actual_io_mode((hid_t)*dxpl_id, &c_actual_io_mode)) < 0)
+ return ret_value; /* error occurred */
- *actual_io_mode =(int_f)c_actual_io_mode;
+ *actual_io_mode = (int_f)c_actual_io_mode;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
#endif /*H5_HAVE_PARALLEL*/
diff --git a/fortran/src/H5Rf.c b/fortran/src/H5Rf.c
index df2ded4..d712a8f 100644
--- a/fortran/src/H5Rf.c
+++ b/fortran/src/H5Rf.c
@@ -17,7 +17,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include "H5f90.h"
#include "H5Eprivate.h"
@@ -43,34 +43,34 @@
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5rcreate_region_c(int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id)
/******/
{
- char *c_name = NULL;
- hdset_reg_ref_t ref_c;
- int_f ret_value = 0;
+ char * c_name = NULL;
+ hdset_reg_ref_t ref_c;
+ int_f ret_value = 0;
- /*
- * Convert FORTRAN name to C name
- */
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
- HGOTO_DONE(FAIL)
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ HGOTO_DONE(FAIL)
- /*
- * Call H5Rcreate function.
- */
- if(H5Rcreate(&ref_c, (hid_t)*loc_id, c_name, H5R_DATASET_REGION, (hid_t)*space_id) < 0)
- HGOTO_DONE(FAIL)
+ /*
+ * Call H5Rcreate function.
+ */
+ if (H5Rcreate(&ref_c, (hid_t)*loc_id, c_name, H5R_DATASET_REGION, (hid_t)*space_id) < 0)
+ HGOTO_DONE(FAIL)
- /* Copy the reference created */
- HDmemcpy(ref, &ref_c, H5R_DSET_REG_REF_BUF_SIZE);
+ /* Copy the reference created */
+ HDmemcpy(ref, &ref_c, H5R_DSET_REG_REF_BUF_SIZE);
done:
- if(c_name)
- HDfree(c_name);
- return ret_value;
+ if (c_name)
+ HDfree(c_name);
+ return ret_value;
} /* end h5rcreate_region_c() */
/****if* H5Rf/h5rcreate_ptr_c
@@ -92,28 +92,29 @@ done:
* June 20, 2008
*
* SOURCE
-*/
+ */
int_f
-h5rcreate_ptr_c (void *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *ref_type, hid_t_f *space_id)
+h5rcreate_ptr_c(void *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *ref_type, hid_t_f *space_id)
/******/
{
- int ret_value = -1;
- char *c_name;
-
- /*
- * Convert FORTRAN name to C name
- */
- c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
- if (c_name == NULL) return ret_value;
-
- /*
- * Call H5Rcreate function.
- */
- if(H5Rcreate(ref, (hid_t)*loc_id, c_name, (H5R_type_t)*ref_type, (hid_t)*space_id) >= 0)
- ret_value = 0;
-
- HDfree(c_name);
- return ret_value;
+ int ret_value = -1;
+ char *c_name;
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
+ if (c_name == NULL)
+ return ret_value;
+
+ /*
+ * Call H5Rcreate function.
+ */
+ if (H5Rcreate(ref, (hid_t)*loc_id, c_name, (H5R_type_t)*ref_type, (hid_t)*space_id) >= 0)
+ ret_value = 0;
+
+ HDfree(c_name);
+ return ret_value;
}
/****if* H5Rf/h5rdereference_ptr_c
@@ -136,22 +137,23 @@ h5rcreate_ptr_c (void *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *r
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5rdereference_ptr_c (hid_t_f *obj_id, int_f *ref_type, void *ref, hid_t_f *ref_obj_id)
+h5rdereference_ptr_c(hid_t_f *obj_id, int_f *ref_type, void *ref, hid_t_f *ref_obj_id)
/******/
{
- int ret_value = -1;
- hid_t c_ref_obj_id;
-
- /*
- * Call H5Rdereference function.
- */
- c_ref_obj_id = H5Rdereference2((hid_t)*obj_id, H5P_DEFAULT, (H5R_type_t)*ref_type, ref);
- if(c_ref_obj_id < 0) return ret_value;
- *ref_obj_id = (hid_t_f)c_ref_obj_id;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_ref_obj_id;
+
+ /*
+ * Call H5Rdereference function.
+ */
+ c_ref_obj_id = H5Rdereference2((hid_t)*obj_id, H5P_DEFAULT, (H5R_type_t)*ref_type, ref);
+ if (c_ref_obj_id < 0)
+ return ret_value;
+ *ref_obj_id = (hid_t_f)c_ref_obj_id;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Rf/h5rget_region_region_object_c
@@ -172,29 +174,29 @@ h5rdereference_ptr_c (hid_t_f *obj_id, int_f *ref_type, void *ref, hid_t_f *ref_
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5rget_region_region_c(hid_t_f *dset_id, int_f *ref, hid_t_f *space_id)
/******/
{
- hid_t c_space_id;
- hdset_reg_ref_t ref_c;
- int_f ret_value = 0;
+ hid_t c_space_id;
+ hdset_reg_ref_t ref_c;
+ int_f ret_value = 0;
- /* Copy the reference to dereference */
- HDmemcpy(&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE);
+ /* Copy the reference to dereference */
+ HDmemcpy(&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE);
- /*
- * Call H5Rget_region function.
- */
- if((c_space_id = H5Rget_region((hid_t)*dset_id, H5R_DATASET_REGION, &ref_c)) < 0)
- HGOTO_DONE(FAIL)
+ /*
+ * Call H5Rget_region function.
+ */
+ if ((c_space_id = H5Rget_region((hid_t)*dset_id, H5R_DATASET_REGION, &ref_c)) < 0)
+ HGOTO_DONE(FAIL)
- /* Copy the dataspace ID */
- *space_id = (hid_t_f)c_space_id;
+ /* Copy the dataspace ID */
+ *space_id = (hid_t_f)c_space_id;
done:
- return ret_value;
+ return ret_value;
} /* end h5rget_region_region_c() */
/****if* H5Rf/h5rget_region_ptr_c
@@ -215,28 +217,27 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5rget_region_ptr_c(hid_t_f *dset_id, void *ref, hid_t_f *space_id)
/******/
{
- hid_t c_space_id;
- int_f ret_value = 0;
+ hid_t c_space_id;
+ int_f ret_value = 0;
- /*
- * Call H5Rget_region function.
- */
- if((c_space_id = H5Rget_region((hid_t)*dset_id, H5R_DATASET_REGION, ref)) < 0)
- HGOTO_DONE(FAIL)
+ /*
+ * Call H5Rget_region function.
+ */
+ if ((c_space_id = H5Rget_region((hid_t)*dset_id, H5R_DATASET_REGION, ref)) < 0)
+ HGOTO_DONE(FAIL)
- /* Copy the dataspace ID */
- *space_id = (hid_t_f)c_space_id;
+ /* Copy the dataspace ID */
+ *space_id = (hid_t_f)c_space_id;
done:
- return ret_value;
+ return ret_value;
} /* end h5rget_region_ptr_c() */
-
/****if* H5Rf/h5rget_object_type_obj_c
* NAME
* h5rget_object_type_obj_c
@@ -256,26 +257,26 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5rget_object_type_obj_c(hid_t_f *dset_id, haddr_t_f *ref, int_f *obj_type)
/******/
{
- H5O_type_t c_obj_type;
- hobj_ref_t ref_c = (hobj_ref_t)*ref;
- int_f ret_value = 0;
+ H5O_type_t c_obj_type;
+ hobj_ref_t ref_c = (hobj_ref_t)*ref;
+ int_f ret_value = 0;
- /*
- * Call H5Rget_object_type function.
- */
- if(H5Rget_obj_type2((hid_t)*dset_id, H5R_OBJECT, &ref_c, &c_obj_type) < 0)
- HGOTO_DONE(FAIL)
+ /*
+ * Call H5Rget_object_type function.
+ */
+ if (H5Rget_obj_type2((hid_t)*dset_id, H5R_OBJECT, &ref_c, &c_obj_type) < 0)
+ HGOTO_DONE(FAIL)
- /* Copy the object type */
- *obj_type = (int_f)c_obj_type;
+ /* Copy the object type */
+ *obj_type = (int_f)c_obj_type;
done:
- return ret_value;
+ return ret_value;
} /* end h5rget_object_type_obj_c() */
/****if* H5Rf/h5rget_name_ptr_c
@@ -301,40 +302,43 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5rget_name_ptr_c (hid_t_f *loc_id, int_f *ref_type, void *ref, _fcd name, size_t_f *name_len, size_t_f *size_default)
+h5rget_name_ptr_c(hid_t_f *loc_id, int_f *ref_type, void *ref, _fcd name, size_t_f *name_len,
+ size_t_f *size_default)
/******/
{
- int_f ret_value = -1;
- ssize_t c_size;
- size_t c_bufsize;
- char *c_buf= NULL; /* Buffer to hold C string */
-
- c_bufsize = (size_t)*name_len+1;
- /*
- * Allocate buffer to hold name of an attribute
- */
- if ((c_buf = (char *)HDmalloc(c_bufsize)) == NULL)
- return ret_value;
-
- /*
- * Call H5Rget_name function.
- */
- if((c_size=H5Rget_name((hid_t)*loc_id, (H5R_type_t)*ref_type, ref, c_buf, c_bufsize)) < 0){
- if(c_buf) HDfree(c_buf);
- return ret_value;
- }
- /*
- * Convert C name to FORTRAN and place it in the given buffer
- */
- HD5packFstring(c_buf, _fcdtocp(name), c_bufsize-1);
-
- *size_default = (size_t_f)c_size;
- ret_value = 0;
- if(c_buf) HDfree(c_buf);
-
- return ret_value;
+ int_f ret_value = -1;
+ ssize_t c_size;
+ size_t c_bufsize;
+ char * c_buf = NULL; /* Buffer to hold C string */
+
+ c_bufsize = (size_t)*name_len + 1;
+ /*
+ * Allocate buffer to hold name of an attribute
+ */
+ if ((c_buf = (char *)HDmalloc(c_bufsize)) == NULL)
+ return ret_value;
+
+ /*
+ * Call H5Rget_name function.
+ */
+ if ((c_size = H5Rget_name((hid_t)*loc_id, (H5R_type_t)*ref_type, ref, c_buf, c_bufsize)) < 0) {
+ if (c_buf)
+ HDfree(c_buf);
+ return ret_value;
+ }
+ /*
+ * Convert C name to FORTRAN and place it in the given buffer
+ */
+ HD5packFstring(c_buf, _fcdtocp(name), c_bufsize - 1);
+
+ *size_default = (size_t_f)c_size;
+ ret_value = 0;
+ if (c_buf)
+ HDfree(c_buf);
+
+ return ret_value;
}
/****if* H5Rf/h5rget_obj_type_c
@@ -359,22 +363,22 @@ h5rget_name_ptr_c (hid_t_f *loc_id, int_f *ref_type, void *ref, _fcd name, size_
* December 17, 2008
*
* SOURCE
-*/
+ */
int_f
-h5rget_obj_type_c (hid_t_f *loc_id, int_f *ref_type, void *ref, int_f *obj_type)
+h5rget_obj_type_c(hid_t_f *loc_id, int_f *ref_type, void *ref, int_f *obj_type)
/******/
{
- int_f ret_value = -1;
- H5O_type_t obj_type_c;
+ int_f ret_value = -1;
+ H5O_type_t obj_type_c;
- /*
- * Call H5Rget_obj_type function.
- */
- if((H5Rget_obj_type2((hid_t)*loc_id, (H5R_type_t)*ref_type, ref, &obj_type_c)) < 0)
- return ret_value;
+ /*
+ * Call H5Rget_obj_type function.
+ */
+ if ((H5Rget_obj_type2((hid_t)*loc_id, (H5R_type_t)*ref_type, ref, &obj_type_c)) < 0)
+ return ret_value;
- *obj_type = (int_f)obj_type_c;
+ *obj_type = (int_f)obj_type_c;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c
index e3a5809..ebec0e6 100644
--- a/fortran/src/H5Sf.c
+++ b/fortran/src/H5Sf.c
@@ -17,7 +17,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include "H5f90.h"
#include "H5Eprivate.h"
@@ -41,28 +41,28 @@
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5screate_simple_c ( int_f *rank, hsize_t_f *dims, hsize_t_f *maxdims, hid_t_f *space_id )
+h5screate_simple_c(int_f *rank, hsize_t_f *dims, hsize_t_f *maxdims, hid_t_f *space_id)
/******/
{
hsize_t c_dims[H5S_MAX_RANK];
hsize_t c_maxdims[H5S_MAX_RANK];
- hid_t c_space_id;
- int i;
- int_f ret_value = 0;
+ hid_t c_space_id;
+ int i;
+ int_f ret_value = 0;
/*
* Transpose dimension arrays because of C-FORTRAN storage order
*/
- for(i = 0; i < *rank ; i++) {
- c_dims[i] = dims[*rank - i - 1];
- c_maxdims[i] = maxdims[*rank - i - 1];
+ for (i = 0; i < *rank; i++) {
+ c_dims[i] = dims[*rank - i - 1];
+ c_maxdims[i] = maxdims[*rank - i - 1];
} /* end for */
c_space_id = H5Screate_simple(*rank, c_dims, c_maxdims);
- if(c_space_id < 0)
+ if (c_space_id < 0)
HGOTO_DONE(FAIL)
*space_id = (hid_t_f)c_space_id;
@@ -86,18 +86,19 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sclose_c ( hid_t_f *space_id )
+h5sclose_c(hid_t_f *space_id)
/******/
{
- int ret_value = 0;
- hid_t c_space_id;
+ int ret_value = 0;
+ hid_t c_space_id;
- c_space_id = (hid_t)*space_id;
- if ( H5Sclose(c_space_id) < 0 ) ret_value = -1;
- return ret_value;
+ c_space_id = (hid_t)*space_id;
+ if (H5Sclose(c_space_id) < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Sf/h5screate_c
@@ -117,21 +118,22 @@ h5sclose_c ( hid_t_f *space_id )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5screate_c ( int_f *classtype, hid_t_f *space_id )
+h5screate_c(int_f *classtype, hid_t_f *space_id)
/******/
{
- H5S_class_t c_classtype;
- int ret_value = 0;
- hid_t c_space_id;
- c_classtype = (H5S_class_t) *classtype;
- c_space_id = H5Screate(c_classtype);
-
- if ( c_space_id < 0 ) ret_value = -1;
- *space_id = (hid_t_f) c_space_id;
- return ret_value;
+ H5S_class_t c_classtype;
+ int ret_value = 0;
+ hid_t c_space_id;
+ c_classtype = (H5S_class_t)*classtype;
+ c_space_id = H5Screate(c_classtype);
+
+ if (c_space_id < 0)
+ ret_value = -1;
+ *space_id = (hid_t_f)c_space_id;
+ return ret_value;
}
/****if* H5Sf/h5scopy_c
@@ -151,22 +153,23 @@ h5screate_c ( int_f *classtype, hid_t_f *space_id )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5scopy_c( hid_t_f *space_id , hid_t_f *new_space_id)
+h5scopy_c(hid_t_f *space_id, hid_t_f *new_space_id)
/******/
{
- int ret_value = 0;
- hid_t c_new_space_id;
- hid_t c_space_id;
+ int ret_value = 0;
+ hid_t c_new_space_id;
+ hid_t c_space_id;
- c_space_id = (hid_t)*space_id;
- c_new_space_id = H5Scopy(c_space_id);
- if ( c_new_space_id < 0 ) ret_value = -1;
+ c_space_id = (hid_t)*space_id;
+ c_new_space_id = H5Scopy(c_space_id);
+ if (c_new_space_id < 0)
+ ret_value = -1;
- *new_space_id = (hid_t_f)c_new_space_id;
- return ret_value;
+ *new_space_id = (hid_t_f)c_new_space_id;
+ return ret_value;
}
/****if* H5Sf/h5sget_select_hyper_nblocks_c
@@ -189,22 +192,23 @@ h5scopy_c( hid_t_f *space_id , hid_t_f *new_space_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sget_select_hyper_nblocks_c( hid_t_f *space_id , hssize_t_f * num_blocks)
+h5sget_select_hyper_nblocks_c(hid_t_f *space_id, hssize_t_f *num_blocks)
/******/
{
- int ret_value = 0;
- hid_t c_space_id;
- hssize_t c_num_blocks;
+ int ret_value = 0;
+ hid_t c_space_id;
+ hssize_t c_num_blocks;
- c_space_id = (hid_t)*space_id;
- c_num_blocks = H5Sget_select_hyper_nblocks(c_space_id);
- if ( c_num_blocks < 0 ) ret_value = -1;
+ c_space_id = (hid_t)*space_id;
+ c_num_blocks = H5Sget_select_hyper_nblocks(c_space_id);
+ if (c_num_blocks < 0)
+ ret_value = -1;
- *num_blocks = (hssize_t_f)c_num_blocks;
- return ret_value;
+ *num_blocks = (hssize_t_f)c_num_blocks;
+ return ret_value;
}
/****if* H5Sf/h5sget_select_elem_npoints_c
@@ -227,22 +231,23 @@ h5sget_select_hyper_nblocks_c( hid_t_f *space_id , hssize_t_f * num_blocks)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sget_select_elem_npoints_c( hid_t_f *space_id , hssize_t_f * num_points)
+h5sget_select_elem_npoints_c(hid_t_f *space_id, hssize_t_f *num_points)
/******/
{
- int ret_value = 0;
- hid_t c_space_id;
- hssize_t c_num_points;
+ int ret_value = 0;
+ hid_t c_space_id;
+ hssize_t c_num_points;
- c_space_id = (hid_t)*space_id;
- c_num_points = H5Sget_select_elem_npoints(c_space_id);
- if ( c_num_points < 0 ) ret_value = -1;
+ c_space_id = (hid_t)*space_id;
+ c_num_points = H5Sget_select_elem_npoints(c_space_id);
+ if (c_num_points < 0)
+ ret_value = -1;
- *num_points = (hssize_t_f)c_num_points;
- return ret_value;
+ *num_points = (hssize_t_f)c_num_points;
+ return ret_value;
}
/****if* H5Sf/h5sget_select_hyper_blocklist_c
@@ -273,54 +278,56 @@ h5sget_select_elem_npoints_c( hid_t_f *space_id , hssize_t_f * num_points)
* Transpose dimension arrays because of C-FORTRAN storage order
* M. Scot Breitenfeld
* SOURCE
-*/
+ */
int_f
-h5sget_select_hyper_blocklist_c( hid_t_f *space_id ,hsize_t_f *startblock,
- hsize_t_f *num_blocks, hsize_t_f *buf)
+h5sget_select_hyper_blocklist_c(hid_t_f *space_id, hsize_t_f *startblock, hsize_t_f *num_blocks,
+ hsize_t_f *buf)
/******/
{
- int ret_value = -1;
- hid_t c_space_id;
- hsize_t c_num_blocks;
-
- hsize_t i;
- int j,k,m,n;
- int rank;
- hsize_t c_startblock, *c_buf;
-
- c_space_id = (hid_t)*space_id;
- c_num_blocks = (hsize_t)*num_blocks;
-
- rank = H5Sget_simple_extent_ndims(c_space_id);
- if (rank < 0 ) return ret_value;
- c_startblock = (hsize_t)*startblock;
-
- c_buf = (hsize_t*)HDmalloc(sizeof(hsize_t)*(size_t)(c_num_blocks*2*(hsize_t)rank));
- if (!c_buf) return ret_value;
-
- ret_value = H5Sget_select_hyper_blocklist(c_space_id, c_startblock,
- c_num_blocks, c_buf);
-
- /*
- * Transpose dimension arrays because of C-FORTRAN storage order and add 1
- */
- n = 0;
- m = 0;
- for (i=0; i < c_num_blocks; i++) {
- for (j=0; j < rank; j++) {
- for (k=0; k < rank; k++) {
- int t= (m + rank - k - 1);
- buf[n] = (hsize_t_f)c_buf[t]+1;
- n = n + 1;
- }
- m = m + rank;
+ int ret_value = -1;
+ hid_t c_space_id;
+ hsize_t c_num_blocks;
+
+ hsize_t i;
+ int j, k, m, n;
+ int rank;
+ hsize_t c_startblock, *c_buf;
+
+ c_space_id = (hid_t)*space_id;
+ c_num_blocks = (hsize_t)*num_blocks;
+
+ rank = H5Sget_simple_extent_ndims(c_space_id);
+ if (rank < 0)
+ return ret_value;
+ c_startblock = (hsize_t)*startblock;
+
+ c_buf = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)(c_num_blocks * 2 * (hsize_t)rank));
+ if (!c_buf)
+ return ret_value;
+
+ ret_value = H5Sget_select_hyper_blocklist(c_space_id, c_startblock, c_num_blocks, c_buf);
+
+ /*
+ * Transpose dimension arrays because of C-FORTRAN storage order and add 1
+ */
+ n = 0;
+ m = 0;
+ for (i = 0; i < c_num_blocks; i++) {
+ for (j = 0; j < rank; j++) {
+ for (k = 0; k < rank; k++) {
+ int t = (m + rank - k - 1);
+ buf[n] = (hsize_t_f)c_buf[t] + 1;
+ n = n + 1;
+ }
+ m = m + rank;
+ }
}
- }
- HDfree(c_buf);
- if (ret_value >= 0 ) ret_value = 0;
- return ret_value;
+ HDfree(c_buf);
+ if (ret_value >= 0)
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Sf/h5sget_select_bounds_c
@@ -346,29 +353,29 @@ h5sget_select_hyper_blocklist_c( hid_t_f *space_id ,hsize_t_f *startblock,
* matrix notation.
* M. Scot Breitenfeld
* SOURCE
-*/
+ */
int_f
-h5sget_select_bounds_c( hid_t_f *space_id , hsize_t_f * start, hsize_t_f * end)
+h5sget_select_bounds_c(hid_t_f *space_id, hsize_t_f *start, hsize_t_f *end)
/******/
{
- hid_t c_space_id;
+ hid_t c_space_id;
hsize_t c_start[H5S_MAX_RANK];
hsize_t c_end[H5S_MAX_RANK];
- int i, rank;
- int_f ret_value = 0;
+ int i, rank;
+ int_f ret_value = 0;
c_space_id = (hid_t)*space_id;
- rank = H5Sget_simple_extent_ndims(c_space_id);
- if(rank < 0 )
+ rank = H5Sget_simple_extent_ndims(c_space_id);
+ if (rank < 0)
HGOTO_DONE(FAIL)
- if(H5Sget_select_bounds(c_space_id, c_start, c_end) < 0)
+ if (H5Sget_select_bounds(c_space_id, c_start, c_end) < 0)
HGOTO_DONE(FAIL)
- for(i = 0; i < rank; i++) {
+ for (i = 0; i < rank; i++) {
start[i] = (hsize_t_f)(c_start[rank - i - 1] + 1);
- end[i] = (hsize_t_f)(c_end[rank - i - 1] + 1);
+ end[i] = (hsize_t_f)(c_end[rank - i - 1] + 1);
} /* end for */
done:
@@ -401,50 +408,51 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sget_select_elem_pointlist_c( hid_t_f *space_id ,hsize_t_f * startpoint,
- hsize_t_f * numpoints, hsize_t_f * buf)
+h5sget_select_elem_pointlist_c(hid_t_f *space_id, hsize_t_f *startpoint, hsize_t_f *numpoints, hsize_t_f *buf)
/******/
{
- int ret_value = -1;
- hid_t c_space_id;
- hsize_t c_num_points;
- hsize_t c_startpoint,* c_buf;
- hsize_t i, i1;
- int rank;
- int j,i2;
-
- c_space_id = (hid_t)*space_id;
- c_num_points = (hsize_t)* numpoints;
-
- rank = H5Sget_simple_extent_ndims(c_space_id);
- if (rank < 0 ) return ret_value;
-
- c_startpoint = (hsize_t)*startpoint;
- c_buf = (hsize_t*)HDmalloc(sizeof(hsize_t)*(size_t)(c_num_points*(hsize_t)rank));
- if (!c_buf) return ret_value;
- ret_value = H5Sget_select_elem_pointlist(c_space_id, c_startpoint,
- c_num_points, c_buf);
-
- /* re-arrange the return buffer to account for Fortran ordering of 2D arrays */
- /* and add 1 to account for array's starting at one in Fortran */
- i2 = 0;
- for( i = 0; i < c_num_points; i++) {
- i1 = (hsize_t)rank*(i+1);
- for(j = 0; j < rank; j++) {
- buf[i2] = (hsize_t_f)(c_buf[i1-1]+1);
- i2 = i2 + 1;
- i1 = i1 - 1;
+ int ret_value = -1;
+ hid_t c_space_id;
+ hsize_t c_num_points;
+ hsize_t c_startpoint, *c_buf;
+ hsize_t i, i1;
+ int rank;
+ int j, i2;
+
+ c_space_id = (hid_t)*space_id;
+ c_num_points = (hsize_t)*numpoints;
+
+ rank = H5Sget_simple_extent_ndims(c_space_id);
+ if (rank < 0)
+ return ret_value;
+
+ c_startpoint = (hsize_t)*startpoint;
+ c_buf = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)(c_num_points * (hsize_t)rank));
+ if (!c_buf)
+ return ret_value;
+ ret_value = H5Sget_select_elem_pointlist(c_space_id, c_startpoint, c_num_points, c_buf);
+
+ /* re-arrange the return buffer to account for Fortran ordering of 2D arrays */
+ /* and add 1 to account for array's starting at one in Fortran */
+ i2 = 0;
+ for (i = 0; i < c_num_points; i++) {
+ i1 = (hsize_t)rank * (i + 1);
+ for (j = 0; j < rank; j++) {
+ buf[i2] = (hsize_t_f)(c_buf[i1 - 1] + 1);
+ i2 = i2 + 1;
+ i1 = i1 - 1;
+ }
}
- }
- if (ret_value >= 0 ) ret_value = 0;
+ if (ret_value >= 0)
+ ret_value = 0;
- HDfree(c_buf);
+ HDfree(c_buf);
- return ret_value;
+ return ret_value;
}
/****if* H5Sf/h5sselect_all_c
@@ -462,18 +470,19 @@ h5sget_select_elem_pointlist_c( hid_t_f *space_id ,hsize_t_f * startpoint,
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sselect_all_c ( hid_t_f *space_id )
+h5sselect_all_c(hid_t_f *space_id)
/******/
{
- int ret_value = 0;
- hid_t c_space_id;
+ int ret_value = 0;
+ hid_t c_space_id;
- c_space_id = (hid_t)*space_id;
- if ( H5Sselect_all(c_space_id) < 0 ) ret_value = -1;
- return ret_value;
+ c_space_id = (hid_t)*space_id;
+ if (H5Sselect_all(c_space_id) < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Sf/h5sselect_none_c
@@ -491,18 +500,19 @@ h5sselect_all_c ( hid_t_f *space_id )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sselect_none_c ( hid_t_f *space_id )
+h5sselect_none_c(hid_t_f *space_id)
/******/
{
- int ret_value = 0;
- hid_t c_space_id;
+ int ret_value = 0;
+ hid_t c_space_id;
- c_space_id = (hid_t)*space_id;
- if ( H5Sselect_none(c_space_id) < 0 ) ret_value = -1;
- return ret_value;
+ c_space_id = (hid_t)*space_id;
+ if (H5Sselect_none(c_space_id) < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Sf/h5sselect_valid_c
@@ -524,21 +534,22 @@ h5sselect_none_c ( hid_t_f *space_id )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sselect_valid_c ( hid_t_f *space_id , int_f *flag )
+h5sselect_valid_c(hid_t_f *space_id, int_f *flag)
/******/
{
- int ret_value = 0;
- hid_t c_space_id;
- htri_t status;
-
- c_space_id = (hid_t)*space_id;
- status = H5Sselect_valid(c_space_id);
- *flag = (int_f)status;
- if ( status < 0 ) ret_value = -1;
- return ret_value;
+ int ret_value = 0;
+ hid_t c_space_id;
+ htri_t status;
+
+ c_space_id = (hid_t)*space_id;
+ status = H5Sselect_valid(c_space_id);
+ *flag = (int_f)status;
+ if (status < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Sf/h5sget_simple_extent_npoints_c
@@ -559,21 +570,22 @@ h5sselect_valid_c ( hid_t_f *space_id , int_f *flag )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sget_simple_extent_npoints_c ( hid_t_f *space_id , hsize_t_f *npoints )
+h5sget_simple_extent_npoints_c(hid_t_f *space_id, hsize_t_f *npoints)
/******/
{
- int ret_value = 0;
- hid_t c_space_id;
- hssize_t c_npoints;
-
- c_space_id = (hid_t)*space_id;
- c_npoints = H5Sget_simple_extent_npoints(c_space_id);
- if ( c_npoints == 0 ) ret_value = -1;
- *npoints = (hsize_t_f)c_npoints;
- return ret_value;
+ int ret_value = 0;
+ hid_t c_space_id;
+ hssize_t c_npoints;
+
+ c_space_id = (hid_t)*space_id;
+ c_npoints = H5Sget_simple_extent_npoints(c_space_id);
+ if (c_npoints == 0)
+ ret_value = -1;
+ *npoints = (hsize_t_f)c_npoints;
+ return ret_value;
}
/****if* H5Sf/h5sget_select_npoints_c
@@ -594,21 +606,22 @@ h5sget_simple_extent_npoints_c ( hid_t_f *space_id , hsize_t_f *npoints )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sget_select_npoints_c ( hid_t_f *space_id , hssize_t_f *npoints )
+h5sget_select_npoints_c(hid_t_f *space_id, hssize_t_f *npoints)
/******/
{
- int ret_value = 0;
- hssize_t c_npoints;
- hid_t c_space_id;
-
- c_space_id = (hid_t)*space_id;
- c_npoints = H5Sget_select_npoints(c_space_id);
- if ( c_npoints < 0 ) ret_value = -1;
- *npoints = (hssize_t_f)c_npoints;
- return ret_value;
+ int ret_value = 0;
+ hssize_t c_npoints;
+ hid_t c_space_id;
+
+ c_space_id = (hid_t)*space_id;
+ c_npoints = H5Sget_select_npoints(c_space_id);
+ if (c_npoints < 0)
+ ret_value = -1;
+ *npoints = (hssize_t_f)c_npoints;
+ return ret_value;
}
/****if* H5Sf/h5sget_simple_extent_ndims_c
@@ -629,21 +642,22 @@ h5sget_select_npoints_c ( hid_t_f *space_id , hssize_t_f *npoints )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sget_simple_extent_ndims_c ( hid_t_f *space_id , int_f *ndims )
+h5sget_simple_extent_ndims_c(hid_t_f *space_id, int_f *ndims)
/******/
{
- int ret_value = 0;
- hid_t c_space_id;
- int c_ndims;
-
- c_space_id = (hid_t)*space_id;
- c_ndims = H5Sget_simple_extent_ndims(c_space_id);
- if ( c_ndims < 0 ) ret_value = -1;
- *ndims = (int_f)c_ndims;
- return ret_value;
+ int ret_value = 0;
+ hid_t c_space_id;
+ int c_ndims;
+
+ c_space_id = (hid_t)*space_id;
+ c_ndims = H5Sget_simple_extent_ndims(c_space_id);
+ if (c_ndims < 0)
+ ret_value = -1;
+ *ndims = (int_f)c_ndims;
+ return ret_value;
}
/****if* H5Sf/h5sget_simple_extent_type_c
@@ -665,26 +679,27 @@ h5sget_simple_extent_ndims_c ( hid_t_f *space_id , int_f *ndims )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sget_simple_extent_type_c ( hid_t_f *space_id , int_f *classtype)
+h5sget_simple_extent_type_c(hid_t_f *space_id, int_f *classtype)
/******/
{
- int ret_value = 0;
- hid_t c_space_id;
- H5S_class_t c_classtype;
-
- c_space_id = (hid_t)*space_id;
- c_classtype = H5Sget_simple_extent_type(c_space_id);
- if ( c_classtype < 0 ) ret_value = -1;
- *classtype = c_classtype;
-/*
- if (c_classtype == H5S_SCALAR) *classtype = H5S_SCALAR_F;
- if (c_classtype == H5S_SIMPLE) *classtype = H5S_SIMPLE_F;
- if (c_classtype == H5S_NULL) *classtype = H5S_NULL_F;
-*/
- return ret_value;
+ int ret_value = 0;
+ hid_t c_space_id;
+ H5S_class_t c_classtype;
+
+ c_space_id = (hid_t)*space_id;
+ c_classtype = H5Sget_simple_extent_type(c_space_id);
+ if (c_classtype < 0)
+ ret_value = -1;
+ *classtype = c_classtype;
+ /*
+ if (c_classtype == H5S_SCALAR) *classtype = H5S_SCALAR_F;
+ if (c_classtype == H5S_SIMPLE) *classtype = H5S_SIMPLE_F;
+ if (c_classtype == H5S_NULL) *classtype = H5S_NULL_F;
+ */
+ return ret_value;
}
/****if* H5Sf/h5soffset_simple_c
@@ -704,30 +719,30 @@ h5sget_simple_extent_type_c ( hid_t_f *space_id , int_f *classtype)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5soffset_simple_c ( hid_t_f *space_id , hssize_t_f *offset)
+h5soffset_simple_c(hid_t_f *space_id, hssize_t_f *offset)
/******/
{
- hid_t c_space_id;
- int rank;
+ hid_t c_space_id;
+ int rank;
hssize_t c_offset[H5S_MAX_RANK];
- int i;
- int_f ret_value = 0;
+ int i;
+ int_f ret_value = 0;
c_space_id = (hid_t)*space_id;
- rank = H5Sget_simple_extent_ndims(c_space_id);
- if(rank < 0)
+ rank = H5Sget_simple_extent_ndims(c_space_id);
+ if (rank < 0)
HGOTO_DONE(FAIL)
/*
* Reverse dimensions due to C-FORTRAN storage order.
*/
- for(i = 0; i < rank; i++)
+ for (i = 0; i < rank; i++)
c_offset[i] = offset[rank - i - 1];
- if(H5Soffset_simple(c_space_id, c_offset) < 0)
+ if (H5Soffset_simple(c_space_id, c_offset) < 0)
HGOTO_DONE(FAIL)
done:
@@ -753,33 +768,32 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sset_extent_simple_c ( hid_t_f *space_id , int_f *rank, hsize_t_f *current_size, hsize_t_f *maximum_size)
+h5sset_extent_simple_c(hid_t_f *space_id, int_f *rank, hsize_t_f *current_size, hsize_t_f *maximum_size)
/******/
{
hsize_t c_current_size[H5S_MAX_RANK];
hsize_t c_maximum_size[H5S_MAX_RANK];
- int i;
- int_f ret_value = 0;
+ int i;
+ int_f ret_value = 0;
/*
* Reverse dimensions due to C-FORTRAN storage order.
*/
- for(i = 0; i < *rank; i++) {
+ for (i = 0; i < *rank; i++) {
c_current_size[i] = (hsize_t)current_size[*rank - i - 1];
c_maximum_size[i] = (hsize_t)maximum_size[*rank - i - 1];
} /* end for */
- if(H5Sset_extent_simple((hid_t)*space_id, (int)*rank, c_current_size, c_maximum_size) < 0)
+ if (H5Sset_extent_simple((hid_t)*space_id, (int)*rank, c_current_size, c_maximum_size) < 0)
HGOTO_DONE(FAIL)
done:
return ret_value;
}
-
/****if* H5Sf/h5sget_simple_extent_dims_c
* NAME
* h5sget_simple_extent_dims_c
@@ -799,32 +813,32 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sget_simple_extent_dims_c ( hid_t_f *space_id , hsize_t_f *dims, hsize_t_f *maxdims)
+h5sget_simple_extent_dims_c(hid_t_f *space_id, hsize_t_f *dims, hsize_t_f *maxdims)
/******/
{
- hid_t c_space_id;
+ hid_t c_space_id;
hsize_t c_dims[H5S_MAX_RANK];
hsize_t c_maxdims[H5S_MAX_RANK];
- int rank;
- int i;
- int_f ret_value;
+ int rank;
+ int i;
+ int_f ret_value;
c_space_id = (hid_t)*space_id;
- rank = H5Sget_simple_extent_ndims(c_space_id);
- if(rank < 0)
+ rank = H5Sget_simple_extent_ndims(c_space_id);
+ if (rank < 0)
HGOTO_DONE(FAIL)
- if(H5Sget_simple_extent_dims(c_space_id, c_dims, c_maxdims) < 0)
+ if (H5Sget_simple_extent_dims(c_space_id, c_dims, c_maxdims) < 0)
HGOTO_DONE(FAIL)
/*
* Reverse dimensions due to C-FORTRAN storage order.
*/
- for(i = 0; i < rank; i++) {
- dims[rank - i - 1] = (hsize_t_f)c_dims[i];
+ for (i = 0; i < rank; i++) {
+ dims[rank - i - 1] = (hsize_t_f)c_dims[i];
maxdims[rank - i - 1] = (hsize_t_f)c_maxdims[i];
} /* end for */
@@ -853,23 +867,23 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sis_simple_c ( hid_t_f *space_id , int_f *flag )
+h5sis_simple_c(hid_t_f *space_id, int_f *flag)
/******/
{
- int ret_value = 0;
- hid_t c_space_id;
- htri_t status;
-
- c_space_id = (hid_t)*space_id;
- status = H5Sis_simple(c_space_id);
- *flag = (int_f)status;
- if ( status < 0 ) ret_value = -1;
- return ret_value;
-}
+ int ret_value = 0;
+ hid_t c_space_id;
+ htri_t status;
+ c_space_id = (hid_t)*space_id;
+ status = H5Sis_simple(c_space_id);
+ *flag = (int_f)status;
+ if (status < 0)
+ ret_value = -1;
+ return ret_value;
+}
/****if* H5Sf/h5sextent_copy_c
* NAME
@@ -887,21 +901,22 @@ h5sis_simple_c ( hid_t_f *space_id , int_f *flag )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sextent_copy_c ( hid_t_f *dest_space_id , hid_t_f *source_space_id)
+h5sextent_copy_c(hid_t_f *dest_space_id, hid_t_f *source_space_id)
/******/
{
- int ret_value = 0;
- hid_t c_dest_space_id, c_source_space_id;
- herr_t status;
-
- c_dest_space_id = (hid_t)*dest_space_id;
- c_source_space_id = (hid_t)*source_space_id;
- status = H5Sextent_copy(c_dest_space_id, c_source_space_id);
- if ( status < 0 ) ret_value = -1;
- return ret_value;
+ int ret_value = 0;
+ hid_t c_dest_space_id, c_source_space_id;
+ herr_t status;
+
+ c_dest_space_id = (hid_t)*dest_space_id;
+ c_source_space_id = (hid_t)*source_space_id;
+ status = H5Sextent_copy(c_dest_space_id, c_source_space_id);
+ if (status < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Sf/h5sset_extent_none_c
@@ -919,20 +934,21 @@ h5sextent_copy_c ( hid_t_f *dest_space_id , hid_t_f *source_space_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sset_extent_none_c ( hid_t_f *space_id )
+h5sset_extent_none_c(hid_t_f *space_id)
/******/
{
- int ret_value = 0;
- hid_t c_space_id;
- herr_t status;
-
- c_space_id = (hid_t)*space_id;
- status = H5Sset_extent_none(c_space_id);
- if ( status < 0 ) ret_value = -1;
- return ret_value;
+ int ret_value = 0;
+ hid_t c_space_id;
+ herr_t status;
+
+ c_space_id = (hid_t)*space_id;
+ status = H5Sset_extent_none(c_space_id);
+ if (status < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Sf/h5sselect_hyperslab_c
@@ -957,37 +973,38 @@ h5sset_extent_none_c ( hid_t_f *space_id )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sselect_hyperslab_c ( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block)
+h5sselect_hyperslab_c(hid_t_f *space_id, int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride,
+ hsize_t_f *block)
/******/
{
hsize_t c_start[H5S_MAX_RANK];
hsize_t c_count[H5S_MAX_RANK];
hsize_t c_stride[H5S_MAX_RANK];
hsize_t c_block[H5S_MAX_RANK];
- int rank;
- int i;
- int_f ret_value = 0;
+ int rank;
+ int i;
+ int_f ret_value = 0;
rank = H5Sget_simple_extent_ndims((hid_t)*space_id);
- if(rank < 0 )
+ if (rank < 0)
HGOTO_DONE(FAIL)
/*
* Reverse dimensions due to C-FORTRAN storage order.
*/
- for(i = 0; i < rank; i++) {
+ for (i = 0; i < rank; i++) {
int t = (rank - i) - 1;
- c_start[i] = (hsize_t)start[t];
- c_count[i] = (hsize_t)count[t];
+ c_start[i] = (hsize_t)start[t];
+ c_count[i] = (hsize_t)count[t];
c_stride[i] = (hsize_t)stride[t];
- c_block[i] = (hsize_t)block[t];
+ c_block[i] = (hsize_t)block[t];
} /* end for */
- if(H5Sselect_hyperslab((hid_t)*space_id, (H5S_seloper_t)*op, c_start, c_stride, c_count, c_block) < 0)
+ if (H5Sselect_hyperslab((hid_t)*space_id, (H5S_seloper_t)*op, c_start, c_stride, c_count, c_block) < 0)
HGOTO_DONE(FAIL)
done:
@@ -1016,64 +1033,74 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block, hid_t_f *hyper_id)
+h5scombine_hyperslab_c(hid_t_f *space_id, int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride,
+ hsize_t_f *block, hid_t_f *hyper_id)
/******/
{
- int ret_value = -1;
- hid_t c_space_id;
- hid_t c_hyper_id;
- hsize_t *c_start = NULL;
- hsize_t *c_count = NULL;
- hsize_t *c_stride = NULL;
- hsize_t *c_block = NULL;
-
- H5S_seloper_t c_op;
- int rank;
- int i;
-
- rank = H5Sget_simple_extent_ndims(*space_id);
- if (rank < 0 ) return ret_value;
- c_start = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank);
- if (c_start == NULL) goto DONE;
-
- c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank);
- if (c_count == NULL) goto DONE;
-
- c_stride = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank);
- if (c_stride == NULL) goto DONE;
-
- c_block = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank);
- if (c_block == NULL) goto DONE;
-
-
- /*
- * Reverse dimensions due to C-FORTRAN storage order.
- */
-
- for (i=0; i < rank; i++) {
- int t= (rank - i) - 1;
- c_start[i] = (hsize_t)start[t];
- c_count[i] = (hsize_t)count[t];
- c_stride[i] = (hsize_t)stride[t];
- c_block[i] = (hsize_t)block[t];
- }
-
- c_op = (H5S_seloper_t)*op;
-
- c_space_id = (hid_t)*space_id;
- c_hyper_id = H5Scombine_hyperslab(c_space_id, c_op, c_start, c_stride, c_count, c_block);
- if ( c_hyper_id < 0 ) goto DONE;
- *hyper_id = (hid_t_f)c_hyper_id;
- ret_value = 0;
+ int ret_value = -1;
+ hid_t c_space_id;
+ hid_t c_hyper_id;
+ hsize_t *c_start = NULL;
+ hsize_t *c_count = NULL;
+ hsize_t *c_stride = NULL;
+ hsize_t *c_block = NULL;
+
+ H5S_seloper_t c_op;
+ int rank;
+ int i;
+
+ rank = H5Sget_simple_extent_ndims(*space_id);
+ if (rank < 0)
+ return ret_value;
+ c_start = (hsize_t *)HDmalloc(sizeof(hsize_t) * (unsigned)rank);
+ if (c_start == NULL)
+ goto DONE;
+
+ c_count = (hsize_t *)HDmalloc(sizeof(hsize_t) * (unsigned)rank);
+ if (c_count == NULL)
+ goto DONE;
+
+ c_stride = (hsize_t *)HDmalloc(sizeof(hsize_t) * (unsigned)rank);
+ if (c_stride == NULL)
+ goto DONE;
+
+ c_block = (hsize_t *)HDmalloc(sizeof(hsize_t) * (unsigned)rank);
+ if (c_block == NULL)
+ goto DONE;
+
+ /*
+ * Reverse dimensions due to C-FORTRAN storage order.
+ */
+
+ for (i = 0; i < rank; i++) {
+ int t = (rank - i) - 1;
+ c_start[i] = (hsize_t)start[t];
+ c_count[i] = (hsize_t)count[t];
+ c_stride[i] = (hsize_t)stride[t];
+ c_block[i] = (hsize_t)block[t];
+ }
+
+ c_op = (H5S_seloper_t)*op;
+
+ c_space_id = (hid_t)*space_id;
+ c_hyper_id = H5Scombine_hyperslab(c_space_id, c_op, c_start, c_stride, c_count, c_block);
+ if (c_hyper_id < 0)
+ goto DONE;
+ *hyper_id = (hid_t_f)c_hyper_id;
+ ret_value = 0;
DONE:
- if(c_start != NULL) HDfree(c_start);
- if(c_count != NULL) HDfree(c_count);
- if(c_stride!= NULL) HDfree(c_stride);
- if(c_block != NULL) HDfree(c_block);
- return ret_value;
+ if (c_start != NULL)
+ HDfree(c_start);
+ if (c_count != NULL)
+ HDfree(c_count);
+ if (c_stride != NULL)
+ HDfree(c_stride);
+ if (c_block != NULL)
+ HDfree(c_block);
+ return ret_value;
}
/****if* H5Sf/h5scombine_select_c
* NAME
@@ -1094,27 +1121,28 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5scombine_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t_f *ds_id)
+h5scombine_select_c(hid_t_f *space1_id, int_f *op, hid_t_f *space2_id, hid_t_f *ds_id)
/******/
{
- int ret_value = -1;
- hid_t c_space1_id;
- hid_t c_space2_id;
- hid_t c_ds_id;
- H5S_seloper_t c_op;
-
- c_op = (H5S_seloper_t)*op;
-
- c_space1_id = (hid_t)*space1_id;
- c_space2_id = (hid_t)*space2_id;
- c_ds_id = H5Scombine_select(c_space1_id, c_op, c_space2_id);
- if ( c_ds_id < 0 ) return ret_value;
- *ds_id = (hid_t_f)c_ds_id;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_space1_id;
+ hid_t c_space2_id;
+ hid_t c_ds_id;
+ H5S_seloper_t c_op;
+
+ c_op = (H5S_seloper_t)*op;
+
+ c_space1_id = (hid_t)*space1_id;
+ c_space2_id = (hid_t)*space2_id;
+ c_ds_id = H5Scombine_select(c_space1_id, c_op, c_space2_id);
+ if (c_ds_id < 0)
+ return ret_value;
+ *ds_id = (hid_t_f)c_ds_id;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Sf/h5smodify_select_c
* NAME
@@ -1133,24 +1161,25 @@ h5scombine_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t_
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5smodify_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id)
+h5smodify_select_c(hid_t_f *space1_id, int_f *op, hid_t_f *space2_id)
/******/
{
- int ret_value = -1;
- hid_t c_space1_id;
- hid_t c_space2_id;
- H5S_seloper_t c_op;
-
- c_op = (H5S_seloper_t)*op;
-
- c_space1_id = (hid_t)*space1_id;
- c_space2_id = (hid_t)*space2_id;
- if( H5Smodify_select(c_space1_id, c_op, c_space2_id)< 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_space1_id;
+ hid_t c_space2_id;
+ H5S_seloper_t c_op;
+
+ c_op = (H5S_seloper_t)*op;
+
+ c_space1_id = (hid_t)*space1_id;
+ c_space2_id = (hid_t)*space2_id;
+ if (H5Smodify_select(c_space1_id, c_op, c_space2_id) < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Sf/h5sget_select_type_c
@@ -1170,23 +1199,23 @@ h5smodify_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sget_select_type_c ( hid_t_f *space_id , int_f *type)
+h5sget_select_type_c(hid_t_f *space_id, int_f *type)
/******/
{
- int ret_value = -1;
- hid_t c_space_id;
- H5S_sel_type c_type;
-
- c_space_id = (hid_t)*space_id;
- c_type = H5Sget_select_type(c_space_id);
- if(c_type < 0) return ret_value;
- *type = (int_f)c_type;
- ret_value = 0;
- return ret_value;
-}
+ int ret_value = -1;
+ hid_t c_space_id;
+ H5S_sel_type c_type;
+ c_space_id = (hid_t)*space_id;
+ c_type = H5Sget_select_type(c_space_id);
+ if (c_type < 0)
+ return ret_value;
+ *type = (int_f)c_type;
+ ret_value = 0;
+ return ret_value;
+}
/****if* H5Sf/h5sselect_elements_c
* NAME
@@ -1208,40 +1237,42 @@ h5sget_select_type_c ( hid_t_f *space_id , int_f *type)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f *nelements, hsize_t_f *coord)
+h5sselect_elements_c(hid_t_f *space_id, int_f *op, size_t_f *nelements, hsize_t_f *coord)
/******/
{
- int ret_value = -1;
- hid_t c_space_id;
- H5S_seloper_t c_op;
- herr_t status;
- int rank;
- size_t i;
- int j;
- hsize_t *c_coord;
- size_t c_nelements;
-
- c_op = (H5S_seloper_t)*op;
-
- c_space_id = *space_id;
- rank = H5Sget_simple_extent_ndims(c_space_id);
-
- c_coord = (hsize_t *)HDmalloc(sizeof(hsize_t)*(size_t)rank*((size_t)*nelements));
- if(!c_coord) return ret_value;
- for (i=0; i< (size_t)*nelements; i++) {
- for (j = 0; j < rank; j++) {
- c_coord[(size_t)j+i*(size_t)rank] = (hsize_t)coord[(size_t)j + i*(size_t)rank];
- }
- }
-
- c_nelements = *nelements;
- status = H5Sselect_elements(c_space_id, c_op, c_nelements, c_coord);
- if ( status >= 0 ) ret_value = 0;
- HDfree(c_coord);
- return ret_value;
+ int ret_value = -1;
+ hid_t c_space_id;
+ H5S_seloper_t c_op;
+ herr_t status;
+ int rank;
+ size_t i;
+ int j;
+ hsize_t * c_coord;
+ size_t c_nelements;
+
+ c_op = (H5S_seloper_t)*op;
+
+ c_space_id = *space_id;
+ rank = H5Sget_simple_extent_ndims(c_space_id);
+
+ c_coord = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)rank * ((size_t)*nelements));
+ if (!c_coord)
+ return ret_value;
+ for (i = 0; i < (size_t)*nelements; i++) {
+ for (j = 0; j < rank; j++) {
+ c_coord[(size_t)j + i * (size_t)rank] = (hsize_t)coord[(size_t)j + i * (size_t)rank];
+ }
+ }
+
+ c_nelements = *nelements;
+ status = H5Sselect_elements(c_space_id, c_op, c_nelements, c_coord);
+ if (status >= 0)
+ ret_value = 0;
+ HDfree(c_coord);
+ return ret_value;
}
/****if* H5Sf/h5sdecode_c
@@ -1261,30 +1292,30 @@ h5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f *nelements, hsiz
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sdecode_c ( _fcd buf, hid_t_f *obj_id )
+h5sdecode_c(_fcd buf, hid_t_f *obj_id)
/******/
{
- int ret_value = -1;
- unsigned char *c_buf = NULL; /* Buffer to hold C string */
- hid_t c_obj_id;
+ int ret_value = -1;
+ unsigned char *c_buf = NULL; /* Buffer to hold C string */
+ hid_t c_obj_id;
- /*
- * Call H5Sdecode function.
- */
+ /*
+ * Call H5Sdecode function.
+ */
- c_buf = (unsigned char*)buf;
+ c_buf = (unsigned char *)buf;
- c_obj_id = H5Sdecode(c_buf);
- if(c_obj_id < 0)
- return ret_value;
+ c_obj_id = H5Sdecode(c_buf);
+ if (c_obj_id < 0)
+ return ret_value;
- *obj_id = (hid_t_f)c_obj_id;
- ret_value = 0;
+ *obj_id = (hid_t_f)c_obj_id;
+ ret_value = 0;
- return ret_value;
+ return ret_value;
}
/****if* H5Sf/h5sencode_c
@@ -1304,55 +1335,56 @@ h5sdecode_c ( _fcd buf, hid_t_f *obj_id )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc, hid_t_f *fapl_id )
+h5sencode_c(_fcd buf, hid_t_f *obj_id, size_t_f *nalloc, hid_t_f *fapl_id)
/******/
{
- int ret_value = -1;
- unsigned char *c_buf = NULL; /* Buffer to hold C string */
- size_t c_size;
+ int ret_value = -1;
+ unsigned char *c_buf = NULL; /* Buffer to hold C string */
+ size_t c_size;
- /* return just the size of the allocated buffer;
- * equivalent to C routine for which 'name' is set equal to NULL
- */
+ /* return just the size of the allocated buffer;
+ * equivalent to C routine for which 'name' is set equal to NULL
+ */
- if (*nalloc == 0) {
+ if (*nalloc == 0) {
- if(H5Sencode2((hid_t)*obj_id, c_buf, &c_size, (hid_t)*fapl_id) < 0)
- return ret_value;
+ if (H5Sencode2((hid_t)*obj_id, c_buf, &c_size, (hid_t)*fapl_id) < 0)
+ return ret_value;
- *nalloc = (size_t_f)c_size;
+ *nalloc = (size_t_f)c_size;
- ret_value = 0;
- return ret_value;
- }
+ ret_value = 0;
+ return ret_value;
+ }
- c_size = (size_t)*nalloc;
- /*
- * Allocate buffer
- */
- if(NULL == (c_buf = (unsigned char *)HDmalloc(c_size)))
- return ret_value;
- /*
- * Call H5Sencode function.
- */
- if(H5Sencode2((hid_t)*obj_id, c_buf, &c_size, (hid_t)*fapl_id) < 0){
- return ret_value;
- }
+ c_size = (size_t)*nalloc;
+ /*
+ * Allocate buffer
+ */
+ if (NULL == (c_buf = (unsigned char *)HDmalloc(c_size)))
+ return ret_value;
+ /*
+ * Call H5Sencode function.
+ */
+ if (H5Sencode2((hid_t)*obj_id, c_buf, &c_size, (hid_t)*fapl_id) < 0) {
+ return ret_value;
+ }
- /* copy the C buffer to the FORTRAN buffer.
- * Can not use HD5packFstring because we don't want to
- * eliminate the NUL terminator or pad remaining space
- * with blanks.
- */
+ /* copy the C buffer to the FORTRAN buffer.
+ * Can not use HD5packFstring because we don't want to
+ * eliminate the NUL terminator or pad remaining space
+ * with blanks.
+ */
- HDmemcpy(_fcdtocp(buf),(char *)c_buf,c_size);
+ HDmemcpy(_fcdtocp(buf), (char *)c_buf, c_size);
- ret_value = 0;
- if(c_buf) HDfree(c_buf);
- return ret_value;
+ ret_value = 0;
+ if (c_buf)
+ HDfree(c_buf);
+ return ret_value;
}
/****if* H5Sf/h5sextent_equal_c
@@ -1373,18 +1405,17 @@ h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc, hid_t_f *fapl_id )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5sextent_equal_c ( hid_t_f * space1_id, hid_t_f *space2_id, hid_t_f *c_equal)
+h5sextent_equal_c(hid_t_f *space1_id, hid_t_f *space2_id, hid_t_f *c_equal)
/******/
{
- int ret_value = -1;
+ int ret_value = -1;
- if( (*c_equal = (hid_t_f)H5Sextent_equal((hid_t)*space1_id, (hid_t)*space2_id)) < 0)
- return ret_value;
+ if ((*c_equal = (hid_t_f)H5Sextent_equal((hid_t)*space1_id, (hid_t)*space2_id)) < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
-
diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c
index c40abae..1b9cbd1 100644
--- a/fortran/src/H5Tf.c
+++ b/fortran/src/H5Tf.c
@@ -17,7 +17,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include "H5f90.h"
@@ -41,32 +41,32 @@
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5topen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *tapl_id)
+h5topen_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *tapl_id)
/******/
{
char *c_name = NULL;
hid_t c_type_id;
- int ret_value = -1;
+ int ret_value = -1;
/*
* Convert FORTRAN name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
goto done;
/*
* Call H5Topen2 function.
*/
- if((c_type_id = H5Topen2((hid_t)*loc_id, c_name, (hid_t)*tapl_id)) < 0)
+ if ((c_type_id = H5Topen2((hid_t)*loc_id, c_name, (hid_t)*tapl_id)) < 0)
goto done;
*type_id = (hid_t_f)c_type_id;
ret_value = 0;
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
@@ -95,27 +95,28 @@ done:
* - Added passing optional parameters for version 1.8
* M. Scot Breitenfeld
* SOURCE
-*/
+ */
int_f
-h5tcommit_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id,
- hid_t_f *lcpl_id, hid_t_f *tcpl_id, hid_t_f *tapl_id)
+h5tcommit_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *lcpl_id, hid_t_f *tcpl_id,
+ hid_t_f *tapl_id)
/******/
{
- char *c_name = NULL;
- int ret_value = -1;
+ char *c_name = NULL;
+ int ret_value = -1;
/* Convert FORTRAN name to C name */
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
goto done;
/* Call H5Tcommit2 function */
- if(H5Tcommit2((hid_t)*loc_id, c_name, (hid_t)*type_id, (hid_t)*lcpl_id, (hid_t)*tcpl_id, (hid_t)*tapl_id) < 0)
+ if (H5Tcommit2((hid_t)*loc_id, c_name, (hid_t)*type_id, (hid_t)*lcpl_id, (hid_t)*tcpl_id,
+ (hid_t)*tapl_id) < 0)
goto done;
ret_value = 0;
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
}
@@ -135,18 +136,19 @@ done:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tclose_c ( hid_t_f *type_id )
+h5tclose_c(hid_t_f *type_id)
/******/
{
- int ret_value = 0;
- hid_t c_type_id;
+ int ret_value = 0;
+ hid_t c_type_id;
- c_type_id = *type_id;
- if ( H5Tclose(c_type_id) < 0 ) ret_value = -1;
- return ret_value;
+ c_type_id = *type_id;
+ if (H5Tclose(c_type_id) < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Tf/h5tcopy_c
@@ -166,21 +168,22 @@ h5tclose_c ( hid_t_f *type_id )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tcopy_c ( hid_t_f *type_id , hid_t_f *new_type_id)
+h5tcopy_c(hid_t_f *type_id, hid_t_f *new_type_id)
/******/
{
- int ret_value = 0;
- hid_t c_type_id;
- hid_t c_new_type_id;
-
- c_type_id = *type_id;
- c_new_type_id = H5Tcopy(c_type_id);
- if ( c_new_type_id < 0 ) ret_value = -1;
- *new_type_id = (hid_t_f)c_new_type_id;
- return ret_value;
+ int ret_value = 0;
+ hid_t c_type_id;
+ hid_t c_new_type_id;
+
+ c_type_id = *type_id;
+ c_new_type_id = H5Tcopy(c_type_id);
+ if (c_new_type_id < 0)
+ ret_value = -1;
+ *new_type_id = (hid_t_f)c_new_type_id;
+ return ret_value;
}
/****if* H5Tf/h5tequal_c
@@ -201,23 +204,24 @@ h5tcopy_c ( hid_t_f *type_id , hid_t_f *new_type_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tequal_c ( hid_t_f *type1_id , hid_t_f *type2_id, int_f *c_flag)
+h5tequal_c(hid_t_f *type1_id, hid_t_f *type2_id, int_f *c_flag)
/******/
{
- int ret_value = -1;
- hid_t c_type1_id, c_type2_id;
- htri_t status;
-
- c_type1_id = *type1_id;
- c_type2_id = *type2_id;
- status = H5Tequal(c_type1_id, c_type2_id);
- if ( status < 0 ) return ret_value;
- *c_flag = (int_f)status;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type1_id, c_type2_id;
+ htri_t status;
+
+ c_type1_id = *type1_id;
+ c_type2_id = *type2_id;
+ status = H5Tequal(c_type1_id, c_type2_id);
+ if (status < 0)
+ return ret_value;
+ *c_flag = (int_f)status;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_class_c
@@ -249,37 +253,37 @@ h5tequal_c ( hid_t_f *type1_id , hid_t_f *type2_id, int_f *c_flag)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_class_c ( hid_t_f *type_id , int_f *classtype)
+h5tget_class_c(hid_t_f *type_id, int_f *classtype)
/******/
{
- int ret_value = 0;
- hid_t c_type_id;
- H5T_class_t c_classtype;
-
- c_type_id = *type_id;
- c_classtype = H5Tget_class(c_type_id);
- if (c_classtype == H5T_NO_CLASS ) {
- /* *classtype = H5T_NO_CLASS_F; */
- *classtype = (int_f)H5T_NO_CLASS;
- ret_value = -1;
- return ret_value;
- }
- *classtype = c_classtype;
-/*
- if (c_classtype == H5T_INTEGER) *classtype = H5T_INTEGER_F;
- if (c_classtype == H5T_FLOAT) *classtype = H5T_FLOAT_F;
- if (c_classtype == H5T_TIME) *classtype = H5T_TIME_F;
- if (c_classtype == H5T_STRING) *classtype = H5T_STRING_F;
- if (c_classtype == H5T_BITFIELD) *classtype = H5T_BITFIELD_F;
- if (c_classtype == H5T_OPAQUE) *classtype = H5T_OPAQUE_F;
- if (c_classtype == H5T_COMPOUND) *classtype = H5T_COMPOUND_F;
- if (c_classtype == H5T_REFERENCE) *classtype = H5T_REFERENCE_F;
- if (c_classtype == H5T_ENUM) *classtype = H5T_ENUM_F;
-*/
- return ret_value;
+ int ret_value = 0;
+ hid_t c_type_id;
+ H5T_class_t c_classtype;
+
+ c_type_id = *type_id;
+ c_classtype = H5Tget_class(c_type_id);
+ if (c_classtype == H5T_NO_CLASS) {
+ /* *classtype = H5T_NO_CLASS_F; */
+ *classtype = (int_f)H5T_NO_CLASS;
+ ret_value = -1;
+ return ret_value;
+ }
+ *classtype = c_classtype;
+ /*
+ if (c_classtype == H5T_INTEGER) *classtype = H5T_INTEGER_F;
+ if (c_classtype == H5T_FLOAT) *classtype = H5T_FLOAT_F;
+ if (c_classtype == H5T_TIME) *classtype = H5T_TIME_F;
+ if (c_classtype == H5T_STRING) *classtype = H5T_STRING_F;
+ if (c_classtype == H5T_BITFIELD) *classtype = H5T_BITFIELD_F;
+ if (c_classtype == H5T_OPAQUE) *classtype = H5T_OPAQUE_F;
+ if (c_classtype == H5T_COMPOUND) *classtype = H5T_COMPOUND_F;
+ if (c_classtype == H5T_REFERENCE) *classtype = H5T_REFERENCE_F;
+ if (c_classtype == H5T_ENUM) *classtype = H5T_ENUM_F;
+ */
+ return ret_value;
}
/****if* H5Tf/h5tget_order_c
@@ -302,29 +306,29 @@ h5tget_class_c ( hid_t_f *type_id , int_f *classtype)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_order_c ( hid_t_f *type_id , int_f *order)
+h5tget_order_c(hid_t_f *type_id, int_f *order)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- H5T_order_t c_order;
-
- c_type_id = *type_id;
- c_order = H5Tget_order(c_type_id);
- if ( c_order < 0 ) return ret_value;
- *order = (int_f)c_order;
- ret_value = 0;
-/*
- if ( c_order == H5T_ORDER_LE) *order = H5T_ORDER_LE_F;
- if ( c_order == H5T_ORDER_BE) *order = H5T_ORDER_BE_F;
- if ( c_order == H5T_ORDER_VAX) *order = H5T_ORDER_VAX_F;
-*/
- return ret_value;
-}
+ int ret_value = -1;
+ hid_t c_type_id;
+ H5T_order_t c_order;
+ c_type_id = *type_id;
+ c_order = H5Tget_order(c_type_id);
+ if (c_order < 0)
+ return ret_value;
+ *order = (int_f)c_order;
+ ret_value = 0;
+ /*
+ if ( c_order == H5T_ORDER_LE) *order = H5T_ORDER_LE_F;
+ if ( c_order == H5T_ORDER_BE) *order = H5T_ORDER_BE_F;
+ if ( c_order == H5T_ORDER_VAX) *order = H5T_ORDER_VAX_F;
+ */
+ return ret_value;
+}
/****if* H5Tf/h5tset_order_c
* NAME
@@ -345,26 +349,27 @@ h5tget_order_c ( hid_t_f *type_id , int_f *order)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tset_order_c ( hid_t_f *type_id , int_f *order)
+h5tset_order_c(hid_t_f *type_id, int_f *order)
/******/
{
- int ret_value = 0;
- hid_t c_type_id;
- H5T_order_t c_order;
- herr_t status;
- c_order = (H5T_order_t)*order;
-/*
- if ( *order == H5T_ORDER_LE_F) c_order = H5T_ORDER_LE;
- if ( *order == H5T_ORDER_BE_F) c_order = H5T_ORDER_BE;
- if ( *order == H5T_ORDER_VAX_F) c_order = H5T_ORDER_VAX;
-*/
- c_type_id = *type_id;
- status = H5Tset_order(c_type_id, c_order);
- if ( status < 0 ) ret_value = -1;
- return ret_value;
+ int ret_value = 0;
+ hid_t c_type_id;
+ H5T_order_t c_order;
+ herr_t status;
+ c_order = (H5T_order_t)*order;
+ /*
+ if ( *order == H5T_ORDER_LE_F) c_order = H5T_ORDER_LE;
+ if ( *order == H5T_ORDER_BE_F) c_order = H5T_ORDER_BE;
+ if ( *order == H5T_ORDER_VAX_F) c_order = H5T_ORDER_VAX;
+ */
+ c_type_id = *type_id;
+ status = H5Tset_order(c_type_id, c_order);
+ if (status < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Tf/h5tget_size_c
@@ -384,22 +389,23 @@ h5tset_order_c ( hid_t_f *type_id , int_f *order)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_size_c ( hid_t_f *type_id , size_t_f *size)
+h5tget_size_c(hid_t_f *type_id, size_t_f *size)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- size_t c_size;
-
- c_type_id = *type_id;
- c_size = H5Tget_size(c_type_id);
- if ( c_size == 0 ) return ret_value;
- *size = (size_t_f)c_size ;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ size_t c_size;
+
+ c_type_id = *type_id;
+ c_size = H5Tget_size(c_type_id);
+ if (c_size == 0)
+ return ret_value;
+ *size = (size_t_f)c_size;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tset_size_c
@@ -419,23 +425,24 @@ h5tget_size_c ( hid_t_f *type_id , size_t_f *size)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tset_size_c ( hid_t_f *type_id , size_t_f *size)
+h5tset_size_c(hid_t_f *type_id, size_t_f *size)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- size_t c_size;
- herr_t status;
-
- c_size = (size_t)*size;
- c_type_id = *type_id;
- status = H5Tset_size(c_type_id, c_size);
- if ( status < 0 ) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ size_t c_size;
+ herr_t status;
+
+ c_size = (size_t)*size;
+ c_type_id = *type_id;
+ status = H5Tset_size(c_type_id, c_size);
+ if (status < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_precision_c
@@ -455,22 +462,23 @@ h5tset_size_c ( hid_t_f *type_id , size_t_f *size)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_precision_c ( hid_t_f *type_id , size_t_f *precision)
+h5tget_precision_c(hid_t_f *type_id, size_t_f *precision)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- size_t c_precision;
-
- c_type_id = *type_id;
- c_precision = H5Tget_precision(c_type_id);
- if ( c_precision == 0 ) return ret_value;
- *precision = (size_t_f)c_precision ;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ size_t c_precision;
+
+ c_type_id = *type_id;
+ c_precision = H5Tget_precision(c_type_id);
+ if (c_precision == 0)
+ return ret_value;
+ *precision = (size_t_f)c_precision;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tset_precision_c
@@ -489,23 +497,24 @@ h5tget_precision_c ( hid_t_f *type_id , size_t_f *precision)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tset_precision_c ( hid_t_f *type_id , size_t_f *precision)
+h5tset_precision_c(hid_t_f *type_id, size_t_f *precision)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- size_t c_precision;
- herr_t status;
-
- c_type_id = *type_id;
- c_precision = (size_t)*precision;
- status = H5Tset_precision(c_type_id, c_precision);
- if ( status < 0 ) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ size_t c_precision;
+ herr_t status;
+
+ c_type_id = *type_id;
+ c_precision = (size_t)*precision;
+ status = H5Tset_precision(c_type_id, c_precision);
+ if (status < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_offset_c
@@ -526,23 +535,24 @@ h5tset_precision_c ( hid_t_f *type_id , size_t_f *precision)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_offset_c ( hid_t_f *type_id , size_t_f *offset)
+h5tget_offset_c(hid_t_f *type_id, size_t_f *offset)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- int c_offset;
+ int ret_value = -1;
+ hid_t c_type_id;
+ int c_offset;
- c_type_id = *type_id;
- c_offset = H5Tget_offset(c_type_id);
- if ( c_offset < 0 ) return ret_value;
+ c_type_id = *type_id;
+ c_offset = H5Tget_offset(c_type_id);
+ if (c_offset < 0)
+ return ret_value;
- *offset = (size_t_f)c_offset ;
- ret_value = 0;
- return ret_value;
+ *offset = (size_t_f)c_offset;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tset_offset_c
@@ -562,23 +572,24 @@ h5tget_offset_c ( hid_t_f *type_id , size_t_f *offset)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tset_offset_c ( hid_t_f *type_id , size_t_f *offset)
+h5tset_offset_c(hid_t_f *type_id, size_t_f *offset)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- size_t c_offset;
- herr_t status;
-
- c_offset = (size_t)*offset;
- c_type_id = *type_id;
- status = H5Tset_offset(c_type_id, c_offset);
- if ( status < 0 ) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ size_t c_offset;
+ herr_t status;
+
+ c_offset = (size_t)*offset;
+ c_type_id = *type_id;
+ status = H5Tset_offset(c_type_id, c_offset);
+ if (status < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_pad_c
@@ -601,25 +612,26 @@ h5tset_offset_c ( hid_t_f *type_id , size_t_f *offset)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_pad_c ( hid_t_f *type_id , int_f * lsbpad, int_f * msbpad)
+h5tget_pad_c(hid_t_f *type_id, int_f *lsbpad, int_f *msbpad)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- herr_t status;
- H5T_pad_t c_lsb, c_msb;
-
- c_type_id = *type_id;
- status = H5Tget_pad(c_type_id, &c_lsb, &c_msb);
- if ( status < 0 ) return ret_value;
-
- *lsbpad = (int_f) c_lsb;
- *msbpad = (int_f) c_msb;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ herr_t status;
+ H5T_pad_t c_lsb, c_msb;
+
+ c_type_id = *type_id;
+ status = H5Tget_pad(c_type_id, &c_lsb, &c_msb);
+ if (status < 0)
+ return ret_value;
+
+ *lsbpad = (int_f)c_lsb;
+ *msbpad = (int_f)c_msb;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tset_pad_c
@@ -643,24 +655,25 @@ h5tget_pad_c ( hid_t_f *type_id , int_f * lsbpad, int_f * msbpad)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tset_pad_c ( hid_t_f *type_id, int_f * lsbpad, int_f* msbpad )
+h5tset_pad_c(hid_t_f *type_id, int_f *lsbpad, int_f *msbpad)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- herr_t status;
- H5T_pad_t c_lsb, c_msb;
-
- c_type_id = *type_id;
- c_lsb = (H5T_pad_t)*lsbpad;
- c_msb = (H5T_pad_t)*msbpad;
- status = H5Tset_pad(c_type_id, c_lsb, c_msb);
- if ( status < 0 ) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ herr_t status;
+ H5T_pad_t c_lsb, c_msb;
+
+ c_type_id = *type_id;
+ c_lsb = (H5T_pad_t)*lsbpad;
+ c_msb = (H5T_pad_t)*msbpad;
+ status = H5Tset_pad(c_type_id, c_lsb, c_msb);
+ if (status < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_sign_c
@@ -680,22 +693,23 @@ h5tset_pad_c ( hid_t_f *type_id, int_f * lsbpad, int_f* msbpad )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_sign_c ( hid_t_f *type_id , int_f *sign)
+h5tget_sign_c(hid_t_f *type_id, int_f *sign)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- H5T_sign_t c_sign;
-
- c_type_id = *type_id;
- c_sign = H5Tget_sign(c_type_id);
- if ( c_sign == -1 ) return ret_value;
- *sign = (int_f)c_sign ;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ H5T_sign_t c_sign;
+
+ c_type_id = *type_id;
+ c_sign = H5Tget_sign(c_type_id);
+ if (c_sign == -1)
+ return ret_value;
+ *sign = (int_f)c_sign;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tset_sign_c
@@ -714,24 +728,25 @@ h5tget_sign_c ( hid_t_f *type_id , int_f *sign)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tset_sign_c ( hid_t_f *type_id , int_f* sign)
+h5tset_sign_c(hid_t_f *type_id, int_f *sign)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- H5T_sign_t c_sign;
- herr_t status;
-
- c_type_id = *type_id;
- c_sign = (H5T_sign_t)*sign;
- status = H5Tset_sign(c_type_id, c_sign);
- if ( status < 0 ) return ret_value;
-
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ H5T_sign_t c_sign;
+ herr_t status;
+
+ c_type_id = *type_id;
+ c_sign = (H5T_sign_t)*sign;
+ status = H5Tset_sign(c_type_id, c_sign);
+ if (status < 0)
+ return ret_value;
+
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_fields_c
@@ -755,27 +770,29 @@ h5tset_sign_c ( hid_t_f *type_id , int_f* sign)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_fields_c ( hid_t_f *type_id , size_t_f *spos, size_t_f *epos, size_t_f* esize, size_t_f* mpos, size_t_f* msize)
+h5tget_fields_c(hid_t_f *type_id, size_t_f *spos, size_t_f *epos, size_t_f *esize, size_t_f *mpos,
+ size_t_f *msize)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- herr_t status;
- size_t c_spos, c_epos, c_esize, c_mpos, c_msize;
-
- c_type_id = *type_id;
- status = H5Tget_fields(c_type_id, &c_spos, &c_epos, &c_esize, &c_mpos, &c_msize);
- if ( status < 0 ) return ret_value;
- *spos = (size_t_f) c_spos;
- *epos = (size_t_f) c_epos;
- *esize = (size_t_f) c_esize;
- *mpos = (size_t_f) c_mpos;
- *msize = (size_t_f) c_msize;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ herr_t status;
+ size_t c_spos, c_epos, c_esize, c_mpos, c_msize;
+
+ c_type_id = *type_id;
+ status = H5Tget_fields(c_type_id, &c_spos, &c_epos, &c_esize, &c_mpos, &c_msize);
+ if (status < 0)
+ return ret_value;
+ *spos = (size_t_f)c_spos;
+ *epos = (size_t_f)c_epos;
+ *esize = (size_t_f)c_esize;
+ *mpos = (size_t_f)c_mpos;
+ *msize = (size_t_f)c_msize;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tset_fields_c
@@ -798,28 +815,30 @@ h5tget_fields_c ( hid_t_f *type_id , size_t_f *spos, size_t_f *epos, size_t_f* e
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tset_fields_c ( hid_t_f *type_id, size_t_f *spos, size_t_f *epos, size_t_f* esize, size_t_f* mpos, size_t_f* msize)
+h5tset_fields_c(hid_t_f *type_id, size_t_f *spos, size_t_f *epos, size_t_f *esize, size_t_f *mpos,
+ size_t_f *msize)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- herr_t status;
- size_t c_spos, c_epos, c_esize, c_mpos, c_msize;
-
- c_spos = (size_t)*spos;
- c_epos = (size_t)*epos;
- c_esize = (size_t)*esize;
- c_mpos = (size_t)*mpos;
- c_msize = (size_t)*msize;
- c_type_id = *type_id;
- status = H5Tset_fields(c_type_id, c_spos, c_epos, c_esize, c_mpos, c_msize);
- if ( status < 0 ) return ret_value;
-
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ herr_t status;
+ size_t c_spos, c_epos, c_esize, c_mpos, c_msize;
+
+ c_spos = (size_t)*spos;
+ c_epos = (size_t)*epos;
+ c_esize = (size_t)*esize;
+ c_mpos = (size_t)*mpos;
+ c_msize = (size_t)*msize;
+ c_type_id = *type_id;
+ status = H5Tset_fields(c_type_id, c_spos, c_epos, c_esize, c_mpos, c_msize);
+ if (status < 0)
+ return ret_value;
+
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_ebias_c
@@ -840,23 +859,24 @@ h5tset_fields_c ( hid_t_f *type_id, size_t_f *spos, size_t_f *epos, size_t_f* es
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_ebias_c ( hid_t_f *type_id , size_t_f *ebias)
+h5tget_ebias_c(hid_t_f *type_id, size_t_f *ebias)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- size_t c_ebias;
+ int ret_value = -1;
+ hid_t c_type_id;
+ size_t c_ebias;
- c_type_id = *type_id;
- c_ebias = H5Tget_ebias(c_type_id);
- if ( c_ebias == 0 ) return ret_value;
+ c_type_id = *type_id;
+ c_ebias = H5Tget_ebias(c_type_id);
+ if (c_ebias == 0)
+ return ret_value;
- *ebias = (size_t_f)c_ebias;
- ret_value = 0;
- return ret_value;
+ *ebias = (size_t_f)c_ebias;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tset_ebias_c
@@ -876,24 +896,25 @@ h5tget_ebias_c ( hid_t_f *type_id , size_t_f *ebias)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tset_ebias_c ( hid_t_f *type_id , size_t_f *ebias)
+h5tset_ebias_c(hid_t_f *type_id, size_t_f *ebias)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- size_t c_ebias;
- herr_t status;
-
- c_type_id = *type_id;
- c_ebias = (size_t)*ebias;
- status = H5Tset_ebias(c_type_id, c_ebias);
- if ( status < 0 ) return ret_value;
-
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ size_t c_ebias;
+ herr_t status;
+
+ c_type_id = *type_id;
+ c_ebias = (size_t)*ebias;
+ status = H5Tset_ebias(c_type_id, c_ebias);
+ if (status < 0)
+ return ret_value;
+
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_norm_c
@@ -914,23 +935,24 @@ h5tset_ebias_c ( hid_t_f *type_id , size_t_f *ebias)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_norm_c ( hid_t_f *type_id , int_f *norm)
+h5tget_norm_c(hid_t_f *type_id, int_f *norm)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- H5T_norm_t c_norm;
+ int ret_value = -1;
+ hid_t c_type_id;
+ H5T_norm_t c_norm;
- c_type_id = *type_id;
- c_norm = H5Tget_norm(c_type_id);
- if ( c_norm == H5T_NORM_ERROR ) return ret_value;
+ c_type_id = *type_id;
+ c_norm = H5Tget_norm(c_type_id);
+ if (c_norm == H5T_NORM_ERROR)
+ return ret_value;
- *norm = (int_f)c_norm;
- ret_value = 0;
- return ret_value;
+ *norm = (int_f)c_norm;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tset_norm_c
@@ -950,24 +972,25 @@ h5tget_norm_c ( hid_t_f *type_id , int_f *norm)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tset_norm_c ( hid_t_f *type_id , int_f *norm)
+h5tset_norm_c(hid_t_f *type_id, int_f *norm)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- H5T_norm_t c_norm;
- herr_t status;
-
- c_type_id = *type_id;
- c_norm = (H5T_norm_t)*norm;
- status = H5Tset_norm(c_type_id, c_norm);
- if ( status < 0 ) return ret_value;
-
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ H5T_norm_t c_norm;
+ herr_t status;
+
+ c_type_id = *type_id;
+ c_norm = (H5T_norm_t)*norm;
+ status = H5Tset_norm(c_type_id, c_norm);
+ if (status < 0)
+ return ret_value;
+
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_inpad_c
@@ -990,23 +1013,24 @@ h5tset_norm_c ( hid_t_f *type_id , int_f *norm)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_inpad_c ( hid_t_f *type_id , int_f * padtype)
+h5tget_inpad_c(hid_t_f *type_id, int_f *padtype)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- H5T_pad_t c_padtype;
+ int ret_value = -1;
+ hid_t c_type_id;
+ H5T_pad_t c_padtype;
- c_type_id = *type_id;
- c_padtype = H5Tget_inpad(c_type_id);
- if ( c_padtype == H5T_PAD_ERROR ) return ret_value;
+ c_type_id = *type_id;
+ c_padtype = H5Tget_inpad(c_type_id);
+ if (c_padtype == H5T_PAD_ERROR)
+ return ret_value;
- *padtype = (int_f) c_padtype;
- ret_value = 0;
- return ret_value;
+ *padtype = (int_f)c_padtype;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tset_inpad_c
@@ -1030,24 +1054,25 @@ h5tget_inpad_c ( hid_t_f *type_id , int_f * padtype)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tset_inpad_c ( hid_t_f *type_id, int_f * padtype)
+h5tset_inpad_c(hid_t_f *type_id, int_f *padtype)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- herr_t status;
- H5T_pad_t c_padtype;
-
- c_type_id = *type_id;
- c_padtype = (H5T_pad_t)*padtype;
- status = H5Tset_inpad(c_type_id, c_padtype);
- if ( status < 0 ) return ret_value;
-
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ herr_t status;
+ H5T_pad_t c_padtype;
+
+ c_type_id = *type_id;
+ c_padtype = (H5T_pad_t)*padtype;
+ status = H5Tset_inpad(c_type_id, c_padtype);
+ if (status < 0)
+ return ret_value;
+
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_cset_c
@@ -1069,23 +1094,24 @@ h5tset_inpad_c ( hid_t_f *type_id, int_f * padtype)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_cset_c ( hid_t_f *type_id , int_f * cset)
+h5tget_cset_c(hid_t_f *type_id, int_f *cset)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- H5T_cset_t c_cset;
+ int ret_value = -1;
+ hid_t c_type_id;
+ H5T_cset_t c_cset;
- c_type_id = *type_id;
- c_cset = H5Tget_cset(c_type_id);
- if ( c_cset == H5T_CSET_ERROR ) return ret_value;
+ c_type_id = *type_id;
+ c_cset = H5Tget_cset(c_type_id);
+ if (c_cset == H5T_CSET_ERROR)
+ return ret_value;
- *cset = (int_f) c_cset;
- ret_value = 0;
- return ret_value;
+ *cset = (int_f)c_cset;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tset_cset_c
@@ -1108,24 +1134,25 @@ h5tget_cset_c ( hid_t_f *type_id , int_f * cset)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tset_cset_c ( hid_t_f *type_id, int_f * cset)
+h5tset_cset_c(hid_t_f *type_id, int_f *cset)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- herr_t status;
- H5T_cset_t c_cset;
-
- c_type_id = *type_id;
- c_cset = (H5T_cset_t)*cset;
- status = H5Tset_cset(c_type_id, c_cset);
-
- if ( status < 0 ) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ herr_t status;
+ H5T_cset_t c_cset;
+
+ c_type_id = *type_id;
+ c_cset = (H5T_cset_t)*cset;
+ status = H5Tset_cset(c_type_id, c_cset);
+
+ if (status < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_strpad_c
@@ -1146,22 +1173,23 @@ h5tset_cset_c ( hid_t_f *type_id, int_f * cset)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_strpad_c ( hid_t_f *type_id , int_f * strpad)
+h5tget_strpad_c(hid_t_f *type_id, int_f *strpad)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- H5T_str_t c_strpad;
+ int ret_value = -1;
+ hid_t c_type_id;
+ H5T_str_t c_strpad;
- c_type_id = *type_id;
- c_strpad = H5Tget_strpad(c_type_id);
- if ( c_strpad == H5T_STR_ERROR ) return ret_value;
+ c_type_id = *type_id;
+ c_strpad = H5Tget_strpad(c_type_id);
+ if (c_strpad == H5T_STR_ERROR)
+ return ret_value;
- *strpad = (int_f) c_strpad;
- ret_value = 0;
- return ret_value;
+ *strpad = (int_f)c_strpad;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tset_strpad_c
@@ -1184,24 +1212,25 @@ h5tget_strpad_c ( hid_t_f *type_id , int_f * strpad)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tset_strpad_c ( hid_t_f *type_id, int_f * strpad)
+h5tset_strpad_c(hid_t_f *type_id, int_f *strpad)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- herr_t status;
- H5T_str_t c_strpad;
-
- c_type_id = *type_id;
- c_strpad = (H5T_str_t)*strpad;
- status = H5Tset_strpad(c_type_id, c_strpad);
- if ( status < 0 ) return ret_value;
-
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ herr_t status;
+ H5T_str_t c_strpad;
+
+ c_type_id = *type_id;
+ c_strpad = (H5T_str_t)*strpad;
+ status = H5Tset_strpad(c_type_id, c_strpad);
+ if (status < 0)
+ return ret_value;
+
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_nmembers_c
@@ -1222,21 +1251,22 @@ h5tset_strpad_c ( hid_t_f *type_id, int_f * strpad)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_nmembers_c ( hid_t_f *type_id , int_f * num_members)
+h5tget_nmembers_c(hid_t_f *type_id, int_f *num_members)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
+ int ret_value = -1;
+ hid_t c_type_id;
- c_type_id = *type_id;
- *num_members = (int_f)H5Tget_nmembers(c_type_id);
- if (*num_members < 0 ) return ret_value;
+ c_type_id = *type_id;
+ *num_members = (int_f)H5Tget_nmembers(c_type_id);
+ if (*num_members < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_member_name_c
@@ -1258,27 +1288,28 @@ h5tget_nmembers_c ( hid_t_f *type_id , int_f * num_members)
* Elena Pourmal
* Added namelen parameter to return length of the name to Fortran user
* SOURCE
-*/
+ */
int_f
-h5tget_member_name_c ( hid_t_f *type_id ,int_f* idx, _fcd member_name, int_f *namelen)
+h5tget_member_name_c(hid_t_f *type_id, int_f *idx, _fcd member_name, int_f *namelen)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- unsigned c_index;
- char *c_name;
-
- c_type_id = *type_id;
- c_index = (unsigned)*idx;
- c_name = H5Tget_member_name(c_type_id, c_index);
- if (c_name == NULL ) return ret_value;
-
- HD5packFstring(c_name, _fcdtocp(member_name), strlen(c_name));
- *namelen = (int_f)strlen(c_name);
- H5free_memory(c_name);
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ unsigned c_index;
+ char * c_name;
+
+ c_type_id = *type_id;
+ c_index = (unsigned)*idx;
+ c_name = H5Tget_member_name(c_type_id, c_index);
+ if (c_name == NULL)
+ return ret_value;
+
+ HD5packFstring(c_name, _fcdtocp(member_name), strlen(c_name));
+ *namelen = (int_f)strlen(c_name);
+ H5free_memory(c_name);
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_member_index_c
* NAME
@@ -1300,37 +1331,38 @@ h5tget_member_name_c ( hid_t_f *type_id ,int_f* idx, _fcd member_name, int_f *na
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_member_index_c (hid_t_f *type_id, _fcd name, int_f *namelen, int_f *idx)
+h5tget_member_index_c(hid_t_f *type_id, _fcd name, int_f *namelen, int_f *idx)
/******/
{
- int ret_value = -1;
- char *c_name;
- hid_t c_type_id;
- int c_index;
-
- /*
- * Convert FORTRAN name to C name
- */
- c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
- if (c_name == NULL) return ret_value;
-
- /*
- * Call H5Tget_member_index function.
- */
- c_type_id = (hid_t)*type_id;
- c_index = H5Tget_member_index(c_type_id, c_name);
-
- if (c_index < 0) goto DONE;
- *idx = (int_f)c_index;
+ int ret_value = -1;
+ char *c_name;
+ hid_t c_type_id;
+ int c_index;
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
+ if (c_name == NULL)
+ return ret_value;
+
+ /*
+ * Call H5Tget_member_index function.
+ */
+ c_type_id = (hid_t)*type_id;
+ c_index = H5Tget_member_index(c_type_id, c_name);
+
+ if (c_index < 0)
+ goto DONE;
+ *idx = (int_f)c_index;
DONE:
- HDfree(c_name);
- ret_value = 0;
- return ret_value;
+ HDfree(c_name);
+ ret_value = 0;
+ return ret_value;
}
-
/****if* H5Tf/h5tget_member_offset_c
* NAME
* h5tget_member_offset_c
@@ -1352,19 +1384,19 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_member_offset_c ( hid_t_f *type_id ,int_f* member_no, size_t_f * offset)
+h5tget_member_offset_c(hid_t_f *type_id, int_f *member_no, size_t_f *offset)
/******/
{
- int ret_value = -1;
- size_t c_offset;
+ int ret_value = -1;
+ size_t c_offset;
- c_offset = H5Tget_member_offset((hid_t)*type_id, (unsigned)*member_no);
- *offset = (size_t_f)c_offset;
- ret_value = 0;
- return ret_value;
+ c_offset = H5Tget_member_offset((hid_t)*type_id, (unsigned)*member_no);
+ *offset = (size_t_f)c_offset;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_array_dims_c
@@ -1385,23 +1417,23 @@ h5tget_member_offset_c ( hid_t_f *type_id ,int_f* member_no, size_t_f * offset)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_array_dims_c ( hid_t_f *type_id , hsize_t_f * dims)
+h5tget_array_dims_c(hid_t_f *type_id, hsize_t_f *dims)
/******/
{
hsize_t c_dims[H5S_MAX_RANK];
- int rank, i;
- int ret_value = -1;
+ int rank, i;
+ int ret_value = -1;
- if((rank = H5Tget_array_ndims((hid_t)*type_id)) < 0)
+ if ((rank = H5Tget_array_ndims((hid_t)*type_id)) < 0)
goto DONE;
- if(H5Tget_array_dims2((hid_t)*type_id, c_dims) < 0)
+ if (H5Tget_array_dims2((hid_t)*type_id, c_dims) < 0)
goto DONE;
- for(i = 0; i < rank; i++)
+ for (i = 0; i < rank; i++)
dims[(rank - i) - 1] = (hsize_t_f)c_dims[i];
ret_value = 0;
@@ -1428,23 +1460,24 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_array_ndims_c ( hid_t_f *type_id , int_f * ndims)
+h5tget_array_ndims_c(hid_t_f *type_id, int_f *ndims)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- int c_ndims;
+ int ret_value = -1;
+ hid_t c_type_id;
+ int c_ndims;
- c_type_id = (hid_t)*type_id;
- c_ndims = H5Tget_array_ndims(c_type_id);
- if (c_ndims < 0) return ret_value;
+ c_type_id = (hid_t)*type_id;
+ c_ndims = H5Tget_array_ndims(c_type_id);
+ if (c_ndims < 0)
+ return ret_value;
- *ndims = (int_f)c_ndims;
- ret_value = 0;
- return ret_value;
+ *ndims = (int_f)c_ndims;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_super_c
@@ -1465,26 +1498,26 @@ h5tget_array_ndims_c ( hid_t_f *type_id , int_f * ndims)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_super_c ( hid_t_f *type_id , hid_t_f *base_type_id)
+h5tget_super_c(hid_t_f *type_id, hid_t_f *base_type_id)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- hid_t c_base_type_id;
+ int ret_value = -1;
+ hid_t c_type_id;
+ hid_t c_base_type_id;
- c_type_id = (hid_t)*type_id;
- c_base_type_id = H5Tget_super(c_type_id);
- if (c_base_type_id < 0) return ret_value;
+ c_type_id = (hid_t)*type_id;
+ c_base_type_id = H5Tget_super(c_type_id);
+ if (c_base_type_id < 0)
+ return ret_value;
- *base_type_id = (hid_t_f)c_base_type_id;
- ret_value = 0;
- return ret_value;
+ *base_type_id = (hid_t_f)c_base_type_id;
+ ret_value = 0;
+ return ret_value;
}
-
/****if* H5Tf/h5tget_member_type_c
* NAME
* h5tget_member_type_c
@@ -1504,22 +1537,22 @@ h5tget_super_c ( hid_t_f *type_id , hid_t_f *base_type_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_member_type_c ( hid_t_f *type_id ,int_f* field_idx, hid_t_f * datatype)
+h5tget_member_type_c(hid_t_f *type_id, int_f *field_idx, hid_t_f *datatype)
/******/
{
- int ret_value = -1;
+ int ret_value = -1;
- *datatype = (hid_t_f)H5Tget_member_type((hid_t)*type_id, (unsigned)*field_idx);
- if(*datatype < 0) return ret_value;
+ *datatype = (hid_t_f)H5Tget_member_type((hid_t)*type_id, (unsigned)*field_idx);
+ if (*datatype < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
-
/****if* H5Tf/h5tcreate_c
* NAME
* h5tcreate_c
@@ -1536,24 +1569,25 @@ h5tget_member_type_c ( hid_t_f *type_id ,int_f* field_idx, hid_t_f * datatype)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5tcreate_c(int_f *cls, size_t_f *size, hid_t_f *type_id)
/******/
{
- int ret_value = -1;
- H5T_class_t c_class;
- size_t c_size;
+ int ret_value = -1;
+ H5T_class_t c_class;
+ size_t c_size;
- c_size =(size_t) *size;
- c_class = (H5T_class_t) *cls;
+ c_size = (size_t)*size;
+ c_class = (H5T_class_t)*cls;
- *type_id = (hid_t_f)H5Tcreate(c_class, c_size);
- if(*type_id < 0) return ret_value;
+ *type_id = (hid_t_f)H5Tcreate(c_class, c_size);
+ if (*type_id < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tinsert_c
@@ -1575,28 +1609,29 @@ h5tcreate_c(int_f *cls, size_t_f *size, hid_t_f *type_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tinsert_c(hid_t_f *type_id, _fcd name, int_f* namelen, size_t_f *offset, hid_t_f * field_id)
+h5tinsert_c(hid_t_f *type_id, _fcd name, int_f *namelen, size_t_f *offset, hid_t_f *field_id)
/******/
{
- int ret_value = -1;
- char* c_name;
- herr_t error;
+ int ret_value = -1;
+ char * c_name;
+ herr_t error;
- c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
- if (c_name == NULL) return ret_value;
+ c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
+ if (c_name == NULL)
+ return ret_value;
- error = H5Tinsert((hid_t)*type_id, c_name, (size_t)*offset, (hid_t)*field_id);
+ error = H5Tinsert((hid_t)*type_id, c_name, (size_t)*offset, (hid_t)*field_id);
- HDfree(c_name);
- if(error < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ HDfree(c_name);
+ if (error < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
-
/****if* H5Tf/h5tpack_c
* NAME
* h5tpack_c
@@ -1614,22 +1649,23 @@ h5tinsert_c(hid_t_f *type_id, _fcd name, int_f* namelen, size_t_f *offset, hid_t
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tpack_c(hid_t_f * type_id)
+h5tpack_c(hid_t_f *type_id)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- herr_t status;
+ int ret_value = -1;
+ hid_t c_type_id;
+ herr_t status;
- c_type_id = *type_id;
- status = H5Tpack(c_type_id);
- if (status < 0) return ret_value;
+ c_type_id = *type_id;
+ status = H5Tpack(c_type_id);
+ if (status < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tarray_create_c
@@ -1650,34 +1686,32 @@ h5tpack_c(hid_t_f * type_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tarray_create_c(hid_t_f * base_id, int_f *rank, hsize_t_f* dims, hid_t_f* type_id)
+h5tarray_create_c(hid_t_f *base_id, int_f *rank, hsize_t_f *dims, hid_t_f *type_id)
/******/
{
- hsize_t c_dims[H5S_MAX_RANK];
- hid_t c_type_id;
- unsigned u; /* Local index variable */
- int ret_value = -1;
-
+ hsize_t c_dims[H5S_MAX_RANK];
+ hid_t c_type_id;
+ unsigned u; /* Local index variable */
+ int ret_value = -1;
/*
* Transpose dimension arrays because of C-FORTRAN storage order
*/
- for(u = 0; u < (unsigned)*rank ; u++)
- c_dims[u] = (hsize_t)dims[((unsigned)*rank - u) - 1];
+ for (u = 0; u < (unsigned)*rank; u++)
+ c_dims[u] = (hsize_t)dims[((unsigned)*rank - u) - 1];
- if((c_type_id = H5Tarray_create2((hid_t)*base_id, (unsigned)*rank, c_dims)) < 0)
+ if ((c_type_id = H5Tarray_create2((hid_t)*base_id, (unsigned)*rank, c_dims)) < 0)
goto DONE;
- *type_id = (hid_t_f)c_type_id;
+ *type_id = (hid_t_f)c_type_id;
ret_value = 0;
DONE:
return ret_value;
}
-
/****if* H5Tf/h5tenum_create_c
* NAME
* h5tenum_create_c
@@ -1696,20 +1730,21 @@ DONE:
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tenum_create_c ( hid_t_f *parent_id , hid_t_f *new_type_id)
+h5tenum_create_c(hid_t_f *parent_id, hid_t_f *new_type_id)
/******/
{
- int ret_value = 0;
- hid_t c_new_type_id;
+ int ret_value = 0;
+ hid_t c_new_type_id;
- c_new_type_id = H5Tenum_create((hid_t)*parent_id);
- if ( c_new_type_id < 0 ) ret_value = -1;
+ c_new_type_id = H5Tenum_create((hid_t)*parent_id);
+ if (c_new_type_id < 0)
+ ret_value = -1;
- *new_type_id = (hid_t_f)c_new_type_id;
- return ret_value;
+ *new_type_id = (hid_t_f)c_new_type_id;
+ return ret_value;
}
/****if* H5Tf/h5tenum_insert_c
@@ -1732,31 +1767,32 @@ h5tenum_create_c ( hid_t_f *parent_id , hid_t_f *new_type_id)
* it should not be cast to an int (which might be 4 bytes). Instead the value
* is written as the size of an int_f.
* SOURCE
-*/
+ */
int_f
-h5tenum_insert_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value)
+h5tenum_insert_c(hid_t_f *type_id, _fcd name, int_f *namelen, int_f *value)
/******/
{
- int ret_value = -1;
- char* c_name;
- herr_t error;
- int_f c_value;
+ int ret_value = -1;
+ char * c_name;
+ herr_t error;
+ int_f c_value;
- c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
- if (c_name == NULL) return ret_value;
+ c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
+ if (c_name == NULL)
+ return ret_value;
- c_value = *value;
- error = H5Tenum_insert((hid_t)*type_id, c_name, &c_value);
+ c_value = *value;
+ error = H5Tenum_insert((hid_t)*type_id, c_name, &c_value);
- HDfree(c_name);
- if(error < 0) return ret_value;
+ HDfree(c_name);
+ if (error < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
-
/****if* H5Tf/h5tenum_nameof_c
* NAME
* h5tenum_nameof_c
@@ -1776,29 +1812,30 @@ h5tenum_insert_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tenum_nameof_c(hid_t_f *type_id, int_f* value, _fcd name, size_t_f* namelen)
+h5tenum_nameof_c(hid_t_f *type_id, int_f *value, _fcd name, size_t_f *namelen)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- char* c_name;
- size_t c_namelen;
- herr_t error;
- int_f c_value;
- c_value = *value;
- c_namelen = ((size_t)*namelen) +1;
- c_name = (char *)HDmalloc(sizeof(char)*c_namelen);
- c_type_id = (hid_t)*type_id;
- error = H5Tenum_nameof(c_type_id, &c_value, c_name, c_namelen);
- HD5packFstring(c_name, _fcdtocp(name), strlen(c_name));
- HDfree(c_name);
-
- if(error < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ char * c_name;
+ size_t c_namelen;
+ herr_t error;
+ int_f c_value;
+ c_value = *value;
+ c_namelen = ((size_t)*namelen) + 1;
+ c_name = (char *)HDmalloc(sizeof(char) * c_namelen);
+ c_type_id = (hid_t)*type_id;
+ error = H5Tenum_nameof(c_type_id, &c_value, c_name, c_namelen);
+ HD5packFstring(c_name, _fcdtocp(name), strlen(c_name));
+ HDfree(c_name);
+
+ if (error < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tenum_valueof_c
@@ -1820,26 +1857,27 @@ h5tenum_nameof_c(hid_t_f *type_id, int_f* value, _fcd name, size_t_f* namelen)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tenum_valueof_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value)
+h5tenum_valueof_c(hid_t_f *type_id, _fcd name, int_f *namelen, int_f *value)
/******/
{
- int ret_value = -1;
- char* c_name;
- herr_t error;
- c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
- if (c_name == NULL) return ret_value;
-
- error = H5Tenum_valueof((hid_t)*type_id, c_name, value);
- HDfree(c_name);
-
- if(error < 0) return ret_value;
- ret_value = 0;
- return ret_value;
-}
+ int ret_value = -1;
+ char * c_name;
+ herr_t error;
+ c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
+ if (c_name == NULL)
+ return ret_value;
+
+ error = H5Tenum_valueof((hid_t)*type_id, c_name, value);
+ HDfree(c_name);
+ if (error < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
+}
/****if* H5Tf/h5tget_member_value_c
* NAME
@@ -1859,22 +1897,23 @@ h5tenum_valueof_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_member_value_c(hid_t_f *type_id, int_f* member_no, int_f* value)
+h5tget_member_value_c(hid_t_f *type_id, int_f *member_no, int_f *value)
/******/
{
- int ret_value = -1;
- int c_value;
- herr_t error;
+ int ret_value = -1;
+ int c_value;
+ herr_t error;
- error = H5Tget_member_value((hid_t)*type_id, (unsigned)*member_no, &c_value);
- if(error < 0) return ret_value;
+ error = H5Tget_member_value((hid_t)*type_id, (unsigned)*member_no, &c_value);
+ if (error < 0)
+ return ret_value;
- *value = (int_f)c_value;
- ret_value = 0;
- return ret_value;
+ *value = (int_f)c_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tset_tag_c
@@ -1897,23 +1936,24 @@ h5tget_member_value_c(hid_t_f *type_id, int_f* member_no, int_f* value)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tset_tag_c(hid_t_f* type_id, _fcd tag, int_f* namelen)
+h5tset_tag_c(hid_t_f *type_id, _fcd tag, int_f *namelen)
/******/
{
- int ret_value = -1;
- herr_t status;
- char* c_tag;
+ int ret_value = -1;
+ herr_t status;
+ char * c_tag;
- c_tag = (char *)HD5f2cstring(tag, (size_t)*namelen);
+ c_tag = (char *)HD5f2cstring(tag, (size_t)*namelen);
- status = H5Tset_tag((hid_t)*type_id, c_tag);
- HDfree(c_tag);
- if ( status < 0 ) return ret_value;
+ status = H5Tset_tag((hid_t)*type_id, c_tag);
+ HDfree(c_tag);
+ if (status < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_tag_c
@@ -1935,24 +1975,25 @@ h5tset_tag_c(hid_t_f* type_id, _fcd tag, int_f* namelen)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_tag_c(hid_t_f* type_id, _fcd tag, size_t_f* tag_size, int_f* taglen)
+h5tget_tag_c(hid_t_f *type_id, _fcd tag, size_t_f *tag_size, int_f *taglen)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- char *c_tag;
-
- c_type_id = *type_id;
- c_tag = H5Tget_tag(c_type_id);
- if (c_tag == NULL ) return ret_value;
-
- HD5packFstring(c_tag, _fcdtocp(tag), (size_t)*tag_size);
- *taglen = (int_f)HDstrlen(c_tag);
- H5free_memory(c_tag);
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ char *c_tag;
+
+ c_type_id = *type_id;
+ c_tag = H5Tget_tag(c_type_id);
+ if (c_tag == NULL)
+ return ret_value;
+
+ HD5packFstring(c_tag, _fcdtocp(tag), (size_t)*tag_size);
+ *taglen = (int_f)HDstrlen(c_tag);
+ H5free_memory(c_tag);
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tvlen_create_c
* NAME
@@ -1971,21 +2012,22 @@ h5tget_tag_c(hid_t_f* type_id, _fcd tag, size_t_f* tag_size, int_f* taglen)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tvlen_create_c(hid_t_f* type_id, hid_t_f *vltype_id)
+h5tvlen_create_c(hid_t_f *type_id, hid_t_f *vltype_id)
/******/
{
- int ret_value = -1;
- hid_t c_type_id;
- hid_t c_vltype_id;
-
- c_type_id = (hid_t)*type_id;
- c_vltype_id = H5Tvlen_create(c_type_id);
- if (c_vltype_id < 0 ) return ret_value;
- *vltype_id = (hid_t_f)c_vltype_id;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t c_type_id;
+ hid_t c_vltype_id;
+
+ c_type_id = (hid_t)*type_id;
+ c_vltype_id = H5Tvlen_create(c_type_id);
+ if (c_vltype_id < 0)
+ return ret_value;
+ *vltype_id = (hid_t_f)c_vltype_id;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tis_variable_str_c
* NAME
@@ -2006,21 +2048,22 @@ h5tvlen_create_c(hid_t_f* type_id, hid_t_f *vltype_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tis_variable_str_c ( hid_t_f *type_id , int_f *flag )
+h5tis_variable_str_c(hid_t_f *type_id, int_f *flag)
/******/
{
- int ret_value = 0;
- hid_t c_type_id;
- htri_t status;
-
- c_type_id = (hid_t)*type_id;
- status = H5Tis_variable_str(c_type_id);
- *flag = (int_f)status;
- if ( status < 0 ) ret_value = -1;
- return ret_value;
+ int ret_value = 0;
+ hid_t c_type_id;
+ htri_t status;
+
+ c_type_id = (hid_t)*type_id;
+ status = H5Tis_variable_str(c_type_id);
+ *flag = (int_f)status;
+ if (status < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Tf/h5tget_member_class_c
* NAME
@@ -2042,24 +2085,25 @@ h5tis_variable_str_c ( hid_t_f *type_id , int_f *flag )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tget_member_class_c ( hid_t_f *type_id , int_f *member_no, int_f *cls )
+h5tget_member_class_c(hid_t_f *type_id, int_f *member_no, int_f *cls)
/******/
{
- int ret_value = 0;
- hid_t c_type_id;
- unsigned c_member_no;
- H5T_class_t c_class;
-
- c_type_id = (hid_t)*type_id;
- c_member_no = (unsigned)*member_no;
- c_class = H5Tget_member_class(c_type_id, c_member_no);
-
- if ( c_class == H5T_NO_CLASS ) ret_value = -1;
- *cls = (int_f)c_class;
- return ret_value;
+ int ret_value = 0;
+ hid_t c_type_id;
+ unsigned c_member_no;
+ H5T_class_t c_class;
+
+ c_type_id = (hid_t)*type_id;
+ c_member_no = (unsigned)*member_no;
+ c_class = H5Tget_member_class(c_type_id, c_member_no);
+
+ if (c_class == H5T_NO_CLASS)
+ ret_value = -1;
+ *cls = (int_f)c_class;
+ return ret_value;
}
/****if* H5Tf/h5tcommit_anon_c
@@ -2080,22 +2124,21 @@ h5tget_member_class_c ( hid_t_f *type_id , int_f *member_no, int_f *cls )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tcommit_anon_c(hid_t_f *loc_id, hid_t_f *dtype_id,
- hid_t_f *tcpl_id, hid_t_f *tapl_id)
+h5tcommit_anon_c(hid_t_f *loc_id, hid_t_f *dtype_id, hid_t_f *tcpl_id, hid_t_f *tapl_id)
/******/
{
- int ret_value = -1;
+ int ret_value = -1;
- /* Call H5Tcommit_anon function */
- if(H5Tcommit_anon((hid_t)*loc_id, (hid_t)*dtype_id, (hid_t)*tcpl_id, (hid_t)*tapl_id) < 0)
- goto done;
+ /* Call H5Tcommit_anon function */
+ if (H5Tcommit_anon((hid_t)*loc_id, (hid_t)*dtype_id, (hid_t)*tcpl_id, (hid_t)*tapl_id) < 0)
+ goto done;
- ret_value = 0;
+ ret_value = 0;
- done:
- return ret_value;
+done:
+ return ret_value;
}
/****if* H5Tf/h5tcommitted_c
@@ -2114,19 +2157,18 @@ h5tcommit_anon_c(hid_t_f *loc_id, hid_t_f *dtype_id,
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5tcommitted_c(hid_t_f *dtype_id)
/******/
{
- int_f ret_value;
+ int_f ret_value;
- /* Call H5Tcommitted function */
+ /* Call H5Tcommitted function */
- ret_value=(int_f)H5Tcommitted((hid_t)*dtype_id);
-
- return ret_value;
+ ret_value = (int_f)H5Tcommitted((hid_t)*dtype_id);
+ return ret_value;
}
/****if* H5Tf/h5tdecode_c
@@ -2149,30 +2191,30 @@ h5tcommitted_c(hid_t_f *dtype_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tdecode_c ( _fcd buf, hid_t_f *obj_id )
+h5tdecode_c(_fcd buf, hid_t_f *obj_id)
/******/
{
- int ret_value = -1;
- unsigned char *c_buf = NULL; /* Buffer to hold C string */
- hid_t c_obj_id;
+ int ret_value = -1;
+ unsigned char *c_buf = NULL; /* Buffer to hold C string */
+ hid_t c_obj_id;
- /*
- * Call H5Tdecode function.
- */
+ /*
+ * Call H5Tdecode function.
+ */
- c_buf = (unsigned char*)buf;
+ c_buf = (unsigned char *)buf;
- c_obj_id = H5Tdecode(c_buf);
- if(c_obj_id < 0)
- return ret_value;
+ c_obj_id = H5Tdecode(c_buf);
+ if (c_obj_id < 0)
+ return ret_value;
- *obj_id = (hid_t_f)c_obj_id;
- ret_value = 0;
+ *obj_id = (hid_t_f)c_obj_id;
+ ret_value = 0;
- return ret_value;
+ return ret_value;
}
/****if* H5Tf/h5tencode_c
@@ -2193,56 +2235,56 @@ h5tdecode_c ( _fcd buf, hid_t_f *obj_id )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc )
+h5tencode_c(_fcd buf, hid_t_f *obj_id, size_t_f *nalloc)
/******/
{
- int ret_value = -1;
- unsigned char *c_buf = NULL; /* Buffer to hold C string */
- size_t c_size;
+ int ret_value = -1;
+ unsigned char *c_buf = NULL; /* Buffer to hold C string */
+ size_t c_size;
- /* return just the size of the allocated buffer;
- * equivalent to C routine for which 'name' is set equal to NULL
- */
+ /* return just the size of the allocated buffer;
+ * equivalent to C routine for which 'name' is set equal to NULL
+ */
- if (*nalloc == 0) {
+ if (*nalloc == 0) {
- if(H5Tencode((hid_t)*obj_id, c_buf, &c_size) < 0)
- return ret_value;
+ if (H5Tencode((hid_t)*obj_id, c_buf, &c_size) < 0)
+ return ret_value;
- *nalloc = (size_t_f)c_size;
+ *nalloc = (size_t_f)c_size;
- ret_value = 0;
- return ret_value;
- }
+ ret_value = 0;
+ return ret_value;
+ }
- /*
- * Allocate buffer
- */
- c_size = (size_t)*nalloc;
- if(NULL == (c_buf = (unsigned char *)HDmalloc(c_size)))
- return ret_value;
+ /*
+ * Allocate buffer
+ */
+ c_size = (size_t)*nalloc;
+ if (NULL == (c_buf = (unsigned char *)HDmalloc(c_size)))
+ return ret_value;
- /*
- * Call H5Tencode function.
- */
- if(H5Tencode((hid_t)*obj_id, c_buf, &c_size) < 0)
- return ret_value;
+ /*
+ * Call H5Tencode function.
+ */
+ if (H5Tencode((hid_t)*obj_id, c_buf, &c_size) < 0)
+ return ret_value;
- /* copy the C buffer to the FORTRAN buffer.
- * Can not use HD5packFstring because we don't want to
- * eliminate the NUL terminator or pad remaining space
- * with blanks.
- */
+ /* copy the C buffer to the FORTRAN buffer.
+ * Can not use HD5packFstring because we don't want to
+ * eliminate the NUL terminator or pad remaining space
+ * with blanks.
+ */
- HDmemcpy(_fcdtocp(buf),(char *)c_buf,c_size);
+ HDmemcpy(_fcdtocp(buf), (char *)c_buf, c_size);
- ret_value = 0;
- if(c_buf)
- HDfree(c_buf);
- return ret_value;
+ ret_value = 0;
+ if (c_buf)
+ HDfree(c_buf);
+ return ret_value;
}
/****if* H5Tf/h5tget_create_plist_c
@@ -2262,13 +2304,13 @@ h5tencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc )
* HISTORY
* N/A
* SOURCE
-*/
+ */
int_f
-h5tget_create_plist_c ( hid_t_f *dtype_id, hid_t_f *dtpl_id)
+h5tget_create_plist_c(hid_t_f *dtype_id, hid_t_f *dtpl_id)
/******/
{
- int_f ret_value=-1; /* Return value */
+ int_f ret_value = -1; /* Return value */
if ((*dtpl_id = (hid_t_f)H5Tget_create_plist((hid_t)*dtype_id)) < 0)
return ret_value;
@@ -2296,20 +2338,21 @@ h5tget_create_plist_c ( hid_t_f *dtype_id, hid_t_f *dtpl_id)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5tcompiler_conv_c ( hid_t_f *src_id, hid_t_f *dst_id, int_f *c_flag)
+h5tcompiler_conv_c(hid_t_f *src_id, hid_t_f *dst_id, int_f *c_flag)
/******/
{
- int ret_value = -1;
- htri_t status;
-
- status = H5Tcompiler_conv( (hid_t)*src_id , (hid_t)*dst_id);
- if ( status < 0 ) return ret_value;
- *c_flag = (int_f)status;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ htri_t status;
+
+ status = H5Tcompiler_conv((hid_t)*src_id, (hid_t)*dst_id);
+ if (status < 0)
+ return ret_value;
+ *c_flag = (int_f)status;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tget_native_type_c
* NAME
@@ -2330,20 +2373,21 @@ h5tcompiler_conv_c ( hid_t_f *src_id, hid_t_f *dst_id, int_f *c_flag)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
h5tget_native_type_c(hid_t_f *dtype_id, int_f *direction, hid_t_f *native_dtype_id)
/******/
{
- int ret_value = -1;
- hid_t status;
-
- status = H5Tget_native_type( (hid_t)*dtype_id, (H5T_direction_t)*direction);
- if ( status < 0 ) return ret_value;
- *native_dtype_id = (hid_t_f)status;
- ret_value = 0;
- return ret_value;
+ int ret_value = -1;
+ hid_t status;
+
+ status = H5Tget_native_type((hid_t)*dtype_id, (H5T_direction_t)*direction);
+ if (status < 0)
+ return ret_value;
+ *native_dtype_id = (hid_t_f)status;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tconvert_c
@@ -2370,18 +2414,20 @@ h5tget_native_type_c(hid_t_f *dtype_id, int_f *direction, hid_t_f *native_dtype_
* December 8, 2008
*
* SOURCE
-*/
+ */
int_f
-h5tconvert_c(hid_t_f *src_id, hid_t_f *dst_id, size_t_f *nelmts, void *buf, void *background, hid_t_f *plist_id)
+h5tconvert_c(hid_t_f *src_id, hid_t_f *dst_id, size_t_f *nelmts, void *buf, void *background,
+ hid_t_f *plist_id)
/******/
{
- int ret_value = -1;
- hid_t status;
+ int ret_value = -1;
+ hid_t status;
- status = H5Tconvert( (hid_t)*src_id, (hid_t)*dst_id, (size_t)*nelmts, buf, background, (hid_t)*plist_id );
- if ( status < 0 ) return ret_value;
- ret_value = 0;
- return ret_value;
+ status = H5Tconvert((hid_t)*src_id, (hid_t)*dst_id, (size_t)*nelmts, buf, background, (hid_t)*plist_id);
+ if (status < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Tf/h5tenum_insert_ptr_c
@@ -2403,28 +2449,28 @@ h5tconvert_c(hid_t_f *src_id, hid_t_f *dst_id, size_t_f *nelmts, void *buf, void
* February 6, 2015
*
* SOURCE
-*/
+ */
int_f
-h5tenum_insert_ptr_c(hid_t_f *type_id, _fcd name, int_f* namelen, void *value)
+h5tenum_insert_ptr_c(hid_t_f *type_id, _fcd name, int_f *namelen, void *value)
/******/
{
- int ret_value = -1;
- hid_t status;
- char *c_name;
+ int ret_value = -1;
+ hid_t status;
+ char *c_name;
- /*
- * Convert FORTRAN name to C name
- */
- c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
- if (c_name == NULL) return ret_value;
+ /*
+ * Convert FORTRAN name to C name
+ */
+ c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
+ if (c_name == NULL)
+ return ret_value;
- status = H5Tenum_insert( (hid_t)*type_id, c_name, value);
+ status = H5Tenum_insert((hid_t)*type_id, c_name, value);
- HDfree(c_name);
- if ( status < 0 ) return ret_value;
+ HDfree(c_name);
+ if (status < 0)
+ return ret_value;
- ret_value = 0;
- return ret_value;
+ ret_value = 0;
+ return ret_value;
}
-
-
diff --git a/fortran/src/H5Zf.c b/fortran/src/H5Zf.c
index 7afafd5..ca9e7eb 100644
--- a/fortran/src/H5Zf.c
+++ b/fortran/src/H5Zf.c
@@ -17,7 +17,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include "H5f90.h"
@@ -36,23 +36,24 @@
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5zunregister_c (int_f *filter)
+h5zunregister_c(int_f *filter)
/******/
{
- int ret_value = -1;
- herr_t status;
- H5Z_filter_t c_filter;
+ int ret_value = -1;
+ herr_t status;
+ H5Z_filter_t c_filter;
- /*
- * Call H5Zunregister function.
- */
- c_filter = (H5Z_filter_t)*filter;
- status = H5Zunregister(c_filter);
- if (status < 0) return ret_value;
- ret_value = 0;
- return ret_value;
+ /*
+ * Call H5Zunregister function.
+ */
+ c_filter = (H5Z_filter_t)*filter;
+ status = H5Zunregister(c_filter);
+ if (status < 0)
+ return ret_value;
+ ret_value = 0;
+ return ret_value;
}
/****if* H5Zf/h5zfiletr_avail_c
* NAME
@@ -71,21 +72,22 @@ h5zunregister_c (int_f *filter)
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5zfilter_avail_c ( int_f *filter , int_f *flag )
+h5zfilter_avail_c(int_f *filter, int_f *flag)
/******/
{
- int ret_value = 0;
- H5Z_filter_t c_filter;
- htri_t status;
+ int ret_value = 0;
+ H5Z_filter_t c_filter;
+ htri_t status;
- c_filter = (H5Z_filter_t)*filter;
- status = H5Zfilter_avail(c_filter);
- *flag = (int_f)status;
- if ( status < 0 ) ret_value = -1;
- return ret_value;
+ c_filter = (H5Z_filter_t)*filter;
+ status = H5Zfilter_avail(c_filter);
+ *flag = (int_f)status;
+ if (status < 0)
+ ret_value = -1;
+ return ret_value;
}
/****if* H5Zf/h5zget_filter_info_c
@@ -106,19 +108,19 @@ h5zfilter_avail_c ( int_f *filter , int_f *flag )
* HISTORY
*
* SOURCE
-*/
+ */
int_f
-h5zget_filter_info_c ( int_f *filter , int_f *flag )
+h5zget_filter_info_c(int_f *filter, int_f *flag)
/******/
{
- int ret_value = 0;
- H5Z_filter_t c_filter;
- unsigned int c_flag;
+ int ret_value = 0;
+ H5Z_filter_t c_filter;
+ unsigned int c_flag;
- c_filter = (H5Z_filter_t)*filter;
- ret_value = H5Zget_filter_info(c_filter, &c_flag);
- *flag = (int_f)c_flag;
+ c_filter = (H5Z_filter_t)*filter;
+ ret_value = H5Zget_filter_info(c_filter, &c_flag);
+ *flag = (int_f)c_flag;
- return ret_value;
+ return ret_value;
}
diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c
index 8044b78..9c71c57 100644
--- a/fortran/src/H5_f.c
+++ b/fortran/src/H5_f.c
@@ -17,14 +17,13 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include "H5f90.h"
#include "H5fort_type_defines.h"
int IntKinds_SizeOf[] = H5_FORTRAN_INTEGER_KINDS_SIZEOF;
-
/****if* H5_f/h5init_types_c
* NAME
* h5init_types_c
@@ -49,14 +48,14 @@ int IntKinds_SizeOf[] = H5_FORTRAN_INTEGER_KINDS_SIZEOF;
* Elena Pourmal
* Tuesday, August 3, 1999
* SOURCE
-*/
+ */
int_f
-h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes )
+h5init_types_c(hid_t_f *types, hid_t_f *floatingtypes, hid_t_f *integertypes)
/******/
{
- int ret_value = -1;
+ int ret_value = -1;
hid_t c_type_id;
- int i;
+ int i;
/* Fortran INTEGER may not be the same as C; do all checking to find
an appropriate size
@@ -67,186 +66,258 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes
*/
/* Initialized INTEGER KIND types to default to native integer */
- for(i=0;i<5;i++) {
- if ((types[i] = (hid_t_f)H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value;
+ for (i = 0; i < 5; i++) {
+ if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0)
+ return ret_value;
}
- for(i=0;i<H5_FORTRAN_NUM_INTEGER_KINDS;i++) {
- if ( IntKinds_SizeOf[i] == sizeof(char)) {
- if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_CHAR)) < 0) return ret_value;
- } /*end if */
- else if ( IntKinds_SizeOf[i] == sizeof(short)) {
- if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_SHORT)) < 0) return ret_value;
- } /*end if */
- else if ( IntKinds_SizeOf[i] == sizeof(int)) {
- if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value;
- } /*end if */
- else if ( IntKinds_SizeOf[i] == sizeof(long long)) {
- if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value;
- } /*end if */
- else {
- if ((types[i] = (hid_t_f)H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value;
- if ( H5Tset_precision (types[i], 128) < 0) return ret_value;
- } /*end else */
-
+ for (i = 0; i < H5_FORTRAN_NUM_INTEGER_KINDS; i++) {
+ if (IntKinds_SizeOf[i] == sizeof(char)) {
+ if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ return ret_value;
+ } /*end if */
+ else if (IntKinds_SizeOf[i] == sizeof(short)) {
+ if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ return ret_value;
+ } /*end if */
+ else if (IntKinds_SizeOf[i] == sizeof(int)) {
+ if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0)
+ return ret_value;
+ } /*end if */
+ else if (IntKinds_SizeOf[i] == sizeof(long long)) {
+ if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0)
+ return ret_value;
+ } /*end if */
+ else {
+ if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0)
+ return ret_value;
+ if (H5Tset_precision(types[i], 128) < 0)
+ return ret_value;
+ } /*end else */
}
if (sizeof(int_f) == sizeof(int)) {
- if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value;
+ if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0)
+ return ret_value;
} /*end if */
else if (sizeof(int_f) == sizeof(long)) {
- if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_LONG)) < 0) return ret_value;
+ if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_LONG)) < 0)
+ return ret_value;
} /*end if */
- else
- if (sizeof(int_f) == sizeof(long long)) {
- if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0) return ret_value;
+ else if (sizeof(int_f) == sizeof(long long)) {
+ if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_LLONG)) < 0)
+ return ret_value;
} /*end else */
/* Find appropriate size to store Fortran REAL */
- if(sizeof(real_f)==sizeof(float)) {
- if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value;
+ if (sizeof(real_f) == sizeof(float)) {
+ if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0)
+ return ret_value;
} /* end if */
- else if(sizeof(real_f)==sizeof(double)){
- if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value;
+ else if (sizeof(real_f) == sizeof(double)) {
+ if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)
+ return ret_value;
} /* end if */
-#if H5_SIZEOF_LONG_DOUBLE!=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
else if (sizeof(real_f) == sizeof(long double)) {
- if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value;
+ if ((types[6] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0)
+ return ret_value;
} /* end else */
#endif
/* Find appropriate size to store Fortran DOUBLE */
- if(sizeof(double_f)==sizeof(double)) {
- if ((types[7] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value;
- }/*end if */
-#if H5_SIZEOF_LONG_DOUBLE!=0
- else if(sizeof(double_f)==sizeof(long double)) {
- if ((types[7] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value;
- }/*end else */
+ if (sizeof(double_f) == sizeof(double)) {
+ if ((types[7] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)
+ return ret_value;
+ } /*end if */
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ else if (sizeof(double_f) == sizeof(long double)) {
+ if ((types[7] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0)
+ return ret_value;
+ } /*end else */
#endif
#ifdef H5_HAVE_FLOAT128
- else if(sizeof(double_f)==sizeof(__float128)) {
- if ((types[7] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value;
- if ( H5Tset_precision (types[7], 128) < 0) return ret_value;
- }/*end else */
+ else if (sizeof(double_f) == sizeof(__float128)) {
+ if ((types[7] = H5Tcopy(H5T_NATIVE_FLOAT)) < 0)
+ return ret_value;
+ if (H5Tset_precision(types[7], 128) < 0)
+ return ret_value;
+ } /*end else */
#endif
- if ((c_type_id = H5Tcopy(H5T_FORTRAN_S1)) < 0) return ret_value;
- if(H5Tset_size(c_type_id, 1) < 0) return ret_value;
- if(H5Tset_strpad(c_type_id, H5T_STR_SPACEPAD) < 0) return ret_value;
+ if ((c_type_id = H5Tcopy(H5T_FORTRAN_S1)) < 0)
+ return ret_value;
+ if (H5Tset_size(c_type_id, 1) < 0)
+ return ret_value;
+ if (H5Tset_strpad(c_type_id, H5T_STR_SPACEPAD) < 0)
+ return ret_value;
types[8] = (hid_t_f)c_type_id;
- if ((types[9] = (hid_t_f)H5Tcopy(H5T_STD_REF_OBJ)) < 0) return ret_value;
- if ((types[10] = (hid_t_f)H5Tcopy(H5T_STD_REF_DSETREG)) < 0) return ret_value;
+ if ((types[9] = (hid_t_f)H5Tcopy(H5T_STD_REF_OBJ)) < 0)
+ return ret_value;
+ if ((types[10] = (hid_t_f)H5Tcopy(H5T_STD_REF_DSETREG)) < 0)
+ return ret_value;
/*
* FIND H5T_NATIVE_REAL_C_FLOAT
*/
if (sizeof(real_C_FLOAT_f) == sizeof(float)) {
- if ((types[11] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value;
+ if ((types[11] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0)
+ return ret_value;
} /*end if */
else if (sizeof(real_C_FLOAT_f) == sizeof(double)) {
- if ((types[11] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value;
+ if ((types[11] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)
+ return ret_value;
} /*end if */
-#if H5_SIZEOF_LONG_DOUBLE!=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
else if (sizeof(real_C_FLOAT_f) == sizeof(long double)) {
- if ((types[11] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value;
+ if ((types[11] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0)
+ return ret_value;
} /*end else */
#endif
/*
* FIND H5T_NATIVE_REAL_C_DOUBLE
*/
if (sizeof(real_C_DOUBLE_f) == sizeof(float)) {
- if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value;
+ if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0)
+ return ret_value;
} /*end if */
else if (sizeof(real_C_DOUBLE_f) == sizeof(double)) {
- if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value;
+ if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)
+ return ret_value;
} /*end if */
-#if H5_SIZEOF_LONG_DOUBLE!=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
else if (sizeof(real_C_DOUBLE_f) == sizeof(long double)) {
- if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value;
+ if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0)
+ return ret_value;
} /*end else */
#endif
/*
* FIND H5T_NATIVE_REAL_C_LONG_DOUBLE
*/
-#if H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE!=0
+#if H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE != 0
if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(float)) {
- if ((types[13] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value;
+ if ((types[13] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0)
+ return ret_value;
} /*end if */
else if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(double)) {
- if ((types[13] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value;
+ if ((types[13] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)
+ return ret_value;
} /*end if */
-# if H5_FORTRAN_HAVE_C_LONG_DOUBLE!=0
+#if H5_FORTRAN_HAVE_C_LONG_DOUBLE != 0
else if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(long double)) {
- if ( H5_PAC_C_MAX_REAL_PRECISION >= H5_PAC_FC_MAX_REAL_PRECISION) {
- if ((types[13] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value;
- }
- else {
- if ((types[13] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value;
- if ( H5Tset_precision (types[13], 128) < 0) return ret_value;
- }
+ if (H5_PAC_C_MAX_REAL_PRECISION >= H5_PAC_FC_MAX_REAL_PRECISION) {
+ if ((types[13] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0)
+ return ret_value;
+ }
+ else {
+ if ((types[13] = H5Tcopy(H5T_NATIVE_FLOAT)) < 0)
+ return ret_value;
+ if (H5Tset_precision(types[13], 128) < 0)
+ return ret_value;
+ }
}
-# else
- if ((types[13] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value;
- if ( H5Tset_precision (types[13], 64) < 0) return ret_value;
-# endif
#else
- if ((types[13] = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value;
+ if ((types[13] = H5Tcopy(H5T_NATIVE_FLOAT)) < 0)
+ return ret_value;
+ if (H5Tset_precision(types[13], 64) < 0)
+ return ret_value;
+#endif
+#else
+ if ((types[13] = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)
+ return ret_value;
#endif
/*
* FIND H5T_NATIVE_B_8
*/
- if ((types[14] = (hid_t_f)H5Tcopy(H5T_NATIVE_B8)) < 0) return ret_value;
- if ((types[15] = (hid_t_f)H5Tcopy(H5T_NATIVE_B16)) < 0) return ret_value;
- if ((types[16] = (hid_t_f)H5Tcopy(H5T_NATIVE_B32)) < 0) return ret_value;
- if ((types[17] = (hid_t_f)H5Tcopy(H5T_NATIVE_B64)) < 0) return ret_value;
+ if ((types[14] = (hid_t_f)H5Tcopy(H5T_NATIVE_B8)) < 0)
+ return ret_value;
+ if ((types[15] = (hid_t_f)H5Tcopy(H5T_NATIVE_B16)) < 0)
+ return ret_value;
+ if ((types[16] = (hid_t_f)H5Tcopy(H5T_NATIVE_B32)) < 0)
+ return ret_value;
+ if ((types[17] = (hid_t_f)H5Tcopy(H5T_NATIVE_B64)) < 0)
+ return ret_value;
/*
* FIND H5T_NATIVE_FLOAT_128
*/
- if ((types[18] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value;
- if ( H5Tset_precision (types[18], 128) < 0) return ret_value;
+ if ((types[18] = H5Tcopy(H5T_NATIVE_FLOAT)) < 0)
+ return ret_value;
+ if (H5Tset_precision(types[18], 128) < 0)
+ return ret_value;
/*--------------------------------------------------------------------------------------*/
- if ((floatingtypes[0] = (hid_t_f)H5Tcopy(H5T_IEEE_F32BE)) < 0) return ret_value;
- if ((floatingtypes[1] = (hid_t_f)H5Tcopy(H5T_IEEE_F32LE)) < 0) return ret_value;
- if ((floatingtypes[2] = (hid_t_f)H5Tcopy(H5T_IEEE_F64BE)) < 0) return ret_value;
- if ((floatingtypes[3] = (hid_t_f)H5Tcopy(H5T_IEEE_F64LE)) < 0) return ret_value;
-
- if ((integertypes[0] = (hid_t_f)H5Tcopy(H5T_STD_I8BE)) < 0) return ret_value;
- if ((integertypes[1] = (hid_t_f)H5Tcopy(H5T_STD_I8LE)) < 0) return ret_value;
- if ((integertypes[2] = (hid_t_f)H5Tcopy(H5T_STD_I16BE)) < 0) return ret_value;
- if ((integertypes[3] = (hid_t_f)H5Tcopy(H5T_STD_I16LE)) < 0) return ret_value;
- if ((integertypes[4] = (hid_t_f)H5Tcopy(H5T_STD_I32BE)) < 0) return ret_value;
- if ((integertypes[5] = (hid_t_f)H5Tcopy(H5T_STD_I32LE)) < 0) return ret_value;
- if ((integertypes[6] = (hid_t_f)H5Tcopy(H5T_STD_I64BE)) < 0) return ret_value;
- if ((integertypes[7] = (hid_t_f)H5Tcopy(H5T_STD_I64LE)) < 0) return ret_value;
- if ((integertypes[8] = (hid_t_f)H5Tcopy(H5T_STD_U8BE)) < 0) return ret_value;
- if ((integertypes[9] = (hid_t_f)H5Tcopy(H5T_STD_U8LE)) < 0) return ret_value;
- if ((integertypes[10] = (hid_t_f)H5Tcopy(H5T_STD_U16BE)) < 0) return ret_value;
- if ((integertypes[11] = (hid_t_f)H5Tcopy(H5T_STD_U16LE)) < 0) return ret_value;
- if ((integertypes[12] = (hid_t_f)H5Tcopy(H5T_STD_U32BE)) < 0) return ret_value;
- if ((integertypes[13] = (hid_t_f)H5Tcopy(H5T_STD_U32LE)) < 0) return ret_value;
- if ((integertypes[14] = (hid_t_f)H5Tcopy(H5T_STD_U64BE)) < 0) return ret_value;
- if ((integertypes[15] = (hid_t_f)H5Tcopy(H5T_STD_U64LE)) < 0) return ret_value;
- if ((integertypes[17] = (hid_t_f)H5Tcopy(H5T_STD_B8BE)) < 0) return ret_value;
- if ((integertypes[18] = (hid_t_f)H5Tcopy(H5T_STD_B8LE)) < 0) return ret_value;
- if ((integertypes[19] = (hid_t_f)H5Tcopy(H5T_STD_B16BE)) < 0) return ret_value;
- if ((integertypes[20] = (hid_t_f)H5Tcopy(H5T_STD_B16LE)) < 0) return ret_value;
- if ((integertypes[21] = (hid_t_f)H5Tcopy(H5T_STD_B32BE)) < 0) return ret_value;
- if ((integertypes[22] = (hid_t_f)H5Tcopy(H5T_STD_B32LE)) < 0) return ret_value;
- if ((integertypes[23] = (hid_t_f)H5Tcopy(H5T_STD_B64BE)) < 0) return ret_value;
- if ((integertypes[24] = (hid_t_f)H5Tcopy(H5T_STD_B64LE)) < 0) return ret_value;
- if ((integertypes[25] = (hid_t_f)H5Tcopy(H5T_FORTRAN_S1)) < 0) return ret_value;
- if ((integertypes[26] = (hid_t_f)H5Tcopy(H5T_C_S1)) < 0) return ret_value;
-
-/*
- * Define Fortran H5T_STRING type to store non-fixed size strings
- */
- if ((c_type_id = H5Tcopy(H5T_C_S1)) < 0) return ret_value;
- if(H5Tset_size(c_type_id, H5T_VARIABLE) < 0) return ret_value;
+ if ((floatingtypes[0] = (hid_t_f)H5Tcopy(H5T_IEEE_F32BE)) < 0)
+ return ret_value;
+ if ((floatingtypes[1] = (hid_t_f)H5Tcopy(H5T_IEEE_F32LE)) < 0)
+ return ret_value;
+ if ((floatingtypes[2] = (hid_t_f)H5Tcopy(H5T_IEEE_F64BE)) < 0)
+ return ret_value;
+ if ((floatingtypes[3] = (hid_t_f)H5Tcopy(H5T_IEEE_F64LE)) < 0)
+ return ret_value;
+
+ if ((integertypes[0] = (hid_t_f)H5Tcopy(H5T_STD_I8BE)) < 0)
+ return ret_value;
+ if ((integertypes[1] = (hid_t_f)H5Tcopy(H5T_STD_I8LE)) < 0)
+ return ret_value;
+ if ((integertypes[2] = (hid_t_f)H5Tcopy(H5T_STD_I16BE)) < 0)
+ return ret_value;
+ if ((integertypes[3] = (hid_t_f)H5Tcopy(H5T_STD_I16LE)) < 0)
+ return ret_value;
+ if ((integertypes[4] = (hid_t_f)H5Tcopy(H5T_STD_I32BE)) < 0)
+ return ret_value;
+ if ((integertypes[5] = (hid_t_f)H5Tcopy(H5T_STD_I32LE)) < 0)
+ return ret_value;
+ if ((integertypes[6] = (hid_t_f)H5Tcopy(H5T_STD_I64BE)) < 0)
+ return ret_value;
+ if ((integertypes[7] = (hid_t_f)H5Tcopy(H5T_STD_I64LE)) < 0)
+ return ret_value;
+ if ((integertypes[8] = (hid_t_f)H5Tcopy(H5T_STD_U8BE)) < 0)
+ return ret_value;
+ if ((integertypes[9] = (hid_t_f)H5Tcopy(H5T_STD_U8LE)) < 0)
+ return ret_value;
+ if ((integertypes[10] = (hid_t_f)H5Tcopy(H5T_STD_U16BE)) < 0)
+ return ret_value;
+ if ((integertypes[11] = (hid_t_f)H5Tcopy(H5T_STD_U16LE)) < 0)
+ return ret_value;
+ if ((integertypes[12] = (hid_t_f)H5Tcopy(H5T_STD_U32BE)) < 0)
+ return ret_value;
+ if ((integertypes[13] = (hid_t_f)H5Tcopy(H5T_STD_U32LE)) < 0)
+ return ret_value;
+ if ((integertypes[14] = (hid_t_f)H5Tcopy(H5T_STD_U64BE)) < 0)
+ return ret_value;
+ if ((integertypes[15] = (hid_t_f)H5Tcopy(H5T_STD_U64LE)) < 0)
+ return ret_value;
+ if ((integertypes[17] = (hid_t_f)H5Tcopy(H5T_STD_B8BE)) < 0)
+ return ret_value;
+ if ((integertypes[18] = (hid_t_f)H5Tcopy(H5T_STD_B8LE)) < 0)
+ return ret_value;
+ if ((integertypes[19] = (hid_t_f)H5Tcopy(H5T_STD_B16BE)) < 0)
+ return ret_value;
+ if ((integertypes[20] = (hid_t_f)H5Tcopy(H5T_STD_B16LE)) < 0)
+ return ret_value;
+ if ((integertypes[21] = (hid_t_f)H5Tcopy(H5T_STD_B32BE)) < 0)
+ return ret_value;
+ if ((integertypes[22] = (hid_t_f)H5Tcopy(H5T_STD_B32LE)) < 0)
+ return ret_value;
+ if ((integertypes[23] = (hid_t_f)H5Tcopy(H5T_STD_B64BE)) < 0)
+ return ret_value;
+ if ((integertypes[24] = (hid_t_f)H5Tcopy(H5T_STD_B64LE)) < 0)
+ return ret_value;
+ if ((integertypes[25] = (hid_t_f)H5Tcopy(H5T_FORTRAN_S1)) < 0)
+ return ret_value;
+ if ((integertypes[26] = (hid_t_f)H5Tcopy(H5T_C_S1)) < 0)
+ return ret_value;
+
+ /*
+ * Define Fortran H5T_STRING type to store non-fixed size strings
+ */
+ if ((c_type_id = H5Tcopy(H5T_C_S1)) < 0)
+ return ret_value;
+ if (H5Tset_size(c_type_id, H5T_VARIABLE) < 0)
+ return ret_value;
integertypes[16] = c_type_id;
ret_value = 0;
@@ -287,26 +358,28 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes
* SOURCE
*/
int_f
-h5close_types_c( hid_t_f * types, int_f *lentypes,
- hid_t_f * floatingtypes, int_f* floatinglen,
- hid_t_f * integertypes, int_f * integerlen )
+h5close_types_c(hid_t_f *types, int_f *lentypes, hid_t_f *floatingtypes, int_f *floatinglen,
+ hid_t_f *integertypes, int_f *integerlen)
/******/
{
- int ret_value = -1;
+ int ret_value = -1;
hid_t c_type_id;
- int i;
+ int i;
for (i = 0; i < *lentypes; i++) {
- c_type_id = types[i];
- if ( H5Tclose(c_type_id) < 0) return ret_value;
+ c_type_id = types[i];
+ if (H5Tclose(c_type_id) < 0)
+ return ret_value;
}
for (i = 0; i < *floatinglen; i++) {
- c_type_id = floatingtypes[i];
- if ( H5Tclose(c_type_id) < 0) return ret_value;
+ c_type_id = floatingtypes[i];
+ if (H5Tclose(c_type_id) < 0)
+ return ret_value;
}
for (i = 0; i < *integerlen; i++) {
- c_type_id = integertypes[i];
- if ( H5Tclose(c_type_id) < 0) return ret_value;
+ c_type_id = integertypes[i];
+ if (H5Tclose(c_type_id) < 0)
+ return ret_value;
}
ret_value = 0;
return ret_value;
@@ -359,32 +432,29 @@ h5close_types_c( hid_t_f * types, int_f *lentypes,
* SOURCE
*/
int_f
-h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
- int_f *h5e_flags, hid_t_f *h5e_hid_flags, int_f *h5f_flags,
- int_f *h5fd_flags, hid_t_f *h5fd_hid_flags,
- int_f *h5g_flags, int_f *h5i_flags, int_f *h5l_flags, int_f *h5o_flags,
- hid_t_f *h5p_flags, int_f *h5p_flags_int, int_f *h5r_flags,
- int_f *h5s_flags, hid_t_f *h5s_hid_flags, hsize_t_f *h5s_hsize_flags,
- int_f *h5t_flags, int_f *h5z_flags, int_f *h5_generic_flags,
- haddr_t_f *h5_haddr_generic_flags)
+h5init_flags_c(int_f *h5d_flags, size_t_f *h5d_size_flags, int_f *h5e_flags, hid_t_f *h5e_hid_flags,
+ int_f *h5f_flags, int_f *h5fd_flags, hid_t_f *h5fd_hid_flags, int_f *h5g_flags,
+ int_f *h5i_flags, int_f *h5l_flags, int_f *h5o_flags, hid_t_f *h5p_flags, int_f *h5p_flags_int,
+ int_f *h5r_flags, int_f *h5s_flags, hid_t_f *h5s_hid_flags, hsize_t_f *h5s_hsize_flags,
+ int_f *h5t_flags, int_f *h5z_flags, int_f *h5_generic_flags, haddr_t_f *h5_haddr_generic_flags)
/******/
{
-/*
- * H5D flags
- */
+ /*
+ * H5D flags
+ */
h5d_size_flags[0] = (size_t_f)H5D_CHUNK_CACHE_NSLOTS_DEFAULT;
h5d_size_flags[1] = (size_t_f)H5D_CHUNK_CACHE_NBYTES_DEFAULT;
- h5d_flags[0] = (int_f)H5D_COMPACT;
- h5d_flags[1] = (int_f)H5D_CONTIGUOUS;
- h5d_flags[2] = (int_f)H5D_CHUNKED;
- h5d_flags[3] = (int_f)H5D_ALLOC_TIME_ERROR;
- h5d_flags[4] = (int_f)H5D_ALLOC_TIME_DEFAULT;
- h5d_flags[5] = (int_f)H5D_ALLOC_TIME_EARLY;
- h5d_flags[6] = (int_f)H5D_ALLOC_TIME_LATE;
- h5d_flags[7] = (int_f)H5D_ALLOC_TIME_INCR;
- h5d_flags[8] = (int_f)H5D_SPACE_STATUS_ERROR;
- h5d_flags[9] = (int_f)H5D_SPACE_STATUS_NOT_ALLOCATED;
+ h5d_flags[0] = (int_f)H5D_COMPACT;
+ h5d_flags[1] = (int_f)H5D_CONTIGUOUS;
+ h5d_flags[2] = (int_f)H5D_CHUNKED;
+ h5d_flags[3] = (int_f)H5D_ALLOC_TIME_ERROR;
+ h5d_flags[4] = (int_f)H5D_ALLOC_TIME_DEFAULT;
+ h5d_flags[5] = (int_f)H5D_ALLOC_TIME_EARLY;
+ h5d_flags[6] = (int_f)H5D_ALLOC_TIME_LATE;
+ h5d_flags[7] = (int_f)H5D_ALLOC_TIME_INCR;
+ h5d_flags[8] = (int_f)H5D_SPACE_STATUS_ERROR;
+ h5d_flags[9] = (int_f)H5D_SPACE_STATUS_NOT_ALLOCATED;
h5d_flags[10] = (int_f)H5D_SPACE_STATUS_PART_ALLOCATED;
h5d_flags[11] = (int_f)H5D_SPACE_STATUS_ALLOCATED;
h5d_flags[12] = (int_f)H5D_FILL_TIME_ERROR;
@@ -405,9 +475,9 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
h5d_flags[27] = (int_f)H5D_VDS_LAST_AVAILABLE;
h5d_flags[28] = (int_f)H5D_VIRTUAL;
-/*
- * H5E flags
- */
+ /*
+ * H5E flags
+ */
h5e_hid_flags[0] = (hid_t_f)H5E_DEFAULT;
h5e_flags[0] = (int_f)H5E_MAJOR;
@@ -415,12 +485,12 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
h5e_flags[2] = (int_f)H5E_WALK_UPWARD;
h5e_flags[3] = (int_f)H5E_WALK_DOWNWARD;
-/*
- * H5F flags
- *
- * Note that H5F_ACC_DEBUG is deprecated (nonfunctional) but retained
- * for backward compatibility since it's in the public API.
- */
+ /*
+ * H5F flags
+ *
+ * Note that H5F_ACC_DEBUG is deprecated (nonfunctional) but retained
+ * for backward compatibility since it's in the public API.
+ */
h5f_flags[0] = (int_f)H5F_ACC_RDWR;
h5f_flags[1] = (int_f)H5F_ACC_RDONLY;
h5f_flags[2] = (int_f)H5F_ACC_TRUNC;
@@ -428,11 +498,11 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
#ifndef H5_NO_DEPRECATED_SYMBOLS
h5f_flags[4] = (int_f)H5F_ACC_DEBUG;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- h5f_flags[5] = (int_f)H5F_SCOPE_LOCAL;
- h5f_flags[6] = (int_f)H5F_SCOPE_GLOBAL;
- h5f_flags[7] = (int_f)H5F_CLOSE_DEFAULT;
- h5f_flags[8] = (int_f)H5F_CLOSE_WEAK;
- h5f_flags[9] = (int_f)H5F_CLOSE_SEMI;
+ h5f_flags[5] = (int_f)H5F_SCOPE_LOCAL;
+ h5f_flags[6] = (int_f)H5F_SCOPE_GLOBAL;
+ h5f_flags[7] = (int_f)H5F_CLOSE_DEFAULT;
+ h5f_flags[8] = (int_f)H5F_CLOSE_WEAK;
+ h5f_flags[9] = (int_f)H5F_CLOSE_SEMI;
h5f_flags[10] = (int_f)H5F_CLOSE_STRONG;
h5f_flags[11] = (int_f)H5F_OBJ_FILE;
h5f_flags[12] = (int_f)H5F_OBJ_DATASET;
@@ -449,24 +519,24 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
h5f_flags[23] = (int_f)H5F_LIBVER_V112;
h5f_flags[24] = (int_f)H5F_LIBVER_V114;
-/*
- * H5FD flags
- */
- h5fd_flags[0] = (int_f)H5FD_MPIO_INDEPENDENT;
- h5fd_flags[1] = (int_f)H5FD_MPIO_COLLECTIVE;
- h5fd_flags[2] = (int_f)H5FD_MEM_NOLIST;
- h5fd_flags[3] = (int_f)H5FD_MEM_DEFAULT;
- h5fd_flags[4] = (int_f)H5FD_MEM_SUPER;
- h5fd_flags[5] = (int_f)H5FD_MEM_BTREE;
- h5fd_flags[6] = (int_f)H5FD_MEM_DRAW;
- h5fd_flags[7] = (int_f)H5FD_MEM_GHEAP;
- h5fd_flags[8] = (int_f)H5FD_MEM_LHEAP;
- h5fd_flags[9] = (int_f)H5FD_MEM_OHDR;
+ /*
+ * H5FD flags
+ */
+ h5fd_flags[0] = (int_f)H5FD_MPIO_INDEPENDENT;
+ h5fd_flags[1] = (int_f)H5FD_MPIO_COLLECTIVE;
+ h5fd_flags[2] = (int_f)H5FD_MEM_NOLIST;
+ h5fd_flags[3] = (int_f)H5FD_MEM_DEFAULT;
+ h5fd_flags[4] = (int_f)H5FD_MEM_SUPER;
+ h5fd_flags[5] = (int_f)H5FD_MEM_BTREE;
+ h5fd_flags[6] = (int_f)H5FD_MEM_DRAW;
+ h5fd_flags[7] = (int_f)H5FD_MEM_GHEAP;
+ h5fd_flags[8] = (int_f)H5FD_MEM_LHEAP;
+ h5fd_flags[9] = (int_f)H5FD_MEM_OHDR;
h5fd_flags[10] = (int_f)H5FD_MEM_NTYPES;
-/*
- * H5FD flags of type hid_t
- */
+ /*
+ * H5FD flags of type hid_t
+ */
h5fd_hid_flags[0] = (hid_t_f)H5FD_CORE;
h5fd_hid_flags[1] = (hid_t_f)H5FD_FAMILY;
h5fd_hid_flags[2] = (hid_t_f)H5FD_LOG;
@@ -475,36 +545,36 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
h5fd_hid_flags[5] = (hid_t_f)H5FD_SEC2;
h5fd_hid_flags[6] = (hid_t_f)H5FD_STDIO;
-/*
- * H5G flags
- */
- h5g_flags[0] = (int_f)H5O_TYPE_UNKNOWN; /* H5G_UNKNOWN is deprecated */
- h5g_flags[1] = (int_f)H5O_TYPE_GROUP; /* H5G_GROUP is deprecated */
- h5g_flags[2] = (int_f)H5O_TYPE_DATASET; /* H5G_DATASET is deprecated */
+ /*
+ * H5G flags
+ */
+ h5g_flags[0] = (int_f)H5O_TYPE_UNKNOWN; /* H5G_UNKNOWN is deprecated */
+ h5g_flags[1] = (int_f)H5O_TYPE_GROUP; /* H5G_GROUP is deprecated */
+ h5g_flags[2] = (int_f)H5O_TYPE_DATASET; /* H5G_DATASET is deprecated */
h5g_flags[3] = (int_f)H5O_TYPE_NAMED_DATATYPE; /* H5G_TYPE is deprecated */
h5g_flags[4] = (int_f)H5L_SAME_LOC;
h5g_flags[5] = (int_f)H5L_TYPE_ERROR;
h5g_flags[6] = (int_f)H5L_TYPE_HARD;
h5g_flags[7] = (int_f)H5L_TYPE_SOFT;
- h5g_flags[8] = (int_f)H5G_STORAGE_TYPE_UNKNOWN;
- h5g_flags[9] = (int_f)H5G_STORAGE_TYPE_SYMBOL_TABLE;
+ h5g_flags[8] = (int_f)H5G_STORAGE_TYPE_UNKNOWN;
+ h5g_flags[9] = (int_f)H5G_STORAGE_TYPE_SYMBOL_TABLE;
h5g_flags[10] = (int_f)H5G_STORAGE_TYPE_COMPACT;
h5g_flags[11] = (int_f)H5G_STORAGE_TYPE_DENSE;
-/*
- * H5I flags
- */
- h5i_flags[0] = (int_f)H5I_FILE;
- h5i_flags[1] = (int_f)H5I_GROUP;
- h5i_flags[2] = (int_f)H5I_DATATYPE;
- h5i_flags[3] = (int_f)H5I_DATASPACE;
- h5i_flags[4] = (int_f)H5I_DATASET;
- h5i_flags[5] = (int_f)H5I_ATTR;
- h5i_flags[6] = (int_f)H5I_BADID;
- h5i_flags[7] = (int_f)H5I_UNINIT;
- h5i_flags[8] = (int_f)H5I_VFL;
- h5i_flags[9] = (int_f)H5I_VOL;
+ /*
+ * H5I flags
+ */
+ h5i_flags[0] = (int_f)H5I_FILE;
+ h5i_flags[1] = (int_f)H5I_GROUP;
+ h5i_flags[2] = (int_f)H5I_DATATYPE;
+ h5i_flags[3] = (int_f)H5I_DATASPACE;
+ h5i_flags[4] = (int_f)H5I_DATASET;
+ h5i_flags[5] = (int_f)H5I_ATTR;
+ h5i_flags[6] = (int_f)H5I_BADID;
+ h5i_flags[7] = (int_f)H5I_UNINIT;
+ h5i_flags[8] = (int_f)H5I_VFL;
+ h5i_flags[9] = (int_f)H5I_VOL;
h5i_flags[10] = (int_f)H5I_GENPROP_CLS;
h5i_flags[11] = (int_f)H5I_GENPROP_LST;
h5i_flags[12] = (int_f)H5I_ERROR_CLASS;
@@ -512,94 +582,97 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
h5i_flags[14] = (int_f)H5I_ERROR_STACK;
h5i_flags[15] = (int_f)H5I_NTYPES;
h5i_flags[16] = (int_f)H5I_INVALID_HID;
-/*
- * H5L flags
- */
+ /*
+ * H5L flags
+ */
h5l_flags[0] = (int_f)H5L_TYPE_ERROR;
h5l_flags[1] = (int_f)H5L_TYPE_HARD;
h5l_flags[2] = (int_f)H5L_TYPE_SOFT;
h5l_flags[3] = (int_f)H5L_TYPE_EXTERNAL;
- h5l_flags[4] = (int_f)H5L_SAME_LOC; /* Macro to indicate operation occurs on same location */
+ h5l_flags[4] = (int_f)H5L_SAME_LOC; /* Macro to indicate operation occurs on same location */
h5l_flags[5] = (int_f)H5L_LINK_CLASS_T_VERS; /* Current version of the H5L_class_t struct */
-/*
- * H5O flags
- */
+ /*
+ * H5O flags
+ */
-/* Flags for object copy (H5Ocopy) */
+ /* Flags for object copy (H5Ocopy) */
h5o_flags[0] = (int_f)H5O_COPY_SHALLOW_HIERARCHY_FLAG; /* Copy only immediate members */
- h5o_flags[1] = (int_f)H5O_COPY_EXPAND_SOFT_LINK_FLAG; /* Expand soft links into new objects */
- h5o_flags[2] = (int_f)H5O_COPY_EXPAND_EXT_LINK_FLAG; /* Expand external links into new objects */
- h5o_flags[3] = (int_f)H5O_COPY_EXPAND_REFERENCE_FLAG; /* Copy objects that are pointed by references */
- h5o_flags[4] = (int_f)H5O_COPY_WITHOUT_ATTR_FLAG; /* Copy object without copying attributes */
- h5o_flags[5] = (int_f)H5O_COPY_PRESERVE_NULL_FLAG; /* Copy NULL messages (empty space) */
+ h5o_flags[1] = (int_f)H5O_COPY_EXPAND_SOFT_LINK_FLAG; /* Expand soft links into new objects */
+ h5o_flags[2] = (int_f)H5O_COPY_EXPAND_EXT_LINK_FLAG; /* Expand external links into new objects */
+ h5o_flags[3] = (int_f)H5O_COPY_EXPAND_REFERENCE_FLAG; /* Copy objects that are pointed by references */
+ h5o_flags[4] = (int_f)H5O_COPY_WITHOUT_ATTR_FLAG; /* Copy object without copying attributes */
+ h5o_flags[5] = (int_f)H5O_COPY_PRESERVE_NULL_FLAG; /* Copy NULL messages (empty space) */
h5o_flags[6] = (int_f)H5O_COPY_ALL; /* All object copying flags (for internal checking) */
-/* Flags for shared message indexes.
- * Pass these flags in using the mesg_type_flags parameter in
- * H5P_set_shared_mesg_index.
- * (Developers: These flags correspond to object header message type IDs,
- * but we need to assign each kind of message to a different bit so that
- * one index can hold multiple types.)
- */
- h5o_flags[7] = (int_f)H5O_SHMESG_NONE_FLAG; /* No shared messages */
- h5o_flags[8] = (int_f)H5O_SHMESG_SDSPACE_FLAG; /* Simple Dataspace Message. */
- h5o_flags[9] = (int_f)H5O_SHMESG_DTYPE_FLAG; /* Datatype Message. */
- h5o_flags[10] = (int_f)H5O_SHMESG_FILL_FLAG; /* Fill Value Message. */
- h5o_flags[11] = (int_f)H5O_SHMESG_PLINE_FLAG; /* Filter pipeline message. */
- h5o_flags[12] = (int_f)H5O_SHMESG_ATTR_FLAG; /* Attribute Message. */
+ /* Flags for shared message indexes.
+ * Pass these flags in using the mesg_type_flags parameter in
+ * H5P_set_shared_mesg_index.
+ * (Developers: These flags correspond to object header message type IDs,
+ * but we need to assign each kind of message to a different bit so that
+ * one index can hold multiple types.)
+ */
+ h5o_flags[7] = (int_f)H5O_SHMESG_NONE_FLAG; /* No shared messages */
+ h5o_flags[8] = (int_f)H5O_SHMESG_SDSPACE_FLAG; /* Simple Dataspace Message. */
+ h5o_flags[9] = (int_f)H5O_SHMESG_DTYPE_FLAG; /* Datatype Message. */
+ h5o_flags[10] = (int_f)H5O_SHMESG_FILL_FLAG; /* Fill Value Message. */
+ h5o_flags[11] = (int_f)H5O_SHMESG_PLINE_FLAG; /* Filter pipeline message. */
+ h5o_flags[12] = (int_f)H5O_SHMESG_ATTR_FLAG; /* Attribute Message. */
h5o_flags[13] = (int_f)H5O_SHMESG_ALL_FLAG;
-/* Object header status flag definitions */
- h5o_flags[14] = (int_f)H5O_HDR_CHUNK0_SIZE; /* 2-bit field indicating # of bytes to store the size of chunk 0's data */
+ /* Object header status flag definitions */
+ h5o_flags[14] = (int_f)
+ H5O_HDR_CHUNK0_SIZE; /* 2-bit field indicating # of bytes to store the size of chunk 0's data */
h5o_flags[15] = (int_f)H5O_HDR_ATTR_CRT_ORDER_TRACKED; /* Attribute creation order is tracked */
h5o_flags[16] = (int_f)H5O_HDR_ATTR_CRT_ORDER_INDEXED; /* Attribute creation order has index */
- h5o_flags[17] = (int_f)H5O_HDR_ATTR_STORE_PHASE_CHANGE; /* Non-default attribute storage phase change values stored */
- h5o_flags[18] = (int_f)H5O_HDR_STORE_TIMES; /* Store access, modification, change & birth times for object */
+ h5o_flags[17] =
+ (int_f)H5O_HDR_ATTR_STORE_PHASE_CHANGE; /* Non-default attribute storage phase change values stored */
+ h5o_flags[18] =
+ (int_f)H5O_HDR_STORE_TIMES; /* Store access, modification, change & birth times for object */
h5o_flags[19] = (int_f)H5O_HDR_ALL_FLAGS;
-/* Maximum shared message values. Number of indexes is 8 to allow room to add
- * new types of messages.
- */
+ /* Maximum shared message values. Number of indexes is 8 to allow room to add
+ * new types of messages.
+ */
h5o_flags[20] = (int_f)H5O_SHMESG_MAX_NINDEXES;
h5o_flags[21] = (int_f)H5O_SHMESG_MAX_LIST_SIZE;
-/* Types of objects in file */
- h5o_flags[22] = (int_f)H5O_TYPE_UNKNOWN; /* Unknown object type */
+ /* Types of objects in file */
+ h5o_flags[22] = (int_f)H5O_TYPE_UNKNOWN; /* Unknown object type */
h5o_flags[23] = (int_f)H5O_TYPE_GROUP; /* Object is a group */
h5o_flags[24] = (int_f)H5O_TYPE_DATASET; /* Object is a dataset */
h5o_flags[25] = (int_f)H5O_TYPE_NAMED_DATATYPE; /* Object is a named data type */
h5o_flags[26] = (int_f)H5O_TYPE_NTYPES; /* Number of different object types */
-/* Flags for H5Oget_info.
- * These flags determine which fields will be filled in in the H5O_info_t
- * struct.
- */
- h5o_flags[27] = (int_f)H5O_INFO_ALL; /* (H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_NUM_ATTRS) */
- h5o_flags[28] = (int_f)H5O_INFO_BASIC; /* Fill in the fileno, addr, type, and rc fields */
- h5o_flags[29] = (int_f)H5O_INFO_TIME; /* Fill in the atime, mtime, ctime, and btime fields */
+ /* Flags for H5Oget_info.
+ * These flags determine which fields will be filled in in the H5O_info_t
+ * struct.
+ */
+ h5o_flags[27] = (int_f)H5O_INFO_ALL; /* (H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_NUM_ATTRS) */
+ h5o_flags[28] = (int_f)H5O_INFO_BASIC; /* Fill in the fileno, addr, type, and rc fields */
+ h5o_flags[29] = (int_f)H5O_INFO_TIME; /* Fill in the atime, mtime, ctime, and btime fields */
h5o_flags[30] = (int_f)H5O_INFO_NUM_ATTRS; /* Fill in the num_attrs field */
-/* Flags for H5Oget_native_info.
- * These flags determine which fields will be filled in in the H5O_native_info_t
- * struct.
- */
+ /* Flags for H5Oget_native_info.
+ * These flags determine which fields will be filled in in the H5O_native_info_t
+ * struct.
+ */
h5o_flags[31] = (int_f)H5O_NATIVE_INFO_ALL; /* (H5O_NATIVE_INFO_HDR|H5O_NATIVE_INFO_META_SIZE) */
h5o_flags[32] = (int_f)H5O_NATIVE_INFO_HDR; /* Fill in the hdr field */
h5o_flags[33] = (int_f)H5O_NATIVE_INFO_META_SIZE; /* Fill in the meta_size field */
-/*
- * H5P flags
- */
- h5p_flags[0] = (hid_t_f)H5P_FILE_CREATE;
- h5p_flags[1] = (hid_t_f)H5P_FILE_ACCESS;
- h5p_flags[2] = (hid_t_f)H5P_DATASET_CREATE;
- h5p_flags[3] = (hid_t_f)H5P_DATASET_XFER;
- h5p_flags[4] = (hid_t_f)H5P_FILE_MOUNT;
- h5p_flags[5] = (hid_t_f)H5P_DEFAULT;
- h5p_flags[6] = (hid_t_f)H5P_ROOT;
- h5p_flags[7] = (hid_t_f)H5P_OBJECT_CREATE;
- h5p_flags[8] = (hid_t_f)H5P_DATASET_ACCESS;
- h5p_flags[9] = (hid_t_f)H5P_GROUP_CREATE;
+ /*
+ * H5P flags
+ */
+ h5p_flags[0] = (hid_t_f)H5P_FILE_CREATE;
+ h5p_flags[1] = (hid_t_f)H5P_FILE_ACCESS;
+ h5p_flags[2] = (hid_t_f)H5P_DATASET_CREATE;
+ h5p_flags[3] = (hid_t_f)H5P_DATASET_XFER;
+ h5p_flags[4] = (hid_t_f)H5P_FILE_MOUNT;
+ h5p_flags[5] = (hid_t_f)H5P_DEFAULT;
+ h5p_flags[6] = (hid_t_f)H5P_ROOT;
+ h5p_flags[7] = (hid_t_f)H5P_OBJECT_CREATE;
+ h5p_flags[8] = (hid_t_f)H5P_DATASET_ACCESS;
+ h5p_flags[9] = (hid_t_f)H5P_GROUP_CREATE;
h5p_flags[10] = (hid_t_f)H5P_GROUP_ACCESS;
h5p_flags[11] = (hid_t_f)H5P_DATATYPE_CREATE;
h5p_flags[12] = (hid_t_f)H5P_DATATYPE_ACCESS;
@@ -609,22 +682,21 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
h5p_flags[16] = (hid_t_f)H5P_LINK_CREATE;
h5p_flags[17] = (hid_t_f)H5P_LINK_ACCESS;
-
-/*
- * H5P integer flags
- */
+ /*
+ * H5P integer flags
+ */
h5p_flags_int[0] = (int_f)H5P_CRT_ORDER_INDEXED;
h5p_flags_int[1] = (int_f)H5P_CRT_ORDER_TRACKED;
-/*
- * H5R flags
- */
+ /*
+ * H5R flags
+ */
h5r_flags[0] = (int_f)H5R_OBJECT;
h5r_flags[1] = (int_f)H5R_DATASET_REGION;
-/*
- * H5S flags
- */
+ /*
+ * H5S flags
+ */
h5s_hid_flags[0] = (hid_t_f)H5S_ALL;
h5s_hsize_flags[0] = (hsize_t_f)H5S_UNLIMITED;
@@ -651,19 +723,19 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
h5s_flags[16] = (int_f)H5S_SEL_HYPERSLABS;
h5s_flags[17] = (int_f)H5S_SEL_ALL;
-/*
- * H5T flags
- */
- h5t_flags[0] = (int_f)H5T_NO_CLASS;
- h5t_flags[1] = (int_f)H5T_INTEGER;
- h5t_flags[2] = (int_f)H5T_FLOAT;
- h5t_flags[3] = (int_f)H5T_TIME;
- h5t_flags[4] = (int_f)H5T_STRING;
- h5t_flags[5] = (int_f)H5T_BITFIELD;
- h5t_flags[6] = (int_f)H5T_OPAQUE;
- h5t_flags[7] = (int_f)H5T_COMPOUND;
- h5t_flags[8] = (int_f)H5T_REFERENCE;
- h5t_flags[9] = (int_f)H5T_ENUM;
+ /*
+ * H5T flags
+ */
+ h5t_flags[0] = (int_f)H5T_NO_CLASS;
+ h5t_flags[1] = (int_f)H5T_INTEGER;
+ h5t_flags[2] = (int_f)H5T_FLOAT;
+ h5t_flags[3] = (int_f)H5T_TIME;
+ h5t_flags[4] = (int_f)H5T_STRING;
+ h5t_flags[5] = (int_f)H5T_BITFIELD;
+ h5t_flags[6] = (int_f)H5T_OPAQUE;
+ h5t_flags[7] = (int_f)H5T_COMPOUND;
+ h5t_flags[8] = (int_f)H5T_REFERENCE;
+ h5t_flags[9] = (int_f)H5T_ENUM;
h5t_flags[10] = (int_f)H5T_ORDER_LE;
h5t_flags[11] = (int_f)H5T_ORDER_BE;
h5t_flags[12] = (int_f)H5T_ORDER_MIXED;
@@ -690,19 +762,19 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
h5t_flags[33] = (int_f)H5T_DIR_ASCEND;
h5t_flags[34] = (int_f)H5T_DIR_DESCEND;
-/*
- * H5Z flags
- */
- h5z_flags[0] = (int_f)H5Z_FILTER_ERROR;
- h5z_flags[1] = (int_f)H5Z_FILTER_NONE;
- h5z_flags[2] = (int_f)H5Z_FILTER_DEFLATE;
- h5z_flags[3] = (int_f)H5Z_FILTER_SHUFFLE;
- h5z_flags[4] = (int_f)H5Z_FILTER_FLETCHER32;
- h5z_flags[5] = (int_f)H5Z_ERROR_EDC;
- h5z_flags[6] = (int_f)H5Z_DISABLE_EDC;
- h5z_flags[7] = (int_f)H5Z_ENABLE_EDC;
- h5z_flags[8] = (int_f)H5Z_NO_EDC;
- h5z_flags[9] = (int_f)H5Z_FILTER_SZIP;
+ /*
+ * H5Z flags
+ */
+ h5z_flags[0] = (int_f)H5Z_FILTER_ERROR;
+ h5z_flags[1] = (int_f)H5Z_FILTER_NONE;
+ h5z_flags[2] = (int_f)H5Z_FILTER_DEFLATE;
+ h5z_flags[3] = (int_f)H5Z_FILTER_SHUFFLE;
+ h5z_flags[4] = (int_f)H5Z_FILTER_FLETCHER32;
+ h5z_flags[5] = (int_f)H5Z_ERROR_EDC;
+ h5z_flags[6] = (int_f)H5Z_DISABLE_EDC;
+ h5z_flags[7] = (int_f)H5Z_ENABLE_EDC;
+ h5z_flags[8] = (int_f)H5Z_NO_EDC;
+ h5z_flags[9] = (int_f)H5Z_FILTER_SZIP;
h5z_flags[10] = (int_f)H5Z_FLAG_OPTIONAL;
h5z_flags[11] = (int_f)H5Z_FILTER_CONFIG_ENCODE_ENABLED;
h5z_flags[12] = (int_f)H5Z_FILTER_CONFIG_DECODE_ENABLED;
@@ -714,9 +786,9 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
h5z_flags[18] = (int_f)H5Z_SO_INT;
h5z_flags[19] = (int_f)H5Z_SO_INT_MINBITS_DEFAULT;
-/*
- * H5 Generic flags introduced in version 1.8
- */
+ /*
+ * H5 Generic flags introduced in version 1.8
+ */
/* H5_index_t enum struct */
@@ -725,14 +797,13 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
h5_generic_flags[2] = (int_f)H5_INDEX_CRT_ORDER; /* Index on creation order */
h5_generic_flags[3] = (int_f)H5_INDEX_N; /* Index on creation order */
-
/* H5_iter_order_t enum struct */
- h5_generic_flags[4] = (int_f)H5_ITER_UNKNOWN; /* Unknown order */
- h5_generic_flags[5] = (int_f)H5_ITER_INC; /* Increasing order */
- h5_generic_flags[6] = (int_f)H5_ITER_DEC; /* Decreasing order */
- h5_generic_flags[7] = (int_f)H5_ITER_NATIVE; /* No particular order, whatever is fastest */
- h5_generic_flags[8] = (int_f)H5_ITER_N; /* Number of iteration orders */
+ h5_generic_flags[4] = (int_f)H5_ITER_UNKNOWN; /* Unknown order */
+ h5_generic_flags[5] = (int_f)H5_ITER_INC; /* Increasing order */
+ h5_generic_flags[6] = (int_f)H5_ITER_DEC; /* Decreasing order */
+ h5_generic_flags[7] = (int_f)H5_ITER_NATIVE; /* No particular order, whatever is fastest */
+ h5_generic_flags[8] = (int_f)H5_ITER_N; /* Number of iteration orders */
h5_haddr_generic_flags[0] = (haddr_t_f)HADDR_UNDEF; /* undefined address */
@@ -743,12 +814,12 @@ int_f
h5init1_flags_c(int_f *h5lib_flags)
/******/
{
- int ret_value = -1;
- unsigned prm_1 = H5_SZIP_EC_OPTION_MASK;
- unsigned prm_2 = H5_SZIP_NN_OPTION_MASK;
- h5lib_flags[0] = (int_f)prm_1;
- h5lib_flags[1] = (int_f)prm_2;
- ret_value = 0;
+ int ret_value = -1;
+ unsigned prm_1 = H5_SZIP_EC_OPTION_MASK;
+ unsigned prm_2 = H5_SZIP_NN_OPTION_MASK;
+ h5lib_flags[0] = (int_f)prm_1;
+ h5lib_flags[1] = (int_f)prm_2;
+ ret_value = 0;
return ret_value;
}
@@ -771,7 +842,8 @@ h5open_c(void)
{
int ret_value = -1;
- if (H5open() < 0) return ret_value;
+ if (H5open() < 0)
+ return ret_value;
ret_value = 0;
return ret_value;
}
@@ -792,7 +864,8 @@ h5close_c(void)
{
int ret_value = -1;
- if (H5close() < 0) return ret_value;
+ if (H5close() < 0)
+ return ret_value;
ret_value = 0;
return ret_value;
}
@@ -824,14 +897,15 @@ h5get_libversion_c(int_f *majnum, int_f *minnum, int_f *relnum)
/******/
{
- int ret_value = -1;
+ int ret_value = -1;
unsigned c_majnum, c_minnum, c_relnum;
- if (H5get_libversion(&c_majnum, &c_minnum, &c_relnum) < 0) return ret_value;
+ if (H5get_libversion(&c_majnum, &c_minnum, &c_relnum) < 0)
+ return ret_value;
- *majnum = (int_f)c_majnum;
- *minnum = (int_f)c_minnum;
- *relnum = (int_f)c_relnum;
+ *majnum = (int_f)c_majnum;
+ *minnum = (int_f)c_minnum;
+ *relnum = (int_f)c_relnum;
ret_value = 0;
return ret_value;
}
@@ -861,12 +935,12 @@ int_f
h5check_version_c(int_f *majnum, int_f *minnum, int_f *relnum)
/******/
{
- int ret_value = -1;
+ int ret_value = -1;
unsigned c_majnum, c_minnum, c_relnum;
- c_majnum = (unsigned) *majnum;
- c_minnum = (unsigned) *minnum;
- c_relnum = (unsigned) *relnum;
+ c_majnum = (unsigned)*majnum;
+ c_minnum = (unsigned)*minnum;
+ c_relnum = (unsigned)*relnum;
H5check_version(c_majnum, c_minnum, c_relnum);
@@ -892,7 +966,8 @@ h5garbage_collect_c(void)
{
int ret_value = -1;
- if (H5garbage_collect() < 0) return ret_value;
+ if (H5garbage_collect() < 0)
+ return ret_value;
ret_value = 0;
return ret_value;
}
@@ -915,8 +990,8 @@ h5dont_atexit_c(void)
{
int ret_value = -1;
- if (H5dont_atexit() < 0) return ret_value;
+ if (H5dont_atexit() < 0)
+ return ret_value;
ret_value = 0;
return ret_value;
}
-
diff --git a/fortran/src/H5f90.h b/fortran/src/H5f90.h
index 655cb9b..373f3d9 100644
--- a/fortran/src/H5f90.h
+++ b/fortran/src/H5f90.h
@@ -11,7 +11,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
#ifndef _H5f90_H
#define _H5f90_H
@@ -21,12 +20,11 @@
#include "H5f90proto.h"
/* Constants used in H5Rff.F90 and H5Rf.c files */
-#define REF_REG_BUF_LEN_F 3
+#define REF_REG_BUF_LEN_F 3
/* Constants used in H5Gf.c files */
#define OBJECT_NAMELEN_DEFAULT_F -1
-#define H5_MAX(a,b) (((a)>(b)) ? (a) : (b))
+#define H5_MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif /* _H5f90_H */
-
diff --git a/fortran/src/H5f90i.h b/fortran/src/H5f90i.h
index 057edc5..71ce77f 100644
--- a/fortran/src/H5f90i.h
+++ b/fortran/src/H5f90i.h
@@ -11,7 +11,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
#ifndef _H5f90i_H
#define _H5f90i_H
@@ -25,7 +24,7 @@
*/
#define _fcdtocp(desc) (desc)
-#if (defined (UNICOS) || defined (_UNICOS)) && !defined(__crayx1)
+#if (defined(UNICOS) || defined(_UNICOS)) && !defined(__crayx1)
#include <fortran.h>
@@ -33,7 +32,7 @@
#else
-typedef char *_fcd;
+typedef char *_fcd;
#endif
diff --git a/fortran/src/H5f90kit.c b/fortran/src/H5f90kit.c
index 6e8c793..458bcd1 100644
--- a/fortran/src/H5f90kit.c
+++ b/fortran/src/H5f90kit.c
@@ -20,7 +20,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include <ctype.h>
#include <stddef.h>
@@ -45,17 +45,17 @@ char *
HD5f2cstring(_fcd fdesc, size_t len)
/******/
{
- char *cstr; /* C string to return */
- char *str; /* Pointer to FORTRAN string */
- int i; /* Local index variable */
+ char *cstr; /* C string to return */
+ char *str; /* Pointer to FORTRAN string */
+ int i; /* Local index variable */
/* Search for the end of the string */
str = _fcdtocp(fdesc);
- for(i = (int)len - 1; i >= 0 && HDisspace((int)str[i]) && str[i] == ' '; i--)
+ for (i = (int)len - 1; i >= 0 && HDisspace((int)str[i]) && str[i] == ' '; i--)
/*EMPTY*/;
/* Allocate C string */
- if(NULL == (cstr = (char *)HDmalloc((size_t)(i + 2))))
+ if (NULL == (cstr = (char *)HDmalloc((size_t)(i + 2))))
return NULL;
/* Copy text from FORTRAN to C string */
@@ -65,7 +65,7 @@ HD5f2cstring(_fcd fdesc, size_t len)
cstr[i + 1] = '\0';
return cstr;
-} /* HD5f2cstring */
+} /* HD5f2cstring */
/****if* H5f90kit/HD5packFstring
* NAME
@@ -91,15 +91,14 @@ void
HD5packFstring(char *src, char *dest, size_t dst_len)
/******/
{
- size_t src_len=HDstrlen(src);
+ size_t src_len = HDstrlen(src);
/* Copy over the string information, up to the length of the src */
/* (Don't copy the NUL terminator from the C string to the FORTRAN string */
- HDmemcpy(dest,src,MIN(src_len,dst_len));
+ HDmemcpy(dest, src, MIN(src_len, dst_len));
/* Pad out any remaining space in the FORTRAN string with ' 's */
- if(src_len<dst_len)
- HDmemset(&dest[src_len],' ',dst_len-src_len);
-
-} /* HD5packFstring */
+ if (src_len < dst_len)
+ HDmemset(&dest[src_len], ' ', dst_len - src_len);
+} /* HD5packFstring */
diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h
index 695efcd..74eb54e 100644
--- a/fortran/src/H5f90proto.h
+++ b/fortran/src/H5f90proto.h
@@ -11,76 +11,75 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
#ifndef _H5f90proto_H
#define _H5f90proto_H
#include "H5public.h"
#include "H5f90.h"
-H5_FCDLL char * HD5f2cstring (_fcd fdesc, size_t len);
-H5_FCDLL void HD5packFstring(char *src, char *dest, size_t len);
-
+H5_FCDLL char *HD5f2cstring(_fcd fdesc, size_t len);
+H5_FCDLL void HD5packFstring(char *src, char *dest, size_t len);
/*
* Storage info struct used by H5O_info_t and H5F_info_t
* interoperable with Fortran.
*/
typedef struct H5_ih_info_t_f {
- hsize_t index_size; /* btree and/or list */
- hsize_t heap_size;
+ hsize_t index_size; /* btree and/or list */
+ hsize_t heap_size;
} H5_ih_info_t_f;
/* Information struct for object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx)
* interoperable with Fortran.
*/
typedef struct H5O_hdr_info_t_f {
- int_f version; /* Version number of header format in file */
- int_f nmesgs; /* Number of object header messages */
- int_f nchunks; /* Number of object header chunks */
- int_f flags; /* Object header status flags */
+ int_f version; /* Version number of header format in file */
+ int_f nmesgs; /* Number of object header messages */
+ int_f nchunks; /* Number of object header chunks */
+ int_f flags; /* Object header status flags */
struct {
- hsize_t total; /* Total space for storing object header in file */
- hsize_t meta; /* Space within header for object header metadata information */
- hsize_t mesg; /* Space within header for actual message information */
- hsize_t free; /* Free space within object header */
+ hsize_t total; /* Total space for storing object header in file */
+ hsize_t meta; /* Space within header for object header metadata information */
+ hsize_t mesg; /* Space within header for actual message information */
+ hsize_t free; /* Free space within object header */
} space;
struct {
- uint64_t present; /* Flags to indicate presence of message type in header */
- uint64_t shared; /* Flags to indicate message type is shared in header */
+ uint64_t present; /* Flags to indicate presence of message type in header */
+ uint64_t shared; /* Flags to indicate message type is shared in header */
} mesg;
} H5O_hdr_info_t_f;
/* Information struct for object (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx)
*/
typedef struct H5O_info_t_f {
- unsigned long fileno; /* File number that object is located in */
- H5O_token_t token; /* Token of object in file */
- int type; /* Basic object type (group, dataset, etc.) */
- int_f rc; /* Reference count of object */
- int_f atime[8]; /* Access time */
- int_f mtime[8]; /* Modification time */
- int_f ctime[8]; /* Change time */
- int_f btime[8]; /* Birth time */
- hsize_t num_attrs; /* # of attributes attached to object */
+ unsigned long fileno; /* File number that object is located in */
+ H5O_token_t token; /* Token of object in file */
+ int type; /* Basic object type (group, dataset, etc.) */
+ int_f rc; /* Reference count of object */
+ int_f atime[8]; /* Access time */
+ int_f mtime[8]; /* Modification time */
+ int_f ctime[8]; /* Change time */
+ int_f btime[8]; /* Birth time */
+ hsize_t num_attrs; /* # of attributes attached to object */
} H5O_info_t_f;
-/* Information struct for native object (for H5Oget_native_info/H5Oget_native_info_by_name/H5Oget_native_info_by_idx)
+/* Information struct for native object (for
+ * H5Oget_native_info/H5Oget_native_info_by_name/H5Oget_native_info_by_idx)
*/
typedef struct H5O_native_info_t_f {
- H5O_hdr_info_t_f hdr; /* Object header information */
+ H5O_hdr_info_t_f hdr; /* Object header information */
/* Extra metadata storage for obj & attributes */
struct {
- H5_ih_info_t_f obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
- H5_ih_info_t_f attr; /* v2 B-tree & heap for attributes */
+ H5_ih_info_t_f obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
+ H5_ih_info_t_f attr; /* v2 B-tree & heap for attributes */
} meta_size;
} H5O_native_info_t_f;
-
/*
* Functions from H5Ff.c
*/
-H5_FCDLL int_f h5fcreate_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *crt_prp, hid_t_f *acc_prp, hid_t_f *file_id);
+H5_FCDLL int_f h5fcreate_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *crt_prp, hid_t_f *acc_prp,
+ hid_t_f *file_id);
H5_FCDLL int_f h5fopen_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hid_t_f *file_id);
H5_FCDLL int_f h5fclose_c(hid_t_f *file_id);
H5_FCDLL int_f h5fmount_c(hid_t_f *loc_id, _fcd dsetname, int_f *namelen, hid_t_f *file_id, hid_t_f *acc_prp);
@@ -89,7 +88,8 @@ H5_FCDLL int_f h5freopen_c(hid_t_f *file_id1, hid_t_f *file_id2);
H5_FCDLL int_f h5fget_create_plist_c(hid_t_f *file_id, hid_t_f *prop_id);
H5_FCDLL int_f h5fget_access_plist_c(hid_t_f *file_id, hid_t_f *access_id);
H5_FCDLL int_f h5fget_obj_count_c(hid_t_f *file_id, int_f *obj_type, size_t_f *obj_count);
-H5_FCDLL int_f h5fget_obj_ids_c(hid_t_f *file_id, int_f *obj_type, size_t_f *max_objs, hid_t_f *obj_ids, size_t_f *num_objs);
+H5_FCDLL int_f h5fget_obj_ids_c(hid_t_f *file_id, int_f *obj_type, size_t_f *max_objs, hid_t_f *obj_ids,
+ size_t_f *num_objs);
H5_FCDLL int_f h5fget_freespace_c(hid_t_f *file_id, hssize_t_f *free_space);
H5_FCDLL int_f h5fget_file_image_c(hid_t_f *file_id, void *buf_ptr, size_t_f *buf_len, size_t_f *buf_req);
H5_FCDLL int_f h5fflush_c(hid_t_f *obj_id, int_f *scope);
@@ -100,97 +100,124 @@ H5_FCDLL int_f h5fget_fileno_c(hid_t_f *file_id, int_f *fileno);
/*
* Functions from H5Sf.c
*/
-H5_FCDLL int_f h5screate_simple_c( int_f *rank, hsize_t_f *dims, hsize_t_f *maxdims, hid_t_f *space_id );
-H5_FCDLL int_f h5sclose_c( hid_t_f *space_id );
-H5_FCDLL int_f h5screate_c( int_f *classtype, hid_t_f *space_id );
-H5_FCDLL int_f h5scopy_c( hid_t_f *space_id , hid_t_f *new_space_id);
-H5_FCDLL int_f h5sget_select_hyper_nblocks_c( hid_t_f *space_id , hssize_t_f * num_blocks);
-H5_FCDLL int_f h5sget_select_hyper_blocklist_c( hid_t_f *space_id ,hsize_t_f * startblock, hsize_t_f * num_blocks, hsize_t_f * buf);
-H5_FCDLL int_f h5sget_select_bounds_c( hid_t_f *space_id , hsize_t_f * start, hsize_t_f * end);
-H5_FCDLL int_f h5sget_select_elem_npoints_c( hid_t_f *space_id , hssize_t_f * num_points);
-H5_FCDLL int_f h5sget_select_elem_pointlist_c( hid_t_f *space_id ,hsize_t_f * startpoint, hsize_t_f * numpoints, hsize_t_f * buf);
-H5_FCDLL int_f h5sselect_all_c( hid_t_f *space_id );
-H5_FCDLL int_f h5sselect_none_c( hid_t_f *space_id );
-H5_FCDLL int_f h5sselect_valid_c( hid_t_f *space_id , int_f *flag );
-H5_FCDLL int_f h5sget_simple_extent_npoints_c( hid_t_f *space_id , hsize_t_f *npoints );
-H5_FCDLL int_f h5sget_select_npoints_c( hid_t_f *space_id , hssize_t_f *npoints );
-H5_FCDLL int_f h5sget_simple_extent_ndims_c( hid_t_f *space_id , int_f *ndims );
-H5_FCDLL int_f h5sget_simple_extent_type_c( hid_t_f *space_id , int_f *classtype);
-H5_FCDLL int_f h5soffset_simple_c( hid_t_f *space_id , hssize_t_f *offset);
-H5_FCDLL int_f h5sset_extent_simple_c( hid_t_f *space_id , int_f *rank, hsize_t_f * current_size, hsize_t_f *maximum_size);
-H5_FCDLL int_f h5sis_simple_c( hid_t_f *space_id , int_f *flag );
-H5_FCDLL int_f h5sget_simple_extent_dims_c( hid_t_f *space_id , hsize_t_f *dims, hsize_t_f *maxdims);
-H5_FCDLL int_f h5sextent_copy_c( hid_t_f *dest_space_id , hid_t_f *source_space_id);
-H5_FCDLL int_f h5sset_extent_none_c( hid_t_f *space_id );
-H5_FCDLL int_f h5sselect_hyperslab_c( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block);
-H5_FCDLL int_f h5sget_select_type_c( hid_t_f *space_id , int_f *op);
-H5_FCDLL int_f h5sselect_elements_c( hid_t_f *space_id , int_f *op, size_t_f *nelements, hsize_t_f *coord);
-H5_FCDLL int_f h5scombine_hyperslab_c( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block, hid_t_f *hyper_id);
-H5_FCDLL int_f h5scombine_select_c( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t_f *ds_id);
-H5_FCDLL int_f h5smodify_select_c( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id);
-H5_FCDLL int_f h5sdecode_c( _fcd buf, hid_t_f *obj_id );
-H5_FCDLL int_f h5sencode_c(_fcd buf, hid_t_f *obj_id, size_t_f *nalloc, hid_t_f *fapl_id );
-H5_FCDLL int_f h5sextent_equal_c( hid_t_f * space1_id, hid_t_f *space2_id, hid_t_f *c_equal);
+H5_FCDLL int_f h5screate_simple_c(int_f *rank, hsize_t_f *dims, hsize_t_f *maxdims, hid_t_f *space_id);
+H5_FCDLL int_f h5sclose_c(hid_t_f *space_id);
+H5_FCDLL int_f h5screate_c(int_f *classtype, hid_t_f *space_id);
+H5_FCDLL int_f h5scopy_c(hid_t_f *space_id, hid_t_f *new_space_id);
+H5_FCDLL int_f h5sget_select_hyper_nblocks_c(hid_t_f *space_id, hssize_t_f *num_blocks);
+H5_FCDLL int_f h5sget_select_hyper_blocklist_c(hid_t_f *space_id, hsize_t_f *startblock,
+ hsize_t_f *num_blocks, hsize_t_f *buf);
+H5_FCDLL int_f h5sget_select_bounds_c(hid_t_f *space_id, hsize_t_f *start, hsize_t_f *end);
+H5_FCDLL int_f h5sget_select_elem_npoints_c(hid_t_f *space_id, hssize_t_f *num_points);
+H5_FCDLL int_f h5sget_select_elem_pointlist_c(hid_t_f *space_id, hsize_t_f *startpoint, hsize_t_f *numpoints,
+ hsize_t_f *buf);
+H5_FCDLL int_f h5sselect_all_c(hid_t_f *space_id);
+H5_FCDLL int_f h5sselect_none_c(hid_t_f *space_id);
+H5_FCDLL int_f h5sselect_valid_c(hid_t_f *space_id, int_f *flag);
+H5_FCDLL int_f h5sget_simple_extent_npoints_c(hid_t_f *space_id, hsize_t_f *npoints);
+H5_FCDLL int_f h5sget_select_npoints_c(hid_t_f *space_id, hssize_t_f *npoints);
+H5_FCDLL int_f h5sget_simple_extent_ndims_c(hid_t_f *space_id, int_f *ndims);
+H5_FCDLL int_f h5sget_simple_extent_type_c(hid_t_f *space_id, int_f *classtype);
+H5_FCDLL int_f h5soffset_simple_c(hid_t_f *space_id, hssize_t_f *offset);
+H5_FCDLL int_f h5sset_extent_simple_c(hid_t_f *space_id, int_f *rank, hsize_t_f *current_size,
+ hsize_t_f *maximum_size);
+H5_FCDLL int_f h5sis_simple_c(hid_t_f *space_id, int_f *flag);
+H5_FCDLL int_f h5sget_simple_extent_dims_c(hid_t_f *space_id, hsize_t_f *dims, hsize_t_f *maxdims);
+H5_FCDLL int_f h5sextent_copy_c(hid_t_f *dest_space_id, hid_t_f *source_space_id);
+H5_FCDLL int_f h5sset_extent_none_c(hid_t_f *space_id);
+H5_FCDLL int_f h5sselect_hyperslab_c(hid_t_f *space_id, int_f *op, hsize_t_f *start, hsize_t_f *count,
+ hsize_t_f *stride, hsize_t_f *block);
+H5_FCDLL int_f h5sget_select_type_c(hid_t_f *space_id, int_f *op);
+H5_FCDLL int_f h5sselect_elements_c(hid_t_f *space_id, int_f *op, size_t_f *nelements, hsize_t_f *coord);
+H5_FCDLL int_f h5scombine_hyperslab_c(hid_t_f *space_id, int_f *op, hsize_t_f *start, hsize_t_f *count,
+ hsize_t_f *stride, hsize_t_f *block, hid_t_f *hyper_id);
+H5_FCDLL int_f h5scombine_select_c(hid_t_f *space1_id, int_f *op, hid_t_f *space2_id, hid_t_f *ds_id);
+H5_FCDLL int_f h5smodify_select_c(hid_t_f *space1_id, int_f *op, hid_t_f *space2_id);
+H5_FCDLL int_f h5sdecode_c(_fcd buf, hid_t_f *obj_id);
+H5_FCDLL int_f h5sencode_c(_fcd buf, hid_t_f *obj_id, size_t_f *nalloc, hid_t_f *fapl_id);
+H5_FCDLL int_f h5sextent_equal_c(hid_t_f *space1_id, hid_t_f *space2_id, hid_t_f *c_equal);
/*
* Functions from H5Df.c
*/
H5_FCDLL int_f h5dcreate_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *space_id,
- hid_t_f *lcpl_id, hid_t_f *dcpl_id, hid_t_f *dapl_id, hid_t_f *dset_id);
+ hid_t_f *lcpl_id, hid_t_f *dcpl_id, hid_t_f *dapl_id, hid_t_f *dset_id);
H5_FCDLL int_f h5dopen_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *dapl_id, hid_t_f *dset_id);
-H5_FCDLL int_f h5dclose_c( hid_t_f *dset_id );
+H5_FCDLL int_f h5dclose_c(hid_t_f *dset_id);
-H5_FCDLL int_f h5dwrite_vl_integer_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims, size_t_f *len);
-H5_FCDLL int_f h5dwrite_vl_real_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, real_f *buf, hsize_t_f *dims, size_t_f *len);
-H5_FCDLL int_f h5dwrite_vl_string_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims, size_t_f *len);
-H5_FCDLL int_f h5dwrite_ref_reg_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims);
-H5_FCDLL int_f h5dread_vl_integer_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims, size_t_f *len);
-H5_FCDLL int_f h5dread_vl_real_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, real_f *buf, hsize_t_f *dims, size_t_f *len);
-H5_FCDLL int_f h5dread_vl_string_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims, size_t_f *len);
-H5_FCDLL int_f h5dread_ref_reg_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f * buf, hsize_t_f *dims);
+H5_FCDLL int_f h5dwrite_vl_integer_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id,
+ hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims,
+ size_t_f *len);
+H5_FCDLL int_f h5dwrite_vl_real_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id,
+ hid_t_f *file_space_id, hid_t_f *xfer_prp, real_f *buf, hsize_t_f *dims,
+ size_t_f *len);
+H5_FCDLL int_f h5dwrite_vl_string_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id,
+ hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims,
+ size_t_f *len);
+H5_FCDLL int_f h5dwrite_ref_reg_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id,
+ hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims);
+H5_FCDLL int_f h5dread_vl_integer_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id,
+ hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims,
+ size_t_f *len);
+H5_FCDLL int_f h5dread_vl_real_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id,
+ hid_t_f *file_space_id, hid_t_f *xfer_prp, real_f *buf, hsize_t_f *dims,
+ size_t_f *len);
+H5_FCDLL int_f h5dread_vl_string_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id,
+ hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims,
+ size_t_f *len);
+H5_FCDLL int_f h5dread_ref_reg_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id,
+ hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims);
H5_FCDLL int_f h5dget_access_plist_c(hid_t_f *dset_id, hid_t_f *plist_id);
-H5_FCDLL int_f h5dget_space_c( hid_t_f *dset_id , hid_t_f *space_id);
-H5_FCDLL int_f h5dget_type_c( hid_t_f *dset_id , hid_t_f *type_id);
-H5_FCDLL int_f h5dget_create_plist_c( hid_t_f *dset_id , hid_t_f *plist_id);
-H5_FCDLL int_f h5dset_extent_c( hid_t_f *dset_id , hsize_t_f *dims);
+H5_FCDLL int_f h5dget_space_c(hid_t_f *dset_id, hid_t_f *space_id);
+H5_FCDLL int_f h5dget_type_c(hid_t_f *dset_id, hid_t_f *type_id);
+H5_FCDLL int_f h5dget_create_plist_c(hid_t_f *dset_id, hid_t_f *plist_id);
+H5_FCDLL int_f h5dset_extent_c(hid_t_f *dset_id, hsize_t_f *dims);
H5_FCDLL int_f h5dvlen_get_max_len_c(hid_t_f *dataset_id, hid_t_f *type_id, hid_t_f *space_id, size_t_f *len);
H5_FCDLL int_f h5dget_storage_size_c(hid_t_f *dataset_id, hsize_t_f *size);
-H5_FCDLL int_f h5dfill_c(void * fill_value, hid_t_f *fill_type_id, hid_t_f *space_id, void * buf, hid_t_f *mem_type_id);
-H5_FCDLL int_f h5dget_space_status_c( hid_t_f *dset_id, int_f *flag);
-H5_FCDLL int_f h5dcreate_anon_c(hid_t_f *loc_id, hid_t_f *type_id, hid_t_f *space_id,
- hid_t_f *dcpl_id, hid_t_f *dapl_id, hid_t_f *dset_id);
+H5_FCDLL int_f h5dfill_c(void *fill_value, hid_t_f *fill_type_id, hid_t_f *space_id, void *buf,
+ hid_t_f *mem_type_id);
+H5_FCDLL int_f h5dget_space_status_c(hid_t_f *dset_id, int_f *flag);
+H5_FCDLL int_f h5dcreate_anon_c(hid_t_f *loc_id, hid_t_f *type_id, hid_t_f *space_id, hid_t_f *dcpl_id,
+ hid_t_f *dapl_id, hid_t_f *dset_id);
H5_FCDLL int_f h5dwrite_f_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id,
- hid_t_f *file_space_id, hid_t_f *xfer_prp, void *buf);
-H5_FCDLL int_f h5dread_f_c( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_space_id,
- hid_t_f *file_space_id, hid_t_f *xfer_prp, void *buf);
-H5_FCDLL int_f h5dvlen_reclaim_c(hid_t_f *type_id , hid_t_f *space_id, hid_t_f *plist_id, void *buf);
+ hid_t_f *file_space_id, hid_t_f *xfer_prp, void *buf);
+H5_FCDLL int_f h5dread_f_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id,
+ hid_t_f *file_space_id, hid_t_f *xfer_prp, void *buf);
+H5_FCDLL int_f h5dvlen_reclaim_c(hid_t_f *type_id, hid_t_f *space_id, hid_t_f *plist_id, void *buf);
/*
* Functions from H5Gf.c
*/
-H5_FCDLL int_f h5gcreate_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size_hint, hid_t_f *grp_id,
- hid_t_f *lcpl_id, hid_t_f *gcpl_id, hid_t_f *gapl_id);
+H5_FCDLL int_f h5gcreate_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size_hint, hid_t_f *grp_id,
+ hid_t_f *lcpl_id, hid_t_f *gcpl_id, hid_t_f *gapl_id);
H5_FCDLL int_f h5gopen_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *gapl_id, hid_t_f *grp_id);
-H5_FCDLL int_f h5gclose_c( hid_t_f *grp_id );
-H5_FCDLL int_f h5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, _fcd obj_name, int_f *obj_namelen, int_f *obj_type);
+H5_FCDLL int_f h5gclose_c(hid_t_f *grp_id);
+H5_FCDLL int_f h5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, _fcd obj_name,
+ int_f *obj_namelen, int_f *obj_type);
H5_FCDLL int_f h5gn_members_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *nmembers);
-H5_FCDLL int_f h5glink_c(hid_t_f *loc_id, int_f *link_type, _fcd current_name, int_f *current_namelen, _fcd new_name, int_f *new_namelen);
-H5_FCDLL int_f h5glink2_c(hid_t_f *cur_loc_id, _fcd cur_name, int_f *cur_namelen, int_f *link_type, hid_t_f *new_loc_id, _fcd new_name, int_f *new_namelen);
+H5_FCDLL int_f h5glink_c(hid_t_f *loc_id, int_f *link_type, _fcd current_name, int_f *current_namelen,
+ _fcd new_name, int_f *new_namelen);
+H5_FCDLL int_f h5glink2_c(hid_t_f *cur_loc_id, _fcd cur_name, int_f *cur_namelen, int_f *link_type,
+ hid_t_f *new_loc_id, _fcd new_name, int_f *new_namelen);
H5_FCDLL int_f h5gunlink_c(hid_t_f *loc_id, _fcd name, int_f *namelen);
-H5_FCDLL int_f h5gmove_c(hid_t_f *loc_id, _fcd src_name, int_f *src_namelen, _fcd dst_name, int_f *dst_namelen);
-H5_FCDLL int_f h5gmove2_c(hid_t_f *src_loc_id, _fcd src_name, int_f *src_namelen, hid_t_f *dst_loc_id,_fcd dst_name, int_f *dst_namelen);
-H5_FCDLL int_f h5gget_linkval_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size, _fcd value );
+H5_FCDLL int_f h5gmove_c(hid_t_f *loc_id, _fcd src_name, int_f *src_namelen, _fcd dst_name,
+ int_f *dst_namelen);
+H5_FCDLL int_f h5gmove2_c(hid_t_f *src_loc_id, _fcd src_name, int_f *src_namelen, hid_t_f *dst_loc_id,
+ _fcd dst_name, int_f *dst_namelen);
+H5_FCDLL int_f h5gget_linkval_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size, _fcd value);
H5_FCDLL int_f h5gset_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, _fcd comment, int_f *commentlen);
H5_FCDLL int_f h5gget_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *bufsize, _fcd comment);
H5_FCDLL int_f h5gcreate_anon_c(hid_t_f *loc_id, hid_t_f *gcpl_id, hid_t_f *gapl_id, hid_t_f *grp_id);
-H5_FCDLL int_f h5gget_create_plist_c(hid_t_f *grp_id, hid_t_f *gcpl_id );
-H5_FCDLL int_f h5gget_info_c(hid_t_f *group_id, int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted);
+H5_FCDLL int_f h5gget_create_plist_c(hid_t_f *grp_id, hid_t_f *gcpl_id);
+H5_FCDLL int_f h5gget_info_c(hid_t_f *group_id, int_f *storage_type, int_f *nlinks, int_f *max_corder,
+ int_f *mounted);
H5_FCDLL int_f h5gget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
- int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *lapl_id,
- int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted);
-H5_FCDLL int_f h5gget_info_by_name_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, hid_t_f *lapl_id,
- int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted);
+ int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *lapl_id,
+ int_f *storage_type, int_f *nlinks, int_f *max_corder, int_f *mounted);
+H5_FCDLL int_f h5gget_info_by_name_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
+ hid_t_f *lapl_id, int_f *storage_type, int_f *nlinks, int_f *max_corder,
+ int_f *mounted);
/*
* Functions from H5Af.c
@@ -198,212 +225,228 @@ H5_FCDLL int_f h5gget_info_by_name_c(hid_t_f *loc_id, _fcd group_name, size_t_f
H5_FCDLL int_f h5awrite_f_c(hid_t_f *attr_id, hid_t_f *mem_type_id, void *buf);
H5_FCDLL int_f h5aread_f_c(hid_t_f *attr_id, hid_t_f *mem_type_id, void *buf);
-H5_FCDLL int_f h5acreate_c(hid_t_f *obj_id, _fcd name, size_t_f *namelen, hid_t_f *type_id,
- hid_t_f *space_id, hid_t_f *crt_prp, hid_t_f *aapl, hid_t_f *attr_id);
+H5_FCDLL int_f h5acreate_c(hid_t_f *obj_id, _fcd name, size_t_f *namelen, hid_t_f *type_id, hid_t_f *space_id,
+ hid_t_f *crt_prp, hid_t_f *aapl, hid_t_f *attr_id);
H5_FCDLL int_f h5adelete_c(hid_t_f *obj_id, _fcd name, size_t_f *namelen);
H5_FCDLL int_f h5aget_num_attrs_c(hid_t_f *obj_id, int_f *attr_num);
H5_FCDLL int_f h5aget_name_c(hid_t_f *attr_id, size_t_f *size, _fcd buf);
-H5_FCDLL int_f h5arename_by_name_c( hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
- _fcd old_attr_name, size_t_f *old_attr_namelen,
- _fcd new_attr_name, size_t_f *new_attr_namelen,
- hid_t_f *lapl_id );
-H5_FCDLL int_f h5aopen_c( hid_t_f *obj_id, _fcd attr_name, size_t_f *attr_namelen,
- hid_t_f *aapl_id, hid_t_f *attr_id);
-H5_FCDLL int_f h5adelete_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
- _fcd attr_name, size_t_f *attr_namelen, hid_t_f *lapl_id);
-H5_FCDLL int_f h5adelete_by_idx_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
- int_f *idx_type, int_f *order, hsize_t_f *n, hid_t_f *lapl_id);
-H5_FCDLL int_f h5aget_name_by_idx_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
- int_f *idx_type, int_f *order, hsize_t_f *n, _fcd name,
- size_t_f *size, hid_t_f *lapl_id);
-H5_FCDLL int_f h5aopen_by_idx_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
- int_f *idx_type, int_f *order, hsize_t_f *n, hid_t_f *aapl_id, hid_t_f *lapl_id, hid_t_f *attr_id);
-H5_FCDLL int_f h5aget_info_c(hid_t_f *loc_id, int_f *corder_valid, int_f *corder,
- int_f *cset, hsize_t_f *data_size );
-H5_FCDLL int_f h5aget_info_by_idx_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
- int_f *idx_type, int_f *order, hsize_t_f *n, hid_t_f *lapl_id,
- int_f *corder_valid, int_f *corder,
- int_f *cset, hsize_t_f *data_size );
-H5_FCDLL int_f h5aget_info_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
- _fcd attr_name, size_t_f *attr_namelen, hid_t_f *lapl_id,
- int_f *corder_valid, int_f *corder,
- int_f *cset, hsize_t_f *data_size );
-H5_FCDLL int_f h5acreate_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen,
- _fcd attr_name, size_t_f *attr_namelen, hid_t_f *type_id,
- hid_t_f *space_id, hid_t_f *acpl_id, hid_t_f *aapl_id,
- hid_t_f *lapl_id, hid_t_f *attr_id );
+H5_FCDLL int_f h5arename_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd old_attr_name,
+ size_t_f *old_attr_namelen, _fcd new_attr_name, size_t_f *new_attr_namelen,
+ hid_t_f *lapl_id);
+H5_FCDLL int_f h5aopen_c(hid_t_f *obj_id, _fcd attr_name, size_t_f *attr_namelen, hid_t_f *aapl_id,
+ hid_t_f *attr_id);
+H5_FCDLL int_f h5adelete_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd attr_name,
+ size_t_f *attr_namelen, hid_t_f *lapl_id);
+H5_FCDLL int_f h5adelete_by_idx_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, int_f *idx_type,
+ int_f *order, hsize_t_f *n, hid_t_f *lapl_id);
+H5_FCDLL int_f h5aget_name_by_idx_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, int_f *idx_type,
+ int_f *order, hsize_t_f *n, _fcd name, size_t_f *size, hid_t_f *lapl_id);
+H5_FCDLL int_f h5aopen_by_idx_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, int_f *idx_type,
+ int_f *order, hsize_t_f *n, hid_t_f *aapl_id, hid_t_f *lapl_id,
+ hid_t_f *attr_id);
+H5_FCDLL int_f h5aget_info_c(hid_t_f *loc_id, int_f *corder_valid, int_f *corder, int_f *cset,
+ hsize_t_f *data_size);
+H5_FCDLL int_f h5aget_info_by_idx_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, int_f *idx_type,
+ int_f *order, hsize_t_f *n, hid_t_f *lapl_id, int_f *corder_valid,
+ int_f *corder, int_f *cset, hsize_t_f *data_size);
+H5_FCDLL int_f h5aget_info_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd attr_name,
+ size_t_f *attr_namelen, hid_t_f *lapl_id, int_f *corder_valid,
+ int_f *corder, int_f *cset, hsize_t_f *data_size);
+H5_FCDLL int_f h5acreate_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd attr_name,
+ size_t_f *attr_namelen, hid_t_f *type_id, hid_t_f *space_id,
+ hid_t_f *acpl_id, hid_t_f *aapl_id, hid_t_f *lapl_id, hid_t_f *attr_id);
H5_FCDLL int_f h5aexists_c(hid_t_f *obj_id, _fcd name, size_t_f *namelen, hid_t_f *attr_exists);
-H5_FCDLL int_f h5aexists_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd attr_name, size_t_f *attr_namelen,
- hid_t_f *lapl_id, int_f *attr_exists);
-H5_FCDLL int_f h5aopen_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd attr_name, size_t_f *attr_namelen,
- hid_t_f *aapl_id, hid_t_f *lapl_id, hid_t_f *attr_id);
-H5_FCDLL int_f h5arename_c( hid_t_f *loc_id,
- _fcd old_attr_name, size_t_f *old_attr_namelen,
- _fcd new_attr_name, size_t_f *new_attr_namelen);
+H5_FCDLL int_f h5aexists_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd attr_name,
+ size_t_f *attr_namelen, hid_t_f *lapl_id, int_f *attr_exists);
+H5_FCDLL int_f h5aopen_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fcd attr_name,
+ size_t_f *attr_namelen, hid_t_f *aapl_id, hid_t_f *lapl_id,
+ hid_t_f *attr_id);
+H5_FCDLL int_f h5arename_c(hid_t_f *loc_id, _fcd old_attr_name, size_t_f *old_attr_namelen,
+ _fcd new_attr_name, size_t_f *new_attr_namelen);
/*
* Functions form H5Tf.c file
*/
H5_FCDLL int_f h5tcreate_c(int_f *cls, size_t_f *size, hid_t_f *type_id);
-H5_FCDLL int_f h5topen_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *tapl_id );
-H5_FCDLL int_f h5tcommit_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *lcpl_id, hid_t_f *tcpl_id, hid_t_f *tapl_id);
-H5_FCDLL int_f h5tclose_c( hid_t_f *type_id );
-H5_FCDLL int_f h5tequal_c( hid_t_f *type1_id , hid_t_f *type2_id, int_f *c_flag);
-H5_FCDLL int_f h5tcopy_c( hid_t_f *type_id , hid_t_f *new_type_id);
-H5_FCDLL int_f h5tget_class_c( hid_t_f *type_id , int_f *classtype);
-H5_FCDLL int_f h5tget_order_c( hid_t_f *type_id , int_f *order);
-H5_FCDLL int_f h5tset_order_c( hid_t_f *type_id , int_f *order);
-H5_FCDLL int_f h5tget_size_c( hid_t_f *type_id , size_t_f *size);
-H5_FCDLL int_f h5tset_size_c( hid_t_f *type_id , size_t_f *size);
+H5_FCDLL int_f h5topen_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *tapl_id);
+H5_FCDLL int_f h5tcommit_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *lcpl_id,
+ hid_t_f *tcpl_id, hid_t_f *tapl_id);
+H5_FCDLL int_f h5tclose_c(hid_t_f *type_id);
+H5_FCDLL int_f h5tequal_c(hid_t_f *type1_id, hid_t_f *type2_id, int_f *c_flag);
+H5_FCDLL int_f h5tcopy_c(hid_t_f *type_id, hid_t_f *new_type_id);
+H5_FCDLL int_f h5tget_class_c(hid_t_f *type_id, int_f *classtype);
+H5_FCDLL int_f h5tget_order_c(hid_t_f *type_id, int_f *order);
+H5_FCDLL int_f h5tset_order_c(hid_t_f *type_id, int_f *order);
+H5_FCDLL int_f h5tget_size_c(hid_t_f *type_id, size_t_f *size);
+H5_FCDLL int_f h5tset_size_c(hid_t_f *type_id, size_t_f *size);
H5_FCDLL int_f h5tcommitted_c(hid_t_f *dtype_id);
-H5_FCDLL int_f h5tget_precision_c( hid_t_f *type_id , size_t_f *precision);
-H5_FCDLL int_f h5tset_precision_c( hid_t_f *type_id , size_t_f *precision);
-H5_FCDLL int_f h5tget_offset_c( hid_t_f *type_id , size_t_f *offset);
-H5_FCDLL int_f h5tset_offset_c( hid_t_f *type_id , size_t_f *offset);
-H5_FCDLL int_f h5tget_pad_c( hid_t_f *type_id , int_f * lsbpad, int_f * msbpad);
-H5_FCDLL int_f h5tset_pad_c( hid_t_f *type_id, int_f * lsbpad, int_f * msbpad );
-H5_FCDLL int_f h5tget_sign_c( hid_t_f *type_id , int_f* sign);
-H5_FCDLL int_f h5tset_sign_c( hid_t_f *type_id , int_f *sign);
-H5_FCDLL int_f h5tget_fields_c( hid_t_f *type_id, size_t_f *spos, size_t_f *epos, size_t_f* esize, size_t_f* mpos, size_t_f* msize);
-H5_FCDLL int_f h5tset_fields_c( hid_t_f *type_id, size_t_f *spos, size_t_f *epos, size_t_f* esize, size_t_f* mpos, size_t_f* msize);
-H5_FCDLL int_f h5tget_ebias_c( hid_t_f *type_id , size_t_f *ebias);
-H5_FCDLL int_f h5tset_ebias_c( hid_t_f *type_id , size_t_f *ebias);
-H5_FCDLL int_f h5tget_norm_c( hid_t_f *type_id , int_f *norm);
-H5_FCDLL int_f h5tset_norm_c( hid_t_f *type_id , int_f *norm);
-H5_FCDLL int_f h5tget_inpad_c( hid_t_f *type_id, int_f * padtype);
-H5_FCDLL int_f h5tset_inpad_c( hid_t_f *type_id, int_f * padtype);
-H5_FCDLL int_f h5tget_cset_c( hid_t_f *type_id, int_f * cset);
-H5_FCDLL int_f h5tset_cset_c( hid_t_f *type_id, int_f * cset);
-H5_FCDLL int_f h5tget_strpad_c( hid_t_f *type_id, int_f * strpad);
-H5_FCDLL int_f h5tset_strpad_c( hid_t_f *type_id, int_f * strpad);
-H5_FCDLL int_f h5tget_nmembers_c( hid_t_f *type_id , int_f * num_members);
-H5_FCDLL int_f h5tget_member_name_c( hid_t_f *type_id ,int_f* idx, _fcd member_name, int_f *namelen);
-H5_FCDLL int_f h5tget_member_dims_c( hid_t_f *type_id ,int_f* field_idx, int_f * dims, size_t_f * field_dims, int_f * perm );
-H5_FCDLL int_f h5tget_member_offset_c( hid_t_f *type_id ,int_f* member_no, size_t_f* offset);
-H5_FCDLL int_f h5tget_member_type_c( hid_t_f *type_id ,int_f* field_idx, hid_t_f * datatype);
-H5_FCDLL int_f h5tget_member_index_c( hid_t_f *type_id ,_fcd name, int_f* namelen, int_f *idx);
-H5_FCDLL int_f h5tinsert_c(hid_t_f *type_id, _fcd name, int_f* namelen, size_t_f *offset, hid_t_f * field_id);
-H5_FCDLL int_f h5tpack_c(hid_t_f * type_id);
-H5_FCDLL int_f h5tinsert_array_c(hid_t_f * parent_id, _fcd name, int_f* namelen, size_t_f* offset, int_f* ndims, size_t_f* dims, hid_t_f* member_id, int_f* perm );
-H5_FCDLL int_f h5tinsert_array_c2(hid_t_f * parent_id, _fcd name, int_f* namelen, size_t_f* offset, int_f* ndims, size_t_f* dims, hid_t_f* member_id);
-H5_FCDLL int_f h5tenum_create_c( hid_t_f *parent_id , hid_t_f *new_type_id);
-H5_FCDLL int_f h5tenum_insert_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value);
-H5_FCDLL int_f h5tenum_insert_ptr_c(hid_t_f *type_id, _fcd name, int_f* namelen, void *value);
-H5_FCDLL int_f h5tenum_nameof_c(hid_t_f *type_id, int_f* value, _fcd name, size_t_f* namelen);
-H5_FCDLL int_f h5tenum_valueof_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value);
-H5_FCDLL int_f h5tget_member_value_c(hid_t_f *type_id, int_f* member_no, int_f* value);
-H5_FCDLL int_f h5tset_tag_c(hid_t_f* type_id, _fcd tag, int_f* namelen);
-H5_FCDLL int_f h5tget_tag_c(hid_t_f* type_id, _fcd tag, size_t_f* tag_size, int_f* namelen);
-H5_FCDLL int_f h5tarray_create_c(hid_t_f * base_id, int_f *rank, hsize_t_f* dims, hid_t_f* type_id);
-H5_FCDLL int_f h5tget_array_dims_c( hid_t_f *type_id , hsize_t_f * dims);
-H5_FCDLL int_f h5tget_array_ndims_c( hid_t_f *type_id , int_f * ndims);
-H5_FCDLL int_f h5tget_super_c( hid_t_f *type_id , hid_t_f *base_type_id);
-H5_FCDLL int_f h5tvlen_create_c( hid_t_f *type_id , hid_t_f *vltype_id);
-H5_FCDLL int_f h5tis_variable_str_c( hid_t_f *type_id , int_f *flag );
-H5_FCDLL int_f h5tget_member_class_c( hid_t_f *type_id , int_f *member_no, int_f *cls );
+H5_FCDLL int_f h5tget_precision_c(hid_t_f *type_id, size_t_f *precision);
+H5_FCDLL int_f h5tset_precision_c(hid_t_f *type_id, size_t_f *precision);
+H5_FCDLL int_f h5tget_offset_c(hid_t_f *type_id, size_t_f *offset);
+H5_FCDLL int_f h5tset_offset_c(hid_t_f *type_id, size_t_f *offset);
+H5_FCDLL int_f h5tget_pad_c(hid_t_f *type_id, int_f *lsbpad, int_f *msbpad);
+H5_FCDLL int_f h5tset_pad_c(hid_t_f *type_id, int_f *lsbpad, int_f *msbpad);
+H5_FCDLL int_f h5tget_sign_c(hid_t_f *type_id, int_f *sign);
+H5_FCDLL int_f h5tset_sign_c(hid_t_f *type_id, int_f *sign);
+H5_FCDLL int_f h5tget_fields_c(hid_t_f *type_id, size_t_f *spos, size_t_f *epos, size_t_f *esize,
+ size_t_f *mpos, size_t_f *msize);
+H5_FCDLL int_f h5tset_fields_c(hid_t_f *type_id, size_t_f *spos, size_t_f *epos, size_t_f *esize,
+ size_t_f *mpos, size_t_f *msize);
+H5_FCDLL int_f h5tget_ebias_c(hid_t_f *type_id, size_t_f *ebias);
+H5_FCDLL int_f h5tset_ebias_c(hid_t_f *type_id, size_t_f *ebias);
+H5_FCDLL int_f h5tget_norm_c(hid_t_f *type_id, int_f *norm);
+H5_FCDLL int_f h5tset_norm_c(hid_t_f *type_id, int_f *norm);
+H5_FCDLL int_f h5tget_inpad_c(hid_t_f *type_id, int_f *padtype);
+H5_FCDLL int_f h5tset_inpad_c(hid_t_f *type_id, int_f *padtype);
+H5_FCDLL int_f h5tget_cset_c(hid_t_f *type_id, int_f *cset);
+H5_FCDLL int_f h5tset_cset_c(hid_t_f *type_id, int_f *cset);
+H5_FCDLL int_f h5tget_strpad_c(hid_t_f *type_id, int_f *strpad);
+H5_FCDLL int_f h5tset_strpad_c(hid_t_f *type_id, int_f *strpad);
+H5_FCDLL int_f h5tget_nmembers_c(hid_t_f *type_id, int_f *num_members);
+H5_FCDLL int_f h5tget_member_name_c(hid_t_f *type_id, int_f *idx, _fcd member_name, int_f *namelen);
+H5_FCDLL int_f h5tget_member_dims_c(hid_t_f *type_id, int_f *field_idx, int_f *dims, size_t_f *field_dims,
+ int_f *perm);
+H5_FCDLL int_f h5tget_member_offset_c(hid_t_f *type_id, int_f *member_no, size_t_f *offset);
+H5_FCDLL int_f h5tget_member_type_c(hid_t_f *type_id, int_f *field_idx, hid_t_f *datatype);
+H5_FCDLL int_f h5tget_member_index_c(hid_t_f *type_id, _fcd name, int_f *namelen, int_f *idx);
+H5_FCDLL int_f h5tinsert_c(hid_t_f *type_id, _fcd name, int_f *namelen, size_t_f *offset, hid_t_f *field_id);
+H5_FCDLL int_f h5tpack_c(hid_t_f *type_id);
+H5_FCDLL int_f h5tinsert_array_c(hid_t_f *parent_id, _fcd name, int_f *namelen, size_t_f *offset,
+ int_f *ndims, size_t_f *dims, hid_t_f *member_id, int_f *perm);
+H5_FCDLL int_f h5tinsert_array_c2(hid_t_f *parent_id, _fcd name, int_f *namelen, size_t_f *offset,
+ int_f *ndims, size_t_f *dims, hid_t_f *member_id);
+H5_FCDLL int_f h5tenum_create_c(hid_t_f *parent_id, hid_t_f *new_type_id);
+H5_FCDLL int_f h5tenum_insert_c(hid_t_f *type_id, _fcd name, int_f *namelen, int_f *value);
+H5_FCDLL int_f h5tenum_insert_ptr_c(hid_t_f *type_id, _fcd name, int_f *namelen, void *value);
+H5_FCDLL int_f h5tenum_nameof_c(hid_t_f *type_id, int_f *value, _fcd name, size_t_f *namelen);
+H5_FCDLL int_f h5tenum_valueof_c(hid_t_f *type_id, _fcd name, int_f *namelen, int_f *value);
+H5_FCDLL int_f h5tget_member_value_c(hid_t_f *type_id, int_f *member_no, int_f *value);
+H5_FCDLL int_f h5tset_tag_c(hid_t_f *type_id, _fcd tag, int_f *namelen);
+H5_FCDLL int_f h5tget_tag_c(hid_t_f *type_id, _fcd tag, size_t_f *tag_size, int_f *namelen);
+H5_FCDLL int_f h5tarray_create_c(hid_t_f *base_id, int_f *rank, hsize_t_f *dims, hid_t_f *type_id);
+H5_FCDLL int_f h5tget_array_dims_c(hid_t_f *type_id, hsize_t_f *dims);
+H5_FCDLL int_f h5tget_array_ndims_c(hid_t_f *type_id, int_f *ndims);
+H5_FCDLL int_f h5tget_super_c(hid_t_f *type_id, hid_t_f *base_type_id);
+H5_FCDLL int_f h5tvlen_create_c(hid_t_f *type_id, hid_t_f *vltype_id);
+H5_FCDLL int_f h5tis_variable_str_c(hid_t_f *type_id, int_f *flag);
+H5_FCDLL int_f h5tget_member_class_c(hid_t_f *type_id, int_f *member_no, int_f *cls);
H5_FCDLL int_f h5tcommit_anon_c(hid_t_f *loc_id, hid_t_f *dtype_id, hid_t_f *tcpl_id, hid_t_f *tapl_id);
-H5_FCDLL int_f h5tdecode_c( _fcd buf, hid_t_f *obj_id );
-H5_FCDLL int_f h5tencode_c(_fcd buf, hid_t_f *obj_id, size_t_f *nalloc );
-H5_FCDLL int_f h5tget_create_plist_c( hid_t_f *dtype_id, hid_t_f *dtpl_id);
-H5_FCDLL int_f h5tcompiler_conv_c( hid_t_f *src_id, hid_t_f *dst_id, int_f *c_flag);
+H5_FCDLL int_f h5tdecode_c(_fcd buf, hid_t_f *obj_id);
+H5_FCDLL int_f h5tencode_c(_fcd buf, hid_t_f *obj_id, size_t_f *nalloc);
+H5_FCDLL int_f h5tget_create_plist_c(hid_t_f *dtype_id, hid_t_f *dtpl_id);
+H5_FCDLL int_f h5tcompiler_conv_c(hid_t_f *src_id, hid_t_f *dst_id, int_f *c_flag);
H5_FCDLL int_f h5tget_native_type_c(hid_t_f *dtype_id, int_f *direction, hid_t_f *native_dtype_id);
-H5_FCDLL int_f h5tconvert_c(hid_t_f *src_id, hid_t_f *dst_id, size_t_f *nelmts, void *buf, void *background, hid_t_f *plist_id);
+H5_FCDLL int_f h5tconvert_c(hid_t_f *src_id, hid_t_f *dst_id, size_t_f *nelmts, void *buf, void *background,
+ hid_t_f *plist_id);
/*
* Functions from H5Of.c
*/
H5_FCDLL int_f h5oopen_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, hid_t_f *obj_id);
-H5_FCDLL int_f h5oclose_c(hid_t_f *object_id );
+H5_FCDLL int_f h5oclose_c(hid_t_f *object_id);
H5_FCDLL int_f h5oopen_by_token_c(hid_t_f *loc_id, H5O_token_t *token, hid_t_f *obj_id);
H5_FCDLL int_f h5olink_c(hid_t_f *object_id, hid_t_f *new_loc_id, _fcd name, size_t_f *namelen,
- hid_t_f *lcpl_id, hid_t_f *lapl_id);
-H5_FCDLL int_f h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate2_t op, void *op_data, int_f *fields);
-H5_FCDLL int_f h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order,
- H5O_iterate2_t op, void *op_data, hid_t_f *lapl_id, int_f *fields );
+ hid_t_f *lcpl_id, hid_t_f *lapl_id);
+H5_FCDLL int_f h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate2_t op,
+ void *op_data, int_f *fields);
+H5_FCDLL int_f h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type,
+ int_f *order, H5O_iterate2_t op, void *op_data, hid_t_f *lapl_id,
+ int_f *fields);
H5_FCDLL int_f h5oget_info_c(hid_t_f *object_id, H5O_info_t_f *object_info, int_f *fields);
-H5_FCDLL int_f h5oget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *namelen,
- int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info, int_f *fields);
+H5_FCDLL int_f h5oget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, int_f *index_field,
+ int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info,
+ int_f *fields);
H5_FCDLL int_f h5oget_info_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id,
- H5O_info_t_f *object_info, int_f *fields);
-H5_FCDLL int_f h5ocopy_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len,
- hid_t_f *dst_loc_id, _fcd dst_name, size_t_f *dst_name_len,
- hid_t_f *ocpypl_id, hid_t_f *lcpl_id );
+ H5O_info_t_f *object_info, int_f *fields);
+H5_FCDLL int_f h5ocopy_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, hid_t_f *dst_loc_id,
+ _fcd dst_name, size_t_f *dst_name_len, hid_t_f *ocpypl_id, hid_t_f *lcpl_id);
H5_FCDLL int_f h5odecr_refcount_c(hid_t_f *object_id);
H5_FCDLL int_f h5oincr_refcount_c(hid_t_f *object_id);
H5_FCDLL int_f h5oexists_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id);
H5_FCDLL int_f h5oset_comment_c(hid_t_f *object_id, _fcd comment, size_t_f *commentlen);
-H5_FCDLL int_f h5oset_comment_by_name_c(hid_t_f *object_id, _fcd name, size_t_f *namelen, _fcd comment, size_t_f *commentlen, hid_t_f *lapl_id);
-H5_FCDLL int_f h5oopen_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
- int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id);
+H5_FCDLL int_f h5oset_comment_by_name_c(hid_t_f *object_id, _fcd name, size_t_f *namelen, _fcd comment,
+ size_t_f *commentlen, hid_t_f *lapl_id);
+H5_FCDLL int_f h5oopen_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, int_f *index_type,
+ int_f *order, hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id);
H5_FCDLL int_f h5oget_comment_c(hid_t_f *object_id, _fcd comment, size_t_f *commentsize, hssize_t_f *bufsize);
-H5_FCDLL int_f h5oget_comment_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *name_size,
- _fcd comment, size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id);
-H5_FCDLL int_f h5otoken_cmp_c(hid_t_f *loc_id, H5O_token_t *token1,
- H5O_token_t *token2, int_f *cmp_value);
+H5_FCDLL int_f h5oget_comment_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *name_size, _fcd comment,
+ size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id);
+H5_FCDLL int_f h5otoken_cmp_c(hid_t_f *loc_id, H5O_token_t *token1, H5O_token_t *token2, int_f *cmp_value);
/*
* Functions from H5Pf.c
*/
-H5_FCDLL int_f h5pcreate_c( hid_t_f *cls, hid_t_f *prp_id );
-H5_FCDLL int_f h5pclose_c( hid_t_f *prp_id );
-H5_FCDLL int_f h5pcopy_c( hid_t_f *prp_id , hid_t_f *new_prp_id);
-H5_FCDLL int_f h5pequal_c( hid_t_f *plist1_id , hid_t_f *plist2_id, int_f *c_flag);
-H5_FCDLL int_f h5pget_class_c( hid_t_f *prp_id , hid_t_f *classtype);
-H5_FCDLL int_f h5pset_deflate_c( hid_t_f *prp_id , int_f *level);
-H5_FCDLL int_f h5pset_chunk_c( hid_t_f *prp_id, int_f *rank, hsize_t_f *dims );
-H5_FCDLL int_f h5pget_chunk_c( hid_t_f *prp_id, int_f *max_rank, hsize_t_f *dims );
+H5_FCDLL int_f h5pcreate_c(hid_t_f *cls, hid_t_f *prp_id);
+H5_FCDLL int_f h5pclose_c(hid_t_f *prp_id);
+H5_FCDLL int_f h5pcopy_c(hid_t_f *prp_id, hid_t_f *new_prp_id);
+H5_FCDLL int_f h5pequal_c(hid_t_f *plist1_id, hid_t_f *plist2_id, int_f *c_flag);
+H5_FCDLL int_f h5pget_class_c(hid_t_f *prp_id, hid_t_f *classtype);
+H5_FCDLL int_f h5pset_deflate_c(hid_t_f *prp_id, int_f *level);
+H5_FCDLL int_f h5pset_chunk_c(hid_t_f *prp_id, int_f *rank, hsize_t_f *dims);
+H5_FCDLL int_f h5pget_chunk_c(hid_t_f *prp_id, int_f *max_rank, hsize_t_f *dims);
H5_FCDLL int_f h5pset_file_image_c(hid_t_f *fapl_id, void *buf_ptr, size_t_f *buf_len);
H5_FCDLL int_f h5pset_fill_value_c(hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue);
H5_FCDLL int_f h5pget_file_image_c(hid_t_f *fapl_id, void **buf_ptr, size_t_f *buf_len);
H5_FCDLL int_f h5pget_fill_value_c(hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue);
-H5_FCDLL int_f h5pset_preserve_c( hid_t_f *prp_id , int_f *flag);
-H5_FCDLL int_f h5pget_preserve_c( hid_t_f *prp_id , int_f *flag);
-H5_FCDLL int_f h5pget_version_c(hid_t_f *prp_id, int_f * boot,int_f * freelist, int_f * stab, int_f *shhdr);
-H5_FCDLL int_f h5pset_userblock_c(hid_t_f *prp_id, hsize_t_f * size);
-H5_FCDLL int_f h5pget_userblock_c(hid_t_f *prp_id, hsize_t_f * size);
-H5_FCDLL int_f h5pget_sizes_c(hid_t_f *prp_id, size_t_f * sizeof_addr, size_t_f * sizeof_size);
-H5_FCDLL int_f h5pset_sizes_c(hid_t_f *prp_id, size_t_f * sizeof_addr, size_t_f * sizeof_size);
-H5_FCDLL int_f h5pset_sym_k_c(hid_t_f *prp_id, int_f* ik, int_f* lk);
-H5_FCDLL int_f h5pget_sym_k_c(hid_t_f *prp_id, int_f* ik, int_f* lk);
-H5_FCDLL int_f h5pset_istore_k_c(hid_t_f *prp_id, int_f* ik);
-H5_FCDLL int_f h5pget_istore_k_c(hid_t_f *prp_id, int_f* ik);
-H5_FCDLL int_f h5pget_driver_c(hid_t_f *prp_id, hid_t_f*driver);
+H5_FCDLL int_f h5pset_preserve_c(hid_t_f *prp_id, int_f *flag);
+H5_FCDLL int_f h5pget_preserve_c(hid_t_f *prp_id, int_f *flag);
+H5_FCDLL int_f h5pget_version_c(hid_t_f *prp_id, int_f *boot, int_f *freelist, int_f *stab, int_f *shhdr);
+H5_FCDLL int_f h5pset_userblock_c(hid_t_f *prp_id, hsize_t_f *size);
+H5_FCDLL int_f h5pget_userblock_c(hid_t_f *prp_id, hsize_t_f *size);
+H5_FCDLL int_f h5pget_sizes_c(hid_t_f *prp_id, size_t_f *sizeof_addr, size_t_f *sizeof_size);
+H5_FCDLL int_f h5pset_sizes_c(hid_t_f *prp_id, size_t_f *sizeof_addr, size_t_f *sizeof_size);
+H5_FCDLL int_f h5pset_sym_k_c(hid_t_f *prp_id, int_f *ik, int_f *lk);
+H5_FCDLL int_f h5pget_sym_k_c(hid_t_f *prp_id, int_f *ik, int_f *lk);
+H5_FCDLL int_f h5pset_istore_k_c(hid_t_f *prp_id, int_f *ik);
+H5_FCDLL int_f h5pget_istore_k_c(hid_t_f *prp_id, int_f *ik);
+H5_FCDLL int_f h5pget_driver_c(hid_t_f *prp_id, hid_t_f *driver);
H5_FCDLL int_f h5pset_fapl_stdio_c(hid_t_f *prp_id);
#ifdef NO_SUCH_F90_FUNCTION
-H5_FCDLL int_f h5pget_fapl_stdio_c(hid_t_f *prp_id, int_f* io);
+H5_FCDLL int_f h5pget_fapl_stdio_c(hid_t_f *prp_id, int_f *io);
#endif
H5_FCDLL int_f h5pset_fapl_sec2_c(hid_t_f *prp_id);
#ifdef NO_SUCH_F90_FUNCTION
-H5_FCDLL int_f h5pget_fapl_sec2_c(hid_t_f *prp_id, int_f* sec2);
+H5_FCDLL int_f h5pget_fapl_sec2_c(hid_t_f *prp_id, int_f *sec2);
#endif
-H5_FCDLL int_f h5pset_alignment_c(hid_t_f *prp_id, hsize_t_f* threshold, hsize_t_f* alignment);
-H5_FCDLL int_f h5pget_alignment_c(hid_t_f *prp_id, hsize_t_f* threshold, hsize_t_f* alignment);
-H5_FCDLL int_f h5pget_fapl_core_c(hid_t_f *prp_id, size_t_f* increment, int_f *flag);
-H5_FCDLL int_f h5pset_fapl_core_c(hid_t_f *prp_id, size_t_f* increment, int_f *flag);
-H5_FCDLL int_f h5pset_fapl_family_c(hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plist );
-H5_FCDLL int_f h5pget_fapl_family_c(hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plist );
-H5_FCDLL int_f h5pset_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, size_t_f* rdcc_nelmts, size_t_f* rdcc_nbytes, real_f* rdcc_w0);
-H5_FCDLL int_f h5pget_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, size_t_f* rdcc_nelmts, size_t_f* rdcc_nbytes, real_f* rdcc_w0);
+H5_FCDLL int_f h5pset_alignment_c(hid_t_f *prp_id, hsize_t_f *threshold, hsize_t_f *alignment);
+H5_FCDLL int_f h5pget_alignment_c(hid_t_f *prp_id, hsize_t_f *threshold, hsize_t_f *alignment);
+H5_FCDLL int_f h5pget_fapl_core_c(hid_t_f *prp_id, size_t_f *increment, int_f *flag);
+H5_FCDLL int_f h5pset_fapl_core_c(hid_t_f *prp_id, size_t_f *increment, int_f *flag);
+H5_FCDLL int_f h5pset_fapl_family_c(hid_t_f *prp_id, hsize_t_f *memb_size, hid_t_f *memb_plist);
+H5_FCDLL int_f h5pget_fapl_family_c(hid_t_f *prp_id, hsize_t_f *memb_size, hid_t_f *memb_plist);
+H5_FCDLL int_f h5pset_cache_c(hid_t_f *prp_id, int_f *mdc_nelmts, size_t_f *rdcc_nelmts,
+ size_t_f *rdcc_nbytes, real_f *rdcc_w0);
+H5_FCDLL int_f h5pget_cache_c(hid_t_f *prp_id, int_f *mdc_nelmts, size_t_f *rdcc_nelmts,
+ size_t_f *rdcc_nbytes, real_f *rdcc_w0);
#ifdef NO_SUCH_F90_FUNCTION
-H5_FCDLL int_f h5pget_fapl_split_c(hid_t_f *prp_id, size_t_f* meta_ext_size , _fcd meta_ext, hid_t_f* meta_plist, size_t_f* raw_ext_size, _fcd raw_ext, hid_t_f * raw_plist);
+H5_FCDLL int_f h5pget_fapl_split_c(hid_t_f *prp_id, size_t_f *meta_ext_size, _fcd meta_ext,
+ hid_t_f *meta_plist, size_t_f *raw_ext_size, _fcd raw_ext,
+ hid_t_f *raw_plist);
#endif
-H5_FCDLL int_f h5pset_fapl_split_c(hid_t_f *prp_id, int_f* meta_len, _fcd meta_ext, hid_t_f* meta_plist, int_f* raw_len, _fcd raw_ext, hid_t_f * raw_plist);
-H5_FCDLL int_f h5pset_gc_references_c(hid_t_f *prp_id, int_f* gc_references);
-H5_FCDLL int_f h5pget_gc_references_c(hid_t_f *prp_id, int_f* gc_references);
-H5_FCDLL int_f h5pset_layout_c(hid_t_f *prp_id, int_f* layout);
-H5_FCDLL int_f h5pget_layout_c(hid_t_f *prp_id, int_f* layout);
-H5_FCDLL int_f h5pset_filter_c(hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values );
-H5_FCDLL int_f h5premove_filter_c(hid_t_f *prp_id, int_f* filter);
-H5_FCDLL int_f h5pmodify_filter_c(hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values );
-H5_FCDLL int_f h5pget_nfilters_c(hid_t_f *prp_id, int_f* nfilters);
-H5_FCDLL int_f h5pget_filter_c(hid_t_f *prp_id, int_f* filter_number, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name, int_f* filter_id);
-H5_FCDLL int_f h5pget_filter_by_id_c(hid_t_f *prp_id, int_f* filter_id, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name);
-H5_FCDLL int_f h5pset_external_c(hid_t_f *prp_id, _fcd name, int_f* namelen, off_t_f* offset, hsize_t_f*bytes);
-H5_FCDLL int_f h5pget_external_count_c(hid_t_f *prp_id, int_f* count);
-H5_FCDLL int_f h5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, off_t_f* offset, hsize_t_f*bytes);
-H5_FCDLL int_f h5pget_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* right);
-H5_FCDLL int_f h5pset_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* right);
+H5_FCDLL int_f h5pset_fapl_split_c(hid_t_f *prp_id, int_f *meta_len, _fcd meta_ext, hid_t_f *meta_plist,
+ int_f *raw_len, _fcd raw_ext, hid_t_f *raw_plist);
+H5_FCDLL int_f h5pset_gc_references_c(hid_t_f *prp_id, int_f *gc_references);
+H5_FCDLL int_f h5pget_gc_references_c(hid_t_f *prp_id, int_f *gc_references);
+H5_FCDLL int_f h5pset_layout_c(hid_t_f *prp_id, int_f *layout);
+H5_FCDLL int_f h5pget_layout_c(hid_t_f *prp_id, int_f *layout);
+H5_FCDLL int_f h5pset_filter_c(hid_t_f *prp_id, int_f *filter, int_f *flags, size_t_f *cd_nelmts,
+ int_f *cd_values);
+H5_FCDLL int_f h5premove_filter_c(hid_t_f *prp_id, int_f *filter);
+H5_FCDLL int_f h5pmodify_filter_c(hid_t_f *prp_id, int_f *filter, int_f *flags, size_t_f *cd_nelmts,
+ int_f *cd_values);
+H5_FCDLL int_f h5pget_nfilters_c(hid_t_f *prp_id, int_f *nfilters);
+H5_FCDLL int_f h5pget_filter_c(hid_t_f *prp_id, int_f *filter_number, int_f *flags, size_t_f *cd_nelmts,
+ int_f *cd_values, size_t_f *namelen, _fcd name, int_f *filter_id);
+H5_FCDLL int_f h5pget_filter_by_id_c(hid_t_f *prp_id, int_f *filter_id, int_f *flags, size_t_f *cd_nelmts,
+ int_f *cd_values, size_t_f *namelen, _fcd name);
+H5_FCDLL int_f h5pset_external_c(hid_t_f *prp_id, _fcd name, int_f *namelen, off_t_f *offset,
+ hsize_t_f *bytes);
+H5_FCDLL int_f h5pget_external_count_c(hid_t_f *prp_id, int_f *count);
+H5_FCDLL int_f h5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f *name_size, _fcd name, off_t_f *offset,
+ hsize_t_f *bytes);
+H5_FCDLL int_f h5pget_btree_ratios_c(hid_t_f *prp_id, real_f *left, real_f *middle, real_f *right);
+H5_FCDLL int_f h5pset_btree_ratios_c(hid_t_f *prp_id, real_f *left, real_f *middle, real_f *right);
H5_FCDLL int_f h5pset_fclose_degree_c(hid_t_f *fapl, int_f *degree);
H5_FCDLL int_f h5pget_fclose_degree_c(hid_t_f *fapl, int_f *degree);
H5_FCDLL int_f h5pget_buffer_c(hid_t_f *plist, hsize_t_f *size);
@@ -421,11 +464,10 @@ H5_FCDLL int_f h5pget_small_data_block_size_c(hid_t_f *plist, hsize_t_f *size);
H5_FCDLL int_f h5pset_hyper_vector_size_c(hid_t_f *plist, size_t_f *size);
H5_FCDLL int_f h5pget_hyper_vector_size_c(hid_t_f *plist, size_t_f *size);
H5_FCDLL int_f h5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *cls,
- H5P_cls_create_func_t create, void *create_data,
- H5P_cls_copy_func_t copy, void *copy_data,
- H5P_cls_close_func_t close, void *close_data);
-H5_FCDLL int_f h5pregister_c(hid_t_f *cls, _fcd name, int_f * name_len, size_t_f *size, void *value);
-H5_FCDLL int_f h5pinsert_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, void *value);
+ H5P_cls_create_func_t create, void *create_data, H5P_cls_copy_func_t copy,
+ void *copy_data, H5P_cls_close_func_t close, void *close_data);
+H5_FCDLL int_f h5pregister_c(hid_t_f *cls, _fcd name, int_f *name_len, size_t_f *size, void *value);
+H5_FCDLL int_f h5pinsert_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, void *value);
H5_FCDLL int_f h5pset_c(hid_t_f *prp_id, _fcd name, int_f *name_len, void *value);
H5_FCDLL int_f h5pget_c(hid_t_f *prp_id, _fcd name, int_f *name_len, void *value);
H5_FCDLL int_f h5pexist_c(hid_t_f *prp_id, _fcd name, int_f *name_len);
@@ -436,26 +478,30 @@ H5_FCDLL int_f h5pisa_class_c(hid_t_f *plist, hid_t_f *pclass);
H5_FCDLL int_f h5pcopy_prop_c(hid_t_f *dst_id, hid_t_f *src_id, _fcd name, int_f *name_len);
H5_FCDLL int_f h5premove_c(hid_t_f *plid, _fcd name, int_f *name_len);
H5_FCDLL int_f h5punregister_c(hid_t_f *cls, _fcd name, int_f *name_len);
-H5_FCDLL int_f h5pclose_class_c(hid_t_f * cls);
+H5_FCDLL int_f h5pclose_class_c(hid_t_f *cls);
H5_FCDLL int_f h5pget_class_name_c(hid_t_f *prp_id, _fcd name, int_f *name_len);
-H5_FCDLL int_f h5pset_shuffle_c( hid_t_f *prp_id);
-H5_FCDLL int_f h5pset_fletcher32_c( hid_t_f *prp_id );
-H5_FCDLL int_f h5pset_edc_check_c( hid_t_f *prp_id, int_f *flag );
-H5_FCDLL int_f h5pget_edc_check_c( hid_t_f *prp_id, int_f *flag );
-H5_FCDLL int_f h5pset_family_offset_c( hid_t_f *prp_id , hsize_t_f *offset);
-H5_FCDLL int_f h5pget_fapl_multi_c( hid_t_f *prp_id , int_f *mem_map, hid_t_f *memb_fapl, _fcd memb_name, int_f *len, int_f *lenmax, real_f *memb_addr, int_f *flag, int_f *maxlen_out);
-H5_FCDLL int_f h5pset_fapl_multi_c( hid_t_f *prp_id , int_f *mem_map, hid_t_f *memb_fapl, _fcd memb_name, int_f *len, int_f *lenmax, real_f *memb_addr, int_f *flag);
-H5_FCDLL int_f h5pset_fapl_multi_sc ( hid_t_f *prp_id , int_f *flag);
-H5_FCDLL int_f h5pset_szip_c( hid_t_f *prp_id , int_f *options_mask, int_f *pixels_per_block);
-H5_FCDLL int_f h5pall_filters_avail_c( hid_t_f *prp_id , int_f *status);
-H5_FCDLL int_f h5pfill_value_defined_c( hid_t_f *prp_id , int_f *flag);
-H5_FCDLL int_f h5pget_attr_phase_change_c(hid_t_f *ocpl_id, int_f *max_compact, int_f *min_dense );
-H5_FCDLL int_f h5pset_attr_creation_order_c(hid_t_f *ocpl_id, int_f *crt_order_flags );
-H5_FCDLL int_f h5pset_shared_mesg_nindexes_c(hid_t_f *plist_id, int_f *nindexes );
-H5_FCDLL int_f h5pset_shared_mesg_index_c(hid_t_f *fcpl_id, int_f *index_num, int_f *mesg_type_flags, int_f *min_mesg_size);
+H5_FCDLL int_f h5pset_shuffle_c(hid_t_f *prp_id);
+H5_FCDLL int_f h5pset_fletcher32_c(hid_t_f *prp_id);
+H5_FCDLL int_f h5pset_edc_check_c(hid_t_f *prp_id, int_f *flag);
+H5_FCDLL int_f h5pget_edc_check_c(hid_t_f *prp_id, int_f *flag);
+H5_FCDLL int_f h5pset_family_offset_c(hid_t_f *prp_id, hsize_t_f *offset);
+H5_FCDLL int_f h5pget_fapl_multi_c(hid_t_f *prp_id, int_f *mem_map, hid_t_f *memb_fapl, _fcd memb_name,
+ int_f *len, int_f *lenmax, real_f *memb_addr, int_f *flag,
+ int_f *maxlen_out);
+H5_FCDLL int_f h5pset_fapl_multi_c(hid_t_f *prp_id, int_f *mem_map, hid_t_f *memb_fapl, _fcd memb_name,
+ int_f *len, int_f *lenmax, real_f *memb_addr, int_f *flag);
+H5_FCDLL int_f h5pset_fapl_multi_sc(hid_t_f *prp_id, int_f *flag);
+H5_FCDLL int_f h5pset_szip_c(hid_t_f *prp_id, int_f *options_mask, int_f *pixels_per_block);
+H5_FCDLL int_f h5pall_filters_avail_c(hid_t_f *prp_id, int_f *status);
+H5_FCDLL int_f h5pfill_value_defined_c(hid_t_f *prp_id, int_f *flag);
+H5_FCDLL int_f h5pget_attr_phase_change_c(hid_t_f *ocpl_id, int_f *max_compact, int_f *min_dense);
+H5_FCDLL int_f h5pset_attr_creation_order_c(hid_t_f *ocpl_id, int_f *crt_order_flags);
+H5_FCDLL int_f h5pset_shared_mesg_nindexes_c(hid_t_f *plist_id, int_f *nindexes);
+H5_FCDLL int_f h5pset_shared_mesg_index_c(hid_t_f *fcpl_id, int_f *index_num, int_f *mesg_type_flags,
+ int_f *min_mesg_size);
H5_FCDLL int_f h5pget_attr_creation_order_c(hid_t_f *ocpl_id, int_f *crt_order_flags);
H5_FCDLL int_f h5pset_link_creation_order_c(hid_t_f *gcpl_id, int_f *crt_order_flags);
-H5_FCDLL int_f h5pget_link_phase_change_c(hid_t_f *gcpl_id, int_f *max_compact, int_f *min_dense );
+H5_FCDLL int_f h5pget_link_phase_change_c(hid_t_f *gcpl_id, int_f *max_compact, int_f *min_dense);
H5_FCDLL int_f h5pget_obj_track_times_c(hid_t_f *plist_id, int_f *flag);
H5_FCDLL int_f h5pset_obj_track_times_c(hid_t_f *plist_id, int_f *flag);
H5_FCDLL int_f h5pset_create_inter_group_c(hid_t_f *lcpl_id, int_f *crt_intermed_group);
@@ -465,39 +511,46 @@ H5_FCDLL int_f h5pset_char_encoding_c(hid_t_f *plist_id, int_f *encoding);
H5_FCDLL int_f h5pget_char_encoding_c(hid_t_f *plist_id, int_f *encoding);
H5_FCDLL int_f h5pset_copy_object_c(hid_t_f *ocp_plist_id, int_f *copy_options);
H5_FCDLL int_f h5pget_copy_object_c(hid_t_f *ocp_plist_id, int_f *copy_options);
-H5_FCDLL int_f h5pget_data_transform_c(hid_t_f *plist_id, _fcd expression, int_f *expression_len, size_t_f *size);
+H5_FCDLL int_f h5pget_data_transform_c(hid_t_f *plist_id, _fcd expression, int_f *expression_len,
+ size_t_f *size);
H5_FCDLL int_f h5pset_data_transform_c(hid_t_f *plist_id, _fcd expression, int_f *expression_len);
H5_FCDLL int_f h5pget_local_heap_size_hint_c(hid_t_f *gcpl_id, size_t_f *size_hint);
H5_FCDLL int_f h5pget_est_link_info_c(hid_t_f *gcpl_id, int_f *est_num_entries, int_f *est_name_len);
H5_FCDLL int_f h5pset_local_heap_size_hint_c(hid_t_f *gcpl_id, size_t_f *size_hint);
H5_FCDLL int_f h5pset_est_link_info_c(hid_t_f *gcpl_id, int_f *est_num_entries, int_f *est_name_len);
-H5_FCDLL int_f h5pset_link_phase_change_c(hid_t_f *gcpl_id, int_f *max_compact, int_f *min_dense );
-H5_FCDLL int_f h5pset_fapl_direct_c(hid_t_f *fapl_id, size_t_f *alignment, size_t_f *block_size, size_t_f *cbuf_size );
-H5_FCDLL int_f h5pget_fapl_direct_c(hid_t_f *fapl_id, size_t_f *alignment, size_t_f *block_size, size_t_f *cbuf_size );
-H5_FCDLL int_f h5pset_attr_phase_change_c(hid_t_f *ocpl_id, int_f *max_compact, int_f *min_dense );
-H5_FCDLL int_f h5pset_nbit_c(hid_t_f *plist_id );
-H5_FCDLL int_f h5pset_scaleoffset_c(hid_t_f *plist_id, int_f *scale_type, int_f *scale_factor );
+H5_FCDLL int_f h5pset_link_phase_change_c(hid_t_f *gcpl_id, int_f *max_compact, int_f *min_dense);
+H5_FCDLL int_f h5pset_fapl_direct_c(hid_t_f *fapl_id, size_t_f *alignment, size_t_f *block_size,
+ size_t_f *cbuf_size);
+H5_FCDLL int_f h5pget_fapl_direct_c(hid_t_f *fapl_id, size_t_f *alignment, size_t_f *block_size,
+ size_t_f *cbuf_size);
+H5_FCDLL int_f h5pset_attr_phase_change_c(hid_t_f *ocpl_id, int_f *max_compact, int_f *min_dense);
+H5_FCDLL int_f h5pset_nbit_c(hid_t_f *plist_id);
+H5_FCDLL int_f h5pset_scaleoffset_c(hid_t_f *plist_id, int_f *scale_type, int_f *scale_factor);
H5_FCDLL int_f h5pset_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks);
H5_FCDLL int_f h5pget_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks);
-H5_FCDLL int_f h5pset_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes, real_f *rdcc_w0);
-H5_FCDLL int_f h5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes, real_f *rdcc_w0);
+H5_FCDLL int_f h5pset_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes,
+ real_f *rdcc_w0);
+H5_FCDLL int_f h5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes,
+ real_f *rdcc_w0);
#ifdef H5_HAVE_PARALLEL
H5_FCDLL int_f h5pget_mpio_actual_io_mode_c(hid_t_f *dxpl_id, int_f *actual_io_mode);
-H5_FCDLL int_f h5pget_fapl_mpio_c(hid_t_f *prp_id, int_f* comm, int_f* info);
-H5_FCDLL int_f h5pset_fapl_mpio_c(hid_t_f *prp_id, int_f* comm, int_f* info);
-H5_FCDLL int_f h5pget_dxpl_mpio_c(hid_t_f *prp_id, int_f* data_xfer_mode);
-H5_FCDLL int_f h5pset_dxpl_mpio_c(hid_t_f *prp_id, int_f* data_xfer_mode);
+H5_FCDLL int_f h5pget_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info);
+H5_FCDLL int_f h5pset_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info);
+H5_FCDLL int_f h5pget_dxpl_mpio_c(hid_t_f *prp_id, int_f *data_xfer_mode);
+H5_FCDLL int_f h5pset_dxpl_mpio_c(hid_t_f *prp_id, int_f *data_xfer_mode);
#endif
/*
* Functions frome H5Rf.c
*/
H5_FCDLL int_f h5rcreate_region_c(int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id);
-H5_FCDLL int_f h5rcreate_ptr_c(void *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *ref_type, hid_t_f *space_id);
+H5_FCDLL int_f h5rcreate_ptr_c(void *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *ref_type,
+ hid_t_f *space_id);
H5_FCDLL int_f h5rdereference_ptr_c(hid_t_f *obj_id, int_f *ref_type, void *ref, hid_t_f *ref_obj_id);
H5_FCDLL int_f h5rget_region_region_c(hid_t_f *dset_id, int_f *ref, hid_t_f *space_id);
H5_FCDLL int_f h5rget_region_ptr_c(hid_t_f *dset_id, void *ref, hid_t_f *space_id);
H5_FCDLL int_f h5rget_object_type_obj_c(hid_t_f *dset_id, haddr_t_f *ref, int_f *obj_type);
-H5_FCDLL int_f h5rget_name_ptr_c(hid_t_f *loc_id, int_f *ref_type, void *ref, _fcd name, size_t_f *name_len, size_t_f *size_default);
+H5_FCDLL int_f h5rget_name_ptr_c(hid_t_f *loc_id, int_f *ref_type, void *ref, _fcd name, size_t_f *name_len,
+ size_t_f *size_default);
H5_FCDLL int_f h5rget_obj_type_c(hid_t_f *loc_id, int_f *ref_type, void *ref, int_f *obj_type);
/*
* Functions from H5If.c
@@ -515,11 +568,11 @@ H5_FCDLL int_f h5iis_valid_c(hid_t_f *obj_id, int_f *c_valid);
*/
H5_FCDLL int_f h5eclear_c(hid_t_f *estack_id);
-H5_FCDLL int_f h5eprint_c1(_fcd name, int_f* namelen);
+H5_FCDLL int_f h5eprint_c1(_fcd name, int_f *namelen);
H5_FCDLL int_f h5eprint_c2(void);
-H5_FCDLL int_f h5eget_major_c(int_f* error_no, _fcd name, size_t_f* namelen);
-H5_FCDLL int_f h5eget_minor_c(int_f* error_no, _fcd name, size_t_f* namelen);
-H5_FCDLL int_f h5eset_auto2_c(int_f* printflag, hid_t_f *estack_id, H5E_auto2_t func, void *client_data);
+H5_FCDLL int_f h5eget_major_c(int_f *error_no, _fcd name, size_t_f *namelen);
+H5_FCDLL int_f h5eget_minor_c(int_f *error_no, _fcd name, size_t_f *namelen);
+H5_FCDLL int_f h5eset_auto2_c(int_f *printflag, hid_t_f *estack_id, H5E_auto2_t func, void *client_data);
/*
* Functions from H5f.c
@@ -527,15 +580,15 @@ H5_FCDLL int_f h5eset_auto2_c(int_f* printflag, hid_t_f *estack_id, H5E_auto2_t
H5_FCDLL int_f h5open_c(void);
H5_FCDLL int_f h5close_c(void);
H5_FCDLL int_f h5init_types_c(hid_t_f *types, hid_t_f *floatingtypes, hid_t_f *integertypes);
-H5_FCDLL int_f h5close_types_c(hid_t_f *types, int_f *lentypes, hid_t_f *floatingtypes, int_f *floatinglen, hid_t_f *integertypes, int_f *integerlen);
-H5_FCDLL int_f h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
- int_f *h5e_flags, hid_t_f *h5e_hid_flags, int_f *h5f_flags,
- int_f *h5fd_flags, hid_t_f *h5fd_hid_flags,
- int_f *h5g_flags, int_f *h5i_flags, int_f *h5l_flags, int_f *h5o_flags,
- hid_t_f *h5p_flags, int_f *h5p_flags_int, int_f *h5r_flags,
- int_f *h5s_flags, hid_t_f *h5s_hid_flags, hsize_t_f *h5s_hsize_flags,
- int_f *h5t_flags, int_f *h5z_flags, int_f *h5_generic_flags,
- haddr_t_f *h5_haddr_generic_flags);
+H5_FCDLL int_f h5close_types_c(hid_t_f *types, int_f *lentypes, hid_t_f *floatingtypes, int_f *floatinglen,
+ hid_t_f *integertypes, int_f *integerlen);
+H5_FCDLL int_f h5init_flags_c(int_f *h5d_flags, size_t_f *h5d_size_flags, int_f *h5e_flags,
+ hid_t_f *h5e_hid_flags, int_f *h5f_flags, int_f *h5fd_flags,
+ hid_t_f *h5fd_hid_flags, int_f *h5g_flags, int_f *h5i_flags, int_f *h5l_flags,
+ int_f *h5o_flags, hid_t_f *h5p_flags, int_f *h5p_flags_int, int_f *h5r_flags,
+ int_f *h5s_flags, hid_t_f *h5s_hid_flags, hsize_t_f *h5s_hsize_flags,
+ int_f *h5t_flags, int_f *h5z_flags, int_f *h5_generic_flags,
+ haddr_t_f *h5_haddr_generic_flags);
H5_FCDLL int_f h5init1_flags_c(int_f *h5lib_flags);
H5_FCDLL int_f h5get_libversion_c(int_f *majnum, int_f *minnum, int_f *relnum);
H5_FCDLL int_f h5check_version_c(int_f *majnum, int_f *minnum, int_f *relnum);
@@ -554,41 +607,40 @@ H5_FCDLL int_f h5zget_filter_info_c(int_f *filter, int_f *flag);
*/
H5_FCDLL int_f h5lcopy_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_namelen, hid_t_f *dest_loc_id,
- _fcd dest_name, size_t_f *dest_namelen,
- hid_t_f *lcpl_id, hid_t_f *lapl_id);
-H5_FCDLL int_f h5lcreate_external_c(_fcd file_name, size_t_f *file_namelen, _fcd obj_name, size_t_f *obj_namelen,
- hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen,
- hid_t_f *lcpl_id, hid_t_f *lapl_id);
+ _fcd dest_name, size_t_f *dest_namelen, hid_t_f *lcpl_id, hid_t_f *lapl_id);
+H5_FCDLL int_f h5lcreate_external_c(_fcd file_name, size_t_f *file_namelen, _fcd obj_name,
+ size_t_f *obj_namelen, hid_t_f *link_loc_id, _fcd link_name,
+ size_t_f *link_namelen, hid_t_f *lcpl_id, hid_t_f *lapl_id);
H5_FCDLL int_f h5lcreate_hard_c(hid_t_f *obj_loc_id, _fcd obj_name, size_t_f *obj_namelen,
- hid_t_f *link_loc_id,
- _fcd link_name, size_t_f *link_namelen,
- hid_t_f *lcpl_id, hid_t_f *lapl_id );
-H5_FCDLL int_f h5lcreate_soft_c(_fcd target_path, size_t_f *target_path_len,
- hid_t_f *link_loc_id,
- _fcd link_name, size_t_f *link_name_len,
- hid_t_f *lcpl_id, hid_t_f *lapl_id );
-H5_FCDLL int_f h5ldelete_c( hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id );
+ hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen,
+ hid_t_f *lcpl_id, hid_t_f *lapl_id);
+H5_FCDLL int_f h5lcreate_soft_c(_fcd target_path, size_t_f *target_path_len, hid_t_f *link_loc_id,
+ _fcd link_name, size_t_f *link_name_len, hid_t_f *lcpl_id, hid_t_f *lapl_id);
+H5_FCDLL int_f h5ldelete_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id);
H5_FCDLL int_f h5ldelete_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
- int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id);
-H5_FCDLL int_f h5lexists_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, int_f *link_exists);
-H5_FCDLL int_f h5lget_info_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen,
- int_f *cset, int_f *corder, int_f *corder_valid, int_f *link_type,
- H5O_token_t *token, size_t_f *val_size, hid_t_f *lapl_id);
+ int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id);
+H5_FCDLL int_f h5lexists_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id,
+ int_f *link_exists);
+H5_FCDLL int_f h5lget_info_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, int_f *cset,
+ int_f *corder, int_f *corder_valid, int_f *link_type, H5O_token_t *token,
+ size_t_f *val_size, hid_t_f *lapl_id);
H5_FCDLL int_f h5lget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
- int_f *index_field, int_f *order, hsize_t_f *n,
- int_f *link_type, int_f *corder_valid, int_f *corder,
- int_f *cset, H5O_token_t *token, size_t_f *val_size, hid_t_f *lapl_id);
+ int_f *index_field, int_f *order, hsize_t_f *n, int_f *link_type,
+ int_f *corder_valid, int_f *corder, int_f *cset, H5O_token_t *token,
+ size_t_f *val_size, hid_t_f *lapl_id);
H5_FCDLL int_f h5lis_registered_c(int_f *link_cls_id);
H5_FCDLL int_f h5lmove_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_namelen, hid_t_f *dest_loc_id,
- _fcd dest_name, size_t_f *dest_namelen, hid_t_f *lcpl_id, hid_t_f *lapl_id);
+ _fcd dest_name, size_t_f *dest_namelen, hid_t_f *lcpl_id, hid_t_f *lapl_id);
H5_FCDLL int_f h5lget_name_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
- int_f *index_field, int_f *order, hsize_t_f *n,
- size_t_f *size, _fcd name, hid_t_f *lapl_id);
+ int_f *index_field, int_f *order, hsize_t_f *n, size_t_f *size, _fcd name,
+ hid_t_f *lapl_id);
H5_FCDLL int_f h5lget_val_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, size_t_f *size,
- void *linkval_buff, hid_t_f *lapl_id) ;
-
-H5_FCDLL int_f h5literate_c(hid_t_f *group_id, int_f *index_type, int_f *order, hsize_t_f *idx, H5L_iterate2_t op, void *op_data );
-H5_FCDLL int_f h5literate_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, int_f *index_type, int_f *order, hsize_t_f *idx, H5L_iterate2_t op, void *op_data, hid_t_f *lapl_id);
+ void *linkval_buff, hid_t_f *lapl_id);
+H5_FCDLL int_f h5literate_c(hid_t_f *group_id, int_f *index_type, int_f *order, hsize_t_f *idx,
+ H5L_iterate2_t op, void *op_data);
+H5_FCDLL int_f h5literate_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, int_f *index_type,
+ int_f *order, hsize_t_f *idx, H5L_iterate2_t op, void *op_data,
+ hid_t_f *lapl_id);
#endif /* _H5f90proto_H */
diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c
index 231b90d..85b86d1 100644
--- a/fortran/src/H5match_types.c
+++ b/fortran/src/H5match_types.c
@@ -26,7 +26,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include <stdio.h>
#include <string.h>
@@ -40,24 +40,24 @@
#include "H5fort_type_defines.h"
/* File pointers for files */
-FILE * c_header;
-FILE * fort_header;
+FILE *c_header;
+FILE *fort_header;
#define CFILE "H5f90i_gen.h"
#define FFILE "H5fortran_types.F90"
/* Prototypes for the write routines */
-void writeTypedef(const char* c_typedef, const char* c_type, int size);
-void writeTypedefDefault(const char* c_typedef, int size);
-void writeToFiles(const char* c_typedef, const char* fortran_type, const char* c_type, int kind);
-void writeToCFileOnly(const char* c_typedef, const char* fortran_type, const char* c_type, int size);
-void writeToFilesChr(const char* c_typedef, const char* fortran_type, const char* c_type, int size, const char* kind);
+void writeTypedef(const char *c_typedef, const char *c_type, int size);
+void writeTypedefDefault(const char *c_typedef, int size);
+void writeToFiles(const char *c_typedef, const char *fortran_type, const char *c_type, int kind);
+void writeToCFileOnly(const char *c_typedef, const char *fortran_type, const char *c_type, int size);
+void writeToFilesChr(const char *c_typedef, const char *fortran_type, const char *c_type, int size,
+ const char *kind);
static void
initCfile(void)
{
- fprintf(c_header,
- "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\
+ fprintf(c_header, "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\
* Copyright by The HDF Group. *\n\
* Copyright by the Board of Trustees of the University of Illinois. *\n\
* All rights reserved. *\n\
@@ -81,8 +81,7 @@ initCfile(void)
static void
initFfile(void)
{
- fprintf(fort_header,
- "! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n\
+ fprintf(fort_header, "! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n\
! Copyright by The HDF Group. *\n\
! Copyright by the Board of Trustees of the University of Illinois. *\n\
! All rights reserved. *\n\
@@ -101,340 +100,359 @@ initFfile(void)
!\n\
! HDF5 integers\n\
!\n");
-
}
static void
endCfile(void)
{
- fprintf(c_header, "\n#endif /* _H5f90i_gen_H */\n");
+ fprintf(c_header, "\n#endif /* _H5f90i_gen_H */\n");
}
static void
endFfile(void)
{
- fprintf(fort_header, "\n INTEGER(SIZE_T), PARAMETER :: OBJECT_NAMELEN_DEFAULT_F = -1\n\n");
- fprintf(fort_header, " END MODULE H5FORTRAN_TYPES\n");
+ fprintf(fort_header, "\n INTEGER(SIZE_T), PARAMETER :: OBJECT_NAMELEN_DEFAULT_F = -1\n\n");
+ fprintf(fort_header, " END MODULE H5FORTRAN_TYPES\n");
}
/* Define a c_int_x type in the C header */
-void writeTypedef(const char* c_typedef, const char* c_type, int size)
+void
+writeTypedef(const char *c_typedef, const char *c_type, int size)
{
- fprintf(c_header, "#define c_%s_%u %s\n", c_typedef, size, c_type);
+ fprintf(c_header, "#define c_%s_%u %s\n", c_typedef, size, c_type);
}
/* Call this function if there is no matching C type for sizes > 1 */
-void writeTypedefDefault(const char* c_typedef, int size)
+void
+writeTypedefDefault(const char *c_typedef, int size)
{
- assert(size %2 == 0);
- fprintf(c_header, "typedef struct {c_%s_%u a; c_%s_%u b;} c_%s_%u;\n", c_typedef, size / 2, c_typedef, size / 2, c_typedef, size);
+ assert(size % 2 == 0);
+ fprintf(c_header, "typedef struct {c_%s_%u a; c_%s_%u b;} c_%s_%u;\n", c_typedef, size / 2, c_typedef,
+ size / 2, c_typedef, size);
}
/* Create matching Fortran and C types by writing to both files */
-void writeToFiles(const char* c_typedef, const char* fortran_type, const char* c_type, int kind)
+void
+writeToFiles(const char *c_typedef, const char *fortran_type, const char *c_type, int kind)
{
- fprintf(fort_header, " INTEGER, PARAMETER :: %s = %u\n", fortran_type, kind);
- fprintf(c_header, "typedef c_%s_%d %s;\n", c_typedef, kind, c_type);
+ fprintf(fort_header, " INTEGER, PARAMETER :: %s = %u\n", fortran_type, kind);
+ fprintf(c_header, "typedef c_%s_%d %s;\n", c_typedef, kind, c_type);
}
-void writeToFilesChr(const char* c_typedef, const char* fortran_type, const char* c_type, int size, const char* kind)
+void
+writeToFilesChr(const char *c_typedef, const char *fortran_type, const char *c_type, int size,
+ const char *kind)
{
- fprintf(fort_header, " INTEGER, PARAMETER :: %s = %s\n", fortran_type, kind);
- fprintf(c_header, "typedef c_%s_%d %s;\n", c_typedef, size, c_type);
+ fprintf(fort_header, " INTEGER, PARAMETER :: %s = %s\n", fortran_type, kind);
+ fprintf(c_header, "typedef c_%s_%d %s;\n", c_typedef, size, c_type);
}
-int main(void)
+int
+main(void)
{
- int i;
- char chrA[64],chrB[64];
-
- int IntKinds[] = H5_FORTRAN_INTEGER_KINDS;
- int IntKinds_SizeOf[] = H5_FORTRAN_INTEGER_KINDS_SIZEOF;
- int RealKinds[] = H5_FORTRAN_REAL_KINDS;
- int RealKinds_SizeOf[] = H5_FORTRAN_REAL_KINDS_SIZEOF;
- char Real_C_TYPES[10][32];
-
- int FORTRAN_NUM_INTEGER_KINDS=H5_FORTRAN_NUM_INTEGER_KINDS;
- int H5_FORTRAN_NUM_REAL_KINDS;
-#if H5_FORTRAN_HAVE_C_LONG_DOUBLE!=0
- int found_long_double = 0;
+ int i;
+ char chrA[64], chrB[64];
+
+ int IntKinds[] = H5_FORTRAN_INTEGER_KINDS;
+ int IntKinds_SizeOf[] = H5_FORTRAN_INTEGER_KINDS_SIZEOF;
+ int RealKinds[] = H5_FORTRAN_REAL_KINDS;
+ int RealKinds_SizeOf[] = H5_FORTRAN_REAL_KINDS_SIZEOF;
+ char Real_C_TYPES[10][32];
+
+ int FORTRAN_NUM_INTEGER_KINDS = H5_FORTRAN_NUM_INTEGER_KINDS;
+ int H5_FORTRAN_NUM_REAL_KINDS;
+#if H5_FORTRAN_HAVE_C_LONG_DOUBLE != 0
+ int found_long_double = 0;
#endif
- /* Open target files */
- c_header = fopen(CFILE, "w");
- fort_header = fopen(FFILE, "w");
-
- /* Write copyright, boilerplate to both files */
- initCfile();
- initFfile();
-
- /* (a) define c_int_x */
-
- FORTRAN_NUM_INTEGER_KINDS = (int)(sizeof(IntKinds)/sizeof(IntKinds[0]));
- H5_FORTRAN_NUM_REAL_KINDS = (int)(sizeof(RealKinds)/sizeof(RealKinds[0]));
-
- fprintf(fort_header," INTEGER, PARAMETER :: H5_FORTRAN_NUM_INTEGER_KINDS = %d\n", FORTRAN_NUM_INTEGER_KINDS);
-
-
- for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) {
- if(sizeof(long long) == IntKinds_SizeOf[i])
- writeTypedef("int", "long long", IntKinds[i]);
- else if(sizeof(long) == IntKinds[i])
- writeTypedef("int", "long", IntKinds[i]);
- else if(sizeof(int) == IntKinds_SizeOf[i])
- writeTypedef("int", "int", IntKinds[i]);
- else if(sizeof(short) == IntKinds_SizeOf[i])
- writeTypedef("int", "short", IntKinds[i]);
- else
- if(IntKinds_SizeOf[i] == 1) {
- writeTypedef("int", "char", IntKinds[i]);
- /* Actually, char is not necessarily one byte.
- * But if char isn't, then nothing is, so this
- * is as close as we can get. */
- } else {
- writeTypedefDefault("int",IntKinds[i]);
- }
- if(sizeof(size_t) == IntKinds_SizeOf[i])
- writeTypedef("size_t", "size_t", IntKinds[i]);
- if(sizeof(time_t) == IntKinds_SizeOf[i])
- writeTypedef("time_t", "time_t", IntKinds[i]);
- if(sizeof(hsize_t) == IntKinds_SizeOf[i])
- writeTypedef("hsize_t", "hsize_t", IntKinds[i]);
- }
-
- /* (b) Define c_float_x */
-
- for(i=0;i< H5_FORTRAN_NUM_REAL_KINDS;i++) {
- if (sizeof(float) == RealKinds_SizeOf[i]) {
- writeTypedef("float", "float", RealKinds[i]);
- strcpy(Real_C_TYPES[i], "C_FLOAT");
- }
- else if(sizeof(double) == RealKinds_SizeOf[i]) {
- writeTypedef("float", "double", RealKinds[i]);
- strcpy(Real_C_TYPES[i], "C_DOUBLE");
+ /* Open target files */
+ c_header = fopen(CFILE, "w");
+ fort_header = fopen(FFILE, "w");
+
+ /* Write copyright, boilerplate to both files */
+ initCfile();
+ initFfile();
+
+ /* (a) define c_int_x */
+
+ FORTRAN_NUM_INTEGER_KINDS = (int)(sizeof(IntKinds) / sizeof(IntKinds[0]));
+ H5_FORTRAN_NUM_REAL_KINDS = (int)(sizeof(RealKinds) / sizeof(RealKinds[0]));
+
+ fprintf(fort_header, " INTEGER, PARAMETER :: H5_FORTRAN_NUM_INTEGER_KINDS = %d\n",
+ FORTRAN_NUM_INTEGER_KINDS);
+
+ for (i = 0; i < FORTRAN_NUM_INTEGER_KINDS; i++) {
+ if (sizeof(long long) == IntKinds_SizeOf[i])
+ writeTypedef("int", "long long", IntKinds[i]);
+ else if (sizeof(long) == IntKinds[i])
+ writeTypedef("int", "long", IntKinds[i]);
+ else if (sizeof(int) == IntKinds_SizeOf[i])
+ writeTypedef("int", "int", IntKinds[i]);
+ else if (sizeof(short) == IntKinds_SizeOf[i])
+ writeTypedef("int", "short", IntKinds[i]);
+ else if (IntKinds_SizeOf[i] == 1) {
+ writeTypedef("int", "char", IntKinds[i]);
+ /* Actually, char is not necessarily one byte.
+ * But if char isn't, then nothing is, so this
+ * is as close as we can get. */
+ }
+ else {
+ writeTypedefDefault("int", IntKinds[i]);
+ }
+ if (sizeof(size_t) == IntKinds_SizeOf[i])
+ writeTypedef("size_t", "size_t", IntKinds[i]);
+ if (sizeof(time_t) == IntKinds_SizeOf[i])
+ writeTypedef("time_t", "time_t", IntKinds[i]);
+ if (sizeof(hsize_t) == IntKinds_SizeOf[i])
+ writeTypedef("hsize_t", "hsize_t", IntKinds[i]);
}
-#if H5_FORTRAN_HAVE_C_LONG_DOUBLE!=0
- else if(sizeof(long double) == RealKinds_SizeOf[i] && found_long_double == 0) {
- writeTypedef("float", "long double", RealKinds[i]);
- strcpy(Real_C_TYPES[i], "C_LONG_DOUBLE");
- found_long_double = 1;
- }
-# ifdef H5_HAVE_FLOAT128
- /* Don't select a higher precision than Fortran can support */
- else if(sizeof(__float128) == RealKinds_SizeOf[i] && found_long_double == 1 && H5_PAC_FC_MAX_REAL_PRECISION > 28) {
- writeTypedef("float", "__float128", RealKinds[i]);
- strcpy(Real_C_TYPES[i], "C_FLOAT128");
- }
-# else
- else if(sizeof(long double) == RealKinds_SizeOf[i] && found_long_double == 1 && H5_PAC_FC_MAX_REAL_PRECISION > 28) {
- writeTypedef("float", "long double", RealKinds[i]);
- strcpy(Real_C_TYPES[i], "C_FLOAT128");
- }
-# endif
+
+ /* (b) Define c_float_x */
+
+ for (i = 0; i < H5_FORTRAN_NUM_REAL_KINDS; i++) {
+ if (sizeof(float) == RealKinds_SizeOf[i]) {
+ writeTypedef("float", "float", RealKinds[i]);
+ strcpy(Real_C_TYPES[i], "C_FLOAT");
+ }
+ else if (sizeof(double) == RealKinds_SizeOf[i]) {
+ writeTypedef("float", "double", RealKinds[i]);
+ strcpy(Real_C_TYPES[i], "C_DOUBLE");
+ }
+#if H5_FORTRAN_HAVE_C_LONG_DOUBLE != 0
+ else if (sizeof(long double) == RealKinds_SizeOf[i] && found_long_double == 0) {
+ writeTypedef("float", "long double", RealKinds[i]);
+ strcpy(Real_C_TYPES[i], "C_LONG_DOUBLE");
+ found_long_double = 1;
+ }
+#ifdef H5_HAVE_FLOAT128
+ /* Don't select a higher precision than Fortran can support */
+ else if (sizeof(__float128) == RealKinds_SizeOf[i] && found_long_double == 1 &&
+ H5_PAC_FC_MAX_REAL_PRECISION > 28) {
+ writeTypedef("float", "__float128", RealKinds[i]);
+ strcpy(Real_C_TYPES[i], "C_FLOAT128");
+ }
+#else
+ else if (sizeof(long double) == RealKinds_SizeOf[i] && found_long_double == 1 &&
+ H5_PAC_FC_MAX_REAL_PRECISION > 28) {
+ writeTypedef("float", "long double", RealKinds[i]);
+ strcpy(Real_C_TYPES[i], "C_FLOAT128");
+ }
+#endif
#else /* There is no C_LONG_DOUBLE intrinsic */
-# ifdef H5_HAVE_FLOAT128
- /* Don't select a higher precision than Fortran can support */
- else if(sizeof(__float128) == RealKinds_SizeOf[i] ) {
- writeTypedef("float", "__float128", RealKinds[i]);
- strcpy(Real_C_TYPES[i], "C_FLOAT128");
- }
-# else
- else if(sizeof(long double) == RealKinds_SizeOf[i] ) {
- writeTypedef("float", "long double", RealKinds[i]);
- strcpy(Real_C_TYPES[i], "C_FLOAT128");
- }
-# endif
+#ifdef H5_HAVE_FLOAT128
+ /* Don't select a higher precision than Fortran can support */
+ else if (sizeof(__float128) == RealKinds_SizeOf[i]) {
+ writeTypedef("float", "__float128", RealKinds[i]);
+ strcpy(Real_C_TYPES[i], "C_FLOAT128");
+ }
+#else
+ else if (sizeof(long double) == RealKinds_SizeOf[i]) {
+ writeTypedef("float", "long double", RealKinds[i]);
+ strcpy(Real_C_TYPES[i], "C_FLOAT128");
+ }
#endif
- else {
- printf("\n **** HDF5 WARNING ****\n");
- printf("Fortran REAL(KIND=%d) is %d Bytes, but no corresponding C float type exists of that size\n",RealKinds[i],RealKinds_SizeOf[i]);
- printf(" !!! Fortran interfaces will not be generated for REAL(KIND=%d) !!!\n\n",RealKinds[i]);
-
- RealKinds_SizeOf[i] = -1;
- RealKinds[i] = -1;
+#endif
+ else {
+ printf("\n **** HDF5 WARNING ****\n");
+ printf(
+ "Fortran REAL(KIND=%d) is %d Bytes, but no corresponding C float type exists of that size\n",
+ RealKinds[i], RealKinds_SizeOf[i]);
+ printf(" !!! Fortran interfaces will not be generated for REAL(KIND=%d) !!!\n\n",
+ RealKinds[i]);
+
+ RealKinds_SizeOf[i] = -1;
+ RealKinds[i] = -1;
+ }
}
- }
-
- /* Now begin defining fortran types. */
- fprintf(c_header, "\n");
- /* haddr_t */
- for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) {
- if(IntKinds_SizeOf[i] == H5_SIZEOF_HADDR_T) {
- writeToFiles("int","HADDR_T", "haddr_t_f", IntKinds[i]);
- break;
+ /* Now begin defining fortran types. */
+ fprintf(c_header, "\n");
+
+ /* haddr_t */
+ for (i = 0; i < FORTRAN_NUM_INTEGER_KINDS; i++) {
+ if (IntKinds_SizeOf[i] == H5_SIZEOF_HADDR_T) {
+ writeToFiles("int", "HADDR_T", "haddr_t_f", IntKinds[i]);
+ break;
+ }
+ if (i == (FORTRAN_NUM_INTEGER_KINDS - 1))
+ /* Error: couldn't find a size for haddr_t */
+ return -1;
}
- if(i == (FORTRAN_NUM_INTEGER_KINDS-1) )
- /* Error: couldn't find a size for haddr_t */
- return -1;
- }
-
- /* hsize_t */
- for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) {
- if(IntKinds_SizeOf[i] == H5_SIZEOF_HSIZE_T) {
- writeToFiles("hsize_t","HSIZE_T", "hsize_t_f", IntKinds[i]);
- break;
+
+ /* hsize_t */
+ for (i = 0; i < FORTRAN_NUM_INTEGER_KINDS; i++) {
+ if (IntKinds_SizeOf[i] == H5_SIZEOF_HSIZE_T) {
+ writeToFiles("hsize_t", "HSIZE_T", "hsize_t_f", IntKinds[i]);
+ break;
+ }
+ if (i == (FORTRAN_NUM_INTEGER_KINDS - 1))
+ /* Error: couldn't find a size for hsize_t */
+ return -1;
}
- if(i == (FORTRAN_NUM_INTEGER_KINDS-1) )
- /* Error: couldn't find a size for hsize_t */
- return -1;
- }
-
- /* hssize_t */
- for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) {
- if(IntKinds_SizeOf[i] == H5_SIZEOF_HSSIZE_T) {
- writeToFiles("int","HSSIZE_T", "hssize_t_f", IntKinds[i]);
- break;
+
+ /* hssize_t */
+ for (i = 0; i < FORTRAN_NUM_INTEGER_KINDS; i++) {
+ if (IntKinds_SizeOf[i] == H5_SIZEOF_HSSIZE_T) {
+ writeToFiles("int", "HSSIZE_T", "hssize_t_f", IntKinds[i]);
+ break;
+ }
+ if (i == (FORTRAN_NUM_INTEGER_KINDS - 1))
+ /* Error: couldn't find a size for hssize_t */
+ return -1;
}
- if(i == (FORTRAN_NUM_INTEGER_KINDS-1) )
- /* Error: couldn't find a size for hssize_t */
- return -1;
- }
-
- /* off_t */
- for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) {
- if(IntKinds_SizeOf[i] == H5_SIZEOF_OFF_T) {
- writeToFiles("int","OFF_T", "off_t_f", IntKinds[i]);
- break;
+
+ /* off_t */
+ for (i = 0; i < FORTRAN_NUM_INTEGER_KINDS; i++) {
+ if (IntKinds_SizeOf[i] == H5_SIZEOF_OFF_T) {
+ writeToFiles("int", "OFF_T", "off_t_f", IntKinds[i]);
+ break;
+ }
+ if (i == (FORTRAN_NUM_INTEGER_KINDS - 1))
+ /* Error: couldn't find a size for off_t */
+ return -1;
}
- if(i == (FORTRAN_NUM_INTEGER_KINDS-1) )
- /* Error: couldn't find a size for off_t */
- return -1;
- }
-
- /* size_t */
- for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) {
- if(IntKinds_SizeOf[i] == H5_SIZEOF_SIZE_T) {
- writeToFiles("size_t","SIZE_T", "size_t_f", IntKinds[i]);
- break;
+
+ /* size_t */
+ for (i = 0; i < FORTRAN_NUM_INTEGER_KINDS; i++) {
+ if (IntKinds_SizeOf[i] == H5_SIZEOF_SIZE_T) {
+ writeToFiles("size_t", "SIZE_T", "size_t_f", IntKinds[i]);
+ break;
+ }
+ if (i == (FORTRAN_NUM_INTEGER_KINDS - 1))
+ /* Error: couldn't find a size for size_t */
+ return -1;
}
- if(i == (FORTRAN_NUM_INTEGER_KINDS-1) )
- /* Error: couldn't find a size for size_t */
- return -1;
- }
-
- /* time_t */
- for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) {
- if(IntKinds_SizeOf[i] == H5_SIZEOF_TIME_T) {
- writeToFiles("time_t","TIME_T", "time_t_f", IntKinds[i]);
- break;
+
+ /* time_t */
+ for (i = 0; i < FORTRAN_NUM_INTEGER_KINDS; i++) {
+ if (IntKinds_SizeOf[i] == H5_SIZEOF_TIME_T) {
+ writeToFiles("time_t", "TIME_T", "time_t_f", IntKinds[i]);
+ break;
+ }
+ if (i == (FORTRAN_NUM_INTEGER_KINDS - 1))
+ /* Error: couldn't find a size for time_t */
+ return -1;
}
- if(i == (FORTRAN_NUM_INTEGER_KINDS-1) )
- /* Error: couldn't find a size for time_t */
- return -1;
- }
- /* int */
- writeToFiles("int","Fortran_INTEGER", "int_f", H5_FORTRAN_NATIVE_INTEGER_KIND);
+ /* int */
+ writeToFiles("int", "Fortran_INTEGER", "int_f", H5_FORTRAN_NATIVE_INTEGER_KIND);
- /* int_1, int_2, int_4, int_8 */
+ /* int_1, int_2, int_4, int_8 */
-/* Defined different KINDs of integers */
+ /* Defined different KINDs of integers */
- fprintf(fort_header," INTEGER, DIMENSION(1:%d), PARAMETER :: Fortran_INTEGER_AVAIL_KINDS = (/", FORTRAN_NUM_INTEGER_KINDS);
+ fprintf(fort_header, " INTEGER, DIMENSION(1:%d), PARAMETER :: Fortran_INTEGER_AVAIL_KINDS = (/",
+ FORTRAN_NUM_INTEGER_KINDS);
- for(i=0;i<FORTRAN_NUM_INTEGER_KINDS;i++) {
- fprintf(fort_header,"%d",(int)IntKinds[i]);
- if(i==FORTRAN_NUM_INTEGER_KINDS-1) {
- fprintf(fort_header,"/)\n");
- } else {
- fprintf(fort_header,",");
+ for (i = 0; i < FORTRAN_NUM_INTEGER_KINDS; i++) {
+ fprintf(fort_header, "%d", (int)IntKinds[i]);
+ if (i == FORTRAN_NUM_INTEGER_KINDS - 1) {
+ fprintf(fort_header, "/)\n");
+ }
+ else {
+ fprintf(fort_header, ",");
+ }
}
- }
+ /* real_4, real_8, real_16 */
- /* real_4, real_8, real_16 */
+ /* Defined different KINDs of reals: */
+ /* if the REAL kind is not available then we assign */
+ /* it a value of the next larger one, but if the next */
+ /* higher one is not available we assigned it the next lowest */
-/* Defined different KINDs of reals: */
-/* if the REAL kind is not available then we assign */
-/* it a value of the next larger one, but if the next */
-/* higher one is not available we assigned it the next lowest */
-
- for(i=0;i<H5_FORTRAN_NUM_REAL_KINDS;i++) {
- if (RealKinds[i] > 0) {
- snprintf(chrA, sizeof(chrA), "Fortran_REAL_%s", Real_C_TYPES[i]);
- snprintf(chrB, sizeof(chrB), "real_%s_f", Real_C_TYPES[i]);
- writeToFiles("float",chrA, chrB, RealKinds[i]);
+ for (i = 0; i < H5_FORTRAN_NUM_REAL_KINDS; i++) {
+ if (RealKinds[i] > 0) {
+ snprintf(chrA, sizeof(chrA), "Fortran_REAL_%s", Real_C_TYPES[i]);
+ snprintf(chrB, sizeof(chrB), "real_%s_f", Real_C_TYPES[i]);
+ writeToFiles("float", chrA, chrB, RealKinds[i]);
+ }
}
- }
- /* hid_t */
- for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) {
- if(IntKinds_SizeOf[i] == H5_SIZEOF_HID_T) {
- writeToFiles("int","HID_T", "hid_t_f", IntKinds[i]);
- break;
+ /* hid_t */
+ for (i = 0; i < FORTRAN_NUM_INTEGER_KINDS; i++) {
+ if (IntKinds_SizeOf[i] == H5_SIZEOF_HID_T) {
+ writeToFiles("int", "HID_T", "hid_t_f", IntKinds[i]);
+ break;
+ }
+ if (i == (FORTRAN_NUM_INTEGER_KINDS - 1))
+ /* Error: couldn't find a size for hid_t */
+ return -1;
+ }
+ /* real_f */
+#if H5_FORTRAN_HAVE_C_LONG_DOUBLE != 0
+ if (H5_FORTRAN_NATIVE_REAL_SIZEOF == sizeof(long double)) {
+ writeToFilesChr("float", "Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_LONG_DOUBLE");
}
- if(i == (FORTRAN_NUM_INTEGER_KINDS-1) )
- /* Error: couldn't find a size for hid_t */
- return -1;
- }
- /* real_f */
-#if H5_FORTRAN_HAVE_C_LONG_DOUBLE!=0
- if(H5_FORTRAN_NATIVE_REAL_SIZEOF == sizeof(long double)) {
- writeToFilesChr("float","Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_LONG_DOUBLE");
- } else
+ else
#endif
- if(H5_FORTRAN_NATIVE_REAL_SIZEOF == sizeof(double)) {
- writeToFilesChr("float","Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_DOUBLE");
- } else if(H5_FORTRAN_NATIVE_REAL_SIZEOF == sizeof(float))
- writeToFilesChr("float","Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_FLOAT");
- else {
- /* No exact match, choose the next highest */
- if(H5_FORTRAN_NATIVE_REAL_SIZEOF > sizeof(long double))
- writeToFilesChr("float","Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_LONG_DOUBLE");
- else if(H5_FORTRAN_NATIVE_REAL_SIZEOF > sizeof(double))
- writeToFilesChr("float","Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_DOUBLE");
- else if(H5_FORTRAN_NATIVE_REAL_SIZEOF > sizeof(float))
- writeToFilesChr("float","Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_FLOAT");
+ if (H5_FORTRAN_NATIVE_REAL_SIZEOF == sizeof(double)) {
+ writeToFilesChr("float", "Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_DOUBLE");
+ }
+ else if (H5_FORTRAN_NATIVE_REAL_SIZEOF == sizeof(float))
+ writeToFilesChr("float", "Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_FLOAT");
else {
- /* Error: couldn't find a size for real_f */
- printf("Error: couldn't find a size for real_f \n");
- return -1;
+ /* No exact match, choose the next highest */
+ if (H5_FORTRAN_NATIVE_REAL_SIZEOF > sizeof(long double))
+ writeToFilesChr("float", "Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_LONG_DOUBLE");
+ else if (H5_FORTRAN_NATIVE_REAL_SIZEOF > sizeof(double))
+ writeToFilesChr("float", "Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_DOUBLE");
+ else if (H5_FORTRAN_NATIVE_REAL_SIZEOF > sizeof(float))
+ writeToFilesChr("float", "Fortran_REAL", "real_f", H5_FORTRAN_NATIVE_REAL_KIND, "C_FLOAT");
+ else {
+ /* Error: couldn't find a size for real_f */
+ printf("Error: couldn't find a size for real_f \n");
+ return -1;
+ }
}
- }
- /* double_f */
-#if H5_FORTRAN_HAVE_C_LONG_DOUBLE!=0
- if(H5_FORTRAN_NATIVE_DOUBLE_SIZEOF == sizeof(long double)){
- writeToFilesChr("float","Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "C_LONG_DOUBLE");
- } else
+ /* double_f */
+#if H5_FORTRAN_HAVE_C_LONG_DOUBLE != 0
+ if (H5_FORTRAN_NATIVE_DOUBLE_SIZEOF == sizeof(long double)) {
+ writeToFilesChr("float", "Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND,
+ "C_LONG_DOUBLE");
+ }
+ else
#endif
- if(H5_FORTRAN_NATIVE_DOUBLE_SIZEOF == sizeof(double)) {
- writeToFilesChr("float","Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "C_DOUBLE");
- } else if(H5_FORTRAN_NATIVE_DOUBLE_SIZEOF == sizeof(float))
- writeToFilesChr("float","Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "C_FLOAT");
+ if (H5_FORTRAN_NATIVE_DOUBLE_SIZEOF == sizeof(double)) {
+ writeToFilesChr("float", "Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "C_DOUBLE");
+ }
+ else if (H5_FORTRAN_NATIVE_DOUBLE_SIZEOF == sizeof(float))
+ writeToFilesChr("float", "Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "C_FLOAT");
#ifdef H5_HAVE_FLOAT128
/* Don't select a higher precision than Fortran can support */
- else if(sizeof(__float128) == H5_FORTRAN_NATIVE_DOUBLE_SIZEOF && H5_PAC_FC_MAX_REAL_PRECISION > 28) {
- writeToFilesChr("float","Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "Fortran_REAL_C_FLOAT128");
+ else if (sizeof(__float128) == H5_FORTRAN_NATIVE_DOUBLE_SIZEOF && H5_PAC_FC_MAX_REAL_PRECISION > 28) {
+ writeToFilesChr("float", "Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND,
+ "Fortran_REAL_C_FLOAT128");
}
#else
- else if(sizeof(long double) == H5_FORTRAN_NATIVE_DOUBLE_SIZEOF && H5_PAC_FC_MAX_REAL_PRECISION > 28) {
- writeToFilesChr("float","Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND, "Fortran_REAL_C_FLOAT128");
+ else if (sizeof(long double) == H5_FORTRAN_NATIVE_DOUBLE_SIZEOF && H5_PAC_FC_MAX_REAL_PRECISION > 28) {
+ writeToFilesChr("float", "Fortran_DOUBLE", "double_f", H5_FORTRAN_NATIVE_DOUBLE_KIND,
+ "Fortran_REAL_C_FLOAT128");
}
#endif
- else {
- /* Error: couldn't find a size for double_f */
- printf("Error: couldn't find a size for double_f \n");
- return -1;
- }
+ else {
+ /* Error: couldn't find a size for double_f */
+ printf("Error: couldn't find a size for double_f \n");
+ return -1;
+ }
- /* Need the buffer size for the fortran derived type 'hdset_reg_ref_t_f03'
- * in order to be interoperable with C's structure, the C buffer size
- * H5R_DSET_REG_REF_BUF_SIZE is (sizeof(haddr_t)+4)
- */
+ /* Need the buffer size for the fortran derived type 'hdset_reg_ref_t_f03'
+ * in order to be interoperable with C's structure, the C buffer size
+ * H5R_DSET_REG_REF_BUF_SIZE is (sizeof(haddr_t)+4)
+ */
- fprintf(fort_header, " INTEGER, PARAMETER :: H5R_DSET_REG_REF_BUF_SIZE_F = %u\n", H5_SIZEOF_HADDR_T + 4 );
+ fprintf(fort_header, " INTEGER, PARAMETER :: H5R_DSET_REG_REF_BUF_SIZE_F = %u\n",
+ H5_SIZEOF_HADDR_T + 4);
- /* Need the buffer size for the fortran derived type 'h5o_token_t'
- * in order to be interoperable with C's structure.
- */
+ /* Need the buffer size for the fortran derived type 'h5o_token_t'
+ * in order to be interoperable with C's structure.
+ */
fprintf(fort_header, " INTEGER, PARAMETER :: H5O_MAX_TOKEN_SIZE_F = %u\n", H5O_MAX_TOKEN_SIZE);
- /* Close files */
- endCfile();
- endFfile();
- fclose(c_header);
- fclose(fort_header);
+ /* Close files */
+ endCfile();
+ endFfile();
+ fclose(c_header);
+ fclose(fort_header);
- return 0;
+ return 0;
}
-
diff --git a/fortran/test/t.c b/fortran/test/t.c
index 107e8d5..26cb2c0 100644
--- a/fortran/test/t.c
+++ b/fortran/test/t.c
@@ -21,7 +21,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
-*/
+ */
#include "t.h"
#include "H5Eprivate.h"
@@ -40,34 +40,34 @@
* Modifications:
*---------------------------------------------------------------------------*/
int_f
-nh5_fixname_c(_fcd base_name, size_t_f *base_namelen, hid_t_f* fapl, _fcd full_name, size_t_f *full_namelen)
+nh5_fixname_c(_fcd base_name, size_t_f *base_namelen, hid_t_f *fapl, _fcd full_name, size_t_f *full_namelen)
{
- char *c_base_name = NULL;
- char *c_full_name = NULL;
- int_f ret_value = 0;
+ char *c_base_name = NULL;
+ char *c_full_name = NULL;
+ int_f ret_value = 0;
- /*
- * Convert FORTRAN name to C name
- */
- if(NULL == (c_base_name = (char *)HD5f2cstring(base_name, (size_t)*base_namelen)))
- HGOTO_DONE(FAIL)
- if(NULL == (c_full_name = (char *)HDmalloc((size_t)*full_namelen + 1)))
- HGOTO_DONE(FAIL)
+ /*
+ * Convert FORTRAN name to C name
+ */
+ if (NULL == (c_base_name = (char *)HD5f2cstring(base_name, (size_t)*base_namelen)))
+ HGOTO_DONE(FAIL)
+ if (NULL == (c_full_name = (char *)HDmalloc((size_t)*full_namelen + 1)))
+ HGOTO_DONE(FAIL)
- /*
- * Call h5_fixname function.
- */
- if(NULL == h5_fixname(c_base_name, (hid_t)*fapl, c_full_name, (size_t)*full_namelen + 1))
- HGOTO_DONE(FAIL)
- HD5packFstring(c_full_name, _fcdtocp(full_name), (size_t)*full_namelen);
+ /*
+ * Call h5_fixname function.
+ */
+ if (NULL == h5_fixname(c_base_name, (hid_t)*fapl, c_full_name, (size_t)*full_namelen + 1))
+ HGOTO_DONE(FAIL)
+ HD5packFstring(c_full_name, _fcdtocp(full_name), (size_t)*full_namelen);
done:
- if(c_base_name)
+ if (c_base_name)
HDfree(c_base_name);
- if(c_full_name)
+ if (c_full_name)
HDfree(c_full_name);
- return ret_value;
+ return ret_value;
}
/*----------------------------------------------------------------------------
@@ -82,40 +82,41 @@ done:
* Modifications:
*---------------------------------------------------------------------------*/
int_f
-nh5_cleanup_c(_fcd base_name, size_t_f *base_namelen, hid_t_f* fapl)
+nh5_cleanup_c(_fcd base_name, size_t_f *base_namelen, hid_t_f *fapl)
{
- char filename[1024];
- int ret_value = -1;
- char *c_base_name[1];
- hid_t c_fapl;
+ char filename[1024];
+ int ret_value = -1;
+ char *c_base_name[1];
+ hid_t c_fapl;
- /*
- * Define ifile access property list
- */
- c_fapl = (hid_t)*fapl;
- /*c_fapl = H5Pcreate(H5P_FILE_ACCESS);*/
- /*
- * Convert FORTRAN name to C name
- */
- c_base_name[0] = (char *)HD5f2cstring(base_name, (size_t)*base_namelen);
- if (c_base_name[0] == NULL) goto DONE;
+ /*
+ * Define ifile access property list
+ */
+ c_fapl = (hid_t)*fapl;
+ /*c_fapl = H5Pcreate(H5P_FILE_ACCESS);*/
+ /*
+ * Convert FORTRAN name to C name
+ */
+ c_base_name[0] = (char *)HD5f2cstring(base_name, (size_t)*base_namelen);
+ if (c_base_name[0] == NULL)
+ goto DONE;
- /*
- * Call h5_cleanup function.
- */
- /*if (h5_cleanup(c_base_name, c_fapl) != 0) {
- ret_value = 0;
- goto DONE;
- }
+ /*
+ * Call h5_cleanup function.
+ */
+ /*if (h5_cleanup(c_base_name, c_fapl) != 0) {
+ ret_value = 0;
+ goto DONE;
+ }
*/
- h5_fixname(c_base_name[0], c_fapl, filename, sizeof(filename));
- HDremove(filename);
- ret_value =0;
+ h5_fixname(c_base_name[0], c_fapl, filename, sizeof(filename));
+ HDremove(filename);
+ ret_value = 0;
DONE:
- if (NULL != c_base_name[0]) HDfree(c_base_name[0]);
- return ret_value;
-
+ if (NULL != c_base_name[0])
+ HDfree(c_base_name[0]);
+ return ret_value;
}
/*----------------------------------------------------------------------------
@@ -134,7 +135,7 @@ void
nh5_exit_c(int_f *status)
{
HDexit((int)*status);
-} /* h5_exit_c */
+} /* h5_exit_c */
/*----------------------------------------------------------------------------
* Name: h5_env_nocleanup_c
@@ -150,8 +151,7 @@ nh5_exit_c(int_f *status)
void
nh5_env_nocleanup_c(int_f *status)
{
- *status = (int_f)0;
- if (HDgetenv("HDF5_NOCLEANUP"))
- *status = (int_f)1;
-} /* h5_env_nocleanup_c */
-
+ *status = (int_f)0;
+ if (HDgetenv("HDF5_NOCLEANUP"))
+ *status = (int_f)1;
+} /* h5_env_nocleanup_c */
diff --git a/fortran/test/t.h b/fortran/test/t.h
index 81d2b5d..aa28ef1 100644
--- a/fortran/test/t.h
+++ b/fortran/test/t.h
@@ -21,20 +21,16 @@ char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
/*
* Functions from t.c
*/
-# define nh5_fixname_c H5_FC_FUNC_(h5_fixname_c, H5_FIXNAME_C)
-# define nh5_cleanup_c H5_FC_FUNC_(h5_cleanup_c, H5_CLEANUP_C)
-# define nh5_exit_c H5_FC_FUNC_(h5_exit_c, H5_EXIT_C)
-# define nh5_env_nocleanup_c H5_FC_FUNC_(h5_env_nocleanup_c, H5_ENV_NOCLEANUP_C)
+#define nh5_fixname_c H5_FC_FUNC_(h5_fixname_c, H5_FIXNAME_C)
+#define nh5_cleanup_c H5_FC_FUNC_(h5_cleanup_c, H5_CLEANUP_C)
+#define nh5_exit_c H5_FC_FUNC_(h5_exit_c, H5_EXIT_C)
+#define nh5_env_nocleanup_c H5_FC_FUNC_(h5_env_nocleanup_c, H5_ENV_NOCLEANUP_C)
-H5_FCTESTDLL int_f nh5_fixname_c
-(_fcd base_name, size_t_f *base_namelen, hid_t_f *fapl, _fcd full_name, size_t_f *full_namelen);
+H5_FCTESTDLL int_f nh5_fixname_c(_fcd base_name, size_t_f *base_namelen, hid_t_f *fapl, _fcd full_name,
+ size_t_f *full_namelen);
-H5_FCTESTDLL int_f nh5_cleanup_c
-(_fcd base_name, size_t_f *base_namelen, hid_t_f *fapl);
+H5_FCTESTDLL int_f nh5_cleanup_c(_fcd base_name, size_t_f *base_namelen, hid_t_f *fapl);
-H5_FCTESTDLL H5_ATTR_NORETURN void nh5_exit_c
-(int_f *status);
-
-H5_FCTESTDLL void nh5_env_nocleanup_c
-(int_f *status);
+H5_FCTESTDLL H5_ATTR_NORETURN void nh5_exit_c(int_f *status);
+H5_FCTESTDLL void nh5_env_nocleanup_c(int_f *status);
diff --git a/hl/c++/examples/ptExampleFL.cpp b/hl/c++/examples/ptExampleFL.cpp
index 26cbf09..d0b62da 100644
--- a/hl/c++/examples/ptExampleFL.cpp
+++ b/hl/c++/examples/ptExampleFL.cpp
@@ -22,56 +22,55 @@
*-------------------------------------------------------------------------
*/
-const char* FILE_NAME("PTcppexampleFL.h5");
-const char* PT_NAME("/examplePacketTable");
+const char *FILE_NAME("PTcppexampleFL.h5");
+const char *PT_NAME("/examplePacketTable");
-int main(void)
+int
+main(void)
{
- herr_t err; /* Return value from function calls */
- hid_t fileID; /* HDF5 identifier for file */
- hid_t plistID; /* HDF5 identifier for property list to use compression */
- hsize_t count; /* Number of records in table */
- int x; /* Temporary counter variable */
+ herr_t err; /* Return value from function calls */
+ hid_t fileID; /* HDF5 identifier for file */
+ hid_t plistID; /* HDF5 identifier for property list to use compression */
+ hsize_t count; /* Number of records in table */
+ int x; /* Temporary counter variable */
/* Buffers to hold data */
int readBuffer[5];
int writeBuffer[5];
/* Initialize buffers */
- for(x=0; x<5; x++)
- {
- writeBuffer[x]=x;
- readBuffer[x] = -1;
+ for (x = 0; x < 5; x++) {
+ writeBuffer[x] = x;
+ readBuffer[x] = -1;
}
/* Create a new HDF5 file */
fileID = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if(fileID <0)
+ if (fileID < 0)
fprintf(stderr, "Couldn't create file.\n");
/* Prepare property list to set compression, randomly use deflate
with compression level 5. */
plistID = H5Pcreate(H5P_DATASET_CREATE);
- err = H5Pset_deflate(plistID, 5);
- if(err < 0)
+ err = H5Pset_deflate(plistID, 5);
+ if (err < 0)
fprintf(stderr, "Error setting compression level.");
/* Create a fixed-length packet table. */
FL_PacketTable ptable(fileID, plistID, PT_NAME, H5T_NATIVE_INT, 100);
- if(! ptable.IsValid())
+ if (!ptable.IsValid())
fprintf(stderr, "Unable to create packet table.");
/* Append five packets to the packet table, one at a time */
- for(x=0; x<5; x++)
- {
- err = ptable.AppendPacket( &(writeBuffer[x]) );
- if(err<0)
+ for (x = 0; x < 5; x++) {
+ err = ptable.AppendPacket(&(writeBuffer[x]));
+ if (err < 0)
fprintf(stderr, "Error adding record.");
}
/* Get the number of packets in the packet table. This should be five. */
count = ptable.GetPacketCount(err);
- if(err < 0)
+ if (err < 0)
fprintf(stderr, "Error getting packet count.");
printf("Number of packets in packet table after five appends: %d\n", count);
@@ -80,10 +79,9 @@ int main(void)
ptable.ResetIndex();
/* Iterate through packets, read each one back */
- for(x=0; x<5; x++)
- {
- err = ptable.GetNextPacket( &(readBuffer[x]) );
- if(err < 0)
+ for (x = 0; x < 5; x++) {
+ err = ptable.GetNextPacket(&(readBuffer[x]));
+ if (err < 0)
fprintf(stderr, "Error reading record.");
printf("Packet %d's value is %d.\n", x, readBuffer[x]);
@@ -93,9 +91,8 @@ int main(void)
/* out of scope. */
err = H5Fclose(fileID);
- if( err < 0 )
+ if (err < 0)
fprintf(stderr, "Failed to close file.\n");
return 0;
}
-
diff --git a/hl/c++/src/H5PacketTable.cpp b/hl/c++/src/H5PacketTable.cpp
index 544df0b..1409048 100644
--- a/hl/c++/src/H5PacketTable.cpp
+++ b/hl/c++/src/H5PacketTable.cpp
@@ -24,257 +24,265 @@
#include "H5PacketTable.h"
- /********************************/
- /* PacketTable superclass */
- /********************************/
-
- /* "Open" Constructor
- * Opens an existing packet table, which can contain either fixed-length or
- * variable-length packets.
- */
- PacketTable::PacketTable(hid_t fileID, const char* name)
- {
- table_id = H5PTopen( fileID, name);
- }
-
- /* "Open" Constructor - will be deprecated because of char* name */
- PacketTable::PacketTable(hid_t fileID, char* name)
- {
- table_id = H5PTopen( fileID, name);
- }
-
- /* Destructor
- * Cleans up the packet table
- */
- PacketTable::~PacketTable()
- {
- H5PTclose( table_id);
- }
-
- /* IsValid
- * Returns true if this packet table is valid, false otherwise.
- * Use this after the constructor to ensure HDF did not have
- * any trouble making or opening the packet table.
- */
- bool PacketTable::IsValid()
- {
- if (H5PTis_valid(table_id) == 0)
- return true;
- else
- return false;
- }
-
- /* IsVariableLength
- * Return 1 if this packet table uses variable-length datatype,
- * and 0, otherwise. Returns -1 if the table is invalid (not open).
- */
- int PacketTable::IsVariableLength()
- {
- return H5PTis_varlen(table_id);
- }
-
- /* ResetIndex
- * Sets the index to point to the first packet in the packet table
- */
- void PacketTable::ResetIndex()
- {
- H5PTcreate_index(table_id);
- }
-
- /* SetIndex
- * Sets the index to point to the packet specified by index.
- * Returns 0 on success, negative on failure (if index is out of bounds)
- */
- int PacketTable::SetIndex(hsize_t index)
- {
- return H5PTset_index(table_id, index);
- }
-
- /* SetIndex
- * Sets the index to point to the packet specified by index.
- * Returns 0 on success, negative on failure (if index is out of bounds)
- */
- hsize_t PacketTable::GetIndex(int &error)
- {
- hsize_t index;
-
- error = H5PTget_index(table_id, &index);
- if(error < 0)
- return 0;
- else
- return index;
- }
-
- /* GetPacketCount
- * Returns the number of packets in the packet table. Error
- * is set to 0 on success. On failure, returns 0 and
- * error is set to negative.
- */
- hsize_t PacketTable::GetPacketCount(int& error)
- {
- hsize_t npackets;
-
- error = H5PTget_num_packets(table_id, &npackets);
- return npackets;
- }
-
- /* GetTableId
- * Returns the identifier of the packet table
- */
- hid_t PacketTable::GetTableId()
- {
- return table_id;
- }
-
- /* GetDatatype
- * Returns the datatype identifier used by the packet table, on success,
- * or H5I_INVALID_HID, on failure.
- * Note: it is best to avoid using this identifier in applications, unless
- * the desired functionality cannot be performed via the packet table ID.
- */
- hid_t PacketTable::GetDatatype()
- {
- return H5PTget_type(table_id);
- }
-
- /* GetDataset
- * Returns the dataset identifier associated with the packet table, on
- * success, or H5I_INVALID_HID, on failure.
- * Note: it is best to avoid using this identifier in applications, unless
- * the desired functionality cannot be performed via the packet table ID.
- */
- hid_t PacketTable::GetDataset()
- {
- return H5PTget_dataset(table_id);
- }
-
- /* FreeBuff
- * Frees the buffers created when variable-length packets are read.
- * Takes the number of hvl_t structs to be freed and a pointer to their
- * location in memory.
- * Returns 0 on success, negative on error.
- */
- int PacketTable::FreeBuff(size_t numStructs, hvl_t * buffer)
- {
- return H5PTfree_vlen_buff( table_id, numStructs, buffer);
- }
-
-
- /********************************/
- /* Fixed-Length Packet Table */
- /********************************/
-
- /* Constructor
- * Creates a packet table to store either fixed- or variable-length packets.
- * Takes the ID of the file the packet table will be created in, the ID of
- * the property list to specify compression, the name of the packet table,
- * the ID of the datatype, and the size of a memory chunk used in chunking.
- */
- FL_PacketTable::FL_PacketTable(hid_t fileID, const char* name, hid_t dtypeID, hsize_t chunkSize, hid_t plistID)
- {
- table_id = H5PTcreate(fileID, name, dtypeID, chunkSize, plistID);
- }
-
- /* Constructor - deprecated
- * Creates a packet table to store either fixed- or variable-length packets.
- * Takes the ID of the file the packet table will be created in, the ID of
- * the property list to specify compression, the name of the packet table,
- * the ID of the datatype, and the size of a memory chunk used in chunking.
- * Note: The above constructor has a better prototype, which allows default
- * values to be used. This constructor was only released in 1.10.0.
- */
- FL_PacketTable::FL_PacketTable(hid_t fileID, hid_t plistID, const char* name, hid_t dtypeID, hsize_t chunkSize)
- {
- table_id = H5PTcreate(fileID, name, dtypeID, chunkSize, plistID);
- }
-
- /* Constructor
- * Creates a packet table to store either fixed- or variable-length packets.
- * Takes the ID of the file the packet table will be created in, the name of
- * the packet table, the ID of the datatype of the set, and the size
- * of a memory chunk used in chunking.
- * Note: this overload will be deprecated in favor of the constructor above.
- */
- FL_PacketTable::FL_PacketTable(hid_t fileID, char* name, hid_t dtypeID, hsize_t chunkSize, int compression)
- {
- table_id = H5PTcreate_fl(fileID, name, dtypeID, chunkSize, compression);
- }
-
- /* "Open" Constructor
- * Opens an existing fixed-length packet table.
- * Fails if the packet table specified is variable-length.
- */
- FL_PacketTable::FL_PacketTable(hid_t fileID, const char* name) : PacketTable(fileID, name) {}
-
- /* "Open" Constructor - will be deprecated because of char* name */
- FL_PacketTable::FL_PacketTable(hid_t fileID, char* name) : PacketTable(fileID, name) {}
-
- /* AppendPacket
- * Adds a single packet to the packet table. Takes a pointer
- * to the location of the data in memory.
- * Returns 0 on success, negative on failure
- */
- int FL_PacketTable::AppendPacket(void * data)
- {
- return H5PTappend(table_id, 1, data);
- }
-
- /* AppendPackets (multiple packets)
- * Adds multiple packets to the packet table. Takes the number of packets
- * to be added and a pointer to their location in memory.
- * Returns 0 on success, -1 on failure.
- */
- int FL_PacketTable::AppendPackets(size_t numPackets, void * data)
- {
- return H5PTappend(table_id, numPackets, data);
- }
-
- /* GetPacket (indexed)
- * Gets a single packet from the packet table. Takes the index
- * of the packet (with 0 being the first packet) and a pointer
- * to memory where the data should be stored.
- * Returns 0 on success, negative on failure
- */
- int FL_PacketTable::GetPacket(hsize_t index, void * data)
- {
- return H5PTread_packets(table_id, index, 1, data);
- }
-
- /* GetPackets (multiple packets)
- * Gets multiple packets at once, all packets between
- * startIndex and endIndex inclusive. Also takes a pointer to
- * the memory where these packets should be stored.
- * Returns 0 on success, negative on failure.
- */
- int FL_PacketTable::GetPackets(hsize_t startIndex, hsize_t endIndex, void * data)
- {
- // Make sure the range of indexes is valid
- if (startIndex > endIndex)
- return -1;
-
- return H5PTread_packets(table_id, startIndex, (size_t)(endIndex-startIndex+1), data);
- }
-
- /* GetNextPacket (single packet)
- * Gets the next packet in the packet table. Takes a pointer to
- * memory where the packet should be stored.
- * Returns 0 on success, negative on failure. Index
- * is not advanced to the next packet on failure.
- */
- int FL_PacketTable::GetNextPacket(void * data)
- {
- return H5PTget_next(table_id, 1, data);
- }
-
- /* GetNextPackets (multiple packets)
- * Gets the next numPackets packets in the packet table. Takes a
- * pointer to memory where these packets should be stored.
- * Returns 0 on success, negative on failure. Index
- * is not advanced on failure.
- */
- int FL_PacketTable::GetNextPackets(size_t numPackets, void * data)
- {
- return H5PTget_next(table_id, numPackets, data);
- }
+/********************************/
+/* PacketTable superclass */
+/********************************/
+
+/* "Open" Constructor
+ * Opens an existing packet table, which can contain either fixed-length or
+ * variable-length packets.
+ */
+PacketTable::PacketTable(hid_t fileID, const char *name) { table_id = H5PTopen(fileID, name); }
+
+/* "Open" Constructor - will be deprecated because of char* name */
+PacketTable::PacketTable(hid_t fileID, char *name) { table_id = H5PTopen(fileID, name); }
+
+/* Destructor
+ * Cleans up the packet table
+ */
+PacketTable::~PacketTable() { H5PTclose(table_id); }
+
+/* IsValid
+ * Returns true if this packet table is valid, false otherwise.
+ * Use this after the constructor to ensure HDF did not have
+ * any trouble making or opening the packet table.
+ */
+bool
+PacketTable::IsValid()
+{
+ if (H5PTis_valid(table_id) == 0)
+ return true;
+ else
+ return false;
+}
+
+/* IsVariableLength
+ * Return 1 if this packet table uses variable-length datatype,
+ * and 0, otherwise. Returns -1 if the table is invalid (not open).
+ */
+int
+PacketTable::IsVariableLength()
+{
+ return H5PTis_varlen(table_id);
+}
+
+/* ResetIndex
+ * Sets the index to point to the first packet in the packet table
+ */
+void
+PacketTable::ResetIndex()
+{
+ H5PTcreate_index(table_id);
+}
+
+/* SetIndex
+ * Sets the index to point to the packet specified by index.
+ * Returns 0 on success, negative on failure (if index is out of bounds)
+ */
+int
+PacketTable::SetIndex(hsize_t index)
+{
+ return H5PTset_index(table_id, index);
+}
+
+/* SetIndex
+ * Sets the index to point to the packet specified by index.
+ * Returns 0 on success, negative on failure (if index is out of bounds)
+ */
+hsize_t
+PacketTable::GetIndex(int &error)
+{
+ hsize_t index;
+
+ error = H5PTget_index(table_id, &index);
+ if (error < 0)
+ return 0;
+ else
+ return index;
+}
+
+/* GetPacketCount
+ * Returns the number of packets in the packet table. Error
+ * is set to 0 on success. On failure, returns 0 and
+ * error is set to negative.
+ */
+hsize_t
+PacketTable::GetPacketCount(int &error)
+{
+ hsize_t npackets;
+
+ error = H5PTget_num_packets(table_id, &npackets);
+ return npackets;
+}
+
+/* GetTableId
+ * Returns the identifier of the packet table
+ */
+hid_t
+PacketTable::GetTableId()
+{
+ return table_id;
+}
+
+/* GetDatatype
+ * Returns the datatype identifier used by the packet table, on success,
+ * or H5I_INVALID_HID, on failure.
+ * Note: it is best to avoid using this identifier in applications, unless
+ * the desired functionality cannot be performed via the packet table ID.
+ */
+hid_t
+PacketTable::GetDatatype()
+{
+ return H5PTget_type(table_id);
+}
+
+/* GetDataset
+ * Returns the dataset identifier associated with the packet table, on
+ * success, or H5I_INVALID_HID, on failure.
+ * Note: it is best to avoid using this identifier in applications, unless
+ * the desired functionality cannot be performed via the packet table ID.
+ */
+hid_t
+PacketTable::GetDataset()
+{
+ return H5PTget_dataset(table_id);
+}
+
+/* FreeBuff
+ * Frees the buffers created when variable-length packets are read.
+ * Takes the number of hvl_t structs to be freed and a pointer to their
+ * location in memory.
+ * Returns 0 on success, negative on error.
+ */
+int
+PacketTable::FreeBuff(size_t numStructs, hvl_t *buffer)
+{
+ return H5PTfree_vlen_buff(table_id, numStructs, buffer);
+}
+
+/********************************/
+/* Fixed-Length Packet Table */
+/********************************/
+
+/* Constructor
+ * Creates a packet table to store either fixed- or variable-length packets.
+ * Takes the ID of the file the packet table will be created in, the ID of
+ * the property list to specify compression, the name of the packet table,
+ * the ID of the datatype, and the size of a memory chunk used in chunking.
+ */
+FL_PacketTable::FL_PacketTable(hid_t fileID, const char *name, hid_t dtypeID, hsize_t chunkSize,
+ hid_t plistID)
+{
+ table_id = H5PTcreate(fileID, name, dtypeID, chunkSize, plistID);
+}
+
+/* Constructor - deprecated
+ * Creates a packet table to store either fixed- or variable-length packets.
+ * Takes the ID of the file the packet table will be created in, the ID of
+ * the property list to specify compression, the name of the packet table,
+ * the ID of the datatype, and the size of a memory chunk used in chunking.
+ * Note: The above constructor has a better prototype, which allows default
+ * values to be used. This constructor was only released in 1.10.0.
+ */
+FL_PacketTable::FL_PacketTable(hid_t fileID, hid_t plistID, const char *name, hid_t dtypeID,
+ hsize_t chunkSize)
+{
+ table_id = H5PTcreate(fileID, name, dtypeID, chunkSize, plistID);
+}
+
+/* Constructor
+ * Creates a packet table to store either fixed- or variable-length packets.
+ * Takes the ID of the file the packet table will be created in, the name of
+ * the packet table, the ID of the datatype of the set, and the size
+ * of a memory chunk used in chunking.
+ * Note: this overload will be deprecated in favor of the constructor above.
+ */
+FL_PacketTable::FL_PacketTable(hid_t fileID, char *name, hid_t dtypeID, hsize_t chunkSize, int compression)
+{
+ table_id = H5PTcreate_fl(fileID, name, dtypeID, chunkSize, compression);
+}
+
+/* "Open" Constructor
+ * Opens an existing fixed-length packet table.
+ * Fails if the packet table specified is variable-length.
+ */
+FL_PacketTable::FL_PacketTable(hid_t fileID, const char *name) : PacketTable(fileID, name) {}
+
+/* "Open" Constructor - will be deprecated because of char* name */
+FL_PacketTable::FL_PacketTable(hid_t fileID, char *name) : PacketTable(fileID, name) {}
+
+/* AppendPacket
+ * Adds a single packet to the packet table. Takes a pointer
+ * to the location of the data in memory.
+ * Returns 0 on success, negative on failure
+ */
+int
+FL_PacketTable::AppendPacket(void *data)
+{
+ return H5PTappend(table_id, 1, data);
+}
+
+/* AppendPackets (multiple packets)
+ * Adds multiple packets to the packet table. Takes the number of packets
+ * to be added and a pointer to their location in memory.
+ * Returns 0 on success, -1 on failure.
+ */
+int
+FL_PacketTable::AppendPackets(size_t numPackets, void *data)
+{
+ return H5PTappend(table_id, numPackets, data);
+}
+
+/* GetPacket (indexed)
+ * Gets a single packet from the packet table. Takes the index
+ * of the packet (with 0 being the first packet) and a pointer
+ * to memory where the data should be stored.
+ * Returns 0 on success, negative on failure
+ */
+int
+FL_PacketTable::GetPacket(hsize_t index, void *data)
+{
+ return H5PTread_packets(table_id, index, 1, data);
+}
+
+/* GetPackets (multiple packets)
+ * Gets multiple packets at once, all packets between
+ * startIndex and endIndex inclusive. Also takes a pointer to
+ * the memory where these packets should be stored.
+ * Returns 0 on success, negative on failure.
+ */
+int
+FL_PacketTable::GetPackets(hsize_t startIndex, hsize_t endIndex, void *data)
+{
+ // Make sure the range of indexes is valid
+ if (startIndex > endIndex)
+ return -1;
+
+ return H5PTread_packets(table_id, startIndex, (size_t)(endIndex - startIndex + 1), data);
+}
+
+/* GetNextPacket (single packet)
+ * Gets the next packet in the packet table. Takes a pointer to
+ * memory where the packet should be stored.
+ * Returns 0 on success, negative on failure. Index
+ * is not advanced to the next packet on failure.
+ */
+int
+FL_PacketTable::GetNextPacket(void *data)
+{
+ return H5PTget_next(table_id, 1, data);
+}
+
+/* GetNextPackets (multiple packets)
+ * Gets the next numPackets packets in the packet table. Takes a
+ * pointer to memory where these packets should be stored.
+ * Returns 0 on success, negative on failure. Index
+ * is not advanced on failure.
+ */
+int
+FL_PacketTable::GetNextPackets(size_t numPackets, void *data)
+{
+ return H5PTget_next(table_id, numPackets, data);
+}
/* Removed "ifdef VLPT_REMOVED" block. 03/08/2016, -BMR */
diff --git a/hl/c++/src/H5PacketTable.h b/hl/c++/src/H5PacketTable.h
index 2665984..400ea52 100644
--- a/hl/c++/src/H5PacketTable.h
+++ b/hl/c++/src/H5PacketTable.h
@@ -28,22 +28,21 @@
#include "H5PTpublic.h"
#include "H5api_adpt.h"
-class H5_HLCPPDLL PacketTable
-{
-public:
+class H5_HLCPPDLL PacketTable {
+ public:
/* Null constructor
* Sets table_id to "invalid"
*/
- PacketTable() {table_id = H5I_BADID;}
+ PacketTable() { table_id = H5I_BADID; }
/* "Open" Constructor
* Opens an existing packet table, which can contain either fixed-length or
* variable-length packets.
*/
- PacketTable(hid_t fileID, const char* name);
+ PacketTable(hid_t fileID, const char *name);
/* "Open" Constructor - will be deprecated because of char* name */
- PacketTable(hid_t fileID, char* name);
+ PacketTable(hid_t fileID, char *name);
/* Destructor
* Cleans up the packet table
@@ -80,16 +79,17 @@ public:
* Returns the position of the current packet.
* On failure, returns 0 and error is set to negative.
*/
- hsize_t GetIndex(int& error);
+ hsize_t GetIndex(int &error);
/* GetPacketCount
* Returns the number of packets in the packet table. Error
* is set to 0 on success. On failure, returns 0 and
* error is set to negative.
*/
- hsize_t GetPacketCount(int& error);
+ hsize_t GetPacketCount(int &error);
- hsize_t GetPacketCount()
+ hsize_t
+ GetPacketCount()
{
int ignoreError;
return GetPacketCount(ignoreError);
@@ -122,22 +122,22 @@ public:
* location in memory.
* Returns 0 on success, negative on error.
*/
- int FreeBuff(size_t numStructs, hvl_t * buffer);
+ int FreeBuff(size_t numStructs, hvl_t *buffer);
-protected:
+ protected:
hid_t table_id;
};
-class H5_HLCPPDLL FL_PacketTable : virtual public PacketTable
-{
-public:
+class H5_HLCPPDLL FL_PacketTable : virtual public PacketTable {
+ public:
/* Constructor
* Creates a packet table to store either fixed- or variable-length packets.
* Takes the ID of the file the packet table will be created in, the ID of
* the property list to specify compression, the name of the packet table,
* the ID of the datatype, and the size of a memory chunk used in chunking.
*/
- FL_PacketTable(hid_t fileID, const char* name, hid_t dtypeID, hsize_t chunkSize = 0, hid_t plistID = H5P_DEFAULT);
+ FL_PacketTable(hid_t fileID, const char *name, hid_t dtypeID, hsize_t chunkSize = 0,
+ hid_t plistID = H5P_DEFAULT);
/* Constructors - deprecated
* Creates a packet table in which to store fixed length packets.
@@ -148,36 +148,36 @@ public:
* Note: these overloaded constructors will be deprecated in favor of the
* constructor above.
*/
- FL_PacketTable(hid_t fileID, hid_t plist_id, const char* name, hid_t dtypeID, hsize_t chunkSize);
- FL_PacketTable(hid_t fileID, char* name, hid_t dtypeID, hsize_t chunkSize, int compression = 0);
+ FL_PacketTable(hid_t fileID, hid_t plist_id, const char *name, hid_t dtypeID, hsize_t chunkSize);
+ FL_PacketTable(hid_t fileID, char *name, hid_t dtypeID, hsize_t chunkSize, int compression = 0);
/* "Open" Constructor
* Opens an existing fixed-length packet table.
* Fails if the packet table specified is variable-length.
*/
- FL_PacketTable(hid_t fileID, const char* name);
+ FL_PacketTable(hid_t fileID, const char *name);
/* "Open" Constructor - will be deprecated because of char* name */
- FL_PacketTable(hid_t fileID, char* name);
+ FL_PacketTable(hid_t fileID, char *name);
/* Destructor
* Cleans up the packet table
*/
- virtual ~FL_PacketTable() {};
+ virtual ~FL_PacketTable(){};
/* AppendPacket
* Adds a single packet to the packet table. Takes a pointer
* to the location of the data in memory.
* Returns 0 on success, negative on failure
*/
- int AppendPacket(void * data);
+ int AppendPacket(void *data);
/* AppendPackets (multiple packets)
* Adds multiple packets to the packet table. Takes the number of packets
* to be added and a pointer to their location in memory.
* Returns 0 on success, -1 on failure.
*/
- int AppendPackets(size_t numPackets, void * data);
+ int AppendPackets(size_t numPackets, void *data);
/* GetPacket (indexed)
* Gets a single packet from the packet table. Takes the index
@@ -185,7 +185,7 @@ public:
* to memory where the data should be stored.
* Returns 0 on success, negative on failure
*/
- int GetPacket(hsize_t index, void * data);
+ int GetPacket(hsize_t index, void *data);
/* GetPackets (multiple packets)
* Gets multiple packets at once, all packets between
@@ -193,7 +193,7 @@ public:
* the memory where these packets should be stored.
* Returns 0 on success, negative on failure.
*/
- int GetPackets(hsize_t startIndex, hsize_t endIndex, void * data);
+ int GetPackets(hsize_t startIndex, hsize_t endIndex, void *data);
/* GetNextPacket (single packet)
* Gets the next packet in the packet table. Takes a pointer to
@@ -201,7 +201,7 @@ public:
* Returns 0 on success, negative on failure. Index
* is not advanced to the next packet on failure.
*/
- int GetNextPacket(void * data);
+ int GetNextPacket(void *data);
/* GetNextPackets (multiple packets)
* Gets the next numPackets packets in the packet table. Takes a
@@ -209,7 +209,7 @@ public:
* Returns 0 on success, negative on failure. Index
* is not advanced on failure.
*/
- int GetNextPackets(size_t numPackets, void * data);
+ int GetNextPackets(size_t numPackets, void *data);
};
/* Removed "#ifdef VLPT_REMOVED" block. 03/08/2016, -BMR */
diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp
index 52f3a6b..57a28b8 100644
--- a/hl/c++/test/ptableTest.cpp
+++ b/hl/c++/test/ptableTest.cpp
@@ -22,41 +22,40 @@ using namespace std;
#define TEST_FILE "packettest.h5"
/* Main test function */
-int main(void)
+int
+main(void)
{
herr_t err;
herr_t num_errors = 0;
/* Create new HDF5 file */
fileID = H5Fcreate(TEST_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if(fileID <0)
- {
+ if (fileID < 0) {
fprintf(stderr, "Couldn't create file.\n");
num_errors = 1;
}
else {
- num_errors += BasicTest();
+ num_errors += BasicTest();
- num_errors += TestCompoundDatatype();
+ num_errors += TestCompoundDatatype();
- num_errors += TestGetPacket();
+ num_errors += TestGetPacket();
- num_errors += TestGetNext();
+ num_errors += TestGetNext();
- num_errors += TestCompress();
+ num_errors += TestCompress();
- num_errors += TestErrors();
+ num_errors += TestErrors();
- num_errors += SystemTest();
+ num_errors += SystemTest();
- /* Test data corruption in packed structs */
- num_errors += TestHDFFV_9758();
+ /* Test data corruption in packed structs */
+ num_errors += TestHDFFV_9758();
/* Terminate access to the file. */
err = H5Fclose(fileID);
- if( err < 0 )
- {
+ if (err < 0) {
fprintf(stderr, "Failed to close file.\n");
num_errors++;
}
@@ -66,38 +65,39 @@ int main(void)
}
if (num_errors == 0)
- /* ALL TESTS PASSED */
- return 0;
+ /* ALL TESTS PASSED */
+ return 0;
else
- /* ERRORS */
- return -1;
+ /* ERRORS */
+ return -1;
}
-const char* BASICTEST_PT("/basicTest");
-int BasicTest()
+const char *BASICTEST_PT("/basicTest");
+int
+BasicTest()
{
- herr_t err;
- int myRecord;
+ herr_t err;
+ int myRecord;
hsize_t count;
- int error;
+ int error;
printf("Testing %-62s", "basic functionality");
HDfflush(stdout);
FL_PacketTable wrapper(fileID, H5P_DEFAULT, BASICTEST_PT, H5T_NATIVE_INT, 1);
- if(! wrapper.IsValid())
- goto error;
+ if (!wrapper.IsValid())
+ goto error;
/* Ensure initial count is zero */
count = wrapper.GetPacketCount(error);
- if(count != 0 || error != 0)
- goto error;
+ if (count != 0 || error != 0)
+ goto error;
myRecord = 1;
/* add some records test */
err = wrapper.AppendPacket(&myRecord);
- if(err < 0)
+ if (err < 0)
goto error;
myRecord = 2;
@@ -106,22 +106,22 @@ int BasicTest()
/* get number of records test */
count = wrapper.GetPacketCount();
- if(count != 2)
- goto error;
+ if (count != 2)
+ goto error;
/* get records test */
err = wrapper.GetPacket(0, &myRecord);
- if(err < 0)
- goto error;
+ if (err < 0)
+ goto error;
- if(myRecord != 1)
- goto error;
+ if (myRecord != 1)
+ goto error;
err = wrapper.GetPacket(1, &myRecord);
- if(err < 0)
- goto error;
- if(myRecord != 2)
- goto error;
+ if (err < 0)
+ goto error;
+ if (myRecord != 2)
+ goto error;
PASSED();
return 0;
@@ -131,58 +131,58 @@ error:
return 1;
}
-const char* CMPDTEST_PT("/compoundTest");
-int TestCompoundDatatype()
+const char *CMPDTEST_PT("/compoundTest");
+int
+TestCompoundDatatype()
{
- hid_t dtypeID;
+ hid_t dtypeID;
hsize_t count;
- int error;
+ int error;
printf("Testing %-62s", "compound datatypes");
HDfflush(stdout);
/* Create compound datatype */
- typedef struct
- {
+ typedef struct {
short a, b, c;
- int e;
+ int e;
} compoundType;
- dtypeID = H5Tcreate( H5T_COMPOUND, sizeof(compoundType));
+ dtypeID = H5Tcreate(H5T_COMPOUND, sizeof(compoundType));
- H5Tinsert(dtypeID, "abbey", HOFFSET( compoundType, a ), H5T_NATIVE_SHORT);
- H5Tinsert(dtypeID, "bert", HOFFSET( compoundType, b ), H5T_NATIVE_SHORT);
- H5Tinsert(dtypeID, "charlie", HOFFSET( compoundType, c ), H5T_NATIVE_SHORT);
- H5Tinsert(dtypeID, "ebert", HOFFSET( compoundType, e ), H5T_NATIVE_INT);
+ H5Tinsert(dtypeID, "abbey", HOFFSET(compoundType, a), H5T_NATIVE_SHORT);
+ H5Tinsert(dtypeID, "bert", HOFFSET(compoundType, b), H5T_NATIVE_SHORT);
+ H5Tinsert(dtypeID, "charlie", HOFFSET(compoundType, c), H5T_NATIVE_SHORT);
+ H5Tinsert(dtypeID, "ebert", HOFFSET(compoundType, e), H5T_NATIVE_INT);
/* Create packet table using default property list. */
FL_PacketTable wrapper(fileID, H5P_DEFAULT, CMPDTEST_PT, dtypeID, 1);
- if(! wrapper.IsValid())
- goto error;
+ if (!wrapper.IsValid())
+ goto error;
compoundType first;
first.a = 1;
first.b = first.c = 3;
- first.e = 5;
+ first.e = 5;
/* Write packet */
wrapper.AppendPacket(&first);
count = wrapper.GetPacketCount(error);
- if(count != 1)
- goto error;
+ if (count != 1)
+ goto error;
first.a = first.b = first.c = 0;
- first.e = 0;
+ first.e = 0;
/* Read packet back */
wrapper.GetPacket(0, &first);
- if(first.a != 1)
- goto error;
- if(first.e != 5)
- goto error;
+ if (first.a != 1)
+ goto error;
+ if (first.e != 5)
+ goto error;
PASSED();
@@ -191,17 +191,16 @@ int TestCompoundDatatype()
error:
- H5E_BEGIN_TRY {
- H5Tclose(dtypeID);
- } H5E_END_TRY;
-
+ H5E_BEGIN_TRY { H5Tclose(dtypeID); }
+ H5E_END_TRY;
H5_FAILED();
return 1;
}
-const char* GETNEXT_PT("/TestGetNext");
-int TestGetNext()
+const char *GETNEXT_PT("/TestGetNext");
+int
+TestGetNext()
{
int error;
int record;
@@ -214,47 +213,49 @@ int TestGetNext()
/* Create a dataset */
FL_PacketTable wrapper(fileID, H5P_DEFAULT, GETNEXT_PT, H5T_NATIVE_INT, 500);
- if(! wrapper.IsValid())
- goto error;
+ if (!wrapper.IsValid())
+ goto error;
/* Append 5 records to the dataset */
- for(record = 1; record < 6; record++)
+ for (record = 1; record < 6; record++)
wrapper.AppendPacket(&record);
/* Ensure that we can interate through the records and get the right ones */
- for(i = 1; i < 6; i++)
- {
+ for (i = 1; i < 6; i++) {
wrapper.GetNextPacket(&record);
- if(record != i)
- goto error;
+ if (record != i)
+ goto error;
}
/* Reset the index and check that it worked */
wrapper.ResetIndex();
- if(wrapper.GetIndex(error) != 0) goto error;
- if(error < 0) goto error;
+ if (wrapper.GetIndex(error) != 0)
+ goto error;
+ if (error < 0)
+ goto error;
/* Ensure that we can interate through the records and get the right ones */
- for(i = 1; i < 6; i++)
- {
+ for (i = 1; i < 6; i++) {
error = wrapper.GetNextPacket(&record);
- if(record != i || error <0)
- goto error;
+ if (record != i || error < 0)
+ goto error;
}
wrapper.SetIndex(1);
- if(wrapper.GetIndex(error) != 1) goto error;
- if(error < 0) goto error;
+ if (wrapper.GetIndex(error) != 1)
+ goto error;
+ if (error < 0)
+ goto error;
/* Ensure we can get multiple records with our index pointer */
wrapper.GetNextPackets(2, records);
- if(records[0] != 2 || records[1] != 3)
- goto error;
+ if (records[0] != 2 || records[1] != 3)
+ goto error;
/* Ensure our pointer was updated correctly */
wrapper.GetNextPacket(&record);
- if(record != 4)
- goto error;
+ if (record != 4)
+ goto error;
PASSED();
return 0;
@@ -264,28 +265,29 @@ error:
return 1;
}
-const char* COMPRESS_PT("/compressTest");
-int TestCompress()
+const char *COMPRESS_PT("/compressTest");
+int
+TestCompress()
{
#ifdef H5_HAVE_FILTER_DEFLATE
- unsigned int flags = 0;
- unsigned int config = 0;
- size_t cd_nelemts = 0;
+ unsigned int flags = 0;
+ unsigned int config = 0;
+ size_t cd_nelemts = 0;
printf("Testing %-62s", "compression");
HDfflush(stdout);
try {
- /* Prepare property list to set compression, randomly use deflate */
- DSetCreatPropList dscreatplist;
- dscreatplist.setDeflate(6);
+ /* Prepare property list to set compression, randomly use deflate */
+ DSetCreatPropList dscreatplist;
+ dscreatplist.setDeflate(6);
/* Create packet table with compression. */
FL_PacketTable wrapper(fileID, COMPRESS_PT, H5T_NATIVE_CHAR, 100, dscreatplist.getId());
- /* Close the property list */
- dscreatplist.close();
+ /* Close the property list */
+ dscreatplist.close();
- /* Verify that the deflate filter is set */
+ /* Verify that the deflate filter is set */
/* Create an HDF5 C++ file object */
H5File file;
@@ -297,13 +299,14 @@ int TestCompress()
DSetCreatPropList dcpl = dset.getCreatePlist();
- char filter_name[8];
+ char filter_name[8];
dcpl.getFilterById(H5Z_FILTER_DEFLATE, flags, cd_nelemts, NULL, 8, filter_name, config);
- if (HDstrncmp(filter_name, "deflate", 7) != 0)
- H5_FAILED()
- } catch (Exception e) {
- H5_FAILED();
- return 1;
+ if (HDstrncmp(filter_name, "deflate", 7) != 0)
+ H5_FAILED()
+ }
+ catch (Exception e) {
+ H5_FAILED();
+ return 1;
}
PASSED();
#else
@@ -313,8 +316,9 @@ int TestCompress()
return 0;
}
-const char* PT_TESTGETPT = "/TestGetPacket";
-int TestGetPacket()
+const char *PT_TESTGETPT = "/TestGetPacket";
+int
+TestGetPacket()
{
int record;
int theRecs[3];
@@ -326,24 +330,23 @@ int TestGetPacket()
there is no compression. */
FL_PacketTable wrapper(fileID, PT_TESTGETPT, H5T_NATIVE_INT, 1);
- if(! wrapper.IsValid())
- goto error;
+ if (!wrapper.IsValid())
+ goto error;
/* Append 5 records to the dataset */
- for(record = 1; record < 6; record++)
+ for (record = 1; record < 6; record++)
wrapper.AppendPacket(&record);
/* Ensure that the records were written properly */
wrapper.GetPacket(1, &record);
- if(record != 2)
- goto error;
+ if (record != 2)
+ goto error;
/* Ensure that we can retrieve multiple records */
wrapper.GetPackets(1, 3, theRecs);
- for(i = 0; i < 3; i++)
- {
- if(theRecs[i] != i+2)
- goto error;
+ for (i = 0; i < 3; i++) {
+ if (theRecs[i] != i + 2)
+ goto error;
}
PASSED();
@@ -354,9 +357,10 @@ error:
return 1;
}
-const char* PT_TESTERROR = "/TestErrors";
+const char *PT_TESTERROR = "/TestErrors";
-int TestErrors()
+int
+TestErrors()
{
printf("Testing %-62s", "error conditions");
HDfflush(stdout);
@@ -364,99 +368,105 @@ int TestErrors()
/* Create a dataset */
FL_PacketTable wrapper(fileID, PT_TESTERROR, H5T_NATIVE_INT, 1);
- if(! wrapper.IsValid())
- goto error;
+ if (!wrapper.IsValid())
+ goto error;
int record;
int records[3];
int error;
/* Append 4 records to the dataset */
- for(record = 1; record < 5; record++)
+ for (record = 1; record < 5; record++)
wrapper.AppendPacket(&record);
/* Try to confuse functions with bad indexes */
error = wrapper.GetPacket(static_cast<unsigned>(-1), &record);
- if(error >= 0)
- goto error;
+ if (error >= 0)
+ goto error;
error = wrapper.GetPacket(4, &record);
- if(error >= 0)
- goto error;
+ if (error >= 0)
+ goto error;
error = wrapper.GetPacket(static_cast<unsigned>(-250), &record);
- if(error >= 0)
- goto error;
+ if (error >= 0)
+ goto error;
error = wrapper.GetPacket(3000, &record);
- if(error >= 0)
- goto error;
+ if (error >= 0)
+ goto error;
error = wrapper.GetPacket(1, &record);
- if(error < 0)
- goto error;
+ if (error < 0)
+ goto error;
error = wrapper.GetPackets(static_cast<unsigned>(-1), 1, records);
- if(error >= 0)
- goto error;
+ if (error >= 0)
+ goto error;
error = wrapper.GetPackets(2, 4, records);
- if(error >= 0)
- goto error;
+ if (error >= 0)
+ goto error;
error = wrapper.GetPackets(static_cast<unsigned>(-60), static_cast<unsigned>(-62), records);
- if(error >= 0)
- goto error;
+ if (error >= 0)
+ goto error;
error = wrapper.GetPackets(10, 12, records);
- if(error >= 0)
- goto error;
+ if (error >= 0)
+ goto error;
error = wrapper.GetPackets(0, 2, records);
- if(error < 0)
- goto error;
+ if (error < 0)
+ goto error;
error = wrapper.GetPackets(2, 0, records);
- if(error >= 0)
- goto error;
+ if (error >= 0)
+ goto error;
error = wrapper.GetPackets(1, 1, records);
- if(error < 0)
- goto error;
+ if (error < 0)
+ goto error;
error = wrapper.GetPackets(1, 3, records);
- if(error < 0)
- goto error;
+ if (error < 0)
+ goto error;
wrapper.ResetIndex();
error = wrapper.SetIndex(static_cast<unsigned>(-1));
- if(error >= 0)
- goto error;
- if(wrapper.GetIndex(error) != 0) goto error;
- if(error < 0) goto error;
+ if (error >= 0)
+ goto error;
+ if (wrapper.GetIndex(error) != 0)
+ goto error;
+ if (error < 0)
+ goto error;
error = wrapper.GetNextPacket(&record);
- if(error < 0)
- goto error;
- if(record != 1)
- goto error;
- if(wrapper.GetIndex(error) != 1) goto error;
- if(error < 0) goto error;
+ if (error < 0)
+ goto error;
+ if (record != 1)
+ goto error;
+ if (wrapper.GetIndex(error) != 1)
+ goto error;
+ if (error < 0)
+ goto error;
error = wrapper.SetIndex(20);
- if(error >= 0)
- goto error;
+ if (error >= 0)
+ goto error;
error = wrapper.GetNextPacket(&record);
- if(error < 0)
- goto error;
- if(record != 2)
- goto error;
+ if (error < 0)
+ goto error;
+ if (record != 2)
+ goto error;
wrapper.SetIndex(3);
error = wrapper.GetNextPacket(&record);
- if(error < 0)
- goto error;
- if(record != 4)
- goto error;
- if(wrapper.GetIndex(error) != 4) goto error;
- if(error < 0) goto error;
+ if (error < 0)
+ goto error;
+ if (record != 4)
+ goto error;
+ if (wrapper.GetIndex(error) != 4)
+ goto error;
+ if (error < 0)
+ goto error;
error = wrapper.GetNextPacket(&record);
- if(error >= 0)
- goto error;
+ if (error >= 0)
+ goto error;
wrapper.ResetIndex();
error = wrapper.GetNextPackets(10, records);
- if(error >= 0)
- goto error;
+ if (error >= 0)
+ goto error;
error = wrapper.GetNextPackets(0, records);
- if(error < 0)
- goto error;
+ if (error < 0)
+ goto error;
PASSED();
return 0;
@@ -466,45 +476,44 @@ error:
return 1;
}
-const char* PT_SYSTEMTST1 = "/SystemTest1";
-const char* PT_SYSTEMTST2 = "/SystemTest2";
-int SystemTest()
+const char *PT_SYSTEMTST1 = "/SystemTest1";
+const char *PT_SYSTEMTST2 = "/SystemTest2";
+int
+SystemTest()
{
printf("Testing %-62s", "multiple datatypes");
HDfflush(stdout);
- hid_t dtypeID1, dtypeID2;
+ hid_t dtypeID1, dtypeID2;
hsize_t count;
- int error;
+ int error;
/* Creating two inter-related datatypes. Create two datasets and put
* one datatype in each. */
- typedef struct
- {
+ typedef struct {
short a, b, c;
- int e;
+ int e;
} compoundType;
dtypeID1 = H5Tcreate(H5T_COMPOUND, sizeof(compoundType));
- H5Tinsert(dtypeID1, "abbey", HOFFSET( compoundType, a ), H5T_NATIVE_SHORT);
- H5Tinsert(dtypeID1, "bert", HOFFSET( compoundType, b ), H5T_NATIVE_SHORT);
- H5Tinsert(dtypeID1, "charlie", HOFFSET( compoundType, c ), H5T_NATIVE_SHORT);
- H5Tinsert(dtypeID1, "ebert", HOFFSET( compoundType, e ), H5T_NATIVE_INT);
+ H5Tinsert(dtypeID1, "abbey", HOFFSET(compoundType, a), H5T_NATIVE_SHORT);
+ H5Tinsert(dtypeID1, "bert", HOFFSET(compoundType, b), H5T_NATIVE_SHORT);
+ H5Tinsert(dtypeID1, "charlie", HOFFSET(compoundType, c), H5T_NATIVE_SHORT);
+ H5Tinsert(dtypeID1, "ebert", HOFFSET(compoundType, e), H5T_NATIVE_INT);
- typedef struct
- {
- char f;
+ typedef struct {
+ char f;
compoundType g;
} cType2;
dtypeID2 = H5Tcreate(H5T_COMPOUND, sizeof(cType2));
- H5Tinsert(dtypeID2, "f", HOFFSET( cType2, f ), H5T_NATIVE_CHAR);
- H5Tinsert(dtypeID2, "g", HOFFSET( cType2, g ), dtypeID1);
+ H5Tinsert(dtypeID2, "f", HOFFSET(cType2, f), H5T_NATIVE_CHAR);
+ H5Tinsert(dtypeID2, "g", HOFFSET(cType2, g), dtypeID1);
cType2 ct2[10];
- ct2[0].f = 'h';
+ ct2[0].f = 'h';
ct2[0].g.a = 9;
ct2[0].g.b = -13;
ct2[0].g.c = 0;
@@ -514,17 +523,17 @@ int SystemTest()
FL_PacketTable wrapper1(fileID, PT_SYSTEMTST1, dtypeID1, 1);
FL_PacketTable wrapper2(fileID, H5P_DEFAULT, PT_SYSTEMTST2, dtypeID2, 1);
- if(! wrapper1.IsValid())
- goto error;
- if(! wrapper2.IsValid())
- goto error;
+ if (!wrapper1.IsValid())
+ goto error;
+ if (!wrapper2.IsValid())
+ goto error;
/* Write and read packets, ensure that nothing is unusual */
wrapper2.AppendPacket(ct2);
count = wrapper1.GetPacketCount();
- if(count != 0)
- goto error;
+ if (count != 0)
+ goto error;
compoundType ct1[10];
ct1[0].a = 31;
@@ -541,13 +550,17 @@ int SystemTest()
wrapper1.ResetIndex();
wrapper1.GetNextPacket(&ct1[1]);
wrapper2.GetPacket(1, &ct2[2]);
- if(wrapper1.GetIndex(error) != 1) goto error;
- if(error < 0) goto error;
- if(wrapper2.GetIndex(error) != 0) goto error;
- if(error < 0) goto error;
+ if (wrapper1.GetIndex(error) != 1)
+ goto error;
+ if (error < 0)
+ goto error;
+ if (wrapper2.GetIndex(error) != 0)
+ goto error;
+ if (error < 0)
+ goto error;
- if(ct1[1].b != ct2[2].g.b)
- goto error;
+ if (ct1[1].b != ct2[2].g.b)
+ goto error;
H5Tclose(dtypeID1);
H5Tclose(dtypeID2);
@@ -556,10 +569,12 @@ int SystemTest()
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(dtypeID1);
H5Tclose(dtypeID2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return 1;
@@ -580,33 +595,32 @@ error:
* 2016/10/25 -BMR
*-------------------------------------------------------------------------
*/
-#pragma pack() // default alignment
-const char* ABHI_PT("/abhiTest");
-const hsize_t NUM_PACKETS = 5;
-const int STRING_LENGTH = 19; // including terminating NULL
-int TestHDFFV_9758()
+#pragma pack() // default alignment
+const char * ABHI_PT("/abhiTest");
+const hsize_t NUM_PACKETS = 5;
+const int STRING_LENGTH = 19; // including terminating NULL
+int
+TestHDFFV_9758()
{
- hid_t strtype;
- hid_t compound_type;
+ hid_t strtype;
+ hid_t compound_type;
herr_t err;
- struct s1_t
- {
- int a;
- float b;
+ struct s1_t {
+ int a;
+ float b;
double c;
- char d[STRING_LENGTH]; // null terminated string
- int e;
+ char d[STRING_LENGTH]; // null terminated string
+ int e;
};
s1_t s1[NUM_PACKETS];
- for (hsize_t i = 0; i < NUM_PACKETS; i++)
- {
+ for (hsize_t i = 0; i < NUM_PACKETS; i++) {
s1[i].a = i;
s1[i].b = 1.f * static_cast<float>(i * i);
s1[i].c = 1. / (i + 1);
HDsprintf(s1[i].d, "string%d", (int)i);
- s1[i].e = 100+i;
+ s1[i].e = 100 + i;
}
printf("Testing %-62s", "data corruption in packed structs (HDFFV-9758)");
@@ -615,73 +629,70 @@ int TestHDFFV_9758()
// Build a compound datatype
compound_type = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
if (compound_type < 0)
- goto error;
+ goto error;
err = H5Tinsert(compound_type, "a_name", HOFFSET(s1_t, a), H5T_NATIVE_INT);
if (err < 0)
- goto error;
+ goto error;
err = H5Tinsert(compound_type, "b_name", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT);
if (err < 0)
- goto error;
+ goto error;
err = H5Tinsert(compound_type, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE);
if (err < 0)
- goto error;
+ goto error;
- strtype = H5Tcopy (H5T_C_S1);
+ strtype = H5Tcopy(H5T_C_S1);
if (compound_type < 0)
- goto error;
- err = H5Tset_size (strtype, STRING_LENGTH); /* create string */
+ goto error;
+ err = H5Tset_size(strtype, STRING_LENGTH); /* create string */
if (err < 0)
- goto error;
+ goto error;
err = H5Tinsert(compound_type, "d_name", HOFFSET(s1_t, d), strtype);
if (err < 0)
- goto error;
+ goto error;
err = H5Tinsert(compound_type, "e_name", HOFFSET(s1_t, e), H5T_NATIVE_INT);
if (err < 0)
- goto error;
+ goto error;
{ // so ptable will go out of scope before PASSED
- // Create a packet table
- FL_PacketTable ptable(fileID, "/examplePacketTable", compound_type, 1);
- if (!ptable.IsValid())
- goto error;
-
- // Add packets to the table
- for (size_t i = 0; i < NUM_PACKETS; i++)
- {
- /* Appends one packet at the current position */
- err = ptable.AppendPacket(s1 + i);
- if (err < 0) goto error;
- }
-
- // Check packet count
- const hsize_t count = ptable.GetPacketCount(err);
- if (err < 0)
- goto error;
+ // Create a packet table
+ FL_PacketTable ptable(fileID, "/examplePacketTable", compound_type, 1);
+ if (!ptable.IsValid())
+ goto error;
+
+ // Add packets to the table
+ for (size_t i = 0; i < NUM_PACKETS; i++) {
+ /* Appends one packet at the current position */
+ err = ptable.AppendPacket(s1 + i);
+ if (err < 0)
+ goto error;
+ }
- if (count != NUM_PACKETS)
- {
- std::cerr
- << "Number of packets in packet table should be " << NUM_PACKETS
- << " but is " << count << endl;
- }
+ // Check packet count
+ const hsize_t count = ptable.GetPacketCount(err);
+ if (err < 0)
+ goto error;
- // Read and verify the data
- ptable.ResetIndex();
- for (size_t i = 0; i < NUM_PACKETS; i++)
- {
- s1_t s2;
- HDmemset(&s2, 0, sizeof(s1_t));
- err = ptable.GetNextPacket(&s2);
- if (err < 0)
- goto error;
+ if (count != NUM_PACKETS) {
+ std::cerr << "Number of packets in packet table should be " << NUM_PACKETS << " but is " << count
+ << endl;
+ }
- if (s2.a != s1[i].a || s2.e != s1[i].e)
- goto error;
- else if (HDstrcmp(s2.d, s1[i].d))
- goto error;
- }
+ // Read and verify the data
+ ptable.ResetIndex();
+ for (size_t i = 0; i < NUM_PACKETS; i++) {
+ s1_t s2;
+ HDmemset(&s2, 0, sizeof(s1_t));
+ err = ptable.GetNextPacket(&s2);
+ if (err < 0)
+ goto error;
+
+ if (s2.a != s1[i].a || s2.e != s1[i].e)
+ goto error;
+ else if (HDstrcmp(s2.d, s1[i].d))
+ goto error;
+ }
} // end of ptable block
PASSED();
@@ -689,13 +700,14 @@ int TestHDFFV_9758()
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(strtype);
H5Tclose(compound_type);
H5Fclose(fileID);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return 1;
}
-
diff --git a/hl/examples/ex_ds1.c b/hl/examples/ex_ds1.c
index 1e0c592..af8b581 100644
--- a/hl/examples/ex_ds1.c
+++ b/hl/examples/ex_ds1.c
@@ -14,99 +14,93 @@
#include "hdf5.h"
#include "hdf5_hl.h"
-
-#define RANK 2
-#define DIM_DATA 12
-#define DIM1_SIZE 3
-#define DIM2_SIZE 4
-#define DIM0 0
-#define DIM1 1
-
-#define DSET_NAME "Mydata"
-#define DS_1_NAME "Yaxis"
-#define DS_2_NAME "Xaxis"
-
-int main(void)
+#define RANK 2
+#define DIM_DATA 12
+#define DIM1_SIZE 3
+#define DIM2_SIZE 4
+#define DIM0 0
+#define DIM1 1
+
+#define DSET_NAME "Mydata"
+#define DS_1_NAME "Yaxis"
+#define DS_2_NAME "Xaxis"
+
+int
+main(void)
{
- hid_t fid; /* file ID */
- hid_t did; /* dataset ID */
- hid_t dsid; /* DS dataset ID */
- int rank = RANK; /* rank of data dataset */
- int rankds = 1; /* rank of DS dataset */
- hsize_t dims[RANK] = {DIM1_SIZE,DIM2_SIZE}; /* size of data dataset */
- int buf[DIM_DATA] = {1,2,3,4,5,6,7,8,9,10,11,12}; /* data of data dataset */
- hsize_t s1_dim[1] = {DIM1_SIZE}; /* size of DS 1 dataset */
- hsize_t s2_dim[1] = {DIM2_SIZE}; /* size of DS 2 dataset */
- float s1_wbuf[DIM1_SIZE] = {10,20,30}; /* data of DS 1 dataset */
- int s2_wbuf[DIM2_SIZE] = {10,20,50,100}; /* data of DS 2 dataset */
-
-
- /* create a file using default properties */
- if ((fid=H5Fcreate("ex_ds1.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
- goto out;
-
- /* make a dataset */
- if (H5LTmake_dataset_int(fid,DSET_NAME,rank,dims,buf)<0)
- goto out;
-
- /* make a DS dataset for the first dimension */
- if (H5LTmake_dataset_float(fid,DS_1_NAME,rankds,s1_dim,s1_wbuf)<0)
- goto out;
-
- /* make a DS dataset for the second dimension */
- if (H5LTmake_dataset_int(fid,DS_2_NAME,rankds,s2_dim,s2_wbuf)<0)
- goto out;
-
-
-/*-------------------------------------------------------------------------
- * attach the DS_1_NAME dimension scale to DSET_NAME at dimension 0
- *-------------------------------------------------------------------------
- */
-
- /* get the dataset id for DSET_NAME */
- if ((did = H5Dopen2(fid,DSET_NAME, H5P_DEFAULT))<0)
- goto out;
-
- /* get the DS dataset id */
- if ((dsid = H5Dopen2(fid,DS_1_NAME, H5P_DEFAULT))<0)
- goto out;
-
- /* attach the DS_1_NAME dimension scale to DSET_NAME at dimension index 0 */
- if (H5DSattach_scale(did,dsid,DIM0)<0)
- goto out;
-
- /* close DS id */
- if (H5Dclose(dsid)<0)
- goto out;
-
-/*-------------------------------------------------------------------------
- * attach the DS_2_NAME dimension scale to DSET_NAME
- *-------------------------------------------------------------------------
- */
-
- /* get the DS dataset id */
- if ((dsid = H5Dopen2(fid,DS_2_NAME, H5P_DEFAULT))<0)
- goto out;
-
- /* attach the DS_2_NAME dimension scale to DSET_NAME as the 2nd dimension (index 1) */
- if (H5DSattach_scale(did,dsid,DIM1)<0)
- goto out;
-
- /* close DS id */
- if (H5Dclose(dsid)<0)
- goto out;
-
- /* close file */
- H5Fclose(fid);
-
- return 0;
+ hid_t fid; /* file ID */
+ hid_t did; /* dataset ID */
+ hid_t dsid; /* DS dataset ID */
+ int rank = RANK; /* rank of data dataset */
+ int rankds = 1; /* rank of DS dataset */
+ hsize_t dims[RANK] = {DIM1_SIZE, DIM2_SIZE}; /* size of data dataset */
+ int buf[DIM_DATA] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; /* data of data dataset */
+ hsize_t s1_dim[1] = {DIM1_SIZE}; /* size of DS 1 dataset */
+ hsize_t s2_dim[1] = {DIM2_SIZE}; /* size of DS 2 dataset */
+ float s1_wbuf[DIM1_SIZE] = {10, 20, 30}; /* data of DS 1 dataset */
+ int s2_wbuf[DIM2_SIZE] = {10, 20, 50, 100}; /* data of DS 2 dataset */
+
+ /* create a file using default properties */
+ if ((fid = H5Fcreate("ex_ds1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* make a dataset */
+ if (H5LTmake_dataset_int(fid, DSET_NAME, rank, dims, buf) < 0)
+ goto out;
+
+ /* make a DS dataset for the first dimension */
+ if (H5LTmake_dataset_float(fid, DS_1_NAME, rankds, s1_dim, s1_wbuf) < 0)
+ goto out;
+
+ /* make a DS dataset for the second dimension */
+ if (H5LTmake_dataset_int(fid, DS_2_NAME, rankds, s2_dim, s2_wbuf) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * attach the DS_1_NAME dimension scale to DSET_NAME at dimension 0
+ *-------------------------------------------------------------------------
+ */
+
+ /* get the dataset id for DSET_NAME */
+ if ((did = H5Dopen2(fid, DSET_NAME, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* get the DS dataset id */
+ if ((dsid = H5Dopen2(fid, DS_1_NAME, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* attach the DS_1_NAME dimension scale to DSET_NAME at dimension index 0 */
+ if (H5DSattach_scale(did, dsid, DIM0) < 0)
+ goto out;
+
+ /* close DS id */
+ if (H5Dclose(dsid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * attach the DS_2_NAME dimension scale to DSET_NAME
+ *-------------------------------------------------------------------------
+ */
+
+ /* get the DS dataset id */
+ if ((dsid = H5Dopen2(fid, DS_2_NAME, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* attach the DS_2_NAME dimension scale to DSET_NAME as the 2nd dimension (index 1) */
+ if (H5DSattach_scale(did, dsid, DIM1) < 0)
+ goto out;
+
+ /* close DS id */
+ if (H5Dclose(dsid) < 0)
+ goto out;
+
+ /* close file */
+ H5Fclose(fid);
+
+ return 0;
out:
- printf("Error on return function...Exiting\n");
- return 1;
-
+ printf("Error on return function...Exiting\n");
+ return 1;
}
-
-
-
diff --git a/hl/examples/ex_image1.c b/hl/examples/ex_image1.c
index 56a175d..ef9410b 100644
--- a/hl/examples/ex_image1.c
+++ b/hl/examples/ex_image1.c
@@ -14,56 +14,55 @@
#include "hdf5.h"
#include "hdf5_hl.h"
-#define WIDTH 400
-#define HEIGHT 200
-#define PAL_ENTRIES 9
-unsigned char buf [ WIDTH*HEIGHT ];
+#define WIDTH 400
+#define HEIGHT 200
+#define PAL_ENTRIES 9
+unsigned char buf[WIDTH * HEIGHT];
-int main( void )
+int
+main(void)
{
- hid_t file_id;
- hsize_t pal_dims[] = {PAL_ENTRIES,3};
- size_t i, j;
- int n, space;
- unsigned char pal[PAL_ENTRIES*3] = { /* create a palette with 9 colors */
- 0,0,168, /* dark blue */
- 0,0,252, /* blue */
- 0,168,252, /* ocean blue */
- 84,252,252, /* light blue */
- 168,252,168, /* light green */
- 0,252,168, /* green */
- 252,252,84, /* yellow */
- 252,168,0, /* orange */
- 252,0,0}; /* red */
+ hid_t file_id;
+ hsize_t pal_dims[] = {PAL_ENTRIES, 3};
+ size_t i, j;
+ int n, space;
+ unsigned char pal[PAL_ENTRIES * 3] = { /* create a palette with 9 colors */
+ 0, 0, 168, /* dark blue */
+ 0, 0, 252, /* blue */
+ 0, 168, 252, /* ocean blue */
+ 84, 252, 252, /* light blue */
+ 168, 252, 168, /* light green */
+ 0, 252, 168, /* green */
+ 252, 252, 84, /* yellow */
+ 252, 168, 0, /* orange */
+ 252, 0, 0}; /* red */
- /* create an image of 9 values divided evenly by the array */
- space = WIDTH*HEIGHT / PAL_ENTRIES;
- for (i=0, j=0, n=0; i < WIDTH*HEIGHT; i++, j++ )
- {
- buf[i] = n;
- if ( j > space )
- {
- n++;
- j=0;
- }
- if (n>PAL_ENTRIES-1) n=0;
- }
+ /* create an image of 9 values divided evenly by the array */
+ space = WIDTH * HEIGHT / PAL_ENTRIES;
+ for (i = 0, j = 0, n = 0; i < WIDTH * HEIGHT; i++, j++) {
+ buf[i] = n;
+ if (j > space) {
+ n++;
+ j = 0;
+ }
+ if (n > PAL_ENTRIES - 1)
+ n = 0;
+ }
- /* create a new HDF5 file using default properties. */
- file_id = H5Fcreate( "ex_image1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
+ /* create a new HDF5 file using default properties. */
+ file_id = H5Fcreate("ex_image1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- /* make the image */
- H5IMmake_image_8bit( file_id, "image1", (hsize_t)WIDTH, (hsize_t)HEIGHT, buf );
+ /* make the image */
+ H5IMmake_image_8bit(file_id, "image1", (hsize_t)WIDTH, (hsize_t)HEIGHT, buf);
- /* make a palette */
- H5IMmake_palette( file_id, "pallete", pal_dims, pal );
+ /* make a palette */
+ H5IMmake_palette(file_id, "pallete", pal_dims, pal);
- /* attach the palette to the image */
- H5IMlink_palette( file_id, "image1", "pallete" );
+ /* attach the palette to the image */
+ H5IMlink_palette(file_id, "image1", "pallete");
- /* close the file. */
- H5Fclose( file_id );
-
- return 0;
+ /* close the file. */
+ H5Fclose(file_id);
+ return 0;
}
diff --git a/hl/examples/ex_image2.c b/hl/examples/ex_image2.c
index 5abf723..2a38430 100644
--- a/hl/examples/ex_image2.c
+++ b/hl/examples/ex_image2.c
@@ -16,90 +16,89 @@
#include <stdlib.h>
#include <string.h>
-#define DATA_FILE1 "image8.txt"
-#define DATA_FILE2 "image24pixel.txt"
-#define IMAGE1_NAME "image8bit"
-#define IMAGE2_NAME "image24bitpixel"
-#define PAL_NAME "palette"
-#define PAL_ENTRIES 256
-
-static int read_data(const char* file_name, hsize_t *width, hsize_t *height );
-unsigned char *gbuf = NULL; /* global buffer for image data */
-
-int main( void )
+#define DATA_FILE1 "image8.txt"
+#define DATA_FILE2 "image24pixel.txt"
+#define IMAGE1_NAME "image8bit"
+#define IMAGE2_NAME "image24bitpixel"
+#define PAL_NAME "palette"
+#define PAL_ENTRIES 256
+
+static int read_data(const char *file_name, hsize_t *width, hsize_t *height);
+unsigned char *gbuf = NULL; /* global buffer for image data */
+
+int
+main(void)
{
- hid_t file_id; /* HDF5 file identifier */
- hsize_t width; /* width of image */
- hsize_t height; /* height of image */
- unsigned char pal[ PAL_ENTRIES * 3 ]; /* palette array */
- hsize_t pal_dims[2] = {PAL_ENTRIES,3}; /* palette dimensions */
- herr_t i, n;
-
- /* create a new HDF5 file using default properties. */
- file_id = H5Fcreate( "ex_image2.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
- /* read first data file */
- if (read_data(DATA_FILE1,&width,&height)<0)
- goto out;
-
- /* make the image */
- H5IMmake_image_8bit( file_id, IMAGE1_NAME, width, height, gbuf );
- if (gbuf) {
- free(gbuf);
- gbuf = NULL;
- }
-
-/*-------------------------------------------------------------------------
- * define a palette, blue to red tones
- *-------------------------------------------------------------------------
- */
- for ( i=0, n=0; i<PAL_ENTRIES*3; i+=3, n++)
- {
- pal[i] =n; /* red */
- pal[i+1]=0; /* green */
- pal[i+2]=255-n; /* blue */
- }
-
- /* make a palette */
- H5IMmake_palette( file_id, PAL_NAME, pal_dims, pal );
-
- /* attach the palette to the image */
- H5IMlink_palette( file_id, IMAGE1_NAME, PAL_NAME );
-
-/*-------------------------------------------------------------------------
- * True color image example with pixel interlace
- *-------------------------------------------------------------------------
- */
-
- /* read second data file */
- if (read_data(DATA_FILE2,&width,&height)<0)
- goto out;
-
- /* make dataset */
- H5IMmake_image_24bit( file_id, IMAGE2_NAME, width, height, "INTERLACE_PIXEL", gbuf );
-
- /* close the file. */
- H5Fclose( file_id );
-
- if(gbuf) {
- free(gbuf);
- gbuf = NULL;
- }
-
- return 0;
+ hid_t file_id; /* HDF5 file identifier */
+ hsize_t width; /* width of image */
+ hsize_t height; /* height of image */
+ unsigned char pal[PAL_ENTRIES * 3]; /* palette array */
+ hsize_t pal_dims[2] = {PAL_ENTRIES, 3}; /* palette dimensions */
+ herr_t i, n;
+
+ /* create a new HDF5 file using default properties. */
+ file_id = H5Fcreate("ex_image2.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* read first data file */
+ if (read_data(DATA_FILE1, &width, &height) < 0)
+ goto out;
+
+ /* make the image */
+ H5IMmake_image_8bit(file_id, IMAGE1_NAME, width, height, gbuf);
+ if (gbuf) {
+ free(gbuf);
+ gbuf = NULL;
+ }
+
+ /*-------------------------------------------------------------------------
+ * define a palette, blue to red tones
+ *-------------------------------------------------------------------------
+ */
+ for (i = 0, n = 0; i < PAL_ENTRIES * 3; i += 3, n++) {
+ pal[i] = n; /* red */
+ pal[i + 1] = 0; /* green */
+ pal[i + 2] = 255 - n; /* blue */
+ }
+
+ /* make a palette */
+ H5IMmake_palette(file_id, PAL_NAME, pal_dims, pal);
+
+ /* attach the palette to the image */
+ H5IMlink_palette(file_id, IMAGE1_NAME, PAL_NAME);
+
+ /*-------------------------------------------------------------------------
+ * True color image example with pixel interlace
+ *-------------------------------------------------------------------------
+ */
+
+ /* read second data file */
+ if (read_data(DATA_FILE2, &width, &height) < 0)
+ goto out;
+
+ /* make dataset */
+ H5IMmake_image_24bit(file_id, IMAGE2_NAME, width, height, "INTERLACE_PIXEL", gbuf);
+
+ /* close the file. */
+ H5Fclose(file_id);
+
+ if (gbuf) {
+ free(gbuf);
+ gbuf = NULL;
+ }
+
+ return 0;
out:
- printf("Error on return function...Exiting\n");
+ printf("Error on return function...Exiting\n");
- if(gbuf) {
- free(gbuf);
- gbuf = NULL;
- }
+ if (gbuf) {
+ free(gbuf);
+ gbuf = NULL;
+ }
- return 1;
+ return 1;
}
-
/*-------------------------------------------------------------------------
* read_data
* utility function to read ASCII image data
@@ -117,68 +116,63 @@ out:
*-------------------------------------------------------------------------
*/
-static int read_data( const char* fname, /*IN*/
- hsize_t *width, /*OUT*/
- hsize_t *height /*OUT*/ )
+static int
+read_data(const char *fname, /*IN*/
+ hsize_t * width, /*OUT*/
+ hsize_t * height /*OUT*/)
{
- int i, n;
- int color_planes;
- char str[20];
- FILE *f;
- int w, h;
- char *srcdir = getenv("srcdir"); /* the source directory */
- char data_file[512]=""; /* buffer to hold name of existing data file */
-
-/*-------------------------------------------------------------------------
- * compose the name of the file to open, using "srcdir", if appropriate
- *-------------------------------------------------------------------------
- */
- strcpy(data_file, "");
- if (srcdir)
- {
- strcpy(data_file, srcdir);
- strcat(data_file, "/");
- }
- strcat(data_file,fname);
-
-/*-------------------------------------------------------------------------
- * read
- *-------------------------------------------------------------------------
- */
-
- f = fopen(data_file, "r");
- if ( f == NULL )
- {
- printf( "Could not open file %s. Try set $srcdir \n", data_file );
- return -1;
- }
-
- fscanf( f, "%s", str );
- fscanf( f, "%d", &color_planes );
- fscanf( f, "%s", str );
- fscanf( f, "%d", &h);
- fscanf( f, "%s", str );
- fscanf( f, "%d", &w);
-
- *width = (hsize_t)w;
- *height = (hsize_t)h;
-
- if ( gbuf )
- {
- free( gbuf );
- gbuf=NULL;
- }
-
- gbuf = (unsigned char*) malloc (w * h * color_planes * sizeof( unsigned char ));
-
- for (i = 0; i < h * w * color_planes ; i++)
- {
- fscanf( f, "%d",&n );
- gbuf[i] = (unsigned char)n;
- }
- fclose(f);
-
- return 1;
-
+ int i, n;
+ int color_planes;
+ char str[20];
+ FILE *f;
+ int w, h;
+ char *srcdir = getenv("srcdir"); /* the source directory */
+ char data_file[512] = ""; /* buffer to hold name of existing data file */
+
+ /*-------------------------------------------------------------------------
+ * compose the name of the file to open, using "srcdir", if appropriate
+ *-------------------------------------------------------------------------
+ */
+ strcpy(data_file, "");
+ if (srcdir) {
+ strcpy(data_file, srcdir);
+ strcat(data_file, "/");
+ }
+ strcat(data_file, fname);
+
+ /*-------------------------------------------------------------------------
+ * read
+ *-------------------------------------------------------------------------
+ */
+
+ f = fopen(data_file, "r");
+ if (f == NULL) {
+ printf("Could not open file %s. Try set $srcdir \n", data_file);
+ return -1;
+ }
+
+ fscanf(f, "%s", str);
+ fscanf(f, "%d", &color_planes);
+ fscanf(f, "%s", str);
+ fscanf(f, "%d", &h);
+ fscanf(f, "%s", str);
+ fscanf(f, "%d", &w);
+
+ *width = (hsize_t)w;
+ *height = (hsize_t)h;
+
+ if (gbuf) {
+ free(gbuf);
+ gbuf = NULL;
+ }
+
+ gbuf = (unsigned char *)malloc(w * h * color_planes * sizeof(unsigned char));
+
+ for (i = 0; i < h * w * color_planes; i++) {
+ fscanf(f, "%d", &n);
+ gbuf[i] = (unsigned char)n;
+ }
+ fclose(f);
+
+ return 1;
}
-
diff --git a/hl/examples/ex_lite1.c b/hl/examples/ex_lite1.c
index 89f60dc..3056480 100644
--- a/hl/examples/ex_lite1.c
+++ b/hl/examples/ex_lite1.c
@@ -11,29 +11,26 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
#include "hdf5.h"
#include "hdf5_hl.h"
#define RANK 2
-
-int main( void )
+int
+main(void)
{
- hid_t file_id;
- hsize_t dims[RANK]={2,3};
- int data[6]={1,2,3,4,5,6};
+ hid_t file_id;
+ hsize_t dims[RANK] = {2, 3};
+ int data[6] = {1, 2, 3, 4, 5, 6};
- /* create a HDF5 file */
- file_id = H5Fcreate ("ex_lite1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ /* create a HDF5 file */
+ file_id = H5Fcreate("ex_lite1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- /* create and write an integer type dataset named "dset" */
- H5LTmake_dataset(file_id,"/dset",RANK,dims,H5T_NATIVE_INT,data);
+ /* create and write an integer type dataset named "dset" */
+ H5LTmake_dataset(file_id, "/dset", RANK, dims, H5T_NATIVE_INT, data);
- /* close file */
- H5Fclose (file_id);
+ /* close file */
+ H5Fclose(file_id);
- return 0;
+ return 0;
}
-
-
diff --git a/hl/examples/ex_lite2.c b/hl/examples/ex_lite2.c
index 261fc73..4441844 100644
--- a/hl/examples/ex_lite2.c
+++ b/hl/examples/ex_lite2.c
@@ -14,38 +14,34 @@
#include "hdf5.h"
#include "hdf5_hl.h"
-int main( void )
+int
+main(void)
{
- hid_t file_id;
- int data[6];
- hsize_t dims[2];
- size_t i, j, nrow, n_values;
+ hid_t file_id;
+ int data[6];
+ hsize_t dims[2];
+ size_t i, j, nrow, n_values;
- /* open file from ex_lite1.c */
- file_id = H5Fopen ("ex_lite1.h5", H5F_ACC_RDONLY, H5P_DEFAULT);
+ /* open file from ex_lite1.c */
+ file_id = H5Fopen("ex_lite1.h5", H5F_ACC_RDONLY, H5P_DEFAULT);
- /* read dataset */
- H5LTread_dataset_int(file_id,"/dset",data);
+ /* read dataset */
+ H5LTread_dataset_int(file_id, "/dset", data);
- /* get the dimensions of the dataset */
- H5LTget_dataset_info(file_id,"/dset",dims,NULL,NULL);
+ /* get the dimensions of the dataset */
+ H5LTget_dataset_info(file_id, "/dset", dims, NULL, NULL);
- /* print it by rows */
- n_values = (size_t)(dims[0] * dims[1]);
- nrow = (size_t)dims[1];
- for (i=0; i<n_values/nrow; i++ )
- {
- for (j=0; j<nrow; j++)
- printf (" %d", data[i*nrow + j]);
- printf ("\n");
- }
-
- /* close file */
- H5Fclose (file_id);
-
- return 0;
+ /* print it by rows */
+ n_values = (size_t)(dims[0] * dims[1]);
+ nrow = (size_t)dims[1];
+ for (i = 0; i < n_values / nrow; i++) {
+ for (j = 0; j < nrow; j++)
+ printf(" %d", data[i * nrow + j]);
+ printf("\n");
+ }
+ /* close file */
+ H5Fclose(file_id);
+ return 0;
}
-
-
diff --git a/hl/examples/ex_lite3.c b/hl/examples/ex_lite3.c
index 420cbcb..f80582e 100644
--- a/hl/examples/ex_lite3.c
+++ b/hl/examples/ex_lite3.c
@@ -17,51 +17,51 @@
#define ATTR_SIZE 5
-int main( void )
+int
+main(void)
{
- hid_t file_id;
- hid_t dset_id;
- hid_t space_id;
- hsize_t dims[1] = { ATTR_SIZE };
- int data[ATTR_SIZE] = {1,2,3,4,5};
- int i;
+ hid_t file_id;
+ hid_t dset_id;
+ hid_t space_id;
+ hsize_t dims[1] = {ATTR_SIZE};
+ int data[ATTR_SIZE] = {1, 2, 3, 4, 5};
+ int i;
- /* create a file */
- file_id = H5Fcreate("ex_lite3.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ /* create a file */
+ file_id = H5Fcreate("ex_lite3.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- /* create a data space */
- space_id = H5Screate_simple(1, dims, NULL);
+ /* create a data space */
+ space_id = H5Screate_simple(1, dims, NULL);
- /* create a dataset named "dset" */
- dset_id = H5Dcreate2(file_id, "dset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* create a dataset named "dset" */
+ dset_id = H5Dcreate2(file_id, "dset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- /* close */
- H5Dclose(dset_id);
- H5Sclose(space_id);
+ /* close */
+ H5Dclose(dset_id);
+ H5Sclose(space_id);
-/*-------------------------------------------------------------------------
- * example of H5LTset_attribute_int
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * example of H5LTset_attribute_int
+ *-------------------------------------------------------------------------
+ */
- /* create and write the attribute "attr1" on the dataset "dset" */
- H5LTset_attribute_int(file_id, "dset", "attr1", data, ATTR_SIZE);
+ /* create and write the attribute "attr1" on the dataset "dset" */
+ H5LTset_attribute_int(file_id, "dset", "attr1", data, ATTR_SIZE);
-/*-------------------------------------------------------------------------
- * example of H5LTget_attribute_int
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * example of H5LTget_attribute_int
+ *-------------------------------------------------------------------------
+ */
- /* get the attribute "attr1" from the dataset "dset" */
- H5LTget_attribute_int(file_id, "dset", "attr1", data);
+ /* get the attribute "attr1" from the dataset "dset" */
+ H5LTget_attribute_int(file_id, "dset", "attr1", data);
- for(i = 0; i < ATTR_SIZE; i++ )
- printf(" %d", data[i]);
- printf("\n");
+ for (i = 0; i < ATTR_SIZE; i++)
+ printf(" %d", data[i]);
+ printf("\n");
- /* close file */
- H5Fclose(file_id);
+ /* close file */
+ H5Fclose(file_id);
- return 0;
+ return 0;
}
-
diff --git a/hl/examples/ex_table_01.c b/hl/examples/ex_table_01.c
index f1d0266..f3f1b0d 100644
--- a/hl/examples/ex_table_01.c
+++ b/hl/examples/ex_table_01.c
@@ -24,112 +24,91 @@
*-------------------------------------------------------------------------
*/
-#define NFIELDS (hsize_t) 5
-#define NRECORDS (hsize_t) 8
+#define NFIELDS (hsize_t)5
+#define NRECORDS (hsize_t)8
#define TABLE_NAME "table"
-
-int main( void )
+int
+main(void)
{
- typedef struct Particle
- {
- char name[16];
- int lati;
- int longi;
- float pressure;
- double temperature;
- } Particle;
-
- Particle dst_buf[NRECORDS];
-
- /* Calculate the size and the offsets of our struct members in memory */
- size_t dst_size = sizeof( Particle );
- size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ),
- HOFFSET( Particle, lati ),
- HOFFSET( Particle, longi ),
- HOFFSET( Particle, pressure ),
- HOFFSET( Particle, temperature )};
-
- size_t dst_sizes[NFIELDS] = { sizeof( dst_buf[0].name),
- sizeof( dst_buf[0].lati),
- sizeof( dst_buf[0].longi),
- sizeof( dst_buf[0].pressure),
- sizeof( dst_buf[0].temperature)};
-
-
- /* Define an array of Particles */
- Particle p_data[NRECORDS] = {
- {"zero",0,0, 0.0f, 0.0},
- {"one",10,10, 1.0f, 10.0},
- {"two", 20,20, 2.0f, 20.0},
- {"three",30,30, 3.0f, 30.0},
- {"four", 40,40, 4.0f, 40.0},
- {"five", 50,50, 5.0f, 50.0},
- {"six", 60,60, 6.0f, 60.0},
- {"seven",70,70, 7.0f, 70.0}
- };
-
- /* Define field information */
- const char *field_names[NFIELDS] =
- { "Name","Latitude", "Longitude", "Pressure", "Temperature" };
- hid_t field_type[NFIELDS];
- hid_t string_type;
- hid_t file_id;
- hsize_t chunk_size = 10;
- int *fill_data = NULL;
- int compress = 0;
- int i;
-
- /* Initialize field_type */
- string_type = H5Tcopy( H5T_C_S1 );
- H5Tset_size( string_type, 16 );
- field_type[0] = string_type;
- field_type[1] = H5T_NATIVE_INT;
- field_type[2] = H5T_NATIVE_INT;
- field_type[3] = H5T_NATIVE_FLOAT;
- field_type[4] = H5T_NATIVE_DOUBLE;
-
- /* Create a new file using default properties. */
- file_id = H5Fcreate( "ex_table_01.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
-/*-------------------------------------------------------------------------
- * H5TBmake_table
- *-------------------------------------------------------------------------
- */
-
- H5TBmake_table( "Table Title", file_id, TABLE_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
- chunk_size, fill_data, compress, p_data );
-
-/*-------------------------------------------------------------------------
- * H5TBread_table
- *-------------------------------------------------------------------------
- */
-
- H5TBread_table( file_id, TABLE_NAME, dst_size, dst_offset, dst_sizes, dst_buf );
-
- /* print it by rows */
- for (i=0; i<NRECORDS; i++) {
- printf ("%-5s %-5d %-5d %-5f %-5f",
- dst_buf[i].name,
- dst_buf[i].lati,
- dst_buf[i].longi,
- dst_buf[i].pressure,
- dst_buf[i].temperature);
- printf ("\n");
- }
-
-/*-------------------------------------------------------------------------
- * end
- *-------------------------------------------------------------------------
- */
-
- /* close type */
- H5Tclose( string_type );
-
- /* close the file */
- H5Fclose( file_id );
-
- return 0;
+ typedef struct Particle {
+ char name[16];
+ int lati;
+ int longi;
+ float pressure;
+ double temperature;
+ } Particle;
+
+ Particle dst_buf[NRECORDS];
+
+ /* Calculate the size and the offsets of our struct members in memory */
+ size_t dst_size = sizeof(Particle);
+ size_t dst_offset[NFIELDS] = {HOFFSET(Particle, name), HOFFSET(Particle, lati), HOFFSET(Particle, longi),
+ HOFFSET(Particle, pressure), HOFFSET(Particle, temperature)};
+
+ size_t dst_sizes[NFIELDS] = {sizeof(dst_buf[0].name), sizeof(dst_buf[0].lati), sizeof(dst_buf[0].longi),
+ sizeof(dst_buf[0].pressure), sizeof(dst_buf[0].temperature)};
+
+ /* Define an array of Particles */
+ Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0},
+ {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0},
+ {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0},
+ {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}};
+
+ /* Define field information */
+ const char *field_names[NFIELDS] = {"Name", "Latitude", "Longitude", "Pressure", "Temperature"};
+ hid_t field_type[NFIELDS];
+ hid_t string_type;
+ hid_t file_id;
+ hsize_t chunk_size = 10;
+ int * fill_data = NULL;
+ int compress = 0;
+ int i;
+
+ /* Initialize field_type */
+ string_type = H5Tcopy(H5T_C_S1);
+ H5Tset_size(string_type, 16);
+ field_type[0] = string_type;
+ field_type[1] = H5T_NATIVE_INT;
+ field_type[2] = H5T_NATIVE_INT;
+ field_type[3] = H5T_NATIVE_FLOAT;
+ field_type[4] = H5T_NATIVE_DOUBLE;
+
+ /* Create a new file using default properties. */
+ file_id = H5Fcreate("ex_table_01.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*-------------------------------------------------------------------------
+ * H5TBmake_table
+ *-------------------------------------------------------------------------
+ */
+
+ H5TBmake_table("Table Title", file_id, TABLE_NAME, NFIELDS, NRECORDS, dst_size, field_names, dst_offset,
+ field_type, chunk_size, fill_data, compress, p_data);
+
+ /*-------------------------------------------------------------------------
+ * H5TBread_table
+ *-------------------------------------------------------------------------
+ */
+
+ H5TBread_table(file_id, TABLE_NAME, dst_size, dst_offset, dst_sizes, dst_buf);
+
+ /* print it by rows */
+ for (i = 0; i < NRECORDS; i++) {
+ printf("%-5s %-5d %-5d %-5f %-5f", dst_buf[i].name, dst_buf[i].lati, dst_buf[i].longi,
+ dst_buf[i].pressure, dst_buf[i].temperature);
+ printf("\n");
+ }
+
+ /*-------------------------------------------------------------------------
+ * end
+ *-------------------------------------------------------------------------
+ */
+
+ /* close type */
+ H5Tclose(string_type);
+
+ /* close the file */
+ H5Fclose(file_id);
+
+ return 0;
}
-
diff --git a/hl/examples/ex_table_02.c b/hl/examples/ex_table_02.c
index 923f810..2c2f56b 100644
--- a/hl/examples/ex_table_02.c
+++ b/hl/examples/ex_table_02.c
@@ -23,107 +23,85 @@
*-------------------------------------------------------------------------
*/
-#define NFIELDS (hsize_t) 5
-#define NRECORDS (hsize_t) 8
-#define NRECORDS_ADD (hsize_t) 2
-#define TABLE_NAME "table"
+#define NFIELDS (hsize_t)5
+#define NRECORDS (hsize_t)8
+#define NRECORDS_ADD (hsize_t)2
+#define TABLE_NAME "table"
-int main( void )
+int
+main(void)
{
- typedef struct Particle
- {
- char name[16];
- int lati;
- int longi;
- float pressure;
- double temperature;
- } Particle;
-
- Particle dst_buf[NRECORDS+NRECORDS_ADD];
-
-/* Define an array of Particles */
- Particle p_data[NRECORDS] = {
- {"zero",0,0, 0.0f, 0.0},
- {"one",10,10, 1.0f, 10.0},
- {"two", 20,20, 2.0f, 20.0},
- {"three",30,30, 3.0f, 30.0},
- {"four", 40,40, 4.0f, 40.0},
- {"five", 50,50, 5.0f, 50.0},
- {"six", 60,60, 6.0f, 60.0},
- {"seven",70,70, 7.0f, 70.0}
- };
-
- /* Calculate the size and the offsets of our struct members in memory */
- size_t dst_size = sizeof( Particle );
- size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ),
- HOFFSET( Particle, lati ),
- HOFFSET( Particle, longi ),
- HOFFSET( Particle, pressure ),
- HOFFSET( Particle, temperature )};
-
- size_t dst_sizes[NFIELDS] = { sizeof( p_data[0].name),
- sizeof( p_data[0].lati),
- sizeof( p_data[0].longi),
- sizeof( p_data[0].pressure),
- sizeof( p_data[0].temperature)};
-
- /* Define field information */
- const char *field_names[NFIELDS] =
- { "Name","Latitude", "Longitude", "Pressure", "Temperature" };
- hid_t field_type[NFIELDS];
- hid_t string_type;
- hid_t file_id;
- hsize_t chunk_size = 10;
- int *fill_data = NULL;
- int compress = 0;
- int i;
-
- /* Append particles */
- Particle particle_in[ NRECORDS_ADD ] =
- {{ "eight",80,80, 8.0f, 80.0},
- {"nine",90,90, 9.0f, 90.0} };
-
- /* Initialize the field field_type */
- string_type = H5Tcopy( H5T_C_S1 );
- H5Tset_size( string_type, 16 );
- field_type[0] = string_type;
- field_type[1] = H5T_NATIVE_INT;
- field_type[2] = H5T_NATIVE_INT;
- field_type[3] = H5T_NATIVE_FLOAT;
- field_type[4] = H5T_NATIVE_DOUBLE;
-
- /* Create a new file using default properties. */
- file_id = H5Fcreate( "ex_table_02.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
- /* make a table */
- H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,
- dst_size, field_names, dst_offset, field_type,
- chunk_size, fill_data, compress, p_data );
-
- /* append two records */
- H5TBappend_records(file_id, TABLE_NAME,NRECORDS_ADD, dst_size, dst_offset, dst_sizes,
- &particle_in );
-
- /* read the table */
- H5TBread_table( file_id, TABLE_NAME, dst_size, dst_offset, dst_sizes, dst_buf );
-
- /* print it by rows */
- for (i=0; i<NRECORDS+NRECORDS_ADD; i++) {
- printf ("%-5s %-5d %-5d %-5f %-5f",
- dst_buf[i].name,
- dst_buf[i].lati,
- dst_buf[i].longi,
- dst_buf[i].pressure,
- dst_buf[i].temperature);
- printf ("\n");
- }
-
- /* close type */
- H5Tclose( string_type );
-
- /* close the file */
- H5Fclose( file_id );
-
- return 0;
+ typedef struct Particle {
+ char name[16];
+ int lati;
+ int longi;
+ float pressure;
+ double temperature;
+ } Particle;
+
+ Particle dst_buf[NRECORDS + NRECORDS_ADD];
+
+ /* Define an array of Particles */
+ Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0},
+ {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0},
+ {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0},
+ {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}};
+
+ /* Calculate the size and the offsets of our struct members in memory */
+ size_t dst_size = sizeof(Particle);
+ size_t dst_offset[NFIELDS] = {HOFFSET(Particle, name), HOFFSET(Particle, lati), HOFFSET(Particle, longi),
+ HOFFSET(Particle, pressure), HOFFSET(Particle, temperature)};
+
+ size_t dst_sizes[NFIELDS] = {sizeof(p_data[0].name), sizeof(p_data[0].lati), sizeof(p_data[0].longi),
+ sizeof(p_data[0].pressure), sizeof(p_data[0].temperature)};
+
+ /* Define field information */
+ const char *field_names[NFIELDS] = {"Name", "Latitude", "Longitude", "Pressure", "Temperature"};
+ hid_t field_type[NFIELDS];
+ hid_t string_type;
+ hid_t file_id;
+ hsize_t chunk_size = 10;
+ int * fill_data = NULL;
+ int compress = 0;
+ int i;
+
+ /* Append particles */
+ Particle particle_in[NRECORDS_ADD] = {{"eight", 80, 80, 8.0f, 80.0}, {"nine", 90, 90, 9.0f, 90.0}};
+
+ /* Initialize the field field_type */
+ string_type = H5Tcopy(H5T_C_S1);
+ H5Tset_size(string_type, 16);
+ field_type[0] = string_type;
+ field_type[1] = H5T_NATIVE_INT;
+ field_type[2] = H5T_NATIVE_INT;
+ field_type[3] = H5T_NATIVE_FLOAT;
+ field_type[4] = H5T_NATIVE_DOUBLE;
+
+ /* Create a new file using default properties. */
+ file_id = H5Fcreate("ex_table_02.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* make a table */
+ H5TBmake_table("Table Title", file_id, TABLE_NAME, NFIELDS, NRECORDS, dst_size, field_names, dst_offset,
+ field_type, chunk_size, fill_data, compress, p_data);
+
+ /* append two records */
+ H5TBappend_records(file_id, TABLE_NAME, NRECORDS_ADD, dst_size, dst_offset, dst_sizes, &particle_in);
+
+ /* read the table */
+ H5TBread_table(file_id, TABLE_NAME, dst_size, dst_offset, dst_sizes, dst_buf);
+
+ /* print it by rows */
+ for (i = 0; i < NRECORDS + NRECORDS_ADD; i++) {
+ printf("%-5s %-5d %-5d %-5f %-5f", dst_buf[i].name, dst_buf[i].lati, dst_buf[i].longi,
+ dst_buf[i].pressure, dst_buf[i].temperature);
+ printf("\n");
+ }
+
+ /* close type */
+ H5Tclose(string_type);
+
+ /* close the file */
+ H5Fclose(file_id);
+
+ return 0;
}
-
diff --git a/hl/examples/ex_table_03.c b/hl/examples/ex_table_03.c
index 76a9eae..8787275 100644
--- a/hl/examples/ex_table_03.c
+++ b/hl/examples/ex_table_03.c
@@ -11,7 +11,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
#include "hdf5.h"
#include "hdf5_hl.h"
#include <stdlib.h>
@@ -24,113 +23,85 @@
*-------------------------------------------------------------------------
*/
-#define NFIELDS (hsize_t) 5
-#define NRECORDS (hsize_t) 8
-#define NRECORDS_WRITE (hsize_t) 2
-#define TABLE_NAME "table"
+#define NFIELDS (hsize_t)5
+#define NRECORDS (hsize_t)8
+#define NRECORDS_WRITE (hsize_t)2
+#define TABLE_NAME "table"
-int main( void )
+int
+main(void)
{
- typedef struct Particle
- {
- char name[16];
- int lati;
- int longi;
- float pressure;
- double temperature;
- } Particle;
-
- Particle dst_buf[NRECORDS];
-
- /* Calculate the size and the offsets of our struct members in memory */
- size_t dst_size = sizeof( Particle );
- size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ),
- HOFFSET( Particle, lati ),
- HOFFSET( Particle, longi ),
- HOFFSET( Particle, pressure ),
- HOFFSET( Particle, temperature )};
-
- Particle p = {"zero",0,0, 0.0f, 0.0};
- size_t dst_sizes[NFIELDS] = { sizeof( p.name),
- sizeof( p.lati),
- sizeof( p.longi),
- sizeof( p.pressure),
- sizeof( p.temperature)};
-
- /* Define field information */
- const char *field_names[NFIELDS] =
- { "Name","Latitude", "Longitude", "Pressure", "Temperature" };
- /* Fill value particle */
- Particle fill_data[1] =
- { {"no data",-1,-1, -99.0f, -99.0} };
- hid_t field_type[NFIELDS];
- hid_t string_type;
- hid_t file_id;
- hsize_t chunk_size = 10;
- hsize_t start; /* Record to start reading/writing */
- hsize_t nrecords; /* Number of records to read/write */
- int i;
-
- /* Define 2 new particles to write */
- Particle particle_in[NRECORDS_WRITE] =
- { {"zero",0,0, 0.0f, 0.0},
- {"one",10,10, 1.0f, 10.0} };
-
- /* Initialize the field field_type */
- string_type = H5Tcopy( H5T_C_S1 );
- H5Tset_size( string_type, 16 );
- field_type[0] = string_type;
- field_type[1] = H5T_NATIVE_INT;
- field_type[2] = H5T_NATIVE_INT;
- field_type[3] = H5T_NATIVE_FLOAT;
- field_type[4] = H5T_NATIVE_DOUBLE;
-
-/* Create a new file using default properties. */
- file_id = H5Fcreate( "ex_table_03.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
- /* Make the table */
- H5TBmake_table( "Table Title",
- file_id,
- TABLE_NAME,
- NFIELDS,
- NRECORDS,
- dst_size,
- field_names,
- dst_offset,
- field_type,
- chunk_size,
- fill_data,
- 0, /* no compression */
- NULL ); /* no data written */
-
-
- /* Overwrite 2 records starting at record 0 */
- start = 0;
- nrecords = NRECORDS_WRITE;
- H5TBwrite_records( file_id, TABLE_NAME, start, nrecords, dst_size, dst_offset,
- dst_sizes, particle_in);
-
- /* read the table */
- H5TBread_table( file_id, TABLE_NAME, dst_size, dst_offset, dst_sizes, dst_buf );
-
- /* print it by rows */
- for (i=0; i<NRECORDS; i++) {
- printf ("%-5s %-5d %-5d %-5f %-5f",
- dst_buf[i].name,
- dst_buf[i].lati,
- dst_buf[i].longi,
- dst_buf[i].pressure,
- dst_buf[i].temperature);
- printf ("\n");
- }
-
- /* close type */
- H5Tclose( string_type );
-
- /* close the file */
- H5Fclose( file_id );
-
- return 0;
-
+ typedef struct Particle {
+ char name[16];
+ int lati;
+ int longi;
+ float pressure;
+ double temperature;
+ } Particle;
+
+ Particle dst_buf[NRECORDS];
+
+ /* Calculate the size and the offsets of our struct members in memory */
+ size_t dst_size = sizeof(Particle);
+ size_t dst_offset[NFIELDS] = {HOFFSET(Particle, name), HOFFSET(Particle, lati), HOFFSET(Particle, longi),
+ HOFFSET(Particle, pressure), HOFFSET(Particle, temperature)};
+
+ Particle p = {"zero", 0, 0, 0.0f, 0.0};
+ size_t dst_sizes[NFIELDS] = {sizeof(p.name), sizeof(p.lati), sizeof(p.longi), sizeof(p.pressure),
+ sizeof(p.temperature)};
+
+ /* Define field information */
+ const char *field_names[NFIELDS] = {"Name", "Latitude", "Longitude", "Pressure", "Temperature"};
+ /* Fill value particle */
+ Particle fill_data[1] = {{"no data", -1, -1, -99.0f, -99.0}};
+ hid_t field_type[NFIELDS];
+ hid_t string_type;
+ hid_t file_id;
+ hsize_t chunk_size = 10;
+ hsize_t start; /* Record to start reading/writing */
+ hsize_t nrecords; /* Number of records to read/write */
+ int i;
+
+ /* Define 2 new particles to write */
+ Particle particle_in[NRECORDS_WRITE] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0}};
+
+ /* Initialize the field field_type */
+ string_type = H5Tcopy(H5T_C_S1);
+ H5Tset_size(string_type, 16);
+ field_type[0] = string_type;
+ field_type[1] = H5T_NATIVE_INT;
+ field_type[2] = H5T_NATIVE_INT;
+ field_type[3] = H5T_NATIVE_FLOAT;
+ field_type[4] = H5T_NATIVE_DOUBLE;
+
+ /* Create a new file using default properties. */
+ file_id = H5Fcreate("ex_table_03.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Make the table */
+ H5TBmake_table("Table Title", file_id, TABLE_NAME, NFIELDS, NRECORDS, dst_size, field_names, dst_offset,
+ field_type, chunk_size, fill_data, 0, /* no compression */
+ NULL); /* no data written */
+
+ /* Overwrite 2 records starting at record 0 */
+ start = 0;
+ nrecords = NRECORDS_WRITE;
+ H5TBwrite_records(file_id, TABLE_NAME, start, nrecords, dst_size, dst_offset, dst_sizes, particle_in);
+
+ /* read the table */
+ H5TBread_table(file_id, TABLE_NAME, dst_size, dst_offset, dst_sizes, dst_buf);
+
+ /* print it by rows */
+ for (i = 0; i < NRECORDS; i++) {
+ printf("%-5s %-5d %-5d %-5f %-5f", dst_buf[i].name, dst_buf[i].lati, dst_buf[i].longi,
+ dst_buf[i].pressure, dst_buf[i].temperature);
+ printf("\n");
+ }
+
+ /* close type */
+ H5Tclose(string_type);
+
+ /* close the file */
+ H5Fclose(file_id);
+
+ return 0;
}
-
diff --git a/hl/examples/ex_table_04.c b/hl/examples/ex_table_04.c
index 203114c..9cb9137 100644
--- a/hl/examples/ex_table_04.c
+++ b/hl/examples/ex_table_04.c
@@ -23,141 +23,117 @@
*-------------------------------------------------------------------------
*/
-#define NFIELDS (hsize_t) 5
-#define NRECORDS (hsize_t) 8
-#define NRECORDS_ADD (hsize_t) 3
-#define TABLE_NAME "table"
+#define NFIELDS (hsize_t)5
+#define NRECORDS (hsize_t)8
+#define NRECORDS_ADD (hsize_t)3
+#define TABLE_NAME "table"
-int main( void )
+int
+main(void)
{
- typedef struct Particle
- {
- char name[16];
- int lati;
- int longi;
- float pressure;
- double temperature;
- } Particle;
-
- /* Define a subset of Particle, with latitude and longitude fields */
- typedef struct Position
- {
- int lati;
- int longi;
- } Position;
-
- /* Define a subset of Particle, with name and pressure fields */
- typedef struct NamePressure
- {
- char name[16];
- float pressure;
- } NamePressure;
-
- Particle dst_buf[NRECORDS];
- /* Calculate the size and the offsets of our struct members in memory */
- size_t dst_size = sizeof( Particle );
- size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ),
- HOFFSET( Particle, lati ),
- HOFFSET( Particle, longi ),
- HOFFSET( Particle, pressure ),
- HOFFSET( Particle, temperature )};
- size_t dst_sizes[NFIELDS] = { sizeof( dst_buf[0].name),
- sizeof( dst_buf[0].lati),
- sizeof( dst_buf[0].longi),
- sizeof( dst_buf[0].pressure),
- sizeof( dst_buf[0].temperature)};
- size_t field_offset_pos[2] = { HOFFSET( Position, lati ),
- HOFFSET( Position, longi )};
- const char *field_names[NFIELDS] = /* Define field information */
- { "Name","Latitude", "Longitude", "Pressure", "Temperature" };
- hid_t field_type[NFIELDS];
- hid_t string_type;
- hid_t file_id;
- hsize_t chunk_size = 10;
- Particle fill_data[1] =
- { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */
- hsize_t start; /* Record to start reading/writing */
- hsize_t nrecords; /* Number of records to read/write */
- int compress = 0;
- int i;
- Particle *p_data = NULL; /* Initially no data */
- float pressure_in [NRECORDS_ADD] = /* Define new values for the field "Pressure" */
- { 0.0f,1.0f,2.0f};
- Position position_in[NRECORDS_ADD] = {/* Define new values for "Latitude,Longitude" */
- {0,0},
- {10,10},
- {20,20}};
- NamePressure namepre_in[NRECORDS_ADD] =/* Define new values for "Name,Pressure" */
- { {"zero",0.0f},
- {"one", 1.0f},
- {"two", 2.0f},
- };
- size_t field_sizes_pos[2]=
- {
- sizeof(position_in[0].longi),
- sizeof(position_in[0].lati)
- };
- size_t field_sizes_pre[1]=
- {
- sizeof(namepre_in[0].pressure)
- };
-
- /* Initialize the field field_type */
- string_type = H5Tcopy( H5T_C_S1 );
- H5Tset_size( string_type, 16 );
- field_type[0] = string_type;
- field_type[1] = H5T_NATIVE_INT;
- field_type[2] = H5T_NATIVE_INT;
- field_type[3] = H5T_NATIVE_FLOAT;
- field_type[4] = H5T_NATIVE_DOUBLE;
-
- /* Create a new file using default properties. */
- file_id = H5Fcreate( "ex_table_04.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
- /* Make the table */
- H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
- chunk_size, fill_data, compress, p_data );
-
- /* Write the pressure field starting at record 2 */
- start = 2;
- nrecords = NRECORDS_ADD;
- H5TBwrite_fields_name( file_id, TABLE_NAME, "Pressure", start, nrecords,
- sizeof( float ), 0, field_sizes_pre, pressure_in );
-
- /* Write the new longitude and latitude information starting at record 2 */
- start = 2;
- nrecords = NRECORDS_ADD;
- H5TBwrite_fields_name( file_id, TABLE_NAME, "Latitude,Longitude", start, nrecords,
- sizeof( Position ), field_offset_pos, field_sizes_pos, position_in );
-
- /* read the table */
- H5TBread_table( file_id, TABLE_NAME, dst_size, dst_offset, dst_sizes, dst_buf );
-
- /* print it by rows */
- for (i=0; i<NRECORDS; i++) {
- printf ("%-5s %-5d %-5d %-5f %-5f",
- dst_buf[i].name,
- dst_buf[i].lati,
- dst_buf[i].longi,
- dst_buf[i].pressure,
- dst_buf[i].temperature);
- printf ("\n");
- }
-
-/*-------------------------------------------------------------------------
- * end
- *-------------------------------------------------------------------------
- */
-
- /* close type */
- H5Tclose( string_type );
-
- /* close the file */
- H5Fclose( file_id );
-
- return 0;
-
-
+ typedef struct Particle {
+ char name[16];
+ int lati;
+ int longi;
+ float pressure;
+ double temperature;
+ } Particle;
+
+ /* Define a subset of Particle, with latitude and longitude fields */
+ typedef struct Position {
+ int lati;
+ int longi;
+ } Position;
+
+ /* Define a subset of Particle, with name and pressure fields */
+ typedef struct NamePressure {
+ char name[16];
+ float pressure;
+ } NamePressure;
+
+ Particle dst_buf[NRECORDS];
+ /* Calculate the size and the offsets of our struct members in memory */
+ size_t dst_size = sizeof(Particle);
+ size_t dst_offset[NFIELDS] = {HOFFSET(Particle, name), HOFFSET(Particle, lati), HOFFSET(Particle, longi),
+ HOFFSET(Particle, pressure), HOFFSET(Particle, temperature)};
+ size_t dst_sizes[NFIELDS] = {sizeof(dst_buf[0].name), sizeof(dst_buf[0].lati), sizeof(dst_buf[0].longi),
+ sizeof(dst_buf[0].pressure), sizeof(dst_buf[0].temperature)};
+ size_t field_offset_pos[2] = {HOFFSET(Position, lati), HOFFSET(Position, longi)};
+ const char *field_names[NFIELDS] = /* Define field information */
+ {"Name", "Latitude", "Longitude", "Pressure", "Temperature"};
+ hid_t field_type[NFIELDS];
+ hid_t string_type;
+ hid_t file_id;
+ hsize_t chunk_size = 10;
+ Particle fill_data[1] = {{"no data", -1, -1, -99.0f, -99.0}}; /* Fill value particle */
+ hsize_t start; /* Record to start reading/writing */
+ hsize_t nrecords; /* Number of records to read/write */
+ int compress = 0;
+ int i;
+ Particle *p_data = NULL; /* Initially no data */
+ float pressure_in[NRECORDS_ADD] = /* Define new values for the field "Pressure" */
+ {0.0f, 1.0f, 2.0f};
+ Position position_in[NRECORDS_ADD] = {/* Define new values for "Latitude,Longitude" */
+ {0, 0},
+ {10, 10},
+ {20, 20}};
+ NamePressure namepre_in[NRECORDS_ADD] = /* Define new values for "Name,Pressure" */
+ {
+ {"zero", 0.0f},
+ {"one", 1.0f},
+ {"two", 2.0f},
+ };
+ size_t field_sizes_pos[2] = {sizeof(position_in[0].longi), sizeof(position_in[0].lati)};
+ size_t field_sizes_pre[1] = {sizeof(namepre_in[0].pressure)};
+
+ /* Initialize the field field_type */
+ string_type = H5Tcopy(H5T_C_S1);
+ H5Tset_size(string_type, 16);
+ field_type[0] = string_type;
+ field_type[1] = H5T_NATIVE_INT;
+ field_type[2] = H5T_NATIVE_INT;
+ field_type[3] = H5T_NATIVE_FLOAT;
+ field_type[4] = H5T_NATIVE_DOUBLE;
+
+ /* Create a new file using default properties. */
+ file_id = H5Fcreate("ex_table_04.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Make the table */
+ H5TBmake_table("Table Title", file_id, TABLE_NAME, NFIELDS, NRECORDS, dst_size, field_names, dst_offset,
+ field_type, chunk_size, fill_data, compress, p_data);
+
+ /* Write the pressure field starting at record 2 */
+ start = 2;
+ nrecords = NRECORDS_ADD;
+ H5TBwrite_fields_name(file_id, TABLE_NAME, "Pressure", start, nrecords, sizeof(float), 0, field_sizes_pre,
+ pressure_in);
+
+ /* Write the new longitude and latitude information starting at record 2 */
+ start = 2;
+ nrecords = NRECORDS_ADD;
+ H5TBwrite_fields_name(file_id, TABLE_NAME, "Latitude,Longitude", start, nrecords, sizeof(Position),
+ field_offset_pos, field_sizes_pos, position_in);
+
+ /* read the table */
+ H5TBread_table(file_id, TABLE_NAME, dst_size, dst_offset, dst_sizes, dst_buf);
+
+ /* print it by rows */
+ for (i = 0; i < NRECORDS; i++) {
+ printf("%-5s %-5d %-5d %-5f %-5f", dst_buf[i].name, dst_buf[i].lati, dst_buf[i].longi,
+ dst_buf[i].pressure, dst_buf[i].temperature);
+ printf("\n");
+ }
+
+ /*-------------------------------------------------------------------------
+ * end
+ *-------------------------------------------------------------------------
+ */
+
+ /* close type */
+ H5Tclose(string_type);
+
+ /* close the file */
+ H5Fclose(file_id);
+
+ return 0;
}
-
diff --git a/hl/examples/ex_table_05.c b/hl/examples/ex_table_05.c
index b43d635..ab1b77f 100644
--- a/hl/examples/ex_table_05.c
+++ b/hl/examples/ex_table_05.c
@@ -11,7 +11,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
#include "hdf5.h"
#include "hdf5_hl.h"
#include <stdlib.h>
@@ -24,142 +23,111 @@
*-------------------------------------------------------------------------
*/
-#define NFIELDS (hsize_t) 5
-#define NRECORDS (hsize_t) 8
-#define NRECORDS_ADD (hsize_t) 3
-#define TABLE_NAME "table"
-
-
+#define NFIELDS (hsize_t)5
+#define NRECORDS (hsize_t)8
+#define NRECORDS_ADD (hsize_t)3
+#define TABLE_NAME "table"
-int main( void )
+int
+main(void)
{
- typedef struct Particle
- {
- char name[16];
- int lati;
- int longi;
- float pressure;
- double temperature;
- } Particle;
-
- /* Define a subset of Particle, with latitude and longitude fields */
- typedef struct Position
- {
- int lati;
- int longi;
- } Position;
-
- /* Calculate the type_size and the offsets of our struct members */
- Particle dst_buf[NRECORDS];
- size_t dst_size = sizeof( Particle );
- size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ),
- HOFFSET( Particle, lati ),
- HOFFSET( Particle, longi ),
- HOFFSET( Particle, pressure ),
- HOFFSET( Particle, temperature )};
- size_t dst_sizes[NFIELDS] = { sizeof( dst_buf[0].name),
- sizeof( dst_buf[0].lati),
- sizeof( dst_buf[0].longi),
- sizeof( dst_buf[0].pressure),
- sizeof( dst_buf[0].temperature)};
-
- size_t field_offset_pos[2] = { HOFFSET( Position, lati ),
- HOFFSET( Position, longi )};
-
- /* Initially no data */
- Particle *p_data = NULL;
-
- /* Define field information */
- const char *field_names[NFIELDS] =
- { "Name","Latitude", "Longitude", "Pressure", "Temperature" };
- hid_t field_type[NFIELDS];
- hid_t string_type;
- hid_t file_id;
- hsize_t chunk_size = 10;
- Particle fill_data[1] =
- { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */
- int compress = 0;
- hsize_t nfields;
- hsize_t start; /* Record to start reading/writing */
- hsize_t nrecords; /* Number of records to read/write */
- int i;
-
- /* Define new values for the field "Pressure" */
- float pressure_in [NRECORDS_ADD] =
- { 0.0f,1.0f,2.0f};
- int field_index_pre[1] = { 3 };
- int field_index_pos[2] = { 1,2 };
-
- /* Define new values for the fields "Latitude,Longitude" */
- Position position_in[NRECORDS_ADD] = { {0,0},
- {10,10},
- {20,20} };
-
- size_t field_sizes_pos[2]=
- {
- sizeof(position_in[0].longi),
- sizeof(position_in[0].lati)
- };
-
- size_t field_sizes_pre[1]=
- {
- sizeof(float)
- };
-
- /* Initialize the field field_type */
- string_type = H5Tcopy( H5T_C_S1 );
- H5Tset_size( string_type, 16 );
- field_type[0] = string_type;
- field_type[1] = H5T_NATIVE_INT;
- field_type[2] = H5T_NATIVE_INT;
- field_type[3] = H5T_NATIVE_FLOAT;
- field_type[4] = H5T_NATIVE_DOUBLE;
-
- /* Create a new file using default properties. */
- file_id = H5Fcreate( "ex_table_05.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
- /* Make the table */
- H5TBmake_table( "Table Title", file_id, TABLE_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
- chunk_size, fill_data, compress, p_data );
-
- /* Write the pressure field starting at record 2 */
- nfields = 1;
- start = 2;
- nrecords = NRECORDS_ADD;
- H5TBwrite_fields_index( file_id, TABLE_NAME, nfields, field_index_pre, start, nrecords,
- sizeof( float ), 0, field_sizes_pre, pressure_in );
-
-
- /* Write the new longitude and latitude information starting at record 2 */
- nfields = 2;
- start = 2;
- nrecords = NRECORDS_ADD;
- H5TBwrite_fields_index( file_id, TABLE_NAME, nfields, field_index_pos, start, nrecords,
- sizeof( Position ), field_offset_pos, field_sizes_pos, position_in );
-
-
- /* read the table */
- H5TBread_table( file_id, TABLE_NAME, dst_size, dst_offset, dst_sizes, dst_buf );
-
- /* print it by rows */
- for (i=0; i<NRECORDS; i++) {
- printf ("%-5s %-5d %-5d %-5f %-5f",
- dst_buf[i].name,
- dst_buf[i].lati,
- dst_buf[i].longi,
- dst_buf[i].pressure,
- dst_buf[i].temperature);
- printf ("\n");
- }
-
- /* close type */
- H5Tclose( string_type );
-
- /* close the file */
- H5Fclose( file_id );
-
- return 0;
-
+ typedef struct Particle {
+ char name[16];
+ int lati;
+ int longi;
+ float pressure;
+ double temperature;
+ } Particle;
+
+ /* Define a subset of Particle, with latitude and longitude fields */
+ typedef struct Position {
+ int lati;
+ int longi;
+ } Position;
+
+ /* Calculate the type_size and the offsets of our struct members */
+ Particle dst_buf[NRECORDS];
+ size_t dst_size = sizeof(Particle);
+ size_t dst_offset[NFIELDS] = {HOFFSET(Particle, name), HOFFSET(Particle, lati), HOFFSET(Particle, longi),
+ HOFFSET(Particle, pressure), HOFFSET(Particle, temperature)};
+ size_t dst_sizes[NFIELDS] = {sizeof(dst_buf[0].name), sizeof(dst_buf[0].lati), sizeof(dst_buf[0].longi),
+ sizeof(dst_buf[0].pressure), sizeof(dst_buf[0].temperature)};
+
+ size_t field_offset_pos[2] = {HOFFSET(Position, lati), HOFFSET(Position, longi)};
+
+ /* Initially no data */
+ Particle *p_data = NULL;
+
+ /* Define field information */
+ const char *field_names[NFIELDS] = {"Name", "Latitude", "Longitude", "Pressure", "Temperature"};
+ hid_t field_type[NFIELDS];
+ hid_t string_type;
+ hid_t file_id;
+ hsize_t chunk_size = 10;
+ Particle fill_data[1] = {{"no data", -1, -1, -99.0f, -99.0}}; /* Fill value particle */
+ int compress = 0;
+ hsize_t nfields;
+ hsize_t start; /* Record to start reading/writing */
+ hsize_t nrecords; /* Number of records to read/write */
+ int i;
+
+ /* Define new values for the field "Pressure" */
+ float pressure_in[NRECORDS_ADD] = {0.0f, 1.0f, 2.0f};
+ int field_index_pre[1] = {3};
+ int field_index_pos[2] = {1, 2};
+
+ /* Define new values for the fields "Latitude,Longitude" */
+ Position position_in[NRECORDS_ADD] = {{0, 0}, {10, 10}, {20, 20}};
+
+ size_t field_sizes_pos[2] = {sizeof(position_in[0].longi), sizeof(position_in[0].lati)};
+
+ size_t field_sizes_pre[1] = {sizeof(float)};
+
+ /* Initialize the field field_type */
+ string_type = H5Tcopy(H5T_C_S1);
+ H5Tset_size(string_type, 16);
+ field_type[0] = string_type;
+ field_type[1] = H5T_NATIVE_INT;
+ field_type[2] = H5T_NATIVE_INT;
+ field_type[3] = H5T_NATIVE_FLOAT;
+ field_type[4] = H5T_NATIVE_DOUBLE;
+
+ /* Create a new file using default properties. */
+ file_id = H5Fcreate("ex_table_05.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Make the table */
+ H5TBmake_table("Table Title", file_id, TABLE_NAME, NFIELDS, NRECORDS, dst_size, field_names, dst_offset,
+ field_type, chunk_size, fill_data, compress, p_data);
+
+ /* Write the pressure field starting at record 2 */
+ nfields = 1;
+ start = 2;
+ nrecords = NRECORDS_ADD;
+ H5TBwrite_fields_index(file_id, TABLE_NAME, nfields, field_index_pre, start, nrecords, sizeof(float), 0,
+ field_sizes_pre, pressure_in);
+
+ /* Write the new longitude and latitude information starting at record 2 */
+ nfields = 2;
+ start = 2;
+ nrecords = NRECORDS_ADD;
+ H5TBwrite_fields_index(file_id, TABLE_NAME, nfields, field_index_pos, start, nrecords, sizeof(Position),
+ field_offset_pos, field_sizes_pos, position_in);
+
+ /* read the table */
+ H5TBread_table(file_id, TABLE_NAME, dst_size, dst_offset, dst_sizes, dst_buf);
+
+ /* print it by rows */
+ for (i = 0; i < NRECORDS; i++) {
+ printf("%-5s %-5d %-5d %-5f %-5f", dst_buf[i].name, dst_buf[i].lati, dst_buf[i].longi,
+ dst_buf[i].pressure, dst_buf[i].temperature);
+ printf("\n");
+ }
+
+ /* close type */
+ H5Tclose(string_type);
+
+ /* close the file */
+ H5Fclose(file_id);
+
+ return 0;
}
-
diff --git a/hl/examples/ex_table_06.c b/hl/examples/ex_table_06.c
index 0397e83..2784430 100644
--- a/hl/examples/ex_table_06.c
+++ b/hl/examples/ex_table_06.c
@@ -23,73 +23,64 @@
*-------------------------------------------------------------------------
*/
-#define NFIELDS (hsize_t) 5
-#define NRECORDS (hsize_t) 8
+#define NFIELDS (hsize_t)5
+#define NRECORDS (hsize_t)8
#define TABLE_NAME "table"
-int main( void )
+int
+main(void)
{
- typedef struct Particle
- {
- char name[16];
- int lati;
- int longi;
- float pressure;
- double temperature;
- } Particle;
-
- /* Calculate the size and the offsets of our struct members in memory */
- size_t dst_size = sizeof( Particle );
- size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ),
- HOFFSET( Particle, lati ),
- HOFFSET( Particle, longi ),
- HOFFSET( Particle, pressure ),
- HOFFSET( Particle, temperature )};
-
- /* Define field information */
- const char *field_names[NFIELDS] =
- { "Name","Latitude", "Longitude", "Pressure", "Temperature" };
- hid_t field_type[NFIELDS];
- hid_t string_type;
- hid_t file_id;
- hsize_t chunk_size = 10;
- Particle fill_data[1] =
- { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */
- int compress = 0;
- hsize_t nfields_out;
- hsize_t nrecords_out;
-
- /* Initialize field_type */
- string_type = H5Tcopy( H5T_C_S1 );
- H5Tset_size( string_type, 16 );
- field_type[0] = string_type;
- field_type[1] = H5T_NATIVE_INT;
- field_type[2] = H5T_NATIVE_INT;
- field_type[3] = H5T_NATIVE_FLOAT;
- field_type[4] = H5T_NATIVE_DOUBLE;
-
- /* Create a new file using default properties. */
- file_id = H5Fcreate( "ex_table_06.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
- /* Make a table */
- H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,dst_size,
- field_names, dst_offset, field_type,
- chunk_size, fill_data, compress, NULL);
-
- /* Get table info */
- H5TBget_table_info (file_id,TABLE_NAME, &nfields_out, &nrecords_out );
-
- /* print */
- printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out);
-
- /* close type */
- H5Tclose( string_type );
-
- /* close the file */
- H5Fclose( file_id );
-
- return 0;
-
-
+ typedef struct Particle {
+ char name[16];
+ int lati;
+ int longi;
+ float pressure;
+ double temperature;
+ } Particle;
+
+ /* Calculate the size and the offsets of our struct members in memory */
+ size_t dst_size = sizeof(Particle);
+ size_t dst_offset[NFIELDS] = {HOFFSET(Particle, name), HOFFSET(Particle, lati), HOFFSET(Particle, longi),
+ HOFFSET(Particle, pressure), HOFFSET(Particle, temperature)};
+
+ /* Define field information */
+ const char *field_names[NFIELDS] = {"Name", "Latitude", "Longitude", "Pressure", "Temperature"};
+ hid_t field_type[NFIELDS];
+ hid_t string_type;
+ hid_t file_id;
+ hsize_t chunk_size = 10;
+ Particle fill_data[1] = {{"no data", -1, -1, -99.0f, -99.0}}; /* Fill value particle */
+ int compress = 0;
+ hsize_t nfields_out;
+ hsize_t nrecords_out;
+
+ /* Initialize field_type */
+ string_type = H5Tcopy(H5T_C_S1);
+ H5Tset_size(string_type, 16);
+ field_type[0] = string_type;
+ field_type[1] = H5T_NATIVE_INT;
+ field_type[2] = H5T_NATIVE_INT;
+ field_type[3] = H5T_NATIVE_FLOAT;
+ field_type[4] = H5T_NATIVE_DOUBLE;
+
+ /* Create a new file using default properties. */
+ file_id = H5Fcreate("ex_table_06.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Make a table */
+ H5TBmake_table("Table Title", file_id, TABLE_NAME, NFIELDS, NRECORDS, dst_size, field_names, dst_offset,
+ field_type, chunk_size, fill_data, compress, NULL);
+
+ /* Get table info */
+ H5TBget_table_info(file_id, TABLE_NAME, &nfields_out, &nrecords_out);
+
+ /* print */
+ printf("Table has %d fields and %d records\n", (int)nfields_out, (int)nrecords_out);
+
+ /* close type */
+ H5Tclose(string_type);
+
+ /* close the file */
+ H5Fclose(file_id);
+
+ return 0;
}
-
diff --git a/hl/examples/ex_table_07.c b/hl/examples/ex_table_07.c
index d9ea444..b12cc27 100644
--- a/hl/examples/ex_table_07.c
+++ b/hl/examples/ex_table_07.c
@@ -23,90 +23,77 @@
*-------------------------------------------------------------------------
*/
-#define NFIELDS (hsize_t) 5
-#define NRECORDS (hsize_t) 8
-#define TABLE_NAME "table"
+#define NFIELDS (hsize_t)5
+#define NRECORDS (hsize_t)8
+#define TABLE_NAME "table"
-int main( void )
+int
+main(void)
{
- typedef struct Particle
- {
- char name[16];
- int lati;
- int longi;
- float pressure;
- double temperature;
- } Particle;
-
- /* Calculate the size and the offsets of our struct members in memory */
- size_t dst_size = sizeof( Particle );
- size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ),
- HOFFSET( Particle, lati ),
- HOFFSET( Particle, longi ),
- HOFFSET( Particle, pressure ),
- HOFFSET( Particle, temperature )};
-
- /* Define an array of Particles */
- Particle p_data[NRECORDS] = {
- {"zero",0,0, 0.0f, 0.0},
- {"one",10,10, 1.0f, 10.0},
- {"two", 20,20, 2.0f, 20.0},
- {"three",30,30, 3.0f, 30.0},
- {"four", 40,40, 4.0f, 40.0},
- {"five", 50,50, 5.0f, 50.0},
- {"six", 60,60, 6.0f, 60.0},
- {"seven",70,70, 7.0f, 70.0}
- };
-
- const char *field_names[NFIELDS] = /* Define field information */
- { "Name","Latitude", "Longitude", "Pressure", "Temperature" };
- hid_t field_type[NFIELDS];
- hid_t string_type;
- hid_t file_id;
- hsize_t chunk_size = 10;
- int compress = 0;
- Particle fill_data[1] =
- { {"no data",-1,-1, -99.0f, -99.0} };
- hsize_t start; /* Record to start reading */
- hsize_t nrecords; /* Number of records to insert/delete */
- hsize_t nfields_out;
- hsize_t nrecords_out;
-
- /* Initialize the field field_type */
- string_type = H5Tcopy( H5T_C_S1 );
- H5Tset_size( string_type, 16 );
- field_type[0] = string_type;
- field_type[1] = H5T_NATIVE_INT;
- field_type[2] = H5T_NATIVE_INT;
- field_type[3] = H5T_NATIVE_FLOAT;
- field_type[4] = H5T_NATIVE_DOUBLE;
-
- /* Create a new file using default properties. */
- file_id = H5Fcreate( "ex_table_07.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
- /* Make the table */
- H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
- chunk_size, fill_data, compress, p_data );
-
- /* Delete records */
- start = 3;
- nrecords = 3;
- H5TBdelete_record( file_id, TABLE_NAME, start, nrecords );
-
- /* Get table info */
- H5TBget_table_info (file_id,TABLE_NAME, &nfields_out, &nrecords_out );
-
- /* print */
- printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out);
-
- /* close type */
- H5Tclose( string_type );
-
- /* close the file */
- H5Fclose( file_id );
-
- return 0;
-
+ typedef struct Particle {
+ char name[16];
+ int lati;
+ int longi;
+ float pressure;
+ double temperature;
+ } Particle;
+
+ /* Calculate the size and the offsets of our struct members in memory */
+ size_t dst_size = sizeof(Particle);
+ size_t dst_offset[NFIELDS] = {HOFFSET(Particle, name), HOFFSET(Particle, lati), HOFFSET(Particle, longi),
+ HOFFSET(Particle, pressure), HOFFSET(Particle, temperature)};
+
+ /* Define an array of Particles */
+ Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0},
+ {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0},
+ {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0},
+ {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}};
+
+ const char *field_names[NFIELDS] = /* Define field information */
+ {"Name", "Latitude", "Longitude", "Pressure", "Temperature"};
+ hid_t field_type[NFIELDS];
+ hid_t string_type;
+ hid_t file_id;
+ hsize_t chunk_size = 10;
+ int compress = 0;
+ Particle fill_data[1] = {{"no data", -1, -1, -99.0f, -99.0}};
+ hsize_t start; /* Record to start reading */
+ hsize_t nrecords; /* Number of records to insert/delete */
+ hsize_t nfields_out;
+ hsize_t nrecords_out;
+
+ /* Initialize the field field_type */
+ string_type = H5Tcopy(H5T_C_S1);
+ H5Tset_size(string_type, 16);
+ field_type[0] = string_type;
+ field_type[1] = H5T_NATIVE_INT;
+ field_type[2] = H5T_NATIVE_INT;
+ field_type[3] = H5T_NATIVE_FLOAT;
+ field_type[4] = H5T_NATIVE_DOUBLE;
+
+ /* Create a new file using default properties. */
+ file_id = H5Fcreate("ex_table_07.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Make the table */
+ H5TBmake_table("Table Title", file_id, TABLE_NAME, NFIELDS, NRECORDS, dst_size, field_names, dst_offset,
+ field_type, chunk_size, fill_data, compress, p_data);
+
+ /* Delete records */
+ start = 3;
+ nrecords = 3;
+ H5TBdelete_record(file_id, TABLE_NAME, start, nrecords);
+
+ /* Get table info */
+ H5TBget_table_info(file_id, TABLE_NAME, &nfields_out, &nrecords_out);
+
+ /* print */
+ printf("Table has %d fields and %d records\n", (int)nfields_out, (int)nrecords_out);
+
+ /* close type */
+ H5Tclose(string_type);
+
+ /* close the file */
+ H5Fclose(file_id);
+
+ return 0;
}
-
diff --git a/hl/examples/ex_table_08.c b/hl/examples/ex_table_08.c
index a45520d..4210460 100644
--- a/hl/examples/ex_table_08.c
+++ b/hl/examples/ex_table_08.c
@@ -22,121 +22,96 @@
*-------------------------------------------------------------------------
*/
-#define NFIELDS (hsize_t) 5
-#define NRECORDS (hsize_t) 8
-#define NRECORDS_INS (hsize_t) 2
-#define TABLE_NAME "table"
+#define NFIELDS (hsize_t)5
+#define NRECORDS (hsize_t)8
+#define NRECORDS_INS (hsize_t)2
+#define TABLE_NAME "table"
-int main( void )
+int
+main(void)
{
- typedef struct Particle
- {
- char name[16];
- int lati;
- int longi;
- float pressure;
- double temperature;
- } Particle;
-
- Particle dst_buf[ NRECORDS + NRECORDS_INS ];
-
- /* Define an array of Particles */
- Particle p_data[NRECORDS] = {
- {"zero",0,0, 0.0f, 0.0},
- {"one",10,10, 1.0f, 10.0},
- {"two", 20,20, 2.0f, 20.0},
- {"three",30,30, 3.0f, 30.0},
- {"four", 40,40, 4.0f, 40.0},
- {"five", 50,50, 5.0f, 50.0},
- {"six", 60,60, 6.0f, 60.0},
- {"seven",70,70, 7.0f, 70.0}
- };
-
- /* Calculate the size and the offsets of our struct members in memory */
- size_t dst_size = sizeof( Particle );
- size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ),
- HOFFSET( Particle, lati ),
- HOFFSET( Particle, longi ),
- HOFFSET( Particle, pressure ),
- HOFFSET( Particle, temperature )};
- size_t dst_sizes[NFIELDS] = { sizeof( p_data[0].name),
- sizeof( p_data[0].lati),
- sizeof( p_data[0].longi),
- sizeof( p_data[0].pressure),
- sizeof( p_data[0].temperature)};
-
- /* Define an array of Particles to insert */
- Particle p_data_insert[NRECORDS_INS] =
- { {"new",30,30, 3.0f, 30.0},
- {"new",40,40, 4.0f, 40.0}
- };
-
- /* Define field information */
- const char *field_names[NFIELDS] =
- { "Name","Latitude", "Longitude", "Pressure", "Temperature" };
- hid_t field_type[NFIELDS];
- hid_t string_type;
- hid_t file_id;
- hsize_t chunk_size = 10;
- int compress = 0;
- int *fill_data = NULL;
- hsize_t start; /* Record to start reading */
- hsize_t nrecords; /* Number of records to insert/delete */
- hsize_t nfields_out;
- hsize_t nrecords_out;
- int i;
-
- /* Initialize the field field_type */
- string_type = H5Tcopy( H5T_C_S1 );
- H5Tset_size( string_type, 16 );
- field_type[0] = string_type;
- field_type[1] = H5T_NATIVE_INT;
- field_type[2] = H5T_NATIVE_INT;
- field_type[3] = H5T_NATIVE_FLOAT;
- field_type[4] = H5T_NATIVE_DOUBLE;
-
- /* Create a new file using default properties. */
- file_id = H5Fcreate( "ex_table_08.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
- /* Make the table */
- H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
- chunk_size, fill_data, compress, p_data );
-
- /* Insert records */
- start = 3;
- nrecords = NRECORDS_INS;
- H5TBinsert_record( file_id, TABLE_NAME, start, nrecords, dst_size, dst_offset,
- dst_sizes, p_data_insert );
-
- /* read the table */
- H5TBread_table( file_id, TABLE_NAME, dst_size, dst_offset, dst_sizes, dst_buf );
-
- /* get table info */
- H5TBget_table_info(file_id,TABLE_NAME, &nfields_out, &nrecords_out );
-
- /* print */
- printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out);
-
- /* print it by rows */
- for (i=0; i<nrecords_out; i++) {
- printf ("%-5s %-5d %-5d %-5f %-5f",
- dst_buf[i].name,
- dst_buf[i].lati,
- dst_buf[i].longi,
- dst_buf[i].pressure,
- dst_buf[i].temperature);
- printf ("\n");
- }
-
-
- /* close type */
- H5Tclose( string_type );
-
- /* close the file */
- H5Fclose( file_id );
-
- return 0;
-
+ typedef struct Particle {
+ char name[16];
+ int lati;
+ int longi;
+ float pressure;
+ double temperature;
+ } Particle;
+
+ Particle dst_buf[NRECORDS + NRECORDS_INS];
+
+ /* Define an array of Particles */
+ Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0},
+ {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0},
+ {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0},
+ {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}};
+
+ /* Calculate the size and the offsets of our struct members in memory */
+ size_t dst_size = sizeof(Particle);
+ size_t dst_offset[NFIELDS] = {HOFFSET(Particle, name), HOFFSET(Particle, lati), HOFFSET(Particle, longi),
+ HOFFSET(Particle, pressure), HOFFSET(Particle, temperature)};
+ size_t dst_sizes[NFIELDS] = {sizeof(p_data[0].name), sizeof(p_data[0].lati), sizeof(p_data[0].longi),
+ sizeof(p_data[0].pressure), sizeof(p_data[0].temperature)};
+
+ /* Define an array of Particles to insert */
+ Particle p_data_insert[NRECORDS_INS] = {{"new", 30, 30, 3.0f, 30.0}, {"new", 40, 40, 4.0f, 40.0}};
+
+ /* Define field information */
+ const char *field_names[NFIELDS] = {"Name", "Latitude", "Longitude", "Pressure", "Temperature"};
+ hid_t field_type[NFIELDS];
+ hid_t string_type;
+ hid_t file_id;
+ hsize_t chunk_size = 10;
+ int compress = 0;
+ int * fill_data = NULL;
+ hsize_t start; /* Record to start reading */
+ hsize_t nrecords; /* Number of records to insert/delete */
+ hsize_t nfields_out;
+ hsize_t nrecords_out;
+ int i;
+
+ /* Initialize the field field_type */
+ string_type = H5Tcopy(H5T_C_S1);
+ H5Tset_size(string_type, 16);
+ field_type[0] = string_type;
+ field_type[1] = H5T_NATIVE_INT;
+ field_type[2] = H5T_NATIVE_INT;
+ field_type[3] = H5T_NATIVE_FLOAT;
+ field_type[4] = H5T_NATIVE_DOUBLE;
+
+ /* Create a new file using default properties. */
+ file_id = H5Fcreate("ex_table_08.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Make the table */
+ H5TBmake_table("Table Title", file_id, TABLE_NAME, NFIELDS, NRECORDS, dst_size, field_names, dst_offset,
+ field_type, chunk_size, fill_data, compress, p_data);
+
+ /* Insert records */
+ start = 3;
+ nrecords = NRECORDS_INS;
+ H5TBinsert_record(file_id, TABLE_NAME, start, nrecords, dst_size, dst_offset, dst_sizes, p_data_insert);
+
+ /* read the table */
+ H5TBread_table(file_id, TABLE_NAME, dst_size, dst_offset, dst_sizes, dst_buf);
+
+ /* get table info */
+ H5TBget_table_info(file_id, TABLE_NAME, &nfields_out, &nrecords_out);
+
+ /* print */
+ printf("Table has %d fields and %d records\n", (int)nfields_out, (int)nrecords_out);
+
+ /* print it by rows */
+ for (i = 0; i < nrecords_out; i++) {
+ printf("%-5s %-5d %-5d %-5f %-5f", dst_buf[i].name, dst_buf[i].lati, dst_buf[i].longi,
+ dst_buf[i].pressure, dst_buf[i].temperature);
+ printf("\n");
+ }
+
+ /* close type */
+ H5Tclose(string_type);
+
+ /* close the file */
+ H5Fclose(file_id);
+
+ return 0;
}
-
diff --git a/hl/examples/ex_table_09.c b/hl/examples/ex_table_09.c
index a9f5f11..5374aff 100644
--- a/hl/examples/ex_table_09.c
+++ b/hl/examples/ex_table_09.c
@@ -22,121 +22,99 @@
*-------------------------------------------------------------------------
*/
-#define NFIELDS (hsize_t) 5
-#define NRECORDS (hsize_t) 8
-#define NRECORDS_INS (hsize_t) 2
-#define TABLE1_NAME "table1"
-#define TABLE2_NAME "table2"
-
-int main( void )
+#define NFIELDS (hsize_t)5
+#define NRECORDS (hsize_t)8
+#define NRECORDS_INS (hsize_t)2
+#define TABLE1_NAME "table1"
+#define TABLE2_NAME "table2"
+
+int
+main(void)
{
- typedef struct Particle
- {
- char name[16];
- int lati;
- int longi;
- float pressure;
- double temperature;
- } Particle;
-
- Particle dst_buf[ NRECORDS + NRECORDS_INS ];
-
- /* Calculate the size and the offsets of our struct members in memory */
- size_t dst_size = sizeof( Particle );
- size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ),
- HOFFSET( Particle, lati ),
- HOFFSET( Particle, longi ),
- HOFFSET( Particle, pressure ),
- HOFFSET( Particle, temperature )};
- size_t dst_sizes[NFIELDS] = { sizeof( dst_buf[0].name),
- sizeof( dst_buf[0].lati),
- sizeof( dst_buf[0].longi),
- sizeof( dst_buf[0].pressure),
- sizeof( dst_buf[0].temperature)};
-
- /* Define an array of Particles */
- Particle p_data[NRECORDS] = {
- {"zero",0,0, 0.0f, 0.0},
- {"one",10,10, 1.0f, 10.0},
- {"two", 20,20, 2.0f, 20.0},
- {"three",30,30, 3.0f, 30.0},
- {"four", 40,40, 4.0f, 40.0},
- {"five", 50,50, 5.0f, 50.0},
- {"six", 60,60, 6.0f, 60.0},
- {"seven",70,70, 7.0f, 70.0}
- };
-
- /* Define field information */
- const char *field_names[NFIELDS] =
- { "Name","Latitude", "Longitude", "Pressure", "Temperature" };
- hid_t field_type[NFIELDS];
- hid_t string_type;
- hid_t file_id;
- hsize_t chunk_size = 10;
- int compress = 0;
- Particle fill_data[1] =
- { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */
- hsize_t start1; /* Record to start reading from 1st table */
- hsize_t nrecords; /* Number of records to insert */
- hsize_t start2; /* Record to start writing in 2nd table */
- int i;
- hsize_t nfields_out;
- hsize_t nrecords_out;
-
- /* Initialize the field field_type */
- string_type = H5Tcopy( H5T_C_S1 );
- H5Tset_size( string_type, 16 );
- field_type[0] = string_type;
- field_type[1] = H5T_NATIVE_INT;
- field_type[2] = H5T_NATIVE_INT;
- field_type[3] = H5T_NATIVE_FLOAT;
- field_type[4] = H5T_NATIVE_DOUBLE;
-
- /* Create a new file using default properties. */
- file_id = H5Fcreate( "ex_table_09.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
- /* Make 2 tables: TABLE2_NAME is empty */
- H5TBmake_table( "Table Title",file_id,TABLE1_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
- chunk_size, fill_data, compress, p_data );
-
- H5TBmake_table( "Table Title",file_id,TABLE2_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
- chunk_size, fill_data, compress, NULL );
-
-
- /* Add 2 records from TABLE1_NAME to TABLE2_NAME */
- start1 = 3;
- nrecords = NRECORDS_INS;
- start2 = 6;
- H5TBadd_records_from( file_id, TABLE1_NAME, start1, nrecords, TABLE2_NAME, start2 );
-
- /* read TABLE2_NAME: it should have 2 more records now */
- H5TBread_table( file_id, TABLE2_NAME, dst_size, dst_offset, dst_sizes, dst_buf );
-
- /* Get table info */
- H5TBget_table_info (file_id,TABLE2_NAME, &nfields_out, &nrecords_out );
-
- /* print */
- printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out);
-
- /* print it by rows */
- for (i=0; i<nrecords_out; i++) {
- printf ("%-5s %-5d %-5d %-5f %-5f",
- dst_buf[i].name,
- dst_buf[i].lati,
- dst_buf[i].longi,
- dst_buf[i].pressure,
- dst_buf[i].temperature);
- printf ("\n");
- }
-
- /* close type */
- H5Tclose( string_type );
-
- /* close the file */
- H5Fclose( file_id );
-
- return 0;
+ typedef struct Particle {
+ char name[16];
+ int lati;
+ int longi;
+ float pressure;
+ double temperature;
+ } Particle;
+
+ Particle dst_buf[NRECORDS + NRECORDS_INS];
+
+ /* Calculate the size and the offsets of our struct members in memory */
+ size_t dst_size = sizeof(Particle);
+ size_t dst_offset[NFIELDS] = {HOFFSET(Particle, name), HOFFSET(Particle, lati), HOFFSET(Particle, longi),
+ HOFFSET(Particle, pressure), HOFFSET(Particle, temperature)};
+ size_t dst_sizes[NFIELDS] = {sizeof(dst_buf[0].name), sizeof(dst_buf[0].lati), sizeof(dst_buf[0].longi),
+ sizeof(dst_buf[0].pressure), sizeof(dst_buf[0].temperature)};
+
+ /* Define an array of Particles */
+ Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0},
+ {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0},
+ {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0},
+ {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}};
+
+ /* Define field information */
+ const char *field_names[NFIELDS] = {"Name", "Latitude", "Longitude", "Pressure", "Temperature"};
+ hid_t field_type[NFIELDS];
+ hid_t string_type;
+ hid_t file_id;
+ hsize_t chunk_size = 10;
+ int compress = 0;
+ Particle fill_data[1] = {{"no data", -1, -1, -99.0f, -99.0}}; /* Fill value particle */
+ hsize_t start1; /* Record to start reading from 1st table */
+ hsize_t nrecords; /* Number of records to insert */
+ hsize_t start2; /* Record to start writing in 2nd table */
+ int i;
+ hsize_t nfields_out;
+ hsize_t nrecords_out;
+
+ /* Initialize the field field_type */
+ string_type = H5Tcopy(H5T_C_S1);
+ H5Tset_size(string_type, 16);
+ field_type[0] = string_type;
+ field_type[1] = H5T_NATIVE_INT;
+ field_type[2] = H5T_NATIVE_INT;
+ field_type[3] = H5T_NATIVE_FLOAT;
+ field_type[4] = H5T_NATIVE_DOUBLE;
+
+ /* Create a new file using default properties. */
+ file_id = H5Fcreate("ex_table_09.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Make 2 tables: TABLE2_NAME is empty */
+ H5TBmake_table("Table Title", file_id, TABLE1_NAME, NFIELDS, NRECORDS, dst_size, field_names, dst_offset,
+ field_type, chunk_size, fill_data, compress, p_data);
+
+ H5TBmake_table("Table Title", file_id, TABLE2_NAME, NFIELDS, NRECORDS, dst_size, field_names, dst_offset,
+ field_type, chunk_size, fill_data, compress, NULL);
+
+ /* Add 2 records from TABLE1_NAME to TABLE2_NAME */
+ start1 = 3;
+ nrecords = NRECORDS_INS;
+ start2 = 6;
+ H5TBadd_records_from(file_id, TABLE1_NAME, start1, nrecords, TABLE2_NAME, start2);
+
+ /* read TABLE2_NAME: it should have 2 more records now */
+ H5TBread_table(file_id, TABLE2_NAME, dst_size, dst_offset, dst_sizes, dst_buf);
+
+ /* Get table info */
+ H5TBget_table_info(file_id, TABLE2_NAME, &nfields_out, &nrecords_out);
+
+ /* print */
+ printf("Table has %d fields and %d records\n", (int)nfields_out, (int)nrecords_out);
+
+ /* print it by rows */
+ for (i = 0; i < nrecords_out; i++) {
+ printf("%-5s %-5d %-5d %-5f %-5f", dst_buf[i].name, dst_buf[i].lati, dst_buf[i].longi,
+ dst_buf[i].pressure, dst_buf[i].temperature);
+ printf("\n");
+ }
+
+ /* close type */
+ H5Tclose(string_type);
+
+ /* close the file */
+ H5Fclose(file_id);
+
+ return 0;
}
-
diff --git a/hl/examples/ex_table_10.c b/hl/examples/ex_table_10.c
index 8c4d8ae..754974a 100644
--- a/hl/examples/ex_table_10.c
+++ b/hl/examples/ex_table_10.c
@@ -22,114 +22,92 @@
*-------------------------------------------------------------------------
*/
-#define NFIELDS (hsize_t) 5
-#define NRECORDS (hsize_t) 8
-#define TABLE1_NAME "table1"
-#define TABLE2_NAME "table2"
-#define TABLE3_NAME "table3"
-
-int main( void )
+#define NFIELDS (hsize_t)5
+#define NRECORDS (hsize_t)8
+#define TABLE1_NAME "table1"
+#define TABLE2_NAME "table2"
+#define TABLE3_NAME "table3"
+
+int
+main(void)
{
- typedef struct Particle
- {
- char name[16];
- int lati;
- int longi;
- float pressure;
- double temperature;
- } Particle;
-
- /* Define an array of Particles */
- Particle p_data[NRECORDS] = {
- {"zero",0,0, 0.0f, 0.0},
- {"one",10,10, 1.0f, 10.0},
- {"two", 20,20, 2.0f, 20.0},
- {"three",30,30, 3.0f, 30.0},
- {"four", 40,40, 4.0f, 40.0},
- {"five", 50,50, 5.0f, 50.0},
- {"six", 60,60, 6.0f, 60.0},
- {"seven",70,70, 7.0f, 70.0}
- };
-
- Particle dst_buf[ 2 * NRECORDS ];
- /* Calculate the size and the offsets of our struct members in memory */
- size_t dst_size = sizeof( Particle );
- size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ),
- HOFFSET( Particle, lati ),
- HOFFSET( Particle, longi ),
- HOFFSET( Particle, pressure ),
- HOFFSET( Particle, temperature )};
- size_t dst_sizes[NFIELDS] = { sizeof( dst_buf[0].name),
- sizeof( dst_buf[0].lati),
- sizeof( dst_buf[0].longi),
- sizeof( dst_buf[0].pressure),
- sizeof( dst_buf[0].temperature)};
-
-
- /* Define field information */
- const char *field_names[NFIELDS] =
- { "Name","Latitude", "Longitude", "Pressure", "Temperature" };
- hid_t field_type[NFIELDS];
- hid_t string_type;
- hid_t file_id;
- hsize_t chunk_size = 10;
- int compress = 0;
- int *fill_data = NULL;
- hsize_t nfields_out;
- hsize_t nrecords_out;
- int i;
-
- /* Initialize the field field_type */
- string_type = H5Tcopy( H5T_C_S1 );
- H5Tset_size( string_type, 16 );
- field_type[0] = string_type;
- field_type[1] = H5T_NATIVE_INT;
- field_type[2] = H5T_NATIVE_INT;
- field_type[3] = H5T_NATIVE_FLOAT;
- field_type[4] = H5T_NATIVE_DOUBLE;
-
- /* Create a new file using default properties. */
- file_id = H5Fcreate( "ex_table_10.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
- /* Make two tables */
- H5TBmake_table( "Table Title",file_id,TABLE1_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
- chunk_size, fill_data, compress, p_data );
-
- H5TBmake_table( "Table Title",file_id,TABLE2_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
- chunk_size, fill_data, compress, p_data );
-
- /* Combine the two tables into a third in the same file */
- H5TBcombine_tables( file_id, TABLE1_NAME, file_id, TABLE2_NAME, TABLE3_NAME );
-
- /* read the combined table */
- H5TBread_table( file_id, TABLE3_NAME, dst_size, dst_offset, dst_sizes, dst_buf );
-
- /* Get table info */
- H5TBget_table_info (file_id,TABLE3_NAME, &nfields_out, &nrecords_out );
-
- /* print */
- printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out);
-
- /* print it by rows */
- for (i=0; i<nrecords_out; i++) {
- printf ("%-5s %-5d %-5d %-5f %-5f",
- dst_buf[i].name,
- dst_buf[i].lati,
- dst_buf[i].longi,
- dst_buf[i].pressure,
- dst_buf[i].temperature);
- printf ("\n");
- }
-
- /* close type */
- H5Tclose( string_type );
-
- /* close the file */
- H5Fclose( file_id );
-
- return 0;
-
+ typedef struct Particle {
+ char name[16];
+ int lati;
+ int longi;
+ float pressure;
+ double temperature;
+ } Particle;
+
+ /* Define an array of Particles */
+ Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0},
+ {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0},
+ {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0},
+ {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}};
+
+ Particle dst_buf[2 * NRECORDS];
+ /* Calculate the size and the offsets of our struct members in memory */
+ size_t dst_size = sizeof(Particle);
+ size_t dst_offset[NFIELDS] = {HOFFSET(Particle, name), HOFFSET(Particle, lati), HOFFSET(Particle, longi),
+ HOFFSET(Particle, pressure), HOFFSET(Particle, temperature)};
+ size_t dst_sizes[NFIELDS] = {sizeof(dst_buf[0].name), sizeof(dst_buf[0].lati), sizeof(dst_buf[0].longi),
+ sizeof(dst_buf[0].pressure), sizeof(dst_buf[0].temperature)};
+
+ /* Define field information */
+ const char *field_names[NFIELDS] = {"Name", "Latitude", "Longitude", "Pressure", "Temperature"};
+ hid_t field_type[NFIELDS];
+ hid_t string_type;
+ hid_t file_id;
+ hsize_t chunk_size = 10;
+ int compress = 0;
+ int * fill_data = NULL;
+ hsize_t nfields_out;
+ hsize_t nrecords_out;
+ int i;
+
+ /* Initialize the field field_type */
+ string_type = H5Tcopy(H5T_C_S1);
+ H5Tset_size(string_type, 16);
+ field_type[0] = string_type;
+ field_type[1] = H5T_NATIVE_INT;
+ field_type[2] = H5T_NATIVE_INT;
+ field_type[3] = H5T_NATIVE_FLOAT;
+ field_type[4] = H5T_NATIVE_DOUBLE;
+
+ /* Create a new file using default properties. */
+ file_id = H5Fcreate("ex_table_10.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Make two tables */
+ H5TBmake_table("Table Title", file_id, TABLE1_NAME, NFIELDS, NRECORDS, dst_size, field_names, dst_offset,
+ field_type, chunk_size, fill_data, compress, p_data);
+
+ H5TBmake_table("Table Title", file_id, TABLE2_NAME, NFIELDS, NRECORDS, dst_size, field_names, dst_offset,
+ field_type, chunk_size, fill_data, compress, p_data);
+
+ /* Combine the two tables into a third in the same file */
+ H5TBcombine_tables(file_id, TABLE1_NAME, file_id, TABLE2_NAME, TABLE3_NAME);
+
+ /* read the combined table */
+ H5TBread_table(file_id, TABLE3_NAME, dst_size, dst_offset, dst_sizes, dst_buf);
+
+ /* Get table info */
+ H5TBget_table_info(file_id, TABLE3_NAME, &nfields_out, &nrecords_out);
+
+ /* print */
+ printf("Table has %d fields and %d records\n", (int)nfields_out, (int)nrecords_out);
+
+ /* print it by rows */
+ for (i = 0; i < nrecords_out; i++) {
+ printf("%-5s %-5d %-5d %-5f %-5f", dst_buf[i].name, dst_buf[i].lati, dst_buf[i].longi,
+ dst_buf[i].pressure, dst_buf[i].temperature);
+ printf("\n");
+ }
+
+ /* close type */
+ H5Tclose(string_type);
+
+ /* close the file */
+ H5Fclose(file_id);
+
+ return 0;
}
-
diff --git a/hl/examples/ex_table_11.c b/hl/examples/ex_table_11.c
index d6215cb..4f666b9 100644
--- a/hl/examples/ex_table_11.c
+++ b/hl/examples/ex_table_11.c
@@ -22,95 +22,81 @@
*-------------------------------------------------------------------------
*/
-#define NFIELDS (hsize_t) 5
-#define NRECORDS (hsize_t) 8
-#define TABLE_NAME "table"
+#define NFIELDS (hsize_t)5
+#define NRECORDS (hsize_t)8
+#define TABLE_NAME "table"
-int main( void )
+int
+main(void)
{
- typedef struct Particle1
- {
- char name[16];
- int lati;
- int longi;
- float pressure;
- double temperature;
- } Particle1;
-
-/* Define an array of Particles */
- Particle1 p_data[NRECORDS] = {
- {"zero",0,0, 0.0f, 0.0},
- {"one",10,10, 1.0f, 10.0},
- {"two", 20,20, 2.0f, 20.0},
- {"three",30,30, 3.0f, 30.0},
- {"four", 40,40, 4.0f, 40.0},
- {"five", 50,50, 5.0f, 50.0},
- {"six", 60,60, 6.0f, 60.0},
- {"seven",70,70, 7.0f, 70.0}
- };
-
- /* Calculate the size and the offsets of our struct members in memory */
- size_t dst_size1 = sizeof( Particle1 );
- size_t dst_offset1[NFIELDS] = { HOFFSET( Particle1, name ),
- HOFFSET( Particle1, lati ),
- HOFFSET( Particle1, longi ),
- HOFFSET( Particle1, pressure ),
- HOFFSET( Particle1, temperature )};
-
- /* Define field information */
- const char *field_names[NFIELDS] =
- { "Name","Latitude", "Longitude", "Pressure", "Temperature" };
- hid_t field_type[NFIELDS];
- hid_t string_type;
- hid_t file_id;
- hsize_t chunk_size = 10;
- int compress = 0;
- Particle1 fill_data[1] = { {"no data",-1,-1, -99.0f, -99.0} };
- int fill_data_new[1] = { -100 };
- hsize_t position;
- hsize_t nfields_out;
- hsize_t nrecords_out;
-
- /* Define the inserted field information */
- hid_t field_type_new = H5T_NATIVE_INT;
- int data[NRECORDS] = { 0,1,2,3,4,5,6,7 };
-
- /* Initialize the field type */
- string_type = H5Tcopy( H5T_C_S1 );
- H5Tset_size( string_type, 16 );
- field_type[0] = string_type;
- field_type[1] = H5T_NATIVE_INT;
- field_type[2] = H5T_NATIVE_INT;
- field_type[3] = H5T_NATIVE_FLOAT;
- field_type[4] = H5T_NATIVE_DOUBLE;
-
- /* Create a new file using default properties. */
- file_id = H5Fcreate( "ex_table_11.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
- /* Make the table */
- H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,
- dst_size1,field_names, dst_offset1, field_type,
- chunk_size, fill_data, compress, p_data );
-
- /* Insert the new field at the end of the field list */
- position = NFIELDS;
- H5TBinsert_field( file_id, TABLE_NAME, "New Field", field_type_new, position,
- fill_data_new, data );
-
- /* Get table info */
- H5TBget_table_info (file_id,TABLE_NAME, &nfields_out, &nrecords_out );
-
- /* print */
- printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out);
-
- /* close type */
- H5Tclose( string_type );
-
- /* close the file */
- H5Fclose( file_id );
-
- return 0;
-
-
+ typedef struct Particle1 {
+ char name[16];
+ int lati;
+ int longi;
+ float pressure;
+ double temperature;
+ } Particle1;
+
+ /* Define an array of Particles */
+ Particle1 p_data[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0},
+ {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0},
+ {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0},
+ {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}};
+
+ /* Calculate the size and the offsets of our struct members in memory */
+ size_t dst_size1 = sizeof(Particle1);
+ size_t dst_offset1[NFIELDS] = {HOFFSET(Particle1, name), HOFFSET(Particle1, lati),
+ HOFFSET(Particle1, longi), HOFFSET(Particle1, pressure),
+ HOFFSET(Particle1, temperature)};
+
+ /* Define field information */
+ const char *field_names[NFIELDS] = {"Name", "Latitude", "Longitude", "Pressure", "Temperature"};
+ hid_t field_type[NFIELDS];
+ hid_t string_type;
+ hid_t file_id;
+ hsize_t chunk_size = 10;
+ int compress = 0;
+ Particle1 fill_data[1] = {{"no data", -1, -1, -99.0f, -99.0}};
+ int fill_data_new[1] = {-100};
+ hsize_t position;
+ hsize_t nfields_out;
+ hsize_t nrecords_out;
+
+ /* Define the inserted field information */
+ hid_t field_type_new = H5T_NATIVE_INT;
+ int data[NRECORDS] = {0, 1, 2, 3, 4, 5, 6, 7};
+
+ /* Initialize the field type */
+ string_type = H5Tcopy(H5T_C_S1);
+ H5Tset_size(string_type, 16);
+ field_type[0] = string_type;
+ field_type[1] = H5T_NATIVE_INT;
+ field_type[2] = H5T_NATIVE_INT;
+ field_type[3] = H5T_NATIVE_FLOAT;
+ field_type[4] = H5T_NATIVE_DOUBLE;
+
+ /* Create a new file using default properties. */
+ file_id = H5Fcreate("ex_table_11.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Make the table */
+ H5TBmake_table("Table Title", file_id, TABLE_NAME, NFIELDS, NRECORDS, dst_size1, field_names, dst_offset1,
+ field_type, chunk_size, fill_data, compress, p_data);
+
+ /* Insert the new field at the end of the field list */
+ position = NFIELDS;
+ H5TBinsert_field(file_id, TABLE_NAME, "New Field", field_type_new, position, fill_data_new, data);
+
+ /* Get table info */
+ H5TBget_table_info(file_id, TABLE_NAME, &nfields_out, &nrecords_out);
+
+ /* print */
+ printf("Table has %d fields and %d records\n", (int)nfields_out, (int)nrecords_out);
+
+ /* close type */
+ H5Tclose(string_type);
+
+ /* close the file */
+ H5Fclose(file_id);
+
+ return 0;
}
-
diff --git a/hl/examples/ex_table_12.c b/hl/examples/ex_table_12.c
index f287c29..c13401f 100644
--- a/hl/examples/ex_table_12.c
+++ b/hl/examples/ex_table_12.c
@@ -23,87 +23,73 @@
*-------------------------------------------------------------------------
*/
-#define NFIELDS (hsize_t) 5
-#define NRECORDS (hsize_t) 8
-#define TABLE_NAME "table"
+#define NFIELDS (hsize_t)5
+#define NRECORDS (hsize_t)8
+#define TABLE_NAME "table"
-int main( void )
+int
+main(void)
{
- typedef struct Particle
- {
- char name[16];
- int lati;
- int longi;
- float pressure;
- double temperature;
- } Particle;
-
- /* Calculate the size and the offsets of our struct members in memory */
- size_t dst_size = sizeof( Particle );
- size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ),
- HOFFSET( Particle, lati ),
- HOFFSET( Particle, longi ),
- HOFFSET( Particle, pressure ),
- HOFFSET( Particle, temperature )};
-
- /* Define an array of Particles */
- Particle p_data[NRECORDS] = {
- {"zero",0,0, 0.0f, 0.0},
- {"one",10,10, 1.0f, 10.0},
- {"two", 20,20, 2.0f, 20.0},
- {"three",30,30, 3.0f, 30.0},
- {"four", 40,40, 4.0f, 40.0},
- {"five", 50,50, 5.0f, 50.0},
- {"six", 60,60, 6.0f, 60.0},
- {"seven",70,70, 7.0f, 70.0}
- };
-
- /* Define field information */
- const char *field_names[NFIELDS] =
- { "Name","Latitude", "Longitude", "Pressure", "Temperature" };
- hid_t field_type[NFIELDS];
- hid_t string_type;
- hid_t file_id;
- hsize_t chunk_size = 10;
- int compress = 0;
- Particle fill_data[1] =
- { {"no data",-1,-1, -99.0f, -99.0} };
- hsize_t nfields_out;
- hsize_t nrecords_out;
-
- /* Initialize the field type */
- string_type = H5Tcopy( H5T_C_S1 );
- H5Tset_size( string_type, 16 );
- field_type[0] = string_type;
- field_type[1] = H5T_NATIVE_INT;
- field_type[2] = H5T_NATIVE_INT;
- field_type[3] = H5T_NATIVE_FLOAT;
- field_type[4] = H5T_NATIVE_DOUBLE;
-
- /* Create a new file using default properties. */
- file_id = H5Fcreate( "ex_table_12.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
- /* Make a table */
- H5TBmake_table( "Table Title", file_id, TABLE_NAME, NFIELDS, NRECORDS, dst_size,
- field_names, dst_offset, field_type,
- chunk_size, fill_data, compress, p_data );
-
- /* Delete the field */
- H5TBdelete_field( file_id, TABLE_NAME, "Pressure" );
-
- /* Get table info */
- H5TBget_table_info (file_id,TABLE_NAME, &nfields_out, &nrecords_out );
-
- /* print */
- printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out);
-
- /* close type */
- H5Tclose( string_type );
-
- /* close the file */
- H5Fclose( file_id );
-
- return 0;
-
+ typedef struct Particle {
+ char name[16];
+ int lati;
+ int longi;
+ float pressure;
+ double temperature;
+ } Particle;
+
+ /* Calculate the size and the offsets of our struct members in memory */
+ size_t dst_size = sizeof(Particle);
+ size_t dst_offset[NFIELDS] = {HOFFSET(Particle, name), HOFFSET(Particle, lati), HOFFSET(Particle, longi),
+ HOFFSET(Particle, pressure), HOFFSET(Particle, temperature)};
+
+ /* Define an array of Particles */
+ Particle p_data[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0}, {"one", 10, 10, 1.0f, 10.0},
+ {"two", 20, 20, 2.0f, 20.0}, {"three", 30, 30, 3.0f, 30.0},
+ {"four", 40, 40, 4.0f, 40.0}, {"five", 50, 50, 5.0f, 50.0},
+ {"six", 60, 60, 6.0f, 60.0}, {"seven", 70, 70, 7.0f, 70.0}};
+
+ /* Define field information */
+ const char *field_names[NFIELDS] = {"Name", "Latitude", "Longitude", "Pressure", "Temperature"};
+ hid_t field_type[NFIELDS];
+ hid_t string_type;
+ hid_t file_id;
+ hsize_t chunk_size = 10;
+ int compress = 0;
+ Particle fill_data[1] = {{"no data", -1, -1, -99.0f, -99.0}};
+ hsize_t nfields_out;
+ hsize_t nrecords_out;
+
+ /* Initialize the field type */
+ string_type = H5Tcopy(H5T_C_S1);
+ H5Tset_size(string_type, 16);
+ field_type[0] = string_type;
+ field_type[1] = H5T_NATIVE_INT;
+ field_type[2] = H5T_NATIVE_INT;
+ field_type[3] = H5T_NATIVE_FLOAT;
+ field_type[4] = H5T_NATIVE_DOUBLE;
+
+ /* Create a new file using default properties. */
+ file_id = H5Fcreate("ex_table_12.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Make a table */
+ H5TBmake_table("Table Title", file_id, TABLE_NAME, NFIELDS, NRECORDS, dst_size, field_names, dst_offset,
+ field_type, chunk_size, fill_data, compress, p_data);
+
+ /* Delete the field */
+ H5TBdelete_field(file_id, TABLE_NAME, "Pressure");
+
+ /* Get table info */
+ H5TBget_table_info(file_id, TABLE_NAME, &nfields_out, &nrecords_out);
+
+ /* print */
+ printf("Table has %d fields and %d records\n", (int)nfields_out, (int)nrecords_out);
+
+ /* close type */
+ H5Tclose(string_type);
+
+ /* close the file */
+ H5Fclose(file_id);
+
+ return 0;
}
-
diff --git a/hl/examples/pal_rgb.h b/hl/examples/pal_rgb.h
index 488ee42..137d5d9 100644
--- a/hl/examples/pal_rgb.h
+++ b/hl/examples/pal_rgb.h
@@ -271,10 +271,3 @@ const unsigned char pal_rgb[256*3] = {
127,0,0
};
/* clang-format on */
-
-
-
-
-
-
-
diff --git a/hl/examples/ptExampleFL.c b/hl/examples/ptExampleFL.c
index ba7a3a0..66f2040 100644
--- a/hl/examples/ptExampleFL.c
+++ b/hl/examples/ptExampleFL.c
@@ -23,82 +23,80 @@
*-------------------------------------------------------------------------
*/
-int main(void)
+int
+main(void)
{
- hid_t fid; /* File identifier */
- hid_t ptable; /* Packet table identifier */
+ hid_t fid; /* File identifier */
+ hid_t ptable; /* Packet table identifier */
- herr_t err; /* Function return status */
- hsize_t count; /* Number of records in the table */
+ herr_t err; /* Function return status */
+ hsize_t count; /* Number of records in the table */
- int x; /* Loop variable */
+ int x; /* Loop variable */
/* Buffers to hold data */
- int writeBuffer[5];
- int readBuffer[5];
+ int writeBuffer[5];
+ int readBuffer[5];
- /* Initialize buffers */
- for(x=0; x<5; x++)
- {
- writeBuffer[x]=x;
- readBuffer[x] = -1;
- }
+ /* Initialize buffers */
+ for (x = 0; x < 5; x++) {
+ writeBuffer[x] = x;
+ readBuffer[x] = -1;
+ }
/* Create a file using default properties */
- fid=H5Fcreate("packet_table_FLexample.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);
+ fid = H5Fcreate("packet_table_FLexample.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Create a fixed-length packet table within the file */
/* This table's "packets" will be simple integers and it will use compression
* level 5. */
- ptable = H5PTcreate_fl(fid, "Packet Test Dataset", H5T_NATIVE_INT, (hsize_t)100, 5);
- if(ptable == H5I_INVALID_HID)
- goto out;
+ ptable = H5PTcreate_fl(fid, "Packet Test Dataset", H5T_NATIVE_INT, (hsize_t)100, 5);
+ if (ptable == H5I_INVALID_HID)
+ goto out;
/* Write one packet to the packet table */
- err = H5PTappend(ptable, (hsize_t)1, &(writeBuffer[0]) );
- if(err < 0)
- goto out;
+ err = H5PTappend(ptable, (hsize_t)1, &(writeBuffer[0]));
+ if (err < 0)
+ goto out;
/* Write several packets to the packet table */
- err = H5PTappend(ptable, (hsize_t)4, &(writeBuffer[1]) );
- if(err < 0)
- goto out;
+ err = H5PTappend(ptable, (hsize_t)4, &(writeBuffer[1]));
+ if (err < 0)
+ goto out;
/* Get the number of packets in the packet table. This should be five. */
- err = H5PTget_num_packets(ptable, &count);
- if(err < 0)
- goto out;
+ err = H5PTget_num_packets(ptable, &count);
+ if (err < 0)
+ goto out;
- printf("Number of packets in packet table after five appends: %d\n", (int)count);
+ printf("Number of packets in packet table after five appends: %d\n", (int)count);
/* Initialize packet table's "current record" */
- err = H5PTcreate_index(ptable);
- if(err < 0)
- goto out;
+ err = H5PTcreate_index(ptable);
+ if (err < 0)
+ goto out;
/* Iterate through packets, read each one back */
- for(x=0; x<5; x++)
- {
- err = H5PTget_next(ptable, (hsize_t)1, &(readBuffer[x]) );
- if(err < 0)
- goto out;
+ for (x = 0; x < 5; x++) {
+ err = H5PTget_next(ptable, (hsize_t)1, &(readBuffer[x]));
+ if (err < 0)
+ goto out;
- printf("Packet %d's value is %d\n", x, readBuffer[x]);
- }
+ printf("Packet %d's value is %d\n", x, readBuffer[x]);
+ }
/* Close the packet table */
- err = H5PTclose(ptable);
- if(err < 0)
- goto out;
+ err = H5PTclose(ptable);
+ if (err < 0)
+ goto out;
/* Close the file */
- H5Fclose(fid);
+ H5Fclose(fid);
- return 0;
+ return 0;
- out: /* An error has occurred. Clean up and exit. */
+out: /* An error has occurred. Clean up and exit. */
H5PTclose(ptable);
H5Fclose(fid);
return -1;
}
-
diff --git a/hl/fortran/src/H5DSfc.c b/hl/fortran/src/H5DSfc.c
index f99fa4d..398e2b3 100644
--- a/hl/fortran/src/H5DSfc.c
+++ b/hl/fortran/src/H5DSfc.c
@@ -1,15 +1,15 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This files contains C stubs for H5D Fortran APIs */
@@ -18,354 +18,352 @@
#include "H5Eprivate.h"
/*-------------------------------------------------------------------------
-* Function: h5dsset_scale_c
-*
-* Purpose: Calls H5DSset_scale
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: M. Scot Breitenfeld
-*
-* Date: April 17, 2011
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5dsset_scale_c
+ *
+ * Purpose: Calls H5DSset_scale
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: M. Scot Breitenfeld
+ *
+ * Date: April 17, 2011
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
h5dsset_scale_c(hid_t_f *dsid, _fcd dimname, size_t_f *dimnamelen)
{
- char *c_dimname = NULL;
- int_f ret_value = 0;
+ char *c_dimname = NULL;
+ int_f ret_value = 0;
- /*
- * convert FORTRAN name to C name
- */
+ /*
+ * convert FORTRAN name to C name
+ */
- if(*dimnamelen != 0)
- if(NULL == (c_dimname = (char *)HD5f2cstring(dimname, (size_t)*dimnamelen)))
- HGOTO_DONE(FAIL)
+ if (*dimnamelen != 0)
+ if (NULL == (c_dimname = (char *)HD5f2cstring(dimname, (size_t)*dimnamelen)))
+ HGOTO_DONE(FAIL)
- /*
- * call H5DSset_scale function.
- */
+ /*
+ * call H5DSset_scale function.
+ */
- if(H5DSset_scale( (hid_t)*dsid, c_dimname) < 0)
- HGOTO_DONE(FAIL)
+ if (H5DSset_scale((hid_t)*dsid, c_dimname) < 0)
+ HGOTO_DONE(FAIL)
- done:
- if(c_dimname)
- HDfree(c_dimname);
+done:
+ if (c_dimname)
+ HDfree(c_dimname);
- return ret_value;
+ return ret_value;
} /* end h5dsset_scale_c() */
-
/*-------------------------------------------------------------------------
-* Function: H5DSattach_scale_c
-*
-* Purpose: Calls H5DSattach_scale
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: M. Scot Breitenfeld
-*
-* Date: April 17, 2011
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5DSattach_scale_c
+ *
+ * Purpose: Calls H5DSattach_scale
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: M. Scot Breitenfeld
+ *
+ * Date: April 17, 2011
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5dsattach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx)
+h5dsattach_scale_c(hid_t_f *did, hid_t_f *dsid, int_f *idx)
{
- int_f ret_value = 0;
+ int_f ret_value = 0;
- /*
- * call H5DSset_scale function.
- */
+ /*
+ * call H5DSset_scale function.
+ */
- if(H5DSattach_scale( (hid_t)*did, (hid_t)*dsid, (unsigned)*idx ) < 0)
- HGOTO_DONE(FAIL)
+ if (H5DSattach_scale((hid_t)*did, (hid_t)*dsid, (unsigned)*idx) < 0)
+ HGOTO_DONE(FAIL)
- done:
+done:
return ret_value;
} /* end h5dsattach_scale_c() */
-
/*-------------------------------------------------------------------------
-* Function: H5DSdetach_scale_c
-*
-* Purpose: Calls H5DSdetach_scale
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: M. Scot Breitenfeld
-*
-* Date: April 17, 2011
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5DSdetach_scale_c
+ *
+ * Purpose: Calls H5DSdetach_scale
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: M. Scot Breitenfeld
+ *
+ * Date: April 17, 2011
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5dsdetach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx)
+h5dsdetach_scale_c(hid_t_f *did, hid_t_f *dsid, int_f *idx)
{
- int_f ret_value = 0;
+ int_f ret_value = 0;
- /*
- * call H5DSset_scale function.
- */
+ /*
+ * call H5DSset_scale function.
+ */
- if(H5DSdetach_scale( (hid_t)*did, (hid_t)*dsid, (unsigned)*idx ) < 0)
- HGOTO_DONE(FAIL)
+ if (H5DSdetach_scale((hid_t)*did, (hid_t)*dsid, (unsigned)*idx) < 0)
+ HGOTO_DONE(FAIL)
- done:
+done:
return ret_value;
} /* end h5dsdetach_scale_c() */
-
/*-------------------------------------------------------------------------
-* Function: H5DSis_attached_c
-*
-* Purpose: Calls H5DSis_attached
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: M. Scot Breitenfeld
-*
-* Date: April 17, 2011
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5DSis_attached_c
+ *
+ * Purpose: Calls H5DSis_attached
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: M. Scot Breitenfeld
+ *
+ * Date: April 17, 2011
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5dsis_attached_c( hid_t_f *did, hid_t_f *dsid, int_f *idx, int_f *is_attached)
+h5dsis_attached_c(hid_t_f *did, hid_t_f *dsid, int_f *idx, int_f *is_attached)
{
- int_f ret_value = 0;
- htri_t c_is_attached;
+ int_f ret_value = 0;
+ htri_t c_is_attached;
- /*
- * call H5DSis_attached function.
- */
+ /*
+ * call H5DSis_attached function.
+ */
- if((c_is_attached = H5DSis_attached( (hid_t)*did, (hid_t)*dsid, (unsigned)*idx )) < 0)
- HGOTO_DONE(FAIL)
+ if ((c_is_attached = H5DSis_attached((hid_t)*did, (hid_t)*dsid, (unsigned)*idx)) < 0)
+ HGOTO_DONE(FAIL)
- *is_attached = (int_f)c_is_attached;
+ *is_attached = (int_f)c_is_attached;
- done:
- return ret_value;
+done:
+ return ret_value;
} /* end h5dsis_attached_c() */
/*-------------------------------------------------------------------------
-* Function: H5DSis_scale_c
-*
-* Purpose: Calls H5DSis_scale
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: M. Scot Breitenfeld
-*
-* Date: April 18, 2011
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5DSis_scale_c
+ *
+ * Purpose: Calls H5DSis_scale
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: M. Scot Breitenfeld
+ *
+ * Date: April 18, 2011
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5dsis_scale_c( hid_t_f *did, int_f *is_scale)
+h5dsis_scale_c(hid_t_f *did, int_f *is_scale)
{
- int_f ret_value = 0;
- htri_t c_is_scale;
+ int_f ret_value = 0;
+ htri_t c_is_scale;
- /*
- * call H5DSis_scale function.
- */
+ /*
+ * call H5DSis_scale function.
+ */
- if((c_is_scale=H5DSis_scale( (hid_t)*did )) < 0)
- HGOTO_DONE(FAIL)
+ if ((c_is_scale = H5DSis_scale((hid_t)*did)) < 0)
+ HGOTO_DONE(FAIL)
- *is_scale = (int_f)c_is_scale;
+ *is_scale = (int_f)c_is_scale;
- done:
+done:
return ret_value;
} /* end h5dsis_scale_c() */
-
/*-------------------------------------------------------------------------
-* Function: h5dsset_label_c
-*
-* Purpose: Calls H5DSset_label
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: M. Scot Breitenfeld
-*
-* Date: April 18, 2011
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5dsset_label_c
+ *
+ * Purpose: Calls H5DSset_label
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: M. Scot Breitenfeld
+ *
+ * Date: April 18, 2011
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
h5dsset_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *labellen)
{
- char *c_label = NULL;
- int_f ret_value = 0;
+ char *c_label = NULL;
+ int_f ret_value = 0;
- /*
- * convert FORTRAN name to C name
- */
+ /*
+ * convert FORTRAN name to C name
+ */
- if(NULL == (c_label = (char *)HD5f2cstring(label, (size_t)*labellen)))
- HGOTO_DONE(FAIL)
+ if (NULL == (c_label = (char *)HD5f2cstring(label, (size_t)*labellen)))
+ HGOTO_DONE(FAIL)
- /*
- * call H5DSset_label function.
- */
+ /*
+ * call H5DSset_label function.
+ */
- if(H5DSset_label( (hid_t)*did, (unsigned)*idx, c_label) < 0)
- HGOTO_DONE(FAIL)
+ if (H5DSset_label((hid_t)*did, (unsigned)*idx, c_label) < 0)
+ HGOTO_DONE(FAIL)
- done:
- if(c_label)
- HDfree(c_label);
+done:
+ if (c_label)
+ HDfree(c_label);
- return ret_value;
+ return ret_value;
} /* end h5dsset_label_c() */
/*-------------------------------------------------------------------------
-* Function: h5dsget_label_c
-*
-* Purpose: Calls H5DSget_label
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: M. Scot Breitenfeld
-*
-* Date: April 18, 2011
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5dsget_label_c
+ *
+ * Purpose: Calls H5DSget_label
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: M. Scot Breitenfeld
+ *
+ * Date: April 18, 2011
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
h5dsget_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *size)
{
- char *c_label = NULL;
- ssize_t size_c = -1;
- int_f ret_value = 0;
+ char * c_label = NULL;
+ ssize_t size_c = -1;
+ int_f ret_value = 0;
- /*
- * Allocate buffer to hold label
- */
- if ((c_label = (char *)HDmalloc((size_t)*size + 1)) == NULL)
- HGOTO_DONE(FAIL);
+ /*
+ * Allocate buffer to hold label
+ */
+ if ((c_label = (char *)HDmalloc((size_t)*size + 1)) == NULL)
+ HGOTO_DONE(FAIL);
- /*
- * call H5DSget_label function.
- */
+ /*
+ * call H5DSget_label function.
+ */
- if( (size_c = H5DSget_label( (hid_t)*did, (unsigned)*idx, c_label, (size_t)*size+1)) < 0)
- HGOTO_DONE(FAIL)
+ if ((size_c = H5DSget_label((hid_t)*did, (unsigned)*idx, c_label, (size_t)*size + 1)) < 0)
+ HGOTO_DONE(FAIL)
- /*
- * Convert C name to FORTRAN and place it in the given buffer
- */
+ /*
+ * Convert C name to FORTRAN and place it in the given buffer
+ */
- HD5packFstring(c_label, _fcdtocp(label), (size_t)*size);
+ HD5packFstring(c_label, _fcdtocp(label), (size_t)*size);
done:
- *size = (size_t_f)size_c; /* Don't subtract '1' because H5DSget_label doesn't include the
- * trailing NULL in the length calculation, Ref. HDFFV-7596 */
- if(c_label) HDfree(c_label);
- return ret_value;
+ *size = (size_t_f)size_c; /* Don't subtract '1' because H5DSget_label doesn't include the
+ * trailing NULL in the length calculation, Ref. HDFFV-7596 */
+ if (c_label)
+ HDfree(c_label);
+ return ret_value;
} /* end h5dsget_label_c() */
/*-------------------------------------------------------------------------
-* Function: h5dsget_scale_name_c
-*
-* Purpose: Calls H5DSget_scale_name
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: M. Scot Breitenfeld
-*
-* Date: April 18, 2011
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5dsget_scale_name_c
+ *
+ * Purpose: Calls H5DSget_scale_name
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: M. Scot Breitenfeld
+ *
+ * Date: April 18, 2011
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
h5dsget_scale_name_c(hid_t_f *did, _fcd name, size_t_f *size)
{
- char *c_scale_name = NULL;
- ssize_t size_c = -1;
- int_f ret_value = 0;
+ char * c_scale_name = NULL;
+ ssize_t size_c = -1;
+ int_f ret_value = 0;
- /*
- * Allocate buffer to hold name
- */
- if ((c_scale_name = (char *)HDmalloc((size_t)*size + 1)) == NULL)
- HGOTO_DONE(FAIL);
+ /*
+ * Allocate buffer to hold name
+ */
+ if ((c_scale_name = (char *)HDmalloc((size_t)*size + 1)) == NULL)
+ HGOTO_DONE(FAIL);
- /*
- * call H5DSget_scale_name function.
- */
+ /*
+ * call H5DSget_scale_name function.
+ */
- if( (size_c = H5DSget_scale_name( (hid_t)*did, c_scale_name, (size_t)*size+1)) < 0)
- HGOTO_DONE(FAIL)
+ if ((size_c = H5DSget_scale_name((hid_t)*did, c_scale_name, (size_t)*size + 1)) < 0)
+ HGOTO_DONE(FAIL)
- /*
- * Convert C name to FORTRAN and place it in the given buffer
- */
- HD5packFstring(c_scale_name, _fcdtocp(name), (size_t)*size);
- *size = (size_t_f)size_c;
+ /*
+ * Convert C name to FORTRAN and place it in the given buffer
+ */
+ HD5packFstring(c_scale_name, _fcdtocp(name), (size_t)*size);
+ *size = (size_t_f)size_c;
done:
- if(c_scale_name) HDfree(c_scale_name);
- return ret_value;
+ if (c_scale_name)
+ HDfree(c_scale_name);
+ return ret_value;
} /* end h5dsget_scale_name_c() */
/*-------------------------------------------------------------------------
-* Function: H5DSget_num_scales_c
-*
-* Purpose: Calls H5DSget_num_scales
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: M. Scot Breitenfeld
-*
-* Date: April 18, 2011
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5DSget_num_scales_c
+ *
+ * Purpose: Calls H5DSget_num_scales
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: M. Scot Breitenfeld
+ *
+ * Date: April 18, 2011
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5dsget_num_scales_c( hid_t_f *did, int_f *idx, int_f *num_scales)
+h5dsget_num_scales_c(hid_t_f *did, int_f *idx, int_f *num_scales)
{
- int_f ret_value = 0;
+ int_f ret_value = 0;
- /*
- * call H5DSset_scale function.
- */
+ /*
+ * call H5DSset_scale function.
+ */
- if( (*num_scales = (int_f)H5DSget_num_scales( (hid_t)*did, (unsigned)*idx)) < 0)
- HGOTO_DONE(FAIL)
+ if ((*num_scales = (int_f)H5DSget_num_scales((hid_t)*did, (unsigned)*idx)) < 0)
+ HGOTO_DONE(FAIL)
- done:
+done:
return ret_value;
} /* end h5dsget_num_scales_c() */
diff --git a/hl/fortran/src/H5IMcc.c b/hl/fortran/src/H5IMcc.c
index 1d12f56..fc29302 100644
--- a/hl/fortran/src/H5IMcc.c
+++ b/hl/fortran/src/H5IMcc.c
@@ -16,16 +16,11 @@
#include <string.h>
#include <stdlib.h>
-
/*-------------------------------------------------------------------------
* private functions
*-------------------------------------------------------------------------
*/
-herr_t H5IM_get_palette(hid_t loc_id,
- const char *image_name,
- int pal_number,
- hid_t tid,
- void *pal_data);
+herr_t H5IM_get_palette(hid_t loc_id, const char *image_name, int pal_number, hid_t tid, void *pal_data);
/*-------------------------------------------------------------------------
* Function: H5IMmake_image_8bitf
@@ -48,77 +43,76 @@ herr_t H5IM_get_palette(hid_t loc_id,
*-------------------------------------------------------------------------
*/
-herr_t H5IMmake_image_8bitf(hid_t loc_id,
- const char *dset_name,
- hsize_t width,
- hsize_t height,
- int_f *buf)
+herr_t
+H5IMmake_image_8bitf(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height, int_f *buf)
{
- hid_t did; /* dataset ID */
- hid_t sid; /* space ID */
- hsize_t dims[IMAGE8_RANK]; /* dimensions */
+ hid_t did; /* dataset ID */
+ hid_t sid; /* space ID */
+ hsize_t dims[IMAGE8_RANK]; /* dimensions */
- /* initialize the image dimensions */
- dims[0] = height;
- dims[1] = width;
+ /* initialize the image dimensions */
+ dims[0] = height;
+ dims[1] = width;
-/*-------------------------------------------------------------------------
- * create and write the dataset
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * create and write the dataset
+ *-------------------------------------------------------------------------
+ */
- /* create the data space for the dataset. */
- if((sid = H5Screate_simple(IMAGE8_RANK, dims, NULL)) < 0)
- return -1;
-
- /* create the dataset as H5T_NATIVE_UCHAR */
- if((did = H5Dcreate2(loc_id, dset_name, H5T_NATIVE_UINT8, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- return -1;
-
- /* write with memory type H5T_NATIVE_INT */
- /* Use long type if Fortran integer is 8 bytes and C long long is also 8 bytes*/
- /* Fail if otherwise */
- if(buf) {
- if(sizeof(int_f) == sizeof(int)) {
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- return -1;
- } else if(sizeof(int_f) == sizeof(long)) {
- if(H5Dwrite(did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- return -1;
- } else if(sizeof(int_f) == sizeof(long long)) {
- if(H5Dwrite(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- return -1;
- } else
- return -1;
- }
-
- /* close */
- if(H5Dclose(did) < 0)
- return -1;
- if(H5Sclose(sid) < 0)
- return -1;
+ /* create the data space for the dataset. */
+ if ((sid = H5Screate_simple(IMAGE8_RANK, dims, NULL)) < 0)
+ return -1;
-/*-------------------------------------------------------------------------
- * attach the specification attributes
- *-------------------------------------------------------------------------
- */
+ /* create the dataset as H5T_NATIVE_UCHAR */
+ if ((did = H5Dcreate2(loc_id, dset_name, H5T_NATIVE_UINT8, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ return -1;
- /* attach the CLASS attribute */
- if(H5LTset_attribute_string(loc_id, dset_name, "CLASS", IMAGE_CLASS) < 0)
- return -1;
+ /* write with memory type H5T_NATIVE_INT */
+ /* Use long type if Fortran integer is 8 bytes and C long long is also 8 bytes*/
+ /* Fail if otherwise */
+ if (buf) {
+ if (sizeof(int_f) == sizeof(int)) {
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ return -1;
+ }
+ else if (sizeof(int_f) == sizeof(long)) {
+ if (H5Dwrite(did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ return -1;
+ }
+ else if (sizeof(int_f) == sizeof(long long)) {
+ if (H5Dwrite(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ return -1;
+ }
+ else
+ return -1;
+ }
- /* attach the VERSION attribute */
- if(H5LTset_attribute_string(loc_id, dset_name, "IMAGE_VERSION", IMAGE_VERSION) < 0)
- return -1;
+ /* close */
+ if (H5Dclose(did) < 0)
+ return -1;
+ if (H5Sclose(sid) < 0)
+ return -1;
- /* attach the IMAGE_SUBCLASS attribute */
- if(H5LTset_attribute_string(loc_id, dset_name, "IMAGE_SUBCLASS", "IMAGE_INDEXED") < 0)
- return -1;
+ /*-------------------------------------------------------------------------
+ * attach the specification attributes
+ *-------------------------------------------------------------------------
+ */
- return 0;
-}
+ /* attach the CLASS attribute */
+ if (H5LTset_attribute_string(loc_id, dset_name, "CLASS", IMAGE_CLASS) < 0)
+ return -1;
+ /* attach the VERSION attribute */
+ if (H5LTset_attribute_string(loc_id, dset_name, "IMAGE_VERSION", IMAGE_VERSION) < 0)
+ return -1;
+
+ /* attach the IMAGE_SUBCLASS attribute */
+ if (H5LTset_attribute_string(loc_id, dset_name, "IMAGE_SUBCLASS", "IMAGE_INDEXED") < 0)
+ return -1;
+ return 0;
+}
/*-------------------------------------------------------------------------
* Function: H5IMmake_image_24bitf
@@ -146,96 +140,94 @@ herr_t H5IMmake_image_8bitf(hid_t loc_id,
*-------------------------------------------------------------------------
*/
-herr_t H5IMmake_image_24bitf(hid_t loc_id,
- const char *dset_name,
- hsize_t width,
- hsize_t height,
- const char *interlace,
- int_f *buf)
+herr_t
+H5IMmake_image_24bitf(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height,
+ const char *interlace, int_f *buf)
{
- hid_t did; /* dataset ID */
- hid_t sid; /* space ID */
- hsize_t dims[IMAGE24_RANK]; /* dimensions */
+ hid_t did; /* dataset ID */
+ hid_t sid; /* space ID */
+ hsize_t dims[IMAGE24_RANK]; /* dimensions */
+
+ /*-------------------------------------------------------------------------
+ * attach the image dimensions according to the interlace mode
+ *-------------------------------------------------------------------------
+ */
+ if (strcmp(interlace, "INTERLACE_PIXEL") == 0) {
+ /* Number of color planes is defined as the third dimension */
+ dims[0] = height;
+ dims[1] = width;
+ dims[2] = IMAGE24_RANK;
+ }
+ else if (strcmp(interlace, "INTERLACE_PLANE") == 0) {
+ /* Number of color planes is defined as the first dimension */
+ dims[0] = IMAGE24_RANK;
+ dims[1] = height;
+ dims[2] = width;
+ }
+ else
+ return -1;
-/*-------------------------------------------------------------------------
- * attach the image dimensions according to the interlace mode
- *-------------------------------------------------------------------------
- */
- if(strcmp(interlace, "INTERLACE_PIXEL") == 0) {
- /* Number of color planes is defined as the third dimension */
- dims[0] = height;
- dims[1] = width;
- dims[2] = IMAGE24_RANK;
- }
- else
- if(strcmp(interlace, "INTERLACE_PLANE") == 0) {
- /* Number of color planes is defined as the first dimension */
- dims[0] = IMAGE24_RANK;
- dims[1] = height;
- dims[2] = width;
- }
- else
- return -1;
+ /*-------------------------------------------------------------------------
+ * create and write the dataset
+ *-------------------------------------------------------------------------
+ */
-/*-------------------------------------------------------------------------
- * create and write the dataset
- *-------------------------------------------------------------------------
- */
+ /* create the data space for the dataset. */
+ if ((sid = H5Screate_simple(IMAGE24_RANK, dims, NULL)) < 0)
+ return -1;
- /* create the data space for the dataset. */
- if((sid = H5Screate_simple(IMAGE24_RANK, dims, NULL)) < 0)
- return -1;
-
- /* create the dataset as H5T_NATIVE_UCHAR */
- if((did = H5Dcreate2(loc_id, dset_name, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- return -1;
-
- /* write with memory type H5T_NATIVE_INT */
- if(buf) {
- if(sizeof(int_f) == sizeof(int)) {
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- return -1;
- } else if(sizeof(int_f) == sizeof(long)) {
- if(H5Dwrite(did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- return -1;
- } else if(sizeof(int_f) == sizeof(long long)) {
- if(H5Dwrite(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- return -1;
- } else
- return -1;
- }
-
- /* close */
- if(H5Dclose(did) < 0)
- return -1;
- if(H5Sclose(sid) < 0)
- return -1;
+ /* create the dataset as H5T_NATIVE_UCHAR */
+ if ((did = H5Dcreate2(loc_id, dset_name, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ return -1;
-/*-------------------------------------------------------------------------
- * attach the specification attributes
- *-------------------------------------------------------------------------
- */
+ /* write with memory type H5T_NATIVE_INT */
+ if (buf) {
+ if (sizeof(int_f) == sizeof(int)) {
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ return -1;
+ }
+ else if (sizeof(int_f) == sizeof(long)) {
+ if (H5Dwrite(did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ return -1;
+ }
+ else if (sizeof(int_f) == sizeof(long long)) {
+ if (H5Dwrite(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ return -1;
+ }
+ else
+ return -1;
+ }
- /* Attach the CLASS attribute */
- if(H5LTset_attribute_string(loc_id, dset_name, "CLASS", IMAGE_CLASS) < 0)
- return -1;
+ /* close */
+ if (H5Dclose(did) < 0)
+ return -1;
+ if (H5Sclose(sid) < 0)
+ return -1;
- /* Attach the VERSION attribute */
- if(H5LTset_attribute_string(loc_id, dset_name, "IMAGE_VERSION", IMAGE_VERSION) < 0)
- return -1;
+ /*-------------------------------------------------------------------------
+ * attach the specification attributes
+ *-------------------------------------------------------------------------
+ */
- /* Attach the IMAGE_SUBCLASS attribute */
- if(H5LTset_attribute_string(loc_id, dset_name, "IMAGE_SUBCLASS", "IMAGE_TRUECOLOR") < 0)
- return -1;
+ /* Attach the CLASS attribute */
+ if (H5LTset_attribute_string(loc_id, dset_name, "CLASS", IMAGE_CLASS) < 0)
+ return -1;
- /* Attach the INTERLACE_MODE attribute. This attributes is only for true color images */
- if(H5LTset_attribute_string(loc_id, dset_name, "INTERLACE_MODE", interlace) < 0)
- return -1;
+ /* Attach the VERSION attribute */
+ if (H5LTset_attribute_string(loc_id, dset_name, "IMAGE_VERSION", IMAGE_VERSION) < 0)
+ return -1;
- return 0;
+ /* Attach the IMAGE_SUBCLASS attribute */
+ if (H5LTset_attribute_string(loc_id, dset_name, "IMAGE_SUBCLASS", "IMAGE_TRUECOLOR") < 0)
+ return -1;
-}
+ /* Attach the INTERLACE_MODE attribute. This attributes is only for true color images */
+ if (H5LTset_attribute_string(loc_id, dset_name, "INTERLACE_MODE", interlace) < 0)
+ return -1;
+ return 0;
+}
/*-------------------------------------------------------------------------
* Function: H5IMread_imagef
@@ -258,33 +250,32 @@ herr_t H5IMmake_image_24bitf(hid_t loc_id,
*-------------------------------------------------------------------------
*/
-herr_t H5IMread_imagef(hid_t loc_id,
- const char *dset_name,
- int_f *buf)
+herr_t
+H5IMread_imagef(hid_t loc_id, const char *dset_name, int_f *buf)
{
- hid_t did;
- hid_t tid;
+ hid_t did;
+ hid_t tid;
/* open the dataset */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
return -1;
/* determine appropriate datatype to use */
- if(sizeof(int_f) == sizeof(int))
+ if (sizeof(int_f) == sizeof(int))
tid = H5T_NATIVE_INT;
- else if(sizeof(int_f) == sizeof(long))
+ else if (sizeof(int_f) == sizeof(long))
tid = H5T_NATIVE_LONG;
- else if(sizeof(int_f) == sizeof(long long))
+ else if (sizeof(int_f) == sizeof(long long))
tid = H5T_NATIVE_LLONG;
else
goto out;
/* read to memory */
- if(H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
/* close */
- if(H5Dclose(did))
+ if (H5Dclose(did))
return -1;
return 0;
@@ -294,7 +285,6 @@ out:
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: H5IMmake_palettef
*
@@ -318,75 +308,75 @@ out:
*-------------------------------------------------------------------------
*/
-herr_t H5IMmake_palettef(hid_t loc_id,
- const char *pal_name,
- const hsize_t *pal_dims,
- int_f *pal_data)
+herr_t
+H5IMmake_palettef(hid_t loc_id, const char *pal_name, const hsize_t *pal_dims, int_f *pal_data)
{
- hid_t did; /* dataset ID */
- hid_t sid; /* space ID */
- int has_pal;
+ hid_t did; /* dataset ID */
+ hid_t sid; /* space ID */
+ int has_pal;
- /* Check if the dataset already exists */
- has_pal = H5LTfind_dataset(loc_id, pal_name);
+ /* Check if the dataset already exists */
+ has_pal = H5LTfind_dataset(loc_id, pal_name);
- /* It exists. Return */
- if(has_pal == 1)
- return 0;
+ /* It exists. Return */
+ if (has_pal == 1)
+ return 0;
-/*-------------------------------------------------------------------------
- * create and write the dataset
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * create and write the dataset
+ *-------------------------------------------------------------------------
+ */
- /* create the data space for the dataset. */
- if((sid = H5Screate_simple(2, pal_dims, NULL)) < 0)
- return -1;
-
- /* create the dataset as H5T_NATIVE_UCHAR */
- if((did = H5Dcreate2(loc_id, pal_name, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- return -1;
-
- /* write with memory type H5T_NATIVE_INT */
- if(pal_data) {
- if(sizeof(int_f) == sizeof(int)) {
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0)
- return -1;
- } else if(sizeof(int_f) == sizeof(long)) {
- if(H5Dwrite(did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0)
- return -1;
- } else if(sizeof(int_f) == sizeof(long long)) {
- if(H5Dwrite(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0)
- return -1;
- } else
- return -1;
- }
-
- /* close */
- if(H5Dclose(did) < 0)
- return -1;
- if(H5Sclose(sid) < 0)
- return -1;
+ /* create the data space for the dataset. */
+ if ((sid = H5Screate_simple(2, pal_dims, NULL)) < 0)
+ return -1;
-/*-------------------------------------------------------------------------
- * attach the specification attributes
- *-------------------------------------------------------------------------
- */
+ /* create the dataset as H5T_NATIVE_UCHAR */
+ if ((did = H5Dcreate2(loc_id, pal_name, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
+ return -1;
- /* Attach the attribute "CLASS" to the >>palette<< dataset*/
- if(H5LTset_attribute_string(loc_id, pal_name, "CLASS", PALETTE_CLASS) < 0)
- return -1;
+ /* write with memory type H5T_NATIVE_INT */
+ if (pal_data) {
+ if (sizeof(int_f) == sizeof(int)) {
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0)
+ return -1;
+ }
+ else if (sizeof(int_f) == sizeof(long)) {
+ if (H5Dwrite(did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0)
+ return -1;
+ }
+ else if (sizeof(int_f) == sizeof(long long)) {
+ if (H5Dwrite(did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0)
+ return -1;
+ }
+ else
+ return -1;
+ }
- /* Attach the attribute "PAL_VERSION" to the >>palette<< dataset*/
- if(H5LTset_attribute_string(loc_id, pal_name, "PAL_VERSION", "1.2") < 0)
- return -1;
+ /* close */
+ if (H5Dclose(did) < 0)
+ return -1;
+ if (H5Sclose(sid) < 0)
+ return -1;
- return 0;
+ /*-------------------------------------------------------------------------
+ * attach the specification attributes
+ *-------------------------------------------------------------------------
+ */
-}
+ /* Attach the attribute "CLASS" to the >>palette<< dataset*/
+ if (H5LTset_attribute_string(loc_id, pal_name, "CLASS", PALETTE_CLASS) < 0)
+ return -1;
+ /* Attach the attribute "PAL_VERSION" to the >>palette<< dataset*/
+ if (H5LTset_attribute_string(loc_id, pal_name, "PAL_VERSION", "1.2") < 0)
+ return -1;
+
+ return 0;
+}
/*-------------------------------------------------------------------------
* Function: H5IMget_palettef
@@ -411,20 +401,17 @@ herr_t H5IMmake_palettef(hid_t loc_id,
*-------------------------------------------------------------------------
*/
-herr_t H5IMget_palettef(hid_t loc_id,
- const char *image_name,
- int pal_number,
- int_f *pal_data)
+herr_t
+H5IMget_palettef(hid_t loc_id, const char *image_name, int pal_number, int_f *pal_data)
{
- if(sizeof(int_f) == sizeof(int))
- return H5IM_get_palette(loc_id,image_name,pal_number,H5T_NATIVE_INT,pal_data);
- else if(sizeof(int_f) == sizeof(long))
- return H5IM_get_palette(loc_id,image_name,pal_number,H5T_NATIVE_LONG,pal_data);
- else if(sizeof(int_f) == sizeof(long long))
- return H5IM_get_palette(loc_id,image_name,pal_number,H5T_NATIVE_LLONG,pal_data);
- else
- return -1;
-
+ if (sizeof(int_f) == sizeof(int))
+ return H5IM_get_palette(loc_id, image_name, pal_number, H5T_NATIVE_INT, pal_data);
+ else if (sizeof(int_f) == sizeof(long))
+ return H5IM_get_palette(loc_id, image_name, pal_number, H5T_NATIVE_LONG, pal_data);
+ else if (sizeof(int_f) == sizeof(long long))
+ return H5IM_get_palette(loc_id, image_name, pal_number, H5T_NATIVE_LLONG, pal_data);
+ else
+ return -1;
}
/*-------------------------------------------------------------------------
@@ -452,96 +439,88 @@ herr_t H5IMget_palettef(hid_t loc_id,
*
*-------------------------------------------------------------------------
*/
-herr_t H5IM_get_palette(hid_t loc_id,
- const char *image_name,
- int pal_number,
- hid_t tid,
- void *pal_data)
+herr_t
+H5IM_get_palette(hid_t loc_id, const char *image_name, int pal_number, hid_t tid, void *pal_data)
{
- hid_t image_id;
- int has_pal;
- hid_t attr_type;
- hid_t attr_id;
- hid_t attr_space_id;
- hid_t attr_class;
- hssize_t n_refs;
- size_t dim_ref;
- hobj_ref_t *refbuf; /* buffer to read references */
- hid_t pal_id;
-
- /* Open the dataset. */
- if((image_id = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0)
- return -1;
-
- /* Try to find the attribute "PALETTE" on the >>image<< dataset */
- has_pal = H5IM_find_palette(image_id);
+ hid_t image_id;
+ int has_pal;
+ hid_t attr_type;
+ hid_t attr_id;
+ hid_t attr_space_id;
+ hid_t attr_class;
+ hssize_t n_refs;
+ size_t dim_ref;
+ hobj_ref_t *refbuf; /* buffer to read references */
+ hid_t pal_id;
+
+ /* Open the dataset. */
+ if ((image_id = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0)
+ return -1;
- if(has_pal == 1)
- {
+ /* Try to find the attribute "PALETTE" on the >>image<< dataset */
+ has_pal = H5IM_find_palette(image_id);
- if((attr_id = H5Aopen(image_id, "PALETTE", H5P_DEFAULT)) < 0)
- goto out;
+ if (has_pal == 1) {
- if((attr_type = H5Aget_type(attr_id)) < 0)
- goto out;
+ if ((attr_id = H5Aopen(image_id, "PALETTE", H5P_DEFAULT)) < 0)
+ goto out;
- if((attr_class = H5Tget_class(attr_type)) < 0)
- goto out;
+ if ((attr_type = H5Aget_type(attr_id)) < 0)
+ goto out;
- /* Check if it is really a reference */
- if(attr_class == H5T_REFERENCE)
- {
+ if ((attr_class = H5Tget_class(attr_type)) < 0)
+ goto out;
- /* Get the reference(s) */
- if((attr_space_id = H5Aget_space(attr_id)) < 0)
- goto out;
+ /* Check if it is really a reference */
+ if (attr_class == H5T_REFERENCE) {
- n_refs = H5Sget_simple_extent_npoints(attr_space_id);
+ /* Get the reference(s) */
+ if ((attr_space_id = H5Aget_space(attr_id)) < 0)
+ goto out;
- dim_ref = (size_t)n_refs;
+ n_refs = H5Sget_simple_extent_npoints(attr_space_id);
- refbuf = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * dim_ref);
+ dim_ref = (size_t)n_refs;
- if(H5Aread(attr_id, attr_type, refbuf) < 0)
- goto out;
+ refbuf = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * dim_ref);
- /* Get the palette id */
- if((pal_id = H5Rdereference2(image_id, H5P_DEFAULT, H5R_OBJECT, &refbuf[pal_number])) < 0)
- goto out;
+ if (H5Aread(attr_id, attr_type, refbuf) < 0)
+ goto out;
- /* Read the palette dataset using the memory type TID */
- if(H5Dread(pal_id, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0)
- goto out;
+ /* Get the palette id */
+ if ((pal_id = H5Rdereference2(image_id, H5P_DEFAULT, H5R_OBJECT, &refbuf[pal_number])) < 0)
+ goto out;
- if(H5Sclose(attr_space_id) < 0)
- goto out;
+ /* Read the palette dataset using the memory type TID */
+ if (H5Dread(pal_id, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0)
+ goto out;
- /* close the dereferenced dataset */
- if(H5Dclose(pal_id) < 0)
- goto out;
+ if (H5Sclose(attr_space_id) < 0)
+ goto out;
- HDfree(refbuf);
+ /* close the dereferenced dataset */
+ if (H5Dclose(pal_id) < 0)
+ goto out;
- } /* H5T_REFERENCE */
+ HDfree(refbuf);
- if(H5Tclose(attr_type) < 0)
- goto out;
+ } /* H5T_REFERENCE */
- /* Close the attribute. */
- if(H5Aclose(attr_id) < 0)
- goto out;
+ if (H5Tclose(attr_type) < 0)
+ goto out;
- }
+ /* Close the attribute. */
+ if (H5Aclose(attr_id) < 0)
+ goto out;
+ }
- /* Close the image dataset. */
- if(H5Dclose(image_id) < 0)
- return -1;
+ /* Close the image dataset. */
+ if (H5Dclose(image_id) < 0)
+ return -1;
- return 0;
+ return 0;
out:
- H5Dclose(image_id);
- return -1;
-
-
+ H5Dclose(image_id);
+ return -1;
}
diff --git a/hl/fortran/src/H5IMcc.h b/hl/fortran/src/H5IMcc.h
index a65669d..34d3a4e 100644
--- a/hl/fortran/src/H5IMcc.h
+++ b/hl/fortran/src/H5IMcc.h
@@ -22,34 +22,16 @@
extern "C" {
#endif
+herr_t H5IMmake_image_8bitf(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height, int_f *buf);
-herr_t H5IMmake_image_8bitf( hid_t loc_id,
- const char *dset_name,
- hsize_t width,
- hsize_t height,
- int_f *buf );
-
-herr_t H5IMmake_image_24bitf( hid_t loc_id,
- const char *dset_name,
- hsize_t width,
- hsize_t height,
- const char *interlace,
- int_f *buf);
-
-herr_t H5IMread_imagef( hid_t loc_id,
- const char *dset_name,
- int_f *buf );
-
-herr_t H5IMmake_palettef( hid_t loc_id,
- const char *pal_name,
- const hsize_t *pal_dims,
- int_f *pal_data );
-
-herr_t H5IMget_palettef( hid_t loc_id,
- const char *image_name,
- int pal_number,
- int_f *pal_data );
+herr_t H5IMmake_image_24bitf(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height,
+ const char *interlace, int_f *buf);
+herr_t H5IMread_imagef(hid_t loc_id, const char *dset_name, int_f *buf);
+
+herr_t H5IMmake_palettef(hid_t loc_id, const char *pal_name, const hsize_t *pal_dims, int_f *pal_data);
+
+herr_t H5IMget_palettef(hid_t loc_id, const char *image_name, int pal_number, int_f *pal_data);
#ifdef __cplusplus
}
diff --git a/hl/fortran/src/H5IMfc.c b/hl/fortran/src/H5IMfc.c
index 638cea4..b01ed30 100644
--- a/hl/fortran/src/H5IMfc.c
+++ b/hl/fortran/src/H5IMfc.c
@@ -1,15 +1,15 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This files contains C stubs for H5D Fortran APIs */
@@ -18,51 +18,47 @@
#include "H5Eprivate.h"
/*-------------------------------------------------------------------------
-* Function: h5immake_image_8bit_c
-*
-* Purpose: Call H5IMmake_image_8bit
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 05, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5immake_image_8bit_c
+ *
+ * Purpose: Call H5IMmake_image_8bit
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 05, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5immake_image_8bit_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- hsize_t_f *width,
- hsize_t_f *height,
- int_f *buf)
+h5immake_image_8bit_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *width, hsize_t_f *height,
+ int_f *buf)
{
int ret_value = -1;
herr_t ret;
hid_t c_loc_id;
- char *c_name = NULL;
- hsize_t w = (hsize_t)*width;
- hsize_t h = (hsize_t)*height;
+ char * c_name = NULL;
+ hsize_t w = (hsize_t)*width;
+ hsize_t h = (hsize_t)*height;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
if (c_name == NULL)
goto done;
/*
- * call H5IMmake_image_8bitf function.
- */
+ * call H5IMmake_image_8bitf function.
+ */
c_loc_id = (hid_t)*loc_id;
- ret = H5IMmake_image_8bitf(c_loc_id,c_name,w,h,buf);
+ ret = H5IMmake_image_8bitf(c_loc_id, c_name, w, h, buf);
if (ret < 0)
goto done;
@@ -70,54 +66,49 @@ h5immake_image_8bit_c (hid_t_f *loc_id,
ret_value = 0;
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
return ret_value;
-
-
}
/*-------------------------------------------------------------------------
-* Function: h5imread_image_c
-*
-* Purpose: Call H5IMread_image
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 05, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5imread_image_c
+ *
+ * Purpose: Call H5IMread_image
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 05, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5imread_image_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- int_f *buf)
+h5imread_image_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *buf)
{
- int ret_value = -1;
- herr_t ret;
- char *c_name = NULL;
+ int ret_value = -1;
+ herr_t ret;
+ char * c_name = NULL;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
if (c_name == NULL)
goto done;
/*
- * call H5IMread_image function.
- */
- ret = H5IMread_imagef((hid_t)*loc_id,c_name,buf);
+ * call H5IMread_image function.
+ */
+ ret = H5IMread_imagef((hid_t)*loc_id, c_name, buf);
if (ret < 0)
goto done;
@@ -125,52 +116,46 @@ h5imread_image_c (hid_t_f *loc_id,
ret_value = 0;
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: h5immake_image_24bit_c
-*
-* Purpose: Call H5IMmake_image_24bit
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 05, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5immake_image_24bit_c
+ *
+ * Purpose: Call H5IMmake_image_24bit
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 05, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5immake_image_24bit_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- size_t_f *ilen,
- _fcd il,
- hsize_t_f *width,
- hsize_t_f *height,
- void *buf)
+h5immake_image_24bit_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *ilen, _fcd il,
+ hsize_t_f *width, hsize_t_f *height, void *buf)
{
int ret_value = -1;
herr_t ret;
hid_t c_loc_id;
- char *c_name = NULL;
- char *c_il = NULL;
- hsize_t w = (hsize_t)*width;
- hsize_t h = (hsize_t)*height;
+ char * c_name = NULL;
+ char * c_il = NULL;
+ hsize_t w = (hsize_t)*width;
+ hsize_t h = (hsize_t)*height;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
if (c_name == NULL)
goto done;
@@ -180,11 +165,11 @@ h5immake_image_24bit_c (hid_t_f *loc_id,
goto done;
/*
- * call H5IMmake_image_24bitf function.
- */
+ * call H5IMmake_image_24bitf function.
+ */
c_loc_id = (hid_t)*loc_id;
- ret = H5IMmake_image_24bitf(c_loc_id,c_name,w,h,c_il,(int_f *)buf);
+ ret = H5IMmake_image_24bitf(c_loc_id, c_name, w, h, c_il, (int_f *)buf);
if (ret < 0)
goto done;
@@ -192,238 +177,218 @@ h5immake_image_24bit_c (hid_t_f *loc_id,
ret_value = 0;
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
- if(c_il!=NULL)
+ if (c_il != NULL)
HDfree(c_il);
return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: h5imget_image_info_c
-*
-* Purpose: Call H5IMget_image_info
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 05, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5imget_image_info_c
+ *
+ * Purpose: Call H5IMget_image_info
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 05, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5imget_image_info_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- hsize_t_f *width,
- hsize_t_f *height,
- hsize_t_f *planes,
- hsize_t_f *npals,
- size_t_f *ilen,
- _fcd interlace)
+h5imget_image_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *width, hsize_t_f *height,
+ hsize_t_f *planes, hsize_t_f *npals, size_t_f *ilen, _fcd interlace)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name = NULL;
- hsize_t c_width;
- hsize_t c_height;
- hsize_t c_planes;
- hssize_t c_npals;
- char *c_buf=NULL; /* buffer to hold C string */
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char * c_name = NULL;
+ hsize_t c_width;
+ hsize_t c_height;
+ hsize_t c_planes;
+ hssize_t c_npals;
+ char * c_buf = NULL; /* buffer to hold C string */
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
if (c_name == NULL)
goto done;
/*
- * allocate buffer to hold name of an attribute
- */
- if ((c_buf = (char *)HDmalloc((size_t)*ilen +1)) == NULL)
+ * allocate buffer to hold name of an attribute
+ */
+ if ((c_buf = (char *)HDmalloc((size_t)*ilen + 1)) == NULL)
goto done;
/*
- * call H5IMget_image_info function.
- */
+ * call H5IMget_image_info function.
+ */
c_loc_id = (hid_t)*loc_id;
- ret = H5IMget_image_info(c_loc_id,c_name,&c_width,&c_height,&c_planes,c_buf,&c_npals);
+ ret = H5IMget_image_info(c_loc_id, c_name, &c_width, &c_height, &c_planes, c_buf, &c_npals);
if (ret < 0)
goto done;
- *width = (hsize_t_f) c_width;
- *height = (hsize_t_f) c_height;
- *planes = (hsize_t_f) c_planes;
- *npals = (hsize_t_f) c_npals;
+ *width = (hsize_t_f)c_width;
+ *height = (hsize_t_f)c_height;
+ *planes = (hsize_t_f)c_planes;
+ *npals = (hsize_t_f)c_npals;
/*
- * convert C name to FORTRAN and place it in the given buffer
- */
+ * convert C name to FORTRAN and place it in the given buffer
+ */
HD5packFstring(c_buf, _fcdtocp(interlace), (size_t)*ilen);
ret_value = 0;
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
- if(c_buf!=NULL)
+ if (c_buf != NULL)
HDfree(c_buf);
return ret_value;
}
-
/*-------------------------------------------------------------------------
-* Function: h5imis_image_c
-*
-* Purpose: Call H5IMis_image
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 06, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5imis_image_c
+ *
+ * Purpose: Call H5IMis_image
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 06, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5imis_image_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name)
+h5imis_image_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name)
{
- hid_t c_loc_id;
- char *c_name = NULL;
- herr_t ret;
+ hid_t c_loc_id;
+ char * c_name = NULL;
+ herr_t ret;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
- if (c_name == NULL) return -1;
+ if (c_name == NULL)
+ return -1;
/*
- * call H5LTget_dataset_ndims function.
- */
+ * call H5LTget_dataset_ndims function.
+ */
c_loc_id = (hid_t)*loc_id;
ret = H5IMis_image(c_loc_id, c_name);
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
return ret;
-
}
-
/*-------------------------------------------------------------------------
-* Function: h5immake_palette_c
-*
-* Purpose: Call H5IMmake_palette
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 06, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5immake_palette_c
+ *
+ * Purpose: Call H5IMmake_palette
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 06, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5immake_palette_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- hsize_t_f *dims,
- void *buf)
+h5immake_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *dims, void *buf)
{
- char *c_name = NULL;
+ char * c_name = NULL;
hsize_t c_dims[H5S_MAX_RANK];
int i;
- int rank=2;
+ int rank = 2;
int_f ret_value = 0;
/*
- * convert FORTRAN name to C name
- */
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ * convert FORTRAN name to C name
+ */
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL)
- for(i = 0; i < rank ; i++)
- c_dims[i] = (hsize_t)dims[i];
+ for (i = 0; i < rank; i++)
+ c_dims[i] = (hsize_t)dims[i];
/*
- * call H5IMmake_palette function.
- */
- if(H5IMmake_palettef((hid_t)*loc_id, c_name, c_dims, (int_f *)buf) < 0)
+ * call H5IMmake_palette function.
+ */
+ if (H5IMmake_palettef((hid_t)*loc_id, c_name, c_dims, (int_f *)buf) < 0)
HGOTO_DONE(FAIL)
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
}
-
/*-------------------------------------------------------------------------
-* Function: h5imlink_palette_c
-*
-* Purpose: Call H5IMlink_palette
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 06, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5imlink_palette_c
+ *
+ * Purpose: Call H5IMlink_palette
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 06, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5imlink_palette_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- size_t_f *ilen,
- _fcd pal_name)
+h5imlink_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *ilen, _fcd pal_name)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name = NULL;
- char *c_namepal = NULL;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char * c_name = NULL;
+ char * c_namepal = NULL;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
if (c_name == NULL)
goto done;
@@ -433,11 +398,11 @@ h5imlink_palette_c (hid_t_f *loc_id,
goto done;
/*
- * call H5IMlink_palette function.
- */
+ * call H5IMlink_palette function.
+ */
c_loc_id = (hid_t)*loc_id;
- ret = H5IMlink_palette(c_loc_id,c_name,c_namepal);
+ ret = H5IMlink_palette(c_loc_id, c_name, c_namepal);
if (ret < 0)
goto done;
@@ -445,50 +410,45 @@ h5imlink_palette_c (hid_t_f *loc_id,
ret_value = 0;
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
- if(c_namepal!=NULL)
+ if (c_namepal != NULL)
HDfree(c_namepal);
return ret_value;
}
-
/*-------------------------------------------------------------------------
-* Function: h5imunlink_palette_c
-*
-* Purpose: Call H5IMunlink_palette
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 06, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5imunlink_palette_c
+ *
+ * Purpose: Call H5IMunlink_palette
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 06, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5imunlink_palette_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- size_t_f *ilen,
- _fcd pal_name)
+h5imunlink_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *ilen, _fcd pal_name)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name = NULL;
- char *c_namepal = NULL;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char * c_name = NULL;
+ char * c_namepal = NULL;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
if (c_name == NULL)
goto done;
@@ -498,11 +458,11 @@ h5imunlink_palette_c (hid_t_f *loc_id,
goto done;
/*
- * call H5IMunlink_palette function.
- */
+ * call H5IMunlink_palette function.
+ */
c_loc_id = (hid_t)*loc_id;
- ret = H5IMunlink_palette(c_loc_id,c_name,c_namepal);
+ ret = H5IMunlink_palette(c_loc_id, c_name, c_namepal);
if (ret < 0)
goto done;
@@ -510,62 +470,57 @@ h5imunlink_palette_c (hid_t_f *loc_id,
ret_value = 0;
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
- if(c_namepal!=NULL)
+ if (c_namepal != NULL)
HDfree(c_namepal);
return ret_value;
}
-
-
/*-------------------------------------------------------------------------
-* Function: h5imget_npalettes_c
-*
-* Purpose: Call H5IMget_npalettes
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 06 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5imget_npalettes_c
+ *
+ * Purpose: Call H5IMget_npalettes
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 06 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5imget_npalettes_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- hsize_t_f *npals)
+h5imget_npalettes_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *npals)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name = NULL;
- hssize_t c_npals;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char * c_name = NULL;
+ hssize_t c_npals;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
if (c_name == NULL)
goto done;
/*
- * call H5IMget_image_info function.
- */
+ * call H5IMget_image_info function.
+ */
c_loc_id = (hid_t)*loc_id;
- ret = H5IMget_npalettes(c_loc_id,c_name,&c_npals);
+ ret = H5IMget_npalettes(c_loc_id, c_name, &c_npals);
- *npals = (hsize_t_f) c_npals;
+ *npals = (hsize_t_f)c_npals;
if (ret < 0)
goto done;
@@ -573,184 +528,166 @@ h5imget_npalettes_c(hid_t_f *loc_id,
ret_value = 0;
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
return ret_value;
}
-
-
/*-------------------------------------------------------------------------
-* Function: h5imget_palette_info_c
-*
-* Purpose: Call H5IMget_palette_info
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 06 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
-
+ * Function: h5imget_palette_info_c
+ *
+ * Purpose: Call H5IMget_palette_info
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 06 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5imget_palette_info_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- int_f *pal_number,
- hsize_t_f *dims)
+h5imget_palette_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *pal_number, hsize_t_f *dims)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name = NULL;
- hsize_t c_dims[2];
- int i;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char * c_name = NULL;
+ hsize_t c_dims[2];
+ int i;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
if (c_name == NULL)
goto done;
/*
- * call H5IMget_image_info function.
- */
+ * call H5IMget_image_info function.
+ */
c_loc_id = (hid_t)*loc_id;
- ret = H5IMget_palette_info(c_loc_id,c_name,*pal_number,c_dims);
+ ret = H5IMget_palette_info(c_loc_id, c_name, *pal_number, c_dims);
if (ret < 0)
goto done;
- for (i = 0; i < 2 ; i++)
- {
- dims[i] = (hsize_t_f) c_dims[i];
+ for (i = 0; i < 2; i++) {
+ dims[i] = (hsize_t_f)c_dims[i];
}
ret_value = 0;
-
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
return ret_value;
}
-
/*-------------------------------------------------------------------------
-* Function: h5imget_palette_c
-*
-* Purpose: Call H5IMget_palette
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 06 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
-
+ * Function: h5imget_palette_c
+ *
+ * Purpose: Call H5IMget_palette
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 06 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5imget_palette_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- int_f *pal_number,
- void *buf)
+h5imget_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *pal_number, void *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name = NULL;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char * c_name = NULL;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
if (c_name == NULL)
- goto done;
+ goto done;
/*
- * call H5IMget_image_info function.
- */
+ * call H5IMget_image_info function.
+ */
c_loc_id = (hid_t)*loc_id;
- ret = H5IMget_palettef(c_loc_id,c_name,*pal_number,(int_f *)buf);
+ ret = H5IMget_palettef(c_loc_id, c_name, *pal_number, (int_f *)buf);
if (ret < 0)
- goto done;
+ goto done;
ret_value = 0;
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
return ret_value;
}
-
/*-------------------------------------------------------------------------
-* Function: h5imis_palette_c
-*
-* Purpose: Call H5IMis_palette
-*
-* Return: true, false, fail
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 06, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5imis_palette_c
+ *
+ * Purpose: Call H5IMis_palette
+ *
+ * Return: true, false, fail
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 06, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5imis_palette_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name)
+h5imis_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name)
{
- hid_t c_loc_id;
- char *c_name;
- herr_t ret;
+ hid_t c_loc_id;
+ char * c_name;
+ herr_t ret;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
- if (c_name == NULL) return -1;
+ if (c_name == NULL)
+ return -1;
/*
- * call H5IMis_palette function.
- */
+ * call H5IMis_palette function.
+ */
c_loc_id = (hid_t)*loc_id;
ret = H5IMis_palette(c_loc_id, c_name);
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
return ret;
-
}
diff --git a/hl/fortran/src/H5LTf90proto.h b/hl/fortran/src/H5LTf90proto.h
index 44a2fee..b3c0a72 100644
--- a/hl/fortran/src/H5LTf90proto.h
+++ b/hl/fortran/src/H5LTf90proto.h
@@ -1,16 +1,15 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _H5LTf90proto_H
#define _H5LTf90proto_H
@@ -22,414 +21,189 @@
/* These definitions should match those in fortran/src/H5f90kit.c */
-H5_FCDLL char* HD5f2cstring (_fcd fdesc, size_t len);
-H5_FCDLL void HD5packFstring (char *src, char *dest, size_t len);
+H5_FCDLL char *HD5f2cstring(_fcd fdesc, size_t len);
+H5_FCDLL void HD5packFstring(char *src, char *dest, size_t len);
/*
* Functions from H5DSfc.c
*/
HDF5_HL_F90CSTUBDLL
-int_f
-h5dsset_scale_c(hid_t_f *dsid, _fcd dimname, size_t_f *dimnamelen);
+int_f h5dsset_scale_c(hid_t_f *dsid, _fcd dimname, size_t_f *dimnamelen);
HDF5_HL_F90CSTUBDLL
-int_f
-h5dsattach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx);
+int_f h5dsattach_scale_c(hid_t_f *did, hid_t_f *dsid, int_f *idx);
HDF5_HL_F90CSTUBDLL
-int_f
-h5dsdetach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx);
+int_f h5dsdetach_scale_c(hid_t_f *did, hid_t_f *dsid, int_f *idx);
HDF5_HL_F90CSTUBDLL
-int_f
-h5dsis_attached_c( hid_t_f *did, hid_t_f *dsid, int_f *idx, int_f *c_is_attached);
+int_f h5dsis_attached_c(hid_t_f *did, hid_t_f *dsid, int_f *idx, int_f *c_is_attached);
HDF5_HL_F90CSTUBDLL
-int_f
-h5dsis_scale_c(hid_t_f *did, int_f *is_scale);
+int_f h5dsis_scale_c(hid_t_f *did, int_f *is_scale);
HDF5_HL_F90CSTUBDLL
-int_f
-h5dsset_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *labellen);
+int_f h5dsset_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *labellen);
HDF5_HL_F90CSTUBDLL
-int_f
-h5dsget_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *size);
+int_f h5dsget_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *size);
HDF5_HL_F90CSTUBDLL
-int_f
-h5dsget_scale_name_c(hid_t_f *did, _fcd label, size_t_f *size);
+int_f h5dsget_scale_name_c(hid_t_f *did, _fcd label, size_t_f *size);
HDF5_HL_F90CSTUBDLL
-int_f
-h5dsget_num_scales_c( hid_t_f *did, int_f *idx, int_f *num_scales);
+int_f h5dsget_num_scales_c(hid_t_f *did, int_f *idx, int_f *num_scales);
/*
* Functions from H5LTfc.c
*/
HDF5_HL_F90CSTUBDLL
-int_f
-h5ltmake_dataset_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- int_f *rank,
- hsize_t_f *dims,
- hid_t_f *type_id,
- void *buf);
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5ltread_dataset_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf);
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5ltset_attribute_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd dsetname,
- size_t_f *attrnamelen,
- _fcd attrname,
- size_t_f *size,
- void *buf, char *dtype, size_t_f *sizeof_val);
-
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5ltget_attribute_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd dsetname,
- size_t_f *attrnamelen,
- _fcd attrname,
- void *buf, char* dtype, size_t_f *sizeof_val);
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5ltget_attribute_string_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd dsetname,
- size_t_f *attrnamelen,
- _fcd attrname,
- _fcd buf,
- size_t_f *buf_size);
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5ltget_dataset_ndims_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- int_f *rank);
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5ltfind_dataset_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name);
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5ltget_dataset_info_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- hsize_t_f *dims,
- int_f *type_class,
- size_t_f *type_size);
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5ltget_attribute_ndims_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd dsetname,
- size_t_f *attrnamelen,
- _fcd attrname,
- int_f *rank);
-HDF5_HL_F90CSTUBDLL
-int_f
-h5ltget_attribute_info_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- size_t_f *attrnamelen,
- _fcd attrname,
- hsize_t_f *dims,
- int_f *type_class,
- size_t_f *type_size);
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5ltmake_dataset_string_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- size_t_f *buflen,
- char *buf);
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5ltread_dataset_string_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- char *buf);
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5ltpath_valid_c(hid_t_f *loc_id,
- _fcd path,
- size_t_f *pathlen,
- int_f *check_object_valid_c);
+int_f h5ltmake_dataset_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *rank, hsize_t_f *dims,
+ hid_t_f *type_id, void *buf);
+
+HDF5_HL_F90CSTUBDLL
+int_f h5ltread_dataset_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hid_t_f *type_id, void *buf);
+
+HDF5_HL_F90CSTUBDLL
+int_f h5ltset_attribute_c(hid_t_f *loc_id, size_t_f *namelen, _fcd dsetname, size_t_f *attrnamelen,
+ _fcd attrname, size_t_f *size, void *buf, char *dtype, size_t_f *sizeof_val);
+
+HDF5_HL_F90CSTUBDLL
+int_f h5ltget_attribute_c(hid_t_f *loc_id, size_t_f *namelen, _fcd dsetname, size_t_f *attrnamelen,
+ _fcd attrname, void *buf, char *dtype, size_t_f *sizeof_val);
+
+HDF5_HL_F90CSTUBDLL
+int_f h5ltget_attribute_string_c(hid_t_f *loc_id, size_t_f *namelen, _fcd dsetname, size_t_f *attrnamelen,
+ _fcd attrname, _fcd buf, size_t_f *buf_size);
+
+HDF5_HL_F90CSTUBDLL
+int_f h5ltget_dataset_ndims_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *rank);
-/*-------------------------------------------------------------------------
-* Image
-*-------------------------------------------------------------------------
-*/
HDF5_HL_F90CSTUBDLL
-int_f
-h5immake_image_8bit_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- hsize_t_f *width,
- hsize_t_f *height,
- int_f *buf);
+int_f h5ltfind_dataset_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name);
+
HDF5_HL_F90CSTUBDLL
-int_f
-h5imread_image_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- int_f *buf);
+int_f h5ltget_dataset_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *dims,
+ int_f *type_class, size_t_f *type_size);
HDF5_HL_F90CSTUBDLL
-int_f
-h5immake_image_24bit_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- size_t_f *ilen,
- _fcd il,
- hsize_t_f *width,
- hsize_t_f *height,
- void *buf);
+int_f h5ltget_attribute_ndims_c(hid_t_f *loc_id, size_t_f *namelen, _fcd dsetname, size_t_f *attrnamelen,
+ _fcd attrname, int_f *rank);
HDF5_HL_F90CSTUBDLL
-int_f
-h5imget_image_info_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- hsize_t_f *width,
- hsize_t_f *height,
- hsize_t_f *planes,
- hsize_t_f *npals,
- size_t_f *ilen,
- _fcd interlace);
+int_f h5ltget_attribute_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *attrnamelen,
+ _fcd attrname, hsize_t_f *dims, int_f *type_class, size_t_f *type_size);
+HDF5_HL_F90CSTUBDLL
+int_f h5ltmake_dataset_string_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *buflen, char *buf);
HDF5_HL_F90CSTUBDLL
-int_f
-h5imis_image_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name);
+int_f h5ltread_dataset_string_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, char *buf);
+HDF5_HL_F90CSTUBDLL
+int_f h5ltpath_valid_c(hid_t_f *loc_id, _fcd path, size_t_f *pathlen, int_f *check_object_valid_c);
+/*-------------------------------------------------------------------------
+ * Image
+ *-------------------------------------------------------------------------
+ */
HDF5_HL_F90CSTUBDLL
-int_f
-h5immake_palette_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- hsize_t_f *dims,
- void *buf);
+int_f h5immake_image_8bit_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *width,
+ hsize_t_f *height, int_f *buf);
+HDF5_HL_F90CSTUBDLL
+int_f h5imread_image_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *buf);
HDF5_HL_F90CSTUBDLL
-int_f
-h5imlink_palette_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- size_t_f *ilen,
- _fcd pal_name);
+int_f h5immake_image_24bit_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *ilen, _fcd il,
+ hsize_t_f *width, hsize_t_f *height, void *buf);
+HDF5_HL_F90CSTUBDLL
+int_f h5imget_image_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *width, hsize_t_f *height,
+ hsize_t_f *planes, hsize_t_f *npals, size_t_f *ilen, _fcd interlace);
HDF5_HL_F90CSTUBDLL
-int_f
-h5imunlink_palette_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- size_t_f *ilen,
- _fcd pal_name);
+int_f h5imis_image_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name);
HDF5_HL_F90CSTUBDLL
-int_f
-h5imget_npalettes_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- hsize_t_f *npals);
+int_f h5immake_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *dims, void *buf);
+HDF5_HL_F90CSTUBDLL
+int_f h5imlink_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *ilen, _fcd pal_name);
HDF5_HL_F90CSTUBDLL
-int_f
-h5imget_palette_info_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- int_f *pal_number,
- hsize_t_f *dims);
+int_f h5imunlink_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *ilen, _fcd pal_name);
HDF5_HL_F90CSTUBDLL
-int_f
-h5imget_palette_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- int_f *pal_number,
- void *buf);
+int_f h5imget_npalettes_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *npals);
HDF5_HL_F90CSTUBDLL
-int_f
-h5imis_palette_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name);
+int_f h5imget_palette_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *pal_number,
+ hsize_t_f *dims);
+HDF5_HL_F90CSTUBDLL
+int_f h5imget_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *pal_number, void *buf);
+HDF5_HL_F90CSTUBDLL
+int_f h5imis_palette_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name);
/*-------------------------------------------------------------------------
-* Table
-*-------------------------------------------------------------------------
-*/
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5tbmake_table_c(size_t_f *namelen1,
- _fcd name1,
- hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- hsize_t_f *nfields,
- hsize_t_f *nrecords,
- size_t_f *type_size,
- size_t_f *field_offset,
- hid_t_f *field_types,
- hsize_t_f *chunk_size,
- int_f *compress,
- size_t_f *char_len_field_names, /* field_names lengths */
- size_t_f *max_char_size_field_names, /* char len of fields */
- _fcd buf); /* field_names */
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5tbread_table_c(hid_t_f *loc_id,
- _fcd name,
- size_t_f *namelen,
- hsize_t_f *nfields,
- size_t_f *dst_size,
- size_t_f *dst_offset,
- size_t_f *dst_sizes,
- void *dst_buf);
-
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5tbmake_table_ptr_c(size_t_f *namelen1,
- _fcd name1,
- hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- hsize_t_f *nfields,
- hsize_t_f *nrecords,
- size_t_f *type_size,
- size_t_f *field_offset,
- hid_t_f *field_types,
- hsize_t_f *chunk_size,
- void *fill_data,
- int_f *compress,
- size_t_f *char_len_field_names, /* field_names lengths */
- size_t_f *max_char_size_field_names, /* char len of fields */
- char *field_names, /* field_names */
- void *data);
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5tbwrite_field_name_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- size_t_f *namelen1,
- _fcd field_name,
- hsize_t_f *start,
- hsize_t_f *nrecords,
- size_t_f *type_size,
- void *buf);
-
-
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5tbread_field_name_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- size_t_f *namelen1,
- _fcd field_name,
- hsize_t_f *start,
- hsize_t_f *nrecords,
- size_t_f *type_size,
- void *buf);
-
-
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5tbwrite_field_index_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- int_f *field_index,
- hsize_t_f *start,
- hsize_t_f *nrecords,
- size_t_f *type_size,
- void *buf);
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5tbread_field_index_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- int_f *field_index,
- hsize_t_f *start,
- hsize_t_f *nrecords,
- size_t_f *type_size,
- void *buf);
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5tbinsert_field_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- size_t_f *namelen1,
- _fcd field_name,
- hid_t_f *field_type,
- int_f *position,
- void *buf);
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5tbdelete_field_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- size_t_f *namelen1,
- _fcd field_name);
-
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5tbget_table_info_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- hsize_t_f *nfields,
- hsize_t_f *nrecords);
-
-HDF5_HL_F90CSTUBDLL
-int_f
-h5tbget_field_info_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- hsize_t_f *nfields,
- size_t_f *field_sizes,
- size_t_f *field_offsets,
- size_t_f *type_size,
- size_t_f *namelen2,
- size_t_f *lenmax,
- _fcd field_names,
- size_t_f *maxlen_out);
+ * Table
+ *-------------------------------------------------------------------------
+ */
+
+HDF5_HL_F90CSTUBDLL
+int_f h5tbmake_table_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen, _fcd name,
+ hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, size_t_f *field_offset,
+ hid_t_f *field_types, hsize_t_f *chunk_size, int_f *compress,
+ size_t_f *char_len_field_names, /* field_names lengths */
+ size_t_f *max_char_size_field_names, /* char len of fields */
+ _fcd buf); /* field_names */
+
+HDF5_HL_F90CSTUBDLL
+int_f h5tbread_table_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hsize_t_f *nfields, size_t_f *dst_size,
+ size_t_f *dst_offset, size_t_f *dst_sizes, void *dst_buf);
+
+HDF5_HL_F90CSTUBDLL
+int_f h5tbmake_table_ptr_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen, _fcd name,
+ hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size,
+ size_t_f *field_offset, hid_t_f *field_types, hsize_t_f *chunk_size,
+ void *fill_data, int_f *compress,
+ size_t_f *char_len_field_names, /* field_names lengths */
+ size_t_f *max_char_size_field_names, /* char len of fields */
+ char * field_names, /* field_names */
+ void * data);
+
+HDF5_HL_F90CSTUBDLL
+int_f h5tbwrite_field_name_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1,
+ _fcd field_name, hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size,
+ void *buf);
+
+HDF5_HL_F90CSTUBDLL
+int_f h5tbread_field_name_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1,
+ _fcd field_name, hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size,
+ void *buf);
+HDF5_HL_F90CSTUBDLL
+int_f h5tbwrite_field_index_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *field_index,
+ hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf);
+
+HDF5_HL_F90CSTUBDLL
+int_f h5tbread_field_index_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *field_index,
+ hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf);
+
+HDF5_HL_F90CSTUBDLL
+int_f h5tbinsert_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, _fcd field_name,
+ hid_t_f *field_type, int_f *position, void *buf);
+
+HDF5_HL_F90CSTUBDLL
+int_f h5tbdelete_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, _fcd field_name);
+
+HDF5_HL_F90CSTUBDLL
+int_f h5tbget_table_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *nfields,
+ hsize_t_f *nrecords);
+
+HDF5_HL_F90CSTUBDLL
+int_f h5tbget_field_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *nfields,
+ size_t_f *field_sizes, size_t_f *field_offsets, size_t_f *type_size,
+ size_t_f *namelen2, size_t_f *lenmax, _fcd field_names, size_t_f *maxlen_out);
#endif /* _H5LTf90proto_H */
diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c
index 2c4f274..0813f66 100644
--- a/hl/fortran/src/H5LTfc.c
+++ b/hl/fortran/src/H5LTfc.c
@@ -1,15 +1,15 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This files contains C stubs for H5D Fortran APIs */
@@ -18,121 +18,111 @@
#include "H5Eprivate.h"
/*-------------------------------------------------------------------------
-* Function: H5LTmake_dataset_c
-*
-* Purpose: Call H5LTmake_dataset
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 09, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTmake_dataset_c
+ *
+ * Purpose: Call H5LTmake_dataset
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 09, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5ltmake_dataset_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- int_f *rank,
- hsize_t_f *dims,
- hid_t_f *type_id,
- void *buf)
+h5ltmake_dataset_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *rank, hsize_t_f *dims,
+ hid_t_f *type_id, void *buf)
{
- int ret_value = -1;
- herr_t ret;
- char *c_name = NULL;
+ int ret_value = -1;
+ herr_t ret;
+ char * c_name = NULL;
hsize_t *c_dims = NULL;
- int i;
+ int i;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
if (c_name == NULL)
goto done;
- c_dims = (hsize_t *)HDmalloc(sizeof(hsize_t) * ( (size_t)*rank ));
+ c_dims = (hsize_t *)HDmalloc(sizeof(hsize_t) * ((size_t)*rank));
if (c_dims == NULL)
goto done;
/*
- * transpose dimension arrays because of C-FORTRAN storage order
- */
- for (i = 0; i < *rank ; i++)
- {
- c_dims[i] = dims[*rank - i - 1];
+ * transpose dimension arrays because of C-FORTRAN storage order
+ */
+ for (i = 0; i < *rank; i++) {
+ c_dims[i] = dims[*rank - i - 1];
}
/*
- * call H5LTmake_dataset function.
- */
+ * call H5LTmake_dataset function.
+ */
- ret = H5LTmake_dataset((hid_t)*loc_id, c_name, (int)*rank, c_dims, (hid_t)*type_id, buf );
+ ret = H5LTmake_dataset((hid_t)*loc_id, c_name, (int)*rank, c_dims, (hid_t)*type_id, buf);
if (ret < 0)
goto done;
ret_value = 0;
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
- if(c_dims!=NULL)
+ if (c_dims != NULL)
HDfree(c_dims);
return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: H5LTread_dataset_c
-*
-* Purpose: Call H5LTmake_dataset
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 09, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTread_dataset_c
+ *
+ * Purpose: Call H5LTmake_dataset
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 09, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5ltread_dataset_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- hid_t_f *type_id,
- void *buf)
+h5ltread_dataset_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hid_t_f *type_id, void *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- hid_t c_type_id;
- char *c_name = NULL;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ hid_t c_type_id;
+ char * c_name = NULL;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
if (c_name == NULL)
goto done;
/*
- * call H5LTread_dataset function.
- */
- c_loc_id = (hid_t)*loc_id;
+ * call H5LTread_dataset function.
+ */
+ c_loc_id = (hid_t)*loc_id;
c_type_id = (hid_t)*type_id;
- ret = H5LTread_dataset(c_loc_id, c_name, c_type_id, buf );
+ ret = H5LTread_dataset(c_loc_id, c_name, c_type_id, buf);
if (ret < 0)
goto done;
@@ -140,47 +130,43 @@ h5ltread_dataset_c (hid_t_f *loc_id,
ret_value = 0;
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: H5LTmake_dataset_string_c
-*
-* Purpose: Call H5LTmake_dataset
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 09, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTmake_dataset_string_c
+ *
+ * Purpose: Call H5LTmake_dataset
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 09, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5ltmake_dataset_string_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- size_t_f *buflen,
- char *buf)
+h5ltmake_dataset_string_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *buflen, char *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name = NULL;
- char *c_buf = NULL;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char * c_name = NULL;
+ char * c_buf = NULL;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
if (c_name == NULL)
goto done;
@@ -190,11 +176,11 @@ h5ltmake_dataset_string_c (hid_t_f *loc_id,
goto done;
/*
- * call H5LTmake_dataset_string function.
- */
+ * call H5LTmake_dataset_string function.
+ */
c_loc_id = (hid_t)*loc_id;
- ret = H5LTmake_dataset_string(c_loc_id,c_name,c_buf);
+ ret = H5LTmake_dataset_string(c_loc_id, c_name, c_buf);
if (ret < 0)
goto done;
@@ -202,58 +188,54 @@ h5ltmake_dataset_string_c (hid_t_f *loc_id,
ret_value = 0;
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
- if(c_buf!=NULL)
+ if (c_buf != NULL)
HDfree(c_buf);
return ret_value;
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTread_dataset_string_c
-*
-* Purpose: Call H5LTread_dataset_string
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 09, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTread_dataset_string_c
+ *
+ * Purpose: Call H5LTread_dataset_string
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 09, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5ltread_dataset_string_c (hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- char *buf)
+h5ltread_dataset_string_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, char *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name = NULL;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char * c_name = NULL;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
if (c_name == NULL)
goto done;
/*
- * call H5LTread_dataset_string function.
- */
+ * call H5LTread_dataset_string function.
+ */
c_loc_id = (hid_t)*loc_id;
- ret = H5LTread_dataset_string(c_loc_id,c_name,buf);
+ ret = H5LTread_dataset_string(c_loc_id, c_name, buf);
if (ret < 0)
goto done;
@@ -261,51 +243,46 @@ h5ltread_dataset_string_c (hid_t_f *loc_id,
ret_value = 0;
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: H5LTset_attribute_int_c
-*
-* Purpose: Call H5LTset_attribute_int
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 05, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTset_attribute_int_c
+ *
+ * Purpose: Call H5LTset_attribute_int
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 05, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5ltset_attribute_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd dsetname,
- size_t_f *attrnamelen,
- _fcd attrname,
- size_t_f *size,
- void *buf, char *dtype, size_t_f *sizeof_val)
+h5ltset_attribute_c(hid_t_f *loc_id, size_t_f *namelen, _fcd dsetname, size_t_f *attrnamelen, _fcd attrname,
+ size_t_f *size, void *buf, char *dtype, size_t_f *sizeof_val)
{
- int ret_value = -1;
- herr_t ret = SUCCEED;
- hid_t c_loc_id;
- char *c_name = NULL;
- char *c_attrname = NULL;
- char *c_buf = NULL;
- size_t c_size;
+ int ret_value = -1;
+ herr_t ret = SUCCEED;
+ hid_t c_loc_id;
+ char * c_name = NULL;
+ char * c_attrname = NULL;
+ char * c_buf = NULL;
+ size_t c_size;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(dsetname, (size_t)*namelen);
if (c_name == NULL)
goto done;
@@ -315,93 +292,97 @@ h5ltset_attribute_c(hid_t_f *loc_id,
goto done;
/*
- * call H5LTset_attribute_int function.
- */
+ * call H5LTset_attribute_int function.
+ */
c_loc_id = (hid_t)*loc_id;
c_size = (size_t)*size;
- if( HDstrncmp(dtype,"I",1) == 0 ) {
- if ((size_t)*sizeof_val == sizeof(int))
- ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_INT, (const int *)buf);
- else if ((size_t)*sizeof_val == sizeof(long))
- ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_LONG, (const long *)buf);
+ if (HDstrncmp(dtype, "I", 1) == 0) {
+ if ((size_t)*sizeof_val == sizeof(int))
+ ret = H5LT_set_attribute_numerical(c_loc_id, c_name, c_attrname, c_size, H5T_NATIVE_INT,
+ (const int *)buf);
+ else if ((size_t)*sizeof_val == sizeof(long))
+ ret = H5LT_set_attribute_numerical(c_loc_id, c_name, c_attrname, c_size, H5T_NATIVE_LONG,
+ (const long *)buf);
#if H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG
- else if ((size_t)*sizeof_val == sizeof(long long))
- ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_LLONG, (const long long *)buf);
+ else if ((size_t)*sizeof_val == sizeof(long long))
+ ret = H5LT_set_attribute_numerical(c_loc_id, c_name, c_attrname, c_size, H5T_NATIVE_LLONG,
+ (const long long *)buf);
#endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */
- else
- goto done;
- } else if ( HDstrncmp(dtype,"R",1) == 0 ) {
- if((size_t)*sizeof_val == sizeof(float))
- ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_FLOAT, (const float *)buf);
- else if((size_t)*sizeof_val == sizeof(double))
- ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_DOUBLE, (const double *)buf);
-#if H5_SIZEOF_LONG_DOUBLE !=0
- else if((size_t)*sizeof_val == sizeof(long double))
- ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_LDOUBLE, (const long double *)buf);
+ else
+ goto done;
+ }
+ else if (HDstrncmp(dtype, "R", 1) == 0) {
+ if ((size_t)*sizeof_val == sizeof(float))
+ ret = H5LT_set_attribute_numerical(c_loc_id, c_name, c_attrname, c_size, H5T_NATIVE_FLOAT,
+ (const float *)buf);
+ else if ((size_t)*sizeof_val == sizeof(double))
+ ret = H5LT_set_attribute_numerical(c_loc_id, c_name, c_attrname, c_size, H5T_NATIVE_DOUBLE,
+ (const double *)buf);
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ else if ((size_t)*sizeof_val == sizeof(long double))
+ ret = H5LT_set_attribute_numerical(c_loc_id, c_name, c_attrname, c_size, H5T_NATIVE_LDOUBLE,
+ (const long double *)buf);
#endif
- else
- goto done;
- } else if ( HDstrncmp(dtype,"C",1) == 0 ) {
+ else
+ goto done;
+ }
+ else if (HDstrncmp(dtype, "C", 1) == 0) {
- c_buf = (char *)HD5f2cstring((_fcd)buf, c_size);
- if (c_buf == NULL)
- goto done;
+ c_buf = (char *)HD5f2cstring((_fcd)buf, c_size);
+ if (c_buf == NULL)
+ goto done;
- ret = H5LTset_attribute_string(c_loc_id,c_name,c_attrname,c_buf);
+ ret = H5LTset_attribute_string(c_loc_id, c_name, c_attrname, c_buf);
}
if (ret < 0)
- goto done;
+ goto done;
ret_value = 0;
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
- if(c_attrname!=NULL)
+ if (c_attrname != NULL)
HDfree(c_attrname);
- if(c_buf!=NULL)
+ if (c_buf != NULL)
HDfree(c_buf);
return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute_c
-*
-* Purpose: Call H5LTget_attribute_int
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 05, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTget_attribute_c
+ *
+ * Purpose: Call H5LTget_attribute_int
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 05, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5ltget_attribute_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd dsetname,
- size_t_f *attrnamelen,
- _fcd attrname,
- void *buf, char *dtype, size_t_f *sizeof_val)
+h5ltget_attribute_c(hid_t_f *loc_id, size_t_f *namelen, _fcd dsetname, size_t_f *attrnamelen, _fcd attrname,
+ void *buf, char *dtype, size_t_f *sizeof_val)
{
- int ret_value = -1;
- herr_t ret = SUCCEED;
- hid_t c_loc_id;
- char *c_name = NULL;
- char *c_attrname = NULL;
+ int ret_value = -1;
+ herr_t ret = SUCCEED;
+ hid_t c_loc_id;
+ char * c_name = NULL;
+ char * c_attrname = NULL;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(dsetname, (size_t)*namelen);
if (c_name == NULL)
goto done;
@@ -411,32 +392,33 @@ h5ltget_attribute_c(hid_t_f *loc_id,
goto done;
/*
- * call H5LTget_attribute_int function.
- */
+ * call H5LTget_attribute_int function.
+ */
c_loc_id = (hid_t)*loc_id;
- if( HDstrncmp(dtype,"I",1) == 0) {
- if((size_t)*sizeof_val == sizeof(int))
- ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_INT,buf);
- else if ((size_t)*sizeof_val == sizeof(long))
- ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_LONG,buf);
+ if (HDstrncmp(dtype, "I", 1) == 0) {
+ if ((size_t)*sizeof_val == sizeof(int))
+ ret = H5LTget_attribute(c_loc_id, c_name, c_attrname, H5T_NATIVE_INT, buf);
+ else if ((size_t)*sizeof_val == sizeof(long))
+ ret = H5LTget_attribute(c_loc_id, c_name, c_attrname, H5T_NATIVE_LONG, buf);
#if H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG
- else if ((size_t)*sizeof_val == sizeof(long long))
- ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_LLONG,buf);
+ else if ((size_t)*sizeof_val == sizeof(long long))
+ ret = H5LTget_attribute(c_loc_id, c_name, c_attrname, H5T_NATIVE_LLONG, buf);
#endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */
- else
- goto done;
- } else if ( HDstrncmp(dtype,"R",1) == 0 ) {
- if((size_t)*sizeof_val == sizeof(float))
- ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_FLOAT,buf);
- else if((size_t)*sizeof_val == sizeof(double))
- ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_DOUBLE,buf);
-#if H5_SIZEOF_LONG_DOUBLE !=0
- else if((size_t)*sizeof_val == sizeof(long double))
- ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_LDOUBLE,buf);
+ else
+ goto done;
+ }
+ else if (HDstrncmp(dtype, "R", 1) == 0) {
+ if ((size_t)*sizeof_val == sizeof(float))
+ ret = H5LTget_attribute(c_loc_id, c_name, c_attrname, H5T_NATIVE_FLOAT, buf);
+ else if ((size_t)*sizeof_val == sizeof(double))
+ ret = H5LTget_attribute(c_loc_id, c_name, c_attrname, H5T_NATIVE_DOUBLE, buf);
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ else if ((size_t)*sizeof_val == sizeof(long double))
+ ret = H5LTget_attribute(c_loc_id, c_name, c_attrname, H5T_NATIVE_LDOUBLE, buf);
#endif
- else
- goto done;
+ else
+ goto done;
}
if (ret < 0)
@@ -445,50 +427,46 @@ h5ltget_attribute_c(hid_t_f *loc_id,
ret_value = 0;
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
- if(c_attrname!=NULL)
+ if (c_attrname != NULL)
HDfree(c_attrname);
return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute_string_c
-*
-* Purpose: Call H5LTget_attribute_string
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 05, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTget_attribute_string_c
+ *
+ * Purpose: Call H5LTget_attribute_string
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 05, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5ltget_attribute_string_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd dsetname,
- size_t_f *attrnamelen,
- _fcd attrname,
- _fcd buf, size_t_f *buf_size)
+h5ltget_attribute_string_c(hid_t_f *loc_id, size_t_f *namelen, _fcd dsetname, size_t_f *attrnamelen,
+ _fcd attrname, _fcd buf, size_t_f *buf_size)
{
- int ret_value = -1;
- herr_t ret;
- char *c_name = NULL;
- char *c_attrname = NULL;
- char *c_buf = NULL;
+ int ret_value = -1;
+ herr_t ret;
+ char * c_name = NULL;
+ char * c_attrname = NULL;
+ char * c_buf = NULL;
/*
- * Convert FORTRAN name to C name
- */
+ * Convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(dsetname, (size_t)*namelen);
if (c_name == NULL)
goto done;
@@ -500,12 +478,12 @@ h5ltget_attribute_string_c(hid_t_f *loc_id,
* Allocate buffer to hold C attribute string
*/
if ((c_buf = (char *)HDmalloc((size_t)*buf_size + 1)) == NULL)
- goto done;
+ goto done;
/*
* Call H5LTget_attribute_int function.
*/
- ret = H5LTget_attribute_string((hid_t)*loc_id,c_name,c_attrname,c_buf);
+ ret = H5LTget_attribute_string((hid_t)*loc_id, c_name, c_attrname, c_buf);
if (ret < 0)
goto done;
@@ -517,58 +495,54 @@ h5ltget_attribute_string_c(hid_t_f *loc_id,
ret_value = 0;
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
- if(c_attrname!=NULL)
+ if (c_attrname != NULL)
HDfree(c_attrname);
- if(c_buf!=NULL)
+ if (c_buf != NULL)
HDfree(c_buf);
return ret_value;
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTget_dataset_ndims_c
-*
-* Purpose: Call H5LTget_dataset_ndims
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 09, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTget_dataset_ndims_c
+ *
+ * Purpose: Call H5LTget_dataset_ndims
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 09, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5ltget_dataset_ndims_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- int_f *rank)
+h5ltget_dataset_ndims_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *rank)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name = NULL;
- int c_rank;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char * c_name = NULL;
+ int c_rank;
/*
- * Convert FORTRAN name to C name
- */
+ * Convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
if (c_name == NULL)
goto done;
/*
- * Call H5LTget_dataset_ndims function.
- */
+ * Call H5LTget_dataset_ndims function.
+ */
c_loc_id = (hid_t)*loc_id;
ret = H5LTget_dataset_ndims(c_loc_id, c_name, &c_rank);
@@ -576,113 +550,105 @@ h5ltget_dataset_ndims_c(hid_t_f *loc_id,
if (ret < 0)
goto done;
- *rank = (int_f)c_rank;
+ *rank = (int_f)c_rank;
ret_value = 0;
-
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
return ret_value;
}
-
/*-------------------------------------------------------------------------
-* Function: h5ltfind_dataset_c
-*
-* Purpose: Call H5LTfind_dataset
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 09, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5ltfind_dataset_c
+ *
+ * Purpose: Call H5LTfind_dataset
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 09, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5ltfind_dataset_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name)
+h5ltfind_dataset_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name)
{
- hid_t c_loc_id;
- char *c_name = NULL;
- herr_t ret;
+ hid_t c_loc_id;
+ char * c_name = NULL;
+ herr_t ret;
/*
- * Convert FORTRAN name to C name
- */
+ * Convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
- if (c_name == NULL) return -1;
+ if (c_name == NULL)
+ return -1;
/*
- * Call H5LTget_dataset_ndims function.
- */
+ * Call H5LTget_dataset_ndims function.
+ */
c_loc_id = (hid_t)*loc_id;
ret = H5LTfind_dataset(c_loc_id, c_name);
- if(c_name!=NULL)
- HDfree(c_name);
+ if (c_name != NULL)
+ HDfree(c_name);
return ret;
-
}
/*-------------------------------------------------------------------------
-* Function: h5ltget_dataset_info_c
-*
-* Purpose: Call H5LTget_dataset_info
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 09, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5ltget_dataset_info_c
+ *
+ * Purpose: Call H5LTget_dataset_info
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 09, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5ltget_dataset_info_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- hsize_t_f *dims,
- int_f *type_class,
- size_t_f *type_size)
+h5ltget_dataset_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *dims, int_f *type_class,
+ size_t_f *type_size)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name = NULL;
- H5T_class_t c_classtype;
- size_t c_type_size;
- hsize_t c_dims[32];
- int i;
- int c_rank;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char * c_name = NULL;
+ H5T_class_t c_classtype;
+ size_t c_type_size;
+ hsize_t c_dims[32];
+ int i;
+ int c_rank;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
if (c_name == NULL)
goto done;
/*
- * call H5LTget_dataset_ndims function.
- */
+ * call H5LTget_dataset_ndims function.
+ */
c_loc_id = (hid_t)*loc_id;
ret = H5LTget_dataset_info(c_loc_id, c_name, c_dims, &c_classtype, &c_type_size);
@@ -690,68 +656,62 @@ h5ltget_dataset_info_c(hid_t_f *loc_id,
goto done;
*type_class = c_classtype;
- *type_size = (size_t_f)c_type_size;
+ *type_size = (size_t_f)c_type_size;
/*
- * transpose dimension arrays because of C-FORTRAN storage order
- */
+ * transpose dimension arrays because of C-FORTRAN storage order
+ */
ret = H5LTget_dataset_ndims(c_loc_id, c_name, &c_rank);
if (ret < 0)
goto done;
- for (i = 0; i < c_rank ; i++)
- {
- dims[i] = (hsize_t_f) c_dims[c_rank - i - 1];
+ for (i = 0; i < c_rank; i++) {
+ dims[i] = (hsize_t_f)c_dims[c_rank - i - 1];
}
-
ret_value = 0;
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: h5ltget_attribute_ndims_c
-*
-* Purpose: Call H5LTget_attribute_ndims
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 05, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5ltget_attribute_ndims_c
+ *
+ * Purpose: Call H5LTget_attribute_ndims
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 05, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5ltget_attribute_ndims_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd dsetname,
- size_t_f *attrnamelen,
- _fcd attrname,
- int_f *rank)
+h5ltget_attribute_ndims_c(hid_t_f *loc_id, size_t_f *namelen, _fcd dsetname, size_t_f *attrnamelen,
+ _fcd attrname, int_f *rank)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name = NULL;
- char *c_attrname = NULL;
- int c_rank;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char * c_name = NULL;
+ char * c_attrname = NULL;
+ int c_rank;
/*
- * Convert FORTRAN name to C name
- */
+ * Convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(dsetname, (size_t)*namelen);
if (c_name == NULL)
goto done;
@@ -761,72 +721,64 @@ h5ltget_attribute_ndims_c(hid_t_f *loc_id,
goto done;
/*
- * Call H5LTset_attribute_ndims function.
- */
+ * Call H5LTset_attribute_ndims function.
+ */
c_loc_id = (hid_t)*loc_id;
- ret = H5LTget_attribute_ndims(c_loc_id,c_name,c_attrname,&c_rank);
+ ret = H5LTget_attribute_ndims(c_loc_id, c_name, c_attrname, &c_rank);
if (ret < 0)
goto done;
- *rank = (int_f)c_rank;
+ *rank = (int_f)c_rank;
ret_value = 0;
-
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
- if(c_attrname!=NULL)
+ if (c_attrname != NULL)
HDfree(c_attrname);
return ret_value;
}
-
/*-------------------------------------------------------------------------
-* Function: h5ltget_attribute_info_c
-*
-* Purpose: Call H5LTget_attribute_info
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 09, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5ltget_attribute_info_c
+ *
+ * Purpose: Call H5LTget_attribute_info
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 09, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5ltget_attribute_info_c(hid_t_f *loc_id,
- size_t_f *namelen,
- _fcd name,
- size_t_f *attrnamelen,
- _fcd attrname,
- hsize_t_f *dims,
- int_f *type_class,
- size_t_f *type_size)
+h5ltget_attribute_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *attrnamelen, _fcd attrname,
+ hsize_t_f *dims, int_f *type_class, size_t_f *type_size)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
- char *c_name = NULL;
- char *c_attrname = NULL;
- H5T_class_t c_classtype;
- size_t c_type_size;
- hsize_t c_dims[32];
- int i;
- int c_rank;
+ int ret_value = -1;
+ herr_t ret;
+ hid_t c_loc_id;
+ char * c_name = NULL;
+ char * c_attrname = NULL;
+ H5T_class_t c_classtype;
+ size_t c_type_size;
+ hsize_t c_dims[32];
+ int i;
+ int c_rank;
/*
- * convert FORTRAN name to C name
- */
+ * convert FORTRAN name to C name
+ */
c_name = (char *)HD5f2cstring(name, (size_t)*namelen);
if (c_name == NULL)
goto done;
@@ -836,90 +788,84 @@ h5ltget_attribute_info_c(hid_t_f *loc_id,
goto done;
/*
- * call H5LTget_attribute_info function.
- */
+ * call H5LTget_attribute_info function.
+ */
c_loc_id = (hid_t)*loc_id;
- ret = H5LTget_attribute_info(c_loc_id,c_name,c_attrname,c_dims,&c_classtype,&c_type_size);
+ ret = H5LTget_attribute_info(c_loc_id, c_name, c_attrname, c_dims, &c_classtype, &c_type_size);
if (ret < 0)
goto done;
*type_class = c_classtype;
- *type_size = (size_t_f)c_type_size;
+ *type_size = (size_t_f)c_type_size;
/*
- * transpose dimension arrays because of C-FORTRAN storage order
- */
+ * transpose dimension arrays because of C-FORTRAN storage order
+ */
- ret = H5LTget_attribute_ndims(c_loc_id,c_name,c_attrname,&c_rank);
+ ret = H5LTget_attribute_ndims(c_loc_id, c_name, c_attrname, &c_rank);
if (ret < 0)
goto done;
- for (i = 0; i < c_rank ; i++)
- {
- dims[i] = (hsize_t_f) c_dims[c_rank - i - 1];
+ for (i = 0; i < c_rank; i++) {
+ dims[i] = (hsize_t_f)c_dims[c_rank - i - 1];
}
ret_value = 0;
-
done:
- if(c_name!=NULL)
+ if (c_name != NULL)
HDfree(c_name);
- if(c_attrname!=NULL)
+ if (c_attrname != NULL)
HDfree(c_attrname);
-
return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: h5ltpath_valid_c
-*
-* Purpose: Calls h5ltpath_valid
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: M. Scot Breitenfeld
-*
-* Date: February 18, 2012
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5ltpath_valid_c
+ *
+ * Purpose: Calls h5ltpath_valid
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: M. Scot Breitenfeld
+ *
+ * Date: February 18, 2012
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5ltpath_valid_c(hid_t_f *loc_id,
- _fcd path,
- size_t_f *pathlen,
- int_f *check_object_valid_c)
+h5ltpath_valid_c(hid_t_f *loc_id, _fcd path, size_t_f *pathlen, int_f *check_object_valid_c)
{
- htri_t ret = -1;
- char *c_path = NULL;
+ htri_t ret = -1;
+ char * c_path = NULL;
hbool_t check_object_valid;
/*
* convert FORTRAN name to C name
*/
- if( NULL == (c_path = (char *)HD5f2cstring(path, (size_t)*pathlen)))
- goto done;
+ if (NULL == (c_path = (char *)HD5f2cstring(path, (size_t)*pathlen)))
+ goto done;
check_object_valid = FALSE;
- if(*check_object_valid_c == 1)
- check_object_valid = TRUE;
+ if (*check_object_valid_c == 1)
+ check_object_valid = TRUE;
/*
* call H5LTpath_valid function.
*/
- ret = H5LTpath_valid( (hid_t)*loc_id, c_path, check_object_valid );
+ ret = H5LTpath_valid((hid_t)*loc_id, c_path, check_object_valid);
done:
- if(c_path != NULL)
- HDfree(c_path);
+ if (c_path != NULL)
+ HDfree(c_path);
return (int_f)ret;
}
diff --git a/hl/fortran/src/H5TBfc.c b/hl/fortran/src/H5TBfc.c
index bd582e4..35d31cc 100644
--- a/hl/fortran/src/H5TBfc.c
+++ b/hl/fortran/src/H5TBfc.c
@@ -1,15 +1,15 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <math.h>
@@ -20,579 +20,570 @@
#include "H5Eprivate.h"
/*-------------------------------------------------------------------------
-* Function: h5tbmake_table_c
-*
-* Purpose: Call H5TBmake_table
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 06, 2004
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5tbmake_table_c
+ *
+ * Purpose: Call H5TBmake_table
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 06, 2004
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
h5tbmake_table_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen, _fcd name,
- hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, size_t_f *field_offset,
- hid_t_f *field_types, hsize_t_f *chunk_size, int_f *compress,
- size_t_f *char_len_field_names, /* field_names lengths */
- size_t_f *max_char_size_field_names, /* char len of fields */
- char *field_names) /* field_names */
+ hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, size_t_f *field_offset,
+ hid_t_f *field_types, hsize_t_f *chunk_size, int_f *compress,
+ size_t_f *char_len_field_names, /* field_names lengths */
+ size_t_f *max_char_size_field_names, /* char len of fields */
+ char * field_names) /* field_names */
{
- char *c_name = NULL;
- char *c_name1 = NULL;
+ char * c_name = NULL;
+ char * c_name1 = NULL;
hsize_t num_elem;
hsize_t i;
- hsize_t c_nfields = (hsize_t)*nfields;
+ hsize_t c_nfields = (hsize_t)*nfields;
size_t *c_field_offset = NULL;
- hid_t *c_field_types = NULL;
- char **c_field_names = NULL;
- char *tmp = NULL, *tmp_p;
- int_f ret_value = 0;
+ hid_t * c_field_types = NULL;
+ char ** c_field_names = NULL;
+ char * tmp = NULL, *tmp_p;
+ int_f ret_value = 0;
num_elem = (hsize_t)*nfields;
/*
* convert FORTRAN name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL)
- if(NULL == (c_name1 = (char *)HD5f2cstring(name1, (size_t)*namelen1)))
+ if (NULL == (c_name1 = (char *)HD5f2cstring(name1, (size_t)*namelen1)))
HGOTO_DONE(FAIL)
- if(NULL == (c_field_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
+ if (NULL == (c_field_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
HGOTO_DONE(FAIL)
- if(NULL == (c_field_types = (hid_t *)HDmalloc(sizeof(hid_t) * (size_t)c_nfields)))
+ if (NULL == (c_field_types = (hid_t *)HDmalloc(sizeof(hid_t) * (size_t)c_nfields)))
HGOTO_DONE(FAIL)
- for(i = 0; i < num_elem; i++) {
- c_field_offset[i] = (size_t)field_offset[i];
- c_field_types[i] = field_types[i];
+ for (i = 0; i < num_elem; i++) {
+ c_field_offset[i] = (size_t)field_offset[i];
+ c_field_types[i] = field_types[i];
} /* end for */
/*
* allocate array of character pointers
*/
- if(NULL == (c_field_names = (char **)HDcalloc((size_t)num_elem, sizeof(char *))))
+ if (NULL == (c_field_names = (char **)HDcalloc((size_t)num_elem, sizeof(char *))))
HGOTO_DONE(FAIL)
/* copy data to long C string */
- if(NULL == (tmp = (char *)HD5f2cstring(field_names, (size_t)*(max_char_size_field_names)*(size_t)num_elem)))
+ if (NULL ==
+ (tmp = (char *)HD5f2cstring(field_names, (size_t) * (max_char_size_field_names) * (size_t)num_elem)))
HGOTO_DONE(FAIL)
/*
* move data from temorary buffer
*/
tmp_p = tmp;
- for(i = 0; i < num_elem; i++) {
- if(NULL == (c_field_names[i] = (char *)HDmalloc((size_t)char_len_field_names[i] + 1)))
+ for (i = 0; i < num_elem; i++) {
+ if (NULL == (c_field_names[i] = (char *)HDmalloc((size_t)char_len_field_names[i] + 1)))
HGOTO_DONE(FAIL)
HDmemcpy(c_field_names[i], tmp_p, (size_t)char_len_field_names[i]);
c_field_names[i][char_len_field_names[i]] = '\0';
- tmp_p = tmp_p + *max_char_size_field_names;
+ tmp_p = tmp_p + *max_char_size_field_names;
} /* end for */
/*
* call H5TBmake_table function.
*/
- if(H5TBmake_table(c_name1, (hid_t)*loc_id, c_name, c_nfields, (hsize_t)*nrecords,
- (size_t)*type_size, (const char **)c_field_names, c_field_offset, c_field_types,
- (hsize_t)*chunk_size, NULL, *compress, NULL) < 0)
+ if (H5TBmake_table(c_name1, (hid_t)*loc_id, c_name, c_nfields, (hsize_t)*nrecords, (size_t)*type_size,
+ (const char **)c_field_names, c_field_offset, c_field_types, (hsize_t)*chunk_size,
+ NULL, *compress, NULL) < 0)
HGOTO_DONE(FAIL)
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
- if(c_name1)
+ if (c_name1)
HDfree(c_name1);
- if(c_field_names) {
- for(i = 0; i < num_elem; i++) {
- if(c_field_names[i])
+ if (c_field_names) {
+ for (i = 0; i < num_elem; i++) {
+ if (c_field_names[i])
HDfree(c_field_names[i]);
} /* end for */
HDfree(c_field_names);
} /* end if */
- if(tmp)
+ if (tmp)
HDfree(tmp);
- if(c_field_offset)
+ if (c_field_offset)
HDfree(c_field_offset);
- if(c_field_types)
+ if (c_field_types)
HDfree(c_field_types);
return ret_value;
} /* end h5tbmake_table_c() */
/*-------------------------------------------------------------------------
-* Function: h5tbmake_table_ptr_c
-*
-* Purpose: Call H5TBmake_table using F2003 features
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: M. Scot Breitenfeld
-*
-* Date: Sept. 10, 2015
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5tbmake_table_ptr_c
+ *
+ * Purpose: Call H5TBmake_table using F2003 features
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: M. Scot Breitenfeld
+ *
+ * Date: Sept. 10, 2015
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5tbmake_table_ptr_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen,
- _fcd name, hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size,
- size_t_f *field_offset, hid_t_f *field_types, hsize_t_f *chunk_size,
- void *fill_data, int_f *compress,
- size_t_f *char_len_field_names, /* field_names lengths */
- size_t_f *max_char_size_field_names, /* char len of fields */
- char *field_names,
- void *data) /* field_names */
+h5tbmake_table_ptr_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen, _fcd name,
+ hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, size_t_f *field_offset,
+ hid_t_f *field_types, hsize_t_f *chunk_size, void *fill_data, int_f *compress,
+ size_t_f *char_len_field_names, /* field_names lengths */
+ size_t_f *max_char_size_field_names, /* char len of fields */
+ char *field_names, void *data) /* field_names */
{
- char *c_name = NULL;
- char *c_name1 = NULL;
+ char * c_name = NULL;
+ char * c_name1 = NULL;
hsize_t num_elem;
hsize_t i;
- hsize_t c_nfields = (hsize_t)*nfields;
+ hsize_t c_nfields = (hsize_t)*nfields;
size_t *c_field_offset = NULL;
- hid_t *c_field_types = NULL;
- char **c_field_names = NULL;
- char *tmp = NULL, *tmp_p;
- int_f ret_value = 0;
+ hid_t * c_field_types = NULL;
+ char ** c_field_names = NULL;
+ char * tmp = NULL, *tmp_p;
+ int_f ret_value = 0;
num_elem = (hsize_t)*nfields;
/*
* convert FORTRAN name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL)
- if(NULL == (c_name1 = (char *)HD5f2cstring(name1, (size_t)*namelen1)))
+ if (NULL == (c_name1 = (char *)HD5f2cstring(name1, (size_t)*namelen1)))
HGOTO_DONE(FAIL)
- if(NULL == (c_field_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
+ if (NULL == (c_field_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
HGOTO_DONE(FAIL)
- if(NULL == (c_field_types = (hid_t *)HDmalloc(sizeof(hid_t) * (size_t)c_nfields)))
+ if (NULL == (c_field_types = (hid_t *)HDmalloc(sizeof(hid_t) * (size_t)c_nfields)))
HGOTO_DONE(FAIL)
- for(i = 0; i < num_elem; i++) {
- c_field_offset[i] = (size_t)field_offset[i];
- c_field_types[i] = field_types[i];
+ for (i = 0; i < num_elem; i++) {
+ c_field_offset[i] = (size_t)field_offset[i];
+ c_field_types[i] = field_types[i];
} /* end for */
/*
* allocate array of character pointers
*/
- if(NULL == (c_field_names = (char **)HDcalloc((size_t)num_elem, sizeof(char *))))
+ if (NULL == (c_field_names = (char **)HDcalloc((size_t)num_elem, sizeof(char *))))
HGOTO_DONE(FAIL)
/* copy data to long C string */
- if(NULL == (tmp = (char *)HD5f2cstring(field_names, (size_t)*(max_char_size_field_names)*(size_t)num_elem)))
+ if (NULL ==
+ (tmp = (char *)HD5f2cstring(field_names, (size_t) * (max_char_size_field_names) * (size_t)num_elem)))
HGOTO_DONE(FAIL)
/*
* move data from temorary buffer
*/
tmp_p = tmp;
- for(i = 0; i < num_elem; i++) {
- if(NULL == (c_field_names[i] = (char *)HDmalloc((size_t)char_len_field_names[i] + 1)))
+ for (i = 0; i < num_elem; i++) {
+ if (NULL == (c_field_names[i] = (char *)HDmalloc((size_t)char_len_field_names[i] + 1)))
HGOTO_DONE(FAIL)
HDmemcpy(c_field_names[i], tmp_p, (size_t)char_len_field_names[i]);
c_field_names[i][char_len_field_names[i]] = '\0';
- tmp_p = tmp_p + *max_char_size_field_names;
+ tmp_p = tmp_p + *max_char_size_field_names;
} /* end for */
/*
* call H5TBmake_table function.
*/
- if(H5TBmake_table(c_name1, (hid_t)*loc_id, c_name, c_nfields, (hsize_t)*nrecords,
- (size_t)*type_size, (const char **)c_field_names, c_field_offset, c_field_types,
- (hsize_t)*chunk_size, fill_data, *compress, data) < 0)
+ if (H5TBmake_table(c_name1, (hid_t)*loc_id, c_name, c_nfields, (hsize_t)*nrecords, (size_t)*type_size,
+ (const char **)c_field_names, c_field_offset, c_field_types, (hsize_t)*chunk_size,
+ fill_data, *compress, data) < 0)
HGOTO_DONE(FAIL)
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
- if(c_name1)
+ if (c_name1)
HDfree(c_name1);
- if(c_field_names) {
- for(i = 0; i < num_elem; i++) {
- if(c_field_names[i])
+ if (c_field_names) {
+ for (i = 0; i < num_elem; i++) {
+ if (c_field_names[i])
HDfree(c_field_names[i]);
} /* end for */
HDfree(c_field_names);
} /* end if */
- if(tmp)
+ if (tmp)
HDfree(tmp);
- if(c_field_offset)
+ if (c_field_offset)
HDfree(c_field_offset);
- if(c_field_types)
+ if (c_field_types)
HDfree(c_field_types);
return ret_value;
} /* end h5tbmake_table_c() */
-
/*-------------------------------------------------------------------------
-* Function: h5tbread_table_c
-*
-* Purpose: Call H5TBread_table using F2003 features
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: M. Scot Breitenfeld
-*
-* Date: Sept. 14, 2015
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5tbread_table_c
+ *
+ * Purpose: Call H5TBread_table using F2003 features
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: M. Scot Breitenfeld
+ *
+ * Date: Sept. 14, 2015
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5tbread_table_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hsize_t_f *nfields,
- size_t_f *dst_size, size_t_f *dst_offset, size_t_f *dst_sizes, void *dst_buf)
+h5tbread_table_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hsize_t_f *nfields, size_t_f *dst_size,
+ size_t_f *dst_offset, size_t_f *dst_sizes, void *dst_buf)
{
- char *c_name = NULL;
+ char * c_name = NULL;
size_t *c_dst_offset = NULL;
- size_t *c_dst_sizes = NULL;
- hsize_t c_nfields = (hsize_t)*nfields;
- int_f ret_value = 0;
+ size_t *c_dst_sizes = NULL;
+ hsize_t c_nfields = (hsize_t)*nfields;
+ int_f ret_value = 0;
hsize_t i;
/*
* convert FORTRAN name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL)
- if(NULL == (c_dst_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
+ if (NULL == (c_dst_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
HGOTO_DONE(FAIL)
- if(NULL == (c_dst_sizes = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
+ if (NULL == (c_dst_sizes = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
HGOTO_DONE(FAIL)
- for(i = 0; i < c_nfields; i++) {
- c_dst_offset[i] = (size_t)dst_offset[i];
- c_dst_sizes[i] = (size_t)dst_sizes[i];
+ for (i = 0; i < c_nfields; i++) {
+ c_dst_offset[i] = (size_t)dst_offset[i];
+ c_dst_sizes[i] = (size_t)dst_sizes[i];
} /* end for */
/*
* call H5TBread_table function.
*/
- if(H5TBread_table( (hid_t)*loc_id, c_name, (size_t)*dst_size, c_dst_offset,
- c_dst_sizes, dst_buf) < 0)
+ if (H5TBread_table((hid_t)*loc_id, c_name, (size_t)*dst_size, c_dst_offset, c_dst_sizes, dst_buf) < 0)
HGOTO_DONE(FAIL)
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
- if(c_dst_offset)
+ if (c_dst_offset)
HDfree(c_dst_offset);
- if(c_dst_sizes)
+ if (c_dst_sizes)
HDfree(c_dst_sizes);
return ret_value;
} /* end h5tbmake_table_c() */
-
-
-
/*-------------------------------------------------------------------------
-* Function: h5tbwrite_field_name_c
-*
-* Purpose: Call H5TBwrite_fields_name
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 12, 2004
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5tbwrite_field_name_c
+ *
+ * Purpose: Call H5TBwrite_fields_name
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 12, 2004
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
h5tbwrite_field_name_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, _fcd field_name,
- hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf)
+ hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf)
{
- char *c_name = NULL;
- char *c_name1 = NULL;
- size_t c_type_size[1] = {(size_t)*type_size};
- int_f ret_value = 0;
+ char * c_name = NULL;
+ char * c_name1 = NULL;
+ size_t c_type_size[1] = {(size_t)*type_size};
+ int_f ret_value = 0;
/*
* convert FORTRAN name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL)
- if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1)))
+ if (NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1)))
HGOTO_DONE(FAIL)
/*
* call H5TBwrite_fields_name function.
*/
- if(H5TBwrite_fields_name((hid_t)*loc_id, c_name, c_name1, (hsize_t)*start,
- (hsize_t)*nrecords, c_type_size[0], 0, c_type_size, buf) < 0)
+ if (H5TBwrite_fields_name((hid_t)*loc_id, c_name, c_name1, (hsize_t)*start, (hsize_t)*nrecords,
+ c_type_size[0], 0, c_type_size, buf) < 0)
HGOTO_DONE(FAIL)
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
- if(c_name1)
+ if (c_name1)
HDfree(c_name1);
return ret_value;
}
-
/*-------------------------------------------------------------------------
-* Function: h5tbread_field_name_c
-*
-* Purpose: Call H5TBread_fields_name
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 12, 2004
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5tbread_field_name_c
+ *
+ * Purpose: Call H5TBread_fields_name
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 12, 2004
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
h5tbread_field_name_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, _fcd field_name,
- hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf)
+ hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf)
{
- char *c_name = NULL;
- char *c_name1 = NULL;
- size_t c_type_size[1] = {(size_t)*type_size};
- int_f ret_value = 0;
+ char * c_name = NULL;
+ char * c_name1 = NULL;
+ size_t c_type_size[1] = {(size_t)*type_size};
+ int_f ret_value = 0;
/*
* convert FORTRAN name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL)
- if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1)))
+ if (NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1)))
HGOTO_DONE(FAIL)
/*
* call H5TBread_fields_name function.
*/
- if(H5TBread_fields_name((hid_t)*loc_id, c_name, c_name1, (hsize_t)*start,
- (hsize_t)*nrecords, c_type_size[0], 0, c_type_size, buf) < 0)
+ if (H5TBread_fields_name((hid_t)*loc_id, c_name, c_name1, (hsize_t)*start, (hsize_t)*nrecords,
+ c_type_size[0], 0, c_type_size, buf) < 0)
HGOTO_DONE(FAIL)
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
- if(c_name1)
+ if (c_name1)
HDfree(c_name1);
return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: h5tbwrite_field_index_c
-*
-* Purpose: Call H5TBwrite_fields_index
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 12, 2004
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5tbwrite_field_index_c
+ *
+ * Purpose: Call H5TBwrite_fields_index
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 12, 2004
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
h5tbwrite_field_index_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *field_index, hsize_t_f *start,
- hsize_t_f *nrecords, size_t_f *type_size, void *buf)
+ hsize_t_f *nrecords, size_t_f *type_size, void *buf)
{
- char *c_name = NULL;
- size_t c_type_size = *type_size;
- int c_field_index = *field_index - 1; /* C zero based index */
- int_f ret_value = 0;
+ char * c_name = NULL;
+ size_t c_type_size = *type_size;
+ int c_field_index = *field_index - 1; /* C zero based index */
+ int_f ret_value = 0;
/*
* convert FORTRAN name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL)
-
/*
* call H5TBwrite_fields_name function.
*/
- if(H5TBwrite_fields_index((hid_t)*loc_id, c_name, (hsize_t)1, &c_field_index,
- (hsize_t)*start, (hsize_t)*nrecords, c_type_size, 0, &c_type_size, buf) < 0)
+ if (H5TBwrite_fields_index((hid_t)*loc_id, c_name, (hsize_t)1, &c_field_index, (hsize_t)*start,
+ (hsize_t)*nrecords, c_type_size, 0, &c_type_size, buf) < 0)
HGOTO_DONE(FAIL)
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: h5tbread_field_index_c
-*
-* Purpose: Call H5TBread_fields_index
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 12, 2004
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5tbread_field_index_c
+ *
+ * Purpose: Call H5TBread_fields_index
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 12, 2004
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
h5tbread_field_index_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *field_index, hsize_t_f *start,
- hsize_t_f *nrecords, size_t_f *type_size, void *buf)
+ hsize_t_f *nrecords, size_t_f *type_size, void *buf)
{
- char *c_name = NULL;
- size_t c_type_size = *type_size;
- int c_field_index = *field_index - 1; /* C zero based index */
- int_f ret_value = 0;
+ char * c_name = NULL;
+ size_t c_type_size = *type_size;
+ int c_field_index = *field_index - 1; /* C zero based index */
+ int_f ret_value = 0;
/*
* convert FORTRAN name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL)
/*
* call H5TBread_fields_index function.
*/
- if(H5TBread_fields_index((hid_t)*loc_id, c_name,(hsize_t)1, &c_field_index,
- (hsize_t)*start, (hsize_t)*nrecords, c_type_size, 0, &c_type_size, buf) < 0)
+ if (H5TBread_fields_index((hid_t)*loc_id, c_name, (hsize_t)1, &c_field_index, (hsize_t)*start,
+ (hsize_t)*nrecords, c_type_size, 0, &c_type_size, buf) < 0)
HGOTO_DONE(FAIL)
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: h5tbinsert_field_c
-*
-* Purpose: Call H5TBinsert_field
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 13, 2004
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5tbinsert_field_c
+ *
+ * Purpose: Call H5TBinsert_field
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 13, 2004
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5tbinsert_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1,
- _fcd field_name, hid_t_f *field_type, int_f *position, void *buf)
+h5tbinsert_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, _fcd field_name,
+ hid_t_f *field_type, int_f *position, void *buf)
{
- char *c_name = NULL;
- char *c_name1 = NULL;
- int_f ret_value = 0;
+ char *c_name = NULL;
+ char *c_name1 = NULL;
+ int_f ret_value = 0;
/*
* convert FORTRAN name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL)
- if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1)))
+ if (NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1)))
HGOTO_DONE(FAIL)
/*
* call H5TBinsert_field function.
*/
- if(H5TBinsert_field((hid_t)*loc_id, c_name, c_name1, (hid_t)*field_type,
- (hsize_t)*position, NULL, buf) < 0)
+ if (H5TBinsert_field((hid_t)*loc_id, c_name, c_name1, (hid_t)*field_type, (hsize_t)*position, NULL, buf) <
+ 0)
HGOTO_DONE(FAIL)
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
- if(c_name1)
+ if (c_name1)
HDfree(c_name1);
return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: h5tbdelete_field_c
-*
-* Purpose: Call H5TBdelete_field
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 13, 2004
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5tbdelete_field_c
+ *
+ * Purpose: Call H5TBdelete_field
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 13, 2004
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5tbdelete_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name,
- size_t_f *namelen1, _fcd field_name)
+h5tbdelete_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, _fcd field_name)
{
- char *c_name = NULL;
- char *c_name1 = NULL;
- int_f ret_value = 0;
+ char *c_name = NULL;
+ char *c_name1 = NULL;
+ int_f ret_value = 0;
/*
* convert FORTRAN name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL)
- if(NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1)))
+ if (NULL == (c_name1 = (char *)HD5f2cstring(field_name, (size_t)*namelen1)))
HGOTO_DONE(FAIL)
/*
* call H5TBinsert_field function.
*/
- if(H5TBdelete_field((hid_t)*loc_id, c_name, c_name1) < 0)
+ if (H5TBdelete_field((hid_t)*loc_id, c_name, c_name1) < 0)
HGOTO_DONE(FAIL)
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
- if(c_name1)
+ if (c_name1)
HDfree(c_name1);
return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: h5tbget_table_info_c
-*
-* Purpose: Call H5TBread_fields_index
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 12, 2004
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5tbget_table_info_c
+ *
+ * Purpose: Call H5TBread_fields_index
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 12, 2004
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5tbget_table_info_c(hid_t_f *loc_id, size_t_f *namelen,
- _fcd name, hsize_t_f *nfields, hsize_t_f *nrecords)
+h5tbget_table_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *nfields, hsize_t_f *nrecords)
{
- char *c_name = NULL;
+ char * c_name = NULL;
hsize_t c_nfields;
hsize_t c_nrecords;
int_f ret_value = 0;
@@ -600,62 +591,61 @@ h5tbget_table_info_c(hid_t_f *loc_id, size_t_f *namelen,
/*
* convert FORTRAN name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL)
-
/*
* call H5TBread_fields_index function.
*/
- if(H5TBget_table_info((hid_t)*loc_id, c_name, &c_nfields, &c_nrecords) < 0)
+ if (H5TBget_table_info((hid_t)*loc_id, c_name, &c_nfields, &c_nrecords) < 0)
HGOTO_DONE(FAIL)
- *nfields = (hsize_t_f) c_nfields;
- *nrecords = (hsize_t_f) c_nrecords;
+ *nfields = (hsize_t_f)c_nfields;
+ *nrecords = (hsize_t_f)c_nrecords;
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: h5tbget_field_info_c
-*
-* Purpose: Call H5TBget_field_info
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 13, 2004
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: h5tbget_field_info_c
+ *
+ * Purpose: Call H5TBget_field_info
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 13, 2004
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
int_f
-h5tbget_field_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *nfields,
- size_t_f *field_sizes, size_t_f *field_offsets, size_t_f *type_size,
- size_t_f *namelen2, /* field_names lengths */
- size_t_f *lenmax, /* character len max */
- _fcd field_names, /* field_names */
- size_t_f *maxlen_out)
+h5tbget_field_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *nfields, size_t_f *field_sizes,
+ size_t_f *field_offsets, size_t_f *type_size,
+ size_t_f *namelen2, /* field_names lengths */
+ size_t_f *lenmax, /* character len max */
+ _fcd field_names, /* field_names */
+ size_t_f *maxlen_out)
{
- char *c_name = NULL;
+ char * c_name = NULL;
hsize_t num_elem;
- hsize_t c_nfields = *nfields;
- size_t *c_field_sizes = NULL;
+ hsize_t c_nfields = *nfields;
+ size_t *c_field_sizes = NULL;
size_t *c_field_offsets = NULL;
size_t c_type_size;
- char **c_field_names = NULL;
- char *tmp = NULL, *tmp_p;
+ char ** c_field_names = NULL;
+ char * tmp = NULL, *tmp_p;
hsize_t i;
int_f ret_value = 0;
- size_t c_lenmax;
- size_t length = 0;
+ size_t c_lenmax;
+ size_t length = 0;
c_lenmax = (size_t)*lenmax;
@@ -664,47 +654,47 @@ h5tbget_field_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *n
/*
* convert FORTRAN name to C name
*/
- if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL)
- if(NULL == (c_field_offsets = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
+ if (NULL == (c_field_offsets = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
HGOTO_DONE(FAIL)
- if(NULL == (c_field_sizes = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
+ if (NULL == (c_field_sizes = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
HGOTO_DONE(FAIL)
- if(NULL == (c_field_names = (char **)HDcalloc((size_t)c_nfields, sizeof(char *))))
+ if (NULL == (c_field_names = (char **)HDcalloc((size_t)c_nfields, sizeof(char *))))
HGOTO_DONE(FAIL)
- for(i = 0; i < c_nfields; i++)
- if(NULL == (c_field_names[i] = (char *)HDmalloc(sizeof(char) * HLTB_MAX_FIELD_LEN)))
+ for (i = 0; i < c_nfields; i++)
+ if (NULL == (c_field_names[i] = (char *)HDmalloc(sizeof(char) * HLTB_MAX_FIELD_LEN)))
HGOTO_DONE(FAIL)
/*
* call H5TBget_field_info function.
*/
- if(H5TBget_field_info((hid_t)*loc_id, c_name, c_field_names, c_field_sizes,
- c_field_offsets, &c_type_size) < 0)
+ if (H5TBget_field_info((hid_t)*loc_id, c_name, c_field_names, c_field_sizes, c_field_offsets,
+ &c_type_size) < 0)
HGOTO_DONE(FAIL)
/* return values */
/* names array */
- if(NULL == (tmp = (char *)HDmalloc((c_lenmax * (size_t)c_nfields) + 1)))
+ if (NULL == (tmp = (char *)HDmalloc((c_lenmax * (size_t)c_nfields) + 1)))
HGOTO_DONE(FAIL)
tmp_p = tmp;
HDmemset(tmp, ' ', c_lenmax * (size_t)c_nfields);
tmp[c_lenmax * c_nfields] = '\0';
- for(i = 0; i < c_nfields; i++) {
- size_t field_name_len = HDstrlen(c_field_names[i]);
+ for (i = 0; i < c_nfields; i++) {
+ size_t field_name_len = HDstrlen(c_field_names[i]);
- HDmemcpy(tmp_p, c_field_names[i], field_name_len);
- namelen2[i] = (size_t_f)field_name_len;
- length = MAX(length, strlen((c_field_names[i])));
- tmp_p = tmp_p + c_lenmax;
+ HDmemcpy(tmp_p, c_field_names[i], field_name_len);
+ namelen2[i] = (size_t_f)field_name_len;
+ length = MAX(length, strlen((c_field_names[i])));
+ tmp_p = tmp_p + c_lenmax;
} /* end for */
- HD5packFstring(tmp, _fcdtocp(field_names), (size_t)( c_lenmax* c_nfields));
+ HD5packFstring(tmp, _fcdtocp(field_names), (size_t)(c_lenmax * c_nfields));
*type_size = (size_t_f)c_type_size;
- for(i = 0; i < num_elem; i++) {
+ for (i = 0; i < num_elem; i++) {
field_sizes[i] = (size_t_f)c_field_sizes[i];
field_offsets[i] = (size_t_f)c_field_offsets[i];
} /* end for */
@@ -712,21 +702,20 @@ h5tbget_field_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *n
*maxlen_out = (size_t_f)length;
done:
- if(c_name)
+ if (c_name)
HDfree(c_name);
- if(c_field_names) {
- for(i = 0; i < num_elem; i++)
- if(c_field_names[i])
+ if (c_field_names) {
+ for (i = 0; i < num_elem; i++)
+ if (c_field_names[i])
HDfree(c_field_names[i]);
HDfree(c_field_names);
} /* end if */
- if(tmp)
+ if (tmp)
HDfree(tmp);
- if(c_field_offsets)
+ if (c_field_offsets)
HDfree(c_field_offsets);
- if(c_field_sizes)
+ if (c_field_sizes)
HDfree(c_field_sizes);
return ret_value;
}
-
diff --git a/hl/src/H5DO.c b/hl/src/H5DO.c
index 66997cb..5b617cc 100644
--- a/hl/src/H5DO.c
+++ b/hl/src/H5DO.c
@@ -1,15 +1,15 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* High-level library internal header file */
#include "H5HLprivate2.h"
@@ -18,7 +18,7 @@
#include "H5DOpublic.h"
#ifndef H5_NO_DEPRECATED_SYMBOLS
-
+
/*-------------------------------------------------------------------------
* Function: H5DOwrite_chunk
*
@@ -33,8 +33,8 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset,
- size_t data_size, const void *buf)
+H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, size_t data_size,
+ const void *buf)
{
/* Call underlying H5D function */
if (H5Dwrite_chunk(dset_id, dxpl_id, filters, offset, data_size, buf) < 0)
@@ -44,7 +44,6 @@ H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *o
} /* end H5DOwrite_chunk() */
-
/*-------------------------------------------------------------------------
* Function: H5DOread_chunk
*
@@ -59,19 +58,17 @@ H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *o
*---------------------------------------------------------------------------
*/
herr_t
-H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters,
- void *buf)
+H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, void *buf)
{
/* Call underlying H5D function */
if (H5Dread_chunk(dset_id, dxpl_id, offset, filters, buf) < 0)
return FAIL;
else
return SUCCEED;
- } /* end H5DOread_chunk() */
+} /* end H5DOread_chunk() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/*-------------------------------------------------------------------------
* Function: H5DOappend()
*
@@ -103,57 +100,56 @@ H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fi
*-------------------------------------------------------------------------
*/
herr_t
-H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension,
- hid_t memtype, const void *buf)
+H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension, hid_t memtype, const void *buf)
{
- hsize_t size[H5S_MAX_RANK]; /* The new size (after extension */
- hsize_t old_size = 0; /* The size of the dimension to be extended */
- int sndims; /* Number of dimensions in dataspace (signed) */
- unsigned ndims; /* Number of dimensions in dataspace */
- hid_t space_id = FAIL; /* Old file space */
- hid_t new_space_id = FAIL; /* New file space (after extension) */
- hid_t mem_space_id = FAIL; /* Memory space for data buffer */
- hssize_t snelmts; /* Number of elements in selection (signed) */
- hsize_t nelmts; /* Number of elements in selection */
- hid_t dapl = FAIL; /* Dataset access property list */
-
- hsize_t start[H5S_MAX_RANK]; /* H5Sselect_Hyperslab: starting offset */
- hsize_t count[H5S_MAX_RANK]; /* H5Sselect_hyperslab: # of blocks to select */
- hsize_t stride[H5S_MAX_RANK]; /* H5Sselect_hyperslab: # of elements to move when selecting */
- hsize_t block[H5S_MAX_RANK]; /* H5Sselect_hyperslab: # of elements in a block */
-
- hsize_t *boundary = NULL; /* Boundary set in append flush property */
- H5D_append_cb_t append_cb; /* Callback function set in append flush property */
- void *udata; /* User data set in append flush property */
- hbool_t hit = FALSE; /* Boundary is hit or not */
- hsize_t k; /* Local index variable */
- unsigned u; /* Local index variable */
- herr_t ret_value = FAIL; /* Return value */
+ hsize_t size[H5S_MAX_RANK]; /* The new size (after extension */
+ hsize_t old_size = 0; /* The size of the dimension to be extended */
+ int sndims; /* Number of dimensions in dataspace (signed) */
+ unsigned ndims; /* Number of dimensions in dataspace */
+ hid_t space_id = FAIL; /* Old file space */
+ hid_t new_space_id = FAIL; /* New file space (after extension) */
+ hid_t mem_space_id = FAIL; /* Memory space for data buffer */
+ hssize_t snelmts; /* Number of elements in selection (signed) */
+ hsize_t nelmts; /* Number of elements in selection */
+ hid_t dapl = FAIL; /* Dataset access property list */
+
+ hsize_t start[H5S_MAX_RANK]; /* H5Sselect_Hyperslab: starting offset */
+ hsize_t count[H5S_MAX_RANK]; /* H5Sselect_hyperslab: # of blocks to select */
+ hsize_t stride[H5S_MAX_RANK]; /* H5Sselect_hyperslab: # of elements to move when selecting */
+ hsize_t block[H5S_MAX_RANK]; /* H5Sselect_hyperslab: # of elements in a block */
+
+ hsize_t * boundary = NULL; /* Boundary set in append flush property */
+ H5D_append_cb_t append_cb; /* Callback function set in append flush property */
+ void * udata; /* User data set in append flush property */
+ hbool_t hit = FALSE; /* Boundary is hit or not */
+ hsize_t k; /* Local index variable */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = FAIL; /* Return value */
/* check arguments */
- if(H5I_DATASET != H5Iget_type(dset_id))
+ if (H5I_DATASET != H5Iget_type(dset_id))
goto done;
/* If the user passed in a default DXPL, sanity check it */
- if(H5P_DEFAULT != dxpl_id)
- if(TRUE != H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
+ if (H5P_DEFAULT != dxpl_id)
+ if (TRUE != H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
goto done;
/* Get the dataspace of the dataset */
- if(FAIL == (space_id = H5Dget_space(dset_id)))
+ if (FAIL == (space_id = H5Dget_space(dset_id)))
goto done;
/* Get the rank of this dataspace */
- if((sndims = H5Sget_simple_extent_ndims(space_id)) < 0)
+ if ((sndims = H5Sget_simple_extent_ndims(space_id)) < 0)
goto done;
ndims = (unsigned)sndims;
/* Verify correct axis */
- if(axis >= ndims)
+ if (axis >= ndims)
goto done;
/* Get the dimensions sizes of the dataspace */
- if(H5Sget_simple_extent_dims(space_id, size, NULL) < 0)
+ if (H5Sget_simple_extent_dims(space_id, size, NULL) < 0)
goto done;
/* Adjust the dimension size of the requested dimension,
@@ -161,99 +157,98 @@ H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension,
*/
old_size = size[axis];
size[axis] += extension;
- if(size[axis] < old_size)
+ if (size[axis] < old_size)
goto done;
/* Set the extent of the dataset to the new dimension */
- if(H5Dset_extent(dset_id, size) < 0)
+ if (H5Dset_extent(dset_id, size) < 0)
goto done;
/* Get the new dataspace of the dataset */
- if(FAIL == (new_space_id = H5Dget_space(dset_id)))
+ if (FAIL == (new_space_id = H5Dget_space(dset_id)))
goto done;
/* Select a hyperslab corresponding to the append operation */
- for(u = 0 ; u < ndims ; u++) {
- start[u] = 0;
+ for (u = 0; u < ndims; u++) {
+ start[u] = 0;
stride[u] = 1;
- count[u] = size[u];
- block[u] = 1;
- if(u == axis) {
+ count[u] = size[u];
+ block[u] = 1;
+ if (u == axis) {
count[u] = extension;
start[u] = old_size;
} /* end if */
- } /* end for */
- if(FAIL == H5Sselect_hyperslab(new_space_id, H5S_SELECT_SET, start, stride, count, block))
+ } /* end for */
+ if (FAIL == H5Sselect_hyperslab(new_space_id, H5S_SELECT_SET, start, stride, count, block))
goto done;
/* The # of elemnts in the new extended dataspace */
- if((snelmts = H5Sget_select_npoints(new_space_id)) < 0)
+ if ((snelmts = H5Sget_select_npoints(new_space_id)) < 0)
goto done;
nelmts = (hsize_t)snelmts;
/* create a memory space */
- if(FAIL == (mem_space_id = H5Screate_simple(1, &nelmts, NULL)))
+ if (FAIL == (mem_space_id = H5Screate_simple(1, &nelmts, NULL)))
goto done;
/* Write the data */
- if(H5Dwrite(dset_id, memtype, mem_space_id, new_space_id, dxpl_id, buf) < 0)
+ if (H5Dwrite(dset_id, memtype, mem_space_id, new_space_id, dxpl_id, buf) < 0)
goto done;
/* Obtain the dataset's access property list */
- if((dapl = H5Dget_access_plist(dset_id)) < 0)
+ if ((dapl = H5Dget_access_plist(dset_id)) < 0)
goto done;
/* Allocate the boundary array */
boundary = (hsize_t *)HDmalloc(ndims * sizeof(hsize_t));
/* Retrieve the append flush property */
- if(H5Pget_append_flush(dapl, ndims, boundary, &append_cb, &udata) < 0)
+ if (H5Pget_append_flush(dapl, ndims, boundary, &append_cb, &udata) < 0)
goto done;
/* No boundary for this axis */
- if(boundary[axis] != 0) {
+ if (boundary[axis] != 0) {
/* Determine whether a boundary is hit or not */
- for(k = start[axis]; k < size[axis]; k++)
- if(!((k + 1) % boundary[axis])) {
+ for (k = start[axis]; k < size[axis]; k++)
+ if (!((k + 1) % boundary[axis])) {
hit = TRUE;
break;
}
- if(hit) { /* Hit the boundary */
+ if (hit) { /* Hit the boundary */
/* Invoke callback if there is one */
- if(append_cb && append_cb(dset_id, size, udata) < 0)
+ if (append_cb && append_cb(dset_id, size, udata) < 0)
goto done;
- /* Do a dataset flush */
- if(H5Dflush(dset_id) < 0)
+ /* Do a dataset flush */
+ if (H5Dflush(dset_id) < 0)
goto done;
} /* end if */
- } /* end if */
+ } /* end if */
/* Indicate success */
ret_value = SUCCEED;
done:
/* Close old dataspace */
- if(space_id != FAIL && H5Sclose(space_id) < 0)
+ if (space_id != FAIL && H5Sclose(space_id) < 0)
ret_value = FAIL;
/* Close new dataspace */
- if(new_space_id != FAIL && H5Sclose(new_space_id) < 0)
+ if (new_space_id != FAIL && H5Sclose(new_space_id) < 0)
ret_value = FAIL;
/* Close memory dataspace */
- if(mem_space_id != FAIL && H5Sclose(mem_space_id) < 0)
+ if (mem_space_id != FAIL && H5Sclose(mem_space_id) < 0)
ret_value = FAIL;
/* Close the dataset access property list */
- if(dapl != FAIL && H5Pclose(dapl) < 0)
+ if (dapl != FAIL && H5Pclose(dapl) < 0)
ret_value = FAIL;
- if(boundary)
+ if (boundary)
HDfree(boundary);
return ret_value;
} /* H5DOappend() */
-
diff --git a/hl/src/H5DOpublic.h b/hl/src/H5DOpublic.h
index e09ebca..214f1e5 100644
--- a/hl/src/H5DOpublic.h
+++ b/hl/src/H5DOpublic.h
@@ -25,8 +25,8 @@ extern "C" {
*-------------------------------------------------------------------------
*/
-H5_HLDLL herr_t H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis,
- size_t extension, hid_t memtype, const void *buf);
+H5_HLDLL herr_t H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension, hid_t memtype,
+ const void *buf);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -35,10 +35,10 @@ H5_HLDLL herr_t H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis,
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Compatibility wrappers for functionality moved to H5D */
-H5_HLDLL herr_t H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters,
- const hsize_t *offset, size_t data_size, const void *buf);
-H5_HLDLL herr_t H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset,
- uint32_t *filters /*out*/, void *buf /*out*/);
+H5_HLDLL herr_t H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset,
+ size_t data_size, const void *buf);
+H5_HLDLL herr_t H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters /*out*/,
+ void *buf /*out*/);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -47,4 +47,3 @@ H5_HLDLL herr_t H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offs
#endif
#endif
-
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c
index 9847cae..7cd36b9 100644
--- a/hl/src/H5DS.c
+++ b/hl/src/H5DS.c
@@ -1,25 +1,24 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "H5DSprivate.h"
#include "H5LTprivate.h"
#include "H5IMprivate.h"
#include "H5TBprivate.h"
-
/* Local routines */
static herr_t H5DS_is_reserved(hid_t did);
-static hid_t H5DS_get_REFLIST_type(void);
+static hid_t H5DS_get_REFLIST_type(void);
/*-------------------------------------------------------------------------
* Function: H5DSset_scale
@@ -41,51 +40,48 @@ static hid_t H5DS_get_REFLIST_type(void);
herr_t
H5DSset_scale(hid_t dsid, const char *dimname)
{
- int has_dimlist;
+ int has_dimlist;
H5I_type_t it;
/*-------------------------------------------------------------------------
- * parameter checking
- *-------------------------------------------------------------------------
- */
+ * parameter checking
+ *-------------------------------------------------------------------------
+ */
/* get ID type */
if ((it = H5Iget_type(dsid)) < 0)
return FAIL;
- if (H5I_DATASET!=it)
+ if (H5I_DATASET != it)
return FAIL;
/*-------------------------------------------------------------------------
- * check if the dataset is a dataset wich has references to dimension scales
- *-------------------------------------------------------------------------
- */
+ * check if the dataset is a dataset wich has references to dimension scales
+ *-------------------------------------------------------------------------
+ */
/* try to find the attribute "DIMENSION_LIST" */
- if ((has_dimlist = H5LT_find_attribute(dsid,DIMENSION_LIST)) < 0)
+ if ((has_dimlist = H5LT_find_attribute(dsid, DIMENSION_LIST)) < 0)
return FAIL;
if (has_dimlist == 1)
return FAIL;
/*-------------------------------------------------------------------------
- * write the standard attributes for a Dimension Scale dataset
- *-------------------------------------------------------------------------
- */
+ * write the standard attributes for a Dimension Scale dataset
+ *-------------------------------------------------------------------------
+ */
- if (H5LT_set_attribute_string(dsid,"CLASS",DIMENSION_SCALE_CLASS) < 0)
+ if (H5LT_set_attribute_string(dsid, "CLASS", DIMENSION_SCALE_CLASS) < 0)
return FAIL;
- if (dimname!=NULL)
- {
- if (H5LT_set_attribute_string(dsid,"NAME",dimname) < 0)
+ if (dimname != NULL) {
+ if (H5LT_set_attribute_string(dsid, "NAME", dimname) < 0)
return FAIL;
}
return SUCCEED;
}
-
-
/*-------------------------------------------------------------------------
* Function: H5DSattach_scale
*
@@ -110,33 +106,33 @@ H5DSset_scale(hid_t dsid, const char *dimname)
herr_t
H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx)
{
- int has_dimlist;
- int has_reflist;
- int is_ds;
- hssize_t nelmts;
- hid_t sid; /* space ID */
- hid_t tid = -1; /* attribute type ID */
- hid_t ntid = -1; /* attribute native type ID */
- hid_t aid = -1; /* attribute ID */
- int rank; /* rank of dataset */
- hsize_t dims[1]; /* dimension of the "REFERENCE_LIST" array */
- ds_list_t dsl; /* attribute data in the DS pointing to the dataset */
- ds_list_t *dsbuf = NULL; /* array of attribute data in the DS pointing to the dataset */
- hobj_ref_t ref_to_ds; /* reference to the DS */
- hobj_ref_t ref_j; /* iterator reference */
- hvl_t *buf = NULL; /* VL buffer to store in the attribute */
- hid_t dsid_j; /* DS dataset ID in DIMENSION_LIST */
+ int has_dimlist;
+ int has_reflist;
+ int is_ds;
+ hssize_t nelmts;
+ hid_t sid; /* space ID */
+ hid_t tid = -1; /* attribute type ID */
+ hid_t ntid = -1; /* attribute native type ID */
+ hid_t aid = -1; /* attribute ID */
+ int rank; /* rank of dataset */
+ hsize_t dims[1]; /* dimension of the "REFERENCE_LIST" array */
+ ds_list_t dsl; /* attribute data in the DS pointing to the dataset */
+ ds_list_t * dsbuf = NULL; /* array of attribute data in the DS pointing to the dataset */
+ hobj_ref_t ref_to_ds; /* reference to the DS */
+ hobj_ref_t ref_j; /* iterator reference */
+ hvl_t * buf = NULL; /* VL buffer to store in the attribute */
+ hid_t dsid_j; /* DS dataset ID in DIMENSION_LIST */
H5O_info2_t oi1, oi2;
- H5I_type_t it1, it2;
- int i;
- size_t len;
- int found_ds=0;
- htri_t is_scale;
+ H5I_type_t it1, it2;
+ int i;
+ size_t len;
+ int found_ds = 0;
+ htri_t is_scale;
/*-------------------------------------------------------------------------
- * parameter checking
- *-------------------------------------------------------------------------
- */
+ * parameter checking
+ *-------------------------------------------------------------------------
+ */
if ((is_scale = H5DSis_scale(did)) < 0)
return FAIL;
@@ -146,20 +142,20 @@ H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx)
return FAIL;
/* get info for the dataset in the parameter list */
- if(H5Oget_info3(did, &oi1, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did, &oi1, H5O_INFO_BASIC) < 0)
return FAIL;
/* get info for the scale in the parameter list */
- if(H5Oget_info3(dsid, &oi2, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(dsid, &oi2, H5O_INFO_BASIC) < 0)
return FAIL;
/* same object, not valid */
- if(oi1.fileno == oi2.fileno) {
+ if (oi1.fileno == oi2.fileno) {
int token_cmp;
- if(H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0)
+ if (H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0)
return FAIL;
- if(!token_cmp)
+ if (!token_cmp)
return FAIL;
} /* end if */
@@ -173,21 +169,20 @@ H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx)
return FAIL;
/* the DS dataset cannot have dimension scales */
- if (H5LT_find_attribute(dsid,DIMENSION_LIST)==1)
+ if (H5LT_find_attribute(dsid, DIMENSION_LIST) == 1)
return FAIL;
/* check if the dataset is a "reserved" dataset (image, table) */
- if (H5DS_is_reserved(did)==1)
+ if (H5DS_is_reserved(did) == 1)
return FAIL;
-
/*-------------------------------------------------------------------------
- * The dataset may or may not have the associated DS attribute
- * First we try to open to see if it is already there; if not, it is created.
- * If it exists, the array of references is extended to hold the reference
- * to the new DS
- *-------------------------------------------------------------------------
- */
+ * The dataset may or may not have the associated DS attribute
+ * First we try to open to see if it is already there; if not, it is created.
+ * If it exists, the array of references is extended to hold the reference
+ * to the new DS
+ *-------------------------------------------------------------------------
+ */
/* get dataset space */
if ((sid = H5Dget_space(did)) < 0)
@@ -206,14 +201,14 @@ H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx)
return FAIL;
/* parameter range checking */
- if (idx > (unsigned)rank-1)
+ if (idx > (unsigned)rank - 1)
return FAIL;
/*-------------------------------------------------------------------------
- * two references are created: one to the DS, saved in "DIMENSION_LIST"
- * and one to the dataset, saved in "REFERENCE_LIST"
- *-------------------------------------------------------------------------
- */
+ * two references are created: one to the DS, saved in "DIMENSION_LIST"
+ * and one to the dataset, saved in "REFERENCE_LIST"
+ *-------------------------------------------------------------------------
+ */
/* create a reference for the >>DS<< dataset */
if (H5Rcreate(&ref_to_ds, dsid, ".", H5R_OBJECT, (hid_t)-1) < 0)
return FAIL;
@@ -223,57 +218,56 @@ H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx)
return FAIL;
/* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */
- if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST)) < 0)
+ if ((has_dimlist = H5LT_find_attribute(did, DIMENSION_LIST)) < 0)
return FAIL;
/*-------------------------------------------------------------------------
- * it does not exist. we create the attribute and its reference data
- *-------------------------------------------------------------------------
- */
- if (has_dimlist == 0)
- {
+ * it does not exist. we create the attribute and its reference data
+ *-------------------------------------------------------------------------
+ */
+ if (has_dimlist == 0) {
dims[0] = (hsize_t)rank;
/* space for the attribute */
- if((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
return FAIL;
/* create the type for the attribute "DIMENSION_LIST" */
- if((tid = H5Tvlen_create(H5T_STD_REF_OBJ)) < 0)
+ if ((tid = H5Tvlen_create(H5T_STD_REF_OBJ)) < 0)
goto out;
/* create the attribute */
- if((aid = H5Acreate2(did, DIMENSION_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(did, DIMENSION_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* allocate and initialize the VL */
buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t));
- if(buf == NULL)
+ if (buf == NULL)
goto out;
- for(i = 0; i < rank; i++) {
+ for (i = 0; i < rank; i++) {
buf[i].len = 0;
- buf[i].p = NULL;
+ buf[i].p = NULL;
}
/* store the REF information in the index of the dataset that has the DS */
- buf[idx].len = 1;
- buf[idx].p = HDmalloc( 1 * sizeof(hobj_ref_t));
+ buf[idx].len = 1;
+ buf[idx].p = HDmalloc(1 * sizeof(hobj_ref_t));
((hobj_ref_t *)buf[idx].p)[0] = ref_to_ds;
/* write the attribute with the reference */
- if(H5Awrite(aid, tid, buf) < 0)
+ if (H5Awrite(aid, tid, buf) < 0)
goto out;
/* close */
- if(H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0)
+ if (H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0)
goto out;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
HDfree(buf);
@@ -281,218 +275,217 @@ H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx)
}
/*-------------------------------------------------------------------------
- * the attribute already exists, open it, extend the buffer,
- * and insert the new reference
- *-------------------------------------------------------------------------
- */
- else if(has_dimlist == 1)
- {
- if((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0)
+ * the attribute already exists, open it, extend the buffer,
+ * and insert the new reference
+ *-------------------------------------------------------------------------
+ */
+ else if (has_dimlist == 1) {
+ if ((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0)
goto out;
- if((tid = H5Aget_type(aid)) < 0)
+ if ((tid = H5Aget_type(aid)) < 0)
goto out;
- if((sid = H5Aget_space(aid)) < 0)
+ if ((sid = H5Aget_space(aid)) < 0)
goto out;
/* allocate and initialize the VL */
buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t));
- if(buf == NULL)
+ if (buf == NULL)
goto out;
/* read */
- if(H5Aread(aid, tid, buf) < 0)
+ if (H5Aread(aid, tid, buf) < 0)
goto out;
/* check to avoid inserting duplicates. it is not FAIL, just do nothing */
/* iterate all the REFs in this dimension IDX */
- for(i = 0; i < (int)buf[idx].len; i++) {
+ for (i = 0; i < (int)buf[idx].len; i++) {
/* get the reference */
ref_j = ((hobj_ref_t *)buf[idx].p)[i];
/* get the scale id for this REF */
- if((dsid_j = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &ref_j)) < 0)
+ if ((dsid_j = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &ref_j)) < 0)
goto out;
/* get info for DS in the parameter list */
- if(H5Oget_info3(dsid, &oi1, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(dsid, &oi1, H5O_INFO_BASIC) < 0)
goto out;
/* get info for this DS */
- if(H5Oget_info3(dsid_j, &oi2, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(dsid_j, &oi2, H5O_INFO_BASIC) < 0)
goto out;
/* same object, so this DS scale is already in this DIM IDX */
- if(oi1.fileno == oi2.fileno) {
+ if (oi1.fileno == oi2.fileno) {
int token_cmp;
- if(H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0)
+ if (H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0)
goto out;
- if(!token_cmp)
+ if (!token_cmp)
found_ds = 1;
} /* end if */
/* close the dereferenced dataset */
- if(H5Dclose(dsid_j) < 0)
+ if (H5Dclose(dsid_j) < 0)
goto out;
} /* end for */
- if(found_ds == 0) {
+ if (found_ds == 0) {
/* we are adding one more DS to this dimension */
- if(buf[idx].len > 0) {
+ if (buf[idx].len > 0) {
buf[idx].len++;
- len = buf[idx].len;
- buf[idx].p = HDrealloc(buf[idx].p, len * sizeof(hobj_ref_t));
+ len = buf[idx].len;
+ buf[idx].p = HDrealloc(buf[idx].p, len * sizeof(hobj_ref_t));
((hobj_ref_t *)buf[idx].p)[len - 1] = ref_to_ds;
} /* end if */
else {
/* store the REF information in the index of the dataset that has the DS */
- buf[idx].len = 1;
- buf[idx].p = HDmalloc(sizeof(hobj_ref_t));
+ buf[idx].len = 1;
+ buf[idx].p = HDmalloc(sizeof(hobj_ref_t));
((hobj_ref_t *)buf[idx].p)[0] = ref_to_ds;
} /* end else */
- } /* end if */
+ } /* end if */
/* write the attribute with the new references */
- if(H5Awrite(aid, tid, buf) < 0)
+ if (H5Awrite(aid, tid, buf) < 0)
goto out;
/* close */
- if(H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0)
+ if (H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0)
goto out;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
HDfree(buf);
buf = NULL;
} /* has_dimlist */
/*-------------------------------------------------------------------------
- * save DS info on the >>DS<< dataset
- *-------------------------------------------------------------------------
- */
+ * save DS info on the >>DS<< dataset
+ *-------------------------------------------------------------------------
+ */
/* try to find the attribute "REFERENCE_LIST" on the >>DS<< dataset */
- if((has_reflist = H5LT_find_attribute(dsid, REFERENCE_LIST)) < 0)
+ if ((has_reflist = H5LT_find_attribute(dsid, REFERENCE_LIST)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * it does not exist. we create the attribute and its reference data
- *-------------------------------------------------------------------------
- */
- if(has_reflist == 0) {
+ * it does not exist. we create the attribute and its reference data
+ *-------------------------------------------------------------------------
+ */
+ if (has_reflist == 0) {
dims[0] = 1;
/* space for the attribute */
- if((sid = H5Screate_simple(1,dims,NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
/* create the compound datatype for the attribute "REFERENCE_LIST" */
- if((tid = H5Tcreate(H5T_COMPOUND, sizeof(ds_list_t))) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(ds_list_t))) < 0)
goto out;
/* insert reference field */
- if(H5Tinsert(tid, "dataset", HOFFSET(ds_list_t,ref), H5T_STD_REF_OBJ) < 0)
+ if (H5Tinsert(tid, "dataset", HOFFSET(ds_list_t, ref), H5T_STD_REF_OBJ) < 0)
goto out;
/* insert dimension idx of the dataset field */
- if(H5Tinsert(tid, "dimension", HOFFSET(ds_list_t, dim_idx), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(tid, "dimension", HOFFSET(ds_list_t, dim_idx), H5T_NATIVE_INT) < 0)
goto out;
/* create the attribute */
- if((aid = H5Acreate2(dsid, REFERENCE_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(dsid, REFERENCE_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* store the IDX information */
dsl.dim_idx = idx;
/* write the attribute with the reference */
- if(H5Awrite(aid, tid, &dsl) < 0)
+ if (H5Awrite(aid, tid, &dsl) < 0)
goto out;
/* close */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
} /* end if */
/*-------------------------------------------------------------------------
- * the "REFERENCE_LIST" array already exists, open it and extend it
- *-------------------------------------------------------------------------
- */
- else if(has_reflist == 1) {
- if((aid = H5Aopen(dsid, REFERENCE_LIST, H5P_DEFAULT)) < 0)
+ * the "REFERENCE_LIST" array already exists, open it and extend it
+ *-------------------------------------------------------------------------
+ */
+ else if (has_reflist == 1) {
+ if ((aid = H5Aopen(dsid, REFERENCE_LIST, H5P_DEFAULT)) < 0)
goto out;
- if((tid = H5Aget_type(aid)) < 0)
+ if ((tid = H5Aget_type(aid)) < 0)
goto out;
/* get native type to read attribute REFERENCE_LIST */
- if((ntid = H5DS_get_REFLIST_type()) < 0)
+ if ((ntid = H5DS_get_REFLIST_type()) < 0)
goto out;
/* get and save the old reference(s) */
- if((sid = H5Aget_space(aid)) < 0)
+ if ((sid = H5Aget_space(aid)) < 0)
goto out;
- if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0)
+ if ((nelmts = H5Sget_simple_extent_npoints(sid)) < 0)
goto out;
nelmts++;
- dsbuf = (ds_list_t*) HDmalloc((size_t)nelmts * sizeof(ds_list_t));
- if(dsbuf == NULL)
+ dsbuf = (ds_list_t *)HDmalloc((size_t)nelmts * sizeof(ds_list_t));
+ if (dsbuf == NULL)
goto out;
- if(H5Aread(aid, ntid, dsbuf) < 0)
+ if (H5Aread(aid, ntid, dsbuf) < 0)
goto out;
/* close */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * create a new attribute
- *-------------------------------------------------------------------------
- */
+ * create a new attribute
+ *-------------------------------------------------------------------------
+ */
/* the attribute must be deleted, in order to the new one can reflect the changes*/
- if(H5Adelete(dsid, REFERENCE_LIST) < 0)
+ if (H5Adelete(dsid, REFERENCE_LIST) < 0)
goto out;
/* store the IDX information (index of the dataset that has the DS) */
- dsl.dim_idx = idx;
+ dsl.dim_idx = idx;
dsbuf[nelmts - 1] = dsl;
/* create a new data space for the new references array */
dims[0] = (hsize_t)nelmts;
- if((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
/* create the attribute again with the changes of space */
- if((aid = H5Acreate2(dsid, REFERENCE_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(dsid, REFERENCE_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* write the attribute with the new references */
- if(H5Awrite(aid, ntid, dsbuf) < 0)
+ if (H5Awrite(aid, ntid, dsbuf) < 0)
goto out;
/* close */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
if (H5Tclose(ntid) < 0)
goto out;
@@ -502,15 +495,15 @@ H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx)
} /* has_reflist */
/*-------------------------------------------------------------------------
- * write the standard attributes for a Dimension Scale dataset
- *-------------------------------------------------------------------------
- */
+ * write the standard attributes for a Dimension Scale dataset
+ *-------------------------------------------------------------------------
+ */
- if((is_ds = H5DSis_scale(dsid)) < 0)
+ if ((is_ds = H5DSis_scale(dsid)) < 0)
return FAIL;
- if(is_ds == 0) {
- if (H5LT_set_attribute_string(dsid,"CLASS",DIMENSION_SCALE_CLASS) < 0)
+ if (is_ds == 0) {
+ if (H5LT_set_attribute_string(dsid, "CLASS", DIMENSION_SCALE_CLASS) < 0)
return FAIL;
}
@@ -518,17 +511,19 @@ H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx)
/* error zone */
out:
- if(buf)
+ if (buf)
HDfree(buf);
- if(dsbuf)
+ if (dsbuf)
HDfree(dsbuf);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Aclose(aid);
H5Tclose(ntid);
H5Tclose(tid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
}
@@ -559,68 +554,67 @@ out:
herr_t
H5DSdetach_scale(hid_t did, hid_t dsid, unsigned int idx)
{
- int has_dimlist;
- int has_reflist;
- hssize_t nelmts;
- hid_t dsid_j; /* DS dataset ID in DIMENSION_LIST */
- hid_t did_i; /* dataset ID in REFERENCE_LIST */
- hid_t sid; /* space ID */
- hid_t tid = -1; /* attribute type ID */
- hid_t ntid = -1; /* attribute native type ID */
- hid_t aid = -1; /* attribute ID */
- int rank; /* rank of dataset */
- ds_list_t *dsbuf = NULL; /* array of attribute data in the DS pointing to the dataset */
- hsize_t dims[1]; /* dimension of the "REFERENCE_LIST" array */
- hobj_ref_t ref; /* reference to the DS */
- hvl_t *buf = NULL; /* VL buffer to store in the attribute */
- int i;
- size_t j;
- hssize_t ii;
+ int has_dimlist;
+ int has_reflist;
+ hssize_t nelmts;
+ hid_t dsid_j; /* DS dataset ID in DIMENSION_LIST */
+ hid_t did_i; /* dataset ID in REFERENCE_LIST */
+ hid_t sid; /* space ID */
+ hid_t tid = -1; /* attribute type ID */
+ hid_t ntid = -1; /* attribute native type ID */
+ hid_t aid = -1; /* attribute ID */
+ int rank; /* rank of dataset */
+ ds_list_t * dsbuf = NULL; /* array of attribute data in the DS pointing to the dataset */
+ hsize_t dims[1]; /* dimension of the "REFERENCE_LIST" array */
+ hobj_ref_t ref; /* reference to the DS */
+ hvl_t * buf = NULL; /* VL buffer to store in the attribute */
+ int i;
+ size_t j;
+ hssize_t ii;
H5O_info2_t did_oi, dsid_oi, tmp_oi;
- int found_dset = 0, found_ds = 0;
- int have_ds = 0;
- htri_t is_scale;
+ int found_dset = 0, found_ds = 0;
+ int have_ds = 0;
+ htri_t is_scale;
/*-------------------------------------------------------------------------
- * parameter checking
- *-------------------------------------------------------------------------
- */
+ * parameter checking
+ *-------------------------------------------------------------------------
+ */
/* check for valid types of identifiers */
- if(H5I_DATASET != H5Iget_type(did) || H5I_DATASET != H5Iget_type(dsid))
+ if (H5I_DATASET != H5Iget_type(did) || H5I_DATASET != H5Iget_type(dsid))
return FAIL;
- if((is_scale = H5DSis_scale(did)) < 0)
+ if ((is_scale = H5DSis_scale(did)) < 0)
return FAIL;
/* the dataset cannot be a DS dataset */
- if( is_scale == 1)
+ if (is_scale == 1)
return FAIL;
/* get info for the dataset in the parameter list */
- if(H5Oget_info3(did, &did_oi, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did, &did_oi, H5O_INFO_BASIC) < 0)
return FAIL;
/* get info for the scale in the parameter list */
- if(H5Oget_info3(dsid, &dsid_oi, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(dsid, &dsid_oi, H5O_INFO_BASIC) < 0)
return FAIL;
/* same object, not valid */
- if(did_oi.fileno == dsid_oi.fileno) {
+ if (did_oi.fileno == dsid_oi.fileno) {
int token_cmp;
- if(H5Otoken_cmp(did, &did_oi.token, &dsid_oi.token, &token_cmp) < 0)
+ if (H5Otoken_cmp(did, &did_oi.token, &dsid_oi.token, &token_cmp) < 0)
return FAIL;
- if(!token_cmp)
+ if (!token_cmp)
return FAIL;
} /* end if */
-
/*-------------------------------------------------------------------------
- * Find "DIMENSION_LIST"
- *-------------------------------------------------------------------------
- */
+ * Find "DIMENSION_LIST"
+ *-------------------------------------------------------------------------
+ */
/* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */
if ((has_dimlist = H5LT_find_attribute(did, DIMENSION_LIST)) < 0)
return FAIL;
@@ -641,58 +635,56 @@ H5DSdetach_scale(hid_t did, hid_t dsid, unsigned int idx)
return FAIL;
/* parameter range checking */
- if (idx > (unsigned)rank-1)
+ if (idx > (unsigned)rank - 1)
return FAIL;
/*-------------------------------------------------------------------------
- * find "REFERENCE_LIST"
- *-------------------------------------------------------------------------
- */
+ * find "REFERENCE_LIST"
+ *-------------------------------------------------------------------------
+ */
/* try to find the attribute "REFERENCE_LIST" on the >>DS<< dataset */
- if((has_reflist = H5LT_find_attribute(dsid, REFERENCE_LIST)) < 0)
+ if ((has_reflist = H5LT_find_attribute(dsid, REFERENCE_LIST)) < 0)
return FAIL;
- if(has_reflist == 0)
+ if (has_reflist == 0)
return FAIL;
/*-------------------------------------------------------------------------
- * open "DIMENSION_LIST", and delete the reference
- *-------------------------------------------------------------------------
- */
+ * open "DIMENSION_LIST", and delete the reference
+ *-------------------------------------------------------------------------
+ */
- if((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0)
+ if ((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0)
return FAIL;
- if((tid = H5Aget_type(aid)) < 0)
+ if ((tid = H5Aget_type(aid)) < 0)
goto out;
- if((sid = H5Aget_space(aid)) < 0)
+ if ((sid = H5Aget_space(aid)) < 0)
goto out;
/* allocate and initialize the VL */
buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t));
- if(buf == NULL)
+ if (buf == NULL)
goto out;
/* read */
- if(H5Aread(aid, tid, buf) < 0)
+ if (H5Aread(aid, tid, buf) < 0)
goto out;
/* reset */
- if ( buf[idx].len > 0 )
- {
- for (j=0; j<buf[idx].len; j++)
- {
+ if (buf[idx].len > 0) {
+ for (j = 0; j < buf[idx].len; j++) {
/* get the reference */
ref = ((hobj_ref_t *)buf[idx].p)[j];
/* get the DS id */
- if ((dsid_j = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0)
+ if ((dsid_j = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &ref)) < 0)
goto out;
/* get info for this DS */
- if(H5Oget_info3(dsid_j, &tmp_oi, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(dsid_j, &tmp_oi, H5O_INFO_BASIC) < 0)
goto out;
/* Close the dereferenced dataset */
@@ -700,12 +692,12 @@ H5DSdetach_scale(hid_t did, hid_t dsid, unsigned int idx)
goto out;
/* same object, reset */
- if(dsid_oi.fileno == tmp_oi.fileno) {
+ if (dsid_oi.fileno == tmp_oi.fileno) {
int token_cmp;
- if(H5Otoken_cmp(did, &dsid_oi.token, &tmp_oi.token, &token_cmp) < 0)
+ if (H5Otoken_cmp(did, &dsid_oi.token, &tmp_oi.token, &token_cmp) < 0)
goto out;
- if(!token_cmp) {
+ if (!token_cmp) {
/* If there are more than one reference in the VL element
and the reference we found is not the last one,
copy the last one to replace the found one since the order
@@ -716,10 +708,10 @@ H5DSdetach_scale(hid_t did, hid_t dsid, unsigned int idx)
size_t len = buf[idx].len;
- if(j < len - 1)
- ((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1];
+ if (j < len - 1)
+ ((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len - 1];
len = --buf[idx].len;
- if(len == 0) {
+ if (len == 0) {
HDfree(buf[idx].p);
buf[idx].p = NULL;
}
@@ -728,108 +720,107 @@ H5DSdetach_scale(hid_t did, hid_t dsid, unsigned int idx)
found_ds = 1;
break;
} /* end if */
- } /* end if */
- } /* j */
- } /* if */
+ } /* end if */
+ } /* j */
+ } /* if */
/* the scale must be present to continue */
- if(found_ds == 0)
+ if (found_ds == 0)
goto out;
/* Write the attribute, but check first, if we have any scales left,
because if not, we should delete the attribute according to the spec */
- for(i = 0; i < rank; i++) {
- if(buf[i].len > 0) {
+ for (i = 0; i < rank; i++) {
+ if (buf[i].len > 0) {
have_ds = 1;
break;
}
}
- if(have_ds) {
- if(H5Awrite(aid, tid, buf) < 0)
+ if (have_ds) {
+ if (H5Awrite(aid, tid, buf) < 0)
goto out;
}
else {
- if(H5Adelete(did, DIMENSION_LIST) < 0)
+ if (H5Adelete(did, DIMENSION_LIST) < 0)
goto out;
}
/* close */
- if(H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0)
+ if (H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0)
goto out;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
HDfree(buf);
buf = NULL;
-
/*-------------------------------------------------------------------------
- * the "REFERENCE_LIST" array exists, update
- *-------------------------------------------------------------------------
- */
+ * the "REFERENCE_LIST" array exists, update
+ *-------------------------------------------------------------------------
+ */
- if((aid = H5Aopen(dsid, REFERENCE_LIST, H5P_DEFAULT)) < 0)
+ if ((aid = H5Aopen(dsid, REFERENCE_LIST, H5P_DEFAULT)) < 0)
goto out;
- if((tid = H5Aget_type(aid)) < 0)
+ if ((tid = H5Aget_type(aid)) < 0)
goto out;
/* get native type to read attribute REFERENCE_LIST */
- if((ntid = H5DS_get_REFLIST_type()) < 0)
+ if ((ntid = H5DS_get_REFLIST_type()) < 0)
goto out;
/* get and save the old reference(s) */
- if((sid = H5Aget_space(aid)) < 0)
+ if ((sid = H5Aget_space(aid)) < 0)
goto out;
- if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0)
+ if ((nelmts = H5Sget_simple_extent_npoints(sid)) < 0)
goto out;
- dsbuf = (ds_list_t*) HDmalloc((size_t)nelmts * sizeof(ds_list_t));
- if(dsbuf == NULL)
+ dsbuf = (ds_list_t *)HDmalloc((size_t)nelmts * sizeof(ds_list_t));
+ if (dsbuf == NULL)
goto out;
- if(H5Aread(aid, ntid, dsbuf) < 0)
+ if (H5Aread(aid, ntid, dsbuf) < 0)
goto out;
- for(ii = 0; ii < nelmts; ii++) {
+ for (ii = 0; ii < nelmts; ii++) {
/* First check if we have the same dimension index */
- if(idx == dsbuf[ii].dim_idx) {
+ if (idx == dsbuf[ii].dim_idx) {
/* get the reference to the dataset */
ref = dsbuf[ii].ref;
/* get the dataset id */
- if ((did_i = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0)
+ if ((did_i = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &ref)) < 0)
goto out;
/* get info for this dataset */
- if(H5Oget_info3(did_i, &tmp_oi, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did_i, &tmp_oi, H5O_INFO_BASIC) < 0)
goto out;
/* close the dereferenced dataset */
- if(H5Dclose(did_i) < 0)
+ if (H5Dclose(did_i) < 0)
goto out;
/* same object, reset. we want to detach only for this DIM */
- if(did_oi.fileno == tmp_oi.fileno) {
+ if (did_oi.fileno == tmp_oi.fileno) {
int token_cmp;
- if(H5Otoken_cmp(did, &did_oi.token, &tmp_oi.token, &token_cmp) < 0)
+ if (H5Otoken_cmp(did, &did_oi.token, &tmp_oi.token, &token_cmp) < 0)
goto out;
- if(!token_cmp) {
+ if (!token_cmp) {
/* copy the last one to replace the one which is found */
- dsbuf[ii] = dsbuf[nelmts-1];
+ dsbuf[ii] = dsbuf[nelmts - 1];
nelmts--;
- found_dset=1;
+ found_dset = 1;
break;
} /* end if */
- } /* end if */
- } /* if we have the same dimension index */
- } /* ii */
+ } /* end if */
+ } /* if we have the same dimension index */
+ } /* ii */
/* close space and attribute */
if (H5Sclose(sid) < 0)
@@ -838,44 +829,43 @@ H5DSdetach_scale(hid_t did, hid_t dsid, unsigned int idx)
goto out;
/*-------------------------------------------------------------------------
- * check if we found the pointed dataset
- *-------------------------------------------------------------------------
- */
+ * check if we found the pointed dataset
+ *-------------------------------------------------------------------------
+ */
/* the pointed dataset must exist */
if (found_dset == 0)
goto out;
/*-------------------------------------------------------------------------
- * create a new attribute
- *-------------------------------------------------------------------------
- */
+ * create a new attribute
+ *-------------------------------------------------------------------------
+ */
/* the attribute must be deleted, in order to the new one can reflect the changes*/
if (H5Adelete(dsid, REFERENCE_LIST) < 0)
goto out;
/* don't do anything for an empty array */
- if(nelmts)
- {
+ if (nelmts) {
/* create a new data space for the new references array */
- dims[0] = (hsize_t)nelmts;
+ dims[0] = (hsize_t)nelmts;
- if((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
/* create the attribute again with the changes of space */
- if((aid = H5Acreate2(dsid, REFERENCE_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(dsid, REFERENCE_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* write the new attribute with the new references */
- if(H5Awrite(aid, ntid, dsbuf) < 0)
+ if (H5Awrite(aid, ntid, dsbuf) < 0)
goto out;
/* close space and attribute */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
} /* nelmts */
@@ -892,29 +882,30 @@ H5DSdetach_scale(hid_t did, hid_t dsid, unsigned int idx)
/* error zone */
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Aclose(aid);
H5Tclose(ntid);
H5Tclose(tid);
- if(dsbuf) {
+ if (dsbuf) {
HDfree(dsbuf);
dsbuf = NULL;
}
- if(buf) {
+ if (buf) {
/* Failure occured before H5Treclaim was called;
free the pointers allocated when we read data in */
- for(i = 0; i < rank; i++) {
- if(buf[i].p)
+ for (i = 0; i < rank; i++) {
+ if (buf[i].p)
HDfree(buf[i].p);
}
HDfree(buf);
buf = NULL;
}
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
-
}
/*-------------------------------------------------------------------------
@@ -942,52 +933,52 @@ out:
htri_t
H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx)
{
- int has_dimlist;
- int has_reflist;
- hssize_t nelmts;
- hid_t sid; /* space ID */
- hid_t tid = -1; /* attribute type ID */
- hid_t ntid = -1; /* attribute native type ID */
- hid_t aid = -1; /* attribute ID */
- int rank; /* rank of dataset */
- ds_list_t *dsbuf = NULL; /* array of attribute data in the DS pointing to the dataset */
- hobj_ref_t ref; /* reference to the DS */
- hvl_t *buf = NULL; /* VL buffer to store in the attribute */
- hid_t dsid_j; /* DS dataset ID in DIMENSION_LIST */
- hid_t did_i; /* dataset ID in REFERENCE_LIST */
+ int has_dimlist;
+ int has_reflist;
+ hssize_t nelmts;
+ hid_t sid; /* space ID */
+ hid_t tid = -1; /* attribute type ID */
+ hid_t ntid = -1; /* attribute native type ID */
+ hid_t aid = -1; /* attribute ID */
+ int rank; /* rank of dataset */
+ ds_list_t * dsbuf = NULL; /* array of attribute data in the DS pointing to the dataset */
+ hobj_ref_t ref; /* reference to the DS */
+ hvl_t * buf = NULL; /* VL buffer to store in the attribute */
+ hid_t dsid_j; /* DS dataset ID in DIMENSION_LIST */
+ hid_t did_i; /* dataset ID in REFERENCE_LIST */
H5O_info2_t oi1, oi2, oi3, oi4;
- H5I_type_t it1, it2;
- int i;
- int found_dset=0, found_ds=0;
- htri_t is_scale;
+ H5I_type_t it1, it2;
+ int i;
+ int found_dset = 0, found_ds = 0;
+ htri_t is_scale;
/*-------------------------------------------------------------------------
- * parameter checking
- *-------------------------------------------------------------------------
- */
+ * parameter checking
+ *-------------------------------------------------------------------------
+ */
if ((is_scale = H5DSis_scale(did)) < 0)
return FAIL;
/* the dataset cannot be a DS dataset */
- if ( is_scale == 1)
+ if (is_scale == 1)
return FAIL;
/* get info for the dataset in the parameter list */
- if(H5Oget_info3(did, &oi1, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did, &oi1, H5O_INFO_BASIC) < 0)
return FAIL;
/* get info for the scale in the parameter list */
- if(H5Oget_info3(dsid, &oi2, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(dsid, &oi2, H5O_INFO_BASIC) < 0)
return FAIL;
/* same object, not valid */
- if(oi1.fileno == oi2.fileno) {
+ if (oi1.fileno == oi2.fileno) {
int token_cmp;
- if(H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0)
+ if (H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0)
return FAIL;
- if(!token_cmp)
+ if (!token_cmp)
return FAIL;
} /* end if */
@@ -1001,16 +992,16 @@ H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx)
return FAIL;
/*-------------------------------------------------------------------------
- * get space
- *-------------------------------------------------------------------------
- */
+ * get space
+ *-------------------------------------------------------------------------
+ */
/* get dataset space */
if ((sid = H5Dget_space(did)) < 0)
return FAIL;
/* get rank */
- if ((rank=H5Sget_simple_extent_ndims(sid)) < 0)
+ if ((rank = H5Sget_simple_extent_ndims(sid)) < 0)
goto out;
/* close dataset space */
@@ -1018,32 +1009,31 @@ H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx)
goto out;
/* parameter range checking */
- if(idx > ((unsigned)rank - 1))
+ if (idx > ((unsigned)rank - 1))
return FAIL;
/* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */
- if((has_dimlist = H5LT_find_attribute(did, DIMENSION_LIST)) < 0)
+ if ((has_dimlist = H5LT_find_attribute(did, DIMENSION_LIST)) < 0)
return FAIL;
/*-------------------------------------------------------------------------
- * open "DIMENSION_LIST"
- *-------------------------------------------------------------------------
- */
+ * open "DIMENSION_LIST"
+ *-------------------------------------------------------------------------
+ */
- if(has_dimlist == 1)
- {
- if((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0)
+ if (has_dimlist == 1) {
+ if ((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0)
goto out;
- if((tid = H5Aget_type(aid)) < 0)
+ if ((tid = H5Aget_type(aid)) < 0)
goto out;
- if((sid = H5Aget_space(aid)) < 0)
+ if ((sid = H5Aget_space(aid)) < 0)
goto out;
/* allocate and initialize the VL */
- buf = (hvl_t*)HDmalloc((size_t)rank * sizeof(hvl_t));
- if(buf == NULL)
+ buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t));
+ if (buf == NULL)
goto out;
/* read */
@@ -1051,8 +1041,7 @@ H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx)
goto out;
/* iterate all the REFs in this dimension IDX */
- for (i=0; i<(int)buf[idx].len; i++)
- {
+ for (i = 0; i < (int)buf[idx].len; i++) {
/* get the reference */
ref = ((hobj_ref_t *)buf[idx].p)[i];
@@ -1061,30 +1050,28 @@ H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx)
goto out;
/* get info for DS in the parameter list */
- if(H5Oget_info3(dsid, &oi1, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(dsid, &oi1, H5O_INFO_BASIC) < 0)
goto out;
/* get info for this DS */
- if(H5Oget_info3(dsid_j, &oi2, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(dsid_j, &oi2, H5O_INFO_BASIC) < 0)
goto out;
/* same object */
- if(oi1.fileno == oi2.fileno) {
+ if (oi1.fileno == oi2.fileno) {
int token_cmp;
- if(H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0)
+ if (H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0)
goto out;
- if(!token_cmp)
+ if (!token_cmp)
found_ds = 1;
} /* end if */
/* close the dereferenced dataset */
if (H5Dclose(dsid_j) < 0)
goto out;
-
}
-
/* close */
if (H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0)
goto out;
@@ -1099,39 +1086,38 @@ H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx)
} /* has_dimlist */
/*-------------------------------------------------------------------------
- * info on the >>DS<< dataset
- *-------------------------------------------------------------------------
- */
+ * info on the >>DS<< dataset
+ *-------------------------------------------------------------------------
+ */
/* try to find the attribute "REFERENCE_LIST" on the >>DS<< dataset */
- if((has_reflist = H5LT_find_attribute(dsid, REFERENCE_LIST)) < 0)
+ if ((has_reflist = H5LT_find_attribute(dsid, REFERENCE_LIST)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * open "REFERENCE_LIST"
- *-------------------------------------------------------------------------
- */
+ * open "REFERENCE_LIST"
+ *-------------------------------------------------------------------------
+ */
- if(has_reflist == 1)
- {
- if((aid = H5Aopen(dsid, REFERENCE_LIST, H5P_DEFAULT)) < 0)
+ if (has_reflist == 1) {
+ if ((aid = H5Aopen(dsid, REFERENCE_LIST, H5P_DEFAULT)) < 0)
goto out;
- if((tid = H5Aget_type(aid)) < 0)
+ if ((tid = H5Aget_type(aid)) < 0)
goto out;
/* get native type to read REFERENCE_LIST attribute */
- if((ntid = H5DS_get_REFLIST_type()) < 0)
+ if ((ntid = H5DS_get_REFLIST_type()) < 0)
goto out;
/* get and save the old reference(s) */
- if((sid = H5Aget_space(aid)) < 0)
+ if ((sid = H5Aget_space(aid)) < 0)
goto out;
- if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0)
+ if ((nelmts = H5Sget_simple_extent_npoints(sid)) < 0)
goto out;
- dsbuf = (ds_list_t*) HDmalloc((size_t)nelmts * sizeof(ds_list_t));
+ dsbuf = (ds_list_t *)HDmalloc((size_t)nelmts * sizeof(ds_list_t));
if (dsbuf == NULL)
goto out;
@@ -1140,46 +1126,43 @@ H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx)
goto out;
/*-------------------------------------------------------------------------
- * iterate
- *-------------------------------------------------------------------------
- */
+ * iterate
+ *-------------------------------------------------------------------------
+ */
- for(i = 0; i < nelmts; i++)
- {
+ for (i = 0; i < nelmts; i++) {
/* get the reference */
ref = dsbuf[i].ref;
/* the reference was not deleted */
- if (ref)
- {
+ if (ref) {
/* get the dataset id */
if ((did_i = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &ref)) < 0)
goto out;
/* get info for dataset in the parameter list */
- if(H5Oget_info3(did, &oi3, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did, &oi3, H5O_INFO_BASIC) < 0)
goto out;
/* get info for this dataset */
- if(H5Oget_info3(did_i, &oi4, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(did_i, &oi4, H5O_INFO_BASIC) < 0)
goto out;
/* same object */
- if(oi3.fileno == oi4.fileno) {
+ if (oi3.fileno == oi4.fileno) {
int token_cmp;
- if(H5Otoken_cmp(did, &oi3.token, &oi4.token, &token_cmp) < 0)
+ if (H5Otoken_cmp(did, &oi3.token, &oi4.token, &token_cmp) < 0)
goto out;
- if(!token_cmp && (idx == dsbuf[i].dim_idx))
- found_dset=1;
+ if (!token_cmp && (idx == dsbuf[i].dim_idx))
+ found_dset = 1;
} /* end if */
/* close the dereferenced dataset */
if (H5Dclose(did_i) < 0)
goto out;
} /* if */
- } /* i */
-
+ } /* i */
/* close */
if (H5Sclose(sid) < 0)
@@ -1202,18 +1185,20 @@ H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx)
/* error zone */
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Aclose(aid);
H5Tclose(tid);
H5Tclose(ntid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
if (buf) {
HDfree(buf);
buf = NULL;
}
- if(dsbuf) {
+ if (dsbuf) {
HDfree(dsbuf);
dsbuf = NULL;
}
@@ -1260,42 +1245,40 @@ out:
*-------------------------------------------------------------------------
*/
herr_t
-H5DSiterate_scales(hid_t did, unsigned int dim, int *ds_idx,
- H5DS_iterate_t visitor, void *visitor_data )
+H5DSiterate_scales(hid_t did, unsigned int dim, int *ds_idx, H5DS_iterate_t visitor, void *visitor_data)
{
- hid_t scale_id;
- int rank;
- hobj_ref_t ref; /* reference to the DS */
- hid_t sid; /* space ID */
- hid_t tid = -1; /* attribute type ID */
- hid_t aid = -1; /* attribute ID */
- hvl_t *buf = NULL; /* VL buffer to store in the attribute */
- H5I_type_t it; /* ID type */
- herr_t ret_value=0;
- int j_idx;
- int nscales;
- int has_dimlist;
- int i;
+ hid_t scale_id;
+ int rank;
+ hobj_ref_t ref; /* reference to the DS */
+ hid_t sid; /* space ID */
+ hid_t tid = -1; /* attribute type ID */
+ hid_t aid = -1; /* attribute ID */
+ hvl_t * buf = NULL; /* VL buffer to store in the attribute */
+ H5I_type_t it; /* ID type */
+ herr_t ret_value = 0;
+ int j_idx;
+ int nscales;
+ int has_dimlist;
+ int i;
/*-------------------------------------------------------------------------
- * parameter checking
- *-------------------------------------------------------------------------
- */
+ * parameter checking
+ *-------------------------------------------------------------------------
+ */
/* get ID type */
if ((it = H5Iget_type(did)) < 0)
return FAIL;
- if (H5I_DATASET!=it)
+ if (H5I_DATASET != it)
return FAIL;
/* get the number of scales assotiated with this DIM */
- if ((nscales = H5DSget_num_scales(did,dim)) < 0)
+ if ((nscales = H5DSget_num_scales(did, dim)) < 0)
return FAIL;
/* parameter range checking */
- if (ds_idx!=NULL)
- {
- if (*ds_idx>=nscales)
+ if (ds_idx != NULL) {
+ if (*ds_idx >= nscales)
return FAIL;
}
@@ -1304,70 +1287,67 @@ H5DSiterate_scales(hid_t did, unsigned int dim, int *ds_idx,
return FAIL;
/* get rank */
- if ((rank=H5Sget_simple_extent_ndims(sid)) < 0)
+ if ((rank = H5Sget_simple_extent_ndims(sid)) < 0)
goto out;
/* close dataset space */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if ( dim >= (unsigned)rank )
+ if (dim >= (unsigned)rank)
return FAIL;
/* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */
- if((has_dimlist = H5LT_find_attribute(did, DIMENSION_LIST)) < 0)
+ if ((has_dimlist = H5LT_find_attribute(did, DIMENSION_LIST)) < 0)
return FAIL;
- if(has_dimlist == 0)
+ if (has_dimlist == 0)
return SUCCEED;
- else if(has_dimlist == 1)
- {
- if((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0)
+ else if (has_dimlist == 1) {
+ if ((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0)
goto out;
- if((tid = H5Aget_type(aid)) < 0)
+ if ((tid = H5Aget_type(aid)) < 0)
goto out;
- if((sid = H5Aget_space(aid)) < 0)
+ if ((sid = H5Aget_space(aid)) < 0)
goto out;
/* allocate and initialize the VL */
- buf = (hvl_t*)HDmalloc((size_t)rank * sizeof(hvl_t));
+ buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t));
- if(buf == NULL)
+ if (buf == NULL)
goto out;
/* read */
- if(H5Aread(aid, tid, buf) < 0)
+ if (H5Aread(aid, tid, buf) < 0)
goto out;
- if ( buf[dim].len > 0 )
- {
- if (ds_idx!=NULL)
+ if (buf[dim].len > 0) {
+ if (ds_idx != NULL)
j_idx = *ds_idx;
else
- j_idx=0;
+ j_idx = 0;
/* iterate */
- for(i=j_idx; i<nscales; i++)
- {
+ for (i = j_idx; i < nscales; i++) {
/* get the reference */
- ref = ((hobj_ref_t *)buf[dim].p)[ i ];
+ ref = ((hobj_ref_t *)buf[dim].p)[i];
/* disable error reporting, the ID might refer to a deleted dataset */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
/* get the DS id */
- if ((scale_id = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0)
+ if ((scale_id = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &ref)) < 0)
goto out;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* set the return IDX OUT value at current scale index */
- if (ds_idx!=NULL)
- {
+ if (ds_idx != NULL) {
*ds_idx = i;
}
- if((ret_value=(visitor)(did,dim,scale_id,visitor_data))!=0)
- {
+ if ((ret_value = (visitor)(did, dim, scale_id, visitor_data)) != 0) {
/* break */
/* close the DS id */
@@ -1382,10 +1362,10 @@ H5DSiterate_scales(hid_t did, unsigned int dim, int *ds_idx,
goto out;
} /* i */
- } /* if */
+ } /* if */
/* close */
- if (H5Treclaim(tid,sid,H5P_DEFAULT,buf) < 0)
+ if (H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0)
goto out;
if (H5Sclose(sid) < 0)
goto out;
@@ -1401,15 +1381,17 @@ H5DSiterate_scales(hid_t did, unsigned int dim, int *ds_idx,
return ret_value;
out:
- H5E_BEGIN_TRY {
- if(buf) {
- H5Treclaim(tid,sid,H5P_DEFAULT,buf);
+ H5E_BEGIN_TRY
+ {
+ if (buf) {
+ H5Treclaim(tid, sid, H5P_DEFAULT, buf);
HDfree(buf);
}
H5Sclose(sid);
H5Aclose(aid);
H5Tclose(tid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
}
@@ -1430,25 +1412,25 @@ out:
herr_t
H5DSset_label(hid_t did, unsigned int idx, const char *label)
{
- int has_labels;
- hid_t sid = -1; /* space ID */
- hid_t tid = -1; /* attribute type ID */
- hid_t aid = -1; /* attribute ID */
- int rank; /* rank of dataset */
- hsize_t dims[1]; /* dimensions of dataset */
- H5I_type_t it; /* ID type */
- unsigned int i;
- union { /* union is needed to eliminate compiler warnings about */
- char ** buf; /* discarding the 'const' qualifier in the free */
- char const ** const_buf; /* buf calls */
+ int has_labels;
+ hid_t sid = -1; /* space ID */
+ hid_t tid = -1; /* attribute type ID */
+ hid_t aid = -1; /* attribute ID */
+ int rank; /* rank of dataset */
+ hsize_t dims[1]; /* dimensions of dataset */
+ H5I_type_t it; /* ID type */
+ unsigned int i;
+ union { /* union is needed to eliminate compiler warnings about */
+ char ** buf; /* discarding the 'const' qualifier in the free */
+ char const **const_buf; /* buf calls */
} u;
HDmemset(&u, 0, sizeof(u));
/*-------------------------------------------------------------------------
- * parameter checking
- *-------------------------------------------------------------------------
- */
+ * parameter checking
+ *-------------------------------------------------------------------------
+ */
/* get ID type */
if ((it = H5Iget_type(did)) < 0)
return FAIL;
@@ -1459,7 +1441,7 @@ H5DSset_label(hid_t did, unsigned int idx, const char *label)
if (label == NULL)
return FAIL;
- /* get dataset space */
+ /* get dataset space */
if ((sid = H5Dget_space(did)) < 0)
return FAIL;
@@ -1471,25 +1453,24 @@ H5DSset_label(hid_t did, unsigned int idx, const char *label)
if (H5Sclose(sid) < 0)
goto out;
- if ( idx >= (unsigned)rank )
+ if (idx >= (unsigned)rank)
return FAIL;
/*-------------------------------------------------------------------------
- * attribute "DIMENSION_LABELS"
- *-------------------------------------------------------------------------
- */
+ * attribute "DIMENSION_LABELS"
+ *-------------------------------------------------------------------------
+ */
/* try to find the attribute "DIMENSION_LABELS" on the >>data<< dataset */
if ((has_labels = H5LT_find_attribute(did, DIMENSION_LABELS)) < 0)
return FAIL;
/*-------------------------------------------------------------------------
- * make the attribute and insert label
- *-------------------------------------------------------------------------
- */
+ * make the attribute and insert label
+ *-------------------------------------------------------------------------
+ */
- if (has_labels == 0)
- {
+ if (has_labels == 0) {
dims[0] = (hsize_t)rank;
/* space for the attribute */
@@ -1507,12 +1488,12 @@ H5DSset_label(hid_t did, unsigned int idx, const char *label)
goto out;
/* allocate and initialize */
- u.const_buf = (char const **) HDmalloc((size_t) rank * sizeof(char *));
+ u.const_buf = (char const **)HDmalloc((size_t)rank * sizeof(char *));
if (u.const_buf == NULL)
goto out;
- for (i = 0; i < (unsigned int) rank; i++)
+ for (i = 0; i < (unsigned int)rank; i++)
u.const_buf[i] = NULL;
/* store the label information in the required index */
@@ -1529,20 +1510,18 @@ H5DSset_label(hid_t did, unsigned int idx, const char *label)
goto out;
if (H5Aclose(aid) < 0)
goto out;
- if (u.const_buf)
- {
+ if (u.const_buf) {
HDfree(u.const_buf);
u.const_buf = NULL;
}
}
/*-------------------------------------------------------------------------
- * just insert label
- *-------------------------------------------------------------------------
- */
+ * just insert label
+ *-------------------------------------------------------------------------
+ */
- else
- {
+ else {
if ((aid = H5Aopen(did, DIMENSION_LABELS, H5P_DEFAULT)) < 0)
goto out;
@@ -1551,7 +1530,7 @@ H5DSset_label(hid_t did, unsigned int idx, const char *label)
goto out;
/* allocate and initialize */
- u.buf = (char **) HDmalloc((size_t) rank * sizeof(char *));
+ u.buf = (char **)HDmalloc((size_t)rank * sizeof(char *));
if (u.buf == NULL)
goto out;
@@ -1575,8 +1554,7 @@ H5DSset_label(hid_t did, unsigned int idx, const char *label)
u.buf[idx] = NULL;
/* free all the ptr's from the H5Aread() */
- for (i = 0; i < (unsigned int) rank; i++)
- {
+ for (i = 0; i < (unsigned int)rank; i++) {
if (u.buf[i])
HDfree(u.buf[i]);
}
@@ -1586,8 +1564,7 @@ H5DSset_label(hid_t did, unsigned int idx, const char *label)
goto out;
if (H5Aclose(aid) < 0)
goto out;
- if (u.buf)
- {
+ if (u.buf) {
HDfree(u.buf);
u.buf = NULL;
}
@@ -1598,13 +1575,11 @@ H5DSset_label(hid_t did, unsigned int idx, const char *label)
/* error zone */
out:
- if (u.buf)
- {
- if (u.buf[idx]) /* check if we errored during H5Awrite */
+ if (u.buf) {
+ if (u.buf[idx]) /* check if we errored during H5Awrite */
u.buf[idx] = NULL; /* don't free label */
/* free all the ptr's from the H5Aread() */
- for (i = 0; i < (unsigned int) rank; i++)
- {
+ for (i = 0; i < (unsigned int)rank; i++) {
if (u.buf[i])
HDfree(u.buf[i]);
}
@@ -1615,7 +1590,8 @@ out:
H5Sclose(sid);
H5Aclose(aid);
H5Tclose(tid);
- }H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
}
@@ -1640,20 +1616,20 @@ ssize_t
H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size)
{
int has_labels;
- hid_t sid = -1; /* space ID */
- hid_t tid = -1; /* attribute type ID */
- hid_t aid = -1; /* attribute ID */
- int rank; /* rank of dataset */
- char **buf = NULL; /* buffer to store in the attribute */
- H5I_type_t it; /* ID type */
+ hid_t sid = -1; /* space ID */
+ hid_t tid = -1; /* attribute type ID */
+ hid_t aid = -1; /* attribute ID */
+ int rank; /* rank of dataset */
+ char ** buf = NULL; /* buffer to store in the attribute */
+ H5I_type_t it; /* ID type */
size_t nbytes = 0;
size_t copy_len;
int i;
/*-------------------------------------------------------------------------
- * parameter checking
- *-------------------------------------------------------------------------
- */
+ * parameter checking
+ *-------------------------------------------------------------------------
+ */
/* get ID type */
if ((it = H5Iget_type(did)) < 0)
return FAIL;
@@ -1661,7 +1637,7 @@ H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size)
if (H5I_DATASET != it)
return FAIL;
- /* get dataset space */
+ /* get dataset space */
if ((sid = H5Dget_space(did)) < 0)
return FAIL;
@@ -1673,41 +1649,39 @@ H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size)
if (H5Sclose(sid) < 0)
goto out;
- if ( idx >= (unsigned)rank )
+ if (idx >= (unsigned)rank)
return FAIL;
/*-------------------------------------------------------------------------
- * attribute "DIMENSION_LABELS"
- *-------------------------------------------------------------------------
- */
+ * attribute "DIMENSION_LABELS"
+ *-------------------------------------------------------------------------
+ */
/* try to find the attribute "DIMENSION_LABELS" on the >>data<< dataset */
if ((has_labels = H5LT_find_attribute(did, DIMENSION_LABELS)) < 0)
return FAIL;
/* return 0 and NULL for label if no label found */
- if (has_labels == 0)
- {
+ if (has_labels == 0) {
if (label)
label[0] = 0;
return 0;
}
/*-------------------------------------------------------------------------
- * open the attribute and read label
- *-------------------------------------------------------------------------
- */
+ * open the attribute and read label
+ *-------------------------------------------------------------------------
+ */
- assert (has_labels == 1);
+ assert(has_labels == 1);
if ((aid = H5Aopen(did, DIMENSION_LABELS, H5P_DEFAULT)) < 0)
goto out;
-
if ((tid = H5Aget_type(aid)) < 0)
goto out;
/* allocate and initialize */
- buf = (char **) HDmalloc((size_t) rank * sizeof(char *));
+ buf = (char **)HDmalloc((size_t)rank * sizeof(char *));
if (buf == NULL)
goto out;
@@ -1717,27 +1691,23 @@ H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size)
goto out;
/* do only if the label name exists for the dimension */
- if (buf[idx] != NULL)
- {
+ if (buf[idx] != NULL) {
/* get the real string length */
nbytes = HDstrlen(buf[idx]);
/* compute the string length which will fit into the user's buffer */
- copy_len = MIN(size-1, nbytes);
+ copy_len = MIN(size - 1, nbytes);
/* copy all/some of the name */
- if (label)
- {
+ if (label) {
HDmemcpy(label, buf[idx], copy_len);
/* terminate the string */
label[copy_len] = '\0';
}
-
}
/* free all the ptr's from the H5Aread() */
- for (i = 0; i < rank; i++)
- {
+ for (i = 0; i < rank; i++) {
if (buf[i])
HDfree(buf[i]);
}
@@ -1747,21 +1717,18 @@ H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size)
goto out;
if (H5Aclose(aid) < 0)
goto out;
- if (buf)
- {
+ if (buf) {
HDfree(buf);
buf = NULL;
}
- return (ssize_t) nbytes;
+ return (ssize_t)nbytes;
/* error zone */
out:
- if (buf)
- {
+ if (buf) {
/* free all the ptr's from the H5Aread() */
- for (i = 0; i < rank; i++)
- {
+ for (i = 0; i < rank; i++) {
if (buf[i])
HDfree(buf[i]);
}
@@ -1772,7 +1739,8 @@ out:
H5Sclose(sid);
H5Aclose(aid);
H5Tclose(tid);
- }H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
}
@@ -1803,26 +1771,26 @@ H5DSget_scale_name(hid_t did, char *name, size_t size)
size_t nbytes;
size_t copy_len;
int has_name;
- char *buf=NULL;
+ char * buf = NULL;
/*-------------------------------------------------------------------------
- * parameter checking
- *-------------------------------------------------------------------------
- */
+ * parameter checking
+ *-------------------------------------------------------------------------
+ */
/* get ID type */
if ((it = H5Iget_type(did)) < 0)
return FAIL;
- if (H5I_DATASET!=it)
+ if (H5I_DATASET != it)
return FAIL;
- if ((H5DSis_scale(did))<=0)
+ if ((H5DSis_scale(did)) <= 0)
return FAIL;
/*-------------------------------------------------------------------------
- * check if the DS has a name
- *-------------------------------------------------------------------------
- */
+ * check if the DS has a name
+ *-------------------------------------------------------------------------
+ */
/* try to find the attribute "NAME" on the >>DS<< dataset */
if ((has_name = H5LT_find_attribute(did, "NAME")) < 0)
@@ -1832,43 +1800,43 @@ H5DSget_scale_name(hid_t did, char *name, size_t size)
return 0;
/*-------------------------------------------------------------------------
- * open the attribute
- *-------------------------------------------------------------------------
- */
+ * open the attribute
+ *-------------------------------------------------------------------------
+ */
- if((aid = H5Aopen(did, "NAME", H5P_DEFAULT)) < 0)
+ if ((aid = H5Aopen(did, "NAME", H5P_DEFAULT)) < 0)
return FAIL;
/* get space */
- if((sid = H5Aget_space(aid)) < 0)
+ if ((sid = H5Aget_space(aid)) < 0)
goto out;
/* get type */
- if((tid = H5Aget_type(aid)) < 0)
+ if ((tid = H5Aget_type(aid)) < 0)
goto out;
/* get the size */
- if((nbytes = H5Tget_size(tid)) == 0)
+ if ((nbytes = H5Tget_size(tid)) == 0)
goto out;
/* allocate a temporary buffer */
- buf = (char*)HDmalloc(nbytes * sizeof(char));
+ buf = (char *)HDmalloc(nbytes * sizeof(char));
if (buf == NULL)
goto out;
/* read */
- if (H5Aread(aid,tid,buf) < 0)
+ if (H5Aread(aid, tid, buf) < 0)
goto out;
/* compute the string length which will fit into the user's buffer */
- copy_len = MIN(size-1, nbytes);
+ copy_len = MIN(size - 1, nbytes);
/* copy all/some of the name */
if (name) {
HDmemcpy(name, buf, copy_len);
/* terminate the string */
- name[copy_len]='\0';
+ name[copy_len] = '\0';
}
/* close */
@@ -1885,11 +1853,13 @@ H5DSget_scale_name(hid_t did, char *name, size_t size)
/* error zone */
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Aclose(aid);
H5Tclose(tid);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
if (buf)
HDfree(buf);
return FAIL;
@@ -1908,99 +1878,100 @@ out:
*
*-------------------------------------------------------------------------
*/
-htri_t H5DSis_scale(hid_t did)
+htri_t
+H5DSis_scale(hid_t did)
{
- hid_t tid = -1; /* attribute type ID */
- hid_t aid = -1; /* attribute ID */
- herr_t attr_class; /* has the "CLASS" attribute */
- htri_t is_ds = -1; /* set to "not a dimension scale" */
- H5I_type_t it; /* type of identifier */
- char *buf = NULL; /* buffer to read name of attribute */
+ hid_t tid = -1; /* attribute type ID */
+ hid_t aid = -1; /* attribute ID */
+ herr_t attr_class; /* has the "CLASS" attribute */
+ htri_t is_ds = -1; /* set to "not a dimension scale" */
+ H5I_type_t it; /* type of identifier */
+ char * buf = NULL; /* buffer to read name of attribute */
size_t string_size; /* size of storage for the attribute */
H5T_class_t type_class;
H5T_str_t strpad;
/*------------------------------------------------------------------------
- * parameter checking
- *-------------------------------------------------------------------------
- */
+ * parameter checking
+ *-------------------------------------------------------------------------
+ */
/* get ID type */
if ((it = H5Iget_type(did)) < 0)
goto out;
- if(H5I_DATASET != it)
+ if (H5I_DATASET != it)
goto out;
/* try to find the attribute "CLASS" on the dataset */
- if((attr_class = H5LT_find_attribute(did, "CLASS")) < 0)
+ if ((attr_class = H5LT_find_attribute(did, "CLASS")) < 0)
goto out;
- if(attr_class == 0) {
+ if (attr_class == 0) {
is_ds = 0;
goto out;
}
- else
- {
- if((aid = H5Aopen(did, "CLASS", H5P_DEFAULT)) < 0)
+ else {
+ if ((aid = H5Aopen(did, "CLASS", H5P_DEFAULT)) < 0)
goto out;
- if((tid = H5Aget_type(aid)) < 0)
+ if ((tid = H5Aget_type(aid)) < 0)
goto out;
- /* check to make sure attribute is a string;
+ /* check to make sure attribute is a string;
if not, then it is not dimension scale */
- if((type_class = H5Tget_class(tid)) < 0)
+ if ((type_class = H5Tget_class(tid)) < 0)
goto out;
- if(H5T_STRING != type_class) {
+ if (H5T_STRING != type_class) {
is_ds = 0;
goto out;
}
- /* check to make sure string is null-terminated;
+ /* check to make sure string is null-terminated;
if not, then it is not dimension scale */
- if((strpad = H5Tget_strpad(tid)) < 0 )
+ if ((strpad = H5Tget_strpad(tid)) < 0)
goto out;
- if(H5T_STR_NULLTERM != strpad) {
+ if (H5T_STR_NULLTERM != strpad) {
is_ds = 0;
goto out;
}
- /* According to Spec string is ASCII and its size should be 16 to hold
+ /* According to Spec string is ASCII and its size should be 16 to hold
"DIMENSION_SCALE" string */
- if((string_size = H5Tget_size(tid)) == 0)
- goto out;
- if(string_size != 16) {
- is_ds = 0;
+ if ((string_size = H5Tget_size(tid)) == 0)
+ goto out;
+ if (string_size != 16) {
+ is_ds = 0;
goto out;
}
- buf = (char*)HDmalloc((size_t)string_size * sizeof(char));
- if(buf == NULL)
+ buf = (char *)HDmalloc((size_t)string_size * sizeof(char));
+ if (buf == NULL)
goto out;
/* Read the attribute */
- if(H5Aread(aid, tid, buf) < 0)
+ if (H5Aread(aid, tid, buf) < 0)
goto out;
/* compare strings */
- if(HDstrncmp(buf, DIMENSION_SCALE_CLASS,
- MIN(HDstrlen(DIMENSION_SCALE_CLASS),HDstrlen(buf)))==0)
+ if (HDstrncmp(buf, DIMENSION_SCALE_CLASS, MIN(HDstrlen(DIMENSION_SCALE_CLASS), HDstrlen(buf))) == 0)
is_ds = 1;
HDfree(buf);
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
if (H5Aclose(aid) < 0)
goto out;
}
out:
- if(is_ds < 0) {
+ if (is_ds < 0) {
HDfree(buf);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Aclose(aid);
H5Tclose(tid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
}
return is_ds;
}
@@ -2024,84 +1995,84 @@ int
H5DSget_num_scales(hid_t did, unsigned int idx)
{
int has_dimlist;
- hid_t sid; /* space ID */
- hid_t tid = -1; /* attribute type ID */
- hid_t aid = -1; /* attribute ID */
- int rank; /* rank of dataset */
- hvl_t *buf = NULL; /* VL buffer to store in the attribute */
- H5I_type_t it; /* ID type */
+ hid_t sid; /* space ID */
+ hid_t tid = -1; /* attribute type ID */
+ hid_t aid = -1; /* attribute ID */
+ int rank; /* rank of dataset */
+ hvl_t * buf = NULL; /* VL buffer to store in the attribute */
+ H5I_type_t it; /* ID type */
int nscales;
/*-------------------------------------------------------------------------
- * parameter checking
- *-------------------------------------------------------------------------
- */
+ * parameter checking
+ *-------------------------------------------------------------------------
+ */
/* get ID type */
- if((it = H5Iget_type(did)) < 0)
+ if ((it = H5Iget_type(did)) < 0)
return FAIL;
- if(H5I_DATASET != it)
+ if (H5I_DATASET != it)
return FAIL;
/*-------------------------------------------------------------------------
- * the attribute "DIMENSION_LIST" on the >>data<< dataset must exist
- *-------------------------------------------------------------------------
- */
+ * the attribute "DIMENSION_LIST" on the >>data<< dataset must exist
+ *-------------------------------------------------------------------------
+ */
/* get dataset space */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
return FAIL;
/* get rank */
- if((rank = H5Sget_simple_extent_ndims(sid)) < 0)
+ if ((rank = H5Sget_simple_extent_ndims(sid)) < 0)
goto out;
/* close dataset space */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
/* dimemsion index IDX range checking */
- if(idx >= (unsigned int )rank)
+ if (idx >= (unsigned int)rank)
return FAIL;
/* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */
- if((has_dimlist = H5LT_find_attribute(did, DIMENSION_LIST)) < 0)
+ if ((has_dimlist = H5LT_find_attribute(did, DIMENSION_LIST)) < 0)
return FAIL;
/* it does not exist */
- if(has_dimlist == 0)
+ if (has_dimlist == 0)
return 0;
/*-------------------------------------------------------------------------
- * the attribute exists, open it
- *-------------------------------------------------------------------------
- */
+ * the attribute exists, open it
+ *-------------------------------------------------------------------------
+ */
else {
- if((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0)
+ if ((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0)
goto out;
- if((tid = H5Aget_type(aid)) < 0)
+ if ((tid = H5Aget_type(aid)) < 0)
goto out;
- if((sid = H5Aget_space(aid)) < 0)
+ if ((sid = H5Aget_space(aid)) < 0)
goto out;
/* allocate and initialize the VL */
buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t));
- if(buf == NULL)
+ if (buf == NULL)
goto out;
/* read */
- if(H5Aread(aid, tid, buf) < 0)
+ if (H5Aread(aid, tid, buf) < 0)
goto out;
nscales = (int)buf[idx].len;
/* close */
- if(H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0)
+ if (H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0)
goto out;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
HDfree(buf);
buf = NULL;
@@ -2111,13 +2082,15 @@ H5DSget_num_scales(hid_t did, unsigned int idx)
/* error zone */
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Aclose(aid);
H5Tclose(tid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(buf)
+ if (buf)
HDfree(buf);
return FAIL;
@@ -2139,51 +2112,50 @@ out:
static herr_t
H5DS_is_reserved(hid_t did)
{
- int has_class;
- hid_t tid = -1;
- hid_t aid = -1;
- char *buf; /* Name of attribute */
+ int has_class;
+ hid_t tid = -1;
+ hid_t aid = -1;
+ char * buf; /* Name of attribute */
hsize_t storage_size; /* Size of storage for attribute */
- herr_t ret;
+ herr_t ret;
/* try to find the attribute "CLASS" on the dataset */
- if((has_class = H5LT_find_attribute(did, "CLASS")) < 0)
+ if ((has_class = H5LT_find_attribute(did, "CLASS")) < 0)
return -1;
- if(has_class == 0)
+ if (has_class == 0)
return 0;
- assert(has_class == 1);
- if((aid = H5Aopen(did, "CLASS", H5P_DEFAULT)) < 0)
+ assert(has_class == 1);
+ if ((aid = H5Aopen(did, "CLASS", H5P_DEFAULT)) < 0)
goto out;
- if((tid = H5Aget_type(aid)) < 0)
+ if ((tid = H5Aget_type(aid)) < 0)
goto out;
/* check to make sure attribute is a string */
- if(H5T_STRING != H5Tget_class(tid))
- goto out;
+ if (H5T_STRING != H5Tget_class(tid))
+ goto out;
/* check to make sure string is null-terminated */
- if(H5T_STR_NULLTERM != H5Tget_strpad(tid))
- goto out;
+ if (H5T_STR_NULLTERM != H5Tget_strpad(tid))
+ goto out;
/* allocate buffer large enough to hold string */
- if((storage_size = H5Aget_storage_size(aid)) == 0)
- goto out;
+ if ((storage_size = H5Aget_storage_size(aid)) == 0)
+ goto out;
- buf = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1);
- if(buf == NULL)
- goto out;
+ buf = (char *)HDmalloc((size_t)storage_size * sizeof(char) + 1);
+ if (buf == NULL)
+ goto out;
/* Read the attribute */
- if(H5Aread(aid, tid, buf) < 0)
- goto out;
-
+ if (H5Aread(aid, tid, buf) < 0)
+ goto out;
- if(HDstrncmp(buf, IMAGE_CLASS, MIN(HDstrlen(IMAGE_CLASS),HDstrlen(buf))) == 0 ||
- HDstrncmp(buf, PALETTE_CLASS, MIN(HDstrlen(PALETTE_CLASS),HDstrlen(buf))) == 0 ||
- HDstrncmp(buf, TABLE_CLASS, MIN(HDstrlen(TABLE_CLASS),HDstrlen(buf))) == 0 )
+ if (HDstrncmp(buf, IMAGE_CLASS, MIN(HDstrlen(IMAGE_CLASS), HDstrlen(buf))) == 0 ||
+ HDstrncmp(buf, PALETTE_CLASS, MIN(HDstrlen(PALETTE_CLASS), HDstrlen(buf))) == 0 ||
+ HDstrncmp(buf, TABLE_CLASS, MIN(HDstrlen(TABLE_CLASS), HDstrlen(buf))) == 0)
ret = 1;
else
ret = 0;
@@ -2196,7 +2168,6 @@ H5DS_is_reserved(hid_t did)
if (H5Aclose(aid) < 0)
goto out;
-
return ret;
/* error zone */
@@ -2205,7 +2176,8 @@ out:
{
H5Tclose(tid);
H5Aclose(aid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
}
@@ -2232,20 +2204,18 @@ H5DS_get_REFLIST_type(void)
used to store ds_list_t structure in the REFERENCE_LIST
attribute */
- if((ntid_t = H5Tcreate(H5T_COMPOUND, sizeof(ds_list_t))) < 0)
+ if ((ntid_t = H5Tcreate(H5T_COMPOUND, sizeof(ds_list_t))) < 0)
goto out;
- if(H5Tinsert(ntid_t, "dataset", HOFFSET(ds_list_t,ref), H5T_STD_REF_OBJ) < 0)
+ if (H5Tinsert(ntid_t, "dataset", HOFFSET(ds_list_t, ref), H5T_STD_REF_OBJ) < 0)
goto out;
- if(H5Tinsert(ntid_t, "dimension", HOFFSET(ds_list_t, dim_idx), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(ntid_t, "dimension", HOFFSET(ds_list_t, dim_idx), H5T_NATIVE_INT) < 0)
goto out;
return ntid_t;
out:
- H5E_BEGIN_TRY {
- H5Tclose(ntid_t);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Tclose(ntid_t); }
+ H5E_END_TRY;
return FAIL;
}
-
diff --git a/hl/src/H5DSprivate.h b/hl/src/H5DSprivate.h
index 9d20d48..58bb82e 100644
--- a/hl/src/H5DSprivate.h
+++ b/hl/src/H5DSprivate.h
@@ -20,21 +20,15 @@
/* public LT prototypes */
#include "H5DSpublic.h"
-
-
-
/* attribute type of a DS dataset */
typedef struct ds_list_t {
- hobj_ref_t ref; /* object reference */
- unsigned int dim_idx; /* dimension index of the dataset */
+ hobj_ref_t ref; /* object reference */
+ unsigned int dim_idx; /* dimension index of the dataset */
} ds_list_t;
-
/*-------------------------------------------------------------------------
* private functions
*-------------------------------------------------------------------------
*/
-
#endif
-
diff --git a/hl/src/H5DSpublic.h b/hl/src/H5DSpublic.h
index 615122c..0c29a36 100644
--- a/hl/src/H5DSpublic.h
+++ b/hl/src/H5DSpublic.h
@@ -14,61 +14,37 @@
#ifndef _H5DSpublic_H
#define _H5DSpublic_H
-
-
#define DIMENSION_SCALE_CLASS "DIMENSION_SCALE"
#define DIMENSION_LIST "DIMENSION_LIST"
#define REFERENCE_LIST "REFERENCE_LIST"
#define DIMENSION_LABELS "DIMENSION_LABELS"
-
-typedef herr_t (*H5DS_iterate_t)(hid_t dset, unsigned dim, hid_t scale, void *visitor_data);
-
+typedef herr_t (*H5DS_iterate_t)(hid_t dset, unsigned dim, hid_t scale, void *visitor_data);
#ifdef __cplusplus
extern "C" {
#endif
-H5_HLDLL herr_t H5DSattach_scale( hid_t did,
- hid_t dsid,
- unsigned int idx);
-
-H5_HLDLL herr_t H5DSdetach_scale( hid_t did,
- hid_t dsid,
- unsigned int idx);
-
-H5_HLDLL herr_t H5DSset_scale( hid_t dsid,
- const char *dimname);
+H5_HLDLL herr_t H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx);
-H5_HLDLL int H5DSget_num_scales( hid_t did,
- unsigned int dim);
+H5_HLDLL herr_t H5DSdetach_scale(hid_t did, hid_t dsid, unsigned int idx);
-H5_HLDLL herr_t H5DSset_label( hid_t did,
- unsigned int idx,
- const char *label);
+H5_HLDLL herr_t H5DSset_scale(hid_t dsid, const char *dimname);
-H5_HLDLL ssize_t H5DSget_label( hid_t did,
- unsigned int idx,
- char *label,
- size_t size);
+H5_HLDLL int H5DSget_num_scales(hid_t did, unsigned int dim);
-H5_HLDLL ssize_t H5DSget_scale_name( hid_t did,
- char *name,
- size_t size);
+H5_HLDLL herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label);
-H5_HLDLL htri_t H5DSis_scale( hid_t did);
+H5_HLDLL ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size);
-H5_HLDLL herr_t H5DSiterate_scales( hid_t did,
- unsigned int dim,
- int *idx,
- H5DS_iterate_t visitor,
- void *visitor_data);
+H5_HLDLL ssize_t H5DSget_scale_name(hid_t did, char *name, size_t size);
-H5_HLDLL htri_t H5DSis_attached( hid_t did,
- hid_t dsid,
- unsigned int idx);
+H5_HLDLL htri_t H5DSis_scale(hid_t did);
+H5_HLDLL herr_t H5DSiterate_scales(hid_t did, unsigned int dim, int *idx, H5DS_iterate_t visitor,
+ void *visitor_data);
+H5_HLDLL htri_t H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx);
#ifdef __cplusplus
}
diff --git a/hl/src/H5HLprivate2.h b/hl/src/H5HLprivate2.h
index 45591e8..989c799 100644
--- a/hl/src/H5HLprivate2.h
+++ b/hl/src/H5HLprivate2.h
@@ -24,4 +24,3 @@
#include "H5private.h"
#endif /* _H5HLprivate2_H */
-
diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c
index 2b292dc..fb2ccb3 100644
--- a/hl/src/H5IM.c
+++ b/hl/src/H5IM.c
@@ -1,45 +1,43 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "H5IMprivate.h"
#include "H5LTprivate.h"
/*-------------------------------------------------------------------------
-* Function: H5IMmake_image_8bit
-*
-* Purpose: Creates and writes an image an 8 bit image
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente Nunes
-*
-* Date: June 13, 2001
-*
-* Comments:
-* based on HDF5 Image and Palette Specification
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
-herr_t H5IMmake_image_8bit( hid_t loc_id,
- const char *dset_name,
- hsize_t width,
- hsize_t height,
- const unsigned char *buf )
+ * Function: H5IMmake_image_8bit
+ *
+ * Purpose: Creates and writes an image an 8 bit image
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente Nunes
+ *
+ * Date: June 13, 2001
+ *
+ * Comments:
+ * based on HDF5 Image and Palette Specification
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+herr_t
+H5IMmake_image_8bit(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height,
+ const unsigned char *buf)
{
- hsize_t dims[IMAGE8_RANK];
+ hsize_t dims[IMAGE8_RANK];
/* check the arguments */
if (dset_name == NULL)
@@ -50,56 +48,53 @@ herr_t H5IMmake_image_8bit( hid_t loc_id,
dims[1] = width;
/* Make the dataset */
- if ( H5LTmake_dataset( loc_id, dset_name, IMAGE8_RANK, dims, H5T_NATIVE_UCHAR, buf ) < 0)
+ if (H5LTmake_dataset(loc_id, dset_name, IMAGE8_RANK, dims, H5T_NATIVE_UCHAR, buf) < 0)
return -1;
/* Attach the CLASS attribute */
- if ( H5LTset_attribute_string( loc_id, dset_name, "CLASS", IMAGE_CLASS ) < 0)
+ if (H5LTset_attribute_string(loc_id, dset_name, "CLASS", IMAGE_CLASS) < 0)
return -1;
/* Attach the VERSION attribute */
- if ( H5LTset_attribute_string( loc_id, dset_name, "IMAGE_VERSION", IMAGE_VERSION ) < 0)
+ if (H5LTset_attribute_string(loc_id, dset_name, "IMAGE_VERSION", IMAGE_VERSION) < 0)
return -1;
/* Attach the IMAGE_SUBCLASS attribute */
- if ( H5LTset_attribute_string( loc_id, dset_name, "IMAGE_SUBCLASS", "IMAGE_INDEXED" ) < 0)
+ if (H5LTset_attribute_string(loc_id, dset_name, "IMAGE_SUBCLASS", "IMAGE_INDEXED") < 0)
return -1;
return 0;
}
/*-------------------------------------------------------------------------
-* Function: H5IMmake_image_24bit
-*
-* Purpose:
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente Nunes
-*
-* Date: June 13, 2001
-*
-* Comments:
-* based on HDF5 Image and Palette Specification
-*
-* Interlace Mode Dimensions in the Dataspace
-* INTERLACE_PIXEL [height][width][pixel components]
-* INTERLACE_PLANE [pixel components][height][width]
-*
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
-herr_t H5IMmake_image_24bit( hid_t loc_id,
- const char *dset_name,
- hsize_t width,
- hsize_t height,
- const char *interlace,
- const unsigned char *buf )
+ * Function: H5IMmake_image_24bit
+ *
+ * Purpose:
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente Nunes
+ *
+ * Date: June 13, 2001
+ *
+ * Comments:
+ * based on HDF5 Image and Palette Specification
+ *
+ * Interlace Mode Dimensions in the Dataspace
+ * INTERLACE_PIXEL [height][width][pixel components]
+ * INTERLACE_PLANE [pixel components][height][width]
+ *
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+herr_t
+H5IMmake_image_24bit(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height,
+ const char *interlace, const unsigned char *buf)
{
- hsize_t dims[IMAGE24_RANK];
+ hsize_t dims[IMAGE24_RANK];
/* check the arguments */
if (interlace == NULL)
@@ -107,73 +102,65 @@ herr_t H5IMmake_image_24bit( hid_t loc_id,
if (dset_name == NULL)
return -1;
-
/* Initialize the image dimensions */
- if ( HDstrncmp( interlace, "INTERLACE_PIXEL",15 ) == 0 )
- {
+ if (HDstrncmp(interlace, "INTERLACE_PIXEL", 15) == 0) {
/* Number of color planes is defined as the third dimension */
dims[0] = height;
dims[1] = width;
dims[2] = IMAGE24_RANK;
}
+ else if (HDstrncmp(interlace, "INTERLACE_PLANE", 15) == 0) {
+ /* Number of color planes is defined as the first dimension */
+ dims[0] = IMAGE24_RANK;
+ dims[1] = height;
+ dims[2] = width;
+ }
else
- if ( HDstrncmp( interlace, "INTERLACE_PLANE",15 ) == 0 )
- {
- /* Number of color planes is defined as the first dimension */
- dims[0] = IMAGE24_RANK;
- dims[1] = height;
- dims[2] = width;
- }
- else return -1;
-
- /* Make the dataset */
- if ( H5LTmake_dataset( loc_id, dset_name, IMAGE24_RANK, dims, H5T_NATIVE_UCHAR, buf ) < 0)
- return -1;
+ return -1;
- /* Attach the CLASS attribute */
- if ( H5LTset_attribute_string( loc_id, dset_name, "CLASS", IMAGE_CLASS ) < 0)
- return -1;
+ /* Make the dataset */
+ if (H5LTmake_dataset(loc_id, dset_name, IMAGE24_RANK, dims, H5T_NATIVE_UCHAR, buf) < 0)
+ return -1;
- /* Attach the VERSION attribute */
- if ( H5LTset_attribute_string( loc_id, dset_name, "IMAGE_VERSION", IMAGE_VERSION ) < 0)
- return -1;
+ /* Attach the CLASS attribute */
+ if (H5LTset_attribute_string(loc_id, dset_name, "CLASS", IMAGE_CLASS) < 0)
+ return -1;
- /* Attach the IMAGE_SUBCLASS attribute */
- if ( H5LTset_attribute_string( loc_id, dset_name, "IMAGE_SUBCLASS", "IMAGE_TRUECOLOR" ) < 0)
- return -1;
+ /* Attach the VERSION attribute */
+ if (H5LTset_attribute_string(loc_id, dset_name, "IMAGE_VERSION", IMAGE_VERSION) < 0)
+ return -1;
- /* Attach the INTERLACE_MODE attribute. This attributes is only for true color images */
- if ( H5LTset_attribute_string( loc_id, dset_name, "INTERLACE_MODE", interlace ) < 0)
- return -1;
+ /* Attach the IMAGE_SUBCLASS attribute */
+ if (H5LTset_attribute_string(loc_id, dset_name, "IMAGE_SUBCLASS", "IMAGE_TRUECOLOR") < 0)
+ return -1;
- return 0;
+ /* Attach the INTERLACE_MODE attribute. This attributes is only for true color images */
+ if (H5LTset_attribute_string(loc_id, dset_name, "INTERLACE_MODE", interlace) < 0)
+ return -1;
+ return 0;
}
-
-
/*-------------------------------------------------------------------------
-* Function: find_palette
-*
-* Purpose: operator function used by H5LT_find_palette
-*
-* Return:
-*
-* Programmer: Pedro Vicente Nunes
-*
-* Date: May 28, 2001
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-static herr_t find_palette(hid_t loc_id,
- const char *name,
- const H5A_info_t *ainfo,
- void *op_data)
+ * Function: find_palette
+ *
+ * Purpose: operator function used by H5LT_find_palette
+ *
+ * Return:
+ *
+ * Programmer: Pedro Vicente Nunes
+ *
+ * Date: May 28, 2001
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+find_palette(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *op_data)
{
int ret = H5_ITER_CONT;
@@ -182,93 +169,90 @@ static herr_t find_palette(hid_t loc_id,
return -1;
/* Shut compiler up */
- loc_id = loc_id; ainfo = ainfo; op_data = op_data;
+ loc_id = loc_id;
+ ainfo = ainfo;
+ op_data = op_data;
/* Define a positive value for return value if the attribute was found. This will
- * cause the iterator to immediately return that positive value,
- * indicating short-circuit success
- */
- if(HDstrncmp(name, "PALETTE",7) == 0)
+ * cause the iterator to immediately return that positive value,
+ * indicating short-circuit success
+ */
+ if (HDstrncmp(name, "PALETTE", 7) == 0)
ret = H5_ITER_STOP;
return ret;
}
-
/*-------------------------------------------------------------------------
-* Function: H5IM_find_palette
-*
-* Purpose: Private function. Find the attribute "PALETTE" in the image dataset
-*
-* Return: Success: 1, Failure: 0
-*
-* Programmer: Pedro Vicente Nunes
-*
-* Date: May 11, 2001
-*
-* Comments:
-* The function uses H5Aiterate2 with the operator function find_palette
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
-herr_t H5IM_find_palette( hid_t loc_id )
+ * Function: H5IM_find_palette
+ *
+ * Purpose: Private function. Find the attribute "PALETTE" in the image dataset
+ *
+ * Return: Success: 1, Failure: 0
+ *
+ * Programmer: Pedro Vicente Nunes
+ *
+ * Date: May 11, 2001
+ *
+ * Comments:
+ * The function uses H5Aiterate2 with the operator function find_palette
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+herr_t
+H5IM_find_palette(hid_t loc_id)
{
return H5Aiterate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, find_palette, NULL);
}
-
/*-------------------------------------------------------------------------
-* Function: H5IMget_image_info
-*
-* Purpose: Gets information about an image dataset (dimensions, interlace mode
-* and number of associated palettes).
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente Nunes
-*
-* Date: July 25, 2001
-*
-* Comments:
-* based on HDF5 Image and Palette Specification
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
-herr_t H5IMget_image_info( hid_t loc_id,
- const char *dset_name,
- hsize_t *width,
- hsize_t *height,
- hsize_t *planes,
- char *interlace,
- hssize_t *npals )
+ * Function: H5IMget_image_info
+ *
+ * Purpose: Gets information about an image dataset (dimensions, interlace mode
+ * and number of associated palettes).
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente Nunes
+ *
+ * Date: July 25, 2001
+ *
+ * Comments:
+ * based on HDF5 Image and Palette Specification
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+herr_t
+H5IMget_image_info(hid_t loc_id, const char *dset_name, hsize_t *width, hsize_t *height, hsize_t *planes,
+ char *interlace, hssize_t *npals)
{
- hid_t did = -1;
- hid_t sid = -1;
+ hid_t did = -1;
+ hid_t sid = -1;
hsize_t dims[IMAGE24_RANK];
- hid_t aid = -1;
- hid_t asid = -1;
- hid_t atid = -1;
+ hid_t aid = -1;
+ hid_t asid = -1;
+ hid_t atid = -1;
H5T_class_t aclass;
int has_pal;
int has_attr;
/* check the arguments */
if (dset_name == NULL)
- return -1;
+ return -1;
if (interlace == NULL)
- return -1;
+ return -1;
/*assume initially we have no palettes attached*/
*npals = 0;
/* Open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
return -1;
/* Try to find the attribute "INTERLACE_MODE" on the >>image<< dataset */
@@ -276,58 +260,55 @@ herr_t H5IMget_image_info( hid_t loc_id,
goto out;
/* It exists, get it */
- if(has_attr == 1)
- {
+ if (has_attr == 1) {
- if((aid = H5Aopen(did, "INTERLACE_MODE", H5P_DEFAULT)) < 0)
+ if ((aid = H5Aopen(did, "INTERLACE_MODE", H5P_DEFAULT)) < 0)
goto out;
- if((atid = H5Aget_type(aid)) < 0)
+ if ((atid = H5Aget_type(aid)) < 0)
goto out;
- if(H5Aread(aid, atid, interlace) < 0)
+ if (H5Aread(aid, atid, interlace) < 0)
goto out;
- if(H5Tclose(atid) < 0)
+ if (H5Tclose(atid) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
}
/* Get the dataspace handle */
- if ( (sid = H5Dget_space( did )) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto out;
/* Get dimensions */
- if ( H5Sget_simple_extent_dims( sid, dims, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
goto out;
/* Initialize the image dimensions */
- if ( has_attr == 1 )
- /* This is a 24 bit image */
+ if (has_attr == 1)
+ /* This is a 24 bit image */
{
- if ( HDstrncmp( interlace, "INTERLACE_PIXEL", 15 ) == 0 )
- {
+ if (HDstrncmp(interlace, "INTERLACE_PIXEL", 15) == 0) {
/* Number of color planes is defined as the third dimension */
*height = dims[0];
*width = dims[1];
*planes = dims[2];
}
+ else if (HDstrncmp(interlace, "INTERLACE_PLANE", 15) == 0) {
+ /* Number of color planes is defined as the first dimension */
+ *planes = dims[0];
+ *height = dims[1];
+ *width = dims[2];
+ }
else
- if ( HDstrncmp( interlace, "INTERLACE_PLANE", 15 ) == 0 )
- {
- /* Number of color planes is defined as the first dimension */
- *planes = dims[0];
- *height = dims[1];
- *width = dims[2];
- }
- else return -1;
+ return -1;
}
else
- /* This is a 8 bit image */
+ /* This is a 8 bit image */
{
*height = dims[0];
*width = dims[1];
@@ -335,147 +316,135 @@ herr_t H5IMget_image_info( hid_t loc_id,
}
/* Close */
- if ( H5Sclose( sid ) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
-
/* Get number of palettes */
-
/* Try to find the attribute "PALETTE" on the >>image<< dataset */
has_pal = H5IM_find_palette(did);
- if(has_pal == 1)
- {
+ if (has_pal == 1) {
- if((aid = H5Aopen(did, "PALETTE", H5P_DEFAULT)) < 0)
+ if ((aid = H5Aopen(did, "PALETTE", H5P_DEFAULT)) < 0)
goto out;
- if((atid = H5Aget_type(aid)) < 0)
+ if ((atid = H5Aget_type(aid)) < 0)
goto out;
- if((aclass = H5Tget_class(atid)) < 0)
+ if ((aclass = H5Tget_class(atid)) < 0)
goto out;
/* Check if it is really a reference */
- if(aclass == H5T_REFERENCE)
- {
+ if (aclass == H5T_REFERENCE) {
/* Get the reference(s) */
- if ( (asid = H5Aget_space( aid )) < 0)
+ if ((asid = H5Aget_space(aid)) < 0)
goto out;
- *npals = H5Sget_simple_extent_npoints( asid );
+ *npals = H5Sget_simple_extent_npoints(asid);
- if ( H5Sclose( asid ) < 0)
+ if (H5Sclose(asid) < 0)
goto out;
} /* H5T_REFERENCE */
- if ( H5Tclose( atid ) < 0)
+ if (H5Tclose(atid) < 0)
goto out;
/* Close the attribute. */
- if ( H5Aclose( aid ) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
-
}
/* End access to the dataset and release resources used by it. */
- if ( H5Dclose( did ) < 0)
+ if (H5Dclose(did) < 0)
goto out;
return 0;
out:
- if(did > 0)
- H5Dclose( did );
- if(aid > 0)
- H5Aclose( aid );
- if(asid > 0)
- H5Sclose( asid );
- if(atid > 0)
- H5Tclose( atid );
+ if (did > 0)
+ H5Dclose(did);
+ if (aid > 0)
+ H5Aclose(aid);
+ if (asid > 0)
+ H5Sclose(asid);
+ if (atid > 0)
+ H5Tclose(atid);
return -1;
-
}
-
/*-------------------------------------------------------------------------
-* Function: H5IMread_image
-*
-* Purpose: Reads image data from disk.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente Nunes
-*
-* Date: June 13, 2001
-*
-* Comments:
-* based on HDF5 Image and Palette Specification
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
-herr_t H5IMread_image( hid_t loc_id,
- const char *dset_name,
- unsigned char *buf )
+ * Function: H5IMread_image
+ *
+ * Purpose: Reads image data from disk.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente Nunes
+ *
+ * Date: June 13, 2001
+ *
+ * Comments:
+ * based on HDF5 Image and Palette Specification
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+herr_t
+H5IMread_image(hid_t loc_id, const char *dset_name, unsigned char *buf)
{
- hid_t did;
+ hid_t did;
/* check the arguments */
if (dset_name == NULL)
- return -1;
+ return -1;
/* Open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
return -1;
/* Read */
- if ( H5Dread( did, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf ) < 0)
+ if (H5Dread(did, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
/* End access to the dataset and release resources used by it. */
- if ( H5Dclose( did ) )
+ if (H5Dclose(did))
return -1;
return 0;
out:
- H5Dclose( did );
+ H5Dclose(did);
return -1;
-
}
-
/*-------------------------------------------------------------------------
-* Function: H5IMmake_palette
-*
-* Purpose: Creates and writes a palette.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente Nunes
-*
-* Date: May 01, 2001
-*
-* Comments:
-* based on HDF5 Image and Palette Specification
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
-herr_t H5IMmake_palette( hid_t loc_id,
- const char *pal_name,
- const hsize_t *pal_dims,
- const unsigned char *pal_data )
+ * Function: H5IMmake_palette
+ *
+ * Purpose: Creates and writes a palette.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente Nunes
+ *
+ * Date: May 01, 2001
+ *
+ * Comments:
+ * based on HDF5 Image and Palette Specification
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+herr_t
+H5IMmake_palette(hid_t loc_id, const char *pal_name, const hsize_t *pal_dims, const unsigned char *pal_data)
{
@@ -483,231 +452,221 @@ herr_t H5IMmake_palette( hid_t loc_id,
/* check the arguments */
if (pal_name == NULL)
- return -1;
+ return -1;
/* Check if the dataset already exists */
- has_pal = H5LTfind_dataset( loc_id, pal_name );
+ has_pal = H5LTfind_dataset(loc_id, pal_name);
/* It exists. Return */
- if ( has_pal == 1 )
+ if (has_pal == 1)
return 0;
/* Make the palette dataset. */
- if ( H5LTmake_dataset( loc_id, pal_name, 2, pal_dims, H5T_NATIVE_UCHAR, pal_data ) < 0 )
+ if (H5LTmake_dataset(loc_id, pal_name, 2, pal_dims, H5T_NATIVE_UCHAR, pal_data) < 0)
return -1;
/* Attach the attribute "CLASS" to the >>palette<< dataset*/
- if ( H5LTset_attribute_string( loc_id, pal_name, "CLASS", PALETTE_CLASS ) < 0)
+ if (H5LTset_attribute_string(loc_id, pal_name, "CLASS", PALETTE_CLASS) < 0)
return -1;
/* Attach the attribute "PAL_VERSION" to the >>palette<< dataset*/
- if ( H5LTset_attribute_string( loc_id, pal_name, "PAL_VERSION", "1.2" ) < 0)
+ if (H5LTset_attribute_string(loc_id, pal_name, "PAL_VERSION", "1.2") < 0)
return -1;
return 0;
-
}
-
/*-------------------------------------------------------------------------
-* Function: H5IMlink_palette
-*
-* Purpose: This function attaches a palette to an existing image dataset
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente Nunes
-*
-* Date: May 01, 2001
-*
-* Comments:
-* based on HDF5 Image and Palette Specification
-*
-* An image (dataset) within an HDF5 file may optionally specify an array of
-* palettes to be viewed with. The dataset will have an attribute
-* which contains an array of object reference pointers which refer to palettes in the file.
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
-herr_t H5IMlink_palette( hid_t loc_id,
- const char *image_name,
- const char *pal_name )
+ * Function: H5IMlink_palette
+ *
+ * Purpose: This function attaches a palette to an existing image dataset
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente Nunes
+ *
+ * Date: May 01, 2001
+ *
+ * Comments:
+ * based on HDF5 Image and Palette Specification
+ *
+ * An image (dataset) within an HDF5 file may optionally specify an array of
+ * palettes to be viewed with. The dataset will have an attribute
+ * which contains an array of object reference pointers which refer to palettes in the file.
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+herr_t
+H5IMlink_palette(hid_t loc_id, const char *image_name, const char *pal_name)
{
hid_t did;
- hid_t atid=-1;
- hid_t aid=-1;
- hid_t asid=-1;
- hobj_ref_t ref; /* write a new reference */
- hobj_ref_t *refbuf; /* buffer to read references */
+ hid_t atid = -1;
+ hid_t aid = -1;
+ hid_t asid = -1;
+ hobj_ref_t ref; /* write a new reference */
+ hobj_ref_t *refbuf; /* buffer to read references */
hssize_t n_refs;
hsize_t dim_ref;
int ok_pal;
-
/* check the arguments */
if (image_name == NULL)
- return -1;
+ return -1;
if (pal_name == NULL)
- return -1;
+ return -1;
/* The image dataset may or may not have the attribute "PALETTE"
- * First we try to open to see if it is already there; if not, it is created.
- * If it exists, the array of references is extended to hold the reference
- * to the new palette
- */
+ * First we try to open to see if it is already there; if not, it is created.
+ * If it exists, the array of references is extended to hold the reference
+ * to the new palette
+ */
/* First we get the image id */
- if((did = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0)
return -1;
/* Try to find the attribute "PALETTE" on the >>image<< dataset */
- ok_pal = H5LT_find_attribute( did, "PALETTE" );
+ ok_pal = H5LT_find_attribute(did, "PALETTE");
/*-------------------------------------------------------------------------
- * It does not exist. We create the attribute and one reference
- *-------------------------------------------------------------------------
- */
- if(ok_pal == 0 )
- {
- if((asid = H5Screate(H5S_SCALAR)) < 0)
+ * It does not exist. We create the attribute and one reference
+ *-------------------------------------------------------------------------
+ */
+ if (ok_pal == 0) {
+ if ((asid = H5Screate(H5S_SCALAR)) < 0)
goto out;
/* Create the attribute type for the reference */
- if((atid = H5Tcopy(H5T_STD_REF_OBJ)) < 0)
+ if ((atid = H5Tcopy(H5T_STD_REF_OBJ)) < 0)
goto out;
/* Create the attribute "PALETTE" to be attached to the image*/
- if((aid = H5Acreate2(did, "PALETTE", atid, asid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(did, "PALETTE", atid, asid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* Create a reference. The reference is created on the local id. */
- if(H5Rcreate(&ref, loc_id, pal_name, H5R_OBJECT, (hid_t)-1) < 0)
+ if (H5Rcreate(&ref, loc_id, pal_name, H5R_OBJECT, (hid_t)-1) < 0)
goto out;
/* Write the attribute with the reference */
- if(H5Awrite(aid, atid, &ref) < 0)
+ if (H5Awrite(aid, atid, &ref) < 0)
goto out;
/* close */
- if(H5Sclose(asid) < 0)
+ if (H5Sclose(asid) < 0)
goto out;
- if(H5Tclose(atid) < 0)
+ if (H5Tclose(atid) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
-
}
/*-------------------------------------------------------------------------
- * The attribute already exists, open it
- *-------------------------------------------------------------------------
- */
- else if(ok_pal == 1)
- {
- if((aid = H5Aopen(did, "PALETTE", H5P_DEFAULT)) < 0)
+ * The attribute already exists, open it
+ *-------------------------------------------------------------------------
+ */
+ else if (ok_pal == 1) {
+ if ((aid = H5Aopen(did, "PALETTE", H5P_DEFAULT)) < 0)
goto out;
- if((atid = H5Aget_type(aid)) < 0)
+ if ((atid = H5Aget_type(aid)) < 0)
goto out;
- if(H5Tget_class(atid) < 0)
+ if (H5Tget_class(atid) < 0)
goto out;
/* Get and save the old reference(s) */
- if((asid = H5Aget_space(aid)) < 0)
+ if ((asid = H5Aget_space(aid)) < 0)
goto out;
n_refs = H5Sget_simple_extent_npoints(asid);
dim_ref = (hsize_t)n_refs + 1;
- refbuf = (hobj_ref_t*)HDmalloc( sizeof(hobj_ref_t) * (size_t)dim_ref );
+ refbuf = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * (size_t)dim_ref);
- if ( H5Aread( aid, atid, refbuf ) < 0)
+ if (H5Aread(aid, atid, refbuf) < 0)
goto out;
/* The attribute must be deleted, in order to the new one can reflect the changes*/
- if(H5Adelete(did, "PALETTE") < 0)
+ if (H5Adelete(did, "PALETTE") < 0)
goto out;
/* Create a new reference for this palette. */
- if ( H5Rcreate( &ref, loc_id, pal_name, H5R_OBJECT, (hid_t)-1 ) < 0)
+ if (H5Rcreate(&ref, loc_id, pal_name, H5R_OBJECT, (hid_t)-1) < 0)
goto out;
refbuf[n_refs] = ref;
/* Create the data space for the new references */
- if(H5Sclose(asid) < 0)
+ if (H5Sclose(asid) < 0)
goto out;
- if((asid = H5Screate_simple(1, &dim_ref, NULL)) < 0)
+ if ((asid = H5Screate_simple(1, &dim_ref, NULL)) < 0)
goto out;
/* Create the attribute again with the changes of space */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
- if((aid = H5Acreate2(did, "PALETTE", atid, asid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(did, "PALETTE", atid, asid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* Write the attribute with the new references */
- if(H5Awrite(aid, atid, refbuf) < 0)
+ if (H5Awrite(aid, atid, refbuf) < 0)
goto out;
/* close */
- if(H5Sclose(asid) < 0)
+ if (H5Sclose(asid) < 0)
goto out;
- if(H5Tclose(atid) < 0)
+ if (H5Tclose(atid) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
- HDfree( refbuf );
+ HDfree(refbuf);
} /* ok_pal == 1 */
/* Close the image dataset. */
- if ( H5Dclose( did ) < 0)
+ if (H5Dclose(did) < 0)
return -1;
return 0;
out:
- H5Dclose( did );
- H5Sclose( asid );
- H5Tclose( atid );
- H5Aclose( aid );
+ H5Dclose(did);
+ H5Sclose(asid);
+ H5Tclose(atid);
+ H5Aclose(aid);
return -1;
}
-
-
/*-------------------------------------------------------------------------
-* Function: H5IMunlink_palette
-*
-* Purpose: This function dettaches a palette from an existing image dataset
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente Nunes
-*
-* Date: September 10, 2001
-*
-* Comments:
-* based on HDF5 Image and Palette Specification
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
-herr_t H5IMunlink_palette( hid_t loc_id,
- const char *image_name,
- const char *pal_name )
+ * Function: H5IMunlink_palette
+ *
+ * Purpose: This function dettaches a palette from an existing image dataset
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente Nunes
+ *
+ * Date: September 10, 2001
+ *
+ * Comments:
+ * based on HDF5 Image and Palette Specification
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+herr_t
+H5IMunlink_palette(hid_t loc_id, const char *image_name, const char *pal_name)
{
hid_t did;
hid_t atid;
@@ -716,98 +675,94 @@ herr_t H5IMunlink_palette( hid_t loc_id,
int ok_pal, has_pal;
/* check the arguments */
- if(image_name == NULL)
- return -1;
- if(pal_name == NULL)
- return -1;
+ if (image_name == NULL)
+ return -1;
+ if (pal_name == NULL)
+ return -1;
/* Try to find the palette dataset */
- has_pal = H5LTfind_dataset( loc_id, pal_name );
+ has_pal = H5LTfind_dataset(loc_id, pal_name);
/* It does not exist. Return */
- if ( has_pal == 0 )
+ if (has_pal == 0)
return -1;
/* The image dataset may or not have the attribute "PALETTE"
- * First we try to open to see if it is already there; if not, it is created.
- * If it exists, the array of references is extended to hold the reference
- * to the new palette
- */
+ * First we try to open to see if it is already there; if not, it is created.
+ * If it exists, the array of references is extended to hold the reference
+ * to the new palette
+ */
/* First we get the image id */
- if((did = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0)
return -1;
/* Try to find the attribute "PALETTE" on the >>image<< dataset */
ok_pal = H5LT_find_attribute(did, "PALETTE");
/* It does not exist. Nothing to do */
- if(ok_pal == 0)
+ if (ok_pal == 0)
return -1;
/* The attribute exists, open it */
- else if(ok_pal == 1)
- {
- if((aid = H5Aopen(did, "PALETTE", H5P_DEFAULT)) < 0)
+ else if (ok_pal == 1) {
+ if ((aid = H5Aopen(did, "PALETTE", H5P_DEFAULT)) < 0)
goto out;
- if((atid = H5Aget_type(aid)) < 0)
+ if ((atid = H5Aget_type(aid)) < 0)
goto out;
- if((aclass = H5Tget_class(atid)) < 0)
+ if ((aclass = H5Tget_class(atid)) < 0)
goto out;
/* Check if it is really a reference */
- if(aclass == H5T_REFERENCE)
- {
+ if (aclass == H5T_REFERENCE) {
/* Delete the attribute */
- if(H5Adelete(did, "PALETTE") < 0)
+ if (H5Adelete(did, "PALETTE") < 0)
goto out;
- } /* H5T_REFERENCE */
+ } /* H5T_REFERENCE */
- if(H5Tclose(atid) < 0)
+ if (H5Tclose(atid) < 0)
goto out;
/* Close the attribute. */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
} /* ok_pal */
/* Close the image dataset. */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
return -1;
return 0;
out:
- H5Dclose( did );
+ H5Dclose(did);
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: H5IMget_npalettes
-*
-* Purpose: Gets the number of palettes associated to an image
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente Nunes
-*
-* Date: July 22, 2001
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
-herr_t H5IMget_npalettes( hid_t loc_id,
- const char *image_name,
- hssize_t *npals )
+ * Function: H5IMget_npalettes
+ *
+ * Purpose: Gets the number of palettes associated to an image
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente Nunes
+ *
+ * Date: July 22, 2001
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+herr_t
+H5IMget_npalettes(hid_t loc_id, const char *image_name, hssize_t *npals)
{
hid_t did;
hid_t atid;
@@ -817,495 +772,469 @@ herr_t H5IMget_npalettes( hid_t loc_id,
int has_pal;
/* check the arguments */
- if(image_name == NULL)
- return -1;
+ if (image_name == NULL)
+ return -1;
/*assume initially we have no palettes attached*/
*npals = 0;
/* Open the dataset. */
- if((did = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0)
return -1;
/* Try to find the attribute "PALETTE" on the >>image<< dataset */
has_pal = H5IM_find_palette(did);
- if(has_pal == 1 )
- {
+ if (has_pal == 1) {
- if((aid = H5Aopen(did, "PALETTE", H5P_DEFAULT)) < 0)
+ if ((aid = H5Aopen(did, "PALETTE", H5P_DEFAULT)) < 0)
goto out;
- if((atid = H5Aget_type(aid)) < 0)
+ if ((atid = H5Aget_type(aid)) < 0)
goto out;
- if((aclass = H5Tget_class(atid)) < 0)
+ if ((aclass = H5Tget_class(atid)) < 0)
goto out;
/* Check if it is really a reference */
- if(aclass == H5T_REFERENCE)
- {
- if((asid = H5Aget_space(aid)) < 0)
+ if (aclass == H5T_REFERENCE) {
+ if ((asid = H5Aget_space(aid)) < 0)
goto out;
- *npals = H5Sget_simple_extent_npoints( asid );
+ *npals = H5Sget_simple_extent_npoints(asid);
- if ( H5Sclose( asid ) < 0)
+ if (H5Sclose(asid) < 0)
goto out;
} /* H5T_REFERENCE */
- if ( H5Tclose( atid ) < 0)
+ if (H5Tclose(atid) < 0)
goto out;
/* Close the attribute. */
- if ( H5Aclose( aid ) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
-
}
/* Close the image dataset. */
- if ( H5Dclose( did ) < 0)
+ if (H5Dclose(did) < 0)
return -1;
return 0;
out:
- H5Dclose( did );
+ H5Dclose(did);
return -1;
-
}
-
/*-------------------------------------------------------------------------
-* Function: H5IMget_palette_info
-*
-* Purpose: Get palette information
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente Nunes
-*
-* Date: July 22, 2001
-*
-* Comments:
-* based on HDF5 Image and Palette Specification
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
-herr_t H5IMget_palette_info( hid_t loc_id,
- const char *image_name,
- int pal_number,
- hsize_t *pal_dims )
+ * Function: H5IMget_palette_info
+ *
+ * Purpose: Get palette information
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente Nunes
+ *
+ * Date: July 22, 2001
+ *
+ * Comments:
+ * based on HDF5 Image and Palette Specification
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+herr_t
+H5IMget_palette_info(hid_t loc_id, const char *image_name, int pal_number, hsize_t *pal_dims)
{
- hid_t did;
- int has_pal;
- hid_t atid=-1;
- hid_t aid;
- hid_t asid=-1;
- hssize_t n_refs;
- hsize_t dim_ref;
- hobj_ref_t *refbuf; /* buffer to read references */
- hid_t pal_id;
- hid_t pal_space_id;
- hsize_t pal_maxdims[2];
+ hid_t did;
+ int has_pal;
+ hid_t atid = -1;
+ hid_t aid;
+ hid_t asid = -1;
+ hssize_t n_refs;
+ hsize_t dim_ref;
+ hobj_ref_t *refbuf; /* buffer to read references */
+ hid_t pal_id;
+ hid_t pal_space_id;
+ hsize_t pal_maxdims[2];
/* check the arguments */
if (image_name == NULL)
- return -1;
+ return -1;
/* Open the dataset. */
- if((did = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0)
return -1;
/* Try to find the attribute "PALETTE" on the >>image<< dataset */
has_pal = H5IM_find_palette(did);
- if(has_pal == 1)
- {
- if((aid = H5Aopen(did, "PALETTE", H5P_DEFAULT)) < 0)
+ if (has_pal == 1) {
+ if ((aid = H5Aopen(did, "PALETTE", H5P_DEFAULT)) < 0)
goto out;
- if((atid = H5Aget_type(aid)) < 0)
+ if ((atid = H5Aget_type(aid)) < 0)
goto out;
- if(H5Tget_class(atid) < 0)
+ if (H5Tget_class(atid) < 0)
goto out;
/* Get the reference(s) */
- if((asid = H5Aget_space(aid)) < 0)
+ if ((asid = H5Aget_space(aid)) < 0)
goto out;
n_refs = H5Sget_simple_extent_npoints(asid);
dim_ref = (hsize_t)n_refs;
- refbuf = (hobj_ref_t*)HDmalloc( sizeof(hobj_ref_t) * (size_t)dim_ref );
+ refbuf = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * (size_t)dim_ref);
- if ( H5Aread( aid, atid, refbuf ) < 0)
+ if (H5Aread(aid, atid, refbuf) < 0)
goto out;
/* Get the actual palette */
- if ( (pal_id = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &refbuf[pal_number])) < 0)
+ if ((pal_id = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &refbuf[pal_number])) < 0)
goto out;
- if ( (pal_space_id = H5Dget_space( pal_id )) < 0)
+ if ((pal_space_id = H5Dget_space(pal_id)) < 0)
goto out;
- if ( H5Sget_simple_extent_ndims( pal_space_id ) < 0)
+ if (H5Sget_simple_extent_ndims(pal_space_id) < 0)
goto out;
- if ( H5Sget_simple_extent_dims( pal_space_id, pal_dims, pal_maxdims ) < 0)
+ if (H5Sget_simple_extent_dims(pal_space_id, pal_dims, pal_maxdims) < 0)
goto out;
/* close */
- if (H5Dclose(pal_id)<0)
+ if (H5Dclose(pal_id) < 0)
goto out;
- if ( H5Sclose( pal_space_id ) < 0)
+ if (H5Sclose(pal_space_id) < 0)
goto out;
- if ( H5Sclose( asid ) < 0)
+ if (H5Sclose(asid) < 0)
goto out;
- if ( H5Tclose( atid ) < 0)
+ if (H5Tclose(atid) < 0)
goto out;
- if ( H5Aclose( aid ) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
- HDfree( refbuf );
-
-
+ HDfree(refbuf);
}
/* Close the image dataset. */
- if ( H5Dclose( did ) < 0)
+ if (H5Dclose(did) < 0)
return -1;
return 0;
out:
- H5Dclose( did );
- H5Sclose( asid );
- H5Tclose( atid );
- H5Aclose( aid );
+ H5Dclose(did);
+ H5Sclose(asid);
+ H5Tclose(atid);
+ H5Aclose(aid);
return -1;
-
}
-
/*-------------------------------------------------------------------------
-* Function: H5IMget_palette
-*
-* Purpose: Read palette
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente Nunes
-*
-* Date: August 30, 2001
-*
-* Comments:
-* based on HDF5 Image and Palette Specification
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
-herr_t H5IMget_palette( hid_t loc_id,
- const char *image_name,
- int pal_number,
- unsigned char *pal_data )
+ * Function: H5IMget_palette
+ *
+ * Purpose: Read palette
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente Nunes
+ *
+ * Date: August 30, 2001
+ *
+ * Comments:
+ * based on HDF5 Image and Palette Specification
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+herr_t
+H5IMget_palette(hid_t loc_id, const char *image_name, int pal_number, unsigned char *pal_data)
{
- hid_t did;
- int has_pal;
- hid_t atid=-1;
- hid_t aid;
- hid_t asid=-1;
- hssize_t n_refs;
- hsize_t dim_ref;
- hobj_ref_t *refbuf; /* buffer to read references */
- hid_t pal_id;
+ hid_t did;
+ int has_pal;
+ hid_t atid = -1;
+ hid_t aid;
+ hid_t asid = -1;
+ hssize_t n_refs;
+ hsize_t dim_ref;
+ hobj_ref_t *refbuf; /* buffer to read references */
+ hid_t pal_id;
/* check the arguments */
if (image_name == NULL)
- return -1;
+ return -1;
if (pal_data == NULL)
- return -1;
-
+ return -1;
/* Open the dataset. */
- if((did = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0)
return -1;
/* Try to find the attribute "PALETTE" on the >>image<< dataset */
has_pal = H5IM_find_palette(did);
- if(has_pal == 1 )
- {
- if((aid = H5Aopen(did, "PALETTE", H5P_DEFAULT)) < 0)
+ if (has_pal == 1) {
+ if ((aid = H5Aopen(did, "PALETTE", H5P_DEFAULT)) < 0)
goto out;
- if((atid = H5Aget_type(aid)) < 0)
+ if ((atid = H5Aget_type(aid)) < 0)
goto out;
- if(H5Tget_class(atid) < 0)
+ if (H5Tget_class(atid) < 0)
goto out;
/* Get the reference(s) */
- if((asid = H5Aget_space(aid)) < 0)
+ if ((asid = H5Aget_space(aid)) < 0)
goto out;
n_refs = H5Sget_simple_extent_npoints(asid);
dim_ref = (hsize_t)n_refs;
- refbuf = (hobj_ref_t*)HDmalloc( sizeof(hobj_ref_t) * (size_t)dim_ref );
+ refbuf = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * (size_t)dim_ref);
- if ( H5Aread( aid, atid, refbuf ) < 0)
+ if (H5Aread(aid, atid, refbuf) < 0)
goto out;
/* Get the palette id */
- if ( (pal_id = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &refbuf[pal_number])) < 0)
+ if ((pal_id = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &refbuf[pal_number])) < 0)
goto out;
/* Read the palette dataset */
- if ( H5Dread( pal_id, H5Dget_type(pal_id), H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data ) < 0)
+ if (H5Dread(pal_id, H5Dget_type(pal_id), H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data) < 0)
goto out;
/* close */
- if (H5Dclose(pal_id)<0)
+ if (H5Dclose(pal_id) < 0)
goto out;
- if ( H5Sclose( asid ) < 0)
+ if (H5Sclose(asid) < 0)
goto out;
- if ( H5Tclose( atid ) < 0)
+ if (H5Tclose(atid) < 0)
goto out;
- if ( H5Aclose( aid ) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
- HDfree( refbuf );
+ HDfree(refbuf);
}
/* Close the image dataset. */
- if ( H5Dclose( did ) < 0)
+ if (H5Dclose(did) < 0)
return -1;
return 0;
out:
- H5Dclose( did );
- H5Sclose( asid );
- H5Tclose( atid );
- H5Aclose( aid );
+ H5Dclose(did);
+ H5Sclose(asid);
+ H5Tclose(atid);
+ H5Aclose(aid);
return -1;
-
}
/*-------------------------------------------------------------------------
-* Function: H5IMis_image
-*
-* Purpose:
-*
-* Return: true, false, fail
-*
-* Programmer: Pedro Vicente Nunes
-*
-* Date: August 30, 2001
-*
-* Comments:
-* based on HDF5 Image and Palette Specification
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
-herr_t H5IMis_image( hid_t loc_id,
- const char *dset_name )
+ * Function: H5IMis_image
+ *
+ * Purpose:
+ *
+ * Return: true, false, fail
+ *
+ * Programmer: Pedro Vicente Nunes
+ *
+ * Date: August 30, 2001
+ *
+ * Comments:
+ * based on HDF5 Image and Palette Specification
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+herr_t
+H5IMis_image(hid_t loc_id, const char *dset_name)
{
- hid_t did;
- int has_class;
- hid_t atid;
- hid_t aid = -1;
- char* attr_data; /* Name of attribute */
- hsize_t storage_size; /* Size of storage for attribute */
- herr_t ret;
+ hid_t did;
+ int has_class;
+ hid_t atid;
+ hid_t aid = -1;
+ char * attr_data; /* Name of attribute */
+ hsize_t storage_size; /* Size of storage for attribute */
+ herr_t ret;
/* check the arguments */
if (dset_name == NULL)
- return -1;
+ return -1;
/* Assume initially fail condition */
ret = -1;
/* Open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
return -1;
/* Try to find the attribute "CLASS" on the dataset */
has_class = H5LT_find_attribute(did, "CLASS");
- if(has_class == 0)
- {
+ if (has_class == 0) {
H5Dclose(did);
return 0;
}
- else if(has_class == 1)
- {
+ else if (has_class == 1) {
- if((aid = H5Aopen(did, "CLASS", H5P_DEFAULT)) < 0)
+ if ((aid = H5Aopen(did, "CLASS", H5P_DEFAULT)) < 0)
goto out;
- if((atid = H5Aget_type(aid)) < 0)
+ if ((atid = H5Aget_type(aid)) < 0)
goto out;
- /* check to make sure attribute is a string */
- if(H5T_STRING != H5Tget_class(atid))
- goto out;
+ /* check to make sure attribute is a string */
+ if (H5T_STRING != H5Tget_class(atid))
+ goto out;
- /* check to make sure string is null-terminated */
- if(H5T_STR_NULLTERM != H5Tget_strpad(atid))
- goto out;
+ /* check to make sure string is null-terminated */
+ if (H5T_STR_NULLTERM != H5Tget_strpad(atid))
+ goto out;
- /* allocate buffer large enough to hold string */
- if((storage_size = H5Aget_storage_size(aid)) == 0)
- goto out;
+ /* allocate buffer large enough to hold string */
+ if ((storage_size = H5Aget_storage_size(aid)) == 0)
+ goto out;
- attr_data = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1);
- if(attr_data == NULL)
- goto out;
+ attr_data = (char *)HDmalloc((size_t)storage_size * sizeof(char) + 1);
+ if (attr_data == NULL)
+ goto out;
- if(H5Aread(aid, atid, attr_data) < 0)
+ if (H5Aread(aid, atid, attr_data) < 0)
goto out;
- if(HDstrncmp(attr_data, IMAGE_CLASS, MIN(HDstrlen(IMAGE_CLASS),HDstrlen(attr_data))) == 0)
+ if (HDstrncmp(attr_data, IMAGE_CLASS, MIN(HDstrlen(IMAGE_CLASS), HDstrlen(attr_data))) == 0)
ret = 1;
else
ret = 0;
- HDfree(attr_data);
+ HDfree(attr_data);
- if ( H5Tclose( atid ) < 0)
+ if (H5Tclose(atid) < 0)
goto out;
- if ( H5Aclose( aid ) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
-
}
/* Close the dataset. */
- if ( H5Dclose( did ) < 0)
+ if (H5Dclose(did) < 0)
return -1;
return ret;
out:
- H5Dclose( did );
+ H5Dclose(did);
return -1;
-
}
/*-------------------------------------------------------------------------
-* Function: H5IMis_palette
-*
-* Purpose:
-*
-* Return: true, false, fail
-*
-* Programmer: Pedro Vicente Nunes
-*
-* Date: August 30, 2001
-*
-* Comments:
-* based on HDF5 Image and Palette Specification
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
-herr_t H5IMis_palette( hid_t loc_id,
- const char *dset_name )
+ * Function: H5IMis_palette
+ *
+ * Purpose:
+ *
+ * Return: true, false, fail
+ *
+ * Programmer: Pedro Vicente Nunes
+ *
+ * Date: August 30, 2001
+ *
+ * Comments:
+ * based on HDF5 Image and Palette Specification
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+herr_t
+H5IMis_palette(hid_t loc_id, const char *dset_name)
{
- hid_t did;
- int has_class;
- hid_t atid;
- hid_t aid = -1;
- char* attr_data; /* Name of attribute */
- hsize_t storage_size; /* Size of storage for attribute */
- herr_t ret;
+ hid_t did;
+ int has_class;
+ hid_t atid;
+ hid_t aid = -1;
+ char * attr_data; /* Name of attribute */
+ hsize_t storage_size; /* Size of storage for attribute */
+ herr_t ret;
/* check the arguments */
if (dset_name == NULL)
- return -1;
+ return -1;
/* Assume initially fail condition */
ret = -1;
/* Open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
return -1;
/* Try to find the attribute "CLASS" on the dataset */
has_class = H5LT_find_attribute(did, "CLASS");
- if(has_class == 0)
- {
- H5Dclose( did );
+ if (has_class == 0) {
+ H5Dclose(did);
return 0;
}
- else if(has_class == 1)
- {
+ else if (has_class == 1) {
- if((aid = H5Aopen(did, "CLASS", H5P_DEFAULT)) < 0)
+ if ((aid = H5Aopen(did, "CLASS", H5P_DEFAULT)) < 0)
goto out;
- if((atid = H5Aget_type(aid)) < 0)
+ if ((atid = H5Aget_type(aid)) < 0)
goto out;
- /* check to make sure attribute is a string */
- if(H5T_STRING != H5Tget_class(atid))
- goto out;
+ /* check to make sure attribute is a string */
+ if (H5T_STRING != H5Tget_class(atid))
+ goto out;
- /* check to make sure string is null-terminated */
- if(H5T_STR_NULLTERM != H5Tget_strpad(atid))
- goto out;
+ /* check to make sure string is null-terminated */
+ if (H5T_STR_NULLTERM != H5Tget_strpad(atid))
+ goto out;
- /* allocate buffer large enough to hold string */
- if((storage_size = H5Aget_storage_size(aid)) == 0)
- goto out;
+ /* allocate buffer large enough to hold string */
+ if ((storage_size = H5Aget_storage_size(aid)) == 0)
+ goto out;
- attr_data = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1);
- if(attr_data == NULL)
- goto out;
+ attr_data = (char *)HDmalloc((size_t)storage_size * sizeof(char) + 1);
+ if (attr_data == NULL)
+ goto out;
- if(H5Aread(aid, atid, attr_data) < 0)
+ if (H5Aread(aid, atid, attr_data) < 0)
goto out;
- if(HDstrncmp(attr_data, PALETTE_CLASS, MIN(HDstrlen(PALETTE_CLASS),HDstrlen(attr_data))) == 0)
+ if (HDstrncmp(attr_data, PALETTE_CLASS, MIN(HDstrlen(PALETTE_CLASS), HDstrlen(attr_data))) == 0)
ret = 1;
else
ret = 0;
- HDfree(attr_data);
+ HDfree(attr_data);
- if ( H5Tclose( atid ) < 0)
+ if (H5Tclose(atid) < 0)
goto out;
- if ( H5Aclose( aid ) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
-
}
/* Close the dataset. */
- if ( H5Dclose( did ) < 0)
+ if (H5Dclose(did) < 0)
return -1;
return ret;
out:
- H5Dclose( did );
+ H5Dclose(did);
return -1;
-
}
-
diff --git a/hl/src/H5IMprivate.h b/hl/src/H5IMprivate.h
index 6776c9d..0e47509 100644
--- a/hl/src/H5IMprivate.h
+++ b/hl/src/H5IMprivate.h
@@ -20,20 +20,16 @@
/* public IM prototypes */
#include "H5IMpublic.h"
-
#define IMAGE_CLASS "IMAGE"
#define PALETTE_CLASS "PALETTE"
#define IMAGE_VERSION "1.2"
-#define IMAGE8_RANK 2
-#define IMAGE24_RANK 3
-
+#define IMAGE8_RANK 2
+#define IMAGE24_RANK 3
/*-------------------------------------------------------------------------
* Private functions
*-------------------------------------------------------------------------
*/
-H5_HLDLL herr_t H5IM_find_palette(hid_t loc_id );
-
+H5_HLDLL herr_t H5IM_find_palette(hid_t loc_id);
#endif
-
diff --git a/hl/src/H5IMpublic.h b/hl/src/H5IMpublic.h
index a95e439..745eade 100644
--- a/hl/src/H5IMpublic.h
+++ b/hl/src/H5IMpublic.h
@@ -14,69 +14,38 @@
#ifndef _H5IMpublic_H
#define _H5IMpublic_H
-
#ifdef __cplusplus
extern "C" {
#endif
+H5_HLDLL herr_t H5IMmake_image_8bit(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height,
+ const unsigned char *buffer);
+
+H5_HLDLL herr_t H5IMmake_image_24bit(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height,
+ const char *interlace, const unsigned char *buffer);
+
+H5_HLDLL herr_t H5IMget_image_info(hid_t loc_id, const char *dset_name, hsize_t *width, hsize_t *height,
+ hsize_t *planes, char *interlace, hssize_t *npals);
+
+H5_HLDLL herr_t H5IMread_image(hid_t loc_id, const char *dset_name, unsigned char *buffer);
+
+H5_HLDLL herr_t H5IMmake_palette(hid_t loc_id, const char *pal_name, const hsize_t *pal_dims,
+ const unsigned char *pal_data);
+
+H5_HLDLL herr_t H5IMlink_palette(hid_t loc_id, const char *image_name, const char *pal_name);
+
+H5_HLDLL herr_t H5IMunlink_palette(hid_t loc_id, const char *image_name, const char *pal_name);
+
+H5_HLDLL herr_t H5IMget_npalettes(hid_t loc_id, const char *image_name, hssize_t *npals);
+
+H5_HLDLL herr_t H5IMget_palette_info(hid_t loc_id, const char *image_name, int pal_number, hsize_t *pal_dims);
+
+H5_HLDLL herr_t H5IMget_palette(hid_t loc_id, const char *image_name, int pal_number,
+ unsigned char *pal_data);
+
+H5_HLDLL herr_t H5IMis_image(hid_t loc_id, const char *dset_name);
-H5_HLDLL herr_t H5IMmake_image_8bit( hid_t loc_id,
- const char *dset_name,
- hsize_t width,
- hsize_t height,
- const unsigned char *buffer );
-
-H5_HLDLL herr_t H5IMmake_image_24bit( hid_t loc_id,
- const char *dset_name,
- hsize_t width,
- hsize_t height,
- const char *interlace,
- const unsigned char *buffer );
-
-H5_HLDLL herr_t H5IMget_image_info( hid_t loc_id,
- const char *dset_name,
- hsize_t *width,
- hsize_t *height,
- hsize_t *planes,
- char *interlace,
- hssize_t *npals );
-
-H5_HLDLL herr_t H5IMread_image( hid_t loc_id,
- const char *dset_name,
- unsigned char *buffer );
-
-H5_HLDLL herr_t H5IMmake_palette( hid_t loc_id,
- const char *pal_name,
- const hsize_t *pal_dims,
- const unsigned char *pal_data );
-
-H5_HLDLL herr_t H5IMlink_palette( hid_t loc_id,
- const char *image_name,
- const char *pal_name );
-
-H5_HLDLL herr_t H5IMunlink_palette( hid_t loc_id,
- const char *image_name,
- const char *pal_name );
-
-H5_HLDLL herr_t H5IMget_npalettes( hid_t loc_id,
- const char *image_name,
- hssize_t *npals );
-
-H5_HLDLL herr_t H5IMget_palette_info( hid_t loc_id,
- const char *image_name,
- int pal_number,
- hsize_t *pal_dims );
-
-H5_HLDLL herr_t H5IMget_palette( hid_t loc_id,
- const char *image_name,
- int pal_number,
- unsigned char *pal_data );
-
-H5_HLDLL herr_t H5IMis_image( hid_t loc_id,
- const char *dset_name );
-
-H5_HLDLL herr_t H5IMis_palette( hid_t loc_id,
- const char *dset_name );
+H5_HLDLL herr_t H5IMis_palette(hid_t loc_id, const char *dset_name);
#ifdef __cplusplus
}
diff --git a/hl/src/H5LD.c b/hl/src/H5LD.c
index 21975d1..73043a5 100644
--- a/hl/src/H5LD.c
+++ b/hl/src/H5LD.c
@@ -1,15 +1,15 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "H5LDprivate.h"
@@ -22,10 +22,9 @@
static herr_t H5LD_construct_info(H5LD_memb_t *memb, hid_t par_tid);
static herr_t H5LD_get_dset_dims(hid_t did, hsize_t *cur_dims);
static size_t H5LD_get_dset_type_size(hid_t did, const char *fields);
-static herr_t H5LD_get_dset_elmts(hid_t did, const hsize_t *prev_dims,
- const hsize_t *cur_dims, const char *fields, void *buf);
+static herr_t H5LD_get_dset_elmts(hid_t did, const hsize_t *prev_dims, const hsize_t *cur_dims,
+ const char *fields, void *buf);
-
/*-------------------------------------------------------------------------
* Function: H5LD_clean_vector
*
@@ -43,30 +42,29 @@ static herr_t H5LD_get_dset_elmts(hid_t did, const hsize_t *prev_dims,
void
H5LD_clean_vector(H5LD_memb_t *listv[])
{
- unsigned n; /* Local index variable */
+ unsigned n; /* Local index variable */
HDassert(listv);
/* Go through info for each field stored in listv[] */
- for(n = 0; listv[n] != NULL; n++) {
- if(listv[n]->names) {
- HDfree(listv[n]->names);
- listv[n]->names = NULL;
- } /* end if */
-
- /* Close the type id of the last member in the field */
- if(!(listv[n]->last_tid < 0)) {
- H5Tclose(listv[n]->last_tid);
- listv[n]->last_tid = -1;
- } /* end if */
-
- /* Free the H5LD_memb_t structure for the field */
- HDfree(listv[n]);
- listv[n] = NULL;
+ for (n = 0; listv[n] != NULL; n++) {
+ if (listv[n]->names) {
+ HDfree(listv[n]->names);
+ listv[n]->names = NULL;
+ } /* end if */
+
+ /* Close the type id of the last member in the field */
+ if (!(listv[n]->last_tid < 0)) {
+ H5Tclose(listv[n]->last_tid);
+ listv[n]->last_tid = -1;
+ } /* end if */
+
+ /* Free the H5LD_memb_t structure for the field */
+ HDfree(listv[n]);
+ listv[n] = NULL;
} /* end for */
} /* H5LD_clean_vector() */
-
/*-------------------------------------------------------------------------
* Function: H5LD_construct_info()
*
@@ -85,27 +83,27 @@ H5LD_clean_vector(H5LD_memb_t *listv[])
static herr_t
H5LD_construct_info(H5LD_memb_t *memb, hid_t par_tid)
{
- hid_t tmp_tid = -1; /* Dataset type id */
- unsigned i; /* Local index variable */
- herr_t ret_value = FAIL; /* Return value */
+ hid_t tmp_tid = -1; /* Dataset type id */
+ unsigned i; /* Local index variable */
+ herr_t ret_value = FAIL; /* Return value */
/* Make a copy of the incoming datatype */
tmp_tid = H5Tcopy(par_tid);
/* Validate all the members in a field */
- for(i = 0; memb->names[i] != NULL; i++) {
- hid_t memb_tid; /* Type id for a member in a field */
- int idx; /* Index # of a member in a compound datatype */
+ for (i = 0; memb->names[i] != NULL; i++) {
+ hid_t memb_tid; /* Type id for a member in a field */
+ int idx; /* Index # of a member in a compound datatype */
/* Get the member index and member type id */
- if((idx = H5Tget_member_index(tmp_tid, memb->names[i])) < 0)
+ if ((idx = H5Tget_member_index(tmp_tid, memb->names[i])) < 0)
goto done;
- if((memb_tid = H5Tget_member_type(tmp_tid, (unsigned)idx)) < 0)
+ if ((memb_tid = H5Tget_member_type(tmp_tid, (unsigned)idx)) < 0)
goto done;
- /* Sum up the offset of all the members in the field */
+ /* Sum up the offset of all the members in the field */
memb->tot_offset += H5Tget_member_offset(tmp_tid, (unsigned)idx);
- if(H5Tclose(tmp_tid) < 0)
+ if (H5Tclose(tmp_tid) < 0)
goto done;
tmp_tid = memb_tid;
} /* end for */
@@ -121,13 +119,12 @@ H5LD_construct_info(H5LD_memb_t *memb, hid_t par_tid)
done:
H5E_BEGIN_TRY
- H5Tclose(tmp_tid);
+ H5Tclose(tmp_tid);
H5E_END_TRY
- return(ret_value);
+ return (ret_value);
} /* H5LD_construct_info() */
-
/*-------------------------------------------------------------------------
* Function: H5LD_construct_vector
*
@@ -153,84 +150,87 @@ done:
*
* Programmer: Vailin Choi; Aug 2010
*
-*-------------------------------------------------------------------------
-*/
+ *-------------------------------------------------------------------------
+ */
int
-H5LD_construct_vector(char *fields, H5LD_memb_t *listv[]/*OUT*/, hid_t par_tid)
+H5LD_construct_vector(char *fields, H5LD_memb_t *listv[] /*OUT*/, hid_t par_tid)
{
- int nfields; /* The # of comma-separated fields in "fields" */
- hbool_t end_of_fields = FALSE; /* end of "fields" */
- char *fields_ptr; /* Pointer to "fields" */
- int ret_value = FAIL; /* Return value */
+ int nfields; /* The # of comma-separated fields in "fields" */
+ hbool_t end_of_fields = FALSE; /* end of "fields" */
+ char * fields_ptr; /* Pointer to "fields" */
+ int ret_value = FAIL; /* Return value */
HDassert(listv);
HDassert(fields);
fields_ptr = fields;
- nfields = 0;
+ nfields = 0;
/* Process till end of "fields" */
- while(!end_of_fields) {
- H5LD_memb_t *memb = NULL; /* Pointer to structure for storing a field's info */
- char *cur; /* Pointer to a member in a field */
- size_t len; /* Estimated # of members in a field */
- hbool_t gotcomma = FALSE; /* A comma encountered */
- hbool_t gotmember = FALSE; /* Getting member in a field */
- hbool_t valid = TRUE; /* Whether a field being processed is valid or not */
- int j = 0; /* The # of members in a field */
-
- len = (HDstrlen(fields_ptr) / 2) + 2;
-
- /* Allocate memory for an H5LD_memb_t for storing a field's info */
- if(NULL == (memb = (H5LD_memb_t *)HDcalloc((size_t)1, sizeof(H5LD_memb_t))))
- goto done;
-
- /* Allocate memory for an array of pointers to member names */
- if(NULL == (memb->names = (char **)HDcalloc(len, sizeof(char *))))
- goto done;
-
- memb->names[j] = fields_ptr;
- memb->last_tid = -1;
- cur = fields_ptr;
-
- /* Continue processing till: not valid or comma encountered or "fields" ended */
- while(valid && !gotcomma && !end_of_fields) {
- switch(*fields_ptr) {
- case '\0': /* end of list */
- if(gotmember) { /* getting something and end of "fields" */
- *cur++ = '\0';;
+ while (!end_of_fields) {
+ H5LD_memb_t *memb = NULL; /* Pointer to structure for storing a field's info */
+ char * cur; /* Pointer to a member in a field */
+ size_t len; /* Estimated # of members in a field */
+ hbool_t gotcomma = FALSE; /* A comma encountered */
+ hbool_t gotmember = FALSE; /* Getting member in a field */
+ hbool_t valid = TRUE; /* Whether a field being processed is valid or not */
+ int j = 0; /* The # of members in a field */
+
+ len = (HDstrlen(fields_ptr) / 2) + 2;
+
+ /* Allocate memory for an H5LD_memb_t for storing a field's info */
+ if (NULL == (memb = (H5LD_memb_t *)HDcalloc((size_t)1, sizeof(H5LD_memb_t))))
+ goto done;
+
+ /* Allocate memory for an array of pointers to member names */
+ if (NULL == (memb->names = (char **)HDcalloc(len, sizeof(char *))))
+ goto done;
+
+ memb->names[j] = fields_ptr;
+ memb->last_tid = -1;
+ cur = fields_ptr;
+
+ /* Continue processing till: not valid or comma encountered or "fields" ended */
+ while (valid && !gotcomma && !end_of_fields) {
+ switch (*fields_ptr) {
+ case '\0': /* end of list */
+ if (gotmember) { /* getting something and end of "fields" */
+ *cur++ = '\0';
+ ;
memb->names[++j] = NULL;
- } /* end if */
+ } /* end if */
else /* getting nothing but end of list */
valid = FALSE;
end_of_fields = TRUE;
break;
- case '\\': /* escape character */
+ case '\\': /* escape character */
++fields_ptr; /* skip it */
- if(*fields_ptr == '\0')
+ if (*fields_ptr == '\0')
valid = FALSE;
else {
- *cur++ = *fields_ptr++;
+ *cur++ = *fields_ptr++;
gotmember = TRUE;
} /* end else */
break;
case '.': /* nested field separator */
- *fields_ptr++ = *cur++ = '\0';;
- if(gotmember) {
+ *fields_ptr++ = *cur++ = '\0';
+ ;
+ if (gotmember) {
memb->names[++j] = cur;
- gotmember = FALSE;
+ gotmember = FALSE;
} /* end if */
else
valid = FALSE;
break;
case ',': /* field separator */
- *fields_ptr++ = *cur++ = '\0';;
- if(gotmember) {
+ *fields_ptr++ = *cur++ = '\0';
+ ;
+ if (gotmember) {
memb->names[++j] = NULL;
- gotmember = FALSE;
+ gotmember = FALSE;
} /* end if */
else
valid = FALSE;
@@ -238,37 +238,36 @@ H5LD_construct_vector(char *fields, H5LD_memb_t *listv[]/*OUT*/, hid_t par_tid)
break;
default:
- *cur++ = *fields_ptr++;
+ *cur++ = *fields_ptr++;
gotmember = TRUE;
break;
- } /* end switch */
- } /* while (valid && !gotcomma && !end_of_fields) */
-
- /* If valid, put into listv and continue processing further info */
- if(valid) {
- listv[nfields++] = memb;
- if(H5LD_construct_info(memb, par_tid) < 0)
- goto done;
- } /* end if */
+ } /* end switch */
+ } /* while (valid && !gotcomma && !end_of_fields) */
+
+ /* If valid, put into listv and continue processing further info */
+ if (valid) {
+ listv[nfields++] = memb;
+ if (H5LD_construct_info(memb, par_tid) < 0)
+ goto done;
+ } /* end if */
else {
- if(memb)
+ if (memb)
HDfree(memb);
- goto done;
- } /* end else */
- } /* while !end_of_fields */
+ goto done;
+ } /* end else */
+ } /* while !end_of_fields */
/* Indicate success */
ret_value = nfields;
done:
listv[nfields] = NULL;
- if(ret_value == FAIL)
- H5LD_clean_vector(listv);
+ if (ret_value == FAIL)
+ H5LD_clean_vector(listv);
- return(ret_value);
-} /* H5LD_construct_vector() */
+ return (ret_value);
+} /* H5LD_construct_vector() */
-
/*-------------------------------------------------------------------------
* Function: H5LD_get_dset_dims
*
@@ -280,38 +279,36 @@ done:
*
* Programmer: Vailin Choi; March 2010
*
-*-------------------------------------------------------------------------
-*/
+ *-------------------------------------------------------------------------
+ */
static herr_t
H5LD_get_dset_dims(hid_t did, hsize_t *cur_dims)
{
- hid_t sid = -1; /* Dataspace ID */
- herr_t ret_value = FAIL; /* Return Value */
+ hid_t sid = -1; /* Dataspace ID */
+ herr_t ret_value = FAIL; /* Return Value */
/* Verify parameter */
- if(cur_dims == NULL)
+ if (cur_dims == NULL)
goto done;
/* Get the dataset's dataspace */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto done;
/* Get the current dimension size */
- if(H5Sget_simple_extent_dims(sid, cur_dims, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, cur_dims, NULL) < 0)
goto done;
/* Indicate success */
ret_value = SUCCEED;
done:
- H5E_BEGIN_TRY {
- H5Sclose(sid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Sclose(sid); }
+ H5E_END_TRY;
- return(ret_value);
+ return (ret_value);
} /* H5LD_get_dset_dims() */
-
/*-------------------------------------------------------------------------
* Function: H5LD_get_dset_type_size
*
@@ -330,73 +327,72 @@ done:
static size_t
H5LD_get_dset_type_size(hid_t did, const char *fields)
{
- hid_t dset_tid = -1; /* Dataset's type identifier */
- hid_t tid = -1; /* Native Type identifier */
- H5LD_memb_t **listv = NULL; /* Vector for storing information in "fields" */
- char *dup_fields = NULL; /* A copy of "fields" */
- size_t ret_value = 0; /* Return value */
+ hid_t dset_tid = -1; /* Dataset's type identifier */
+ hid_t tid = -1; /* Native Type identifier */
+ H5LD_memb_t **listv = NULL; /* Vector for storing information in "fields" */
+ char * dup_fields = NULL; /* A copy of "fields" */
+ size_t ret_value = 0; /* Return value */
/* Get the datatype of the dataset */
- if((dset_tid = H5Dget_type(did)) < 0)
+ if ((dset_tid = H5Dget_type(did)) < 0)
goto done;
- if((tid = H5Tget_native_type(dset_tid, H5T_DIR_DEFAULT)) < 0)
+ if ((tid = H5Tget_native_type(dset_tid, H5T_DIR_DEFAULT)) < 0)
goto done;
- if(fields == NULL) /* If no "fields" is specified */
+ if (fields == NULL) /* If no "fields" is specified */
ret_value = H5Tget_size(tid);
- else { /* "fields" are specified */
- size_t len; /* Estimate the number of comma-separated fields in "fields" */
- size_t tot = 0; /* Data type size of all the fields in "fields" */
- int n = 0, num = 0; /* Local index variables */
+ else { /* "fields" are specified */
+ size_t len; /* Estimate the number of comma-separated fields in "fields" */
+ size_t tot = 0; /* Data type size of all the fields in "fields" */
+ int n = 0, num = 0; /* Local index variables */
HDassert(fields && *fields);
/* Should be a compound datatype if "fields" exists */
- if(H5Tget_class(dset_tid) != H5T_COMPOUND)
+ if (H5Tget_class(dset_tid) != H5T_COMPOUND)
goto done;
- /* Get a copy of "fields" */
- if(NULL == (dup_fields = HDstrdup(fields)))
+ /* Get a copy of "fields" */
+ if (NULL == (dup_fields = HDstrdup(fields)))
goto done;
- /* Allocate memory for a list of H5LD_memb_t pointers to store "fields" info */
- len = (HDstrlen(fields) / 2) + 2;
- if(NULL == (listv = (H5LD_memb_t **)HDcalloc(len, sizeof(H5LD_memb_t *))))
+ /* Allocate memory for a list of H5LD_memb_t pointers to store "fields" info */
+ len = (HDstrlen(fields) / 2) + 2;
+ if (NULL == (listv = (H5LD_memb_t **)HDcalloc(len, sizeof(H5LD_memb_t *))))
goto done;
- /* Process and store info for "fields" */
- if((num = H5LD_construct_vector(dup_fields, listv/*OUT*/, tid)) < 0)
+ /* Process and store info for "fields" */
+ if ((num = H5LD_construct_vector(dup_fields, listv /*OUT*/, tid)) < 0)
goto done;
- /* Sum up the size of all the datatypes in "fields" */
- for(n = 0; n < num; n++)
- tot += listv[n]->last_tsize;
+ /* Sum up the size of all the datatypes in "fields" */
+ for (n = 0; n < num; n++)
+ tot += listv[n]->last_tsize;
- /* Clean up the vector of H5LD_memb_t structures */
- H5LD_clean_vector(listv);
+ /* Clean up the vector of H5LD_memb_t structures */
+ H5LD_clean_vector(listv);
- /* Return the total size */
- ret_value = tot;
+ /* Return the total size */
+ ret_value = tot;
} /* end else */
done:
H5E_BEGIN_TRY
- H5Tclose(tid);
- H5Tclose(dset_tid);
+ H5Tclose(tid);
+ H5Tclose(dset_tid);
H5E_END_TRY
/* Free the array of H5LD_memb_t pointers */
- if(listv)
+ if (listv)
HDfree(listv);
/* Free memory */
- if(dup_fields)
+ if (dup_fields)
HDfree(dup_fields);
- return(ret_value);
+ return (ret_value);
} /* H5LD_get_dset_type_size() */
-
/*-------------------------------------------------------------------------
* Function: H5LD_get_dset_elmts
*
@@ -410,136 +406,136 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5LD_get_dset_elmts(hid_t did, const hsize_t *prev_dims, const hsize_t *cur_dims,
- const char *fields, void *buf)
+H5LD_get_dset_elmts(hid_t did, const hsize_t *prev_dims, const hsize_t *cur_dims, const char *fields,
+ void *buf)
{
- hid_t dtid = -1, tid = -1; /* Dataset type id */
- hid_t sid = -1, mid = -1; /* Dataspace and memory space id */
- hssize_t snum_elmts; /* Number of dataset elements in the selection (signed) */
- hsize_t num_elmts; /* Number of dataset elements in the selection */
- hsize_t start[H5S_MAX_RANK];/* Starting offset */
- hsize_t count[H5S_MAX_RANK];/* ??offset */
- H5LD_memb_t **listv = NULL; /* Vector for storing information in "fields" */
- char *dup_fields = NULL; /* A copy of "fields" */
- char *sav_buf = NULL; /* Saved pointer temporary buffer */
- unsigned ctr; /* Counter for # of curr_dims > prev_dims */
- int ndims; /* Number of dimensions for the dataset */
- int i; /* Local index variable */
- herr_t ret_value = FAIL; /* Return value */
+ hid_t dtid = -1, tid = -1; /* Dataset type id */
+ hid_t sid = -1, mid = -1; /* Dataspace and memory space id */
+ hssize_t snum_elmts; /* Number of dataset elements in the selection (signed) */
+ hsize_t num_elmts; /* Number of dataset elements in the selection */
+ hsize_t start[H5S_MAX_RANK]; /* Starting offset */
+ hsize_t count[H5S_MAX_RANK]; /* ??offset */
+ H5LD_memb_t **listv = NULL; /* Vector for storing information in "fields" */
+ char * dup_fields = NULL; /* A copy of "fields" */
+ char * sav_buf = NULL; /* Saved pointer temporary buffer */
+ unsigned ctr; /* Counter for # of curr_dims > prev_dims */
+ int ndims; /* Number of dimensions for the dataset */
+ int i; /* Local index variable */
+ herr_t ret_value = FAIL; /* Return value */
/* Verify parameters */
- if(prev_dims == NULL || cur_dims == NULL || buf == NULL)
- goto done;
+ if (prev_dims == NULL || cur_dims == NULL || buf == NULL)
+ goto done;
/* Get dataset's dataspace */
- if((sid = H5Dget_space(did)) < 0)
- goto done;
+ if ((sid = H5Dget_space(did)) < 0)
+ goto done;
/* Get the number of dimensions */
- if((ndims = H5Sget_simple_extent_ndims(sid)) < 0)
- goto done;
+ if ((ndims = H5Sget_simple_extent_ndims(sid)) < 0)
+ goto done;
/* Verify that cur_dims must have one dimension whose size is greater than prev_dims */
HDmemset(start, 0, sizeof start);
HDmemset(count, 0, sizeof count);
ctr = 0;
- for(i = 0; i < ndims; i++)
- if(cur_dims[i] > prev_dims[i]) {
- ++ctr;
- count[i] = cur_dims[i] - prev_dims[i];
- start[i] = prev_dims[i];
- } /* end if */
+ for (i = 0; i < ndims; i++)
+ if (cur_dims[i] > prev_dims[i]) {
+ ++ctr;
+ count[i] = cur_dims[i] - prev_dims[i];
+ start[i] = prev_dims[i];
+ } /* end if */
else { /* < or = */
- start[i] = 0;
- count[i] = MIN(prev_dims[i], cur_dims[i]);
- } /* end else */
- if(!ctr)
- goto done;
-
- if(ctr == 1) { /* changes for only one dimension */
- /* Make the selection in the dataset based on "cur_dims" and "prev_dims" */
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
- goto done;
- } /* end if */
+ start[i] = 0;
+ count[i] = MIN(prev_dims[i], cur_dims[i]);
+ } /* end else */
+ if (!ctr)
+ goto done;
+
+ if (ctr == 1) { /* changes for only one dimension */
+ /* Make the selection in the dataset based on "cur_dims" and "prev_dims" */
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ goto done;
+ } /* end if */
else { /* changes for more than one dimensions */
- HDmemset(start, 0, sizeof start);
+ HDmemset(start, 0, sizeof start);
- /* Make the selection in the dataset based on "cur_dims" and "prev_dims" */
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, cur_dims, NULL) < 0)
- goto done;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_NOTB, start, NULL, prev_dims, NULL) < 0)
- goto done;
+ /* Make the selection in the dataset based on "cur_dims" and "prev_dims" */
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, cur_dims, NULL) < 0)
+ goto done;
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_NOTB, start, NULL, prev_dims, NULL) < 0)
+ goto done;
} /* end else */
/* Get the number of elements in the selection */
- if(0 == (snum_elmts = H5Sget_select_npoints(sid)))
+ if (0 == (snum_elmts = H5Sget_select_npoints(sid)))
goto done;
num_elmts = (hsize_t)snum_elmts;
/* Create the memory space for the selection */
- if((mid = H5Screate_simple(1, &num_elmts, NULL)) < 0)
- goto done;
+ if ((mid = H5Screate_simple(1, &num_elmts, NULL)) < 0)
+ goto done;
/* Get the native datatype size */
- if((dtid = H5Dget_type(did)) < 0)
+ if ((dtid = H5Dget_type(did)) < 0)
goto done;
- if((tid = H5Tget_native_type(dtid, H5T_DIR_DEFAULT)) < 0)
+ if ((tid = H5Tget_native_type(dtid, H5T_DIR_DEFAULT)) < 0)
goto done;
- if(fields == NULL) { /* nothing in "fields" */
- /* Read and store all the elements in "buf" */
- if(H5Dread(did, tid, mid, sid, H5P_DEFAULT, buf) < 0)
- goto done;
- } /* end if */
- else { /* "fields" is specified */
- unsigned char *buf_p = (unsigned char *)buf; /* Pointer to the destination buffer */
- char *tmp_buf; /* Temporary buffer for data read */
- size_t tot_tsize; /* Total datatype size */
- size_t len; /* Estimate the number of comma-separated fields in "fields" */
-
- /* should be a compound datatype if "fields" exists */
- if(H5Tget_class(tid) != H5T_COMPOUND)
- goto done;
-
- /* Get the total size of the dataset's datatypes */
- if(0 == (tot_tsize = H5LD_get_dset_type_size(did, NULL)))
- goto done;
-
- /* Allocate memory for reading in the elements in the dataset selection */
- if(NULL == (sav_buf = tmp_buf = (char *)HDcalloc((size_t)num_elmts, tot_tsize)))
- goto done;
-
- /* Read the dataset elements in the selection */
- if(H5Dread(did, tid, mid, sid, H5P_DEFAULT, tmp_buf) < 0)
- goto done;
-
- /* Make a copy of "fields" */
- if(NULL == (dup_fields = HDstrdup(fields)))
- goto done;
-
- /* Allocate memory for the vector of H5LD_memb_t pointers */
- len = (HDstrlen(fields) / 2) + 2;
- if(NULL == (listv = (H5LD_memb_t **)HDcalloc(len, sizeof(H5LD_memb_t *))))
- goto done;
-
- /* Process and store information for "fields" */
- if(H5LD_construct_vector(dup_fields, listv, tid) < 0)
+ if (fields == NULL) { /* nothing in "fields" */
+ /* Read and store all the elements in "buf" */
+ if (H5Dread(did, tid, mid, sid, H5P_DEFAULT, buf) < 0)
+ goto done;
+ } /* end if */
+ else { /* "fields" is specified */
+ unsigned char *buf_p = (unsigned char *)buf; /* Pointer to the destination buffer */
+ char * tmp_buf; /* Temporary buffer for data read */
+ size_t tot_tsize; /* Total datatype size */
+ size_t len; /* Estimate the number of comma-separated fields in "fields" */
+
+ /* should be a compound datatype if "fields" exists */
+ if (H5Tget_class(tid) != H5T_COMPOUND)
goto done;
- /* Copy data for each dataset element in the selection */
- for(i = 0; i < (int)num_elmts; i++) {
- int j; /* Local index variable */
+ /* Get the total size of the dataset's datatypes */
+ if (0 == (tot_tsize = H5LD_get_dset_type_size(did, NULL)))
+ goto done;
- /* Copy data for "fields" to the input buffer */
- for(j = 0; listv[j] != NULL; j++) {
- HDmemcpy(buf_p, tmp_buf + listv[j]->tot_offset, listv[j]->last_tsize);
- buf_p += listv[j]->last_tsize;
- } /* end for */
- tmp_buf += tot_tsize;
- } /* end for */
+ /* Allocate memory for reading in the elements in the dataset selection */
+ if (NULL == (sav_buf = tmp_buf = (char *)HDcalloc((size_t)num_elmts, tot_tsize)))
+ goto done;
+
+ /* Read the dataset elements in the selection */
+ if (H5Dread(did, tid, mid, sid, H5P_DEFAULT, tmp_buf) < 0)
+ goto done;
+
+ /* Make a copy of "fields" */
+ if (NULL == (dup_fields = HDstrdup(fields)))
+ goto done;
- /* Clean up the vector of H5LD_memb_t structures */
- H5LD_clean_vector(listv);
+ /* Allocate memory for the vector of H5LD_memb_t pointers */
+ len = (HDstrlen(fields) / 2) + 2;
+ if (NULL == (listv = (H5LD_memb_t **)HDcalloc(len, sizeof(H5LD_memb_t *))))
+ goto done;
+
+ /* Process and store information for "fields" */
+ if (H5LD_construct_vector(dup_fields, listv, tid) < 0)
+ goto done;
+
+ /* Copy data for each dataset element in the selection */
+ for (i = 0; i < (int)num_elmts; i++) {
+ int j; /* Local index variable */
+
+ /* Copy data for "fields" to the input buffer */
+ for (j = 0; listv[j] != NULL; j++) {
+ HDmemcpy(buf_p, tmp_buf + listv[j]->tot_offset, listv[j]->last_tsize);
+ buf_p += listv[j]->last_tsize;
+ } /* end for */
+ tmp_buf += tot_tsize;
+ } /* end for */
+
+ /* Clean up the vector of H5LD_memb_t structures */
+ H5LD_clean_vector(listv);
} /* end else */
/* Indicate success */
@@ -547,23 +543,23 @@ H5LD_get_dset_elmts(hid_t did, const hsize_t *prev_dims, const hsize_t *cur_dims
done:
H5E_BEGIN_TRY
- H5Tclose(dtid);
- H5Tclose(tid);
- H5Sclose(sid);
- H5Sclose(mid);
+ H5Tclose(dtid);
+ H5Tclose(tid);
+ H5Sclose(sid);
+ H5Sclose(mid);
H5E_END_TRY
/* Free the array of H5LD_memb_t pointers */
- if(listv)
+ if (listv)
HDfree(listv);
/* Free memory */
- if(dup_fields)
+ if (dup_fields)
HDfree(dup_fields);
- if(sav_buf)
+ if (sav_buf)
HDfree(sav_buf);
- return(ret_value);
+ return (ret_value);
} /* H5LD_get_dset_elmts() */
/*-------------------------------------------------------------------------
@@ -573,7 +569,6 @@ done:
*-------------------------------------------------------------------------
*/
-
/*-------------------------------------------------------------------------
* Function: H5LDget_dset_dims
*
@@ -589,11 +584,9 @@ done:
herr_t
H5LDget_dset_dims(hid_t did, hsize_t *cur_dims)
{
- return(H5LD_get_dset_dims(did, cur_dims));
+ return (H5LD_get_dset_dims(did, cur_dims));
} /* H5LDget_dset_dims() */
-
-
/*-------------------------------------------------------------------------
* Function: H5LDget_dset_type_size
*
@@ -609,10 +602,9 @@ H5LDget_dset_dims(hid_t did, hsize_t *cur_dims)
size_t
H5LDget_dset_type_size(hid_t did, const char *fields)
{
- return(H5LD_get_dset_type_size(did, fields));
+ return (H5LD_get_dset_type_size(did, fields));
} /* H5LDget_dset_type_size() */
-
/*-------------------------------------------------------------------------
* Function: H5LDget_dset_elmts
*
@@ -626,8 +618,8 @@ H5LDget_dset_type_size(hid_t did, const char *fields)
*-------------------------------------------------------------------------
*/
herr_t
-H5LDget_dset_elmts(hid_t did, const hsize_t *prev_dims, const hsize_t *cur_dims, const char *fields, void *buf)
+H5LDget_dset_elmts(hid_t did, const hsize_t *prev_dims, const hsize_t *cur_dims, const char *fields,
+ void *buf)
{
- return(H5LD_get_dset_elmts(did, prev_dims, cur_dims, fields, buf) );
+ return (H5LD_get_dset_elmts(did, prev_dims, cur_dims, fields, buf));
} /* H5LDget_dset_elmts() */
-
diff --git a/hl/src/H5LDprivate.h b/hl/src/H5LDprivate.h
index 203bcea..f499adc 100644
--- a/hl/src/H5LDprivate.h
+++ b/hl/src/H5LDprivate.h
@@ -26,7 +26,7 @@
typedef struct H5LD_memb_t {
size_t tot_offset;
size_t last_tsize;
- hid_t last_tid;
+ hid_t last_tid;
char **names;
} H5LD_memb_t;
@@ -44,11 +44,10 @@ extern "C" {
* Decide to do #3 at this point of time after some discussion.
*/
H5_HLDLL void H5LD_clean_vector(H5LD_memb_t *listv[]);
-H5_HLDLL int H5LD_construct_vector(char *fields, H5LD_memb_t *listv[], hid_t par_tid);
+H5_HLDLL int H5LD_construct_vector(char *fields, H5LD_memb_t *listv[], hid_t par_tid);
#ifdef __cplusplus
}
#endif
#endif /* end _H5LDprivate_H */
-
diff --git a/hl/src/H5LDpublic.h b/hl/src/H5LDpublic.h
index e2bb745..43ea97b 100644
--- a/hl/src/H5LDpublic.h
+++ b/hl/src/H5LDpublic.h
@@ -20,12 +20,11 @@ extern "C" {
H5_HLDLL herr_t H5LDget_dset_dims(hid_t did, hsize_t *cur_dims);
H5_HLDLL size_t H5LDget_dset_type_size(hid_t did, const char *fields);
-H5_HLDLL herr_t H5LDget_dset_elmts(hid_t did, const hsize_t *prev_dims,
- const hsize_t *cur_dims, const char *fields, void *buf);
+H5_HLDLL herr_t H5LDget_dset_elmts(hid_t did, const hsize_t *prev_dims, const hsize_t *cur_dims,
+ const char *fields, void *buf);
#ifdef __cplusplus
}
#endif
#endif /* _H5LDpublic_H */
-
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index 0003018..14875fc 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -1,28 +1,27 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "H5LTprivate.h"
/* For Lex and Yacc */
-#define COL 3
-#define LIMIT 512
-#define INCREMENT 1024
-#define TMP_LEN 256
-#define MAX(a,b) (((a)>(b)) ? (a) : (b))
-size_t input_len;
-char *myinput;
-size_t indent = 0;
-
+#define COL 3
+#define LIMIT 512
+#define INCREMENT 1024
+#define TMP_LEN 256
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+size_t input_len;
+char * myinput;
+size_t indent = 0;
/* File Image operations
@@ -58,58 +57,58 @@ size_t indent = 0;
/* Data structure to pass application data to callbacks. */
typedef struct {
- void *app_image_ptr; /* Pointer to application buffer */
- size_t app_image_size; /* Size of application buffer */
- void *fapl_image_ptr; /* Pointer to FAPL buffer */
- size_t fapl_image_size; /* Size of FAPL buffer */
- int fapl_ref_count; /* Reference counter for FAPL buffer */
- void *vfd_image_ptr; /* Pointer to VFD buffer */
- size_t vfd_image_size; /* Size of VFD buffer */
- int vfd_ref_count; /* Reference counter for VFD buffer */
- unsigned flags; /* Flags indicate how the file image will */
- /* be open */
- int ref_count; /* Reference counter on udata struct */
+ void * app_image_ptr; /* Pointer to application buffer */
+ size_t app_image_size; /* Size of application buffer */
+ void * fapl_image_ptr; /* Pointer to FAPL buffer */
+ size_t fapl_image_size; /* Size of FAPL buffer */
+ int fapl_ref_count; /* Reference counter for FAPL buffer */
+ void * vfd_image_ptr; /* Pointer to VFD buffer */
+ size_t vfd_image_size; /* Size of VFD buffer */
+ int vfd_ref_count; /* Reference counter for VFD buffer */
+ unsigned flags; /* Flags indicate how the file image will */
+ /* be open */
+ int ref_count; /* Reference counter on udata struct */
} H5LT_file_image_ud_t;
/* callbacks prototypes for file image ops */
-static void *image_malloc(size_t size, H5FD_file_image_op_t file_image_op, void *udata);
-static void *image_memcpy(void *dest, const void *src, size_t size, H5FD_file_image_op_t file_image_op, void *udata);
-static void *image_realloc(void *ptr, size_t size, H5FD_file_image_op_t file_image_op, void *udata);
+static void * image_malloc(size_t size, H5FD_file_image_op_t file_image_op, void *udata);
+static void * image_memcpy(void *dest, const void *src, size_t size, H5FD_file_image_op_t file_image_op,
+ void *udata);
+static void * image_realloc(void *ptr, size_t size, H5FD_file_image_op_t file_image_op, void *udata);
static herr_t image_free(void *ptr, H5FD_file_image_op_t file_image_op, void *udata);
-static void *udata_copy(void *udata);
+static void * udata_copy(void *udata);
static herr_t udata_free(void *udata);
/* Definition of callbacks for file image operations. */
-
/*-------------------------------------------------------------------------
-* Function: image_malloc
-*
-* Purpose: Simulates malloc() function to avoid copying file images.
-* The application buffer is set to the buffer on only one FAPL.
-* Then the FAPL buffer can be copied to other FAPL buffers or
-* to only one VFD buffer.
-*
-* Return: Address of "allocated" buffer, if successful. Otherwise, it returns
-* NULL.
-*
-* Programmer: Christian Chilan
-*
-* Date: October 3, 2011
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: image_malloc
+ *
+ * Purpose: Simulates malloc() function to avoid copying file images.
+ * The application buffer is set to the buffer on only one FAPL.
+ * Then the FAPL buffer can be copied to other FAPL buffers or
+ * to only one VFD buffer.
+ *
+ * Return: Address of "allocated" buffer, if successful. Otherwise, it returns
+ * NULL.
+ *
+ * Programmer: Christian Chilan
+ *
+ * Date: October 3, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
static void *
image_malloc(size_t size, H5FD_file_image_op_t file_image_op, void *_udata)
{
- H5LT_file_image_ud_t *udata = (H5LT_file_image_ud_t *)_udata;
- void * return_value = NULL;
+ H5LT_file_image_ud_t *udata = (H5LT_file_image_ud_t *)_udata;
+ void * return_value = NULL;
/* callback is only used if the application buffer is not actually copied */
if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY))
goto out;
- switch ( file_image_op ) {
+ switch (file_image_op) {
/* the app buffer is "copied" to only one FAPL. Afterwards, FAPLs can be "copied" */
case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET:
if (udata->app_image_ptr == NULL)
@@ -123,9 +122,9 @@ image_malloc(size_t size, H5FD_file_image_op_t file_image_op, void *_udata)
if (udata->fapl_ref_count != 0)
goto out;
- udata->fapl_image_ptr = udata->app_image_ptr;
+ udata->fapl_image_ptr = udata->app_image_ptr;
udata->fapl_image_size = udata->app_image_size;
- return_value = udata->fapl_image_ptr;
+ return_value = udata->fapl_image_ptr;
udata->fapl_ref_count++;
break;
@@ -159,7 +158,7 @@ image_malloc(size_t size, H5FD_file_image_op_t file_image_op, void *_udata)
if (udata->fapl_ref_count == 0)
goto out;
- udata->vfd_image_ptr = udata->fapl_image_ptr;
+ udata->vfd_image_ptr = udata->fapl_image_ptr;
udata->vfd_image_size = size;
udata->vfd_ref_count++;
return_value = udata->vfd_image_ptr;
@@ -174,33 +173,31 @@ image_malloc(size_t size, H5FD_file_image_op_t file_image_op, void *_udata)
goto out;
} /* end switch */
- return(return_value);
+ return (return_value);
out:
return NULL;
} /* end image_malloc() */
-
/*-------------------------------------------------------------------------
-* Function: image_memcpy
-*
-* Purpose: Simulates memcpy() function to avoid copying file images.
-* The image buffer can be set to only one FAPL buffer, and
-* "copied" to only one VFD buffer. The FAPL buffer can be
-* "copied" to other FAPLs buffers.
-*
-* Return: The address of the destination buffer, if successful. Otherwise, it
-* returns NULL.
-*
-* Programmer: Christian Chilan
-*
-* Date: October 3, 2011
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: image_memcpy
+ *
+ * Purpose: Simulates memcpy() function to avoid copying file images.
+ * The image buffer can be set to only one FAPL buffer, and
+ * "copied" to only one VFD buffer. The FAPL buffer can be
+ * "copied" to other FAPLs buffers.
+ *
+ * Return: The address of the destination buffer, if successful. Otherwise, it
+ * returns NULL.
+ *
+ * Programmer: Christian Chilan
+ *
+ * Date: October 3, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
static void *
-image_memcpy(void *dest, const void *src, size_t size, H5FD_file_image_op_t file_image_op,
- void *_udata)
+image_memcpy(void *dest, const void *src, size_t size, H5FD_file_image_op_t file_image_op, void *_udata)
{
H5LT_file_image_ud_t *udata = (H5LT_file_image_ud_t *)_udata;
@@ -208,7 +205,7 @@ image_memcpy(void *dest, const void *src, size_t size, H5FD_file_image_op_t file
if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY))
goto out;
- switch(file_image_op) {
+ switch (file_image_op) {
case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET:
if (dest != udata->fapl_image_ptr)
goto out;
@@ -260,33 +257,32 @@ image_memcpy(void *dest, const void *src, size_t size, H5FD_file_image_op_t file
goto out;
} /* end switch */
- return(dest);
+ return (dest);
out:
return NULL;
} /* end image_memcpy() */
-
/*-------------------------------------------------------------------------
-* Function: image_realloc
-*
-* Purpose: Reallocates the shared application image buffer and updates data
-* structures that manage buffer "copying".
-*
-* Return: Address of reallocated buffer, if successful. Otherwise, it returns
-* NULL.
-*
-* Programmer: Christian Chilan
-*
-* Date: October 3, 2011
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: image_realloc
+ *
+ * Purpose: Reallocates the shared application image buffer and updates data
+ * structures that manage buffer "copying".
+ *
+ * Return: Address of reallocated buffer, if successful. Otherwise, it returns
+ * NULL.
+ *
+ * Programmer: Christian Chilan
+ *
+ * Date: October 3, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
static void *
image_realloc(void *ptr, size_t size, H5FD_file_image_op_t file_image_op, void *_udata)
{
- H5LT_file_image_ud_t *udata = (H5LT_file_image_ud_t *)_udata;
- void * return_value = NULL;
+ H5LT_file_image_ud_t *udata = (H5LT_file_image_ud_t *)_udata;
+ void * return_value = NULL;
/* callback is only used if the application buffer is not actually copied */
if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY))
@@ -313,33 +309,32 @@ image_realloc(void *ptr, size_t size, H5FD_file_image_op_t file_image_op, void *
goto out;
udata->vfd_image_size = size;
- return_value = udata->vfd_image_ptr;
+ return_value = udata->vfd_image_ptr;
} /* end if */
else
goto out;
- return(return_value);
+ return (return_value);
out:
return NULL;
} /* end image_realloc() */
-
/*-------------------------------------------------------------------------
-* Function: image_free
-*
-* Purpose: Simulates deallocation of FAPL and VFD buffers by decreasing
-* reference counters. Shared application buffer is actually
-* deallocated if there are no outstanding references.
-*
-* Return: SUCCEED or FAIL
-*
-* Programmer: Christian Chilan
-*
-* Date: October 3, 2011
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: image_free
+ *
+ * Purpose: Simulates deallocation of FAPL and VFD buffers by decreasing
+ * reference counters. Shared application buffer is actually
+ * deallocated if there are no outstanding references.
+ *
+ * Return: SUCCEED or FAIL
+ *
+ * Programmer: Christian Chilan
+ *
+ * Date: October 3, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
static herr_t
image_free(void *ptr, H5FD_file_image_op_t file_image_op, void *_udata)
{
@@ -349,7 +344,7 @@ image_free(void *ptr, H5FD_file_image_op_t file_image_op, void *_udata)
if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY))
goto out;
- switch(file_image_op) {
+ switch (file_image_op) {
case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE:
if (udata->fapl_image_ptr != ptr)
goto out;
@@ -358,13 +353,14 @@ image_free(void *ptr, H5FD_file_image_op_t file_image_op, void *_udata)
udata->fapl_ref_count--;
- /* release the shared buffer only if indicated by the respective flag and there are no outstanding references */
+ /* release the shared buffer only if indicated by the respective flag and there are no outstanding
+ * references */
if (udata->fapl_ref_count == 0 && udata->vfd_ref_count == 0 &&
- !(udata->flags & H5LT_FILE_IMAGE_DONT_RELEASE)) {
+ !(udata->flags & H5LT_FILE_IMAGE_DONT_RELEASE)) {
HDfree(udata->fapl_image_ptr);
- udata->app_image_ptr = NULL;
+ udata->app_image_ptr = NULL;
udata->fapl_image_ptr = NULL;
- udata->vfd_image_ptr = NULL;
+ udata->vfd_image_ptr = NULL;
} /* end if */
break;
@@ -376,13 +372,14 @@ image_free(void *ptr, H5FD_file_image_op_t file_image_op, void *_udata)
udata->vfd_ref_count--;
- /* release the shared buffer only if indicated by the respective flag and there are no outstanding references */
+ /* release the shared buffer only if indicated by the respective flag and there are no outstanding
+ * references */
if (udata->fapl_ref_count == 0 && udata->vfd_ref_count == 0 &&
- !(udata->flags & H5LT_FILE_IMAGE_DONT_RELEASE)) {
+ !(udata->flags & H5LT_FILE_IMAGE_DONT_RELEASE)) {
HDfree(udata->vfd_image_ptr);
- udata->app_image_ptr = NULL;
+ udata->app_image_ptr = NULL;
udata->fapl_image_ptr = NULL;
- udata->vfd_image_ptr = NULL;
+ udata->vfd_image_ptr = NULL;
} /* end if */
break;
@@ -397,28 +394,27 @@ image_free(void *ptr, H5FD_file_image_op_t file_image_op, void *_udata)
goto out;
} /* end switch */
- return(SUCCEED);
+ return (SUCCEED);
out:
- return(FAIL);
+ return (FAIL);
} /* end image_free() */
-
/*-------------------------------------------------------------------------
-* Function: udata_copy
-*
-* Purpose: Simulates the copying of the user data structure utilized in the
-* management of the "copying" of file images.
-*
-* Return: Address of "newly allocated" structure, if successful. Otherwise, it
-* returns NULL.
-*
-* Programmer: Christian Chilan
-*
-* Date: October 3, 2011
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: udata_copy
+ *
+ * Purpose: Simulates the copying of the user data structure utilized in the
+ * management of the "copying" of file images.
+ *
+ * Return: Address of "newly allocated" structure, if successful. Otherwise, it
+ * returns NULL.
+ *
+ * Programmer: Christian Chilan
+ *
+ * Date: October 3, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
static void *
udata_copy(void *_udata)
{
@@ -432,28 +428,27 @@ udata_copy(void *_udata)
udata->ref_count++;
- return(udata);
+ return (udata);
out:
return NULL;
} /* end udata_copy */
-
/*-------------------------------------------------------------------------
-* Function: udata_free
-*
-* Purpose: Simulates deallocation of the user data structure utilized in the
-* management of the "copying" of file images. The data structure is
-* actually deallocated when there are no outstanding references.
-*
-* Return: SUCCEED or FAIL
-*
-* Programmer: Christian Chilan
-*
-* Date: October 3, 2011
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: udata_free
+ *
+ * Purpose: Simulates deallocation of the user data structure utilized in the
+ * management of the "copying" of file images. The data structure is
+ * actually deallocated when there are no outstanding references.
+ *
+ * Return: SUCCEED or FAIL
+ *
+ * Programmer: Christian Chilan
+ *
+ * Date: October 3, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
static herr_t
udata_free(void *_udata)
{
@@ -468,409 +463,370 @@ udata_free(void *_udata)
udata->ref_count--;
/* checks that there are no references outstanding before deallocating udata */
- if (udata->ref_count == 0 && udata->fapl_ref_count == 0 &&
- udata->vfd_ref_count == 0)
+ if (udata->ref_count == 0 && udata->fapl_ref_count == 0 && udata->vfd_ref_count == 0)
HDfree(udata);
- return(SUCCEED);
+ return (SUCCEED);
out:
- return(FAIL);
+ return (FAIL);
} /* end udata_free */
/* End of callbacks definitions for file image operations */
/*-------------------------------------------------------------------------
-*
-* internal functions
-*
-*-------------------------------------------------------------------------
-*/
-static herr_t H5LT_get_attribute_mem(hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- hid_t mem_type_id,
- void *data);
-
-/*-------------------------------------------------------------------------
-* Function: H5LT_make_dataset
-*
-* Purpose: Creates and writes a dataset of a type tid
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Quincey Koziol
-*
-* Date: October 10, 2007
-*
-*-------------------------------------------------------------------------
-*/
+ *
+ * internal functions
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t H5LT_get_attribute_mem(hid_t loc_id, const char *obj_name, const char *attr_name,
+ hid_t mem_type_id, void *data);
+
+/*-------------------------------------------------------------------------
+ * Function: H5LT_make_dataset
+ *
+ * Purpose: Creates and writes a dataset of a type tid
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ *
+ * Date: October 10, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
static herr_t
-H5LT_make_dataset_numerical( hid_t loc_id,
- const char *dset_name,
- int rank,
- const hsize_t *dims,
- hid_t tid,
- const void *data )
+H5LT_make_dataset_numerical(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, hid_t tid,
+ const void *data)
{
- hid_t did = -1, sid = -1;
+ hid_t did = -1, sid = -1;
/* check the arguments */
if (dset_name == NULL)
- return -1;
+ return -1;
/* Create the data space for the dataset. */
- if((sid = H5Screate_simple(rank, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
return -1;
/* Create the dataset. */
- if((did = H5Dcreate2(loc_id, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* Write the dataset only if there is data to write */
- if(data)
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (data)
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
goto out;
/* End access to the dataset and release resources used by it. */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
return -1;
/* Terminate access to the data space. */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
return -1;
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
/*-------------------------------------------------------------------------
-*
-* Public functions
-*
-*-------------------------------------------------------------------------
-*/
+ *
+ * Public functions
+ *
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
-* Function: H5LTmake_dataset
-*
-* Purpose: Creates and writes a dataset of a type tid
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: March 19, 2001
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTmake_dataset
+ *
+ * Purpose: Creates and writes a dataset of a type tid
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: March 19, 2001
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTmake_dataset( hid_t loc_id,
- const char *dset_name,
- int rank,
- const hsize_t *dims,
- hid_t tid,
- const void *data )
+herr_t
+H5LTmake_dataset(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, hid_t tid,
+ const void *data)
{
- return(H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, tid, data));
+ return (H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, tid, data));
}
/*-------------------------------------------------------------------------
-* Function: H5LTmake_dataset_char
-*
-* Purpose: Creates and writes a dataset of H5T_NATIVE_CHAR type
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 14, 2001
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTmake_dataset_char
+ *
+ * Purpose: Creates and writes a dataset of H5T_NATIVE_CHAR type
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 14, 2001
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTmake_dataset_char( hid_t loc_id,
- const char *dset_name,
- int rank,
- const hsize_t *dims,
- const char *data )
+herr_t
+H5LTmake_dataset_char(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const char *data)
{
- return(H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_CHAR, data));
+ return (H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_CHAR, data));
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTmake_dataset_short
-*
-* Purpose: Creates and writes a dataset of H5T_NATIVE_SHORT type
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 14, 2001
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
-
+ * Function: H5LTmake_dataset_short
+ *
+ * Purpose: Creates and writes a dataset of H5T_NATIVE_SHORT type
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 14, 2001
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTmake_dataset_short( hid_t loc_id,
- const char *dset_name,
- int rank,
- const hsize_t *dims,
- const short *data )
+herr_t
+H5LTmake_dataset_short(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const short *data)
{
- return(H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_SHORT, data));
+ return (H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_SHORT, data));
}
/*-------------------------------------------------------------------------
-* Function: H5LTmake_dataset_int
-*
-* Purpose: Creates and writes a dataset of H5T_NATIVE_INT type
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 14, 2001
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
-
+ * Function: H5LTmake_dataset_int
+ *
+ * Purpose: Creates and writes a dataset of H5T_NATIVE_INT type
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 14, 2001
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTmake_dataset_int( hid_t loc_id,
- const char *dset_name,
- int rank,
- const hsize_t *dims,
- const int *data )
+herr_t
+H5LTmake_dataset_int(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const int *data)
{
- return(H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_INT, data));
+ return (H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_INT, data));
}
-
-
/*-------------------------------------------------------------------------
-* Function: H5LTmake_dataset_long
-*
-* Purpose: Creates and writes a dataset of H5T_NATIVE_LONG type
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 14, 2001
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
-
+ * Function: H5LTmake_dataset_long
+ *
+ * Purpose: Creates and writes a dataset of H5T_NATIVE_LONG type
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 14, 2001
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTmake_dataset_long( hid_t loc_id,
- const char *dset_name,
- int rank,
- const hsize_t *dims,
- const long *data )
+herr_t
+H5LTmake_dataset_long(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const long *data)
{
- return(H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_LONG, data));
+ return (H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_LONG, data));
}
/*-------------------------------------------------------------------------
-* Function: H5LTmake_dataset_float
-*
-* Purpose: Creates and writes a dataset of H5T_NATIVE_FLOAT type
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 14, 2001
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
-
+ * Function: H5LTmake_dataset_float
+ *
+ * Purpose: Creates and writes a dataset of H5T_NATIVE_FLOAT type
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 14, 2001
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTmake_dataset_float( hid_t loc_id,
- const char *dset_name,
- int rank,
- const hsize_t *dims,
- const float *data )
+herr_t
+H5LTmake_dataset_float(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const float *data)
{
- return(H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_FLOAT, data));
+ return (H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_FLOAT, data));
}
-
-
/*-------------------------------------------------------------------------
-* Function: H5LTmake_dataset_double
-*
-* Purpose: Creates and writes a dataset of H5T_NATIVE_DOUBLE type
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 14, 2001
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
-
+ * Function: H5LTmake_dataset_double
+ *
+ * Purpose: Creates and writes a dataset of H5T_NATIVE_DOUBLE type
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 14, 2001
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTmake_dataset_double( hid_t loc_id,
- const char *dset_name,
- int rank,
- const hsize_t *dims,
- const double *data )
+herr_t
+H5LTmake_dataset_double(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims,
+ const double *data)
{
- return(H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_DOUBLE, data));
+ return (H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_DOUBLE, data));
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTmake_dataset_string
-*
-* Purpose: Creates and writes a dataset of H5T_C_S1 type
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 05, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*
-*-------------------------------------------------------------------------
-*/
-
+ * Function: H5LTmake_dataset_string
+ *
+ * Purpose: Creates and writes a dataset of H5T_C_S1 type
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 05, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTmake_dataset_string(hid_t loc_id,
- const char *dset_name,
- const char *buf )
+herr_t
+H5LTmake_dataset_string(hid_t loc_id, const char *dset_name, const char *buf)
{
- hid_t did = -1;
- hid_t sid = -1;
- hid_t tid = -1;
- size_t size;
+ hid_t did = -1;
+ hid_t sid = -1;
+ hid_t tid = -1;
+ size_t size;
/* check the arguments */
if (dset_name == NULL)
- return -1;
+ return -1;
/* create a string data type */
- if((tid = H5Tcopy(H5T_C_S1)) < 0 )
+ if ((tid = H5Tcopy(H5T_C_S1)) < 0)
goto out;
size = HDstrlen(buf) + 1; /* extra null term */
- if(H5Tset_size(tid, size) < 0)
+ if (H5Tset_size(tid, size) < 0)
goto out;
- if(H5Tset_strpad(tid, H5T_STR_NULLTERM) < 0)
+ if (H5Tset_strpad(tid, H5T_STR_NULLTERM) < 0)
goto out;
/* Create the data space for the dataset. */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
goto out;
/* Create the dataset. */
- if((did = H5Dcreate2(loc_id, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* Write the dataset only if there is data to write */
- if(buf)
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (buf)
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
/* close*/
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
return -1;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
return -1;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Tclose(tid);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTopen_file_image
-*
-* Purpose: Open a user supplied file image using the core file driver.
-*
-* Return: File identifier, Failure: -1
-*
-* Programmer: Christian Chilan
-*
-* Date: October 3, 2011
-*
-*-------------------------------------------------------------------------
-*/
-hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags)
-{
- hid_t fapl=-1, file_id=-1; /* HDF5 identifiers */
- unsigned file_open_flags; /* Flags for image open */
- char file_name[64]; /* Filename buffer */
- size_t alloc_incr; /* Buffer allocation increment */
- size_t min_incr = 65536; /* Minimum buffer increment */
- double buf_prcnt = 0.1f; /* Percentage of buffer size to set
- as increment */
- static long file_name_counter;
- H5FD_file_image_callbacks_t callbacks = {&image_malloc, &image_memcpy,
- &image_realloc, &image_free,
- &udata_copy, &udata_free,
- (void *)NULL};
+ * Function: H5LTopen_file_image
+ *
+ * Purpose: Open a user supplied file image using the core file driver.
+ *
+ * Return: File identifier, Failure: -1
+ *
+ * Programmer: Christian Chilan
+ *
+ * Date: October 3, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags)
+{
+ hid_t fapl = -1, file_id = -1; /* HDF5 identifiers */
+ unsigned file_open_flags; /* Flags for image open */
+ char file_name[64]; /* Filename buffer */
+ size_t alloc_incr; /* Buffer allocation increment */
+ size_t min_incr = 65536; /* Minimum buffer increment */
+ double buf_prcnt = 0.1f; /* Percentage of buffer size to set
+ as increment */
+ static long file_name_counter;
+ H5FD_file_image_callbacks_t callbacks = {&image_malloc, &image_memcpy, &image_realloc, &image_free,
+ &udata_copy, &udata_free, (void *)NULL};
/* check arguments */
if (buf_ptr == NULL)
@@ -898,33 +854,33 @@ hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags)
/* Set callbacks for file image ops ONLY if the file image is NOT copied */
if (flags & H5LT_FILE_IMAGE_DONT_COPY) {
- H5LT_file_image_ud_t *udata; /* Pointer to udata structure */
+ H5LT_file_image_ud_t *udata; /* Pointer to udata structure */
/* Allocate buffer to communicate user data to callbacks */
if (NULL == (udata = (H5LT_file_image_ud_t *)HDmalloc(sizeof(H5LT_file_image_ud_t))))
goto out;
/* Initialize udata with info about app buffer containing file image and flags */
- udata->app_image_ptr = buf_ptr;
- udata->app_image_size = buf_size;
- udata->fapl_image_ptr = NULL;
+ udata->app_image_ptr = buf_ptr;
+ udata->app_image_size = buf_size;
+ udata->fapl_image_ptr = NULL;
udata->fapl_image_size = 0;
- udata->fapl_ref_count = 0;
- udata->vfd_image_ptr = NULL;
- udata->vfd_image_size = 0;
- udata->vfd_ref_count = 0;
- udata->flags = flags;
- udata->ref_count = 1; /* corresponding to the first FAPL */
+ udata->fapl_ref_count = 0;
+ udata->vfd_image_ptr = NULL;
+ udata->vfd_image_size = 0;
+ udata->vfd_ref_count = 0;
+ udata->flags = flags;
+ udata->ref_count = 1; /* corresponding to the first FAPL */
/* copy address of udata into callbacks */
callbacks.udata = (void *)udata;
/* Set file image callbacks */
- if (H5Pset_file_image_callbacks(fapl, &callbacks) < 0) {
+ if (H5Pset_file_image_callbacks(fapl, &callbacks) < 0) {
HDfree(udata);
goto out;
} /* end if */
- } /* end if */
+ } /* end if */
/* Assign file image in user buffer to FAPL */
if (H5Pset_file_image(fapl, buf_ptr, buf_size) < 0)
@@ -951,46 +907,44 @@ hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags)
return file_id;
out:
- H5E_BEGIN_TRY {
- H5Pclose(fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Pclose(fapl); }
+ H5E_END_TRY;
return -1;
} /* end H5LTopen_file_image() */
-
/*-------------------------------------------------------------------------
-* Function: H5LT_read_dataset
-*
-* Purpose: Reads a dataset from disk.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Quincey Koziol
-*
-* Date: October 8, 2007
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LT_read_dataset
+ *
+ * Purpose: Reads a dataset from disk.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ *
+ * Date: October 8, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
static herr_t
H5LT_read_dataset_numerical(hid_t loc_id, const char *dset_name, hid_t tid, void *data)
{
- hid_t did;
+ hid_t did;
/* check the arguments */
if (dset_name == NULL)
- return -1;
+ return -1;
/* Open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
return -1;
/* Read */
- if(H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
goto out;
/* End access to the dataset and release resources used by it. */
- if(H5Dclose(did))
+ if (H5Dclose(did))
return -1;
return 0;
@@ -1001,407 +955,394 @@ out:
}
/*-------------------------------------------------------------------------
-* Function: H5LTread_dataset
-*
-* Purpose: Reads a dataset from disk.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: June 13, 2001
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTread_dataset
+ *
+ * Purpose: Reads a dataset from disk.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: June 13, 2001
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTread_dataset(hid_t loc_id,
- const char *dset_name,
- hid_t tid,
- void *data)
+herr_t
+H5LTread_dataset(hid_t loc_id, const char *dset_name, hid_t tid, void *data)
{
- return(H5LT_read_dataset_numerical(loc_id, dset_name, tid, data));
+ return (H5LT_read_dataset_numerical(loc_id, dset_name, tid, data));
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTread_dataset_char
-*
-* Purpose: Reads a dataset from disk.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 5, 2001
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTread_dataset_char
+ *
+ * Purpose: Reads a dataset from disk.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 5, 2001
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTread_dataset_char( hid_t loc_id,
- const char *dset_name,
- char *data )
+herr_t
+H5LTread_dataset_char(hid_t loc_id, const char *dset_name, char *data)
{
- return(H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_CHAR, data));
+ return (H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_CHAR, data));
}
/*-------------------------------------------------------------------------
-* Function: H5LTread_dataset_short
-*
-* Purpose: Reads a dataset from disk.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 5, 2001
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTread_dataset_short
+ *
+ * Purpose: Reads a dataset from disk.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 5, 2001
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTread_dataset_short( hid_t loc_id,
- const char *dset_name,
- short *data )
+herr_t
+H5LTread_dataset_short(hid_t loc_id, const char *dset_name, short *data)
{
- return(H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_SHORT, data));
+ return (H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_SHORT, data));
}
/*-------------------------------------------------------------------------
-* Function: H5LTread_dataset_int
-*
-* Purpose: Reads a dataset from disk.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 5, 2001
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTread_dataset_int
+ *
+ * Purpose: Reads a dataset from disk.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 5, 2001
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTread_dataset_int( hid_t loc_id,
- const char *dset_name,
- int *data )
+herr_t
+H5LTread_dataset_int(hid_t loc_id, const char *dset_name, int *data)
{
- return(H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_INT, data));
+ return (H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_INT, data));
}
/*-------------------------------------------------------------------------
-* Function: H5LTread_dataset_long
-*
-* Purpose: Reads a dataset from disk.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 5, 2001
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTread_dataset_long
+ *
+ * Purpose: Reads a dataset from disk.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 5, 2001
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTread_dataset_long( hid_t loc_id,
- const char *dset_name,
- long *data )
+herr_t
+H5LTread_dataset_long(hid_t loc_id, const char *dset_name, long *data)
{
- return(H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_LONG, data));
+ return (H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_LONG, data));
}
/*-------------------------------------------------------------------------
-* Function: H5LTread_dataset_float
-*
-* Purpose: Reads a dataset from disk.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 5, 2001
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTread_dataset_float
+ *
+ * Purpose: Reads a dataset from disk.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 5, 2001
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTread_dataset_float( hid_t loc_id,
- const char *dset_name,
- float *data )
+herr_t
+H5LTread_dataset_float(hid_t loc_id, const char *dset_name, float *data)
{
- return(H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_FLOAT, data));
+ return (H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_FLOAT, data));
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTread_dataset_double
-*
-* Purpose: Reads a dataset from disk.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 5, 2001
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTread_dataset_double
+ *
+ * Purpose: Reads a dataset from disk.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 5, 2001
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTread_dataset_double( hid_t loc_id,
- const char *dset_name,
- double *data )
+herr_t
+H5LTread_dataset_double(hid_t loc_id, const char *dset_name, double *data)
{
- return(H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_DOUBLE, data));
+ return (H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_DOUBLE, data));
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTread_dataset_string
-*
-* Purpose: Reads a dataset
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: October 05, 2004
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTread_dataset_string
+ *
+ * Purpose: Reads a dataset
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: October 05, 2004
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTread_dataset_string( hid_t loc_id,
- const char *dset_name,
- char *buf )
+herr_t
+H5LTread_dataset_string(hid_t loc_id, const char *dset_name, char *buf)
{
- hid_t did = -1;
- hid_t tid = -1;
+ hid_t did = -1;
+ hid_t tid = -1;
/* check the arguments */
if (dset_name == NULL)
- return -1;
+ return -1;
/* Open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
return -1;
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
goto out;
/* Read */
- if(H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
/* close */
- if(H5Dclose(did))
+ if (H5Dclose(did))
goto out;
- if(H5Tclose(tid))
+ if (H5Tclose(tid))
return -1;
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Tclose(tid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTget_dataset_ndims
-*
-* Purpose: Gets the dimensionality of a dataset.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 4, 2001
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTget_dataset_ndims
+ *
+ * Purpose: Gets the dimensionality of a dataset.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 4, 2001
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTget_dataset_ndims( hid_t loc_id,
- const char *dset_name,
- int *rank )
+herr_t
+H5LTget_dataset_ndims(hid_t loc_id, const char *dset_name, int *rank)
{
- hid_t did = -1;
- hid_t sid = -1;
+ hid_t did = -1;
+ hid_t sid = -1;
/* check the arguments */
if (dset_name == NULL)
- return -1;
+ return -1;
/* Open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
return -1;
/* Get the dataspace handle */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto out;
/* Get rank */
- if((*rank = H5Sget_simple_extent_ndims(sid)) < 0)
+ if ((*rank = H5Sget_simple_extent_ndims(sid)) < 0)
goto out;
/* Terminate access to the dataspace */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
/* End access to the dataset */
- if(H5Dclose(did))
+ if (H5Dclose(did))
return -1;
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTget_dataset_info
-*
-* Purpose: Gets information about a dataset.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 4, 2001
-* Modified: February 28, 2006: checked for NULL parameters
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTget_dataset_info
+ *
+ * Purpose: Gets information about a dataset.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 4, 2001
+ * Modified: February 28, 2006: checked for NULL parameters
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTget_dataset_info( hid_t loc_id,
- const char *dset_name,
- hsize_t *dims,
- H5T_class_t *type_class,
- size_t *type_size )
+herr_t
+H5LTget_dataset_info(hid_t loc_id, const char *dset_name, hsize_t *dims, H5T_class_t *type_class,
+ size_t *type_size)
{
- hid_t did = -1;
- hid_t tid = -1;
- hid_t sid = -1;
+ hid_t did = -1;
+ hid_t tid = -1;
+ hid_t sid = -1;
/* check the arguments */
if (dset_name == NULL)
- return -1;
+ return -1;
/* open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
return -1;
/* get an identifier for the datatype. */
tid = H5Dget_type(did);
/* get the class. */
- if(type_class != NULL)
+ if (type_class != NULL)
*type_class = H5Tget_class(tid);
/* get the size. */
- if(type_size!=NULL)
+ if (type_size != NULL)
*type_size = H5Tget_size(tid);
- if(dims != NULL) {
+ if (dims != NULL) {
/* get the dataspace handle */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto out;
/* get dimensions */
- if(H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
goto out;
/* terminate access to the dataspace */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
} /* end if */
/* release the datatype. */
- if(H5Tclose(tid))
+ if (H5Tclose(tid))
return -1;
/* end access to the dataset */
- if(H5Dclose(did))
+ if (H5Dclose(did))
return -1;
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(tid);
H5Sclose(sid);
H5Dclose(did);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-
}
/*-------------------------------------------------------------------------
-* Function: find_dataset
-*
-* Purpose: operator function used by H5LTfind_dataset
-*
-* Programmer: Pedro Vicente
-*
-* Date: June 21, 2001
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: find_dataset
+ *
+ * Purpose: operator function used by H5LTfind_dataset
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: June 21, 2001
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
static herr_t
find_dataset(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *op_data)
{
/* Define a default zero value for return. This will cause the iterator to continue if
- * the dataset is not found yet.
- */
+ * the dataset is not found yet.
+ */
int ret = 0;
/* check the arguments */
if (name == NULL)
- return ret;
+ return ret;
/* Shut the compiler up */
loc_id = loc_id;
- linfo = linfo;
+ linfo = linfo;
/* Define a positive value for return value if the dataset was found. This will
- * cause the iterator to immediately return that positive value,
- * indicating short-circuit success
- */
- if(HDstrncmp(name, (char *)op_data, HDstrlen((char *)op_data)) == 0)
+ * cause the iterator to immediately return that positive value,
+ * indicating short-circuit success
+ */
+ if (HDstrncmp(name, (char *)op_data, HDstrlen((char *)op_data)) == 0)
ret = 1;
return ret;
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTfind_dataset
-*
-* Purpose: Inquires if a dataset named dset_name exists attached
-* to the object loc_id.
-*
-* Programmer: Pedro Vicente
-*
-* Date: July 15, 2001
-*
-* Return:
-* Success: The return value of the first operator that
-* returns non-zero, or zero if all members were
-* processed with no operator returning non-zero.
-*
-* Failure: Negative if something goes wrong within the
-* library, or the negative value returned by one
-* of the operators.
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTfind_dataset
+ *
+ * Purpose: Inquires if a dataset named dset_name exists attached
+ * to the object loc_id.
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: July 15, 2001
+ *
+ * Return:
+ * Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
+ *
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
+ *
+ *-------------------------------------------------------------------------
+ */
/* H5Literate wants a non-const pointer but we have a const pointer in the API
* call. It's safe to ignore this because we control the callback, don't
* modify the op_data buffer (i.e.: dset_name) during the traversal, and the
@@ -1409,105 +1350,102 @@ find_dataset(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *op_
*/
H5_GCC_DIAG_OFF("cast-qual")
herr_t
-H5LTfind_dataset( hid_t loc_id, const char *dset_name )
+H5LTfind_dataset(hid_t loc_id, const char *dset_name)
{
return H5Literate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, 0, find_dataset, (void *)dset_name);
}
H5_GCC_DIAG_ON("cast-qual")
/*-------------------------------------------------------------------------
-*
-* Set attribute functions
-*
-*-------------------------------------------------------------------------
-*/
-
+ *
+ * Set attribute functions
+ *
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
-* Function: H5LTset_attribute_string
-*
-* Purpose: Creates and writes a string attribute named attr_name and attaches
-* it to the object specified by the name obj_name.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: July 23, 2001
-*
-* Comments: If the attribute already exists, it is overwritten
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTset_attribute_string
+ *
+ * Purpose: Creates and writes a string attribute named attr_name and attaches
+ * it to the object specified by the name obj_name.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: July 23, 2001
+ *
+ * Comments: If the attribute already exists, it is overwritten
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTset_attribute_string( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const char *attr_data )
+herr_t
+H5LTset_attribute_string(hid_t loc_id, const char *obj_name, const char *attr_name, const char *attr_data)
{
- hid_t attr_type;
- hid_t attr_space_id;
- hid_t attr_id;
- hid_t obj_id;
- int has_attr;
- size_t attr_size;
+ hid_t attr_type;
+ hid_t attr_space_id;
+ hid_t attr_id;
+ hid_t obj_id;
+ int has_attr;
+ size_t attr_size;
/* check the arguments */
if (obj_name == NULL)
- return -1;
+ return -1;
if (attr_name == NULL)
- return -1;
+ return -1;
if (attr_data == NULL)
- return -1;
+ return -1;
/* Open the object */
if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0)
return -1;
/* Create the attribute */
- if ( (attr_type = H5Tcopy( H5T_C_S1 )) < 0 )
+ if ((attr_type = H5Tcopy(H5T_C_S1)) < 0)
goto out;
- attr_size = HDstrlen( attr_data ) + 1; /* extra null term */
+ attr_size = HDstrlen(attr_data) + 1; /* extra null term */
- if ( H5Tset_size( attr_type, (size_t)attr_size) < 0 )
+ if (H5Tset_size(attr_type, (size_t)attr_size) < 0)
goto out;
- if ( H5Tset_strpad( attr_type, H5T_STR_NULLTERM ) < 0 )
+ if (H5Tset_strpad(attr_type, H5T_STR_NULLTERM) < 0)
goto out;
- if ( (attr_space_id = H5Screate( H5S_SCALAR )) < 0 )
+ if ((attr_space_id = H5Screate(H5S_SCALAR)) < 0)
goto out;
/* Verify if the attribute already exists */
has_attr = H5LT_find_attribute(obj_id, attr_name);
/* The attribute already exists, delete it */
- if(has_attr == 1)
- if(H5Adelete(obj_id, attr_name) < 0)
+ if (has_attr == 1)
+ if (H5Adelete(obj_id, attr_name) < 0)
goto out;
/* Create and write the attribute */
- if((attr_id = H5Acreate2(obj_id, attr_name, attr_type, attr_space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Acreate2(obj_id, attr_name, attr_type, attr_space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Awrite(attr_id, attr_type, attr_data) < 0)
+ if (H5Awrite(attr_id, attr_type, attr_data) < 0)
goto out;
- if(H5Aclose(attr_id) < 0)
+ if (H5Aclose(attr_id) < 0)
goto out;
- if(H5Sclose(attr_space_id) < 0)
+ if (H5Sclose(attr_space_id) < 0)
goto out;
- if(H5Tclose(attr_type) < 0)
+ if (H5Tclose(attr_type) < 0)
goto out;
/* Close the object */
- if(H5Oclose(obj_id) < 0)
+ if (H5Oclose(obj_id) < 0)
return -1;
return 0;
@@ -1518,79 +1456,71 @@ out:
return -1;
}
-
-
-
-
/*-------------------------------------------------------------------------
-* Function: H5LT_set_attribute_numerical
-*
-* Purpose: Private function used by H5LTset_attribute_int and H5LTset_attribute_float
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: July 25, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-
+ * Function: H5LT_set_attribute_numerical
+ *
+ * Purpose: Private function used by H5LTset_attribute_int and H5LTset_attribute_float
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: July 25, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LT_set_attribute_numerical( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- size_t size,
- hid_t tid,
- const void *data )
+herr_t
+H5LT_set_attribute_numerical(hid_t loc_id, const char *obj_name, const char *attr_name, size_t size,
+ hid_t tid, const void *data)
{
- hid_t obj_id, sid, attr_id;
- hsize_t dim_size=size;
- int has_attr;
+ hid_t obj_id, sid, attr_id;
+ hsize_t dim_size = size;
+ int has_attr;
/* check the arguments */
if (obj_name == NULL)
- return -1;
+ return -1;
if (attr_name == NULL)
- return -1;
+ return -1;
/* Open the object */
if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0)
return -1;
/* Create the data space for the attribute. */
- if ( (sid = H5Screate_simple( 1, &dim_size, NULL )) < 0 )
+ if ((sid = H5Screate_simple(1, &dim_size, NULL)) < 0)
goto out;
/* Verify if the attribute already exists */
has_attr = H5LT_find_attribute(obj_id, attr_name);
/* The attribute already exists, delete it */
- if(has_attr == 1)
- if(H5Adelete(obj_id, attr_name) < 0)
+ if (has_attr == 1)
+ if (H5Adelete(obj_id, attr_name) < 0)
goto out;
/* Create the attribute. */
- if((attr_id = H5Acreate2(obj_id, attr_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Acreate2(obj_id, attr_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* Write the attribute data. */
- if(H5Awrite(attr_id, tid, data) < 0)
+ if (H5Awrite(attr_id, tid, data) < 0)
goto out;
/* Close the attribute. */
- if(H5Aclose(attr_id) < 0)
+ if (H5Aclose(attr_id) < 0)
goto out;
/* Close the dataspace. */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
/* Close the object */
- if(H5Oclose(obj_id) < 0)
+ if (H5Oclose(obj_id) < 0)
return -1;
return 0;
@@ -1600,439 +1530,385 @@ out:
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTset_attribute_char
-*
-* Purpose: Create and write an attribute.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 7, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTset_attribute_char
+ *
+ * Purpose: Create and write an attribute.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 7, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTset_attribute_char( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const char *data,
- size_t size )
+herr_t
+H5LTset_attribute_char(hid_t loc_id, const char *obj_name, const char *attr_name, const char *data,
+ size_t size)
{
- if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size,
- H5T_NATIVE_CHAR, data ) < 0 )
+ if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_CHAR, data) < 0)
return -1;
return 0;
}
/*-------------------------------------------------------------------------
-* Function: H5LTset_attribute_uchar
-*
-* Purpose: Create and write an attribute.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: March 8, 2004
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTset_attribute_uchar
+ *
+ * Purpose: Create and write an attribute.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: March 8, 2004
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTset_attribute_uchar( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const unsigned char *data,
- size_t size )
+herr_t
+H5LTset_attribute_uchar(hid_t loc_id, const char *obj_name, const char *attr_name, const unsigned char *data,
+ size_t size)
{
- if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size,
- H5T_NATIVE_UCHAR, data ) < 0 )
+ if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_UCHAR, data) < 0)
return -1;
return 0;
-
}
/*-------------------------------------------------------------------------
-* Function: H5LTset_attribute_short
-*
-* Purpose: Create and write an attribute.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 7, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTset_attribute_short
+ *
+ * Purpose: Create and write an attribute.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 7, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTset_attribute_short( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const short *data,
- size_t size )
+herr_t
+H5LTset_attribute_short(hid_t loc_id, const char *obj_name, const char *attr_name, const short *data,
+ size_t size)
{
- if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size,
- H5T_NATIVE_SHORT, data ) < 0 )
+ if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_SHORT, data) < 0)
return -1;
return 0;
-
}
/*-------------------------------------------------------------------------
-* Function: H5LTset_attribute_ushort
-*
-* Purpose: Create and write an attribute.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: March 8, 2004
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTset_attribute_ushort
+ *
+ * Purpose: Create and write an attribute.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: March 8, 2004
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTset_attribute_ushort( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const unsigned short *data,
- size_t size )
+herr_t
+H5LTset_attribute_ushort(hid_t loc_id, const char *obj_name, const char *attr_name,
+ const unsigned short *data, size_t size)
{
- if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size,
- H5T_NATIVE_USHORT, data ) < 0 )
+ if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_USHORT, data) < 0)
return -1;
return 0;
-
}
/*-------------------------------------------------------------------------
-* Function: H5LTset_attribute_int
-*
-* Purpose: Create and write an attribute.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 7, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTset_attribute_int
+ *
+ * Purpose: Create and write an attribute.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 7, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTset_attribute_int( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const int *data,
- size_t size )
+herr_t
+H5LTset_attribute_int(hid_t loc_id, const char *obj_name, const char *attr_name, const int *data, size_t size)
{
- if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size,
- H5T_NATIVE_INT, data ) < 0 )
+ if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_INT, data) < 0)
return -1;
return 0;
-
}
/*-------------------------------------------------------------------------
-* Function: H5LTset_attribute_uint
-*
-* Purpose: Create and write an attribute.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: March 8, 2004
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTset_attribute_uint
+ *
+ * Purpose: Create and write an attribute.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: March 8, 2004
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTset_attribute_uint( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const unsigned int *data,
- size_t size )
+herr_t
+H5LTset_attribute_uint(hid_t loc_id, const char *obj_name, const char *attr_name, const unsigned int *data,
+ size_t size)
{
- if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size,
- H5T_NATIVE_UINT, data ) < 0 )
+ if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_UINT, data) < 0)
return -1;
return 0;
-
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTset_attribute_long
-*
-* Purpose: Create and write an attribute.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 7, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTset_attribute_long
+ *
+ * Purpose: Create and write an attribute.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 7, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTset_attribute_long( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const long *data,
- size_t size )
+herr_t
+H5LTset_attribute_long(hid_t loc_id, const char *obj_name, const char *attr_name, const long *data,
+ size_t size)
{
- if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size,
- H5T_NATIVE_LONG, data ) < 0 )
+ if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_LONG, data) < 0)
return -1;
return 0;
-
}
/*-------------------------------------------------------------------------
-* Function: H5LTset_attribute_long_long
-*
-* Purpose: Create and write an attribute.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Elena Pourmal
-*
-* Date: June 17, 2005
-*
-* Comments: This function was added to support attributes of type long long
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTset_attribute_long_long
+ *
+ * Purpose: Create and write an attribute.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Elena Pourmal
+ *
+ * Date: June 17, 2005
+ *
+ * Comments: This function was added to support attributes of type long long
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTset_attribute_long_long( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const long long *data,
- size_t size )
+herr_t
+H5LTset_attribute_long_long(hid_t loc_id, const char *obj_name, const char *attr_name, const long long *data,
+ size_t size)
{
- if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size,
- H5T_NATIVE_LLONG, data ) < 0 )
+ if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_LLONG, data) < 0)
return -1;
return 0;
-
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTset_attribute_ulong
-*
-* Purpose: Create and write an attribute.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: March 8, 2004
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTset_attribute_ulong
+ *
+ * Purpose: Create and write an attribute.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: March 8, 2004
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTset_attribute_ulong( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const unsigned long *data,
- size_t size )
+herr_t
+H5LTset_attribute_ulong(hid_t loc_id, const char *obj_name, const char *attr_name, const unsigned long *data,
+ size_t size)
{
- if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size,
- H5T_NATIVE_ULONG, data ) < 0 )
+ if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_ULONG, data) < 0)
return -1;
return 0;
-
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTset_attribute_float
-*
-* Purpose: Create and write an attribute.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: July 25, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-
+ * Function: H5LTset_attribute_float
+ *
+ * Purpose: Create and write an attribute.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: July 25, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTset_attribute_float( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const float *data,
- size_t size )
+herr_t
+H5LTset_attribute_float(hid_t loc_id, const char *obj_name, const char *attr_name, const float *data,
+ size_t size)
{
- if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size,
- H5T_NATIVE_FLOAT, data ) < 0 )
+ if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_FLOAT, data) < 0)
return -1;
return 0;
-
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTset_attribute_double
-*
-* Purpose: Create and write an attribute.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 7, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTset_attribute_double
+ *
+ * Purpose: Create and write an attribute.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 7, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTset_attribute_double( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const double *data,
- size_t size )
+herr_t
+H5LTset_attribute_double(hid_t loc_id, const char *obj_name, const char *attr_name, const double *data,
+ size_t size)
{
- if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size,
- H5T_NATIVE_DOUBLE, data ) < 0 )
+ if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_DOUBLE, data) < 0)
return -1;
return 0;
-
}
-
-
/*-------------------------------------------------------------------------
-* Function: find_attr
-*
-* Purpose: operator function used by H5LT_find_attribute
-*
-* Programmer: Pedro Vicente
-*
-* Date: June 21, 2001
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: find_attr
+ *
+ * Purpose: operator function used by H5LT_find_attribute
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: June 21, 2001
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
static herr_t
-find_attr(hid_t loc_id, const char *name, const H5A_info_t *ainfo,
- void *op_data)
+find_attr(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *op_data)
{
int ret = H5_ITER_CONT;
/* check the arguments */
if (name == NULL)
- return H5_ITER_CONT;
+ return H5_ITER_CONT;
/* Shut compiler up */
- loc_id = loc_id; ainfo = ainfo;
+ loc_id = loc_id;
+ ainfo = ainfo;
/* Define a positive value for return value if the attribute was found. This will
- * cause the iterator to immediately return that positive value,
- * indicating short-circuit success
- */
+ * cause the iterator to immediately return that positive value,
+ * indicating short-circuit success
+ */
- if(HDstrncmp(name, (char *)op_data, MAX(HDstrlen((char *)op_data),HDstrlen(name))) == 0)
+ if (HDstrncmp(name, (char *)op_data, MAX(HDstrlen((char *)op_data), HDstrlen(name))) == 0)
ret = H5_ITER_STOP;
return ret;
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTfind_attribute
-*
-* Purpose: Inquires if an attribute named attr_name exists attached to
-* the object loc_id.
-*
-* Programmer: Pedro Vicente
-*
-* Date: May 17, 2006
-*
-* Comments:
-* Calls the private version of the function
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTfind_attribute
+ *
+ * Purpose: Inquires if an attribute named attr_name exists attached to
+ * the object loc_id.
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: May 17, 2006
+ *
+ * Comments:
+ * Calls the private version of the function
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTfind_attribute( hid_t loc_id, const char* attr_name )
+herr_t
+H5LTfind_attribute(hid_t loc_id, const char *attr_name)
{
- return H5LT_find_attribute(loc_id,attr_name);
+ return H5LT_find_attribute(loc_id, attr_name);
}
-
-
/*-------------------------------------------------------------------------
-* Function: H5LT_find_attribute
-*
-* Purpose: Inquires if an attribute named attr_name exists attached to the object loc_id.
-*
-* Programmer: Pedro Vicente
-*
-* Date: June 21, 2001
-*
-* Comments:
-* The function uses H5Aiterate2 with the operator function find_attr
-*
-* Return:
-* Success: The return value of the first operator that
-* returns non-zero, or zero if all members were
-* processed with no operator returning non-zero.
-*
-* Failure: Negative if something goes wrong within the
-* library, or the negative value returned by one
-* of the operators.
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LT_find_attribute
+ *
+ * Purpose: Inquires if an attribute named attr_name exists attached to the object loc_id.
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: June 21, 2001
+ *
+ * Comments:
+ * The function uses H5Aiterate2 with the operator function find_attr
+ *
+ * Return:
+ * Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
+ *
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
+ *
+ *-------------------------------------------------------------------------
+ */
/* H5Aiterate wants a non-const pointer but we have a const pointer in the API
* call. It's safe to ignore this because we control the callback, don't
* modify the op_data buffer (i.e.: attr_name) during the traversal, and the
@@ -2040,122 +1916,113 @@ herr_t H5LTfind_attribute( hid_t loc_id, const char* attr_name )
*/
H5_GCC_DIAG_OFF("cast-qual")
herr_t
-H5LT_find_attribute( hid_t loc_id, const char* attr_name )
+H5LT_find_attribute(hid_t loc_id, const char *attr_name)
{
return H5Aiterate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, find_attr, (void *)attr_name);
}
H5_GCC_DIAG_ON("cast-qual")
-
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute_ndims
-*
-* Purpose: Gets the dimensionality of an attribute.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 4, 2001
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTget_attribute_ndims
+ *
+ * Purpose: Gets the dimensionality of an attribute.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 4, 2001
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTget_attribute_ndims( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- int *rank )
+herr_t
+H5LTget_attribute_ndims(hid_t loc_id, const char *obj_name, const char *attr_name, int *rank)
{
- hid_t attr_id;
- hid_t sid;
- hid_t obj_id;
+ hid_t attr_id;
+ hid_t sid;
+ hid_t obj_id;
/* check the arguments */
if (obj_name == NULL)
- return -1;
+ return -1;
if (attr_name == NULL)
- return -1;
+ return -1;
/* Open the object */
- if((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0)
+ if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0)
return -1;
/* Open the attribute. */
- if((attr_id = H5Aopen(obj_id, attr_name, H5P_DEFAULT)) < 0)
- {
+ if ((attr_id = H5Aopen(obj_id, attr_name, H5P_DEFAULT)) < 0) {
H5Oclose(obj_id);
return -1;
}
/* Get the dataspace handle */
- if((sid = H5Aget_space(attr_id)) < 0)
+ if ((sid = H5Aget_space(attr_id)) < 0)
goto out;
/* Get rank */
- if((*rank = H5Sget_simple_extent_ndims(sid)) < 0)
+ if ((*rank = H5Sget_simple_extent_ndims(sid)) < 0)
goto out;
/* Terminate access to the attribute */
- if ( H5Sclose( sid ) < 0 )
+ if (H5Sclose(sid) < 0)
goto out;
/* End access to the attribute */
- if ( H5Aclose( attr_id ) )
- goto out;;
+ if (H5Aclose(attr_id))
+ goto out;
+ ;
/* Close the object */
- if(H5Oclose(obj_id) < 0 )
+ if (H5Oclose(obj_id) < 0)
return -1;
return 0;
out:
- H5Aclose( attr_id );
+ H5Aclose(attr_id);
H5Oclose(obj_id);
return -1;
-
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute_info
-*
-* Purpose: Gets information about an attribute.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 4, 2001
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LTget_attribute_info
+ *
+ * Purpose: Gets information about an attribute.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 4, 2001
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTget_attribute_info( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- hsize_t *dims,
- H5T_class_t *type_class,
- size_t *type_size )
+herr_t
+H5LTget_attribute_info(hid_t loc_id, const char *obj_name, const char *attr_name, hsize_t *dims,
+ H5T_class_t *type_class, size_t *type_size)
{
- hid_t attr_id;
- hid_t tid;
- hid_t sid;
- hid_t obj_id;
+ hid_t attr_id;
+ hid_t tid;
+ hid_t sid;
+ hid_t obj_id;
/* check the arguments */
if (obj_name == NULL)
- return -1;
+ return -1;
if (attr_name == NULL)
- return -1;
+ return -1;
/* Open the object */
- if((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0)
+ if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0)
return -1;
/* Open the attribute. */
- if((attr_id = H5Aopen(obj_id, attr_name, H5P_DEFAULT)) < 0)
- {
+ if ((attr_id = H5Aopen(obj_id, attr_name, H5P_DEFAULT)) < 0) {
H5Oclose(obj_id);
return -1;
}
@@ -2167,30 +2034,30 @@ herr_t H5LTget_attribute_info( hid_t loc_id,
*type_class = H5Tget_class(tid);
/* Get the size. */
- *type_size = H5Tget_size( tid );
+ *type_size = H5Tget_size(tid);
/* Get the dataspace handle */
- if ( (sid = H5Aget_space( attr_id )) < 0 )
+ if ((sid = H5Aget_space(attr_id)) < 0)
goto out;
/* Get dimensions */
- if ( H5Sget_simple_extent_dims( sid, dims, NULL) < 0 )
+ if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
goto out;
/* Terminate access to the dataspace */
- if ( H5Sclose( sid ) < 0 )
+ if (H5Sclose(sid) < 0)
goto out;
/* Release the datatype. */
- if ( H5Tclose( tid ) )
+ if (H5Tclose(tid))
goto out;
/* End access to the attribute */
- if ( H5Aclose( attr_id ) )
+ if (H5Aclose(attr_id))
goto out;
/* Close the object */
- if(H5Oclose(obj_id) < 0 )
+ if (H5Oclose(obj_id) < 0)
return -1;
return 0;
@@ -2200,46 +2067,46 @@ out:
H5Aclose(attr_id);
H5Oclose(obj_id);
return -1;
-
}
/*-------------------------------------------------------------------------
-* Function: H5LTtext_to_dtype
-*
-* Purpose: Convert DDL description to HDF5 data type.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Raymond Lu
-*
-* Date: October 6, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type)
+ * Function: H5LTtext_to_dtype
+ *
+ * Purpose: Convert DDL description to HDF5 data type.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Raymond Lu
+ *
+ * Date: October 6, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type)
{
- hid_t type_id;
+ hid_t type_id;
/* check the arguments */
if (text == NULL)
- return -1;
+ return -1;
- if(lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG)
+ if (lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG)
goto out;
- if(lang_type != H5LT_DDL) {
+ if (lang_type != H5LT_DDL) {
HDfprintf(stderr, "only DDL is supported for now.\n");
goto out;
}
input_len = HDstrlen(text);
- myinput = HDstrdup(text);
+ myinput = HDstrdup(text);
- if((type_id = H5LTyyparse()) < 0) {
+ if ((type_id = H5LTyyparse()) < 0) {
HDfree(myinput);
goto out;
}
@@ -2254,57 +2121,60 @@ out:
}
/*-------------------------------------------------------------------------
-* Function: realloc_and_append
-*
-* Purpose: Expand the buffer and append a string to it.
-*
-* Return: void
-*
-* Programmer: Raymond Lu
-*
-* Date: 29 September 2011
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-static char*
+ * Function: realloc_and_append
+ *
+ * Purpose: Expand the buffer and append a string to it.
+ *
+ * Return: void
+ *
+ * Programmer: Raymond Lu
+ *
+ * Date: 29 September 2011
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static char *
realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, const char *str_to_add)
{
size_t size_str_to_add, size_str;
- if(_no_user_buf) {
+ if (_no_user_buf) {
/* If the buffer isn't big enough, reallocate it. Otherwise, go to do strcat. */
- if(str_to_add && ((ssize_t)(*len - (HDstrlen(buf) + HDstrlen(str_to_add) + 1)) < LIMIT)) {
+ if (str_to_add && ((ssize_t)(*len - (HDstrlen(buf) + HDstrlen(str_to_add) + 1)) < LIMIT)) {
*len += ((HDstrlen(buf) + HDstrlen(str_to_add) + 1) / INCREMENT + 1) * INCREMENT;
- buf = (char*)HDrealloc(buf, *len);
- } else if(!str_to_add && ((ssize_t)(*len - HDstrlen(buf) - 1) < LIMIT)) {
+ buf = (char *)HDrealloc(buf, *len);
+ }
+ else if (!str_to_add && ((ssize_t)(*len - HDstrlen(buf) - 1) < LIMIT)) {
*len += INCREMENT;
- buf = (char*)HDrealloc(buf, *len);
+ buf = (char *)HDrealloc(buf, *len);
}
}
- if(!buf)
- goto out;
-
- if(str_to_add) {
- /* find the size of the buffer to add */
- size_str_to_add = HDstrlen(str_to_add);
- /* find the size of the current buffer */
- size_str = HDstrlen(buf);
-
- /* Check to make sure the appended string does not
- * extend past the allocated buffer; if it does then truncate the string
- */
- if(size_str < *len - 1) {
- if( size_str + size_str_to_add < *len - 1) {
- HDstrncat(buf, str_to_add, size_str_to_add);
- } else {
- HDstrncat(buf, str_to_add, (*len - 1) - size_str);
- }
- } else {
- buf[*len-1] = '\0'; /* buffer is full, null terminate */
- }
+ if (!buf)
+ goto out;
+
+ if (str_to_add) {
+ /* find the size of the buffer to add */
+ size_str_to_add = HDstrlen(str_to_add);
+ /* find the size of the current buffer */
+ size_str = HDstrlen(buf);
+
+ /* Check to make sure the appended string does not
+ * extend past the allocated buffer; if it does then truncate the string
+ */
+ if (size_str < *len - 1) {
+ if (size_str + size_str_to_add < *len - 1) {
+ HDstrncat(buf, str_to_add, size_str_to_add);
+ }
+ else {
+ HDstrncat(buf, str_to_add, (*len - 1) - size_str);
+ }
+ }
+ else {
+ buf[*len - 1] = '\0'; /* buffer is full, null terminate */
+ }
}
return buf;
@@ -2314,32 +2184,33 @@ out:
}
/*-------------------------------------------------------------------------
-* Function: indentation
-*
-* Purpose: Print spaces for indentation
-*
-* Return: void
-*
-* Programmer: Raymond Lu
-*
-* Date: December 6, 2005
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-static char*
-indentation(size_t x, char* str, hbool_t no_u_buf, size_t *s_len)
+ * Function: indentation
+ *
+ * Purpose: Print spaces for indentation
+ *
+ * Return: void
+ *
+ * Programmer: Raymond Lu
+ *
+ * Date: December 6, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static char *
+indentation(size_t x, char *str, hbool_t no_u_buf, size_t *s_len)
{
- char tmp_str[TMP_LEN];
+ char tmp_str[TMP_LEN];
if (x < 80) {
HDmemset(tmp_str, ' ', x);
- tmp_str[x]='\0';
- } else
+ tmp_str[x] = '\0';
+ }
+ else
HDsnprintf(tmp_str, TMP_LEN, "error: the indentation exceeds the number of cols.");
- if(!(str = realloc_and_append(no_u_buf, s_len, str, tmp_str)))
+ if (!(str = realloc_and_append(no_u_buf, s_len, str, tmp_str)))
goto out;
return str;
@@ -2349,98 +2220,99 @@ out:
}
/*-------------------------------------------------------------------------
-* Function: print_enum
-*
-* Purpose: prints the enum data
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Raymond Lu
-*
-* Modifications:
-*
-*-----------------------------------------------------------------------*/
-static char*
-print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt)
+ * Function: print_enum
+ *
+ * Purpose: prints the enum data
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Raymond Lu
+ *
+ * Modifications:
+ *
+ *-----------------------------------------------------------------------*/
+static char *
+print_enum(hid_t type, char *str, size_t *str_len, hbool_t no_ubuf, size_t indt)
{
- char **name = NULL; /*member names */
- unsigned char *value = NULL; /*value array */
- int nmembs; /*number of members */
- char tmp_str[TMP_LEN];
- int nchars; /*number of output characters */
- hid_t super = -1; /*enum base integer type */
- hid_t native = -1; /*native integer data type */
- size_t super_size; /*enum base type size */
- size_t dst_size; /*destination value type size */
- int i;
+ char ** name = NULL; /*member names */
+ unsigned char *value = NULL; /*value array */
+ int nmembs; /*number of members */
+ char tmp_str[TMP_LEN];
+ int nchars; /*number of output characters */
+ hid_t super = -1; /*enum base integer type */
+ hid_t native = -1; /*native integer data type */
+ size_t super_size; /*enum base type size */
+ size_t dst_size; /*destination value type size */
+ int i;
- if((nmembs = H5Tget_nmembers(type))<=0)
+ if ((nmembs = H5Tget_nmembers(type)) <= 0)
goto out;
- if((super = H5Tget_super(type)) < 0)
+ if ((super = H5Tget_super(type)) < 0)
goto out;
/* Use buffer of INT or UNSIGNED INT to print enum values because
- * we don't expect these values to be so big that INT or UNSIGNED
- * INT can't hold.
- */
+ * we don't expect these values to be so big that INT or UNSIGNED
+ * INT can't hold.
+ */
if (H5T_SGN_NONE == H5Tget_sign(super)) {
native = H5T_NATIVE_UINT;
- } else {
+ }
+ else {
native = H5T_NATIVE_INT;
}
super_size = H5Tget_size(super);
- dst_size = H5Tget_size(native);
+ dst_size = H5Tget_size(native);
/* Get the names and raw values of all members */
- name = (char**)HDcalloc((size_t)nmembs, sizeof(char *));
- value = (unsigned char*)HDcalloc((size_t)nmembs, MAX(dst_size, super_size));
+ name = (char **)HDcalloc((size_t)nmembs, sizeof(char *));
+ value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(dst_size, super_size));
for (i = 0; i < nmembs; i++) {
- if((name[i] = H5Tget_member_name(type, (unsigned)i))==NULL)
+ if ((name[i] = H5Tget_member_name(type, (unsigned)i)) == NULL)
goto out;
- if(H5Tget_member_value(type, (unsigned)i, value + (size_t)i * super_size) < 0)
+ if (H5Tget_member_value(type, (unsigned)i, value + (size_t)i * super_size) < 0)
goto out;
}
/* Convert values to native data type */
if (native > 0) {
- if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0)
+ if (H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0)
goto out;
}
/*
- * Sort members by increasing value
- * ***not implemented yet***
- */
+ * Sort members by increasing value
+ * ***not implemented yet***
+ */
/* Print members */
for (i = 0; i < nmembs; i++) {
- if(!(str = indentation(indt + COL, str, no_ubuf, str_len)))
+ if (!(str = indentation(indt + COL, str, no_ubuf, str_len)))
goto out;
nchars = HDsnprintf(tmp_str, TMP_LEN, "\"%s\"", name[i]);
- if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str)))
+ if (!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str)))
goto out;
HDmemset(tmp_str, ' ', (size_t)MAX(3, 19 - nchars) + 1);
tmp_str[MAX(3, 19 - nchars)] = '\0';
- if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str)))
+ if (!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str)))
goto out;
if (H5T_SGN_NONE == H5Tget_sign(native))
HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int *)((void *)(value + (size_t)i * dst_size))));
else
HDsnprintf(tmp_str, TMP_LEN, "%d", *((int *)((void *)(value + (size_t)i * dst_size))));
- if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str)))
+ if (!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str)))
goto out;
HDsnprintf(tmp_str, TMP_LEN, ";\n");
- if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str)))
+ if (!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str)))
goto out;
}
/* Release resources */
- for(i = 0; i < nmembs; i++)
+ for (i = 0; i < nmembs; i++)
H5free_memory(name[i]);
HDfree(name);
@@ -2451,71 +2323,73 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt)
out:
- if(0 == nmembs) {
+ if (0 == nmembs) {
str = realloc_and_append(no_ubuf, str_len, str, "\n");
HDassert((indt + 4) < TMP_LEN);
HDmemset(tmp_str, ' ', (indt + 4) + 1);
tmp_str[(indt + 4)] = '\0';
- str = realloc_and_append(no_ubuf, str_len, str, tmp_str);
- str = realloc_and_append(no_ubuf, str_len, str, " <empty>");
+ str = realloc_and_append(no_ubuf, str_len, str, tmp_str);
+ str = realloc_and_append(no_ubuf, str_len, str, " <empty>");
} /* end if */
/* Release resources */
- if(name) {
- for(i = 0; i < nmembs; i++)
- if(name[i])
+ if (name) {
+ for (i = 0; i < nmembs; i++)
+ if (name[i])
HDfree(name[i]);
HDfree(name);
} /* end if */
- if(value)
+ if (value)
HDfree(value);
- if(super >= 0)
+ if (super >= 0)
H5Tclose(super);
return NULL;
}
/*-------------------------------------------------------------------------
-* Function: H5LTdtype_to_text
-*
-* Purpose: Convert HDF5 data type to DDL description.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Raymond Lu
-*
-* Date: December 6, 2005
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *len)
+ * Function: H5LTdtype_to_text
+ *
+ * Purpose: Convert HDF5 data type to DDL description.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Raymond Lu
+ *
+ * Date: December 6, 2005
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *len)
{
- size_t str_len = INCREMENT;
- char *text_str;
- herr_t ret = SUCCEED;
+ size_t str_len = INCREMENT;
+ char * text_str;
+ herr_t ret = SUCCEED;
- if(lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG)
+ if (lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG)
goto out;
- if(len && !str) {
- text_str = (char*)HDcalloc(str_len, sizeof(char));
- text_str[0]='\0';
- if(!(text_str = H5LT_dtype_to_text(dtype, text_str, lang_type, &str_len, 1)))
+ if (len && !str) {
+ text_str = (char *)HDcalloc(str_len, sizeof(char));
+ text_str[0] = '\0';
+ if (!(text_str = H5LT_dtype_to_text(dtype, text_str, lang_type, &str_len, 1)))
goto out;
*len = HDstrlen(text_str) + 1;
- if(text_str)
+ if (text_str)
HDfree(text_str);
text_str = NULL;
- } else if(len && str) {
- if(!(H5LT_dtype_to_text(dtype, str, lang_type, len, 0)))
+ }
+ else if (len && str) {
+ if (!(H5LT_dtype_to_text(dtype, str, lang_type, len, 0)))
goto out;
- str[*len-1] = '\0';
+ str[*len - 1] = '\0';
}
return ret;
@@ -2525,38 +2399,38 @@ out:
}
/*-------------------------------------------------------------------------
-* Function: H5LT_dtype_to_text
-*
-* Purpose: Private function to convert HDF5 data type to DDL description.
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Raymond Lu
-*
-* Date: December 20, 2005
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen,
- hbool_t no_user_buf)
+ * Function: H5LT_dtype_to_text
+ *
+ * Purpose: Private function to convert HDF5 data type to DDL description.
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Raymond Lu
+ *
+ * Date: December 20, 2005
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+char *
+H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, hbool_t no_user_buf)
{
H5T_class_t tcls;
char tmp_str[TMP_LEN];
int i;
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, NULL)))
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, NULL)))
goto out;
- if(lang != H5LT_DDL) {
+ if (lang != H5LT_DDL) {
HDsnprintf(dt_str, *slen, "only DDL is supported for now");
goto out;
}
- if((tcls = H5Tget_class(dtype)) < 0)
+ if ((tcls = H5Tget_class(dtype)) < 0)
goto out;
switch (tcls) {
@@ -2564,57 +2438,83 @@ char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *sl
case H5T_BITFIELD:
if (H5Tequal(dtype, H5T_STD_I8BE)) {
HDsnprintf(dt_str, *slen, "H5T_STD_I8BE");
- } else if (H5Tequal(dtype, H5T_STD_I8LE)) {
+ }
+ else if (H5Tequal(dtype, H5T_STD_I8LE)) {
HDsnprintf(dt_str, *slen, "H5T_STD_I8LE");
- } else if (H5Tequal(dtype, H5T_STD_I16BE)) {
+ }
+ else if (H5Tequal(dtype, H5T_STD_I16BE)) {
HDsnprintf(dt_str, *slen, "H5T_STD_I16BE");
- } else if (H5Tequal(dtype, H5T_STD_I16LE)) {
+ }
+ else if (H5Tequal(dtype, H5T_STD_I16LE)) {
HDsnprintf(dt_str, *slen, "H5T_STD_I16LE");
- } else if (H5Tequal(dtype, H5T_STD_I32BE)) {
+ }
+ else if (H5Tequal(dtype, H5T_STD_I32BE)) {
HDsnprintf(dt_str, *slen, "H5T_STD_I32BE");
- } else if (H5Tequal(dtype, H5T_STD_I32LE)) {
+ }
+ else if (H5Tequal(dtype, H5T_STD_I32LE)) {
HDsnprintf(dt_str, *slen, "H5T_STD_I32LE");
- } else if (H5Tequal(dtype, H5T_STD_I64BE)) {
+ }
+ else if (H5Tequal(dtype, H5T_STD_I64BE)) {
HDsnprintf(dt_str, *slen, "H5T_STD_I64BE");
- } else if (H5Tequal(dtype, H5T_STD_I64LE)) {
+ }
+ else if (H5Tequal(dtype, H5T_STD_I64LE)) {
HDsnprintf(dt_str, *slen, "H5T_STD_I64LE");
- } else if (H5Tequal(dtype, H5T_STD_U8BE)) {
+ }
+ else if (H5Tequal(dtype, H5T_STD_U8BE)) {
HDsnprintf(dt_str, *slen, "H5T_STD_U8BE");
- } else if (H5Tequal(dtype, H5T_STD_U8LE)) {
+ }
+ else if (H5Tequal(dtype, H5T_STD_U8LE)) {
HDsnprintf(dt_str, *slen, "H5T_STD_U8LE");
- } else if (H5Tequal(dtype, H5T_STD_U16BE)) {
+ }
+ else if (H5Tequal(dtype, H5T_STD_U16BE)) {
HDsnprintf(dt_str, *slen, "H5T_STD_U16BE");
- } else if (H5Tequal(dtype, H5T_STD_U16LE)) {
+ }
+ else if (H5Tequal(dtype, H5T_STD_U16LE)) {
HDsnprintf(dt_str, *slen, "H5T_STD_U16LE");
- } else if (H5Tequal(dtype, H5T_STD_U32BE)) {
+ }
+ else if (H5Tequal(dtype, H5T_STD_U32BE)) {
HDsnprintf(dt_str, *slen, "H5T_STD_U32BE");
- } else if (H5Tequal(dtype, H5T_STD_U32LE)) {
+ }
+ else if (H5Tequal(dtype, H5T_STD_U32LE)) {
HDsnprintf(dt_str, *slen, "H5T_STD_U32LE");
- } else if (H5Tequal(dtype, H5T_STD_U64BE)) {
+ }
+ else if (H5Tequal(dtype, H5T_STD_U64BE)) {
HDsnprintf(dt_str, *slen, "H5T_STD_U64BE");
- } else if (H5Tequal(dtype, H5T_STD_U64LE)) {
+ }
+ else if (H5Tequal(dtype, H5T_STD_U64LE)) {
HDsnprintf(dt_str, *slen, "H5T_STD_U64LE");
- } else if (H5Tequal(dtype, H5T_NATIVE_SCHAR)) {
+ }
+ else if (H5Tequal(dtype, H5T_NATIVE_SCHAR)) {
HDsnprintf(dt_str, *slen, "H5T_NATIVE_SCHAR");
- } else if (H5Tequal(dtype, H5T_NATIVE_UCHAR)) {
+ }
+ else if (H5Tequal(dtype, H5T_NATIVE_UCHAR)) {
HDsnprintf(dt_str, *slen, "H5T_NATIVE_UCHAR");
- } else if (H5Tequal(dtype, H5T_NATIVE_SHORT)) {
+ }
+ else if (H5Tequal(dtype, H5T_NATIVE_SHORT)) {
HDsnprintf(dt_str, *slen, "H5T_NATIVE_SHORT");
- } else if (H5Tequal(dtype, H5T_NATIVE_USHORT)) {
+ }
+ else if (H5Tequal(dtype, H5T_NATIVE_USHORT)) {
HDsnprintf(dt_str, *slen, "H5T_NATIVE_USHORT");
- } else if (H5Tequal(dtype, H5T_NATIVE_INT)) {
+ }
+ else if (H5Tequal(dtype, H5T_NATIVE_INT)) {
HDsnprintf(dt_str, *slen, "H5T_NATIVE_INT");
- } else if (H5Tequal(dtype, H5T_NATIVE_UINT)) {
+ }
+ else if (H5Tequal(dtype, H5T_NATIVE_UINT)) {
HDsnprintf(dt_str, *slen, "H5T_NATIVE_UINT");
- } else if (H5Tequal(dtype, H5T_NATIVE_LONG)) {
+ }
+ else if (H5Tequal(dtype, H5T_NATIVE_LONG)) {
HDsnprintf(dt_str, *slen, "H5T_NATIVE_LONG");
- } else if (H5Tequal(dtype, H5T_NATIVE_ULONG)) {
+ }
+ else if (H5Tequal(dtype, H5T_NATIVE_ULONG)) {
HDsnprintf(dt_str, *slen, "H5T_NATIVE_ULONG");
- } else if (H5Tequal(dtype, H5T_NATIVE_LLONG)) {
+ }
+ else if (H5Tequal(dtype, H5T_NATIVE_LLONG)) {
HDsnprintf(dt_str, *slen, "H5T_NATIVE_LLONG");
- } else if (H5Tequal(dtype, H5T_NATIVE_ULLONG)) {
+ }
+ else if (H5Tequal(dtype, H5T_NATIVE_ULLONG)) {
HDsnprintf(dt_str, *slen, "H5T_NATIVE_ULLONG");
- } else {
+ }
+ else {
HDsnprintf(dt_str, *slen, "undefined integer");
}
@@ -2622,439 +2522,445 @@ char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *sl
case H5T_FLOAT:
if (H5Tequal(dtype, H5T_IEEE_F32BE)) {
HDsnprintf(dt_str, *slen, "H5T_IEEE_F32BE");
- } else if (H5Tequal(dtype, H5T_IEEE_F32LE)) {
+ }
+ else if (H5Tequal(dtype, H5T_IEEE_F32LE)) {
HDsnprintf(dt_str, *slen, "H5T_IEEE_F32LE");
- } else if (H5Tequal(dtype, H5T_IEEE_F64BE)) {
+ }
+ else if (H5Tequal(dtype, H5T_IEEE_F64BE)) {
HDsnprintf(dt_str, *slen, "H5T_IEEE_F64BE");
- } else if (H5Tequal(dtype, H5T_IEEE_F64LE)) {
+ }
+ else if (H5Tequal(dtype, H5T_IEEE_F64LE)) {
HDsnprintf(dt_str, *slen, "H5T_IEEE_F64LE");
- } else if (H5Tequal(dtype, H5T_NATIVE_FLOAT)) {
+ }
+ else if (H5Tequal(dtype, H5T_NATIVE_FLOAT)) {
HDsnprintf(dt_str, *slen, "H5T_NATIVE_FLOAT");
- } else if (H5Tequal(dtype, H5T_NATIVE_DOUBLE)) {
+ }
+ else if (H5Tequal(dtype, H5T_NATIVE_DOUBLE)) {
HDsnprintf(dt_str, *slen, "H5T_NATIVE_DOUBLE");
-#if H5_SIZEOF_LONG_DOUBLE !=0
- } else if (H5Tequal(dtype, H5T_NATIVE_LDOUBLE)) {
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ }
+ else if (H5Tequal(dtype, H5T_NATIVE_LDOUBLE)) {
HDsnprintf(dt_str, *slen, "H5T_NATIVE_LDOUBLE");
#endif
- } else {
+ }
+ else {
HDsnprintf(dt_str, *slen, "undefined float");
}
break;
- case H5T_STRING:
- {
- /* Make a copy of type in memory in case when DTYPE is on disk, the size
- * will be bigger than in memory. This makes it easier to compare
- * types in memory. */
- hid_t str_type;
- H5T_order_t order;
- hid_t tmp_type;
- size_t size;
- H5T_str_t str_pad;
- H5T_cset_t cset;
- htri_t is_vlstr;
-
- if((tmp_type = H5Tcopy(dtype)) < 0)
- goto out;
- if((size = H5Tget_size(tmp_type))==0)
- goto out;
- if((str_pad = H5Tget_strpad(tmp_type)) < 0)
- goto out;
- if((cset = H5Tget_cset(tmp_type)) < 0)
- goto out;
- if((is_vlstr = H5Tis_variable_str(tmp_type)) < 0)
- goto out;
+ case H5T_STRING: {
+ /* Make a copy of type in memory in case when DTYPE is on disk, the size
+ * will be bigger than in memory. This makes it easier to compare
+ * types in memory. */
+ hid_t str_type;
+ H5T_order_t order;
+ hid_t tmp_type;
+ size_t size;
+ H5T_str_t str_pad;
+ H5T_cset_t cset;
+ htri_t is_vlstr;
+
+ if ((tmp_type = H5Tcopy(dtype)) < 0)
+ goto out;
+ if ((size = H5Tget_size(tmp_type)) == 0)
+ goto out;
+ if ((str_pad = H5Tget_strpad(tmp_type)) < 0)
+ goto out;
+ if ((cset = H5Tget_cset(tmp_type)) < 0)
+ goto out;
+ if ((is_vlstr = H5Tis_variable_str(tmp_type)) < 0)
+ goto out;
- /* Print lead-in */
- HDsnprintf(dt_str, *slen, "H5T_STRING {\n");
- indent += COL;
+ /* Print lead-in */
+ HDsnprintf(dt_str, *slen, "H5T_STRING {\n");
+ indent += COL;
- if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
- goto out;
+ if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ goto out;
- if(is_vlstr)
- HDsnprintf(tmp_str, TMP_LEN, "STRSIZE H5T_VARIABLE;\n");
- else
- HDsnprintf(tmp_str, TMP_LEN, "STRSIZE %d;\n", (int)size);
+ if (is_vlstr)
+ HDsnprintf(tmp_str, TMP_LEN, "STRSIZE H5T_VARIABLE;\n");
+ else
+ HDsnprintf(tmp_str, TMP_LEN, "STRSIZE %d;\n", (int)size);
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ goto out;
- if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
- goto out;
+ if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ goto out;
- if (str_pad == H5T_STR_NULLTERM)
- HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_NULLTERM;\n");
- else if (str_pad == H5T_STR_NULLPAD)
- HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_NULLPAD;\n");
- else if (str_pad == H5T_STR_SPACEPAD)
- HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_SPACEPAD;\n");
- else
- HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_ERROR;\n");
+ if (str_pad == H5T_STR_NULLTERM)
+ HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_NULLTERM;\n");
+ else if (str_pad == H5T_STR_NULLPAD)
+ HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_NULLPAD;\n");
+ else if (str_pad == H5T_STR_SPACEPAD)
+ HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_SPACEPAD;\n");
+ else
+ HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_ERROR;\n");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ goto out;
- if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
- goto out;
+ if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ goto out;
- if (cset == H5T_CSET_ASCII)
- HDsnprintf(tmp_str, TMP_LEN, "CSET H5T_CSET_ASCII;\n");
- else if (cset == H5T_CSET_UTF8)
- HDsnprintf(tmp_str, TMP_LEN, "CSET H5T_CSET_UTF8;\n");
- else
- HDsnprintf(tmp_str, TMP_LEN, "CSET unknown;\n");
+ if (cset == H5T_CSET_ASCII)
+ HDsnprintf(tmp_str, TMP_LEN, "CSET H5T_CSET_ASCII;\n");
+ else if (cset == H5T_CSET_UTF8)
+ HDsnprintf(tmp_str, TMP_LEN, "CSET H5T_CSET_UTF8;\n");
+ else
+ HDsnprintf(tmp_str, TMP_LEN, "CSET unknown;\n");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ goto out;
- /* Reproduce a C type string */
- if((str_type = H5Tcopy(H5T_C_S1)) < 0)
- goto out;
- if(is_vlstr) {
- if(H5Tset_size(str_type, H5T_VARIABLE) < 0)
- goto out;
- } else {
- if(H5Tset_size(str_type, size) < 0)
- goto out;
- }
- if(H5Tset_cset(str_type, cset) < 0)
+ /* Reproduce a C type string */
+ if ((str_type = H5Tcopy(H5T_C_S1)) < 0)
+ goto out;
+ if (is_vlstr) {
+ if (H5Tset_size(str_type, H5T_VARIABLE) < 0)
goto out;
- if(H5Tset_strpad(str_type, str_pad) < 0)
+ }
+ else {
+ if (H5Tset_size(str_type, size) < 0)
goto out;
+ }
+ if (H5Tset_cset(str_type, cset) < 0)
+ goto out;
+ if (H5Tset_strpad(str_type, str_pad) < 0)
+ goto out;
- if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
- goto out;
+ if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ goto out;
- /* Check C variable-length string first. Are the two types equal? */
- if (H5Tequal(tmp_type, str_type)) {
- HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_C_S1;\n");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
- goto next;
- }
+ /* Check C variable-length string first. Are the two types equal? */
+ if (H5Tequal(tmp_type, str_type)) {
+ HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_C_S1;\n");
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ goto out;
+ goto next;
+ }
- /* Change the endianness and see if they're equal. */
- if((order = H5Tget_order(tmp_type)) < 0)
+ /* Change the endianness and see if they're equal. */
+ if ((order = H5Tget_order(tmp_type)) < 0)
+ goto out;
+ if (order == H5T_ORDER_LE) {
+ if (H5Tset_order(str_type, H5T_ORDER_LE) < 0)
goto out;
- if(order==H5T_ORDER_LE) {
- if(H5Tset_order(str_type, H5T_ORDER_LE) < 0)
- goto out;
- } else if(order==H5T_ORDER_BE) {
- if(H5Tset_order(str_type, H5T_ORDER_BE) < 0)
- goto out;
- }
-
- if (H5Tequal(tmp_type, str_type)) {
- HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_C_S1;\n");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
- goto next;
- }
-
- /* If not equal to C variable-length string, check Fortran type.
- * Actually H5Tequal can't tell difference between H5T_C_S1 and H5T_FORTRAN_S1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
- if(H5Tclose(str_type) < 0)
+ }
+ else if (order == H5T_ORDER_BE) {
+ if (H5Tset_order(str_type, H5T_ORDER_BE) < 0)
goto out;
- if((str_type = H5Tcopy(H5T_FORTRAN_S1)) < 0)
+ }
+
+ if (H5Tequal(tmp_type, str_type)) {
+ HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_C_S1;\n");
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
- if(H5Tset_cset(str_type, cset) < 0)
+ goto next;
+ }
+
+ /* If not equal to C variable-length string, check Fortran type.
+ * Actually H5Tequal can't tell difference between H5T_C_S1 and
+ * H5T_FORTRAN_S1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+ if (H5Tclose(str_type) < 0)
+ goto out;
+ if ((str_type = H5Tcopy(H5T_FORTRAN_S1)) < 0)
+ goto out;
+ if (H5Tset_cset(str_type, cset) < 0)
+ goto out;
+ if (H5Tset_size(str_type, size) < 0)
+ goto out;
+ if (H5Tset_strpad(str_type, str_pad) < 0)
+ goto out;
+
+ /* Are the two types equal? */
+ if (H5Tequal(tmp_type, str_type)) {
+ HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_FORTRAN_S1;\n");
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
- if(H5Tset_size(str_type, size) < 0)
+ goto next;
+ }
+
+ /* Change the endianness and see if they're equal. */
+ if ((order = H5Tget_order(tmp_type)) < 0)
+ goto out;
+ if (order == H5T_ORDER_LE) {
+ if (H5Tset_order(str_type, H5T_ORDER_LE) < 0)
goto out;
- if(H5Tset_strpad(str_type, str_pad) < 0)
+ }
+ else if (order == H5T_ORDER_BE) {
+ if (H5Tset_order(str_type, H5T_ORDER_BE) < 0)
goto out;
+ }
- /* Are the two types equal? */
- if (H5Tequal(tmp_type, str_type)) {
- HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_FORTRAN_S1;\n");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
- goto next;
- }
-
- /* Change the endianness and see if they're equal. */
- if((order = H5Tget_order(tmp_type)) < 0)
- goto out;
- if(order==H5T_ORDER_LE) {
- if(H5Tset_order(str_type, H5T_ORDER_LE) < 0)
- goto out;
- } else if(order==H5T_ORDER_BE) {
- if(H5Tset_order(str_type, H5T_ORDER_BE) < 0)
- goto out;
- }
-
- /* Are the two types equal? */
- if (H5Tequal(tmp_type, str_type)) {
- HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_FORTRAN_S1;\n");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
- goto next;
- }
-
- /* Type doesn't match any of above. */
- HDsnprintf(tmp_str, TMP_LEN, "CTYPE unknown_one_character_type;\n");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ /* Are the two types equal? */
+ if (H5Tequal(tmp_type, str_type)) {
+ HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_FORTRAN_S1;\n");
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
+ goto next;
+ }
+
+ /* Type doesn't match any of above. */
+ HDsnprintf(tmp_str, TMP_LEN, "CTYPE unknown_one_character_type;\n");
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ goto out;
next:
- H5Tclose(str_type);
- H5Tclose(tmp_type);
+ H5Tclose(str_type);
+ H5Tclose(tmp_type);
- /* Print closing */
- indent -= COL;
- if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
- goto out;
- HDsnprintf(tmp_str, TMP_LEN, "}");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
+ /* Print closing */
+ indent -= COL;
+ if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ goto out;
+ HDsnprintf(tmp_str, TMP_LEN, "}");
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ goto out;
- break;
- }
- case H5T_OPAQUE:
- {
+ break;
+ }
+ case H5T_OPAQUE: {
char *tag = NULL;
/* Print lead-in */
HDsnprintf(dt_str, *slen, "H5T_OPAQUE {\n");
indent += COL;
- if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
goto out;
HDsnprintf(tmp_str, TMP_LEN, "OPQ_SIZE %lu;\n", (unsigned long)H5Tget_size(dtype));
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
- if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
goto out;
tag = H5Tget_tag(dtype);
- if(tag) {
+ if (tag) {
HDsnprintf(tmp_str, TMP_LEN, "OPQ_TAG \"%s\";\n", tag);
- if(tag)
+ if (tag)
H5free_memory(tag);
tag = NULL;
- } else
+ }
+ else
HDsnprintf(tmp_str, TMP_LEN, "OPQ_TAG \"\";\n");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
/* Print closing */
indent -= COL;
- if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
goto out;
HDsnprintf(tmp_str, TMP_LEN, "}");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
break;
- }
- case H5T_ENUM:
- {
- hid_t super;
- size_t super_len;
- char* stmp = NULL;
-
- /* Print lead-in */
- HDsnprintf(dt_str, *slen, "H5T_ENUM {\n");
- indent += COL;
- if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
- goto out;
+ }
+ case H5T_ENUM: {
+ hid_t super;
+ size_t super_len;
+ char * stmp = NULL;
- if((super = H5Tget_super(dtype)) < 0)
- goto out;
- if(H5LTdtype_to_text(super, NULL, lang, &super_len) < 0)
- goto out;
- stmp = (char*)HDcalloc(super_len, sizeof(char));
- if(H5LTdtype_to_text(super, stmp, lang, &super_len) < 0)
- goto out;
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp)))
- goto out;
+ /* Print lead-in */
+ HDsnprintf(dt_str, *slen, "H5T_ENUM {\n");
+ indent += COL;
+ if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ goto out;
- if(stmp)
- HDfree(stmp);
- stmp = NULL;
+ if ((super = H5Tget_super(dtype)) < 0)
+ goto out;
+ if (H5LTdtype_to_text(super, NULL, lang, &super_len) < 0)
+ goto out;
+ stmp = (char *)HDcalloc(super_len, sizeof(char));
+ if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0)
+ goto out;
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp)))
+ goto out;
- HDsnprintf(tmp_str, TMP_LEN, ";\n");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
- H5Tclose(super);
+ if (stmp)
+ HDfree(stmp);
+ stmp = NULL;
- if(!(dt_str = print_enum(dtype, dt_str, slen, no_user_buf, indent)))
- goto out;
+ HDsnprintf(tmp_str, TMP_LEN, ";\n");
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ goto out;
+ H5Tclose(super);
- /* Print closing */
- indent -= COL;
- if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
- goto out;
- HDsnprintf(tmp_str, TMP_LEN, "}");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
+ if (!(dt_str = print_enum(dtype, dt_str, slen, no_user_buf, indent)))
+ goto out;
- break;
- }
- case H5T_VLEN:
- {
- hid_t super;
- size_t super_len;
- char* stmp = NULL;
-
- /* Print lead-in */
- HDsnprintf(dt_str, *slen, "H5T_VLEN {\n");
- indent += COL;
- if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
- goto out;
+ /* Print closing */
+ indent -= COL;
+ if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ goto out;
+ HDsnprintf(tmp_str, TMP_LEN, "}");
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ goto out;
- if((super = H5Tget_super(dtype)) < 0)
- goto out;
- if(H5LTdtype_to_text(super, NULL, lang, &super_len) < 0)
- goto out;
- stmp = (char*)HDcalloc(super_len, sizeof(char));
- if(H5LTdtype_to_text(super, stmp, lang, &super_len) < 0)
- goto out;
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp)))
- goto out;
+ break;
+ }
+ case H5T_VLEN: {
+ hid_t super;
+ size_t super_len;
+ char * stmp = NULL;
- if(stmp)
- HDfree(stmp);
- stmp = NULL;
- HDsnprintf(tmp_str, TMP_LEN, "\n");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
- H5Tclose(super);
+ /* Print lead-in */
+ HDsnprintf(dt_str, *slen, "H5T_VLEN {\n");
+ indent += COL;
+ if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ goto out;
- /* Print closing */
- indent -= COL;
- if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
- goto out;
- HDsnprintf(tmp_str, TMP_LEN, "}");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
+ if ((super = H5Tget_super(dtype)) < 0)
+ goto out;
+ if (H5LTdtype_to_text(super, NULL, lang, &super_len) < 0)
+ goto out;
+ stmp = (char *)HDcalloc(super_len, sizeof(char));
+ if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0)
+ goto out;
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp)))
+ goto out;
- break;
- }
- case H5T_ARRAY:
- {
- hid_t super;
- size_t super_len;
- char* stmp = NULL;
- hsize_t dims[H5S_MAX_RANK];
- int ndims;
-
- /* Print lead-in */
- HDsnprintf(dt_str, *slen, "H5T_ARRAY {\n");
- indent += COL;
- if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ if (stmp)
+ HDfree(stmp);
+ stmp = NULL;
+ HDsnprintf(tmp_str, TMP_LEN, "\n");
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ goto out;
+ H5Tclose(super);
+
+ /* Print closing */
+ indent -= COL;
+ if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ goto out;
+ HDsnprintf(tmp_str, TMP_LEN, "}");
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ goto out;
+
+ break;
+ }
+ case H5T_ARRAY: {
+ hid_t super;
+ size_t super_len;
+ char * stmp = NULL;
+ hsize_t dims[H5S_MAX_RANK];
+ int ndims;
+
+ /* Print lead-in */
+ HDsnprintf(dt_str, *slen, "H5T_ARRAY {\n");
+ indent += COL;
+ if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ goto out;
+
+ /* Get array information */
+ if ((ndims = H5Tget_array_ndims(dtype)) < 0)
+ goto out;
+ if (H5Tget_array_dims2(dtype, dims) < 0)
+ goto out;
+
+ /* Print array dimensions */
+ for (i = 0; i < ndims; i++) {
+ HDsnprintf(tmp_str, TMP_LEN, "[%d]", (int)dims[i]);
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
+ }
+ HDsnprintf(tmp_str, TMP_LEN, " ");
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ goto out;
+
+ if ((super = H5Tget_super(dtype)) < 0)
+ goto out;
+ if (H5LTdtype_to_text(super, NULL, lang, &super_len) < 0)
+ goto out;
+ stmp = (char *)HDcalloc(super_len, sizeof(char));
+ if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0)
+ goto out;
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp)))
+ goto out;
+ if (stmp)
+ HDfree(stmp);
+ stmp = NULL;
+ HDsnprintf(tmp_str, TMP_LEN, "\n");
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ goto out;
+ H5Tclose(super);
+
+ /* Print closing */
+ indent -= COL;
+ if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ goto out;
+ HDsnprintf(tmp_str, TMP_LEN, "}");
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ goto out;
+
+ break;
+ }
+ case H5T_COMPOUND: {
+ char * mname = NULL;
+ hid_t mtype;
+ size_t moffset;
+ H5T_class_t mclass;
+ size_t mlen;
+ char * mtmp = NULL;
+ int nmembs;
+
+ if ((nmembs = H5Tget_nmembers(dtype)) < 0)
+ goto out;
+
+ HDsnprintf(dt_str, *slen, "H5T_COMPOUND {\n");
+ indent += COL;
- /* Get array information */
- if((ndims = H5Tget_array_ndims(dtype)) < 0)
+ for (i = 0; i < nmembs; i++) {
+ if ((mname = H5Tget_member_name(dtype, (unsigned)i)) == NULL)
goto out;
- if(H5Tget_array_dims2(dtype, dims) < 0)
+ if ((mtype = H5Tget_member_type(dtype, (unsigned)i)) < 0)
+ goto out;
+ moffset = H5Tget_member_offset(dtype, (unsigned)i);
+ if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
goto out;
- /* Print array dimensions */
- for (i = 0; i < ndims; i++) {
- HDsnprintf(tmp_str, TMP_LEN, "[%d]", (int) dims[i]);
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
- }
- HDsnprintf(tmp_str, TMP_LEN, " ");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
-
- if((super = H5Tget_super(dtype)) < 0)
+ if ((mclass = H5Tget_class(mtype)) < 0)
goto out;
- if(H5LTdtype_to_text(super, NULL, lang, &super_len) < 0)
+ if (H5T_COMPOUND == mclass)
+ indent += COL;
+
+ if (H5LTdtype_to_text(mtype, NULL, lang, &mlen) < 0)
goto out;
- stmp = (char*)HDcalloc(super_len, sizeof(char));
- if(H5LTdtype_to_text(super, stmp, lang, &super_len) < 0)
+ mtmp = (char *)HDcalloc(mlen, sizeof(char));
+ if (H5LTdtype_to_text(mtype, mtmp, lang, &mlen) < 0)
goto out;
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp)))
- goto out;
- if(stmp)
- HDfree(stmp);
- stmp = NULL;
- HDsnprintf(tmp_str, TMP_LEN, "\n");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
- H5Tclose(super);
-
- /* Print closing */
- indent -= COL;
- if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, mtmp)))
goto out;
- HDsnprintf(tmp_str, TMP_LEN, "}");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
+ if (mtmp)
+ HDfree(mtmp);
+ mtmp = NULL;
- break;
- }
- case H5T_COMPOUND:
- {
- char *mname = NULL;
- hid_t mtype;
- size_t moffset;
- H5T_class_t mclass;
- size_t mlen;
- char* mtmp = NULL;
- int nmembs;
-
- if((nmembs = H5Tget_nmembers(dtype)) < 0)
- goto out;
+ if (H5T_COMPOUND == mclass)
+ indent -= COL;
- HDsnprintf(dt_str, *slen, "H5T_COMPOUND {\n");
- indent += COL;
-
- for (i = 0; i < nmembs; i++) {
- if((mname = H5Tget_member_name(dtype, (unsigned)i))==NULL)
- goto out;
- if((mtype = H5Tget_member_type(dtype, (unsigned)i)) < 0)
- goto out;
- moffset = H5Tget_member_offset(dtype, (unsigned)i);
- if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
- goto out;
-
- if((mclass = H5Tget_class(mtype)) < 0)
- goto out;
- if (H5T_COMPOUND == mclass)
- indent += COL;
-
- if(H5LTdtype_to_text(mtype, NULL, lang, &mlen) < 0)
- goto out;
- mtmp = (char*)HDcalloc(mlen, sizeof(char));
- if(H5LTdtype_to_text(mtype, mtmp, lang, &mlen) < 0)
- goto out;
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, mtmp)))
- goto out;
- if(mtmp)
- HDfree(mtmp);
- mtmp = NULL;
-
- if (H5T_COMPOUND == mclass)
- indent -= COL;
-
- HDsnprintf(tmp_str, TMP_LEN, " \"%s\"", mname);
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
- if(mname)
- H5free_memory(mname);
- mname = NULL;
-
- HDsnprintf(tmp_str, TMP_LEN, " : %lu;\n", (unsigned long)moffset);
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
- }
-
- /* Print closing */
- indent -= COL;
- if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ HDsnprintf(tmp_str, TMP_LEN, " \"%s\"", mname);
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
- HDsnprintf(tmp_str, TMP_LEN, "}");
- if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
- goto out;
+ if (mname)
+ H5free_memory(mname);
+ mname = NULL;
- break;
+ HDsnprintf(tmp_str, TMP_LEN, " : %lu;\n", (unsigned long)moffset);
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ goto out;
}
+
+ /* Print closing */
+ indent -= COL;
+ if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
+ goto out;
+ HDsnprintf(tmp_str, TMP_LEN, "}");
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
+ goto out;
+
+ break;
+ }
case H5T_TIME:
HDsnprintf(dt_str, *slen, "H5T_TIME: not yet implemented");
break;
@@ -3082,747 +2988,701 @@ out:
}
/*-------------------------------------------------------------------------
-*
-* Get attribute functions
-*
-*-------------------------------------------------------------------------
-*/
-
+ *
+ * Get attribute functions
+ *
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute_string
-*
-* Purpose: Reads an attribute named attr_name
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 19, 2002
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
+ * Function: H5LTget_attribute_string
+ *
+ * Purpose: Reads an attribute named attr_name
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 19, 2002
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTget_attribute_string( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- char *data )
+herr_t
+H5LTget_attribute_string(hid_t loc_id, const char *obj_name, const char *attr_name, char *data)
{
/* identifiers */
- hid_t obj_id;
+ hid_t obj_id;
/* check the arguments */
if (obj_name == NULL)
- return -1;
+ return -1;
if (attr_name == NULL)
- return -1;
+ return -1;
/* Open the object */
- if ((obj_id = H5Oopen( loc_id, obj_name, H5P_DEFAULT)) < 0)
+ if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0)
return -1;
/* Get the attribute */
- if ( H5LT_get_attribute_disk( obj_id, attr_name, data ) < 0 )
- {
- H5Oclose(obj_id);
- return -1;
+ if (H5LT_get_attribute_disk(obj_id, attr_name, data) < 0) {
+ H5Oclose(obj_id);
+ return -1;
}
/* Close the object */
- if(H5Oclose(obj_id) < 0)
+ if (H5Oclose(obj_id) < 0)
return -1;
return 0;
-
}
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute_char
-*
-* Purpose: Reads an attribute named attr_name
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 19, 2002
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5LTget_attribute_char( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- char *data )
+ * Function: H5LTget_attribute_char
+ *
+ * Purpose: Reads an attribute named attr_name
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 19, 2002
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5LTget_attribute_char(hid_t loc_id, const char *obj_name, const char *attr_name, char *data)
{
/* Get the attribute */
- if(H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_CHAR, data) < 0)
+ if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_CHAR, data) < 0)
return -1;
return 0;
}
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute_uchar
-*
-* Purpose: Reads an attribute named attr_name
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: March 8, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5LTget_attribute_uchar( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- unsigned char *data )
+ * Function: H5LTget_attribute_uchar
+ *
+ * Purpose: Reads an attribute named attr_name
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: March 8, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5LTget_attribute_uchar(hid_t loc_id, const char *obj_name, const char *attr_name, unsigned char *data)
{
/* Get the attribute */
- if(H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_UCHAR, data) < 0)
+ if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_UCHAR, data) < 0)
return -1;
return 0;
}
-
-
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute_short
-*
-* Purpose: Reads an attribute named attr_name
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 19, 2002
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5LTget_attribute_short( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- short *data )
+ * Function: H5LTget_attribute_short
+ *
+ * Purpose: Reads an attribute named attr_name
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 19, 2002
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5LTget_attribute_short(hid_t loc_id, const char *obj_name, const char *attr_name, short *data)
{
/* Get the attribute */
- if(H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_SHORT, data) < 0)
+ if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_SHORT, data) < 0)
return -1;
return 0;
}
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute_ushort
-*
-* Purpose: Reads an attribute named attr_name
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: March 8, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5LTget_attribute_ushort( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- unsigned short *data )
+ * Function: H5LTget_attribute_ushort
+ *
+ * Purpose: Reads an attribute named attr_name
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: March 8, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5LTget_attribute_ushort(hid_t loc_id, const char *obj_name, const char *attr_name, unsigned short *data)
{
/* Get the attribute */
- if(H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_USHORT, data) < 0)
+ if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_USHORT, data) < 0)
return -1;
return 0;
}
-
-
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute_int
-*
-* Purpose: Reads an attribute named attr_name
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 19, 2002
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5LTget_attribute_int( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- int *data )
+ * Function: H5LTget_attribute_int
+ *
+ * Purpose: Reads an attribute named attr_name
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 19, 2002
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5LTget_attribute_int(hid_t loc_id, const char *obj_name, const char *attr_name, int *data)
{
/* Get the attribute */
- if(H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_INT, data) < 0)
+ if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_INT, data) < 0)
return -1;
return 0;
}
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute_uint
-*
-* Purpose: Reads an attribute named attr_name
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: March 8, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5LTget_attribute_uint( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- unsigned int *data )
+ * Function: H5LTget_attribute_uint
+ *
+ * Purpose: Reads an attribute named attr_name
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: March 8, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5LTget_attribute_uint(hid_t loc_id, const char *obj_name, const char *attr_name, unsigned int *data)
{
/* Get the attribute */
- if(H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_UINT, data) < 0)
+ if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_UINT, data) < 0)
return -1;
return 0;
}
-
-
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute_long
-*
-* Purpose: Reads an attribute named attr_name
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 19, 2002
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5LTget_attribute_long( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- long *data )
+ * Function: H5LTget_attribute_long
+ *
+ * Purpose: Reads an attribute named attr_name
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 19, 2002
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5LTget_attribute_long(hid_t loc_id, const char *obj_name, const char *attr_name, long *data)
{
/* Get the attribute */
- if(H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_LONG, data) < 0)
+ if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_LONG, data) < 0)
return -1;
return 0;
}
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute_long_long
-*
-* Purpose: Reads an attribute named attr_name
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Elena Pourmal
-*
-* Date: June 17, 2005
-*
-* Comments: This function was added to support INTEGER*8 Fortran types
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5LTget_attribute_long_long( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- long long *data )
+ * Function: H5LTget_attribute_long_long
+ *
+ * Purpose: Reads an attribute named attr_name
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Elena Pourmal
+ *
+ * Date: June 17, 2005
+ *
+ * Comments: This function was added to support INTEGER*8 Fortran types
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5LTget_attribute_long_long(hid_t loc_id, const char *obj_name, const char *attr_name, long long *data)
{
/* Get the attribute */
- if(H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_LLONG, data) < 0)
+ if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_LLONG, data) < 0)
return -1;
return 0;
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute_ulong
-*
-* Purpose: Reads an attribute named attr_name
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: March 8, 2004
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5LTget_attribute_ulong( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- unsigned long *data )
+ * Function: H5LTget_attribute_ulong
+ *
+ * Purpose: Reads an attribute named attr_name
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: March 8, 2004
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5LTget_attribute_ulong(hid_t loc_id, const char *obj_name, const char *attr_name, unsigned long *data)
{
/* Get the attribute */
- if(H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_ULONG, data) < 0)
+ if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_ULONG, data) < 0)
return -1;
return 0;
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute_float
-*
-* Purpose: Reads an attribute named attr_name
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 19, 2002
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
+ * Function: H5LTget_attribute_float
+ *
+ * Purpose: Reads an attribute named attr_name
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 19, 2002
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTget_attribute_float( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- float *data )
+herr_t
+H5LTget_attribute_float(hid_t loc_id, const char *obj_name, const char *attr_name, float *data)
{
/* Get the attribute */
- if(H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_FLOAT, data) < 0)
+ if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_FLOAT, data) < 0)
return -1;
return 0;
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute_double
-*
-* Purpose: Reads an attribute named attr_name
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 19, 2002
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
+ * Function: H5LTget_attribute_double
+ *
+ * Purpose: Reads an attribute named attr_name
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 19, 2002
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTget_attribute_double( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- double *data )
+herr_t
+H5LTget_attribute_double(hid_t loc_id, const char *obj_name, const char *attr_name, double *data)
{
/* Get the attribute */
- if(H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_DOUBLE, data) < 0)
+ if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_DOUBLE, data) < 0)
return -1;
return 0;
}
-
/*-------------------------------------------------------------------------
-* Function: H5LTget_attribute
-*
-* Purpose: Reads an attribute named attr_name with the memory type mem_type_id
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 19, 2002
-*
-* Comments: Private function
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
+ * Function: H5LTget_attribute
+ *
+ * Purpose: Reads an attribute named attr_name with the memory type mem_type_id
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 19, 2002
+ *
+ * Comments: Private function
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LTget_attribute( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- hid_t mem_type_id,
- void *data )
+herr_t
+H5LTget_attribute(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t mem_type_id, void *data)
{
/* Get the attribute */
- if(H5LT_get_attribute_mem(loc_id, obj_name, attr_name, mem_type_id, data) < 0)
+ if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, mem_type_id, data) < 0)
return -1;
return 0;
}
-
/*-------------------------------------------------------------------------
-* private functions
-*-------------------------------------------------------------------------
-*/
-
+ * private functions
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
-* Function: H5LT_get_attribute_mem
-*
-* Purpose: Reads an attribute named attr_name with the memory type mem_type_id
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 19, 2002
-*
-* Comments: Private function
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-
+ * Function: H5LT_get_attribute_mem
+ *
+ * Purpose: Reads an attribute named attr_name with the memory type mem_type_id
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 19, 2002
+ *
+ * Comments: Private function
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
-static herr_t H5LT_get_attribute_mem(hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- hid_t mem_type_id,
- void *data)
+static herr_t
+H5LT_get_attribute_mem(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t mem_type_id,
+ void *data)
{
/* identifiers */
- hid_t obj_id = -1;
+ hid_t obj_id = -1;
hid_t attr_id = -1;
/* check the arguments */
if (obj_name == NULL)
- return -1;
+ return -1;
if (attr_name == NULL)
- return -1;
+ return -1;
/* Open the object */
- if((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0)
+ if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0)
goto out;
- if((attr_id = H5Aopen(obj_id, attr_name, H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Aopen(obj_id, attr_name, H5P_DEFAULT)) < 0)
goto out;
- if(H5Aread(attr_id, mem_type_id, data) < 0)
+ if (H5Aread(attr_id, mem_type_id, data) < 0)
goto out;
- if(H5Aclose(attr_id) < 0)
+ if (H5Aclose(attr_id) < 0)
goto out;
attr_id = -1;
/* Close the object */
- if(H5Oclose(obj_id) < 0)
+ if (H5Oclose(obj_id) < 0)
goto out;
obj_id = -1;
return 0;
out:
- if(obj_id > 0)
+ if (obj_id > 0)
H5Oclose(obj_id);
- if(attr_id > 0)
+ if (attr_id > 0)
H5Aclose(attr_id);
return -1;
}
/*-------------------------------------------------------------------------
-* Function: H5LT_get_attribute_disk
-*
-* Purpose: Reads an attribute named attr_name with the datatype stored on disk
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: September 19, 2002
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: H5LT_get_attribute_disk
+ *
+ * Purpose: Reads an attribute named attr_name with the datatype stored on disk
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: September 19, 2002
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
-herr_t H5LT_get_attribute_disk( hid_t loc_id,
- const char *attr_name,
- void *attr_out )
+herr_t
+H5LT_get_attribute_disk(hid_t loc_id, const char *attr_name, void *attr_out)
{
/* identifiers */
hid_t attr_id;
hid_t attr_type;
- if(( attr_id = H5Aopen(loc_id, attr_name, H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Aopen(loc_id, attr_name, H5P_DEFAULT)) < 0)
return -1;
- if((attr_type = H5Aget_type(attr_id)) < 0)
+ if ((attr_type = H5Aget_type(attr_id)) < 0)
goto out;
- if(H5Aread(attr_id, attr_type, attr_out) < 0)
+ if (H5Aread(attr_id, attr_type, attr_out) < 0)
goto out;
- if(H5Tclose(attr_type) < 0)
+ if (H5Tclose(attr_type) < 0)
goto out;
- if ( H5Aclose( attr_id ) < 0 )
- return -1;;
+ if (H5Aclose(attr_id) < 0)
+ return -1;
+ ;
return 0;
out:
- H5Tclose( attr_type );
- H5Aclose( attr_id );
+ H5Tclose(attr_type);
+ H5Aclose(attr_id);
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: H5LT_set_attribute_string
-*
-* Purpose: creates and writes an attribute named NAME to the dataset DSET_ID
-*
-* Return: FAIL on error, SUCCESS on success
-*
-* Programmer: Pedro Vicente
-*
-* Date: January 04, 2005
-*
-* Comments:
-*
-* Modifications:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5LT_set_attribute_string(hid_t dset_id,
- const char *name,
- const char *buf )
+ * Function: H5LT_set_attribute_string
+ *
+ * Purpose: creates and writes an attribute named NAME to the dataset DSET_ID
+ *
+ * Return: FAIL on error, SUCCESS on success
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: January 04, 2005
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5LT_set_attribute_string(hid_t dset_id, const char *name, const char *buf)
{
- hid_t tid;
- hid_t sid = -1;
- hid_t aid = -1;
- int has_attr;
- size_t size;
+ hid_t tid;
+ hid_t sid = -1;
+ hid_t aid = -1;
+ int has_attr;
+ size_t size;
/* verify if the attribute already exists */
- has_attr = H5LT_find_attribute(dset_id,name);
+ has_attr = H5LT_find_attribute(dset_id, name);
/* the attribute already exists, delete it */
- if(has_attr == 1)
- if(H5Adelete(dset_id, name) < 0)
+ if (has_attr == 1)
+ if (H5Adelete(dset_id, name) < 0)
return FAIL;
/*-------------------------------------------------------------------------
- * create the attribute type
- *-------------------------------------------------------------------------
- */
- if((tid = H5Tcopy(H5T_C_S1)) < 0)
+ * create the attribute type
+ *-------------------------------------------------------------------------
+ */
+ if ((tid = H5Tcopy(H5T_C_S1)) < 0)
return FAIL;
size = HDstrlen(buf) + 1; /* extra null term */
- if(H5Tset_size(tid,(size_t)size) < 0)
+ if (H5Tset_size(tid, (size_t)size) < 0)
goto out;
- if(H5Tset_strpad(tid, H5T_STR_NULLTERM) < 0)
+ if (H5Tset_strpad(tid, H5T_STR_NULLTERM) < 0)
goto out;
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * create and write the attribute
- *-------------------------------------------------------------------------
- */
- if((aid = H5Acreate2(dset_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ * create and write the attribute
+ *-------------------------------------------------------------------------
+ */
+ if ((aid = H5Acreate2(dset_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Awrite(aid, tid, buf) < 0)
+ if (H5Awrite(aid, tid, buf) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
return SUCCEED;
/* error zone */
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Aclose(aid);
H5Tclose(tid);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
-
}
htri_t
H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid)
- {
- char *tmp_path = NULL; /* Temporary copy of the path */
- char *curr_name; /* Pointer to current component of path name */
- char *delimit; /* Pointer to path delimiter during traversal */
- H5I_type_t obj_type;
- htri_t link_exists, obj_exists;
- size_t path_length;
- htri_t ret_value;
-
- /* Initialize */
- ret_value = FALSE;
-
- /* check the arguments */
- if (path == NULL) {
- ret_value = FAIL;
- goto done;
- }
-
- /* Find the type of loc_id */
- if((obj_type = H5Iget_type(loc_id)) == H5I_BADID) {
- ret_value = FAIL;
- goto done;
- }
-
- /* Find the length of the path */
- path_length = HDstrlen(path);
-
- /* Check if the identifier is the object itself, i.e. path is '.' */
- if(HDstrncmp(path, ".", path_length) == 0) {
- if(check_object_valid) {
- obj_exists = H5Oexists_by_name(loc_id, path, H5P_DEFAULT);
- ret_value = obj_exists;
- goto done;
- } else {
- ret_value = TRUE; /* Since the object is the identifier itself,
- * we can only check if loc_id is a valid type */
- goto done;
- }
- }
-
- /* Duplicate the path to use */
- if(NULL == (tmp_path = HDstrdup(path))) {
- ret_value = FAIL;
- goto done;
- }
-
- curr_name = tmp_path;
-
- /* check if absolute pathname */
- if(HDstrncmp(path, "/", 1) == 0) curr_name++;
-
- /* check if relative path name starts with "./" */
- if(HDstrncmp(path, "./", 2) == 0) curr_name += 2;
-
- while((delimit=HDstrchr(curr_name,'/'))!=NULL) {
- /* Change the delimiter to terminate the string */
- *delimit='\0';
-
- obj_exists = FALSE;
- if((link_exists = H5Lexists(loc_id, tmp_path, H5P_DEFAULT)) < 0) {
- ret_value = FAIL;
- goto done;
- }
-
- /* If target link does not exist then no reason to
- * continue checking the path */
- if(link_exists != TRUE) {
+{
+ char * tmp_path = NULL; /* Temporary copy of the path */
+ char * curr_name; /* Pointer to current component of path name */
+ char * delimit; /* Pointer to path delimiter during traversal */
+ H5I_type_t obj_type;
+ htri_t link_exists, obj_exists;
+ size_t path_length;
+ htri_t ret_value;
+
+ /* Initialize */
ret_value = FALSE;
- goto done;
- }
-
- /* Determine if link resolves to an actual object */
- if((obj_exists = H5Oexists_by_name(loc_id, tmp_path, H5P_DEFAULT)) < 0) {
- ret_value = FAIL;
- goto done;
- }
-
- if(obj_exists != TRUE)
- break;
-
- /* Change the delimiter back to '/' */
- *delimit='/';
-
- /* Advance the pointer in the path to the start of the next component */
- curr_name = delimit + 1;
-
- } /* end while */
-
- /* Should be pointing to the last component in the path name now... */
-
- /* Check if link does not exist */
- if((link_exists = H5Lexists(loc_id, tmp_path, H5P_DEFAULT)) < 0) {
- ret_value = FAIL;
- } else {
- ret_value = link_exists;
- /* Determine if link resolves to an actual object for check_object_valid TRUE */
- if(check_object_valid == TRUE && link_exists == TRUE) {
- if((obj_exists = H5Oexists_by_name(loc_id, tmp_path, H5P_DEFAULT)) < 0) {
- ret_value = FAIL;
- } else {
- ret_value = obj_exists;
- }
- }
- }
+
+ /* check the arguments */
+ if (path == NULL) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ /* Find the type of loc_id */
+ if ((obj_type = H5Iget_type(loc_id)) == H5I_BADID) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ /* Find the length of the path */
+ path_length = HDstrlen(path);
+
+ /* Check if the identifier is the object itself, i.e. path is '.' */
+ if (HDstrncmp(path, ".", path_length) == 0) {
+ if (check_object_valid) {
+ obj_exists = H5Oexists_by_name(loc_id, path, H5P_DEFAULT);
+ ret_value = obj_exists;
+ goto done;
+ }
+ else {
+ ret_value = TRUE; /* Since the object is the identifier itself,
+ * we can only check if loc_id is a valid type */
+ goto done;
+ }
+ }
+
+ /* Duplicate the path to use */
+ if (NULL == (tmp_path = HDstrdup(path))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ curr_name = tmp_path;
+
+ /* check if absolute pathname */
+ if (HDstrncmp(path, "/", 1) == 0)
+ curr_name++;
+
+ /* check if relative path name starts with "./" */
+ if (HDstrncmp(path, "./", 2) == 0)
+ curr_name += 2;
+
+ while ((delimit = HDstrchr(curr_name, '/')) != NULL) {
+ /* Change the delimiter to terminate the string */
+ *delimit = '\0';
+
+ obj_exists = FALSE;
+ if ((link_exists = H5Lexists(loc_id, tmp_path, H5P_DEFAULT)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ /* If target link does not exist then no reason to
+ * continue checking the path */
+ if (link_exists != TRUE) {
+ ret_value = FALSE;
+ goto done;
+ }
+
+ /* Determine if link resolves to an actual object */
+ if ((obj_exists = H5Oexists_by_name(loc_id, tmp_path, H5P_DEFAULT)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (obj_exists != TRUE)
+ break;
+
+ /* Change the delimiter back to '/' */
+ *delimit = '/';
+
+ /* Advance the pointer in the path to the start of the next component */
+ curr_name = delimit + 1;
+
+ } /* end while */
+
+ /* Should be pointing to the last component in the path name now... */
+
+ /* Check if link does not exist */
+ if ((link_exists = H5Lexists(loc_id, tmp_path, H5P_DEFAULT)) < 0) {
+ ret_value = FAIL;
+ }
+ else {
+ ret_value = link_exists;
+ /* Determine if link resolves to an actual object for check_object_valid TRUE */
+ if (check_object_valid == TRUE && link_exists == TRUE) {
+ if ((obj_exists = H5Oexists_by_name(loc_id, tmp_path, H5P_DEFAULT)) < 0) {
+ ret_value = FAIL;
+ }
+ else {
+ ret_value = obj_exists;
+ }
+ }
+ }
done:
- if(tmp_path != NULL)
- HDfree(tmp_path);
+ if (tmp_path != NULL)
+ HDfree(tmp_path);
- return ret_value;
- }
+ return ret_value;
+}
diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c
index e5f0bea..41e77b0 100644
--- a/hl/src/H5LTanalyze.c
+++ b/hl/src/H5LTanalyze.c
@@ -1,61 +1,61 @@
-#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__
-#pragma GCC diagnostic ignored "-Wconversion"
-#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
-#pragma GCC diagnostic ignored "-Wlarger-than="
-#pragma GCC diagnostic ignored "-Wmissing-prototypes"
-#pragma GCC diagnostic ignored "-Wnested-externs"
-#pragma GCC diagnostic ignored "-Wold-style-definition"
-#pragma GCC diagnostic ignored "-Wredundant-decls"
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#pragma GCC diagnostic ignored "-Wsign-conversion"
-#pragma GCC diagnostic ignored "-Wstrict-overflow"
-#pragma GCC diagnostic ignored "-Wstrict-prototypes"
-#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
-#pragma GCC diagnostic ignored "-Wswitch-default"
-#pragma GCC diagnostic ignored "-Wunused-function"
-#pragma GCC diagnostic ignored "-Wunused-macros"
-#pragma GCC diagnostic ignored "-Wunused-parameter"
-#elif defined __SUNPRO_CC
-#pragma disable_warn
-#elif defined _MSC_VER
-#pragma warning(push, 1)
-#endif
+#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
+#pragma GCC diagnostic ignored "-Wlarger-than="
+#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+#pragma GCC diagnostic ignored "-Wnested-externs"
+#pragma GCC diagnostic ignored "-Wold-style-definition"
+#pragma GCC diagnostic ignored "-Wredundant-decls"
+#pragma GCC diagnostic ignored "-Wsign-compare"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#pragma GCC diagnostic ignored "-Wstrict-overflow"
+#pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
+#pragma GCC diagnostic ignored "-Wswitch-default"
+#pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic ignored "-Wunused-macros"
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#elif defined __SUNPRO_CC
+#pragma disable_warn
+#elif defined _MSC_VER
+#pragma warning(push, 1)
+#endif
#line 2 "hl/src/H5LTanalyze.c"
#line 4 "hl/src/H5LTanalyze.c"
-#define YY_INT_ALIGNED short int
+#define YY_INT_ALIGNED short int
/* A lexical scanner generated by flex */
-#define yy_create_buffer H5LTyy_create_buffer
-#define yy_delete_buffer H5LTyy_delete_buffer
-#define yy_scan_buffer H5LTyy_scan_buffer
-#define yy_scan_string H5LTyy_scan_string
-#define yy_scan_bytes H5LTyy_scan_bytes
-#define yy_init_buffer H5LTyy_init_buffer
-#define yy_flush_buffer H5LTyy_flush_buffer
-#define yy_load_buffer_state H5LTyy_load_buffer_state
-#define yy_switch_to_buffer H5LTyy_switch_to_buffer
-#define yypush_buffer_state H5LTyypush_buffer_state
-#define yypop_buffer_state H5LTyypop_buffer_state
+#define yy_create_buffer H5LTyy_create_buffer
+#define yy_delete_buffer H5LTyy_delete_buffer
+#define yy_scan_buffer H5LTyy_scan_buffer
+#define yy_scan_string H5LTyy_scan_string
+#define yy_scan_bytes H5LTyy_scan_bytes
+#define yy_init_buffer H5LTyy_init_buffer
+#define yy_flush_buffer H5LTyy_flush_buffer
+#define yy_load_buffer_state H5LTyy_load_buffer_state
+#define yy_switch_to_buffer H5LTyy_switch_to_buffer
+#define yypush_buffer_state H5LTyypush_buffer_state
+#define yypop_buffer_state H5LTyypop_buffer_state
#define yyensure_buffer_stack H5LTyyensure_buffer_stack
-#define yy_flex_debug H5LTyy_flex_debug
-#define yyin H5LTyyin
-#define yyleng H5LTyyleng
-#define yylex H5LTyylex
-#define yylineno H5LTyylineno
-#define yyout H5LTyyout
-#define yyrestart H5LTyyrestart
-#define yytext H5LTyytext
-#define yywrap H5LTyywrap
-#define yyalloc H5LTyyalloc
-#define yyrealloc H5LTyyrealloc
-#define yyfree H5LTyyfree
+#define yy_flex_debug H5LTyy_flex_debug
+#define yyin H5LTyyin
+#define yyleng H5LTyyleng
+#define yylex H5LTyylex
+#define yylineno H5LTyylineno
+#define yyout H5LTyyout
+#define yyrestart H5LTyyrestart
+#define yytext H5LTyytext
+#define yywrap H5LTyywrap
+#define yyalloc H5LTyyalloc
+#define yyrealloc H5LTyyrealloc
+#define yyfree H5LTyyfree
#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 6
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 6
#define YY_FLEX_SUBMINOR_VERSION 4
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
@@ -312,61 +312,61 @@
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
+ * if you want the limit (max/min) macros for int types.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
#endif
#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
+typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
+typedef unsigned int flex_uint32_t;
/* Limits of integral types. */
#ifndef INT8_MIN
-#define INT8_MIN (-128)
+#define INT8_MIN (-128)
#endif
#ifndef INT16_MIN
-#define INT16_MIN (-32767-1)
+#define INT16_MIN (-32767 - 1)
#endif
#ifndef INT32_MIN
-#define INT32_MIN (-2147483647-1)
+#define INT32_MIN (-2147483647 - 1)
#endif
#ifndef INT8_MAX
-#define INT8_MAX (127)
+#define INT8_MAX (127)
#endif
#ifndef INT16_MAX
-#define INT16_MAX (32767)
+#define INT16_MAX (32767)
#endif
#ifndef INT32_MAX
-#define INT32_MAX (2147483647)
+#define INT32_MAX (2147483647)
#endif
#ifndef UINT8_MAX
-#define UINT8_MAX (255U)
+#define UINT8_MAX (255U)
#endif
#ifndef UINT16_MAX
-#define UINT16_MAX (65535U)
+#define UINT16_MAX (65535U)
#endif
#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
+#define UINT32_MAX (4294967295U)
#endif
#ifndef SIZE_MAX
-#define SIZE_MAX (~(size_t)0)
+#define SIZE_MAX (~(size_t)0)
#endif
#endif /* ! C99 */
@@ -390,7 +390,7 @@ typedef unsigned int flex_uint32_t;
/* Promotes a possibly negative, possibly signed char to an
* integer in range [0..255] for use as an array index.
*/
-#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
+#define YY_SC_TO_UI(c) ((YY_CHAR)(c))
/* Enter a start condition. This macro really ought to take a parameter,
* but we do it the disgusting crufty way forced on us by the ()-less
@@ -401,12 +401,12 @@ typedef unsigned int flex_uint32_t;
* to BEGIN to return to the state. The YYSTATE alias is for lex
* compatibility.
*/
-#define YY_START (((yy_start) - 1) / 2)
-#define YYSTATE YY_START
+#define YY_START (((yy_start)-1) / 2)
+#define YYSTATE YY_START
/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart( yyin )
+#define YY_NEW_FILE yyrestart(yyin)
#define YY_END_OF_BUFFER_CHAR 0
/* Size of default input buffer. */
@@ -424,7 +424,7 @@ typedef unsigned int flex_uint32_t;
/* The state buf must be large enough to hold one state per character in the main buffer.
*/
-#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
@@ -441,96 +441,91 @@ extern int yyleng;
extern FILE *yyin, *yyout;
#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
- #define YY_LESS_LINENO(n)
- #define YY_LINENO_REWIND_TO(ptr)
-
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+#define YY_LESS_LINENO(n)
+#define YY_LINENO_REWIND_TO(ptr)
+
/* Return all but the first "n" matched characters back to the input stream. */
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- int yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- *yy_cp = (yy_hold_char); \
- YY_RESTORE_YY_MORE_OFFSET \
- (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-#define unput(c) yyunput( c, (yytext_ptr) )
+#define yyless(n) \
+ do { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg); \
+ *yy_cp = (yy_hold_char); \
+ YY_RESTORE_YY_MORE_OFFSET(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } while (0)
+#define unput(c) yyunput(c, (yytext_ptr))
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- int yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
+struct yy_buffer_state {
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ int yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
- int yy_buffer_status;
+ int yy_buffer_status;
-#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
#define YY_BUFFER_EOF_PENDING 2
-
- };
+};
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
/* Stack of input buffers. */
-static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
-static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
-static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
+static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
+static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
+static YY_BUFFER_STATE *yy_buffer_stack = NULL; /**< Stack as an array. */
/* We provide macros for accessing buffer states in case in the
* future we want to put the buffer states in a more general
@@ -538,9 +533,7 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
*
* Returns the top of the stack, or NULL.
*/
-#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
- ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
- : NULL)
+#define YY_CURRENT_BUFFER ((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL)
/* Same as previous macro, but useful when we know that the buffer stack is not
* NULL or when we need an lvalue. For internal use only.
*/
@@ -548,59 +541,57 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
/* yy_hold_char holds the character lost when yytext is formed. */
static char yy_hold_char;
-static int yy_n_chars; /* number of characters read into yy_ch_buf */
-int yyleng;
+static int yy_n_chars; /* number of characters read into yy_ch_buf */
+int yyleng;
/* Points to current character in buffer. */
static char *yy_c_buf_p = NULL;
-static int yy_init = 0; /* whether we need to initialize */
-static int yy_start = 0; /* start state number */
+static int yy_init = 0; /* whether we need to initialize */
+static int yy_start = 0; /* start state number */
/* Flag which is used to allow yywrap()'s to do buffer switches
* instead of setting up a fresh yyin. A bit of a hack ...
*/
static int yy_did_buffer_switch_on_eof;
-void yyrestart ( FILE *input_file );
-void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
-YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
-void yy_delete_buffer ( YY_BUFFER_STATE b );
-void yy_flush_buffer ( YY_BUFFER_STATE b );
-void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
-void yypop_buffer_state ( void );
+void yyrestart(FILE *input_file);
+void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer);
+YY_BUFFER_STATE yy_create_buffer(FILE *file, int size);
+void yy_delete_buffer(YY_BUFFER_STATE b);
+void yy_flush_buffer(YY_BUFFER_STATE b);
+void yypush_buffer_state(YY_BUFFER_STATE new_buffer);
+void yypop_buffer_state(void);
-static void yyensure_buffer_stack ( void );
-static void yy_load_buffer_state ( void );
-static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
-#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
+static void yyensure_buffer_stack(void);
+static void yy_load_buffer_state(void);
+static void yy_init_buffer(YY_BUFFER_STATE b, FILE *file);
+#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER)
-YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
-YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
-YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
+YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size);
+YY_BUFFER_STATE yy_scan_string(const char *yy_str);
+YY_BUFFER_STATE yy_scan_bytes(const char *bytes, int len);
-void *yyalloc ( yy_size_t );
-void *yyrealloc ( void *, yy_size_t );
-void yyfree ( void * );
+void *yyalloc(yy_size_t);
+void *yyrealloc(void *, yy_size_t);
+void yyfree(void *);
#define yy_new_buffer yy_create_buffer
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! YY_CURRENT_BUFFER ){ \
- yyensure_buffer_stack (); \
- YY_CURRENT_BUFFER_LVALUE = \
- yy_create_buffer( yyin, YY_BUF_SIZE ); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
- }
-#define yy_set_bol(at_bol) \
- { \
- if ( ! YY_CURRENT_BUFFER ){\
- yyensure_buffer_stack (); \
- YY_CURRENT_BUFFER_LVALUE = \
- yy_create_buffer( yyin, YY_BUF_SIZE ); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
- }
+#define yy_set_interactive(is_interactive) \
+ { \
+ if (!YY_CURRENT_BUFFER) { \
+ yyensure_buffer_stack(); \
+ YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+ }
+#define yy_set_bol(at_bol) \
+ { \
+ if (!YY_CURRENT_BUFFER) { \
+ yyensure_buffer_stack(); \
+ YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+ }
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
/* Begin user sect3 */
@@ -611,7 +602,7 @@ FILE *yyin = NULL, *yyout = NULL;
typedef int yy_state_type;
extern int yylineno;
-int yylineno = 1;
+int yylineno = 1;
extern char *yytext;
#ifdef yytext_ptr
@@ -619,481 +610,272 @@ extern char *yytext;
#endif
#define yytext_ptr yytext
-static yy_state_type yy_get_previous_state ( void );
-static yy_state_type yy_try_NUL_trans ( yy_state_type current_state );
-static int yy_get_next_buffer ( void );
-static void yynoreturn yy_fatal_error ( const char* msg );
+static yy_state_type yy_get_previous_state(void);
+static yy_state_type yy_try_NUL_trans(yy_state_type current_state);
+static int yy_get_next_buffer(void);
+static void yynoreturn yy_fatal_error(const char *msg);
/* Done after the current pattern has been matched and before the
* corresponding action - sets up yytext.
*/
-#define YY_DO_BEFORE_ACTION \
- (yytext_ptr) = yy_bp; \
- yyleng = (int) (yy_cp - yy_bp); \
- (yy_hold_char) = *yy_cp; \
- *yy_cp = '\0'; \
- (yy_c_buf_p) = yy_cp;
-#define YY_NUM_RULES 66
+#define YY_DO_BEFORE_ACTION \
+ (yytext_ptr) = yy_bp; \
+ yyleng = (int)(yy_cp - yy_bp); \
+ (yy_hold_char) = *yy_cp; \
+ *yy_cp = '\0'; \
+ (yy_c_buf_p) = yy_cp;
+#define YY_NUM_RULES 66
#define YY_END_OF_BUFFER 67
/* This struct is not used in this scanner,
but its presence is necessary. */
-struct yy_trans_info
- {
- flex_int32_t yy_verify;
- flex_int32_t yy_nxt;
- };
-static const flex_int16_t yy_acclist[437] =
- { 0,
- 64, 64, 64, 64, 67, 66, 64, 66, 64, 65,
- 66, 56, 66, 55, 66, 62, 66, 63, 66, 66,
- 66, 66, 66, 60, 66, 61, 66, 58, 66, 59,
- 66, 57, 66, 57, 64, 66, 57, 64, 65, 66,
- 55, 57, 66, 57, 62, 66, 57, 63, 66, 57,
- 66, 57, 66, 57, 66, 57, 66, 57, 60, 66,
- 57, 61, 66, 57, 58, 66, 57, 59, 66, 64,
- 55, 57, 57, 64, 55, 57, 57, 57, 57, 57,
- 57, 57, 57, 57, 57, 57, 38, 38, 57, 57,
- 57, 57, 57, 57, 39, 39, 57, 57, 57, 57,
-
- 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
- 37, 57, 57, 57, 57, 57, 57, 57, 57, 57,
- 57, 57, 57, 57, 57, 37, 57, 57, 54, 36,
- 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
- 57, 57, 57, 57, 54, 57, 36, 57, 45, 49,
- 51, 53, 57, 57, 57, 45, 57, 49, 57, 57,
- 57, 57, 57, 57, 57, 57, 57, 51, 57, 53,
- 57, 50, 50, 57, 57, 57, 57, 57, 57, 57,
- 57, 57, 57, 57, 57, 57, 52, 35, 57, 57,
- 57, 57, 57, 57, 52, 57, 57, 57, 57, 57,
-
- 57, 57, 57, 57, 35, 57, 57, 57, 57, 57,
- 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
- 57, 57, 57, 57, 57, 57, 57, 57, 57, 48,
- 1, 2, 9, 10, 47, 48, 57, 57, 57, 57,
- 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
- 57, 57, 57, 57, 57, 1, 57, 2, 57, 57,
- 57, 57, 57, 57, 57, 9, 57, 10, 57, 57,
- 57, 47, 57, 44, 3, 4, 5, 6, 7, 8,
- 11, 12, 13, 14, 15, 16, 57, 44, 57, 57,
- 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
-
- 57, 57, 57, 57, 57, 57, 57, 3, 57, 4,
- 57, 5, 57, 6, 57, 7, 57, 8, 57, 11,
- 57, 12, 57, 13, 57, 14, 57, 15, 57, 16,
- 57, 57, 57, 57, 43, 46, 28, 29, 30, 31,
- 22, 43, 57, 46, 57, 28, 57, 29, 57, 30,
- 57, 31, 57, 57, 57, 57, 22, 57, 57, 57,
- 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
- 57, 17, 24, 23, 41, 17, 57, 57, 57, 57,
- 57, 24, 57, 57, 57, 57, 23, 57, 57, 57,
- 57, 41, 57, 57, 57, 32, 26, 18, 20, 19,
-
- 25, 40, 42, 57, 32, 57, 57, 26, 57, 18,
- 57, 20, 57, 19, 57, 57, 25, 57, 57, 40,
- 57, 42, 57, 33, 27, 21, 33, 57, 57, 27,
- 57, 21, 57, 34, 34, 57
- } ;
-
-static const flex_int16_t yy_accept[546] =
- { 0,
- 1, 2, 3, 4, 5, 6, 7, 9, 12, 14,
- 16, 18, 20, 21, 22, 23, 24, 26, 28, 30,
- 32, 34, 37, 41, 44, 47, 50, 52, 54, 56,
- 58, 61, 64, 67, 70, 71, 72, 72, 72, 72,
- 72, 72, 73, 75, 77, 78, 79, 80, 81, 82,
- 82, 82, 82, 82, 82, 83, 84, 85, 86, 87,
- 88, 88, 88, 88, 88, 88, 90, 91, 92, 93,
- 94, 95, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 98, 99, 100, 101,
- 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
-
- 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
- 111, 111, 111, 111, 112, 112, 113, 114, 115, 116,
- 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
- 128, 129, 129, 129, 129, 129, 129, 129, 129, 129,
- 129, 129, 129, 129, 129, 129, 130, 131, 132, 133,
- 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 147, 149, 149, 149, 149, 150, 151, 151,
- 151, 151, 151, 151, 151, 151, 151, 152, 153, 154,
- 155, 156, 158, 160, 161, 162, 163, 164, 165, 166,
- 167, 168, 170, 172, 173, 173, 173, 173, 173, 173,
-
- 173, 173, 173, 173, 173, 173, 173, 175, 176, 177,
- 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
- 187, 187, 187, 187, 187, 187, 188, 188, 188, 188,
- 188, 188, 188, 188, 188, 189, 189, 189, 189, 190,
- 191, 192, 193, 194, 195, 197, 198, 199, 200, 201,
- 202, 203, 204, 205, 207, 208, 209, 210, 210, 210,
- 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
- 210, 210, 210, 210, 210, 210, 210, 210, 211, 212,
- 213, 214, 215, 216, 217, 218, 219, 220, 221, 222,
- 223, 224, 225, 226, 227, 228, 229, 230, 231, 231,
-
- 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 231, 231, 231, 231, 232, 233, 233,
- 233, 233, 233, 233, 233, 234, 235, 235, 235, 236,
- 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
- 248, 249, 250, 251, 252, 253, 254, 255, 256, 258,
- 260, 261, 262, 263, 264, 265, 266, 268, 270, 271,
- 272, 274, 274, 275, 275, 275, 275, 275, 275, 275,
- 275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
- 275, 275, 276, 277, 278, 279, 280, 281, 282, 283,
- 284, 285, 286, 287, 287, 287, 287, 288, 290, 291,
-
- 292, 293, 294, 295, 296, 297, 298, 299, 300, 301,
- 302, 303, 304, 305, 306, 307, 308, 310, 312, 314,
- 316, 318, 320, 322, 324, 326, 328, 330, 332, 333,
- 334, 335, 336, 337, 338, 339, 340, 341, 341, 341,
- 341, 342, 342, 342, 342, 342, 342, 342, 342, 342,
- 342, 342, 342, 342, 342, 344, 346, 348, 350, 352,
- 354, 355, 356, 357, 359, 360, 361, 362, 363, 364,
- 365, 366, 367, 368, 369, 370, 371, 372, 373, 373,
- 373, 373, 373, 374, 374, 374, 374, 375, 375, 375,
- 375, 376, 376, 376, 378, 379, 380, 381, 382, 384,
-
- 385, 386, 387, 389, 390, 391, 392, 394, 395, 396,
- 396, 397, 397, 398, 399, 400, 401, 401, 402, 402,
- 403, 404, 405, 407, 408, 410, 412, 414, 416, 417,
- 419, 420, 422, 424, 425, 425, 426, 427, 429, 430,
- 432, 434, 435, 437, 437
- } ;
-
-static const YY_CHAR yy_ec[256] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 1, 4, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 5, 6, 7,
- 8, 9, 10, 11, 5, 12, 5, 13, 14, 1,
- 1, 1, 1, 1, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 1, 1, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, 33, 34, 1, 1, 35, 36,
- 37, 1, 38, 1, 39, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 40, 1, 41, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
- } ;
-
-static const YY_CHAR yy_meta[42] =
- { 0,
- 1, 1, 1, 2, 3, 3, 3, 3, 3, 3,
- 3, 3, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1
- } ;
-
-static const flex_int16_t yy_base[547] =
- { 0,
- 0, 0, 41, 0, 610, 611, 81, 83, 611, 0,
- 611, 611, 56, 599, 580, 575, 611, 611, 611, 611,
- 0, 87, 89, 88, 0, 0, 70, 596, 577, 572,
- 0, 0, 0, 0, 101, 0, 584, 567, 569, 571,
- 569, 0, 103, 0, 579, 562, 564, 566, 564, 561,
- 564, 552, 551, 79, 557, 560, 548, 547, 80, 611,
- 566, 97, 87, 569, 560, 0, 563, 117, 90, 566,
- 557, 611, 549, 99, 552, 550, 557, 560, 546, 541,
- 118, 549, 556, 552, 533, 0, 538, 108, 541, 539,
- 546, 549, 535, 530, 126, 538, 545, 541, 522, 527,
-
- 531, 536, 523, 520, 522, 532, 518, 534, 95, 518,
- 528, 510, 524, 611, 525, 513, 517, 522, 509, 506,
- 508, 518, 504, 520, 97, 504, 514, 496, 510, 0,
- 511, 514, 500, 495, 520, 500, 492, 504, 499, 492,
- 481, 106, 496, 492, 498, 611, 611, 501, 487, 482,
- 507, 487, 479, 491, 486, 479, 468, 123, 483, 479,
- 485, 0, 0, 468, 475, 462, 611, 611, 470, 460,
- 464, 464, 126, 470, 126, 480, 611, 611, 459, 466,
- 453, 0, 0, 461, 451, 455, 455, 130, 461, 129,
- 471, 0, 0, 611, 452, 139, 469, 463, 463, 462,
-
- 158, 165, 459, 446, 450, 461, 0, 443, 141, 460,
- 454, 454, 453, 172, 179, 450, 437, 441, 452, 441,
- 435, 433, 438, 150, 424, 611, 451, 454, 451, 151,
- 448, 451, 448, 165, 611, 432, 440, 430, 427, 421,
- 419, 424, 157, 410, 0, 437, 440, 437, 170, 434,
- 437, 434, 172, 0, 418, 426, 416, 421, 421, 417,
- 397, 428, 425, 180, 177, 183, 186, 414, 413, 190,
- 192, 193, 412, 411, 405, 411, 408, 408, 408, 404,
- 384, 415, 412, 201, 196, 199, 206, 401, 400, 211,
- 212, 213, 399, 398, 392, 398, 395, 611, 390, 400,
-
- 380, 215, 217, 388, 382, 384, 381, 220, 223, 225,
- 387, 386, 385, 384, 383, 382, 611, 611, 381, 380,
- 379, 378, 377, 376, 611, 611, 218, 375, 611, 0,
- 370, 380, 360, 227, 236, 368, 362, 364, 361, 235,
- 241, 244, 367, 366, 365, 364, 363, 362, 0, 0,
- 361, 360, 359, 358, 357, 356, 0, 0, 237, 355,
- 0, 350, 611, 366, 352, 351, 350, 349, 352, 333,
- 338, 332, 336, 335, 335, 338, 332, 336, 331, 155,
- 334, 611, 611, 611, 611, 611, 611, 611, 611, 611,
- 611, 611, 611, 340, 335, 325, 329, 0, 345, 331,
-
- 330, 329, 328, 331, 312, 317, 311, 315, 314, 314,
- 317, 311, 315, 310, 168, 313, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 319, 314,
- 304, 611, 611, 611, 611, 611, 611, 301, 314, 314,
- 611, 295, 301, 305, 310, 294, 308, 290, 294, 294,
- 292, 300, 287, 301, 0, 0, 0, 0, 0, 0,
- 285, 298, 298, 0, 279, 285, 289, 294, 278, 292,
- 274, 278, 278, 276, 284, 271, 285, 611, 275, 266,
- 281, 275, 611, 265, 262, 263, 611, 266, 270, 260,
- 611, 264, 270, 0, 263, 254, 269, 263, 0, 253,
-
- 250, 251, 0, 254, 258, 247, 0, 249, 255, 253,
- 611, 247, 611, 611, 611, 611, 249, 611, 234, 611,
- 611, 245, 0, 233, 0, 0, 0, 0, 234, 0,
- 222, 0, 0, 611, 207, 611, 611, 0, 186, 0,
- 0, 611, 0, 611, 106, 275
- } ;
-
-static const flex_int16_t yy_def[547] =
- { 0,
- 544, 1, 544, 3, 544, 544, 544, 544, 544, 545,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
- 546, 546, 546, 546, 544, 545, 544, 544, 544, 544,
- 544, 546, 546, 24, 546, 546, 546, 546, 546, 544,
- 544, 544, 544, 544, 546, 546, 546, 546, 546, 544,
- 544, 544, 544, 544, 544, 546, 546, 546, 546, 546,
- 546, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 546, 546, 546, 546, 546,
- 546, 546, 546, 546, 546, 546, 546, 546, 546, 544,
-
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 546, 546, 546, 546, 546,
- 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
- 546, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 546, 546, 546,
- 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
- 546, 546, 546, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 546, 546,
- 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
- 546, 546, 546, 544, 544, 544, 544, 544, 544, 544,
-
- 544, 544, 544, 544, 544, 544, 546, 546, 546, 546,
- 546, 546, 546, 546, 546, 546, 546, 546, 546, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 546, 546,
- 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
- 546, 546, 546, 546, 546, 546, 546, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 546, 546, 546,
- 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
- 546, 546, 546, 546, 546, 546, 546, 544, 544, 544,
-
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 546,
- 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
- 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
- 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
- 546, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 546, 546, 546, 546,
-
- 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
- 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
- 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
- 546, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 546, 546, 546, 546, 546, 546,
- 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
- 546, 546, 546, 546, 546, 546, 546, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 546, 546, 546, 546, 546, 546, 546,
-
- 546, 546, 546, 546, 546, 546, 546, 546, 546, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 546, 546, 546, 546, 546, 546, 546, 546, 546,
- 546, 546, 546, 544, 544, 544, 544, 546, 546, 546,
- 546, 544, 546, 0, 544, 544
- } ;
-
-static const flex_int16_t yy_nxt[653] =
- { 0,
- 6, 7, 8, 9, 10, 10, 10, 10, 10, 10,
- 10, 10, 11, 12, 6, 6, 13, 6, 6, 6,
- 6, 14, 6, 6, 6, 6, 15, 6, 6, 6,
- 16, 6, 6, 6, 6, 6, 17, 18, 6, 19,
- 20, 21, 22, 23, 9, 24, 24, 24, 24, 24,
- 24, 24, 24, 25, 26, 21, 21, 27, 21, 21,
- 21, 21, 28, 21, 21, 21, 21, 29, 21, 21,
- 21, 30, 21, 21, 21, 21, 21, 31, 32, 21,
- 33, 34, 35, 35, 35, 35, 37, 38, 43, 43,
- 43, 43, 44, 44, 44, 44, 44, 44, 44, 44,
-
- 45, 46, 35, 35, 43, 43, 64, 70, 36, 65,
- 71, 73, 141, 74, 157, 75, 76, 82, 83, 77,
- 96, 97, 78, 79, 142, 101, 158, 80, 174, 102,
- 81, 87, 110, 88, 117, 89, 90, 103, 118, 91,
- 126, 111, 92, 93, 175, 189, 119, 94, 201, 127,
- 95, 204, 214, 221, 217, 240, 205, 262, 202, 218,
- 263, 190, 215, 227, 282, 228, 268, 283, 229, 230,
- 231, 222, 232, 241, 269, 233, 234, 246, 449, 247,
- 273, 450, 248, 249, 250, 288, 251, 293, 274, 252,
- 253, 472, 311, 289, 473, 294, 304, 305, 313, 306,
-
- 312, 315, 307, 308, 543, 319, 314, 321, 323, 316,
- 309, 343, 310, 320, 345, 322, 324, 336, 337, 344,
- 338, 347, 346, 339, 340, 542, 351, 353, 355, 348,
- 365, 341, 367, 342, 352, 354, 356, 373, 366, 376,
- 368, 378, 400, 374, 377, 394, 375, 379, 380, 395,
- 401, 402, 408, 541, 540, 381, 539, 411, 409, 403,
- 413, 410, 412, 538, 429, 537, 414, 415, 430, 536,
- 535, 534, 533, 532, 416, 42, 531, 42, 530, 529,
- 528, 527, 526, 525, 524, 523, 522, 521, 520, 519,
- 518, 517, 516, 515, 514, 513, 512, 511, 510, 509,
-
- 508, 507, 506, 505, 504, 503, 502, 501, 500, 499,
- 498, 497, 496, 495, 494, 493, 492, 491, 490, 489,
- 488, 487, 486, 485, 484, 483, 482, 481, 480, 479,
- 478, 477, 476, 475, 474, 471, 470, 469, 468, 467,
- 466, 465, 464, 463, 462, 461, 460, 459, 458, 457,
- 456, 455, 454, 453, 452, 451, 448, 447, 446, 445,
- 444, 443, 442, 441, 440, 439, 438, 437, 436, 435,
- 434, 433, 432, 431, 428, 427, 426, 425, 424, 423,
- 422, 421, 420, 419, 418, 417, 407, 406, 405, 404,
- 399, 398, 397, 396, 393, 392, 391, 390, 389, 388,
-
- 387, 386, 385, 384, 383, 382, 372, 371, 370, 369,
- 364, 363, 362, 361, 360, 359, 358, 357, 350, 349,
- 335, 334, 333, 332, 331, 330, 329, 328, 327, 326,
- 325, 318, 317, 303, 302, 301, 300, 299, 298, 297,
- 296, 295, 292, 291, 290, 287, 286, 285, 284, 281,
- 280, 279, 278, 277, 276, 275, 272, 271, 270, 267,
- 266, 265, 264, 261, 260, 259, 258, 257, 256, 255,
- 254, 245, 244, 243, 242, 239, 238, 237, 236, 235,
- 226, 225, 224, 223, 220, 219, 216, 213, 212, 211,
- 210, 209, 208, 207, 206, 203, 200, 199, 198, 197,
-
- 196, 195, 194, 193, 192, 191, 188, 187, 186, 185,
- 184, 183, 182, 181, 180, 179, 178, 177, 176, 173,
- 172, 171, 170, 169, 168, 167, 166, 165, 164, 163,
- 162, 161, 160, 159, 156, 155, 154, 153, 152, 151,
- 150, 149, 148, 147, 146, 145, 144, 143, 140, 139,
- 138, 137, 136, 135, 134, 133, 132, 131, 130, 129,
- 128, 125, 124, 123, 122, 121, 120, 116, 115, 114,
- 113, 112, 109, 108, 107, 106, 105, 104, 100, 99,
- 98, 86, 85, 84, 72, 69, 68, 67, 66, 63,
- 62, 61, 60, 59, 58, 57, 56, 55, 54, 53,
-
- 52, 51, 50, 49, 48, 47, 41, 40, 39, 544,
- 5, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544
- } ;
-
-static const flex_int16_t yy_chk[653] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 7, 7, 8, 8, 13, 13, 22, 22,
- 23, 23, 24, 24, 24, 24, 24, 24, 24, 24,
-
- 27, 27, 35, 35, 43, 43, 54, 59, 545, 54,
- 59, 62, 109, 62, 125, 62, 62, 63, 63, 62,
- 69, 69, 62, 62, 109, 74, 125, 62, 142, 74,
- 62, 68, 81, 68, 88, 68, 68, 74, 88, 68,
- 95, 81, 68, 68, 142, 158, 88, 68, 173, 95,
- 68, 175, 188, 196, 190, 209, 175, 224, 173, 190,
- 224, 158, 188, 201, 243, 201, 230, 243, 201, 201,
- 202, 196, 202, 209, 230, 202, 202, 214, 380, 214,
- 234, 380, 214, 214, 215, 249, 215, 253, 234, 215,
- 215, 415, 265, 249, 415, 253, 264, 264, 266, 264,
-
- 265, 267, 264, 264, 539, 270, 266, 271, 272, 267,
- 264, 285, 264, 270, 286, 271, 272, 284, 284, 285,
- 284, 287, 286, 284, 284, 535, 290, 291, 292, 287,
- 302, 284, 303, 284, 290, 291, 292, 308, 302, 309,
- 303, 310, 334, 308, 309, 327, 308, 310, 310, 327,
- 334, 335, 340, 531, 529, 310, 524, 341, 340, 335,
- 342, 340, 341, 522, 359, 519, 342, 342, 359, 517,
- 512, 510, 509, 508, 342, 546, 506, 546, 505, 504,
- 502, 501, 500, 498, 497, 496, 495, 493, 492, 490,
- 489, 488, 486, 485, 484, 482, 481, 480, 479, 477,
-
- 476, 475, 474, 473, 472, 471, 470, 469, 468, 467,
- 466, 465, 463, 462, 461, 454, 453, 452, 451, 450,
- 449, 448, 447, 446, 445, 444, 443, 442, 440, 439,
- 438, 431, 430, 429, 416, 414, 413, 412, 411, 410,
- 409, 408, 407, 406, 405, 404, 403, 402, 401, 400,
- 399, 397, 396, 395, 394, 381, 379, 378, 377, 376,
- 375, 374, 373, 372, 371, 370, 369, 368, 367, 366,
- 365, 364, 362, 360, 356, 355, 354, 353, 352, 351,
- 348, 347, 346, 345, 344, 343, 339, 338, 337, 336,
- 333, 332, 331, 328, 324, 323, 322, 321, 320, 319,
-
- 316, 315, 314, 313, 312, 311, 307, 306, 305, 304,
- 301, 300, 299, 297, 296, 295, 294, 293, 289, 288,
- 283, 282, 281, 280, 279, 278, 277, 276, 275, 274,
- 273, 269, 268, 263, 262, 261, 260, 259, 258, 257,
- 256, 255, 252, 251, 250, 248, 247, 246, 244, 242,
- 241, 240, 239, 238, 237, 236, 233, 232, 231, 229,
- 228, 227, 225, 223, 222, 221, 220, 219, 218, 217,
- 216, 213, 212, 211, 210, 208, 206, 205, 204, 203,
- 200, 199, 198, 197, 195, 191, 189, 187, 186, 185,
- 184, 181, 180, 179, 176, 174, 172, 171, 170, 169,
-
- 166, 165, 164, 161, 160, 159, 157, 156, 155, 154,
- 153, 152, 151, 150, 149, 148, 145, 144, 143, 141,
- 140, 139, 138, 137, 136, 135, 134, 133, 132, 131,
- 129, 128, 127, 126, 124, 123, 122, 121, 120, 119,
- 118, 117, 116, 115, 113, 112, 111, 110, 108, 107,
- 106, 105, 104, 103, 102, 101, 100, 99, 98, 97,
- 96, 94, 93, 92, 91, 90, 89, 87, 85, 84,
- 83, 82, 80, 79, 78, 77, 76, 75, 73, 71,
- 70, 67, 65, 64, 61, 58, 57, 56, 55, 53,
- 52, 51, 50, 49, 48, 47, 46, 45, 41, 40,
-
- 39, 38, 37, 30, 29, 28, 16, 15, 14, 5,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
- 544, 544
- } ;
+struct yy_trans_info {
+ flex_int32_t yy_verify;
+ flex_int32_t yy_nxt;
+};
+static const flex_int16_t yy_acclist[437] = {
+ 0, 64, 64, 64, 64, 67, 66, 64, 66, 64, 65, 66, 56, 66, 55, 66, 62, 66, 63, 66, 66, 66, 66, 66, 60, 66,
+ 61, 66, 58, 66, 59, 66, 57, 66, 57, 64, 66, 57, 64, 65, 66, 55, 57, 66, 57, 62, 66, 57, 63, 66, 57, 66,
+ 57, 66, 57, 66, 57, 66, 57, 60, 66, 57, 61, 66, 57, 58, 66, 57, 59, 66, 64, 55, 57, 57, 64, 55, 57, 57,
+ 57, 57, 57, 57, 57, 57, 57, 57, 57, 38, 38, 57, 57, 57, 57, 57, 57, 39, 39, 57, 57, 57, 57,
+
+ 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 37, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 37,
+ 57, 57, 54, 36, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 54, 57, 36, 57, 45, 49, 51, 53,
+ 57, 57, 57, 45, 57, 49, 57, 57, 57, 57, 57, 57, 57, 57, 57, 51, 57, 53, 57, 50, 50, 57, 57, 57, 57, 57,
+ 57, 57, 57, 57, 57, 57, 57, 57, 52, 35, 57, 57, 57, 57, 57, 57, 52, 57, 57, 57, 57, 57,
+
+ 57, 57, 57, 57, 35, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
+ 57, 57, 57, 48, 1, 2, 9, 10, 47, 48, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
+ 57, 57, 57, 1, 57, 2, 57, 57, 57, 57, 57, 57, 57, 9, 57, 10, 57, 57, 57, 47, 57, 44, 3, 4, 5, 6,
+ 7, 8, 11, 12, 13, 14, 15, 16, 57, 44, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
+
+ 57, 57, 57, 57, 57, 57, 57, 3, 57, 4, 57, 5, 57, 6, 57, 7, 57, 8, 57, 11, 57, 12, 57, 13, 57, 14,
+ 57, 15, 57, 16, 57, 57, 57, 57, 43, 46, 28, 29, 30, 31, 22, 43, 57, 46, 57, 28, 57, 29, 57, 30, 57, 31,
+ 57, 57, 57, 57, 22, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 17, 24, 23, 41, 17, 57, 57,
+ 57, 57, 57, 24, 57, 57, 57, 57, 23, 57, 57, 57, 57, 41, 57, 57, 57, 32, 26, 18, 20, 19,
+
+ 25, 40, 42, 57, 32, 57, 57, 26, 57, 18, 57, 20, 57, 19, 57, 57, 25, 57, 57, 40, 57, 42, 57, 33, 27, 21,
+ 33, 57, 57, 27, 57, 21, 57, 34, 34, 57};
+
+static const flex_int16_t yy_accept[546] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 9, 12, 14, 16, 18, 20, 21, 22, 23, 24, 26, 28, 30,
+ 32, 34, 37, 41, 44, 47, 50, 52, 54, 56, 58, 61, 64, 67, 70, 71, 72, 72, 72, 72, 72,
+ 72, 73, 75, 77, 78, 79, 80, 81, 82, 82, 82, 82, 82, 82, 83, 84, 85, 86, 87, 88, 88,
+ 88, 88, 88, 88, 90, 91, 92, 93, 94, 95, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
+
+ 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 112, 112, 113, 114, 115, 116, 117,
+ 118, 119, 120, 121, 122, 123, 124, 125, 126, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
+ 129, 129, 129, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 147,
+ 149, 149, 149, 149, 150, 151, 151, 151, 151, 151, 151, 151, 151, 151, 152, 153, 154, 155, 156, 158, 160,
+ 161, 162, 163, 164, 165, 166, 167, 168, 170, 172, 173, 173, 173, 173, 173, 173,
+
+ 173, 173, 173, 173, 173, 173, 173, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 187,
+ 187, 187, 187, 187, 187, 188, 188, 188, 188, 188, 188, 188, 188, 188, 189, 189, 189, 189, 190, 191, 192,
+ 193, 194, 195, 197, 198, 199, 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, 210, 210, 210, 210, 210,
+ 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 211, 212, 213, 214, 215, 216,
+ 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 231,
+
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 232, 233, 233, 233,
+ 233, 233, 233, 233, 234, 235, 235, 235, 236, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
+ 250, 251, 252, 253, 254, 255, 256, 258, 260, 261, 262, 263, 264, 265, 266, 268, 270, 271, 272, 274, 274,
+ 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 276, 277,
+ 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 287, 287, 287, 288, 290, 291,
+
+ 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 310, 312, 314, 316,
+ 318, 320, 322, 324, 326, 328, 330, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 341, 341, 341, 342,
+ 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 344, 346, 348, 350, 352, 354, 355, 356,
+ 357, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 373, 373, 373, 373, 374,
+ 374, 374, 374, 375, 375, 375, 375, 376, 376, 376, 378, 379, 380, 381, 382, 384,
+
+ 385, 386, 387, 389, 390, 391, 392, 394, 395, 396, 396, 397, 397, 398, 399, 400, 401, 401, 402, 402, 403,
+ 404, 405, 407, 408, 410, 412, 414, 416, 417, 419, 420, 422, 424, 425, 425, 426, 427, 429, 430, 432, 434,
+ 435, 437, 437};
+
+static const YY_CHAR yy_ec[256] = {
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 2, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 6, 7, 8,
+ 9, 10, 11, 5, 12, 5, 13, 14, 1, 1, 1, 1, 1, 15, 16, 17, 18, 19, 20, 21, 22, 23, 1, 1, 24, 25,
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, 1, 1, 35, 36, 37, 1, 38, 1, 39, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 40, 1, 41, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1};
+
+static const YY_CHAR yy_meta[42] = {0, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+
+static const flex_int16_t yy_base[547] = {
+ 0, 0, 0, 41, 0, 610, 611, 81, 83, 611, 0, 611, 611, 56, 599, 580, 575, 611, 611, 611, 611,
+ 0, 87, 89, 88, 0, 0, 70, 596, 577, 572, 0, 0, 0, 0, 101, 0, 584, 567, 569, 571, 569,
+ 0, 103, 0, 579, 562, 564, 566, 564, 561, 564, 552, 551, 79, 557, 560, 548, 547, 80, 611, 566, 97,
+ 87, 569, 560, 0, 563, 117, 90, 566, 557, 611, 549, 99, 552, 550, 557, 560, 546, 541, 118, 549, 556,
+ 552, 533, 0, 538, 108, 541, 539, 546, 549, 535, 530, 126, 538, 545, 541, 522, 527,
+
+ 531, 536, 523, 520, 522, 532, 518, 534, 95, 518, 528, 510, 524, 611, 525, 513, 517, 522, 509, 506, 508,
+ 518, 504, 520, 97, 504, 514, 496, 510, 0, 511, 514, 500, 495, 520, 500, 492, 504, 499, 492, 481, 106,
+ 496, 492, 498, 611, 611, 501, 487, 482, 507, 487, 479, 491, 486, 479, 468, 123, 483, 479, 485, 0, 0,
+ 468, 475, 462, 611, 611, 470, 460, 464, 464, 126, 470, 126, 480, 611, 611, 459, 466, 453, 0, 0, 461,
+ 451, 455, 455, 130, 461, 129, 471, 0, 0, 611, 452, 139, 469, 463, 463, 462,
+
+ 158, 165, 459, 446, 450, 461, 0, 443, 141, 460, 454, 454, 453, 172, 179, 450, 437, 441, 452, 441, 435,
+ 433, 438, 150, 424, 611, 451, 454, 451, 151, 448, 451, 448, 165, 611, 432, 440, 430, 427, 421, 419, 424,
+ 157, 410, 0, 437, 440, 437, 170, 434, 437, 434, 172, 0, 418, 426, 416, 421, 421, 417, 397, 428, 425,
+ 180, 177, 183, 186, 414, 413, 190, 192, 193, 412, 411, 405, 411, 408, 408, 408, 404, 384, 415, 412, 201,
+ 196, 199, 206, 401, 400, 211, 212, 213, 399, 398, 392, 398, 395, 611, 390, 400,
+
+ 380, 215, 217, 388, 382, 384, 381, 220, 223, 225, 387, 386, 385, 384, 383, 382, 611, 611, 381, 380, 379,
+ 378, 377, 376, 611, 611, 218, 375, 611, 0, 370, 380, 360, 227, 236, 368, 362, 364, 361, 235, 241, 244,
+ 367, 366, 365, 364, 363, 362, 0, 0, 361, 360, 359, 358, 357, 356, 0, 0, 237, 355, 0, 350, 611,
+ 366, 352, 351, 350, 349, 352, 333, 338, 332, 336, 335, 335, 338, 332, 336, 331, 155, 334, 611, 611, 611,
+ 611, 611, 611, 611, 611, 611, 611, 611, 611, 340, 335, 325, 329, 0, 345, 331,
+
+ 330, 329, 328, 331, 312, 317, 311, 315, 314, 314, 317, 311, 315, 310, 168, 313, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 319, 314, 304, 611, 611, 611, 611, 611, 611, 301, 314, 314, 611, 295,
+ 301, 305, 310, 294, 308, 290, 294, 294, 292, 300, 287, 301, 0, 0, 0, 0, 0, 0, 285, 298, 298,
+ 0, 279, 285, 289, 294, 278, 292, 274, 278, 278, 276, 284, 271, 285, 611, 275, 266, 281, 275, 611, 265,
+ 262, 263, 611, 266, 270, 260, 611, 264, 270, 0, 263, 254, 269, 263, 0, 253,
+
+ 250, 251, 0, 254, 258, 247, 0, 249, 255, 253, 611, 247, 611, 611, 611, 611, 249, 611, 234, 611, 611,
+ 245, 0, 233, 0, 0, 0, 0, 234, 0, 222, 0, 0, 611, 207, 611, 611, 0, 186, 0, 0, 611,
+ 0, 611, 106, 275};
+
+static const flex_int16_t yy_def[547] = {
+ 0, 544, 1, 544, 3, 544, 544, 544, 544, 544, 545, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
+ 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 545, 544, 544, 544, 544, 544,
+ 546, 546, 24, 546, 546, 546, 546, 546, 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 544, 544, 544,
+ 544, 544, 544, 546, 546, 546, 546, 546, 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
+ 544, 544, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544,
+
+ 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 546,
+ 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
+ 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
+ 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 546,
+ 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, 544, 544, 544, 544,
+
+ 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544,
+ 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, 546,
+ 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, 544, 544, 544,
+ 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, 546,
+ 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, 544,
+
+ 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
+ 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
+ 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544,
+ 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
+ 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, 546,
+
+ 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546,
+ 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
+ 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, 546, 546, 546,
+ 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, 544, 544, 544, 544,
+ 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, 546,
+
+ 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
+ 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, 544, 546, 546, 546, 546, 544,
+ 546, 0, 544, 544};
+
+static const flex_int16_t yy_nxt[653] = {
+ 0, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 12, 6, 6, 13, 6, 6, 6,
+ 6, 14, 6, 6, 6, 6, 15, 6, 6, 6, 16, 6, 6, 6, 6, 6, 17, 18, 6, 19, 20,
+ 21, 22, 23, 9, 24, 24, 24, 24, 24, 24, 24, 24, 25, 26, 21, 21, 27, 21, 21, 21, 21,
+ 28, 21, 21, 21, 21, 29, 21, 21, 21, 30, 21, 21, 21, 21, 21, 31, 32, 21, 33, 34, 35,
+ 35, 35, 35, 37, 38, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 44, 44,
+
+ 45, 46, 35, 35, 43, 43, 64, 70, 36, 65, 71, 73, 141, 74, 157, 75, 76, 82, 83, 77, 96,
+ 97, 78, 79, 142, 101, 158, 80, 174, 102, 81, 87, 110, 88, 117, 89, 90, 103, 118, 91, 126, 111,
+ 92, 93, 175, 189, 119, 94, 201, 127, 95, 204, 214, 221, 217, 240, 205, 262, 202, 218, 263, 190, 215,
+ 227, 282, 228, 268, 283, 229, 230, 231, 222, 232, 241, 269, 233, 234, 246, 449, 247, 273, 450, 248, 249,
+ 250, 288, 251, 293, 274, 252, 253, 472, 311, 289, 473, 294, 304, 305, 313, 306,
+
+ 312, 315, 307, 308, 543, 319, 314, 321, 323, 316, 309, 343, 310, 320, 345, 322, 324, 336, 337, 344, 338,
+ 347, 346, 339, 340, 542, 351, 353, 355, 348, 365, 341, 367, 342, 352, 354, 356, 373, 366, 376, 368, 378,
+ 400, 374, 377, 394, 375, 379, 380, 395, 401, 402, 408, 541, 540, 381, 539, 411, 409, 403, 413, 410, 412,
+ 538, 429, 537, 414, 415, 430, 536, 535, 534, 533, 532, 416, 42, 531, 42, 530, 529, 528, 527, 526, 525,
+ 524, 523, 522, 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, 511, 510, 509,
+
+ 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488,
+ 487, 486, 485, 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, 474, 471, 470, 469, 468, 467, 466, 465,
+ 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, 451, 448, 447, 446, 445, 444, 443, 442,
+ 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 428, 427, 426, 425, 424, 423, 422, 421, 420, 419,
+ 418, 417, 407, 406, 405, 404, 399, 398, 397, 396, 393, 392, 391, 390, 389, 388,
+
+ 387, 386, 385, 384, 383, 382, 372, 371, 370, 369, 364, 363, 362, 361, 360, 359, 358, 357, 350, 349, 335,
+ 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 318, 317, 303, 302, 301, 300, 299, 298, 297, 296, 295,
+ 292, 291, 290, 287, 286, 285, 284, 281, 280, 279, 278, 277, 276, 275, 272, 271, 270, 267, 266, 265, 264,
+ 261, 260, 259, 258, 257, 256, 255, 254, 245, 244, 243, 242, 239, 238, 237, 236, 235, 226, 225, 224, 223,
+ 220, 219, 216, 213, 212, 211, 210, 209, 208, 207, 206, 203, 200, 199, 198, 197,
+
+ 196, 195, 194, 193, 192, 191, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 173, 172,
+ 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 156, 155, 154, 153, 152, 151, 150, 149,
+ 148, 147, 146, 145, 144, 143, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 125, 124,
+ 123, 122, 121, 120, 116, 115, 114, 113, 112, 109, 108, 107, 106, 105, 104, 100, 99, 98, 86, 85, 84,
+ 72, 69, 68, 67, 66, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53,
+
+ 52, 51, 50, 49, 48, 47, 41, 40, 39, 544, 5, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
+ 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
+ 544, 544, 544, 544, 544, 544, 544, 544, 544, 544};
+
+static const flex_int16_t yy_chk[653] = {
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
+ 7, 8, 8, 13, 13, 22, 22, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24,
+
+ 27, 27, 35, 35, 43, 43, 54, 59, 545, 54, 59, 62, 109, 62, 125, 62, 62, 63, 63, 62, 69,
+ 69, 62, 62, 109, 74, 125, 62, 142, 74, 62, 68, 81, 68, 88, 68, 68, 74, 88, 68, 95, 81,
+ 68, 68, 142, 158, 88, 68, 173, 95, 68, 175, 188, 196, 190, 209, 175, 224, 173, 190, 224, 158, 188,
+ 201, 243, 201, 230, 243, 201, 201, 202, 196, 202, 209, 230, 202, 202, 214, 380, 214, 234, 380, 214, 214,
+ 215, 249, 215, 253, 234, 215, 215, 415, 265, 249, 415, 253, 264, 264, 266, 264,
+
+ 265, 267, 264, 264, 539, 270, 266, 271, 272, 267, 264, 285, 264, 270, 286, 271, 272, 284, 284, 285, 284,
+ 287, 286, 284, 284, 535, 290, 291, 292, 287, 302, 284, 303, 284, 290, 291, 292, 308, 302, 309, 303, 310,
+ 334, 308, 309, 327, 308, 310, 310, 327, 334, 335, 340, 531, 529, 310, 524, 341, 340, 335, 342, 340, 341,
+ 522, 359, 519, 342, 342, 359, 517, 512, 510, 509, 508, 342, 546, 506, 546, 505, 504, 502, 501, 500, 498,
+ 497, 496, 495, 493, 492, 490, 489, 488, 486, 485, 484, 482, 481, 480, 479, 477,
+
+ 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, 463, 462, 461, 454, 453, 452, 451, 450, 449,
+ 448, 447, 446, 445, 444, 443, 442, 440, 439, 438, 431, 430, 429, 416, 414, 413, 412, 411, 410, 409, 408,
+ 407, 406, 405, 404, 403, 402, 401, 400, 399, 397, 396, 395, 394, 381, 379, 378, 377, 376, 375, 374, 373,
+ 372, 371, 370, 369, 368, 367, 366, 365, 364, 362, 360, 356, 355, 354, 353, 352, 351, 348, 347, 346, 345,
+ 344, 343, 339, 338, 337, 336, 333, 332, 331, 328, 324, 323, 322, 321, 320, 319,
+
+ 316, 315, 314, 313, 312, 311, 307, 306, 305, 304, 301, 300, 299, 297, 296, 295, 294, 293, 289, 288, 283,
+ 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 269, 268, 263, 262, 261, 260, 259, 258, 257, 256, 255,
+ 252, 251, 250, 248, 247, 246, 244, 242, 241, 240, 239, 238, 237, 236, 233, 232, 231, 229, 228, 227, 225,
+ 223, 222, 221, 220, 219, 218, 217, 216, 213, 212, 211, 210, 208, 206, 205, 204, 203, 200, 199, 198, 197,
+ 195, 191, 189, 187, 186, 185, 184, 181, 180, 179, 176, 174, 172, 171, 170, 169,
+
+ 166, 165, 164, 161, 160, 159, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 145, 144, 143, 141, 140,
+ 139, 138, 137, 136, 135, 134, 133, 132, 131, 129, 128, 127, 126, 124, 123, 122, 121, 120, 119, 118, 117,
+ 116, 115, 113, 112, 111, 110, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 94, 93,
+ 92, 91, 90, 89, 87, 85, 84, 83, 82, 80, 79, 78, 77, 76, 75, 73, 71, 70, 67, 65, 64,
+ 61, 58, 57, 56, 55, 53, 52, 51, 50, 49, 48, 47, 46, 45, 41, 40,
+
+ 39, 38, 37, 30, 29, 28, 16, 15, 14, 5, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
+ 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544,
+ 544, 544, 544, 544, 544, 544, 544, 544, 544, 544};
extern int yy_flex_debug;
-int yy_flex_debug = 0;
-
-static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;
-static char *yy_full_match;
-static int yy_lp;
-#define REJECT \
-{ \
-*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \
-yy_cp = (yy_full_match); /* restore poss. backed-over text */ \
-++(yy_lp); \
-goto find_rule; \
-}
+int yy_flex_debug = 0;
+
+static yy_state_type *yy_state_buf = 0, *yy_state_ptr = 0;
+static char * yy_full_match;
+static int yy_lp;
+#define REJECT \
+ { \
+ *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \
+ yy_cp = (yy_full_match); /* restore poss. backed-over text */ \
+ ++(yy_lp); \
+ goto find_rule; \
+ }
-#define yymore() yymore_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
@@ -1122,54 +904,54 @@ char *yytext;
#include "H5LTparse.h"
/* Turn off suggest const & malloc attribute warnings in gcc */
-#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__
+#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__
#pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
-#endif
+#endif
/* Turn off null dereference warnings in gcc.
* We have no control over this generated code.
*/
-#if defined __GNUC__ && 600 <= __GNUC__ * 100
+#if defined __GNUC__ && 600 <= __GNUC__ * 100
#pragma GCC diagnostic ignored "-Wnull-dereference"
#endif
int my_yyinput(char *, int);
#undef YY_INPUT
-#define YY_INPUT(b, r, ms) (r=my_yyinput(b, ms))
-#define token(x) (int)x
-#define hid(x) (hid_t)x
+#define YY_INPUT(b, r, ms) (r = my_yyinput(b, ms))
+#define token(x) (int)x
+#define hid(x) (hid_t) x
-#ifdef YY_BUF_SIZE
-#undef YY_BUF_SIZE
+#ifdef YY_BUF_SIZE
+#undef YY_BUF_SIZE
#endif
-#define YY_BUF_SIZE 262144 /*Define read buffer to be 256K*/
+#define YY_BUF_SIZE 262144 /*Define read buffer to be 256K*/
-extern char *myinput;
+extern char * myinput;
extern size_t input_len;
-#define STACK_SIZE 16
+#define STACK_SIZE 16
/*variables for compound type*/
struct cmpd_info {
- hid_t id;
- hbool_t is_field;
- hbool_t first_memb;
+ hid_t id;
+ hbool_t is_field;
+ hbool_t first_memb;
};
extern struct cmpd_info cmpd_stack[STACK_SIZE];
-extern int csindex;
+extern int csindex;
/*variables for array type*/
struct arr_info {
- hsize_t dims[H5S_MAX_RANK];
- int ndim;
- hbool_t is_dim;
+ hsize_t dims[H5S_MAX_RANK];
+ int ndim;
+ hbool_t is_dim;
};
extern struct arr_info arr_stack[STACK_SIZE];
-extern int asindex;
+extern int asindex;
/*variables for enumerate type*/
-extern hbool_t is_enum;
-extern hbool_t is_enum_memb;
+extern hbool_t is_enum;
+extern hbool_t is_enum_memb;
/*variables for string type*/
extern hbool_t is_str_size;
@@ -1178,49 +960,49 @@ extern hbool_t is_str_size;
extern hbool_t is_opq_size;
extern hbool_t is_opq_tag;
-hbool_t first_quote = 1;
+hbool_t first_quote = 1;
#line 1162 "hl/src/H5LTanalyze.c"
#line 1164 "hl/src/H5LTanalyze.c"
-#define INITIAL 0
+#define INITIAL 0
#define TAG_STRING 1
#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif
-static int yy_init_globals ( void );
+static int yy_init_globals(void);
/* Accessor methods to globals.
These are made visible to non-reentrant scanners for convenience. */
-int yylex_destroy ( void );
+int yylex_destroy(void);
-int yyget_debug ( void );
+int yyget_debug(void);
-void yyset_debug ( int debug_flag );
+void yyset_debug(int debug_flag);
-YY_EXTRA_TYPE yyget_extra ( void );
+YY_EXTRA_TYPE yyget_extra(void);
-void yyset_extra ( YY_EXTRA_TYPE user_defined );
+void yyset_extra(YY_EXTRA_TYPE user_defined);
-FILE *yyget_in ( void );
+FILE *yyget_in(void);
-void yyset_in ( FILE * _in_str );
+void yyset_in(FILE *_in_str);
-FILE *yyget_out ( void );
+FILE *yyget_out(void);
-void yyset_out ( FILE * _out_str );
+void yyset_out(FILE *_out_str);
- int yyget_leng ( void );
+int yyget_leng(void);
-char *yyget_text ( void );
+char *yyget_text(void);
-int yyget_lineno ( void );
+int yyget_lineno(void);
-void yyset_lineno ( int _line_number );
+void yyset_lineno(int _line_number);
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -1228,31 +1010,31 @@ void yyset_lineno ( int _line_number );
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
-extern "C" int yywrap ( void );
+extern "C" int yywrap(void);
#else
-extern int yywrap ( void );
+extern int yywrap(void);
#endif
#endif
#ifndef YY_NO_UNPUT
-
- static void yyunput ( int c, char *buf_ptr );
-
+
+static void yyunput(int c, char *buf_ptr);
+
#endif
#ifndef yytext_ptr
-static void yy_flex_strncpy ( char *, const char *, int );
+static void yy_flex_strncpy(char *, const char *, int);
#endif
#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen ( const char * );
+static int yy_flex_strlen(const char *);
#endif
#ifndef YY_NO_INPUT
#ifdef __cplusplus
-static int yyinput ( void );
+static int yyinput(void);
#else
-static int input ( void );
+static int input(void);
#endif
#endif
@@ -1272,42 +1054,40 @@ static int input ( void );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
+#define ECHO \
+ do { \
+ if (fwrite(yytext, (size_t)yyleng, 1, yyout)) { \
+ } \
+ } while (0)
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
* is returned in "result".
*/
#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
- if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
- { \
- int c = '*'; \
- int n; \
- for ( n = 0; n < max_size && \
- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else \
- { \
- errno=0; \
- while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
- { \
- if( errno != EINTR) \
- { \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- break; \
- } \
- errno=0; \
- clearerr(yyin); \
- } \
- }\
-\
+#define YY_INPUT(buf, result, max_size) \
+ if (YY_CURRENT_BUFFER_LVALUE->yy_is_interactive) { \
+ int c = '*'; \
+ int n; \
+ for (n = 0; n < max_size && (c = getc(yyin)) != EOF && c != '\n'; ++n) \
+ buf[n] = (char)c; \
+ if (c == '\n') \
+ buf[n++] = (char)c; \
+ if (c == EOF && ferror(yyin)) \
+ YY_FATAL_ERROR("input in flex scanner failed"); \
+ result = n; \
+ } \
+ else { \
+ errno = 0; \
+ while ((result = (int)fread(buf, 1, (yy_size_t)max_size, yyin)) == 0 && ferror(yyin)) { \
+ if (errno != EINTR) { \
+ YY_FATAL_ERROR("input in flex scanner failed"); \
+ break; \
+ } \
+ errno = 0; \
+ clearerr(yyin); \
+ } \
+ }
#endif
@@ -1326,7 +1106,7 @@ static int input ( void );
/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#define YY_FATAL_ERROR(msg) yy_fatal_error(msg)
#endif
/* end tables serialization structures and prototypes */
@@ -1337,9 +1117,9 @@ static int input ( void );
#ifndef YY_DECL
#define YY_DECL_IS_OURS 1
-extern int yylex (void);
+extern int yylex(void);
-#define YY_DECL int yylex (void)
+#define YY_DECL int yylex(void)
#endif /* !YY_DECL */
/* Code executed at the beginning of each rule, after yytext and yyleng
@@ -1351,609 +1131,714 @@ extern int yylex (void);
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
-#define YY_BREAK /*LINTED*/break;
+#define YY_BREAK /*LINTED*/ break;
#endif
-#define YY_RULE_SETUP \
- YY_USER_ACTION
+#define YY_RULE_SETUP YY_USER_ACTION
/** The main scanner function which does all the work.
*/
YY_DECL
{
- yy_state_type yy_current_state;
- char *yy_cp, *yy_bp;
- int yy_act;
-
- if ( !(yy_init) )
- {
- (yy_init) = 1;
+ yy_state_type yy_current_state;
+ char * yy_cp, *yy_bp;
+ int yy_act;
+
+ if (!(yy_init)) {
+ (yy_init) = 1;
#ifdef YY_USER_INIT
- YY_USER_INIT;
+ YY_USER_INIT;
#endif
/* Create the reject buffer large enough to save one state per allowed character. */
- if ( ! (yy_state_buf) )
- (yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE );
- if ( ! (yy_state_buf) )
- YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
+ if (!(yy_state_buf))
+ (yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE);
+ if (!(yy_state_buf))
+ YY_FATAL_ERROR("out of dynamic memory in yylex()");
- if ( ! (yy_start) )
- (yy_start) = 1; /* first start state */
+ if (!(yy_start))
+ (yy_start) = 1; /* first start state */
- if ( ! yyin )
- yyin = stdin;
+ if (!yyin)
+ yyin = stdin;
- if ( ! yyout )
- yyout = stdout;
+ if (!yyout)
+ yyout = stdout;
- if ( ! YY_CURRENT_BUFFER ) {
- yyensure_buffer_stack ();
- YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer( yyin, YY_BUF_SIZE );
- }
+ if (!YY_CURRENT_BUFFER) {
+ yyensure_buffer_stack();
+ YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE);
+ }
- yy_load_buffer_state( );
- }
+ yy_load_buffer_state();
+ }
- {
+ {
#line 89 "hl/src/H5LTanalyze.l"
-
#line 1383 "hl/src/H5LTanalyze.c"
- while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
- {
- yy_cp = (yy_c_buf_p);
+ while (/*CONSTCOND*/ 1) /* loops until end-of-file is reached */
+ {
+ yy_cp = (yy_c_buf_p);
- /* Support of yytext. */
- *yy_cp = (yy_hold_char);
+ /* Support of yytext. */
+ *yy_cp = (yy_hold_char);
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
- yy_current_state = (yy_start);
+ yy_current_state = (yy_start);
- (yy_state_ptr) = (yy_state_buf);
- *(yy_state_ptr)++ = yy_current_state;
+ (yy_state_ptr) = (yy_state_buf);
+ *(yy_state_ptr)++ = yy_current_state;
yy_match:
- do
- {
- YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 545 )
- yy_c = yy_meta[yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- *(yy_state_ptr)++ = yy_current_state;
- ++yy_cp;
- }
- while ( yy_base[yy_current_state] != 611 );
+ do {
+ YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
+ yy_current_state = (int)yy_def[yy_current_state];
+ if (yy_current_state >= 545)
+ yy_c = yy_meta[yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+ *(yy_state_ptr)++ = yy_current_state;
+ ++yy_cp;
+ } while (yy_base[yy_current_state] != 611);
yy_find_action:
- yy_current_state = *--(yy_state_ptr);
- (yy_lp) = yy_accept[yy_current_state];
+ yy_current_state = *--(yy_state_ptr);
+ (yy_lp) = yy_accept[yy_current_state];
find_rule: /* we branch to this label when backing up */
- for ( ; ; ) /* until we find what rule we matched */
- {
- if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] )
- {
- yy_act = yy_acclist[(yy_lp)];
- {
- (yy_full_match) = yy_cp;
- break;
- }
- }
- --yy_cp;
- yy_current_state = *--(yy_state_ptr);
- (yy_lp) = yy_accept[yy_current_state];
- }
-
- YY_DO_BEFORE_ACTION;
-
-do_action: /* This label is used only to access EOF actions. */
-
- switch ( yy_act )
- { /* beginning of action switch */
-case 1:
-YY_RULE_SETUP
+ for (;;) /* until we find what rule we matched */
+ {
+ if ((yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1]) {
+ yy_act = yy_acclist[(yy_lp)];
+ {
+ (yy_full_match) = yy_cp;
+ break;
+ }
+ }
+ --yy_cp;
+ yy_current_state = *--(yy_state_ptr);
+ (yy_lp) = yy_accept[yy_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+do_action: /* This label is used only to access EOF actions. */
+
+ switch (yy_act) { /* beginning of action switch */
+ case 1:
+ YY_RULE_SETUP
#line 91 "hl/src/H5LTanalyze.l"
-{return hid(H5T_STD_I8BE_TOKEN);}
- YY_BREAK
-case 2:
-YY_RULE_SETUP
+ {
+ return hid(H5T_STD_I8BE_TOKEN);
+ }
+ YY_BREAK
+ case 2:
+ YY_RULE_SETUP
#line 92 "hl/src/H5LTanalyze.l"
-{return hid(H5T_STD_I8LE_TOKEN);}
- YY_BREAK
-case 3:
-YY_RULE_SETUP
+ {
+ return hid(H5T_STD_I8LE_TOKEN);
+ }
+ YY_BREAK
+ case 3:
+ YY_RULE_SETUP
#line 93 "hl/src/H5LTanalyze.l"
-{return hid(H5T_STD_I16BE_TOKEN);}
- YY_BREAK
-case 4:
-YY_RULE_SETUP
+ {
+ return hid(H5T_STD_I16BE_TOKEN);
+ }
+ YY_BREAK
+ case 4:
+ YY_RULE_SETUP
#line 94 "hl/src/H5LTanalyze.l"
-{return hid(H5T_STD_I16LE_TOKEN);}
- YY_BREAK
-case 5:
-YY_RULE_SETUP
+ {
+ return hid(H5T_STD_I16LE_TOKEN);
+ }
+ YY_BREAK
+ case 5:
+ YY_RULE_SETUP
#line 95 "hl/src/H5LTanalyze.l"
-{return hid(H5T_STD_I32BE_TOKEN);}
- YY_BREAK
-case 6:
-YY_RULE_SETUP
+ {
+ return hid(H5T_STD_I32BE_TOKEN);
+ }
+ YY_BREAK
+ case 6:
+ YY_RULE_SETUP
#line 96 "hl/src/H5LTanalyze.l"
-{return hid(H5T_STD_I32LE_TOKEN);}
- YY_BREAK
-case 7:
-YY_RULE_SETUP
+ {
+ return hid(H5T_STD_I32LE_TOKEN);
+ }
+ YY_BREAK
+ case 7:
+ YY_RULE_SETUP
#line 97 "hl/src/H5LTanalyze.l"
-{return hid(H5T_STD_I64BE_TOKEN);}
- YY_BREAK
-case 8:
-YY_RULE_SETUP
+ {
+ return hid(H5T_STD_I64BE_TOKEN);
+ }
+ YY_BREAK
+ case 8:
+ YY_RULE_SETUP
#line 98 "hl/src/H5LTanalyze.l"
-{return hid(H5T_STD_I64LE_TOKEN);}
- YY_BREAK
-case 9:
-YY_RULE_SETUP
+ {
+ return hid(H5T_STD_I64LE_TOKEN);
+ }
+ YY_BREAK
+ case 9:
+ YY_RULE_SETUP
#line 100 "hl/src/H5LTanalyze.l"
-{return hid(H5T_STD_U8BE_TOKEN);}
- YY_BREAK
-case 10:
-YY_RULE_SETUP
+ {
+ return hid(H5T_STD_U8BE_TOKEN);
+ }
+ YY_BREAK
+ case 10:
+ YY_RULE_SETUP
#line 101 "hl/src/H5LTanalyze.l"
-{return hid(H5T_STD_U8LE_TOKEN);}
- YY_BREAK
-case 11:
-YY_RULE_SETUP
+ {
+ return hid(H5T_STD_U8LE_TOKEN);
+ }
+ YY_BREAK
+ case 11:
+ YY_RULE_SETUP
#line 102 "hl/src/H5LTanalyze.l"
-{return hid(H5T_STD_U16BE_TOKEN);}
- YY_BREAK
-case 12:
-YY_RULE_SETUP
+ {
+ return hid(H5T_STD_U16BE_TOKEN);
+ }
+ YY_BREAK
+ case 12:
+ YY_RULE_SETUP
#line 103 "hl/src/H5LTanalyze.l"
-{return hid(H5T_STD_U16LE_TOKEN);}
- YY_BREAK
-case 13:
-YY_RULE_SETUP
+ {
+ return hid(H5T_STD_U16LE_TOKEN);
+ }
+ YY_BREAK
+ case 13:
+ YY_RULE_SETUP
#line 104 "hl/src/H5LTanalyze.l"
-{return hid(H5T_STD_U32BE_TOKEN);}
- YY_BREAK
-case 14:
-YY_RULE_SETUP
+ {
+ return hid(H5T_STD_U32BE_TOKEN);
+ }
+ YY_BREAK
+ case 14:
+ YY_RULE_SETUP
#line 105 "hl/src/H5LTanalyze.l"
-{return hid(H5T_STD_U32LE_TOKEN);}
- YY_BREAK
-case 15:
-YY_RULE_SETUP
+ {
+ return hid(H5T_STD_U32LE_TOKEN);
+ }
+ YY_BREAK
+ case 15:
+ YY_RULE_SETUP
#line 106 "hl/src/H5LTanalyze.l"
-{return hid(H5T_STD_U64BE_TOKEN);}
- YY_BREAK
-case 16:
-YY_RULE_SETUP
+ {
+ return hid(H5T_STD_U64BE_TOKEN);
+ }
+ YY_BREAK
+ case 16:
+ YY_RULE_SETUP
#line 107 "hl/src/H5LTanalyze.l"
-{return hid(H5T_STD_U64LE_TOKEN);}
- YY_BREAK
-case 17:
-YY_RULE_SETUP
+ {
+ return hid(H5T_STD_U64LE_TOKEN);
+ }
+ YY_BREAK
+ case 17:
+ YY_RULE_SETUP
#line 109 "hl/src/H5LTanalyze.l"
-{return hid(H5T_NATIVE_CHAR_TOKEN);}
- YY_BREAK
-case 18:
-YY_RULE_SETUP
+ {
+ return hid(H5T_NATIVE_CHAR_TOKEN);
+ }
+ YY_BREAK
+ case 18:
+ YY_RULE_SETUP
#line 110 "hl/src/H5LTanalyze.l"
-{return hid(H5T_NATIVE_SCHAR_TOKEN);}
- YY_BREAK
-case 19:
-YY_RULE_SETUP
+ {
+ return hid(H5T_NATIVE_SCHAR_TOKEN);
+ }
+ YY_BREAK
+ case 19:
+ YY_RULE_SETUP
#line 111 "hl/src/H5LTanalyze.l"
-{return hid(H5T_NATIVE_UCHAR_TOKEN);}
- YY_BREAK
-case 20:
-YY_RULE_SETUP
+ {
+ return hid(H5T_NATIVE_UCHAR_TOKEN);
+ }
+ YY_BREAK
+ case 20:
+ YY_RULE_SETUP
#line 112 "hl/src/H5LTanalyze.l"
-{return hid(H5T_NATIVE_SHORT_TOKEN);}
- YY_BREAK
-case 21:
-YY_RULE_SETUP
+ {
+ return hid(H5T_NATIVE_SHORT_TOKEN);
+ }
+ YY_BREAK
+ case 21:
+ YY_RULE_SETUP
#line 113 "hl/src/H5LTanalyze.l"
-{return hid(H5T_NATIVE_USHORT_TOKEN);}
- YY_BREAK
-case 22:
-YY_RULE_SETUP
+ {
+ return hid(H5T_NATIVE_USHORT_TOKEN);
+ }
+ YY_BREAK
+ case 22:
+ YY_RULE_SETUP
#line 114 "hl/src/H5LTanalyze.l"
-{return hid(H5T_NATIVE_INT_TOKEN);}
- YY_BREAK
-case 23:
-YY_RULE_SETUP
+ {
+ return hid(H5T_NATIVE_INT_TOKEN);
+ }
+ YY_BREAK
+ case 23:
+ YY_RULE_SETUP
#line 115 "hl/src/H5LTanalyze.l"
-{return hid(H5T_NATIVE_UINT_TOKEN);}
- YY_BREAK
-case 24:
-YY_RULE_SETUP
+ {
+ return hid(H5T_NATIVE_UINT_TOKEN);
+ }
+ YY_BREAK
+ case 24:
+ YY_RULE_SETUP
#line 116 "hl/src/H5LTanalyze.l"
-{return hid(H5T_NATIVE_LONG_TOKEN);}
- YY_BREAK
-case 25:
-YY_RULE_SETUP
+ {
+ return hid(H5T_NATIVE_LONG_TOKEN);
+ }
+ YY_BREAK
+ case 25:
+ YY_RULE_SETUP
#line 117 "hl/src/H5LTanalyze.l"
-{return hid(H5T_NATIVE_ULONG_TOKEN);}
- YY_BREAK
-case 26:
-YY_RULE_SETUP
+ {
+ return hid(H5T_NATIVE_ULONG_TOKEN);
+ }
+ YY_BREAK
+ case 26:
+ YY_RULE_SETUP
#line 118 "hl/src/H5LTanalyze.l"
-{return hid(H5T_NATIVE_LLONG_TOKEN);}
- YY_BREAK
-case 27:
-YY_RULE_SETUP
+ {
+ return hid(H5T_NATIVE_LLONG_TOKEN);
+ }
+ YY_BREAK
+ case 27:
+ YY_RULE_SETUP
#line 119 "hl/src/H5LTanalyze.l"
-{return hid(H5T_NATIVE_ULLONG_TOKEN);}
- YY_BREAK
-case 28:
-YY_RULE_SETUP
+ {
+ return hid(H5T_NATIVE_ULLONG_TOKEN);
+ }
+ YY_BREAK
+ case 28:
+ YY_RULE_SETUP
#line 121 "hl/src/H5LTanalyze.l"
-{return hid(H5T_IEEE_F32BE_TOKEN);}
- YY_BREAK
-case 29:
-YY_RULE_SETUP
+ {
+ return hid(H5T_IEEE_F32BE_TOKEN);
+ }
+ YY_BREAK
+ case 29:
+ YY_RULE_SETUP
#line 122 "hl/src/H5LTanalyze.l"
-{return hid(H5T_IEEE_F32LE_TOKEN);}
- YY_BREAK
-case 30:
-YY_RULE_SETUP
+ {
+ return hid(H5T_IEEE_F32LE_TOKEN);
+ }
+ YY_BREAK
+ case 30:
+ YY_RULE_SETUP
#line 123 "hl/src/H5LTanalyze.l"
-{return hid(H5T_IEEE_F64BE_TOKEN);}
- YY_BREAK
-case 31:
-YY_RULE_SETUP
+ {
+ return hid(H5T_IEEE_F64BE_TOKEN);
+ }
+ YY_BREAK
+ case 31:
+ YY_RULE_SETUP
#line 124 "hl/src/H5LTanalyze.l"
-{return hid(H5T_IEEE_F64LE_TOKEN);}
- YY_BREAK
-case 32:
-YY_RULE_SETUP
+ {
+ return hid(H5T_IEEE_F64LE_TOKEN);
+ }
+ YY_BREAK
+ case 32:
+ YY_RULE_SETUP
#line 125 "hl/src/H5LTanalyze.l"
-{return hid(H5T_NATIVE_FLOAT_TOKEN);}
- YY_BREAK
-case 33:
-YY_RULE_SETUP
+ {
+ return hid(H5T_NATIVE_FLOAT_TOKEN);
+ }
+ YY_BREAK
+ case 33:
+ YY_RULE_SETUP
#line 126 "hl/src/H5LTanalyze.l"
-{return hid(H5T_NATIVE_DOUBLE_TOKEN);}
- YY_BREAK
-case 34:
-YY_RULE_SETUP
+ {
+ return hid(H5T_NATIVE_DOUBLE_TOKEN);
+ }
+ YY_BREAK
+ case 34:
+ YY_RULE_SETUP
#line 127 "hl/src/H5LTanalyze.l"
-{return hid(H5T_NATIVE_LDOUBLE_TOKEN);}
- YY_BREAK
-case 35:
-YY_RULE_SETUP
+ {
+ return hid(H5T_NATIVE_LDOUBLE_TOKEN);
+ }
+ YY_BREAK
+ case 35:
+ YY_RULE_SETUP
#line 129 "hl/src/H5LTanalyze.l"
-{return token(H5T_STRING_TOKEN);}
- YY_BREAK
-case 36:
-YY_RULE_SETUP
+ {
+ return token(H5T_STRING_TOKEN);
+ }
+ YY_BREAK
+ case 36:
+ YY_RULE_SETUP
#line 130 "hl/src/H5LTanalyze.l"
-{return token(STRSIZE_TOKEN);}
- YY_BREAK
-case 37:
-YY_RULE_SETUP
+ {
+ return token(STRSIZE_TOKEN);
+ }
+ YY_BREAK
+ case 37:
+ YY_RULE_SETUP
#line 131 "hl/src/H5LTanalyze.l"
-{return token(STRPAD_TOKEN);}
- YY_BREAK
-case 38:
-YY_RULE_SETUP
+ {
+ return token(STRPAD_TOKEN);
+ }
+ YY_BREAK
+ case 38:
+ YY_RULE_SETUP
#line 132 "hl/src/H5LTanalyze.l"
-{return token(CSET_TOKEN);}
- YY_BREAK
-case 39:
-YY_RULE_SETUP
+ {
+ return token(CSET_TOKEN);
+ }
+ YY_BREAK
+ case 39:
+ YY_RULE_SETUP
#line 133 "hl/src/H5LTanalyze.l"
-{return token(CTYPE_TOKEN);}
- YY_BREAK
-case 40:
-YY_RULE_SETUP
+ {
+ return token(CTYPE_TOKEN);
+ }
+ YY_BREAK
+ case 40:
+ YY_RULE_SETUP
#line 134 "hl/src/H5LTanalyze.l"
-{return token(H5T_STR_NULLTERM_TOKEN);}
- YY_BREAK
-case 41:
-YY_RULE_SETUP
+ {
+ return token(H5T_STR_NULLTERM_TOKEN);
+ }
+ YY_BREAK
+ case 41:
+ YY_RULE_SETUP
#line 135 "hl/src/H5LTanalyze.l"
-{return token(H5T_STR_NULLPAD_TOKEN);}
- YY_BREAK
-case 42:
-YY_RULE_SETUP
+ {
+ return token(H5T_STR_NULLPAD_TOKEN);
+ }
+ YY_BREAK
+ case 42:
+ YY_RULE_SETUP
#line 136 "hl/src/H5LTanalyze.l"
-{return token(H5T_STR_SPACEPAD_TOKEN);}
- YY_BREAK
-case 43:
-YY_RULE_SETUP
+ {
+ return token(H5T_STR_SPACEPAD_TOKEN);
+ }
+ YY_BREAK
+ case 43:
+ YY_RULE_SETUP
#line 137 "hl/src/H5LTanalyze.l"
-{return token(H5T_CSET_ASCII_TOKEN);}
- YY_BREAK
-case 44:
-YY_RULE_SETUP
+ {
+ return token(H5T_CSET_ASCII_TOKEN);
+ }
+ YY_BREAK
+ case 44:
+ YY_RULE_SETUP
#line 138 "hl/src/H5LTanalyze.l"
-{return token(H5T_CSET_UTF8_TOKEN);}
- YY_BREAK
-case 45:
-YY_RULE_SETUP
+ {
+ return token(H5T_CSET_UTF8_TOKEN);
+ }
+ YY_BREAK
+ case 45:
+ YY_RULE_SETUP
#line 139 "hl/src/H5LTanalyze.l"
-{return token(H5T_C_S1_TOKEN);}
- YY_BREAK
-case 46:
-YY_RULE_SETUP
+ {
+ return token(H5T_C_S1_TOKEN);
+ }
+ YY_BREAK
+ case 46:
+ YY_RULE_SETUP
#line 140 "hl/src/H5LTanalyze.l"
-{return token(H5T_FORTRAN_S1_TOKEN);}
- YY_BREAK
-case 47:
-YY_RULE_SETUP
+ {
+ return token(H5T_FORTRAN_S1_TOKEN);
+ }
+ YY_BREAK
+ case 47:
+ YY_RULE_SETUP
#line 141 "hl/src/H5LTanalyze.l"
-{return token(H5T_VARIABLE_TOKEN);}
- YY_BREAK
-case 48:
-YY_RULE_SETUP
+ {
+ return token(H5T_VARIABLE_TOKEN);
+ }
+ YY_BREAK
+ case 48:
+ YY_RULE_SETUP
#line 143 "hl/src/H5LTanalyze.l"
-{return token(H5T_COMPOUND_TOKEN);}
- YY_BREAK
-case 49:
-YY_RULE_SETUP
+ {
+ return token(H5T_COMPOUND_TOKEN);
+ }
+ YY_BREAK
+ case 49:
+ YY_RULE_SETUP
#line 144 "hl/src/H5LTanalyze.l"
-{return token(H5T_ENUM_TOKEN);}
- YY_BREAK
-case 50:
-YY_RULE_SETUP
+ {
+ return token(H5T_ENUM_TOKEN);
+ }
+ YY_BREAK
+ case 50:
+ YY_RULE_SETUP
#line 145 "hl/src/H5LTanalyze.l"
-{return token(H5T_ARRAY_TOKEN);}
- YY_BREAK
-case 51:
-YY_RULE_SETUP
+ {
+ return token(H5T_ARRAY_TOKEN);
+ }
+ YY_BREAK
+ case 51:
+ YY_RULE_SETUP
#line 146 "hl/src/H5LTanalyze.l"
-{return token(H5T_VLEN_TOKEN);}
- YY_BREAK
-case 52:
-YY_RULE_SETUP
+ {
+ return token(H5T_VLEN_TOKEN);
+ }
+ YY_BREAK
+ case 52:
+ YY_RULE_SETUP
#line 148 "hl/src/H5LTanalyze.l"
-{return token(H5T_OPAQUE_TOKEN);}
- YY_BREAK
-case 53:
-YY_RULE_SETUP
+ {
+ return token(H5T_OPAQUE_TOKEN);
+ }
+ YY_BREAK
+ case 53:
+ YY_RULE_SETUP
#line 149 "hl/src/H5LTanalyze.l"
-{return token(OPQ_SIZE_TOKEN);}
- YY_BREAK
-case 54:
-YY_RULE_SETUP
+ {
+ return token(OPQ_SIZE_TOKEN);
+ }
+ YY_BREAK
+ case 54:
+ YY_RULE_SETUP
#line 150 "hl/src/H5LTanalyze.l"
-{return token(OPQ_TAG_TOKEN);}
- YY_BREAK
-case 55:
-YY_RULE_SETUP
+ {
+ return token(OPQ_TAG_TOKEN);
+ }
+ YY_BREAK
+ case 55:
+ YY_RULE_SETUP
#line 152 "hl/src/H5LTanalyze.l"
-{
- if( is_str_size || (is_enum && is_enum_memb) ||
- is_opq_size || (asindex>-1 && arr_stack[asindex].is_dim) ||
- (csindex>-1 && cmpd_stack[csindex].is_field) ) {
+ {
+ if (is_str_size || (is_enum && is_enum_memb) || is_opq_size ||
+ (asindex > -1 && arr_stack[asindex].is_dim) ||
+ (csindex > -1 && cmpd_stack[csindex].is_field)) {
H5LTyylval.ival = atoi(yytext);
- return NUMBER;
- } else
+ return NUMBER;
+ }
+ else
REJECT;
- }
- YY_BREAK
-case 56:
-YY_RULE_SETUP
+ }
+ YY_BREAK
+ case 56:
+ YY_RULE_SETUP
#line 162 "hl/src/H5LTanalyze.l"
-{
- /*if it's first quote, and is a compound field name or an enum symbol*/
- if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field))
- && first_quote) {
- first_quote = 0;
- BEGIN TAG_STRING;
- } else /*if it's second quote*/
- first_quote = 1;
- return token('"');
- }
- YY_BREAK
-case 57:
-/* rule 57 can match eol */
-YY_RULE_SETUP
+ {
+ /*if it's first quote, and is a compound field name or an enum symbol*/
+ if ((is_opq_tag || is_enum || (csindex > -1 && cmpd_stack[csindex].is_field)) &&
+ first_quote) {
+ first_quote = 0;
+ BEGIN TAG_STRING;
+ }
+ else /*if it's second quote*/
+ first_quote = 1;
+ return token('"');
+ }
+ YY_BREAK
+ case 57:
+ /* rule 57 can match eol */
+ YY_RULE_SETUP
#line 172 "hl/src/H5LTanalyze.l"
-{
+ {
#ifdef H5_HAVE_WIN32_API
- H5LTyylval.sval = _strdup(yytext);
-#else /* H5_HAVE_WIN32_API */
- H5LTyylval.sval = strdup(yytext);
-#endif /* H5_HAVE_WIN32_API */
- BEGIN INITIAL;
- return STRING;
- }
- YY_BREAK
-case 58:
-YY_RULE_SETUP
+ H5LTyylval.sval = _strdup(yytext);
+#else /* H5_HAVE_WIN32_API */
+ H5LTyylval.sval = strdup(yytext);
+#endif /* H5_HAVE_WIN32_API */
+ BEGIN INITIAL;
+ return STRING;
+ }
+ YY_BREAK
+ case 58:
+ YY_RULE_SETUP
#line 182 "hl/src/H5LTanalyze.l"
-{return token('{');}
- YY_BREAK
-case 59:
-YY_RULE_SETUP
+ {
+ return token('{');
+ }
+ YY_BREAK
+ case 59:
+ YY_RULE_SETUP
#line 183 "hl/src/H5LTanalyze.l"
-{return token('}');}
- YY_BREAK
-case 60:
-YY_RULE_SETUP
+ {
+ return token('}');
+ }
+ YY_BREAK
+ case 60:
+ YY_RULE_SETUP
#line 184 "hl/src/H5LTanalyze.l"
-{return token('[');}
- YY_BREAK
-case 61:
-YY_RULE_SETUP
+ {
+ return token('[');
+ }
+ YY_BREAK
+ case 61:
+ YY_RULE_SETUP
#line 185 "hl/src/H5LTanalyze.l"
-{return token(']');}
- YY_BREAK
-case 62:
-YY_RULE_SETUP
+ {
+ return token(']');
+ }
+ YY_BREAK
+ case 62:
+ YY_RULE_SETUP
#line 186 "hl/src/H5LTanalyze.l"
-{return token(':');}
- YY_BREAK
-case 63:
-YY_RULE_SETUP
+ {
+ return token(':');
+ }
+ YY_BREAK
+ case 63:
+ YY_RULE_SETUP
#line 187 "hl/src/H5LTanalyze.l"
-{return token(';');}
- YY_BREAK
-case 64:
-/* rule 64 can match eol */
-YY_RULE_SETUP
+ {
+ return token(';');
+ }
+ YY_BREAK
+ case 64:
+ /* rule 64 can match eol */
+ YY_RULE_SETUP
#line 188 "hl/src/H5LTanalyze.l"
-;
- YY_BREAK
-case 65:
-/* rule 65 can match eol */
-YY_RULE_SETUP
+ ;
+ YY_BREAK
+ case 65:
+ /* rule 65 can match eol */
+ YY_RULE_SETUP
#line 189 "hl/src/H5LTanalyze.l"
-{ return 0; }
- YY_BREAK
-case 66:
-YY_RULE_SETUP
+ {
+ return 0;
+ }
+ YY_BREAK
+ case 66:
+ YY_RULE_SETUP
#line 191 "hl/src/H5LTanalyze.l"
-ECHO;
- YY_BREAK
+ ECHO;
+ YY_BREAK
#line 1803 "hl/src/H5LTanalyze.c"
- case YY_STATE_EOF(INITIAL):
- case YY_STATE_EOF(TAG_STRING):
- yyterminate();
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = (yy_hold_char);
- YY_RESTORE_YY_MORE_OFFSET
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * yylex(). If so, then we have to assure
- * consistency between YY_CURRENT_BUFFER and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( );
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state );
-
- yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++(yy_c_buf_p);
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
- yy_cp = (yy_c_buf_p);
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer( ) )
- {
- case EOB_ACT_END_OF_FILE:
- {
- (yy_did_buffer_switch_on_eof) = 0;
-
- if ( yywrap( ) )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! (yy_did_buffer_switch_on_eof) )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- (yy_c_buf_p) =
- (yytext_ptr) + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( );
-
- yy_cp = (yy_c_buf_p);
- yy_bp = (yytext_ptr) + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- (yy_c_buf_p) =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
-
- yy_current_state = yy_get_previous_state( );
-
- yy_cp = (yy_c_buf_p);
- yy_bp = (yytext_ptr) + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
- } /* end of user's declarations */
+ case YY_STATE_EOF(INITIAL):
+ case YY_STATE_EOF(TAG_STRING):
+ yyterminate();
+
+ case YY_END_OF_BUFFER: {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int)(yy_cp - (yytext_ptr)) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = (yy_hold_char);
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW) {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between YY_CURRENT_BUFFER and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ((yy_c_buf_p) <=
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state();
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans(yy_current_state);
+
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+ if (yy_next_state) {
+ /* Consume the NUL. */
+ yy_cp = ++(yy_c_buf_p);
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else {
+ yy_cp = (yy_c_buf_p);
+ goto yy_find_action;
+ }
+ }
+
+ else
+ switch (yy_get_next_buffer()) {
+ case EOB_ACT_END_OF_FILE: {
+ (yy_did_buffer_switch_on_eof) = 0;
+
+ if (yywrap()) {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else {
+ if (!(yy_did_buffer_switch_on_eof))
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state();
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+ yy_current_state = yy_get_previous_state();
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR("fatal flex scanner internal error--no action found");
+ } /* end of action switch */
+ } /* end of scanning one token */
+ } /* end of user's declarations */
} /* end of yylex */
/* yy_get_next_buffer - try to read in a new buffer
@@ -1963,138 +1848,125 @@ ECHO;
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
* EOB_ACT_END_OF_FILE - end of file
*/
-static int yy_get_next_buffer (void)
+static int
+yy_get_next_buffer(void)
{
- char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- char *source = (yytext_ptr);
- int number_to_move, i;
- int ret_val;
-
- if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
-
- else
- {
- int num_to_read =
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-
- YY_FATAL_ERROR(
-"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
-
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- (yy_n_chars), num_to_read );
-
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
- }
-
- if ( (yy_n_chars) == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- yyrestart( yyin );
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
- /* Extend the array by 50%, plus the number we really need. */
- int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
- (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
- if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
- /* "- 2" to take care of EOB's */
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
- }
-
- (yy_n_chars) += number_to_move;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
-
- (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
-
- return ret_val;
+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ char *source = (yytext_ptr);
+ int number_to_move, i;
+ int ret_val;
+
+ if ((yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1])
+ YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed");
+
+ if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer ==
+ 0) { /* Don't try to fill the buffer, so this is an EOF. */
+ if ((yy_c_buf_p) - (yytext_ptr)-YY_MORE_ADJ == 1) {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int)((yy_c_buf_p) - (yytext_ptr)-1);
+
+ for (i = 0; i < number_to_move; ++i)
+ *(dest++) = *(source++);
+
+ if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING)
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+ else {
+ int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+ while (num_to_read <= 0) { /* Not enough room in the buffer - grow it. */
+
+ YY_FATAL_ERROR("input buffer overflow, can't enlarge buffer because scanner uses REJECT");
+ }
+
+ if (num_to_read > YY_READ_BUF_SIZE)
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read);
+
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ if ((yy_n_chars) == 0) {
+ if (number_to_move == YY_MORE_ADJ) {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart(yyin);
+ }
+
+ else {
+ ret_val = EOB_ACT_LAST_MATCH;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ /* Extend the array by 50%, plus the number we really need. */
+ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf =
+ (char *)yyrealloc((void *)YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t)new_size);
+ if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf)
+ YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()");
+ /* "- 2" to take care of EOB's */
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int)(new_size - 2);
+ }
+
+ (yy_n_chars) += number_to_move;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+ (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+ return ret_val;
}
/* yy_get_previous_state - get the state just before the EOB char was reached */
- static yy_state_type yy_get_previous_state (void)
+static yy_state_type
+yy_get_previous_state(void)
{
- yy_state_type yy_current_state;
- char *yy_cp;
-
- yy_current_state = (yy_start);
-
- (yy_state_ptr) = (yy_state_buf);
- *(yy_state_ptr)++ = yy_current_state;
-
- for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
- {
- YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 545 )
- yy_c = yy_meta[yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- *(yy_state_ptr)++ = yy_current_state;
- }
-
- return yy_current_state;
+ yy_state_type yy_current_state;
+ char * yy_cp;
+
+ yy_current_state = (yy_start);
+
+ (yy_state_ptr) = (yy_state_buf);
+ *(yy_state_ptr)++ = yy_current_state;
+
+ for (yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp) {
+ YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
+ yy_current_state = (int)yy_def[yy_current_state];
+ if (yy_current_state >= 545)
+ yy_c = yy_meta[yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+ *(yy_state_ptr)++ = yy_current_state;
+ }
+
+ return yy_current_state;
}
/* yy_try_NUL_trans - try to make a transition on the NUL character
@@ -2102,617 +1974,627 @@ static int yy_get_next_buffer (void)
* synopsis
* next_state = yy_try_NUL_trans( current_state );
*/
- static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
+static yy_state_type
+yy_try_NUL_trans(yy_state_type yy_current_state)
{
- int yy_is_jam;
-
- YY_CHAR yy_c = 1;
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 545 )
- yy_c = yy_meta[yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- yy_is_jam = (yy_current_state == 544);
- if ( ! yy_is_jam )
- *(yy_state_ptr)++ = yy_current_state;
-
- return yy_is_jam ? 0 : yy_current_state;
+ int yy_is_jam;
+
+ YY_CHAR yy_c = 1;
+ while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
+ yy_current_state = (int)yy_def[yy_current_state];
+ if (yy_current_state >= 545)
+ yy_c = yy_meta[yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+ yy_is_jam = (yy_current_state == 544);
+ if (!yy_is_jam)
+ *(yy_state_ptr)++ = yy_current_state;
+
+ return yy_is_jam ? 0 : yy_current_state;
}
#ifndef YY_NO_UNPUT
- static void yyunput (int c, char * yy_bp )
+static void
+yyunput(int c, char *yy_bp)
{
- char *yy_cp;
-
+ char *yy_cp;
+
yy_cp = (yy_c_buf_p);
- /* undo effects of setting up yytext */
- *yy_cp = (yy_hold_char);
+ /* undo effects of setting up yytext */
+ *yy_cp = (yy_hold_char);
- if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
- { /* need to shift things up to make room */
- /* +2 for EOB chars. */
- int number_to_move = (yy_n_chars) + 2;
- char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
- char *source =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+ if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2) { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ int number_to_move = (yy_n_chars) + 2;
+ char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+ char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
- while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
- *--dest = *--source;
+ while (source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf)
+ *--dest = *--source;
- yy_cp += (int) (dest - source);
- yy_bp += (int) (dest - source);
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
- (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+ yy_cp += (int)(dest - source);
+ yy_bp += (int)(dest - source);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = (int)YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
- if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
- YY_FATAL_ERROR( "flex scanner push-back overflow" );
- }
+ if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2)
+ YY_FATAL_ERROR("flex scanner push-back overflow");
+ }
- *--yy_cp = (char) c;
+ *--yy_cp = (char)c;
- (yytext_ptr) = yy_bp;
- (yy_hold_char) = *yy_cp;
- (yy_c_buf_p) = yy_cp;
+ (yytext_ptr) = yy_bp;
+ (yy_hold_char) = *yy_cp;
+ (yy_c_buf_p) = yy_cp;
}
#endif
#ifndef YY_NO_INPUT
#ifdef __cplusplus
- static int yyinput (void)
+static int
+yyinput(void)
#else
- static int input (void)
+static int
+input(void)
#endif
{
- int c;
-
- *(yy_c_buf_p) = (yy_hold_char);
-
- if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
- /* This was really a NUL. */
- *(yy_c_buf_p) = '\0';
-
- else
- { /* need more input */
- int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
- ++(yy_c_buf_p);
-
- switch ( yy_get_next_buffer( ) )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- yyrestart( yyin );
-
- /*FALLTHROUGH*/
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap( ) )
- return 0;
-
- if ( ! (yy_did_buffer_switch_on_eof) )
- YY_NEW_FILE;
+ int c;
+
+ *(yy_c_buf_p) = (yy_hold_char);
+
+ if (*(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR) {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ((yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)])
+ /* This was really a NUL. */
+ *(yy_c_buf_p) = '\0';
+
+ else { /* need more input */
+ int offset = (int)((yy_c_buf_p) - (yytext_ptr));
+ ++(yy_c_buf_p);
+
+ switch (yy_get_next_buffer()) {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart(yyin);
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE: {
+ if (yywrap())
+ return 0;
+
+ if (!(yy_did_buffer_switch_on_eof))
+ YY_NEW_FILE;
#ifdef __cplusplus
- return yyinput();
+ return yyinput();
#else
- return input();
+ return input();
#endif
- }
+ }
- case EOB_ACT_CONTINUE_SCAN:
- (yy_c_buf_p) = (yytext_ptr) + offset;
- break;
- }
- }
- }
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) = (yytext_ptr) + offset;
+ break;
+ }
+ }
+ }
- c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
- *(yy_c_buf_p) = '\0'; /* preserve yytext */
- (yy_hold_char) = *++(yy_c_buf_p);
+ c = *(unsigned char *)(yy_c_buf_p); /* cast for 8-bit char's */
+ *(yy_c_buf_p) = '\0'; /* preserve yytext */
+ (yy_hold_char) = *++(yy_c_buf_p);
- return c;
+ return c;
}
-#endif /* ifndef YY_NO_INPUT */
+#endif /* ifndef YY_NO_INPUT */
/** Immediately switch to a different input stream.
* @param input_file A readable stream.
- *
+ *
* @note This function does not reset the start condition to @c INITIAL .
*/
- void yyrestart (FILE * input_file )
+void
+yyrestart(FILE *input_file)
{
-
- if ( ! YY_CURRENT_BUFFER ){
- yyensure_buffer_stack ();
- YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer( yyin, YY_BUF_SIZE );
- }
-
- yy_init_buffer( YY_CURRENT_BUFFER, input_file );
- yy_load_buffer_state( );
+
+ if (!YY_CURRENT_BUFFER) {
+ yyensure_buffer_stack();
+ YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE);
+ }
+
+ yy_init_buffer(YY_CURRENT_BUFFER, input_file);
+ yy_load_buffer_state();
}
/** Switch to a different input buffer.
* @param new_buffer The new input buffer.
- *
+ *
*/
- void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
+void
+yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)
{
-
- /* TODO. We should be able to replace this entire function body
- * with
- * yypop_buffer_state();
- * yypush_buffer_state(new_buffer);
+
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * yypop_buffer_state();
+ * yypush_buffer_state(new_buffer);
+ */
+ yyensure_buffer_stack();
+ if (YY_CURRENT_BUFFER == new_buffer)
+ return;
+
+ if (YY_CURRENT_BUFFER) {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+ yy_load_buffer_state();
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
*/
- yyensure_buffer_stack ();
- if ( YY_CURRENT_BUFFER == new_buffer )
- return;
-
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *(yy_c_buf_p) = (yy_hold_char);
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
- }
-
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
- yy_load_buffer_state( );
-
- /* We don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- (yy_did_buffer_switch_on_eof) = 1;
+ (yy_did_buffer_switch_on_eof) = 1;
}
-static void yy_load_buffer_state (void)
+static void
+yy_load_buffer_state(void)
{
- (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
- yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
- (yy_hold_char) = *(yy_c_buf_p);
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+ (yy_hold_char) = *(yy_c_buf_p);
}
/** Allocate and initialize an input buffer state.
* @param file A readable stream.
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- *
+ *
* @return the allocated buffer state.
*/
- YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
+YY_BUFFER_STATE
+yy_create_buffer(FILE *file, int size)
{
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+ YY_BUFFER_STATE b;
- b->yy_buf_size = size;
+ b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state));
+ if (!b)
+ YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+ b->yy_buf_size = size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *)yyalloc((yy_size_t)(b->yy_buf_size + 2));
+ if (!b->yy_ch_buf)
+ YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
- b->yy_is_our_buffer = 1;
+ b->yy_is_our_buffer = 1;
- yy_init_buffer( b, file );
+ yy_init_buffer(b, file);
- return b;
+ return b;
}
/** Destroy the buffer.
* @param b a buffer created with yy_create_buffer()
- *
+ *
*/
- void yy_delete_buffer (YY_BUFFER_STATE b )
+void
+yy_delete_buffer(YY_BUFFER_STATE b)
{
-
- if ( ! b )
- return;
- if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
- YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+ if (!b)
+ return;
+
+ if (b == YY_CURRENT_BUFFER) /* Not sure if we should pop here. */
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE)0;
- if ( b->yy_is_our_buffer )
- yyfree( (void *) b->yy_ch_buf );
+ if (b->yy_is_our_buffer)
+ yyfree((void *)b->yy_ch_buf);
- yyfree( (void *) b );
+ yyfree((void *)b);
}
/* Initializes or reinitializes a buffer.
* This function is sometimes called more than once on the same buffer,
* such as during a yyrestart() or at EOF.
*/
- static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
+static void
+yy_init_buffer(YY_BUFFER_STATE b, FILE *file)
{
- int oerrno = errno;
-
- yy_flush_buffer( b );
+ int oerrno = errno;
+
+ yy_flush_buffer(b);
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
/* If b is the current buffer, then yy_init_buffer was _probably_
* called from yyrestart() or through yy_get_next_buffer.
* In that case, we don't want to reset the lineno or column.
*/
- if (b != YY_CURRENT_BUFFER){
+ if (b != YY_CURRENT_BUFFER) {
b->yy_bs_lineno = 1;
b->yy_bs_column = 0;
}
- b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-
- errno = oerrno;
+ b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0;
+
+ errno = oerrno;
}
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- *
+ *
*/
- void yy_flush_buffer (YY_BUFFER_STATE b )
+void
+yy_flush_buffer(YY_BUFFER_STATE b)
{
- if ( ! b )
- return;
+ if (!b)
+ return;
- b->yy_n_chars = 0;
+ b->yy_n_chars = 0;
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
- b->yy_buf_pos = &b->yy_ch_buf[0];
+ b->yy_buf_pos = &b->yy_ch_buf[0];
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
- if ( b == YY_CURRENT_BUFFER )
- yy_load_buffer_state( );
+ if (b == YY_CURRENT_BUFFER)
+ yy_load_buffer_state();
}
/** Pushes the new state onto the stack. The new state becomes
* the current state. This function will allocate the stack
* if necessary.
* @param new_buffer The new state.
- *
+ *
*/
-void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
+void
+yypush_buffer_state(YY_BUFFER_STATE new_buffer)
{
- if (new_buffer == NULL)
- return;
-
- yyensure_buffer_stack();
-
- /* This block is copied from yy_switch_to_buffer. */
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *(yy_c_buf_p) = (yy_hold_char);
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
- }
-
- /* Only push if top exists. Otherwise, replace top. */
- if (YY_CURRENT_BUFFER)
- (yy_buffer_stack_top)++;
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
-
- /* copied from yy_switch_to_buffer. */
- yy_load_buffer_state( );
- (yy_did_buffer_switch_on_eof) = 1;
+ if (new_buffer == NULL)
+ return;
+
+ yyensure_buffer_stack();
+
+ /* This block is copied from yy_switch_to_buffer. */
+ if (YY_CURRENT_BUFFER) {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ /* Only push if top exists. Otherwise, replace top. */
+ if (YY_CURRENT_BUFFER)
+ (yy_buffer_stack_top)++;
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+ /* copied from yy_switch_to_buffer. */
+ yy_load_buffer_state();
+ (yy_did_buffer_switch_on_eof) = 1;
}
/** Removes and deletes the top of the stack, if present.
* The next element becomes the new top.
- *
+ *
*/
-void yypop_buffer_state (void)
+void
+yypop_buffer_state(void)
{
- if (!YY_CURRENT_BUFFER)
- return;
-
- yy_delete_buffer(YY_CURRENT_BUFFER );
- YY_CURRENT_BUFFER_LVALUE = NULL;
- if ((yy_buffer_stack_top) > 0)
- --(yy_buffer_stack_top);
-
- if (YY_CURRENT_BUFFER) {
- yy_load_buffer_state( );
- (yy_did_buffer_switch_on_eof) = 1;
- }
+ if (!YY_CURRENT_BUFFER)
+ return;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER);
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ if ((yy_buffer_stack_top) > 0)
+ --(yy_buffer_stack_top);
+
+ if (YY_CURRENT_BUFFER) {
+ yy_load_buffer_state();
+ (yy_did_buffer_switch_on_eof) = 1;
+ }
}
/* Allocates the stack if it does not exist.
* Guarantees space for at least one push.
*/
-static void yyensure_buffer_stack (void)
+static void
+yyensure_buffer_stack(void)
{
- yy_size_t num_to_alloc;
-
- if (!(yy_buffer_stack)) {
+ yy_size_t num_to_alloc;
+
+ if (!(yy_buffer_stack)) {
- /* First allocation is just for 2 elements, since we don't know if this
- * scanner will even need a stack. We use 2 instead of 1 to avoid an
- * immediate realloc on the next call.
+ /* First allocation is just for 2 elements, since we don't know if this
+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
+ * immediate realloc on the next call.
*/
- num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
- (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
- (num_to_alloc * sizeof(struct yy_buffer_state*)
- );
- if ( ! (yy_buffer_stack) )
- YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
-
- memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
- (yy_buffer_stack_max) = num_to_alloc;
- (yy_buffer_stack_top) = 0;
- return;
- }
-
- if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
-
- /* Increase the buffer to prepare for a possible push. */
- yy_size_t grow_size = 8 /* arbitrary grow size */;
-
- num_to_alloc = (yy_buffer_stack_max) + grow_size;
- (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
- ((yy_buffer_stack),
- num_to_alloc * sizeof(struct yy_buffer_state*)
- );
- if ( ! (yy_buffer_stack) )
- YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
-
- /* zero only the new slots.*/
- memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
- (yy_buffer_stack_max) = num_to_alloc;
- }
+ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
+ (yy_buffer_stack) =
+ (struct yy_buffer_state **)yyalloc(num_to_alloc * sizeof(struct yy_buffer_state *));
+ if (!(yy_buffer_stack))
+ YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()");
+
+ memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state *));
+
+ (yy_buffer_stack_max) = num_to_alloc;
+ (yy_buffer_stack_top) = 0;
+ return;
+ }
+
+ if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1) {
+
+ /* Increase the buffer to prepare for a possible push. */
+ yy_size_t grow_size = 8 /* arbitrary grow size */;
+
+ num_to_alloc = (yy_buffer_stack_max) + grow_size;
+ (yy_buffer_stack) = (struct yy_buffer_state **)yyrealloc(
+ (yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state *));
+ if (!(yy_buffer_stack))
+ YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()");
+
+ /* zero only the new slots.*/
+ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state *));
+ (yy_buffer_stack_max) = num_to_alloc;
+ }
}
/** Setup the input buffer state to scan directly from a user-specified character buffer.
* @param base the character buffer
* @param size the size in bytes of the character buffer
- *
+ *
* @return the newly allocated buffer state object.
*/
-YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
+YY_BUFFER_STATE
+yy_scan_buffer(char *base, yy_size_t size)
{
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return NULL;
-
- b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
-
- b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = NULL;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- yy_switch_to_buffer( b );
-
- return b;
+ YY_BUFFER_STATE b;
+
+ if (size < 2 || base[size - 2] != YY_END_OF_BUFFER_CHAR || base[size - 1] != YY_END_OF_BUFFER_CHAR)
+ /* They forgot to leave room for the EOB's. */
+ return NULL;
+
+ b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state));
+ if (!b)
+ YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()");
+
+ b->yy_buf_size = (int)(size - 2); /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = NULL;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ yy_switch_to_buffer(b);
+
+ return b;
}
/** Setup the input buffer state to scan a string. The next call to yylex() will
* scan from a @e copy of @a str.
* @param yystr a NUL-terminated string to scan
- *
+ *
* @return the newly allocated buffer state object.
* @note If you want to scan bytes that may contain NUL values, then use
* yy_scan_bytes() instead.
*/
-YY_BUFFER_STATE yy_scan_string (const char * yystr )
+YY_BUFFER_STATE
+yy_scan_string(const char *yystr)
{
-
- return yy_scan_bytes( yystr, (int) strlen(yystr) );
+
+ return yy_scan_bytes(yystr, (int)strlen(yystr));
}
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
* scan from a @e copy of @a bytes.
* @param yybytes the byte buffer to scan
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
- *
+ *
* @return the newly allocated buffer state object.
*/
-YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
+YY_BUFFER_STATE
+yy_scan_bytes(const char *yybytes, int _yybytes_len)
{
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- int i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = (yy_size_t) (_yybytes_len + 2);
- buf = (char *) yyalloc( n );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
-
- for ( i = 0; i < _yybytes_len; ++i )
- buf[i] = yybytes[i];
-
- buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = yy_scan_buffer( buf, n );
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
+ YY_BUFFER_STATE b;
+ char * buf;
+ yy_size_t n;
+ int i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = (yy_size_t)(_yybytes_len + 2);
+ buf = (char *)yyalloc(n);
+ if (!buf)
+ YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()");
+
+ for (i = 0; i < _yybytes_len; ++i)
+ buf[i] = yybytes[i];
+
+ buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer(buf, n);
+ if (!b)
+ YY_FATAL_ERROR("bad buffer in yy_scan_bytes()");
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
}
#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif
-static void yynoreturn yy_fatal_error (const char* msg )
+static void yynoreturn
+yy_fatal_error(const char *msg)
{
- fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
+ fprintf(stderr, "%s\n", msg);
+ exit(YY_EXIT_FAILURE);
}
/* Redefine yyless() so it works in section 3 code. */
#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- int yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- yytext[yyleng] = (yy_hold_char); \
- (yy_c_buf_p) = yytext + yyless_macro_arg; \
- (yy_hold_char) = *(yy_c_buf_p); \
- *(yy_c_buf_p) = '\0'; \
- yyleng = yyless_macro_arg; \
- } \
- while ( 0 )
+#define yyless(n) \
+ do { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg); \
+ yytext[yyleng] = (yy_hold_char); \
+ (yy_c_buf_p) = yytext + yyless_macro_arg; \
+ (yy_hold_char) = *(yy_c_buf_p); \
+ *(yy_c_buf_p) = '\0'; \
+ yyleng = yyless_macro_arg; \
+ } while (0)
/* Accessor methods (get/set functions) to struct members. */
/** Get the current line number.
- *
+ *
*/
-int yyget_lineno (void)
+int
+yyget_lineno(void)
{
-
+
return yylineno;
}
/** Get the input stream.
- *
+ *
*/
-FILE *yyget_in (void)
+FILE *
+yyget_in(void)
{
- return yyin;
+ return yyin;
}
/** Get the output stream.
- *
+ *
*/
-FILE *yyget_out (void)
+FILE *
+yyget_out(void)
{
- return yyout;
+ return yyout;
}
/** Get the length of the current token.
- *
+ *
*/
-int yyget_leng (void)
+int
+yyget_leng(void)
{
- return yyleng;
+ return yyleng;
}
/** Get the current token.
- *
+ *
*/
-char *yyget_text (void)
+char *
+yyget_text(void)
{
- return yytext;
+ return yytext;
}
/** Set the current line number.
* @param _line_number line number
- *
+ *
*/
-void yyset_lineno (int _line_number )
+void
+yyset_lineno(int _line_number)
{
-
+
yylineno = _line_number;
}
/** Set the input stream. This does not discard the current
* input buffer.
* @param _in_str A readable stream.
- *
+ *
* @see yy_switch_to_buffer
*/
-void yyset_in (FILE * _in_str )
+void
+yyset_in(FILE *_in_str)
{
- yyin = _in_str ;
+ yyin = _in_str;
}
-void yyset_out (FILE * _out_str )
+void
+yyset_out(FILE *_out_str)
{
- yyout = _out_str ;
+ yyout = _out_str;
}
-int yyget_debug (void)
+int
+yyget_debug(void)
{
- return yy_flex_debug;
+ return yy_flex_debug;
}
-void yyset_debug (int _bdebug )
+void
+yyset_debug(int _bdebug)
{
- yy_flex_debug = _bdebug ;
+ yy_flex_debug = _bdebug;
}
-static int yy_init_globals (void)
+static int
+yy_init_globals(void)
{
- /* Initialization is the same as for the non-reentrant scanner.
+ /* Initialization is the same as for the non-reentrant scanner.
* This function is called from yylex_destroy(), so don't allocate here.
*/
- (yy_buffer_stack) = NULL;
+ (yy_buffer_stack) = NULL;
(yy_buffer_stack_top) = 0;
(yy_buffer_stack_max) = 0;
- (yy_c_buf_p) = NULL;
- (yy_init) = 0;
- (yy_start) = 0;
+ (yy_c_buf_p) = NULL;
+ (yy_init) = 0;
+ (yy_start) = 0;
- (yy_state_buf) = 0;
- (yy_state_ptr) = 0;
+ (yy_state_buf) = 0;
+ (yy_state_ptr) = 0;
(yy_full_match) = 0;
- (yy_lp) = 0;
+ (yy_lp) = 0;
/* Defined in main.c */
#ifdef YY_STDINIT
- yyin = stdin;
+ yyin = stdin;
yyout = stdout;
#else
yyin = NULL;
@@ -2726,26 +2608,27 @@ static int yy_init_globals (void)
}
/* yylex_destroy is for both reentrant and non-reentrant scanners. */
-int yylex_destroy (void)
+int
+yylex_destroy(void)
{
-
+
/* Pop the buffer stack, destroying each element. */
- while(YY_CURRENT_BUFFER){
- yy_delete_buffer( YY_CURRENT_BUFFER );
- YY_CURRENT_BUFFER_LVALUE = NULL;
- yypop_buffer_state();
- }
+ while (YY_CURRENT_BUFFER) {
+ yy_delete_buffer(YY_CURRENT_BUFFER);
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ yypop_buffer_state();
+ }
- /* Destroy the stack itself. */
- yyfree((yy_buffer_stack) );
- (yy_buffer_stack) = NULL;
+ /* Destroy the stack itself. */
+ yyfree((yy_buffer_stack));
+ (yy_buffer_stack) = NULL;
- yyfree ( (yy_state_buf) );
- (yy_state_buf) = NULL;
+ yyfree((yy_state_buf));
+ (yy_state_buf) = NULL;
/* Reset the globals. This is important in a non-reentrant scanner so the next time
* yylex() is called, initialization will occur. */
- yy_init_globals( );
+ yy_init_globals();
return 0;
}
@@ -2755,70 +2638,77 @@ int yylex_destroy (void)
*/
#ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, const char * s2, int n )
+static void
+yy_flex_strncpy(char *s1, const char *s2, int n)
{
-
- int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
+
+ int i;
+ for (i = 0; i < n; ++i)
+ s1[i] = s2[i];
}
#endif
#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (const char * s )
+static int
+yy_flex_strlen(const char *s)
{
- int n;
- for ( n = 0; s[n]; ++n )
- ;
+ int n;
+ for (n = 0; s[n]; ++n)
+ ;
- return n;
+ return n;
}
#endif
-void *yyalloc (yy_size_t size )
+void *
+yyalloc(yy_size_t size)
{
- return malloc(size);
+ return malloc(size);
}
-void *yyrealloc (void * ptr, yy_size_t size )
+void *
+yyrealloc(void *ptr, yy_size_t size)
{
-
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return realloc(ptr, size);
+
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return realloc(ptr, size);
}
-void yyfree (void * ptr )
+void
+yyfree(void *ptr)
{
- free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
+ free((char *)ptr); /* see yyrealloc() for (char *) cast */
}
#define YYTABLES_NAME "yytables"
#line 191 "hl/src/H5LTanalyze.l"
-int my_yyinput(char *buf, int max_size)
+int
+my_yyinput(char *buf, int max_size)
{
- int ret;
-
- memcpy(buf, myinput, input_len);
- ret = (int)input_len;
- return ret;
+ int ret;
+
+ memcpy(buf, myinput, input_len);
+ ret = (int)input_len;
+ return ret;
}
-int H5LTyyerror(const char *msg)
+int
+H5LTyyerror(const char *msg)
{
- printf("ERROR: %s before \"%s\".\n", msg, yytext);
- return 0;
+ printf("ERROR: %s before \"%s\".\n", msg, yytext);
+ return 0;
}
-int yywrap()
+int
+yywrap()
{
- return(1);
+ return (1);
}
-
diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c
index a9b3dc3..291c89d 100644
--- a/hl/src/H5LTparse.c
+++ b/hl/src/H5LTparse.c
@@ -1,25 +1,25 @@
-#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__
-#pragma GCC diagnostic ignored "-Wconversion"
-#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
-#pragma GCC diagnostic ignored "-Wlarger-than="
-#pragma GCC diagnostic ignored "-Wmissing-prototypes"
-#pragma GCC diagnostic ignored "-Wnested-externs"
-#pragma GCC diagnostic ignored "-Wold-style-definition"
-#pragma GCC diagnostic ignored "-Wredundant-decls"
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#pragma GCC diagnostic ignored "-Wsign-conversion"
-#pragma GCC diagnostic ignored "-Wstrict-overflow"
-#pragma GCC diagnostic ignored "-Wstrict-prototypes"
-#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
-#pragma GCC diagnostic ignored "-Wswitch-default"
-#pragma GCC diagnostic ignored "-Wunused-function"
-#pragma GCC diagnostic ignored "-Wunused-macros"
-#pragma GCC diagnostic ignored "-Wunused-parameter"
-#elif defined __SUNPRO_CC
-#pragma disable_warn
-#elif defined _MSC_VER
-#pragma warning(push, 1)
-#endif
+#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
+#pragma GCC diagnostic ignored "-Wlarger-than="
+#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+#pragma GCC diagnostic ignored "-Wnested-externs"
+#pragma GCC diagnostic ignored "-Wold-style-definition"
+#pragma GCC diagnostic ignored "-Wredundant-decls"
+#pragma GCC diagnostic ignored "-Wsign-compare"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#pragma GCC diagnostic ignored "-Wstrict-overflow"
+#pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
+#pragma GCC diagnostic ignored "-Wswitch-default"
+#pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic ignored "-Wunused-macros"
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#elif defined __SUNPRO_CC
+#pragma disable_warn
+#elif defined _MSC_VER
+#pragma warning(push, 1)
+#endif
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison implementation for Yacc-like parsers in C
@@ -80,16 +80,15 @@
/* Pull parsers. */
#define YYPULL 1
-
/* Substitute the variable and function names. */
-#define yyparse H5LTyyparse
-#define yylex H5LTyylex
-#define yyerror H5LTyyerror
-#define yydebug H5LTyydebug
-#define yynerrs H5LTyynerrs
+#define yyparse H5LTyyparse
+#define yylex H5LTyylex
+#define yyerror H5LTyyerror
+#define yydebug H5LTyydebug
+#define yynerrs H5LTyynerrs
-#define yylval H5LTyylval
-#define yychar H5LTyychar
+#define yylval H5LTyylval
+#define yychar H5LTyychar
/* Copy the first part of user declarations. */
#line 20 "hl/src/H5LTparse.y" /* yacc.c:339 */
@@ -101,75 +100,72 @@
extern int yylex();
extern int yyerror(const char *);
-#define STACK_SIZE 16
+#define STACK_SIZE 16
/*structure for compound type information*/
struct cmpd_info {
- hid_t id; /*type ID*/
- hbool_t is_field; /*flag to lexer for compound member*/
- hbool_t first_memb; /*flag for first compound member*/
+ hid_t id; /*type ID*/
+ hbool_t is_field; /*flag to lexer for compound member*/
+ hbool_t first_memb; /*flag for first compound member*/
};
/*stack for nested compound type*/
-struct cmpd_info cmpd_stack[STACK_SIZE] = {
- {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1},
- {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1},
- {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1},
- {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1} };
+struct cmpd_info cmpd_stack[STACK_SIZE] = {{0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1},
+ {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1},
+ {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}};
-int csindex = -1; /*pointer to the top of compound stack*/
+int csindex = -1; /*pointer to the top of compound stack*/
/*structure for array type information*/
struct arr_info {
- hsize_t dims[H5S_MAX_RANK]; /*size of each dimension, limited to 32 dimensions*/
- unsigned ndims; /*number of dimensions*/
- hbool_t is_dim; /*flag to lexer for dimension*/
+ hsize_t dims[H5S_MAX_RANK]; /*size of each dimension, limited to 32 dimensions*/
+ unsigned ndims; /*number of dimensions*/
+ hbool_t is_dim; /*flag to lexer for dimension*/
};
/*stack for nested array type*/
struct arr_info arr_stack[STACK_SIZE];
-int asindex = -1; /*pointer to the top of array stack*/
+int asindex = -1; /*pointer to the top of array stack*/
-hbool_t is_str_size = 0; /*flag to lexer for string size*/
-hbool_t is_str_pad = 0; /*flag to lexer for string padding*/
-H5T_str_t str_pad; /*variable for string padding*/
-H5T_cset_t str_cset; /*variable for string character set*/
-hbool_t is_variable = 0; /*variable for variable-length string*/
-size_t str_size; /*variable for string size*/
-
-hid_t enum_id; /*type ID*/
-hbool_t is_enum = 0; /*flag to lexer for enum type*/
-hbool_t is_enum_memb = 0; /*flag to lexer for enum member*/
-char* enum_memb_symbol; /*enum member symbol string*/
+hbool_t is_str_size = 0; /*flag to lexer for string size*/
+hbool_t is_str_pad = 0; /*flag to lexer for string padding*/
+H5T_str_t str_pad; /*variable for string padding*/
+H5T_cset_t str_cset; /*variable for string character set*/
+hbool_t is_variable = 0; /*variable for variable-length string*/
+size_t str_size; /*variable for string size*/
-hbool_t is_opq_size = 0; /*flag to lexer for opaque type size*/
-hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/
+hid_t enum_id; /*type ID*/
+hbool_t is_enum = 0; /*flag to lexer for enum type*/
+hbool_t is_enum_memb = 0; /*flag to lexer for enum member*/
+char * enum_memb_symbol; /*enum member symbol string*/
+hbool_t is_opq_size = 0; /*flag to lexer for opaque type size*/
+hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/
#line 127 "hl/src/H5LTparse.c" /* yacc.c:339 */
-# ifndef YY_NULLPTR
-# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
-# else
-# define YY_NULLPTR 0
-# endif
-# endif
+#ifndef YY_NULLPTR
+#if defined __cplusplus && 201103L <= __cplusplus
+#define YY_NULLPTR nullptr
+#else
+#define YY_NULLPTR 0
+#endif
+#endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
+#undef YYERROR_VERBOSE
+#define YYERROR_VERBOSE 1
#else
-# define YYERROR_VERBOSE 0
+#define YYERROR_VERBOSE 0
#endif
/* In a future release of Bison, this section will be replaced
by #include "H5LTparse.h". */
#ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED
-# define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED
+#define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
-# define YYDEBUG 0
+#define YYDEBUG 0
#endif
#if YYDEBUG
extern int H5LTyydebug;
@@ -177,91 +173,88 @@ extern int H5LTyydebug;
/* Token type. */
#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- enum yytokentype
- {
- H5T_STD_I8BE_TOKEN = 258,
- H5T_STD_I8LE_TOKEN = 259,
- H5T_STD_I16BE_TOKEN = 260,
- H5T_STD_I16LE_TOKEN = 261,
- H5T_STD_I32BE_TOKEN = 262,
- H5T_STD_I32LE_TOKEN = 263,
- H5T_STD_I64BE_TOKEN = 264,
- H5T_STD_I64LE_TOKEN = 265,
- H5T_STD_U8BE_TOKEN = 266,
- H5T_STD_U8LE_TOKEN = 267,
- H5T_STD_U16BE_TOKEN = 268,
- H5T_STD_U16LE_TOKEN = 269,
- H5T_STD_U32BE_TOKEN = 270,
- H5T_STD_U32LE_TOKEN = 271,
- H5T_STD_U64BE_TOKEN = 272,
- H5T_STD_U64LE_TOKEN = 273,
- H5T_NATIVE_CHAR_TOKEN = 274,
- H5T_NATIVE_SCHAR_TOKEN = 275,
- H5T_NATIVE_UCHAR_TOKEN = 276,
- H5T_NATIVE_SHORT_TOKEN = 277,
- H5T_NATIVE_USHORT_TOKEN = 278,
- H5T_NATIVE_INT_TOKEN = 279,
- H5T_NATIVE_UINT_TOKEN = 280,
- H5T_NATIVE_LONG_TOKEN = 281,
- H5T_NATIVE_ULONG_TOKEN = 282,
- H5T_NATIVE_LLONG_TOKEN = 283,
- H5T_NATIVE_ULLONG_TOKEN = 284,
- H5T_IEEE_F32BE_TOKEN = 285,
- H5T_IEEE_F32LE_TOKEN = 286,
- H5T_IEEE_F64BE_TOKEN = 287,
- H5T_IEEE_F64LE_TOKEN = 288,
- H5T_NATIVE_FLOAT_TOKEN = 289,
- H5T_NATIVE_DOUBLE_TOKEN = 290,
+#define YYTOKENTYPE
+enum yytokentype {
+ H5T_STD_I8BE_TOKEN = 258,
+ H5T_STD_I8LE_TOKEN = 259,
+ H5T_STD_I16BE_TOKEN = 260,
+ H5T_STD_I16LE_TOKEN = 261,
+ H5T_STD_I32BE_TOKEN = 262,
+ H5T_STD_I32LE_TOKEN = 263,
+ H5T_STD_I64BE_TOKEN = 264,
+ H5T_STD_I64LE_TOKEN = 265,
+ H5T_STD_U8BE_TOKEN = 266,
+ H5T_STD_U8LE_TOKEN = 267,
+ H5T_STD_U16BE_TOKEN = 268,
+ H5T_STD_U16LE_TOKEN = 269,
+ H5T_STD_U32BE_TOKEN = 270,
+ H5T_STD_U32LE_TOKEN = 271,
+ H5T_STD_U64BE_TOKEN = 272,
+ H5T_STD_U64LE_TOKEN = 273,
+ H5T_NATIVE_CHAR_TOKEN = 274,
+ H5T_NATIVE_SCHAR_TOKEN = 275,
+ H5T_NATIVE_UCHAR_TOKEN = 276,
+ H5T_NATIVE_SHORT_TOKEN = 277,
+ H5T_NATIVE_USHORT_TOKEN = 278,
+ H5T_NATIVE_INT_TOKEN = 279,
+ H5T_NATIVE_UINT_TOKEN = 280,
+ H5T_NATIVE_LONG_TOKEN = 281,
+ H5T_NATIVE_ULONG_TOKEN = 282,
+ H5T_NATIVE_LLONG_TOKEN = 283,
+ H5T_NATIVE_ULLONG_TOKEN = 284,
+ H5T_IEEE_F32BE_TOKEN = 285,
+ H5T_IEEE_F32LE_TOKEN = 286,
+ H5T_IEEE_F64BE_TOKEN = 287,
+ H5T_IEEE_F64LE_TOKEN = 288,
+ H5T_NATIVE_FLOAT_TOKEN = 289,
+ H5T_NATIVE_DOUBLE_TOKEN = 290,
H5T_NATIVE_LDOUBLE_TOKEN = 291,
- H5T_STRING_TOKEN = 292,
- STRSIZE_TOKEN = 293,
- STRPAD_TOKEN = 294,
- CSET_TOKEN = 295,
- CTYPE_TOKEN = 296,
- H5T_VARIABLE_TOKEN = 297,
- H5T_STR_NULLTERM_TOKEN = 298,
- H5T_STR_NULLPAD_TOKEN = 299,
- H5T_STR_SPACEPAD_TOKEN = 300,
- H5T_CSET_ASCII_TOKEN = 301,
- H5T_CSET_UTF8_TOKEN = 302,
- H5T_C_S1_TOKEN = 303,
- H5T_FORTRAN_S1_TOKEN = 304,
- H5T_OPAQUE_TOKEN = 305,
- OPQ_SIZE_TOKEN = 306,
- OPQ_TAG_TOKEN = 307,
- H5T_COMPOUND_TOKEN = 308,
- H5T_ENUM_TOKEN = 309,
- H5T_ARRAY_TOKEN = 310,
- H5T_VLEN_TOKEN = 311,
- STRING = 312,
- NUMBER = 313
- };
+ H5T_STRING_TOKEN = 292,
+ STRSIZE_TOKEN = 293,
+ STRPAD_TOKEN = 294,
+ CSET_TOKEN = 295,
+ CTYPE_TOKEN = 296,
+ H5T_VARIABLE_TOKEN = 297,
+ H5T_STR_NULLTERM_TOKEN = 298,
+ H5T_STR_NULLPAD_TOKEN = 299,
+ H5T_STR_SPACEPAD_TOKEN = 300,
+ H5T_CSET_ASCII_TOKEN = 301,
+ H5T_CSET_UTF8_TOKEN = 302,
+ H5T_C_S1_TOKEN = 303,
+ H5T_FORTRAN_S1_TOKEN = 304,
+ H5T_OPAQUE_TOKEN = 305,
+ OPQ_SIZE_TOKEN = 306,
+ OPQ_TAG_TOKEN = 307,
+ H5T_COMPOUND_TOKEN = 308,
+ H5T_ENUM_TOKEN = 309,
+ H5T_ARRAY_TOKEN = 310,
+ H5T_VLEN_TOKEN = 311,
+ STRING = 312,
+ NUMBER = 313
+};
#endif
/* Value type. */
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+#if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED
-union YYSTYPE
-{
+union YYSTYPE {
#line 72 "hl/src/H5LTparse.y" /* yacc.c:355 */
- int ival; /*for integer token*/
- char *sval; /*for name string*/
- hid_t hid; /*for hid_t token*/
+ int ival; /*for integer token*/
+ char *sval; /*for name string*/
+ hid_t hid; /*for hid_t token*/
#line 232 "hl/src/H5LTparse.c" /* yacc.c:355 */
};
typedef union YYSTYPE YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define YYSTYPE_IS_DECLARED 1
+#define YYSTYPE_IS_TRIVIAL 1
+#define YYSTYPE_IS_DECLARED 1
#endif
-
extern YYSTYPE H5LTyylval;
-hid_t H5LTyyparse (void);
+hid_t H5LTyyparse(void);
#endif /* !YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED */
@@ -270,19 +263,19 @@ hid_t H5LTyyparse (void);
#line 249 "hl/src/H5LTparse.c" /* yacc.c:358 */
#ifdef short
-# undef short
+#undef short
#endif
#ifdef YYTYPE_UINT8
typedef YYTYPE_UINT8 yytype_uint8;
#else
-typedef unsigned char yytype_uint8;
+typedef unsigned char yytype_uint8;
#endif
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
#else
-typedef signed char yytype_int8;
+typedef signed char yytype_int8;
#endif
#ifdef YYTYPE_UINT16
@@ -294,623 +287,558 @@ typedef unsigned short int yytype_uint16;
#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
-typedef short int yytype_int16;
+typedef short int yytype_int16;
#endif
#ifndef YYSIZE_T
-# ifdef __SIZE_TYPE__
-# define YYSIZE_T __SIZE_TYPE__
-# elif defined size_t
-# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# else
-# define YYSIZE_T unsigned int
-# endif
+#ifdef __SIZE_TYPE__
+#define YYSIZE_T __SIZE_TYPE__
+#elif defined size_t
+#define YYSIZE_T size_t
+#elif !defined YYSIZE_T
+#include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#define YYSIZE_T size_t
+#else
+#define YYSIZE_T unsigned int
+#endif
#endif
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+#define YYSIZE_MAXIMUM ((YYSIZE_T)-1)
#ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
-# if ENABLE_NLS
-# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
-# endif
-# endif
-# ifndef YY_
-# define YY_(Msgid) Msgid
-# endif
+#if defined YYENABLE_NLS && YYENABLE_NLS
+#if ENABLE_NLS
+#include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+#define YY_(Msgid) dgettext("bison-runtime", Msgid)
+#endif
+#endif
+#ifndef YY_
+#define YY_(Msgid) Msgid
+#endif
#endif
#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__ \
- && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
- || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
-# else
-# define YY_ATTRIBUTE(Spec) /* empty */
-# endif
+#if (defined __GNUC__ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) || \
+ defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+#define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+#else
+#define YY_ATTRIBUTE(Spec) /* empty */
+#endif
#endif
#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
+#define YY_ATTRIBUTE_PURE YY_ATTRIBUTE((__pure__))
#endif
#ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE((__unused__))
#endif
-#if !defined _Noreturn \
- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-# define _Noreturn __declspec (noreturn)
-# else
-# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
+#if !defined _Noreturn && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+#if defined _MSC_VER && 1200 <= _MSC_VER
+#define _Noreturn __declspec(noreturn)
+#else
+#define _Noreturn YY_ATTRIBUTE((__noreturn__))
+#endif
#endif
/* Suppress unused-variable warnings by "using" E. */
-#if ! defined lint || defined __GNUC__
-# define YYUSE(E) ((void) (E))
+#if !defined lint || defined __GNUC__
+#define YYUSE(E) ((void)(E))
#else
-# define YYUSE(E) /* empty */
+#define YYUSE(E) /* empty */
#endif
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
- _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
- _Pragma ("GCC diagnostic pop")
+#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \
+ _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+#define YY_IGNORE_MAYBE_UNINITIALIZED_END _Pragma("GCC diagnostic pop")
#else
-# define YY_INITIAL_VALUE(Value) Value
+#define YY_INITIAL_VALUE(Value) Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+#define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
-
-#if ! defined yyoverflow || YYERROR_VERBOSE
+#if !defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
-# ifdef YYSTACK_USE_ALLOCA
-# if YYSTACK_USE_ALLOCA
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# elif defined __BUILTIN_VA_ARG_INCR
-# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
-# elif defined _AIX
-# define YYSTACK_ALLOC __alloca
-# elif defined _MSC_VER
-# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
-# define alloca _alloca
-# else
-# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
- /* Use EXIT_SUCCESS as a witness for stdlib.h. */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# endif
-# endif
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
- /* Pacify GCC's 'empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-# ifndef YYSTACK_ALLOC_MAXIMUM
- /* The OS might guarantee only one guard page at the bottom of the stack,
- and a page size can be as small as 4096 bytes. So we cannot safely
- invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
- to allow for a few compiler-allocated temporary stack slots. */
-# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
-# endif
-# else
-# define YYSTACK_ALLOC YYMALLOC
-# define YYSTACK_FREE YYFREE
-# ifndef YYSTACK_ALLOC_MAXIMUM
-# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
-# endif
-# if (defined __cplusplus && ! defined EXIT_SUCCESS \
- && ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# endif
-# endif
-# ifndef YYMALLOC
-# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# ifndef YYFREE
-# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS
-void free (void *); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+#ifdef YYSTACK_USE_ALLOCA
+#if YYSTACK_USE_ALLOCA
+#ifdef __GNUC__
+#define YYSTACK_ALLOC __builtin_alloca
+#elif defined __BUILTIN_VA_ARG_INCR
+#include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+#elif defined _AIX
+#define YYSTACK_ALLOC __alloca
+#elif defined _MSC_VER
+#include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+#define alloca _alloca
+#else
+#define YYSTACK_ALLOC alloca
+#if !defined _ALLOCA_H && !defined EXIT_SUCCESS
+#include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+/* Use EXIT_SUCCESS as a witness for stdlib.h. */
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
+#endif
+#endif
+#endif
+#endif
+#endif
+#ifdef YYSTACK_ALLOC
+/* Pacify GCC's 'empty if-body' warning. */
+#define YYSTACK_FREE(Ptr) \
+ do { /* empty */ \
+ ; \
+ } while (0)
+#ifndef YYSTACK_ALLOC_MAXIMUM
+/* The OS might guarantee only one guard page at the bottom of the stack,
+ and a page size can be as small as 4096 bytes. So we cannot safely
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
+ to allow for a few compiler-allocated temporary stack slots. */
+#define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+#endif
+#else
+#define YYSTACK_ALLOC YYMALLOC
+#define YYSTACK_FREE YYFREE
+#ifndef YYSTACK_ALLOC_MAXIMUM
+#define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+#endif
+#if (defined __cplusplus && !defined EXIT_SUCCESS && \
+ !((defined YYMALLOC || defined malloc) && (defined YYFREE || defined free)))
+#include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
+#endif
+#endif
+#ifndef YYMALLOC
+#define YYMALLOC malloc
+#if !defined malloc && !defined EXIT_SUCCESS
+void *malloc(YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+#endif
+#endif
+#ifndef YYFREE
+#define YYFREE free
+#if !defined free && !defined EXIT_SUCCESS
+void free(void *); /* INFRINGES ON USER NAME SPACE */
+#endif
+#endif
+#endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-#if (! defined yyoverflow \
- && (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+#if (!defined yyoverflow && (!defined __cplusplus || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
-union yyalloc
-{
- yytype_int16 yyss_alloc;
- YYSTYPE yyvs_alloc;
+union yyalloc {
+ yytype_int16 yyss_alloc;
+ YYSTYPE yyvs_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+#define YYSTACK_GAP_MAXIMUM (sizeof(union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
- + YYSTACK_GAP_MAXIMUM)
+#define YYSTACK_BYTES(N) ((N) * (sizeof(yytype_int16) + sizeof(YYSTYPE)) + YYSTACK_GAP_MAXIMUM)
-# define YYCOPY_NEEDED 1
+#define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (0)
+#define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY(&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * sizeof(*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof(*yyptr); \
+ } while (0)
#endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from SRC to DST. The source and destination do
not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(Dst, Src, Count) \
- __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
-# else
-# define YYCOPY(Dst, Src, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (Dst)[yyi] = (Src)[yyi]; \
- } \
- while (0)
-# endif
-# endif
+#ifndef YYCOPY
+#if defined __GNUC__ && 1 < __GNUC__
+#define YYCOPY(Dst, Src, Count) __builtin_memcpy(Dst, Src, (Count) * sizeof(*(Src)))
+#else
+#define YYCOPY(Dst, Src, Count) \
+ do { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (Dst)[yyi] = (Src)[yyi]; \
+ } while (0)
+#endif
+#endif
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 58
+#define YYFINAL 58
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 203
+#define YYLAST 203
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 66
+#define YYNTOKENS 66
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 46
+#define YYNNTS 46
/* YYNRULES -- Number of rules. */
-#define YYNRULES 95
+#define YYNRULES 95
/* YYNSTATES -- Number of states. */
-#define YYNSTATES 143
+#define YYNSTATES 143
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
-#define YYUNDEFTOK 2
-#define YYMAXUTOK 313
+#define YYUNDEFTOK 2
+#define YYMAXUTOK 313
-#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+#define YYTRANSLATE(YYX) ((unsigned int)(YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, without out-of-bounds checking. */
-static const yytype_uint8 yytranslate[] =
-{
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 63, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 64, 65,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 61, 2, 62, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 59, 2, 60, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58
-};
+static const yytype_uint8 yytranslate[] = {
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 63, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 64, 65, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 61, 2, 62, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 59, 2,
+ 60, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58};
#if YYDEBUG
- /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
-static const yytype_uint16 yyrline[] =
-{
- 0, 105, 105, 106, 108, 109, 110, 111, 113, 114,
- 115, 116, 117, 120, 121, 122, 123, 124, 125, 126,
- 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
- 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
- 149, 150, 151, 152, 153, 154, 155, 159, 158, 167,
- 168, 170, 170, 207, 215, 216, 219, 221, 221, 230,
- 231, 233, 234, 233, 241, 244, 250, 251, 256, 257,
- 248, 265, 267, 271, 272, 280, 289, 296, 269, 320,
- 321, 323, 324, 325, 327, 328, 330, 331, 335, 334,
- 339, 340, 342, 342, 396, 398
-};
+/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+static const yytype_uint16 yyrline[] = {
+ 0, 105, 105, 106, 108, 109, 110, 111, 113, 114, 115, 116, 117, 120, 121, 122, 123, 124, 125, 126,
+ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
+ 149, 150, 151, 152, 153, 154, 155, 159, 158, 167, 168, 170, 170, 207, 215, 216, 219, 221, 221, 230,
+ 231, 233, 234, 233, 241, 244, 250, 251, 256, 257, 248, 265, 267, 271, 272, 280, 289, 296, 269, 320,
+ 321, 323, 324, 325, 327, 328, 330, 331, 335, 334, 339, 340, 342, 342, 396, 398};
#endif
#if YYDEBUG || YYERROR_VERBOSE || 0
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
-static const char *const yytname[] =
-{
- "$end", "error", "$undefined", "H5T_STD_I8BE_TOKEN",
- "H5T_STD_I8LE_TOKEN", "H5T_STD_I16BE_TOKEN", "H5T_STD_I16LE_TOKEN",
- "H5T_STD_I32BE_TOKEN", "H5T_STD_I32LE_TOKEN", "H5T_STD_I64BE_TOKEN",
- "H5T_STD_I64LE_TOKEN", "H5T_STD_U8BE_TOKEN", "H5T_STD_U8LE_TOKEN",
- "H5T_STD_U16BE_TOKEN", "H5T_STD_U16LE_TOKEN", "H5T_STD_U32BE_TOKEN",
- "H5T_STD_U32LE_TOKEN", "H5T_STD_U64BE_TOKEN", "H5T_STD_U64LE_TOKEN",
- "H5T_NATIVE_CHAR_TOKEN", "H5T_NATIVE_SCHAR_TOKEN",
- "H5T_NATIVE_UCHAR_TOKEN", "H5T_NATIVE_SHORT_TOKEN",
- "H5T_NATIVE_USHORT_TOKEN", "H5T_NATIVE_INT_TOKEN",
- "H5T_NATIVE_UINT_TOKEN", "H5T_NATIVE_LONG_TOKEN",
- "H5T_NATIVE_ULONG_TOKEN", "H5T_NATIVE_LLONG_TOKEN",
- "H5T_NATIVE_ULLONG_TOKEN", "H5T_IEEE_F32BE_TOKEN",
- "H5T_IEEE_F32LE_TOKEN", "H5T_IEEE_F64BE_TOKEN", "H5T_IEEE_F64LE_TOKEN",
- "H5T_NATIVE_FLOAT_TOKEN", "H5T_NATIVE_DOUBLE_TOKEN",
- "H5T_NATIVE_LDOUBLE_TOKEN", "H5T_STRING_TOKEN", "STRSIZE_TOKEN",
- "STRPAD_TOKEN", "CSET_TOKEN", "CTYPE_TOKEN", "H5T_VARIABLE_TOKEN",
- "H5T_STR_NULLTERM_TOKEN", "H5T_STR_NULLPAD_TOKEN",
- "H5T_STR_SPACEPAD_TOKEN", "H5T_CSET_ASCII_TOKEN", "H5T_CSET_UTF8_TOKEN",
- "H5T_C_S1_TOKEN", "H5T_FORTRAN_S1_TOKEN", "H5T_OPAQUE_TOKEN",
- "OPQ_SIZE_TOKEN", "OPQ_TAG_TOKEN", "H5T_COMPOUND_TOKEN",
- "H5T_ENUM_TOKEN", "H5T_ARRAY_TOKEN", "H5T_VLEN_TOKEN", "STRING",
- "NUMBER", "'{'", "'}'", "'['", "']'", "'\"'", "':'", "';'", "$accept",
- "start", "ddl_type", "atomic_type", "integer_type", "fp_type",
- "compound_type", "$@1", "memb_list", "memb_def", "$@2", "field_name",
- "field_offset", "offset", "array_type", "$@3", "dim_list", "dim", "$@4",
- "$@5", "dimsize", "vlen_type", "opaque_type", "$@6", "@7", "$@8", "$@9",
- "opaque_size", "opaque_tag", "string_type", "$@10", "$@11", "$@12",
- "$@13", "@14", "strsize", "strpad", "cset", "ctype", "enum_type", "$@15",
- "enum_list", "enum_def", "$@16", "enum_symbol", "enum_val", YY_NULLPTR
-};
+static const char *const yytname[] = {"$end",
+ "error",
+ "$undefined",
+ "H5T_STD_I8BE_TOKEN",
+ "H5T_STD_I8LE_TOKEN",
+ "H5T_STD_I16BE_TOKEN",
+ "H5T_STD_I16LE_TOKEN",
+ "H5T_STD_I32BE_TOKEN",
+ "H5T_STD_I32LE_TOKEN",
+ "H5T_STD_I64BE_TOKEN",
+ "H5T_STD_I64LE_TOKEN",
+ "H5T_STD_U8BE_TOKEN",
+ "H5T_STD_U8LE_TOKEN",
+ "H5T_STD_U16BE_TOKEN",
+ "H5T_STD_U16LE_TOKEN",
+ "H5T_STD_U32BE_TOKEN",
+ "H5T_STD_U32LE_TOKEN",
+ "H5T_STD_U64BE_TOKEN",
+ "H5T_STD_U64LE_TOKEN",
+ "H5T_NATIVE_CHAR_TOKEN",
+ "H5T_NATIVE_SCHAR_TOKEN",
+ "H5T_NATIVE_UCHAR_TOKEN",
+ "H5T_NATIVE_SHORT_TOKEN",
+ "H5T_NATIVE_USHORT_TOKEN",
+ "H5T_NATIVE_INT_TOKEN",
+ "H5T_NATIVE_UINT_TOKEN",
+ "H5T_NATIVE_LONG_TOKEN",
+ "H5T_NATIVE_ULONG_TOKEN",
+ "H5T_NATIVE_LLONG_TOKEN",
+ "H5T_NATIVE_ULLONG_TOKEN",
+ "H5T_IEEE_F32BE_TOKEN",
+ "H5T_IEEE_F32LE_TOKEN",
+ "H5T_IEEE_F64BE_TOKEN",
+ "H5T_IEEE_F64LE_TOKEN",
+ "H5T_NATIVE_FLOAT_TOKEN",
+ "H5T_NATIVE_DOUBLE_TOKEN",
+ "H5T_NATIVE_LDOUBLE_TOKEN",
+ "H5T_STRING_TOKEN",
+ "STRSIZE_TOKEN",
+ "STRPAD_TOKEN",
+ "CSET_TOKEN",
+ "CTYPE_TOKEN",
+ "H5T_VARIABLE_TOKEN",
+ "H5T_STR_NULLTERM_TOKEN",
+ "H5T_STR_NULLPAD_TOKEN",
+ "H5T_STR_SPACEPAD_TOKEN",
+ "H5T_CSET_ASCII_TOKEN",
+ "H5T_CSET_UTF8_TOKEN",
+ "H5T_C_S1_TOKEN",
+ "H5T_FORTRAN_S1_TOKEN",
+ "H5T_OPAQUE_TOKEN",
+ "OPQ_SIZE_TOKEN",
+ "OPQ_TAG_TOKEN",
+ "H5T_COMPOUND_TOKEN",
+ "H5T_ENUM_TOKEN",
+ "H5T_ARRAY_TOKEN",
+ "H5T_VLEN_TOKEN",
+ "STRING",
+ "NUMBER",
+ "'{'",
+ "'}'",
+ "'['",
+ "']'",
+ "'\"'",
+ "':'",
+ "';'",
+ "$accept",
+ "start",
+ "ddl_type",
+ "atomic_type",
+ "integer_type",
+ "fp_type",
+ "compound_type",
+ "$@1",
+ "memb_list",
+ "memb_def",
+ "$@2",
+ "field_name",
+ "field_offset",
+ "offset",
+ "array_type",
+ "$@3",
+ "dim_list",
+ "dim",
+ "$@4",
+ "$@5",
+ "dimsize",
+ "vlen_type",
+ "opaque_type",
+ "$@6",
+ "@7",
+ "$@8",
+ "$@9",
+ "opaque_size",
+ "opaque_tag",
+ "string_type",
+ "$@10",
+ "$@11",
+ "$@12",
+ "$@13",
+ "@14",
+ "strsize",
+ "strpad",
+ "cset",
+ "ctype",
+ "enum_type",
+ "$@15",
+ "enum_list",
+ "enum_def",
+ "$@16",
+ "enum_symbol",
+ "enum_val",
+ YY_NULLPTR};
#endif
-# ifdef YYPRINT
+#ifdef YYPRINT
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
(internal) symbol number NUM (which must be that of a token). */
-static const yytype_uint16 yytoknum[] =
-{
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 308, 309, 310, 311, 312, 313, 123,
- 125, 91, 93, 34, 58, 59
-};
-# endif
+static const yytype_uint16 yytoknum[] = {0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
+ 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
+ 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296,
+ 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310,
+ 311, 312, 313, 123, 125, 91, 93, 34, 58, 59};
+#endif
#define YYPACT_NINF -25
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-25)))
+#define yypact_value_is_default(Yystate) (!!((Yystate) == (-25)))
#define YYTABLE_NINF -1
-#define yytable_value_is_error(Yytable_value) \
- 0
-
- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-static const yytype_int16 yypact[] =
-{
- 114, -25, -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, -25, -25, -25, -24, -20, -25, -15, -25,
- -14, 49, -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, 19, 45, 38, 168, 39, 114, -25, -25,
- -25, -25, 34, -25, 40, -4, 43, 56, -25, -3,
- -25, -25, -25, 37, -25, 42, -25, -25, -25, -25,
- -25, 44, -25, -25, -25, 50, -23, 47, -25, 64,
- 62, 51, -25, 58, -25, -25, -25, -2, -25, -25,
- 89, -25, 90, 92, -25, -25, -25, 91, 94, 95,
- -25, -25, -25, 98, 100, 96, 102, 122, -25, 103,
- -25, -25, -25, -25, 133, 9, 134, -25, -25, -25,
- 135, -25, -25, 105, 160, -25, 46, -25, -25, 137,
- -25, 143, -25
-};
-
- /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE does not specify something else to do. Zero
- means the default is an error. */
-static const yytype_uint8 yydefact[] =
-{
- 2, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
- 42, 43, 44, 45, 46, 0, 0, 47, 0, 57,
- 0, 0, 3, 4, 8, 9, 5, 6, 7, 12,
- 10, 11, 0, 0, 0, 0, 0, 0, 1, 73,
- 66, 49, 0, 59, 0, 0, 0, 0, 88, 0,
- 65, 79, 80, 0, 71, 0, 48, 51, 50, 90,
- 61, 0, 60, 74, 67, 0, 0, 0, 58, 0,
- 0, 0, 89, 0, 91, 64, 62, 0, 68, 53,
- 0, 94, 0, 0, 81, 82, 83, 0, 0, 54,
- 92, 63, 75, 0, 0, 0, 0, 0, 72, 0,
- 56, 55, 52, 95, 0, 0, 0, 93, 84, 85,
- 0, 69, 76, 0, 0, 70, 0, 86, 87, 0,
- 77, 0, 78
-};
-
- /* YYPGOTO[NTERM-NUM]. */
-static const yytype_int8 yypgoto[] =
-{
- -25, -25, -21, -25, 108, -25, -25, -25, -25, -25,
- -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, -25, -25, -25, -25
-};
-
- /* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int16 yydefgoto[] =
-{
- -1, 41, 42, 43, 44, 45, 46, 54, 67, 78,
- 85, 100, 115, 121, 47, 56, 69, 82, 87, 103,
- 96, 48, 49, 66, 90, 108, 133, 75, 119, 50,
- 65, 89, 117, 134, 141, 73, 107, 130, 139, 51,
- 79, 86, 94, 116, 102, 124
-};
-
- /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule whose
- number is the opposite. If YYTABLE_NINF, syntax error. */
-static const yytype_uint8 yytable[] =
-{
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 32, 33, 34, 35, 52, 64, 92, 71, 53,
- 93, 104, 105, 106, 55, 57, 77, 36, 81, 58,
- 37, 38, 39, 40, 72, 128, 129, 59, 80, 1,
- 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 137, 138, 60, 61, 63, 68,
- 70, 74, 83, 97, 88, 95, 36, 84, 99, 37,
- 38, 39, 40, 91, 98, 101, 76, 1, 2, 3,
- 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 109, 110, 111, 118, 112, 113, 120, 114,
- 123, 122, 125, 62, 36, 135, 126, 37, 38, 39,
- 40, 1, 2, 3, 4, 5, 6, 7, 8, 9,
- 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 127, 131,
- 132, 136, 140, 142
-};
-
-static const yytype_uint8 yycheck[] =
-{
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- 33, 34, 35, 36, 37, 59, 57, 60, 42, 59,
- 63, 43, 44, 45, 59, 59, 67, 50, 69, 0,
- 53, 54, 55, 56, 58, 46, 47, 38, 61, 3,
- 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 48, 49, 51, 59, 59, 65,
- 60, 58, 65, 39, 60, 58, 50, 65, 57, 53,
- 54, 55, 56, 63, 52, 57, 60, 3, 4, 5,
- 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 63, 63, 62, 57, 65, 63, 58, 64,
- 58, 65, 40, 55, 50, 60, 63, 53, 54, 55,
- 56, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 65, 65,
- 65, 41, 65, 60
-};
-
- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const yytype_uint8 yystos[] =
-{
- 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 50, 53, 54, 55,
- 56, 67, 68, 69, 70, 71, 72, 80, 87, 88,
- 95, 105, 59, 59, 73, 59, 81, 59, 0, 38,
- 51, 59, 70, 59, 68, 96, 89, 74, 65, 82,
- 60, 42, 58, 101, 58, 93, 60, 68, 75, 106,
- 61, 68, 83, 65, 65, 76, 107, 84, 60, 97,
- 90, 63, 60, 63, 108, 58, 86, 39, 52, 57,
- 77, 57, 110, 85, 43, 44, 45, 102, 91, 63,
- 63, 62, 65, 63, 64, 78, 109, 98, 57, 94,
- 58, 79, 65, 58, 111, 40, 63, 65, 46, 47,
- 103, 65, 65, 92, 99, 60, 41, 48, 49, 104,
- 65, 100, 60
-};
-
- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 66, 67, 67, 68, 68, 68, 68, 69, 69,
- 69, 69, 69, 70, 70, 70, 70, 70, 70, 70,
- 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
- 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
- 71, 71, 71, 71, 71, 71, 71, 73, 72, 74,
- 74, 76, 75, 77, 78, 78, 79, 81, 80, 82,
- 82, 84, 85, 83, 86, 87, 89, 90, 91, 92,
- 88, 93, 94, 96, 97, 98, 99, 100, 95, 101,
- 101, 102, 102, 102, 103, 103, 104, 104, 106, 105,
- 107, 107, 109, 108, 110, 111
-};
-
- /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 0, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 0, 5, 0,
- 2, 0, 7, 1, 0, 2, 1, 0, 6, 0,
- 2, 0, 0, 5, 1, 4, 0, 0, 0, 0,
- 15, 1, 1, 0, 0, 0, 0, 0, 20, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 0, 7,
- 0, 2, 0, 6, 1, 1
-};
-
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
-#define YYRECOVERING() (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (yylen); \
- yystate = *yyssp; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (0)
+#define yytable_value_is_error(Yytable_value) 0
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+static const yytype_int16 yypact[] = {
+ 114, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
+ -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -24, -20, -25, -15, -25, -14, 49,
+ -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, 19, 45, 38, 168, 39, 114, -25, -25, -25, -25, 34,
+ -25, 40, -4, 43, 56, -25, -3, -25, -25, -25, 37, -25, 42, -25, -25, -25, -25, -25, 44, -25, -25,
+ -25, 50, -23, 47, -25, 64, 62, 51, -25, 58, -25, -25, -25, -2, -25, -25, 89, -25, 90, 92, -25,
+ -25, -25, 91, 94, 95, -25, -25, -25, 98, 100, 96, 102, 122, -25, 103, -25, -25, -25, -25, 133, 9,
+ 134, -25, -25, -25, 135, -25, -25, 105, 160, -25, 46, -25, -25, 137, -25, 143, -25};
+
+/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
+static const yytype_uint8 yydefact[] = {
+ 2, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 0, 0, 47, 0, 57, 0, 0, 3, 4, 8, 9, 5, 6,
+ 7, 12, 10, 11, 0, 0, 0, 0, 0, 0, 1, 73, 66, 49, 0, 59, 0, 0, 0, 0, 88, 0, 65, 79,
+ 80, 0, 71, 0, 48, 51, 50, 90, 61, 0, 60, 74, 67, 0, 0, 0, 58, 0, 0, 0, 89, 0, 91, 64,
+ 62, 0, 68, 53, 0, 94, 0, 0, 81, 82, 83, 0, 0, 54, 92, 63, 75, 0, 0, 0, 0, 0, 72, 0,
+ 56, 55, 52, 95, 0, 0, 0, 93, 84, 85, 0, 69, 76, 0, 0, 70, 0, 86, 87, 0, 77, 0, 78};
+
+/* YYPGOTO[NTERM-NUM]. */
+static const yytype_int8 yypgoto[] = {-25, -25, -21, -25, 108, -25, -25, -25, -25, -25, -25, -25,
+ -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
+ -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
+ -25, -25, -25, -25, -25, -25, -25, -25, -25, -25};
+
+/* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int16 yydefgoto[] = {
+ -1, 41, 42, 43, 44, 45, 46, 54, 67, 78, 85, 100, 115, 121, 47, 56, 69, 82, 87, 103, 96, 48, 49,
+ 66, 90, 108, 133, 75, 119, 50, 65, 89, 117, 134, 141, 73, 107, 130, 139, 51, 79, 86, 94, 116, 102, 124};
+
+/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
+static const yytype_uint8 yytable[] = {
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 52, 64, 92, 71, 53, 93, 104,
+ 105, 106, 55, 57, 77, 36, 81, 58, 37, 38, 39, 40, 72, 128, 129, 59, 80, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 137, 138, 60, 61, 63, 68, 70, 74, 83, 97, 88,
+ 95, 36, 84, 99, 37, 38, 39, 40, 91, 98, 101, 76, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 31, 32, 33, 34, 35, 109, 110, 111, 118, 112, 113, 120, 114, 123, 122, 125, 62, 36, 135, 126, 37,
+ 38, 39, 40, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 127, 131, 132, 136, 140, 142};
+
+static const yytype_uint8 yycheck[] = {
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 59, 57, 60, 42, 59, 63, 43, 44, 45, 59, 59, 67, 50, 69, 0, 53, 54,
+ 55, 56, 58, 46, 47, 38, 61, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 48, 49, 51, 59, 59, 65, 60, 58, 65, 39,
+ 60, 58, 50, 65, 57, 53, 54, 55, 56, 63, 52, 57, 60, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 63, 63, 62, 57,
+ 65, 63, 58, 64, 58, 65, 40, 55, 50, 60, 63, 53, 54, 55, 56, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 65, 65, 65, 41, 65, 60};
+
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+static const yytype_uint8 yystos[] = {
+ 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 50, 53, 54, 55, 56, 67,
+ 68, 69, 70, 71, 72, 80, 87, 88, 95, 105, 59, 59, 73, 59, 81, 59, 0, 38, 51, 59, 70,
+ 59, 68, 96, 89, 74, 65, 82, 60, 42, 58, 101, 58, 93, 60, 68, 75, 106, 61, 68, 83, 65,
+ 65, 76, 107, 84, 60, 97, 90, 63, 60, 63, 108, 58, 86, 39, 52, 57, 77, 57, 110, 85, 43,
+ 44, 45, 102, 91, 63, 63, 62, 65, 63, 64, 78, 109, 98, 57, 94, 58, 79, 65, 58, 111, 40,
+ 63, 65, 46, 47, 103, 65, 65, 92, 99, 60, 41, 48, 49, 104, 65, 100, 60};
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] = {
+ 0, 66, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70,
+ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
+ 71, 71, 71, 71, 71, 71, 71, 73, 72, 74, 74, 76, 75, 77, 78, 78, 79, 81, 80, 82,
+ 82, 84, 85, 83, 86, 87, 89, 90, 91, 92, 88, 93, 94, 96, 97, 98, 99, 100, 95, 101,
+ 101, 102, 102, 102, 103, 103, 104, 104, 106, 105, 107, 107, 109, 108, 110, 111};
+
+/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] = {0, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+ 5, 0, 2, 0, 7, 1, 0, 2, 1, 0, 6, 0, 2, 0, 0, 5, 1, 4, 0, 0, 0, 0, 15, 1,
+ 1, 0, 0, 0, 0, 0, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 7, 0, 2, 0, 6, 1, 1};
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+#define YYRECOVERING() (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value) \
+ do \
+ if (yychar == YYEMPTY) { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK(yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else { \
+ yyerror(YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+ while (0)
/* Error token number */
-#define YYTERROR 1
-#define YYERRCODE 256
-
-
+#define YYTERROR 1
+#define YYERRCODE 256
/* Enable debugging if requested. */
#if YYDEBUG
-# ifndef YYFPRINTF
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# define YYFPRINTF fprintf
-# endif
+#ifndef YYFPRINTF
+#include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+#define YYFPRINTF fprintf
+#endif
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (0)
+#define YYDPRINTF(Args) \
+ do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+ } while (0)
/* This macro is provided for backward compatibility. */
#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#define YY_LOCATION_PRINT(File, Loc) ((void)0)
#endif
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (0)
-
+#define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+ do { \
+ if (yydebug) { \
+ YYFPRINTF(stderr, "%s ", Title); \
+ yy_symbol_print(stderr, Type, Value); \
+ YYFPRINTF(stderr, "\n"); \
+ } \
+ } while (0)
/*----------------------------------------.
| Print this symbol's value on YYOUTPUT. |
`----------------------------------------*/
static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+yy_symbol_value_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep)
{
- FILE *yyo = yyoutput;
- YYUSE (yyo);
- if (!yyvaluep)
- return;
-# ifdef YYPRINT
- if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# endif
- YYUSE (yytype);
+ FILE *yyo = yyoutput;
+ YYUSE(yyo);
+ if (!yyvaluep)
+ return;
+#ifdef YYPRINT
+ if (yytype < YYNTOKENS)
+ YYPRINT(yyoutput, yytoknum[yytype], *yyvaluep);
+#endif
+ YYUSE(yytype);
}
-
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+yy_symbol_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep)
{
- YYFPRINTF (yyoutput, "%s %s (",
- yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+ YYFPRINTF(yyoutput, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
- yy_symbol_value_print (yyoutput, yytype, yyvaluep);
- YYFPRINTF (yyoutput, ")");
+ yy_symbol_value_print(yyoutput, yytype, yyvaluep);
+ YYFPRINTF(yyoutput, ")");
}
/*------------------------------------------------------------------.
@@ -919,68 +847,60 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
`------------------------------------------------------------------*/
static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+yy_stack_print(yytype_int16 *yybottom, yytype_int16 *yytop)
{
- YYFPRINTF (stderr, "Stack now");
- for (; yybottom <= yytop; yybottom++)
- {
- int yybot = *yybottom;
- YYFPRINTF (stderr, " %d", yybot);
+ YYFPRINTF(stderr, "Stack now");
+ for (; yybottom <= yytop; yybottom++) {
+ int yybot = *yybottom;
+ YYFPRINTF(stderr, " %d", yybot);
}
- YYFPRINTF (stderr, "\n");
+ YYFPRINTF(stderr, "\n");
}
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (0)
-
+#define YY_STACK_PRINT(Bottom, Top) \
+ do { \
+ if (yydebug) \
+ yy_stack_print((Bottom), (Top)); \
+ } while (0)
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
static void
-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
+yy_reduce_print(yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
{
- unsigned long int yylno = yyrline[yyrule];
- int yynrhs = yyr2[yyrule];
- int yyi;
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
- /* The symbols being reduced. */
- for (yyi = 0; yyi < yynrhs; yyi++)
- {
- YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr,
- yystos[yyssp[yyi + 1 - yynrhs]],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- );
- YYFPRINTF (stderr, "\n");
+ unsigned long int yylno = yyrline[yyrule];
+ int yynrhs = yyr2[yyrule];
+ int yyi;
+ YYFPRINTF(stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno);
+ /* The symbols being reduced. */
+ for (yyi = 0; yyi < yynrhs; yyi++) {
+ YYFPRINTF(stderr, " $%d = ", yyi + 1);
+ yy_symbol_print(stderr, yystos[yyssp[yyi + 1 - yynrhs]], &(yyvsp[(yyi + 1) - (yynrhs)]));
+ YYFPRINTF(stderr, "\n");
}
}
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyssp, yyvsp, Rule); \
-} while (0)
+#define YY_REDUCE_PRINT(Rule) \
+ do { \
+ if (yydebug) \
+ yy_reduce_print(yyssp, yyvsp, Rule); \
+ } while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
+#define YYDPRINTF(Args)
+#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+#define YY_STACK_PRINT(Bottom, Top)
+#define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
-
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
+#define YYINITDEPTH 200
#endif
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
@@ -991,49 +911,48 @@ int yydebug;
evaluated with infinite-precision integer arithmetic. */
#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
+#define YYMAXDEPTH 10000
#endif
-
#if YYERROR_VERBOSE
-# ifndef yystrlen
-# if defined __GLIBC__ && defined _STRING_H
-# define yystrlen strlen
-# else
+#ifndef yystrlen
+#if defined __GLIBC__ && defined _STRING_H
+#define yystrlen strlen
+#else
/* Return the length of YYSTR. */
static YYSIZE_T
-yystrlen (const char *yystr)
+yystrlen(const char *yystr)
{
- YYSIZE_T yylen;
- for (yylen = 0; yystr[yylen]; yylen++)
- continue;
- return yylen;
+ YYSIZE_T yylen;
+ for (yylen = 0; yystr[yylen]; yylen++)
+ continue;
+ return yylen;
}
-# endif
-# endif
+#endif
+#endif
-# ifndef yystpcpy
-# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-# define yystpcpy stpcpy
-# else
+#ifndef yystpcpy
+#if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+#define yystpcpy stpcpy
+#else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
static char *
-yystpcpy (char *yydest, const char *yysrc)
+yystpcpy(char *yydest, const char *yysrc)
{
- char *yyd = yydest;
- const char *yys = yysrc;
+ char * yyd = yydest;
+ const char *yys = yysrc;
- while ((*yyd++ = *yys++) != '\0')
- continue;
+ while ((*yyd++ = *yys++) != '\0')
+ continue;
- return yyd - 1;
+ return yyd - 1;
}
-# endif
-# endif
+#endif
+#endif
-# ifndef yytnamerr
+#ifndef yytnamerr
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
quotes and backslashes, so that it's suitable for yyerror. The
heuristic is that double-quoting is unnecessary unless the string
@@ -1042,44 +961,42 @@ yystpcpy (char *yydest, const char *yysrc)
null, do not copy; instead, return the length of what the result
would have been. */
static YYSIZE_T
-yytnamerr (char *yyres, const char *yystr)
+yytnamerr(char *yyres, const char *yystr)
{
- if (*yystr == '"')
- {
- YYSIZE_T yyn = 0;
- char const *yyp = yystr;
-
- for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
+ if (*yystr == '"') {
+ YYSIZE_T yyn = 0;
+ char const *yyp = yystr;
+
+ for (;;)
+ switch (*++yyp) {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
- do_not_strip_quotes: ;
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
+do_not_strip_quotes:;
}
- if (! yyres)
- return yystrlen (yystr);
+ if (!yyres)
+ return yystrlen(yystr);
- return yystpcpy (yyres, yystr) - yyres;
+ return yystpcpy(yyres, yystr) - yyres;
}
-# endif
+#endif
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
about the unexpected token YYTOKEN for the state stack whose top is
@@ -1090,130 +1007,119 @@ yytnamerr (char *yyres, const char *yystr)
*YYMSG_ALLOC to the required number of bytes. Return 2 if the
required number of bytes is too large to store. */
static int
-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
- yytype_int16 *yyssp, int yytoken)
+yysyntax_error(YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken)
{
- YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
- YYSIZE_T yysize = yysize0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- /* Internationalized format string. */
- const char *yyformat = YY_NULLPTR;
- /* Arguments of yyformat. */
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- /* Number of reported tokens (one for the "unexpected", one per
- "expected"). */
- int yycount = 0;
-
- /* There are many possibilities here to consider:
- - If this state is a consistent state with a default action, then
- the only way this function was invoked is if the default action
- is an error action. In that case, don't check for expected
- tokens because there are none.
- - The only way there can be no lookahead present (in yychar) is if
- this state is a consistent state with a default action. Thus,
- detecting the absence of a lookahead is sufficient to determine
- that there is no unexpected or expected token to report. In that
- case, just report a simple "syntax error".
- - Don't assume there isn't a lookahead just because this state is a
- consistent state with a default action. There might have been a
- previous inconsistent state, consistent state with a non-default
- action, or user semantic action that manipulated yychar.
- - Of course, the expected token list depends on states to have
- correct lookahead information, and it depends on the parser not
- to perform extra reductions after fetching a lookahead from the
- scanner and before detecting a syntax error. Thus, state merging
- (from LALR or IELR) and default reductions corrupt the expected
- token list. However, the list is correct for canonical LR with
- one exception: it will still contain any token that will not be
- accepted due to an error action in a later state.
- */
- if (yytoken != YYEMPTY)
- {
- int yyn = yypact[*yyssp];
- yyarg[yycount++] = yytname[yytoken];
- if (!yypact_value_is_default (yyn))
- {
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. In other words, skip the first -YYN actions for
- this state because they are default actions. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yyx;
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
- && !yytable_value_is_error (yytable[yyx + yyn]))
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- {
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
+ YYSIZE_T yysize0 = yytnamerr(YY_NULLPTR, yytname[yytoken]);
+ YYSIZE_T yysize = yysize0;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ /* Internationalized format string. */
+ const char *yyformat = YY_NULLPTR;
+ /* Arguments of yyformat. */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Number of reported tokens (one for the "unexpected", one per
+ "expected"). */
+ int yycount = 0;
+
+ /* There are many possibilities here to consider:
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+ tokens because there are none.
+ - The only way there can be no lookahead present (in yychar) is if
+ this state is a consistent state with a default action. Thus,
+ detecting the absence of a lookahead is sufficient to determine
+ that there is no unexpected or expected token to report. In that
+ case, just report a simple "syntax error".
+ - Don't assume there isn't a lookahead just because this state is a
+ consistent state with a default action. There might have been a
+ previous inconsistent state, consistent state with a non-default
+ action, or user semantic action that manipulated yychar.
+ - Of course, the expected token list depends on states to have
+ correct lookahead information, and it depends on the parser not
+ to perform extra reductions after fetching a lookahead from the
+ scanner and before detecting a syntax error. Thus, state merging
+ (from LALR or IELR) and default reductions corrupt the expected
+ token list. However, the list is correct for canonical LR with
+ one exception: it will still contain any token that will not be
+ accepted due to an error action in a later state.
+ */
+ if (yytoken != YYEMPTY) {
+ int yyn = yypact[*yyssp];
+ yyarg[yycount++] = yytname[yytoken];
+ if (!yypact_value_is_default(yyn)) {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yyx;
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR &&
+ !yytable_value_is_error(yytable[yyx + yyn])) {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) {
+ yycount = 1;
+ yysize = yysize0;
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ {
+ YYSIZE_T yysize1 = yysize + yytnamerr(YY_NULLPTR, yytname[yyx]);
+ if (!(yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
}
- }
}
}
- switch (yycount)
+ switch (yycount) {
+#define YYCASE_(N, S) \
+ case N: \
+ yyformat = S; \
+ break
+ YYCASE_(0, YY_("syntax error"));
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+#undef YYCASE_
+ }
+
{
-# define YYCASE_(N, S) \
- case N: \
- yyformat = S; \
- break
- YYCASE_(0, YY_("syntax error"));
- YYCASE_(1, YY_("syntax error, unexpected %s"));
- YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
- YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
- YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
- YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
-# undef YYCASE_
+ YYSIZE_T yysize1 = yysize + yystrlen(yyformat);
+ if (!(yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
}
- {
- YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
+ if (*yymsg_alloc < yysize) {
+ *yymsg_alloc = 2 * yysize;
+ if (!(yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+ return 1;
+ }
- if (*yymsg_alloc < yysize)
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
{
- *yymsg_alloc = 2 * yysize;
- if (! (yysize <= *yymsg_alloc
- && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
- *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
- return 1;
+ char *yyp = *yymsg;
+ int yyi = 0;
+ while ((*yyp = *yyformat) != '\0')
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) {
+ yyp += yytnamerr(yyp, yyarg[yyi++]);
+ yyformat += 2;
+ }
+ else {
+ yyp++;
+ yyformat++;
+ }
}
-
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- {
- char *yyp = *yymsg;
- int yyi = 0;
- while ((*yyp = *yyformat) != '\0')
- if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyformat += 2;
- }
- else
- {
- yyp++;
- yyformat++;
- }
- }
- return 0;
+ return 0;
}
#endif /* YYERROR_VERBOSE */
@@ -1222,21 +1128,18 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
`-----------------------------------------------*/
static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep)
{
- YYUSE (yyvaluep);
- if (!yymsg)
- yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- YYUSE (yytype);
- YY_IGNORE_MAYBE_UNINITIALIZED_END
+ YYUSE(yyvaluep);
+ if (!yymsg)
+ yymsg = "Deleting";
+ YY_SYMBOL_PRINT(yymsg, yytype, yyvaluep, yylocationp);
+
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ YYUSE(yytype);
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
}
-
-
-
/* The lookahead symbol. */
int yychar;
@@ -1245,13 +1148,12 @@ YYSTYPE yylval;
/* Number of syntax errors so far. */
int yynerrs;
-
/*----------.
| yyparse. |
`----------*/
hid_t
-yyparse (void)
+yyparse(void)
{
int yystate;
/* Number of tokens to shift before error messages enabled. */
@@ -1265,1025 +1167,1117 @@ yyparse (void)
to reallocate them elsewhere. */
/* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 yyssa[YYINITDEPTH];
yytype_int16 *yyss;
yytype_int16 *yyssp;
/* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs;
YYSTYPE *yyvsp;
YYSIZE_T yystacksize;
- int yyn;
- int yyresult;
- /* Lookahead token as an internal (translated) token number. */
- int yytoken = 0;
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
+ int yyn;
+ int yyresult;
+ /* Lookahead token as an internal (translated) token number. */
+ int yytoken = 0;
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ YYSTYPE yyval;
#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char * yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
- /* The number of symbols on the RHS of the reduced rule.
- Keep to zero when no symbol should be popped. */
- int yylen = 0;
+ /* The number of symbols on the RHS of the reduced rule.
+ Keep to zero when no symbol should be popped. */
+ int yylen = 0;
- yyssp = yyss = yyssa;
- yyvsp = yyvs = yyvsa;
- yystacksize = YYINITDEPTH;
+ yyssp = yyss = yyssa;
+ yyvsp = yyvs = yyvsa;
+ yystacksize = YYINITDEPTH;
- YYDPRINTF ((stderr, "Starting parse\n"));
+ YYDPRINTF((stderr, "Starting parse\n"));
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
- goto yysetstate;
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+ goto yysetstate;
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
-`------------------------------------------------------------*/
- yynewstate:
- /* In all cases, when you get here, the value and location stacks
- have just been pushed. So pushing a state here evens the stacks. */
- yyssp++;
+ /*------------------------------------------------------------.
+ | yynewstate -- Push a new state, which is found in yystate. |
+ `------------------------------------------------------------*/
+yynewstate:
+ /* In all cases, when you get here, the value and location stacks
+ have just been pushed. So pushing a state here evens the stacks. */
+ yyssp++;
- yysetstate:
- *yyssp = yystate;
+yysetstate:
+ *yyssp = yystate;
- if (yyss + yystacksize - 1 <= yyssp)
- {
- /* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
+ if (yyss + yystacksize - 1 <= yyssp) {
+ /* Get the current used size of the three stacks, in elements. */
+ YYSIZE_T yysize = yyssp - yyss + 1;
#ifdef yyoverflow
- {
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
- }
+ {
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE * yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow(YY_("memory exhausted"), &yyss1, yysize * sizeof(*yyssp), &yyvs1,
+ yysize * sizeof(*yyvsp), &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
-# else
- /* Extend the stack our own way. */
- if (YYMAXDEPTH <= yystacksize)
+#ifndef YYSTACK_RELOCATE
goto yyexhaustedlab;
- yystacksize *= 2;
- if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
-
- {
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
- }
-# endif
+#else
+ /* Extend the stack our own way. */
+ if (YYMAXDEPTH <= yystacksize)
+ goto yyexhaustedlab;
+ yystacksize *= 2;
+ if (YYMAXDEPTH < yystacksize)
+ yystacksize = YYMAXDEPTH;
+
+ {
+ yytype_int16 * yyss1 = yyss;
+ union yyalloc *yyptr = (union yyalloc *)YYSTACK_ALLOC(YYSTACK_BYTES(yystacksize));
+ if (!yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE(yyss_alloc, yyss);
+ YYSTACK_RELOCATE(yyvs_alloc, yyvs);
+#undef YYSTACK_RELOCATE
+ if (yyss1 != yyssa)
+ YYSTACK_FREE(yyss1);
+ }
+#endif
#endif /* no yyoverflow */
- yyssp = yyss + yysize - 1;
- yyvsp = yyvs + yysize - 1;
+ yyssp = yyss + yysize - 1;
+ yyvsp = yyvs + yysize - 1;
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ YYDPRINTF((stderr, "Stack size increased to %lu\n", (unsigned long int)yystacksize));
- if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
+ if (yyss + yystacksize - 1 <= yyssp)
+ YYABORT;
}
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+ YYDPRINTF((stderr, "Entering state %d\n", yystate));
- if (yystate == YYFINAL)
- YYACCEPT;
+ if (yystate == YYFINAL)
+ YYACCEPT;
- goto yybackup;
+ goto yybackup;
/*-----------.
| yybackup. |
`-----------*/
yybackup:
- /* Do appropriate processing given the current state. Read a
- lookahead token if we need one and don't already have one. */
+ /* Do appropriate processing given the current state. Read a
+ lookahead token if we need one and don't already have one. */
- /* First try to decide what to do without reference to lookahead token. */
- yyn = yypact[yystate];
- if (yypact_value_is_default (yyn))
- goto yydefault;
+ /* First try to decide what to do without reference to lookahead token. */
+ yyn = yypact[yystate];
+ if (yypact_value_is_default(yyn))
+ goto yydefault;
- /* Not known => get a lookahead token if don't already have one. */
+ /* Not known => get a lookahead token if don't already have one. */
- /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
- if (yychar == YYEMPTY)
- {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = yylex ();
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
+ if (yychar == YYEMPTY) {
+ YYDPRINTF((stderr, "Reading a token: "));
+ yychar = yylex();
}
- if (yychar <= YYEOF)
- {
- yychar = yytoken = YYEOF;
- YYDPRINTF ((stderr, "Now at end of input.\n"));
+ if (yychar <= YYEOF) {
+ yychar = yytoken = YYEOF;
+ YYDPRINTF((stderr, "Now at end of input.\n"));
}
- else
- {
- yytoken = YYTRANSLATE (yychar);
- YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+ else {
+ yytoken = YYTRANSLATE(yychar);
+ YY_SYMBOL_PRINT("Next token is", yytoken, &yylval, &yylloc);
}
- /* If the proper action on seeing token YYTOKEN is to reduce or to
- detect an error, take that action. */
- yyn += yytoken;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
- goto yydefault;
- yyn = yytable[yyn];
- if (yyn <= 0)
- {
- if (yytable_value_is_error (yyn))
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
+ detect an error, take that action. */
+ yyn += yytoken;
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ goto yydefault;
+ yyn = yytable[yyn];
+ if (yyn <= 0) {
+ if (yytable_value_is_error(yyn))
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
}
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
-
- /* Shift the lookahead token. */
- YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (yyerrstatus)
+ yyerrstatus--;
- /* Discard the shifted token. */
- yychar = YYEMPTY;
+ /* Shift the lookahead token. */
+ YY_SYMBOL_PRINT("Shifting", yytoken, &yylval, &yylloc);
- yystate = yyn;
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- *++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
- goto yynewstate;
+ yystate = yyn;
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+ goto yynewstate;
/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state. |
`-----------------------------------------------------------*/
yydefault:
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+ goto yyreduce;
/*-----------------------------.
| yyreduce -- Do a reduction. |
`-----------------------------*/
yyreduce:
- /* yyn is the number of a rule to reduce with. */
- yylen = yyr2[yyn];
+ /* yyn is the number of a rule to reduce with. */
+ yylen = yyr2[yyn];
- /* If YYLEN is nonzero, implement the default value of the action:
- '$$ = $1'.
+ /* If YYLEN is nonzero, implement the default value of the action:
+ '$$ = $1'.
- Otherwise, the following line sets YYVAL to garbage.
- This behavior is undocumented and Bison
- users should not rely upon it. Assigning to YYVAL
- unconditionally makes the parser a bit smaller, and it avoids a
- GCC warning that YYVAL may be used uninitialized. */
- yyval = yyvsp[1-yylen];
+ Otherwise, the following line sets YYVAL to garbage.
+ This behavior is undocumented and Bison
+ users should not rely upon it. Assigning to YYVAL
+ unconditionally makes the parser a bit smaller, and it avoids a
+ GCC warning that YYVAL may be used uninitialized. */
+ yyval = yyvsp[1 - yylen];
-
- YY_REDUCE_PRINT (yyn);
- switch (yyn)
- {
+ YY_REDUCE_PRINT(yyn);
+ switch (yyn) {
case 2:
#line 105 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ }
+ {
+ memset(arr_stack, 0, STACK_SIZE * sizeof(struct arr_info)); /*initialize here?*/
+ }
#line 1470 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 3:
+ case 3:
#line 106 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { return (yyval.hid);}
+ {
+ return (yyval.hid);
+ }
#line 1476 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 13:
+ case 13:
#line 120 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_STD_I8BE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_STD_I8BE);
+ }
#line 1482 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 14:
+ case 14:
#line 121 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_STD_I8LE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_STD_I8LE);
+ }
#line 1488 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 15:
+ case 15:
#line 122 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_STD_I16BE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_STD_I16BE);
+ }
#line 1494 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 16:
+ case 16:
#line 123 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_STD_I16LE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_STD_I16LE);
+ }
#line 1500 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 17:
+ case 17:
#line 124 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_STD_I32BE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_STD_I32BE);
+ }
#line 1506 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 18:
+ case 18:
#line 125 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_STD_I32LE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_STD_I32LE);
+ }
#line 1512 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 19:
+ case 19:
#line 126 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_STD_I64BE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_STD_I64BE);
+ }
#line 1518 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 20:
+ case 20:
#line 127 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_STD_I64LE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_STD_I64LE);
+ }
#line 1524 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 21:
+ case 21:
#line 128 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_STD_U8BE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_STD_U8BE);
+ }
#line 1530 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 22:
+ case 22:
#line 129 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_STD_U8LE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_STD_U8LE);
+ }
#line 1536 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 23:
+ case 23:
#line 130 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_STD_U16BE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_STD_U16BE);
+ }
#line 1542 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 24:
+ case 24:
#line 131 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_STD_U16LE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_STD_U16LE);
+ }
#line 1548 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 25:
+ case 25:
#line 132 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_STD_U32BE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_STD_U32BE);
+ }
#line 1554 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 26:
+ case 26:
#line 133 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_STD_U32LE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_STD_U32LE);
+ }
#line 1560 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 27:
+ case 27:
#line 134 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_STD_U64BE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_STD_U64BE);
+ }
#line 1566 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 28:
+ case 28:
#line 135 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_STD_U64LE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_STD_U64LE);
+ }
#line 1572 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 29:
+ case 29:
#line 136 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR);
+ }
#line 1578 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 30:
+ case 30:
#line 137 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR);
+ }
#line 1584 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 31:
+ case 31:
#line 138 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR);
+ }
#line 1590 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 32:
+ case 32:
#line 139 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT);
+ }
#line 1596 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 33:
+ case 33:
#line 140 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT);
+ }
#line 1602 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 34:
+ case 34:
#line 141 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_NATIVE_INT);
+ }
#line 1608 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 35:
+ case 35:
#line 142 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT);
+ }
#line 1614 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 36:
+ case 36:
#line 143 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG);
+ }
#line 1620 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 37:
+ case 37:
#line 144 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG);
+ }
#line 1626 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 38:
+ case 38:
#line 145 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG);
+ }
#line 1632 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 39:
+ case 39:
#line 146 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG);
+ }
#line 1638 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 40:
+ case 40:
#line 149 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE);
+ }
#line 1644 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 41:
+ case 41:
#line 150 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE);
+ }
#line 1650 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 42:
+ case 42:
#line 151 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE);
+ }
#line 1656 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 43:
+ case 43:
#line 152 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE);
+ }
#line 1662 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 44:
+ case 44:
#line 153 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT);
+ }
#line 1668 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 45:
+ case 45:
#line 154 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE);
+ }
#line 1674 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 46:
+ case 46:
#line 155 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); }
+ {
+ (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE);
+ }
#line 1680 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 47:
+ case 47:
#line 159 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ }
+ {
+ csindex++;
+ cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/
+ }
#line 1686 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 48:
+ case 48:
#line 161 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = cmpd_stack[csindex].id;
- cmpd_stack[csindex].id = 0;
- cmpd_stack[csindex].first_memb = 1;
- csindex--;
- }
+ {
+ (yyval.hid) = cmpd_stack[csindex].id;
+ cmpd_stack[csindex].id = 0;
+ cmpd_stack[csindex].first_memb = 1;
+ csindex--;
+ }
#line 1696 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 51:
+ case 51:
#line 170 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ }
+ {
+ cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/
+ }
#line 1702 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 52:
+ case 52:
#line 172 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- size_t origin_size, new_size;
- hid_t dtype_id = cmpd_stack[csindex].id;
-
- /*Adjust size and insert member, consider both member size and offset.*/
- if(cmpd_stack[csindex].first_memb) { /*reclaim the size 1 temporarily set*/
- new_size = H5Tget_size((yyvsp[-6].hid)) + (yyvsp[-1].ival);
- H5Tset_size(dtype_id, new_size);
- /*member name is saved in yylval.sval by lexer*/
- H5Tinsert(dtype_id, (yyvsp[-3].sval), (yyvsp[-1].ival), (yyvsp[-6].hid));
-
- cmpd_stack[csindex].first_memb = 0;
- } else {
- origin_size = H5Tget_size(dtype_id);
-
- if((yyvsp[-1].ival) == 0) {
- new_size = origin_size + H5Tget_size((yyvsp[-6].hid));
- H5Tset_size(dtype_id, new_size);
- H5Tinsert(dtype_id, (yyvsp[-3].sval), origin_size, (yyvsp[-6].hid));
- } else {
- new_size = (yyvsp[-1].ival) + H5Tget_size((yyvsp[-6].hid));
- H5Tset_size(dtype_id, new_size);
- H5Tinsert(dtype_id, (yyvsp[-3].sval), (yyvsp[-1].ival), (yyvsp[-6].hid));
- }
- }
- if((yyvsp[-3].sval)) {
- free((yyvsp[-3].sval));
- (yyvsp[-3].sval) = NULL;
- }
- cmpd_stack[csindex].is_field = 0;
- H5Tclose((yyvsp[-6].hid));
-
- new_size = H5Tget_size(dtype_id);
- }
+ {
+ size_t origin_size, new_size;
+ hid_t dtype_id = cmpd_stack[csindex].id;
+
+ /*Adjust size and insert member, consider both member size and offset.*/
+ if (cmpd_stack[csindex].first_memb) { /*reclaim the size 1 temporarily set*/
+ new_size = H5Tget_size((yyvsp[-6].hid)) + (yyvsp[-1].ival);
+ H5Tset_size(dtype_id, new_size);
+ /*member name is saved in yylval.sval by lexer*/
+ H5Tinsert(dtype_id, (yyvsp[-3].sval), (yyvsp[-1].ival), (yyvsp[-6].hid));
+
+ cmpd_stack[csindex].first_memb = 0;
+ }
+ else {
+ origin_size = H5Tget_size(dtype_id);
+
+ if ((yyvsp[-1].ival) == 0) {
+ new_size = origin_size + H5Tget_size((yyvsp[-6].hid));
+ H5Tset_size(dtype_id, new_size);
+ H5Tinsert(dtype_id, (yyvsp[-3].sval), origin_size, (yyvsp[-6].hid));
+ }
+ else {
+ new_size = (yyvsp[-1].ival) + H5Tget_size((yyvsp[-6].hid));
+ H5Tset_size(dtype_id, new_size);
+ H5Tinsert(dtype_id, (yyvsp[-3].sval), (yyvsp[-1].ival), (yyvsp[-6].hid));
+ }
+ }
+ if ((yyvsp[-3].sval)) {
+ free((yyvsp[-3].sval));
+ (yyvsp[-3].sval) = NULL;
+ }
+ cmpd_stack[csindex].is_field = 0;
+ H5Tclose((yyvsp[-6].hid));
+
+ new_size = H5Tget_size(dtype_id);
+ }
#line 1741 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 53:
+ case 53:
#line 208 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- (yyval.sval) = strdup(yylval.sval);
- free(yylval.sval);
- yylval.sval = NULL;
- }
+ {
+ (yyval.sval) = strdup(yylval.sval);
+ free(yylval.sval);
+ yylval.sval = NULL;
+ }
#line 1751 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 54:
+ case 54:
#line 215 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.ival) = 0; }
+ {
+ (yyval.ival) = 0;
+ }
#line 1757 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 55:
+ case 55:
#line 217 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.ival) = yylval.ival; }
+ {
+ (yyval.ival) = yylval.ival;
+ }
#line 1763 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 57:
+ case 57:
#line 221 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { asindex++; /*pushd onto the stack*/ }
+ {
+ asindex++; /*pushd onto the stack*/
+ }
#line 1769 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 58:
+ case 58:
#line 223 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- (yyval.hid) = H5Tarray_create2((yyvsp[-1].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims);
- arr_stack[asindex].ndims = 0;
- asindex--;
- H5Tclose((yyvsp[-1].hid));
- }
+ {
+ (yyval.hid) =
+ H5Tarray_create2((yyvsp[-1].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims);
+ arr_stack[asindex].ndims = 0;
+ asindex--;
+ H5Tclose((yyvsp[-1].hid));
+ }
#line 1780 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 61:
+ case 61:
#line 233 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ }
+ {
+ arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/
+ }
#line 1786 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 62:
+ case 62:
#line 234 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { unsigned ndims = arr_stack[asindex].ndims;
- arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival;
- arr_stack[asindex].ndims++;
- arr_stack[asindex].is_dim = 0;
- }
+ {
+ unsigned ndims = arr_stack[asindex].ndims;
+ arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival;
+ arr_stack[asindex].ndims++;
+ arr_stack[asindex].is_dim = 0;
+ }
#line 1796 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 65:
+ case 65:
#line 245 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tvlen_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); }
+ {
+ (yyval.hid) = H5Tvlen_create((yyvsp[-1].hid));
+ H5Tclose((yyvsp[-1].hid));
+ }
#line 1802 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 66:
+ case 66:
#line 250 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { is_opq_size = 1; }
+ {
+ is_opq_size = 1;
+ }
#line 1808 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 67:
+ case 67:
#line 251 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- size_t size = (size_t)yylval.ival;
- (yyval.hid) = H5Tcreate(H5T_OPAQUE, size);
- is_opq_size = 0;
- }
+ {
+ size_t size = (size_t)yylval.ival;
+ (yyval.hid) = H5Tcreate(H5T_OPAQUE, size);
+ is_opq_size = 0;
+ }
#line 1818 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 68:
+ case 68:
#line 256 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { is_opq_tag = 1; }
+ {
+ is_opq_tag = 1;
+ }
#line 1824 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 69:
+ case 69:
#line 257 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- H5Tset_tag((yyvsp[-6].hid), yylval.sval);
- free(yylval.sval);
- yylval.sval = NULL;
- is_opq_tag = 0;
- }
+ {
+ H5Tset_tag((yyvsp[-6].hid), yylval.sval);
+ free(yylval.sval);
+ yylval.sval = NULL;
+ is_opq_tag = 0;
+ }
#line 1835 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 70:
+ case 70:
#line 263 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = (yyvsp[-8].hid); }
+ {
+ (yyval.hid) = (yyvsp[-8].hid);
+ }
#line 1841 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 73:
+ case 73:
#line 271 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { is_str_size = 1; }
+ {
+ is_str_size = 1;
+ }
#line 1847 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 74:
+ case 74:
#line 272 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- if((yyvsp[-1].ival) == H5T_VARIABLE_TOKEN)
- is_variable = 1;
- else
- str_size = yylval.ival;
- is_str_size = 0;
- }
+ {
+ if ((yyvsp[-1].ival) == H5T_VARIABLE_TOKEN)
+ is_variable = 1;
+ else
+ str_size = yylval.ival;
+ is_str_size = 0;
+ }
#line 1859 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 75:
+ case 75:
#line 280 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- if((yyvsp[-1].ival) == H5T_STR_NULLTERM_TOKEN)
- str_pad = H5T_STR_NULLTERM;
- else if((yyvsp[-1].ival) == H5T_STR_NULLPAD_TOKEN)
- str_pad = H5T_STR_NULLPAD;
- else if((yyvsp[-1].ival) == H5T_STR_SPACEPAD_TOKEN)
- str_pad = H5T_STR_SPACEPAD;
- }
+ {
+ if ((yyvsp[-1].ival) == H5T_STR_NULLTERM_TOKEN)
+ str_pad = H5T_STR_NULLTERM;
+ else if ((yyvsp[-1].ival) == H5T_STR_NULLPAD_TOKEN)
+ str_pad = H5T_STR_NULLPAD;
+ else if ((yyvsp[-1].ival) == H5T_STR_SPACEPAD_TOKEN)
+ str_pad = H5T_STR_SPACEPAD;
+ }
#line 1872 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 76:
+ case 76:
#line 289 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- if((yyvsp[-1].ival) == H5T_CSET_ASCII_TOKEN)
- str_cset = H5T_CSET_ASCII;
- else if((yyvsp[-1].ival) == H5T_CSET_UTF8_TOKEN)
- str_cset = H5T_CSET_UTF8;
- }
+ {
+ if ((yyvsp[-1].ival) == H5T_CSET_ASCII_TOKEN)
+ str_cset = H5T_CSET_ASCII;
+ else if ((yyvsp[-1].ival) == H5T_CSET_UTF8_TOKEN)
+ str_cset = H5T_CSET_UTF8;
+ }
#line 1883 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 77:
+ case 77:
#line 296 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- if((yyvsp[-1].hid) == H5T_C_S1_TOKEN)
- (yyval.hid) = H5Tcopy(H5T_C_S1);
- else if((yyvsp[-1].hid) == H5T_FORTRAN_S1_TOKEN)
- (yyval.hid) = H5Tcopy(H5T_FORTRAN_S1);
- }
+ {
+ if ((yyvsp[-1].hid) == H5T_C_S1_TOKEN)
+ (yyval.hid) = H5Tcopy(H5T_C_S1);
+ else if ((yyvsp[-1].hid) == H5T_FORTRAN_S1_TOKEN)
+ (yyval.hid) = H5Tcopy(H5T_FORTRAN_S1);
+ }
#line 1894 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 78:
+ case 78:
#line 303 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- hid_t str_id = (yyvsp[-1].hid);
-
- /*set string size*/
- if(is_variable) {
- H5Tset_size(str_id, H5T_VARIABLE);
- is_variable = 0;
- } else
- H5Tset_size(str_id, str_size);
-
- /*set string padding and character set*/
- H5Tset_strpad(str_id, str_pad);
- H5Tset_cset(str_id, str_cset);
-
- (yyval.hid) = str_id;
- }
+ {
+ hid_t str_id = (yyvsp[-1].hid);
+
+ /*set string size*/
+ if (is_variable) {
+ H5Tset_size(str_id, H5T_VARIABLE);
+ is_variable = 0;
+ }
+ else
+ H5Tset_size(str_id, str_size);
+
+ /*set string padding and character set*/
+ H5Tset_strpad(str_id, str_pad);
+ H5Tset_cset(str_id, str_cset);
+
+ (yyval.hid) = str_id;
+ }
#line 1915 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 79:
+ case 79:
#line 320 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {(yyval.ival) = H5T_VARIABLE_TOKEN;}
+ {
+ (yyval.ival) = H5T_VARIABLE_TOKEN;
+ }
#line 1921 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 81:
+ case 81:
#line 323 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {(yyval.ival) = H5T_STR_NULLTERM_TOKEN;}
+ {
+ (yyval.ival) = H5T_STR_NULLTERM_TOKEN;
+ }
#line 1927 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 82:
+ case 82:
#line 324 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {(yyval.ival) = H5T_STR_NULLPAD_TOKEN;}
+ {
+ (yyval.ival) = H5T_STR_NULLPAD_TOKEN;
+ }
#line 1933 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 83:
+ case 83:
#line 325 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;}
+ {
+ (yyval.ival) = H5T_STR_SPACEPAD_TOKEN;
+ }
#line 1939 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 84:
+ case 84:
#line 327 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {(yyval.ival) = H5T_CSET_ASCII_TOKEN;}
+ {
+ (yyval.ival) = H5T_CSET_ASCII_TOKEN;
+ }
#line 1945 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 85:
+ case 85:
#line 328 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {(yyval.ival) = H5T_CSET_UTF8_TOKEN;}
+ {
+ (yyval.ival) = H5T_CSET_UTF8_TOKEN;
+ }
#line 1951 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 86:
+ case 86:
#line 330 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {(yyval.hid) = H5T_C_S1_TOKEN;}
+ {
+ (yyval.hid) = H5T_C_S1_TOKEN;
+ }
#line 1957 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 87:
+ case 87:
#line 331 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {(yyval.hid) = H5T_FORTRAN_S1_TOKEN;}
+ {
+ (yyval.hid) = H5T_FORTRAN_S1_TOKEN;
+ }
#line 1963 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 88:
+ case 88:
#line 335 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { is_enum = 1; enum_id = H5Tenum_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); }
+ {
+ is_enum = 1;
+ enum_id = H5Tenum_create((yyvsp[-1].hid));
+ H5Tclose((yyvsp[-1].hid));
+ }
#line 1969 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 89:
+ case 89:
#line 337 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { is_enum = 0; /*reset*/ (yyval.hid) = enum_id; }
+ {
+ is_enum = 0; /*reset*/
+ (yyval.hid) = enum_id;
+ }
#line 1975 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 92:
+ case 92:
#line 342 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- is_enum_memb = 1; /*indicate member of enum*/
+ {
+ is_enum_memb = 1; /*indicate member of enum*/
#ifdef H5_HAVE_WIN32_API
- enum_memb_symbol = _strdup(yylval.sval);
-#else /* H5_HAVE_WIN32_API */
- enum_memb_symbol = strdup(yylval.sval);
-#endif /* H5_HAVE_WIN32_API */
- free(yylval.sval);
- yylval.sval = NULL;
- }
+ enum_memb_symbol = _strdup(yylval.sval);
+#else /* H5_HAVE_WIN32_API */
+ enum_memb_symbol = strdup(yylval.sval);
+#endif /* H5_HAVE_WIN32_API */
+ free(yylval.sval);
+ yylval.sval = NULL;
+ }
#line 1990 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ break;
- case 93:
+ case 93:
#line 353 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- char char_val=(char)yylval.ival;
- short short_val=(short)yylval.ival;
- int int_val=(int)yylval.ival;
- long long_val=(long)yylval.ival;
- long long llong_val=(long long)yylval.ival;
- hid_t super = H5Tget_super(enum_id);
- hid_t native = H5Tget_native_type(super, H5T_DIR_ASCEND);
- H5T_order_t super_order = H5Tget_order(super);
- H5T_order_t native_order = H5Tget_order(native);
-
- if(is_enum && is_enum_memb) { /*if it's an enum member*/
- /*To handle machines of different endianness*/
- if(H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) {
- if(super_order != native_order)
- H5Tconvert(native, super, 1, &char_val, NULL, H5P_DEFAULT);
- H5Tenum_insert(enum_id, enum_memb_symbol, &char_val);
- } else if(H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT)) {
- if(super_order != native_order)
- H5Tconvert(native, super, 1, &short_val, NULL, H5P_DEFAULT);
- H5Tenum_insert(enum_id, enum_memb_symbol, &short_val);
- } else if(H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT)) {
- if(super_order != native_order)
- H5Tconvert(native, super, 1, &int_val, NULL, H5P_DEFAULT);
- H5Tenum_insert(enum_id, enum_memb_symbol, &int_val);
- } else if(H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG)) {
- if(super_order != native_order)
- H5Tconvert(native, super, 1, &long_val, NULL, H5P_DEFAULT);
- H5Tenum_insert(enum_id, enum_memb_symbol, &long_val);
- } else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) {
- if(super_order != native_order)
- H5Tconvert(native, super, 1, &llong_val, NULL, H5P_DEFAULT);
- H5Tenum_insert(enum_id, enum_memb_symbol, &llong_val);
- }
-
- is_enum_memb = 0;
- if(enum_memb_symbol) free(enum_memb_symbol);
- }
-
- H5Tclose(super);
- H5Tclose(native);
- }
-#line 2037 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- break;
+ {
+ char char_val = (char)yylval.ival;
+ short short_val = (short)yylval.ival;
+ int int_val = (int)yylval.ival;
+ long long_val = (long)yylval.ival;
+ long long llong_val = (long long)yylval.ival;
+ hid_t super = H5Tget_super(enum_id);
+ hid_t native = H5Tget_native_type(super, H5T_DIR_ASCEND);
+ H5T_order_t super_order = H5Tget_order(super);
+ H5T_order_t native_order = H5Tget_order(native);
+
+ if (is_enum && is_enum_memb) { /*if it's an enum member*/
+ /*To handle machines of different endianness*/
+ if (H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) {
+ if (super_order != native_order)
+ H5Tconvert(native, super, 1, &char_val, NULL, H5P_DEFAULT);
+ H5Tenum_insert(enum_id, enum_memb_symbol, &char_val);
+ }
+ else if (H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT)) {
+ if (super_order != native_order)
+ H5Tconvert(native, super, 1, &short_val, NULL, H5P_DEFAULT);
+ H5Tenum_insert(enum_id, enum_memb_symbol, &short_val);
+ }
+ else if (H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT)) {
+ if (super_order != native_order)
+ H5Tconvert(native, super, 1, &int_val, NULL, H5P_DEFAULT);
+ H5Tenum_insert(enum_id, enum_memb_symbol, &int_val);
+ }
+ else if (H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG)) {
+ if (super_order != native_order)
+ H5Tconvert(native, super, 1, &long_val, NULL, H5P_DEFAULT);
+ H5Tenum_insert(enum_id, enum_memb_symbol, &long_val);
+ }
+ else if (H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) {
+ if (super_order != native_order)
+ H5Tconvert(native, super, 1, &llong_val, NULL, H5P_DEFAULT);
+ H5Tenum_insert(enum_id, enum_memb_symbol, &llong_val);
+ }
+ is_enum_memb = 0;
+ if (enum_memb_symbol)
+ free(enum_memb_symbol);
+ }
+
+ H5Tclose(super);
+ H5Tclose(native);
+ }
+#line 2037 "hl/src/H5LTparse.c" /* yacc.c:1646 */
+ break;
#line 2041 "hl/src/H5LTparse.c" /* yacc.c:1646 */
- default: break;
+ default:
+ break;
}
- /* User semantic actions sometimes alter yychar, and that requires
- that yytoken be updated with the new translation. We take the
- approach of translating immediately before every use of yytoken.
- One alternative is translating here after every semantic action,
- but that translation would be missed if the semantic action invokes
- YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
- if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
- incorrect destructor might then be invoked immediately. In the
- case of YYERROR or YYBACKUP, subsequent parser actions might lead
- to an incorrect destructor call or verbose syntax error message
- before the lookahead is translated. */
- YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
-
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
-
- *++yyvsp = yyval;
-
- /* Now 'shift' the result of the reduction. Determine what state
- that goes to, based on the state we popped back to and the rule
- number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
-
- goto yynewstate;
-
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
+ YY_SYMBOL_PRINT("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+ YYPOPSTACK(yylen);
+ yylen = 0;
+ YY_STACK_PRINT(yyss, yyssp);
+
+ *++yyvsp = yyval;
+
+ /* Now 'shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+ number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTOKENS];
+
+ goto yynewstate;
/*--------------------------------------.
| yyerrlab -- here on detecting error. |
`--------------------------------------*/
yyerrlab:
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
-
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus)
- {
- ++yynerrs;
-#if ! YYERROR_VERBOSE
- yyerror (YY_("syntax error"));
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE(yychar);
+
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus) {
+ ++yynerrs;
+#if !YYERROR_VERBOSE
+ yyerror(YY_("syntax error"));
#else
-# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
- yyssp, yytoken)
- {
- char const *yymsgp = YY_("syntax error");
- int yysyntax_error_status;
- yysyntax_error_status = YYSYNTAX_ERROR;
- if (yysyntax_error_status == 0)
- yymsgp = yymsg;
- else if (yysyntax_error_status == 1)
- {
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
- if (!yymsg)
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- yysyntax_error_status = 2;
- }
- else
- {
- yysyntax_error_status = YYSYNTAX_ERROR;
+#define YYSYNTAX_ERROR yysyntax_error(&yymsg_alloc, &yymsg, yyssp, yytoken)
+ {
+ char const *yymsgp = YY_("syntax error");
+ int yysyntax_error_status;
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ if (yysyntax_error_status == 0)
yymsgp = yymsg;
- }
- }
- yyerror (yymsgp);
- if (yysyntax_error_status == 2)
- goto yyexhaustedlab;
- }
-# undef YYSYNTAX_ERROR
+ else if (yysyntax_error_status == 1) {
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE(yymsg);
+ yymsg = (char *)YYSTACK_ALLOC(yymsg_alloc);
+ if (!yymsg) {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ yysyntax_error_status = 2;
+ }
+ else {
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ yymsgp = yymsg;
+ }
+ }
+ yyerror(yymsgp);
+ if (yysyntax_error_status == 2)
+ goto yyexhaustedlab;
+ }
+#undef YYSYNTAX_ERROR
#endif
}
+ if (yyerrstatus == 3) {
+ /* If just tried and failed to reuse lookahead token after an
+ error, discard it. */
-
- if (yyerrstatus == 3)
- {
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
-
- if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
+ if (yychar <= YYEOF) {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
}
- else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval);
- yychar = YYEMPTY;
+ else {
+ yydestruct("Error: discarding", yytoken, &yylval);
+ yychar = YYEMPTY;
}
}
- /* Else will try to reuse lookahead token after shifting the error
- token. */
- goto yyerrlab1;
-
+ /* Else will try to reuse lookahead token after shifting the error
+ token. */
+ goto yyerrlab1;
/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
-
- /* Do not reclaim the symbols of the rule whose action triggered
- this YYERROR. */
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
- yystate = *yyssp;
- goto yyerrlab1;
+ /* Pacify compilers like GCC when the user code never invokes
+ YYERROR and the label yyerrorlab therefore never appears in user
+ code. */
+ if (/*CONSTCOND*/ 0)
+ goto yyerrorlab;
+ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYERROR. */
+ YYPOPSTACK(yylen);
+ yylen = 0;
+ YY_STACK_PRINT(yyss, yyssp);
+ yystate = *yyssp;
+ goto yyerrlab1;
/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
-
- for (;;)
- {
- yyn = yypact[yystate];
- if (!yypact_value_is_default (yyn))
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
+
+ for (;;) {
+ yyn = yypact[yystate];
+ if (!yypact_value_is_default(yyn)) {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
}
}
- /* Pop the current state because it cannot handle the error token. */
- if (yyssp == yyss)
- YYABORT;
-
+ /* Pop the current state because it cannot handle the error token. */
+ if (yyssp == yyss)
+ YYABORT;
- yydestruct ("Error: popping",
- yystos[yystate], yyvsp);
- YYPOPSTACK (1);
- yystate = *yyssp;
- YY_STACK_PRINT (yyss, yyssp);
+ yydestruct("Error: popping", yystos[yystate], yyvsp);
+ YYPOPSTACK(1);
+ yystate = *yyssp;
+ YY_STACK_PRINT(yyss, yyssp);
}
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- *++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
-
-
- /* Shift the error token. */
- YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
- yystate = yyn;
- goto yynewstate;
+ /* Shift the error token. */
+ YY_SYMBOL_PRINT("Shifting", yystos[yyn], yyvsp, yylsp);
+ yystate = yyn;
+ goto yynewstate;
/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here. |
`-------------------------------------*/
yyacceptlab:
- yyresult = 0;
- goto yyreturn;
+ yyresult = 0;
+ goto yyreturn;
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
yyabortlab:
- yyresult = 1;
- goto yyreturn;
+ yyresult = 1;
+ goto yyreturn;
#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
yyexhaustedlab:
- yyerror (YY_("memory exhausted"));
- yyresult = 2;
- /* Fall through. */
+ yyerror(YY_("memory exhausted"));
+ yyresult = 2;
+ /* Fall through. */
#endif
yyreturn:
- if (yychar != YYEMPTY)
- {
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = YYTRANSLATE (yychar);
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval);
+ if (yychar != YYEMPTY) {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE(yychar);
+ yydestruct("Cleanup: discarding lookahead", yytoken, &yylval);
}
- /* Do not reclaim the symbols of the rule whose action triggered
- this YYABORT or YYACCEPT. */
- YYPOPSTACK (yylen);
- YY_STACK_PRINT (yyss, yyssp);
- while (yyssp != yyss)
- {
- yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp);
- YYPOPSTACK (1);
+ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYABORT or YYACCEPT. */
+ YYPOPSTACK(yylen);
+ YY_STACK_PRINT(yyss, yyssp);
+ while (yyssp != yyss) {
+ yydestruct("Cleanup: popping", yystos[*yyssp], yyvsp);
+ YYPOPSTACK(1);
}
#ifndef yyoverflow
- if (yyss != yyssa)
- YYSTACK_FREE (yyss);
+ if (yyss != yyssa)
+ YYSTACK_FREE(yyss);
#endif
#if YYERROR_VERBOSE
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE(yymsg);
#endif
- return yyresult;
+ return yyresult;
}
diff --git a/hl/src/H5LTparse.h b/hl/src/H5LTparse.h
index e38116a..4855f42 100644
--- a/hl/src/H5LTparse.h
+++ b/hl/src/H5LTparse.h
@@ -31,10 +31,10 @@
version 2.2 of Bison. */
#ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED
-# define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED
+#define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
-# define YYDEBUG 0
+#define YYDEBUG 0
#endif
#if YYDEBUG
extern int H5LTyydebug;
@@ -42,90 +42,87 @@ extern int H5LTyydebug;
/* Token type. */
#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- enum yytokentype
- {
- H5T_STD_I8BE_TOKEN = 258,
- H5T_STD_I8LE_TOKEN = 259,
- H5T_STD_I16BE_TOKEN = 260,
- H5T_STD_I16LE_TOKEN = 261,
- H5T_STD_I32BE_TOKEN = 262,
- H5T_STD_I32LE_TOKEN = 263,
- H5T_STD_I64BE_TOKEN = 264,
- H5T_STD_I64LE_TOKEN = 265,
- H5T_STD_U8BE_TOKEN = 266,
- H5T_STD_U8LE_TOKEN = 267,
- H5T_STD_U16BE_TOKEN = 268,
- H5T_STD_U16LE_TOKEN = 269,
- H5T_STD_U32BE_TOKEN = 270,
- H5T_STD_U32LE_TOKEN = 271,
- H5T_STD_U64BE_TOKEN = 272,
- H5T_STD_U64LE_TOKEN = 273,
- H5T_NATIVE_CHAR_TOKEN = 274,
- H5T_NATIVE_SCHAR_TOKEN = 275,
- H5T_NATIVE_UCHAR_TOKEN = 276,
- H5T_NATIVE_SHORT_TOKEN = 277,
- H5T_NATIVE_USHORT_TOKEN = 278,
- H5T_NATIVE_INT_TOKEN = 279,
- H5T_NATIVE_UINT_TOKEN = 280,
- H5T_NATIVE_LONG_TOKEN = 281,
- H5T_NATIVE_ULONG_TOKEN = 282,
- H5T_NATIVE_LLONG_TOKEN = 283,
- H5T_NATIVE_ULLONG_TOKEN = 284,
- H5T_IEEE_F32BE_TOKEN = 285,
- H5T_IEEE_F32LE_TOKEN = 286,
- H5T_IEEE_F64BE_TOKEN = 287,
- H5T_IEEE_F64LE_TOKEN = 288,
- H5T_NATIVE_FLOAT_TOKEN = 289,
- H5T_NATIVE_DOUBLE_TOKEN = 290,
+#define YYTOKENTYPE
+enum yytokentype {
+ H5T_STD_I8BE_TOKEN = 258,
+ H5T_STD_I8LE_TOKEN = 259,
+ H5T_STD_I16BE_TOKEN = 260,
+ H5T_STD_I16LE_TOKEN = 261,
+ H5T_STD_I32BE_TOKEN = 262,
+ H5T_STD_I32LE_TOKEN = 263,
+ H5T_STD_I64BE_TOKEN = 264,
+ H5T_STD_I64LE_TOKEN = 265,
+ H5T_STD_U8BE_TOKEN = 266,
+ H5T_STD_U8LE_TOKEN = 267,
+ H5T_STD_U16BE_TOKEN = 268,
+ H5T_STD_U16LE_TOKEN = 269,
+ H5T_STD_U32BE_TOKEN = 270,
+ H5T_STD_U32LE_TOKEN = 271,
+ H5T_STD_U64BE_TOKEN = 272,
+ H5T_STD_U64LE_TOKEN = 273,
+ H5T_NATIVE_CHAR_TOKEN = 274,
+ H5T_NATIVE_SCHAR_TOKEN = 275,
+ H5T_NATIVE_UCHAR_TOKEN = 276,
+ H5T_NATIVE_SHORT_TOKEN = 277,
+ H5T_NATIVE_USHORT_TOKEN = 278,
+ H5T_NATIVE_INT_TOKEN = 279,
+ H5T_NATIVE_UINT_TOKEN = 280,
+ H5T_NATIVE_LONG_TOKEN = 281,
+ H5T_NATIVE_ULONG_TOKEN = 282,
+ H5T_NATIVE_LLONG_TOKEN = 283,
+ H5T_NATIVE_ULLONG_TOKEN = 284,
+ H5T_IEEE_F32BE_TOKEN = 285,
+ H5T_IEEE_F32LE_TOKEN = 286,
+ H5T_IEEE_F64BE_TOKEN = 287,
+ H5T_IEEE_F64LE_TOKEN = 288,
+ H5T_NATIVE_FLOAT_TOKEN = 289,
+ H5T_NATIVE_DOUBLE_TOKEN = 290,
H5T_NATIVE_LDOUBLE_TOKEN = 291,
- H5T_STRING_TOKEN = 292,
- STRSIZE_TOKEN = 293,
- STRPAD_TOKEN = 294,
- CSET_TOKEN = 295,
- CTYPE_TOKEN = 296,
- H5T_VARIABLE_TOKEN = 297,
- H5T_STR_NULLTERM_TOKEN = 298,
- H5T_STR_NULLPAD_TOKEN = 299,
- H5T_STR_SPACEPAD_TOKEN = 300,
- H5T_CSET_ASCII_TOKEN = 301,
- H5T_CSET_UTF8_TOKEN = 302,
- H5T_C_S1_TOKEN = 303,
- H5T_FORTRAN_S1_TOKEN = 304,
- H5T_OPAQUE_TOKEN = 305,
- OPQ_SIZE_TOKEN = 306,
- OPQ_TAG_TOKEN = 307,
- H5T_COMPOUND_TOKEN = 308,
- H5T_ENUM_TOKEN = 309,
- H5T_ARRAY_TOKEN = 310,
- H5T_VLEN_TOKEN = 311,
- STRING = 312,
- NUMBER = 313
- };
+ H5T_STRING_TOKEN = 292,
+ STRSIZE_TOKEN = 293,
+ STRPAD_TOKEN = 294,
+ CSET_TOKEN = 295,
+ CTYPE_TOKEN = 296,
+ H5T_VARIABLE_TOKEN = 297,
+ H5T_STR_NULLTERM_TOKEN = 298,
+ H5T_STR_NULLPAD_TOKEN = 299,
+ H5T_STR_SPACEPAD_TOKEN = 300,
+ H5T_CSET_ASCII_TOKEN = 301,
+ H5T_CSET_UTF8_TOKEN = 302,
+ H5T_C_S1_TOKEN = 303,
+ H5T_FORTRAN_S1_TOKEN = 304,
+ H5T_OPAQUE_TOKEN = 305,
+ OPQ_SIZE_TOKEN = 306,
+ OPQ_TAG_TOKEN = 307,
+ H5T_COMPOUND_TOKEN = 308,
+ H5T_ENUM_TOKEN = 309,
+ H5T_ARRAY_TOKEN = 310,
+ H5T_VLEN_TOKEN = 311,
+ STRING = 312,
+ NUMBER = 313
+};
#endif
/* Value type. */
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+#if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED
-union YYSTYPE
-{
+union YYSTYPE {
#line 72 "hl/src/H5LTparse.y" /* yacc.c:1909 */
- int ival; /*for integer token*/
- char *sval; /*for name string*/
- hid_t hid; /*for hid_t token*/
+ int ival; /*for integer token*/
+ char *sval; /*for name string*/
+ hid_t hid; /*for hid_t token*/
#line 119 "hl/src/H5LTparse.h" /* yacc.c:1909 */
};
typedef union YYSTYPE YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define YYSTYPE_IS_DECLARED 1
+#define YYSTYPE_IS_TRIVIAL 1
+#define YYSTYPE_IS_DECLARED 1
#endif
-
extern YYSTYPE H5LTyylval;
-int H5LTyyparse (void);
+int H5LTyyparse(void);
#endif /* !YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED */
diff --git a/hl/src/H5LTprivate.h b/hl/src/H5LTprivate.h
index 01c5ee6..0200725 100644
--- a/hl/src/H5LTprivate.h
+++ b/hl/src/H5LTprivate.h
@@ -25,26 +25,17 @@
*-------------------------------------------------------------------------
*/
-H5_HLDLL herr_t H5LT_get_attribute_disk( hid_t obj_id,
- const char *attr_name,
- void *data );
+H5_HLDLL herr_t H5LT_get_attribute_disk(hid_t obj_id, const char *attr_name, void *data);
-H5_HLDLL herr_t H5LT_set_attribute_numerical( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- size_t size,
- hid_t type_id,
- const void *data );
+H5_HLDLL herr_t H5LT_set_attribute_numerical(hid_t loc_id, const char *obj_name, const char *attr_name,
+ size_t size, hid_t type_id, const void *data);
-H5_HLDLL herr_t H5LT_set_attribute_string( hid_t dset_id,
- const char *name,
- const char *buf );
+H5_HLDLL herr_t H5LT_set_attribute_string(hid_t dset_id, const char *name, const char *buf);
-H5_HLDLL herr_t H5LT_find_attribute( hid_t loc_id, const char *name );
+H5_HLDLL herr_t H5LT_find_attribute(hid_t loc_id, const char *name);
-
-H5_HLDLL char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang,
- size_t *slen, hbool_t no_user_buf);
+H5_HLDLL char *H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen,
+ hbool_t no_user_buf);
H5_HLDLL hid_t H5LTyyparse(void);
diff --git a/hl/src/H5LTpublic.h b/hl/src/H5LTpublic.h
index 6df7c4b..97129bf 100644
--- a/hl/src/H5LTpublic.h
+++ b/hl/src/H5LTpublic.h
@@ -15,13 +15,13 @@
#define _H5LTpublic_H
/* Flag definitions for H5LTopen_file_image() */
-#define H5LT_FILE_IMAGE_OPEN_RW 0x0001 /* Open image for read-write */
-#define H5LT_FILE_IMAGE_DONT_COPY 0x0002 /* The HDF5 lib won't copy */
+#define H5LT_FILE_IMAGE_OPEN_RW 0x0001 /* Open image for read-write */
+#define H5LT_FILE_IMAGE_DONT_COPY 0x0002 /* The HDF5 lib won't copy */
/* user supplied image buffer. The same image is open with the core driver. */
#define H5LT_FILE_IMAGE_DONT_RELEASE 0x0004 /* The HDF5 lib won't */
/* deallocate user supplied image buffer. The user application is reponsible */
/* for doing so. */
-#define H5LT_FILE_IMAGE_ALL 0x0007
+#define H5LT_FILE_IMAGE_ALL 0x0007
typedef enum H5LT_lang_t {
H5LT_LANG_ERR = -1, /*this is the first*/
@@ -42,53 +42,28 @@ extern "C" {
*-------------------------------------------------------------------------
*/
-H5_HLDLL herr_t H5LTmake_dataset( hid_t loc_id,
- const char *dset_name,
- int rank,
- const hsize_t *dims,
- hid_t type_id,
- const void *buffer );
-
-H5_HLDLL herr_t H5LTmake_dataset_char( hid_t loc_id,
- const char *dset_name,
- int rank,
- const hsize_t *dims,
- const char *buffer );
-
-H5_HLDLL herr_t H5LTmake_dataset_short( hid_t loc_id,
- const char *dset_name,
- int rank,
- const hsize_t *dims,
- const short *buffer );
-
-H5_HLDLL herr_t H5LTmake_dataset_int( hid_t loc_id,
- const char *dset_name,
- int rank,
- const hsize_t *dims,
- const int *buffer );
-
-H5_HLDLL herr_t H5LTmake_dataset_long( hid_t loc_id,
- const char *dset_name,
- int rank,
- const hsize_t *dims,
- const long *buffer );
-
-H5_HLDLL herr_t H5LTmake_dataset_float( hid_t loc_id,
- const char *dset_name,
- int rank,
- const hsize_t *dims,
- const float *buffer );
-
-H5_HLDLL herr_t H5LTmake_dataset_double( hid_t loc_id,
- const char *dset_name,
- int rank,
- const hsize_t *dims,
- const double *buffer );
-
-H5_HLDLL herr_t H5LTmake_dataset_string( hid_t loc_id,
- const char *dset_name,
- const char *buf );
+H5_HLDLL herr_t H5LTmake_dataset(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims,
+ hid_t type_id, const void *buffer);
+H5_HLDLL herr_t H5LTmake_dataset_char(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims,
+ const char *buffer);
+
+H5_HLDLL herr_t H5LTmake_dataset_short(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims,
+ const short *buffer);
+
+H5_HLDLL herr_t H5LTmake_dataset_int(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims,
+ const int *buffer);
+
+H5_HLDLL herr_t H5LTmake_dataset_long(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims,
+ const long *buffer);
+
+H5_HLDLL herr_t H5LTmake_dataset_float(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims,
+ const float *buffer);
+
+H5_HLDLL herr_t H5LTmake_dataset_double(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims,
+ const double *buffer);
+
+H5_HLDLL herr_t H5LTmake_dataset_string(hid_t loc_id, const char *dset_name, const char *buf);
/*-------------------------------------------------------------------------
*
@@ -97,38 +72,21 @@ H5_HLDLL herr_t H5LTmake_dataset_string( hid_t loc_id,
*-------------------------------------------------------------------------
*/
-H5_HLDLL herr_t H5LTread_dataset( hid_t loc_id,
- const char *dset_name,
- hid_t type_id,
- void *buffer );
+H5_HLDLL herr_t H5LTread_dataset(hid_t loc_id, const char *dset_name, hid_t type_id, void *buffer);
-H5_HLDLL herr_t H5LTread_dataset_char( hid_t loc_id,
- const char *dset_name,
- char *buffer );
+H5_HLDLL herr_t H5LTread_dataset_char(hid_t loc_id, const char *dset_name, char *buffer);
-H5_HLDLL herr_t H5LTread_dataset_short( hid_t loc_id,
- const char *dset_name,
- short *buffer );
+H5_HLDLL herr_t H5LTread_dataset_short(hid_t loc_id, const char *dset_name, short *buffer);
-H5_HLDLL herr_t H5LTread_dataset_int( hid_t loc_id,
- const char *dset_name,
- int *buffer );
+H5_HLDLL herr_t H5LTread_dataset_int(hid_t loc_id, const char *dset_name, int *buffer);
-H5_HLDLL herr_t H5LTread_dataset_long( hid_t loc_id,
- const char *dset_name,
- long *buffer );
+H5_HLDLL herr_t H5LTread_dataset_long(hid_t loc_id, const char *dset_name, long *buffer);
-H5_HLDLL herr_t H5LTread_dataset_float( hid_t loc_id,
- const char *dset_name,
- float *buffer );
+H5_HLDLL herr_t H5LTread_dataset_float(hid_t loc_id, const char *dset_name, float *buffer);
-H5_HLDLL herr_t H5LTread_dataset_double( hid_t loc_id,
- const char *dset_name,
- double *buffer );
+H5_HLDLL herr_t H5LTread_dataset_double(hid_t loc_id, const char *dset_name, double *buffer);
-H5_HLDLL herr_t H5LTread_dataset_string( hid_t loc_id,
- const char *dset_name,
- char *buf );
+H5_HLDLL herr_t H5LTread_dataset_string(hid_t loc_id, const char *dset_name, char *buf);
/*-------------------------------------------------------------------------
*
@@ -137,20 +95,12 @@ H5_HLDLL herr_t H5LTread_dataset_string( hid_t loc_id,
*-------------------------------------------------------------------------
*/
+H5_HLDLL herr_t H5LTget_dataset_ndims(hid_t loc_id, const char *dset_name, int *rank);
-H5_HLDLL herr_t H5LTget_dataset_ndims( hid_t loc_id,
- const char *dset_name,
- int *rank );
-
-H5_HLDLL herr_t H5LTget_dataset_info( hid_t loc_id,
- const char *dset_name,
- hsize_t *dims,
- H5T_class_t *type_class,
- size_t *type_size );
-
-H5_HLDLL herr_t H5LTfind_dataset( hid_t loc_id, const char *name );
-
+H5_HLDLL herr_t H5LTget_dataset_info(hid_t loc_id, const char *dset_name, hsize_t *dims,
+ H5T_class_t *type_class, size_t *type_size);
+H5_HLDLL herr_t H5LTfind_dataset(hid_t loc_id, const char *name);
/*-------------------------------------------------------------------------
*
@@ -159,77 +109,41 @@ H5_HLDLL herr_t H5LTfind_dataset( hid_t loc_id, const char *name );
*-------------------------------------------------------------------------
*/
+H5_HLDLL herr_t H5LTset_attribute_string(hid_t loc_id, const char *obj_name, const char *attr_name,
+ const char *attr_data);
+
+H5_HLDLL herr_t H5LTset_attribute_char(hid_t loc_id, const char *obj_name, const char *attr_name,
+ const char *buffer, size_t size);
+
+H5_HLDLL herr_t H5LTset_attribute_uchar(hid_t loc_id, const char *obj_name, const char *attr_name,
+ const unsigned char *buffer, size_t size);
+
+H5_HLDLL herr_t H5LTset_attribute_short(hid_t loc_id, const char *obj_name, const char *attr_name,
+ const short *buffer, size_t size);
+
+H5_HLDLL herr_t H5LTset_attribute_ushort(hid_t loc_id, const char *obj_name, const char *attr_name,
+ const unsigned short *buffer, size_t size);
+
+H5_HLDLL herr_t H5LTset_attribute_int(hid_t loc_id, const char *obj_name, const char *attr_name,
+ const int *buffer, size_t size);
+
+H5_HLDLL herr_t H5LTset_attribute_uint(hid_t loc_id, const char *obj_name, const char *attr_name,
+ const unsigned int *buffer, size_t size);
+
+H5_HLDLL herr_t H5LTset_attribute_long(hid_t loc_id, const char *obj_name, const char *attr_name,
+ const long *buffer, size_t size);
+
+H5_HLDLL herr_t H5LTset_attribute_long_long(hid_t loc_id, const char *obj_name, const char *attr_name,
+ const long long *buffer, size_t size);
+
+H5_HLDLL herr_t H5LTset_attribute_ulong(hid_t loc_id, const char *obj_name, const char *attr_name,
+ const unsigned long *buffer, size_t size);
+
+H5_HLDLL herr_t H5LTset_attribute_float(hid_t loc_id, const char *obj_name, const char *attr_name,
+ const float *buffer, size_t size);
-H5_HLDLL herr_t H5LTset_attribute_string( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const char *attr_data );
-
-H5_HLDLL herr_t H5LTset_attribute_char( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const char *buffer,
- size_t size );
-
-H5_HLDLL herr_t H5LTset_attribute_uchar( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const unsigned char *buffer,
- size_t size );
-
-H5_HLDLL herr_t H5LTset_attribute_short( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const short *buffer,
- size_t size );
-
-H5_HLDLL herr_t H5LTset_attribute_ushort( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const unsigned short *buffer,
- size_t size );
-
-H5_HLDLL herr_t H5LTset_attribute_int( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const int *buffer,
- size_t size );
-
-H5_HLDLL herr_t H5LTset_attribute_uint( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const unsigned int *buffer,
- size_t size );
-
-H5_HLDLL herr_t H5LTset_attribute_long( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const long *buffer,
- size_t size );
-
-H5_HLDLL herr_t H5LTset_attribute_long_long( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const long long *buffer,
- size_t size );
-
-H5_HLDLL herr_t H5LTset_attribute_ulong( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const unsigned long *buffer,
- size_t size );
-
-H5_HLDLL herr_t H5LTset_attribute_float( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const float *buffer,
- size_t size );
-
-H5_HLDLL herr_t H5LTset_attribute_double( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- const double *buffer,
- size_t size );
+H5_HLDLL herr_t H5LTset_attribute_double(hid_t loc_id, const char *obj_name, const char *attr_name,
+ const double *buffer, size_t size);
/*-------------------------------------------------------------------------
*
@@ -238,72 +152,41 @@ H5_HLDLL herr_t H5LTset_attribute_double( hid_t loc_id,
*-------------------------------------------------------------------------
*/
-H5_HLDLL herr_t H5LTget_attribute( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- hid_t mem_type_id,
- void *data );
-
-H5_HLDLL herr_t H5LTget_attribute_string( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- char *data );
-
-H5_HLDLL herr_t H5LTget_attribute_char( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- char *data );
-
-H5_HLDLL herr_t H5LTget_attribute_uchar( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- unsigned char *data );
-
-H5_HLDLL herr_t H5LTget_attribute_short( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- short *data );
-
-H5_HLDLL herr_t H5LTget_attribute_ushort( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- unsigned short *data );
-
-H5_HLDLL herr_t H5LTget_attribute_int( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- int *data );
-
-H5_HLDLL herr_t H5LTget_attribute_uint( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- unsigned int *data );
-
-H5_HLDLL herr_t H5LTget_attribute_long( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- long *data );
-
-H5_HLDLL herr_t H5LTget_attribute_long_long( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- long long *data );
-
-H5_HLDLL herr_t H5LTget_attribute_ulong( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- unsigned long *data );
-
-H5_HLDLL herr_t H5LTget_attribute_float( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- float *data );
-
-H5_HLDLL herr_t H5LTget_attribute_double( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- double *data );
+H5_HLDLL herr_t H5LTget_attribute(hid_t loc_id, const char *obj_name, const char *attr_name,
+ hid_t mem_type_id, void *data);
+H5_HLDLL herr_t H5LTget_attribute_string(hid_t loc_id, const char *obj_name, const char *attr_name,
+ char *data);
+
+H5_HLDLL herr_t H5LTget_attribute_char(hid_t loc_id, const char *obj_name, const char *attr_name, char *data);
+
+H5_HLDLL herr_t H5LTget_attribute_uchar(hid_t loc_id, const char *obj_name, const char *attr_name,
+ unsigned char *data);
+
+H5_HLDLL herr_t H5LTget_attribute_short(hid_t loc_id, const char *obj_name, const char *attr_name,
+ short *data);
+
+H5_HLDLL herr_t H5LTget_attribute_ushort(hid_t loc_id, const char *obj_name, const char *attr_name,
+ unsigned short *data);
+
+H5_HLDLL herr_t H5LTget_attribute_int(hid_t loc_id, const char *obj_name, const char *attr_name, int *data);
+
+H5_HLDLL herr_t H5LTget_attribute_uint(hid_t loc_id, const char *obj_name, const char *attr_name,
+ unsigned int *data);
+
+H5_HLDLL herr_t H5LTget_attribute_long(hid_t loc_id, const char *obj_name, const char *attr_name, long *data);
+
+H5_HLDLL herr_t H5LTget_attribute_long_long(hid_t loc_id, const char *obj_name, const char *attr_name,
+ long long *data);
+
+H5_HLDLL herr_t H5LTget_attribute_ulong(hid_t loc_id, const char *obj_name, const char *attr_name,
+ unsigned long *data);
+
+H5_HLDLL herr_t H5LTget_attribute_float(hid_t loc_id, const char *obj_name, const char *attr_name,
+ float *data);
+
+H5_HLDLL herr_t H5LTget_attribute_double(hid_t loc_id, const char *obj_name, const char *attr_name,
+ double *data);
/*-------------------------------------------------------------------------
*
@@ -312,22 +195,10 @@ H5_HLDLL herr_t H5LTget_attribute_double( hid_t loc_id,
*-------------------------------------------------------------------------
*/
+H5_HLDLL herr_t H5LTget_attribute_ndims(hid_t loc_id, const char *obj_name, const char *attr_name, int *rank);
-H5_HLDLL herr_t H5LTget_attribute_ndims( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- int *rank );
-
-H5_HLDLL herr_t H5LTget_attribute_info( hid_t loc_id,
- const char *obj_name,
- const char *attr_name,
- hsize_t *dims,
- H5T_class_t *type_class,
- size_t *type_size );
-
-
-
-
+H5_HLDLL herr_t H5LTget_attribute_info(hid_t loc_id, const char *obj_name, const char *attr_name,
+ hsize_t *dims, H5T_class_t *type_class, size_t *type_size);
/*-------------------------------------------------------------------------
*
@@ -336,10 +207,9 @@ H5_HLDLL herr_t H5LTget_attribute_info( hid_t loc_id,
*-------------------------------------------------------------------------
*/
-H5_HLDLL hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type);
+H5_HLDLL hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type);
H5_HLDLL herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *len);
-
/*-------------------------------------------------------------------------
*
* Utility functions
@@ -347,7 +217,7 @@ H5_HLDLL herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type,
*-------------------------------------------------------------------------
*/
-H5_HLDLL herr_t H5LTfind_attribute( hid_t loc_id, const char *name );
+H5_HLDLL herr_t H5LTfind_attribute(hid_t loc_id, const char *name);
H5_HLDLL htri_t H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid);
@@ -365,4 +235,3 @@ H5_HLDLL hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flag
#endif
#endif
-
diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c
index fa77ae1..7e18d33 100644
--- a/hl/src/H5PT.c
+++ b/hl/src/H5PT.c
@@ -16,22 +16,21 @@
/* Packet Table private data */
-typedef struct
-{
- hid_t dset_id; /* The ID of the dataset containing this table */
- hid_t type_id; /* The ID of the packet table's native datatype */
- hsize_t current_index; /* The index of the packet that get_next_packet will read next */
- hsize_t size; /* The number of packets currently contained in this table */
+typedef struct {
+ hid_t dset_id; /* The ID of the dataset containing this table */
+ hid_t type_id; /* The ID of the packet table's native datatype */
+ hsize_t current_index; /* The index of the packet that get_next_packet will read next */
+ hsize_t size; /* The number of packets currently contained in this table */
} htbl_t;
-static hsize_t H5PT_ptable_count = 0;
+static hsize_t H5PT_ptable_count = 0;
static H5I_type_t H5PT_ptable_id_type = H5I_UNINIT;
#define H5PT_HASH_TABLE_SIZE 64
/* Packet Table private functions */
static herr_t H5PT_free_id(void *id);
-static herr_t H5PT_close( htbl_t* table );
+static herr_t H5PT_close(htbl_t *table);
static herr_t H5PT_create_index(htbl_t *table_id);
static herr_t H5PT_set_index(htbl_t *table_id, hsize_t pt_index);
static herr_t H5PT_get_index(htbl_t *table_id, hsize_t *pt_index);
@@ -69,109 +68,105 @@ static herr_t H5PT_get_index(htbl_t *table_id, hsize_t *pt_index);
*
*-------------------------------------------------------------------------
*/
-hid_t H5PTcreate(hid_t loc_id,
- const char *dset_name,
- hid_t dtype_id,
- hsize_t chunk_size,
- hid_t plist_id)
+hid_t
+H5PTcreate(hid_t loc_id, const char *dset_name, hid_t dtype_id, hsize_t chunk_size, hid_t plist_id)
{
- htbl_t * table = NULL;
- hid_t dset_id = H5I_INVALID_HID;
- hid_t space_id = H5I_INVALID_HID;
- hid_t plistcopy_id = H5I_INVALID_HID;
- hsize_t dims[1];
- hsize_t dims_chunk[1];
- hsize_t maxdims[1];
- hid_t ret_value = H5I_INVALID_HID;
-
- /* check the arguments */
- if (dset_name == NULL) {
- goto error;
- }
-
- /* Register the packet table ID type if this is the first table created */
- if(H5PT_ptable_id_type < 0)
- if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0)
- goto error;
-
- /* Get memory for the table identifier */
- table = (htbl_t *)HDmalloc(sizeof(htbl_t));
- if ( table == NULL ) {
- goto error;
- }
- table->dset_id = H5I_INVALID_HID;
- table->type_id = H5I_INVALID_HID;
-
- /* Create a simple data space with unlimited size */
- dims[0] = 0;
- dims_chunk[0] = chunk_size;
- maxdims[0] = H5S_UNLIMITED;
- if((space_id = H5Screate_simple(1, dims, maxdims)) < 0)
- goto error;
-
- /* Modify dataset creation properties to enable chunking */
- if (plist_id == H5P_DEFAULT) {
- plistcopy_id = H5Pcreate(H5P_DATASET_CREATE);
- }
- else {
- plistcopy_id = H5Pcopy(plist_id);
- }
- if (chunk_size > 0)
- {
- if(H5Pset_chunk(plistcopy_id, 1, dims_chunk) < 0)
- goto error;
- }
-
- /* Create the dataset. */
- if((dset_id = H5Dcreate2(loc_id, dset_name, dtype_id, space_id, H5P_DEFAULT, plistcopy_id, H5P_DEFAULT)) < 0)
- goto error;
-
- /* Create the table identifier */
- table->dset_id = dset_id;
-
- /* Terminate access to the data space. */
- if(H5Sclose(space_id) < 0)
- goto error;
-
- /* End access to the property list */
- if(H5Pclose(plistcopy_id) < 0)
- goto error;
-
- /* Make a copy of caller's datatype and save it in the table structure.
- It will be closed when the table is closed */
- if((table->type_id = H5Tcopy(dtype_id)) < 0)
- goto error;
-
- H5PT_create_index(table);
- table->size = 0;
-
- /* Get an ID for this table */
- ret_value = H5Iregister(H5PT_ptable_id_type, table);
- if(ret_value != H5I_INVALID_HID)
- H5PT_ptable_count++;
- else
- H5PT_close(table);
-
- return ret_value;
+ htbl_t *table = NULL;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ hid_t plistcopy_id = H5I_INVALID_HID;
+ hsize_t dims[1];
+ hsize_t dims_chunk[1];
+ hsize_t maxdims[1];
+ hid_t ret_value = H5I_INVALID_HID;
+
+ /* check the arguments */
+ if (dset_name == NULL) {
+ goto error;
+ }
+
+ /* Register the packet table ID type if this is the first table created */
+ if (H5PT_ptable_id_type < 0)
+ if ((H5PT_ptable_id_type =
+ H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0)
+ goto error;
+
+ /* Get memory for the table identifier */
+ table = (htbl_t *)HDmalloc(sizeof(htbl_t));
+ if (table == NULL) {
+ goto error;
+ }
+ table->dset_id = H5I_INVALID_HID;
+ table->type_id = H5I_INVALID_HID;
+
+ /* Create a simple data space with unlimited size */
+ dims[0] = 0;
+ dims_chunk[0] = chunk_size;
+ maxdims[0] = H5S_UNLIMITED;
+ if ((space_id = H5Screate_simple(1, dims, maxdims)) < 0)
+ goto error;
+
+ /* Modify dataset creation properties to enable chunking */
+ if (plist_id == H5P_DEFAULT) {
+ plistcopy_id = H5Pcreate(H5P_DATASET_CREATE);
+ }
+ else {
+ plistcopy_id = H5Pcopy(plist_id);
+ }
+ if (chunk_size > 0) {
+ if (H5Pset_chunk(plistcopy_id, 1, dims_chunk) < 0)
+ goto error;
+ }
+
+ /* Create the dataset. */
+ if ((dset_id =
+ H5Dcreate2(loc_id, dset_name, dtype_id, space_id, H5P_DEFAULT, plistcopy_id, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create the table identifier */
+ table->dset_id = dset_id;
+
+ /* Terminate access to the data space. */
+ if (H5Sclose(space_id) < 0)
+ goto error;
+
+ /* End access to the property list */
+ if (H5Pclose(plistcopy_id) < 0)
+ goto error;
+
+ /* Make a copy of caller's datatype and save it in the table structure.
+ It will be closed when the table is closed */
+ if ((table->type_id = H5Tcopy(dtype_id)) < 0)
+ goto error;
+
+ H5PT_create_index(table);
+ table->size = 0;
+
+ /* Get an ID for this table */
+ ret_value = H5Iregister(H5PT_ptable_id_type, table);
+ if (ret_value != H5I_INVALID_HID)
+ H5PT_ptable_count++;
+ else
+ H5PT_close(table);
+
+ return ret_value;
error:
if (space_id != H5I_INVALID_HID)
- H5Sclose(space_id);
+ H5Sclose(space_id);
if (plistcopy_id != H5I_INVALID_HID)
- H5Pclose(plistcopy_id);
+ H5Pclose(plistcopy_id);
if (dset_id != H5I_INVALID_HID)
- H5Dclose(dset_id);
- if (table)
- {
+ H5Dclose(dset_id);
+ if (table) {
if (table->type_id != H5I_INVALID_HID)
- H5Tclose(table->type_id);
- HDfree(table);
+ H5Tclose(table->type_id);
+ HDfree(table);
}
return ret_value;
} /* H5PTcreate */
-
/*-------------------------------------------------------------------------
* Function: H5PTcreate_fl
*
@@ -194,98 +189,95 @@ error:
*-------------------------------------------------------------------------
*/
-hid_t H5PTcreate_fl ( hid_t loc_id,
- const char *dset_name,
- hid_t dtype_id,
- hsize_t chunk_size,
- int compression )
+hid_t
+H5PTcreate_fl(hid_t loc_id, const char *dset_name, hid_t dtype_id, hsize_t chunk_size, int compression)
{
- htbl_t * table = NULL;
- hid_t dset_id = H5I_INVALID_HID;
- hid_t space_id = H5I_INVALID_HID;
- hid_t plist_id = H5I_INVALID_HID;
- hsize_t dims[1];
- hsize_t dims_chunk[1];
- hsize_t maxdims[1];
- hid_t ret_value = H5I_INVALID_HID;
-
- /* check the arguments */
- if (dset_name == NULL) {
- goto error;
- }
-
- /* Register the packet table ID type if this is the first table created */
- if(H5PT_ptable_id_type < 0)
- if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0)
- goto error;
-
- /* Get memory for the table identifier */
- table = (htbl_t *)HDmalloc(sizeof(htbl_t));
- if ( table == NULL ) {
- goto error;
- }
- table->dset_id = H5I_INVALID_HID;
- table->type_id = H5I_INVALID_HID;
-
- /* Create a simple data space with unlimited size */
- dims[0] = 0;
- dims_chunk[0] = chunk_size;
- maxdims[0] = H5S_UNLIMITED;
- if((space_id = H5Screate_simple(1, dims, maxdims)) < 0)
- goto error;
-
- /* Modify dataset creation properties to enable chunking */
- plist_id = H5Pcreate(H5P_DATASET_CREATE);
- if(H5Pset_chunk(plist_id, 1, dims_chunk) < 0)
- goto error;
- if(compression >= 0 && compression <= 9)
- if(H5Pset_deflate(plist_id, (unsigned)compression) < 0)
+ htbl_t *table = NULL;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ hid_t plist_id = H5I_INVALID_HID;
+ hsize_t dims[1];
+ hsize_t dims_chunk[1];
+ hsize_t maxdims[1];
+ hid_t ret_value = H5I_INVALID_HID;
+
+ /* check the arguments */
+ if (dset_name == NULL) {
goto error;
+ }
- /* Create the dataset. */
- if((dset_id = H5Dcreate2(loc_id, dset_name, dtype_id, space_id, H5P_DEFAULT, plist_id, H5P_DEFAULT)) < 0)
- goto error;
+ /* Register the packet table ID type if this is the first table created */
+ if (H5PT_ptable_id_type < 0)
+ if ((H5PT_ptable_id_type =
+ H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0)
+ goto error;
- /* Create the table identifier */
- table->dset_id = dset_id;
+ /* Get memory for the table identifier */
+ table = (htbl_t *)HDmalloc(sizeof(htbl_t));
+ if (table == NULL) {
+ goto error;
+ }
+ table->dset_id = H5I_INVALID_HID;
+ table->type_id = H5I_INVALID_HID;
+
+ /* Create a simple data space with unlimited size */
+ dims[0] = 0;
+ dims_chunk[0] = chunk_size;
+ maxdims[0] = H5S_UNLIMITED;
+ if ((space_id = H5Screate_simple(1, dims, maxdims)) < 0)
+ goto error;
- /* Terminate access to the data space. */
- if(H5Sclose(space_id) < 0)
- goto error;
+ /* Modify dataset creation properties to enable chunking */
+ plist_id = H5Pcreate(H5P_DATASET_CREATE);
+ if (H5Pset_chunk(plist_id, 1, dims_chunk) < 0)
+ goto error;
+ if (compression >= 0 && compression <= 9)
+ if (H5Pset_deflate(plist_id, (unsigned)compression) < 0)
+ goto error;
- /* End access to the property list */
- if(H5Pclose(plist_id) < 0)
- goto error;
+ /* Create the dataset. */
+ if ((dset_id = H5Dcreate2(loc_id, dset_name, dtype_id, space_id, H5P_DEFAULT, plist_id, H5P_DEFAULT)) < 0)
+ goto error;
- /* Make a copy of caller's datatype and save it in the table structure.
- It will be closed when the table is closed */
- if((table->type_id = H5Tcopy(dtype_id)) < 0)
- goto error;
+ /* Create the table identifier */
+ table->dset_id = dset_id;
- H5PT_create_index(table);
- table->size = 0;
+ /* Terminate access to the data space. */
+ if (H5Sclose(space_id) < 0)
+ goto error;
+
+ /* End access to the property list */
+ if (H5Pclose(plist_id) < 0)
+ goto error;
+
+ /* Make a copy of caller's datatype and save it in the table structure.
+ It will be closed when the table is closed */
+ if ((table->type_id = H5Tcopy(dtype_id)) < 0)
+ goto error;
+
+ H5PT_create_index(table);
+ table->size = 0;
- /* Get an ID for this table */
- ret_value = H5Iregister(H5PT_ptable_id_type, table);
- if(ret_value != H5I_INVALID_HID)
- H5PT_ptable_count++;
- else
- H5PT_close(table);
+ /* Get an ID for this table */
+ ret_value = H5Iregister(H5PT_ptable_id_type, table);
+ if (ret_value != H5I_INVALID_HID)
+ H5PT_ptable_count++;
+ else
+ H5PT_close(table);
- return ret_value;
+ return ret_value;
error:
if (space_id != H5I_INVALID_HID)
- H5Sclose(space_id);
+ H5Sclose(space_id);
if (plist_id != H5I_INVALID_HID)
- H5Pclose(plist_id);
+ H5Pclose(plist_id);
if (dset_id != H5I_INVALID_HID)
- H5Dclose(dset_id);
- if (table)
- {
+ H5Dclose(dset_id);
+ if (table) {
if (table->type_id != H5I_INVALID_HID)
- H5Tclose(table->type_id);
- HDfree(table);
+ H5Tclose(table->type_id);
+ HDfree(table);
}
return ret_value;
@@ -315,87 +307,87 @@ error:
*
*-------------------------------------------------------------------------
*/
-hid_t H5PTopen( hid_t loc_id,
- const char *dset_name )
+hid_t
+H5PTopen(hid_t loc_id, const char *dset_name)
{
- hid_t type_id=H5I_INVALID_HID;
- hid_t space_id=H5I_INVALID_HID;
- htbl_t * table = NULL;
- hsize_t dims[1];
- hid_t ret_value = H5I_INVALID_HID;
-
- /* check the arguments */
- if (dset_name == NULL) {
- goto error;
- }
-
- /* Register the packet table ID type if this is the first table created */
- if( H5PT_ptable_id_type < 0)
- if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0)
- goto error;
-
- table = (htbl_t *)HDmalloc(sizeof(htbl_t));
- if ( table == NULL ) {
- goto error;
- }
- table->dset_id = H5I_INVALID_HID;
- table->type_id = H5I_INVALID_HID;
-
- /* Open the dataset */
- if((table->dset_id = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
- goto error;
-
- /* Get the dataset's disk datatype */
- if((type_id = H5Dget_type(table->dset_id)) < 0)
- goto error;
-
- /* Make a copy of the datatype obtained and save it in the table structure.
- It will be closed when the table is closed */
- if((table->type_id = H5Tcopy(type_id)) < 0)
- goto error;
-
- /* Close the disk datatype */
- if(H5Tclose(type_id) < 0)
- goto error;
- type_id = H5I_INVALID_HID;
-
- /* Initialize the current record pointer */
- if((H5PT_create_index(table)) < 0)
- goto error;
-
- /* Get number of records in table */
- if((space_id=H5Dget_space(table->dset_id)) < 0)
- goto error;
- if(H5Sget_simple_extent_dims(space_id, dims, NULL) < 0)
- goto error;
- if(H5Sclose(space_id) < 0)
- goto error;
- space_id = H5I_INVALID_HID;
-
- table->size = dims[0];
-
- /* Get an ID for this table */
- ret_value = H5Iregister(H5PT_ptable_id_type, table);
-
- if(ret_value != H5I_INVALID_HID)
- H5PT_ptable_count++;
- else
- H5PT_close(table);
-
- return ret_value;
+ hid_t type_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ htbl_t *table = NULL;
+ hsize_t dims[1];
+ hid_t ret_value = H5I_INVALID_HID;
+
+ /* check the arguments */
+ if (dset_name == NULL) {
+ goto error;
+ }
+
+ /* Register the packet table ID type if this is the first table created */
+ if (H5PT_ptable_id_type < 0)
+ if ((H5PT_ptable_id_type =
+ H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0)
+ goto error;
+
+ table = (htbl_t *)HDmalloc(sizeof(htbl_t));
+ if (table == NULL) {
+ goto error;
+ }
+ table->dset_id = H5I_INVALID_HID;
+ table->type_id = H5I_INVALID_HID;
+
+ /* Open the dataset */
+ if ((table->dset_id = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Get the dataset's disk datatype */
+ if ((type_id = H5Dget_type(table->dset_id)) < 0)
+ goto error;
+
+ /* Make a copy of the datatype obtained and save it in the table structure.
+ It will be closed when the table is closed */
+ if ((table->type_id = H5Tcopy(type_id)) < 0)
+ goto error;
+
+ /* Close the disk datatype */
+ if (H5Tclose(type_id) < 0)
+ goto error;
+ type_id = H5I_INVALID_HID;
+
+ /* Initialize the current record pointer */
+ if ((H5PT_create_index(table)) < 0)
+ goto error;
+
+ /* Get number of records in table */
+ if ((space_id = H5Dget_space(table->dset_id)) < 0)
+ goto error;
+ if (H5Sget_simple_extent_dims(space_id, dims, NULL) < 0)
+ goto error;
+ if (H5Sclose(space_id) < 0)
+ goto error;
+ space_id = H5I_INVALID_HID;
+
+ table->size = dims[0];
+
+ /* Get an ID for this table */
+ ret_value = H5Iregister(H5PT_ptable_id_type, table);
+
+ if (ret_value != H5I_INVALID_HID)
+ H5PT_ptable_count++;
+ else
+ H5PT_close(table);
+
+ return ret_value;
error:
if (type_id != H5I_INVALID_HID)
- H5Dclose(type_id);
+ H5Dclose(type_id);
if (space_id != H5I_INVALID_HID)
- H5Sclose(space_id);
- if(table)
- {
+ H5Sclose(space_id);
+ if (table) {
if (table->type_id != H5I_INVALID_HID)
- H5Tclose(table->type_id);
- if (table->dset_id != H5I_INVALID_HID)
- H5Dclose(table->dset_id);
- HDfree(table);
+ H5Tclose(table->type_id);
+ if (table->dset_id != H5I_INVALID_HID)
+ H5Dclose(table->dset_id);
+ HDfree(table);
}
return ret_value;
@@ -436,33 +428,32 @@ H5PT_free_id(void *id)
*-------------------------------------------------------------------------
*/
static herr_t
-H5PT_close( htbl_t* table)
+H5PT_close(htbl_t *table)
{
- if(table == NULL)
- goto error;
+ if (table == NULL)
+ goto error;
- /* Close the dataset */
- if(H5Dclose(table->dset_id) < 0)
- goto error;
+ /* Close the dataset */
+ if (H5Dclose(table->dset_id) < 0)
+ goto error;
- /* Close the memory datatype */
- if(H5Tclose(table->type_id) < 0)
- goto error;
+ /* Close the memory datatype */
+ if (H5Tclose(table->type_id) < 0)
+ goto error;
- HDfree(table);
+ HDfree(table);
- return SUCCEED;
+ return SUCCEED;
error:
- if(table)
- {
- H5E_BEGIN_TRY
- H5Dclose(table->dset_id);
- H5Tclose(table->type_id);
- H5E_END_TRY
- HDfree(table);
- }
- return FAIL;
+ if (table) {
+ H5E_BEGIN_TRY
+ H5Dclose(table->dset_id);
+ H5Tclose(table->type_id);
+ H5E_END_TRY
+ HDfree(table);
+ }
+ return FAIL;
}
/*-------------------------------------------------------------------------
@@ -484,36 +475,35 @@ error:
*
*-------------------------------------------------------------------------
*/
-herr_t H5PTclose( hid_t table_id )
+herr_t
+H5PTclose(hid_t table_id)
{
- htbl_t * table;
+ htbl_t *table;
- /* Remove the ID from the library */
- if((table = (htbl_t *)H5Iremove_verify(table_id, H5PT_ptable_id_type)) ==NULL)
- goto error;
+ /* Remove the ID from the library */
+ if ((table = (htbl_t *)H5Iremove_verify(table_id, H5PT_ptable_id_type)) == NULL)
+ goto error;
- /* If the library found the table, remove it */
- if( H5PT_close(table) < 0)
- goto error;
+ /* If the library found the table, remove it */
+ if (H5PT_close(table) < 0)
+ goto error;
- /* One less packet table open */
- H5PT_ptable_count--;
+ /* One less packet table open */
+ H5PT_ptable_count--;
- /* Remove the packet table type ID if no more packet */
- /* tables are open */
- if(H5PT_ptable_count == 0)
- {
- H5Idestroy_type(H5PT_ptable_id_type);
- H5PT_ptable_id_type = H5I_UNINIT;
- }
+ /* Remove the packet table type ID if no more packet */
+ /* tables are open */
+ if (H5PT_ptable_count == 0) {
+ H5Idestroy_type(H5PT_ptable_id_type);
+ H5PT_ptable_id_type = H5I_UNINIT;
+ }
- return SUCCEED;
+ return SUCCEED;
error:
- return FAIL;
+ return FAIL;
}
-
/*-------------------------------------------------------------------------
*
* Write functions
@@ -539,30 +529,28 @@ error:
*
*-------------------------------------------------------------------------
*/
-herr_t H5PTappend( hid_t table_id,
- size_t nrecords,
- const void * data )
+herr_t
+H5PTappend(hid_t table_id, size_t nrecords, const void *data)
{
- htbl_t * table;
+ htbl_t *table;
- /* Find the table struct from its ID */
- if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
- goto error;
+ /* Find the table struct from its ID */
+ if ((table = (htbl_t *)H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
+ goto error;
- /* If we are asked to write 0 records, just do nothing */
- if(nrecords == 0)
- return SUCCEED;
+ /* If we are asked to write 0 records, just do nothing */
+ if (nrecords == 0)
+ return SUCCEED;
- if((H5TB_common_append_records(table->dset_id, table->type_id,
- nrecords, table->size, data)) < 0)
- goto error;
+ if ((H5TB_common_append_records(table->dset_id, table->type_id, nrecords, table->size, data)) < 0)
+ goto error;
- /* Update table size */
- table->size += nrecords;
- return SUCCEED;
+ /* Update table size */
+ table->size += nrecords;
+ return SUCCEED;
error:
- return FAIL;
+ return FAIL;
}
/*-------------------------------------------------------------------------
@@ -572,7 +560,6 @@ error:
*-------------------------------------------------------------------------
*/
-
/*-------------------------------------------------------------------------
* Function: H5PTget_next
*
@@ -593,30 +580,29 @@ error:
*
*-------------------------------------------------------------------------
*/
-herr_t H5PTget_next( hid_t table_id,
- size_t nrecords,
- void * data)
+herr_t
+H5PTget_next(hid_t table_id, size_t nrecords, void *data)
{
- htbl_t * table;
+ htbl_t *table;
- /* Find the table struct from its ID */
- if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
- goto error;
+ /* Find the table struct from its ID */
+ if ((table = (htbl_t *)H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
+ goto error;
- /* If nrecords == 0, do nothing */
- if(nrecords == 0)
- return SUCCEED;
+ /* If nrecords == 0, do nothing */
+ if (nrecords == 0)
+ return SUCCEED;
- if((H5TB_common_read_records(table->dset_id, table->type_id,
- table->current_index, nrecords, table->size, data)) < 0)
- goto error;
+ if ((H5TB_common_read_records(table->dset_id, table->type_id, table->current_index, nrecords, table->size,
+ data)) < 0)
+ goto error;
- /* Update the current index */
- table->current_index += nrecords;
- return SUCCEED;
+ /* Update the current index */
+ table->current_index += nrecords;
+ return SUCCEED;
error:
- return FAIL;
+ return FAIL;
}
/*-------------------------------------------------------------------------
@@ -638,30 +624,27 @@ error:
*
*-------------------------------------------------------------------------
*/
-herr_t H5PTread_packets( hid_t table_id,
- hsize_t start,
- size_t nrecords,
- void *data)
+herr_t
+H5PTread_packets(hid_t table_id, hsize_t start, size_t nrecords, void *data)
{
- htbl_t * table;
+ htbl_t *table;
- /* find the table struct from its ID */
- table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type);
- if(table == NULL)
- goto error;
+ /* find the table struct from its ID */
+ table = (htbl_t *)H5Iobject_verify(table_id, H5PT_ptable_id_type);
+ if (table == NULL)
+ goto error;
- /* If nrecords == 0, do nothing */
- if(nrecords == 0)
- return SUCCEED;
+ /* If nrecords == 0, do nothing */
+ if (nrecords == 0)
+ return SUCCEED;
- if( H5TB_common_read_records(table->dset_id, table->type_id,
- start, nrecords, table->size, data) < 0)
- goto error;
+ if (H5TB_common_read_records(table->dset_id, table->type_id, start, nrecords, table->size, data) < 0)
+ goto error;
- return SUCCEED;
+ return SUCCEED;
error:
- return FAIL;
+ return FAIL;
}
/*-------------------------------------------------------------------------
@@ -692,40 +675,36 @@ error:
static herr_t
H5PT_create_index(htbl_t *table)
{
- if( table != NULL)
- {
- table->current_index = 0;
- return SUCCEED;
- }
- return FAIL;
+ if (table != NULL) {
+ table->current_index = 0;
+ return SUCCEED;
+ }
+ return FAIL;
}
static herr_t
H5PT_set_index(htbl_t *table, hsize_t pt_index)
{
- /* Ensure index is valid */
- if( table != NULL )
- {
- if( pt_index < table->size )
- {
- table->current_index = pt_index;
- return SUCCEED;
+ /* Ensure index is valid */
+ if (table != NULL) {
+ if (pt_index < table->size) {
+ table->current_index = pt_index;
+ return SUCCEED;
+ }
}
- }
- return FAIL;
+ return FAIL;
}
static herr_t
H5PT_get_index(htbl_t *table, hsize_t *pt_index)
{
- /* Ensure index is valid */
- if( table != NULL )
- {
- if(pt_index)
- *pt_index = table->current_index;
- return SUCCEED;
- }
- return FAIL;
+ /* Ensure index is valid */
+ if (table != NULL) {
+ if (pt_index)
+ *pt_index = table->current_index;
+ return SUCCEED;
+ }
+ return FAIL;
}
/*-------------------------------------------------------------------------
@@ -746,37 +725,40 @@ H5PT_get_index(htbl_t *table, hsize_t *pt_index)
*
*-------------------------------------------------------------------------
*/
-herr_t H5PTcreate_index(hid_t table_id)
+herr_t
+H5PTcreate_index(hid_t table_id)
{
- htbl_t * table;
+ htbl_t *table;
- /* find the table struct from its ID */
- if((table = (htbl_t *) (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
- return FAIL;
+ /* find the table struct from its ID */
+ if ((table = (htbl_t *)(htbl_t *)H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
+ return FAIL;
- return H5PT_create_index(table);
+ return H5PT_create_index(table);
}
-herr_t H5PTset_index(hid_t table_id, hsize_t pt_index)
+herr_t
+H5PTset_index(hid_t table_id, hsize_t pt_index)
{
- htbl_t * table;
+ htbl_t *table;
- /* find the table struct from its ID */
- if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
- return FAIL;
+ /* find the table struct from its ID */
+ if ((table = (htbl_t *)H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
+ return FAIL;
- return H5PT_set_index(table, pt_index);
+ return H5PT_set_index(table, pt_index);
}
-herr_t H5PTget_index(hid_t table_id, hsize_t *pt_index)
+herr_t
+H5PTget_index(hid_t table_id, hsize_t *pt_index)
{
- htbl_t * table;
+ htbl_t *table;
- /* find the table struct from its ID */
- if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
- return FAIL;
+ /* find the table struct from its ID */
+ if ((table = (htbl_t *)H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
+ return FAIL;
- return H5PT_get_index(table, pt_index);
+ return H5PT_get_index(table, pt_index);
}
/*-------------------------------------------------------------------------
@@ -805,24 +787,24 @@ herr_t H5PTget_index(hid_t table_id, hsize_t *pt_index)
*
*-------------------------------------------------------------------------
*/
-herr_t H5PTget_num_packets( hid_t table_id, hsize_t *nrecords)
+herr_t
+H5PTget_num_packets(hid_t table_id, hsize_t *nrecords)
{
- htbl_t * table;
+ htbl_t *table;
- /* find the table struct from its ID */
- if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
- goto error;
+ /* find the table struct from its ID */
+ if ((table = (htbl_t *)H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
+ goto error;
- if(nrecords)
- *nrecords = table->size;
+ if (nrecords)
+ *nrecords = table->size;
- return SUCCEED;
+ return SUCCEED;
error:
- return FAIL;
+ return FAIL;
}
-
/*-------------------------------------------------------------------------
* Function: H5PTis_valid
*
@@ -842,13 +824,14 @@ error:
*
*-------------------------------------------------------------------------
*/
-herr_t H5PTis_valid(hid_t table_id)
+herr_t
+H5PTis_valid(hid_t table_id)
{
- /* find the table struct from its ID */
- if(H5Iobject_verify(table_id, H5PT_ptable_id_type) ==NULL)
- return FAIL;
+ /* find the table struct from its ID */
+ if (H5Iobject_verify(table_id, H5PT_ptable_id_type) == NULL)
+ return FAIL;
- return SUCCEED;
+ return SUCCEED;
}
/*-------------------------------------------------------------------------
@@ -871,25 +854,26 @@ herr_t H5PTis_valid(hid_t table_id)
*
*-------------------------------------------------------------------------
*/
-herr_t H5PTis_varlen(hid_t table_id)
+herr_t
+H5PTis_varlen(hid_t table_id)
{
- H5T_class_t type;
- htbl_t * table;
+ H5T_class_t type;
+ htbl_t * table;
- /* find the table struct from its ID */
- if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
- goto error;
+ /* find the table struct from its ID */
+ if ((table = (htbl_t *)H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
+ goto error;
- if((type = H5Tget_class( table->type_id )) == H5T_NO_CLASS)
- goto error;
+ if ((type = H5Tget_class(table->type_id)) == H5T_NO_CLASS)
+ goto error;
- if( type == H5T_VLEN )
- return 1;
- else
- return 0;
+ if (type == H5T_VLEN)
+ return 1;
+ else
+ return 0;
error:
- return FAIL;
+ return FAIL;
}
/*-------------------------------------------------------------------------
@@ -921,38 +905,37 @@ error:
*-------------------------------------------------------------------------
*/
-herr_t H5PTfree_vlen_buff( hid_t table_id,
- size_t _bufflen,
- void * buff )
+herr_t
+H5PTfree_vlen_buff(hid_t table_id, size_t _bufflen, void *buff)
{
- hid_t space_id = H5I_INVALID_HID;
- htbl_t * table;
- hsize_t bufflen = _bufflen;
- herr_t ret_value;
+ hid_t space_id = H5I_INVALID_HID;
+ htbl_t *table;
+ hsize_t bufflen = _bufflen;
+ herr_t ret_value;
- /* find the table struct from its ID */
- if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
- goto error;
+ /* find the table struct from its ID */
+ if ((table = (htbl_t *)H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
+ goto error;
- if((space_id = H5Screate_simple(1, &bufflen, NULL)) < 0)
- goto error;
+ if ((space_id = H5Screate_simple(1, &bufflen, NULL)) < 0)
+ goto error;
- /* Free the memory. If this succeeds, ret_value should be 0. */
- if((ret_value = H5Treclaim(table->type_id, space_id, H5P_DEFAULT, buff)) < 0)
- goto error;
+ /* Free the memory. If this succeeds, ret_value should be 0. */
+ if ((ret_value = H5Treclaim(table->type_id, space_id, H5P_DEFAULT, buff)) < 0)
+ goto error;
- /* If the dataspace cannot be closed, return -2 to indicate that memory */
- /* was freed successfully but an error still occurred. */
- if(H5Sclose(space_id) < 0)
- return -2;
+ /* If the dataspace cannot be closed, return -2 to indicate that memory */
+ /* was freed successfully but an error still occurred. */
+ if (H5Sclose(space_id) < 0)
+ return -2;
- return ret_value;
+ return ret_value;
error:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
H5Sclose(space_id);
- H5E_END_TRY
- return FAIL;
+ H5E_END_TRY
+ return FAIL;
} /* H5PTfree_vlen_buff */
/*-------------------------------------------------------------------------
@@ -979,20 +962,21 @@ error:
*
*-------------------------------------------------------------------------
*/
-hid_t H5PTget_dataset(hid_t table_id)
+hid_t
+H5PTget_dataset(hid_t table_id)
{
- htbl_t * table;
- hid_t ret_value = H5I_INVALID_HID;
+ htbl_t *table;
+ hid_t ret_value = H5I_INVALID_HID;
- /* find the table struct from its ID */
- if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
- goto error;
+ /* find the table struct from its ID */
+ if ((table = (htbl_t *)H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
+ goto error;
- ret_value = table->dset_id;
+ ret_value = table->dset_id;
error:
- return ret_value;
+ return ret_value;
}
/*-------------------------------------------------------------------------
@@ -1013,18 +997,19 @@ error:
*
*-------------------------------------------------------------------------
*/
-hid_t H5PTget_type( hid_t table_id)
+hid_t
+H5PTget_type(hid_t table_id)
{
- htbl_t * table;
- hid_t ret_value = H5I_INVALID_HID;
+ htbl_t *table;
+ hid_t ret_value = H5I_INVALID_HID;
- /* find the table struct from its ID */
- if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
- goto error;
+ /* find the table struct from its ID */
+ if ((table = (htbl_t *)H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL)
+ goto error;
- ret_value = table->type_id;
+ ret_value = table->type_id;
error:
- return ret_value;
+ return ret_value;
}
diff --git a/hl/src/H5PTprivate.h b/hl/src/H5PTprivate.h
index eec9df7..18ea3c2 100644
--- a/hl/src/H5PTprivate.h
+++ b/hl/src/H5PTprivate.h
@@ -21,4 +21,3 @@
#include "H5PTpublic.h"
#endif
-
diff --git a/hl/src/H5PTpublic.h b/hl/src/H5PTpublic.h
index 8a12c8c..a94e81c 100644
--- a/hl/src/H5PTpublic.h
+++ b/hl/src/H5PTpublic.h
@@ -14,7 +14,6 @@
#ifndef _H5PTpublic_H
#define _H5PTpublic_H
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -25,17 +24,16 @@ extern "C" {
*/
/* NOTE: H5PTcreate is replacing H5PTcreate_fl for better name due to the
removal of H5PTcreate_vl. H5PTcreate_fl may be retired in 1.8.19. */
-H5_HLDLL hid_t H5PTcreate(hid_t loc_id, const char *dset_name,
- hid_t dtype_id, hsize_t chunk_size, hid_t plist_id);
+H5_HLDLL hid_t H5PTcreate(hid_t loc_id, const char *dset_name, hid_t dtype_id, hsize_t chunk_size,
+ hid_t plist_id);
H5_HLDLL hid_t H5PTopen(hid_t loc_id, const char *dset_name);
H5_HLDLL herr_t H5PTclose(hid_t table_id);
/* This function may be removed from the packet table in release 1.8.19. */
-H5_HLDLL hid_t H5PTcreate_fl(hid_t loc_id, const char *dset_name,
- hid_t dtype_id, hsize_t chunk_size, int compression);
-
+H5_HLDLL hid_t H5PTcreate_fl(hid_t loc_id, const char *dset_name, hid_t dtype_id, hsize_t chunk_size,
+ int compression);
/*-------------------------------------------------------------------------
* Write functions
@@ -47,10 +45,9 @@ H5_HLDLL herr_t H5PTappend(hid_t table_id, size_t nrecords, const void *data);
* Read functions
*-------------------------------------------------------------------------
*/
-H5_HLDLL herr_t H5PTget_next(hid_t table_id, size_t nrecords, void * data);
+H5_HLDLL herr_t H5PTget_next(hid_t table_id, size_t nrecords, void *data);
-H5_HLDLL herr_t H5PTread_packets(hid_t table_id, hsize_t start,
- size_t nrecords, void *data);
+H5_HLDLL herr_t H5PTread_packets(hid_t table_id, hsize_t start, size_t nrecords, void *data);
/*-------------------------------------------------------------------------
* Inquiry functions
@@ -80,13 +77,11 @@ H5_HLDLL hid_t H5PTget_type(hid_t table_id);
*-------------------------------------------------------------------------
*/
-H5_HLDLL herr_t H5PTcreate_index( hid_t table_id );
+H5_HLDLL herr_t H5PTcreate_index(hid_t table_id);
-H5_HLDLL herr_t H5PTset_index( hid_t table_id,
- hsize_t pt_index );
+H5_HLDLL herr_t H5PTset_index(hid_t table_id, hsize_t pt_index);
-H5_HLDLL herr_t H5PTget_index( hid_t table_id,
- hsize_t *pt_index );
+H5_HLDLL herr_t H5PTget_index(hid_t table_id, hsize_t *pt_index);
/*-------------------------------------------------------------------------
*
@@ -95,13 +90,10 @@ H5_HLDLL herr_t H5PTget_index( hid_t table_id,
*-------------------------------------------------------------------------
*/
-H5_HLDLL herr_t H5PTfree_vlen_buff( hid_t table_id,
- size_t bufflen,
- void * buff );
+H5_HLDLL herr_t H5PTfree_vlen_buff(hid_t table_id, size_t bufflen, void *buff);
#ifdef __cplusplus
}
#endif
#endif
-
diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c
index 79d5cef..a3dfdae 100644
--- a/hl/src/H5TB.c
+++ b/hl/src/H5TB.c
@@ -1,191 +1,173 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "H5LTprivate.h"
#include "H5TBprivate.h"
-
/*-------------------------------------------------------------------------
-*
-* internal functions
-*
-*-------------------------------------------------------------------------
-*/
-
-static hbool_t H5TB_find_field(const char *field,
- const char *field_list);
-
-static herr_t H5TB_attach_attributes(const char *table_title,
- hid_t loc_id,
- const char *dset_name,
- hsize_t nfields,
- hid_t tid);
-
-static hid_t H5TB_create_type(hid_t loc_id,
- const char *dset_name,
- size_t type_size,
- const size_t *field_offset,
- const size_t *field_sizes,
- hid_t ftype_id);
+ *
+ * internal functions
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static hbool_t H5TB_find_field(const char *field, const char *field_list);
+
+static herr_t H5TB_attach_attributes(const char *table_title, hid_t loc_id, const char *dset_name,
+ hsize_t nfields, hid_t tid);
+
+static hid_t H5TB_create_type(hid_t loc_id, const char *dset_name, size_t type_size,
+ const size_t *field_offset, const size_t *field_sizes, hid_t ftype_id);
/*-------------------------------------------------------------------------
-*
-* Create functions
-*
-*-------------------------------------------------------------------------
-*/
+ *
+ * Create functions
+ *
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
-* Function: H5TBmake_table
-*
-* Purpose: Make a table
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-* Quincey Koziol
-*
-* Date: January 17, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBmake_table(const char *table_title,
- hid_t loc_id,
- const char *dset_name,
- hsize_t nfields,
- hsize_t nrecords,
- size_t type_size,
- const char *field_names[],
- const size_t *field_offset,
- const hid_t *field_types,
- hsize_t chunk_size,
- void *fill_data,
- int compress,
- const void *buf)
+ * Function: H5TBmake_table
+ *
+ * Purpose: Make a table
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ * Quincey Koziol
+ *
+ * Date: January 17, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsize_t nfields,
+ hsize_t nrecords, size_t type_size, const char *field_names[], const size_t *field_offset,
+ const hid_t *field_types, hsize_t chunk_size, void *fill_data, int compress, const void *buf)
{
- hid_t did = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
- hid_t plist_id = H5I_BADID;
- hid_t attr_id = H5I_BADID;
- hsize_t dims[1];
- hsize_t dims_chunk[1];
- hsize_t maxdims[1] = {H5S_UNLIMITED};
- char attr_name[255];
- char *member_name = NULL;
- unsigned char *tmp_buf = NULL;
- hsize_t i;
- herr_t ret_val = -1;
+ hid_t did = H5I_BADID;
+ hid_t sid = H5I_BADID;
+ hid_t mem_type_id = H5I_BADID;
+ hid_t plist_id = H5I_BADID;
+ hid_t attr_id = H5I_BADID;
+ hsize_t dims[1];
+ hsize_t dims_chunk[1];
+ hsize_t maxdims[1] = {H5S_UNLIMITED};
+ char attr_name[255];
+ char * member_name = NULL;
+ unsigned char *tmp_buf = NULL;
+ hsize_t i;
+ herr_t ret_val = -1;
/* check the arguments */
if (table_title == NULL) {
- goto out;
+ goto out;
}
if (dset_name == NULL) {
- goto out;
+ goto out;
}
if (field_names == NULL) {
- goto out;
+ goto out;
}
dims[0] = nrecords;
dims_chunk[0] = chunk_size;
/* create the memory data type. */
- if((mem_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0)
+ if ((mem_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0)
goto out;
/* insert fields. */
- for(i = 0; i < nfields; i++)
- if(H5Tinsert(mem_type_id, field_names[i], field_offset[i], field_types[i] ) < 0)
+ for (i = 0; i < nfields; i++)
+ if (H5Tinsert(mem_type_id, field_names[i], field_offset[i], field_types[i]) < 0)
goto out;
/* create a simple data space with unlimited size */
- if((sid = H5Screate_simple(1, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(1, dims, maxdims)) < 0)
goto out;
/* modify dataset creation properties, i.e. enable chunking */
- if((plist_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((plist_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
- if(H5Pset_chunk(plist_id, 1, dims_chunk) < 0)
+ if (H5Pset_chunk(plist_id, 1, dims_chunk) < 0)
goto out;
/* set the fill value using a struct as the data type. */
- if(fill_data)
- if(H5Pset_fill_value(plist_id, mem_type_id, fill_data) < 0)
+ if (fill_data)
+ if (H5Pset_fill_value(plist_id, mem_type_id, fill_data) < 0)
goto out;
/*
dataset creation property list is modified to use
GZIP compression with the compression effort set to 6.
*/
- if(compress)
- if(H5Pset_deflate(plist_id, 6) < 0)
+ if (compress)
+ if (H5Pset_deflate(plist_id, 6) < 0)
goto out;
/* create the dataset. */
- if((did = H5Dcreate2(loc_id, dset_name, mem_type_id, sid, H5P_DEFAULT, plist_id, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, dset_name, mem_type_id, sid, H5P_DEFAULT, plist_id, H5P_DEFAULT)) < 0)
goto out;
/* only write if there is something to write */
- if(buf)
- if(H5Dwrite(did, mem_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (buf)
+ if (H5Dwrite(did, mem_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
/* terminate access to the data space. */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
sid = H5I_BADID;
/* end access to the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
did = H5I_BADID;
/* end access to the property list */
- if(H5Pclose(plist_id) < 0)
+ if (H5Pclose(plist_id) < 0)
goto out;
plist_id = H5I_BADID;
/*-------------------------------------------------------------------------
- * set the conforming table attributes
- *-------------------------------------------------------------------------
- */
+ * set the conforming table attributes
+ *-------------------------------------------------------------------------
+ */
/* attach the CLASS attribute */
- if(H5LTset_attribute_string(loc_id, dset_name, "CLASS", TABLE_CLASS) < 0)
+ if (H5LTset_attribute_string(loc_id, dset_name, "CLASS", TABLE_CLASS) < 0)
goto out;
/* attach the VERSION attribute */
- if(H5LTset_attribute_string(loc_id, dset_name, "VERSION", TABLE_VERSION) < 0)
+ if (H5LTset_attribute_string(loc_id, dset_name, "VERSION", TABLE_VERSION) < 0)
goto out;
/* attach the TITLE attribute */
- if(H5LTset_attribute_string(loc_id, dset_name, "TITLE", table_title) < 0)
+ if (H5LTset_attribute_string(loc_id, dset_name, "TITLE", table_title) < 0)
goto out;
/* attach the FIELD_ name attribute */
- for(i = 0; i < nfields; i++) {
+ for (i = 0; i < nfields; i++) {
/* get the member name */
- if(NULL == (member_name = H5Tget_member_name(mem_type_id, (unsigned)i)))
+ if (NULL == (member_name = H5Tget_member_name(mem_type_id, (unsigned)i)))
goto out;
HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_NAME", (int)i);
/* attach the attribute */
- if(H5LTset_attribute_string(loc_id, dset_name, attr_name, member_name) < 0)
+ if (H5LTset_attribute_string(loc_id, dset_name, attr_name, member_name) < 0)
goto out;
H5free_memory(member_name);
@@ -193,283 +175,269 @@ herr_t H5TBmake_table(const char *table_title,
} /* end for */
/* attach the FIELD_ fill value attribute */
- if(fill_data) {
+ if (fill_data) {
tmp_buf = (unsigned char *)fill_data;
/* open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
goto out;
- for(i = 0; i < nfields; i++) {
+ for (i = 0; i < nfields; i++) {
HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
- if((attr_id = H5Acreate2(did, attr_name, field_types[i], sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Acreate2(did, attr_name, field_types[i], sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Awrite(attr_id, field_types[i], tmp_buf + field_offset[i]) < 0)
+ if (H5Awrite(attr_id, field_types[i], tmp_buf + field_offset[i]) < 0)
goto out;
- if(H5Aclose(attr_id) < 0)
+ if (H5Aclose(attr_id) < 0)
goto out;
attr_id = H5I_BADID;
} /* end for */
/* terminate access to the data space. */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
sid = H5I_BADID;
/* end access to the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
did = H5I_BADID;
} /* end if */
/* release the datatype. */
- if(H5Tclose(mem_type_id) < 0)
+ if (H5Tclose(mem_type_id) < 0)
goto out;
mem_type_id = H5I_BADID;
ret_val = 0;
out:
- if(member_name)
+ if (member_name)
H5free_memory(member_name);
- if(attr_id > 0)
- if(H5Aclose(attr_id) < 0)
+ if (attr_id > 0)
+ if (H5Aclose(attr_id) < 0)
ret_val = -1;
- if(plist_id > 0)
- if(H5Pclose(plist_id) < 0)
+ if (plist_id > 0)
+ if (H5Pclose(plist_id) < 0)
ret_val = -1;
- if(sid > 0)
- if(H5Sclose(sid) < 0)
+ if (sid > 0)
+ if (H5Sclose(sid) < 0)
ret_val = -1;
- if(did > 0)
- if(H5Dclose(did) < 0)
+ if (did > 0)
+ if (H5Dclose(did) < 0)
ret_val = -1;
- if(mem_type_id > 0)
- if(H5Tclose(mem_type_id) < 0)
+ if (mem_type_id > 0)
+ if (H5Tclose(mem_type_id) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBmake_table() */
/*-------------------------------------------------------------------------
-*
-* Write functions
-*
-*-------------------------------------------------------------------------
-*/
+ *
+ * Write functions
+ *
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
-* Function: H5TBappend_records
-*
-* Purpose: Appends records to a table
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmers:
-* Pedro Vicente
-* Quincey Koziol
-*
-* Date: November 19, 2001
-*
-* Comments: Uses memory offsets
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBappend_records(hid_t loc_id,
- const char *dset_name,
- hsize_t nrecords,
- size_t type_size,
- const size_t *field_offset,
- const size_t *field_sizes,
- const void *buf)
+ * Function: H5TBappend_records
+ *
+ * Purpose: Appends records to a table
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmers:
+ * Pedro Vicente
+ * Quincey Koziol
+ *
+ * Date: November 19, 2001
+ *
+ * Comments: Uses memory offsets
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBappend_records(hid_t loc_id, const char *dset_name, hsize_t nrecords, size_t type_size,
+ const size_t *field_offset, const size_t *field_sizes, const void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
- hsize_t nrecords_orig;
- hsize_t nfields;
- herr_t ret_val = -1;
+ hid_t did = H5I_BADID;
+ hid_t tid = H5I_BADID;
+ hid_t mem_type_id = H5I_BADID;
+ hsize_t nrecords_orig;
+ hsize_t nfields;
+ herr_t ret_val = -1;
/* check the arguments */
if (dset_name == NULL)
goto out;
/* get the original number of records and fields */
- if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords_orig) < 0)
+ if (H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords_orig) < 0)
goto out;
/* open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
/* get the datatypes */
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
goto out;
- if((mem_type_id = H5TB_create_type(loc_id, dset_name, type_size, field_offset, field_sizes, tid)) < 0)
+ if ((mem_type_id = H5TB_create_type(loc_id, dset_name, type_size, field_offset, field_sizes, tid)) < 0)
goto out;
/* append the records */
- if((H5TB_common_append_records(did, mem_type_id, (size_t)nrecords, nrecords_orig, buf)) < 0)
+ if ((H5TB_common_append_records(did, mem_type_id, (size_t)nrecords, nrecords_orig, buf)) < 0)
goto out;
ret_val = 0;
out:
- if(tid > 0)
- if(H5Tclose(tid) < 0)
+ if (tid > 0)
+ if (H5Tclose(tid) < 0)
ret_val = -1;
- if(mem_type_id > 0)
- if(H5Tclose(mem_type_id) < 0)
+ if (mem_type_id > 0)
+ if (H5Tclose(mem_type_id) < 0)
ret_val = -1;
- if(did > 0)
- if(H5Dclose(did) < 0)
+ if (did > 0)
+ if (H5Dclose(did) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBappend_records() */
/*-------------------------------------------------------------------------
-* Function: H5TBwrite_records
-*
-* Purpose: Writes records
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 19, 2001
-*
-* Comments: Uses memory offsets
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBwrite_records(hid_t loc_id,
- const char *dset_name,
- hsize_t start,
- hsize_t nrecords,
- size_t type_size,
- const size_t *field_offset,
- const size_t *field_sizes,
- const void *buf)
+ * Function: H5TBwrite_records
+ *
+ * Purpose: Writes records
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 19, 2001
+ *
+ * Comments: Uses memory offsets
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBwrite_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size,
+ const size_t *field_offset, const size_t *field_sizes, const void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
- hsize_t count[1];
- hsize_t offset[1];
- hsize_t mem_size[1];
- hsize_t dims[1];
- herr_t ret_val = -1;
+ hid_t did = H5I_BADID;
+ hid_t tid = H5I_BADID;
+ hid_t sid = H5I_BADID;
+ hid_t m_sid = H5I_BADID;
+ hid_t mem_type_id = H5I_BADID;
+ hsize_t count[1];
+ hsize_t offset[1];
+ hsize_t mem_size[1];
+ hsize_t dims[1];
+ herr_t ret_val = -1;
/* check the arguments */
if (dset_name == NULL)
goto out;
/* open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
/* get the datatype */
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
goto out;
- if((mem_type_id = H5TB_create_type(loc_id, dset_name, type_size, field_offset, field_sizes, tid)) < 0)
+ if ((mem_type_id = H5TB_create_type(loc_id, dset_name, type_size, field_offset, field_sizes, tid)) < 0)
goto out;
/* get the dataspace handle */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto out;
/* get records */
- if(H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
goto out;
- if(start + nrecords > dims[0])
+ if (start + nrecords > dims[0])
goto out;
/* define a hyperslab in the dataset of the size of the records */
offset[0] = start;
count[0] = nrecords;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto out;
/* create a memory dataspace handle */
mem_size[0] = count[0];
- if((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
+ if ((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
goto out;
- if(H5Dwrite(did, mem_type_id, m_sid, sid, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did, mem_type_id, m_sid, sid, H5P_DEFAULT, buf) < 0)
goto out;
ret_val = 0;
out:
- if(m_sid > 0)
- if(H5Sclose(m_sid) < 0)
+ if (m_sid > 0)
+ if (H5Sclose(m_sid) < 0)
ret_val = -1;
- if(sid > 0)
- if(H5Sclose(sid) < 0)
+ if (sid > 0)
+ if (H5Sclose(sid) < 0)
ret_val = -1;
- if(tid > 0)
- if(H5Tclose(tid) < 0)
+ if (tid > 0)
+ if (H5Tclose(tid) < 0)
ret_val = -1;
- if(mem_type_id > 0)
- if(H5Tclose(mem_type_id) < 0)
+ if (mem_type_id > 0)
+ if (H5Tclose(mem_type_id) < 0)
ret_val = -1;
- if(did > 0)
- if(H5Dclose(did) < 0)
+ if (did > 0)
+ if (H5Dclose(did) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBwrite_records() */
/*-------------------------------------------------------------------------
-* Function: H5TBwrite_fields_name
-*
-* Purpose: Writes fields
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 21, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBwrite_fields_name(hid_t loc_id,
- const char *dset_name,
- const char *field_names,
- hsize_t start,
- hsize_t nrecords,
- size_t type_size,
- const size_t *field_offset,
- const size_t *field_sizes,
- const void *buf)
+ * Function: H5TBwrite_fields_name
+ *
+ * Purpose: Writes fields
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 21, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBwrite_fields_name(hid_t loc_id, const char *dset_name, const char *field_names, hsize_t start,
+ hsize_t nrecords, size_t type_size, const size_t *field_offset,
+ const size_t *field_sizes, const void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t write_type_id = H5I_BADID;
+ hid_t did = H5I_BADID;
+ hid_t tid = H5I_BADID;
+ hid_t write_type_id = H5I_BADID;
hid_t member_type_id = H5I_BADID;
- hid_t nmtype_id = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hid_t file_space_id = H5I_BADID;
- hid_t preserve_id = H5I_BADID;
+ hid_t nmtype_id = H5I_BADID;
+ hid_t m_sid = H5I_BADID;
+ hid_t file_space_id = H5I_BADID;
+ hid_t preserve_id = H5I_BADID;
hssize_t nfields;
hssize_t i, j;
hsize_t count[1];
hsize_t offset[1];
- char *member_name = NULL;
+ char * member_name = NULL;
size_t size_native;
herr_t ret_val = -1;
@@ -480,70 +448,70 @@ herr_t H5TBwrite_fields_name(hid_t loc_id,
goto out;
/* create xfer properties to preserve initialized data */
- if((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto out;
- if(H5Pset_preserve(preserve_id, 1) < 0)
+ if (H5Pset_preserve(preserve_id, 1) < 0)
goto out;
/* open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
/* get the datatype */
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
goto out;
/* get the number of fields */
- if((nfields = H5Tget_nmembers(tid)) < 0)
+ if ((nfields = H5Tget_nmembers(tid)) < 0)
goto out;
/* create a write id */
- if((write_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0)
+ if ((write_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0)
goto out;
j = 0;
/* iterate though the members */
- for(i = 0; i < nfields; i++) {
+ for (i = 0; i < nfields; i++) {
/* get the member name */
- if(NULL == (member_name = H5Tget_member_name(tid, (unsigned)i)))
+ if (NULL == (member_name = H5Tget_member_name(tid, (unsigned)i)))
goto out;
- if(H5TB_find_field(member_name, field_names)) {
+ if (H5TB_find_field(member_name, field_names)) {
/* get the member type */
- if((member_type_id = H5Tget_member_type(tid, (unsigned)i)) < 0)
+ if ((member_type_id = H5Tget_member_type(tid, (unsigned)i)) < 0)
goto out;
/* convert to native type */
- if((nmtype_id = H5Tget_native_type(member_type_id, H5T_DIR_DEFAULT)) < 0)
+ if ((nmtype_id = H5Tget_native_type(member_type_id, H5T_DIR_DEFAULT)) < 0)
goto out;
- if(0 == (size_native = H5Tget_size(nmtype_id)))
+ if (0 == (size_native = H5Tget_size(nmtype_id)))
goto out;
/* adjust, if necessary */
- if(field_sizes[j] != size_native)
- if(H5Tset_size(nmtype_id, field_sizes[j]) < 0)
+ if (field_sizes[j] != size_native)
+ if (H5Tset_size(nmtype_id, field_sizes[j]) < 0)
goto out;
/* the field in the file is found by its name */
- if(field_offset) {
- if(H5Tinsert(write_type_id, member_name, field_offset[j], nmtype_id) < 0)
+ if (field_offset) {
+ if (H5Tinsert(write_type_id, member_name, field_offset[j], nmtype_id) < 0)
goto out;
} /* end if */
/* only one field */
else {
- if(H5Tinsert(write_type_id, member_name, (size_t)0, nmtype_id) < 0)
+ if (H5Tinsert(write_type_id, member_name, (size_t)0, nmtype_id) < 0)
goto out;
} /* end else */
j++;
/* close */
- if(H5Tclose(member_type_id) < 0)
+ if (H5Tclose(member_type_id) < 0)
goto out;
member_type_id = H5I_BADID;
- if(H5Tclose(nmtype_id) < 0)
+ if (H5Tclose(nmtype_id) < 0)
goto out;
nmtype_id = H5I_BADID;
} /* end if */
@@ -553,156 +521,150 @@ herr_t H5TBwrite_fields_name(hid_t loc_id,
} /* end for */
/* get the dataspace handle */
- if((file_space_id = H5Dget_space(did)) < 0)
+ if ((file_space_id = H5Dget_space(did)) < 0)
goto out;
- if((m_sid = H5Screate_simple(1, &nrecords, NULL)) < 0)
+ if ((m_sid = H5Screate_simple(1, &nrecords, NULL)) < 0)
goto out;
/* define a hyperslab in the dataset */
offset[0] = start;
count[0] = nrecords;
- if(H5Sselect_hyperslab(file_space_id, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(file_space_id, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto out;
/* write */
- if(H5Dwrite(did, write_type_id, m_sid, file_space_id, preserve_id, buf) < 0)
+ if (H5Dwrite(did, write_type_id, m_sid, file_space_id, preserve_id, buf) < 0)
goto out;
ret_val = 0;
out:
- if(member_name)
+ if (member_name)
H5free_memory(member_name);
- if(preserve_id > 0)
- if(H5Pclose(preserve_id) < 0)
+ if (preserve_id > 0)
+ if (H5Pclose(preserve_id) < 0)
ret_val = -1;
- if(write_type_id > 0)
- if(H5Tclose(write_type_id) < 0)
+ if (write_type_id > 0)
+ if (H5Tclose(write_type_id) < 0)
ret_val = -1;
- if(tid > 0)
- if(H5Tclose(tid) < 0)
+ if (tid > 0)
+ if (H5Tclose(tid) < 0)
ret_val = -1;
- if(file_space_id > 0)
- if(H5Sclose(file_space_id) < 0)
+ if (file_space_id > 0)
+ if (H5Sclose(file_space_id) < 0)
ret_val = -1;
- if(m_sid > 0)
- if(H5Sclose(m_sid) < 0)
+ if (m_sid > 0)
+ if (H5Sclose(m_sid) < 0)
ret_val = -1;
- if(did > 0)
- if(H5Dclose(did) < 0)
+ if (did > 0)
+ if (H5Dclose(did) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBwrite_fields_name() */
/*-------------------------------------------------------------------------
-* Function: H5TBwrite_fields_index
-*
-* Purpose: Writes fields
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 21, 2001
-*
-* Comments: Uses memory offsets
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBwrite_fields_index(hid_t loc_id,
- const char *dset_name,
- hsize_t nfields,
- const int *field_index,
- hsize_t start,
- hsize_t nrecords,
- size_t type_size,
- const size_t *field_offset,
- const size_t *field_sizes,
- const void *buf)
+ * Function: H5TBwrite_fields_index
+ *
+ * Purpose: Writes fields
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 21, 2001
+ *
+ * Comments: Uses memory offsets
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBwrite_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, const int *field_index,
+ hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset,
+ const size_t *field_sizes, const void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t write_type_id = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t nmtype_id = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hid_t file_space_id = H5I_BADID;
- hid_t preserve_id = H5I_BADID;
- hsize_t count[1];
- hsize_t offset[1];
- hsize_t i;
- size_t size_native;
- char *member_name = NULL;
- herr_t ret_val = -1;
+ hid_t did = H5I_BADID;
+ hid_t tid = H5I_BADID;
+ hid_t write_type_id = H5I_BADID;
+ hid_t member_type_id = H5I_BADID;
+ hid_t nmtype_id = H5I_BADID;
+ hid_t m_sid = H5I_BADID;
+ hid_t file_space_id = H5I_BADID;
+ hid_t preserve_id = H5I_BADID;
+ hsize_t count[1];
+ hsize_t offset[1];
+ hsize_t i;
+ size_t size_native;
+ char * member_name = NULL;
+ herr_t ret_val = -1;
/* check the arguments */
if (dset_name == NULL)
goto out;
/* create xfer properties to preserve initialized data */
- if((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto out;
- if(H5Pset_preserve(preserve_id, 1) < 0)
+ if (H5Pset_preserve(preserve_id, 1) < 0)
goto out;
/* open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
/* get the datatype */
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
goto out;
/* create a write id */
- if((write_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0)
+ if ((write_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0)
goto out;
/* iterate tru the members */
- for(i = 0; i < nfields; i++) {
- unsigned j;
+ for (i = 0; i < nfields; i++) {
+ unsigned j;
/* Range check value */
- if(field_index[i] < 0)
+ if (field_index[i] < 0)
goto out;
j = (unsigned)field_index[i];
/* get the member name */
- if(NULL == (member_name = H5Tget_member_name(tid, j)))
+ if (NULL == (member_name = H5Tget_member_name(tid, j)))
goto out;
/* get the member type */
- if((member_type_id = H5Tget_member_type(tid, j)) < 0)
+ if ((member_type_id = H5Tget_member_type(tid, j)) < 0)
goto out;
/* convert to native type */
- if((nmtype_id = H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT)) < 0)
+ if ((nmtype_id = H5Tget_native_type(member_type_id, H5T_DIR_DEFAULT)) < 0)
goto out;
- if(0 == (size_native = H5Tget_size(nmtype_id)))
+ if (0 == (size_native = H5Tget_size(nmtype_id)))
goto out;
- if(field_sizes[i] != size_native)
- if(H5Tset_size(nmtype_id, field_sizes[i]) < 0)
+ if (field_sizes[i] != size_native)
+ if (H5Tset_size(nmtype_id, field_sizes[i]) < 0)
goto out;
/* the field in the file is found by its name */
- if(field_offset) {
- if(H5Tinsert(write_type_id, member_name, field_offset[i], nmtype_id) < 0)
+ if (field_offset) {
+ if (H5Tinsert(write_type_id, member_name, field_offset[i], nmtype_id) < 0)
goto out;
} /* end if */
/* only one field */
else {
- if(H5Tinsert(write_type_id, member_name, (size_t)0, nmtype_id) < 0)
+ if (H5Tinsert(write_type_id, member_name, (size_t)0, nmtype_id) < 0)
goto out;
} /* end else */
/* close */
- if(H5Tclose(member_type_id) < 0)
+ if (H5Tclose(member_type_id) < 0)
goto out;
member_type_id = H5I_BADID;
- if(H5Tclose(nmtype_id) < 0)
+ if (H5Tclose(nmtype_id) < 0)
goto out;
nmtype_id = H5I_BADID;
@@ -711,250 +673,236 @@ herr_t H5TBwrite_fields_index(hid_t loc_id,
} /* end for */
/* get the dataspace handles */
- if((file_space_id = H5Dget_space(did)) < 0)
+ if ((file_space_id = H5Dget_space(did)) < 0)
goto out;
- if((m_sid = H5Screate_simple(1, &nrecords, NULL)) < 0)
+ if ((m_sid = H5Screate_simple(1, &nrecords, NULL)) < 0)
goto out;
/* define a hyperslab in the dataset */
offset[0] = start;
count[0] = nrecords;
- if(H5Sselect_hyperslab(file_space_id, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(file_space_id, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto out;
/* write */
- if(H5Dwrite(did, write_type_id, m_sid, file_space_id, preserve_id, buf) < 0)
+ if (H5Dwrite(did, write_type_id, m_sid, file_space_id, preserve_id, buf) < 0)
goto out;
ret_val = 0;
out:
- if(member_name)
+ if (member_name)
H5free_memory(member_name);
- if(preserve_id > 0)
- if(H5Pclose(preserve_id) < 0)
+ if (preserve_id > 0)
+ if (H5Pclose(preserve_id) < 0)
ret_val = -1;
- if(write_type_id > 0)
- if(H5Tclose(write_type_id) < 0)
+ if (write_type_id > 0)
+ if (H5Tclose(write_type_id) < 0)
ret_val = -1;
- if(member_type_id > 0)
- if(H5Tclose(member_type_id) < 0)
+ if (member_type_id > 0)
+ if (H5Tclose(member_type_id) < 0)
ret_val = -1;
- if(nmtype_id > 0)
- if(H5Tclose(nmtype_id) < 0)
+ if (nmtype_id > 0)
+ if (H5Tclose(nmtype_id) < 0)
ret_val = -1;
- if(tid > 0)
- if(H5Tclose(tid) < 0)
+ if (tid > 0)
+ if (H5Tclose(tid) < 0)
ret_val = -1;
- if(file_space_id > 0)
- if(H5Sclose(file_space_id) < 0)
+ if (file_space_id > 0)
+ if (H5Sclose(file_space_id) < 0)
ret_val = -1;
- if(m_sid > 0)
- if(H5Sclose(m_sid) < 0)
+ if (m_sid > 0)
+ if (H5Sclose(m_sid) < 0)
ret_val = -1;
- if(did > 0)
- if(H5Dclose(did) < 0)
+ if (did > 0)
+ if (H5Dclose(did) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBwrite_fields_index() */
-
/*-------------------------------------------------------------------------
-*
-* Read functions
-*
-*-------------------------------------------------------------------------
-*/
-
+ *
+ * Read functions
+ *
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
-* Function: H5TBread_table
-*
-* Purpose: Reads a table
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 20, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBread_table(hid_t loc_id,
- const char *dset_name,
- size_t type_size,
- const size_t *field_offset,
- const size_t *field_sizes,
- void *dst_buf)
+ * Function: H5TBread_table
+ *
+ * Purpose: Reads a table
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 20, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBread_table(hid_t loc_id, const char *dset_name, size_t type_size, const size_t *field_offset,
+ const size_t *field_sizes, void *dst_buf)
{
- hid_t did = H5I_BADID;
- hid_t ftype_id = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
- hid_t sid = H5I_BADID;
- hsize_t dims[1];
- herr_t ret_val = -1;
+ hid_t did = H5I_BADID;
+ hid_t ftype_id = H5I_BADID;
+ hid_t mem_type_id = H5I_BADID;
+ hid_t sid = H5I_BADID;
+ hsize_t dims[1];
+ herr_t ret_val = -1;
/* check the arguments */
if (dset_name == NULL)
goto out;
/* open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
/* get the dataspace handle */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto out;
/* get dimensions */
- if(H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
goto out;
/* get the datatypes */
- if((ftype_id = H5Dget_type (did)) < 0)
+ if ((ftype_id = H5Dget_type(did)) < 0)
goto out;
- if((mem_type_id = H5TB_create_type(loc_id, dset_name, type_size, field_offset, field_sizes, ftype_id)) < 0)
+ if ((mem_type_id = H5TB_create_type(loc_id, dset_name, type_size, field_offset, field_sizes, ftype_id)) <
+ 0)
goto out;
/* read */
- if(H5Dread(did, mem_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, dst_buf) < 0)
+ if (H5Dread(did, mem_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, dst_buf) < 0)
goto out;
ret_val = 0;
out:
- if(mem_type_id > 0)
- if(H5Tclose(mem_type_id) < 0)
+ if (mem_type_id > 0)
+ if (H5Tclose(mem_type_id) < 0)
ret_val = -1;
- if(ftype_id > 0)
- if(H5Tclose(ftype_id) < 0)
+ if (ftype_id > 0)
+ if (H5Tclose(ftype_id) < 0)
ret_val = -1;
- if(sid > 0)
- if(H5Sclose(sid) < 0)
+ if (sid > 0)
+ if (H5Sclose(sid) < 0)
ret_val = -1;
- if(did > 0)
- if(H5Dclose(did) < 0)
+ if (did > 0)
+ if (H5Dclose(did) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBread_table() */
/*-------------------------------------------------------------------------
-* Function: H5TBread_records
-*
-* Purpose: Reads records
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 19, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBread_records(hid_t loc_id,
- const char *dset_name,
- hsize_t start,
- hsize_t nrecords,
- size_t type_size,
- const size_t *field_offset,
- const size_t *field_sizes,
- void *buf)
+ * Function: H5TBread_records
+ *
+ * Purpose: Reads records
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 19, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBread_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size,
+ const size_t *field_offset, const size_t *field_sizes, void *buf)
{
- hid_t did = H5I_BADID;
- hid_t ftype_id = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
- hsize_t nrecords_orig;
- hsize_t nfields;
- herr_t ret_val = -1;
+ hid_t did = H5I_BADID;
+ hid_t ftype_id = H5I_BADID;
+ hid_t mem_type_id = H5I_BADID;
+ hsize_t nrecords_orig;
+ hsize_t nfields;
+ herr_t ret_val = -1;
/* check the arguments */
if (dset_name == NULL)
goto out;
/* get the number of records and fields */
- if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords_orig) < 0)
+ if (H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords_orig) < 0)
goto out;
/* open the dataset */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
/* get the datatypes */
- if((ftype_id = H5Dget_type(did)) < 0)
+ if ((ftype_id = H5Dget_type(did)) < 0)
goto out;
- if((mem_type_id = H5TB_create_type(loc_id, dset_name, type_size, field_offset, field_sizes, ftype_id)) < 0)
+ if ((mem_type_id = H5TB_create_type(loc_id, dset_name, type_size, field_offset, field_sizes, ftype_id)) <
+ 0)
goto out;
/* read the records */
- if((H5TB_common_read_records(did, mem_type_id, start, (size_t)nrecords, nrecords_orig, buf)) < 0)
+ if ((H5TB_common_read_records(did, mem_type_id, start, (size_t)nrecords, nrecords_orig, buf)) < 0)
goto out;
ret_val = 0;
out:
- if(mem_type_id > 0)
- if(H5Tclose(mem_type_id) < 0)
+ if (mem_type_id > 0)
+ if (H5Tclose(mem_type_id) < 0)
ret_val = -1;
- if(ftype_id > 0)
- if(H5Tclose(ftype_id) < 0)
+ if (ftype_id > 0)
+ if (H5Tclose(ftype_id) < 0)
ret_val = -1;
- if(did > 0)
- if(H5Dclose(did) < 0)
+ if (did > 0)
+ if (H5Dclose(did) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBread_records() */
/*-------------------------------------------------------------------------
-* Function: H5TBread_fields_name
-*
-* Purpose: Reads fields
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 19, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBread_fields_name(hid_t loc_id,
- const char *dset_name,
- const char *field_names,
- hsize_t start,
- hsize_t nrecords,
- size_t type_size,
- const size_t *field_offset,
- const size_t *field_sizes,
- void *buf)
+ * Function: H5TBread_fields_name
+ *
+ * Purpose: Reads fields
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 19, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBread_fields_name(hid_t loc_id, const char *dset_name, const char *field_names, hsize_t start,
+ hsize_t nrecords, size_t type_size, const size_t *field_offset,
+ const size_t *field_sizes, void *buf)
{
- hid_t did = H5I_BADID;
- hid_t ftype_id = H5I_BADID;
+ hid_t did = H5I_BADID;
+ hid_t ftype_id = H5I_BADID;
hid_t mem_type_id = H5I_BADID;
- hid_t mtype_id = H5I_BADID;
- hid_t nmtype_id = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
+ hid_t mtype_id = H5I_BADID;
+ hid_t nmtype_id = H5I_BADID;
+ hid_t sid = H5I_BADID;
+ hid_t m_sid = H5I_BADID;
hssize_t nfields;
hsize_t count[1];
hsize_t offset[1];
hsize_t mem_size[1];
size_t size_native;
- char *member_name = NULL;
+ char * member_name = NULL;
hssize_t i, j;
herr_t ret_val = -1;
-
/* check the arguments */
if (dset_name == NULL)
goto out;
@@ -962,58 +910,58 @@ herr_t H5TBread_fields_name(hid_t loc_id,
goto out;
/* open the dataset */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
/* get the datatype */
- if((ftype_id = H5Dget_type(did)) < 0)
+ if ((ftype_id = H5Dget_type(did)) < 0)
goto out;
/* get the number of fields */
- if((nfields = H5Tget_nmembers(ftype_id)) < 0)
+ if ((nfields = H5Tget_nmembers(ftype_id)) < 0)
goto out;
/* create a memory read id */
- if((mem_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0)
+ if ((mem_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0)
goto out;
/* iterate through the members */
- for(i = 0, j = 0; i < nfields; i++) {
+ for (i = 0, j = 0; i < nfields; i++) {
/* get the member name */
- if(NULL == (member_name = H5Tget_member_name(ftype_id, (unsigned)i)))
+ if (NULL == (member_name = H5Tget_member_name(ftype_id, (unsigned)i)))
goto out;
- if(H5TB_find_field(member_name, field_names)) {
+ if (H5TB_find_field(member_name, field_names)) {
/* get the member type */
- if((mtype_id = H5Tget_member_type(ftype_id, (unsigned)i)) < 0)
+ if ((mtype_id = H5Tget_member_type(ftype_id, (unsigned)i)) < 0)
goto out;
/* convert to native type */
- if((nmtype_id = H5Tget_native_type(mtype_id, H5T_DIR_DEFAULT)) < 0)
+ if ((nmtype_id = H5Tget_native_type(mtype_id, H5T_DIR_DEFAULT)) < 0)
goto out;
- if(0 == (size_native = H5Tget_size(nmtype_id)))
+ if (0 == (size_native = H5Tget_size(nmtype_id)))
goto out;
- if(field_sizes[j] != size_native)
- if(H5Tset_size(nmtype_id, field_sizes[j]) < 0)
+ if (field_sizes[j] != size_native)
+ if (H5Tset_size(nmtype_id, field_sizes[j]) < 0)
goto out;
/* the field in the file is found by its name */
- if(field_offset) {
- if(H5Tinsert(mem_type_id, member_name, field_offset[j], nmtype_id) < 0)
+ if (field_offset) {
+ if (H5Tinsert(mem_type_id, member_name, field_offset[j], nmtype_id) < 0)
goto out;
} /* end if */
else {
- if(H5Tinsert(mem_type_id, member_name, (size_t)0, nmtype_id) < 0)
+ if (H5Tinsert(mem_type_id, member_name, (size_t)0, nmtype_id) < 0)
goto out;
} /* end else */
/* close */
- if(H5Tclose(mtype_id) < 0)
+ if (H5Tclose(mtype_id) < 0)
goto out;
mtype_id = H5I_BADID;
- if(H5Tclose(nmtype_id) < 0)
+ if (H5Tclose(nmtype_id) < 0)
goto out;
nmtype_id = H5I_BADID;
j++;
@@ -1024,159 +972,153 @@ herr_t H5TBread_fields_name(hid_t loc_id,
} /* end for */
/* check to make sure field was found, no reason to continue if it does not exist */
- if(j == 0)
- goto out;
+ if (j == 0)
+ goto out;
/* get the dataspace handle */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto out;
/* define a hyperslab in the dataset */
offset[0] = start;
count[0] = nrecords;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto out;
/* create a memory dataspace handle */
mem_size[0] = count[0];
- if((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
+ if ((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
goto out;
/* read */
- if(H5Dread(did, mem_type_id, m_sid, sid, H5P_DEFAULT, buf) < 0)
+ if (H5Dread(did, mem_type_id, m_sid, sid, H5P_DEFAULT, buf) < 0)
goto out;
ret_val = 0;
out:
- if(member_name)
+ if (member_name)
H5free_memory(member_name);
- if(mtype_id > 0)
- if(H5Tclose(mtype_id) < 0)
+ if (mtype_id > 0)
+ if (H5Tclose(mtype_id) < 0)
ret_val = -1;
- if(nmtype_id > 0)
- if(H5Tclose(nmtype_id) < 0)
+ if (nmtype_id > 0)
+ if (H5Tclose(nmtype_id) < 0)
ret_val = -1;
- if(mem_type_id > 0)
- if(H5Tclose(mem_type_id) < 0)
+ if (mem_type_id > 0)
+ if (H5Tclose(mem_type_id) < 0)
ret_val = -1;
- if(ftype_id > 0)
- if(H5Tclose(ftype_id) < 0)
+ if (ftype_id > 0)
+ if (H5Tclose(ftype_id) < 0)
ret_val = -1;
- if(m_sid > 0)
- if(H5Sclose(m_sid) < 0)
+ if (m_sid > 0)
+ if (H5Sclose(m_sid) < 0)
ret_val = -1;
- if(sid > 0)
- if(H5Sclose(sid) < 0)
+ if (sid > 0)
+ if (H5Sclose(sid) < 0)
ret_val = -1;
- if(did > 0)
- if(H5Dclose(did) < 0)
+ if (did > 0)
+ if (H5Dclose(did) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBread_fields_name() */
/*-------------------------------------------------------------------------
-* Function: H5TBread_fields_index
-*
-* Purpose: Reads fields
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 19, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBread_fields_index(hid_t loc_id,
- const char *dset_name,
- hsize_t nfields,
- const int *field_index,
- hsize_t start,
- hsize_t nrecords,
- size_t type_size,
- const size_t *field_offset,
- const size_t *field_sizes,
- void *buf)
+ * Function: H5TBread_fields_index
+ *
+ * Purpose: Reads fields
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 19, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBread_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, const int *field_index,
+ hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset,
+ const size_t *field_sizes, void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t read_type_id = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t nmtype_id = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hsize_t count[1];
- hsize_t offset[1];
- hsize_t mem_size[1];
- hsize_t i;
- size_t size_native;
- char *member_name = NULL;
- herr_t ret_val = -1;
+ hid_t did = H5I_BADID;
+ hid_t tid = H5I_BADID;
+ hid_t read_type_id = H5I_BADID;
+ hid_t member_type_id = H5I_BADID;
+ hid_t nmtype_id = H5I_BADID;
+ hid_t sid = H5I_BADID;
+ hid_t m_sid = H5I_BADID;
+ hsize_t count[1];
+ hsize_t offset[1];
+ hsize_t mem_size[1];
+ hsize_t i;
+ size_t size_native;
+ char * member_name = NULL;
+ herr_t ret_val = -1;
/* check the arguments */
if (dset_name == NULL)
goto out;
/* open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
/* get the datatype */
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
goto out;
/* create a read id */
- if((read_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0)
+ if ((read_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0)
goto out;
/* iterate tru the members */
- for(i = 0; i < nfields; i++) {
- unsigned j;
+ for (i = 0; i < nfields; i++) {
+ unsigned j;
/* Range check */
- if(field_index[i] < 0)
+ if (field_index[i] < 0)
goto out;
j = (unsigned)field_index[i];
/* get the member name */
- if(NULL == (member_name = H5Tget_member_name(tid, (unsigned)j)))
+ if (NULL == (member_name = H5Tget_member_name(tid, (unsigned)j)))
goto out;
/* get the member type */
- if((member_type_id = H5Tget_member_type(tid, (unsigned)j)) < 0)
+ if ((member_type_id = H5Tget_member_type(tid, (unsigned)j)) < 0)
goto out;
/* convert to native type */
- if((nmtype_id = H5Tget_native_type(member_type_id, H5T_DIR_DEFAULT)) < 0)
+ if ((nmtype_id = H5Tget_native_type(member_type_id, H5T_DIR_DEFAULT)) < 0)
goto out;
- if(0 == (size_native = H5Tget_size(nmtype_id)))
+ if (0 == (size_native = H5Tget_size(nmtype_id)))
goto out;
- if(field_sizes[i] != size_native)
- if(H5Tset_size(nmtype_id, field_sizes[i]) < 0)
+ if (field_sizes[i] != size_native)
+ if (H5Tset_size(nmtype_id, field_sizes[i]) < 0)
goto out;
/* the field in the file is found by its name */
- if(field_offset) {
- if(H5Tinsert(read_type_id, member_name, field_offset[i], nmtype_id) < 0)
+ if (field_offset) {
+ if (H5Tinsert(read_type_id, member_name, field_offset[i], nmtype_id) < 0)
goto out;
} /* end if */
else {
- if(H5Tinsert(read_type_id, member_name, (size_t)0, nmtype_id) < 0)
+ if (H5Tinsert(read_type_id, member_name, (size_t)0, nmtype_id) < 0)
goto out;
} /* end else */
/* close the member type */
- if(H5Tclose(member_type_id) < 0)
+ if (H5Tclose(member_type_id) < 0)
goto out;
member_type_id = H5I_BADID;
- if(H5Tclose(nmtype_id) < 0)
+ if (H5Tclose(nmtype_id) < 0)
goto out;
nmtype_id = H5I_BADID;
@@ -1185,683 +1127,671 @@ herr_t H5TBread_fields_index(hid_t loc_id,
} /* end for */
/* get the dataspace handle */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto out;
/* define a hyperslab in the dataset */
offset[0] = start;
count[0] = nrecords;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto out;
/* create a memory dataspace handle */
mem_size[0] = count[0];
- if((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
+ if ((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
goto out;
/* read */
- if(H5Dread( did, read_type_id, m_sid, sid, H5P_DEFAULT, buf) < 0)
+ if (H5Dread(did, read_type_id, m_sid, sid, H5P_DEFAULT, buf) < 0)
goto out;
ret_val = 0;
out:
- if(member_name)
+ if (member_name)
H5free_memory(member_name);
- if(read_type_id > 0)
- if(H5Tclose(read_type_id) < 0)
+ if (read_type_id > 0)
+ if (H5Tclose(read_type_id) < 0)
ret_val = -1;
- if(member_type_id > 0)
- if(H5Tclose(member_type_id) < 0)
+ if (member_type_id > 0)
+ if (H5Tclose(member_type_id) < 0)
ret_val = -1;
- if(nmtype_id > 0)
- if(H5Tclose(nmtype_id) < 0)
+ if (nmtype_id > 0)
+ if (H5Tclose(nmtype_id) < 0)
ret_val = -1;
- if(tid > 0)
- if(H5Tclose(tid) < 0)
+ if (tid > 0)
+ if (H5Tclose(tid) < 0)
ret_val = -1;
- if(m_sid > 0)
- if(H5Sclose(m_sid) < 0)
+ if (m_sid > 0)
+ if (H5Sclose(m_sid) < 0)
ret_val = -1;
- if(sid > 0)
- if(H5Sclose(sid) < 0)
+ if (sid > 0)
+ if (H5Sclose(sid) < 0)
ret_val = -1;
- if(did > 0)
- if(H5Dclose(did) < 0)
+ if (did > 0)
+ if (H5Dclose(did) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBread_fields_index() */
-
/*-------------------------------------------------------------------------
-*
-* Manipulation functions
-*
-*-------------------------------------------------------------------------
-*/
+ *
+ * Manipulation functions
+ *
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
-* Function: H5TBdelete_record
-*
-* Purpose: Delete records from middle of table ("pulling up" all the records after it)
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 26, 2001
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBdelete_record(hid_t loc_id,
- const char *dset_name,
- hsize_t start,
- hsize_t nrecords)
+ * Function: H5TBdelete_record
+ *
+ * Purpose: Delete records from middle of table ("pulling up" all the records after it)
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 26, 2001
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBdelete_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
- hsize_t nfields;
- hsize_t ntotal_records;
- hsize_t read_start;
- hsize_t read_nrecords;
- hsize_t count[1];
- hsize_t offset[1];
- hsize_t mem_size[1];
- hsize_t dims[1];
- size_t src_size;
- size_t *src_offset = NULL;
- size_t *src_sizes = NULL;
- unsigned char *tmp_buf = NULL;
- herr_t ret_val = -1;
-
+ hid_t did = H5I_BADID;
+ hid_t tid = H5I_BADID;
+ hid_t sid = H5I_BADID;
+ hid_t m_sid = H5I_BADID;
+ hid_t mem_type_id = H5I_BADID;
+ hsize_t nfields;
+ hsize_t ntotal_records;
+ hsize_t read_start;
+ hsize_t read_nrecords;
+ hsize_t count[1];
+ hsize_t offset[1];
+ hsize_t mem_size[1];
+ hsize_t dims[1];
+ size_t src_size;
+ size_t * src_offset = NULL;
+ size_t * src_sizes = NULL;
+ unsigned char *tmp_buf = NULL;
+ herr_t ret_val = -1;
/* check the arguments */
if (dset_name == NULL)
goto out;
/*-------------------------------------------------------------------------
- * first we get information about type size and offsets on disk
- *-------------------------------------------------------------------------
- */
+ * first we get information about type size and offsets on disk
+ *-------------------------------------------------------------------------
+ */
/* get the number of records and fields */
- if(H5TBget_table_info(loc_id, dset_name, &nfields, &ntotal_records) < 0)
+ if (H5TBget_table_info(loc_id, dset_name, &nfields, &ntotal_records) < 0)
goto out;
- if(NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
+ if (NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
goto out;
- if(NULL == (src_sizes = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
+ if (NULL == (src_sizes = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
goto out;
/* get field info */
- if(H5TBget_field_info(loc_id, dset_name, NULL, src_sizes, src_offset, &src_size) < 0)
+ if (H5TBget_field_info(loc_id, dset_name, NULL, src_sizes, src_offset, &src_size) < 0)
goto out;
/* open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * read the records after the deleted one(s)
- *-------------------------------------------------------------------------
- */
+ * read the records after the deleted one(s)
+ *-------------------------------------------------------------------------
+ */
- read_start = start + nrecords;
+ read_start = start + nrecords;
read_nrecords = ntotal_records - read_start;
- if(read_nrecords) {
- if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)read_nrecords, src_size)))
+ if (read_nrecords) {
+ if (NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)read_nrecords, src_size)))
goto out;
/* read the records after the deleted one(s) */
- if(H5TBread_records(loc_id, dset_name, read_start, read_nrecords, src_size, src_offset, src_sizes, tmp_buf) < 0)
+ if (H5TBread_records(loc_id, dset_name, read_start, read_nrecords, src_size, src_offset, src_sizes,
+ tmp_buf) < 0)
goto out;
/*-------------------------------------------------------------------------
- * write the records in another position
- *-------------------------------------------------------------------------
- */
+ * write the records in another position
+ *-------------------------------------------------------------------------
+ */
/* get the datatype */
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
goto out;
/* get the dataspace handle */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto out;
- /* create the memory data type. */
- if((mem_type_id = H5TB_create_type( loc_id, dset_name, src_size, src_offset, src_sizes, tid)) < 0)
- goto out;
+ /* create the memory data type. */
+ if ((mem_type_id = H5TB_create_type(loc_id, dset_name, src_size, src_offset, src_sizes, tid)) < 0)
+ goto out;
/* define a hyperslab in the dataset of the size of the records */
offset[0] = start;
count[0] = read_nrecords;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto out;
/* create a memory dataspace handle */
mem_size[0] = count[0];
- if((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
+ if ((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
goto out;
- if(H5Dwrite(did, mem_type_id, m_sid, sid, H5P_DEFAULT, tmp_buf) < 0)
+ if (H5Dwrite(did, mem_type_id, m_sid, sid, H5P_DEFAULT, tmp_buf) < 0)
goto out;
/* close */
- if(H5Sclose(m_sid) < 0)
+ if (H5Sclose(m_sid) < 0)
goto out;
m_sid = H5I_BADID;
- if(H5Tclose(mem_type_id) < 0)
- goto out;
+ if (H5Tclose(mem_type_id) < 0)
+ goto out;
mem_type_id = H5I_BADID;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
sid = H5I_BADID;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
tid = H5I_BADID;
} /* read_nrecords */
/*-------------------------------------------------------------------------
- * change the dataset dimension
- *-------------------------------------------------------------------------
- */
+ * change the dataset dimension
+ *-------------------------------------------------------------------------
+ */
dims[0] = ntotal_records - nrecords;
- if(H5Dset_extent(did, dims) < 0)
+ if (H5Dset_extent(did, dims) < 0)
goto out;
ret_val = 0;
out:
- if(tmp_buf)
+ if (tmp_buf)
HDfree(tmp_buf);
- if(src_offset)
+ if (src_offset)
HDfree(src_offset);
- if(src_sizes)
+ if (src_sizes)
HDfree(src_sizes);
- if(mem_type_id > 0)
- if(H5Tclose(mem_type_id) < 0)
+ if (mem_type_id > 0)
+ if (H5Tclose(mem_type_id) < 0)
ret_val = -1;
- if(tid > 0)
- if(H5Tclose(tid) < 0)
+ if (tid > 0)
+ if (H5Tclose(tid) < 0)
ret_val = -1;
- if(m_sid > 0)
- if(H5Sclose(m_sid) < 0)
+ if (m_sid > 0)
+ if (H5Sclose(m_sid) < 0)
ret_val = -1;
- if(sid > 0)
- if(H5Sclose(sid) < 0)
+ if (sid > 0)
+ if (H5Sclose(sid) < 0)
ret_val = -1;
- if(did > 0)
- if(H5Dclose(did) < 0)
+ if (did > 0)
+ if (H5Dclose(did) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBdelete_record() */
/*-------------------------------------------------------------------------
-* Function: H5TBinsert_record
-*
-* Purpose: Inserts records into middle of table ("pushing down" all the records after it)
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 26, 2001
-*
-* Comments: Uses memory offsets
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBinsert_record(hid_t loc_id,
- const char *dset_name,
- hsize_t start,
- hsize_t nrecords,
- size_t type_size,
- const size_t *field_offset,
- const size_t *field_sizes,
- void *buf)
+ * Function: H5TBinsert_record
+ *
+ * Purpose: Inserts records into middle of table ("pushing down" all the records after it)
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 26, 2001
+ *
+ * Comments: Uses memory offsets
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBinsert_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size,
+ const size_t *field_offset, const size_t *field_sizes, void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hsize_t nfields;
- hsize_t ntotal_records;
- hsize_t read_nrecords;
- hsize_t count[1];
- hsize_t offset[1];
- hsize_t dims[1];
- hsize_t mem_dims[1];
+ hid_t did = H5I_BADID;
+ hid_t tid = H5I_BADID;
+ hid_t mem_type_id = H5I_BADID;
+ hid_t sid = H5I_BADID;
+ hid_t m_sid = H5I_BADID;
+ hsize_t nfields;
+ hsize_t ntotal_records;
+ hsize_t read_nrecords;
+ hsize_t count[1];
+ hsize_t offset[1];
+ hsize_t dims[1];
+ hsize_t mem_dims[1];
unsigned char *tmp_buf = NULL;
- herr_t ret_val = -1;
+ herr_t ret_val = -1;
/* check the arguments */
if (dset_name == NULL)
goto out;
/*-------------------------------------------------------------------------
- * read the records after the inserted one(s)
- *-------------------------------------------------------------------------
- */
+ * read the records after the inserted one(s)
+ *-------------------------------------------------------------------------
+ */
/* get the dimensions */
- if(H5TBget_table_info(loc_id, dset_name, &nfields, &ntotal_records) < 0)
+ if (H5TBget_table_info(loc_id, dset_name, &nfields, &ntotal_records) < 0)
goto out;
/* open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
/* get the datatype */
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
goto out;
/* create the memory data type. */
- if((mem_type_id = H5TB_create_type(loc_id, dset_name, type_size, field_offset, field_sizes, tid)) < 0)
+ if ((mem_type_id = H5TB_create_type(loc_id, dset_name, type_size, field_offset, field_sizes, tid)) < 0)
goto out;
read_nrecords = ntotal_records - start;
- if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t) read_nrecords, type_size)))
+ if (NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)read_nrecords, type_size)))
goto out;
/* read the records after the inserted one(s) */
- if(H5TBread_records(loc_id, dset_name, start, read_nrecords, type_size, field_offset, field_sizes, tmp_buf) < 0)
+ if (H5TBread_records(loc_id, dset_name, start, read_nrecords, type_size, field_offset, field_sizes,
+ tmp_buf) < 0)
goto out;
/* extend the dataset */
dims[0] = ntotal_records + nrecords;
- if(H5Dset_extent(did, dims) < 0)
+ if (H5Dset_extent(did, dims) < 0)
goto out;
/*-------------------------------------------------------------------------
- * write the inserted records
- *-------------------------------------------------------------------------
- */
+ * write the inserted records
+ *-------------------------------------------------------------------------
+ */
/* create a simple memory data space */
mem_dims[0] = nrecords;
- if((m_sid = H5Screate_simple(1, mem_dims, NULL)) < 0)
+ if ((m_sid = H5Screate_simple(1, mem_dims, NULL)) < 0)
goto out;
/* get the file data space */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto out;
/* define a hyperslab in the dataset to write the new data */
offset[0] = start;
count[0] = nrecords;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto out;
- if(H5Dwrite(did, mem_type_id, m_sid, sid, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did, mem_type_id, m_sid, sid, H5P_DEFAULT, buf) < 0)
goto out;
/* terminate access to the dataspace */
- if(H5Sclose(m_sid) < 0)
+ if (H5Sclose(m_sid) < 0)
goto out;
m_sid = H5I_BADID;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
sid = H5I_BADID;
/*-------------------------------------------------------------------------
- * write the "pushed down" records
- *-------------------------------------------------------------------------
- */
+ * write the "pushed down" records
+ *-------------------------------------------------------------------------
+ */
/* create a simple memory data space */
mem_dims[0] = read_nrecords;
- if((m_sid = H5Screate_simple(1, mem_dims, NULL)) < 0)
+ if ((m_sid = H5Screate_simple(1, mem_dims, NULL)) < 0)
goto out;
/* get the file data space */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto out;
/* define a hyperslab in the dataset to write the new data */
offset[0] = start + nrecords;
count[0] = read_nrecords;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto out;
- if(H5Dwrite(did, mem_type_id, m_sid, sid, H5P_DEFAULT, tmp_buf) < 0)
+ if (H5Dwrite(did, mem_type_id, m_sid, sid, H5P_DEFAULT, tmp_buf) < 0)
goto out;
ret_val = 0;
out:
- if(tmp_buf)
+ if (tmp_buf)
HDfree(tmp_buf);
- if(sid > 0)
- if(H5Sclose(sid) < 0)
+ if (sid > 0)
+ if (H5Sclose(sid) < 0)
ret_val = -1;
- if(m_sid > 0)
- if(H5Sclose(m_sid) < 0)
+ if (m_sid > 0)
+ if (H5Sclose(m_sid) < 0)
ret_val = -1;
- if(mem_type_id > 0)
- if(H5Tclose(mem_type_id) < 0)
+ if (mem_type_id > 0)
+ if (H5Tclose(mem_type_id) < 0)
ret_val = -1;
- if(tid > 0)
- if(H5Tclose(tid) < 0)
+ if (tid > 0)
+ if (H5Tclose(tid) < 0)
ret_val = -1;
- if(did > 0)
- if(H5Dclose(did) < 0)
+ if (did > 0)
+ if (H5Dclose(did) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBinsert_record() */
/*-------------------------------------------------------------------------
-* Function: H5TBadd_records_from
-*
-* Purpose: Add records from first table to second table
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: December 5, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBadd_records_from(hid_t loc_id,
- const char *dset_name1,
- hsize_t start1,
- hsize_t nrecords,
- const char *dset_name2,
- hsize_t start2)
+ * Function: H5TBadd_records_from
+ *
+ * Purpose: Add records from first table to second table
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: December 5, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBadd_records_from(hid_t loc_id, const char *dset_name1, hsize_t start1, hsize_t nrecords,
+ const char *dset_name2, hsize_t start2)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hsize_t count[1];
- hsize_t offset[1];
- hsize_t mem_size[1];
- hsize_t nfields;
- hsize_t ntotal_records;
- size_t type_size1;
- size_t src_size;
- size_t *src_offset = NULL;
- size_t *src_sizes = NULL;
- unsigned char *tmp_buf = NULL;
- herr_t ret_val = -1;
+ hid_t did = H5I_BADID;
+ hid_t tid = H5I_BADID;
+ hid_t sid = H5I_BADID;
+ hid_t m_sid = H5I_BADID;
+ hsize_t count[1];
+ hsize_t offset[1];
+ hsize_t mem_size[1];
+ hsize_t nfields;
+ hsize_t ntotal_records;
+ size_t type_size1;
+ size_t src_size;
+ size_t * src_offset = NULL;
+ size_t * src_sizes = NULL;
+ unsigned char *tmp_buf = NULL;
+ herr_t ret_val = -1;
/* check the arguments */
if (dset_name1 == NULL)
- goto out;
+ goto out;
if (dset_name2 == NULL)
- goto out;
+ goto out;
/*-------------------------------------------------------------------------
- * first we get information about type size and offsets on disk
- *-------------------------------------------------------------------------
- */
+ * first we get information about type size and offsets on disk
+ *-------------------------------------------------------------------------
+ */
/* get the number of records and fields */
- if(H5TBget_table_info(loc_id, dset_name1, &nfields, &ntotal_records) < 0)
+ if (H5TBget_table_info(loc_id, dset_name1, &nfields, &ntotal_records) < 0)
goto out;
- if(NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
+ if (NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
goto out;
- if(NULL == (src_sizes = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
+ if (NULL == (src_sizes = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
goto out;
/* get field info */
- if(H5TBget_field_info(loc_id, dset_name1, NULL, src_sizes, src_offset, &src_size) < 0)
+ if (H5TBget_field_info(loc_id, dset_name1, NULL, src_sizes, src_offset, &src_size) < 0)
goto out;
/*-------------------------------------------------------------------------
- * Get information about the first table and read it
- *-------------------------------------------------------------------------
- */
+ * Get information about the first table and read it
+ *-------------------------------------------------------------------------
+ */
/* open the 1st dataset. */
- if((did = H5Dopen2(loc_id, dset_name1, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name1, H5P_DEFAULT)) < 0)
goto out;
/* get the datatype */
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
goto out;
/* get the dataspace handle */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto out;
/* get the size of the datatype */
- if(0 == (type_size1 = H5Tget_size(tid)))
+ if (0 == (type_size1 = H5Tget_size(tid)))
goto out;
- if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, type_size1)))
+ if (NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, type_size1)))
goto out;
/* define a hyperslab in the dataset of the size of the records */
offset[0] = start1;
count[0] = nrecords;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto out;
/* create a memory dataspace handle */
mem_size[0] = count[0];
- if((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
+ if ((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
goto out;
- if(H5Dread(did, tid, m_sid, sid, H5P_DEFAULT, tmp_buf) < 0)
+ if (H5Dread(did, tid, m_sid, sid, H5P_DEFAULT, tmp_buf) < 0)
goto out;
/*-------------------------------------------------------------------------
- * add to the second table
- *-------------------------------------------------------------------------
- */
- if(H5TBinsert_record(loc_id, dset_name2, start2, nrecords, src_size, src_offset, src_sizes, tmp_buf) < 0)
+ * add to the second table
+ *-------------------------------------------------------------------------
+ */
+ if (H5TBinsert_record(loc_id, dset_name2, start2, nrecords, src_size, src_offset, src_sizes, tmp_buf) < 0)
goto out;
ret_val = 0;
out:
- if(tmp_buf)
+ if (tmp_buf)
HDfree(tmp_buf);
- if(src_offset)
+ if (src_offset)
HDfree(src_offset);
- if(src_sizes)
+ if (src_sizes)
HDfree(src_sizes);
- if(tid > 0)
- if(H5Tclose(tid) < 0)
+ if (tid > 0)
+ if (H5Tclose(tid) < 0)
ret_val = -1;
- if(sid > 0)
- if(H5Sclose(sid) < 0)
+ if (sid > 0)
+ if (H5Sclose(sid) < 0)
ret_val = -1;
- if(m_sid > 0)
- if(H5Sclose(m_sid) < 0)
+ if (m_sid > 0)
+ if (H5Sclose(m_sid) < 0)
ret_val = -1;
- if(did > 0)
- if(H5Dclose(did) < 0)
+ if (did > 0)
+ if (H5Dclose(did) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBadd_records_from() */
/*-------------------------------------------------------------------------
-* Function: H5TBcombine_tables
-*
-* Purpose: Combine records from two tables into a third
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: December 10, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBcombine_tables(hid_t loc_id1,
- const char *dset_name1,
- hid_t loc_id2,
- const char *dset_name2,
- const char *dset_name3)
+ * Function: H5TBcombine_tables
+ *
+ * Purpose: Combine records from two tables into a third
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: December 10, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const char *dset_name2,
+ const char *dset_name3)
{
/* identifiers for the 1st dataset. */
- hid_t did_1 = H5I_BADID;
- hid_t tid_1 = H5I_BADID;
- hid_t sid_1 = H5I_BADID;
- hid_t pid_1 = H5I_BADID;
+ hid_t did_1 = H5I_BADID;
+ hid_t tid_1 = H5I_BADID;
+ hid_t sid_1 = H5I_BADID;
+ hid_t pid_1 = H5I_BADID;
/* identifiers for the 2nd dataset. */
- hid_t did_2 = H5I_BADID;
- hid_t tid_2 = H5I_BADID;
- hid_t sid_2 = H5I_BADID;
- hid_t pid_2 = H5I_BADID;
+ hid_t did_2 = H5I_BADID;
+ hid_t tid_2 = H5I_BADID;
+ hid_t sid_2 = H5I_BADID;
+ hid_t pid_2 = H5I_BADID;
/* identifiers for the 3rd dataset. */
- hid_t did_3 = H5I_BADID;
- hid_t tid_3 = H5I_BADID;
- hid_t sid_3 = H5I_BADID;
- hid_t pid_3 = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t attr_id = H5I_BADID;
- hsize_t count[1];
- hsize_t offset[1];
- hsize_t mem_size[1];
- hsize_t nfields;
- hsize_t nrecords;
- hsize_t dims[1];
- hsize_t maxdims[1] = {H5S_UNLIMITED};
- hsize_t i;
- size_t type_size;
- size_t member_offset;
- size_t src_size;
- size_t *src_offset = NULL;
- size_t *src_sizes = NULL;
- char attr_name[255];
- unsigned char *tmp_buf = NULL;
+ hid_t did_3 = H5I_BADID;
+ hid_t tid_3 = H5I_BADID;
+ hid_t sid_3 = H5I_BADID;
+ hid_t pid_3 = H5I_BADID;
+ hid_t sid = H5I_BADID;
+ hid_t m_sid = H5I_BADID;
+ hid_t member_type_id = H5I_BADID;
+ hid_t attr_id = H5I_BADID;
+ hsize_t count[1];
+ hsize_t offset[1];
+ hsize_t mem_size[1];
+ hsize_t nfields;
+ hsize_t nrecords;
+ hsize_t dims[1];
+ hsize_t maxdims[1] = {H5S_UNLIMITED};
+ hsize_t i;
+ size_t type_size;
+ size_t member_offset;
+ size_t src_size;
+ size_t * src_offset = NULL;
+ size_t * src_sizes = NULL;
+ char attr_name[255];
+ unsigned char *tmp_buf = NULL;
unsigned char *tmp_fill_buf = NULL;
- htri_t has_fill;
- herr_t ret_val = -1;
+ htri_t has_fill;
+ herr_t ret_val = -1;
/* check the arguments */
if (dset_name1 == NULL)
- goto out;
+ goto out;
if (dset_name2 == NULL)
- goto out;
+ goto out;
if (dset_name3 == NULL)
- goto out;
+ goto out;
/*-------------------------------------------------------------------------
- * first we get information about type size and offsets on disk
- *-------------------------------------------------------------------------
- */
+ * first we get information about type size and offsets on disk
+ *-------------------------------------------------------------------------
+ */
/* get the number of records and fields */
- if(H5TBget_table_info(loc_id1, dset_name1, &nfields, &nrecords) < 0)
+ if (H5TBget_table_info(loc_id1, dset_name1, &nfields, &nrecords) < 0)
goto out;
- if(NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
+ if (NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
goto out;
- if(NULL == (src_sizes = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
+ if (NULL == (src_sizes = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
goto out;
/* get field info */
- if(H5TBget_field_info(loc_id1, dset_name1, NULL, src_sizes, src_offset, &src_size) < 0)
+ if (H5TBget_field_info(loc_id1, dset_name1, NULL, src_sizes, src_offset, &src_size) < 0)
goto out;
/*-------------------------------------------------------------------------
- * get information about the first table
- *-------------------------------------------------------------------------
- */
+ * get information about the first table
+ *-------------------------------------------------------------------------
+ */
/* open the 1st dataset. */
- if((did_1 = H5Dopen2(loc_id1, dset_name1, H5P_DEFAULT)) < 0)
+ if ((did_1 = H5Dopen2(loc_id1, dset_name1, H5P_DEFAULT)) < 0)
goto out;
/* get the datatype */
- if((tid_1 = H5Dget_type(did_1)) < 0)
+ if ((tid_1 = H5Dget_type(did_1)) < 0)
goto out;
/* get the dataspace handle */
- if((sid_1 = H5Dget_space(did_1)) < 0)
+ if ((sid_1 = H5Dget_space(did_1)) < 0)
goto out;
/* get creation properties list */
- if((pid_1 = H5Dget_create_plist(did_1)) < 0)
+ if ((pid_1 = H5Dget_create_plist(did_1)) < 0)
goto out;
/* get the dimensions */
- if(H5TBget_table_info(loc_id1, dset_name1, &nfields, &nrecords) < 0)
+ if (H5TBget_table_info(loc_id1, dset_name1, &nfields, &nrecords) < 0)
goto out;
/*-------------------------------------------------------------------------
- * make the merged table with no data originally
- *-------------------------------------------------------------------------
- */
+ * make the merged table with no data originally
+ *-------------------------------------------------------------------------
+ */
/* clone the property list */
- if((pid_3 = H5Pcopy(pid_1)) < 0)
+ if ((pid_3 = H5Pcopy(pid_1)) < 0)
goto out;
/* clone the type id */
- if((tid_3 = H5Tcopy(tid_1)) < 0)
+ if ((tid_3 = H5Tcopy(tid_1)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * here we do not clone the file space from the 1st dataset, because we want to create
- * an empty table. Instead we create a new dataspace with zero records and expandable.
- *-------------------------------------------------------------------------
- */
+ * here we do not clone the file space from the 1st dataset, because we want to create
+ * an empty table. Instead we create a new dataspace with zero records and expandable.
+ *-------------------------------------------------------------------------
+ */
dims[0] = 0;
/* create a simple data space with unlimited size */
- if((sid_3 = H5Screate_simple(1, dims, maxdims)) < 0)
+ if ((sid_3 = H5Screate_simple(1, dims, maxdims)) < 0)
goto out;
/* create the dataset */
- if((did_3 = H5Dcreate2(loc_id1, dset_name3, tid_3, sid_3, H5P_DEFAULT, pid_3, H5P_DEFAULT)) < 0)
+ if ((did_3 = H5Dcreate2(loc_id1, dset_name3, tid_3, sid_3, H5P_DEFAULT, pid_3, H5P_DEFAULT)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attach the conforming table attributes
- *-------------------------------------------------------------------------
- */
- if(H5TB_attach_attributes("Merge table", loc_id1, dset_name3, nfields, tid_3) < 0)
+ * attach the conforming table attributes
+ *-------------------------------------------------------------------------
+ */
+ if (H5TB_attach_attributes("Merge table", loc_id1, dset_name3, nfields, tid_3) < 0)
goto out;
/*-------------------------------------------------------------------------
- * get attributes
- *-------------------------------------------------------------------------
- */
- if(0 == (type_size = H5Tget_size(tid_3)))
+ * get attributes
+ *-------------------------------------------------------------------------
+ */
+ if (0 == (type_size = H5Tget_size(tid_3)))
goto out;
/* alloc fill value attribute buffer */
- if(NULL == (tmp_fill_buf = (unsigned char *)HDmalloc(type_size)))
+ if (NULL == (tmp_fill_buf = (unsigned char *)HDmalloc(type_size)))
goto out;
/* get the fill value attributes */
- if((has_fill = H5TBAget_fill(loc_id1, dset_name1, did_1, tmp_fill_buf)) < 0)
+ if ((has_fill = H5TBAget_fill(loc_id1, dset_name1, did_1, tmp_fill_buf)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attach the fill attributes from previous table
- *-------------------------------------------------------------------------
- */
- if(has_fill) {
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ * attach the fill attributes from previous table
+ *-------------------------------------------------------------------------
+ */
+ if (has_fill) {
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
goto out;
- for(i = 0; i < nfields; i++) {
+ for (i = 0; i < nfields; i++) {
/* get the member type */
- if((member_type_id = H5Tget_member_type(tid_3, (unsigned)i)) < 0)
+ if ((member_type_id = H5Tget_member_type(tid_3, (unsigned)i)) < 0)
goto out;
/* get the member offset */
@@ -1869,249 +1799,245 @@ herr_t H5TBcombine_tables(hid_t loc_id1,
HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
- if((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Awrite(attr_id, member_type_id, tmp_fill_buf + member_offset) < 0)
+ if (H5Awrite(attr_id, member_type_id, tmp_fill_buf + member_offset) < 0)
goto out;
- if(H5Aclose(attr_id) < 0)
+ if (H5Aclose(attr_id) < 0)
goto out;
attr_id = H5I_BADID;
- if(H5Tclose(member_type_id) < 0)
+ if (H5Tclose(member_type_id) < 0)
goto out;
member_type_id = H5I_BADID;
} /* end for */
/* close data space. */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
sid = H5I_BADID;
} /* end if */
/*-------------------------------------------------------------------------
- * read data from 1st table
- *-------------------------------------------------------------------------
- */
- if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, type_size)))
+ * read data from 1st table
+ *-------------------------------------------------------------------------
+ */
+ if (NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, type_size)))
goto out;
/* define a hyperslab in the dataset of the size of the records */
offset[0] = 0;
count[0] = nrecords;
- if(H5Sselect_hyperslab(sid_1, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid_1, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto out;
/* create a memory dataspace handle */
mem_size[0] = count[0];
- if((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
+ if ((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
goto out;
- if(H5Dread(did_1, tid_1, m_sid, sid_1, H5P_DEFAULT, tmp_buf) < 0)
+ if (H5Dread(did_1, tid_1, m_sid, sid_1, H5P_DEFAULT, tmp_buf) < 0)
goto out;
/*-------------------------------------------------------------------------
- * save data from 1st table into new table
- *-------------------------------------------------------------------------
- */
+ * save data from 1st table into new table
+ *-------------------------------------------------------------------------
+ */
/* append the records to the new table */
- if(H5TBappend_records(loc_id1, dset_name3, nrecords, src_size, src_offset, src_sizes, tmp_buf) < 0)
+ if (H5TBappend_records(loc_id1, dset_name3, nrecords, src_size, src_offset, src_sizes, tmp_buf) < 0)
goto out;
/*-------------------------------------------------------------------------
- * release temporary resources
- *-------------------------------------------------------------------------
- */
- if(H5Sclose(m_sid) < 0)
+ * release temporary resources
+ *-------------------------------------------------------------------------
+ */
+ if (H5Sclose(m_sid) < 0)
goto out;
m_sid = H5I_BADID;
HDfree(tmp_buf);
tmp_buf = NULL;
/*-------------------------------------------------------------------------
- * get information about the 2nd table
- *-------------------------------------------------------------------------
- */
+ * get information about the 2nd table
+ *-------------------------------------------------------------------------
+ */
/* open the dataset. */
- if((did_2 = H5Dopen2(loc_id2, dset_name2, H5P_DEFAULT)) < 0)
+ if ((did_2 = H5Dopen2(loc_id2, dset_name2, H5P_DEFAULT)) < 0)
goto out;
/* get the datatype */
- if((tid_2 = H5Dget_type(did_2)) < 0)
+ if ((tid_2 = H5Dget_type(did_2)) < 0)
goto out;
/* get the dataspace handle */
- if((sid_2 = H5Dget_space(did_2)) < 0)
+ if ((sid_2 = H5Dget_space(did_2)) < 0)
goto out;
/* get the property list handle */
- if((pid_2 = H5Dget_create_plist(did_2)) < 0)
+ if ((pid_2 = H5Dget_create_plist(did_2)) < 0)
goto out;
/* get the dimensions */
- if(H5TBget_table_info(loc_id2, dset_name2, &nfields, &nrecords) < 0)
+ if (H5TBget_table_info(loc_id2, dset_name2, &nfields, &nrecords) < 0)
goto out;
/*-------------------------------------------------------------------------
- * read data from 2nd table
- *-------------------------------------------------------------------------
- */
+ * read data from 2nd table
+ *-------------------------------------------------------------------------
+ */
- if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, type_size)))
+ if (NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, type_size)))
goto out;
/* define a hyperslab in the dataset of the size of the records */
offset[0] = 0;
count[0] = nrecords;
- if(H5Sselect_hyperslab(sid_2, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid_2, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto out;
/* create a memory dataspace handle */
mem_size[0] = count[0];
- if((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
+ if ((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
goto out;
- if(H5Dread(did_2, tid_2, m_sid, sid_2, H5P_DEFAULT, tmp_buf) < 0)
+ if (H5Dread(did_2, tid_2, m_sid, sid_2, H5P_DEFAULT, tmp_buf) < 0)
goto out;
/*-------------------------------------------------------------------------
- * save data from 2nd table into new table
- *-------------------------------------------------------------------------
- */
+ * save data from 2nd table into new table
+ *-------------------------------------------------------------------------
+ */
/* append the records to the new table */
- if(H5TBappend_records(loc_id1, dset_name3, nrecords, src_size, src_offset, src_sizes, tmp_buf) < 0)
+ if (H5TBappend_records(loc_id1, dset_name3, nrecords, src_size, src_offset, src_sizes, tmp_buf) < 0)
goto out;
ret_val = 0;
out:
- if(tmp_buf)
+ if (tmp_buf)
HDfree(tmp_buf);
- if(tmp_fill_buf)
+ if (tmp_fill_buf)
HDfree(tmp_fill_buf);
- if(src_offset)
+ if (src_offset)
HDfree(src_offset);
- if(src_sizes)
+ if (src_sizes)
HDfree(src_sizes);
- if(member_type_id > 0)
- if(H5Tclose(member_type_id) < 0)
+ if (member_type_id > 0)
+ if (H5Tclose(member_type_id) < 0)
ret_val = -1;
- if(attr_id > 0)
- if(H5Aclose(attr_id) < 0)
+ if (attr_id > 0)
+ if (H5Aclose(attr_id) < 0)
ret_val = -1;
- if(sid > 0)
- if(H5Sclose(sid) < 0)
+ if (sid > 0)
+ if (H5Sclose(sid) < 0)
ret_val = -1;
- if(m_sid > 0)
- if(H5Sclose(m_sid) < 0)
+ if (m_sid > 0)
+ if (H5Sclose(m_sid) < 0)
ret_val = -1;
- if(sid_1 > 0)
- if(H5Sclose(sid_1) < 0)
+ if (sid_1 > 0)
+ if (H5Sclose(sid_1) < 0)
ret_val = -1;
- if(tid_1 > 0)
- if(H5Tclose(tid_1) < 0)
+ if (tid_1 > 0)
+ if (H5Tclose(tid_1) < 0)
ret_val = -1;
- if(pid_1 > 0)
- if(H5Pclose(pid_1) < 0)
+ if (pid_1 > 0)
+ if (H5Pclose(pid_1) < 0)
ret_val = -1;
- if(did_1 > 0)
- if(H5Dclose(did_1) < 0)
+ if (did_1 > 0)
+ if (H5Dclose(did_1) < 0)
ret_val = -1;
- if(sid_2 > 0)
- if(H5Sclose(sid_2) < 0)
+ if (sid_2 > 0)
+ if (H5Sclose(sid_2) < 0)
ret_val = -1;
- if(tid_2 > 0)
- if(H5Tclose(tid_2) < 0)
+ if (tid_2 > 0)
+ if (H5Tclose(tid_2) < 0)
ret_val = -1;
- if(pid_2 > 0)
- if(H5Pclose(pid_2) < 0)
+ if (pid_2 > 0)
+ if (H5Pclose(pid_2) < 0)
ret_val = -1;
- if(did_2 > 0)
- if(H5Dclose(did_2) < 0)
+ if (did_2 > 0)
+ if (H5Dclose(did_2) < 0)
ret_val = -1;
- if(sid_3 > 0)
- if(H5Sclose(sid_3) < 0)
+ if (sid_3 > 0)
+ if (H5Sclose(sid_3) < 0)
ret_val = -1;
- if(tid_3 > 0)
- if(H5Tclose(tid_3) < 0)
+ if (tid_3 > 0)
+ if (H5Tclose(tid_3) < 0)
ret_val = -1;
- if(pid_3 > 0)
- if(H5Pclose(pid_3) < 0)
+ if (pid_3 > 0)
+ if (H5Pclose(pid_3) < 0)
ret_val = -1;
- if(did_3 > 0)
- if(H5Dclose(did_3) < 0)
+ if (did_3 > 0)
+ if (H5Dclose(did_3) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBcombine_tables() */
/*-------------------------------------------------------------------------
-* Function: H5TBinsert_field
-*
-* Purpose: Inserts a field
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: January 30, 2002
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBinsert_field(hid_t loc_id,
- const char *dset_name,
- const char *field_name,
- hid_t field_type,
- hsize_t position,
- const void *fill_data,
- const void *buf)
+ * Function: H5TBinsert_field
+ *
+ * Purpose: Inserts a field
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: January 30, 2002
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hid_t field_type,
+ hsize_t position, const void *fill_data, const void *buf)
{
/* identifiers for the 1st, original dataset */
- hid_t did_1 = H5I_BADID;
- hid_t tid_1 = H5I_BADID;
- hid_t sid_1 = H5I_BADID;
- hid_t pid_1 = H5I_BADID;
- hid_t msid_1 = H5I_BADID;
+ hid_t did_1 = H5I_BADID;
+ hid_t tid_1 = H5I_BADID;
+ hid_t sid_1 = H5I_BADID;
+ hid_t pid_1 = H5I_BADID;
+ hid_t msid_1 = H5I_BADID;
/* identifiers for the 2nd, new dataset */
- hid_t did_2 = H5I_BADID;
- hid_t tid_2 = H5I_BADID;
- hid_t sid_2 = H5I_BADID;
- hid_t pid_2 = H5I_BADID;
- hid_t msid_2 = H5I_BADID;
+ hid_t did_2 = H5I_BADID;
+ hid_t tid_2 = H5I_BADID;
+ hid_t sid_2 = H5I_BADID;
+ hid_t pid_2 = H5I_BADID;
+ hid_t msid_2 = H5I_BADID;
/* identifiers for the 3rd, final dataset */
- hid_t did_3 = H5I_BADID;
- hid_t tid_3 = H5I_BADID;
- hid_t sid_3 = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t write_type_id = H5I_BADID;
- hid_t preserve_id = H5I_BADID;
- hid_t attr_id = H5I_BADID;
- size_t member_size;
- size_t new_member_size = 0;
- size_t total_size;
- size_t curr_offset;
- hsize_t nfields;
- hsize_t nrecords;
- hsize_t dims_chunk[1];
- hsize_t dims[1];
- hsize_t maxdims[1] = { H5S_UNLIMITED };
- hsize_t count[1];
- hsize_t offset[1];
- hsize_t mem_size[1];
- hsize_t i;
- char table_title[255];
- char attr_name[255];
- char *member_name = NULL;
- unsigned char *tmp_buf = NULL;
+ hid_t did_3 = H5I_BADID;
+ hid_t tid_3 = H5I_BADID;
+ hid_t sid_3 = H5I_BADID;
+ hid_t member_type_id = H5I_BADID;
+ hid_t write_type_id = H5I_BADID;
+ hid_t preserve_id = H5I_BADID;
+ hid_t attr_id = H5I_BADID;
+ size_t member_size;
+ size_t new_member_size = 0;
+ size_t total_size;
+ size_t curr_offset;
+ hsize_t nfields;
+ hsize_t nrecords;
+ hsize_t dims_chunk[1];
+ hsize_t dims[1];
+ hsize_t maxdims[1] = {H5S_UNLIMITED};
+ hsize_t count[1];
+ hsize_t offset[1];
+ hsize_t mem_size[1];
+ hsize_t i;
+ char table_title[255];
+ char attr_name[255];
+ char * member_name = NULL;
+ unsigned char *tmp_buf = NULL;
unsigned char *tmp_fill_buf = NULL;
- hbool_t inserted;
- herr_t ret_val = -1;
+ hbool_t inserted;
+ herr_t ret_val = -1;
/* check the arguments */
if (dset_name == NULL)
@@ -2120,7 +2046,7 @@ herr_t H5TBinsert_field(hid_t loc_id,
goto out;
/* get the number of records and fields */
- if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0)
+ if (H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0)
goto out;
/*-------------------------------------------------------------------------
@@ -2129,27 +2055,27 @@ herr_t H5TBinsert_field(hid_t loc_id,
*/
/* open the dataset. */
- if((did_1 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did_1 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
/* get creation properties list */
- if((pid_1 = H5Dget_create_plist(did_1)) < 0)
+ if ((pid_1 = H5Dget_create_plist(did_1)) < 0)
goto out;
/* get the datatype */
- if((tid_1 = H5Dget_type(did_1)) < 0)
+ if ((tid_1 = H5Dget_type(did_1)) < 0)
goto out;
/* get the size of the datatype */
- if(0 == (total_size = H5Tget_size(tid_1)))
+ if (0 == (total_size = H5Tget_size(tid_1)))
goto out;
/* get the dataspace handle */
- if((sid_1 = H5Dget_space(did_1)) < 0)
+ if ((sid_1 = H5Dget_space(did_1)) < 0)
goto out;
/* get dimension */
- if(H5Sget_simple_extent_dims(sid_1, dims, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid_1, dims, NULL) < 0)
goto out;
/*-------------------------------------------------------------------------
@@ -2158,15 +2084,15 @@ herr_t H5TBinsert_field(hid_t loc_id,
*/
/* get the table title */
- if((H5TBAget_title(did_1, table_title)) < 0)
+ if ((H5TBAget_title(did_1, table_title)) < 0)
goto out;
/* alloc fill value attribute buffer */
- if(NULL == (tmp_fill_buf = (unsigned char *)HDmalloc(total_size)))
+ if (NULL == (tmp_fill_buf = (unsigned char *)HDmalloc(total_size)))
goto out;
/* get the fill value attributes */
- if((H5TBAget_fill(loc_id, dset_name, did_1, tmp_fill_buf)) < 0)
+ if ((H5TBAget_fill(loc_id, dset_name, did_1, tmp_fill_buf)) < 0)
goto out;
/*-------------------------------------------------------------------------
@@ -2175,31 +2101,31 @@ herr_t H5TBinsert_field(hid_t loc_id,
*/
/* get the new member size */
- if(0 == (member_size = H5Tget_size(field_type)))
+ if (0 == (member_size = H5Tget_size(field_type)))
goto out;
/* create the data type. */
- if((tid_2 = H5Tcreate(H5T_COMPOUND, (size_t)(total_size + member_size))) < 0)
+ if ((tid_2 = H5Tcreate(H5T_COMPOUND, (size_t)(total_size + member_size))) < 0)
goto out;
curr_offset = 0;
inserted = FALSE;
/* insert the old fields, counting with the new one */
- for(i = 0; i < nfields + 1; i++) {
- hsize_t idx;
+ for (i = 0; i < nfields + 1; i++) {
+ hsize_t idx;
idx = i;
- if(inserted)
+ if (inserted)
idx = i - 1;
- if(i == position) {
+ if (i == position) {
/* get the new member size */
- if(0 == (new_member_size = H5Tget_size(field_type)))
+ if (0 == (new_member_size = H5Tget_size(field_type)))
goto out;
/* insert the new field type */
- if(H5Tinsert(tid_2, field_name, curr_offset, field_type) < 0)
+ if (H5Tinsert(tid_2, field_name, curr_offset, field_type) < 0)
goto out;
curr_offset += new_member_size;
@@ -2208,19 +2134,19 @@ herr_t H5TBinsert_field(hid_t loc_id,
} /* end if */
else {
/* get the member name */
- if(NULL == (member_name = H5Tget_member_name(tid_1, (unsigned)idx)))
+ if (NULL == (member_name = H5Tget_member_name(tid_1, (unsigned)idx)))
goto out;
/* get the member type */
- if((member_type_id = H5Tget_member_type(tid_1, (unsigned)idx)) < 0)
+ if ((member_type_id = H5Tget_member_type(tid_1, (unsigned)idx)) < 0)
goto out;
/* get the member size */
- if(0 == (member_size = H5Tget_size(member_type_id)))
+ if (0 == (member_size = H5Tget_size(member_type_id)))
goto out;
/* insert it into the new type */
- if(H5Tinsert(tid_2, member_name, curr_offset, member_type_id) < 0)
+ if (H5Tinsert(tid_2, member_name, curr_offset, member_type_id) < 0)
goto out;
curr_offset += member_size;
@@ -2229,11 +2155,11 @@ herr_t H5TBinsert_field(hid_t loc_id,
member_name = NULL;
/* close the member type */
- if(H5Tclose(member_type_id) < 0)
+ if (H5Tclose(member_type_id) < 0)
goto out;
member_type_id = H5I_BADID;
} /* end else */
- } /* end for */
+ } /* end for */
/*-------------------------------------------------------------------------
* create a new temporary dataset
@@ -2241,21 +2167,21 @@ herr_t H5TBinsert_field(hid_t loc_id,
*/
/* retrieve the size of chunk */
- if(H5Pget_chunk(pid_1, 1, dims_chunk) < 0)
+ if (H5Pget_chunk(pid_1, 1, dims_chunk) < 0)
goto out;
/* create a new simple data space with unlimited size, using the dimension */
- if((sid_2 = H5Screate_simple(1, dims, maxdims)) < 0)
+ if ((sid_2 = H5Screate_simple(1, dims, maxdims)) < 0)
goto out;
/* modify dataset creation properties, i.e. enable chunking */
- if((pid_2 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((pid_2 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
- if(H5Pset_chunk(pid_2, 1, dims_chunk) < 0)
+ if (H5Pset_chunk(pid_2, 1, dims_chunk) < 0)
goto out;
/* create the dataset. */
- if((did_2 = H5Dcreate2(loc_id, "new", tid_2, sid_2, H5P_DEFAULT, pid_2, H5P_DEFAULT)) < 0)
+ if ((did_2 = H5Dcreate2(loc_id, "new", tid_2, sid_2, H5P_DEFAULT, pid_2, H5P_DEFAULT)) < 0)
goto out;
/*-------------------------------------------------------------------------
@@ -2263,21 +2189,21 @@ herr_t H5TBinsert_field(hid_t loc_id,
*-------------------------------------------------------------------------
*/
- if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, (size_t)total_size)))
+ if (NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, (size_t)total_size)))
goto out;
/* define a hyperslab in the dataset of the size of the records */
offset[0] = 0;
count[0] = nrecords;
- if(H5Sselect_hyperslab(sid_1, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid_1, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto out;
/* create a memory dataspace handle */
mem_size[0] = count[0];
- if((msid_1 = H5Screate_simple(1, mem_size, NULL)) < 0)
+ if ((msid_1 = H5Screate_simple(1, mem_size, NULL)) < 0)
goto out;
- if(H5Dread(did_1, tid_1, msid_1, H5S_ALL, H5P_DEFAULT, tmp_buf) < 0)
+ if (H5Dread(did_1, tid_1, msid_1, H5S_ALL, H5P_DEFAULT, tmp_buf) < 0)
goto out;
/*-------------------------------------------------------------------------
@@ -2286,7 +2212,7 @@ herr_t H5TBinsert_field(hid_t loc_id,
*/
/* write */
- if(H5Dwrite(did_2, tid_1, msid_1, H5S_ALL, H5P_DEFAULT, tmp_buf) < 0)
+ if (H5Dwrite(did_2, tid_1, msid_1, H5S_ALL, H5P_DEFAULT, tmp_buf) < 0)
goto out;
/*-------------------------------------------------------------------------
@@ -2295,27 +2221,27 @@ herr_t H5TBinsert_field(hid_t loc_id,
*/
/* create a write id */
- if((write_type_id = H5Tcreate(H5T_COMPOUND, (size_t)new_member_size)) < 0)
+ if ((write_type_id = H5Tcreate(H5T_COMPOUND, (size_t)new_member_size)) < 0)
goto out;
/* the field in the file is found by its name */
- if(H5Tinsert(write_type_id, field_name, (size_t)0, field_type) < 0)
+ if (H5Tinsert(write_type_id, field_name, (size_t)0, field_type) < 0)
goto out;
/* create xfer properties to preserve initialized data */
- if((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto out;
- if(H5Pset_preserve(preserve_id, 1) < 0)
+ if (H5Pset_preserve(preserve_id, 1) < 0)
goto out;
/* only write if there is something to write */
- if(buf) {
+ if (buf) {
/* create a memory dataspace handle */
- if((msid_2 = H5Screate_simple(1, mem_size, NULL)) < 0)
+ if ((msid_2 = H5Screate_simple(1, mem_size, NULL)) < 0)
goto out;
/* write */
- if(H5Dwrite(did_2, write_type_id, msid_2, sid_2, preserve_id, buf) < 0)
+ if (H5Dwrite(did_2, write_type_id, msid_2, sid_2, preserve_id, buf) < 0)
goto out;
} /* end if */
@@ -2323,14 +2249,14 @@ herr_t H5TBinsert_field(hid_t loc_id,
* delete 1st table
*-------------------------------------------------------------------------
*/
- if(H5Ldelete(loc_id, dset_name, H5P_DEFAULT) < 0)
+ if (H5Ldelete(loc_id, dset_name, H5P_DEFAULT) < 0)
goto out;
/*-------------------------------------------------------------------------
* rename 2nd table
*-------------------------------------------------------------------------
*/
- if(H5Lmove(loc_id, "new", H5L_SAME_LOC, dset_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lmove(loc_id, "new", H5L_SAME_LOC, dset_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
/*-------------------------------------------------------------------------
@@ -2339,33 +2265,33 @@ herr_t H5TBinsert_field(hid_t loc_id,
*/
/* get the number of records and fields */
- if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0)
+ if (H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0)
goto out;
/* open the dataset. */
- if((did_3 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did_3 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
/* get the datatype */
- if((tid_3 = H5Dget_type(did_3)) < 0)
+ if ((tid_3 = H5Dget_type(did_3)) < 0)
goto out;
/* set the attributes */
- if(H5TB_attach_attributes(table_title, loc_id, dset_name, (hsize_t)nfields, tid_3) < 0)
+ if (H5TB_attach_attributes(table_title, loc_id, dset_name, (hsize_t)nfields, tid_3) < 0)
goto out;
/*-------------------------------------------------------------------------
* attach the fill attributes from previous table
*-------------------------------------------------------------------------
*/
- if((sid_3 = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid_3 = H5Screate(H5S_SCALAR)) < 0)
goto out;
- for(i = 0; i < (nfields - 1); i++) {
- size_t member_offset;
+ for (i = 0; i < (nfields - 1); i++) {
+ size_t member_offset;
/* get the member type */
- if((member_type_id = H5Tget_member_type(tid_3, (unsigned)i)) < 0)
+ if ((member_type_id = H5Tget_member_type(tid_3, (unsigned)i)) < 0)
goto out;
/* get the member offset */
@@ -2373,18 +2299,18 @@ herr_t H5TBinsert_field(hid_t loc_id,
HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
- if((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid_3, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid_3, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Awrite(attr_id, member_type_id, tmp_fill_buf + member_offset) < 0)
+ if (H5Awrite(attr_id, member_type_id, tmp_fill_buf + member_offset) < 0)
goto out;
- if(H5Aclose(attr_id) < 0)
+ if (H5Aclose(attr_id) < 0)
goto out;
attr_id = H5I_BADID;
/* close the member type */
- if(H5Tclose(member_type_id) < 0)
+ if (H5Tclose(member_type_id) < 0)
goto out;
member_type_id = H5I_BADID;
} /* end for */
@@ -2393,24 +2319,24 @@ herr_t H5TBinsert_field(hid_t loc_id,
* attach the fill attribute from the new field, if present
*-------------------------------------------------------------------------
*/
- if(fill_data) {
+ if (fill_data) {
HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)(nfields - 1));
/* get the member type */
- if((member_type_id = H5Tget_member_type(tid_3, (unsigned)nfields - 1)) < 0)
+ if ((member_type_id = H5Tget_member_type(tid_3, (unsigned)nfields - 1)) < 0)
goto out;
- if((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid_3, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid_3, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Awrite(attr_id, member_type_id, fill_data) < 0)
+ if (H5Awrite(attr_id, member_type_id, fill_data) < 0)
goto out;
- if(H5Aclose(attr_id) < 0)
+ if (H5Aclose(attr_id) < 0)
goto out;
attr_id = H5I_BADID;
- if(H5Tclose(member_type_id) < 0)
+ if (H5Tclose(member_type_id) < 0)
goto out;
member_type_id = H5I_BADID;
} /* end fill_data */
@@ -2418,115 +2344,113 @@ herr_t H5TBinsert_field(hid_t loc_id,
ret_val = 0;
out:
- if(member_name)
+ if (member_name)
H5free_memory(member_name);
- if(tmp_buf)
+ if (tmp_buf)
HDfree(tmp_buf);
- if(tmp_fill_buf)
+ if (tmp_fill_buf)
HDfree(tmp_fill_buf);
- if(preserve_id > 0)
- if(H5Pclose(preserve_id) < 0)
+ if (preserve_id > 0)
+ if (H5Pclose(preserve_id) < 0)
ret_val = -1;
- if(msid_1 > 0)
- if(H5Sclose(msid_1) < 0)
+ if (msid_1 > 0)
+ if (H5Sclose(msid_1) < 0)
ret_val = -1;
- if(tid_1 > 0)
- if(H5Tclose(tid_1) < 0)
+ if (tid_1 > 0)
+ if (H5Tclose(tid_1) < 0)
ret_val = -1;
- if(pid_1 > 0)
- if(H5Pclose(pid_1) < 0)
+ if (pid_1 > 0)
+ if (H5Pclose(pid_1) < 0)
ret_val = -1;
- if(sid_1 > 0)
- if(H5Sclose(sid_1) < 0)
+ if (sid_1 > 0)
+ if (H5Sclose(sid_1) < 0)
ret_val = -1;
- if(did_1 > 0)
- if(H5Dclose(did_1) < 0)
+ if (did_1 > 0)
+ if (H5Dclose(did_1) < 0)
ret_val = -1;
- if(msid_2 > 0)
- if(H5Sclose(msid_2) < 0)
+ if (msid_2 > 0)
+ if (H5Sclose(msid_2) < 0)
ret_val = -1;
- if(sid_2 > 0)
- if(H5Sclose(sid_2) < 0)
+ if (sid_2 > 0)
+ if (H5Sclose(sid_2) < 0)
ret_val = -1;
- if(tid_2 > 0)
- if(H5Tclose(tid_2) < 0)
+ if (tid_2 > 0)
+ if (H5Tclose(tid_2) < 0)
ret_val = -1;
- if(pid_2 > 0)
- if(H5Pclose(pid_2) < 0)
+ if (pid_2 > 0)
+ if (H5Pclose(pid_2) < 0)
ret_val = -1;
- if(did_2 > 0)
- if(H5Dclose(did_2) < 0)
+ if (did_2 > 0)
+ if (H5Dclose(did_2) < 0)
ret_val = -1;
- if(sid_3 > 0)
- if(H5Sclose(sid_3) < 0)
+ if (sid_3 > 0)
+ if (H5Sclose(sid_3) < 0)
ret_val = -1;
- if(tid_3 > 0)
- if(H5Tclose(tid_3) < 0)
+ if (tid_3 > 0)
+ if (H5Tclose(tid_3) < 0)
ret_val = -1;
- if(did_3 > 0)
- if(H5Dclose(did_3) < 0)
+ if (did_3 > 0)
+ if (H5Dclose(did_3) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBinsert_field() */
/*-------------------------------------------------------------------------
-* Function: H5TBdelete_field
-*
-* Purpose: Deletes a field
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: January 30, 2002
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBdelete_field(hid_t loc_id,
- const char *dset_name,
- const char *field_name)
+ * Function: H5TBdelete_field
+ *
+ * Purpose: Deletes a field
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: January 30, 2002
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
{
/* identifiers for the 1st original dataset */
- hid_t did_1 = H5I_BADID;
- hid_t tid_1 = H5I_BADID;
- hid_t sid_1 = H5I_BADID;
- hid_t pid_1 = H5I_BADID;
+ hid_t did_1 = H5I_BADID;
+ hid_t tid_1 = H5I_BADID;
+ hid_t sid_1 = H5I_BADID;
+ hid_t pid_1 = H5I_BADID;
/* identifiers for the 2nd new dataset */
- hid_t did_2 = H5I_BADID;
- hid_t tid_2 = H5I_BADID;
- hid_t sid_2 = H5I_BADID;
- hid_t pid_2 = H5I_BADID;
+ hid_t did_2 = H5I_BADID;
+ hid_t tid_2 = H5I_BADID;
+ hid_t sid_2 = H5I_BADID;
+ hid_t pid_2 = H5I_BADID;
/* identifiers for the 3rd final dataset */
- hid_t did_3 = H5I_BADID;
- hid_t tid_3 = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t preserve_id = H5I_BADID;
- hid_t read_type_id = H5I_BADID;
- hid_t write_type_id = H5I_BADID;
- hid_t attr_id = H5I_BADID;
- size_t member_size;
- size_t type_size1;
- size_t type_size2;
- size_t curr_offset;
- size_t delete_member_size = 0;
- size_t member_offset;
- hsize_t nfields;
- hsize_t nrecords;
- hsize_t dims_chunk[1];
- hsize_t dims[1];
- hsize_t maxdims[1] = { H5S_UNLIMITED };
- hsize_t i;
- char attr_name[255];
- char table_title[255];
- char *member_name = NULL;
- unsigned char *tmp_buf = NULL;
+ hid_t did_3 = H5I_BADID;
+ hid_t tid_3 = H5I_BADID;
+ hid_t member_type_id = H5I_BADID;
+ hid_t preserve_id = H5I_BADID;
+ hid_t read_type_id = H5I_BADID;
+ hid_t write_type_id = H5I_BADID;
+ hid_t attr_id = H5I_BADID;
+ size_t member_size;
+ size_t type_size1;
+ size_t type_size2;
+ size_t curr_offset;
+ size_t delete_member_size = 0;
+ size_t member_offset;
+ hsize_t nfields;
+ hsize_t nrecords;
+ hsize_t dims_chunk[1];
+ hsize_t dims[1];
+ hsize_t maxdims[1] = {H5S_UNLIMITED};
+ hsize_t i;
+ char attr_name[255];
+ char table_title[255];
+ char * member_name = NULL;
+ unsigned char *tmp_buf = NULL;
unsigned char *tmp_fill_buf = NULL;
- htri_t has_fill = FALSE;
- herr_t ret_val = -1;
-
+ htri_t has_fill = FALSE;
+ herr_t ret_val = -1;
/* check the arguments */
if (dset_name == NULL)
@@ -2535,61 +2459,61 @@ herr_t H5TBdelete_field(hid_t loc_id,
goto out;
/* get the number of records and fields */
- if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0)
+ if (H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0)
goto out;
/*-------------------------------------------------------------------------
- * get information about the old data type
- *-------------------------------------------------------------------------
- */
+ * get information about the old data type
+ *-------------------------------------------------------------------------
+ */
/* open the dataset. */
- if((did_1 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did_1 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
/* get creation properties list */
- if((pid_1 = H5Dget_create_plist(did_1)) < 0)
+ if ((pid_1 = H5Dget_create_plist(did_1)) < 0)
goto out;
/* get the datatype */
- if((tid_1 = H5Dget_type(did_1)) < 0)
+ if ((tid_1 = H5Dget_type(did_1)) < 0)
goto out;
/* get the size of the datatype */
- if(0 == (type_size1 = H5Tget_size(tid_1)))
+ if (0 == (type_size1 = H5Tget_size(tid_1)))
goto out;
/* get the dataspace handle */
- if((sid_1 = H5Dget_space(did_1)) < 0)
+ if ((sid_1 = H5Dget_space(did_1)) < 0)
goto out;
/* get dimension */
- if(H5Sget_simple_extent_dims(sid_1, dims, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid_1, dims, NULL) < 0)
goto out;
/*-------------------------------------------------------------------------
- * create a new data type; first we find the size of the datatype to delete
- *-------------------------------------------------------------------------
- */
+ * create a new data type; first we find the size of the datatype to delete
+ *-------------------------------------------------------------------------
+ */
/* check out the field */
- for(i = 0; i < nfields; i++) {
+ for (i = 0; i < nfields; i++) {
/* get the member name */
- if(NULL == (member_name = H5Tget_member_name(tid_1, (unsigned)i)))
+ if (NULL == (member_name = H5Tget_member_name(tid_1, (unsigned)i)))
goto out;
/* we want to find the field to delete */
- if(H5TB_find_field(member_name, field_name)) {
+ if (H5TB_find_field(member_name, field_name)) {
/* get the member type */
- if((member_type_id = H5Tget_member_type(tid_1, (unsigned)i)) < 0)
+ if ((member_type_id = H5Tget_member_type(tid_1, (unsigned)i)) < 0)
goto out;
/* get the member size */
- if(0 == (delete_member_size = H5Tget_size(member_type_id)))
+ if (0 == (delete_member_size = H5Tget_size(member_type_id)))
goto out;
/* close the member type */
- if(H5Tclose(member_type_id) < 0)
+ if (H5Tclose(member_type_id) < 0)
goto out;
member_type_id = H5I_BADID;
@@ -2604,75 +2528,75 @@ herr_t H5TBdelete_field(hid_t loc_id,
} /* end for */
/* no field to delete was found */
- if(delete_member_size == 0)
+ if (delete_member_size == 0)
goto out;
/*-------------------------------------------------------------------------
- * create a new data type; we now insert all the fields into the new type
- *-------------------------------------------------------------------------
- */
+ * create a new data type; we now insert all the fields into the new type
+ *-------------------------------------------------------------------------
+ */
type_size2 = type_size1 - delete_member_size;
/* create the data type. */
- if((tid_2 = H5Tcreate (H5T_COMPOUND, type_size2)) < 0)
+ if ((tid_2 = H5Tcreate(H5T_COMPOUND, type_size2)) < 0)
goto out;
curr_offset = 0;
/* alloc fill value attribute buffer */
- if(NULL == (tmp_fill_buf = (unsigned char *)HDmalloc((size_t)type_size2)))
+ if (NULL == (tmp_fill_buf = (unsigned char *)HDmalloc((size_t)type_size2)))
goto out;
/*-------------------------------------------------------------------------
- * get attributes from previous table in the process
- *-------------------------------------------------------------------------
- */
+ * get attributes from previous table in the process
+ *-------------------------------------------------------------------------
+ */
/* get the table title */
- if((H5TBAget_title(did_1, table_title)) < 0)
+ if ((H5TBAget_title(did_1, table_title)) < 0)
goto out;
/* insert the old fields except the one to delete */
- for(i = 0; i < nfields; i++) {
+ for (i = 0; i < nfields; i++) {
/* get the member name */
- if(NULL == (member_name = H5Tget_member_name(tid_1, (unsigned)i)))
+ if (NULL == (member_name = H5Tget_member_name(tid_1, (unsigned)i)))
goto out;
/* we want to skip the field to delete */
- if(!H5TB_find_field(member_name, field_name)) {
+ if (!H5TB_find_field(member_name, field_name)) {
/* get the member type */
- if((member_type_id = H5Tget_member_type(tid_1, (unsigned)i)) < 0)
+ if ((member_type_id = H5Tget_member_type(tid_1, (unsigned)i)) < 0)
goto out;
/* get the member size */
- if(0 == (member_size = H5Tget_size(member_type_id)))
+ if (0 == (member_size = H5Tget_size(member_type_id)))
goto out;
/* insert it into the new type */
- if(H5Tinsert(tid_2, member_name, curr_offset, member_type_id) < 0)
+ if (H5Tinsert(tid_2, member_name, curr_offset, member_type_id) < 0)
goto out;
/*-------------------------------------------------------------------------
- * get the fill value information
- *-------------------------------------------------------------------------
- */
+ * get the fill value information
+ *-------------------------------------------------------------------------
+ */
HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
/* check if we have the _FILL attribute */
- if((has_fill = H5LT_find_attribute(did_1, attr_name)) < 0)
+ if ((has_fill = H5LT_find_attribute(did_1, attr_name)) < 0)
goto out;
/* get it */
- if(has_fill)
- if(H5LT_get_attribute_disk(did_1, attr_name, tmp_fill_buf + curr_offset) < 0)
+ if (has_fill)
+ if (H5LT_get_attribute_disk(did_1, attr_name, tmp_fill_buf + curr_offset) < 0)
goto out;
curr_offset += member_size;
/* close the member type */
- if(H5Tclose(member_type_id) < 0)
+ if (H5Tclose(member_type_id) < 0)
goto out;
member_type_id = H5I_BADID;
} /* end if */
@@ -2682,96 +2606,96 @@ herr_t H5TBdelete_field(hid_t loc_id,
} /* end for */
/*-------------------------------------------------------------------------
- * create a new temporary dataset
- *-------------------------------------------------------------------------
- */
+ * create a new temporary dataset
+ *-------------------------------------------------------------------------
+ */
/* retrieve the size of chunk */
- if(H5Pget_chunk(pid_1, 1, dims_chunk) < 0)
+ if (H5Pget_chunk(pid_1, 1, dims_chunk) < 0)
goto out;
/* create a new simple data space with unlimited size, using the dimension */
- if((sid_2 = H5Screate_simple(1, dims, maxdims)) < 0)
+ if ((sid_2 = H5Screate_simple(1, dims, maxdims)) < 0)
goto out;
/* modify dataset creation properties, i.e. enable chunking */
pid_2 = H5Pcreate(H5P_DATASET_CREATE);
- if(H5Pset_chunk(pid_2, 1, dims_chunk) < 0)
+ if (H5Pset_chunk(pid_2, 1, dims_chunk) < 0)
goto out;
/* create the dataset. */
- if((did_2 = H5Dcreate2(loc_id, "new", tid_2, sid_2, H5P_DEFAULT, pid_2, H5P_DEFAULT)) < 0)
+ if ((did_2 = H5Dcreate2(loc_id, "new", tid_2, sid_2, H5P_DEFAULT, pid_2, H5P_DEFAULT)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * we have to read field by field of the old dataset and save it into the new one
- *-------------------------------------------------------------------------
- */
- for(i = 0; i < nfields; i++) {
+ * we have to read field by field of the old dataset and save it into the new one
+ *-------------------------------------------------------------------------
+ */
+ for (i = 0; i < nfields; i++) {
/* get the member name */
- if(NULL == (member_name = H5Tget_member_name(tid_1, (unsigned)i)))
+ if (NULL == (member_name = H5Tget_member_name(tid_1, (unsigned)i)))
goto out;
/* skip the field to delete */
- if(!H5TB_find_field(member_name, field_name)) {
+ if (!H5TB_find_field(member_name, field_name)) {
/* get the member type */
- if((member_type_id = H5Tget_member_type(tid_1, (unsigned)i)) < 0)
+ if ((member_type_id = H5Tget_member_type(tid_1, (unsigned)i)) < 0)
goto out;
/* get the member size */
- if(0 == (member_size = H5Tget_size(member_type_id)))
+ if (0 == (member_size = H5Tget_size(member_type_id)))
goto out;
/* create a read id */
- if((read_type_id = H5Tcreate(H5T_COMPOUND, member_size)) < 0)
+ if ((read_type_id = H5Tcreate(H5T_COMPOUND, member_size)) < 0)
goto out;
/* insert it into the new type */
- if(H5Tinsert(read_type_id, member_name, (size_t)0, member_type_id) < 0)
+ if (H5Tinsert(read_type_id, member_name, (size_t)0, member_type_id) < 0)
goto out;
- if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, member_size)))
+ if (NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, member_size)))
goto out;
/* read */
- if(H5Dread(did_1, read_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp_buf) < 0)
+ if (H5Dread(did_1, read_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp_buf) < 0)
goto out;
/* create a write id */
- if((write_type_id = H5Tcreate(H5T_COMPOUND, member_size)) < 0)
+ if ((write_type_id = H5Tcreate(H5T_COMPOUND, member_size)) < 0)
goto out;
/* the field in the file is found by its name */
- if(H5Tinsert(write_type_id, member_name, (size_t)0, member_type_id) < 0)
+ if (H5Tinsert(write_type_id, member_name, (size_t)0, member_type_id) < 0)
goto out;
/* create xfer properties to preserve initialized data */
- if((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto out;
- if(H5Pset_preserve(preserve_id, 1) < 0)
+ if (H5Pset_preserve(preserve_id, 1) < 0)
goto out;
/* write */
- if(H5Dwrite(did_2, write_type_id, H5S_ALL, H5S_ALL, preserve_id, tmp_buf) < 0)
+ if (H5Dwrite(did_2, write_type_id, H5S_ALL, H5S_ALL, preserve_id, tmp_buf) < 0)
goto out;
/* end access to the property list */
- if(H5Pclose(preserve_id) < 0)
+ if (H5Pclose(preserve_id) < 0)
goto out;
preserve_id = H5I_BADID;
/* close the member type */
- if(H5Tclose(member_type_id) < 0)
+ if (H5Tclose(member_type_id) < 0)
goto out;
member_type_id = H5I_BADID;
/* close the read type */
- if(H5Tclose(read_type_id) < 0)
+ if (H5Tclose(read_type_id) < 0)
goto out;
read_type_id = H5I_BADID;
/* close the write type */
- if(H5Tclose(write_type_id) < 0)
+ if (H5Tclose(write_type_id) < 0)
goto out;
write_type_id = H5I_BADID;
@@ -2785,51 +2709,51 @@ herr_t H5TBdelete_field(hid_t loc_id,
} /* end for */
/*-------------------------------------------------------------------------
- * delete 1st table
- *-------------------------------------------------------------------------
- */
- if(H5Ldelete(loc_id, dset_name, H5P_DEFAULT) < 0)
+ * delete 1st table
+ *-------------------------------------------------------------------------
+ */
+ if (H5Ldelete(loc_id, dset_name, H5P_DEFAULT) < 0)
goto out;
/*-------------------------------------------------------------------------
- * rename 2nd table
- *-------------------------------------------------------------------------
- */
- if(H5Lmove(loc_id, "new", H5L_SAME_LOC, dset_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ * rename 2nd table
+ *-------------------------------------------------------------------------
+ */
+ if (H5Lmove(loc_id, "new", H5L_SAME_LOC, dset_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attach the conforming table attributes
- *-------------------------------------------------------------------------
- */
+ * attach the conforming table attributes
+ *-------------------------------------------------------------------------
+ */
/* get the number of records and fields */
- if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0)
+ if (H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0)
goto out;
/* open the dataset. */
- if((did_3 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did_3 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
/* get the datatype */
- if((tid_3 = H5Dget_type(did_3)) < 0)
+ if ((tid_3 = H5Dget_type(did_3)) < 0)
goto out;
/* set the attributes */
- if(H5TB_attach_attributes(table_title, loc_id, dset_name, nfields, tid_3) < 0)
+ if (H5TB_attach_attributes(table_title, loc_id, dset_name, nfields, tid_3) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attach the fill attributes from previous table
- *-------------------------------------------------------------------------
- */
- if(has_fill) {
- if((sid_1 = H5Screate(H5S_SCALAR)) < 0)
+ * attach the fill attributes from previous table
+ *-------------------------------------------------------------------------
+ */
+ if (has_fill) {
+ if ((sid_1 = H5Screate(H5S_SCALAR)) < 0)
goto out;
- for(i = 0; i < nfields; i++) {
+ for (i = 0; i < nfields; i++) {
/* get the member type */
- if((member_type_id = H5Tget_member_type(tid_3, (unsigned)i)) < 0)
+ if ((member_type_id = H5Tget_member_type(tid_3, (unsigned)i)) < 0)
goto out;
/* get the member offset */
@@ -2837,24 +2761,24 @@ herr_t H5TBdelete_field(hid_t loc_id,
HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
- if((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid_1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid_1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Awrite(attr_id, member_type_id, tmp_fill_buf + member_offset) < 0)
+ if (H5Awrite(attr_id, member_type_id, tmp_fill_buf + member_offset) < 0)
goto out;
- if(H5Aclose(attr_id) < 0)
+ if (H5Aclose(attr_id) < 0)
goto out;
attr_id = H5I_BADID;
/* close the member type */
- if(H5Tclose(member_type_id) < 0)
+ if (H5Tclose(member_type_id) < 0)
goto out;
member_type_id = H5I_BADID;
} /* end for */
/* close data space. */
- if(H5Sclose(sid_1) < 0)
+ if (H5Sclose(sid_1) < 0)
goto out;
sid_1 = H5I_BADID;
} /* end if */
@@ -2862,232 +2786,227 @@ herr_t H5TBdelete_field(hid_t loc_id,
ret_val = 0;
out:
- if(member_name)
+ if (member_name)
H5free_memory(member_name);
- if(tmp_fill_buf)
+ if (tmp_fill_buf)
HDfree(tmp_fill_buf);
- if(tmp_buf)
+ if (tmp_buf)
HDfree(tmp_buf);
- if(attr_id > 0)
- if(H5Aclose(attr_id) < 0)
+ if (attr_id > 0)
+ if (H5Aclose(attr_id) < 0)
ret_val = -1;
- if(preserve_id > 0)
- if(H5Pclose(preserve_id) < 0)
+ if (preserve_id > 0)
+ if (H5Pclose(preserve_id) < 0)
ret_val = -1;
- if(member_type_id > 0)
- if(H5Tclose(member_type_id) < 0)
+ if (member_type_id > 0)
+ if (H5Tclose(member_type_id) < 0)
ret_val = -1;
- if(read_type_id > 0)
- if(H5Tclose(read_type_id) < 0)
+ if (read_type_id > 0)
+ if (H5Tclose(read_type_id) < 0)
ret_val = -1;
- if(write_type_id > 0)
- if(H5Tclose(write_type_id) < 0)
+ if (write_type_id > 0)
+ if (H5Tclose(write_type_id) < 0)
ret_val = -1;
- if(tid_1 > 0)
- if(H5Tclose(tid_1) < 0)
+ if (tid_1 > 0)
+ if (H5Tclose(tid_1) < 0)
ret_val = -1;
- if(pid_1 > 0)
- if(H5Pclose(pid_1) < 0)
+ if (pid_1 > 0)
+ if (H5Pclose(pid_1) < 0)
ret_val = -1;
- if(sid_1 > 0)
- if(H5Sclose(sid_1) < 0)
+ if (sid_1 > 0)
+ if (H5Sclose(sid_1) < 0)
ret_val = -1;
- if(did_1 > 0)
- if(H5Dclose(did_1) < 0)
+ if (did_1 > 0)
+ if (H5Dclose(did_1) < 0)
ret_val = -1;
- if(sid_2 > 0)
- if(H5Sclose(sid_2) < 0)
+ if (sid_2 > 0)
+ if (H5Sclose(sid_2) < 0)
ret_val = -1;
- if(tid_2 > 0)
- if(H5Tclose(tid_2) < 0)
+ if (tid_2 > 0)
+ if (H5Tclose(tid_2) < 0)
ret_val = -1;
- if(pid_2 > 0)
- if(H5Pclose(pid_2) < 0)
+ if (pid_2 > 0)
+ if (H5Pclose(pid_2) < 0)
ret_val = -1;
- if(did_2 > 0)
- if(H5Dclose(did_2) < 0)
+ if (did_2 > 0)
+ if (H5Dclose(did_2) < 0)
ret_val = -1;
- if(tid_3 > 0)
- if(H5Tclose(tid_3) < 0)
+ if (tid_3 > 0)
+ if (H5Tclose(tid_3) < 0)
ret_val = -1;
- if(did_3 > 0)
- if(H5Dclose(did_3) < 0)
+ if (did_3 > 0)
+ if (H5Dclose(did_3) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBdelete_field() */
/*-------------------------------------------------------------------------
-*
-* Table attribute functions
-*
-*-------------------------------------------------------------------------
-*/
+ *
+ * Table attribute functions
+ *
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
-* Function: H5TBAget_title
-*
-* Purpose: Read the table title
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: January 30, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBAget_title(hid_t loc_id,
- char *table_title)
+ * Function: H5TBAget_title
+ *
+ * Purpose: Read the table title
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: January 30, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBAget_title(hid_t loc_id, char *table_title)
{
/* Get the TITLE attribute */
- if(H5LT_get_attribute_disk(loc_id, "TITLE", table_title) < 0)
+ if (H5LT_get_attribute_disk(loc_id, "TITLE", table_title) < 0)
return -1;
return 0;
}
/*-------------------------------------------------------------------------
-* Function: H5TBAget_fill
-*
-* Purpose: Read the table attribute fill values
-*
-* Return: Success: TRUE/FALSE, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: January 30, 2002
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-htri_t H5TBAget_fill(hid_t loc_id,
- const char *dset_name,
- hid_t dset_id,
- unsigned char *dst_buf)
+ * Function: H5TBAget_fill
+ *
+ * Purpose: Read the table attribute fill values
+ *
+ * Return: Success: TRUE/FALSE, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: January 30, 2002
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5TBAget_fill(hid_t loc_id, const char *dset_name, hid_t dset_id, unsigned char *dst_buf)
{
- hsize_t nfields;
- hsize_t nrecords;
- hsize_t i;
- size_t *src_offset = NULL;
- char attr_name[255];
- htri_t has_fill = FALSE;
- htri_t ret_val = -1;
+ hsize_t nfields;
+ hsize_t nrecords;
+ hsize_t i;
+ size_t *src_offset = NULL;
+ char attr_name[255];
+ htri_t has_fill = FALSE;
+ htri_t ret_val = -1;
/* check the arguments */
if (dset_name == NULL)
goto out;
/* get the number of records and fields */
- if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0)
+ if (H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0)
goto out;
- if(NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
+ if (NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
goto out;
/* get field info */
- if(H5TBget_field_info(loc_id, dset_name, NULL, NULL, src_offset, NULL) < 0)
+ if (H5TBget_field_info(loc_id, dset_name, NULL, NULL, src_offset, NULL) < 0)
goto out;
- for(i = 0; i < nfields; i++) {
+ for (i = 0; i < nfields; i++) {
HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
/* check if we have the _FILL attribute */
- if((has_fill = H5LT_find_attribute(dset_id, attr_name)) < 0)
+ if ((has_fill = H5LT_find_attribute(dset_id, attr_name)) < 0)
goto out;
/* get it */
- if(has_fill)
- if(H5LT_get_attribute_disk(dset_id, attr_name, dst_buf + src_offset[i]) < 0)
+ if (has_fill)
+ if (H5LT_get_attribute_disk(dset_id, attr_name, dst_buf + src_offset[i]) < 0)
goto out;
} /* end for */
ret_val = has_fill;
out:
- if(src_offset)
+ if (src_offset)
HDfree(src_offset);
return ret_val;
} /* end H5TBAget_fill() */
-
/*-------------------------------------------------------------------------
-*
-* Inquiry functions
-*
-*-------------------------------------------------------------------------
-*/
+ *
+ * Inquiry functions
+ *
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
-* Function: H5TBget_table_info
-*
-* Purpose: Gets the number of records and fields of a table
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 19, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBget_table_info(hid_t loc_id,
- const char *dset_name,
- hsize_t *nfields,
- hsize_t *nrecords)
+ * Function: H5TBget_table_info
+ *
+ * Purpose: Gets the number of records and fields of a table
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 19, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBget_table_info(hid_t loc_id, const char *dset_name, hsize_t *nfields, hsize_t *nrecords)
{
- hid_t tid = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t did = H5I_BADID;
- hsize_t dims[1];
- int num_members;
- herr_t ret_val = -1;
+ hid_t tid = H5I_BADID;
+ hid_t sid = H5I_BADID;
+ hid_t did = H5I_BADID;
+ hsize_t dims[1];
+ int num_members;
+ herr_t ret_val = -1;
/* check the arguments */
if (dset_name == NULL)
goto out;
/* open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
/* get the datatype */
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
goto out;
/* get the number of members */
- if((num_members = H5Tget_nmembers(tid)) < 0)
+ if ((num_members = H5Tget_nmembers(tid)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * get number of nfields
- *-------------------------------------------------------------------------
- */
- if(nfields)
+ * get number of nfields
+ *-------------------------------------------------------------------------
+ */
+ if (nfields)
*nfields = (hsize_t)num_members;
/*-------------------------------------------------------------------------
- * get number of records
- *-------------------------------------------------------------------------
- */
- if(nrecords) {
+ * get number of records
+ *-------------------------------------------------------------------------
+ */
+ if (nrecords) {
/* get the dataspace handle */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto out;
/* get dimension */
- if(H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
goto out;
/* terminate access to the dataspace */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
sid = H5I_BADID;
@@ -3097,106 +3016,103 @@ herr_t H5TBget_table_info(hid_t loc_id,
ret_val = 0;
out:
- if(sid > 0)
- if(H5Sclose(sid) < 0)
+ if (sid > 0)
+ if (H5Sclose(sid) < 0)
ret_val = -1;
- if(tid > 0)
- if(H5Tclose(tid) < 0)
+ if (tid > 0)
+ if (H5Tclose(tid) < 0)
ret_val = -1;
- if(did > 0)
- if(H5Dclose(did) < 0)
+ if (did > 0)
+ if (H5Dclose(did) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBget_table_info() */
/*-------------------------------------------------------------------------
-* Function: H5TBget_field_info
-*
-* Purpose: Get information about fields
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 19, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TBget_field_info(hid_t loc_id,
- const char *dset_name,
- char *field_names[],
- size_t *field_sizes,
- size_t *field_offsets,
- size_t *type_size)
+ * Function: H5TBget_field_info
+ *
+ * Purpose: Get information about fields
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 19, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TBget_field_info(hid_t loc_id, const char *dset_name, char *field_names[], size_t *field_sizes,
+ size_t *field_offsets, size_t *type_size)
{
- hid_t did = H5I_BADID; /* dataset ID */
- hid_t tid = H5I_BADID; /* file type ID */
- hid_t n_tid = H5I_BADID; /* native type ID */
- hid_t m_tid = H5I_BADID; /* member type ID */
- hid_t nm_tid = H5I_BADID; /* native member ID */
- hssize_t nfields;
- hssize_t i;
- herr_t ret_val = -1;
+ hid_t did = H5I_BADID; /* dataset ID */
+ hid_t tid = H5I_BADID; /* file type ID */
+ hid_t n_tid = H5I_BADID; /* native type ID */
+ hid_t m_tid = H5I_BADID; /* member type ID */
+ hid_t nm_tid = H5I_BADID; /* native member ID */
+ hssize_t nfields;
+ hssize_t i;
+ herr_t ret_val = -1;
/* check the arguments */
if (dset_name == NULL)
goto out;
/* open the dataset. */
- if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
/* get the datatype */
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
goto out;
- if((n_tid = H5Tget_native_type(tid, H5T_DIR_DEFAULT)) < 0)
+ if ((n_tid = H5Tget_native_type(tid, H5T_DIR_DEFAULT)) < 0)
goto out;
/* get the type size */
- if(type_size)
- if(0 == (*type_size = H5Tget_size(n_tid)))
+ if (type_size)
+ if (0 == (*type_size = H5Tget_size(n_tid)))
goto out;
/* get the number of members */
- if((nfields = H5Tget_nmembers(tid)) < 0)
+ if ((nfields = H5Tget_nmembers(tid)) < 0)
goto out;
/* iterate tru the members */
- for(i = 0; i < nfields; i++) {
+ for (i = 0; i < nfields; i++) {
/* get the member name */
- if(field_names) {
- char *member_name;
+ if (field_names) {
+ char *member_name;
- if(NULL == (member_name = H5Tget_member_name(tid, (unsigned)i)))
+ if (NULL == (member_name = H5Tget_member_name(tid, (unsigned)i)))
goto out;
strcpy(field_names[i], member_name);
H5free_memory(member_name);
} /* end if */
/* get the member type */
- if((m_tid = H5Tget_member_type(tid, (unsigned)i)) < 0)
+ if ((m_tid = H5Tget_member_type(tid, (unsigned)i)) < 0)
goto out;
- if((nm_tid = H5Tget_native_type(m_tid, H5T_DIR_DEFAULT)) < 0)
+ if ((nm_tid = H5Tget_native_type(m_tid, H5T_DIR_DEFAULT)) < 0)
goto out;
/* get the member size */
- if(field_sizes)
- if(0 == (field_sizes[i] = H5Tget_size(nm_tid)))
+ if (field_sizes)
+ if (0 == (field_sizes[i] = H5Tget_size(nm_tid)))
goto out;
/* get the member offset */
- if(field_offsets)
- field_offsets[i] = H5Tget_member_offset(n_tid, (unsigned) i);
+ if (field_offsets)
+ field_offsets[i] = H5Tget_member_offset(n_tid, (unsigned)i);
/* close the member types */
- if(H5Tclose(m_tid) < 0)
+ if (H5Tclose(m_tid) < 0)
goto out;
m_tid = H5I_BADID;
- if(H5Tclose(nm_tid) < 0)
+ if (H5Tclose(nm_tid) < 0)
goto out;
nm_tid = H5I_BADID;
} /* end for */
@@ -3204,122 +3120,119 @@ herr_t H5TBget_field_info(hid_t loc_id,
ret_val = 0;
out:
- if(tid > 0)
- if(H5Tclose(tid) < 0)
+ if (tid > 0)
+ if (H5Tclose(tid) < 0)
ret_val = -1;
- if(n_tid > 0)
- if(H5Tclose(n_tid) < 0)
+ if (n_tid > 0)
+ if (H5Tclose(n_tid) < 0)
ret_val = -1;
- if(m_tid > 0)
- if(H5Tclose(m_tid) < 0)
+ if (m_tid > 0)
+ if (H5Tclose(m_tid) < 0)
ret_val = -1;
- if(nm_tid > 0)
- if(H5Tclose(nm_tid) < 0)
+ if (nm_tid > 0)
+ if (H5Tclose(nm_tid) < 0)
ret_val = -1;
- if(did > 0)
- if(H5Dclose(did) < 0)
+ if (did > 0)
+ if (H5Dclose(did) < 0)
ret_val = -1;
return ret_val;
} /* end H5TBget_field_info() */
/*-------------------------------------------------------------------------
-*
-* internal functions
-*
-*-------------------------------------------------------------------------
-*/
+ *
+ * internal functions
+ *
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
-* Function: H5TB_find_field
-*
-* Purpose: Find a string field
-*
-* Return: Success: TRUE/FALSE, Failure: N/A
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 19, 2001
-*
-*-------------------------------------------------------------------------
-*/
-H5_ATTR_PURE static
-hbool_t H5TB_find_field(const char *field, const char *field_list)
+ * Function: H5TB_find_field
+ *
+ * Purpose: Find a string field
+ *
+ * Return: Success: TRUE/FALSE, Failure: N/A
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 19, 2001
+ *
+ *-------------------------------------------------------------------------
+ */
+H5_ATTR_PURE static hbool_t
+H5TB_find_field(const char *field, const char *field_list)
{
const char *start = field_list;
const char *end;
/* check the arguments */
if (field == NULL)
- return FALSE;
+ return FALSE;
if (field_list == NULL)
- return FALSE;
+ return FALSE;
- while((end = HDstrstr(start, ",")) != 0) {
+ while ((end = HDstrstr(start, ",")) != 0) {
ptrdiff_t count = end - start;
- if(HDstrncmp(start, field, (size_t)count) == 0 && (size_t)count == HDstrlen(field))
+ if (HDstrncmp(start, field, (size_t)count) == 0 && (size_t)count == HDstrlen(field))
return TRUE;
start = end + 1;
} /* end while */
- if(HDstrncmp(start, field, HDstrlen(field)) == 0)
+ if (HDstrncmp(start, field, HDstrlen(field)) == 0)
return TRUE;
return FALSE;
} /* end H5TB_find_field() */
/*-------------------------------------------------------------------------
-* Function: H5TB_attach_attributes
-*
-* Purpose: Private function that creates the conforming table attributes;
-* Used by H5TBcombine_tables; not used by H5TBmake_table, which does not read
-* the fill value attributes from an existing table
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: December 6, 2001
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-static
-herr_t H5TB_attach_attributes(const char *table_title,
- hid_t loc_id,
- const char *dset_name,
- hsize_t nfields,
- hid_t tid)
+ * Function: H5TB_attach_attributes
+ *
+ * Purpose: Private function that creates the conforming table attributes;
+ * Used by H5TBcombine_tables; not used by H5TBmake_table, which does not read
+ * the fill value attributes from an existing table
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: December 6, 2001
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5TB_attach_attributes(const char *table_title, hid_t loc_id, const char *dset_name, hsize_t nfields,
+ hid_t tid)
{
- char attr_name[255];
- char *member_name = NULL;
- hsize_t i;
- herr_t ret_val = -1;
+ char attr_name[255];
+ char * member_name = NULL;
+ hsize_t i;
+ herr_t ret_val = -1;
/* attach the CLASS attribute */
- if(H5LTset_attribute_string(loc_id, dset_name, "CLASS", TABLE_CLASS) < 0)
+ if (H5LTset_attribute_string(loc_id, dset_name, "CLASS", TABLE_CLASS) < 0)
goto out;
/* attach the VERSION attribute */
- if(H5LTset_attribute_string(loc_id, dset_name, "VERSION", TABLE_VERSION) < 0)
+ if (H5LTset_attribute_string(loc_id, dset_name, "VERSION", TABLE_VERSION) < 0)
goto out;
/* attach the TITLE attribute */
- if(H5LTset_attribute_string(loc_id, dset_name, "TITLE", table_title) < 0)
+ if (H5LTset_attribute_string(loc_id, dset_name, "TITLE", table_title) < 0)
goto out;
/* attach the FIELD_ name attribute */
- for(i = 0; i < nfields; i++) {
+ for (i = 0; i < nfields; i++) {
/* get the member name */
- if(NULL == (member_name = H5Tget_member_name(tid, (unsigned)i)))
+ if (NULL == (member_name = H5Tget_member_name(tid, (unsigned)i)))
goto out;
HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_NAME", (int)i);
/* attach the attribute */
- if(H5LTset_attribute_string(loc_id, dset_name, attr_name, member_name) < 0)
+ if (H5LTset_attribute_string(loc_id, dset_name, attr_name, member_name) < 0)
goto out;
H5free_memory(member_name);
@@ -3329,57 +3242,53 @@ herr_t H5TB_attach_attributes(const char *table_title,
ret_val = 0;
out:
- if(member_name)
+ if (member_name)
H5free_memory(member_name);
return ret_val;
} /* end H5TB_attach_attributes() */
/*-------------------------------------------------------------------------
-* Function: H5TB_create_type
-*
-* Purpose: Private function that creates a memory type ID
-*
-* Return: Success: the memory type ID, Failure: -1
-*
-* Programmer: Pedro Vicente
-*
-* Date: March 31, 2004
-*
-* Comments:
-*
-*-------------------------------------------------------------------------
-*/
-static
-hid_t H5TB_create_type(hid_t loc_id,
- const char *dset_name,
- size_t type_size,
- const size_t *field_offset,
- const size_t *field_sizes,
- hid_t ftype_id)
+ * Function: H5TB_create_type
+ *
+ * Purpose: Private function that creates a memory type ID
+ *
+ * Return: Success: the memory type ID, Failure: -1
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: March 31, 2004
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+static hid_t
+H5TB_create_type(hid_t loc_id, const char *dset_name, size_t type_size, const size_t *field_offset,
+ const size_t *field_sizes, hid_t ftype_id)
{
hid_t mem_type_id = H5I_BADID;
- hid_t mtype_id = H5I_BADID;
- hid_t nmtype_id = H5I_BADID;
+ hid_t mtype_id = H5I_BADID;
+ hid_t nmtype_id = H5I_BADID;
size_t size_native;
hsize_t nfields = 0;
- char **fnames = NULL;
+ char ** fnames = NULL;
unsigned i;
- hid_t ret_val = -1;
+ hid_t ret_val = -1;
/* get the number of fields */
- if(H5TBget_table_info(loc_id, dset_name, &nfields, NULL) < 0)
+ if (H5TBget_table_info(loc_id, dset_name, &nfields, NULL) < 0)
goto out;
- if(NULL == (fnames = (char**)HDcalloc(sizeof(char*), (size_t)nfields)))
+ if (NULL == (fnames = (char **)HDcalloc(sizeof(char *), (size_t)nfields)))
goto out;
- for(i = 0; i < nfields; i++)
- if(NULL == (fnames[i] = (char*)HDmalloc(HLTB_MAX_FIELD_LEN)))
+ for (i = 0; i < nfields; i++)
+ if (NULL == (fnames[i] = (char *)HDmalloc(HLTB_MAX_FIELD_LEN)))
goto out;
/* get field info */
- if(H5TBget_field_info(loc_id, dset_name, fnames, NULL, NULL, NULL) < 0)
+ if (H5TBget_field_info(loc_id, dset_name, fnames, NULL, NULL, NULL) < 0)
goto out;
/* create the memory data type */
@@ -3387,22 +3296,22 @@ hid_t H5TB_create_type(hid_t loc_id,
goto out;
/* get each field ID and adjust its size, if necessary */
- for(i = 0; i < nfields; i++) {
- if((mtype_id = H5Tget_member_type(ftype_id, i)) < 0)
+ for (i = 0; i < nfields; i++) {
+ if ((mtype_id = H5Tget_member_type(ftype_id, i)) < 0)
goto out;
- if((nmtype_id = H5Tget_native_type(mtype_id, H5T_DIR_DEFAULT)) < 0)
+ if ((nmtype_id = H5Tget_native_type(mtype_id, H5T_DIR_DEFAULT)) < 0)
goto out;
- if(0 == (size_native = H5Tget_size(nmtype_id)))
+ if (0 == (size_native = H5Tget_size(nmtype_id)))
goto out;
- if(field_sizes[i] != size_native)
- if(H5Tset_size(nmtype_id, field_sizes[i]) < 0)
+ if (field_sizes[i] != size_native)
+ if (H5Tset_size(nmtype_id, field_sizes[i]) < 0)
goto out;
- if(H5Tinsert(mem_type_id, fnames[i], field_offset[i], nmtype_id) < 0)
+ if (H5Tinsert(mem_type_id, fnames[i], field_offset[i], nmtype_id) < 0)
goto out;
- if(H5Tclose(mtype_id) < 0)
+ if (H5Tclose(mtype_id) < 0)
goto out;
mtype_id = H5I_BADID;
- if(H5Tclose(nmtype_id) < 0)
+ if (H5Tclose(nmtype_id) < 0)
goto out;
nmtype_id = H5I_BADID;
} /* end for */
@@ -3410,159 +3319,153 @@ hid_t H5TB_create_type(hid_t loc_id,
ret_val = mem_type_id;
out:
- if(fnames) {
- for(i = 0; i < nfields; i++)
- if(fnames[i])
+ if (fnames) {
+ for (i = 0; i < nfields; i++)
+ if (fnames[i])
HDfree(fnames[i]);
HDfree(fnames);
} /* end if */
- if(mtype_id > 0)
- if(H5Tclose(mtype_id) < 0)
+ if (mtype_id > 0)
+ if (H5Tclose(mtype_id) < 0)
ret_val = -1;
- if(nmtype_id > 0)
- if(H5Tclose(nmtype_id) < 0)
+ if (nmtype_id > 0)
+ if (H5Tclose(nmtype_id) < 0)
ret_val = -1;
- if(ret_val < 0 && mem_type_id > 0)
+ if (ret_val < 0 && mem_type_id > 0)
H5Tclose(mem_type_id);
return ret_val;
} /* end H5TB_create_type() */
/*-------------------------------------------------------------------------
-*
-* Functions shared between H5TB and H5PT
-*
-*-------------------------------------------------------------------------
-*/
+ *
+ * Functions shared between H5TB and H5PT
+ *
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
-* Function: H5TB_common_append_records
-*
-* Purpose: Common code for reading records shared between H5PT and H5TB
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Nat Furrer
-* James Laird
-*
-* Date: March 8, 2004
-*
-* Comments: Called by H5TBappend_records and H5PTappend_records
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TB_common_append_records(hid_t dataset_id,
- hid_t mem_type_id,
- size_t nrecords,
- hsize_t orig_table_size,
- const void *buf)
+ * Function: H5TB_common_append_records
+ *
+ * Purpose: Common code for reading records shared between H5PT and H5TB
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Nat Furrer
+ * James Laird
+ *
+ * Date: March 8, 2004
+ *
+ * Comments: Called by H5TBappend_records and H5PTappend_records
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TB_common_append_records(hid_t dataset_id, hid_t mem_type_id, size_t nrecords, hsize_t orig_table_size,
+ const void *buf)
{
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hsize_t count[1];
- hsize_t offset[1];
- hsize_t dims[1];
- hsize_t mem_dims[1];
- herr_t ret_val = -1;
+ hid_t sid = H5I_BADID;
+ hid_t m_sid = H5I_BADID;
+ hsize_t count[1];
+ hsize_t offset[1];
+ hsize_t dims[1];
+ hsize_t mem_dims[1];
+ herr_t ret_val = -1;
/* extend the dataset */
dims[0] = nrecords + orig_table_size;
- if(H5Dset_extent(dataset_id, dims) < 0)
+ if (H5Dset_extent(dataset_id, dims) < 0)
goto out;
/* create a simple memory data space */
mem_dims[0] = nrecords;
- if((m_sid = H5Screate_simple(1, mem_dims, NULL)) < 0)
+ if ((m_sid = H5Screate_simple(1, mem_dims, NULL)) < 0)
goto out;
/* get a copy of the new file data space for writing */
- if((sid = H5Dget_space(dataset_id)) < 0)
+ if ((sid = H5Dget_space(dataset_id)) < 0)
goto out;
/* define a hyperslab in the dataset */
offset[0] = orig_table_size;
- count[0] = nrecords;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
+ count[0] = nrecords;
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto out;
/* write the records */
- if(H5Dwrite(dataset_id, mem_type_id, m_sid, sid, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(dataset_id, mem_type_id, m_sid, sid, H5P_DEFAULT, buf) < 0)
goto out;
ret_val = 0;
out:
- if(m_sid > 0)
- if(H5Sclose(m_sid) < 0)
+ if (m_sid > 0)
+ if (H5Sclose(m_sid) < 0)
ret_val = -1;
- if(sid > 0)
- if(H5Sclose(sid) < 0)
+ if (sid > 0)
+ if (H5Sclose(sid) < 0)
ret_val = -1;
return ret_val;
} /* end H5TB_common_append_records() */
/*-------------------------------------------------------------------------
-* Function: H5TB_common_read_records
-*
-* Purpose: Common code for reading records shared between H5PT and H5TB
-*
-* Return: Success: 0, Failure: -1
-*
-* Programmer: Nat Furrer
-* James Laird
-*
-* Date: March 8, 2004
-*
-* Comments: Called by H5TBread_records and H5PTread_records
-*
-*-------------------------------------------------------------------------
-*/
-herr_t H5TB_common_read_records(hid_t dataset_id,
- hid_t mem_type_id,
- hsize_t start,
- size_t nrecords,
- hsize_t table_size,
- void *buf)
+ * Function: H5TB_common_read_records
+ *
+ * Purpose: Common code for reading records shared between H5PT and H5TB
+ *
+ * Return: Success: 0, Failure: -1
+ *
+ * Programmer: Nat Furrer
+ * James Laird
+ *
+ * Date: March 8, 2004
+ *
+ * Comments: Called by H5TBread_records and H5PTread_records
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5TB_common_read_records(hid_t dataset_id, hid_t mem_type_id, hsize_t start, size_t nrecords,
+ hsize_t table_size, void *buf)
{
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hsize_t count[1];
- hsize_t offset[1];
- hsize_t mem_size[1];
- herr_t ret_val = -1;
+ hid_t sid = H5I_BADID;
+ hid_t m_sid = H5I_BADID;
+ hsize_t count[1];
+ hsize_t offset[1];
+ hsize_t mem_size[1];
+ herr_t ret_val = -1;
/* make sure the read request is in bounds */
- if(start + nrecords > table_size)
+ if (start + nrecords > table_size)
goto out;
/* get the dataspace handle */
- if((sid = H5Dget_space(dataset_id)) < 0)
+ if ((sid = H5Dget_space(dataset_id)) < 0)
goto out;
/* define a hyperslab in the dataset of the size of the records */
offset[0] = start;
count[0] = nrecords;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto out;
/* create a memory dataspace handle */
mem_size[0] = count[0];
- if((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
+ if ((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0)
goto out;
- if((H5Dread(dataset_id, mem_type_id, m_sid, sid, H5P_DEFAULT, buf)) < 0)
+ if ((H5Dread(dataset_id, mem_type_id, m_sid, sid, H5P_DEFAULT, buf)) < 0)
goto out;
ret_val = 0;
out:
- if(m_sid > 0)
- if(H5Sclose(m_sid) < 0)
+ if (m_sid > 0)
+ if (H5Sclose(m_sid) < 0)
ret_val = -1;
- if(sid > 0)
- if(H5Sclose(sid) < 0)
+ if (sid > 0)
+ if (H5Sclose(sid) < 0)
ret_val = -1;
return ret_val;
} /* end H5TB_common_read_records() */
-
diff --git a/hl/src/H5TBprivate.h b/hl/src/H5TBprivate.h
index 17306fb..cdddfbc 100644
--- a/hl/src/H5TBprivate.h
+++ b/hl/src/H5TBprivate.h
@@ -20,10 +20,9 @@
/* public TB prototypes */
#include "H5TBpublic.h"
-
-#define TABLE_CLASS "TABLE"
-#define TABLE_VERSION "3.0"
-#define HLTB_MAX_FIELD_LEN 255
+#define TABLE_CLASS "TABLE"
+#define TABLE_VERSION "3.0"
+#define HLTB_MAX_FIELD_LEN 255
/*-------------------------------------------------------------------------
*
@@ -32,11 +31,8 @@
*-------------------------------------------------------------------------
*/
-herr_t H5TB_common_append_records( hid_t dataset_id,
- hid_t mem_type_id,
- size_t nrecords,
- hsize_t orig_table_size,
- const void * data);
+herr_t H5TB_common_append_records(hid_t dataset_id, hid_t mem_type_id, size_t nrecords,
+ hsize_t orig_table_size, const void *data);
/*-------------------------------------------------------------------------
*
@@ -45,16 +41,7 @@ herr_t H5TB_common_append_records( hid_t dataset_id,
*-------------------------------------------------------------------------
*/
-
-herr_t H5TB_common_read_records( hid_t dataset_id,
- hid_t mem_type_id,
- hsize_t start,
- size_t nrecords,
- hsize_t table_size,
- void *data);
-
-
-
+herr_t H5TB_common_read_records(hid_t dataset_id, hid_t mem_type_id, hsize_t start, size_t nrecords,
+ hsize_t table_size, void *data);
#endif
-
diff --git a/hl/src/H5TBpublic.h b/hl/src/H5TBpublic.h
index 56aa915..3649225 100644
--- a/hl/src/H5TBpublic.h
+++ b/hl/src/H5TBpublic.h
@@ -14,12 +14,10 @@
#ifndef _H5TBpublic_H
#define _H5TBpublic_H
-
#ifdef __cplusplus
extern "C" {
#endif
-
/*-------------------------------------------------------------------------
*
* Create functions
@@ -27,20 +25,10 @@ extern "C" {
*-------------------------------------------------------------------------
*/
-H5_HLDLL herr_t H5TBmake_table( const char *table_title,
- hid_t loc_id,
- const char *dset_name,
- hsize_t nfields,
- hsize_t nrecords,
- size_t type_size,
- const char *field_names[],
- const size_t *field_offset,
- const hid_t *field_types,
- hsize_t chunk_size,
- void *fill_data,
- int compress,
- const void *buf );
-
+H5_HLDLL herr_t H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsize_t nfields,
+ hsize_t nrecords, size_t type_size, const char *field_names[],
+ const size_t *field_offset, const hid_t *field_types, hsize_t chunk_size,
+ void *fill_data, int compress, const void *buf);
/*-------------------------------------------------------------------------
*
@@ -49,45 +37,21 @@ H5_HLDLL herr_t H5TBmake_table( const char *table_title,
*-------------------------------------------------------------------------
*/
-H5_HLDLL herr_t H5TBappend_records( hid_t loc_id,
- const char *dset_name,
- hsize_t nrecords,
- size_t type_size,
- const size_t *field_offset,
- const size_t *dst_sizes,
- const void *buf );
-
-H5_HLDLL herr_t H5TBwrite_records( hid_t loc_id,
- const char *dset_name,
- hsize_t start,
- hsize_t nrecords,
- size_t type_size,
- const size_t *field_offset,
- const size_t *dst_sizes,
- const void *buf );
-
-
-H5_HLDLL herr_t H5TBwrite_fields_name( hid_t loc_id,
- const char *dset_name,
- const char *field_names,
- hsize_t start,
- hsize_t nrecords,
- size_t type_size,
- const size_t *field_offset,
- const size_t *dst_sizes,
- const void *buf );
-
-H5_HLDLL herr_t H5TBwrite_fields_index( hid_t loc_id,
- const char *dset_name,
- hsize_t nfields,
- const int *field_index,
- hsize_t start,
- hsize_t nrecords,
- size_t type_size,
- const size_t *field_offset,
- const size_t *dst_sizes,
- const void *buf );
+H5_HLDLL herr_t H5TBappend_records(hid_t loc_id, const char *dset_name, hsize_t nrecords, size_t type_size,
+ const size_t *field_offset, const size_t *dst_sizes, const void *buf);
+
+H5_HLDLL herr_t H5TBwrite_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords,
+ size_t type_size, const size_t *field_offset, const size_t *dst_sizes,
+ const void *buf);
+H5_HLDLL herr_t H5TBwrite_fields_name(hid_t loc_id, const char *dset_name, const char *field_names,
+ hsize_t start, hsize_t nrecords, size_t type_size,
+ const size_t *field_offset, const size_t *dst_sizes, const void *buf);
+
+H5_HLDLL herr_t H5TBwrite_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields,
+ const int *field_index, hsize_t start, hsize_t nrecords,
+ size_t type_size, const size_t *field_offset, const size_t *dst_sizes,
+ const void *buf);
/*-------------------------------------------------------------------------
*
@@ -96,46 +60,21 @@ H5_HLDLL herr_t H5TBwrite_fields_index( hid_t loc_id,
*-------------------------------------------------------------------------
*/
+H5_HLDLL herr_t H5TBread_table(hid_t loc_id, const char *dset_name, size_t dst_size, const size_t *dst_offset,
+ const size_t *dst_sizes, void *dst_buf);
+
+H5_HLDLL herr_t H5TBread_fields_name(hid_t loc_id, const char *dset_name, const char *field_names,
+ hsize_t start, hsize_t nrecords, size_t type_size,
+ const size_t *field_offset, const size_t *dst_sizes, void *buf);
+H5_HLDLL herr_t H5TBread_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields,
+ const int *field_index, hsize_t start, hsize_t nrecords,
+ size_t type_size, const size_t *field_offset, const size_t *dst_sizes,
+ void *buf);
-H5_HLDLL herr_t H5TBread_table( hid_t loc_id,
- const char *dset_name,
- size_t dst_size,
- const size_t *dst_offset,
- const size_t *dst_sizes,
- void *dst_buf );
-
-
-H5_HLDLL herr_t H5TBread_fields_name( hid_t loc_id,
- const char *dset_name,
- const char *field_names,
- hsize_t start,
- hsize_t nrecords,
- size_t type_size,
- const size_t *field_offset,
- const size_t *dst_sizes,
- void *buf );
-
-H5_HLDLL herr_t H5TBread_fields_index( hid_t loc_id,
- const char *dset_name,
- hsize_t nfields,
- const int *field_index,
- hsize_t start,
- hsize_t nrecords,
- size_t type_size,
- const size_t *field_offset,
- const size_t *dst_sizes,
- void *buf );
-
-
-H5_HLDLL herr_t H5TBread_records( hid_t loc_id,
- const char *dset_name,
- hsize_t start,
- hsize_t nrecords,
- size_t type_size,
- const size_t *dst_offset,
- const size_t *dst_sizes,
- void *buf );
+H5_HLDLL herr_t H5TBread_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords,
+ size_t type_size, const size_t *dst_offset, const size_t *dst_sizes,
+ void *buf);
/*-------------------------------------------------------------------------
*
@@ -144,19 +83,10 @@ H5_HLDLL herr_t H5TBread_records( hid_t loc_id,
*-------------------------------------------------------------------------
*/
+H5_HLDLL herr_t H5TBget_table_info(hid_t loc_id, const char *dset_name, hsize_t *nfields, hsize_t *nrecords);
-H5_HLDLL herr_t H5TBget_table_info ( hid_t loc_id,
- const char *dset_name,
- hsize_t *nfields,
- hsize_t *nrecords );
-
-H5_HLDLL herr_t H5TBget_field_info( hid_t loc_id,
- const char *dset_name,
- char *field_names[],
- size_t *field_sizes,
- size_t *field_offsets,
- size_t *type_size );
-
+H5_HLDLL herr_t H5TBget_field_info(hid_t loc_id, const char *dset_name, char *field_names[],
+ size_t *field_sizes, size_t *field_offsets, size_t *type_size);
/*-------------------------------------------------------------------------
*
@@ -165,47 +95,22 @@ H5_HLDLL herr_t H5TBget_field_info( hid_t loc_id,
*-------------------------------------------------------------------------
*/
+H5_HLDLL herr_t H5TBdelete_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords);
-H5_HLDLL herr_t H5TBdelete_record( hid_t loc_id,
- const char *dset_name,
- hsize_t start,
- hsize_t nrecords );
-
-
-H5_HLDLL herr_t H5TBinsert_record( hid_t loc_id,
- const char *dset_name,
- hsize_t start,
- hsize_t nrecords,
- size_t dst_size,
- const size_t *dst_offset,
- const size_t *dst_sizes,
- void *buf );
+H5_HLDLL herr_t H5TBinsert_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords,
+ size_t dst_size, const size_t *dst_offset, const size_t *dst_sizes,
+ void *buf);
-H5_HLDLL herr_t H5TBadd_records_from( hid_t loc_id,
- const char *dset_name1,
- hsize_t start1,
- hsize_t nrecords,
- const char *dset_name2,
- hsize_t start2 );
+H5_HLDLL herr_t H5TBadd_records_from(hid_t loc_id, const char *dset_name1, hsize_t start1, hsize_t nrecords,
+ const char *dset_name2, hsize_t start2);
-H5_HLDLL herr_t H5TBcombine_tables( hid_t loc_id1,
- const char *dset_name1,
- hid_t loc_id2,
- const char *dset_name2,
- const char *dset_name3 );
+H5_HLDLL herr_t H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2,
+ const char *dset_name2, const char *dset_name3);
-H5_HLDLL herr_t H5TBinsert_field( hid_t loc_id,
- const char *dset_name,
- const char *field_name,
- hid_t field_type,
- hsize_t position,
- const void *fill_data,
- const void *buf );
-
-H5_HLDLL herr_t H5TBdelete_field( hid_t loc_id,
- const char *dset_name,
- const char *field_name );
+H5_HLDLL herr_t H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name,
+ hid_t field_type, hsize_t position, const void *fill_data, const void *buf);
+H5_HLDLL herr_t H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name);
/*-------------------------------------------------------------------------
*
@@ -214,18 +119,12 @@ H5_HLDLL herr_t H5TBdelete_field( hid_t loc_id,
*-------------------------------------------------------------------------
*/
-H5_HLDLL herr_t H5TBAget_title( hid_t loc_id,
- char *table_title );
+H5_HLDLL herr_t H5TBAget_title(hid_t loc_id, char *table_title);
-H5_HLDLL htri_t H5TBAget_fill(hid_t loc_id,
- const char *dset_name,
- hid_t dset_id,
- unsigned char *dst_buf);
+H5_HLDLL htri_t H5TBAget_fill(hid_t loc_id, const char *dset_name, hid_t dset_id, unsigned char *dst_buf);
#ifdef __cplusplus
}
#endif
-
#endif
-
diff --git a/hl/src/hdf5_hl.h b/hl/src/hdf5_hl.h
index 3a7b8ee..51f8ab9 100644
--- a/hl/src/hdf5_hl.h
+++ b/hl/src/hdf5_hl.h
@@ -29,4 +29,3 @@
#include "H5LDpublic.h" /* lite dataset */
#endif /*H5_INCLUDE_HL*/
-
diff --git a/hl/test/gen_test_ds.c b/hl/test/gen_test_ds.c
index a43af77..27c3a0b 100644
--- a/hl/test/gen_test_ds.c
+++ b/hl/test/gen_test_ds.c
@@ -29,9 +29,9 @@
/* prototypes */
static hid_t open_test_file(const char *fileext);
-herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx);
-herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx);
-herr_t test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx);
+herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx);
+herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx);
+herr_t test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx);
herr_t test_set_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx);
herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx);
@@ -41,47 +41,46 @@ static int test_long_scalenames(const char *filename);
static int test_samelong_scalenames(const char *filename);
static int test_foreign_scaleattached(const char *filename);
-
-#define DIM_DATA 12
-#define DIM1_SIZE 3
-#define DIM2_SIZE 4
-#define DIM3_SIZE 12
-#define DIM4_SIZE 2
-#define DIM0 0
-#define DIM1 1
-#define DIM2 2
-#define DIM3 3
-
-#define DATASET_NAME "dset_"
-#define DS_1_NAME "ds_1_"
-#define DS_2_NAME "ds_2_"
-#define DS_3_NAME "ds_3_"
-#define DS_4_NAME "ds_4_"
-
-#define SCALE_1_NAME "scalename_1_"
-#define SCALE_2_NAME "scalename_2_"
-#define SCALE_3_NAME "scalename_3_"
-#define SCALE_4_NAME "scalename_4_"
-
-#define FILENAME "test_ds_"
-#define FILEEXT ".h5"
+#define DIM_DATA 12
+#define DIM1_SIZE 3
+#define DIM2_SIZE 4
+#define DIM3_SIZE 12
+#define DIM4_SIZE 2
+#define DIM0 0
+#define DIM1 1
+#define DIM2 2
+#define DIM3 3
+
+#define DATASET_NAME "dset_"
+#define DS_1_NAME "ds_1_"
+#define DS_2_NAME "ds_2_"
+#define DS_3_NAME "ds_3_"
+#define DS_4_NAME "ds_4_"
+
+#define SCALE_1_NAME "scalename_1_"
+#define SCALE_2_NAME "scalename_2_"
+#define SCALE_3_NAME "scalename_3_"
+#define SCALE_4_NAME "scalename_4_"
+
+#define FILENAME "test_ds_"
+#define FILEEXT ".h5"
/*-------------------------------------------------------------------------
* the main program
*-------------------------------------------------------------------------
*/
-int main(int argc , char **argv)
+int
+main(int argc, char **argv)
{
- int nerrors=0;
+ int nerrors = 0;
char filename[65];
-
if (argc < 2) {
HDprintf("Usage: gen_test [le | be]\n");
return 1;
}
- if ( argv[1] && (strcmp("le",argv[1])!=0) && (strcmp("be",argv[1])!=0) ) {
+ if (argv[1] && (strcmp("le", argv[1]) != 0) && (strcmp("be", argv[1]) != 0)) {
HDprintf("Usage: gen_test [le | be]\n");
return 1;
}
@@ -90,26 +89,28 @@ int main(int argc , char **argv)
strcpy(filename, FILENAME);
strcat(filename, argv[1]);
strcat(filename, FILEEXT);
- if(H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT) < 0) {
+ if (H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT) < 0) {
nerrors = 1;
goto error;
}
- nerrors += test_long_attachscales(filename) < 0 ? 1 : 0;
- nerrors += test_duplicatelong_attachscales(filename) < 0 ? 1 : 0;
- nerrors += test_samelong_scalenames(filename) < 0 ? 1 : 0;
- nerrors += test_foreign_scaleattached(filename) < 0 ? 1 : 0;
- nerrors += test_long_scalenames(filename) < 0 ? 1 : 0;
+ nerrors += test_long_attachscales(filename) < 0 ? 1 : 0;
+ nerrors += test_duplicatelong_attachscales(filename) < 0 ? 1 : 0;
+ nerrors += test_samelong_scalenames(filename) < 0 ? 1 : 0;
+ nerrors += test_foreign_scaleattached(filename) < 0 ? 1 : 0;
+ nerrors += test_long_scalenames(filename) < 0 ? 1 : 0;
- if(nerrors) goto error;
+ if (nerrors)
+ goto error;
HDprintf("Dimension scales file generation passed.\n");
return 0;
error:
- HDprintf("***** %d DIMENSION SCALES FILE GENERATION FAILED! *****\n",nerrors);
+ HDprintf("***** %d DIMENSION SCALES FILE GENERATION FAILED! *****\n", nerrors);
return 1;
}
-static hid_t open_test_file(const char *fileext)
+static hid_t
+open_test_file(const char *fileext)
{
char filename[65];
@@ -125,191 +126,197 @@ static hid_t open_test_file(const char *fileext)
*-------------------------------------------------------------------------
*/
-herr_t create_long_dataset(hid_t fid, const char *name, const char *dsidx)
+herr_t
+create_long_dataset(hid_t fid, const char *name, const char *dsidx)
{
- int rank = 4;
- int rankds = 1;
- hsize_t dims[4] = {DIM1_SIZE,DIM2_SIZE,DIM3_SIZE,DIM4_SIZE};
- long buf[DIM_DATA*3*2] = {1,2,3,4,5,6,7,8,9,10,11,12,
- 1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12,
- 1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12,
- 1,2,3,4,5,6,7,8,9,10,11,12};
- hsize_t s1_dim[1] = {DIM1_SIZE};
- hsize_t s2_dim[1] = {DIM2_SIZE};
- hsize_t s3_dim[1] = {DIM3_SIZE};
- hsize_t s4_dim[1] = {DIM4_SIZE};
- long s1_wbuf[DIM1_SIZE] = {10,20,30};
- long s2_wbuf[DIM2_SIZE] = {100,200,300,400};
- long s3_wbuf[DIM3_SIZE] = {10,10,10,20,20,20,30,30,30,40,40,40};
- long s4_wbuf[DIM4_SIZE] = {18,18};
+ int rank = 4;
+ int rankds = 1;
+ hsize_t dims[4] = {DIM1_SIZE, DIM2_SIZE, DIM3_SIZE, DIM4_SIZE};
+ long buf[DIM_DATA * 3 * 2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
+ hsize_t s1_dim[1] = {DIM1_SIZE};
+ hsize_t s2_dim[1] = {DIM2_SIZE};
+ hsize_t s3_dim[1] = {DIM3_SIZE};
+ hsize_t s4_dim[1] = {DIM4_SIZE};
+ long s1_wbuf[DIM1_SIZE] = {10, 20, 30};
+ long s2_wbuf[DIM2_SIZE] = {100, 200, 300, 400};
+ long s3_wbuf[DIM3_SIZE] = {10, 10, 10, 20, 20, 20, 30, 30, 30, 40, 40, 40};
+ long s4_wbuf[DIM4_SIZE] = {18, 18};
/* make a dataset */
- if(H5LTmake_dataset_long(fid, name, rank, dims, buf) >= 0) {
+ if (H5LTmake_dataset_long(fid, name, rank, dims, buf) >= 0) {
/* make a DS dataset for the first dimension */
char dsname[32];
strcpy(dsname, DS_1_NAME);
strcat(dsname, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_long(fid, dsname, rankds, s1_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, dsname, rankds, s1_dim, s1_wbuf) < 0)
return FAIL;
strcpy(dsname, DS_2_NAME);
strcat(dsname, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_long(fid, dsname, rankds, s2_dim, s2_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, dsname, rankds, s2_dim, s2_wbuf) < 0)
return FAIL;
strcpy(dsname, DS_3_NAME);
strcat(dsname, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_long(fid, dsname, rankds, s3_dim, s3_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, dsname, rankds, s3_dim, s3_wbuf) < 0)
return FAIL;
strcpy(dsname, DS_4_NAME);
strcat(dsname, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_long(fid, dsname, rankds, s4_dim, s4_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, dsname, rankds, s4_dim, s4_wbuf) < 0)
return FAIL;
- }
- else
- return FAIL;
+ }
+ else
+ return FAIL;
return SUCCEED;
}
-herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
+herr_t
+test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
{
- herr_t ret_value = FAIL;
- hid_t dsid = -1;
+ herr_t ret_value = FAIL;
+ hid_t dsid = -1;
- if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
- if(H5DSis_attached(did, dsid, idx) == 0) {
- if(H5DSattach_scale(did, dsid, idx) >= 0) {
- if(H5DSis_attached(did, dsid, idx) > 0) {
+ if ((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
+ if (H5DSis_attached(did, dsid, idx) == 0) {
+ if (H5DSattach_scale(did, dsid, idx) >= 0) {
+ if (H5DSis_attached(did, dsid, idx) > 0) {
/* HDprintf(" scale attached "); */
ret_value = SUCCEED;
}
- else if(H5DSis_attached(did, dsid, idx) == 0) {
+ else if (H5DSis_attached(did, dsid, idx) == 0) {
HDprintf(" scale not attached ");
}
}
}
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
ret_value = FAIL;
}
return ret_value;
}
-herr_t test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
+herr_t
+test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
{
- herr_t ret_value = FAIL;
- hid_t dsid = -1;
+ herr_t ret_value = FAIL;
+ hid_t dsid = -1;
- if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
- if(H5DSis_attached(did, dsid, idx) == 1) {
- if(H5DSdetach_scale(did, dsid, idx) >= 0) {
- if(H5DSis_attached(did, dsid, idx) == 0) {
+ if ((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
+ if (H5DSis_attached(did, dsid, idx) == 1) {
+ if (H5DSdetach_scale(did, dsid, idx) >= 0) {
+ if (H5DSis_attached(did, dsid, idx) == 0) {
ret_value = SUCCEED;
}
}
}
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
ret_value = FAIL;
}
return ret_value;
}
-herr_t test_set_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
+herr_t
+test_set_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
{
- herr_t ret_value = FAIL;
- hid_t dsid = -1;
+ herr_t ret_value = FAIL;
+ hid_t dsid = -1;
- if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
- if(H5DSis_attached(did, dsid, idx) == 1) {
- if(H5DSset_scale(dsid, scalename) >= 0) {
- if(H5DSis_attached(did, dsid, idx) == 1) {
- ret_value = SUCCEED;
+ if ((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
+ if (H5DSis_attached(did, dsid, idx) == 1) {
+ if (H5DSset_scale(dsid, scalename) >= 0) {
+ if (H5DSis_attached(did, dsid, idx) == 1) {
+ ret_value = SUCCEED;
}
}
}
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
ret_value = FAIL;
}
return ret_value;
}
-herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
+herr_t
+test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
{
herr_t ret_value = FAIL;
- hid_t dsid = -1;
+ hid_t dsid = -1;
ssize_t name_len;
- char *name_out=NULL;
-
- if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
- if(H5DSis_attached(did, dsid, idx) == 1) {
- if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) > 0) {
- name_out = (char*)HDmalloc((size_t)name_len * sizeof (char));
- if(name_out != NULL) {
- if(H5DSget_scale_name(dsid, name_out, (size_t)name_len) >= 0) {
- if(strcmp(scalename,name_out)==0) {
+ char * name_out = NULL;
+
+ if ((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
+ if (H5DSis_attached(did, dsid, idx) == 1) {
+ if ((name_len = H5DSget_scale_name(dsid, NULL, (size_t)0)) > 0) {
+ name_out = (char *)HDmalloc((size_t)name_len * sizeof(char));
+ if (name_out != NULL) {
+ if (H5DSget_scale_name(dsid, name_out, (size_t)name_len) >= 0) {
+ if (strcmp(scalename, name_out) == 0) {
ret_value = SUCCEED;
}
HDfree(name_out);
- name_out=NULL;
+ name_out = NULL;
}
}
}
}
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
ret_value = FAIL;
}
return ret_value;
}
-static int test_long_attachscales(const char *filename)
+static int
+test_long_attachscales(const char *filename)
{
- hid_t fid = -1;
- hid_t did = -1;
- char dsname[32];
- char scalename[32];
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "al");
HL_TESTING2("test_long_attachscales");
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
goto out;
/* make a dataset */
- if(create_long_dataset(fid, dsname, "al") < 0)
+ if (create_long_dataset(fid, dsname, "al") < 0)
goto out;
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
strcpy(scalename, DS_1_NAME);
strcat(scalename, "al");
- if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
strcpy(scalename, DS_2_NAME);
strcat(scalename, "al");
- if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
strcpy(scalename, DS_3_NAME);
strcat(scalename, "al");
- if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
strcpy(scalename, DS_4_NAME);
strcat(scalename, "al");
- if(test_attach_scale(fid, did, scalename, DIM3) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM3) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -321,56 +328,59 @@ static int test_long_attachscales(const char *filename)
return SUCCEED;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_duplicatelong_attachscales(const char *filename)
+static int
+test_duplicatelong_attachscales(const char *filename)
{
- hid_t fid = -1;
- hid_t did = -1;
- char dsname[32];
- char scalename[32];
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "al2");
HL_TESTING2("test_duplicatelong_attachscales");
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
goto out;
/* make a dataset 2 */
- if(create_long_dataset(fid, dsname, "al2") < 0)
+ if (create_long_dataset(fid, dsname, "al2") < 0)
goto out;
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
strcpy(scalename, DS_1_NAME);
strcat(scalename, "al");
- if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
strcpy(scalename, DS_2_NAME);
strcat(scalename, "al");
- if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
strcpy(scalename, DS_3_NAME);
strcat(scalename, "al");
- if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
strcpy(scalename, DS_4_NAME);
strcat(scalename, "al");
- if(test_attach_scale(fid, did, scalename, DIM3) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM3) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -382,71 +392,75 @@ static int test_duplicatelong_attachscales(const char *filename)
return SUCCEED;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_long_scalenames(const char *filename) {
- hid_t fid = -1;
- hid_t did = -1;
- char dsname[32];
- char scalename[32];
- char name[32];
+static int
+test_long_scalenames(const char *filename)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ char name[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "al");
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
goto out;
HL_TESTING2("set long scale/cmp scale name");
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
strcpy(scalename, DS_1_NAME);
strcat(scalename, "al");
strcpy(name, SCALE_1_NAME);
strcat(name, "al");
- if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
strcpy(scalename, DS_2_NAME);
strcat(scalename, "al");
strcpy(name, SCALE_2_NAME);
strcat(name, "al");
- if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
strcpy(scalename, DS_3_NAME);
strcat(scalename, "al");
strcpy(name, SCALE_3_NAME);
strcat(name, "al");
- if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
strcpy(scalename, DS_4_NAME);
strcat(scalename, "al");
strcpy(name, SCALE_4_NAME);
strcat(name, "al");
- if(test_set_scalename(fid, did, scalename, name, DIM3) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM3) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM3) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM3) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -458,72 +472,76 @@ static int test_long_scalenames(const char *filename) {
return SUCCEED;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_samelong_scalenames(const char *filename) {
- hid_t fid = -1;
- hid_t did = -1;
- char dsname[32];
- char scalename[32];
- char name[32];
+static int
+test_samelong_scalenames(const char *filename)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ char name[32];
strcpy(dsname, DATASET_NAME);
strcat(dsname, "al2");
- if((fid = open_test_file(filename)) < 0)
+ if ((fid = open_test_file(filename)) < 0)
goto out;
HL_TESTING2("set same long scale/cmp scale name");
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
strcpy(scalename, DS_1_NAME);
strcat(scalename, "al");
strcpy(name, DS_1_NAME);
strcat(name, "al");
- if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
strcpy(scalename, DS_2_NAME);
strcat(scalename, "al");
strcpy(name, DS_2_NAME);
strcat(name, "al");
- if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
strcpy(scalename, DS_3_NAME);
strcat(scalename, "al");
strcpy(name, DS_3_NAME);
strcat(name, "al");
- if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
strcpy(scalename, DS_4_NAME);
strcat(scalename, "al");
strcpy(name, DS_4_NAME);
strcat(name, "al");
- if(test_set_scalename(fid, did, scalename, name, DIM3) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM3) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM3) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM3) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -535,43 +553,46 @@ static int test_samelong_scalenames(const char *filename) {
return SUCCEED;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_foreign_scaleattached(const char *filename)
+static int
+test_foreign_scaleattached(const char *filename)
{
- herr_t ret_value = FAIL;
- hid_t fid = -1;
- hid_t did = -1;
- hid_t dsid = -1;
+ herr_t ret_value = FAIL;
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t dsid = -1;
HL_TESTING2("test_foreign_scaleattached");
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
goto out;
- if((did = H5Dopen2(fid, "/dset_al", H5P_DEFAULT)) >= 0) {
- if((dsid = H5Dopen2(fid, "/ds_4_al", H5P_DEFAULT)) >= 0) {
- if(H5DSis_attached(did, dsid, 3) == 1) {
+ if ((did = H5Dopen2(fid, "/dset_al", H5P_DEFAULT)) >= 0) {
+ if ((dsid = H5Dopen2(fid, "/ds_4_al", H5P_DEFAULT)) >= 0) {
+ if (H5DSis_attached(did, dsid, 3) == 1) {
ret_value = SUCCEED;
}
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
}
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
goto out;
- if(ret_value == FAIL)
+ if (ret_value == FAIL)
goto out;
PASSED();
@@ -580,10 +601,12 @@ static int test_foreign_scaleattached(const char *filename)
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
diff --git a/hl/test/gen_test_ld.c b/hl/test/gen_test_ld.c
index 981aded..2a3beb5 100644
--- a/hl/test/gen_test_ld.c
+++ b/hl/test/gen_test_ld.c
@@ -31,28 +31,28 @@
* DSET_NONE: fixed dimension setting, contiguous, H5D_ALLOC_TIME_LATE
* DSET_NOMAX: fixed dimension setting, chunked, H5D_ALLOC_TIME_INCR
*/
-#define ONE_DIMS0 10
-#define MAX_ONE_DIMS0 100
+#define ONE_DIMS0 10
+#define MAX_ONE_DIMS0 100
-#define DSET_ONE "DSET_ONE"
-#define DSET_NONE "DSET_NONE"
-#define DSET_NOMAX "DSET_NOMAX"
-#define DSET_ALLOC_LATE "DSET_ALLOC_LATE"
+#define DSET_ONE "DSET_ONE"
+#define DSET_NONE "DSET_NONE"
+#define DSET_NOMAX "DSET_NOMAX"
+#define DSET_ALLOC_LATE "DSET_ALLOC_LATE"
#define DSET_ALLOC_EARLY "DSET_ALLOC_EARLY"
-#define DSET_CMPD "DSET_CMPD"
-#define DSET_CMPD_ESC "DSET_CMPD_ESC"
-#define DSET_NULL "DSET_NULL"
-#define DSET_SCALAR "DSET_SCALAR"
+#define DSET_CMPD "DSET_CMPD"
+#define DSET_CMPD_ESC "DSET_CMPD_ESC"
+#define DSET_NULL "DSET_NULL"
+#define DSET_SCALAR "DSET_SCALAR"
-#define TWO_DIMS0 4
-#define TWO_DIMS1 10
-#define MAX_TWO_DIMS0 60
-#define MAX_TWO_DIMS1 100
+#define TWO_DIMS0 4
+#define TWO_DIMS1 10
+#define MAX_TWO_DIMS0 60
+#define MAX_TWO_DIMS1 100
-#define DSET_TWO "DSET_TWO"
-#define DSET_CMPD_TWO "DSET_CMPD_TWO"
+#define DSET_TWO "DSET_TWO"
+#define DSET_CMPD_TWO "DSET_CMPD_TWO"
-#define CHUNK_SIZE 2
+#define CHUNK_SIZE 2
#define FILE "test_ld.h5"
@@ -65,7 +65,7 @@ typedef struct sub22_t {
typedef struct sub2_t {
unsigned int a;
- sub22_t b;
+ sub22_t b;
unsigned int c;
} sub2_t;
@@ -76,9 +76,9 @@ typedef struct sub4_t {
typedef struct set_t {
unsigned int field1;
- sub2_t field2;
- double field3;
- sub4_t field4;
+ sub2_t field2;
+ double field3;
+ sub4_t field4;
} set_t;
/*
@@ -90,119 +90,119 @@ typedef struct set_t {
**************************************************************************************
*/
static int
-generate_dset(hid_t fid, const char *dname, int ndims, hsize_t *dims,
- hsize_t *maxdims, hid_t dtid, void *data)
+generate_dset(hid_t fid, const char *dname, int ndims, hsize_t *dims, hsize_t *maxdims, hid_t dtid,
+ void *data)
{
- hid_t dcpl = -1; /* Dataset creation property */
- hid_t did = -1; /* Dataset id */
- hid_t sid = -1; /* Dataspace id */
- int i; /* Local index variable */
+ hid_t dcpl = -1; /* Dataset creation property */
+ hid_t did = -1; /* Dataset id */
+ hid_t sid = -1; /* Dataspace id */
+ int i; /* Local index variable */
/* Create the dataspace */
- if((sid = H5Screate_simple(ndims, dims, maxdims)) < 0)
- goto done;
+ if ((sid = H5Screate_simple(ndims, dims, maxdims)) < 0)
+ goto done;
/* Set up dataset's creation properties */
- if(!HDstrcmp(dname, DSET_NONE))
- dcpl = H5P_DEFAULT;
+ if (!HDstrcmp(dname, DSET_NONE))
+ dcpl = H5P_DEFAULT;
else {
- hsize_t chunk_dims[H5S_MAX_RANK]; /* Dimension sizes for chunks */
-
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto done;
- for(i = 0; i < ndims; i++)
- chunk_dims[i] = CHUNK_SIZE;
- if(H5Pset_chunk(dcpl, ndims, chunk_dims) < 0)
- goto done;
+ hsize_t chunk_dims[H5S_MAX_RANK]; /* Dimension sizes for chunks */
+
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto done;
+ for (i = 0; i < ndims; i++)
+ chunk_dims[i] = CHUNK_SIZE;
+ if (H5Pset_chunk(dcpl, ndims, chunk_dims) < 0)
+ goto done;
} /* end else */
- if(!HDstrcmp(dname, DSET_ALLOC_LATE)) {
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0)
- goto done;
+ if (!HDstrcmp(dname, DSET_ALLOC_LATE)) {
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0)
+ goto done;
} /* end if */
- else if(!HDstrcmp(dname, DSET_ALLOC_EARLY)) {
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
- goto done;
+ else if (!HDstrcmp(dname, DSET_ALLOC_EARLY)) {
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ goto done;
} /* end if */
/* Create the dataset */
- if((did = H5Dcreate2(fid, dname, dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto done;
+ if ((did = H5Dcreate2(fid, dname, dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto done;
/* Write to the dataset */
- if(H5Dwrite(did, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
- goto done;
+ if (H5Dwrite(did, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ goto done;
/* Closing */
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto done;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto done;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto done;
- return(SUCCEED);
+ return (SUCCEED);
done:
H5E_BEGIN_TRY
- H5Sclose(sid);
- H5Pclose(dcpl);
- H5Dclose(did);
+ H5Sclose(sid);
+ H5Pclose(dcpl);
+ H5Dclose(did);
H5E_END_TRY
- return(FAIL);
+ return (FAIL);
} /* generate_dset() */
int
main(void)
{
- hid_t fid; /* File id */
- hid_t fapl; /* File access property list */
- hsize_t cur_dims[1]; /* Dimension sizes */
- hsize_t max_dims[1]; /* Maximum dimension sizes */
- hsize_t cur2_dims[2]; /* Current dimension sizes */
- hsize_t max2_dims[2]; /* Maximum dimension sizes */
- hid_t set_tid, esc_set_tid; /* Compound type id */
- hid_t sub22_tid; /* Compound type id */
- hid_t sub2_tid, esc_sub2_tid; /* Compound type id */
- hid_t sub4_tid, esc_sub4_tid; /* Compound type id */
- hid_t null_did, null_sid; /* H5S_NULL dataset & dataspace ids */
- hid_t scalar_did, scalar_sid; /* H5S_SCALAR dataset & dataspace ids */
- int one_data[ONE_DIMS0]; /* Buffer for data */
- int two_data[TWO_DIMS0*TWO_DIMS1]; /* Buffer for data */
- set_t one_cbuf[ONE_DIMS0]; /* Buffer for data with compound type */
- set_t two_cbuf[TWO_DIMS0*TWO_DIMS1]; /* Buffer for data with compound type */
- int i; /* Local index variable */
+ hid_t fid; /* File id */
+ hid_t fapl; /* File access property list */
+ hsize_t cur_dims[1]; /* Dimension sizes */
+ hsize_t max_dims[1]; /* Maximum dimension sizes */
+ hsize_t cur2_dims[2]; /* Current dimension sizes */
+ hsize_t max2_dims[2]; /* Maximum dimension sizes */
+ hid_t set_tid, esc_set_tid; /* Compound type id */
+ hid_t sub22_tid; /* Compound type id */
+ hid_t sub2_tid, esc_sub2_tid; /* Compound type id */
+ hid_t sub4_tid, esc_sub4_tid; /* Compound type id */
+ hid_t null_did, null_sid; /* H5S_NULL dataset & dataspace ids */
+ hid_t scalar_did, scalar_sid; /* H5S_SCALAR dataset & dataspace ids */
+ int one_data[ONE_DIMS0]; /* Buffer for data */
+ int two_data[TWO_DIMS0 * TWO_DIMS1]; /* Buffer for data */
+ set_t one_cbuf[ONE_DIMS0]; /* Buffer for data with compound type */
+ set_t two_cbuf[TWO_DIMS0 * TWO_DIMS1]; /* Buffer for data with compound type */
+ int i; /* Local index variable */
/* Create a file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto done;
/* Set to use latest library format */
- if((H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)) < 0)
+ if ((H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)) < 0)
goto done;
/* Create a file */
- if((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- goto done;
+ if ((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto done;
/* Initialization for one-dimensional dataset */
cur_dims[0] = ONE_DIMS0;
max_dims[0] = MAX_ONE_DIMS0;
- for(i = 0; i < ONE_DIMS0; i++)
+ for (i = 0; i < ONE_DIMS0; i++)
one_data[i] = i;
/* Generate DSET_ONE, DSET_NONE, DSET_NOMAX, DSET_ALLOC_LATE, DSET_EARLY */
- if(generate_dset(fid, DSET_ONE, 1, cur_dims, max_dims, H5T_NATIVE_INT, one_data) < 0)
- goto done;
- if(generate_dset(fid, DSET_NONE, 1, cur_dims, NULL, H5T_NATIVE_INT, one_data) < 0)
- goto done;
- if(generate_dset(fid, DSET_NOMAX, 1, cur_dims, NULL, H5T_NATIVE_INT, one_data) < 0)
- goto done;
- if(generate_dset(fid, DSET_ALLOC_LATE, 1, cur_dims, max_dims, H5T_NATIVE_INT, one_data) < 0)
- goto done;
- if(generate_dset(fid, DSET_ALLOC_EARLY, 1, cur_dims, max_dims, H5T_NATIVE_INT, one_data) < 0)
- goto done;
+ if (generate_dset(fid, DSET_ONE, 1, cur_dims, max_dims, H5T_NATIVE_INT, one_data) < 0)
+ goto done;
+ if (generate_dset(fid, DSET_NONE, 1, cur_dims, NULL, H5T_NATIVE_INT, one_data) < 0)
+ goto done;
+ if (generate_dset(fid, DSET_NOMAX, 1, cur_dims, NULL, H5T_NATIVE_INT, one_data) < 0)
+ goto done;
+ if (generate_dset(fid, DSET_ALLOC_LATE, 1, cur_dims, max_dims, H5T_NATIVE_INT, one_data) < 0)
+ goto done;
+ if (generate_dset(fid, DSET_ALLOC_EARLY, 1, cur_dims, max_dims, H5T_NATIVE_INT, one_data) < 0)
+ goto done;
/* Initialization for two-dimensional dataset */
cur2_dims[0] = TWO_DIMS0;
@@ -210,99 +210,99 @@ main(void)
max2_dims[0] = MAX_TWO_DIMS0;
max2_dims[1] = MAX_TWO_DIMS1;
- for(i = 0; i < (TWO_DIMS0 * TWO_DIMS1); i++)
+ for (i = 0; i < (TWO_DIMS0 * TWO_DIMS1); i++)
two_data[i] = i;
/* Generate DSET_TWO */
- if(generate_dset(fid, DSET_TWO, 2, cur2_dims, max2_dims, H5T_NATIVE_INT, two_data) < 0)
- goto done;
+ if (generate_dset(fid, DSET_TWO, 2, cur2_dims, max2_dims, H5T_NATIVE_INT, two_data) < 0)
+ goto done;
/* Initialization for one-dimensional compound typed dataset */
cur_dims[0] = ONE_DIMS0;
max_dims[0] = MAX_ONE_DIMS0;
for (i = 0; i < ONE_DIMS0; i++) {
- one_cbuf[i].field1 = 1;
- one_cbuf[i].field2.a = 2;
- one_cbuf[i].field2.c = 4;
+ one_cbuf[i].field1 = 1;
+ one_cbuf[i].field2.a = 2;
+ one_cbuf[i].field2.c = 4;
one_cbuf[i].field2.b.a = 20;
one_cbuf[i].field2.b.b = 40;
one_cbuf[i].field2.b.c = 80;
- one_cbuf[i].field3 = 3.0f;
- one_cbuf[i].field4.a = 4;
- one_cbuf[i].field4.b = 8;
+ one_cbuf[i].field3 = 3.0f;
+ one_cbuf[i].field4.a = 4;
+ one_cbuf[i].field4.b = 8;
} /* end for */
/* Create the compound type */
- if((sub22_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub22_t))) < 0)
- goto done;
- if(H5Tinsert(sub22_tid, "a", HOFFSET(sub22_t, a), H5T_NATIVE_INT) < 0)
- goto done;
- if(H5Tinsert(sub22_tid, "b", HOFFSET(sub22_t, b), H5T_NATIVE_INT) < 0)
- goto done;
- if(H5Tinsert(sub22_tid, "c", HOFFSET(sub22_t, c), H5T_NATIVE_INT) < 0)
- goto done;
-
- if((sub2_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub2_t))) < 0)
- goto done;
- if(H5Tinsert(sub2_tid, "a", HOFFSET(sub2_t, a), H5T_NATIVE_INT) < 0)
- goto done;
- if(H5Tinsert(sub2_tid, "b", HOFFSET(sub2_t, b), sub22_tid) < 0)
- goto done;
- if(H5Tinsert(sub2_tid, "c", HOFFSET(sub2_t, c), H5T_NATIVE_INT) < 0)
- goto done;
-
- if((sub4_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub4_t))) < 0)
- goto done;
- if(H5Tinsert(sub4_tid, "a", HOFFSET(sub4_t, a), H5T_NATIVE_INT) < 0)
- goto done;
- if(H5Tinsert(sub4_tid, "b", HOFFSET(sub4_t, b), H5T_NATIVE_INT) < 0)
- goto done;
-
- if((set_tid = H5Tcreate(H5T_COMPOUND, sizeof(set_t))) < 0)
- goto done;
- if(H5Tinsert(set_tid, "field1", HOFFSET(set_t, field1), H5T_NATIVE_INT) < 0)
- goto done;
- if(H5Tinsert(set_tid, "field2", HOFFSET(set_t, field2), sub2_tid) < 0)
- goto done;
- if(H5Tinsert(set_tid, "field3", HOFFSET(set_t, field3), H5T_NATIVE_DOUBLE) < 0)
- goto done;
- if(H5Tinsert(set_tid, "field4", HOFFSET(set_t, field4), sub4_tid) < 0)
- goto done;
+ if ((sub22_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub22_t))) < 0)
+ goto done;
+ if (H5Tinsert(sub22_tid, "a", HOFFSET(sub22_t, a), H5T_NATIVE_INT) < 0)
+ goto done;
+ if (H5Tinsert(sub22_tid, "b", HOFFSET(sub22_t, b), H5T_NATIVE_INT) < 0)
+ goto done;
+ if (H5Tinsert(sub22_tid, "c", HOFFSET(sub22_t, c), H5T_NATIVE_INT) < 0)
+ goto done;
+
+ if ((sub2_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub2_t))) < 0)
+ goto done;
+ if (H5Tinsert(sub2_tid, "a", HOFFSET(sub2_t, a), H5T_NATIVE_INT) < 0)
+ goto done;
+ if (H5Tinsert(sub2_tid, "b", HOFFSET(sub2_t, b), sub22_tid) < 0)
+ goto done;
+ if (H5Tinsert(sub2_tid, "c", HOFFSET(sub2_t, c), H5T_NATIVE_INT) < 0)
+ goto done;
+
+ if ((sub4_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub4_t))) < 0)
+ goto done;
+ if (H5Tinsert(sub4_tid, "a", HOFFSET(sub4_t, a), H5T_NATIVE_INT) < 0)
+ goto done;
+ if (H5Tinsert(sub4_tid, "b", HOFFSET(sub4_t, b), H5T_NATIVE_INT) < 0)
+ goto done;
+
+ if ((set_tid = H5Tcreate(H5T_COMPOUND, sizeof(set_t))) < 0)
+ goto done;
+ if (H5Tinsert(set_tid, "field1", HOFFSET(set_t, field1), H5T_NATIVE_INT) < 0)
+ goto done;
+ if (H5Tinsert(set_tid, "field2", HOFFSET(set_t, field2), sub2_tid) < 0)
+ goto done;
+ if (H5Tinsert(set_tid, "field3", HOFFSET(set_t, field3), H5T_NATIVE_DOUBLE) < 0)
+ goto done;
+ if (H5Tinsert(set_tid, "field4", HOFFSET(set_t, field4), sub4_tid) < 0)
+ goto done;
/* Create the compound type with escape/separator characters */
- if((esc_sub2_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub2_t))) < 0)
- goto done;
- if(H5Tinsert(esc_sub2_tid, ".a", HOFFSET(sub2_t, a), H5T_NATIVE_INT) < 0)
- goto done;
- if(H5Tinsert(esc_sub2_tid, ",b", HOFFSET(sub2_t, b), sub22_tid) < 0)
- goto done;
- if(H5Tinsert(esc_sub2_tid, "\\c", HOFFSET(sub2_t, c), H5T_NATIVE_INT) < 0)
- goto done;
-
- if((esc_sub4_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub4_t))) < 0)
- goto done;
- if(H5Tinsert(esc_sub4_tid, "a.", HOFFSET(sub4_t, a), H5T_NATIVE_INT) < 0)
- goto done;
- if(H5Tinsert(esc_sub4_tid, "b,", HOFFSET(sub4_t, b), H5T_NATIVE_INT) < 0)
- goto done;
-
- if((esc_set_tid = H5Tcreate(H5T_COMPOUND, sizeof(set_t))) < 0)
- goto done;
- if(H5Tinsert(esc_set_tid, "field,1", HOFFSET(set_t, field1), H5T_NATIVE_INT) < 0)
- goto done;
- if(H5Tinsert(esc_set_tid, "field2.", HOFFSET(set_t, field2), esc_sub2_tid) < 0)
- goto done;
- if(H5Tinsert(esc_set_tid, "field\\3", HOFFSET(set_t, field3), H5T_NATIVE_DOUBLE) < 0)
- goto done;
- if(H5Tinsert(esc_set_tid, "field4,", HOFFSET(set_t, field4), esc_sub4_tid) < 0)
- goto done;
+ if ((esc_sub2_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub2_t))) < 0)
+ goto done;
+ if (H5Tinsert(esc_sub2_tid, ".a", HOFFSET(sub2_t, a), H5T_NATIVE_INT) < 0)
+ goto done;
+ if (H5Tinsert(esc_sub2_tid, ",b", HOFFSET(sub2_t, b), sub22_tid) < 0)
+ goto done;
+ if (H5Tinsert(esc_sub2_tid, "\\c", HOFFSET(sub2_t, c), H5T_NATIVE_INT) < 0)
+ goto done;
+
+ if ((esc_sub4_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub4_t))) < 0)
+ goto done;
+ if (H5Tinsert(esc_sub4_tid, "a.", HOFFSET(sub4_t, a), H5T_NATIVE_INT) < 0)
+ goto done;
+ if (H5Tinsert(esc_sub4_tid, "b,", HOFFSET(sub4_t, b), H5T_NATIVE_INT) < 0)
+ goto done;
+
+ if ((esc_set_tid = H5Tcreate(H5T_COMPOUND, sizeof(set_t))) < 0)
+ goto done;
+ if (H5Tinsert(esc_set_tid, "field,1", HOFFSET(set_t, field1), H5T_NATIVE_INT) < 0)
+ goto done;
+ if (H5Tinsert(esc_set_tid, "field2.", HOFFSET(set_t, field2), esc_sub2_tid) < 0)
+ goto done;
+ if (H5Tinsert(esc_set_tid, "field\\3", HOFFSET(set_t, field3), H5T_NATIVE_DOUBLE) < 0)
+ goto done;
+ if (H5Tinsert(esc_set_tid, "field4,", HOFFSET(set_t, field4), esc_sub4_tid) < 0)
+ goto done;
/* Generate DSET_CMPD, DSET_CMPD_ESC */
- if(generate_dset(fid, DSET_CMPD, 1, cur_dims, max_dims, set_tid, one_cbuf) < 0)
- goto done;
- if(generate_dset(fid, DSET_CMPD_ESC, 1, cur_dims, max_dims, esc_set_tid, one_cbuf) < 0)
- goto done;
+ if (generate_dset(fid, DSET_CMPD, 1, cur_dims, max_dims, set_tid, one_cbuf) < 0)
+ goto done;
+ if (generate_dset(fid, DSET_CMPD_ESC, 1, cur_dims, max_dims, esc_set_tid, one_cbuf) < 0)
+ goto done;
/* Initialization for two-dimensional compound typed dataset */
cur2_dims[0] = TWO_DIMS0;
@@ -311,76 +311,90 @@ main(void)
max2_dims[0] = MAX_TWO_DIMS1;
for (i = 0; i < (TWO_DIMS0 * TWO_DIMS1); i++) {
- two_cbuf[i].field1 = 1;
- two_cbuf[i].field2.a = 2;
- two_cbuf[i].field2.c = 4;
+ two_cbuf[i].field1 = 1;
+ two_cbuf[i].field2.a = 2;
+ two_cbuf[i].field2.c = 4;
two_cbuf[i].field2.b.a = 20;
two_cbuf[i].field2.b.b = 40;
two_cbuf[i].field2.b.c = 80;
- two_cbuf[i].field3 = 3.0f;
- two_cbuf[i].field4.a = 4;
- two_cbuf[i].field4.b = 8;
+ two_cbuf[i].field3 = 3.0f;
+ two_cbuf[i].field4.a = 4;
+ two_cbuf[i].field4.b = 8;
} /* end for */
/* Generate DSET_CMPD_TWO */
- if(generate_dset(fid, DSET_CMPD_TWO, 2, cur2_dims, max2_dims, set_tid, two_cbuf) < 0)
- goto done;
+ if (generate_dset(fid, DSET_CMPD_TWO, 2, cur2_dims, max2_dims, set_tid, two_cbuf) < 0)
+ goto done;
/* Create NULL dataspace */
- if((null_sid = H5Screate(H5S_NULL)) < 0)
- goto done;
+ if ((null_sid = H5Screate(H5S_NULL)) < 0)
+ goto done;
/* Create the NULL dataset */
- if((null_did = H5Dcreate2(fid, DSET_NULL, H5T_NATIVE_UINT, null_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto done;
+ if ((null_did = H5Dcreate2(fid, DSET_NULL, H5T_NATIVE_UINT, null_sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ goto done;
/* Create SCALAR dataspace */
- if((scalar_sid = H5Screate(H5S_SCALAR)) < 0)
- goto done;
+ if ((scalar_sid = H5Screate(H5S_SCALAR)) < 0)
+ goto done;
/* Create the SCALAR dataset */
- if((scalar_did = H5Dcreate2(fid, DSET_SCALAR, H5T_NATIVE_INT, scalar_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto done;
+ if ((scalar_did = H5Dcreate2(fid, DSET_SCALAR, H5T_NATIVE_INT, scalar_sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ goto done;
/* Closing */
- if(H5Dclose(scalar_did) < 0) goto done;
- if(H5Sclose(scalar_sid) < 0) goto done;
+ if (H5Dclose(scalar_did) < 0)
+ goto done;
+ if (H5Sclose(scalar_sid) < 0)
+ goto done;
- if(H5Dclose(null_did) < 0) goto done;
- if(H5Sclose(null_sid) < 0) goto done;
+ if (H5Dclose(null_did) < 0)
+ goto done;
+ if (H5Sclose(null_sid) < 0)
+ goto done;
- if(H5Tclose(sub22_tid) < 0) goto done;
- if(H5Tclose(sub2_tid) < 0) goto done;
- if(H5Tclose(sub4_tid) < 0) goto done;
- if(H5Tclose(set_tid) < 0) goto done;
- if(H5Tclose(esc_sub2_tid) < 0) goto done;
- if(H5Tclose(esc_sub4_tid) < 0) goto done;
- if(H5Tclose(esc_set_tid) < 0) goto done;
+ if (H5Tclose(sub22_tid) < 0)
+ goto done;
+ if (H5Tclose(sub2_tid) < 0)
+ goto done;
+ if (H5Tclose(sub4_tid) < 0)
+ goto done;
+ if (H5Tclose(set_tid) < 0)
+ goto done;
+ if (H5Tclose(esc_sub2_tid) < 0)
+ goto done;
+ if (H5Tclose(esc_sub4_tid) < 0)
+ goto done;
+ if (H5Tclose(esc_set_tid) < 0)
+ goto done;
- if(H5Pclose(fapl) < 0) goto done;
- if(H5Fclose(fid) < 0) goto done;
+ if (H5Pclose(fapl) < 0)
+ goto done;
+ if (H5Fclose(fid) < 0)
+ goto done;
exit(EXIT_SUCCESS);
done:
H5E_BEGIN_TRY
- H5Tclose(sub22_tid);
- H5Tclose(sub2_tid);
- H5Tclose(sub4_tid);
- H5Tclose(set_tid);
- H5Tclose(esc_sub2_tid);
- H5Tclose(esc_sub4_tid);
- H5Tclose(esc_set_tid);
-
- H5Dclose(null_did);
- H5Sclose(null_sid);
- H5Dclose(scalar_did);
- H5Sclose(scalar_sid);
-
- H5Pclose(fapl);
- H5Fclose(fid);
+ H5Tclose(sub22_tid);
+ H5Tclose(sub2_tid);
+ H5Tclose(sub4_tid);
+ H5Tclose(set_tid);
+ H5Tclose(esc_sub2_tid);
+ H5Tclose(esc_sub4_tid);
+ H5Tclose(esc_set_tid);
+
+ H5Dclose(null_did);
+ H5Sclose(null_sid);
+ H5Dclose(scalar_did);
+ H5Sclose(scalar_sid);
+
+ H5Pclose(fapl);
+ H5Fclose(fid);
H5E_END_TRY
exit(EXIT_FAILURE);
} /* main() */
-
diff --git a/hl/test/h5hltest.h b/hl/test/h5hltest.h
index 6cf5062..4ccdd78 100644
--- a/hl/test/h5hltest.h
+++ b/hl/test/h5hltest.h
@@ -28,13 +28,24 @@
#include "H5HLprivate2.h"
/* Macros used in HL tests */
-#define HL_TESTING2(WHAT) {HDprintf("Testing %-62s", WHAT); HDfflush(stdout);}
-#define HL_TESTING3(WHAT) {HDprintf("Testing %-62s", WHAT); HDfflush(stdout);}
+#define HL_TESTING2(WHAT) \
+ { \
+ HDprintf("Testing %-62s", WHAT); \
+ HDfflush(stdout); \
+ }
+#define HL_TESTING3(WHAT) \
+ { \
+ HDprintf("Testing %-62s", WHAT); \
+ HDfflush(stdout); \
+ }
/* Implements verbose 'assert' with 'goto error' exit */
-#define VERIFY(condition, string) do { if (!(condition)) FAIL_PUTS_ERROR(string) } while(0)
+#define VERIFY(condition, string) \
+ do { \
+ if (!(condition)) \
+ FAIL_PUTS_ERROR(string) \
+ } while (0)
int test_packet_table_with_varlen(void);
#endif /* _H5HLTEST_H */
-
diff --git a/hl/test/pal_rgb.h b/hl/test/pal_rgb.h
index 488ee42..137d5d9 100644
--- a/hl/test/pal_rgb.h
+++ b/hl/test/pal_rgb.h
@@ -271,10 +271,3 @@ const unsigned char pal_rgb[256*3] = {
127,0,0
};
/* clang-format on */
-
-
-
-
-
-
-
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c
index 5550dd1..9e56ff0 100644
--- a/hl/test/test_ds.c
+++ b/hl/test/test_ds.c
@@ -27,27 +27,43 @@ static herr_t op_stop(hid_t did, unsigned dim, hid_t dsid, void *visitor_data);
/* prototypes */
static hid_t create_test_file(const char *fileext);
static hid_t open_test_file(const char *fileext);
-herr_t create_char_dataset(hid_t fid, const char *dsidx, int fulldims);
-herr_t create_short_dataset(hid_t fid, const char *dsidx, int fulldims);
-herr_t create_int_dataset(hid_t fid, const char *dsidx, int fulldims);
-herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int fulldims);
-herr_t create_float_dataset(hid_t fid, const char *dsidx, int fulldims);
-herr_t create_DS1_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf);
-herr_t create_DS2_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf, char *s2_wbuf);
-herr_t create_DS3_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf, char *s2_wbuf, char *s3_wbuf);
-herr_t create_DS1_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf);
-herr_t create_DS2_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf, short *s2_wbuf);
-herr_t create_DS3_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf, short *s2_wbuf, short *s3_wbuf);
-herr_t create_DS1_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf);
-herr_t create_DS2_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf, int *s2_wbuf);
-herr_t create_DS3_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf, int *s2_wbuf, int *s3_wbuf);
-herr_t create_DS1_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf);
-herr_t create_DS2_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf);
-herr_t create_DS3_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf, long *s3_wbuf);
-herr_t create_DS4_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf, long *s3_wbuf, long *s4_wbuf);
-herr_t create_DS1_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf);
-herr_t create_DS2_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf, float *s2_wbuf);
-herr_t create_DS3_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf, float *s2_wbuf, float *s3_wbuf);
+herr_t create_char_dataset(hid_t fid, const char *dsidx, int fulldims);
+herr_t create_short_dataset(hid_t fid, const char *dsidx, int fulldims);
+herr_t create_int_dataset(hid_t fid, const char *dsidx, int fulldims);
+herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int fulldims);
+herr_t create_float_dataset(hid_t fid, const char *dsidx, int fulldims);
+herr_t create_DS1_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf,
+ char *s1_wbuf);
+herr_t create_DS2_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf,
+ char *s1_wbuf, char *s2_wbuf);
+herr_t create_DS3_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf,
+ char *s1_wbuf, char *s2_wbuf, char *s3_wbuf);
+herr_t create_DS1_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf,
+ short *s1_wbuf);
+herr_t create_DS2_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf,
+ short *s1_wbuf, short *s2_wbuf);
+herr_t create_DS3_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf,
+ short *s1_wbuf, short *s2_wbuf, short *s3_wbuf);
+herr_t create_DS1_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf,
+ int *s1_wbuf);
+herr_t create_DS2_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf,
+ int *s1_wbuf, int *s2_wbuf);
+herr_t create_DS3_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf,
+ int *s1_wbuf, int *s2_wbuf, int *s3_wbuf);
+herr_t create_DS1_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf,
+ long *s1_wbuf);
+herr_t create_DS2_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf,
+ long *s1_wbuf, long *s2_wbuf);
+herr_t create_DS3_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf,
+ long *s1_wbuf, long *s2_wbuf, long *s3_wbuf);
+herr_t create_DS4_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf,
+ long *s1_wbuf, long *s2_wbuf, long *s3_wbuf, long *s4_wbuf);
+herr_t create_DS1_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf,
+ float *s1_wbuf);
+herr_t create_DS2_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf,
+ float *s1_wbuf, float *s2_wbuf);
+herr_t create_DS3_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf,
+ float *s1_wbuf, float *s2_wbuf, float *s3_wbuf);
herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx);
herr_t test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx);
herr_t test_set_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx);
@@ -76,64 +92,64 @@ static int test_rank(void);
static int test_types(void);
static int test_iterators(void);
static int test_data(void);
-static int read_data( const char* fname, int ndims, hsize_t *dims, float **buf );
+static int read_data(const char *fname, int ndims, hsize_t *dims, float **buf);
static int test_attach_detach(void);
-#define RANK1 1
-#define RANK 2
-#define DIM_DATA 12
-#define DIM1_SIZE 3
-#define DIM2_SIZE 4
-#define DIM3_SIZE 12
-#define DIM4_SIZE 2
-#define DIM0 0
-#define DIM1 1
-#define DIM2 2
-#define DIM3 3
-
-#define DATASET_NAME "dset_"
-#define DS_1_NAME "ds_1_"
-#define DS_11_NAME "ds_11_"
-#define DS_2_NAME "ds_2_"
-#define DS_21_NAME "ds_21_"
-#define DS_22_NAME "ds_22_"
-#define DS_3_NAME "ds_3_"
-#define DS_31_NAME "ds_31_"
-#define DS_32_NAME "ds_32_"
-#define DS_33_NAME "ds_33_"
-#define DS_4_NAME "ds_4_"
-#define DS_41_NAME "ds_41_"
-#define DS_42_NAME "ds_42_"
-#define DS_43_NAME "ds_43_"
-#define DS_44_NAME "ds_44_"
-
-#define SCALE_1_NAME "scalename_1_"
-#define SCALE_11_NAME "scalename_11_"
-#define SCALE_2_NAME "scalename_2_"
-#define SCALE_21_NAME "scalename_21_"
-#define SCALE_22_NAME "scalename_22_"
-#define SCALE_3_NAME "scalename_3_"
-#define SCALE_31_NAME "scalename_31_"
-#define SCALE_32_NAME "scalename_32_"
-#define SCALE_33_NAME "scalename_33_"
-#define SCALE_4_NAME "scalename_4_"
-
-#define DIM0_LABEL "Latitude"
-#define DIM1_LABEL "Longitude"
-
-#define FOREIGN_FILE1 "test_ds_le.h5"
-#define FOREIGN_FILE2 "test_ds_be.h5"
-#define FILENAME "test_ds"
-#define FILEEXT ".h5"
-
-#define FILE1 "test_ds3.h5"
-#define FILE2 "test_ds4.h5"
-#define FILE3 "test_ds5.h5"
-#define FILE4 "test_ds6.h5"
-#define FILE5 "test_ds7.h5"
-#define FILE6 "test_ds8.h5"
-#define FILE7 "test_ds9.h5"
-#define FILE8 "test_ds10.h5"
+#define RANK1 1
+#define RANK 2
+#define DIM_DATA 12
+#define DIM1_SIZE 3
+#define DIM2_SIZE 4
+#define DIM3_SIZE 12
+#define DIM4_SIZE 2
+#define DIM0 0
+#define DIM1 1
+#define DIM2 2
+#define DIM3 3
+
+#define DATASET_NAME "dset_"
+#define DS_1_NAME "ds_1_"
+#define DS_11_NAME "ds_11_"
+#define DS_2_NAME "ds_2_"
+#define DS_21_NAME "ds_21_"
+#define DS_22_NAME "ds_22_"
+#define DS_3_NAME "ds_3_"
+#define DS_31_NAME "ds_31_"
+#define DS_32_NAME "ds_32_"
+#define DS_33_NAME "ds_33_"
+#define DS_4_NAME "ds_4_"
+#define DS_41_NAME "ds_41_"
+#define DS_42_NAME "ds_42_"
+#define DS_43_NAME "ds_43_"
+#define DS_44_NAME "ds_44_"
+
+#define SCALE_1_NAME "scalename_1_"
+#define SCALE_11_NAME "scalename_11_"
+#define SCALE_2_NAME "scalename_2_"
+#define SCALE_21_NAME "scalename_21_"
+#define SCALE_22_NAME "scalename_22_"
+#define SCALE_3_NAME "scalename_3_"
+#define SCALE_31_NAME "scalename_31_"
+#define SCALE_32_NAME "scalename_32_"
+#define SCALE_33_NAME "scalename_33_"
+#define SCALE_4_NAME "scalename_4_"
+
+#define DIM0_LABEL "Latitude"
+#define DIM1_LABEL "Longitude"
+
+#define FOREIGN_FILE1 "test_ds_le.h5"
+#define FOREIGN_FILE2 "test_ds_be.h5"
+#define FILENAME "test_ds"
+#define FILEEXT ".h5"
+
+#define FILE1 "test_ds3.h5"
+#define FILE2 "test_ds4.h5"
+#define FILE3 "test_ds5.h5"
+#define FILE4 "test_ds6.h5"
+#define FILE5 "test_ds7.h5"
+#define FILE6 "test_ds8.h5"
+#define FILE7 "test_ds9.h5"
+#define FILE8 "test_ds10.h5"
#define DIMENSION_LIST "DIMENSION_LIST"
#define REFERENCE_LIST "REFERENCE_LIST"
@@ -142,57 +158,57 @@ static int test_attach_detach(void);
* the main program
*-------------------------------------------------------------------------
*/
-int main(void)
+int
+main(void)
{
- int nerrors=0;
+ int nerrors = 0;
/* create file to be used in following tests */
- if(create_test_file("1") < 0) {
+ if (create_test_file("1") < 0) {
nerrors = 1;
goto error;
}
- nerrors += test_char_attachscales("1") < 0 ? 1 : 0;
- nerrors += test_short_attachscales("1") < 0 ? 1 : 0;
- nerrors += test_int_attachscales("1") < 0 ? 1 : 0;
- nerrors += test_long_attachscales("1") < 0 ? 1 : 0;
- nerrors += test_float_attachscales("1") < 0 ? 1 : 0;
- nerrors += test_char_scalenames("1") < 0 ? 1 : 0;
- nerrors += test_short_scalenames("1") < 0 ? 1 : 0;
- nerrors += test_int_scalenames("1") < 0 ? 1 : 0;
- nerrors += test_long_scalenames("1") < 0 ? 1 : 0;
- nerrors += test_float_scalenames("1") < 0 ? 1 : 0;
- nerrors += test_numberofscales("1") < 0 ? 1 : 0;
- if(create_test_file("2") < 0) {
+ nerrors += test_char_attachscales("1") < 0 ? 1 : 0;
+ nerrors += test_short_attachscales("1") < 0 ? 1 : 0;
+ nerrors += test_int_attachscales("1") < 0 ? 1 : 0;
+ nerrors += test_long_attachscales("1") < 0 ? 1 : 0;
+ nerrors += test_float_attachscales("1") < 0 ? 1 : 0;
+ nerrors += test_char_scalenames("1") < 0 ? 1 : 0;
+ nerrors += test_short_scalenames("1") < 0 ? 1 : 0;
+ nerrors += test_int_scalenames("1") < 0 ? 1 : 0;
+ nerrors += test_long_scalenames("1") < 0 ? 1 : 0;
+ nerrors += test_float_scalenames("1") < 0 ? 1 : 0;
+ nerrors += test_numberofscales("1") < 0 ? 1 : 0;
+ if (create_test_file("2") < 0) {
nerrors = 1;
goto error;
}
- nerrors += test_long_attachscales("2") < 0 ? 1 : 0;
- nerrors += test_duplicatelong_attachscales("2") < 0 ? 1 : 0;
- nerrors += test_samelong_scalenames("2") < 0 ? 1 : 0;
- nerrors += test_foreign_scaleattached(FOREIGN_FILE1) < 0 ? 1 : 0;
- nerrors += test_foreign_scaleattached(FOREIGN_FILE2) < 0 ? 1 : 0;
- nerrors += test_detachscales() < 0 ? 1 : 0;
- nerrors += test_attach_detach() < 0 ? 1 : 0;
-/* the following tests have not been rewritten to match those above */
- nerrors += test_simple() < 0 ?1:0;
- nerrors += test_errors() < 0 ?1:0;
- nerrors += test_errors2() < 0 ?1:0;
- nerrors += test_rank() < 0 ?1:0;
- nerrors += test_iterators() < 0 ?1:0;
- nerrors += test_types() < 0 ?1:0;
- nerrors += test_data() < 0 ?1:0;
-
-
- if(nerrors) goto error;
+ nerrors += test_long_attachscales("2") < 0 ? 1 : 0;
+ nerrors += test_duplicatelong_attachscales("2") < 0 ? 1 : 0;
+ nerrors += test_samelong_scalenames("2") < 0 ? 1 : 0;
+ nerrors += test_foreign_scaleattached(FOREIGN_FILE1) < 0 ? 1 : 0;
+ nerrors += test_foreign_scaleattached(FOREIGN_FILE2) < 0 ? 1 : 0;
+ nerrors += test_detachscales() < 0 ? 1 : 0;
+ nerrors += test_attach_detach() < 0 ? 1 : 0;
+ /* the following tests have not been rewritten to match those above */
+ nerrors += test_simple() < 0 ? 1 : 0;
+ nerrors += test_errors() < 0 ? 1 : 0;
+ nerrors += test_errors2() < 0 ? 1 : 0;
+ nerrors += test_rank() < 0 ? 1 : 0;
+ nerrors += test_iterators() < 0 ? 1 : 0;
+ nerrors += test_types() < 0 ? 1 : 0;
+ nerrors += test_data() < 0 ? 1 : 0;
+
+ if (nerrors)
+ goto error;
HDprintf("All dimension scales tests passed.\n");
return 0;
error:
- HDprintf("***** %d DIMENSION SCALES TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d DIMENSION SCALES TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
return 1;
}
-
/*-------------------------------------------------------------------------
* DS API test
*
@@ -211,7 +227,8 @@ error:
*-------------------------------------------------------------------------
*/
-static hid_t create_test_file(const char *fileext)
+static hid_t
+create_test_file(const char *fileext)
{
char filename[65];
@@ -220,7 +237,8 @@ static hid_t create_test_file(const char *fileext)
return H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
}
-static hid_t open_test_file(const char *fileext)
+static hid_t
+open_test_file(const char *fileext)
{
char filename[65];
@@ -233,261 +251,270 @@ static hid_t open_test_file(const char *fileext)
* create "data" dataset
*-------------------------------------------------------------------------
*/
-herr_t create_char_dataset(hid_t fid, const char *dsidx, int fulldims)
+herr_t
+create_char_dataset(hid_t fid, const char *dsidx, int fulldims)
{
- int rank = 3;
- int rankds = 1;
- hsize_t dims[3] = {DIM1_SIZE,DIM2_SIZE,DIM3_SIZE};
- char buf[DIM1_SIZE*DIM2_SIZE*DIM3_SIZE];
- hsize_t s1_dim[1] = {DIM1_SIZE};
- hsize_t s2_dim[1] = {DIM2_SIZE};
- hsize_t s3_dim[1] = {DIM3_SIZE};
- char s1_wbuf[DIM1_SIZE] = {1,2,3};
- char s11_wbuf[DIM1_SIZE] = {10,20,30};
- char s2_wbuf[DIM2_SIZE] = {10,20,30,40};
- char s21_wbuf[DIM2_SIZE] = {1,2,3,4};
- char s22_wbuf[DIM2_SIZE] = {5,10,50,100};
- char s3_wbuf[DIM3_SIZE] = {10,10,10,20,20,20,30,30,30,40,40,40};
- char s31_wbuf[DIM3_SIZE] = {1,1,1,2,2,2,3,3,3,4,4,4};
- char s32_wbuf[DIM3_SIZE] = {5,5,5,10,10,10,50,50,50,100,100,100};
- char s33_wbuf[DIM3_SIZE] = {6,6,6,12,12,12,53,53,53,120,120,120};
+ int rank = 3;
+ int rankds = 1;
+ hsize_t dims[3] = {DIM1_SIZE, DIM2_SIZE, DIM3_SIZE};
+ char buf[DIM1_SIZE * DIM2_SIZE * DIM3_SIZE];
+ hsize_t s1_dim[1] = {DIM1_SIZE};
+ hsize_t s2_dim[1] = {DIM2_SIZE};
+ hsize_t s3_dim[1] = {DIM3_SIZE};
+ char s1_wbuf[DIM1_SIZE] = {1, 2, 3};
+ char s11_wbuf[DIM1_SIZE] = {10, 20, 30};
+ char s2_wbuf[DIM2_SIZE] = {10, 20, 30, 40};
+ char s21_wbuf[DIM2_SIZE] = {1, 2, 3, 4};
+ char s22_wbuf[DIM2_SIZE] = {5, 10, 50, 100};
+ char s3_wbuf[DIM3_SIZE] = {10, 10, 10, 20, 20, 20, 30, 30, 30, 40, 40, 40};
+ char s31_wbuf[DIM3_SIZE] = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4};
+ char s32_wbuf[DIM3_SIZE] = {5, 5, 5, 10, 10, 10, 50, 50, 50, 100, 100, 100};
+ char s33_wbuf[DIM3_SIZE] = {6, 6, 6, 12, 12, 12, 53, 53, 53, 120, 120, 120};
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DATASET_NAME, dsidx);
/* make a dataset */
- if(H5LTmake_dataset_char(fid, name, rank, dims, buf) >= 0) {
- if(fulldims==0) {
+ if (H5LTmake_dataset_char(fid, name, rank, dims, buf) >= 0) {
+ if (fulldims == 0) {
/* make a DS dataset for the first dimension */
- if(create_DS1_char_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
- return FAIL;
+ if (create_DS1_char_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
+ return FAIL;
/* make a DS dataset for the second dimension */
- if(create_DS2_char_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
- return FAIL;
+ if (create_DS2_char_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
+ return FAIL;
/* make a DS dataset for the third dimension */
- if(create_DS3_char_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, NULL, NULL, NULL) < 0)
- return FAIL;
+ if (create_DS3_char_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, NULL, NULL, NULL) < 0)
+ return FAIL;
}
else {
- if(create_DS1_char_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
- return FAIL;
+ if (create_DS1_char_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
+ return FAIL;
- if(create_DS2_char_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
- return FAIL;
+ if (create_DS2_char_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
+ return FAIL;
- if(create_DS3_char_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, s31_wbuf, s32_wbuf, s33_wbuf) < 0)
- return FAIL;
+ if (create_DS3_char_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, s31_wbuf, s32_wbuf, s33_wbuf) <
+ 0)
+ return FAIL;
}
- }
- else
- return FAIL;
+ }
+ else
+ return FAIL;
return SUCCEED;
}
-herr_t create_short_dataset(hid_t fid, const char *dsidx, int fulldims)
+herr_t
+create_short_dataset(hid_t fid, const char *dsidx, int fulldims)
{
- int rank = 3;
- int rankds = 1;
- hsize_t dims[3] = {DIM1_SIZE,DIM2_SIZE,DIM3_SIZE};
- short buf[DIM1_SIZE*DIM2_SIZE*DIM3_SIZE];
- hsize_t s1_dim[1] = {DIM1_SIZE};
- hsize_t s2_dim[1] = {DIM2_SIZE};
- hsize_t s3_dim[1] = {DIM3_SIZE};
- short s1_wbuf[DIM1_SIZE] = {10,20,30};
- short s11_wbuf[DIM1_SIZE] = {10,100,300};
- short s2_wbuf[DIM2_SIZE] = {100,200,300,400};
- short s21_wbuf[DIM2_SIZE] = {10,20,30,40};
- short s22_wbuf[DIM2_SIZE] = {5,10,50,300};
- short s3_wbuf[DIM3_SIZE] = {10,10,10,20,20,20,30,30,30,40,40,40};
- short s31_wbuf[DIM3_SIZE] = {1,1,1,2,2,2,3,3,3,4,4,4};
- short s32_wbuf[DIM3_SIZE] = {5,5,5,10,10,10,50,50,50,100,100,100};
- short s33_wbuf[DIM3_SIZE] = {6,6,6,12,12,12,53,53,53,140,140,140};
+ int rank = 3;
+ int rankds = 1;
+ hsize_t dims[3] = {DIM1_SIZE, DIM2_SIZE, DIM3_SIZE};
+ short buf[DIM1_SIZE * DIM2_SIZE * DIM3_SIZE];
+ hsize_t s1_dim[1] = {DIM1_SIZE};
+ hsize_t s2_dim[1] = {DIM2_SIZE};
+ hsize_t s3_dim[1] = {DIM3_SIZE};
+ short s1_wbuf[DIM1_SIZE] = {10, 20, 30};
+ short s11_wbuf[DIM1_SIZE] = {10, 100, 300};
+ short s2_wbuf[DIM2_SIZE] = {100, 200, 300, 400};
+ short s21_wbuf[DIM2_SIZE] = {10, 20, 30, 40};
+ short s22_wbuf[DIM2_SIZE] = {5, 10, 50, 300};
+ short s3_wbuf[DIM3_SIZE] = {10, 10, 10, 20, 20, 20, 30, 30, 30, 40, 40, 40};
+ short s31_wbuf[DIM3_SIZE] = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4};
+ short s32_wbuf[DIM3_SIZE] = {5, 5, 5, 10, 10, 10, 50, 50, 50, 100, 100, 100};
+ short s33_wbuf[DIM3_SIZE] = {6, 6, 6, 12, 12, 12, 53, 53, 53, 140, 140, 140};
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DATASET_NAME, dsidx);
/* make a dataset */
- if(H5LTmake_dataset_short(fid, name, rank, dims, buf) >= 0) {
- if(fulldims==0) {
+ if (H5LTmake_dataset_short(fid, name, rank, dims, buf) >= 0) {
+ if (fulldims == 0) {
/* make a DS dataset for the first dimension */
- if(create_DS1_short_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
- return FAIL;
+ if (create_DS1_short_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
+ return FAIL;
/* make a DS dataset for the second dimension */
- if(create_DS2_short_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
- return FAIL;
+ if (create_DS2_short_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
+ return FAIL;
/* make a DS dataset for the third dimension */
- if(create_DS3_short_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, NULL, NULL, NULL) < 0)
- return FAIL;
+ if (create_DS3_short_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, NULL, NULL, NULL) < 0)
+ return FAIL;
}
else {
- if(create_DS1_short_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
- return FAIL;
+ if (create_DS1_short_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
+ return FAIL;
- if(create_DS2_short_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
- return FAIL;
+ if (create_DS2_short_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
+ return FAIL;
- if(create_DS3_short_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, s31_wbuf, s32_wbuf, s33_wbuf) < 0)
- return FAIL;
+ if (create_DS3_short_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, s31_wbuf, s32_wbuf, s33_wbuf) <
+ 0)
+ return FAIL;
}
- }
- else
- return FAIL;
+ }
+ else
+ return FAIL;
return SUCCEED;
}
-herr_t create_int_dataset(hid_t fid, const char *dsidx, int fulldims)
+herr_t
+create_int_dataset(hid_t fid, const char *dsidx, int fulldims)
{
- int rank = RANK;
- int rankds = 1;
- hsize_t dims[RANK] = {DIM1_SIZE,DIM2_SIZE};
- int buf[DIM1_SIZE*DIM2_SIZE];
- hsize_t s1_dim[1] = {DIM1_SIZE};
- hsize_t s2_dim[1] = {DIM2_SIZE};
- int s1_wbuf[DIM1_SIZE] = {10,20,30};
- int s11_wbuf[DIM1_SIZE] = {10,100,300};
- int s2_wbuf[DIM2_SIZE] = {100,200,300,400};
- int s21_wbuf[DIM2_SIZE] = {10,20,30,40};
- int s22_wbuf[DIM2_SIZE] = {5,10,50,300};
+ int rank = RANK;
+ int rankds = 1;
+ hsize_t dims[RANK] = {DIM1_SIZE, DIM2_SIZE};
+ int buf[DIM1_SIZE * DIM2_SIZE];
+ hsize_t s1_dim[1] = {DIM1_SIZE};
+ hsize_t s2_dim[1] = {DIM2_SIZE};
+ int s1_wbuf[DIM1_SIZE] = {10, 20, 30};
+ int s11_wbuf[DIM1_SIZE] = {10, 100, 300};
+ int s2_wbuf[DIM2_SIZE] = {100, 200, 300, 400};
+ int s21_wbuf[DIM2_SIZE] = {10, 20, 30, 40};
+ int s22_wbuf[DIM2_SIZE] = {5, 10, 50, 300};
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DATASET_NAME, dsidx);
/* make a dataset */
- if(H5LTmake_dataset_int(fid, name, rank, dims, buf) >= 0) {
- if(fulldims==0) {
+ if (H5LTmake_dataset_int(fid, name, rank, dims, buf) >= 0) {
+ if (fulldims == 0) {
/* make a DS dataset for the first dimension */
- if(create_DS1_int_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
- return FAIL;
+ if (create_DS1_int_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
+ return FAIL;
/* make a DS dataset for the second dimension */
- if(create_DS2_int_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
- return FAIL;
+ if (create_DS2_int_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
+ return FAIL;
}
else {
- if(create_DS1_int_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
- return FAIL;
+ if (create_DS1_int_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
+ return FAIL;
- if(create_DS2_int_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
- return FAIL;
+ if (create_DS2_int_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
+ return FAIL;
}
- }
- else
- return FAIL;
+ }
+ else
+ return FAIL;
return SUCCEED;
}
-herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int fulldims)
+herr_t
+create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int fulldims)
{
- int rank = 4;
- int rankds = 1;
- hsize_t dims[4] = {DIM1_SIZE,DIM2_SIZE,DIM3_SIZE,DIM4_SIZE};
- long *buf;
- hsize_t s1_dim[1] = {DIM1_SIZE};
- hsize_t s2_dim[1] = {DIM2_SIZE};
- hsize_t s3_dim[1] = {DIM3_SIZE};
- hsize_t s4_dim[1] = {DIM4_SIZE};
- long s1_wbuf[DIM1_SIZE] = {10,20,30};
- long s11_wbuf[DIM1_SIZE] = {10,100,300};
- long s2_wbuf[DIM2_SIZE] = {100,200,300,400};
- long s21_wbuf[DIM2_SIZE] = {10,20,30,40};
- long s22_wbuf[DIM2_SIZE] = {5,10,50,300};
- long s3_wbuf[DIM3_SIZE] = {10,10,10,20,20,20,30,30,30,40,40,40};
- long s31_wbuf[DIM3_SIZE] = {1,1,1,2,2,2,3,3,3,4,4,4};
- long s32_wbuf[DIM3_SIZE] = {5,5,5,10,10,10,50,50,50,100,100,100};
- long s33_wbuf[DIM3_SIZE] = {6,6,6,12,12,12,53,53,53,140,140,140};
- long s4_wbuf[DIM4_SIZE] = {18,18};
- long s41_wbuf[DIM4_SIZE] = {8,8};
- long s42_wbuf[DIM4_SIZE] = {80,80};
- long s43_wbuf[DIM4_SIZE] = {180,180};
- long s44_wbuf[DIM4_SIZE] = {280,280};
+ int rank = 4;
+ int rankds = 1;
+ hsize_t dims[4] = {DIM1_SIZE, DIM2_SIZE, DIM3_SIZE, DIM4_SIZE};
+ long * buf;
+ hsize_t s1_dim[1] = {DIM1_SIZE};
+ hsize_t s2_dim[1] = {DIM2_SIZE};
+ hsize_t s3_dim[1] = {DIM3_SIZE};
+ hsize_t s4_dim[1] = {DIM4_SIZE};
+ long s1_wbuf[DIM1_SIZE] = {10, 20, 30};
+ long s11_wbuf[DIM1_SIZE] = {10, 100, 300};
+ long s2_wbuf[DIM2_SIZE] = {100, 200, 300, 400};
+ long s21_wbuf[DIM2_SIZE] = {10, 20, 30, 40};
+ long s22_wbuf[DIM2_SIZE] = {5, 10, 50, 300};
+ long s3_wbuf[DIM3_SIZE] = {10, 10, 10, 20, 20, 20, 30, 30, 30, 40, 40, 40};
+ long s31_wbuf[DIM3_SIZE] = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4};
+ long s32_wbuf[DIM3_SIZE] = {5, 5, 5, 10, 10, 10, 50, 50, 50, 100, 100, 100};
+ long s33_wbuf[DIM3_SIZE] = {6, 6, 6, 12, 12, 12, 53, 53, 53, 140, 140, 140};
+ long s4_wbuf[DIM4_SIZE] = {18, 18};
+ long s41_wbuf[DIM4_SIZE] = {8, 8};
+ long s42_wbuf[DIM4_SIZE] = {80, 80};
+ long s43_wbuf[DIM4_SIZE] = {180, 180};
+ long s44_wbuf[DIM4_SIZE] = {280, 280};
/* Allocate buffer */
- if(NULL == (buf = (long *)HDmalloc(sizeof(long) * DIM1_SIZE * DIM2_SIZE * DIM3_SIZE * DIM4_SIZE)))
- return FAIL;
+ if (NULL == (buf = (long *)HDmalloc(sizeof(long) * DIM1_SIZE * DIM2_SIZE * DIM3_SIZE * DIM4_SIZE)))
+ return FAIL;
/* make a dataset */
- if(H5LTmake_dataset_long(fid, dsname, rank, dims, buf) >= 0) {
- if(fulldims==0) {
+ if (H5LTmake_dataset_long(fid, dsname, rank, dims, buf) >= 0) {
+ if (fulldims == 0) {
/* make a DS dataset for the first dimension */
- if(create_DS1_long_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
- return FAIL;
+ if (create_DS1_long_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
+ return FAIL;
/* make a DS dataset for the second dimension */
- if(create_DS2_long_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
- return FAIL;
+ if (create_DS2_long_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
+ return FAIL;
/* make a DS dataset for the third dimension */
- if(create_DS3_long_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, NULL, NULL, NULL) < 0)
- return FAIL;
+ if (create_DS3_long_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, NULL, NULL, NULL) < 0)
+ return FAIL;
/* make a DS dataset for the fourth dimension */
- if(create_DS4_long_datasets(fid, dsidx, rankds, s4_dim, s4_wbuf, NULL, NULL, NULL, NULL) < 0)
- return FAIL;
+ if (create_DS4_long_datasets(fid, dsidx, rankds, s4_dim, s4_wbuf, NULL, NULL, NULL, NULL) < 0)
+ return FAIL;
}
else {
- if(create_DS1_long_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
- return FAIL;
+ if (create_DS1_long_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
+ return FAIL;
- if(create_DS2_long_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
- return FAIL;
+ if (create_DS2_long_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
+ return FAIL;
- if(create_DS3_long_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, s31_wbuf, s32_wbuf, s33_wbuf) < 0)
- return FAIL;
+ if (create_DS3_long_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, s31_wbuf, s32_wbuf, s33_wbuf) <
+ 0)
+ return FAIL;
- if(create_DS4_long_datasets(fid, dsidx, rankds, s4_dim, s4_wbuf, s41_wbuf, s42_wbuf, s43_wbuf, s44_wbuf) < 0)
- return FAIL;
+ if (create_DS4_long_datasets(fid, dsidx, rankds, s4_dim, s4_wbuf, s41_wbuf, s42_wbuf, s43_wbuf,
+ s44_wbuf) < 0)
+ return FAIL;
}
- }
- else
- return FAIL;
+ }
+ else
+ return FAIL;
HDfree(buf);
return SUCCEED;
}
-herr_t create_float_dataset(hid_t fid, const char *dsidx, int fulldims)
+herr_t
+create_float_dataset(hid_t fid, const char *dsidx, int fulldims)
{
- int rank = RANK;
- int rankds = 1;
- hsize_t dims[RANK] = {DIM1_SIZE,DIM2_SIZE};
- float buf[DIM1_SIZE*DIM2_SIZE];
- hsize_t s1_dim[1] = {DIM1_SIZE};
- hsize_t s2_dim[1] = {DIM2_SIZE};
- float s1_wbuf[DIM1_SIZE] = {10,20,30};
- float s11_wbuf[DIM1_SIZE] = {10,100,300};
- float s2_wbuf[DIM2_SIZE] = {100,200,300,400};
- float s21_wbuf[DIM2_SIZE] = {10,20,30,40};
- float s22_wbuf[DIM2_SIZE] = {5,10,50,300};
+ int rank = RANK;
+ int rankds = 1;
+ hsize_t dims[RANK] = {DIM1_SIZE, DIM2_SIZE};
+ float buf[DIM1_SIZE * DIM2_SIZE];
+ hsize_t s1_dim[1] = {DIM1_SIZE};
+ hsize_t s2_dim[1] = {DIM2_SIZE};
+ float s1_wbuf[DIM1_SIZE] = {10, 20, 30};
+ float s11_wbuf[DIM1_SIZE] = {10, 100, 300};
+ float s2_wbuf[DIM2_SIZE] = {100, 200, 300, 400};
+ float s21_wbuf[DIM2_SIZE] = {10, 20, 30, 40};
+ float s22_wbuf[DIM2_SIZE] = {5, 10, 50, 300};
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DATASET_NAME, dsidx);
/* make a dataset */
- if(H5LTmake_dataset_float(fid, name, rank, dims, buf) >= 0) {
- if(fulldims==0) {
+ if (H5LTmake_dataset_float(fid, name, rank, dims, buf) >= 0) {
+ if (fulldims == 0) {
/* make a DS dataset for the first dimension */
- if(create_DS1_float_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
- return FAIL;
+ if (create_DS1_float_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
+ return FAIL;
/* make a DS dataset for the second dimension */
- if(create_DS2_float_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
- return FAIL;
+ if (create_DS2_float_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
+ return FAIL;
}
else {
- if(create_DS1_float_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
- return FAIL;
+ if (create_DS1_float_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
+ return FAIL;
- if(create_DS2_float_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
- return FAIL;
+ if (create_DS2_float_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
+ return FAIL;
}
- }
- else
- return FAIL;
+ }
+ else
+ return FAIL;
return SUCCEED;
}
@@ -495,21 +522,23 @@ herr_t create_float_dataset(hid_t fid, const char *dsidx, int fulldims)
* create 2 dimension scales datasets for first dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS1_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf)
+herr_t
+create_DS1_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf,
+ char *s1_wbuf)
{
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DS_1_NAME, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s_wbuf) < 0)
+ if (H5LTmake_dataset_char(fid, name, rankds, s_dim, s_wbuf) < 0)
return FAIL;
- if(s1_wbuf != NULL) {
+ if (s1_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_11_NAME, dsidx);
/* make a DS dataset with an alternate scale for the first dimension */
- if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_char(fid, name, rankds, s_dim, s1_wbuf) < 0)
return FAIL;
}
@@ -520,29 +549,31 @@ herr_t create_DS1_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_
* create 3 dimension scales datasets for second dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS2_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf, char *s2_wbuf)
+herr_t
+create_DS2_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf,
+ char *s1_wbuf, char *s2_wbuf)
{
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DS_2_NAME, dsidx);
/* make a DS dataset for the second dimension */
- if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s_wbuf) < 0)
+ if (H5LTmake_dataset_char(fid, name, rankds, s_dim, s_wbuf) < 0)
return FAIL;
- if(s1_wbuf != NULL) {
+ if (s1_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_21_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_char(fid, name, rankds, s_dim, s1_wbuf) < 0)
return FAIL;
}
- if(s2_wbuf != NULL) {
+ if (s2_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_22_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ if (H5LTmake_dataset_char(fid, name, rankds, s_dim, s2_wbuf) < 0)
return FAIL;
}
@@ -553,37 +584,39 @@ herr_t create_DS2_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_
* create 1 dimension scales datasets for third dimension of dataset
*-------------------------------------------------------------------------
*/
-herr_t create_DS3_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf, char *s1_wbuf, char *s2_wbuf, char *s3_wbuf)
+herr_t
+create_DS3_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, char *s_wbuf,
+ char *s1_wbuf, char *s2_wbuf, char *s3_wbuf)
{
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DS_3_NAME, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s_wbuf) < 0)
+ if (H5LTmake_dataset_char(fid, name, rankds, s_dim, s_wbuf) < 0)
return FAIL;
- if(s1_wbuf != NULL) {
+ if (s1_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_31_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_char(fid, name, rankds, s_dim, s1_wbuf) < 0)
return FAIL;
}
- if(s2_wbuf != NULL) {
+ if (s2_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_32_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ if (H5LTmake_dataset_char(fid, name, rankds, s_dim, s2_wbuf) < 0)
return FAIL;
}
- if(s3_wbuf != NULL) {
+ if (s3_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_33_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s3_wbuf) < 0)
+ if (H5LTmake_dataset_char(fid, name, rankds, s_dim, s3_wbuf) < 0)
return FAIL;
}
@@ -594,21 +627,23 @@ herr_t create_DS3_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_
* create 2 dimension scales datasets for first dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS1_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf)
+herr_t
+create_DS1_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf,
+ short *s1_wbuf)
{
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DS_1_NAME, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s_wbuf) < 0)
+ if (H5LTmake_dataset_short(fid, name, rankds, s_dim, s_wbuf) < 0)
return FAIL;
- if(s1_wbuf != NULL) {
+ if (s1_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_11_NAME, dsidx);
/* make a DS dataset with an alternate scale for the first dimension */
- if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_short(fid, name, rankds, s_dim, s1_wbuf) < 0)
return FAIL;
}
@@ -619,29 +654,31 @@ herr_t create_DS1_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize
* create 3 dimension scales datasets for second dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS2_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf, short *s2_wbuf)
+herr_t
+create_DS2_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf,
+ short *s1_wbuf, short *s2_wbuf)
{
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DS_2_NAME, dsidx);
/* make a DS dataset for the second dimension */
- if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s_wbuf) < 0)
+ if (H5LTmake_dataset_short(fid, name, rankds, s_dim, s_wbuf) < 0)
return FAIL;
- if(s1_wbuf != NULL) {
+ if (s1_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_21_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_short(fid, name, rankds, s_dim, s1_wbuf) < 0)
return FAIL;
}
- if(s2_wbuf != NULL) {
+ if (s2_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_22_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ if (H5LTmake_dataset_short(fid, name, rankds, s_dim, s2_wbuf) < 0)
return FAIL;
}
@@ -652,37 +689,39 @@ herr_t create_DS2_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize
* create 1 dimension scales datasets for third dimension of dataset
*-------------------------------------------------------------------------
*/
-herr_t create_DS3_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf, short *s1_wbuf, short *s2_wbuf, short *s3_wbuf)
+herr_t
+create_DS3_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, short *s_wbuf,
+ short *s1_wbuf, short *s2_wbuf, short *s3_wbuf)
{
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DS_3_NAME, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s_wbuf) < 0)
+ if (H5LTmake_dataset_short(fid, name, rankds, s_dim, s_wbuf) < 0)
return FAIL;
- if(s1_wbuf != NULL) {
+ if (s1_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_31_NAME, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_short(fid, name, rankds, s_dim, s1_wbuf) < 0)
return FAIL;
}
- if(s2_wbuf != NULL) {
+ if (s2_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_32_NAME, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ if (H5LTmake_dataset_short(fid, name, rankds, s_dim, s2_wbuf) < 0)
return FAIL;
}
- if(s3_wbuf != NULL) {
+ if (s3_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_33_NAME, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s3_wbuf) < 0)
+ if (H5LTmake_dataset_short(fid, name, rankds, s_dim, s3_wbuf) < 0)
return FAIL;
}
@@ -693,21 +732,22 @@ herr_t create_DS3_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize
* create 2 dimension scales datasets for first dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS1_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf)
+herr_t
+create_DS1_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf)
{
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DS_1_NAME, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, name, rankds, s_dim, s_wbuf) < 0)
return FAIL;
- if(s1_wbuf != NULL) {
+ if (s1_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_11_NAME, dsidx);
/* make a DS dataset with an alternate scale for the first dimension */
- if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, name, rankds, s_dim, s1_wbuf) < 0)
return FAIL;
}
@@ -718,29 +758,31 @@ herr_t create_DS1_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t
* create 3 dimension scales datasets for second dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS2_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf, int *s2_wbuf)
+herr_t
+create_DS2_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf,
+ int *s2_wbuf)
{
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DS_2_NAME, dsidx);
/* make a DS dataset for the second dimension */
- if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, name, rankds, s_dim, s_wbuf) < 0)
return FAIL;
- if(s1_wbuf != NULL) {
+ if (s1_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_21_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, name, rankds, s_dim, s1_wbuf) < 0)
return FAIL;
}
- if(s2_wbuf != NULL) {
+ if (s2_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_22_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, name, rankds, s_dim, s2_wbuf) < 0)
return FAIL;
}
@@ -751,37 +793,39 @@ herr_t create_DS2_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t
* create 1 dimension scales datasets for third dimension of dataset
*-------------------------------------------------------------------------
*/
-herr_t create_DS3_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf, int *s2_wbuf, int *s3_wbuf)
+herr_t
+create_DS3_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, int *s_wbuf, int *s1_wbuf,
+ int *s2_wbuf, int *s3_wbuf)
{
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DS_3_NAME, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, name, rankds, s_dim, s_wbuf) < 0)
return FAIL;
- if(s1_wbuf != NULL) {
+ if (s1_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_31_NAME, dsidx);
/* make a DS dataset with an alternate scale for the first dimension */
- if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, name, rankds, s_dim, s1_wbuf) < 0)
return FAIL;
}
- if(s2_wbuf != NULL) {
+ if (s2_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_32_NAME, dsidx);
/* make a DS dataset with an alternate scale for the first dimension */
- if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, name, rankds, s_dim, s2_wbuf) < 0)
return FAIL;
}
- if(s3_wbuf != NULL) {
+ if (s3_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_33_NAME, dsidx);
/* make a DS dataset with an alternate scale for the first dimension */
- if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s3_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, name, rankds, s_dim, s3_wbuf) < 0)
return FAIL;
}
@@ -792,21 +836,23 @@ herr_t create_DS3_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t
* create 2 dimension scales datasets for first dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS1_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf)
+herr_t
+create_DS1_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf,
+ long *s1_wbuf)
{
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DS_1_NAME, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0)
return FAIL;
- if(s1_wbuf != NULL) {
+ if (s1_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_11_NAME, dsidx);
/* make a DS dataset with an alternate scale for the first dimension */
- if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0)
return FAIL;
}
@@ -817,29 +863,31 @@ herr_t create_DS1_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_
* create 3 dimension scales datasets for second dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS2_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf)
+herr_t
+create_DS2_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf,
+ long *s1_wbuf, long *s2_wbuf)
{
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DS_2_NAME, dsidx);
/* make a DS dataset for the second dimension */
- if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0)
return FAIL;
- if(s1_wbuf != NULL) {
+ if (s1_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_21_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0)
return FAIL;
}
- if(s2_wbuf != NULL) {
+ if (s2_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_22_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, name, rankds, s_dim, s2_wbuf) < 0)
return FAIL;
}
@@ -850,37 +898,39 @@ herr_t create_DS2_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_
* create 3 dimension scales datasets for third dimension of dataset
*-------------------------------------------------------------------------
*/
-herr_t create_DS3_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf, long *s3_wbuf)
+herr_t
+create_DS3_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf,
+ long *s1_wbuf, long *s2_wbuf, long *s3_wbuf)
{
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DS_3_NAME, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0)
return FAIL;
- if(s1_wbuf != NULL) {
+ if (s1_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_31_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0)
return FAIL;
}
- if(s2_wbuf != NULL) {
+ if (s2_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_32_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, name, rankds, s_dim, s2_wbuf) < 0)
return FAIL;
}
- if(s3_wbuf != NULL) {
+ if (s3_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_33_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s3_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, name, rankds, s_dim, s3_wbuf) < 0)
return FAIL;
}
@@ -891,45 +941,47 @@ herr_t create_DS3_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_
* create 4 dimension scales datasets for third dimension of dataset
*-------------------------------------------------------------------------
*/
-herr_t create_DS4_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf, long *s1_wbuf, long *s2_wbuf, long *s3_wbuf, long *s4_wbuf)
+herr_t
+create_DS4_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, long *s_wbuf,
+ long *s1_wbuf, long *s2_wbuf, long *s3_wbuf, long *s4_wbuf)
{
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DS_4_NAME, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0)
return FAIL;
- if(s1_wbuf != NULL) {
+ if (s1_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_41_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0)
return FAIL;
}
- if(s2_wbuf != NULL) {
+ if (s2_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_42_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, name, rankds, s_dim, s2_wbuf) < 0)
return FAIL;
}
- if(s3_wbuf != NULL) {
+ if (s3_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_43_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s3_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, name, rankds, s_dim, s3_wbuf) < 0)
return FAIL;
}
- if(s4_wbuf != NULL) {
+ if (s4_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_44_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s4_wbuf) < 0)
+ if (H5LTmake_dataset_long(fid, name, rankds, s_dim, s4_wbuf) < 0)
return FAIL;
}
@@ -940,21 +992,23 @@ herr_t create_DS4_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_
* create 2 dimension scales datasets for first dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS1_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf)
+herr_t
+create_DS1_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf,
+ float *s1_wbuf)
{
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DS_1_NAME, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s_wbuf) < 0)
+ if (H5LTmake_dataset_float(fid, name, rankds, s_dim, s_wbuf) < 0)
return FAIL;
- if(s1_wbuf != NULL) {
+ if (s1_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_11_NAME, dsidx);
/* make a DS dataset with an alternate scale for the first dimension */
- if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_float(fid, name, rankds, s_dim, s1_wbuf) < 0)
return FAIL;
}
@@ -965,29 +1019,31 @@ herr_t create_DS1_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize
* create 3 dimension scales datasets for second dimension
*-------------------------------------------------------------------------
*/
-herr_t create_DS2_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf, float *s2_wbuf)
+herr_t
+create_DS2_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf,
+ float *s1_wbuf, float *s2_wbuf)
{
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DS_2_NAME, dsidx);
/* make a DS dataset for the second dimension */
- if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s_wbuf) < 0)
+ if (H5LTmake_dataset_float(fid, name, rankds, s_dim, s_wbuf) < 0)
return FAIL;
- if(s1_wbuf != NULL) {
+ if (s1_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_21_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_float(fid, name, rankds, s_dim, s1_wbuf) < 0)
return FAIL;
}
- if(s2_wbuf != NULL) {
+ if (s2_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_22_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ if (H5LTmake_dataset_float(fid, name, rankds, s_dim, s2_wbuf) < 0)
return FAIL;
}
@@ -998,144 +1054,151 @@ herr_t create_DS2_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize
* create 3 dimension scales datasets for third dimension of dataset
*-------------------------------------------------------------------------
*/
-herr_t create_DS3_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf, float *s1_wbuf, float *s2_wbuf, float *s3_wbuf)
+herr_t
+create_DS3_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t *s_dim, float *s_wbuf,
+ float *s1_wbuf, float *s2_wbuf, float *s3_wbuf)
{
char name[64];
HDsnprintf(name, sizeof(name), "%s%s", DS_3_NAME, dsidx);
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s_wbuf) < 0)
+ if (H5LTmake_dataset_float(fid, name, rankds, s_dim, s_wbuf) < 0)
return FAIL;
- if(s1_wbuf != NULL) {
+ if (s1_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_31_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_float(fid, name, rankds, s_dim, s1_wbuf) < 0)
return FAIL;
}
- if(s2_wbuf != NULL) {
+ if (s2_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_32_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s2_wbuf) < 0)
+ if (H5LTmake_dataset_float(fid, name, rankds, s_dim, s2_wbuf) < 0)
return FAIL;
}
- if(s3_wbuf != NULL) {
+ if (s3_wbuf != NULL) {
HDsnprintf(name, sizeof(name), "%s%s", DS_33_NAME, dsidx);
/* make a DS dataset with an alternate scale for the second dimension */
- if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s3_wbuf) < 0)
+ if (H5LTmake_dataset_float(fid, name, rankds, s_dim, s3_wbuf) < 0)
return FAIL;
}
return SUCCEED;
}
-herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
+herr_t
+test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
{
- herr_t ret_value = FAIL;
- hid_t dsid = -1;
+ herr_t ret_value = FAIL;
+ hid_t dsid = -1;
- if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
- if(H5DSis_attached(did, dsid, idx) == 0) {
- if(H5DSattach_scale(did, dsid, idx) >= 0) {
- if(H5DSis_attached(did, dsid, idx) > 0) {
+ if ((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
+ if (H5DSis_attached(did, dsid, idx) == 0) {
+ if (H5DSattach_scale(did, dsid, idx) >= 0) {
+ if (H5DSis_attached(did, dsid, idx) > 0) {
ret_value = SUCCEED;
}
- else if(H5DSis_attached(did, dsid, idx) == 0) {
+ else if (H5DSis_attached(did, dsid, idx) == 0) {
HDprintf(" scale not attached ");
}
}
}
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
ret_value = FAIL;
}
return ret_value;
}
-herr_t test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
+herr_t
+test_detach_scale(hid_t fid, hid_t did, const char *name, unsigned int idx)
{
- herr_t ret_value = FAIL;
- hid_t dsid = -1;
+ herr_t ret_value = FAIL;
+ hid_t dsid = -1;
- if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
- if(H5DSis_attached(did, dsid, idx) == 1) {
- if(H5DSdetach_scale(did, dsid, idx) >= 0) {
- if(H5DSis_attached(did, dsid, idx) == 0) {
+ if ((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
+ if (H5DSis_attached(did, dsid, idx) == 1) {
+ if (H5DSdetach_scale(did, dsid, idx) >= 0) {
+ if (H5DSis_attached(did, dsid, idx) == 0) {
ret_value = SUCCEED;
}
}
}
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
ret_value = FAIL;
}
return ret_value;
}
-herr_t test_set_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
+herr_t
+test_set_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
{
- herr_t ret_value = FAIL;
- hid_t dsid = -1;
+ herr_t ret_value = FAIL;
+ hid_t dsid = -1;
- if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
- if(H5DSis_attached(did, dsid, idx) == 1) {
- if(H5DSset_scale(dsid, scalename) >= 0) {
- if(H5DSis_attached(did, dsid, idx) == 1) {
- ret_value = SUCCEED;
+ if ((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
+ if (H5DSis_attached(did, dsid, idx) == 1) {
+ if (H5DSset_scale(dsid, scalename) >= 0) {
+ if (H5DSis_attached(did, dsid, idx) == 1) {
+ ret_value = SUCCEED;
}
}
}
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
ret_value = FAIL;
}
return ret_value;
}
-herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
+herr_t
+test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *scalename, unsigned int idx)
{
herr_t ret_value = FAIL;
- hid_t dsid = -1;
+ hid_t dsid = -1;
ssize_t name_len;
- char *name_out=NULL;
-
- if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
- if(H5DSis_attached(did, dsid, idx) == 1) {
- if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) > 0) {
- name_out = (char*)HDmalloc(((size_t)name_len+1) * sizeof (char));
- if(name_out != NULL) {
- if(H5DSget_scale_name(dsid, name_out, (size_t)name_len+1) >= 0) {
- if(HDstrncmp(scalename, name_out, (size_t)name_len)==0) {
+ char * name_out = NULL;
+
+ if ((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
+ if (H5DSis_attached(did, dsid, idx) == 1) {
+ if ((name_len = H5DSget_scale_name(dsid, NULL, (size_t)0)) > 0) {
+ name_out = (char *)HDmalloc(((size_t)name_len + 1) * sizeof(char));
+ if (name_out != NULL) {
+ if (H5DSget_scale_name(dsid, name_out, (size_t)name_len + 1) >= 0) {
+ if (HDstrncmp(scalename, name_out, (size_t)name_len) == 0) {
ret_value = SUCCEED;
}
HDfree(name_out);
- name_out=NULL;
+ name_out = NULL;
}
}
}
}
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
ret_value = FAIL;
}
return ret_value;
}
-static int test_detachscales(void)
+static int
+test_detachscales(void)
{
- hid_t fid = -1;
- hid_t did = -1;
- hid_t dsid = -1;
- int rank1 = 1;
- int rank3 = 3;
- hsize_t dims[] = {1,2,3}; /*some bogus numbers, not important for the test*/
- int *buf = NULL;
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t dsid = -1;
+ int rank1 = 1;
+ int rank3 = 3;
+ hsize_t dims[] = {1, 2, 3}; /*some bogus numbers, not important for the test*/
+ int * buf = NULL;
char dname[16];
int i;
@@ -1146,52 +1209,52 @@ static int test_detachscales(void)
HL_TESTING2("test_detachscales");
- if((fid = H5Fcreate("test_detach.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate("test_detach.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* make datasets; they are three dimensional*/
- for (i=0; i < 2; i++) {
- HDsprintf(dname,"D%d", i);
- if(H5LTmake_dataset_int(fid, dname, rank3, dims, buf) < 0)
+ for (i = 0; i < 2; i++) {
+ HDsprintf(dname, "D%d", i);
+ if (H5LTmake_dataset_int(fid, dname, rank3, dims, buf) < 0)
goto out;
}
/* create datasets and make them dim. scales */
- for (i=0; i < 4; i++) {
+ for (i = 0; i < 4; i++) {
HDsprintf(dname, "DS%d", i);
- if(H5LTmake_dataset_int(fid, dname, rank1, dims, buf) < 0)
+ if (H5LTmake_dataset_int(fid, dname, rank1, dims, buf) < 0)
goto out;
}
/* attach scales to the first dataset; first dimension will have
two scales attached */
- if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) {
- for (i=0; i<4; i++) {
- HDsprintf(dname, "DS%d", i);
- if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
- goto out;
- if(H5DSattach_scale(did, dsid, (unsigned int) i%3) < 0)
- goto out;
- if(H5Dclose(dsid) < 0)
- goto out;
+ if ((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < 4; i++) {
+ HDsprintf(dname, "DS%d", i);
+ if ((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
+ goto out;
+ if (H5DSattach_scale(did, dsid, (unsigned int)i % 3) < 0)
+ goto out;
+ if (H5Dclose(dsid) < 0)
+ goto out;
}
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
goto out;
- /* attach scales to the second dataset */
- if((did = H5Dopen2(fid, "D1", H5P_DEFAULT)) >= 0) {
- for (i=0; i<3; i++) {
- HDsprintf(dname, "DS%d", i);
- if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
- goto out;
- if(H5DSattach_scale(did, dsid, (unsigned int) i) < 0)
- goto out;
- if(H5Dclose(dsid) < 0)
- goto out;
+ /* attach scales to the second dataset */
+ if ((did = H5Dopen2(fid, "D1", H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < 3; i++) {
+ HDsprintf(dname, "DS%d", i);
+ if ((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
+ goto out;
+ if (H5DSattach_scale(did, dsid, (unsigned int)i) < 0)
+ goto out;
+ if (H5Dclose(dsid) < 0)
+ goto out;
}
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -1200,107 +1263,109 @@ static int test_detachscales(void)
/* detach DS0 from first dimension of D0 and D1; then check
that DS0 doesn't have attribute REFERENCE _LIST */
- if((dsid = H5Dopen2(fid, "DS0", H5P_DEFAULT)) < 0)
- goto out;
+ if ((dsid = H5Dopen2(fid, "DS0", H5P_DEFAULT)) < 0)
+ goto out;
- for (i=0; i<2; i++) {
+ for (i = 0; i < 2; i++) {
HDsprintf(dname, "D%d", i);
- if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
goto out;
- if(H5DSdetach_scale(did, dsid, (unsigned int)0) < 0)
+ if (H5DSdetach_scale(did, dsid, (unsigned int)0) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
/* Check that attribute "REFERENCE_LIST" doesn't exist anymore */
- if(H5Aexists(dsid, REFERENCE_LIST)!= 0)
+ if (H5Aexists(dsid, REFERENCE_LIST) != 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* Check that DS3 is the only dim. scale attached to the first
dimension of D0 */
- if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) < 0)
goto out;
- if((dsid = H5Dopen2(fid, "DS3", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "DS3", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSis_attached(did, dsid, (unsigned int) 0) <= 0)
+ if (H5DSis_attached(did, dsid, (unsigned int)0) <= 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* Detach the rest of the scales DS3, DS1, DS2 from D0 and make
sure that attribute "DIMENSION_LIST" doesn't exist anymore */
- if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) {
- for (i=1; i<4; i++) {
- HDsprintf(dname, "DS%d", i);
- if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
- goto out;
- if(H5DSdetach_scale(did, dsid, (unsigned int) i%3) < 0)
- goto out;
- if(H5Dclose(dsid) < 0)
- goto out;
+ if ((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) {
+ for (i = 1; i < 4; i++) {
+ HDsprintf(dname, "DS%d", i);
+ if ((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
+ goto out;
+ if (H5DSdetach_scale(did, dsid, (unsigned int)i % 3) < 0)
+ goto out;
+ if (H5Dclose(dsid) < 0)
+ goto out;
}
/* Check that attribute "DIMENSION_LIST" doesn't exist anymore */
- if(H5Aexists(did, DIMENSION_LIST)!= 0)
+ if (H5Aexists(did, DIMENSION_LIST) != 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
goto out;
-
PASSED();
H5Fclose(fid);
return SUCCEED;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Dclose(dsid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_char_attachscales(const char *fileext)
+static int
+test_char_attachscales(const char *fileext)
{
- hid_t fid = -1;
- hid_t did = -1;
- char dsname[32];
- char scalename[32];
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "ac");
HL_TESTING2("test_char_attachscales");
- if((fid = open_test_file(fileext)) < 0)
+ if ((fid = open_test_file(fileext)) < 0)
goto out;
/* make a dataset */
- if(create_char_dataset(fid, "ac", 0) < 0)
+ if (create_char_dataset(fid, "ac", 0) < 0)
goto out;
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "ac");
- if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_2_NAME, "ac");
- if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_3_NAME, "ac");
- if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -1312,72 +1377,75 @@ static int test_char_attachscales(const char *fileext)
return SUCCEED;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_short_attachscales(const char *fileext)
+static int
+test_short_attachscales(const char *fileext)
{
- hid_t fid = -1;
- hid_t did = -1;
- char dsname[32];
- char scalename[32];
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "as");
HL_TESTING2("test_short_attachscales");
- if((fid = open_test_file(fileext)) < 0)
+ if ((fid = open_test_file(fileext)) < 0)
goto out;
/* make a dataset */
- if(create_short_dataset(fid, "as", 1) < 0)
+ if (create_short_dataset(fid, "as", 1) < 0)
goto out;
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "as");
- if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_11_NAME, "as");
- if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_2_NAME, "as");
- if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_21_NAME, "as");
- if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_22_NAME, "as");
- if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_3_NAME, "as");
- if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_31_NAME, "as");
- if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_32_NAME, "as");
- if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_33_NAME, "as");
- if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -1389,56 +1457,59 @@ static int test_short_attachscales(const char *fileext)
return SUCCEED;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_int_attachscales(const char *fileext)
+static int
+test_int_attachscales(const char *fileext)
{
- hid_t fid = -1;
- hid_t did = -1;
- char dsname[32];
- char scalename[32];
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "a");
HL_TESTING2("test_int_attachscales");
- if((fid = open_test_file(fileext)) < 0)
+ if ((fid = open_test_file(fileext)) < 0)
goto out;
/* make a dataset */
- if(create_int_dataset(fid, "a", 1) < 0)
+ if (create_int_dataset(fid, "a", 1) < 0)
goto out;
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "a");
- if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_11_NAME, "a");
- if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_2_NAME, "a");
- if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_21_NAME, "a");
- if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_22_NAME, "a");
- if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -1450,52 +1521,55 @@ static int test_int_attachscales(const char *fileext)
return SUCCEED;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_long_attachscales(const char *fileext)
+static int
+test_long_attachscales(const char *fileext)
{
- hid_t fid = -1;
- hid_t did = -1;
- char dsname[32];
- char scalename[32];
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "al");
HL_TESTING2("test_long_attachscales");
- if((fid = open_test_file(fileext)) < 0)
+ if ((fid = open_test_file(fileext)) < 0)
goto out;
/* make a dataset */
- if(create_long_dataset(fid, dsname, "al", 0) < 0)
+ if (create_long_dataset(fid, dsname, "al", 0) < 0)
goto out;
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "al");
- if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_2_NAME, "al");
- if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_3_NAME, "al");
- if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_4_NAME, "al");
- if(test_attach_scale(fid, did, scalename, DIM3) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM3) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -1507,52 +1581,55 @@ static int test_long_attachscales(const char *fileext)
return SUCCEED;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_duplicatelong_attachscales(const char *fileext)
+static int
+test_duplicatelong_attachscales(const char *fileext)
{
- hid_t fid = -1;
- hid_t did = -1;
- char dsname[32];
- char scalename[32];
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "al2");
HL_TESTING2("test_duplicatelong_attachscales");
- if((fid = open_test_file(fileext)) < 0)
+ if ((fid = open_test_file(fileext)) < 0)
goto out;
/* make a dataset 2 */
- if(create_long_dataset(fid, dsname, "al2", 0) < 0)
+ if (create_long_dataset(fid, dsname, "al2", 0) < 0)
goto out;
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "al");
- if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_2_NAME, "al");
- if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_3_NAME, "al");
- if(test_attach_scale(fid, did, scalename, DIM2) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM2) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_4_NAME, "al");
- if(test_attach_scale(fid, did, scalename, DIM3) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM3) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -1564,56 +1641,59 @@ static int test_duplicatelong_attachscales(const char *fileext)
return SUCCEED;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_float_attachscales(const char *fileext)
+static int
+test_float_attachscales(const char *fileext)
{
- hid_t fid = -1;
- hid_t did = -1;
- char dsname[32];
- char scalename[32];
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "af");
HL_TESTING2("test_float_attachscales");
- if((fid = open_test_file(fileext)) < 0)
+ if ((fid = open_test_file(fileext)) < 0)
goto out;
/* make a dataset */
- if(create_float_dataset(fid, "af", 1) < 0)
+ if (create_float_dataset(fid, "af", 1) < 0)
goto out;
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "af");
- if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_11_NAME, "af");
- if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_2_NAME, "af");
- if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_21_NAME, "af");
- if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_22_NAME, "af");
- if(test_attach_scale(fid, did, scalename, DIM1) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM1) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -1625,45 +1705,48 @@ static int test_float_attachscales(const char *fileext)
return SUCCEED;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_numberofscales(const char *fileext)
+static int
+test_numberofscales(const char *fileext)
{
- hid_t fid = -1;
- hid_t did = -1;
- int nscales; /* number of scales in DIM */
- char dsname[32];
- char scalename[32];
+ hid_t fid = -1;
+ hid_t did = -1;
+ int nscales; /* number of scales in DIM */
+ char dsname[32];
+ char scalename[32];
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "a");
HL_TESTING2("test_numberofscales");
- if((fid = open_test_file(fileext)) < 0)
+ if ((fid = open_test_file(fileext)) < 0)
goto out;
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
- if((nscales = H5DSget_num_scales(did, 0)) < 0)
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((nscales = H5DSget_num_scales(did, 0)) < 0)
goto out;
- if(nscales != 2)
+ if (nscales != 2)
goto out;
- if((nscales = H5DSget_num_scales(did, 1)) < 0)
+ if ((nscales = H5DSget_num_scales(did, 1)) < 0)
goto out;
- if(nscales != 3)
+ if (nscales != 3)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -1672,28 +1755,28 @@ static int test_numberofscales(const char *fileext)
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "b");
/* make a dataset */
- if(create_int_dataset(fid, "b", 1) < 0)
+ if (create_int_dataset(fid, "b", 1) < 0)
goto out;
/* make a DS dataset for the first dimension */
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "b");
- if(test_attach_scale(fid, did, scalename, DIM0) < 0)
+ if (test_attach_scale(fid, did, scalename, DIM0) < 0)
goto out;
- if((nscales = H5DSget_num_scales(did, 0)) < 0)
+ if ((nscales = H5DSget_num_scales(did, 0)) < 0)
goto out;
- if(nscales != 1)
+ if (nscales != 1)
goto out;
- if((nscales = H5DSget_num_scales(did, 1)) < 0)
+ if ((nscales = H5DSget_num_scales(did, 1)) < 0)
goto out;
- if(nscales != 0)
+ if (nscales != 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -1705,55 +1788,59 @@ static int test_numberofscales(const char *fileext)
return SUCCEED;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_char_scalenames(const char *fileext) {
- hid_t fid = -1;
- hid_t did = -1;
- char dsname[32];
- char scalename[32];
- char name[32];
+static int
+test_char_scalenames(const char *fileext)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ char name[32];
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "ac");
- if((fid = open_test_file(fileext)) < 0)
+ if ((fid = open_test_file(fileext)) < 0)
goto out;
HL_TESTING2("set char scale/cmp scale name");
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "ac");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "ac");
- if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_2_NAME, "ac");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_2_NAME, "ac");
- if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_3_NAME, "ac");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_3_NAME, "ac");
- if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -1765,103 +1852,107 @@ static int test_char_scalenames(const char *fileext) {
return SUCCEED;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_short_scalenames(const char *fileext) {
- hid_t fid = -1;
- hid_t did = -1;
- char dsname[32];
- char scalename[32];
- char name[32];
+static int
+test_short_scalenames(const char *fileext)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ char name[32];
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "as");
- if((fid = open_test_file(fileext)) < 0)
+ if ((fid = open_test_file(fileext)) < 0)
goto out;
HL_TESTING2("set short scale/cmp scale name");
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "as");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "as");
- if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_11_NAME, "as");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_11_NAME, "as");
- if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_2_NAME, "as");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_2_NAME, "as");
- if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_21_NAME, "as");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_21_NAME, "as");
- if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_22_NAME, "as");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_22_NAME, "as");
- if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_3_NAME, "as");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_3_NAME, "as");
- if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_31_NAME, "as");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_31_NAME, "as");
- if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_32_NAME, "as");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_32_NAME, "as");
- if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_33_NAME, "as");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_33_NAME, "as");
- if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -1873,71 +1964,75 @@ static int test_short_scalenames(const char *fileext) {
return SUCCEED;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_int_scalenames(const char *fileext) {
- hid_t fid = -1;
- hid_t did = -1;
- char dsname[32];
- char scalename[32];
- char name[32];
+static int
+test_int_scalenames(const char *fileext)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ char name[32];
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "a");
- if((fid = open_test_file(fileext)) < 0)
+ if ((fid = open_test_file(fileext)) < 0)
goto out;
HL_TESTING2("set int scale/cmp scale name");
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "a");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "a");
- if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_11_NAME, "a");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_11_NAME, "a");
- if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_2_NAME, "a");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_2_NAME, "a");
- if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_21_NAME, "a");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_21_NAME, "a");
- if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_22_NAME, "a");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_22_NAME, "a");
- if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -1949,63 +2044,67 @@ static int test_int_scalenames(const char *fileext) {
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_long_scalenames(const char *fileext) {
- hid_t fid = -1;
- hid_t did = -1;
- char dsname[32];
- char scalename[32];
- char name[32];
+static int
+test_long_scalenames(const char *fileext)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ char name[32];
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "al");
- if((fid = open_test_file(fileext)) < 0)
+ if ((fid = open_test_file(fileext)) < 0)
goto out;
HL_TESTING2("set long scale/cmp scale name");
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "al");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "al");
- if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_2_NAME, "al");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_2_NAME, "al");
- if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_3_NAME, "al");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_3_NAME, "al");
- if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_4_NAME, "al");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_4_NAME, "al");
- if(test_set_scalename(fid, did, scalename, name, DIM3) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM3) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM3) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM3) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -2017,63 +2116,67 @@ static int test_long_scalenames(const char *fileext) {
return SUCCEED;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_samelong_scalenames(const char *fileext) {
- hid_t fid = -1;
- hid_t did = -1;
- char dsname[32];
- char scalename[32];
- char name[32];
+static int
+test_samelong_scalenames(const char *fileext)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ char name[32];
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "al2");
- if((fid = open_test_file(fileext)) < 0)
+ if ((fid = open_test_file(fileext)) < 0)
goto out;
HL_TESTING2("set same long scale/cmp scale name");
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "al");
HDsnprintf(name, sizeof(name), "%s%s", DS_1_NAME, "al");
- if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_2_NAME, "al");
HDsnprintf(name, sizeof(name), "%s%s", DS_2_NAME, "al");
- if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_3_NAME, "al");
HDsnprintf(name, sizeof(name), "%s%s", DS_3_NAME, "al");
- if(test_set_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM2) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_4_NAME, "al");
HDsnprintf(name, sizeof(name), "%s%s", DS_4_NAME, "al");
- if(test_set_scalename(fid, did, scalename, name, DIM3) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM3) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM3) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM3) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -2085,71 +2188,75 @@ static int test_samelong_scalenames(const char *fileext) {
return SUCCEED;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_float_scalenames(const char *fileext) {
- hid_t fid = -1;
- hid_t did = -1;
- char dsname[32];
- char scalename[32];
- char name[32];
+static int
+test_float_scalenames(const char *fileext)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ char dsname[32];
+ char scalename[32];
+ char name[32];
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "af");
- if((fid = open_test_file(fileext)) < 0)
+ if ((fid = open_test_file(fileext)) < 0)
goto out;
HL_TESTING2("set float scale/cmp scale name");
- if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
+ if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "af");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "af");
- if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_11_NAME, "af");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_11_NAME, "af");
- if(test_set_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM0) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_2_NAME, "af");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_2_NAME, "af");
- if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_21_NAME, "af");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_21_NAME, "af");
- if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_22_NAME, "af");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_22_NAME, "af");
- if(test_set_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_set_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
- if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
+ if (test_cmp_scalename(fid, did, scalename, name, DIM1) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
@@ -2161,44 +2268,47 @@ static int test_float_scalenames(const char *fileext) {
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_foreign_scaleattached(const char *fileforeign)
+static int
+test_foreign_scaleattached(const char *fileforeign)
{
- herr_t ret_value = FAIL;
- hid_t fid = -1;
- hid_t did = -1;
- hid_t dsid = -1;
- const char *filename = H5_get_srcdir_filename(fileforeign);
+ herr_t ret_value = FAIL;
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t dsid = -1;
+ const char *filename = H5_get_srcdir_filename(fileforeign);
HL_TESTING2("test_foreign_scaleattached");
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
goto out;
- if((did = H5Dopen2(fid, "/dset_al", H5P_DEFAULT)) >= 0) {
- if((dsid = H5Dopen2(fid, "/ds_4_al", H5P_DEFAULT)) >= 0) {
- if(H5DSis_attached(did, dsid, 3) == 1) {
+ if ((did = H5Dopen2(fid, "/dset_al", H5P_DEFAULT)) >= 0) {
+ if ((dsid = H5Dopen2(fid, "/ds_4_al", H5P_DEFAULT)) >= 0) {
+ if (H5DSis_attached(did, dsid, 3) == 1) {
ret_value = SUCCEED;
}
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
}
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
else
goto out;
- if(ret_value == FAIL)
+ if (ret_value == FAIL)
goto out;
PASSED();
@@ -2207,1225 +2317,1206 @@ static int test_foreign_scaleattached(const char *fileforeign)
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-static int test_simple(void)
+static int
+test_simple(void)
{
- hid_t fid = -1;
- hid_t did = -1;
- hid_t dsid = -1;
- hid_t sid = -1;
- hid_t gid = -1;
- int rank = RANK;
- int rankds = 1;
- hsize_t dims[RANK] = {DIM1_SIZE,DIM2_SIZE};
- int buf[DIM_DATA] = {1,2,3,4,5,6,7,8,9,10,11,12};
- hsize_t s1_dim[1] = {DIM1_SIZE};
- hsize_t s2_dim[1] = {DIM2_SIZE};
- char sname[30];
- char dname[30];
- int s1_wbuf[DIM1_SIZE] = {10,20,30};
- int s11_wbuf[DIM1_SIZE] = {10,100,300};
- int s2_wbuf[DIM2_SIZE] = {100,200,300,400};
- int s21_wbuf[DIM2_SIZE] = {10,20,30,40};
- int s22_wbuf[DIM2_SIZE] = {5,10,50,300};
- char dim0_label[16];
- char dim1_label[16];
- char *dim0_labeld;
- char *dim1_labeld;
- char dim0_labels[3];
- char dim1_labels[3];
- ssize_t dim0_label_size;
- ssize_t dim1_label_size;
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t dsid = -1;
+ hid_t sid = -1;
+ hid_t gid = -1;
+ int rank = RANK;
+ int rankds = 1;
+ hsize_t dims[RANK] = {DIM1_SIZE, DIM2_SIZE};
+ int buf[DIM_DATA] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
+ hsize_t s1_dim[1] = {DIM1_SIZE};
+ hsize_t s2_dim[1] = {DIM2_SIZE};
+ char sname[30];
+ char dname[30];
+ int s1_wbuf[DIM1_SIZE] = {10, 20, 30};
+ int s11_wbuf[DIM1_SIZE] = {10, 100, 300};
+ int s2_wbuf[DIM2_SIZE] = {100, 200, 300, 400};
+ int s21_wbuf[DIM2_SIZE] = {10, 20, 30, 40};
+ int s22_wbuf[DIM2_SIZE] = {5, 10, 50, 300};
+ char dim0_label[16];
+ char dim1_label[16];
+ char * dim0_labeld;
+ char * dim1_labeld;
+ char dim0_labels[3];
+ char dim1_labels[3];
+ ssize_t dim0_label_size;
+ ssize_t dim1_label_size;
unsigned int dim;
- int scale_idx;
- int nscales;
- ssize_t name_len;
- char *name_out=NULL;
- char snames[3];
- int i, j;
+ int scale_idx;
+ int nscales;
+ ssize_t name_len;
+ char * name_out = NULL;
+ char snames[3];
+ int i, j;
HDprintf("Testing API functions\n");
/*-------------------------------------------------------------------------
- * create a file for the test
- *-------------------------------------------------------------------------
- */
+ * create a file for the test
+ *-------------------------------------------------------------------------
+ */
/* create a file using default properties */
- if((fid=H5Fcreate(FILE1,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * create datasets: 1 "data" dataset and 4 dimension scales
- *-------------------------------------------------------------------------
- */
+ * create datasets: 1 "data" dataset and 4 dimension scales
+ *-------------------------------------------------------------------------
+ */
/* make a dataset */
- if(H5LTmake_dataset_int(fid,"dset_a",rank,dims,buf) < 0)
+ if (H5LTmake_dataset_int(fid, "dset_a", rank, dims, buf) < 0)
goto out;
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_int(fid,"ds_a_1",rankds,s1_dim,s1_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_a_1", rankds, s1_dim, s1_wbuf) < 0)
goto out;
/* make a DS dataset with an alternate scale for the 2nd dimension */
- if(H5LTmake_dataset_int(fid,"ds_a_11",rankds,s1_dim,s11_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_a_11", rankds, s1_dim, s11_wbuf) < 0)
goto out;
/* make a DS dataset for the second dimension */
- if(H5LTmake_dataset_int(fid,"ds_a_2",rankds,s2_dim,s2_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_a_2", rankds, s2_dim, s2_wbuf) < 0)
goto out;
/* make a DS dataset with an alternate scale for the 2nd dimension */
- if(H5LTmake_dataset_int(fid,"ds_a_21",rankds,s2_dim,s21_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_a_21", rankds, s2_dim, s21_wbuf) < 0)
goto out;
/* make a DS dataset with an alternate scale for the 2nd dimension */
- if(H5LTmake_dataset_int(fid,"ds_a_22",rankds,s2_dim,s22_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_a_22", rankds, s2_dim, s22_wbuf) < 0)
goto out;
/* get the dataset id for "dset_a" */
- if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attach the DS_1_NAME dimension scale to "dset_a"
- *-------------------------------------------------------------------------
- */
+ * attach the DS_1_NAME dimension scale to "dset_a"
+ *-------------------------------------------------------------------------
+ */
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,"ds_a_1", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_a_1", H5P_DEFAULT)) < 0)
goto out;
/* attach the DS_1_NAME dimension scale to "dset_a" at dimension 0 */
- if(H5DSattach_scale(did,dsid,DIM0) < 0)
+ if (H5DSattach_scale(did, dsid, DIM0) < 0)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attach the DS_11_NAME dimension scale to "dset_a"
- *-------------------------------------------------------------------------
- */
+ * attach the DS_11_NAME dimension scale to "dset_a"
+ *-------------------------------------------------------------------------
+ */
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,"ds_a_11", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_a_11", H5P_DEFAULT)) < 0)
goto out;
/* attach the DS_11_NAME dimension scale to "dset_a" at dimension 0 */
- if(H5DSattach_scale(did,dsid,DIM0) < 0)
+ if (H5DSattach_scale(did, dsid, DIM0) < 0)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attach the DS_2_NAME dimension scale to "dset_a"
- *-------------------------------------------------------------------------
- */
+ * attach the DS_2_NAME dimension scale to "dset_a"
+ *-------------------------------------------------------------------------
+ */
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,"ds_a_2", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_a_2", H5P_DEFAULT)) < 0)
goto out;
/* attach the "ds2" dimension scale to "dset_a" as the 2nd dimension */
- if(H5DSattach_scale(did,dsid,DIM1) < 0)
+ if (H5DSattach_scale(did, dsid, DIM1) < 0)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attach the DS_21_NAME dimension scale to "dset_a"
- *-------------------------------------------------------------------------
- */
+ * attach the DS_21_NAME dimension scale to "dset_a"
+ *-------------------------------------------------------------------------
+ */
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,"ds_a_21", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_a_21", H5P_DEFAULT)) < 0)
goto out;
/* attach the DS_21_NAME dimension scale to "dset_a" as the 2nd dimension */
- if(H5DSattach_scale(did,dsid,DIM1) < 0)
+ if (H5DSattach_scale(did, dsid, DIM1) < 0)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attach the DS_22_NAME dimension scale to "dset_a"
- *-------------------------------------------------------------------------
- */
+ * attach the DS_22_NAME dimension scale to "dset_a"
+ *-------------------------------------------------------------------------
+ */
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,"ds_a_22", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_a_22", H5P_DEFAULT)) < 0)
goto out;
/* attach the "ds22" dimension scale to "dset_a" as the 2nd dimension */
- if(H5DSattach_scale(did,dsid,DIM1) < 0)
+ if (H5DSattach_scale(did, dsid, DIM1) < 0)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* close dataset ID of "dset_a" */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/*-------------------------------------------------------------------------
- * create datasets: 1 "data" dataset and 1 dimension scale
- *-------------------------------------------------------------------------
- */
+ * create datasets: 1 "data" dataset and 1 dimension scale
+ *-------------------------------------------------------------------------
+ */
/* make a dataset */
- if(H5LTmake_dataset_int(fid,"dset_b",rank,dims,buf) < 0)
+ if (H5LTmake_dataset_int(fid, "dset_b", rank, dims, buf) < 0)
goto out;
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_int(fid,"ds_b_1",rankds,s1_dim,s1_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_b_1", rankds, s1_dim, s1_wbuf) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attach the scale to "dset_b"
- *-------------------------------------------------------------------------
- */
+ * attach the scale to "dset_b"
+ *-------------------------------------------------------------------------
+ */
- if((did = H5Dopen2(fid,"dset_b", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_b", H5P_DEFAULT)) < 0)
goto out;
- if((dsid = H5Dopen2(fid,"ds_b_1", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_b_1", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did,dsid,0) < 0)
+ if (H5DSattach_scale(did, dsid, 0) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* close dataset ID of "dset_b" */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
-
-
/*-------------------------------------------------------------------------
- * H5DSdetach_scale
- *-------------------------------------------------------------------------
- */
+ * H5DSdetach_scale
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("detach scales ");
-
/*-------------------------------------------------------------------------
- * create datasets: one "data" dataset and 4 dimension scales
- *-------------------------------------------------------------------------
- */
+ * create datasets: one "data" dataset and 4 dimension scales
+ *-------------------------------------------------------------------------
+ */
/* make a dataset */
- if(H5LTmake_dataset_int(fid, "dset_c", rank, dims, buf) < 0)
+ if (H5LTmake_dataset_int(fid, "dset_c", rank, dims, buf) < 0)
goto out;
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_int(fid, "ds_c_1", rankds, s1_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_c_1", rankds, s1_dim, s1_wbuf) < 0)
goto out;
/* make a DS dataset for the second dimension */
- if(H5LTmake_dataset_int(fid, "ds_c_2", rankds, s2_dim, s2_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_c_2", rankds, s2_dim, s2_wbuf) < 0)
goto out;
/* make a DS dataset with an alternate scale for the 2nd dimension */
- if(H5LTmake_dataset_int(fid, "ds_c_21", rankds, s2_dim, s2_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_c_21", rankds, s2_dim, s2_wbuf) < 0)
goto out;
/* make a DS dataset with an alternate scale for the 2nd dimension */
- if(H5LTmake_dataset_int(fid, "ds_c_22", rankds, s2_dim, s2_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_c_22", rankds, s2_dim, s2_wbuf) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * attach the scales to "dset_c"
- *-------------------------------------------------------------------------
- */
+ * attach the scales to "dset_c"
+ *-------------------------------------------------------------------------
+ */
- if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_c", H5P_DEFAULT)) < 0)
goto out;
- if((dsid = H5Dopen2(fid,"ds_c_1", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_c_1", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did, dsid, 0) < 0)
+ if (H5DSattach_scale(did, dsid, 0) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if((dsid = H5Dopen2(fid,"ds_c_2", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_c_2", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did, dsid, 1) < 0)
+ if (H5DSattach_scale(did, dsid, 1) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if((dsid = H5Dopen2(fid,"ds_c_21", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_c_21", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did, dsid, 1) < 0)
+ if (H5DSattach_scale(did, dsid, 1) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if((dsid = H5Dopen2(fid,"ds_c_22", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_c_22", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did, dsid, 1) < 0)
+ if (H5DSattach_scale(did, dsid, 1) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/*-------------------------------------------------------------------------
- * verify if "dset_c" has dimension scales
- *-------------------------------------------------------------------------
- */
+ * verify if "dset_c" has dimension scales
+ *-------------------------------------------------------------------------
+ */
- if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_c", H5P_DEFAULT)) < 0)
goto out;
/* verify that "dset_c" has 1 dimension scale at DIM 0 */
- if((nscales = H5DSget_num_scales(did, 0)) < 0)
+ if ((nscales = H5DSget_num_scales(did, 0)) < 0)
goto out;
- if(nscales != 1)
+ if (nscales != 1)
goto out;
/* verify that "dset_c" has 3 dimension scales at DIM 1 */
- if((nscales = H5DSget_num_scales(did, 1)) < 0)
+ if ((nscales = H5DSget_num_scales(did, 1)) < 0)
goto out;
- if(nscales != 3)
+ if (nscales != 3)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/*-------------------------------------------------------------------------
- * detach the "ds_c_21" dimension scale to "dset_c"
- *-------------------------------------------------------------------------
- */
+ * detach the "ds_c_21" dimension scale to "dset_c"
+ *-------------------------------------------------------------------------
+ */
/* get the dataset id for "dset_c" */
- if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_c", H5P_DEFAULT)) < 0)
goto out;
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,"ds_c_21", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_c_21", H5P_DEFAULT)) < 0)
goto out;
/* detach the "ds_c_21" dimension scale to "dset_c" in DIM 1 */
- if(H5DSdetach_scale(did, dsid, 1) < 0)
+ if (H5DSdetach_scale(did, dsid, 1) < 0)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* close dataset ID of "dset_c" */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/*-------------------------------------------------------------------------
- * "dset_c" must have now 2 dimension scales at DIM 1
- *-------------------------------------------------------------------------
- */
+ * "dset_c" must have now 2 dimension scales at DIM 1
+ *-------------------------------------------------------------------------
+ */
- if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_c", H5P_DEFAULT)) < 0)
goto out;
/* verify that "dset_c" has 2 dimension scales at DIM 1 */
- if((nscales = H5DSget_num_scales(did, 1)) < 0)
+ if ((nscales = H5DSget_num_scales(did, 1)) < 0)
goto out;
- if(nscales != 2)
+ if (nscales != 2)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/*-------------------------------------------------------------------------
- * detach the "ds_c_22" dimension scale to "dset_c"
- *-------------------------------------------------------------------------
- */
+ * detach the "ds_c_22" dimension scale to "dset_c"
+ *-------------------------------------------------------------------------
+ */
/* get the dataset id for "dset_c" */
- if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_c", H5P_DEFAULT)) < 0)
goto out;
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,"ds_c_22", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_c_22", H5P_DEFAULT)) < 0)
goto out;
/* detach the "ds_c_22" dimension scale to "dset_c" in DIM 1 */
- if(H5DSdetach_scale(did, dsid, 1) < 0)
+ if (H5DSdetach_scale(did, dsid, 1) < 0)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* close dataset ID of "dset_c" */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/*-------------------------------------------------------------------------
- * "dset_c" must have now 1 dimension scale at DIM 1
- *-------------------------------------------------------------------------
- */
+ * "dset_c" must have now 1 dimension scale at DIM 1
+ *-------------------------------------------------------------------------
+ */
- if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_c", H5P_DEFAULT)) < 0)
goto out;
/* verify that "dset_c" has 1 dimension scale at DIM 1 */
- if((nscales = H5DSget_num_scales(did, 1)) < 0)
+ if ((nscales = H5DSget_num_scales(did, 1)) < 0)
goto out;
- if(nscales != 1)
+ if (nscales != 1)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/*-------------------------------------------------------------------------
- * detach the "ds_c_2" dimension scale to "dset_c"
- *-------------------------------------------------------------------------
- */
+ * detach the "ds_c_2" dimension scale to "dset_c"
+ *-------------------------------------------------------------------------
+ */
/* get the dataset id for "dset_c" */
- if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_c", H5P_DEFAULT)) < 0)
goto out;
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,"ds_c_2", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_c_2", H5P_DEFAULT)) < 0)
goto out;
/* detach the "ds_c_2" dimension scale to "dset_c" in DIM 1 */
- if(H5DSdetach_scale(did, dsid, 1) < 0)
+ if (H5DSdetach_scale(did, dsid, 1) < 0)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* close dataset ID of "dset_c" */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/*-------------------------------------------------------------------------
- * "dset_c" must have now 0 dimension scales at DIM 1
- *-------------------------------------------------------------------------
- */
+ * "dset_c" must have now 0 dimension scales at DIM 1
+ *-------------------------------------------------------------------------
+ */
- if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_c", H5P_DEFAULT)) < 0)
goto out;
/* verify that "dset_c" has 1 dimension scale at DIM 1 */
- if((nscales = H5DSget_num_scales(did, 1)) < 0)
+ if ((nscales = H5DSget_num_scales(did, 1)) < 0)
goto out;
- if(nscales != 0)
+ if (nscales != 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * create 3 datasets: 1 "data" dataset and 2 dimension scales
- *-------------------------------------------------------------------------
- */
- if(H5LTmake_dataset_int(fid,"dset_d",rank,dims,NULL) < 0)
+ * create 3 datasets: 1 "data" dataset and 2 dimension scales
+ *-------------------------------------------------------------------------
+ */
+ if (H5LTmake_dataset_int(fid, "dset_d", rank, dims, NULL) < 0)
goto out;
- if(H5LTmake_dataset_int(fid,"ds_d_1",rankds,s1_dim,NULL) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_d_1", rankds, s1_dim, NULL) < 0)
goto out;
- if(H5LTmake_dataset_int(fid,"ds_d_2",rankds,s2_dim,NULL) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_d_2", rankds, s2_dim, NULL) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attach them
- *-------------------------------------------------------------------------
- */
- if((did = H5Dopen2(fid,"dset_d", H5P_DEFAULT)) < 0)
+ * attach them
+ *-------------------------------------------------------------------------
+ */
+ if ((did = H5Dopen2(fid, "dset_d", H5P_DEFAULT)) < 0)
goto out;
- if((dsid = H5Dopen2(fid,"ds_d_1", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_d_1", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did, dsid, 0) < 0)
+ if (H5DSattach_scale(did, dsid, 0) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if((dsid = H5Dopen2(fid,"ds_d_2", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_d_2", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did, dsid, 1) < 0)
+ if (H5DSattach_scale(did, dsid, 1) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/*-------------------------------------------------------------------------
- * verify
- *-------------------------------------------------------------------------
- */
+ * verify
+ *-------------------------------------------------------------------------
+ */
- if((did = H5Dopen2(fid,"dset_d", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_d", H5P_DEFAULT)) < 0)
goto out;
- if((dsid = H5Dopen2(fid,"ds_d_1", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_d_1", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSis_attached(did,dsid,DIM0)<=0)
+ if (H5DSis_attached(did, dsid, DIM0) <= 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if((dsid = H5Dopen2(fid,"ds_d_2", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_d_2", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSis_attached(did,dsid,DIM1)<=0)
+ if (H5DSis_attached(did, dsid, DIM1) <= 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * detach
- *-------------------------------------------------------------------------
- */
+ * detach
+ *-------------------------------------------------------------------------
+ */
/* get the dataset id for "dset_d" */
- if((did = H5Dopen2(fid,"dset_d", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_d", H5P_DEFAULT)) < 0)
goto out;
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,"ds_d_1", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_d_1", H5P_DEFAULT)) < 0)
goto out;
/* detach the dimension scale to "dset_d" in DIM 0 */
- if(H5DSdetach_scale(did,dsid,DIM0) < 0)
+ if (H5DSdetach_scale(did, dsid, DIM0) < 0)
goto out;
/* verify attach, it must return 0 for no attach */
- if(H5DSis_attached(did,dsid,DIM0)!=0)
+ if (H5DSis_attached(did, dsid, DIM0) != 0)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* close dataset ID of "dset_d" */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attach again
- *-------------------------------------------------------------------------
- */
+ * attach again
+ *-------------------------------------------------------------------------
+ */
/* get the dataset id for "dset_d" */
- if((did = H5Dopen2(fid,"dset_d", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_d", H5P_DEFAULT)) < 0)
goto out;
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,"ds_d_1", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_d_1", H5P_DEFAULT)) < 0)
goto out;
/* attach "ds_d_1" again in DIM 0 */
- if(H5DSattach_scale(did,dsid,DIM0) < 0)
+ if (H5DSattach_scale(did, dsid, DIM0) < 0)
goto out;
/* verify attach, it must return 1 for attach */
- if(H5DSis_attached(did,dsid,DIM0)!=1)
+ if (H5DSis_attached(did, dsid, DIM0) != 1)
goto out;
/* verify that "ds_d_1" has only 1 scale at DIM0 */
- if((nscales = H5DSget_num_scales(did,DIM0)) < 0)
+ if ((nscales = H5DSget_num_scales(did, DIM0)) < 0)
goto out;
- if(nscales != 1)
+ if (nscales != 1)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* close dataset ID of "dset_d" */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/*-------------------------------------------------------------------------
- * detach/detach
- *-------------------------------------------------------------------------
- */
+ * detach/detach
+ *-------------------------------------------------------------------------
+ */
/* get the dataset id for "dset_d" */
- if((did = H5Dopen2(fid,"dset_d", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_d", H5P_DEFAULT)) < 0)
goto out;
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,"ds_d_2", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_d_2", H5P_DEFAULT)) < 0)
goto out;
/* detach the "ds_d_2" dimension scale to "dset_d" in DIM 1 */
- if(H5DSdetach_scale(did,dsid,DIM1) < 0)
+ if (H5DSdetach_scale(did, dsid, DIM1) < 0)
goto out;
/* detach again, it should fail */
- if(H5DSdetach_scale(did,dsid,DIM1)==SUCCEED)
+ if (H5DSdetach_scale(did, dsid, DIM1) == SUCCEED)
goto out;
/* verify attach, it must return 0 for no attach */
- if(H5DSis_attached(did,dsid,DIM1)!=0)
+ if (H5DSis_attached(did, dsid, DIM1) != 0)
goto out;
/* verify that "ds_d_1" has no scale at DIM1 */
- if((nscales = H5DSget_num_scales(did,DIM1)) < 0)
+ if ((nscales = H5DSget_num_scales(did, DIM1)) < 0)
goto out;
- if(nscales != 0)
+ if (nscales != 0)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* close dataset ID of "dset_d" */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attach twice
- *-------------------------------------------------------------------------
- */
+ * attach twice
+ *-------------------------------------------------------------------------
+ */
/* get the dataset id for "dset_d" */
- if((did = H5Dopen2(fid,"dset_d", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_d", H5P_DEFAULT)) < 0)
goto out;
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,"ds_d_2", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_d_2", H5P_DEFAULT)) < 0)
goto out;
/* attach "ds_d_2" in DIM 1 */
- if(H5DSattach_scale(did,dsid,DIM1) < 0)
+ if (H5DSattach_scale(did, dsid, DIM1) < 0)
goto out;
/* verify attach, it must return 1 for attach */
- if(H5DSis_attached(did,dsid,DIM1)!=1)
+ if (H5DSis_attached(did, dsid, DIM1) != 1)
goto out;
/* verify that "ds_d_2" has only 1 scale at DIM1 */
- if((nscales = H5DSget_num_scales(did,DIM0)) < 0)
+ if ((nscales = H5DSget_num_scales(did, DIM0)) < 0)
goto out;
- if(nscales != 1)
+ if (nscales != 1)
goto out;
/* attach "ds_d_2" again in DIM 1 */
- if(H5DSattach_scale(did,dsid,DIM1) < 0)
+ if (H5DSattach_scale(did, dsid, DIM1) < 0)
goto out;
/* verify attach, it must return 1 for attach */
- if(H5DSis_attached(did,dsid,DIM1)!=1)
+ if (H5DSis_attached(did, dsid, DIM1) != 1)
goto out;
/* verify that "ds_d_2" has only 1 scale at DIM1 */
- if((nscales = H5DSget_num_scales(did,DIM0)) < 0)
+ if ((nscales = H5DSget_num_scales(did, DIM0)) < 0)
goto out;
- if(nscales != 1)
+ if (nscales != 1)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* close dataset ID of "dset_d" */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/*-------------------------------------------------------------------------
- * create 10 datasets: 5 "data" dataset and 5 dimension scales
- *-------------------------------------------------------------------------
- */
+ * create 10 datasets: 5 "data" dataset and 5 dimension scales
+ *-------------------------------------------------------------------------
+ */
/* create a group */
- if((gid = H5Gcreate2(fid, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* create the data space for the dataset */
- if((sid = H5Screate_simple(rank,dims,NULL)) < 0)
+ if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
goto out;
- for(i = 0; i < 5; i++) {
- HDsprintf(dname,"dset_%d",i);
- if((did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 5; i++) {
+ HDsprintf(dname, "dset_%d", i);
+ if ((did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- HDsprintf(sname,"ds_%d",i);
- if((dsid = H5Dcreate2(gid, sname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ HDsprintf(sname, "ds_%d", i);
+ if ((dsid = H5Dcreate2(gid, sname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5DSset_scale(dsid,"scale") < 0)
+ if (H5DSset_scale(dsid, "scale") < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
/*-------------------------------------------------------------------------
- * attach for DIM 0
- *-------------------------------------------------------------------------
- */
+ * attach for DIM 0
+ *-------------------------------------------------------------------------
+ */
- for(i = 0; i < 5; i++) {
+ for (i = 0; i < 5; i++) {
HDsprintf(dname, "dset_%d", i);
- if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0)
goto out;
- for(j = 0; j < 5; j++) {
+ for (j = 0; j < 5; j++) {
HDsprintf(sname, "ds_%d", j);
- if((dsid = H5Dopen2(gid, sname, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(gid, sname, H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did, dsid, DIM0) < 0)
+ if (H5DSattach_scale(did, dsid, DIM0) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
}
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
/*-------------------------------------------------------------------------
- * dettach for DIM0
- *-------------------------------------------------------------------------
- */
+ * dettach for DIM0
+ *-------------------------------------------------------------------------
+ */
- for(i = 0; i < 5; i++) {
+ for (i = 0; i < 5; i++) {
HDsprintf(dname, "dset_%d", i);
- if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0)
goto out;
- for(j = 0; j < 5; j++) {
+ for (j = 0; j < 5; j++) {
HDsprintf(sname, "ds_%d", j);
- if((dsid = H5Dopen2(gid, sname, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(gid, sname, H5P_DEFAULT)) < 0)
goto out;
- if(H5DSdetach_scale(did, dsid, DIM0) < 0)
+ if (H5DSdetach_scale(did, dsid, DIM0) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
}
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
-
/*-------------------------------------------------------------------------
- * attach again for DIM0
- *-------------------------------------------------------------------------
- */
+ * attach again for DIM0
+ *-------------------------------------------------------------------------
+ */
- for(i=0; i<5; i++) {
- HDsprintf(dname,"dset_%d",i);
- if((did = H5Dopen2(gid,dname, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 5; i++) {
+ HDsprintf(dname, "dset_%d", i);
+ if ((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0)
goto out;
- for(j=0; j<5; j++) {
- HDsprintf(sname,"ds_%d",j);
- if((dsid = H5Dopen2(gid,sname, H5P_DEFAULT)) < 0)
+ for (j = 0; j < 5; j++) {
+ HDsprintf(sname, "ds_%d", j);
+ if ((dsid = H5Dopen2(gid, sname, H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did,dsid,DIM0) < 0)
+ if (H5DSattach_scale(did, dsid, DIM0) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
}
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
}
/* close */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
-
-
/*-------------------------------------------------------------------------
- * create a dataset and attach only to 1 dimension
- *-------------------------------------------------------------------------
- */
+ * create a dataset and attach only to 1 dimension
+ *-------------------------------------------------------------------------
+ */
/* make a dataset */
- if(H5LTmake_dataset_int(fid,"dset_e",rank,dims,NULL) < 0)
+ if (H5LTmake_dataset_int(fid, "dset_e", rank, dims, NULL) < 0)
goto out;
/* make a scale */
- if(H5LTmake_dataset_int(fid,"ds_e_1",rankds,s1_dim,NULL) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_e_1", rankds, s1_dim, NULL) < 0)
goto out;
/* attach the DS to dimension 1 */
- if((did = H5Dopen2(fid,"dset_e", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_e", H5P_DEFAULT)) < 0)
goto out;
- if((dsid = H5Dopen2(fid,"ds_e_1", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_e_1", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did,dsid,DIM1) < 0)
+ if (H5DSattach_scale(did, dsid, DIM1) < 0)
goto out;
- if(H5DSis_attached(did,dsid,DIM1)<=0)
+ if (H5DSis_attached(did, dsid, DIM1) <= 0)
goto out;
-
/* try to detach all dimensions. for dimensions 0 and 2, it is an error */
- for(i=0; i<rank; i++) {
- if( i==1 ) {
- if(H5DSdetach_scale(did,dsid,(unsigned)i) < 0)
+ for (i = 0; i < rank; i++) {
+ if (i == 1) {
+ if (H5DSdetach_scale(did, dsid, (unsigned)i) < 0)
goto out;
}
else {
- if(H5DSdetach_scale(did,dsid,(unsigned)i)!=FAIL)
+ if (H5DSdetach_scale(did, dsid, (unsigned)i) != FAIL)
goto out;
}
}
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
PASSED();
-
-
/*-------------------------------------------------------------------------
- * H5DSset_label, H5DSget_label
- *-------------------------------------------------------------------------
- */
+ * H5DSset_label, H5DSget_label
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("set/get label");
- if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * set label
- *-------------------------------------------------------------------------
- */
+ * set label
+ *-------------------------------------------------------------------------
+ */
- if(H5DSset_label(did,DIM0,DIM0_LABEL) < 0)
+ if (H5DSset_label(did, DIM0, DIM0_LABEL) < 0)
goto out;
/* check getting a label which does not exist */
- if(H5DSget_label(did,DIM1,dim1_label,sizeof(dim1_label)) != 0)
+ if (H5DSget_label(did, DIM1, dim1_label, sizeof(dim1_label)) != 0)
goto out;
- if(H5DSset_label(did,DIM1,DIM1_LABEL) < 0)
+ if (H5DSset_label(did, DIM1, DIM1_LABEL) < 0)
goto out;
/*-------------------------------------------------------------------------
- * get the scale name using a static buffer
- *-------------------------------------------------------------------------
- */
+ * get the scale name using a static buffer
+ *-------------------------------------------------------------------------
+ */
- if(H5DSget_label(did,DIM0,dim0_label,sizeof(dim0_label)) < 0)
+ if (H5DSget_label(did, DIM0, dim0_label, sizeof(dim0_label)) < 0)
goto out;
- if(H5DSget_label(did,DIM1,dim1_label,sizeof(dim1_label)) < 0)
+ if (H5DSget_label(did, DIM1, dim1_label, sizeof(dim1_label)) < 0)
goto out;
- if(HDstrncmp(DIM0_LABEL,dim0_label,sizeof(dim0_label))!=0)
+ if (HDstrncmp(DIM0_LABEL, dim0_label, sizeof(dim0_label)) != 0)
goto out;
- if(HDstrncmp(DIM1_LABEL,dim1_label,sizeof(dim1_label))!=0)
+ if (HDstrncmp(DIM1_LABEL, dim1_label, sizeof(dim1_label)) != 0)
goto out;
/*-------------------------------------------------------------------------
- * get the scale name using a dynamic buffer
- *-------------------------------------------------------------------------
- */
+ * get the scale name using a dynamic buffer
+ *-------------------------------------------------------------------------
+ */
- if((dim0_label_size=H5DSget_label(did,DIM0,NULL,(size_t)0)) < 0)
+ if ((dim0_label_size = H5DSget_label(did, DIM0, NULL, (size_t)0)) < 0)
goto out;
- if((dim1_label_size=H5DSget_label(did,DIM1,NULL,(size_t)0)) < 0)
+ if ((dim1_label_size = H5DSget_label(did, DIM1, NULL, (size_t)0)) < 0)
goto out;
/* allocate */
- dim0_labeld = (char*)HDmalloc((size_t)dim0_label_size * sizeof (char));
- dim1_labeld = (char*)HDmalloc((size_t)dim1_label_size * sizeof (char));
- if( dim0_labeld==NULL || dim1_labeld==NULL)
+ dim0_labeld = (char *)HDmalloc((size_t)dim0_label_size * sizeof(char));
+ dim1_labeld = (char *)HDmalloc((size_t)dim1_label_size * sizeof(char));
+ if (dim0_labeld == NULL || dim1_labeld == NULL)
goto out;
- if(H5DSget_label(did,DIM0,dim0_labeld,(size_t)dim0_label_size) < 0)
+ if (H5DSget_label(did, DIM0, dim0_labeld, (size_t)dim0_label_size) < 0)
goto out;
- if(H5DSget_label(did,DIM1,dim1_labeld,(size_t)dim1_label_size) < 0)
+ if (H5DSget_label(did, DIM1, dim1_labeld, (size_t)dim1_label_size) < 0)
goto out;
- if(HDstrncmp(DIM0_LABEL,dim0_labeld,(size_t)(dim0_label_size-1))!=0)
+ if (HDstrncmp(DIM0_LABEL, dim0_labeld, (size_t)(dim0_label_size - 1)) != 0)
goto out;
- if(HDstrncmp(DIM1_LABEL,dim1_labeld,(size_t)(dim1_label_size-1))!=0)
+ if (HDstrncmp(DIM1_LABEL, dim1_labeld, (size_t)(dim1_label_size - 1)) != 0)
goto out;
- if(dim0_labeld) {
+ if (dim0_labeld) {
HDfree(dim0_labeld);
- dim0_labeld=NULL;
+ dim0_labeld = NULL;
}
- if(dim1_labeld) {
+ if (dim1_labeld) {
HDfree(dim1_labeld);
- dim1_labeld=NULL;
+ dim1_labeld = NULL;
}
-
/*-------------------------------------------------------------------------
- * get the label using a static buffer smaller than the string length
- *-------------------------------------------------------------------------
- */
+ * get the label using a static buffer smaller than the string length
+ *-------------------------------------------------------------------------
+ */
- if(H5DSget_label(did,DIM0,dim0_labels,sizeof(dim0_labels)) < 0)
+ if (H5DSget_label(did, DIM0, dim0_labels, sizeof(dim0_labels)) < 0)
goto out;
- if(H5DSget_label(did,DIM1,dim1_labels,sizeof(dim1_labels)) < 0)
+ if (H5DSget_label(did, DIM1, dim1_labels, sizeof(dim1_labels)) < 0)
goto out;
- if(HDstrncmp(DIM0_LABEL,dim0_labels,sizeof(dim0_labels)-1)!=0)
+ if (HDstrncmp(DIM0_LABEL, dim0_labels, sizeof(dim0_labels) - 1) != 0)
goto out;
- if(HDstrncmp(DIM1_LABEL,dim1_labels,sizeof(dim1_labels)-1)!=0)
+ if (HDstrncmp(DIM1_LABEL, dim1_labels, sizeof(dim1_labels) - 1) != 0)
goto out;
- if(H5Dclose(did))
+ if (H5Dclose(did))
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * H5DSget_scale_name, H5DSget_scale_name
- *-------------------------------------------------------------------------
- */
-
+ * H5DSget_scale_name, H5DSget_scale_name
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("set scale/get scale name");
- if((dsid = H5Dopen2(fid,"ds_a_1", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_a_1", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSset_scale(dsid,"Latitude set 0") < 0)
+ if (H5DSset_scale(dsid, "Latitude set 0") < 0)
goto out;
/* verify that DS_1_NAME is a dimension scale dataset */
- if((H5DSis_scale(dsid)) == 0)
+ if ((H5DSis_scale(dsid)) == 0)
goto out;
/*-------------------------------------------------------------------------
- * get the scale name using a dynamic buffer
- *-------------------------------------------------------------------------
- */
+ * get the scale name using a dynamic buffer
+ *-------------------------------------------------------------------------
+ */
/* get the length of the scale name (pass NULL in name) */
- if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) < 0)
+ if ((name_len = H5DSget_scale_name(dsid, NULL, (size_t)0)) < 0)
goto out;
/* allocate a buffer */
- name_out = (char*)HDmalloc(((size_t)name_len+1) * sizeof (char));
- if(name_out == NULL)
+ name_out = (char *)HDmalloc(((size_t)name_len + 1) * sizeof(char));
+ if (name_out == NULL)
goto out;
/* get the scale name using this buffer */
- if(H5DSget_scale_name(dsid, name_out, (size_t)name_len+1) < 0)
+ if (H5DSget_scale_name(dsid, name_out, (size_t)name_len + 1) < 0)
goto out;
- if(HDstrncmp("Latitude set 0",name_out, (size_t)name_len)!=0)
+ if (HDstrncmp("Latitude set 0", name_out, (size_t)name_len) != 0)
goto out;
- if(name_out) {
+ if (name_out) {
HDfree(name_out);
- name_out=NULL;
+ name_out = NULL;
}
/*-------------------------------------------------------------------------
- * get the scale name using a static buffer
- *-------------------------------------------------------------------------
- */
+ * get the scale name using a static buffer
+ *-------------------------------------------------------------------------
+ */
/* get the scale name using this buffer */
- if(H5DSget_scale_name(dsid, sname, sizeof(sname)) < 0)
+ if (H5DSget_scale_name(dsid, sname, sizeof(sname)) < 0)
goto out;
- if(HDstrncmp("Latitude set 0", sname, sizeof(sname))!=0)
+ if (HDstrncmp("Latitude set 0", sname, sizeof(sname)) != 0)
goto out;
/*-------------------------------------------------------------------------
- * get the scale name using a static buffer smaller than the string length
- *-------------------------------------------------------------------------
- */
+ * get the scale name using a static buffer smaller than the string length
+ *-------------------------------------------------------------------------
+ */
/* get the scale name using this buffer */
- if(H5DSget_scale_name(dsid, snames, sizeof (snames)) < 0)
+ if (H5DSget_scale_name(dsid, snames, sizeof(snames)) < 0)
goto out;
- if(HDstrncmp("Latitude set 0",snames,sizeof(snames)-1)!=0)
+ if (HDstrncmp("Latitude set 0", snames, sizeof(snames) - 1) != 0)
goto out;
- if(H5Dclose(dsid))
+ if (H5Dclose(dsid))
goto out;
/*-------------------------------------------------------------------------
- * add scale names
- *-------------------------------------------------------------------------
- */
+ * add scale names
+ *-------------------------------------------------------------------------
+ */
- if((dsid = H5Dopen2(fid,"ds_a_11", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_a_11", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSset_scale(dsid,"Latitude set 1") < 0)
+ if (H5DSset_scale(dsid, "Latitude set 1") < 0)
goto out;
- if(H5Dclose(dsid))
+ if (H5Dclose(dsid))
goto out;
- if((dsid = H5Dopen2(fid,"ds_a_2", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_a_2", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSset_scale(dsid,"Longitude set 0") < 0)
+ if (H5DSset_scale(dsid, "Longitude set 0") < 0)
goto out;
- if(H5Dclose(dsid))
+ if (H5Dclose(dsid))
goto out;
- if((dsid = H5Dopen2(fid,"ds_a_21", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_a_21", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSset_scale(dsid,"Longitude set 1") < 0)
+ if (H5DSset_scale(dsid, "Longitude set 1") < 0)
goto out;
- if(H5Dclose(dsid))
+ if (H5Dclose(dsid))
goto out;
- if((dsid = H5Dopen2(fid,"ds_a_22", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_a_22", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSset_scale(dsid,"Longitude set 2") < 0)
+ if (H5DSset_scale(dsid, "Longitude set 2") < 0)
goto out;
- if(H5Dclose(dsid))
+ if (H5Dclose(dsid))
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * H5DSiterate_scales
- *-------------------------------------------------------------------------
- */
-
+ * H5DSiterate_scales
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("iterate scales");
-
/*-------------------------------------------------------------------------
- * test 6: test iterate scales with a function verify_scale
- *-------------------------------------------------------------------------
- */
+ * test 6: test iterate scales with a function verify_scale
+ *-------------------------------------------------------------------------
+ */
/* get the dataset id for "dset_a" */
- if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
dim = 0;
/* iterate trough the 1st dimension of "dset_a" and verify that its DS is valid */
- if(H5DSiterate_scales(did,dim,NULL,verify_scale,NULL) < 0)
+ if (H5DSiterate_scales(did, dim, NULL, verify_scale, NULL) < 0)
goto out;
/* iterate trough the 2nd dimension of "dset_a" and verify that its DS is valid
start at DS index 2 */
- dim = 1;
+ dim = 1;
scale_idx = 2;
- if(H5DSiterate_scales(did,dim,&scale_idx,verify_scale,NULL) < 0)
+ if (H5DSiterate_scales(did, dim, &scale_idx, verify_scale, NULL) < 0)
goto out;
/* close dataset ID of "dset_a" */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * test iterate scales with a function read_scale
- *-------------------------------------------------------------------------
- */
-
+ * test iterate scales with a function read_scale
+ *-------------------------------------------------------------------------
+ */
/* get the dataset id for "dset_a" */
- if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
dim = 0;
/* iterate trough the 1st dimension of "dset_a" and read the DS */
- if(H5DSiterate_scales(did,dim,NULL,read_scale,s1_wbuf) < 0)
+ if (H5DSiterate_scales(did, dim, NULL, read_scale, s1_wbuf) < 0)
goto out;
/* iterate trough the 2nd dimension of "dset_a" and read the DS
start at DS index 2 */
- dim = 1;
+ dim = 1;
scale_idx = 2;
- if(H5DSiterate_scales(did, dim, &scale_idx, read_scale, s22_wbuf) < 0)
+ if (H5DSiterate_scales(did, dim, &scale_idx, read_scale, s22_wbuf) < 0)
goto out;
/* close dataset ID of "dset_a" */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * test iterate scales with a function match_dim_scale
- *-------------------------------------------------------------------------
- */
+ * test iterate scales with a function match_dim_scale
+ *-------------------------------------------------------------------------
+ */
/* get the dataset id for "dset_a" */
- if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
/* get dataset space */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto out;
/* get rank */
- if((rank = H5Sget_simple_extent_ndims(sid)) < 0)
+ if ((rank = H5Sget_simple_extent_ndims(sid)) < 0)
goto out;
/* get dimensions of dataset */
- if(H5Sget_simple_extent_dims(sid,dims,NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
goto out;
{
- int match_size; /* does this scale size matches the dataset DIM size */
- int idx = 0; /* scale index to start iterating, on return, index where iterator stoped */
+ int match_size; /* does this scale size matches the dataset DIM size */
+ int idx = 0; /* scale index to start iterating, on return, index where iterator stoped */
/* iterate trough all the dimensions */
- for(dim=0; dim<(unsigned)rank; dim++) {
- if((match_size=H5DSiterate_scales(did,dim,&idx,match_dim_scale,NULL)) < 0)
+ for (dim = 0; dim < (unsigned)rank; dim++) {
+ if ((match_size = H5DSiterate_scales(did, dim, &idx, match_dim_scale, NULL)) < 0)
goto out;
/* "dset_a" was defined with all dimension scales size matching the size of its dimensions */
- if(match_size==0)
+ if (match_size == 0)
goto out;
/* both DS_1_NAME and DS_2_NAME are the on the first index */
- if(idx!=0)
+ if (idx != 0)
goto out;
}
}
-
/* close */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * test iterate scales with a function match_dim_scale
- *-------------------------------------------------------------------------
- */
+ * test iterate scales with a function match_dim_scale
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * create 3 datasets: 1 "data" dataset and dimension scales (some are empty)
- *-------------------------------------------------------------------------
- */
- if(H5LTmake_dataset_int(fid, "dset_f", rank, dims, buf) < 0)
+ * create 3 datasets: 1 "data" dataset and dimension scales (some are empty)
+ *-------------------------------------------------------------------------
+ */
+ if (H5LTmake_dataset_int(fid, "dset_f", rank, dims, buf) < 0)
goto out;
- if(H5LTmake_dataset_int(fid,"ds_f_1",rankds,s1_dim,NULL) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_f_1", rankds, s1_dim, NULL) < 0)
goto out;
- if(H5LTmake_dataset_int(fid, "ds_f_11", rankds, s1_dim, s1_wbuf) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_f_11", rankds, s1_dim, s1_wbuf) < 0)
goto out;
- if(H5LTmake_dataset_int(fid,"ds_f_2",rankds,s2_dim,NULL) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_f_2", rankds, s2_dim, NULL) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attach them
- *-------------------------------------------------------------------------
- */
- if((did = H5Dopen2(fid,"dset_f", H5P_DEFAULT)) < 0)
+ * attach them
+ *-------------------------------------------------------------------------
+ */
+ if ((did = H5Dopen2(fid, "dset_f", H5P_DEFAULT)) < 0)
goto out;
- if((dsid = H5Dopen2(fid,"ds_f_1", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_f_1", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did,dsid,DIM0) < 0)
+ if (H5DSattach_scale(did, dsid, DIM0) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if((dsid = H5Dopen2(fid,"ds_f_11", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_f_11", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did,dsid,DIM0) < 0)
+ if (H5DSattach_scale(did, dsid, DIM0) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if((dsid = H5Dopen2(fid,"ds_f_2", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_f_2", H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did,dsid,DIM1) < 0)
+ if (H5DSattach_scale(did, dsid, DIM1) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/*-------------------------------------------------------------------------
- * verify match
- *-------------------------------------------------------------------------
- */
+ * verify match
+ *-------------------------------------------------------------------------
+ */
/* get the dataset id for "dset_f" */
- if((did = H5Dopen2(fid,"dset_f", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_f", H5P_DEFAULT)) < 0)
goto out;
/* get dataset space */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto out;
/* get rank */
- if((rank = H5Sget_simple_extent_ndims(sid)) < 0)
+ if ((rank = H5Sget_simple_extent_ndims(sid)) < 0)
goto out;
/* get dimensions of dataset */
- if(H5Sget_simple_extent_dims(sid,dims,NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
goto out;
{
int match_size; /* does this scale size matches the dataset DIM size */
int idx; /* scale index to start iterating, on return, index where iterator stoped */
/* iterate trough all the dimensions */
- for(dim=0; dim<(unsigned)rank; dim++) {
+ for (dim = 0; dim < (unsigned)rank; dim++) {
/* always start at 1st scale */
- idx=0;
+ idx = 0;
- if((match_size=H5DSiterate_scales(did,dim,&idx,match_dim_scale,NULL)) < 0)
+ if ((match_size = H5DSiterate_scales(did, dim, &idx, match_dim_scale, NULL)) < 0)
goto out;
/* "dset_e" was defined with :
dim 0: 2 scales, first is empty
dim 1: 1 scale, empty */
- switch(dim) {
- case 0: /* for DIM 0, we get a valid scale at IDX 1 */
- if(match_size!=1 && idx!=1)
- goto out;
- break;
- case 1: /* for DIM 1, we get no valid scales */
- if(match_size!=0 && idx!=0)
- goto out;
- break;
- default:
- HDassert(0);
- break;
- }/*switch*/
- }/*for*/
+ switch (dim) {
+ case 0: /* for DIM 0, we get a valid scale at IDX 1 */
+ if (match_size != 1 && idx != 1)
+ goto out;
+ break;
+ case 1: /* for DIM 1, we get no valid scales */
+ if (match_size != 0 && idx != 0)
+ goto out;
+ break;
+ default:
+ HDassert(0);
+ break;
+ } /*switch*/
+ } /*for*/
}
/* close */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
PASSED();
-
/*-------------------------------------------------------------------------
- * end
- *-------------------------------------------------------------------------
- */
+ * end
+ *-------------------------------------------------------------------------
+ */
/* close */
H5Fclose(fid);
return 0;
- /* error zone */
- out:
+/* error zone */
+out:
H5E_BEGIN_TRY
{
H5Dclose(did);
@@ -3433,13 +3524,12 @@ static int test_simple(void)
H5Fclose(fid);
H5Sclose(sid);
H5Gclose(gid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-
-
/*-------------------------------------------------------------------------
* Function: verify_scale
*
@@ -3457,29 +3547,29 @@ static int test_simple(void)
*-------------------------------------------------------------------------
*/
-static herr_t verify_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
+static herr_t
+verify_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
{
/* define a default zero value for return. This will cause the iterator to continue */
int ret = 0;
/* unused */
- dset=dset;
- dim=dim;
- visitor_data=visitor_data;
+ dset = dset;
+ dim = dim;
+ visitor_data = visitor_data;
/* define a positive value for return value. This will cause the iterator to
immediately return that positive value, indicating short-circuit success
*/
/* the parameter DS dataset must be a valid DS dataset */
- if((H5DSis_scale(scale_id))==1) {
+ if ((H5DSis_scale(scale_id)) == 1) {
ret = 1;
}
return ret;
}
-
/*-------------------------------------------------------------------------
* Function: read_scale
*
@@ -3498,47 +3588,48 @@ static herr_t verify_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visit
*-------------------------------------------------------------------------
*/
-static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
+static herr_t
+read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
{
- int ret = 0; /* define a default zero value for return. This will cause the iterator to continue */
- hid_t sid = -1; /* space ID */
- hid_t tid = -1; /* file type ID */
+ int ret = 0; /* define a default zero value for return. This will cause the iterator to continue */
+ hid_t sid = -1; /* space ID */
+ hid_t tid = -1; /* file type ID */
hid_t mtid = -1; /* memory type ID */
hssize_t nelmts; /* number of data elements */
- char *buf=NULL; /* data buffer */
+ char * buf = NULL; /* data buffer */
size_t size;
int i;
- char *data = (char*) visitor_data;
+ char * data = (char *)visitor_data;
/* unused */
- dset=dset;
- dim=dim;
+ dset = dset;
+ dim = dim;
/* get space */
- if((sid = H5Dget_space(scale_id)) < 0)
+ if ((sid = H5Dget_space(scale_id)) < 0)
goto out;
/* get type */
- if((tid = H5Dget_type(scale_id)) < 0)
+ if ((tid = H5Dget_type(scale_id)) < 0)
goto out;
/* get size of the DS array */
- if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0)
+ if ((nelmts = H5Sget_simple_extent_npoints(sid)) < 0)
goto out;
/* get type */
- if((mtid=H5Tget_native_type(tid,H5T_DIR_DEFAULT)) < 0)
+ if ((mtid = H5Tget_native_type(tid, H5T_DIR_DEFAULT)) < 0)
goto out;
/* get type size */
- if((size=H5Tget_size(mtid))==0)
+ if ((size = H5Tget_size(mtid)) == 0)
goto out;
- if(nelmts) {
- buf=(char *)HDmalloc(((size_t)nelmts*size));
- if(buf==NULL)
+ if (nelmts) {
+ buf = (char *)HDmalloc(((size_t)nelmts * size));
+ if (buf == NULL)
goto out;
- if(H5Dread(scale_id,mtid,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0)
+ if (H5Dread(scale_id, mtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
- for(i=0; i<nelmts; i++) {
- if(buf[i] != data[i]) {
+ for (i = 0; i < nelmts; i++) {
+ if (buf[i] != data[i]) {
HDprintf("read and write buffers differ\n");
goto out;
}
@@ -3546,33 +3637,33 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor
} /* if */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
- if(H5Tclose(mtid) < 0)
+ if (H5Tclose(mtid) < 0)
goto out;
- if(buf)
+ if (buf)
HDfree(buf);
-
return ret;
/* error zone */
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Tclose(tid);
H5Tclose(mtid);
- if(buf) {
+ if (buf) {
HDfree(buf);
}
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
}
-
/*-------------------------------------------------------------------------
* Function: match_dim_scale
*
@@ -3590,71 +3681,70 @@ out:
*-------------------------------------------------------------------------
*/
-static herr_t match_dim_scale(hid_t did, unsigned dim, hid_t dsid, void *visitor_data)
+static herr_t
+match_dim_scale(hid_t did, unsigned dim, hid_t dsid, void *visitor_data)
{
- int ret = 0; /* define a default zero value for return. This will cause the iterator to continue */
- hid_t sid; /* space ID */
- hssize_t nelmts; /* size of a dimension scale array */
- hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
- hsize_t storage_size;
+ int ret = 0; /* define a default zero value for return. This will cause the iterator to continue */
+ hid_t sid; /* space ID */
+ hssize_t nelmts; /* size of a dimension scale array */
+ hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
+ hsize_t storage_size;
/* Stop compiler from whining about "unused parameters" */
visitor_data = visitor_data;
/*-------------------------------------------------------------------------
- * get DID (dataset) space info
- *-------------------------------------------------------------------------
- */
+ * get DID (dataset) space info
+ *-------------------------------------------------------------------------
+ */
/* get dataset space */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto out;
/* get dimensions of dataset */
- if(H5Sget_simple_extent_dims(sid,dims,NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
goto out;
/* close the dataspace id */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * get DSID (scale) space info
- *-------------------------------------------------------------------------
- */
+ * get DSID (scale) space info
+ *-------------------------------------------------------------------------
+ */
/* get the space for the scale */
- if((sid = H5Dget_space(dsid)) < 0)
+ if ((sid = H5Dget_space(dsid)) < 0)
goto out;
/* get size of the DS array */
- if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0)
+ if ((nelmts = H5Sget_simple_extent_npoints(sid)) < 0)
goto out;
/* close */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
/* the size of the DS array must match the dimension of the dataset */
- if(nelmts == (hssize_t)dims[dim])
+ if (nelmts == (hssize_t)dims[dim])
ret = 1;
/* if the scale is empty assume it cannot be used */
- storage_size=H5Dget_storage_size(dsid);
+ storage_size = H5Dget_storage_size(dsid);
- if(storage_size==0)
+ if (storage_size == 0)
ret = 0;
return ret;
out:
- H5E_BEGIN_TRY {
- H5Sclose(sid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Sclose(sid); }
+ H5E_END_TRY;
return FAIL;
}
-
/*-------------------------------------------------------------------------
* Function: op_continue
*
@@ -3672,14 +3762,15 @@ out:
*-------------------------------------------------------------------------
*/
-static herr_t op_continue(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
+static herr_t
+op_continue(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
{
/* Stop compiler from whining about "unused parameters" */
- dset = dset;
- dim = dim;
+ dset = dset;
+ dim = dim;
scale_id = scale_id;
- if ( visitor_data != NULL ) {
+ if (visitor_data != NULL) {
(*(int *)visitor_data)++;
}
@@ -3704,14 +3795,15 @@ static herr_t op_continue(hid_t dset, unsigned dim, hid_t scale_id, void *visito
*-------------------------------------------------------------------------
*/
-static herr_t op_stop(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
+static herr_t
+op_stop(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
{
/* Stop compiler from whining about "unused parameters" */
- dset = dset;
- dim = dim;
+ dset = dset;
+ dim = dim;
scale_id = scale_id;
- if ( visitor_data != NULL ) {
+ if (visitor_data != NULL) {
(*(int *)visitor_data)++;
}
@@ -3724,360 +3816,356 @@ static herr_t op_stop(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_da
*-------------------------------------------------------------------------
*/
-static int test_errors(void)
+static int
+test_errors(void)
{
- hid_t fid; /* file ID */
- int rank = RANK; /* rank of data dataset */
- int rankds = 1; /* rank of DS dataset */
- hsize_t dims[RANK] = {DIM1_SIZE,DIM2_SIZE}; /* size of data dataset */
- hsize_t s1_dim[1] = {DIM1_SIZE}; /* size of DS 1 dataset */
- hid_t did = -1; /* dataset ID */
- hid_t dsid = -1; /* scale ID */
- hid_t gid = -1; /* group ID */
- hid_t sid = -1; /* space ID */
- hid_t sidds = -1; /* space ID */
- hsize_t pal_dims[] = {9,3};
+ hid_t fid; /* file ID */
+ int rank = RANK; /* rank of data dataset */
+ int rankds = 1; /* rank of DS dataset */
+ hsize_t dims[RANK] = {DIM1_SIZE, DIM2_SIZE}; /* size of data dataset */
+ hsize_t s1_dim[1] = {DIM1_SIZE}; /* size of DS 1 dataset */
+ hid_t did = -1; /* dataset ID */
+ hid_t dsid = -1; /* scale ID */
+ hid_t gid = -1; /* group ID */
+ hid_t sid = -1; /* space ID */
+ hid_t sidds = -1; /* space ID */
+ hsize_t pal_dims[] = {9, 3};
HDprintf("Testing error conditions\n");
/*-------------------------------------------------------------------------
- * create a file, spaces, dataset and group ids
- *-------------------------------------------------------------------------
- */
+ * create a file, spaces, dataset and group ids
+ *-------------------------------------------------------------------------
+ */
/* create a file using default properties */
- if((fid = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* create a group */
- if((gid = H5Gcreate2(fid, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* create the data space for the dataset */
- if((sid = H5Screate_simple(rank, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
goto out;
/* create the data space for the scale */
- if((sidds = H5Screate_simple(rankds, s1_dim, NULL)) < 0)
+ if ((sidds = H5Screate_simple(rankds, s1_dim, NULL)) < 0)
goto out;
/* create a dataset */
- if((did = H5Dcreate2(fid, "dset_a", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dset_a", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* create a dataset for the scale */
- if((dsid = H5Dcreate2(fid, "ds_a", H5T_NATIVE_INT, sidds, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, "ds_a", H5T_NATIVE_INT, sidds, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attempt to attach a dataset to itself, it should fail
- *-------------------------------------------------------------------------
- */
+ * attempt to attach a dataset to itself, it should fail
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("attach a dataset to itself");
- if(H5DSattach_scale(did, did, 0) == SUCCEED)
+ if (H5DSattach_scale(did, did, 0) == SUCCEED)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * attempt to attach a group with a dataset, it should fail
- *-------------------------------------------------------------------------
- */
+ * attempt to attach a group with a dataset, it should fail
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("attach a group with a dataset");
- if(H5DSattach_scale(gid,dsid,0)==SUCCEED)
+ if (H5DSattach_scale(gid, dsid, 0) == SUCCEED)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * attempt to attach a dataset with a group, it should fail
- *-------------------------------------------------------------------------
- */
+ * attempt to attach a dataset with a group, it should fail
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("attach a dataset with a group");
- if(H5DSattach_scale(did,gid,0)==SUCCEED)
+ if (H5DSattach_scale(did, gid, 0) == SUCCEED)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * attempt to set scale for a group, it should fail
- *-------------------------------------------------------------------------
- */
+ * attempt to set scale for a group, it should fail
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("set scale for a group");
- if(H5DSset_scale(gid,"scale 1")==SUCCEED)
+ if (H5DSset_scale(gid, "scale 1") == SUCCEED)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * close IDs for this set
- *-------------------------------------------------------------------------
- */
+ * close IDs for this set
+ *-------------------------------------------------------------------------
+ */
/* close */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Sclose(sidds) < 0)
+ if (H5Sclose(sidds) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * try to attach a scale that has scales
- *-------------------------------------------------------------------------
- */
+ * try to attach a scale that has scales
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("attach a scale that has scales");
/* create the data space for the scale */
- if((sidds = H5Screate_simple(rankds, s1_dim, NULL)) < 0)
+ if ((sidds = H5Screate_simple(rankds, s1_dim, NULL)) < 0)
goto out;
/* create a dataset "ds_b" for the scale */
- if((dsid = H5Dcreate2(fid, "ds_b", H5T_NATIVE_INT, sidds, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, "ds_b", H5T_NATIVE_INT, sidds, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* open the previous written "ds_a" */
- if((did = H5Dopen2(fid,"ds_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "ds_a", H5P_DEFAULT)) < 0)
goto out;
/* attach "ds_b" to "ds_a", valid */
- if(H5DSattach_scale(did, dsid, 0) < 0)
+ if (H5DSattach_scale(did, dsid, 0) < 0)
goto out;
/* close */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
- if(H5Sclose(sidds) < 0)
+ if (H5Sclose(sidds) < 0)
goto out;
/* open the previous written "dset_a" */
- if((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
/* open the previous written "ds_a" */
- if((dsid = H5Dopen2(fid, "ds_a", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_a", H5P_DEFAULT)) < 0)
goto out;
/* try to attach "ds_a" to "dset_a", not valid */
- if(H5DSattach_scale(did,dsid,0)==SUCCEED)
+ if (H5DSattach_scale(did, dsid, 0) == SUCCEED)
goto out;
/* close */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/* open the previous written "ds_a" */
- if((did = H5Dopen2(fid,"ds_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "ds_a", H5P_DEFAULT)) < 0)
goto out;
/* open the previous written "ds_b" */
- if((dsid = H5Dopen2(fid,"ds_b", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_b", H5P_DEFAULT)) < 0)
goto out;
/* detach "ds_b" to "ds_a" */
- if(H5DSdetach_scale(did,dsid,0) < 0)
+ if (H5DSdetach_scale(did, dsid, 0) < 0)
goto out;
/* close */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * try to attach a dataset that is a scale
- *-------------------------------------------------------------------------
- */
+ * try to attach a dataset that is a scale
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("attach to a dataset that is a scale");
/* open the previous written "ds_b", that is a scale */
- if((dsid = H5Dopen2(fid,"ds_b", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_b", H5P_DEFAULT)) < 0)
goto out;
/* open the previous written "ds_a" */
- if((did = H5Dopen2(fid,"ds_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "ds_a", H5P_DEFAULT)) < 0)
goto out;
/* try to attach "ds_a" to "ds_b", not valid */
- if(H5DSattach_scale(dsid,did,0)==SUCCEED)
+ if (H5DSattach_scale(dsid, did, 0) == SUCCEED)
goto out;
/* close */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * try to attach a scale to an image, pallete or table
- *-------------------------------------------------------------------------
- */
+ * try to attach a scale to an image, pallete or table
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("attach to a dataset that is a reserved class dataset");
/* make an image */
- if(H5IMmake_image_8bit(fid,"image",(hsize_t)100,(hsize_t)50,NULL) < 0)
+ if (H5IMmake_image_8bit(fid, "image", (hsize_t)100, (hsize_t)50, NULL) < 0)
goto out;
/* make a palette */
- if(H5IMmake_palette(fid,"pallete",pal_dims,NULL) < 0)
+ if (H5IMmake_palette(fid, "pallete", pal_dims, NULL) < 0)
goto out;
/* open the previous written "ds_b" */
- if((dsid = H5Dopen2(fid,"ds_b", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_b", H5P_DEFAULT)) < 0)
goto out;
/* open the image dataset */
- if((did = H5Dopen2(fid,"image", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "image", H5P_DEFAULT)) < 0)
goto out;
/* try to attach "ds_a" to the image, not valid */
- if(H5DSattach_scale(did,dsid,0)==SUCCEED)
+ if (H5DSattach_scale(did, dsid, 0) == SUCCEED)
goto out;
/* close */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * is scale
- *-------------------------------------------------------------------------
- */
+ * is scale
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("is scale");
/* open a non scale dataset */
- if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
/* verify that it is not a dimension scale dataset */
- if((H5DSis_scale(did))==1)
+ if ((H5DSis_scale(did)) == 1)
goto out;
/* close */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/* open the group. */
- if((gid = H5Gopen2(fid, "grp", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, "grp", H5P_DEFAULT)) < 0)
goto out;
/* verify that it is not a dimension scale dataset */
- if((H5DSis_scale(gid))==1)
+ if ((H5DSis_scale(gid)) == 1)
goto out;
/* close */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
PASSED();
-
/*-------------------------------------------------------------------------
- * detach
- *-------------------------------------------------------------------------
- */
+ * detach
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("detach scale from dataset it is not attached to");
/* open the previous written "ds_a" */
- if((dsid = H5Dopen2(fid,"ds_a", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_a", H5P_DEFAULT)) < 0)
goto out;
/* open the previous written "dset_a" */
- if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
/* try to detach "ds_a" from "dset_a" */
- if(H5DSdetach_scale(did,dsid,0)==SUCCEED)
+ if (H5DSdetach_scale(did, dsid, 0) == SUCCEED)
goto out;
/* close */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
PASSED();
-
/*-------------------------------------------------------------------------
- * detach
- *-------------------------------------------------------------------------
- */
+ * detach
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("detach scale from group");
/* open the previous written "ds_a" */
- if((dsid = H5Dopen2(fid,"ds_a", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_a", H5P_DEFAULT)) < 0)
goto out;
/* open the group. */
- if((gid = H5Gopen2(fid, "grp", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, "grp", H5P_DEFAULT)) < 0)
goto out;
/* try to detach "ds_a" from "grp" */
- if(H5DSdetach_scale(gid,dsid,0)==SUCCEED)
+ if (H5DSdetach_scale(gid, dsid, 0) == SUCCEED)
goto out;
/* close */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
PASSED();
-
/*-------------------------------------------------------------------------
- * detach
- *-------------------------------------------------------------------------
- */
+ * detach
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("detach scale when scale is group");
/* open the previous written "dset_a" */
- if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
/* open the group. */
- if((gid = H5Gopen2(fid, "grp", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, "grp", H5P_DEFAULT)) < 0)
goto out;
/* try to detach "grp" from "dset_a" */
- if(H5DSdetach_scale(did,gid,0)==SUCCEED)
+ if (H5DSdetach_scale(did, gid, 0) == SUCCEED)
goto out;
/* close */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
PASSED();
-
/* close */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto out;
return 0;
@@ -4092,183 +4180,180 @@ out:
H5Dclose(dsid);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-
-
/*-------------------------------------------------------------------------
* test iterators
*-------------------------------------------------------------------------
*/
-static int test_iterators(void)
+static int
+test_iterators(void)
{
- hid_t fid; /* file ID */
- int rank = RANK; /* rank of data dataset */
- int rankds = 1; /* rank of DS dataset */
- hsize_t dims[RANK] = {DIM1_SIZE,DIM2_SIZE}; /* size of data dataset */
- hsize_t s1_dim[1] = {DIM1_SIZE}; /* size of DS 1 dataset */
- hid_t gid = -1; /* group ID */
- hid_t did = -1; /* dataset ID */
- hid_t dsid = -1; /* scale ID */
- char dname[30]; /* dataset name */
+ hid_t fid; /* file ID */
+ int rank = RANK; /* rank of data dataset */
+ int rankds = 1; /* rank of DS dataset */
+ hsize_t dims[RANK] = {DIM1_SIZE, DIM2_SIZE}; /* size of data dataset */
+ hsize_t s1_dim[1] = {DIM1_SIZE}; /* size of DS 1 dataset */
+ hid_t gid = -1; /* group ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t dsid = -1; /* scale ID */
+ char dname[30]; /* dataset name */
int i;
HDprintf("Testing iterators\n");
/*-------------------------------------------------------------------------
- * create a file, spaces, dataset and group ids
- *-------------------------------------------------------------------------
- */
+ * create a file, spaces, dataset and group ids
+ *-------------------------------------------------------------------------
+ */
/* create a file using default properties */
- if((fid=H5Fcreate(FILE3,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* create a group */
- if((gid = H5Gcreate2(fid, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
/* make a dataset */
- if(H5LTmake_dataset_int(fid,"dset_a",rank,dims,NULL) < 0)
+ if (H5LTmake_dataset_int(fid, "dset_a", rank, dims, NULL) < 0)
goto out;
/* make a DS dataset */
- if(H5LTmake_dataset_int(fid,"ds_a",rankds,s1_dim,NULL) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_a", rankds, s1_dim, NULL) < 0)
goto out;
/*-------------------------------------------------------------------------
- * iterate when the dataset has no scales
- *-------------------------------------------------------------------------
- */
+ * iterate when the dataset has no scales
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("iterate when the dataset has no scales ");
/* get the dataset id for "dset_a" */
- if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
/* try to iterate trough the 1st dimension of "dset_a", return error */
- if(H5DSiterate_scales(did,0,NULL,verify_scale,NULL) < 0)
+ if (H5DSiterate_scales(did, 0, NULL, verify_scale, NULL) < 0)
goto out;
/* close */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
PASSED();
-
/*-------------------------------------------------------------------------
- * iterate on dimension that is outside the rank
- *-------------------------------------------------------------------------
- */
+ * iterate on dimension that is outside the rank
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("iterate on dimension that is outside the rank ");
/* get the dataset id for "dset_a" */
- if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
/* try to iterate trough the 3rd dimension of "dset_a", return error */
- if(H5DSiterate_scales(did,3,NULL,verify_scale,NULL)==SUCCEED)
+ if (H5DSiterate_scales(did, 3, NULL, verify_scale, NULL) == SUCCEED)
goto out;
/* close */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * iterate for dimension with many scales
- *-------------------------------------------------------------------------
- */
+ * iterate for dimension with many scales
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("iterate for dimension with many scales ");
/* open the previously written "dset_a" */
- if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
- for(i=0; i<100; i++) {
+ for (i = 0; i < 100; i++) {
/* make a DS */
- HDsprintf(dname,"ds_%d",i);
- if(H5LTmake_dataset_int(fid,dname,rankds,s1_dim,NULL) < 0)
+ HDsprintf(dname, "ds_%d", i);
+ if (H5LTmake_dataset_int(fid, dname, rankds, s1_dim, NULL) < 0)
goto out;
/* open */
- if((dsid = H5Dopen2(fid,dname, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
goto out;
/* attach */
- if(H5DSattach_scale(did,dsid,0) < 0)
+ if (H5DSattach_scale(did, dsid, 0) < 0)
goto out;
/* close */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
}
/* iterate trough the 1st dimension of "dset_a" */
- if(H5DSiterate_scales(did,0,NULL,op_continue,NULL) < 0)
+ if (H5DSiterate_scales(did, 0, NULL, op_continue, NULL) < 0)
goto out;
/* close */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * iterate on group
- *-------------------------------------------------------------------------
- */
+ * iterate on group
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("iterate on group ");
/* open */
- if((gid = H5Gopen2(fid, "grp", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, "grp", H5P_DEFAULT)) < 0)
goto out;
/* try to iterate, return error */
- if(H5DSiterate_scales(gid,0,NULL,verify_scale,NULL)==SUCCEED)
+ if (H5DSiterate_scales(gid, 0, NULL, verify_scale, NULL) == SUCCEED)
goto out;
/* close */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
PASSED();
-
/*-------------------------------------------------------------------------
- * iterate in deleted scales
- *-------------------------------------------------------------------------
- */
+ * iterate in deleted scales
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("iterate in deleted scales ");
- if(H5Ldelete(fid, "ds_0", H5P_DEFAULT) < 0)
+ if (H5Ldelete(fid, "ds_0", H5P_DEFAULT) < 0)
goto out;
/* open the previously written "dset_a" */
- if((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
/* iterate */
- if(H5DSiterate_scales(did, 0, NULL, op_continue, NULL) == SUCCEED)
+ if (H5DSiterate_scales(did, 0, NULL, op_continue, NULL) == SUCCEED)
goto out;
/* close */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
PASSED();
-
/* close */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto out;
return 0;
@@ -4280,201 +4365,202 @@ out:
H5Gclose(gid);
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-
/*-------------------------------------------------------------------------
* test several ranks
*-------------------------------------------------------------------------
*/
-static int test_rank(void)
+static int
+test_rank(void)
{
- hid_t fid; /* file ID */
- hid_t did = -1; /* dataset ID */
- hid_t dsid = -1; /* scale ID */
- hid_t sid = -1; /* space ID */
- hid_t sidds = -1; /* space ID */
- hsize_t dims1[1] = {DIM1_SIZE}; /* size of data dataset */
- hsize_t dims2[2] = {DIM1_SIZE,DIM2_SIZE}; /* size of data dataset */
- hsize_t dims3[3] = {DIM1_SIZE,DIM2_SIZE,DIM3_SIZE}; /* size of data dataset */
- hsize_t dimss[2] = {1,1}; /* size of data dataset */
- char name[30]; /* dataset name buffer */
- char names[30]; /* dataset scale name buffer */
- char namel[30]; /* dataset label name buffer */
- int bufi[1]={2};
- float buff[1]={1};
+ hid_t fid; /* file ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t dsid = -1; /* scale ID */
+ hid_t sid = -1; /* space ID */
+ hid_t sidds = -1; /* space ID */
+ hsize_t dims1[1] = {DIM1_SIZE}; /* size of data dataset */
+ hsize_t dims2[2] = {DIM1_SIZE, DIM2_SIZE}; /* size of data dataset */
+ hsize_t dims3[3] = {DIM1_SIZE, DIM2_SIZE, DIM3_SIZE}; /* size of data dataset */
+ hsize_t dimss[2] = {1, 1}; /* size of data dataset */
+ char name[30]; /* dataset name buffer */
+ char names[30]; /* dataset scale name buffer */
+ char namel[30]; /* dataset label name buffer */
+ int bufi[1] = {2};
+ float buff[1] = {1};
int i;
HDprintf("Testing ranks\n");
/*-------------------------------------------------------------------------
- * create a file, a dataset, scales
- *-------------------------------------------------------------------------
- */
+ * create a file, a dataset, scales
+ *-------------------------------------------------------------------------
+ */
/* create a file using default properties */
- if((fid=H5Fcreate(FILE4,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* make a dataset a 3D data dataset */
- if(H5LTmake_dataset_int(fid,"dset_a",3,dims3,NULL) < 0)
+ if (H5LTmake_dataset_int(fid, "dset_a", 3, dims3, NULL) < 0)
goto out;
/* make a 1D scale dataset */
- if(H5LTmake_dataset_int(fid,"ds_a_0",1,dims1,NULL) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_a_0", 1, dims1, NULL) < 0)
goto out;
/* make a 2D scale dataset */
- if(H5LTmake_dataset_int(fid,"ds_a_1",2,dims2,NULL) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_a_1", 2, dims2, NULL) < 0)
goto out;
/* make a 3D scale dataset */
- if(H5LTmake_dataset_int(fid,"ds_a_2",3,dims3,NULL) < 0)
+ if (H5LTmake_dataset_int(fid, "ds_a_2", 3, dims3, NULL) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attach
- *-------------------------------------------------------------------------
- */
+ * attach
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("attach");
- if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
- for(i=0; i<3; i++) {
- HDsprintf(name,"ds_a_%d",i);
- if((dsid = H5Dopen2(fid,name, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ HDsprintf(name, "ds_a_%d", i);
+ if ((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
goto out;
- if(H5DSattach_scale(did,dsid,(unsigned)i) < 0)
+ if (H5DSattach_scale(did, dsid, (unsigned)i) < 0)
goto out;
- if(H5DSis_attached(did,dsid,(unsigned)i)<=0)
+ if (H5DSis_attached(did, dsid, (unsigned)i) <= 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
}
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
PASSED();
-
/*-------------------------------------------------------------------------
- * detach
- *-------------------------------------------------------------------------
- */
+ * detach
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("detach");
- if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
- for(i=0; i<3; i++) {
- HDsprintf(name,"ds_a_%d",i);
- if((dsid = H5Dopen2(fid,name, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ HDsprintf(name, "ds_a_%d", i);
+ if ((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
goto out;
- if(H5DSdetach_scale(did,dsid,(unsigned)i) < 0)
+ if (H5DSdetach_scale(did, dsid, (unsigned)i) < 0)
goto out;
- if(H5DSis_attached(did,dsid,(unsigned)i)!=0)
+ if (H5DSis_attached(did, dsid, (unsigned)i) != 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
}
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * attach, set, get names, labels
- *-------------------------------------------------------------------------
- */
+ * attach, set, get names, labels
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("attach, set, get names, labels");
- if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
- for(i=0; i<3; i++) {
- HDsprintf(name,"ds_a_%d",i);
- if((dsid = H5Dopen2(fid,name, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ HDsprintf(name, "ds_a_%d", i);
+ if ((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
goto out;
- if(H5DSset_scale(dsid,name) < 0)
+ if (H5DSset_scale(dsid, name) < 0)
goto out;
- if(H5DSattach_scale(did,dsid,(unsigned)i) < 0)
+ if (H5DSattach_scale(did, dsid, (unsigned)i) < 0)
goto out;
- if(H5DSis_attached(did,dsid,(unsigned)i)<=0)
+ if (H5DSis_attached(did, dsid, (unsigned)i) <= 0)
goto out;
- if(H5DSget_scale_name(dsid,names,sizeof(names)) < 0)
+ if (H5DSget_scale_name(dsid, names, sizeof(names)) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
- if(H5DSset_label(did,(unsigned)i,name) < 0)
+ if (H5DSset_label(did, (unsigned)i, name) < 0)
goto out;
- if(H5DSget_label(did,(unsigned)i,namel,sizeof(namel)) < 0)
+ if (H5DSget_label(did, (unsigned)i, namel, sizeof(namel)) < 0)
goto out;
- if(HDstrncmp(name, names, sizeof(names))!=0)
+ if (HDstrncmp(name, names, sizeof(names)) != 0)
goto out;
- if(HDstrncmp(name, namel, sizeof(namel))!=0)
+ if (HDstrncmp(name, namel, sizeof(namel)) != 0)
goto out;
}
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * attach a scalar scale
- *-------------------------------------------------------------------------
- */
+ * attach a scalar scale
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("attach a scalar scale");
/* create the data space for the dataset */
- if((sid = H5Screate_simple(2, dimss, NULL)) < 0)
+ if ((sid = H5Screate_simple(2, dimss, NULL)) < 0)
goto out;
/* create a dataset of rank 2 */
- if((did = H5Dcreate2(fid, "dset_b", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dset_b", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* create a scalar space */
- if((sidds = H5Screate(H5S_SCALAR)) < 0)
+ if ((sidds = H5Screate(H5S_SCALAR)) < 0)
goto out;
/* create a dataset of scalar rank for the scale */
- if((dsid = H5Dcreate2(fid, "ds_b_1", H5T_NATIVE_FLOAT, sidds, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(fid, "ds_b_1", H5T_NATIVE_FLOAT, sidds, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
goto out;
/* write */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, bufi) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, bufi) < 0)
goto out;
- if(H5Dwrite(dsid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buff) < 0)
+ if (H5Dwrite(dsid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buff) < 0)
goto out;
/* attach */
- if(H5DSattach_scale(did, dsid, 0) < 0)
+ if (H5DSattach_scale(did, dsid, 0) < 0)
goto out;
- if(H5DSattach_scale(did, dsid, 1) < 0)
+ if (H5DSattach_scale(did, dsid, 1) < 0)
goto out;
/* close */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Sclose(sidds) < 0)
+ if (H5Sclose(sidds) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- if(H5Fclose(fid) < 0)
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Fclose(fid) < 0)
goto out;
return 0;
@@ -4488,173 +4574,174 @@ out:
H5Sclose(sidds);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-
/*-------------------------------------------------------------------------
* attach scales with several datatypes
*-------------------------------------------------------------------------
*/
-static int test_types(void)
+static int
+test_types(void)
{
- hid_t fid; /* file ID */
- hid_t did = -1; /* dataset ID */
- hid_t dsid = -1; /* DS dataset ID */
- int rank = RANK; /* rank of data dataset */
- int rankds = 1; /* rank of DS dataset */
- hsize_t dims[RANK] = {DIM1_SIZE,DIM2_SIZE}; /* size of data dataset */
- int buf[DIM_DATA] = {1,2,3,4,5,6,7,8,9,10,11,12}; /* data of data dataset */
- hsize_t s1_dim[1] = {DIM1_SIZE}; /* size of DS 1 dataset */
- hsize_t s2_dim[1] = {DIM2_SIZE}; /* size of DS 2 dataset */
- float s1_float[DIM1_SIZE] = {10,20,30}; /* data of DS 1 dataset */
- unsigned short s2_ushort[DIM2_SIZE] = {10,20,30,40}; /* data of DS 2 dataset */
- const char *s1_str = "ABC";
- const char *s2_str = "ABCD";
+ hid_t fid; /* file ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t dsid = -1; /* DS dataset ID */
+ int rank = RANK; /* rank of data dataset */
+ int rankds = 1; /* rank of DS dataset */
+ hsize_t dims[RANK] = {DIM1_SIZE, DIM2_SIZE}; /* size of data dataset */
+ int buf[DIM_DATA] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; /* data of data dataset */
+ hsize_t s1_dim[1] = {DIM1_SIZE}; /* size of DS 1 dataset */
+ hsize_t s2_dim[1] = {DIM2_SIZE}; /* size of DS 2 dataset */
+ float s1_float[DIM1_SIZE] = {10, 20, 30}; /* data of DS 1 dataset */
+ unsigned short s2_ushort[DIM2_SIZE] = {10, 20, 30, 40}; /* data of DS 2 dataset */
+ const char * s1_str = "ABC";
+ const char * s2_str = "ABCD";
HDprintf("Testing scales with several datatypes\n");
/*-------------------------------------------------------------------------
- * create a file for the test
- *-------------------------------------------------------------------------
- */
+ * create a file for the test
+ *-------------------------------------------------------------------------
+ */
/* create a file using default properties */
- if((fid=H5Fcreate(FILE5,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FILE5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * create datasets: 1 "data" dataset and 2 dimension scales
- *-------------------------------------------------------------------------
- */
+ * create datasets: 1 "data" dataset and 2 dimension scales
+ *-------------------------------------------------------------------------
+ */
/* make a dataset */
- if(H5LTmake_dataset_int(fid,"dset_a",rank,dims,buf) < 0)
+ if (H5LTmake_dataset_int(fid, "dset_a", rank, dims, buf) < 0)
goto out;
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_float(fid,DS_1_NAME,rankds,s1_dim,s1_float) < 0)
+ if (H5LTmake_dataset_float(fid, DS_1_NAME, rankds, s1_dim, s1_float) < 0)
goto out;
/* make a DS dataset for the second dimension */
- if(H5LTmake_dataset(fid,DS_2_NAME,rankds,s2_dim,H5T_NATIVE_USHORT,s2_ushort) < 0)
+ if (H5LTmake_dataset(fid, DS_2_NAME, rankds, s2_dim, H5T_NATIVE_USHORT, s2_ushort) < 0)
goto out;
/*-------------------------------------------------------------------------
- * floating point and short scales
- *-------------------------------------------------------------------------
- */
+ * floating point and short scales
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("floating point and short scales");
/* get the dataset id for "dset_a" */
- if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_a", H5P_DEFAULT)) < 0)
goto out;
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,DS_1_NAME, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, DS_1_NAME, H5P_DEFAULT)) < 0)
goto out;
/* attach the DS_1_NAME dimension scale to "dset_a" at dimension 0 */
- if(H5DSattach_scale(did,dsid,DIM0) < 0)
+ if (H5DSattach_scale(did, dsid, DIM0) < 0)
goto out;
/* set name */
- if(H5DSset_scale(dsid,SCALE_1_NAME) < 0)
+ if (H5DSset_scale(dsid, SCALE_1_NAME) < 0)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,DS_2_NAME, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, DS_2_NAME, H5P_DEFAULT)) < 0)
goto out;
/* attach the DS_2_NAME dimension scale to "dset_a" at dimension 1 */
- if(H5DSattach_scale(did,dsid,DIM1) < 0)
+ if (H5DSattach_scale(did, dsid, DIM1) < 0)
goto out;
/* set name */
- if(H5DSset_scale(dsid,SCALE_2_NAME) < 0)
+ if (H5DSset_scale(dsid, SCALE_2_NAME) < 0)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* set a label */
- if(H5DSset_label(did,DIM0,DIM0_LABEL) < 0)
+ if (H5DSset_label(did, DIM0, DIM0_LABEL) < 0)
goto out;
- if(H5DSset_label(did,DIM1,DIM1_LABEL) < 0)
+ if (H5DSset_label(did, DIM1, DIM1_LABEL) < 0)
goto out;
/* close */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * create datasets: 1 "data" dataset and 2 dimension scales
- *-------------------------------------------------------------------------
- */
+ * create datasets: 1 "data" dataset and 2 dimension scales
+ *-------------------------------------------------------------------------
+ */
/* make a dataset */
- if(H5LTmake_dataset_int(fid,"dset_b",rank,dims,buf) < 0)
+ if (H5LTmake_dataset_int(fid, "dset_b", rank, dims, buf) < 0)
goto out;
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_string(fid,"ds_b_1",s1_str) < 0)
+ if (H5LTmake_dataset_string(fid, "ds_b_1", s1_str) < 0)
goto out;
/* make a DS dataset for the second dimension */
- if(H5LTmake_dataset_string(fid,"ds_b_2",s2_str) < 0)
+ if (H5LTmake_dataset_string(fid, "ds_b_2", s2_str) < 0)
goto out;
/*-------------------------------------------------------------------------
- * floating point and short scales
- *-------------------------------------------------------------------------
- */
+ * floating point and short scales
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("string scales");
/* get the dataset id for "dset_b" */
- if((did = H5Dopen2(fid,"dset_b", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset_b", H5P_DEFAULT)) < 0)
goto out;
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,"ds_b_1", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_b_1", H5P_DEFAULT)) < 0)
goto out;
/* attach the DS_1_NAME dimension scale to "dset_b" at dimension 0 */
- if(H5DSattach_scale(did,dsid,DIM0) < 0)
+ if (H5DSattach_scale(did, dsid, DIM0) < 0)
goto out;
/* set name */
- if(H5DSset_scale(dsid,SCALE_1_NAME) < 0)
+ if (H5DSset_scale(dsid, SCALE_1_NAME) < 0)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,"ds_b_2", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds_b_2", H5P_DEFAULT)) < 0)
goto out;
/* attach the DS_2_NAME dimension scale to "dset_b" at dimension 1 */
- if(H5DSattach_scale(did,dsid,DIM1) < 0)
+ if (H5DSattach_scale(did, dsid, DIM1) < 0)
goto out;
/* set name */
- if(H5DSset_scale(dsid,SCALE_2_NAME) < 0)
+ if (H5DSset_scale(dsid, SCALE_2_NAME) < 0)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* set a label */
- if(H5DSset_label(did,DIM0,DIM0_LABEL) < 0)
+ if (H5DSset_label(did, DIM0, DIM0_LABEL) < 0)
goto out;
- if(H5DSset_label(did,DIM1,DIM1_LABEL) < 0)
+ if (H5DSset_label(did, DIM1, DIM1_LABEL) < 0)
goto out;
/* close */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- if(H5Fclose(fid) < 0)
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Fclose(fid) < 0)
goto out;
return 0;
@@ -4666,7 +4753,8 @@ out:
H5Dclose(did);
H5Dclose(dsid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
@@ -4676,144 +4764,142 @@ out:
*-------------------------------------------------------------------------
*/
-static int test_data(void)
+static int
+test_data(void)
{
- hid_t fid; /* file ID */
- hid_t did = -1; /* dataset ID */
- hid_t dsid = -1; /* DS dataset ID */
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
- float *vals=NULL; /* array to hold data values */
- float *latbuf=NULL; /* array to hold the latitude values */
- float *lonbuf=NULL; /* array to hold the longitude values */
- hsize_t dims[2]; /* array to hold dimensions */
- hsize_t latdims[1]; /* array to hold dimensions */
- hsize_t londims[1]; /* array to hold dimensions */
- float fill=-99; /* fill value */
-
+ hid_t fid; /* file ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t dsid = -1; /* DS dataset ID */
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ float * vals = NULL; /* array to hold data values */
+ float * latbuf = NULL; /* array to hold the latitude values */
+ float * lonbuf = NULL; /* array to hold the longitude values */
+ hsize_t dims[2]; /* array to hold dimensions */
+ hsize_t latdims[1]; /* array to hold dimensions */
+ hsize_t londims[1]; /* array to hold dimensions */
+ float fill = -99; /* fill value */
HDprintf("Testing reading ASCII data and generate HDF5 data with scales\n");
/*-------------------------------------------------------------------------
- * create a file for the test
- *-------------------------------------------------------------------------
- */
+ * create a file for the test
+ *-------------------------------------------------------------------------
+ */
/* create a file using default properties */
- if((fid=H5Fcreate(FILE6,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FILE6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * generating scales
- *-------------------------------------------------------------------------
- */
+ * generating scales
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("generating scales");
/*-------------------------------------------------------------------------
- * create datasets: 1 "data" dataset and 2 dimension scales
- *-------------------------------------------------------------------------
- */
+ * create datasets: 1 "data" dataset and 2 dimension scales
+ *-------------------------------------------------------------------------
+ */
/* read the latitude */
- if(read_data("dslat.txt",1,latdims,&latbuf) < 0)
+ if (read_data("dslat.txt", 1, latdims, &latbuf) < 0)
goto out;
/* make a DS dataset for the first dimension */
- if(H5LTmake_dataset_float(fid, "lat", 1, latdims, latbuf) < 0)
+ if (H5LTmake_dataset_float(fid, "lat", 1, latdims, latbuf) < 0)
goto out;
- HDfree( latbuf );
+ HDfree(latbuf);
latbuf = NULL;
- /* read the longitude */
- if(read_data("dslon.txt",1,londims,&lonbuf) < 0)
+ /* read the longitude */
+ if (read_data("dslon.txt", 1, londims, &lonbuf) < 0)
goto out;
/* make a DS dataset for the second dimension */
- if(H5LTmake_dataset_float(fid, "lon", 1, londims, lonbuf) < 0)
+ if (H5LTmake_dataset_float(fid, "lon", 1, londims, lonbuf) < 0)
goto out;
- HDfree( lonbuf );
+ HDfree(lonbuf);
lonbuf = NULL;
/* make a dataset for the data. a fill value is set */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fill) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fill) < 0)
goto out;
/* read ASCII bathymetry data and dimensions to create dataset */
- if(read_data("dsdata.txt",2,dims,&vals) < 0)
+ if (read_data("dsdata.txt", 2, dims, &vals) < 0)
goto out;
- if((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
goto out;
- if((did = H5Dcreate2(fid, "data", H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "data", H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, vals) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, vals) < 0)
goto out;
- HDfree ( vals );
+ HDfree(vals);
vals = NULL;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto out;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * attach
- *-------------------------------------------------------------------------
- */
+ * attach
+ *-------------------------------------------------------------------------
+ */
/* get the dataset id for "data" */
- if((did = H5Dopen2(fid,"data", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "data", H5P_DEFAULT)) < 0)
goto out;
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,"lat", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "lat", H5P_DEFAULT)) < 0)
goto out;
/* attach the DS_1_NAME dimension scale to "data" at dimension 0 */
- if(H5DSattach_scale(did,dsid,DIM0) < 0)
+ if (H5DSattach_scale(did, dsid, DIM0) < 0)
goto out;
/* set name */
- if(H5DSset_scale(dsid,SCALE_1_NAME) < 0)
+ if (H5DSset_scale(dsid, SCALE_1_NAME) < 0)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* get the DS dataset id */
- if((dsid = H5Dopen2(fid,"lon", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "lon", H5P_DEFAULT)) < 0)
goto out;
/* attach the DS_2_NAME dimension scale to "data" at dimension 1 */
- if(H5DSattach_scale(did,dsid,DIM1) < 0)
+ if (H5DSattach_scale(did, dsid, DIM1) < 0)
goto out;
/* set name */
- if(H5DSset_scale(dsid,SCALE_2_NAME) < 0)
+ if (H5DSset_scale(dsid, SCALE_2_NAME) < 0)
goto out;
/* close DS id */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto out;
/* set a label */
- if(H5DSset_label(did,DIM0,DIM0_LABEL) < 0)
+ if (H5DSset_label(did, DIM0, DIM0_LABEL) < 0)
goto out;
- if(H5DSset_label(did,DIM1,DIM1_LABEL) < 0)
+ if (H5DSset_label(did, DIM1, DIM1_LABEL) < 0)
goto out;
/* close */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
PASSED();
-
-
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- if(H5Fclose(fid) < 0)
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Fclose(fid) < 0)
goto out;
return 0;
@@ -4825,20 +4911,19 @@ out:
H5Dclose(did);
H5Dclose(dsid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
if (latbuf)
- HDfree( latbuf );
+ HDfree(latbuf);
if (lonbuf)
- HDfree( lonbuf );
+ HDfree(lonbuf);
if (vals)
- HDfree( vals );
+ HDfree(vals);
return FAIL;
}
-
-
/*-------------------------------------------------------------------------
* read_data
* utility function to read ASCII data
@@ -4852,34 +4937,32 @@ out:
*-------------------------------------------------------------------------
*/
-static int read_data( const char* fname,
- int ndims,
- hsize_t *dims,
- float **buf )
+static int
+read_data(const char *fname, int ndims, hsize_t *dims, float **buf)
{
- int i, n;
- unsigned j;
- char str[20];
- size_t nelms;
- FILE *f;
- float val;
+ int i, n;
+ unsigned j;
+ char str[20];
+ size_t nelms;
+ FILE * f;
+ float val;
const char *data_file = H5_get_srcdir_filename(fname);
/* read first data file */
f = HDfopen(data_file, "r");
- if( f == NULL ) {
- HDprintf( "Could not open file %s\n", data_file );
+ if (f == NULL) {
+ HDprintf("Could not open file %s\n", data_file);
return -1;
}
- for(i=0, nelms=1; i < ndims; i++) {
- if(fscanf( f, "%s %u", str, &j) && HDferror(f)) {
- HDprintf( "fscanf error in file %s\n", data_file );
+ for (i = 0, nelms = 1; i < ndims; i++) {
+ if (fscanf(f, "%s %u", str, &j) && HDferror(f)) {
+ HDprintf("fscanf error in file %s\n", data_file);
HDfclose(f);
return -1;
} /* end if */
- if(fscanf( f, "%d",&n ) < 0 && HDferror(f)) {
- HDprintf( "fscanf error in file %s\n", data_file );
+ if (fscanf(f, "%d", &n) < 0 && HDferror(f)) {
+ HDprintf("fscanf error in file %s\n", data_file);
HDfclose(f);
return -1;
} /* end if */
@@ -4887,17 +4970,17 @@ static int read_data( const char* fname,
nelms *= (size_t)n;
}
- *buf = (float*) HDmalloc (nelms * sizeof( float ));
+ *buf = (float *)HDmalloc(nelms * sizeof(float));
- if ( *buf == NULL ) {
- HDprintf( "memory allocation failed\n" );
+ if (*buf == NULL) {
+ HDprintf("memory allocation failed\n");
HDfclose(f);
return -1;
}
- for(j = 0; j < nelms; j++) {
- if(fscanf( f, "%f",&val ) < 0 && HDferror(f)) {
- HDprintf( "fscanf error in file %s\n", data_file );
+ for (j = 0; j < nelms; j++) {
+ if (fscanf(f, "%f", &val) < 0 && HDferror(f)) {
+ HDprintf("fscanf error in file %s\n", data_file);
HDfclose(f);
return -1;
} /* end if */
@@ -4906,67 +4989,64 @@ static int read_data( const char* fname,
HDfclose(f);
return 1;
-
}
-
/*-------------------------------------------------------------------------
* test parameter errors
*-------------------------------------------------------------------------
*/
-static int test_errors2(void)
+static int
+test_errors2(void)
{
- hid_t fid; /* file ID */
- hid_t did = -1; /* dataset ID */
- hid_t dsid = -1; /* scale ID */
- hsize_t dimd[2] = {3,3}; /* size of data dataset */
- hsize_t dims[1] = {3}; /* size of scale dataset */
- char lbuf[255]; /* label buffer */
- ssize_t label_len; /* label length */
- int scale_idx; /* scale index */
- int nscales; /* number of scales in DIM */
- int count; /* visitor data */
+ hid_t fid; /* file ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t dsid = -1; /* scale ID */
+ hsize_t dimd[2] = {3, 3}; /* size of data dataset */
+ hsize_t dims[1] = {3}; /* size of scale dataset */
+ char lbuf[255]; /* label buffer */
+ ssize_t label_len; /* label length */
+ int scale_idx; /* scale index */
+ int nscales; /* number of scales in DIM */
+ int count; /* visitor data */
HDprintf("Testing parameter errors\n");
/*-------------------------------------------------------------------------
- * create a file, a dataset, scales
- *-------------------------------------------------------------------------
- */
+ * create a file, a dataset, scales
+ *-------------------------------------------------------------------------
+ */
/* create a file using default properties */
- if ((fid=H5Fcreate(FILE7,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FILE7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* make a dataset */
- if (H5LTmake_dataset_int(fid,"dset",2,dimd,NULL) < 0)
+ if (H5LTmake_dataset_int(fid, "dset", 2, dimd, NULL) < 0)
goto out;
/* make a scale dataset */
- if(H5LTmake_dataset_int(fid,"ds1",1,dims,NULL) < 0)
+ if (H5LTmake_dataset_int(fid, "ds1", 1, dims, NULL) < 0)
goto out;
/* make a scale dataset */
- if(H5LTmake_dataset_int(fid,"ds2",1,dims,NULL) < 0)
+ if (H5LTmake_dataset_int(fid, "ds2", 1, dims, NULL) < 0)
goto out;
-
HL_TESTING2("attach scales");
-
/*-------------------------------------------------------------------------
- * attach with invalid indices
- *-------------------------------------------------------------------------
- */
+ * attach with invalid indices
+ *-------------------------------------------------------------------------
+ */
- if ((did = H5Dopen2(fid,"dset", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0)
goto out;
- if ((dsid = H5Dopen2(fid,"ds1", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds1", H5P_DEFAULT)) < 0)
goto out;
- if (H5DSattach_scale(did,dsid,2) == SUCCEED)
+ if (H5DSattach_scale(did, dsid, 2) == SUCCEED)
goto out;
- if (H5DSattach_scale(did,dsid,0) < 0)
+ if (H5DSattach_scale(did, dsid, 0) < 0)
goto out;
if (H5Dclose(dsid) < 0)
goto out;
@@ -4978,16 +5058,16 @@ static int test_errors2(void)
HL_TESTING2("detach scales");
/*-------------------------------------------------------------------------
- * detach with invalid indices
- *-------------------------------------------------------------------------
- */
- if ((did = H5Dopen2(fid,"dset", H5P_DEFAULT)) < 0)
+ * detach with invalid indices
+ *-------------------------------------------------------------------------
+ */
+ if ((did = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0)
goto out;
- if ((dsid = H5Dopen2(fid,"ds1", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds1", H5P_DEFAULT)) < 0)
goto out;
- if (H5DSdetach_scale(did,dsid,2) == SUCCEED)
+ if (H5DSdetach_scale(did, dsid, 2) == SUCCEED)
goto out;
- if (H5DSdetach_scale(did,dsid,0) < 0)
+ if (H5DSdetach_scale(did, dsid, 0) < 0)
goto out;
if (H5Dclose(dsid) < 0)
goto out;
@@ -4999,22 +5079,22 @@ static int test_errors2(void)
HL_TESTING2("set/get label");
/*-------------------------------------------------------------------------
- * set/get label invalid indices
- *-------------------------------------------------------------------------
- */
- if ((did = H5Dopen2(fid,"dset", H5P_DEFAULT)) < 0)
+ * set/get label invalid indices
+ *-------------------------------------------------------------------------
+ */
+ if ((did = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0)
goto out;
- if (H5DSset_label(did,2,"label")== SUCCEED)
+ if (H5DSset_label(did, 2, "label") == SUCCEED)
goto out;
- if (H5DSset_label(did,0,"label") < 0)
+ if (H5DSset_label(did, 0, "label") < 0)
goto out;
- if (H5DSget_label(did,2,lbuf,sizeof(lbuf)) == SUCCEED)
+ if (H5DSget_label(did, 2, lbuf, sizeof(lbuf)) == SUCCEED)
goto out;
- if ((label_len=H5DSget_label(did,0,NULL,0)) < 0)
+ if ((label_len = H5DSget_label(did, 0, NULL, 0)) < 0)
goto out;
- if ( label_len != HDstrlen("label") )
+ if (label_len != HDstrlen("label"))
goto out;
- if (H5DSget_label(did,0,lbuf,sizeof(lbuf)) < 0)
+ if (H5DSget_label(did, 0, lbuf, sizeof(lbuf)) < 0)
goto out;
if (H5Dclose(did) < 0)
goto out;
@@ -5023,70 +5103,68 @@ static int test_errors2(void)
HL_TESTING2("iterate scales");
-
/*-------------------------------------------------------------------------
- * iterate_scales invalid indices and return DS_IDX and visitor data
- *-------------------------------------------------------------------------
- */
- if ((did = H5Dopen2(fid,"dset", H5P_DEFAULT)) < 0)
+ * iterate_scales invalid indices and return DS_IDX and visitor data
+ *-------------------------------------------------------------------------
+ */
+ if ((did = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0)
goto out;
- if ((dsid = H5Dopen2(fid,"ds1", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds1", H5P_DEFAULT)) < 0)
goto out;
- if (H5DSattach_scale(did,dsid,0) < 0)
+ if (H5DSattach_scale(did, dsid, 0) < 0)
goto out;
if (H5Dclose(dsid) < 0)
goto out;
- if ((dsid = H5Dopen2(fid,"ds2", H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dopen2(fid, "ds2", H5P_DEFAULT)) < 0)
goto out;
- if (H5DSattach_scale(did,dsid,0) < 0)
+ if (H5DSattach_scale(did, dsid, 0) < 0)
goto out;
if (H5Dclose(dsid) < 0)
goto out;
- if((nscales = H5DSget_num_scales(did,0)) < 0)
+ if ((nscales = H5DSget_num_scales(did, 0)) < 0)
goto out;
- if(nscales!=2)
+ if (nscales != 2)
goto out;
/* invalid DIM */
- if (H5DSiterate_scales(did,2,NULL,op_continue,NULL)== SUCCEED)
+ if (H5DSiterate_scales(did, 2, NULL, op_continue, NULL) == SUCCEED)
goto out;
/* invalid DS_IDX */
scale_idx = 2;
- if (H5DSiterate_scales(did,0,&scale_idx,op_continue,NULL)== SUCCEED)
+ if (H5DSiterate_scales(did, 0, &scale_idx, op_continue, NULL) == SUCCEED)
goto out;
/* continue iteration */
scale_idx = 0;
- count = 0;
- if (H5DSiterate_scales(did,0,&scale_idx,op_continue,(void *)&count) < 0)
+ count = 0;
+ if (H5DSiterate_scales(did, 0, &scale_idx, op_continue, (void *)&count) < 0)
goto out;
- if ( scale_idx != 1 && count != nscales ) {
+ if (scale_idx != 1 && count != nscales) {
goto out;
}
/* stop iteration */
scale_idx = 0;
- count = 0;
- if (H5DSiterate_scales(did,0,&scale_idx,op_stop,(void *)&count) < 0)
+ count = 0;
+ if (H5DSiterate_scales(did, 0, &scale_idx, op_stop, (void *)&count) < 0)
goto out;
- if ( scale_idx != 0 && count != 1 ) {
+ if (scale_idx != 0 && count != 1) {
goto out;
}
-
if (H5Dclose(did) < 0)
goto out;
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- if(H5Fclose(fid) < 0)
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Fclose(fid) < 0)
goto out;
PASSED();
@@ -5100,7 +5178,8 @@ out:
H5Dclose(did);
H5Dclose(dsid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
@@ -5110,220 +5189,219 @@ out:
*-------------------------------------------------------------------------
*/
-static int test_attach_detach(void)
+static int
+test_attach_detach(void)
{
- hid_t fid; /* file ID */
- hid_t gid; /* group ID */
- hid_t sid; /* dataspace ID */
- hid_t dcpl_id; /* dataset creation property */
- hid_t dsid = -1; /* DS dataset ID */
- hid_t var1_id, var2_id, var3_id; /* DS component name */
- hsize_t dims[RANK1] = {DIM1};
+ hid_t fid; /* file ID */
+ hid_t gid; /* group ID */
+ hid_t sid; /* dataspace ID */
+ hid_t dcpl_id; /* dataset creation property */
+ hid_t dsid = -1; /* DS dataset ID */
+ hid_t var1_id, var2_id, var3_id; /* DS component name */
+ hsize_t dims[RANK1] = {DIM1};
HL_TESTING2("permutations of attaching and detaching");
- if((fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto out;
+ if ((fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
- goto out;
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ goto out;
/* Create dimension scale. */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
- if((sid = H5Screate_simple(1, dims, dims)) < 0)
- goto out;
+ if ((sid = H5Screate_simple(1, dims, dims)) < 0)
+ goto out;
- if((dsid = H5Dcreate2(gid, DS_3_NAME, H5T_IEEE_F32BE, sid,
- H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
- goto out;
+ if ((dsid = H5Dcreate2(gid, DS_3_NAME, H5T_IEEE_F32BE, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ goto out;
- if(H5Sclose(sid) < 0)
- goto out;
- if(H5Pclose(dcpl_id) < 0)
- goto out;
+ if (H5Sclose(sid) < 0)
+ goto out;
+ if (H5Pclose(dcpl_id) < 0)
+ goto out;
- if(H5DSset_scale(dsid, DS_3_NAME) < 0)
- goto out;
+ if (H5DSset_scale(dsid, DS_3_NAME) < 0)
+ goto out;
/* Create a variable that uses this dimension scale. */
- if((sid = H5Screate_simple(DIM1, dims, dims)) < 0)
- goto out;
+ if ((sid = H5Screate_simple(DIM1, dims, dims)) < 0)
+ goto out;
- if((var1_id = H5Dcreate2(gid, DS_31_NAME, H5T_NATIVE_FLOAT, sid,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto out;
+ if ((var1_id =
+ H5Dcreate2(gid, DS_31_NAME, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
- if(H5Sclose(sid) < 0)
- goto out;
+ if (H5Sclose(sid) < 0)
+ goto out;
- if(H5DSattach_scale(var1_id, dsid, 0) < 0)
- goto out;
+ if (H5DSattach_scale(var1_id, dsid, 0) < 0)
+ goto out;
/* Create another variable that uses this dimension scale. */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
- if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0)
- goto out;
+ if (H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0)
+ goto out;
- if((sid = H5Screate_simple(DIM1, dims, dims)) < 0)
- goto out;
+ if ((sid = H5Screate_simple(DIM1, dims, dims)) < 0)
+ goto out;
- if((var2_id = H5Dcreate2(gid, DS_32_NAME, H5T_NATIVE_FLOAT, sid,
- H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0)
- goto out;
+ if ((var2_id =
+ H5Dcreate2(gid, DS_32_NAME, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
- if(H5Pclose(dcpl_id) < 0)
- goto out;
+ if (H5Pclose(dcpl_id) < 0)
+ goto out;
- if(H5Sclose(sid) < 0)
- goto out;
+ if (H5Sclose(sid) < 0)
+ goto out;
/* Create 3rd variable that uses this dimension scale. */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
- if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0)
- goto out;
+ if (H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0)
+ goto out;
- if((sid = H5Screate_simple(DIM1, dims, dims)) < 0)
- goto out;
+ if ((sid = H5Screate_simple(DIM1, dims, dims)) < 0)
+ goto out;
- if((var3_id = H5Dcreate2(gid, DS_33_NAME, H5T_NATIVE_FLOAT, sid,
- H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0)
- goto out;
+ if ((var3_id =
+ H5Dcreate2(gid, DS_33_NAME, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
- if(H5Pclose(dcpl_id) < 0)
- goto out;
+ if (H5Pclose(dcpl_id) < 0)
+ goto out;
- if(H5Sclose(sid) < 0)
- goto out;
+ if (H5Sclose(sid) < 0)
+ goto out;
/* Attached var2 scale */
- if(H5DSattach_scale(var2_id, dsid, 0) < 0)
- goto out;
+ if (H5DSattach_scale(var2_id, dsid, 0) < 0)
+ goto out;
/* Detach the var2 scale */
- if(H5DSdetach_scale(var2_id, dsid, 0) < 0)
- goto out;
+ if (H5DSdetach_scale(var2_id, dsid, 0) < 0)
+ goto out;
/* Check if in correct state of detached and attached */
- if(H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */
- goto out;
- if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */
- goto out;
+ if (H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */
+ goto out;
+ if (H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
/* Detach the var1 scale */
- if(H5DSdetach_scale(var1_id, dsid, 0) < 0)
- goto out;
+ if (H5DSdetach_scale(var1_id, dsid, 0) < 0)
+ goto out;
/* Check if in correct state of detached and attached */
- if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */
- goto out;
- if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */
- goto out;
+ if (H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
+ if (H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
/* Attach the DS again and remove them in the opposite order */
- if(H5DSattach_scale(var1_id, dsid, 0) < 0)
- goto out;
+ if (H5DSattach_scale(var1_id, dsid, 0) < 0)
+ goto out;
- if(H5DSattach_scale(var2_id, dsid, 0) < 0)
- goto out;
+ if (H5DSattach_scale(var2_id, dsid, 0) < 0)
+ goto out;
/* Detach the var1 scale */
- if(H5DSdetach_scale(var1_id, dsid, 0) < 0)
- goto out;
+ if (H5DSdetach_scale(var1_id, dsid, 0) < 0)
+ goto out;
/* Check if in correct state of detached and attached */
- if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */
- goto out;
- if(H5DSis_attached(var2_id, dsid, 0) == 0) /* should still be attached */
- goto out;
+ if (H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
+ if (H5DSis_attached(var2_id, dsid, 0) == 0) /* should still be attached */
+ goto out;
/* Detach the var2 scale */
- if(H5DSdetach_scale(var2_id, dsid, 0) < 0)
- goto out;
+ if (H5DSdetach_scale(var2_id, dsid, 0) < 0)
+ goto out;
/* Check if in correct state of detached and attached */
- if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */
- goto out;
- if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */
- goto out;
+ if (H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
+ if (H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
/***************************************************
* Attach Three DS and remove the middle one first
*****************************************************/
- if(H5DSattach_scale(var1_id, dsid, 0) < 0)
- goto out;
-
- if(H5DSattach_scale(var2_id, dsid, 0) < 0)
- goto out;
+ if (H5DSattach_scale(var1_id, dsid, 0) < 0)
+ goto out;
- if(H5DSattach_scale(var3_id, dsid, 0) < 0)
- goto out;
+ if (H5DSattach_scale(var2_id, dsid, 0) < 0)
+ goto out;
+ if (H5DSattach_scale(var3_id, dsid, 0) < 0)
+ goto out;
/* Detach the var2 scale */
- if(H5DSdetach_scale(var2_id, dsid, 0) < 0)
- goto out;
+ if (H5DSdetach_scale(var2_id, dsid, 0) < 0)
+ goto out;
/* Check if in correct state of detached and attached */
- if(H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */
- goto out;
- if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */
- goto out;
- if(H5DSis_attached(var3_id, dsid, 0) == 0) /* should still be attached */
- goto out;
+ if (H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */
+ goto out;
+ if (H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
+ if (H5DSis_attached(var3_id, dsid, 0) == 0) /* should still be attached */
+ goto out;
/* Detach the var3 scale */
- if(H5DSdetach_scale(var3_id, dsid, 0) < 0)
- goto out;
+ if (H5DSdetach_scale(var3_id, dsid, 0) < 0)
+ goto out;
/* Check if in correct state of detached and attached */
- if(H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */
- goto out;
- if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */
- goto out;
- if(H5DSis_attached(var3_id, dsid, 0) != 0) /* should not be attached */
- goto out;
+ if (H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */
+ goto out;
+ if (H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
+ if (H5DSis_attached(var3_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
/* Detach the var1 scale */
- if(H5DSdetach_scale(var1_id, dsid, 0) < 0)
- goto out;
+ if (H5DSdetach_scale(var1_id, dsid, 0) < 0)
+ goto out;
/* Check if in correct state of detached and attached */
- if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */
- goto out;
- if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */
- goto out;
- if(H5DSis_attached(var3_id, dsid, 0) != 0) /* should not be attached */
- goto out;
+ if (H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
+ if (H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
+ if (H5DSis_attached(var3_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
+ * close
+ *-------------------------------------------------------------------------
+ */
- if(H5Dclose(var1_id) < 0)
- goto out;
- if(H5Dclose(var2_id) < 0)
- goto out;
- if(H5Dclose(var3_id) < 0)
- goto out;
- if(H5Dclose(dsid) < 0)
- goto out;
- if(H5Gclose(gid) < 0)
- goto out;
- if(H5Fclose(fid) < 0)
- goto out;
+ if (H5Dclose(var1_id) < 0)
+ goto out;
+ if (H5Dclose(var2_id) < 0)
+ goto out;
+ if (H5Dclose(var3_id) < 0)
+ goto out;
+ if (H5Dclose(dsid) < 0)
+ goto out;
+ if (H5Gclose(gid) < 0)
+ goto out;
+ if (H5Fclose(fid) < 0)
+ goto out;
PASSED();
@@ -5333,13 +5411,14 @@ static int test_attach_detach(void)
out:
H5E_BEGIN_TRY
{
- H5Dclose(var1_id);
- H5Dclose(var2_id);
- H5Dclose(var3_id);
+ H5Dclose(var1_id);
+ H5Dclose(var2_id);
+ H5Dclose(var3_id);
H5Dclose(dsid);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c
index 455c0e8..9c5efdd 100644
--- a/hl/test/test_dset_append.c
+++ b/hl/test/test_dset_append.c
@@ -1,35 +1,35 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5hltest.h"
#include "H5DOpublic.h"
#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER)
-# define H5_ZLIB_HEADER "zlib.h"
+#define H5_ZLIB_HEADER "zlib.h"
#endif
#if defined(H5_ZLIB_HEADER)
-#include H5_ZLIB_HEADER /* "zlib.h" */
+#include H5_ZLIB_HEADER /* "zlib.h" */
#endif
-#define FILENAME "test_append.h5"
-#define DNAME_NOTSET "dataset_notset"
-#define DNAME_UNLIM "dataset_unlim"
-#define DNAME_LESS "dataset_less"
-#define DNAME_VARY "dataset_vary"
-#define DNAME_ROW "dataset_row"
-#define DNAME_COLUMN "dataset_column"
-#define DBUGNAME1 "dataset_bug1"
-#define DBUGNAME2 "dataset_bug2"
+#define FILENAME "test_append.h5"
+#define DNAME_NOTSET "dataset_notset"
+#define DNAME_UNLIM "dataset_unlim"
+#define DNAME_LESS "dataset_less"
+#define DNAME_VARY "dataset_vary"
+#define DNAME_ROW "dataset_row"
+#define DNAME_COLUMN "dataset_column"
+#define DBUGNAME1 "dataset_bug1"
+#define DBUGNAME2 "dataset_bug2"
/*-------------------------------------------------------------------------
* Function: test_dataset_append_notset
@@ -48,67 +48,67 @@
static int
test_dataset_append_notset(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* A copy of dataset creation property */
- hid_t ffapl = -1; /* The file's file access property list */
-
- hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
- hsize_t maxdims[2] = {H5S_UNLIMITED, 20}; /* Maximum dimension sizes */
- hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
- int lbuf[10]; /* The data buffers */
- int i, j; /* Local index variables */
- h5_stat_t sb1, sb2; /* File info */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t ffapl = -1; /* The file's file access property list */
+
+ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, 20}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2, 5}; /* Chunk dimension sizes */
+ int lbuf[10]; /* The data buffers */
+ int i, j; /* Local index variables */
+ h5_stat_t sb1, sb2; /* File info */
HL_TESTING2("Append flush with H5DOappend()--append rows with default dapl");
/* Get the file's file access property list */
- if((ffapl = H5Fget_access_plist(fid)) < 0)
+ if ((ffapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR;
/* Set to create a chunked dataset with extendible dimensions */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DNAME_NOTSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DNAME_NOTSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Append 6 rows to the dataset */
- for(i = 0; i < 6; i++) {
- for(j = 0; j < 10; j++)
+ for (i = 0; i < 6; i++) {
+ for (j = 0; j < 10; j++)
lbuf[j] = (i * 10) + (j + 1);
/* Append without boundary, callback and flush */
- if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
+ if (H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
FAIL_STACK_ERROR;
} /* end for */
/* File size when not flushed */
- if(HDstat(FILENAME, &sb1) < 0)
+ if (HDstat(FILENAME, &sb1) < 0)
TEST_ERROR;
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
/* File size after flushing */
- if(HDstat(FILENAME, &sb2) < 0)
+ if (HDstat(FILENAME, &sb2) < 0)
TEST_ERROR;
/* File size before flushing should be less */
- if(sb1.st_size > sb2.st_size)
+ if (sb1.st_size > sb2.st_size)
TEST_ERROR;
/* Closing */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(ffapl) < 0)
+ if (H5Pclose(ffapl) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -116,12 +116,14 @@ test_dataset_append_notset(hid_t fid)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Pclose(sid);
H5Dclose(did);
H5Pclose(ffapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_dataset_append_notset() */
@@ -130,7 +132,7 @@ error:
static herr_t
flush_func(hid_t H5_ATTR_UNUSED obj_id, void *_udata)
{
- unsigned *flush_ct = (unsigned*)_udata;
+ unsigned *flush_ct = (unsigned *)_udata;
++(*flush_ct);
return 0;
}
@@ -161,125 +163,125 @@ append_func(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void
static int
test_dataset_append_rows_columns(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* A copy of dataset creation property */
- hid_t dapl = -1; /* A copy of dataset access property */
- hid_t ffapl = -1; /* The file's file access property list */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t dapl = -1; /* A copy of dataset access property */
+ hid_t ffapl = -1; /* The file's file access property list */
- hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
- hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
- int lbuf[10], cbuf[6]; /* The data buffers */
- int buf[6][13], rbuf[6][13]; /* The data buffers */
+ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2, 5}; /* Chunk dimension sizes */
+ int lbuf[10], cbuf[6]; /* The data buffers */
+ int buf[6][13], rbuf[6][13]; /* The data buffers */
- hsize_t boundary[2] = {1, 1}; /* Boundary sizes */
- unsigned append_ct = 0; /* The # of appends */
- unsigned *flush_ptr; /* Points to the flush counter */
+ hsize_t boundary[2] = {1, 1}; /* Boundary sizes */
+ unsigned append_ct = 0; /* The # of appends */
+ unsigned *flush_ptr; /* Points to the flush counter */
- int i, j; /* Local index variables */
+ int i, j; /* Local index variables */
HL_TESTING2("Append flush with H5DOappend()--append rows & columns");
/* Get the file's file access property list */
- if((ffapl = H5Fget_access_plist(fid)) < 0)
+ if ((ffapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR;
/* Set to create a chunked dataset with 2 extendible dimensions */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR;
/* Set append flush property */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
+ if (H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
FAIL_STACK_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DNAME_UNLIM, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((did = H5Dcreate2(fid, DNAME_UNLIM, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR;
/* Append 6 rows to the dataset */
- for(i = 0; i < 6; i++) {
- for(j = 0; j < 10; j++)
+ for (i = 0; i < 6; i++) {
+ for (j = 0; j < 10; j++)
lbuf[j] = buf[i][j] = (i * 10) + (j + 1);
- if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
+ if (H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
TEST_ERROR;
} /* end for */
/* Verify the # of appends */
- if(append_ct != 6)
+ if (append_ct != 6)
TEST_ERROR;
/* Retrieve and verify object flush counts */
- if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
+ if (H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
FAIL_STACK_ERROR;
- if(*flush_ptr != 6)
+ if (*flush_ptr != 6)
TEST_ERROR;
/* Append 3 columns to the dataset */
- for(i = 0; i < 3; i++) {
- for(j = 0; j < 6; j++)
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 6; j++)
cbuf[j] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1;
- if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0)
+ if (H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0)
TEST_ERROR;
} /* end for */
/* Verify the # of appends */
- if(append_ct != 9)
+ if (append_ct != 9)
TEST_ERROR;
/* Retrieve and verify object flush counts */
- if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
+ if (H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
FAIL_STACK_ERROR;
- if(*flush_ptr != 9)
+ if (*flush_ptr != 9)
TEST_ERROR;
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data */
- for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
- if(buf[i][j] != rbuf[i][j])
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 13; j++)
+ if (buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Clear the buffer */
HDmemset(rbuf, 0, sizeof(rbuf));
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
/* Open the dataset again */
- if((did = H5Dopen2(fid, DNAME_UNLIM, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DNAME_UNLIM, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data */
- for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
- if(buf[i][j] != rbuf[i][j])
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 13; j++)
+ if (buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(ffapl) < 0)
+ if (H5Pclose(ffapl) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -287,13 +289,15 @@ test_dataset_append_rows_columns(hid_t fid)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dapl);
H5Pclose(dcpl);
H5Pclose(sid);
H5Dclose(did);
H5Pclose(ffapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_dataset_append_rows_columns() */
@@ -315,105 +319,105 @@ error:
static int
test_dataset_append_rows(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* A copy of dataset creation property */
- hid_t dapl = -1; /* A copy of dataset access property */
- hid_t ffapl = -1; /* The file's file access property list */
-
- hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
- hsize_t maxdims[2] = {H5S_UNLIMITED, 10}; /* Maximum dimension sizes */
- hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
- int lbuf[10]; /* The data buffer */
- int buf[6][10], rbuf[6][10]; /* The data buffers */
- int i, j; /* Local index variables */
-
- hsize_t boundary[2] = {1, 0}; /* Boundary sizes */
- unsigned append_ct = 0; /* The # of appends */
- unsigned *flush_ptr; /* Points to the flush counter */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t dapl = -1; /* A copy of dataset access property */
+ hid_t ffapl = -1; /* The file's file access property list */
+
+ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, 10}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2, 5}; /* Chunk dimension sizes */
+ int lbuf[10]; /* The data buffer */
+ int buf[6][10], rbuf[6][10]; /* The data buffers */
+ int i, j; /* Local index variables */
+
+ hsize_t boundary[2] = {1, 0}; /* Boundary sizes */
+ unsigned append_ct = 0; /* The # of appends */
+ unsigned *flush_ptr; /* Points to the flush counter */
HL_TESTING2("Append flush with H5DOappend()--append rows");
/* Get the file's file access property list */
- if((ffapl = H5Fget_access_plist(fid)) < 0)
+ if ((ffapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR;
/* Set to create a chunked dataset with 1 extendible dimension */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR;
/* Set append flush property */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
+ if (H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
FAIL_STACK_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DNAME_ROW, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((did = H5Dcreate2(fid, DNAME_ROW, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR;
/* Append 6 rows to the dataset */
- for(i = 0; i < 6; i++) {
- for(j = 0; j < 10; j++)
+ for (i = 0; i < 6; i++) {
+ for (j = 0; j < 10; j++)
lbuf[j] = buf[i][j] = (i * 10) + (j + 1);
- if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
+ if (H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
TEST_ERROR;
} /* end for */
/* Verify the # of appends */
- if(append_ct != 6)
+ if (append_ct != 6)
TEST_ERROR;
- if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
+ if (H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
FAIL_STACK_ERROR;
- if(*flush_ptr != 6)
+ if (*flush_ptr != 6)
TEST_ERROR;
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data */
- for(i = 0; i < 6; i++)
- for(j = 0; j < 10; j++)
- if(buf[i][j] != rbuf[i][j])
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 10; j++)
+ if (buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Clear the buffer */
HDmemset(rbuf, 0, sizeof(rbuf));
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
/* Open the dataset again */
- if((did = H5Dopen2(fid, DNAME_ROW, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DNAME_ROW, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data */
- for(i = 0; i < 6; i++)
- for(j = 0; j < 10; j++)
- if(buf[i][j] != rbuf[i][j])
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 10; j++)
+ if (buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(ffapl) < 0)
+ if (H5Pclose(ffapl) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -421,13 +425,15 @@ test_dataset_append_rows(hid_t fid)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dapl);
H5Pclose(dcpl);
H5Pclose(sid);
H5Dclose(did);
H5Pclose(ffapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_dataset_append_rows() */
@@ -449,106 +455,106 @@ error:
static int
test_dataset_append_columns(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* A copy of dataset creation property */
- hid_t dapl = -1; /* A copy of dataset access property */
- hid_t ffapl = -1; /* The file's file access property list */
-
- hsize_t dims[2] = {6, 0}; /* Current dimension sizes */
- hsize_t maxdims[2] = {6, H5S_UNLIMITED}; /* Maximum dimension sizes */
- hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
- int cbuf[6]; /* The data buffer */
- int buf[6][3], rbuf[6][3]; /* The data buffers */
- int i, j; /* Local index variable */
-
- hsize_t boundary[2] = {0, 1}; /* Boundary sizes */
- unsigned append_ct = 0; /* The # of appends */
- unsigned *flush_ptr; /* Points to the flush counter */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t dapl = -1; /* A copy of dataset access property */
+ hid_t ffapl = -1; /* The file's file access property list */
+
+ hsize_t dims[2] = {6, 0}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {6, H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2, 5}; /* Chunk dimension sizes */
+ int cbuf[6]; /* The data buffer */
+ int buf[6][3], rbuf[6][3]; /* The data buffers */
+ int i, j; /* Local index variable */
+
+ hsize_t boundary[2] = {0, 1}; /* Boundary sizes */
+ unsigned append_ct = 0; /* The # of appends */
+ unsigned *flush_ptr; /* Points to the flush counter */
HL_TESTING2("Append flush with H5DOappend()--append columns");
/* Get the file's file access property list */
- if((ffapl = H5Fget_access_plist(fid)) < 0)
+ if ((ffapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR;
/* Set to create a chunked dataset with 1 extendible dimension */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR;
/* Set append flush property */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
+ if (H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
FAIL_STACK_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DNAME_COLUMN, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((did = H5Dcreate2(fid, DNAME_COLUMN, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR;
/* Append 3 columns to the dataset */
- for(i = 0; i < 3; i++) {
- for(j = 0; j < 6; j++)
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 6; j++)
cbuf[j] = buf[j][i] = ((i * 6) + (j + 1)) * -1;
- if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0)
+ if (H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0)
TEST_ERROR;
} /* end for */
/* Verify the # of appends */
- if(append_ct != 3)
+ if (append_ct != 3)
TEST_ERROR;
/* Retrieve and verify object flush counts */
- if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
+ if (H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
FAIL_STACK_ERROR;
- if(*flush_ptr != 3)
+ if (*flush_ptr != 3)
TEST_ERROR;
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data */
- for(i = 0; i < 6; i++)
- for(j = 0; j < 3; j++)
- if(buf[i][j] != rbuf[i][j])
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 3; j++)
+ if (buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Clear the buffer */
HDmemset(rbuf, 0, sizeof(rbuf));
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
/* Open the dataset again */
- if((did = H5Dopen2(fid, DNAME_COLUMN, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DNAME_COLUMN, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data */
- for(i = 0; i < 6; i++)
- for(j = 0; j < 3; j++)
- if(buf[i][j] != rbuf[i][j])
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 3; j++)
+ if (buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(ffapl) < 0)
+ if (H5Pclose(ffapl) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -556,13 +562,15 @@ test_dataset_append_columns(hid_t fid)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dapl);
H5Pclose(dcpl);
H5Pclose(sid);
H5Dclose(did);
H5Pclose(ffapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_dataset_append_columns() */
@@ -593,123 +601,123 @@ error:
static int
test_dataset_append_BUG1(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* Dataset creation property */
- hid_t dapl = -1; /* Dataset access property */
- hid_t ffapl = -1; /* The file's file access property list */
-
- hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
- hsize_t maxdims[2] = {H5S_UNLIMITED, 50}; /* Maximum dimension sizes */
- hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
- int lbuf[10], cbuf[6]; /* The data buffers */
- int buf[6][13], rbuf[6][13]; /* The data buffers */
- int i, j; /* Local index variables */
-
- hsize_t boundary[2] = {1, 1}; /* Boundary sizes */
- unsigned append_ct = 0; /* The # of appends */
- unsigned *flush_ptr; /* Points to the flush counter */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* Dataset creation property */
+ hid_t dapl = -1; /* Dataset access property */
+ hid_t ffapl = -1; /* The file's file access property list */
+
+ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, 50}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2, 5}; /* Chunk dimension sizes */
+ int lbuf[10], cbuf[6]; /* The data buffers */
+ int buf[6][13], rbuf[6][13]; /* The data buffers */
+ int i, j; /* Local index variables */
+
+ hsize_t boundary[2] = {1, 1}; /* Boundary sizes */
+ unsigned append_ct = 0; /* The # of appends */
+ unsigned *flush_ptr; /* Points to the flush counter */
HL_TESTING2("Append flush with H5DOappend()--append rows & columns--BUG1");
/* Get the file's file access property list */
- if((ffapl = H5Fget_access_plist(fid)) < 0)
+ if ((ffapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR;
/* Set to create a chunked dataset with 2 extendible dimensions */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR;
/* Set append flush property */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
+ if (H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
FAIL_STACK_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DBUGNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((did = H5Dcreate2(fid, DBUGNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR;
/* Append 6 rows to the dataset */
- for(i = 0; i < 6; i++) {
- for(j = 0; j < 10; j++)
+ for (i = 0; i < 6; i++) {
+ for (j = 0; j < 10; j++)
lbuf[j] = buf[i][j] = (i * 10) + (j + 1);
- if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
+ if (H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
TEST_ERROR;
} /* end for */
/* Verify the # of appends */
- if(append_ct != 6)
+ if (append_ct != 6)
TEST_ERROR;
/* Retrieve and verify object flush counts */
- if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
+ if (H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
FAIL_STACK_ERROR;
- if(*flush_ptr != 6)
+ if (*flush_ptr != 6)
TEST_ERROR;
/* Append 3 columns to the dataset */
- for(i = 0; i < 3; i++) {
- for(j = 0; j < 6; j++)
- cbuf[j] = buf[j][i+10] = ((i * 6) + (j + 1)) * -1;
- if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0)
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 6; j++)
+ cbuf[j] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1;
+ if (H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0)
TEST_ERROR;
} /* end for */
/* Verify the # of appends */
- if(append_ct != 9)
+ if (append_ct != 9)
TEST_ERROR;
/* Retrieve and verify object flush counts */
- if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
+ if (H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
FAIL_STACK_ERROR;
- if(*flush_ptr != 9)
+ if (*flush_ptr != 9)
TEST_ERROR;
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data */
- for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
- if(buf[i][j] != rbuf[i][j])
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 13; j++)
+ if (buf[i][j] != rbuf[i][j])
TEST_ERROR;
HDmemset(rbuf, 0, sizeof(rbuf));
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
/* Open the dataset again */
- if((did = H5Dopen2(fid, DBUGNAME1, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DBUGNAME1, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data */
- for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
- if(buf[i][j] != rbuf[i][j])
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 13; j++)
+ if (buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(ffapl) < 0)
+ if (H5Pclose(ffapl) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -717,13 +725,15 @@ test_dataset_append_BUG1(hid_t fid)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Pclose(dapl);
H5Pclose(sid);
H5Dclose(did);
H5Pclose(ffapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_dataset_append_BUG1() */
@@ -754,124 +764,123 @@ error:
static int
test_dataset_append_BUG2(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* Dataset creation property */
- hid_t dapl = -1; /* Dataset access property */
- hid_t ffapl = -1; /* The file's file access property list */
-
- hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
- hsize_t maxdims[2] = {50, H5S_UNLIMITED}; /* Maximum dimension sizes */
- hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
- int lbuf[10], cbuf[6]; /* Data buffers */
- int buf[6][13], rbuf[6][13]; /* Data buffers */
- int i, j; /* Local index variables */
-
- hsize_t boundary[2] = {1, 1}; /* Boundary sizes */
- unsigned append_ct = 0; /* The # of appends */
- unsigned *flush_ptr; /* Points to the flush counter */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* Dataset creation property */
+ hid_t dapl = -1; /* Dataset access property */
+ hid_t ffapl = -1; /* The file's file access property list */
+
+ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {50, H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2, 5}; /* Chunk dimension sizes */
+ int lbuf[10], cbuf[6]; /* Data buffers */
+ int buf[6][13], rbuf[6][13]; /* Data buffers */
+ int i, j; /* Local index variables */
+
+ hsize_t boundary[2] = {1, 1}; /* Boundary sizes */
+ unsigned append_ct = 0; /* The # of appends */
+ unsigned *flush_ptr; /* Points to the flush counter */
HL_TESTING2("Append flush with H5DOappend()--append rows & columns--BUG2");
/* Get the file's file access property list */
- if((ffapl = H5Fget_access_plist(fid)) < 0)
+ if ((ffapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR;
/* Set to create a chunked dataset with 2 extendible dimensions */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR;
/* Set append flush property */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
+ if (H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
FAIL_STACK_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DBUGNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((did = H5Dcreate2(fid, DBUGNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR;
/* Append 6 rows to the dataset */
- for(i = 0; i < 6; i++) {
- for(j = 0; j < 10; j++)
+ for (i = 0; i < 6; i++) {
+ for (j = 0; j < 10; j++)
lbuf[j] = buf[i][j] = (i * 10) + (j + 1);
- if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
+ if (H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
TEST_ERROR;
} /* end for */
/* Verify the # of appends */
- if(append_ct != 6)
+ if (append_ct != 6)
TEST_ERROR;
/* Retrieve and verify object flush counts */
- if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
+ if (H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
FAIL_STACK_ERROR;
- if(*flush_ptr != 6)
+ if (*flush_ptr != 6)
TEST_ERROR;
-
/* Append 3 columns to the dataset */
- for(i = 0; i < 3; i++) {
- for(j = 0; j < 6; j++)
- cbuf[j] = buf[j][i+10] = ((i * 6) + (j + 1)) * -1;
- if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0)
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 6; j++)
+ cbuf[j] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1;
+ if (H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0)
TEST_ERROR;
} /* end for */
/* Verify the # of appends */
- if(append_ct != 9)
+ if (append_ct != 9)
TEST_ERROR;
/* Retrieve and verify object flush counts */
- if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
+ if (H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
FAIL_STACK_ERROR;
- if(*flush_ptr != 9)
+ if (*flush_ptr != 9)
TEST_ERROR;
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data */
- for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
- if(buf[i][j] != rbuf[i][j])
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 13; j++)
+ if (buf[i][j] != rbuf[i][j])
TEST_ERROR;
HDmemset(rbuf, 0, sizeof(rbuf));
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
/* Open the dataset again */
- if((did = H5Dopen2(fid, DBUGNAME2, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DBUGNAME2, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data */
- for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
- if(buf[i][j] != rbuf[i][j])
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 13; j++)
+ if (buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(ffapl) < 0)
+ if (H5Pclose(ffapl) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -879,18 +888,19 @@ test_dataset_append_BUG2(hid_t fid)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Pclose(dapl);
H5Pclose(sid);
H5Dclose(did);
H5Pclose(ffapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_dataset_append_BUG2() */
-
/*-------------------------------------------------------------------------
* Function: test_dataset_append_less
*
@@ -909,127 +919,127 @@ error:
static int
test_dataset_append_less(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* A copy of dataset creation property */
- hid_t dapl = -1; /* A copy of dataset access property */
- hid_t ffapl = -1; /* The file's file access property list */
-
- hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
- hsize_t maxdims[2] = {100, 100}; /* Maximum dimension sizes */
- hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
- int lbuf[20], cbuf[6][3]; /* Data buffers */
- int buf[6][13], rbuf[6][13]; /* Data buffers */
- int i, j, k; /* Local index variables */
-
- hsize_t boundary[2] = {3, 3}; /* Boundary sizes */
- unsigned append_ct = 0; /* The # of appends */
- unsigned *flush_ptr; /* Points to the flush counter */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t dapl = -1; /* A copy of dataset access property */
+ hid_t ffapl = -1; /* The file's file access property list */
+
+ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {100, 100}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2, 5}; /* Chunk dimension sizes */
+ int lbuf[20], cbuf[6][3]; /* Data buffers */
+ int buf[6][13], rbuf[6][13]; /* Data buffers */
+ int i, j, k; /* Local index variables */
+
+ hsize_t boundary[2] = {3, 3}; /* Boundary sizes */
+ unsigned append_ct = 0; /* The # of appends */
+ unsigned *flush_ptr; /* Points to the flush counter */
HL_TESTING2("Append flush with H5DOappend()--append size < boundary size");
/* Get the file's file access property list */
- if((ffapl = H5Fget_access_plist(fid)) < 0)
+ if ((ffapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR;
/* Set to create a chunked dataset with 2 extendible dimensions */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR;
/* Set append flush property */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
+ if (H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
FAIL_STACK_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DNAME_LESS, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((did = H5Dcreate2(fid, DNAME_LESS, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR;
/* Append to the dataset 2 rows at a time for 3 times */
- for(i = 0, k = 0; i < 6; i++) {
- for(j = 0; j < 10; j++, k++)
+ for (i = 0, k = 0; i < 6; i++) {
+ for (j = 0; j < 10; j++, k++)
buf[i][j] = lbuf[k] = (i * 10) + (j + 1);
- if((i + 1) % 2 == 0) {
- if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)2, H5T_NATIVE_INT, lbuf) < 0)
+ if ((i + 1) % 2 == 0) {
+ if (H5DOappend(did, H5P_DEFAULT, 0, (size_t)2, H5T_NATIVE_INT, lbuf) < 0)
TEST_ERROR;
k = 0;
} /* end if */
- } /* end for */
+ } /* end for */
/* Verify the # of appends */
- if(append_ct != 2)
+ if (append_ct != 2)
TEST_ERROR;
/* Retrieve and verify object flush counts */
- if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
+ if (H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
FAIL_STACK_ERROR;
- if(*flush_ptr != 2)
+ if (*flush_ptr != 2)
TEST_ERROR;
/* Append 3 columns to the dataset, once */
- for(i = 0; i < 3; i++)
- for(j = 0; j < 6; j++, k++)
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 6; j++, k++)
cbuf[j][i] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1;
- if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)3, H5T_NATIVE_INT, cbuf) < 0)
+ if (H5DOappend(did, H5P_DEFAULT, 1, (size_t)3, H5T_NATIVE_INT, cbuf) < 0)
TEST_ERROR;
/* Verify the # of appends */
- if(append_ct != 3)
+ if (append_ct != 3)
TEST_ERROR;
/* Retrieve and verify object flush counts */
- if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
+ if (H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
FAIL_STACK_ERROR;
- if(*flush_ptr != 3)
+ if (*flush_ptr != 3)
TEST_ERROR;
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data */
- for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
- if(buf[i][j] != rbuf[i][j])
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 13; j++)
+ if (buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Clear the buffer */
HDmemset(rbuf, 0, sizeof(rbuf));
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
/* Open the dataset again */
- if((did = H5Dopen2(fid, DNAME_LESS, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DNAME_LESS, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data */
- for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
- if(buf[i][j] != rbuf[i][j])
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 13; j++)
+ if (buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(ffapl) < 0)
+ if (H5Pclose(ffapl) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -1037,13 +1047,15 @@ test_dataset_append_less(hid_t fid)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dapl);
H5Pclose(dcpl);
H5Pclose(sid);
H5Dclose(did);
H5Pclose(ffapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_dataset_append_less() */
@@ -1069,122 +1081,122 @@ error:
static int
test_dataset_append_vary(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* A copy of dataset creation property */
- hid_t dapl = -1; /* A copy of dataset access property */
- hid_t ffapl = -1; /* The file's file access property list */
-
- hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
- hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
- int lbuf[60], cbuf[6][3]; /* Data buffers */
- int buf[6][13], rbuf[6][13]; /* Data buffers */
- int i, j, k; /* Local index variables */
-
- hsize_t boundary[2] = {3, 7}; /* Boundary sizes */
- unsigned append_ct = 0; /* The # of appends */
- unsigned *flush_ptr; /* Points to the flush counter */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t dapl = -1; /* A copy of dataset access property */
+ hid_t ffapl = -1; /* The file's file access property list */
+
+ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2, 5}; /* Chunk dimension sizes */
+ int lbuf[60], cbuf[6][3]; /* Data buffers */
+ int buf[6][13], rbuf[6][13]; /* Data buffers */
+ int i, j, k; /* Local index variables */
+
+ hsize_t boundary[2] = {3, 7}; /* Boundary sizes */
+ unsigned append_ct = 0; /* The # of appends */
+ unsigned *flush_ptr; /* Points to the flush counter */
HL_TESTING2("Append flush with H5DOappend()--append & boundary size vary");
/* Get the file's file access property list */
- if((ffapl = H5Fget_access_plist(fid)) < 0)
+ if ((ffapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR;
/* Set to create a chunked dataset with 2 extendible dimensions */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR;
/* Set append flush property */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
+ if (H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
FAIL_STACK_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DNAME_VARY, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
+ if ((did = H5Dcreate2(fid, DNAME_VARY, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
TEST_ERROR;
/* Append 6 rows to the dataset, once */
- for(i = 0, k = 0; i < 6; i++)
- for(j = 0; j < 10; j++, k++)
+ for (i = 0, k = 0; i < 6; i++)
+ for (j = 0; j < 10; j++, k++)
buf[i][j] = lbuf[k] = (i * 10) + (j + 1);
- if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)6, H5T_NATIVE_INT, lbuf) < 0)
+ if (H5DOappend(did, H5P_DEFAULT, 0, (size_t)6, H5T_NATIVE_INT, lbuf) < 0)
TEST_ERROR;
/* Verify the # of appends */
- if(append_ct != 1)
+ if (append_ct != 1)
TEST_ERROR;
/* Retrieve and verify object flush counts */
- if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
+ if (H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
FAIL_STACK_ERROR;
- if(*flush_ptr != 1)
+ if (*flush_ptr != 1)
TEST_ERROR;
/* Append 3 columns to the dataset, once */
- for(i = 0; i < 3; i++)
- for(j = 0; j < 6; j++, k++)
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 6; j++, k++)
cbuf[j][i] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1;
- if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)3, H5T_NATIVE_INT, cbuf) < 0)
+ if (H5DOappend(did, H5P_DEFAULT, 1, (size_t)3, H5T_NATIVE_INT, cbuf) < 0)
TEST_ERROR;
/* Verify the # of appends */
- if(append_ct != 1)
+ if (append_ct != 1)
TEST_ERROR;
/* Retrieve and verify object flush counts */
- if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
+ if (H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
FAIL_STACK_ERROR;
- if(*flush_ptr != 1)
+ if (*flush_ptr != 1)
TEST_ERROR;
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data */
- for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
- if(buf[i][j] != rbuf[i][j])
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 13; j++)
+ if (buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Clear the dataset */
HDmemset(rbuf, 0, sizeof(rbuf));
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
/* Open the dataset again */
- if((did = H5Dopen2(fid, DNAME_VARY, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DNAME_VARY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data */
- for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
- if(buf[i][j] != rbuf[i][j])
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 13; j++)
+ if (buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(ffapl) < 0)
+ if (H5Pclose(ffapl) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -1192,13 +1204,15 @@ test_dataset_append_vary(hid_t fid)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dapl);
H5Pclose(dcpl);
H5Pclose(sid);
H5Dclose(did);
H5Pclose(ffapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* test_dataset_append_vary() */
@@ -1215,64 +1229,66 @@ error:
*
*-------------------------------------------------------------------------
*/
-int main(void)
+int
+main(void)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list */
- unsigned flush_ct = 0; /* The # of flushes */
- int nerrors = 0; /* The # of errors encountered */
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list */
+ unsigned flush_ct = 0; /* The # of flushes */
+ int nerrors = 0; /* The # of errors encountered */
/* Get a copy of file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
FAIL_STACK_ERROR;
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR;
/* Set object flush property */
- if(H5Pset_object_flush_cb(fapl, flush_func, &flush_ct) < 0)
+ if (H5Pset_object_flush_cb(fapl, flush_func, &flush_ct) < 0)
FAIL_STACK_ERROR;
/* Create the test file */
- if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR;
nerrors += test_dataset_append_notset(fid);
nerrors += test_dataset_append_rows(fid);
- flush_ct = 0; /* Reset flush counter */
+ flush_ct = 0; /* Reset flush counter */
nerrors += test_dataset_append_columns(fid);
- flush_ct = 0; /* Reset flush counter */
+ flush_ct = 0; /* Reset flush counter */
nerrors += test_dataset_append_rows_columns(fid);
-/*
- * The following tests illustrate the scenarios when H5DOappend does not work with extensible array indexing:
- * - when the the dataset has 1 unlimited dimension and the other dimension is fixed but extendible
- * - the dataset expands along 1 dimension and then expands along the other dimension
- */
- flush_ct = 0; /* Reset flush counter */
+ /*
+ * The following tests illustrate the scenarios when H5DOappend does not work with extensible array
+ * indexing:
+ * - when the the dataset has 1 unlimited dimension and the other dimension is fixed but extendible
+ * - the dataset expands along 1 dimension and then expands along the other dimension
+ */
+ flush_ct = 0; /* Reset flush counter */
nerrors += test_dataset_append_BUG1(fid);
- flush_ct = 0; /* Reset flush counter */
+ flush_ct = 0; /* Reset flush counter */
nerrors += test_dataset_append_BUG2(fid);
- flush_ct = 0; /* Reset flush counter */
+ flush_ct = 0; /* Reset flush counter */
nerrors += test_dataset_append_less(fid);
- flush_ct = 0; /* Reset flush counter */
+ flush_ct = 0; /* Reset flush counter */
nerrors += test_dataset_append_vary(fid);
/* Closing */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Check for errors */
- if(nerrors)
+ if (nerrors)
goto error;
return EXIT_SUCCESS;
@@ -1280,4 +1296,3 @@ int main(void)
error:
return EXIT_FAILURE;
}
-
diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c
index 504a3f5..712107e 100644
--- a/hl/test/test_file_image.c
+++ b/hl/test/test_file_image.c
@@ -1,15 +1,15 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5hltest.h"
#include "H5LTpublic.h"
@@ -21,8 +21,8 @@
/* For superblock version 0, 1: the offset to "file consistency flags" is 20 with size of 4 bytes */
/* The file consistency flags is the "status_flags" field in H5F_super_t */
/* Note: the offset and size will be different when using superblock version 2 for the test file */
-#define SUPER_STATUS_FLAGS_OFF_V0_V1 20
-#define SUPER_STATUS_FLAGS_SIZE_V0_V1 4
+#define SUPER_STATUS_FLAGS_OFF_V0_V1 20
+#define SUPER_STATUS_FLAGS_SIZE_V0_V1 4
/* Test of file image operations.
@@ -47,32 +47,32 @@
buffers if appropriate. */
/*-------------------------------------------------------------------------
-* test file image operations
-*-------------------------------------------------------------------------
-*/
+ * test file image operations
+ *-------------------------------------------------------------------------
+ */
static int
test_file_image(size_t open_images, size_t nflags, unsigned *flags)
{
- hid_t *file_id, *dset_id, file_space, plist; /* HDF5 ids */
- hsize_t dims1[RANK] = {2,3}; /* original dimension of datasets */
- hsize_t max_dims[RANK] = {H5S_UNLIMITED, H5S_UNLIMITED};
- int data1[6] = {1,2,3,4,5,6}; /* original contents of dataset */
- int data2[6] = {7,8,9,10,11,12}; /* "wrong" contents of dataset */
- hsize_t dims3[RANK]; /* array to read dataset dimensions */
- int data3[15]; /* array to read dataset contents */
- hsize_t dims4[RANK] = {3,5}; /* extended dimensions of datasets */
- int data4[15] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
- /* extended contents of dataset */
- ssize_t *buf_size; /* pointer to array of buffer sizes */
- void **buf_ptr; /* pointer to array of pointers to image buffers */
- char **filename; /* pointer to array of pointers to filenames */
- unsigned *input_flags; /* pointer to array of flag combinations */
- size_t i, j, k, nrow, n_values;
- herr_t status1;
- void *handle_ptr = NULL; /* pointers to driver buffer */
+ hid_t * file_id, *dset_id, file_space, plist; /* HDF5 ids */
+ hsize_t dims1[RANK] = {2, 3}; /* original dimension of datasets */
+ hsize_t max_dims[RANK] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ int data1[6] = {1, 2, 3, 4, 5, 6}; /* original contents of dataset */
+ int data2[6] = {7, 8, 9, 10, 11, 12}; /* "wrong" contents of dataset */
+ hsize_t dims3[RANK]; /* array to read dataset dimensions */
+ int data3[15]; /* array to read dataset contents */
+ hsize_t dims4[RANK] = {3, 5}; /* extended dimensions of datasets */
+ int data4[15] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+ /* extended contents of dataset */
+ ssize_t * buf_size; /* pointer to array of buffer sizes */
+ void ** buf_ptr; /* pointer to array of pointers to image buffers */
+ char ** filename; /* pointer to array of pointers to filenames */
+ unsigned * input_flags; /* pointer to array of flag combinations */
+ size_t i, j, k, nrow, n_values;
+ herr_t status1;
+ void * handle_ptr = NULL; /* pointers to driver buffer */
unsigned char **core_buf_ptr_ptr = NULL;
- VERIFY(open_images > 1 , "The number of open images must be greater than 1");
+ VERIFY(open_images > 1, "The number of open images must be greater than 1");
VERIFY(nflags > 0, "The number of flag combinations must be greater than 0");
@@ -131,7 +131,8 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
FAIL_PUTS_ERROR("H5Pset_chunk() failed");
/* create and write an integer type dataset named "dset" */
- if ((dset_id[i] = H5Dcreate2(file_id[i], DSET_NAME, H5T_NATIVE_INT, file_space, H5P_DEFAULT, plist, H5P_DEFAULT)) < 0)
+ if ((dset_id[i] = H5Dcreate2(file_id[i], DSET_NAME, H5T_NATIVE_INT, file_space, H5P_DEFAULT, plist,
+ H5P_DEFAULT)) < 0)
FAIL_PUTS_ERROR("H5Dcreate() failed");
/* dataset in open image 1 is written with "wrong" data */
@@ -172,7 +173,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
/* buffer for file image 2 is filled with counter data (non-valid image) */
if (i == 2) {
for (j = 0; j < (size_t)buf_size[i]; j++)
- ((char*)(buf_ptr[i]))[j] = (char)j;
+ ((char *)(buf_ptr[i]))[j] = (char)j;
} /* end if */
/* buffers for the rest of the file images are filled with data from the respective files */
else {
@@ -181,7 +182,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
} /* end else */
/* file close */
- if (H5Fclose (file_id[i]) < 0)
+ if (H5Fclose(file_id[i]) < 0)
FAIL_PUTS_ERROR("H5Fclose() failed");
} /* end for */
@@ -193,10 +194,12 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
for (i = 0; i < open_images; i++) {
/* open file image 2 filled with counter data (non-valid image) */
if (i == 2) {
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
/* attempt to set file image in the core driver */
file_id[i] = H5LTopen_file_image(buf_ptr[i], (size_t)buf_size[i], input_flags[i]);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
VERIFY(file_id[i] < 0, "H5LTopen_file_image() should have failed");
} /* end if */
@@ -208,36 +211,41 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
/* get pointer to the image buffer of the core driver */
if (H5Fget_vfd_handle(file_id[i], H5P_DEFAULT, &handle_ptr) < 0)
- FAIL_PUTS_ERROR("H5Fget_vfd_handle() failed");
+ FAIL_PUTS_ERROR("H5Fget_vfd_handle() failed");
core_buf_ptr_ptr = (unsigned char **)handle_ptr;
/* test whether the user buffer has been copied or not */
if (input_flags[i] & H5LT_FILE_IMAGE_DONT_COPY)
- VERIFY(*core_buf_ptr_ptr == buf_ptr[i], "vfd buffer and user buffer should have been the same");
+ VERIFY(*core_buf_ptr_ptr == buf_ptr[i],
+ "vfd buffer and user buffer should have been the same");
else
VERIFY(*core_buf_ptr_ptr != buf_ptr[i], "vfd buffer and user buffer should be different");
- /*
+ /*
* When the vfd and user buffers are different and H5LT_FILE_IMAGE_OPEN_RW is enabled,
* status_flags in the superblock needs to be cleared in the vfd buffer for
* the comparison to proceed as expected. The user buffer as returned from H5Fget_file_image()
* has already cleared status_flags. The superblock's status_flags is used for the
* implementation of file locking.
*/
- if(input_flags[i] & H5LT_FILE_IMAGE_OPEN_RW && !(input_flags[i] & H5LT_FILE_IMAGE_DONT_COPY)) {
+ if (input_flags[i] & H5LT_FILE_IMAGE_OPEN_RW && !(input_flags[i] & H5LT_FILE_IMAGE_DONT_COPY)) {
void *tmp_ptr = HDmalloc((size_t)buf_size[i]);
/* Copy vfd buffer to a temporary buffer */
HDmemcpy(tmp_ptr, (void *)*core_buf_ptr_ptr, (size_t)buf_size[i]);
- /* Clear status_flags in the superblock for the vfd buffer: file locking is using status_flags */
- HDmemset((uint8_t *)tmp_ptr + SUPER_STATUS_FLAGS_OFF_V0_V1, (int)0, (size_t)SUPER_STATUS_FLAGS_SIZE_V0_V1);
+ /* Clear status_flags in the superblock for the vfd buffer: file locking is using status_flags
+ */
+ HDmemset((uint8_t *)tmp_ptr + SUPER_STATUS_FLAGS_OFF_V0_V1, (int)0,
+ (size_t)SUPER_STATUS_FLAGS_SIZE_V0_V1);
/* Does the comparision */
- if(HDmemcmp(tmp_ptr, buf_ptr[i], (size_t)buf_size[i]) != 0)
+ if (HDmemcmp(tmp_ptr, buf_ptr[i], (size_t)buf_size[i]) != 0)
FAIL_PUTS_ERROR("comparison of TMP vfd and user buffer failed");
/* Free the temporary buffer */
- if(tmp_ptr) HDfree(tmp_ptr);
- } else {
+ if (tmp_ptr)
+ HDfree(tmp_ptr);
+ }
+ else {
/* test whether the contents of the user buffer and driver buffer */
/* are equal. */
@@ -245,7 +253,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
FAIL_PUTS_ERROR("comparison of vfd and user buffer failed");
}
} /* end else */
- } /* end for */
+ } /* end for */
PASSED();
@@ -272,7 +280,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
FAIL_PUTS_ERROR("H5Sget_simple_extent_dims() failed");
/* read dataset */
- if (H5Dread(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data3) < 0)
+ if (H5Dread(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data3) < 0)
FAIL_PUTS_ERROR("H5Dread() failed");
/* compute number of elements in dataset */
@@ -286,7 +294,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
/* compare file image values with original data */
for (j = 0; j < n_values / nrow; j++)
for (k = 0; k < nrow; k++)
- if (data3[j * nrow + k ] == data1[j * nrow + k ])
+ if (data3[j * nrow + k] == data1[j * nrow + k])
FAIL_PUTS_ERROR("comparison of image values with original data should have failed");
} /* end if */
/* verify contents for the rest of the file images */
@@ -294,12 +302,12 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
/* compare file image values with original data */
for (j = 0; j < n_values / nrow; j++)
for (k = 0; k < nrow; k++)
- if (data3[j * nrow + k ] != data1[j * nrow + k ])
+ if (data3[j * nrow + k] != data1[j * nrow + k])
FAIL_PUTS_ERROR("comparison of image values with original data failed");
} /* end else */
/* close dataspace */
- if (H5Sclose (file_space) < 0)
+ if (H5Sclose(file_space) < 0)
FAIL_PUTS_ERROR("H5Sclose() failed");
} /* end for */
@@ -318,23 +326,26 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
/* test data write when file image access is read-only */
if (!(input_flags[i] & H5LT_FILE_IMAGE_OPEN_RW)) {
/* write dataset without extending it */
- H5E_BEGIN_TRY {
- status1 = H5Dwrite(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ status1 = H5Dwrite(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
+ }
+ H5E_END_TRY;
VERIFY(status1 < 0, "H5Dwrite() should have failed");
/* extend dimensions of dataset */
- H5E_BEGIN_TRY {
- status1 = H5Dset_extent(dset_id[i], dims4);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { status1 = H5Dset_extent(dset_id[i], dims4); }
+ H5E_END_TRY;
VERIFY(status1 < 0, "H5Dset_extent() should have failed");
/* write extended dataset */
- H5E_BEGIN_TRY {
- status1 = H5Dwrite(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data4);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ status1 = H5Dwrite(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data4);
+ }
+ H5E_END_TRY;
VERIFY(status1 < 0, "H5Dwrite() should have failed");
@@ -344,7 +355,8 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
} /* end if */
/* test data write where file image access is read-write */
else {
- if ((input_flags[i] & H5LT_FILE_IMAGE_DONT_COPY) && (input_flags[i] & H5LT_FILE_IMAGE_DONT_RELEASE)) {
+ if ((input_flags[i] & H5LT_FILE_IMAGE_DONT_COPY) &&
+ (input_flags[i] & H5LT_FILE_IMAGE_DONT_RELEASE)) {
/* This test is disabled currently, since the new attribute causes the file
* to increase in size, but the realloc call in H5FD_core_write() fails, causing
* the flush operation to fail and the file to fail to close, eventually
@@ -396,13 +408,13 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
H5Aclose(attr_id);
} H5E_END_TRY;
#endif
- if (H5Dclose(dset_id[i]) < 0)
- FAIL_PUTS_ERROR("H5Dclose() failed");
- dset_id[i] = -1;
+ if (H5Dclose(dset_id[i]) < 0)
+ FAIL_PUTS_ERROR("H5Dclose() failed");
+ dset_id[i] = -1;
} /* end if */
else {
/* write dataset without extending it */
- if (H5Dwrite(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1) < 0)
+ if (H5Dwrite(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1) < 0)
FAIL_PUTS_ERROR("H5Dwrite() failed");
/* extend dimensions of dataset */
@@ -410,15 +422,15 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
FAIL_PUTS_ERROR("H5Dset_extent() failed");
/* write extended dataset */
- if (H5Dwrite(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data4) < 0)
+ if (H5Dwrite(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data4) < 0)
FAIL_PUTS_ERROR("H5Dwrite() failed");
/* close dataset */
if (H5Dclose(dset_id[i]) < 0)
FAIL_PUTS_ERROR("H5Dclose() failed");
} /* end else */
- } /* end else */
- } /* end for */
+ } /* end else */
+ } /* end for */
PASSED();
@@ -427,7 +439,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
/* read open file images and verify data */
for (i = 0; i < open_images; i++) {
/* if opening the file image failed, continue next iteration */
- if ((dset_id[i] < 0) || (file_id[i] < 0) || (!(input_flags[i] & H5LT_FILE_IMAGE_OPEN_RW )))
+ if ((dset_id[i] < 0) || (file_id[i] < 0) || (!(input_flags[i] & H5LT_FILE_IMAGE_OPEN_RW)))
continue;
/* open dataset in file image */
@@ -443,7 +455,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
FAIL_PUTS_ERROR("H5Sget_simple_extent_dims() failed");
/* read dataset */
- if (H5Dread(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data3) < 0)
+ if (H5Dread(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data3) < 0)
FAIL_PUTS_ERROR("H5Dread() failed");
/* compute number of elements in dataset */
@@ -455,11 +467,11 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
/* verify contents for the file images */
for (j = 0; j < n_values / nrow; j++)
for (k = 0; k < nrow; k++)
- if (data3[j * nrow + k ] != data4[j * nrow + k ])
+ if (data3[j * nrow + k] != data4[j * nrow + k])
FAIL_PUTS_ERROR("comparison of image values with original data failed");
/* close dataspace */
- if (H5Sclose (file_space) < 0)
+ if (H5Sclose(file_space) < 0)
FAIL_PUTS_ERROR("H5Sclose() failed");
/* close dataset */
@@ -485,7 +497,8 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
FAIL_PUTS_ERROR("HDremove() failed");
/* free shared buffer if appropriate */
- if (!(input_flags[i] & H5LT_FILE_IMAGE_DONT_COPY) || (input_flags[i] & H5LT_FILE_IMAGE_DONT_RELEASE)) {
+ if (!(input_flags[i] & H5LT_FILE_IMAGE_DONT_COPY) ||
+ (input_flags[i] & H5LT_FILE_IMAGE_DONT_RELEASE)) {
VERIFY(buf_ptr[i] != NULL, "buffer pointer must be non NULL");
HDfree(buf_ptr[i]);
} /* end if */
@@ -512,15 +525,16 @@ error:
}
/*-------------------------------------------------------------------------
-* the main program
-*-------------------------------------------------------------------------
-*/
-int main( void )
+ * the main program
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
{
- int nerrors = 0;
- size_t open_images = 10; /* number of open file images */
- size_t nflags = 8; /* number of flag combinations */
- unsigned flags[8]; /* array with flag combinations */
+ int nerrors = 0;
+ size_t open_images = 10; /* number of open file images */
+ size_t nflags = 8; /* number of flag combinations */
+ unsigned flags[8]; /* array with flag combinations */
/* set flag combinations for testing */
flags[0] = 0;
@@ -533,14 +547,14 @@ int main( void )
flags[7] = H5LT_FILE_IMAGE_OPEN_RW | H5LT_FILE_IMAGE_DONT_COPY | H5LT_FILE_IMAGE_DONT_RELEASE;
/* Test file image operations. The flag combinations are assigned to file images in round-robin fashion */
- nerrors += test_file_image(open_images, nflags, flags) < 0? 1 : 0;
+ nerrors += test_file_image(open_images, nflags, flags) < 0 ? 1 : 0;
- if (nerrors) goto error;
+ if (nerrors)
+ goto error;
HDprintf("File image tests passed.\n");
return 0;
error:
- HDprintf("***** %d IMAGE TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d IMAGE TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
return 1;
}
-
diff --git a/hl/test/test_h5do_compat.c b/hl/test/test_h5do_compat.c
index 75028fb..7efef3f 100644
--- a/hl/test/test_h5do_compat.c
+++ b/hl/test/test_h5do_compat.c
@@ -20,12 +20,11 @@
#ifndef H5_NO_DEPRECATED_SYMBOLS
-#define FILE_NAME "h5do_compat.h5"
-#define DATASET_NAME "direct_chunk_io"
-
-#define NX 8
-#define CHUNK_NX 4
+#define FILE_NAME "h5do_compat.h5"
+#define DATASET_NAME "direct_chunk_io"
+#define NX 8
+#define CHUNK_NX 4
/*-------------------------------------------------------------------------
* Function: test_direct_chunk_write
@@ -40,12 +39,12 @@
static hid_t
create_dataset(hid_t fid)
{
- hid_t did = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hid_t dcpl_id = H5I_INVALID_HID;
- hsize_t dims[1] = {NX};
- hsize_t maxdims[1] = {H5S_UNLIMITED};
- hsize_t chunk_dims[1] = {CHUNK_NX};
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hsize_t dims[1] = {NX};
+ hsize_t maxdims[1] = {H5S_UNLIMITED};
+ hsize_t chunk_dims[1] = {CHUNK_NX};
int data[NX];
int i;
@@ -79,19 +78,19 @@ create_dataset(hid_t fid)
return did;
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Sclose(sid);
H5Pclose(dcpl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return H5I_INVALID_HID;
} /* end create_dataset() */
-
-
/*-------------------------------------------------------------------------
* Function: test_direct_chunk_write
*
@@ -105,11 +104,11 @@ create_dataset(hid_t fid)
static int
test_direct_chunk_write(hid_t did)
{
- unsigned filter_mask = 0;
- int chunk_data[CHUNK_NX];
- hsize_t offset[1];
- size_t data_size;
- int i;
+ unsigned filter_mask = 0;
+ int chunk_data[CHUNK_NX];
+ hsize_t offset[1];
+ size_t data_size;
+ int i;
HL_TESTING2("H5DOwrite_chunk wrapper");
@@ -124,7 +123,7 @@ test_direct_chunk_write(hid_t did)
* dataset, using the direct writing function.
*/
offset[0] = 0;
- for (i = 0; i < NX/CHUNK_NX; i++) {
+ for (i = 0; i < NX / CHUNK_NX; i++) {
if (H5DOwrite_chunk(did, H5P_DEFAULT, filter_mask, offset, data_size, chunk_data) < 0)
TEST_ERROR
offset[0] += CHUNK_NX;
@@ -138,7 +137,6 @@ error:
return 1;
} /* test_direct_chunk_write() */
-
/*-------------------------------------------------------------------------
* Function: test_direct_chunk_read
*
@@ -152,22 +150,22 @@ error:
static int
test_direct_chunk_read(hid_t did)
{
- hid_t mem_sid = H5I_INVALID_HID;
- hid_t file_sid = H5I_INVALID_HID;
- hsize_t dims[1] = {NX};
- hsize_t chunk_dims[1] = {CHUNK_NX};
+ hid_t mem_sid = H5I_INVALID_HID;
+ hid_t file_sid = H5I_INVALID_HID;
+ hsize_t dims[1] = {NX};
+ hsize_t chunk_dims[1] = {CHUNK_NX};
- unsigned filter_mask;
- int chunk_data[CHUNK_NX]; /* Chunk read with H5DOread_chunk */
- int check[CHUNK_NX]; /* Chunk read with H5Dread */
- hsize_t offset[1];
+ unsigned filter_mask;
+ int chunk_data[CHUNK_NX]; /* Chunk read with H5DOread_chunk */
+ int check[CHUNK_NX]; /* Chunk read with H5Dread */
+ hsize_t offset[1];
- hsize_t start[1]; /* Start of hyperslab */
- hsize_t stride[1]; /* Stride of hyperslab */
- hsize_t count[1]; /* Block count */
- hsize_t block[1]; /* Block sizes */
+ hsize_t start[1]; /* Start of hyperslab */
+ hsize_t stride[1]; /* Stride of hyperslab */
+ hsize_t count[1]; /* Block count */
+ hsize_t block[1]; /* Block sizes */
- int i,j;
+ int i, j;
HL_TESTING2("H5DOread_chunk wrapper");
@@ -178,7 +176,7 @@ test_direct_chunk_read(hid_t did)
TEST_ERROR
/* For each chunk in the dataset, compare the result of H5Dread and H5DOread_chunk. */
- for (i = 0; i < NX/CHUNK_NX; i++) {
+ for (i = 0; i < NX / CHUNK_NX; i++) {
/* Select hyperslab for one chunk in the file */
start[0] = (hsize_t)i * CHUNK_NX;
@@ -197,7 +195,7 @@ test_direct_chunk_read(hid_t did)
/* Read the raw chunk back */
HDmemset(chunk_data, 0, CHUNK_NX * sizeof(int));
filter_mask = UINT_MAX;
- offset[0] = (hsize_t)i * CHUNK_NX;
+ offset[0] = (hsize_t)i * CHUNK_NX;
if (H5DOread_chunk(did, H5P_DEFAULT, offset, &filter_mask, chunk_data) < 0)
TEST_ERROR
@@ -221,10 +219,12 @@ test_direct_chunk_read(hid_t did)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(mem_sid);
H5Sclose(file_sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5_FAILED();
return 1;
@@ -232,7 +232,6 @@ error:
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -244,7 +243,8 @@ error:
*
*-------------------------------------------------------------------------
*/
-int main( void )
+int
+main(void)
{
#ifdef H5_NO_DEPRECATED_SYMBOLS
@@ -254,9 +254,9 @@ int main( void )
#else
- hid_t fid = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
- int nerrors = 0;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ int nerrors = 0;
if ((fid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
diff --git a/hl/test/test_image.c b/hl/test/test_image.c
index 06a0ff3..0cdb2d3 100644
--- a/hl/test/test_image.c
+++ b/hl/test/test_image.c
@@ -1,15 +1,15 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5hltest.h"
#include "H5srcdir.h"
@@ -35,10 +35,9 @@
#define PAL3_NAME "earth"
#define PAL4_NAME "blue-red"
-
-#define WIDTH 400
-#define HEIGHT 200
-#define PAL_ENTRIES 256
+#define WIDTH 400
+#define HEIGHT 200
+#define PAL_ENTRIES 256
/* struct to store RGB values read from a .pal file */
typedef struct rgb_t {
@@ -51,54 +50,57 @@ typedef struct rgb_t {
static int test_simple(void);
static int test_data(void);
static int test_generate(void);
-static int read_data(const char* file_name, hsize_t *width, hsize_t *height );
-static int read_palette(const char* file_name, rgb_t *palette, size_t palette_size);
+static int read_data(const char *file_name, hsize_t *width, hsize_t *height);
+static int read_palette(const char *file_name, rgb_t *palette, size_t palette_size);
/* globals */
unsigned char *image_data = NULL;
/*-------------------------------------------------------------------------
-* the main program
-*-------------------------------------------------------------------------
-*/
+ * the main program
+ *-------------------------------------------------------------------------
+ */
-int main(void)
+int
+main(void)
{
- int nerrors=0;
+ int nerrors = 0;
- nerrors += test_simple()<0 ?1:0;
- nerrors += test_data()<0 ?1:0;
- nerrors += test_generate()<0 ?1:0;
+ nerrors += test_simple() < 0 ? 1 : 0;
+ nerrors += test_data() < 0 ? 1 : 0;
+ nerrors += test_generate() < 0 ? 1 : 0;
- if (nerrors) goto error;
+ if (nerrors)
+ goto error;
HDprintf("All image tests passed.\n");
return 0;
error:
- HDprintf("***** %d IMAGE TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d IMAGE TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
return 1;
}
/*-------------------------------------------------------------------------
-* a simple test that generates images and palettes
-*-------------------------------------------------------------------------
-*/
+ * a simple test that generates images and palettes
+ *-------------------------------------------------------------------------
+ */
-static int test_simple(void)
+static int
+test_simple(void)
{
- hsize_t width = WIDTH;
- hsize_t height = HEIGHT;
- hsize_t planes;
- hid_t fid;
- int i, j, n, space;
- hsize_t u;
- char interlace[20];
- hssize_t npals;
+ hsize_t width = WIDTH;
+ hsize_t height = HEIGHT;
+ hsize_t planes;
+ hid_t fid;
+ int i, j, n, space;
+ hsize_t u;
+ char interlace[20];
+ hssize_t npals;
/* 8-bit image */
unsigned char *buf1 = NULL;
- unsigned char pal[ PAL_ENTRIES * 3 ]; /* palette array */
- hsize_t pal_dims[2] = {PAL_ENTRIES,3}; /* palette dimensions */
+ unsigned char pal[PAL_ENTRIES * 3]; /* palette array */
+ hsize_t pal_dims[2] = {PAL_ENTRIES, 3}; /* palette dimensions */
/* 24-bit image */
unsigned char *buf2 = NULL;
@@ -106,395 +108,373 @@ static int test_simple(void)
/* read data */
unsigned char *buf1_out = NULL;
unsigned char *buf2_out = NULL;
- unsigned char pal_out[ PAL_ENTRIES * 3 ]; /* palette array */
- hsize_t pal_dims_out[2]; /* palette dimensions */
+ unsigned char pal_out[PAL_ENTRIES * 3]; /* palette array */
+ hsize_t pal_dims_out[2]; /* palette dimensions */
/* Allocate image buffers */
buf1 = (unsigned char *)HDmalloc(WIDTH * HEIGHT);
HDassert(buf1);
- buf2 = (unsigned char *)HDmalloc(WIDTH * HEIGHT * 3);
+ buf2 = (unsigned char *)HDmalloc(WIDTH * HEIGHT * 3);
HDassert(buf2);
buf1_out = (unsigned char *)HDmalloc(WIDTH * HEIGHT);
HDassert(buf1_out);
- buf2_out = (unsigned char *)HDmalloc(WIDTH * HEIGHT * 3);
+ buf2_out = (unsigned char *)HDmalloc(WIDTH * HEIGHT * 3);
HDassert(buf2_out);
/* create an image */
- space = WIDTH*HEIGHT / PAL_ENTRIES;
- for (i=0, j=0, n=0; i < WIDTH*HEIGHT; i++, j++ )
- {
+ space = WIDTH * HEIGHT / PAL_ENTRIES;
+ for (i = 0, j = 0, n = 0; i < WIDTH * HEIGHT; i++, j++) {
buf1[i] = (unsigned char)n;
- if ( j > space )
- {
+ if (j > space) {
n++;
- j=0;
+ j = 0;
}
-
}
/* create an image */
- space = WIDTH*HEIGHT / 256;
- for (i=0, j=0, n=0; i < WIDTH*HEIGHT*3; i+=3, j++ )
- {
- buf2[i] = (unsigned char)n;
- buf2[i+1] = 0;
- buf2[i+2] = (unsigned char)(255 - n);
- if ( j > space )
- {
+ space = WIDTH * HEIGHT / 256;
+ for (i = 0, j = 0, n = 0; i < WIDTH * HEIGHT * 3; i += 3, j++) {
+ buf2[i] = (unsigned char)n;
+ buf2[i + 1] = 0;
+ buf2[i + 2] = (unsigned char)(255 - n);
+ if (j > space) {
n++;
- j=0;
+ j = 0;
}
}
/*-------------------------------------------------------------------------
- * define a palette, blue to red tones
- *-------------------------------------------------------------------------
- */
- for ( i=0, n=0; i<PAL_ENTRIES*3; i+=3, n++)
- {
- pal[i] =(unsigned char)n; /* red */
- pal[i+1]=0; /* green */
- pal[i+2]=(unsigned char)(255 - n); /* blue */
+ * define a palette, blue to red tones
+ *-------------------------------------------------------------------------
+ */
+ for (i = 0, n = 0; i < PAL_ENTRIES * 3; i += 3, n++) {
+ pal[i] = (unsigned char)n; /* red */
+ pal[i + 1] = 0; /* green */
+ pal[i + 2] = (unsigned char)(255 - n); /* blue */
}
/* Create a new HDF5 file using default properties. */
- fid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
+ fid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * Indexed image test
- *-------------------------------------------------------------------------
- */
+ * Indexed image test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("indexed image");
/* Write image */
- if ( H5IMmake_image_8bit( fid, IMAGE1_NAME, width, height, buf1 ) < 0 )
+ if (H5IMmake_image_8bit(fid, IMAGE1_NAME, width, height, buf1) < 0)
goto out;
/* Make a palette */
- if ( H5IMmake_palette( fid, PAL_NAME, pal_dims, pal ) < 0 )
+ if (H5IMmake_palette(fid, PAL_NAME, pal_dims, pal) < 0)
goto out;
/* Attach a palette to the image dataset */
- if ( H5IMlink_palette( fid, IMAGE1_NAME, PAL_NAME ) < 0 )
+ if (H5IMlink_palette(fid, IMAGE1_NAME, PAL_NAME) < 0)
goto out;
/* Read image */
- if ( H5IMget_image_info( fid, IMAGE1_NAME, &width, &height, &planes, interlace, &npals ) < 0 )
+ if (H5IMget_image_info(fid, IMAGE1_NAME, &width, &height, &planes, interlace, &npals) < 0)
goto out;
- if ( H5IMread_image( fid, IMAGE1_NAME, buf1_out ) < 0 )
+ if (H5IMread_image(fid, IMAGE1_NAME, buf1_out) < 0)
goto out;
- for (u = 0; u < height*width*planes; u++)
- {
- if ( buf1[u] != buf1_out[u] )
+ for (u = 0; u < height * width * planes; u++) {
+ if (buf1[u] != buf1_out[u])
goto out;
-
}
-
PASSED();
/*-------------------------------------------------------------------------
- * True color image test
- *-------------------------------------------------------------------------
- */
+ * True color image test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("true color image");
/* Write image */
- if ( H5IMmake_image_24bit( fid, IMAGE2_NAME, width, height, "INTERLACE_PIXEL", buf2 ) )
+ if (H5IMmake_image_24bit(fid, IMAGE2_NAME, width, height, "INTERLACE_PIXEL", buf2))
goto out;
/* Read image */
- if ( H5IMget_image_info( fid, IMAGE2_NAME, &width, &height, &planes, interlace, &npals ) < 0 )
+ if (H5IMget_image_info(fid, IMAGE2_NAME, &width, &height, &planes, interlace, &npals) < 0)
goto out;
- if ( H5IMread_image( fid, IMAGE2_NAME, buf2_out ) < 0 )
+ if (H5IMread_image(fid, IMAGE2_NAME, buf2_out) < 0)
goto out;
- for (u = 0; u < height*width*planes; u++)
- {
- if ( buf2[u] != buf2_out[u] )
+ for (u = 0; u < height * width * planes; u++) {
+ if (buf2[u] != buf2_out[u])
goto out;
}
-
PASSED();
/*-------------------------------------------------------------------------
- * H5IMget_npalettes test
- *-------------------------------------------------------------------------
- */
+ * H5IMget_npalettes test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("pallete functions");
- if ( H5IMget_npalettes( fid, IMAGE1_NAME, &npals ) < 0 )
+ if (H5IMget_npalettes(fid, IMAGE1_NAME, &npals) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5IMget_palette_info test
- *-------------------------------------------------------------------------
- */
+ * H5IMget_palette_info test
+ *-------------------------------------------------------------------------
+ */
- if ( H5IMget_palette_info( fid, IMAGE1_NAME, 0, pal_dims_out ) < 0 )
+ if (H5IMget_palette_info(fid, IMAGE1_NAME, 0, pal_dims_out) < 0)
goto out;
- for (i = 0; i < 2; i++)
- {
- if ( pal_dims[i] != pal_dims_out[i] )
+ for (i = 0; i < 2; i++) {
+ if (pal_dims[i] != pal_dims_out[i])
goto out;
}
/*-------------------------------------------------------------------------
- * H5IMget_palette test
- *-------------------------------------------------------------------------
- */
+ * H5IMget_palette test
+ *-------------------------------------------------------------------------
+ */
- if ( H5IMget_palette( fid, IMAGE1_NAME, 0, pal_out ) < 0 )
+ if (H5IMget_palette(fid, IMAGE1_NAME, 0, pal_out) < 0)
goto out;
- for (i = 0; i < PAL_ENTRIES * 3; i++)
- {
- if ( pal[i] != pal_out[i] )
+ for (i = 0; i < PAL_ENTRIES * 3; i++) {
+ if (pal[i] != pal_out[i])
goto out;
}
/*-------------------------------------------------------------------------
- * H5IMis_image test
- *-------------------------------------------------------------------------
- */
+ * H5IMis_image test
+ *-------------------------------------------------------------------------
+ */
- if ( H5IMis_image( fid, IMAGE1_NAME ) < 0 )
+ if (H5IMis_image(fid, IMAGE1_NAME) < 0)
goto out;
- if ( H5IMis_image( fid, IMAGE2_NAME ) < 0 )
+ if (H5IMis_image(fid, IMAGE2_NAME) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5IMis_palette test
- *-------------------------------------------------------------------------
- */
+ * H5IMis_palette test
+ *-------------------------------------------------------------------------
+ */
- if ( H5IMis_palette( fid, PAL_NAME ) < 0 )
+ if (H5IMis_palette(fid, PAL_NAME) < 0)
goto out;
/*-------------------------------------------------------------------------
- * end tests
- *-------------------------------------------------------------------------
- */
+ * end tests
+ *-------------------------------------------------------------------------
+ */
- if(buf1)
+ if (buf1)
HDfree(buf1);
- if(buf2)
+ if (buf2)
HDfree(buf2);
- if(buf1_out)
+ if (buf1_out)
HDfree(buf1_out);
- if(buf2_out)
+ if (buf2_out)
HDfree(buf2_out);
/* Close the file. */
- if(H5Fclose( fid ) < 0)
+ if (H5Fclose(fid) < 0)
goto out;
-
PASSED();
return 0;
/* error zone, gracefully close */
out:
- if(buf1)
+ if (buf1)
HDfree(buf1);
- if(buf2)
+ if (buf2)
HDfree(buf2);
- if(buf1_out)
+ if (buf1_out)
HDfree(buf1_out);
- if(buf2_out)
+ if (buf2_out)
HDfree(buf2_out);
- H5E_BEGIN_TRY {
- H5Fclose(fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Fclose(fid); }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-
/*-------------------------------------------------------------------------
-* read sample realistic image data from ASCII files
-*-------------------------------------------------------------------------
-*/
+ * read sample realistic image data from ASCII files
+ *-------------------------------------------------------------------------
+ */
-static int test_data(void)
+static int
+test_data(void)
{
- hid_t fid;
- hsize_t pal_dims[2];
- hsize_t width;
- hsize_t height;
- unsigned char pal[256*3]; /* buffer to hold an HDF5 palette */
- rgb_t rgb[256]; /* buffer to hold a .pal file palette */
- int i, n;
+ hid_t fid;
+ hsize_t pal_dims[2];
+ hsize_t width;
+ hsize_t height;
+ unsigned char pal[256 * 3]; /* buffer to hold an HDF5 palette */
+ rgb_t rgb[256]; /* buffer to hold a .pal file palette */
+ int i, n;
/* create a file using default properties */
- if ((fid=H5Fcreate(FILE2,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
+ if ((fid = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
HDprintf("Testing read ascii image data and generate images\n");
/*-------------------------------------------------------------------------
- * read 8bit image data
- *-------------------------------------------------------------------------
- */
+ * read 8bit image data
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("make indexed image");
/* read first data file */
- if (read_data(DATA_FILE1,&width,&height)<0)
+ if (read_data(DATA_FILE1, &width, &height) < 0)
goto out;
/* make an image */
- if (H5IMmake_image_8bit(fid,IMAGE1_NAME,width,height,image_data)<0)
+ if (H5IMmake_image_8bit(fid, IMAGE1_NAME, width, height, image_data) < 0)
goto out;
PASSED();
-
HL_TESTING2("attaching palettes");
/*-------------------------------------------------------------------------
- * palette #1. rainbow palette. data is contained in "pal_rgb.h"
- *-------------------------------------------------------------------------
- */
+ * palette #1. rainbow palette. data is contained in "pal_rgb.h"
+ *-------------------------------------------------------------------------
+ */
/* initialize the palette data */
pal_dims[0] = 256;
pal_dims[1] = 3;
/* make a palette */
- if (H5IMmake_palette(fid,PAL1_NAME,pal_dims,pal_rgb)<0)
+ if (H5IMmake_palette(fid, PAL1_NAME, pal_dims, pal_rgb) < 0)
goto out;
/* attach a palette to the image dataset */
- if (H5IMlink_palette(fid,IMAGE1_NAME,PAL1_NAME)<0)
+ if (H5IMlink_palette(fid, IMAGE1_NAME, PAL1_NAME) < 0)
goto out;
/*-------------------------------------------------------------------------
- * palette #2. sepia palette.
- * read a PAL file and attach the palette to the HDF5 file
- *-------------------------------------------------------------------------
- */
+ * palette #2. sepia palette.
+ * read a PAL file and attach the palette to the HDF5 file
+ *-------------------------------------------------------------------------
+ */
/* read a PAL file */
if (read_palette(PAL2_FILE, rgb, (sizeof(rgb) / sizeof(rgb[0]))) < 0)
goto out;
/* transfer to the HDF5 buffer */
- for ( i=0, n=0; i<256*3; i+=3, n++)
- {
- pal[i] =rgb[n].r;
- pal[i+1]=rgb[n].g;
- pal[i+2]=rgb[n].b;
+ for (i = 0, n = 0; i < 256 * 3; i += 3, n++) {
+ pal[i] = rgb[n].r;
+ pal[i + 1] = rgb[n].g;
+ pal[i + 2] = rgb[n].b;
}
/* make a palette */
- if (H5IMmake_palette(fid,PAL2_NAME,pal_dims,pal)<0)
+ if (H5IMmake_palette(fid, PAL2_NAME, pal_dims, pal) < 0)
goto out;
/* attach the palette to the image dataset */
- if (H5IMlink_palette(fid,IMAGE1_NAME,PAL2_NAME)<0)
+ if (H5IMlink_palette(fid, IMAGE1_NAME, PAL2_NAME) < 0)
goto out;
/*-------------------------------------------------------------------------
- * palette #3. earth palette.
- * read a PAL file and attach the palette to the HDF5 file
- *-------------------------------------------------------------------------
- */
+ * palette #3. earth palette.
+ * read a PAL file and attach the palette to the HDF5 file
+ *-------------------------------------------------------------------------
+ */
/* read a PAL file */
if (read_palette(PAL3_FILE, rgb, (sizeof(rgb) / sizeof(rgb[0]))) < 0)
goto out;
/* transfer to the HDF5 buffer */
- for ( i=0, n=0; i<256*3; i+=3, n++)
- {
- pal[i] =rgb[n].r;
- pal[i+1]=rgb[n].g;
- pal[i+2]=rgb[n].b;
+ for (i = 0, n = 0; i < 256 * 3; i += 3, n++) {
+ pal[i] = rgb[n].r;
+ pal[i + 1] = rgb[n].g;
+ pal[i + 2] = rgb[n].b;
}
/* make a palette */
- if (H5IMmake_palette(fid,PAL3_NAME,pal_dims,pal)<0)
+ if (H5IMmake_palette(fid, PAL3_NAME, pal_dims, pal) < 0)
goto out;
/* attach the palette to the image dataset */
- if (H5IMlink_palette(fid,IMAGE1_NAME,PAL3_NAME)<0)
+ if (H5IMlink_palette(fid, IMAGE1_NAME, PAL3_NAME) < 0)
goto out;
PASSED();
-
/*-------------------------------------------------------------------------
- * palette #4. blue-red
- * make a palette whith blue to red colors
- *-------------------------------------------------------------------------
- */
- for ( i=0, n=0; i<256*3; i+=3, n++)
- {
- pal[i] =(unsigned char)n;
- pal[i+1]=0;
- pal[i+2]=(unsigned char)(255 - n);
+ * palette #4. blue-red
+ * make a palette whith blue to red colors
+ *-------------------------------------------------------------------------
+ */
+ for (i = 0, n = 0; i < 256 * 3; i += 3, n++) {
+ pal[i] = (unsigned char)n;
+ pal[i + 1] = 0;
+ pal[i + 2] = (unsigned char)(255 - n);
}
/* make a palette */
- if (H5IMmake_palette(fid,PAL4_NAME,pal_dims,pal)<0)
+ if (H5IMmake_palette(fid, PAL4_NAME, pal_dims, pal) < 0)
goto out;
/* attach the palette to the image dataset */
- if (H5IMlink_palette(fid,IMAGE1_NAME,PAL4_NAME)<0)
+ if (H5IMlink_palette(fid, IMAGE1_NAME, PAL4_NAME) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * true color image example with pixel interlace
- *-------------------------------------------------------------------------
- */
+ * true color image example with pixel interlace
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("make true color image with pixel interlace");
/* read second data file */
- if ((read_data(DATA_FILE2,&width,&height))<0)
+ if ((read_data(DATA_FILE2, &width, &height)) < 0)
goto out;
/* make image */
- if ((H5IMmake_image_24bit(fid,IMAGE2_NAME,width,height,"INTERLACE_PIXEL",image_data))<0)
+ if ((H5IMmake_image_24bit(fid, IMAGE2_NAME, width, height, "INTERLACE_PIXEL", image_data)) < 0)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * True color image example with plane interlace
- *-------------------------------------------------------------------------
- */
+ * True color image example with plane interlace
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("make true color image with plane interlace");
/* read third data file */
- if ((read_data(DATA_FILE3,&width,&height))<0)
+ if ((read_data(DATA_FILE3, &width, &height)) < 0)
goto out;
/* make image */
- if ((H5IMmake_image_24bit(fid,IMAGE3_NAME,width,height,"INTERLACE_PLANE",image_data))<0)
+ if ((H5IMmake_image_24bit(fid, IMAGE3_NAME, width, height, "INTERLACE_PLANE", image_data)) < 0)
goto out;
PASSED();
-
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- if (H5Fclose(fid)<0)
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Fclose(fid) < 0)
goto out;
/* Release memory buffer */
@@ -505,18 +485,16 @@ static int test_data(void)
/* error zone, gracefully close */
out:
/* Release memory buffer */
- if(image_data)
+ if (image_data)
HDfree(image_data);
- H5E_BEGIN_TRY {
- H5Fclose(fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Fclose(fid); }
+ H5E_END_TRY;
H5_FAILED();
return FAIL;
}
-
/*
The following test provides an examples of how to generate HDF5 image data from
floating point data. In the example we use real life topographic data
@@ -530,34 +508,34 @@ http://modb.oce.ulg.ac.be/
*/
-static int test_generate(void)
+static int
+test_generate(void)
{
- hid_t fid;
- hsize_t pal_dims[2] = { 256, 3 };
- float *data = NULL;
- int imax, jmax, kmax;
- int n_elements;
- float valex, xmin, xmax, value;
- FILE *f = NULL;
+ hid_t fid;
+ hsize_t pal_dims[2] = {256, 3};
+ float * data = NULL;
+ int imax, jmax, kmax;
+ int n_elements;
+ float valex, xmin, xmax, value;
+ FILE * f = NULL;
const char *data_file = H5_get_srcdir_filename(DATA_FILE4);
- int i;
- int retval = FAIL;
+ int i;
+ int retval = FAIL;
/* create a file using default properties */
- if ((fid=H5Fcreate(FILE3,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
+ if ((fid = H5Fcreate(FILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
HDprintf("Testing read and process data and make indexed images\n");
/*-------------------------------------------------------------------------
- * read data; the file data format is described below
- *-------------------------------------------------------------------------
- */
+ * read data; the file data format is described below
+ *-------------------------------------------------------------------------
+ */
- f = HDfopen( data_file, "r" ) ;
- if ( f == NULL )
- {
- HDprintf( "Could not find file %s. Try set $srcdir \n", data_file );
+ f = HDfopen(data_file, "r");
+ if (f == NULL) {
+ HDprintf("Could not find file %s. Try set $srcdir \n", data_file);
goto out;
}
@@ -596,45 +574,43 @@ static int test_generate(void)
!
*/
-
- if(fscanf( f, "%d %d %d", &imax, &jmax, &kmax ) < 0 && HDferror(f)) {
- HDprintf( "fscanf error in file %s.\n", data_file );
+ if (fscanf(f, "%d %d %d", &imax, &jmax, &kmax) < 0 && HDferror(f)) {
+ HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
- if(fscanf( f, "%f %f %f", &valex, &xmin, &xmax ) < 0 && HDferror(f)) {
- HDprintf( "fscanf error in file %s.\n", data_file );
+ if (fscanf(f, "%f %f %f", &valex, &xmin, &xmax) < 0 && HDferror(f)) {
+ HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
/* Sanity check on scanned-in values */
- if(imax < 1 || jmax < 1 || kmax < 1)
+ if (imax < 1 || jmax < 1 || kmax < 1)
goto out;
/* Test product for integer overflow */
- if(imax > INT_MAX / jmax)
+ if (imax > INT_MAX / jmax)
goto out;
- if(imax * jmax > INT_MAX / kmax)
+ if (imax * jmax > INT_MAX / kmax)
goto out;
n_elements = imax * jmax * kmax;
/* Test buffer sizes for overflow */
- if(n_elements > INT_MAX / (int)sizeof(unsigned char))
+ if (n_elements > INT_MAX / (int)sizeof(unsigned char))
goto out;
- if(n_elements > INT_MAX / (int)sizeof(float))
+ if (n_elements > INT_MAX / (int)sizeof(float))
goto out;
data = (float *)HDmalloc((size_t)n_elements * sizeof(float));
- if(NULL == data)
+ if (NULL == data)
goto out;
image_data = (unsigned char *)HDmalloc((size_t)n_elements * sizeof(unsigned char));
- if(NULL == image_data)
+ if (NULL == image_data)
goto out;
- for ( i = 0; i < n_elements; i++ )
- {
- if(fscanf( f, "%f ", &value ) < 0 && HDferror(f)) {
- HDprintf( "fscanf error in file %s.\n", data_file );
+ for (i = 0; i < n_elements; i++) {
+ if (fscanf(f, "%f ", &value) < 0 && HDferror(f)) {
+ HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
data[i] = value;
@@ -643,93 +619,90 @@ static int test_generate(void)
f = NULL;
/*-------------------------------------------------------------------------
- * transform the data from floating point to unsigned char
- * we are processing all the data here
- *-------------------------------------------------------------------------
- */
+ * transform the data from floating point to unsigned char
+ * we are processing all the data here
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("make indexed image from all the data");
- for ( i = 0; i < n_elements; i++ )
- image_data[i] = (unsigned char)(( 255 * (data[i] - xmin ) ) / (xmax - xmin ));
+ for (i = 0; i < n_elements; i++)
+ image_data[i] = (unsigned char)((255 * (data[i] - xmin)) / (xmax - xmin));
/* Make the image */
- if ((H5IMmake_image_8bit(fid,"All data",(hsize_t)imax,(hsize_t)jmax,image_data))<0)
+ if ((H5IMmake_image_8bit(fid, "All data", (hsize_t)imax, (hsize_t)jmax, image_data)) < 0)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * transform the data from floating point to unsigned char
- * here we just process the land data
- *-------------------------------------------------------------------------
- */
+ * transform the data from floating point to unsigned char
+ * here we just process the land data
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("make indexed image from land data");
- for ( i = 0; i < n_elements; i++ )
- {
- if ( data[i] < 0 )
+ for (i = 0; i < n_elements; i++) {
+ if (data[i] < 0)
image_data[i] = 0;
else
- image_data[i] = (unsigned char)(( 255 * (data[i] ) ) / xmax );
+ image_data[i] = (unsigned char)((255 * (data[i])) / xmax);
}
/* make the image */
- if ((H5IMmake_image_8bit(fid,"Land data",(hsize_t)imax,(hsize_t)jmax,image_data))<0)
+ if ((H5IMmake_image_8bit(fid, "Land data", (hsize_t)imax, (hsize_t)jmax, image_data)) < 0)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * transform the data from floating point to unsigned char
- * here we just process the sea data
- *-------------------------------------------------------------------------
- */
+ * transform the data from floating point to unsigned char
+ * here we just process the sea data
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("make indexed image from sea data");
- for ( i = 0; i < n_elements; i++ )
- {
- if ( data[i] > 0 )
+ for (i = 0; i < n_elements; i++) {
+ if (data[i] > 0)
image_data[i] = 0;
else
- image_data[i] = (unsigned char)(( 255 * (data[i] - xmin ) ) / xmin );
+ image_data[i] = (unsigned char)((255 * (data[i] - xmin)) / xmin);
}
/* make the image */
- if ((H5IMmake_image_8bit(fid,"Sea data",(hsize_t)imax,(hsize_t)jmax,image_data))<0)
+ if ((H5IMmake_image_8bit(fid, "Sea data", (hsize_t)imax, (hsize_t)jmax, image_data)) < 0)
goto out;
PASSED();
/*-------------------------------------------------------------------------
- * make a palette and attach it to the datasets
- *-------------------------------------------------------------------------
- */
+ * make a palette and attach it to the datasets
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("attaching palettes");
/* make a palette */
- if ((H5IMmake_palette(fid,PAL1_NAME,pal_dims,pal_rgb))<0)
+ if ((H5IMmake_palette(fid, PAL1_NAME, pal_dims, pal_rgb)) < 0)
goto out;
/* attach the palette to the image datasets */
- if ((H5IMlink_palette(fid,"All data",PAL1_NAME))<0)
+ if ((H5IMlink_palette(fid, "All data", PAL1_NAME)) < 0)
goto out;
- if ((H5IMlink_palette(fid,"Land data",PAL1_NAME))<0)
+ if ((H5IMlink_palette(fid, "Land data", PAL1_NAME)) < 0)
goto out;
- if ((H5IMlink_palette(fid,"Sea data",PAL1_NAME))<0)
+ if ((H5IMlink_palette(fid, "Sea data", PAL1_NAME)) < 0)
goto out;
PASSED();
-
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- if (H5Fclose(fid)<0)
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Fclose(fid) < 0)
goto out;
/* Release memory buffers */
@@ -742,122 +715,121 @@ static int test_generate(void)
/* error zone, gracefully close */
out:
/* Release memory buffers */
- if(data)
+ if (data)
HDfree(data);
- if(image_data)
+ if (image_data)
HDfree(image_data);
- H5E_BEGIN_TRY {
- H5Fclose(fid);
- } H5E_END_TRY;
- if(f)
+ H5E_BEGIN_TRY { H5Fclose(fid); }
+ H5E_END_TRY;
+ if (f)
HDfclose(f);
H5_FAILED();
return retval;
}
-
/*-------------------------------------------------------------------------
-* read_data
-* utility function to read ASCII image data
-* the files have a header of the type
-*
-* components
-* n
-* height
-* n
-* width
-* n
-*
-* followed by the image data
-*
-*-------------------------------------------------------------------------
-*/
-
-static int read_data(const char* fname, /*IN*/
- hsize_t *width, /*OUT*/
- hsize_t *height /*OUT*/)
+ * read_data
+ * utility function to read ASCII image data
+ * the files have a header of the type
+ *
+ * components
+ * n
+ * height
+ * n
+ * width
+ * n
+ *
+ * followed by the image data
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static int
+read_data(const char *fname, /*IN*/
+ hsize_t * width, /*OUT*/
+ hsize_t * height /*OUT*/)
{
- int i, n;
- int color_planes;
- char str[20];
- FILE *f = NULL;
- int w, h;
- int n_elements;
+ int i, n;
+ int color_planes;
+ char str[20];
+ FILE * f = NULL;
+ int w, h;
+ int n_elements;
const char *data_file = H5_get_srcdir_filename(fname);
- int ret_val = -1;
+ int ret_val = -1;
/*-------------------------------------------------------------------------
- * read
- *-------------------------------------------------------------------------
- */
+ * read
+ *-------------------------------------------------------------------------
+ */
- if(NULL == (f = HDfopen(data_file, "r"))) {
- HDprintf( "Could not open file %s. Try set $srcdir \n", data_file );
+ if (NULL == (f = HDfopen(data_file, "r"))) {
+ HDprintf("Could not open file %s. Try set $srcdir \n", data_file);
goto out;
}
- if(fscanf(f, "%s", str) < 0 && HDferror(f)) {
- HDprintf( "fscanf error in file %s.\n", data_file );
+ if (fscanf(f, "%s", str) < 0 && HDferror(f)) {
+ HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
- if(fscanf(f, "%d", &color_planes) < 0 && HDferror(f)) {
- HDprintf( "fscanf error in file %s.\n", data_file );
+ if (fscanf(f, "%d", &color_planes) < 0 && HDferror(f)) {
+ HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
- if(fscanf(f, "%s", str) < 0 && HDferror(f)) {
- HDprintf( "fscanf error in file %s.\n", data_file );
+ if (fscanf(f, "%s", str) < 0 && HDferror(f)) {
+ HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
- if(fscanf(f, "%d", &h) < 0 && HDferror(f)) {
- HDprintf( "fscanf error in file %s.\n", data_file );
+ if (fscanf(f, "%d", &h) < 0 && HDferror(f)) {
+ HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
- if(fscanf(f, "%s", str) < 0 && HDferror(f)) {
- HDprintf( "fscanf error in file %s.\n", data_file );
+ if (fscanf(f, "%s", str) < 0 && HDferror(f)) {
+ HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
- if(fscanf(f, "%d", &w) < 0 && HDferror(f)) {
- HDprintf( "fscanf error in file %s.\n", data_file );
+ if (fscanf(f, "%d", &w) < 0 && HDferror(f)) {
+ HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
/* Check product for overflow */
- if(w < 1 || h < 1 || color_planes < 1)
+ if (w < 1 || h < 1 || color_planes < 1)
goto out;
- if(w > INT_MAX / h)
+ if (w > INT_MAX / h)
goto out;
- if(w * h > INT_MAX / color_planes)
+ if (w * h > INT_MAX / color_planes)
goto out;
/* Compute buffer size */
n_elements = w * h * color_planes;
/* Check buffer size for overflow */
- if(n_elements > INT_MAX / (int)sizeof(unsigned char))
+ if (n_elements > INT_MAX / (int)sizeof(unsigned char))
goto out;
/* Release the buffer, if it was previously allocated */
- if(image_data)
+ if (image_data)
HDfree(image_data);
/* Allocate the image data buffer */
image_data = (unsigned char *)HDmalloc((size_t)n_elements * sizeof(unsigned char));
- if(NULL == image_data)
+ if (NULL == image_data)
goto out;
- *width = (hsize_t)w;
+ *width = (hsize_t)w;
*height = (hsize_t)h;
/* Read data elements */
- for(i = 0; i < n_elements; i++) {
- if(fscanf(f, "%d", &n) < 0 && HDferror(f)) {
- HDprintf( "fscanf error in file %s.\n", data_file );
+ for (i = 0; i < n_elements; i++) {
+ if (fscanf(f, "%d", &n) < 0 && HDferror(f)) {
+ HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
image_data[i] = (unsigned char)n;
@@ -867,123 +839,108 @@ static int read_data(const char* fname, /*IN*/
ret_val = 1;
out:
- if(f)
+ if (f)
HDfclose(f);
return ret_val;
} /* end read_data() */
-
/*-------------------------------------------------------------------------
-* read_palette
-* Read an ASCII palette file .PAL into an array
-* the files have a header of the type
-*
-* Parameters:
-* fname - name of file to read.
-* palette - array of rgb_t to store the read palette.
-* palette_size - number of elements in 'palette' array
-*
-*-------------------------------------------------------------------------
-*/
-
+ * read_palette
+ * Read an ASCII palette file .PAL into an array
+ * the files have a header of the type
+ *
+ * Parameters:
+ * fname - name of file to read.
+ * palette - array of rgb_t to store the read palette.
+ * palette_size - number of elements in 'palette' array
+ *
+ *-------------------------------------------------------------------------
+ */
#define STRING_JASC "JASC-PAL"
#define VERSION_JASC "0100"
#define STRING_CWPAL "CWPAL"
#define VERSION_CWPAL "100"
-static int read_palette(const char* fname,
- rgb_t *palette,
- size_t palette_size)
+static int
+read_palette(const char *fname, rgb_t *palette, size_t palette_size)
{
- FILE *file;
- char buffer[80];
- unsigned u;
- unsigned int red;
- unsigned int green;
- unsigned int blue;
- unsigned nentries;
- const char *data_file = H5_get_srcdir_filename(fname);
+ FILE * file;
+ char buffer[80];
+ unsigned u;
+ unsigned int red;
+ unsigned int green;
+ unsigned int blue;
+ unsigned nentries;
+ const char * data_file = H5_get_srcdir_filename(fname);
/* ensure the given palette is valid */
if (!palette)
return -1;
/* open the input file */
- if (!(file = HDfopen(data_file, "r")))
- {
- HDprintf( "Could not open file %s. Try set $srcdir \n", data_file );
+ if (!(file = HDfopen(data_file, "r"))) {
+ HDprintf("Could not open file %s. Try set $srcdir \n", data_file);
return -1;
}
/* read the file ident string */
- if (HDfgets(buffer, sizeof(buffer), file) == NULL)
- {
+ if (HDfgets(buffer, sizeof(buffer), file) == NULL) {
HDfclose(file);
return -1;
}
/* ensure it matches the palette file ident string */
- if ( HDstrncmp(buffer, STRING_JASC, sizeof(STRING_JASC) - 1) != 0 &&
- HDstrncmp(buffer, STRING_CWPAL, sizeof(STRING_CWPAL) - 1) != 0 )
- {
+ if (HDstrncmp(buffer, STRING_JASC, sizeof(STRING_JASC) - 1) != 0 &&
+ HDstrncmp(buffer, STRING_CWPAL, sizeof(STRING_CWPAL) - 1) != 0) {
HDfclose(file);
return -1;
}
/* read the version string */
- if (HDfgets(buffer, sizeof(buffer), file) == NULL)
- {
+ if (HDfgets(buffer, sizeof(buffer), file) == NULL) {
HDfclose(file);
return -1;
}
/* ensure it matches the palette file version string */
- if ( HDstrncmp(buffer, VERSION_JASC, sizeof(VERSION_JASC) - 1) != 0 &&
- HDstrncmp(buffer, VERSION_CWPAL, sizeof(VERSION_CWPAL) - 1) != 0 )
- {
+ if (HDstrncmp(buffer, VERSION_JASC, sizeof(VERSION_JASC) - 1) != 0 &&
+ HDstrncmp(buffer, VERSION_CWPAL, sizeof(VERSION_CWPAL) - 1) != 0) {
HDfclose(file);
return -1;
}
/* read the number of colors */
- if (HDfgets(buffer, sizeof(buffer), file) == NULL)
- {
+ if (HDfgets(buffer, sizeof(buffer), file) == NULL) {
HDfclose(file);
return -1;
}
-
/* extract the number of colors.
check for missing version or number of colors
in this case it reads the first entry
*/
- if ( HDstrlen( buffer ) > 4 )
- {
+ if (HDstrlen(buffer) > 4) {
HDfclose(file);
return -1;
}
- if (sscanf(buffer, "%u", &nentries) != 1)
- {
+ if (sscanf(buffer, "%u", &nentries) != 1) {
HDfclose(file);
return -1;
}
/* ensure there are a sensible number of colors in the palette */
- if ((nentries > 256) || (nentries > palette_size))
- {
+ if ((nentries > 256) || (nentries > palette_size)) {
HDfclose(file);
- return(-1);
+ return (-1);
}
/* read the palette entries */
- for (u = 0; u < nentries; u++)
- {
+ for (u = 0; u < nentries; u++) {
/* extract the red, green and blue color components. */
- if (fscanf(file, "%u %u %u", &red, &green, &blue) != 3)
- {
+ if (fscanf(file, "%u %u %u", &red, &green, &blue) != 3) {
HDfclose(file);
return -1;
}
@@ -998,4 +955,3 @@ static int read_palette(const char* fname,
return (int)nentries;
}
-
diff --git a/hl/test/test_ld.c b/hl/test/test_ld.c
index 7de409f..cc98fc9 100644
--- a/hl/test/test_ld.c
+++ b/hl/test/test_ld.c
@@ -1,15 +1,15 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5hltest.h"
#include "H5srcdir.h"
@@ -21,17 +21,17 @@
#define COPY_FILENAME "COPY_test_ld.h5"
/* Dataset names */
-#define DSET_ONE "DSET_ONE"
-#define DSET_ALLOC_LATE "DSET_ALLOC_LATE"
+#define DSET_ONE "DSET_ONE"
+#define DSET_ALLOC_LATE "DSET_ALLOC_LATE"
#define DSET_ALLOC_EARLY "DSET_ALLOC_EARLY"
-#define DSET_TWO "DSET_TWO"
-#define TWO_DIM_1 4
-#define TWO_DIM_2 10
-#define DSET_CMPD "DSET_CMPD"
-#define DSET_CMPD_ESC "DSET_CMPD_ESC"
-#define DSET_CMPD_TWO "DSET_CMPD_TWO"
-#define DSET_NULL "DSET_NULL"
-#define DSET_SCALAR "DSET_SCALAR"
+#define DSET_TWO "DSET_TWO"
+#define TWO_DIM_1 4
+#define TWO_DIM_2 10
+#define DSET_CMPD "DSET_CMPD"
+#define DSET_CMPD_ESC "DSET_CMPD_ESC"
+#define DSET_CMPD_TWO "DSET_CMPD_TWO"
+#define DSET_NULL "DSET_NULL"
+#define DSET_SCALAR "DSET_SCALAR"
/* Selected compound field members for testing */
#define VALID_FIELDS1 "field1,field2.a,field3,field4" /* TEMPORORAY */
@@ -52,7 +52,7 @@
* Test variations (retained original) for one-dimensional dataset:
* Varies from 10->13; 10->9, 10->10, 10->1, 10->11
*/
-#define ONE_NTESTS 5
+#define ONE_NTESTS 5
int one_tests[ONE_NTESTS] = {3, -1, 0, -9, 1};
/*
@@ -61,88 +61,92 @@ int one_tests[ONE_NTESTS] = {3, -1, 0, -9, 1};
* {4,10}->{3,12}; {4,10}->{3,9}; {4,10}->{3,10};
* {4,10}->{4,12}; {4,10}->{4,9}; {4,10}->{4,10}
*/
-#define TWO_NTESTS 9
-int two_tests[TWO_NTESTS][2] = { {2,2}, {2,-1}, {2,0},
- {-1,2}, {-1,-1}, {-1,0},
- {0,2}, {0,-1}, {0,0} };
-
+#define TWO_NTESTS 9
+int two_tests[TWO_NTESTS][2] = {{2, 2}, {2, -1}, {2, 0}, {-1, 2}, {-1, -1}, {-1, 0}, {0, 2}, {0, -1}, {0, 0}};
/* Verify that the two input values are the same */
-#define VERIFY_EQUAL(_x, _y) \
-{ \
- long __x = (long)_x, __y = (long)_y; \
- if(__x != __y) TEST_ERROR \
-}
+#define VERIFY_EQUAL(_x, _y) \
+ { \
+ long __x = (long)_x, __y = (long)_y; \
+ if (__x != __y) \
+ TEST_ERROR \
+ }
/* Temporary buffer for reading in the test file */
-#define TMP_BUF_SIZE 2048
-char g_tmp_buf[TMP_BUF_SIZE];
+#define TMP_BUF_SIZE 2048
+char g_tmp_buf[TMP_BUF_SIZE];
/* Macros for verifying compound fields */
/* Verify all fields */
-#define VERIFY_ELMTS_ALL(ent1, ent2) { \
- VERIFY_EQUAL(ent1.field1, ent2.field1); \
- VERIFY_EQUAL(ent1.field2.a, ent2.field2.a); \
- VERIFY_EQUAL(ent1.field2.b.a, ent2.field2.b.a); \
- VERIFY_EQUAL(ent1.field2.b.b, ent2.field2.b.b); \
- VERIFY_EQUAL(ent1.field2.b.c, ent2.field2.b.c); \
- VERIFY_EQUAL(ent1.field2.c, ent2.field2.c); \
- VERIFY_EQUAL(ent1.field3, ent2.field3); \
- VERIFY_EQUAL(ent1.field4.a, ent2.field4.a); \
-}
+#define VERIFY_ELMTS_ALL(ent1, ent2) \
+ { \
+ VERIFY_EQUAL(ent1.field1, ent2.field1); \
+ VERIFY_EQUAL(ent1.field2.a, ent2.field2.a); \
+ VERIFY_EQUAL(ent1.field2.b.a, ent2.field2.b.a); \
+ VERIFY_EQUAL(ent1.field2.b.b, ent2.field2.b.b); \
+ VERIFY_EQUAL(ent1.field2.b.c, ent2.field2.b.c); \
+ VERIFY_EQUAL(ent1.field2.c, ent2.field2.c); \
+ VERIFY_EQUAL(ent1.field3, ent2.field3); \
+ VERIFY_EQUAL(ent1.field4.a, ent2.field4.a); \
+ }
/* Verify fields selected in VALID_FIELDS1 */
-#define VERIFY_ELMTS_VALID1(ent1, ent2) { \
- VERIFY_EQUAL(ent1.field1, ent2.field1); \
- VERIFY_EQUAL(ent1.field2_a, ent2.field2.a); \
- VERIFY_EQUAL(ent1.field3, ent2.field3); \
- VERIFY_EQUAL(ent1.field4.a, ent2.field4.a); \
- VERIFY_EQUAL(ent1.field4.b, ent2.field4.b); \
-}
+#define VERIFY_ELMTS_VALID1(ent1, ent2) \
+ { \
+ VERIFY_EQUAL(ent1.field1, ent2.field1); \
+ VERIFY_EQUAL(ent1.field2_a, ent2.field2.a); \
+ VERIFY_EQUAL(ent1.field3, ent2.field3); \
+ VERIFY_EQUAL(ent1.field4.a, ent2.field4.a); \
+ VERIFY_EQUAL(ent1.field4.b, ent2.field4.b); \
+ }
/* Verify fields selected in VALID_FIELDS2 */
-#define VERIFY_ELMTS_VALID2(ent1, ent2) { \
- VERIFY_EQUAL(ent1.field2_b_a, ent2.field2.b.a); \
- VERIFY_EQUAL(ent1.field2_c, ent2.field2.c); \
- VERIFY_EQUAL(ent1.field4_b, ent2.field4.b); \
-}
+#define VERIFY_ELMTS_VALID2(ent1, ent2) \
+ { \
+ VERIFY_EQUAL(ent1.field2_b_a, ent2.field2.b.a); \
+ VERIFY_EQUAL(ent1.field2_c, ent2.field2.c); \
+ VERIFY_EQUAL(ent1.field4_b, ent2.field4.b); \
+ }
/* The types of 2-dimensional dataset: DSET_TWO or DSET_CMPD_TWO */
-#define TWO_NONE 0 /* DSET_TWO */
-#define TWO_CMPD_NULL 1 /* DSET_CMPD_TWO with NULL fields */
-#define TWO_CMPD_VALID1 2 /* DSET_CMPD_TWO with VALID_FIELDS1 or VALID_ESC_FIELDS1 */
-#define TWO_CMPD_VALID2 3 /* DSET_CMPD_TWO with VALID_FIELDS2 or VALID_ESC_FIELDS2 */
-
-#define VERIFY_ELMTS(type, k, ind, _ldbuf, _buf) { \
- if(type == TWO_NONE) { \
- int *iib = (int *)_ldbuf; \
- int *ib = (int *)_buf; \
- \
- VERIFY_EQUAL(iib[k], ib[ind + n]) \
- } else if(type == TWO_CMPD_NULL) { \
- set_t *ccb = (set_t *)_ldbuf; \
- set_t *cb = (set_t *)_buf; \
- \
- VERIFY_ELMTS_ALL(ccb[k], cb[ind + n]) \
- } else if(type == TWO_CMPD_VALID1) { \
- test_valid_fields1 *vb1 = (test_valid_fields1 *)_ldbuf; \
- set_t *cb = (set_t *)_buf; \
- \
- VERIFY_ELMTS_VALID1(vb1[k], cb[ind + n]) \
- } else if(type == TWO_CMPD_VALID2) { \
- test_valid_fields2 *vb2 = (test_valid_fields2 *)_ldbuf; \
- set_t *cb = (set_t *)_buf; \
- \
- VERIFY_ELMTS_VALID2(vb2[k], cb[ind + n]) \
- } \
-}
+#define TWO_NONE 0 /* DSET_TWO */
+#define TWO_CMPD_NULL 1 /* DSET_CMPD_TWO with NULL fields */
+#define TWO_CMPD_VALID1 2 /* DSET_CMPD_TWO with VALID_FIELDS1 or VALID_ESC_FIELDS1 */
+#define TWO_CMPD_VALID2 3 /* DSET_CMPD_TWO with VALID_FIELDS2 or VALID_ESC_FIELDS2 */
+
+#define VERIFY_ELMTS(type, k, ind, _ldbuf, _buf) \
+ { \
+ if (type == TWO_NONE) { \
+ int *iib = (int *)_ldbuf; \
+ int *ib = (int *)_buf; \
+ \
+ VERIFY_EQUAL(iib[k], ib[ind + n]) \
+ } \
+ else if (type == TWO_CMPD_NULL) { \
+ set_t *ccb = (set_t *)_ldbuf; \
+ set_t *cb = (set_t *)_buf; \
+ \
+ VERIFY_ELMTS_ALL(ccb[k], cb[ind + n]) \
+ } \
+ else if (type == TWO_CMPD_VALID1) { \
+ test_valid_fields1 *vb1 = (test_valid_fields1 *)_ldbuf; \
+ set_t * cb = (set_t *)_buf; \
+ \
+ VERIFY_ELMTS_VALID1(vb1[k], cb[ind + n]) \
+ } \
+ else if (type == TWO_CMPD_VALID2) { \
+ test_valid_fields2 *vb2 = (test_valid_fields2 *)_ldbuf; \
+ set_t * cb = (set_t *)_buf; \
+ \
+ VERIFY_ELMTS_VALID2(vb2[k], cb[ind + n]) \
+ } \
+ }
/* Tests for test_LD_elmts_pipe() */
-#define ONE_TESTS 3
-int onetests[ONE_TESTS] = {3, 9, 1};
-#define TWO_TESTS 5
-int twotests[TWO_TESTS][2] = { {2,2}, {2,-1}, {2,0}, {-1,2}, {0,2} };
-
+#define ONE_TESTS 3
+int onetests[ONE_TESTS] = {3, 9, 1};
+#define TWO_TESTS 5
+int twotests[TWO_TESTS][2] = {{2, 2}, {2, -1}, {2, 0}, {-1, 2}, {0, 2}};
static herr_t test_LD_dims_params(const char *file);
static herr_t test_LD_dims(const char *file);
@@ -153,7 +157,7 @@ static herr_t test_LD_elmts_invalid(const char *file);
static herr_t test_LD_elmts_one(const char *file, const char *dname, const char *fields);
static herr_t test_LD_elmts_two(const char *file, const char *dname, const char *fields);
-static herr_t verify_elmts_two(int type, hsize_t *ext_dims, hsize_t *prev_dims, void *_ldbuf, void *_buf);
+static herr_t verify_elmts_two(int type, hsize_t *ext_dims, hsize_t *prev_dims, void *_ldbuf, void *_buf);
/* data structures for compound data type */
typedef struct sub22_t {
@@ -163,9 +167,9 @@ typedef struct sub22_t {
} sub22_t;
typedef struct sub2_t {
- int a;
+ int a;
sub22_t b;
- int c;
+ int c;
} sub2_t;
typedef struct sub4_t {
@@ -174,7 +178,7 @@ typedef struct sub4_t {
} sub4_t;
typedef struct set_t {
- int field1;
+ int field1;
sub2_t field2;
double field3;
sub4_t field4;
@@ -190,8 +194,8 @@ typedef struct set_t {
/* VALID_FIELDS1 "field1,field2.a,field3,field4" */
/* VALID_ESC_FIELDS1 "field\\,1,field2\\..\\.a,field\\\\3,field4\\," */
typedef struct test_valid_fields1 {
- int field1;
- int field2_a;
+ int field1;
+ int field2_a;
double field3;
sub4_t field4;
} test_valid_fields1;
@@ -204,16 +208,14 @@ typedef struct test_valid_fields2 {
int field4_b;
} test_valid_fields2;
-
/* Temporary buffers for tests: test_LD_elmts_one() & test_LD_elmts_two() */
-#define TEST_BUF_SIZE 100
-int *iibuf; /* buffer for storing retrieved elements */
-int *ibuf; /* buffer for storing retrieved elements (integer) */
-set_t *cbuf; /* buffer for storing retrieved elemnets (compound) */
-set_t *ccbuf; /* buffer for storing retrieved elemnets (compound) */
-test_valid_fields1 *vbuf1; /* buffer for storing retrieved elements (FIELDS1) */
-test_valid_fields2 *vbuf2; /* buffer for storing retrieved elements (FIELDS2) */
-
+#define TEST_BUF_SIZE 100
+int * iibuf; /* buffer for storing retrieved elements */
+int * ibuf; /* buffer for storing retrieved elements (integer) */
+set_t * cbuf; /* buffer for storing retrieved elemnets (compound) */
+set_t * ccbuf; /* buffer for storing retrieved elemnets (compound) */
+test_valid_fields1 *vbuf1; /* buffer for storing retrieved elements (FIELDS1) */
+test_valid_fields2 *vbuf2; /* buffer for storing retrieved elements (FIELDS2) */
/*
*********************************************************************************
@@ -231,109 +233,108 @@ test_valid_fields2 *vbuf2; /* buffer for storing retrieved elements (FIELDS2)
static herr_t
test_LD_dims_params(const char *file)
{
- hid_t fid=-1; /* file identifier */
- hid_t did=-1; /* dataset identifier */
- hsize_t one_cur_dims[1]; /* current dimension sizes for 1-dimensonal dataset */
- hsize_t two_cur_dims[2]; /* current dimension sizes for 2-dimensional dataset */
- hid_t invalid_id = -1;
- herr_t ret; /* return value */
+ hid_t fid = -1; /* file identifier */
+ hid_t did = -1; /* dataset identifier */
+ hsize_t one_cur_dims[1]; /* current dimension sizes for 1-dimensonal dataset */
+ hsize_t two_cur_dims[2]; /* current dimension sizes for 2-dimensional dataset */
+ hid_t invalid_id = -1;
+ herr_t ret; /* return value */
const char *filename = H5_get_srcdir_filename(file);
HL_TESTING2("H5LDget_dset_dims");
/* Open the copied file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/*
* 1. Verify failure with negative dataset id
*/
- H5E_BEGIN_TRY {
- ret = H5LDget_dset_dims(invalid_id, one_cur_dims);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5LDget_dset_dims(invalid_id, one_cur_dims); }
+ H5E_END_TRY;
VERIFY_EQUAL(ret, FAIL)
/*
* 2. Verify failure for NULL cur_dims
*/
- if((did = H5Dopen2(fid, DSET_ALLOC_EARLY, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- ret = H5LDget_dset_dims(did, NULL);
- } H5E_END_TRY;
+ if ((did = H5Dopen2(fid, DSET_ALLOC_EARLY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ H5E_BEGIN_TRY { ret = H5LDget_dset_dims(did, NULL); }
+ H5E_END_TRY;
VERIFY_EQUAL(ret, FAIL)
- if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/*
* 3. Verify for nonNULL cur_dims
*/
- if((did = H5Dopen2(fid, DSET_ALLOC_LATE, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if(H5LDget_dset_dims(did, one_cur_dims) < 0)
- FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid, DSET_ALLOC_LATE, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5LDget_dset_dims(did, one_cur_dims) < 0)
+ FAIL_STACK_ERROR
VERIFY_EQUAL(one_cur_dims[0], 10)
- if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/*
* 4. Verify nonNULL cur_dims for a 2-dimensional dataset
*/
- if((did = H5Dopen2(fid, DSET_CMPD_TWO, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if(H5LDget_dset_dims(did, two_cur_dims) < 0)
- FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid, DSET_CMPD_TWO, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if (H5LDget_dset_dims(did, two_cur_dims) < 0)
+ FAIL_STACK_ERROR
VERIFY_EQUAL(two_cur_dims[0], TWO_DIM_1)
VERIFY_EQUAL(two_cur_dims[1], TWO_DIM_2)
- if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/*
* 5. Verify nonNULL cur_dims for dataset with H5S_NULL dataspace
*/
one_cur_dims[0] = 0;
- if((did = H5Dopen2(fid, DSET_NULL, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid, DSET_NULL, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
- if(H5LDget_dset_dims(did, one_cur_dims) < 0)
- FAIL_STACK_ERROR
+ if (H5LDget_dset_dims(did, one_cur_dims) < 0)
+ FAIL_STACK_ERROR
VERIFY_EQUAL(one_cur_dims[0], 0)
- if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/*
* 6. Verify nonNULL cur_dims for dataset with H5S_SCALAR dataspace
*/
one_cur_dims[0] = 0;
- if((did = H5Dopen2(fid, DSET_SCALAR, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid, DSET_SCALAR, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
- if(H5LDget_dset_dims(did, one_cur_dims) < 0)
- FAIL_STACK_ERROR
+ if (H5LDget_dset_dims(did, one_cur_dims) < 0)
+ FAIL_STACK_ERROR
VERIFY_EQUAL(one_cur_dims[0], 0)
- if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Dclose(did);
- H5Fclose(fid);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Dclose(did);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
- return(-1);
+ return (-1);
} /* test_LD_dims_params() */
-
/*
*********************************************************************************
*
@@ -374,93 +375,93 @@ error:
static herr_t
test_LD_dims(const char *file)
{
- hid_t fid=-1; /* file identifier */
- hid_t did=-1; /* dataset identifier */
- hsize_t one_prev_dims[1]; /* original dimension sizes for 1-dimensonal dataset */
- hsize_t one_cur_dims[1]; /* current dimension sizes for 1-dimensonal dataset */
- hsize_t one_ext_dims[1]; /* extended dimension sizes for 1-dimensonal dataset */
- hsize_t two_prev_dims[2]; /* original dimension sizes for 2-dimensional dataset */
- hsize_t two_cur_dims[2]; /* current dimension sizes for 2-dimensional dataset */
- hsize_t two_ext_dims[2]; /* extended dimension sizes for 2-dimensional dataset*/
- int i; /* local index variable */
+ hid_t fid = -1; /* file identifier */
+ hid_t did = -1; /* dataset identifier */
+ hsize_t one_prev_dims[1]; /* original dimension sizes for 1-dimensonal dataset */
+ hsize_t one_cur_dims[1]; /* current dimension sizes for 1-dimensonal dataset */
+ hsize_t one_ext_dims[1]; /* extended dimension sizes for 1-dimensonal dataset */
+ hsize_t two_prev_dims[2]; /* original dimension sizes for 2-dimensional dataset */
+ hsize_t two_cur_dims[2]; /* current dimension sizes for 2-dimensional dataset */
+ hsize_t two_ext_dims[2]; /* extended dimension sizes for 2-dimensional dataset*/
+ int i; /* local index variable */
HL_TESTING2("H5LDget_dset_dims with H5Dset_extent");
/* Make a copy of the test file */
- if(h5_make_local_copy(file, COPY_FILENAME) < 0)
+ if (h5_make_local_copy(file, COPY_FILENAME) < 0)
TEST_ERROR
/* Open the copied file */
- if((fid = H5Fopen(COPY_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fopen(COPY_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/*
* Testing with one-dimensional dataset: DSET_ONE
*/
- if((did = H5Dopen2(fid, DSET_ONE, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid, DSET_ONE, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Retrieve dimension sizes */
- if(H5LDget_dset_dims(did, one_prev_dims) < 0)
- FAIL_STACK_ERROR
+ if (H5LDget_dset_dims(did, one_prev_dims) < 0)
+ FAIL_STACK_ERROR
- for(i = 0; i < ONE_NTESTS; i++) {
+ for (i = 0; i < ONE_NTESTS; i++) {
- /* Set up the extended dimension sizes */
- one_ext_dims[0] = (hsize_t)((int)one_prev_dims[0] + one_tests[i]);
+ /* Set up the extended dimension sizes */
+ one_ext_dims[0] = (hsize_t)((int)one_prev_dims[0] + one_tests[i]);
- /* Change the dimension size */
- if(H5Dset_extent(did, one_ext_dims) < 0)
- FAIL_STACK_ERROR
+ /* Change the dimension size */
+ if (H5Dset_extent(did, one_ext_dims) < 0)
+ FAIL_STACK_ERROR
- /* Retrieve the dimension size */
- if(H5LDget_dset_dims(did, one_cur_dims) < 0)
- FAIL_STACK_ERROR
+ /* Retrieve the dimension size */
+ if (H5LDget_dset_dims(did, one_cur_dims) < 0)
+ FAIL_STACK_ERROR
- /* Verify that the retrieved dimension size is correct as expected */
- VERIFY_EQUAL(one_cur_dims[0], one_ext_dims[0])
+ /* Verify that the retrieved dimension size is correct as expected */
+ VERIFY_EQUAL(one_cur_dims[0], one_ext_dims[0])
}
/* Close the dataset */
- if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/*
* Testing with two-dimensional dataset: DSET_TWO
*/
- if((did = H5Dopen2(fid, DSET_TWO, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid, DSET_TWO, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Retrieve the dimension sizes */
- if(H5LDget_dset_dims(did, two_prev_dims) < 0)
- FAIL_STACK_ERROR
+ if (H5LDget_dset_dims(did, two_prev_dims) < 0)
+ FAIL_STACK_ERROR
- for(i = 0; i < TWO_NTESTS; i++) {
+ for (i = 0; i < TWO_NTESTS; i++) {
- /* Set up the extended dimension sizes */
- two_ext_dims[0] = (hsize_t)((int)two_prev_dims[0] + two_tests[i][0]);
- two_ext_dims[1] = (hsize_t) ((int)two_prev_dims[1] + two_tests[i][1]);
+ /* Set up the extended dimension sizes */
+ two_ext_dims[0] = (hsize_t)((int)two_prev_dims[0] + two_tests[i][0]);
+ two_ext_dims[1] = (hsize_t)((int)two_prev_dims[1] + two_tests[i][1]);
- /* Change the dimension sizes */
- if(H5Dset_extent(did, two_ext_dims) < 0)
- FAIL_STACK_ERROR
+ /* Change the dimension sizes */
+ if (H5Dset_extent(did, two_ext_dims) < 0)
+ FAIL_STACK_ERROR
- /* Retrieve the dimension sizes */
- if(H5LDget_dset_dims(did, two_cur_dims) < 0)
- FAIL_STACK_ERROR
+ /* Retrieve the dimension sizes */
+ if (H5LDget_dset_dims(did, two_cur_dims) < 0)
+ FAIL_STACK_ERROR
- /* Verify that the retrieved dimension sizes are correct as expected */
- VERIFY_EQUAL(two_cur_dims[0], two_ext_dims[0])
- VERIFY_EQUAL(two_cur_dims[1], two_ext_dims[1])
+ /* Verify that the retrieved dimension sizes are correct as expected */
+ VERIFY_EQUAL(two_cur_dims[0], two_ext_dims[0])
+ VERIFY_EQUAL(two_cur_dims[1], two_ext_dims[1])
} /* end TWO_NTESTS */
/* Close the dataset */
- if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Remove the copied file */
HDremove(COPY_FILENAME);
@@ -469,15 +470,16 @@ test_LD_dims(const char *file)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Dclose(did);
- H5Fclose(fid);
- } H5E_END_TRY;
- return(-1);
+ H5E_BEGIN_TRY
+ {
+ H5Dclose(did);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
+ return (-1);
} /* test_LD_dims() */
-
/*
**********************************************************************************
*
@@ -509,33 +511,32 @@ error:
static int
test_LD_size(const char *file)
{
- hid_t fid=-1; /* file identifier */
- hid_t did=-1; /* dataset identifier */
- hid_t dtid=-1; /* dataset's datatype identifier */
- hid_t invalid_id=-1;
- hid_t memb0_tid=-1; /* type identifier for a member in the compound type */
- hid_t memb1_tid=-1; /* type identifier for a member in the compound type */
- hid_t memb2_tid=-1; /* type identifier for a member in the compound type */
- hid_t memb3_tid=-1; /* type identifier for a member in the compound type */
- hid_t memb_tid=-1; /* type identifier for a member in the compound type */
- hid_t memb_tid2=-1; /* type identifier for a member in the compound type */
- size_t dsize; /* size of the dataset's datatype */
- size_t ck_dsize; /* size of the dataset's datatype to be checked against */
+ hid_t fid = -1; /* file identifier */
+ hid_t did = -1; /* dataset identifier */
+ hid_t dtid = -1; /* dataset's datatype identifier */
+ hid_t invalid_id = -1;
+ hid_t memb0_tid = -1; /* type identifier for a member in the compound type */
+ hid_t memb1_tid = -1; /* type identifier for a member in the compound type */
+ hid_t memb2_tid = -1; /* type identifier for a member in the compound type */
+ hid_t memb3_tid = -1; /* type identifier for a member in the compound type */
+ hid_t memb_tid = -1; /* type identifier for a member in the compound type */
+ hid_t memb_tid2 = -1; /* type identifier for a member in the compound type */
+ size_t dsize; /* size of the dataset's datatype */
+ size_t ck_dsize; /* size of the dataset's datatype to be checked against */
const char *filename = H5_get_srcdir_filename(file);
HL_TESTING2("H5LDget_dset_type_size");
/* Open the file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/*
* Verify failure with an invalid dataset id
*/
- H5E_BEGIN_TRY {
- dsize = H5LDget_dset_type_size(invalid_id, NULL);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { dsize = H5LDget_dset_type_size(invalid_id, NULL); }
+ H5E_END_TRY;
VERIFY_EQUAL(dsize, 0)
/*
@@ -544,91 +545,91 @@ test_LD_size(const char *file)
*/
/* Open dataset DSET_CMPD */
- if((did = H5Dopen2(fid, DSET_CMPD, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid, DSET_CMPD, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Return size of the whole element */
- if((dsize = H5LDget_dset_type_size(did, NULL)) == 0)
- FAIL_STACK_ERROR
+ if ((dsize = H5LDget_dset_type_size(did, NULL)) == 0)
+ FAIL_STACK_ERROR
/* Get the dataset's datatype and then its datatype size */
- if((dtid = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0)
+ if ((dtid = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((ck_dsize = H5Tget_size(dtid)) == 0)
- FAIL_STACK_ERROR
+ if ((ck_dsize = H5Tget_size(dtid)) == 0)
+ FAIL_STACK_ERROR
/* Verify case #1 */
VERIFY_EQUAL(dsize, ck_dsize)
/* Get datatype id for each member */
- if((memb0_tid = H5Tget_member_type(dtid, 0)) < 0) /* "field1" */
- FAIL_STACK_ERROR
- if((memb1_tid = H5Tget_member_type(dtid, 1)) < 0) /* "field2" */
- FAIL_STACK_ERROR
- if((memb2_tid = H5Tget_member_type(dtid, 2)) < 0) /* "field3" */
- FAIL_STACK_ERROR
- if((memb3_tid = H5Tget_member_type(dtid, 3)) < 0) /* "field4" */
- FAIL_STACK_ERROR
+ if ((memb0_tid = H5Tget_member_type(dtid, 0)) < 0) /* "field1" */
+ FAIL_STACK_ERROR
+ if ((memb1_tid = H5Tget_member_type(dtid, 1)) < 0) /* "field2" */
+ FAIL_STACK_ERROR
+ if ((memb2_tid = H5Tget_member_type(dtid, 2)) < 0) /* "field3" */
+ FAIL_STACK_ERROR
+ if ((memb3_tid = H5Tget_member_type(dtid, 3)) < 0) /* "field4" */
+ FAIL_STACK_ERROR
/* Obtain size for VALID_FIELDS1: "field1,field2.a,field3,field4" */
- if((dsize = H5LDget_dset_type_size(did, VALID_FIELDS1)) == 0)
- FAIL_STACK_ERROR
+ if ((dsize = H5LDget_dset_type_size(did, VALID_FIELDS1)) == 0)
+ FAIL_STACK_ERROR
/* Get the datatype size for "field1" */
- if((ck_dsize = H5Tget_size(memb0_tid)) == 0)
- FAIL_STACK_ERROR
+ if ((ck_dsize = H5Tget_size(memb0_tid)) == 0)
+ FAIL_STACK_ERROR
/* Add the datatype size for "field2.a" */
- if((memb_tid = H5Tget_member_type(memb1_tid, 0)) < 0)
- FAIL_STACK_ERROR
- if((ck_dsize += H5Tget_size(memb_tid)) == 0)
- FAIL_STACK_ERROR
- if(H5Tclose(memb_tid) < 0)
- FAIL_STACK_ERROR
+ if ((memb_tid = H5Tget_member_type(memb1_tid, 0)) < 0)
+ FAIL_STACK_ERROR
+ if ((ck_dsize += H5Tget_size(memb_tid)) == 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb_tid) < 0)
+ FAIL_STACK_ERROR
/* Add the datatype size for "field3" */
- if((ck_dsize += H5Tget_size(memb2_tid)) == 0)
- FAIL_STACK_ERROR
+ if ((ck_dsize += H5Tget_size(memb2_tid)) == 0)
+ FAIL_STACK_ERROR
/* Add the datatype size for "field4" */
- if((ck_dsize += H5Tget_size(memb3_tid)) == 0)
- FAIL_STACK_ERROR
+ if ((ck_dsize += H5Tget_size(memb3_tid)) == 0)
+ FAIL_STACK_ERROR
/* Verify case #2 */
VERIFY_EQUAL(dsize, ck_dsize)
/* Obtain datatype size for VALID_FIELDS2: "field2.b.a,field2.c,field4.b" */
- if((dsize = H5LDget_dset_type_size(did, VALID_FIELDS2)) == 0)
- FAIL_STACK_ERROR
+ if ((dsize = H5LDget_dset_type_size(did, VALID_FIELDS2)) == 0)
+ FAIL_STACK_ERROR
/* Get the datatype size for "field2.b.a" */
- if((memb_tid = H5Tget_member_type(memb1_tid, 1)) < 0)
- FAIL_STACK_ERROR
- if((memb_tid2 = H5Tget_member_type(memb_tid, 0)) < 0)
- FAIL_STACK_ERROR
- if((ck_dsize = H5Tget_size(memb_tid2)) == 0)
- FAIL_STACK_ERROR
- if(H5Tclose(memb_tid) < 0)
- FAIL_STACK_ERROR
- if(H5Tclose(memb_tid2) < 0)
- FAIL_STACK_ERROR
+ if ((memb_tid = H5Tget_member_type(memb1_tid, 1)) < 0)
+ FAIL_STACK_ERROR
+ if ((memb_tid2 = H5Tget_member_type(memb_tid, 0)) < 0)
+ FAIL_STACK_ERROR
+ if ((ck_dsize = H5Tget_size(memb_tid2)) == 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb_tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb_tid2) < 0)
+ FAIL_STACK_ERROR
/* Add the datatype size for "field2.c" */
- if((memb_tid = H5Tget_member_type(memb1_tid, 2)) < 0)
- FAIL_STACK_ERROR
- if((ck_dsize += H5Tget_size(memb_tid)) == 0)
- FAIL_STACK_ERROR
- if(H5Tclose(memb_tid) < 0)
- FAIL_STACK_ERROR
+ if ((memb_tid = H5Tget_member_type(memb1_tid, 2)) < 0)
+ FAIL_STACK_ERROR
+ if ((ck_dsize += H5Tget_size(memb_tid)) == 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb_tid) < 0)
+ FAIL_STACK_ERROR
/* Add the datatype size for "field4.b" */
- if((memb_tid = H5Tget_member_type(memb3_tid, 1)) < 0)
- FAIL_STACK_ERROR
- if((ck_dsize += H5Tget_size(memb_tid)) == 0)
- FAIL_STACK_ERROR
- if(H5Tclose(memb_tid) < 0)
- FAIL_STACK_ERROR
+ if ((memb_tid = H5Tget_member_type(memb3_tid, 1)) < 0)
+ FAIL_STACK_ERROR
+ if ((ck_dsize += H5Tget_size(memb_tid)) == 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb_tid) < 0)
+ FAIL_STACK_ERROR
/* Verify case #3 */
VERIFY_EQUAL(dsize, ck_dsize)
@@ -652,18 +653,18 @@ test_LD_size(const char *file)
VERIFY_EQUAL(dsize, 0)
/* Closing */
- if(H5Tclose(memb0_tid) < 0)
- FAIL_STACK_ERROR
- if(H5Tclose(memb1_tid) < 0)
- FAIL_STACK_ERROR
- if(H5Tclose(memb2_tid) < 0)
- FAIL_STACK_ERROR
- if(H5Tclose(memb3_tid) < 0)
- FAIL_STACK_ERROR
- if(H5Tclose(dtid) < 0)
- FAIL_STACK_ERROR
- if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ if (H5Tclose(memb0_tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb1_tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb2_tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb3_tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(dtid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/*
* Testing one-dimensional dataset with compound datatype and
@@ -672,91 +673,91 @@ test_LD_size(const char *file)
*/
/* Open dataset DSET_CMPD_ESC */
- if((did = H5Dopen2(fid, DSET_CMPD_ESC, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid, DSET_CMPD_ESC, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Return size of the whole element */
- if((dsize = H5LDget_dset_type_size(did, NULL)) == 0)
- FAIL_STACK_ERROR
+ if ((dsize = H5LDget_dset_type_size(did, NULL)) == 0)
+ FAIL_STACK_ERROR
/* Get the dataset's datatype and then its datatype size */
- if((dtid = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0)
+ if ((dtid = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if ((ck_dsize = H5Tget_size(dtid)) == 0)
FAIL_STACK_ERROR
- if((ck_dsize = H5Tget_size(dtid)) == 0)
- FAIL_STACK_ERROR
/* Verify case #1 */
VERIFY_EQUAL(dsize, ck_dsize)
/* Get datatype id for each member */
- if((memb0_tid = H5Tget_member_type(dtid, 0)) < 0) /* "field,1" */
- FAIL_STACK_ERROR
- if((memb1_tid = H5Tget_member_type(dtid, 1)) < 0) /* "field2." */
- FAIL_STACK_ERROR
- if((memb2_tid = H5Tget_member_type(dtid, 2)) < 0) /* "field\3" */
- FAIL_STACK_ERROR
- if((memb3_tid = H5Tget_member_type(dtid, 3)) < 0) /* "field4," */
- FAIL_STACK_ERROR
+ if ((memb0_tid = H5Tget_member_type(dtid, 0)) < 0) /* "field,1" */
+ FAIL_STACK_ERROR
+ if ((memb1_tid = H5Tget_member_type(dtid, 1)) < 0) /* "field2." */
+ FAIL_STACK_ERROR
+ if ((memb2_tid = H5Tget_member_type(dtid, 2)) < 0) /* "field\3" */
+ FAIL_STACK_ERROR
+ if ((memb3_tid = H5Tget_member_type(dtid, 3)) < 0) /* "field4," */
+ FAIL_STACK_ERROR
/* Obtain size for VALID_ESC_FIELDS1: "field\\,1,field2\\..\\.a,field\\\\3,field4\\," */
- if((dsize = H5LDget_dset_type_size(did, VALID_ESC_FIELDS1)) == 0)
- FAIL_STACK_ERROR
+ if ((dsize = H5LDget_dset_type_size(did, VALID_ESC_FIELDS1)) == 0)
+ FAIL_STACK_ERROR
/* Get the datatype size for "field\\,1" */
- if((ck_dsize = H5Tget_size(memb0_tid)) == 0)
- FAIL_STACK_ERROR
+ if ((ck_dsize = H5Tget_size(memb0_tid)) == 0)
+ FAIL_STACK_ERROR
/* Add the datatype size for "field2\\..\\.a" */
- if((memb_tid = H5Tget_member_type(memb1_tid, 0)) < 0)
- FAIL_STACK_ERROR
- if((ck_dsize += H5Tget_size(memb_tid)) == 0)
- FAIL_STACK_ERROR
- if(H5Tclose(memb_tid) < 0)
- FAIL_STACK_ERROR
+ if ((memb_tid = H5Tget_member_type(memb1_tid, 0)) < 0)
+ FAIL_STACK_ERROR
+ if ((ck_dsize += H5Tget_size(memb_tid)) == 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb_tid) < 0)
+ FAIL_STACK_ERROR
/* Add the datatype size for "field\\\\3" */
- if((ck_dsize += H5Tget_size(memb2_tid)) == 0)
- FAIL_STACK_ERROR
+ if ((ck_dsize += H5Tget_size(memb2_tid)) == 0)
+ FAIL_STACK_ERROR
/* Add the datatype size for "field4\\," */
- if((ck_dsize += H5Tget_size(memb3_tid)) == 0)
- FAIL_STACK_ERROR
+ if ((ck_dsize += H5Tget_size(memb3_tid)) == 0)
+ FAIL_STACK_ERROR
/* Verify case #2 */
VERIFY_EQUAL(dsize, ck_dsize)
/* Obtain datatype size for VALID_ESC_FIELDS2:
"field2\\..\\,b.a,field2\\..\\\\c,field4\\,.b\\," */
- if((dsize = H5LDget_dset_type_size(did, VALID_ESC_FIELDS2)) == 0)
- FAIL_STACK_ERROR
+ if ((dsize = H5LDget_dset_type_size(did, VALID_ESC_FIELDS2)) == 0)
+ FAIL_STACK_ERROR
/* Get the datatype size for "field2\..,b.a" */
- if((memb_tid = H5Tget_member_type(memb1_tid, 1)) < 0)
- FAIL_STACK_ERROR
- if((memb_tid2 = H5Tget_member_type(memb_tid, 0)) < 0)
- FAIL_STACK_ERROR
- if((ck_dsize = H5Tget_size(memb_tid2)) == 0)
- FAIL_STACK_ERROR
- if(H5Tclose(memb_tid) < 0)
- FAIL_STACK_ERROR
- if(H5Tclose(memb_tid2) < 0)
- FAIL_STACK_ERROR
+ if ((memb_tid = H5Tget_member_type(memb1_tid, 1)) < 0)
+ FAIL_STACK_ERROR
+ if ((memb_tid2 = H5Tget_member_type(memb_tid, 0)) < 0)
+ FAIL_STACK_ERROR
+ if ((ck_dsize = H5Tget_size(memb_tid2)) == 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb_tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb_tid2) < 0)
+ FAIL_STACK_ERROR
/* Add the datatype size for "field2\..\\c" */
- if((memb_tid = H5Tget_member_type(memb1_tid, 2)) < 0)
- FAIL_STACK_ERROR
- if((ck_dsize += H5Tget_size(memb_tid)) == 0)
- FAIL_STACK_ERROR
- if(H5Tclose(memb_tid) < 0)
- FAIL_STACK_ERROR
+ if ((memb_tid = H5Tget_member_type(memb1_tid, 2)) < 0)
+ FAIL_STACK_ERROR
+ if ((ck_dsize += H5Tget_size(memb_tid)) == 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb_tid) < 0)
+ FAIL_STACK_ERROR
/* Add the datatype size for "field4\,.b\," */
- if((memb_tid = H5Tget_member_type(memb3_tid, 1)) < 0)
- FAIL_STACK_ERROR
- if((ck_dsize += H5Tget_size(memb_tid)) == 0)
- FAIL_STACK_ERROR
- if(H5Tclose(memb_tid) < 0)
- FAIL_STACK_ERROR
+ if ((memb_tid = H5Tget_member_type(memb3_tid, 1)) < 0)
+ FAIL_STACK_ERROR
+ if ((ck_dsize += H5Tget_size(memb_tid)) == 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb_tid) < 0)
+ FAIL_STACK_ERROR
/* Verify case #3 */
VERIFY_EQUAL(dsize, ck_dsize)
@@ -780,42 +781,43 @@ test_LD_size(const char *file)
VERIFY_EQUAL(dsize, 0)
/* Closing */
- if(H5Tclose(memb0_tid) < 0)
- FAIL_STACK_ERROR
- if(H5Tclose(memb1_tid) < 0)
- FAIL_STACK_ERROR
- if(H5Tclose(memb2_tid) < 0)
- FAIL_STACK_ERROR
- if(H5Tclose(memb3_tid) < 0)
- FAIL_STACK_ERROR
- if(H5Tclose(dtid) < 0)
- FAIL_STACK_ERROR
- if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
-
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ if (H5Tclose(memb0_tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb1_tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb2_tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(memb3_tid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(dtid) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Tclose(memb0_tid);
- H5Tclose(memb1_tid);
- H5Tclose(memb2_tid);
- H5Tclose(memb3_tid);
- H5Tclose(memb_tid);
- H5Tclose(memb_tid2);
- H5Tclose(dtid);
- H5Dclose(did);
- H5Fclose(fid);
- } H5E_END_TRY;
- return(-1);
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(memb0_tid);
+ H5Tclose(memb1_tid);
+ H5Tclose(memb2_tid);
+ H5Tclose(memb3_tid);
+ H5Tclose(memb_tid);
+ H5Tclose(memb_tid2);
+ H5Tclose(dtid);
+ H5Dclose(did);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
+ return (-1);
} /* test_LD_size() */
-
/*
**************************************************************************************
* Testing for the High Level public routine: H5LDget_dset_elmts()
@@ -839,32 +841,32 @@ error:
static int
test_LD_elmts_invalid(const char *file)
{
- hid_t fid=-1; /* file identifier */
- hid_t did=-1; /* dataset identifier */
- hid_t sid=-1; /* dataspace identifier */
- hid_t invalid_id=-1;
- int ret; /* return value */
- hsize_t cur_dims[2]; /* current dimension sizes of the dataset */
- hsize_t prev_dims[2]; /* previous dimension sizes of the dataset */
- char tbuf[2]; /* temporary buffer for testing */
- int ndims; /* # of dimension sizes */
- int i; /* local index variable */
+ hid_t fid = -1; /* file identifier */
+ hid_t did = -1; /* dataset identifier */
+ hid_t sid = -1; /* dataspace identifier */
+ hid_t invalid_id = -1;
+ int ret; /* return value */
+ hsize_t cur_dims[2]; /* current dimension sizes of the dataset */
+ hsize_t prev_dims[2]; /* previous dimension sizes of the dataset */
+ char tbuf[2]; /* temporary buffer for testing */
+ int ndims; /* # of dimension sizes */
+ int i; /* local index variable */
const char *filename = H5_get_srcdir_filename(file);
HL_TESTING2("H5LDget_dset_elmts on invalid conditions");
/* Open the copied file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/*
* Testing two-dimensional dataset: DSET_TWO
*/
/* Open dataset: DSET_TWO */
- if((did = H5Dopen2(fid, DSET_TWO, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid, DSET_TWO, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Verify failure from case #1: cur_dims and prev_dims are NULL */
ret = H5LDget_dset_elmts(did, NULL, NULL, NULL, NULL);
@@ -878,16 +880,16 @@ test_LD_elmts_invalid(const char *file)
ret = H5LDget_dset_elmts(did, NULL, prev_dims, NULL, NULL);
VERIFY_EQUAL(ret, FAIL)
- if((sid = H5Dget_space(did)) < 0)
- FAIL_STACK_ERROR
+ if ((sid = H5Dget_space(did)) < 0)
+ FAIL_STACK_ERROR
/* Get the # of dimensions and current dimension sizes */
- if((ndims = H5Sget_simple_extent_dims(sid, cur_dims, NULL)) < 0)
- FAIL_STACK_ERROR
+ if ((ndims = H5Sget_simple_extent_dims(sid, cur_dims, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Set up valid cur_dims and prev_dims */
- for(i = 0; i < ndims; i++)
- prev_dims[i] = cur_dims[i] - 1;
+ for (i = 0; i < ndims; i++)
+ prev_dims[i] = cur_dims[i] - 1;
/* Verify failure from case #4: FIELDS is nonNULL but the dataset is not compound datatype */
ret = H5LDget_dset_elmts(did, prev_dims, cur_dims, "field1", tbuf);
@@ -900,12 +902,12 @@ test_LD_elmts_invalid(const char *file)
/* Verify failure from case #6: cur_dims is not > than prev_dims */
cur_dims[0] = prev_dims[0] - 1;
cur_dims[1] = prev_dims[1] - 1;
- ret = H5LDget_dset_elmts(did, prev_dims, cur_dims, NULL, tbuf);
+ ret = H5LDget_dset_elmts(did, prev_dims, cur_dims, NULL, tbuf);
VERIFY_EQUAL(ret, FAIL)
/* Close DSET_TWO */
- if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/*
* Testing one-dimensional dataset with compound datatype:
@@ -913,18 +915,17 @@ test_LD_elmts_invalid(const char *file)
*/
/* Verify failure from case #1: an invalid dataset id */
- H5E_BEGIN_TRY {
- ret = H5LDget_dset_elmts(invalid_id, prev_dims, cur_dims, NULL, tbuf);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5LDget_dset_elmts(invalid_id, prev_dims, cur_dims, NULL, tbuf); }
+ H5E_END_TRY;
VERIFY_EQUAL(ret, FAIL)
/* Open dataset: DSET_CMPD */
- if((did = H5Dopen2(fid, DSET_CMPD, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid, DSET_CMPD, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Retrieve the current dimension sizes */
- if(H5LDget_dset_dims(did, cur_dims) < 0)
- FAIL_STACK_ERROR
+ if (H5LDget_dset_dims(did, cur_dims) < 0)
+ FAIL_STACK_ERROR
/* Set up valid cur_dims, prev_dims */
prev_dims[0] = cur_dims[0] - 1;
@@ -934,27 +935,28 @@ test_LD_elmts_invalid(const char *file)
VERIFY_EQUAL(ret, FAIL)
/* Close DSET_CMPD */
- if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- H5Sclose(sid);
- H5Dclose(did);
- H5Fclose(fid);
- } H5E_END_TRY;
- return(-1);
+ H5E_BEGIN_TRY
+ {
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
+ return (-1);
} /* test_LD_elmts_invalid() */
-
/*
**************************************************************************************
* Testing for the High Level public routine: H5LDget_dset_elmts()
@@ -977,122 +979,122 @@ error:
static herr_t
test_LD_elmts_one(const char *file, const char *dname, const char *fields)
{
- hid_t fid=-1; /* file identifier */
- hid_t did=-1; /* dataset identifier */
- hid_t dtype=-1; /* dataset's data type */
- hsize_t ext_dims[1]; /* extended dimension sizes of the dataset */
- hsize_t prev_dims[1]; /* previous dimension sizes of the dataset */
- int i, j; /* local index variable */
- int ret = 0; /* return value */
+ hid_t fid = -1; /* file identifier */
+ hid_t did = -1; /* dataset identifier */
+ hid_t dtype = -1; /* dataset's data type */
+ hsize_t ext_dims[1]; /* extended dimension sizes of the dataset */
+ hsize_t prev_dims[1]; /* previous dimension sizes of the dataset */
+ int i, j; /* local index variable */
+ int ret = 0; /* return value */
HL_TESTING2("H5LDget_dset_elmts: one-dimensional dataset");
/* Copy the test file */
- if(h5_make_local_copy(file, COPY_FILENAME) < 0)
+ if (h5_make_local_copy(file, COPY_FILENAME) < 0)
TEST_ERROR
- for(i = 0; i < TEST_BUF_SIZE; i++) {
- cbuf[i].field1 = i;
- cbuf[i].field2.a = i;
- cbuf[i].field2.b.a = i;
- cbuf[i].field2.b.b = i;
- cbuf[i].field2.b.c = i;
- cbuf[i].field2.c = i;
- cbuf[i].field3 = (double)i;
- cbuf[i].field4.a = i;
- cbuf[i].field4.b = i;
- ibuf[i] = i;
+ for (i = 0; i < TEST_BUF_SIZE; i++) {
+ cbuf[i].field1 = i;
+ cbuf[i].field2.a = i;
+ cbuf[i].field2.b.a = i;
+ cbuf[i].field2.b.b = i;
+ cbuf[i].field2.b.c = i;
+ cbuf[i].field2.c = i;
+ cbuf[i].field3 = (double)i;
+ cbuf[i].field4.a = i;
+ cbuf[i].field4.b = i;
+ ibuf[i] = i;
} /* end for */
/* Open the copied file */
- if((fid = H5Fopen(COPY_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fopen(COPY_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Open the dataset */
- if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get the dataset's data type */
- if((dtype = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((dtype = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get current dimension sizes before extending the dataset's dimension sizes */
- if(H5LDget_dset_dims(did, prev_dims) < 0)
- FAIL_STACK_ERROR
-
- /* Loop through different variations of extending the dataset */
- for(i = 0; i < ONE_NTESTS; i++) {
- HDmemset(vbuf1, 0, TEST_BUF_SIZE * sizeof(test_valid_fields1));
- HDmemset(vbuf2, 0, TEST_BUF_SIZE * sizeof(test_valid_fields2));
- HDmemset(ccbuf, 0, TEST_BUF_SIZE * sizeof(set_t));
- HDmemset(iibuf, 0, TEST_BUF_SIZE * sizeof(int));
-
- ext_dims[0] = (hsize_t)((int)prev_dims[0] + one_tests[i]);
-
- /* Change the dimension sizes of the dataset */
- if(H5Dset_extent(did, ext_dims) < 0)
+ if (H5LDget_dset_dims(did, prev_dims) < 0)
FAIL_STACK_ERROR
- /* Initialize data */
- if(!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) {
- if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, cbuf) < 0)
- FAIL_STACK_ERROR
- } /* end if */
- else if(!HDstrcmp(dname, DSET_ONE)) {
- if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf) < 0)
- FAIL_STACK_ERROR
- } /* end if */
+ /* Loop through different variations of extending the dataset */
+ for (i = 0; i < ONE_NTESTS; i++) {
+ HDmemset(vbuf1, 0, TEST_BUF_SIZE * sizeof(test_valid_fields1));
+ HDmemset(vbuf2, 0, TEST_BUF_SIZE * sizeof(test_valid_fields2));
+ HDmemset(ccbuf, 0, TEST_BUF_SIZE * sizeof(set_t));
+ HDmemset(iibuf, 0, TEST_BUF_SIZE * sizeof(int));
+
+ ext_dims[0] = (hsize_t)((int)prev_dims[0] + one_tests[i]);
+
+ /* Change the dimension sizes of the dataset */
+ if (H5Dset_extent(did, ext_dims) < 0)
+ FAIL_STACK_ERROR
+
+ /* Initialize data */
+ if (!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) {
+ if (H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, cbuf) < 0)
+ FAIL_STACK_ERROR
+ } /* end if */
+ else if (!HDstrcmp(dname, DSET_ONE)) {
+ if (H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf) < 0)
+ FAIL_STACK_ERROR
+ } /* end if */
- /* There are changes in dimension sizes */
- if(one_tests[i] > 0) {
- if(!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) {
- if(fields) {
- if(!HDstrcmp(fields, VALID_FIELDS1) || !HDstrcmp(fields, VALID_ESC_FIELDS1)) {
+ /* There are changes in dimension sizes */
+ if (one_tests[i] > 0) {
+ if (!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) {
+ if (fields) {
+ if (!HDstrcmp(fields, VALID_FIELDS1) || !HDstrcmp(fields, VALID_ESC_FIELDS1)) {
/* Retrieve the elmemts in BUF */
- if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, vbuf1) < 0)
+ if (H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, vbuf1) < 0)
TEST_ERROR
- for(j = 0; j < one_tests[i]; j++)
+ for (j = 0; j < one_tests[i]; j++)
VERIFY_ELMTS_VALID1(vbuf1[j], cbuf[prev_dims[0] + (hsize_t)j])
} /* end if */
- else if(!HDstrcmp(fields, VALID_FIELDS2) || !HDstrcmp(fields, VALID_ESC_FIELDS2)) {
+ else if (!HDstrcmp(fields, VALID_FIELDS2) || !HDstrcmp(fields, VALID_ESC_FIELDS2)) {
/* Retrieve the elmemts in BUF */
- if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, vbuf2) < 0)
+ if (H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, vbuf2) < 0)
TEST_ERROR
- for(j = 0; j < one_tests[i]; j++)
+ for (j = 0; j < one_tests[i]; j++)
VERIFY_ELMTS_VALID2(vbuf2[j], cbuf[prev_dims[0] + (hsize_t)j])
} /* end else-if */
else
- TEST_ERROR
- } /* end if */
+ TEST_ERROR
+ } /* end if */
else {
- /* Retrieve the elmemts in BUF */
- if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, ccbuf) < 0)
- TEST_ERROR
- for(j = 0; j < one_tests[i]; j++)
- VERIFY_ELMTS_ALL(ccbuf[j], cbuf[prev_dims[0] + (hsize_t)j])
- } /* end else-if */
- } /* end if */
+ /* Retrieve the elmemts in BUF */
+ if (H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, ccbuf) < 0)
+ TEST_ERROR
+ for (j = 0; j < one_tests[i]; j++)
+ VERIFY_ELMTS_ALL(ccbuf[j], cbuf[prev_dims[0] + (hsize_t)j])
+ } /* end else-if */
+ } /* end if */
else {
- /* Retrieve the elmemts in BUF */
- if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf) < 0)
- TEST_ERROR
- for(j = 0; j < one_tests[i]; j++)
- VERIFY_EQUAL(iibuf[j], ibuf[prev_dims[0] + (hsize_t)j])
- } /* end else */
- } /* end if */
+ /* Retrieve the elmemts in BUF */
+ if (H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf) < 0)
+ TEST_ERROR
+ for (j = 0; j < one_tests[i]; j++)
+ VERIFY_EQUAL(iibuf[j], ibuf[prev_dims[0] + (hsize_t)j])
+ } /* end else */
+ } /* end if */
else {
/* Verify failure when changes between prev_dims and ext_dims are same/decrease */
ret = H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf);
VERIFY_EQUAL(ret, FAIL)
} /* end else */
- } /* end for */
+ } /* end for */
/* Closing */
- if(H5Tclose(dtype) < 0)
+ if (H5Tclose(dtype) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Remove the copied file */
@@ -1102,15 +1104,16 @@ test_LD_elmts_one(const char *file, const char *dname, const char *fields)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Tclose(dtype);
- H5Dclose(did);
- H5Fclose(fid);
- } H5E_END_TRY;
- return(-1);
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(dtype);
+ H5Dclose(did);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
+ return (-1);
} /* test_LD_elmts_one() */
-
/*
**************************************************************************************
*
@@ -1132,36 +1135,35 @@ error:
**************************************************************************************
*/
static herr_t
-verify_elmts_two(int type, hsize_t *ext_dims, hsize_t *prev_dims, void *_ldbuf, void *_buf)
+verify_elmts_two(int type, hsize_t *ext_dims, hsize_t *prev_dims, void *_ldbuf, void *_buf)
{
- int k, m; /* Local index variable */
+ int k, m; /* Local index variable */
k = 0;
- for(m = 0; m < (int)ext_dims[0]; m++) {
- int n, ind; /* Local index variable */
-
- ind = m * (int)ext_dims[1];
- if(m < (int)prev_dims[0]) {
- for(n = (int)prev_dims[1]; n < (int)ext_dims[1]; n++) {
- VERIFY_ELMTS(type, k, ind, _ldbuf, _buf)
- ++k;
- } /* end for */
- } /* end if */
+ for (m = 0; m < (int)ext_dims[0]; m++) {
+ int n, ind; /* Local index variable */
+
+ ind = m * (int)ext_dims[1];
+ if (m < (int)prev_dims[0]) {
+ for (n = (int)prev_dims[1]; n < (int)ext_dims[1]; n++) {
+ VERIFY_ELMTS(type, k, ind, _ldbuf, _buf)
+ ++k;
+ } /* end for */
+ } /* end if */
else {
- for(n = 0; n < (int)ext_dims[1]; n++) {
- VERIFY_ELMTS(type, k, ind, _ldbuf, _buf)
- ++k;
- } /* end for */
- } /* end else */
- } /* end for */
+ for (n = 0; n < (int)ext_dims[1]; n++) {
+ VERIFY_ELMTS(type, k, ind, _ldbuf, _buf)
+ ++k;
+ } /* end for */
+ } /* end else */
+ } /* end for */
- return(0);
+ return (0);
error:
- return(-1);
+ return (-1);
} /* verify_elmts_two() */
-
/*
**************************************************************************************
* Testing for the High Level public routine: H5LDget_dset_elmts()
@@ -1188,126 +1190,126 @@ error:
static herr_t
test_LD_elmts_two(const char *file, const char *dname, const char *fields)
{
- hid_t fid=-1; /* file identifier */
- hid_t did=-1; /* dataset identifier */
- hid_t dtype=-1; /* dataset's data type */
- hsize_t ext_dims[2]; /* extended dimension sizes of the dataset */
- hsize_t prev_dims[2]; /* previous dimension sizes of the dataset */
- int i; /* local index variable */
- int ret = 0; /* return value */
+ hid_t fid = -1; /* file identifier */
+ hid_t did = -1; /* dataset identifier */
+ hid_t dtype = -1; /* dataset's data type */
+ hsize_t ext_dims[2]; /* extended dimension sizes of the dataset */
+ hsize_t prev_dims[2]; /* previous dimension sizes of the dataset */
+ int i; /* local index variable */
+ int ret = 0; /* return value */
HL_TESTING2("H5LDget_dset_elmts: two-dimensional dataset");
/* Copy the test file */
- if(h5_make_local_copy(file, COPY_FILENAME) < 0)
+ if (h5_make_local_copy(file, COPY_FILENAME) < 0)
TEST_ERROR
- for(i = 0; i < TEST_BUF_SIZE; i++) {
- cbuf[i].field1 = i;
- cbuf[i].field2.a = i;
- cbuf[i].field2.b.a = i;
- cbuf[i].field2.b.b = i;
- cbuf[i].field2.b.c = i;
- cbuf[i].field2.c = i;
- cbuf[i].field3 = (double)i;
- cbuf[i].field4.a = i;
- cbuf[i].field4.b = i;
- ibuf[i] = i;
+ for (i = 0; i < TEST_BUF_SIZE; i++) {
+ cbuf[i].field1 = i;
+ cbuf[i].field2.a = i;
+ cbuf[i].field2.b.a = i;
+ cbuf[i].field2.b.b = i;
+ cbuf[i].field2.b.c = i;
+ cbuf[i].field2.c = i;
+ cbuf[i].field3 = (double)i;
+ cbuf[i].field4.a = i;
+ cbuf[i].field4.b = i;
+ ibuf[i] = i;
} /* end for */
/* Open the copied file */
- if((fid = H5Fopen(COPY_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fopen(COPY_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Open the dataset */
- if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get the dataset's data type */
- if((dtype = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((dtype = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Get current dimension sizes before extending the dataset's dimension sizes */
- if(H5LDget_dset_dims(did, prev_dims) < 0)
- FAIL_STACK_ERROR
-
- /* Loop through different variations of extending the dataset */
- for(i = 0; i < TWO_NTESTS; i++) {
- HDmemset(vbuf1, 0, TEST_BUF_SIZE * sizeof(test_valid_fields1));
- HDmemset(vbuf2, 0, TEST_BUF_SIZE * sizeof(test_valid_fields2));
- HDmemset(ccbuf, 0, TEST_BUF_SIZE * sizeof(set_t));
- HDmemset(iibuf, 0, TEST_BUF_SIZE * sizeof(int));
-
- ext_dims[0] = (hsize_t)((int)prev_dims[0] + two_tests[i][0]);
- ext_dims[1] = (hsize_t)((int)prev_dims[1] + two_tests[i][1]);
-
- /* Change the dimension sizes of the dataset */
- if(H5Dset_extent(did, ext_dims) < 0)
+ if (H5LDget_dset_dims(did, prev_dims) < 0)
FAIL_STACK_ERROR
- /* Initialize data */
- if(!HDstrcmp(dname, DSET_CMPD_TWO)) {
- if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, cbuf) < 0)
- FAIL_STACK_ERROR
- } /* end if */
- else if(!HDstrcmp(dname, DSET_TWO)) {
- if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf) < 0)
- FAIL_STACK_ERROR
- } /* end else-if */
+ /* Loop through different variations of extending the dataset */
+ for (i = 0; i < TWO_NTESTS; i++) {
+ HDmemset(vbuf1, 0, TEST_BUF_SIZE * sizeof(test_valid_fields1));
+ HDmemset(vbuf2, 0, TEST_BUF_SIZE * sizeof(test_valid_fields2));
+ HDmemset(ccbuf, 0, TEST_BUF_SIZE * sizeof(set_t));
+ HDmemset(iibuf, 0, TEST_BUF_SIZE * sizeof(int));
+
+ ext_dims[0] = (hsize_t)((int)prev_dims[0] + two_tests[i][0]);
+ ext_dims[1] = (hsize_t)((int)prev_dims[1] + two_tests[i][1]);
+
+ /* Change the dimension sizes of the dataset */
+ if (H5Dset_extent(did, ext_dims) < 0)
+ FAIL_STACK_ERROR
+
+ /* Initialize data */
+ if (!HDstrcmp(dname, DSET_CMPD_TWO)) {
+ if (H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, cbuf) < 0)
+ FAIL_STACK_ERROR
+ } /* end if */
+ else if (!HDstrcmp(dname, DSET_TWO)) {
+ if (H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf) < 0)
+ FAIL_STACK_ERROR
+ } /* end else-if */
else
TEST_ERROR
- /* There are changes in dimension sizes */
- if(two_tests[i][0] > 0 || two_tests[i][1] > 0) {
- if(!HDstrcmp(dname, DSET_CMPD_TWO)) {
- if(fields) {
- if(!HDstrcmp(fields, VALID_FIELDS1) || !HDstrcmp(fields, VALID_ESC_FIELDS1)) {
+ /* There are changes in dimension sizes */
+ if (two_tests[i][0] > 0 || two_tests[i][1] > 0) {
+ if (!HDstrcmp(dname, DSET_CMPD_TWO)) {
+ if (fields) {
+ if (!HDstrcmp(fields, VALID_FIELDS1) || !HDstrcmp(fields, VALID_ESC_FIELDS1)) {
/* Retrieve the elmemts in BUF */
- if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, vbuf1) < 0)
+ if (H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, vbuf1) < 0)
TEST_ERROR
- if(verify_elmts_two(TWO_CMPD_VALID1, ext_dims, prev_dims, vbuf1, cbuf) < 0)
+ if (verify_elmts_two(TWO_CMPD_VALID1, ext_dims, prev_dims, vbuf1, cbuf) < 0)
TEST_ERROR
} /* end if */
- else if(!HDstrcmp(fields, VALID_FIELDS2) || !HDstrcmp(fields, VALID_ESC_FIELDS2)) {
+ else if (!HDstrcmp(fields, VALID_FIELDS2) || !HDstrcmp(fields, VALID_ESC_FIELDS2)) {
/* Retrieve the elmemts in BUF */
- if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, vbuf2) < 0)
+ if (H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, vbuf2) < 0)
TEST_ERROR
- if(verify_elmts_two(TWO_CMPD_VALID2, ext_dims, prev_dims, vbuf2, cbuf) < 0)
+ if (verify_elmts_two(TWO_CMPD_VALID2, ext_dims, prev_dims, vbuf2, cbuf) < 0)
TEST_ERROR
} /* end else-if */
else
TEST_ERROR
- } /* end if */
+ } /* end if */
else {
- /* Retrieve the elmemts in BUF */
- if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, ccbuf) < 0)
- TEST_ERROR
- if(verify_elmts_two(TWO_CMPD_NULL, ext_dims, prev_dims, ccbuf, cbuf) < 0)
- TEST_ERROR
- } /* end else */
- } /* end if */
+ /* Retrieve the elmemts in BUF */
+ if (H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, ccbuf) < 0)
+ TEST_ERROR
+ if (verify_elmts_two(TWO_CMPD_NULL, ext_dims, prev_dims, ccbuf, cbuf) < 0)
+ TEST_ERROR
+ } /* end else */
+ } /* end if */
else { /* DSET_TWO */
- /* Retrieve the elmemts in BUF */
- if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf) < 0)
- TEST_ERROR
- if(verify_elmts_two(TWO_NONE, ext_dims, prev_dims, iibuf, ibuf) < 0)
- TEST_ERROR
- } /* end else */
- } /* end if */
+ /* Retrieve the elmemts in BUF */
+ if (H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf) < 0)
+ TEST_ERROR
+ if (verify_elmts_two(TWO_NONE, ext_dims, prev_dims, iibuf, ibuf) < 0)
+ TEST_ERROR
+ } /* end else */
+ } /* end if */
else {
- /* Verify failure when changes between prev_dims and ext_dims are same/decrease */
- ret = H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf);
- VERIFY_EQUAL(ret, FAIL)
- } /* end else */
- } /* end for */
+ /* Verify failure when changes between prev_dims and ext_dims are same/decrease */
+ ret = H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf);
+ VERIFY_EQUAL(ret, FAIL)
+ } /* end else */
+ } /* end for */
/* Closing */
- if(H5Tclose(dtype) < 0)
- FAIL_STACK_ERROR;
- if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ if (H5Tclose(dtype) < 0)
+ FAIL_STACK_ERROR;
+ if (H5Dclose(did) < 0)
+ FAIL_STACK_ERROR;
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR;
/* Remove the copied file */
HDremove(COPY_FILENAME);
@@ -1316,37 +1318,40 @@ test_LD_elmts_two(const char *file, const char *dname, const char *fields)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Tclose(dtype);
- H5Dclose(did);
- H5Fclose(fid);
- } H5E_END_TRY;
- return(-1);
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(dtype);
+ H5Dclose(did);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY;
+ return (-1);
} /* test_LD_elmts_two() */
/*
* Tests for High Level routines:
* H5LDget_dset_dims(), H5LDget_dset_elmts, H5LDget_dset_type_size()
*/
-int main(void)
+int
+main(void)
{
- int nerrors = 0;
+ int nerrors = 0;
/* Set up temporary buffers for tests: test_LD_elmts_one() & test_LD_elmts_two() */
- if(NULL == (ibuf = (int *)HDmalloc(sizeof(int) * TEST_BUF_SIZE)))
- FAIL_STACK_ERROR;
- if(NULL == (iibuf = (int *)HDmalloc(sizeof(int) * TEST_BUF_SIZE)))
- FAIL_STACK_ERROR;
+ if (NULL == (ibuf = (int *)HDmalloc(sizeof(int) * TEST_BUF_SIZE)))
+ FAIL_STACK_ERROR;
+ if (NULL == (iibuf = (int *)HDmalloc(sizeof(int) * TEST_BUF_SIZE)))
+ FAIL_STACK_ERROR;
- if(NULL == (cbuf = (set_t *)HDmalloc(sizeof(set_t) * TEST_BUF_SIZE)))
- FAIL_STACK_ERROR;
- if(NULL == (ccbuf = (set_t *)HDmalloc(sizeof(set_t) * TEST_BUF_SIZE)))
- FAIL_STACK_ERROR;
+ if (NULL == (cbuf = (set_t *)HDmalloc(sizeof(set_t) * TEST_BUF_SIZE)))
+ FAIL_STACK_ERROR;
+ if (NULL == (ccbuf = (set_t *)HDmalloc(sizeof(set_t) * TEST_BUF_SIZE)))
+ FAIL_STACK_ERROR;
- if(NULL == (vbuf1 = (test_valid_fields1 *)HDmalloc(sizeof(test_valid_fields1) * TEST_BUF_SIZE)))
- FAIL_STACK_ERROR;
- if(NULL == (vbuf2 = (test_valid_fields2 *)HDmalloc(sizeof(test_valid_fields2) * TEST_BUF_SIZE)))
- FAIL_STACK_ERROR;
+ if (NULL == (vbuf1 = (test_valid_fields1 *)HDmalloc(sizeof(test_valid_fields1) * TEST_BUF_SIZE)))
+ FAIL_STACK_ERROR;
+ if (NULL == (vbuf2 = (test_valid_fields2 *)HDmalloc(sizeof(test_valid_fields2) * TEST_BUF_SIZE)))
+ FAIL_STACK_ERROR;
/*
* Testing H5LDget_dset_dims()
@@ -1396,28 +1401,27 @@ int main(void)
nerrors += test_LD_elmts_two(FILE, DSET_CMPD_TWO, VALID_FIELDS2);
/* Free temporary buffers */
- if(ibuf)
+ if (ibuf)
HDfree(ibuf);
- if(iibuf)
+ if (iibuf)
HDfree(iibuf);
- if(cbuf)
+ if (cbuf)
HDfree(cbuf);
- if(ccbuf)
+ if (ccbuf)
HDfree(ccbuf);
- if(vbuf1)
+ if (vbuf1)
HDfree(vbuf1);
- if(vbuf2)
+ if (vbuf2)
HDfree(vbuf2);
/* check for errors */
- if(nerrors)
- goto error;
+ if (nerrors)
+ goto error;
puts("All tests for H5LD high level routines passed.");
- return(0);
+ return (0);
error:
- return(1);
+ return (1);
} /* main() */
-
diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c
index f3e6e97..558211e 100644
--- a/hl/test/test_lite.c
+++ b/hl/test/test_lite.c
@@ -1,21 +1,21 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5hltest.h"
#include "H5srcdir.h"
#include "H5LTpublic.h"
-#define FILE_NAME "test_lite1.h5"
+#define FILE_NAME "test_lite1.h5"
#define FILE_NAME2 "test_lite2.h5"
#define FILE_NAME3 "test_lite3.h5"
#define FILE_NAME4 "test_lite4.h5"
@@ -33,78 +33,76 @@
#define DIM 6
#define ATTR_NAME_SUB "att"
-#define ATTR1_NAME "attr string"
-#define ATTR2_NAME "attr char"
-#define ATTR3_NAME "attr short"
-#define ATTR4_NAME "attr int"
+#define ATTR1_NAME "attr string"
+#define ATTR2_NAME "attr char"
+#define ATTR3_NAME "attr short"
+#define ATTR4_NAME "attr int"
#define ATTR_NAME_EXT "att int ext"
-#define ATTR5_NAME "attr long"
-#define ATTR6_NAME "attr uchar"
-#define ATTR7_NAME "attr ushort"
-#define ATTR8_NAME "attr uint"
-#define ATTR9_NAME "attr ulong"
-#define ATTR10_NAME "attr float"
-#define ATTR11_NAME "attr double"
-
-static herr_t make_attributes( hid_t loc_id, const char* obj_name );
+#define ATTR5_NAME "attr long"
+#define ATTR6_NAME "attr uchar"
+#define ATTR7_NAME "attr ushort"
+#define ATTR8_NAME "attr uint"
+#define ATTR9_NAME "attr ulong"
+#define ATTR10_NAME "attr float"
+#define ATTR11_NAME "attr double"
+static herr_t make_attributes(hid_t loc_id, const char *obj_name);
/*-------------------------------------------------------------------------
-* test dataset functions
-*-------------------------------------------------------------------------
-*/
+ * test dataset functions
+ *-------------------------------------------------------------------------
+ */
-static int test_dsets( void )
+static int
+test_dsets(void)
{
- int rank = 2;
- hsize_t dims[2] = {2,3};
- hid_t file_id;
- hid_t dataset_id;
- char data_char_in[DIM] = {1,2,3,4,5,6};
- char data_char_out[DIM];
- short data_short_in[DIM] = {1,2,3,4,5,6};
- short data_short_out[DIM];
- int data_int_in[DIM] = {1,2,3,4,5,6};
- int data_int_out[DIM];
- long data_long_in[DIM] = {1,2,3,4,5,6};
- long data_long_out[DIM];
- float data_float_in[DIM] = {1,2,3,4,5,6};
- float data_float_out[DIM];
- double data_double_in[DIM] = {1,2,3,4,5,6};
- double data_double_out[DIM];
- const char *data_string_in = "This is a string";
- char data_string_out[20];
- int i;
-
+ int rank = 2;
+ hsize_t dims[2] = {2, 3};
+ hid_t file_id;
+ hid_t dataset_id;
+ char data_char_in[DIM] = {1, 2, 3, 4, 5, 6};
+ char data_char_out[DIM];
+ short data_short_in[DIM] = {1, 2, 3, 4, 5, 6};
+ short data_short_out[DIM];
+ int data_int_in[DIM] = {1, 2, 3, 4, 5, 6};
+ int data_int_out[DIM];
+ long data_long_in[DIM] = {1, 2, 3, 4, 5, 6};
+ long data_long_out[DIM];
+ float data_float_in[DIM] = {1, 2, 3, 4, 5, 6};
+ float data_float_out[DIM];
+ double data_double_in[DIM] = {1, 2, 3, 4, 5, 6};
+ double data_double_out[DIM];
+ const char *data_string_in = "This is a string";
+ char data_string_out[20];
+ int i;
/* Create a new file using default properties. */
- file_id = H5Fcreate( FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
+ file_id = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * H5LTmake_dataset test
- *-------------------------------------------------------------------------
- */
+ * H5LTmake_dataset test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTmake_dataset");
/* Make dataset */
- if ( H5LTmake_dataset( file_id, DSET0_NAME, rank, dims, H5T_NATIVE_INT, data_int_in ) < 0 )
+ if (H5LTmake_dataset(file_id, DSET0_NAME, rank, dims, H5T_NATIVE_INT, data_int_in) < 0)
goto out;
/* Read dataset using the basic HDF5 API */
- if ( ( dataset_id = H5Dopen2(file_id, DSET0_NAME, H5P_DEFAULT) ) < 0 )
+ if ((dataset_id = H5Dopen2(file_id, DSET0_NAME, H5P_DEFAULT)) < 0)
goto out;
- if ( H5Dread ( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_int_out ) < 0 )
+ if (H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_int_out) < 0)
goto out;
- if ( H5Dclose( dataset_id ) < 0 )
+ if (H5Dclose(dataset_id) < 0)
goto out;
- for (i = 0; i < DIM; i++)
- {
- if ( data_int_in[i] != data_int_out[i] ) {
+ for (i = 0; i < DIM; i++) {
+ if (data_int_in[i] != data_int_out[i]) {
goto out;
}
}
@@ -112,18 +110,17 @@ static int test_dsets( void )
PASSED();
/*-------------------------------------------------------------------------
- * read using the LT function H5LTread_dataset
- *-------------------------------------------------------------------------
- */
+ * read using the LT function H5LTread_dataset
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTread_dataset");
- if ( H5LTread_dataset( file_id, DSET0_NAME, H5T_NATIVE_INT, data_int_out ) < 0 )
+ if (H5LTread_dataset(file_id, DSET0_NAME, H5T_NATIVE_INT, data_int_out) < 0)
goto out;
- for (i = 0; i < DIM; i++)
- {
- if ( data_int_in[i] != data_int_out[i] ) {
+ for (i = 0; i < DIM; i++) {
+ if (data_int_in[i] != data_int_out[i]) {
goto out;
}
}
@@ -131,76 +128,70 @@ static int test_dsets( void )
PASSED();
/*-------------------------------------------------------------------------
- * test the H5LTmake_dataset_ functions
- *-------------------------------------------------------------------------
- */
-
+ * test the H5LTmake_dataset_ functions
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5LTmake_dataset_char
- *-------------------------------------------------------------------------
- */
+ * H5LTmake_dataset_char
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTmake_dataset_char");
/* Make dataset char */
- if ( H5LTmake_dataset_char( file_id, DSET1_NAME, rank, dims, data_char_in ) < 0 )
+ if (H5LTmake_dataset_char(file_id, DSET1_NAME, rank, dims, data_char_in) < 0)
goto out;
/* Read dataset */
- if ( H5LTread_dataset( file_id, DSET1_NAME, H5T_NATIVE_CHAR, data_char_out ) < 0 )
+ if (H5LTread_dataset(file_id, DSET1_NAME, H5T_NATIVE_CHAR, data_char_out) < 0)
goto out;
- for (i = 0; i < DIM; i++)
- {
- if ( data_char_in[i] != data_char_out[i] ) {
+ for (i = 0; i < DIM; i++) {
+ if (data_char_in[i] != data_char_out[i]) {
goto out;
}
}
/* Read dataset */
- if ( H5LTread_dataset_char( file_id, DSET1_NAME, data_char_out ) < 0 )
+ if (H5LTread_dataset_char(file_id, DSET1_NAME, data_char_out) < 0)
goto out;
- for (i = 0; i < DIM; i++)
- {
- if ( data_char_in[i] != data_char_out[i] ) {
+ for (i = 0; i < DIM; i++) {
+ if (data_char_in[i] != data_char_out[i]) {
goto out;
}
}
PASSED();
-
/*-------------------------------------------------------------------------
- * H5LTmake_dataset_short
- *-------------------------------------------------------------------------
- */
+ * H5LTmake_dataset_short
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTmake_dataset_short");
/* Make dataset short */
- if ( H5LTmake_dataset_short( file_id, DSET2_NAME, rank, dims, data_short_in ) < 0 )
+ if (H5LTmake_dataset_short(file_id, DSET2_NAME, rank, dims, data_short_in) < 0)
goto out;
/* Read dataset */
- if ( H5LTread_dataset( file_id, DSET2_NAME, H5T_NATIVE_SHORT, data_short_out ) < 0 )
+ if (H5LTread_dataset(file_id, DSET2_NAME, H5T_NATIVE_SHORT, data_short_out) < 0)
goto out;
- for (i = 0; i < DIM; i++)
- {
- if ( data_short_in[i] != data_short_out[i] ) {
+ for (i = 0; i < DIM; i++) {
+ if (data_short_in[i] != data_short_out[i]) {
goto out;
}
}
/* Read dataset */
- if ( H5LTread_dataset_short( file_id, DSET2_NAME, data_short_out ) < 0 )
+ if (H5LTread_dataset_short(file_id, DSET2_NAME, data_short_out) < 0)
goto out;
- for (i = 0; i < DIM; i++)
- {
- if ( data_short_in[i] != data_short_out[i] ) {
+ for (i = 0; i < DIM; i++) {
+ if (data_short_in[i] != data_short_out[i]) {
goto out;
}
}
@@ -208,180 +199,165 @@ static int test_dsets( void )
PASSED();
/*-------------------------------------------------------------------------
- * H5LTmake_dataset_int
- *-------------------------------------------------------------------------
- */
+ * H5LTmake_dataset_int
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTmake_dataset_int");
/* Make dataset int */
- if ( H5LTmake_dataset_int( file_id, DSET3_NAME, rank, dims, data_int_in ) < 0 )
+ if (H5LTmake_dataset_int(file_id, DSET3_NAME, rank, dims, data_int_in) < 0)
goto out;
/* Read dataset */
- if ( H5LTread_dataset( file_id, DSET3_NAME, H5T_NATIVE_INT, data_int_out ) < 0 )
+ if (H5LTread_dataset(file_id, DSET3_NAME, H5T_NATIVE_INT, data_int_out) < 0)
goto out;
- for (i = 0; i < DIM; i++)
- {
- if ( data_int_in[i] != data_int_out[i] ) {
+ for (i = 0; i < DIM; i++) {
+ if (data_int_in[i] != data_int_out[i]) {
goto out;
}
}
/* Read dataset */
- if ( H5LTread_dataset_int( file_id, DSET3_NAME, data_int_out ) < 0 )
+ if (H5LTread_dataset_int(file_id, DSET3_NAME, data_int_out) < 0)
goto out;
- for (i = 0; i < DIM; i++)
- {
- if ( data_int_in[i] != data_int_out[i] ) {
+ for (i = 0; i < DIM; i++) {
+ if (data_int_in[i] != data_int_out[i]) {
goto out;
}
}
PASSED();
-
/*-------------------------------------------------------------------------
- * H5LTmake_dataset_long
- *-------------------------------------------------------------------------
- */
+ * H5LTmake_dataset_long
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTmake_dataset_long");
/* Make dataset long */
- if ( H5LTmake_dataset_long( file_id, DSET4_NAME, rank, dims, data_long_in ) < 0 )
+ if (H5LTmake_dataset_long(file_id, DSET4_NAME, rank, dims, data_long_in) < 0)
goto out;
/* Read dataset */
- if ( H5LTread_dataset( file_id, DSET4_NAME, H5T_NATIVE_LONG, data_long_out ) < 0 )
+ if (H5LTread_dataset(file_id, DSET4_NAME, H5T_NATIVE_LONG, data_long_out) < 0)
goto out;
- for (i = 0; i < DIM; i++)
- {
- if ( data_long_in[i] != data_long_out[i] ) {
+ for (i = 0; i < DIM; i++) {
+ if (data_long_in[i] != data_long_out[i]) {
goto out;
}
}
/* Read dataset */
- if ( H5LTread_dataset_long( file_id, DSET4_NAME, data_long_out ) < 0 )
+ if (H5LTread_dataset_long(file_id, DSET4_NAME, data_long_out) < 0)
goto out;
- for (i = 0; i < DIM; i++)
- {
- if ( data_long_in[i] != data_long_out[i] ) {
+ for (i = 0; i < DIM; i++) {
+ if (data_long_in[i] != data_long_out[i]) {
goto out;
}
}
PASSED();
-
/*-------------------------------------------------------------------------
- * H5LTmake_dataset_float
- *-------------------------------------------------------------------------
- */
+ * H5LTmake_dataset_float
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTmake_dataset_float");
/* Make dataset float */
- if ( H5LTmake_dataset_float( file_id, DSET5_NAME, rank, dims, data_float_in ) < 0 )
+ if (H5LTmake_dataset_float(file_id, DSET5_NAME, rank, dims, data_float_in) < 0)
goto out;
/* Read dataset */
- if ( H5LTread_dataset( file_id, DSET5_NAME, H5T_NATIVE_FLOAT, data_float_out ) < 0 )
+ if (H5LTread_dataset(file_id, DSET5_NAME, H5T_NATIVE_FLOAT, data_float_out) < 0)
goto out;
- for (i = 0; i < DIM; i++)
- {
- if(!H5_FLT_ABS_EQUAL(data_float_in[i],data_float_out[i])) {
+ for (i = 0; i < DIM; i++) {
+ if (!H5_FLT_ABS_EQUAL(data_float_in[i], data_float_out[i])) {
goto out;
}
}
/* Read dataset */
- if ( H5LTread_dataset_float( file_id, DSET5_NAME, data_float_out ) < 0 )
+ if (H5LTread_dataset_float(file_id, DSET5_NAME, data_float_out) < 0)
goto out;
- for (i = 0; i < DIM; i++)
- {
- if(!H5_FLT_ABS_EQUAL(data_float_in[i],data_float_out[i])) {
+ for (i = 0; i < DIM; i++) {
+ if (!H5_FLT_ABS_EQUAL(data_float_in[i], data_float_out[i])) {
goto out;
}
}
PASSED();
-
/*-------------------------------------------------------------------------
- * H5LTmake_dataset_double
- *-------------------------------------------------------------------------
- */
+ * H5LTmake_dataset_double
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTmake_dataset_double");
/* Make dataset double */
- if ( H5LTmake_dataset_double( file_id, DSET6_NAME, rank, dims, data_double_in ) < 0 )
+ if (H5LTmake_dataset_double(file_id, DSET6_NAME, rank, dims, data_double_in) < 0)
goto out;
/* Read dataset */
- if ( H5LTread_dataset( file_id, DSET6_NAME, H5T_NATIVE_DOUBLE, data_double_out ) < 0 )
+ if (H5LTread_dataset(file_id, DSET6_NAME, H5T_NATIVE_DOUBLE, data_double_out) < 0)
goto out;
- for (i = 0; i < DIM; i++)
- {
- if(!H5_DBL_ABS_EQUAL(data_double_in[i],data_double_out[i])) {
+ for (i = 0; i < DIM; i++) {
+ if (!H5_DBL_ABS_EQUAL(data_double_in[i], data_double_out[i])) {
goto out;
}
}
/* Read dataset */
- if ( H5LTread_dataset_double( file_id, DSET6_NAME, data_double_out ) < 0 )
+ if (H5LTread_dataset_double(file_id, DSET6_NAME, data_double_out) < 0)
goto out;
- for (i = 0; i < DIM; i++)
- {
- if(!H5_DBL_ABS_EQUAL(data_double_in[i],data_double_out[i])) {
+ for (i = 0; i < DIM; i++) {
+ if (!H5_DBL_ABS_EQUAL(data_double_in[i], data_double_out[i])) {
goto out;
}
}
PASSED();
-
/*-------------------------------------------------------------------------
- * H5LTmake_dataset_string
- *-------------------------------------------------------------------------
- */
+ * H5LTmake_dataset_string
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTmake_dataset_string");
/* Make dataset string */
- if ( H5LTmake_dataset_string(file_id,DSET7_NAME,data_string_in) < 0 )
+ if (H5LTmake_dataset_string(file_id, DSET7_NAME, data_string_in) < 0)
goto out;
/* Read dataset */
- if ( H5LTread_dataset_string(file_id,DSET7_NAME,data_string_out) < 0 )
+ if (H5LTread_dataset_string(file_id, DSET7_NAME, data_string_out) < 0)
goto out;
- if ( HDstrcmp(data_string_in,data_string_out) != 0 )
+ if (HDstrcmp(data_string_in, data_string_out) != 0)
goto out;
-
-
/*-------------------------------------------------------------------------
- * end tests
- *-------------------------------------------------------------------------
- */
+ * end tests
+ *-------------------------------------------------------------------------
+ */
/* Close the file. */
- H5Fclose( file_id );
+ H5Fclose(file_id);
PASSED();
-
return 0;
out:
@@ -391,75 +367,83 @@ out:
}
/*-------------------------------------------------------------------------
-* test attribute functions
-*-------------------------------------------------------------------------
-*/
+ * test attribute functions
+ *-------------------------------------------------------------------------
+ */
-static int test_attr(void)
+static int
+test_attr(void)
{
hid_t file_id;
hid_t dataset_id;
hid_t group_id;
hid_t space_id;
- hsize_t dims[1] = { 5 };
+ hsize_t dims[1] = {5};
/* Create a new file using default properties. */
file_id = H5Fcreate(FILE_NAME2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * Create a dataset named "dset" on the root group
- *-------------------------------------------------------------------------
- */
+ * Create a dataset named "dset" on the root group
+ *-------------------------------------------------------------------------
+ */
/* Create the data space */
- if((space_id = H5Screate_simple(1, dims, NULL)) < 0) goto out;
+ if ((space_id = H5Screate_simple(1, dims, NULL)) < 0)
+ goto out;
/* Create the dataset */
- if((dataset_id = H5Dcreate2(file_id , "dset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out;
+ if ((dataset_id = H5Dcreate2(file_id, "dset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ goto out;
/* Close */
H5Dclose(dataset_id);
/*-------------------------------------------------------------------------
- * Create a group named "grp" on the root group
- *-------------------------------------------------------------------------
- */
+ * Create a group named "grp" on the root group
+ *-------------------------------------------------------------------------
+ */
/* Create a group. */
- if((group_id = H5Gcreate2(file_id, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out;
+ if ((group_id = H5Gcreate2(file_id, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
/* Close */
H5Gclose(group_id);
/*-------------------------------------------------------------------------
- *
- * Create attributes in the root group
- * Note that we are calling the H5LTset_attribute functions with the name "."
- *
- *-------------------------------------------------------------------------
- */
- if(make_attributes(file_id, ".") < 0) goto out;
+ *
+ * Create attributes in the root group
+ * Note that we are calling the H5LTset_attribute functions with the name "."
+ *
+ *-------------------------------------------------------------------------
+ */
+ if (make_attributes(file_id, ".") < 0)
+ goto out;
/*-------------------------------------------------------------------------
- *
- * Create attributes in the dataset "dset"
- *
- *-------------------------------------------------------------------------
- */
- if(make_attributes(file_id, "dset") < 0) goto out;
+ *
+ * Create attributes in the dataset "dset"
+ *
+ *-------------------------------------------------------------------------
+ */
+ if (make_attributes(file_id, "dset") < 0)
+ goto out;
/*-------------------------------------------------------------------------
- *
- * Create attributes in the group "grp"
- *
- *-------------------------------------------------------------------------
- */
- if(make_attributes(file_id, "grp") < 0) goto out;
+ *
+ * Create attributes in the group "grp"
+ *
+ *-------------------------------------------------------------------------
+ */
+ if (make_attributes(file_id, "grp") < 0)
+ goto out;
/*-------------------------------------------------------------------------
- * end
- *-------------------------------------------------------------------------
- */
+ * end
+ *-------------------------------------------------------------------------
+ */
/* Close the file. */
H5Fclose(file_id);
@@ -474,113 +458,109 @@ out:
}
/*-------------------------------------------------------------------------
-* make_attributes
-*-------------------------------------------------------------------------
-*/
+ * make_attributes
+ *-------------------------------------------------------------------------
+ */
-static herr_t make_attributes( hid_t loc_id, const char* obj_name )
+static herr_t
+make_attributes(hid_t loc_id, const char *obj_name)
{
int rank_out;
- hsize_t *dims_out = 0;
+ hsize_t * dims_out = 0;
H5T_class_t type_class;
size_t type_size;
int i;
- char attr_str_in[] = {"My attribute"};
- char attr_str_out[20];
- char attr_char_in[5] = {1,2,3,4,5};
- char attr_char_out[5];
- short attr_short_in[5] = {1,2,3,4,5};
- short attr_short_out[5];
- int attr_int_in[5] = {1,2,3,4,5};
- int attr_int_out[5];
- long attr_long_in[5] = {1,2,3,4,5};
- long attr_long_out[5];
- float attr_float_in[5] = {1,2,3,4,5};
- float attr_float_out[5];
- double attr_double_in[5] = {1,2,3,4,5};
- double attr_double_out[5];
- unsigned char attr_uchar_in[5] = {1,2,3,4,5};
- unsigned char attr_uchar_out[5];
- unsigned short attr_ushort_in[5] = {1,2,3,4,5};
- unsigned short attr_ushort_out[5];
- unsigned int attr_uint_in[5] = {1,2,3,4,5};
- unsigned int attr_uint_out[5];
- unsigned long attr_ulong_in[5] = {1,2,3,4,5};
- unsigned long attr_ulong_out[5];
+ char attr_str_in[] = {"My attribute"};
+ char attr_str_out[20];
+ char attr_char_in[5] = {1, 2, 3, 4, 5};
+ char attr_char_out[5];
+ short attr_short_in[5] = {1, 2, 3, 4, 5};
+ short attr_short_out[5];
+ int attr_int_in[5] = {1, 2, 3, 4, 5};
+ int attr_int_out[5];
+ long attr_long_in[5] = {1, 2, 3, 4, 5};
+ long attr_long_out[5];
+ float attr_float_in[5] = {1, 2, 3, 4, 5};
+ float attr_float_out[5];
+ double attr_double_in[5] = {1, 2, 3, 4, 5};
+ double attr_double_out[5];
+ unsigned char attr_uchar_in[5] = {1, 2, 3, 4, 5};
+ unsigned char attr_uchar_out[5];
+ unsigned short attr_ushort_in[5] = {1, 2, 3, 4, 5};
+ unsigned short attr_ushort_out[5];
+ unsigned int attr_uint_in[5] = {1, 2, 3, 4, 5};
+ unsigned int attr_uint_out[5];
+ unsigned long attr_ulong_in[5] = {1, 2, 3, 4, 5};
+ unsigned long attr_ulong_out[5];
/*-------------------------------------------------------------------------
- * H5LTset_attribute_string test
- *-------------------------------------------------------------------------
- */
+ * H5LTset_attribute_string test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTset_attribute_string");
/* Set the attribute */
- if ( H5LTset_attribute_string( loc_id, obj_name, ATTR1_NAME, attr_str_in ) < 0 )
+ if (H5LTset_attribute_string(loc_id, obj_name, ATTR1_NAME, attr_str_in) < 0)
return -1;
PASSED();
/*-------------------------------------------------------------------------
- * H5LTset_attribute_string test
- *-------------------------------------------------------------------------
- */
+ * H5LTset_attribute_string test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTget_attribute_string");
-
/* Get the attribute */
- if ( H5LTget_attribute_string( loc_id, obj_name, ATTR1_NAME, attr_str_out ) < 0 )
+ if (H5LTget_attribute_string(loc_id, obj_name, ATTR1_NAME, attr_str_out) < 0)
return -1;
- if ( HDstrcmp( attr_str_in, attr_str_out ) != 0 )
- {
+ if (HDstrcmp(attr_str_in, attr_str_out) != 0) {
return -1;
}
PASSED();
-
/*-------------------------------------------------------------------------
- * H5LTset_attribute_char test
- *-------------------------------------------------------------------------
- */
+ * H5LTset_attribute_char test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTset_attribute_char");
/* Set the attribute */
- if ( H5LTset_attribute_char( loc_id, obj_name, ATTR2_NAME, attr_char_in, (size_t)5 ) < 0 )
+ if (H5LTset_attribute_char(loc_id, obj_name, ATTR2_NAME, attr_char_in, (size_t)5) < 0)
return -1;
PASSED();
/*-------------------------------------------------------------------------
- * H5LTget_attribute_char test
- *-------------------------------------------------------------------------
- */
+ * H5LTget_attribute_char test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTget_attribute_char");
/* Get the attribute */
- if ( H5LTget_attribute_char( loc_id, obj_name, ATTR2_NAME, attr_char_out ) < 0 )
+ if (H5LTget_attribute_char(loc_id, obj_name, ATTR2_NAME, attr_char_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_char_in[i] != attr_char_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_char_in[i] != attr_char_out[i]) {
return -1;
}
}
/* Get the attribute */
- if ( H5LTget_attribute( loc_id, obj_name, ATTR2_NAME, H5T_NATIVE_CHAR, attr_char_out ) < 0 )
+ if (H5LTget_attribute(loc_id, obj_name, ATTR2_NAME, H5T_NATIVE_CHAR, attr_char_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_char_in[i] != attr_char_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_char_in[i] != attr_char_out[i]) {
return -1;
}
}
@@ -588,117 +568,109 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
PASSED();
/*-------------------------------------------------------------------------
- * H5LTset_attribute_short test
- *-------------------------------------------------------------------------
- */
+ * H5LTset_attribute_short test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTset_attribute_short");
/* Set the attribute */
- if ( H5LTset_attribute_short( loc_id, obj_name, ATTR3_NAME, attr_short_in, (size_t)5 ) < 0 )
+ if (H5LTset_attribute_short(loc_id, obj_name, ATTR3_NAME, attr_short_in, (size_t)5) < 0)
return -1;
PASSED();
-
/*-------------------------------------------------------------------------
- * H5LTget_attribute_short test
- *-------------------------------------------------------------------------
- */
+ * H5LTget_attribute_short test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTget_attribute_short");
/* Get the attribute */
- if ( H5LTget_attribute_short( loc_id, obj_name, ATTR3_NAME, attr_short_out ) < 0 )
+ if (H5LTget_attribute_short(loc_id, obj_name, ATTR3_NAME, attr_short_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_short_in[i] != attr_short_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_short_in[i] != attr_short_out[i]) {
return -1;
}
}
/* Get the attribute */
- if ( H5LTget_attribute( loc_id, obj_name, ATTR3_NAME, H5T_NATIVE_SHORT, attr_short_out ) < 0 )
+ if (H5LTget_attribute(loc_id, obj_name, ATTR3_NAME, H5T_NATIVE_SHORT, attr_short_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_short_in[i] != attr_short_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_short_in[i] != attr_short_out[i]) {
return -1;
}
}
PASSED();
-
/*-------------------------------------------------------------------------
- * H5LTset_attribute_int test
- *-------------------------------------------------------------------------
- */
+ * H5LTset_attribute_int test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTset_attribute_int");
/* Set the attribute */
- if ( H5LTset_attribute_int( loc_id, obj_name, ATTR4_NAME, attr_int_in, (size_t)5 ) < 0 )
+ if (H5LTset_attribute_int(loc_id, obj_name, ATTR4_NAME, attr_int_in, (size_t)5) < 0)
return -1;
/* Set the attribute which is a substring of an existing attribute */
- if ( H5LTset_attribute_int( loc_id, obj_name, ATTR_NAME_SUB, attr_int_in, (size_t)5 ) < 0 )
+ if (H5LTset_attribute_int(loc_id, obj_name, ATTR_NAME_SUB, attr_int_in, (size_t)5) < 0)
return -1;
/* Set the attribute which is an extension of an existing attribute */
- if ( H5LTset_attribute_int( loc_id, obj_name, ATTR_NAME_EXT, attr_int_in, (size_t)5 ) < 0 )
+ if (H5LTset_attribute_int(loc_id, obj_name, ATTR_NAME_EXT, attr_int_in, (size_t)5) < 0)
return -1;
PASSED();
/*-------------------------------------------------------------------------
- * H5LTget_attribute_int test
- *-------------------------------------------------------------------------
- */
+ * H5LTget_attribute_int test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTget_attribute_int");
/* Get the attribute */
- if ( H5LTget_attribute_int( loc_id, obj_name, ATTR4_NAME, attr_int_out ) < 0 )
+ if (H5LTget_attribute_int(loc_id, obj_name, ATTR4_NAME, attr_int_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_int_in[i] != attr_int_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_int_in[i] != attr_int_out[i]) {
return -1;
}
}
- if ( H5LTget_attribute_int( loc_id, obj_name, ATTR_NAME_SUB, attr_int_out ) < 0 )
+ if (H5LTget_attribute_int(loc_id, obj_name, ATTR_NAME_SUB, attr_int_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_int_in[i] != attr_int_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_int_in[i] != attr_int_out[i]) {
return -1;
}
}
- if ( H5LTget_attribute_int( loc_id, obj_name, ATTR_NAME_EXT, attr_int_out ) < 0 )
+ if (H5LTget_attribute_int(loc_id, obj_name, ATTR_NAME_EXT, attr_int_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_int_in[i] != attr_int_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_int_in[i] != attr_int_out[i]) {
return -1;
}
}
/* Get the attribute */
- if ( H5LTget_attribute( loc_id, obj_name, ATTR4_NAME, H5T_NATIVE_INT, attr_int_out ) < 0 )
+ if (H5LTget_attribute(loc_id, obj_name, ATTR4_NAME, H5T_NATIVE_INT, attr_int_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_int_in[i] != attr_int_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_int_in[i] != attr_int_out[i]) {
return -1;
}
}
@@ -706,43 +678,41 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
PASSED();
/*-------------------------------------------------------------------------
- * H5LTset_attribute_long test
- *-------------------------------------------------------------------------
- */
+ * H5LTset_attribute_long test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTset_attribute_long");
/* Set the attribute */
- if ( H5LTset_attribute_long( loc_id, obj_name, ATTR5_NAME, attr_long_in, (size_t)5 ) < 0 )
+ if (H5LTset_attribute_long(loc_id, obj_name, ATTR5_NAME, attr_long_in, (size_t)5) < 0)
return -1;
PASSED();
/*-------------------------------------------------------------------------
- * H5LTget_attribute_long test
- *-------------------------------------------------------------------------
- */
+ * H5LTget_attribute_long test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTget_attribute_long");
/* Get the attribute */
- if ( H5LTget_attribute_long( loc_id, obj_name, ATTR5_NAME, attr_long_out ) < 0 )
+ if (H5LTget_attribute_long(loc_id, obj_name, ATTR5_NAME, attr_long_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_long_in[i] != attr_long_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_long_in[i] != attr_long_out[i]) {
return -1;
}
}
/* Get the attribute */
- if ( H5LTget_attribute( loc_id, obj_name, ATTR5_NAME, H5T_NATIVE_LONG, attr_long_out ) < 0 )
+ if (H5LTget_attribute(loc_id, obj_name, ATTR5_NAME, H5T_NATIVE_LONG, attr_long_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_long_in[i] != attr_long_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_long_in[i] != attr_long_out[i]) {
return -1;
}
}
@@ -750,43 +720,41 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
PASSED();
/*-------------------------------------------------------------------------
- * H5LTset_attribute_uchar test
- *-------------------------------------------------------------------------
- */
+ * H5LTset_attribute_uchar test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTset_attribute_uchar");
/* Set the attribute */
- if ( H5LTset_attribute_uchar( loc_id, obj_name, ATTR6_NAME, attr_uchar_in, (size_t)5 ) < 0 )
+ if (H5LTset_attribute_uchar(loc_id, obj_name, ATTR6_NAME, attr_uchar_in, (size_t)5) < 0)
return -1;
PASSED();
/*-------------------------------------------------------------------------
- * H5LTget_attribute_uchar test
- *-------------------------------------------------------------------------
- */
+ * H5LTget_attribute_uchar test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTget_attribute_uchar");
/* Get the attribute */
- if ( H5LTget_attribute_uchar( loc_id, obj_name, ATTR6_NAME, attr_uchar_out ) < 0 )
+ if (H5LTget_attribute_uchar(loc_id, obj_name, ATTR6_NAME, attr_uchar_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_uchar_in[i] != attr_uchar_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_uchar_in[i] != attr_uchar_out[i]) {
return -1;
}
}
/* Get the attribute */
- if ( H5LTget_attribute( loc_id, obj_name, ATTR6_NAME, H5T_NATIVE_UCHAR, attr_uchar_out ) < 0 )
+ if (H5LTget_attribute(loc_id, obj_name, ATTR6_NAME, H5T_NATIVE_UCHAR, attr_uchar_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_uchar_in[i] != attr_uchar_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_uchar_in[i] != attr_uchar_out[i]) {
return -1;
}
}
@@ -794,89 +762,83 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
PASSED();
/*-------------------------------------------------------------------------
- * H5LTset_attribute_ushort test
- *-------------------------------------------------------------------------
- */
+ * H5LTset_attribute_ushort test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTset_attribute_ushort");
/* Set the attribute */
- if ( H5LTset_attribute_ushort( loc_id, obj_name, ATTR7_NAME, attr_ushort_in, (size_t)5 ) < 0 )
+ if (H5LTset_attribute_ushort(loc_id, obj_name, ATTR7_NAME, attr_ushort_in, (size_t)5) < 0)
return -1;
PASSED();
-
/*-------------------------------------------------------------------------
- * H5LTget_attribute_ushort test
- *-------------------------------------------------------------------------
- */
+ * H5LTget_attribute_ushort test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTget_attribute_ushort");
/* Get the attribute */
- if ( H5LTget_attribute_ushort( loc_id, obj_name, ATTR7_NAME, attr_ushort_out ) < 0 )
+ if (H5LTget_attribute_ushort(loc_id, obj_name, ATTR7_NAME, attr_ushort_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_ushort_in[i] != attr_ushort_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_ushort_in[i] != attr_ushort_out[i]) {
return -1;
}
}
/* Get the attribute */
- if ( H5LTget_attribute( loc_id, obj_name, ATTR7_NAME, H5T_NATIVE_USHORT, attr_ushort_out ) < 0 )
+ if (H5LTget_attribute(loc_id, obj_name, ATTR7_NAME, H5T_NATIVE_USHORT, attr_ushort_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_ushort_in[i] != attr_ushort_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_ushort_in[i] != attr_ushort_out[i]) {
return -1;
}
}
PASSED();
-
/*-------------------------------------------------------------------------
- * H5LTset_attribute_int test
- *-------------------------------------------------------------------------
- */
+ * H5LTset_attribute_int test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTset_attribute_uint");
/* Set the attribute */
- if ( H5LTset_attribute_uint( loc_id, obj_name, ATTR8_NAME, attr_uint_in, (size_t)5 ) < 0 )
+ if (H5LTset_attribute_uint(loc_id, obj_name, ATTR8_NAME, attr_uint_in, (size_t)5) < 0)
return -1;
PASSED();
/*-------------------------------------------------------------------------
- * H5LTget_attribute_int test
- *-------------------------------------------------------------------------
- */
+ * H5LTget_attribute_int test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTget_attribute_uint");
/* Get the attribute */
- if ( H5LTget_attribute_uint( loc_id, obj_name, ATTR8_NAME, attr_uint_out ) < 0 )
+ if (H5LTget_attribute_uint(loc_id, obj_name, ATTR8_NAME, attr_uint_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_uint_in[i] != attr_uint_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_uint_in[i] != attr_uint_out[i]) {
return -1;
}
}
/* Get the attribute */
- if ( H5LTget_attribute( loc_id, obj_name, ATTR8_NAME, H5T_NATIVE_UINT, attr_uint_out ) < 0 )
+ if (H5LTget_attribute(loc_id, obj_name, ATTR8_NAME, H5T_NATIVE_UINT, attr_uint_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_uint_in[i] != attr_uint_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_uint_in[i] != attr_uint_out[i]) {
return -1;
}
}
@@ -884,89 +846,83 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
PASSED();
/*-------------------------------------------------------------------------
- * H5LTset_attribute_ulong test
- *-------------------------------------------------------------------------
- */
+ * H5LTset_attribute_ulong test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTset_attribute_ulong");
/* Set the attribute */
- if ( H5LTset_attribute_ulong( loc_id, obj_name, ATTR9_NAME, attr_ulong_in, (size_t)5 ) < 0 )
+ if (H5LTset_attribute_ulong(loc_id, obj_name, ATTR9_NAME, attr_ulong_in, (size_t)5) < 0)
return -1;
PASSED();
/*-------------------------------------------------------------------------
- * H5LTget_attribute_long test
- *-------------------------------------------------------------------------
- */
+ * H5LTget_attribute_long test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTget_attribute_ulong");
/* Get the attribute */
- if ( H5LTget_attribute_ulong( loc_id, obj_name, ATTR9_NAME, attr_ulong_out ) < 0 )
+ if (H5LTget_attribute_ulong(loc_id, obj_name, ATTR9_NAME, attr_ulong_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_ulong_in[i] != attr_ulong_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_ulong_in[i] != attr_ulong_out[i]) {
return -1;
}
}
/* Get the attribute */
- if ( H5LTget_attribute( loc_id, obj_name, ATTR9_NAME, H5T_NATIVE_ULONG, attr_ulong_out ) < 0 )
+ if (H5LTget_attribute(loc_id, obj_name, ATTR9_NAME, H5T_NATIVE_ULONG, attr_ulong_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if ( attr_ulong_in[i] != attr_ulong_out[i] ) {
+ for (i = 0; i < 5; i++) {
+ if (attr_ulong_in[i] != attr_ulong_out[i]) {
return -1;
}
}
PASSED();
-
/*-------------------------------------------------------------------------
- * H5LTset_attribute_float test
- *-------------------------------------------------------------------------
- */
+ * H5LTset_attribute_float test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTset_attribute_float");
/* Set the attribute */
- if ( H5LTset_attribute_float( loc_id, obj_name, ATTR10_NAME, attr_float_in, (size_t)5 ) < 0 )
+ if (H5LTset_attribute_float(loc_id, obj_name, ATTR10_NAME, attr_float_in, (size_t)5) < 0)
return -1;
PASSED();
/*-------------------------------------------------------------------------
- * H5LTget_attribute_float test
- *-------------------------------------------------------------------------
- */
+ * H5LTget_attribute_float test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTget_attribute_float");
-
/* Get the attribute */
- if ( H5LTget_attribute_float( loc_id, obj_name, ATTR10_NAME, attr_float_out ) < 0 )
+ if (H5LTget_attribute_float(loc_id, obj_name, ATTR10_NAME, attr_float_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if(!H5_FLT_ABS_EQUAL(attr_float_in[i],attr_float_out[i])) {
+ for (i = 0; i < 5; i++) {
+ if (!H5_FLT_ABS_EQUAL(attr_float_in[i], attr_float_out[i])) {
return -1;
}
}
/* Get the attribute */
- if ( H5LTget_attribute( loc_id, obj_name, ATTR10_NAME, H5T_NATIVE_FLOAT, attr_float_out ) < 0 )
+ if (H5LTget_attribute(loc_id, obj_name, ATTR10_NAME, H5T_NATIVE_FLOAT, attr_float_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if(!H5_FLT_ABS_EQUAL(attr_float_in[i],attr_float_out[i])) {
+ for (i = 0; i < 5; i++) {
+ if (!H5_FLT_ABS_EQUAL(attr_float_in[i], attr_float_out[i])) {
return -1;
}
}
@@ -974,93 +930,90 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
PASSED();
/*-------------------------------------------------------------------------
- * H5LTset_attribute_double test
- *-------------------------------------------------------------------------
- */
+ * H5LTset_attribute_double test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTset_attribute_double");
/* Set the attribute */
- if ( H5LTset_attribute_double( loc_id, obj_name, ATTR11_NAME, attr_double_in, (size_t)5 ) < 0 )
+ if (H5LTset_attribute_double(loc_id, obj_name, ATTR11_NAME, attr_double_in, (size_t)5) < 0)
return -1;
PASSED();
/*-------------------------------------------------------------------------
- * H5LTget_attribute_double test
- *-------------------------------------------------------------------------
- */
+ * H5LTget_attribute_double test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTget_attribute_double");
/* Get the attribute */
- if ( H5LTget_attribute_double( loc_id, obj_name, ATTR11_NAME, attr_double_out ) < 0 )
+ if (H5LTget_attribute_double(loc_id, obj_name, ATTR11_NAME, attr_double_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if(!H5_DBL_ABS_EQUAL(attr_double_in[i],attr_double_out[i])) {
+ for (i = 0; i < 5; i++) {
+ if (!H5_DBL_ABS_EQUAL(attr_double_in[i], attr_double_out[i])) {
return -1;
}
}
/* Get the attribute */
- if ( H5LTget_attribute( loc_id, obj_name, ATTR11_NAME, H5T_NATIVE_DOUBLE, attr_double_out ) < 0 )
+ if (H5LTget_attribute(loc_id, obj_name, ATTR11_NAME, H5T_NATIVE_DOUBLE, attr_double_out) < 0)
return -1;
- for (i = 0; i < 5; i++)
- {
- if(!H5_DBL_ABS_EQUAL(attr_double_in[i],attr_double_out[i])) {
+ for (i = 0; i < 5; i++) {
+ if (!H5_DBL_ABS_EQUAL(attr_double_in[i], attr_double_out[i])) {
return -1;
}
}
PASSED();
-
/*-------------------------------------------------------------------------
- * H5LTget_attribute_ndims test
- *-------------------------------------------------------------------------
- */
-
+ * H5LTget_attribute_ndims test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTget_attribute_ndims");
- if ( H5LTget_attribute_ndims( loc_id, obj_name, ATTR2_NAME, &rank_out ) < 0 )
+ if (H5LTget_attribute_ndims(loc_id, obj_name, ATTR2_NAME, &rank_out) < 0)
return -1;
- if ( rank_out != 1 ) {
+ if (rank_out != 1) {
return -1;
}
PASSED();
/*-------------------------------------------------------------------------
- * H5LTget_attribute_info test
- *-------------------------------------------------------------------------
- */
+ * H5LTget_attribute_info test
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("H5LTget_attribute_info");
- if(NULL==(dims_out = (hsize_t*) HDmalloc( sizeof(hsize_t) * (size_t)rank_out ))) return -1;
+ if (NULL == (dims_out = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)rank_out)))
+ return -1;
- if ( H5LTget_attribute_info( loc_id, obj_name, ATTR2_NAME, dims_out, &type_class, &type_size) < 0 ) {
- HDfree( dims_out );
+ if (H5LTget_attribute_info(loc_id, obj_name, ATTR2_NAME, dims_out, &type_class, &type_size) < 0) {
+ HDfree(dims_out);
return -1;
}
for (i = 0; i < rank_out; i++) {
- if ( dims_out[i] != 5 ) {
- HDfree( dims_out );
+ if (dims_out[i] != 5) {
+ HDfree(dims_out);
return -1;
}
}
- if ( type_class != H5T_INTEGER ) {
- HDfree( dims_out );
+ if (type_class != H5T_INTEGER) {
+ HDfree(dims_out);
return -1;
}
- HDfree( dims_out );
+ HDfree(dims_out);
PASSED();
@@ -1068,52 +1021,53 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
}
/*-------------------------------------------------------------------------
-* subroutine for test_text_dtype(): test_integers().
-*-------------------------------------------------------------------------
-*/
-static int test_integers(void)
+ * subroutine for test_text_dtype(): test_integers().
+ *-------------------------------------------------------------------------
+ */
+static int
+test_integers(void)
{
- hid_t dtype;
- char* dt_str;
- size_t str_len;
+ hid_t dtype;
+ char * dt_str;
+ size_t str_len;
HL_TESTING3("\n text for integer types");
- if((dtype = H5LTtext_to_dtype("H5T_NATIVE_INT\n", H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype("H5T_NATIVE_INT\n", H5LT_DDL)) < 0)
goto out;
- if(!H5Tequal(dtype, H5T_NATIVE_INT))
+ if (!H5Tequal(dtype, H5T_NATIVE_INT))
goto out;
- if(H5Tclose(dtype)<0)
+ if (H5Tclose(dtype) < 0)
goto out;
- if((dtype = H5LTtext_to_dtype("H5T_STD_I8BE\n", H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype("H5T_STD_I8BE\n", H5LT_DDL)) < 0)
goto out;
- if(!H5Tequal(dtype, H5T_STD_I8BE))
+ if (!H5Tequal(dtype, H5T_STD_I8BE))
goto out;
- if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
+ if (H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len) < 0)
goto out;
- if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
+ if (NULL == (dt_str = (char *)HDcalloc(str_len, sizeof(char))))
goto out;
- if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) {
+ if (H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len) < 0) {
HDfree(dt_str);
goto out;
}
- if(HDstrcmp(dt_str, "H5T_STD_I8BE")) {
+ if (HDstrcmp(dt_str, "H5T_STD_I8BE")) {
HDfree(dt_str);
goto out;
}
HDfree(dt_str);
- if(H5Tclose(dtype)<0)
+ if (H5Tclose(dtype) < 0)
goto out;
- if((dtype = H5LTtext_to_dtype("H5T_STD_U16LE\n", H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype("H5T_STD_U16LE\n", H5LT_DDL)) < 0)
goto out;
- if(!H5Tequal(dtype, H5T_STD_U16LE))
+ if (!H5Tequal(dtype, H5T_STD_U16LE))
goto out;
- if(H5Tclose(dtype)<0)
+ if (H5Tclose(dtype) < 0)
goto out;
PASSED();
@@ -1125,52 +1079,53 @@ out:
}
/*-------------------------------------------------------------------------
-* subroutine for test_text_dtype(): test_fps().
-*-------------------------------------------------------------------------
-*/
-static int test_fps(void)
+ * subroutine for test_text_dtype(): test_fps().
+ *-------------------------------------------------------------------------
+ */
+static int
+test_fps(void)
{
- hid_t dtype;
- char* dt_str;
- size_t str_len;
+ hid_t dtype;
+ char * dt_str;
+ size_t str_len;
HL_TESTING3(" text for floating-point types");
- if((dtype = H5LTtext_to_dtype("H5T_NATIVE_LDOUBLE\n", H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype("H5T_NATIVE_LDOUBLE\n", H5LT_DDL)) < 0)
goto out;
- if(!H5Tequal(dtype, H5T_NATIVE_LDOUBLE))
+ if (!H5Tequal(dtype, H5T_NATIVE_LDOUBLE))
goto out;
- if(H5Tclose(dtype)<0)
+ if (H5Tclose(dtype) < 0)
goto out;
- if((dtype = H5LTtext_to_dtype("H5T_IEEE_F32BE\n", H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype("H5T_IEEE_F32BE\n", H5LT_DDL)) < 0)
goto out;
- if(!H5Tequal(dtype, H5T_IEEE_F32BE))
+ if (!H5Tequal(dtype, H5T_IEEE_F32BE))
goto out;
- if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
+ if (H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len) < 0)
goto out;
- if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
+ if (NULL == (dt_str = (char *)HDcalloc(str_len, sizeof(char))))
goto out;
- if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) {
+ if (H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len) < 0) {
HDfree(dt_str);
goto out;
}
- if(HDstrcmp(dt_str, "H5T_IEEE_F32BE")) {
+ if (HDstrcmp(dt_str, "H5T_IEEE_F32BE")) {
HDfree(dt_str);
goto out;
}
HDfree(dt_str);
- if(H5Tclose(dtype)<0)
+ if (H5Tclose(dtype) < 0)
goto out;
- if((dtype = H5LTtext_to_dtype("H5T_IEEE_F64LE\n", H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype("H5T_IEEE_F64LE\n", H5LT_DDL)) < 0)
goto out;
- if(!H5Tequal(dtype, H5T_IEEE_F64LE))
+ if (!H5Tequal(dtype, H5T_IEEE_F64LE))
goto out;
- if(H5Tclose(dtype)<0)
+ if (H5Tclose(dtype) < 0)
goto out;
PASSED();
@@ -1182,82 +1137,89 @@ out:
}
/*-------------------------------------------------------------------------
-* subroutine for test_text_dtype(): test_strings().
-*-------------------------------------------------------------------------
-*/
-static int test_strings(void)
+ * subroutine for test_text_dtype(): test_strings().
+ *-------------------------------------------------------------------------
+ */
+static int
+test_strings(void)
{
- hid_t dtype;
- size_t str_size;
+ hid_t dtype;
+ size_t str_size;
H5T_str_t str_pad;
H5T_cset_t str_cset;
H5T_class_t type_class;
- char* dt_str = NULL;
- size_t str_len;
+ char * dt_str = NULL;
+ size_t str_len;
HL_TESTING3(" text for string types");
- if((dtype = H5LTtext_to_dtype("H5T_STRING { STRSIZE 13; STRPAD H5T_STR_NULLTERM; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; }", H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype(
+ "H5T_STRING { STRSIZE 13; STRPAD H5T_STR_NULLTERM; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; }",
+ H5LT_DDL)) < 0)
goto out;
- if((type_class = H5Tget_class(dtype))<0)
+ if ((type_class = H5Tget_class(dtype)) < 0)
goto out;
- if(type_class != H5T_STRING)
+ if (type_class != H5T_STRING)
goto out;
str_size = H5Tget_size(dtype);
- if(str_size != 13)
+ if (str_size != 13)
goto out;
str_pad = H5Tget_strpad(dtype);
- if(str_pad != H5T_STR_NULLTERM)
+ if (str_pad != H5T_STR_NULLTERM)
goto out;
str_cset = H5Tget_cset(dtype);
- if(str_cset != H5T_CSET_ASCII)
+ if (str_cset != H5T_CSET_ASCII)
goto out;
- if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
+ if (H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len) < 0)
goto out;
- if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
+ if (NULL == (dt_str = (char *)HDcalloc(str_len, sizeof(char))))
goto out;
- if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) {
+ if (H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len) < 0) {
HDfree(dt_str);
goto out;
}
- if(HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE 13;\n STRPAD H5T_STR_NULLTERM;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) {
+ if (HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE 13;\n STRPAD H5T_STR_NULLTERM;\n CSET "
+ "H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) {
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
HDfree(dt_str);
- if(H5Tclose(dtype)<0)
+ if (H5Tclose(dtype) < 0)
goto out;
- if((dtype = H5LTtext_to_dtype("H5T_STRING { STRSIZE H5T_VARIABLE; STRPAD H5T_STR_NULLPAD; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; }", H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype("H5T_STRING { STRSIZE H5T_VARIABLE; STRPAD H5T_STR_NULLPAD; CSET "
+ "H5T_CSET_ASCII; CTYPE H5T_C_S1; }",
+ H5LT_DDL)) < 0)
goto out;
- if(!H5Tis_variable_str(dtype))
+ if (!H5Tis_variable_str(dtype))
goto out;
str_pad = H5Tget_strpad(dtype);
- if(str_pad != H5T_STR_NULLPAD)
+ if (str_pad != H5T_STR_NULLPAD)
goto out;
str_cset = H5Tget_cset(dtype);
- if(str_cset != H5T_CSET_ASCII)
+ if (str_cset != H5T_CSET_ASCII)
goto out;
- if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
+ if (H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len) < 0)
goto out;
- if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
+ if (NULL == (dt_str = (char *)HDcalloc(str_len, sizeof(char))))
goto out;
- if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) {
+ if (H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len) < 0) {
HDfree(dt_str);
goto out;
}
- if(HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) {
+ if (HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n "
+ "CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) {
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
@@ -1266,97 +1228,108 @@ static int test_strings(void)
/* Length of the character buffer is larger then needed */
str_len = str_len + 10;
- if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
- goto out;
+ if (NULL == (dt_str = (char *)HDcalloc(str_len, sizeof(char))))
+ goto out;
- if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) {
- HDfree(dt_str);
- goto out;
+ if (H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len) < 0) {
+ HDfree(dt_str);
+ goto out;
}
- if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len-1)) {
- HDprintf("dt=\n%s\n", dt_str);
- HDfree(dt_str);
- goto out;
+ if (HDstrncmp(dt_str,
+ "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET "
+ "H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }",
+ str_len - 1)) {
+ HDprintf("dt=\n%s\n", dt_str);
+ HDfree(dt_str);
+ goto out;
}
HDfree(dt_str);
/* Length of the character buffer is smaller then needed */
str_len = 21;
- if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
- goto out;
+ if (NULL == (dt_str = (char *)HDcalloc(str_len, sizeof(char))))
+ goto out;
- if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) {
- HDfree(dt_str);
- goto out;
+ if (H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len) < 0) {
+ HDfree(dt_str);
+ goto out;
}
/* check the truncated string */
- if(HDstrlen(dt_str) != str_len-1) goto out;
+ if (HDstrlen(dt_str) != str_len - 1)
+ goto out;
str_len = HDstrlen(dt_str);
- if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len)) {
- HDprintf("dt=\n%s\n", dt_str);
- HDfree(dt_str);
- goto out;
+ if (HDstrncmp(dt_str,
+ "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET "
+ "H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }",
+ str_len)) {
+ HDprintf("dt=\n%s\n", dt_str);
+ HDfree(dt_str);
+ goto out;
}
HDfree(dt_str);
- if(H5Tclose(dtype)<0)
+ if (H5Tclose(dtype) < 0)
goto out;
PASSED();
return 0;
out:
- if(dt_str)
- HDfree(dt_str);
+ if (dt_str)
+ HDfree(dt_str);
H5_FAILED();
return -1;
}
/*-------------------------------------------------------------------------
-* subroutine for test_text_dtype(): test_opaques().
-*-------------------------------------------------------------------------
-*/
-static int test_opaques(void)
+ * subroutine for test_text_dtype(): test_opaques().
+ *-------------------------------------------------------------------------
+ */
+static int
+test_opaques(void)
{
- hid_t dtype;
- size_t opq_size;
+ hid_t dtype;
+ size_t opq_size;
H5T_class_t type_class;
- char* dt_str;
- size_t str_len;
+ char * dt_str;
+ size_t str_len;
HL_TESTING3(" text for opaque types");
- if((dtype = H5LTtext_to_dtype("H5T_OPAQUE { OPQ_SIZE 19; OPQ_TAG \"This is a tag for opaque type\"; }", H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype("H5T_OPAQUE { OPQ_SIZE 19; OPQ_TAG \"This is a tag for opaque type\"; }",
+ H5LT_DDL)) < 0)
goto out;
- if((type_class = H5Tget_class(dtype))<0)
+ if ((type_class = H5Tget_class(dtype)) < 0)
goto out;
- if(type_class != H5T_OPAQUE)
+ if (type_class != H5T_OPAQUE)
goto out;
- if((opq_size = H5Tget_size(dtype)) == 0)
+ if ((opq_size = H5Tget_size(dtype)) == 0)
goto out;
- if(opq_size != 19)
+ if (opq_size != 19)
goto out;
- if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
+ if (H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len) < 0)
goto out;
- if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
+ if (NULL == (dt_str = (char *)HDcalloc(str_len, sizeof(char))))
goto out;
- if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) {
+ if (H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len) < 0) {
HDfree(dt_str);
goto out;
}
- if(HDstrcmp(dt_str, "H5T_OPAQUE {\n OPQ_SIZE 19;\n OPQ_TAG \"This is a tag for opaque type\";\n }")) {
+ if (HDstrcmp(
+ dt_str,
+ "H5T_OPAQUE {\n OPQ_SIZE 19;\n OPQ_TAG \"This is a tag for opaque type\";\n }")) {
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
HDfree(dt_str);
- if(H5Tclose(dtype)<0)
+ if (H5Tclose(dtype) < 0)
goto out;
PASSED();
@@ -1368,63 +1341,66 @@ out:
}
/*-------------------------------------------------------------------------
-* subroutine for test_text_dtype(): test_enums().
-*-------------------------------------------------------------------------
-*/
-static int test_enums(void)
+ * subroutine for test_text_dtype(): test_enums().
+ *-------------------------------------------------------------------------
+ */
+static int
+test_enums(void)
{
- hid_t dtype;
- size_t size = 16;
- char name1[16];
- int value1 = 7;
- const char *name2 = "WHITE";
- int value2;
+ hid_t dtype;
+ size_t size = 16;
+ char name1[16];
+ int value1 = 7;
+ const char *name2 = "WHITE";
+ int value2;
H5T_class_t type_class;
- char* dt_str;
- size_t str_len;
+ char * dt_str;
+ size_t str_len;
HL_TESTING3(" text for enum types");
- if((dtype = H5LTtext_to_dtype("H5T_ENUM { H5T_STD_I32LE; \"RED\" 5; \"GREEN\" 6; \"BLUE\" 7; \"WHITE\" 8; }", H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype(
+ "H5T_ENUM { H5T_STD_I32LE; \"RED\" 5; \"GREEN\" 6; \"BLUE\" 7; \"WHITE\" 8; }", H5LT_DDL)) < 0)
goto out;
- if((type_class = H5Tget_class(dtype))<0)
+ if ((type_class = H5Tget_class(dtype)) < 0)
goto out;
- if(type_class != H5T_ENUM)
+ if (type_class != H5T_ENUM)
goto out;
/* Convert the variable before using it */
- if(!H5Tequal(H5T_STD_I32LE, H5T_NATIVE_INT)) {
- if(H5Tconvert(H5T_NATIVE_INT, H5T_STD_I32LE, 1, &value1, NULL, H5P_DEFAULT) < 0)
+ if (!H5Tequal(H5T_STD_I32LE, H5T_NATIVE_INT)) {
+ if (H5Tconvert(H5T_NATIVE_INT, H5T_STD_I32LE, 1, &value1, NULL, H5P_DEFAULT) < 0)
goto out;
}
- if(H5Tenum_nameof(dtype, &value1, name1, size)<0)
+ if (H5Tenum_nameof(dtype, &value1, name1, size) < 0)
goto out;
- if(HDstrcmp(name1, "BLUE"))
+ if (HDstrcmp(name1, "BLUE"))
goto out;
- if(H5Tenum_valueof(dtype, name2, &value2)<0)
+ if (H5Tenum_valueof(dtype, name2, &value2) < 0)
goto out;
/* Convert the variable before comparing it */
- if(!H5Tequal(H5T_STD_I32LE, H5T_NATIVE_INT)) {
- if(H5Tconvert(H5T_NATIVE_INT, H5T_STD_I32LE, 1, &value2, NULL, H5P_DEFAULT) < 0)
+ if (!H5Tequal(H5T_STD_I32LE, H5T_NATIVE_INT)) {
+ if (H5Tconvert(H5T_NATIVE_INT, H5T_STD_I32LE, 1, &value2, NULL, H5P_DEFAULT) < 0)
goto out;
}
- if(value2 != 8)
+ if (value2 != 8)
goto out;
- if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
+ if (H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len) < 0)
goto out;
- if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
+ if (NULL == (dt_str = (char *)HDcalloc(str_len, sizeof(char))))
goto out;
- if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) {
+ if (H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len) < 0) {
HDfree(dt_str);
goto out;
}
- if(HDstrcmp(dt_str, "H5T_ENUM {\n H5T_STD_I32LE;\n \"RED\" 5;\n \"GREEN\" 6;\n \"BLUE\" 7;\n \"WHITE\" 8;\n }")) {
+ if (HDstrcmp(dt_str, "H5T_ENUM {\n H5T_STD_I32LE;\n \"RED\" 5;\n \"GREEN\" "
+ " 6;\n \"BLUE\" 7;\n \"WHITE\" 8;\n }")) {
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
@@ -1433,7 +1409,7 @@ static int test_enums(void)
HDfree(dt_str);
- if(H5Tclose(dtype)<0)
+ if (H5Tclose(dtype) < 0)
goto out;
PASSED();
@@ -1445,54 +1421,55 @@ out:
}
/*-------------------------------------------------------------------------
-* subroutine for test_text_dtype(): test_variables().
-*-------------------------------------------------------------------------
-*/
-static int test_variables(void)
+ * subroutine for test_text_dtype(): test_variables().
+ *-------------------------------------------------------------------------
+ */
+static int
+test_variables(void)
{
- hid_t dtype;
+ hid_t dtype;
H5T_class_t type_class;
- char* dt_str;
- size_t str_len;
+ char * dt_str;
+ size_t str_len;
HL_TESTING3(" text for variable types");
- if((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_NATIVE_CHAR }\n", H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_NATIVE_CHAR }\n", H5LT_DDL)) < 0)
goto out;
- if((type_class = H5Tget_class(dtype))<0)
+ if ((type_class = H5Tget_class(dtype)) < 0)
goto out;
- if(type_class != H5T_VLEN)
+ if (type_class != H5T_VLEN)
goto out;
- if(H5Tis_variable_str(dtype))
+ if (H5Tis_variable_str(dtype))
goto out;
- if(H5Tclose(dtype)<0)
+ if (H5Tclose(dtype) < 0)
goto out;
- if((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_VLEN { H5T_STD_I32BE } }", H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_VLEN { H5T_STD_I32BE } }", H5LT_DDL)) < 0)
goto out;
- if(H5Tis_variable_str(dtype))
+ if (H5Tis_variable_str(dtype))
goto out;
- if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
+ if (H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len) < 0)
goto out;
- if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
+ if (NULL == (dt_str = (char *)HDcalloc(str_len, sizeof(char))))
goto out;
- if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) {
+ if (H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len) < 0) {
HDfree(dt_str);
goto out;
}
- if(HDstrcmp(dt_str, "H5T_VLEN {\n H5T_VLEN {\n H5T_STD_I32BE\n }\n }")) {
+ if (HDstrcmp(dt_str, "H5T_VLEN {\n H5T_VLEN {\n H5T_STD_I32BE\n }\n }")) {
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
HDfree(dt_str);
- if(H5Tclose(dtype)<0)
+ if (H5Tclose(dtype) < 0)
goto out;
PASSED();
@@ -1504,47 +1481,52 @@ out:
}
/*-------------------------------------------------------------------------
-* subroutine for test_text_dtype(): test_arrays().
-*-------------------------------------------------------------------------
-*/
-static int test_arrays(void)
+ * subroutine for test_text_dtype(): test_arrays().
+ *-------------------------------------------------------------------------
+ */
+static int
+test_arrays(void)
{
- hid_t dtype;
- int ndims;
- hsize_t dims[3];
+ hid_t dtype;
+ int ndims;
+ hsize_t dims[3];
H5T_class_t type_class;
- char* dt_str;
- size_t str_len;
+ char * dt_str;
+ size_t str_len;
HL_TESTING3(" text for array types");
- if((dtype = H5LTtext_to_dtype("H5T_ARRAY { [5][7][13] H5T_ARRAY { [17][19] H5T_COMPOUND { H5T_STD_I8BE \"arr_compound_1\"; H5T_STD_I32BE \"arr_compound_2\"; } } }", H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype("H5T_ARRAY { [5][7][13] H5T_ARRAY { [17][19] H5T_COMPOUND { H5T_STD_I8BE "
+ "\"arr_compound_1\"; H5T_STD_I32BE \"arr_compound_2\"; } } }",
+ H5LT_DDL)) < 0)
goto out;
- if((type_class = H5Tget_class(dtype))<0)
+ if ((type_class = H5Tget_class(dtype)) < 0)
goto out;
- if(type_class != H5T_ARRAY)
+ if (type_class != H5T_ARRAY)
goto out;
- if((ndims = H5Tget_array_ndims(dtype))<0)
+ if ((ndims = H5Tget_array_ndims(dtype)) < 0)
goto out;
- if(ndims != 3)
+ if (ndims != 3)
goto out;
- if(H5Tget_array_dims2(dtype, dims) < 0)
+ if (H5Tget_array_dims2(dtype, dims) < 0)
goto out;
- if(dims[0] != 5 || dims[1] != 7 || dims[2] != 13)
+ if (dims[0] != 5 || dims[1] != 7 || dims[2] != 13)
goto out;
- if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
+ if (H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len) < 0)
goto out;
- if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
+ if (NULL == (dt_str = (char *)HDcalloc(str_len, sizeof(char))))
goto out;
- if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) {
+ if (H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len) < 0) {
HDfree(dt_str);
goto out;
}
- if(HDstrcmp(dt_str, "H5T_ARRAY {\n [5][7][13] H5T_ARRAY {\n [17][19] H5T_COMPOUND {\n H5T_STD_I8BE \"arr_compound_1\" : 0;\n H5T_STD_I32BE \"arr_compound_2\" : 1;\n }\n }\n }")) {
+ if (HDstrcmp(dt_str, "H5T_ARRAY {\n [5][7][13] H5T_ARRAY {\n [17][19] H5T_COMPOUND {\n "
+ " H5T_STD_I8BE \"arr_compound_1\" : 0;\n H5T_STD_I32BE "
+ "\"arr_compound_2\" : 1;\n }\n }\n }")) {
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
@@ -1552,7 +1534,7 @@ static int test_arrays(void)
HDfree(dt_str);
- if(H5Tclose(dtype)<0)
+ if (H5Tclose(dtype) < 0)
goto out;
PASSED();
@@ -1564,66 +1546,74 @@ out:
}
/*-------------------------------------------------------------------------
-* subroutine for test_text_dtype(): test_compounds().
-*-------------------------------------------------------------------------
-*/
-static int test_compounds(void)
+ * subroutine for test_text_dtype(): test_compounds().
+ *-------------------------------------------------------------------------
+ */
+static int
+test_compounds(void)
{
- hid_t dtype;
- int nmembs;
- char *memb_name = NULL;
+ hid_t dtype;
+ int nmembs;
+ char * memb_name = NULL;
H5T_class_t memb_class;
H5T_class_t type_class;
- char* dt_str;
- size_t str_len;
+ char * dt_str;
+ size_t str_len;
HL_TESTING3(" text for compound types");
- if((dtype = H5LTtext_to_dtype("H5T_COMPOUND { H5T_STD_I16BE \"one_field\" : 2; H5T_STD_U8LE \"two_field\" : 6; }", H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype(
+ "H5T_COMPOUND { H5T_STD_I16BE \"one_field\" : 2; H5T_STD_U8LE \"two_field\" : 6; }", H5LT_DDL)) <
+ 0)
goto out;
- if((type_class = H5Tget_class(dtype))<0)
+ if ((type_class = H5Tget_class(dtype)) < 0)
goto out;
- if(type_class != H5T_COMPOUND)
+ if (type_class != H5T_COMPOUND)
goto out;
- if((nmembs = H5Tget_nmembers(dtype))<0)
+ if ((nmembs = H5Tget_nmembers(dtype)) < 0)
goto out;
- if(nmembs != 2)
+ if (nmembs != 2)
goto out;
- if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
+ if (H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len) < 0)
goto out;
- if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
+ if (NULL == (dt_str = (char *)HDcalloc(str_len, sizeof(char))))
goto out;
- if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) {
+ if (H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len) < 0) {
HDfree(dt_str);
goto out;
}
- if(HDstrcmp(dt_str, "H5T_COMPOUND {\n H5T_STD_I16BE \"one_field\" : 2;\n H5T_STD_U8LE \"two_field\" : 6;\n }")) {
+ if (HDstrcmp(dt_str, "H5T_COMPOUND {\n H5T_STD_I16BE \"one_field\" : 2;\n H5T_STD_U8LE "
+ "\"two_field\" : 6;\n }")) {
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
HDfree(dt_str);
- if(H5Tclose(dtype)<0)
+ if (H5Tclose(dtype) < 0)
goto out;
- if((dtype = H5LTtext_to_dtype("H5T_COMPOUND { H5T_STD_I32BE \"i32_field\"; H5T_STD_I16BE \"i16_field\"; H5T_COMPOUND { H5T_STD_I16BE \"sec_field\"; H5T_COMPOUND { H5T_STD_I32BE \"thd_field\"; } \"grandchild\"; } \"child_compound\"; H5T_STD_I8BE \"i8_field\"; }", H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype(
+ "H5T_COMPOUND { H5T_STD_I32BE \"i32_field\"; H5T_STD_I16BE \"i16_field\"; H5T_COMPOUND { "
+ "H5T_STD_I16BE \"sec_field\"; H5T_COMPOUND { H5T_STD_I32BE \"thd_field\"; } \"grandchild\"; } "
+ "\"child_compound\"; H5T_STD_I8BE \"i8_field\"; }",
+ H5LT_DDL)) < 0)
goto out;
- if((memb_name = H5Tget_member_name(dtype, 1)) == NULL)
+ if ((memb_name = H5Tget_member_name(dtype, 1)) == NULL)
goto out;
- if(HDstrcmp(memb_name, "i16_field")) {
+ if (HDstrcmp(memb_name, "i16_field")) {
H5free_memory(memb_name);
goto out;
}
H5free_memory(memb_name);
- if((memb_class = H5Tget_member_class(dtype, 2))<0)
+ if ((memb_class = H5Tget_member_class(dtype, 2)) < 0)
goto out;
- if(memb_class != H5T_COMPOUND)
+ if (memb_class != H5T_COMPOUND)
goto out;
PASSED();
@@ -1635,110 +1625,120 @@ out:
}
/*-------------------------------------------------------------------------
-* subroutine for test_text_dtype(): test_compound_bug(). Test case for
-* issue 7701.
-*-------------------------------------------------------------------------
-*/
-static int test_compound_bug(void)
+ * subroutine for test_text_dtype(): test_compound_bug(). Test case for
+ * issue 7701.
+ *-------------------------------------------------------------------------
+ */
+static int
+test_compound_bug(void)
{
hid_t dtype;
H5T_class_t type_class;
int nmembs;
- char* memb_name = NULL;
- char* dt_str;
+ char * memb_name = NULL;
+ char * dt_str;
size_t str_len;
- char text[] = "H5T_COMPOUND { H5T_STD_I32LE \"state_________________________________________________________________________________\"; H5T_STD_I32LE \"desc_________________________________________________________________________________________\"; H5T_VLEN { H5T_COMPOUND { H5T_ENUM { H5T_STD_I16LE; \"ZERO\" 0; \"ONE\" 1; \"TWO\" 2; \"THREE\" 3; } \"type____\"; H5T_STD_I32LE \"sub_______________________________________________________________________________________________________________\"; H5T_STRING { STRSIZE H5T_VARIABLE; STRPAD H5T_STR_SPACEPAD; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; } \"sub_desc\"; H5T_STD_I32LE \"final___________________________________________________________________________________________________\"; } } \"sub\"; }";
- char text2[] =
- "H5T_COMPOUND {\n"
- " H5T_STD_I16LE \"state___________________________"
- "__________________________________________________"
- "____\" : 0;\n"
- " H5T_STD_I16LE \"desc____________________________"
- "__________________________________________________"
- "___________\" : 2;\n"
- " H5T_VLEN { H5T_COMPOUND {\n"
- " H5T_ENUM { H5T_STD_I16LE; \"ZERO\" 0; \"ONE\" "
- "1; \"TWO\" 2; \"THREE\" 3; } \"type____\" : 0;\n"
- " H5T_STD_I32LE \"sub___________________________"
- "__________________________________________________"
- "__________________________________1\" : 4;\n"
- " H5T_STRING { STRSIZE H5T_VARIABLE; STRPAD H5T_"
- "STR_SPACEPAD; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1;"
- " } \"sub_desc\" : 8;\n"
- " H5T_STD_I32LE \"final_________________________"
- "__________________________________________________"
- "________________________\" : 16;\n"
- " } } \"sub\" : 8;\n"
- "}\n";
+ char text[] = "H5T_COMPOUND { H5T_STD_I32LE "
+ "\"state_________________________________________________________________________________"
+ "\"; H5T_STD_I32LE "
+ "\"desc____________________________________________________________________________________"
+ "_____\"; H5T_VLEN { H5T_COMPOUND { H5T_ENUM { H5T_STD_I16LE; \"ZERO\" 0; \"ONE\" 1; "
+ "\"TWO\" 2; \"THREE\" 3; } \"type____\"; H5T_STD_I32LE "
+ "\"sub_____________________________________________________________________________________"
+ "__________________________\"; H5T_STRING { STRSIZE H5T_VARIABLE; STRPAD H5T_STR_SPACEPAD; "
+ "CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; } \"sub_desc\"; H5T_STD_I32LE "
+ "\"final___________________________________________________________________________________"
+ "________________\"; } } \"sub\"; }";
+ char text2[] = "H5T_COMPOUND {\n"
+ " H5T_STD_I16LE \"state___________________________"
+ "__________________________________________________"
+ "____\" : 0;\n"
+ " H5T_STD_I16LE \"desc____________________________"
+ "__________________________________________________"
+ "___________\" : 2;\n"
+ " H5T_VLEN { H5T_COMPOUND {\n"
+ " H5T_ENUM { H5T_STD_I16LE; \"ZERO\" 0; \"ONE\" "
+ "1; \"TWO\" 2; \"THREE\" 3; } \"type____\" : 0;\n"
+ " H5T_STD_I32LE \"sub___________________________"
+ "__________________________________________________"
+ "__________________________________1\" : 4;\n"
+ " H5T_STRING { STRSIZE H5T_VARIABLE; STRPAD H5T_"
+ "STR_SPACEPAD; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1;"
+ " } \"sub_desc\" : 8;\n"
+ " H5T_STD_I32LE \"final_________________________"
+ "__________________________________________________"
+ "________________________\" : 16;\n"
+ " } } \"sub\" : 8;\n"
+ "}\n";
HL_TESTING3(" text for compound type of bug fix");
- if((dtype = H5LTtext_to_dtype(text, H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype(text, H5LT_DDL)) < 0)
goto out;
- if((type_class = H5Tget_class(dtype))<0)
+ if ((type_class = H5Tget_class(dtype)) < 0)
goto out;
- if(type_class != H5T_COMPOUND)
+ if (type_class != H5T_COMPOUND)
goto out;
- if((memb_name = H5Tget_member_name(dtype, 2)) == NULL)
+ if ((memb_name = H5Tget_member_name(dtype, 2)) == NULL)
goto out;
- if(HDstrcmp(memb_name, "sub")) {
+ if (HDstrcmp(memb_name, "sub")) {
H5free_memory(memb_name);
goto out;
}
H5free_memory(memb_name);
- if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
+ if (H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len) < 0)
goto out;
- if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
+ if (NULL == (dt_str = (char *)HDcalloc(str_len, sizeof(char))))
goto out;
- if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) {
+ if (H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len) < 0) {
HDfree(dt_str);
goto out;
}
HDfree(dt_str);
- if(H5Tclose(dtype)<0)
+ if (H5Tclose(dtype) < 0)
goto out;
-
/* Test similar datatype in another format */
- if((dtype = H5LTtext_to_dtype(text2, H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype(text2, H5LT_DDL)) < 0)
goto out;
- if((type_class = H5Tget_class(dtype))<0)
+ if ((type_class = H5Tget_class(dtype)) < 0)
goto out;
- if(type_class != H5T_COMPOUND)
+ if (type_class != H5T_COMPOUND)
goto out;
- if((nmembs = H5Tget_nmembers(dtype))<0)
+ if ((nmembs = H5Tget_nmembers(dtype)) < 0)
goto out;
- if(nmembs != 3)
+ if (nmembs != 3)
goto out;
- if((memb_name = H5Tget_member_name(dtype, 1)) == NULL)
+ if ((memb_name = H5Tget_member_name(dtype, 1)) == NULL)
goto out;
- if(HDstrcmp(memb_name, "desc_________________________________________________________________________________________")) {
+ if (HDstrcmp(memb_name, "desc____________________________________________________________________________"
+ "_____________")) {
H5free_memory(memb_name);
goto out;
}
H5free_memory(memb_name);
- if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
+ if (H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len) < 0)
goto out;
- if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
+ if (NULL == (dt_str = (char *)HDcalloc(str_len, sizeof(char))))
goto out;
- if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) {
+ if (H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len) < 0) {
HDfree(dt_str);
goto out;
}
HDfree(dt_str);
- if(H5Tclose(dtype)<0)
+ if (H5Tclose(dtype) < 0)
goto out;
PASSED();
@@ -1750,66 +1750,67 @@ out:
}
/*-------------------------------------------------------------------------
-* subroutine for test_text_dtype(): test_complicated_compound().
-*-------------------------------------------------------------------------
-*/
-static int test_complicated_compound(void)
+ * subroutine for test_text_dtype(): test_complicated_compound().
+ *-------------------------------------------------------------------------
+ */
+static int
+test_complicated_compound(void)
{
- hid_t dtype;
- int nmembs;
+ hid_t dtype;
+ int nmembs;
H5T_class_t type_class;
- char *line = NULL;
- FILE *fp = NULL;
- size_t size = 1024;
+ char * line = NULL;
+ FILE * fp = NULL;
+ size_t size = 1024;
const char *filename = H5_get_srcdir_filename(INPUT_FILE);
HL_TESTING3(" text for complicated compound types");
/* Open input file */
fp = HDfopen(filename, "r");
- if(fp == NULL) {
- HDprintf( "Could not find file %s. Try set $srcdir \n", filename);
+ if (fp == NULL) {
+ HDprintf("Could not find file %s. Try set $srcdir \n", filename);
goto out;
}
/* This part reads in the input as a string in a slow manner. GNU C
- * Library has convenient function getline() but isn't available on
- * all machines.
- */
- if((line = (char*)HDcalloc(size, sizeof(char)))==NULL)
+ * Library has convenient function getline() but isn't available on
+ * all machines.
+ */
+ if ((line = (char *)HDcalloc(size, sizeof(char))) == NULL)
goto out;
- if(HDfgets(line, (int)size, fp)==NULL)
+ if (HDfgets(line, (int)size, fp) == NULL)
goto out;
- while(HDstrlen(line)==size-1) {
+ while (HDstrlen(line) == size - 1) {
size *= 2;
- if(line)
+ if (line)
HDfree(line);
- if((line = (char*)HDcalloc(size, sizeof(char)))==NULL)
+ if ((line = (char *)HDcalloc(size, sizeof(char))) == NULL)
goto out;
- if(HDfseek(fp, 0L, SEEK_SET)!=0)
+ if (HDfseek(fp, 0L, SEEK_SET) != 0)
goto out;
- if(HDfgets(line, (int)size, fp)==NULL)
+ if (HDfgets(line, (int)size, fp) == NULL)
goto out;
}
HDfclose(fp);
fp = NULL;
- if((dtype = H5LTtext_to_dtype(line, H5LT_DDL))<0)
+ if ((dtype = H5LTtext_to_dtype(line, H5LT_DDL)) < 0)
goto out;
- if((type_class = H5Tget_class(dtype))<0)
+ if ((type_class = H5Tget_class(dtype)) < 0)
goto out;
- if(type_class != H5T_COMPOUND)
+ if (type_class != H5T_COMPOUND)
goto out;
/* There should be 101 compound members */
- if((nmembs = H5Tget_nmembers(dtype))<0)
+ if ((nmembs = H5Tget_nmembers(dtype)) < 0)
goto out;
- if(nmembs != 101)
+ if (nmembs != 101)
goto out;
- if(line)
+ if (line)
HDfree(line);
PASSED();
@@ -1817,9 +1818,9 @@ static int test_complicated_compound(void)
out:
- if(line)
+ if (line)
HDfree(line);
- if(fp)
+ if (fp)
HDfclose(fp);
H5_FAILED();
@@ -1827,41 +1828,42 @@ out:
}
/*-------------------------------------------------------------------------
-* test H5LTtext_to_dtype function
-*-------------------------------------------------------------------------
-*/
-static int test_text_dtype(void)
+ * test H5LTtext_to_dtype function
+ *-------------------------------------------------------------------------
+ */
+static int
+test_text_dtype(void)
{
HL_TESTING2("H5LTtext_to_dtype");
- if(test_integers()<0)
+ if (test_integers() < 0)
goto out;
- if(test_fps()<0)
+ if (test_fps() < 0)
goto out;
- if(test_strings()<0)
+ if (test_strings() < 0)
goto out;
- if(test_opaques()<0)
+ if (test_opaques() < 0)
goto out;
- if(test_enums()<0)
+ if (test_enums() < 0)
goto out;
- if(test_variables()<0)
+ if (test_variables() < 0)
goto out;
- if(test_arrays()<0)
+ if (test_arrays() < 0)
goto out;
- if(test_compounds()<0)
+ if (test_compounds() < 0)
goto out;
- if(test_compound_bug()<0)
+ if (test_compound_bug() < 0)
goto out;
- if(test_complicated_compound()<0)
+ if (test_complicated_compound() < 0)
goto out;
return 0;
@@ -1874,362 +1876,364 @@ out:
* test H5LTpath_valid function
*-------------------------------------------------------------------------
*/
-static int test_valid_path(void)
+static int
+test_valid_path(void)
{
- hid_t file_id, group;
- htri_t path_valid;
- const char *data_string_in = "test";
-
- HL_TESTING2("H5LTpath_valid");
-
- /* Create a new file using default properties. */
-
- /**************************************************************
- * The file structure should look like this:
- *
- * +----------------------------------+
- * | / |
- * +----------------------------------+
- * / | \ \
- * / | \ \
- * / | \ \
- * / | \ G8 (dangled external link)
- * / DS \
- * / \
- * G1 G2
- * | --> DS1 |
- * / \--> DS3 / \
- * / / \
- * G2 DS4 G7
- * | (hard link (dangled soft link
- * | to /G1/DS3) to /G1/G20 )
- * |
- * |
- * | --- Gcyc (soft link to /G1)
- * / \
- * / \
- * G5 \
- * (soft link G6 (external link /G1 in FILENAME4)
- * to /G2)
- *
- ****************************************************************/
-
- file_id = H5Fcreate(FILE_NAME3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
- /*
- * Create dataset "/DS"
- */
- if(H5LTmake_dataset_string(file_id, "DS", data_string_in)<0)
- goto out;
-
- /*
- * Create an external dangled link
- */
- if(H5Lcreate_external("NonExistant_File.h5", "G8", file_id, "DangledExternalLink", H5P_DEFAULT, H5P_DEFAULT)<0)
- goto out;
-
- /*
- * Create a group named "G2" in the file.
- */
- if((group = H5Gcreate2(file_id, "G2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT))<0)
- goto out;
-
- /*
- * Create a dataset named "G2/DS4" in the file.
- */
- if(H5LTmake_dataset_string(group, "/G2/DS4", data_string_in)<0)
- goto out;
-
- /*
- * Create a soft link
- */
- if(H5Lcreate_soft("/G1/G20", file_id, "/G2/G7", H5P_DEFAULT, H5P_DEFAULT) <0)
- goto out;
-
- if(H5Gclose(group)<0)
- goto out;
-
- /*
- * Create a group named "G1" in the file.
- */
- if((group = H5Gcreate2(file_id, "G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT))<0)
- goto out;
-
- /*
- * Create a group named "G1/DS1" in the file.
- */
- if(H5LTmake_dataset_string(group, "/G1/DS1", data_string_in)<0)
- goto out;
-
- if(H5Gclose(group)<0)
- goto out;
-
- /*
- * Create a hard link
- */
- if(H5Lcreate_hard(file_id, "/G2/DS4", file_id, "/G1/DS3",H5P_DEFAULT, H5P_DEFAULT)<0)
- goto out;
- /*
- * Create a group named "/G1/G2" in the file.
- */
- if((group = H5Gcreate2(file_id, "/G1/G2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT))<0)
- goto out;
-
- /*
- * Create a soft link
- */
- if(H5Lcreate_soft("/G2", file_id, "/G1/G2/G5", H5P_DEFAULT, H5P_DEFAULT)<0)
- goto out;
-
- /*
- * Create a cyclic soft link
- */
- if(H5Lcreate_soft("/G1", file_id, "/G1/G2/Gcyc", H5P_DEFAULT, H5P_DEFAULT)<0)
- goto out;
-
- if(H5Gclose(group)<0)
- goto out;
-
- /*
- * Create a group named "/G1/G2/G6" in the file.
- */
- if((group = H5Gcreate2(file_id, "/G1/G2/G6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT))<0)
- goto out;
-
- /*
- * Create an external link
- */
- if(H5Lcreate_external( FILE_NAME4, "G1", group, "ExternalLink", H5P_DEFAULT, H5P_DEFAULT)<0)
- goto out;
-
- if(H5Gclose(group)<0)
- goto out;
- /*
- * Close the file.
- */
- if(H5Fclose (file_id) < 0)
- goto out;
-
- /* Create another file for checking external links */
-
- /**************************************************************
- * The file structure should look like this:
- *
- * +----+
- * | / |
- * +----+
- * |
- * |
- * |
- * G1
- * / \
- * / \
- * DS1 G2
- * (dangled soft link to /G1/G20)
- *
- ****************************************************************/
-
- /* Make external link file */
- file_id = H5Fcreate(FILE_NAME4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
- /*
- * Create a group named "G1" in the file.
- */
- if((group = H5Gcreate2(file_id, "G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT))<0)
- goto out;
- /*
- * Create a dataset named "G1/DS1" in the file.
- */
- if(H5LTmake_dataset_string(group, "/G1/DS1", data_string_in)<0)
- goto out;
-
- /*
- * Create a dangling soft link
- */
-
- if(H5Lcreate_soft("/G1/G2", file_id, "/G1/G20", H5P_DEFAULT, H5P_DEFAULT)<0)
- goto out;
-
- if(H5Gclose(group)<0)
- goto out;
-
- H5Fclose(file_id);
-
- /* Open input file */
- if((file_id = H5Fopen(FILE_NAME3,H5F_ACC_RDONLY, H5P_DEFAULT))<0)
- goto out;
-
- /**************************************
- * CHECK ABSOLUTE PATHS
- **************************************/
-
- if( (path_valid = H5LTpath_valid(file_id, "/", TRUE)) != TRUE) {
- goto out;
- }
-
- if( (path_valid = H5LTpath_valid(file_id, "/", FALSE)) != TRUE) {
- goto out;
- }
-
- if( (path_valid = H5LTpath_valid(file_id, "/G1", TRUE)) != TRUE) {
- goto out;
- }
-
- if((path_valid = H5LTpath_valid(file_id, "/G1/DS1", TRUE)) != TRUE)
- goto out;
-
- if( (path_valid = H5LTpath_valid(file_id, "/G1/DS3", TRUE)) != TRUE)
- goto out;
-
- if( (path_valid = H5LTpath_valid(file_id, "/G1/G2", TRUE)) != TRUE)
- goto out;
-
- if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G5", TRUE)) != TRUE)
- goto out;
+ hid_t file_id, group;
+ htri_t path_valid;
+ const char *data_string_in = "test";
- if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", FALSE)) != TRUE)
- goto out;
+ HL_TESTING2("H5LTpath_valid");
- if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", TRUE)) != TRUE)
- goto out;
+ /* Create a new file using default properties. */
- if( (path_valid = H5LTpath_valid(file_id, "/G2", TRUE)) != TRUE)
- goto out;
+ /**************************************************************
+ * The file structure should look like this:
+ *
+ * +----------------------------------+
+ * | / |
+ * +----------------------------------+
+ * / | \ \
+ * / | \ \
+ * / | \ \
+ * / | \ G8 (dangled external link)
+ * / DS \
+ * / \
+ * G1 G2
+ * | --> DS1 |
+ * / \--> DS3 / \
+ * / / \
+ * G2 DS4 G7
+ * | (hard link (dangled soft link
+ * | to /G1/DS3) to /G1/G20 )
+ * |
+ * |
+ * | --- Gcyc (soft link to /G1)
+ * / \
+ * / \
+ * G5 \
+ * (soft link G6 (external link /G1 in FILENAME4)
+ * to /G2)
+ *
+ ****************************************************************/
- /* check soft link points to a valid object*/
- if( (path_valid = H5LTpath_valid(file_id, "/G2/DS4", TRUE)) != TRUE)
- goto out;
+ file_id = H5Fcreate(FILE_NAME3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- /* check if path exist, but not the object */
- if( (path_valid = H5LTpath_valid(file_id, "/G2/G7", FALSE)) != TRUE )
- goto out;
- /* check if path exist and if the object exists. It should fail
- * since it is a dangling soft link
- */
- if( (path_valid = H5LTpath_valid(file_id, "/G2/G7", TRUE)) == TRUE)
- goto out;
+ /*
+ * Create dataset "/DS"
+ */
+ if (H5LTmake_dataset_string(file_id, "DS", data_string_in) < 0)
+ goto out;
- /* check soft links */
- if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G5/DS4", TRUE)) != TRUE)
- goto out;
+ /*
+ * Create an external dangled link
+ */
+ if (H5Lcreate_external("NonExistant_File.h5", "G8", file_id, "DangledExternalLink", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ goto out;
- /**************************************
- * CHECK RELATIVE PATHS
- ***************************************/
+ /*
+ * Create a group named "G2" in the file.
+ */
+ if ((group = H5Gcreate2(file_id, "G2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
- if( (group = H5Gopen2(file_id, "/", H5P_DEFAULT)) < 0)
- goto out;
+ /*
+ * Create a dataset named "G2/DS4" in the file.
+ */
+ if (H5LTmake_dataset_string(group, "/G2/DS4", data_string_in) < 0)
+ goto out;
- if( (path_valid = H5LTpath_valid(group, "/", TRUE)) != TRUE) {
- goto out;
- }
+ /*
+ * Create a soft link
+ */
+ if (H5Lcreate_soft("/G1/G20", file_id, "/G2/G7", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto out;
- if( (path_valid = H5LTpath_valid(group, "/", FALSE)) != TRUE) {
- goto out;
- }
+ if (H5Gclose(group) < 0)
+ goto out;
- if(H5Gclose(group)<0)
- goto out;
+ /*
+ * Create a group named "G1" in the file.
+ */
+ if ((group = H5Gcreate2(file_id, "G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
- if( (group = H5Gopen2(file_id, "/G1", H5P_DEFAULT)) < 0)
- goto out;
+ /*
+ * Create a group named "G1/DS1" in the file.
+ */
+ if (H5LTmake_dataset_string(group, "/G1/DS1", data_string_in) < 0)
+ goto out;
- /* The identifier (file id) is the object itself, i.e. "." */
+ if (H5Gclose(group) < 0)
+ goto out;
- if((path_valid = H5LTpath_valid(file_id, ".", FALSE)) != TRUE)
- goto out;
+ /*
+ * Create a hard link
+ */
+ if (H5Lcreate_hard(file_id, "/G2/DS4", file_id, "/G1/DS3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto out;
+ /*
+ * Create a group named "/G1/G2" in the file.
+ */
+ if ((group = H5Gcreate2(file_id, "/G1/G2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
- if( (path_valid = H5LTpath_valid(file_id, ".", TRUE)) != TRUE)
- goto out;
+ /*
+ * Create a soft link
+ */
+ if (H5Lcreate_soft("/G2", file_id, "/G1/G2/G5", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto out;
- /* The identifier (group id) is the object itself, i.e. "." */
+ /*
+ * Create a cyclic soft link
+ */
+ if (H5Lcreate_soft("/G1", file_id, "/G1/G2/Gcyc", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto out;
+
+ if (H5Gclose(group) < 0)
+ goto out;
+
+ /*
+ * Create a group named "/G1/G2/G6" in the file.
+ */
+ if ((group = H5Gcreate2(file_id, "/G1/G2/G6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /*
+ * Create an external link
+ */
+ if (H5Lcreate_external(FILE_NAME4, "G1", group, "ExternalLink", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto out;
+
+ if (H5Gclose(group) < 0)
+ goto out;
+ /*
+ * Close the file.
+ */
+ if (H5Fclose(file_id) < 0)
+ goto out;
+
+ /* Create another file for checking external links */
+
+ /**************************************************************
+ * The file structure should look like this:
+ *
+ * +----+
+ * | / |
+ * +----+
+ * |
+ * |
+ * |
+ * G1
+ * / \
+ * / \
+ * DS1 G2
+ * (dangled soft link to /G1/G20)
+ *
+ ****************************************************************/
+
+ /* Make external link file */
+ file_id = H5Fcreate(FILE_NAME4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create a group named "G1" in the file.
+ */
+ if ((group = H5Gcreate2(file_id, "G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ /*
+ * Create a dataset named "G1/DS1" in the file.
+ */
+ if (H5LTmake_dataset_string(group, "/G1/DS1", data_string_in) < 0)
+ goto out;
+
+ /*
+ * Create a dangling soft link
+ */
+
+ if (H5Lcreate_soft("/G1/G2", file_id, "/G1/G20", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto out;
+
+ if (H5Gclose(group) < 0)
+ goto out;
+
+ H5Fclose(file_id);
+
+ /* Open input file */
+ if ((file_id = H5Fopen(FILE_NAME3, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /**************************************
+ * CHECK ABSOLUTE PATHS
+ **************************************/
+
+ if ((path_valid = H5LTpath_valid(file_id, "/", TRUE)) != TRUE) {
+ goto out;
+ }
+
+ if ((path_valid = H5LTpath_valid(file_id, "/", FALSE)) != TRUE) {
+ goto out;
+ }
+
+ if ((path_valid = H5LTpath_valid(file_id, "/G1", TRUE)) != TRUE) {
+ goto out;
+ }
+
+ if ((path_valid = H5LTpath_valid(file_id, "/G1/DS1", TRUE)) != TRUE)
+ goto out;
+
+ if ((path_valid = H5LTpath_valid(file_id, "/G1/DS3", TRUE)) != TRUE)
+ goto out;
+
+ if ((path_valid = H5LTpath_valid(file_id, "/G1/G2", TRUE)) != TRUE)
+ goto out;
+
+ if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G5", TRUE)) != TRUE)
+ goto out;
+
+ if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", FALSE)) != TRUE)
+ goto out;
+
+ if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", TRUE)) != TRUE)
+ goto out;
+
+ if ((path_valid = H5LTpath_valid(file_id, "/G2", TRUE)) != TRUE)
+ goto out;
+
+ /* check soft link points to a valid object*/
+ if ((path_valid = H5LTpath_valid(file_id, "/G2/DS4", TRUE)) != TRUE)
+ goto out;
- if( (path_valid = H5LTpath_valid(group, ".", TRUE)) != TRUE)
- goto out;
+ /* check if path exist, but not the object */
+ if ((path_valid = H5LTpath_valid(file_id, "/G2/G7", FALSE)) != TRUE)
+ goto out;
+ /* check if path exist and if the object exists. It should fail
+ * since it is a dangling soft link
+ */
+ if ((path_valid = H5LTpath_valid(file_id, "/G2/G7", TRUE)) == TRUE)
+ goto out;
- if( (path_valid = H5LTpath_valid(group, "DS3", FALSE)) != TRUE)
- goto out;
+ /* check soft links */
+ if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G5/DS4", TRUE)) != TRUE)
+ goto out;
- if( (path_valid = H5LTpath_valid(group, "DS3", TRUE)) != TRUE)
- goto out;
+ /**************************************
+ * CHECK RELATIVE PATHS
+ ***************************************/
- if( (path_valid = H5LTpath_valid(group, "G2/G5", TRUE)) != TRUE)
- goto out;
+ if ((group = H5Gopen2(file_id, "/", H5P_DEFAULT)) < 0)
+ goto out;
- /* Check the "./" case */
- if( (path_valid = H5LTpath_valid(group, "./DS3", TRUE)) != TRUE)
- goto out;
+ if ((path_valid = H5LTpath_valid(group, "/", TRUE)) != TRUE) {
+ goto out;
+ }
- if( (path_valid = H5LTpath_valid(group, "./G2/G5", TRUE)) != TRUE)
- goto out;
+ if ((path_valid = H5LTpath_valid(group, "/", FALSE)) != TRUE) {
+ goto out;
+ }
+
+ if (H5Gclose(group) < 0)
+ goto out;
- /* Should fail, does not exist */
- if( (path_valid = H5LTpath_valid(group, "./G2/G20", FALSE)) == TRUE)
- goto out;
+ if ((group = H5Gopen2(file_id, "/G1", H5P_DEFAULT)) < 0)
+ goto out;
- /* Should fail, does not exist */
- if( (path_valid = H5LTpath_valid(group, "./G2/G20", TRUE)) == TRUE)
- goto out;
+ /* The identifier (file id) is the object itself, i.e. "." */
- if(H5Gclose(group)<0)
- goto out;
+ if ((path_valid = H5LTpath_valid(file_id, ".", FALSE)) != TRUE)
+ goto out;
- /*****************************
- * Check external links
- *****************************/
+ if ((path_valid = H5LTpath_valid(file_id, ".", TRUE)) != TRUE)
+ goto out;
- /* The dangled external link path is valid */
- if( (path_valid = H5LTpath_valid(file_id, "/DangledExternalLink", FALSE)) != TRUE)
- goto out;
+ /* The identifier (group id) is the object itself, i.e. "." */
- /* The file however does not exists, so the link dangles -> should return false */
- if( (path_valid = H5LTpath_valid(file_id, "/DangledExternalLink", TRUE)) == TRUE)
- goto out;
+ if ((path_valid = H5LTpath_valid(group, ".", TRUE)) != TRUE)
+ goto out;
- if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", FALSE)) != TRUE)
- goto out;
+ if ((path_valid = H5LTpath_valid(group, "DS3", FALSE)) != TRUE)
+ goto out;
- if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", TRUE)) != TRUE)
- goto out;
+ if ((path_valid = H5LTpath_valid(group, "DS3", TRUE)) != TRUE)
+ goto out;
- if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/DS1", TRUE)) != TRUE)
- goto out;
+ if ((path_valid = H5LTpath_valid(group, "G2/G5", TRUE)) != TRUE)
+ goto out;
- if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/G20", FALSE)) != TRUE)
- goto out;
+ /* Check the "./" case */
+ if ((path_valid = H5LTpath_valid(group, "./DS3", TRUE)) != TRUE)
+ goto out;
- if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/DS1", TRUE)) != TRUE)
- goto out;
+ if ((path_valid = H5LTpath_valid(group, "./G2/G5", TRUE)) != TRUE)
+ goto out;
- if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/G20", FALSE)) != TRUE)
- goto out;
+ /* Should fail, does not exist */
+ if ((path_valid = H5LTpath_valid(group, "./G2/G20", FALSE)) == TRUE)
+ goto out;
- /* Should fail, does not exist */
- if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/G20", TRUE)) == TRUE)
- goto out;
+ /* Should fail, does not exist */
+ if ((path_valid = H5LTpath_valid(group, "./G2/G20", TRUE)) == TRUE)
+ goto out;
- if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/G20", TRUE)) == TRUE)
- goto out;
+ if (H5Gclose(group) < 0)
+ goto out;
+ /*****************************
+ * Check external links
+ *****************************/
- if(H5Fclose(file_id)<0)
- goto out;
+ /* The dangled external link path is valid */
+ if ((path_valid = H5LTpath_valid(file_id, "/DangledExternalLink", FALSE)) != TRUE)
+ goto out;
- PASSED();
- return 0;
+ /* The file however does not exists, so the link dangles -> should return false */
+ if ((path_valid = H5LTpath_valid(file_id, "/DangledExternalLink", TRUE)) == TRUE)
+ goto out;
- out:
- H5_FAILED();
- return -1;
+ if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", FALSE)) != TRUE)
+ goto out;
+
+ if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", TRUE)) != TRUE)
+ goto out;
+
+ if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/DS1", TRUE)) != TRUE)
+ goto out;
+
+ if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/G20", FALSE)) != TRUE)
+ goto out;
+
+ if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/DS1", TRUE)) != TRUE)
+ goto out;
+
+ if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/G20", FALSE)) != TRUE)
+ goto out;
+
+ /* Should fail, does not exist */
+ if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/G20", TRUE)) == TRUE)
+ goto out;
+
+ if ((path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/G2/G6/ExternalLink/G20", TRUE)) == TRUE)
+ goto out;
+
+ if (H5Fclose(file_id) < 0)
+ goto out;
+
+ PASSED();
+ return 0;
+
+out:
+ H5_FAILED();
+ return -1;
}
/*-------------------------------------------------------------------------
-* the main program
-*-------------------------------------------------------------------------
-*/
-int main( void )
+ * the main program
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
{
- int nerrors=0;
+ int nerrors = 0;
/* test dataset functions */
nerrors += test_dsets();
diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c
index eb28e3d..1224f0f 100644
--- a/hl/test/test_packet.c
+++ b/hl/test/test_packet.c
@@ -21,41 +21,34 @@
*-------------------------------------------------------------------------
*/
-#define NRECORDS 8
-#define BIG_TABLE_SIZE 8000
-#define NFIELDS 5
-#define TEST_FILE_NAME "test_packet_table.h5"
+#define NRECORDS 8
+#define BIG_TABLE_SIZE 8000
+#define NFIELDS 5
+#define TEST_FILE_NAME "test_packet_table.h5"
#define TEST_COMPRESS_FILE "test_packet_compress.h5"
-#define PT_NAME "Test Packet Table"
-#define H5TB_TABLE_NAME "Table1"
+#define PT_NAME "Test Packet Table"
+#define H5TB_TABLE_NAME "Table1"
/*-------------------------------------------------------------------------
* structure used for some tests, a particle
*-------------------------------------------------------------------------
*/
-typedef struct particle_t
-{
- char name[16];
- int lati;
- int longi;
- float pressure;
- double temperature;
+typedef struct particle_t {
+ char name[16];
+ int lati;
+ int longi;
+ float pressure;
+ double temperature;
} particle_t;
/*-------------------------------------------------------------------------
* a static array of particles for writing and checking reads
*-------------------------------------------------------------------------
*/
-static particle_t testPart[NRECORDS] = {
- {"zero", 0,0, 0.0f, 0.0f},
- {"one", 10,10, 1.0f, 10.0f},
- {"two", 20,20, 2.0f, 20.0f},
- {"three",30,30, 3.0f, 30.0f},
- {"four", 40,40, 4.0f, 40.0f},
- {"five", 50,50, 5.0f, 50.0f},
- {"six", 60,60, 6.0f, 60.0f},
- {"seven",70,70, 7.0f, 70.0f}
- };
+static particle_t testPart[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0f}, {"one", 10, 10, 1.0f, 10.0f},
+ {"two", 20, 20, 2.0f, 20.0f}, {"three", 30, 30, 3.0f, 30.0f},
+ {"four", 40, 40, 4.0f, 40.0f}, {"five", 50, 50, 5.0f, 50.0f},
+ {"six", 60, 60, 6.0f, 60.0f}, {"seven", 70, 70, 7.0f, 70.0f}};
/*-------------------------------------------------------------------------
* function that compares one particle
@@ -63,16 +56,15 @@ static particle_t testPart[NRECORDS] = {
* fields verbatim and not lose any bits. -JML
*-------------------------------------------------------------------------
*/
-static int cmp_par(size_t i, size_t j, particle_t *rbuf, particle_t *wbuf )
+static int
+cmp_par(size_t i, size_t j, particle_t *rbuf, particle_t *wbuf)
{
- if ( ( HDstrcmp( rbuf[i].name, wbuf[j].name ) != 0 ) ||
- rbuf[i].lati != wbuf[j].lati ||
- rbuf[i].longi != wbuf[j].longi ||
- !H5_FLT_ABS_EQUAL(rbuf[i].pressure,wbuf[j].pressure) ||
- !H5_DBL_ABS_EQUAL(rbuf[i].temperature,wbuf[j].temperature) ) {
- return FAIL;
- }
- return SUCCEED;
+ if ((HDstrcmp(rbuf[i].name, wbuf[j].name) != 0) || rbuf[i].lati != wbuf[j].lati ||
+ rbuf[i].longi != wbuf[j].longi || !H5_FLT_ABS_EQUAL(rbuf[i].pressure, wbuf[j].pressure) ||
+ !H5_DBL_ABS_EQUAL(rbuf[i].temperature, wbuf[j].temperature)) {
+ return FAIL;
+ }
+ return SUCCEED;
}
/*-------------------------------------------------------------------------
@@ -82,53 +74,51 @@ static int cmp_par(size_t i, size_t j, particle_t *rbuf, particle_t *wbuf )
static hid_t
make_particle_type(void)
{
- hid_t type_id;
- hid_t string_type;
- size_t type_size = sizeof(particle_t);
-
- /* Create the memory data type. */
- if ((type_id = H5Tcreate (H5T_COMPOUND, type_size )) < 0 )
- return FAIL;
-
- /* Insert fields. */
- if ((string_type = H5Tcopy(H5T_C_S1)) < 0)
- return FAIL;
- if (H5Tset_size(string_type, (size_t)16) < 0)
- return FAIL;
-
- if ( H5Tinsert(type_id, "Name", HOFFSET(particle_t, name) , string_type ) < 0 )
- return FAIL;
- if ( H5Tinsert(type_id, "Lat", HOFFSET(particle_t, lati) , H5T_NATIVE_INT ) < 0 )
- return FAIL;
- if ( H5Tinsert(type_id, "Long", HOFFSET(particle_t, longi) , H5T_NATIVE_INT ) < 0 )
- return FAIL;
- if ( H5Tinsert(type_id, "Pressure", HOFFSET(particle_t, pressure) , H5T_NATIVE_FLOAT ) < 0 )
- return FAIL;
- if ( H5Tinsert(type_id, "Temperature", HOFFSET(particle_t, temperature) , H5T_NATIVE_DOUBLE ) < 0 )
- return FAIL;
-
- return type_id;
+ hid_t type_id;
+ hid_t string_type;
+ size_t type_size = sizeof(particle_t);
+
+ /* Create the memory data type. */
+ if ((type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0)
+ return FAIL;
+
+ /* Insert fields. */
+ if ((string_type = H5Tcopy(H5T_C_S1)) < 0)
+ return FAIL;
+ if (H5Tset_size(string_type, (size_t)16) < 0)
+ return FAIL;
+
+ if (H5Tinsert(type_id, "Name", HOFFSET(particle_t, name), string_type) < 0)
+ return FAIL;
+ if (H5Tinsert(type_id, "Lat", HOFFSET(particle_t, lati), H5T_NATIVE_INT) < 0)
+ return FAIL;
+ if (H5Tinsert(type_id, "Long", HOFFSET(particle_t, longi), H5T_NATIVE_INT) < 0)
+ return FAIL;
+ if (H5Tinsert(type_id, "Pressure", HOFFSET(particle_t, pressure), H5T_NATIVE_FLOAT) < 0)
+ return FAIL;
+ if (H5Tinsert(type_id, "Temperature", HOFFSET(particle_t, temperature), H5T_NATIVE_DOUBLE) < 0)
+ return FAIL;
+
+ return type_id;
}
- /* Create a normal HL table just like the HL examples do */
-static int create_hl_table(hid_t fid)
+/* Create a normal HL table just like the HL examples do */
+static int
+create_hl_table(hid_t fid)
{
- /* Calculate the offsets of the particle struct members in memory */
- size_t part_offset[NFIELDS] = { HOFFSET( particle_t, name ),
- HOFFSET( particle_t, lati ),
- HOFFSET( particle_t, longi ),
- HOFFSET( particle_t, pressure ),
- HOFFSET( particle_t, temperature )};
+ /* Calculate the offsets of the particle struct members in memory */
+ size_t part_offset[NFIELDS] = {HOFFSET(particle_t, name), HOFFSET(particle_t, lati),
+ HOFFSET(particle_t, longi), HOFFSET(particle_t, pressure),
+ HOFFSET(particle_t, temperature)};
/* Define field information */
- const char *field_names[NFIELDS] =
- { "Name","Latitude", "Longitude", "Pressure", "Temperature" };
- hid_t field_type[NFIELDS];
- hid_t string_type;
- hsize_t chunk_size = 10;
- int *fill_data = NULL;
- int compress = 0;
- herr_t status;
+ const char *field_names[NFIELDS] = {"Name", "Latitude", "Longitude", "Pressure", "Temperature"};
+ hid_t field_type[NFIELDS];
+ hid_t string_type;
+ hsize_t chunk_size = 10;
+ int * fill_data = NULL;
+ int compress = 0;
+ herr_t status;
/* Initialize the field field_type */
if ((string_type = H5Tcopy(H5T_C_S1)) < 0)
@@ -141,27 +131,24 @@ static int create_hl_table(hid_t fid)
field_type[3] = H5T_NATIVE_FLOAT;
field_type[4] = H5T_NATIVE_DOUBLE;
+ /*------------------------------------------------------------------------
+ * H5TBmake_table
+ *-------------------------------------------------------------------------
+ */
- /*------------------------------------------------------------------------
- * H5TBmake_table
- *-------------------------------------------------------------------------
- */
-
- status=H5TBmake_table( "Table Title", fid, H5TB_TABLE_NAME, (hsize_t)NFIELDS,
- (hsize_t)NRECORDS, sizeof(particle_t),
- field_names, part_offset, field_type,
- chunk_size, fill_data, compress, testPart );
+ status = H5TBmake_table("Table Title", fid, H5TB_TABLE_NAME, (hsize_t)NFIELDS, (hsize_t)NRECORDS,
+ sizeof(particle_t), field_names, part_offset, field_type, chunk_size, fill_data,
+ compress, testPart);
- if (H5Tclose(string_type) < 0)
- return FAIL;
+ if (H5Tclose(string_type) < 0)
+ return FAIL;
- if(status<0)
- return FAIL;
- else
- return SUCCEED;
+ if (status < 0)
+ return FAIL;
+ else
+ return SUCCEED;
}
-
/*-------------------------------------------------------------------------
* test_create_close
*
@@ -170,11 +157,12 @@ static int create_hl_table(hid_t fid)
*-------------------------------------------------------------------------
*/
-static int test_create_close(hid_t fid)
+static int
+test_create_close(hid_t fid)
{
herr_t err;
- hid_t table;
- hid_t part_t;
+ hid_t table;
+ hid_t part_t;
HL_TESTING2("H5PTcreate_fl and H5PTclose");
@@ -186,23 +174,23 @@ static int test_create_close(hid_t fid)
/* Create the table */
table = H5PTcreate_fl(fid, PT_NAME, part_t, (hsize_t)100, -1);
if (H5Tclose(part_t) < 0)
- goto error;
- if( H5PTis_valid(table) < 0)
- goto error;
- if( H5PTis_varlen(table) != 0)
- goto error;
+ goto error;
+ if (H5PTis_valid(table) < 0)
+ goto error;
+ if (H5PTis_varlen(table) != 0)
+ goto error;
/* Close the table */
err = H5PTclose(table);
- if( err < 0)
+ if (err < 0)
goto error;
PASSED();
return SUCCEED;
error:
- H5_FAILED();
- return FAIL;
+ H5_FAILED();
+ return FAIL;
}
/*-------------------------------------------------------------------------
@@ -212,32 +200,34 @@ error:
*
*-------------------------------------------------------------------------
*/
-static int test_open(hid_t fid)
+static int
+test_open(hid_t fid)
{
herr_t err;
- hid_t table;
+ hid_t table;
HL_TESTING2("H5PTopen");
/* Open the table */
table = H5PTopen(fid, PT_NAME);
- if( H5PTis_valid(table) < 0)
+ if (H5PTis_valid(table) < 0)
goto error;
- if( H5PTis_varlen(table) != 0)
+ if (H5PTis_varlen(table) != 0)
goto error;
/* Close the table */
err = H5PTclose(table);
- if( err < 0)
+ if (err < 0)
goto error;
PASSED();
return SUCCEED;
error:
- if (table > 0) H5PTclose(table);
- H5_FAILED();
- return FAIL;
+ if (table > 0)
+ H5PTclose(table);
+ H5_FAILED();
+ return FAIL;
}
/*-------------------------------------------------------------------------
@@ -247,63 +237,64 @@ error:
*
*-------------------------------------------------------------------------
*/
-static int test_append(hid_t fid)
+static int
+test_append(hid_t fid)
{
- herr_t err;
- hid_t table;
+ herr_t err;
+ hid_t table;
hsize_t count = 0;
HL_TESTING2("H5PTappend");
/* Open the table */
table = H5PTopen(fid, PT_NAME);
- if( H5PTis_valid(table) < 0)
+ if (H5PTis_valid(table) < 0)
goto error;
/* Count the number of packets in the table */
err = H5PTget_num_packets(table, &count);
- if( err < 0)
+ if (err < 0)
goto error;
/* There should be 0 records in the table */
- if( count != 0 )
+ if (count != 0)
goto error;
/* Append one particle */
err = H5PTappend(table, (size_t)1, &(testPart[0]));
- if( err < 0)
+ if (err < 0)
goto error;
/* Append several particles */
err = H5PTappend(table, (size_t)6, &(testPart[1]));
- if( err < 0)
+ if (err < 0)
goto error;
/* Append one more particle */
err = H5PTappend(table, (size_t)1, &(testPart[7]));
- if( err < 0)
+ if (err < 0)
goto error;
/* Count the number of packets in the table */
err = H5PTget_num_packets(table, &count);
- if( err < 0)
+ if (err < 0)
goto error;
/* There should be 8 records in the table now */
- if( count != 8 )
+ if (count != 8)
goto error;
/* Close the table */
err = H5PTclose(table);
- if( err < 0)
+ if (err < 0)
goto error;
PASSED();
return SUCCEED;
error:
- H5_FAILED();
- if( H5PTis_valid(table) > 0)
- H5PTclose(table);
- return FAIL;
+ H5_FAILED();
+ if (H5PTis_valid(table) > 0)
+ H5PTclose(table);
+ return FAIL;
}
/*-------------------------------------------------------------------------
@@ -313,45 +304,45 @@ error:
*
*-------------------------------------------------------------------------
*/
-static int test_read(hid_t fid)
+static int
+test_read(hid_t fid)
{
- herr_t err;
- hid_t table;
+ herr_t err;
+ hid_t table;
particle_t readBuf[NRECORDS];
- size_t c;
+ size_t c;
HL_TESTING2("H5PTread_packets");
/* Open the table */
table = H5PTopen(fid, PT_NAME);
- if( H5PTis_valid(table) < 0)
+ if (H5PTis_valid(table) < 0)
goto error;
/* Read several particles */
err = H5PTread_packets(table, (hsize_t)0, 3, &(readBuf[0]));
- if( err < 0)
+ if (err < 0)
goto error;
/* Read one particle */
err = H5PTread_packets(table, (hsize_t)3, 1, &(readBuf[3]));
- if( err < 0)
+ if (err < 0)
goto error;
/* Read several particles */
- err = H5PTread_packets(table, (hsize_t)4, (NRECORDS - 4 ), &(readBuf[4]));
- if( err < 0)
+ err = H5PTread_packets(table, (hsize_t)4, (NRECORDS - 4), &(readBuf[4]));
+ if (err < 0)
goto error;
/* Ensure that particles were read correctly */
- for(c=0; c<NRECORDS; c++)
- {
- if( cmp_par(c%8, c, testPart, readBuf) != 0)
+ for (c = 0; c < NRECORDS; c++) {
+ if (cmp_par(c % 8, c, testPart, readBuf) != 0)
goto error;
}
/* Close the table */
err = H5PTclose(table);
- if( err < 0)
+ if (err < 0)
goto error;
PASSED();
@@ -359,10 +350,10 @@ static int test_read(hid_t fid)
return SUCCEED;
error:
- H5_FAILED();
- if( H5PTis_valid(table) > 0)
- H5PTclose(table);
- return FAIL;
+ H5_FAILED();
+ if (H5PTis_valid(table) > 0)
+ H5PTclose(table);
+ return FAIL;
}
/*-------------------------------------------------------------------------
@@ -373,66 +364,63 @@ error:
*
*-------------------------------------------------------------------------
*/
-static int test_get_next(hid_t fid)
+static int
+test_get_next(hid_t fid)
{
- herr_t err;
- hid_t table;
+ herr_t err;
+ hid_t table;
particle_t readBuf[NRECORDS];
particle_t readBuf2[NRECORDS];
- size_t c;
+ size_t c;
HL_TESTING2("H5PTget_next");
/* Open the table */
table = H5PTopen(fid, PT_NAME);
- if( H5PTis_valid(table) < 0)
+ if (H5PTis_valid(table) < 0)
goto error;
/* Read several particles consecutively */
- for(c=0; c < NRECORDS; c++)
- {
+ for (c = 0; c < NRECORDS; c++) {
err = H5PTget_next(table, (size_t)1, &readBuf[c]);
- if(err < 0)
+ if (err < 0)
goto error;
}
/* Ensure that particles were read correctly */
- for(c=0; c<NRECORDS; c++)
- {
- if( cmp_par(c, c, testPart, readBuf) != 0)
+ for (c = 0; c < NRECORDS; c++) {
+ if (cmp_par(c, c, testPart, readBuf) != 0)
goto error;
}
H5PTcreate_index(table);
/* Read particles two by two */
- for(c=0; c < NRECORDS / 2; c++)
- {
+ for (c = 0; c < NRECORDS / 2; c++) {
err = H5PTget_next(table, (size_t)2, &readBuf2[c * 2]);
- if(err < 0)
+ if (err < 0)
goto error;
}
/* Ensure that particles were read correctly */
- for(c=0; c<NRECORDS; c++)
- {
- if( cmp_par(c, c, testPart, readBuf2) != 0)
+ for (c = 0; c < NRECORDS; c++) {
+ if (cmp_par(c, c, testPart, readBuf2) != 0)
goto error;
}
/* Close the table */
err = H5PTclose(table);
- if( err < 0)
+ if (err < 0)
goto error;
PASSED();
return SUCCEED;
error:
- H5_FAILED();
- if( H5PTis_valid(table) > 0)
- H5PTclose(table);
- return FAIL;
+ H5_FAILED();
+ if (H5PTis_valid(table) > 0)
+ H5PTclose(table);
+ return FAIL;
}
/*-------------------------------------------------------------------------
@@ -443,14 +431,15 @@ error:
*
*-------------------------------------------------------------------------
*/
-static int test_big_table(hid_t fid)
+static int
+test_big_table(hid_t fid)
{
- herr_t err;
- hid_t table;
- hid_t part_t;
- size_t c;
+ herr_t err;
+ hid_t table;
+ hid_t part_t;
+ size_t c;
particle_t readPart;
- hsize_t count;
+ hsize_t count;
HL_TESTING2("large packet table");
@@ -463,52 +452,50 @@ static int test_big_table(hid_t fid)
table = H5PTcreate_fl(fid, "Packet Test Dataset2", part_t, (hsize_t)33, -1);
if (H5Tclose(part_t) < 0)
goto error;
- if( H5PTis_valid(table) < 0)
+ if (H5PTis_valid(table) < 0)
goto error;
- /* Add many particles */
- for(c = 0; c < BIG_TABLE_SIZE ; c+=8)
- {
+ /* Add many particles */
+ for (c = 0; c < BIG_TABLE_SIZE; c += 8) {
/* Append eight particles at once*/
err = H5PTappend(table, (size_t)8, &(testPart[0]));
- if( err < 0)
+ if (err < 0)
goto error;
}
/* Count the number of packets in the table */
err = H5PTget_num_packets(table, &count);
- if( err < 0)
+ if (err < 0)
goto error;
- if( count != BIG_TABLE_SIZE )
+ if (count != BIG_TABLE_SIZE)
goto error;
/* Read particles to ensure that all of them were written correctly */
/* Also, ensure that H5PTcreate_fl set the current packet to */
/* the first packet in the table */
- for(c = 0; c < BIG_TABLE_SIZE; c++)
- {
+ for (c = 0; c < BIG_TABLE_SIZE; c++) {
err = H5PTget_next(table, (size_t)1, &readPart);
- if(err < 0)
+ if (err < 0)
goto error;
/* Ensure that particles were read correctly */
- if( cmp_par(c % 8, 0, testPart, &readPart) != 0)
+ if (cmp_par(c % 8, 0, testPart, &readPart) != 0)
goto error;
}
/* Close the table */
err = H5PTclose(table);
- if( err < 0)
+ if (err < 0)
goto error;
PASSED();
return SUCCEED;
error:
- H5_FAILED();
- if( H5PTis_valid(table) > 0)
- H5PTclose(table);
- return FAIL;
+ H5_FAILED();
+ if (H5PTis_valid(table) > 0)
+ H5PTclose(table);
+ return FAIL;
}
/*-------------------------------------------------------------------------
@@ -518,63 +505,63 @@ error:
*
*-------------------------------------------------------------------------
*/
-static int test_opaque(hid_t fid)
+static int
+test_opaque(hid_t fid)
{
- herr_t err;
- hid_t table;
- hid_t part_t;
- size_t c;
+ herr_t err;
+ hid_t table;
+ hid_t part_t;
+ size_t c;
particle_t readBuf[NRECORDS];
HL_TESTING2("opaque data");
/* Create an opaque datatype for the particle struct */
- if ((part_t = H5Tcreate (H5T_OPAQUE, sizeof(particle_t) )) < 0 )
+ if ((part_t = H5Tcreate(H5T_OPAQUE, sizeof(particle_t))) < 0)
return FAIL;
HDassert(part_t != -1);
/* Tag the opaque datatype */
- if ( H5Tset_tag(part_t, "Opaque Particle" ) < 0)
+ if (H5Tset_tag(part_t, "Opaque Particle") < 0)
return FAIL;
/* Create a new table */
table = H5PTcreate_fl(fid, "Packet Test Dataset3", part_t, (hsize_t)100, -1);
- if( H5Tclose(part_t) < 0)
+ if (H5Tclose(part_t) < 0)
goto error;
- if( H5PTis_valid(table) < 0)
+ if (H5PTis_valid(table) < 0)
goto error;
/* Append several particles, starting at particle 1 */
err = H5PTappend(table, (size_t)(NRECORDS - 1), &(testPart[1]));
- if( err < 0)
+ if (err < 0)
goto error;
/* Read the particles back */
err = H5PTread_packets(table, (hsize_t)0, 7, &(readBuf[0]));
- if( err < 0)
+ if (err < 0)
goto error;
/* Ensure that particles were read correctly */
- for(c=0; c<NRECORDS - 1; c++)
- {
- if( cmp_par(c+1, c, testPart, readBuf) != 0)
+ for (c = 0; c < NRECORDS - 1; c++) {
+ if (cmp_par(c + 1, c, testPart, readBuf) != 0)
goto error;
}
/* Close the table */
err = H5PTclose(table);
- if( err < 0)
+ if (err < 0)
goto error;
PASSED();
return SUCCEED;
error:
- H5_FAILED();
- if( H5PTis_valid(table) > 0)
- H5PTclose(table);
- return FAIL;
+ H5_FAILED();
+ if (H5PTis_valid(table) > 0)
+ H5PTclose(table);
+ return FAIL;
}
/*-------------------------------------------------------------------------
@@ -588,22 +575,23 @@ error:
static int
test_compress(void)
{
- hid_t fid1 = H5I_INVALID_HID;
- herr_t err;
- hid_t table = H5I_INVALID_HID;
- hid_t part_t = H5I_INVALID_HID;
- hid_t dset_id = H5I_INVALID_HID;
- hid_t plist_id = H5I_INVALID_HID;
- size_t c;
- size_t num_elems = 1;
- unsigned filter_vals[1];
+ hid_t fid1 = H5I_INVALID_HID;
+ herr_t err;
+ hid_t table = H5I_INVALID_HID;
+ hid_t part_t = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t plist_id = H5I_INVALID_HID;
+ size_t c;
+ size_t num_elems = 1;
+ unsigned filter_vals[1];
particle_t readPart[1];
- hsize_t count;
+ hsize_t count;
HL_TESTING2("packet table compression");
/* Create a file. */
- if((fid1 = H5Fcreate(TEST_COMPRESS_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if ((fid1 = H5Fcreate(TEST_COMPRESS_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create a datatype for the particle struct */
part_t = make_particle_type();
@@ -612,106 +600,129 @@ test_compress(void)
/* Create a new table with compression level 8 */
table = H5PTcreate_fl(fid1, "Compressed Test Dataset", part_t, (hsize_t)80, 8);
- if( H5PTis_valid(table) < 0) TEST_ERROR;
+ if (H5PTis_valid(table) < 0)
+ TEST_ERROR;
/* We can now use this table exactly the same way we use a normal uncompressed
* packet table, and it should pass the same tests. */
- /* Add many particles */
- for(c = 0; c < BIG_TABLE_SIZE ; c+=8)
- {
+ /* Add many particles */
+ for (c = 0; c < BIG_TABLE_SIZE; c += 8) {
/* Append eight particles at once*/
err = H5PTappend(table, (size_t)8, &(testPart[0]));
- if( err < 0) TEST_ERROR;
+ if (err < 0)
+ TEST_ERROR;
}
/* Count the number of packets in the table */
err = H5PTget_num_packets(table, &count);
- if( err < 0) TEST_ERROR;
- if( count != BIG_TABLE_SIZE ) TEST_ERROR;
+ if (err < 0)
+ TEST_ERROR;
+ if (count != BIG_TABLE_SIZE)
+ TEST_ERROR;
/* Read particles to ensure that all of them were written correctly */
HDmemset(readPart, 0, sizeof(readPart));
- for(c = 0; c < BIG_TABLE_SIZE; c++)
- {
+ for (c = 0; c < BIG_TABLE_SIZE; c++) {
err = H5PTget_next(table, (size_t)1, readPart);
- if(err < 0) TEST_ERROR;
+ if (err < 0)
+ TEST_ERROR;
/* Ensure that particles were read correctly */
- if( cmp_par(c % 8, 0, testPart, readPart) != 0) TEST_ERROR;
+ if (cmp_par(c % 8, 0, testPart, readPart) != 0)
+ TEST_ERROR;
}
/* Close the table */
err = H5PTclose(table);
- if( err < 0) TEST_ERROR;
+ if (err < 0)
+ TEST_ERROR;
/* Open the packet table as a regular dataset and make sure that the
* compression filter is set.
*/
dset_id = H5Dopen2(fid1, "Compressed Test Dataset", H5P_DEFAULT);
- if( dset_id < 0) TEST_ERROR;
+ if (dset_id < 0)
+ TEST_ERROR;
plist_id = H5Dget_create_plist(dset_id);
- if( plist_id < 0) TEST_ERROR;
+ if (plist_id < 0)
+ TEST_ERROR;
- err = H5Pget_filter_by_id2(plist_id, H5Z_FILTER_DEFLATE, NULL, &num_elems,
- filter_vals, 0, NULL, NULL);
- if( err < 0) TEST_ERROR;
+ err = H5Pget_filter_by_id2(plist_id, H5Z_FILTER_DEFLATE, NULL, &num_elems, filter_vals, 0, NULL, NULL);
+ if (err < 0)
+ TEST_ERROR;
/* The compression level should be 8, the value we passed in */
- if(filter_vals[0] != 8) TEST_ERROR;
+ if (filter_vals[0] != 8)
+ TEST_ERROR;
/* Clean up */
err = H5Pclose(plist_id);
- if( err < 0) TEST_ERROR;
+ if (err < 0)
+ TEST_ERROR;
err = H5Dclose(dset_id);
- if( err < 0) TEST_ERROR;
+ if (err < 0)
+ TEST_ERROR;
/* Create a new table without compression. */
table = H5PTcreate_fl(fid1, "Uncompressed Dataset", part_t, (hsize_t)80, -1);
- if(table < 0) TEST_ERROR;
+ if (table < 0)
+ TEST_ERROR;
/* Close the packet table */
err = H5PTclose(table);
- if( err < 0) TEST_ERROR;
+ if (err < 0)
+ TEST_ERROR;
/* Open the packet table as a regular dataset and make sure that the
* compression filter is not set.
*/
dset_id = H5Dopen2(fid1, "Uncompressed Dataset", H5P_DEFAULT);
- if( dset_id < 0) TEST_ERROR;
+ if (dset_id < 0)
+ TEST_ERROR;
plist_id = H5Dget_create_plist(dset_id);
- if( plist_id < 0) TEST_ERROR;
+ if (plist_id < 0)
+ TEST_ERROR;
- H5E_BEGIN_TRY {
- err = H5Pget_filter_by_id2(plist_id, H5Z_FILTER_DEFLATE, NULL, &num_elems,
- filter_vals, 0, NULL, NULL);
- if( err >= 0) TEST_ERROR;
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ err =
+ H5Pget_filter_by_id2(plist_id, H5Z_FILTER_DEFLATE, NULL, &num_elems, filter_vals, 0, NULL, NULL);
+ if (err >= 0)
+ TEST_ERROR;
+ }
+ H5E_END_TRY
/* Clean up */
err = H5Pclose(plist_id);
- if( err < 0) TEST_ERROR;
+ if (err < 0)
+ TEST_ERROR;
err = H5Dclose(dset_id);
- if( err < 0) TEST_ERROR;
+ if (err < 0)
+ TEST_ERROR;
/* Close the datatype and the file */
err = H5Tclose(part_t);
- if( err < 0) TEST_ERROR;
+ if (err < 0)
+ TEST_ERROR;
err = H5Fclose(fid1);
- if( err < 0) TEST_ERROR;
+ if (err < 0)
+ TEST_ERROR;
PASSED();
return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Pclose(plist_id);
- H5Dclose(dset_id);
- H5Tclose(part_t);
- H5PTclose(table);
- H5Fclose(fid1);
- } H5E_END_TRY
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(plist_id);
+ H5Dclose(dset_id);
+ H5Tclose(part_t);
+ H5PTclose(table);
+ H5Fclose(fid1);
+ }
+ H5E_END_TRY
H5_FAILED();
return FAIL;
}
@@ -724,83 +735,85 @@ error:
*
*-------------------------------------------------------------------------
*/
-static int test_rw_nonnative_dt(hid_t fid)
+static int
+test_rw_nonnative_dt(hid_t fid)
{
- hid_t ptable; /* Packet table identifier */
+ hid_t ptable; /* Packet table identifier */
- herr_t err; /* Function return status */
- hsize_t count; /* Number of records in the table */
+ herr_t err; /* Function return status */
+ hsize_t count; /* Number of records in the table */
- int x; /* Loop variable */
+ int x; /* Loop variable */
- /* Buffers to hold data */
- int writeBuffer[5];
- int readBuffer[5];
+ /* Buffers to hold data */
+ int writeBuffer[5];
+ int readBuffer[5];
- HL_TESTING2("reading/writing non-native packet table");
+ HL_TESTING2("reading/writing non-native packet table");
- /* Initialize buffers */
- for(x=0; x<5; x++) {
- writeBuffer[x]=x;
- readBuffer[x] = -1;
- }
+ /* Initialize buffers */
+ for (x = 0; x < 5; x++) {
+ writeBuffer[x] = x;
+ readBuffer[x] = -1;
+ }
- /* Create a fixed-length packet table within the file */
- /* This table's "packets" will be simple integers and it will use no compression */
- if(H5Tget_order(H5T_NATIVE_INT) == H5T_ORDER_LE) {
- ptable = H5PTcreate(fid, "Packet Test Dataset, Non-native", H5T_STD_I32BE, (hsize_t)100, H5P_DEFAULT);
- } else {
- ptable = H5PTcreate(fid, "Packet Test Dataset, Non-native", H5T_STD_I32LE, (hsize_t)100, H5P_DEFAULT);
- }
- if(ptable == H5I_INVALID_HID)
+ /* Create a fixed-length packet table within the file */
+ /* This table's "packets" will be simple integers and it will use no compression */
+ if (H5Tget_order(H5T_NATIVE_INT) == H5T_ORDER_LE) {
+ ptable = H5PTcreate(fid, "Packet Test Dataset, Non-native", H5T_STD_I32BE, (hsize_t)100, H5P_DEFAULT);
+ }
+ else {
+ ptable = H5PTcreate(fid, "Packet Test Dataset, Non-native", H5T_STD_I32LE, (hsize_t)100, H5P_DEFAULT);
+ }
+ if (ptable == H5I_INVALID_HID)
goto error;
- /* Write one packet to the packet table */
- if( (err = H5PTappend(ptable, (size_t)1, &(writeBuffer[0]))) < 0 )
+ /* Write one packet to the packet table */
+ if ((err = H5PTappend(ptable, (size_t)1, &(writeBuffer[0]))) < 0)
goto error;
- /* Write several packets to the packet table */
- if( (err = H5PTappend(ptable, (size_t)4, &(writeBuffer[1]))) < 0)
+ /* Write several packets to the packet table */
+ if ((err = H5PTappend(ptable, (size_t)4, &(writeBuffer[1]))) < 0)
goto error;
- if( (err = H5PTclose(ptable)) < 0)
+ if ((err = H5PTclose(ptable)) < 0)
goto error;
- /* Open the Packet table */
- if( (ptable = H5PTopen(fid, "Packet Test Dataset, Non-native")) < 0)
+ /* Open the Packet table */
+ if ((ptable = H5PTopen(fid, "Packet Test Dataset, Non-native")) < 0)
goto error;
- /* Get the number of packets in the packet table. This should be five. */
- if( (err = H5PTget_num_packets(ptable, &count)) < 0)
+ /* Get the number of packets in the packet table. This should be five. */
+ if ((err = H5PTget_num_packets(ptable, &count)) < 0)
goto error;
- if( (int)count != 5 )
+ if ((int)count != 5)
goto error;
- /* Initialize packet table's "current record" */
- if( (err = H5PTcreate_index(ptable)) < 0)
+ /* Initialize packet table's "current record" */
+ if ((err = H5PTcreate_index(ptable)) < 0)
goto error;
- /* Iterate through packets, read each one back */
- for(x=0; x<5; x++) {
- if( (err = H5PTget_next(ptable, (size_t)1, &(readBuffer[x]))) < 0)
- goto error;
- if( x != readBuffer[x])
- goto error;
- }
+ /* Iterate through packets, read each one back */
+ for (x = 0; x < 5; x++) {
+ if ((err = H5PTget_next(ptable, (size_t)1, &(readBuffer[x]))) < 0)
+ goto error;
+ if (x != readBuffer[x])
+ goto error;
+ }
- /* Close the packet table */
- if( (err = H5PTclose(ptable)) < 0)
+ /* Close the packet table */
+ if ((err = H5PTclose(ptable)) < 0)
goto error;
- PASSED();
- return SUCCEED;
+ PASSED();
+ return SUCCEED;
error:
- H5_FAILED();
- if( H5PTis_valid(ptable) > 0)
- H5PTclose(ptable);
- return FAIL;
+ H5_FAILED();
+ if (H5PTis_valid(ptable) > 0)
+ H5PTclose(ptable);
+ return FAIL;
}
/*-------------------------------------------------------------------------
@@ -811,109 +824,110 @@ error:
*
*-------------------------------------------------------------------------
*/
-static int test_error(hid_t fid)
+static int
+test_error(hid_t fid)
{
- hid_t id = H5I_INVALID_HID;
- int id_open=0;
- particle_t readBuf[1];
+ hid_t id = H5I_INVALID_HID;
+ int id_open = 0;
+ particle_t readBuf[1];
- HL_TESTING2("error conditions");
+ HL_TESTING2("error conditions");
- /* Create a HL table */
- if(create_hl_table(fid) < 0)
+ /* Create a HL table */
+ if (create_hl_table(fid) < 0)
goto error;
- /* Try to open things that are not packet tables */
- H5E_BEGIN_TRY
- if(H5PTopen(fid, "Bogus_name") >= 0)
+ /* Try to open things that are not packet tables */
+ H5E_BEGIN_TRY
+ if (H5PTopen(fid, "Bogus_name") >= 0)
goto error;
- if(H5PTopen(fid, "group1") >= 0)
+ if (H5PTopen(fid, "group1") >= 0)
goto error;
- H5E_END_TRY
+ H5E_END_TRY
- /* Try to execute packet table commands on an invalid ID */
- H5E_BEGIN_TRY
- if(H5PTis_valid(id) >= 0)
+ /* Try to execute packet table commands on an invalid ID */
+ H5E_BEGIN_TRY
+ if (H5PTis_valid(id) >= 0)
goto error;
- if(H5PTis_varlen(id) >= 0)
+ if (H5PTis_varlen(id) >= 0)
goto error;
- if(H5PTclose(id) >= 0)
+ if (H5PTclose(id) >= 0)
goto error;
- if(H5PTappend(id, (size_t)1, testPart) >= 0)
+ if (H5PTappend(id, (size_t)1, testPart) >= 0)
goto error;
- if(H5PTread_packets(id, (hsize_t)0, 1, readBuf) >= 0)
+ if (H5PTread_packets(id, (hsize_t)0, 1, readBuf) >= 0)
goto error;
- if(H5PTcreate_index(id) >= 0)
+ if (H5PTcreate_index(id) >= 0)
goto error;
- if(H5PTset_index(id, (hsize_t)1) >= 0)
+ if (H5PTset_index(id, (hsize_t)1) >= 0)
goto error;
- if(H5PTget_index(id, NULL) >= 0)
+ if (H5PTget_index(id, NULL) >= 0)
goto error;
- H5E_END_TRY
+ H5E_END_TRY
- /* Open a high-level non-packet (H5TB) table and try to */
- /* execute commands on it. */
- if((id=H5Dopen2(fid, H5TB_TABLE_NAME, H5P_DEFAULT)) <0)
+ /* Open a high-level non-packet (H5TB) table and try to */
+ /* execute commands on it. */
+ if ((id = H5Dopen2(fid, H5TB_TABLE_NAME, H5P_DEFAULT)) < 0)
goto error;
- id_open = 1;
+ id_open = 1;
- H5E_BEGIN_TRY
- if(H5PTis_valid(id) >= 0)
+ H5E_BEGIN_TRY
+ if (H5PTis_valid(id) >= 0)
goto error;
- if(H5PTis_varlen(id) >= 0)
+ if (H5PTis_varlen(id) >= 0)
goto error;
- if(H5PTclose(id) >= 0)
+ if (H5PTclose(id) >= 0)
goto error;
- if(H5PTappend(id, (size_t)1, testPart) >= 0)
+ if (H5PTappend(id, (size_t)1, testPart) >= 0)
goto error;
- if(H5PTread_packets(id, (hsize_t)0, 1, readBuf) >= 0)
+ if (H5PTread_packets(id, (hsize_t)0, 1, readBuf) >= 0)
goto error;
- if(H5PTcreate_index(id) >= 0)
+ if (H5PTcreate_index(id) >= 0)
goto error;
- if(H5PTset_index(id, (hsize_t)1) >= 0)
+ if (H5PTset_index(id, (hsize_t)1) >= 0)
goto error;
- if(H5PTget_index(id, NULL) >= 0)
+ if (H5PTget_index(id, NULL) >= 0)
goto error;
- H5E_END_TRY
+ H5E_END_TRY
- id_open=0;
- if(H5Dclose(id) <0)
+ id_open = 0;
+ if (H5Dclose(id) < 0)
goto error;
- /* Open and close a packet table. Try to execute */
- /* commands on the closed ID. */
- if((id=H5PTopen(fid, PT_NAME))<0)
+ /* Open and close a packet table. Try to execute */
+ /* commands on the closed ID. */
+ if ((id = H5PTopen(fid, PT_NAME)) < 0)
goto error;
- if(H5PTclose(id) <0)
+ if (H5PTclose(id) < 0)
goto error;
- H5E_BEGIN_TRY
- if(H5PTis_valid(id) >= 0)
+ H5E_BEGIN_TRY
+ if (H5PTis_valid(id) >= 0)
goto error;
- if(H5PTis_varlen(id) >= 0)
+ if (H5PTis_varlen(id) >= 0)
goto error;
- if(H5PTclose(id) >= 0)
+ if (H5PTclose(id) >= 0)
goto error;
- if(H5PTappend(id, (size_t)1, testPart) >= 0)
+ if (H5PTappend(id, (size_t)1, testPart) >= 0)
goto error;
- if(H5PTread_packets(id, (hsize_t)0, 1, readBuf) >= 0)
+ if (H5PTread_packets(id, (hsize_t)0, 1, readBuf) >= 0)
goto error;
- if(H5PTcreate_index(id) >= 0)
+ if (H5PTcreate_index(id) >= 0)
goto error;
- if(H5PTset_index(id, (hsize_t)1) >= 0)
+ if (H5PTset_index(id, (hsize_t)1) >= 0)
goto error;
- if(H5PTget_index(id, NULL) >= 0)
+ if (H5PTget_index(id, NULL) >= 0)
goto error;
- H5E_END_TRY
+ H5E_END_TRY
- PASSED();
- return SUCCEED;
+ PASSED();
+ return SUCCEED;
error:
- H5_FAILED();
- if(id_open)
- H5Dclose(id);
- return FAIL;
+ H5_FAILED();
+ if (id_open)
+ H5Dclose(id);
+ return FAIL;
}
/*-------------------------------------------------------------------------
@@ -923,18 +937,19 @@ error:
*
*-------------------------------------------------------------------------
*/
-static int test_packet_table(hid_t fid)
+static int
+test_packet_table(hid_t fid)
{
- if( test_create_close(fid) < 0 )
+ if (test_create_close(fid) < 0)
return FAIL;
- if( test_open(fid) < 0 )
+ if (test_open(fid) < 0)
return FAIL;
/* test_append must be run before test_count and test_read, as it */
/* creates the packet table they use. */
- if( test_append(fid) < 0 )
+ if (test_append(fid) < 0)
return FAIL;
/* These tests will not necessarily cause failures in each other,
@@ -952,22 +967,23 @@ static int test_packet_table(hid_t fid)
/*
*
-*/
-int main(void)
+ */
+int
+main(void)
{
/* identifier for the file that is used in FL PT tests */
- hid_t fid;
- int status = 0;
+ hid_t fid;
+ int status = 0;
-/*-------------------------------------------------------------------------
- * Packet test: test each function of the packet table library
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Packet test: test each function of the packet table library
+ *-------------------------------------------------------------------------
+ */
- /* create a file using default properties */
- fid=H5Fcreate(TEST_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ /* create a file using default properties */
+ fid = H5Fcreate(TEST_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDputs("Testing packet table");
+ HDputs("Testing packet table");
/* Test packet table with fixed length */
if (test_packet_table(fid) < 0)
@@ -979,7 +995,7 @@ int main(void)
/* Close the file */
if (H5Fclose(fid) < 0)
- status = 1;
+ status = 1;
return status;
}
diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c
index b41e73d..d2331d7 100644
--- a/hl/test/test_packet_vlen.c
+++ b/hl/test/test_packet_vlen.c
@@ -18,17 +18,17 @@
*-------------------------------------------------------------------------
*/
-#define NRECORDS 5
-#define TEST_FILE_NAME "test_packet_table_vlen.h5"
+#define NRECORDS 5
+#define TEST_FILE_NAME "test_packet_table_vlen.h5"
#define TESTFL_FILE_NAME "testfl_packet_table_vlen.h5"
-#define PT_VLEN_ATOMIC "Dataset with VL of Atomic types"
-#define PT_VLEN_COMP "Dataset with VL of Compound Types"
-#define PT_COMP_VLEN "Dataset with Compound Type of VL types"
-#define PT_VLEN_VLEN "Dataset with VL of VL types"
-#define PT_FIXED_LEN "Fixed-length Packet Table"
-#define L1_INCM 16
-#define L2_INCM 8
-#define NAME_BUF_SIZE 80
+#define PT_VLEN_ATOMIC "Dataset with VL of Atomic types"
+#define PT_VLEN_COMP "Dataset with VL of Compound Types"
+#define PT_COMP_VLEN "Dataset with Compound Type of VL types"
+#define PT_VLEN_VLEN "Dataset with VL of VL types"
+#define PT_FIXED_LEN "Fixed-length Packet Table"
+#define L1_INCM 16
+#define L2_INCM 8
+#define NAME_BUF_SIZE 80
/*-------------------------------------------------------------------------
* Local functions
@@ -51,17 +51,18 @@ static int verify_attribute(hid_t fid, const char *table_name, const char *attr_
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-static int test_VLof_atomic(void)
+static int
+test_VLof_atomic(void)
{
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */
- hsize_t count; /* Number of records in the table */
- unsigned uu, vv; /* Loop variables */
- hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
- hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
- char msg[80]; /* For error message */
- herr_t ret; /* Returned status from a callee */
+ hid_t fid = H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
+ hid_t vltype = H5I_INVALID_HID; /* Variable length datatype */
+ hsize_t count; /* Number of records in the table */
+ unsigned uu, vv; /* Loop variables */
+ hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
+ hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
+ char msg[80]; /* For error message */
+ herr_t ret; /* Returned status from a callee */
HL_TESTING3(" with vlen of atomic");
@@ -71,84 +72,86 @@ static int test_VLof_atomic(void)
if (writeBuf[uu].p == NULL) {
HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
- }
+ }
writeBuf[uu].len = uu + 1;
for (vv = 0; vv < (uu + 1); vv++)
- ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv;
+ ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv;
} /* end for */
/* Open the file */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create a vlen type that uses an atomic datatype as its base type */
- vltype = H5Tvlen_create (H5T_NATIVE_UINT);
+ vltype = H5Tvlen_create(H5T_NATIVE_UINT);
if (vltype < 0)
- goto error;
+ goto error;
/* Create a packet table that uses a vlen datatype of an atomic type */
ptable = H5PTcreate(fid, PT_VLEN_ATOMIC, vltype, (hsize_t)1, H5P_DEFAULT);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Close the vlen datatype */
if (H5Tclose(vltype) < 0)
- goto error;
+ goto error;
/* Write the entire buffer to the packet table */
ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Get the number of packets in the packet table, should be NRECORDS. */
ret = H5PTget_num_packets(ptable, &count);
if (ret < 0)
- goto error;
+ goto error;
HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
- ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf );
+ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void *)readBuf);
if (ret < 0)
- goto error;
+ goto error;
for (uu = 0; uu < NRECORDS; uu++)
- for (vv = 0; vv < (uu + 1); vv++)
- {
- if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) {
- HDprintf("Packet %u's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]);
- HDprintf("Packet %u's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]);
- }
+ for (vv = 0; vv < (uu + 1); vv++) {
+ if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) {
+ HDprintf("Packet %u's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]);
+ HDprintf("Packet %u's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]);
+ }
}
/* Free the buffers */
- ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf );
+ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
if (ret < 0)
- goto error;
+ goto error;
ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
error: /* An error has occurred. Clean up and exit. */
- if (vltype > 0) H5Tclose(vltype);
- if (H5PTis_valid(ptable) > 0) H5PTclose(ptable);
- if (fid > 0) H5Fclose(fid);
+ if (vltype > 0)
+ H5Tclose(vltype);
+ if (H5PTis_valid(ptable) > 0)
+ H5PTclose(ptable);
+ if (fid > 0)
+ H5Fclose(fid);
H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
H5_FAILED();
@@ -162,134 +165,142 @@ error: /* An error has occurred. Clean up and exit. */
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-static int test_VLof_comptype(void)
+static int
+test_VLof_comptype(void)
{
/* Struct that the VL sequences are composed of */
typedef struct {
unsigned u;
- float f;
+ float f;
} VLcomp_t;
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */
- hid_t cmptype=H5I_INVALID_HID; /* Compound datatype */
- hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
- hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
- hsize_t count; /* Number of records in the table */
- unsigned uu, vv; /* Loop variables */
- char msg[80]; /* For error message */
- herr_t ret;
+ hid_t fid = H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
+ hid_t vltype = H5I_INVALID_HID; /* Variable length datatype */
+ hid_t cmptype = H5I_INVALID_HID; /* Compound datatype */
+ hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
+ hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
+ hsize_t count; /* Number of records in the table */
+ unsigned uu, vv; /* Loop variables */
+ char msg[80]; /* For error message */
+ herr_t ret;
HL_TESTING3(" with vlen of compound datatypes");
/* Allocate and initialize VL data to write (copied from C test) */
for (uu = 0; uu < NRECORDS; uu++) {
writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(VLcomp_t));
- if(writeBuf[uu].p == NULL) {
+ if (writeBuf[uu].p == NULL) {
HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
- }
+ }
writeBuf[uu].len = uu + 1;
for (vv = 0; vv < (uu + 1); vv++) {
((VLcomp_t *)writeBuf[uu].p)[vv].u = uu + vv;
((VLcomp_t *)writeBuf[uu].p)[vv].f = (float)(uu + vv) / 3.0F;
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Open the file */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create the base compound type */
cmptype = H5Tcreate(H5T_COMPOUND, sizeof(VLcomp_t));
if (cmptype < 0)
- goto error;
+ goto error;
/* Insert fields */
ret = H5Tinsert(cmptype, "u", HOFFSET(VLcomp_t, u), H5T_NATIVE_UINT);
if (ret < 0)
- goto error;
+ goto error;
ret = H5Tinsert(cmptype, "f", HOFFSET(VLcomp_t, f), H5T_NATIVE_FLOAT);
if (ret < 0)
- goto error;
+ goto error;
/* Create a variable length type that uses the VLcomp_t as its base type */
vltype = H5Tvlen_create(cmptype);
if (vltype < 0)
- goto error;
+ goto error;
/* Create a packet table that uses a vlen datatype of compound datatype */
ptable = H5PTcreate(fid, PT_VLEN_COMP, vltype, (hsize_t)1, H5P_DEFAULT);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Release the datatypes */
if (H5Tclose(cmptype) < 0)
- goto error;
+ goto error;
if (H5Tclose(vltype) < 0)
- goto error;
+ goto error;
/* Write the entire buffer to the packet table */
- ret = H5PTappend(ptable, (size_t)5, writeBuf );
+ ret = H5PTappend(ptable, (size_t)5, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Get the number of packets in the packet table, should be NRECORDS. */
ret = H5PTget_num_packets(ptable, &count);
if (ret < 0)
- goto error;
+ goto error;
HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
- ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf );
+ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void *)readBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Compare data read in */
for (uu = 0; uu < NRECORDS; uu++) {
if (writeBuf[uu].len != readBuf[uu].len) {
- HDfprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%d, readBuf[%u].len=%d\n", __LINE__, uu, (int)writeBuf[uu].len, uu, (int)readBuf[uu].len);
- continue;
- } /* write len != read len */
+ HDfprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%d, readBuf[%u].len=%d\n",
+ __LINE__, uu, (int)writeBuf[uu].len, uu, (int)readBuf[uu].len);
+ continue;
+ } /* write len != read len */
for (vv = 0; vv < (uu + 1); vv++) {
- if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv] ) {
- HDfprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%d]=%d, readBuf[uu].p[%d]=%d\n", vv, (int)((unsigned int *)writeBuf[uu].p)[vv], vv, (int)((unsigned int *)readBuf[uu].p)[vv]);
+ if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv]) {
+ HDfprintf(
+ stderr, "VL data values don't match!, writeBuf[uu].p[%d]=%d, readBuf[uu].p[%d]=%d\n", vv,
+ (int)((unsigned int *)writeBuf[uu].p)[vv], vv, (int)((unsigned int *)readBuf[uu].p)[vv]);
continue;
- } /* write value != read value */
- }
+ } /* write value != read value */
+ }
} /* end for */
/* Free the buffers */
ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
if (ret < 0)
- goto error;
+ goto error;
ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
error: /* An error has occurred. Clean up and exit. */
- if (cmptype > 0) H5Tclose(cmptype);
- if (vltype > 0) H5Tclose(vltype);
- if (H5PTis_valid(ptable) > 0) H5PTclose(ptable);
- if (fid > 0) H5Fclose(fid);
+ if (cmptype > 0)
+ H5Tclose(cmptype);
+ if (vltype > 0)
+ H5Tclose(vltype);
+ if (H5PTis_valid(ptable) > 0)
+ H5PTclose(ptable);
+ if (fid > 0)
+ H5Fclose(fid);
H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
H5_FAILED();
@@ -304,47 +315,47 @@ error: /* An error has occurred. Clean up and exit. */
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-static int test_compound_VL_VLtype(void)
+static int
+test_compound_VL_VLtype(void)
{
/* Struct that the VL sequences are composed of */
typedef struct {
unsigned u;
- float f;
- hvl_t v;
+ float f;
+ hvl_t v;
} compVLVL_t;
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */
- hid_t vlofvl=H5I_INVALID_HID; /* Variable length datatype */
- hid_t comp_vlvl=H5I_INVALID_HID; /* ID of a compound datatype containing
- a VL of VL of atomic datatype */
- hsize_t count; /* Number of records in the table */
- compVLVL_t writeBuf[NRECORDS];/* Buffer to hold data to be written */
- compVLVL_t readBuf[NRECORDS]; /* Buffer to hold read data */
- hvl_t *t1, *t2;
- unsigned uu, vv, ww; /* Loop variables */
- char msg[80]; /* For error message */
- herr_t ret; /* Returned status from a callee */
+ hid_t fid = H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
+ hid_t vlatomic = H5I_INVALID_HID; /* Variable length datatype */
+ hid_t vlofvl = H5I_INVALID_HID; /* Variable length datatype */
+ hid_t comp_vlvl = H5I_INVALID_HID; /* ID of a compound datatype containing
+ a VL of VL of atomic datatype */
+ hsize_t count; /* Number of records in the table */
+ compVLVL_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
+ compVLVL_t readBuf[NRECORDS]; /* Buffer to hold read data */
+ hvl_t * t1, *t2;
+ unsigned uu, vv, ww; /* Loop variables */
+ char msg[80]; /* For error message */
+ herr_t ret; /* Returned status from a callee */
HL_TESTING3(" with compound datatype containing vlen datatype");
/* Allocate and initialize VL data to write (copied from C test) */
for (uu = 0; uu < NRECORDS; uu++) {
- writeBuf[uu].u = uu * 10;
- writeBuf[uu].f = (float)(uu * 20) / 3.0F;
+ writeBuf[uu].u = uu * 10;
+ writeBuf[uu].f = (float)(uu * 20) / 3.0F;
writeBuf[uu].v.p = HDmalloc((uu + L1_INCM) * sizeof(hvl_t));
if (writeBuf[uu].v.p == NULL) {
HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
- }
+ }
writeBuf[uu].v.len = uu + L1_INCM;
- for (t1 = (hvl_t *)((writeBuf[uu].v).p), vv = 0; vv < (uu + L1_INCM); vv++, t1++)
- {
+ for (t1 = (hvl_t *)((writeBuf[uu].v).p), vv = 0; vv < (uu + L1_INCM); vv++, t1++) {
t1->p = HDmalloc((vv + L2_INCM) * sizeof(unsigned int));
- if (t1->p == NULL) {
- HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
- goto error;
- }
+ if (t1->p == NULL) {
+ HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
+ goto error;
+ }
t1->len = vv + L2_INCM;
for (ww = 0; ww < vv + L2_INCM; ww++)
((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww;
@@ -354,123 +365,135 @@ static int test_compound_VL_VLtype(void)
/* Open the file */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create a VL datatype of an atomic type */
- vlatomic = H5Tvlen_create (H5T_NATIVE_UINT);
+ vlatomic = H5Tvlen_create(H5T_NATIVE_UINT);
if (vlatomic < 0)
- goto error;
+ goto error;
/* Create a VL datatype of the VL of atomic datatype */
- vlofvl = H5Tvlen_create (vlatomic);
+ vlofvl = H5Tvlen_create(vlatomic);
if (vlofvl < 0)
- goto error;
+ goto error;
/* Create the base compound type */
comp_vlvl = H5Tcreate(H5T_COMPOUND, sizeof(compVLVL_t));
if (comp_vlvl < 0)
- goto error;
+ goto error;
/* Insert fields: atomic, atomic, vlen */
ret = H5Tinsert(comp_vlvl, "u", HOFFSET(compVLVL_t, u), H5T_NATIVE_UINT);
if (ret < 0)
- goto error;
+ goto error;
ret = H5Tinsert(comp_vlvl, "f", HOFFSET(compVLVL_t, f), H5T_NATIVE_FLOAT);
if (ret < 0)
- goto error;
+ goto error;
ret = H5Tinsert(comp_vlvl, "v", HOFFSET(compVLVL_t, v), vlofvl);
if (ret < 0)
- goto error;
+ goto error;
/* Create a packet table that uses a compound datatype of vlen datatype */
ptable = H5PTcreate(fid, PT_COMP_VLEN, comp_vlvl, (hsize_t)1, H5P_DEFAULT);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Release datatypes */
if (H5Tclose(vlatomic) < 0)
- goto error;
+ goto error;
if (H5Tclose(vlofvl) < 0)
- goto error;
+ goto error;
if (H5Tclose(comp_vlvl) < 0)
- goto error;
+ goto error;
/* Write the entire buffer to the packet table */
- ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf );
+ ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Get the number of packets in the packet table, should be NRECORDS. */
ret = H5PTget_num_packets(ptable, &count);
if (ret < 0)
- goto error;
+ goto error;
HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
- ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf );
+ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void *)readBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Compare data read in */
for (uu = 0; uu < NRECORDS; uu++) {
if (writeBuf[uu].u != readBuf[uu].u) {
- HDfprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, writeBuf[uu].u, uu, readBuf[uu].u);
+ HDfprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu,
+ writeBuf[uu].u, uu, readBuf[uu].u);
continue;
} /* end if */
- if (!H5_FLT_ABS_EQUAL(writeBuf[uu].f,readBuf[uu].f)) {
- HDfprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, (double)writeBuf[uu].f, uu, (double)readBuf[uu].f);
+ if (!H5_FLT_ABS_EQUAL(writeBuf[uu].f, readBuf[uu].f)) {
+ HDfprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu,
+ (double)writeBuf[uu].f, uu, (double)readBuf[uu].f);
continue;
} /* end if */
if (writeBuf[uu].v.len != readBuf[uu].v.len) {
- HDfprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].v.len=%zu, readBuf[%d].v.len=%zu\n", __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len);
+ HDfprintf(stderr,
+ "%d: VL data length don't match!, writeBuf[%d].v.len=%zu, readBuf[%d].v.len=%zu\n",
+ __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len);
continue;
} /* end if */
- for (t1 = (hvl_t *)(writeBuf[uu].v.p), t2 = (hvl_t *)(readBuf[uu].v.p), vv = 0; (size_t)vv < readBuf[uu].v.len; vv++, t1++, t2++) {
+ for (t1 = (hvl_t *)(writeBuf[uu].v.p), t2 = (hvl_t *)(readBuf[uu].v.p), vv = 0;
+ (size_t)vv < readBuf[uu].v.len; vv++, t1++, t2++) {
if (t1->len != t2->len) {
- HDfprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", __LINE__, uu, vv, t1->len, t2->len);
+ HDfprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n",
+ __LINE__, uu, vv, t1->len, t2->len);
continue;
} /* end if */
for (ww = 0; (size_t)ww < t2->len; ww++) {
- if (((unsigned int *)t1->p)[ww] != ((unsigned int *)t2->p)[ww] ) {
- HDfprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]);
+ if (((unsigned int *)t1->p)[ww] != ((unsigned int *)t2->p)[ww]) {
+ HDfprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww,
+ ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
/* Free the buffers */
ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
if (ret < 0)
- goto error;
+ goto error;
ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
error: /* An error has occurred. Clean up and exit. */
- if (vlatomic > 0) H5Tclose(vlatomic);
- if (vlofvl > 0) H5Tclose(vlofvl);
- if (comp_vlvl > 0) H5Tclose(comp_vlvl);
- if (H5PTis_valid(ptable) > 0) H5PTclose(ptable);
- if (fid > 0) H5Fclose(fid);
+ if (vlatomic > 0)
+ H5Tclose(vlatomic);
+ if (vlofvl > 0)
+ H5Tclose(vlofvl);
+ if (comp_vlvl > 0)
+ H5Tclose(comp_vlvl);
+ if (H5PTis_valid(ptable) > 0)
+ H5PTclose(ptable);
+ if (fid > 0)
+ H5Fclose(fid);
H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
H5_FAILED();
@@ -485,19 +508,20 @@ error: /* An error has occurred. Clean up and exit. */
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-static int test_VLof_VLtype(void)
+static int
+test_VLof_VLtype(void)
{
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */
- hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */
- hsize_t count; /* Number of records in the table */
- hvl_t *t1; /* pointer to advance */
- unsigned uu, vv, ww; /* Loop variables */
- hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
- hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
- char msg[80]; /* For error message */
- herr_t ret; /* Returned status from a callee */
+ hid_t fid = H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
+ hid_t vlatomic = H5I_INVALID_HID; /* Variable length datatype */
+ hid_t vlofvl = H5I_INVALID_HID; /* VL datatype of VL datatypes */
+ hsize_t count; /* Number of records in the table */
+ hvl_t * t1; /* pointer to advance */
+ unsigned uu, vv, ww; /* Loop variables */
+ hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
+ hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
+ char msg[80]; /* For error message */
+ herr_t ret; /* Returned status from a callee */
HL_TESTING3(" with vlen datatype of vlen datatype");
@@ -509,89 +533,92 @@ static int test_VLof_VLtype(void)
goto error;
} /* end if */
writeBuf[uu].len = uu + 1;
- for (t1=(hvl_t *)(writeBuf[uu].p), vv = 0; vv < (uu + 1); vv++, t1++)
- {
+ for (t1 = (hvl_t *)(writeBuf[uu].p), vv = 0; vv < (uu + 1); vv++, t1++) {
t1->p = HDmalloc((vv + 1) * sizeof(unsigned int));
- if (t1->p == NULL) {
- HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
- goto error;
- }
+ if (t1->p == NULL) {
+ HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
+ goto error;
+ }
t1->len = vv * 1;
for (ww = 0; ww < (vv * 1); ww++)
((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww;
} /* end for */
- } /* end for */
+ } /* end for */
/* Open the file */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create a VL datatype of an atomic type */
- vlatomic = H5Tvlen_create (H5T_NATIVE_UINT);
+ vlatomic = H5Tvlen_create(H5T_NATIVE_UINT);
if (vlatomic < 0)
- goto error;
+ goto error;
- vlofvl = H5Tvlen_create (vlatomic);
+ vlofvl = H5Tvlen_create(vlatomic);
if (vlofvl < 0)
- goto error;
+ goto error;
/* Create a packet table that uses a vlen datatype of vlen datatype */
ptable = H5PTcreate(fid, PT_VLEN_VLEN, vlofvl, (hsize_t)1, H5P_DEFAULT);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Release datatypes */
if (H5Tclose(vlatomic) < 0)
- goto error;
+ goto error;
if (H5Tclose(vlofvl) < 0)
- goto error;
+ goto error;
/* Write the entire buffer to the packet table */
- ret = H5PTappend(ptable, (size_t)5, writeBuf );
+ ret = H5PTappend(ptable, (size_t)5, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Get the number of packets in the packet table, should be NRECORDS. */
ret = H5PTget_num_packets(ptable, &count);
if (ret < 0)
- goto error;
+ goto error;
HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
- ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf );
+ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void *)readBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Free the buffers */
ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
if (ret < 0)
- goto error;
+ goto error;
ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
error: /* An error has occurred. Clean up and exit. */
- if (vlatomic > 0) H5Tclose(vlatomic);
- if (vlofvl > 0) H5Tclose(vlofvl);
- if (H5PTis_valid(ptable) > 0) H5PTclose(ptable);
- if (fid > 0) H5Fclose(fid);
+ if (vlatomic > 0)
+ H5Tclose(vlatomic);
+ if (vlofvl > 0)
+ H5Tclose(vlofvl);
+ if (H5PTis_valid(ptable) > 0)
+ H5PTclose(ptable);
+ if (fid > 0)
+ H5Fclose(fid);
H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
H5_FAILED();
@@ -606,40 +633,41 @@ error: /* An error has occurred. Clean up and exit. */
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-static int verify_ptlengthtype(hid_t fid, const char *table_name, herr_t expected_value)
+static int
+verify_ptlengthtype(hid_t fid, const char *table_name, herr_t expected_value)
{
- hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
- herr_t is_varlen = 0;
- herr_t ret = FAIL;
+ hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
+ herr_t is_varlen = 0;
+ herr_t ret = FAIL;
/* Open the named packet table */
- if( (ptable = H5PTopen(fid, table_name)) < 0)
- goto error;
+ if ((ptable = H5PTopen(fid, table_name)) < 0)
+ goto error;
/* Verify the value returned from H5PTis_varlen is as expected */
is_varlen = H5PTis_varlen(ptable);
if (is_varlen == FAIL)
- goto error;
+ goto error;
else if (is_varlen == expected_value)
- ret = SUCCEED;
- else
- {
- char lenthtype[20];
- HDstrcpy(lenthtype, "fixed-length");
- if (expected_value == 1)
- HDstrcpy(lenthtype, "variable-length");
- HDfprintf(stderr, "\nPacket table '%s' should be %s but is not\n", table_name, lenthtype);
- ret = FAIL;
+ ret = SUCCEED;
+ else {
+ char lenthtype[20];
+ HDstrcpy(lenthtype, "fixed-length");
+ if (expected_value == 1)
+ HDstrcpy(lenthtype, "variable-length");
+ HDfprintf(stderr, "\nPacket table '%s' should be %s but is not\n", table_name, lenthtype);
+ ret = FAIL;
}
/* Close the packet table */
if (H5PTclose(ptable) < 0)
- goto error;
+ goto error;
return ret;
error: /* An error has occurred. Clean up and exit. */
- if (H5PTis_valid(ptable) > 0) H5PTclose(ptable);
+ if (H5PTis_valid(ptable) > 0)
+ H5PTclose(ptable);
return ret;
} /* verify_ptlengthtype */
@@ -655,67 +683,69 @@ error: /* An error has occurred. Clean up and exit. */
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-static int test_H5PTis_varlen(void)
+static int
+test_H5PTis_varlen(void)
{
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- herr_t ret; /* Returned status from a callee */
+ hid_t fid = H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
+ herr_t ret; /* Returned status from a callee */
HL_TESTING2("H5PTis_varlen");
/* Open the file */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create a new table */
ptable = H5PTcreate(fid, PT_FIXED_LEN, H5T_STD_I32BE, (hsize_t)100, H5P_DEFAULT);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
/* Open the file */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Open each packet table, and verify that H5PTis_varlen returns correct
type for each table */
ret = verify_ptlengthtype(fid, PT_VLEN_ATOMIC, 1); /* vlen of atomic */
if (ret < 0)
- goto error;
+ goto error;
ret = verify_ptlengthtype(fid, PT_VLEN_COMP, 1); /* vlen of compound */
if (ret < 0)
- goto error;
+ goto error;
ret = verify_ptlengthtype(fid, PT_COMP_VLEN, 0); /* compound of vlen, no vlen */
if (ret < 0)
- goto error;
+ goto error;
ret = verify_ptlengthtype(fid, PT_VLEN_VLEN, 1); /* vlen of vlen */
if (ret < 0)
- goto error;
+ goto error;
ret = verify_ptlengthtype(fid, PT_FIXED_LEN, 0); /* no vlen */
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
error: /* An error has occurred. Clean up and exit. */
- if (fid > 0) H5Fclose(fid);
+ if (fid > 0)
+ H5Fclose(fid);
H5_FAILED();
return FAIL;
} /* test_H5PTis_varlen */
@@ -731,60 +761,64 @@ error: /* An error has occurred. Clean up and exit. */
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-#define ATTR_RANK 1
-#define ATTR_DIM 3
-int attr_data[ATTR_DIM]={256,11945,-22107}; /* values to be written to attr */
+#define ATTR_RANK 1
+#define ATTR_DIM 3
+int attr_data[ATTR_DIM] = {256, 11945, -22107}; /* values to be written to attr */
-static int adding_attribute(hid_t fid, const char *table_name, const char *attr_name)
+static int
+adding_attribute(hid_t fid, const char *table_name, const char *attr_name)
{
- hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
- hid_t space_id = H5I_INVALID_HID; /* Dataspace for the attribute */
- hid_t attr_id = H5I_INVALID_HID; /* Attribute identifier */
- hid_t dset_id = H5I_INVALID_HID; /* Dataset identifier */
- hsize_t dims[] = {ATTR_DIM}; /* Dimension for dataspace */
- int ret = FAIL; /* Returned status from a callee */
+ hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
+ hid_t space_id = H5I_INVALID_HID; /* Dataspace for the attribute */
+ hid_t attr_id = H5I_INVALID_HID; /* Attribute identifier */
+ hid_t dset_id = H5I_INVALID_HID; /* Dataset identifier */
+ hsize_t dims[] = {ATTR_DIM}; /* Dimension for dataspace */
+ int ret = FAIL; /* Returned status from a callee */
/* Create dataspace for attribute */
space_id = H5Screate_simple(ATTR_RANK, dims, NULL);
if (space_id < 0)
- goto error;
+ goto error;
/* Open the named packet table */
- if( (ptable = H5PTopen(fid, table_name)) < 0)
- goto error;
+ if ((ptable = H5PTopen(fid, table_name)) < 0)
+ goto error;
dset_id = H5PTget_dataset(ptable);
if (dset_id < 0)
- goto error;
+ goto error;
/* Add the specified attribute to it */
attr_id = H5Acreate2(dset_id, attr_name, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT);
if (attr_id < 0)
- goto error;
+ goto error;
/* Write attribute values */
ret = H5Awrite(attr_id, H5T_NATIVE_INT, attr_data);
if (ret < 0)
- goto error;
+ goto error;
/* Close the attribute */
if (H5Aclose(attr_id) < 0)
- goto error;
+ goto error;
/* Close the dataspace */
if (H5Sclose(space_id) < 0)
- goto error;
+ goto error;
/* Close the packet table */
if (H5PTclose(ptable) < 0)
- goto error;
+ goto error;
return SUCCEED;
error: /* An error has occurred. Clean up and exit. */
- if (attr_id > 0) H5Aclose(attr_id);
- if (space_id > 0) H5Sclose(space_id);
- if (H5PTis_valid(ptable) > 0) H5PTclose(ptable);
+ if (attr_id > 0)
+ H5Aclose(attr_id);
+ if (space_id > 0)
+ H5Sclose(space_id);
+ if (H5PTis_valid(ptable) > 0)
+ H5PTclose(ptable);
return ret;
} /* adding_attribute */
@@ -795,53 +829,57 @@ error: /* An error has occurred. Clean up and exit. */
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-static herr_t verify_attribute(hid_t fid, const char *table_name, const char *attr_name)
+static herr_t
+verify_attribute(hid_t fid, const char *table_name, const char *attr_name)
{
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t attr_id=H5I_INVALID_HID; /* Attribute identifier */
- hid_t dset_id=H5I_INVALID_HID; /* Dataset associated with the pt */
- int read_data[ATTR_DIM]; /* Output buffer */
- int ii;
- herr_t ret = FAIL; /* Returned status from a callee */
+ hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
+ hid_t attr_id = H5I_INVALID_HID; /* Attribute identifier */
+ hid_t dset_id = H5I_INVALID_HID; /* Dataset associated with the pt */
+ int read_data[ATTR_DIM]; /* Output buffer */
+ int ii;
+ herr_t ret = FAIL; /* Returned status from a callee */
/* Open the named packet table */
ptable = H5PTopen(fid, table_name);
if (ptable < 0)
- goto error;
+ goto error;
/* Get the dataset id of this packet table */
dset_id = H5PTget_dataset(ptable);
if (dset_id < 0)
- goto error;
+ goto error;
/* Open first attribute for the dataset */
attr_id = H5Aopen(dset_id, attr_name, H5P_DEFAULT);
if (attr_id < 0)
- goto error;
+ goto error;
/* Read attribute values */
ret = H5Aread(attr_id, H5T_NATIVE_INT, read_data);
if (ret < 0)
- goto error;
+ goto error;
/* Verify values read in */
for (ii = 0; ii < ATTR_DIM; ii++)
if (attr_data[ii] != read_data[ii])
- TestErrPrintf("%d: attribute data different: attr_data[%d]=%d, read_data[%d]=%d\n", __LINE__, ii, attr_data[ii], ii, read_data[ii]);
+ TestErrPrintf("%d: attribute data different: attr_data[%d]=%d, read_data[%d]=%d\n", __LINE__, ii,
+ attr_data[ii], ii, read_data[ii]);
/* Close the attribute */
if (H5Aclose(attr_id) < 0)
- goto error;
+ goto error;
/* Close the packet table */
if (H5PTclose(ptable) < 0)
- goto error;
+ goto error;
return SUCCEED;
error: /* An error has occurred. Clean up and exit. */
- if (attr_id > 0) H5Aclose(attr_id);
- if (H5PTis_valid(ptable) > 0) H5PTclose(ptable);
+ if (attr_id > 0)
+ H5Aclose(attr_id);
+ if (H5PTis_valid(ptable) > 0)
+ H5PTclose(ptable);
return ret;
} /* verify_attribute */
@@ -854,59 +892,61 @@ error: /* An error has occurred. Clean up and exit. */
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-static int test_attributes(void)
+static int
+test_attributes(void)
{
- hid_t fid=H5I_INVALID_HID; /* File identifier */
- hid_t attr_id=H5I_INVALID_HID; /* Attribute identifier */
- herr_t ret = FAIL; /* Returned status from a callee */
+ hid_t fid = H5I_INVALID_HID; /* File identifier */
+ hid_t attr_id = H5I_INVALID_HID; /* Attribute identifier */
+ herr_t ret = FAIL; /* Returned status from a callee */
HL_TESTING2("adding attributes to packet tables");
/* Open the file */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Add an arbitrary attribute to a few packet tables, using helper func */
attr_id = adding_attribute(fid, PT_VLEN_ATOMIC, "Attribute 1");
if (attr_id < 0)
- goto error;
+ goto error;
attr_id = adding_attribute(fid, PT_VLEN_COMP, "Attribute 2");
if (attr_id < 0)
- goto error;
+ goto error;
attr_id = adding_attribute(fid, PT_COMP_VLEN, "Attribute 3");
if (attr_id < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
/* Open the file again */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Read each attribute and verify the values, using helper function */
ret = verify_attribute(fid, PT_VLEN_ATOMIC, "Attribute 1");
if (ret < 0)
- goto error;
+ goto error;
ret = verify_attribute(fid, PT_VLEN_COMP, "Attribute 2");
if (ret < 0)
- goto error;
+ goto error;
ret = verify_attribute(fid, PT_COMP_VLEN, "Attribute 3");
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
- return(ret);
+ return (ret);
error: /* An error has occurred. Clean up and exit. */
- if (fid > 0) H5Fclose(fid);
+ if (fid > 0)
+ H5Fclose(fid);
H5_FAILED();
return FAIL;
} /* test_attributes */
@@ -928,35 +968,36 @@ error: /* An error has occurred. Clean up and exit. */
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-static herr_t verify_accessors(hid_t fid, const char *table_name, hbool_t uses_vlen_type)
+static herr_t
+verify_accessors(hid_t fid, const char *table_name, hbool_t uses_vlen_type)
{
- hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
- hid_t dset_id = H5I_INVALID_HID; /* Dataset associated with the pt */
- hid_t dtype_id = H5I_INVALID_HID; /* Dataset identifier */
- char buf[NAME_BUF_SIZE];
+ hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
+ hid_t dset_id = H5I_INVALID_HID; /* Dataset associated with the pt */
+ hid_t dtype_id = H5I_INVALID_HID; /* Dataset identifier */
+ char buf[NAME_BUF_SIZE];
ssize_t name_size;
- htri_t vlen_check_result = -1;
+ htri_t vlen_check_result = -1;
/* Open the named packet table. */
- if((ptable = H5PTopen(fid, table_name)) < 0)
+ if ((ptable = H5PTopen(fid, table_name)) < 0)
goto error;
/* Get the associated dataset ID. */
- if((dset_id = H5PTget_dataset(ptable)) < 0)
+ if ((dset_id = H5PTget_dataset(ptable)) < 0)
goto error;
/* Check if the packet table's name matches its associated dataset's. */
*buf = '\0';
- if((name_size = H5Iget_name(dset_id, (char*)buf, NAME_BUF_SIZE)) < 0)
+ if ((name_size = H5Iget_name(dset_id, (char *)buf, NAME_BUF_SIZE)) < 0)
goto error;
VERIFY(HDstrcmp(buf, table_name), "Names of dataset and packet table don't match");
/* Get the packet table's datatype ID */
- if((dtype_id = H5PTget_type(ptable)) < 0)
+ if ((dtype_id = H5PTget_type(ptable)) < 0)
goto error;
/* Check if the type class matches that of the packet table. */
- if((vlen_check_result = H5Tdetect_class(dtype_id, H5T_VLEN)) < 0)
+ if ((vlen_check_result = H5Tdetect_class(dtype_id, H5T_VLEN)) < 0)
goto error;
/* Check if length types match */
@@ -996,10 +1037,11 @@ error: /* An error has occurred. Clean up and exit. */
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-static int test_accessors(void)
+static int
+test_accessors(void)
{
- hid_t fid=H5I_INVALID_HID; /* File identifier */
- herr_t ret = FAIL; /* Returned status from a callee */
+ hid_t fid = H5I_INVALID_HID; /* File identifier */
+ herr_t ret = FAIL; /* Returned status from a callee */
HL_TESTING2("accessor functions");
@@ -1044,17 +1086,18 @@ error: /* An error has occurred. Clean up and exit. */
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-static int testfl_VLof_atomic(void)
+static int
+testfl_VLof_atomic(void)
{
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */
- hsize_t count; /* Number of records in the table */
- unsigned uu, vv; /* Loop variables */
- hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
- hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
- char msg[80]; /* For error message */
- herr_t ret; /* Returned status from a callee */
+ hid_t fid = H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
+ hid_t vltype = H5I_INVALID_HID; /* Variable length datatype */
+ hsize_t count; /* Number of records in the table */
+ unsigned uu, vv; /* Loop variables */
+ hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
+ hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
+ char msg[80]; /* For error message */
+ herr_t ret; /* Returned status from a callee */
HL_TESTING3(" with vlen of atomic");
@@ -1064,84 +1107,86 @@ static int testfl_VLof_atomic(void)
if (writeBuf[uu].p == NULL) {
HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
- }
+ }
writeBuf[uu].len = uu + 1;
for (vv = 0; vv < (uu + 1); vv++)
- ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv;
+ ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv;
} /* end for */
/* Open the file */
fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create a vlen type that uses an atomic datatype as its base type */
- vltype = H5Tvlen_create (H5T_NATIVE_UINT);
+ vltype = H5Tvlen_create(H5T_NATIVE_UINT);
if (vltype < 0)
- goto error;
+ goto error;
/* Create a packet table that uses a vlen datatype of an atomic type */
ptable = H5PTcreate_fl(fid, PT_VLEN_ATOMIC, vltype, (hsize_t)1, 0);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Close the vlen datatype */
if (H5Tclose(vltype) < 0)
- goto error;
+ goto error;
/* Write the entire buffer to the packet table */
ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Get the number of packets in the packet table, should be NRECORDS. */
ret = H5PTget_num_packets(ptable, &count);
if (ret < 0)
- goto error;
+ goto error;
HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
- ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf );
+ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void *)readBuf);
if (ret < 0)
- goto error;
+ goto error;
for (uu = 0; uu < NRECORDS; uu++)
- for (vv = 0; vv < (uu + 1); vv++)
- {
- if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) {
- HDprintf("Packet %d's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]);
- HDprintf("Packet %d's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]);
- }
+ for (vv = 0; vv < (uu + 1); vv++) {
+ if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) {
+ HDprintf("Packet %d's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]);
+ HDprintf("Packet %d's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]);
+ }
}
/* Free the buffers */
- ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf );
+ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
if (ret < 0)
- goto error;
+ goto error;
ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
error: /* An error has occurred. Clean up and exit. */
- if (vltype > 0) H5Tclose(vltype);
- if (H5PTis_valid(ptable) > 0) H5PTclose(ptable);
- if (fid > 0) H5Fclose(fid);
+ if (vltype > 0)
+ H5Tclose(vltype);
+ if (H5PTis_valid(ptable) > 0)
+ H5PTclose(ptable);
+ if (fid > 0)
+ H5Fclose(fid);
H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
H5_FAILED();
@@ -1155,134 +1200,142 @@ error: /* An error has occurred. Clean up and exit. */
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-static int testfl_VLof_comptype(void)
+static int
+testfl_VLof_comptype(void)
{
/* Struct that the VL sequences are composed of */
typedef struct {
unsigned u;
- float f;
+ float f;
} VLcomp_t;
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */
- hid_t cmptype=H5I_INVALID_HID; /* Compound datatype */
- hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
- hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
- hsize_t count; /* Number of records in the table */
- unsigned uu, vv; /* Loop variables */
- char msg[80]; /* For error message */
- herr_t ret;
+ hid_t fid = H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
+ hid_t vltype = H5I_INVALID_HID; /* Variable length datatype */
+ hid_t cmptype = H5I_INVALID_HID; /* Compound datatype */
+ hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
+ hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
+ hsize_t count; /* Number of records in the table */
+ unsigned uu, vv; /* Loop variables */
+ char msg[80]; /* For error message */
+ herr_t ret;
HL_TESTING3(" with vlen of compound datatypes");
/* Allocate and initialize VL data to write (copied from C test) */
for (uu = 0; uu < NRECORDS; uu++) {
writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(VLcomp_t));
- if(writeBuf[uu].p == NULL) {
+ if (writeBuf[uu].p == NULL) {
HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
- }
+ }
writeBuf[uu].len = uu + 1;
for (vv = 0; vv < (uu + 1); vv++) {
((VLcomp_t *)writeBuf[uu].p)[vv].u = uu + vv;
((VLcomp_t *)writeBuf[uu].p)[vv].f = (float)(uu + vv) / 3.0F;
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Open the file */
fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create the base compound type */
cmptype = H5Tcreate(H5T_COMPOUND, sizeof(VLcomp_t));
if (cmptype < 0)
- goto error;
+ goto error;
/* Insert fields */
ret = H5Tinsert(cmptype, "u", HOFFSET(VLcomp_t, u), H5T_NATIVE_UINT);
if (ret < 0)
- goto error;
+ goto error;
ret = H5Tinsert(cmptype, "f", HOFFSET(VLcomp_t, f), H5T_NATIVE_FLOAT);
if (ret < 0)
- goto error;
+ goto error;
/* Create a variable length type that uses the VLcomp_t as its base type */
vltype = H5Tvlen_create(cmptype);
if (vltype < 0)
- goto error;
+ goto error;
/* Create a packet table that uses a vlen datatype of compound datatype */
ptable = H5PTcreate_fl(fid, PT_VLEN_COMP, vltype, (hsize_t)1, 0);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Release the datatypes */
if (H5Tclose(cmptype) < 0)
- goto error;
+ goto error;
if (H5Tclose(vltype) < 0)
- goto error;
+ goto error;
/* Write the entire buffer to the packet table */
- ret = H5PTappend(ptable, (size_t)5, writeBuf );
+ ret = H5PTappend(ptable, (size_t)5, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Get the number of packets in the packet table, should be NRECORDS. */
ret = H5PTget_num_packets(ptable, &count);
if (ret < 0)
- goto error;
+ goto error;
HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
- ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf );
+ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void *)readBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Compare data read in */
for (uu = 0; uu < NRECORDS; uu++) {
if (writeBuf[uu].len != readBuf[uu].len) {
- HDfprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%zu, readBuf[%u].len=%zu\n",__LINE__, uu, writeBuf[uu].len, uu, readBuf[uu].len);
- continue;
- } /* write len != read len */
+ HDfprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%zu, readBuf[%u].len=%zu\n",
+ __LINE__, uu, writeBuf[uu].len, uu, readBuf[uu].len);
+ continue;
+ } /* write len != read len */
for (vv = 0; vv < (uu + 1); vv++) {
- if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv] ) {
- HDfprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%u]=%u, readBuf[uu].p[%u]=%u\n", vv, ((unsigned int *)writeBuf[uu].p)[vv], vv, ((unsigned int *)readBuf[uu].p)[vv]);
+ if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv]) {
+ HDfprintf(stderr,
+ "VL data values don't match!, writeBuf[uu].p[%u]=%u, readBuf[uu].p[%u]=%u\n", vv,
+ ((unsigned int *)writeBuf[uu].p)[vv], vv, ((unsigned int *)readBuf[uu].p)[vv]);
continue;
- } /* write value != read value */
- }
+ } /* write value != read value */
+ }
} /* end for */
/* Free the buffers */
ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
if (ret < 0)
- goto error;
+ goto error;
ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
error: /* An error has occurred. Clean up and exit. */
- if (cmptype > 0) H5Tclose(cmptype);
- if (vltype > 0) H5Tclose(vltype);
- if (H5PTis_valid(ptable) > 0) H5PTclose(ptable);
- if (fid > 0) H5Fclose(fid);
+ if (cmptype > 0)
+ H5Tclose(cmptype);
+ if (vltype > 0)
+ H5Tclose(vltype);
+ if (H5PTis_valid(ptable) > 0)
+ H5PTclose(ptable);
+ if (fid > 0)
+ H5Fclose(fid);
H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
H5_FAILED();
@@ -1297,173 +1350,185 @@ error: /* An error has occurred. Clean up and exit. */
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-static int testfl_compound_VL_VLtype(void)
+static int
+testfl_compound_VL_VLtype(void)
{
/* Struct that the VL sequences are composed of */
typedef struct {
unsigned u;
- float f;
- hvl_t v;
+ float f;
+ hvl_t v;
} compVLVL_t;
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */
- hid_t vlofvl=H5I_INVALID_HID; /* Variable length datatype */
- hid_t comp_vlvl=H5I_INVALID_HID; /* ID of a compound datatype containing
- a VL of VL of atomic datatype */
- hsize_t count; /* Number of records in the table */
- compVLVL_t writeBuf[NRECORDS];/* Buffer to hold data to be written */
- compVLVL_t readBuf[NRECORDS]; /* Buffer to hold read data */
- hvl_t *t1, *t2;
- unsigned uu, vv, ww; /* Loop variables */
- char msg[80]; /* For error message */
- herr_t ret; /* Returned status from a callee */
+ hid_t fid = H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
+ hid_t vlatomic = H5I_INVALID_HID; /* Variable length datatype */
+ hid_t vlofvl = H5I_INVALID_HID; /* Variable length datatype */
+ hid_t comp_vlvl = H5I_INVALID_HID; /* ID of a compound datatype containing
+ a VL of VL of atomic datatype */
+ hsize_t count; /* Number of records in the table */
+ compVLVL_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
+ compVLVL_t readBuf[NRECORDS]; /* Buffer to hold read data */
+ hvl_t * t1, *t2;
+ unsigned uu, vv, ww; /* Loop variables */
+ char msg[80]; /* For error message */
+ herr_t ret; /* Returned status from a callee */
HL_TESTING3(" with compound datatype containing vlen datatype");
/* Allocate and initialize VL data to write (copied from C test) */
for (uu = 0; uu < NRECORDS; uu++) {
- writeBuf[uu].u = uu * 10;
- writeBuf[uu].f = (float)(uu * 20) / 3.0F;
+ writeBuf[uu].u = uu * 10;
+ writeBuf[uu].f = (float)(uu * 20) / 3.0F;
writeBuf[uu].v.p = HDmalloc((uu + L1_INCM) * sizeof(hvl_t));
if (writeBuf[uu].v.p == NULL) {
HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
- }
+ }
writeBuf[uu].v.len = uu + L1_INCM;
- for (t1 = (hvl_t *)((writeBuf[uu].v).p), vv = 0; vv < (uu + L1_INCM); vv++, t1++)
- {
+ for (t1 = (hvl_t *)((writeBuf[uu].v).p), vv = 0; vv < (uu + L1_INCM); vv++, t1++) {
t1->p = HDmalloc((vv + L2_INCM) * sizeof(unsigned int));
- if (t1->p == NULL) {
- HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
- goto error;
- }
+ if (t1->p == NULL) {
+ HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
+ goto error;
+ }
t1->len = vv + L2_INCM;
for (ww = 0; ww < vv + L2_INCM; ww++)
- ((unsigned int*)t1->p)[ww] = uu * 100 + vv * 10 + ww;
+ ((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww;
}
} /* end for */
/* Open the file */
fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create a VL datatype of an atomic type */
- vlatomic = H5Tvlen_create (H5T_NATIVE_UINT);
+ vlatomic = H5Tvlen_create(H5T_NATIVE_UINT);
if (vlatomic < 0)
- goto error;
+ goto error;
/* Create a VL datatype of the VL of atomic datatype */
- vlofvl = H5Tvlen_create (vlatomic);
+ vlofvl = H5Tvlen_create(vlatomic);
if (vlofvl < 0)
- goto error;
+ goto error;
/* Create the base compound type */
comp_vlvl = H5Tcreate(H5T_COMPOUND, sizeof(compVLVL_t));
if (comp_vlvl < 0)
- goto error;
+ goto error;
/* Insert fields: atomic, atomic, vlen */
ret = H5Tinsert(comp_vlvl, "u", HOFFSET(compVLVL_t, u), H5T_NATIVE_UINT);
if (ret < 0)
- goto error;
+ goto error;
ret = H5Tinsert(comp_vlvl, "f", HOFFSET(compVLVL_t, f), H5T_NATIVE_FLOAT);
if (ret < 0)
- goto error;
+ goto error;
ret = H5Tinsert(comp_vlvl, "v", HOFFSET(compVLVL_t, v), vlofvl);
if (ret < 0)
- goto error;
+ goto error;
/* Create a packet table that uses a compound datatype of vlen datatype */
ptable = H5PTcreate_fl(fid, PT_COMP_VLEN, comp_vlvl, (hsize_t)1, 0);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Release datatypes */
if (H5Tclose(vlatomic) < 0)
- goto error;
+ goto error;
if (H5Tclose(vlofvl) < 0)
- goto error;
+ goto error;
if (H5Tclose(comp_vlvl) < 0)
- goto error;
+ goto error;
/* Write the entire buffer to the packet table */
- ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf );
+ ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Get the number of packets in the packet table, should be NRECORDS. */
ret = H5PTget_num_packets(ptable, &count);
if (ret < 0)
- goto error;
+ goto error;
HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
- ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf );
+ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void *)readBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Compare data read in */
for (uu = 0; uu < NRECORDS; uu++) {
if (writeBuf[uu].u != readBuf[uu].u) {
- HDfprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, writeBuf[uu].u, uu, readBuf[uu].u);
+ HDfprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu,
+ writeBuf[uu].u, uu, readBuf[uu].u);
continue;
} /* end if */
if (!H5_FLT_ABS_EQUAL(writeBuf[uu].f, readBuf[uu].f)) {
- HDfprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, (double)writeBuf[uu].f, uu, (double)readBuf[uu].f);
+ HDfprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu,
+ (double)writeBuf[uu].f, uu, (double)readBuf[uu].f);
continue;
} /* end if */
if (writeBuf[uu].v.len != readBuf[uu].v.len) {
- HDfprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].v.len=%zu, readBuf[%u].v.len=%zu\n", __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len);
+ HDfprintf(stderr,
+ "%d: VL data length don't match!, writeBuf[%u].v.len=%zu, readBuf[%u].v.len=%zu\n",
+ __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len);
continue;
} /* end if */
- for (t1 = (hvl_t *)(writeBuf[uu].v.p), t2 = (hvl_t *)(readBuf[uu].v.p), vv = 0; (size_t)vv < readBuf[uu].v.len; vv++, t1++, t2++) {
+ for (t1 = (hvl_t *)(writeBuf[uu].v.p), t2 = (hvl_t *)(readBuf[uu].v.p), vv = 0;
+ (size_t)vv < readBuf[uu].v.len; vv++, t1++, t2++) {
if (t1->len != t2->len) {
- HDfprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", __LINE__, uu, vv, t1->len, t2->len);
+ HDfprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n",
+ __LINE__, uu, vv, t1->len, t2->len);
continue;
} /* end if */
for (ww = 0; (size_t)ww < t2->len; ww++) {
- if (((unsigned int *)t1->p)[ww] != ((unsigned int *)t2->p)[ww] ) {
- HDfprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]);
+ if (((unsigned int *)t1->p)[ww] != ((unsigned int *)t2->p)[ww]) {
+ HDfprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww,
+ ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]);
continue;
} /* end if */
- } /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
/* Free the buffers */
ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
if (ret < 0)
- goto error;
+ goto error;
ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
error: /* An error has occurred. Clean up and exit. */
- if (vlatomic > 0) H5Tclose(vlatomic);
- if (vlofvl > 0) H5Tclose(vlofvl);
- if (comp_vlvl > 0) H5Tclose(comp_vlvl);
- if (H5PTis_valid(ptable) > 0) H5PTclose(ptable);
- if (fid > 0) H5Fclose(fid);
+ if (vlatomic > 0)
+ H5Tclose(vlatomic);
+ if (vlofvl > 0)
+ H5Tclose(vlofvl);
+ if (comp_vlvl > 0)
+ H5Tclose(comp_vlvl);
+ if (H5PTis_valid(ptable) > 0)
+ H5PTclose(ptable);
+ if (fid > 0)
+ H5Fclose(fid);
H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
H5_FAILED();
@@ -1478,19 +1543,20 @@ error: /* An error has occurred. Clean up and exit. */
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-static int testfl_VLof_VLtype(void)
+static int
+testfl_VLof_VLtype(void)
{
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */
- hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */
- hsize_t count; /* Number of records in the table */
- hvl_t *t1; /* pointer to advance */
- unsigned uu, vv, ww; /* Loop variables */
- hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
- hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
- char msg[80]; /* For error message */
- herr_t ret; /* Returned status from a callee */
+ hid_t fid = H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
+ hid_t vlatomic = H5I_INVALID_HID; /* Variable length datatype */
+ hid_t vlofvl = H5I_INVALID_HID; /* VL datatype of VL datatypes */
+ hsize_t count; /* Number of records in the table */
+ hvl_t * t1; /* pointer to advance */
+ unsigned uu, vv, ww; /* Loop variables */
+ hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
+ hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
+ char msg[80]; /* For error message */
+ herr_t ret; /* Returned status from a callee */
HL_TESTING3(" with vlen datatype of vlen datatype");
@@ -1502,89 +1568,92 @@ static int testfl_VLof_VLtype(void)
goto error;
} /* end if */
writeBuf[uu].len = uu + 1;
- for (t1 = (hvl_t *)(writeBuf[uu].p), vv = 0; vv < (uu + 1); vv++, t1++)
- {
+ for (t1 = (hvl_t *)(writeBuf[uu].p), vv = 0; vv < (uu + 1); vv++, t1++) {
t1->p = HDmalloc((vv + 1) * sizeof(unsigned int));
- if (t1->p == NULL) {
- HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
- goto error;
- }
+ if (t1->p == NULL) {
+ HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
+ goto error;
+ }
t1->len = vv + 1;
for (ww = 0; ww < (vv + 1); ww++)
((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww;
} /* end for */
- } /* end for */
+ } /* end for */
/* Open the file */
fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create a VL datatype of an atomic type */
- vlatomic = H5Tvlen_create (H5T_NATIVE_UINT);
+ vlatomic = H5Tvlen_create(H5T_NATIVE_UINT);
if (vlatomic < 0)
- goto error;
+ goto error;
- vlofvl = H5Tvlen_create (vlatomic);
+ vlofvl = H5Tvlen_create(vlatomic);
if (vlofvl < 0)
- goto error;
+ goto error;
/* Create a packet table that uses a vlen datatype of vlen datatype */
ptable = H5PTcreate_fl(fid, PT_VLEN_VLEN, vlofvl, (hsize_t)1, 0);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Release datatypes */
if (H5Tclose(vlatomic) < 0)
- goto error;
+ goto error;
if (H5Tclose(vlofvl) < 0)
- goto error;
+ goto error;
/* Write the entire buffer to the packet table */
- ret = H5PTappend(ptable, (size_t)5, writeBuf );
+ ret = H5PTappend(ptable, (size_t)5, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Get the number of packets in the packet table, should be NRECORDS. */
ret = H5PTget_num_packets(ptable, &count);
if (ret < 0)
- goto error;
+ goto error;
HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
- ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf );
+ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void *)readBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Free the buffers */
ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
if (ret < 0)
- goto error;
+ goto error;
ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
error: /* An error has occurred. Clean up and exit. */
- if (vlatomic > 0) H5Tclose(vlatomic);
- if (vlofvl > 0) H5Tclose(vlofvl);
- if (H5PTis_valid(ptable) > 0) H5PTclose(ptable);
- if (fid > 0) H5Fclose(fid);
+ if (vlatomic > 0)
+ H5Tclose(vlatomic);
+ if (vlofvl > 0)
+ H5Tclose(vlofvl);
+ if (H5PTis_valid(ptable) > 0)
+ H5PTclose(ptable);
+ if (fid > 0)
+ H5Fclose(fid);
H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
H5_FAILED();
@@ -1599,19 +1668,20 @@ error: /* An error has occurred. Clean up and exit. */
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-int test_packet_table_with_varlen(void)
+int
+test_packet_table_with_varlen(void)
{
- hid_t fid=H5I_INVALID_HID; /* File identifier */
- int status = SUCCEED;
+ hid_t fid = H5I_INVALID_HID; /* File identifier */
+ int status = SUCCEED;
/* Create a file using default properties */
fid = H5Fcreate(TEST_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid < 0)
- return FAIL;
+ return FAIL;
/* Close the file. The file will be opened by each test function below */
if (H5Fclose(fid) < 0)
- return FAIL;
+ return FAIL;
HDputs("Testing packet table with various variable-length datatypes");
@@ -1620,46 +1690,46 @@ int test_packet_table_with_varlen(void)
/* Test variable length of a simple type */
if (test_VLof_atomic() < 0)
- status = FAIL;
+ status = FAIL;
/* Test variable length of a compound type */
if (test_VLof_comptype() < 0)
- status = FAIL;
+ status = FAIL;
/* Test compound type with variable length */
if (test_compound_VL_VLtype() < 0)
- status = FAIL;
+ status = FAIL;
/* Test variable length of a variable length */
if (test_VLof_VLtype() < 0)
- status = FAIL;
+ status = FAIL;
/* Test variable length of a variable length */
if (test_H5PTis_varlen() < 0)
- status = FAIL;
+ status = FAIL;
/* Test adding attributes to packet table */
if (test_attributes() < 0)
- status = FAIL;
+ status = FAIL;
/* Test accessor functions */
if (test_accessors() < 0)
- status = FAIL;
+ status = FAIL;
-/**************************************************************************
- Calling test functions for deprecated function H5PTcreate_fl
- Mar 2016, -BMR
+ /**************************************************************************
+ Calling test functions for deprecated function H5PTcreate_fl
+ Mar 2016, -BMR
-**************************************************************************/
+ **************************************************************************/
/* Create a file using default properties */
fid = H5Fcreate(TESTFL_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid < 0)
- return FAIL;
+ return FAIL;
/* Close the file. The file will be opened by each test function below */
if (H5Fclose(fid) < 0)
- return FAIL;
+ return FAIL;
HDputs("Testing packet table with various variable-length datatypes - H5PTcreate_fl");
@@ -1668,19 +1738,19 @@ int test_packet_table_with_varlen(void)
/* Test variable length of a simple type */
if (testfl_VLof_atomic() < 0)
- status = FAIL;
+ status = FAIL;
/* Test variable length of a compound type */
if (testfl_VLof_comptype() < 0)
- status = FAIL;
+ status = FAIL;
/* Test compound type with variable length */
if (testfl_compound_VL_VLtype() < 0)
- status = FAIL;
+ status = FAIL;
/* Test variable length of a variable length */
if (testfl_VLof_VLtype() < 0)
- status = FAIL;
+ status = FAIL;
- return(status);
+ return (status);
}
diff --git a/hl/test/test_table.c b/hl/test/test_table.c
index cd2e2a4..2f98f4a 100644
--- a/hl/test/test_table.c
+++ b/hl/test/test_table.c
@@ -1,60 +1,58 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5hltest.h"
#include "H5srcdir.h"
#include "H5TBpublic.h"
-#define TEST_FILE_BE "test_table_be.h5"
-#define TEST_FILE_LE "test_table_le.h5"
+#define TEST_FILE_BE "test_table_be.h5"
+#define TEST_FILE_LE "test_table_le.h5"
#define TEST_FILE_CRAY "test_table_cray.h5"
-
/*-------------------------------------------------------------------------
-* Table API test
-*
-* Functions tested:
-*
-* H5TBmake_table
-* H5TBread_table
-* H5TBwrite_records
-* H5TBread_records
-* H5TBappend_records
-* H5TBinsert_record
-* H5TBdelete_record
-* H5TBcombine_tables
-* H5TBwrite_fields_name
-* H5TBread_fields_name
-* H5TBwrite_fields_index
-* H5TBinsert_field
-* H5TBdelete_field
-* H5TBget_table_info
-* H5TBget_field_info
-*
-*-------------------------------------------------------------------------
-*/
-
-#define TITLE "Title"
-#define NFIELDS 5
-#define NRECORDS 8
-#define NRECORDS_ADD 3
+ * Table API test
+ *
+ * Functions tested:
+ *
+ * H5TBmake_table
+ * H5TBread_table
+ * H5TBwrite_records
+ * H5TBread_records
+ * H5TBappend_records
+ * H5TBinsert_record
+ * H5TBdelete_record
+ * H5TBcombine_tables
+ * H5TBwrite_fields_name
+ * H5TBread_fields_name
+ * H5TBwrite_fields_index
+ * H5TBinsert_field
+ * H5TBdelete_field
+ * H5TBget_table_info
+ * H5TBget_field_info
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#define TITLE "Title"
+#define NFIELDS 5
+#define NRECORDS 8
+#define NRECORDS_ADD 3
/*-------------------------------------------------------------------------
-* structure used for all tests, a particle with properties
-*-------------------------------------------------------------------------
-*/
-typedef struct particle_t
-{
+ * structure used for all tests, a particle with properties
+ *-------------------------------------------------------------------------
+ */
+typedef struct particle_t {
char name[16];
long longi;
float pressure;
@@ -63,31 +61,28 @@ typedef struct particle_t
} particle_t;
/*-------------------------------------------------------------------------
-* a subset of particle_t, with latitude and longitude fields
-*-------------------------------------------------------------------------
-*/
-typedef struct position_t
-{
- long longi;
- int lati;
+ * a subset of particle_t, with latitude and longitude fields
+ *-------------------------------------------------------------------------
+ */
+typedef struct position_t {
+ long longi;
+ int lati;
} position_t;
/*-------------------------------------------------------------------------
-* a subset of particle_t, with name and pressure fields
-*-------------------------------------------------------------------------
-*/
-typedef struct namepressure_t
-{
- char name[16];
- float pressure;
+ * a subset of particle_t, with name and pressure fields
+ *-------------------------------------------------------------------------
+ */
+typedef struct namepressure_t {
+ char name[16];
+ float pressure;
} namepressure_t;
/*-------------------------------------------------------------------------
-* an extended particle, used in the insert field test
-*-------------------------------------------------------------------------
-*/
-typedef struct particle2_t
-{
+ * an extended particle, used in the insert field test
+ *-------------------------------------------------------------------------
+ */
+typedef struct particle2_t {
char name[16];
long longi;
float pressure;
@@ -97,11 +92,10 @@ typedef struct particle2_t
} particle2_t;
/*-------------------------------------------------------------------------
-* a particle with one field less, used in the delete field test
-*-------------------------------------------------------------------------
-*/
-typedef struct particle3_t
-{
+ * a particle with one field less, used in the delete field test
+ *-------------------------------------------------------------------------
+ */
+typedef struct particle3_t {
char name[16];
long longi;
double temperature;
@@ -116,35 +110,34 @@ typedef struct particle3_t
/* Push current alignment rule forcing 4-byte alignment boundary
* to the internal stack ...
*/
-#pragma pack(push,4)
- typedef struct particle4_t {
- uint32_t state;
- double posx;
- double posy;
- float atx[3];
- float aty[3];
- float rro[2];
- } particle4_t;
+#pragma pack(push, 4)
+typedef struct particle4_t {
+ uint32_t state;
+ double posx;
+ double posy;
+ float atx[3];
+ float aty[3];
+ float rro[2];
+} particle4_t;
/*
* ... and restore original alignment rules from stack
*/
#pragma pack(pop)
-
/*-------------------------------------------------------------------------
-* function to open an HDF5 file and return its file identifier
-*-------------------------------------------------------------------------
-*/
-static hid_t h5file_open(const char *fname, unsigned flags)
+ * function to open an HDF5 file and return its file identifier
+ *-------------------------------------------------------------------------
+ */
+static hid_t
+h5file_open(const char *fname, unsigned flags)
{
- hid_t fid; /* identifier for the file */
+ hid_t fid; /* identifier for the file */
const char *data_file = H5_get_srcdir_filename(fname);
/* open */
- if ((fid = H5Fopen(data_file,flags,H5P_DEFAULT))<0)
- {
- HDfprintf(stderr,"Error: Cannot open file <%s>\n",data_file );
+ if ((fid = H5Fopen(data_file, flags, H5P_DEFAULT)) < 0) {
+ HDfprintf(stderr, "Error: Cannot open file <%s>\n", data_file);
HDexit(1);
}
@@ -152,74 +145,68 @@ static hid_t h5file_open(const char *fname, unsigned flags)
}
/*-------------------------------------------------------------------------
-* function that compares one particle
-*-------------------------------------------------------------------------
-*/
-static int cmp_par(hsize_t i, hsize_t j, particle_t *rbuf, particle_t *wbuf )
+ * function that compares one particle
+ *-------------------------------------------------------------------------
+ */
+static int
+cmp_par(hsize_t i, hsize_t j, particle_t *rbuf, particle_t *wbuf)
{
- if ( ( HDstrcmp( rbuf[i].name, wbuf[j].name ) != 0 ) ||
- rbuf[i].lati != wbuf[j].lati ||
- rbuf[i].longi != wbuf[j].longi ||
- !H5_FLT_ABS_EQUAL(rbuf[i].pressure,wbuf[j].pressure) ||
- !H5_DBL_ABS_EQUAL(rbuf[i].temperature,wbuf[j].temperature) )
- {
- HDfprintf(stderr,"read and write buffers have differences\n");
- HDfprintf(stderr,"%s %ld %f %f %d\n",
- rbuf[i].name,rbuf[i].longi,(double)rbuf[i].pressure,rbuf[i].temperature,rbuf[i].lati);
- HDfprintf(stderr,"%s %ld %f %f %d\n",
- wbuf[j].name,wbuf[j].longi,(double)wbuf[j].pressure,wbuf[j].temperature,wbuf[j].lati);
+ if ((HDstrcmp(rbuf[i].name, wbuf[j].name) != 0) || rbuf[i].lati != wbuf[j].lati ||
+ rbuf[i].longi != wbuf[j].longi || !H5_FLT_ABS_EQUAL(rbuf[i].pressure, wbuf[j].pressure) ||
+ !H5_DBL_ABS_EQUAL(rbuf[i].temperature, wbuf[j].temperature)) {
+ HDfprintf(stderr, "read and write buffers have differences\n");
+ HDfprintf(stderr, "%s %ld %f %f %d\n", rbuf[i].name, rbuf[i].longi, (double)rbuf[i].pressure,
+ rbuf[i].temperature, rbuf[i].lati);
+ HDfprintf(stderr, "%s %ld %f %f %d\n", wbuf[j].name, wbuf[j].longi, (double)wbuf[j].pressure,
+ wbuf[j].temperature, wbuf[j].lati);
return -1;
}
return 0;
}
/*-------------------------------------------------------------------------
-* function to compare deleted records
-*-------------------------------------------------------------------------
-*/
-static int compare_deleted(hsize_t rrecords, hsize_t dstart, hsize_t drecords,
- particle_t *rbuf, particle_t *wbuf)
+ * function to compare deleted records
+ *-------------------------------------------------------------------------
+ */
+static int
+compare_deleted(hsize_t rrecords, hsize_t dstart, hsize_t drecords, particle_t *rbuf, particle_t *wbuf)
{
- hsize_t i,j;
- for( i=0; i<rrecords; i++)
- {
- if (i<dstart)
- {
- if (cmp_par(i,i,rbuf,wbuf)<0)
+ hsize_t i, j;
+ for (i = 0; i < rrecords; i++) {
+ if (i < dstart) {
+ if (cmp_par(i, i, rbuf, wbuf) < 0)
return -1;
}
- else
- {
- j=i+drecords;
- if (cmp_par(i,j,rbuf,wbuf)<0)
+ else {
+ j = i + drecords;
+ if (cmp_par(i, j, rbuf, wbuf) < 0)
return -1;
}
}
return 0;
}
-
-
/*-------------------------------------------------------------------------
-* the test program
-*-------------------------------------------------------------------------
-*/
+ * the test program
+ *-------------------------------------------------------------------------
+ */
-static int test_table(hid_t fid, int do_write)
+static int
+test_table(hid_t fid, int do_write)
{
- hid_t fid1;
- hid_t fid2;
- hsize_t chunk_size=10;
- int compress=0;
- int *fill=NULL;
- particle_t fill1[1] = { {"no data",-1, -99.0f, -99.0f, -1} };
- int fill1_new[1] = { -100 };
- hsize_t position;
- char tname[20];
- hsize_t i, j;
+ hid_t fid1;
+ hid_t fid2;
+ hsize_t chunk_size = 10;
+ int compress = 0;
+ int * fill = NULL;
+ particle_t fill1[1] = {{"no data", -1, -99.0f, -99.0f, -1}};
+ int fill1_new[1] = {-100};
+ hsize_t position;
+ char tname[20];
+ hsize_t i, j;
/* write, read, append, delete, insert some records and fields */
- hsize_t FIELDS = NFIELDS;
- hsize_t RECORDS = NRECORDS;
+ hsize_t FIELDS = NFIELDS;
+ hsize_t RECORDS = NRECORDS;
hsize_t start;
hsize_t wstart;
hsize_t rstart;
@@ -233,210 +220,157 @@ static int test_table(hid_t fid, int do_write)
hsize_t drecords;
hsize_t nfields;
hsize_t rfields;
- hsize_t start1; /* record to start reading from 1st table */
- hsize_t start2; /* record to start writing in 2nd table */
+ hsize_t start1; /* record to start reading from 1st table */
+ hsize_t start2; /* record to start writing in 2nd table */
/* read, write, insert, append buffers */
- particle_t rbuf[NRECORDS+4];
+ particle_t rbuf[NRECORDS + 4];
particle2_t rbuf2[NRECORDS];
particle3_t rbuf3[NRECORDS];
- particle_t rbufc[NRECORDS*2];
- particle_t abuf[2]={{"eight",80,8.0f,80.0f,80},{"nine",90,9.0f,90.0f,90}};
- particle_t ibuf[2]={{"zero", 0, 0.0f, 0.0f, 0},{"zero", 0, 0.0f, 0.0f, 0}};
+ particle_t rbufc[NRECORDS * 2];
+ particle_t abuf[2] = {{"eight", 80, 8.0f, 80.0f, 80}, {"nine", 90, 9.0f, 90.0f, 90}};
+ particle_t ibuf[2] = {{"zero", 0, 0.0f, 0.0f, 0}, {"zero", 0, 0.0f, 0.0f, 0}};
particle_t wbufd[NRECORDS];
- particle_t wbuf[NRECORDS] = {
- {"zero", 0, 0.0f, 0.0f, 0,},
- {"one", 10, 1.0f, 10.0f, 10},
- {"two", 20, 2.0f, 20.0f, 20},
- {"three",30, 3.0f, 30.0f, 30},
- {"four", 40, 4.0f, 40.0f, 40},
- {"five", 50, 5.0f, 50.0f, 50},
- {"six", 60, 6.0f, 60.0f, 60},
- {"seven",70, 7.0f, 70.0f, 70}
- };
+ particle_t wbuf[NRECORDS] = {{
+ "zero",
+ 0,
+ 0.0f,
+ 0.0f,
+ 0,
+ },
+ {"one", 10, 1.0f, 10.0f, 10},
+ {"two", 20, 2.0f, 20.0f, 20},
+ {"three", 30, 3.0f, 30.0f, 30},
+ {"four", 40, 4.0f, 40.0f, 40},
+ {"five", 50, 5.0f, 50.0f, 50},
+ {"six", 60, 6.0f, 60.0f, 60},
+ {"seven", 70, 7.0f, 70.0f, 70}};
/* buffers for the field "Pressure" and "New_field" */
- float pressure_in [NRECORDS] = { 0.0f,1.0f,2.0f,3.0f,4.0f,5.0f,6.0f,7.0f };
- float pressure_out [NRECORDS];
- int buf_new[NRECORDS] = { 0,1,2,3,4,5,6,7 };
+ float pressure_in[NRECORDS] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f};
+ float pressure_out[NRECORDS];
+ int buf_new[NRECORDS] = {0, 1, 2, 3, 4, 5, 6, 7};
/* buffers for the fields "Latitude,Longitude" */
- position_t position_out[NRECORDS_ADD];
- position_t position_in[NRECORDS_ADD] = { {0,0},
- {10,10},
- {20,20}};
+ position_t position_out[NRECORDS_ADD];
+ position_t position_in[NRECORDS_ADD] = {{0, 0}, {10, 10}, {20, 20}};
/* buffers for the fields "Name,Pressure" */
- namepressure_t namepre_out[NRECORDS];
- namepressure_t namepre_in[NRECORDS] =
- { {"zero",0.0f},
- {"one", 1.0f},
- {"two", 2.0f},
- {"three", 3.0f},
- {"four", 4.0f},
- {"five", 5.0f},
- {"six", 6.0f},
- {"seven", 7.0f},
+ namepressure_t namepre_out[NRECORDS];
+ namepressure_t namepre_in[NRECORDS] = {
+ {"zero", 0.0f}, {"one", 1.0f}, {"two", 2.0f}, {"three", 3.0f},
+ {"four", 4.0f}, {"five", 5.0f}, {"six", 6.0f}, {"seven", 7.0f},
};
-
/*-------------------------------------------------------------------------
- * initialize table parameters
- * field offsets and sizes used in the fields functions
- *-------------------------------------------------------------------------
- */
-
- size_t field_offset_pos[2]=
- {
- HOFFSET( position_t, longi ),
- HOFFSET( position_t, lati )
- };
- size_t field_offset_namepre[2]=
- {
- HOFFSET( namepressure_t, name ),
- HOFFSET( namepressure_t, pressure )
- };
- size_t field_sizes_pos[2]=
- {
- sizeof(position_in[0].longi),
- sizeof(position_in[0].lati)
- };
- size_t field_sizes_namepre[2]=
- {
- sizeof(namepre_in[0].name),
- sizeof(namepre_in[0].pressure)
- };
- size_t field_sizes_pre[1]=
- {
- sizeof(namepre_in[0].pressure)
- };
+ * initialize table parameters
+ * field offsets and sizes used in the fields functions
+ *-------------------------------------------------------------------------
+ */
+
+ size_t field_offset_pos[2] = {HOFFSET(position_t, longi), HOFFSET(position_t, lati)};
+ size_t field_offset_namepre[2] = {HOFFSET(namepressure_t, name), HOFFSET(namepressure_t, pressure)};
+ size_t field_sizes_pos[2] = {sizeof(position_in[0].longi), sizeof(position_in[0].lati)};
+ size_t field_sizes_namepre[2] = {sizeof(namepre_in[0].name), sizeof(namepre_in[0].pressure)};
+ size_t field_sizes_pre[1] = {sizeof(namepre_in[0].pressure)};
/*-------------------------------------------------------------------------
- * query table test
- *-------------------------------------------------------------------------
- */
- char **names_out;
- size_t sizes_out[NFIELDS];
- size_t offset_out[NFIELDS];
- size_t size_out;
+ * query table test
+ *-------------------------------------------------------------------------
+ */
+ char **names_out;
+ size_t sizes_out[NFIELDS];
+ size_t offset_out[NFIELDS];
+ size_t size_out;
/*-------------------------------------------------------------------------
- * initialize table parameters
- * field indexes (zero based) used in the fields functions
- * "Name 0","Longitude 1","Pressure 2","Temperature 3","Latitude 4"
- *-------------------------------------------------------------------------
- */
- int field_index_pre[1] = { 2 };
- int field_index_pos[2] = { 1,4 };
- int field_index_namepre[2] = { 0,2 };
- int field_index[NFIELDS] = { 0,1,2,3,4 };
+ * initialize table parameters
+ * field indexes (zero based) used in the fields functions
+ * "Name 0","Longitude 1","Pressure 2","Temperature 3","Latitude 4"
+ *-------------------------------------------------------------------------
+ */
+ int field_index_pre[1] = {2};
+ int field_index_pos[2] = {1, 4};
+ int field_index_namepre[2] = {0, 2};
+ int field_index[NFIELDS] = {0, 1, 2, 3, 4};
/*-------------------------------------------------------------------------
- * initialize table parameters
- * size and the offsets of struct members in memory
- * define the inserted field HDF5 type and buffers
- * these are used for the insert field test
- *-------------------------------------------------------------------------
- */
- hid_t field_type_new = H5T_NATIVE_INT;
- size_t dst_size2 = sizeof( particle2_t );
- size_t dst_offset2[NFIELDS+1] = { HOFFSET( particle2_t, name ),
- HOFFSET( particle2_t, longi ),
- HOFFSET( particle2_t, pressure ),
- HOFFSET( particle2_t, temperature ),
- HOFFSET( particle2_t, lati ),
- HOFFSET( particle2_t, new_field )};
- size_t dst_sizes2[NFIELDS+1] = { sizeof( rbuf2[0].name),
- sizeof( rbuf2[0].longi),
- sizeof( rbuf2[0].pressure),
- sizeof( rbuf2[0].temperature),
- sizeof( rbuf2[0].lati),
- sizeof( rbuf2[0].new_field)};
+ * initialize table parameters
+ * size and the offsets of struct members in memory
+ * define the inserted field HDF5 type and buffers
+ * these are used for the insert field test
+ *-------------------------------------------------------------------------
+ */
+ hid_t field_type_new = H5T_NATIVE_INT;
+ size_t dst_size2 = sizeof(particle2_t);
+ size_t dst_offset2[NFIELDS + 1] = {HOFFSET(particle2_t, name), HOFFSET(particle2_t, longi),
+ HOFFSET(particle2_t, pressure), HOFFSET(particle2_t, temperature),
+ HOFFSET(particle2_t, lati), HOFFSET(particle2_t, new_field)};
+ size_t dst_sizes2[NFIELDS + 1] = {sizeof(rbuf2[0].name), sizeof(rbuf2[0].longi),
+ sizeof(rbuf2[0].pressure), sizeof(rbuf2[0].temperature),
+ sizeof(rbuf2[0].lati), sizeof(rbuf2[0].new_field)};
/*-------------------------------------------------------------------------
- * initialize table parameters
- * size and the offsets of struct members in memory
- * these are used for the delete field test
- *-------------------------------------------------------------------------
- */
- size_t dst_size3 = sizeof( particle3_t );
- size_t dst_offset3[NFIELDS-1] = { HOFFSET( particle3_t, name ),
- HOFFSET( particle3_t, longi ),
- HOFFSET( particle3_t, temperature ),
- HOFFSET( particle3_t, lati )};
-
- size_t dst_sizes3[NFIELDS-1] = { sizeof( rbuf3[0].name),
- sizeof( rbuf3[0].longi),
- sizeof( rbuf3[0].temperature),
- sizeof( rbuf3[0].lati)};
+ * initialize table parameters
+ * size and the offsets of struct members in memory
+ * these are used for the delete field test
+ *-------------------------------------------------------------------------
+ */
+ size_t dst_size3 = sizeof(particle3_t);
+ size_t dst_offset3[NFIELDS - 1] = {HOFFSET(particle3_t, name), HOFFSET(particle3_t, longi),
+ HOFFSET(particle3_t, temperature), HOFFSET(particle3_t, lati)};
+
+ size_t dst_sizes3[NFIELDS - 1] = {sizeof(rbuf3[0].name), sizeof(rbuf3[0].longi),
+ sizeof(rbuf3[0].temperature), sizeof(rbuf3[0].lati)};
/*-------------------------------------------------------------------------
- * initialize table parameters
- * size and the offsets of struct members in memory
- * these are used for the delete field test with differing memory layout
- *-------------------------------------------------------------------------
- */
+ * initialize table parameters
+ * size and the offsets of struct members in memory
+ * these are used for the delete field test with differing memory layout
+ *-------------------------------------------------------------------------
+ */
/* Calculate the size and the offsets of our struct members in memory */
- size_t tbl_size = sizeof(particle4_t);
- size_t tbl_offset[NFIELDS+1] = { HOFFSET(particle4_t, state),
- HOFFSET(particle4_t, posx),
- HOFFSET(particle4_t, posy),
- HOFFSET(particle4_t, atx),
- HOFFSET(particle4_t, aty),
- HOFFSET(particle4_t, rro)
- };
+ size_t tbl_size = sizeof(particle4_t);
+ size_t tbl_offset[NFIELDS + 1] = {HOFFSET(particle4_t, state), HOFFSET(particle4_t, posx),
+ HOFFSET(particle4_t, posy), HOFFSET(particle4_t, atx),
+ HOFFSET(particle4_t, aty), HOFFSET(particle4_t, rro)};
/* Define an array of Particles */
- particle4_t p_data[NRECORDS] = {
- {12112, 1.4f, 2.5f, {1,2,3},{4,5,6}, {99,100}},
- {12113, 1.4f, 2.5f, {1,2,3},{4,5,6}, {99,100}},
- {12114, 1.4f, 2.5f, {1,2,3},{4,5,6}, {99,100}},
- {12115, 1.4f, 2.5f, {1,2,3},{4,5,6}, {99,100}},
- {12116, 1.4f, 2.5f, {1,2,3},{4,5,6}, {99,100}},
- {12117, 1.4f, 2.5f, {1,2,3},{4,5,6}, {99,100}},
- {12118, 1.4f, 2.5f, {1,2,3},{4,5,6}, {99,100}},
- {12119, 1.4f, 2.5f, {1,2,3},{4,5,6}, {99,100}}
- };
+ particle4_t p_data[NRECORDS] = {{12112, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}},
+ {12113, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}},
+ {12114, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}},
+ {12115, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}},
+ {12116, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}},
+ {12117, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}},
+ {12118, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}},
+ {12119, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}}};
/*-------------------------------------------------------------------------
- * initialize table parameters
- * 1) size and the offsets of struct members in memory
- * 2) field names
- * 3) define a HDF5 type for the fields
- *-------------------------------------------------------------------------
- */
-
- size_t type_size_mem = sizeof( particle_t );
- size_t field_offset[NFIELDS]=
- {
- HOFFSET( particle_t, name ),
- HOFFSET( particle_t, longi ),
- HOFFSET( particle_t, pressure ),
- HOFFSET( particle_t, temperature ),
- HOFFSET( particle_t, lati )
- };
- size_t field_size[NFIELDS] =
- {
- sizeof( rbuf[0].name),
- sizeof( rbuf[0].longi),
- sizeof( rbuf[0].pressure),
- sizeof( rbuf[0].temperature),
- sizeof( rbuf[0].lati)
- };
+ * initialize table parameters
+ * 1) size and the offsets of struct members in memory
+ * 2) field names
+ * 3) define a HDF5 type for the fields
+ *-------------------------------------------------------------------------
+ */
+
+ size_t type_size_mem = sizeof(particle_t);
+ size_t field_offset[NFIELDS] = {HOFFSET(particle_t, name), HOFFSET(particle_t, longi),
+ HOFFSET(particle_t, pressure), HOFFSET(particle_t, temperature),
+ HOFFSET(particle_t, lati)};
+ size_t field_size[NFIELDS] = {sizeof(rbuf[0].name), sizeof(rbuf[0].longi), sizeof(rbuf[0].pressure),
+ sizeof(rbuf[0].temperature), sizeof(rbuf[0].lati)};
- const char *field_names4[NFIELDS+1] =
- { "F1", "F2", "F3", "F4", "F5", "F6"};
- hid_t field_type4[NFIELDS+1];
- particle4_t fill_data[1] = { {9999999, -9999999, 999999, {999,999,999},{999,999,999}, {999,999}} };
+ const char *field_names4[NFIELDS + 1] = {"F1", "F2", "F3", "F4", "F5", "F6"};
+ hid_t field_type4[NFIELDS + 1];
+ particle4_t fill_data[1] = {{9999999, -9999999, 999999, {999, 999, 999}, {999, 999, 999}, {999, 999}}};
- hsize_t nfields_out;
- hsize_t nrecords_out;
- hid_t arry3_32f;
- hid_t arry2_32f;
- hsize_t dims;
+ hsize_t nfields_out;
+ hsize_t nrecords_out;
+ hid_t arry3_32f;
+ hid_t arry2_32f;
+ hsize_t dims;
- const char *field_names[NFIELDS] =
- { "Name","Longitude","Pressure","Temperature","Latitude" };
- hid_t field_type[NFIELDS];
- hid_t string_type = H5Tcopy( H5T_C_S1 );
+ const char *field_names[NFIELDS] = {"Name", "Longitude", "Pressure", "Temperature", "Latitude"};
+ hid_t field_type[NFIELDS];
+ hid_t string_type = H5Tcopy(H5T_C_S1);
- H5Tset_size( string_type, 16 );
+ H5Tset_size(string_type, 16);
field_type[0] = string_type;
field_type[1] = H5T_NATIVE_LONG;
field_type[2] = H5T_NATIVE_FLOAT;
@@ -444,21 +378,19 @@ static int test_table(hid_t fid, int do_write)
field_type[4] = H5T_NATIVE_INT;
/*-------------------------------------------------------------------------
- *
- * Functions tested:
- *
- * H5TBmake_table
- * H5TBread_table
- *
- *-------------------------------------------------------------------------
- */
- if (do_write)
- {
+ *
+ * Functions tested:
+ *
+ * H5TBmake_table
+ * H5TBread_table
+ *
+ *-------------------------------------------------------------------------
+ */
+ if (do_write) {
HL_TESTING2("making table");
- if (H5TBmake_table(TITLE,fid,"table1",FIELDS,RECORDS,type_size_mem,
- field_names,field_offset,field_type,
- chunk_size,fill,compress,wbuf)<0)
+ if (H5TBmake_table(TITLE, fid, "table1", FIELDS, RECORDS, type_size_mem, field_names, field_offset,
+ field_type, chunk_size, fill, compress, wbuf) < 0)
goto out;
PASSED();
}
@@ -466,61 +398,56 @@ static int test_table(hid_t fid, int do_write)
HL_TESTING2("reading table");
/*-------------------------------------------------------------------------
- * read the table
- *-------------------------------------------------------------------------
- */
+ * read the table
+ *-------------------------------------------------------------------------
+ */
- if (H5TBread_table(fid,"table1",type_size_mem,field_offset,field_size,rbuf)<0)
+ if (H5TBread_table(fid, "table1", type_size_mem, field_offset, field_size, rbuf) < 0)
goto out;
/* compare the extracted table with the original array */
- for( i = 0; i < NRECORDS; i++ )
- {
- if (cmp_par(i,i,rbuf,wbuf)<0)
+ for (i = 0; i < NRECORDS; i++) {
+ if (cmp_par(i, i, rbuf, wbuf) < 0)
goto out;
}
PASSED();
-
/*-------------------------------------------------------------------------
- *
- * Functions tested:
- *
- * H5TBwrite_records
- *
- *-------------------------------------------------------------------------
- */
- if (do_write)
- {
+ *
+ * Functions tested:
+ *
+ * H5TBwrite_records
+ *
+ *-------------------------------------------------------------------------
+ */
+ if (do_write) {
HL_TESTING2("writing records");
/* create an empty table */
- if (H5TBmake_table(TITLE,fid,"table2",FIELDS,RECORDS,type_size_mem,
- field_names,field_offset,field_type,
- chunk_size,fill,compress,0)<0)
+ if (H5TBmake_table(TITLE, fid, "table2", FIELDS, RECORDS, type_size_mem, field_names, field_offset,
+ field_type, chunk_size, fill, compress, 0) < 0)
goto out;
/*-------------------------------------------------------------------------
- * write records, start at 0, write 8
- * pos = 0 1 2 3 4 5 6 7
- * data= 0 1 2 3 4 5 6 7
- *-------------------------------------------------------------------------
- */
- wstart=0;
- wrecords=8;
- if (H5TBwrite_records(fid,"table2",wstart,wrecords,type_size_mem,field_offset,
- field_size,wbuf)<0)
+ * write records, start at 0, write 8
+ * pos = 0 1 2 3 4 5 6 7
+ * data= 0 1 2 3 4 5 6 7
+ *-------------------------------------------------------------------------
+ */
+ wstart = 0;
+ wrecords = 8;
+ if (H5TBwrite_records(fid, "table2", wstart, wrecords, type_size_mem, field_offset, field_size,
+ wbuf) < 0)
goto out;
/* read it back */
- if (H5TBread_table(fid,"table2",type_size_mem,field_offset,field_size,rbuf)<0)
+ if (H5TBread_table(fid, "table2", type_size_mem, field_offset, field_size, rbuf) < 0)
goto out;
/* compare */
- for( i = 0; i < NRECORDS; i++ )
- {
- if (cmp_par(i,i,rbuf,wbuf)<0)
+ for (i = 0; i < NRECORDS; i++) {
+ if (cmp_par(i, i, rbuf, wbuf) < 0)
goto out;
}
@@ -528,147 +455,139 @@ static int test_table(hid_t fid, int do_write)
}
/*-------------------------------------------------------------------------
- *
- * Functions tested:
- *
- * H5TBread_records
- *
- *-------------------------------------------------------------------------
- */
+ *
+ * Functions tested:
+ *
+ * H5TBread_records
+ *
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("reading records");
/*-------------------------------------------------------------------------
- * read records, start at 0, read 8
- * pos = 0 1 2 3 4 5 6 7
- * data= 0 1 2 3 4 5 6 7
- *-------------------------------------------------------------------------
- */
+ * read records, start at 0, read 8
+ * pos = 0 1 2 3 4 5 6 7
+ * data= 0 1 2 3 4 5 6 7
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * for the read test we cannot use "table2" because it has been appended
- * we use the original "table1" instead
- *-------------------------------------------------------------------------
- */
- if(do_write)
- HDstrcpy(tname,"table2");
+ * for the read test we cannot use "table2" because it has been appended
+ * we use the original "table1" instead
+ *-------------------------------------------------------------------------
+ */
+ if (do_write)
+ HDstrcpy(tname, "table2");
else
- HDstrcpy(tname,"table1");
+ HDstrcpy(tname, "table1");
- rstart=0;
- rrecords=8;
- if (H5TBread_records(fid,tname,rstart,rrecords,type_size_mem,field_offset,
- field_size,rbuf)<0)
+ rstart = 0;
+ rrecords = 8;
+ if (H5TBread_records(fid, tname, rstart, rrecords, type_size_mem, field_offset, field_size, rbuf) < 0)
goto out;
/* compare */
- for( i = rstart; i < rrecords; i++)
- {
- if (cmp_par(i,i,rbuf,wbuf)<0)
+ for (i = rstart; i < rrecords; i++) {
+ if (cmp_par(i, i, rbuf, wbuf) < 0)
goto out;
}
PASSED();
/*-------------------------------------------------------------------------
- *
- * Functions tested:
- *
- * H5TBappend_records
- * H5TBread_records
- *
- *-------------------------------------------------------------------------
- */
- if (do_write)
- {
+ *
+ * Functions tested:
+ *
+ * H5TBappend_records
+ * H5TBread_records
+ *
+ *-------------------------------------------------------------------------
+ */
+ if (do_write) {
HL_TESTING2("appending records");
/*-------------------------------------------------------------------------
- * append 2 records
- * pos = 0 1 2 3 4 5 6 7 8 9
- * data= 0 1 2 3 4 5 6 7 8 9
- *-------------------------------------------------------------------------
- */
- arecords=2;
- if (H5TBappend_records(fid,"table2",arecords,type_size_mem,field_offset,field_size,abuf)<0)
+ * append 2 records
+ * pos = 0 1 2 3 4 5 6 7 8 9
+ * data= 0 1 2 3 4 5 6 7 8 9
+ *-------------------------------------------------------------------------
+ */
+ arecords = 2;
+ if (H5TBappend_records(fid, "table2", arecords, type_size_mem, field_offset, field_size, abuf) < 0)
return 1;
- if (H5TBget_table_info(fid,"table2",&rfields,&rrecords)<0)
+ if (H5TBget_table_info(fid, "table2", &rfields, &rrecords) < 0)
return 1;
- rstart=0; rrecords=NRECORDS+arecords;
- if (H5TBread_records(fid,"table2",rstart,rrecords,type_size_mem,field_offset,
- field_size,rbuf)<0)
+ rstart = 0;
+ rrecords = NRECORDS + arecords;
+ if (H5TBread_records(fid, "table2", rstart, rrecords, type_size_mem, field_offset, field_size, rbuf) <
+ 0)
return 1;
/* compare */
- wrecords=8;
- for( i = rstart; i< wrecords; i++)
- {
- if (cmp_par(i,i,rbuf,wbuf)<0)
+ wrecords = 8;
+ for (i = rstart; i < wrecords; i++) {
+ if (cmp_par(i, i, rbuf, wbuf) < 0)
goto out;
}
- for( i = wrecords, j = 0; i < rrecords; i++,j++)
- {
- if (cmp_par(i,j,rbuf,abuf)<0)
+ for (i = wrecords, j = 0; i < rrecords; i++, j++) {
+ if (cmp_par(i, j, rbuf, abuf) < 0)
goto out;
}
PASSED();
}
/*-------------------------------------------------------------------------
- *
- * Functions tested:
- *
- * H5TBinsert_record
- * H5TBread_records
- *
- *-------------------------------------------------------------------------
- */
- if (do_write)
- {
+ *
+ * Functions tested:
+ *
+ * H5TBinsert_record
+ * H5TBread_records
+ *
+ *-------------------------------------------------------------------------
+ */
+ if (do_write) {
HL_TESTING2("inserting records");
/*-------------------------------------------------------------------------
- * insert 2 records
- * pos = 0 1 2 3 4 5 6 7 8 9 10 11
- * data= 0 0 0 1 2 3 4 5 6 7 8 9
- *-------------------------------------------------------------------------
- */
- istart=1; irecords=2;
- if (H5TBinsert_record(fid,"table2",istart,irecords,type_size_mem,field_offset,field_size,ibuf)<0)
+ * insert 2 records
+ * pos = 0 1 2 3 4 5 6 7 8 9 10 11
+ * data= 0 0 0 1 2 3 4 5 6 7 8 9
+ *-------------------------------------------------------------------------
+ */
+ istart = 1;
+ irecords = 2;
+ if (H5TBinsert_record(fid, "table2", istart, irecords, type_size_mem, field_offset, field_size,
+ ibuf) < 0)
return 1;
- if (H5TBget_table_info(fid,"table2",&rfields,&rrecords)<0)
+ if (H5TBget_table_info(fid, "table2", &rfields, &rrecords) < 0)
return 1;
- if (H5TBread_records(fid,"table2",rstart,rrecords,type_size_mem,field_offset,
- field_size,rbuf)<0)
+ if (H5TBread_records(fid, "table2", rstart, rrecords, type_size_mem, field_offset, field_size, rbuf) <
+ 0)
return 1;
/* compare */
- for( i = 0; i < 12; i++)
- {
- if (i < istart)
- {
- if (cmp_par(i,i,rbuf,wbuf)<0)
+ for (i = 0; i < 12; i++) {
+ if (i < istart) {
+ if (cmp_par(i, i, rbuf, wbuf) < 0)
goto out;
}
- else if (i >= istart && i < istart + irecords)
- {
+ else if (i >= istart && i < istart + irecords) {
j = i - istart;
- if (cmp_par(i,j,rbuf,ibuf)<0)
+ if (cmp_par(i, j, rbuf, ibuf) < 0)
goto out;
}
- else if ( i >= istart + irecords && i < 10 )
- {
+ else if (i >= istart + irecords && i < 10) {
j = i - irecords;
- if (cmp_par(i,j,rbuf,wbuf)<0)
+ if (cmp_par(i, j, rbuf, wbuf) < 0)
goto out;
}
- else
- {
+ else {
j = i - 10;
- if (cmp_par(i,j,rbuf,abuf)<0)
+ if (cmp_par(i, j, rbuf, abuf) < 0)
goto out;
}
}
@@ -676,198 +595,192 @@ static int test_table(hid_t fid, int do_write)
}
/*-------------------------------------------------------------------------
- *
- * Functions tested:
- *
- * H5TBdelete_record
- * H5TBread_records
- *
- *-------------------------------------------------------------------------
- */
- if (do_write)
- {
+ *
+ * Functions tested:
+ *
+ * H5TBdelete_record
+ * H5TBread_records
+ *
+ *-------------------------------------------------------------------------
+ */
+ if (do_write) {
HL_TESTING2("deleting records");
/*-------------------------------------------------------------------------
- * Create a table
- * pos = 0 1 2 3 4 5 6 7
- * data= 0 1 2 3 4 5 6 7
- *-------------------------------------------------------------------------
- */
-
- for( i=0; i<NRECORDS; i++)
- {
- wbufd[i].lati = wbuf[i].lati;
- wbufd[i].longi = wbuf[i].longi;
- wbufd[i].pressure = wbuf[i].pressure;
+ * Create a table
+ * pos = 0 1 2 3 4 5 6 7
+ * data= 0 1 2 3 4 5 6 7
+ *-------------------------------------------------------------------------
+ */
+
+ for (i = 0; i < NRECORDS; i++) {
+ wbufd[i].lati = wbuf[i].lati;
+ wbufd[i].longi = wbuf[i].longi;
+ wbufd[i].pressure = wbuf[i].pressure;
wbufd[i].temperature = wbuf[i].temperature;
- HDstrcpy(wbufd[i].name, wbuf[i].name );
-
+ HDstrcpy(wbufd[i].name, wbuf[i].name);
}
-
- if (H5TBmake_table(TITLE,fid,"table3",FIELDS,RECORDS,type_size_mem,
- field_names,field_offset,field_type,
- chunk_size,fill,compress,wbufd)<0)
+ if (H5TBmake_table(TITLE, fid, "table3", FIELDS, RECORDS, type_size_mem, field_names, field_offset,
+ field_type, chunk_size, fill, compress, wbufd) < 0)
goto out;
/*-------------------------------------------------------------------------
- * Delete records, start at 2, delete 3
- * pos = 0 1 2 3 4
- * data= 0 1 5 6 7
- *-------------------------------------------------------------------------
- */
- dstart=2; drecords=3;
- if (H5TBdelete_record(fid,"table3",dstart,drecords)<0)
+ * Delete records, start at 2, delete 3
+ * pos = 0 1 2 3 4
+ * data= 0 1 5 6 7
+ *-------------------------------------------------------------------------
+ */
+ dstart = 2;
+ drecords = 3;
+ if (H5TBdelete_record(fid, "table3", dstart, drecords) < 0)
goto out;
- if (H5TBget_table_info(fid,"table3",&rfields,&rrecords)<0)
+ if (H5TBget_table_info(fid, "table3", &rfields, &rrecords) < 0)
goto out;
- rstart=0;
- if (H5TBread_records(fid,"table3",rstart,rrecords,type_size_mem,field_offset,
- field_size,rbuf)<0)
+ rstart = 0;
+ if (H5TBread_records(fid, "table3", rstart, rrecords, type_size_mem, field_offset, field_size, rbuf) <
+ 0)
goto out;
/* compare */
- nrecords=NRECORDS;
- assert(rrecords == nrecords-drecords);
- if (compare_deleted(rrecords,dstart,drecords,rbuf,wbufd)<0)
+ nrecords = NRECORDS;
+ assert(rrecords == nrecords - drecords);
+ if (compare_deleted(rrecords, dstart, drecords, rbuf, wbufd) < 0)
goto out;
/*-------------------------------------------------------------------------
- * reset compare buffer
- *-------------------------------------------------------------------------
- */
- nrecords=rrecords;
- for( i=0; i<nrecords; i++)
- {
+ * reset compare buffer
+ *-------------------------------------------------------------------------
+ */
+ nrecords = rrecords;
+ for (i = 0; i < nrecords; i++) {
wbufd[i] = rbuf[i];
}
/*-------------------------------------------------------------------------
- * Delete records, start at 0, delete 2
- * pos = 0 1 2
- * data= 5 6 7
- *-------------------------------------------------------------------------
- */
- dstart=0; drecords=2;
- if (H5TBdelete_record(fid,"table3",dstart,drecords)<0)
+ * Delete records, start at 0, delete 2
+ * pos = 0 1 2
+ * data= 5 6 7
+ *-------------------------------------------------------------------------
+ */
+ dstart = 0;
+ drecords = 2;
+ if (H5TBdelete_record(fid, "table3", dstart, drecords) < 0)
goto out;
- if (H5TBget_table_info(fid,"table3",&rfields,&rrecords)<0)
+ if (H5TBget_table_info(fid, "table3", &rfields, &rrecords) < 0)
goto out;
- rstart=0;
- if (H5TBread_records(fid,"table3",rstart,rrecords,type_size_mem,field_offset,
- field_size,rbuf)<0)
+ rstart = 0;
+ if (H5TBread_records(fid, "table3", rstart, rrecords, type_size_mem, field_offset, field_size, rbuf) <
+ 0)
goto out;
/* Compare */
- assert(rrecords == nrecords-drecords);
- if (compare_deleted(rrecords,dstart,drecords,rbuf,wbufd)<0)
+ assert(rrecords == nrecords - drecords);
+ if (compare_deleted(rrecords, dstart, drecords, rbuf, wbufd) < 0)
goto out;
/*-------------------------------------------------------------------------
- * reset compare buffer
- *-------------------------------------------------------------------------
- */
- nrecords=rrecords;
- for( i=0; i<nrecords; i++)
- {
+ * reset compare buffer
+ *-------------------------------------------------------------------------
+ */
+ nrecords = rrecords;
+ for (i = 0; i < nrecords; i++) {
wbufd[i] = rbuf[i];
}
/*-------------------------------------------------------------------------
- * Delete records, start at 1, delete 1
- * pos = 0 1
- * data= 5 7
- *-------------------------------------------------------------------------
- */
- dstart=1; drecords=1;
- if (H5TBdelete_record(fid,"table3",dstart,drecords)<0)
+ * Delete records, start at 1, delete 1
+ * pos = 0 1
+ * data= 5 7
+ *-------------------------------------------------------------------------
+ */
+ dstart = 1;
+ drecords = 1;
+ if (H5TBdelete_record(fid, "table3", dstart, drecords) < 0)
goto out;
- if (H5TBget_table_info(fid,"table3",&rfields,&rrecords)<0)
+ if (H5TBget_table_info(fid, "table3", &rfields, &rrecords) < 0)
goto out;
- rstart=0;
- if (H5TBread_records(fid,"table3",rstart,rrecords,type_size_mem,field_offset,
- field_size,rbuf)<0)
+ rstart = 0;
+ if (H5TBread_records(fid, "table3", rstart, rrecords, type_size_mem, field_offset, field_size, rbuf) <
+ 0)
goto out;
/* Compare */
- assert(rrecords == nrecords-drecords);
- if (compare_deleted(rrecords,dstart,drecords,rbuf,wbufd)<0)
+ assert(rrecords == nrecords - drecords);
+ if (compare_deleted(rrecords, dstart, drecords, rbuf, wbufd) < 0)
goto out;
/*-------------------------------------------------------------------------
- * reset compare buffer
- *-------------------------------------------------------------------------
- */
- nrecords=rrecords;
- for( i=0; i<nrecords; i++)
- {
+ * reset compare buffer
+ *-------------------------------------------------------------------------
+ */
+ nrecords = rrecords;
+ for (i = 0; i < nrecords; i++) {
wbufd[i] = rbuf[i];
}
/*-------------------------------------------------------------------------
- * Delete records, start at 0, delete 1
- * pos = 0
- * data= 7
- *-------------------------------------------------------------------------
- */
- dstart=0; drecords=1;
- if (H5TBdelete_record(fid,"table3",dstart,drecords)<0)
+ * Delete records, start at 0, delete 1
+ * pos = 0
+ * data= 7
+ *-------------------------------------------------------------------------
+ */
+ dstart = 0;
+ drecords = 1;
+ if (H5TBdelete_record(fid, "table3", dstart, drecords) < 0)
goto out;
- if (H5TBget_table_info(fid,"table3",&rfields,&rrecords)<0)
+ if (H5TBget_table_info(fid, "table3", &rfields, &rrecords) < 0)
goto out;
- rstart=0;
- if (H5TBread_records(fid,"table3",rstart,rrecords,type_size_mem,field_offset,
- field_size,rbuf)<0)
+ rstart = 0;
+ if (H5TBread_records(fid, "table3", rstart, rrecords, type_size_mem, field_offset, field_size, rbuf) <
+ 0)
goto out;
/* Compare */
- assert(rrecords == nrecords-drecords);
- if (compare_deleted(rrecords,dstart,drecords,rbuf,wbufd)<0)
+ assert(rrecords == nrecords - drecords);
+ if (compare_deleted(rrecords, dstart, drecords, rbuf, wbufd) < 0)
goto out;
/*-------------------------------------------------------------------------
- * reset compare buffer
- *-------------------------------------------------------------------------
- */
- nrecords=rrecords;
- for( i=0; i<nrecords; i++)
- {
+ * reset compare buffer
+ *-------------------------------------------------------------------------
+ */
+ nrecords = rrecords;
+ for (i = 0; i < nrecords; i++) {
wbufd[i] = rbuf[i];
}
/* Read complete table */
- if (H5TBread_table(fid,"table3",type_size_mem,field_offset,field_size,rbuf)<0)
+ if (H5TBread_table(fid, "table3", type_size_mem, field_offset, field_size, rbuf) < 0)
goto out;
/* Compare */
- for( i=0; i<rrecords; i++)
- {
- if (cmp_par(i,i,rbuf,wbufd)<0)
- {
+ for (i = 0; i < rrecords; i++) {
+ if (cmp_par(i, i, rbuf, wbufd) < 0) {
goto out;
}
}
/*-------------------------------------------------------------------------
- * Delete records, start at 0, delete 1
- * pos = 0
- * data= empty
- *-------------------------------------------------------------------------
- */
- dstart=0; drecords=1;
- if (H5TBdelete_record(fid,"table3",dstart,drecords)<0)
+ * Delete records, start at 0, delete 1
+ * pos = 0
+ * data= empty
+ *-------------------------------------------------------------------------
+ */
+ dstart = 0;
+ drecords = 1;
+ if (H5TBdelete_record(fid, "table3", dstart, drecords) < 0)
goto out;
- if (H5TBget_table_info(fid,"table3",&rfields,&rrecords)<0)
+ if (H5TBget_table_info(fid, "table3", &rfields, &rrecords) < 0)
goto out;
if (rrecords)
@@ -884,104 +797,97 @@ static int test_table(hid_t fid, int do_write)
*
*-------------------------------------------------------------------------
*/
- if (do_write)
- {
+ if (do_write) {
HL_TESTING2("deleting records (differing memory layout)");
- dims = 3;
- arry3_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims);
-
- dims = 2;
- arry2_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims);
-
- /* Initialize the field field_type */
- field_type4[0] = H5T_NATIVE_UINT32;
- field_type4[1] = H5T_NATIVE_DOUBLE;
- field_type4[2] = H5T_NATIVE_DOUBLE;
- field_type4[3] = arry3_32f;
- field_type4[4] = arry3_32f;
- field_type4[5] = arry2_32f;
-
- /* Make the table */
- if (H5TBmake_table("Table Title",fid,"table",NFIELDS+1,(hsize_t)NRECORDS,
- tbl_size, field_names4, tbl_offset, field_type4,
- chunk_size, fill_data, compress, p_data)<0)
- goto out;
- /* Delete records */
- start = 3;
- nrecords = 3;
- if (H5TBdelete_record(fid, "table", start, nrecords)<0)
- goto out;;
- /* Get table info */
- if (H5TBget_table_info(fid,"table", &nfields_out, &nrecords_out)<0)
- goto out;
- /* check */
- if( (int)nfields_out != (int)NFIELDS+1)
- goto out;
-
- if( (int)nrecords_out != (int)NRECORDS-3)
- goto out;
-
- /* close type */
- H5Tclose(arry3_32f);
- H5Tclose(arry2_32f);
+ dims = 3;
+ arry3_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims);
- PASSED();
+ dims = 2;
+ arry2_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims);
+
+ /* Initialize the field field_type */
+ field_type4[0] = H5T_NATIVE_UINT32;
+ field_type4[1] = H5T_NATIVE_DOUBLE;
+ field_type4[2] = H5T_NATIVE_DOUBLE;
+ field_type4[3] = arry3_32f;
+ field_type4[4] = arry3_32f;
+ field_type4[5] = arry2_32f;
+
+ /* Make the table */
+ if (H5TBmake_table("Table Title", fid, "table", NFIELDS + 1, (hsize_t)NRECORDS, tbl_size,
+ field_names4, tbl_offset, field_type4, chunk_size, fill_data, compress,
+ p_data) < 0)
+ goto out;
+ /* Delete records */
+ start = 3;
+ nrecords = 3;
+ if (H5TBdelete_record(fid, "table", start, nrecords) < 0)
+ goto out;
+ ;
+ /* Get table info */
+ if (H5TBget_table_info(fid, "table", &nfields_out, &nrecords_out) < 0)
+ goto out;
+ /* check */
+ if ((int)nfields_out != (int)NFIELDS + 1)
+ goto out;
+
+ if ((int)nrecords_out != (int)NRECORDS - 3)
+ goto out;
+
+ /* close type */
+ H5Tclose(arry3_32f);
+ H5Tclose(arry2_32f);
+
+ PASSED();
}
/*-------------------------------------------------------------------------
- *
- * Functions tested:
- *
- * H5TBadd_records_from
- * H5TBread_records
- *
- *-------------------------------------------------------------------------
- */
+ *
+ * Functions tested:
+ *
+ * H5TBadd_records_from
+ * H5TBread_records
+ *
+ *-------------------------------------------------------------------------
+ */
- if (do_write)
- {
+ if (do_write) {
HL_TESTING2("adding records");
/* create 2 tables */
- if (H5TBmake_table(TITLE,fid,"table4",FIELDS,RECORDS,type_size_mem,
- field_names,field_offset,field_type,
- chunk_size,fill,compress,wbuf)<0)
+ if (H5TBmake_table(TITLE, fid, "table4", FIELDS, RECORDS, type_size_mem, field_names, field_offset,
+ field_type, chunk_size, fill, compress, wbuf) < 0)
goto out;
- if (H5TBmake_table(TITLE,fid,"table5",FIELDS,RECORDS,type_size_mem,
- field_names,field_offset,field_type,
- chunk_size,fill,compress,wbuf)<0)
+ if (H5TBmake_table(TITLE, fid, "table5", FIELDS, RECORDS, type_size_mem, field_names, field_offset,
+ field_type, chunk_size, fill, compress, wbuf) < 0)
goto out;
/* add the records from "table4" to "table5" */
- start1 = 3;
- nrecords = 2;
- start2 = 6;
- if ( H5TBadd_records_from(fid,"table4",start1,nrecords,"table5",start2)<0)
+ start1 = 3;
+ nrecords = 2;
+ start2 = 6;
+ if (H5TBadd_records_from(fid, "table4", start1, nrecords, "table5", start2) < 0)
goto out;
/* read final table */
- if (H5TBread_table(fid,"table5",type_size_mem,field_offset,field_size,rbuf)<0)
+ if (H5TBread_table(fid, "table5", type_size_mem, field_offset, field_size, rbuf) < 0)
goto out;
/* compare */
- for( i = 0; i < NRECORDS+2; i++ )
- {
- if ( i < start2 )
- {
- if (cmp_par(i,i,rbuf,wbuf)<0)
+ for (i = 0; i < NRECORDS + 2; i++) {
+ if (i < start2) {
+ if (cmp_par(i, i, rbuf, wbuf) < 0)
goto out;
}
- else if ( i < start2 + nrecords )
- {
+ else if (i < start2 + nrecords) {
j = i - start1;
- if (cmp_par(i,j,rbuf,wbuf)<0)
+ if (cmp_par(i, j, rbuf, wbuf) < 0)
goto out;
}
- else
- {
+ else {
j = i - nrecords;
- if (cmp_par(i,j,rbuf,wbuf)<0)
+ if (cmp_par(i, j, rbuf, wbuf) < 0)
goto out;
}
}
@@ -990,90 +896,79 @@ static int test_table(hid_t fid, int do_write)
}
/*-------------------------------------------------------------------------
- *
- * Functions tested:
- *
- * H5TBcombine_tables
- * H5TBread_table
- *
- *-------------------------------------------------------------------------
- */
+ *
+ * Functions tested:
+ *
+ * H5TBcombine_tables
+ * H5TBread_table
+ *
+ *-------------------------------------------------------------------------
+ */
- if (do_write)
- {
+ if (do_write) {
HL_TESTING2("combining tables");
/* create 2 tables */
- if (H5TBmake_table(TITLE,fid,"table6",FIELDS,RECORDS,type_size_mem,
- field_names,field_offset,field_type,
- chunk_size,fill,compress,wbuf)<0)
+ if (H5TBmake_table(TITLE, fid, "table6", FIELDS, RECORDS, type_size_mem, field_names, field_offset,
+ field_type, chunk_size, fill, compress, wbuf) < 0)
goto out;
- if (H5TBmake_table(TITLE,fid,"table7",FIELDS,RECORDS,type_size_mem,
- field_names,field_offset,field_type,
- chunk_size,fill,compress,wbuf)<0)
+ if (H5TBmake_table(TITLE, fid, "table7", FIELDS, RECORDS, type_size_mem, field_names, field_offset,
+ field_type, chunk_size, fill, compress, wbuf) < 0)
goto out;
/* combine the two tables into a third */
- if ( H5TBcombine_tables(fid,"table6",fid,"table7","table8")<0)
+ if (H5TBcombine_tables(fid, "table6", fid, "table7", "table8") < 0)
goto out;
/* read merged table */
- if (H5TBread_table(fid,"table8",type_size_mem,field_offset,field_size,rbufc)<0)
+ if (H5TBread_table(fid, "table8", type_size_mem, field_offset, field_size, rbufc) < 0)
goto out;
/* compare */
- for( i = 0; i < NRECORDS*2; i++ )
- {
- if ( i < NRECORDS )
- {
- if (cmp_par(i,i,rbufc,wbuf)<0)
+ for (i = 0; i < NRECORDS * 2; i++) {
+ if (i < NRECORDS) {
+ if (cmp_par(i, i, rbufc, wbuf) < 0)
goto out;
}
- else
- {
- if (cmp_par(i,i-NRECORDS,rbufc,wbuf)<0)
+ else {
+ if (cmp_par(i, i - NRECORDS, rbufc, wbuf) < 0)
goto out;
}
}
/*-------------------------------------------------------------------------
- * multi file test
- *-------------------------------------------------------------------------
- */
+ * multi file test
+ *-------------------------------------------------------------------------
+ */
/* create 2 files using default properties. */
- fid1 = H5Fcreate("combine_tables1.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);
- fid2 = H5Fcreate("combine_tables2.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);
+ fid1 = H5Fcreate("combine_tables1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid2 = H5Fcreate("combine_tables2.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* create 2 tables, one in each file */
- if (H5TBmake_table(TITLE,fid1,"table1",FIELDS,RECORDS,type_size_mem,
- field_names,field_offset,field_type,
- chunk_size,fill,compress,wbuf)<0)
+ if (H5TBmake_table(TITLE, fid1, "table1", FIELDS, RECORDS, type_size_mem, field_names, field_offset,
+ field_type, chunk_size, fill, compress, wbuf) < 0)
goto out;
- if (H5TBmake_table(TITLE,fid2,"table2",FIELDS,RECORDS,type_size_mem,
- field_names,field_offset,field_type,
- chunk_size,fill,compress,wbuf)<0)
+ if (H5TBmake_table(TITLE, fid2, "table2", FIELDS, RECORDS, type_size_mem, field_names, field_offset,
+ field_type, chunk_size, fill, compress, wbuf) < 0)
goto out;
/* combine the two tables into a third */
- if ( H5TBcombine_tables(fid1,"table1",fid2,"table2","table3")<0)
+ if (H5TBcombine_tables(fid1, "table1", fid2, "table2", "table3") < 0)
goto out;
/* read merged table */
- if (H5TBread_table(fid1,"table3",type_size_mem,field_offset,field_size,rbufc)<0)
+ if (H5TBread_table(fid1, "table3", type_size_mem, field_offset, field_size, rbufc) < 0)
goto out;
/* compare */
- for( i = 0; i < NRECORDS*2; i++ )
- {
- if ( i < NRECORDS )
- {
- if (cmp_par(i,i,rbufc,wbuf)<0)
+ for (i = 0; i < NRECORDS * 2; i++) {
+ if (i < NRECORDS) {
+ if (cmp_par(i, i, rbufc, wbuf) < 0)
goto out;
}
- else
- {
- if (cmp_par(i,i-NRECORDS,rbufc,wbuf)<0)
+ else {
+ if (cmp_par(i, i - NRECORDS, rbufc, wbuf) < 0)
goto out;
}
}
@@ -1085,98 +980,87 @@ static int test_table(hid_t fid, int do_write)
PASSED();
}
-
/*-------------------------------------------------------------------------
- *
- * Functions tested:
- *
- * H5TBwrite_fields_name
- *
- *-------------------------------------------------------------------------
- */
- if (do_write)
- {
+ *
+ * Functions tested:
+ *
+ * H5TBwrite_fields_name
+ *
+ *-------------------------------------------------------------------------
+ */
+ if (do_write) {
HL_TESTING2("writing fields by name");
/* make an empty table with fill values */
- if (H5TBmake_table(TITLE,fid,"table9",FIELDS,RECORDS,type_size_mem,
- field_names,field_offset,field_type,
- chunk_size,fill1,compress,0)<0)
+ if (H5TBmake_table(TITLE, fid, "table9", FIELDS, RECORDS, type_size_mem, field_names, field_offset,
+ field_type, chunk_size, fill1, compress, 0) < 0)
goto out;
/* write the pressure field starting at record 2 */
start = 2;
nrecords = NRECORDS_ADD;
- if (H5TBwrite_fields_name(fid,"table9","Pressure",start,nrecords,sizeof(float),
- 0,field_sizes_pre,pressure_in)<0)
+ if (H5TBwrite_fields_name(fid, "table9", "Pressure", start, nrecords, sizeof(float), 0,
+ field_sizes_pre, pressure_in) < 0)
goto out;
/* write the new longitude and latitude information starting at record 2 */
start = 2;
nrecords = 3;
- if (H5TBwrite_fields_name(fid,"table9","Latitude,Longitude",start,nrecords,sizeof(position_t),
- field_offset_pos,field_sizes_pos,position_in)<0)
+ if (H5TBwrite_fields_name(fid, "table9", "Latitude,Longitude", start, nrecords, sizeof(position_t),
+ field_offset_pos, field_sizes_pos, position_in) < 0)
goto out;
/* read back the all table */
start = 0;
nrecords = NRECORDS;
- if (H5TBread_table(fid,"table9",type_size_mem,field_offset,field_size,rbuf)<0)
+ if (H5TBread_table(fid, "table9", type_size_mem, field_offset, field_size, rbuf) < 0)
goto out;
{
-
/* compare the read values with the initial values */
- for( i = 0; i < NRECORDS; i++ )
- {
- if ( i >= 2 && i <= 4 )
- {
- if ( rbuf[i].lati != position_in[i-NRECORDS_ADD+1].lati ||
- rbuf[i].longi != position_in[i-NRECORDS_ADD+1].longi ||
- !H5_FLT_ABS_EQUAL(rbuf[i].pressure,pressure_in[i-NRECORDS_ADD+1]) )
- {
- HDfprintf(stderr,"%ld %f %d\n",
- rbuf[i].longi,(double)rbuf[i].pressure,rbuf[i].lati);
- HDfprintf(stderr,"%ld %f %d\n",
- position_in[i].longi,(double)pressure_in[i],position_in[i].lati);
+ for (i = 0; i < NRECORDS; i++) {
+ if (i >= 2 && i <= 4) {
+ if (rbuf[i].lati != position_in[i - NRECORDS_ADD + 1].lati ||
+ rbuf[i].longi != position_in[i - NRECORDS_ADD + 1].longi ||
+ !H5_FLT_ABS_EQUAL(rbuf[i].pressure, pressure_in[i - NRECORDS_ADD + 1])) {
+ HDfprintf(stderr, "%ld %f %d\n", rbuf[i].longi, (double)rbuf[i].pressure,
+ rbuf[i].lati);
+ HDfprintf(stderr, "%ld %f %d\n", position_in[i].longi, (double)pressure_in[i],
+ position_in[i].lati);
goto out;
}
}
}
}
-
-
PASSED();
} /*write*/
/*-------------------------------------------------------------------------
- *
- * Functions tested:
- *
- * H5TBread_fields_name
- *
- *-------------------------------------------------------------------------
- */
+ *
+ * Functions tested:
+ *
+ * H5TBread_fields_name
+ *
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("reading fields by name");
/*-------------------------------------------------------------------------
- * write and read the "Pressure" field
- *-------------------------------------------------------------------------
- */
- if (do_write)
- {
- if (H5TBmake_table(TITLE,fid,"table10",FIELDS,RECORDS,type_size_mem,
- field_names,field_offset,field_type,
- chunk_size,fill1,compress,0)<0)
+ * write and read the "Pressure" field
+ *-------------------------------------------------------------------------
+ */
+ if (do_write) {
+ if (H5TBmake_table(TITLE, fid, "table10", FIELDS, RECORDS, type_size_mem, field_names, field_offset,
+ field_type, chunk_size, fill1, compress, 0) < 0)
goto out;
/* write the pressure field to all the records */
start = 0;
nrecords = NRECORDS;
- if ( H5TBwrite_fields_name(fid,"table10","Pressure",start,nrecords,
- sizeof( float ),0,field_sizes_pre,pressure_in)<0)
+ if (H5TBwrite_fields_name(fid, "table10", "Pressure", start, nrecords, sizeof(float), 0,
+ field_sizes_pre, pressure_in) < 0)
goto out;
}
@@ -1184,170 +1068,149 @@ static int test_table(hid_t fid, int do_write)
nrecords = NRECORDS;
/* read an invalid field, should fail */
- if ( H5TBread_fields_name(fid,"table10","DoesNotExist",start,nrecords,
- sizeof(float),0,field_sizes_pre,pressure_out) >=0)
- goto out;
+ if (H5TBread_fields_name(fid, "table10", "DoesNotExist", start, nrecords, sizeof(float), 0,
+ field_sizes_pre, pressure_out) >= 0)
+ goto out;
/* read the "Pressure" field */
- if ( H5TBread_fields_name(fid,"table10","Pressure",start,nrecords,
- sizeof(float),0,field_sizes_pre,pressure_out)<0)
+ if (H5TBread_fields_name(fid, "table10", "Pressure", start, nrecords, sizeof(float), 0, field_sizes_pre,
+ pressure_out) < 0)
goto out;
/* Compare the extracted table with the initial values */
- for ( i = 0; i < NRECORDS; i++ )
- {
- if ( !H5_FLT_ABS_EQUAL(pressure_out[i], pressure_in[i]) ) {
+ for (i = 0; i < NRECORDS; i++) {
+ if (!H5_FLT_ABS_EQUAL(pressure_out[i], pressure_in[i])) {
goto out;
}
}
/*-------------------------------------------------------------------------
- * Write and read the "Latitude,Longitude" fields
- *-------------------------------------------------------------------------
- */
- if (do_write)
- {
+ * Write and read the "Latitude,Longitude" fields
+ *-------------------------------------------------------------------------
+ */
+ if (do_write) {
/* Write the new longitude and latitude information to all the records */
start = 0;
nrecords = NRECORDS_ADD;
- if ( H5TBwrite_fields_name(fid,"table10", "Latitude,Longitude", start, nrecords,
- sizeof( position_t ), field_offset_pos, field_sizes_pos, position_in ) < 0 )
+ if (H5TBwrite_fields_name(fid, "table10", "Latitude,Longitude", start, nrecords, sizeof(position_t),
+ field_offset_pos, field_sizes_pos, position_in) < 0)
goto out;
- }/*write*/
+ } /*write*/
/* Read the "Latitude,Longitude" fields */
start = 0;
nrecords = NRECORDS_ADD;
- if ( H5TBread_fields_name( fid, "table10", "Latitude,Longitude",
- start, nrecords, sizeof(position_t), field_offset_pos, field_sizes_pos, position_out ) < 0 )
+ if (H5TBread_fields_name(fid, "table10", "Latitude,Longitude", start, nrecords, sizeof(position_t),
+ field_offset_pos, field_sizes_pos, position_out) < 0)
goto out;
-
/* Compare the extracted table with the initial values */
- for( i = 0; i < NRECORDS_ADD; i++ )
- {
- if ( position_out[i].lati != position_in[i].lati ||
- position_out[i].longi != position_in[i].longi )
+ for (i = 0; i < NRECORDS_ADD; i++) {
+ if (position_out[i].lati != position_in[i].lati || position_out[i].longi != position_in[i].longi)
goto out;
}
-
/*-------------------------------------------------------------------------
- * Write and read the "Name,Pressure" fields
- *-------------------------------------------------------------------------
- */
- if (do_write)
- {
+ * Write and read the "Name,Pressure" fields
+ *-------------------------------------------------------------------------
+ */
+ if (do_write) {
/* Write the new name and pressure information to all the records */
start = 0;
nrecords = NRECORDS;
- if ( H5TBwrite_fields_name( fid, "table10", "Name,Pressure", start, nrecords,
- sizeof( namepressure_t ), field_offset_namepre, field_sizes_namepre, namepre_in ) < 0 )
+ if (H5TBwrite_fields_name(fid, "table10", "Name,Pressure", start, nrecords, sizeof(namepressure_t),
+ field_offset_namepre, field_sizes_namepre, namepre_in) < 0)
goto out;
- }/*write*/
+ } /*write*/
/* Read the "Name,Pressure" fields */
start = 0;
nrecords = NRECORDS;
- if ( H5TBread_fields_name( fid, "table10", "Name,Pressure",
- start, nrecords, sizeof(namepressure_t), field_offset_namepre, field_sizes_namepre,
- namepre_out ) < 0 )
+ if (H5TBread_fields_name(fid, "table10", "Name,Pressure", start, nrecords, sizeof(namepressure_t),
+ field_offset_namepre, field_sizes_namepre, namepre_out) < 0)
goto out;
-
/* Compare the extracted table with the initial values */
- for( i = 0; i < NRECORDS; i++ )
- {
- if ( ( HDstrcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) ||
- !H5_FLT_ABS_EQUAL(namepre_out[i].pressure,namepre_in[i].pressure) ) {
- goto out;
+ for (i = 0; i < NRECORDS; i++) {
+ if ((HDstrcmp(namepre_out[i].name, namepre_in[i].name) != 0) ||
+ !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, namepre_in[i].pressure)) {
+ goto out;
}
}
/* reset buffer */
- for( i = 0; i < NRECORDS; i++ )
- {
- HDstrcpy( namepre_out[i].name, "\0" );
+ for (i = 0; i < NRECORDS; i++) {
+ HDstrcpy(namepre_out[i].name, "\0");
namepre_out[i].pressure = -1;
}
/*-------------------------------------------------------------------------
- * read only 3 records of the "Name,Pressure" fields, starting at record 2
- *-------------------------------------------------------------------------
- */
+ * read only 3 records of the "Name,Pressure" fields, starting at record 2
+ *-------------------------------------------------------------------------
+ */
start = 2;
nrecords = 3;
- if ( H5TBread_fields_name( fid, "table10", "Name,Pressure",
- start, nrecords, sizeof(namepressure_t), field_offset_namepre,
- field_sizes_namepre, namepre_out ) < 0 )
+ if (H5TBread_fields_name(fid, "table10", "Name,Pressure", start, nrecords, sizeof(namepressure_t),
+ field_offset_namepre, field_sizes_namepre, namepre_out) < 0)
goto out;
-
/* Compare the extracted table with the initial values */
- for( i = 0; i < 3; i++ )
- {
+ for (i = 0; i < 3; i++) {
hsize_t iistart = start;
- if ( ( HDstrcmp( namepre_out[i].name, namepre_in[iistart+i].name ) != 0 ) ||
- !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, namepre_in[iistart+i].pressure) ) {
- goto out;
+ if ((HDstrcmp(namepre_out[i].name, namepre_in[iistart + i].name) != 0) ||
+ !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, namepre_in[iistart + i].pressure)) {
+ goto out;
}
}
-
-
PASSED();
/*-------------------------------------------------------------------------
- *
- * Functions tested:
- *
- * H5TBwrite_fields_index
- *
- *-------------------------------------------------------------------------
- */
- if (do_write)
- {
+ *
+ * Functions tested:
+ *
+ * H5TBwrite_fields_index
+ *
+ *-------------------------------------------------------------------------
+ */
+ if (do_write) {
HL_TESTING2("writing fields by index");
/* make an empty table */
- if (H5TBmake_table(TITLE,fid,"table11",FIELDS,RECORDS,type_size_mem,
- field_names,field_offset,field_type,
- chunk_size,fill,compress,NULL)<0)
+ if (H5TBmake_table(TITLE, fid, "table11", FIELDS, RECORDS, type_size_mem, field_names, field_offset,
+ field_type, chunk_size, fill, compress, NULL) < 0)
goto out;
/* write the pressure field starting at record 2 */
nfields = 1;
start = 2;
nrecords = NRECORDS_ADD;
- if ( H5TBwrite_fields_index(fid, "table11", nfields, field_index_pre, start, nrecords,
- sizeof( float ), 0, field_sizes_pre, pressure_in ) < 0 )
+ if (H5TBwrite_fields_index(fid, "table11", nfields, field_index_pre, start, nrecords, sizeof(float),
+ 0, field_sizes_pre, pressure_in) < 0)
goto out;
-
/* write the new longitude and latitude information starting at record 2 */
nfields = 2;
start = 2;
nrecords = NRECORDS_ADD;
- if ( H5TBwrite_fields_index(fid, "table11", nfields, field_index_pos, start, nrecords,
- sizeof( position_t ), field_offset_pos, field_sizes_pos, position_in ) < 0 )
+ if (H5TBwrite_fields_index(fid, "table11", nfields, field_index_pos, start, nrecords,
+ sizeof(position_t), field_offset_pos, field_sizes_pos, position_in) < 0)
goto out;
/* read back the all table */
nfields = 5;
start = 0;
nrecords = NRECORDS;
- if ( H5TBread_fields_index(fid, "table11", nfields, field_index,
- start, nrecords, type_size_mem, field_offset, field_size, rbuf ) < 0 )
+ if (H5TBread_fields_index(fid, "table11", nfields, field_index, start, nrecords, type_size_mem,
+ field_offset, field_size, rbuf) < 0)
goto out;
/* Compare the extracted table with the initial values */
- for( i = 0; i < NRECORDS; i++ )
- {
- if ( i >= 2 && i <= 4 )
- {
- if ( rbuf[i].lati != position_in[i-NRECORDS_ADD+1].lati ||
- rbuf[i].longi != position_in[i-NRECORDS_ADD+1].longi ||
- !H5_FLT_ABS_EQUAL(rbuf[i].pressure,pressure_in[i-NRECORDS_ADD+1]) )
+ for (i = 0; i < NRECORDS; i++) {
+ if (i >= 2 && i <= 4) {
+ if (rbuf[i].lati != position_in[i - NRECORDS_ADD + 1].lati ||
+ rbuf[i].longi != position_in[i - NRECORDS_ADD + 1].longi ||
+ !H5_FLT_ABS_EQUAL(rbuf[i].pressure, pressure_in[i - NRECORDS_ADD + 1]))
goto out;
}
}
@@ -1355,37 +1218,34 @@ static int test_table(hid_t fid, int do_write)
PASSED();
}
-
/*-------------------------------------------------------------------------
- *
- * Functions tested:
- *
- * H5TBread_fields_index
- *
- *-------------------------------------------------------------------------
- */
+ *
+ * Functions tested:
+ *
+ * H5TBread_fields_index
+ *
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("reading fields by index");
- if (do_write)
- {
+ if (do_write) {
/* make an empty table */
- if (H5TBmake_table(TITLE,fid,"table12",FIELDS,RECORDS,type_size_mem,
- field_names,field_offset,field_type,
- chunk_size,fill,compress,NULL)<0)
+ if (H5TBmake_table(TITLE, fid, "table12", FIELDS, RECORDS, type_size_mem, field_names, field_offset,
+ field_type, chunk_size, fill, compress, NULL) < 0)
goto out;
/*-------------------------------------------------------------------------
- * write and read the "Pressure" field
- *-------------------------------------------------------------------------
- */
+ * write and read the "Pressure" field
+ *-------------------------------------------------------------------------
+ */
/* write the pressure field to all the records */
nfields = 1;
start = 0;
nrecords = NRECORDS;
- if ( H5TBwrite_fields_index(fid, "table12", nfields, field_index_pre, start, nrecords,
- sizeof( float ), 0, field_sizes_pre, pressure_in ) < 0 )
+ if (H5TBwrite_fields_index(fid, "table12", nfields, field_index_pre, start, nrecords, sizeof(float),
+ 0, field_sizes_pre, pressure_in) < 0)
goto out;
}
@@ -1393,196 +1253,178 @@ static int test_table(hid_t fid, int do_write)
nfields = 1;
start = 0;
nrecords = NRECORDS;
- if ( H5TBread_fields_index(fid, "table12", nfields, field_index_pre,
- start, nrecords, sizeof(float), 0, field_sizes_pre, pressure_out ) < 0 )
+ if (H5TBread_fields_index(fid, "table12", nfields, field_index_pre, start, nrecords, sizeof(float), 0,
+ field_sizes_pre, pressure_out) < 0)
goto out;
/* compare the extracted table with the initial values */
- for( i = 0; i < NRECORDS; i++ )
- {
- if ( !H5_FLT_ABS_EQUAL(pressure_out[i], pressure_in[i]) ) {
+ for (i = 0; i < NRECORDS; i++) {
+ if (!H5_FLT_ABS_EQUAL(pressure_out[i], pressure_in[i])) {
goto out;
}
}
/*-------------------------------------------------------------------------
- * write and read the "Latitude,Longitude" fields
- *-------------------------------------------------------------------------
- */
- if (do_write)
- {
+ * write and read the "Latitude,Longitude" fields
+ *-------------------------------------------------------------------------
+ */
+ if (do_write) {
/* write the new longitude and latitude information to all the records */
- nfields = 2;
+ nfields = 2;
start = 0;
nrecords = NRECORDS;
- if ( H5TBwrite_fields_index(fid, "table12", nfields, field_index_pos, start, nrecords,
- sizeof( position_t ), field_offset_pos, field_sizes_pos, position_in ) < 0 )
+ if (H5TBwrite_fields_index(fid, "table12", nfields, field_index_pos, start, nrecords,
+ sizeof(position_t), field_offset_pos, field_sizes_pos, position_in) < 0)
goto out;
} /*write*/
/* read the "Latitude,Longitude" fields */
- nfields = 2;
+ nfields = 2;
start = 0;
nrecords = NRECORDS_ADD;
- if ( H5TBread_fields_index(fid, "table12", nfields, field_index_pos,
- start, nrecords, sizeof(position_t), field_offset_pos, field_sizes_pos, position_out ) < 0 )
+ if (H5TBread_fields_index(fid, "table12", nfields, field_index_pos, start, nrecords, sizeof(position_t),
+ field_offset_pos, field_sizes_pos, position_out) < 0)
goto out;
/* compare the extracted table with the initial values */
- for( i = 0; i < NRECORDS_ADD; i++ )
- {
- if ( position_out[i].lati != position_in[i].lati ||
- position_out[i].longi != position_in[i].longi ) {
- goto out;
+ for (i = 0; i < NRECORDS_ADD; i++) {
+ if (position_out[i].lati != position_in[i].lati || position_out[i].longi != position_in[i].longi) {
+ goto out;
}
}
/*-------------------------------------------------------------------------
- * write and read the "Name,Pressure" fields
- *-------------------------------------------------------------------------
- */
+ * write and read the "Name,Pressure" fields
+ *-------------------------------------------------------------------------
+ */
- if (do_write)
- {
+ if (do_write) {
/* write the new name and pressure information to all the records */
- nfields = 2;
+ nfields = 2;
start = 0;
nrecords = NRECORDS;
- if ( H5TBwrite_fields_index(fid, "table12", nfields, field_index_namepre, start, nrecords,
- sizeof( namepressure_t ), field_offset_namepre, field_sizes_namepre, namepre_in ) < 0 )
+ if (H5TBwrite_fields_index(fid, "table12", nfields, field_index_namepre, start, nrecords,
+ sizeof(namepressure_t), field_offset_namepre, field_sizes_namepre,
+ namepre_in) < 0)
goto out;
}
/* read the "Name,Pressure" fields */
- nfields = 2;
+ nfields = 2;
start = 0;
nrecords = NRECORDS;
- if ( H5TBread_fields_index(fid, "table12", nfields, field_index_namepre,
- start, nrecords, sizeof(namepressure_t), field_offset_namepre,
- field_sizes_namepre, namepre_out ) < 0 )
+ if (H5TBread_fields_index(fid, "table12", nfields, field_index_namepre, start, nrecords,
+ sizeof(namepressure_t), field_offset_namepre, field_sizes_namepre,
+ namepre_out) < 0)
goto out;
/* compare the extracted table with the initial values */
- for( i = 0; i < NRECORDS; i++ )
- {
- if ( ( HDstrcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) ||
- !H5_FLT_ABS_EQUAL(namepre_out[i].pressure,namepre_in[i].pressure) ) {
- goto out;
- }
+ for (i = 0; i < NRECORDS; i++) {
+ if ((HDstrcmp(namepre_out[i].name, namepre_in[i].name) != 0) ||
+ !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, namepre_in[i].pressure)) {
+ goto out;
+ }
}
/* reset buffer */
- for( i = 0; i < NRECORDS; i++ )
- {
- HDstrcpy( namepre_out[i].name, "\0" );
+ for (i = 0; i < NRECORDS; i++) {
+ HDstrcpy(namepre_out[i].name, "\0");
namepre_out[i].pressure = -1;
}
/*-------------------------------------------------------------------------
- * read only 3 records of the "Name,Pressure" fields, starting at record 2
- *-------------------------------------------------------------------------
- */
+ * read only 3 records of the "Name,Pressure" fields, starting at record 2
+ *-------------------------------------------------------------------------
+ */
/* write the new name and pressure information to all the records */
nfields = 2;
start = 2;
nrecords = 3;
- if ( H5TBread_fields_index(fid, "table12", nfields, field_index_namepre,
- start, nrecords, sizeof(namepressure_t), field_offset_namepre,
- field_sizes_namepre, namepre_out ) < 0 )
+ if (H5TBread_fields_index(fid, "table12", nfields, field_index_namepre, start, nrecords,
+ sizeof(namepressure_t), field_offset_namepre, field_sizes_namepre,
+ namepre_out) < 0)
goto out;
/* compare the extracted table with the initial values */
- for( i = 0; i < 3; i++ )
- {
- int iistart = (int) start;
- if ( ( HDstrcmp( namepre_out[i].name, wbuf[iistart+(int)i].name ) != 0 ) ||
- !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, wbuf[iistart+(int)i].pressure) ) {
- goto out;
+ for (i = 0; i < 3; i++) {
+ int iistart = (int)start;
+ if ((HDstrcmp(namepre_out[i].name, wbuf[iistart + (int)i].name) != 0) ||
+ !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, wbuf[iistart + (int)i].pressure)) {
+ goto out;
}
}
PASSED();
-
/*-------------------------------------------------------------------------
- *
- * Functions tested:
- *
- * H5TBinsert_field
- *
- *-------------------------------------------------------------------------
- */
+ *
+ * Functions tested:
+ *
+ * H5TBinsert_field
+ *
+ *-------------------------------------------------------------------------
+ */
- if (do_write)
- {
+ if (do_write) {
HL_TESTING2("inserting fields");
/* make a table */
- if (H5TBmake_table(TITLE,fid,"table13",FIELDS,RECORDS,type_size_mem,
- field_names,field_offset,field_type,
- chunk_size,fill1,compress,wbuf)<0)
+ if (H5TBmake_table(TITLE, fid, "table13", FIELDS, RECORDS, type_size_mem, field_names, field_offset,
+ field_type, chunk_size, fill1, compress, wbuf) < 0)
goto out;
/* insert the new field at the end of the field list */
position = NFIELDS;
- if ( H5TBinsert_field( fid, "table13", "New Field", field_type_new, position,
- fill1_new, buf_new ) < 0 )
+ if (H5TBinsert_field(fid, "table13", "New Field", field_type_new, position, fill1_new, buf_new) < 0)
goto out;
/* read the table */
- if ( H5TBread_table( fid, "table13", dst_size2, dst_offset2, dst_sizes2, rbuf2 ) < 0 )
+ if (H5TBread_table(fid, "table13", dst_size2, dst_offset2, dst_sizes2, rbuf2) < 0)
goto out;
/* compare the extracted table with the original array */
- for( i = 0; i < NRECORDS; i++ )
- {
- if ( ( HDstrcmp( rbuf2[i].name, wbuf[i].name ) != 0 ) ||
- rbuf2[i].lati != wbuf[i].lati ||
- rbuf2[i].longi != wbuf[i].longi ||
- !H5_FLT_ABS_EQUAL(rbuf2[i].pressure,wbuf[i].pressure) ||
- !H5_DBL_ABS_EQUAL(rbuf2[i].temperature,wbuf[i].temperature) ||
- rbuf2[i].new_field != buf_new[i] ) {
- goto out;
+ for (i = 0; i < NRECORDS; i++) {
+ if ((HDstrcmp(rbuf2[i].name, wbuf[i].name) != 0) || rbuf2[i].lati != wbuf[i].lati ||
+ rbuf2[i].longi != wbuf[i].longi || !H5_FLT_ABS_EQUAL(rbuf2[i].pressure, wbuf[i].pressure) ||
+ !H5_DBL_ABS_EQUAL(rbuf2[i].temperature, wbuf[i].temperature) ||
+ rbuf2[i].new_field != buf_new[i]) {
+ goto out;
}
}
PASSED();
}
/*-------------------------------------------------------------------------
- *
- * Functions tested:
- *
- * H5TBdelete_field
- *
- *-------------------------------------------------------------------------
- */
- if (do_write)
- {
+ *
+ * Functions tested:
+ *
+ * H5TBdelete_field
+ *
+ *-------------------------------------------------------------------------
+ */
+ if (do_write) {
HL_TESTING2("deleting fields");
/* make a table */
- if (H5TBmake_table(TITLE,fid,"table14",FIELDS,RECORDS,type_size_mem,
- field_names,field_offset,field_type,
- chunk_size,fill,compress,wbuf)<0)
+ if (H5TBmake_table(TITLE, fid, "table14", FIELDS, RECORDS, type_size_mem, field_names, field_offset,
+ field_type, chunk_size, fill, compress, wbuf) < 0)
goto out;
/* delete the field */
- if ( H5TBdelete_field(fid, "table14", "Pressure" ) < 0 )
+ if (H5TBdelete_field(fid, "table14", "Pressure") < 0)
goto out;
/* read the table */
- if ( H5TBread_table(fid, "table14", dst_size3, dst_offset3, dst_sizes3, rbuf3 ) < 0 )
+ if (H5TBread_table(fid, "table14", dst_size3, dst_offset3, dst_sizes3, rbuf3) < 0)
goto out;
/* compare the extracted table with the original array */
- for( i = 0; i < NRECORDS; i++ )
- {
- if ( ( HDstrcmp( rbuf3[i].name, wbuf[i].name ) != 0 ) ||
- rbuf3[i].lati != wbuf[i].lati ||
+ for (i = 0; i < NRECORDS; i++) {
+ if ((HDstrcmp(rbuf3[i].name, wbuf[i].name) != 0) || rbuf3[i].lati != wbuf[i].lati ||
rbuf3[i].longi != wbuf[i].longi ||
- !H5_DBL_ABS_EQUAL(rbuf3[i].temperature,wbuf[i].temperature) ) {
- goto out;
+ !H5_DBL_ABS_EQUAL(rbuf3[i].temperature, wbuf[i].temperature)) {
+ goto out;
}
}
@@ -1590,143 +1432,140 @@ static int test_table(hid_t fid, int do_write)
}
/*-------------------------------------------------------------------------
- *
- * Functions tested:
- *
- * H5TBget_table_info
- * H5TBget_field_info
- *
- *-------------------------------------------------------------------------
- */
+ *
+ * Functions tested:
+ *
+ * H5TBget_table_info
+ * H5TBget_field_info
+ *
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("getting table info");
/* get table info */
- if ( H5TBget_table_info (fid, "table1", &rfields, &rrecords ) < 0 )
+ if (H5TBget_table_info(fid, "table1", &rfields, &rrecords) < 0)
goto out;
- if ( NFIELDS != rfields || rrecords != NRECORDS ) {
+ if (NFIELDS != rfields || rrecords != NRECORDS) {
goto out;
}
PASSED();
/*-------------------------------------------------------------------------
- *
- * Functions tested:
- *
- * H5TBget_field_info
- *
- *-------------------------------------------------------------------------
- */
+ *
+ * Functions tested:
+ *
+ * H5TBget_field_info
+ *
+ *-------------------------------------------------------------------------
+ */
HL_TESTING2("getting field info");
/* alocate */
- names_out = (char**) HDmalloc( sizeof(char*) * (size_t)NFIELDS );
- for ( i = 0; i < NFIELDS; i++)
- {
- names_out[i] = (char*) HDmalloc( sizeof(char) * 255 );
+ names_out = (char **)HDmalloc(sizeof(char *) * (size_t)NFIELDS);
+ for (i = 0; i < NFIELDS; i++) {
+ names_out[i] = (char *)HDmalloc(sizeof(char) * 255);
}
/* Get field info */
- if ( H5TBget_field_info(fid, "table1", names_out, sizes_out, offset_out, &size_out ) < 0 )
+ if (H5TBget_field_info(fid, "table1", names_out, sizes_out, offset_out, &size_out) < 0)
goto out;
- for ( i = 0; i < NFIELDS; i++)
- {
- if ( (HDstrcmp( field_names[i], names_out[i] ) != 0)) {
+ for (i = 0; i < NFIELDS; i++) {
+ if ((HDstrcmp(field_names[i], names_out[i]) != 0)) {
goto out;
}
}
/* release */
- for ( i = 0; i < NFIELDS; i++)
- {
- HDfree ( names_out[i] );
+ for (i = 0; i < NFIELDS; i++) {
+ HDfree(names_out[i]);
}
- HDfree ( names_out );
+ HDfree(names_out);
PASSED();
/*-------------------------------------------------------------------------
- * end
- *-------------------------------------------------------------------------
- */
+ * end
+ *-------------------------------------------------------------------------
+ */
return 0;
out:
H5_FAILED();
return -1;
}
-
/*-------------------------------------------------------------------------
-* the main program
-*-------------------------------------------------------------------------
-*/
+ * the main program
+ *-------------------------------------------------------------------------
+ */
-int main(void)
+int
+main(void)
{
- hid_t fid; /* identifier for the file */
- unsigned flags=H5F_ACC_RDONLY;
+ hid_t fid; /* identifier for the file */
+ unsigned flags = H5F_ACC_RDONLY;
/*-------------------------------------------------------------------------
- * test1: create a file for the write/read test
- *-------------------------------------------------------------------------
- */
+ * test1: create a file for the write/read test
+ *-------------------------------------------------------------------------
+ */
/* create a file using default properties */
- fid=H5Fcreate("test_table.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);
+ fid = H5Fcreate("test_table.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
HDputs("Testing table with file creation mode (read/write in native architecture):");
/* test, do write */
- if (test_table(fid,1)<0)
+ if (test_table(fid, 1) < 0)
goto out;
/* close */
H5Fclose(fid);
/*-------------------------------------------------------------------------
- * test2: open a file written in test1 on a big-endian machine
- *-------------------------------------------------------------------------
- */
+ * test2: open a file written in test1 on a big-endian machine
+ *-------------------------------------------------------------------------
+ */
HDputs("Testing table with file open mode (read big-endian data):");
- fid=h5file_open(TEST_FILE_BE,flags);
+ fid = h5file_open(TEST_FILE_BE, flags);
/* test, do not write */
- if (test_table(fid,0)<0)
+ if (test_table(fid, 0) < 0)
goto out;
/* close */
H5Fclose(fid);
/*-------------------------------------------------------------------------
- * test3: open a file written in test1 on a little-endian machine
- *-------------------------------------------------------------------------
- */
+ * test3: open a file written in test1 on a little-endian machine
+ *-------------------------------------------------------------------------
+ */
HDputs("Testing table with file open mode (read little-endian data):");
- fid=h5file_open(TEST_FILE_LE,flags);
+ fid = h5file_open(TEST_FILE_LE, flags);
/* test, do not write */
- if (test_table(fid,0)<0)
+ if (test_table(fid, 0) < 0)
goto out;
/* close */
H5Fclose(fid);
/*-------------------------------------------------------------------------
- * test4: open a file written in test1 on the Cray T3 machine
- *-------------------------------------------------------------------------
- */
+ * test4: open a file written in test1 on the Cray T3 machine
+ *-------------------------------------------------------------------------
+ */
HDputs("Testing table with file open mode (read Cray data):");
- fid=h5file_open(TEST_FILE_CRAY,flags);
+ fid = h5file_open(TEST_FILE_CRAY, flags);
/* test, do not write */
- if (test_table(fid,0)<0)
+ if (test_table(fid, 0) < 0)
goto out;
/* close */
@@ -1737,5 +1576,3 @@ out:
H5Fclose(fid);
return 1;
}
-
-
diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c
index 129fa60..710d29f 100644
--- a/hl/tools/gif2h5/decompress.c
+++ b/hl/tools/gif2h5/decompress.c
@@ -15,45 +15,43 @@
#include "gif.h"
-GIFWORD iWIDE, iHIGH, eWIDE, eHIGH, expand, numcols, strip, nostrip;
-unsigned long cols[256];
-char *cmd;
+GIFWORD iWIDE, iHIGH, eWIDE, eHIGH, expand, numcols, strip, nostrip;
+unsigned long cols[256];
+char * cmd;
FILE *fp;
-static GIFWORD
- XC = 0, YC = 0, /* Output X and Y coords of current pixel */
- InitCodeSize, /* Starting code size, used during Clear */
- CodeSize, /* Code size, read from GIF header */
- BytesPerScanline, /* Bytes per scanline in output raster */
- IWidth, IHeight; /* image dimensions */
-static int
- BitOffset = 0, /* Bit Offset of next code */
- Pass = 0, /* Used by output routine if GIFWORDerlaced pic */
- OutCount = 0, /* Decompressor output 'stack count' */
- Code, /* Value returned by ReadCode */
- MaxCode, /* limiting value for current code size */
- ClearCode, /* GIF clear code */
- EOFCode, /* GIF end-of-information code */
- CurCode, OldCode, InCode, /* Decompressor variables */
- FirstFree, /* First free code, generated per GIF spec */
- FreeCode, /* Decompressor, next free slot in hash table */
- FinChar, /* Decompressor variable */
- DataMask, /* AND mask for data size */
- ReadMask; /* Code AND mask for current code size */
+static GIFWORD XC = 0, YC = 0, /* Output X and Y coords of current pixel */
+ InitCodeSize, /* Starting code size, used during Clear */
+ CodeSize, /* Code size, read from GIF header */
+ BytesPerScanline, /* Bytes per scanline in output raster */
+ IWidth, IHeight; /* image dimensions */
+static int BitOffset = 0, /* Bit Offset of next code */
+ Pass = 0, /* Used by output routine if GIFWORDerlaced pic */
+ OutCount = 0, /* Decompressor output 'stack count' */
+ Code, /* Value returned by ReadCode */
+ MaxCode, /* limiting value for current code size */
+ ClearCode, /* GIF clear code */
+ EOFCode, /* GIF end-of-information code */
+ CurCode, OldCode, InCode, /* Decompressor variables */
+ FirstFree, /* First free code, generated per GIF spec */
+ FreeCode, /* Decompressor, next free slot in hash table */
+ FinChar, /* Decompressor variable */
+ DataMask, /* AND mask for data size */
+ ReadMask; /* Code AND mask for current code size */
/*MODIFICATIONS*/
-GIFBYTE tempbyte[10];
-GIFBYTE * tempGIFBYTEptr[10];
-GIFWORD tempint[10];
-GIFWORD ImageCount = 0;
+GIFBYTE tempbyte[10];
+GIFBYTE *tempGIFBYTEptr[10];
+GIFWORD tempint[10];
+GIFWORD ImageCount = 0;
/*END MODIFICATION*/
boolean Interlace, HasColormap;
-GIFBYTE *Image; /* The result array */
-GIFBYTE *RawGIF; /* The heap array to hold it, raw */
-GIFBYTE *Raster; /* The raster data stream, unblocked */
+GIFBYTE *Image; /* The result array */
+GIFBYTE *RawGIF; /* The heap array to hold it, raw */
+GIFBYTE *Raster; /* The raster data stream, unblocked */
/* The hash table used by the decompressor */
@@ -66,7 +64,7 @@ int *OutCode;
/* The color map, read from the GIF header */
-int numused;
+int numused;
/*
* Fetch the next code from the raster data stream. The codes can be any
@@ -82,7 +80,7 @@ ReadCode(void)
int RawCode, ByteOffset;
ByteOffset = BitOffset / 8;
- RawCode = Raster[ByteOffset] + (0x100 * Raster[ByteOffset + 1]);
+ RawCode = Raster[ByteOffset] + (0x100 * Raster[ByteOffset + 1]);
if (CodeSize >= 8)
RawCode += (0x10000 * Raster[ByteOffset + 2]);
@@ -95,10 +93,8 @@ ReadCode(void)
static void
AddToPixel(GIFBYTE Index)
{
- if (YC<IHeight)
- *(Image + YC * BytesPerScanline + XC) = Index;
-
-
+ if (YC < IHeight)
+ *(Image + YC * BytesPerScanline + XC) = Index;
/* Update the X-coordinate, and if it overflows, update the
* Y-coordinate */
@@ -113,40 +109,41 @@ AddToPixel(GIFBYTE Index)
if (!Interlace) {
YC++;
- } else {
+ }
+ else {
switch (Pass) {
- case 0:
- YC += 8;
-
- if (YC >= IHeight) {
- Pass++;
- YC = 4;
- }
-
- break;
- case 1:
- YC += 8;
-
- if (YC >= IHeight) {
- Pass++;
- YC = 2;
- }
-
- break;
- case 2:
- YC += 4;
-
- if (YC >= IHeight) {
- Pass++;
- YC = 1;
- }
-
- break;
- case 3:
- YC += 2;
- break;
- default:
- break;
+ case 0:
+ YC += 8;
+
+ if (YC >= IHeight) {
+ Pass++;
+ YC = 4;
+ }
+
+ break;
+ case 1:
+ YC += 8;
+
+ if (YC >= IHeight) {
+ Pass++;
+ YC = 2;
+ }
+
+ break;
+ case 2:
+ YC += 4;
+
+ if (YC >= IHeight) {
+ Pass++;
+ YC = 1;
+ }
+
+ break;
+ case 3:
+ YC += 2;
+ break;
+ default:
+ break;
}
}
}
@@ -172,20 +169,20 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
exit(EXIT_FAILURE);
}
- XC = 0;
- YC = 0;
- Pass = 0;
- OutCount = 0;
+ XC = 0;
+ YC = 0;
+ Pass = 0;
+ OutCount = 0;
BitOffset = 0;
- DataMask = (1 << ((GifHead->PackedField & 0x07) +1)) -1;
- Raster = GifImageDesc->GIFImage;
+ DataMask = (1 << ((GifHead->PackedField & 0x07) + 1)) - 1;
+ Raster = GifImageDesc->GIFImage;
/* Check for image seperator */
/* Now read in values from the image descriptor */
- IWidth = GifImageDesc->ImageWidth;
- IHeight = GifImageDesc->ImageHeight;
+ IWidth = GifImageDesc->ImageWidth;
+ IHeight = GifImageDesc->ImageHeight;
Interlace = (uint8_t)(GifImageDesc->PackedField & 0x40);
/*
@@ -200,9 +197,9 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
* compute decompressor constant values, based on this code size.
*/
- CodeSize = GifImageDesc->CodeSize;
+ CodeSize = GifImageDesc->CodeSize;
ClearCode = (1 << CodeSize);
- EOFCode = ClearCode + 1;
+ EOFCode = ClearCode + 1;
FreeCode = FirstFree = ClearCode + 2;
/*
@@ -214,8 +211,8 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
CodeSize++;
InitCodeSize = CodeSize;
- MaxCode = (1 << CodeSize);
- ReadMask = MaxCode - 1;
+ MaxCode = (1 << CodeSize);
+ ReadMask = MaxCode - 1;
/*
* Read the raster data. Here we just transpose it from the GIF array to
@@ -225,7 +222,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
/* Allocate the Image */
- if (!(Image = (GIFBYTE *)malloc((size_t)IWidth*(size_t)IHeight))) {
+ if (!(Image = (GIFBYTE *)malloc((size_t)IWidth * (size_t)IHeight))) {
printf("Out of memory");
exit(EXIT_FAILURE);
}
@@ -246,13 +243,14 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
*/
if (Code == ClearCode) {
CodeSize = InitCodeSize;
- MaxCode = (1 << CodeSize);
+ MaxCode = (1 << CodeSize);
ReadMask = MaxCode - 1;
FreeCode = FirstFree;
CurCode = OldCode = Code = ReadCode();
- FinChar = CurCode & DataMask;
+ FinChar = CurCode & DataMask;
AddToPixel((GIFBYTE)FinChar);
- } else {
+ }
+ else {
/*
* If not a clear code, then must be data: save same as CurCode
* and InCode
@@ -264,7 +262,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
* repeat the last character decoded
*/
if (CurCode >= FreeCode) {
- CurCode = OldCode;
+ CurCode = OldCode;
OutCode[OutCount++] = FinChar;
}
@@ -279,11 +277,11 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
}
OutCode[OutCount++] = Suffix[CurCode];
- CurCode = Prefix[CurCode];
+ CurCode = Prefix[CurCode];
}
/* The last code in the chain is treated as raw data. */
- FinChar = CurCode & DataMask;
+ FinChar = CurCode & DataMask;
OutCode[OutCount++] = FinChar;
/*
@@ -301,7 +299,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
*/
Prefix[FreeCode] = OldCode;
Suffix[FreeCode] = FinChar;
- OldCode = InCode;
+ OldCode = InCode;
/*
* Point to the next slot in the table. If we exceed the current
diff --git a/hl/tools/gif2h5/gif.h b/hl/tools/gif2h5/gif.h
index 0c0f963..cb54b9b 100644
--- a/hl/tools/gif2h5/gif.h
+++ b/hl/tools/gif2h5/gif.h
@@ -16,7 +16,7 @@
* Purpose: GIF Header file
*/
#ifndef GIF_H_
-#define GIF_H_ 1
+#define GIF_H_ 1
#include <stdio.h>
#include <stdlib.h>
@@ -39,10 +39,10 @@ typedef unsigned char boolean;
#endif
#ifndef false
-#define false 0
+#define false 0
#endif
#ifndef true
-#define true 1
+#define true 1
#endif
/* Set the EndianOrder.
@@ -50,7 +50,7 @@ typedef unsigned char boolean;
** Set EndianOrder = 0 if machine is little endian
** EndianOrder = 1 if machine is big endian.
*/
-extern int EndianOrder;
+extern int EndianOrder;
/*
** The GIF header format.
@@ -59,31 +59,30 @@ extern int EndianOrder;
** descriptor, and the global color table for the GIF image.
*/
typedef struct _GifHeader { /* Offset Description */
- GIFBYTE PackedField; /* 0Ah Color Information */
+ GIFBYTE PackedField; /* 0Ah Color Information */
GIFWORD TableSize;
- GIFBYTE ImageCount; /* Keep a count of the number of images */
+ GIFBYTE ImageCount; /* Keep a count of the number of images */
GIFBYTE CommentCount;
GIFBYTE ApplicationCount;
GIFBYTE PlainTextCount;
GIFBYTE HDFPalette[256][3];
- GIFBYTE HeaderDump[6]; /* GIFBYTE array to dump header contents */
- GIFBYTE LSDDump[7]; /* Logical Screen Descriptor dump */
+ GIFBYTE HeaderDump[6]; /* GIFBYTE array to dump header contents */
+ GIFBYTE LSDDump[7]; /* Logical Screen Descriptor dump */
} GIFHEAD;
-
/*
** The GIF Image Descriptor.
*/
typedef struct _GifImageDescriptor {
- GIFWORD ImageWidth; /* Width of the image in pixels */
- GIFWORD ImageHeight; /* Height of the image in pixels */
- GIFBYTE PackedField; /* Image and Color Table Data Information */
+ GIFWORD ImageWidth; /* Width of the image in pixels */
+ GIFWORD ImageHeight; /* Height of the image in pixels */
+ GIFBYTE PackedField; /* Image and Color Table Data Information */
GIFWORD TableSize;
- GIFWORD CodeSize; /* Minimum LZW CodeSize for image data */
+ GIFWORD CodeSize; /* Minimum LZW CodeSize for image data */
GIFBYTE HDFPalette[256][3];
- GIFBYTE GIDDump[9]; /* GifImageDescriptor dump */
+ GIFBYTE GIDDump[9]; /* GifImageDescriptor dump */
- GIFBYTE *Image; /* Decompressed Raster Image */
+ GIFBYTE *Image; /* Decompressed Raster Image */
GIFBYTE *GIFImage;
} GIFIMAGEDESC;
@@ -91,36 +90,35 @@ typedef struct _GifImageDescriptor {
** GIF 89a Graphic Control Extension Block
*/
typedef struct _GifGraphicControlExtension {
- GIFBYTE GCEDump[5]; /* Graphic Control Extension Dump */
+ GIFBYTE GCEDump[5]; /* Graphic Control Extension Dump */
} GIFGRAPHICCONTROL;
/*
** GIF 89a Plain Text Extension Block
*/
typedef struct _GifPlainTextExtension {
- GIFBYTE PTEDump[15]; /* Plain Text Extension Dump */
- GIFBYTE *PlainTextData; /* Plain Text data sub-blocks */
- GIFWORD DataSize;
+ GIFBYTE PTEDump[15]; /* Plain Text Extension Dump */
+ GIFBYTE *PlainTextData; /* Plain Text data sub-blocks */
+ GIFWORD DataSize;
} GIFPLAINTEXT;
-
/*
** GIF 89a Application Extension Block
*/
typedef struct _GifApplicationExtension {
- GIFBYTE AEDump[14]; /* Application Extension Dump */
- GIFBYTE *ApplicationData; /* Application data sub-blocks */
- GIFWORD DataSize;
+ GIFBYTE AEDump[14]; /* Application Extension Dump */
+ GIFBYTE *ApplicationData; /* Application data sub-blocks */
+ GIFWORD DataSize;
} GIFAPPLICATION;
/*
** GIF 89a Comment Extension Block
*/
typedef struct _GifCommentExtension {
- GIFBYTE CEDump[2]; /* Comment Extension Dump */
- GIFBYTE *CommentData; /* Comment data sub-blocks */
- GIFWORD DataSize;
- GIFBYTE Terminator; /* Block Terminator (always 0) */
+ GIFBYTE CEDump[2]; /* Comment Extension Dump */
+ GIFBYTE *CommentData; /* Comment data sub-blocks */
+ GIFWORD DataSize;
+ GIFBYTE Terminator; /* Block Terminator (always 0) */
} GIFCOMMENT;
/*
@@ -135,12 +133,12 @@ typedef struct _GifCommentExtension {
** extension.
*/
typedef struct _GifToMem {
- GIFHEAD *GifHeader;
- GIFIMAGEDESC **GifImageDesc;
+ GIFHEAD * GifHeader;
+ GIFIMAGEDESC ** GifImageDesc;
GIFGRAPHICCONTROL **GifGraphicControlExtension;
- GIFPLAINTEXT **GifPlainTextExtension;
- GIFAPPLICATION **GifApplicationExtension;
- GIFCOMMENT **GifCommentExtension;
+ GIFPLAINTEXT ** GifPlainTextExtension;
+ GIFAPPLICATION ** GifApplicationExtension;
+ GIFCOMMENT ** GifCommentExtension;
} GIFTOMEM;
/*
@@ -159,12 +157,11 @@ int ReadGifApplication(GIFAPPLICATION *, GIFBYTE **);
int ReadGifComment(GIFCOMMENT *, GIFBYTE **);
/* HDFGIFWR.C */
-int hdfWriteGIF(FILE *fp, GIFBYTE *pic, int ptype, int w, int h, GIFBYTE *rmap,
- GIFBYTE *gmap, GIFBYTE *bmap, GIFBYTE *pc2ncmap, int numcols,
- int colorstyle, int BitsPerPixel);
+int hdfWriteGIF(FILE *fp, GIFBYTE *pic, int ptype, int w, int h, GIFBYTE *rmap, GIFBYTE *gmap, GIFBYTE *bmap,
+ GIFBYTE *pc2ncmap, int numcols, int colorstyle, int BitsPerPixel);
/* WRITEHDF.C */
-int WriteHDF(GIFTOMEM , GIFCHAR * );
+int WriteHDF(GIFTOMEM, GIFCHAR *);
/* Function: ReadHDF
** Return: 0 on completion without error, -1 on error
@@ -175,13 +172,13 @@ int WriteHDF(GIFTOMEM , GIFCHAR * );
** GIFBYTE palette[256][3] - the corresponding palette
** hsize_t* image_size - the size of each dimension of the image
*/
-int ReadHDF(GIFBYTE** data, GIFBYTE palette[256][3], hsize_t *image_size,
- GIFCHAR *h5_file, GIFCHAR *dset_name, GIFCHAR *pal_name);
+int ReadHDF(GIFBYTE **data, GIFBYTE palette[256][3], hsize_t *image_size, GIFCHAR *h5_file,
+ GIFCHAR *dset_name, GIFCHAR *pal_name);
GIFBYTE *Decompress(GIFIMAGEDESC *, GIFHEAD *);
-GIFBYTE GetByte(GIFBYTE *);
-GIFWORD GetWord(GIFBYTE *);
+GIFBYTE GetByte(GIFBYTE *);
+GIFWORD GetWord(GIFBYTE *);
-void cleanup(GIFBYTE*);
+void cleanup(GIFBYTE *);
-#endif /* GIF_H_ */
+#endif /* GIF_H_ */
diff --git a/hl/tools/gif2h5/gif2hdf.c b/hl/tools/gif2h5/gif2hdf.c
index 051ff56..939844c 100644
--- a/hl/tools/gif2h5/gif2hdf.c
+++ b/hl/tools/gif2h5/gif2hdf.c
@@ -18,11 +18,10 @@
#include "h5tools.h"
#include "h5tools_utils.h"
-
int
-main(int argv , char *argc[])
+main(int argv, char *argc[])
{
- GIFTOMEM GifMemoryStruct;
+ GIFTOMEM GifMemoryStruct;
GIFIMAGEDESC gifImageDesc;
FILE *fpGif;
@@ -51,11 +50,9 @@ main(int argv , char *argc[])
/* Initialize h5tools lib */
h5tools_init();
- if ( argc[1] && (strcmp("-V",argc[1])==0) )
- {
+ if (argc[1] && (strcmp("-V", argc[1]) == 0)) {
print_version("gif2h5");
exit(EXIT_SUCCESS);
-
}
if (argv < 3) {
@@ -68,15 +65,15 @@ main(int argv , char *argc[])
GIFFileName = argc[1];
HDFFileName = argc[2];
- if (!(fpGif = fopen(GIFFileName,"rb"))) {
+ if (!(fpGif = fopen(GIFFileName, "rb"))) {
printf("Unable to open GIF file for reading.\n");
exit(EXIT_FAILURE);
}
/* Get the whole file into memory. Mem's much faster than I/O */
- fseek(fpGif, 0L , 2);
+ fseek(fpGif, 0L, 2);
filesize = ftell(fpGif);
- fseek(fpGif, 0L , 0);
+ fseek(fpGif, 0L, 0);
if (filesize == 0)
printf("File Size Zero");
@@ -86,12 +83,12 @@ main(int argv , char *argc[])
exit(EXIT_FAILURE);
}
- if (fread(MemGif,(size_t)filesize,1,fpGif) != 1) {
+ if (fread(MemGif, (size_t)filesize, 1, fpGif) != 1) {
printf("Corrupted Input File");
exit(EXIT_FAILURE);
}
- fseek(fpGif,0L,0);
+ fseek(fpGif, 0L, 0);
/*
* Call Gif2Mem and break the whole file into parts. Gif2Mem also calls
@@ -100,8 +97,8 @@ main(int argv , char *argc[])
Gif2Mem(MemGif, &GifMemoryStruct);
if (ferror(fpGif)) {
- printf("File Stream Error\n\n");
- exit(EXIT_FAILURE);
+ printf("File Stream Error\n\n");
+ exit(EXIT_FAILURE);
}
fclose(fpGif);
@@ -110,54 +107,47 @@ main(int argv , char *argc[])
* Call WriteHDF from here. Go ahead and change WriteHDF to write whatever
* format you want
*/
- if (WriteHDF(GifMemoryStruct , HDFFileName))
+ if (WriteHDF(GifMemoryStruct, HDFFileName))
printf("HDF Write Error\n\n");
/* Free all buffers */
/* replacing int32 with long */
ImageCount = (long)((GifMemoryStruct.GifHeader)->ImageCount);
- for(i = 0; i < ImageCount ; i++) {
+ for (i = 0; i < ImageCount; i++) {
gifImageDesc = *(GifMemoryStruct.GifImageDesc[i]);
if (gifImageDesc.Image != NULL)
free(gifImageDesc.Image);
- if (GifMemoryStruct.GifImageDesc[i] != NULL)
- {
+ if (GifMemoryStruct.GifImageDesc[i] != NULL) {
free(GifMemoryStruct.GifImageDesc[i]);
GifMemoryStruct.GifImageDesc[i] = NULL;
}
- if (GifMemoryStruct.GifGraphicControlExtension[i] != NULL)
- {
+ if (GifMemoryStruct.GifGraphicControlExtension[i] != NULL) {
free(GifMemoryStruct.GifGraphicControlExtension[i]);
GifMemoryStruct.GifGraphicControlExtension[i] = NULL;
}
}
free(StartPos);
- if (GifMemoryStruct.GifHeader != NULL)
- {
+ if (GifMemoryStruct.GifHeader != NULL) {
free(GifMemoryStruct.GifHeader);
GifMemoryStruct.GifHeader = NULL;
}
- if (GifMemoryStruct.GifApplicationExtension != NULL)
- {
+ if (GifMemoryStruct.GifApplicationExtension != NULL) {
free(GifMemoryStruct.GifApplicationExtension);
GifMemoryStruct.GifApplicationExtension = NULL;
}
- if (GifMemoryStruct.GifImageDesc != NULL)
- {
+ if (GifMemoryStruct.GifImageDesc != NULL) {
free(GifMemoryStruct.GifImageDesc);
GifMemoryStruct.GifImageDesc = NULL;
}
- if (GifMemoryStruct.GifGraphicControlExtension != NULL)
- {
+ if (GifMemoryStruct.GifGraphicControlExtension != NULL) {
free(GifMemoryStruct.GifGraphicControlExtension);
GifMemoryStruct.GifGraphicControlExtension = NULL;
}
-
return EXIT_SUCCESS;
}
diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c
index ae0a113..b1ea718 100644
--- a/hl/tools/gif2h5/gif2mem.c
+++ b/hl/tools/gif2h5/gif2mem.c
@@ -42,29 +42,29 @@ Gif2Mem(GIFBYTE *MemGif, GIFTOMEM *GifMemoryStruct)
* The gif structure outline for passing data to memory is given in gif.h.
* These pointers are redunant, should take them out in ver. 2
*/
- GIFHEAD *gifHead; /* GIF Header structure */
- GIFIMAGEDESC **gifImageDesc; /* Logical Image Descriptor struct */
- GIFPLAINTEXT **gifPlainText; /* Plain Text Extension structure */
- GIFAPPLICATION **gifApplication; /* Application Extension structure */
- GIFCOMMENT **gifComment; /* Comment Extension structure */
+ GIFHEAD * gifHead; /* GIF Header structure */
+ GIFIMAGEDESC ** gifImageDesc; /* Logical Image Descriptor struct */
+ GIFPLAINTEXT ** gifPlainText; /* Plain Text Extension structure */
+ GIFAPPLICATION ** gifApplication; /* Application Extension structure */
+ GIFCOMMENT ** gifComment; /* Comment Extension structure */
GIFGRAPHICCONTROL **gifGraphicControl; /* Graphic Control Extension strct */
- register GIFWORD i; /* Loop counter */
- GIFBYTE Identifier; /* Extension block identifier holder */
- GIFBYTE Label; /* Extension block label holder */
- GIFBYTE ImageCount; /* Count of the number of images in the file */
- GIFBYTE ImageArray; /* Keep the size of the array to store Images */
- GIFBYTE CommentCount;
- GIFBYTE CommentArray;
- GIFBYTE ApplicationCount;
- GIFBYTE ApplicationArray;
- GIFBYTE PlainTextCount;
- GIFBYTE PlainTextArray;
- GIFBYTE GCEflag;
- GIFBYTE aTemp;
- GIFBYTE j;
- GIFBYTE w; /* Two more variables needed only while testing */
- GIFBYTE *b; /* Endian Ordering */
+ register GIFWORD i; /* Loop counter */
+ GIFBYTE Identifier; /* Extension block identifier holder */
+ GIFBYTE Label; /* Extension block label holder */
+ GIFBYTE ImageCount; /* Count of the number of images in the file */
+ GIFBYTE ImageArray; /* Keep the size of the array to store Images */
+ GIFBYTE CommentCount;
+ GIFBYTE CommentArray;
+ GIFBYTE ApplicationCount;
+ GIFBYTE ApplicationArray;
+ GIFBYTE PlainTextCount;
+ GIFBYTE PlainTextArray;
+ GIFBYTE GCEflag;
+ GIFBYTE aTemp;
+ GIFBYTE j;
+ GIFBYTE w; /* Two more variables needed only while testing */
+ GIFBYTE * b; /* Endian Ordering */
/* Allocate memory for the GIF structures */
/* Plug the structs into GifMemoryStruct at the end */
@@ -89,8 +89,8 @@ Gif2Mem(GIFBYTE *MemGif, GIFTOMEM *GifMemoryStruct)
/******************************/
/* Carry out Endian Testing and set Endian Order */
- w = 0x0001;
- b = (GIFBYTE *) &w;
+ w = 0x0001;
+ b = (GIFBYTE *)&w;
EndianOrder = (b[0] ? 1 : 0);
/* Read the GIF image file header information */
@@ -103,22 +103,22 @@ Gif2Mem(GIFBYTE *MemGif, GIFTOMEM *GifMemoryStruct)
fputs("GIFHEAD: Error reading header information!\n", stderr);
exit(EXIT_FAILURE);
}
-#endif /* 0 */
+#endif /* 0 */
/*
* Identify, read, and display block information.
*/
- ImageCount = ImageArray = 0;
- CommentCount = CommentArray = 0;
+ ImageCount = ImageArray = 0;
+ CommentCount = CommentArray = 0;
ApplicationCount = ApplicationArray = 0;
- PlainTextCount = PlainTextArray = 0;
- GCEflag = 0;
+ PlainTextCount = PlainTextArray = 0;
+ GCEflag = 0;
for (;;) {
Identifier = *MemGif++;
switch (Identifier) {
- case 0x3B: /* Trailer */
+ case 0x3B: /* Trailer */
/*
* The counts are stored to make it easier while putting stuff
* into the HDF file and then deallocating space.
@@ -129,17 +129,17 @@ Gif2Mem(GIFBYTE *MemGif, GIFTOMEM *GifMemoryStruct)
gifHead->PlainTextCount = PlainTextCount;
/* putting stuff into the gif2mem structure */
- GifMemoryStruct->GifHeader = gifHead;
- GifMemoryStruct->GifImageDesc = gifImageDesc;
- GifMemoryStruct->GifPlainTextExtension = gifPlainText;
- GifMemoryStruct->GifApplicationExtension = gifApplication;
- GifMemoryStruct->GifCommentExtension = gifComment;
+ GifMemoryStruct->GifHeader = gifHead;
+ GifMemoryStruct->GifImageDesc = gifImageDesc;
+ GifMemoryStruct->GifPlainTextExtension = gifPlainText;
+ GifMemoryStruct->GifApplicationExtension = gifApplication;
+ GifMemoryStruct->GifCommentExtension = gifComment;
GifMemoryStruct->GifGraphicControlExtension = gifGraphicControl;
/* return the struct */
return 0;
- case 0x2C: /* Image Descriptor */
+ case 0x2C: /* Image Descriptor */
/*
* If there was no image descriptor before this increase image
* count. If an imagedescriptor was present, reset GCEflag
@@ -150,40 +150,37 @@ Gif2Mem(GIFBYTE *MemGif, GIFTOMEM *GifMemoryStruct)
GCEflag = 0;
if (ImageCount > ImageArray) {
- aTemp = ImageArray;
+ aTemp = ImageArray;
ImageArray = (GIFBYTE)((ImageArray << 1) + 1);
- if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(gifImageDesc,
- sizeof(GIFIMAGEDESC *) * ImageArray))) {
+ if (!(gifImageDesc =
+ (GIFIMAGEDESC **)realloc(gifImageDesc, sizeof(GIFIMAGEDESC *) * ImageArray))) {
printf("Out of memory!");
exit(EXIT_FAILURE);
}
if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc(
- gifGraphicControl,
- sizeof(GIFGRAPHICCONTROL *) * ImageArray))) {
+ gifGraphicControl, sizeof(GIFGRAPHICCONTROL *) * ImageArray))) {
printf("Out of memory!");
exit(EXIT_FAILURE);
}
- for (j = aTemp ; j < ImageArray ; j++) {
+ for (j = aTemp; j < ImageArray; j++) {
gifGraphicControl[j] = NULL;
- gifImageDesc[j] = NULL;
+ gifImageDesc[j] = NULL;
}
}
- if(!(gifImageDesc[ImageCount-1] = (GIFIMAGEDESC*)malloc(sizeof(GIFIMAGEDESC)))) {
+ if (!(gifImageDesc[ImageCount - 1] = (GIFIMAGEDESC *)malloc(sizeof(GIFIMAGEDESC)))) {
printf("Out of memory!");
exit(EXIT_FAILURE);
}
-
- if (ReadGifImageDesc(gifImageDesc[ImageCount-1], &MemGif) == -1)
+ if (ReadGifImageDesc(gifImageDesc[ImageCount - 1], &MemGif) == -1)
fputs("Error reading Image Descriptor information\n", stderr);
/* Decompress the Image */
- gifImageDesc[ImageCount-1]->Image = Decompress(gifImageDesc[ImageCount-1],
- gifHead);
- free(gifImageDesc[ImageCount-1]->GIFImage);
+ gifImageDesc[ImageCount - 1]->Image = Decompress(gifImageDesc[ImageCount - 1], gifHead);
+ free(gifImageDesc[ImageCount - 1]->GIFImage);
/*
* Convert the local palette into an HDF compatible palette In
@@ -191,150 +188,146 @@ Gif2Mem(GIFBYTE *MemGif, GIFTOMEM *GifMemoryStruct)
* the HDFPalette If it is absent the global table is written
* as the HDFPalette.
*/
- if (!((gifImageDesc[ImageCount-1]->PackedField) & 0x80)) {
+ if (!((gifImageDesc[ImageCount - 1]->PackedField) & 0x80)) {
/* Check to see if the global color table exists.... */
if (gifHead->PackedField & 0x80) {
- for (i=0 ; i<gifHead->TableSize ; i++) {
- gifImageDesc[ImageCount-1]->HDFPalette[i][0] =
- gifHead->HDFPalette[i][0];
- gifImageDesc[ImageCount-1]->HDFPalette[i][1] =
- gifHead->HDFPalette[i][1];
- gifImageDesc[ImageCount-1]->HDFPalette[i][2] =
- gifHead->HDFPalette[i][2];
+ for (i = 0; i < gifHead->TableSize; i++) {
+ gifImageDesc[ImageCount - 1]->HDFPalette[i][0] = gifHead->HDFPalette[i][0];
+ gifImageDesc[ImageCount - 1]->HDFPalette[i][1] = gifHead->HDFPalette[i][1];
+ gifImageDesc[ImageCount - 1]->HDFPalette[i][2] = gifHead->HDFPalette[i][2];
}
}
- gifImageDesc[ImageCount-1]->TableSize = gifHead->TableSize;
+ gifImageDesc[ImageCount - 1]->TableSize = gifHead->TableSize;
}
break;
- case 0x21: /* Extension Block */
- Label = *MemGif++;
+ case 0x21: /* Extension Block */
+ Label = *MemGif++;
- switch (Label) {
- case 0x01: /* Plain Text Extension */
+ switch (Label) {
+ case 0x01: /* Plain Text Extension */
puts("Plain Text Extension\n");
PlainTextCount++;
if (PlainTextCount > PlainTextArray)
PlainTextArray = (GIFBYTE)((PlainTextArray << 1) + 1);
- if (!(gifPlainText = (GIFPLAINTEXT **)realloc(gifPlainText , sizeof(GIFPLAINTEXT *) * PlainTextArray))) {
+ if (!(gifPlainText = (GIFPLAINTEXT **)realloc(gifPlainText, sizeof(GIFPLAINTEXT *) *
+ PlainTextArray))) {
printf("Out of memory!");
exit(EXIT_FAILURE);
}
- if(!(gifPlainText[PlainTextCount - 1] = (GIFPLAINTEXT*)malloc(sizeof(GIFPLAINTEXT)))) {
+ if (!(gifPlainText[PlainTextCount - 1] =
+ (GIFPLAINTEXT *)malloc(sizeof(GIFPLAINTEXT)))) {
printf("Out of memory!");
exit(EXIT_FAILURE);
}
if (ReadGifPlainText(gifPlainText[PlainTextCount - 1], &MemGif))
- fprintf(stderr,
- "Error reading Plain Text Extension information.\n");
+ fprintf(stderr, "Error reading Plain Text Extension information.\n");
break;
- case 0xFE: /* Comment Extension */
+ case 0xFE: /* Comment Extension */
CommentCount++;
if (CommentCount > CommentArray)
CommentArray = (GIFBYTE)((CommentArray << 1) + 1);
- if (!(gifComment = (GIFCOMMENT **)realloc(gifComment , sizeof(GIFCOMMENT *) * CommentArray))) {
+ if (!(gifComment =
+ (GIFCOMMENT **)realloc(gifComment, sizeof(GIFCOMMENT *) * CommentArray))) {
printf("Out of memory!");
exit(EXIT_FAILURE);
}
- if(!(gifComment[CommentCount - 1] = (GIFCOMMENT *)malloc(sizeof(GIFCOMMENT)))) {
+ if (!(gifComment[CommentCount - 1] = (GIFCOMMENT *)malloc(sizeof(GIFCOMMENT)))) {
printf("Out of memory!");
exit(EXIT_FAILURE);
}
-
if (ReadGifComment(gifComment[CommentCount - 1], &MemGif))
- fprintf(stderr,
- "Error reading Comment Extension information\n");
+ fprintf(stderr, "Error reading Comment Extension information\n");
break;
- case 0xF9: /* Graphic Control Extension */
- if (GCEflag == 0 )
+ case 0xF9: /* Graphic Control Extension */
+ if (GCEflag == 0)
ImageCount++;
GCEflag = 1;
if (ImageCount > ImageArray) {
- aTemp = ImageArray;
+ aTemp = ImageArray;
ImageArray = (GIFBYTE)((ImageArray << 1) + 1);
- if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc(gifGraphicControl , sizeof(GIFGRAPHICCONTROL *) * ImageArray))) {
+ if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc(
+ gifGraphicControl, sizeof(GIFGRAPHICCONTROL *) * ImageArray))) {
printf("Out of memory!");
exit(EXIT_FAILURE);
}
- if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(gifImageDesc , sizeof(GIFIMAGEDESC *) * ImageArray))) {
+ if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(
+ gifImageDesc, sizeof(GIFIMAGEDESC *) * ImageArray))) {
printf("Out of memory!");
exit(EXIT_FAILURE);
}
- for (j = aTemp ; j < ImageArray ; j++) {
+ for (j = aTemp; j < ImageArray; j++) {
gifGraphicControl[j] = NULL;
gifImageDesc[j] = NULL;
}
}
- if(!(gifGraphicControl[ImageCount-1] = (GIFGRAPHICCONTROL*)malloc(sizeof(GIFGRAPHICCONTROL)))) {
+ if (!(gifGraphicControl[ImageCount - 1] =
+ (GIFGRAPHICCONTROL *)malloc(sizeof(GIFGRAPHICCONTROL)))) {
printf("Out of memory!");
exit(EXIT_FAILURE);
}
-
- if (ReadGifGraphicControl(gifGraphicControl[ImageCount-1], &MemGif))
- fprintf(stderr,
- "Error reading Graphic Control Extension information\n");
+ if (ReadGifGraphicControl(gifGraphicControl[ImageCount - 1], &MemGif))
+ fprintf(stderr, "Error reading Graphic Control Extension information\n");
(*MemGif)++;
if ((!*MemGif) == 0)
- fprintf(stderr,
- "Error reading Graphic Control Extension\n");
+ fprintf(stderr, "Error reading Graphic Control Extension\n");
break;
- case 0xFF: /* Application Extension */
+ case 0xFF: /* Application Extension */
ApplicationCount++;
if (ApplicationCount > ApplicationArray)
ApplicationArray = (GIFBYTE)((ApplicationArray << 1) + 1);
- if (!(gifApplication = (GIFAPPLICATION **)realloc(gifApplication , sizeof(GIFAPPLICATION *) * ApplicationArray))) {
+ if (!(gifApplication = (GIFAPPLICATION **)realloc(
+ gifApplication, sizeof(GIFAPPLICATION *) * ApplicationArray))) {
printf("Out of memory!");
exit(EXIT_FAILURE);
}
- if(!(gifApplication[ApplicationCount - 1] = (GIFAPPLICATION *)malloc(sizeof(GIFAPPLICATION)))) {
+ if (!(gifApplication[ApplicationCount - 1] =
+ (GIFAPPLICATION *)malloc(sizeof(GIFAPPLICATION)))) {
printf("Out of memory!");
exit(EXIT_FAILURE);
}
-
if (ReadGifApplication(gifApplication[ApplicationCount - 1], &MemGif))
- fprintf(stderr,
- "Error reading Application Extension information\n");
+ fprintf(stderr, "Error reading Application Extension information\n");
break;
default:
printf("Unknown Extension Label: %#02x\n", Label);
break;
- }
+ }
- break;
+ break;
default:
- fprintf(stderr,
- "Unknown Block Separator Character: %#02x\n", Identifier);
+ fprintf(stderr, "Unknown Block Separator Character: %#02x\n", Identifier);
}
}
}
diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c
index 79671aa..705e6f3 100644
--- a/hl/tools/gif2h5/gifread.c
+++ b/hl/tools/gif2h5/gifread.c
@@ -26,21 +26,19 @@ GetWord(GIFBYTE *MemGif)
if (EndianOrder == 1) {
/* LittleEndian */
- w = (GIFWORD) (*MemGif++ & 0xFF);
- w |= (GIFWORD) ((*MemGif++ & 0xFF) << 0x08);
- } else {
- w = (GIFWORD) (*MemGif++ & 0xFF);
- w = ((GIFWORD) (*MemGif++ & 0xFF)) | (w << 0x08);
+ w = (GIFWORD)(*MemGif++ & 0xFF);
+ w |= (GIFWORD)((*MemGif++ & 0xFF) << 0x08);
+ }
+ else {
+ w = (GIFWORD)(*MemGif++ & 0xFF);
+ w = ((GIFWORD)(*MemGif++ & 0xFF)) | (w << 0x08);
}
return w;
}
GIFBYTE
-GetByte(GIFBYTE *MemGif)
-{
- return *MemGif;
-}
+GetByte(GIFBYTE *MemGif) { return *MemGif; }
/*
* Read a GIF image GIFBYTE Header.
@@ -53,23 +51,23 @@ GetByte(GIFBYTE *MemGif)
* otherwise 0 if no error occured.
*/
int
-ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */
- GIFBYTE **MemGif2) /* GIF image file input FILE stream */
+ReadGifHeader(GIFHEAD * GifHead, /* Pointer to GIF header structure */
+ GIFBYTE **MemGif2) /* GIF image file input FILE stream */
{
- GIFWORD i; /* Loop counter */
- GIFWORD tableSize; /* Number of entires in the Global Color Table */
+ GIFWORD i; /* Loop counter */
+ GIFWORD tableSize; /* Number of entires in the Global Color Table */
GifHead->TableSize = 0;
- for (i = 0 ; i < 6 ; i++) {
+ for (i = 0; i < 6; i++) {
GifHead->HeaderDump[i] = *(*MemGif2)++;
}
- if (strncmp((const char *)GifHead->HeaderDump , "GIF" , (size_t)3)) {
+ if (strncmp((const char *)GifHead->HeaderDump, "GIF", (size_t)3)) {
printf("The file does not appear to be a valid GIF file.\n");
exit(EXIT_FAILURE);
}
- for (i = 0 ; i < 7 ; i++) {
+ for (i = 0; i < 7; i++) {
GifHead->LSDDump[i] = *(*MemGif2)++;
}
@@ -78,7 +76,7 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */
/* Check if a Global Color Table is present */
if (GifHead->PackedField & 0x80) {
/* Read number of color table entries */
- tableSize = (GIFWORD) (1L << ((GifHead->PackedField & 0x07) + 1));
+ tableSize = (GIFWORD)(1L << ((GifHead->PackedField & 0x07) + 1));
GifHead->TableSize = tableSize;
/* Read the Global Color Table */
@@ -100,12 +98,11 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */
#if 0
if (ferror(FpGif))
return -1;
-#endif /* 0 */
+#endif /* 0 */
- return 0; /* No FILE stream error occured */
+ return 0; /* No FILE stream error occured */
}
-
/*
** Read a GIF Local Image Descriptor.
**
@@ -120,93 +117,85 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */
** otherwise 0 if no error occured.
*/
int
-ReadGifImageDesc(
- GIFIMAGEDESC *GifImageDesc, /* Pointer to GIF image descriptor structure */
- GIFBYTE **MemGif2 /* GIF image file input FILE stream */
- )
+ReadGifImageDesc(GIFIMAGEDESC *GifImageDesc, /* Pointer to GIF image descriptor structure */
+ GIFBYTE ** MemGif2 /* GIF image file input FILE stream */
+)
{
- GIFWORD i; /* Loop counter */
- GIFWORD tableSize; /* Number of entries in the Local Color Table */
- /* GIFBYTE Interlace; */ /* PackedField & 0x20 gives information on interlacing */
- GIFBYTE *TempPtr;
- int ch , ch1;
-
- GifImageDesc->TableSize = 0;
- for (i = 0 ; i < 9 ; i++) {
- GifImageDesc->GIDDump[i] = *(*MemGif2)++;
- }
-
- /*
- ** Get the relevant fields. I need ImageWidth and Height actively hence I have
- ** taken information from those fields. I intend to keep the GifImageDesc data
- ** structure as it is so that anyone needing the rest of the fields can do so
- ** quickly.
- */
-
- if (EndianOrder == 1) /* LittleEndian */
- {
- GifImageDesc->ImageWidth = (GIFWORD) (GifImageDesc->GIDDump[4] & 0xFF);
- GifImageDesc->ImageWidth |= (GIFWORD) ((GifImageDesc->GIDDump[5] & 0xFF) << 0x08);
-
- GifImageDesc->ImageHeight = (GIFWORD) (GifImageDesc->GIDDump[6] & 0xFF);
- GifImageDesc->ImageHeight |= (GIFWORD) ((GifImageDesc->GIDDump[7] & 0xFF) << 0x08);
-
- }
- else
- {
- GifImageDesc->ImageWidth = (GIFWORD) (GifImageDesc->GIDDump[4] & 0xFF);
- GifImageDesc->ImageWidth = ((GIFWORD) (GifImageDesc->GIDDump[5] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08);
+ GIFWORD i; /* Loop counter */
+ GIFWORD tableSize; /* Number of entries in the Local Color Table */
+ /* GIFBYTE Interlace; */ /* PackedField & 0x20 gives information on interlacing */
+ GIFBYTE *TempPtr;
+ int ch, ch1;
+
+ GifImageDesc->TableSize = 0;
+ for (i = 0; i < 9; i++) {
+ GifImageDesc->GIDDump[i] = *(*MemGif2)++;
+ }
- GifImageDesc->ImageHeight = (GIFWORD) (GifImageDesc->GIDDump[6] & 0xFF);
- GifImageDesc->ImageHeight = ((GIFWORD) (GifImageDesc->GIDDump[7] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08);
+ /*
+ ** Get the relevant fields. I need ImageWidth and Height actively hence I have
+ ** taken information from those fields. I intend to keep the GifImageDesc data
+ ** structure as it is so that anyone needing the rest of the fields can do so
+ ** quickly.
+ */
+ if (EndianOrder == 1) /* LittleEndian */
+ {
+ GifImageDesc->ImageWidth = (GIFWORD)(GifImageDesc->GIDDump[4] & 0xFF);
+ GifImageDesc->ImageWidth |= (GIFWORD)((GifImageDesc->GIDDump[5] & 0xFF) << 0x08);
- }
+ GifImageDesc->ImageHeight = (GIFWORD)(GifImageDesc->GIDDump[6] & 0xFF);
+ GifImageDesc->ImageHeight |= (GIFWORD)((GifImageDesc->GIDDump[7] & 0xFF) << 0x08);
+ }
+ else {
+ GifImageDesc->ImageWidth = (GIFWORD)(GifImageDesc->GIDDump[4] & 0xFF);
+ GifImageDesc->ImageWidth =
+ ((GIFWORD)(GifImageDesc->GIDDump[5] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08);
+
+ GifImageDesc->ImageHeight = (GIFWORD)(GifImageDesc->GIDDump[6] & 0xFF);
+ GifImageDesc->ImageHeight =
+ ((GIFWORD)(GifImageDesc->GIDDump[7] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08);
+ }
- GifImageDesc->PackedField = GifImageDesc->GIDDump[8];
+ GifImageDesc->PackedField = GifImageDesc->GIDDump[8];
- /* Interlace = GifImageDesc->PackedField & 0x20; */
+ /* Interlace = GifImageDesc->PackedField & 0x20; */
/* Check if a Local Color Table is present */
- if (GifImageDesc->PackedField & 0x80)
- {
+ if (GifImageDesc->PackedField & 0x80) {
/* Read number of color table entries */
- tableSize = (GIFWORD) (1L << ((GifImageDesc->PackedField & 0x07) + 1));
- GifImageDesc->TableSize = tableSize;
+ tableSize = (GIFWORD)(1L << ((GifImageDesc->PackedField & 0x07) + 1));
+ GifImageDesc->TableSize = tableSize;
/* Read the Local Color Table */
- for (i = 0; i < tableSize; i++)
- {
+ for (i = 0; i < tableSize; i++) {
GifImageDesc->HDFPalette[i][0] = *(*MemGif2)++;
GifImageDesc->HDFPalette[i][1] = *(*MemGif2)++;
GifImageDesc->HDFPalette[i][2] = *(*MemGif2)++;
}
}
- /*
- ** Get LZW minimum Code Size
- */
- GifImageDesc->CodeSize = (GIFWORD)*(*MemGif2)++;
-
- /*GifImageDesc->GIFImage = ReadDataSubBlocks(FpGif);*/
- if (!(GifImageDesc->GIFImage = (GIFBYTE *)malloc((GifImageDesc->ImageWidth) * (GifImageDesc->ImageHeight)))) {
- printf("Out of memory");
- exit(EXIT_FAILURE);
- }
-
-
- TempPtr = GifImageDesc->GIFImage;
- do
- {
- ch = ch1 = (int)*(*MemGif2)++;
- while (ch--) *TempPtr++ = *(*MemGif2)++;
- }
- while (ch1);
+ /*
+ ** Get LZW minimum Code Size
+ */
+ GifImageDesc->CodeSize = (GIFWORD) * (*MemGif2)++;
+
+ /*GifImageDesc->GIFImage = ReadDataSubBlocks(FpGif);*/
+ if (!(GifImageDesc->GIFImage =
+ (GIFBYTE *)malloc((GifImageDesc->ImageWidth) * (GifImageDesc->ImageHeight)))) {
+ printf("Out of memory");
+ exit(EXIT_FAILURE);
+ }
+ TempPtr = GifImageDesc->GIFImage;
+ do {
+ ch = ch1 = (int)*(*MemGif2)++;
+ while (ch--)
+ *TempPtr++ = *(*MemGif2)++;
+ } while (ch1);
- return(0); /* No FILE stream error occured */
+ return (0); /* No FILE stream error occured */
}
-
/*
** Read a GIF Graphic Control Extension block.
**
@@ -217,21 +206,19 @@ ReadGifImageDesc(
** otherwise 0 if no error occured.
*/
int
-ReadGifGraphicControl(
- GIFGRAPHICCONTROL *GifGraphicControl, /* Pointer to GC Extension structure */
- GIFBYTE **MemGif2 /* GIF image file input FILE stream */
- )
+ReadGifGraphicControl(GIFGRAPHICCONTROL *GifGraphicControl, /* Pointer to GC Extension structure */
+ GIFBYTE ** MemGif2 /* GIF image file input FILE stream */
+)
{
int i;
- for (i = 0 ; i < 5 ; i++) {
- GifGraphicControl->GCEDump[i] = *(*MemGif2)++;
+ for (i = 0; i < 5; i++) {
+ GifGraphicControl->GCEDump[i] = *(*MemGif2)++;
}
- return(0); /* No FILE stream error occured */
+ return (0); /* No FILE stream error occured */
}
-
/*
** Read a GIF Plain Text Extension block.
**
@@ -242,35 +229,33 @@ ReadGifGraphicControl(
** otherwise 0 if no error occured.
*/
int
-ReadGifPlainText(
- GIFPLAINTEXT *GifPlainText, /* Pointer to Plain Text Extension structure */
- GIFBYTE **MemGif2 /* GIF image file input FILE stream */
- )
+ReadGifPlainText(GIFPLAINTEXT *GifPlainText, /* Pointer to Plain Text Extension structure */
+ GIFBYTE ** MemGif2 /* GIF image file input FILE stream */
+)
{
int i;
- for (i = 0 ; i < 13 ; i++) {
- GifPlainText->PTEDump[i] = *(*MemGif2)++;
- }
+ for (i = 0; i < 13; i++) {
+ GifPlainText->PTEDump[i] = *(*MemGif2)++;
+ }
/* Read in the Plain Text data sub-blocks */
- if (!(GifPlainText->PlainTextData = ReadDataSubBlocks(MemGif2 , &(GifPlainText->DataSize))))
- return(1);
+ if (!(GifPlainText->PlainTextData = ReadDataSubBlocks(MemGif2, &(GifPlainText->DataSize))))
+ return (1);
/*
GifPlainText->Terminator = 0;
*/
/* Check for a FILE stream error */
- /*
- if (ferror(FpGif))
- return(-1);
- */
+ /*
+ if (ferror(FpGif))
+ return(-1);
+ */
- return(0); /* No FILE stream error occured */
+ return (0); /* No FILE stream error occured */
}
-
/*
** Read a GIF Application Extension block.
**
@@ -281,34 +266,32 @@ ReadGifPlainText(
** otherwise 0 if no error occured.
*/
int
-ReadGifApplication(
- GIFAPPLICATION *GifApplication, /* Pointer to Application Extension structure */
- GIFBYTE **MemGif2 /* GIF image file input FILE stream */
- )
+ReadGifApplication(GIFAPPLICATION *GifApplication, /* Pointer to Application Extension structure */
+ GIFBYTE ** MemGif2 /* GIF image file input FILE stream */
+)
{
int i;
- for (i = 0 ; i < 12 ; i++) {
- GifApplication->AEDump[i] = *(*MemGif2)++;
- }
+ for (i = 0; i < 12; i++) {
+ GifApplication->AEDump[i] = *(*MemGif2)++;
+ }
/* Read in the Plain Text data sub-blocks */
- if (!(GifApplication->ApplicationData = ReadDataSubBlocks(MemGif2 , &(GifApplication->DataSize))))
- return(1);
- /*
- GifApplication->Terminator = 0;
- */
+ if (!(GifApplication->ApplicationData = ReadDataSubBlocks(MemGif2, &(GifApplication->DataSize))))
+ return (1);
+ /*
+ GifApplication->Terminator = 0;
+ */
- /* Check for a FILE stream error */
- /*
- if (ferror(FpGif))
- return(-1);
- */
+ /* Check for a FILE stream error */
+ /*
+ if (ferror(FpGif))
+ return(-1);
+ */
- return(0); /* No FILE stream error occured */
+ return (0); /* No FILE stream error occured */
}
-
/*
** Read a GIF Comment Extension block.
**
@@ -319,22 +302,20 @@ ReadGifApplication(
** otherwise 0 if no error occured.
*/
int
-ReadGifComment(
- GIFCOMMENT *GifComment, /* Pointer to GIF Comment Extension structure */
- GIFBYTE **MemGif2 /* GIF image file input FILE stream */
- )
+ReadGifComment(GIFCOMMENT *GifComment, /* Pointer to GIF Comment Extension structure */
+ GIFBYTE ** MemGif2 /* GIF image file input FILE stream */
+)
{
/* Read in the Plain Text data sub-blocks */
- if (!(GifComment->CommentData = ReadDataSubBlocks(MemGif2 , &(GifComment->DataSize))))
- return(1);
+ if (!(GifComment->CommentData = ReadDataSubBlocks(MemGif2, &(GifComment->DataSize))))
+ return (1);
GifComment->Terminator = 0;
- return(0); /* No FILE stream error occured */
+ return (0); /* No FILE stream error occured */
}
-
/*
** Read one or more GIF data sub-blocks and write the information
** to a buffer.
@@ -347,55 +328,47 @@ ReadGifComment(
*/
static GIFBYTE *
ReadDataSubBlocks(GIFBYTE **MemGif2, /* GIF image file input FILE stream */
- GIFWORD *DSize)
+ GIFWORD * DSize)
{
GIFBYTE *ptr1; /* Pointer used to "walk the heap" */
GIFBYTE *ptr2; /* Pointer used to mark the top of the heap */
- GIFBYTE dataSize; /* Size of the current data sub-block being read */
- GIFWORD bufSize; /* Total size of the Plain Text data buffer */
- int tempcount = 0;
+ GIFBYTE dataSize; /* Size of the current data sub-block being read */
+ GIFWORD bufSize; /* Total size of the Plain Text data buffer */
+ int tempcount = 0;
- bufSize = 0; /* The output buffer is empty */
+ bufSize = 0; /* The output buffer is empty */
- dataSize = *(*MemGif2)++; /* Get the size of the first sub-block */
+ dataSize = *(*MemGif2)++; /* Get the size of the first sub-block */
/* Allocate initial data buffer */
- if (!(ptr1 = ptr2 = (GIFBYTE *) malloc((size_t)dataSize + 1))) {
- printf("Out of memory. Allocation of memory for data sub-blocks for\neither Comment, Plain Text or Application Extensions failed");
- return((GIFBYTE *) NULL);
- }
- for (;;)
- {
- tempcount++;
- bufSize += (dataSize); /* Running total of the buffer size */
- *DSize = bufSize;
+ if (!(ptr1 = ptr2 = (GIFBYTE *)malloc((size_t)dataSize + 1))) {
+ printf("Out of memory. Allocation of memory for data sub-blocks for\neither Comment, Plain Text or "
+ "Application Extensions failed");
+ return ((GIFBYTE *)NULL);
+ }
+ for (;;) {
+ tempcount++;
+ bufSize += (dataSize); /* Running total of the buffer size */
+ *DSize = bufSize;
#ifdef COMMENTED_OUT
- *ptr1++ = dataSize; /* Write the data count */
-#endif /* COMMENTED_OUT */
- while (dataSize--) /* Read/write the Plain Text data */
- *ptr1++ = *(*MemGif2)++;
+ *ptr1++ = dataSize; /* Write the data count */
+#endif /* COMMENTED_OUT */
+ while (dataSize--) /* Read/write the Plain Text data */
+ *ptr1++ = *(*MemGif2)++;
/* Check if there is another data sub-block */
if ((dataSize = *(*MemGif2)++) == 0)
- break; /* Block Terminator encountered */
+ break; /* Block Terminator encountered */
/* Increase the buffer size to accomodate the next sub-block */
- if (!(ptr1 = ptr2 = (GIFBYTE *) realloc(ptr2, bufSize + dataSize + 1)))
- return((GIFBYTE *) NULL);
-
-
- ptr1 += bufSize; /* Move pointer to the end of the data */
-
+ if (!(ptr1 = ptr2 = (GIFBYTE *)realloc(ptr2, bufSize + dataSize + 1)))
+ return ((GIFBYTE *)NULL);
+ ptr1 += bufSize; /* Move pointer to the end of the data */
}
*ptr1++ = '\0';
- return(ptr2); /* Return a pointer to the sub-block data */
+ return (ptr2); /* Return a pointer to the sub-block data */
}
-
-
-
-
-
diff --git a/hl/tools/gif2h5/h52gifgentst.c b/hl/tools/gif2h5/h52gifgentst.c
index c0ad151..020fe26 100644
--- a/hl/tools/gif2h5/h52gifgentst.c
+++ b/hl/tools/gif2h5/h52gifgentst.c
@@ -30,11 +30,11 @@
*/
#define FILENAME "h52giftst.h5"
-#define WIDTH 400
-#define HEIGHT 200
-#define PAL_ENTRIES 256
-#define IMAGE1_NAME "image"
-#define PAL_NAME "palette"
+#define WIDTH 400
+#define HEIGHT 200
+#define PAL_ENTRIES 256
+#define IMAGE1_NAME "image"
+#define PAL_NAME "palette"
/*-------------------------------------------------------------------------
* Function: main
@@ -44,65 +44,61 @@
*-------------------------------------------------------------------------
*/
-int main(void)
+int
+main(void)
{
- hid_t fid;
- int i, j, n, space;
+ hid_t fid;
+ int i, j, n, space;
unsigned char *buf;
- unsigned char pal[ PAL_ENTRIES * 3 ]; /* palette array */
- hsize_t pal_dims[2] = {PAL_ENTRIES,3}; /* palette dimensions */
- hsize_t width = WIDTH;
- hsize_t height = HEIGHT;
+ unsigned char pal[PAL_ENTRIES * 3]; /* palette array */
+ hsize_t pal_dims[2] = {PAL_ENTRIES, 3}; /* palette dimensions */
+ hsize_t width = WIDTH;
+ hsize_t height = HEIGHT;
/* Allocate buffer */
- if(NULL == (buf = (unsigned char *)malloc(WIDTH * HEIGHT)))
+ if (NULL == (buf = (unsigned char *)malloc(WIDTH * HEIGHT)))
return EXIT_FAILURE;
/* create a file */
- if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0)
+ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return EXIT_FAILURE;
/* create an image */
- space = WIDTH*HEIGHT / PAL_ENTRIES;
- for (i=0, j=0, n=0; i < WIDTH*HEIGHT; i++, j++ )
- {
+ space = WIDTH * HEIGHT / PAL_ENTRIES;
+ for (i = 0, j = 0, n = 0; i < WIDTH * HEIGHT; i++, j++) {
buf[i] = (unsigned char)n;
- if ( j > space )
- {
+ if (j > space) {
n++;
- j=0;
+ j = 0;
}
-
}
/* make the image */
- if (H5IMmake_image_8bit( fid, IMAGE1_NAME, width, height, buf )<0)
+ if (H5IMmake_image_8bit(fid, IMAGE1_NAME, width, height, buf) < 0)
return EXIT_FAILURE;
- /*-------------------------------------------------------------------------
- * define a palette, blue to red tones
- *-------------------------------------------------------------------------
- */
- for ( i=0, n=0; i<PAL_ENTRIES*3; i+=3, n++)
- {
- pal[i] = (unsigned char)n; /* red */
- pal[i+1] = (unsigned char)0; /* green */
- pal[i+2] = (unsigned char)(255-n); /* blue */
+ /*-------------------------------------------------------------------------
+ * define a palette, blue to red tones
+ *-------------------------------------------------------------------------
+ */
+ for (i = 0, n = 0; i < PAL_ENTRIES * 3; i += 3, n++) {
+ pal[i] = (unsigned char)n; /* red */
+ pal[i + 1] = (unsigned char)0; /* green */
+ pal[i + 2] = (unsigned char)(255 - n); /* blue */
}
/* make a palette */
- if (H5IMmake_palette( fid, PAL_NAME, pal_dims, pal )<0)
+ if (H5IMmake_palette(fid, PAL_NAME, pal_dims, pal) < 0)
return EXIT_FAILURE;
/* attach the palette to the image */
- if (H5IMlink_palette( fid, IMAGE1_NAME, PAL_NAME )<0)
+ if (H5IMlink_palette(fid, IMAGE1_NAME, PAL_NAME) < 0)
return EXIT_FAILURE;
- if(H5Fclose(fid)<0)
+ if (H5Fclose(fid) < 0)
return EXIT_FAILURE;
free(buf);
return EXIT_SUCCESS;
}
-
diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c
index 1833c92..936fd21 100644
--- a/hl/tools/gif2h5/hdf2gif.c
+++ b/hl/tools/gif2h5/hdf2gif.c
@@ -21,9 +21,8 @@
/* Name of tool */
#define PROGRAMNAME "hdf2gif"
-#define IMAGE_WIDTH_MAX 65535 /* unsigned 16bits integer */
-#define IMAGE_HEIGHT_MAX 65535 /* unsigned 16bits integer */
-
+#define IMAGE_WIDTH_MAX 65535 /* unsigned 16bits integer */
+#define IMAGE_HEIGHT_MAX 65535 /* unsigned 16bits integer */
int EndianOrder;
@@ -31,8 +30,8 @@ static void
putword(int w, FILE *fp)
{
/* writes a 16-bit integer in GIF order (LSB first) */
- fputc(w &0xff, fp);
- fputc((w>>8)&0xff,fp);
+ fputc(w & 0xff, fp);
+ fputc((w >> 8) & 0xff, fp);
}
static void
@@ -42,18 +41,18 @@ usage(void)
fprintf(stdout, " h52gif -V \n");
fprintf(stdout, " Print HDF5 library version and exit\n");
printf("h52gif expects *at least* one h5_image.\n");
-
}
static void
leave(int ret)
{
- h5tools_close();
- HDexit(ret);
+ h5tools_close();
+ HDexit(ret);
}
FILE *fpGif = NULL;
-int main(int argc , char **argv)
+int
+main(int argc, char **argv)
{
GIFBYTE *Image;
@@ -61,25 +60,25 @@ int main(int argc , char **argv)
GIFCHAR *HDFName = NULL;
GIFCHAR *GIFName = NULL;
- GIFBYTE* b;
+ GIFBYTE *b;
- GIFBYTE GlobalPalette[256][3];
- GIFBYTE Red[256];
- GIFBYTE Green[256];
- GIFBYTE Blue[256];
+ GIFBYTE GlobalPalette[256][3];
+ GIFBYTE Red[256];
+ GIFBYTE Green[256];
+ GIFBYTE Blue[256];
- int RWidth, RHeight;
- int ColorMapSize, InitCodeSize, Background, BitsPerPixel;
- int j,nc;
- int i;
- int numcols = 0;
+ int RWidth, RHeight;
+ int ColorMapSize, InitCodeSize, Background, BitsPerPixel;
+ int j, nc;
+ int i;
+ int numcols = 0;
- GIFBYTE pc2nc[256] , r1[256] , g1[256] , b1[256];
+ GIFBYTE pc2nc[256], r1[256], g1[256], b1[256];
- int arg_index = 2;
- int bool_is_image = 0; /* 0 = false , 1 = true */
- char *image_name = NULL;
- int idx;
+ int arg_index = 2;
+ int bool_is_image = 0; /* 0 = false , 1 = true */
+ char *image_name = NULL;
+ int idx;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -87,15 +86,12 @@ int main(int argc , char **argv)
/* Initialize h5tools lib */
h5tools_init();
- if ( argv[1] && (strcmp("-V",argv[1])==0) )
- {
+ if (argv[1] && (strcmp("-V", argv[1]) == 0)) {
print_version("gif2h5");
h5tools_setstatus(EXIT_SUCCESS);
}
-
- if (argc < 4)
- {
+ if (argc < 4) {
/* they didn't supply at least one image -- bail */
usage();
h5tools_setstatus(EXIT_FAILURE);
@@ -105,19 +101,17 @@ int main(int argc , char **argv)
GIFName = argv[2];
/* get the options */
- while (arg_index++ < argc - 1)
- {
- if (!strcmp(argv[arg_index] , "-i")) {
+ while (arg_index++ < argc - 1) {
+ if (!strcmp(argv[arg_index], "-i")) {
bool_is_image = 1;
continue;
}
- if (bool_is_image)
- {
+ if (bool_is_image) {
/* allocate space to store the image name */
size_t len = strlen(argv[arg_index]);
- image_name = (GIFCHAR*) malloc( len + 1);
- strcpy(image_name , argv[arg_index]);
+ image_name = (GIFCHAR *)malloc(len + 1);
+ strcpy(image_name, argv[arg_index]);
bool_is_image = 0;
continue;
@@ -129,80 +123,72 @@ int main(int argc , char **argv)
goto out;
}
- /* Do Endian Order testing and set Endian Order */
- idx = 0x0001;
- b = (GIFBYTE *) &idx;
- EndianOrder = (b[0] ? 1:0);
+ /* Do Endian Order testing and set Endian Order */
+ idx = 0x0001;
+ b = (GIFBYTE *)&idx;
+ EndianOrder = (b[0] ? 1 : 0);
- if (!(fpGif = fopen(GIFName , "wb")))
- {
+ if (!(fpGif = fopen(GIFName, "wb"))) {
printf("Error opening gif file for output. Aborting.\n");
goto out;
}
Background = 0;
{
- hsize_t width, height, planes;
- hid_t fid;
- char interlace[20];
- hssize_t npals;
- hsize_t pal_dims[2];
+ hsize_t width, height, planes;
+ hid_t fid;
+ char interlace[20];
+ hssize_t npals;
+ hsize_t pal_dims[2];
unsigned char *pal;
- if ((fid = H5Fopen(HDFName , H5F_ACC_RDONLY , H5P_DEFAULT)) < 0)
- {
- fprintf(stderr , "Unable to open HDF file for input. Aborting.\n");
+ if ((fid = H5Fopen(HDFName, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
+ fprintf(stderr, "Unable to open HDF file for input. Aborting.\n");
goto out;
}
/* get image's information */
- if ( H5IMget_image_info( fid, image_name, &width, &height, &planes, interlace, &npals ) < 0 )
- {
- fprintf(stderr , "Unable to get information of the image. Aborting.\n");
+ if (H5IMget_image_info(fid, image_name, &width, &height, &planes, interlace, &npals) < 0) {
+ fprintf(stderr, "Unable to get information of the image. Aborting.\n");
goto out;
}
- if (width > IMAGE_WIDTH_MAX || height > IMAGE_HEIGHT_MAX)
- {
- fprintf(stderr, "HDF5 image is too large. Limit is %d by %d.\n", IMAGE_WIDTH_MAX, IMAGE_HEIGHT_MAX);
+ if (width > IMAGE_WIDTH_MAX || height > IMAGE_HEIGHT_MAX) {
+ fprintf(stderr, "HDF5 image is too large. Limit is %d by %d.\n", IMAGE_WIDTH_MAX,
+ IMAGE_HEIGHT_MAX);
goto out;
}
/* tool can handle single plane images only. */
- if (planes > 1)
- {
+ if (planes > 1) {
fprintf(stderr, "Cannot handle multiple planes image\n");
goto out;
}
- Image = (GIFBYTE*) malloc( (size_t) width * (size_t) height );
+ Image = (GIFBYTE *)malloc((size_t)width * (size_t)height);
- if ( H5IMread_image( fid, image_name, Image ) < 0 )
- {
- fprintf(stderr , "Unable to read the image. Aborting.\n");
+ if (H5IMread_image(fid, image_name, Image) < 0) {
+ fprintf(stderr, "Unable to read the image. Aborting.\n");
goto out;
}
- if (npals)
- {
- if ( H5IMget_palette_info( fid, image_name, 0, pal_dims ) < 0 )
- {
- fprintf(stderr , "Unable to get information of the palette. Aborting.\n");
+ if (npals) {
+ if (H5IMget_palette_info(fid, image_name, 0, pal_dims) < 0) {
+ fprintf(stderr, "Unable to get information of the palette. Aborting.\n");
goto out;
}
- pal = (GIFBYTE*) malloc( (size_t) pal_dims[0] * (size_t) pal_dims[1] );
+ pal = (GIFBYTE *)malloc((size_t)pal_dims[0] * (size_t)pal_dims[1]);
- if ( H5IMget_palette( fid, image_name, 0, pal ) < 0 )
+ if (H5IMget_palette(fid, image_name, 0, pal) < 0)
goto out;
- numcols = (int) pal_dims[0];
+ numcols = (int)pal_dims[0];
- for (i = 0, j = 0 ; i < numcols ; j+=3, i++)
- {
+ for (i = 0, j = 0; i < numcols; j += 3, i++) {
GlobalPalette[i][0] = pal[j];
- GlobalPalette[i][1] = pal[j+1];
- GlobalPalette[i][2] = pal[j+2];
+ GlobalPalette[i][1] = pal[j + 1];
+ GlobalPalette[i][2] = pal[j + 2];
}
free(pal);
@@ -213,7 +199,6 @@ int main(int argc , char **argv)
RWidth = (int)width;
RHeight = (int)height;
-
/*
* If the first image does not have a palette, I make my own global
* color table Obviously this is not the best thing to do, better
@@ -223,62 +208,52 @@ int main(int argc , char **argv)
* palette
* 2. Check for palettes in any of the other images.
*/
- if (!npals)
- {
+ if (!npals) {
numcols = 256;
- for (i = 0 ; i < numcols ; i++)
- {
- Red[i] = (GIFBYTE)(255 - i);
+ for (i = 0; i < numcols; i++) {
+ Red[i] = (GIFBYTE)(255 - i);
Green[i] = (GIFBYTE)(255 - i);
- Blue[i] = (GIFBYTE)(255 - i);
+ Blue[i] = (GIFBYTE)(255 - i);
}
}
- else
- {
- for (i = 0 ; i < numcols ; i++)
- {
- Red[i] = GlobalPalette[i][0];
+ else {
+ for (i = 0; i < numcols; i++) {
+ Red[i] = GlobalPalette[i][0];
Green[i] = GlobalPalette[i][1];
- Blue[i] = GlobalPalette[i][2];
+ Blue[i] = GlobalPalette[i][2];
}
}
- for (i = 0; i < numcols; i++)
- {
+ for (i = 0; i < numcols; i++) {
pc2nc[i] = r1[i] = g1[i] = b1[i] = 0;
}
/* compute number of unique colors */
nc = 0;
- for (i = 0; i < numcols; i++)
- {
+ for (i = 0; i < numcols; i++) {
/* see if color #i is already used */
- for (j = 0; j < i; j++)
- {
+ for (j = 0; j < i; j++) {
if (Red[i] == Red[j] && Green[i] == Green[j] && Blue[i] == Blue[j])
break;
}
- if (j==i)
- {
+ if (j == i) {
/* wasn't found */
pc2nc[i] = (GIFBYTE)nc;
- r1[nc] = Red[i];
- g1[nc] = Green[i];
- b1[nc] = Blue[i];
+ r1[nc] = Red[i];
+ g1[nc] = Green[i];
+ b1[nc] = Blue[i];
nc++;
}
- else
- {
+ else {
pc2nc[i] = pc2nc[j];
}
}
/* figure out 'BitsPerPixel' */
- for (i = 1; i < 8; i++)
- {
- if ((1<<i) >= nc)
+ for (i = 1; i < 8; i++) {
+ if ((1 << i) >= nc)
break;
}
@@ -290,59 +265,54 @@ int main(int argc , char **argv)
else
InitCodeSize = BitsPerPixel;
- if (!fpGif)
- {
- fprintf(stderr, "WriteGIF: file not open for writing\n" );
+ if (!fpGif) {
+ fprintf(stderr, "WriteGIF: file not open for writing\n");
goto out;
}
+ fwrite("GIF87a", sizeof(char), 6, fpGif); /* the GIF magic number */
- fwrite("GIF87a", sizeof( char ), 6, fpGif); /* the GIF magic number */
-
- putword(RWidth, fpGif); /* screen descriptor */
+ putword(RWidth, fpGif); /* screen descriptor */
putword(RHeight, fpGif);
- i = 0x00; /* No, there is no color map */
- i |= (8-1)<<4; /* OR in the color resolution (hardwired 8) */
- i |= (BitsPerPixel - 1); /* OR in the # of bits per pixel */
- fputc(i,fpGif);
-
- fputc(Background,fpGif); /* background color */
- fputc(0, fpGif); /* future expansion byte */
+ i = 0x00; /* No, there is no color map */
+ i |= (8 - 1) << 4; /* OR in the color resolution (hardwired 8) */
+ i |= (BitsPerPixel - 1); /* OR in the # of bits per pixel */
+ fputc(i, fpGif);
+ fputc(Background, fpGif); /* background color */
+ fputc(0, fpGif); /* future expansion byte */
/*
* Put Image Descriptor
* Hardwiring Left Offset and Top Offset to 0x00
*/
- fputc(0x2c , fpGif);
- putword(0x00 , fpGif);
- putword(0x00 , fpGif);
- putword(RWidth , fpGif);
- putword(RHeight , fpGif);
+ fputc(0x2c, fpGif);
+ putword(0x00, fpGif);
+ putword(0x00, fpGif);
+ putword(RWidth, fpGif);
+ putword(RHeight, fpGif);
/* since we always have a local color palette ... */
- fputc((0x80 | (BitsPerPixel - 1)) , fpGif);
+ fputc((0x80 | (BitsPerPixel - 1)), fpGif);
- for (i = 0; i < ColorMapSize; i++)
- {
+ for (i = 0; i < ColorMapSize; i++) {
/* write out Global colormap */
fputc(r1[i], fpGif);
fputc(g1[i], fpGif);
fputc(b1[i], fpGif);
}
- fputc(InitCodeSize , fpGif);
+ fputc(InitCodeSize, fpGif);
- i = hdfWriteGIF(fpGif , Image , 0 , RHeight , RWidth , r1, g1 , b1 , pc2nc , 256 , 8 , BitsPerPixel);
+ i = hdfWriteGIF(fpGif, Image, 0, RHeight, RWidth, r1, g1, b1, pc2nc, 256, 8, BitsPerPixel);
fputc(0x00, fpGif);
free(Image);
}
- if (fputc(';',fpGif) == EOF)
- {
+ if (fputc(';', fpGif) == EOF) {
/* Write GIF file terminator */
- fprintf(stderr , "Error!");
+ fprintf(stderr, "Error!");
goto out;
}
@@ -353,7 +323,6 @@ int main(int argc , char **argv)
leave(h5tools_getstatus());
-
out:
if (fpGif != NULL)
diff --git a/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c
index d44ff7a..7be68dc 100644
--- a/hl/tools/gif2h5/hdfgifwr.c
+++ b/hl/tools/gif2h5/hdfgifwr.c
@@ -44,7 +44,6 @@
* Joe Orost (decvax!vax135!petsd!joe)
*****************************************************************/
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -65,32 +64,32 @@ static void flush_char(void);
#else
static void compress(), output(), cl_block(), cl_hash();
static void char_init(), char_out(), flush_char();
-#endif /* __STDC__ */
+#endif /* __STDC__ */
static byte pc2nc[256];
/***********************************************************************/
static unsigned long cur_accum = 0;
-static int cur_bits = 0;
+static int cur_bits = 0;
-#define MAXCODE(n_bits) ( (1 << (n_bits)) - 1)
-#define XV_BITS 12 /* BITS was already defined on some systems */
-#define HSIZE 5003 /* 80% occupancy */
+#define MAXCODE(n_bits) ((1 << (n_bits)) - 1)
+#define XV_BITS 12 /* BITS was already defined on some systems */
+#define HSIZE 5003 /* 80% occupancy */
-typedef unsigned char char_type;
+typedef unsigned char char_type;
static int n_bits; /* number of bits/code */
static int maxbits = XV_BITS; /* user settable max # bits/code */
static int maxcode; /* maximum code, given n_bits */
static int maxmaxcode = 1 << XV_BITS; /* NEVER generate this */
-static count_int *htab;
-static unsigned short *codetab;
+static count_int * htab;
+static unsigned short *codetab;
-#define HashTabOf(i) htab[i]
-#define CodeTabOf(i) codetab[i]
+#define HashTabOf(i) htab[i]
+#define CodeTabOf(i) codetab[i]
-static int hsize = HSIZE; /* for dynamic table sizing */
+static int hsize = HSIZE; /* for dynamic table sizing */
/*
* To save much memory, we overlay the table used by compress() with those
@@ -101,7 +100,7 @@ static int hsize = HSIZE; /* for dynamic table sizing */
* used to be 8000 characters).
*/
-static int free_ent = 0; /* first unused entry */
+static int free_ent = 0; /* first unused entry */
/*
* block compression parameters -- after all codes are used up,
@@ -109,8 +108,8 @@ static int free_ent = 0; /* first unused entry */
*/
static int clear_flg = 0;
-static long int in_count = 1; /* length of input */
-static long int out_count = 0; /* # of codes output (for debugging) */
+static long int in_count = 1; /* length of input */
+static long int out_count = 0; /* # of codes output (for debugging) */
/*
* compress stdin to stdout
@@ -128,19 +127,19 @@ static long int out_count = 0; /* # of codes output (for debugging) */
* about this implementation to ames!jaw.
*/
-static int g_init_bits;
+static int g_init_bits;
static FILE *g_outfile;
static int ClearCode;
static int EOFCode;
/*************************************************************/
-int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap,
- byte *gmap, byte *bmap, byte *pc2ncmap, int numcols,
- int colorstyle, int BitsPerPixel)
+int
+hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap, byte *gmap, byte *bmap, byte *pc2ncmap,
+ int numcols, int colorstyle, int BitsPerPixel)
{
- int InitCodeSize;
- int i;
+ int InitCodeSize;
+ int i;
byte *pic8 = pic;
if (!(htab = calloc(HSIZE, sizeof(count_int)))) {
@@ -153,15 +152,15 @@ int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap,
}
/* Shut compiler up... */
- ptype=ptype;
- rmap=rmap;
- gmap=gmap;
- bmap=bmap;
- numcols=numcols;
- colorstyle=colorstyle;
+ ptype = ptype;
+ rmap = rmap;
+ gmap = gmap;
+ bmap = bmap;
+ numcols = numcols;
+ colorstyle = colorstyle;
for (i = 0; i < 256; i++) {
- pc2nc[i] = pc2ncmap[i];
+ pc2nc[i] = pc2ncmap[i];
}
if (BitsPerPixel <= 1)
@@ -170,11 +169,11 @@ int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap,
InitCodeSize = BitsPerPixel;
if (!fp) {
- fprintf(stderr, "WriteGIF: file not open for writing\n");
+ fprintf(stderr, "WriteGIF: file not open for writing\n");
return 1;
}
- compress(InitCodeSize+1, fp, pic8, w*h);
+ compress(InitCodeSize + 1, fp, pic8, w * h);
free(htab);
free(codetab);
@@ -182,19 +181,20 @@ int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap,
if (ferror(fp))
return -1;
- return 0 ;
+ return 0;
}
/********************************************************/
-static void compress(int init_bits, FILE *outfile, byte *data, int len)
+static void
+compress(int init_bits, FILE *outfile, byte *data, int len)
{
register long fcode;
- register int i = 0;
- register int c;
- register int ent;
- register int disp;
- register int hsize_reg;
- register int hshift;
+ register int i = 0;
+ register int c;
+ register int ent;
+ register int disp;
+ register int hsize_reg;
+ register int hshift;
/*
* Set up the globals: g_init_bits - initial number of bits g_outfile -
@@ -204,38 +204,38 @@ static void compress(int init_bits, FILE *outfile, byte *data, int len)
g_outfile = outfile;
/* initialize 'compress' globals */
- maxbits = XV_BITS;
- maxmaxcode = 1<<XV_BITS;
- hsize = HSIZE;
- free_ent = 0;
- clear_flg = 0;
- in_count = 1;
- out_count = 0;
- cur_accum = 0;
- cur_bits = 0;
+ maxbits = XV_BITS;
+ maxmaxcode = 1 << XV_BITS;
+ hsize = HSIZE;
+ free_ent = 0;
+ clear_flg = 0;
+ in_count = 1;
+ out_count = 0;
+ cur_accum = 0;
+ cur_bits = 0;
/* Set up the necessary values */
out_count = 0;
clear_flg = 0;
- in_count = 1;
- maxcode = MAXCODE(n_bits = g_init_bits);
+ in_count = 1;
+ maxcode = MAXCODE(n_bits = g_init_bits);
ClearCode = (1 << (init_bits - 1));
- EOFCode = ClearCode + 1;
- free_ent = ClearCode + 2;
+ EOFCode = ClearCode + 1;
+ free_ent = ClearCode + 2;
char_init();
ent = pc2nc[*data++];
len--;
hshift = 0;
- for (fcode = (long)hsize; fcode < 65536L; fcode *= 2L )
+ for (fcode = (long)hsize; fcode < 65536L; fcode *= 2L)
hshift++;
hshift = 8 - hshift; /* set hash code range bound */
hsize_reg = hsize;
- cl_hash( (count_int) hsize_reg); /* clear hash table */
+ cl_hash((count_int)hsize_reg); /* clear hash table */
output(ClearCode);
@@ -244,32 +244,33 @@ static void compress(int init_bits, FILE *outfile, byte *data, int len)
len--;
in_count++;
- fcode = (long)(((long) c << maxbits) + ent);
- i = (((int) c << hshift) ^ ent); /* xor hashing */
+ fcode = (long)(((long)c << maxbits) + ent);
+ i = (((int)c << hshift) ^ ent); /* xor hashing */
- if ( HashTabOf (i) == fcode ) {
- ent = CodeTabOf (i);
+ if (HashTabOf(i) == fcode) {
+ ent = CodeTabOf(i);
continue;
- } else if ( (long)HashTabOf (i) < 0) {
+ }
+ else if ((long)HashTabOf(i) < 0) {
/* empty slot */
goto nomatch;
}
- disp = hsize_reg - i; /* secondary hash (after G. Knott) */
+ disp = hsize_reg - i; /* secondary hash (after G. Knott) */
- if ( i == 0 )
+ if (i == 0)
disp = 1;
probe:
if ((i -= disp) < 0)
i += hsize_reg;
- if (HashTabOf (i) == fcode) {
- ent = CodeTabOf (i);
+ if (HashTabOf(i) == fcode) {
+ ent = CodeTabOf(i);
continue;
}
- if ((long)HashTabOf (i) >= 0)
+ if ((long)HashTabOf(i) >= 0)
goto probe;
nomatch:
@@ -278,9 +279,10 @@ nomatch:
ent = c;
if (free_ent < maxmaxcode) {
- CodeTabOf (i) = (unsigned short)free_ent++; /* code -> hashtable */
- HashTabOf (i) = fcode;
- } else {
+ CodeTabOf(i) = (unsigned short)free_ent++; /* code -> hashtable */
+ HashTabOf(i) = fcode;
+ }
+ else {
cl_block();
}
}
@@ -291,7 +293,6 @@ nomatch:
output(EOFCode);
}
-
/*****************************************************************
* TAG( output )
*
@@ -309,11 +310,8 @@ nomatch:
* code in turn. When the buffer fills up empty it and start over.
*/
-static
-unsigned long masks[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F,
- 0x001F, 0x003F, 0x007F, 0x00FF,
- 0x01FF, 0x03FF, 0x07FF, 0x0FFF,
- 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF };
+static unsigned long masks[] = {0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF,
+ 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF};
static void
output(int code)
@@ -327,8 +325,8 @@ output(int code)
cur_bits += n_bits;
- while( cur_bits >= 8 ) {
- char_out( (int)((unsigned int) cur_accum & 0xff) );
+ while (cur_bits >= 8) {
+ char_out((int)((unsigned int)cur_accum & 0xff));
cur_accum >>= 8;
cur_bits -= 8;
}
@@ -339,12 +337,13 @@ output(int code)
*/
if (free_ent > maxcode || clear_flg) {
if (clear_flg) {
- maxcode = MAXCODE (n_bits = g_init_bits);
+ maxcode = MAXCODE(n_bits = g_init_bits);
clear_flg = 0;
- } else {
+ }
+ else {
n_bits++;
- if ( n_bits == maxbits )
+ if (n_bits == maxbits)
maxcode = maxmaxcode;
else
maxcode = MAXCODE(n_bits);
@@ -353,17 +352,17 @@ output(int code)
if (code == EOFCode) {
/* At EOF, write the rest of the buffer */
- while( cur_bits > 0 ) {
- char_out( (int)((unsigned int)cur_accum & 0xff) );
+ while (cur_bits > 0) {
+ char_out((int)((unsigned int)cur_accum & 0xff));
cur_accum >>= 8;
cur_bits -= 8;
}
flush_char();
- fflush( g_outfile );
+ fflush(g_outfile);
#ifdef FOO
- if(ferror( g_outfile))
+ if (ferror(g_outfile))
FatalError("unable to write GIF file");
#endif
}
@@ -371,45 +370,45 @@ output(int code)
/********************************/
static void
-cl_block(void) /* table clear for block compress */
+cl_block(void) /* table clear for block compress */
{
/* Clear out the hash table */
- cl_hash((count_int) hsize);
- free_ent = ClearCode + 2;
+ cl_hash((count_int)hsize);
+ free_ent = ClearCode + 2;
clear_flg = 1;
output(ClearCode);
}
/********************************/
static void
-cl_hash(count_int hashsize) /* reset code table */
+cl_hash(count_int hashsize) /* reset code table */
{
- count_int *htab_p = htab+hashsize;
- long i, m1 = -1;
+ count_int *htab_p = htab + hashsize;
+ long i, m1 = -1;
i = hashsize - 16;
- do { /* might use Sys V memset(3) here */
- *(htab_p-16) = m1;
- *(htab_p-15) = m1;
- *(htab_p-14) = m1;
- *(htab_p-13) = m1;
- *(htab_p-12) = m1;
- *(htab_p-11) = m1;
- *(htab_p-10) = m1;
- *(htab_p-9) = m1;
- *(htab_p-8) = m1;
- *(htab_p-7) = m1;
- *(htab_p-6) = m1;
- *(htab_p-5) = m1;
- *(htab_p-4) = m1;
- *(htab_p-3) = m1;
- *(htab_p-2) = m1;
- *(htab_p-1) = m1;
+ do { /* might use Sys V memset(3) here */
+ *(htab_p - 16) = m1;
+ *(htab_p - 15) = m1;
+ *(htab_p - 14) = m1;
+ *(htab_p - 13) = m1;
+ *(htab_p - 12) = m1;
+ *(htab_p - 11) = m1;
+ *(htab_p - 10) = m1;
+ *(htab_p - 9) = m1;
+ *(htab_p - 8) = m1;
+ *(htab_p - 7) = m1;
+ *(htab_p - 6) = m1;
+ *(htab_p - 5) = m1;
+ *(htab_p - 4) = m1;
+ *(htab_p - 3) = m1;
+ *(htab_p - 2) = m1;
+ *(htab_p - 1) = m1;
htab_p -= 16;
} while ((i -= 16) >= 0);
- for ( i += 16; i > 0; i-- )
+ for (i += 16; i > 0; i--)
*--htab_p = m1;
}
@@ -436,7 +435,7 @@ char_init(void)
/*
* Define the storage for the packet accumulator
*/
-static char accum[ 256 ];
+static char accum[256];
/*
* Add a character to the end of the current packet, and if it is 254
@@ -445,7 +444,7 @@ static char accum[ 256 ];
static void
char_out(int c)
{
- accum[ a_count++ ] = (char)c;
+ accum[a_count++] = (char)c;
if (a_count >= 254)
flush_char();
@@ -458,8 +457,8 @@ static void
flush_char(void)
{
if (a_count > 0) {
- fputc( a_count, g_outfile );
- fwrite( accum, (size_t)1, (size_t)a_count, g_outfile);
+ fputc(a_count, g_outfile);
+ fwrite(accum, (size_t)1, (size_t)a_count, g_outfile);
a_count = 0;
}
}
diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c
index c2933c5..0cf3926 100644
--- a/hl/tools/gif2h5/writehdf.c
+++ b/hl/tools/gif2h5/writehdf.c
@@ -37,21 +37,21 @@
int
WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName)
{
- GIFHEAD gifHead; /* GIF Header structure */
- GIFIMAGEDESC *gifImageDesc; /* Logical Image Descriptor struct */
- int has_pal=0;
+ GIFHEAD gifHead; /* GIF Header structure */
+ GIFIMAGEDESC *gifImageDesc; /* Logical Image Descriptor struct */
+ int has_pal = 0;
- long ImageCount; /* number of images */
+ long ImageCount; /* number of images */
#ifdef UNUSED
- long CommentCount, /* number of comments */
- ApplicationCount, /* number of application extensions */
- PlainTextCount; /* number of plain text extensions */
-#endif /* UNUSED */
+ long CommentCount, /* number of comments */
+ ApplicationCount, /* number of application extensions */
+ PlainTextCount; /* number of plain text extensions */
+#endif /* UNUSED */
- char ImageName[256]; /* Image name for the Image */
+ char ImageName[256]; /* Image name for the Image */
/* H5 variables */
- hid_t file_id; /* H5 file id */
+ hid_t file_id; /* H5 file id */
/* temp counter */
int i;
@@ -62,35 +62,36 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName)
/* get some data from gifHead */
ImageCount = gifHead.ImageCount;
#ifdef UNUSED
- CommentCount = (GIFWORD)gifHead.CommentCount;
+ CommentCount = (GIFWORD)gifHead.CommentCount;
ApplicationCount = (GIFWORD)gifHead.ApplicationCount;
- PlainTextCount = (GIFWORD)gifHead.PlainTextCount;
+ PlainTextCount = (GIFWORD)gifHead.PlainTextCount;
#endif /* UNUSED */
- if ((file_id = H5Fcreate(HDFName , H5F_ACC_TRUNC , H5P_DEFAULT , H5P_DEFAULT)) < 0) {
+ if ((file_id = H5Fcreate(HDFName, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
/* error occured opening the HDF File for write */
- fprintf(stderr , "HDF file could not be opened for writing\n");
- fprintf(stderr , "NOTE: GIF file must be present in the same directory as the binary on UNIX systems.\n");
+ fprintf(stderr, "HDF file could not be opened for writing\n");
+ fprintf(stderr,
+ "NOTE: GIF file must be present in the same directory as the binary on UNIX systems.\n");
exit(1);
}
/* first create the global palette if there is one */
if (gifHead.PackedField & 0x80) { /* global palette exists */
- hsize_t dims[2]; /* specify the dimensions of the palette */
+ hsize_t dims[2]; /* specify the dimensions of the palette */
/* size of the palette is tablesize (rows) X 3 (columns) */
dims[0] = gifHead.TableSize;
dims[1] = 3;
/* make a palette */
- if (H5IMmake_palette(file_id,PAL_NAME,dims,(unsigned char *)gifHead.HDFPalette)<0)
- return -1;
+ if (H5IMmake_palette(file_id, PAL_NAME, dims, (unsigned char *)gifHead.HDFPalette) < 0)
+ return -1;
- has_pal=1;
+ has_pal = 1;
}
- for(i = 0; i < ImageCount; i++) {
- hsize_t dims[2]; /* dimensions for the dataset */
+ for (i = 0; i < ImageCount; i++) {
+ hsize_t dims[2]; /* dimensions for the dataset */
/* get the gifImageDesc */
gifImageDesc = GifMemoryStruct.GifImageDesc[i];
@@ -99,26 +100,24 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName)
dims[1] = gifImageDesc->ImageWidth;
/* create the image name */
- sprintf(ImageName , "Image%d" , i);
+ sprintf(ImageName, "Image%d", i);
/* write image */
- if (H5IMmake_image_8bit(file_id,ImageName,dims[1],dims[0],(gifImageDesc->Image))<0)
- return -1;
+ if (H5IMmake_image_8bit(file_id, ImageName, dims[1], dims[0], (gifImageDesc->Image)) < 0)
+ return -1;
/* attach the palette to the image dataset */
- if (has_pal)
- {
- if (H5IMlink_palette(file_id,ImageName,PAL_NAME)<0)
+ if (has_pal) {
+ if (H5IMlink_palette(file_id, ImageName, PAL_NAME) < 0)
return -1;
}
}
/* close the H5 file */
if (H5Fclose(file_id) < 0) {
- fprintf(stderr , "Could not close HDF5 file. Aborting...\n");
+ fprintf(stderr, "Could not close HDF5 file. Aborting...\n");
return -1;
}
return 0;
}
-
diff --git a/hl/tools/h5watch/extend_dset.c b/hl/tools/h5watch/extend_dset.c
index 6b59ea1..8677601 100644
--- a/hl/tools/h5watch/extend_dset.c
+++ b/hl/tools/h5watch/extend_dset.c
@@ -16,18 +16,18 @@
/*
* Extending datasets in WATCH.h5 generated by h5watchgentest.c
*/
-#define DSET_ONE "DSET_ONE"
-#define DSET_TWO "DSET_TWO"
-#define DSET_CMPD "DSET_CMPD"
-#define DSET_CMPD_ESC "DSET_CMPD_ESC"
-#define DSET_CMPD_TWO "DSET_CMPD_TWO"
-#define DSET_ALLOC_LATE "DSET_ALLOC_LATE"
+#define DSET_ONE "DSET_ONE"
+#define DSET_TWO "DSET_TWO"
+#define DSET_CMPD "DSET_CMPD"
+#define DSET_CMPD_ESC "DSET_CMPD_ESC"
+#define DSET_CMPD_TWO "DSET_CMPD_TWO"
+#define DSET_ALLOC_LATE "DSET_ALLOC_LATE"
#define DSET_ALLOC_EARLY "DSET_ALLOC_EARLY"
/* The message sent by this process (extend_dset) to the test script to start "h5watch" */
-#define WRITER_MESSAGE "writer_message"
+#define WRITER_MESSAGE "writer_message"
/* The message received from the test script to start extending dataset */
-#define READER_MESSAGE "reader_message"
+#define READER_MESSAGE "reader_message"
/* Size of data buffer */
#define TEST_BUF_SIZE 100
@@ -35,7 +35,6 @@
static herr_t extend_dset_two(const char *file, char *dname, int action1, int action2);
static herr_t extend_dset_one(const char *file, char *dname, int action);
-
/* Data structures for datasets with compound data type */
typedef struct sub22_t {
int a;
@@ -44,9 +43,9 @@ typedef struct sub22_t {
} sub22_t;
typedef struct sub2_t {
- int a;
+ int a;
sub22_t b;
- int c;
+ int c;
} sub2_t;
typedef struct sub4_t {
@@ -55,7 +54,7 @@ typedef struct sub4_t {
} sub4_t;
typedef struct set_t {
- int field1;
+ int field1;
sub2_t field2;
double field3;
sub4_t field4;
@@ -72,67 +71,67 @@ typedef struct set_t {
static herr_t
extend_dset_two(const char *file, char *dname, int action1, int action2)
{
- hid_t fid = -1; /* file id */
- hid_t fapl = -1; /* file access property list id */
- hid_t did = -1; /* dataset id */
- hid_t sid = -1; /* dataspace id */
- hid_t dtid = -1; /* dataset's datatype id */
- int ndims; /* # of dimension sizes */
- unsigned i; /* local index variable */
- hsize_t ext_dims[2]; /* new dimension sizes after extension */
- hsize_t cur_dims[2]; /* current dimension sizes */
- size_t dtype_size; /* size of the dataset's datatype */
- unsigned num_elmts; /* number of elements in the dataset */
- int *ibuf = NULL; /* buffer for storing retrieved elements (integer) */
- set_t *cbuf = NULL; /* buffer for storing retrieved elemnets (compound) */
+ hid_t fid = -1; /* file id */
+ hid_t fapl = -1; /* file access property list id */
+ hid_t did = -1; /* dataset id */
+ hid_t sid = -1; /* dataspace id */
+ hid_t dtid = -1; /* dataset's datatype id */
+ int ndims; /* # of dimension sizes */
+ unsigned i; /* local index variable */
+ hsize_t ext_dims[2]; /* new dimension sizes after extension */
+ hsize_t cur_dims[2]; /* current dimension sizes */
+ size_t dtype_size; /* size of the dataset's datatype */
+ unsigned num_elmts; /* number of elements in the dataset */
+ int * ibuf = NULL; /* buffer for storing retrieved elements (integer) */
+ set_t * cbuf = NULL; /* buffer for storing retrieved elemnets (compound) */
/* Allocate memory */
- if(NULL == (ibuf = (int *)HDcalloc(TEST_BUF_SIZE, sizeof(int))))
+ if (NULL == (ibuf = (int *)HDcalloc(TEST_BUF_SIZE, sizeof(int))))
goto error;
- if(NULL == (cbuf = (set_t *)HDcalloc(TEST_BUF_SIZE, sizeof(set_t))))
+ if (NULL == (cbuf = (set_t *)HDcalloc(TEST_BUF_SIZE, sizeof(set_t))))
goto error;
/* Create a copy of file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
goto error;
/* Open the file and dataset with SWMR write */
- if((fid = H5Fopen(file, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(file, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
goto error;
- if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
goto error;
/* Send message to the test script to start "h5watch" */
h5_send_message(WRITER_MESSAGE, NULL, NULL);
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
goto error;
- if((ndims = H5Sget_simple_extent_ndims(sid)) < 0)
+ if ((ndims = H5Sget_simple_extent_ndims(sid)) < 0)
goto error;
/* Get the size of the dataset's datatype */
- if((dtype_size = H5LDget_dset_type_size(did, NULL)) == 0)
+ if ((dtype_size = H5LDget_dset_type_size(did, NULL)) == 0)
goto error;
/* Get the dataset's data type */
- if((dtid = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0)
+ if ((dtid = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0)
goto error;
/* Wait for message from the test script to start extending dataset */
- if(h5_wait_message(READER_MESSAGE) < 0)
+ if (h5_wait_message(READER_MESSAGE) < 0)
goto error;
/* sleep to emulate about 2 seconds of application operation */
HDsleep(2);
/* Get current dimension sizes */
- if(H5LDget_dset_dims(did, cur_dims) < 0)
+ if (H5LDget_dset_dims(did, cur_dims) < 0)
goto error;
/* Set up the new extended dimension sizes */
@@ -140,68 +139,74 @@ extend_dset_two(const char *file, char *dname, int action1, int action2)
ext_dims[1] = cur_dims[1] + (hsize_t)action2;
/* Extend the dataset */
- if(H5Dset_extent(did, ext_dims) < 0)
+ if (H5Dset_extent(did, ext_dims) < 0)
goto error;
num_elmts = 1;
- for(i = 0; i < (unsigned)ndims; i++)
+ for (i = 0; i < (unsigned)ndims; i++)
num_elmts *= (unsigned)ext_dims[i];
/* Compound type */
- if(!HDstrcmp(dname, DSET_CMPD_TWO)) {
+ if (!HDstrcmp(dname, DSET_CMPD_TWO)) {
HDmemset(cbuf, 0, TEST_BUF_SIZE * sizeof(set_t));
- for(i = 0; i < num_elmts; i++) {
- cbuf[i].field1 = action1;
- cbuf[i].field2.a = action1;
- cbuf[i].field2.c = action1;
+ for (i = 0; i < num_elmts; i++) {
+ cbuf[i].field1 = action1;
+ cbuf[i].field2.a = action1;
+ cbuf[i].field2.c = action1;
cbuf[i].field2.b.a = action1;
cbuf[i].field2.b.b = action1;
cbuf[i].field2.b.c = action1;
- cbuf[i].field3 = action1;
- cbuf[i].field4.a = action1;
- cbuf[i].field4.b = action1;
+ cbuf[i].field3 = action1;
+ cbuf[i].field4.a = action1;
+ cbuf[i].field4.b = action1;
} /* end for */
- /* Write to the dataset */
- if(H5Dwrite(did, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, cbuf) < 0)
+ /* Write to the dataset */
+ if (H5Dwrite(did, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, cbuf) < 0)
goto error;
-
- } else { /* Integer type */
+ }
+ else { /* Integer type */
HDmemset(ibuf, 0, TEST_BUF_SIZE * sizeof(int));
- for(i = 0; i < num_elmts; i++)
+ for (i = 0; i < num_elmts; i++)
ibuf[i] = action1;
/* Write to the dataset */
- if(H5Dwrite(did, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf) < 0)
+ if (H5Dwrite(did, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf) < 0)
goto error;
} /* end if-else */
- if(H5Dflush(did) < 0)
+ if (H5Dflush(did) < 0)
goto error;
/* Closing */
- if(H5Tclose(dtid) < 0) goto error;
- if(H5Dclose(did) < 0) goto error;
- if(H5Pclose(fapl) < 0) goto error;
- if(H5Fclose(fid) < 0) goto error;
+ if (H5Tclose(dtid) < 0)
+ goto error;
+ if (H5Dclose(did) < 0)
+ goto error;
+ if (H5Pclose(fapl) < 0)
+ goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
- if(ibuf) HDfree(ibuf);
- if(cbuf) HDfree(cbuf);
+ if (ibuf)
+ HDfree(ibuf);
+ if (cbuf)
+ HDfree(cbuf);
return SUCCEED;
error:
H5E_BEGIN_TRY
- H5Tclose(dtid);
- H5Dclose(did);
- H5Pclose(fapl);
- H5Fclose(fid);
+ H5Tclose(dtid);
+ H5Dclose(did);
+ H5Pclose(fapl);
+ H5Fclose(fid);
H5E_END_TRY
- if(ibuf)
+ if (ibuf)
HDfree(ibuf);
- if(cbuf)
+ if (cbuf)
HDfree(cbuf);
return FAIL;
@@ -219,98 +224,98 @@ error:
static herr_t
extend_dset_one(const char *file, char *dname, int action)
{
- hid_t fid = -1; /* file id */
- hid_t fapl = -1; /* file access property list id */
- hid_t did = -1; /* dataset id */
- hid_t dtid = -1; /* dataset's datatype id */
- hid_t sid = -1; /* dataspace id */
- hid_t mid = -1; /* memory space id */
- int i; /* local index variable */
- hsize_t cur_dims[1]; /* current dimension sizes */
- hsize_t ext_dims[1]; /* new dimension sizes after extension */
- hsize_t offset[1]; /* starting offsets of appended data */
- hsize_t count[1]; /* dimension sizes of appended data */
- size_t dtype_size; /* size of the dataset's datatype */
- int *ibuf = NULL; /* buffer for storing retrieved elements (integer) */
- set_t *cbuf = NULL; /* buffer for storing retrieved elemnets (compound) */
+ hid_t fid = -1; /* file id */
+ hid_t fapl = -1; /* file access property list id */
+ hid_t did = -1; /* dataset id */
+ hid_t dtid = -1; /* dataset's datatype id */
+ hid_t sid = -1; /* dataspace id */
+ hid_t mid = -1; /* memory space id */
+ int i; /* local index variable */
+ hsize_t cur_dims[1]; /* current dimension sizes */
+ hsize_t ext_dims[1]; /* new dimension sizes after extension */
+ hsize_t offset[1]; /* starting offsets of appended data */
+ hsize_t count[1]; /* dimension sizes of appended data */
+ size_t dtype_size; /* size of the dataset's datatype */
+ int * ibuf = NULL; /* buffer for storing retrieved elements (integer) */
+ set_t * cbuf = NULL; /* buffer for storing retrieved elemnets (compound) */
/* Allocate memory */
- if(NULL == (ibuf = (int *)HDcalloc(TEST_BUF_SIZE, sizeof(int))))
+ if (NULL == (ibuf = (int *)HDcalloc(TEST_BUF_SIZE, sizeof(int))))
goto error;
- if(NULL == (cbuf = (set_t *)HDcalloc(TEST_BUF_SIZE, sizeof(set_t))))
+ if (NULL == (cbuf = (set_t *)HDcalloc(TEST_BUF_SIZE, sizeof(set_t))))
goto error;
/* Create a copy of file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
goto error;
/* Open the file and dataset with SWMR write */
- if((fid = H5Fopen(file, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(file, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
goto error;
/* Send message to the test script to start "h5watch" */
h5_send_message(WRITER_MESSAGE, NULL, NULL);
- if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
goto error;
/* Get size of the dataset's datatype */
- if((dtype_size = H5LDget_dset_type_size(did, NULL)) == 0)
+ if ((dtype_size = H5LDget_dset_type_size(did, NULL)) == 0)
goto error;
/* Get dataset's datatype */
- if((dtid = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0)
+ if ((dtid = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0)
goto error;
/* Wait for message from the test script to start extending dataset */
- if(h5_wait_message(READER_MESSAGE) < 0)
+ if (h5_wait_message(READER_MESSAGE) < 0)
goto error;
/* sleep to emulate about 2 seconds of application operation */
HDsleep(2);
/* Get current dimension sizes */
- if(H5LDget_dset_dims(did, cur_dims) < 0)
+ if (H5LDget_dset_dims(did, cur_dims) < 0)
goto error;
/* Set up the new extended dimension sizes */
ext_dims[0] = cur_dims[0] + (hsize_t)action;
/* Extend the dataset */
- if(H5Dset_extent(did, ext_dims) < 0)
+ if (H5Dset_extent(did, ext_dims) < 0)
goto error;
/* Write to the new appended region of the dataset */
- if(action > 0) {
+ if (action > 0) {
/* Select the extended region */
offset[0] = cur_dims[0];
- count[0] = (hsize_t)action;
- if((sid = H5Dget_space(did)) < 0)
+ count[0] = (hsize_t)action;
+ if ((sid = H5Dget_space(did)) < 0)
goto error;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0)
goto error;
/* Set up memory space and get dataset's datatype */
- if((mid = H5Screate_simple(1, count, NULL)) < 0)
+ if ((mid = H5Screate_simple(1, count, NULL)) < 0)
goto error;
/* Initialize data for the extended region of the dataset */
/* Compound type */
- if(!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) {
+ if (!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) {
HDmemset(cbuf, 0, TEST_BUF_SIZE * sizeof(set_t));
- for(i = 0; i < action; i++) {
- cbuf[i].field1 = i + 1;
- cbuf[i].field2.a = i + 2;
+ for (i = 0; i < action; i++) {
+ cbuf[i].field1 = i + 1;
+ cbuf[i].field2.a = i + 2;
cbuf[i].field2.b.a = i + 2;
cbuf[i].field2.b.b = i + 2;
cbuf[i].field2.b.c = i + 2;
- cbuf[i].field2.c = i + 2;
+ cbuf[i].field2.c = i + 2;
cbuf[i].field3 = i + 3;
@@ -319,57 +324,65 @@ extend_dset_one(const char *file, char *dname, int action)
} /* end for */
/* Write to the extended region of the dataset */
- if(H5Dwrite(did, dtid, mid, sid, H5P_DEFAULT, cbuf) < 0)
+ if (H5Dwrite(did, dtid, mid, sid, H5P_DEFAULT, cbuf) < 0)
goto error;
- } else { /* Integer type */
+ }
+ else { /* Integer type */
HDmemset(ibuf, 0, TEST_BUF_SIZE * sizeof(int));
- for(i = 0; i < action; i++)
+ for (i = 0; i < action; i++)
ibuf[i] = (int)i;
/* Write to the extended region of the dataset */
- if(H5Dwrite(did, dtid, mid, sid, H5P_DEFAULT, ibuf) < 0)
+ if (H5Dwrite(did, dtid, mid, sid, H5P_DEFAULT, ibuf) < 0)
goto error;
} /* end if-else */
/* Closing */
- if(H5Sclose(sid) < 0) goto error;
- if(H5Sclose(mid) < 0) goto error;
+ if (H5Sclose(sid) < 0)
+ goto error;
+ if (H5Sclose(mid) < 0)
+ goto error;
} /* end if */
- if(H5Dflush(did) < 0)
+ if (H5Dflush(did) < 0)
goto error;
/* Closing */
- if(H5Tclose(dtid) < 0) goto error;
- if(H5Dclose(did) < 0) goto error;
- if(H5Pclose(fapl) < 0) goto error;
- if(H5Fclose(fid) < 0) goto error;
+ if (H5Tclose(dtid) < 0)
+ goto error;
+ if (H5Dclose(did) < 0)
+ goto error;
+ if (H5Pclose(fapl) < 0)
+ goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
- if(ibuf) HDfree(ibuf);
- if(cbuf) HDfree(cbuf);
+ if (ibuf)
+ HDfree(ibuf);
+ if (cbuf)
+ HDfree(cbuf);
return SUCCEED;
error:
H5E_BEGIN_TRY
- H5Sclose(sid);
- H5Sclose(mid);
- H5Tclose(dtid);
- H5Dclose(did);
- H5Pclose(fapl);
- H5Fclose(fid);
+ H5Sclose(sid);
+ H5Sclose(mid);
+ H5Tclose(dtid);
+ H5Dclose(did);
+ H5Pclose(fapl);
+ H5Fclose(fid);
H5E_END_TRY
- if(ibuf)
+ if (ibuf)
HDfree(ibuf);
- if(cbuf)
+ if (cbuf)
HDfree(cbuf);
return FAIL;
} /* end extend_dset_one() */
-
/*
***********************************************************************
*
@@ -383,32 +396,33 @@ main(int argc, const char *argv[])
{
char *dname = NULL;
char *fname = NULL;
- int action1, action2;
+ int action1, action2;
- if(argc != 5) {
+ if (argc != 5) {
HDfprintf(stderr, "Should have file name, dataset name, and the extended amount...\n");
goto error;
} /* end if */
/* Get the dataset name to be extended */
- fname = HDstrdup(argv[1]);
- dname = HDstrdup(argv[2]);
+ fname = HDstrdup(argv[1]);
+ dname = HDstrdup(argv[2]);
action1 = HDatoi(argv[3]);
action2 = HDatoi(argv[4]);
- if(!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) {
- if(extend_dset_one(fname, dname, action1) < 0)
+ if (!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) {
+ if (extend_dset_one(fname, dname, action1) < 0)
goto error;
- } else if(!HDstrcmp(dname, DSET_ONE) ||
- !HDstrcmp(dname, DSET_ALLOC_LATE) ||
- !HDstrcmp(dname, DSET_ALLOC_EARLY)) {
- if(extend_dset_one(fname, dname, action1) < 0)
+ }
+ else if (!HDstrcmp(dname, DSET_ONE) || !HDstrcmp(dname, DSET_ALLOC_LATE) ||
+ !HDstrcmp(dname, DSET_ALLOC_EARLY)) {
+ if (extend_dset_one(fname, dname, action1) < 0)
goto error;
- } else if(!HDstrcmp(dname, DSET_TWO) ||
- !HDstrcmp(dname, DSET_CMPD_TWO)) {
- if(extend_dset_two(fname, dname, action1, action2) < 0)
+ }
+ else if (!HDstrcmp(dname, DSET_TWO) || !HDstrcmp(dname, DSET_CMPD_TWO)) {
+ if (extend_dset_two(fname, dname, action1, action2) < 0)
goto error;
- } else {
+ }
+ else {
HDfprintf(stdout, "Dataset cannot be extended...\n");
goto error;
} /* end if-else */
@@ -416,9 +430,9 @@ main(int argc, const char *argv[])
HDexit(EXIT_SUCCESS);
error:
- if(dname)
+ if (dname)
HDfree(dname);
- if(fname)
+ if (fname)
HDfree(fname);
HDexit(EXIT_FAILURE);
} /* end main() */
diff --git a/hl/tools/h5watch/h5watch.c b/hl/tools/h5watch/h5watch.c
index 56f9b63..0190545 100644
--- a/hl/tools/h5watch/h5watch.c
+++ b/hl/tools/h5watch/h5watch.c
@@ -18,10 +18,9 @@
/*
* Note: This tool used private routine
*/
-#define PROGRAMNAME "h5watch" /* Name of tool */
-#define FIELD_SEP "," /* nested field separator */
-#define DEFAULT_RETRY 50 /* number of times to try opening the file */
-
+#define PROGRAMNAME "h5watch" /* Name of tool */
+#define FIELD_SEP "," /* nested field separator */
+#define DEFAULT_RETRY 50 /* number of times to try opening the file */
/*
* Note:(see comments in hl/src/H5LDprivate.h)
@@ -29,80 +28,57 @@
* This tool uses H5LD_memb_t data structure declared in H5LDprivate.h
*/
-const char *progname = "h5watch"; /* tool name */
-static char *g_list_of_fields = NULL; /* command line input for "list_of_fields" */
-static char *g_dup_fields = NULL; /* copy of "list_of_fields" */
-static H5LD_memb_t **g_listv = NULL; /* vector info for "list_of_fields" */
+const char * progname = "h5watch"; /* tool name */
+static char * g_list_of_fields = NULL; /* command line input for "list_of_fields" */
+static char * g_dup_fields = NULL; /* copy of "list_of_fields" */
+static H5LD_memb_t **g_listv = NULL; /* vector info for "list_of_fields" */
-static hbool_t g_monitor_size_only = FALSE; /* monitor changes in dataset dimension sizes */
-static unsigned g_polling_interval = 1; /* polling interval to check appended data */
+static hbool_t g_monitor_size_only = FALSE; /* monitor changes in dataset dimension sizes */
+static unsigned g_polling_interval = 1; /* polling interval to check appended data */
-static hbool_t g_label = FALSE; /* label compound values */
-static int g_display_width = 80; /* output width in characters */
-static hbool_t g_simple_output = FALSE; /* make output more machine-readable */
-static unsigned g_retry = DEFAULT_RETRY; /* # of times to try opening the file if somehow file is unstable */
-static hbool_t g_display_hex = FALSE; /* display data in hexadecimal format : LATER */
-static hbool_t g_user_interrupt = FALSE; /* Flag to indicate that user interrupted execution */
+static hbool_t g_label = FALSE; /* label compound values */
+static int g_display_width = 80; /* output width in characters */
+static hbool_t g_simple_output = FALSE; /* make output more machine-readable */
+static unsigned g_retry = DEFAULT_RETRY; /* # of times to try opening the file if somehow file is unstable */
+static hbool_t g_display_hex = FALSE; /* display data in hexadecimal format : LATER */
+static hbool_t g_user_interrupt = FALSE; /* Flag to indicate that user interrupted execution */
static herr_t doprint(hid_t did, hsize_t *start, hsize_t *block, int rank);
-static herr_t slicendump(hid_t did, hsize_t *prev_dims, hsize_t *cur_dims,
- hsize_t *start, hsize_t *block, int rank, int subrank);
+static herr_t slicendump(hid_t did, hsize_t *prev_dims, hsize_t *cur_dims, hsize_t *start, hsize_t *block,
+ int rank, int subrank);
static herr_t monitor_dataset(hid_t fid, char *dsetname);
static herr_t process_cmpd_fields(hid_t fid, char *dsetname);
static herr_t check_dataset(hid_t fid, char *dsetname);
-static void leave(int ret);
-static void usage(const char *prog);
-static void parse_command_line(int argc, const char *argv[]);
-
+static void leave(int ret);
+static void usage(const char *prog);
+static void parse_command_line(int argc, const char *argv[]);
/*
* Command-line options: The user can only specify long-named parameters.
* The long-named ones can be partially spelled. When
* adding more, make sure that they don't clash with each other.
*/
-static const char *s_opts ="?";
-static struct long_options l_opts[] = {
- { "help", no_arg, 'h' },
- { "hel", no_arg, 'h' },
- { "dim", no_arg, 'd' },
- { "di", no_arg, 'd' },
- { "label", no_arg, 'l' },
- { "labe", no_arg, 'l' },
- { "lab", no_arg, 'l' },
- { "la", no_arg, 'l' },
- { "simple", no_arg, 'S' },
- { "simpl", no_arg, 'S' },
- { "simp", no_arg, 'S' },
- { "sim", no_arg, 'S' },
- { "si", no_arg, 'S' },
- { "hexdump", no_arg, 'x' },
- { "hexdum", no_arg, 'x' },
- { "hexdu", no_arg, 'x' },
- { "hexd", no_arg, 'x' },
- { "hex", no_arg, 'x' },
- { "width", require_arg, 'w' },
- { "widt", require_arg, 'w' },
- { "wid", require_arg, 'w' },
- { "wi", require_arg, 'w' },
- { "polling", require_arg, 'p' },
- { "pollin", require_arg, 'p' },
- { "polli", require_arg, 'p' },
- { "poll", require_arg, 'p' },
- { "pol", require_arg, 'p' },
- { "po", require_arg, 'p' },
- { "fields", require_arg, 'f' },
- { "field", require_arg, 'f' },
- { "fiel", require_arg, 'f' },
- { "fie", require_arg, 'f' },
- { "fi", require_arg, 'f' },
- { "version", no_arg, 'V' },
- { "versio", no_arg, 'V' },
- { "versi", no_arg, 'V' },
- { "vers", no_arg, 'V' },
- { "ver", no_arg, 'V' },
- { "ve", no_arg, 'V' },
- { NULL, 0, '\0' }
-};
+static const char * s_opts = "?";
+static struct long_options l_opts[] = {{"help", no_arg, 'h'}, {"hel", no_arg, 'h'},
+ {"dim", no_arg, 'd'}, {"di", no_arg, 'd'},
+ {"label", no_arg, 'l'}, {"labe", no_arg, 'l'},
+ {"lab", no_arg, 'l'}, {"la", no_arg, 'l'},
+ {"simple", no_arg, 'S'}, {"simpl", no_arg, 'S'},
+ {"simp", no_arg, 'S'}, {"sim", no_arg, 'S'},
+ {"si", no_arg, 'S'}, {"hexdump", no_arg, 'x'},
+ {"hexdum", no_arg, 'x'}, {"hexdu", no_arg, 'x'},
+ {"hexd", no_arg, 'x'}, {"hex", no_arg, 'x'},
+ {"width", require_arg, 'w'}, {"widt", require_arg, 'w'},
+ {"wid", require_arg, 'w'}, {"wi", require_arg, 'w'},
+ {"polling", require_arg, 'p'}, {"pollin", require_arg, 'p'},
+ {"polli", require_arg, 'p'}, {"poll", require_arg, 'p'},
+ {"pol", require_arg, 'p'}, {"po", require_arg, 'p'},
+ {"fields", require_arg, 'f'}, {"field", require_arg, 'f'},
+ {"fiel", require_arg, 'f'}, {"fie", require_arg, 'f'},
+ {"fi", require_arg, 'f'}, {"version", no_arg, 'V'},
+ {"versio", no_arg, 'V'}, {"versi", no_arg, 'V'},
+ {"vers", no_arg, 'V'}, {"ver", no_arg, 'V'},
+ {"ve", no_arg, 'V'}, {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: doprint()
@@ -121,29 +97,29 @@ static struct long_options l_opts[] = {
static herr_t
doprint(hid_t did, hsize_t *start, hsize_t *block, int rank)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t info; /* Format info for the tools library */
- static char fmt_double[16], fmt_float[16]; /* Format info */
- struct subset_t subset; /* Subsetting info */
- hsize_t ss_start[H5S_MAX_RANK]; /* Info for hyperslab */
- hsize_t ss_stride[H5S_MAX_RANK]; /* Info for hyperslab */
- hsize_t ss_block[H5S_MAX_RANK]; /* Info for hyperslab */
- hsize_t ss_count[H5S_MAX_RANK]; /* Info for hyperslab */
- int i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t info; /* Format info for the tools library */
+ static char fmt_double[16], fmt_float[16]; /* Format info */
+ struct subset_t subset; /* Subsetting info */
+ hsize_t ss_start[H5S_MAX_RANK]; /* Info for hyperslab */
+ hsize_t ss_stride[H5S_MAX_RANK]; /* Info for hyperslab */
+ hsize_t ss_block[H5S_MAX_RANK]; /* Info for hyperslab */
+ hsize_t ss_count[H5S_MAX_RANK]; /* Info for hyperslab */
+ int i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Subsetting information for the tools library printing routines */
- subset.start.data = ss_start;
+ subset.start.data = ss_start;
subset.stride.data = ss_stride;
- subset.block.data = ss_block;
- subset.count.data = ss_count;
+ subset.block.data = ss_block;
+ subset.count.data = ss_count;
/* Initialize subsetting information */
- for(i = 0; i < rank; i++) {
+ for (i = 0; i < rank; i++) {
subset.stride.data[i] = 1;
- subset.count.data[i] = 1;
- subset.start.data[i] = start[i];
- subset.block.data[i] = block[i];
+ subset.count.data[i] = 1;
+ subset.start.data[i] = start[i];
+ subset.block.data[i] = block[i];
} /* end for */
HDmemset(&ctx, 0, sizeof(ctx));
@@ -152,13 +128,13 @@ doprint(hid_t did, hsize_t *start, hsize_t *block, int rank)
/* Set to all default values and then override */
HDmemset(&info, 0, sizeof info);
- if(g_simple_output) {
- info.idx_fmt = "";
- info.line_ncols = 65535; /*something big*/
- info.line_per_line = 1;
+ if (g_simple_output) {
+ info.idx_fmt = "";
+ info.line_ncols = 65535; /*something big*/
+ info.line_per_line = 1;
info.line_multi_new = 0;
- info.line_pre = " ";
- info.line_cont = " ";
+ info.line_pre = " ";
+ info.line_cont = " ";
info.arr_pre = "";
info.arr_suf = "";
@@ -169,18 +145,18 @@ doprint(hid_t did, hsize_t *start, hsize_t *block, int rank)
info.cmpd_sep = " ";
/* The "fields" selected by the user */
- info.cmpd_listv = (const struct H5LD_memb_t * const *)g_listv;
+ info.cmpd_listv = (const struct H5LD_memb_t *const *)g_listv;
- if(g_label)
+ if (g_label)
info.cmpd_name = "%s=";
- info.elmt_suf1 = " ";
+ info.elmt_suf1 = " ";
info.str_locale = ESCAPE_HTML;
-
- } else {
+ }
+ else {
info.idx_fmt = "(%s)";
- if(!g_display_width) {
- info.line_ncols = 65535;
+ if (!g_display_width) {
+ info.line_ncols = 65535;
info.line_per_line = 1;
} /* end if */
else
@@ -189,11 +165,11 @@ doprint(hid_t did, hsize_t *start, hsize_t *block, int rank)
info.line_multi_new = 1;
/* The "fields" selected by the user */
- info.cmpd_listv = (const struct H5LD_memb_t * const *)g_listv;
- if(g_label)
+ info.cmpd_listv = (const struct H5LD_memb_t *const *)g_listv;
+ if (g_label)
info.cmpd_name = "%s=";
- info.line_pre = " %s ";
- info.line_cont = " %s ";
+ info.line_pre = " %s ";
+ info.line_cont = " %s ";
info.str_repeat = 8;
} /* end else */
@@ -203,25 +179,25 @@ doprint(hid_t did, hsize_t *start, hsize_t *block, int rank)
sprintf(fmt_double, "%%1.%dg", DBL_DIG);
info.fmt_double = fmt_double;
- info.dset_format = "DSET-%s ";
+ info.dset_format = "DSET-%s ";
info.dset_hidefileno = 0;
- info.obj_format = "-%lu:%" PRIuHADDR;
+ info.obj_format = "-%lu:%" PRIuHADDR;
info.obj_hidefileno = 0;
info.dset_blockformat_pre = "%sBlk%lu: ";
- info.dset_ptformat_pre = "%sPt%lu: ";
+ info.dset_ptformat_pre = "%sPt%lu: ";
info.line_indent = "";
- if(g_display_hex) {
+ if (g_display_hex) {
/* Print all data in hexadecimal format if the `-x' or `--hexdump'
* command line switch was given. */
info.raw = TRUE;
} /* end if */
/* Print the values. */
- if((ret_value = h5tools_dump_dset(stdout, &info, &ctx, did)) < 0)
+ if ((ret_value = h5tools_dump_dset(stdout, &info, &ctx, did)) < 0)
error_msg("unable to print data\n");
HDfprintf(stdout, "\n");
@@ -251,25 +227,26 @@ doprint(hid_t did, hsize_t *start, hsize_t *block, int rank)
*-------------------------------------------------------------------------
*/
static herr_t
-slicendump(hid_t did, hsize_t *prev_dims, hsize_t *cur_dims, hsize_t *start, hsize_t *block, int rank, int subrank)
+slicendump(hid_t did, hsize_t *prev_dims, hsize_t *cur_dims, hsize_t *start, hsize_t *block, int rank,
+ int subrank)
{
- int i; /* Local index variable */
- int ind; /* Index for the current rank */
+ int i; /* Local index variable */
+ int ind; /* Index for the current rank */
herr_t ret_value = SUCCEED; /* Return value */
ind = rank - subrank;
- if((subrank - 1) > 0) {
+ if ((subrank - 1) > 0) {
/* continue onto the next dimension */
- for (i = 0; i < (hssize_t)MIN(prev_dims[ind], cur_dims[ind]); i++){
+ for (i = 0; i < (hssize_t)MIN(prev_dims[ind], cur_dims[ind]); i++) {
start[ind] = (hsize_t)i;
- if((ret_value = slicendump(did, prev_dims, cur_dims, start, block, rank, subrank-1)) < 0)
+ if ((ret_value = slicendump(did, prev_dims, cur_dims, start, block, rank, subrank - 1)) < 0)
goto done;
} /* end for */
- } /* end if */
+ } /* end if */
/* this dimension remains the same or shrinking */
- if(cur_dims[ind] <= prev_dims[ind])
+ if (cur_dims[ind] <= prev_dims[ind])
goto done;
/* select first the slice for the faster changing dimension */
@@ -277,7 +254,7 @@ slicendump(hid_t did, hsize_t *prev_dims, hsize_t *cur_dims, hsize_t *start, hsi
start[ind] = prev_dims[ind];
block[ind] = cur_dims[ind] - prev_dims[ind];
- for(i = ind + 1; i < rank; i++){
+ for (i = ind + 1; i < rank; i++) {
start[i] = 0;
block[i] = cur_dims[i];
} /* end for */
@@ -289,7 +266,6 @@ done:
return ret_value;
} /* end slicendump() */
-
/*-------------------------------------------------------------------------
* Function: monitor_dataset
*
@@ -309,30 +285,30 @@ done:
static herr_t
monitor_dataset(hid_t fid, char *dsetname)
{
- hid_t did; /* dataset id */
- hid_t sid; /* dataspace id */
- int ndims; /* # of dimensions in the dataspace */
- int i, u; /* local index variable */
- hsize_t prev_dims[H5S_MAX_RANK]; /* current dataspace dimensions */
- hsize_t cur_dims[H5S_MAX_RANK]; /* previous dataspace dimensions */
- herr_t ret_value = SUCCEED; /* return value */
+ hid_t did; /* dataset id */
+ hid_t sid; /* dataspace id */
+ int ndims; /* # of dimensions in the dataspace */
+ int i, u; /* local index variable */
+ hsize_t prev_dims[H5S_MAX_RANK]; /* current dataspace dimensions */
+ hsize_t cur_dims[H5S_MAX_RANK]; /* previous dataspace dimensions */
+ herr_t ret_value = SUCCEED; /* return value */
HDfprintf(stdout, "Monitoring dataset %s...\n", dsetname);
/* Open the dataset for minitoring */
- if((did = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0) {
+ if ((did = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0) {
error_msg("error in opening dataset \"%s\"\n", dsetname);
ret_value = FAIL;
goto done;
}
- if((sid = H5Dget_space(did)) < 0) {
+ if ((sid = H5Dget_space(did)) < 0) {
error_msg("error in getting dataspace id for dataset \"%s\"\n", dsetname);
ret_value = FAIL;
goto done;
}
/* Get the dataset's dimension sizes */
- if((ndims = H5Sget_simple_extent_dims(sid, prev_dims, NULL)) < 0) {
+ if ((ndims = H5Sget_simple_extent_dims(sid, prev_dims, NULL)) < 0) {
error_msg("unable to get dimensions sizes for \"%s\"\n", dsetname);
ret_value = FAIL;
goto done;
@@ -340,58 +316,60 @@ monitor_dataset(hid_t fid, char *dsetname)
HDfflush(stdout);
/* Loop until an error occurs or the user interrupts execution */
- while(!g_user_interrupt) {
+ while (!g_user_interrupt) {
/* Refreshes the dataset */
- if(H5Drefresh(did) < 0) {
+ if (H5Drefresh(did) < 0) {
ret_value = FAIL;
goto done;
}
/* Get the dataset's current dimension sizes */
- if(H5LDget_dset_dims(did, cur_dims) < 0) {
+ if (H5LDget_dset_dims(did, cur_dims) < 0) {
error_msg("unable to get dimension sizes for \"%s\"\n", dsetname);
ret_value = FAIL;
goto done;
}
/* Check the dimension sizes */
- for(i = 0; i < ndims; i++)
- if(cur_dims[i] != prev_dims[i])
+ for (i = 0; i < ndims; i++)
+ if (cur_dims[i] != prev_dims[i])
break;
/* at least one dimension has changed */
- if(i != ndims) {
+ if (i != ndims) {
/* Printing changes in dimension sizes */
- for(u = 0; u < ndims; u++) {
- HDfprintf(stdout, "dimension %d: %" PRIuHSIZE "->%" PRIuHSIZE "", u, prev_dims[u], cur_dims[u]);
- if(cur_dims[u] > prev_dims[u])
+ for (u = 0; u < ndims; u++) {
+ HDfprintf(stdout, "dimension %d: %" PRIuHSIZE "->%" PRIuHSIZE "", u, prev_dims[u],
+ cur_dims[u]);
+ if (cur_dims[u] > prev_dims[u])
HDfprintf(stdout, " (increases)\n");
- else if(cur_dims[u] < prev_dims[u])
+ else if (cur_dims[u] < prev_dims[u])
HDfprintf(stdout, " (decreases)\n");
else
HDfprintf(stdout, " (unchanged)\n");
}
/* Printing elements appended to the dataset if there is */
- if(!g_monitor_size_only) {
+ if (!g_monitor_size_only) {
/* See if at least one dimension size has increased */
- for(u = 0; u < ndims; u++) {
- int j;
+ for (u = 0; u < ndims; u++) {
+ int j;
hsize_t start[H5S_MAX_RANK];
hsize_t block[H5S_MAX_RANK];
/* Print the new appended data to the dataset */
- if(cur_dims[u] > prev_dims[u]) {
+ if (cur_dims[u] > prev_dims[u]) {
HDfprintf(stdout, " Data:\n");
- for(j = 0; j < ndims; j++) {
+ for (j = 0; j < ndims; j++) {
start[j] = 0;
block[j] = 1;
}
- if((ret_value = slicendump(did, prev_dims, cur_dims, start, block, ndims, ndims)) < 0)
+ if ((ret_value = slicendump(did, prev_dims, cur_dims, start, block, ndims, ndims)) <
+ 0)
goto done;
break;
}
@@ -412,10 +390,10 @@ monitor_dataset(hid_t fid, char *dsetname)
done:
/* Closing */
H5E_BEGIN_TRY
- H5Dclose(did);
+ H5Dclose(did);
H5E_END_TRY
- return(ret_value);
+ return (ret_value);
} /* monitor_dataset() */
/*-------------------------------------------------------------------------
@@ -433,53 +411,53 @@ done:
static herr_t
process_cmpd_fields(hid_t fid, char *dsetname)
{
- hid_t did=-1; /* dataset id */
- hid_t dtid=-1, tid=-1; /* dataset's data type id */
+ hid_t did = -1; /* dataset id */
+ hid_t dtid = -1, tid = -1; /* dataset's data type id */
size_t len; /* number of comma-separated fields in "g_list_of_fields" */
herr_t ret_value = SUCCEED; /* Return value */
HDassert(g_list_of_fields && *g_list_of_fields);
/* Open the dataset */
- if((did = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0) {
+ if ((did = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0) {
error_msg("error in opening dataset \"%s\"\n", dsetname);
ret_value = FAIL;
goto done;
}
/* Get the dataset's datatype */
- if(((dtid = H5Dget_type(did)) < 0) || (tid = H5Tget_native_type(dtid, H5T_DIR_DEFAULT)) < 0) {
+ if (((dtid = H5Dget_type(did)) < 0) || (tid = H5Tget_native_type(dtid, H5T_DIR_DEFAULT)) < 0) {
error_msg("error in getting dataset's datatype\n");
ret_value = FAIL;
goto done;
}
/* Check to make sure that the dataset's datatype is compound type */
- if(H5Tget_class(dtid) != H5T_COMPOUND) {
+ if (H5Tget_class(dtid) != H5T_COMPOUND) {
error_msg("dataset should be compound type for <list_of_fields>\n");
ret_value = FAIL;
goto done;
}
/* Make a copy of "g_list_of_fields" */
- if((g_dup_fields = HDstrdup(g_list_of_fields)) == NULL) {
+ if ((g_dup_fields = HDstrdup(g_list_of_fields)) == NULL) {
error_msg("error in duplicating g_list_of_fields\n");
ret_value = FAIL;
goto done;
}
/* Estimate the number of comma-separated fields in "g_list of_fields" */
- len = HDstrlen(g_list_of_fields)/2 + 2;
+ len = HDstrlen(g_list_of_fields) / 2 + 2;
/* Allocate memory for a list vector of H5LD_memb_t structures to store "g_list_of_fields" info */
- if((g_listv = (H5LD_memb_t **)HDcalloc(len, sizeof(H5LD_memb_t *))) == NULL) {
+ if ((g_listv = (H5LD_memb_t **)HDcalloc(len, sizeof(H5LD_memb_t *))) == NULL) {
error_msg("error in allocating memory for H5LD_memb_t\n");
ret_value = FAIL;
goto done;
}
/* Process and store info for "g_listv" */
- if(H5LD_construct_vector(g_dup_fields, g_listv, tid) < 0) {
+ if (H5LD_construct_vector(g_dup_fields, g_listv, tid) < 0) {
error_msg("error in processing <list_of_fields>\n");
ret_value = FAIL;
goto done;
@@ -489,14 +467,13 @@ process_cmpd_fields(hid_t fid, char *dsetname)
done:
/* Closing */
H5E_BEGIN_TRY
- H5Tclose(dtid);
- H5Tclose(tid);
- H5Dclose(did);
+ H5Tclose(dtid);
+ H5Tclose(tid);
+ H5Dclose(did);
H5E_END_TRY
- return(ret_value);
+ return (ret_value);
} /* process_cmpd_fields() */
-
/*-------------------------------------------------------------------------
* Function: check_dataset
*
@@ -513,44 +490,44 @@ done:
static herr_t
check_dataset(hid_t fid, char *dsetname)
{
- hid_t did=-1; /* Dataset id */
- hid_t dcp=-1; /* Dataset creation property */
- hid_t sid=-1; /* Dataset's dataspace id */
- int ndims; /* # of dimensions in the dataspace */
- unsigned u; /* Local index variable */
- hsize_t cur_dims[H5S_MAX_RANK]; /* size of dataspace dimensions */
- hsize_t max_dims[H5S_MAX_RANK]; /* maximum size of dataspace dimensions */
- hbool_t unlim_max_dims = FALSE; /* whether dataset has unlimited or max. dimension setting */
- void *edata;
- H5E_auto2_t func;
- H5D_layout_t layout;
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t did = -1; /* Dataset id */
+ hid_t dcp = -1; /* Dataset creation property */
+ hid_t sid = -1; /* Dataset's dataspace id */
+ int ndims; /* # of dimensions in the dataspace */
+ unsigned u; /* Local index variable */
+ hsize_t cur_dims[H5S_MAX_RANK]; /* size of dataspace dimensions */
+ hsize_t max_dims[H5S_MAX_RANK]; /* maximum size of dataspace dimensions */
+ hbool_t unlim_max_dims = FALSE; /* whether dataset has unlimited or max. dimension setting */
+ void * edata;
+ H5E_auto2_t func;
+ H5D_layout_t layout;
+ herr_t ret_value = SUCCEED; /* Return value */
/* Disable error reporting */
H5Eget_auto2(H5E_DEFAULT, &func, &edata);
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
/* Open the dataset */
- if((did = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0) {
+ if ((did = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0) {
error_msg("unable to open dataset \"%s\"\n", dsetname);
ret_value = FAIL;
goto done;
}
/* Get dataset's creation property list */
- if((dcp = H5Dget_create_plist(did)) < 0) {
+ if ((dcp = H5Dget_create_plist(did)) < 0) {
error_msg("unable to get dataset's creation property list \"%s\"\n", dsetname);
ret_value = FAIL;
goto done;
}
/* Query dataset's layout; the layout should be chunked or virtual */
- if((layout = H5Pget_layout(dcp)) < 0) {
+ if ((layout = H5Pget_layout(dcp)) < 0) {
error_msg("unable to get dataset layout \"%s\"\n", dsetname);
ret_value = FAIL;
goto done;
}
- if(layout != H5D_CHUNKED && layout != H5D_VIRTUAL) {
+ if (layout != H5D_CHUNKED && layout != H5D_VIRTUAL) {
error_msg("\"%s\" should be a chunked or virtual dataset\n", dsetname);
ret_value = FAIL;
goto done;
@@ -560,27 +537,27 @@ check_dataset(hid_t fid, char *dsetname)
HDmemset(max_dims, 0, sizeof max_dims);
/* Get dataset's dataspace */
- if((sid = H5Dget_space(did)) < 0) {
+ if ((sid = H5Dget_space(did)) < 0) {
error_msg("can't get dataset's dataspace\"%s\"\n", dsetname);
ret_value = FAIL;
goto done;
}
/* Get dimension size of dataset's dataspace */
- if((ndims = H5Sget_simple_extent_dims(sid, cur_dims, max_dims)) < 0) {
+ if ((ndims = H5Sget_simple_extent_dims(sid, cur_dims, max_dims)) < 0) {
error_msg("can't get dataspace dimensions for dataset \"%s\"\n", dsetname);
ret_value = FAIL;
goto done;
}
/* Check whether dataset has unlimited dimension or max. dimension setting */
- for(u = 0; u < (unsigned)ndims; u++)
- if(max_dims[u] == H5S_UNLIMITED || cur_dims[u] != max_dims[u]) {
- unlim_max_dims = TRUE;
- break;
- }
+ for (u = 0; u < (unsigned)ndims; u++)
+ if (max_dims[u] == H5S_UNLIMITED || cur_dims[u] != max_dims[u]) {
+ unlim_max_dims = TRUE;
+ break;
+ }
- if(!unlim_max_dims) {
+ if (!unlim_max_dims) {
error_msg("\"%s\" should have unlimited or max. dimension setting\n", dsetname);
ret_value = FAIL;
}
@@ -590,15 +567,14 @@ done:
/* Closing */
H5E_BEGIN_TRY
- H5Sclose(sid);
- H5Pclose(dcp);
- H5Dclose(did);
+ H5Sclose(sid);
+ H5Pclose(dcp);
+ H5Dclose(did);
H5E_END_TRY
- return(ret_value);
+ return (ret_value);
} /* check_dataset() */
-
/*-------------------------------------------------------------------------
* Function: leave
*
@@ -619,7 +595,6 @@ leave(int ret)
exit(ret);
}
-
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -647,10 +622,12 @@ usage(const char *prog)
HDfprintf(stdout, " A value of 0 sets the number of columns to the\n");
HDfprintf(stdout, " maximum (65535). The default width is 80 columns.\n");
HDfprintf(stdout, " --polling=N Set the polling interval to N (in seconds) when the\n");
- HDfprintf(stdout, " dataset will be checked for appended data. The default\n");
+ HDfprintf(stdout,
+ " dataset will be checked for appended data. The default\n");
HDfprintf(stdout, " polling interval is 1.\n");
HDfprintf(stdout, " --fields=<list_of_fields>\n");
- HDfprintf(stdout, " Display data for the fields specified in <list_of_fields>\n");
+ HDfprintf(stdout,
+ " Display data for the fields specified in <list_of_fields>\n");
HDfprintf(stdout, " for a compound data type. <list_of_fields> can be\n");
HDfprintf(stdout, " specified as follows:\n");
HDfprintf(stdout, " 1) A comma-separated list of field names in a\n");
@@ -660,7 +637,8 @@ usage(const char *prog)
HDfprintf(stdout, " 2) A single field name in a compound data type.\n");
HDfprintf(stdout, " Can use this option multiple times.\n");
HDfprintf(stdout, " Note that backslash is the escape character to avoid\n");
- HDfprintf(stdout, " characters in field names that conflict with the tool's\n");
+ HDfprintf(stdout,
+ " characters in field names that conflict with the tool's\n");
HDfprintf(stdout, " separators.\n");
HDfprintf(stdout, "\n");
HDfprintf(stdout, " OBJECT is specified as [<filename>/<path_to_dataset>/<dsetname>]\n");
@@ -669,11 +647,11 @@ usage(const char *prog)
HDfprintf(stdout, " <path_to_dataset> Path separated by slashes to the specified dataset\n");
HDfprintf(stdout, " <dsetname> Name of the dataset\n");
HDfprintf(stdout, "\n");
- HDfprintf(stdout, " User can end the h5watch process by ctrl-C (SIGINT) or kill the process (SIGTERM).\n");
+ HDfprintf(stdout,
+ " User can end the h5watch process by ctrl-C (SIGINT) or kill the process (SIGTERM).\n");
} /* usage() */
-
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@@ -689,10 +667,10 @@ usage(const char *prog)
static void
parse_command_line(int argc, const char *argv[])
{
- int opt; /* Command line option */
+ int opt; /* Command line option */
int tmp;
- /* no arguments */
+ /* no arguments */
if (argc == 1) {
usage(h5tools_getprogname());
leave(EXIT_FAILURE);
@@ -701,80 +679,77 @@ parse_command_line(int argc, const char *argv[])
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
- case '?':
- case 'h': /* --help */
- usage(h5tools_getprogname());
- leave(EXIT_SUCCESS);
- break;
-
- case 'V': /* --version */
- print_version(progname);
- leave(EXIT_SUCCESS);
- break;
-
- case 'w': /* --width=N */
- g_display_width = (int)HDstrtol(opt_arg, NULL, 0);
- if(g_display_width < 0) {
+ case '?':
+ case 'h': /* --help */
usage(h5tools_getprogname());
- leave(EXIT_FAILURE);
- }
- break;
+ leave(EXIT_SUCCESS);
+ break;
- case 'd': /* --dim */
- g_monitor_size_only = TRUE;
- break;
+ case 'V': /* --version */
+ print_version(progname);
+ leave(EXIT_SUCCESS);
+ break;
- case 'S': /* --simple */
- g_simple_output = TRUE;
- break;
+ case 'w': /* --width=N */
+ g_display_width = (int)HDstrtol(opt_arg, NULL, 0);
+ if (g_display_width < 0) {
+ usage(h5tools_getprogname());
+ leave(EXIT_FAILURE);
+ }
+ break;
- case 'l': /* --label */
- g_label = TRUE;
- break;
+ case 'd': /* --dim */
+ g_monitor_size_only = TRUE;
+ break;
- case 'p': /* --polling=N */
- /* g_polling_interval = HDstrtod(opt_arg, NULL); */
- if((tmp = (int)HDstrtol(opt_arg, NULL, 10)) <= 0) {
- usage(h5tools_getprogname());
- leave(EXIT_FAILURE);
- }
- g_polling_interval = (unsigned)tmp;
- break;
+ case 'S': /* --simple */
+ g_simple_output = TRUE;
+ break;
+
+ case 'l': /* --label */
+ g_label = TRUE;
+ break;
- case 'f': /* --fields=<list_of_fields> */
- if(g_list_of_fields == NULL) {
- if((g_list_of_fields = HDstrdup(opt_arg)) == NULL) {
- error_msg("memory allocation failed (file %s:line %d)\n",
- __FILE__, __LINE__);
+ case 'p': /* --polling=N */
+ /* g_polling_interval = HDstrtod(opt_arg, NULL); */
+ if ((tmp = (int)HDstrtol(opt_arg, NULL, 10)) <= 0) {
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
}
- } else {
- char *str;
+ g_polling_interval = (unsigned)tmp;
+ break;
- if((str = HDstrdup(opt_arg)) == NULL) {
- error_msg("memory allocation failed (file %s:line %d)\n",
- __FILE__, __LINE__);
- leave(EXIT_FAILURE);
+ case 'f': /* --fields=<list_of_fields> */
+ if (g_list_of_fields == NULL) {
+ if ((g_list_of_fields = HDstrdup(opt_arg)) == NULL) {
+ error_msg("memory allocation failed (file %s:line %d)\n", __FILE__, __LINE__);
+ leave(EXIT_FAILURE);
+ }
}
- if((g_list_of_fields = (char *)HDrealloc(g_list_of_fields, HDstrlen(g_list_of_fields) + HDstrlen(str) + 2)) == NULL) {
- error_msg("memory allocation failed (file %s:line %d)\n",
- __FILE__, __LINE__);
- leave(EXIT_FAILURE);
+ else {
+ char *str;
+ if ((str = HDstrdup(opt_arg)) == NULL) {
+ error_msg("memory allocation failed (file %s:line %d)\n", __FILE__, __LINE__);
+ leave(EXIT_FAILURE);
+ }
+ if ((g_list_of_fields = (char *)HDrealloc(
+ g_list_of_fields, HDstrlen(g_list_of_fields) + HDstrlen(str) + 2)) == NULL) {
+ error_msg("memory allocation failed (file %s:line %d)\n", __FILE__, __LINE__);
+ leave(EXIT_FAILURE);
+ }
+ HDstrcat(g_list_of_fields, FIELD_SEP);
+ HDstrcat(g_list_of_fields, str);
}
- HDstrcat(g_list_of_fields, FIELD_SEP);
- HDstrcat(g_list_of_fields, str);
- }
- break;
+ break;
- default:
- usage(h5tools_getprogname());
- leave(EXIT_FAILURE);
+ default:
+ usage(h5tools_getprogname());
+ leave(EXIT_FAILURE);
}
}
-
/* check for object to be processed */
if (argc <= opt_ind) {
error_msg("missing dataset name\n");
@@ -783,7 +758,6 @@ parse_command_line(int argc, const char *argv[])
}
} /* parse_command_line() */
-
/*-------------------------------------------------------------------------
* Function: catch_signal
*
@@ -796,13 +770,13 @@ parse_command_line(int argc, const char *argv[])
*
*-------------------------------------------------------------------------
*/
-static void catch_signal(int H5_ATTR_UNUSED signo)
+static void
+catch_signal(int H5_ATTR_UNUSED signo)
{
/* Set the flag to get out of the main loop */
g_user_interrupt = TRUE;
} /* catch_signal() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -818,12 +792,12 @@ static void catch_signal(int H5_ATTR_UNUSED signo)
int
main(int argc, const char *argv[])
{
- char drivername[50]; /* VFD name */
- char *fname = NULL; /* File name */
- char *dname = NULL; /* Dataset name */
- char *x; /* Temporary string pointer */
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list */
+ char drivername[50]; /* VFD name */
+ char *fname = NULL; /* File name */
+ char *dname = NULL; /* Dataset name */
+ char *x; /* Temporary string pointer */
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list */
/* Set up tool name and exit status */
h5tools_setprogname(PROGRAMNAME);
@@ -833,13 +807,13 @@ main(int argc, const char *argv[])
h5tools_init();
/* To exit from h5watch for SIGTERM signal */
- if(HDsignal(SIGTERM, catch_signal) == SIG_ERR) {
+ if (HDsignal(SIGTERM, catch_signal) == SIG_ERR) {
error_msg("An error occurred while setting a signal handler.\n");
leave(EXIT_FAILURE);
}
/* To exit from h5watch for SIGINT signal */
- if(HDsignal(SIGINT, catch_signal) == SIG_ERR) {
+ if (HDsignal(SIGINT, catch_signal) == SIG_ERR) {
error_msg("An error occurred while setting a signal handler.\n");
leave(EXIT_FAILURE);
}
@@ -847,7 +821,7 @@ main(int argc, const char *argv[])
/* parse command line options */
parse_command_line(argc, argv);
- if(argc <= opt_ind) {
+ if (argc <= opt_ind) {
error_msg("missing dataset name\n");
usage(h5tools_getprogname());
leave(EXIT_FAILURE);
@@ -871,60 +845,61 @@ main(int argc, const char *argv[])
* then there must have been something wrong with the file (perhaps it
* doesn't exist).
*/
- if((fname = HDstrdup(argv[opt_ind])) == NULL) {
+ if ((fname = HDstrdup(argv[opt_ind])) == NULL) {
error_msg("memory allocation failed (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
/* Create a copy of file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
do {
- while(fname && *fname) {
- fid = h5tools_fopen(fname, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl, FALSE, drivername, sizeof drivername);
+ while (fname && *fname) {
+ fid = h5tools_fopen(fname, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl, FALSE, drivername,
+ sizeof drivername);
- if(fid >= 0) {
+ if (fid >= 0) {
HDfprintf(stdout, "Opened \"%s\" with %s driver.\n", fname, drivername);
break; /*success*/
- } /* end if */
+ } /* end if */
/* Shorten the file name; lengthen the object name */
- x = dname;
+ x = dname;
dname = HDstrrchr(fname, '/');
- if(x)
+ if (x)
*x = '/';
- if(!dname)
+ if (!dname)
break;
*dname = '\0';
} /* end while */
- /* Try opening the file again if somehow unstable */
- } while(g_retry-- > 0 && fid == FAIL);
+ /* Try opening the file again if somehow unstable */
+ } while (g_retry-- > 0 && fid == FAIL);
- if(fid < 0) {
+ if (fid < 0) {
error_msg("unable to open file \"%s\"\n", fname);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- if(!dname) {
+ if (!dname) {
error_msg("no dataset specified\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
else {
*dname = '/';
- x = dname;
- if((dname = HDstrdup(dname)) == NULL) {
+ x = dname;
+ if ((dname = HDstrdup(dname)) == NULL) {
error_msg("memory allocation failed (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -932,13 +907,13 @@ main(int argc, const char *argv[])
else {
*x = '\0';
/* Validate dataset */
- if(check_dataset(fid, dname) < 0) {
+ if (check_dataset(fid, dname) < 0) {
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
/* Validate input "fields" */
- else if(g_list_of_fields && *g_list_of_fields) {
- if(process_cmpd_fields(fid, dname) < 0) {
+ else if (g_list_of_fields && *g_list_of_fields) {
+ if (process_cmpd_fields(fid, dname) < 0) {
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
@@ -947,33 +922,33 @@ main(int argc, const char *argv[])
}
/* If everything is fine, start monitoring the datset */
- if(h5tools_getstatus() != EXIT_FAILURE)
- if(monitor_dataset(fid, dname) < 0)
+ if (h5tools_getstatus() != EXIT_FAILURE)
+ if (monitor_dataset(fid, dname) < 0)
h5tools_setstatus(EXIT_FAILURE);
done:
/* Free spaces */
- if(fname)
+ if (fname)
HDfree(fname);
- if(dname)
+ if (dname)
HDfree(dname);
- if(g_list_of_fields)
+ if (g_list_of_fields)
HDfree(g_list_of_fields);
- if(g_listv) {
+ if (g_listv) {
H5LD_clean_vector(g_listv);
HDfree(g_listv);
}
- if(g_dup_fields)
+ if (g_dup_fields)
HDfree(g_dup_fields);
/* Close the file access property list */
- if(fapl >= 0 && H5Pclose(fapl) < 0) {
+ if (fapl >= 0 && H5Pclose(fapl) < 0) {
error_msg("unable to close file access property list\n");
h5tools_setstatus(EXIT_FAILURE);
}
/* Close the file */
- if(fid >= 0 && H5Fclose(fid) < 0) {
+ if (fid >= 0 && H5Fclose(fid) < 0) {
error_msg("unable to close file\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -981,4 +956,3 @@ done:
/* exit */
leave(h5tools_getstatus());
} /* main() */
-
diff --git a/hl/tools/h5watch/h5watchgentest.c b/hl/tools/h5watch/h5watchgentest.c
index 19c9876..255ad41 100644
--- a/hl/tools/h5watch/h5watchgentest.c
+++ b/hl/tools/h5watch/h5watchgentest.c
@@ -33,26 +33,26 @@
* DSET_NONE: fixed dimension setting, contiguous, H5D_ALLOC_TIME_LATE
* DSET_NOMAX: fixed dimension setting, chunked, H5D_ALLOC_TIME_INCR
*/
-#define ONE_DIMS0 10
-#define MAX_ONE_DIMS0 100
+#define ONE_DIMS0 10
+#define MAX_ONE_DIMS0 100
-#define DSET_ONE "DSET_ONE"
-#define DSET_NONE "DSET_NONE"
-#define DSET_NOMAX "DSET_NOMAX"
-#define DSET_ALLOC_LATE "DSET_ALLOC_LATE"
+#define DSET_ONE "DSET_ONE"
+#define DSET_NONE "DSET_NONE"
+#define DSET_NOMAX "DSET_NOMAX"
+#define DSET_ALLOC_LATE "DSET_ALLOC_LATE"
#define DSET_ALLOC_EARLY "DSET_ALLOC_EARLY"
-#define DSET_CMPD "DSET_CMPD"
-#define DSET_CMPD_ESC "DSET_CMPD_ESC"
+#define DSET_CMPD "DSET_CMPD"
+#define DSET_CMPD_ESC "DSET_CMPD_ESC"
-#define TWO_DIMS0 4
-#define TWO_DIMS1 10
-#define MAX_TWO_DIMS0 60
-#define MAX_TWO_DIMS1 100
+#define TWO_DIMS0 4
+#define TWO_DIMS1 10
+#define MAX_TWO_DIMS0 60
+#define MAX_TWO_DIMS1 100
-#define DSET_TWO "DSET_TWO"
-#define DSET_CMPD_TWO "DSET_CMPD_TWO"
+#define DSET_TWO "DSET_TWO"
+#define DSET_CMPD_TWO "DSET_CMPD_TWO"
-#define CHUNK_SIZE 2
+#define CHUNK_SIZE 2
#define FILE "WATCH.h5"
@@ -64,9 +64,9 @@ typedef struct sub22_t {
} sub22_t;
typedef struct sub2_t {
- int a;
+ int a;
sub22_t b;
- int c;
+ int c;
} sub2_t;
typedef struct sub4_t {
@@ -75,7 +75,7 @@ typedef struct sub4_t {
} sub4_t;
typedef struct set_t {
- int field1;
+ int field1;
sub2_t field2;
double field3;
sub4_t field4;
@@ -90,58 +90,63 @@ typedef struct set_t {
**************************************************************************************
*/
static herr_t
-generate_dset(hid_t fid, const char *dname, int ndims, hsize_t *dims, hsize_t *maxdims, hid_t dtid, void *data)
+generate_dset(hid_t fid, const char *dname, int ndims, hsize_t *dims, hsize_t *maxdims, hid_t dtid,
+ void *data)
{
- hid_t dcpl=-1; /* Dataset creation property */
- hid_t did=-1; /* Dataset id */
- hid_t sid=-1; /* Dataspace id */
- int i; /* Local index variable */
- hsize_t chunk_dims[H5S_MAX_RANK]; /* Dimension sizes for chunks */
+ hid_t dcpl = -1; /* Dataset creation property */
+ hid_t did = -1; /* Dataset id */
+ hid_t sid = -1; /* Dataspace id */
+ int i; /* Local index variable */
+ hsize_t chunk_dims[H5S_MAX_RANK]; /* Dimension sizes for chunks */
/* Create the dataspace */
- if((sid = H5Screate_simple(ndims, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(ndims, dims, maxdims)) < 0)
goto done;
/* Set up dataset's creation properties */
- if(!HDstrcmp(dname, DSET_NONE))
+ if (!HDstrcmp(dname, DSET_NONE))
dcpl = H5P_DEFAULT;
else {
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto done;
- for(i = 0; i < ndims; i++)
+ for (i = 0; i < ndims; i++)
chunk_dims[i] = CHUNK_SIZE;
- if(H5Pset_chunk(dcpl, ndims, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, ndims, chunk_dims) < 0)
goto done;
} /* end else */
- if(!HDstrcmp(dname, DSET_ALLOC_LATE)) {
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0)
+ if (!HDstrcmp(dname, DSET_ALLOC_LATE)) {
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0)
goto done;
- } else if(!HDstrcmp(dname, DSET_ALLOC_EARLY)) {
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ }
+ else if (!HDstrcmp(dname, DSET_ALLOC_EARLY)) {
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
goto done;
} /* end if-else */
/* Create the dataset */
- if((did = H5Dcreate2(fid, dname, dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, dname, dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto done;
/* Write to the dataset */
- if(H5Dwrite(did, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(did, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
goto done;
/* Closing */
- if(H5Pclose(dcpl) < 0) goto done;
- if(H5Sclose(sid) < 0) goto done;
- if(H5Dclose(did) < 0) goto done;
+ if (H5Pclose(dcpl) < 0)
+ goto done;
+ if (H5Sclose(sid) < 0)
+ goto done;
+ if (H5Dclose(did) < 0)
+ goto done;
return SUCCEED;
done:
H5E_BEGIN_TRY
- H5Sclose(sid);
- H5Pclose(dcpl);
- H5Dclose(did);
+ H5Sclose(sid);
+ H5Pclose(dcpl);
+ H5Dclose(did);
H5E_END_TRY
return FAIL;
@@ -150,49 +155,49 @@ done:
int
main(void)
{
- hid_t fid=-1; /* File id */
- hid_t fapl=-1; /* File access property list id */
- hsize_t cur_dims[1]; /* Dimension sizes */
- hsize_t max_dims[1]; /* Maximum dimension sizes */
- hsize_t cur2_dims[2]; /* Current dimension sizes */
- hsize_t max2_dims[2]; /* Maximum dimension sizes */
- hid_t set_tid=-1, esc_set_tid=-1; /* Compound type id */
- hid_t sub22_tid=-1; /* Compound type id */
- hid_t sub2_tid=-1, esc_sub2_tid=-1; /* Compound type id */
- hid_t sub4_tid=-1, esc_sub4_tid=-1; /* Compound type id */
- int one_data[ONE_DIMS0]; /* Buffer for data */
- int two_data[TWO_DIMS0*TWO_DIMS1]; /* Buffer for data */
- set_t one_cbuf[ONE_DIMS0]; /* Buffer for data with compound type */
- set_t two_cbuf[TWO_DIMS0*TWO_DIMS1]; /* Buffer for data with compound type */
- int i; /* Local index variable */
+ hid_t fid = -1; /* File id */
+ hid_t fapl = -1; /* File access property list id */
+ hsize_t cur_dims[1]; /* Dimension sizes */
+ hsize_t max_dims[1]; /* Maximum dimension sizes */
+ hsize_t cur2_dims[2]; /* Current dimension sizes */
+ hsize_t max2_dims[2]; /* Maximum dimension sizes */
+ hid_t set_tid = -1, esc_set_tid = -1; /* Compound type id */
+ hid_t sub22_tid = -1; /* Compound type id */
+ hid_t sub2_tid = -1, esc_sub2_tid = -1; /* Compound type id */
+ hid_t sub4_tid = -1, esc_sub4_tid = -1; /* Compound type id */
+ int one_data[ONE_DIMS0]; /* Buffer for data */
+ int two_data[TWO_DIMS0 * TWO_DIMS1]; /* Buffer for data */
+ set_t one_cbuf[ONE_DIMS0]; /* Buffer for data with compound type */
+ set_t two_cbuf[TWO_DIMS0 * TWO_DIMS1]; /* Buffer for data with compound type */
+ int i; /* Local index variable */
/* Create a copy of file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
HDexit(EXIT_FAILURE);
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
HDexit(EXIT_FAILURE);
/* Create a file with the latest format */
- if((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
HDexit(EXIT_FAILURE);
/* Initialization for one-dimensional dataset */
cur_dims[0] = ONE_DIMS0;
max_dims[0] = MAX_ONE_DIMS0;
- for(i = 0; i < ONE_DIMS0; i++)
+ for (i = 0; i < ONE_DIMS0; i++)
one_data[i] = i;
/* Generate DSET_ONE, DSET_NONE, DSET_NOMAX, DSET_ALLOC_LATE, DSET_EARLY */
- if(generate_dset(fid, DSET_ONE, 1, cur_dims, max_dims, H5T_NATIVE_INT, one_data) < 0)
+ if (generate_dset(fid, DSET_ONE, 1, cur_dims, max_dims, H5T_NATIVE_INT, one_data) < 0)
goto done;
- if(generate_dset(fid, DSET_NONE, 1, cur_dims, NULL, H5T_NATIVE_INT, one_data) < 0)
+ if (generate_dset(fid, DSET_NONE, 1, cur_dims, NULL, H5T_NATIVE_INT, one_data) < 0)
goto done;
- if(generate_dset(fid, DSET_NOMAX, 1, cur_dims, NULL, H5T_NATIVE_INT, one_data) < 0)
+ if (generate_dset(fid, DSET_NOMAX, 1, cur_dims, NULL, H5T_NATIVE_INT, one_data) < 0)
goto done;
- if(generate_dset(fid, DSET_ALLOC_LATE, 1, cur_dims, max_dims, H5T_NATIVE_INT, one_data) < 0)
+ if (generate_dset(fid, DSET_ALLOC_LATE, 1, cur_dims, max_dims, H5T_NATIVE_INT, one_data) < 0)
goto done;
- if(generate_dset(fid, DSET_ALLOC_EARLY, 1, cur_dims, max_dims, H5T_NATIVE_INT, one_data) < 0)
+ if (generate_dset(fid, DSET_ALLOC_EARLY, 1, cur_dims, max_dims, H5T_NATIVE_INT, one_data) < 0)
goto done;
/* Initialization for two-dimensional dataset */
@@ -201,98 +206,98 @@ main(void)
max2_dims[0] = MAX_TWO_DIMS0;
max2_dims[1] = MAX_TWO_DIMS1;
- for(i = 0; i < (TWO_DIMS0 * TWO_DIMS1); i++)
+ for (i = 0; i < (TWO_DIMS0 * TWO_DIMS1); i++)
two_data[i] = i;
/* Generate DSET_TWO */
- if(generate_dset(fid, DSET_TWO, 2, cur2_dims, max2_dims, H5T_NATIVE_INT, two_data) < 0)
+ if (generate_dset(fid, DSET_TWO, 2, cur2_dims, max2_dims, H5T_NATIVE_INT, two_data) < 0)
goto done;
/* Initialization for one-dimensional compound typed dataset */
cur_dims[0] = ONE_DIMS0;
max_dims[0] = MAX_ONE_DIMS0;
- for(i = 0; i < ONE_DIMS0; i++) {
- one_cbuf[i].field1 = 1;
- one_cbuf[i].field2.a = 2;
- one_cbuf[i].field2.c = 4;
+ for (i = 0; i < ONE_DIMS0; i++) {
+ one_cbuf[i].field1 = 1;
+ one_cbuf[i].field2.a = 2;
+ one_cbuf[i].field2.c = 4;
one_cbuf[i].field2.b.a = 20;
one_cbuf[i].field2.b.b = 40;
one_cbuf[i].field2.b.c = 80;
- one_cbuf[i].field3 = 3.0F;
- one_cbuf[i].field4.a = 4;
- one_cbuf[i].field4.b = 8;
+ one_cbuf[i].field3 = 3.0F;
+ one_cbuf[i].field4.a = 4;
+ one_cbuf[i].field4.b = 8;
} /* end for */
/* Create the compound type */
- if((sub22_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub22_t))) < 0)
+ if ((sub22_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub22_t))) < 0)
goto done;
- if(H5Tinsert(sub22_tid, "a", HOFFSET(sub22_t, a), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(sub22_tid, "a", HOFFSET(sub22_t, a), H5T_NATIVE_INT) < 0)
goto done;
- if(H5Tinsert(sub22_tid, "b", HOFFSET(sub22_t, b), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(sub22_tid, "b", HOFFSET(sub22_t, b), H5T_NATIVE_INT) < 0)
goto done;
- if(H5Tinsert(sub22_tid, "c", HOFFSET(sub22_t, c), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(sub22_tid, "c", HOFFSET(sub22_t, c), H5T_NATIVE_INT) < 0)
goto done;
- if((sub2_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub2_t))) < 0)
+ if ((sub2_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub2_t))) < 0)
goto done;
- if(H5Tinsert(sub2_tid, "a", HOFFSET(sub2_t, a), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(sub2_tid, "a", HOFFSET(sub2_t, a), H5T_NATIVE_INT) < 0)
goto done;
- if(H5Tinsert(sub2_tid, "b", HOFFSET(sub2_t, b), sub22_tid) < 0)
+ if (H5Tinsert(sub2_tid, "b", HOFFSET(sub2_t, b), sub22_tid) < 0)
goto done;
- if(H5Tinsert(sub2_tid, "c", HOFFSET(sub2_t, c), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(sub2_tid, "c", HOFFSET(sub2_t, c), H5T_NATIVE_INT) < 0)
goto done;
- if((sub4_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub4_t))) < 0)
+ if ((sub4_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub4_t))) < 0)
goto done;
- if(H5Tinsert(sub4_tid, "a", HOFFSET(sub4_t, a), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(sub4_tid, "a", HOFFSET(sub4_t, a), H5T_NATIVE_INT) < 0)
goto done;
- if(H5Tinsert(sub4_tid, "b", HOFFSET(sub4_t, b), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(sub4_tid, "b", HOFFSET(sub4_t, b), H5T_NATIVE_INT) < 0)
goto done;
- if((set_tid = H5Tcreate(H5T_COMPOUND, sizeof(set_t))) < 0)
+ if ((set_tid = H5Tcreate(H5T_COMPOUND, sizeof(set_t))) < 0)
goto done;
- if(H5Tinsert(set_tid, "field1", HOFFSET(set_t, field1), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(set_tid, "field1", HOFFSET(set_t, field1), H5T_NATIVE_INT) < 0)
goto done;
- if(H5Tinsert(set_tid, "field2", HOFFSET(set_t, field2), sub2_tid) < 0)
+ if (H5Tinsert(set_tid, "field2", HOFFSET(set_t, field2), sub2_tid) < 0)
goto done;
- if(H5Tinsert(set_tid, "field3", HOFFSET(set_t, field3), H5T_NATIVE_DOUBLE) < 0)
+ if (H5Tinsert(set_tid, "field3", HOFFSET(set_t, field3), H5T_NATIVE_DOUBLE) < 0)
goto done;
- if(H5Tinsert(set_tid, "field4", HOFFSET(set_t, field4), sub4_tid) < 0)
+ if (H5Tinsert(set_tid, "field4", HOFFSET(set_t, field4), sub4_tid) < 0)
goto done;
/* Create the compound type with escape/separator characters */
- if((esc_sub2_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub2_t))) < 0)
+ if ((esc_sub2_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub2_t))) < 0)
goto done;
- if(H5Tinsert(esc_sub2_tid, ".a", HOFFSET(sub2_t, a), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(esc_sub2_tid, ".a", HOFFSET(sub2_t, a), H5T_NATIVE_INT) < 0)
goto done;
- if(H5Tinsert(esc_sub2_tid, ",b", HOFFSET(sub2_t, b), sub22_tid) < 0)
+ if (H5Tinsert(esc_sub2_tid, ",b", HOFFSET(sub2_t, b), sub22_tid) < 0)
goto done;
- if(H5Tinsert(esc_sub2_tid, "\\K", HOFFSET(sub2_t, c), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(esc_sub2_tid, "\\K", HOFFSET(sub2_t, c), H5T_NATIVE_INT) < 0)
goto done;
- if((esc_sub4_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub4_t))) < 0)
+ if ((esc_sub4_tid = H5Tcreate(H5T_COMPOUND, sizeof(sub4_t))) < 0)
goto done;
- if(H5Tinsert(esc_sub4_tid, "a.", HOFFSET(sub4_t, a), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(esc_sub4_tid, "a.", HOFFSET(sub4_t, a), H5T_NATIVE_INT) < 0)
goto done;
- if(H5Tinsert(esc_sub4_tid, "b,", HOFFSET(sub4_t, b), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(esc_sub4_tid, "b,", HOFFSET(sub4_t, b), H5T_NATIVE_INT) < 0)
goto done;
- if((esc_set_tid = H5Tcreate(H5T_COMPOUND, sizeof(set_t))) < 0)
+ if ((esc_set_tid = H5Tcreate(H5T_COMPOUND, sizeof(set_t))) < 0)
goto done;
- if(H5Tinsert(esc_set_tid, "field,1", HOFFSET(set_t, field1), H5T_NATIVE_INT) < 0)
+ if (H5Tinsert(esc_set_tid, "field,1", HOFFSET(set_t, field1), H5T_NATIVE_INT) < 0)
goto done;
- if(H5Tinsert(esc_set_tid, "field2.", HOFFSET(set_t, field2), esc_sub2_tid) < 0)
+ if (H5Tinsert(esc_set_tid, "field2.", HOFFSET(set_t, field2), esc_sub2_tid) < 0)
goto done;
- if(H5Tinsert(esc_set_tid, "field\\3", HOFFSET(set_t, field3), H5T_NATIVE_DOUBLE) < 0)
+ if (H5Tinsert(esc_set_tid, "field\\3", HOFFSET(set_t, field3), H5T_NATIVE_DOUBLE) < 0)
goto done;
- if(H5Tinsert(esc_set_tid, "field4,", HOFFSET(set_t, field4), esc_sub4_tid) < 0)
+ if (H5Tinsert(esc_set_tid, "field4,", HOFFSET(set_t, field4), esc_sub4_tid) < 0)
goto done;
/* Generate DSET_CMPD, DSET_CMPD_ESC */
- if(generate_dset(fid, DSET_CMPD, 1, cur_dims, max_dims, set_tid, one_cbuf) < 0)
+ if (generate_dset(fid, DSET_CMPD, 1, cur_dims, max_dims, set_tid, one_cbuf) < 0)
goto done;
- if(generate_dset(fid, DSET_CMPD_ESC, 1, cur_dims, max_dims, esc_set_tid, one_cbuf) < 0)
+ if (generate_dset(fid, DSET_CMPD_ESC, 1, cur_dims, max_dims, esc_set_tid, one_cbuf) < 0)
goto done;
/* Initialization for two-dimensional compound typed dataset */
@@ -301,48 +306,56 @@ main(void)
max2_dims[0] = MAX_TWO_DIMS0;
max2_dims[0] = MAX_TWO_DIMS1;
- for(i = 0; i < (TWO_DIMS0 * TWO_DIMS1); i++) {
- two_cbuf[i].field1 = 1;
- two_cbuf[i].field2.a = 2;
- two_cbuf[i].field2.c = 4;
+ for (i = 0; i < (TWO_DIMS0 * TWO_DIMS1); i++) {
+ two_cbuf[i].field1 = 1;
+ two_cbuf[i].field2.a = 2;
+ two_cbuf[i].field2.c = 4;
two_cbuf[i].field2.b.a = 20;
two_cbuf[i].field2.b.b = 40;
two_cbuf[i].field2.b.c = 80;
- two_cbuf[i].field3 = 3.0F;
- two_cbuf[i].field4.a = 4;
- two_cbuf[i].field4.b = 8;
+ two_cbuf[i].field3 = 3.0F;
+ two_cbuf[i].field4.a = 4;
+ two_cbuf[i].field4.b = 8;
} /* end for */
/* Generate DSET_CMPD_TWO */
- if(generate_dset(fid, DSET_CMPD_TWO, 2, cur2_dims, max2_dims, set_tid, two_cbuf) < 0)
+ if (generate_dset(fid, DSET_CMPD_TWO, 2, cur2_dims, max2_dims, set_tid, two_cbuf) < 0)
goto done;
/* Closing */
- if(H5Tclose(sub22_tid) < 0) goto done;
- if(H5Tclose(sub2_tid) < 0) goto done;
- if(H5Tclose(sub4_tid) < 0) goto done;
- if(H5Tclose(set_tid) < 0) goto done;
- if(H5Tclose(esc_sub2_tid) < 0) goto done;
- if(H5Tclose(esc_sub4_tid) < 0) goto done;
- if(H5Tclose(esc_set_tid) < 0) goto done;
- if(H5Pclose(fapl) < 0) goto done;
- if(H5Fclose(fid) < 0) goto done;
+ if (H5Tclose(sub22_tid) < 0)
+ goto done;
+ if (H5Tclose(sub2_tid) < 0)
+ goto done;
+ if (H5Tclose(sub4_tid) < 0)
+ goto done;
+ if (H5Tclose(set_tid) < 0)
+ goto done;
+ if (H5Tclose(esc_sub2_tid) < 0)
+ goto done;
+ if (H5Tclose(esc_sub4_tid) < 0)
+ goto done;
+ if (H5Tclose(esc_set_tid) < 0)
+ goto done;
+ if (H5Pclose(fapl) < 0)
+ goto done;
+ if (H5Fclose(fid) < 0)
+ goto done;
HDexit(EXIT_SUCCESS);
done:
H5E_BEGIN_TRY
- H5Tclose(sub22_tid);
- H5Tclose(sub2_tid);
- H5Tclose(sub4_tid);
- H5Tclose(set_tid);
- H5Tclose(esc_sub2_tid);
- H5Tclose(esc_sub4_tid);
- H5Tclose(esc_set_tid);
- H5Pclose(fapl);
- H5Fclose(fid);
+ H5Tclose(sub22_tid);
+ H5Tclose(sub2_tid);
+ H5Tclose(sub4_tid);
+ H5Tclose(set_tid);
+ H5Tclose(esc_sub2_tid);
+ H5Tclose(esc_sub4_tid);
+ H5Tclose(esc_set_tid);
+ H5Pclose(fapl);
+ H5Fclose(fid);
H5E_END_TRY
HDexit(EXIT_FAILURE);
} /* end main() */
-
diff --git a/hl/tools/h5watch/swmr_check_compat_vfd.c b/hl/tools/h5watch/swmr_check_compat_vfd.c
index 608f4a8..fb1c903 100644
--- a/hl/tools/h5watch/swmr_check_compat_vfd.c
+++ b/hl/tools/h5watch/swmr_check_compat_vfd.c
@@ -22,11 +22,10 @@
#include "H5private.h"
/* This file needs to access the file driver testing code */
-#define H5FD_FRIEND /*suppress error about including H5FDpkg */
+#define H5FD_FRIEND /*suppress error about including H5FDpkg */
#define H5FD_TESTING
-#include "H5FDpkg.h" /* File drivers */
+#include "H5FDpkg.h" /* File drivers */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -48,10 +47,9 @@ main(void)
driver = HDgetenv("HDF5_DRIVER");
- if(H5FD__supports_swmr_test(driver))
+ if (H5FD__supports_swmr_test(driver))
return EXIT_SUCCESS;
else
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/java/src/jni/exceptionImp.c b/java/src/jni/exceptionImp.c
index c08b67b..c5e7d85 100644
--- a/java/src/jni/exceptionImp.c
+++ b/java/src/jni/exceptionImp.c
@@ -21,7 +21,6 @@
extern "C" {
#endif /* __cplusplus */
-
/***********/
/* Headers */
/***********/
@@ -33,9 +32,8 @@ extern "C" {
#include "h5jni.h"
#include "exceptionImp.h"
-extern H5E_auto2_t efunc;
-extern void *edata;
-
+extern H5E_auto2_t efunc;
+extern void * edata;
/*******************/
/* Local Variables */
@@ -47,13 +45,13 @@ extern void *edata;
* minor error numbers.
*/
typedef struct H5E_major_mesg_t {
- hid_t error_code;
- const char *str;
+ hid_t error_code;
+ const char *str;
} H5E_major_mesg_t;
typedef struct H5E_minor_mesg_t {
- hid_t error_code;
- const char *str;
+ hid_t error_code;
+ const char *str;
} H5E_minor_mesg_t;
/* major and minor error numbers */
@@ -66,42 +64,41 @@ typedef struct H5E_num_t {
/* Local Macros */
/********************/
-#define THROWEXCEPTION(className, args) \
-{ \
- jmethodID jm; \
- jclass jc; \
- jobject ex; \
- \
- if (NULL == (jc = ENVPTR->FindClass(ENVONLY, (className)))) \
- CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \
- \
- if (NULL == (jm = ENVPTR->GetMethodID(ENVONLY, jc, "<init>", "(Ljava/lang/String;)V"))) { \
- HDprintf("THROWEXCEPTION FATAL ERROR: GetMethodID failed\n"); \
- CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \
- } \
- \
- if (NULL == (ex = ENVPTR->NewObjectA(ENVONLY, jc, jm, (jvalue *)(args)))) { \
- HDprintf("THROWEXCEPTION FATAL ERROR: Class %s: Creation failed\n", (className)); \
- CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \
- } \
- \
- if (ENVPTR->Throw(ENVONLY, (jthrowable)ex) < 0) { \
- HDprintf("THROWEXCEPTION FATAL ERROR: Class %s: Throw failed\n", (className)); \
- CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \
- } \
-}
+#define THROWEXCEPTION(className, args) \
+ { \
+ jmethodID jm; \
+ jclass jc; \
+ jobject ex; \
+ \
+ if (NULL == (jc = ENVPTR->FindClass(ENVONLY, (className)))) \
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \
+ \
+ if (NULL == (jm = ENVPTR->GetMethodID(ENVONLY, jc, "<init>", "(Ljava/lang/String;)V"))) { \
+ HDprintf("THROWEXCEPTION FATAL ERROR: GetMethodID failed\n"); \
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \
+ } \
+ \
+ if (NULL == (ex = ENVPTR->NewObjectA(ENVONLY, jc, jm, (jvalue *)(args)))) { \
+ HDprintf("THROWEXCEPTION FATAL ERROR: Class %s: Creation failed\n", (className)); \
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \
+ } \
+ \
+ if (ENVPTR->Throw(ENVONLY, (jthrowable)ex) < 0) { \
+ HDprintf("THROWEXCEPTION FATAL ERROR: Class %s: Throw failed\n", (className)); \
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \
+ } \
+ }
/********************/
/* Local Prototypes */
/********************/
static const char *defineHDF5LibraryException(hid_t maj_num);
-static jboolean H5JNIErrorClass(JNIEnv *env, const char *message, const char *className);
+static jboolean H5JNIErrorClass(JNIEnv *env, const char *message, const char *className);
/* get the major and minor error numbers on the top of the error stack */
static herr_t
-walk_error_callback
- (unsigned n, const H5E_error2_t *err_desc, void *_err_nums)
+walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void *_err_nums)
{
H5E_num_t *err_nums = (H5E_num_t *)_err_nums;
@@ -122,8 +119,7 @@ walk_error_callback
*
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5error_1off
- (JNIEnv *env, jclass clss)
+Java_hdf_hdf5lib_H5_H5error_1off(JNIEnv *env, jclass clss)
{
UNUSED(env);
UNUSED(clss);
@@ -144,8 +140,7 @@ Java_hdf_hdf5lib_H5_H5error_1off
*
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5error_1on
- (JNIEnv *env, jclass clss)
+Java_hdf_hdf5lib_H5_H5error_1on(JNIEnv *env, jclass clss)
{
UNUSED(env);
UNUSED(clss);
@@ -161,11 +156,10 @@ Java_hdf_hdf5lib_H5_H5error_1on
* Call the HDF-5 library to print the HDF-5 error stack to 'file_name'.
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0
- (JNIEnv *env, jobject obj, jstring file_name)
+Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0(JNIEnv *env, jobject obj, jstring file_name)
{
- FILE *stream = NULL;
- const char *file = NULL;
+ FILE * stream = NULL;
+ const char *file = NULL;
UNUSED(obj);
@@ -196,8 +190,7 @@ done:
* Extract the HDF-5 major error number from the HDF-5 error stack.
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMajorErrorNumber
- (JNIEnv *env, jobject obj)
+Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMajorErrorNumber(JNIEnv *env, jobject obj)
{
H5E_num_t err_nums;
@@ -221,8 +214,7 @@ Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMajorErrorNumber
* Extract the HDF-5 minor error number from the HDF-5 error stack.
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMinorErrorNumber
- (JNIEnv *env, jobject obj)
+Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMinorErrorNumber(JNIEnv *env, jobject obj)
{
H5E_num_t err_nums;
@@ -242,17 +234,16 @@ Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMinorErrorNumber
* Routine to raise particular Java exceptions from C.
*/
static jboolean
-H5JNIErrorClass
- (JNIEnv *env, const char *message, const char *className)
+H5JNIErrorClass(JNIEnv *env, const char *message, const char *className)
{
- jstring str;
- char *args[2];
- jboolean retVal = JNI_FALSE;
+ jstring str;
+ char * args[2];
+ jboolean retVal = JNI_FALSE;
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, message)))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- args[0] = (char *) str;
+ args[0] = (char *)str;
args[1] = 0;
THROWEXCEPTION(className, args);
@@ -271,13 +262,11 @@ done:
* exception.
*/
jboolean
-h5outOfMemory
- (JNIEnv *env, const char *functName)
+h5outOfMemory(JNIEnv *env, const char *functName)
{
return H5JNIErrorClass(env, functName, "java/lang/OutOfMemoryError");
} /* end h5outOfMemory() */
-
/*
* A fatal error in a JNI call
* Create and throw an 'InternalError'
@@ -287,8 +276,7 @@ h5outOfMemory
* exception.
*/
jboolean
-h5JNIFatalError
- (JNIEnv *env, const char *functName)
+h5JNIFatalError(JNIEnv *env, const char *functName)
{
return H5JNIErrorClass(env, functName, "java/lang/InternalError");
} /* end h5JNIFatalError() */
@@ -302,8 +290,7 @@ h5JNIFatalError
* exception.
*/
jboolean
-h5nullArgument
- (JNIEnv *env, const char *functName)
+h5nullArgument(JNIEnv *env, const char *functName)
{
return H5JNIErrorClass(env, functName, "java/lang/NullPointerException");
} /* end h5nullArgument() */
@@ -317,8 +304,7 @@ h5nullArgument
* exception.
*/
jboolean
-h5badArgument
- (JNIEnv *env, const char *functName)
+h5badArgument(JNIEnv *env, const char *functName)
{
return H5JNIErrorClass(env, functName, "java/lang/IllegalArgumentException");
} /* end h5badArgument() */
@@ -332,8 +318,7 @@ h5badArgument
* exception.
*/
jboolean
-h5unimplemented
- (JNIEnv *env, const char *functName)
+h5unimplemented(JNIEnv *env, const char *functName)
{
return H5JNIErrorClass(env, functName, "java/lang/UnsupportedOperationException");
} /* end h5unimplemented() */
@@ -346,8 +331,7 @@ h5unimplemented
* exception.
*/
jboolean
-h5raiseException
- (JNIEnv *env, const char *message, const char *exception)
+h5raiseException(JNIEnv *env, const char *message, const char *exception)
{
return H5JNIErrorClass(env, message, exception);
} /* end h5raiseException() */
@@ -364,20 +348,19 @@ h5raiseException
* exception.
*/
jboolean
-h5libraryError
- (JNIEnv *env)
+h5libraryError(JNIEnv *env)
{
const char *exception = NULL;
H5E_type_t error_msg_type;
H5E_num_t exceptionNumbers;
- jstring str = NULL;
+ jstring str = NULL;
ssize_t msg_size = 0;
hid_t min_num;
hid_t maj_num;
hid_t stk_id = H5I_INVALID_HID;
- char *args[2];
- char *msg_str = NULL;
- jboolean retVal = JNI_FALSE;
+ char * args[2];
+ char * msg_str = NULL;
+ jboolean retVal = JNI_FALSE;
exceptionNumbers.maj_num = 0;
exceptionNumbers.min_num = 0;
@@ -408,7 +391,7 @@ h5libraryError
goto done;
if (msg_size > 0) {
- if (NULL == (msg_str = (char *) HDcalloc((size_t)msg_size + 1, sizeof(char))))
+ if (NULL == (msg_str = (char *)HDcalloc((size_t)msg_size + 1, sizeof(char))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5libraryerror: failed to allocate buffer for error message");
if ((msg_size = H5Eget_msg(min_num, &error_msg_type, msg_str, (size_t)msg_size + 1)) < 0)
@@ -424,7 +407,7 @@ h5libraryError
if (stk_id >= 0)
H5Eset_current_stack(stk_id);
- args[0] = (char *) str;
+ args[0] = (char *)str;
args[1] = 0;
THROWEXCEPTION(exception, args);
@@ -443,8 +426,7 @@ done:
* which goes with an HDF-5 error code.
*/
static const char *
-defineHDF5LibraryException
- (hid_t maj_num)
+defineHDF5LibraryException(hid_t maj_num)
{
hid_t err_num = maj_num;
@@ -497,4 +479,3 @@ defineHDF5LibraryException
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
-
diff --git a/java/src/jni/exceptionImp.h b/java/src/jni/exceptionImp.h
index 5873202..1a7ad92 100644
--- a/java/src/jni/exceptionImp.h
+++ b/java/src/jni/exceptionImp.h
@@ -27,9 +27,7 @@ extern "C" {
* Signature: ()I
*
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5error_1off
- (JNIEnv *env, jclass clss );
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5error_1off(JNIEnv *env, jclass clss);
/*
* Class: hdf_hdf5lib_exceptions_HDF5Library
@@ -37,10 +35,7 @@ Java_hdf_hdf5lib_H5_H5error_1off
* Signature: ()V
*
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5error_1on
- (JNIEnv *env, jclass clss );
-
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5error_1on(JNIEnv *env, jclass clss);
/*
* Class: hdf_hdf5lib_exceptions_HDFLibraryException
@@ -49,27 +44,25 @@ Java_hdf_hdf5lib_H5_H5error_1on
*
* Call the HDF-5 library to print the HDF-5 error stack to 'file_name'.
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0
- (JNIEnv *env, jobject obj, jstring file_name);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0(JNIEnv *env,
+ jobject obj,
+ jstring file_name);
/*
* Class: hdf_hdf5lib_exceptions_HDFLibraryException
* Method: _getMajorErrorNumber
* Signature: ()J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMajorErrorNumber
- (JNIEnv *env, jobject obj);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMajorErrorNumber(JNIEnv *env,
+ jobject obj);
/*
* Class: hdf_hdf5lib_exceptions_HDFLibraryException
* Method: _getMinorErrorNumber
* Signature: ()J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMinorErrorNumber
- (JNIEnv *env, jobject obj);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMinorErrorNumber(JNIEnv *env,
+ jobject obj);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c
index f9354d7..38f0883 100644
--- a/java/src/jni/h5Constants.c
+++ b/java/src/jni/h5Constants.c
@@ -30,420 +30,1015 @@ H5_GCC_DIAG_OFF("missing-prototypes")
H5_GCC_DIAG_OFF("unused-parameter")
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1QUARTER_1HADDR_1MAX(JNIEnv *env, jclass cls) { return (hsize_t)HADDR_MAX/4; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1QUARTER_1HADDR_1MAX(JNIEnv *env, jclass cls)
+{
+ return (hsize_t)HADDR_MAX / 4;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1ALLOW_1K13_1OPTION_1MASK(JNIEnv *env, jclass cls) { return H5_SZIP_ALLOW_K13_OPTION_MASK; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1ALLOW_1K13_1OPTION_1MASK(JNIEnv *env, jclass cls)
+{
+ return H5_SZIP_ALLOW_K13_OPTION_MASK;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1CHIP_1OPTION_1MASK(JNIEnv *env, jclass cls) { return H5_SZIP_CHIP_OPTION_MASK; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1CHIP_1OPTION_1MASK(JNIEnv *env, jclass cls)
+{
+ return H5_SZIP_CHIP_OPTION_MASK;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1EC_1OPTION_1MASK(JNIEnv *env, jclass cls) { return H5_SZIP_EC_OPTION_MASK; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1EC_1OPTION_1MASK(JNIEnv *env, jclass cls)
+{
+ return H5_SZIP_EC_OPTION_MASK;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1MAX_1PIXELS_1PER_1BLOCK(JNIEnv *env, jclass cls) { return H5_SZIP_MAX_PIXELS_PER_BLOCK; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1MAX_1PIXELS_1PER_1BLOCK(JNIEnv *env, jclass cls)
+{
+ return H5_SZIP_MAX_PIXELS_PER_BLOCK;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1NN_1OPTION_1MASK(JNIEnv *env, jclass cls) { return H5_SZIP_NN_OPTION_MASK; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1NN_1OPTION_1MASK(JNIEnv *env, jclass cls)
+{
+ return H5_SZIP_NN_OPTION_MASK;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1UNKNOWN(JNIEnv *env, jclass cls) { return H5_INDEX_UNKNOWN; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1UNKNOWN(JNIEnv *env, jclass cls)
+{
+ return H5_INDEX_UNKNOWN;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1NAME(JNIEnv *env, jclass cls) { return H5_INDEX_NAME; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1NAME(JNIEnv *env, jclass cls)
+{
+ return H5_INDEX_NAME;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1CRT_1ORDER(JNIEnv *env, jclass cls) { return H5_INDEX_CRT_ORDER; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1CRT_1ORDER(JNIEnv *env, jclass cls)
+{
+ return H5_INDEX_CRT_ORDER;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1N(JNIEnv *env, jclass cls) { return H5_INDEX_N; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1N(JNIEnv *env, jclass cls)
+{
+ return H5_INDEX_N;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1UNKNOWN(JNIEnv *env, jclass cls) { return H5_ITER_UNKNOWN; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1UNKNOWN(JNIEnv *env, jclass cls)
+{
+ return H5_ITER_UNKNOWN;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1INC(JNIEnv *env, jclass cls) { return H5_ITER_INC; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1INC(JNIEnv *env, jclass cls)
+{
+ return H5_ITER_INC;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1DEC(JNIEnv *env, jclass cls) { return H5_ITER_DEC; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1DEC(JNIEnv *env, jclass cls)
+{
+ return H5_ITER_DEC;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1NATIVE(JNIEnv *env, jclass cls) { return H5_ITER_NATIVE; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1NATIVE(JNIEnv *env, jclass cls)
+{
+ return H5_ITER_NATIVE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1N(JNIEnv *env, jclass cls) { return H5_ITER_N; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1N(JNIEnv *env, jclass cls)
+{
+ return H5_ITER_N;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5AC_1CURR_1CACHE_1CONFIG_1VERSION(JNIEnv *env, jclass cls) { return H5AC__CURR_CACHE_CONFIG_VERSION; }
+Java_hdf_hdf5lib_HDF5Constants_H5AC_1CURR_1CACHE_1CONFIG_1VERSION(JNIEnv *env, jclass cls)
+{
+ return H5AC__CURR_CACHE_CONFIG_VERSION;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5AC_1MAX_1TRACE_1FILE_1NAME_1LEN(JNIEnv *env, jclass cls) { return H5AC__MAX_TRACE_FILE_NAME_LEN; }
+Java_hdf_hdf5lib_HDF5Constants_H5AC_1MAX_1TRACE_1FILE_1NAME_1LEN(JNIEnv *env, jclass cls)
+{
+ return H5AC__MAX_TRACE_FILE_NAME_LEN;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5AC_1METADATA_1WRITE_1STRATEGY_1PROCESS_1ZERO_1ONLY(JNIEnv *env, jclass cls) { return H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY; }
+Java_hdf_hdf5lib_HDF5Constants_H5AC_1METADATA_1WRITE_1STRATEGY_1PROCESS_1ZERO_1ONLY(JNIEnv *env, jclass cls)
+{
+ return H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5AC_1METADATA_1WRITE_1STRATEGY_1DISTRIBUTED(JNIEnv *env, jclass cls) { return H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED; }
+Java_hdf_hdf5lib_HDF5Constants_H5AC_1METADATA_1WRITE_1STRATEGY_1DISTRIBUTED(JNIEnv *env, jclass cls)
+{
+ return H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5C_1incr_1off(JNIEnv *env, jclass cls) { return H5C_incr__off; }
+Java_hdf_hdf5lib_HDF5Constants_H5C_1incr_1off(JNIEnv *env, jclass cls)
+{
+ return H5C_incr__off;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5C_1incr_1threshold(JNIEnv *env, jclass cls) { return H5C_incr__threshold; }
+Java_hdf_hdf5lib_HDF5Constants_H5C_1incr_1threshold(JNIEnv *env, jclass cls)
+{
+ return H5C_incr__threshold;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5C_1flash_1incr_1off(JNIEnv *env, jclass cls) { return H5C_flash_incr__off; }
+Java_hdf_hdf5lib_HDF5Constants_H5C_1flash_1incr_1off(JNIEnv *env, jclass cls)
+{
+ return H5C_flash_incr__off;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5C_1flash_1incr_1add_1space(JNIEnv *env, jclass cls) { return H5C_flash_incr__add_space; }
+Java_hdf_hdf5lib_HDF5Constants_H5C_1flash_1incr_1add_1space(JNIEnv *env, jclass cls)
+{
+ return H5C_flash_incr__add_space;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1off(JNIEnv *env, jclass cls) { return H5C_decr__off; }
+Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1off(JNIEnv *env, jclass cls)
+{
+ return H5C_decr__off;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1threshold(JNIEnv *env, jclass cls) { return H5C_decr__threshold; }
+Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1threshold(JNIEnv *env, jclass cls)
+{
+ return H5C_decr__threshold;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1age_1out(JNIEnv *env, jclass cls) { return H5C_decr__age_out; }
+Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1age_1out(JNIEnv *env, jclass cls)
+{
+ return H5C_decr__age_out;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1age_1out_1with_1threshold(JNIEnv *env, jclass cls) { return H5C_decr__age_out_with_threshold; }
+Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1age_1out_1with_1threshold(JNIEnv *env, jclass cls)
+{
+ return H5C_decr__age_out_with_threshold;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNK_1IDX_1BTREE(JNIEnv *env, jclass cls) { return H5D_CHUNK_IDX_BTREE; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNK_1IDX_1BTREE(JNIEnv *env, jclass cls)
+{
+ return H5D_CHUNK_IDX_BTREE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1DEFAULT(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_DEFAULT; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5D_ALLOC_TIME_DEFAULT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1EARLY(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_EARLY; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1EARLY(JNIEnv *env, jclass cls)
+{
+ return H5D_ALLOC_TIME_EARLY;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1ERROR(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5D_ALLOC_TIME_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1INCR(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_INCR; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1INCR(JNIEnv *env, jclass cls)
+{
+ return H5D_ALLOC_TIME_INCR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1LATE(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_LATE; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1LATE(JNIEnv *env, jclass cls)
+{
+ return H5D_ALLOC_TIME_LATE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1ERROR(JNIEnv *env, jclass cls) { return H5D_FILL_TIME_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5D_FILL_TIME_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1ALLOC(JNIEnv *env, jclass cls) { return H5D_FILL_TIME_ALLOC; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1ALLOC(JNIEnv *env, jclass cls)
+{
+ return H5D_FILL_TIME_ALLOC;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1NEVER(JNIEnv *env, jclass cls) { return H5D_FILL_TIME_NEVER; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1NEVER(JNIEnv *env, jclass cls)
+{
+ return H5D_FILL_TIME_NEVER;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1IFSET(JNIEnv *env, jclass cls) { return H5D_FILL_TIME_IFSET; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1IFSET(JNIEnv *env, jclass cls)
+{
+ return H5D_FILL_TIME_IFSET;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1DEFAULT(JNIEnv *env, jclass cls) { return H5D_FILL_VALUE_DEFAULT; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5D_FILL_VALUE_DEFAULT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1ERROR(JNIEnv *env, jclass cls) { return H5D_FILL_VALUE_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5D_FILL_VALUE_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1UNDEFINED(JNIEnv *env, jclass cls) { return H5D_FILL_VALUE_UNDEFINED; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1UNDEFINED(JNIEnv *env, jclass cls)
+{
+ return H5D_FILL_VALUE_UNDEFINED;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1USER_1DEFINED(JNIEnv *env, jclass cls) { return H5D_FILL_VALUE_USER_DEFINED; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1USER_1DEFINED(JNIEnv *env, jclass cls)
+{
+ return H5D_FILL_VALUE_USER_DEFINED;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1LAYOUT_1ERROR(JNIEnv *env, jclass cls) { return H5D_LAYOUT_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1LAYOUT_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5D_LAYOUT_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNKED(JNIEnv *env, jclass cls) { return H5D_CHUNKED; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNKED(JNIEnv *env, jclass cls)
+{
+ return H5D_CHUNKED;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1COMPACT(JNIEnv *env, jclass cls) { return H5D_COMPACT; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1COMPACT(JNIEnv *env, jclass cls)
+{
+ return H5D_COMPACT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1CONTIGUOUS(JNIEnv *env, jclass cls) { return H5D_CONTIGUOUS; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1CONTIGUOUS(JNIEnv *env, jclass cls)
+{
+ return H5D_CONTIGUOUS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1VIRTUAL(JNIEnv *env, jclass cls) { return H5D_VIRTUAL; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1VIRTUAL(JNIEnv *env, jclass cls)
+{
+ return H5D_VIRTUAL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1NLAYOUTS(JNIEnv *env, jclass cls) { return H5D_NLAYOUTS; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1NLAYOUTS(JNIEnv *env, jclass cls)
+{
+ return H5D_NLAYOUTS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1ALLOCATED(JNIEnv *env, jclass cls) { return H5D_SPACE_STATUS_ALLOCATED; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1ALLOCATED(JNIEnv *env, jclass cls)
+{
+ return H5D_SPACE_STATUS_ALLOCATED;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1ERROR(JNIEnv *env, jclass cls) { return H5D_SPACE_STATUS_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5D_SPACE_STATUS_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1NOT_1ALLOCATED(JNIEnv *env, jclass cls) { return H5D_SPACE_STATUS_NOT_ALLOCATED; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1NOT_1ALLOCATED(JNIEnv *env, jclass cls)
+{
+ return H5D_SPACE_STATUS_NOT_ALLOCATED;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1PART_1ALLOCATED(JNIEnv *env, jclass cls) { return H5D_SPACE_STATUS_PART_ALLOCATED; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1PART_1ALLOCATED(JNIEnv *env, jclass cls)
+{
+ return H5D_SPACE_STATUS_PART_ALLOCATED;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1ERROR(JNIEnv *env, jclass cls) { return H5D_VDS_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5D_VDS_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1FIRST_1MISSING(JNIEnv *env, jclass cls) { return H5D_VDS_FIRST_MISSING; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1FIRST_1MISSING(JNIEnv *env, jclass cls)
+{
+ return H5D_VDS_FIRST_MISSING;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1LAST_1AVAILABLE(JNIEnv *env, jclass cls) { return H5D_VDS_LAST_AVAILABLE; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1LAST_1AVAILABLE(JNIEnv *env, jclass cls)
+{
+ return H5D_VDS_LAST_AVAILABLE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNK_1DONT_1FILTER_1PARTIAL_1CHUNKS(JNIEnv *env, jclass cls) { return H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS; }
+Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNK_1DONT_1FILTER_1PARTIAL_1CHUNKS(JNIEnv *env, jclass cls)
+{
+ return H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1ALIGNMENT(JNIEnv *env, jclass cls) { return H5E_ALIGNMENT; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1ALIGNMENT(JNIEnv *env, jclass cls)
+{
+ return H5E_ALIGNMENT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1ALREADYEXISTS(JNIEnv *env, jclass cls) { return H5E_ALREADYEXISTS; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1ALREADYEXISTS(JNIEnv *env, jclass cls)
+{
+ return H5E_ALREADYEXISTS;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1ALREADYINIT(JNIEnv *env, jclass cls) { return H5E_ALREADYINIT; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1ALREADYINIT(JNIEnv *env, jclass cls)
+{
+ return H5E_ALREADYINIT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1ARGS(JNIEnv *env, jclass cls) { return H5E_ARGS; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1ARGS(JNIEnv *env, jclass cls)
+{
+ return H5E_ARGS;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1ATOM(JNIEnv *env, jclass cls) { return H5E_ATOM; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1ATOM(JNIEnv *env, jclass cls)
+{
+ return H5E_ATOM;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1ATTR(JNIEnv *env, jclass cls) { return H5E_ATTR; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1ATTR(JNIEnv *env, jclass cls)
+{
+ return H5E_ATTR;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1BADATOM(JNIEnv *env, jclass cls) { return H5E_BADATOM; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1BADATOM(JNIEnv *env, jclass cls)
+{
+ return H5E_BADATOM;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1BADFILE(JNIEnv *env, jclass cls) { return H5E_BADFILE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1BADFILE(JNIEnv *env, jclass cls)
+{
+ return H5E_BADFILE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1BADGROUP(JNIEnv *env, jclass cls) { return H5E_BADGROUP; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1BADGROUP(JNIEnv *env, jclass cls)
+{
+ return H5E_BADGROUP;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1BADMESG(JNIEnv *env, jclass cls) { return H5E_BADMESG; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1BADMESG(JNIEnv *env, jclass cls)
+{
+ return H5E_BADMESG;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1BADRANGE(JNIEnv *env, jclass cls) { return H5E_BADRANGE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1BADRANGE(JNIEnv *env, jclass cls)
+{
+ return H5E_BADRANGE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1BADSELECT(JNIEnv *env, jclass cls) { return H5E_BADSELECT; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1BADSELECT(JNIEnv *env, jclass cls)
+{
+ return H5E_BADSELECT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1BADSIZE(JNIEnv *env, jclass cls) { return H5E_BADSIZE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1BADSIZE(JNIEnv *env, jclass cls)
+{
+ return H5E_BADSIZE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1BADTYPE(JNIEnv *env, jclass cls) { return H5E_BADTYPE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1BADTYPE(JNIEnv *env, jclass cls)
+{
+ return H5E_BADTYPE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1BADVALUE(JNIEnv *env, jclass cls) { return H5E_BADVALUE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1BADVALUE(JNIEnv *env, jclass cls)
+{
+ return H5E_BADVALUE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1BTREE(JNIEnv *env, jclass cls) { return H5E_BTREE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1BTREE(JNIEnv *env, jclass cls)
+{
+ return H5E_BTREE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CACHE(JNIEnv *env, jclass cls) { return H5E_CACHE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CACHE(JNIEnv *env, jclass cls)
+{
+ return H5E_CACHE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CALLBACK(JNIEnv *env, jclass cls) { return H5E_CALLBACK; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CALLBACK(JNIEnv *env, jclass cls)
+{
+ return H5E_CALLBACK;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANAPPLY(JNIEnv *env, jclass cls) { return H5E_CANAPPLY; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANAPPLY(JNIEnv *env, jclass cls)
+{
+ return H5E_CANAPPLY;
+}
/*JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTALLOC(JNIEnv *env, jclass cls) { return H5E_CANTALLOC; }*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCLIP(JNIEnv *env, jclass cls) { return H5E_CANTCLIP; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCLIP(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTCLIP;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCLOSEFILE(JNIEnv *env, jclass cls) { return H5E_CANTCLOSEFILE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCLOSEFILE(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTCLOSEFILE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCONVERT(JNIEnv *env, jclass cls) { return H5E_CANTCONVERT; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCONVERT(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTCONVERT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCOPY(JNIEnv *env, jclass cls) { return H5E_CANTCOPY; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCOPY(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTCOPY;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCOUNT(JNIEnv *env, jclass cls) { return H5E_CANTCOUNT; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCOUNT(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTCOUNT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCREATE(JNIEnv *env, jclass cls) { return H5E_CANTCREATE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCREATE(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTCREATE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDEC(JNIEnv *env, jclass cls) { return H5E_CANTDEC; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDEC(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTDEC;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDECODE(JNIEnv *env, jclass cls) { return H5E_CANTDECODE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDECODE(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTDECODE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDELETE(JNIEnv *env, jclass cls) { return H5E_CANTDELETE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDELETE(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTDELETE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDELETEFILE(JNIEnv *env, jclass cls) { return H5E_CANTDELETEFILE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDELETEFILE(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTDELETEFILE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTENCODE(JNIEnv *env, jclass cls) { return H5E_CANTENCODE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTENCODE(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTENCODE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTFLUSH(JNIEnv *env, jclass cls) { return H5E_CANTFLUSH; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTFLUSH(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTFLUSH;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTFREE(JNIEnv *env, jclass cls) { return H5E_CANTFREE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTFREE(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTFREE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTGET(JNIEnv *env, jclass cls) { return H5E_CANTGET; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTGET(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTGET;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTINC(JNIEnv *env, jclass cls) { return H5E_CANTINC; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTINC(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTINC;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTINIT(JNIEnv *env, jclass cls) { return H5E_CANTINIT; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTINIT(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTINIT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTINSERT(JNIEnv *env, jclass cls) { return H5E_CANTINSERT; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTINSERT(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTINSERT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTLIST(JNIEnv *env, jclass cls) { return H5E_CANTLIST; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTLIST(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTLIST;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTLOAD(JNIEnv *env, jclass cls) { return H5E_CANTLOAD; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTLOAD(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTLOAD;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTLOCK(JNIEnv *env, jclass cls) { return H5E_CANTLOCK; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTLOCK(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTLOCK;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTNEXT(JNIEnv *env, jclass cls) { return H5E_CANTNEXT; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTNEXT(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTNEXT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTOPENFILE(JNIEnv *env, jclass cls) { return H5E_CANTOPENFILE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTOPENFILE(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTOPENFILE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTOPENOBJ(JNIEnv *env, jclass cls) { return H5E_CANTOPENOBJ; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTOPENOBJ(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTOPENOBJ;
+}
/*JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTRECV(JNIEnv *env, jclass cls) { return H5E_CANTRECV; }*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTREGISTER(JNIEnv *env, jclass cls) { return H5E_CANTREGISTER; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTREGISTER(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTREGISTER;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTRELEASE(JNIEnv *env, jclass cls) { return H5E_CANTRELEASE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTRELEASE(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTRELEASE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTSELECT(JNIEnv *env, jclass cls) { return H5E_CANTSELECT; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTSELECT(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTSELECT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTSET(JNIEnv *env, jclass cls) { return H5E_CANTSET; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTSET(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTSET;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTSPLIT(JNIEnv *env, jclass cls) { return H5E_CANTSPLIT; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTSPLIT(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTSPLIT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTUNLOCK(JNIEnv *env, jclass cls) { return H5E_CANTUNLOCK; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTUNLOCK(JNIEnv *env, jclass cls)
+{
+ return H5E_CANTUNLOCK;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1CLOSEERROR(JNIEnv *env, jclass cls) { return H5E_CLOSEERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CLOSEERROR(JNIEnv *env, jclass cls)
+{
+ return H5E_CLOSEERROR;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1COMPLEN(JNIEnv *env, jclass cls) { return H5E_COMPLEN; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1COMPLEN(JNIEnv *env, jclass cls)
+{
+ return H5E_COMPLEN;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1DATASET(JNIEnv *env, jclass cls) { return H5E_DATASET; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1DATASET(JNIEnv *env, jclass cls)
+{
+ return H5E_DATASET;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1DATASPACE(JNIEnv *env, jclass cls) { return H5E_DATASPACE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1DATASPACE(JNIEnv *env, jclass cls)
+{
+ return H5E_DATASPACE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1DATATYPE(JNIEnv *env, jclass cls) { return H5E_DATATYPE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1DATATYPE(JNIEnv *env, jclass cls)
+{
+ return H5E_DATATYPE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1DEFAULT(JNIEnv *env, jclass cls) { return H5E_DEFAULT; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5E_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1DUPCLASS(JNIEnv *env, jclass cls) { return H5E_DUPCLASS; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1DUPCLASS(JNIEnv *env, jclass cls)
+{
+ return H5E_DUPCLASS;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1EFL(JNIEnv *env, jclass cls) { return H5E_EFL; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1EFL(JNIEnv *env, jclass cls)
+{
+ return H5E_EFL;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1EXISTS(JNIEnv *env, jclass cls) { return H5E_EXISTS; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1EXISTS(JNIEnv *env, jclass cls)
+{
+ return H5E_EXISTS;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1FCNTL(JNIEnv *env, jclass cls) { return H5E_FCNTL; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1FCNTL(JNIEnv *env, jclass cls)
+{
+ return H5E_FCNTL;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1FILE(JNIEnv *env, jclass cls) { return H5E_FILE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1FILE(JNIEnv *env, jclass cls)
+{
+ return H5E_FILE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1FILEEXISTS(JNIEnv *env, jclass cls) { return H5E_FILEEXISTS; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1FILEEXISTS(JNIEnv *env, jclass cls)
+{
+ return H5E_FILEEXISTS;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1FILEOPEN(JNIEnv *env, jclass cls) { return H5E_FILEOPEN; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1FILEOPEN(JNIEnv *env, jclass cls)
+{
+ return H5E_FILEOPEN;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1FUNC(JNIEnv *env, jclass cls) { return H5E_FUNC; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1FUNC(JNIEnv *env, jclass cls)
+{
+ return H5E_FUNC;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1HEAP(JNIEnv *env, jclass cls) { return H5E_HEAP; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1HEAP(JNIEnv *env, jclass cls)
+{
+ return H5E_HEAP;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1INTERNAL(JNIEnv *env, jclass cls) { return H5E_INTERNAL; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1INTERNAL(JNIEnv *env, jclass cls)
+{
+ return H5E_INTERNAL;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1IO(JNIEnv *env, jclass cls) { return H5E_IO; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1IO(JNIEnv *env, jclass cls)
+{
+ return H5E_IO;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1LINK(JNIEnv *env, jclass cls) { return H5E_LINK; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1LINK(JNIEnv *env, jclass cls)
+{
+ return H5E_LINK;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1LINKCOUNT(JNIEnv *env, jclass cls) { return H5E_LINKCOUNT; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1LINKCOUNT(JNIEnv *env, jclass cls)
+{
+ return H5E_LINKCOUNT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1MAJOR(JNIEnv *env, jclass cls) { return H5E_MAJOR; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1MAJOR(JNIEnv *env, jclass cls)
+{
+ return H5E_MAJOR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1MINOR(JNIEnv *env, jclass cls) { return H5E_MINOR; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1MINOR(JNIEnv *env, jclass cls)
+{
+ return H5E_MINOR;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1MOUNT(JNIEnv *env, jclass cls) { return H5E_MOUNT; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1MOUNT(JNIEnv *env, jclass cls)
+{
+ return H5E_MOUNT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1MPI(JNIEnv *env, jclass cls) { return H5E_MPI; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1MPI(JNIEnv *env, jclass cls)
+{
+ return H5E_MPI;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1MPIERRSTR(JNIEnv *env, jclass cls) { return H5E_MPIERRSTR; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1MPIERRSTR(JNIEnv *env, jclass cls)
+{
+ return H5E_MPIERRSTR;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1NOFILTER(JNIEnv *env, jclass cls) { return H5E_NOFILTER; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1NOFILTER(JNIEnv *env, jclass cls)
+{
+ return H5E_NOFILTER;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1NOIDS(JNIEnv *env, jclass cls) { return H5E_NOIDS; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1NOIDS(JNIEnv *env, jclass cls)
+{
+ return H5E_NOIDS;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1NONE_1MAJOR(JNIEnv *env, jclass cls) { return H5E_NONE_MAJOR; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1NONE_1MAJOR(JNIEnv *env, jclass cls)
+{
+ return H5E_NONE_MAJOR;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1NONE_1MINOR(JNIEnv *env, jclass cls) { return H5E_NONE_MINOR; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1NONE_1MINOR(JNIEnv *env, jclass cls)
+{
+ return H5E_NONE_MINOR;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1NOSPACE(JNIEnv *env, jclass cls) { return H5E_NOSPACE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1NOSPACE(JNIEnv *env, jclass cls)
+{
+ return H5E_NOSPACE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1NOTCACHED(JNIEnv *env, jclass cls) { return H5E_NOTCACHED; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1NOTCACHED(JNIEnv *env, jclass cls)
+{
+ return H5E_NOTCACHED;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1NOTFOUND(JNIEnv *env, jclass cls) { return H5E_NOTFOUND; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1NOTFOUND(JNIEnv *env, jclass cls)
+{
+ return H5E_NOTFOUND;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1NOTHDF5(JNIEnv *env, jclass cls) { return H5E_NOTHDF5; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1NOTHDF5(JNIEnv *env, jclass cls)
+{
+ return H5E_NOTHDF5;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1OHDR(JNIEnv *env, jclass cls) { return H5E_OHDR; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1OHDR(JNIEnv *env, jclass cls)
+{
+ return H5E_OHDR;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1OVERFLOW(JNIEnv *env, jclass cls) { return H5E_OVERFLOW; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1OVERFLOW(JNIEnv *env, jclass cls)
+{
+ return H5E_OVERFLOW;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1PLINE(JNIEnv *env, jclass cls) { return H5E_PLINE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1PLINE(JNIEnv *env, jclass cls)
+{
+ return H5E_PLINE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1PLIST(JNIEnv *env, jclass cls) { return H5E_PLIST; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1PLIST(JNIEnv *env, jclass cls)
+{
+ return H5E_PLIST;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1PROTECT(JNIEnv *env, jclass cls) { return H5E_PROTECT; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1PROTECT(JNIEnv *env, jclass cls)
+{
+ return H5E_PROTECT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1READERROR(JNIEnv *env, jclass cls) { return H5E_READERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1READERROR(JNIEnv *env, jclass cls)
+{
+ return H5E_READERROR;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1REFERENCE(JNIEnv *env, jclass cls) { return H5E_REFERENCE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1REFERENCE(JNIEnv *env, jclass cls)
+{
+ return H5E_REFERENCE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1RESOURCE(JNIEnv *env, jclass cls) { return H5E_RESOURCE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1RESOURCE(JNIEnv *env, jclass cls)
+{
+ return H5E_RESOURCE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1RS(JNIEnv *env, jclass cls) { return H5E_RS; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1RS(JNIEnv *env, jclass cls)
+{
+ return H5E_RS;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1SEEKERROR(JNIEnv *env, jclass cls) { return H5E_SEEKERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1SEEKERROR(JNIEnv *env, jclass cls)
+{
+ return H5E_SEEKERROR;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1SETLOCAL(JNIEnv *env, jclass cls) { return H5E_SETLOCAL; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1SETLOCAL(JNIEnv *env, jclass cls)
+{
+ return H5E_SETLOCAL;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1STORAGE(JNIEnv *env, jclass cls) { return H5E_STORAGE; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1STORAGE(JNIEnv *env, jclass cls)
+{
+ return H5E_STORAGE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1SYM(JNIEnv *env, jclass cls) { return H5E_SYM; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1SYM(JNIEnv *env, jclass cls)
+{
+ return H5E_SYM;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1TRUNCATED(JNIEnv *env, jclass cls) { return H5E_TRUNCATED; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1TRUNCATED(JNIEnv *env, jclass cls)
+{
+ return H5E_TRUNCATED;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1TST(JNIEnv *env, jclass cls) { return H5E_TST; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1TST(JNIEnv *env, jclass cls)
+{
+ return H5E_TST;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1UNINITIALIZED(JNIEnv *env, jclass cls) { return H5E_UNINITIALIZED; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1UNINITIALIZED(JNIEnv *env, jclass cls)
+{
+ return H5E_UNINITIALIZED;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1UNSUPPORTED(JNIEnv *env, jclass cls) { return H5E_UNSUPPORTED; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1UNSUPPORTED(JNIEnv *env, jclass cls)
+{
+ return H5E_UNSUPPORTED;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1VERSION(JNIEnv *env, jclass cls) { return H5E_VERSION; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1VERSION(JNIEnv *env, jclass cls)
+{
+ return H5E_VERSION;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1VFL(JNIEnv *env, jclass cls) { return H5E_VFL; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1VFL(JNIEnv *env, jclass cls)
+{
+ return H5E_VFL;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1VOL(JNIEnv *env, jclass cls) { return H5E_VOL; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1VOL(JNIEnv *env, jclass cls)
+{
+ return H5E_VOL;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1DOWNWARD(JNIEnv *env, jclass cls) { return H5E_WALK_DOWNWARD; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1DOWNWARD(JNIEnv *env, jclass cls)
+{
+ return H5E_WALK_DOWNWARD;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1UPWARD(JNIEnv *env, jclass cls) { return H5E_WALK_UPWARD; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1UPWARD(JNIEnv *env, jclass cls)
+{
+ return H5E_WALK_UPWARD;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5E_1WRITEERROR(JNIEnv *env, jclass cls) { return H5E_WRITEERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5E_1WRITEERROR(JNIEnv *env, jclass cls)
+{
+ return H5E_WRITEERROR;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1IN_1PROGRESS(JNIEnv *env, jclass cls) { return H5ES_STATUS_IN_PROGRESS; }
+Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1IN_1PROGRESS(JNIEnv *env, jclass cls)
+{
+ return H5ES_STATUS_IN_PROGRESS;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1SUCCEED(JNIEnv *env, jclass cls) { return H5ES_STATUS_SUCCEED; }
+Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1SUCCEED(JNIEnv *env, jclass cls)
+{
+ return H5ES_STATUS_SUCCEED;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1FAIL(JNIEnv *env, jclass cls) { return H5ES_STATUS_FAIL; }
+Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1FAIL(JNIEnv *env, jclass cls)
+{
+ return H5ES_STATUS_FAIL;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1CANCELED(JNIEnv *env, jclass cls) { return H5ES_STATUS_CANCELED; }
+Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1CANCELED(JNIEnv *env, jclass cls)
+{
+ return H5ES_STATUS_CANCELED;
+}
/* Java does not have unsigned native types */
H5_GCC_DIAG_OFF("sign-conversion")
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1CREAT(JNIEnv *env, jclass cls) { return H5F_ACC_CREAT; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1CREAT(JNIEnv *env, jclass cls)
+{
+ return H5F_ACC_CREAT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1EXCL(JNIEnv *env, jclass cls) { return H5F_ACC_EXCL; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1EXCL(JNIEnv *env, jclass cls)
+{
+ return H5F_ACC_EXCL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1RDONLY(JNIEnv *env, jclass cls) { return H5F_ACC_RDONLY; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1RDONLY(JNIEnv *env, jclass cls)
+{
+ return H5F_ACC_RDONLY;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1RDWR(JNIEnv *env, jclass cls) { return H5F_ACC_RDWR; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1RDWR(JNIEnv *env, jclass cls)
+{
+ return H5F_ACC_RDWR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1TRUNC(JNIEnv *env, jclass cls) { return H5F_ACC_TRUNC; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1TRUNC(JNIEnv *env, jclass cls)
+{
+ return H5F_ACC_TRUNC;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1DEFAULT(JNIEnv *env, jclass cls) { return H5F_ACC_DEFAULT; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5F_ACC_DEFAULT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1SWMR_1READ(JNIEnv *env, jclass cls) { return H5F_ACC_SWMR_READ; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1SWMR_1READ(JNIEnv *env, jclass cls)
+{
+ return H5F_ACC_SWMR_READ;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1SWMR_1WRITE(JNIEnv *env, jclass cls) { return H5F_ACC_SWMR_WRITE; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1SWMR_1WRITE(JNIEnv *env, jclass cls)
+{
+ return H5F_ACC_SWMR_WRITE;
+}
H5_GCC_DIAG_ON("sign-conversion")
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1DEFAULT(JNIEnv *env, jclass cls) { return H5F_CLOSE_DEFAULT; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5F_CLOSE_DEFAULT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1SEMI(JNIEnv *env, jclass cls) { return H5F_CLOSE_SEMI; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1SEMI(JNIEnv *env, jclass cls)
+{
+ return H5F_CLOSE_SEMI;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1STRONG(JNIEnv *env, jclass cls) { return H5F_CLOSE_STRONG; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1STRONG(JNIEnv *env, jclass cls)
+{
+ return H5F_CLOSE_STRONG;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1WEAK(JNIEnv *env, jclass cls) { return H5F_CLOSE_WEAK; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1WEAK(JNIEnv *env, jclass cls)
+{
+ return H5F_CLOSE_WEAK;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1ERROR(JNIEnv *env, jclass cls){return H5F_LIBVER_ERROR;}
+Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5F_LIBVER_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1EARLIEST(JNIEnv *env, jclass cls){return H5F_LIBVER_EARLIEST;}
+Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1EARLIEST(JNIEnv *env, jclass cls)
+{
+ return H5F_LIBVER_EARLIEST;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V18(JNIEnv *env, jclass cls){return H5F_LIBVER_V18;}
+Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V18(JNIEnv *env, jclass cls)
+{
+ return H5F_LIBVER_V18;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V110(JNIEnv *env, jclass cls){return H5F_LIBVER_V110;}
+Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V110(JNIEnv *env, jclass cls)
+{
+ return H5F_LIBVER_V110;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V112(JNIEnv *env, jclass cls){return H5F_LIBVER_V112;}
+Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V112(JNIEnv *env, jclass cls)
+{
+ return H5F_LIBVER_V112;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V114(JNIEnv *env, jclass cls){return H5F_LIBVER_V114;}
+Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V114(JNIEnv *env, jclass cls)
+{
+ return H5F_LIBVER_V114;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1NBOUNDS(JNIEnv *env, jclass cls){return H5F_LIBVER_NBOUNDS;}
+Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1NBOUNDS(JNIEnv *env, jclass cls)
+{
+ return H5F_LIBVER_NBOUNDS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1LATEST(JNIEnv *env, jclass cls){return H5F_LIBVER_LATEST;}
+Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1LATEST(JNIEnv *env, jclass cls)
+{
+ return H5F_LIBVER_LATEST;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1ALL(JNIEnv *env, jclass cls) { return H5F_OBJ_ALL; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1ALL(JNIEnv *env, jclass cls)
+{
+ return H5F_OBJ_ALL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1ATTR(JNIEnv *env, jclass cls) { return H5F_OBJ_ATTR; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1ATTR(JNIEnv *env, jclass cls)
+{
+ return H5F_OBJ_ATTR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1DATASET(JNIEnv *env, jclass cls) { return H5F_OBJ_DATASET; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1DATASET(JNIEnv *env, jclass cls)
+{
+ return H5F_OBJ_DATASET;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1DATATYPE(JNIEnv *env, jclass cls) { return H5F_OBJ_DATATYPE; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1DATATYPE(JNIEnv *env, jclass cls)
+{
+ return H5F_OBJ_DATATYPE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1FILE(JNIEnv *env, jclass cls) { return H5F_OBJ_FILE; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1FILE(JNIEnv *env, jclass cls)
+{
+ return H5F_OBJ_FILE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1GROUP(JNIEnv *env, jclass cls) { return H5F_OBJ_GROUP; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1GROUP(JNIEnv *env, jclass cls)
+{
+ return H5F_OBJ_GROUP;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1LOCAL(JNIEnv *env, jclass cls) { return H5F_OBJ_LOCAL; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1LOCAL(JNIEnv *env, jclass cls)
+{
+ return H5F_OBJ_LOCAL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1SCOPE_1GLOBAL(JNIEnv *env, jclass cls) { return H5F_SCOPE_GLOBAL; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1SCOPE_1GLOBAL(JNIEnv *env, jclass cls)
+{
+ return H5F_SCOPE_GLOBAL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1SCOPE_1LOCAL(JNIEnv *env, jclass cls) { return H5F_SCOPE_LOCAL; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1SCOPE_1LOCAL(JNIEnv *env, jclass cls)
+{
+ return H5F_SCOPE_LOCAL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1UNLIMITED(JNIEnv *env, jclass cls) { return (jint)H5F_UNLIMITED; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1UNLIMITED(JNIEnv *env, jclass cls)
+{
+ return (jint)H5F_UNLIMITED;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1FSPACE_1STRATEGY_1FSM_1AGGR(JNIEnv *env, jclass cls) { return H5F_FSPACE_STRATEGY_FSM_AGGR; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1FSPACE_1STRATEGY_1FSM_1AGGR(JNIEnv *env, jclass cls)
+{
+ return H5F_FSPACE_STRATEGY_FSM_AGGR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1FSPACE_1STRATEGY_1AGGR(JNIEnv *env, jclass cls) { return H5F_FSPACE_STRATEGY_AGGR; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1FSPACE_1STRATEGY_1AGGR(JNIEnv *env, jclass cls)
+{
+ return H5F_FSPACE_STRATEGY_AGGR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1FSPACE_1STRATEGY_1PAGE(JNIEnv *env, jclass cls) { return H5F_FSPACE_STRATEGY_PAGE; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1FSPACE_1STRATEGY_1PAGE(JNIEnv *env, jclass cls)
+{
+ return H5F_FSPACE_STRATEGY_PAGE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1FSPACE_1STRATEGY_1NONE(JNIEnv *env, jclass cls) { return H5F_FSPACE_STRATEGY_NONE; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1FSPACE_1STRATEGY_1NONE(JNIEnv *env, jclass cls)
+{
+ return H5F_FSPACE_STRATEGY_NONE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5F_1FSPACE_1STRATEGY_1NTYPES(JNIEnv *env, jclass cls) { return H5F_FSPACE_STRATEGY_NTYPES; }
+Java_hdf_hdf5lib_HDF5Constants_H5F_1FSPACE_1STRATEGY_1NTYPES(JNIEnv *env, jclass cls)
+{
+ return H5F_FSPACE_STRATEGY_NTYPES;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1CORE(JNIEnv *env, jclass cls) { return H5FD_CORE; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1CORE(JNIEnv *env, jclass cls)
+{
+ return H5FD_CORE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1DIRECT(JNIEnv *env, jclass cls) {
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1DIRECT(JNIEnv *env, jclass cls)
+{
#ifdef H5_HAVE_DIRECT
return H5FD_DIRECT;
#else
@@ -451,9 +1046,13 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1DIRECT(JNIEnv *env, jclass cls) {
#endif
}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1FAMILY(JNIEnv *env, jclass cls) { return H5FD_FAMILY; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1FAMILY(JNIEnv *env, jclass cls)
+{
+ return H5FD_FAMILY;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1HDFS(JNIEnv *env, jclass cls) {
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1HDFS(JNIEnv *env, jclass cls)
+{
#ifdef H5_HAVE_LIBHDFS
return H5FD_HDFS;
#else
@@ -461,15 +1060,28 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1HDFS(JNIEnv *env, jclass cls) {
#endif
}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG(JNIEnv *env, jclass cls) { return H5FD_LOG; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MPIO(JNIEnv *env, jclass cls) { return H5FD_MPIO; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MPIO(JNIEnv *env, jclass cls)
+{
+ return H5FD_MPIO;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MULTI(JNIEnv *env, jclass cls) { return H5FD_MULTI; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MULTI(JNIEnv *env, jclass cls)
+{
+ return H5FD_MULTI;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1SEC2(JNIEnv *env, jclass cls) { return H5FD_SEC2; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1SEC2(JNIEnv *env, jclass cls)
+{
+ return H5FD_SEC2;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1ROS3(JNIEnv *env, jclass cls) {
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1ROS3(JNIEnv *env, jclass cls)
+{
#ifdef H5_HAVE_ROS3_VFD
return H5FD_ROS3;
#else
@@ -477,9 +1089,13 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1ROS3(JNIEnv *env, jclass cls) {
#endif
}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1STDIO(JNIEnv *env, jclass cls) { return H5FD_STDIO; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1STDIO(JNIEnv *env, jclass cls)
+{
+ return H5FD_STDIO;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1WINDOWS(JNIEnv *env, jclass cls) {
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1WINDOWS(JNIEnv *env, jclass cls)
+{
#ifdef H5_HAVE_WINDOWS
return H5FD_DIRECT;
#else
@@ -487,85 +1103,201 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1WINDOWS(JNIEnv *env, jclass cls) {
#endif
}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1READ(JNIEnv *env, jclass cls) { return H5FD_LOG_LOC_READ; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1READ(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_LOC_READ;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1WRITE(JNIEnv *env, jclass cls) { return H5FD_LOG_LOC_WRITE; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1WRITE(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_LOC_WRITE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1SEEK(JNIEnv *env, jclass cls) { return H5FD_LOG_LOC_SEEK; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1SEEK(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_LOC_SEEK;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1IO(JNIEnv *env, jclass cls) { return H5FD_LOG_LOC_IO; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1IO(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_LOC_IO;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FILE_1READ(JNIEnv *env, jclass cls) { return H5FD_LOG_FILE_READ; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FILE_1READ(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_FILE_READ;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FILE_1WRITE(JNIEnv *env, jclass cls) { return H5FD_LOG_FILE_WRITE; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FILE_1WRITE(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_FILE_WRITE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FILE_1IO(JNIEnv *env, jclass cls) { return H5FD_LOG_FILE_IO; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FILE_1IO(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_FILE_IO;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FLAVOR(JNIEnv *env, jclass cls) { return H5FD_LOG_FLAVOR; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FLAVOR(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_FLAVOR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1READ(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_READ; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1READ(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_NUM_READ;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1WRITE(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_WRITE; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1WRITE(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_NUM_WRITE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1SEEK(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_SEEK; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1SEEK(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_NUM_SEEK;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1TRUNCATE(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_TRUNCATE; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1TRUNCATE(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_NUM_TRUNCATE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1IO(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_IO; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1IO(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_NUM_IO;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1OPEN(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_OPEN; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1OPEN(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_TIME_OPEN;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1STAT(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_STAT; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1STAT(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_TIME_STAT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1READ(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_READ; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1READ(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_TIME_READ;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1WRITE(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_WRITE; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1WRITE(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_TIME_WRITE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1SEEK(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_SEEK; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1SEEK(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_TIME_SEEK;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1CLOSE(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_CLOSE; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1CLOSE(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_TIME_CLOSE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1IO(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_IO; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1IO(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_TIME_IO;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1ALLOC(JNIEnv *env, jclass cls) { return H5FD_LOG_ALLOC; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1ALLOC(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_ALLOC;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1ALL(JNIEnv *env, jclass cls) { return H5FD_LOG_ALL; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1ALL(JNIEnv *env, jclass cls)
+{
+ return H5FD_LOG_ALL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1NOLIST(JNIEnv *env, jclass cls) { return H5FD_MEM_NOLIST; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1NOLIST(JNIEnv *env, jclass cls)
+{
+ return H5FD_MEM_NOLIST;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT(JNIEnv *env, jclass cls) { return H5FD_MEM_DEFAULT; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5FD_MEM_DEFAULT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1SUPER(JNIEnv *env, jclass cls) { return H5FD_MEM_SUPER; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1SUPER(JNIEnv *env, jclass cls)
+{
+ return H5FD_MEM_SUPER;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1BTREE(JNIEnv *env, jclass cls) { return H5FD_MEM_BTREE; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1BTREE(JNIEnv *env, jclass cls)
+{
+ return H5FD_MEM_BTREE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DRAW(JNIEnv *env, jclass cls) { return H5FD_MEM_DRAW; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DRAW(JNIEnv *env, jclass cls)
+{
+ return H5FD_MEM_DRAW;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1GHEAP(JNIEnv *env, jclass cls) { return H5FD_MEM_GHEAP; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1GHEAP(JNIEnv *env, jclass cls)
+{
+ return H5FD_MEM_GHEAP;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1LHEAP(JNIEnv *env, jclass cls) { return H5FD_MEM_LHEAP; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1LHEAP(JNIEnv *env, jclass cls)
+{
+ return H5FD_MEM_LHEAP;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1OHDR(JNIEnv *env, jclass cls) { return H5FD_MEM_OHDR; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1OHDR(JNIEnv *env, jclass cls)
+{
+ return H5FD_MEM_OHDR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1NTYPES(JNIEnv *env, jclass cls) { return H5FD_MEM_NTYPES; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1NTYPES(JNIEnv *env, jclass cls)
+{
+ return H5FD_MEM_NTYPES;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1DEFAULT_1HADDR_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(HADDR_MAX/H5FD_MEM_NTYPES); }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1DEFAULT_1HADDR_1SIZE(JNIEnv *env, jclass cls)
+{
+ return (hsize_t)(HADDR_MAX / H5FD_MEM_NTYPES);
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)0; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1SIZE(JNIEnv *env, jclass cls)
+{
+ return (hsize_t)0;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1SUPER_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)0; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1SUPER_1SIZE(JNIEnv *env, jclass cls)
+{
+ return (hsize_t)0;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1BTREE_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(1 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1BTREE_1SIZE(JNIEnv *env, jclass cls)
+{
+ return (hsize_t)(1 * (HADDR_MAX / (H5FD_MEM_NTYPES - 1)));
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1DRAW_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(2 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1DRAW_1SIZE(JNIEnv *env, jclass cls)
+{
+ return (hsize_t)(2 * (HADDR_MAX / (H5FD_MEM_NTYPES - 1)));
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1GHEAP_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(3 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1GHEAP_1SIZE(JNIEnv *env, jclass cls)
+{
+ return (hsize_t)(3 * (HADDR_MAX / (H5FD_MEM_NTYPES - 1)));
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1LHEAP_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(4 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1LHEAP_1SIZE(JNIEnv *env, jclass cls)
+{
+ return (hsize_t)(4 * (HADDR_MAX / (H5FD_MEM_NTYPES - 1)));
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1OHDR_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(5 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); }
-
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1OHDR_1SIZE(JNIEnv *env, jclass cls)
+{
+ return (hsize_t)(5 * (HADDR_MAX / (H5FD_MEM_NTYPES - 1)));
+}
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -574,147 +1306,351 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1OHDR_1SIZE(JNIEnv *env, jclas
#ifndef H5_NO_DEPRECATED_SYMBOLS
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1DATASET(JNIEnv *env, jclass cls) { return H5G_DATASET; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1DATASET(JNIEnv *env, jclass cls)
+{
+ return H5G_DATASET;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1GROUP(JNIEnv *env, jclass cls) { return H5G_GROUP; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1GROUP(JNIEnv *env, jclass cls)
+{
+ return H5G_GROUP;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK(JNIEnv *env, jclass cls) { return H5G_LINK; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK(JNIEnv *env, jclass cls)
+{
+ return H5G_LINK;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1UDLINK(JNIEnv *env, jclass cls) { return H5G_UDLINK; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1UDLINK(JNIEnv *env, jclass cls)
+{
+ return H5G_UDLINK;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_15(JNIEnv *env, jclass cls) { return H5G_RESERVED_5; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_15(JNIEnv *env, jclass cls)
+{
+ return H5G_RESERVED_5;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_16(JNIEnv *env, jclass cls) { return H5G_RESERVED_6; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_16(JNIEnv *env, jclass cls)
+{
+ return H5G_RESERVED_6;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_17(JNIEnv *env, jclass cls) { return H5G_RESERVED_7; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_17(JNIEnv *env, jclass cls)
+{
+ return H5G_RESERVED_7;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1TYPE(JNIEnv *env, jclass cls) { return H5G_TYPE; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1TYPE(JNIEnv *env, jclass cls)
+{
+ return H5G_TYPE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1UNKNOWN(JNIEnv *env, jclass cls) { return H5G_UNKNOWN; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1UNKNOWN(JNIEnv *env, jclass cls)
+{
+ return H5G_UNKNOWN;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1ERROR(JNIEnv *env, jclass cls) { return H5G_LINK_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5G_LINK_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1HARD(JNIEnv *env, jclass cls) { return H5G_LINK_HARD; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1HARD(JNIEnv *env, jclass cls)
+{
+ return H5G_LINK_HARD;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1SOFT(JNIEnv *env, jclass cls) { return H5G_LINK_SOFT; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1SOFT(JNIEnv *env, jclass cls)
+{
+ return H5G_LINK_SOFT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1NLIBTYPES(JNIEnv *env, jclass cls) { return H5G_NLIBTYPES; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1NLIBTYPES(JNIEnv *env, jclass cls)
+{
+ return H5G_NLIBTYPES;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1NTYPES(JNIEnv *env, jclass cls) { return H5G_NTYPES; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1NTYPES(JNIEnv *env, jclass cls)
+{
+ return H5G_NTYPES;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1NUSERTYPES(JNIEnv *env, jclass cls) { return H5G_NUSERTYPES; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1NUSERTYPES(JNIEnv *env, jclass cls)
+{
+ return H5G_NUSERTYPES;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1SAME_1LOC(JNIEnv *env, jclass cls) { return H5G_SAME_LOC; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1SAME_1LOC(JNIEnv *env, jclass cls)
+{
+ return H5G_SAME_LOC;
+}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1UNKNOWN(JNIEnv *env, jclass cls){ return H5G_STORAGE_TYPE_UNKNOWN; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1UNKNOWN(JNIEnv *env, jclass cls)
+{
+ return H5G_STORAGE_TYPE_UNKNOWN;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1SYMBOL_1TABLE(JNIEnv *env, jclass cls){ return H5G_STORAGE_TYPE_SYMBOL_TABLE; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1SYMBOL_1TABLE(JNIEnv *env, jclass cls)
+{
+ return H5G_STORAGE_TYPE_SYMBOL_TABLE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1COMPACT(JNIEnv *env, jclass cls){ return H5G_STORAGE_TYPE_COMPACT; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1COMPACT(JNIEnv *env, jclass cls)
+{
+ return H5G_STORAGE_TYPE_COMPACT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1DENSE(JNIEnv *env, jclass cls){ return H5G_STORAGE_TYPE_DENSE; }
+Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1DENSE(JNIEnv *env, jclass cls)
+{
+ return H5G_STORAGE_TYPE_DENSE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1UNINIT(JNIEnv *env, jclass cls) { return H5I_UNINIT; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1UNINIT(JNIEnv *env, jclass cls)
+{
+ return H5I_UNINIT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1BADID(JNIEnv *env, jclass cls) { return H5I_BADID; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1BADID(JNIEnv *env, jclass cls)
+{
+ return H5I_BADID;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1FILE(JNIEnv *env, jclass cls) { return H5I_FILE; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1FILE(JNIEnv *env, jclass cls)
+{
+ return H5I_FILE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1GROUP(JNIEnv *env, jclass cls) { return H5I_GROUP; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1GROUP(JNIEnv *env, jclass cls)
+{
+ return H5I_GROUP;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1DATATYPE(JNIEnv *env, jclass cls) { return H5I_DATATYPE; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1DATATYPE(JNIEnv *env, jclass cls)
+{
+ return H5I_DATATYPE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1DATASPACE(JNIEnv *env, jclass cls) { return H5I_DATASPACE; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1DATASPACE(JNIEnv *env, jclass cls)
+{
+ return H5I_DATASPACE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1DATASET(JNIEnv *env, jclass cls) { return H5I_DATASET; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1DATASET(JNIEnv *env, jclass cls)
+{
+ return H5I_DATASET;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1ATTR(JNIEnv *env, jclass cls) { return H5I_ATTR; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1ATTR(JNIEnv *env, jclass cls)
+{
+ return H5I_ATTR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1VFL(JNIEnv *env, jclass cls) { return H5I_VFL; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1VFL(JNIEnv *env, jclass cls)
+{
+ return H5I_VFL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1VOL(JNIEnv *env, jclass cls) { return H5I_VOL; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1VOL(JNIEnv *env, jclass cls)
+{
+ return H5I_VOL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1INVALID_1HID(JNIEnv *env, jclass cls) { return H5I_INVALID_HID; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1INVALID_1HID(JNIEnv *env, jclass cls)
+{
+ return H5I_INVALID_HID;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1GENPROP_1CLS(JNIEnv *env, jclass cls) { return H5I_GENPROP_CLS; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1GENPROP_1CLS(JNIEnv *env, jclass cls)
+{
+ return H5I_GENPROP_CLS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1GENPROP_1LST(JNIEnv *env, jclass cls) { return H5I_GENPROP_LST; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1GENPROP_1LST(JNIEnv *env, jclass cls)
+{
+ return H5I_GENPROP_LST;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1ERROR_1CLASS(JNIEnv *env, jclass cls) { return H5I_ERROR_CLASS; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1ERROR_1CLASS(JNIEnv *env, jclass cls)
+{
+ return H5I_ERROR_CLASS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1ERROR_1MSG(JNIEnv *env, jclass cls) { return H5I_ERROR_MSG; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1ERROR_1MSG(JNIEnv *env, jclass cls)
+{
+ return H5I_ERROR_MSG;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1ERROR_1STACK(JNIEnv *env, jclass cls) { return H5I_ERROR_STACK; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1ERROR_1STACK(JNIEnv *env, jclass cls)
+{
+ return H5I_ERROR_STACK;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1NTYPES(JNIEnv *env, jclass cls) { return H5I_NTYPES; }
+Java_hdf_hdf5lib_HDF5Constants_H5I_1NTYPES(JNIEnv *env, jclass cls)
+{
+ return H5I_NTYPES;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1ERROR(JNIEnv *env, jclass cls) { return H5L_TYPE_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5L_TYPE_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1HARD(JNIEnv *env, jclass cls) { return H5L_TYPE_HARD; }
+Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1HARD(JNIEnv *env, jclass cls)
+{
+ return H5L_TYPE_HARD;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1SOFT(JNIEnv *env, jclass cls) { return H5L_TYPE_SOFT; }
+Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1SOFT(JNIEnv *env, jclass cls)
+{
+ return H5L_TYPE_SOFT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1EXTERNAL(JNIEnv *env, jclass cls) { return H5L_TYPE_EXTERNAL; }
+Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1EXTERNAL(JNIEnv *env, jclass cls)
+{
+ return H5L_TYPE_EXTERNAL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1MAX(JNIEnv *env, jclass cls) { return H5L_TYPE_MAX; }
+Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1MAX(JNIEnv *env, jclass cls)
+{
+ return H5L_TYPE_MAX;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1SHALLOW_1HIERARCHY_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_SHALLOW_HIERARCHY_FLAG; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1SHALLOW_1HIERARCHY_1FLAG(JNIEnv *env, jclass cls)
+{
+ return H5O_COPY_SHALLOW_HIERARCHY_FLAG;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1EXPAND_1SOFT_1LINK_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_EXPAND_SOFT_LINK_FLAG; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1EXPAND_1SOFT_1LINK_1FLAG(JNIEnv *env, jclass cls)
+{
+ return H5O_COPY_EXPAND_SOFT_LINK_FLAG;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1EXPAND_1EXT_1LINK_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_EXPAND_EXT_LINK_FLAG; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1EXPAND_1EXT_1LINK_1FLAG(JNIEnv *env, jclass cls)
+{
+ return H5O_COPY_EXPAND_EXT_LINK_FLAG;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1EXPAND_1REFERENCE_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_EXPAND_REFERENCE_FLAG; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1EXPAND_1REFERENCE_1FLAG(JNIEnv *env, jclass cls)
+{
+ return H5O_COPY_EXPAND_REFERENCE_FLAG;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1WITHOUT_1ATTR_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_WITHOUT_ATTR_FLAG; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1WITHOUT_1ATTR_1FLAG(JNIEnv *env, jclass cls)
+{
+ return H5O_COPY_WITHOUT_ATTR_FLAG;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1PRESERVE_1NULL_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_PRESERVE_NULL_FLAG; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1PRESERVE_1NULL_1FLAG(JNIEnv *env, jclass cls)
+{
+ return H5O_COPY_PRESERVE_NULL_FLAG;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1BASIC(JNIEnv *env, jclass cls) { return H5O_INFO_BASIC; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1BASIC(JNIEnv *env, jclass cls)
+{
+ return H5O_INFO_BASIC;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1TIME(JNIEnv *env, jclass cls) { return H5O_INFO_TIME; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1TIME(JNIEnv *env, jclass cls)
+{
+ return H5O_INFO_TIME;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1NUM_1ATTRS(JNIEnv *env, jclass cls) { return H5O_INFO_NUM_ATTRS; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1NUM_1ATTRS(JNIEnv *env, jclass cls)
+{
+ return H5O_INFO_NUM_ATTRS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1ALL(JNIEnv *env, jclass cls) { return H5O_INFO_ALL; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1ALL(JNIEnv *env, jclass cls)
+{
+ return H5O_INFO_ALL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1NATIVE_1INFO_1HDR(JNIEnv *env, jclass cls) { return H5O_NATIVE_INFO_HDR; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1NATIVE_1INFO_1HDR(JNIEnv *env, jclass cls)
+{
+ return H5O_NATIVE_INFO_HDR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1NATIVE_1INFO_1META_1SIZE(JNIEnv *env, jclass cls) { return H5O_NATIVE_INFO_META_SIZE; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1NATIVE_1INFO_1META_1SIZE(JNIEnv *env, jclass cls)
+{
+ return H5O_NATIVE_INFO_META_SIZE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1NATIVE_1INFO_1ALL(JNIEnv *env, jclass cls) { return H5O_NATIVE_INFO_ALL; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1NATIVE_1INFO_1ALL(JNIEnv *env, jclass cls)
+{
+ return H5O_NATIVE_INFO_ALL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1NONE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_NONE_FLAG; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1NONE_1FLAG(JNIEnv *env, jclass cls)
+{
+ return H5O_SHMESG_NONE_FLAG;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1SDSPACE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_SDSPACE_FLAG; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1SDSPACE_1FLAG(JNIEnv *env, jclass cls)
+{
+ return H5O_SHMESG_SDSPACE_FLAG;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1DTYPE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_DTYPE_FLAG; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1DTYPE_1FLAG(JNIEnv *env, jclass cls)
+{
+ return H5O_SHMESG_DTYPE_FLAG;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1FILL_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_FILL_FLAG; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1FILL_1FLAG(JNIEnv *env, jclass cls)
+{
+ return H5O_SHMESG_FILL_FLAG;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1PLINE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_PLINE_FLAG; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1PLINE_1FLAG(JNIEnv *env, jclass cls)
+{
+ return H5O_SHMESG_PLINE_FLAG;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1ATTR_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_ATTR_FLAG; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1ATTR_1FLAG(JNIEnv *env, jclass cls)
+{
+ return H5O_SHMESG_ATTR_FLAG;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1ALL_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_ALL_FLAG; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1ALL_1FLAG(JNIEnv *env, jclass cls)
+{
+ return H5O_SHMESG_ALL_FLAG;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1UNKNOWN(JNIEnv *env, jclass cls) { return H5O_TYPE_UNKNOWN; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1UNKNOWN(JNIEnv *env, jclass cls)
+{
+ return H5O_TYPE_UNKNOWN;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1GROUP(JNIEnv *env, jclass cls) { return H5O_TYPE_GROUP; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1GROUP(JNIEnv *env, jclass cls)
+{
+ return H5O_TYPE_GROUP;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1DATASET(JNIEnv *env, jclass cls) { return H5O_TYPE_DATASET; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1DATASET(JNIEnv *env, jclass cls)
+{
+ return H5O_TYPE_DATASET;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1NAMED_1DATATYPE(JNIEnv *env, jclass cls) { return H5O_TYPE_NAMED_DATATYPE; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1NAMED_1DATATYPE(JNIEnv *env, jclass cls)
+{
+ return H5O_TYPE_NAMED_DATATYPE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1NTYPES(JNIEnv *env, jclass cls) { return H5O_TYPE_NTYPES; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1NTYPES(JNIEnv *env, jclass cls)
+{
+ return H5O_TYPE_NTYPES;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5O_1MAX_1TOKEN_1SIZE(JNIEnv *env, jclass cls) { return H5O_MAX_TOKEN_SIZE; }
+Java_hdf_hdf5lib_HDF5Constants_H5O_1MAX_1TOKEN_1SIZE(JNIEnv *env, jclass cls)
+{
+ return H5O_MAX_TOKEN_SIZE;
+}
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5O_1TOKEN_1UNDEF(JNIEnv *env, jclass cls)
{
@@ -725,690 +1661,1707 @@ Java_hdf_hdf5lib_HDF5Constants_H5O_1TOKEN_1UNDEF(JNIEnv *env, jclass cls)
}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1ROOT(JNIEnv *env, jclass cls){return H5P_ROOT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1ROOT(JNIEnv *env, jclass cls)
+{
+ return H5P_ROOT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1OBJECT_1CREATE(JNIEnv *env, jclass cls){return H5P_OBJECT_CREATE;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1OBJECT_1CREATE(JNIEnv *env, jclass cls)
+{
+ return H5P_OBJECT_CREATE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1CREATE(JNIEnv *env, jclass cls){return H5P_FILE_CREATE;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1CREATE(JNIEnv *env, jclass cls)
+{
+ return H5P_FILE_CREATE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1ACCESS(JNIEnv *env, jclass cls){return H5P_FILE_ACCESS;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1ACCESS(JNIEnv *env, jclass cls)
+{
+ return H5P_FILE_ACCESS;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1CREATE(JNIEnv *env, jclass cls){return H5P_DATASET_CREATE;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1CREATE(JNIEnv *env, jclass cls)
+{
+ return H5P_DATASET_CREATE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1ACCESS(JNIEnv *env, jclass cls){return H5P_DATASET_ACCESS;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1ACCESS(JNIEnv *env, jclass cls)
+{
+ return H5P_DATASET_ACCESS;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1XFER(JNIEnv *env, jclass cls){return H5P_DATASET_XFER;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1XFER(JNIEnv *env, jclass cls)
+{
+ return H5P_DATASET_XFER;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1MOUNT(JNIEnv *env, jclass cls){return H5P_FILE_MOUNT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1MOUNT(JNIEnv *env, jclass cls)
+{
+ return H5P_FILE_MOUNT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1CREATE(JNIEnv *env, jclass cls){return H5P_GROUP_CREATE;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1CREATE(JNIEnv *env, jclass cls)
+{
+ return H5P_GROUP_CREATE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1ACCESS(JNIEnv *env, jclass cls){return H5P_GROUP_ACCESS;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1ACCESS(JNIEnv *env, jclass cls)
+{
+ return H5P_GROUP_ACCESS;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1CREATE(JNIEnv *env, jclass cls){return H5P_DATATYPE_CREATE;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1CREATE(JNIEnv *env, jclass cls)
+{
+ return H5P_DATATYPE_CREATE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1ACCESS(JNIEnv *env, jclass cls){return H5P_DATATYPE_ACCESS;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1ACCESS(JNIEnv *env, jclass cls)
+{
+ return H5P_DATATYPE_ACCESS;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1STRING_1CREATE(JNIEnv *env, jclass cls){return H5P_STRING_CREATE;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1STRING_1CREATE(JNIEnv *env, jclass cls)
+{
+ return H5P_STRING_CREATE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1CREATE(JNIEnv *env, jclass cls){return H5P_ATTRIBUTE_CREATE;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1CREATE(JNIEnv *env, jclass cls)
+{
+ return H5P_ATTRIBUTE_CREATE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1ACCESS(JNIEnv *env, jclass cls){return H5P_ATTRIBUTE_ACCESS;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1ACCESS(JNIEnv *env, jclass cls)
+{
+ return H5P_ATTRIBUTE_ACCESS;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1OBJECT_1COPY(JNIEnv *env, jclass cls){return H5P_OBJECT_COPY;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1OBJECT_1COPY(JNIEnv *env, jclass cls)
+{
+ return H5P_OBJECT_COPY;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1CREATE(JNIEnv *env, jclass cls){return H5P_LINK_CREATE;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1CREATE(JNIEnv *env, jclass cls)
+{
+ return H5P_LINK_CREATE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1ACCESS(JNIEnv *env, jclass cls){return H5P_LINK_ACCESS;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1ACCESS(JNIEnv *env, jclass cls)
+{
+ return H5P_LINK_ACCESS;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1VOL_1INITIALIZE(JNIEnv *env, jclass cls){return H5P_VOL_INITIALIZE;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1VOL_1INITIALIZE(JNIEnv *env, jclass cls)
+{
+ return H5P_VOL_INITIALIZE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_CREATE_DEFAULT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_FILE_CREATE_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_ACCESS_DEFAULT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_FILE_ACCESS_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATASET_CREATE_DEFAULT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1CREATE_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_DATASET_CREATE_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATASET_ACCESS_DEFAULT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_DATASET_ACCESS_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1XFER_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATASET_XFER_DEFAULT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1XFER_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_DATASET_XFER_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1MOUNT_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_MOUNT_DEFAULT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1MOUNT_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_FILE_MOUNT_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_GROUP_CREATE_DEFAULT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1CREATE_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_GROUP_CREATE_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_GROUP_ACCESS_DEFAULT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_GROUP_ACCESS_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATATYPE_CREATE_DEFAULT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_DATATYPE_CREATE_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATATYPE_ACCESS_DEFAULT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_DATATYPE_ACCESS_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_ATTRIBUTE_CREATE_DEFAULT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_ATTRIBUTE_CREATE_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_ATTRIBUTE_ACCESS_DEFAULT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_ATTRIBUTE_ACCESS_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1OBJECT_1COPY_1DEFAULT(JNIEnv *env, jclass cls){return H5P_OBJECT_COPY_DEFAULT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1OBJECT_1COPY_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_OBJECT_COPY_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_LINK_CREATE_DEFAULT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1CREATE_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_LINK_CREATE_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_LINK_ACCESS_DEFAULT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_LINK_ACCESS_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1VOL_1INITIALIZE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_VOL_INITIALIZE_DEFAULT;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1VOL_1INITIALIZE_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_VOL_INITIALIZE_DEFAULT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1CRT_1ORDER_1TRACKED(JNIEnv *env, jclass cls){return H5P_CRT_ORDER_TRACKED;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1CRT_1ORDER_1TRACKED(JNIEnv *env, jclass cls)
+{
+ return H5P_CRT_ORDER_TRACKED;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1CRT_1ORDER_1INDEXED(JNIEnv *env, jclass cls){return H5P_CRT_ORDER_INDEXED;}
+Java_hdf_hdf5lib_HDF5Constants_H5P_1CRT_1ORDER_1INDEXED(JNIEnv *env, jclass cls)
+{
+ return H5P_CRT_ORDER_INDEXED;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1DEFAULT(JNIEnv *env, jclass cls) { return H5P_DEFAULT; }
+Java_hdf_hdf5lib_HDF5Constants_H5P_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5P_DEFAULT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5P_1NO_1CLASS(JNIEnv *env, jclass cls) { return H5P_ROOT; }
+Java_hdf_hdf5lib_HDF5Constants_H5P_1NO_1CLASS(JNIEnv *env, jclass cls)
+{
+ return H5P_ROOT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1ERROR(JNIEnv *env, jclass cls) { return H5PL_TYPE_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5PL_TYPE_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1FILTER(JNIEnv *env, jclass cls) { return H5PL_TYPE_FILTER; }
+Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1FILTER(JNIEnv *env, jclass cls)
+{
+ return H5PL_TYPE_FILTER;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1VOL(JNIEnv *env, jclass cls) { return H5PL_TYPE_VOL; }
+Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1VOL(JNIEnv *env, jclass cls)
+{
+ return H5PL_TYPE_VOL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1NONE(JNIEnv *env, jclass cls) { return H5PL_TYPE_NONE; }
+Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1NONE(JNIEnv *env, jclass cls)
+{
+ return H5PL_TYPE_NONE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5PL_1FILTER_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_FILTER_PLUGIN; }
+Java_hdf_hdf5lib_HDF5Constants_H5PL_1FILTER_1PLUGIN(JNIEnv *env, jclass cls)
+{
+ return H5PL_FILTER_PLUGIN;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5PL_1VOL_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_VOL_PLUGIN; }
+Java_hdf_hdf5lib_HDF5Constants_H5PL_1VOL_1PLUGIN(JNIEnv *env, jclass cls)
+{
+ return H5PL_VOL_PLUGIN;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5PL_1ALL_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_ALL_PLUGIN; }
+Java_hdf_hdf5lib_HDF5Constants_H5PL_1ALL_1PLUGIN(JNIEnv *env, jclass cls)
+{
+ return H5PL_ALL_PLUGIN;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5R_1BADTYPE(JNIEnv *env, jclass cls) { return H5R_BADTYPE; }
+Java_hdf_hdf5lib_HDF5Constants_H5R_1BADTYPE(JNIEnv *env, jclass cls)
+{
+ return H5R_BADTYPE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5R_1MAXTYPE(JNIEnv *env, jclass cls) { return H5R_MAXTYPE; }
+Java_hdf_hdf5lib_HDF5Constants_H5R_1MAXTYPE(JNIEnv *env, jclass cls)
+{
+ return H5R_MAXTYPE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5R_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls) { return H5R_REF_BUF_SIZE; }
+Java_hdf_hdf5lib_HDF5Constants_H5R_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls)
+{
+ return H5R_REF_BUF_SIZE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJ_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls) { return H5R_OBJ_REF_BUF_SIZE; }
+Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJ_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls)
+{
+ return H5R_OBJ_REF_BUF_SIZE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5R_1DSET_1REG_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls) { return H5R_DSET_REG_REF_BUF_SIZE; }
+Java_hdf_hdf5lib_HDF5Constants_H5R_1DSET_1REG_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls)
+{
+ return H5R_DSET_REG_REF_BUF_SIZE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5R_1ATTR(JNIEnv *env, jclass cls) { return H5R_ATTR; }
+Java_hdf_hdf5lib_HDF5Constants_H5R_1ATTR(JNIEnv *env, jclass cls)
+{
+ return H5R_ATTR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT(JNIEnv *env, jclass cls) { return H5R_OBJECT; }
+Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT(JNIEnv *env, jclass cls)
+{
+ return H5R_OBJECT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT1(JNIEnv *env, jclass cls) { return H5R_OBJECT1; }
+Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT1(JNIEnv *env, jclass cls)
+{
+ return H5R_OBJECT1;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT2(JNIEnv *env, jclass cls) { return H5R_OBJECT2; }
+Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT2(JNIEnv *env, jclass cls)
+{
+ return H5R_OBJECT2;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION(JNIEnv *env, jclass cls) { return H5R_DATASET_REGION; }
+Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION(JNIEnv *env, jclass cls)
+{
+ return H5R_DATASET_REGION;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION1(JNIEnv *env, jclass cls) { return H5R_DATASET_REGION1; }
+Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION1(JNIEnv *env, jclass cls)
+{
+ return H5R_DATASET_REGION1;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION2(JNIEnv *env, jclass cls) { return H5R_DATASET_REGION2; }
+Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION2(JNIEnv *env, jclass cls)
+{
+ return H5R_DATASET_REGION2;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1ALL(JNIEnv *env, jclass cls) { return H5S_ALL; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1ALL(JNIEnv *env, jclass cls)
+{
+ return H5S_ALL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1MAX_1RANK(JNIEnv *env, jclass cls) { return H5S_MAX_RANK; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1MAX_1RANK(JNIEnv *env, jclass cls)
+{
+ return H5S_MAX_RANK;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1NO_1CLASS(JNIEnv *env, jclass cls) { return H5S_NO_CLASS; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1NO_1CLASS(JNIEnv *env, jclass cls)
+{
+ return H5S_NO_CLASS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1NULL(JNIEnv *env, jclass cls) { return H5S_NULL; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1NULL(JNIEnv *env, jclass cls)
+{
+ return H5S_NULL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SCALAR(JNIEnv *env, jclass cls) { return H5S_SCALAR; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SCALAR(JNIEnv *env, jclass cls)
+{
+ return H5S_SCALAR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1ALL(JNIEnv *env, jclass cls) { return H5S_SEL_ALL; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1ALL(JNIEnv *env, jclass cls)
+{
+ return H5S_SEL_ALL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1ERROR(JNIEnv *env, jclass cls) { return H5S_SEL_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5S_SEL_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1HYPERSLABS(JNIEnv *env, jclass cls) { return H5S_SEL_HYPERSLABS; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1HYPERSLABS(JNIEnv *env, jclass cls)
+{
+ return H5S_SEL_HYPERSLABS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1N(JNIEnv *env, jclass cls) { return H5S_SEL_N; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1N(JNIEnv *env, jclass cls)
+{
+ return H5S_SEL_N;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1NONE(JNIEnv *env, jclass cls) { return H5S_SEL_NONE; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1NONE(JNIEnv *env, jclass cls)
+{
+ return H5S_SEL_NONE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1POINTS(JNIEnv *env, jclass cls) { return H5S_SEL_POINTS; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1POINTS(JNIEnv *env, jclass cls)
+{
+ return H5S_SEL_POINTS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1AND(JNIEnv *env, jclass cls) { return H5S_SELECT_AND; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1AND(JNIEnv *env, jclass cls)
+{
+ return H5S_SELECT_AND;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1APPEND(JNIEnv *env, jclass cls) { return H5S_SELECT_APPEND; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1APPEND(JNIEnv *env, jclass cls)
+{
+ return H5S_SELECT_APPEND;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1INVALID(JNIEnv *env, jclass cls) { return H5S_SELECT_INVALID; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1INVALID(JNIEnv *env, jclass cls)
+{
+ return H5S_SELECT_INVALID;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1NOOP(JNIEnv *env, jclass cls) { return H5S_SELECT_NOOP; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1NOOP(JNIEnv *env, jclass cls)
+{
+ return H5S_SELECT_NOOP;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1NOTA(JNIEnv *env, jclass cls) { return H5S_SELECT_NOTA; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1NOTA(JNIEnv *env, jclass cls)
+{
+ return H5S_SELECT_NOTA;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1NOTB(JNIEnv *env, jclass cls) { return H5S_SELECT_NOTB; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1NOTB(JNIEnv *env, jclass cls)
+{
+ return H5S_SELECT_NOTB;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1OR(JNIEnv *env, jclass cls) { return H5S_SELECT_OR; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1OR(JNIEnv *env, jclass cls)
+{
+ return H5S_SELECT_OR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1PREPEND(JNIEnv *env, jclass cls) { return H5S_SELECT_PREPEND; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1PREPEND(JNIEnv *env, jclass cls)
+{
+ return H5S_SELECT_PREPEND;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1SET(JNIEnv *env, jclass cls) { return H5S_SELECT_SET; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1SET(JNIEnv *env, jclass cls)
+{
+ return H5S_SELECT_SET;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1XOR(JNIEnv *env, jclass cls) { return H5S_SELECT_XOR; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1XOR(JNIEnv *env, jclass cls)
+{
+ return H5S_SELECT_XOR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1SIMPLE(JNIEnv *env, jclass cls) { return H5S_SIMPLE; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1SIMPLE(JNIEnv *env, jclass cls)
+{
+ return H5S_SIMPLE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5S_1UNLIMITED(JNIEnv *env, jclass cls) { return (jint)H5S_UNLIMITED; }
+Java_hdf_hdf5lib_HDF5Constants_H5S_1UNLIMITED(JNIEnv *env, jclass cls)
+{
+ return (jint)H5S_UNLIMITED;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B16(JNIEnv *env, jclass cls) { return H5T_ALPHA_B16; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B16(JNIEnv *env, jclass cls)
+{
+ return H5T_ALPHA_B16;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B32(JNIEnv *env, jclass cls) { return H5T_ALPHA_B32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B32(JNIEnv *env, jclass cls)
+{
+ return H5T_ALPHA_B32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B64(JNIEnv *env, jclass cls) { return H5T_ALPHA_B64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B64(JNIEnv *env, jclass cls)
+{
+ return H5T_ALPHA_B64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B8(JNIEnv *env, jclass cls) { return H5T_ALPHA_B8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B8(JNIEnv *env, jclass cls)
+{
+ return H5T_ALPHA_B8;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1F32(JNIEnv *env, jclass cls) { return H5T_ALPHA_F32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1F32(JNIEnv *env, jclass cls)
+{
+ return H5T_ALPHA_F32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1F64(JNIEnv *env, jclass cls) { return H5T_ALPHA_F64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1F64(JNIEnv *env, jclass cls)
+{
+ return H5T_ALPHA_F64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I16(JNIEnv *env, jclass cls) { return H5T_ALPHA_I16; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I16(JNIEnv *env, jclass cls)
+{
+ return H5T_ALPHA_I16;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I32(JNIEnv *env, jclass cls) { return H5T_ALPHA_I32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I32(JNIEnv *env, jclass cls)
+{
+ return H5T_ALPHA_I32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I64(JNIEnv *env, jclass cls) { return H5T_ALPHA_I64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I64(JNIEnv *env, jclass cls)
+{
+ return H5T_ALPHA_I64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I8(JNIEnv *env, jclass cls) { return H5T_ALPHA_I8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I8(JNIEnv *env, jclass cls)
+{
+ return H5T_ALPHA_I8;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U16(JNIEnv *env, jclass cls) { return H5T_ALPHA_U16; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U16(JNIEnv *env, jclass cls)
+{
+ return H5T_ALPHA_U16;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U32(JNIEnv *env, jclass cls) { return H5T_ALPHA_U32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U32(JNIEnv *env, jclass cls)
+{
+ return H5T_ALPHA_U32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U64(JNIEnv *env, jclass cls) { return H5T_ALPHA_U64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U64(JNIEnv *env, jclass cls)
+{
+ return H5T_ALPHA_U64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U8(JNIEnv *env, jclass cls) { return H5T_ALPHA_U8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U8(JNIEnv *env, jclass cls)
+{
+ return H5T_ALPHA_U8;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ARRAY(JNIEnv *env, jclass cls) { return H5T_ARRAY; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ARRAY(JNIEnv *env, jclass cls)
+{
+ return H5T_ARRAY;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1BITFIELD(JNIEnv *env, jclass cls) { return H5T_BITFIELD; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1BITFIELD(JNIEnv *env, jclass cls)
+{
+ return H5T_BITFIELD;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1BKG_1NO(JNIEnv *env, jclass cls) { return H5T_BKG_NO; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1BKG_1NO(JNIEnv *env, jclass cls)
+{
+ return H5T_BKG_NO;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1BKG_1YES(JNIEnv *env, jclass cls) { return H5T_BKG_YES; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1BKG_1YES(JNIEnv *env, jclass cls)
+{
+ return H5T_BKG_YES;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1C_1S1(JNIEnv *env, jclass cls) { return H5T_C_S1; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1C_1S1(JNIEnv *env, jclass cls)
+{
+ return H5T_C_S1;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1COMPOUND(JNIEnv *env, jclass cls) { return H5T_COMPOUND; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1COMPOUND(JNIEnv *env, jclass cls)
+{
+ return H5T_COMPOUND;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CONV_1CONV(JNIEnv *env, jclass cls) { return H5T_CONV_CONV; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CONV_1CONV(JNIEnv *env, jclass cls)
+{
+ return H5T_CONV_CONV;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CONV_1FREE(JNIEnv *env, jclass cls) { return H5T_CONV_FREE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CONV_1FREE(JNIEnv *env, jclass cls)
+{
+ return H5T_CONV_FREE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CONV_1INIT(JNIEnv *env, jclass cls) { return H5T_CONV_INIT; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CONV_1INIT(JNIEnv *env, jclass cls)
+{
+ return H5T_CONV_INIT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1ERROR(JNIEnv *env, jclass cls) { return H5T_CSET_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1ASCII(JNIEnv *env, jclass cls) { return H5T_CSET_ASCII; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1ASCII(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_ASCII;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1UTF8(JNIEnv *env, jclass cls) { return H5T_CSET_UTF8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1UTF8(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_UTF8;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_110(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_10; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_110(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_RESERVED_10;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_111(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_11; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_111(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_RESERVED_11;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_112(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_12; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_112(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_RESERVED_12;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_113(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_13; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_113(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_RESERVED_13;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_114(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_14; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_114(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_RESERVED_14;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_115(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_15; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_115(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_RESERVED_15;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_12(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_2; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_12(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_RESERVED_2;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_13(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_3; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_13(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_RESERVED_3;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_14(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_4; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_14(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_RESERVED_4;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_15(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_5; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_15(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_RESERVED_5;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_16(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_6; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_16(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_RESERVED_6;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_17(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_7; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_17(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_RESERVED_7;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_18(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_18(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_RESERVED_8;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_19(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_9; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_19(JNIEnv *env, jclass cls)
+{
+ return H5T_CSET_RESERVED_9;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1DIR_1ASCEND(JNIEnv *env, jclass cls) { return H5T_DIR_ASCEND; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1DIR_1ASCEND(JNIEnv *env, jclass cls)
+{
+ return H5T_DIR_ASCEND;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1DIR_1DEFAULT(JNIEnv *env, jclass cls) { return H5T_DIR_DEFAULT; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1DIR_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5T_DIR_DEFAULT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1DIR_1DESCEND(JNIEnv *env, jclass cls) { return H5T_DIR_DESCEND; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1DIR_1DESCEND(JNIEnv *env, jclass cls)
+{
+ return H5T_DIR_DESCEND;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ENUM(JNIEnv *env, jclass cls) { return H5T_ENUM; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ENUM(JNIEnv *env, jclass cls)
+{
+ return H5T_ENUM;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1FLOAT(JNIEnv *env, jclass cls) { return H5T_FLOAT; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1FLOAT(JNIEnv *env, jclass cls)
+{
+ return H5T_FLOAT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1FORTRAN_1S1(JNIEnv *env, jclass cls) { return H5T_FORTRAN_S1; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1FORTRAN_1S1(JNIEnv *env, jclass cls)
+{
+ return H5T_FORTRAN_S1;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F32BE(JNIEnv *env, jclass cls) { return H5T_IEEE_F32BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F32BE(JNIEnv *env, jclass cls)
+{
+ return H5T_IEEE_F32BE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F32LE(JNIEnv *env, jclass cls) { return H5T_IEEE_F32LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F32LE(JNIEnv *env, jclass cls)
+{
+ return H5T_IEEE_F32LE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F64BE(JNIEnv *env, jclass cls) { return H5T_IEEE_F64BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F64BE(JNIEnv *env, jclass cls)
+{
+ return H5T_IEEE_F64BE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F64LE(JNIEnv *env, jclass cls) { return H5T_IEEE_F64LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F64LE(JNIEnv *env, jclass cls)
+{
+ return H5T_IEEE_F64LE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEGER(JNIEnv *env, jclass cls) { return H5T_INTEGER; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEGER(JNIEnv *env, jclass cls)
+{
+ return H5T_INTEGER;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B16(JNIEnv *env, jclass cls) { return H5T_INTEL_B16; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B16(JNIEnv *env, jclass cls)
+{
+ return H5T_INTEL_B16;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B32(JNIEnv *env, jclass cls) { return H5T_INTEL_B32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B32(JNIEnv *env, jclass cls)
+{
+ return H5T_INTEL_B32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B64(JNIEnv *env, jclass cls) { return H5T_INTEL_B64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B64(JNIEnv *env, jclass cls)
+{
+ return H5T_INTEL_B64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B8(JNIEnv *env, jclass cls) { return H5T_INTEL_B8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B8(JNIEnv *env, jclass cls)
+{
+ return H5T_INTEL_B8;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1F32(JNIEnv *env, jclass cls) { return H5T_INTEL_F32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1F32(JNIEnv *env, jclass cls)
+{
+ return H5T_INTEL_F32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1F64(JNIEnv *env, jclass cls) { return H5T_INTEL_F64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1F64(JNIEnv *env, jclass cls)
+{
+ return H5T_INTEL_F64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I16(JNIEnv *env, jclass cls) { return H5T_INTEL_I16; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I16(JNIEnv *env, jclass cls)
+{
+ return H5T_INTEL_I16;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I32(JNIEnv *env, jclass cls) { return H5T_INTEL_I32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I32(JNIEnv *env, jclass cls)
+{
+ return H5T_INTEL_I32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I64(JNIEnv *env, jclass cls) { return H5T_INTEL_I64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I64(JNIEnv *env, jclass cls)
+{
+ return H5T_INTEL_I64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I8(JNIEnv *env, jclass cls) { return H5T_INTEL_I8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I8(JNIEnv *env, jclass cls)
+{
+ return H5T_INTEL_I8;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U16(JNIEnv *env, jclass cls) { return H5T_INTEL_U16; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U16(JNIEnv *env, jclass cls)
+{
+ return H5T_INTEL_U16;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U32(JNIEnv *env, jclass cls) { return H5T_INTEL_U32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U32(JNIEnv *env, jclass cls)
+{
+ return H5T_INTEL_U32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U64(JNIEnv *env, jclass cls) { return H5T_INTEL_U64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U64(JNIEnv *env, jclass cls)
+{
+ return H5T_INTEL_U64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U8(JNIEnv *env, jclass cls) { return H5T_INTEL_U8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U8(JNIEnv *env, jclass cls)
+{
+ return H5T_INTEL_U8;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B16(JNIEnv *env, jclass cls) { return H5T_MIPS_B16; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B16(JNIEnv *env, jclass cls)
+{
+ return H5T_MIPS_B16;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B32(JNIEnv *env, jclass cls) { return H5T_MIPS_B32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B32(JNIEnv *env, jclass cls)
+{
+ return H5T_MIPS_B32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B64(JNIEnv *env, jclass cls) { return H5T_MIPS_B64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B64(JNIEnv *env, jclass cls)
+{
+ return H5T_MIPS_B64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B8(JNIEnv *env, jclass cls) { return H5T_MIPS_B8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B8(JNIEnv *env, jclass cls)
+{
+ return H5T_MIPS_B8;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1F32(JNIEnv *env, jclass cls) { return H5T_MIPS_F32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1F32(JNIEnv *env, jclass cls)
+{
+ return H5T_MIPS_F32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1F64(JNIEnv *env, jclass cls) { return H5T_MIPS_F64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1F64(JNIEnv *env, jclass cls)
+{
+ return H5T_MIPS_F64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I16(JNIEnv *env, jclass cls) { return H5T_MIPS_I16; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I16(JNIEnv *env, jclass cls)
+{
+ return H5T_MIPS_I16;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I32(JNIEnv *env, jclass cls) { return H5T_MIPS_I32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I32(JNIEnv *env, jclass cls)
+{
+ return H5T_MIPS_I32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I64(JNIEnv *env, jclass cls) { return H5T_MIPS_I64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I64(JNIEnv *env, jclass cls)
+{
+ return H5T_MIPS_I64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I8(JNIEnv *env, jclass cls) { return H5T_MIPS_I8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I8(JNIEnv *env, jclass cls)
+{
+ return H5T_MIPS_I8;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U16(JNIEnv *env, jclass cls) { return H5T_MIPS_U16; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U16(JNIEnv *env, jclass cls)
+{
+ return H5T_MIPS_U16;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U32(JNIEnv *env, jclass cls) { return H5T_MIPS_U32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U32(JNIEnv *env, jclass cls)
+{
+ return H5T_MIPS_U32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U64(JNIEnv *env, jclass cls) { return H5T_MIPS_U64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U64(JNIEnv *env, jclass cls)
+{
+ return H5T_MIPS_U64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U8(JNIEnv *env, jclass cls) { return H5T_MIPS_U8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U8(JNIEnv *env, jclass cls)
+{
+ return H5T_MIPS_U8;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B16(JNIEnv *env, jclass cls) { return H5T_NATIVE_B16; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B16(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_B16;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B32(JNIEnv *env, jclass cls) { return H5T_NATIVE_B32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B32(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_B32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B64(JNIEnv *env, jclass cls) { return H5T_NATIVE_B64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B64(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_B64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B8(JNIEnv *env, jclass cls) { return H5T_NATIVE_B8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B8(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_B8;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1CHAR(JNIEnv *env, jclass cls) { return H5T_NATIVE_CHAR; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1CHAR(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_CHAR;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1DOUBLE(JNIEnv *env, jclass cls) { return H5T_NATIVE_DOUBLE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1DOUBLE(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_DOUBLE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1FLOAT(JNIEnv *env, jclass cls) { return H5T_NATIVE_FLOAT; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1FLOAT(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_FLOAT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HADDR(JNIEnv *env, jclass cls) { return H5T_NATIVE_HADDR; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HADDR(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_HADDR;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HBOOL(JNIEnv *env, jclass cls) { return H5T_NATIVE_HBOOL; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HBOOL(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_HBOOL;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HERR(JNIEnv *env, jclass cls) { return H5T_NATIVE_HERR; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HERR(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_HERR;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HSIZE(JNIEnv *env, jclass cls) { return H5T_NATIVE_HSIZE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HSIZE(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_HSIZE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HSSIZE(JNIEnv *env, jclass cls) { return H5T_NATIVE_HSSIZE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HSSIZE(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_HSSIZE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_INT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST16(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_FAST16; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST16(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_INT_FAST16;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST32(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_FAST32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST32(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_INT_FAST32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST64(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_FAST64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST64(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_INT_FAST64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST8(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_FAST8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST8(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_INT_FAST8;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST16(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_LEAST16; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST16(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_INT_LEAST16;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST32(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_LEAST32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST32(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_INT_LEAST32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST64(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_LEAST64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST64(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_INT_LEAST64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST8(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_LEAST8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST8(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_INT_LEAST8;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT16(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT16; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT16(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_INT16;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT32(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT32(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_INT32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT64(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT64(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_INT64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT8(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT8(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_INT8;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LDOUBLE(JNIEnv *env, jclass cls) { return H5T_NATIVE_LDOUBLE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LDOUBLE(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_LDOUBLE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LLONG(JNIEnv *env, jclass cls) { return H5T_NATIVE_LLONG; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LLONG(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_LLONG;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LONG(JNIEnv *env, jclass cls) { return H5T_NATIVE_LONG; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LONG(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_LONG;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1OPAQUE(JNIEnv *env, jclass cls) { return H5T_NATIVE_OPAQUE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1OPAQUE(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_OPAQUE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1SCHAR(JNIEnv *env, jclass cls) { return H5T_NATIVE_SCHAR; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1SCHAR(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_SCHAR;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1SHORT(JNIEnv *env, jclass cls) { return H5T_NATIVE_SHORT; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1SHORT(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_SHORT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UCHAR(JNIEnv *env, jclass cls) { return H5T_NATIVE_UCHAR; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UCHAR(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_UCHAR;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_UINT;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST16(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_FAST16; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST16(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_UINT_FAST16;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST32(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_FAST32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST32(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_UINT_FAST32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST64(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_FAST64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST64(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_UINT_FAST64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST8(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_FAST8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST8(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_UINT_FAST8;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST16(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_LEAST16; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST16(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_UINT_LEAST16;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST32(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_LEAST32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST32(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_UINT_LEAST32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST64(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_LEAST64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST64(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_UINT_LEAST64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST8(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_LEAST8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST8(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_UINT_LEAST8;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT16(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT16; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT16(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_UINT16;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT32(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT32; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT32(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_UINT32;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT64(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT64; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT64(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_UINT64;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT8(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT8(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_UINT8;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1ULLONG(JNIEnv *env, jclass cls) { return H5T_NATIVE_ULLONG; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1ULLONG(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_ULLONG;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1ULONG(JNIEnv *env, jclass cls) { return H5T_NATIVE_ULONG; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1ULONG(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_ULONG;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1USHORT(JNIEnv *env, jclass cls) { return H5T_NATIVE_USHORT; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1USHORT(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_USHORT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NCLASSES(JNIEnv *env, jclass cls) { return H5T_NCLASSES; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NCLASSES(JNIEnv *env, jclass cls)
+{
+ return H5T_NCLASSES;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NO_1CLASS(JNIEnv *env, jclass cls) { return H5T_NO_CLASS; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NO_1CLASS(JNIEnv *env, jclass cls)
+{
+ return H5T_NO_CLASS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1ERROR(JNIEnv *env, jclass cls) { return H5T_NORM_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5T_NORM_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1IMPLIED(JNIEnv *env, jclass cls) { return H5T_NORM_IMPLIED; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1IMPLIED(JNIEnv *env, jclass cls)
+{
+ return H5T_NORM_IMPLIED;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1MSBSET(JNIEnv *env, jclass cls) { return H5T_NORM_MSBSET; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1MSBSET(JNIEnv *env, jclass cls)
+{
+ return H5T_NORM_MSBSET;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1NONE(JNIEnv *env, jclass cls) { return H5T_NORM_NONE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1NONE(JNIEnv *env, jclass cls)
+{
+ return H5T_NORM_NONE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NPAD(JNIEnv *env, jclass cls) { return H5T_NPAD; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NPAD(JNIEnv *env, jclass cls)
+{
+ return H5T_NPAD;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1NSGN(JNIEnv *env, jclass cls) { return H5T_NSGN; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NSGN(JNIEnv *env, jclass cls)
+{
+ return H5T_NSGN;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1OPAQUE(JNIEnv *env, jclass cls) { return H5T_OPAQUE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1OPAQUE(JNIEnv *env, jclass cls)
+{
+ return H5T_OPAQUE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1OPAQUE_1TAG_1MAX(JNIEnv *env, jclass cls) { return H5T_OPAQUE_TAG_MAX; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1OPAQUE_1TAG_1MAX(JNIEnv *env, jclass cls)
+{
+ return H5T_OPAQUE_TAG_MAX;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1BE(JNIEnv *env, jclass cls) { return H5T_ORDER_BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1BE(JNIEnv *env, jclass cls)
+{
+ return H5T_ORDER_BE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1ERROR(JNIEnv *env, jclass cls) { return H5T_ORDER_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5T_ORDER_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1LE(JNIEnv *env, jclass cls) { return H5T_ORDER_LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1LE(JNIEnv *env, jclass cls)
+{
+ return H5T_ORDER_LE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1NONE(JNIEnv *env, jclass cls) { return H5T_ORDER_NONE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1NONE(JNIEnv *env, jclass cls)
+{
+ return H5T_ORDER_NONE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1VAX(JNIEnv *env, jclass cls) { return H5T_ORDER_VAX; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1VAX(JNIEnv *env, jclass cls)
+{
+ return H5T_ORDER_VAX;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1BACKGROUND(JNIEnv *env, jclass cls) { return H5T_PAD_BACKGROUND; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1BACKGROUND(JNIEnv *env, jclass cls)
+{
+ return H5T_PAD_BACKGROUND;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1ERROR(JNIEnv *env, jclass cls) { return H5T_PAD_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5T_PAD_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1ONE(JNIEnv *env, jclass cls) { return H5T_PAD_ONE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1ONE(JNIEnv *env, jclass cls)
+{
+ return H5T_PAD_ONE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1ZERO(JNIEnv *env, jclass cls) { return H5T_PAD_ZERO; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1ZERO(JNIEnv *env, jclass cls)
+{
+ return H5T_PAD_ZERO;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1PERS_1DONTCARE(JNIEnv *env, jclass cls) { return H5T_PERS_DONTCARE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1PERS_1DONTCARE(JNIEnv *env, jclass cls)
+{
+ return H5T_PERS_DONTCARE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1PERS_1HARD(JNIEnv *env, jclass cls) { return H5T_PERS_HARD; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1PERS_1HARD(JNIEnv *env, jclass cls)
+{
+ return H5T_PERS_HARD;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1PERS_1SOFT(JNIEnv *env, jclass cls) { return H5T_PERS_SOFT; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1PERS_1SOFT(JNIEnv *env, jclass cls)
+{
+ return H5T_PERS_SOFT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1REFERENCE(JNIEnv *env, jclass cls) { return H5T_REFERENCE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1REFERENCE(JNIEnv *env, jclass cls)
+{
+ return H5T_REFERENCE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1SGN_12(JNIEnv *env, jclass cls) { return H5T_SGN_2; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1SGN_12(JNIEnv *env, jclass cls)
+{
+ return H5T_SGN_2;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1SGN_1ERROR(JNIEnv *env, jclass cls) { return H5T_SGN_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1SGN_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5T_SGN_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1SGN_1NONE(JNIEnv *env, jclass cls) { return H5T_SGN_NONE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1SGN_1NONE(JNIEnv *env, jclass cls)
+{
+ return H5T_SGN_NONE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B16BE(JNIEnv *env, jclass cls) { return H5T_STD_B16BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B16BE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_B16BE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B16LE(JNIEnv *env, jclass cls) { return H5T_STD_B16LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B16LE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_B16LE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B32BE(JNIEnv *env, jclass cls) { return H5T_STD_B32BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B32BE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_B32BE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B32LE(JNIEnv *env, jclass cls) { return H5T_STD_B32LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B32LE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_B32LE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B64BE(JNIEnv *env, jclass cls) { return H5T_STD_B64BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B64BE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_B64BE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B64LE(JNIEnv *env, jclass cls) { return H5T_STD_B64LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B64LE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_B64LE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B8BE(JNIEnv *env, jclass cls) { return H5T_STD_B8BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B8BE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_B8BE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B8LE(JNIEnv *env, jclass cls) { return H5T_STD_B8LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B8LE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_B8LE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I16BE(JNIEnv *env, jclass cls) { return H5T_STD_I16BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I16BE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_I16BE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I16LE(JNIEnv *env, jclass cls) { return H5T_STD_I16LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I16LE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_I16LE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I32BE(JNIEnv *env, jclass cls) { return H5T_STD_I32BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I32BE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_I32BE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I32LE(JNIEnv *env, jclass cls) { return H5T_STD_I32LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I32LE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_I32LE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I64BE(JNIEnv *env, jclass cls) { return H5T_STD_I64BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I64BE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_I64BE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I64LE(JNIEnv *env, jclass cls) { return H5T_STD_I64LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I64LE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_I64LE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I8BE(JNIEnv *env, jclass cls) { return H5T_STD_I8BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I8BE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_I8BE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I8LE(JNIEnv *env, jclass cls) { return H5T_STD_I8LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I8LE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_I8LE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF_1DSETREG(JNIEnv *env, jclass cls) { return H5T_STD_REF_DSETREG; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF_1DSETREG(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_REF_DSETREG;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF_1OBJ(JNIEnv *env, jclass cls) { return H5T_STD_REF_OBJ; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF_1OBJ(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_REF_OBJ;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF(JNIEnv *env, jclass cls) { return H5T_STD_REF; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_REF;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U16BE(JNIEnv *env, jclass cls) { return H5T_STD_U16BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U16BE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_U16BE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U16LE(JNIEnv *env, jclass cls) { return H5T_STD_U16LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U16LE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_U16LE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U32BE(JNIEnv *env, jclass cls) { return H5T_STD_U32BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U32BE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_U32BE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U32LE(JNIEnv *env, jclass cls) { return H5T_STD_U32LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U32LE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_U32LE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U64BE(JNIEnv *env, jclass cls) { return H5T_STD_U64BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U64BE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_U64BE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U64LE(JNIEnv *env, jclass cls) { return H5T_STD_U64LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U64LE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_U64LE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U8BE(JNIEnv *env, jclass cls) { return H5T_STD_U8BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U8BE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_U8BE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U8LE(JNIEnv *env, jclass cls) { return H5T_STD_U8LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U8LE(JNIEnv *env, jclass cls)
+{
+ return H5T_STD_U8LE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1ERROR(JNIEnv *env, jclass cls) { return H5T_STR_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1NULLPAD(JNIEnv *env, jclass cls) { return H5T_STR_NULLPAD; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1NULLPAD(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_NULLPAD;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1NULLTERM(JNIEnv *env, jclass cls) { return H5T_STR_NULLTERM; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1NULLTERM(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_NULLTERM;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_110(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_10; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_110(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_RESERVED_10;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_111(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_11; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_111(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_RESERVED_11;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_112(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_12; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_112(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_RESERVED_12;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_113(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_13; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_113(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_RESERVED_13;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_114(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_14; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_114(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_RESERVED_14;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_115(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_15; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_115(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_RESERVED_15;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_13(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_3; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_13(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_RESERVED_3;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_14(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_4; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_14(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_RESERVED_4;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_15(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_5; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_15(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_RESERVED_5;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_16(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_6; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_16(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_RESERVED_6;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_17(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_7; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_17(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_RESERVED_7;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_18(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_8; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_18(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_RESERVED_8;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_19(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_9; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_19(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_RESERVED_9;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1SPACEPAD(JNIEnv *env, jclass cls) { return H5T_STR_SPACEPAD; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1SPACEPAD(JNIEnv *env, jclass cls)
+{
+ return H5T_STR_SPACEPAD;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1STRING(JNIEnv *env, jclass cls) { return H5T_STRING; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STRING(JNIEnv *env, jclass cls)
+{
+ return H5T_STRING;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1TIME(JNIEnv *env, jclass cls) { return H5T_TIME; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1TIME(JNIEnv *env, jclass cls)
+{
+ return H5T_TIME;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D32BE(JNIEnv *env, jclass cls) { return H5T_UNIX_D32BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D32BE(JNIEnv *env, jclass cls)
+{
+ return H5T_UNIX_D32BE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D32LE(JNIEnv *env, jclass cls) { return H5T_UNIX_D32LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D32LE(JNIEnv *env, jclass cls)
+{
+ return H5T_UNIX_D32LE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D64BE(JNIEnv *env, jclass cls) { return H5T_UNIX_D64BE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D64BE(JNIEnv *env, jclass cls)
+{
+ return H5T_UNIX_D64BE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D64LE(JNIEnv *env, jclass cls) { return H5T_UNIX_D64LE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D64LE(JNIEnv *env, jclass cls)
+{
+ return H5T_UNIX_D64LE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1VARIABLE(JNIEnv *env, jclass cls) { return (int)H5T_VARIABLE; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1VARIABLE(JNIEnv *env, jclass cls)
+{
+ return (int)H5T_VARIABLE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1VLEN(JNIEnv *env, jclass cls) { return H5T_VLEN; }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1VLEN(JNIEnv *env, jclass cls)
+{
+ return H5T_VLEN;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5T_1VL_1T(JNIEnv *env, jclass cls) { return sizeof(hvl_t); }
+Java_hdf_hdf5lib_HDF5Constants_H5T_1VL_1T(JNIEnv *env, jclass cls)
+{
+ return sizeof(hvl_t);
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5VL_1CAP_1FLAG_1NONE(JNIEnv *env, jclass cls) { return H5VL_CAP_FLAG_NONE; }
+Java_hdf_hdf5lib_HDF5Constants_H5VL_1CAP_1FLAG_1NONE(JNIEnv *env, jclass cls)
+{
+ return H5VL_CAP_FLAG_NONE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5VL_1CAP_1FLAG_1THREADSAFE(JNIEnv *env, jclass cls) { return H5VL_CAP_FLAG_THREADSAFE; }
+Java_hdf_hdf5lib_HDF5Constants_H5VL_1CAP_1FLAG_1THREADSAFE(JNIEnv *env, jclass cls)
+{
+ return H5VL_CAP_FLAG_THREADSAFE;
+}
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE(JNIEnv *env, jclass cls) { return H5VL_NATIVE; }
+Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE(JNIEnv *env, jclass cls)
+{
+ return H5VL_NATIVE;
+}
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1NAME(JNIEnv *env, jclass cls) { return (jstring)ENVPTR->NewStringUTF(ENVONLY, H5VL_NATIVE_NAME); }
+Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1NAME(JNIEnv *env, jclass cls)
+{
+ return (jstring)ENVPTR->NewStringUTF(ENVONLY, H5VL_NATIVE_NAME);
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1VALUE(JNIEnv *env, jclass cls) { return H5VL_NATIVE_VALUE; }
+Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1VALUE(JNIEnv *env, jclass cls)
+{
+ return H5VL_NATIVE_VALUE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1VERSION(JNIEnv *env, jclass cls) { return H5VL_NATIVE_VERSION; }
+Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1VERSION(JNIEnv *env, jclass cls)
+{
+ return H5VL_NATIVE_VERSION;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1INVALID(JNIEnv *env, jclass cls) { return H5_VOL_INVALID; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1INVALID(JNIEnv *env, jclass cls)
+{
+ return H5_VOL_INVALID;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1NATIVE(JNIEnv *env, jclass cls) { return H5_VOL_NATIVE; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1NATIVE(JNIEnv *env, jclass cls)
+{
+ return H5_VOL_NATIVE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1RESERVED(JNIEnv *env, jclass cls) { return H5_VOL_RESERVED; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1RESERVED(JNIEnv *env, jclass cls)
+{
+ return H5_VOL_RESERVED;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1MAX(JNIEnv *env, jclass cls) { return H5_VOL_MAX; }
+Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1MAX(JNIEnv *env, jclass cls)
+{
+ return H5_VOL_MAX;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1CONT(JNIEnv *env, jclass cls) { return H5Z_CB_CONT; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1CONT(JNIEnv *env, jclass cls)
+{
+ return H5Z_CB_CONT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1ERROR(JNIEnv *env, jclass cls) { return H5Z_CB_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5Z_CB_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1FAIL(JNIEnv *env, jclass cls) { return H5Z_CB_FAIL; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1FAIL(JNIEnv *env, jclass cls)
+{
+ return H5Z_CB_FAIL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1NO(JNIEnv *env, jclass cls) { return H5Z_CB_NO; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1NO(JNIEnv *env, jclass cls)
+{
+ return H5Z_CB_NO;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1DISABLE_1EDC(JNIEnv *env, jclass cls) { return H5Z_DISABLE_EDC; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1DISABLE_1EDC(JNIEnv *env, jclass cls)
+{
+ return H5Z_DISABLE_EDC;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1ENABLE_1EDC(JNIEnv *env, jclass cls) { return H5Z_ENABLE_EDC; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1ENABLE_1EDC(JNIEnv *env, jclass cls)
+{
+ return H5Z_ENABLE_EDC;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1ERROR_1EDC(JNIEnv *env, jclass cls) { return H5Z_ERROR_EDC; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1ERROR_1EDC(JNIEnv *env, jclass cls)
+{
+ return H5Z_ERROR_EDC;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1CONFIG_1DECODE_1ENABLED(JNIEnv *env, jclass cls) { return H5Z_FILTER_CONFIG_DECODE_ENABLED; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1CONFIG_1DECODE_1ENABLED(JNIEnv *env, jclass cls)
+{
+ return H5Z_FILTER_CONFIG_DECODE_ENABLED;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1CONFIG_1ENCODE_1ENABLED(JNIEnv *env, jclass cls) { return H5Z_FILTER_CONFIG_ENCODE_ENABLED; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1CONFIG_1ENCODE_1ENABLED(JNIEnv *env, jclass cls)
+{
+ return H5Z_FILTER_CONFIG_ENCODE_ENABLED;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1DEFLATE(JNIEnv *env, jclass cls) { return H5Z_FILTER_DEFLATE; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1DEFLATE(JNIEnv *env, jclass cls)
+{
+ return H5Z_FILTER_DEFLATE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1ERROR(JNIEnv *env, jclass cls) { return H5Z_FILTER_ERROR; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1ERROR(JNIEnv *env, jclass cls)
+{
+ return H5Z_FILTER_ERROR;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1FLETCHER32(JNIEnv *env, jclass cls) { return H5Z_FILTER_FLETCHER32; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1FLETCHER32(JNIEnv *env, jclass cls)
+{
+ return H5Z_FILTER_FLETCHER32;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1MAX(JNIEnv *env, jclass cls) { return H5Z_FILTER_MAX; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1MAX(JNIEnv *env, jclass cls)
+{
+ return H5Z_FILTER_MAX;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1NBIT(JNIEnv *env, jclass cls) {return H5Z_FILTER_NBIT; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1NBIT(JNIEnv *env, jclass cls)
+{
+ return H5Z_FILTER_NBIT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1NONE(JNIEnv *env, jclass cls) { return H5Z_FILTER_NONE; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1NONE(JNIEnv *env, jclass cls)
+{
+ return H5Z_FILTER_NONE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1RESERVED(JNIEnv *env, jclass cls) { return H5Z_FILTER_RESERVED; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1RESERVED(JNIEnv *env, jclass cls)
+{
+ return H5Z_FILTER_RESERVED;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1SCALEOFFSET(JNIEnv *env, jclass cls){ return H5Z_FILTER_SCALEOFFSET; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1SCALEOFFSET(JNIEnv *env, jclass cls)
+{
+ return H5Z_FILTER_SCALEOFFSET;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1SHUFFLE(JNIEnv *env, jclass cls) { return H5Z_FILTER_SHUFFLE; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1SHUFFLE(JNIEnv *env, jclass cls)
+{
+ return H5Z_FILTER_SHUFFLE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1SZIP(JNIEnv *env, jclass cls) { return H5Z_FILTER_SZIP; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1SZIP(JNIEnv *env, jclass cls)
+{
+ return H5Z_FILTER_SZIP;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1DEFMASK(JNIEnv *env, jclass cls) { return H5Z_FLAG_DEFMASK; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1DEFMASK(JNIEnv *env, jclass cls)
+{
+ return H5Z_FLAG_DEFMASK;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1INVMASK(JNIEnv *env, jclass cls) { return H5Z_FLAG_INVMASK; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1INVMASK(JNIEnv *env, jclass cls)
+{
+ return H5Z_FLAG_INVMASK;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1MANDATORY(JNIEnv *env, jclass cls) { return H5Z_FLAG_MANDATORY; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1MANDATORY(JNIEnv *env, jclass cls)
+{
+ return H5Z_FLAG_MANDATORY;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1OPTIONAL(JNIEnv *env, jclass cls) { return H5Z_FLAG_OPTIONAL; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1OPTIONAL(JNIEnv *env, jclass cls)
+{
+ return H5Z_FLAG_OPTIONAL;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1REVERSE(JNIEnv *env, jclass cls) { return H5Z_FLAG_REVERSE; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1REVERSE(JNIEnv *env, jclass cls)
+{
+ return H5Z_FLAG_REVERSE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1SKIP_1EDC(JNIEnv *env, jclass cls) { return H5Z_FLAG_SKIP_EDC; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1SKIP_1EDC(JNIEnv *env, jclass cls)
+{
+ return H5Z_FLAG_SKIP_EDC;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1MAX_1NFILTERS(JNIEnv *env, jclass cls) { return H5Z_MAX_NFILTERS; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1MAX_1NFILTERS(JNIEnv *env, jclass cls)
+{
+ return H5Z_MAX_NFILTERS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1NO_1EDC(JNIEnv *env, jclass cls) { return H5Z_NO_EDC; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1NO_1EDC(JNIEnv *env, jclass cls)
+{
+ return H5Z_NO_EDC;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1INT_1MINBITS_1DEFAULT(JNIEnv *env, jclass cls) { return H5Z_SO_INT_MINBITS_DEFAULT; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1INT_1MINBITS_1DEFAULT(JNIEnv *env, jclass cls)
+{
+ return H5Z_SO_INT_MINBITS_DEFAULT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1FLOAT_1DSCALE(JNIEnv *env, jclass cls){return H5Z_SO_FLOAT_DSCALE; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1FLOAT_1DSCALE(JNIEnv *env, jclass cls)
+{
+ return H5Z_SO_FLOAT_DSCALE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1FLOAT_1ESCALE(JNIEnv *env, jclass cls){return H5Z_SO_FLOAT_ESCALE; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1FLOAT_1ESCALE(JNIEnv *env, jclass cls)
+{
+ return H5Z_SO_FLOAT_ESCALE;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1INT(JNIEnv *env, jclass cls){return H5Z_SO_INT; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1INT(JNIEnv *env, jclass cls)
+{
+ return H5Z_SO_INT;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1SHUFFLE_1USER_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SHUFFLE_USER_NPARMS; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1SHUFFLE_1USER_1NPARMS(JNIEnv *env, jclass cls)
+{
+ return H5Z_SHUFFLE_USER_NPARMS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1SHUFFLE_1TOTAL_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SHUFFLE_TOTAL_NPARMS; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1SHUFFLE_1TOTAL_1NPARMS(JNIEnv *env, jclass cls)
+{
+ return H5Z_SHUFFLE_TOTAL_NPARMS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1USER_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SZIP_USER_NPARMS; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1USER_1NPARMS(JNIEnv *env, jclass cls)
+{
+ return H5Z_SZIP_USER_NPARMS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1TOTAL_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SZIP_TOTAL_NPARMS; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1TOTAL_1NPARMS(JNIEnv *env, jclass cls)
+{
+ return H5Z_SZIP_TOTAL_NPARMS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1MASK(JNIEnv *env, jclass cls) { return H5Z_SZIP_PARM_MASK; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1MASK(JNIEnv *env, jclass cls)
+{
+ return H5Z_SZIP_PARM_MASK;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1PPB(JNIEnv *env, jclass cls) { return H5Z_SZIP_PARM_PPB; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1PPB(JNIEnv *env, jclass cls)
+{
+ return H5Z_SZIP_PARM_PPB;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1BPP(JNIEnv *env, jclass cls) { return H5Z_SZIP_PARM_BPP; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1BPP(JNIEnv *env, jclass cls)
+{
+ return H5Z_SZIP_PARM_BPP;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1PPS(JNIEnv *env, jclass cls) { return H5Z_SZIP_PARM_PPS; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1PPS(JNIEnv *env, jclass cls)
+{
+ return H5Z_SZIP_PARM_PPS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1NBIT_1USER_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_NBIT_USER_NPARMS; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1NBIT_1USER_1NPARMS(JNIEnv *env, jclass cls)
+{
+ return H5Z_NBIT_USER_NPARMS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1SCALEOFFSET_1USER_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SCALEOFFSET_USER_NPARMS; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1SCALEOFFSET_1USER_1NPARMS(JNIEnv *env, jclass cls)
+{
+ return H5Z_SCALEOFFSET_USER_NPARMS;
+}
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1ALL(JNIEnv *env, jclass cls) { return H5Z_FILTER_ALL; }
+Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1ALL(JNIEnv *env, jclass cls)
+{
+ return H5Z_FILTER_ALL;
+}
H5_GCC_DIAG_ON("missing-prototypes")
H5_GCC_DIAG_ON("unused-parameter")
@@ -1416,4 +3369,3 @@ H5_GCC_DIAG_ON("unused-parameter")
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
-
diff --git a/java/src/jni/h5Imp.c b/java/src/jni/h5Imp.c
index f0dd691..5773fff 100644
--- a/java/src/jni/h5Imp.c
+++ b/java/src/jni/h5Imp.c
@@ -46,8 +46,7 @@ extern "C" {
* Signature: ()I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5open
- (JNIEnv *env, jclass clss)
+Java_hdf_hdf5lib_H5_H5open(JNIEnv *env, jclass clss)
{
herr_t retVal = FAIL;
@@ -66,8 +65,7 @@ done:
* Signature: ()I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5close
- (JNIEnv *env, jclass clss)
+Java_hdf_hdf5lib_H5_H5close(JNIEnv *env, jclass clss)
{
herr_t retVal = FAIL;
@@ -86,8 +84,7 @@ done:
* Signature: ()I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5dont_1atexit
- (JNIEnv *env, jclass clss)
+Java_hdf_hdf5lib_H5_H5dont_1atexit(JNIEnv *env, jclass clss)
{
herr_t retVal = FAIL;
@@ -106,21 +103,22 @@ done:
* Signature: ([I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5get_1libversion
- (JNIEnv *env, jclass clss, jintArray libversion)
+Java_hdf_hdf5lib_H5_H5get_1libversion(JNIEnv *env, jclass clss, jintArray libversion)
{
- jboolean libversionArrayIsCopy;
- int *libversionArray = NULL;
- herr_t status = FAIL;
+ jboolean libversionArrayIsCopy;
+ int * libversionArray = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
if (libversion == NULL)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5get_libversion: libversion is NULL");
- PIN_INT_ARRAY(ENVONLY, libversion, libversionArray, &libversionArrayIsCopy, "H5get_libversion: libversion input not pinned");
+ PIN_INT_ARRAY(ENVONLY, libversion, libversionArray, &libversionArrayIsCopy,
+ "H5get_libversion: libversion input not pinned");
- if ((status = H5get_libversion((unsigned *) &(libversionArray[0]), (unsigned *) &(libversionArray[1]), (unsigned *) &(libversionArray[2]))) < 0)
+ if ((status = H5get_libversion((unsigned *)&(libversionArray[0]), (unsigned *)&(libversionArray[1]),
+ (unsigned *)&(libversionArray[2]))) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -136,8 +134,7 @@ done:
* Signature: (III)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5check_1version
- (JNIEnv *env, jclass clss, jint majnum, jint minnum, jint relnum)
+Java_hdf_hdf5lib_H5_H5check_1version(JNIEnv *env, jclass clss, jint majnum, jint minnum, jint relnum)
{
UNUSED(env);
UNUSED(clss);
@@ -152,8 +149,7 @@ Java_hdf_hdf5lib_H5_H5check_1version
*
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5garbage_1collect
- (JNIEnv *env, jclass clss)
+Java_hdf_hdf5lib_H5_H5garbage_1collect(JNIEnv *env, jclass clss)
{
herr_t retVal = FAIL;
@@ -172,16 +168,16 @@ done:
* Signature: (IIIIII)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5set_1free_1list_1limits
- (JNIEnv *env, jclass clss, jint reg_global_lim, jint reg_list_lim,
- jint arr_global_lim, jint arr_list_lim, jint blk_global_lim, jint blk_list_lim )
+Java_hdf_hdf5lib_H5_H5set_1free_1list_1limits(JNIEnv *env, jclass clss, jint reg_global_lim,
+ jint reg_list_lim, jint arr_global_lim, jint arr_list_lim,
+ jint blk_global_lim, jint blk_list_lim)
{
herr_t retVal = FAIL;
UNUSED(clss);
- if ((retVal = H5set_free_list_limits((int)reg_global_lim, (int)reg_list_lim,
- (int)arr_global_lim, (int)arr_list_lim, (int)blk_global_lim, (int)blk_list_lim)) < 0)
+ if ((retVal = H5set_free_list_limits((int)reg_global_lim, (int)reg_list_lim, (int)arr_global_lim,
+ (int)arr_list_lim, (int)blk_global_lim, (int)blk_list_lim)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -194,8 +190,7 @@ done:
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe
- (JNIEnv *env, jclass clss)
+Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe(JNIEnv *env, jclass clss)
{
hbool_t is_ts = false;
@@ -208,7 +203,6 @@ done:
return (jboolean)is_ts;
} /* end Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe */
-
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/h5Imp.h b/java/src/jni/h5Imp.h
index 756b8bb..696d7d2 100644
--- a/java/src/jni/h5Imp.h
+++ b/java/src/jni/h5Imp.h
@@ -26,45 +26,35 @@ extern "C" {
* Method: H5open
* Signature: ()I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5open
- (JNIEnv *, jclass);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5open(JNIEnv *, jclass);
/*
* Class: hdf_hdf5lib_H5
* Method: H5close
* Signature: ()I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5close
- (JNIEnv *, jclass);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5close(JNIEnv *, jclass);
/*
* Class: hdf_hdf5lib_H5
* Method: H5dont_atexit
* Signature: ()I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5dont_1atexit
- (JNIEnv *, jclass);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5dont_1atexit(JNIEnv *, jclass);
/*
* Class: hdf_hdf5lib_H5
* Method: H5get_libversion
* Signature: ([I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5get_1libversion
- (JNIEnv *, jclass, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5get_1libversion(JNIEnv *, jclass, jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5check_version
* Signature: (III)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5check_1version
- (JNIEnv *, jclass, jint, jint, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5check_1version(JNIEnv *, jclass, jint, jint, jint);
/*
* Class: hdf_hdf5lib_H5
@@ -72,27 +62,22 @@ Java_hdf_hdf5lib_H5_H5check_1version
* Signature: ()I
*
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5garbage_1collect
- (JNIEnv *, jclass);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5garbage_1collect(JNIEnv *, jclass);
/*
* Class: hdf_hdf5lib_H5
* Method: H5set_free_list_limits
* Signature: (IIIIII)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5set_1free_1list_1limits
- (JNIEnv *, jclass, jint, jint, jint, jint, jint, jint );
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5set_1free_1list_1limits(JNIEnv *, jclass, jint, jint, jint, jint,
+ jint, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5is_library_threadsafe
* Signature: ()Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe
- (JNIEnv *, jclass);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe(JNIEnv *, jclass);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c
index 8b3f9e5..fdfa14c 100644
--- a/java/src/jni/h5aImp.c
+++ b/java/src/jni/h5aImp.c
@@ -54,19 +54,17 @@ static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *inf
/* Local Macros */
/********************/
-
/*
* Class: hdf_hdf5lib_H5
* Method: H5Acreate
* Signature: (JLjava/lang/String;JJJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Acreate
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id,
- jlong space_id, jlong create_plist)
+Java_hdf_hdf5lib_H5__1H5Acreate(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id,
+ jlong space_id, jlong create_plist)
{
const char *attrName = NULL;
- hid_t attr_id = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
UNUSED(clss);
@@ -75,7 +73,8 @@ Java_hdf_hdf5lib_H5__1H5Acreate
PIN_JAVA_STRING(ENVONLY, name, attrName, NULL, "H5Acreate: attribute name not pinned");
- if ((attr_id = H5Acreate2((hid_t)loc_id, attrName, (hid_t)type_id, (hid_t)space_id, (hid_t)create_plist, (hid_t)H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Acreate2((hid_t)loc_id, attrName, (hid_t)type_id, (hid_t)space_id, (hid_t)create_plist,
+ (hid_t)H5P_DEFAULT)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -91,13 +90,12 @@ done:
* Signature: (JLjava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Aopen_1name
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name)
+Java_hdf_hdf5lib_H5__1H5Aopen_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring name)
{
#ifndef H5_NO_DEPRECATED_SYMBOLS
const char *attrName = NULL;
#endif
- hid_t attr_id = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
UNUSED(clss);
@@ -111,7 +109,7 @@ Java_hdf_hdf5lib_H5__1H5Aopen_1name
PIN_JAVA_STRING(ENVONLY, name, attrName, NULL, "H5Aopen_name: attribute name not pinned");
- if((attr_id = H5Aopen_name((hid_t)loc_id, attrName)) < 0)
+ if ((attr_id = H5Aopen_name((hid_t)loc_id, attrName)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
#endif
@@ -130,8 +128,7 @@ done:
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Aopen_1idx
- (JNIEnv *env, jclass clss, jlong loc_id, jint idx)
+Java_hdf_hdf5lib_H5__1H5Aopen_1idx(JNIEnv *env, jclass clss, jlong loc_id, jint idx)
{
hid_t attr_id = H5I_INVALID_HID;
@@ -142,7 +139,7 @@ Java_hdf_hdf5lib_H5__1H5Aopen_1idx
UNUSED(idx);
H5_UNIMPLEMENTED(ENVONLY, "H5Aopen_idx: not implemented");
#else
- if ((attr_id = H5Aopen_idx((hid_t) loc_id, (unsigned int) idx)) < 0)
+ if ((attr_id = H5Aopen_idx((hid_t)loc_id, (unsigned int)idx)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
#endif
@@ -156,13 +153,13 @@ done:
* Signature: (JJ[BZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Aread(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf,
+ jboolean isCriticalPinning)
{
- jboolean readBufIsCopy;
- jbyte *readBuf = NULL;
- htri_t data_class;
- herr_t status = FAIL;
+ jboolean readBufIsCopy;
+ jbyte * readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -183,7 +180,8 @@ Java_hdf_hdf5lib_H5_H5Aread
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread: variable length type not supported");
if (isCriticalPinning) {
- PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread: read buffer not critically pinned");
+ PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy,
+ "H5Aread: read buffer not critically pinned");
}
else {
PIN_BYTE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread: read buffer not pinned");
@@ -211,13 +209,13 @@ done:
* Signature: (JJ[BZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Awrite
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Awrite(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf,
+ jboolean isCriticalPinning)
{
- jboolean writeBufIsCopy;
- jbyte *writeBuf = NULL;
- htri_t data_class;
- herr_t status = FAIL;
+ jboolean writeBufIsCopy;
+ jbyte * writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -238,7 +236,8 @@ Java_hdf_hdf5lib_H5_H5Awrite
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite: variable length type not supported");
if (isCriticalPinning) {
- PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite: write buffer not critically pinned");
+ PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy,
+ "H5Awrite: write buffer not critically pinned");
}
else {
PIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite: write buffer not pinned");
@@ -266,13 +265,13 @@ done:
* Signature: (JJ[SZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread_1short
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jshortArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Aread_1short(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id,
+ jshortArray buf, jboolean isCriticalPinning)
{
- jboolean readBufIsCopy;
- jshort *readBuf = NULL;
- htri_t data_class;
- herr_t status = FAIL;
+ jboolean readBufIsCopy;
+ jshort * readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -293,7 +292,8 @@ Java_hdf_hdf5lib_H5_H5Aread_1short
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_short: variable length type not supported");
if (isCriticalPinning) {
- PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_short: read buffer not critically pinned");
+ PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy,
+ "H5Aread_short: read buffer not critically pinned");
}
else {
PIN_SHORT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_short: read buffer not pinned");
@@ -321,13 +321,13 @@ done:
* Signature: (JJ[SZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Awrite_1short
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jshortArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Awrite_1short(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id,
+ jshortArray buf, jboolean isCriticalPinning)
{
- jboolean writeBufIsCopy;
- jshort *writeBuf = NULL;
- htri_t data_class;
- herr_t status = FAIL;
+ jboolean writeBufIsCopy;
+ jshort * writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -348,7 +348,8 @@ Java_hdf_hdf5lib_H5_H5Awrite_1short
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_short: variable length type not supported");
if (isCriticalPinning) {
- PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_short: write buffer not critically pinned");
+ PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy,
+ "H5Awrite_short: write buffer not critically pinned");
}
else {
PIN_SHORT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_short: write buffer not pinned");
@@ -376,13 +377,13 @@ done:
* Signature: (JJ[IZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread_1int
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jintArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Aread_1int(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jintArray buf,
+ jboolean isCriticalPinning)
{
- jboolean readBufIsCopy;
- htri_t data_class;
- jint *readBuf = NULL;
- herr_t status = FAIL;
+ jboolean readBufIsCopy;
+ htri_t data_class;
+ jint * readBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -403,7 +404,8 @@ Java_hdf_hdf5lib_H5_H5Aread_1int
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_int: variable length type not supported");
if (isCriticalPinning) {
- PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_int: read buffer not critically pinned");
+ PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy,
+ "H5Aread_int: read buffer not critically pinned");
}
else {
PIN_INT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_int: read buffer not pinned");
@@ -431,13 +433,13 @@ done:
* Signature: (JJ[IZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Awrite_1int
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jintArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Awrite_1int(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jintArray buf,
+ jboolean isCriticalPinning)
{
- jboolean writeBufIsCopy;
- jint *writeBuf = NULL;
- htri_t data_class;
- herr_t status = FAIL;
+ jboolean writeBufIsCopy;
+ jint * writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -458,7 +460,8 @@ Java_hdf_hdf5lib_H5_H5Awrite_1int
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_int: variable length type not supported");
if (isCriticalPinning) {
- PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_int: write buffer not critically pinned");
+ PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy,
+ "H5Awrite_int: write buffer not critically pinned");
}
else {
PIN_INT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_int: write buffer not pinned");
@@ -486,13 +489,13 @@ done:
* Signature: (JJ[JZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread_1long
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jlongArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Aread_1long(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jlongArray buf,
+ jboolean isCriticalPinning)
{
- jboolean readBufIsCopy;
- jlong *readBuf = NULL;
- htri_t data_class;
- herr_t status = FAIL;
+ jboolean readBufIsCopy;
+ jlong * readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -513,7 +516,8 @@ Java_hdf_hdf5lib_H5_H5Aread_1long
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_long: variable length type not supported");
if (isCriticalPinning) {
- PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_long: read buffer not critically pinned");
+ PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy,
+ "H5Aread_long: read buffer not critically pinned");
}
else {
PIN_LONG_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_long: read buffer not pinned");
@@ -541,13 +545,13 @@ done:
* Signature: (JJ[JZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Awrite_1long
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jlongArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Awrite_1long(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jlongArray buf,
+ jboolean isCriticalPinning)
{
- jboolean writeBufIsCopy;
- jlong *writeBuf = NULL;
- htri_t data_class;
- herr_t status = FAIL;
+ jboolean writeBufIsCopy;
+ jlong * writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -568,7 +572,8 @@ Java_hdf_hdf5lib_H5_H5Awrite_1long
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_long: variable length type not supported");
if (isCriticalPinning) {
- PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_long: write buffer not critically pinned");
+ PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy,
+ "H5Awrite_long: write buffer not critically pinned");
}
else {
PIN_LONG_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_long: write buffer not pinned");
@@ -596,13 +601,13 @@ done:
* Signature: (JJ[FZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread_1float
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jfloatArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Aread_1float(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id,
+ jfloatArray buf, jboolean isCriticalPinning)
{
- jboolean readBufIsCopy;
- jfloat *readBuf = NULL;
- htri_t data_class;
- herr_t status = FAIL;
+ jboolean readBufIsCopy;
+ jfloat * readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -623,7 +628,8 @@ Java_hdf_hdf5lib_H5_H5Aread_1float
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_float: variable length type not supported");
if (isCriticalPinning) {
- PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_float: read buffer not critically pinned");
+ PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy,
+ "H5Aread_float: read buffer not critically pinned");
}
else {
PIN_FLOAT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_float: read buffer not pinned");
@@ -651,13 +657,13 @@ done:
* Signature: (JJ[FZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Awrite_1float
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jfloatArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Awrite_1float(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id,
+ jfloatArray buf, jboolean isCriticalPinning)
{
- jboolean writeBufIsCopy;
- jfloat *writeBuf = NULL;
- htri_t data_class;
- herr_t status = FAIL;
+ jboolean writeBufIsCopy;
+ jfloat * writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -678,7 +684,8 @@ Java_hdf_hdf5lib_H5_H5Awrite_1float
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_float: variable length type not supported");
if (isCriticalPinning) {
- PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_float: write buffer not critically pinned");
+ PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy,
+ "H5Awrite_float: write buffer not critically pinned");
}
else {
PIN_FLOAT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_float: write buffer not pinned");
@@ -706,13 +713,13 @@ done:
* Signature: (JJ[DZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread_1double
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jdoubleArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Aread_1double(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id,
+ jdoubleArray buf, jboolean isCriticalPinning)
{
- jboolean readBufIsCopy;
- jdouble *readBuf = NULL;
- htri_t data_class;
- herr_t status = FAIL;
+ jboolean readBufIsCopy;
+ jdouble *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -733,7 +740,8 @@ Java_hdf_hdf5lib_H5_H5Aread_1double
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_double: variable length type not supported");
if (isCriticalPinning) {
- PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_double: read buffer not critically pinned");
+ PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy,
+ "H5Aread_double: read buffer not critically pinned");
}
else {
PIN_DOUBLE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_double: read buffer not pinned");
@@ -761,13 +769,13 @@ done:
* Signature: (JJ[DZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Awrite_1double
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jdoubleArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Awrite_1double(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id,
+ jdoubleArray buf, jboolean isCriticalPinning)
{
- jboolean writeBufIsCopy;
- jdouble *writeBuf = NULL;
- htri_t data_class;
- herr_t status = FAIL;
+ jboolean writeBufIsCopy;
+ jdouble *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -788,7 +796,8 @@ Java_hdf_hdf5lib_H5_H5Awrite_1double
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_double: variable length type not supported");
if (isCriticalPinning) {
- PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_double: write buffer not critically pinned");
+ PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy,
+ "H5Awrite_double: write buffer not critically pinned");
}
else {
PIN_DOUBLE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_double: write buffer not pinned");
@@ -816,16 +825,16 @@ done:
* Signature: (JJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread_1string
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray j_buf)
+Java_hdf_hdf5lib_H5_H5Aread_1string(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id,
+ jobjectArray j_buf)
{
- jstring jstr;
- size_t str_len;
- size_t pos;
- jsize i, n;
- char *c_buf = NULL;
- char *cstr = NULL;
- herr_t status = FAIL;
+ jstring jstr;
+ size_t str_len;
+ size_t pos;
+ jsize i, n;
+ char * c_buf = NULL;
+ char * cstr = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -840,22 +849,23 @@ Java_hdf_hdf5lib_H5_H5Aread_1string
if (!(str_len = H5Tget_size((hid_t)mem_type_id)))
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (cstr = (char *) HDmalloc(str_len + 1)))
+ if (NULL == (cstr = (char *)HDmalloc(str_len + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread_string: memory allocation failed");
- if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len)))
+ if (NULL == (c_buf = (char *)HDmalloc((size_t)n * str_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread_string: memory allocation failed");
if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, c_buf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
for (i = 0, pos = 0; i < n; i++) {
- HDmemcpy(cstr, c_buf+pos, str_len);
+ HDmemcpy(cstr, c_buf + pos, str_len);
cstr[str_len] = '\0';
if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, cstr))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread_string: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY, "H5Aread_string: out of memory - unable to construct string from UTF characters");
}
ENVPTR->SetObjectArrayElement(ENVONLY, j_buf, i, jstr);
@@ -881,14 +891,14 @@ done:
* Signature: (JJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Awrite_1string
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray j_buf)
+Java_hdf_hdf5lib_H5_H5Awrite_1string(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id,
+ jobjectArray j_buf)
{
const char *utf8 = NULL;
jstring obj;
size_t i, str_len;
jsize n;
- char *c_buf = NULL;
+ char * c_buf = NULL;
herr_t status = FAIL;
UNUSED(clss);
@@ -904,11 +914,11 @@ Java_hdf_hdf5lib_H5_H5Awrite_1string
if (!(str_len = H5Tget_size((hid_t)mem_type_id)))
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len)))
+ if (NULL == (c_buf = (char *)HDmalloc((size_t)n * str_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Awrite_string: memory allocation failed");
- for (i = 0; i < (size_t) n; i++) {
- if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)j_buf, (jsize) i))) {
+ for (i = 0; i < (size_t)n; i++) {
+ if (NULL == (obj = (jstring)ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)j_buf, (jsize)i))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
/*
@@ -951,16 +961,15 @@ done:
* Signature: (JJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5AreadVL
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
+Java_hdf_hdf5lib_H5_H5AreadVL(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
{
H5T_class_t type_class;
- htri_t isStr = 0;
- htri_t isVlenStr = 0;
- htri_t isComplex = 0;
+ htri_t isStr = 0;
+ htri_t isVlenStr = 0;
+ htri_t isComplex = 0;
htri_t isComplex2 = 0;
hid_t nested_tid = H5I_INVALID_HID;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -980,7 +989,7 @@ Java_hdf_hdf5lib_H5_H5AreadVL
if ((num_members = H5Tget_nmembers(mem_type_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- for (i = 0; i < (unsigned) num_members; i++) {
+ for (i = 0; i < (unsigned)num_members; i++) {
if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -1023,21 +1032,21 @@ done:
* buffer in turn.
*/
static herr_t
-H5AreadVL_str
- (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
+H5AreadVL_str(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
{
- jstring jstr;
- jsize i, n;
- char **strs = NULL;
- herr_t status = FAIL;
+ jstring jstr;
+ jsize i, n;
+ char ** strs = NULL;
+ herr_t status = FAIL;
if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AreadVL_str: buf length < 0");
}
- if (NULL == (strs = (char **) HDcalloc((size_t)n, sizeof(char *))))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadVL_str: failed to allocate variable length string read buffer");
+ if (NULL == (strs = (char **)HDcalloc((size_t)n, sizeof(char *))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "H5AreadVL_str: failed to allocate variable length string read buffer");
if ((status = H5Aread(aid, tid, strs)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -1081,18 +1090,17 @@ done:
* in the output buffer in turn.
*/
static herr_t
-H5AreadVL_asstr
- (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
+H5AreadVL_asstr(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
{
- hsize_t dims[H5S_MAX_RANK];
- jstring jstr;
- h5str_t h5str;
- size_t typeSize;
- size_t i;
- hid_t sid = H5I_INVALID_HID;
- jsize n;
- void *readBuf = NULL;
- herr_t status = FAIL;
+ hsize_t dims[H5S_MAX_RANK];
+ jstring jstr;
+ h5str_t h5str;
+ size_t typeSize;
+ size_t i;
+ hid_t sid = H5I_INVALID_HID;
+ jsize n;
+ void * readBuf = NULL;
+ herr_t status = FAIL;
HDmemset(&h5str, 0, sizeof(h5str_t));
@@ -1122,16 +1130,16 @@ H5AreadVL_asstr
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadVL_asstr: failed to allocate buffer");
/* Convert each element to a char string */
- for (i = 0; i < (size_t) n; i++) {
+ for (i = 0; i < (size_t)n; i++) {
h5str.s[0] = '\0';
- if (!h5str_sprintf(ENVONLY, &h5str, aid, tid, &(((char *) readBuf)[i * typeSize]), typeSize, 0))
+ if (!h5str_sprintf(ENVONLY, &h5str, aid, tid, &(((char *)readBuf)[i * typeSize]), typeSize, 0))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s)))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- ENVPTR->SetObjectArrayElement(ENVONLY, buf, (jsize) i, jstr);
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, (jsize)i, jstr);
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
ENVPTR->DeleteLocalRef(ENVONLY, jstr);
@@ -1156,16 +1164,15 @@ done:
* Signature: (JJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5AwriteVL
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
+Java_hdf_hdf5lib_H5_H5AwriteVL(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
{
H5T_class_t type_class;
- htri_t isStr = 0;
- htri_t isVlenStr = 0;
- htri_t isComplex = 0;
+ htri_t isStr = 0;
+ htri_t isVlenStr = 0;
+ htri_t isComplex = 0;
htri_t isComplex2 = 0;
hid_t nested_tid = H5I_INVALID_HID;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1185,7 +1192,7 @@ Java_hdf_hdf5lib_H5_H5AwriteVL
if ((num_members = H5Tget_nmembers(mem_type_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- for(i = 0; i < (unsigned) num_members; i++) {
+ for (i = 0; i < (unsigned)num_members; i++) {
if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -1227,28 +1234,28 @@ done:
* The buffer of C-strings is then written to the HDF5 attribute specified.
*/
static herr_t
-H5AwriteVL_str
- (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
+H5AwriteVL_str(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
{
- const char *utf8 = NULL;
- jstring obj;
- jsize size;
- jint i;
- char **writeBuf = NULL;
- herr_t status = FAIL;
-
- if ((size = ENVPTR->GetArrayLength(ENVONLY, (jarray) buf)) < 0) {
+ const char *utf8 = NULL;
+ jstring obj;
+ jsize size;
+ jint i;
+ char ** writeBuf = NULL;
+ herr_t status = FAIL;
+
+ if ((size = ENVPTR->GetArrayLength(ENVONLY, (jarray)buf)) < 0) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AwriteVL_str: buf length < 0");
}
- if (NULL == (writeBuf = (char **) HDcalloc((size_t)size + 1, sizeof(char *))))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL_str: failed to allocate variable length string write buffer");
+ if (NULL == (writeBuf = (char **)HDcalloc((size_t)size + 1, sizeof(char *))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "H5AwriteVL_str: failed to allocate variable length string write buffer");
for (i = 0; i < size; ++i) {
jsize length;
- if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray) buf, i))) {
+ if (NULL == (obj = (jstring)ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, i))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
/*
@@ -1263,7 +1270,7 @@ H5AwriteVL_str
PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5AwriteVL_str: string not pinned");
- if (NULL == (writeBuf[i] = (char *) HDmalloc((size_t)length + 1)))
+ if (NULL == (writeBuf[i] = (char *)HDmalloc((size_t)length + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL_str: failed to allocate string buffer");
HDstrncpy(writeBuf[i], utf8, (size_t)length);
@@ -1299,8 +1306,7 @@ done:
* elements is then written to the HDF5 attribute.
*/
static herr_t
-H5AwriteVL_asstr
- (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
+H5AwriteVL_asstr(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
{
const char *utf8 = NULL;
hsize_t dims[H5S_MAX_RANK];
@@ -1309,8 +1315,8 @@ H5AwriteVL_asstr
size_t i;
hid_t sid = H5I_INVALID_HID;
jsize n;
- void *writeBuf = NULL;
- herr_t status = FAIL;
+ void * writeBuf = NULL;
+ herr_t status = FAIL;
if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
@@ -1333,14 +1339,14 @@ H5AwriteVL_asstr
* free space in time. Instead, we use "H5free_memory(strs[i])" to free individual strings
* once done.
*/
- for (i = 0; i < (size_t) n; i++) {
- if (NULL == (jstr = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray) buf, (jsize) i))) {
+ for (i = 0; i < (size_t)n; i++) {
+ if (NULL == (jstr = (jstring)ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, (jsize)i))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
/*
* If the string object was NULL, skip it.
*/
- HDmemset(&(((char *) writeBuf)[i * typeSize]), 0, typeSize);
+ HDmemset(&(((char *)writeBuf)[i * typeSize]), 0, typeSize);
continue;
}
@@ -1356,7 +1362,7 @@ H5AwriteVL_asstr
* one before destroying it with h5str_convert.
*/
- if (!h5str_convert(ENVONLY, (char **) &utf8, aid, tid, &(((char *) writeBuf)[i * typeSize]), 0))
+ if (!h5str_convert(ENVONLY, (char **)&utf8, aid, tid, &(((char *)writeBuf)[i * typeSize]), 0))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
UNPIN_JAVA_STRING(ENVONLY, jstr, utf8);
@@ -1387,14 +1393,14 @@ done:
* Signature: (JJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
+Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id,
+ jobjectArray buf)
{
- H5R_ref_t *ref_data = NULL;
- h5str_t h5str;
- jstring jstr;
- jsize i, n;
- herr_t status = FAIL;
+ H5R_ref_t *ref_data = NULL;
+ h5str_t h5str;
+ jstring jstr;
+ jsize i, n;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1405,7 +1411,7 @@ Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_reg_ref: buf length < 0");
}
- if (NULL == (ref_data = (H5R_ref_t *) HDcalloc(1, (size_t)n * sizeof(H5R_ref_t))))
+ if (NULL == (ref_data = (H5R_ref_t *)HDcalloc(1, (size_t)n * sizeof(H5R_ref_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread_reg_ref: failed to allocate read buffer");
if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, ref_data)) < 0)
@@ -1419,7 +1425,7 @@ Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref
for (i = 0; i < n; i++) {
h5str.s[0] = '\0';
- if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)attr_id, (hid_t)mem_type_id, (void*)&ref_data[i], 0, 0))
+ if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)attr_id, (hid_t)mem_type_id, (void *)&ref_data[i], 0, 0))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s)))
@@ -1446,8 +1452,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Aget_1space
- (JNIEnv *env, jclass clss, jlong attr_id)
+Java_hdf_hdf5lib_H5__1H5Aget_1space(JNIEnv *env, jclass clss, jlong attr_id)
{
hid_t retVal = H5I_INVALID_HID;
@@ -1466,8 +1471,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Aget_1type
- (JNIEnv *env, jclass clss, jlong attr_id)
+Java_hdf_hdf5lib_H5__1H5Aget_1type(JNIEnv *env, jclass clss, jlong attr_id)
{
hid_t retVal = H5I_INVALID_HID;
@@ -1486,19 +1490,18 @@ done:
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Aget_1name
- (JNIEnv *env, jclass clss, jlong attr_id)
+Java_hdf_hdf5lib_H5_H5Aget_1name(JNIEnv *env, jclass clss, jlong attr_id)
{
- jstring str = NULL;
- ssize_t buf_size;
- char *attrName = NULL;
+ jstring str = NULL;
+ ssize_t buf_size;
+ char * attrName = NULL;
UNUSED(clss);
if ((buf_size = H5Aget_name((hid_t)attr_id, 0, NULL)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (attrName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ if (NULL == (attrName = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aget_name: failed to allocate attribute name buffer");
if (H5Aget_name((hid_t)attr_id, (size_t)buf_size + 1, attrName) < 0)
@@ -1521,8 +1524,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aget_1num_1attrs
- (JNIEnv *env, jclass clss, jlong loc_id)
+Java_hdf_hdf5lib_H5_H5Aget_1num_1attrs(JNIEnv *env, jclass clss, jlong loc_id)
{
int retVal = FAIL;
@@ -1546,11 +1548,10 @@ done:
* Signature: (JLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Adelete
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name)
+Java_hdf_hdf5lib_H5_H5Adelete(JNIEnv *env, jclass clss, jlong loc_id, jstring name)
{
const char *attrName = NULL;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1575,8 +1576,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Aclose
- (JNIEnv *env, jclass clss, jlong attr_id)
+Java_hdf_hdf5lib_H5__1H5Aclose(JNIEnv *env, jclass clss, jlong attr_id)
{
herr_t retVal = FAIL;
@@ -1595,12 +1595,11 @@ done:
* Signature: (JLjava/lang/String;JJJJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Acreate2
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id,
- jlong space_id, jlong create_plist, jlong access_plist)
+Java_hdf_hdf5lib_H5__1H5Acreate2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id,
+ jlong space_id, jlong create_plist, jlong access_plist)
{
const char *attrName = NULL;
- hid_t status = H5I_INVALID_HID;
+ hid_t status = H5I_INVALID_HID;
UNUSED(clss);
@@ -1609,8 +1608,8 @@ Java_hdf_hdf5lib_H5__1H5Acreate2
PIN_JAVA_STRING(ENVONLY, name, attrName, NULL, "H5Acreate2: attribute name not pinned");
- if ((status = H5Acreate2((hid_t)loc_id, attrName, (hid_t)type_id,
- (hid_t)space_id, (hid_t)create_plist, (hid_t)access_plist)) < 0)
+ if ((status = H5Acreate2((hid_t)loc_id, attrName, (hid_t)type_id, (hid_t)space_id, (hid_t)create_plist,
+ (hid_t)access_plist)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -1626,12 +1625,11 @@ done:
* Signature: (JLjava/lang/String;J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Aopen
- (JNIEnv *env, jclass clss, jlong obj_id, jstring name, jlong access_plist)
+Java_hdf_hdf5lib_H5__1H5Aopen(JNIEnv *env, jclass clss, jlong obj_id, jstring name, jlong access_plist)
{
const char *attrName = NULL;
- hid_t retVal = H5I_INVALID_HID;
+ hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
@@ -1656,11 +1654,11 @@ done:
* Signature: (JLjava/lang/String;IIJJJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint idx_type, jint order, jlong n, jlong aapl_id, jlong lapl_id)
+Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint idx_type,
+ jint order, jlong n, jlong aapl_id, jlong lapl_id)
{
const char *objName = NULL;
- hid_t retVal = H5I_INVALID_HID;
+ hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
@@ -1669,8 +1667,8 @@ Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx
PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Aopen_by_idx: object name not pinned");
- if ((retVal = H5Aopen_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type,
- (H5_iter_order_t)order, (hsize_t)n, (hid_t)aapl_id, (hid_t)lapl_id)) < 0)
+ if ((retVal = H5Aopen_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order,
+ (hsize_t)n, (hid_t)aapl_id, (hid_t)lapl_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -1681,17 +1679,18 @@ done:
} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx */
/*
-* Class: hdf_hdf5lib_H5
-* Method: _H5Acreate_by_name
-* Signature: (JLjava/lang/String;Ljava/lang/String;JJJJJ)J
-*/
+ * Class: hdf_hdf5lib_H5
+ * Method: _H5Acreate_by_name
+ * Signature: (JLjava/lang/String;Ljava/lang/String;JJJJJ)J
+ */
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name
- (JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong type_id, jlong space_id, jlong acpl_id, jlong aapl_id, jlong lapl_id)
+Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name,
+ jstring attr_name, jlong type_id, jlong space_id, jlong acpl_id,
+ jlong aapl_id, jlong lapl_id)
{
- const char *objName = NULL;
+ const char *objName = NULL;
const char *attrName = NULL;
- hid_t retVal = H5I_INVALID_HID;
+ hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
@@ -1703,8 +1702,8 @@ Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name
PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Acreate_by_name: object name not pinned");
PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Acreate_by_name: attribute name not pinned");
- if ((retVal = H5Acreate_by_name((hid_t)loc_id, objName, attrName, (hid_t)type_id,
- (hid_t)space_id, (hid_t)acpl_id, (hid_t)aapl_id, (hid_t)lapl_id)) < 0)
+ if ((retVal = H5Acreate_by_name((hid_t)loc_id, objName, attrName, (hid_t)type_id, (hid_t)space_id,
+ (hid_t)acpl_id, (hid_t)aapl_id, (hid_t)lapl_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -1722,12 +1721,12 @@ done:
* Signature: (JLjava/lang/String;Ljava/lang/String;J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Aexists_1by_1name
- (JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong lapl_id)
+Java_hdf_hdf5lib_H5_H5Aexists_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name,
+ jstring attr_name, jlong lapl_id)
{
- const char *objName = NULL;
+ const char *objName = NULL;
const char *attrName = NULL;
- htri_t bval = JNI_FALSE;
+ htri_t bval = JNI_FALSE;
UNUSED(clss);
@@ -1759,12 +1758,12 @@ done:
* Signature: (JLjava/lang/String;Ljava/lang/String)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Arename
- (JNIEnv *env, jclass clss, jlong loc_id, jstring old_attr_name, jstring new_attr_name)
+Java_hdf_hdf5lib_H5_H5Arename(JNIEnv *env, jclass clss, jlong loc_id, jstring old_attr_name,
+ jstring new_attr_name)
{
const char *oldAttrName = NULL;
const char *newAttrName = NULL;
- herr_t retVal = FAIL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -1794,13 +1793,13 @@ done:
* Signature: (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Arename_1by_1name
- (JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring old_attr_name, jstring new_attr_name, jlong lapl_id)
+Java_hdf_hdf5lib_H5_H5Arename_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name,
+ jstring old_attr_name, jstring new_attr_name, jlong lapl_id)
{
- const char *objName = NULL;
+ const char *objName = NULL;
const char *oldAttrName = NULL;
const char *newAttrName = NULL;
- herr_t retVal = FAIL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -1812,8 +1811,10 @@ Java_hdf_hdf5lib_H5_H5Arename_1by_1name
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Arename_by_name: new attribute name is NULL");
PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Arename_by_name: object name not pinned");
- PIN_JAVA_STRING(ENVONLY, old_attr_name, oldAttrName, NULL, "H5Arename_by_name: old attribute name not pinned");
- PIN_JAVA_STRING(ENVONLY, new_attr_name, newAttrName, NULL, "H5Arename_by_name: new attribute name not pinned");
+ PIN_JAVA_STRING(ENVONLY, old_attr_name, oldAttrName, NULL,
+ "H5Arename_by_name: old attribute name not pinned");
+ PIN_JAVA_STRING(ENVONLY, new_attr_name, newAttrName, NULL,
+ "H5Arename_by_name: new attribute name not pinned");
if ((retVal = H5Arename_by_name((hid_t)loc_id, objName, oldAttrName, newAttrName, (hid_t)lapl_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -1835,13 +1836,13 @@ done:
* Signature: (JLjava/lang/String;IIJJ)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx
- (JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jint idx_type, jint order, jlong n, jlong lapl_id)
+Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name,
+ jint idx_type, jint order, jlong n, jlong lapl_id)
{
- const char *objName = NULL;
- jstring str = NULL;
+ const char *objName = NULL;
+ jstring str = NULL;
ssize_t status_size = -1;
- char *attrName = NULL;
+ char * attrName = NULL;
UNUSED(clss);
@@ -1851,15 +1852,16 @@ Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx
PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aget_name_by_idx: object name not pinned");
/* Get the length of the attribute name */
- if ((status_size = H5Aget_name_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type,
- (H5_iter_order_t) order, (hsize_t) n, (char *)NULL, (size_t)0, (hid_t)lapl_id)) < 0)
+ if ((status_size =
+ H5Aget_name_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order,
+ (hsize_t)n, (char *)NULL, (size_t)0, (hid_t)lapl_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (attrName = (char *) HDmalloc(sizeof(char) * (size_t) status_size + 1)))
+ if (NULL == (attrName = (char *)HDmalloc(sizeof(char) * (size_t)status_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aget_name_by_idx: failed to allocate buffer for attribute name");
- if ((H5Aget_name_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type,
- (H5_iter_order_t) order, (hsize_t) n, (char *)attrName, (size_t)status_size + 1, (hid_t)lapl_id)) < 0)
+ if ((H5Aget_name_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t)n,
+ (char *)attrName, (size_t)status_size + 1, (hid_t)lapl_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
attrName[status_size] = '\0';
@@ -1881,8 +1883,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Aget_1storage_1size
- (JNIEnv *env, jclass clss, jlong attr_id)
+Java_hdf_hdf5lib_H5_H5Aget_1storage_1size(JNIEnv *env, jclass clss, jlong attr_id)
{
hsize_t retVal = 0;
@@ -1901,8 +1902,7 @@ done:
* Signature: (J)Lhdf/hdf5lib/structs/H5A_info_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Aget_1info
- (JNIEnv *env, jclass clss, jlong attr_id)
+Java_hdf_hdf5lib_H5_H5Aget_1info(JNIEnv *env, jclass clss, jlong attr_id)
{
H5A_info_t ainfo;
jobject ret_obj = NULL;
@@ -1930,8 +1930,8 @@ done:
* Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5A_info_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx
- (JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jint idx_type, jint order, jlong n, jlong lapl_id)
+Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name,
+ jint idx_type, jint order, jlong n, jlong lapl_id)
{
const char *objName = NULL;
H5A_info_t ainfo;
@@ -1946,8 +1946,8 @@ Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx
PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aget_info_by_idx: object name not pinned");
- if ((status = H5Aget_info_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type,
- (H5_iter_order_t)order, (hsize_t)n, &ainfo, (hid_t)lapl_id)) < 0)
+ if ((status = H5Aget_info_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order,
+ (hsize_t)n, &ainfo, (hid_t)lapl_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
args[0].z = ainfo.corder_valid;
@@ -1970,10 +1970,10 @@ done:
* Signature: (JLjava/lang/String;Ljava/lang/String;J)Lhdf/hdf5lib/structs/H5A_info_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1name
- (JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong lapl_id)
+Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name,
+ jstring attr_name, jlong lapl_id)
{
- const char *objName = NULL;
+ const char *objName = NULL;
const char *attrName = NULL;
H5A_info_t ainfo;
herr_t status;
@@ -2015,12 +2015,12 @@ done:
* Signature: (JLjava/lang/String;Ljava/lang/String;J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Adelete_1by_1name
- (JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong lapl_id)
+Java_hdf_hdf5lib_H5_H5Adelete_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name,
+ jstring attr_name, jlong lapl_id)
{
- const char *objName = NULL;
+ const char *objName = NULL;
const char *attrName = NULL;
- herr_t retVal = FAIL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -2050,11 +2050,10 @@ done:
* Signature: (JLjava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Aexists
- (JNIEnv *env, jclass clss, jlong obj_id, jstring attr_name)
+Java_hdf_hdf5lib_H5_H5Aexists(JNIEnv *env, jclass clss, jlong obj_id, jstring attr_name)
{
const char *attrName = NULL;
- htri_t bval = JNI_FALSE;
+ htri_t bval = JNI_FALSE;
UNUSED(clss);
@@ -2081,11 +2080,11 @@ done:
* Signature: (JLjava/lang/String;IIJJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx
- (JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jint idx_type, jint order, jlong n, jlong lapl_id)
+Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name,
+ jint idx_type, jint order, jlong n, jlong lapl_id)
{
const char *objName = NULL;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -2094,7 +2093,8 @@ Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx
PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Adelete_by_idx: object name not pinned");
- if ((status = H5Adelete_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t)n, (hid_t)lapl_id)) < 0)
+ if ((status = H5Adelete_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order,
+ (hsize_t)n, (hid_t)lapl_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -2108,13 +2108,13 @@ done:
* Signature: (JLjava/lang/String;Ljava/lang/String;JJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name
- (JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong aapl_id, jlong lapl_id)
+Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name,
+ jstring attr_name, jlong aapl_id, jlong lapl_id)
{
const char *attrName = NULL;
- const char *objName = NULL;
- hid_t status = H5I_INVALID_HID;
+ const char *objName = NULL;
+ hid_t status = H5I_INVALID_HID;
UNUSED(clss);
@@ -2144,8 +2144,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist
- (JNIEnv *env, jclass clss, jlong attr_id)
+Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist(JNIEnv *env, jclass clss, jlong attr_id)
{
hid_t retVal = H5I_INVALID_HID;
@@ -2159,18 +2158,18 @@ done:
} /* end Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist */
static herr_t
-H5A_iterate_cb
- (hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data) {
+H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data)
+{
cb_wrapper *wrapper = (cb_wrapper *)cb_data;
jmethodID mid;
- jobject cb_info_t = NULL;
+ jobject cb_info_t = NULL;
jobject visit_callback = wrapper->visit_callback;
jstring str;
- JNIEnv *cbenv = NULL;
+ JNIEnv * cbenv = NULL;
jclass cbcls;
jvalue args[4];
- void *op_data = (void *)wrapper->op_data;
- jint status = -1;
+ void * op_data = (void *)wrapper->op_data;
+ jint status = -1;
if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
@@ -2180,7 +2179,10 @@ H5A_iterate_cb
if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5A_info_t;Lhdf/hdf5lib/callbacks/H5A_iterate_t;)I")))
+ if (NULL ==
+ (mid = CBENVPTR->GetMethodID(
+ CBENVONLY, cbcls, "callback",
+ "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5A_info_t;Lhdf/hdf5lib/callbacks/H5A_iterate_t;)I")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
@@ -2209,13 +2211,12 @@ done:
* Signature: (JIIJLjava/lang/Object;Ljava/lang/Object;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aiterate
- (JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order,
- jlong idx, jobject callback_op, jobject op_data)
+Java_hdf_hdf5lib_H5_H5Aiterate(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order, jlong idx,
+ jobject callback_op, jobject op_data)
{
- cb_wrapper wrapper = { callback_op, op_data };
+ cb_wrapper wrapper = {callback_op, op_data};
hsize_t start_idx = (hsize_t)idx;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -2227,7 +2228,8 @@ Java_hdf_hdf5lib_H5_H5Aiterate
if (NULL == callback_op)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aiterate: callback_op is NULL");
- if ((status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)&wrapper)) < 0)
+ if ((status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order,
+ (hsize_t *)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void *)&wrapper)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -2240,14 +2242,14 @@ done:
* Signature: (JLjava/lang/String;IIJLjava/lang/Object;Ljava/lang/Object;J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name
- (JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order,
- jlong idx, jobject callback_op, jobject op_data, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type,
+ jint order, jlong idx, jobject callback_op, jobject op_data,
+ jlong access_id)
{
- const char *objName = NULL;
- cb_wrapper wrapper = { callback_op, op_data };
+ const char *objName = NULL;
+ cb_wrapper wrapper = {callback_op, op_data};
hsize_t start_idx = (hsize_t)idx;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -2263,7 +2265,9 @@ Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name
PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Aiterate_by_name: object name not pinned");
- if ((status = H5Aiterate_by_name((hid_t)grp_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)&wrapper, (hid_t)access_id)) < 0)
+ if ((status = H5Aiterate_by_name((hid_t)grp_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order,
+ (hsize_t *)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void *)&wrapper,
+ (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
diff --git a/java/src/jni/h5aImp.h b/java/src/jni/h5aImp.h
index 15cc83e..d3a4246 100644
--- a/java/src/jni/h5aImp.h
+++ b/java/src/jni/h5aImp.h
@@ -21,430 +21,356 @@
extern "C" {
#endif /* __cplusplus */
-
/*
* Class: hdf_hdf5lib_H5
* Method: H5Acreate
* Signature: (JLjava/lang/String;JJJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Acreate
- (JNIEnv *, jclass, jlong, jstring, jlong, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Acreate(JNIEnv *, jclass, jlong, jstring, jlong, jlong,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aopen_name
* Signature: (JLjava/lang/String;)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Aopen_1name
- (JNIEnv *, jclass, jlong, jstring);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aopen_1name(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aopen_idx
* Signature: (JI)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Aopen_1idx
- (JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aopen_1idx(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread
* Signature: (JJ[B)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread
- (JNIEnv *, jclass, jlong, jlong, jbyteArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aread(JNIEnv *, jclass, jlong, jlong, jbyteArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite
* Signature: (JJ[B)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Awrite
- (JNIEnv *, jclass, jlong, jlong, jbyteArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Awrite(JNIEnv *, jclass, jlong, jlong, jbyteArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread_short
* Signature: (JJ[SZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread_1short
- (JNIEnv*, jclass, jlong, jlong, jshortArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aread_1short(JNIEnv *, jclass, jlong, jlong, jshortArray,
+ jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite_short
* Signature: (JJ[SZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Awrite_1short
- (JNIEnv*, jclass, jlong, jlong, jshortArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Awrite_1short(JNIEnv *, jclass, jlong, jlong, jshortArray,
+ jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread_int
* Signature: (JJ[IZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread_1int
- (JNIEnv*, jclass, jlong, jlong, jintArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aread_1int(JNIEnv *, jclass, jlong, jlong, jintArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite_int
* Signature: (JJ[IZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Awrite_1int
- (JNIEnv*, jclass, jlong, jlong, jintArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Awrite_1int(JNIEnv *, jclass, jlong, jlong, jintArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread_long
* Signature: (JJ[JZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread_1long
- (JNIEnv*, jclass, jlong, jlong, jlongArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aread_1long(JNIEnv *, jclass, jlong, jlong, jlongArray,
+ jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite_long
* Signature: (JJ[JZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Awrite_1long
- (JNIEnv*, jclass, jlong, jlong, jlongArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Awrite_1long(JNIEnv *, jclass, jlong, jlong, jlongArray,
+ jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread_float
* Signature: (JJ[FZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread_1float
- (JNIEnv*, jclass, jlong, jlong, jfloatArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aread_1float(JNIEnv *, jclass, jlong, jlong, jfloatArray,
+ jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite_float
* Signature: (JJ[FZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Awrite_1float
- (JNIEnv*, jclass, jlong, jlong, jfloatArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Awrite_1float(JNIEnv *, jclass, jlong, jlong, jfloatArray,
+ jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread_double
* Signature: (JJ[DZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread_1double
- (JNIEnv*, jclass, jlong, jlong, jdoubleArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aread_1double(JNIEnv *, jclass, jlong, jlong, jdoubleArray,
+ jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite_double
* Signature: (JJ[DZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Awrite_1double
- (JNIEnv*, jclass, jlong, jlong, jdoubleArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Awrite_1double(JNIEnv *, jclass, jlong, jlong, jdoubleArray,
+ jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5AreadVL
* Signature: (JJ[Ljava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5AreadVL
- (JNIEnv *, jclass, jlong, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5AreadVL(JNIEnv *, jclass, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5AwriteVL
* Signature: (JJ[Ljava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5AwriteVL
- (JNIEnv *, jclass, jlong, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5AwriteVL(JNIEnv *, jclass, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread_string
* Signature: (JJ[Ljava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread_1string
- (JNIEnv*, jclass, jlong, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aread_1string(JNIEnv *, jclass, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite_string
* Signature: (JJ[Ljava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Awrite_1string
-(JNIEnv*, jclass, jlong, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Awrite_1string(JNIEnv *, jclass, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread_VLStrings
* Signature: (JJ[Ljava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread_1VLStrings
-(JNIEnv*, jclass, jlong, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aread_1VLStrings(JNIEnv *, jclass, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Awrite_VLStrings
* Signature: (JJ[B)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Awrite_1VLStrings
- (JNIEnv*, jclass, jlong, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Awrite_1VLStrings(JNIEnv *, jclass, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aread_reg_ref
* Signature: (JJ[Ljava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref
-(JNIEnv*, jclass, jlong, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref(JNIEnv *, jclass, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aget_space
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Aget_1space
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aget_1space(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aget_type
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Aget_1type
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aget_1type(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aget_name
* Signature: (J)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Aget_1name
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Aget_1name(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aget_num_attrs
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aget_1num_1attrs
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aget_1num_1attrs(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Adelete
* Signature: (JLjava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Adelete
- (JNIEnv *, jclass, jlong, jstring);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Adelete(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aclose
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Aclose
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Aclose(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Acreate2
* Signature: (JLjava/lang/String;JJJJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Acreate2
-(JNIEnv *, jclass, jlong, jstring, jlong, jlong, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Acreate2(JNIEnv *, jclass, jlong, jstring, jlong, jlong,
+ jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Aopen
* Signature: (JLjava/lang/String;J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Aopen
- (JNIEnv *, jclass, jlong, jstring, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aopen(JNIEnv *, jclass, jlong, jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Aopen_by_idx
* Signature: (JLjava/lang/String;IIJJJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx
- (JNIEnv *, jclass, jlong, jstring, jint, jint, jlong, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx(JNIEnv *, jclass, jlong, jstring, jint, jint,
+ jlong, jlong, jlong);
/*
-* Class: hdf_hdf5lib_H5
-* Method: _H5Acreate_by_name
-* Signature: (JLjava/lang/String;Ljava/lang/String;JJJJJ)J
-*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name
-(JNIEnv *, jclass, jlong, jstring, jstring, jlong, jlong, jlong, jlong, jlong);
+ * Class: hdf_hdf5lib_H5
+ * Method: _H5Acreate_by_name
+ * Signature: (JLjava/lang/String;Ljava/lang/String;JJJJJ)J
+ */
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name(JNIEnv *, jclass, jlong, jstring, jstring,
+ jlong, jlong, jlong, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aexists_by_name
* Signature: (JLjava/lang/String;Ljava/lang/String;J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Aexists_1by_1name
- (JNIEnv *, jclass, jlong, jstring, jstring, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Aexists_1by_1name(JNIEnv *, jclass, jlong, jstring, jstring,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Arename
* Signature: (JLjava/lang/String;Ljava/lang/String)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Arename
- (JNIEnv *, jclass, jlong, jstring, jstring);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Arename(JNIEnv *, jclass, jlong, jstring, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Arename_by_name
* Signature: (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Arename_1by_1name
- (JNIEnv *, jclass, jlong, jstring, jstring, jstring, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Arename_1by_1name(JNIEnv *, jclass, jlong, jstring, jstring,
+ jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aget_name_by_idx
* Signature: (JLjava/lang/String;IIJJ)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx
- (JNIEnv *, jclass, jlong, jstring, jint, jint, jlong, jlong);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx(JNIEnv *, jclass, jlong, jstring, jint,
+ jint, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aget_storage_size
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Aget_1storage_1size
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Aget_1storage_1size(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aget_info
* Signature: (J)Lhdf/hdf5lib/structs/H5A_info_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Aget_1info
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Aget_1info(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aget_info_by_idx
* Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5A_info_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx
- (JNIEnv *, jclass, jlong, jstring, jint, jint, jlong, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx(JNIEnv *, jclass, jlong, jstring, jint,
+ jint, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aget_info_by_name
* Signature: (JLjava/lang/String;Ljava/lang/String;J)Lhdf/hdf5lib/structs/H5A_info_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1name
- (JNIEnv *, jclass, jlong, jstring, jstring, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1name(JNIEnv *, jclass, jlong, jstring,
+ jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Adelete_by_name
* Signature: (JLjava/lang/String;Ljava/lang/String;J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Adelete_1by_1name
- (JNIEnv *, jclass, jlong, jstring, jstring, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Adelete_1by_1name(JNIEnv *, jclass, jlong, jstring, jstring,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aexists
* Signature: (JLjava/lang/String;)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Aexists
- (JNIEnv *, jclass, jlong, jstring);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Aexists(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Adelete_by_idx
* Signature: (JLjava/lang/String;IIJJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx
- (JNIEnv *, jclass, jlong, jstring, jint, jint, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx(JNIEnv *, jclass, jlong, jstring, jint, jint,
+ jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Aopen_by_name
* Signature: (JLjava/lang/String;Ljava/lang/String;JJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name
- (JNIEnv *, jclass, jlong, jstring, jstring, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name(JNIEnv *, jclass, jlong, jstring, jstring,
+ jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aget_create_plist
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aiterate
* Signature: (JIIJLjava/lang/Object;Ljava/lang/Object;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aiterate
- (JNIEnv*, jclass, jlong, jint, jint, jlong, jobject, jobject);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aiterate(JNIEnv *, jclass, jlong, jint, jint, jlong, jobject,
+ jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aiterate_by_name
* Signature: (JLjava/lang/String;IIJLjava/lang/Object;Ljava/lang/Object;J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name
- (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jobject, jobject, jlong);
-
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name(JNIEnv *, jclass, jlong, jstring, jint, jint,
+ jlong, jobject, jobject, jlong);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c
index bcefe12..b34fe25 100644
--- a/java/src/jni/h5dImp.c
+++ b/java/src/jni/h5dImp.c
@@ -44,28 +44,30 @@ typedef struct _cb_wrapper {
/* Local Prototypes */
/********************/
-static herr_t H5DreadVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
-static herr_t H5DreadVL_str(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
-static herr_t H5DwriteVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
-static herr_t H5DwriteVL_str(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
+static herr_t H5DreadVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid,
+ hid_t xfer_plist_id, jobjectArray buf);
+static herr_t H5DreadVL_str(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid,
+ hid_t xfer_plist_id, jobjectArray buf);
+static herr_t H5DwriteVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid,
+ hid_t xfer_plist_id, jobjectArray buf);
+static herr_t H5DwriteVL_str(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid,
+ hid_t xfer_plist_id, jobjectArray buf);
/********************/
/* Local Macros */
/********************/
-
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Dcreate
* Signature: (JLjava/lang/String;JJJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Dcreate
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id,
- jlong space_id, jlong create_plist_id)
+Java_hdf_hdf5lib_H5__1H5Dcreate(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id,
+ jlong space_id, jlong create_plist_id)
{
const char *dsetName = NULL;
- hid_t dset_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
UNUSED(clss);
@@ -74,7 +76,8 @@ Java_hdf_hdf5lib_H5__1H5Dcreate
PIN_JAVA_STRING(ENVONLY, name, dsetName, NULL, "H5Dcreate: dataset name not pinned");
- if ((dset_id = H5Dcreate2((hid_t)loc_id, dsetName, (hid_t)type_id, (hid_t)space_id, H5P_DEFAULT, (hid_t)create_plist_id, H5P_DEFAULT)) < 0)
+ if ((dset_id = H5Dcreate2((hid_t)loc_id, dsetName, (hid_t)type_id, (hid_t)space_id, H5P_DEFAULT,
+ (hid_t)create_plist_id, H5P_DEFAULT)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -90,11 +93,10 @@ done:
* Signature: (JLjava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Dopen
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name)
+Java_hdf_hdf5lib_H5__1H5Dopen(JNIEnv *env, jclass clss, jlong loc_id, jstring name)
{
const char *dsetName = NULL;
- hid_t dset_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
UNUSED(clss);
@@ -119,8 +121,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Dget_1space
- (JNIEnv *env, jclass clss, jlong dataset_id)
+Java_hdf_hdf5lib_H5__1H5Dget_1space(JNIEnv *env, jclass clss, jlong dataset_id)
{
hid_t retVal = H5I_INVALID_HID;
@@ -139,8 +140,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Dget_1type
- (JNIEnv *env, jclass clss, jlong dataset_id)
+Java_hdf_hdf5lib_H5__1H5Dget_1type(JNIEnv *env, jclass clss, jlong dataset_id)
{
hid_t retVal = H5I_INVALID_HID;
@@ -159,8 +159,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Dget_1create_1plist
- (JNIEnv *env, jclass clss, jlong dataset_id)
+Java_hdf_hdf5lib_H5__1H5Dget_1create_1plist(JNIEnv *env, jclass clss, jlong dataset_id)
{
hid_t retVal = H5I_INVALID_HID;
@@ -179,14 +178,14 @@ done:
* Signature: (JJJJJ[BZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jbyteArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Dread(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
+ jlong file_space_id, jlong xfer_plist_id, jbyteArray buf,
+ jboolean isCriticalPinning)
{
- jboolean readBufIsCopy;
- htri_t data_class;
- jbyte *readBuf = NULL;
- herr_t status = FAIL;
+ jboolean readBufIsCopy;
+ htri_t data_class;
+ jbyte * readBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -207,14 +206,15 @@ Java_hdf_hdf5lib_H5_H5Dread
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread: variable length type not supported");
if (isCriticalPinning) {
- PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread: read buffer not critically pinned");
+ PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy,
+ "H5Dread: read buffer not critically pinned");
}
else {
PIN_BYTE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread: read buffer not pinned");
}
- if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id,
+ (hid_t)xfer_plist_id, readBuf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -236,14 +236,14 @@ done:
* Signature: (JJJJJ[BZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jbyteArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Dwrite(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, jbyteArray buf,
+ jboolean isCriticalPinning)
{
- jboolean writeBufIsCopy;
- htri_t data_class;
- jbyte *writeBuf = NULL;
- herr_t status = FAIL;
+ jboolean writeBufIsCopy;
+ htri_t data_class;
+ jbyte * writeBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -264,14 +264,15 @@ Java_hdf_hdf5lib_H5_H5Dwrite
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite: variable length type not supported");
if (isCriticalPinning) {
- PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite: write buffer not critically pinned");
+ PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy,
+ "H5Dwrite: write buffer not critically pinned");
}
else {
PIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite: write buffer not pinned");
}
- if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id,
+ (hid_t)xfer_plist_id, writeBuf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -293,8 +294,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Dclose
- (JNIEnv *env, jclass clss, jlong dataset_id)
+Java_hdf_hdf5lib_H5__1H5Dclose(JNIEnv *env, jclass clss, jlong dataset_id)
{
herr_t retVal = FAIL;
@@ -313,8 +313,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Dget_1storage_1size
- (JNIEnv *env, jclass clss, jlong dataset_id)
+Java_hdf_hdf5lib_H5_H5Dget_1storage_1size(JNIEnv *env, jclass clss, jlong dataset_id)
{
hsize_t retVal = 0;
@@ -336,15 +335,14 @@ done:
* Signature: (JJJ[B)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim
- (JNIEnv *env, jclass clss, jlong type_id, jlong space_id,
- jlong xfer_plist_id, jbyteArray buf)
+Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim(JNIEnv *env, jclass clss, jlong type_id, jlong space_id,
+ jlong xfer_plist_id, jbyteArray buf)
{
#ifndef H5_NO_DEPRECATED_SYMBOLS
- jboolean vlenBufIsCopy;
- jbyte *vlenBuf = NULL;
+ jboolean vlenBufIsCopy;
+ jbyte * vlenBuf = NULL;
#endif
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -379,14 +377,14 @@ done:
* Signature: (JJJJJ[SZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1short
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jshortArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Dread_1short(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id,
+ jshortArray buf, jboolean isCriticalPinning)
{
- jboolean readBufIsCopy;
- jshort *readBuf = NULL;
- htri_t data_class;
- herr_t status = FAIL;
+ jboolean readBufIsCopy;
+ jshort * readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -407,14 +405,15 @@ Java_hdf_hdf5lib_H5_H5Dread_1short
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_short: variable length type not supported");
if (isCriticalPinning) {
- PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_short: read buffer not critically pinned");
+ PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy,
+ "H5Dread_short: read buffer not critically pinned");
}
else {
PIN_SHORT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_short: read buffer not pinned");
}
- if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id,
+ (hid_t)xfer_plist_id, readBuf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -436,14 +435,14 @@ done:
* Signature: (JJJJJ[SZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite_1short
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jshortArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Dwrite_1short(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id,
+ jshortArray buf, jboolean isCriticalPinning)
{
- jboolean writeBufIsCopy;
- jshort *writeBuf = NULL;
- htri_t data_class;
- herr_t status = FAIL;
+ jboolean writeBufIsCopy;
+ jshort * writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -464,14 +463,15 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1short
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_short: variable length type not supported");
if (isCriticalPinning) {
- PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_short: write buffer not critically pinned");
+ PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy,
+ "H5Dwrite_short: write buffer not critically pinned");
}
else {
PIN_SHORT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_short: write buffer not pinned");
}
- if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id,
+ (hid_t)xfer_plist_id, writeBuf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -493,14 +493,14 @@ done:
* Signature: (JJJJJ[IZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1int
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jintArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Dread_1int(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, jintArray buf,
+ jboolean isCriticalPinning)
{
- jboolean readBufIsCopy;
- htri_t data_class;
- jint *readBuf = NULL;
- herr_t status = FAIL;
+ jboolean readBufIsCopy;
+ htri_t data_class;
+ jint * readBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -521,14 +521,15 @@ Java_hdf_hdf5lib_H5_H5Dread_1int
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_int: variable length type not supported");
if (isCriticalPinning) {
- PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_int: read buffer not critically pinned");
+ PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy,
+ "H5Dread_int: read buffer not critically pinned");
}
else {
PIN_INT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_int: read buffer not pinned");
}
- if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id,
+ (hid_t)xfer_plist_id, readBuf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -550,14 +551,14 @@ done:
* Signature: (JJJJJ[IZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite_1int
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jintArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Dwrite_1int(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, jintArray buf,
+ jboolean isCriticalPinning)
{
- jboolean writeBufIsCopy;
- htri_t data_class;
- jint *writeBuf = NULL;
- herr_t status = FAIL;
+ jboolean writeBufIsCopy;
+ htri_t data_class;
+ jint * writeBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -578,14 +579,15 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1int
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_int: variable length type not supported");
if (isCriticalPinning) {
- PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_int: write buffer not critically pinned");
+ PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy,
+ "H5Dwrite_int: write buffer not critically pinned");
}
else {
PIN_INT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_int: write buffer not pinned");
}
- if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id,
+ (hid_t)xfer_plist_id, writeBuf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -607,14 +609,14 @@ done:
* Signature: (JJJJJ[JZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1long
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jlongArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Dread_1long(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id,
+ jlongArray buf, jboolean isCriticalPinning)
{
- jboolean readBufIsCopy;
- htri_t data_class;
- jlong *readBuf = NULL;
- herr_t status = FAIL;
+ jboolean readBufIsCopy;
+ htri_t data_class;
+ jlong * readBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -635,14 +637,15 @@ Java_hdf_hdf5lib_H5_H5Dread_1long
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_long: variable length type not supported");
if (isCriticalPinning) {
- PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_long: read buffer not critically pinned");
+ PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy,
+ "H5Dread_long: read buffer not critically pinned");
}
else {
PIN_LONG_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_long: read buffer not pinned");
}
- if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id,
+ (hid_t)xfer_plist_id, readBuf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -664,14 +667,14 @@ done:
* Signature: (JJJJJ[JZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite_1long
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jlongArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Dwrite_1long(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id,
+ jlongArray buf, jboolean isCriticalPinning)
{
- jboolean writeBufIsCopy;
- htri_t data_class;
- jlong *writeBuf = NULL;
- herr_t status = FAIL;
+ jboolean writeBufIsCopy;
+ htri_t data_class;
+ jlong * writeBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -692,14 +695,15 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1long
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_long: variable length type not supported");
if (isCriticalPinning) {
- PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_long: write buffer not critically pinned");
+ PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy,
+ "H5Dwrite_long: write buffer not critically pinned");
}
else {
PIN_LONG_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_long: write buffer not pinned");
}
- if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id,
+ (hid_t)xfer_plist_id, writeBuf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -721,14 +725,14 @@ done:
* Signature: (JJJJJ[FZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1float
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jfloatArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Dread_1float(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id,
+ jfloatArray buf, jboolean isCriticalPinning)
{
- jboolean readBufIsCopy;
- htri_t data_class;
- jfloat *readBuf = NULL;
- herr_t status = FAIL;
+ jboolean readBufIsCopy;
+ htri_t data_class;
+ jfloat * readBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -749,14 +753,15 @@ Java_hdf_hdf5lib_H5_H5Dread_1float
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_float: variable length type not supported");
if (isCriticalPinning) {
- PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_float: read buffer not critically pinned");
+ PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy,
+ "H5Dread_float: read buffer not critically pinned");
}
else {
PIN_FLOAT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_float: read buffer not pinned");
}
- if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id,
+ (hid_t)xfer_plist_id, readBuf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -778,14 +783,14 @@ done:
* Signature: (JJJJJ[FZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite_1float
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jfloatArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Dwrite_1float(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id,
+ jfloatArray buf, jboolean isCriticalPinning)
{
- jboolean writeBufIsCopy;
- htri_t data_class;
- jfloat *writeBuf = NULL;
- herr_t status = FAIL;
+ jboolean writeBufIsCopy;
+ htri_t data_class;
+ jfloat * writeBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -806,14 +811,15 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1float
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_float: variable length type not supported");
if (isCriticalPinning) {
- PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_float: write buffer not critically pinned");
+ PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy,
+ "H5Dwrite_float: write buffer not critically pinned");
}
else {
PIN_FLOAT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_float: write buffer not pinned");
}
- if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id,
+ (hid_t)xfer_plist_id, writeBuf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -835,14 +841,14 @@ done:
* Signature: (JJJJJ[DZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1double
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jdoubleArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Dread_1double(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id,
+ jdoubleArray buf, jboolean isCriticalPinning)
{
- jboolean readBufIsCopy;
- jdouble *readBuf = NULL;
- htri_t data_class;
- herr_t status = FAIL;
+ jboolean readBufIsCopy;
+ jdouble *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -863,14 +869,15 @@ Java_hdf_hdf5lib_H5_H5Dread_1double
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_double: variable length type not supported");
if (isCriticalPinning) {
- PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_double: read buffer not critically pinned");
+ PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy,
+ "H5Dread_double: read buffer not critically pinned");
}
else {
PIN_DOUBLE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_double: read buffer not pinned");
}
- if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id,
+ (hid_t)xfer_plist_id, readBuf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -892,14 +899,14 @@ done:
* Signature: (JJJJJ[DZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite_1double
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jdoubleArray buf, jboolean isCriticalPinning)
+Java_hdf_hdf5lib_H5_H5Dwrite_1double(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id,
+ jdoubleArray buf, jboolean isCriticalPinning)
{
- jboolean writeBufIsCopy;
- jdouble *writeBuf = NULL;
- htri_t data_class;
- herr_t status = FAIL;
+ jboolean writeBufIsCopy;
+ jdouble *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -920,14 +927,15 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1double
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_double: variable length type not supported");
if (isCriticalPinning) {
- PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_double: write buffer not critically pinned");
+ PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy,
+ "H5Dwrite_double: write buffer not critically pinned");
}
else {
PIN_DOUBLE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_double: write buffer not pinned");
}
- if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id,
+ (hid_t)xfer_plist_id, writeBuf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -949,17 +957,17 @@ done:
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1string
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jobjectArray j_buf)
+Java_hdf_hdf5lib_H5_H5Dread_1string(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id,
+ jobjectArray j_buf)
{
- jstring jstr;
- size_t str_len;
- size_t pos;
- jsize i, n;
- char *c_buf = NULL;
- char *cstr = NULL;
- herr_t status = FAIL;
+ jstring jstr;
+ size_t str_len;
+ size_t pos;
+ jsize i, n;
+ char * c_buf = NULL;
+ char * cstr = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -974,23 +982,24 @@ Java_hdf_hdf5lib_H5_H5Dread_1string
if (!(str_len = H5Tget_size((hid_t)mem_type_id)))
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (cstr = (char *) HDmalloc(str_len + 1)))
+ if (NULL == (cstr = (char *)HDmalloc(str_len + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_string: memory allocation failed");
- if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len)))
+ if (NULL == (c_buf = (char *)HDmalloc((size_t)n * str_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_string: memory allocation failed");
- if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf)) < 0)
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id,
+ (hid_t)xfer_plist_id, c_buf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
for (i = 0, pos = 0; i < n; i++) {
- HDmemcpy(cstr, c_buf+pos, str_len);
+ HDmemcpy(cstr, c_buf + pos, str_len);
cstr[str_len] = '\0';
if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, cstr))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_string: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY, "H5Dread_string: out of memory - unable to construct string from UTF characters");
}
ENVPTR->SetObjectArrayElement(ENVONLY, j_buf, i, jstr);
@@ -1016,15 +1025,15 @@ done:
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite_1string
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jobjectArray j_buf)
+Java_hdf_hdf5lib_H5_H5Dwrite_1string(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id,
+ jobjectArray j_buf)
{
const char *utf8 = NULL;
jstring obj;
size_t i, str_len;
jsize n;
- char *c_buf = NULL;
+ char * c_buf = NULL;
herr_t status = FAIL;
UNUSED(clss);
@@ -1040,11 +1049,11 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1string
if (!(str_len = H5Tget_size((hid_t)mem_type_id)))
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len)))
+ if (NULL == (c_buf = (char *)HDmalloc((size_t)n * str_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dwrite_string: memory allocation failed");
- for (i = 0; i < (size_t) n; i++) {
- if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)j_buf, (jsize) i))) {
+ for (i = 0; i < (size_t)n; i++) {
+ if (NULL == (obj = (jstring)ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)j_buf, (jsize)i))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
/*
@@ -1069,8 +1078,8 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1string
ENVPTR->DeleteLocalRef(ENVONLY, obj);
} /* end for */
- if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf)) < 0)
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id,
+ (hid_t)xfer_plist_id, c_buf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -1088,17 +1097,16 @@ done:
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5DreadVL
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
+Java_hdf_hdf5lib_H5_H5DreadVL(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
{
H5T_class_t type_class;
- htri_t isStr = 0;
- htri_t isVlenStr = 0;
- htri_t isComplex = 0;
+ htri_t isStr = 0;
+ htri_t isVlenStr = 0;
+ htri_t isComplex = 0;
htri_t isComplex2 = 0;
hid_t nested_tid = H5I_INVALID_HID;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1118,7 +1126,7 @@ Java_hdf_hdf5lib_H5_H5DreadVL
if ((num_members = H5Tget_nmembers(mem_type_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- for (i = 0; i < (unsigned) num_members; i++) {
+ for (i = 0; i < (unsigned)num_members; i++) {
if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -1140,13 +1148,13 @@ Java_hdf_hdf5lib_H5_H5DreadVL
}
if (!isStr || isComplex || isVlenStr) {
- if ((status = H5DreadVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id,
- (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ if ((status = H5DreadVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
else if (isStr) {
- if ((status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
- (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ if ((status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
@@ -1163,21 +1171,22 @@ done:
* buffer in turn.
*/
static herr_t
-H5DreadVL_str
- (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf)
+H5DreadVL_str(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id,
+ jobjectArray buf)
{
- jstring jstr;
- jsize i, n;
- char **strs = NULL;
- herr_t status = FAIL;
+ jstring jstr;
+ jsize i, n;
+ char ** strs = NULL;
+ herr_t status = FAIL;
if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DreadVL_str: buf length < 0");
}
- if (NULL == (strs = (char **) HDcalloc((size_t)n, sizeof(char *))))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DreadVL_str: failed to allocate variable length string read buffer");
+ if (NULL == (strs = (char **)HDcalloc((size_t)n, sizeof(char *))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "H5DreadVL_str: failed to allocate variable length string read buffer");
if ((status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, strs)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -1221,19 +1230,19 @@ done:
* in the output buffer in turn.
*/
static herr_t
-H5DreadVL_asstr
- (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf)
+H5DreadVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id,
+ jobjectArray buf)
{
- H5T_class_t tclass;
- jstring jstr;
- h5str_t h5str;
- hbool_t close_mem_space = FALSE;
- size_t typeSize;
- size_t i;
- hid_t mem_space = mem_sid;
- jsize n;
- void *readBuf = NULL;
- herr_t status = FAIL;
+ H5T_class_t tclass;
+ jstring jstr;
+ h5str_t h5str;
+ hbool_t close_mem_space = FALSE;
+ size_t typeSize;
+ size_t i;
+ hid_t mem_space = mem_sid;
+ jsize n;
+ void * readBuf = NULL;
+ herr_t status = FAIL;
HDmemset(&h5str, 0, sizeof(h5str_t));
@@ -1278,16 +1287,16 @@ H5DreadVL_asstr
H5_LIBRARY_ERROR(ENVONLY);
/* Convert each element to a char string */
- for (i = 0; i < (size_t) n; i++) {
+ for (i = 0; i < (size_t)n; i++) {
h5str.s[0] = '\0';
- if (!h5str_sprintf(ENVONLY, &h5str, did, tid, &(((char *) readBuf)[i * typeSize]), typeSize, 0))
+ if (!h5str_sprintf(ENVONLY, &h5str, did, tid, &(((char *)readBuf)[i * typeSize]), typeSize, 0))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s)))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- ENVPTR->SetObjectArrayElement(ENVONLY, buf, (jsize) i, jstr);
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, (jsize)i, jstr);
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
ENVPTR->DeleteLocalRef(ENVONLY, jstr);
@@ -1319,12 +1328,12 @@ done:
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1VLStrings
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
+Java_hdf_hdf5lib_H5_H5Dread_1VLStrings(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id,
+ jobjectArray buf)
{
htri_t isVlenStr = 0;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1335,8 +1344,8 @@ Java_hdf_hdf5lib_H5_H5Dread_1VLStrings
H5_LIBRARY_ERROR(ENVONLY);
if (isVlenStr) {
- if ((status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
- (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ if ((status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
}
else
@@ -1352,17 +1361,16 @@ done:
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5DwriteVL
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
+Java_hdf_hdf5lib_H5_H5DwriteVL(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
{
H5T_class_t type_class;
- htri_t isStr = 0;
- htri_t isVlenStr = 0;
- htri_t isComplex = 0;
+ htri_t isStr = 0;
+ htri_t isVlenStr = 0;
+ htri_t isComplex = 0;
htri_t isComplex2 = 0;
hid_t nested_tid = H5I_INVALID_HID;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1382,7 +1390,7 @@ Java_hdf_hdf5lib_H5_H5DwriteVL
if ((num_members = H5Tget_nmembers(mem_type_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- for (i = 0; i < (unsigned) num_members; i++) {
+ for (i = 0; i < (unsigned)num_members; i++) {
if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -1404,13 +1412,13 @@ Java_hdf_hdf5lib_H5_H5DwriteVL
}
if (!isStr || isComplex || isVlenStr) {
- if ((status = H5DwriteVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id,
- (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ if ((status = H5DwriteVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
else if (isStr) {
- if ((status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
- (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ if ((status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
@@ -1426,28 +1434,29 @@ done:
* The buffer of C-strings is then written to the HDF5 dataset specified.
*/
static herr_t
-H5DwriteVL_str
- (JNIEnv *env, hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t xfer_plist_id, jobjectArray buf)
+H5DwriteVL_str(JNIEnv *env, hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
+ hid_t xfer_plist_id, jobjectArray buf)
{
- const char *utf8 = NULL;
- jstring obj;
- jsize size;
- jsize i;
- char **writeBuf = NULL;
- herr_t status = FAIL;
-
- if ((size = ENVPTR->GetArrayLength(ENVONLY, (jarray) buf)) < 0) {
+ const char *utf8 = NULL;
+ jstring obj;
+ jsize size;
+ jsize i;
+ char ** writeBuf = NULL;
+ herr_t status = FAIL;
+
+ if ((size = ENVPTR->GetArrayLength(ENVONLY, (jarray)buf)) < 0) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DwriteVL_str: buf length < 0");
}
- if (NULL == (writeBuf = (char **) HDcalloc((size_t)size + 1, sizeof(char *))))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DwriteVL_str: failed to allocate variable length string write buffer");
+ if (NULL == (writeBuf = (char **)HDcalloc((size_t)size + 1, sizeof(char *))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "H5DwriteVL_str: failed to allocate variable length string write buffer");
for (i = 0; i < size; ++i) {
jsize length;
- if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, i))) {
+ if (NULL == (obj = (jstring)ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, i))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
/*
@@ -1462,7 +1471,7 @@ H5DwriteVL_str
PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5DwriteVL_str: string not pinned");
- if (NULL == (writeBuf[i] = (char *) HDmalloc((size_t)length + 1)))
+ if (NULL == (writeBuf[i] = (char *)HDmalloc((size_t)length + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DwriteVL_str: failed to allocate string buffer");
HDstrncpy(writeBuf[i], utf8, (size_t)length + 1);
@@ -1474,7 +1483,8 @@ H5DwriteVL_str
ENVPTR->DeleteLocalRef(ENVONLY, obj);
} /* end for (i = 0; i < size; ++i) */
- if ((status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, writeBuf)) < 0)
+ if ((status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, writeBuf)) <
+ 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -1498,18 +1508,18 @@ done:
* elements is then written to the HDF5 dataset.
*/
static herr_t
-H5DwriteVL_asstr
- (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf)
+H5DwriteVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id,
+ jobjectArray buf)
{
- const char *utf8 = NULL;
- jstring obj = NULL;
+ const char *utf8 = NULL;
+ jstring obj = NULL;
hbool_t close_mem_space = FALSE;
size_t typeSize;
size_t i;
hid_t mem_space = mem_sid;
jsize n;
- void *writeBuf = NULL;
- herr_t status = FAIL;
+ void * writeBuf = NULL;
+ herr_t status = FAIL;
if (mem_space == H5S_ALL) {
mem_space = file_sid;
@@ -1538,14 +1548,14 @@ H5DwriteVL_asstr
if (NULL == (writeBuf = HDcalloc((size_t)n, typeSize)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL_asstr: failed to allocate write buffer");
- for (i = 0; i < (size_t) n; ++i) {
- if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, (jsize) i))) {
+ for (i = 0; i < (size_t)n; ++i) {
+ if (NULL == (obj = (jstring)ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, (jsize)i))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
/*
* If the string object was NULL, skip it.
*/
- HDmemset(&(((char *) writeBuf)[i * typeSize]), 0, typeSize);
+ HDmemset(&(((char *)writeBuf)[i * typeSize]), 0, typeSize);
continue;
}
@@ -1561,7 +1571,7 @@ H5DwriteVL_asstr
* one before destroying it with h5str_convert.
*/
- if (!h5str_convert(ENVONLY, (char **) &utf8, did, tid, &(((char *) writeBuf)[i * typeSize]), 0))
+ if (!h5str_convert(ENVONLY, (char **)&utf8, did, tid, &(((char *)writeBuf)[i * typeSize]), 0))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
@@ -1592,12 +1602,12 @@ done:
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
+Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id,
+ jobjectArray buf)
{
- htri_t isVlenStr = 0;
- herr_t status = FAIL;
+ htri_t isVlenStr = 0;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1608,8 +1618,8 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings
H5_LIBRARY_ERROR(ENVONLY);
if (isVlenStr) {
- if ((status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
- (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ if ((status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
} /* end if */
else
@@ -1625,16 +1635,15 @@ done:
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref
- (JNIEnv *env, jclass clss,
- jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
+Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id,
+ jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id,
+ jobjectArray buf)
{
- H5R_ref_t *ref_data = NULL;
- h5str_t h5str;
- jstring jstr;
- jsize i, n;
- herr_t status = FAIL;
+ H5R_ref_t *ref_data = NULL;
+ h5str_t h5str;
+ jstring jstr;
+ jsize i, n;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1645,10 +1654,11 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_reg_ref: buf length < 0");
}
- if (NULL == (ref_data = (H5R_ref_t *) HDcalloc(1, (size_t)n * sizeof(H5R_ref_t))))
+ if (NULL == (ref_data = (H5R_ref_t *)HDcalloc(1, (size_t)n * sizeof(H5R_ref_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_reg_ref: failed to allocate read buffer");
- if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, xfer_plist_id, ref_data)) < 0)
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id,
+ xfer_plist_id, ref_data)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
h5str_new(&h5str, 1024);
@@ -1659,7 +1669,8 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref
for (i = 0; i < n; i++) {
h5str.s[0] = '\0';
- if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)dataset_id, (hid_t)mem_type_id, (void*)&ref_data[i], 0, 0))
+ if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)dataset_id, (hid_t)mem_type_id, (void *)&ref_data[i], 0,
+ 0))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s)))
@@ -1686,12 +1697,12 @@ done:
* Signature: (JLjava/lang/String;JJJJJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Dcreate2
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id,
- jlong space_id, jlong link_plist_id, jlong create_plist_id, jlong access_plist_id)
+Java_hdf_hdf5lib_H5__1H5Dcreate2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id,
+ jlong space_id, jlong link_plist_id, jlong create_plist_id,
+ jlong access_plist_id)
{
const char *dsetName = NULL;
- hid_t dset_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
UNUSED(clss);
@@ -1700,7 +1711,8 @@ Java_hdf_hdf5lib_H5__1H5Dcreate2
PIN_JAVA_STRING(ENVONLY, name, dsetName, NULL, "H5Dcreate2: dataset name not pinned");
- if ((dset_id = H5Dcreate2((hid_t)loc_id, dsetName, (hid_t)type_id, (hid_t)space_id, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id)) < 0)
+ if ((dset_id = H5Dcreate2((hid_t)loc_id, dsetName, (hid_t)type_id, (hid_t)space_id, (hid_t)link_plist_id,
+ (hid_t)create_plist_id, (hid_t)access_plist_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -1716,11 +1728,10 @@ done:
* Signature: (JLjava/lang/String;J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Dopen2
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist)
+Java_hdf_hdf5lib_H5__1H5Dopen2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist)
{
const char *dsetName = NULL;
- hid_t dset_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
UNUSED(clss);
@@ -1745,14 +1756,15 @@ done:
* Signature: (JJJJJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Dcreate_1anon
- (JNIEnv *env, jclass clss, jlong loc_id, jlong type_id, jlong space_id, jlong dcpl_id, jlong dapl_id)
+Java_hdf_hdf5lib_H5__1H5Dcreate_1anon(JNIEnv *env, jclass clss, jlong loc_id, jlong type_id, jlong space_id,
+ jlong dcpl_id, jlong dapl_id)
{
hid_t dset_id = H5I_INVALID_HID;
UNUSED(clss);
- if ((dset_id = H5Dcreate_anon((hid_t)loc_id, (hid_t)type_id, (hid_t)space_id, (hid_t)dcpl_id, (hid_t)dapl_id)) < 0)
+ if ((dset_id = H5Dcreate_anon((hid_t)loc_id, (hid_t)type_id, (hid_t)space_id, (hid_t)dcpl_id,
+ (hid_t)dapl_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -1765,8 +1777,7 @@ done:
* Signature: (J)I;
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dget_1space_1status
- (JNIEnv *env, jclass clss, jlong loc_id)
+Java_hdf_hdf5lib_H5_H5Dget_1space_1status(JNIEnv *env, jclass clss, jlong loc_id)
{
H5D_space_status_t space_status = H5D_SPACE_STATUS_ERROR;
@@ -1785,8 +1796,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Dget_1access_1plist
- (JNIEnv *env, jclass clss, jlong loc_id)
+Java_hdf_hdf5lib_H5_H5Dget_1access_1plist(JNIEnv *env, jclass clss, jlong loc_id)
{
hid_t retVal = H5I_INVALID_HID;
@@ -1805,8 +1815,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Dget_1offset
- (JNIEnv *env, jclass clss, jlong loc_id)
+Java_hdf_hdf5lib_H5_H5Dget_1offset(JNIEnv *env, jclass clss, jlong loc_id)
{
haddr_t offset = HADDR_UNDEF;
@@ -1825,8 +1834,8 @@ done:
* Signature: (JJJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong type_id, jlong space_id)
+Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size(JNIEnv *env, jclass clss, jlong dataset_id, jlong type_id,
+ jlong space_id)
{
hsize_t sz = 0;
@@ -1845,14 +1854,14 @@ done:
* Signature: ([BJ[BJJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Dfill
- (JNIEnv *env, jclass clss, jbyteArray fill, jlong fill_type_id, jbyteArray buf, jlong buf_type_id, jlong space_id)
+Java_hdf_hdf5lib_H5_H5Dfill(JNIEnv *env, jclass clss, jbyteArray fill, jlong fill_type_id, jbyteArray buf,
+ jlong buf_type_id, jlong space_id)
{
- jboolean isCopy1;
- jboolean isCopy2;
- herr_t status = FAIL;
- jbyte *fillP = NULL;
- jbyte *buffP = NULL;
+ jboolean isCopy1;
+ jboolean isCopy2;
+ herr_t status = FAIL;
+ jbyte * fillP = NULL;
+ jbyte * buffP = NULL;
UNUSED(clss);
@@ -1865,7 +1874,8 @@ Java_hdf_hdf5lib_H5_H5Dfill
PIN_BYTE_ARRAY(ENVONLY, fill, fillP, &isCopy1, "H5Dfill: fill buffer not pinned");
}
- if ((status = H5Dfill((const void *)fillP, (hid_t)fill_type_id, (void *)buffP, (hid_t)buf_type_id, (hid_t)space_id)) < 0)
+ if ((status = H5Dfill((const void *)fillP, (hid_t)fill_type_id, (void *)buffP, (hid_t)buf_type_id,
+ (hid_t)space_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if (fillP) {
@@ -1886,15 +1896,14 @@ done:
* Signature: (J[J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Dset_1extent
- (JNIEnv *env, jclass clss, jlong loc_id, jlongArray buf)
+Java_hdf_hdf5lib_H5_H5Dset_1extent(JNIEnv *env, jclass clss, jlong loc_id, jlongArray buf)
{
- jboolean isCopy;
- hsize_t *dims = NULL;
- herr_t status;
- jsize rank;
- jlong *dimsBuf = NULL;
- int i = 0;
+ jboolean isCopy;
+ hsize_t *dims = NULL;
+ herr_t status;
+ jsize rank;
+ jlong * dimsBuf = NULL;
+ int i = 0;
UNUSED(clss);
@@ -1908,7 +1917,7 @@ Java_hdf_hdf5lib_H5_H5Dset_1extent
PIN_LONG_ARRAY(ENVONLY, buf, dimsBuf, &isCopy, "H5Dset_extent: buffer not pinned");
- if (NULL == (dims = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ if (NULL == (dims = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dset_extent: failed to allocate dataset dimension buffer");
for (i = 0; i < rank; i++)
@@ -1925,18 +1934,18 @@ done:
} /* end Java_hdf_hdf5lib_H5_H5Dset_1extent */
static herr_t
-H5D_iterate_cb
- (void *elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *cb_data) {
+H5D_iterate_cb(void *elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *cb_data)
+{
cb_wrapper *wrapper = (cb_wrapper *)cb_data;
jbyteArray elemArray;
jlongArray pointArray;
jmethodID mid;
jobject visit_callback = wrapper->visit_callback;
jclass cls;
- JNIEnv *cbenv = NULL;
+ JNIEnv * cbenv = NULL;
jint status = FAIL;
jsize size;
- void *op_data = (void *)wrapper->op_data;
+ void * op_data = (void *)wrapper->op_data;
if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
@@ -1946,7 +1955,8 @@ H5D_iterate_cb
if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "([BJI[JLhdf/hdf5lib/callbacks/H5D_iterate_t;)I")))
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback",
+ "([BJI[JLhdf/hdf5lib/callbacks/H5D_iterate_t;)I")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
if (NULL == elem)
@@ -1969,7 +1979,8 @@ H5D_iterate_cb
CBENVPTR->SetLongArrayRegion(CBENVONLY, pointArray, 0, 2, (const jlong *)point);
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, (void *)elemArray, elem_id, ndim, pointArray, op_data);
+ status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, (void *)elemArray, elem_id, ndim,
+ pointArray, op_data);
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
CBENVPTR->GetByteArrayRegion(CBENVONLY, elemArray, 0, size, (jbyte *)elem);
@@ -1988,14 +1999,13 @@ done:
* Signature: ([BJJLjava/lang/Object;Ljava/lang/Object;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Diterate
- (JNIEnv *env, jclass clss, jbyteArray buf, jlong buf_type, jlong space,
- jobject callback_op, jobject op_data)
+Java_hdf_hdf5lib_H5_H5Diterate(JNIEnv *env, jclass clss, jbyteArray buf, jlong buf_type, jlong space,
+ jobject callback_op, jobject op_data)
{
- cb_wrapper wrapper = { callback_op, op_data };
- jboolean isCopy;
- jbyte *iterBuf = NULL;
- herr_t status = FAIL;
+ cb_wrapper wrapper = {callback_op, op_data};
+ jboolean isCopy;
+ jbyte * iterBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -2011,12 +2021,14 @@ Java_hdf_hdf5lib_H5_H5Diterate
PIN_BYTE_ARRAY(ENVONLY, buf, iterBuf, &isCopy, "H5Diterate: buffer not pinned");
- if ((status = H5Diterate((void *)iterBuf, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void *)&wrapper)) < 0)
+ if ((status = H5Diterate((void *)iterBuf, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb,
+ (void *)&wrapper)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
if (iterBuf)
- UNPIN_BYTE_ARRAY(ENVONLY, buf, iterBuf, (status < 0) ? (JNI_ABORT) : ((isCopy == JNI_TRUE) ? 0 : JNI_ABORT));
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, iterBuf,
+ (status < 0) ? (JNI_ABORT) : ((isCopy == JNI_TRUE) ? 0 : JNI_ABORT));
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Diterate */
@@ -2027,8 +2039,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Dflush
- (JNIEnv *env, jclass clss, jlong loc_id)
+Java_hdf_hdf5lib_H5_H5Dflush(JNIEnv *env, jclass clss, jlong loc_id)
{
UNUSED(clss);
@@ -2045,8 +2056,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Drefresh
- (JNIEnv *env, jclass clss, jlong loc_id)
+Java_hdf_hdf5lib_H5_H5Drefresh(JNIEnv *env, jclass clss, jlong loc_id)
{
UNUSED(clss);
diff --git a/java/src/jni/h5dImp.h b/java/src/jni/h5dImp.h
index f824452..b9ad1bb 100644
--- a/java/src/jni/h5dImp.h
+++ b/java/src/jni/h5dImp.h
@@ -21,357 +21,303 @@
extern "C" {
#endif /* __cplusplus */
-
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Dcreate
* Signature: (JLjava/lang/String;JJJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Dcreate
- (JNIEnv*, jclass, jlong, jstring, jlong, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dcreate(JNIEnv *, jclass, jlong, jstring, jlong, jlong,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Dopen
* Signature: (JLjava/lang/String;)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Dopen
- (JNIEnv*, jclass, jlong, jstring);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dopen(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Dget_space
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Dget_1space
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dget_1space(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Dget_type
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Dget_1type
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dget_1type(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Dget_create_plist
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Dget_1create_1plist
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dget_1create_1plist(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dread
* Signature: (JJJJJ[BZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jbyteArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread(JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong,
+ jbyteArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dwrite
* Signature: (JJJJJ[BZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jbyteArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite(JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong,
+ jbyteArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Dclose
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Dclose
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Dclose(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dget_storage_size
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Dget_1storage_1size
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Dget_1storage_1size(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dvlen_reclaim
* Signature: (JJJ[B)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim
- (JNIEnv*, jclass, jlong, jlong, jlong, jbyteArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim(JNIEnv *, jclass, jlong, jlong, jlong,
+ jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dread_short
* Signature: (JJJJJ[SZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1short
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jshortArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1short(JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong,
+ jshortArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dwrite_short
* Signature: (JJJJJ[SZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite_1short
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jshortArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1short(JNIEnv *, jclass, jlong, jlong, jlong, jlong,
+ jlong, jshortArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dread_int
* Signature: (JJJJJ[IZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1int
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jintArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1int(JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong,
+ jintArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dwrite_int
* Signature: (JJJJJ[IZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite_1int
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jintArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1int(JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong,
+ jintArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dread_long
* Signature: (JJJJJ[JZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1long
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jlongArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1long(JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong,
+ jlongArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dwrite_long
* Signature: (JJJJJ[JZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite_1long
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jlongArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1long(JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong,
+ jlongArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dread_float
* Signature: (JJJJJ[FZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1float
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jfloatArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1float(JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong,
+ jfloatArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dwrite_float
* Signature: (JJJJJ[FZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite_1float
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jfloatArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1float(JNIEnv *, jclass, jlong, jlong, jlong, jlong,
+ jlong, jfloatArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dread_double
* Signature: (JJJJJ[DZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1double
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jdoubleArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1double(JNIEnv *, jclass, jlong, jlong, jlong, jlong,
+ jlong, jdoubleArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dwrite_double
* Signature: (JJJJJ[DZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite_1double
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jdoubleArray, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1double(JNIEnv *, jclass, jlong, jlong, jlong, jlong,
+ jlong, jdoubleArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5DreadVL
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5DreadVL
-(JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5DreadVL(JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong,
+ jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5DwriteVL
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5DwriteVL
-(JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5DwriteVL(JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong,
+ jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dread_string
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1string
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1string(JNIEnv *, jclass, jlong, jlong, jlong, jlong,
+ jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dwrite_string
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite_1string
-(JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1string(JNIEnv *, jclass, jlong, jlong, jlong, jlong,
+ jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dread_VLStrings
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1VLStrings
-(JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1VLStrings(JNIEnv *, jclass, jlong, jlong, jlong, jlong,
+ jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dwrite_VLStrings
* Signature: (JJJJJ[B)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings(JNIEnv *, jclass, jlong, jlong, jlong, jlong,
+ jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dread_reg_ref
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref
-(JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref(JNIEnv *, jclass, jlong, jlong, jlong, jlong,
+ jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Dcreate2
* Signature: (JLjava/lang/String;JJJJJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Dcreate2
- (JNIEnv*, jclass, jlong, jstring, jlong, jlong, jlong, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dcreate2(JNIEnv *, jclass, jlong, jstring, jlong, jlong,
+ jlong, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Dopen2
* Signature: (JLjava/lang/String;J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Dopen2
- (JNIEnv*, jclass, jlong, jstring, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dopen2(JNIEnv *, jclass, jlong, jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Dcreate_anon
* Signature: (JJJJJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Dcreate_1anon
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dcreate_1anon(JNIEnv *, jclass, jlong, jlong, jlong, jlong,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dget_space_status
* Signature: (J)I;
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dget_1space_1status
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dget_1space_1status(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dget_access_plist
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Dget_1access_1plist
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Dget_1access_1plist(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dget_offset
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Dget_1offset
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Dget_1offset(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dvlen_get_buf_size
* Signature: (JJJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size
- (JNIEnv*, jclass, jlong, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size(JNIEnv *, jclass, jlong, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dfill
* Signature: ([BJ[BJJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Dfill
- (JNIEnv*, jclass, jbyteArray, jlong, jbyteArray, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Dfill(JNIEnv *, jclass, jbyteArray, jlong, jbyteArray, jlong,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dset_extent
* Signature: (J[J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Dset_1extent
- (JNIEnv*, jclass, jlong, jlongArray);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Dset_1extent(JNIEnv *, jclass, jlong, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Diterate
* Signature: ([BJJLjava/lang/Object;Ljava/lang/Object;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Diterate
- (JNIEnv*, jclass, jbyteArray, jlong, jlong, jobject, jobject);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Diterate(JNIEnv *, jclass, jbyteArray, jlong, jlong, jobject,
+ jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dflush
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Dflush
- (JNIEnv*, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Dflush(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Drefresh
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Drefresh
- (JNIEnv*, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Drefresh(JNIEnv *, jclass, jlong);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c
index 80e23a1..13826dc 100644
--- a/java/src/jni/h5eImp.c
+++ b/java/src/jni/h5eImp.c
@@ -61,8 +61,7 @@ static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *cb_data);
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2
- (JNIEnv *env, jclass clss, jlong stk_id)
+Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2(JNIEnv *env, jclass clss, jlong stk_id)
{
unsigned int is_stack = 0;
@@ -84,13 +83,13 @@ done:
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Eregister_1class
- (JNIEnv *env, jclass clss, jstring cls_name, jstring lib_name, jstring version)
+Java_hdf_hdf5lib_H5_H5Eregister_1class(JNIEnv *env, jclass clss, jstring cls_name, jstring lib_name,
+ jstring version)
{
- const char* the_cls_name = NULL;
- const char* the_lib_name = NULL;
- const char* the_version = NULL;
- hid_t ret_val = H5I_INVALID_HID;
+ const char *the_cls_name = NULL;
+ const char *the_lib_name = NULL;
+ const char *the_version = NULL;
+ hid_t ret_val = H5I_INVALID_HID;
UNUSED(clss);
@@ -125,8 +124,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Eunregister_1class
- (JNIEnv *env, jclass clss, jlong cls_id)
+Java_hdf_hdf5lib_H5_H5Eunregister_1class(JNIEnv *env, jclass clss, jlong cls_id)
{
UNUSED(clss);
@@ -146,8 +144,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Eclose_1msg
- (JNIEnv *env, jclass clss, jlong err_id)
+Java_hdf_hdf5lib_H5_H5Eclose_1msg(JNIEnv *env, jclass clss, jlong err_id)
{
UNUSED(clss);
@@ -167,12 +164,11 @@ done:
* Signature: (JILjava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Ecreate_1msg
- (JNIEnv *env, jclass clss, jlong err_id, jint msg_type, jstring err_msg)
+Java_hdf_hdf5lib_H5_H5Ecreate_1msg(JNIEnv *env, jclass clss, jlong err_id, jint msg_type, jstring err_msg)
{
H5E_type_t error_msg_type = (H5E_type_t)msg_type;
- const char *the_err_msg = NULL;
- hid_t ret_val = H5I_INVALID_HID;
+ const char *the_err_msg = NULL;
+ hid_t ret_val = H5I_INVALID_HID;
UNUSED(clss);
@@ -199,8 +195,7 @@ done:
* Signature: ()J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Ecreate_1stack
- (JNIEnv *env, jclass clss)
+Java_hdf_hdf5lib_H5_H5Ecreate_1stack(JNIEnv *env, jclass clss)
{
hid_t ret_val = H5I_INVALID_HID;
@@ -219,8 +214,7 @@ done:
* Signature: ()J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Eget_1current_1stack
- (JNIEnv *env, jclass clss)
+Java_hdf_hdf5lib_H5_H5Eget_1current_1stack(JNIEnv *env, jclass clss)
{
hid_t ret_val = H5I_INVALID_HID;
@@ -239,8 +233,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Eclose_1stack
- (JNIEnv *env, jclass clss, jlong stk_id)
+Java_hdf_hdf5lib_H5_H5Eclose_1stack(JNIEnv *env, jclass clss, jlong stk_id)
{
UNUSED(clss);
@@ -260,8 +253,7 @@ done:
* Signature: (JLjava/lang/Object;)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Eprint2
- (JNIEnv *env, jclass clss, jlong stk_id, jobject stream_obj)
+Java_hdf_hdf5lib_H5_H5Eprint2(JNIEnv *env, jclass clss, jlong stk_id, jobject stream_obj)
{
herr_t ret_val = FAIL;
@@ -289,12 +281,11 @@ done:
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Eget_1class_1name
- (JNIEnv *env, jclass clss, jlong cls_id)
+Java_hdf_hdf5lib_H5_H5Eget_1class_1name(JNIEnv *env, jclass clss, jlong cls_id)
{
- jstring str = NULL;
- ssize_t buf_size;
- char *namePtr = NULL;
+ jstring str = NULL;
+ ssize_t buf_size;
+ char * namePtr = NULL;
UNUSED(clss);
@@ -308,7 +299,7 @@ Java_hdf_hdf5lib_H5_H5Eget_1class_1name
if (!buf_size)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_class_name: no class name");
- if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ if (NULL == (namePtr = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Eget_class_name: malloc failed");
if ((H5Eget_class_name((hid_t)cls_id, (char *)namePtr, (size_t)buf_size + 1)) < 0)
@@ -331,8 +322,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Eset_1current_1stack
- (JNIEnv *env, jclass clss, jlong stk_id)
+Java_hdf_hdf5lib_H5_H5Eset_1current_1stack(JNIEnv *env, jclass clss, jlong stk_id)
{
UNUSED(clss);
@@ -352,8 +342,7 @@ done:
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Epop
- (JNIEnv *env, jclass clss, jlong stk_id, jlong count)
+Java_hdf_hdf5lib_H5_H5Epop(JNIEnv *env, jclass clss, jlong stk_id, jlong count)
{
UNUSED(clss);
@@ -373,13 +362,13 @@ done:
* Signature: (JLjava/lang/String;Ljava/lang/String;IJJJLjava/lang/String;)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Epush2
- (JNIEnv *env, jclass clss, jlong stk_id, jstring filename, jstring funcname,
- jint linenumber, jlong class_id, jlong major_id, jlong minor_id, jstring err_desc)
+Java_hdf_hdf5lib_H5_H5Epush2(JNIEnv *env, jclass clss, jlong stk_id, jstring filename, jstring funcname,
+ jint linenumber, jlong class_id, jlong major_id, jlong minor_id,
+ jstring err_desc)
{
- const char *fName = NULL;
+ const char *fName = NULL;
const char *fncName = NULL;
- const char *errMsg = NULL;
+ const char *errMsg = NULL;
herr_t ret_val = FAIL;
UNUSED(clss);
@@ -404,7 +393,7 @@ Java_hdf_hdf5lib_H5_H5Epush2
PIN_JAVA_STRING(ENVONLY, err_desc, errMsg, NULL, "H5Epush2: error message not pinned");
if ((ret_val = H5Epush2((hid_t)stk_id, fName, fncName, (unsigned)linenumber, (hid_t)class_id,
- (hid_t)major_id, (hid_t)minor_id, errMsg)) < 0)
+ (hid_t)major_id, (hid_t)minor_id, errMsg)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -422,8 +411,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Eclear2
- (JNIEnv *env, jclass clss, jlong stk_id)
+Java_hdf_hdf5lib_H5_H5Eclear2(JNIEnv *env, jclass clss, jlong stk_id)
{
UNUSED(clss);
@@ -443,14 +431,13 @@ done:
* Signature: (J[I)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Eget_1msg
- (JNIEnv *env, jclass clss, jlong msg_id, jintArray error_msg_type_list)
+Java_hdf_hdf5lib_H5_H5Eget_1msg(JNIEnv *env, jclass clss, jlong msg_id, jintArray error_msg_type_list)
{
- H5E_type_t error_msg_type;
- jstring str = NULL;
- ssize_t buf_size;
- jint *theArray = NULL;
- char *namePtr = NULL;
+ H5E_type_t error_msg_type;
+ jstring str = NULL;
+ ssize_t buf_size;
+ jint * theArray = NULL;
+ char * namePtr = NULL;
UNUSED(clss);
@@ -466,7 +453,7 @@ Java_hdf_hdf5lib_H5_H5Eget_1msg
if (!buf_size)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_msg: invalid message");
- if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ if (NULL == (namePtr = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Eget_msg: malloc failed");
PIN_INT_ARRAY(ENVONLY, error_msg_type_list, theArray, NULL, "H5Eget_msg: error_msg_type_list not pinned");
@@ -495,8 +482,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Eget_1num
- (JNIEnv *env, jclass clss, jlong stk_id)
+Java_hdf_hdf5lib_H5_H5Eget_1num(JNIEnv *env, jclass clss, jlong stk_id)
{
ssize_t ret_val = -1;
@@ -513,8 +499,7 @@ done:
} /* end Java_hdf_hdf5lib_H5_H5Eget_1num */
static herr_t
-H5E_walk_cb
- (int nindx, const H5E_error2_t *info, void *cb_data)
+H5E_walk_cb(int nindx, const H5E_error2_t *info, void *cb_data)
{
cb_wrapper *wrapper = (cb_wrapper *)cb_data;
jmethodID mid;
@@ -522,10 +507,10 @@ H5E_walk_cb
jstring str1, str2, str3;
jobject cb_info_t = NULL;
jvalue args[7];
- JNIEnv *cbenv = NULL;
+ JNIEnv * cbenv = NULL;
jclass cbcls;
- void *op_data = (void *)wrapper->op_data;
- jint status = FAIL;
+ void * op_data = (void *)wrapper->op_data;
+ jint status = FAIL;
if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
@@ -535,7 +520,9 @@ H5E_walk_cb
if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(ILhdf/hdf5lib/structs/H5E_error2_t;Lhdf/hdf5lib/callbacks/H5E_walk_t;)I")))
+ if (NULL == (mid = CBENVPTR->GetMethodID(
+ CBENVONLY, cbcls, "callback",
+ "(ILhdf/hdf5lib/structs/H5E_error2_t;Lhdf/hdf5lib/callbacks/H5E_walk_t;)I")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
args[0].j = info->cls_id;
@@ -558,7 +545,8 @@ H5E_walk_cb
args[6].l = str3;
- CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5E_error2_t", "(JJJILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", args, cb_info_t);
+ CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5E_error2_t",
+ "(JJJILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", args, cb_info_t);
status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, nindx, cb_info_t, op_data);
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
@@ -576,10 +564,10 @@ done:
* Signature: (JJLjava/lang/Object;Ljava/lang/Object;)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Ewalk2
- (JNIEnv *env, jclass clss, jlong stk_id, jlong direction, jobject callback_op, jobject op_data)
+Java_hdf_hdf5lib_H5_H5Ewalk2(JNIEnv *env, jclass clss, jlong stk_id, jlong direction, jobject callback_op,
+ jobject op_data)
{
- cb_wrapper wrapper = { callback_op, op_data };
+ cb_wrapper wrapper = {callback_op, op_data};
UNUSED(clss);
diff --git a/java/src/jni/h5eImp.h b/java/src/jni/h5eImp.h
index 051b2ed..4754965 100644
--- a/java/src/jni/h5eImp.h
+++ b/java/src/jni/h5eImp.h
@@ -21,159 +21,125 @@
extern "C" {
#endif /* __cplusplus */
-
/*
* Class: hdf_hdf5lib_H5
* Method: H5Eauto_is_v2
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Eregister_class
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Eregister_1class
- (JNIEnv *, jclass, jstring, jstring, jstring);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Eregister_1class(JNIEnv *, jclass, jstring, jstring, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Eunregister_class
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Eunregister_1class
- (JNIEnv *, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eunregister_1class(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Eclose_msg
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Eclose_1msg
- (JNIEnv *, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eclose_1msg(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Ecreate_msg
* Signature: (JILjava/lang/String;)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Ecreate_1msg
- (JNIEnv *, jclass, jlong, jint, jstring);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Ecreate_1msg(JNIEnv *, jclass, jlong, jint, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Ecreate_stack
* Signature: ()J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Ecreate_1stack
- (JNIEnv *, jclass);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Ecreate_1stack(JNIEnv *, jclass);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Eget_current_stack
* Signature: ()J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Eget_1current_1stack
- (JNIEnv *, jclass);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Eget_1current_1stack(JNIEnv *, jclass);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Eclose_stack
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Eclose_1stack
- (JNIEnv *, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eclose_1stack(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Eprint2
* Signature: (JLjava/lang/Object;)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Eprint2
- (JNIEnv *, jclass, jlong, jobject);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eprint2(JNIEnv *, jclass, jlong, jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Eget_class_name
* Signature: (J)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Eget_1class_1name
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Eget_1class_1name(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Eset_current_stack
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Eset_1current_1stack
- (JNIEnv *, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eset_1current_1stack(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Epop
* Signature: (JJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Epop
- (JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Epop(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Epush2
* Signature: (JLjava/lang/String;Ljava/lang/String;IJJJLjava/lang/String;)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Epush2
- (JNIEnv *, jclass, jlong, jstring, jstring, jint, jlong, jlong, jlong, jstring);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Epush2(JNIEnv *, jclass, jlong, jstring, jstring, jint, jlong,
+ jlong, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Eclear2
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Eclear2
- (JNIEnv *, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eclear2(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Eget_msg
* Signature: (J[I)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Eget_1msg
- (JNIEnv *, jclass, jlong, jintArray);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Eget_1msg(JNIEnv *, jclass, jlong, jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Eget_num
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Eget_1num
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Eget_1num(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Ewalk2
* Signature: (JJLjava/lang/Object;Ljava/lang/Object;)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Ewalk2
- (JNIEnv *, jclass, jlong, jlong, jobject, jobject);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ewalk2(JNIEnv *, jclass, jlong, jlong, jobject, jobject);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c
index 3b7b96c..76c5ad7 100644
--- a/java/src/jni/h5fImp.c
+++ b/java/src/jni/h5fImp.c
@@ -39,11 +39,10 @@ extern "C" {
* Signature: (Ljava/lang/String;IJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Fopen
- (JNIEnv *env, jclass clss, jstring name, jint flags, jlong access_id)
+Java_hdf_hdf5lib_H5__1H5Fopen(JNIEnv *env, jclass clss, jstring name, jint flags, jlong access_id)
{
const char *fileName = NULL;
- hid_t status = H5I_INVALID_HID;
+ hid_t status = H5I_INVALID_HID;
UNUSED(clss);
@@ -68,11 +67,11 @@ done:
* Signature: (Ljava/lang/String;IJJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Fcreate
- (JNIEnv *env, jclass clss, jstring name, jint flags, jlong create_id, jlong access_id)
+Java_hdf_hdf5lib_H5__1H5Fcreate(JNIEnv *env, jclass clss, jstring name, jint flags, jlong create_id,
+ jlong access_id)
{
const char *fileName = NULL;
- hid_t status = H5I_INVALID_HID;
+ hid_t status = H5I_INVALID_HID;
UNUSED(clss);
@@ -97,8 +96,7 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Fflush
- (JNIEnv *env, jclass clss, jlong object_id, jint scope)
+Java_hdf_hdf5lib_H5_H5Fflush(JNIEnv *env, jclass clss, jlong object_id, jint scope)
{
herr_t retVal = FAIL;
@@ -117,12 +115,11 @@ done:
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1name
- (JNIEnv *env, jclass clss, jlong file_id)
+Java_hdf_hdf5lib_H5_H5Fget_1name(JNIEnv *env, jclass clss, jlong file_id)
{
- jstring str = NULL;
- ssize_t buf_size;
- char *namePtr = NULL;
+ jstring str = NULL;
+ ssize_t buf_size;
+ char * namePtr = NULL;
UNUSED(clss);
@@ -130,7 +127,7 @@ Java_hdf_hdf5lib_H5_H5Fget_1name
if ((buf_size = H5Fget_name((hid_t)file_id, NULL, 0)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ if (NULL == (namePtr = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Fget_name: malloc failed");
if ((H5Fget_name((hid_t)file_id, namePtr, (size_t)buf_size + 1)) < 0)
@@ -153,13 +150,12 @@ done:
* Signature: (Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Fis_1hdf5
- (JNIEnv *env, jclass clss, jstring name)
+Java_hdf_hdf5lib_H5_H5Fis_1hdf5(JNIEnv *env, jclass clss, jstring name)
{
#ifndef H5_NO_DEPRECATED_SYMBOLS
const char *fileName = NULL;
#endif
- htri_t bval = JNI_FALSE;
+ htri_t bval = JNI_FALSE;
UNUSED(clss);
@@ -193,11 +189,10 @@ done:
* Signature: (Ljava/lang/String;J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Fis_1accessible
- (JNIEnv *env, jclass clss, jstring name, jlong file_id)
+Java_hdf_hdf5lib_H5_H5Fis_1accessible(JNIEnv *env, jclass clss, jstring name, jlong file_id)
{
const char *fileName = NULL;
- htri_t bval = JNI_FALSE;
+ htri_t bval = JNI_FALSE;
UNUSED(clss);
@@ -224,8 +219,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist
- (JNIEnv *env, jclass clss, jlong file_id)
+Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist(JNIEnv *env, jclass clss, jlong file_id)
{
hid_t retVal = H5I_INVALID_HID;
@@ -244,8 +238,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Fget_1access_1plist
- (JNIEnv *env, jclass clss, jlong file_id)
+Java_hdf_hdf5lib_H5__1H5Fget_1access_1plist(JNIEnv *env, jclass clss, jlong file_id)
{
hid_t retVal = H5I_INVALID_HID;
@@ -264,8 +257,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1intent
- (JNIEnv *env, jclass clss, jlong file_id)
+Java_hdf_hdf5lib_H5_H5Fget_1intent(JNIEnv *env, jclass clss, jlong file_id)
{
unsigned intent = 0;
@@ -284,8 +276,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1fileno
- (JNIEnv *env, jclass clss, jlong file_id)
+Java_hdf_hdf5lib_H5_H5Fget_1fileno(JNIEnv *env, jclass clss, jlong file_id)
{
unsigned long fileno = 0;
@@ -304,8 +295,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Fclose
- (JNIEnv *env, jclass clss, jlong file_id)
+Java_hdf_hdf5lib_H5__1H5Fclose(JNIEnv *env, jclass clss, jlong file_id)
{
herr_t status = FAIL;
@@ -324,11 +314,11 @@ done:
* Signature: (JLjava/lang/String;JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Fmount
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong child_id, jlong plist_id)
+Java_hdf_hdf5lib_H5_H5Fmount(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong child_id,
+ jlong plist_id)
{
const char *fileName = NULL;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -353,11 +343,10 @@ done:
* Signature: (JLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Funmount
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name)
+Java_hdf_hdf5lib_H5_H5Funmount(JNIEnv *env, jclass clss, jlong loc_id, jstring name)
{
const char *fileName = NULL;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -382,8 +371,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1freespace
- (JNIEnv *env, jclass clss, jlong file_id)
+Java_hdf_hdf5lib_H5_H5Fget_1freespace(JNIEnv *env, jclass clss, jlong file_id)
{
hssize_t ret_val = -1;
@@ -402,8 +390,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Freopen
- (JNIEnv *env, jclass clss, jlong file_id)
+Java_hdf_hdf5lib_H5__1H5Freopen(JNIEnv *env, jclass clss, jlong file_id)
{
hid_t retVal = H5I_INVALID_HID;
@@ -422,16 +409,15 @@ done:
* Signature: (JIJ[J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids
- (JNIEnv *env, jclass clss, jlong file_id, jint types, jlong maxObjs,
- jlongArray obj_id_list)
+Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids(JNIEnv *env, jclass clss, jlong file_id, jint types, jlong maxObjs,
+ jlongArray obj_id_list)
{
- jboolean isCopy;
- ssize_t ret_val = -1;
- size_t i;
- jsize rank;
- jlong *obj_id_listP = NULL;
- hid_t *id_list = NULL;
+ jboolean isCopy;
+ ssize_t ret_val = -1;
+ size_t i;
+ jsize rank;
+ jlong * obj_id_listP = NULL;
+ hid_t * id_list = NULL;
UNUSED(clss);
@@ -445,7 +431,7 @@ Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Fget_obj_ids: obj_id_list length < 0");
}
- if (NULL == (id_list = (hid_t *) HDmalloc((size_t)rank * sizeof(hid_t))))
+ if (NULL == (id_list = (hid_t *)HDmalloc((size_t)rank * sizeof(hid_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Fget_obj_ids: malloc failed");
if ((ret_val = H5Fget_obj_ids((hid_t)file_id, (unsigned int)types, (size_t)maxObjs, id_list)) < 0)
@@ -470,8 +456,7 @@ done:
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1obj_1count
- (JNIEnv *env, jclass clss, jlong file_id, jint types)
+Java_hdf_hdf5lib_H5_H5Fget_1obj_1count(JNIEnv *env, jclass clss, jlong file_id, jint types)
{
ssize_t ret_val = -1;
@@ -490,8 +475,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1filesize
- (JNIEnv *env, jclass clss, jlong file_id)
+Java_hdf_hdf5lib_H5_H5Fget_1filesize(JNIEnv *env, jclass clss, jlong file_id)
{
hsize_t size = 0;
@@ -501,7 +485,7 @@ Java_hdf_hdf5lib_H5_H5Fget_1filesize
H5_LIBRARY_ERROR(ENVONLY);
done:
- return (jlong) size;
+ return (jlong)size;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1filesize */
/*
@@ -510,8 +494,7 @@ done:
* Signature: (J)D
*/
JNIEXPORT jdouble JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate
- (JNIEnv *env, jclass clss, jlong file_id)
+Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate(JNIEnv *env, jclass clss, jlong file_id)
{
double rate = 0.0;
@@ -530,14 +513,13 @@ done:
* Signature: (J[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size
- (JNIEnv *env, jclass clss, jlong file_id, jlongArray metadata_cache)
+Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size(JNIEnv *env, jclass clss, jlong file_id, jlongArray metadata_cache)
{
- jboolean isCopy;
- size_t max_size = 0, min_clean_size = 0, cur_size = 0;
- jlong *metadata_cache_ptr = NULL;
- jsize size = 0;
- int cur_num_entries = -1;
+ jboolean isCopy;
+ size_t max_size = 0, min_clean_size = 0, cur_size = 0;
+ jlong * metadata_cache_ptr = NULL;
+ jsize size = 0;
+ int cur_num_entries = -1;
UNUSED(clss);
@@ -555,7 +537,8 @@ Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size
if (H5Fget_mdc_size((hid_t)file_id, &max_size, &min_clean_size, &cur_size, &cur_num_entries) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- PIN_LONG_ARRAY(ENVONLY, metadata_cache, metadata_cache_ptr, &isCopy, "H5Fget_mdc_size: metadata_cache array not pinned");
+ PIN_LONG_ARRAY(ENVONLY, metadata_cache, metadata_cache_ptr, &isCopy,
+ "H5Fget_mdc_size: metadata_cache array not pinned");
metadata_cache_ptr[0] = (jlong)max_size;
metadata_cache_ptr[1] = (jlong)min_clean_size;
@@ -574,8 +557,7 @@ done:
* Signature: (J)Lhdf/hdf5lib/structs/H5F_info2_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1info
- (JNIEnv *env, jclass clss, jlong obj_id)
+Java_hdf_hdf5lib_H5_H5Fget_1info(JNIEnv *env, jclass clss, jlong obj_id)
{
H5F_info2_t finfo;
jobject ihinfobuf;
@@ -604,7 +586,8 @@ Java_hdf_hdf5lib_H5_H5Fget_1info
args[7].j = (jlong)finfo.sohm.hdr_size;
args[8].l = ihinfobuf;
- CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5F_info2_t", "(IJJIJJIJLhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj);
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5F_info2_t",
+ "(IJJIJJIJLhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj);
done:
return ret_obj;
@@ -616,8 +599,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats
- (JNIEnv *env, jclass clss, jlong file_id)
+Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats(JNIEnv *env, jclass clss, jlong file_id)
{
UNUSED(clss);
@@ -634,8 +616,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache
- (JNIEnv *env, jclass clss, jlong file_id)
+Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache(JNIEnv *env, jclass clss, jlong file_id)
{
UNUSED(clss);
@@ -652,8 +633,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write
- (JNIEnv *env, jclass clss, jlong file_id)
+Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write(JNIEnv *env, jclass clss, jlong file_id)
{
UNUSED(clss);
@@ -670,8 +650,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging
- (JNIEnv *env, jclass clss, jlong file_id)
+Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging(JNIEnv *env, jclass clss, jlong file_id)
{
UNUSED(clss);
@@ -688,8 +667,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging
- (JNIEnv *env, jclass clss, jlong file_id)
+Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging(JNIEnv *env, jclass clss, jlong file_id)
{
UNUSED(clss);
@@ -706,14 +684,14 @@ done:
* Signature: (J[Z)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status
- (JNIEnv *env, jclass clss, jlong file_id, jbooleanArray mdc_logging_status)
+Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status(JNIEnv *env, jclass clss, jlong file_id,
+ jbooleanArray mdc_logging_status)
{
- jboolean *mdc_logging_status_ptr = NULL;
- jboolean isCopy;
- hbool_t is_enabled;
- hbool_t is_currently_logging;
- jsize size;
+ jboolean *mdc_logging_status_ptr = NULL;
+ jboolean isCopy;
+ hbool_t is_enabled;
+ hbool_t is_currently_logging;
+ jsize size;
UNUSED(clss);
@@ -731,7 +709,8 @@ Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status
if (H5Fget_mdc_logging_status((hid_t)file_id, &is_enabled, &is_currently_logging) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- PIN_BOOL_ARRAY(ENVONLY, mdc_logging_status, mdc_logging_status_ptr, &isCopy, "H5Fget_mdc_logging_status: mdc_logging_status array not pinned");
+ PIN_BOOL_ARRAY(ENVONLY, mdc_logging_status, mdc_logging_status_ptr, &isCopy,
+ "H5Fget_mdc_logging_status: mdc_logging_status array not pinned");
mdc_logging_status_ptr[0] = (jboolean)is_enabled;
mdc_logging_status_ptr[1] = (jboolean)is_currently_logging;
@@ -749,8 +728,7 @@ done:
* Signature: (JZ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Fset_1dset_1no_1attrs_1hint
-(JNIEnv *env, jclass clss, jlong file_id, jboolean minimize)
+Java_hdf_hdf5lib_H5_H5Fset_1dset_1no_1attrs_1hint(JNIEnv *env, jclass clss, jlong file_id, jboolean minimize)
{
hbool_t minimize_val;
herr_t retVal = FAIL;
@@ -772,10 +750,9 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint
-(JNIEnv *env, jclass clss, jlong file_id)
+Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint(JNIEnv *env, jclass clss, jlong file_id)
{
- jboolean bval = JNI_FALSE;
+ jboolean bval = JNI_FALSE;
hbool_t minimize = FALSE;
UNUSED(clss);
@@ -784,7 +761,7 @@ Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint
H5_LIBRARY_ERROR(ENVONLY);
if (minimize == TRUE)
- bval = JNI_TRUE;
+ bval = JNI_TRUE;
done:
return bval;
@@ -796,8 +773,7 @@ done:
* Signature: (JII)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds
- (JNIEnv *env, jclass clss, jlong file_id, jint low, jint high)
+Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds(JNIEnv *env, jclass clss, jlong file_id, jint low, jint high)
{
herr_t retVal = FAIL;
@@ -810,7 +786,6 @@ done:
return;
} /* end Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds */
-
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/h5fImp.h b/java/src/jni/h5fImp.h
index fc02c76..6696218 100644
--- a/java/src/jni/h5fImp.h
+++ b/java/src/jni/h5fImp.h
@@ -26,270 +26,212 @@ extern "C" {
* Method: H5Fopen
* Signature: (Ljava/lang/String;IJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Fopen
- (JNIEnv*, jclass, jstring, jint, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Fopen(JNIEnv *, jclass, jstring, jint, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fcreate
* Signature: (Ljava/lang/String;IJJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Fcreate
- (JNIEnv*, jclass, jstring, jint, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Fcreate(JNIEnv *, jclass, jstring, jint, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fflush
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Fflush
- (JNIEnv*, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Fflush(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fget_name
* Signature: (J)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1name
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Fget_1name(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fis_hdf5
* Signature: (Ljava/lang/String;)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Fis_1hdf5
- (JNIEnv*, jclass, jstring);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Fis_1hdf5(JNIEnv *, jclass, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fis_accessible
* Signature: (Ljava/lang/String;J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Fis_1accessible
- (JNIEnv*, jclass, jstring, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Fis_1accessible(JNIEnv *, jclass, jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fget_create_plist
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fget_access_plist
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Fget_1access_1plist
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Fget_1access_1plist(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fget_intent
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1intent
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Fget_1intent(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fget_fileno
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1fileno
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1fileno(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fclose
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Fclose
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Fclose(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fmount
* Signature: (JLjava/lang/String;JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Fmount
- (JNIEnv*, jclass, jlong, jstring, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Fmount(JNIEnv *, jclass, jlong, jstring, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Funmount
* Signature: (JLjava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Funmount
- (JNIEnv*, jclass, jlong, jstring);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Funmount(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fget_freespace
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1freespace
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1freespace(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Freopen
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Freopen
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Freopen(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fget_obj_ids
* Signature: (JIJ[J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids
- (JNIEnv*, jclass, jlong, jint, jlong, jlongArray);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids(JNIEnv *, jclass, jlong, jint, jlong,
+ jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fget_obj_count
* Signature: (JI)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1obj_1count
- (JNIEnv*, jclass, jlong, jint);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1obj_1count(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fget_filesize
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1filesize
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1filesize(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fget_mdc_hit_rate
* Signature: (J)D
*/
-JNIEXPORT jdouble JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jdouble JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fget_mdc_size
* Signature: (J[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size
- (JNIEnv*, jclass, jlong, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size(JNIEnv *, jclass, jlong, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Freset_mdc_hit_rate_stats
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats
- (JNIEnv*, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fget_info
* Signature: (J)Lhdf/hdf5lib/structs/H5F_info2_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1info
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Fget_1info(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fclear_elink_file_cache
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache
- (JNIEnv *, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fstart_swmr_write
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write
- (JNIEnv *, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fstart_mdc_logging
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging
- (JNIEnv *, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fstop_mdc_logging
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging
- (JNIEnv *, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fget_mdc_logging_status
* Signature: (J[Z)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status
- (JNIEnv *, jclass, jlong, jbooleanArray);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status(JNIEnv *, jclass, jlong,
+ jbooleanArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fset_dset_no_attrs_hint
* Signature: (JZ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Fset_1dset_1no_1attrs_1hint
- (JNIEnv *, jclass, jlong, jboolean);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fset_1dset_1no_1attrs_1hint(JNIEnv *, jclass, jlong, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fget_dset_no_attrs_hint
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fset_libver_bounds
* Signature: (JII)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds
-(JNIEnv *, jclass, jlong, jint, jint);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds(JNIEnv *, jclass, jlong, jint, jint);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5gImp.c b/java/src/jni/h5gImp.c
index 79b1b65..43a6122 100644
--- a/java/src/jni/h5gImp.c
+++ b/java/src/jni/h5gImp.c
@@ -40,8 +40,7 @@ extern "C" {
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Gclose
- (JNIEnv *env, jclass clss, jlong group_id)
+Java_hdf_hdf5lib_H5__1H5Gclose(JNIEnv *env, jclass clss, jlong group_id)
{
herr_t retVal = FAIL;
@@ -65,8 +64,7 @@ done:
*
*/
jobject
-create_H5G_info_t
- (JNIEnv *env, H5G_info_t group_info)
+create_H5G_info_t(JNIEnv *env, H5G_info_t group_info)
{
jfieldID fid_storage_type, fid_nlinks, fid_max_corder, fid_mounted;
jboolean jmounted;
@@ -92,7 +90,7 @@ create_H5G_info_t
if (NULL == (fid_mounted = ENVPTR->GetFieldID(ENVONLY, cls, "mounted", "Z")))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- jmounted = (group_info.mounted == 0) ? JNI_FALSE : JNI_TRUE;
+ jmounted = (group_info.mounted == 0) ? JNI_FALSE : JNI_TRUE;
storage_type = (jint)group_info.storage_type;
ENVPTR->SetIntField(ENVONLY, obj, fid_storage_type, (jint)storage_type);
@@ -117,11 +115,10 @@ done:
* Signature: (JLjava/lang/String;JJJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Gcreate2
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name,
- jlong link_plist_id, jlong create_plist_id, jlong access_plist_id)
+Java_hdf_hdf5lib_H5__1H5Gcreate2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong link_plist_id,
+ jlong create_plist_id, jlong access_plist_id)
{
- const char *grpName = NULL;
+ const char *grpName = NULL;
hid_t group_id = H5I_INVALID_HID;
UNUSED(clss);
@@ -131,7 +128,8 @@ Java_hdf_hdf5lib_H5__1H5Gcreate2
PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gcreate2: group name not pinned");
- if ((group_id = H5Gcreate2((hid_t)loc_id, grpName, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id)) < 0)
+ if ((group_id = H5Gcreate2((hid_t)loc_id, grpName, (hid_t)link_plist_id, (hid_t)create_plist_id,
+ (hid_t)access_plist_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -147,8 +145,7 @@ done:
* Signature: (JJJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Gcreate_1anon
- (JNIEnv *env, jclass clss, jlong loc_id, jlong gcpl_id, jlong gapl_id)
+Java_hdf_hdf5lib_H5__1H5Gcreate_1anon(JNIEnv *env, jclass clss, jlong loc_id, jlong gcpl_id, jlong gapl_id)
{
hid_t group_id = H5I_INVALID_HID;
@@ -167,10 +164,9 @@ done:
* Signature: (JLjava/lang/String;J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Gopen2
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist_id)
+Java_hdf_hdf5lib_H5__1H5Gopen2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist_id)
{
- const char *grpName = NULL;
+ const char *grpName = NULL;
hid_t group_id = H5I_INVALID_HID;
UNUSED(clss);
@@ -190,15 +186,13 @@ done:
return (jlong)group_id;
} /* end Java_hdf_hdf5lib_H5__1H5Gopen2 */
-
/*
* Class: hdf_hdf5lib_H5
* Method: H5Gget_create_plist
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Gget_1create_1plist
- (JNIEnv *env, jclass clss, jlong loc_id)
+Java_hdf_hdf5lib_H5_H5Gget_1create_1plist(JNIEnv *env, jclass clss, jlong loc_id)
{
hid_t plist_id = H5I_INVALID_HID;
@@ -217,8 +211,7 @@ done:
* Signature: (J)Lhdf/hdf5lib/structs/H5G_info_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Gget_1info
- (JNIEnv *env, jclass clss, jlong loc_id)
+Java_hdf_hdf5lib_H5_H5Gget_1info(JNIEnv *env, jclass clss, jlong loc_id)
{
H5G_info_t group_info;
jobject obj = NULL;
@@ -241,12 +234,12 @@ done:
* Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5G_info_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong lapl_id)
+Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
+ jlong lapl_id)
{
H5G_info_t group_info;
const char *grpName = NULL;
- jobject obj = NULL;
+ jobject obj = NULL;
herr_t ret_val = FAIL;
UNUSED(clss);
@@ -277,16 +270,15 @@ done:
* Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5G_info_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint index_type,
- jint order, jlong n, jlong lapl_id)
+Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
+ jint index_type, jint order, jlong n, jlong lapl_id)
{
- H5_iter_order_t corder = (H5_iter_order_t)order;
- H5_index_t cindex_type = (H5_index_t)index_type;
- H5G_info_t group_info;
- const char *grpName = NULL;
- jobject obj = NULL;
- herr_t ret_val = FAIL;
+ H5_iter_order_t corder = (H5_iter_order_t)order;
+ H5_index_t cindex_type = (H5_index_t)index_type;
+ H5G_info_t group_info;
+ const char * grpName = NULL;
+ jobject obj = NULL;
+ herr_t ret_val = FAIL;
UNUSED(clss);
@@ -295,8 +287,8 @@ Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx
PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gget_info_by_idx: group name not pinned");
- if ((ret_val = H5Gget_info_by_idx((hid_t)loc_id, grpName, cindex_type,
- corder, (hsize_t)n, &group_info, (hid_t)lapl_id)) < 0)
+ if ((ret_val = H5Gget_info_by_idx((hid_t)loc_id, grpName, cindex_type, corder, (hsize_t)n, &group_info,
+ (hid_t)lapl_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if (NULL == (obj = create_H5G_info_t(env, group_info))) {
@@ -317,8 +309,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Gflush
- (JNIEnv *env, jclass clss, jlong loc_id)
+Java_hdf_hdf5lib_H5_H5Gflush(JNIEnv *env, jclass clss, jlong loc_id)
{
UNUSED(clss);
@@ -335,8 +326,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Grefresh
- (JNIEnv *env, jclass clss, jlong loc_id)
+Java_hdf_hdf5lib_H5_H5Grefresh(JNIEnv *env, jclass clss, jlong loc_id)
{
UNUSED(clss);
@@ -347,8 +337,6 @@ done:
return;
} /* end Java_hdf_hdf5lib_H5_H5Grefresh */
-
-
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/h5gImp.h b/java/src/jni/h5gImp.h
index a411658..3de21b7 100644
--- a/java/src/jni/h5gImp.h
+++ b/java/src/jni/h5gImp.h
@@ -21,97 +21,77 @@
extern "C" {
#endif /* __cplusplus */
-
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Gclose
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Gclose
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Gclose(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Gcreate2
* Signature: (JLjava/lang/String;JJJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Gcreate2
- (JNIEnv*, jclass, jlong, jstring, jlong, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Gcreate2(JNIEnv *, jclass, jlong, jstring, jlong, jlong,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Gcreate_anon
* Signature: (JJJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Gcreate_1anon
- (JNIEnv*, jclass, jlong, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Gcreate_1anon(JNIEnv *, jclass, jlong, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Gopen2
* Signature: (JLjava/lang/String;J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Gopen2
- (JNIEnv*, jclass, jlong, jstring, jlong);
-
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Gopen2(JNIEnv *, jclass, jlong, jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Gget_create_plist
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Gget_1create_1plist
-(JNIEnv*, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Gget_1create_1plist(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Gget_info
* Signature: (J)Lhdf/hdf5lib/structs/H5G_info_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Gget_1info
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Gget_1info(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Gget_info_by_name
* Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5G_info_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name
- (JNIEnv*, jclass, jlong, jstring, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name(JNIEnv *, jclass, jlong, jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Gget_info_by_idx
* Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5G_info_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx
- (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx(JNIEnv *, jclass, jlong, jstring, jint,
+ jint, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Gflush
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Gflush
- (JNIEnv*, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Gflush(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Grefresh
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Grefresh
- (JNIEnv*, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Grefresh(JNIEnv *, jclass, jlong);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5iImp.c b/java/src/jni/h5iImp.c
index e8030aee..78cc138 100644
--- a/java/src/jni/h5iImp.c
+++ b/java/src/jni/h5iImp.c
@@ -38,8 +38,7 @@ extern "C" {
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Iget_1type
- (JNIEnv *env, jclass clss, jlong obj_id)
+Java_hdf_hdf5lib_H5_H5Iget_1type(JNIEnv *env, jclass clss, jlong obj_id)
{
H5I_type_t retVal = H5I_BADID;
@@ -58,19 +57,19 @@ done:
* Signature: (JLjava/lang/String;J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Iget_1name_1long
- (JNIEnv *env, jclass clss, jlong obj_id, jobjectArray name, jlong buf_size)
+Java_hdf_hdf5lib_H5_H5Iget_1name_1long(JNIEnv *env, jclass clss, jlong obj_id, jobjectArray name,
+ jlong buf_size)
{
- ssize_t size = -1;
- jstring str;
- char *aName = NULL;
+ ssize_t size = -1;
+ jstring str;
+ char * aName = NULL;
UNUSED(clss);
if (buf_size < 0)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Iget_name_long: buf_size < 0");
- if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ if (NULL == (aName = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Iget_name_long: malloc failed");
if ((size = H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size + 1)) < 0)
@@ -90,19 +89,17 @@ done:
return (jlong)size;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1name */
-
/*
* Class: hdf_hdf5lib_H5
* Method: H5Iget_name
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Iget_1name
- (JNIEnv *env, jclass clss, jlong obj_id)
+Java_hdf_hdf5lib_H5_H5Iget_1name(JNIEnv *env, jclass clss, jlong obj_id)
{
- jstring str = NULL;
- ssize_t buf_size = -1;
- char *aName = NULL;
+ jstring str = NULL;
+ ssize_t buf_size = -1;
+ char * aName = NULL;
UNUSED(clss);
@@ -110,7 +107,7 @@ Java_hdf_hdf5lib_H5_H5Iget_1name
if ((buf_size = H5Iget_name((hid_t)obj_id, NULL, 0)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ if (NULL == (aName = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Iget_name: malloc failed");
if (H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size + 1) < 0)
@@ -133,8 +130,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Iget_1ref
- (JNIEnv *env, jclass clss, jlong obj_id)
+Java_hdf_hdf5lib_H5_H5Iget_1ref(JNIEnv *env, jclass clss, jlong obj_id)
{
int retVal = FAIL;
@@ -153,8 +149,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Iinc_1ref
- (JNIEnv *env, jclass clss, jlong obj_id)
+Java_hdf_hdf5lib_H5_H5Iinc_1ref(JNIEnv *env, jclass clss, jlong obj_id)
{
int retVal = FAIL;
@@ -173,8 +168,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Idec_1ref
- (JNIEnv *env, jclass clss, jlong obj_id)
+Java_hdf_hdf5lib_H5_H5Idec_1ref(JNIEnv *env, jclass clss, jlong obj_id)
{
int retVal = FAIL;
@@ -194,8 +188,7 @@ done:
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Iget_1file_1id
- (JNIEnv *env, jclass clss, jlong obj_id)
+Java_hdf_hdf5lib_H5_H5Iget_1file_1id(JNIEnv *env, jclass clss, jlong obj_id)
{
hid_t file_id = H5I_INVALID_HID;
@@ -205,7 +198,7 @@ Java_hdf_hdf5lib_H5_H5Iget_1file_1id
H5_LIBRARY_ERROR(ENVONLY);
done:
- return (jlong) file_id;
+ return (jlong)file_id;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1file_1id */
/*
@@ -214,8 +207,7 @@ done:
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Iget_1type_1ref
- (JNIEnv *env, jclass clss, jint type)
+Java_hdf_hdf5lib_H5_H5Iget_1type_1ref(JNIEnv *env, jclass clss, jint type)
{
int retVal = FAIL;
@@ -234,8 +226,7 @@ done:
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Idec_1type_1ref
- (JNIEnv *env, jclass clss, jint type)
+Java_hdf_hdf5lib_H5_H5Idec_1type_1ref(JNIEnv *env, jclass clss, jint type)
{
int retVal = FAIL;
@@ -254,8 +245,7 @@ done:
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Iinc_1type_1ref
- (JNIEnv *env, jclass clss, jint type)
+Java_hdf_hdf5lib_H5_H5Iinc_1type_1ref(JNIEnv *env, jclass clss, jint type)
{
int retVal = FAIL;
@@ -274,8 +264,7 @@ done:
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Inmembers
- (JNIEnv *env, jclass clss, jint type)
+Java_hdf_hdf5lib_H5_H5Inmembers(JNIEnv *env, jclass clss, jint type)
{
hsize_t num_members = 0;
@@ -294,8 +283,7 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Iis_1valid
- (JNIEnv *env, jclass clss, jlong obj_id)
+Java_hdf_hdf5lib_H5_H5Iis_1valid(JNIEnv *env, jclass clss, jlong obj_id)
{
htri_t bval = JNI_FALSE;
@@ -315,8 +303,7 @@ done:
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Itype_1exists
- (JNIEnv *env, jclass clss, jint type)
+Java_hdf_hdf5lib_H5_H5Itype_1exists(JNIEnv *env, jclass clss, jint type)
{
htri_t bval = JNI_FALSE;
@@ -337,8 +324,7 @@ done:
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Iclear_1type
- (JNIEnv *env, jclass clss, jint type, jboolean force)
+Java_hdf_hdf5lib_H5_H5Iclear_1type(JNIEnv *env, jclass clss, jint type, jboolean force)
{
UNUSED(clss);
@@ -355,8 +341,7 @@ done:
* Signature: (I)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Idestroy_1type
- (JNIEnv *env, jclass clss, jint type)
+Java_hdf_hdf5lib_H5_H5Idestroy_1type(JNIEnv *env, jclass clss, jint type)
{
UNUSED(clss);
diff --git a/java/src/jni/h5iImp.h b/java/src/jni/h5iImp.h
index 2c854e6..ff407d9 100644
--- a/java/src/jni/h5iImp.h
+++ b/java/src/jni/h5iImp.h
@@ -26,54 +26,42 @@ extern "C" {
* Method: H5Iget_type
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Iget_1type
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Iget_1type(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Iget_name_long
* Signature: (JLjava/lang/String;J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Iget_1name_1long
- (JNIEnv*, jclass, jlong, jobjectArray, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Iget_1name_1long(JNIEnv *, jclass, jlong, jobjectArray, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Iget_name
* Signature: (J)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Iget_1name
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Iget_1name(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Iget_ref
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Iget_1ref
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Iget_1ref(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Iinc_ref
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Iinc_1ref
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Iinc_1ref(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Idec_1ref
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Idec_1ref
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Idec_1ref(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
@@ -81,81 +69,63 @@ Java_hdf_hdf5lib_H5_H5Idec_1ref
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Iget_1file_1id
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Iget_1file_1id(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Iget_type_ref
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Iget_1type_1ref
- (JNIEnv*, jclass, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Iget_1type_1ref(JNIEnv *, jclass, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Idec_type_ref
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Idec_1type_1ref
- (JNIEnv*, jclass, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Idec_1type_1ref(JNIEnv *, jclass, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Iinc_type_ref
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Iinc_1type_1ref
- (JNIEnv*, jclass, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Iinc_1type_1ref(JNIEnv *, jclass, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Inmembers
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Inmembers
- (JNIEnv*, jclass, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Inmembers(JNIEnv *, jclass, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Iis_valid
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Iis_1valid
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Iis_1valid(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Itype_exists
* Signature: (I)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Itype_1exists
- (JNIEnv*, jclass, jint);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Itype_1exists(JNIEnv *, jclass, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Iclear_type
* Signature: (IZ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Iclear_1type
- (JNIEnv*, jclass, jint, jboolean);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Iclear_1type(JNIEnv *, jclass, jint, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Idestroy_type
* Signature: (I)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Idestroy_1type
- (JNIEnv*, jclass, jint);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Idestroy_1type(JNIEnv *, jclass, jint);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5jni.h b/java/src/jni/h5jni.h
index f583630..346b605 100644
--- a/java/src/jni/h5jni.h
+++ b/java/src/jni/h5jni.h
@@ -26,26 +26,26 @@
#define _Included_h5jni
#ifdef __cplusplus
- #define ENVPTR (env)
- #define ENVONLY
- #define CBENVPTR (cbenv)
- #define CBENVONLY
- #define JVMPTR (jvm)
- #define JVMPAR
+#define ENVPTR (env)
+#define ENVONLY
+#define CBENVPTR (cbenv)
+#define CBENVONLY
+#define JVMPTR (jvm)
+#define JVMPAR
#else /* __cplusplus */
- #define ENVPTR (*env)
- #define ENVONLY env
- #define CBENVPTR (*cbenv)
- #define CBENVONLY cbenv
- #define JVMPTR (*jvm)
- #define JVMPAR jvm
+#define ENVPTR (*env)
+#define ENVONLY env
+#define CBENVPTR (*cbenv)
+#define CBENVONLY cbenv
+#define JVMPTR (*jvm)
+#define JVMPAR jvm
#endif /* __cplusplus */
/*
* Used to silence compiler when a particular
* function parameter is not used.
*/
-#define UNUSED(o) (void) o
+#define UNUSED(o) (void)o
/*
* Macro to check for a JNI exception after a JNI method is called.
@@ -57,205 +57,207 @@
* cleanup+return section of the native method, since at that point
* cleaning up and returning is the only safe thing that can be done.
*/
-#define CHECK_JNI_EXCEPTION(envptr, clearException) \
-do { \
- if (JNI_TRUE == (*envptr)->ExceptionCheck(envptr)) { \
- if (JNI_TRUE == clearException) \
- (*envptr)->ExceptionClear(envptr); \
- else \
- goto done; \
- } \
-} while(0)
+#define CHECK_JNI_EXCEPTION(envptr, clearException) \
+ do { \
+ if (JNI_TRUE == (*envptr)->ExceptionCheck(envptr)) { \
+ if (JNI_TRUE == clearException) \
+ (*envptr)->ExceptionClear(envptr); \
+ else \
+ goto done; \
+ } \
+ } while (0)
/* Macros for class access */
/* Calling code must define ret_obj as jobject */
-#define CALL_CONSTRUCTOR(envptr, classname, classsig, args, ret_obj) \
-do { \
- jmethodID constructor; \
- jclass cls; \
- \
- if (NULL == (cls = (*envptr)->FindClass(envptr, (classname)))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, "JNI error: GetObjectClass"); \
- } \
- if (NULL == (constructor = (*envptr)->GetMethodID(envptr, cls, "<init>", (classsig)))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, "JNI error: GetMethodID failed"); \
- } \
- if (NULL == (ret_obj = (*envptr)->NewObjectA(envptr, cls, constructor, (args)))) { \
- HDprintf("FATAL ERROR: %s: Creation failed\n", classname); \
- CHECK_JNI_EXCEPTION(envptr, JNI_FALSE); \
- } \
-} while(0)
+#define CALL_CONSTRUCTOR(envptr, classname, classsig, args, ret_obj) \
+ do { \
+ jmethodID constructor; \
+ jclass cls; \
+ \
+ if (NULL == (cls = (*envptr)->FindClass(envptr, (classname)))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, "JNI error: GetObjectClass"); \
+ } \
+ if (NULL == (constructor = (*envptr)->GetMethodID(envptr, cls, "<init>", (classsig)))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, "JNI error: GetMethodID failed"); \
+ } \
+ if (NULL == (ret_obj = (*envptr)->NewObjectA(envptr, cls, constructor, (args)))) { \
+ HDprintf("FATAL ERROR: %s: Creation failed\n", classname); \
+ CHECK_JNI_EXCEPTION(envptr, JNI_FALSE); \
+ } \
+ } while (0)
/*
* Macros for pinning/unpinning objects.
*/
-#define PIN_BYTE_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
-do { \
- if (NULL == (outBuf = (*envptr)->GetByteArrayElements(envptr, arrayToPin, isCopy))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
- } \
-} while(0)
-
-#define PIN_BYTE_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
-do { \
- if (NULL == (outBuf = (jbyte *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
- } \
-} while(0)
-
-#define UNPIN_BYTE_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
-do { \
- (*envptr)->ReleaseByteArrayElements(envptr, pinnedArray, (jbyte *) bufToRelease, freeMode); \
-} while(0)
-
-#define PIN_SHORT_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
-do { \
- if (NULL == (outBuf = (*envptr)->GetShortArrayElements(envptr, arrayToPin, isCopy))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
- } \
-} while(0)
-
-#define PIN_SHORT_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
-do { \
- if (NULL == (outBuf = (jshort *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
- } \
-} while(0)
-
-#define UNPIN_SHORT_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
-do { \
- (*envptr)->ReleaseShortArrayElements(envptr, pinnedArray, (jshort *) bufToRelease, freeMode); \
-} while(0)
-
-#define PIN_INT_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
-do { \
- if (NULL == (outBuf = (*envptr)->GetIntArrayElements(envptr, arrayToPin, isCopy))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
- } \
-} while(0)
-
-#define PIN_INT_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
-do { \
- if (NULL == (outBuf = (jint *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
- } \
-} while(0)
-
-#define UNPIN_INT_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
-do { \
- (*envptr)->ReleaseIntArrayElements(envptr, pinnedArray, (jint *) bufToRelease, freeMode); \
-} while(0)
-
-#define PIN_LONG_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
-do { \
- if (NULL == (outBuf = (*envptr)->GetLongArrayElements(envptr, arrayToPin, isCopy))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
- } \
-} while(0)
-
-#define PIN_LONG_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
-do { \
- if (NULL == (outBuf = (jlong *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
- } \
-} while(0)
-
-#define UNPIN_LONG_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
-do { \
- (*envptr)->ReleaseLongArrayElements(envptr, pinnedArray, (jlong *) bufToRelease, freeMode); \
-} while(0)
-
-#define PIN_FLOAT_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
-do { \
- if (NULL == (outBuf = (*envptr)->GetFloatArrayElements(envptr, arrayToPin, isCopy))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
- } \
-} while(0)
-
-#define PIN_FLOAT_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
-do { \
- if (NULL == (outBuf = (jfloat *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
- } \
-} while(0)
-
-#define UNPIN_FLOAT_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
-do { \
- (*envptr)->ReleaseFloatArrayElements(envptr, pinnedArray, (jfloat *) bufToRelease, freeMode); \
-} while(0)
-
-#define PIN_DOUBLE_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
-do { \
- if (NULL == (outBuf = (*envptr)->GetDoubleArrayElements(envptr, arrayToPin, isCopy))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
- } \
-} while(0)
-
-#define PIN_DOUBLE_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
-do { \
- if (NULL == (outBuf = (jdouble *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
- } \
-} while(0)
-
-#define UNPIN_DOUBLE_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
-do { \
- (*envptr)->ReleaseDoubleArrayElements(envptr, pinnedArray, (jdouble *) bufToRelease, freeMode); \
-} while(0)
-
-#define PIN_BOOL_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
-do { \
- if (NULL == (outBuf = (*envptr)->GetBooleanArrayElements(envptr, arrayToPin, isCopy))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
- } \
-} while(0)
-
-#define PIN_BOOL_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
-do { \
- if (NULL == (outBuf = (jboolean *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
- } \
-} while(0)
-
-#define UNPIN_BOOL_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
-do { \
- (*envptr)->ReleaseBooleanArrayElements(envptr, pinnedArray, (jboolean *) bufToRelease, freeMode); \
-} while(0)
-
-#define UNPIN_ARRAY_CRITICAL(envptr, pinnedArray, bufToRelease, freeMode) \
-do { \
- (*envptr)->ReleasePrimitiveArrayCritical(envptr, pinnedArray, bufToRelease, freeMode); \
-} while(0)
+#define PIN_BYTE_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+ do { \
+ if (NULL == (outBuf = (*envptr)->GetByteArrayElements(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+ } while (0)
+
+#define PIN_BYTE_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+ do { \
+ if (NULL == (outBuf = (jbyte *)(*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+ } while (0)
+
+#define UNPIN_BYTE_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
+ do { \
+ (*envptr)->ReleaseByteArrayElements(envptr, pinnedArray, (jbyte *)bufToRelease, freeMode); \
+ } while (0)
+
+#define PIN_SHORT_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+ do { \
+ if (NULL == (outBuf = (*envptr)->GetShortArrayElements(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+ } while (0)
+
+#define PIN_SHORT_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+ do { \
+ if (NULL == (outBuf = (jshort *)(*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+ } while (0)
+
+#define UNPIN_SHORT_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
+ do { \
+ (*envptr)->ReleaseShortArrayElements(envptr, pinnedArray, (jshort *)bufToRelease, freeMode); \
+ } while (0)
+
+#define PIN_INT_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+ do { \
+ if (NULL == (outBuf = (*envptr)->GetIntArrayElements(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+ } while (0)
+
+#define PIN_INT_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+ do { \
+ if (NULL == (outBuf = (jint *)(*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+ } while (0)
+
+#define UNPIN_INT_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
+ do { \
+ (*envptr)->ReleaseIntArrayElements(envptr, pinnedArray, (jint *)bufToRelease, freeMode); \
+ } while (0)
+
+#define PIN_LONG_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+ do { \
+ if (NULL == (outBuf = (*envptr)->GetLongArrayElements(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+ } while (0)
+
+#define PIN_LONG_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+ do { \
+ if (NULL == (outBuf = (jlong *)(*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+ } while (0)
+
+#define UNPIN_LONG_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
+ do { \
+ (*envptr)->ReleaseLongArrayElements(envptr, pinnedArray, (jlong *)bufToRelease, freeMode); \
+ } while (0)
+
+#define PIN_FLOAT_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+ do { \
+ if (NULL == (outBuf = (*envptr)->GetFloatArrayElements(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+ } while (0)
+
+#define PIN_FLOAT_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+ do { \
+ if (NULL == (outBuf = (jfloat *)(*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+ } while (0)
+
+#define UNPIN_FLOAT_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
+ do { \
+ (*envptr)->ReleaseFloatArrayElements(envptr, pinnedArray, (jfloat *)bufToRelease, freeMode); \
+ } while (0)
+
+#define PIN_DOUBLE_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+ do { \
+ if (NULL == (outBuf = (*envptr)->GetDoubleArrayElements(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+ } while (0)
+
+#define PIN_DOUBLE_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+ do { \
+ if (NULL == \
+ (outBuf = (jdouble *)(*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+ } while (0)
+
+#define UNPIN_DOUBLE_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
+ do { \
+ (*envptr)->ReleaseDoubleArrayElements(envptr, pinnedArray, (jdouble *)bufToRelease, freeMode); \
+ } while (0)
+
+#define PIN_BOOL_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+ do { \
+ if (NULL == (outBuf = (*envptr)->GetBooleanArrayElements(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+ } while (0)
+
+#define PIN_BOOL_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+ do { \
+ if (NULL == \
+ (outBuf = (jboolean *)(*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+ } while (0)
+
+#define UNPIN_BOOL_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
+ do { \
+ (*envptr)->ReleaseBooleanArrayElements(envptr, pinnedArray, (jboolean *)bufToRelease, freeMode); \
+ } while (0)
+
+#define UNPIN_ARRAY_CRITICAL(envptr, pinnedArray, bufToRelease, freeMode) \
+ do { \
+ (*envptr)->ReleasePrimitiveArrayCritical(envptr, pinnedArray, bufToRelease, freeMode); \
+ } while (0)
/* Macros for string access */
-#define PIN_JAVA_STRING(envptr, stringToPin, outString, isCopy, failErrMsg) \
-do { \
- if (NULL == (outString = (*envptr)->GetStringUTFChars(envptr, stringToPin, isCopy))) { \
- CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
- H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
- } \
-} while(0)
-
-#define UNPIN_JAVA_STRING(envptr, pinnedString, stringToRelease) \
-do { \
- (*envptr)->ReleaseStringUTFChars(envptr, pinnedString, stringToRelease); \
-} while(0)
+#define PIN_JAVA_STRING(envptr, stringToPin, outString, isCopy, failErrMsg) \
+ do { \
+ if (NULL == (outString = (*envptr)->GetStringUTFChars(envptr, stringToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+ } while (0)
+
+#define UNPIN_JAVA_STRING(envptr, pinnedString, stringToRelease) \
+ do { \
+ (*envptr)->ReleaseStringUTFChars(envptr, pinnedString, stringToRelease); \
+ } while (0)
#ifdef __cplusplus
extern "C" {
@@ -267,7 +269,7 @@ extern jboolean h5badArgument(JNIEnv *env, const char *);
extern jboolean h5outOfMemory(JNIEnv *env, const char *);
extern jboolean h5libraryError(JNIEnv *env);
extern jboolean h5raiseException(JNIEnv *env, const char *, const char *);
-extern jboolean h5unimplemented( JNIEnv *env, const char *functName);
+extern jboolean h5unimplemented(JNIEnv *env, const char *functName);
/*
* The following macros are to facilitate immediate cleanup+return
@@ -279,52 +281,52 @@ extern jboolean h5unimplemented( JNIEnv *env, const char *functName);
* Note that a native method can clear the exception when one occurs and
* then do its own error handling, but we instead opt to immediately return.
*/
-#define H5_JNI_FATAL_ERROR(env, message) \
-do { \
- h5JNIFatalError(env, message); \
- goto done; \
-} while(0)
-
-#define H5_NULL_ARGUMENT_ERROR(env, message) \
-do { \
- h5nullArgument(env, message); \
- goto done; \
-} while(0)
-
-#define H5_BAD_ARGUMENT_ERROR(env, message) \
-do { \
- h5badArgument(env, message); \
- goto done; \
-} while(0)
-
-#define H5_OUT_OF_MEMORY_ERROR(env, message) \
-do { \
- h5outOfMemory(env, message); \
- goto done; \
-} while(0)
-
-#define H5_LIBRARY_ERROR(env) \
-do { \
- h5libraryError(env); \
- goto done; \
-} while(0)
-
-#define H5_RAISE_EXCEPTION(env, message, exception) \
-do { \
- h5raiseException(env, message, exception); \
- goto done; \
-} while(0)
-
-#define H5_UNIMPLEMENTED(env, message) \
-do { \
- h5unimplemented(env, message); \
- goto done; \
-} while(0)
+#define H5_JNI_FATAL_ERROR(env, message) \
+ do { \
+ h5JNIFatalError(env, message); \
+ goto done; \
+ } while (0)
+
+#define H5_NULL_ARGUMENT_ERROR(env, message) \
+ do { \
+ h5nullArgument(env, message); \
+ goto done; \
+ } while (0)
+
+#define H5_BAD_ARGUMENT_ERROR(env, message) \
+ do { \
+ h5badArgument(env, message); \
+ goto done; \
+ } while (0)
+
+#define H5_OUT_OF_MEMORY_ERROR(env, message) \
+ do { \
+ h5outOfMemory(env, message); \
+ goto done; \
+ } while (0)
+
+#define H5_LIBRARY_ERROR(env) \
+ do { \
+ h5libraryError(env); \
+ goto done; \
+ } while (0)
+
+#define H5_RAISE_EXCEPTION(env, message, exception) \
+ do { \
+ h5raiseException(env, message, exception); \
+ goto done; \
+ } while (0)
+
+#define H5_UNIMPLEMENTED(env, message) \
+ do { \
+ h5unimplemented(env, message); \
+ goto done; \
+ } while (0)
/* implemented at H5.c */
-extern jint get_enum_value(JNIEnv *env, jobject enum_obj);
-extern jobject get_enum_object(JNIEnv *env, const char* enum_class_name,
- jint enum_val, const char* enum_field_desc);
+extern jint get_enum_value(JNIEnv *env, jobject enum_obj);
+extern jobject get_enum_object(JNIEnv *env, const char *enum_class_name, jint enum_val,
+ const char *enum_field_desc);
/* implemented at H5G.c */
extern jobject create_H5G_info_t(JNIEnv *env, H5G_info_t group_info);
diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c
index b5312bd..5dd2d0a 100644
--- a/java/src/jni/h5lImp.c
+++ b/java/src/jni/h5lImp.c
@@ -49,13 +49,12 @@ static herr_t H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info2_t *in
* Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Lcopy
- (JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name, jlong dst_loc_id,
- jstring dst_name, jlong create_id, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Lcopy(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name, jlong dst_loc_id,
+ jstring dst_name, jlong create_id, jlong access_id)
{
const char *lCurName = NULL;
const char *lDstName = NULL;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -67,7 +66,8 @@ Java_hdf_hdf5lib_H5_H5Lcopy
PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Lcopy: src name not pinned");
PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Lcopy: dest name not pinned");
- if ((status = H5Lcopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ if ((status = H5Lcopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id,
+ (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -83,14 +83,13 @@ done:
* Signature: (Ljava/lang/String;Ljava/lang/String;JLjava/lang/String;JJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Lcreate_1external
- (JNIEnv *env, jclass clss, jstring file_name, jstring cur_name,
- jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Lcreate_1external(JNIEnv *env, jclass clss, jstring file_name, jstring cur_name,
+ jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id)
{
const char *lFileName = NULL;
- const char *lCurName = NULL;
- const char *lDstName = NULL;
- herr_t status = FAIL;
+ const char *lCurName = NULL;
+ const char *lDstName = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -105,7 +104,8 @@ Java_hdf_hdf5lib_H5_H5Lcreate_1external
PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Lcreate_external: object name not pinned");
PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Lcreate_external: link name not pinned");
- if ((status = H5Lcreate_external(lFileName, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ if ((status = H5Lcreate_external(lFileName, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id,
+ (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -123,13 +123,12 @@ done:
* Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Lcreate_1hard
- (JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name,
- jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Lcreate_1hard(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name,
+ jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id)
{
const char *lCurName = NULL;
const char *lDstName = NULL;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -141,7 +140,8 @@ Java_hdf_hdf5lib_H5_H5Lcreate_1hard
PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Lcreate_hard: object name not pinned");
PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Lcreate_hard: link name not pinned");
- if ((status = H5Lcreate_hard((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ if ((status = H5Lcreate_hard((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id,
+ (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -157,13 +157,12 @@ done:
* Signature: (Ljava/lang/String;JLjava/lang/String;JJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Lcreate_1soft
- (JNIEnv *env, jclass clss, jstring cur_name, jlong dst_loc_id,
- jstring dst_name, jlong create_id, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Lcreate_1soft(JNIEnv *env, jclass clss, jstring cur_name, jlong dst_loc_id,
+ jstring dst_name, jlong create_id, jlong access_id)
{
const char *linkTarget = NULL;
- const char *linkName = NULL;
- herr_t status = FAIL;
+ const char *linkName = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -175,7 +174,8 @@ Java_hdf_hdf5lib_H5_H5Lcreate_1soft
PIN_JAVA_STRING(ENVONLY, cur_name, linkTarget, NULL, "H5Lcreate_soft: link target not pinned");
PIN_JAVA_STRING(ENVONLY, dst_name, linkName, NULL, "H5Lcreate_soft: link name not pinned");
- if ((status = H5Lcreate_soft(linkTarget, (hid_t)dst_loc_id, linkName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ if ((status =
+ H5Lcreate_soft(linkTarget, (hid_t)dst_loc_id, linkName, (hid_t)create_id, (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -191,11 +191,10 @@ done:
* Signature: (JLjava/lang/String;J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Ldelete
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Ldelete(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
const char *linkName = NULL;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -218,13 +217,12 @@ done:
* Signature: (JLjava/lang/String;IIJJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name,
- jint index_field, jint order, jlong link_n, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint index_field,
+ jint order, jlong link_n, jlong access_id)
{
const char *groupName = NULL;
- hsize_t n = (hsize_t)link_n;
- herr_t status = FAIL;
+ hsize_t n = (hsize_t)link_n;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -233,7 +231,8 @@ Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx
PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Ldelete_by_idx: group name not pinned");
- if ((status = H5Ldelete_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, n, (hid_t)access_id)) < 0)
+ if ((status = H5Ldelete_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order,
+ n, (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -247,11 +246,10 @@ done:
* Signature: (JLjava/lang/String;J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Lexists
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Lexists(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
const char *linkName = NULL;
- htri_t bval = JNI_FALSE;
+ htri_t bval = JNI_FALSE;
UNUSED(clss);
@@ -278,14 +276,13 @@ done:
* Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5L_info_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Lget_1info
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Lget_1info(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
- H5L_info2_t infobuf;
- const char *linkName = NULL;
- jvalue args[5];
- herr_t status = FAIL;
- jobject ret_obj = NULL;
+ H5L_info2_t infobuf;
+ const char *linkName = NULL;
+ jvalue args[5];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
UNUSED(clss);
@@ -315,7 +312,8 @@ Java_hdf_hdf5lib_H5_H5Lget_1info
args[3].i = infobuf.cset;
args[4].l = token;
- CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJILhdf/hdf5lib/structs/H5O_token_t;)V", args, ret_obj);
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5L_info_t",
+ "(IZJILhdf/hdf5lib/structs/H5O_token_t;)V", args, ret_obj);
}
else {
args[0].i = infobuf.type;
@@ -340,15 +338,14 @@ done:
* Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5L_info_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name,
- jint index_field, jint order, jlong link_n, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
+ jint index_field, jint order, jlong link_n, jlong access_id)
{
- H5L_info2_t infobuf;
- const char *groupName = NULL;
- jvalue args[5];
- herr_t status = FAIL;
- jobject ret_obj = NULL;
+ H5L_info2_t infobuf;
+ const char *groupName = NULL;
+ jvalue args[5];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
UNUSED(clss);
@@ -357,7 +354,9 @@ Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx
PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Lget_info_by_idx: group name not pinned");
- if ((status = H5Lget_info_by_idx2((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id)) < 0)
+ if ((status = H5Lget_info_by_idx2((hid_t)loc_id, groupName, (H5_index_t)index_field,
+ (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id)) <
+ 0)
H5_LIBRARY_ERROR(ENVONLY);
/*
@@ -378,7 +377,8 @@ Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx
args[3].i = infobuf.cset;
args[4].l = token;
- CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJILhdf/hdf5lib/structs/H5O_token_t;)V", args, ret_obj);
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5L_info_t",
+ "(IZJILhdf/hdf5lib/structs/H5O_token_t;)V", args, ret_obj);
}
else {
args[0].i = infobuf.type;
@@ -403,14 +403,13 @@ done:
* Signature: (JLjava/lang/String;IIJJ)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name,
- jint index_field, jint order, jlong link_n, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
+ jint index_field, jint order, jlong link_n, jlong access_id)
{
- const char *groupName = NULL;
- jstring str = NULL;
+ const char *groupName = NULL;
+ jstring str = NULL;
ssize_t status_size = -1;
- char *linkName = NULL;
+ char * linkName = NULL;
UNUSED(clss);
@@ -420,14 +419,18 @@ Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx
PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Lget_name_by_idx: group name not pinned");
/* Get the length of the link name */
- if ((status_size = H5Lget_name_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (char *)NULL, (size_t)0, H5P_DEFAULT)) < 0)
+ if ((status_size =
+ H5Lget_name_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order,
+ (hsize_t)link_n, (char *)NULL, (size_t)0, H5P_DEFAULT)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
/* add extra space for the null terminator */
- if (NULL == (linkName = (char *) HDmalloc(sizeof(char) * (size_t)status_size + 1)))
+ if (NULL == (linkName = (char *)HDmalloc(sizeof(char) * (size_t)status_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Lget_name_by_idx: failed to allocate buffer for link name");
- if ((H5Lget_name_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (char *)linkName, (size_t)status_size + 1, (hid_t)access_id)) < 0)
+ if ((H5Lget_name_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order,
+ (hsize_t)link_n, (char *)linkName, (size_t)status_size + 1, (hid_t)access_id)) <
+ 0)
H5_LIBRARY_ERROR(ENVONLY);
linkName[status_size] = '\0';
@@ -449,16 +452,16 @@ done:
* Signature: (JLjava/lang/String;[Ljava/lang/String;J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Lget_1value
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jobjectArray link_value, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Lget_1value(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
+ jobjectArray link_value, jlong access_id)
{
- H5L_info2_t infobuf;
- const char *file_name = NULL;
- const char *obj_name = NULL;
- const char *linkName = NULL;
- jstring str;
- herr_t status;
- char *linkValue = NULL;
+ H5L_info2_t infobuf;
+ const char *file_name = NULL;
+ const char *obj_name = NULL;
+ const char *linkName = NULL;
+ jstring str;
+ herr_t status;
+ char * linkValue = NULL;
UNUSED(clss);
@@ -476,16 +479,16 @@ Java_hdf_hdf5lib_H5_H5Lget_1value
if (H5L_TYPE_HARD == infobuf.type)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Lget_val: hard links are unsupported");
- if (NULL == (linkValue = (char *) HDmalloc(sizeof(char) * infobuf.u.val_size + 1)))
+ if (NULL == (linkValue = (char *)HDmalloc(sizeof(char) * infobuf.u.val_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Lget_val: failed to allocate buffer for link value");
- if ((status = H5Lget_val((hid_t)loc_id, linkName, (void *)linkValue, infobuf.u.val_size + 1, (hid_t)access_id)) < 0)
+ if ((status = H5Lget_val((hid_t)loc_id, linkName, (void *)linkValue, infobuf.u.val_size + 1,
+ (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
linkValue[infobuf.u.val_size] = '\0';
switch (infobuf.type) {
- case H5L_TYPE_SOFT:
- {
+ case H5L_TYPE_SOFT: {
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, linkValue)))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
@@ -495,9 +498,9 @@ Java_hdf_hdf5lib_H5_H5Lget_1value
break;
}
- case H5L_TYPE_EXTERNAL:
- {
- if ((status = H5Lunpack_elink_val(linkValue, (size_t)infobuf.u.val_size, (unsigned *)NULL, &file_name, &obj_name)) < 0)
+ case H5L_TYPE_EXTERNAL: {
+ if ((status = H5Lunpack_elink_val(linkValue, (size_t)infobuf.u.val_size, (unsigned *)NULL,
+ &file_name, &obj_name)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, obj_name)))
@@ -538,17 +541,17 @@ done:
* Signature: (JLjava/lang/String;IIJ[Ljava/lang/String;J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint index_field, jint order,
- jlong link_n, jobjectArray link_value, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
+ jint index_field, jint order, jlong link_n,
+ jobjectArray link_value, jlong access_id)
{
- H5L_info2_t infobuf;
- const char *file_name = NULL;
- const char *obj_name = NULL;
- const char *grpName = NULL;
- jstring str;
- herr_t status;
- void *linkValue = NULL;
+ H5L_info2_t infobuf;
+ const char *file_name = NULL;
+ const char *obj_name = NULL;
+ const char *grpName = NULL;
+ jstring str;
+ herr_t status;
+ void * linkValue = NULL;
UNUSED(clss);
@@ -560,7 +563,8 @@ Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx
PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Lget_val_by_idx: group name not pinned");
/* Get the length of the link value */
- if ((status = H5Lget_info_by_idx2((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id)) < 0)
+ if ((status = H5Lget_info_by_idx2((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order,
+ (hsize_t)link_n, &infobuf, (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if (H5L_TYPE_HARD == infobuf.type)
@@ -569,16 +573,17 @@ Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx
if (!infobuf.u.val_size)
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (linkValue = (void *) HDmalloc(infobuf.u.val_size + 1)))
+ if (NULL == (linkValue = (void *)HDmalloc(infobuf.u.val_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Lget_val_by_idx: failed to allocate buffer for link value");
- if ((status = H5Lget_val_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (void *)linkValue, infobuf.u.val_size + 1, (hid_t)access_id)) < 0)
+ if ((status = H5Lget_val_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order,
+ (hsize_t)link_n, (void *)linkValue, infobuf.u.val_size + 1,
+ (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- ((char *) linkValue)[infobuf.u.val_size] = '\0';
+ ((char *)linkValue)[infobuf.u.val_size] = '\0';
switch (infobuf.type) {
- case H5L_TYPE_SOFT:
- {
+ case H5L_TYPE_SOFT: {
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, (char *)linkValue)))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
@@ -588,9 +593,9 @@ Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx
break;
}
- case H5L_TYPE_EXTERNAL:
- {
- if ((status = H5Lunpack_elink_val((char *)linkValue, (size_t)infobuf.u.val_size, (unsigned *)NULL, (const char **)&file_name, (const char**)&obj_name)) < 0)
+ case H5L_TYPE_EXTERNAL: {
+ if ((status = H5Lunpack_elink_val((char *)linkValue, (size_t)infobuf.u.val_size, (unsigned *)NULL,
+ (const char **)&file_name, (const char **)&obj_name)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, obj_name)))
@@ -631,13 +636,12 @@ done:
* Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Lmove
- (JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name,
- jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Lmove(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name, jlong dst_loc_id,
+ jstring dst_name, jlong create_id, jlong access_id)
{
const char *lCurName = NULL;
const char *lDstName = NULL;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -649,7 +653,8 @@ Java_hdf_hdf5lib_H5_H5Lmove
PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Lmove: src name not pinned");
PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Lmove: dest name not pinned");
- if ((status = H5Lmove((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ if ((status = H5Lmove((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id,
+ (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -663,19 +668,18 @@ done:
* Shim function for link iteration and link visiting which
*/
static herr_t
-H5L_iterate_cb
- (hid_t g_id, const char *name, const H5L_info2_t *info, void *cb_data)
+H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info2_t *info, void *cb_data)
{
cb_wrapper *wrapper = (cb_wrapper *)cb_data;
jmethodID mid;
- jobject cb_info_t = NULL;
+ jobject cb_info_t = NULL;
jobject visit_callback = wrapper->visit_callback;
jstring str;
- JNIEnv *cbenv = NULL;
+ JNIEnv * cbenv = NULL;
jclass cbcls;
jvalue args[5];
- void *op_data = (void *)wrapper->op_data;
- jint status = -1;
+ void * op_data = (void *)wrapper->op_data;
+ jint status = -1;
if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
@@ -686,7 +690,9 @@ H5L_iterate_cb
if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5L_info_t;Lhdf/hdf5lib/callbacks/H5L_iterate_opdata_t;)I")))
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback",
+ "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5L_info_t;Lhdf/"
+ "hdf5lib/callbacks/H5L_iterate_opdata_t;)I")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
@@ -710,7 +716,8 @@ H5L_iterate_cb
args[3].i = info->cset;
args[4].l = token;
- CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJILhdf/hdf5lib/structs/H5O_token_t;)V", args, cb_info_t);
+ CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5L_info_t",
+ "(IZJILhdf/hdf5lib/structs/H5O_token_t;)V", args, cb_info_t);
}
else {
args[0].i = info->type;
@@ -738,12 +745,11 @@ done:
* Signature: (JIILjava/lang/Object;Ljava/lang/Object;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Lvisit
- (JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order,
- jobject callback_op, jobject op_data)
+Java_hdf_hdf5lib_H5_H5Lvisit(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order,
+ jobject callback_op, jobject op_data)
{
- cb_wrapper wrapper = { callback_op, op_data };
- herr_t status = FAIL;
+ cb_wrapper wrapper = {callback_op, op_data};
+ herr_t status = FAIL;
UNUSED(clss);
@@ -755,8 +761,8 @@ Java_hdf_hdf5lib_H5_H5Lvisit
if (NULL == callback_op)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lvisit: callback_op is NULL");
- if ((status = H5Lvisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order,
- H5L_iterate_cb, (void *)&wrapper)) < 0)
+ if ((status = H5Lvisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, H5L_iterate_cb,
+ (void *)&wrapper)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -769,13 +775,12 @@ done:
* Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name
- (JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order,
- jobject callback_op, jobject op_data, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type,
+ jint order, jobject callback_op, jobject op_data, jlong access_id)
{
- cb_wrapper wrapper = { callback_op, op_data };
+ cb_wrapper wrapper = {callback_op, op_data};
const char *grpName = NULL;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -792,7 +797,7 @@ Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name
PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Lvisit_by_name: group name not pinned");
if ((status = H5Lvisit_by_name2((hid_t)grp_id, grpName, (H5_index_t)idx_type, (H5_iter_order_t)order,
- H5L_iterate_cb, (void *)&wrapper, (hid_t)access_id)) < 0)
+ H5L_iterate_cb, (void *)&wrapper, (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -808,13 +813,12 @@ done:
* Signature: (JIIJLjava/lang/Object;Ljava/lang/Object;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Literate
- (JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order,
- jlong idx, jobject callback_op, jobject op_data)
+Java_hdf_hdf5lib_H5_H5Literate(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order, jlong idx,
+ jobject callback_op, jobject op_data)
{
- cb_wrapper wrapper = { callback_op, op_data };
+ cb_wrapper wrapper = {callback_op, op_data};
hsize_t start_idx = (hsize_t)idx;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -826,8 +830,8 @@ Java_hdf_hdf5lib_H5_H5Literate
if (NULL == callback_op)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Literate: callback_op is NULL");
- if ((status = H5Literate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order,
- &start_idx, H5L_iterate_cb, (void *)&wrapper)) < 0)
+ if ((status = H5Literate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, &start_idx,
+ H5L_iterate_cb, (void *)&wrapper)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -840,14 +844,14 @@ done:
* Signature: (JLjava/lang/String;IIJLjava/lang/Object;Ljava/lang/Object;J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Literate_1by_1name
- (JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order,
- jlong idx, jobject callback_op, jobject op_data, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Literate_1by_1name(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type,
+ jint order, jlong idx, jobject callback_op, jobject op_data,
+ jlong access_id)
{
- cb_wrapper wrapper = { callback_op, op_data };
+ cb_wrapper wrapper = {callback_op, op_data};
const char *groupName = NULL;
hsize_t start_idx = (hsize_t)idx;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -864,7 +868,7 @@ Java_hdf_hdf5lib_H5_H5Literate_1by_1name
PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Literate_by_name: group name not pinned");
if ((status = H5Literate_by_name2((hid_t)grp_id, groupName, (H5_index_t)idx_type, (H5_iter_order_t)order,
- &start_idx, H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id)) < 0)
+ &start_idx, H5L_iterate_cb, (void *)&wrapper, (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -880,8 +884,7 @@ done:
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Lis_1registered
- (JNIEnv *env, jclass clss, jint link_cls_id)
+Java_hdf_hdf5lib_H5_H5Lis_1registered(JNIEnv *env, jclass clss, jint link_cls_id)
{
htri_t ret_val = FAIL;
@@ -900,8 +903,7 @@ done:
* Signature: (I)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Lunregister
- (JNIEnv *env, jclass clss, jint link_cls_id)
+Java_hdf_hdf5lib_H5_H5Lunregister(JNIEnv *env, jclass clss, jint link_cls_id)
{
UNUSED(clss);
@@ -912,7 +914,6 @@ done:
return;
} /* end Java_hdf_hdf5lib_H5_H5Lunregister */
-
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/h5lImp.h b/java/src/jni/h5lImp.h
index 3a7d8ea..7a93c71 100644
--- a/java/src/jni/h5lImp.h
+++ b/java/src/jni/h5lImp.h
@@ -21,177 +21,151 @@
extern "C" {
#endif /* __cplusplus */
-
/*
* Class: hdf_hdf5lib_H5
* Method: H5Lcopy
* Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Lcopy
- (JNIEnv*, jclass, jlong, jstring, jlong, jstring, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lcopy(JNIEnv *, jclass, jlong, jstring, jlong, jstring, jlong,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Lcreate_external
* Signature: (Ljava/lang/String;Ljava/lang/String;JLjava/lang/String;JJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Lcreate_1external
-(JNIEnv*, jclass, jstring, jstring, jlong, jstring, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lcreate_1external(JNIEnv *, jclass, jstring, jstring, jlong,
+ jstring, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Lcreate_hard
* Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Lcreate_1hard
- (JNIEnv*, jclass, jlong, jstring, jlong, jstring, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lcreate_1hard(JNIEnv *, jclass, jlong, jstring, jlong, jstring,
+ jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Lcreate_soft
* Signature: (Ljava/lang/String;JLjava/lang/String;JJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Lcreate_1soft
- (JNIEnv*, jclass, jstring, jlong, jstring, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lcreate_1soft(JNIEnv *, jclass, jstring, jlong, jstring, jlong,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Ldelete
* Signature: (JLjava/lang/String;J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Ldelete
- (JNIEnv*, jclass, jlong, jstring, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ldelete(JNIEnv *, jclass, jlong, jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Ldelete_by_idx
* Signature: (JLjava/lang/String;IIJJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx
-(JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx(JNIEnv *, jclass, jlong, jstring, jint, jint,
+ jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Lexists
* Signature: (JLjava/lang/String;J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Lexists
- (JNIEnv*, jclass, jlong, jstring, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Lexists(JNIEnv *, jclass, jlong, jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Lget_info
* Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5L_info_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Lget_1info
-(JNIEnv*, jclass, jlong, jstring, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Lget_1info(JNIEnv *, jclass, jlong, jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Lget_info_by_idx
* Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5L_info_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx
-(JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx(JNIEnv *, jclass, jlong, jstring, jint,
+ jint, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Lget_name_by_idx
* Signature: (JLjava/lang/String;IIJJ)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx
-(JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx(JNIEnv *, jclass, jlong, jstring, jint,
+ jint, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Lget_value
* Signature: (JLjava/lang/String;[Ljava/lang/String;J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Lget_1value
- (JNIEnv*, jclass, jlong, jstring, jobjectArray, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lget_1value(JNIEnv *, jclass, jlong, jstring, jobjectArray,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Lget_value_by_idx
* Signature: (JLjava/lang/String;IIJ[Ljava/lang/String;J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx
-(JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jobjectArray, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx(JNIEnv *, jclass, jlong, jstring, jint,
+ jint, jlong, jobjectArray, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Lmove
* Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Lmove
- (JNIEnv*, jclass, jlong, jstring, jlong, jstring, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lmove(JNIEnv *, jclass, jlong, jstring, jlong, jstring, jlong,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Lvisit
* Signature: (JIILjava/lang/Object;Ljava/lang/Object;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Lvisit
- (JNIEnv*, jclass, jlong, jint, jint, jobject, jobject);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lvisit(JNIEnv *, jclass, jlong, jint, jint, jobject, jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Lvisit_by_name
* Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name
- (JNIEnv*, jclass, jlong, jstring, jint, jint, jobject, jobject, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name(JNIEnv *, jclass, jlong, jstring, jint, jint,
+ jobject, jobject, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Literate
* Signature: (JIIJLjava/lang/Object;Ljava/lang/Object;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Literate
- (JNIEnv*, jclass, jlong, jint, jint, jlong, jobject, jobject);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Literate(JNIEnv *, jclass, jlong, jint, jint, jlong, jobject,
+ jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Literate_by_name
* Signature: (JLjava/lang/String;IIJLjava/lang/Object;Ljava/lang/Object;J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Literate_1by_1name
- (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jobject, jobject, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Literate_1by_1name(JNIEnv *, jclass, jlong, jstring, jint, jint,
+ jlong, jobject, jobject, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Lis_registered
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Lis_1registered
- (JNIEnv*, jclass, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lis_1registered(JNIEnv *, jclass, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Lunregister
* Signature: (I)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Lunregister
- (JNIEnv*, jclass, jint);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lunregister(JNIEnv *, jclass, jint);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c
index 33bec85..1582f04 100644
--- a/java/src/jni/h5oImp.c
+++ b/java/src/jni/h5oImp.c
@@ -46,22 +46,23 @@ static herr_t H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info2_t *in
* Create a java object of hdf.hdf5lib.structs.H5O_token_t.
*/
jobject
-create_H5O_token_t
- (JNIEnv *envptr, const H5O_token_t *token, hbool_t is_critical_pinning)
+create_H5O_token_t(JNIEnv *envptr, const H5O_token_t *token, hbool_t is_critical_pinning)
{
- jbyteArray tokenByteBuf;
- jboolean token_buf_is_copy;
- jvalue constructor_args[1];
- jbyte *token_buf = NULL;
- jobject ret_token_obj = NULL;
+ jbyteArray tokenByteBuf;
+ jboolean token_buf_is_copy;
+ jvalue constructor_args[1];
+ jbyte * token_buf = NULL;
+ jobject ret_token_obj = NULL;
if (NULL == (tokenByteBuf = (*envptr)->NewByteArray(envptr, H5O_MAX_TOKEN_SIZE)))
CHECK_JNI_EXCEPTION(envptr, JNI_FALSE);
if (is_critical_pinning)
- PIN_BYTE_ARRAY_CRITICAL(envptr, tokenByteBuf, token_buf, &token_buf_is_copy, "create_H5O_token_t: object token buffer not pinned");
+ PIN_BYTE_ARRAY_CRITICAL(envptr, tokenByteBuf, token_buf, &token_buf_is_copy,
+ "create_H5O_token_t: object token buffer not pinned");
else
- PIN_BYTE_ARRAY(envptr, tokenByteBuf, token_buf, &token_buf_is_copy, "create_H5O_token_t: object token buffer not pinned");
+ PIN_BYTE_ARRAY(envptr, tokenByteBuf, token_buf, &token_buf_is_copy,
+ "create_H5O_token_t: object token buffer not pinned");
HDmemcpy(token_buf, token, sizeof(H5O_token_t));
@@ -99,11 +100,10 @@ done:
* Signature: (JLjava/lang/String;J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Oopen
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist_id)
+Java_hdf_hdf5lib_H5__1H5Oopen(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist_id)
{
const char *objName = NULL;
- hid_t status = H5I_INVALID_HID;
+ hid_t status = H5I_INVALID_HID;
UNUSED(clss);
@@ -128,8 +128,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Oclose
- (JNIEnv *env, jclass clss, jlong object_id)
+Java_hdf_hdf5lib_H5__1H5Oclose(JNIEnv *env, jclass clss, jlong object_id)
{
herr_t retVal = FAIL;
@@ -148,13 +147,12 @@ done:
* Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Ocopy
- (JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name,
- jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Ocopy(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name, jlong dst_loc_id,
+ jstring dst_name, jlong create_id, jlong access_id)
{
const char *lCurName = NULL;
const char *lDstName = NULL;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -166,7 +164,8 @@ Java_hdf_hdf5lib_H5_H5Ocopy
PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Ocopy: src name not pinned");
PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Ocopy: dest name not pinned");
- if ((status = H5Ocopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ if ((status = H5Ocopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id,
+ (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -182,13 +181,12 @@ done:
* Signature: (JI)Lhdf/hdf5lib/structs/H5O_info_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Oget_1info
- (JNIEnv *env, jclass clss, jlong loc_id, jint fields)
+Java_hdf_hdf5lib_H5_H5Oget_1info(JNIEnv *env, jclass clss, jlong loc_id, jint fields)
{
H5O_info2_t infobuf;
jobject token;
jvalue args[9];
- herr_t status = FAIL;
+ herr_t status = FAIL;
jobject ret_obj = NULL;
UNUSED(clss);
@@ -209,7 +207,8 @@ Java_hdf_hdf5lib_H5_H5Oget_1info
args[7].j = infobuf.btime;
args[8].j = (jlong)infobuf.num_attrs;
- CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JLhdf/hdf5lib/structs/H5O_token_t;IIJJJJJ)V", args, ret_obj);
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t",
+ "(JLhdf/hdf5lib/structs/H5O_token_t;IIJJJJJ)V", args, ret_obj);
done:
return ret_obj;
@@ -221,15 +220,15 @@ done:
* Signature: (JLjava/lang/String;IJ)Lhdf/hdf5lib/structs/H5O_info_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint fields, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint fields,
+ jlong access_id)
{
- H5O_info2_t infobuf;
- const char *objName = NULL;
- jobject token;
- jvalue args[9];
- herr_t status = FAIL;
- jobject ret_obj = NULL;
+ H5O_info2_t infobuf;
+ const char *objName = NULL;
+ jobject token;
+ jvalue args[9];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
UNUSED(clss);
@@ -238,7 +237,8 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name
PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oget_info_by_name: object name not pinned");
- if ((status = H5Oget_info_by_name3((hid_t)loc_id, objName, &infobuf, (unsigned)fields, (hid_t)access_id)) < 0)
+ if ((status =
+ H5Oget_info_by_name3((hid_t)loc_id, objName, &infobuf, (unsigned)fields, (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
/* Create an H5O_token_t object */
@@ -255,7 +255,8 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name
args[7].j = infobuf.btime;
args[8].j = (jlong)infobuf.num_attrs;
- CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JLhdf/hdf5lib/structs/H5O_token_t;IIJJJJJ)V", args, ret_obj);
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t",
+ "(JLhdf/hdf5lib/structs/H5O_token_t;IIJJJJJ)V", args, ret_obj);
done:
if (objName)
@@ -270,16 +271,16 @@ done:
* Signature: (JLjava/lang/String;IIJIJ)Lhdf/hdf5lib/structs/H5O_info_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx
- (JNIEnv *env, jclass clss, jlong loc_id,
- jstring name, jint index_field, jint order, jlong link_n, jint fields, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
+ jint index_field, jint order, jlong link_n, jint fields,
+ jlong access_id)
{
- H5O_info2_t infobuf;
- const char *grpName = NULL;
- jobject token;
- jvalue args[9];
- herr_t status = FAIL;
- jobject ret_obj = NULL;
+ H5O_info2_t infobuf;
+ const char *grpName = NULL;
+ jobject token;
+ jvalue args[9];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
UNUSED(clss);
@@ -288,8 +289,8 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx
PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Oget_info_by_idx: group name not pinned");
- if ((status = H5Oget_info_by_idx3((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n,
- &infobuf, (unsigned)fields, (hid_t)access_id)) < 0)
+ if ((status = H5Oget_info_by_idx3((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order,
+ (hsize_t)link_n, &infobuf, (unsigned)fields, (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
/* Create an H5O_token_t object */
@@ -306,7 +307,8 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx
args[7].j = infobuf.btime;
args[8].j = (jlong)infobuf.num_attrs;
- CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JLhdf/hdf5lib/structs/H5O_token_t;IIJJJJJ)V", args, ret_obj);
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t",
+ "(JLhdf/hdf5lib/structs/H5O_token_t;IIJJJJJ)V", args, ret_obj);
done:
if (grpName)
@@ -321,15 +323,14 @@ done:
* Signature: (JI)Lhdf/hdf5lib/structs/H5O_native_info_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Oget_1native_1info
- (JNIEnv *env, jclass clss, jlong loc_id, jint fields)
+Java_hdf_hdf5lib_H5_H5Oget_1native_1info(JNIEnv *env, jclass clss, jlong loc_id, jint fields)
{
H5O_native_info_t infobuf;
jobject hdrinfobuf;
jobject obj_ihinfobuf;
jobject attr_ihinfobuf;
jvalue args[10];
- herr_t status = FAIL;
+ herr_t status = FAIL;
jobject ret_obj = NULL;
UNUSED(clss);
@@ -367,7 +368,10 @@ Java_hdf_hdf5lib_H5_H5Oget_1native_1info
args[1].l = obj_ihinfobuf;
args[2].l = attr_ihinfobuf;
- CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_native_info_t", "(Lhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj);
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_native_info_t",
+ "(Lhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/"
+ "structs/H5_ih_info_t;)V",
+ args, ret_obj);
done:
return ret_obj;
@@ -379,17 +383,17 @@ done:
* Signature: (JLjava/lang/String;IJ)Lhdf/hdf5lib/structs/H5O_native_info_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1name
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint fields, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
+ jint fields, jlong access_id)
{
- H5O_native_info_t infobuf;
- const char *objName = NULL;
- jobject hdrinfobuf;
- jobject obj_ihinfobuf;
- jobject attr_ihinfobuf;
- jvalue args[10];
- herr_t status = FAIL;
- jobject ret_obj = NULL;
+ H5O_native_info_t infobuf;
+ const char * objName = NULL;
+ jobject hdrinfobuf;
+ jobject obj_ihinfobuf;
+ jobject attr_ihinfobuf;
+ jvalue args[10];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
UNUSED(clss);
@@ -398,7 +402,8 @@ Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1name
PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oget_native_info_by_name: object name not pinned");
- if ((status = H5Oget_native_info_by_name((hid_t)loc_id, objName, &infobuf, (unsigned)fields, (hid_t)access_id)) < 0)
+ if ((status = H5Oget_native_info_by_name((hid_t)loc_id, objName, &infobuf, (unsigned)fields,
+ (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
args[0].i = (jint)infobuf.hdr.version;
@@ -431,7 +436,10 @@ Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1name
args[1].l = obj_ihinfobuf;
args[2].l = attr_ihinfobuf;
- CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_native_info_t", "(Lhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj);
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_native_info_t",
+ "(Lhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/"
+ "structs/H5_ih_info_t;)V",
+ args, ret_obj);
done:
if (objName)
@@ -446,18 +454,18 @@ done:
* Signature: (JLjava/lang/String;IIJIJ)Lhdf/hdf5lib/structs/H5O_native_info_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1idx
- (JNIEnv *env, jclass clss, jlong loc_id,
- jstring name, jint index_field, jint order, jlong link_n, jint fields, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
+ jint index_field, jint order, jlong link_n, jint fields,
+ jlong access_id)
{
- H5O_native_info_t infobuf;
- const char *grpName = NULL;
- jobject hdrinfobuf;
- jobject obj_ihinfobuf;
- jobject attr_ihinfobuf;
- jvalue args[10];
- herr_t status = FAIL;
- jobject ret_obj = NULL;
+ H5O_native_info_t infobuf;
+ const char * grpName = NULL;
+ jobject hdrinfobuf;
+ jobject obj_ihinfobuf;
+ jobject attr_ihinfobuf;
+ jvalue args[10];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
UNUSED(clss);
@@ -466,8 +474,9 @@ Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1idx
PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Oget_native_info_by_idx: group name not pinned");
- if ((status = H5Oget_native_info_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n,
- &infobuf, (unsigned)fields, (hid_t)access_id)) < 0)
+ if ((status = H5Oget_native_info_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field,
+ (H5_iter_order_t)order, (hsize_t)link_n, &infobuf,
+ (unsigned)fields, (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
args[0].i = (jint)infobuf.hdr.version;
@@ -500,7 +509,10 @@ Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1idx
args[1].l = obj_ihinfobuf;
args[2].l = attr_ihinfobuf;
- CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_native_info_t", "(Lhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj);
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_native_info_t",
+ "(Lhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/"
+ "structs/H5_ih_info_t;)V",
+ args, ret_obj);
done:
if (grpName)
@@ -515,12 +527,11 @@ done:
* Signature: (JJLjava/lang/String;JJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Olink
- (JNIEnv *env, jclass clss, jlong cur_loc_id, jlong dst_loc_id,
- jstring dst_name, jlong create_id, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Olink(JNIEnv *env, jclass clss, jlong cur_loc_id, jlong dst_loc_id, jstring dst_name,
+ jlong create_id, jlong access_id)
{
const char *linkDstName = NULL;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -529,7 +540,8 @@ Java_hdf_hdf5lib_H5_H5Olink
PIN_JAVA_STRING(ENVONLY, dst_name, linkDstName, NULL, "H5Olink: link destination name not pinned");
- if ((status = H5Olink((hid_t)cur_loc_id, (hid_t)dst_loc_id, linkDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ if ((status = H5Olink((hid_t)cur_loc_id, (hid_t)dst_loc_id, linkDstName, (hid_t)create_id,
+ (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -538,20 +550,19 @@ done:
} /* end Java_hdf_hdf5lib_H5_H5Olink */
static herr_t
-H5O_iterate_cb
- (hid_t g_id, const char *name, const H5O_info2_t *info, void *cb_data)
+H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info2_t *info, void *cb_data)
{
cb_wrapper *wrapper = (cb_wrapper *)cb_data;
jmethodID mid;
- jobject cb_info_t = NULL;
+ jobject cb_info_t = NULL;
jobject visit_callback = wrapper->visit_callback;
jobject token;
jstring str;
- JNIEnv *cbenv = NULL;
+ JNIEnv * cbenv = NULL;
jclass cbcls;
jvalue args[12];
- void *op_data = (void *)wrapper->op_data;
- jint status = FAIL;
+ void * op_data = (void *)wrapper->op_data;
+ jint status = FAIL;
if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
@@ -561,7 +572,9 @@ H5O_iterate_cb
if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5O_info_t;Lhdf/hdf5lib/callbacks/H5O_iterate_opdata_t;)I")))
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback",
+ "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5O_info_t;Lhdf/"
+ "hdf5lib/callbacks/H5O_iterate_opdata_t;)I")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
@@ -582,7 +595,8 @@ H5O_iterate_cb
args[8].j = (jlong)info->num_attrs;
/* Get a reference to the H5O_info_t class */
- CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JLhdf/hdf5lib/structs/H5O_token_t;IIJJJJJ)V", args, cb_info_t);
+ CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5O_info_t",
+ "(JLhdf/hdf5lib/structs/H5O_token_t;IIJJJJJ)V", args, cb_info_t);
status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, g_id, str, cb_info_t, op_data);
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
@@ -600,12 +614,11 @@ done:
* Signature: (JIILjava/lang/Object;Ljava/lang/Object;I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Ovisit
- (JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order,
- jobject callback_op, jobject op_data, jint fields)
+Java_hdf_hdf5lib_H5_H5Ovisit(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order,
+ jobject callback_op, jobject op_data, jint fields)
{
- cb_wrapper wrapper = { callback_op, op_data };
- herr_t status = FAIL;
+ cb_wrapper wrapper = {callback_op, op_data};
+ herr_t status = FAIL;
UNUSED(clss);
@@ -617,8 +630,8 @@ Java_hdf_hdf5lib_H5_H5Ovisit
if (NULL == callback_op)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ovisit: callback_op is NULL");
- if ((status = H5Ovisit3((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order,
- H5O_iterate_cb, (void *)&wrapper, (unsigned)fields)) < 0)
+ if ((status = H5Ovisit3((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, H5O_iterate_cb,
+ (void *)&wrapper, (unsigned)fields)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -631,13 +644,13 @@ done:
* Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;IJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name
- (JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order,
- jobject callback_op, jobject op_data, jint fields, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type,
+ jint order, jobject callback_op, jobject op_data, jint fields,
+ jlong access_id)
{
- cb_wrapper wrapper = { callback_op, op_data };
+ cb_wrapper wrapper = {callback_op, op_data};
const char *objName = NULL;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -654,7 +667,8 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name
PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Ovisit_by_name: object name not pinned");
if ((status = H5Ovisit_by_name3((hid_t)grp_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order,
- H5O_iterate_cb, (void *)&wrapper, (unsigned)fields, (hid_t)access_id)) < 0)
+ H5O_iterate_cb, (void *)&wrapper, (unsigned)fields, (hid_t)access_id)) <
+ 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -670,11 +684,10 @@ done:
* Signature: (JLjava/lang/String;)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Oset_1comment
- (JNIEnv *env, jclass clss, jlong loc_id, jstring comment)
+Java_hdf_hdf5lib_H5_H5Oset_1comment(JNIEnv *env, jclass clss, jlong loc_id, jstring comment)
{
const char *oComment = NULL;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -695,11 +708,10 @@ done:
* Signature: (JLjava/lang/String;Ljava/lang/String;J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name
- (JNIEnv *env, jclass clss, jlong loc_id,
- jstring name, jstring comment, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
+ jstring comment, jlong access_id)
{
- const char *objName = NULL;
+ const char *objName = NULL;
const char *objComment = NULL;
jboolean isCopy;
herr_t status = FAIL;
@@ -712,7 +724,8 @@ Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name
PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oset_comment_by_name: object name not pinned");
if (NULL != comment)
- PIN_JAVA_STRING(ENVONLY, comment, objComment, &isCopy, "H5Oset_comment_by_name: object comment not pinned");
+ PIN_JAVA_STRING(ENVONLY, comment, objComment, &isCopy,
+ "H5Oset_comment_by_name: object comment not pinned");
if ((status = H5Oset_comment_by_name((hid_t)loc_id, objName, objComment, (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -730,13 +743,12 @@ done:
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Oget_1comment
- (JNIEnv *env, jclass clss, jlong loc_id)
+Java_hdf_hdf5lib_H5_H5Oget_1comment(JNIEnv *env, jclass clss, jlong loc_id)
{
- jstring str = NULL;
- ssize_t buf_size;
- ssize_t status = -1;
- char *oComment = NULL;
+ jstring str = NULL;
+ ssize_t buf_size;
+ ssize_t status = -1;
+ char * oComment = NULL;
UNUSED(clss);
@@ -745,7 +757,7 @@ Java_hdf_hdf5lib_H5_H5Oget_1comment
H5_LIBRARY_ERROR(ENVONLY);
if (buf_size) {
- if (NULL == (oComment = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ if (NULL == (oComment = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Oget_comment: failed to allocate object comment buffer");
if ((status = H5Oget_comment((hid_t)loc_id, oComment, (size_t)buf_size + 1)) < 0)
@@ -769,14 +781,14 @@ done:
* Signature: (JLjava/lang/String;J)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
+ jlong access_id)
{
const char *objName = NULL;
- jstring str = NULL;
+ jstring str = NULL;
ssize_t buf_size;
ssize_t status;
- char *objComment = NULL;
+ char * objComment = NULL;
UNUSED(clss);
@@ -790,10 +802,12 @@ Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name
H5_LIBRARY_ERROR(ENVONLY);
if (buf_size) {
- if (NULL == (objComment = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Oget_comment_by_name: failed to allocate buffer for object comment");
+ if (NULL == (objComment = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "H5Oget_comment_by_name: failed to allocate buffer for object comment");
- if ((status = H5Oget_comment_by_name((hid_t)loc_id, objName, objComment, (size_t)buf_size + 1, (hid_t)access_id)) < 0)
+ if ((status = H5Oget_comment_by_name((hid_t)loc_id, objName, objComment, (size_t)buf_size + 1,
+ (hid_t)access_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
objComment[buf_size] = '\0';
@@ -816,11 +830,10 @@ done:
* Signature: (JLjava/lang/String;J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Oexists_1by_1name
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
+Java_hdf_hdf5lib_H5_H5Oexists_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
const char *objName = NULL;
- htri_t bval = JNI_FALSE;
+ htri_t bval = JNI_FALSE;
UNUSED(clss);
@@ -847,8 +860,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Odecr_1refcount
- (JNIEnv *env, jclass clss, jlong object_id)
+Java_hdf_hdf5lib_H5_H5Odecr_1refcount(JNIEnv *env, jclass clss, jlong object_id)
{
UNUSED(clss);
@@ -865,8 +877,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Oincr_1refcount
- (JNIEnv *env, jclass clss, jlong object_id)
+Java_hdf_hdf5lib_H5_H5Oincr_1refcount(JNIEnv *env, jclass clss, jlong object_id)
{
UNUSED(clss);
@@ -883,16 +894,15 @@ done:
* Signature: (JLhdf/hdf5lib/structs/H5O_token_t;)J;
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Oopen_1by_1token
- (JNIEnv *env, jclass clss, jlong loc_id, jobject token)
+Java_hdf_hdf5lib_H5__1H5Oopen_1by_1token(JNIEnv *env, jclass clss, jlong loc_id, jobject token)
{
- H5O_token_t obj_token;
- jboolean token_buf_is_copy;
- jfieldID token_data_field_id;
- jclass token_cls;
- jbyte *token_buf = NULL;
- jobject token_data;
- hid_t retVal = H5I_INVALID_HID;
+ H5O_token_t obj_token;
+ jboolean token_buf_is_copy;
+ jfieldID token_data_field_id;
+ jclass token_cls;
+ jbyte * token_buf = NULL;
+ jobject token_data;
+ hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
@@ -905,7 +915,8 @@ Java_hdf_hdf5lib_H5__1H5Oopen_1by_1token
token_data = ENVPTR->GetObjectField(ENVONLY, token, token_data_field_id);
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- PIN_BYTE_ARRAY(ENVONLY, (jbyteArray)token_data, token_buf, &token_buf_is_copy, "H5Oopen_by_token: token buffer not pinned");
+ PIN_BYTE_ARRAY(ENVONLY, (jbyteArray)token_data, token_buf, &token_buf_is_copy,
+ "H5Oopen_by_token: token buffer not pinned");
HDmemcpy(&obj_token, token_buf, sizeof(H5O_token_t));
UNPIN_BYTE_ARRAY(ENVONLY, (jbyteArray)token_data, token_buf, JNI_ABORT);
token_buf = NULL;
@@ -926,12 +937,11 @@ done:
* Signature: (JLjava/lang/String;IIJJ)J;
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name,
- jint index_field, jint order, jlong link_n, jlong lapl_id)
+Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint index_field,
+ jint order, jlong link_n, jlong lapl_id)
{
const char *grpName = NULL;
- hid_t retVal = H5I_INVALID_HID;
+ hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
@@ -940,7 +950,8 @@ Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx
PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Oopen_by_idx: object name not pinned");
- if ((retVal = H5Oopen_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (hid_t)lapl_id)) < 0)
+ if ((retVal = H5Oopen_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order,
+ (hsize_t)link_n, (hid_t)lapl_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -956,8 +967,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Oflush
- (JNIEnv *env, jclass clss, jlong loc_id)
+Java_hdf_hdf5lib_H5_H5Oflush(JNIEnv *env, jclass clss, jlong loc_id)
{
UNUSED(clss);
@@ -974,8 +984,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Orefresh
- (JNIEnv *env, jclass clss, jlong loc_id)
+Java_hdf_hdf5lib_H5_H5Orefresh(JNIEnv *env, jclass clss, jlong loc_id)
{
UNUSED(clss);
@@ -992,8 +1001,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Odisable_1mdc_1flushes
- (JNIEnv *env, jclass clss, jlong loc_id)
+Java_hdf_hdf5lib_H5_H5Odisable_1mdc_1flushes(JNIEnv *env, jclass clss, jlong loc_id)
{
UNUSED(clss);
@@ -1010,8 +1018,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Oenable_1mdc_1flushes
- (JNIEnv *env, jclass clss, jlong loc_id)
+Java_hdf_hdf5lib_H5_H5Oenable_1mdc_1flushes(JNIEnv *env, jclass clss, jlong loc_id)
{
UNUSED(clss);
@@ -1028,11 +1035,10 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled
- (JNIEnv *env, jclass clss, jlong loc_id)
+Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled(JNIEnv *env, jclass clss, jlong loc_id)
{
- jboolean bval = JNI_FALSE;
- hbool_t is_disabled = FALSE;
+ jboolean bval = JNI_FALSE;
+ hbool_t is_disabled = FALSE;
UNUSED(clss);
@@ -1040,14 +1046,12 @@ Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled
H5_LIBRARY_ERROR(ENVONLY);
if (is_disabled == TRUE)
- bval = JNI_TRUE;
+ bval = JNI_TRUE;
done:
return bval;
} /* end Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled */
-
-
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/h5oImp.h b/java/src/jni/h5oImp.h
index 2b53fd3..965df19 100644
--- a/java/src/jni/h5oImp.h
+++ b/java/src/jni/h5oImp.h
@@ -21,240 +21,198 @@
extern "C" {
#endif /* __cplusplus */
-
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Oopen
* Signature: (JLjava/lang/String;J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Oopen
- (JNIEnv*, jclass, jlong, jstring, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Oopen(JNIEnv *, jclass, jlong, jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Oclose
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Oclose
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Oclose(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Ocopy
* Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Ocopy
- (JNIEnv*, jclass, jlong, jstring, jlong, jstring, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ocopy(JNIEnv *, jclass, jlong, jstring, jlong, jstring, jlong,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oget_info
* Signature: (JI)Lhdf/hdf5lib/structs/H5O_info_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Oget_1info
-(JNIEnv*, jclass, jlong, jint fields);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info(JNIEnv *, jclass, jlong, jint fields);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oget_info_by_name
* Signature: (JLjava/lang/String;IJ)Lhdf/hdf5lib/structs/H5O_info_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name
-(JNIEnv*, jclass, jlong, jstring, jint fields, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name(JNIEnv *, jclass, jlong, jstring,
+ jint fields, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oget_info_by_idx
* Signature: (JLjava/lang/String;IIJIJ)Lhdf/hdf5lib/structs/H5O_info_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx
-(JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jint fields, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx(JNIEnv *, jclass, jlong, jstring, jint,
+ jint, jlong, jint fields, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oget_native_info
* Signature: (JI)Lhdf/hdf5lib/structs/H5O_native_info_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Oget_1native_1info
-(JNIEnv*, jclass, jlong, jint fields);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1native_1info(JNIEnv *, jclass, jlong, jint fields);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oget_native_info_by_name
* Signature: (JLjava/lang/String;IJ)Lhdf/hdf5lib/structs/H5O_native_info_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1name
-(JNIEnv*, jclass, jlong, jstring, jint fields, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1name(JNIEnv *, jclass, jlong, jstring,
+ jint fields, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oget_native_info_by_idx
* Signature: (JLjava/lang/String;IIJIJ)Lhdf/hdf5lib/structs/H5O_native_info_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1idx
-(JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jint fields, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1idx(JNIEnv *, jclass, jlong, jstring,
+ jint, jint, jlong, jint fields,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Olink
* Signature: (JJLjava/lang/String;JJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Olink
- (JNIEnv*, jclass, jlong, jlong, jstring, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Olink(JNIEnv *, jclass, jlong, jlong, jstring, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Ovisit
* Signature: (JIILjava/lang/Object;Ljava/lang/Object;I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Ovisit
- (JNIEnv*, jclass, jlong, jint, jint, jobject, jobject, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Ovisit(JNIEnv *, jclass, jlong, jint, jint, jobject, jobject,
+ jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Ovisit_by_name
* Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;IJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name
- (JNIEnv*, jclass, jlong, jstring, jint, jint, jobject, jobject, jint, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name(JNIEnv *, jclass, jlong, jstring, jint, jint,
+ jobject, jobject, jint, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oset_comment
* Signature: (JLjava/lang/String;)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Oset_1comment
- (JNIEnv*, jclass, jlong, jstring);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Oset_1comment(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oset_comment_by_name
* Signature: (JLjava/lang/String;Ljava/lang/String;J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name
- (JNIEnv*, jclass, jlong, jstring, jstring, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name(JNIEnv *, jclass, jlong, jstring,
+ jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oget_comment
* Signature: (J)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Oget_1comment
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Oget_1comment(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oget_comment_by_name
* Signature: (JLjava/lang/String;J)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name
- (JNIEnv*, jclass, jlong, jstring, jlong);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name(JNIEnv *, jclass, jlong, jstring,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oexists_by_name
* Signature: (JLjava/lang/String;J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Oexists_1by_1name
- (JNIEnv*, jclass, jlong, jstring, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Oexists_1by_1name(JNIEnv *, jclass, jlong, jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Odecr_refcount
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Odecr_1refcount
- (JNIEnv*, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Odecr_1refcount(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oincr_refcount
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Oincr_1refcount
- (JNIEnv*, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Oincr_1refcount(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Oopen_by_token
* Signature: (JLhdf/hdf5lib/structs/H5O_token_t;)J;
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Oopen_1by_1token
- (JNIEnv*, jclass, jlong, jobject);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Oopen_1by_1token(JNIEnv *, jclass, jlong, jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Oopen_by_idx
* Signature: (JLjava/lang/String;IIJJ)J;
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx
- (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx(JNIEnv *, jclass, jlong, jstring, jint, jint,
+ jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oflush
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Oflush
- (JNIEnv*, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Oflush(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Orefresh
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Orefresh
- (JNIEnv*, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Orefresh(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Odisable_mdc_flushes
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Odisable_1mdc_1flushes
- (JNIEnv*, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Odisable_1mdc_1flushes(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oenable_mdc_flushes
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Oenable_1mdc_1flushes
- (JNIEnv*, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Oenable_1mdc_1flushes(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oare_mdc_flushes_disabled
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled
- (JNIEnv*, jclass, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled(JNIEnv *, jclass, jlong);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5pDAPLImp.c b/java/src/jni/h5pDAPLImp.c
index 2386df1..4654aa3 100644
--- a/java/src/jni/h5pDAPLImp.c
+++ b/java/src/jni/h5pDAPLImp.c
@@ -44,13 +44,12 @@ static herr_t H5D_append_cb(hid_t dataset_id, hsize_t *cur_dims, void *cb_data);
* Signature: (JJJD)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache
- (JNIEnv *env, jclass clss, jlong dapl, jlong rdcc_nslots,
- jlong rdcc_nbytes, jdouble rdcc_w0)
+Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache(JNIEnv *env, jclass clss, jlong dapl, jlong rdcc_nslots,
+ jlong rdcc_nbytes, jdouble rdcc_w0)
{
UNUSED(clss);
- if (H5Pset_chunk_cache((hid_t)dapl, (size_t)rdcc_nslots, (size_t)rdcc_nbytes, (double) rdcc_w0) < 0)
+ if (H5Pset_chunk_cache((hid_t)dapl, (size_t)rdcc_nslots, (size_t)rdcc_nbytes, (double)rdcc_w0) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -63,37 +62,38 @@ done:
* Signature: (J[J[J[D)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache
- (JNIEnv *env, jclass clss, jlong dapl, jlongArray rdcc_nslots,
- jlongArray rdcc_nbytes, jdoubleArray rdcc_w0)
+Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache(JNIEnv *env, jclass clss, jlong dapl, jlongArray rdcc_nslots,
+ jlongArray rdcc_nbytes, jdoubleArray rdcc_w0)
{
- jboolean isCopy;
- jdouble *w0Array = NULL;
- jlong *rdcc_nslotsArray = NULL;
- jlong *nbytesArray = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jdouble *w0Array = NULL;
+ jlong * rdcc_nslotsArray = NULL;
+ jlong * nbytesArray = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
if (NULL != rdcc_w0)
PIN_DOUBLE_ARRAY(ENVONLY, rdcc_w0, w0Array, &isCopy, "H5Pget_chunk_cache: rdcc_w0 array not pinned");
if (NULL != rdcc_nslots)
- PIN_LONG_ARRAY(ENVONLY, rdcc_nslots, rdcc_nslotsArray, &isCopy, "H5Pget_chunk_cache: rdcc_nslots array not pinned");
+ PIN_LONG_ARRAY(ENVONLY, rdcc_nslots, rdcc_nslotsArray, &isCopy,
+ "H5Pget_chunk_cache: rdcc_nslots array not pinned");
if (NULL != rdcc_nbytes)
- PIN_LONG_ARRAY(ENVONLY, rdcc_nbytes, nbytesArray, &isCopy, "H5Pget_chunk_cache: nbytesArray array not pinned");
+ PIN_LONG_ARRAY(ENVONLY, rdcc_nbytes, nbytesArray, &isCopy,
+ "H5Pget_chunk_cache: nbytesArray array not pinned");
{
/* direct cast (size_t *)variable fails on 32-bit environment */
long long rdcc_nslots_temp = *rdcc_nslotsArray;
- long long nbytes_temp = *nbytesArray;
- size_t rdcc_nslots_t = (size_t) rdcc_nslots_temp;
- size_t nbytes_t = (size_t) nbytes_temp;
+ long long nbytes_temp = *nbytesArray;
+ size_t rdcc_nslots_t = (size_t)rdcc_nslots_temp;
+ size_t nbytes_t = (size_t)nbytes_temp;
if ((status = H5Pget_chunk_cache((hid_t)dapl, &rdcc_nslots_t, &nbytes_t, (double *)w0Array)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
*rdcc_nslotsArray = (jlong)rdcc_nslots_t;
- *nbytesArray = (jlong)nbytes_t;
+ *nbytesArray = (jlong)nbytes_t;
} /* end direct cast special handling */
done:
@@ -111,18 +111,18 @@ done:
* Signature: (JLjava/lang/String;)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix
- (JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix)
+Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix(JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix)
{
const char *extFilePrefix = NULL;
- herr_t retVal = FAIL;
+ herr_t retVal = FAIL;
UNUSED(clss);
if (NULL == prefix)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_efile_prefix: external file prefix is NULL");
- PIN_JAVA_STRING(ENVONLY, prefix, extFilePrefix, NULL, "H5Pset_efile_prefix: external file prefix not pinned");
+ PIN_JAVA_STRING(ENVONLY, prefix, extFilePrefix, NULL,
+ "H5Pset_efile_prefix: external file prefix not pinned");
if ((retVal = H5Pset_efile_prefix((hid_t)dapl_id, extFilePrefix)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -138,19 +138,18 @@ done:
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix
- (JNIEnv *env, jclass clss, jlong dapl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix(JNIEnv *env, jclass clss, jlong dapl_id)
{
- ssize_t prefix_size = -1;
- char *pre = NULL;
- jstring str = NULL;
+ ssize_t prefix_size = -1;
+ char * pre = NULL;
+ jstring str = NULL;
UNUSED(clss);
if ((prefix_size = H5Pget_efile_prefix((hid_t)dapl_id, (char *)NULL, 0)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (pre = (char *) HDmalloc(sizeof(char) * (size_t)prefix_size + 1)))
+ if (NULL == (pre = (char *)HDmalloc(sizeof(char) * (size_t)prefix_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_efile_prefix: memory allocation failed");
if (H5Pget_efile_prefix((hid_t)dapl_id, (char *)pre, (size_t)prefix_size + 1) < 0)
@@ -159,7 +158,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, pre))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_efile_prefix: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY, "H5Pget_efile_prefix: out of memory - unable to construct string from UTF characters");
}
done:
@@ -175,11 +175,11 @@ done:
* Signature: (JI[JLjava/lang/Object;Ljava/lang/Object;)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1append_1flush
- (JNIEnv *env, jclass clss, jlong plist_id, jint ndims, jlongArray boundary, jobject callback_op, jobject op_data)
+Java_hdf_hdf5lib_H5_H5Pset_1append_1flush(JNIEnv *env, jclass clss, jlong plist_id, jint ndims,
+ jlongArray boundary, jobject callback_op, jobject op_data)
{
- cb_wrapper wrapper = { callback_op, op_data };
- herr_t status = FAIL;
+ cb_wrapper wrapper = {callback_op, op_data};
+ herr_t status = FAIL;
UNUSED(clss);
@@ -191,7 +191,8 @@ Java_hdf_hdf5lib_H5_H5Pset_1append_1flush
if (NULL == callback_op)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_append_flush: callback_op is NULL");
- if ((status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t *)boundary, (H5D_append_cb_t)H5D_append_cb, (void *)&wrapper)) < 0)
+ if ((status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t *)boundary,
+ (H5D_append_cb_t)H5D_append_cb, (void *)&wrapper)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -208,8 +209,7 @@ done:
* Signature: (JI)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view
- (JNIEnv *env, jclass clss, jlong dapl_id, jint view)
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view(JNIEnv *env, jclass clss, jlong dapl_id, jint view)
{
UNUSED(clss);
@@ -226,8 +226,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view
- (JNIEnv *env, jclass clss, jlong dapl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view(JNIEnv *env, jclass clss, jlong dapl_id)
{
H5D_vds_view_t virtual_view = H5D_VDS_ERROR;
@@ -246,8 +245,7 @@ done:
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap
- (JNIEnv *env, jclass clss, jlong dapl_id, jlong gap_size)
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap(JNIEnv *env, jclass clss, jlong dapl_id, jlong gap_size)
{
UNUSED(clss);
@@ -264,8 +262,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap
- (JNIEnv *env, jclass clss, jlong dapl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap(JNIEnv *env, jclass clss, jlong dapl_id)
{
hsize_t gap_size = 0;
@@ -279,17 +276,16 @@ done:
} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap */
static herr_t
-H5D_append_cb
- (hid_t dataset_id, hsize_t *cur_dims, void *cb_data)
+H5D_append_cb(hid_t dataset_id, hsize_t *cur_dims, void *cb_data)
{
cb_wrapper *wrapper = (cb_wrapper *)cb_data;
jlongArray cur_dimsArray;
jmethodID mid;
jobject visit_callback = wrapper->visit_callback;
jclass cls;
- JNIEnv *cbenv = NULL;
- void *op_data = (void *)wrapper->op_data;
- jint status = -1;
+ JNIEnv * cbenv = NULL;
+ void * op_data = (void *)wrapper->op_data;
+ jint status = -1;
if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
@@ -299,7 +295,8 @@ H5D_append_cb
if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(J[JLhdf/hdf5lib/callbacks/H5D_append_t;)I")))
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback",
+ "(J[JLhdf/hdf5lib/callbacks/H5D_append_t;)I")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
if (NULL != cur_dims) {
diff --git a/java/src/jni/h5pDAPLImp.h b/java/src/jni/h5pDAPLImp.h
index a9fbadd..85238e1 100644
--- a/java/src/jni/h5pDAPLImp.h
+++ b/java/src/jni/h5pDAPLImp.h
@@ -25,45 +25,38 @@ extern "C" {
* Method: H5Pset_chunk_cache
* Signature: (JJJD)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache
-(JNIEnv *, jclass, jlong, jlong, jlong, jdouble);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache(JNIEnv *, jclass, jlong, jlong, jlong,
+ jdouble);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_chunk_cache
* Signature: (J[J[J[D)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache
-(JNIEnv *, jclass, jlong, jlongArray, jlongArray, jdoubleArray);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache(JNIEnv *, jclass, jlong, jlongArray,
+ jlongArray, jdoubleArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_efile_prefix
* Signature: (JLjava/lang/String;)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix
-(JNIEnv *, jclass, jlong, jstring);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_efile_prefix
* Signature: (J)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_append_flush
* Signature: (JI[JLjava/lang/Object;Ljava/lang/Object;)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1append_1flush
- (JNIEnv*, jclass, jlong, jint, jlongArray, jobject, jobject);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1append_1flush(JNIEnv *, jclass, jlong, jint, jlongArray,
+ jobject, jobject);
/*
* TODO: H5Pget_append_flush
@@ -74,36 +67,28 @@ Java_hdf_hdf5lib_H5_H5Pset_1append_1flush
* Method: H5Pset_virtual_view
* Signature: (JI)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_virtual_view
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_virtual_printf_gap
* Signature: (JJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_virtual_printf_gap
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap(JNIEnv *, jclass, jlong);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5pDCPLImp.c b/java/src/jni/h5pDCPLImp.c
index f5bbcb1..df9c4eb 100644
--- a/java/src/jni/h5pDCPLImp.c
+++ b/java/src/jni/h5pDCPLImp.c
@@ -37,8 +37,7 @@ extern "C" {
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1layout
- (JNIEnv *env, jclass clss, jlong plist, jint layout)
+Java_hdf_hdf5lib_H5_H5Pset_1layout(JNIEnv *env, jclass clss, jlong plist, jint layout)
{
herr_t retVal = FAIL;
@@ -57,8 +56,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1layout
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5_H5Pget_1layout(JNIEnv *env, jclass clss, jlong plist)
{
H5D_layout_t retVal = H5D_LAYOUT_ERROR;
@@ -77,18 +75,17 @@ done:
* Signature: (JI[B)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1chunk
- (JNIEnv *env, jclass clss, jlong plist, jint ndims, jbyteArray dim)
+Java_hdf_hdf5lib_H5_H5Pset_1chunk(JNIEnv *env, jclass clss, jlong plist, jint ndims, jbyteArray dim)
{
- jboolean isCopy;
- hsize_t *da = NULL;
- hsize_t *lp = NULL;
- size_t i;
- size_t rank;
- jsize arrLen;
- jbyte *theArray = NULL;
- jlong *jlp = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ hsize_t *da = NULL;
+ hsize_t *lp = NULL;
+ size_t i;
+ size_t rank;
+ jsize arrLen;
+ jbyte * theArray = NULL;
+ jlong * jlp = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -102,13 +99,13 @@ Java_hdf_hdf5lib_H5_H5Pset_1chunk
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_chunk: dim array length < 0");
}
- rank = (size_t) arrLen / sizeof(jlong);
- if (rank < (size_t) ndims)
+ rank = (size_t)arrLen / sizeof(jlong);
+ if (rank < (size_t)ndims)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_chunk: dims array rank < ndims");
PIN_BYTE_ARRAY(ENVONLY, dim, theArray, &isCopy, "H5Pset_chunk: dim array not pinned");
- if (NULL == (da = lp = (hsize_t *) HDmalloc(rank * sizeof(hsize_t))))
+ if (NULL == (da = lp = (hsize_t *)HDmalloc(rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pset_chunk: memory allocation failed");
jlp = (jlong *)theArray;
@@ -136,15 +133,14 @@ done:
* Signature: (JI[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1chunk
- (JNIEnv *env, jclass clss, jlong plist, jint max_ndims, jlongArray dims)
+Java_hdf_hdf5lib_H5_H5Pget_1chunk(JNIEnv *env, jclass clss, jlong plist, jint max_ndims, jlongArray dims)
{
- jboolean isCopy;
- hsize_t *da = NULL;
- jlong *theArray = NULL;
- jsize arrLen;
- int i;
- herr_t status = FAIL;
+ jboolean isCopy;
+ hsize_t *da = NULL;
+ jlong * theArray = NULL;
+ jsize arrLen;
+ int i;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -160,7 +156,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1chunk
PIN_LONG_ARRAY(ENVONLY, dims, theArray, &isCopy, "H5Pget_chunk: input dims not pinned");
- if (NULL == (da = (hsize_t *) HDmalloc((size_t)max_ndims * sizeof(hsize_t))))
+ if (NULL == (da = (hsize_t *)HDmalloc((size_t)max_ndims * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_chunk: memory allocation failed");
if ((status = H5Pget_chunk((hid_t)plist, (int)max_ndims, da)) < 0)
@@ -184,8 +180,7 @@ done:
* Signature: (JI)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts
- (JNIEnv *env, jclass clss, jlong dcpl_id, jint opts)
+Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts(JNIEnv *env, jclass clss, jlong dcpl_id, jint opts)
{
herr_t retVal = FAIL;
@@ -204,8 +199,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts
- (JNIEnv *env, jclass clss, jlong dcpl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts(JNIEnv *env, jclass clss, jlong dcpl_id)
{
unsigned opts = 0;
@@ -224,8 +218,7 @@ done:
* Signature: (JZ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1dset_1no_1attrs_1hint
-(JNIEnv *env, jclass clss, jlong dcpl_id, jboolean minimize)
+Java_hdf_hdf5lib_H5_H5Pset_1dset_1no_1attrs_1hint(JNIEnv *env, jclass clss, jlong dcpl_id, jboolean minimize)
{
hbool_t minimize_val;
herr_t retVal = FAIL;
@@ -247,11 +240,10 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1dset_1no_1attrs_1hint
-(JNIEnv *env, jclass clss, jlong dcpl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1dset_1no_1attrs_1hint(JNIEnv *env, jclass clss, jlong dcpl_id)
{
hbool_t minimize = FALSE;
- jboolean bval = JNI_FALSE;
+ jboolean bval = JNI_FALSE;
UNUSED(clss);
@@ -271,8 +263,7 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1deflate
- (JNIEnv *env, jclass clss, jlong plist, jint level)
+Java_hdf_hdf5lib_H5_H5Pset_1deflate(JNIEnv *env, jclass clss, jlong plist, jint level)
{
herr_t retVal = FAIL;
@@ -291,12 +282,12 @@ done:
* Signature: (JJ[B)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fill_1value
- (JNIEnv *env, jclass clss, jlong plist_id, jlong type_id, jbyteArray value)
+Java_hdf_hdf5lib_H5_H5Pset_1fill_1value(JNIEnv *env, jclass clss, jlong plist_id, jlong type_id,
+ jbyteArray value)
{
- jboolean isCopy;
- jbyte *byteP = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jbyte * byteP = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -324,12 +315,12 @@ done:
* Signature: (JJ[B)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fill_1value
- (JNIEnv *env, jclass clss, jlong plist_id, jlong type_id, jbyteArray value)
+Java_hdf_hdf5lib_H5_H5Pget_1fill_1value(JNIEnv *env, jclass clss, jlong plist_id, jlong type_id,
+ jbyteArray value)
{
- jboolean isCopy;
- herr_t status = FAIL;
- jbyte *byteP = NULL;
+ jboolean isCopy;
+ herr_t status = FAIL;
+ jbyte * byteP = NULL;
UNUSED(clss);
@@ -354,13 +345,12 @@ done:
* Signature: (J[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined
- (JNIEnv *env, jclass clss, jlong plist, jintArray status)
+Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined(JNIEnv *env, jclass clss, jlong plist, jintArray status)
{
- H5D_fill_value_t value = H5D_FILL_VALUE_ERROR;
- jboolean isCopy;
- jint *theArray = NULL;
- herr_t retVal = FAIL;
+ H5D_fill_value_t value = H5D_FILL_VALUE_ERROR;
+ jboolean isCopy;
+ jint * theArray = NULL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -387,8 +377,7 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fill_1time
- (JNIEnv *env, jclass clss, jlong plist, jint fill_time)
+Java_hdf_hdf5lib_H5_H5Pset_1fill_1time(JNIEnv *env, jclass clss, jlong plist, jint fill_time)
{
herr_t retVal = FAIL;
@@ -407,13 +396,12 @@ done:
* Signature: (J[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fill_1time
- (JNIEnv *env, jclass clss, jlong plist, jintArray fill_time)
+Java_hdf_hdf5lib_H5_H5Pget_1fill_1time(JNIEnv *env, jclass clss, jlong plist, jintArray fill_time)
{
- H5D_fill_time_t time = H5D_FILL_TIME_ERROR;
- jboolean isCopy;
- jint *theArray = NULL;
- herr_t retVal = FAIL;
+ H5D_fill_time_t time = H5D_FILL_TIME_ERROR;
+ jboolean isCopy;
+ jint * theArray = NULL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -440,8 +428,7 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time
- (JNIEnv *env, jclass clss, jlong plist, jint alloc_time)
+Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time(JNIEnv *env, jclass clss, jlong plist, jint alloc_time)
{
herr_t retVal = FAIL;
@@ -460,13 +447,12 @@ done:
* Signature: (J[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time
- (JNIEnv *env, jclass clss, jlong plist, jintArray alloc_time)
+Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time(JNIEnv *env, jclass clss, jlong plist, jintArray alloc_time)
{
- H5D_alloc_time_t time = H5D_ALLOC_TIME_ERROR;
- jboolean isCopy;
- jint *theArray = NULL;
- herr_t retVal = FAIL;
+ H5D_alloc_time_t time = H5D_ALLOC_TIME_ERROR;
+ jboolean isCopy;
+ jint * theArray = NULL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -475,7 +461,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time
PIN_INT_ARRAY(ENVONLY, alloc_time, theArray, &isCopy, "H5Pget_alloc_time: alloc_time not pinned");
- if ((retVal = H5Pget_alloc_time((hid_t)plist, &time)) < 0)
+ if ((retVal = H5Pget_alloc_time((hid_t)plist, &time)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
theArray[0] = time;
@@ -493,26 +479,25 @@ done:
* Signature: (JIIJ[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1filter
- (JNIEnv *env, jclass clss, jlong plist, jint filter, jint flags,
- jlong cd_nelmts, jintArray cd_values)
+Java_hdf_hdf5lib_H5_H5Pset_1filter(JNIEnv *env, jclass clss, jlong plist, jint filter, jint flags,
+ jlong cd_nelmts, jintArray cd_values)
{
- jboolean isCopy;
- jint *theArray = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jint * theArray = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
if (NULL == cd_values) {
- if ((status = H5Pset_filter((hid_t)plist, (H5Z_filter_t)filter,
- (unsigned int)flags, (size_t)cd_nelmts, NULL)) < 0)
+ if ((status = H5Pset_filter((hid_t)plist, (H5Z_filter_t)filter, (unsigned int)flags,
+ (size_t)cd_nelmts, NULL)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
}
else {
PIN_INT_ARRAY(ENVONLY, cd_values, theArray, &isCopy, "H5Pset_filter: input array not pinned");
- if ((status = H5Pset_filter((hid_t)plist, (H5Z_filter_t)filter,
- (unsigned int)flags, (size_t)cd_nelmts, (const unsigned int *)theArray)) < 0)
+ if ((status = H5Pset_filter((hid_t)plist, (H5Z_filter_t)filter, (unsigned int)flags,
+ (size_t)cd_nelmts, (const unsigned int *)theArray)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
}
@@ -529,8 +514,7 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail
- (JNIEnv *env, jclass clss, jlong dcpl_id)
+Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail(JNIEnv *env, jclass clss, jlong dcpl_id)
{
htri_t bval = JNI_FALSE;
@@ -551,8 +535,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1nfilters
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5_H5Pget_1nfilters(JNIEnv *env, jclass clss, jlong plist)
{
int retVal = -1;
@@ -571,17 +554,17 @@ done:
* Signature: (JI[I[J[IJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter
- (JNIEnv *env, jclass clss, jlong plist, jint filter_number, jintArray flags,
- jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name)
+Java_hdf_hdf5lib_H5_H5Pget_1filter(JNIEnv *env, jclass clss, jlong plist, jint filter_number, jintArray flags,
+ jlongArray cd_nelmts, jintArray cd_values, jlong namelen,
+ jobjectArray name)
{
- jboolean isCopy;
- jstring str;
- jint *flagsArray = NULL;
- jlong *cd_nelmtsArray = NULL;
- jint *cd_valuesArray = NULL;
- char *filter = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jstring str;
+ jint * flagsArray = NULL;
+ jlong * cd_nelmtsArray = NULL;
+ jint * cd_valuesArray = NULL;
+ char * filter = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -594,23 +577,22 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter
if (NULL == cd_values)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter: cd_values is NULL");
- if (NULL == (filter = (char *) HDmalloc(sizeof(char) * (size_t)namelen)))
+ if (NULL == (filter = (char *)HDmalloc(sizeof(char) * (size_t)namelen)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter: memory allocation failed");
PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter: flags array not pinned");
PIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, &isCopy, "H5Pget_filter: nelmts array not pinned");
PIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, &isCopy, "H5Pget_filter: elmts array not pinned");
-
/* direct cast (size_t *)variable fails on 32-bit environment */
{
unsigned int filter_config;
long long cd_nelmts_temp = *cd_nelmtsArray;
- size_t cd_nelmts_t = (size_t) cd_nelmts_temp;
+ size_t cd_nelmts_t = (size_t)cd_nelmts_temp;
- if ((status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number,
- (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
- (size_t)namelen, filter, &filter_config)) < 0)
+ if ((status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number, (unsigned int *)flagsArray,
+ &cd_nelmts_t, (unsigned int *)cd_valuesArray, (size_t)namelen, filter,
+ &filter_config)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
filter[namelen - 1] = '\0';
@@ -620,7 +602,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, filter))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY, "H5Pget_filter: out of memory - unable to construct string from UTF characters");
}
ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
@@ -645,19 +628,18 @@ done:
* Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter2
- (JNIEnv *env, jclass clss, jlong plist, jint filter_number,
- jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen,
- jobjectArray name, jintArray filter_config)
+Java_hdf_hdf5lib_H5_H5Pget_1filter2(JNIEnv *env, jclass clss, jlong plist, jint filter_number,
+ jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen,
+ jobjectArray name, jintArray filter_config)
{
- jboolean isCopy;
- jstring str;
- jint *flagsArray = NULL;
- jlong *cd_nelmtsArray = NULL;
- jint *cd_valuesArray = NULL;
- jint *filter_configArray = NULL;
- char *filter = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jstring str;
+ jint * flagsArray = NULL;
+ jlong * cd_nelmtsArray = NULL;
+ jint * cd_valuesArray = NULL;
+ jint * filter_configArray = NULL;
+ char * filter = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -670,21 +652,22 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter2
if (NULL == filter_config)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter2: filter_config is NULL");
- if (NULL == (filter = (char *) HDmalloc(sizeof(char) * (size_t)namelen)))
+ if (NULL == (filter = (char *)HDmalloc(sizeof(char) * (size_t)namelen)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter2: memory allocation failed");
PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter2: flags array not pinned");
PIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, &isCopy, "H5Pget_filter2: nelmts array not pinned");
- PIN_INT_ARRAY(ENVONLY, filter_config, filter_configArray, &isCopy, "H5Pget_filter2: filter_config array not pinned");
+ PIN_INT_ARRAY(ENVONLY, filter_config, filter_configArray, &isCopy,
+ "H5Pget_filter2: filter_config array not pinned");
if (NULL == cd_values && *cd_nelmtsArray == 0) {
/* direct cast (size_t *)variable fails on 32-bit environment */
long long cd_nelmts_temp = 0;
- size_t cd_nelmts_t = (size_t) cd_nelmts_temp;
+ size_t cd_nelmts_t = (size_t)cd_nelmts_temp;
- if ((status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number,
- (unsigned int *)flagsArray, &cd_nelmts_t, NULL,
- (size_t)namelen, filter, (unsigned int *)filter_configArray)) < 0)
+ if ((status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number, (unsigned int *)flagsArray,
+ &cd_nelmts_t, NULL, (size_t)namelen, filter,
+ (unsigned int *)filter_configArray)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
filter[namelen - 1] = '\0';
@@ -700,11 +683,11 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter2
{
/* direct cast (size_t *)variable fails on 32-bit environment */
long long cd_nelmts_temp = *cd_nelmtsArray;
- size_t cd_nelmts_t = (size_t) cd_nelmts_temp;
+ size_t cd_nelmts_t = (size_t)cd_nelmts_temp;
- if ((status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number,
- (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
- (size_t)namelen, filter, (unsigned int *)filter_configArray)) < 0)
+ if ((status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number, (unsigned int *)flagsArray,
+ &cd_nelmts_t, (unsigned int *)cd_valuesArray, (size_t)namelen,
+ filter, (unsigned int *)filter_configArray)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
filter[namelen - 1] = '\0';
@@ -715,7 +698,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter2
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, filter))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter2: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY, "H5Pget_filter2: out of memory - unable to construct string from UTF characters");
}
ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
@@ -742,19 +726,19 @@ done:
* Signature: (JI[I[J[IJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id
- (JNIEnv *env, jclass clss, jlong plist, jint filter,
- jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name)
+Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id(JNIEnv *env, jclass clss, jlong plist, jint filter,
+ jintArray flags, jlongArray cd_nelmts, jintArray cd_values,
+ jlong namelen, jobjectArray name)
{
- jboolean isCopy;
- jstring str;
- jlong *cd_nelmtsArray = NULL;
- jint *cd_valuesArray = NULL;
- jint *flagsArray = NULL;
- char *aName = NULL;
- long bs;
- int rank;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jstring str;
+ jlong * cd_nelmtsArray = NULL;
+ jint * cd_valuesArray = NULL;
+ jint * flagsArray = NULL;
+ char * aName = NULL;
+ long bs;
+ int rank;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -771,12 +755,13 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id
if (NULL == name)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id: name is NULL");
- if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)bs)))
+ if (NULL == (aName = (char *)HDmalloc(sizeof(char) * (size_t)bs)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter_by_id: memory allocation failed");
PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter_by_id: flags not pinned");
PIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, &isCopy, "H5Pget_filter_by_id: cd_nelms not pinned");
- PIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, &isCopy, "H5Pget_filter_by_id: cd_values array not pinned");
+ PIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, &isCopy,
+ "H5Pget_filter_by_id: cd_values array not pinned");
if ((rank = ENVPTR->GetArrayLength(ENVONLY, cd_values)) < 0) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
@@ -787,11 +772,11 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id
/* direct cast (size_t *)variable fails on 32-bit environment */
unsigned int filter_config;
long long cd_nelmts_temp = *cd_nelmtsArray;
- size_t cd_nelmts_t = (size_t) cd_nelmts_temp;
+ size_t cd_nelmts_t = (size_t)cd_nelmts_temp;
- if ((status = H5Pget_filter_by_id2((hid_t)plist, (H5Z_filter_t)filter,
- (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
- (size_t)namelen, (char *)aName, &filter_config)) < 0)
+ if ((status = H5Pget_filter_by_id2((hid_t)plist, (H5Z_filter_t)filter, (unsigned int *)flagsArray,
+ &cd_nelmts_t, (unsigned int *)cd_valuesArray, (size_t)namelen,
+ (char *)aName, &filter_config)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
aName[bs - 1] = '\0';
@@ -801,7 +786,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter_by_id: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY, "H5Pget_filter_by_id: out of memory - unable to construct string from UTF characters");
}
ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
@@ -826,19 +812,19 @@ done:
* Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2
- (JNIEnv *env, jclass clss, jlong plist, jint filter,
- jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name, jintArray filter_config)
+Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2(JNIEnv *env, jclass clss, jlong plist, jint filter,
+ jintArray flags, jlongArray cd_nelmts, jintArray cd_values,
+ jlong namelen, jobjectArray name, jintArray filter_config)
{
- jboolean isCopy;
- jstring str;
- jlong *cd_nelmtsArray = NULL;
- jint *cd_valuesArray = NULL;
- jint *flagsArray = NULL;
- jint *filter_configArray = NULL;
- long bs;
- char *aName = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jstring str;
+ jlong * cd_nelmtsArray = NULL;
+ jint * cd_valuesArray = NULL;
+ jint * flagsArray = NULL;
+ jint * filter_configArray = NULL;
+ long bs;
+ char * aName = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -857,22 +843,24 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2
if (NULL == filter_config)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id2: filter_config is NULL");
- if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)bs)))
+ if (NULL == (aName = (char *)HDmalloc(sizeof(char) * (size_t)bs)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter_by_id2: memory allocation failed");
PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter_by_id2: flags not pinned");
PIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, &isCopy, "H5Pget_filter_by_id2: cd_nelms not pinned");
- PIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, &isCopy, "H5Pget_filter_by_id2: cd_values array not pinned");
- PIN_INT_ARRAY(ENVONLY, filter_config, filter_configArray, &isCopy, "H5Pget_filter_by_id2: filter_config not pinned");
+ PIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, &isCopy,
+ "H5Pget_filter_by_id2: cd_values array not pinned");
+ PIN_INT_ARRAY(ENVONLY, filter_config, filter_configArray, &isCopy,
+ "H5Pget_filter_by_id2: filter_config not pinned");
{
/* direct cast (size_t *)variable fails on 32-bit environment */
long long cd_nelmts_temp = *cd_nelmtsArray;
- size_t cd_nelmts_t = (size_t) cd_nelmts_temp;
+ size_t cd_nelmts_t = (size_t)cd_nelmts_temp;
- if ((status = H5Pget_filter_by_id2((hid_t)plist, (H5Z_filter_t)filter,
- (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
- (size_t)namelen, (char *)aName, (unsigned int *)filter_configArray)) < 0)
+ if ((status = H5Pget_filter_by_id2((hid_t)plist, (H5Z_filter_t)filter, (unsigned int *)flagsArray,
+ &cd_nelmts_t, (unsigned int *)cd_valuesArray, (size_t)namelen,
+ (char *)aName, (unsigned int *)filter_configArray)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
aName[bs - 1] = '\0';
@@ -882,7 +870,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter_by_id2: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY, "H5Pget_filter_by_id2: out of memory - unable to construct string from UTF characters");
}
ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
@@ -909,13 +898,12 @@ done:
* Signature: (JIIJ[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pmodify_1filter
- (JNIEnv *env, jclass clss, jlong plist, jint filter,
- jint flags, jlong cd_nelmts, jintArray cd_values)
+Java_hdf_hdf5lib_H5_H5Pmodify_1filter(JNIEnv *env, jclass clss, jlong plist, jint filter, jint flags,
+ jlong cd_nelmts, jintArray cd_values)
{
- jboolean isCopy;
- jint *cd_valuesP = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jint * cd_valuesP = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -925,7 +913,7 @@ Java_hdf_hdf5lib_H5_H5Pmodify_1filter
PIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesP, &isCopy, "H5Pmodify_filter: cd_values not pinned");
if ((status = H5Pmodify_filter((hid_t)plist, (H5Z_filter_t)filter, (const unsigned int)flags,
- (size_t)cd_nelmts, (unsigned int *)cd_valuesP)) < 0)
+ (size_t)cd_nelmts, (unsigned int *)cd_valuesP)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -941,8 +929,7 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5P1remove_1filter
- (JNIEnv *env, jclass clss, jlong obj_id, jint filter)
+Java_hdf_hdf5lib_H5_H5P1remove_1filter(JNIEnv *env, jclass clss, jlong obj_id, jint filter)
{
herr_t status = FAIL;
@@ -961,8 +948,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fletcher32
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5_H5Pset_1fletcher32(JNIEnv *env, jclass clss, jlong plist)
{
herr_t retVal = FAIL;
@@ -981,8 +967,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1nbit
- (JNIEnv *env, jclass clss, jlong plist_id)
+Java_hdf_hdf5lib_H5_H5Pset_1nbit(JNIEnv *env, jclass clss, jlong plist_id)
{
herr_t retVal = FAIL;
@@ -1001,8 +986,8 @@ done:
* Signature: (JII)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset
- (JNIEnv *env, jclass clss, jlong plist_id, jint scale_type, jint scale_factor)
+Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset(JNIEnv *env, jclass clss, jlong plist_id, jint scale_type,
+ jint scale_factor)
{
herr_t retVal = FAIL;
@@ -1026,8 +1011,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shuffle
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5_H5Pset_1shuffle(JNIEnv *env, jclass clss, jlong plist)
{
herr_t retVal = FAIL;
@@ -1046,8 +1030,8 @@ done:
* Signature: (JII)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1szip
- (JNIEnv *env, jclass clss, jlong plist, jint options_mask, jint pixels_per_block)
+Java_hdf_hdf5lib_H5_H5Pset_1szip(JNIEnv *env, jclass clss, jlong plist, jint options_mask,
+ jint pixels_per_block)
{
herr_t retVal = FAIL;
@@ -1066,11 +1050,11 @@ done:
* Signature: (JLjava/lang/String;JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1external
- (JNIEnv *env, jclass clss, jlong plist, jstring name, jlong offset, jlong size)
+Java_hdf_hdf5lib_H5_H5Pset_1external(JNIEnv *env, jclass clss, jlong plist, jstring name, jlong offset,
+ jlong size)
{
const char *fileName = NULL;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1095,18 +1079,17 @@ done:
* Signature: (JIJ[Ljava/lang/String;[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1external
- (JNIEnv *env, jclass clss, jlong plist, jint idx, jlong name_size,
- jobjectArray name, jlongArray size)
+Java_hdf_hdf5lib_H5_H5Pget_1external(JNIEnv *env, jclass clss, jlong plist, jint idx, jlong name_size,
+ jobjectArray name, jlongArray size)
{
- jboolean isCopy;
- jstring str;
- hsize_t s;
- off_t o;
- jsize arrLen;
- jlong *theArray = NULL;
- char *file = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jstring str;
+ hsize_t s;
+ off_t o;
+ jsize arrLen;
+ jlong * theArray = NULL;
+ char * file = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1121,11 +1104,11 @@ Java_hdf_hdf5lib_H5_H5Pget_1external
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_external: size input array < 2");
if (name_size > 0)
- if (NULL == (file = (char *) HDmalloc(sizeof(char) * (size_t)name_size)))
+ if (NULL == (file = (char *)HDmalloc(sizeof(char) * (size_t)name_size)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_external: memory allocation failed");
- if ((status = H5Pget_external((hid_t) plist, (unsigned)idx, (size_t)name_size,
- file, (off_t *)&o, (hsize_t *)&s)) < 0)
+ if ((status = H5Pget_external((hid_t)plist, (unsigned)idx, (size_t)name_size, file, (off_t *)&o,
+ (hsize_t *)&s)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if (NULL != size) {
@@ -1140,7 +1123,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1external
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, file))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_external: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY, "H5Pget_external: out of memory - unable to construct string from UTF characters");
}
ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
@@ -1162,8 +1146,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1external_1count
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5_H5Pget_1external_1count(JNIEnv *env, jclass clss, jlong plist)
{
int retVal = -1;
@@ -1182,12 +1165,11 @@ done:
* Signature: (JJLjava/lang/String;Ljava/lang/String;J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual
- (JNIEnv *env, jclass clss, jlong dcpl_id, jlong vspace_id,
- jstring src_file_name, jstring src_dset_name, jlong src_space_id)
+Java_hdf_hdf5lib_H5_H5Pset_1virtual(JNIEnv *env, jclass clss, jlong dcpl_id, jlong vspace_id,
+ jstring src_file_name, jstring src_dset_name, jlong src_space_id)
{
- const char *fstr = NULL;
- const char *dstr = NULL;
+ const char *fstr = NULL;
+ const char *dstr = NULL;
herr_t retVal = FAIL;
UNUSED(clss);
@@ -1216,8 +1198,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count
- (JNIEnv *env, jclass clss, jlong dcpl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count(JNIEnv *env, jclass clss, jlong dcpl_id)
{
size_t s = 0;
@@ -1236,29 +1217,30 @@ done:
* Signature: (JJ)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname
- (JNIEnv *env, jclass clss, jlong dcpl_id, jlong idx)
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname(JNIEnv *env, jclass clss, jlong dcpl_id, jlong idx)
{
- ssize_t buf_size;
- char *dname = NULL;
- jstring str = NULL;
+ ssize_t buf_size;
+ char * dname = NULL;
+ jstring str = NULL;
UNUSED(clss);
/* get the length of the filename */
- if ((buf_size = H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t) idx, NULL, 0)) < 0)
+ if ((buf_size = H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)idx, NULL, 0)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (dname = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ if (NULL == (dname = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_dsetname: memory allocation failed");
- if (H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t) idx, dname, (size_t)buf_size + 1) < 0)
+ if (H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)idx, dname, (size_t)buf_size + 1) < 0)
H5_LIBRARY_ERROR(ENVONLY);
dname[buf_size] = '\0';
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, dname))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_dsetname: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY,
+ "H5Pget_virtual_dsetname: out of memory - unable to construct string from UTF characters");
}
done:
@@ -1274,29 +1256,30 @@ done:
* Signature: (JJ)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename
- (JNIEnv *env, jclass clss, jlong dcpl_id, jlong idx)
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename(JNIEnv *env, jclass clss, jlong dcpl_id, jlong idx)
{
- ssize_t buf_size;
- char *fname = NULL;
- jstring str = NULL;
+ ssize_t buf_size;
+ char * fname = NULL;
+ jstring str = NULL;
UNUSED(clss);
/* get the length of the filename */
- if ((buf_size = H5Pget_virtual_filename((hid_t)dcpl_id, (size_t) idx, NULL, 0)) < 0)
+ if ((buf_size = H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)idx, NULL, 0)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (fname = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ if (NULL == (fname = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_filename: memory allocation failed");
- if (H5Pget_virtual_filename((hid_t)dcpl_id, (size_t) idx, fname, (size_t)buf_size + 1) < 0)
+ if (H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)idx, fname, (size_t)buf_size + 1) < 0)
H5_LIBRARY_ERROR(ENVONLY);
fname[buf_size] = '\0';
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, fname))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_filename: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY,
+ "H5Pget_virtual_filename: out of memory - unable to construct string from UTF characters");
}
done:
@@ -1312,14 +1295,13 @@ done:
* Signature: (JJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace
- (JNIEnv *env, jclass clss, jlong dcpl_id, jlong idx)
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace(JNIEnv *env, jclass clss, jlong dcpl_id, jlong idx)
{
hid_t space_id = H5I_INVALID_HID;
UNUSED(clss);
- if ((space_id = H5Pget_virtual_srcspace((hid_t)dcpl_id, (size_t) idx)) < 0)
+ if ((space_id = H5Pget_virtual_srcspace((hid_t)dcpl_id, (size_t)idx)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -1332,14 +1314,13 @@ done:
* Signature: (JJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace
- (JNIEnv *env, jclass clss, jlong dcpl_id, jlong idx)
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace(JNIEnv *env, jclass clss, jlong dcpl_id, jlong idx)
{
hid_t space_id = H5I_INVALID_HID;
UNUSED(clss);
- if ((space_id = H5Pget_virtual_vspace((hid_t)dcpl_id, (size_t) idx)) < 0)
+ if ((space_id = H5Pget_virtual_vspace((hid_t)dcpl_id, (size_t)idx)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -1352,11 +1333,10 @@ done:
* Signature: (JLjava/lang/String;)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix
- (JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix)
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix(JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix)
{
const char *virtPrefix = NULL;
- herr_t retVal = FAIL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -1379,28 +1359,28 @@ done:
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix
- (JNIEnv *env, jclass clss, jlong dapl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix(JNIEnv *env, jclass clss, jlong dapl_id)
{
- ssize_t prefix_size = -1;
- char *pre = NULL;
- jstring str = NULL;
+ ssize_t prefix_size = -1;
+ char * pre = NULL;
+ jstring str = NULL;
UNUSED(clss);
if ((prefix_size = H5Pget_virtual_prefix((hid_t)dapl_id, (char *)NULL, 0)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (pre = (char *) HDmalloc(sizeof(char) * (size_t) prefix_size + 1)))
+ if (NULL == (pre = (char *)HDmalloc(sizeof(char) * (size_t)prefix_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_prefix: memory allocation failed");
- if (H5Pget_virtual_prefix((hid_t)dapl_id, (char *)pre, (size_t) prefix_size + 1) < 0)
+ if (H5Pget_virtual_prefix((hid_t)dapl_id, (char *)pre, (size_t)prefix_size + 1) < 0)
H5_LIBRARY_ERROR(ENVONLY);
pre[prefix_size] = '\0';
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, pre))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_prefix: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY, "H5Pget_virtual_prefix: out of memory - unable to construct string from UTF characters");
}
done:
diff --git a/java/src/jni/h5pDCPLImp.h b/java/src/jni/h5pDCPLImp.h
index 6e5c225..3a6a088 100644
--- a/java/src/jni/h5pDCPLImp.h
+++ b/java/src/jni/h5pDCPLImp.h
@@ -25,369 +25,297 @@ extern "C" {
* Method: H5Pset_layout
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1layout
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1layout(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_layout
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1layout
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1layout(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_chunk
* Signature: (JI[B)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1chunk
-(JNIEnv *, jclass, jlong, jint, jbyteArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1chunk(JNIEnv *, jclass, jlong, jint, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_chunk
* Signature: (JI[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1chunk
-(JNIEnv *, jclass, jlong, jint, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1chunk(JNIEnv *, jclass, jlong, jint, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_chunk_opts
* Signature: (JI)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_chunk_opts
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_dset_no_attrs_hint
* Signature: (JZ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1dset_1no_1attrs_1hint
- (JNIEnv *, jclass, jlong, jboolean);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1dset_1no_1attrs_1hint(JNIEnv *, jclass, jlong, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_dset_no_attrs_hint
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1dset_1no_1attrs_1hint
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1dset_1no_1attrs_1hint(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_deflate
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1deflate
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1deflate(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_fill_value
* Signature: (JJ[B)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fill_1value
-(JNIEnv *, jclass, jlong, jlong, jbyteArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fill_1value(JNIEnv *, jclass, jlong, jlong, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_fill_value
* Signature: (JJ[B)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fill_1value
-(JNIEnv *, jclass, jlong, jlong, jbyteArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fill_1value(JNIEnv *, jclass, jlong, jlong, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pfill_value_defined
* Signature: (J[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined
-(JNIEnv *, jclass, jlong, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined(JNIEnv *, jclass, jlong, jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_fill_time
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fill_1time
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fill_1time(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_fill_time
* Signature: (J[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fill_1time
-(JNIEnv *, jclass, jlong, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fill_1time(JNIEnv *, jclass, jlong, jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_alloc_time
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_alloc_time
* Signature: (J[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time
-(JNIEnv *, jclass, jlong, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time(JNIEnv *, jclass, jlong, jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_filter
* Signature: (JIIJ[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1filter
-(JNIEnv *, jclass, jlong, jint, jint, jlong, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1filter(JNIEnv *, jclass, jlong, jint, jint, jlong,
+ jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pall_filters_avail
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_nfilters
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1nfilters
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1nfilters(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_filter
* Signature: (JI[I[J[IJ[Ljava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter
-(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1filter(JNIEnv *, jclass, jlong, jint, jintArray,
+ jlongArray, jintArray, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_filter2
* Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter2
-(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1filter2(JNIEnv *, jclass, jlong, jint, jintArray,
+ jlongArray, jintArray, jlong, jobjectArray,
+ jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_filter_by_id
* Signature: (JI[I[J[IJ[Ljava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id
-(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id(JNIEnv *, jclass, jlong, jint, jintArray,
+ jlongArray, jintArray, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_filter_by_id2
* Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2
-(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2(JNIEnv *, jclass, jlong, jint, jintArray,
+ jlongArray, jintArray, jlong, jobjectArray,
+ jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pmodify_filter
* Signature: (JIIJ[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pmodify_1filter
-(JNIEnv *, jclass, jlong, jint, jint, jlong, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pmodify_1filter(JNIEnv *, jclass, jlong, jint, jint, jlong,
+ jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Premove_filter
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5P1remove_1filter
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5P1remove_1filter(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_fletcher32
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fletcher32
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fletcher32(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_nbit
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1nbit
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1nbit(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_scaleoffset
* Signature: (JII)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset
-(JNIEnv *, jclass, jlong, jint, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset(JNIEnv *, jclass, jlong, jint, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_shuffle
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shuffle
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1shuffle(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_szip
* Signature: (JII)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1szip
-(JNIEnv *, jclass, jlong, jint, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1szip(JNIEnv *, jclass, jlong, jint, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_external
* Signature: (JLjava/lang/String;JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1external
-(JNIEnv *, jclass, jlong, jstring, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1external(JNIEnv *, jclass, jlong, jstring, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_external
* Signature: (JIJ[Ljava/lang/String;[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1external
-(JNIEnv *, jclass, jlong, jint, jlong, jobjectArray, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1external(JNIEnv *, jclass, jlong, jint, jlong,
+ jobjectArray, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_external_count
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1external_1count
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1external_1count(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_virtual
* Signature: (JJLjava/lang/String;Ljava/lang/String;J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual
-(JNIEnv *, jclass, jlong, jlong, jstring, jstring, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1virtual(JNIEnv *, jclass, jlong, jlong, jstring, jstring,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_virtual_count
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_virtual_dsetname
* Signature: (JJ)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_virtual_filename
* Signature: (JJ)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_virtual_srcspace
* Signature: (JJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_virtual_vspace
* Signature: (JJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_virtual_prefix
* Signature: (JLjava/lang/String;)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix
-(JNIEnv *, jclass, jlong, jstring);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_virtual_prefix
* Signature: (J)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix(JNIEnv *, jclass, jlong);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5pDXPLImp.c b/java/src/jni/h5pDXPLImp.c
index 12e3367..f7f9f96 100644
--- a/java/src/jni/h5pDXPLImp.c
+++ b/java/src/jni/h5pDXPLImp.c
@@ -37,15 +37,15 @@ extern "C" {
* Signature: (JJ[B[B)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1buffer
- (JNIEnv *env, jclass clss, jlong plist, jlong size, jbyteArray tconv, jbyteArray bkg)
+Java_hdf_hdf5lib_H5_H5Pset_1buffer(JNIEnv *env, jclass clss, jlong plist, jlong size, jbyteArray tconv,
+ jbyteArray bkg)
{
#ifdef notdef
- jboolean isCopy;
- jbyte *tconvP = NULL;
- jbyte *bkgP = NULL;
+ jboolean isCopy;
+ jbyte * tconvP = NULL;
+ jbyte * bkgP = NULL;
#endif
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
#ifndef notdef
@@ -85,15 +85,14 @@ done:
* Signature: (J[B[B)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1buffer
- (JNIEnv *env, jclass clss, jlong plist, jbyteArray tconv, jbyteArray bkg)
+Java_hdf_hdf5lib_H5_H5Pget_1buffer(JNIEnv *env, jclass clss, jlong plist, jbyteArray tconv, jbyteArray bkg)
{
#ifdef notdef
- jboolean isCopy;
- jbyte *tconvP = NULL;
- jbyte *bkgP = NULL;
+ jboolean isCopy;
+ jbyte * tconvP = NULL;
+ jbyte * bkgP = NULL;
#endif
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
#ifndef notdef
@@ -135,8 +134,7 @@ done:
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size
- (JNIEnv *env, jclass clss, jlong plist, jlong size)
+Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size(JNIEnv *env, jclass clss, jlong plist, jlong size)
{
UNUSED(clss);
@@ -153,8 +151,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size(JNIEnv *env, jclass clss, jlong plist)
{
size_t size = 0;
@@ -173,10 +170,9 @@ done:
* Signature: (JZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1preserve
- (JNIEnv *env, jclass clss, jlong plist, jboolean status)
+Java_hdf_hdf5lib_H5_H5Pset_1preserve(JNIEnv *env, jclass clss, jlong plist, jboolean status)
{
- hbool_t st = JNI_FALSE;
+ hbool_t st = JNI_FALSE;
herr_t retVal = FAIL;
UNUSED(clss);
@@ -201,8 +197,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1preserve
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5_H5Pget_1preserve(JNIEnv *env, jclass clss, jlong plist)
{
herr_t retVal = FAIL;
@@ -221,8 +216,7 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1edc_1check
- (JNIEnv *env, jclass clss, jlong plist, jint check)
+Java_hdf_hdf5lib_H5_H5Pset_1edc_1check(JNIEnv *env, jclass clss, jlong plist, jint check)
{
herr_t retVal = FAIL;
@@ -241,8 +235,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1edc_1check
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5_H5Pget_1edc_1check(JNIEnv *env, jclass clss, jlong plist)
{
H5Z_EDC_t retVal = -1;
@@ -265,18 +258,18 @@ done:
* Signature: (JLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1data_1transform
- (JNIEnv *env, jclass clss, jlong plist_id, jstring expression)
+Java_hdf_hdf5lib_H5_H5Pset_1data_1transform(JNIEnv *env, jclass clss, jlong plist_id, jstring expression)
{
const char *express = NULL;
- herr_t retVal = FAIL;
+ herr_t retVal = FAIL;
UNUSED(clss);
if (NULL == expression)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_data_transform: data transform expression is NULL");
- PIN_JAVA_STRING(ENVONLY, expression, express, NULL, "H5Pset_data_transform: data transform expression not pinned");
+ PIN_JAVA_STRING(ENVONLY, expression, express, NULL,
+ "H5Pset_data_transform: data transform expression not pinned");
if ((retVal = H5Pset_data_transform((hid_t)plist_id, express)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -294,12 +287,12 @@ done:
* Signature: (J[Ljava/lang/String;J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1data_1transform
- (JNIEnv *env, jclass clss, jlong plist_id, jobjectArray expression, jlong size)
+Java_hdf_hdf5lib_H5_H5Pget_1data_1transform(JNIEnv *env, jclass clss, jlong plist_id, jobjectArray expression,
+ jlong size)
{
- jstring str = NULL;
- char *express = NULL;
- ssize_t express_size = -1;
+ jstring str = NULL;
+ char * express = NULL;
+ ssize_t express_size = -1;
UNUSED(clss);
@@ -309,7 +302,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1data_1transform
if ((express_size = H5Pget_data_transform((hid_t)plist_id, (char *)NULL, (size_t)size)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (express = (char *) HDmalloc(sizeof(char) * (size_t)express_size + 1)))
+ if (NULL == (express = (char *)HDmalloc(sizeof(char) * (size_t)express_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_data_transform: memory allocation failed");
if (H5Pget_data_transform((hid_t)plist_id, express, (size_t)express_size + 1) < 0)
@@ -318,7 +311,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1data_1transform
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, express))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_data_transform: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY, "H5Pget_data_transform: out of memory - unable to construct string from UTF characters");
}
ENVPTR->SetObjectArrayElement(ENVONLY, expression, 0, str);
@@ -345,8 +339,7 @@ done:
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size
- (JNIEnv *env, jclass clss, jlong plist, jlong vector_size)
+Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size(JNIEnv *env, jclass clss, jlong plist, jlong vector_size)
{
herr_t retVal = FAIL;
@@ -365,22 +358,22 @@ done:
* Signature: (J[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size
- (JNIEnv *env, jclass clss, jlong plist, jlongArray vector_size)
+Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size(JNIEnv *env, jclass clss, jlong plist, jlongArray vector_size)
{
- jboolean isCopy;
- size_t size;
- jlong *theArray = NULL;
- herr_t retVal = FAIL;
+ jboolean isCopy;
+ size_t size;
+ jlong * theArray = NULL;
+ herr_t retVal = FAIL;
UNUSED(clss);
if (NULL == vector_size)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_hyper_vector_size: vector_size is NULL");
- PIN_LONG_ARRAY(ENVONLY, vector_size, theArray, &isCopy, "H5Pget_hyper_vector_size: vector_size not pinned");
+ PIN_LONG_ARRAY(ENVONLY, vector_size, theArray, &isCopy,
+ "H5Pget_hyper_vector_size: vector_size not pinned");
- if ((retVal = H5Pget_hyper_vector_size((hid_t)plist, &size)) < 0)
+ if ((retVal = H5Pget_hyper_vector_size((hid_t)plist, &size)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
theArray[0] = (jlong)size;
@@ -398,14 +391,14 @@ done:
* Signature: (JDDD)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios
- (JNIEnv *env, jclass clss, jlong plist_id, jdouble left, jdouble middle, jdouble right)
+Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios(JNIEnv *env, jclass clss, jlong plist_id, jdouble left,
+ jdouble middle, jdouble right)
{
herr_t status = FAIL;
UNUSED(clss);
- if ((status = H5Pset_btree_ratios((hid_t)plist_id, (double)left,(double)middle, (double)right)) < 0)
+ if ((status = H5Pset_btree_ratios((hid_t)plist_id, (double)left, (double)middle, (double)right)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -418,15 +411,14 @@ done:
* Signature: (J[D[D[D)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios
- (JNIEnv *env, jclass clss, jlong plist_id, jdoubleArray left,
- jdoubleArray middle, jdoubleArray right)
+Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios(JNIEnv *env, jclass clss, jlong plist_id, jdoubleArray left,
+ jdoubleArray middle, jdoubleArray right)
{
- jboolean isCopy;
- jdouble *leftP = NULL;
- jdouble *middleP = NULL;
- jdouble *rightP = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jdouble *leftP = NULL;
+ jdouble *middleP = NULL;
+ jdouble *rightP = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -441,8 +433,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios
PIN_DOUBLE_ARRAY(ENVONLY, middle, middleP, &isCopy, "H5Pget_btree_ratios: middle array not pinned");
PIN_DOUBLE_ARRAY(ENVONLY, right, rightP, &isCopy, "H5Pget_btree_ratios: right array not pinned");
- if ((status = H5Pget_btree_ratios((hid_t)plist_id, (double *)leftP,
- (double *)middleP, (double *)rightP)) < 0)
+ if ((status =
+ H5Pget_btree_ratios((hid_t)plist_id, (double *)leftP, (double *)middleP, (double *)rightP)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
diff --git a/java/src/jni/h5pDXPLImp.h b/java/src/jni/h5pDXPLImp.h
index d62f9c5..9793ce7 100644
--- a/java/src/jni/h5pDXPLImp.h
+++ b/java/src/jni/h5pDXPLImp.h
@@ -25,72 +25,57 @@ extern "C" {
* Method: H5Pset_buffer
* Signature: (JJ[B[B)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1buffer
-(JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1buffer(JNIEnv *, jclass, jlong, jlong, jbyteArray,
+ jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_buffer
* Signature: (J[B[B)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1buffer
-(JNIEnv *, jclass, jlong, jbyteArray, jbyteArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1buffer(JNIEnv *, jclass, jlong, jbyteArray, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_buffer_size
* Signature: (JJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_buffer_size
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_preserve
* Signature: (JZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1preserve
-(JNIEnv *, jclass, jlong, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1preserve(JNIEnv *, jclass, jlong, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_preserve
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1preserve
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1preserve(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_edc_check
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1edc_1check
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1edc_1check(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_edc_check
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1edc_1check
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1edc_1check(JNIEnv *, jclass, jlong);
/*
* TODO: H5Pset_filter_callback
@@ -101,18 +86,15 @@ Java_hdf_hdf5lib_H5_H5Pget_1edc_1check
* Method: H5Pset_data_transform
* Signature: (JLjava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1data_1transform
-(JNIEnv *, jclass, jlong, jstring);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1data_1transform(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_data_transform
* Signature: (J[Ljava/lang/String;J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1data_1transform
-(JNIEnv *, jclass, jlong, jobjectArray, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1data_1transform(JNIEnv *, jclass, jlong, jobjectArray,
+ jlong);
/*
* TODO: H5Pset_type_conv_cb
@@ -127,36 +109,30 @@ Java_hdf_hdf5lib_H5_H5Pget_1data_1transform
* Method: H5Pset_hyper_vector_size
* Signature: (JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_hyper_vector_size
* Signature: (J[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size
-(JNIEnv *, jclass, jlong, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size(JNIEnv *, jclass, jlong, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_btree_ratios
* Signature: (JDDD)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios
-(JNIEnv *, jclass, jlong, jdouble, jdouble, jdouble);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios(JNIEnv *, jclass, jlong, jdouble, jdouble,
+ jdouble);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_btree_ratios
* Signature: (J[D[D[D)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios
-(JNIEnv *, jclass, jlong, jdoubleArray, jdoubleArray, jdoubleArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios(JNIEnv *, jclass, jlong, jdoubleArray,
+ jdoubleArray, jdoubleArray);
/*
* TODO: H5Pset_vlen_mem_manager
diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c
index dbfbb5a..0077df4 100644
--- a/java/src/jni/h5pFAPLImp.c
+++ b/java/src/jni/h5pFAPLImp.c
@@ -42,14 +42,13 @@ extern "C" {
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1driver
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5_H5Pget_1driver(JNIEnv *env, jclass clss, jlong plist)
{
hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
- if ((retVal = H5Pget_driver((hid_t) plist)) < 0)
+ if ((retVal = H5Pget_driver((hid_t)plist)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -66,8 +65,7 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree
- (JNIEnv *env, jclass clss, jlong plist, jint fc_degree)
+Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree(JNIEnv *env, jclass clss, jlong plist, jint fc_degree)
{
herr_t retVal = FAIL;
@@ -86,8 +84,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree(JNIEnv *env, jclass clss, jlong plist)
{
H5F_close_degree_t degree = H5F_CLOSE_DEFAULT;
@@ -106,8 +103,8 @@ done:
* Signature: (JJZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core
- (JNIEnv *env, jclass clss, jlong fapl_id, jlong increment, jboolean backing_store)
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core(JNIEnv *env, jclass clss, jlong fapl_id, jlong increment,
+ jboolean backing_store)
{
herr_t retVal = FAIL;
@@ -126,13 +123,13 @@ done:
* Signature: (J[J[Z)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core
- (JNIEnv *env, jclass clss, jlong fapl_id, jlongArray increment, jbooleanArray backing_store)
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core(JNIEnv *env, jclass clss, jlong fapl_id, jlongArray increment,
+ jbooleanArray backing_store)
{
jboolean isCopy;
jboolean *backArray = NULL;
- jlong *incArray = NULL;
- herr_t status = FAIL;
+ jlong * incArray = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -147,7 +144,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core
{
/* Direct cast (size_t *)variable fails on 32-bit environment */
long long inc_temp = *incArray;
- size_t inc_t = (size_t) inc_temp;
+ size_t inc_t = (size_t)inc_temp;
if ((status = H5Pget_fapl_core((hid_t)fapl_id, &inc_t, (hbool_t *)backArray)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -178,16 +175,16 @@ done:
* Signature: (JJJJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct
- (JNIEnv *env, jclass clss, jlong fapl_id, jlong alignment,
- jlong block_size, jlong cbuf_size)
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct(JNIEnv *env, jclass clss, jlong fapl_id, jlong alignment,
+ jlong block_size, jlong cbuf_size)
{
herr_t retVal = FAIL;
UNUSED(clss);
#ifdef H5_HAVE_DIRECT
- if ((retVal = H5Pset_fapl_direct((hid_t)fapl_id, (size_t)alignment, (size_t)block_size, (size_t)cbuf_size)) < 0)
+ if ((retVal = H5Pset_fapl_direct((hid_t)fapl_id, (size_t)alignment, (size_t)block_size,
+ (size_t)cbuf_size)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -208,18 +205,17 @@ done:
* Signature: (J[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct
- (JNIEnv *env, jclass clss, jlong fapl_id, jlongArray info)
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct(JNIEnv *env, jclass clss, jlong fapl_id, jlongArray info)
{
#ifdef H5_HAVE_DIRECT
- jboolean isCopy;
- jlong *theArray = NULL;
- size_t alignment = 0;
- size_t block_size = 0;
- size_t cbuf_size = 0;
- jsize arrLen;
+ jboolean isCopy;
+ jlong * theArray = NULL;
+ size_t alignment = 0;
+ size_t block_size = 0;
+ size_t cbuf_size = 0;
+ jsize arrLen;
#endif
- herr_t retVal = FAIL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -261,10 +257,10 @@ done:
* Signature: (JJJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family
- (JNIEnv *env, jclass clss, jlong plist, jlong memb_size, jlong memb_plist)
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family(JNIEnv *env, jclass clss, jlong plist, jlong memb_size,
+ jlong memb_plist)
{
- long ms = (long)memb_size;
+ long ms = (long)memb_size;
herr_t retVal = FAIL;
UNUSED(clss);
@@ -282,16 +278,16 @@ done:
* Signature: (J[J[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family
- (JNIEnv *env, jclass clss, jlong tid, jlongArray memb_size, jlongArray memb_plist)
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family(JNIEnv *env, jclass clss, jlong tid, jlongArray memb_size,
+ jlongArray memb_plist)
{
- jboolean isCopy;
- hsize_t *sa = NULL;
- size_t i;
- jlong *sizeArray = NULL;
- jlong *plistArray = NULL;
- jsize rank;
- herr_t status = FAIL;
+ jboolean isCopy;
+ hsize_t *sa = NULL;
+ size_t i;
+ jlong * sizeArray = NULL;
+ jlong * plistArray = NULL;
+ jsize rank;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -307,7 +303,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_family: memb_size array length < 0");
}
- if (NULL == (sa = (hsize_t *) HDmalloc((size_t) rank * sizeof(hsize_t))))
+ if (NULL == (sa = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_family: memory allocation failed");
PIN_LONG_ARRAY(ENVONLY, memb_plist, plistArray, &isCopy, "H5Pget_family: plistArray not pinned");
@@ -315,7 +311,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family
if ((status = H5Pget_fapl_family((hid_t)tid, sa, (hid_t *)plistArray)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- for (i = 0; i < (size_t) rank; i++)
+ for (i = 0; i < (size_t)rank; i++)
sizeArray[i] = (jlong)sa[i];
done:
@@ -335,8 +331,7 @@ done:
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1family_1offset
- (JNIEnv *env, jclass clss, jlong fapl_id, jlong offset)
+Java_hdf_hdf5lib_H5_H5Pset_1family_1offset(JNIEnv *env, jclass clss, jlong fapl_id, jlong offset)
{
herr_t retVal = FAIL;
@@ -355,8 +350,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1family_1offset
- (JNIEnv *env, jclass clss, jlong fapl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1family_1offset(JNIEnv *env, jclass clss, jlong fapl_id)
{
hsize_t offset = 0;
herr_t retVal = FAIL;
@@ -375,8 +369,7 @@ done:
* Signature: (J)Lhdf/hdf5lib/structs/H5FD_hdfs_fapl_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs
- (JNIEnv *env, jclass clss, jlong fapl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs(JNIEnv *env, jclass clss, jlong fapl_id)
{
#ifdef H5_HAVE_LIBHDFS
H5FD_hdfs_fapl_t fa;
@@ -387,7 +380,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs
jstring j_kerb_cache_path = NULL;
jint j_stream_buffer_size = 0;
#endif /* H5_HAVE_LIBHDFS */
- jobject ret_obj = NULL;
+ jobject ret_obj = NULL;
UNUSED(clss);
@@ -397,7 +390,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs
if (NULL == (j_namenode_name = ENVPTR->NewStringUTF(ENVONLY, fa.namenode_name))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create namenode_name string");
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "H5Pget_fapl_hdfs: out of memory - can't create namenode_name string");
}
args[0].l = j_namenode_name;
@@ -411,13 +405,15 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs
if (NULL == (j_kerb_cache_path = ENVPTR->NewStringUTF(ENVONLY, fa.kerberos_ticket_cache))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create kerberos_ticket_cache string");
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "H5Pget_fapl_hdfs: out of memory - can't create kerberos_ticket_cache string");
}
args[3].l = j_kerb_cache_path;
args[4].i = (jint)fa.stream_buffer_size;
- CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5FD_hdfs_fapl_t", "(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;I)V", args, ret_obj);
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5FD_hdfs_fapl_t",
+ "(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;I)V", args, ret_obj);
#else
UNUSED(fapl_id);
@@ -434,15 +430,14 @@ done:
* Signature: (JLhdf/hdf5lib/structs/H5FD_hdfs_fapl_t;)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs
- (JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config)
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs(JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config)
{
#ifdef H5_HAVE_LIBHDFS
- H5FD_hdfs_fapl_t instance;
- const char *str = NULL;
- jfieldID fid;
- jstring j_str;
- jclass cls;
+ H5FD_hdfs_fapl_t instance;
+ const char * str = NULL;
+ jfieldID fid;
+ jstring j_str;
+ jclass cls;
#endif /* H5_HAVE_LIBHDFS */
UNUSED(clss);
@@ -508,7 +503,8 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
if (j_str) {
- PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config kerberos_ticket_cache not pinned");
+ PIN_JAVA_STRING(ENVONLY, j_str, str, NULL,
+ "H5FDset_fapl_hdfs: fapl_config kerberos_ticket_cache not pinned");
HDstrncpy(instance.kerberos_ticket_cache, str, H5FD__HDFS_KERB_CACHE_PATH_SPACE + 1);
instance.kerberos_ticket_cache[H5FD__HDFS_KERB_CACHE_PATH_SPACE] = '\0';
@@ -526,7 +522,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
if (H5Pset_fapl_hdfs((hid_t)fapl_id, &instance) < 0)
- H5_LIBRARY_ERROR(ENVONLY);
+ H5_LIBRARY_ERROR(ENVONLY);
#else
UNUSED(fapl_id);
UNUSED(fapl_config);
@@ -548,11 +544,11 @@ done:
* Signature: (JLjava/lang/String;JJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log
- (JNIEnv *env, jclass clss, jlong fapl_id, jstring logfile, jlong flags, jlong buf_size)
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log(JNIEnv *env, jclass clss, jlong fapl_id, jstring logfile, jlong flags,
+ jlong buf_size)
{
const char *pLogfile = NULL;
- herr_t retVal = FAIL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -591,24 +587,24 @@ done:
* Signature: (J[I[J[Ljava/lang/String;[JZ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
- (JNIEnv *env, jclass clss, jlong tid, jintArray memb_map,
- jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr, jboolean relax)
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi(JNIEnv *env, jclass clss, jlong tid, jintArray memb_map,
+ jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr,
+ jboolean relax)
{
- const char * const *mName = NULL;
- const char *utf8 = NULL;
- jboolean isCopy;
- jboolean bb;
- jobject o;
- jstring rstring;
- jstring obj;
- jclass Sjc;
- size_t i;
- jlong *thefaplArray = NULL;
- jlong *theaddrArray = NULL;
- jint *themapArray = NULL;
- char *member_name[H5FD_MEM_NTYPES];
- herr_t status = FAIL;
+ const char *const *mName = NULL;
+ const char * utf8 = NULL;
+ jboolean isCopy;
+ jboolean bb;
+ jobject o;
+ jstring rstring;
+ jstring obj;
+ jclass Sjc;
+ size_t i;
+ jlong * thefaplArray = NULL;
+ jlong * theaddrArray = NULL;
+ jint * themapArray = NULL;
+ char * member_name[H5FD_MEM_NTYPES];
+ herr_t status = FAIL;
UNUSED(clss);
@@ -625,7 +621,8 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
for (i = 0; i < H5FD_MEM_NTYPES; i++) {
size_t str_len;
- if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray) memb_name, (jsize) i))) {
+ if (NULL ==
+ (obj = (jstring)ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)memb_name, (jsize)i))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
/*
@@ -644,7 +641,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
str_len = HDstrlen(utf8);
- if (NULL == (member_name[i] = (char *) HDmalloc(str_len + 1)))
+ if (NULL == (member_name[i] = (char *)HDmalloc(str_len + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pset_fapl_multi: memory allocation failed");
HDstrncpy(member_name[i], utf8, str_len + 1);
@@ -656,11 +653,11 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
ENVPTR->DeleteLocalRef(ENVONLY, obj);
}
- mName = (const char * const *)member_name;
+ mName = (const char *const *)member_name;
}
if ((status = H5Pset_fapl_multi((hid_t)tid, (const H5FD_mem_t *)themapArray, (const hid_t *)thefaplArray,
- mName, (const haddr_t *)theaddrArray, (hbool_t)relax)) < 0)
+ mName, (const haddr_t *)theaddrArray, (hbool_t)relax)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if (memb_name && mName) {
@@ -668,14 +665,17 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
for (i = 0; i < H5FD_MEM_NTYPES; i++) {
- if (!member_name[i]) continue;
+ if (!member_name[i])
+ continue;
if (NULL == (rstring = ENVPTR->NewStringUTF(ENVONLY, member_name[i]))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pset_fapl_multi: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY,
+ "H5Pset_fapl_multi: out of memory - unable to construct string from UTF characters");
}
- if (NULL == (o = ENVPTR->GetObjectArrayElement(ENVONLY, memb_name, (jsize) i))) {
+ if (NULL == (o = ENVPTR->GetObjectArrayElement(ENVONLY, memb_name, (jsize)i))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
/*
@@ -686,7 +686,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
}
if (JNI_TRUE == (bb = ENVPTR->IsInstanceOf(ENVONLY, o, Sjc))) {
- ENVPTR->SetObjectArrayElement(ENVONLY, memb_name, (jsize) i, (jobject)rstring);
+ ENVPTR->SetObjectArrayElement(ENVONLY, memb_name, (jsize)i, (jobject)rstring);
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
@@ -719,20 +719,19 @@ done:
* Signature: (J[I[J[Ljava/lang/String;[J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi
- (JNIEnv *env, jclass clss, jlong tid, jintArray memb_map,
- jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr)
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi(JNIEnv *env, jclass clss, jlong tid, jintArray memb_map,
+ jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr)
{
- jboolean isCopy;
- jstring str;
- herr_t status = FAIL;
- size_t i;
- jlong *thefaplArray = NULL;
- jlong *theaddrArray = NULL;
- jint *themapArray = NULL;
- char **mName = NULL;
- int relax = 0;
- int retVal = 0;
+ jboolean isCopy;
+ jstring str;
+ herr_t status = FAIL;
+ size_t i;
+ jlong * thefaplArray = NULL;
+ jlong * theaddrArray = NULL;
+ jint * themapArray = NULL;
+ char ** mName = NULL;
+ int relax = 0;
+ int retVal = 0;
UNUSED(clss);
@@ -743,11 +742,11 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi
if (memb_addr)
PIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, &isCopy, "H5Pget_fapl_multi: memb_addr not pinned");
if (memb_name)
- if (NULL == (mName = (char **) HDcalloc(H5FD_MEM_NTYPES, sizeof(*mName))))
+ if (NULL == (mName = (char **)HDcalloc(H5FD_MEM_NTYPES, sizeof(*mName))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_multi: memory allocation failed");
- if ((status = H5Pget_fapl_multi((hid_t)tid, (H5FD_mem_t *)themapArray, (hid_t *)thefaplArray,
- mName, (haddr_t *)theaddrArray, (hbool_t *)&relax)) < 0)
+ if ((status = H5Pget_fapl_multi((hid_t)tid, (H5FD_mem_t *)themapArray, (hid_t *)thefaplArray, mName,
+ (haddr_t *)theaddrArray, (hbool_t *)&relax)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if (memb_name && mName) {
@@ -755,10 +754,12 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi
if (mName[i]) {
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, mName[i]))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_multi: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY,
+ "H5Pget_fapl_multi: out of memory - unable to construct string from UTF characters");
}
- ENVPTR->SetObjectArrayElement(ENVONLY, memb_name, (jsize) i, (jobject)str);
+ ENVPTR->SetObjectArrayElement(ENVONLY, memb_name, (jsize)i, (jobject)str);
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
ENVPTR->DeleteLocalRef(ENVONLY, str);
@@ -794,17 +795,16 @@ done:
* Signature: (J)Lhdf/hdf5lib/structs/H5FD_ros3_fapl_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3
- (JNIEnv *env, jclass clss, jlong fapl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3(JNIEnv *env, jclass clss, jlong fapl_id)
{
#ifdef H5_HAVE_ROS3_VFD
H5FD_ros3_fapl_t fa;
jvalue args[3];
- jstring j_aws = NULL;
- jstring j_id = NULL;
- jstring j_key = NULL;
+ jstring j_aws = NULL;
+ jstring j_id = NULL;
+ jstring j_key = NULL;
#endif /* H5_HAVE_ROS3_VFD */
- jobject ret_obj = NULL;
+ jobject ret_obj = NULL;
UNUSED(clss);
@@ -832,7 +832,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3
}
args[2].l = j_key;
- CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5FD_ros3_fapl_t", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", args, ret_obj);
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5FD_ros3_fapl_t",
+ "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", args, ret_obj);
#else
UNUSED(fapl_id);
@@ -849,15 +850,14 @@ done:
* Signature: (JLhdf/hdf5lib/structs/H5FD_ros3_fapl_t;)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3
- (JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config)
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3(JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config)
{
#ifdef H5_HAVE_ROS3_VFD
- H5FD_ros3_fapl_t instance;
- const char *str = NULL;
- jfieldID fid;
- jstring j_str;
- jclass cls;
+ H5FD_ros3_fapl_t instance;
+ const char * str = NULL;
+ jfieldID fid;
+ jstring j_str;
+ jclass cls;
#endif /* H5_HAVE_ROS3_VFD */
UNUSED(clss);
@@ -928,7 +928,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3
else
HDmemset(instance.secret_key, 0, H5FD_ROS3_MAX_SECRET_KEY_LEN + 1);
- if (instance.aws_region[0] != '\0' && instance.secret_id[0] !='\0' && instance.secret_key[0] !='\0')
+ if (instance.aws_region[0] != '\0' && instance.secret_id[0] != '\0' && instance.secret_key[0] != '\0')
instance.authenticate = TRUE;
if (H5Pset_fapl_ros3((hid_t)fapl_id, &instance) < 0)
@@ -954,11 +954,11 @@ done:
* Signature: (JLjava/lang/String;JLjava/lang/String;J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split
- (JNIEnv *env, jclass clss, jlong fapl_id, jstring metaext, jlong meta_pl_id, jstring rawext, jlong raw_pl_id)
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split(JNIEnv *env, jclass clss, jlong fapl_id, jstring metaext,
+ jlong meta_pl_id, jstring rawext, jlong raw_pl_id)
{
- const char *mstr = NULL;
- const char *rstr = NULL;
+ const char *mstr = NULL;
+ const char *rstr = NULL;
herr_t retVal = FAIL;
UNUSED(clss);
@@ -987,14 +987,13 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2
- (JNIEnv *env, jclass clss, jlong fapl_id)
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2(JNIEnv *env, jclass clss, jlong fapl_id)
{
herr_t retVal = FAIL;
UNUSED(clss);
- if ((retVal = H5Pset_fapl_sec2((hid_t) fapl_id)) < 0)
+ if ((retVal = H5Pset_fapl_sec2((hid_t)fapl_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -1007,14 +1006,13 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio
- (JNIEnv *env, jclass clss, jlong fapl_id)
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio(JNIEnv *env, jclass clss, jlong fapl_id)
{
herr_t retVal = FAIL;
UNUSED(clss);
- if ((retVal = H5Pset_fapl_stdio((hid_t) fapl_id)) < 0)
+ if ((retVal = H5Pset_fapl_stdio((hid_t)fapl_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -1027,15 +1025,14 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows
- (JNIEnv *env, jclass clss, jlong fapl_id)
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows(JNIEnv *env, jclass clss, jlong fapl_id)
{
herr_t retVal = FAIL;
UNUSED(clss);
#ifdef H5_HAVE_WINDOWS
- if ((retVal = H5Pset_fapl_windows((hid_t) fapl_id)) < 0)
+ if ((retVal = H5Pset_fapl_windows((hid_t)fapl_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -1068,8 +1065,7 @@ done:
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size
- (JNIEnv *env, jclass clss, jlong plist, jlong size)
+Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size(JNIEnv *env, jclass clss, jlong plist, jlong size)
{
long sz = (long)size;
@@ -1088,8 +1084,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size(JNIEnv *env, jclass clss, jlong plist)
{
hsize_t s = 0;
@@ -1116,8 +1111,7 @@ done:
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size
- (JNIEnv *env, jclass clss, jlong plist, jlong size)
+Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size(JNIEnv *env, jclass clss, jlong plist, jlong size)
{
size_t sz = (size_t)size;
@@ -1136,8 +1130,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size(JNIEnv *env, jclass clss, jlong plist)
{
size_t s = 0;
@@ -1156,11 +1149,10 @@ done:
* Signature: (JJJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1alignment
- (JNIEnv *env, jclass clss, jlong plist, jlong threshold, jlong alignment)
+Java_hdf_hdf5lib_H5_H5Pset_1alignment(JNIEnv *env, jclass clss, jlong plist, jlong threshold, jlong alignment)
{
- long thr = (long)threshold;
- long align = (long)alignment;
+ long thr = (long)threshold;
+ long align = (long)alignment;
herr_t retVal = FAIL;
UNUSED(clss);
@@ -1178,15 +1170,14 @@ done:
* Signature: (J[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1alignment
- (JNIEnv *env, jclass clss, jlong plist, jlongArray alignment)
+Java_hdf_hdf5lib_H5_H5Pget_1alignment(JNIEnv *env, jclass clss, jlong plist, jlongArray alignment)
{
- jboolean isCopy;
- hsize_t t = 0;
- hsize_t a = 0;
- jsize arrLen;
- jlong *theArray = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ hsize_t t = 0;
+ hsize_t a = 0;
+ jsize arrLen;
+ jlong * theArray = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1221,16 +1212,15 @@ done:
* Signature: (JIJJD)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1cache
- (JNIEnv *env, jclass clss, jlong plist, jint mdc_nelmts, jlong rdcc_nelmts,
- jlong rdcc_nbytes, jdouble rdcc_w0)
+Java_hdf_hdf5lib_H5_H5Pset_1cache(JNIEnv *env, jclass clss, jlong plist, jint mdc_nelmts, jlong rdcc_nelmts,
+ jlong rdcc_nbytes, jdouble rdcc_w0)
{
herr_t retVal = FAIL;
UNUSED(clss);
- if ((retVal = H5Pset_cache((hid_t)plist, (int)mdc_nelmts, (size_t)rdcc_nelmts,
- (size_t)rdcc_nbytes, (double) rdcc_w0)) < 0)
+ if ((retVal = H5Pset_cache((hid_t)plist, (int)mdc_nelmts, (size_t)rdcc_nelmts, (size_t)rdcc_nbytes,
+ (double)rdcc_w0)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -1243,15 +1233,14 @@ done:
* Signature: (J[I[J[J[D)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1cache
- (JNIEnv *env, jclass clss, jlong plist, jintArray mdc_nelmts,
- jlongArray rdcc_nelmts, jlongArray rdcc_nbytes, jdoubleArray rdcc_w0)
+Java_hdf_hdf5lib_H5_H5Pget_1cache(JNIEnv *env, jclass clss, jlong plist, jintArray mdc_nelmts,
+ jlongArray rdcc_nelmts, jlongArray rdcc_nbytes, jdoubleArray rdcc_w0)
{
- jboolean isCopy;
- jdouble *w0Array = NULL;
- jlong *rdcc_nelmtsArray = NULL;
- jlong *nbytesArray = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jdouble *w0Array = NULL;
+ jlong * rdcc_nelmtsArray = NULL;
+ jlong * nbytesArray = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
UNUSED(mdc_nelmts);
@@ -1259,23 +1248,25 @@ Java_hdf_hdf5lib_H5_H5Pget_1cache
if (NULL != rdcc_w0)
PIN_DOUBLE_ARRAY(ENVONLY, rdcc_w0, w0Array, &isCopy, "H5Pget_cache: rdcc_w0 array not pinned");
if (NULL != rdcc_nelmts)
- PIN_LONG_ARRAY(ENVONLY, rdcc_nelmts, rdcc_nelmtsArray, &isCopy, "H5Pget_cache: rdcc_nelmts array not pinned");
+ PIN_LONG_ARRAY(ENVONLY, rdcc_nelmts, rdcc_nelmtsArray, &isCopy,
+ "H5Pget_cache: rdcc_nelmts array not pinned");
if (NULL != rdcc_nbytes)
- PIN_LONG_ARRAY(ENVONLY, rdcc_nbytes, nbytesArray, &isCopy, "H5Pget_cache: nbytesArray array not pinned");
+ PIN_LONG_ARRAY(ENVONLY, rdcc_nbytes, nbytesArray, &isCopy,
+ "H5Pget_cache: nbytesArray array not pinned");
{
/* direct cast (size_t *)variable fails on 32-bit environment */
long long rdcc_nelmts_temp = *rdcc_nelmtsArray;
- long long nbytes_temp = *nbytesArray;
- size_t rdcc_nelmts_t = (size_t) rdcc_nelmts_temp;
- size_t nbytes_t = (size_t) nbytes_temp;
+ long long nbytes_temp = *nbytesArray;
+ size_t rdcc_nelmts_t = (size_t)rdcc_nelmts_temp;
+ size_t nbytes_t = (size_t)nbytes_temp;
- if ((status = H5Pget_cache((hid_t)plist, (int *)NULL, &rdcc_nelmts_t,
- &nbytes_t, (double *)w0Array)) < 0)
+ if ((status = H5Pget_cache((hid_t)plist, (int *)NULL, &rdcc_nelmts_t, &nbytes_t, (double *)w0Array)) <
+ 0)
H5_LIBRARY_ERROR(ENVONLY);
*rdcc_nelmtsArray = (jlong)rdcc_nelmts_t;
- *nbytesArray = (jlong)nbytes_t;
+ *nbytesArray = (jlong)nbytes_t;
} /* end direct cast special */
done:
@@ -1295,8 +1286,7 @@ done:
* Signature: (JI)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size
- (JNIEnv *env, jclass clss, jlong plist, jint size)
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size(JNIEnv *env, jclass clss, jlong plist, jint size)
{
unsigned sz = (unsigned)size;
@@ -1315,8 +1305,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size(JNIEnv *env, jclass clss, jlong plist)
{
unsigned s = 0;
@@ -1335,11 +1324,10 @@ done:
* Signature: (JZ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close
- (JNIEnv *env, jclass clss, jlong fapl_id, jboolean evict_on_close)
+Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close(JNIEnv *env, jclass clss, jlong fapl_id, jboolean evict_on_close)
{
hbool_t evict_on_close_val = FALSE;
- herr_t retVal = FAIL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -1358,11 +1346,10 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close
- (JNIEnv *env, jclass clss, jlong fapl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close(JNIEnv *env, jclass clss, jlong fapl_id)
{
hbool_t evict_on_close_val = FALSE;
- jboolean bval = JNI_FALSE;
+ jboolean bval = JNI_FALSE;
UNUSED(clss);
@@ -1381,15 +1368,15 @@ done:
* Signature: (JZZ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1file_1locking
- (JNIEnv *env, jclass clss, jlong fapl_id, jboolean use_file_locking, jboolean ignore_when_disabled)
+Java_hdf_hdf5lib_H5_H5Pset_1file_1locking(JNIEnv *env, jclass clss, jlong fapl_id, jboolean use_file_locking,
+ jboolean ignore_when_disabled)
{
- hbool_t use_file_locking_val = TRUE;
+ hbool_t use_file_locking_val = TRUE;
hbool_t ignore_when_disabled_val = TRUE;
UNUSED(clss);
- use_file_locking_val = (use_file_locking == JNI_TRUE) ? TRUE : FALSE;
+ use_file_locking_val = (use_file_locking == JNI_TRUE) ? TRUE : FALSE;
ignore_when_disabled_val = (ignore_when_disabled == JNI_TRUE) ? TRUE : FALSE;
if (H5Pset_file_locking((hid_t)fapl_id, use_file_locking_val, ignore_when_disabled_val) < 0)
@@ -1405,12 +1392,11 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1use_1file_1locking
- (JNIEnv *env, jclass clss, jlong fapl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1use_1file_1locking(JNIEnv *env, jclass clss, jlong fapl_id)
{
- hbool_t use_file_locking_val = TRUE;
- hbool_t unused = TRUE;
- jboolean bval = JNI_FALSE;
+ hbool_t use_file_locking_val = TRUE;
+ hbool_t unused = TRUE;
+ jboolean bval = JNI_FALSE;
UNUSED(clss);
@@ -1429,12 +1415,11 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1ignore_1disabled_1file_1locking
- (JNIEnv *env, jclass clss, jlong fapl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1ignore_1disabled_1file_1locking(JNIEnv *env, jclass clss, jlong fapl_id)
{
- hbool_t ignore_when_disabled_val = TRUE;
- hbool_t unused = TRUE;
- jboolean bval = JNI_FALSE;
+ hbool_t ignore_when_disabled_val = TRUE;
+ hbool_t unused = TRUE;
+ jboolean bval = JNI_FALSE;
UNUSED(clss);
@@ -1453,8 +1438,7 @@ done:
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts
- (JNIEnv *env, jclass clss, jlong plist_id, jlong attempts)
+Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts(JNIEnv *env, jclass clss, jlong plist_id, jlong attempts)
{
UNUSED(clss);
@@ -1474,8 +1458,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts
- (JNIEnv *env, jclass clss, jlong plist_id)
+Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts(JNIEnv *env, jclass clss, jlong plist_id)
{
unsigned attempts = 0;
@@ -1485,7 +1468,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts
H5_LIBRARY_ERROR(ENVONLY);
done:
- return (jlong) attempts;
+ return (jlong)attempts;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts */
/*
@@ -1494,18 +1477,17 @@ done:
* Signature: (JLhdf/hdf5lib/structs/H5AC_cache_config_t;)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
- (JNIEnv *env, jclass clss, jlong plist, jobject cache_config)
+Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config(JNIEnv *env, jclass clss, jlong plist, jobject cache_config)
{
- H5AC_cache_config_t cacheinfo;
- const char *str = NULL;
- jfieldID fid;
- jstring j_str;
- jclass cls;
- jint flash_incr_mode;
- jint incr_mode;
- jint decr_mode;
- herr_t status = FAIL;
+ H5AC_cache_config_t cacheinfo;
+ const char * str = NULL;
+ jfieldID fid;
+ jstring j_str;
+ jclass cls;
+ jint flash_incr_mode;
+ jint incr_mode;
+ jint decr_mode;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1603,7 +1585,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
incr_mode = ENVPTR->GetIntField(ENVONLY, cache_config, fid); /*(enum H5C_cache_incr_mode) */
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- cacheinfo.incr_mode = (enum H5C_cache_incr_mode) incr_mode;
+ cacheinfo.incr_mode = (enum H5C_cache_incr_mode)incr_mode;
if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "lower_hr_threshold", "D")))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
@@ -1634,7 +1616,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
flash_incr_mode = ENVPTR->GetIntField(ENVONLY, cache_config, fid); /*(enum H5C_cache_flash_incr_mode) */
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- cacheinfo.flash_incr_mode = (enum H5C_cache_flash_incr_mode) flash_incr_mode;
+ cacheinfo.flash_incr_mode = (enum H5C_cache_flash_incr_mode)flash_incr_mode;
if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "flash_multiple", "D")))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
@@ -1653,7 +1635,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
decr_mode = ENVPTR->GetIntField(ENVONLY, cache_config, fid); /*(enum H5C_cache_decr_mode) */
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- cacheinfo.decr_mode = (enum H5C_cache_decr_mode) decr_mode;
+ cacheinfo.decr_mode = (enum H5C_cache_decr_mode)decr_mode;
if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "upper_hr_threshold", "D")))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
@@ -1723,13 +1705,12 @@ done:
* Signature: (J)Lhdf/hdf5lib/structs/H5AC_cache_config_t;
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config(JNIEnv *env, jclass clss, jlong plist)
{
H5AC_cache_config_t cacheinfo;
jstring j_str = NULL;
jvalue args[30];
- herr_t status = FAIL;
+ herr_t status = FAIL;
jobject ret_obj = NULL;
UNUSED(clss);
@@ -1747,15 +1728,16 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config
if (NULL == (j_str = ENVPTR->NewStringUTF(ENVONLY, cacheinfo.trace_file_name))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_mdc_config: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY, "H5Pget_mdc_config: out of memory - unable to construct string from UTF characters");
}
- args[4].l = j_str;
- args[5].z = cacheinfo.evictions_enabled;
- args[6].z = cacheinfo.set_initial_size;
- args[7].j = (jlong)cacheinfo.initial_size;
- args[8].d = cacheinfo.min_clean_fraction;
- args[9].j = (jlong)cacheinfo.max_size;
+ args[4].l = j_str;
+ args[5].z = cacheinfo.evictions_enabled;
+ args[6].z = cacheinfo.set_initial_size;
+ args[7].j = (jlong)cacheinfo.initial_size;
+ args[8].d = cacheinfo.min_clean_fraction;
+ args[9].j = (jlong)cacheinfo.max_size;
args[10].j = (jlong)cacheinfo.min_size;
args[11].j = cacheinfo.epoch_length;
args[12].i = cacheinfo.incr_mode;
@@ -1777,7 +1759,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config
args[28].j = (jlong)cacheinfo.dirty_bytes_threshold;
args[29].i = cacheinfo.metadata_write_strategy;
- CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5AC_cache_config_t", "(IZZZLjava/lang/String;ZZJDJJJIDDZJIDDIDDZJIZDJI)V", args, ret_obj);
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5AC_cache_config_t",
+ "(IZZZLjava/lang/String;ZZJDJJJIDDZJIDDIDDZJIZDJI)V", args, ret_obj);
done:
return ret_obj;
@@ -1797,8 +1780,8 @@ done:
* Signature: (JZLjava/lang/String;Z)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options
- (JNIEnv *env, jclass clss, jlong fapl_id, jboolean is_enabled, jstring location, jboolean start_on_access)
+Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options(JNIEnv *env, jclass clss, jlong fapl_id, jboolean is_enabled,
+ jstring location, jboolean start_on_access)
{
const char *locStr = NULL;
herr_t retVal = FAIL;
@@ -1810,7 +1793,8 @@ Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options
PIN_JAVA_STRING(ENVONLY, location, locStr, NULL, "H5Pset_mdc_log_options: location string not pinned");
- if ((retVal = H5Pset_mdc_log_options((hid_t)fapl_id, (hbool_t)is_enabled, locStr, (hbool_t)start_on_access)) < 0)
+ if ((retVal = H5Pset_mdc_log_options((hid_t)fapl_id, (hbool_t)is_enabled, locStr,
+ (hbool_t)start_on_access)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -1824,18 +1808,18 @@ done:
* Signature: (J[Z)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
- (JNIEnv *env, jclass clss, jlong fapl_id, jbooleanArray mdc_log_options)
+Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options(JNIEnv *env, jclass clss, jlong fapl_id,
+ jbooleanArray mdc_log_options)
{
- jboolean isCopy;
- jboolean *mdc_log_options_ptr = NULL;
- hbool_t is_enabled;
- hbool_t start_on_access;
- ssize_t status = -1;
- size_t location_size;
- jsize arrLen;
- char *lname = NULL;
- jstring str = NULL;
+ jboolean isCopy;
+ jboolean *mdc_log_options_ptr = NULL;
+ hbool_t is_enabled;
+ hbool_t start_on_access;
+ ssize_t status = -1;
+ size_t location_size;
+ jsize arrLen;
+ char * lname = NULL;
+ jstring str = NULL;
UNUSED(clss);
@@ -1849,7 +1833,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
if (arrLen < 2)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_mdc_log_options: length of mdc_log_options < 2");
- PIN_BOOL_ARRAY(ENVONLY, mdc_log_options, mdc_log_options_ptr, &isCopy, "H5Pget_mdc_log_options: mdc_log_options array not pinned");
+ PIN_BOOL_ARRAY(ENVONLY, mdc_log_options, mdc_log_options_ptr, &isCopy,
+ "H5Pget_mdc_log_options: mdc_log_options array not pinned");
/* get the length of the filename */
if (H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, NULL, &location_size, &start_on_access) < 0)
@@ -1859,16 +1844,19 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_mdc_log_options: location_size is 0");
location_size++; /* add extra space for the null terminator */
- if (NULL == (lname = (char *) HDmalloc(sizeof(char) * location_size)))
+ if (NULL == (lname = (char *)HDmalloc(sizeof(char) * location_size)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_mdc_log_options: memory allocation failed");
- if ((status = H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, lname, &location_size, &start_on_access)) < 0)
+ if ((status = H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, lname, &location_size,
+ &start_on_access)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
lname[location_size - 1] = '\0';
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, lname))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_mdc_log_options: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY,
+ "H5Pget_mdc_log_options: out of memory - unable to construct string from UTF characters");
}
mdc_log_options_ptr[0] = (jboolean)is_enabled;
@@ -1905,11 +1893,10 @@ done:
* Signature: (JZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1gc_1references
- (JNIEnv *env, jclass clss, jlong fapl_id, jboolean gc_ref)
+Java_hdf_hdf5lib_H5_H5Pset_1gc_1references(JNIEnv *env, jclass clss, jlong fapl_id, jboolean gc_ref)
{
unsigned gc_ref_val = 0;
- herr_t retVal = FAIL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -1928,11 +1915,10 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1gc_1references
- (JNIEnv *env, jclass clss, jlong fapl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1gc_1references(JNIEnv *env, jclass clss, jlong fapl_id)
{
unsigned gc_ref_val = 0;
- jboolean bval = JNI_FALSE;
+ jboolean bval = JNI_FALSE;
UNUSED(clss);
@@ -1951,10 +1937,9 @@ done:
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size
- (JNIEnv *env, jclass clss, jlong plist, jlong size)
+Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size(JNIEnv *env, jclass clss, jlong plist, jlong size)
{
- long sz = (long)size;
+ long sz = (long)size;
herr_t retVal = FAIL;
UNUSED(clss);
@@ -1972,8 +1957,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size(JNIEnv *env, jclass clss, jlong plist)
{
hsize_t s = 0;
@@ -1992,8 +1976,7 @@ done:
* Signature: (JII)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds
- (JNIEnv *env, jclass clss, jlong fapl_id, jint low, jint high)
+Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds(JNIEnv *env, jclass clss, jlong fapl_id, jint low, jint high)
{
herr_t retVal = FAIL;
@@ -2012,12 +1995,11 @@ done:
* Signature: (J[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds
- (JNIEnv *env, jclass clss, jlong fapl_id, jintArray libver)
+Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds(JNIEnv *env, jclass clss, jlong fapl_id, jintArray libver)
{
- jboolean isCopy;
- jint *theArray = NULL;
- herr_t retVal = FAIL;
+ jboolean isCopy;
+ jint * theArray = NULL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -2026,7 +2008,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds
PIN_INT_ARRAY(ENVONLY, libver, theArray, &isCopy, "H5Pget_libver_bounds: input not pinned");
- if ((retVal = H5Pget_libver_bounds((hid_t)fapl_id, (H5F_libver_t *)&(theArray[0]), (H5F_libver_t *)&(theArray[1]))) < 0)
+ if ((retVal = H5Pget_libver_bounds((hid_t)fapl_id, (H5F_libver_t *)&(theArray[0]),
+ (H5F_libver_t *)&(theArray[1]))) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
diff --git a/java/src/jni/h5pFAPLImp.h b/java/src/jni/h5pFAPLImp.h
index b9b4556..780ebc4 100644
--- a/java/src/jni/h5pFAPLImp.h
+++ b/java/src/jni/h5pFAPLImp.h
@@ -29,9 +29,7 @@ extern "C" {
* Method: H5Pget_driver
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1driver
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1driver(JNIEnv *, jclass, jlong);
/*
* TODO: H5Pget_driver_info
@@ -42,36 +40,29 @@ Java_hdf_hdf5lib_H5_H5Pget_1driver
* Method: H5Pset_fclose_degree
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_fclose_degree
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_fapl_core
* Signature: (JJZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core
-(JNIEnv *, jclass, jlong, jlong, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core(JNIEnv *, jclass, jlong, jlong, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_fapl_core
* Signature: (J[J[Z)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core
-(JNIEnv *, jclass, jlong, jlongArray, jbooleanArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core(JNIEnv *, jclass, jlong, jlongArray,
+ jbooleanArray);
/*
* TODO: H5Pset_core_write_tracking
@@ -86,81 +77,64 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core
* Method: H5Pset_fapl_direct
* Signature: (JJJJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct
-(JNIEnv *, jclass, jlong, jlong, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct(JNIEnv *, jclass, jlong, jlong, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_fapl_direct
* Signature: (J[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct
-(JNIEnv *, jclass, jlong, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct(JNIEnv *, jclass, jlong, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_fapl_family
* Signature: (JJJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family
-(JNIEnv *, jclass, jlong, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family(JNIEnv *, jclass, jlong, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_fapl_family
* Signature: (J[J[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family
-(JNIEnv *, jclass, jlong, jlongArray, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family(JNIEnv *, jclass, jlong, jlongArray,
+ jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_family_offset
* Signature: (JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1family_1offset
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1family_1offset(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_family_offset
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1family_1offset
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1family_1offset(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_fapl_hdfs
* Signature: (J)Lhdf/hdf5lib/structs/H5FD_hdfs_fapl_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_fapl_hdfs
* Signature: (JLhdf/hdf5lib/structs/H5FD_hdfs_fapl_t;)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs
-(JNIEnv *, jclass, jlong, jobject);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs(JNIEnv *, jclass, jlong, jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_fapl_log
* Signature: (JLjava/lang/String;JJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log
-(JNIEnv *, jclass, jlong, jstring, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log(JNIEnv *, jclass, jlong, jstring, jlong, jlong);
/*
* TODO: H5Pset_fapl_mpio
@@ -183,18 +157,16 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log
* Method: H5Pset_fapl_multi
* Signature: (J[I[J[Ljava/lang/String;[JZ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
-(JNIEnv *, jclass, jlong, jintArray, jlongArray, jobjectArray, jlongArray, jboolean);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi(JNIEnv *, jclass, jlong, jintArray, jlongArray,
+ jobjectArray, jlongArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_fapl_multi
* Signature: (J[I[J[Ljava/lang/String;[J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi
-(JNIEnv *, jclass, jlong, jintArray, jlongArray, jobjectArray, jlongArray);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi(JNIEnv *, jclass, jlong, jintArray,
+ jlongArray, jobjectArray, jlongArray);
/*
* TODO: H5Pset_multi_type
@@ -209,54 +181,43 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi
* Method: H5Pget_fapl_ros3
* Signature: (J)Lhdf/hdf5lib/structs/H5FD_ros3_fapl_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_fapl_ros3
* Signature: (JLhdf/hdf5lib/structs/H5FD_ros3_fapl_t;)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3
-(JNIEnv *, jclass, jlong, jobject);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3(JNIEnv *, jclass, jlong, jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_fapl_split
* Signature: (JLjava/lang/String;JLjava/lang/String;J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split
-(JNIEnv *, jclass, jlong, jstring, jlong, jstring, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split(JNIEnv *, jclass, jlong, jstring, jlong,
+ jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_fapl_sec2
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_fapl_stdio
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_fapl_windows
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows(JNIEnv *, jclass, jlong);
/*
* TODO: H5Pset_file_image
@@ -279,18 +240,14 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows
* Method: H5Pset_meta_block_size
* Signature: (JJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_meta_block_size
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size(JNIEnv *, jclass, jlong);
/*
* TODO: H5Pset_page_buffer_size
@@ -305,153 +262,126 @@ Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size
* Method: H5Pset_sieve_buf_size
* Signature: (JJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_sieve_buf_size
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_alignment
* Signature: (JJJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1alignment
-(JNIEnv *, jclass, jlong, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1alignment(JNIEnv *, jclass, jlong, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_alignment
* Signature: (J[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1alignment
-(JNIEnv *, jclass, jlong, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1alignment(JNIEnv *, jclass, jlong, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_cache
* Signature: (JIJJD)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1cache
-(JNIEnv *, jclass, jlong, jint, jlong, jlong, jdouble);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1cache(JNIEnv *, jclass, jlong, jint, jlong, jlong,
+ jdouble);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_cache
* Signature: (J[I[J[J[D)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1cache
-(JNIEnv *, jclass, jlong, jintArray, jlongArray, jlongArray, jdoubleArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1cache(JNIEnv *, jclass, jlong, jintArray, jlongArray,
+ jlongArray, jdoubleArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_elink_file_cache_size
* Signature: (JI)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_elink_file_cache_size
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_evict_on_close
* Signature: (JZ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close
-(JNIEnv *, jclass, jlong, jboolean);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close(JNIEnv *, jclass, jlong, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_evict_on_close
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_file_locking
* Signature: (JZZ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1file_1locking
-(JNIEnv *env, jclass clss, jlong fapl_id, jboolean use_file_locking, jboolean ignore_when_disabled);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1file_1locking(JNIEnv *env, jclass clss, jlong fapl_id,
+ jboolean use_file_locking,
+ jboolean ignore_when_disabled);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_use_file_locking
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1use_1file_1locking
-(JNIEnv *env, jclass clss, jlong fapl_id);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1use_1file_1locking(JNIEnv *env, jclass clss,
+ jlong fapl_id);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_ignore_disabled_file_locking
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1ignore_1disabled_1file_1locking
-(JNIEnv *env, jclass clss, jlong fapl_id);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1ignore_1disabled_1file_1locking(JNIEnv *env,
+ jclass clss,
+ jlong fapl_id);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_metadata_read_attempts
* Signature: (JJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_metadata_read_attempts
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_mdc_config
* Signature: (JLhdf/hdf5lib/structs/H5AC_cache_config_t;)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
-(JNIEnv *, jclass, jlong, jobject);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config(JNIEnv *, jclass, jlong, jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_mdc_config
* Signature: (J)Lhdf/hdf5lib/structs/H5AC_cache_config_t;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config(JNIEnv *, jclass, jlong);
/*
* TODO: H5Pset_mdc_image_config
@@ -466,18 +396,16 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config
* Method: H5Pset_mdc_log_options
* Signature: (JZLjava/lang/String;Z)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options
-(JNIEnv *, jclass, jlong, jboolean, jstring, jboolean);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options(JNIEnv *, jclass, jlong, jboolean,
+ jstring, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_mdc_log_options
* Signature: (J[Z)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
-(JNIEnv *, jclass, jlong, jbooleanArray);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options(JNIEnv *, jclass, jlong,
+ jbooleanArray);
/*
* TODO: H5Pset_all_coll_metadata_ops
@@ -500,54 +428,42 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
* Method: H5Pset_gc_references
* Signature: (JZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1gc_1references
-(JNIEnv *, jclass, jlong, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1gc_1references(JNIEnv *, jclass, jlong, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_gc_references
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1gc_1references
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1gc_1references(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_small_data_block_size
* Signature: (JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_small_data_block_size
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_libver_bounds
* Signature: (JII)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds
-(JNIEnv *, jclass, jlong, jint, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds(JNIEnv *, jclass, jlong, jint, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_libver_bounds
* Signature: (J[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds
-(JNIEnv *, jclass, jlong, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds(JNIEnv *, jclass, jlong, jintArray);
/*
* TODO: H5Pset_object_flush_cb
diff --git a/java/src/jni/h5pFCPLImp.c b/java/src/jni/h5pFCPLImp.c
index 2160496..fcb590e 100644
--- a/java/src/jni/h5pFCPLImp.c
+++ b/java/src/jni/h5pFCPLImp.c
@@ -37,10 +37,9 @@ extern "C" {
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1userblock
- (JNIEnv *env, jclass clss, jlong plist, jlong size)
+Java_hdf_hdf5lib_H5_H5Pset_1userblock(JNIEnv *env, jclass clss, jlong plist, jlong size)
{
- long sz = (long) size;
+ long sz = (long)size;
herr_t retVal = FAIL;
UNUSED(clss);
@@ -58,13 +57,12 @@ done:
* Signature: (J[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1userblock
- (JNIEnv *env, jclass clss, jlong plist, jlongArray size)
+Java_hdf_hdf5lib_H5_H5Pget_1userblock(JNIEnv *env, jclass clss, jlong plist, jlongArray size)
{
- jboolean isCopy;
- hsize_t s;
- jlong *theArray = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ hsize_t s;
+ jlong * theArray = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -91,8 +89,7 @@ done:
* Signature: (JII)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sizes
- (JNIEnv *env, jclass clss, jlong plist, jint sizeof_addr, jint sizeof_size)
+Java_hdf_hdf5lib_H5_H5Pset_1sizes(JNIEnv *env, jclass clss, jlong plist, jint sizeof_addr, jint sizeof_size)
{
herr_t retVal = FAIL;
@@ -111,15 +108,14 @@ done:
* Signature: (J[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sizes
- (JNIEnv *env, jclass clss, jlong plist, jlongArray size)
+Java_hdf_hdf5lib_H5_H5Pget_1sizes(JNIEnv *env, jclass clss, jlong plist, jlongArray size)
{
- jboolean isCopy;
- jlong *theArray = NULL;
- jsize arrLen;
- size_t ss;
- size_t sa;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jlong * theArray = NULL;
+ jsize arrLen;
+ size_t ss;
+ size_t sa;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -154,8 +150,7 @@ done:
* Signature: (JII)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sym_1k
- (JNIEnv *env, jclass clss, jlong plist, jint ik, jint lk)
+Java_hdf_hdf5lib_H5_H5Pset_1sym_1k(JNIEnv *env, jclass clss, jlong plist, jint ik, jint lk)
{
herr_t retVal = FAIL;
@@ -174,13 +169,12 @@ done:
* Signature: (J[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sym_1k
- (JNIEnv *env, jclass clss, jlong plist, jintArray size)
+Java_hdf_hdf5lib_H5_H5Pget_1sym_1k(JNIEnv *env, jclass clss, jlong plist, jintArray size)
{
- jboolean isCopy;
- jsize arrLen;
- jint *theArray = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jsize arrLen;
+ jint * theArray = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -212,8 +206,7 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1istore_1k
- (JNIEnv *env, jclass clss, jlong plist, jint ik)
+Java_hdf_hdf5lib_H5_H5Pset_1istore_1k(JNIEnv *env, jclass clss, jlong plist, jint ik)
{
herr_t retVal = FAIL;
@@ -232,12 +225,11 @@ done:
* Signature: (J[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1istore_1k
- (JNIEnv *env, jclass clss, jlong plist, jintArray ik)
+Java_hdf_hdf5lib_H5_H5Pget_1istore_1k(JNIEnv *env, jclass clss, jlong plist, jintArray ik)
{
- jboolean isCopy;
- jint *theArray = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jint * theArray = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -262,8 +254,7 @@ done:
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1page_1size
- (JNIEnv *env, jclass clss, jlong fcpl_id, jlong fsp_size)
+Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1page_1size(JNIEnv *env, jclass clss, jlong fcpl_id, jlong fsp_size)
{
UNUSED(clss);
@@ -280,8 +271,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1page_1size
- (JNIEnv *env, jclass clss, jlong fcpl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1page_1size(JNIEnv *env, jclass clss, jlong fcpl_id)
{
hsize_t fsp_size = 0;
@@ -300,12 +290,13 @@ done:
* Signature: (JIZJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1strategy
- (JNIEnv *env, jclass clss, jlong fcpl_id, jint strategy, jboolean persist, jlong threshold)
+Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1strategy(JNIEnv *env, jclass clss, jlong fcpl_id, jint strategy,
+ jboolean persist, jlong threshold)
{
UNUSED(clss);
- if (H5Pset_file_space_strategy((hid_t)fcpl_id, (H5F_fspace_strategy_t)strategy, (hbool_t)persist, (hsize_t)threshold) < 0)
+ if (H5Pset_file_space_strategy((hid_t)fcpl_id, (H5F_fspace_strategy_t)strategy, (hbool_t)persist,
+ (hsize_t)threshold) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -318,23 +309,25 @@ done:
* Signature: (J[Z[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy
- (JNIEnv *env, jclass clss, jlong fcpl_id, jbooleanArray persist, jlongArray threshold)
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy(JNIEnv *env, jclass clss, jlong fcpl_id,
+ jbooleanArray persist, jlongArray threshold)
{
- H5F_fspace_strategy_t thestrategy = H5F_FSPACE_STRATEGY_FSM_AGGR; /* Library default */
- jboolean isCopy;
- jboolean *persistArray = NULL;
- jlong *thresholdArray = NULL;
- herr_t status = FAIL;
+ H5F_fspace_strategy_t thestrategy = H5F_FSPACE_STRATEGY_FSM_AGGR; /* Library default */
+ jboolean isCopy;
+ jboolean * persistArray = NULL;
+ jlong * thresholdArray = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
if (persist)
PIN_BOOL_ARRAY(ENVONLY, persist, persistArray, &isCopy, "H5Pget_file_space: persist not pinned");
if (threshold)
- PIN_LONG_ARRAY(ENVONLY, threshold, thresholdArray, &isCopy, "H5Pget_file_space: threshold not pinned");
+ PIN_LONG_ARRAY(ENVONLY, threshold, thresholdArray, &isCopy,
+ "H5Pget_file_space: threshold not pinned");
- if ((status = H5Pget_file_space_strategy((hid_t)fcpl_id, &thestrategy, (hbool_t *)persistArray, (hsize_t *)thresholdArray)) < 0)
+ if ((status = H5Pget_file_space_strategy((hid_t)fcpl_id, &thestrategy, (hbool_t *)persistArray,
+ (hsize_t *)thresholdArray)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -352,11 +345,10 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist
- (JNIEnv *env, jclass clss, jlong fcpl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist(JNIEnv *env, jclass clss, jlong fcpl_id)
{
hbool_t persist = FALSE;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -373,11 +365,10 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1threshold
- (JNIEnv *env, jclass clss, jlong fcpl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1threshold(JNIEnv *env, jclass clss, jlong fcpl_id)
{
hsize_t threshold = 0;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -394,15 +385,16 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes
- (JNIEnv *env, jclass clss, jlong plist_id, jint nindexes)
+Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes(JNIEnv *env, jclass clss, jlong plist_id, jint nindexes)
{
herr_t retVal = FAIL;
UNUSED(clss);
if (nindexes > H5O_SHMESG_MAX_NINDEXES)
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_nindexes: number of indexes is greater than H5O_SHMESG_MAX_NINDEXES");
+ H5_BAD_ARGUMENT_ERROR(
+ ENVONLY,
+ "H5Pset_shared_mesg_nindexes: number of indexes is greater than H5O_SHMESG_MAX_NINDEXES");
if ((retVal = H5Pset_shared_mesg_nindexes((hid_t)plist_id, (unsigned)nindexes)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -417,8 +409,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes
- (JNIEnv *env, jclass clss, jlong fcpl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes(JNIEnv *env, jclass clss, jlong fcpl_id)
{
unsigned nindexes;
@@ -437,9 +428,8 @@ done:
* Signature: (JIII)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index
- (JNIEnv *env, jclass clss, jlong fcpl_id, jint index_num,
- jint mesg_type_flags, jint min_mesg_size)
+Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index(JNIEnv *env, jclass clss, jlong fcpl_id, jint index_num,
+ jint mesg_type_flags, jint min_mesg_size)
{
unsigned nindexes; /* Number of SOHM indexes */
herr_t retVal = FAIL;
@@ -447,7 +437,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index
UNUSED(clss);
/* Check arguments */
- if ((unsigned) mesg_type_flags > H5O_SHMESG_ALL_FLAG)
+ if ((unsigned)mesg_type_flags > H5O_SHMESG_ALL_FLAG)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_index: unrecognized flags in mesg_type_flags");
/* Read the current number of indexes */
@@ -455,10 +445,11 @@ Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index
H5_LIBRARY_ERROR(ENVONLY);
/* Range check */
- if ((unsigned) index_num >= nindexes)
+ if ((unsigned)index_num >= nindexes)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_index: index_num is too large; no such index");
- if ((retVal = H5Pset_shared_mesg_index((hid_t)fcpl_id, (unsigned)index_num, (unsigned) mesg_type_flags, (unsigned) min_mesg_size)) < 0)
+ if ((retVal = H5Pset_shared_mesg_index((hid_t)fcpl_id, (unsigned)index_num, (unsigned)mesg_type_flags,
+ (unsigned)min_mesg_size)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -471,13 +462,13 @@ done:
* Signature: (JI[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index
- (JNIEnv *env, jclass clss, jlong fcpl_id, jint index_num, jintArray mesg_info)
+Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index(JNIEnv *env, jclass clss, jlong fcpl_id, jint index_num,
+ jintArray mesg_info)
{
- jboolean isCopy;
- unsigned nindexes; /* Number of SOHM indexes */
- jint *theArray = NULL;
- herr_t retVal = FAIL;
+ jboolean isCopy;
+ unsigned nindexes; /* Number of SOHM indexes */
+ jint * theArray = NULL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -489,12 +480,13 @@ Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index
H5_LIBRARY_ERROR(ENVONLY);
/* Range check */
- if ((unsigned) index_num >= nindexes)
+ if ((unsigned)index_num >= nindexes)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_shared_mesg_index: index_num is too large; no such index");
PIN_INT_ARRAY(ENVONLY, mesg_info, theArray, &isCopy, "H5Pget_shared_mesg_index: input not pinned");
- if ((retVal = H5Pget_shared_mesg_index((hid_t)fcpl_id, (unsigned)index_num, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ if ((retVal = H5Pget_shared_mesg_index((hid_t)fcpl_id, (unsigned)index_num, (unsigned *)&(theArray[0]),
+ (unsigned *)&(theArray[1]))) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -510,8 +502,8 @@ done:
* Signature: (JII)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change
- (JNIEnv *env, jclass clss, jlong fcpl_id, jint max_list, jint min_btree)
+Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change(JNIEnv *env, jclass clss, jlong fcpl_id,
+ jint max_list, jint min_btree)
{
herr_t retVal = FAIL;
@@ -524,13 +516,20 @@ Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change
*/
if (max_list + 1 < min_btree)
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_phase_change: minimum B-tree value is greater than maximum list value");
+ H5_BAD_ARGUMENT_ERROR(
+ ENVONLY,
+ "H5Pset_shared_mesg_phase_change: minimum B-tree value is greater than maximum list value");
if (max_list > H5O_SHMESG_MAX_LIST_SIZE)
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_phase_change: max list value is larger than H5O_SHMESG_MAX_LIST_SIZE");
+ H5_BAD_ARGUMENT_ERROR(
+ ENVONLY,
+ "H5Pset_shared_mesg_phase_change: max list value is larger than H5O_SHMESG_MAX_LIST_SIZE");
if (min_btree > H5O_SHMESG_MAX_LIST_SIZE)
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_phase_change: min btree value is larger than H5O_SHMESG_MAX_LIST_SIZE");
+ H5_BAD_ARGUMENT_ERROR(
+ ENVONLY,
+ "H5Pset_shared_mesg_phase_change: min btree value is larger than H5O_SHMESG_MAX_LIST_SIZE");
- if ((retVal = H5Pset_shared_mesg_phase_change((hid_t)fcpl_id, (unsigned)max_list, (unsigned)min_btree)) < 0)
+ if ((retVal = H5Pset_shared_mesg_phase_change((hid_t)fcpl_id, (unsigned)max_list, (unsigned)min_btree)) <
+ 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -543,12 +542,12 @@ done:
* Signature: (J[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change
- (JNIEnv *env, jclass clss, jlong fcpl_id, jintArray size)
+Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change(JNIEnv *env, jclass clss, jlong fcpl_id,
+ jintArray size)
{
- jboolean isCopy;
- jint *theArray = NULL;
- herr_t retVal = FAIL;
+ jboolean isCopy;
+ jint * theArray = NULL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -557,7 +556,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change
PIN_INT_ARRAY(ENVONLY, size, theArray, &isCopy, "H5Pget_shared_mesg_phase_change: input not pinned");
- if ((retVal = H5Pget_shared_mesg_phase_change((hid_t)fcpl_id, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ if ((retVal = H5Pget_shared_mesg_phase_change((hid_t)fcpl_id, (unsigned *)&(theArray[0]),
+ (unsigned *)&(theArray[1]))) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
diff --git a/java/src/jni/h5pFCPLImp.h b/java/src/jni/h5pFCPLImp.h
index 57fcae8..924e325 100644
--- a/java/src/jni/h5pFCPLImp.h
+++ b/java/src/jni/h5pFCPLImp.h
@@ -25,180 +25,147 @@ extern "C" {
* Method: H5Pset_userblock
* Signature: (JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1userblock
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1userblock(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_userblock
* Signature: (J[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1userblock
-(JNIEnv *, jclass, jlong, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1userblock(JNIEnv *, jclass, jlong, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_sizes
* Signature: (JII)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sizes
-(JNIEnv *, jclass, jlong, jint, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1sizes(JNIEnv *, jclass, jlong, jint, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_sizes
* Signature: (J[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sizes
-(JNIEnv *, jclass, jlong, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1sizes(JNIEnv *, jclass, jlong, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_sym_k
* Signature: (JII)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sym_1k
-(JNIEnv *, jclass, jlong, jint, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1sym_1k(JNIEnv *, jclass, jlong, jint, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_sym_k
* Signature: (J[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sym_1k
-(JNIEnv *, jclass, jlong, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1sym_1k(JNIEnv *, jclass, jlong, jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_istore_k
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1istore_1k
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1istore_1k(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_istore_k
* Signature: (J[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1istore_1k
-(JNIEnv *, jclass, jlong, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1istore_1k(JNIEnv *, jclass, jlong, jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_file_space_page_size
* Signature: (JJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1page_1size
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1page_1size(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_file_space_page_size
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1page_1size
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1page_1size(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_file_space_strategy
* Signature: (JIZJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1strategy
-(JNIEnv *, jclass, jlong, jint, jboolean, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1strategy(JNIEnv *, jclass, jlong, jint,
+ jboolean, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_file_space_strategy
* Signature: (J[Z[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy
-(JNIEnv *, jclass, jlong, jbooleanArray, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy(JNIEnv *, jclass, jlong,
+ jbooleanArray, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_file_space_strategy_persist
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist(JNIEnv *, jclass,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_file_space_strategy_threshold
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1threshold
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1threshold(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_shared_mesg_nindexes
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_shared_mesg_nindexes
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_shared_mesg_index
* Signature: (JIII)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index
-(JNIEnv *, jclass, jlong, jint, jint, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index(JNIEnv *, jclass, jlong, jint, jint,
+ jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_shared_mesg_index
* Signature: (JI[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index
-(JNIEnv *, jclass, jlong, jint, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index(JNIEnv *, jclass, jlong, jint,
+ jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_shared_mesg_phase_change
* Signature: (JII)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change
-(JNIEnv *, jclass, jlong, jint, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change(JNIEnv *, jclass, jlong, jint,
+ jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_shared_mesg_phase_change
* Signature: (J[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change
-(JNIEnv *, jclass, jlong, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change(JNIEnv *, jclass, jlong,
+ jintArray);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5pGCPLImp.c b/java/src/jni/h5pGCPLImp.c
index 2ba1c7d..67af902 100644
--- a/java/src/jni/h5pGCPLImp.c
+++ b/java/src/jni/h5pGCPLImp.c
@@ -37,8 +37,7 @@ extern "C" {
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint
- (JNIEnv *env, jclass clss, jlong gcpl_id, jlong size_hint)
+Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint(JNIEnv *env, jclass clss, jlong gcpl_id, jlong size_hint)
{
herr_t retVal = FAIL;
@@ -57,8 +56,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint
- (JNIEnv *env, jclass clss, jlong gcpl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint(JNIEnv *env, jclass clss, jlong gcpl_id)
{
size_t size_hint = 0;
@@ -77,8 +75,8 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order
- (JNIEnv *env, jclass clss, jlong gcpl_id, jint crt_order_flags)
+Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order(JNIEnv *env, jclass clss, jlong gcpl_id,
+ jint crt_order_flags)
{
herr_t retVal = FAIL;
@@ -97,8 +95,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order
- (JNIEnv *env, jclass clss, jlong gcpl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order(JNIEnv *env, jclass clss, jlong gcpl_id)
{
unsigned crt_order_flags;
@@ -117,8 +114,8 @@ done:
* Signature: (JII)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info
- (JNIEnv *env, jclass clss, jlong gcpl_id, jint est_num_entries, jint est_name_len)
+Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info(JNIEnv *env, jclass clss, jlong gcpl_id, jint est_num_entries,
+ jint est_name_len)
{
herr_t retVal = FAIL;
@@ -126,9 +123,11 @@ Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info
/* Range check values */
if ((est_num_entries > 65535) || (est_name_len > 65535))
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_est_link_info: est. name length or number of entries must be < 65536");
+ H5_BAD_ARGUMENT_ERROR(ENVONLY,
+ "H5Pset_est_link_info: est. name length or number of entries must be < 65536");
- if ((retVal = H5Pset_est_link_info((hid_t)gcpl_id, (unsigned)est_num_entries, (unsigned)est_name_len)) < 0)
+ if ((retVal = H5Pset_est_link_info((hid_t)gcpl_id, (unsigned)est_num_entries, (unsigned)est_name_len)) <
+ 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -141,12 +140,11 @@ done:
* Signature: (J[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info
- (JNIEnv *env, jclass clss, jlong gcpl_id, jintArray link_info)
+Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info(JNIEnv *env, jclass clss, jlong gcpl_id, jintArray link_info)
{
- jboolean isCopy;
- jint *theArray = NULL;
- herr_t retVal = FAIL;
+ jboolean isCopy;
+ jint * theArray = NULL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -155,7 +153,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info
PIN_INT_ARRAY(ENVONLY, link_info, theArray, &isCopy, "H5Pget_est_link_info: input not pinned");
- if ((retVal = H5Pget_est_link_info((hid_t)gcpl_id, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ if ((retVal = H5Pget_est_link_info((hid_t)gcpl_id, (unsigned *)&(theArray[0]),
+ (unsigned *)&(theArray[1]))) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -171,15 +170,16 @@ done:
* Signature: (JII)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change
- (JNIEnv *env, jclass clss, jlong gcpl_id, jint max_compact, jint min_dense)
+Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change(JNIEnv *env, jclass clss, jlong gcpl_id, jint max_compact,
+ jint min_dense)
{
herr_t retVal = FAIL;
UNUSED(clss);
if (max_compact < min_dense)
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_link_phase_change: max compact value must be >= min dense value");
+ H5_BAD_ARGUMENT_ERROR(ENVONLY,
+ "H5Pset_link_phase_change: max compact value must be >= min dense value");
if (max_compact > 65535)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_link_phase_change: max compact value must be < 65536");
if (min_dense > 65535)
@@ -198,12 +198,11 @@ done:
* Signature: (J[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change
- (JNIEnv *env, jclass clss, jlong gcpl_id, jintArray links)
+Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change(JNIEnv *env, jclass clss, jlong gcpl_id, jintArray links)
{
- jboolean isCopy;
- jint *theArray = NULL;
- herr_t retVal = FAIL;
+ jboolean isCopy;
+ jint * theArray = NULL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -212,7 +211,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change
PIN_INT_ARRAY(ENVONLY, links, theArray, &isCopy, "H5Pget_link_phase_change: input not pinned");
- if ((retVal = H5Pget_link_phase_change((hid_t)gcpl_id, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ if ((retVal = H5Pget_link_phase_change((hid_t)gcpl_id, (unsigned *)&(theArray[0]),
+ (unsigned *)&(theArray[1]))) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
diff --git a/java/src/jni/h5pGCPLImp.h b/java/src/jni/h5pGCPLImp.h
index 9c32063..920e799 100644
--- a/java/src/jni/h5pGCPLImp.h
+++ b/java/src/jni/h5pGCPLImp.h
@@ -25,72 +25,56 @@ extern "C" {
* Method: H5Pset_local_heap_size_hint
* Signature: (JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_local_heap_size_hint
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_link_creation_order
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_link_creation_order
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_est_link_info
* Signature: (JII)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info
-(JNIEnv *, jclass, jlong, jint, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info(JNIEnv *, jclass, jlong, jint, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_est_link_info
* Signature: (J[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info
-(JNIEnv *, jclass, jlong, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info(JNIEnv *, jclass, jlong, jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_link_phase_change
* Signature: (JII)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change
-(JNIEnv *, jclass, jlong, jint, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change(JNIEnv *, jclass, jlong, jint, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_link_phase_change
* Signature: (J[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change
-(JNIEnv *, jclass, jlong, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change(JNIEnv *, jclass, jlong, jintArray);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c
index 9e5b004..4ab359a 100644
--- a/java/src/jni/h5pImp.c
+++ b/java/src/jni/h5pImp.c
@@ -54,7 +54,7 @@ static herr_t H5P_cls_close_cb(hid_t prop_id, void *close_data);
static herr_t H5P_prp_create_cb(const char *name, size_t size, void *value);
static herr_t H5P_prp_copy_cb(const char *name, size_t size, void *value);
static herr_t H5P_prp_close_cb(const char *name, size_t size, void *value);
-static int H5P_prp_compare_cb(void *value1, void *value2, size_t size);
+static int H5P_prp_compare_cb(void *value1, void *value2, size_t size);
static herr_t H5P_prp_get_cb(hid_t prop_id, const char *name, size_t size, void *value);
static herr_t H5P_prp_set_cb(hid_t prop_id, const char *name, size_t size, void *value);
static herr_t H5P_prp_delete_cb(hid_t prop_id, const char *name, size_t size, void *value);
@@ -67,14 +67,13 @@ static herr_t H5P_iterate_cb(hid_t prop_id, const char *name, void *cb_data);
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pcreate
- (JNIEnv *env, jclass clss, jlong type)
+Java_hdf_hdf5lib_H5__1H5Pcreate(JNIEnv *env, jclass clss, jlong type)
{
hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
- if ((retVal = H5Pcreate((hid_t) type)) < 0)
+ if ((retVal = H5Pcreate((hid_t)type)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -87,14 +86,13 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1class
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5_H5Pget_1class(JNIEnv *env, jclass clss, jlong plist)
{
hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
- if ((retVal = H5Pget_class((hid_t) plist)) < 0)
+ if ((retVal = H5Pget_class((hid_t)plist)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
/*
@@ -112,14 +110,13 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pcopy
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5__1H5Pcopy(JNIEnv *env, jclass clss, jlong plist)
{
hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
- if ((retVal = H5Pcopy((hid_t) plist)) < 0)
+ if ((retVal = H5Pcopy((hid_t)plist)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -132,15 +129,14 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Pclose
- (JNIEnv *env, jclass clss, jlong plist)
+Java_hdf_hdf5lib_H5__1H5Pclose(JNIEnv *env, jclass clss, jlong plist)
{
herr_t retVal = FAIL;
UNUSED(clss);
if (plist >= 0)
- if ((retVal = H5Pclose((hid_t) plist)) < 0)
+ if ((retVal = H5Pclose((hid_t)plist)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -158,29 +154,32 @@ done:
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Pcreate_class
- * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
+ * Signature:
+ * (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pcreate_1class
- (JNIEnv *env, jclass clss, jlong parent_class, jstring name, jobject create_op,
- jobject create_data, jobject copy_op, jobject copy_data, jobject close_op, jobject close_data)
+Java_hdf_hdf5lib_H5__1H5Pcreate_1class(JNIEnv *env, jclass clss, jlong parent_class, jstring name,
+ jobject create_op, jobject create_data, jobject copy_op,
+ jobject copy_data, jobject close_op, jobject close_data)
{
- const char *cstr = NULL;
+ const char *cstr = NULL;
hid_t class_id = H5I_INVALID_HID;
UNUSED(clss);
create_callback = create_op;
- close_callback = close_op;
- copy_callback = copy_op;
+ close_callback = close_op;
+ copy_callback = copy_op;
if (NULL == name)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "_H5Pcreate_class: class name is NULL");
PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "_H5Pcreate_class: class name not pinned");
- if ((class_id = H5Pcreate_class((hid_t)parent_class, cstr, (H5P_cls_create_func_t)H5P_cls_create_cb, (void *) create_data,
- (H5P_cls_copy_func_t)H5P_cls_copy_cb, (void *) copy_data, (H5P_cls_close_func_t)H5P_cls_close_cb, (void *) close_data)) < 0)
+ if ((class_id =
+ H5Pcreate_class((hid_t)parent_class, cstr, (H5P_cls_create_func_t)H5P_cls_create_cb,
+ (void *)create_data, (H5P_cls_copy_func_t)H5P_cls_copy_cb, (void *)copy_data,
+ (H5P_cls_close_func_t)H5P_cls_close_cb, (void *)close_data)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -193,13 +192,13 @@ done:
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Pcreate_class_nocb
- * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
+ * Signature:
+ * (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb
- (JNIEnv *env, jclass clss, jlong parent_class, jstring name)
+Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb(JNIEnv *env, jclass clss, jlong parent_class, jstring name)
{
- const char *cstr = NULL;
+ const char *cstr = NULL;
hid_t class_id = H5I_INVALID_HID;
UNUSED(clss);
@@ -209,7 +208,7 @@ Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb
PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "_H5Pcreate_class_nocb: class name not pinned");
- if ((class_id = H5Pcreate_class((hid_t)parent_class, cstr, NULL, NULL, NULL, NULL, NULL, NULL)) < 0)
+ if ((class_id = H5Pcreate_class((hid_t)parent_class, cstr, NULL, NULL, NULL, NULL, NULL, NULL)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -222,39 +221,43 @@ done:
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pregister2
- * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
+ * Signature:
+ * (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pregister2
- (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size,
- jbyteArray def_value, jobject prp_create, jobject prp_set, jobject prp_get, jobject prp_delete,
- jobject prp_copy, jobject prp_cmp, jobject prp_close)
+Java_hdf_hdf5lib_H5_H5Pregister2(JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size,
+ jbyteArray def_value, jobject prp_create, jobject prp_set, jobject prp_get,
+ jobject prp_delete, jobject prp_copy, jobject prp_cmp, jobject prp_close)
{
const char *cstr = NULL;
jboolean isCopy;
- herr_t status = FAIL;
- jbyte *propValBuf = NULL;
+ herr_t status = FAIL;
+ jbyte * propValBuf = NULL;
UNUSED(clss);
- copy_callback = prp_copy;
- close_callback = prp_close;
- create_callback = prp_create;
+ copy_callback = prp_copy;
+ close_callback = prp_close;
+ create_callback = prp_create;
compare_callback = prp_cmp;
- set_callback = prp_set;
- get_callback = prp_get;
- delete_callback = prp_delete;
+ set_callback = prp_set;
+ get_callback = prp_get;
+ delete_callback = prp_delete;
if (NULL == name)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pregister2: property name is NULL");
PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pregister2: property name not pinned");
- PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy, "H5Pregister2: default property value buffer not pinned");
+ PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy,
+ "H5Pregister2: default property value buffer not pinned");
- if ((status = H5Pregister2((hid_t)cls_id, cstr, (size_t)prp_size, (void *)propValBuf, (H5P_prp_create_func_t)H5P_prp_create_cb,
- (H5P_prp_set_func_t)H5P_prp_set_cb, (H5P_prp_get_func_t)H5P_prp_get_cb, (H5P_prp_delete_func_t)H5P_prp_delete_cb,
- (H5P_prp_copy_func_t)H5P_prp_copy_cb, (H5P_prp_compare_func_t)H5P_prp_compare_cb, (H5P_prp_close_func_t)H5P_prp_close_cb)) < 0)
+ if ((status =
+ H5Pregister2((hid_t)cls_id, cstr, (size_t)prp_size, (void *)propValBuf,
+ (H5P_prp_create_func_t)H5P_prp_create_cb, (H5P_prp_set_func_t)H5P_prp_set_cb,
+ (H5P_prp_get_func_t)H5P_prp_get_cb, (H5P_prp_delete_func_t)H5P_prp_delete_cb,
+ (H5P_prp_copy_func_t)H5P_prp_copy_cb, (H5P_prp_compare_func_t)H5P_prp_compare_cb,
+ (H5P_prp_close_func_t)H5P_prp_close_cb)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -270,13 +273,13 @@ done:
* Signature: (JLjava/lang/String;J[B)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pregister2_1nocb
- (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, jbyteArray def_value)
+Java_hdf_hdf5lib_H5_H5Pregister2_1nocb(JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size,
+ jbyteArray def_value)
{
const char *cstr = NULL;
jboolean isCopy;
- herr_t status = FAIL;
- jbyte *propValBuf = NULL;
+ herr_t status = FAIL;
+ jbyte * propValBuf = NULL;
UNUSED(clss);
@@ -285,9 +288,11 @@ Java_hdf_hdf5lib_H5_H5Pregister2_1nocb
PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pregister2_nocb: property name not pinned");
- PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy, "H5Pregister2_nocb: default property value buffer not pinned");
+ PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy,
+ "H5Pregister2_nocb: default property value buffer not pinned");
- if ((status = H5Pregister2((hid_t)cls_id, cstr, (size_t)prp_size, (void *)propValBuf, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) < 0)
+ if ((status = H5Pregister2((hid_t)cls_id, cstr, (size_t)prp_size, (void *)propValBuf, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -300,27 +305,27 @@ done:
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pinsert2
- * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
+ * Signature:
+ * (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pinsert2
- (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size,
- jbyteArray def_value, jobject prp_set, jobject prp_get, jobject prp_delete,
- jobject prp_copy, jobject prp_cmp, jobject prp_close)
+Java_hdf_hdf5lib_H5_H5Pinsert2(JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size,
+ jbyteArray def_value, jobject prp_set, jobject prp_get, jobject prp_delete,
+ jobject prp_copy, jobject prp_cmp, jobject prp_close)
{
const char *cstr = NULL;
jboolean isCopy;
- herr_t status = FAIL;
- jbyte *propValBuf = NULL;
+ herr_t status = FAIL;
+ jbyte * propValBuf = NULL;
UNUSED(clss);
- copy_callback = prp_copy;
- close_callback = prp_close;
+ copy_callback = prp_copy;
+ close_callback = prp_close;
compare_callback = prp_cmp;
- set_callback = prp_set;
- get_callback = prp_get;
- delete_callback = prp_delete;
+ set_callback = prp_set;
+ get_callback = prp_get;
+ delete_callback = prp_delete;
if (NULL == name)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pinsert2: property name is NULL");
@@ -330,8 +335,10 @@ Java_hdf_hdf5lib_H5_H5Pinsert2
PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy, "H5Pinsert2: property value buffer not pinned");
if ((status = H5Pinsert2((hid_t)cls_id, cstr, (size_t)prp_size, (void *)propValBuf,
- (H5P_prp_set_func_t)H5P_prp_set_cb, (H5P_prp_get_func_t)H5P_prp_get_cb, (H5P_prp_delete_func_t)H5P_prp_delete_cb,
- (H5P_prp_copy_func_t)H5P_prp_copy_cb, (H5P_prp_compare_func_t)H5P_prp_compare_cb, (H5P_prp_close_func_t)H5P_prp_close_cb)) < 0)
+ (H5P_prp_set_func_t)H5P_prp_set_cb, (H5P_prp_get_func_t)H5P_prp_get_cb,
+ (H5P_prp_delete_func_t)H5P_prp_delete_cb, (H5P_prp_copy_func_t)H5P_prp_copy_cb,
+ (H5P_prp_compare_func_t)H5P_prp_compare_cb,
+ (H5P_prp_close_func_t)H5P_prp_close_cb)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -347,13 +354,13 @@ done:
* Signature: (JLjava/lang/String;J[B)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb
- (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, jbyteArray def_value)
+Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb(JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size,
+ jbyteArray def_value)
{
const char *cstr = NULL;
jboolean isCopy;
- herr_t status = FAIL;
- jbyte *propValBuf = NULL;
+ herr_t status = FAIL;
+ jbyte * propValBuf = NULL;
UNUSED(clss);
@@ -362,9 +369,11 @@ Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb
PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pinsert2_nocb: property name not pinned");
- PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy, "H5Pinsert2_nocb: property value buffer not pinned");
+ PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy,
+ "H5Pinsert2_nocb: property value buffer not pinned");
- if ((status = H5Pinsert2((hid_t)cls_id, cstr, (size_t)prp_size, (void *)propValBuf, NULL, NULL, NULL, NULL, NULL, NULL)) < 0)
+ if ((status = H5Pinsert2((hid_t)cls_id, cstr, (size_t)prp_size, (void *)propValBuf, NULL, NULL, NULL,
+ NULL, NULL, NULL)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -380,10 +389,9 @@ done:
* Signature: (JLjava/lang/String;I)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pset
- (JNIEnv *env, jclass clss, jlong plid, jstring name, jint val)
+Java_hdf_hdf5lib_H5_H5Pset(JNIEnv *env, jclass clss, jlong plid, jstring name, jint val)
{
- const char *cstr = NULL;
+ const char *cstr = NULL;
hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
@@ -409,8 +417,7 @@ done:
* Signature: (JLjava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pexist
- (JNIEnv *env, jclass clss, jlong plid, jstring name)
+Java_hdf_hdf5lib_H5_H5Pexist(JNIEnv *env, jclass clss, jlong plid, jstring name)
{
const char *cstr = NULL;
htri_t bval = JNI_FALSE;
@@ -440,11 +447,10 @@ done:
* Signature: (JLjava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1size
- (JNIEnv *env, jclass clss, jlong plid, jstring name)
+Java_hdf_hdf5lib_H5_H5Pget_1size(JNIEnv *env, jclass clss, jlong plid, jstring name)
{
- const char *cstr = NULL;
- size_t size = 0;
+ const char *cstr = NULL;
+ size_t size = 0;
herr_t status = FAIL;
UNUSED(clss);
@@ -461,7 +467,7 @@ done:
if (cstr)
UNPIN_JAVA_STRING(ENVONLY, name, cstr);
- return (jlong) size;
+ return (jlong)size;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1size */
/*
@@ -470,8 +476,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1nprops
- (JNIEnv *env, jclass clss, jlong plid)
+Java_hdf_hdf5lib_H5_H5Pget_1nprops(JNIEnv *env, jclass clss, jlong plid)
{
size_t nprops = 0;
@@ -490,11 +495,10 @@ done:
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1class_1name
- (JNIEnv *env, jclass clss, jlong plid)
+Java_hdf_hdf5lib_H5_H5Pget_1class_1name(JNIEnv *env, jclass clss, jlong plid)
{
- char *c_str = NULL;
- jstring j_str = NULL;
+ char * c_str = NULL;
+ jstring j_str = NULL;
UNUSED(clss);
@@ -503,7 +507,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1class_1name
if (NULL == (j_str = ENVPTR->NewStringUTF(ENVONLY, c_str))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_class_name: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY, "H5Pget_class_name: out of memory - unable to construct string from UTF characters");
}
done:
@@ -519,8 +524,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1class_1parent
- (JNIEnv *env, jclass clss, jlong plid)
+Java_hdf_hdf5lib_H5_H5Pget_1class_1parent(JNIEnv *env, jclass clss, jlong plid)
{
hid_t retVal = H5I_INVALID_HID;
@@ -539,8 +543,7 @@ done:
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pisa_1class
- (JNIEnv *env, jclass clss, jlong plid, jlong pcls)
+Java_hdf_hdf5lib_H5_H5Pisa_1class(JNIEnv *env, jclass clss, jlong plid, jlong pcls)
{
htri_t retVal = FAIL;
@@ -559,8 +562,7 @@ done:
* Signature: (JLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget
- (JNIEnv *env, jclass clss, jlong plid, jstring name)
+Java_hdf_hdf5lib_H5_H5Pget(JNIEnv *env, jclass clss, jlong plid, jstring name)
{
const char *cstr = NULL;
jint val;
@@ -589,8 +591,7 @@ done:
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pequal
- (JNIEnv *env, jclass clss, jlong plid1, jlong plid2)
+Java_hdf_hdf5lib_H5_H5Pequal(JNIEnv *env, jclass clss, jlong plid1, jlong plid2)
{
htri_t retVal = FAIL;
@@ -609,13 +610,13 @@ done:
* Signature: (J[ILjava/lang/Object;Ljava/lang/Object;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Piterate
- (JNIEnv *env, jclass clss, jlong prop_id, jintArray idx, jobject callback_op, jobject op_data)
+Java_hdf_hdf5lib_H5_H5Piterate(JNIEnv *env, jclass clss, jlong prop_id, jintArray idx, jobject callback_op,
+ jobject op_data)
{
- cb_wrapper wrapper = { callback_op, op_data };
- jboolean isCopy;
- jint *theArray = NULL;
- herr_t status = FAIL;
+ cb_wrapper wrapper = {callback_op, op_data};
+ jboolean isCopy;
+ jint * theArray = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -634,7 +635,8 @@ Java_hdf_hdf5lib_H5_H5Piterate
else {
PIN_INT_ARRAY(ENVONLY, idx, theArray, &isCopy, "H5Piterate: idx not pinned");
- if ((status = H5Piterate((hid_t)prop_id, (int *)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void *)&wrapper)) < 0)
+ if ((status = H5Piterate((hid_t)prop_id, (int *)&theArray[0], (H5P_iterate_t)H5P_iterate_cb,
+ (void *)&wrapper)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
}
@@ -651,10 +653,9 @@ done:
* Signature: (JJLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pcopy_1prop
- (JNIEnv *env, jclass clss, jlong dst_plid, jlong src_plid, jstring name)
+Java_hdf_hdf5lib_H5_H5Pcopy_1prop(JNIEnv *env, jclass clss, jlong dst_plid, jlong src_plid, jstring name)
{
- const char *cstr = NULL;
+ const char *cstr = NULL;
herr_t retVal = FAIL;
UNUSED(clss);
@@ -680,10 +681,9 @@ done:
* Signature: (JLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Premove
- (JNIEnv *env, jclass clss, jlong plid, jstring name)
+Java_hdf_hdf5lib_H5_H5Premove(JNIEnv *env, jclass clss, jlong plid, jstring name)
{
- const char *cstr = NULL;
+ const char *cstr = NULL;
herr_t retVal = FAIL;
UNUSED(clss);
@@ -709,10 +709,9 @@ done:
* Signature: (JLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Punregister
- (JNIEnv *env, jclass clss, jlong plid, jstring name)
+Java_hdf_hdf5lib_H5_H5Punregister(JNIEnv *env, jclass clss, jlong plid, jstring name)
{
- const char *cstr = NULL;
+ const char *cstr = NULL;
herr_t retVal = FAIL;
UNUSED(clss);
@@ -738,8 +737,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Pclose_1class
- (JNIEnv *env, jclass clss, jlong plid)
+Java_hdf_hdf5lib_H5__1H5Pclose_1class(JNIEnv *env, jclass clss, jlong plid)
{
herr_t retVal = FAIL;
@@ -753,13 +751,12 @@ done:
} /* end Java_hdf_hdf5lib_H5__1H5Pclose_1class */
static herr_t
-H5P_cls_create_cb
- (hid_t prop_id, void *create_data)
+H5P_cls_create_cb(hid_t prop_id, void *create_data)
{
- jmethodID mid;
- JNIEnv *cbenv = NULL;
- jclass cls;
- jint status = -1;
+ jmethodID mid;
+ JNIEnv * cbenv = NULL;
+ jclass cls;
+ jint status = -1;
if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
@@ -769,7 +766,8 @@ H5P_cls_create_cb
if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, create_callback)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLhdf/hdf5lib/callbacks/H5P_cls_create_func_t;)I")))
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback",
+ "(JLhdf/hdf5lib/callbacks/H5P_cls_create_func_t;)I")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
status = CBENVPTR->CallIntMethod(CBENVONLY, create_callback, mid, prop_id, create_data);
@@ -783,13 +781,12 @@ done:
} /* end H5P_cls_create_cb */
static herr_t
-H5P_cls_copy_cb
- (hid_t new_prop_id, hid_t old_prop_id, void *copy_data)
+H5P_cls_copy_cb(hid_t new_prop_id, hid_t old_prop_id, void *copy_data)
{
- jmethodID mid;
- JNIEnv *cbenv = NULL;
- jclass cls;
- jint status = -1;
+ jmethodID mid;
+ JNIEnv * cbenv = NULL;
+ jclass cls;
+ jint status = -1;
if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
@@ -799,7 +796,8 @@ H5P_cls_copy_cb
if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, copy_callback)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JJLhdf/hdf5lib/callbacks/H5P_cls_copy_func_t;)I")))
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback",
+ "(JJLhdf/hdf5lib/callbacks/H5P_cls_copy_func_t;)I")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
status = CBENVPTR->CallIntMethod(CBENVONLY, copy_callback, mid, new_prop_id, old_prop_id, copy_data);
@@ -813,13 +811,12 @@ done:
} /* end H5P_cls_copy_cb */
static herr_t
-H5P_cls_close_cb
- (hid_t prop_id, void *close_data)
+H5P_cls_close_cb(hid_t prop_id, void *close_data)
{
- jmethodID mid;
- JNIEnv *cbenv = NULL;
- jclass cls;
- jint status = -1;
+ jmethodID mid;
+ JNIEnv * cbenv = NULL;
+ jclass cls;
+ jint status = -1;
if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
@@ -829,7 +826,8 @@ H5P_cls_close_cb
if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, close_callback)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLhdf/hdf5lib/callbacks/H5P_cls_close_func_t;)I")))
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback",
+ "(JLhdf/hdf5lib/callbacks/H5P_cls_close_func_t;)I")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
status = CBENVPTR->CallIntMethod(CBENVONLY, close_callback, mid, prop_id, close_data);
@@ -843,14 +841,13 @@ done:
} /* end H5P_cls_close_cb */
static herr_t
-H5P_prp_create_cb
- (const char *name, size_t size, void *value)
+H5P_prp_create_cb(const char *name, size_t size, void *value)
{
- jmethodID mid;
- jstring str;
- jclass cls;
- JNIEnv *cbenv = NULL;
- jint status = -1;
+ jmethodID mid;
+ jstring str;
+ jclass cls;
+ JNIEnv * cbenv = NULL;
+ jint status = -1;
if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
@@ -877,14 +874,13 @@ done:
} /* end H5P_prp_create_cb */
static herr_t
-H5P_prp_set_cb
- (hid_t prop_id, const char *name, size_t size, void *value)
+H5P_prp_set_cb(hid_t prop_id, const char *name, size_t size, void *value)
{
- jmethodID mid;
- jstring str;
- jclass cls;
- JNIEnv *cbenv = NULL;
- jint status = -1;
+ jmethodID mid;
+ jstring str;
+ jclass cls;
+ JNIEnv * cbenv = NULL;
+ jint status = -1;
if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
@@ -911,14 +907,13 @@ done:
} /* end H5P_prp_set_cb */
static herr_t
-H5P_prp_get_cb
- (hid_t prop_id, const char *name, size_t size, void *value)
+H5P_prp_get_cb(hid_t prop_id, const char *name, size_t size, void *value)
{
- jmethodID mid;
- jstring str;
- jclass cls;
- JNIEnv *cbenv = NULL;
- jint status = -1;
+ jmethodID mid;
+ jstring str;
+ jclass cls;
+ JNIEnv * cbenv = NULL;
+ jint status = -1;
if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
@@ -945,14 +940,13 @@ done:
} /* end H5P_prp_get_cb */
static herr_t
-H5P_prp_delete_cb
- (hid_t prop_id, const char *name, size_t size, void *value)
+H5P_prp_delete_cb(hid_t prop_id, const char *name, size_t size, void *value)
{
- jmethodID mid;
- jstring str;
- jclass cls;
- JNIEnv *cbenv = NULL;
- jint status = -1;
+ jmethodID mid;
+ jstring str;
+ jclass cls;
+ JNIEnv * cbenv = NULL;
+ jint status = -1;
if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
@@ -979,14 +973,13 @@ done:
} /* end H5P_prp_delete_cb */
static herr_t
-H5P_prp_copy_cb
- (const char *name, size_t size, void *value)
+H5P_prp_copy_cb(const char *name, size_t size, void *value)
{
- jmethodID mid;
- jstring str;
- jclass cls;
- JNIEnv *cbenv = NULL;
- jint status = -1;
+ jmethodID mid;
+ jstring str;
+ jclass cls;
+ JNIEnv * cbenv = NULL;
+ jint status = -1;
if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
@@ -1013,13 +1006,12 @@ done:
} /* end H5P_prp_copy_cb */
static int
-H5P_prp_compare_cb
- (void *value1, void *value2, size_t size)
+H5P_prp_compare_cb(void *value1, void *value2, size_t size)
{
- jmethodID mid;
- jclass cls;
- JNIEnv *cbenv = NULL;
- jint status = -1;
+ jmethodID mid;
+ jclass cls;
+ JNIEnv * cbenv = NULL;
+ jint status = -1;
if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
@@ -1043,14 +1035,13 @@ done:
} /* end H5P_prp_compare_cb */
static herr_t
-H5P_prp_close_cb
- (const char *name, size_t size, void *value)
+H5P_prp_close_cb(const char *name, size_t size, void *value)
{
- jmethodID mid;
- jstring str;
- jclass cls;
- JNIEnv *cbenv = NULL;
- jint status = -1;
+ jmethodID mid;
+ jstring str;
+ jclass cls;
+ JNIEnv * cbenv = NULL;
+ jint status = -1;
if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
@@ -1077,19 +1068,18 @@ done:
} /* end H5P_prp_close_cb */
static herr_t
-H5P_iterate_cb
- (hid_t prop_id, const char *name, void *cb_data)
+H5P_iterate_cb(hid_t prop_id, const char *name, void *cb_data)
{
- cb_wrapper *wrapper = (cb_wrapper *) cb_data;
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
jmethodID mid;
jobject visit_callback = wrapper->visit_callback;
jstring str;
jclass cls;
- JNIEnv *cbenv = NULL;
- void *op_data = (void *) wrapper->op_data;
- jint status = -1;
+ JNIEnv * cbenv = NULL;
+ void * op_data = (void *)wrapper->op_data;
+ jint status = -1;
- if (JVMPTR->AttachCurrentThread(JVMPAR, (void**)&cbenv, NULL) < 0) {
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_iterate_cb: failed to attach current thread to JVM");
}
@@ -1097,7 +1087,8 @@ H5P_iterate_cb
if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/callbacks/H5P_iterate_t;)I")))
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback",
+ "(JLjava/lang/String;Lhdf/hdf5lib/callbacks/H5P_iterate_t;)I")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h
index 8318be4..b35bf94 100644
--- a/java/src/jni/h5pImp.h
+++ b/java/src/jni/h5pImp.h
@@ -27,36 +27,28 @@ extern "C" {
* Method: H5Pcreate
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pcreate
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Pcreate(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_class
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1class
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1class(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pcopy
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pcopy
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Pcopy(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pclose
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Pclose
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Pclose(JNIEnv *, jclass, jlong);
/*
* TODO: H5Pencode
@@ -69,182 +61,151 @@ Java_hdf_hdf5lib_H5__1H5Pclose
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Pcreate_class
- * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
+ * Signature:
+ * (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pcreate_1class
- (JNIEnv*, jclass, jlong, jstring, jobject, jobject, jobject, jobject, jobject, jobject);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Pcreate_1class(JNIEnv *, jclass, jlong, jstring, jobject,
+ jobject, jobject, jobject, jobject, jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Pcreate_class_nocb
* Signature: (JLjava/lang/String;)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb
- (JNIEnv*, jclass, jlong, jstring);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pregister2
- * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
+ * Signature:
+ * (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pregister2
- (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray, jobject, jobject, jobject, jobject, jobject, jobject, jobject);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pregister2(JNIEnv *, jclass, jlong, jstring, jlong, jbyteArray,
+ jobject, jobject, jobject, jobject, jobject, jobject,
+ jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pregister2_nocb
* Signature: (JLjava/lang/String;J[B)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pregister2_1nocb
- (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pregister2_1nocb(JNIEnv *, jclass, jlong, jstring, jlong,
+ jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pinsert2
- * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
+ * Signature:
+ * (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pinsert2
- (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray, jobject, jobject, jobject, jobject, jobject, jobject);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pinsert2(JNIEnv *, jclass, jlong, jstring, jlong, jbyteArray,
+ jobject, jobject, jobject, jobject, jobject, jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pinsert2_nocb
* Signature: (JLjava/lang/String;J[B)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb
- (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb(JNIEnv *, jclass, jlong, jstring, jlong,
+ jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset
* Signature: (JLjava/lang/String;I)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pset
-(JNIEnv *, jclass, jlong, jstring, jint);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pset(JNIEnv *, jclass, jlong, jstring, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pexist
* Signature: (JLjava/lang/String;)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pexist
-(JNIEnv *, jclass, jlong, jstring);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pexist(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_size
* Signature: (JLjava/lang/String;)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1size
-(JNIEnv *, jclass, jlong, jstring);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1size(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_nprops
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1nprops
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1nprops(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_class_name
* Signature: (J)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1class_1name
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Pget_1class_1name(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_class_parent
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1class_1parent
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1class_1parent(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pisa_class
* Signature: (JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pisa_1class
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pisa_1class(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget
* Signature: (JLjava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget
-(JNIEnv *, jclass, jlong, jstring);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pequal
* Signature: (JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pequal
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pequal(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Piterate
* Signature: (J[ILjava/lang/Object;Ljava/lang/Object;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Piterate
- (JNIEnv*, jclass, jlong, jintArray, jobject, jobject);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Piterate(JNIEnv *, jclass, jlong, jintArray, jobject, jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pcopy_prop
* Signature: (JJLjava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pcopy_1prop
-(JNIEnv *, jclass, jlong, jlong, jstring);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pcopy_1prop(JNIEnv *, jclass, jlong, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Premove
* Signature: (JLjava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Premove
-(JNIEnv *, jclass, jlong, jstring);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Premove(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Punregister
* Signature: (JLjava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Punregister
-(JNIEnv *, jclass, jlong, jstring);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Punregister(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Pclose_class
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Pclose_1class
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Pclose_1class(JNIEnv *, jclass, jlong);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5pLAPLImp.c b/java/src/jni/h5pLAPLImp.c
index 754bece..01b2bb1 100644
--- a/java/src/jni/h5pLAPLImp.c
+++ b/java/src/jni/h5pLAPLImp.c
@@ -37,8 +37,7 @@ extern "C" {
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1nlinks
- (JNIEnv *env, jclass clss, jlong lapl_id, jlong nlinks)
+Java_hdf_hdf5lib_H5_H5Pset_1nlinks(JNIEnv *env, jclass clss, jlong lapl_id, jlong nlinks)
{
herr_t retVal = FAIL;
@@ -60,8 +59,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1nlinks
- (JNIEnv *env, jclass clss, jlong lapl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1nlinks(JNIEnv *env, jclass clss, jlong lapl_id)
{
size_t nlinks = 0;
@@ -71,7 +69,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1nlinks
H5_LIBRARY_ERROR(ENVONLY);
done:
- return (jlong) nlinks;
+ return (jlong)nlinks;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1nlinks */
/*
@@ -88,11 +86,10 @@ done:
* Signature: (JLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix
- (JNIEnv *env, jclass clss, jlong lapl_id, jstring prefix)
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix(JNIEnv *env, jclass clss, jlong lapl_id, jstring prefix)
{
const char *linkPrefix = NULL;
- herr_t retVal = FAIL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -117,13 +114,12 @@ done:
* Signature: (J[Ljava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix
- (JNIEnv *env, jclass clss, jlong lapl_id, jobjectArray prefix)
+Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix(JNIEnv *env, jclass clss, jlong lapl_id, jobjectArray prefix)
{
- ssize_t prefix_size = -1;
- size_t size = 0;
- char *pre = NULL;
- jstring str = NULL;
+ ssize_t prefix_size = -1;
+ size_t size = 0;
+ char * pre = NULL;
+ jstring str = NULL;
UNUSED(clss);
@@ -133,16 +129,17 @@ Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix
if ((prefix_size = H5Pget_elink_prefix((hid_t)lapl_id, (char *)NULL, size)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (pre = (char *) HDmalloc(sizeof(char) * (size_t) prefix_size + 1)))
+ if (NULL == (pre = (char *)HDmalloc(sizeof(char) * (size_t)prefix_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_elink_prefix: memory allocation failed");
- if (H5Pget_elink_prefix((hid_t)lapl_id, (char *)pre, (size_t) prefix_size + 1) < 0)
+ if (H5Pget_elink_prefix((hid_t)lapl_id, (char *)pre, (size_t)prefix_size + 1) < 0)
H5_LIBRARY_ERROR(ENVONLY);
pre[prefix_size] = '\0';
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, pre))) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_elink_prefix: out of memory - unable to construct string from UTF characters");
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY, "H5Pget_elink_prefix: out of memory - unable to construct string from UTF characters");
}
ENVPTR->SetObjectArrayElement(ENVONLY, prefix, 0, str);
@@ -161,8 +158,7 @@ done:
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl
- (JNIEnv *env, jclass clss, jlong lapl_id, jlong fapl_id)
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl(JNIEnv *env, jclass clss, jlong lapl_id, jlong fapl_id)
{
herr_t retVal = FAIL;
@@ -181,8 +177,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl
- (JNIEnv *env, jclass clss, jlong lapl_id)
+Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl(JNIEnv *env, jclass clss, jlong lapl_id)
{
hid_t retVal = H5I_INVALID_HID;
@@ -201,8 +196,7 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags
- (JNIEnv *env, jclass clss, jlong lapl_id, jint flags)
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags(JNIEnv *env, jclass clss, jlong lapl_id, jint flags)
{
herr_t retVal = FAIL;
@@ -212,7 +206,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags
H5_LIBRARY_ERROR(ENVONLY);
done:
- return (jint) retVal;
+ return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags */
/*
@@ -221,8 +215,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags
- (JNIEnv *env, jclass clss, jlong lapl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags(JNIEnv *env, jclass clss, jlong lapl_id)
{
unsigned flags;
diff --git a/java/src/jni/h5pLAPLImp.h b/java/src/jni/h5pLAPLImp.h
index 8efcfb5..c08e0c9 100644
--- a/java/src/jni/h5pLAPLImp.h
+++ b/java/src/jni/h5pLAPLImp.h
@@ -25,18 +25,14 @@ extern "C" {
* Method: H5Pset_nlinks
* Signature: (JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1nlinks
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1nlinks(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_nlinks
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1nlinks
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1nlinks(JNIEnv *, jclass, jlong);
/*
* TODO: H5Pset_elink_cb
@@ -51,54 +47,42 @@ Java_hdf_hdf5lib_H5_H5Pget_1nlinks
* Method: H5Pset_elink_prefix
* Signature: (JLjava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix
-(JNIEnv *, jclass, jlong, jstring);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_elink_prefix
* Signature: (J[Ljava/lang/String;)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix
-(JNIEnv *, jclass, jlong, jobjectArray);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix(JNIEnv *, jclass, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_elink_fapl
* Signature: (JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Pget_elink_fapl
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_elink_acc_flags
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_elink_acc_flags
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags(JNIEnv *, jclass, jlong);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5pOCPLImp.c b/java/src/jni/h5pOCPLImp.c
index 241842e..68fe471 100644
--- a/java/src/jni/h5pOCPLImp.c
+++ b/java/src/jni/h5pOCPLImp.c
@@ -37,8 +37,8 @@ extern "C" {
* Signature: (JZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group
- (JNIEnv *env, jclass clss, jlong lcpl_id, jboolean crt_intermed_group)
+Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group(JNIEnv *env, jclass clss, jlong lcpl_id,
+ jboolean crt_intermed_group)
{
herr_t retVal = FAIL;
@@ -57,8 +57,7 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group
- (JNIEnv *env, jclass clss, jlong lcpl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group(JNIEnv *env, jclass clss, jlong lcpl_id)
{
unsigned crt_intermed_group = 0;
@@ -77,8 +76,7 @@ done:
* Signature: (JZ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times
- (JNIEnv *env, jclass clss, jlong objplid, jboolean track_times)
+Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times(JNIEnv *env, jclass clss, jlong objplid, jboolean track_times)
{
hbool_t track = FALSE;
@@ -99,11 +97,10 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times
- (JNIEnv *env, jclass clss, jlong objplid)
+Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times(JNIEnv *env, jclass clss, jlong objplid)
{
hbool_t track_times = FALSE;
- jboolean retVal = JNI_FALSE;
+ jboolean retVal = JNI_FALSE;
UNUSED(clss);
@@ -122,8 +119,8 @@ done:
* Signature: (JII)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change
- (JNIEnv *env, jclass clss, jlong ocpl_id, jint max_compact, jint min_dense)
+Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change(JNIEnv *env, jclass clss, jlong ocpl_id, jint max_compact,
+ jint min_dense)
{
herr_t retVal = FAIL;
@@ -142,12 +139,11 @@ done:
* Signature: (J[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change
- (JNIEnv *env, jclass clss, jlong ocpl_id, jintArray attributes)
+Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change(JNIEnv *env, jclass clss, jlong ocpl_id, jintArray attributes)
{
- jboolean isCopy;
- jint *theArray = NULL;
- herr_t retVal = FAIL;
+ jboolean isCopy;
+ jint * theArray = NULL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -156,7 +152,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change
PIN_INT_ARRAY(ENVONLY, attributes, theArray, &isCopy, "H5Pget_attr_phase_change: input not pinned");
- if ((retVal = H5Pget_attr_phase_change((hid_t)ocpl_id, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ if ((retVal = H5Pget_attr_phase_change((hid_t)ocpl_id, (unsigned *)&(theArray[0]),
+ (unsigned *)&(theArray[1]))) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -172,8 +169,8 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order
- (JNIEnv *env, jclass clss, jlong ocpl_id, jint crt_order_flags)
+Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order(JNIEnv *env, jclass clss, jlong ocpl_id,
+ jint crt_order_flags)
{
herr_t retVal = FAIL;
@@ -192,8 +189,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order
- (JNIEnv *env, jclass clss, jlong ocpl_id)
+Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order(JNIEnv *env, jclass clss, jlong ocpl_id)
{
unsigned crt_order_flags = 0;
diff --git a/java/src/jni/h5pOCPLImp.h b/java/src/jni/h5pOCPLImp.h
index fe01f06..ad45ab9 100644
--- a/java/src/jni/h5pOCPLImp.h
+++ b/java/src/jni/h5pOCPLImp.h
@@ -25,72 +25,57 @@ extern "C" {
* Method: H5Pset_create_intermediate_group
* Signature: (JZ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group
-(JNIEnv *, jclass, jlong, jboolean);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group(JNIEnv *, jclass, jlong,
+ jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_create_intermediate_group
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_obj_track_times
* Signature: (JZ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times
-(JNIEnv *, jclass, jlong, jboolean);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times(JNIEnv *, jclass, jlong, jboolean);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_obj_track_times
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_attr_phase_change
* Signature: (JII)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change
-(JNIEnv *, jclass, jlong, jint, jint);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change(JNIEnv *, jclass, jlong, jint, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_attr_phase_change
* Signature: (J[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change
-(JNIEnv *, jclass, jlong, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change(JNIEnv *, jclass, jlong, jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_attr_creation_order
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_attr_creation_order
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order(JNIEnv *, jclass, jlong);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5pOCpyPLImp.c b/java/src/jni/h5pOCpyPLImp.c
index 9481f91..81664ce 100644
--- a/java/src/jni/h5pOCpyPLImp.c
+++ b/java/src/jni/h5pOCpyPLImp.c
@@ -37,8 +37,7 @@ extern "C" {
* Signature: (JI)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1copy_1object
- (JNIEnv *env, jclass clss, jlong ocp_plist_id, jint copy_options)
+Java_hdf_hdf5lib_H5_H5Pset_1copy_1object(JNIEnv *env, jclass clss, jlong ocp_plist_id, jint copy_options)
{
herr_t retVal = FAIL;
@@ -57,8 +56,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1copy_1object
- (JNIEnv *env, jclass clss, jlong ocp_plist_id)
+Java_hdf_hdf5lib_H5_H5Pget_1copy_1object(JNIEnv *env, jclass clss, jlong ocp_plist_id)
{
unsigned copy_options = 0;
diff --git a/java/src/jni/h5pOCpyPLImp.h b/java/src/jni/h5pOCpyPLImp.h
index f1dca58..662fba1 100644
--- a/java/src/jni/h5pOCpyPLImp.h
+++ b/java/src/jni/h5pOCpyPLImp.h
@@ -25,18 +25,14 @@ extern "C" {
* Method: H5Pset_copy_object
* Signature: (JI)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1copy_1object
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1copy_1object(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_copy_object
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1copy_1object
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1copy_1object(JNIEnv *, jclass, jlong);
/*
* TODO: H5Padd_merge_committed_dtype_path
diff --git a/java/src/jni/h5pStrCPLImp.c b/java/src/jni/h5pStrCPLImp.c
index e69847d..aceeb0b 100644
--- a/java/src/jni/h5pStrCPLImp.c
+++ b/java/src/jni/h5pStrCPLImp.c
@@ -37,8 +37,7 @@ extern "C" {
* Signature: (JI)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding
- (JNIEnv *env, jclass clss, jlong acpl, jint encoding)
+Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding(JNIEnv *env, jclass clss, jlong acpl, jint encoding)
{
UNUSED(clss);
@@ -55,8 +54,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding
- (JNIEnv *env, jclass clss, jlong acpl)
+Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding(JNIEnv *env, jclass clss, jlong acpl)
{
H5T_cset_t encoding = H5T_CSET_ERROR;
diff --git a/java/src/jni/h5pStrCPLImp.h b/java/src/jni/h5pStrCPLImp.h
index 6e140d3..1e89314 100644
--- a/java/src/jni/h5pStrCPLImp.h
+++ b/java/src/jni/h5pStrCPLImp.h
@@ -25,18 +25,14 @@ extern "C" {
* Method: H5Pset_char_encoding
* Signature: (JI)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pget_char_encoding
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding(JNIEnv *, jclass, jlong);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5plImp.c b/java/src/jni/h5plImp.c
index ce42842..4d2743a 100644
--- a/java/src/jni/h5plImp.c
+++ b/java/src/jni/h5plImp.c
@@ -37,8 +37,7 @@ extern "C" {
* Signature: (I)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5PLset_1loading_1state
- (JNIEnv *env, jclass clss, jint plugin_flags)
+Java_hdf_hdf5lib_H5_H5PLset_1loading_1state(JNIEnv *env, jclass clss, jint plugin_flags)
{
UNUSED(clss);
@@ -55,8 +54,7 @@ done:
* Signature: (V)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5PLget_1loading_1state
- (JNIEnv *env, jclass clss)
+Java_hdf_hdf5lib_H5_H5PLget_1loading_1state(JNIEnv *env, jclass clss)
{
unsigned int plugin_type = 0;
@@ -75,11 +73,10 @@ done:
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5PLappend
- (JNIEnv *env, jclass clss, jobjectArray plugin_path)
+Java_hdf_hdf5lib_H5_H5PLappend(JNIEnv *env, jclass clss, jobjectArray plugin_path)
{
const char *newPath = NULL;
- herr_t retVal = FAIL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -101,11 +98,10 @@ done:
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5PLprepend
- (JNIEnv *env, jclass clss, jobjectArray plugin_path)
+Java_hdf_hdf5lib_H5_H5PLprepend(JNIEnv *env, jclass clss, jobjectArray plugin_path)
{
const char *newPath = NULL;
- herr_t retVal = FAIL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -128,11 +124,10 @@ done:
* Signature: (Ljava/lang/String;I)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5PLreplace
- (JNIEnv *env, jclass clss, jobjectArray plugin_path, jint idx)
+Java_hdf_hdf5lib_H5_H5PLreplace(JNIEnv *env, jclass clss, jobjectArray plugin_path, jint idx)
{
const char *newPath = NULL;
- herr_t retVal = FAIL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -144,7 +139,7 @@ Java_hdf_hdf5lib_H5_H5PLreplace
PIN_JAVA_STRING(ENVONLY, plugin_path, newPath, NULL, "H5PLreplace: new path not pinned");
- if ((retVal = H5PLreplace(newPath, (unsigned) idx)) < 0)
+ if ((retVal = H5PLreplace(newPath, (unsigned)idx)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -158,11 +153,10 @@ done:
* Signature: (Ljava/lang/String;I)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5PLinsert
- (JNIEnv *env, jclass clss, jobjectArray plugin_path, jint idx)
+Java_hdf_hdf5lib_H5_H5PLinsert(JNIEnv *env, jclass clss, jobjectArray plugin_path, jint idx)
{
const char *newPath = NULL;
- herr_t retVal = FAIL;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -174,7 +168,7 @@ Java_hdf_hdf5lib_H5_H5PLinsert
PIN_JAVA_STRING(ENVONLY, plugin_path, newPath, NULL, "H5PLinsert: new path not pinned");
- if ((retVal = H5PLinsert(newPath, (unsigned) idx)) < 0)
+ if ((retVal = H5PLinsert(newPath, (unsigned)idx)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -188,15 +182,14 @@ done:
* Signature: (I)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5PLremove
- (JNIEnv *env, jclass clss, jint idx)
+Java_hdf_hdf5lib_H5_H5PLremove(JNIEnv *env, jclass clss, jint idx)
{
UNUSED(clss);
if (idx < 0)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLremove: index < 0");
- if (H5PLremove((unsigned) idx) < 0)
+ if (H5PLremove((unsigned)idx) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -209,12 +202,11 @@ done:
* Signature: (I)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5PLget
- (JNIEnv *env, jclass clss, jint idx)
+Java_hdf_hdf5lib_H5_H5PLget(JNIEnv *env, jclass clss, jint idx)
{
- jstring str = NULL;
- ssize_t buf_size;
- char *aName = NULL;
+ jstring str = NULL;
+ ssize_t buf_size;
+ char * aName = NULL;
UNUSED(clss);
@@ -222,13 +214,13 @@ Java_hdf_hdf5lib_H5_H5PLget
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLget: index < 0");
/* Get the length of the name */
- if ((buf_size = H5PLget((unsigned) idx, NULL, 0)) < 0)
+ if ((buf_size = H5PLget((unsigned)idx, NULL, 0)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ if (NULL == (aName = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5PLget: failed to allocate plugin name buffer");
- if ((H5PLget((unsigned) idx, aName, (size_t)buf_size + 1)) < 0)
+ if ((H5PLget((unsigned)idx, aName, (size_t)buf_size + 1)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
aName[buf_size] = '\0';
@@ -248,8 +240,7 @@ done:
* Signature: (V)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5PLsize
- (JNIEnv *env, jclass clss)
+Java_hdf_hdf5lib_H5_H5PLsize(JNIEnv *env, jclass clss)
{
unsigned int listsize = 0;
diff --git a/java/src/jni/h5plImp.h b/java/src/jni/h5plImp.h
index 5336621..82b0699 100644
--- a/java/src/jni/h5plImp.h
+++ b/java/src/jni/h5plImp.h
@@ -26,81 +26,63 @@ extern "C" {
* Method: H5PLset_loading_state
* Signature: (I)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5PLset_1loading_1state
- (JNIEnv *, jclass, jint);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5PLset_1loading_1state(JNIEnv *, jclass, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5PLget_loading_state
* Signature: (V)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5PLget_1loading_1state
- (JNIEnv *, jclass);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5PLget_1loading_1state(JNIEnv *, jclass);
/*
* Class: hdf_hdf5lib_H5
* Method: H5PLappend
* Signature: (Ljava/lang/String;)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5PLappend
- (JNIEnv *, jclass, jobjectArray);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5PLappend(JNIEnv *, jclass, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5PLprepend
* Signature: (Ljava/lang/String;)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5PLprepend
- (JNIEnv *, jclass, jobjectArray);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5PLprepend(JNIEnv *, jclass, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5PLreplace
* Signature: (Ljava/lang/String;I)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5PLreplace
- (JNIEnv *, jclass, jobjectArray, jint);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5PLreplace(JNIEnv *, jclass, jobjectArray, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5PLinsert
* Signature: (Ljava/lang/String;I)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5PLinsert
- (JNIEnv *, jclass, jobjectArray, jint);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5PLinsert(JNIEnv *, jclass, jobjectArray, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5PLremove
* Signature: (I)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5PLremove
- (JNIEnv *, jclass, jint);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5PLremove(JNIEnv *, jclass, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5PLget
* Signature: (I)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5PLget
- (JNIEnv *, jclass, jint);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5PLget(JNIEnv *, jclass, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5PLsize
* Signature: (V)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5PLsize
- (JNIEnv *, jclass);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5PLsize(JNIEnv *, jclass);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c
index e24fc2a..abdd8a1 100644
--- a/java/src/jni/h5rImp.c
+++ b/java/src/jni/h5rImp.c
@@ -26,7 +26,6 @@ extern "C" {
#include "h5jni.h"
#include "h5rImp.h"
-
/* H5R: HDF5 1.12 Reference API Functions */
/*
@@ -35,13 +34,12 @@ extern "C" {
* Signature: (JLjava/lang/String;)[B
*/
JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_H5_H5Rcreate_1object
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong aid)
+Java_hdf_hdf5lib_H5_H5Rcreate_1object(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong aid)
{
const char *refName = NULL;
- jbyteArray ref = NULL;
- jbyte *refBuf = NULL;
- herr_t status = FAIL;
+ jbyteArray ref = NULL;
+ jbyte * refBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -71,20 +69,19 @@ done:
return ref;
} /* end Java_hdf_hdf5lib_H5_H5Rcreate_1object */
-
/*
* Class: hdf_hdf5lib_H5
* Method: H5Rcreate_region
* Signature: (JLjava/lang/String;J)[B
*/
JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_H5_H5Rcreate_1region
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong space_id, jlong aid)
+Java_hdf_hdf5lib_H5_H5Rcreate_1region(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong space_id,
+ jlong aid)
{
const char *refName = NULL;
- jbyteArray ref = NULL;
- jbyte *refBuf = NULL;
- herr_t status = FAIL;
+ jbyteArray ref = NULL;
+ jbyte * refBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -96,7 +93,8 @@ Java_hdf_hdf5lib_H5_H5Rcreate_1region
if (NULL == (refBuf = HDcalloc(1, H5R_REF_BUF_SIZE)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rcreate_region: failed to allocate reference buffer");
- if ((status = H5Rcreate_region((hid_t)loc_id, refName, space_id, (hid_t)aid, (const H5R_ref_t *)refBuf)) < 0)
+ if ((status = H5Rcreate_region((hid_t)loc_id, refName, space_id, (hid_t)aid, (const H5R_ref_t *)refBuf)) <
+ 0)
H5_LIBRARY_ERROR(ENVONLY);
if (NULL == (ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE)))
@@ -120,14 +118,14 @@ done:
* Signature: (JLjava/lang/String;Ljava/lang/String;)[B
*/
JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_H5_H5Rcreate_1attr
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jstring attr_name, jlong aid)
+Java_hdf_hdf5lib_H5_H5Rcreate_1attr(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jstring attr_name,
+ jlong aid)
{
- const char *refName = NULL;
+ const char *refName = NULL;
const char *attrName = NULL;
- jbyteArray ref = NULL;
- jbyte *refBuf = NULL;
- herr_t status = FAIL;
+ jbyteArray ref = NULL;
+ jbyte * refBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -143,7 +141,8 @@ Java_hdf_hdf5lib_H5_H5Rcreate_1attr
if (NULL == (refBuf = HDcalloc(1, H5R_REF_BUF_SIZE)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rcreate_attr: failed to allocate reference buffer");
- if ((status = H5Rcreate_attr((hid_t)loc_id, refName, attrName, (hid_t)aid, (const H5R_ref_t *)refBuf)) < 0)
+ if ((status = H5Rcreate_attr((hid_t)loc_id, refName, attrName, (hid_t)aid, (const H5R_ref_t *)refBuf)) <
+ 0)
H5_LIBRARY_ERROR(ENVONLY);
if (NULL == (ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE)))
@@ -169,13 +168,12 @@ done:
* Signature: ([B)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Rdestroy
- (JNIEnv *env, jclass clss, jbyteArray ref)
+Java_hdf_hdf5lib_H5_H5Rdestroy(JNIEnv *env, jclass clss, jbyteArray ref)
{
- jboolean isCopy;
- jbyte *refBuf = NULL;
- jsize refBufLen;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jbyte * refBuf = NULL;
+ jsize refBufLen;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -203,13 +201,12 @@ done:
* Signature: ([B)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Rget_1type
- (JNIEnv *env, jclass clss, jbyteArray ref)
+Java_hdf_hdf5lib_H5_H5Rget_1type(JNIEnv *env, jclass clss, jbyteArray ref)
{
- jboolean isCopy;
- jbyte *refBuf = NULL;
- jsize refBufLen;
- H5R_type_t ref_type = -1;
+ jboolean isCopy;
+ jbyte * refBuf = NULL;
+ jsize refBufLen;
+ H5R_type_t ref_type = -1;
UNUSED(clss);
@@ -239,15 +236,14 @@ done:
* Signature: ([B[B)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Requal
- (JNIEnv *env, jclass clss, jbyteArray ref1, jbyteArray ref2)
+Java_hdf_hdf5lib_H5_H5Requal(JNIEnv *env, jclass clss, jbyteArray ref1, jbyteArray ref2)
{
- jboolean isCopy;
- jbyte *refBuf1 = NULL;
- jbyte *refBuf2 = NULL;
- jsize refBufLen;
- htri_t bval = JNI_FALSE;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jbyte * refBuf1 = NULL;
+ jbyte * refBuf2 = NULL;
+ jsize refBufLen;
+ htri_t bval = JNI_FALSE;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -292,15 +288,14 @@ done:
* Signature: ([B)[B
*/
JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_H5_H5Rcopy
- (JNIEnv *env, jclass clss, jbyteArray src_ref)
+Java_hdf_hdf5lib_H5_H5Rcopy(JNIEnv *env, jclass clss, jbyteArray src_ref)
{
- jboolean isCopy;
- jbyte *src_refBuf = NULL;
- jsize refBufLen;
- jbyteArray dst_ref = NULL;
- jbyte *dst_refBuf = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jbyte * src_refBuf = NULL;
+ jsize refBufLen;
+ jbyteArray dst_ref = NULL;
+ jbyte * dst_refBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -341,13 +336,12 @@ done:
* Signature: ([BJJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Ropen_1object
- (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong oapl_id)
+Java_hdf_hdf5lib_H5_H5Ropen_1object(JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong oapl_id)
{
- jboolean isCopy;
- jbyte *refBuf = NULL;
- jsize refBufLen;
- hid_t retVal = H5I_INVALID_HID;
+ jboolean isCopy;
+ jbyte * refBuf = NULL;
+ jsize refBufLen;
+ hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
@@ -377,13 +371,12 @@ done:
* Signature: ([BJJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Ropen_1region
- (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong oapl_id)
+Java_hdf_hdf5lib_H5_H5Ropen_1region(JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong oapl_id)
{
- jboolean isCopy;
- jbyte *refBuf = NULL;
- jsize refBufLen;
- hid_t retVal = H5I_INVALID_HID;
+ jboolean isCopy;
+ jbyte * refBuf = NULL;
+ jsize refBufLen;
+ hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
@@ -413,13 +406,12 @@ done:
* Signature: ([BJJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Ropen_1attr
- (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong aapl_id)
+Java_hdf_hdf5lib_H5_H5Ropen_1attr(JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong aapl_id)
{
- jboolean isCopy;
- jbyte *refBuf = NULL;
- jsize refBufLen;
- hid_t retVal = H5I_INVALID_HID;
+ jboolean isCopy;
+ jbyte * refBuf = NULL;
+ jsize refBufLen;
+ hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
@@ -449,13 +441,12 @@ done:
* Signature: ([BJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Rget_1obj_1type3
- (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id)
+Java_hdf_hdf5lib_H5_H5Rget_1obj_1type3(JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id)
{
- H5O_type_t object_info = -1;
- jboolean isCopy;
- jbyte *refBuf = NULL;
- int retVal = -1;
+ H5O_type_t object_info = -1;
+ jboolean isCopy;
+ jbyte * refBuf = NULL;
+ int retVal = -1;
UNUSED(clss);
@@ -483,15 +474,14 @@ done:
* Signature: ([B)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Rget_1file_1name
- (JNIEnv *env, jclass clss, jbyteArray ref)
+Java_hdf_hdf5lib_H5_H5Rget_1file_1name(JNIEnv *env, jclass clss, jbyteArray ref)
{
- jboolean isCopy;
- jbyte *refBuf = NULL;
- jstring str = NULL;
- ssize_t buf_size;
- ssize_t check_size = -1;
- char *namePtr = NULL;
+ jboolean isCopy;
+ jbyte * refBuf = NULL;
+ jstring str = NULL;
+ ssize_t buf_size;
+ ssize_t check_size = -1;
+ char * namePtr = NULL;
UNUSED(clss);
@@ -529,15 +519,14 @@ done:
* Signature: ([BJ)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Rget_1obj_1name
- (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id)
+Java_hdf_hdf5lib_H5_H5Rget_1obj_1name(JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id)
{
- jboolean isCopy;
- jbyte *refBuf = NULL;
- jstring str = NULL;
- ssize_t buf_size;
- ssize_t check_size = -1;
- char *namePtr = NULL;
+ jboolean isCopy;
+ jbyte * refBuf = NULL;
+ jstring str = NULL;
+ ssize_t buf_size;
+ ssize_t check_size = -1;
+ char * namePtr = NULL;
UNUSED(clss);
@@ -553,7 +542,8 @@ Java_hdf_hdf5lib_H5_H5Rget_1obj_1name
if (NULL == (namePtr = HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rget_obj_name: malloc failed");
- if ((check_size = H5Rget_obj_name((const H5R_ref_t *)refBuf, (hid_t)rapl_id, namePtr, (size_t)buf_size + 1)) < 0)
+ if ((check_size =
+ H5Rget_obj_name((const H5R_ref_t *)refBuf, (hid_t)rapl_id, namePtr, (size_t)buf_size + 1)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
namePtr[buf_size] = '\0';
@@ -575,15 +565,14 @@ done:
* Signature: ([B)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Rget_1attr_1name
- (JNIEnv *env, jclass clss, jbyteArray ref)
+Java_hdf_hdf5lib_H5_H5Rget_1attr_1name(JNIEnv *env, jclass clss, jbyteArray ref)
{
- jboolean isCopy;
- jbyte *refBuf = NULL;
- jstring str = NULL;
- ssize_t buf_size;
- ssize_t check_size = -1;
- char *namePtr = NULL;
+ jboolean isCopy;
+ jbyte * refBuf = NULL;
+ jstring str = NULL;
+ ssize_t buf_size;
+ ssize_t check_size = -1;
+ char * namePtr = NULL;
UNUSED(clss);
@@ -623,12 +612,12 @@ done:
* Signature: ([BJLjava/lang/String;IJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Rcreate
- (JNIEnv *env, jclass clss, jbyteArray ref, jlong loc_id, jstring name, jint ref_type, jlong space_id)
+Java_hdf_hdf5lib_H5_H5Rcreate(JNIEnv *env, jclass clss, jbyteArray ref, jlong loc_id, jstring name,
+ jint ref_type, jlong space_id)
{
const char *refName = NULL;
jboolean isCopy;
- jbyte *refBuf = NULL;
+ jbyte * refBuf = NULL;
jsize refBufLen;
herr_t status = FAIL;
@@ -647,7 +636,8 @@ Java_hdf_hdf5lib_H5_H5Rcreate
if ((H5R_OBJECT == ref_type) && (refBufLen != H5R_OBJ_REF_BUF_SIZE))
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: reference input array length != H5R_OBJ_REF_BUF_SIZE");
else if ((H5R_DATASET_REGION == ref_type) && (refBufLen != H5R_DSET_REG_REF_BUF_SIZE))
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE");
+ H5_BAD_ARGUMENT_ERROR(ENVONLY,
+ "H5Rcreate: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE");
else if ((H5R_OBJECT != ref_type) && (H5R_DATASET_REGION != ref_type))
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: unknown reference type");
@@ -673,13 +663,13 @@ done:
* Signature: (JJI[B)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Rdereference
- (JNIEnv *env, jclass clss, jlong dataset, jlong access_list, jint ref_type, jbyteArray ref)
+Java_hdf_hdf5lib_H5__1H5Rdereference(JNIEnv *env, jclass clss, jlong dataset, jlong access_list,
+ jint ref_type, jbyteArray ref)
{
- jboolean isCopy;
- jbyte *refBuf = NULL;
- jsize refBufLen;
- hid_t retVal = H5I_INVALID_HID;
+ jboolean isCopy;
+ jbyte * refBuf = NULL;
+ jsize refBufLen;
+ hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
@@ -692,9 +682,11 @@ Java_hdf_hdf5lib_H5__1H5Rdereference
}
if ((H5R_OBJECT == ref_type) && (refBufLen != H5R_OBJ_REF_BUF_SIZE))
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: reference input array length != H5R_OBJ_REF_BUF_SIZE");
+ H5_BAD_ARGUMENT_ERROR(ENVONLY,
+ "H5Rdereference: reference input array length != H5R_OBJ_REF_BUF_SIZE");
else if ((H5R_DATASET_REGION == ref_type) && (refBufLen != H5R_DSET_REG_REF_BUF_SIZE))
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE");
+ H5_BAD_ARGUMENT_ERROR(
+ ENVONLY, "H5Rdereference: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE");
else if ((H5R_OBJECT != ref_type) && (H5R_DATASET_REGION != ref_type))
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: unknown reference type");
@@ -716,13 +708,12 @@ done:
* Signature: (JI[B)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Rget_1region
- (JNIEnv *env, jclass clss, jlong dataset, jint ref_type, jbyteArray ref)
+Java_hdf_hdf5lib_H5__1H5Rget_1region(JNIEnv *env, jclass clss, jlong dataset, jint ref_type, jbyteArray ref)
{
- jboolean isCopy;
- jbyte *refBuf = NULL;
- jsize refBufLen;
- hid_t retVal = H5I_INVALID_HID;
+ jboolean isCopy;
+ jbyte * refBuf = NULL;
+ jsize refBufLen;
+ hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
@@ -737,7 +728,8 @@ Java_hdf_hdf5lib_H5__1H5Rget_1region
}
if (refBufLen != H5R_DSET_REG_REF_BUF_SIZE)
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_region: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE");
+ H5_BAD_ARGUMENT_ERROR(
+ ENVONLY, "H5Rget_region: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE");
PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_region: reference buffer not pinned");
@@ -757,13 +749,12 @@ done:
* Signature: (JI[B)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Rget_1obj_1type
- (JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref)
+Java_hdf_hdf5lib_H5_H5Rget_1obj_1type(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref)
{
- H5O_type_t object_info;
- jboolean isCopy;
- jbyte *refBuf = NULL;
- int retVal = -1;
+ H5O_type_t object_info;
+ jboolean isCopy;
+ jbyte * refBuf = NULL;
+ int retVal = -1;
UNUSED(clss);
@@ -791,14 +782,14 @@ done:
* Signature: (JI[B[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2
- (JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref, jintArray ref_obj)
+Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref,
+ jintArray ref_obj)
{
- jboolean isCopy, isCopy2;
- jbyte *refBuf = NULL;
- jint *ref_objP = NULL;
- jint status = -1;
- int retVal = -1;
+ jboolean isCopy, isCopy2;
+ jbyte * refBuf = NULL;
+ jint * ref_objP = NULL;
+ jint status = -1;
+ int retVal = -1;
UNUSED(clss);
@@ -831,15 +822,15 @@ done:
* Signature: (JI[B[Ljava/lang/String;J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Rget_1name
- (JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref, jobjectArray name, jlong size)
+Java_hdf_hdf5lib_H5_H5Rget_1name(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref,
+ jobjectArray name, jlong size)
{
- jboolean isCopy;
- jstring str;
- jsize refBufLen;
- jbyte *refBuf = NULL;
- char *aName = NULL;
- jlong ret_val = -1;
+ jboolean isCopy;
+ jstring str;
+ jsize refBufLen;
+ jbyte * refBuf = NULL;
+ char * aName = NULL;
+ jlong ret_val = -1;
UNUSED(clss);
@@ -856,7 +847,8 @@ Java_hdf_hdf5lib_H5_H5Rget_1name
if ((H5R_OBJECT == ref_type) && (refBufLen != H5R_OBJ_REF_BUF_SIZE))
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: reference input array length != H5R_OBJ_REF_BUF_SIZE");
else if ((H5R_DATASET_REGION == ref_type) && (refBufLen != H5R_DSET_REG_REF_BUF_SIZE))
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE");
+ H5_BAD_ARGUMENT_ERROR(
+ ENVONLY, "H5Rget_name: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE");
else if ((H5R_OBJECT != ref_type) && (H5R_DATASET_REGION != ref_type))
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: unknown reference type");
@@ -865,14 +857,15 @@ Java_hdf_hdf5lib_H5_H5Rget_1name
if (NULL == (aName = HDmalloc(sizeof(char) * (size_t)size + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rget_name: failed to allocate referenced object name buffer");
- if ((ret_val = (jlong)H5Rget_name((hid_t)loc_id, (H5R_type_t)ref_type, refBuf, aName, (size_t)size + 1)) < 0)
+ if ((ret_val = (jlong)H5Rget_name((hid_t)loc_id, (H5R_type_t)ref_type, refBuf, aName, (size_t)size + 1)) <
+ 0)
H5_LIBRARY_ERROR(ENVONLY);
aName[(size_t)size] = '\0';
if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName)))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- ENVPTR->SetObjectArrayElement(ENVONLY, name, (jsize) 0, str);
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, (jsize)0, str);
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
done:
@@ -884,7 +877,6 @@ done:
return ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Rget_1name */
-
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/h5rImp.h b/java/src/jni/h5rImp.h
index 3bdb266..d0c5e3b 100644
--- a/java/src/jni/h5rImp.h
+++ b/java/src/jni/h5rImp.h
@@ -28,126 +28,100 @@ extern "C" {
* Method: H5Rcreate_object
* Signature: (JLjava/lang/String;)[B
*/
-JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_H5_H5Rcreate_1object
- (JNIEnv *, jclass, jlong, jstring, jlong);
+JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_H5_H5Rcreate_1object(JNIEnv *, jclass, jlong, jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Rcreate_region
* Signature: (JLjava/lang/String;J)[B
*/
-JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_H5_H5Rcreate_1region
- (JNIEnv *, jclass, jlong, jstring, jlong, jlong);
+JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_H5_H5Rcreate_1region(JNIEnv *, jclass, jlong, jstring, jlong,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Rcreate_attr
* Signature: (JLjava/lang/String;Ljava/lang/String;)[B
*/
-JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_H5_H5Rcreate_1attr
- (JNIEnv *, jclass, jlong, jstring, jstring, jlong);
+JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_H5_H5Rcreate_1attr(JNIEnv *, jclass, jlong, jstring, jstring,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Rdestroy
* Signature: ([B)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Rdestroy
- (JNIEnv *, jclass, jbyteArray);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Rdestroy(JNIEnv *, jclass, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Rget_type
* Signature: ([B)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Rget_1type
- (JNIEnv *, jclass, jbyteArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Rget_1type(JNIEnv *, jclass, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Requal
* Signature: ([B[B)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Requal
- (JNIEnv *, jclass, jbyteArray, jbyteArray);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Requal(JNIEnv *, jclass, jbyteArray, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Rcopy
* Signature: ([B)[B
*/
-JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_H5_H5Rcopy
- (JNIEnv *, jclass, jbyteArray);
+JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_H5_H5Rcopy(JNIEnv *, jclass, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Ropen_object
* Signature: ([BJJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Ropen_1object
- (JNIEnv *, jclass, jbyteArray, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Ropen_1object(JNIEnv *, jclass, jbyteArray, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Ropen_region
* Signature: ([BJJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Ropen_1region
- (JNIEnv *, jclass, jbyteArray, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Ropen_1region(JNIEnv *, jclass, jbyteArray, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Ropen_attr
* Signature: ([BJJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Ropen_1attr
- (JNIEnv *, jclass, jbyteArray, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Ropen_1attr(JNIEnv *, jclass, jbyteArray, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Rget_obj_type3
* Signature: ([BJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Rget_1obj_1type3
- (JNIEnv *, jclass, jbyteArray, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Rget_1obj_1type3(JNIEnv *, jclass, jbyteArray, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Rget_file_name
* Signature: ([B)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Rget_1file_1name
- (JNIEnv *, jclass, jbyteArray);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Rget_1file_1name(JNIEnv *, jclass, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Rget_obj_name
* Signature: ([BJ)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Rget_1obj_1name
- (JNIEnv *, jclass, jbyteArray, jlong);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Rget_1obj_1name(JNIEnv *, jclass, jbyteArray, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Rget_attr_name
* Signature: ([B)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Rget_1attr_1name
- (JNIEnv *, jclass, jbyteArray);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Rget_1attr_1name(JNIEnv *, jclass, jbyteArray);
/* H5R: HDF5 1.8 Reference API Functions */
@@ -156,54 +130,46 @@ Java_hdf_hdf5lib_H5_H5Rget_1attr_1name
* Method: H5Rcreate
* Signature: ([BJLjava/lang/String;IJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Rcreate
- (JNIEnv *, jclass, jbyteArray, jlong, jstring, jint, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Rcreate(JNIEnv *, jclass, jbyteArray, jlong, jstring, jint,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Rdereference
* Signature: (JJI[B)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Rdereference
- (JNIEnv *, jclass, jlong, jlong, jint, jbyteArray);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Rdereference(JNIEnv *, jclass, jlong, jlong, jint,
+ jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Rget_region
* Signature: (JI[B)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Rget_1region
- (JNIEnv *, jclass, jlong, jint, jbyteArray);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Rget_1region(JNIEnv *, jclass, jlong, jint, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5G_obj_t H5Rget_obj_type
* Signature: (JI[B)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Rget_1obj_1type
- (JNIEnv *, jclass, jlong, jint, jbyteArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Rget_1obj_1type(JNIEnv *, jclass, jlong, jint, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: int H5Rget_obj_type2
* Signature: (JI[B[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2
- (JNIEnv *, jclass, jlong, jint, jbyteArray, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2(JNIEnv *, jclass, jlong, jint, jbyteArray,
+ jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Rget_name
* Signature: (JI[B[Ljava/lang/String;J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Rget_1name
- (JNIEnv *, jclass, jlong, jint, jbyteArray, jobjectArray, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Rget_1name(JNIEnv *, jclass, jlong, jint, jbyteArray,
+ jobjectArray, jlong);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c
index 3498392..2a9cff5 100644
--- a/java/src/jni/h5sImp.c
+++ b/java/src/jni/h5sImp.c
@@ -37,14 +37,13 @@ extern "C" {
* Signature: (I)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Screate
- (JNIEnv *env, jclass clss, jint type)
+Java_hdf_hdf5lib_H5__1H5Screate(JNIEnv *env, jclass clss, jint type)
{
hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
- if ((retVal = H5Screate((H5S_class_t) type)) < 0)
+ if ((retVal = H5Screate((H5S_class_t)type)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -57,18 +56,18 @@ done:
* Signature: (I[J[J)G
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Screate_1simple
- (JNIEnv *env, jclass clss, jint rank, jlongArray dims, jlongArray maxdims)
+Java_hdf_hdf5lib_H5__1H5Screate_1simple(JNIEnv *env, jclass clss, jint rank, jlongArray dims,
+ jlongArray maxdims)
{
- jboolean isCopy;
- hsize_t *sa = NULL;
- hsize_t *msa = NULL;
- hsize_t *lp = NULL;
- jlong *dimsP = NULL, *maxdimsP = NULL;
- jlong *jlp = NULL;
- jsize drank = 0, mrank = 0;
- int i;
- hid_t retVal = H5I_INVALID_HID;
+ jboolean isCopy;
+ hsize_t *sa = NULL;
+ hsize_t *msa = NULL;
+ hsize_t *lp = NULL;
+ jlong * dimsP = NULL, *maxdimsP = NULL;
+ jlong * jlp = NULL;
+ jsize drank = 0, mrank = 0;
+ int i;
+ hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
@@ -97,29 +96,29 @@ Java_hdf_hdf5lib_H5__1H5Screate_1simple
PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Screate_simple: dims not pinned");
- if (NULL == (sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ if (NULL == (sa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Screate_simple: failed to allocate dims buffer");
- jlp = (jlong *) dimsP;
+ jlp = (jlong *)dimsP;
for (i = 0; i < rank; i++) {
- *lp = (hsize_t) *jlp;
+ *lp = (hsize_t)*jlp;
lp++;
jlp++;
} /* end for */
if (NULL == maxdims) {
maxdimsP = NULL;
- msa = (hsize_t *)maxdimsP;
+ msa = (hsize_t *)maxdimsP;
}
else {
PIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, &isCopy, "H5Screate_simple: maxdims not pinned");
- if (NULL == (msa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ if (NULL == (msa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Screate_simple: failed to allocate maxdims buffer");
- jlp = (jlong *) maxdimsP;
+ jlp = (jlong *)maxdimsP;
for (i = 0; i < mrank; i++) {
- *lp = (hsize_t) *jlp;
+ *lp = (hsize_t)*jlp;
lp++;
jlp++;
} /* end for */
@@ -147,8 +146,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Scopy
- (JNIEnv *env, jclass clss, jlong space_id)
+Java_hdf_hdf5lib_H5__1H5Scopy(JNIEnv *env, jclass clss, jlong space_id)
{
hid_t retVal = H5I_INVALID_HID;
@@ -177,12 +175,12 @@ done:
* Signature: (JII[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sselect_1elements
- (JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn, jlongArray coords)
+Java_hdf_hdf5lib_H5_H5Sselect_1elements(JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn,
+ jlongArray coords)
{
jboolean isCopy;
hssize_t *sa = NULL;
- jlong *P = NULL;
+ jlong * P = NULL;
jint i;
int rank;
herr_t status = FAIL;
@@ -194,7 +192,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1elements
PIN_LONG_ARRAY(ENVONLY, coords, P, &isCopy, "H5Sselect_elements: coords not pinned");
- if (NULL == (sa = (hssize_t *) HDmalloc( (size_t)num_elemn * 2 * sizeof(hssize_t))))
+ if (NULL == (sa = (hssize_t *)HDmalloc((size_t)num_elemn * 2 * sizeof(hssize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer");
for (i = 0; i < (num_elemn * 2); i++) {
@@ -220,18 +218,18 @@ done:
* Signature: (JII[B)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sselect_1elements
- (JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn, jbyteArray coords)
+Java_hdf_hdf5lib_H5_H5Sselect_1elements(JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn,
+ jbyteArray coords)
{
- jboolean isCopy;
- hsize_t *lp = NULL;
- hsize_t *llp = NULL;
- jlong *jlp = NULL;
- jbyte *P = NULL;
- jsize size;
- int ii;
- int nlongs;
- herr_t status = FAIL;
+ jboolean isCopy;
+ hsize_t *lp = NULL;
+ hsize_t *llp = NULL;
+ jlong * jlp = NULL;
+ jbyte * P = NULL;
+ jsize size;
+ int ii;
+ int nlongs;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -247,18 +245,19 @@ Java_hdf_hdf5lib_H5_H5Sselect_1elements
nlongs = (int)((size_t)size / sizeof(jlong));
- if (NULL == (lp = (hsize_t *) HDmalloc((size_t)nlongs * sizeof(hsize_t))))
+ if (NULL == (lp = (hsize_t *)HDmalloc((size_t)nlongs * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer");
- jlp = (jlong *) P;
+ jlp = (jlong *)P;
llp = lp;
for (ii = 0; ii < nlongs; ii++) {
- *lp = (hsize_t) *jlp;
+ *lp = (hsize_t)*jlp;
lp++;
jlp++;
} /* end for */
- if ((status = H5Sselect_elements(space_id, (H5S_seloper_t)op, (size_t)num_elemn, (const hsize_t *)llp)) < 0)
+ if ((status = H5Sselect_elements(space_id, (H5S_seloper_t)op, (size_t)num_elemn, (const hsize_t *)llp)) <
+ 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -276,8 +275,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sselect_1all
- (JNIEnv *env, jclass clss, jlong space_id)
+Java_hdf_hdf5lib_H5_H5Sselect_1all(JNIEnv *env, jclass clss, jlong space_id)
{
herr_t retVal = FAIL;
@@ -287,7 +285,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1all
H5_LIBRARY_ERROR(ENVONLY);
done:
- return (jint) retVal;
+ return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sselect_1all */
/*
@@ -296,8 +294,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sselect_1none
- (JNIEnv *env, jclass clss, jlong space_id)
+Java_hdf_hdf5lib_H5_H5Sselect_1none(JNIEnv *env, jclass clss, jlong space_id)
{
herr_t retVal = FAIL;
@@ -307,7 +304,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1none
H5_LIBRARY_ERROR(ENVONLY);
done:
- return (jint) retVal;
+ return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sselect_1none */
/*
@@ -316,8 +313,7 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Sselect_1valid
- (JNIEnv *env, jclass clss, jlong space_id)
+Java_hdf_hdf5lib_H5_H5Sselect_1valid(JNIEnv *env, jclass clss, jlong space_id)
{
htri_t bval = JNI_FALSE;
@@ -338,8 +334,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints
- (JNIEnv *env, jclass clss, jlong space_id)
+Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints(JNIEnv *env, jclass clss, jlong space_id)
{
hssize_t retVal = -1;
@@ -349,7 +344,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints
H5_LIBRARY_ERROR(ENVONLY);
done:
- return (jlong) retVal;
+ return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints */
/*
@@ -358,8 +353,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints
- (JNIEnv *env, jclass clss, jlong space_id)
+Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints(JNIEnv *env, jclass clss, jlong space_id)
{
hssize_t retVal = -1;
@@ -369,7 +363,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints
H5_LIBRARY_ERROR(ENVONLY);
done:
- return (jlong) retVal;
+ return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints */
/*
@@ -378,8 +372,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1select_1type
- (JNIEnv *env, jclass clss, jlong space_id)
+Java_hdf_hdf5lib_H5_H5Sget_1select_1type(JNIEnv *env, jclass clss, jlong space_id)
{
int retVal = -1;
@@ -389,7 +382,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1type
H5_LIBRARY_ERROR(ENVONLY);
done:
- return (jint) retVal;
+ return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1type */
/*
@@ -398,8 +391,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims
- (JNIEnv *env, jclass clss, jlong space_id)
+Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims(JNIEnv *env, jclass clss, jlong space_id)
{
int retVal = -1;
@@ -409,7 +401,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims
H5_LIBRARY_ERROR(ENVONLY);
done:
- return (jint) retVal;
+ return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims */
/*
@@ -418,23 +410,23 @@ done:
* Signature: (J[J[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims
- (JNIEnv *env, jclass clss, jlong space_id, jlongArray dims, jlongArray maxdims)
+Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims(JNIEnv *env, jclass clss, jlong space_id, jlongArray dims,
+ jlongArray maxdims)
{
- jboolean isCopy;
- hsize_t *sa = NULL;
- hsize_t *msa = NULL;
- jlong *dimsP = NULL, *maxdimsP = NULL;
- int i;
- int rank = -1;
- int mrank;
- int status = -1;
+ jboolean isCopy;
+ hsize_t *sa = NULL;
+ hsize_t *msa = NULL;
+ jlong * dimsP = NULL, *maxdimsP = NULL;
+ int i;
+ int rank = -1;
+ int mrank;
+ int status = -1;
UNUSED(clss);
if (NULL == dims) {
dimsP = NULL;
- sa = (hsize_t *) dimsP;
+ sa = (hsize_t *)dimsP;
}
else {
PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Sget_simple_extent_dims: dims not pinned");
@@ -444,18 +436,18 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_dims: dims array length < 0");
}
- if (NULL == (sa = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ if (NULL == (sa = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_simple_extent_dims: failed to allocate dimension buffer");
}
if (NULL == maxdims) {
maxdimsP = NULL;
- msa = (hsize_t *) maxdimsP;
+ msa = (hsize_t *)maxdimsP;
}
else {
PIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, &isCopy, "H5Sget_simple_extent_dims: maxdims not pinned");
- if ((mrank = (int) ENVPTR->GetArrayLength(ENVONLY, maxdims)) < 0) {
+ if ((mrank = (int)ENVPTR->GetArrayLength(ENVONLY, maxdims)) < 0) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_dims: maxdims array length < 0");
}
@@ -465,8 +457,9 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims
else if (mrank != rank)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_dims: maxdims rank not same as dims");
- if (NULL == (msa = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_simple_extent_dims: failed to allocate maximum dimension buffer");
+ if (NULL == (msa = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "H5Sget_simple_extent_dims: failed to allocate maximum dimension buffer");
}
if ((status = H5Sget_simple_extent_dims(space_id, (hsize_t *)sa, (hsize_t *)msa)) < 0)
@@ -503,8 +496,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type
- (JNIEnv *env, jclass clss, jlong space_id)
+Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type(JNIEnv *env, jclass clss, jlong space_id)
{
H5S_class_t retVal = H5S_NO_CLASS;
@@ -526,18 +518,18 @@ done:
* Signature: (JI[J[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple
- (JNIEnv *env, jclass clss, jlong space_id, jint rank, jlongArray dims, jlongArray maxdims)
+Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple(JNIEnv *env, jclass clss, jlong space_id, jint rank,
+ jlongArray dims, jlongArray maxdims)
{
- jboolean isCopy;
- hsize_t *sa = NULL;
- hsize_t *msa = NULL;
- hsize_t *lp = NULL;
- jlong *dimsP = NULL, *maxdimsP = NULL;
- jlong *jlp = NULL;
- jsize drank, mrank;
- int i;
- herr_t status = FAIL;
+ jboolean isCopy;
+ hsize_t *sa = NULL;
+ hsize_t *msa = NULL;
+ hsize_t *lp = NULL;
+ jlong * dimsP = NULL, *maxdimsP = NULL;
+ jlong * jlp = NULL;
+ jsize drank, mrank;
+ int i;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -564,35 +556,36 @@ Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple
PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Sset_extent_simple: dims not pinned");
- if (NULL == (sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ if (NULL == (sa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sset_extent_simple: failed to allocate dimension buffer");
- jlp = (jlong *) dimsP;
+ jlp = (jlong *)dimsP;
for (i = 0; i < rank; i++) {
- *lp = (hsize_t) *jlp;
+ *lp = (hsize_t)*jlp;
lp++;
jlp++;
} /* end for */
if (NULL == maxdims) {
maxdimsP = NULL;
- msa = (hsize_t *) maxdimsP;
+ msa = (hsize_t *)maxdimsP;
}
else {
PIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, &isCopy, "H5Sset_extent_simple: maxdims not pinned");
- if (NULL == (msa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sset_extent_simple: failed to allocate maximum dimension buffer");
+ if (NULL == (msa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "H5Sset_extent_simple: failed to allocate maximum dimension buffer");
- jlp = (jlong *) maxdimsP;
+ jlp = (jlong *)maxdimsP;
for (i = 0; i < rank; i++) {
- *lp = (hsize_t) *jlp;
+ *lp = (hsize_t)*jlp;
lp++;
jlp++;
} /* end for */
}
- if ((status = H5Sset_extent_simple(space_id, rank, (hsize_t *) sa, (hsize_t *) msa)) < 0)
+ if ((status = H5Sset_extent_simple(space_id, rank, (hsize_t *)sa, (hsize_t *)msa)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -614,8 +607,7 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Sis_1simple
- (JNIEnv *env, jclass clss, jlong space_id)
+Java_hdf_hdf5lib_H5_H5Sis_1simple(JNIEnv *env, jclass clss, jlong space_id)
{
htri_t bval = JNI_FALSE;
@@ -636,16 +628,15 @@ done:
* Signature: (J[B)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Soffset_1simple
- (JNIEnv *env, jclass clss, jlong space_id, jbyteArray offset)
+Java_hdf_hdf5lib_H5_H5Soffset_1simple(JNIEnv *env, jclass clss, jlong space_id, jbyteArray offset)
{
jboolean isCopy;
hssize_t *sa = NULL;
hssize_t *lp = NULL;
size_t rank;
jsize i;
- jbyte *P = NULL;
- jlong *jlp = NULL;
+ jbyte * P = NULL;
+ jlong * jlp = NULL;
herr_t status = FAIL;
UNUSED(clss);
@@ -658,21 +649,21 @@ Java_hdf_hdf5lib_H5_H5Soffset_1simple
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Soffset_simple: offset array length < 0");
}
- rank = (size_t) i / sizeof(jlong);
+ rank = (size_t)i / sizeof(jlong);
- if (NULL == (sa = lp = (hssize_t *) HDmalloc((size_t)rank * sizeof(hssize_t))))
+ if (NULL == (sa = lp = (hssize_t *)HDmalloc((size_t)rank * sizeof(hssize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Soffset_simple: failed to allocate offset buffer");
- jlp = (jlong *) P;
- for (i = 0; (size_t) i < rank; i++) {
- *lp = (hssize_t) *jlp;
+ jlp = (jlong *)P;
+ for (i = 0; (size_t)i < rank; i++) {
+ *lp = (hssize_t)*jlp;
lp++;
jlp++;
} /* end for */
}
else {
- P = NULL;
- sa = (hssize_t *) P;
+ P = NULL;
+ sa = (hssize_t *)P;
}
if ((status = H5Soffset_simple(space_id, sa)) < 0)
@@ -693,8 +684,7 @@ done:
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sextent_1copy
- (JNIEnv *env, jclass clss, jlong space_id, jlong src_id)
+Java_hdf_hdf5lib_H5_H5Sextent_1copy(JNIEnv *env, jclass clss, jlong space_id, jlong src_id)
{
herr_t retVal = FAIL;
@@ -713,8 +703,7 @@ done:
* Signature: (JJ)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Sextent_1equal
- (JNIEnv *env, jclass clss, jlong space_id, jlong src_id)
+Java_hdf_hdf5lib_H5_H5Sextent_1equal(JNIEnv *env, jclass clss, jlong space_id, jlong src_id)
{
htri_t bval = JNI_FALSE;
@@ -735,8 +724,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sset_1extent_1none
- (JNIEnv *env, jclass clss, jlong space_id)
+Java_hdf_hdf5lib_H5_H5Sset_1extent_1none(JNIEnv *env, jclass clss, jlong space_id)
{
herr_t retVal = FAIL;
@@ -755,17 +743,17 @@ done:
* Signature: (JI[J[J[J[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab
- (JNIEnv *env, jclass clss, jlong space_id, jint op, jlongArray start, jlongArray stride, jlongArray count, jlongArray block)
+Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab(JNIEnv *env, jclass clss, jlong space_id, jint op, jlongArray start,
+ jlongArray stride, jlongArray count, jlongArray block)
{
- jboolean isCopy;
- hsize_t *strt = NULL, *strd = NULL, *cnt = NULL, *blk = NULL;
- hsize_t *lp = NULL;
- jlong *startP = NULL, *strideP = NULL, *countP = NULL, *blockP = NULL;
- jlong *jlp = NULL;
- jsize start_rank, stride_rank, count_rank, block_rank;
- int i;
- herr_t status = FAIL;
+ jboolean isCopy;
+ hsize_t *strt = NULL, *strd = NULL, *cnt = NULL, *blk = NULL;
+ hsize_t *lp = NULL;
+ jlong * startP = NULL, *strideP = NULL, *countP = NULL, *blockP = NULL;
+ jlong * jlp = NULL;
+ jsize start_rank, stride_rank, count_rank, block_rank;
+ int i;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -788,31 +776,31 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab
PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Sselect_hyperslab: start not pinned");
- if (NULL == (strt = lp = (hsize_t *) HDmalloc((size_t)start_rank * sizeof(hsize_t))))
+ if (NULL == (strt = lp = (hsize_t *)HDmalloc((size_t)start_rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate start buffer");
- jlp = (jlong *) startP;
+ jlp = (jlong *)startP;
for (i = 0; i < start_rank; i++) {
- *lp = (hsize_t) *jlp;
+ *lp = (hsize_t)*jlp;
lp++;
jlp++;
} /* end if */
PIN_LONG_ARRAY(ENVONLY, count, countP, &isCopy, "H5Sselect_hyperslab: count not pinned");
- if (NULL == (cnt = lp = (hsize_t *) HDmalloc((size_t)count_rank * sizeof(hsize_t))))
+ if (NULL == (cnt = lp = (hsize_t *)HDmalloc((size_t)count_rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate count buffer");
- jlp = (jlong *) countP;
+ jlp = (jlong *)countP;
for (i = 0; i < count_rank; i++) {
- *lp = (hsize_t) *jlp;
+ *lp = (hsize_t)*jlp;
lp++;
jlp++;
} /* end if */
if (NULL == stride) {
strideP = NULL;
- strd = (hsize_t *) strideP;
+ strd = (hsize_t *)strideP;
}
else {
if ((stride_rank = ENVPTR->GetArrayLength(ENVONLY, stride)) < 0) {
@@ -825,12 +813,12 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab
PIN_LONG_ARRAY(ENVONLY, stride, strideP, &isCopy, "H5Sselect_hyperslab: stride not pinned");
- if (NULL == (strd = lp = (hsize_t *) HDmalloc((size_t)stride_rank * sizeof(hsize_t))))
+ if (NULL == (strd = lp = (hsize_t *)HDmalloc((size_t)stride_rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate stride buffer");
- jlp = (jlong *) strideP;
+ jlp = (jlong *)strideP;
for (i = 0; i < stride_rank; i++) {
- *lp = (hsize_t) *jlp;
+ *lp = (hsize_t)*jlp;
lp++;
jlp++;
} /* end if */
@@ -838,7 +826,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab
if (NULL == block) {
blockP = NULL;
- blk = (hsize_t *) blockP;
+ blk = (hsize_t *)blockP;
}
else {
if ((block_rank = ENVPTR->GetArrayLength(ENVONLY, block)) < 0) {
@@ -851,19 +839,19 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab
PIN_LONG_ARRAY(ENVONLY, block, blockP, &isCopy, "H5Sselect_hyperslab: block not pinned");
- if (NULL == (blk = lp = (hsize_t *) HDmalloc((size_t)block_rank * sizeof(hsize_t))))
+ if (NULL == (blk = lp = (hsize_t *)HDmalloc((size_t)block_rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate block buffer");
- jlp = (jlong *) blockP;
+ jlp = (jlong *)blockP;
for (i = 0; i < block_rank; i++) {
- *lp = (hsize_t) *jlp;
+ *lp = (hsize_t)*jlp;
lp++;
jlp++;
} /* end for */
}
- if ((status = H5Sselect_hyperslab(space_id, (H5S_seloper_t) op, (const hsize_t *) strt, (const hsize_t *) strd,
- (const hsize_t *) cnt, (const hsize_t *) blk)) < 0)
+ if ((status = H5Sselect_hyperslab(space_id, (H5S_seloper_t)op, (const hsize_t *)strt,
+ (const hsize_t *)strd, (const hsize_t *)cnt, (const hsize_t *)blk)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -893,8 +881,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Sclose
- (JNIEnv *env, jclass clss, jlong space_id)
+Java_hdf_hdf5lib_H5__1H5Sclose(JNIEnv *env, jclass clss, jlong space_id)
{
herr_t retVal = FAIL;
@@ -913,14 +900,13 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1nblocks
- (JNIEnv *env, jclass clss, jlong spaceid)
+Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1nblocks(JNIEnv *env, jclass clss, jlong spaceid)
{
hssize_t retVal = -1;
UNUSED(clss);
- if ((retVal = H5Sget_select_hyper_nblocks((hid_t) spaceid)) < 0)
+ if ((retVal = H5Sget_select_hyper_nblocks((hid_t)spaceid)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -933,14 +919,13 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1npoints
- (JNIEnv *env, jclass clss, jlong spaceid)
+Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1npoints(JNIEnv *env, jclass clss, jlong spaceid)
{
hssize_t retVal = -1;
UNUSED(clss);
- if ((retVal = H5Sget_select_elem_npoints((hid_t) spaceid)) < 0)
+ if ((retVal = H5Sget_select_elem_npoints((hid_t)spaceid)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -953,16 +938,16 @@ done:
* Signature: (JJJ[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist
- (JNIEnv *env, jclass clss, jlong spaceid, jlong startblock, jlong numblocks, jlongArray buf)
+Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist(JNIEnv *env, jclass clss, jlong spaceid,
+ jlong startblock, jlong numblocks, jlongArray buf)
{
- jboolean isCopy;
- hsize_t *ba = NULL;
- size_t i, buf_size;
- jlong *bufP = NULL;
- jsize buflen;
- int rank;
- herr_t status = FAIL;
+ jboolean isCopy;
+ hsize_t *ba = NULL;
+ size_t i, buf_size;
+ jlong * bufP = NULL;
+ jsize buflen;
+ int rank;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -987,15 +972,17 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist
PIN_LONG_ARRAY(ENVONLY, buf, bufP, &isCopy, "H5Sget_select_hyper_blocklist: buffer not pinned");
- buf_size = (size_t) numblocks * (size_t) 2 * (size_t) rank * sizeof(hsize_t);
- if (NULL == (ba = (hsize_t *) HDmalloc(buf_size)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_hyper_blocklist: failed to allocate block list buffer");
+ buf_size = (size_t)numblocks * (size_t)2 * (size_t)rank * sizeof(hsize_t);
+ if (NULL == (ba = (hsize_t *)HDmalloc(buf_size)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "H5Sget_select_hyper_blocklist: failed to allocate block list buffer");
- if ((status = H5Sget_select_hyper_blocklist((hid_t)spaceid, (hsize_t) startblock, (hsize_t) numblocks, (hsize_t *)ba)) < 0)
+ if ((status = H5Sget_select_hyper_blocklist((hid_t)spaceid, (hsize_t)startblock, (hsize_t)numblocks,
+ (hsize_t *)ba)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
for (i = 0; i < (buf_size / sizeof(hsize_t)); i++) {
- bufP[i] = (jlong) ba[i];
+ bufP[i] = (jlong)ba[i];
} /* end for */
done:
@@ -1013,15 +1000,15 @@ done:
* Signature: (JJJ[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist
- (JNIEnv *env, jclass clss, jlong spaceid, jlong startpoint, jlong numpoints, jlongArray buf)
+Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist(JNIEnv *env, jclass clss, jlong spaceid, jlong startpoint,
+ jlong numpoints, jlongArray buf)
{
- jboolean isCopy;
- hsize_t *ba = NULL;
- jlong *bufP = NULL;
- jsize buflen;
- int i, rank;
- herr_t status = FAIL;
+ jboolean isCopy;
+ hsize_t *ba = NULL;
+ jlong * bufP = NULL;
+ jsize buflen;
+ int i, rank;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1044,14 +1031,15 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist
PIN_LONG_ARRAY(ENVONLY, buf, bufP, &isCopy, "H5Sget_select_elem_pointlist: buffer not pinned");
- if (NULL == (ba = (hsize_t *) HDmalloc(((size_t)numpoints * (size_t)rank) * sizeof(hsize_t))))
+ if (NULL == (ba = (hsize_t *)HDmalloc(((size_t)numpoints * (size_t)rank) * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_elem_pointlist: failed to allocate point list buffer");
- if ((status = H5Sget_select_elem_pointlist((hid_t)spaceid, (hsize_t)startpoint, (hsize_t)numpoints, (hsize_t *)ba)) < 0)
+ if ((status = H5Sget_select_elem_pointlist((hid_t)spaceid, (hsize_t)startpoint, (hsize_t)numpoints,
+ (hsize_t *)ba)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
for (i = 0; i < (numpoints * rank); i++) {
- bufP[i] = (jlong) ba[i];
+ bufP[i] = (jlong)ba[i];
} /* end for */
done:
@@ -1069,16 +1057,16 @@ done:
* Signature: (J[J[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds
- (JNIEnv *env, jclass clss, jlong spaceid, jlongArray start, jlongArray end)
+Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds(JNIEnv *env, jclass clss, jlong spaceid, jlongArray start,
+ jlongArray end)
{
- jboolean isCopy;
- hsize_t *strt = NULL;
- hsize_t *en = NULL;
- size_t i;
- jlong *startP = NULL, *endP = NULL;
- jsize rank;
- herr_t status = FAIL;
+ jboolean isCopy;
+ hsize_t *strt = NULL;
+ hsize_t *en = NULL;
+ size_t i;
+ jlong * startP = NULL, *endP = NULL;
+ jsize rank;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1094,20 +1082,20 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_bounds: start array length < 0");
}
- if (NULL == (strt = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ if (NULL == (strt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate start buffer");
PIN_LONG_ARRAY(ENVONLY, end, endP, &isCopy, "H5Sget_select_bounds: end not pinned");
- if (NULL == (en = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ if (NULL == (en = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate end buffer");
- if ((status = H5Sget_select_bounds((hid_t) spaceid, (hsize_t *) strt, (hsize_t *) en)) < 0)
+ if ((status = H5Sget_select_bounds((hid_t)spaceid, (hsize_t *)strt, (hsize_t *)en)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- for (i = 0; i < (size_t) rank; i++) {
- startP[i] = (jlong) strt[i];
- endP[i] = (jlong) en[i];
+ for (i = 0; i < (size_t)rank; i++) {
+ startP[i] = (jlong)strt[i];
+ endP[i] = (jlong)en[i];
} /* end for */
done:
@@ -1129,12 +1117,11 @@ done:
* Signature: (J)[B
*/
JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_H5_H5Sencode
- (JNIEnv *env, jclass clss, jlong obj_id)
+Java_hdf_hdf5lib_H5_H5Sencode(JNIEnv *env, jclass clss, jlong obj_id)
{
- unsigned char *bufPtr = NULL;
- size_t buf_size = 0;
- herr_t status = FAIL;
+ unsigned char *bufPtr = NULL;
+ size_t buf_size = 0;
+ herr_t status = FAIL;
jbyteArray returnedArray = NULL;
UNUSED(clss);
@@ -1148,16 +1135,16 @@ Java_hdf_hdf5lib_H5_H5Sencode
if (buf_size == 0)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sencode: buf_size = 0");
- if (NULL == (bufPtr = (unsigned char *) HDcalloc((size_t) 1, buf_size)))
+ if (NULL == (bufPtr = (unsigned char *)HDcalloc((size_t)1, buf_size)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sencode: failed to allocate encoding buffer");
- if ((status = H5Sencode2((hid_t) obj_id, bufPtr, &buf_size, H5P_DEFAULT)) < 0)
+ if ((status = H5Sencode2((hid_t)obj_id, bufPtr, &buf_size, H5P_DEFAULT)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (returnedArray = ENVPTR->NewByteArray(ENVONLY, (jsize) buf_size)))
+ if (NULL == (returnedArray = ENVPTR->NewByteArray(ENVONLY, (jsize)buf_size)))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- ENVPTR->SetByteArrayRegion(ENVONLY, returnedArray, 0, (jsize) buf_size, (jbyte *) bufPtr);
+ ENVPTR->SetByteArrayRegion(ENVONLY, returnedArray, 0, (jsize)buf_size, (jbyte *)bufPtr);
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
done:
@@ -1173,12 +1160,11 @@ done:
* Signature: ([B)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Sdecode
- (JNIEnv *env, jclass clss, jbyteArray buf)
+Java_hdf_hdf5lib_H5_H5Sdecode(JNIEnv *env, jclass clss, jbyteArray buf)
{
- jboolean isCopy;
- jbyte *bufP = NULL;
- hid_t sid = H5I_INVALID_HID;
+ jboolean isCopy;
+ jbyte * bufP = NULL;
+ hid_t sid = H5I_INVALID_HID;
UNUSED(clss);
@@ -1203,8 +1189,7 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab
- (JNIEnv *env, jclass clss, jlong obj_id)
+Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab(JNIEnv *env, jclass clss, jlong obj_id)
{
htri_t bval = JNI_FALSE;
@@ -1225,15 +1210,15 @@ done:
* Signature: (J[J[J[J[J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab
- (JNIEnv *env, jclass clss, jlong space_id, jlongArray start, jlongArray stride, jlongArray count, jlongArray block)
+Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab(JNIEnv *env, jclass clss, jlong space_id, jlongArray start,
+ jlongArray stride, jlongArray count, jlongArray block)
{
- jboolean isCopy;
- hsize_t *strt = NULL, *strd = NULL, *cnt = NULL, *blk = NULL;
- jlong *startP = NULL, *strideP = NULL, *countP = NULL, *blockP = NULL;
- jsize start_rank = -1, stride_rank = -1, count_rank = -1, block_rank = -1;
- int i, rank = -1;
- herr_t status = FAIL;
+ jboolean isCopy;
+ hsize_t *strt = NULL, *strd = NULL, *cnt = NULL, *blk = NULL;
+ jlong * startP = NULL, *strideP = NULL, *countP = NULL, *blockP = NULL;
+ jsize start_rank = -1, stride_rank = -1, count_rank = -1, block_rank = -1;
+ int i, rank = -1;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1245,7 +1230,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab
if (NULL == start) {
startP = NULL;
- strt = (hsize_t *) startP;
+ strt = (hsize_t *)startP;
}
else {
if ((start_rank = ENVPTR->GetArrayLength(ENVONLY, start)) < 0) {
@@ -1254,17 +1239,18 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab
}
if (start_rank != rank)
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: start rank doesn't match dataspace rank!");
+ H5_BAD_ARGUMENT_ERROR(ENVONLY,
+ "H5Sget_regular_hyperslab: start rank doesn't match dataspace rank!");
PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Sget_regular_hyperslab: start not pinned");
- if (NULL == (strt = (hsize_t *) HDmalloc((size_t)start_rank * sizeof(hsize_t))))
+ if (NULL == (strt = (hsize_t *)HDmalloc((size_t)start_rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate start buffer");
}
if (NULL == stride) {
strideP = NULL;
- strd = (hsize_t *) strideP;
+ strd = (hsize_t *)strideP;
}
else {
if ((stride_rank = ENVPTR->GetArrayLength(ENVONLY, stride)) < 0) {
@@ -1273,17 +1259,18 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab
}
if (stride_rank != rank)
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: stride rank doesn't match dataspace rank!");
+ H5_BAD_ARGUMENT_ERROR(ENVONLY,
+ "H5Sget_regular_hyperslab: stride rank doesn't match dataspace rank!");
PIN_LONG_ARRAY(ENVONLY, stride, strideP, &isCopy, "H5Sget_regular_hyperslab: stride not pinned");
- if (NULL == (strd = (hsize_t *) HDmalloc((size_t)stride_rank * sizeof(hsize_t))))
+ if (NULL == (strd = (hsize_t *)HDmalloc((size_t)stride_rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate stride buffer");
}
if (NULL == count) {
countP = NULL;
- cnt = (hsize_t *) countP;
+ cnt = (hsize_t *)countP;
}
else {
if ((count_rank = ENVPTR->GetArrayLength(ENVONLY, count)) < 0) {
@@ -1292,17 +1279,18 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab
}
if (count_rank != rank)
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: count rank doesn't match dataspace rank!");
+ H5_BAD_ARGUMENT_ERROR(ENVONLY,
+ "H5Sget_regular_hyperslab: count rank doesn't match dataspace rank!");
PIN_LONG_ARRAY(ENVONLY, count, countP, &isCopy, "H5Sget_regular_hyperslab: count not pinned");
- if (NULL == (cnt = (hsize_t *) HDmalloc((size_t)count_rank * sizeof(hsize_t))))
+ if (NULL == (cnt = (hsize_t *)HDmalloc((size_t)count_rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate count buffer");
}
if (NULL == block) {
blockP = NULL;
- blk = (hsize_t *) blockP;
+ blk = (hsize_t *)blockP;
}
else {
if ((block_rank = ENVPTR->GetArrayLength(ENVONLY, block)) < 0) {
@@ -1311,22 +1299,24 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab
}
if (block_rank != rank)
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: block rank doesn't match dataspace rank!");
+ H5_BAD_ARGUMENT_ERROR(ENVONLY,
+ "H5Sget_regular_hyperslab: block rank doesn't match dataspace rank!");
PIN_LONG_ARRAY(ENVONLY, block, blockP, &isCopy, "H5Sget_regular_hyperslab: block not pinned");
- if (NULL == (blk = (hsize_t *) HDmalloc((size_t)block_rank * sizeof(hsize_t))))
+ if (NULL == (blk = (hsize_t *)HDmalloc((size_t)block_rank * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate block buffer");
}
- if ((status = H5Sget_regular_hyperslab(space_id, (hsize_t *) strt, (hsize_t *) strd, (hsize_t *) cnt, (hsize_t *) blk)) < 0)
+ if ((status = H5Sget_regular_hyperslab(space_id, (hsize_t *)strt, (hsize_t *)strd, (hsize_t *)cnt,
+ (hsize_t *)blk)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
for (i = 0; i < start_rank; i++) {
- startP[i] = (jlong) strt[i];
- countP[i] = (jlong) cnt[i];
- strideP[i] = (jlong) strd[i];
- blockP[i] = (jlong) blk[i];
+ startP[i] = (jlong)strt[i];
+ countP[i] = (jlong)cnt[i];
+ strideP[i] = (jlong)strd[i];
+ blockP[i] = (jlong)blk[i];
} /* end for */
done:
diff --git a/java/src/jni/h5sImp.h b/java/src/jni/h5sImp.h
index cea2ebf..ee28b39 100644
--- a/java/src/jni/h5sImp.h
+++ b/java/src/jni/h5sImp.h
@@ -26,27 +26,22 @@ extern "C" {
* Method: _H5Screate
* Signature: (I)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Screate
-(JNIEnv *, jclass, jint);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Screate(JNIEnv *, jclass, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Screate_simple
* Signature: (I[J[J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Screate_1simple
-(JNIEnv *, jclass, jint, jlongArray, jlongArray);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Screate_1simple(JNIEnv *, jclass, jint, jlongArray,
+ jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Scopy
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Scopy
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Scopy(JNIEnv *, jclass, jlong);
#ifdef notdef
/* 10/28/99 -- added code to copy the array -- this is not used,
@@ -63,9 +58,8 @@ Java_hdf_hdf5lib_H5__1H5Scopy
* Method: H5Sselect_elements
* Signature: (JII[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sselect_1elements
-(JNIEnv *, jclass, jlong, jint, jint, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1elements(JNIEnv *, jclass, jlong, jint, jint,
+ jlongArray);
#endif
/*
@@ -73,242 +67,197 @@ Java_hdf_hdf5lib_H5_H5Sselect_1elements
* Method: H5Sselect_elements
* Signature: (JII[B)I
*/
-JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1elements
-(JNIEnv *, jclass, jlong, jint, jint, jbyteArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1elements(JNIEnv *, jclass, jlong, jint, jint,
+ jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sselect_all
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sselect_1all
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1all(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sselect_none
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sselect_1none
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1none(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sselect_valid
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Sselect_1valid
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1valid(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sget_simple_extent_npoints
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sget_select_npoints
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sget_select_type
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1select_1type
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1type(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sget_simple_extent_ndims
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sget_simple_extent_dims
* Signature: (J[J[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims
-(JNIEnv *, jclass, jlong, jlongArray, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims(JNIEnv *, jclass, jlong, jlongArray,
+ jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sget_simple_extent_type
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sset_extent_simple
* Signature: (JI[J[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple
-(JNIEnv *, jclass, jlong, jint, jlongArray, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple(JNIEnv *, jclass, jlong, jint, jlongArray,
+ jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sis_simple
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Sis_1simple
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Sis_1simple(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Soffset_simple
* Signature: (J[B)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Soffset_1simple
-(JNIEnv *, jclass, jlong, jbyteArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Soffset_1simple(JNIEnv *, jclass, jlong, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sextent_copy
* Signature: (JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sextent_1copy
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sextent_1copy(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sextent_equal
* Signature: (JJ)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Sextent_1equal
- (JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Sextent_1equal(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sset_extent_none
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sset_1extent_1none
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sset_1extent_1none(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sselect_hyperslab
* Signature: (JI[J[J[J[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab
-(JNIEnv *, jclass, jlong, jint, jlongArray, jlongArray, jlongArray, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab(JNIEnv *, jclass, jlong, jint, jlongArray,
+ jlongArray, jlongArray, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sclose
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Sclose
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Sclose(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sget_select_hyper_nblocks
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1nblocks
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1nblocks(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sget_select_elem_npoints
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1npoints
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1npoints(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sget_select_hyper_blocklist
* Signature: (JJJ[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist
-(JNIEnv *, jclass, jlong, jlong, jlong, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist(JNIEnv *, jclass, jlong, jlong,
+ jlong, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sget_select_elem_pointlist
* Signature: (JJJ[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist
-(JNIEnv *, jclass, jlong, jlong, jlong, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist(JNIEnv *, jclass, jlong, jlong,
+ jlong, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sget_select_bounds
* Signature: (J[J[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds
-(JNIEnv *, jclass, jlong, jlongArray, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds(JNIEnv *, jclass, jlong, jlongArray,
+ jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sencode
* Signature: (J)[B
*/
-JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_H5_H5Sencode
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_H5_H5Sencode(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sdecode
* Signature: ([B)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Sdecode
- (JNIEnv *, jclass, jbyteArray);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sdecode(JNIEnv *, jclass, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sis_regular_hyperslab
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Sget_regular_hyperslab
* Signature: (J[J[J[J[J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab
-(JNIEnv *, jclass, jlong, jlongArray, jlongArray, jlongArray, jlongArray);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab(JNIEnv *, jclass, jlong, jlongArray,
+ jlongArray, jlongArray, jlongArray);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c
index 1cbf1a5..e968ad2 100644
--- a/java/src/jni/h5tImp.c
+++ b/java/src/jni/h5tImp.c
@@ -40,11 +40,10 @@ extern "C" {
* Signature: (JLjava/lang/String;J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Topen2
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist)
+Java_hdf_hdf5lib_H5__1H5Topen2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist)
{
const char *datatypeName = NULL;
- hid_t status = H5I_INVALID_HID;
+ hid_t status = H5I_INVALID_HID;
UNUSED(clss);
@@ -69,8 +68,7 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Tcommitted
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tcommitted(JNIEnv *env, jclass clss, jlong type_id)
{
htri_t bval = JNI_FALSE;
@@ -91,14 +89,13 @@ done:
* Signature: (IJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Tcreate
- (JNIEnv *env, jclass clss, jint dclass, jlong size)
+Java_hdf_hdf5lib_H5__1H5Tcreate(JNIEnv *env, jclass clss, jint dclass, jlong size)
{
hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
- if ((retVal = H5Tcreate((H5T_class_t )dclass, (size_t)size)) < 0)
+ if ((retVal = H5Tcreate((H5T_class_t)dclass, (size_t)size)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -111,8 +108,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Tcopy
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5__1H5Tcopy(JNIEnv *env, jclass clss, jlong type_id)
{
hid_t retVal = H5I_INVALID_HID;
@@ -131,8 +127,7 @@ done:
* Signature: (JJ)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Tequal
- (JNIEnv *env, jclass clss, jlong type_id1, jlong type_id2)
+Java_hdf_hdf5lib_H5_H5Tequal(JNIEnv *env, jclass clss, jlong type_id1, jlong type_id2)
{
htri_t bval = JNI_FALSE;
@@ -153,8 +148,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tlock
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tlock(JNIEnv *env, jclass clss, jlong type_id)
{
herr_t retVal = FAIL;
@@ -173,8 +167,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1class
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tget_1class(JNIEnv *env, jclass clss, jlong type_id)
{
H5T_class_t retVal = H5T_NO_CLASS;
@@ -193,8 +186,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1size
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tget_1size(JNIEnv *env, jclass clss, jlong type_id)
{
size_t retVal = 0;
@@ -213,10 +205,9 @@ done:
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1size
- (JNIEnv *env, jclass clss, jlong type_id, jlong size)
+Java_hdf_hdf5lib_H5_H5Tset_1size(JNIEnv *env, jclass clss, jlong type_id, jlong size)
{
- size_t tsize = (size_t)size;
+ size_t tsize = (size_t)size;
herr_t retVal = FAIL;
UNUSED(clss);
@@ -234,8 +225,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1order
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tget_1order(JNIEnv *env, jclass clss, jlong type_id)
{
H5T_order_t retVal = H5T_ORDER_ERROR;
@@ -254,8 +244,7 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1order
- (JNIEnv *env, jclass clss, jlong type_id, jint order)
+Java_hdf_hdf5lib_H5_H5Tset_1order(JNIEnv *env, jclass clss, jlong type_id, jint order)
{
herr_t retVal = FAIL;
@@ -274,8 +263,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1precision
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tget_1precision(JNIEnv *env, jclass clss, jlong type_id)
{
size_t retVal = 0;
@@ -294,8 +282,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1precision_1long
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tget_1precision_1long(JNIEnv *env, jclass clss, jlong type_id)
{
size_t retVal = 0;
@@ -314,8 +301,7 @@ done:
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1precision
- (JNIEnv *env, jclass clss, jlong type_id, jlong precision)
+Java_hdf_hdf5lib_H5_H5Tset_1precision(JNIEnv *env, jclass clss, jlong type_id, jlong precision)
{
herr_t retVal = FAIL;
@@ -334,8 +320,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1offset
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tget_1offset(JNIEnv *env, jclass clss, jlong type_id)
{
int retVal = -1;
@@ -354,8 +339,7 @@ done:
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1offset
- (JNIEnv *env, jclass clss, jlong type_id, jlong offset)
+Java_hdf_hdf5lib_H5_H5Tset_1offset(JNIEnv *env, jclass clss, jlong type_id, jlong offset)
{
herr_t retVal = FAIL;
@@ -374,12 +358,11 @@ done:
* Signature: (J[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1pad
- (JNIEnv *env, jclass clss, jlong type_id, jintArray pad)
+Java_hdf_hdf5lib_H5_H5Tget_1pad(JNIEnv *env, jclass clss, jlong type_id, jintArray pad)
{
- jboolean isCopy;
- jint *P = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jint * P = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -404,8 +387,7 @@ done:
* Signature: (JII)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1pad
- (JNIEnv *env, jclass clss, jlong type_id, jint lsb, jint msb)
+Java_hdf_hdf5lib_H5_H5Tset_1pad(JNIEnv *env, jclass clss, jlong type_id, jint lsb, jint msb)
{
herr_t retVal = FAIL;
@@ -424,8 +406,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1sign
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tget_1sign(JNIEnv *env, jclass clss, jlong type_id)
{
H5T_sign_t retVal = H5T_SGN_ERROR;
@@ -444,8 +425,7 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1sign
- (JNIEnv *env, jclass clss, jlong type_id, jint sign)
+Java_hdf_hdf5lib_H5_H5Tset_1sign(JNIEnv *env, jclass clss, jlong type_id, jint sign)
{
herr_t retVal = FAIL;
@@ -464,13 +444,12 @@ done:
* Signature: (J[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1fields_1int
- (JNIEnv *env, jclass clss, jlong type_id, jintArray fields)
+Java_hdf_hdf5lib_H5_H5Tget_1fields_1int(JNIEnv *env, jclass clss, jlong type_id, jintArray fields)
{
- jboolean isCopy;
- jsize arrLen;
- jint *P = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jsize arrLen;
+ jint * P = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -486,7 +465,8 @@ Java_hdf_hdf5lib_H5_H5Tget_1fields_1int
PIN_INT_ARRAY(ENVONLY, fields, P, &isCopy, "H5Tget_fields_int: fields not pinned");
- if ((status = H5Tget_fields((hid_t)type_id, (size_t *)&(P[0]), (size_t *)&(P[1]), (size_t *)&(P[2]), (size_t *)&(P[3]), (size_t *)&(P[4]))) < 0)
+ if ((status = H5Tget_fields((hid_t)type_id, (size_t *)&(P[0]), (size_t *)&(P[1]), (size_t *)&(P[2]),
+ (size_t *)&(P[3]), (size_t *)&(P[4]))) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -502,13 +482,12 @@ done:
* Signature: (J[J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1fields
- (JNIEnv *env, jclass clss, jlong type_id, jlongArray fields)
+Java_hdf_hdf5lib_H5_H5Tget_1fields(JNIEnv *env, jclass clss, jlong type_id, jlongArray fields)
{
- jboolean isCopy;
- jlong *fieldsArray = NULL;
- jsize arrLen;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jlong * fieldsArray = NULL;
+ jsize arrLen;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -525,21 +504,21 @@ Java_hdf_hdf5lib_H5_H5Tget_1fields
PIN_LONG_ARRAY(ENVONLY, fields, fieldsArray, &isCopy, "H5Tget_fields: fields not pinned");
{ /* Direct cast (size_t *)variable fails on 32-bit environment */
- size_t spos_t = 0;
- size_t epos_t = 0;
- size_t esize_t = 0;
- size_t mpos_t = 0;
- size_t msize_t = 0;
+ size_t spos_t = 0;
+ size_t epos_t = 0;
+ size_t esize_t = 0;
+ size_t mpos_t = 0;
+ size_t msize_t = 0;
long long fields_temp = *(&fieldsArray[0]);
- spos_t = (size_t)fields_temp;
- fields_temp = *(&fieldsArray[1]);
- epos_t = (size_t)fields_temp;
- fields_temp = *(&fieldsArray[2]);
- esize_t = (size_t)fields_temp;
- fields_temp = *(&fieldsArray[3]);
- mpos_t = (size_t)fields_temp;
- fields_temp = *(&fieldsArray[4]);
- msize_t = (size_t)fields_temp;
+ spos_t = (size_t)fields_temp;
+ fields_temp = *(&fieldsArray[1]);
+ epos_t = (size_t)fields_temp;
+ fields_temp = *(&fieldsArray[2]);
+ esize_t = (size_t)fields_temp;
+ fields_temp = *(&fieldsArray[3]);
+ mpos_t = (size_t)fields_temp;
+ fields_temp = *(&fieldsArray[4]);
+ msize_t = (size_t)fields_temp;
if ((status = H5Tget_fields((hid_t)type_id, &spos_t, &epos_t, &esize_t, &mpos_t, &msize_t)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -564,13 +543,13 @@ done:
* Signature: (JJJJJJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1fields
- (JNIEnv *env, jclass clss, jlong type_id, jlong spos, jlong epos,
- jlong esize, jlong mpos, jlong msize)
+Java_hdf_hdf5lib_H5_H5Tset_1fields(JNIEnv *env, jclass clss, jlong type_id, jlong spos, jlong epos,
+ jlong esize, jlong mpos, jlong msize)
{
UNUSED(clss);
- if (H5Tset_fields((hid_t)type_id, (size_t)spos, (size_t)epos, (size_t)esize, (size_t)mpos, (size_t)msize) < 0)
+ if (H5Tset_fields((hid_t)type_id, (size_t)spos, (size_t)epos, (size_t)esize, (size_t)mpos,
+ (size_t)msize) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -583,14 +562,13 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1ebias
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tget_1ebias(JNIEnv *env, jclass clss, jlong type_id)
{
size_t retVal = 0;
UNUSED(clss);
- if (!(retVal = H5Tget_ebias((hid_t)type_id)))
+ if (!(retVal = H5Tget_ebias((hid_t)type_id)))
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -603,8 +581,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1ebias_1long
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tget_1ebias_1long(JNIEnv *env, jclass clss, jlong type_id)
{
size_t retVal = 0;
@@ -623,8 +600,7 @@ done:
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1ebias
- (JNIEnv *env, jclass clss, jlong type_id, jlong ebias)
+Java_hdf_hdf5lib_H5_H5Tset_1ebias(JNIEnv *env, jclass clss, jlong type_id, jlong ebias)
{
herr_t retVal = FAIL;
@@ -643,8 +619,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1norm
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tget_1norm(JNIEnv *env, jclass clss, jlong type_id)
{
H5T_norm_t retVal = H5T_NORM_ERROR;
@@ -663,14 +638,13 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1norm
- (JNIEnv *env, jclass clss, jlong type_id, jint norm)
+Java_hdf_hdf5lib_H5_H5Tset_1norm(JNIEnv *env, jclass clss, jlong type_id, jint norm)
{
herr_t retVal = FAIL;
UNUSED(clss);
- if ((retVal = H5Tset_norm((hid_t)type_id, (H5T_norm_t )norm)) < 0)
+ if ((retVal = H5Tset_norm((hid_t)type_id, (H5T_norm_t)norm)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -683,8 +657,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1inpad
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tget_1inpad(JNIEnv *env, jclass clss, jlong type_id)
{
H5T_pad_t retVal = H5T_PAD_ERROR;
@@ -703,14 +676,13 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1inpad
- (JNIEnv *env, jclass clss, jlong type_id, jint inpad)
+Java_hdf_hdf5lib_H5_H5Tset_1inpad(JNIEnv *env, jclass clss, jlong type_id, jint inpad)
{
herr_t retVal = FAIL;
UNUSED(clss);
- if ((retVal = H5Tset_inpad((hid_t)type_id, (H5T_pad_t) inpad)) < 0)
+ if ((retVal = H5Tset_inpad((hid_t)type_id, (H5T_pad_t)inpad)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -723,8 +695,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1cset
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tget_1cset(JNIEnv *env, jclass clss, jlong type_id)
{
H5T_cset_t retVal = H5T_CSET_ERROR;
@@ -743,8 +714,7 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1cset
- (JNIEnv *env, jclass clss, jlong type_id, jint cset)
+Java_hdf_hdf5lib_H5_H5Tset_1cset(JNIEnv *env, jclass clss, jlong type_id, jint cset)
{
herr_t retVal = FAIL;
@@ -763,8 +733,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1strpad
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tget_1strpad(JNIEnv *env, jclass clss, jlong type_id)
{
H5T_str_t retVal = H5T_STR_ERROR;
@@ -783,8 +752,7 @@ done:
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1strpad
- (JNIEnv *env, jclass clss, jlong type_id, jint strpad)
+Java_hdf_hdf5lib_H5_H5Tset_1strpad(JNIEnv *env, jclass clss, jlong type_id, jint strpad)
{
herr_t retVal = FAIL;
@@ -803,8 +771,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1nmembers
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tget_1nmembers(JNIEnv *env, jclass clss, jlong type_id)
{
int retVal = -1;
@@ -823,11 +790,10 @@ done:
* Signature: (JI)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1member_1name
- (JNIEnv *env, jclass clss, jlong type_id, jint field_idx)
+Java_hdf_hdf5lib_H5_H5Tget_1member_1name(JNIEnv *env, jclass clss, jlong type_id, jint field_idx)
{
- char *member_name = NULL;
- jstring str = NULL;
+ char * member_name = NULL;
+ jstring str = NULL;
UNUSED(clss);
@@ -850,11 +816,10 @@ done:
* Signature: (JLjava/lang/String)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1member_1index
- (JNIEnv *env, jclass clss, jlong type_id, jstring field_name)
+Java_hdf_hdf5lib_H5_H5Tget_1member_1index(JNIEnv *env, jclass clss, jlong type_id, jstring field_name)
{
const char *datatypeName = NULL;
- int index = -1;
+ int index = -1;
UNUSED(clss);
@@ -879,8 +844,7 @@ done:
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Tget_1member_1type
- (JNIEnv *env, jclass clss, jlong type_id, jint field_idx)
+Java_hdf_hdf5lib_H5__1H5Tget_1member_1type(JNIEnv *env, jclass clss, jlong type_id, jint field_idx)
{
hid_t retVal = H5I_INVALID_HID;
@@ -899,8 +863,7 @@ done:
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1member_1offset
- (JNIEnv *env, jclass clss, jlong type_id, jint memno)
+Java_hdf_hdf5lib_H5_H5Tget_1member_1offset(JNIEnv *env, jclass clss, jlong type_id, jint memno)
{
UNUSED(env);
UNUSED(clss);
@@ -914,8 +877,7 @@ Java_hdf_hdf5lib_H5_H5Tget_1member_1offset
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1member_1class
- (JNIEnv *env, jclass clss, jlong type_id, jint memno)
+Java_hdf_hdf5lib_H5_H5Tget_1member_1class(JNIEnv *env, jclass clss, jlong type_id, jint memno)
{
H5T_class_t retVal = H5T_NO_CLASS;
@@ -934,12 +896,12 @@ done:
* Signature: (JLjava/lang/String;JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tinsert
- (JNIEnv *env, jclass clss, jlong type_id, jstring name, jlong offset, jlong field_id)
+Java_hdf_hdf5lib_H5_H5Tinsert(JNIEnv *env, jclass clss, jlong type_id, jstring name, jlong offset,
+ jlong field_id)
{
const char *datatypeName = NULL;
- long off = (long)offset;
- herr_t status = FAIL;
+ long off = (long)offset;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -964,8 +926,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tpack
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tpack(JNIEnv *env, jclass clss, jlong type_id)
{
herr_t retVal = FAIL;
@@ -984,13 +945,12 @@ done:
* Signature: (JJJ[B)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Treclaim
- (JNIEnv *env, jclass clss, jlong type_id, jlong space_id,
- jlong xfer_plist_id, jbyteArray buf)
+Java_hdf_hdf5lib_H5_H5Treclaim(JNIEnv *env, jclass clss, jlong type_id, jlong space_id, jlong xfer_plist_id,
+ jbyteArray buf)
{
- jboolean bufIsCopy;
- jbyte *pinBuf = NULL;
- herr_t status = FAIL;
+ jboolean bufIsCopy;
+ jbyte * pinBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1013,8 +973,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Tclose
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5__1H5Tclose(JNIEnv *env, jclass clss, jlong type_id)
{
herr_t retVal = FAIL;
@@ -1033,8 +992,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Tvlen_1create
- (JNIEnv *env, jclass clss, jlong base_id)
+Java_hdf_hdf5lib_H5__1H5Tvlen_1create(JNIEnv *env, jclass clss, jlong base_id)
{
hid_t retVal = H5I_INVALID_HID;
@@ -1053,8 +1011,7 @@ done:
* Signature: (JLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1tag
- (JNIEnv *env, jclass clss, jlong type, jstring tag)
+Java_hdf_hdf5lib_H5_H5Tset_1tag(JNIEnv *env, jclass clss, jlong type, jstring tag)
{
const char *tagBuf = NULL;
herr_t status = FAIL;
@@ -1082,11 +1039,10 @@ done:
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1tag
- (JNIEnv *env, jclass clss, jlong type)
+Java_hdf_hdf5lib_H5_H5Tget_1tag(JNIEnv *env, jclass clss, jlong type)
{
- jstring str = NULL;
- char *tag = NULL;
+ jstring str = NULL;
+ char * tag = NULL;
UNUSED(clss);
@@ -1109,8 +1065,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Tget_1super
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5__1H5Tget_1super(JNIEnv *env, jclass clss, jlong type_id)
{
hid_t retVal = H5I_INVALID_HID;
@@ -1129,8 +1084,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Tenum_1create
- (JNIEnv *env, jclass clss, jlong base_id)
+Java_hdf_hdf5lib_H5__1H5Tenum_1create(JNIEnv *env, jclass clss, jlong base_id)
{
hid_t retVal = H5I_INVALID_HID;
@@ -1149,12 +1103,12 @@ done:
* Signature: (JLjava/lang/String;[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tenum_1insert_1int
- (JNIEnv *env, jclass clss, jlong type_id, jstring name, jintArray value)
+Java_hdf_hdf5lib_H5_H5Tenum_1insert_1int(JNIEnv *env, jclass clss, jlong type_id, jstring name,
+ jintArray value)
{
const char *memberName = NULL;
jboolean isCopy;
- jint *intBuf = NULL;
+ jint * intBuf = NULL;
herr_t status = FAIL;
UNUSED(clss);
@@ -1186,13 +1140,12 @@ done:
* Signature: (JLjava/lang/String;[B)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Tenum_1insert
- (JNIEnv *env, jclass clss, jlong type_id, jstring name, jbyteArray value)
+Java_hdf_hdf5lib_H5_H5Tenum_1insert(JNIEnv *env, jclass clss, jlong type_id, jstring name, jbyteArray value)
{
const char *memberName = NULL;
jboolean isCopy;
- jbyte *memberBuf = NULL;
- herr_t status = FAIL;
+ jbyte * memberBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1221,15 +1174,14 @@ done:
* Signature: (J[I[Ljava/lang/String;I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int
- (JNIEnv *env, jclass clss, jlong type_id, jintArray value, jobjectArray name,
- jint size)
+Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int(JNIEnv *env, jclass clss, jlong type_id, jintArray value,
+ jobjectArray name, jint size)
{
- jboolean isCopy;
- jstring str;
- jint *intP = NULL;
- char *nameP = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jstring str;
+ jint * intP = NULL;
+ char * nameP = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1238,7 +1190,7 @@ Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int
if (size <= 0)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof_int: name size < 0");
- if (NULL == (nameP = (char *) HDmalloc(sizeof(char) * (size_t)size)))
+ if (NULL == (nameP = (char *)HDmalloc(sizeof(char) * (size_t)size)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tenum_nameof_int: failed to allocate name buffer");
PIN_INT_ARRAY(ENVONLY, value, intP, &isCopy, "H5Tenum_nameof_int: value not pinned");
@@ -1268,14 +1220,13 @@ done:
* Signature: (J[BJ)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Tenum_1nameof
- (JNIEnv *env, jclass clss, jlong type_id, jbyteArray value, jlong size)
+Java_hdf_hdf5lib_H5_H5Tenum_1nameof(JNIEnv *env, jclass clss, jlong type_id, jbyteArray value, jlong size)
{
- jboolean isCopy;
- jstring str = NULL;
- jbyte *byteP = NULL;
- char *nameP = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jstring str = NULL;
+ jbyte * byteP = NULL;
+ char * nameP = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1284,7 +1235,7 @@ Java_hdf_hdf5lib_H5_H5Tenum_1nameof
if (NULL == value)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof: value is NULL");
- if (NULL == (nameP = (char *) HDmalloc(sizeof(char) * (size_t)size)))
+ if (NULL == (nameP = (char *)HDmalloc(sizeof(char) * (size_t)size)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tenum_nameof: failed to allocate name buffer");
PIN_BYTE_ARRAY(ENVONLY, value, byteP, &isCopy, "H5Tenum_nameof: value not pinned");
@@ -1311,13 +1262,13 @@ done:
* Signature: (JLjava/lang/String;[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tenum_1valueof_1int
- (JNIEnv *env, jclass clss, jlong type_id, jstring name, jintArray value)
+Java_hdf_hdf5lib_H5_H5Tenum_1valueof_1int(JNIEnv *env, jclass clss, jlong type_id, jstring name,
+ jintArray value)
{
const char *enumValue = NULL;
jboolean isCopy;
- jint *enumValueBuf = NULL;
- herr_t status = FAIL;
+ jint * enumValueBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1348,13 +1299,12 @@ done:
* Signature: (JLjava/lang/String;[B)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Tenum_1valueof
- (JNIEnv *env, jclass clss, jlong type_id, jstring name, jbyteArray value)
+Java_hdf_hdf5lib_H5_H5Tenum_1valueof(JNIEnv *env, jclass clss, jlong type_id, jstring name, jbyteArray value)
{
const char *enumValue = NULL;
jboolean isCopy;
- jbyte *enumValueBuf = NULL;
- herr_t status = FAIL;
+ jbyte * enumValueBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1383,12 +1333,12 @@ done:
* Signature: (JI[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1member_1value_1int
- (JNIEnv *env, jclass clss, jlong type_id, jint membno, jintArray value)
+Java_hdf_hdf5lib_H5_H5Tget_1member_1value_1int(JNIEnv *env, jclass clss, jlong type_id, jint membno,
+ jintArray value)
{
- jboolean isCopy;
- jint *intP = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jint * intP = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1413,12 +1363,12 @@ done:
* Signature: (JI[B)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1member_1value
- (JNIEnv *env, jclass clss, jlong type_id, jint membno, jbyteArray value)
+Java_hdf_hdf5lib_H5_H5Tget_1member_1value(JNIEnv *env, jclass clss, jlong type_id, jint membno,
+ jbyteArray value)
{
- jboolean isCopy;
- jbyte *byteP = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jbyte * byteP = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1441,8 +1391,7 @@ done:
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1array_1ndims
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tget_1array_1ndims(JNIEnv *env, jclass clss, jlong type_id)
{
int ndims = -1;
@@ -1461,15 +1410,15 @@ done:
* Signature: (J[I[I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1array_1dims
- (JNIEnv *env, jclass clss, jlong type_id, jintArray dims, jintArray perms)
+Java_hdf_hdf5lib_H5_H5Tget_1array_1dims(JNIEnv *env, jclass clss, jlong type_id, jintArray dims,
+ jintArray perms)
{
- jboolean isCopy;
- hsize_t *cdims = NULL;
- size_t i;
- jsize dlen;
- jint *dimsP = NULL;
- int ndims = -1;
+ jboolean isCopy;
+ hsize_t *cdims = NULL;
+ size_t i;
+ jsize dlen;
+ jint * dimsP = NULL;
+ int ndims = -1;
UNUSED(clss);
UNUSED(perms);
@@ -1484,14 +1433,14 @@ Java_hdf_hdf5lib_H5_H5Tget_1array_1dims
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tget_array_dims: dims array length < 0");
}
- if (NULL == (cdims = (hsize_t *) HDmalloc((size_t)dlen * sizeof(hsize_t))))
+ if (NULL == (cdims = (hsize_t *)HDmalloc((size_t)dlen * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tget_array_dims: failed to allocate dimension buffer");
if ((ndims = H5Tget_array_dims2((hid_t)type_id, cdims)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- for (i = 0; i < (size_t) dlen; i++) {
- dimsP[i] = (jint) cdims[i];
+ for (i = 0; i < (size_t)dlen; i++) {
+ dimsP[i] = (jint)cdims[i];
} /* end for */
done:
@@ -1509,8 +1458,7 @@ done:
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Tis_1variable_1str
- (JNIEnv *env, jclass clss, jlong type_id)
+Java_hdf_hdf5lib_H5_H5Tis_1variable_1str(JNIEnv *env, jclass clss, jlong type_id)
{
htri_t bval = JNI_FALSE;
@@ -1531,8 +1479,7 @@ done:
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Tget_1native_1type
- (JNIEnv *env, jclass clss, jlong type_id, jint direction)
+Java_hdf_hdf5lib_H5__1H5Tget_1native_1type(JNIEnv *env, jclass clss, jlong type_id, jint direction)
{
hid_t native_tid = H5I_INVALID_HID;
@@ -1551,8 +1498,7 @@ done:
* Signature: (JI)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Tdetect_1class
- (JNIEnv *env, jclass clss, jlong type_id, jint dtype_class)
+Java_hdf_hdf5lib_H5_H5Tdetect_1class(JNIEnv *env, jclass clss, jlong type_id, jint dtype_class)
{
htri_t bval = JNI_FALSE;
@@ -1573,12 +1519,11 @@ done:
* Signature: (JLjava/lang/String;JJJJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Tcommit
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type,
- jlong link_plist_id, jlong create_plist_id, jlong access_plist_id)
+Java_hdf_hdf5lib_H5_H5Tcommit(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type,
+ jlong link_plist_id, jlong create_plist_id, jlong access_plist_id)
{
const char *datatypeName = NULL;
- herr_t status = FAIL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1587,7 +1532,8 @@ Java_hdf_hdf5lib_H5_H5Tcommit
PIN_JAVA_STRING(ENVONLY, name, datatypeName, NULL, "H5Tcommit: datatype name not pinned");
- if ((status = H5Tcommit2((hid_t)loc_id, datatypeName, (hid_t)type, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id)) < 0)
+ if ((status = H5Tcommit2((hid_t)loc_id, datatypeName, (hid_t)type, (hid_t)link_plist_id,
+ (hid_t)create_plist_id, (hid_t)access_plist_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -1601,15 +1547,14 @@ done:
* Signature: (JI[J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Tarray_1create2
- (JNIEnv *env, jclass clss, jlong base_id, jint rank, jlongArray dims)
+Java_hdf_hdf5lib_H5__1H5Tarray_1create2(JNIEnv *env, jclass clss, jlong base_id, jint rank, jlongArray dims)
{
- jboolean isCopy;
- hsize_t *cdims = NULL;
- size_t i;
- jlong *dimsP = NULL;
- jsize dlen;
- hid_t retVal = H5I_INVALID_HID;
+ jboolean isCopy;
+ hsize_t *cdims = NULL;
+ size_t i;
+ jlong * dimsP = NULL;
+ jsize dlen;
+ hid_t retVal = H5I_INVALID_HID;
UNUSED(clss);
@@ -1628,10 +1573,10 @@ Java_hdf_hdf5lib_H5__1H5Tarray_1create2
if (dlen != rank)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tarray_create: dimension array length != array rank");
- if (NULL == (cdims = (hsize_t *) HDmalloc((size_t)dlen * sizeof(hsize_t))))
+ if (NULL == (cdims = (hsize_t *)HDmalloc((size_t)dlen * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tarray_create: failed to allocate dimension buffer");
- for (i = 0; i < (size_t) dlen; i++) {
+ for (i = 0; i < (size_t)dlen; i++) {
cdims[i] = (hsize_t)dimsP[i];
} /* end for */
@@ -1653,15 +1598,14 @@ done:
* Signature: (J[J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2
- (JNIEnv *env, jclass clss, jlong type_id, jlongArray dims)
+Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2(JNIEnv *env, jclass clss, jlong type_id, jlongArray dims)
{
- jboolean isCopy;
- hsize_t *cdims = NULL;
- size_t i;
- jlong *dimsP = NULL;
- jsize dlen;
- int ndims = -1;
+ jboolean isCopy;
+ hsize_t *cdims = NULL;
+ size_t i;
+ jlong * dimsP = NULL;
+ jsize dlen;
+ int ndims = -1;
UNUSED(clss);
@@ -1675,14 +1619,14 @@ Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tarray_get_dims2: dims array length < 0");
}
- if (NULL == (cdims = (hsize_t *) HDmalloc((size_t)dlen * sizeof(hsize_t))))
+ if (NULL == (cdims = (hsize_t *)HDmalloc((size_t)dlen * sizeof(hsize_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tarray_get_dims2: failed to allocate dimension buffer");
- if ((ndims = H5Tget_array_dims2((hid_t)type_id, (hsize_t*)cdims)) < 0)
+ if ((ndims = H5Tget_array_dims2((hid_t)type_id, (hsize_t *)cdims)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- for (i = 0; i < (size_t) dlen; i++) {
- dimsP[i] = (jlong) cdims[i];
+ for (i = 0; i < (size_t)dlen; i++) {
+ dimsP[i] = (jlong)cdims[i];
} /* end for */
done:
@@ -1700,14 +1644,13 @@ done:
* Signature: (JJJ[B[BJ)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Tconvert
- (JNIEnv *env, jclass clss, jlong src_id, jlong dst_id, jlong nelmts,
- jbyteArray buf, jbyteArray background, jlong plist_id)
+Java_hdf_hdf5lib_H5_H5Tconvert(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id, jlong nelmts,
+ jbyteArray buf, jbyteArray background, jlong plist_id)
{
- jboolean isCopy;
- jbyte *bufP = NULL;
- jbyte *bgP = NULL;
- herr_t status = FAIL;
+ jboolean isCopy;
+ jbyte * bufP = NULL;
+ jbyte * bgP = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -1719,7 +1662,8 @@ Java_hdf_hdf5lib_H5_H5Tconvert
if (background)
PIN_BYTE_ARRAY(ENVONLY, background, bgP, &isCopy, "H5Tconvert: background buffer not pinned");
- if ((status = H5Tconvert((hid_t)src_id, (hid_t)dst_id, (size_t)nelmts, (void *)bufP, (void *)bgP, (hid_t)plist_id)) < 0)
+ if ((status = H5Tconvert((hid_t)src_id, (hid_t)dst_id, (size_t)nelmts, (void *)bufP, (void *)bgP,
+ (hid_t)plist_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
@@ -1763,7 +1707,6 @@ done:
return;
}
-
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/h5tImp.h b/java/src/jni/h5tImp.h
index 78e4561..41f7681 100644
--- a/java/src/jni/h5tImp.h
+++ b/java/src/jni/h5tImp.h
@@ -26,612 +26,481 @@ extern "C" {
* Method: _H5Topen2
* Signature: (JLjava/lang/String;J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Topen2
- (JNIEnv *, jclass, jlong, jstring, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Topen2(JNIEnv *, jclass, jlong, jstring, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tcommitted
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Tcommitted
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Tcommitted(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Tcreate
* Signature: (IJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Tcreate
- (JNIEnv *, jclass, jint, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tcreate(JNIEnv *, jclass, jint, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Tcopy
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Tcopy
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tcopy(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tequal
* Signature: (JJ)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Tequal
- (JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Tequal(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tlock
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tlock
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tlock(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_class
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1class
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1class(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_size
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1size
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Tget_1size(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tset_size
* Signature: (JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1size
- (JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1size(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_order
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1order
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1order(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tset_order
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1order
- (JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1order(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_precision
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1precision
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1precision(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_precision_long
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1precision_1long
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Tget_1precision_1long(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tset_precision
* Signature: (JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1precision
- (JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1precision(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_offset
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1offset
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1offset(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tset_offset
* Signature: (JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1offset
- (JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1offset(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_pad
* Signature: (J[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1pad
- (JNIEnv *, jclass, jlong, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1pad(JNIEnv *, jclass, jlong, jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tset_pad
* Signature: (JII)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1pad
- (JNIEnv *, jclass, jlong, jint, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1pad(JNIEnv *, jclass, jlong, jint, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_sign
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1sign
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1sign(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tset_sign
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1sign
- (JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1sign(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_fields_int
* Signature: (J[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1fields_1int
- (JNIEnv *, jclass, jlong, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1fields_1int(JNIEnv *, jclass, jlong, jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_fields
* Signature: (J[J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1fields
- (JNIEnv *, jclass, jlong, jlongArray);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tget_1fields(JNIEnv *, jclass, jlong, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tset_fields
* Signature: (JJJJJJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1fields
- (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tset_1fields(JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_ebias
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1ebias
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1ebias(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_ebias_long
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1ebias_1long
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Tget_1ebias_1long(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tset_ebias
* Signature: (JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1ebias
- (JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1ebias(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_norm
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1norm
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1norm(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tset_norm
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1norm
- (JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1norm(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_inpad
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1inpad
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1inpad(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tset_inpad
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1inpad
- (JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1inpad(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_cset
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1cset
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1cset(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tset_cset
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1cset
- (JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1cset(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_strpad
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1strpad
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1strpad(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tset_strpad
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1strpad
- (JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1strpad(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_nmembers
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1nmembers
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1nmembers(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_member_name
* Signature: (JI)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1member_1name
- (JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1name(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_member_index
* Signature: (JLjava/lang/String)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1member_1index
- (JNIEnv *, jclass, jlong, jstring);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1index(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_member_type
* Signature: (JI)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Tget_1member_1type
- (JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tget_1member_1type(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_member_offset
* Signature: (JI)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1member_1offset
- (JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1offset(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_member_class
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1member_1class
- (JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1class(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tinsert
* Signature: (JLjava/lang/String;JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tinsert
- (JNIEnv *, jclass, jlong, jstring, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tinsert(JNIEnv *, jclass, jlong, jstring, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tpack
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tpack
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tpack(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Treclaim
* Signature: (JJJ[B)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Treclaim
- (JNIEnv*, jclass, jlong, jlong, jlong, jbyteArray);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Treclaim(JNIEnv *, jclass, jlong, jlong, jlong, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Tclose
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Tclose
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Tclose(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Tvlen_create
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Tvlen_1create
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tvlen_1create(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tset_tag
* Signature: (JLjava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tset_1tag
- (JNIEnv *, jclass, jlong, jstring);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1tag(JNIEnv *, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_tag
* Signature: (J)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1tag
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Tget_1tag(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_super
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Tget_1super
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tget_1super(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Tenum_create
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Tenum_1create
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tenum_1create(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tenum_insert_int
* Signature: (JLjava/lang/String;[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tenum_1insert_1int
- (JNIEnv *, jclass, jlong, jstring, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1insert_1int(JNIEnv *, jclass, jlong, jstring, jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tenum_insert
* Signature: (JLjava/lang/String;[B)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Tenum_1insert
- (JNIEnv *, jclass, jlong, jstring, jbyteArray);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1insert(JNIEnv *, jclass, jlong, jstring, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tenum_nameof_int
* Signature: (J[I[Ljava/lang/String;I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int
- (JNIEnv *, jclass, jlong, jintArray, jobjectArray, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int(JNIEnv *, jclass, jlong, jintArray,
+ jobjectArray, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tenum_nameof
* Signature: (J[BJ)Ljava/lang/String;
*/
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Tenum_1nameof
- (JNIEnv *, jclass, jlong, jbyteArray, jlong);
+JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1nameof(JNIEnv *, jclass, jlong, jbyteArray, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tenum_valueof_int
* Signature: (JLjava/lang/String;[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tenum_1valueof_1int
- (JNIEnv *, jclass, jlong, jstring, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1valueof_1int(JNIEnv *, jclass, jlong, jstring, jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tenum_valueof
* Signature: (JLjava/lang/String;[B)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Tenum_1valueof
- (JNIEnv *, jclass, jlong, jstring, jbyteArray);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1valueof(JNIEnv *, jclass, jlong, jstring, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_member_value_int
* Signature: (JI[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1member_1value_1int
- (JNIEnv *, jclass, jlong, jint, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1value_1int(JNIEnv *, jclass, jlong, jint,
+ jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_member_value
* Signature: (JI[B)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1member_1value
- (JNIEnv *, jclass, jlong, jint, jbyteArray);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1value(JNIEnv *, jclass, jlong, jint, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_array_ndims
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1array_1ndims
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1array_1ndims(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_array_dims
* Signature: (J[I[I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1array_1dims
- (JNIEnv *, jclass, jlong, jintArray, jintArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1array_1dims(JNIEnv *, jclass, jlong, jintArray, jintArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tis_variable_str
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Tis_1variable_1str
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Tis_1variable_1str(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_native_type
* Signature: (JI)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Tget_1native_1type
- (JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tget_1native_1type(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tdetect_class
* Signature: (JI)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Tdetect_1class
- (JNIEnv *, jclass, jlong, jint);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Tdetect_1class(JNIEnv *, jclass, jlong, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tcommit
* Signature: (JLjava/lang/String;JJJJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Tcommit
- (JNIEnv *, jclass, jlong, jstring, jlong, jlong, jlong, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tcommit(JNIEnv *, jclass, jlong, jstring, jlong, jlong, jlong,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Tarray_create2
* Signature: (JI[J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Tarray_1create2
- (JNIEnv *, jclass, jlong, jint, jlongArray);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tarray_1create2(JNIEnv *, jclass, jlong, jint, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tget_array_dims2
* Signature: (J[J)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2
- (JNIEnv *, jclass, jlong, jlongArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2(JNIEnv *, jclass, jlong, jlongArray);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tconvert
* Signature: (JJJ[B[BJ)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Tconvert
- (JNIEnv *, jclass, jlong, jlong, jlong, jbyteArray, jbyteArray, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tconvert(JNIEnv *, jclass, jlong, jlong, jlong, jbyteArray,
+ jbyteArray, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Tflush
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Tflush
- (JNIEnv*, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tflush(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Trefresh
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Trefresh
- (JNIEnv*, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Trefresh(JNIEnv *, jclass, jlong);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c
index 8c3686d..4d067da 100644
--- a/java/src/jni/h5util.c
+++ b/java/src/jni/h5util.c
@@ -31,8 +31,8 @@ extern "C" {
#define SKIP_UNUSED_DUMP_ROUTINES
/* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */
-hsize_t H5TOOLS_BUFSIZE = (32 * 1024 * 1024); /* 32 MB */
-int H5TOOLS_TEXT_BLOCK = 16; /* Number of elements on a line in a text export file */
+hsize_t H5TOOLS_BUFSIZE = (32 * 1024 * 1024); /* 32 MB */
+int H5TOOLS_TEXT_BLOCK = 16; /* Number of elements on a line in a text export file */
/*
* Pointer to the JNI's Virtual Machine; used for callback functions.
@@ -47,44 +47,46 @@ jobject get_callback;
jobject set_callback;
jobject delete_callback;
-H5E_auto2_t efunc;
-void *edata;
+H5E_auto2_t efunc;
+void * edata;
/********************/
/* Local Prototypes */
/********************/
#ifndef SKIP_UNUSED_DUMP_ROUTINES
-static int h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
-static int h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
+static int h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
+static int h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
#endif
-static int h5str_is_zero(const void *_mem, size_t size);
-static hid_t h5str_get_native_type(hid_t type);
-static hid_t h5str_get_little_endian_type(hid_t type);
-static hid_t h5str_get_big_endian_type(hid_t type);
-static htri_t h5str_detect_vlen(hid_t tid);
-static htri_t h5str_detect_vlen_str(hid_t tid);
-static int h5tools_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts);
-static int h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts);
-static int render_bin_output_region_data_blocks(FILE *stream, hid_t region_id,
- hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata);
-static int render_bin_output_region_blocks(FILE *stream, hid_t region_space,
- hid_t region_id, hid_t container);
-static int render_bin_output_region_data_points(FILE *stream, hid_t region_space, hid_t region_id,
- hid_t container, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata);
-static int render_bin_output_region_points(FILE *stream, hid_t region_space,
- hid_t region_id, hid_t container);
+static int h5str_is_zero(const void *_mem, size_t size);
+static hid_t h5str_get_native_type(hid_t type);
+static hid_t h5str_get_little_endian_type(hid_t type);
+static hid_t h5str_get_big_endian_type(hid_t type);
+static htri_t h5str_detect_vlen(hid_t tid);
+static htri_t h5str_detect_vlen_str(hid_t tid);
+static int h5tools_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem,
+ hsize_t nelmts);
+static int h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem,
+ hsize_t block_nelmts);
+static int render_bin_output_region_data_blocks(FILE *stream, hid_t region_id, hid_t container, int ndims,
+ hid_t type_id, hssize_t nblocks, hsize_t *ptdata);
+static int render_bin_output_region_blocks(FILE *stream, hid_t region_space, hid_t region_id,
+ hid_t container);
+static int render_bin_output_region_data_points(FILE *stream, hid_t region_space, hid_t region_id,
+ hid_t container, int ndims, hid_t type_id, hssize_t npoints,
+ hsize_t *ptdata);
+static int render_bin_output_region_points(FILE *stream, hid_t region_space, hid_t region_id,
+ hid_t container);
/* Strings for output */
-#define H5_TOOLS_GROUP "GROUP"
-#define H5_TOOLS_DATASET "DATASET"
-#define H5_TOOLS_DATATYPE "DATATYPE"
-#define H5_TOOLS_ATTRIBUTE "ATTRIBUTE"
+#define H5_TOOLS_GROUP "GROUP"
+#define H5_TOOLS_DATASET "DATASET"
+#define H5_TOOLS_DATATYPE "DATATYPE"
+#define H5_TOOLS_ATTRIBUTE "ATTRIBUTE"
/** frees memory held by array of strings */
void
-h5str_array_free
- (char **strs, size_t len)
+h5str_array_free(char **strs, size_t len)
{
size_t i;
@@ -101,20 +103,18 @@ h5str_array_free
/** allocate a new str with given length */
void
-h5str_new
- (h5str_t *str, size_t len)
+h5str_new(h5str_t *str, size_t len)
{
if (str && len > 0) {
- str->s = (char *)HDmalloc(len);
- str->max = len;
+ str->s = (char *)HDmalloc(len);
+ str->max = len;
str->s[0] = '\0';
} /* end if */
} /* end h5str_new */
/** free string memory */
void
-h5str_free
- (h5str_t *str)
+h5str_free(h5str_t *str)
{
if (str && str->max > 0) {
HDfree(str->s);
@@ -127,15 +127,14 @@ h5str_free
* TODO: no error return. malloc can fail.
*/
void
-h5str_resize
- (h5str_t *str, size_t new_len)
+h5str_resize(h5str_t *str, size_t new_len)
{
char *new_str;
if (!str || new_len <= 0 || str->max == new_len)
return;
- if (NULL == (new_str = (char *) HDmalloc(new_len)))
+ if (NULL == (new_str = (char *)HDmalloc(new_len)))
return;
if (new_len > str->max) /* increase memory */
@@ -144,7 +143,7 @@ h5str_resize
HDstrncpy(new_str, str->s, new_len - 1);
HDfree(str->s);
- str->s = new_str;
+ str->s = new_str;
str->max = new_len;
} /* end h5str_resize */
@@ -152,9 +151,8 @@ h5str_resize
Return Value:
the char string point to str->s
*/
-char*
-h5str_append
- (h5str_t *str, const char* cstr)
+char *
+h5str_append(h5str_t *str, const char *cstr)
{
size_t len;
@@ -180,22 +178,20 @@ h5str_append
* FAILURE: 0
*/
size_t
-h5str_convert
- (JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_buf, size_t out_buf_offset)
+h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_buf, size_t out_buf_offset)
{
unsigned char *ucptr = NULL;
static char fmt_llong[8], fmt_ullong[8];
- H5T_class_t tclass = H5T_NO_CLASS;
- const char delimiter[] = " ," H5_COMPOUND_BEGIN_INDICATOR H5_COMPOUND_END_INDICATOR \
- H5_ARRAY_BEGIN_INDICATOR H5_ARRAY_END_INDICATOR \
- H5_VLEN_BEGIN_INDICATOR H5_VLEN_END_INDICATOR;
- size_t typeSize = 0;
- hid_t mtid = H5I_INVALID_HID;
- char *this_str = NULL;
- char *token;
- char *cptr = NULL;
- int n;
- size_t retVal = 0;
+ H5T_class_t tclass = H5T_NO_CLASS;
+ const char delimiter[] = " ," H5_COMPOUND_BEGIN_INDICATOR H5_COMPOUND_END_INDICATOR
+ H5_ARRAY_BEGIN_INDICATOR H5_ARRAY_END_INDICATOR H5_VLEN_BEGIN_INDICATOR H5_VLEN_END_INDICATOR;
+ size_t typeSize = 0;
+ hid_t mtid = H5I_INVALID_HID;
+ char * this_str = NULL;
+ char * token;
+ char * cptr = NULL;
+ int n;
+ size_t retVal = 0;
if (!in_str)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "h5str_convert: in_str is NULL");
@@ -203,8 +199,8 @@ h5str_convert
H5_NULL_ARGUMENT_ERROR(ENVONLY, "h5str_convert: out_buf is NULL");
this_str = *in_str;
- cptr = &(((char *) out_buf)[out_buf_offset]);
- ucptr = &(((unsigned char *) out_buf)[out_buf_offset]);
+ cptr = &(((char *)out_buf)[out_buf_offset]);
+ ucptr = &(((unsigned char *)out_buf)[out_buf_offset]);
if (H5T_NO_CLASS == (tclass = H5Tget_class(tid)))
H5_LIBRARY_ERROR(ENVONLY);
@@ -220,13 +216,11 @@ h5str_convert
} /* end if */
switch (tclass) {
- case H5T_FLOAT:
- {
+ case H5T_FLOAT: {
token = HDstrtok(this_str, delimiter);
switch (typeSize) {
- case sizeof(float):
- {
+ case sizeof(float): {
float tmp_float = 0.0f;
sscanf(token, "%f", &tmp_float);
@@ -234,8 +228,7 @@ h5str_convert
break;
}
- case sizeof(double):
- {
+ case sizeof(double): {
double tmp_double = 0.0;
sscanf(token, "%lf", &tmp_double);
@@ -243,8 +236,7 @@ h5str_convert
break;
}
#if H5_SIZEOF_LONG_DOUBLE != 0 && H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
- case sizeof(long double):
- {
+ case sizeof(long double): {
long double tmp_ldouble = 0.0;
sscanf(token, "%Lf", &tmp_ldouble);
@@ -254,7 +246,9 @@ h5str_convert
#endif
default:
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_convert: floating-point datatype size didn't match any of expected sizes");
+ H5_BAD_ARGUMENT_ERROR(
+ ENVONLY,
+ "h5str_convert: floating-point datatype size didn't match any of expected sizes");
break;
}
@@ -263,8 +257,7 @@ h5str_convert
break;
}
- case H5T_STRING:
- {
+ case H5T_STRING: {
size_t len = HDstrlen(this_str);
if (len > 0) {
@@ -280,8 +273,7 @@ h5str_convert
break;
}
- case H5T_INTEGER:
- {
+ case H5T_INTEGER: {
H5T_sign_t nsign = H5T_SGN_ERROR;
if (H5T_SGN_ERROR == (nsign = H5Tget_sign(tid)))
@@ -290,10 +282,9 @@ h5str_convert
token = HDstrtok(this_str, delimiter);
switch (typeSize) {
- case sizeof(char):
- {
+ case sizeof(char): {
unsigned char tmp_uchar = 0;
- signed char tmp_char = 0;
+ signed char tmp_char = 0;
if (H5T_SGN_NONE == nsign) {
sscanf(token, "%hhu", &tmp_uchar);
@@ -307,10 +298,9 @@ h5str_convert
break;
}
- case sizeof(short):
- {
+ case sizeof(short): {
unsigned short tmp_ushort = 0;
- short tmp_short = 0;
+ short tmp_short = 0;
if (H5T_SGN_NONE == nsign) {
sscanf(token, "%hu", &tmp_ushort);
@@ -324,10 +314,9 @@ h5str_convert
break;
}
- case sizeof(int):
- {
+ case sizeof(int): {
unsigned int tmp_uint = 0;
- int tmp_int = 0;
+ int tmp_int = 0;
if (H5T_SGN_NONE == nsign) {
sscanf(token, "%u", &tmp_uint);
@@ -342,10 +331,9 @@ h5str_convert
}
#if H5_SIZEOF_LONG != H5_SIZEOF_INT
- case sizeof(long):
- {
+ case sizeof(long): {
unsigned long tmp_ulong = 0;
- long tmp_long = 0;
+ long tmp_long = 0;
if (H5T_SGN_NONE == nsign) {
sscanf(token, "%lu", &tmp_ulong);
@@ -360,10 +348,9 @@ h5str_convert
}
#endif
#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
- case sizeof(long long):
- {
+ case sizeof(long long): {
unsigned long long tmp_ullong = 0;
- long long tmp_llong = 0;
+ long long tmp_llong = 0;
if (H5T_SGN_NONE == nsign) {
sscanf(token, fmt_ullong, &tmp_ullong);
@@ -379,7 +366,8 @@ h5str_convert
#endif
default:
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_convert: integer datatype size didn't match any of expected sizes");
+ H5_BAD_ARGUMENT_ERROR(
+ ENVONLY, "h5str_convert: integer datatype size didn't match any of expected sizes");
break;
}
@@ -388,8 +376,7 @@ h5str_convert
break;
}
- case H5T_COMPOUND:
- {
+ case H5T_COMPOUND: {
unsigned i;
size_t member_offset;
@@ -397,11 +384,14 @@ h5str_convert
H5_LIBRARY_ERROR(ENVONLY);
/* Skip whitespace and compound indicators */
- while (*this_str == ' ') this_str++;
- if (*this_str == '{') this_str++;
- while (*this_str == ' ') this_str++;
-
- for (i = 0; i < (unsigned) n; i++) {
+ while (*this_str == ' ')
+ this_str++;
+ if (*this_str == '{')
+ this_str++;
+ while (*this_str == ' ')
+ this_str++;
+
+ for (i = 0; i < (unsigned)n; i++) {
member_offset = H5Tget_member_offset(tid, i);
if ((mtid = H5Tget_member_type(tid, i)) < 0)
@@ -413,9 +403,12 @@ h5str_convert
}
/* Skip whitespace and commas */
- while (*this_str == ' ') this_str++;
- if (*this_str == ',') this_str++;
- while (*this_str == ' ') this_str++;
+ while (*this_str == ' ')
+ this_str++;
+ if (*this_str == ',')
+ this_str++;
+ while (*this_str == ' ')
+ this_str++;
if (H5Tclose(mtid) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -423,11 +416,14 @@ h5str_convert
}
/* Skip whitespace and compound indicators */
- while (*this_str == ' ') this_str++;
- if (*this_str == '}') this_str++;
- while (*this_str == ' ') this_str++;
+ while (*this_str == ' ')
+ this_str++;
+ if (*this_str == '}')
+ this_str++;
+ while (*this_str == ' ')
+ this_str++;
- retVal = typeSize * (size_t) n;
+ retVal = typeSize * (size_t)n;
break;
}
@@ -437,47 +433,41 @@ h5str_convert
cptr = NULL;
break;
- case H5T_ENUM:
- {
+ case H5T_ENUM: {
void *value;
token = HDstrtok(this_str, delimiter);
switch (typeSize) {
- case sizeof(char):
- {
+ case sizeof(char): {
unsigned char tmp_uchar = 0;
- value = &tmp_uchar;
+ value = &tmp_uchar;
break;
}
- case sizeof(short):
- {
+ case sizeof(short): {
unsigned short tmp_ushort = 0;
- value = &tmp_ushort;
+ value = &tmp_ushort;
break;
}
#if H5_SIZEOF_LONG != H5_SIZEOF_INT
- case sizeof(long):
- {
+ case sizeof(long): {
unsigned long tmp_ulong = 0;
- value = &tmp_ulong;
+ value = &tmp_ulong;
break;
}
#endif
#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
- case sizeof(long long):
- {
+ case sizeof(long long): {
unsigned long long tmp_ullong = 0;
- value = &tmp_ullong;
+ value = &tmp_ullong;
break;
}
#endif
- default:
- {
+ default: {
unsigned int tmp_uint = 0;
- value = &tmp_uint;
+ value = &tmp_uint;
break;
}
}
@@ -492,16 +482,18 @@ h5str_convert
break;
}
- case H5T_ARRAY:
- {
+ case H5T_ARRAY: {
hsize_t i, dims[H5S_MAX_RANK], total_elmts;
size_t baseTypeSize;
int rank = 0;
/* Skip whitespace and array indicators */
- while (*this_str == ' ') this_str++;
- if (*this_str == '[') this_str++;
- while (*this_str == ' ') this_str++;
+ while (*this_str == ' ')
+ this_str++;
+ if (*this_str == '[')
+ this_str++;
+ while (*this_str == ' ')
+ this_str++;
if ((mtid = H5Tget_super(tid)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -515,10 +507,10 @@ h5str_convert
if (H5Tget_array_dims2(tid, dims) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- for (i = 0, total_elmts = 1; i < (hsize_t) rank; i++)
+ for (i = 0, total_elmts = 1; i < (hsize_t)rank; i++)
total_elmts *= dims[i];
- if (NULL == (cptr = (char *) HDcalloc((size_t)total_elmts, baseTypeSize)))
+ if (NULL == (cptr = (char *)HDcalloc((size_t)total_elmts, baseTypeSize)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_convert: failed to allocate array buffer");
for (i = 0; i < total_elmts; i++) {
@@ -528,9 +520,12 @@ h5str_convert
}
/* Skip whitespace and commas */
- while (*this_str == ' ') this_str++;
- if (*this_str == ',') this_str++;
- while (*this_str == ' ') this_str++;
+ while (*this_str == ' ')
+ this_str++;
+ if (*this_str == ',')
+ this_str++;
+ while (*this_str == ' ')
+ this_str++;
}
if (H5Tclose(mtid) < 0)
@@ -538,20 +533,22 @@ h5str_convert
mtid = H5I_INVALID_HID;
/* Skip whitespace and array indicators */
- while (*this_str == ' ') this_str++;
- if (*this_str == ']') this_str++;
- while (*this_str == ' ') this_str++;
+ while (*this_str == ' ')
+ this_str++;
+ if (*this_str == ']')
+ this_str++;
+ while (*this_str == ' ')
+ this_str++;
retVal = typeSize * total_elmts;
break;
}
- case H5T_VLEN:
- {
- size_t i, baseTypeSize;
- hvl_t *vl_buf = (hvl_t *) out_buf;
- char cur_char;
+ case H5T_VLEN: {
+ size_t i, baseTypeSize;
+ hvl_t *vl_buf = (hvl_t *)out_buf;
+ char cur_char;
if ((mtid = H5Tget_super(tid)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -564,16 +561,19 @@ h5str_convert
vl_buf->len = 1;
/* Skip whitespace and vlen indicators */
- while (*this_str == ' ') this_str++;
- if (*this_str == '(') this_str++;
- while (*this_str == ' ') this_str++;
+ while (*this_str == ' ')
+ this_str++;
+ if (*this_str == '(')
+ this_str++;
+ while (*this_str == ' ')
+ this_str++;
cur_char = *this_str;
for (i = 0; cur_char != ')' && cur_char != '\0'; i++) {
if (i >= vl_buf->len) {
char *tmp_realloc;
- if (NULL == (tmp_realloc = (char *) HDrealloc(vl_buf->p, vl_buf->len * 2 * baseTypeSize)))
+ if (NULL == (tmp_realloc = (char *)HDrealloc(vl_buf->p, vl_buf->len * 2 * baseTypeSize)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_convert: failed to reallocate vlen buffer");
vl_buf->len *= 2;
vl_buf->p = tmp_realloc;
@@ -586,9 +586,12 @@ h5str_convert
}
/* Skip whitespace and commas */
- while (*this_str == ' ') this_str++;
- if (*this_str == ',') this_str++;
- while (*this_str == ' ') this_str++;
+ while (*this_str == ' ')
+ this_str++;
+ if (*this_str == ',')
+ this_str++;
+ while (*this_str == ' ')
+ this_str++;
}
vl_buf->len = i;
@@ -598,9 +601,12 @@ h5str_convert
mtid = H5I_INVALID_HID;
/* Skip whitespace and vlen indicators */
- while (*this_str == ' ') this_str++;
- if (*this_str == ')') this_str++;
- while (*this_str == ' ') this_str++;
+ while (*this_str == ' ')
+ this_str++;
+ if (*this_str == ')')
+ this_str++;
+ while (*this_str == ' ')
+ this_str++;
retVal = typeSize;
@@ -608,8 +614,7 @@ h5str_convert
}
case H5T_NCLASSES:
- case H5T_NO_CLASS:
- {
+ case H5T_NO_CLASS: {
H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_convert: invalid datatype class");
break;
}
@@ -617,8 +622,7 @@ h5str_convert
case H5T_TIME:
case H5T_BITFIELD:
case H5T_OPAQUE:
- default:
- {
+ default: {
/* All other types get copied raw */
HDmemcpy(ucptr, this_str, typeSize);
@@ -646,9 +650,9 @@ done:
void
h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_p)
{
- ssize_t buf_size;
- char *ref_name = NULL;
- const H5R_ref_t *ref_vp = (H5R_ref_t *)ref_p;
+ ssize_t buf_size;
+ char * ref_name = NULL;
+ const H5R_ref_t *ref_vp = (H5R_ref_t *)ref_p;
UNUSED(container);
@@ -706,18 +710,18 @@ done:
* FAILURE: 0
*/
size_t
-h5str_sprintf
- (JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, size_t in_buf_len, int expand_data)
+h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, size_t in_buf_len,
+ int expand_data)
{
- unsigned char *ucptr = (unsigned char *) in_buf;
+ unsigned char *ucptr = (unsigned char *)in_buf;
static char fmt_llong[8], fmt_ullong[8];
- H5T_class_t tclass = H5T_NO_CLASS;
+ H5T_class_t tclass = H5T_NO_CLASS;
size_t typeSize = 0;
- H5T_sign_t nsign = H5T_SGN_ERROR;
- hid_t mtid = H5I_INVALID_HID;
- hid_t obj = H5I_INVALID_HID;
- char *cptr = (char *) in_buf;
- char *this_str = NULL;
+ H5T_sign_t nsign = H5T_SGN_ERROR;
+ hid_t mtid = H5I_INVALID_HID;
+ hid_t obj = H5I_INVALID_HID;
+ char * cptr = (char *)in_buf;
+ char * this_str = NULL;
int n;
size_t retVal = 0;
@@ -742,16 +746,14 @@ h5str_sprintf
} /* end if */
switch (tclass) {
- case H5T_FLOAT:
- {
+ case H5T_FLOAT: {
switch (typeSize) {
- case sizeof(float):
- {
+ case sizeof(float): {
float tmp_float = 0.0f;
HDmemcpy(&tmp_float, cptr, sizeof(float));
- if (NULL == (this_str = (char *) HDmalloc(25)))
+ if (NULL == (this_str = (char *)HDmalloc(25)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
if (HDsprintf(this_str, "%g", tmp_float) < 0)
@@ -760,13 +762,12 @@ h5str_sprintf
break;
}
- case sizeof(double):
- {
+ case sizeof(double): {
double tmp_double = 0.0;
HDmemcpy(&tmp_double, cptr, sizeof(double));
- if (NULL == (this_str = (char *) HDmalloc(25)))
+ if (NULL == (this_str = (char *)HDmalloc(25)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
if (HDsprintf(this_str, "%g", tmp_double) < 0)
@@ -775,13 +776,12 @@ h5str_sprintf
break;
}
#if H5_SIZEOF_LONG_DOUBLE != 0 && H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
- case sizeof(long double):
- {
+ case sizeof(long double): {
long double tmp_ldouble = 0.0;
HDmemcpy(&tmp_ldouble, cptr, sizeof(long double));
- if (NULL == (this_str = (char *) HDmalloc(27)))
+ if (NULL == (this_str = (char *)HDmalloc(27)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
if (HDsprintf(this_str, "%Lg", tmp_ldouble) < 0)
@@ -792,17 +792,18 @@ h5str_sprintf
#endif
default:
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_sprintf: floating-point datatype size didn't match any of expected sizes");
+ H5_BAD_ARGUMENT_ERROR(
+ ENVONLY,
+ "h5str_sprintf: floating-point datatype size didn't match any of expected sizes");
break;
}
break;
}
- case H5T_STRING:
- {
- htri_t is_variable;
- char *tmp_str;
+ case H5T_STRING: {
+ htri_t is_variable;
+ char * tmp_str;
if ((is_variable = H5Tis_variable_str(tid)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -820,13 +821,13 @@ h5str_sprintf
/* Check for NULL pointer for string */
if (!tmp_str) {
- if (NULL == (this_str = (char *) HDmalloc(5)))
+ if (NULL == (this_str = (char *)HDmalloc(5)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
HDstrncpy(this_str, "NULL", 5);
}
else {
if (typeSize > 0) {
- if (NULL == (this_str = (char *) HDmalloc(typeSize + 1)))
+ if (NULL == (this_str = (char *)HDmalloc(typeSize + 1)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
HDstrncpy(this_str, tmp_str, typeSize);
@@ -837,23 +838,22 @@ h5str_sprintf
break;
}
- case H5T_INTEGER:
- {
+ case H5T_INTEGER: {
if (H5T_SGN_ERROR == (nsign = H5Tget_sign(tid)))
H5_LIBRARY_ERROR(ENVONLY);
switch (typeSize) {
- case sizeof(char):
- {
+ case sizeof(char): {
unsigned char tmp_uchar = 0;
- char tmp_char = 0;
+ char tmp_char = 0;
if (H5T_SGN_NONE == nsign) {
HDmemcpy(&tmp_uchar, cptr, sizeof(unsigned char));
- if (NULL == (this_str = (char *) HDmalloc(7)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+ if (NULL == (this_str = (char *)HDmalloc(7)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_sprintf: failed to allocate string buffer");
if (HDsprintf(this_str, "%hhu", tmp_uchar) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
@@ -861,8 +861,9 @@ h5str_sprintf
else {
HDmemcpy(&tmp_char, cptr, sizeof(char));
- if (NULL == (this_str = (char *) HDmalloc(7)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+ if (NULL == (this_str = (char *)HDmalloc(7)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_sprintf: failed to allocate string buffer");
if (HDsprintf(this_str, "%hhd", tmp_char) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
@@ -871,16 +872,16 @@ h5str_sprintf
break;
}
- case sizeof(short):
- {
+ case sizeof(short): {
unsigned short tmp_ushort = 0;
- short tmp_short = 0;
+ short tmp_short = 0;
if (H5T_SGN_NONE == nsign) {
HDmemcpy(&tmp_ushort, cptr, sizeof(unsigned short));
- if (NULL == (this_str = (char *) HDmalloc(9)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+ if (NULL == (this_str = (char *)HDmalloc(9)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_sprintf: failed to allocate string buffer");
if (HDsprintf(this_str, "%hu", tmp_ushort) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
@@ -888,8 +889,9 @@ h5str_sprintf
else {
HDmemcpy(&tmp_short, cptr, sizeof(short));
- if (NULL == (this_str = (char *) HDmalloc(9)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+ if (NULL == (this_str = (char *)HDmalloc(9)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_sprintf: failed to allocate string buffer");
if (HDsprintf(this_str, "%hd", tmp_short) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
@@ -898,16 +900,16 @@ h5str_sprintf
break;
}
- case sizeof(int):
- {
+ case sizeof(int): {
unsigned int tmp_uint = 0;
- int tmp_int = 0;
+ int tmp_int = 0;
if (H5T_SGN_NONE == nsign) {
HDmemcpy(&tmp_uint, cptr, sizeof(unsigned int));
- if (NULL == (this_str = (char *) HDmalloc(14)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+ if (NULL == (this_str = (char *)HDmalloc(14)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_sprintf: failed to allocate string buffer");
if (HDsprintf(this_str, "%u", tmp_uint) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
@@ -915,8 +917,9 @@ h5str_sprintf
else {
HDmemcpy(&tmp_int, cptr, sizeof(int));
- if (NULL == (this_str = (char *) HDmalloc(14)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+ if (NULL == (this_str = (char *)HDmalloc(14)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_sprintf: failed to allocate string buffer");
if (HDsprintf(this_str, "%d", tmp_int) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
@@ -925,16 +928,16 @@ h5str_sprintf
break;
}
#if H5_SIZEOF_LONG != H5_SIZEOF_INT
- case sizeof(long):
- {
+ case sizeof(long): {
unsigned long tmp_ulong = 0;
- long tmp_long = 0;
+ long tmp_long = 0;
if (H5T_SGN_NONE == nsign) {
HDmemcpy(&tmp_ulong, cptr, sizeof(unsigned long));
- if (NULL == (this_str = (char *) HDmalloc(23)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+ if (NULL == (this_str = (char *)HDmalloc(23)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_sprintf: failed to allocate string buffer");
if (HDsprintf(this_str, "%lu", tmp_ulong) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
@@ -942,8 +945,9 @@ h5str_sprintf
else {
HDmemcpy(&tmp_long, cptr, sizeof(long));
- if (NULL == (this_str = (char *) HDmalloc(23)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+ if (NULL == (this_str = (char *)HDmalloc(23)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_sprintf: failed to allocate string buffer");
if (HDsprintf(this_str, "%ld", tmp_long) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
@@ -953,16 +957,16 @@ h5str_sprintf
}
#endif
#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
- case sizeof(long long):
- {
+ case sizeof(long long): {
unsigned long long tmp_ullong = 0;
- long long tmp_llong = 0;
+ long long tmp_llong = 0;
if (H5T_SGN_NONE == nsign) {
HDmemcpy(&tmp_ullong, cptr, sizeof(unsigned long long));
- if (NULL == (this_str = (char *) HDmalloc(25)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+ if (NULL == (this_str = (char *)HDmalloc(25)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_sprintf: failed to allocate string buffer");
if (HDsprintf(this_str, fmt_ullong, tmp_ullong) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
@@ -970,8 +974,9 @@ h5str_sprintf
else {
HDmemcpy(&tmp_llong, cptr, sizeof(long long));
- if (NULL == (this_str = (char *) HDmalloc(25)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+ if (NULL == (this_str = (char *)HDmalloc(25)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_sprintf: failed to allocate string buffer");
if (HDsprintf(this_str, fmt_llong, tmp_llong) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
@@ -982,15 +987,15 @@ h5str_sprintf
#endif
default:
- H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_sprintf: integer datatype size didn't match any of expected sizes");
+ H5_BAD_ARGUMENT_ERROR(
+ ENVONLY, "h5str_sprintf: integer datatype size didn't match any of expected sizes");
break;
}
break;
}
- case H5T_COMPOUND:
- {
+ case H5T_COMPOUND: {
unsigned i;
size_t offset;
@@ -1000,7 +1005,7 @@ h5str_sprintf
if (!h5str_append(out_str, H5_COMPOUND_BEGIN_INDICATOR))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- for (i = 0; i < (unsigned) n; i++) {
+ for (i = 0; i < (unsigned)n; i++) {
offset = H5Tget_member_offset(tid, i);
if ((mtid = H5Tget_member_type(tid, i)) < 0)
@@ -1009,7 +1014,7 @@ h5str_sprintf
if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &cptr[offset], in_buf_len, expand_data))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if ((i + 1) < (unsigned) n)
+ if ((i + 1) < (unsigned)n)
if (!h5str_append(out_str, ", "))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
@@ -1024,8 +1029,7 @@ h5str_sprintf
break;
}
- case H5T_ENUM:
- {
+ case H5T_ENUM: {
char enum_name[1024];
if (H5Tenum_nameof(tid, cptr, enum_name, sizeof enum_name) >= 0) {
@@ -1035,7 +1039,7 @@ h5str_sprintf
else {
size_t i;
- if (NULL == (this_str = (char *) HDmalloc(4 * (typeSize + 1))))
+ if (NULL == (this_str = (char *)HDmalloc(4 * (typeSize + 1))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
if (1 == typeSize) {
@@ -1052,8 +1056,7 @@ h5str_sprintf
break;
}
- case H5T_REFERENCE:
- {
+ case H5T_REFERENCE: {
if (h5str_is_zero(cptr, typeSize)) {
if (!h5str_append(out_str, "NULL"))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
@@ -1061,29 +1064,29 @@ h5str_sprintf
}
if (H5Tequal(tid, H5T_STD_REF)) {
- H5O_type_t obj_type = -1; /* Object type */
- H5R_type_t ref_type; /* Reference type */
+ H5O_type_t obj_type = -1; /* Object type */
+ H5R_type_t ref_type; /* Reference type */
const H5R_ref_t *ref_vp = (H5R_ref_t *)cptr;
ref_type = H5Rget_type(ref_vp);
H5Rget_obj_type3(ref_vp, H5P_DEFAULT, &obj_type);
switch (ref_type) {
- case H5R_OBJECT1:
- {
+ case H5R_OBJECT1: {
/* Object references -- show the type and OID of the referenced object. */
H5O_info2_t oi;
- if((obj = H5Ropen_object(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((obj = H5Ropen_object(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
H5Oget_info3(obj, &oi, H5O_INFO_BASIC);
- if(H5Oclose(obj) < 0)
+ if (H5Oclose(obj) < 0)
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
else
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if (NULL == (this_str = (char *) HDmalloc(14)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%u-", (unsigned) oi.type) < 0)
+ if (NULL == (this_str = (char *)HDmalloc(14)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_sprintf: failed to allocate string buffer");
+ if (HDsprintf(this_str, "%u-", (unsigned)oi.type) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
if (!h5str_append(out_str, this_str))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
@@ -1121,21 +1124,22 @@ h5str_sprintf
H5Otoken_to_str(tid, &oi.token, &token_str);
- if (NULL == (this_str = (char *) HDmalloc(64 + strlen(token_str) + 1)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+ if (NULL == (this_str = (char *)HDmalloc(64 + strlen(token_str) + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_sprintf: failed to allocate string buffer");
if (HDsprintf(this_str, "%lu:%s", oi.fileno, token_str) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
H5free_memory(token_str);
}
- }
+ }
- break;
+ break;
case H5R_DATASET_REGION1:
if (!h5str_append(out_str, H5_TOOLS_DATASET))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- h5str_sprint_reference(ENVONLY, out_str, container, (void*)cptr);
+ h5str_sprint_reference(ENVONLY, out_str, container, (void *)cptr);
break;
case H5R_OBJECT2:
switch (obj_type) {
@@ -1160,17 +1164,17 @@ h5str_sprintf
default:
break;
} /* end switch */
- h5str_sprint_reference(ENVONLY, out_str, container, (void*)cptr);
+ h5str_sprint_reference(ENVONLY, out_str, container, (void *)cptr);
break;
case H5R_DATASET_REGION2:
if (!h5str_append(out_str, H5_TOOLS_DATASET))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- h5str_sprint_reference(ENVONLY, out_str, container, (void*)cptr);
+ h5str_sprint_reference(ENVONLY, out_str, container, (void *)cptr);
break;
case H5R_ATTR:
if (!h5str_append(out_str, H5_TOOLS_ATTRIBUTE))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- h5str_sprint_reference(ENVONLY, out_str, container, (void*)cptr);
+ h5str_sprint_reference(ENVONLY, out_str, container, (void *)cptr);
break;
case H5R_BADTYPE:
case H5R_MAXTYPE:
@@ -1190,8 +1194,7 @@ h5str_sprintf
break;
}
- case H5T_ARRAY:
- {
+ case H5T_ARRAY: {
hsize_t dims[H5S_MAX_RANK], i, total_elmts;
size_t baseSize;
int rank = 0;
@@ -1211,11 +1214,12 @@ h5str_sprintf
if (H5Tget_array_dims2(tid, dims) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- for (i = 0, total_elmts = 1; i < (hsize_t) rank; i++)
+ for (i = 0, total_elmts = 1; i < (hsize_t)rank; i++)
total_elmts *= dims[i];
for (i = 0; i < total_elmts; i++) {
- if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(cptr[i * baseSize]), in_buf_len, expand_data))
+ if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(cptr[i * baseSize]), in_buf_len,
+ expand_data))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
if ((i + 1) < total_elmts)
@@ -1233,11 +1237,10 @@ h5str_sprintf
break;
}
- case H5T_VLEN:
- {
- unsigned int i;
- size_t baseSize;
- hvl_t *vl_buf = (hvl_t *) in_buf;
+ case H5T_VLEN: {
+ unsigned int i;
+ size_t baseSize;
+ hvl_t * vl_buf = (hvl_t *)in_buf;
if ((mtid = H5Tget_super(tid)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -1248,11 +1251,12 @@ h5str_sprintf
if (!h5str_append(out_str, H5_VLEN_BEGIN_INDICATOR))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- for (i = 0; i < (unsigned) vl_buf->len; i++) {
- if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(((char *) vl_buf->p)[i * baseSize]), vl_buf->len, expand_data))
+ for (i = 0; i < (unsigned)vl_buf->len; i++) {
+ if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(((char *)vl_buf->p)[i * baseSize]),
+ vl_buf->len, expand_data))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if ((i + 1) < (unsigned) vl_buf->len)
+ if ((i + 1) < (unsigned)vl_buf->len)
if (!h5str_append(out_str, ", "))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
@@ -1268,8 +1272,7 @@ h5str_sprintf
}
case H5T_NO_CLASS:
- case H5T_NCLASSES:
- {
+ case H5T_NCLASSES: {
H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_sprintf: invalid datatype class");
break;
}
@@ -1277,13 +1280,12 @@ h5str_sprintf
case H5T_TIME:
case H5T_BITFIELD:
case H5T_OPAQUE:
- default:
- {
+ default: {
size_t i;
/* All other types get printed as hexadecimal */
- if (NULL == (this_str = (char *) HDmalloc(4 * (typeSize + 1))))
+ if (NULL == (this_str = (char *)HDmalloc(4 * (typeSize + 1))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
if (1 == typeSize) {
@@ -1328,23 +1330,23 @@ done:
*-------------------------------------------------------------------------
*/
static int
-h5str_print_region_data_blocks
- (JNIEnv *env, hid_t region_id, h5str_t *str, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata)
+h5str_print_region_data_blocks(JNIEnv *env, hid_t region_id, h5str_t *str, int ndims, hid_t type_id,
+ hssize_t nblocks, hsize_t *ptdata)
{
- unsigned indx;
- hsize_t *dims1 = NULL;
- hsize_t *start = NULL;
- hsize_t *count = NULL;
- hsize_t blkndx;
- hsize_t total_size[H5S_MAX_RANK];
- hsize_t numelem;
- hsize_t numindex;
- size_t jndx;
- size_t type_size;
- hid_t mem_space = H5I_INVALID_HID;
- hid_t sid1 = H5I_INVALID_HID;
- void *region_buf = NULL;
- int ret_value = FAIL;
+ unsigned indx;
+ hsize_t *dims1 = NULL;
+ hsize_t *start = NULL;
+ hsize_t *count = NULL;
+ hsize_t blkndx;
+ hsize_t total_size[H5S_MAX_RANK];
+ hsize_t numelem;
+ hsize_t numindex;
+ size_t jndx;
+ size_t type_size;
+ hid_t mem_space = H5I_INVALID_HID;
+ hid_t sid1 = H5I_INVALID_HID;
+ void * region_buf = NULL;
+ int ret_value = FAIL;
if (ndims < 0)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_print_region_data_blocks: ndims < 0");
@@ -1356,13 +1358,14 @@ h5str_print_region_data_blocks
H5_LIBRARY_ERROR(ENVONLY);
/* Allocate space for the dimension array */
- if (NULL == (dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate dimension array buffer");
+ if (NULL == (dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_print_region_data_blocks: failed to allocate dimension array buffer");
/* Find the dimensions of each data space from the block coordinates */
- for (jndx = 0, numelem = 1; jndx < (size_t) ndims; jndx++) {
+ for (jndx = 0, numelem = 1; jndx < (size_t)ndims; jndx++) {
dims1[jndx] = ptdata[jndx + (size_t)ndims] - ptdata[jndx] + 1;
- numelem = dims1[jndx] * numelem;
+ numelem = dims1[jndx] * numelem;
} /* end for */
/* Create dataspace for reading buffer */
@@ -1377,14 +1380,16 @@ h5str_print_region_data_blocks
/* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
/* 1 2 n 1 2 n */
- if (NULL == (start = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate hyperslab start buffer");
+ if (NULL == (start = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_print_region_data_blocks: failed to allocate hyperslab start buffer");
- if (NULL == (count = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate hyperslab count buffer");
+ if (NULL == (count = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_print_region_data_blocks: failed to allocate hyperslab count buffer");
- for (blkndx = 0; blkndx < (hsize_t) nblocks; blkndx++) {
- for (indx = 0; indx < (unsigned) ndims; indx++) {
+ for (blkndx = 0; blkndx < (hsize_t)nblocks; blkndx++) {
+ for (indx = 0; indx < (unsigned)ndims; indx++) {
start[indx] = ptdata[indx + blkndx * (hsize_t)ndims * 2];
count[indx] = dims1[indx];
} /* end for */
@@ -1399,14 +1404,15 @@ h5str_print_region_data_blocks
H5_LIBRARY_ERROR(ENVONLY);
for (numindex = 0; numindex < numelem; numindex++) {
- if (!h5str_sprintf(ENVONLY, str, region_id, type_id, ((char *)region_buf + numindex * type_size), 0, 1))
+ if (!h5str_sprintf(ENVONLY, str, region_id, type_id, ((char *)region_buf + numindex * type_size),
+ 0, 1))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
if (numindex + 1 < numelem)
if (!h5str_append(str, ", "))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
} /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */
- } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
+ } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
ret_value = SUCCEED;
@@ -1428,23 +1434,21 @@ done:
} /* end h5str_print_region_data_blocks */
int
-h5str_dump_region_blocks_data
- (JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
+h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
{
- hssize_t nblocks;
- hsize_t alloc_size;
- hsize_t *ptdata = NULL;
- hid_t dtype = H5I_INVALID_HID;
- hid_t type_id = H5I_INVALID_HID;
- int ndims = -1;
- int ret_value = FAIL;
+ hssize_t nblocks;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ int ndims = -1;
+ int ret_value = FAIL;
/*
* This function fails if the region does not have blocks.
*/
- H5E_BEGIN_TRY {
- nblocks = H5Sget_select_hyper_nblocks(region);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { nblocks = H5Sget_select_hyper_nblocks(region); }
+ H5E_END_TRY;
if (nblocks < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -1454,11 +1458,12 @@ h5str_dump_region_blocks_data
/* Print block information */
alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]);
- if (alloc_size == (hsize_t)((size_t) alloc_size)) {
- if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t) alloc_size)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_blocks_data: failed to allocate region block buffer");
+ if (alloc_size == (hsize_t)((size_t)alloc_size)) {
+ if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_dump_region_blocks_data: failed to allocate region block buffer");
- if (H5Sget_select_hyper_blocklist(region, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0)
+ if (H5Sget_select_hyper_blocklist(region, (hsize_t)0, (hsize_t)nblocks, ptdata) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if ((dtype = H5Dget_type(region_id)) < 0)
@@ -1486,24 +1491,22 @@ done:
#ifndef SKIP_UNUSED_DUMP_ROUTINES
static int
-h5str_dump_region_blocks
- (JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
+h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
{
- hssize_t nblocks;
- hsize_t alloc_size;
- hsize_t *ptdata = NULL;
- char tmp_str[256];
- int ndims = -1;
- int ret_value = FAIL;
+ hssize_t nblocks;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ char tmp_str[256];
+ int ndims = -1;
+ int ret_value = FAIL;
UNUSED(region_id);
/*
* This function fails if the region does not have blocks.
*/
- H5E_BEGIN_TRY {
- nblocks = H5Sget_select_hyper_nblocks(region);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { nblocks = H5Sget_select_hyper_nblocks(region); }
+ H5E_END_TRY;
if (nblocks < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -1513,13 +1516,14 @@ h5str_dump_region_blocks
/* Print block information */
alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]);
- if (alloc_size == (hsize_t)((size_t) alloc_size)) {
+ if (alloc_size == (hsize_t)((size_t)alloc_size)) {
int i;
- if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t) alloc_size)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_blocks: failed to allocate region block buffer");
+ if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_dump_region_blocks: failed to allocate region block buffer");
- if (H5Sget_select_hyper_blocklist(region, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0)
+ if (H5Sget_select_hyper_blocklist(region, (hsize_t)0, (hsize_t)nblocks, ptdata) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if (!h5str_append(str, " {"))
@@ -1535,8 +1539,7 @@ h5str_dump_region_blocks
for (j = 0; j < ndims; j++) {
tmp_str[0] = '\0';
- if (HDsprintf(tmp_str, "%s%lu", j ? "," : "(",
- (unsigned long) ptdata[i * 2 * ndims + j]) < 0)
+ if (HDsprintf(tmp_str, "%s%lu", j ? "," : "(", (unsigned long)ptdata[i * 2 * ndims + j]) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsprintf failure");
if (!h5str_append(str, tmp_str))
@@ -1547,7 +1550,7 @@ h5str_dump_region_blocks
tmp_str[0] = '\0';
if (HDsprintf(tmp_str, "%s%lu", j ? "," : ")-(",
- (unsigned long) ptdata[i * 2 * ndims + j + ndims]) < 0)
+ (unsigned long)ptdata[i * 2 * ndims + j + ndims]) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsprintf failure");
if (!h5str_append(str, tmp_str))
@@ -1585,16 +1588,16 @@ done:
*-------------------------------------------------------------------------
*/
static int
-h5str_print_region_data_points
- (JNIEnv *env, hid_t region_space, hid_t region_id, h5str_t *str, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata)
+h5str_print_region_data_points(JNIEnv *env, hid_t region_space, hid_t region_id, h5str_t *str, int ndims,
+ hid_t type_id, hssize_t npoints, hsize_t *ptdata)
{
hsize_t *dims1 = NULL;
hsize_t total_size[H5S_MAX_RANK];
size_t jndx;
size_t type_size;
- hid_t mem_space = H5I_INVALID_HID;
- void *region_buf = NULL;
- int ret_value = FAIL;
+ hid_t mem_space = H5I_INVALID_HID;
+ void * region_buf = NULL;
+ int ret_value = FAIL;
UNUSED(ptdata);
@@ -1602,8 +1605,9 @@ h5str_print_region_data_points
H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_print_region_data_points: npoints < 0");
/* Allocate space for the dimension array */
- if (NULL == (dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_points: failed to allocate dimension array buffer");
+ if (NULL == (dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_print_region_data_points: failed to allocate dimension array buffer");
dims1[0] = (hsize_t)npoints;
@@ -1620,14 +1624,14 @@ h5str_print_region_data_points
if (H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- for (jndx = 0; jndx < (size_t) npoints; jndx++) {
+ for (jndx = 0; jndx < (size_t)npoints; jndx++) {
if (H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if (!h5str_sprintf(ENVONLY, str, region_id, type_id, ((char *)region_buf + jndx * type_size), 0, 1))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if (jndx + 1 < (size_t) npoints)
+ if (jndx + 1 < (size_t)npoints)
if (!h5str_append(str, ", "))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
} /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */
@@ -1646,23 +1650,21 @@ done:
} /* end h5str_print_region_data_points */
int
-h5str_dump_region_points_data
- (JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
+h5str_dump_region_points_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
{
- hssize_t npoints;
- hsize_t alloc_size;
- hsize_t *ptdata = NULL;
- hid_t dtype = H5I_INVALID_HID;
- hid_t type_id = H5I_INVALID_HID;
- int ndims = -1;
- int ret_value = FAIL;
+ hssize_t npoints;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ int ndims = -1;
+ int ret_value = FAIL;
/*
* This function fails if the region does not have points.
*/
- H5E_BEGIN_TRY {
- npoints = H5Sget_select_elem_npoints(region);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { npoints = H5Sget_select_elem_npoints(region); }
+ H5E_END_TRY;
if (npoints < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -1673,11 +1675,12 @@ h5str_dump_region_points_data
/* Print point information */
if (npoints > 0) {
alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]);
- if (alloc_size == (hsize_t)((size_t) alloc_size)) {
- if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t) alloc_size)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_points_data: failed to allocate region point data buffer");
+ if (alloc_size == (hsize_t)((size_t)alloc_size)) {
+ if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size)))
+ H5_OUT_OF_MEMORY_ERROR(
+ ENVONLY, "h5str_dump_region_points_data: failed to allocate region point data buffer");
- if (H5Sget_select_elem_pointlist(region, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0)
+ if (H5Sget_select_elem_pointlist(region, (hsize_t)0, (hsize_t)npoints, ptdata) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if ((dtype = H5Dget_type(region_id)) < 0)
@@ -1686,8 +1689,8 @@ h5str_dump_region_points_data
if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- if (h5str_print_region_data_points(ENVONLY, region, region_id,
- str, ndims, type_id, npoints, ptdata) < 0)
+ if (h5str_print_region_data_points(ENVONLY, region, region_id, str, ndims, type_id, npoints,
+ ptdata) < 0)
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
}
@@ -1707,24 +1710,22 @@ done:
#ifndef SKIP_UNUSED_DUMP_ROUTINES
static int
-h5str_dump_region_points
- (JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
+h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
{
- hssize_t npoints;
- hsize_t alloc_size;
- hsize_t *ptdata = NULL;
- char tmp_str[256];
- int ndims = -1;
- int ret_value = FAIL;
+ hssize_t npoints;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ char tmp_str[256];
+ int ndims = -1;
+ int ret_value = FAIL;
UNUSED(region_id);
/*
* This function fails if the region does not have points.
*/
- H5E_BEGIN_TRY {
- npoints = H5Sget_select_elem_npoints(region);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { npoints = H5Sget_select_elem_npoints(region); }
+ H5E_END_TRY;
if (npoints < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -1737,11 +1738,12 @@ h5str_dump_region_points
int i;
alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]);
- if (alloc_size == (hsize_t)((size_t) alloc_size)) {
- if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t) alloc_size)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_points: failed to allocate region point buffer");
+ if (alloc_size == (hsize_t)((size_t)alloc_size)) {
+ if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "h5str_dump_region_points: failed to allocate region point buffer");
- if (H5Sget_select_elem_pointlist(region, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0)
+ if (H5Sget_select_elem_pointlist(region, (hsize_t)0, (hsize_t)npoints, ptdata) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if (!h5str_append(str, " {"))
@@ -1756,8 +1758,8 @@ h5str_dump_region_points
for (j = 0; j < ndims; j++) {
tmp_str[0] = '\0';
- if (HDsprintf(tmp_str, "%s%lu", j ? "," : "(",
- (unsigned long) (ptdata[i * ndims + j])) < 0)
+ if (HDsprintf(tmp_str, "%s%lu", j ? "," : "(", (unsigned long)(ptdata[i * ndims + j])) <
+ 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points: HDsprintf failure");
if (!h5str_append(str, tmp_str))
@@ -1771,7 +1773,7 @@ h5str_dump_region_points
if (!h5str_append(str, " }"))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
} /* end if (alloc_size == (hsize_t)((size_t) alloc_size)) */
- } /* end if (npoints > 0) */
+ } /* end if (npoints > 0) */
ret_value = SUCCEED;
@@ -1784,10 +1786,9 @@ done:
#endif
static int
-h5str_is_zero
- (const void *_mem, size_t size)
+h5str_is_zero(const void *_mem, size_t size)
{
- const unsigned char *mem = (const unsigned char *) _mem;
+ const unsigned char *mem = (const unsigned char *)_mem;
while (size-- > 0)
if (mem[size])
@@ -1808,8 +1809,7 @@ h5str_is_zero
*-------------------------------------------------------------------------
*/
static htri_t
-h5str_detect_vlen
- (hid_t tid)
+h5str_detect_vlen(hid_t tid)
{
htri_t ret = FAIL;
@@ -1840,48 +1840,47 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-h5str_detect_vlen_str
- (hid_t tid)
+h5str_detect_vlen_str(hid_t tid)
{
H5T_class_t tclass = H5T_NO_CLASS;
- htri_t ret = 0;
+ htri_t ret = 0;
ret = H5Tis_variable_str(tid);
- if((ret == 1) || (ret < 0))
+ if ((ret == 1) || (ret < 0))
goto done;
tclass = H5Tget_class(tid);
- if(tclass == H5T_ARRAY || tclass == H5T_VLEN) {
+ if (tclass == H5T_ARRAY || tclass == H5T_VLEN) {
hid_t btid = H5Tget_super(tid);
- if(btid < 0) {
+ if (btid < 0) {
ret = (htri_t)btid;
goto done;
} /* end if */
ret = h5str_detect_vlen_str(btid);
- if((ret == 1) || (ret < 0)) {
+ if ((ret == 1) || (ret < 0)) {
H5Tclose(btid);
goto done;
} /* end if */
- } /* end if */
- else if(tclass == H5T_COMPOUND) {
+ } /* end if */
+ else if (tclass == H5T_COMPOUND) {
unsigned i = 0;
- int n = H5Tget_nmembers(tid);
+ int n = H5Tget_nmembers(tid);
if (n < 0)
goto done;
- for(i = 0; i < (unsigned) n; i++) {
+ for (i = 0; i < (unsigned)n; i++) {
hid_t mtid = H5Tget_member_type(tid, i);
ret = h5str_detect_vlen_str(mtid);
- if((ret == 1) || (ret < 0)) {
+ if ((ret == 1) || (ret < 0)) {
H5Tclose(mtid);
goto done;
}
H5Tclose(mtid);
} /* end for */
- } /* end else */
+ } /* end else */
done:
return ret;
@@ -1898,8 +1897,7 @@ done:
*-------------------------------------------------------------------------
*/
static hid_t
-h5str_get_native_type
- (hid_t type)
+h5str_get_native_type(hid_t type)
{
H5T_class_t type_class;
hid_t p_type = H5I_INVALID_HID;
@@ -1913,10 +1911,9 @@ h5str_get_native_type
p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
done:
- return(p_type);
+ return (p_type);
} /* end h5str_get_native_type */
-
/*-------------------------------------------------------------------------
* Function: h5str_get_little_endian_type
*
@@ -1927,8 +1924,7 @@ done:
*-------------------------------------------------------------------------
*/
static hid_t
-h5str_get_little_endian_type
- (hid_t tid)
+h5str_get_little_endian_type(hid_t tid)
{
H5T_class_t type_class;
H5T_sign_t sign;
@@ -1944,56 +1940,52 @@ h5str_get_little_endian_type
if ((sign = H5Tget_sign(tid)) < 0)
goto done;
- switch ( type_class ) {
- case H5T_INTEGER:
- {
- if ( size == 1 && sign == H5T_SGN_2 )
+ switch (type_class) {
+ case H5T_INTEGER: {
+ if (size == 1 && sign == H5T_SGN_2)
p_type = H5Tcopy(H5T_STD_I8LE);
- else if ( size == 2 && sign == H5T_SGN_2 )
+ else if (size == 2 && sign == H5T_SGN_2)
p_type = H5Tcopy(H5T_STD_I16LE);
- else if ( size == 4 && sign == H5T_SGN_2 )
+ else if (size == 4 && sign == H5T_SGN_2)
p_type = H5Tcopy(H5T_STD_I32LE);
- else if ( size == 8 && sign == H5T_SGN_2 )
+ else if (size == 8 && sign == H5T_SGN_2)
p_type = H5Tcopy(H5T_STD_I64LE);
- else if ( size == 1 && sign == H5T_SGN_NONE )
+ else if (size == 1 && sign == H5T_SGN_NONE)
p_type = H5Tcopy(H5T_STD_U8LE);
- else if ( size == 2 && sign == H5T_SGN_NONE )
+ else if (size == 2 && sign == H5T_SGN_NONE)
p_type = H5Tcopy(H5T_STD_U16LE);
- else if ( size == 4 && sign == H5T_SGN_NONE )
+ else if (size == 4 && sign == H5T_SGN_NONE)
p_type = H5Tcopy(H5T_STD_U32LE);
- else if ( size == 8 && sign == H5T_SGN_NONE )
+ else if (size == 8 && sign == H5T_SGN_NONE)
p_type = H5Tcopy(H5T_STD_U64LE);
break;
}
- case H5T_FLOAT:
- {
- if ( size == 4 )
+ case H5T_FLOAT: {
+ if (size == 4)
p_type = H5Tcopy(H5T_IEEE_F32LE);
- else if ( size == 8 )
+ else if (size == 8)
p_type = H5Tcopy(H5T_IEEE_F64LE);
break;
}
- case H5T_BITFIELD:
- {
- if ( size == 1 )
+ case H5T_BITFIELD: {
+ if (size == 1)
p_type = H5Tcopy(H5T_STD_B8LE);
- else if ( size == 2 )
+ else if (size == 2)
p_type = H5Tcopy(H5T_STD_B16LE);
- else if ( size == 4 )
+ else if (size == 4)
p_type = H5Tcopy(H5T_STD_B32LE);
- else if ( size == 8 )
+ else if (size == 8)
p_type = H5Tcopy(H5T_STD_B64LE);
break;
}
case H5T_NO_CLASS:
- case H5T_NCLASSES:
- {
+ case H5T_NCLASSES: {
goto done;
break;
}
@@ -2013,7 +2005,7 @@ h5str_get_little_endian_type
}
done:
- return(p_type);
+ return (p_type);
} /* end h5str_get_little_endian_type */
/*-------------------------------------------------------------------------
@@ -2026,8 +2018,7 @@ done:
*-------------------------------------------------------------------------
*/
static hid_t
-h5str_get_big_endian_type
- (hid_t tid)
+h5str_get_big_endian_type(hid_t tid)
{
H5T_class_t type_class;
H5T_sign_t sign;
@@ -2043,56 +2034,52 @@ h5str_get_big_endian_type
if ((sign = H5Tget_sign(tid)) < 0)
goto done;
- switch ( type_class ) {
- case H5T_INTEGER:
- {
- if ( size == 1 && sign == H5T_SGN_2 )
+ switch (type_class) {
+ case H5T_INTEGER: {
+ if (size == 1 && sign == H5T_SGN_2)
p_type = H5Tcopy(H5T_STD_I8BE);
- else if ( size == 2 && sign == H5T_SGN_2 )
+ else if (size == 2 && sign == H5T_SGN_2)
p_type = H5Tcopy(H5T_STD_I16BE);
- else if ( size == 4 && sign == H5T_SGN_2 )
+ else if (size == 4 && sign == H5T_SGN_2)
p_type = H5Tcopy(H5T_STD_I32BE);
- else if ( size == 8 && sign == H5T_SGN_2 )
+ else if (size == 8 && sign == H5T_SGN_2)
p_type = H5Tcopy(H5T_STD_I64BE);
- else if ( size == 1 && sign == H5T_SGN_NONE )
+ else if (size == 1 && sign == H5T_SGN_NONE)
p_type = H5Tcopy(H5T_STD_U8BE);
- else if ( size == 2 && sign == H5T_SGN_NONE )
+ else if (size == 2 && sign == H5T_SGN_NONE)
p_type = H5Tcopy(H5T_STD_U16BE);
- else if ( size == 4 && sign == H5T_SGN_NONE )
+ else if (size == 4 && sign == H5T_SGN_NONE)
p_type = H5Tcopy(H5T_STD_U32BE);
- else if ( size == 8 && sign == H5T_SGN_NONE )
+ else if (size == 8 && sign == H5T_SGN_NONE)
p_type = H5Tcopy(H5T_STD_U64BE);
break;
}
- case H5T_FLOAT:
- {
- if ( size == 4 )
+ case H5T_FLOAT: {
+ if (size == 4)
p_type = H5Tcopy(H5T_IEEE_F32BE);
- else if ( size == 8 )
+ else if (size == 8)
p_type = H5Tcopy(H5T_IEEE_F64BE);
break;
}
- case H5T_BITFIELD:
- {
- if ( size == 1 )
+ case H5T_BITFIELD: {
+ if (size == 1)
p_type = H5Tcopy(H5T_STD_B8BE);
- else if ( size == 2 )
+ else if (size == 2)
p_type = H5Tcopy(H5T_STD_B16BE);
- else if ( size == 4 )
+ else if (size == 4)
p_type = H5Tcopy(H5T_STD_B32BE);
- else if ( size == 8 )
+ else if (size == 8)
p_type = H5Tcopy(H5T_STD_B64BE);
break;
}
case H5T_NO_CLASS:
- case H5T_NCLASSES:
- {
+ case H5T_NCLASSES: {
goto done;
break;
}
@@ -2112,7 +2099,7 @@ h5str_get_big_endian_type
}
done:
- return(p_type);
+ return (p_type);
} /* end h5str_get_big_endian_type */
/*-------------------------------------------------------------------------
@@ -2125,13 +2112,12 @@ done:
*-------------------------------------------------------------------------
*/
static int
-h5str_render_bin_output
- (FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts)
+h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts)
{
- unsigned char *mem = (unsigned char*)_mem;
+ unsigned char *mem = (unsigned char *)_mem;
H5T_class_t type_class;
hsize_t block_index;
- size_t size; /* datum size */
+ size_t size; /* datum size */
int ret_value = 0;
if (!(size = H5Tget_size(tid))) {
@@ -2147,12 +2133,11 @@ h5str_render_bin_output
switch (type_class) {
case H5T_INTEGER:
case H5T_FLOAT:
- case H5T_ENUM:
- {
+ case H5T_ENUM: {
block_index = block_nelmts * size;
while (block_index > 0) {
- size_t bytes_in = 0; /* # of bytes to write */
- size_t bytes_wrote = 0; /* # of bytes written */
+ size_t bytes_in = 0; /* # of bytes to write */
+ size_t bytes_wrote = 0; /* # of bytes written */
if (block_index > sizeof(size_t))
bytes_in = sizeof(size_t);
@@ -2173,12 +2158,11 @@ h5str_render_bin_output
break;
}
- case H5T_STRING:
- {
- unsigned char tempuchar;
- unsigned int i;
- H5T_str_t pad;
- char *s;
+ case H5T_STRING: {
+ unsigned char tempuchar;
+ unsigned int i;
+ H5T_str_t pad;
+ char * s;
if ((pad = H5Tget_strpad(tid)) < 0) {
ret_value = FAIL;
@@ -2189,12 +2173,12 @@ h5str_render_bin_output
mem = ((unsigned char *)_mem) + block_index * size;
if (H5Tis_variable_str(tid)) {
- s = *(char**) mem;
+ s = *(char **)mem;
if (s != NULL)
size = HDstrlen(s);
}
else {
- s = (char *) mem;
+ s = (char *)mem;
}
for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) {
HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char));
@@ -2210,8 +2194,7 @@ h5str_render_bin_output
break;
}
- case H5T_COMPOUND:
- {
+ case H5T_COMPOUND: {
unsigned j;
size_t offset;
hid_t memb = H5I_INVALID_HID;
@@ -2223,8 +2206,8 @@ h5str_render_bin_output
}
for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
- for (j = 0; j < (unsigned) nmembs; j++) {
+ mem = ((unsigned char *)_mem) + block_index * size;
+ for (j = 0; j < (unsigned)nmembs; j++) {
offset = H5Tget_member_offset(tid, j);
memb = H5Tget_member_type(tid, j);
@@ -2244,8 +2227,7 @@ h5str_render_bin_output
break;
}
- case H5T_ARRAY:
- {
+ case H5T_ARRAY: {
hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts;
hid_t memb;
int k, ndims;
@@ -2270,11 +2252,11 @@ h5str_render_bin_output
for (k = 0, nelmts = 1; k < ndims; k++) {
temp_nelmts = nelmts;
temp_nelmts *= dims[k];
- nelmts = (size_t) temp_nelmts;
+ nelmts = (size_t)temp_nelmts;
}
for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
+ mem = ((unsigned char *)_mem) + block_index * size;
/* dump the array element */
if (h5str_render_bin_output(stream, container, memb, mem, nelmts) < 0) {
@@ -2288,8 +2270,7 @@ h5str_render_bin_output
break;
}
- case H5T_VLEN:
- {
+ case H5T_VLEN: {
hsize_t nelmts;
hid_t memb;
@@ -2300,13 +2281,14 @@ h5str_render_bin_output
}
for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
+ mem = ((unsigned char *)_mem) + block_index * size;
/* Get the number of sequence elements */
- nelmts = ((hvl_t *) mem)->len;
+ nelmts = ((hvl_t *)mem)->len;
/* dump the array element */
- if (h5str_render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) {
+ if (h5str_render_bin_output(stream, container, memb, ((char *)(((hvl_t *)mem)->p)), nelmts) <
+ 0) {
ret_value = FAIL;
break;
}
@@ -2317,26 +2299,28 @@ h5str_render_bin_output
break;
}
- case H5T_REFERENCE:
- {
+ case H5T_REFERENCE: {
if (H5Tequal(tid, H5T_STD_REF)) {
- hid_t region_id = H5I_INVALID_HID;
- hid_t region_space = H5I_INVALID_HID;
+ hid_t region_id = H5I_INVALID_HID;
+ hid_t region_space = H5I_INVALID_HID;
H5S_sel_type region_type;
/* Region data */
for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
- if((region_id = H5Ropen_object((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ mem = ((unsigned char *)_mem) + block_index * size;
+ if ((region_id = H5Ropen_object((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0)
continue;
else {
- if((region_space = H5Ropen_region((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((region_space =
+ H5Ropen_region((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
if (!h5str_is_zero(mem, H5Tget_size(H5T_STD_REF))) {
region_type = H5Sget_select_type(region_space);
if (region_type == H5S_SEL_POINTS)
- ret_value = render_bin_output_region_points(stream, region_space, region_id, container);
+ ret_value = render_bin_output_region_points(stream, region_space,
+ region_id, container);
else
- ret_value = render_bin_output_region_blocks(stream, region_space, region_id, container);
+ ret_value = render_bin_output_region_blocks(stream, region_space,
+ region_id, container);
}
H5Sclose(region_space);
} /* end if (region_space >= 0) */
@@ -2363,8 +2347,7 @@ h5str_render_bin_output
}
case H5T_NO_CLASS:
- case H5T_NCLASSES:
- {
+ case H5T_NCLASSES: {
ret_value = FAIL;
goto done;
break;
@@ -2375,7 +2358,7 @@ h5str_render_bin_output
case H5T_OPAQUE:
default:
for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
+ mem = ((unsigned char *)_mem) + block_index * size;
if (size != fwrite(mem, sizeof(char), size, stream)) {
ret_value = FAIL;
break;
@@ -2400,8 +2383,8 @@ done:
*-------------------------------------------------------------------------
*/
static int
-render_bin_output_region_data_blocks
- (FILE *stream, hid_t region_id, hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata)
+render_bin_output_region_data_blocks(FILE *stream, hid_t region_id, hid_t container, int ndims, hid_t type_id,
+ hssize_t nblocks, hsize_t *ptdata)
{
hsize_t *dims1 = NULL;
hsize_t *start = NULL;
@@ -2409,9 +2392,9 @@ render_bin_output_region_data_blocks
hsize_t numelem;
hsize_t total_size[H5S_MAX_RANK];
size_t type_size;
- hid_t sid1 = H5I_INVALID_HID;
- hid_t mem_space = H5I_INVALID_HID;
- void *region_buf = NULL;
+ hid_t sid1 = H5I_INVALID_HID;
+ hid_t mem_space = H5I_INVALID_HID;
+ void * region_buf = NULL;
int blkndx;
int jndx;
int ret_value = SUCCEED;
@@ -2423,7 +2406,7 @@ render_bin_output_region_data_blocks
}
/* Allocate space for the dimension array */
- if (NULL == (dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims))) {
+ if (NULL == (dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims))) {
ret_value = FAIL;
goto done;
}
@@ -2431,7 +2414,7 @@ render_bin_output_region_data_blocks
/* Find the dimensions of each data space from the block coordinates */
for (jndx = 0, numelem = 1; jndx < ndims; jndx++) {
dims1[jndx] = ptdata[jndx + ndims] - ptdata[jndx] + 1;
- numelem = dims1[jndx] * numelem;
+ numelem = dims1[jndx] * numelem;
}
/* Create dataspace for reading buffer */
@@ -2452,12 +2435,12 @@ render_bin_output_region_data_blocks
/* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
/* 1 2 n 1 2 n */
- if (NULL == (start = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims))) {
+ if (NULL == (start = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims))) {
ret_value = FAIL;
goto done;
}
- if (NULL == (count = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims))) {
+ if (NULL == (count = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims))) {
ret_value = FAIL;
goto done;
}
@@ -2520,16 +2503,15 @@ done:
*-------------------------------------------------------------------------
*/
static int
-render_bin_output_region_blocks
- (FILE *stream, hid_t region_space, hid_t region_id, hid_t container)
+render_bin_output_region_blocks(FILE *stream, hid_t region_space, hid_t region_id, hid_t container)
{
- hssize_t nblocks;
- hsize_t alloc_size;
- hsize_t *ptdata = NULL;
- hid_t dtype = H5I_INVALID_HID;
- hid_t type_id = H5I_INVALID_HID;
- int ndims;
- int ret_value = SUCCEED;
+ hssize_t nblocks;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ int ndims;
+ int ret_value = SUCCEED;
if ((nblocks = H5Sget_select_hyper_nblocks(region_space)) < 0) {
ret_value = FAIL;
@@ -2545,7 +2527,7 @@ render_bin_output_region_blocks
alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]);
- if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t)alloc_size))) {
+ if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) {
ret_value = FAIL;
goto done;
}
@@ -2565,8 +2547,8 @@ render_bin_output_region_blocks
goto done;
}
- if (render_bin_output_region_data_blocks(stream, region_id, container,
- ndims, type_id, nblocks, ptdata) < 0) {
+ if (render_bin_output_region_data_blocks(stream, region_id, container, ndims, type_id, nblocks,
+ ptdata) < 0) {
ret_value = FAIL;
goto done;
}
@@ -2595,15 +2577,14 @@ done:
*-------------------------------------------------------------------------
*/
static int
-render_bin_output_region_data_points
- (FILE *stream, hid_t region_space, hid_t region_id,
- hid_t container, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata)
+render_bin_output_region_data_points(FILE *stream, hid_t region_space, hid_t region_id, hid_t container,
+ int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata)
{
hsize_t *dims1 = NULL;
size_t type_size;
- hid_t mem_space = H5I_INVALID_HID;
- void *region_buf = NULL;
- int ret_value = SUCCEED;
+ hid_t mem_space = H5I_INVALID_HID;
+ void * region_buf = NULL;
+ int ret_value = SUCCEED;
UNUSED(ptdata);
@@ -2618,7 +2599,7 @@ render_bin_output_region_data_points
}
/* Allocate space for the dimension array */
- if (NULL == (dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims))) {
+ if (NULL == (dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims))) {
ret_value = FAIL;
goto done;
}
@@ -2668,16 +2649,15 @@ done:
*-------------------------------------------------------------------------
*/
static int
-render_bin_output_region_points
- (FILE *stream, hid_t region_space, hid_t region_id, hid_t container)
+render_bin_output_region_points(FILE *stream, hid_t region_space, hid_t region_id, hid_t container)
{
- hssize_t npoints;
- hsize_t alloc_size;
- hsize_t *ptdata = NULL;
- hid_t dtype = H5I_INVALID_HID;
- hid_t type_id = H5I_INVALID_HID;
- int ndims;
- int ret_value = SUCCEED;
+ hssize_t npoints;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ int ndims;
+ int ret_value = SUCCEED;
if ((npoints = H5Sget_select_elem_npoints(region_space)) < 0) {
ret_value = FAIL;
@@ -2693,7 +2673,7 @@ render_bin_output_region_points
alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]);
- if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t)alloc_size))) {
+ if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) {
ret_value = FAIL;
goto done;
}
@@ -2713,8 +2693,8 @@ render_bin_output_region_points
goto done;
}
- if (render_bin_output_region_data_points(stream, region_space, region_id,
- container, ndims, type_id, npoints, ptdata) < 0) {
+ if (render_bin_output_region_data_points(stream, region_space, region_id, container, ndims, type_id,
+ npoints, ptdata) < 0) {
ret_value = FAIL;
goto done;
}
@@ -2732,8 +2712,7 @@ done:
} /* end render_bin_output_region_points */
int
-h5str_dump_simple_dset
- (JNIEnv *env, FILE *stream, hid_t dset, int binary_order)
+h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order)
{
hsize_t elmtno; /* counter */
hsize_t zero[8]; /* vector of zeros */
@@ -2741,7 +2720,7 @@ h5str_dump_simple_dset
size_t i; /* counter */
hid_t f_space = H5I_INVALID_HID; /* file data space */
int ndims;
- int carry; /* counter carry value */
+ int carry; /* counter carry value */
/* Print info */
hsize_t p_nelmts; /* total selected elmts */
@@ -2761,8 +2740,8 @@ h5str_dump_simple_dset
/* VL data special information */
unsigned int vl_data = 0; /* contains VL datatypes */
- hid_t p_type = H5I_INVALID_HID;
- hid_t f_type = H5I_INVALID_HID;
+ hid_t p_type = H5I_INVALID_HID;
+ hid_t f_type = H5I_INVALID_HID;
int ret_value = FAIL;
@@ -2773,32 +2752,28 @@ h5str_dump_simple_dset
H5_LIBRARY_ERROR(ENVONLY);
switch (binary_order) {
- case 1:
- {
+ case 1: {
if ((p_type = h5str_get_native_type(f_type)) < 0)
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
break;
}
- case 2:
- {
+ case 2: {
if ((p_type = h5str_get_little_endian_type(f_type)) < 0)
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
break;
}
- case 3:
- {
+ case 3: {
if ((p_type = h5str_get_big_endian_type(f_type)) < 0)
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
break;
}
- default:
- {
+ default: {
if ((p_type = H5Tcopy(f_type)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -2820,7 +2795,7 @@ h5str_dump_simple_dset
p_nelmts = 1;
if (ndims > 0) {
- for (i = 0; i < (size_t) ndims; i++)
+ for (i = 0; i < (size_t)ndims; i++)
p_nelmts *= total_size[i];
} /* end if */
@@ -2839,7 +2814,7 @@ h5str_dump_simple_dset
if (ndims > 0) {
for (i = (size_t)ndims; i > 0; --i) {
hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
- if ( size == 0 ) /* datum size > H5TOOLS_BUFSIZE */
+ if (size == 0) /* datum size > H5TOOLS_BUFSIZE */
size = 1;
sm_size[i - 1] = (((total_size[i - 1]) < (size)) ? (total_size[i - 1]) : (size));
sm_nbytes *= sm_size[i - 1];
@@ -2847,7 +2822,7 @@ h5str_dump_simple_dset
}
if (sm_nbytes > 0) {
- if (NULL == (sm_buf = (unsigned char *) HDmalloc((size_t)sm_nbytes)))
+ if (NULL == (sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_simple_dset: failed to allocate sm_buf");
sm_nelmts = sm_nbytes / p_type_nbytes;
@@ -2862,8 +2837,10 @@ h5str_dump_simple_dset
for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) {
/* Calculate the hyperslab size */
if (ndims > 0) {
- for (i = 0, hs_nelmts = 1; i < (size_t) ndims; i++) {
- hs_size[i] = (((total_size[i] - hs_offset[i]) < (sm_size[i])) ? (total_size[i] - hs_offset[i]) : (sm_size[i]));
+ for (i = 0, hs_nelmts = 1; i < (size_t)ndims; i++) {
+ hs_size[i] = (((total_size[i] - hs_offset[i]) < (sm_size[i]))
+ ? (total_size[i] - hs_offset[i])
+ : (sm_size[i]));
hs_nelmts *= hs_size[i];
}
@@ -2934,23 +2911,24 @@ done:
} /* end h5str_dump_simple_dset */
htri_t
-H5Tdetect_variable_str(hid_t tid) {
+H5Tdetect_variable_str(hid_t tid)
+{
htri_t ret_val = 0;
if (H5Tget_class(tid) == H5T_COMPOUND) {
unsigned i;
unsigned nm = (unsigned)H5Tget_nmembers(tid);
- for(i = 0; i < nm; i++) {
+ for (i = 0; i < nm; i++) {
htri_t status = 0;
- hid_t mtid = 0;
- if((mtid = H5Tget_member_type(tid, i)) < 0)
+ hid_t mtid = 0;
+ if ((mtid = H5Tget_member_type(tid, i)) < 0)
return FAIL; /* exit immediately on error */
- if((status = H5Tdetect_variable_str(mtid)) < 0)
+ if ((status = H5Tdetect_variable_str(mtid)) < 0)
return status; /* exit immediately on error */
ret_val |= status;
- H5Tclose (mtid);
+ H5Tclose(mtid);
} /* end for */
- } /* end if */
+ } /* end if */
else
ret_val = H5Tis_variable_str(tid);
@@ -2958,8 +2936,7 @@ H5Tdetect_variable_str(hid_t tid) {
} /* end H5Tdetect_variable_str */
static int
-h5tools_dump_simple_data
- (JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts)
+h5tools_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts)
{
unsigned char *mem = (unsigned char *)_mem;
h5str_t buffer; /* string into which to render */
@@ -2972,8 +2949,8 @@ h5tools_dump_simple_data
H5_LIBRARY_ERROR(ENVONLY);
for (i = 0, line_count = 0; i < nelmts; i++, line_count++) {
- size_t bytes_in = 0; /* # of bytes to write */
- void *memref = mem + i * size;
+ size_t bytes_in = 0; /* # of bytes to write */
+ void * memref = mem + i * size;
/* Render the data element*/
h5str_new(&buffer, 32 * size);
@@ -3023,17 +3000,17 @@ done:
* Signature: (JJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5AreadComplex
-(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
+Java_hdf_hdf5lib_H5_H5AreadComplex(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id,
+ jobjectArray buf)
{
- h5str_t h5str;
- jstring jstr;
- size_t size;
- size_t i;
- hid_t p_type = H5I_INVALID_HID;
- jsize n;
- char *readBuf = NULL;
- herr_t status = FAIL;
+ h5str_t h5str;
+ jstring jstr;
+ size_t size;
+ size_t i;
+ hid_t p_type = H5I_INVALID_HID;
+ jsize n;
+ char * readBuf = NULL;
+ herr_t status = FAIL;
UNUSED(clss);
@@ -3042,14 +3019,15 @@ Java_hdf_hdf5lib_H5_H5AreadComplex
if ((p_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- size = (((H5Tget_size(mem_type_id))>(H5Tget_size(p_type))) ? (H5Tget_size(mem_type_id)) : (H5Tget_size(p_type)));
+ size = (((H5Tget_size(mem_type_id)) > (H5Tget_size(p_type))) ? (H5Tget_size(mem_type_id))
+ : (H5Tget_size(p_type)));
if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) <= 0) {
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AreadComplex: read buffer length <= 0");
}
- if (NULL == (readBuf = (char *) HDmalloc((size_t)n * size)))
+ if (NULL == (readBuf = (char *)HDmalloc((size_t)n * size)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadComplex: failed to allocate read buffer");
if ((status = H5Aread(attr_id, mem_type_id, readBuf)) < 0)
@@ -3060,7 +3038,7 @@ Java_hdf_hdf5lib_H5_H5AreadComplex
if (!h5str.s)
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadComplex: failed to allocate string buffer");
- for (i = 0; i < (size_t) n; i++) {
+ for (i = 0; i < (size_t)n; i++) {
h5str.s[0] = '\0';
if (!h5str_sprintf(ENVONLY, &h5str, attr_id, mem_type_id, readBuf + (i * size), 0, 0))
@@ -3069,7 +3047,7 @@ Java_hdf_hdf5lib_H5_H5AreadComplex
if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s)))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- ENVPTR->SetObjectArrayElement(ENVONLY, buf, (jsize) i, jstr);
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, (jsize)i, jstr);
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
ENVPTR->DeleteLocalRef(ENVONLY, jstr);
@@ -3093,16 +3071,15 @@ done:
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Acopy
- (JNIEnv *env, jclass clss, jlong src_id, jlong dst_id)
+Java_hdf_hdf5lib_H5_H5Acopy(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id)
{
- hssize_t npoints;
- hsize_t total_size = 0;
- size_t type_size;
- jbyte *buf = NULL;
- hid_t tid = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- herr_t retVal = FAIL;
+ hssize_t npoints;
+ hsize_t total_size = 0;
+ size_t type_size;
+ jbyte * buf = NULL;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -3118,7 +3095,7 @@ Java_hdf_hdf5lib_H5_H5Acopy
H5_LIBRARY_ERROR(ENVONLY);
total_size = (hsize_t)npoints * (hsize_t)type_size;
- if (NULL == (buf = (jbyte *) HDmalloc((size_t)total_size * sizeof(jbyte))))
+ if (NULL == (buf = (jbyte *)HDmalloc((size_t)total_size * sizeof(jbyte))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Acopy: failed to allocate buffer");
if ((retVal = H5Aread((hid_t)src_id, tid, buf)) < 0)
@@ -3152,16 +3129,15 @@ done:
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dcopy
- (JNIEnv *env, jclass clss, jlong src_id, jlong dst_id)
+Java_hdf_hdf5lib_H5_H5Dcopy(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id)
{
- hssize_t npoints;
- hsize_t total_size = 0, total_allocated_size;
- size_t type_size;
- jbyte *buf = NULL;
- hid_t tid = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- herr_t retVal = FAIL;
+ hssize_t npoints;
+ hsize_t total_size = 0, total_allocated_size;
+ size_t type_size;
+ jbyte * buf = NULL;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ herr_t retVal = FAIL;
UNUSED(clss);
@@ -3180,7 +3156,7 @@ Java_hdf_hdf5lib_H5_H5Dcopy
H5_LIBRARY_ERROR(ENVONLY);
total_size = (hsize_t)npoints * (hsize_t)type_size;
- if (NULL == (buf = (jbyte *) HDmalloc((size_t)total_size * sizeof(jbyte))))
+ if (NULL == (buf = (jbyte *)HDmalloc((size_t)total_size * sizeof(jbyte))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dcopy: failed to allocate buffer");
if ((retVal = H5Dread((hid_t)src_id, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)) < 0)
@@ -3219,29 +3195,29 @@ done:
*/
#ifdef __cplusplus
- herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info2_t *linfo, void *op_data);
- herr_t obj_info_max(hid_t g_id, const char *name, const H5L_info2_t *linfo, void *op_data);
- int H5Gget_obj_info_max(hid_t, char **, int *, int *, H5O_token_t *, long);
- int H5Gget_obj_info_full( hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, H5O_token_t *obj_token, int indexType, int indexOrder);
+herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info2_t *linfo, void *op_data);
+herr_t obj_info_max(hid_t g_id, const char *name, const H5L_info2_t *linfo, void *op_data);
+int H5Gget_obj_info_max(hid_t, char **, int *, int *, H5O_token_t *, long);
+int H5Gget_obj_info_full(hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno,
+ H5O_token_t *obj_token, int indexType, int indexOrder);
#else
- static herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info2_t *linfo, void *op_data);
- static herr_t obj_info_max(hid_t g_id, const char *name, const H5L_info2_t *linfo, void *op_data);
- static int H5Gget_obj_info_max(hid_t, char **, int *, int *, H5O_token_t *, long);
- static int H5Gget_obj_info_full( hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, H5O_token_t *obj_token, int indexType, int indexOrder);
+static herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info2_t *linfo, void *op_data);
+static herr_t obj_info_max(hid_t g_id, const char *name, const H5L_info2_t *linfo, void *op_data);
+static int H5Gget_obj_info_max(hid_t, char **, int *, int *, H5O_token_t *, long);
+static int H5Gget_obj_info_full(hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno,
+ H5O_token_t *obj_token, int indexType, int indexOrder);
#endif
-typedef struct info_all
-{
- char **objname;
- int *otype;
- int *ltype;
- H5O_token_t *obj_token;
+typedef struct info_all {
+ char ** objname;
+ int * otype;
+ int * ltype;
+ H5O_token_t * obj_token;
unsigned long *fno;
- unsigned long idxnum;
- int count;
+ unsigned long idxnum;
+ int count;
} info_all_t;
-
/*
* Class: hdf_hdf5lib_H5
* Method: H5Gget_obj_info_full
@@ -3253,26 +3229,26 @@ typedef struct info_all
* end up overwriting memory heap-tracking info.
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full
- (JNIEnv *env, jclass clss, jlong loc_id, jstring group_name,
- jobjectArray objName, jintArray oType, jintArray lType, jlongArray fNo,
- jobjectArray oToken, jint n, jint indx_type, jint indx_order)
+Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full(JNIEnv *env, jclass clss, jlong loc_id, jstring group_name,
+ jobjectArray objName, jintArray oType, jintArray lType,
+ jlongArray fNo, jobjectArray oToken, jint n, jint indx_type,
+ jint indx_order)
{
- unsigned long *fnos = NULL;
- H5O_token_t *tokens = NULL;
- const char *gName = NULL;
- char **oName = NULL;
- jboolean isCopy;
- jstring str;
- jobject token;
- jint *otarr = NULL;
- jint *ltarr = NULL;
- jlong *fnoP = NULL;
- hid_t gid = (hid_t)loc_id;
- int i;
- int indexType = indx_type;
- int indexOrder = indx_order;
- herr_t ret_val = FAIL;
+ unsigned long *fnos = NULL;
+ H5O_token_t * tokens = NULL;
+ const char * gName = NULL;
+ char ** oName = NULL;
+ jboolean isCopy;
+ jstring str;
+ jobject token;
+ jint * otarr = NULL;
+ jint * ltarr = NULL;
+ jlong * fnoP = NULL;
+ hid_t gid = (hid_t)loc_id;
+ int i;
+ int indexType = indx_type;
+ int indexOrder = indx_order;
+ herr_t ret_val = FAIL;
UNUSED(clss);
@@ -3289,14 +3265,15 @@ Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full
PIN_INT_ARRAY(ENVONLY, lType, ltarr, &isCopy, "H5Gget_obj_info_full: lType not pinned");
PIN_LONG_ARRAY(ENVONLY, fNo, fnoP, &isCopy, "H5Gget_obj_info_full: fNo not pinned");
- if (NULL == (oName = (char **) HDcalloc((size_t)n, sizeof(*oName))))
+ if (NULL == (oName = (char **)HDcalloc((size_t)n, sizeof(*oName))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for object name");
- if (NULL == (tokens = (H5O_token_t *) HDcalloc((size_t)n, sizeof(H5O_token_t))))
+ if (NULL == (tokens = (H5O_token_t *)HDcalloc((size_t)n, sizeof(H5O_token_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for object tokens");
- if (NULL == (fnos = (unsigned long *) HDcalloc((size_t)n, sizeof(unsigned long))))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for file number info");
+ if (NULL == (fnos = (unsigned long *)HDcalloc((size_t)n, sizeof(unsigned long))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "H5Gget_obj_info_full: failed to allocate buffer for file number info");
if (group_name) {
PIN_JAVA_STRING(ENVONLY, group_name, gName, &isCopy, "H5Gget_obj_info_full: group_name not pinned");
@@ -3305,7 +3282,8 @@ Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full
H5_LIBRARY_ERROR(ENVONLY);
}
- if ((ret_val = H5Gget_obj_info_full(gid, oName, (int *)otarr, (int *)ltarr, fnos, tokens, indexType, indexOrder)) < 0)
+ if ((ret_val = H5Gget_obj_info_full(gid, oName, (int *)otarr, (int *)ltarr, fnos, tokens, indexType,
+ indexOrder)) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_full: retrieval of object info failed");
for (i = 0; i < n; i++) {
@@ -3363,19 +3341,19 @@ done:
* will most likely end up overwriting memory heap-tracking info.
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max
- (JNIEnv *env, jclass clss, jlong loc_id, jobjectArray objName,
- jintArray oType, jintArray lType, jobjectArray oToken, jlong maxnum, jint n)
+Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max(JNIEnv *env, jclass clss, jlong loc_id, jobjectArray objName,
+ jintArray oType, jintArray lType, jobjectArray oToken,
+ jlong maxnum, jint n)
{
- H5O_token_t *tokens = NULL;
- jboolean isCopy;
- jstring str;
- jobject token;
- char **oName = NULL;
- jint *otarr = NULL;
- jint *ltarr = NULL;
- int i;
- herr_t ret_val = FAIL;
+ H5O_token_t *tokens = NULL;
+ jboolean isCopy;
+ jstring str;
+ jobject token;
+ char ** oName = NULL;
+ jint * otarr = NULL;
+ jint * ltarr = NULL;
+ int i;
+ herr_t ret_val = FAIL;
UNUSED(clss);
@@ -3389,10 +3367,10 @@ Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max
PIN_INT_ARRAY(ENVONLY, oType, otarr, &isCopy, "H5Gget_obj_info_max: oType not pinned");
PIN_INT_ARRAY(ENVONLY, lType, ltarr, &isCopy, "H5Gget_obj_info_max: lType not pinned");
- if (NULL == (oName = (char **) HDcalloc((size_t)n, sizeof(*oName))))
+ if (NULL == (oName = (char **)HDcalloc((size_t)n, sizeof(*oName))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_max: failed to allocate buffer for object name");
- if (NULL == (tokens = (H5O_token_t *) HDcalloc((size_t)n, sizeof(H5O_token_t))))
+ if (NULL == (tokens = (H5O_token_t *)HDcalloc((size_t)n, sizeof(H5O_token_t))))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_max: failed to allocate buffer for object tokens");
if ((ret_val = H5Gget_obj_info_max((hid_t)loc_id, oName, (int *)otarr, (int *)ltarr, tokens, maxnum)) < 0)
@@ -3433,30 +3411,31 @@ done:
} /* end Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max */
int
-H5Gget_obj_info_full
- (hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, H5O_token_t *obj_token, int indexType, int indexOrder)
+H5Gget_obj_info_full(hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno,
+ H5O_token_t *obj_token, int indexType, int indexOrder)
{
info_all_t info;
- info.objname = objname;
- info.otype = otype;
- info.ltype = ltype;
- info.idxnum = 0;
- info.fno = fno;
+ info.objname = objname;
+ info.otype = otype;
+ info.ltype = ltype;
+ info.idxnum = 0;
+ info.fno = fno;
info.obj_token = obj_token;
- info.count = 0;
+ info.count = 0;
- if (H5Literate2(loc_id, (H5_index_t)indexType, (H5_iter_order_t)indexOrder, NULL, obj_info_all, (void *)&info) < 0) {
+ if (H5Literate2(loc_id, (H5_index_t)indexType, (H5_iter_order_t)indexOrder, NULL, obj_info_all,
+ (void *)&info) < 0) {
/*
* Reset info stats; most importantly, reset the count.
*/
- info.objname = objname;
- info.otype = otype;
- info.ltype = ltype;
- info.idxnum = 0;
- info.fno = fno;
+ info.objname = objname;
+ info.otype = otype;
+ info.ltype = ltype;
+ info.idxnum = 0;
+ info.fno = fno;
info.obj_token = obj_token;
- info.count = 0;
+ info.count = 0;
/* Iteration failed, try normal alphabetical order */
if (H5Literate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, obj_info_all, (void *)&info) < 0)
@@ -3467,17 +3446,16 @@ H5Gget_obj_info_full
} /* end H5Gget_obj_info_full */
int
-H5Gget_obj_info_max
- (hid_t loc_id, char **objname, int *otype, int *ltype, H5O_token_t *obj_token, long maxnum)
+H5Gget_obj_info_max(hid_t loc_id, char **objname, int *otype, int *ltype, H5O_token_t *obj_token, long maxnum)
{
info_all_t info;
- info.objname = objname;
- info.otype = otype;
- info.ltype = ltype;
- info.idxnum = (unsigned long)maxnum;
+ info.objname = objname;
+ info.otype = otype;
+ info.ltype = ltype;
+ info.idxnum = (unsigned long)maxnum;
info.obj_token = obj_token;
- info.count = 0;
+ info.count = 0;
if (H5Lvisit2(loc_id, H5_INDEX_NAME, H5_ITER_NATIVE, obj_info_max, (void *)&info) < 0)
return -1;
@@ -3486,20 +3464,19 @@ H5Gget_obj_info_max
} /* end H5Gget_obj_info_max */
herr_t
-obj_info_all
- (hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_data)
+obj_info_all(hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_data)
{
- info_all_t *datainfo = (info_all_t *)op_data;
- H5O_info2_t object_info;
- htri_t object_exists;
- size_t str_len;
+ info_all_t *datainfo = (info_all_t *)op_data;
+ H5O_info2_t object_info;
+ htri_t object_exists;
+ size_t str_len;
- datainfo->otype[datainfo->count] = -1;
- datainfo->ltype[datainfo->count] = -1;
+ datainfo->otype[datainfo->count] = -1;
+ datainfo->ltype[datainfo->count] = -1;
datainfo->obj_token[datainfo->count] = H5O_TOKEN_UNDEF;
str_len = HDstrlen(name);
- if (NULL == (datainfo->objname[datainfo->count] = (char *) HDmalloc(str_len + 1)))
+ if (NULL == (datainfo->objname[datainfo->count] = (char *)HDmalloc(str_len + 1)))
goto done;
HDstrncpy(datainfo->objname[datainfo->count], name, str_len);
@@ -3514,7 +3491,7 @@ obj_info_all
datainfo->otype[datainfo->count] = object_info.type;
datainfo->ltype[datainfo->count] = info->type;
- datainfo->fno[datainfo->count] = object_info.fileno;
+ datainfo->fno[datainfo->count] = object_info.fileno;
HDmemcpy(&datainfo->obj_token[datainfo->count], &object_info.token, sizeof(object_info.token));
}
@@ -3526,21 +3503,20 @@ done:
} /* end obj_info_all */
herr_t
-obj_info_max
- (hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_data)
+obj_info_max(hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_data)
{
- info_all_t *datainfo = (info_all_t *)op_data;
- H5O_info2_t object_info;
- size_t str_len;
+ info_all_t *datainfo = (info_all_t *)op_data;
+ H5O_info2_t object_info;
+ size_t str_len;
- datainfo->otype[datainfo->count] = -1;
- datainfo->ltype[datainfo->count] = -1;
- datainfo->objname[datainfo->count] = NULL;
+ datainfo->otype[datainfo->count] = -1;
+ datainfo->ltype[datainfo->count] = -1;
+ datainfo->objname[datainfo->count] = NULL;
datainfo->obj_token[datainfo->count] = H5O_TOKEN_UNDEF;
/* This will be freed by h5str_array_free(oName, n) */
str_len = HDstrlen(name);
- if (NULL == (datainfo->objname[datainfo->count] = (char *) HDmalloc(str_len + 1)))
+ if (NULL == (datainfo->objname[datainfo->count] = (char *)HDmalloc(str_len + 1)))
goto done;
HDstrncpy(datainfo->objname[datainfo->count], name, str_len);
@@ -3569,17 +3545,17 @@ done:
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5export_1dataset
- (JNIEnv *env, jclass clss, jstring file_export_name, jstring file_name, jstring object_path, jint binary_order)
+Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *env, jclass clss, jstring file_export_name, jstring file_name,
+ jstring object_path, jint binary_order)
{
const char *file_export = NULL;
const char *object_name = NULL;
- const char *fileName = NULL;
+ const char *fileName = NULL;
jboolean isCopy;
- herr_t ret_val = FAIL;
- hid_t file_id = H5I_INVALID_HID;
+ herr_t ret_val = FAIL;
+ hid_t file_id = H5I_INVALID_HID;
hid_t dataset_id = H5I_INVALID_HID;
- FILE *stream = NULL;
+ FILE * stream = NULL;
UNUSED(clss);
@@ -3602,7 +3578,8 @@ Java_hdf_hdf5lib_H5_H5export_1dataset
if ((dataset_id = H5Dopen2(file_id, object_name, H5P_DEFAULT)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- PIN_JAVA_STRING(ENVONLY, file_export_name, file_export, NULL, "H5export_dataset: file_export name not pinned");
+ PIN_JAVA_STRING(ENVONLY, file_export_name, file_export, NULL,
+ "H5export_dataset: file_export name not pinned");
if (NULL == (stream = HDfopen(file_export, "w+")))
H5_JNI_FATAL_ERROR(ENVONLY, "HDfopen failed");
diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h
index 51b6594..7c5fb90 100644
--- a/java/src/jni/h5util.h
+++ b/java/src/jni/h5util.h
@@ -23,51 +23,51 @@
#include "h5jni.h"
#ifndef SUCCEED
-#define SUCCEED 0
+#define SUCCEED 0
#endif
#ifndef FAIL
-#define FAIL (-1)
+#define FAIL (-1)
#endif
typedef struct h5str_t {
- char *s;
- size_t max; /* the allocated size of the string */
+ char * s;
+ size_t max; /* the allocated size of the string */
} h5str_t;
-extern void h5str_new(h5str_t *str, size_t len);
-extern void h5str_free(h5str_t *str);
-extern void h5str_resize(h5str_t *str, size_t new_len);
-extern char* h5str_append(h5str_t *str, const char* cstr);
-extern size_t h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_buf, size_t out_buf_offset);
-extern void h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_p);
-extern size_t h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, size_t in_buf_len, int expand_data);
-extern void h5str_array_free(char **strs, size_t len);
-extern int h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order);
-extern int h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
-extern int h5str_dump_region_points_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
-
-extern htri_t H5Tdetect_variable_str(hid_t tid);
+extern void h5str_new(h5str_t *str, size_t len);
+extern void h5str_free(h5str_t *str);
+extern void h5str_resize(h5str_t *str, size_t new_len);
+extern char * h5str_append(h5str_t *str, const char *cstr);
+extern size_t h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_buf,
+ size_t out_buf_offset);
+extern void h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_p);
+extern size_t h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf,
+ size_t in_buf_len, int expand_data);
+extern void h5str_array_free(char **strs, size_t len);
+extern int h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order);
+extern int h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
+extern int h5str_dump_region_points_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
+
+extern htri_t H5Tdetect_variable_str(hid_t tid);
/*
* Symbols used to format the output of h5str_sprintf and
* to interpret the input to h5str_convert.
*/
#define H5_COMPOUND_BEGIN_INDICATOR "{"
-#define H5_COMPOUND_END_INDICATOR "}"
-#define H5_ARRAY_BEGIN_INDICATOR "["
-#define H5_ARRAY_END_INDICATOR "]"
-#define H5_VLEN_BEGIN_INDICATOR "("
-#define H5_VLEN_END_INDICATOR ")"
+#define H5_COMPOUND_END_INDICATOR "}"
+#define H5_ARRAY_BEGIN_INDICATOR "["
+#define H5_ARRAY_END_INDICATOR "]"
+#define H5_VLEN_BEGIN_INDICATOR "("
+#define H5_VLEN_END_INDICATOR ")"
/*
* Class: hdf_hdf5lib_H5
* Method: H5AreadComplex
* Signature: (JJ[Ljava/lang/String;)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5AreadComplex
- (JNIEnv *, jclass, jlong, jlong, jobjectArray);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5AreadComplex(JNIEnv *, jclass, jlong, jlong, jobjectArray);
/*
* Copies the content of one dataset to another dataset
@@ -75,9 +75,7 @@ Java_hdf_hdf5lib_H5_H5AreadComplex
* Method: H5Acopy
* Signature: (JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Acopy
- (JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Acopy(JNIEnv *, jclass, jlong, jlong);
/*
* Copies the content of one dataset to another dataset
@@ -85,35 +83,33 @@ Java_hdf_hdf5lib_H5_H5Acopy
* Method: H5Dcopy
* Signature: (JJ)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dcopy
- (JNIEnv*, jclass, jlong, jlong);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dcopy(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Gget_obj_info_full
* Signature: (JLjava/lang/String;[Ljava/lang/String;[I[I[J[JIII)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full
- (JNIEnv*, jclass, jlong, jstring, jobjectArray, jintArray, jintArray, jlongArray, jobjectArray, jint, jint, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full(JNIEnv *, jclass, jlong, jstring,
+ jobjectArray, jintArray, jintArray,
+ jlongArray, jobjectArray, jint, jint,
+ jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Gget_obj_info_max
* Signature: (J[Ljava/lang/String;[I[I[JJI)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max
- (JNIEnv*, jclass, jlong, jobjectArray, jintArray, jintArray, jlongArray, jlong, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max(JNIEnv *, jclass, jlong, jobjectArray,
+ jintArray, jintArray, jlongArray, jlong,
+ jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5export_dataset
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5export_1dataset
- (JNIEnv*, jclass, jstring, jstring, jstring, jint);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *, jclass, jstring, jstring, jstring,
+ jint);
-#endif /* H5UTIL_H__ */
+#endif /* H5UTIL_H__ */
diff --git a/java/src/jni/h5vlImp.c b/java/src/jni/h5vlImp.c
index 1ead30b..1460e5d 100644
--- a/java/src/jni/h5vlImp.c
+++ b/java/src/jni/h5vlImp.c
@@ -33,18 +33,19 @@ extern "C" {
* Signature: (Ljava/lang/String;J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name
- (JNIEnv *env, jclass clss, jobject connector_name, jlong vipl_id)
+Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name(JNIEnv *env, jclass clss, jobject connector_name,
+ jlong vipl_id)
{
const char *volName = NULL;
- hid_t status = H5I_INVALID_HID;
+ hid_t status = H5I_INVALID_HID;
UNUSED(clss);
if (NULL == connector_name)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLregister_connector_by_name: VOL connector name is NULL");
- PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLregister_connector_by_name: VOL connector name not pinned");
+ PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL,
+ "H5VLregister_connector_by_name: VOL connector name not pinned");
if ((status = H5VLregister_connector_by_name(volName, (hid_t)vipl_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -62,8 +63,8 @@ done:
* Signature: (IJ)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value
- (JNIEnv *env, jclass clss, jint connector_value, jlong vipl_id)
+Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value(JNIEnv *env, jclass clss, jint connector_value,
+ jlong vipl_id)
{
hid_t status = H5I_INVALID_HID;
@@ -82,18 +83,18 @@ done:
* Signature: (Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1name
- (JNIEnv *env, jclass clss, jobject connector_name)
+Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1name(JNIEnv *env, jclass clss, jobject connector_name)
{
const char *volName = NULL;
- htri_t bval = JNI_FALSE;
+ htri_t bval = JNI_FALSE;
UNUSED(clss);
if (NULL == connector_name)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLis_connector_registered_by_name: VOL connector name is NULL");
- PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLis_connector_registered_by_name: VOL connector name not pinned");
+ PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL,
+ "H5VLis_connector_registered_by_name: VOL connector name not pinned");
if ((bval = H5VLis_connector_registered_by_name(volName)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -113,8 +114,7 @@ done:
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1value
- (JNIEnv *env, jclass clss, jint connector_value)
+Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1value(JNIEnv *env, jclass clss, jint connector_value)
{
htri_t bval = JNI_FALSE;
@@ -138,8 +138,7 @@ done:
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5VLget_1connector_1id
- (JNIEnv *env, jclass clss, jlong obj_id)
+Java_hdf_hdf5lib_H5_H5VLget_1connector_1id(JNIEnv *env, jclass clss, jlong obj_id)
{
hid_t status = H5I_INVALID_HID;
@@ -158,18 +157,18 @@ done:
* Signature: (Ljava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1name
- (JNIEnv *env, jclass clss, jobject connector_name)
+Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1name(JNIEnv *env, jclass clss, jobject connector_name)
{
const char *volName = NULL;
- hid_t status = H5I_INVALID_HID;
+ hid_t status = H5I_INVALID_HID;
UNUSED(clss);
if (NULL == connector_name)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLget_connector_id_by_name: VOL connector name is NULL");
- PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLget_connector_id_by_name: VOL connector name not pinned");
+ PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL,
+ "H5VLget_connector_id_by_name: VOL connector name not pinned");
if ((status = H5VLget_connector_id_by_name(volName)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -187,8 +186,7 @@ done:
* Signature: (I)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1value
- (JNIEnv *env, jclass clss, jint connector_value)
+Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1value(JNIEnv *env, jclass clss, jint connector_value)
{
hid_t status = H5I_INVALID_HID;
@@ -211,12 +209,11 @@ done:
*/
JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5VLget_1connector_1name
- (JNIEnv *env, jclass clss, jlong object_id)
+Java_hdf_hdf5lib_H5_H5VLget_1connector_1name(JNIEnv *env, jclass clss, jlong object_id)
{
- ssize_t buf_size, status;
- char *volName = NULL;
- jstring str = NULL;
+ ssize_t buf_size, status;
+ char * volName = NULL;
+ jstring str = NULL;
UNUSED(clss);
@@ -225,8 +222,9 @@ Java_hdf_hdf5lib_H5_H5VLget_1connector_1name
H5_LIBRARY_ERROR(ENVONLY);
if (buf_size > 0) {
- if (NULL == (volName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
- H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5VLget_connector_name: failed to allocated VOL connector name buffer");
+ if (NULL == (volName = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY,
+ "H5VLget_connector_name: failed to allocated VOL connector name buffer");
if ((status = H5VLget_connector_name((hid_t)object_id, volName, (size_t)buf_size + 1)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
@@ -249,8 +247,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5VLclose
- (JNIEnv *env, jclass clss, jlong connector_id)
+Java_hdf_hdf5lib_H5_H5VLclose(JNIEnv *env, jclass clss, jlong connector_id)
{
herr_t retValue = FAIL;
@@ -269,8 +266,7 @@ done:
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5VLunregister_1connector
- (JNIEnv *env, jclass clss, jlong connector_id)
+Java_hdf_hdf5lib_H5_H5VLunregister_1connector(JNIEnv *env, jclass clss, jlong connector_id)
{
herr_t retValue = FAIL;
@@ -283,7 +279,6 @@ done:
return;
} /* end Java_hdf_hdf5lib_H5_H5VLunregister_1connector */
-
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/h5vlImp.h b/java/src/jni/h5vlImp.h
index a58abef..4fbf577 100644
--- a/java/src/jni/h5vlImp.h
+++ b/java/src/jni/h5vlImp.h
@@ -25,63 +25,52 @@ extern "C" {
* Method: H5VLregister_connector_by_name
* Signature: (Ljava/lang/String;J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name
- (JNIEnv *, jclass, jobject, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name(JNIEnv *, jclass, jobject,
+ jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLregister_connector_by_value
* Signature: (IJ)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value
- (JNIEnv *, jclass, jint, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value(JNIEnv *, jclass, jint, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLis_connector_registered_by_name
* Signature: (Ljava/lang/String;)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1name
- (JNIEnv *, jclass, jobject);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1name(JNIEnv *, jclass,
+ jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLis_connector_registered_by_value
* Signature: (I)Z
*/
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1value
- (JNIEnv *, jclass, jint);
+JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1value(JNIEnv *, jclass,
+ jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLget_connector_id
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5VLget_1connector_1id
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5VLget_1connector_1id(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLget_connector_id_by_name
* Signature: (Ljava/lang/String;)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1name
- (JNIEnv *, jclass, jobject);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1name(JNIEnv *, jclass, jobject);
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLget_connector_id_by_value
* Signature: (I)J
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1value
- (JNIEnv *, jclass, jint);
+JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1value(JNIEnv *, jclass, jint);
/*
* Class: hdf_hdf5lib_H5
@@ -89,27 +78,21 @@ Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1value
* Signature: (J)Ljava/lang/String;
*/
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5VLget_1connector_1name
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5VLget_1connector_1name(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLclose
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5VLclose
- (JNIEnv *, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5VLclose(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5VLunregister_connector
* Signature: (J)V
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5VLunregister_1connector
- (JNIEnv *, jclass, jlong);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5VLunregister_1connector(JNIEnv *, jclass, jlong);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5zImp.c b/java/src/jni/h5zImp.c
index a1c8517..5d9f442 100644
--- a/java/src/jni/h5zImp.c
+++ b/java/src/jni/h5zImp.c
@@ -33,8 +33,7 @@ extern "C" {
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Zunregister
- (JNIEnv *env, jclass clss, jint filter)
+Java_hdf_hdf5lib_H5_H5Zunregister(JNIEnv *env, jclass clss, jint filter)
{
herr_t retVal = FAIL;
@@ -53,8 +52,7 @@ done:
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Zfilter_1avail
- (JNIEnv *env, jclass clss, jint filter)
+Java_hdf_hdf5lib_H5_H5Zfilter_1avail(JNIEnv *env, jclass clss, jint filter)
{
herr_t retVal = FAIL;
@@ -74,21 +72,19 @@ done:
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Zget_1filter_1info
- (JNIEnv *env, jclass clss, jint filter)
+Java_hdf_hdf5lib_H5_H5Zget_1filter_1info(JNIEnv *env, jclass clss, jint filter)
{
unsigned int flags = 0;
UNUSED(clss);
- if (H5Zget_filter_info((H5Z_filter_t) filter, (unsigned *) &flags) < 0)
+ if (H5Zget_filter_info((H5Z_filter_t)filter, (unsigned *)&flags) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
return (jint)flags;
} /* end Java_hdf_hdf5lib_H5_H5Zget_1filter_1info */
-
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/h5zImp.h b/java/src/jni/h5zImp.h
index bffe9d8..58b088b 100644
--- a/java/src/jni/h5zImp.h
+++ b/java/src/jni/h5zImp.h
@@ -26,18 +26,14 @@ extern "C" {
* Method: H5Zunregister
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Zunregister
- (JNIEnv *, jclass, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Zunregister(JNIEnv *, jclass, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Zfilter_avail
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Zfilter_1avail
- (JNIEnv *, jclass, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Zfilter_1avail(JNIEnv *, jclass, jint);
/*
* Class: hdf_hdf5lib_H5
@@ -45,9 +41,7 @@ Java_hdf_hdf5lib_H5_H5Zfilter_1avail
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Zget_1filter_1info
- (JNIEnv *, jclass, jint);
+JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Zget_1filter_1info(JNIEnv *, jclass, jint);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/nativeData.c b/java/src/jni/nativeData.c
index 3c3d3d5..d2f00ec 100644
--- a/java/src/jni/nativeData.c
+++ b/java/src/jni/nativeData.c
@@ -44,21 +44,20 @@ extern "C" {
#include "h5jni.h"
#include "nativeData.h"
-
/* returns int [] */
JNIEXPORT jintArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B
- (JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
+Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B(JNIEnv *env, jclass clss,
+ jbyteArray bdata) /* IN: array of bytes */
{
- jintArray rarray = NULL;
- jboolean bb;
- jbyte *barr = NULL;
- jint *iarray = NULL;
- jint *iap = NULL;
- char *bp = NULL;
- int blen;
- int ii;
- int len;
+ jintArray rarray = NULL;
+ jboolean bb;
+ jbyte * barr = NULL;
+ jint * iarray = NULL;
+ jint * iap = NULL;
+ char * bp = NULL;
+ int blen;
+ int ii;
+ int len;
UNUSED(clss);
@@ -79,7 +78,7 @@ Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B
PIN_INT_ARRAY(ENVONLY, rarray, iarray, &bb, "byteToInt: int array not pinned");
- bp = (char *)barr;
+ bp = (char *)barr;
iap = iarray;
for (ii = 0; ii < len; ii++) {
*iap = *(jint *)bp;
@@ -98,18 +97,18 @@ done:
/* returns float [] */
JNIEXPORT jfloatArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B
- (JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
+Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B(JNIEnv *env, jclass clss,
+ jbyteArray bdata) /* IN: array of bytes */
{
- jfloatArray rarray = NULL;
- jboolean bb;
- jfloat *farray = NULL;
- jfloat *iap = NULL;
- jbyte *barr = NULL;
- char *bp = NULL;
- int blen;
- int ii;
- int len;
+ jfloatArray rarray = NULL;
+ jboolean bb;
+ jfloat * farray = NULL;
+ jfloat * iap = NULL;
+ jbyte * barr = NULL;
+ char * bp = NULL;
+ int blen;
+ int ii;
+ int len;
UNUSED(clss);
@@ -130,7 +129,7 @@ Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B
PIN_FLOAT_ARRAY(ENVONLY, rarray, farray, &bb, "byteToFloat: float array not pinned");
- bp = (char *)barr;
+ bp = (char *)barr;
iap = farray;
for (ii = 0; ii < len; ii++) {
*iap = *(jfloat *)bp;
@@ -149,18 +148,18 @@ done:
/* returns short [] */
JNIEXPORT jshortArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B
- (JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
+Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B(JNIEnv *env, jclass clss,
+ jbyteArray bdata) /* IN: array of bytes */
{
- jshortArray rarray = NULL;
- jboolean bb;
- jshort *sarray = NULL;
- jshort *iap = NULL;
- jbyte *barr = NULL;
- char *bp = NULL;
- int blen;
- int ii;
- int len;
+ jshortArray rarray = NULL;
+ jboolean bb;
+ jshort * sarray = NULL;
+ jshort * iap = NULL;
+ jbyte * barr = NULL;
+ char * bp = NULL;
+ int blen;
+ int ii;
+ int len;
UNUSED(clss);
@@ -181,7 +180,7 @@ Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B
PIN_SHORT_ARRAY(ENVONLY, rarray, sarray, &bb, "byteToShort: short array not pinned");
- bp = (char *)barr;
+ bp = (char *)barr;
iap = sarray;
for (ii = 0; ii < len; ii++) {
*iap = *(jshort *)bp;
@@ -200,18 +199,18 @@ done:
/* returns long [] */
JNIEXPORT jlongArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B
- (JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
+Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B(JNIEnv *env, jclass clss,
+ jbyteArray bdata) /* IN: array of bytes */
{
- jlongArray rarray = NULL;
- jboolean bb;
- jlong *larray = NULL;
- jlong *iap = NULL;
- jbyte *barr = NULL;
- char *bp = NULL;
- int blen;
- int ii;
- int len;
+ jlongArray rarray = NULL;
+ jboolean bb;
+ jlong * larray = NULL;
+ jlong * iap = NULL;
+ jbyte * barr = NULL;
+ char * bp = NULL;
+ int blen;
+ int ii;
+ int len;
UNUSED(clss);
@@ -232,7 +231,7 @@ Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B
PIN_LONG_ARRAY(ENVONLY, rarray, larray, &bb, "byteToLong: long array not pinned");
- bp = (char *)barr;
+ bp = (char *)barr;
iap = larray;
for (ii = 0; ii < len; ii++) {
*iap = *(jlong *)bp;
@@ -251,18 +250,18 @@ done:
/* returns double [] */
JNIEXPORT jdoubleArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B
- (JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
+Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B(JNIEnv *env, jclass clss,
+ jbyteArray bdata) /* IN: array of bytes */
{
- jdoubleArray rarray = NULL;
- jboolean bb;
- jdouble *darray = NULL;
- jdouble *iap = NULL;
- jbyte *barr = NULL;
- char *bp = NULL;
- int blen;
- int ii;
- int len;
+ jdoubleArray rarray = NULL;
+ jboolean bb;
+ jdouble * darray = NULL;
+ jdouble * iap = NULL;
+ jbyte * barr = NULL;
+ char * bp = NULL;
+ int blen;
+ int ii;
+ int len;
UNUSED(clss);
@@ -283,7 +282,7 @@ Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B
PIN_DOUBLE_ARRAY(ENVONLY, rarray, darray, &bb, "byteToDouble: double array not pinned");
- bp = (char *)barr;
+ bp = (char *)barr;
iap = darray;
for (ii = 0; ii < len; ii++) {
*iap = *(jdouble *)bp;
@@ -302,17 +301,17 @@ done:
/* returns int [] */
JNIEXPORT jintArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B
- (JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
+Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B(JNIEnv *env, jclass clss, jint start, jint len,
+ jbyteArray bdata) /* IN: array of bytes */
{
- jintArray rarray = NULL;
- jboolean bb;
- jint *iarray = NULL;
- jint *iap = NULL;
- jbyte *barr = NULL;
- char *bp = NULL;
- int blen;
- int ii;
+ jintArray rarray = NULL;
+ jboolean bb;
+ jint * iarray = NULL;
+ jint * iap = NULL;
+ jbyte * barr = NULL;
+ char * bp = NULL;
+ int blen;
+ int ii;
UNUSED(clss);
@@ -354,17 +353,17 @@ done:
/* returns short [] */
JNIEXPORT jshortArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B
- (JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
+Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B(JNIEnv *env, jclass clss, jint start, jint len,
+ jbyteArray bdata) /* IN: array of bytes */
{
- jshortArray rarray = NULL;
- jboolean bb;
- jshort *sarray = NULL;
- jshort *iap = NULL;
- jbyte *barr = NULL;
- char *bp = NULL;
- int blen;
- int ii;
+ jshortArray rarray = NULL;
+ jboolean bb;
+ jshort * sarray = NULL;
+ jshort * iap = NULL;
+ jbyte * barr = NULL;
+ char * bp = NULL;
+ int blen;
+ int ii;
UNUSED(clss);
@@ -406,17 +405,17 @@ done:
/* returns float [] */
JNIEXPORT jfloatArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B
- (JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
+Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B(JNIEnv *env, jclass clss, jint start, jint len,
+ jbyteArray bdata) /* IN: array of bytes */
{
- jfloatArray rarray = NULL;
- jboolean bb;
- jfloat *farray = NULL;
- jfloat *iap = NULL;
- jbyte *barr = NULL;
- char *bp = NULL;
- int blen;
- int ii;
+ jfloatArray rarray = NULL;
+ jboolean bb;
+ jfloat * farray = NULL;
+ jfloat * iap = NULL;
+ jbyte * barr = NULL;
+ char * bp = NULL;
+ int blen;
+ int ii;
UNUSED(clss);
@@ -458,17 +457,17 @@ done:
/* returns long [] */
JNIEXPORT jlongArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B
- (JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
+Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B(JNIEnv *env, jclass clss, jint start, jint len,
+ jbyteArray bdata) /* IN: array of bytes */
{
- jlongArray rarray = NULL;
- jboolean bb;
- jlong *larray = NULL;
- jlong *iap = NULL;
- jbyte *barr = NULL;
- char *bp = NULL;
- int blen;
- int ii;
+ jlongArray rarray = NULL;
+ jboolean bb;
+ jlong * larray = NULL;
+ jlong * iap = NULL;
+ jbyte * barr = NULL;
+ char * bp = NULL;
+ int blen;
+ int ii;
UNUSED(clss);
@@ -510,17 +509,17 @@ done:
/* returns double [] */
JNIEXPORT jdoubleArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B
- (JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
+Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B(JNIEnv *env, jclass clss, jint start, jint len,
+ jbyteArray bdata) /* IN: array of bytes */
{
- jdoubleArray rarray = NULL;
- jboolean bb;
- jdouble *darray = NULL;
- jdouble *iap = NULL;
- jbyte *barr = NULL;
- char *bp = NULL;
- int blen;
- int ii;
+ jdoubleArray rarray = NULL;
+ jboolean bb;
+ jdouble * darray = NULL;
+ jdouble * iap = NULL;
+ jbyte * barr = NULL;
+ char * bp = NULL;
+ int blen;
+ int ii;
UNUSED(clss);
@@ -562,21 +561,21 @@ done:
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I
- (JNIEnv *env, jclass clss, jint start, jint len, jintArray idata) /* IN: array of int */
+Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I(JNIEnv *env, jclass clss, jint start, jint len,
+ jintArray idata) /* IN: array of int */
{
- jbyteArray rarray = NULL;
- jboolean bb;
- jbyte *barray = NULL;
- jbyte *bap = NULL;
- jint *ip = NULL;
- jint *iarr = NULL;
- int ilen;
- int blen;
- int ii;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jbyte * barray = NULL;
+ jbyte * bap = NULL;
+ jint * ip = NULL;
+ jint * iarr = NULL;
+ int ilen;
+ int blen;
+ int ii;
+ int ij;
union things {
- int ival;
+ int ival;
char bytes[4];
} u;
@@ -607,11 +606,11 @@ Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I
bap = barray;
for (ii = 0; ii < len; ii++) {
u.ival = *ip++;
- for (ij = 0; (size_t) ij < sizeof(jint); ij++) {
+ for (ij = 0; (size_t)ij < sizeof(jint); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- } /* end for */
+ } /* end for */
done:
if (barray)
@@ -624,22 +623,22 @@ done:
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S
- (JNIEnv *env, jclass clss, jint start, jint len, jshortArray sdata) /* IN: array of short */
+Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S(JNIEnv *env, jclass clss, jint start, jint len,
+ jshortArray sdata) /* IN: array of short */
{
- jbyteArray rarray = NULL;
- jboolean bb;
- jshort *ip = NULL;
- jshort *sarr = NULL;
- jbyte *barray = NULL;
- jbyte *bap = NULL;
- int ilen;
- int blen;
- int ii;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jshort * ip = NULL;
+ jshort * sarr = NULL;
+ jbyte * barray = NULL;
+ jbyte * bap = NULL;
+ int ilen;
+ int blen;
+ int ii;
+ int ij;
union things {
short ival;
- char bytes[4];
+ char bytes[4];
} u;
UNUSED(clss);
@@ -669,11 +668,11 @@ Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S
bap = barray;
for (ii = 0; ii < len; ii++) {
u.ival = *ip++;
- for (ij = 0; (size_t) ij < sizeof(jshort); ij++) {
+ for (ij = 0; (size_t)ij < sizeof(jshort); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- } /* end for */
+ } /* end for */
done:
if (barray)
@@ -686,22 +685,22 @@ done:
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F
- (JNIEnv *env, jclass clss, jint start, jint len, jfloatArray fdata) /* IN: array of float */
+Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F(JNIEnv *env, jclass clss, jint start, jint len,
+ jfloatArray fdata) /* IN: array of float */
{
- jbyteArray rarray = NULL;
- jboolean bb;
- jfloat *ip = NULL;
- jfloat *farr = NULL;
- jbyte *barray = NULL;
- jbyte *bap = NULL;
- int ilen;
- int blen;
- int ii;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jfloat * ip = NULL;
+ jfloat * farr = NULL;
+ jbyte * barray = NULL;
+ jbyte * bap = NULL;
+ int ilen;
+ int blen;
+ int ii;
+ int ij;
union things {
float ival;
- char bytes[4];
+ char bytes[4];
} u;
UNUSED(clss);
@@ -731,11 +730,11 @@ Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F
bap = barray;
for (ii = 0; ii < len; ii++) {
u.ival = *ip++;
- for (ij = 0; (size_t) ij < sizeof(jfloat); ij++) {
+ for (ij = 0; (size_t)ij < sizeof(jfloat); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- } /* end for */
+ } /* end for */
done:
if (barray)
@@ -748,22 +747,22 @@ done:
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D
- (JNIEnv *env, jclass clss, jint start, jint len, jdoubleArray ddata) /* IN: array of double */
+Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D(JNIEnv *env, jclass clss, jint start, jint len,
+ jdoubleArray ddata) /* IN: array of double */
{
- jbyteArray rarray = NULL;
- jboolean bb;
- jdouble *ip = NULL;
- jdouble *darr = NULL;
- jbyte *barray = NULL;
- jbyte *bap = NULL;
- int ilen;
- int blen;
- int ii;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jdouble * ip = NULL;
+ jdouble * darr = NULL;
+ jbyte * barray = NULL;
+ jbyte * bap = NULL;
+ int ilen;
+ int blen;
+ int ii;
+ int ij;
union things {
double ival;
- char bytes[8];
+ char bytes[8];
} u;
UNUSED(clss);
@@ -793,11 +792,11 @@ Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D
bap = barray;
for (ii = 0; ii < len; ii++) {
u.ival = *ip++;
- for (ij = 0; (size_t) ij < sizeof(jdouble); ij++) {
+ for (ij = 0; (size_t)ij < sizeof(jdouble); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- } /* end for */
+ } /* end for */
done:
if (barray)
@@ -810,22 +809,22 @@ done:
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J
- (JNIEnv *env, jclass clss, jint start, jint len, jlongArray ldata) /* IN: array of long */
+Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J(JNIEnv *env, jclass clss, jint start, jint len,
+ jlongArray ldata) /* IN: array of long */
{
- jbyteArray rarray = NULL;
- jboolean bb;
- jlong *ip = NULL;
- jlong *larr = NULL;
- jbyte *barray = NULL;
- jbyte *bap = NULL;
- int ilen;
- int blen;
- int ii;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jlong * ip = NULL;
+ jlong * larr = NULL;
+ jbyte * barray = NULL;
+ jbyte * bap = NULL;
+ int ilen;
+ int blen;
+ int ii;
+ int ij;
union things {
jlong ival;
- char bytes[8];
+ char bytes[8];
} u;
UNUSED(clss);
@@ -855,11 +854,11 @@ Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J
bap = barray;
for (ii = 0; ii < len; ii++) {
u.ival = *ip++;
- for (ij = 0; (size_t) ij < sizeof(jlong); ij++) {
+ for (ij = 0; (size_t)ij < sizeof(jlong); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- } /* end for */
+ } /* end for */
done:
if (barray)
@@ -872,16 +871,15 @@ done:
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_intToByte__I
- (JNIEnv *env, jclass clss, jint idata) /* IN: int */
+Java_hdf_hdf5lib_HDFNativeData_intToByte__I(JNIEnv *env, jclass clss, jint idata) /* IN: int */
{
- jbyteArray rarray = NULL;
- jboolean bb;
- jbyte *barray = NULL;
- jbyte *bap = NULL;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jbyte * barray = NULL;
+ jbyte * bap = NULL;
+ int ij;
union things {
- int ival;
+ int ival;
char bytes[sizeof(int)];
} u;
@@ -892,9 +890,9 @@ Java_hdf_hdf5lib_HDFNativeData_intToByte__I
PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "intToByte: byte array not pinned");
- bap = barray;
+ bap = barray;
u.ival = idata;
- for (ij = 0; (size_t) ij < sizeof(jint); ij++) {
+ for (ij = 0; (size_t)ij < sizeof(jint); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
@@ -908,17 +906,16 @@ done:
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_floatToByte__F
- (JNIEnv *env, jclass clss, jfloat fdata) /* IN: float */
+Java_hdf_hdf5lib_HDFNativeData_floatToByte__F(JNIEnv *env, jclass clss, jfloat fdata) /* IN: float */
{
- jbyteArray rarray = NULL;
- jboolean bb;
- jbyte *barray = NULL;
- jbyte *bap = NULL;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jbyte * barray = NULL;
+ jbyte * bap = NULL;
+ int ij;
union things {
float ival;
- char bytes[sizeof(float)];
+ char bytes[sizeof(float)];
} u;
UNUSED(clss);
@@ -928,9 +925,9 @@ Java_hdf_hdf5lib_HDFNativeData_floatToByte__F
PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "floatToByte: byte array not pinned");
- bap = barray;
+ bap = barray;
u.ival = fdata;
- for (ij = 0; (size_t) ij < sizeof(jfloat); ij++) {
+ for (ij = 0; (size_t)ij < sizeof(jfloat); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
@@ -944,17 +941,16 @@ done:
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_shortToByte__S
- (JNIEnv *env, jclass clss, jshort sdata) /* IN: short */
+Java_hdf_hdf5lib_HDFNativeData_shortToByte__S(JNIEnv *env, jclass clss, jshort sdata) /* IN: short */
{
- jbyteArray rarray = NULL;
- jboolean bb;
- jbyte *barray = NULL;
- jbyte *bap = NULL;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jbyte * barray = NULL;
+ jbyte * bap = NULL;
+ int ij;
union things {
short ival;
- char bytes[sizeof(short)];
+ char bytes[sizeof(short)];
} u;
UNUSED(clss);
@@ -964,9 +960,9 @@ Java_hdf_hdf5lib_HDFNativeData_shortToByte__S
PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "shortToByte: byte array not pinned");
- bap = barray;
+ bap = barray;
u.ival = sdata;
- for (ij = 0; (size_t) ij < sizeof(jshort); ij++) {
+ for (ij = 0; (size_t)ij < sizeof(jshort); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
@@ -980,17 +976,16 @@ done:
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D
- (JNIEnv *env, jclass clss, jdouble ddata) /* IN: double */
+Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D(JNIEnv *env, jclass clss, jdouble ddata) /* IN: double */
{
- jbyteArray rarray = NULL;
- jboolean bb;
- jbyte *barray = NULL;
- jbyte *bap = NULL;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jbyte * barray = NULL;
+ jbyte * bap = NULL;
+ int ij;
union things {
double ival;
- char bytes[sizeof(double)];
+ char bytes[sizeof(double)];
} u;
UNUSED(clss);
@@ -1000,9 +995,9 @@ Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D
PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "doubleToByte: byte array not pinned");
- bap = barray;
+ bap = barray;
u.ival = ddata;
- for (ij = 0; (size_t) ij < sizeof(jdouble); ij++) {
+ for (ij = 0; (size_t)ij < sizeof(jdouble); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
@@ -1016,17 +1011,16 @@ done:
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_longToByte__J
- (JNIEnv *env, jclass clss, jlong ldata) /* IN: long */
+Java_hdf_hdf5lib_HDFNativeData_longToByte__J(JNIEnv *env, jclass clss, jlong ldata) /* IN: long */
{
- jbyteArray rarray = NULL;
- jboolean bb;
- jbyte *barray = NULL;
- jbyte *bap = NULL;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jbyte * barray = NULL;
+ jbyte * bap = NULL;
+ int ij;
union things {
jlong ival;
- char bytes[sizeof(jlong)];
+ char bytes[sizeof(jlong)];
} u;
UNUSED(clss);
@@ -1036,9 +1030,9 @@ Java_hdf_hdf5lib_HDFNativeData_longToByte__J
PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "longToByte: byte array not pinned");
- bap = barray;
+ bap = barray;
u.ival = ldata;
- for (ij = 0; (size_t) ij < sizeof(jlong); ij++) {
+ for (ij = 0; (size_t)ij < sizeof(jlong); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
@@ -1052,17 +1046,16 @@ done:
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToByte__B
- (JNIEnv *env, jclass clss, jbyte bdata) /* IN: byte */
+Java_hdf_hdf5lib_HDFNativeData_byteToByte__B(JNIEnv *env, jclass clss, jbyte bdata) /* IN: byte */
{
- jbyteArray rarray = NULL;
- jboolean bb;
- jbyte *barray = NULL;
- jbyte *bap = NULL;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jbyte * barray = NULL;
+ jbyte * bap = NULL;
+ int ij;
union things {
jbyte ival;
- char bytes[sizeof(jbyte)];
+ char bytes[sizeof(jbyte)];
} u;
UNUSED(clss);
@@ -1072,9 +1065,9 @@ Java_hdf_hdf5lib_HDFNativeData_byteToByte__B
PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "byteToByte: byte array not pinned");
- bap = barray;
+ bap = barray;
u.ival = bdata;
- for (ij = 0; (size_t) ij < sizeof(jbyte); ij++) {
+ for (ij = 0; (size_t)ij < sizeof(jbyte); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
@@ -1086,7 +1079,6 @@ done:
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToByte__B */
-
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/nativeData.h b/java/src/jni/nativeData.h
index e9e1a5d..012f73e 100644
--- a/java/src/jni/nativeData.h
+++ b/java/src/jni/nativeData.h
@@ -21,111 +21,78 @@
extern "C" {
#endif /* __cplusplus */
-
/* returns int [] */
-JNIEXPORT jintArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B
-(JNIEnv *, jclass, jbyteArray);
+JNIEXPORT jintArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B(JNIEnv *, jclass, jbyteArray);
/* returns float [] */
-JNIEXPORT jfloatArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B
-(JNIEnv *, jclass, jbyteArray);
+JNIEXPORT jfloatArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B(JNIEnv *, jclass, jbyteArray);
/* returns short [] */
-JNIEXPORT jshortArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B
-(JNIEnv *, jclass, jbyteArray);
+JNIEXPORT jshortArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B(JNIEnv *, jclass, jbyteArray);
/* returns long [] */
-JNIEXPORT jlongArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B
-(JNIEnv *, jclass, jbyteArray);
+JNIEXPORT jlongArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B(JNIEnv *, jclass, jbyteArray);
/* returns double [] */
-JNIEXPORT jdoubleArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B
-(JNIEnv *, jclass, jbyteArray);
+JNIEXPORT jdoubleArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B(JNIEnv *, jclass, jbyteArray);
/* returns int [] */
-JNIEXPORT jintArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B
-(JNIEnv *, jclass, jint, jint, jbyteArray);
+JNIEXPORT jintArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B(JNIEnv *, jclass, jint, jint,
+ jbyteArray);
/* returns short [] */
-JNIEXPORT jshortArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B
-(JNIEnv *, jclass, jint, jint, jbyteArray);
+JNIEXPORT jshortArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B(JNIEnv *, jclass, jint, jint,
+ jbyteArray);
/* returns float [] */
-JNIEXPORT jfloatArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B
-(JNIEnv *, jclass, jint, jint, jbyteArray);
+JNIEXPORT jfloatArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B(JNIEnv *, jclass, jint, jint,
+ jbyteArray);
/* returns long [] */
-JNIEXPORT jlongArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B
-(JNIEnv *, jclass, jint, jint, jbyteArray);
+JNIEXPORT jlongArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B(JNIEnv *, jclass, jint, jint,
+ jbyteArray);
/* returns double [] */
-JNIEXPORT jdoubleArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B
-(JNIEnv *, jclass, jint, jint, jbyteArray);
+JNIEXPORT jdoubleArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B(JNIEnv *, jclass, jint,
+ jint, jbyteArray);
/* returns byte [] */
-JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I
-(JNIEnv *, jclass, jint, jint, jintArray);
+JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I(JNIEnv *, jclass, jint, jint,
+ jintArray);
/* returns byte [] */
-JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S
-(JNIEnv *, jclass, jint, jint, jshortArray);
+JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S(JNIEnv *, jclass, jint, jint,
+ jshortArray);
/* returns byte [] */
-JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F
-(JNIEnv *, jclass, jint, jint, jfloatArray);
+JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F(JNIEnv *, jclass, jint, jint,
+ jfloatArray);
/* returns byte [] */
-JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D
-(JNIEnv *, jclass, jint, jint, jdoubleArray);
+JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D(JNIEnv *, jclass, jint, jint,
+ jdoubleArray);
/* returns byte [] */
-JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J
-(JNIEnv *, jclass, jint, jint, jlongArray);
+JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J(JNIEnv *, jclass, jint, jint,
+ jlongArray);
/* returns byte [] */
-JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_intToByte__I
-(JNIEnv *, jclass, jint);
+JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_intToByte__I(JNIEnv *, jclass, jint);
/* returns byte [] */
-JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_floatToByte__F
-(JNIEnv *, jclass, jfloat);
+JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_floatToByte__F(JNIEnv *, jclass, jfloat);
/* returns byte [] */
-JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_shortToByte__S
-(JNIEnv *, jclass, jshort);
+JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_shortToByte__S(JNIEnv *, jclass, jshort);
/* returns byte [] */
-JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D
-(JNIEnv *env, jclass, jdouble);
+JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D(JNIEnv *env, jclass, jdouble);
/* returns byte [] */
-JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_longToByte__J
-(JNIEnv *, jclass, jlong);
+JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_longToByte__J(JNIEnv *, jclass, jlong);
/* returns byte [] */
-JNIEXPORT jbyteArray JNICALL
-Java_hdf_hdf5lib_HDFNativeData_byteToByte__B
-(JNIEnv *, jclass, jbyte);
+JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToByte__B(JNIEnv *, jclass, jbyte);
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/src/H5.c b/src/H5.c
index 4e5648a..e7514b4 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -15,42 +15,38 @@
/* Module Setup */
/****************/
-
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5FSprivate.h" /* File free space */
-#include "H5Lprivate.h" /* Links */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5SLprivate.h" /* Skip lists */
-#include "H5Tprivate.h" /* Datatypes */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5FSprivate.h" /* File free space */
+#include "H5Lprivate.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5SLprivate.h" /* Skip lists */
+#include "H5Tprivate.h" /* Datatypes */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-static void H5__debug_mask(const char*);
+static void H5__debug_mask(const char *);
#ifdef H5_HAVE_PARALLEL
static int H5__mpi_delete_cb(MPI_Comm comm, int keyval, void *attr_val, int *flag);
#endif /*H5_HAVE_PARALLEL*/
@@ -59,7 +55,6 @@ static int H5__mpi_delete_cb(MPI_Comm comm, int keyval, void *attr_val, int *fla
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -73,24 +68,22 @@ hbool_t H5_api_entered_g = FALSE;
#ifdef H5_HAVE_THREADSAFE
H5_api_t H5_g;
#else
-hbool_t H5_libinit_g = FALSE; /* Library hasn't been initialized */
-hbool_t H5_libterm_g = FALSE; /* Library isn't being shutdown */
+hbool_t H5_libinit_g = FALSE; /* Library hasn't been initialized */
+hbool_t H5_libterm_g = FALSE; /* Library isn't being shutdown */
#endif
#ifdef H5_HAVE_MPE
-hbool_t H5_MPEinit_g = FALSE; /* MPE Library hasn't been initialized */
+hbool_t H5_MPEinit_g = FALSE; /* MPE Library hasn't been initialized */
#endif
-char H5_lib_vers_info_g[] = H5_VERS_INFO;
-static hbool_t H5_dont_atexit_g = FALSE;
-H5_debug_t H5_debug_g; /* debugging info */
-
+char H5_lib_vers_info_g[] = H5_VERS_INFO;
+static hbool_t H5_dont_atexit_g = FALSE;
+H5_debug_t H5_debug_g; /* debugging info */
/*******************/
/* Local Variables */
/*******************/
-
/*--------------------------------------------------------------------------
* NAME
* H5_init_library -- Initialize library-global information
@@ -114,12 +107,12 @@ H5_init_library(void)
#ifdef H5_HAVE_PARALLEL
{
- int mpi_initialized;
- int mpi_finalized;
+ int mpi_initialized;
+ int mpi_finalized;
int mpi_code;
- MPI_Initialized(&mpi_initialized);
- MPI_Finalized(&mpi_finalized);
+ MPI_Initialized(&mpi_initialized);
+ MPI_Finalized(&mpi_finalized);
#ifdef H5_HAVE_MPE
/* Initialize MPE instrumentation library. */
@@ -127,7 +120,7 @@ H5_init_library(void)
int mpe_code;
if (mpi_initialized && !mpi_finalized) {
mpe_code = MPE_Init_log();
- HDassert(mpe_code >=0);
+ HDassert(mpe_code >= 0);
H5_MPEinit_g = TRUE;
}
}
@@ -138,15 +131,15 @@ H5_init_library(void)
if (mpi_initialized && !mpi_finalized) {
int key_val;
- if(MPI_SUCCESS != (mpi_code = MPI_Comm_create_keyval(MPI_COMM_NULL_COPY_FN,
- (MPI_Comm_delete_attr_function *)H5__mpi_delete_cb,
- &key_val, NULL)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_create_keyval(
+ MPI_COMM_NULL_COPY_FN, (MPI_Comm_delete_attr_function *)H5__mpi_delete_cb,
+ &key_val, NULL)))
HMPI_GOTO_ERROR(FAIL, "MPI_Comm_create_keyval failed", mpi_code)
- if(MPI_SUCCESS != (mpi_code = MPI_Comm_set_attr(MPI_COMM_SELF, key_val, NULL)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_set_attr(MPI_COMM_SELF, key_val, NULL)))
HMPI_GOTO_ERROR(FAIL, "MPI_Comm_set_attr failed", mpi_code)
- if(MPI_SUCCESS != (mpi_code = MPI_Comm_free_keyval(&key_val)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_free_keyval(&key_val)))
HMPI_GOTO_ERROR(FAIL, "MPI_Comm_free_keyval failed", mpi_code)
}
}
@@ -156,26 +149,26 @@ H5_init_library(void)
* Make sure the package information is updated.
*/
HDmemset(&H5_debug_g, 0, sizeof H5_debug_g);
- H5_debug_g.pkg[H5_PKG_A].name = "a";
+ H5_debug_g.pkg[H5_PKG_A].name = "a";
H5_debug_g.pkg[H5_PKG_AC].name = "ac";
- H5_debug_g.pkg[H5_PKG_B].name = "b";
- H5_debug_g.pkg[H5_PKG_D].name = "d";
- H5_debug_g.pkg[H5_PKG_E].name = "e";
- H5_debug_g.pkg[H5_PKG_F].name = "f";
- H5_debug_g.pkg[H5_PKG_G].name = "g";
+ H5_debug_g.pkg[H5_PKG_B].name = "b";
+ H5_debug_g.pkg[H5_PKG_D].name = "d";
+ H5_debug_g.pkg[H5_PKG_E].name = "e";
+ H5_debug_g.pkg[H5_PKG_F].name = "f";
+ H5_debug_g.pkg[H5_PKG_G].name = "g";
H5_debug_g.pkg[H5_PKG_HG].name = "hg";
H5_debug_g.pkg[H5_PKG_HL].name = "hl";
- H5_debug_g.pkg[H5_PKG_I].name = "i";
- H5_debug_g.pkg[H5_PKG_M].name = "m";
+ H5_debug_g.pkg[H5_PKG_I].name = "i";
+ H5_debug_g.pkg[H5_PKG_M].name = "m";
H5_debug_g.pkg[H5_PKG_MF].name = "mf";
H5_debug_g.pkg[H5_PKG_MM].name = "mm";
- H5_debug_g.pkg[H5_PKG_O].name = "o";
- H5_debug_g.pkg[H5_PKG_P].name = "p";
- H5_debug_g.pkg[H5_PKG_S].name = "s";
- H5_debug_g.pkg[H5_PKG_T].name = "t";
- H5_debug_g.pkg[H5_PKG_V].name = "v";
+ H5_debug_g.pkg[H5_PKG_O].name = "o";
+ H5_debug_g.pkg[H5_PKG_P].name = "p";
+ H5_debug_g.pkg[H5_PKG_S].name = "s";
+ H5_debug_g.pkg[H5_PKG_T].name = "t";
+ H5_debug_g.pkg[H5_PKG_V].name = "v";
H5_debug_g.pkg[H5_PKG_VL].name = "vl";
- H5_debug_g.pkg[H5_PKG_Z].name = "z";
+ H5_debug_g.pkg[H5_PKG_Z].name = "z";
/*
* Install atexit() library cleanup routines unless the H5dont_atexit()
@@ -190,7 +183,7 @@ H5_init_library(void)
* This must be entered before the library cleanup code so it's
* executed in LIFO order (i.e., last).
*/
- (void)HDatexit(H5TS_win32_process_exit);
+ (void)HDatexit(H5TS_win32_process_exit);
#endif /* H5_HAVE_THREADSAFE && H5_HAVE_WIN_THREADS */
/* Normal library termination code */
@@ -213,21 +206,21 @@ H5_init_library(void)
* When the application does not close the file, routines in the module might
* be called via H5_term_library() when shutting down the file.
*/
- if(H5E_init() < 0)
+ if (H5E_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize error interface")
- if(H5VL_init_phase1() < 0)
+ if (H5VL_init_phase1() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize vol interface")
- if(H5P_init() < 0)
+ if (H5P_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize property list interface")
- if(H5AC_init() < 0)
+ if (H5AC_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize metadata caching interface")
- if(H5L_init() < 0)
+ if (H5L_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize link interface")
- if(H5FS_init() < 0)
+ if (H5FS_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize FS interface")
/* Finish initializing interfaces that depend on the interfaces above */
- if(H5VL_init_phase2() < 0)
+ if (H5VL_init_phase2() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize vol interface")
/* Debugging? */
@@ -238,7 +231,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5_init_library() */
-
/*-------------------------------------------------------------------------
* Function: H5_term_library
*
@@ -253,9 +245,9 @@ done:
void
H5_term_library(void)
{
- int pending, ntries = 0, n;
- size_t at = 0;
- char loop[1024];
+ int pending, ntries = 0, n;
+ size_t at = 0;
+ char loop[1024];
H5E_auto2_t func;
#ifdef H5_HAVE_THREADSAFE
@@ -265,7 +257,7 @@ H5_term_library(void)
#endif
/* Don't do anything if the library is already closed */
- if(!(H5_INIT_GLOBAL))
+ if (!(H5_INIT_GLOBAL))
goto done;
/* Indicate that the library is being shut down */
@@ -282,15 +274,11 @@ H5_term_library(void)
* value if they do something that might affect some other interface in a
* way that would necessitate some cleanup work in the other interface.
*/
-#define DOWN(F) \
- (((n = H5##F##_term_package()) && (at + 8) < sizeof loop)? \
- (HDsprintf(loop + at, "%s%s", (at ? "," : ""), #F), \
- at += HDstrlen(loop + at), \
- n): \
- ((n > 0 && (at + 5) < sizeof loop) ? \
- (HDsprintf(loop + at, "..."), \
- at += HDstrlen(loop + at), \
- n) : n))
+#define DOWN(F) \
+ (((n = H5##F##_term_package()) && (at + 8) < sizeof loop) \
+ ? (HDsprintf(loop + at, "%s%s", (at ? "," : ""), #F), at += HDstrlen(loop + at), n) \
+ : ((n > 0 && (at + 5) < sizeof loop) ? (HDsprintf(loop + at, "..."), at += HDstrlen(loop + at), n) \
+ : n))
do {
pending = 0;
@@ -315,19 +303,19 @@ H5_term_library(void)
pending += DOWN(T_top);
/* Don't shut down the file code until objects in files are shut down */
- if(pending == 0)
+ if (pending == 0)
pending += DOWN(F);
/* Don't shut down the property list code until all objects that might
* use property lists are shut down */
- if(pending == 0)
+ if (pending == 0)
pending += DOWN(P);
/* Wait to shut down the "bottom" of various interfaces until the
* files are closed, so pieces of the file can be serialized
* correctly.
*/
- if(pending == 0) {
+ if (pending == 0) {
/* Shut down the "bottom" of the attribute, dataset, group,
* reference, dataspace, and datatype interfaces, fully closing
* out the interfaces now.
@@ -346,48 +334,48 @@ H5_term_library(void)
* from being closed "out from underneath" of the high-level objects
* that depend on them. -QAK
*/
- if(pending == 0) {
+ if (pending == 0) {
pending += DOWN(AC);
pending += DOWN(Z);
pending += DOWN(FD);
pending += DOWN(VL);
/* Don't shut down the plugin code until all "pluggable" interfaces (Z, FD, PL) are shut down */
- if(pending == 0)
+ if (pending == 0)
pending += DOWN(PL);
/* Don't shut down the error code until other APIs which use it are shut down */
- if(pending == 0)
+ if (pending == 0)
pending += DOWN(E);
/* Don't shut down the ID code until other APIs which use them are shut down */
- if(pending == 0)
+ if (pending == 0)
pending += DOWN(I);
/* Don't shut down the skip list code until everything that uses it is down */
- if(pending == 0)
+ if (pending == 0)
pending += DOWN(SL);
/* Don't shut down the free list code until everything that uses it is down */
- if(pending == 0)
+ if (pending == 0)
pending += DOWN(FL);
/* Don't shut down the API context code until _everything_ else is down */
- if(pending == 0)
+ if (pending == 0)
pending += DOWN(CX);
} /* end if */
- } while(pending && ntries++ < 100);
+ } while (pending && ntries++ < 100);
- if(pending) {
+ if (pending) {
/* Only display the error message if the user is interested in them. */
- if(func) {
+ if (func) {
HDfprintf(stderr, "HDF5: infinite loop closing library\n");
HDfprintf(stderr, " %s\n", loop);
#ifndef NDEBUG
HDabort();
-#endif /* NDEBUG */
+#endif /* NDEBUG */
} /* end if */
- } /* end if */
+ } /* end if */
#ifdef H5_HAVE_MPE
/* Close MPE instrumentation library. May need to move this
* down if any of the below code involves using the instrumentation code.
*/
- if(H5_MPEinit_g) {
+ if (H5_MPEinit_g) {
int mpi_initialized;
int mpi_finalized;
int mpe_code;
@@ -397,15 +385,15 @@ H5_term_library(void)
if (mpi_initialized && !mpi_finalized) {
mpe_code = MPE_Finish_log("h5log");
- HDassert(mpe_code >=0);
- } /* end if */
- H5_MPEinit_g = FALSE; /* turn it off no matter what */
- } /* end if */
+ HDassert(mpe_code >= 0);
+ } /* end if */
+ H5_MPEinit_g = FALSE; /* turn it off no matter what */
+ } /* end if */
#endif
/* Free open debugging streams */
- while(H5_debug_g.open_stream) {
- H5_debug_open_stream_t *tmp_open_stream;
+ while (H5_debug_g.open_stream) {
+ H5_debug_open_stream_t *tmp_open_stream;
tmp_open_stream = H5_debug_g.open_stream;
(void)HDfclose(H5_debug_g.open_stream->stream);
@@ -434,7 +422,6 @@ done:
return;
} /* end H5_term_library() */
-
/*-------------------------------------------------------------------------
* Function: H5dont_atexit
*
@@ -458,12 +445,12 @@ done:
herr_t
H5dont_atexit(void)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT_NOERR_NOFS
- H5TRACE0("e","");
+ H5TRACE0("e", "");
- if(H5_dont_atexit_g)
+ if (H5_dont_atexit_g)
ret_value = FAIL;
else
H5_dont_atexit_g = TRUE;
@@ -471,7 +458,6 @@ H5dont_atexit(void)
FUNC_LEAVE_API_NOFS(ret_value)
} /* end H5dont_atexit() */
-
/*-------------------------------------------------------------------------
* Function: H5garbage_collect
*
@@ -492,20 +478,19 @@ H5dont_atexit(void)
herr_t
H5garbage_collect(void)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE0("e","");
+ H5TRACE0("e", "");
/* Call the garbage collection routines in the library */
- if(H5FL_garbage_coll()<0)
+ if (H5FL_garbage_coll() < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect objects")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5garbage_collect() */
+} /* end H5garbage_collect() */
-
/*-------------------------------------------------------------------------
* Function: H5set_free_list_limits
*
@@ -534,25 +519,24 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_lim,
- int arr_list_lim, int blk_global_lim, int blk_list_lim)
+H5set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_lim, int arr_list_lim,
+ int blk_global_lim, int blk_list_lim)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "IsIsIsIsIsIs", reg_global_lim, reg_list_lim, arr_global_lim,
- arr_list_lim, blk_global_lim, blk_list_lim);
+ H5TRACE6("e", "IsIsIsIsIsIs", reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim, blk_global_lim,
+ blk_list_lim);
/* Call the free list function to actually set the limits */
- if(H5FL_set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim,
- blk_global_lim, blk_list_lim, blk_global_lim, blk_list_lim)<0)
+ if (H5FL_set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim, blk_global_lim,
+ blk_list_lim, blk_global_lim, blk_list_lim) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "can't set garbage collection limits")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5set_free_list_limits() */
+} /* end H5set_free_list_limits() */
-
/*-------------------------------------------------------------------------
* Function: H5get_free_list_sizes
*
@@ -576,23 +560,21 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size,
- size_t *fac_size)
+H5get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, size_t *fac_size)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "*z*z*z*z", reg_size, arr_size, blk_size, fac_size);
/* Call the free list function to actually get the sizes */
- if(H5FL_get_free_list_sizes(reg_size, arr_size, blk_size, fac_size) < 0)
+ if (H5FL_get_free_list_sizes(reg_size, arr_size, blk_size, fac_size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get garbage collection sizes")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5get_free_list_sizes() */
+} /* end H5get_free_list_sizes() */
-
/*-------------------------------------------------------------------------
* Function: H5get_alloc_stats
*
@@ -620,20 +602,19 @@ done:
herr_t
H5get_alloc_stats(H5_alloc_stats_t *stats)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "*x", stats);
/* Call the internal allocation stat routine to get the values */
- if(H5MM_get_alloc_stats(stats) < 0)
+ if (H5MM_get_alloc_stats(stats) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get allocation stats")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5get_alloc_stats() */
+} /* end H5get_alloc_stats() */
-
/*-------------------------------------------------------------------------
* Function: H5__debug_mask
*
@@ -660,84 +641,92 @@ done:
static void
H5__debug_mask(const char *s)
{
- FILE *stream = stderr;
- char pkg_name[32], *rest;
- size_t i;
- hbool_t clear;
+ FILE * stream = stderr;
+ char pkg_name[32], *rest;
+ size_t i;
+ hbool_t clear;
while (s && *s) {
- if (HDisalpha(*s) || '-'==*s || '+'==*s) {
+ if (HDisalpha(*s) || '-' == *s || '+' == *s) {
/* Enable or Disable debugging? */
- if ('-'==*s) {
+ if ('-' == *s) {
clear = TRUE;
s++;
- } else if ('+'==*s) {
+ }
+ else if ('+' == *s) {
clear = FALSE;
s++;
- } else {
+ }
+ else {
clear = FALSE;
} /* end if */
/* Get the name */
- for (i=0; HDisalpha(*s); i++, s++)
- if (i<sizeof pkg_name)
+ for (i = 0; HDisalpha(*s); i++, s++)
+ if (i < sizeof pkg_name)
pkg_name[i] = *s;
- pkg_name[MIN(sizeof(pkg_name)-1, i)] = '\0';
+ pkg_name[MIN(sizeof(pkg_name) - 1, i)] = '\0';
/* Trace, all, or one? */
if (!HDstrcmp(pkg_name, "trace")) {
H5_debug_g.trace = clear ? NULL : stream;
- } else if (!HDstrcmp(pkg_name, "ttop")) {
- H5_debug_g.trace = stream;
- H5_debug_g.ttop = (hbool_t)!clear;
- } else if (!HDstrcmp(pkg_name, "ttimes")) {
+ }
+ else if (!HDstrcmp(pkg_name, "ttop")) {
H5_debug_g.trace = stream;
+ H5_debug_g.ttop = (hbool_t)!clear;
+ }
+ else if (!HDstrcmp(pkg_name, "ttimes")) {
+ H5_debug_g.trace = stream;
H5_debug_g.ttimes = (hbool_t)!clear;
- } else if (!HDstrcmp(pkg_name, "all")) {
- for (i=0; i<(size_t)H5_NPKGS; i++)
+ }
+ else if (!HDstrcmp(pkg_name, "all")) {
+ for (i = 0; i < (size_t)H5_NPKGS; i++)
H5_debug_g.pkg[i].stream = clear ? NULL : stream;
- } else {
- for (i=0; i<(size_t)H5_NPKGS; i++) {
+ }
+ else {
+ for (i = 0; i < (size_t)H5_NPKGS; i++) {
if (!HDstrcmp(H5_debug_g.pkg[i].name, pkg_name)) {
H5_debug_g.pkg[i].stream = clear ? NULL : stream;
break;
- } /* end if */
- } /* end for */
- if (i>=(size_t)H5_NPKGS)
+ } /* end if */
+ } /* end for */
+ if (i >= (size_t)H5_NPKGS)
HDfprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name);
} /* end if-else */
-
- } else if (HDisdigit(*s)) {
- int fd = (int)HDstrtol(s, &rest, 0);
+ }
+ else if (HDisdigit(*s)) {
+ int fd = (int)HDstrtol(s, &rest, 0);
H5_debug_open_stream_t *open_stream;
- if((stream = HDfdopen(fd, "w")) != NULL) {
+ if ((stream = HDfdopen(fd, "w")) != NULL) {
(void)HDsetvbuf(stream, NULL, _IOLBF, (size_t)0);
- if(NULL == (open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) {
+ if (NULL ==
+ (open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) {
(void)HDfclose(stream);
return;
} /* end if */
- open_stream->stream = stream;
- open_stream->next = H5_debug_g.open_stream;
+ open_stream->stream = stream;
+ open_stream->next = H5_debug_g.open_stream;
H5_debug_g.open_stream = open_stream;
} /* end if */
s = rest;
- } else {
+ }
+ else {
s++;
} /* end if-else */
- } /* end while */
+ } /* end while */
return;
} /* end H5__debug_mask() */
#ifdef H5_HAVE_PARALLEL
-
+
/*-------------------------------------------------------------------------
* Function: H5__mpi_delete_cb
*
@@ -748,14 +737,15 @@ H5__debug_mask(const char *s)
*
*-------------------------------------------------------------------------
*/
-static int H5__mpi_delete_cb(MPI_Comm H5_ATTR_UNUSED comm, int H5_ATTR_UNUSED keyval, void H5_ATTR_UNUSED *attr_val, int H5_ATTR_UNUSED *flag)
+static int
+H5__mpi_delete_cb(MPI_Comm H5_ATTR_UNUSED comm, int H5_ATTR_UNUSED keyval, void H5_ATTR_UNUSED *attr_val,
+ int H5_ATTR_UNUSED *flag)
{
H5_term_library();
return MPI_SUCCESS;
}
#endif /*H5_HAVE_PARALLEL*/
-
/*-------------------------------------------------------------------------
* Function: H5get_libversion
*
@@ -775,21 +765,23 @@ static int H5__mpi_delete_cb(MPI_Comm H5_ATTR_UNUSED comm, int H5_ATTR_UNUSED ke
herr_t
H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "*Iu*Iu*Iu", majnum, minnum, relnum);
/* Set the version information */
- if (majnum) *majnum = H5_VERS_MAJOR;
- if (minnum) *minnum = H5_VERS_MINOR;
- if (relnum) *relnum = H5_VERS_RELEASE;
+ if (majnum)
+ *majnum = H5_VERS_MAJOR;
+ if (minnum)
+ *minnum = H5_VERS_MINOR;
+ if (relnum)
+ *relnum = H5_VERS_RELEASE;
done:
FUNC_LEAVE_API(ret_value)
} /* end H5get_libversion() */
-
/*-------------------------------------------------------------------------
* Function: H5check_version
*
@@ -805,78 +797,76 @@ done:
*
*-------------------------------------------------------------------------
*/
-#define VERSION_MISMATCH_WARNING \
- "Warning! ***HDF5 library version mismatched error***\n" \
- "The HDF5 header files used to compile this application do not match\n" \
- "the version used by the HDF5 library to which this application is linked.\n" \
- "Data corruption or segmentation faults may occur if the application continues.\n" \
- "This can happen when an application was compiled by one version of HDF5 but\n" \
- "linked with a different version of static or shared HDF5 library.\n" \
- "You should recompile the application or check your shared library related\n" \
+#define VERSION_MISMATCH_WARNING \
+ "Warning! ***HDF5 library version mismatched error***\n" \
+ "The HDF5 header files used to compile this application do not match\n" \
+ "the version used by the HDF5 library to which this application is linked.\n" \
+ "Data corruption or segmentation faults may occur if the application continues.\n" \
+ "This can happen when an application was compiled by one version of HDF5 but\n" \
+ "linked with a different version of static or shared HDF5 library.\n" \
+ "You should recompile the application or check your shared library related\n" \
"settings such as 'LD_LIBRARY_PATH'.\n"
herr_t
H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
{
- char lib_str[256];
- char substr[] = H5_VERS_SUBRELEASE;
- static int checked = 0; /* If we've already checked the version info */
- static unsigned int disable_version_check = 0; /* Set if the version check should be disabled */
- static const char *version_mismatch_warning = VERSION_MISMATCH_WARNING;
- herr_t ret_value = SUCCEED; /* Return value */
+ char lib_str[256];
+ char substr[] = H5_VERS_SUBRELEASE;
+ static int checked = 0; /* If we've already checked the version info */
+ static unsigned int disable_version_check = 0; /* Set if the version check should be disabled */
+ static const char * version_mismatch_warning = VERSION_MISMATCH_WARNING;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT_NOERR_NOFS
H5TRACE3("e", "IuIuIu", majnum, minnum, relnum);
/* Don't check again, if we already have */
if (checked)
- HGOTO_DONE(SUCCEED)
+ HGOTO_DONE(SUCCEED)
- { const char *s; /* Environment string for disabling version check */
+ {
+ const char *s; /* Environment string for disabling version check */
/* Allow different versions of the header files and library? */
- s = HDgetenv ("HDF5_DISABLE_VERSION_CHECK");
+ s = HDgetenv("HDF5_DISABLE_VERSION_CHECK");
if (s && HDisdigit(*s))
- disable_version_check = (unsigned int)HDstrtol (s, NULL, 0);
+ disable_version_check = (unsigned int)HDstrtol(s, NULL, 0);
}
- if (H5_VERS_MAJOR!=majnum || H5_VERS_MINOR!=minnum ||
- H5_VERS_RELEASE!=relnum) {
+ if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE != relnum) {
switch (disable_version_check) {
- case 0:
- HDfprintf(stderr, "%s%s", version_mismatch_warning,
- "You can, at your own risk, disable this warning by setting the environment\n"
- "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.\n"
- "Setting it to 2 or higher will suppress the warning messages totally.\n");
- /* Mention the versions we are referring to */
- HDfprintf (stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n",
- majnum, minnum, relnum,
- (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, (unsigned)H5_VERS_RELEASE);
- /* Show library settings if available */
- HDfprintf (stderr, "%s", H5libhdf5_settings);
-
- /* Bail out now. */
- HDfputs ("Bye...\n", stderr);
- HDabort ();
- case 1:
- /* continue with a warning */
- /* Note that the warning message is embedded in the format string.*/
- HDfprintf (stderr,
- "%s'HDF5_DISABLE_VERSION_CHECK' "
- "environment variable is set to %d, application will\n"
- "continue at your own risk.\n",
- version_mismatch_warning, disable_version_check);
- /* Mention the versions we are referring to */
- HDfprintf (stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n",
- majnum, minnum, relnum,
- (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, (unsigned)H5_VERS_RELEASE);
- /* Show library settings if available */
- HDfprintf (stderr, "%s", H5libhdf5_settings);
- break;
- default:
- /* 2 or higher: continue silently */
- break;
+ case 0:
+ HDfprintf(stderr, "%s%s", version_mismatch_warning,
+ "You can, at your own risk, disable this warning by setting the environment\n"
+ "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.\n"
+ "Setting it to 2 or higher will suppress the warning messages totally.\n");
+ /* Mention the versions we are referring to */
+ HDfprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum, relnum,
+ (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, (unsigned)H5_VERS_RELEASE);
+ /* Show library settings if available */
+ HDfprintf(stderr, "%s", H5libhdf5_settings);
+
+ /* Bail out now. */
+ HDfputs("Bye...\n", stderr);
+ HDabort();
+ case 1:
+ /* continue with a warning */
+ /* Note that the warning message is embedded in the format string.*/
+ HDfprintf(stderr,
+ "%s'HDF5_DISABLE_VERSION_CHECK' "
+ "environment variable is set to %d, application will\n"
+ "continue at your own risk.\n",
+ version_mismatch_warning, disable_version_check);
+ /* Mention the versions we are referring to */
+ HDfprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum, relnum,
+ (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, (unsigned)H5_VERS_RELEASE);
+ /* Show library settings if available */
+ HDfprintf(stderr, "%s", H5libhdf5_settings);
+ break;
+ default:
+ /* 2 or higher: continue silently */
+ break;
} /* end switch */
} /* end if */
@@ -884,39 +874,38 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
/* Indicate that the version check has been performed */
checked = 1;
- if (!disable_version_check){
- /*
- * Verify if H5_VERS_INFO is consistent with the other version information.
- * Check only the first sizeof(lib_str) char. Assume the information
- * will fit within this size or enough significance.
- */
- HDsnprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d",
- H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
- if(*substr) {
- HDstrncat(lib_str, "-", (size_t)1);
- HDstrncat(lib_str, substr, (sizeof(lib_str) - HDstrlen(lib_str)) - 1);
- } /* end if */
- if (HDstrcmp(lib_str, H5_lib_vers_info_g)){
- HDfputs ("Warning! Library version information error.\n"
- "The HDF5 library version information are not "
- "consistent in its source code.\nThis is NOT a fatal error "
- "but should be corrected. Setting the environment\n"
- "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of 1 "
- "will suppress\nthis warning.\n",
- stderr);
- HDfprintf (stderr, "Library version information are:\n"
- "H5_VERS_MAJOR=%d, H5_VERS_MINOR=%d, H5_VERS_RELEASE=%d, "
- "H5_VERS_SUBRELEASE=%s,\nH5_VERS_INFO=%s\n",
- H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
- H5_VERS_SUBRELEASE, H5_VERS_INFO);
- } /* end if */
+ if (!disable_version_check) {
+ /*
+ * Verify if H5_VERS_INFO is consistent with the other version information.
+ * Check only the first sizeof(lib_str) char. Assume the information
+ * will fit within this size or enough significance.
+ */
+ HDsnprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d", H5_VERS_MAJOR, H5_VERS_MINOR,
+ H5_VERS_RELEASE);
+ if (*substr) {
+ HDstrncat(lib_str, "-", (size_t)1);
+ HDstrncat(lib_str, substr, (sizeof(lib_str) - HDstrlen(lib_str)) - 1);
+ } /* end if */
+ if (HDstrcmp(lib_str, H5_lib_vers_info_g)) {
+ HDfputs("Warning! Library version information error.\n"
+ "The HDF5 library version information are not "
+ "consistent in its source code.\nThis is NOT a fatal error "
+ "but should be corrected. Setting the environment\n"
+ "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of 1 "
+ "will suppress\nthis warning.\n",
+ stderr);
+ HDfprintf(stderr,
+ "Library version information are:\n"
+ "H5_VERS_MAJOR=%d, H5_VERS_MINOR=%d, H5_VERS_RELEASE=%d, "
+ "H5_VERS_SUBRELEASE=%s,\nH5_VERS_INFO=%s\n",
+ H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, H5_VERS_SUBRELEASE, H5_VERS_INFO);
+ } /* end if */
}
done:
FUNC_LEAVE_API_NOFS(ret_value)
} /* end H5check_version() */
-
/*-------------------------------------------------------------------------
* Function: H5open
*
@@ -932,7 +921,7 @@ done:
herr_t
H5open(void)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOPUSH(FAIL)
/*NO TRACE*/
@@ -943,7 +932,6 @@ done:
FUNC_LEAVE_API_NOPUSH(ret_value)
} /* end H5open() */
-
/*-------------------------------------------------------------------------
* Function: H5close
*
@@ -962,14 +950,13 @@ H5close(void)
* this function for an uninitialized library.
*/
FUNC_ENTER_API_NOINIT_NOERR_NOFS
- H5TRACE0("e","");
+ H5TRACE0("e", "");
H5_term_library();
FUNC_LEAVE_API_NOFS(SUCCEED)
} /* end H5close() */
-
/*-------------------------------------------------------------------------
* Function: H5allocate_memory
*
@@ -1002,7 +989,7 @@ H5allocate_memory(size_t size, hbool_t clear)
FUNC_ENTER_API_NOINIT
H5TRACE2("*x", "zb", size, clear);
- if(clear)
+ if (clear)
ret_value = H5MM_calloc(size);
else
ret_value = H5MM_malloc(size);
@@ -1010,7 +997,6 @@ H5allocate_memory(size_t size, hbool_t clear)
FUNC_LEAVE_API_NOINIT(ret_value)
} /* end H5allocate_memory() */
-
/*-------------------------------------------------------------------------
* Function: H5resize_memory
*
@@ -1048,7 +1034,6 @@ H5resize_memory(void *mem, size_t size)
FUNC_LEAVE_API_NOINIT(ret_value)
} /* end H5resize_memory() */
-
/*-------------------------------------------------------------------------
* Function: H5free_memory
*
@@ -1073,7 +1058,6 @@ H5free_memory(void *mem)
FUNC_LEAVE_API_NOINIT(SUCCEED)
} /* end H5free_memory() */
-
/*-------------------------------------------------------------------------
* Function: H5is_library_threadsafe
*
@@ -1095,16 +1079,15 @@ H5is_library_threadsafe(hbool_t *is_ts)
/* At this time, it is impossible for this to fail. */
#ifdef H5_HAVE_THREADSAFE
*is_ts = TRUE;
-#else /* H5_HAVE_THREADSAFE */
+#else /* H5_HAVE_THREADSAFE */
*is_ts = FALSE;
#endif /* H5_HAVE_THREADSAFE */
FUNC_LEAVE_API_NOINIT(SUCCEED)
} /* end H5is_library_threadsafe() */
-
-#if defined(H5_HAVE_THREADSAFE) && defined(H5_BUILT_AS_DYNAMIC_LIB) \
- && defined(H5_HAVE_WIN32_API) && defined(H5_HAVE_WIN_THREADS)
+#if defined(H5_HAVE_THREADSAFE) && defined(H5_BUILT_AS_DYNAMIC_LIB) && defined(H5_HAVE_WIN32_API) && \
+ defined(H5_HAVE_WIN_THREADS)
/*-------------------------------------------------------------------------
* Function: DllMain
*
@@ -1132,35 +1115,33 @@ DllMain(_In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved)
BOOL fOkay = TRUE;
- switch(fdwReason)
- {
- case DLL_PROCESS_ATTACH:
- break;
+ switch (fdwReason) {
+ case DLL_PROCESS_ATTACH:
+ break;
- case DLL_PROCESS_DETACH:
- break;
+ case DLL_PROCESS_DETACH:
+ break;
- case DLL_THREAD_ATTACH:
+ case DLL_THREAD_ATTACH:
#ifdef H5_HAVE_WIN_THREADS
- if(H5TS_win32_thread_enter() < 0)
- fOkay = FALSE;
+ if (H5TS_win32_thread_enter() < 0)
+ fOkay = FALSE;
#endif /* H5_HAVE_WIN_THREADS */
- break;
+ break;
- case DLL_THREAD_DETACH:
+ case DLL_THREAD_DETACH:
#ifdef H5_HAVE_WIN_THREADS
- if(H5TS_win32_thread_exit() < 0)
- fOkay = FALSE;
+ if (H5TS_win32_thread_exit() < 0)
+ fOkay = FALSE;
#endif /* H5_HAVE_WIN_THREADS */
- break;
+ break;
- default:
- /* Shouldn't get here */
- fOkay = FALSE;
- break;
+ default:
+ /* Shouldn't get here */
+ fOkay = FALSE;
+ break;
}
return fOkay;
}
#endif /* H5_HAVE_WIN32_API && H5_BUILT_AS_DYNAMIC_LIB && H5_HAVE_WIN_THREADS && H5_HAVE_THREADSAFE*/
-
diff --git a/src/H5A.c b/src/H5A.c
index 19c2e77..7071f05 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -15,30 +15,27 @@
/* Module Setup */
/****************/
-#include "H5Amodule.h" /* This source code file is part of the H5A module */
-#define H5O_FRIEND /* Suppress error about including H5Opkg */
-
+#include "H5Amodule.h" /* This source code file is part of the H5A module */
+#define H5O_FRIEND /* Suppress error about including H5Opkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Apkg.h" /* Attributes */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-#include "H5Sprivate.h" /* Dataspace functions */
-#include "H5VLprivate.h" /* Virtual Object Layer */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Apkg.h" /* Attributes */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5Sprivate.h" /* Dataspace functions */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
@@ -47,20 +44,17 @@
/* Data structure for callback for locating the index by name */
typedef struct H5A_iter_cb1 {
const char *name;
- int idx;
+ int idx;
} H5A_iter_cb1;
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
@@ -68,12 +62,10 @@ typedef struct H5A_iter_cb1 {
/* Package initialization variable */
hbool_t H5_PKG_INIT_VAR = FALSE;
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -89,17 +81,15 @@ H5FL_BLK_DEFINE(attr_buf);
/* Attribute ID class */
static const H5I_class_t H5I_ATTR_CLS[1] = {{
- H5I_ATTR, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
- (H5I_free_t)H5A__close_cb /* Callback routine for closing objects of this class */
+ H5I_ATTR, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5A__close_cb /* Callback routine for closing objects of this class */
}};
/* Flag indicating "top" of interface has been initialized */
static hbool_t H5A_top_package_initialize_s = FALSE;
-
-
/*-------------------------------------------------------------------------
* Function: H5A_init
*
@@ -113,7 +103,7 @@ static hbool_t H5A_top_package_initialize_s = FALSE;
herr_t
H5A_init(void)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* FUNC_ENTER() does all the work */
@@ -122,7 +112,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A_init() */
-
/*--------------------------------------------------------------------------
NAME
H5A__init_package -- Initialize interface-specific information
@@ -138,14 +127,14 @@ DESCRIPTION
herr_t
H5A__init_package(void)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/*
* Create attribute ID type.
*/
- if(H5I_register_type(H5I_ATTR_CLS) < 0)
+ if (H5I_register_type(H5I_ATTR_CLS) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* Mark "top" of interface as initialized, too */
@@ -155,7 +144,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__init_package() */
-
/*--------------------------------------------------------------------------
NAME
H5A_top_term_package
@@ -176,25 +164,24 @@ done:
int
H5A_top_term_package(void)
{
- int n = 0;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(H5A_top_package_initialize_s) {
- if(H5I_nmembers(H5I_ATTR) > 0) {
- (void)H5I_clear_type(H5I_ATTR, FALSE, FALSE);
+ if (H5A_top_package_initialize_s) {
+ if (H5I_nmembers(H5I_ATTR) > 0) {
+ (void)H5I_clear_type(H5I_ATTR, FALSE, FALSE);
n++; /*H5I*/
- } /* end if */
+ } /* end if */
/* Mark closed */
- if(0 == n)
+ if (0 == n)
H5A_top_package_initialize_s = FALSE;
} /* end if */
FUNC_LEAVE_NOAPI(n)
} /* H5A_top_term_package() */
-
/*--------------------------------------------------------------------------
NAME
H5A_term_package
@@ -217,11 +204,11 @@ H5A_top_term_package(void)
int
H5A_term_package(void)
{
- int n = 0;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(H5_PKG_INIT_VAR) {
+ if (H5_PKG_INIT_VAR) {
/* Sanity checks */
HDassert(0 == H5I_nmembers(H5I_ATTR));
HDassert(FALSE == H5A_top_package_initialize_s);
@@ -230,14 +217,13 @@ H5A_term_package(void)
n += (H5I_dec_type_ref(H5I_ATTR) > 0);
/* Mark closed */
- if(0 == n)
+ if (0 == n)
H5_PKG_INIT_VAR = FALSE;
} /* end if */
FUNC_LEAVE_NOAPI(n)
} /* H5A_term_package() */
-
/*--------------------------------------------------------------------------
* Function: H5Acreate2
*
@@ -272,35 +258,34 @@ H5A_term_package(void)
*-------------------------------------------------------------------------
*/
hid_t
-H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
- hid_t acpl_id, hid_t aapl_id)
+H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id)
{
- void *attr = NULL; /* Attribute created */
- H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void * attr = NULL; /* Attribute created */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE6("i", "i*siiii", loc_id, attr_name, type_id, space_id, acpl_id, aapl_id);
/* Check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
- if(!attr_name)
+ if (!attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be NULL")
- if(!*attr_name)
+ if (!*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be an empty string")
/* Get correct property list */
- if(H5P_DEFAULT == acpl_id)
+ if (H5P_DEFAULT == acpl_id)
acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT;
/* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0)
+ if (H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* Get the location object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Set location parameters */
@@ -308,23 +293,23 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the attribute */
- if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, type_id, space_id, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if (NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, type_id, space_id, acpl_id, aapl_id,
+ H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
- if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID")
done:
/* Cleanup on failure */
- if(H5I_INVALID_HID == ret_value)
- if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value)
+ if (attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Acreate2() */
-
/*--------------------------------------------------------------------------
NAME
H5Acreate_by_name
@@ -356,35 +341,33 @@ done:
--------------------------------------------------------------------------*/
hid_t
-H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
- hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id,
- hid_t lapl_id)
+H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id, hid_t space_id,
+ hid_t acpl_id, hid_t aapl_id, hid_t lapl_id)
{
- void *attr = NULL; /* attr object from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void * attr = NULL; /* attr object from VOL connector */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
- H5TRACE8("i", "i*s*siiiii", loc_id, obj_name, attr_name, type_id, space_id,
- acpl_id, aapl_id, lapl_id);
+ H5TRACE8("i", "i*s*siiiii", loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id);
/* Check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
- if(!obj_name || !*obj_name)
+ if (!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name")
- if(!attr_name || !*attr_name)
+ if (!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no attribute name")
/* Get correct property list */
- if(H5P_DEFAULT == acpl_id)
+ if (H5P_DEFAULT == acpl_id)
acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT;
/* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0)
+ if (H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info")
- if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set link access property list info")
/* Set up location struct */
@@ -394,27 +377,27 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
/* Get the location object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the attribute */
- if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, type_id, space_id, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if (NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, type_id, space_id, acpl_id, aapl_id,
+ H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
- if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID")
done:
/* Cleanup on failure */
- if(H5I_INVALID_HID == ret_value)
- if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value)
+ if (attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Acreate_by_name() */
-
/*--------------------------------------------------------------------------
NAME
H5Aopen
@@ -437,52 +420,52 @@ done:
hid_t
H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id)
{
- void *attr = NULL; /* attr object from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object of loc_id */
+ void * attr = NULL; /* attr object from VOL connector */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID;
+ hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, attr_name, aapl_id);
/* Check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
- if(!attr_name)
+ if (!attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
- if(!*attr_name)
+ if (!*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0)
+ if (H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* Set location struct fields */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
- if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if (NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", attr_name)
/* Register the attribute and get an ID for it */
- if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID")
done:
/* Cleanup on failure */
- if(H5I_INVALID_HID == ret_value)
- if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value)
+ if (attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen() */
-
/*--------------------------------------------------------------------------
NAME
H5Aopen_by_name
@@ -505,29 +488,28 @@ done:
H5Aclose or resource leaks will develop.
--------------------------------------------------------------------------*/
hid_t
-H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
- hid_t aapl_id, hid_t lapl_id)
+H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id, hid_t lapl_id)
{
- void *attr = NULL; /* attr object from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object of loc_id */
+ void * attr = NULL; /* attr object from VOL connector */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID;
+ hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "i*s*sii", loc_id, obj_name, attr_name, aapl_id, lapl_id);
/* Check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
- if(!obj_name || !*obj_name)
+ if (!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name")
- if(!attr_name || !*attr_name)
+ if (!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no attribute name")
/* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0)
+ if (H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info")
- if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set link access property list info")
/* Fill in location struct fields */
@@ -541,23 +523,23 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
- if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if (NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute")
/* Register the attribute and get an ID for it */
- if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
- if(H5I_INVALID_HID == ret_value)
- if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value)
+ if (attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* end H5Aopen_by_name() */
-
/*--------------------------------------------------------------------------
NAME
H5Aopen_by_idx
@@ -583,32 +565,31 @@ done:
H5Aclose or resource leaks will develop.
--------------------------------------------------------------------------*/
hid_t
-H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, hid_t aapl_id, hid_t lapl_id)
+H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
+ hid_t aapl_id, hid_t lapl_id)
{
- void *attr = NULL; /* Attribute opened */
- H5VL_object_t *vol_obj = NULL; /* object of loc_id */
+ void * attr = NULL; /* Attribute opened */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
- H5TRACE7("i", "i*sIiIohii", loc_id, obj_name, idx_type, order, n, aapl_id,
- lapl_id);
+ H5TRACE7("i", "i*sIiIohii", loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id);
/* Check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
- if(!obj_name || !*obj_name)
+ if (!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name")
- if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
+ if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid index type specified")
- if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0)
+ if (H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info")
- if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set link access property list info")
/* Fill in location struct parameters */
@@ -621,27 +602,27 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
- if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if (NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, aapl_id, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute")
/* Register the attribute and get an ID for it */
- if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Cleanup on failure */
- if(H5I_INVALID_HID == ret_value)
- if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value)
+ if (attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen_by_idx() */
-
/*--------------------------------------------------------------------------
NAME
H5Awrite
@@ -661,33 +642,32 @@ done:
herr_t
H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf)
{
- H5VL_object_t *vol_obj; /* Attribute object for ID */
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* Attribute object for ID */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ii*x", attr_id, dtype_id, buf);
/* Check arguments */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
- if(H5I_DATATYPE != H5I_get_type(dtype_id))
+ if (H5I_DATATYPE != H5I_get_type(dtype_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
- if(NULL == buf)
+ if (NULL == buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL")
/* Set up collective metadata if appropriate */
- if(H5CX_set_loc(attr_id) < 0)
+ if (H5CX_set_loc(attr_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
/* Write the attribute data */
- if((ret_value = H5VL_attr_write(vol_obj, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ if ((ret_value = H5VL_attr_write(vol_obj, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Awrite() */
-
/*--------------------------------------------------------------------------
NAME
H5Aread
@@ -707,29 +687,28 @@ done:
herr_t
H5Aread(hid_t attr_id, hid_t dtype_id, void *buf)
{
- H5VL_object_t *vol_obj; /* Attribute object for ID */
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj; /* Attribute object for ID */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ii*x", attr_id, dtype_id, buf);
/* Check arguments */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
- if(H5I_DATATYPE != H5I_get_type(dtype_id))
+ if (H5I_DATATYPE != H5I_get_type(dtype_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
- if(NULL == buf)
+ if (NULL == buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL")
/* Read the attribute data */
- if((ret_value = H5VL_attr_read(vol_obj, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ if ((ret_value = H5VL_attr_read(vol_obj, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aread() */
-
/*--------------------------------------------------------------------------
NAME
H5Aget_space
@@ -749,25 +728,25 @@ done:
hid_t
H5Aget_space(hid_t attr_id)
{
- H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", attr_id);
/* Check arguments */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
/* Get the dataspace */
- if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) <
+ 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aget_space() */
-
/*--------------------------------------------------------------------------
NAME
H5Aget_type
@@ -787,25 +766,24 @@ done:
hid_t
H5Aget_type(hid_t attr_id)
{
- H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", attr_id);
/* Check arguments */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
/* Get the datatype */
- if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aget_type() */
-
/*--------------------------------------------------------------------------
NAME
H5Aget_create_plist
@@ -828,8 +806,8 @@ done:
hid_t
H5Aget_create_plist(hid_t attr_id)
{
- H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", attr_id);
@@ -837,18 +815,18 @@ H5Aget_create_plist(hid_t attr_id)
HDassert(H5P_LST_ATTRIBUTE_CREATE_ID_g != -1);
/* Check arguments */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
/* Get the acpl */
- if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_ACPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get creation property list for attribute")
+ if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_ACPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID,
+ "unable to get creation property list for attribute")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Aget_create_plist() */
-
/*--------------------------------------------------------------------------
NAME
H5Aget_name
@@ -873,32 +851,32 @@ done:
ssize_t
H5Aget_name(hid_t attr_id, size_t buf_size, char *buf)
{
- H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
- H5VL_loc_params_t loc_params;
- ssize_t ret_value = -1;
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_loc_params_t loc_params;
+ ssize_t ret_value = -1;
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "iz*s", attr_id, buf_size, buf);
/* check arguments */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an attribute")
- if(!buf && buf_size)
+ if (!buf && buf_size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "buf cannot be NULL if buf_size is non-zero")
/* Set location struct parameters */
- loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(attr_id);
/* Get the attribute name */
- if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, buf_size, buf, &ret_value) < 0)
+ if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
+ buf_size, buf, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aget_name() */
-
/*-------------------------------------------------------------------------
* Function: H5Aget_name_by_idx
*
@@ -917,55 +895,53 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size,
- hid_t lapl_id)
+H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
+ char *name /*out*/, size_t size, hid_t lapl_id)
{
- H5VL_object_t *vol_obj;
+ H5VL_object_t * vol_obj;
H5VL_loc_params_t loc_params;
- ssize_t ret_value; /* Return value */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE8("Zs", "i*sIiIohxzi", loc_id, obj_name, idx_type, order, n, name, size,
- lapl_id);
+ H5TRACE8("Zs", "i*sIiIohxzi", loc_id, obj_name, idx_type, order, n, name, size, lapl_id);
/* Check args */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(!obj_name || !*obj_name)
+ if (!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- if(!name && size)
+ if (!name && size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name cannot be NULL if size is non-zero")
- if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
+ if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
- if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
- loc_params.type = H5VL_OBJECT_BY_IDX;
- loc_params.loc_data.loc_by_idx.name = obj_name;
+ loc_params.type = H5VL_OBJECT_BY_IDX;
+ loc_params.loc_data.loc_by_idx.name = obj_name;
loc_params.loc_data.loc_by_idx.idx_type = idx_type;
- loc_params.loc_data.loc_by_idx.order = order;
- loc_params.loc_data.loc_by_idx.n = n;
- loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
- loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.loc_data.loc_by_idx.order = order;
+ loc_params.loc_data.loc_by_idx.n = n;
+ loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
+ loc_params.obj_type = H5I_get_type(loc_id);
/* Get the name */
- if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, size, name, &ret_value) < 0)
+ if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
+ size, name, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get name")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Aget_name_by_idx() */
-
/*-------------------------------------------------------------------------
* Function: H5Aget_storage_size
*
@@ -987,24 +963,24 @@ hsize_t
H5Aget_storage_size(hid_t attr_id)
{
H5VL_object_t *vol_obj;
- hsize_t ret_value; /* Return value */
+ hsize_t ret_value; /* Return value */
FUNC_ENTER_API(0)
H5TRACE1("h", "i", attr_id);
/* Check arguments */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute")
/* Get the storage size */
- if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, 0, "unable to get acpl")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Aget_storage_size() */
-
/*-------------------------------------------------------------------------
* Function: H5Aget_info
*
@@ -1021,31 +997,31 @@ done:
herr_t
H5Aget_info(hid_t attr_id, H5A_info_t *ainfo)
{
- H5VL_object_t *vol_obj;
+ H5VL_object_t * vol_obj;
H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*x", attr_id, ainfo);
/* Check args */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
- if(!ainfo)
+ if (!ainfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "attribute_info parameter cannot be NULL")
- loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(attr_id);
/* Get the attribute information */
- if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo) < 0)
+ if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
+ ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Aget_info() */
-
/*-------------------------------------------------------------------------
* Function: H5Aget_info_by_name
*
@@ -1060,48 +1036,48 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
- H5A_info_t *ainfo, hid_t lapl_id)
+H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5A_info_t *ainfo,
+ hid_t lapl_id)
{
- H5VL_object_t *vol_obj;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj;
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*s*s*xi", loc_id, obj_name, attr_name, ainfo, lapl_id);
/* Check args */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(!obj_name || !*obj_name)
+ if (!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
- if(!attr_name || !*attr_name)
+ if (!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
- if(NULL == ainfo)
+ if (NULL == ainfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer")
/* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- loc_params.type = H5VL_OBJECT_BY_NAME;
- loc_params.loc_data.loc_by_name.name = obj_name;
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.loc_data.loc_by_name.name = obj_name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
- loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.obj_type = H5I_get_type(loc_id);
/* Get the object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Get the attribute information */
- if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo, attr_name) < 0)
+ if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
+ ainfo, attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Aget_info_by_name() */
-
/*-------------------------------------------------------------------------
* Function: H5Aget_info_by_idx
*
@@ -1117,31 +1093,30 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, H5A_info_t *ainfo, hid_t lapl_id)
+H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
+ H5A_info_t *ainfo, hid_t lapl_id)
{
- H5VL_object_t *vol_obj;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj;
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "i*sIiIoh*xi", loc_id, obj_name, idx_type, order, n, ainfo,
- lapl_id);
+ H5TRACE7("e", "i*sIiIoh*xi", loc_id, obj_name, idx_type, order, n, ainfo, lapl_id);
/* Check args */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(!obj_name || !*obj_name)
+ if (!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
+ if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
- if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
- if(NULL == ainfo)
+ if (NULL == ainfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer")
/* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
loc_params.type = H5VL_OBJECT_BY_IDX;
@@ -1153,18 +1128,18 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Get the attribute information */
- if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo) < 0)
+ if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
+ ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Aget_info_by_idx() */
-
/*-------------------------------------------------------------------------
* Function: H5Arename
*
@@ -1181,40 +1156,41 @@ done:
herr_t
H5Arename(hid_t loc_id, const char *old_name, const char *new_name)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*s*s", loc_id, old_name, new_name);
/* Check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(!old_name)
+ if (!old_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "old attribute name cannot be NULL")
- if(!*old_name)
+ if (!*old_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "old attribute name cannot be an empty string")
- if(!new_name)
+ if (!new_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new attribute name cannot be NULL")
- if(!*new_name)
+ if (!*new_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new attribute name cannot be an empty string")
/* Avoid thrashing things if the names are the same */
- if(HDstrcmp(old_name, new_name)) {
- H5VL_object_t *vol_obj;
+ if (HDstrcmp(old_name, new_name)) {
+ H5VL_object_t * vol_obj;
H5VL_loc_params_t loc_params;
- loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set up collective metadata if appropriate */
- if(H5CX_set_loc(loc_id) < 0)
+ if (H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
/* Rename the attribute */
- if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_name, new_name) < 0)
+ if (H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, old_name, new_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
} /* end if */
@@ -1222,7 +1198,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Arename() */
-
/*-------------------------------------------------------------------------
* Function: H5Arename_by_name
*
@@ -1237,45 +1212,45 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
- const char *new_attr_name, hid_t lapl_id)
+H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, const char *new_attr_name,
+ hid_t lapl_id)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "i*s*s*si", loc_id, obj_name, old_attr_name, new_attr_name,
- lapl_id);
+ H5TRACE5("e", "i*s*s*si", loc_id, obj_name, old_attr_name, new_attr_name, lapl_id);
/* check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(!obj_name || !*obj_name)
+ if (!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
- if(!old_attr_name || !*old_attr_name)
+ if (!old_attr_name || !*old_attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no old attribute name")
- if(!new_attr_name || !*new_attr_name)
+ if (!new_attr_name || !*new_attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name")
/* Avoid thrashing things if the names are the same */
- if(HDstrcmp(old_attr_name, new_attr_name)) {
- H5VL_object_t *vol_obj;
+ if (HDstrcmp(old_attr_name, new_attr_name)) {
+ H5VL_object_t * vol_obj;
H5VL_loc_params_t loc_params;
/* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- loc_params.type = H5VL_OBJECT_BY_NAME;
- loc_params.loc_data.loc_by_name.name = obj_name;
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.loc_data.loc_by_name.name = obj_name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
- loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Rename the attribute */
- if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_attr_name, new_attr_name) < 0)
+ if (H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, old_attr_name, new_attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
} /* end if */
@@ -1283,7 +1258,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Arename_by_name() */
-
/*--------------------------------------------------------------------------
NAME
H5Aiterate2
@@ -1326,40 +1300,40 @@ done:
attribute.
--------------------------------------------------------------------------*/
herr_t
-H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t *idx, H5A_operator2_t op, void *op_data)
+H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op,
+ void *op_data)
{
- H5VL_object_t *vol_obj = NULL; /* object of loc_id */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
- herr_t ret_value; /* Return value */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iIiIo*hx*x", loc_id, idx_type, order, idx, op, op_data);
/* check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
+ if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
- if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
- loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
/* get the loc object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Iterate over attributes */
- if((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, idx, op, op_data)) < 0)
+ if ((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, (int)idx_type, (int)order, idx, op, op_data)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aiterate2() */
-
/*--------------------------------------------------------------------------
NAME
H5Aiterate_by_name
@@ -1404,50 +1378,48 @@ done:
attribute.
--------------------------------------------------------------------------*/
herr_t
-H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data,
- hid_t lapl_id)
+H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t *idx, H5A_operator2_t op, void *op_data, hid_t lapl_id)
{
- H5VL_object_t *vol_obj = NULL; /* Object location */
+ H5VL_object_t * vol_obj = NULL; /* Object location */
H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, obj_name, idx_type, order, idx, op,
- op_data, lapl_id);
+ H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, obj_name, idx_type, order, idx, op, op_data, lapl_id);
/* Check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(!obj_name || !*obj_name)
+ if (!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
- if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
+ if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
- if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- loc_params.type = H5VL_OBJECT_BY_NAME;
- loc_params.obj_type = H5I_get_type(loc_id);
- loc_params.loc_data.loc_by_name.name = obj_name;
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.loc_data.loc_by_name.name = obj_name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
/* get the loc object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Iterate over attributes */
- if((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, idx, op, op_data)) < 0)
+ if ((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, (int)idx_type, (int)order, idx, op, op_data)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed");
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aiterate_by_name() */
-
/*--------------------------------------------------------------------------
NAME
H5Adelete
@@ -1465,42 +1437,42 @@ done:
herr_t
H5Adelete(hid_t loc_id, const char *name)
{
- H5VL_object_t *vol_obj = NULL;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*s", loc_id, name);
/* Check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(!name)
+ if (!name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
- if(!*name)
+ if (!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
/* Set up collective metadata if appropriate */
- if(H5CX_set_loc(loc_id) < 0)
+ if (H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
/* Fill in location struct fields */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
/* Get the object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Delete the attribute */
- if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name) < 0)
+ if (H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Adelete() */
-
/*--------------------------------------------------------------------------
NAME
H5Adelete_by_name
@@ -1518,26 +1490,25 @@ done:
This function removes the named attribute from an object.
--------------------------------------------------------------------------*/
herr_t
-H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
- hid_t lapl_id)
+H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id)
{
- H5VL_object_t *vol_obj;
+ H5VL_object_t * vol_obj;
H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*s*si", loc_id, obj_name, attr_name, lapl_id);
/* Check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(!obj_name || !*obj_name)
+ if (!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
- if(!attr_name || !*attr_name)
+ if (!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
/* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Fill in location struct fields */
@@ -1547,18 +1518,18 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Delete the attribute */
- if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name) < 0)
+ if (H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Adelete_by_name() */
-
/*--------------------------------------------------------------------------
NAME
H5Adelete_by_idx
@@ -1584,51 +1555,51 @@ done:
object to operate on.
--------------------------------------------------------------------------*/
herr_t
-H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, hid_t lapl_id)
+H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
+ hid_t lapl_id)
{
- H5VL_object_t *vol_obj;
+ H5VL_object_t * vol_obj;
H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*sIiIohi", loc_id, obj_name, idx_type, order, n, lapl_id);
/* check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(!obj_name || !*obj_name)
+ if (!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
- if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
+ if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
- if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- loc_params.type = H5VL_OBJECT_BY_IDX;
- loc_params.loc_data.loc_by_idx.name = obj_name;
+ loc_params.type = H5VL_OBJECT_BY_IDX;
+ loc_params.loc_data.loc_by_idx.name = obj_name;
loc_params.loc_data.loc_by_idx.idx_type = idx_type;
- loc_params.loc_data.loc_by_idx.order = order;
- loc_params.loc_data.loc_by_idx.n = n;
- loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
- loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.loc_data.loc_by_idx.order = order;
+ loc_params.loc_data.loc_by_idx.n = n;
+ loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
+ loc_params.obj_type = H5I_get_type(loc_id);
/* get the object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Delete the attribute */
- if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL) < 0)
+ if (H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Adelete_by_idx() */
-
/*-------------------------------------------------------------------------
* Function: H5Aclose
*
@@ -1643,24 +1614,23 @@ done:
herr_t
H5Aclose(hid_t attr_id)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", attr_id);
/* Check arguments */
- if(NULL == H5I_object_verify(attr_id, H5I_ATTR))
+ if (NULL == H5I_object_verify(attr_id, H5I_ATTR))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
/* Decrement references to that atom (and close it) */
- if(H5I_dec_app_ref(attr_id) < 0)
+ if (H5I_dec_app_ref(attr_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "can't close attribute")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aclose() */
-
/*-------------------------------------------------------------------------
* Function: H5Aexists
*
@@ -1678,35 +1648,35 @@ done:
htri_t
H5Aexists(hid_t obj_id, const char *attr_name)
{
- H5VL_object_t *vol_obj;
+ H5VL_object_t * vol_obj;
H5VL_loc_params_t loc_params;
- htri_t ret_value; /* Return value */
+ htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("t", "i*s", obj_id, attr_name);
/* Check arguments */
- if(H5I_ATTR == H5I_get_type(obj_id))
+ if (H5I_ATTR == H5I_get_type(obj_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(!attr_name || !*attr_name)
+ if (!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
/* get the object */
- if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
- loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(obj_id);
/* Check if the attribute exists */
- if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0)
+ if (H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ attr_name, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aexists() */
-
/*-------------------------------------------------------------------------
* Function: H5Aexists_by_name
*
@@ -1721,42 +1691,41 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
- hid_t lapl_id)
+H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id)
{
- H5VL_object_t *vol_obj;
+ H5VL_object_t * vol_obj;
H5VL_loc_params_t loc_params;
- htri_t ret_value; /* Return value */
+ htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("t", "i*s*si", loc_id, obj_name, attr_name, lapl_id);
/* check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(!obj_name || !*obj_name)
+ if (!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
- if(!attr_name || !*attr_name)
+ if (!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
/* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
/* get the object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
- loc_params.type = H5VL_OBJECT_BY_NAME;
- loc_params.loc_data.loc_by_name.name = obj_name;
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.loc_data.loc_by_name.name = obj_name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
- loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.obj_type = H5I_get_type(loc_id);
/* Check existence of attribute */
- if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0)
+ if (H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ attr_name, &ret_value) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aexists_by_name() */
-
diff --git a/src/H5AC.c b/src/H5AC.c
index 0f5d3a3..7e39f09 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -29,50 +29,44 @@
/* Module Setup */
/****************/
-#include "H5ACmodule.h" /* This source code file is part of the H5AC module */
-#define H5C_FRIEND /* Suppress error about including H5Cpkg */
-#define H5F_FRIEND /* Suppress error about including H5Fpkg */
-
+#include "H5ACmodule.h" /* This source code file is part of the H5AC module */
+#define H5C_FRIEND /* Suppress error about including H5Cpkg */
+#define H5F_FRIEND /* Suppress error about including H5Fpkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACpkg.h" /* Metadata cache */
-#include "H5Clog.h" /* Cache logging */
-#include "H5Cpkg.h" /* Cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* Files */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5SLprivate.h" /* Skip Lists */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5ACpkg.h" /* Metadata cache */
+#include "H5Clog.h" /* Cache logging */
+#include "H5Cpkg.h" /* Cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5SLprivate.h" /* Skip Lists */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5AC__check_if_write_permitted(const H5F_t *f,
- hbool_t *write_permitted_ptr);
+static herr_t H5AC__check_if_write_permitted(const H5F_t *f, hbool_t *write_permitted_ptr);
static herr_t H5AC__ext_config_2_int_config(H5AC_cache_config_t *ext_conf_ptr,
- H5C_auto_size_ctl_t *int_conf_ptr);
+ H5C_auto_size_ctl_t *int_conf_ptr);
#if H5AC_DO_TAGGING_SANITY_CHECKS
-static herr_t H5AC__verify_tag(const H5AC_class_t * type);
+static herr_t H5AC__verify_tag(const H5AC_class_t *type);
#endif /* H5AC_DO_TAGGING_SANITY_CHECKS */
-
/*********************/
/* Package Variables */
/*********************/
@@ -89,7 +83,6 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
hbool_t H5_coll_api_sanity_check_g = false;
#endif /* H5_HAVE_PARALLEL */
-
/*******************/
/* Local Variables */
/*******************/
@@ -101,40 +94,38 @@ hbool_t H5_coll_api_sanity_check_g = false;
*/
static const H5AC_class_t *const H5AC_class_s[] = {
- H5AC_BT, /* ( 0) B-tree nodes */
- H5AC_SNODE, /* ( 1) symbol table nodes */
- H5AC_LHEAP_PRFX, /* ( 2) local heap prefix */
- H5AC_LHEAP_DBLK, /* ( 3) local heap data block */
- H5AC_GHEAP, /* ( 4) global heap */
- H5AC_OHDR, /* ( 5) object header */
- H5AC_OHDR_CHK, /* ( 6) object header chunk */
- H5AC_BT2_HDR, /* ( 7) v2 B-tree header */
- H5AC_BT2_INT, /* ( 8) v2 B-tree internal node */
- H5AC_BT2_LEAF, /* ( 9) v2 B-tree leaf node */
- H5AC_FHEAP_HDR, /* (10) fractal heap header */
- H5AC_FHEAP_DBLOCK, /* (11) fractal heap direct block */
- H5AC_FHEAP_IBLOCK, /* (12) fractal heap indirect block */
- H5AC_FSPACE_HDR, /* (13) free space header */
- H5AC_FSPACE_SINFO, /* (14) free space sections */
- H5AC_SOHM_TABLE, /* (15) shared object header message master table */
- H5AC_SOHM_LIST, /* (16) shared message index stored as a list */
- H5AC_EARRAY_HDR, /* (17) extensible array header */
- H5AC_EARRAY_IBLOCK, /* (18) extensible array index block */
- H5AC_EARRAY_SBLOCK, /* (19) extensible array super block */
- H5AC_EARRAY_DBLOCK, /* (20) extensible array data block */
- H5AC_EARRAY_DBLK_PAGE, /* (21) extensible array data block page */
- H5AC_FARRAY_HDR, /* (22) fixed array header */
- H5AC_FARRAY_DBLOCK, /* (23) fixed array data block */
- H5AC_FARRAY_DBLK_PAGE, /* (24) fixed array data block page */
- H5AC_SUPERBLOCK, /* (25) file superblock */
- H5AC_DRVRINFO, /* (26) driver info block (supplements superblock) */
- H5AC_EPOCH_MARKER, /* (27) epoch marker - always internal to cache */
- H5AC_PROXY_ENTRY, /* (28) cache entry proxy */
- H5AC_PREFETCHED_ENTRY /* (29) prefetched entry - always internal to cache */
+ H5AC_BT, /* ( 0) B-tree nodes */
+ H5AC_SNODE, /* ( 1) symbol table nodes */
+ H5AC_LHEAP_PRFX, /* ( 2) local heap prefix */
+ H5AC_LHEAP_DBLK, /* ( 3) local heap data block */
+ H5AC_GHEAP, /* ( 4) global heap */
+ H5AC_OHDR, /* ( 5) object header */
+ H5AC_OHDR_CHK, /* ( 6) object header chunk */
+ H5AC_BT2_HDR, /* ( 7) v2 B-tree header */
+ H5AC_BT2_INT, /* ( 8) v2 B-tree internal node */
+ H5AC_BT2_LEAF, /* ( 9) v2 B-tree leaf node */
+ H5AC_FHEAP_HDR, /* (10) fractal heap header */
+ H5AC_FHEAP_DBLOCK, /* (11) fractal heap direct block */
+ H5AC_FHEAP_IBLOCK, /* (12) fractal heap indirect block */
+ H5AC_FSPACE_HDR, /* (13) free space header */
+ H5AC_FSPACE_SINFO, /* (14) free space sections */
+ H5AC_SOHM_TABLE, /* (15) shared object header message master table */
+ H5AC_SOHM_LIST, /* (16) shared message index stored as a list */
+ H5AC_EARRAY_HDR, /* (17) extensible array header */
+ H5AC_EARRAY_IBLOCK, /* (18) extensible array index block */
+ H5AC_EARRAY_SBLOCK, /* (19) extensible array super block */
+ H5AC_EARRAY_DBLOCK, /* (20) extensible array data block */
+ H5AC_EARRAY_DBLK_PAGE, /* (21) extensible array data block page */
+ H5AC_FARRAY_HDR, /* (22) fixed array header */
+ H5AC_FARRAY_DBLOCK, /* (23) fixed array data block */
+ H5AC_FARRAY_DBLK_PAGE, /* (24) fixed array data block page */
+ H5AC_SUPERBLOCK, /* (25) file superblock */
+ H5AC_DRVRINFO, /* (26) driver info block (supplements superblock) */
+ H5AC_EPOCH_MARKER, /* (27) epoch marker - always internal to cache */
+ H5AC_PROXY_ENTRY, /* (28) cache entry proxy */
+ H5AC_PREFETCHED_ENTRY /* (29) prefetched entry - always internal to cache */
};
-
-
/*-------------------------------------------------------------------------
* Function: H5AC_init
*
@@ -151,7 +142,7 @@ static const H5AC_class_t *const H5AC_class_s[] = {
herr_t
H5AC_init(void)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* FUNC_ENTER() does all the work */
@@ -160,7 +151,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5AC_init() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__init_package
*
@@ -183,11 +173,11 @@ H5AC__init_package(void)
* sanity checks using MPI barriers
*/
{
- const char *s; /* String for environment variables */
+ const char *s; /* String for environment variables */
s = HDgetenv("H5_COLL_API_SANITY_CHECK");
- if(s && HDisdigit(*s)) {
- long env_val = HDstrtol(s, NULL, 0);
+ if (s && HDisdigit(*s)) {
+ long env_val = HDstrtol(s, NULL, 0);
H5_coll_api_sanity_check_g = (0 == env_val) ? FALSE : TRUE;
}
}
@@ -196,7 +186,6 @@ H5AC__init_package(void)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5AC__init_package() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_term_package
*
@@ -216,14 +205,13 @@ H5AC_term_package(void)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(H5_PKG_INIT_VAR)
+ if (H5_PKG_INIT_VAR)
/* Reset interface initialization flag */
H5_PKG_INIT_VAR = FALSE;
FUNC_LEAVE_NOAPI(0)
} /* end H5AC_term_package() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC_cache_image_pending()
@@ -244,8 +232,8 @@ H5AC_term_package(void)
hbool_t
H5AC_cache_image_pending(const H5F_t *f)
{
- H5C_t *cache_ptr;
- hbool_t ret_value = FALSE; /* Return value */
+ H5C_t * cache_ptr;
+ hbool_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -259,7 +247,6 @@ H5AC_cache_image_pending(const H5F_t *f)
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_cache_image_pending() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_create
*
@@ -278,81 +265,81 @@ H5AC_cache_image_pending(const H5F_t *f)
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_config_t * image_config_ptr)
+H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_config_t *image_config_ptr)
{
#ifdef H5_HAVE_PARALLEL
- char prefix[H5C__PREFIX_LEN] = "";
- H5AC_aux_t * aux_ptr = NULL;
+ char prefix[H5C__PREFIX_LEN] = "";
+ H5AC_aux_t *aux_ptr = NULL;
#endif /* H5_HAVE_PARALLEL */
struct H5C_cache_image_ctl_t int_ci_config = H5C__DEFAULT_CACHE_IMAGE_CTL;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check arguments */
HDassert(f);
HDassert(NULL == f->shared->cache);
- HDassert(config_ptr != NULL) ;
- HDassert(image_config_ptr != NULL) ;
+ HDassert(config_ptr != NULL);
+ HDassert(image_config_ptr != NULL);
HDassert(image_config_ptr->version == H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION);
HDcompile_assert(NELMTS(H5AC_class_s) == H5AC_NTYPES);
HDcompile_assert(H5C__MAX_NUM_TYPE_IDS == H5AC_NTYPES);
/* Validate configurations */
- if(H5AC_validate_config(config_ptr) < 0)
+ if (H5AC_validate_config(config_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache configuration")
- if(H5AC_validate_cache_image_config(image_config_ptr) < 0)
+ if (H5AC_validate_cache_image_config(image_config_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache image configuration")
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
- MPI_Comm mpi_comm;
- int mpi_rank;
- int mpi_size;
+ if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
+ MPI_Comm mpi_comm;
+ int mpi_rank;
+ int mpi_size;
- if(MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(f)))
+ if (MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(f)))
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI communicator")
- if((mpi_rank = H5F_mpi_get_rank(f)) < 0)
+ if ((mpi_rank = H5F_mpi_get_rank(f)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get mpi rank")
- if((mpi_size = H5F_mpi_get_size(f)) < 0)
+ if ((mpi_size = H5F_mpi_get_size(f)) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get mpi size")
- if(NULL == (aux_ptr = H5FL_CALLOC(H5AC_aux_t)))
+ if (NULL == (aux_ptr = H5FL_CALLOC(H5AC_aux_t)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate H5AC auxiliary structure")
- aux_ptr->magic = H5AC__H5AC_AUX_T_MAGIC;
- aux_ptr->mpi_comm = mpi_comm;
- aux_ptr->mpi_rank = mpi_rank;
- aux_ptr->mpi_size = mpi_size;
- aux_ptr->write_permitted = FALSE;
- aux_ptr->dirty_bytes_threshold = H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD;
- aux_ptr->dirty_bytes = 0;
+ aux_ptr->magic = H5AC__H5AC_AUX_T_MAGIC;
+ aux_ptr->mpi_comm = mpi_comm;
+ aux_ptr->mpi_rank = mpi_rank;
+ aux_ptr->mpi_size = mpi_size;
+ aux_ptr->write_permitted = FALSE;
+ aux_ptr->dirty_bytes_threshold = H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD;
+ aux_ptr->dirty_bytes = 0;
aux_ptr->metadata_write_strategy = H5AC__DEFAULT_METADATA_WRITE_STRATEGY;
#if H5AC_DEBUG_DIRTY_BYTES_CREATION
- aux_ptr->dirty_bytes_propagations = 0;
- aux_ptr->unprotect_dirty_bytes = 0;
+ aux_ptr->dirty_bytes_propagations = 0;
+ aux_ptr->unprotect_dirty_bytes = 0;
aux_ptr->unprotect_dirty_bytes_updates = 0;
- aux_ptr->insert_dirty_bytes = 0;
- aux_ptr->insert_dirty_bytes_updates = 0;
- aux_ptr->move_dirty_bytes = 0;
- aux_ptr->move_dirty_bytes_updates = 0;
+ aux_ptr->insert_dirty_bytes = 0;
+ aux_ptr->insert_dirty_bytes_updates = 0;
+ aux_ptr->move_dirty_bytes = 0;
+ aux_ptr->move_dirty_bytes_updates = 0;
#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */
- aux_ptr->d_slist_ptr = NULL;
- aux_ptr->c_slist_ptr = NULL;
+ aux_ptr->d_slist_ptr = NULL;
+ aux_ptr->c_slist_ptr = NULL;
aux_ptr->candidate_slist_ptr = NULL;
- aux_ptr->write_done = NULL;
- aux_ptr->sync_point_done = NULL;
- aux_ptr->p0_image_len = 0;
+ aux_ptr->write_done = NULL;
+ aux_ptr->sync_point_done = NULL;
+ aux_ptr->p0_image_len = 0;
HDsprintf(prefix, "%d:", mpi_rank);
- if(mpi_rank == 0) {
- if(NULL == (aux_ptr->d_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
+ if (mpi_rank == 0) {
+ if (NULL == (aux_ptr->d_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create dirtied entry list")
- if(NULL == (aux_ptr->c_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
+ if (NULL == (aux_ptr->c_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create cleaned entry list")
} /* end if */
@@ -360,27 +347,22 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co
* when the distributed strategy is selected as all processes
* will use it in the case of a flush.
*/
- if(NULL == (aux_ptr->candidate_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
+ if (NULL == (aux_ptr->candidate_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create candidate entry list")
- if(aux_ptr != NULL)
- if(aux_ptr->mpi_rank == 0)
- f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE,
- H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1),
- H5AC_class_s,
- H5AC__check_if_write_permitted, TRUE, H5AC__log_flushed_entry,
- (void *)aux_ptr);
+ if (aux_ptr != NULL)
+ if (aux_ptr->mpi_rank == 0)
+ f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE,
+ (H5AC_NTYPES - 1), H5AC_class_s, H5AC__check_if_write_permitted,
+ TRUE, H5AC__log_flushed_entry, (void *)aux_ptr);
else
- f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE,
- H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1),
- H5AC_class_s,
- H5AC__check_if_write_permitted, TRUE, NULL,
- (void *)aux_ptr);
+ f->shared->cache =
+ H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1),
+ H5AC_class_s, H5AC__check_if_write_permitted, TRUE, NULL, (void *)aux_ptr);
else
- f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE,
- H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1),
- H5AC_class_s,
- H5AC__check_if_write_permitted, TRUE, NULL, NULL);
+ f->shared->cache =
+ H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1),
+ H5AC_class_s, H5AC__check_if_write_permitted, TRUE, NULL, NULL);
} /* end if */
else {
#endif /* H5_HAVE_PARALLEL */
@@ -388,20 +370,19 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co
* overwritten shortly by the subsequent set resize config call.
* -- JRM
*/
- f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE,
- H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1),
- H5AC_class_s,
- H5AC__check_if_write_permitted, TRUE, NULL, NULL);
+ f->shared->cache =
+ H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1),
+ H5AC_class_s, H5AC__check_if_write_permitted, TRUE, NULL, NULL);
#ifdef H5_HAVE_PARALLEL
- } /* end else */
+ } /* end else */
#endif /* H5_HAVE_PARALLEL */
- if(NULL == f->shared->cache)
+ if (NULL == f->shared->cache)
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
#ifdef H5_HAVE_PARALLEL
- if(aux_ptr != NULL)
- if(H5C_set_prefix(f->shared->cache, prefix) < 0)
+ if (aux_ptr != NULL)
+ if (H5C_set_prefix(f->shared->cache, prefix) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "H5C_set_prefix() failed")
#endif /* H5_HAVE_PARALLEL */
@@ -409,12 +390,13 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co
* This will be JSON until we create a special API call. Trace output
* is generated when logging is controlled by the struct.
*/
- if(H5F_USE_MDC_LOGGING(f))
- if(H5C_log_set_up(f->shared->cache, H5F_MDC_LOG_LOCATION(f), H5C_LOG_STYLE_JSON, H5F_START_MDC_LOG_ON_ACCESS(f)) < 0)
+ if (H5F_USE_MDC_LOGGING(f))
+ if (H5C_log_set_up(f->shared->cache, H5F_MDC_LOG_LOCATION(f), H5C_LOG_STYLE_JSON,
+ H5F_START_MDC_LOG_ON_ACCESS(f)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging setup failed")
/* Set the cache parameters */
- if(H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0)
+ if (H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "auto resize configuration failed")
/* Don't need to get the current H5C image config here since the
@@ -427,35 +409,34 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co
int_ci_config.generate_image = image_config_ptr->generate_image;
int_ci_config.save_resize_status = image_config_ptr->save_resize_status;
int_ci_config.entry_ageout = image_config_ptr->entry_ageout;
- if(H5C_set_cache_image_config(f, f->shared->cache, &int_ci_config) < 0)
+ if (H5C_set_cache_image_config(f, f->shared->cache, &int_ci_config) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "auto resize configuration failed")
done:
/* If currently logging, generate a message */
- if(f->shared->cache->log_info->logging)
- if(H5C_log_write_create_cache_msg(f->shared->cache, ret_value) < 0)
+ if (f->shared->cache->log_info->logging)
+ if (H5C_log_write_create_cache_msg(f->shared->cache, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
#ifdef H5_HAVE_PARALLEL
/* if there is a failure, try to tidy up the auxiliary structure */
- if(ret_value < 0) {
- if(aux_ptr != NULL) {
- if(aux_ptr->d_slist_ptr != NULL)
+ if (ret_value < 0) {
+ if (aux_ptr != NULL) {
+ if (aux_ptr->d_slist_ptr != NULL)
H5SL_close(aux_ptr->d_slist_ptr);
- if(aux_ptr->c_slist_ptr != NULL)
+ if (aux_ptr->c_slist_ptr != NULL)
H5SL_close(aux_ptr->c_slist_ptr);
- if(aux_ptr->candidate_slist_ptr != NULL)
+ if (aux_ptr->candidate_slist_ptr != NULL)
H5SL_close(aux_ptr->candidate_slist_ptr);
aux_ptr->magic = 0;
- aux_ptr = H5FL_FREE(H5AC_aux_t, aux_ptr);
+ aux_ptr = H5FL_FREE(H5AC_aux_t, aux_ptr);
} /* end if */
- } /* end if */
-#endif /* H5_HAVE_PARALLEL */
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_create() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_dest
*
@@ -470,10 +451,10 @@ done:
*
* Changes:
*
- * In the parallel case, added code to setup the MDC slist
+ * In the parallel case, added code to setup the MDC slist
* before the call to H5AC__flush_entries() and take it down
- * afterwards.
- *
+ * afterwards.
+ *
* JRM -- 7/29/20
*
*-------------------------------------------------------------------------
@@ -481,12 +462,12 @@ done:
herr_t
H5AC_dest(H5F_t *f)
{
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
+ hbool_t log_enabled; /* TRUE if logging was set up */
+ hbool_t curr_logging; /* TRUE if currently logging */
#ifdef H5_HAVE_PARALLEL
- H5AC_aux_t * aux_ptr = NULL;
-#endif /* H5_HAVE_PARALLEL */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_aux_t *aux_ptr = NULL;
+#endif /* H5_HAVE_PARALLEL */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -501,42 +482,37 @@ H5AC_dest(H5F_t *f)
#endif /* H5AC_DUMP_STATS_ON_CLOSE */
/* Check if log messages are being emitted */
- if(H5C_get_logging_status(f->shared->cache,
- &log_enabled, &curr_logging) < 0)
+ if (H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to get logging status")
- if(log_enabled && curr_logging) {
+ if (log_enabled && curr_logging) {
- if(H5C_log_write_destroy_cache_msg(f->shared->cache) < 0)
+ if (H5C_log_write_destroy_cache_msg(f->shared->cache) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, \
- "unable to emit log message")
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
}
/* Tear down logging */
- if(log_enabled) {
+ if (log_enabled) {
- if(H5C_log_tear_down(f->shared->cache) < 0)
+ if (H5C_log_tear_down(f->shared->cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, \
- "mdc logging tear-down failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging tear-down failed")
}
#ifdef H5_HAVE_PARALLEL
/* destroying the cache, so clear all collective entries */
- if(H5C_clear_coll_entries(f->shared->cache, FALSE) < 0)
+ if (H5C_clear_coll_entries(f->shared->cache, FALSE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, \
- "H5C_clear_coll_entries() failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed")
aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache);
- if(aux_ptr) {
+ if (aux_ptr) {
/* Sanity check */
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
-
/* If the file was opened R/W, attempt to flush all entries
* from rank 0 & Bcast clean list to other ranks.
@@ -544,8 +520,8 @@ H5AC_dest(H5F_t *f)
* Must not flush in the R/O case, as this will trigger the
* free space manager settle routines.
*
- * Must also enable the skip list before the call to
- * H5AC__flush_entries() and disable it afterwards, as the
+ * Must also enable the skip list before the call to
+ * H5AC__flush_entries() and disable it afterwards, as the
* skip list will be disabled after the previous flush.
*
* Note that H5C_dest() does slist setup and take down as well.
@@ -555,20 +531,19 @@ H5AC_dest(H5F_t *f)
* Fortunately, the cache should be clean or close to it at this
* point, so the overhead should be minimal.
*/
- if(H5F_ACC_RDWR & H5F_INTENT(f)) {
+ if (H5F_ACC_RDWR & H5F_INTENT(f)) {
/* enable and load the slist */
- if ( H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0 )
+ if (H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "set slist enabled failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed")
- if(H5AC__flush_entries(f) < 0)
+ if (H5AC__flush_entries(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush")
/* disable the slist -- should be empty */
- if ( H5C_set_slist_enabled(f->shared->cache, FALSE, FALSE) < 0 )
+ if (H5C_set_slist_enabled(f->shared->cache, FALSE, FALSE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "disable slist failed")
}
@@ -576,7 +551,7 @@ H5AC_dest(H5F_t *f)
#endif /* H5_HAVE_PARALLEL */
/* Destroy the cache */
- if(H5C_dest(f) < 0)
+ if (H5C_dest(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't destroy cache")
@@ -584,23 +559,23 @@ H5AC_dest(H5F_t *f)
#ifdef H5_HAVE_PARALLEL
- if(aux_ptr != NULL) {
+ if (aux_ptr != NULL) {
- if(aux_ptr->d_slist_ptr != NULL) {
+ if (aux_ptr->d_slist_ptr != NULL) {
HDassert(H5SL_count(aux_ptr->d_slist_ptr) == 0);
H5SL_close(aux_ptr->d_slist_ptr);
} /* end if */
- if(aux_ptr->c_slist_ptr != NULL) {
+ if (aux_ptr->c_slist_ptr != NULL) {
HDassert(H5SL_count(aux_ptr->c_slist_ptr) == 0);
H5SL_close(aux_ptr->c_slist_ptr);
} /* end if */
- if(aux_ptr->candidate_slist_ptr != NULL) {
+ if (aux_ptr->candidate_slist_ptr != NULL) {
HDassert(H5SL_count(aux_ptr->candidate_slist_ptr) == 0);
H5SL_close(aux_ptr->candidate_slist_ptr);
@@ -608,16 +583,15 @@ H5AC_dest(H5F_t *f)
} /* end if */
aux_ptr->magic = 0;
- aux_ptr = H5FL_FREE(H5AC_aux_t, aux_ptr);
+ aux_ptr = H5FL_FREE(H5AC_aux_t, aux_ptr);
- } /* end if */
+ } /* end if */
#endif /* H5_HAVE_PARALLEL */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_dest() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_evict
*
@@ -634,7 +608,7 @@ done:
herr_t
H5AC_evict(H5F_t *f)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -644,19 +618,18 @@ H5AC_evict(H5F_t *f)
HDassert(f->shared->cache);
/* Evict all entries in the cache except the pinned superblock entry */
- if(H5C_evict(f) < 0)
+ if (H5C_evict(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't evict cache")
done:
/* If currently logging, generate a message */
- if(f->shared->cache->log_info->logging)
- if(H5C_log_write_evict_cache_msg(f->shared->cache, ret_value) < 0)
+ if (f->shared->cache->log_info->logging)
+ if (H5C_log_write_evict_cache_msg(f->shared->cache, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_evict() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_expunge_entry
*
@@ -672,10 +645,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_expunge_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr,
- unsigned flags)
+H5AC_expunge_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, unsigned flags)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -687,19 +659,18 @@ H5AC_expunge_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr,
HDassert(type->serialize);
HDassert(H5F_addr_defined(addr));
- if(H5C_expunge_entry(f, type, addr, flags) < 0)
+ if (H5C_expunge_entry(f, type, addr, flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "H5C_expunge_entry() failed")
done:
/* If currently logging, generate a message */
- if(f->shared->cache->log_info->logging)
- if(H5C_log_write_expunge_entry_msg(f->shared->cache, addr, type->id, ret_value) < 0)
+ if (f->shared->cache->log_info->logging)
+ if (H5C_log_write_expunge_entry_msg(f->shared->cache, addr, type->id, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_expunge_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_flush
*
@@ -722,7 +693,7 @@ done:
herr_t
H5AC_flush(H5F_t *f)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -733,29 +704,28 @@ H5AC_flush(H5F_t *f)
#ifdef H5_HAVE_PARALLEL
/* flushing the cache, so clear all collective entries */
- if(H5C_clear_coll_entries(f->shared->cache, FALSE) < 0)
+ if (H5C_clear_coll_entries(f->shared->cache, FALSE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed")
/* Attempt to flush all entries from rank 0 & Bcast clean list to other ranks */
- if(H5AC__flush_entries(f) < 0)
+ if (H5AC__flush_entries(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush")
#endif /* H5_HAVE_PARALLEL */
/* Flush the cache */
/* (Again, in parallel - writes out the superblock) */
- if(H5C_flush_cache(f, H5AC__NO_FLAGS_SET) < 0)
+ if (H5C_flush_cache(f, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache")
done:
/* If currently logging, generate a message */
- if(f->shared->cache->log_info->logging)
- if(H5C_log_write_flush_cache_msg(f->shared->cache, ret_value) < 0)
+ if (f->shared->cache->log_info->logging)
+ if (H5C_log_write_flush_cache_msg(f->shared->cache, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_flush() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_get_entry_status
*
@@ -780,40 +750,40 @@ done:
herr_t
H5AC_get_entry_status(const H5F_t *f, haddr_t addr, unsigned *status)
{
- hbool_t in_cache; /* Entry @ addr is in the cache */
- hbool_t is_dirty; /* Entry @ addr is in the cache and dirty */
- hbool_t is_protected; /* Entry @ addr is in the cache and protected */
- hbool_t is_pinned; /* Entry @ addr is in the cache and pinned */
- hbool_t is_corked;
- hbool_t is_flush_dep_child; /* Entry @ addr is in the cache and is a flush dependency child */
- hbool_t is_flush_dep_parent; /* Entry @ addr is in the cache and is a flush dependency parent */
- hbool_t image_is_up_to_date; /* Entry @ addr is in the cache and has an up to date image */
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t in_cache; /* Entry @ addr is in the cache */
+ hbool_t is_dirty; /* Entry @ addr is in the cache and dirty */
+ hbool_t is_protected; /* Entry @ addr is in the cache and protected */
+ hbool_t is_pinned; /* Entry @ addr is in the cache and pinned */
+ hbool_t is_corked;
+ hbool_t is_flush_dep_child; /* Entry @ addr is in the cache and is a flush dependency child */
+ hbool_t is_flush_dep_parent; /* Entry @ addr is in the cache and is a flush dependency parent */
+ hbool_t image_is_up_to_date; /* Entry @ addr is in the cache and has an up to date image */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if((f == NULL) || (!H5F_addr_defined(addr)) || (status == NULL))
+ if ((f == NULL) || (!H5F_addr_defined(addr)) || (status == NULL))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry")
- if(H5C_get_entry_status(f, addr, NULL, &in_cache, &is_dirty,
- &is_protected, &is_pinned, &is_corked, &is_flush_dep_parent, &is_flush_dep_child, &image_is_up_to_date) < 0)
+ if (H5C_get_entry_status(f, addr, NULL, &in_cache, &is_dirty, &is_protected, &is_pinned, &is_corked,
+ &is_flush_dep_parent, &is_flush_dep_child, &image_is_up_to_date) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_entry_status() failed")
- if(in_cache) {
+ if (in_cache) {
*status |= H5AC_ES__IN_CACHE;
- if(is_dirty)
+ if (is_dirty)
*status |= H5AC_ES__IS_DIRTY;
- if(is_protected)
+ if (is_protected)
*status |= H5AC_ES__IS_PROTECTED;
- if(is_pinned)
+ if (is_pinned)
*status |= H5AC_ES__IS_PINNED;
- if(is_corked)
+ if (is_corked)
*status |= H5AC_ES__IS_CORKED;
- if(is_flush_dep_parent)
+ if (is_flush_dep_parent)
*status |= H5AC_ES__IS_FLUSH_DEP_PARENT;
- if(is_flush_dep_child)
+ if (is_flush_dep_child)
*status |= H5AC_ES__IS_FLUSH_DEP_CHILD;
- if(image_is_up_to_date)
+ if (image_is_up_to_date)
*status |= H5AC_ES__IMAGE_IS_UP_TO_DATE;
} /* end if */
else
@@ -823,7 +793,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_get_entry_status() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_insert_entry
*
@@ -839,10 +808,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
- unsigned int flags)
+H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned int flags)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -856,45 +824,45 @@ H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
HDassert(thing);
/* Check for invalid access request */
- if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
+ if (0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file")
#if H5AC_DO_TAGGING_SANITY_CHECKS
- if(!H5C_get_ignore_tags(f->shared->cache) && H5AC__verify_tag(type) < 0)
+ if (!H5C_get_ignore_tags(f->shared->cache) && H5AC__verify_tag(type) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Bad tag value")
#endif /* H5AC_DO_TAGGING_SANITY_CHECKS */
/* Insert entry into metadata cache */
- if(H5C_insert_entry(f, type, addr, thing, flags) < 0)
+ if (H5C_insert_entry(f, type, addr, thing, flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C_insert_entry() failed")
#ifdef H5_HAVE_PARALLEL
-{
- H5AC_aux_t *aux_ptr;
+ {
+ H5AC_aux_t *aux_ptr;
- if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache))) {
- /* Log the new entry */
- if(H5AC__log_inserted_entry((H5AC_info_t *)thing) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5AC__log_inserted_entry() failed")
+ if (NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache))) {
+ /* Log the new entry */
+ if (H5AC__log_inserted_entry((H5AC_info_t *)thing) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5AC__log_inserted_entry() failed")
- /* Check if we should try to flush */
- if(aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold)
- if(H5AC__run_sync_point(f, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point")
- } /* end if */
-}
+ /* Check if we should try to flush */
+ if (aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold)
+ if (H5AC__run_sync_point(f, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point")
+ } /* end if */
+ }
#endif /* H5_HAVE_PARALLEL */
done:
/* If currently logging, generate a message */
- if(f->shared->cache->log_info->logging)
- if(H5C_log_write_insert_entry_msg(f->shared->cache, addr, type->id, flags, ((H5C_cache_entry_t *)thing)->size, ret_value) < 0)
+ if (f->shared->cache->log_info->logging)
+ if (H5C_log_write_insert_entry_msg(f->shared->cache, addr, type->id, flags,
+ ((H5C_cache_entry_t *)thing)->size, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_insert_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_load_cache_image_on_next_protect
*
@@ -910,10 +878,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_load_cache_image_on_next_protect(H5F_t * f, haddr_t addr, hsize_t len,
- hbool_t rw)
+H5AC_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len, hbool_t rw)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -922,14 +889,13 @@ H5AC_load_cache_image_on_next_protect(H5F_t * f, haddr_t addr, hsize_t len,
HDassert(f->shared);
HDassert(f->shared->cache);
- if(H5C_load_cache_image_on_next_protect(f, addr, len, rw) < 0)
+ if (H5C_load_cache_image_on_next_protect(f, addr, len, rw) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "call to H5C_load_cache_image_on_next_protect failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_load_cache_image_on_next_protect() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_mark_entry_dirty
*
@@ -947,8 +913,8 @@ herr_t
H5AC_mark_entry_dirty(void *thing)
{
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
- H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -960,31 +926,30 @@ H5AC_mark_entry_dirty(void *thing)
cache_ptr = entry_ptr->cache_ptr;
#ifdef H5_HAVE_PARALLEL
-{
- H5AC_aux_t *aux_ptr;
+ {
+ H5AC_aux_t *aux_ptr;
- aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
- if((!entry_ptr->is_dirty) && (!entry_ptr->is_protected) &&
- (entry_ptr->is_pinned) && (NULL != aux_ptr))
- if(H5AC__log_dirtied_entry(entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry")
-}
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
+ if ((!entry_ptr->is_dirty) && (!entry_ptr->is_protected) && (entry_ptr->is_pinned) &&
+ (NULL != aux_ptr))
+ if (H5AC__log_dirtied_entry(entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry")
+ }
#endif /* H5_HAVE_PARALLEL */
- if(H5C_mark_entry_dirty(thing) < 0)
+ if (H5C_mark_entry_dirty(thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't mark pinned or protected entry dirty")
done:
/* If currently logging, generate a message */
- if(cache_ptr != NULL && cache_ptr->log_info != NULL)
- if(cache_ptr->log_info->logging)
- if(H5C_log_write_mark_entry_dirty_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ if (cache_ptr != NULL && cache_ptr->log_info != NULL)
+ if (cache_ptr->log_info->logging)
+ if (H5C_log_write_mark_entry_dirty_msg(cache_ptr, entry_ptr, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_mark_entry_dirty() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_mark_entry_clean
*
@@ -1002,8 +967,8 @@ herr_t
H5AC_mark_entry_clean(void *thing)
{
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
- H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1014,31 +979,30 @@ H5AC_mark_entry_clean(void *thing)
cache_ptr = entry_ptr->cache_ptr;
#ifdef H5_HAVE_PARALLEL
-{
- H5AC_aux_t *aux_ptr;
+ {
+ H5AC_aux_t *aux_ptr;
- aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
- if((!entry_ptr->is_dirty) && (!entry_ptr->is_protected) &&
- (entry_ptr->is_pinned) && (NULL != aux_ptr))
- if(H5AC__log_cleaned_entry(entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "can't log cleaned entry")
-}
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
+ if ((!entry_ptr->is_dirty) && (!entry_ptr->is_protected) && (entry_ptr->is_pinned) &&
+ (NULL != aux_ptr))
+ if (H5AC__log_cleaned_entry(entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "can't log cleaned entry")
+ }
#endif /* H5_HAVE_PARALLEL */
- if(H5C_mark_entry_clean(thing) < 0)
+ if (H5C_mark_entry_clean(thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "can't mark pinned or protected entry clean")
done:
/* If currently logging, generate a message */
- if(cache_ptr != NULL && cache_ptr->log_info != NULL)
- if(cache_ptr->log_info->logging)
- if(H5C_log_write_mark_entry_clean_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ if (cache_ptr != NULL && cache_ptr->log_info != NULL)
+ if (cache_ptr->log_info->logging)
+ if (H5C_log_write_mark_entry_clean_msg(cache_ptr, entry_ptr, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_mark_entry_clean() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_mark_entry_unserialized
*
@@ -1056,8 +1020,8 @@ herr_t
H5AC_mark_entry_unserialized(void *thing)
{
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
- H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1068,20 +1032,19 @@ H5AC_mark_entry_unserialized(void *thing)
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
- if(H5C_mark_entry_unserialized(thing) < 0)
+ if (H5C_mark_entry_unserialized(thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKUNSERIALIZED, FAIL, "can't mark entry unserialized")
done:
/* If currently logging, generate a message */
- if(cache_ptr != NULL && cache_ptr->log_info != NULL)
- if(cache_ptr->log_info->logging)
- if(H5C_log_write_mark_unserialized_entry_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ if (cache_ptr != NULL && cache_ptr->log_info != NULL)
+ if (cache_ptr->log_info->logging)
+ if (H5C_log_write_mark_unserialized_entry_msg(cache_ptr, entry_ptr, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_mark_entry_unserialized() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_mark_entry_serialized
*
@@ -1099,8 +1062,8 @@ herr_t
H5AC_mark_entry_serialized(void *thing)
{
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
- H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1110,20 +1073,19 @@ H5AC_mark_entry_serialized(void *thing)
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
- if(H5C_mark_entry_serialized(thing) < 0)
+ if (H5C_mark_entry_serialized(thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKSERIALIZED, FAIL, "can't mark entry serialized")
done:
/* If currently logging, generate a message */
- if(cache_ptr != NULL && cache_ptr->log_info != NULL)
- if(cache_ptr->log_info->logging)
- if(H5C_log_write_mark_serialized_entry_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ if (cache_ptr != NULL && cache_ptr->log_info != NULL)
+ if (cache_ptr->log_info->logging)
+ if (H5C_log_write_mark_serialized_entry_msg(cache_ptr, entry_ptr, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_mark_entry_serialized() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_move_entry
*
@@ -1141,9 +1103,9 @@ herr_t
H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr)
{
#ifdef H5_HAVE_PARALLEL
- H5AC_aux_t *aux_ptr;
-#endif /* H5_HAVE_PARALLEL */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_aux_t *aux_ptr;
+#endif /* H5_HAVE_PARALLEL */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1157,31 +1119,30 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne
#ifdef H5_HAVE_PARALLEL
/* Log moving the entry */
- if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache)))
- if(H5AC__log_moved_entry(f, old_addr, new_addr) < 0)
+ if (NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache)))
+ if (H5AC__log_moved_entry(f, old_addr, new_addr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log moved entry")
#endif /* H5_HAVE_PARALLEL */
- if(H5C_move_entry(f->shared->cache, type, old_addr, new_addr) < 0)
+ if (H5C_move_entry(f->shared->cache, type, old_addr, new_addr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "H5C_move_entry() failed")
#ifdef H5_HAVE_PARALLEL
/* Check if we should try to flush */
- if(NULL != aux_ptr && aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold)
- if(H5AC__run_sync_point(f, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0)
+ if (NULL != aux_ptr && aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold)
+ if (H5AC__run_sync_point(f, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point")
#endif /* H5_HAVE_PARALLEL */
done:
/* If currently logging, generate a message */
- if(f->shared->cache->log_info->logging)
- if(H5C_log_write_move_entry_msg(f->shared->cache, old_addr, new_addr, type->id, ret_value) < 0)
+ if (f->shared->cache->log_info->logging)
+ if (H5C_log_write_move_entry_msg(f->shared->cache, old_addr, new_addr, type->id, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_move_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_pin_protected_entry()
*
@@ -1198,9 +1159,9 @@ done:
herr_t
H5AC_pin_protected_entry(void *thing)
{
- H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
- H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
+ H5C_t * cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1212,20 +1173,19 @@ H5AC_pin_protected_entry(void *thing)
HDassert(cache_ptr);
/* Pin entry */
- if(H5C_pin_protected_entry(thing) < 0)
+ if (H5C_pin_protected_entry(thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "can't pin entry")
done:
/* If currently logging, generate a message */
- if(cache_ptr != NULL && cache_ptr->log_info != NULL)
- if(cache_ptr->log_info->logging)
- if(H5C_log_write_pin_entry_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ if (cache_ptr != NULL && cache_ptr->log_info != NULL)
+ if (cache_ptr->log_info->logging)
+ if (H5C_log_write_pin_entry_msg(cache_ptr, entry_ptr, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_pin_protected_entry() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC_prep_for_file_close
@@ -1247,7 +1207,7 @@ done:
herr_t
H5AC_prep_for_file_close(H5F_t *f)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1256,29 +1216,28 @@ H5AC_prep_for_file_close(H5F_t *f)
HDassert(f->shared);
HDassert(f->shared->cache);
- if(H5C_prep_for_file_close(f) < 0)
+ if (H5C_prep_for_file_close(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "cache prep for file close failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_prep_for_file_close() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC_prep_for_file_flush
*
- * Purpose: This function should be called just prior to the first
+ * Purpose: This function should be called just prior to the first
* call to H5AC_flush() during a file flush.
*
- * Its purpose is to handly any setup required prior to
- * metadata cache flush.
+ * Its purpose is to handly any setup required prior to
+ * metadata cache flush.
*
* Initially, this means setting up the slist prior to the
- * flush. We do this in a seperate call because
+ * flush. We do this in a seperate call because
* H5F__flush_phase2() make repeated calls to H5AC_flush().
- * Handling this detail in separate calls allows us to avoid
- * the overhead of setting up and taking down the skip list
+ * Handling this detail in separate calls allows us to avoid
+ * the overhead of setting up and taking down the skip list
* repeatedly.
*
* Return: Non-negative on success/Negative on failure
@@ -1293,7 +1252,7 @@ done:
herr_t
H5AC_prep_for_file_flush(H5F_t *f)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1302,7 +1261,7 @@ H5AC_prep_for_file_flush(H5F_t *f)
HDassert(f->shared);
HDassert(f->shared->cache);
- if ( H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0)
+ if (H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist enabled failed")
@@ -1312,26 +1271,25 @@ done:
} /* H5AC_prep_for_file_flush() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC_secure_from_file_flush
*
- * Purpose: This function should be called just after the last
+ * Purpose: This function should be called just after the last
* call to H5AC_flush() during a file flush.
*
* Its purpose is to perform any necessary cleanup after the
* metadata cache flush.
*
* The objective of the call is to allow the metadata cache
- * to do any necessary necessary cleanup work after a cache
+ * to do any necessary necessary cleanup work after a cache
* flush.
*
* Initially, this means taking down the slist after the
- * flush. We do this in a seperate call because
+ * flush. We do this in a seperate call because
* H5F__flush_phase2() make repeated calls to H5AC_flush().
- * Handling this detail in separate calls allows us to avoid
- * the overhead of setting up and taking down the skip list
+ * Handling this detail in separate calls allows us to avoid
+ * the overhead of setting up and taking down the skip list
* repeatedly.
*
* Return: Non-negative on success/Negative on failure
@@ -1346,7 +1304,7 @@ done:
herr_t
H5AC_secure_from_file_flush(H5F_t *f)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1355,7 +1313,7 @@ H5AC_secure_from_file_flush(H5F_t *f)
HDassert(f->shared);
HDassert(f->shared->cache);
- if ( H5C_set_slist_enabled(f->shared->cache, FALSE, FALSE) < 0)
+ if (H5C_set_slist_enabled(f->shared->cache, FALSE, FALSE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist enabled failed")
@@ -1365,7 +1323,6 @@ done:
} /* H5AC_secure_from_file_flush() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC_create_flush_dependency()
@@ -1381,11 +1338,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_create_flush_dependency(void * parent_thing, void * child_thing)
+H5AC_create_flush_dependency(void *parent_thing, void *child_thing)
{
- H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
- H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
+ H5C_t * cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1398,20 +1355,20 @@ H5AC_create_flush_dependency(void * parent_thing, void * child_thing)
HDassert(cache_ptr);
/* Create the flush dependency */
- if(H5C_create_flush_dependency(parent_thing, child_thing) < 0)
+ if (H5C_create_flush_dependency(parent_thing, child_thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "H5C_create_flush_dependency() failed")
done:
/* If currently logging, generate a message */
- if(cache_ptr != NULL && cache_ptr->log_info != NULL)
- if(cache_ptr->log_info->logging)
- if(H5C_log_write_create_fd_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0)
+ if (cache_ptr != NULL && cache_ptr->log_info != NULL)
+ if (cache_ptr->log_info->logging)
+ if (H5C_log_write_create_fd_msg(cache_ptr, (H5AC_info_t *)parent_thing,
+ (H5AC_info_t *)child_thing, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_create_flush_dependency() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_protect
*
@@ -1436,11 +1393,10 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata,
- unsigned flags)
+H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata, unsigned flags)
{
- void * thing = NULL; /* Pointer to native data structure for entry */
- void * ret_value = NULL; /* Return value */
+ void *thing = NULL; /* Pointer to native data structure for entry */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1456,24 +1412,22 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata,
* only permitted in the parallel case.
*/
#ifdef H5_HAVE_PARALLEL
- HDassert(0 == (flags & (unsigned)(~(H5C__READ_ONLY_FLAG | \
- H5C__FLUSH_LAST_FLAG | \
- H5C__FLUSH_COLLECTIVELY_FLAG))));
-#else /* H5_HAVE_PARALLEL */
- HDassert(0 == (flags & (unsigned)(~(H5C__READ_ONLY_FLAG | \
- H5C__FLUSH_LAST_FLAG))));
+ HDassert(0 == (flags &
+ (unsigned)(~(H5C__READ_ONLY_FLAG | H5C__FLUSH_LAST_FLAG | H5C__FLUSH_COLLECTIVELY_FLAG))));
+#else /* H5_HAVE_PARALLEL */
+ HDassert(0 == (flags & (unsigned)(~(H5C__READ_ONLY_FLAG | H5C__FLUSH_LAST_FLAG))));
#endif /* H5_HAVE_PARALLEL */
/* Check for invalid access request */
- if((0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) && (0 == (flags & H5C__READ_ONLY_FLAG)))
+ if ((0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) && (0 == (flags & H5C__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "no write intent on file")
#if H5AC_DO_TAGGING_SANITY_CHECKS
- if(!H5C_get_ignore_tags(f->shared->cache) && H5AC__verify_tag(type) < 0)
+ if (!H5C_get_ignore_tags(f->shared->cache) && H5AC__verify_tag(type) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Bad tag value")
#endif /* H5AC_DO_TAGGING_SANITY_CHECKS */
- if(NULL == (thing = H5C_protect(f, type, addr, udata, flags)))
+ if (NULL == (thing = H5C_protect(f, type, addr, udata, flags)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_protect() failed")
/* Set return value */
@@ -1484,15 +1438,15 @@ done:
{
herr_t fake_ret_value = (NULL == ret_value) ? FAIL : SUCCEED;
- if(f->shared->cache->log_info->logging)
- if(H5C_log_write_protect_entry_msg(f->shared->cache, (H5AC_info_t *)thing, type->id, flags, fake_ret_value) < 0)
+ if (f->shared->cache->log_info->logging)
+ if (H5C_log_write_protect_entry_msg(f->shared->cache, (H5AC_info_t *)thing, type->id, flags,
+ fake_ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, NULL, "unable to emit log message")
}
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_protect() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_resize_entry
*
@@ -1509,8 +1463,8 @@ herr_t
H5AC_resize_entry(void *thing, size_t new_size)
{
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
- H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1522,31 +1476,30 @@ H5AC_resize_entry(void *thing, size_t new_size)
HDassert(cache_ptr);
/* Resize the entry */
- if(H5C_resize_entry(thing, new_size) < 0)
+ if (H5C_resize_entry(thing, new_size) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "can't resize entry")
#ifdef H5_HAVE_PARALLEL
-{
- H5AC_aux_t *aux_ptr;
+ {
+ H5AC_aux_t *aux_ptr;
- aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
- if((!entry_ptr->is_dirty) && (NULL != aux_ptr))
- if(H5AC__log_dirtied_entry(entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry")
-}
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
+ if ((!entry_ptr->is_dirty) && (NULL != aux_ptr))
+ if (H5AC__log_dirtied_entry(entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry")
+ }
#endif /* H5_HAVE_PARALLEL */
done:
/* If currently logging, generate a message */
- if(cache_ptr != NULL && cache_ptr->log_info != NULL)
- if(cache_ptr->log_info->logging)
- if(H5C_log_write_resize_entry_msg(cache_ptr, entry_ptr, new_size, ret_value) < 0)
+ if (cache_ptr != NULL && cache_ptr->log_info != NULL)
+ if (cache_ptr->log_info->logging)
+ if (H5C_log_write_resize_entry_msg(cache_ptr, entry_ptr, new_size, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_resize_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_unpin_entry()
*
@@ -1564,8 +1517,8 @@ herr_t
H5AC_unpin_entry(void *thing)
{
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
- H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1577,20 +1530,19 @@ H5AC_unpin_entry(void *thing)
HDassert(cache_ptr);
/* Unpin the entry */
- if(H5C_unpin_entry(thing) < 0)
+ if (H5C_unpin_entry(thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry")
done:
/* If currently logging, generate a message */
- if(cache_ptr != NULL && cache_ptr->log_info != NULL)
- if(cache_ptr->log_info->logging)
- if(H5C_log_write_unpin_entry_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ if (cache_ptr != NULL && cache_ptr->log_info != NULL)
+ if (cache_ptr->log_info->logging)
+ if (H5C_log_write_unpin_entry_msg(cache_ptr, entry_ptr, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_unpin_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_destroy_flush_dependency()
*
@@ -1604,11 +1556,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_destroy_flush_dependency(void * parent_thing, void * child_thing)
+H5AC_destroy_flush_dependency(void *parent_thing, void *child_thing)
{
- H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
- H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
+ H5C_t * cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1621,20 +1573,20 @@ H5AC_destroy_flush_dependency(void * parent_thing, void * child_thing)
HDassert(cache_ptr);
/* Destroy the flush dependency */
- if(H5C_destroy_flush_dependency(parent_thing, child_thing) < 0)
+ if (H5C_destroy_flush_dependency(parent_thing, child_thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "H5C_destroy_flush_dependency() failed")
done:
/* If currently logging, generate a message */
- if(cache_ptr != NULL && cache_ptr->log_info != NULL)
- if(cache_ptr->log_info->logging)
- if(H5C_log_write_destroy_fd_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0)
+ if (cache_ptr != NULL && cache_ptr->log_info != NULL)
+ if (cache_ptr->log_info->logging)
+ if (H5C_log_write_destroy_fd_msg(cache_ptr, (H5AC_info_t *)parent_thing,
+ (H5AC_info_t *)child_thing, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_destroy_flush_dependency() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_unprotect
*
@@ -1673,15 +1625,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
- unsigned flags)
+H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned flags)
{
- hbool_t dirtied;
- hbool_t deleted;
+ hbool_t dirtied;
+ hbool_t deleted;
#ifdef H5_HAVE_PARALLEL
- H5AC_aux_t * aux_ptr = NULL;
-#endif /* H5_HAVE_PARALLEL */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5AC_aux_t *aux_ptr = NULL;
+#endif /* H5_HAVE_PARALLEL */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1697,55 +1648,54 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
HDassert(((H5AC_info_t *)thing)->addr == addr);
HDassert(((H5AC_info_t *)thing)->type == type);
- dirtied = (hbool_t)(((flags & H5AC__DIRTIED_FLAG) == H5AC__DIRTIED_FLAG) ||
- (((H5AC_info_t *)thing)->dirtied));
+ dirtied =
+ (hbool_t)(((flags & H5AC__DIRTIED_FLAG) == H5AC__DIRTIED_FLAG) || (((H5AC_info_t *)thing)->dirtied));
deleted = (hbool_t)((flags & H5C__DELETED_FLAG) == H5C__DELETED_FLAG);
/* Check if the size changed out from underneath us, if we're not deleting
* the entry.
*/
- if(dirtied && !deleted) {
- size_t curr_size = 0;
+ if (dirtied && !deleted) {
+ size_t curr_size = 0;
- if((type->image_len)(thing, &curr_size) < 0)
+ if ((type->image_len)(thing, &curr_size) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGETSIZE, FAIL, "Can't get size of thing")
- if(((H5AC_info_t *)thing)->size != curr_size)
+ if (((H5AC_info_t *)thing)->size != curr_size)
HGOTO_ERROR(H5E_CACHE, H5E_BADSIZE, FAIL, "size of entry changed")
} /* end if */
#ifdef H5_HAVE_PARALLEL
- if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache))) {
- if(dirtied && ((H5AC_info_t *)thing)->is_dirty == FALSE)
- if(H5AC__log_dirtied_entry((H5AC_info_t *)thing) < 0)
+ if (NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache))) {
+ if (dirtied && ((H5AC_info_t *)thing)->is_dirty == FALSE)
+ if (H5AC__log_dirtied_entry((H5AC_info_t *)thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log dirtied entry")
- if(deleted && aux_ptr->mpi_rank == 0)
- if(H5AC__log_deleted_entry((H5AC_info_t *)thing) < 0)
+ if (deleted && aux_ptr->mpi_rank == 0)
+ if (H5AC__log_deleted_entry((H5AC_info_t *)thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "H5AC__log_deleted_entry() failed")
- } /* end if */
+ } /* end if */
#endif /* H5_HAVE_PARALLEL */
- if(H5C_unprotect(f, addr, thing, flags) < 0)
+ if (H5C_unprotect(f, addr, thing, flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "H5C_unprotect() failed")
#ifdef H5_HAVE_PARALLEL
/* Check if we should try to flush */
- if((aux_ptr != NULL) && (aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold))
- if(H5AC__run_sync_point(f, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0)
+ if ((aux_ptr != NULL) && (aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold))
+ if (H5AC__run_sync_point(f, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point")
#endif /* H5_HAVE_PARALLEL */
done:
/* If currently logging, generate a message */
- if(f->shared->cache->log_info->logging)
- if(H5C_log_write_unprotect_entry_msg(f->shared->cache, addr, type->id, flags, ret_value) < 0)
+ if (f->shared->cache->log_info->logging)
+ if (H5C_log_write_unprotect_entry_msg(f->shared->cache, addr, type->id, flags, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_unprotect() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_get_cache_auto_resize_config
*
@@ -1759,37 +1709,36 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr,
- H5AC_cache_config_t *config_ptr)
+H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr)
{
H5C_auto_size_ctl_t internal_config;
- hbool_t evictions_enabled;
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t evictions_enabled;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- if((cache_ptr == NULL) || (config_ptr == NULL) ||
- (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION))
+ if ((cache_ptr == NULL) || (config_ptr == NULL) ||
+ (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr or config_ptr on entry")
#ifdef H5_HAVE_PARALLEL
-{
- H5AC_aux_t *aux_ptr;
+ {
+ H5AC_aux_t *aux_ptr;
- aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
- if((aux_ptr != NULL) && (aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad aux_ptr on entry")
-}
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
+ if ((aux_ptr != NULL) && (aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad aux_ptr on entry")
+ }
#endif /* H5_HAVE_PARALLEL */
/* Retrieve the configuration */
- if(H5C_get_cache_auto_resize_config((const H5C_t *)cache_ptr, &internal_config) < 0)
+ if (H5C_get_cache_auto_resize_config((const H5C_t *)cache_ptr, &internal_config) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_auto_resize_config() failed")
- if(H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled) < 0)
+ if (H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_resize_enabled() failed")
/* Set the information to return */
- if(internal_config.rpt_fcn == NULL)
+ if (internal_config.rpt_fcn == NULL)
config_ptr->rpt_fcn_enabled = FALSE;
else
config_ptr->rpt_fcn_enabled = TRUE;
@@ -1820,27 +1769,26 @@ H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr,
config_ptr->apply_empty_reserve = internal_config.apply_empty_reserve;
config_ptr->empty_reserve = internal_config.empty_reserve;
#ifdef H5_HAVE_PARALLEL
-{
- H5AC_aux_t *aux_ptr;
+ {
+ H5AC_aux_t *aux_ptr;
- if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr))) {
- config_ptr->dirty_bytes_threshold = aux_ptr->dirty_bytes_threshold;
- config_ptr->metadata_write_strategy = aux_ptr->metadata_write_strategy;
- } /* end if */
- else {
+ if (NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr))) {
+ config_ptr->dirty_bytes_threshold = aux_ptr->dirty_bytes_threshold;
+ config_ptr->metadata_write_strategy = aux_ptr->metadata_write_strategy;
+ } /* end if */
+ else {
#endif /* H5_HAVE_PARALLEL */
- config_ptr->dirty_bytes_threshold = H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD;
- config_ptr->metadata_write_strategy = H5AC__DEFAULT_METADATA_WRITE_STRATEGY;
+ config_ptr->dirty_bytes_threshold = H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD;
+ config_ptr->metadata_write_strategy = H5AC__DEFAULT_METADATA_WRITE_STRATEGY;
#ifdef H5_HAVE_PARALLEL
- } /* end else */
-}
+ } /* end else */
+ }
#endif /* H5_HAVE_PARALLEL */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_get_cache_auto_resize_config() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_get_cache_size
*
@@ -1854,22 +1802,21 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_get_cache_size(H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr,
- size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr)
+H5AC_get_cache_size(H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr,
+ uint32_t *cur_num_entries_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if(H5C_get_cache_size((H5C_t *)cache_ptr, max_size_ptr, min_clean_size_ptr,
- cur_size_ptr, cur_num_entries_ptr) < 0)
+ if (H5C_get_cache_size((H5C_t *)cache_ptr, max_size_ptr, min_clean_size_ptr, cur_size_ptr,
+ cur_num_entries_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_size() failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_get_cache_size() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_get_cache_flush_in_progess
*
@@ -1885,18 +1832,17 @@ done:
herr_t
H5AC_get_cache_flush_in_progress(H5AC_t *cache_ptr, hbool_t *flush_in_progress_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if(H5C_get_cache_flush_in_progress((H5C_t *)cache_ptr, flush_in_progress_ptr) < 0)
+ if (H5C_get_cache_flush_in_progress((H5C_t *)cache_ptr, flush_in_progress_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_flush_in_progress() failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_get_cache_flush_in_progress() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_get_cache_hit_rate
*
@@ -1912,18 +1858,17 @@ done:
herr_t
H5AC_get_cache_hit_rate(H5AC_t *cache_ptr, double *hit_rate_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if(H5C_get_cache_hit_rate((H5C_t *)cache_ptr, hit_rate_ptr) < 0)
+ if (H5C_get_cache_hit_rate((H5C_t *)cache_ptr, hit_rate_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_hit_rate() failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_get_cache_hit_rate() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC_reset_cache_hit_rate_stats()
@@ -1937,20 +1882,19 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_reset_cache_hit_rate_stats(H5AC_t * cache_ptr)
+H5AC_reset_cache_hit_rate_stats(H5AC_t *cache_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if(H5C_reset_cache_hit_rate_stats((H5C_t *)cache_ptr) < 0)
+ if (H5C_reset_cache_hit_rate_stats((H5C_t *)cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats() failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_reset_cache_hit_rate_stats() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_set_cache_auto_resize_config
*
@@ -1967,27 +1911,27 @@ herr_t
H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr)
{
H5C_auto_size_ctl_t internal_config;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
HDassert(cache_ptr);
- if(cache_ptr == NULL)
+ if (cache_ptr == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry")
#ifdef H5_HAVE_PARALLEL
-{
- H5AC_aux_t *aux_ptr;
+ {
+ H5AC_aux_t *aux_ptr;
- aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
- if((aux_ptr != NULL) && (aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad aux_ptr on entry")
-}
+ aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
+ if ((aux_ptr != NULL) && (aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad aux_ptr on entry")
+ }
#endif /* H5_HAVE_PARALLEL */
/* Validate external configuration */
- if(H5AC_validate_config(config_ptr) != SUCCEED)
+ if (H5AC_validate_config(config_ptr) != SUCCEED)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache configuration")
/* If the cache config struct is being used to control logging, perform
@@ -1996,53 +1940,52 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config
* to write start/stop messages.
*/
/* close */
- if(config_ptr->close_trace_file)
- if(H5C_log_tear_down((H5C_t *)cache_ptr) < 0)
+ if (config_ptr->close_trace_file)
+ if (H5C_log_tear_down((H5C_t *)cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging tear-down failed")
/* open */
- if(config_ptr->open_trace_file) {
+ if (config_ptr->open_trace_file) {
/* Turn on metadata cache logging.
* This will be trace output until we create a special API call. JSON
* output is generated when logging is controlled by the H5P calls.
*/
- if(H5C_log_set_up((H5C_t *)cache_ptr, config_ptr->trace_file_name, H5C_LOG_STYLE_TRACE, TRUE) < 0)
+ if (H5C_log_set_up((H5C_t *)cache_ptr, config_ptr->trace_file_name, H5C_LOG_STYLE_TRACE, TRUE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging setup failed")
}
/* Convert external configuration to internal representation */
- if(H5AC__ext_config_2_int_config(config_ptr, &internal_config) < 0)
+ if (H5AC__ext_config_2_int_config(config_ptr, &internal_config) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__ext_config_2_int_config() failed")
/* Set configuration */
- if(H5C_set_cache_auto_resize_config(cache_ptr, &internal_config) < 0)
+ if (H5C_set_cache_auto_resize_config(cache_ptr, &internal_config) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_cache_auto_resize_config() failed")
- if(H5C_set_evictions_enabled(cache_ptr, config_ptr->evictions_enabled) < 0)
+ if (H5C_set_evictions_enabled(cache_ptr, config_ptr->evictions_enabled) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_evictions_enabled() failed")
#ifdef H5_HAVE_PARALLEL
-{
- H5AC_aux_t *aux_ptr;
+ {
+ H5AC_aux_t *aux_ptr;
- /* Set parallel configuration values */
- /* (Which are only held in the H5AC layer -QAK) */
- if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr))) {
- aux_ptr->dirty_bytes_threshold = config_ptr->dirty_bytes_threshold;
- aux_ptr->metadata_write_strategy = config_ptr->metadata_write_strategy;
- } /* end if */
-}
+ /* Set parallel configuration values */
+ /* (Which are only held in the H5AC layer -QAK) */
+ if (NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr))) {
+ aux_ptr->dirty_bytes_threshold = config_ptr->dirty_bytes_threshold;
+ aux_ptr->metadata_write_strategy = config_ptr->metadata_write_strategy;
+ } /* end if */
+ }
#endif /* H5_HAVE_PARALLEL */
done:
/* If currently logging, generate a message */
- if(cache_ptr->log_info->logging)
- if(H5C_log_write_set_cache_config_msg(cache_ptr, config_ptr, ret_value) < 0)
+ if (cache_ptr->log_info->logging)
+ if (H5C_log_write_set_cache_config_msg(cache_ptr, config_ptr, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_set_cache_auto_resize_config() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_validate_config()
*
@@ -2069,57 +2012,55 @@ herr_t
H5AC_validate_config(H5AC_cache_config_t *config_ptr)
{
H5C_auto_size_ctl_t internal_config;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- if(config_ptr == NULL)
+ if (config_ptr == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "NULL config_ptr on entry")
- if(config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION)
+ if (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Unknown config version")
/* don't bother to test trace_file_name unless open_trace_file is TRUE */
- if(config_ptr->open_trace_file) {
- size_t name_len;
+ if (config_ptr->open_trace_file) {
+ size_t name_len;
/* Can't really test the trace_file_name field without trying to
* open the file, so we will content ourselves with a couple of
* sanity checks on the length of the file name.
*/
name_len = HDstrlen(config_ptr->trace_file_name);
- if(name_len == 0)
+ if (name_len == 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name is empty")
- else if(name_len > H5AC__MAX_TRACE_FILE_NAME_LEN)
+ else if (name_len > H5AC__MAX_TRACE_FILE_NAME_LEN)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name too long")
} /* end if */
- if((config_ptr->evictions_enabled == FALSE) &&
- ((config_ptr->incr_mode != H5C_incr__off) ||
- (config_ptr->flash_incr_mode != H5C_flash_incr__off) ||
- (config_ptr->decr_mode != H5C_decr__off)))
+ if ((config_ptr->evictions_enabled == FALSE) &&
+ ((config_ptr->incr_mode != H5C_incr__off) || (config_ptr->flash_incr_mode != H5C_flash_incr__off) ||
+ (config_ptr->decr_mode != H5C_decr__off)))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Can't disable evictions while auto-resize is enabled")
- if(config_ptr->dirty_bytes_threshold < H5AC__MIN_DIRTY_BYTES_THRESHOLD)
+ if (config_ptr->dirty_bytes_threshold < H5AC__MIN_DIRTY_BYTES_THRESHOLD)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "dirty_bytes_threshold too small")
- else if(config_ptr->dirty_bytes_threshold > H5AC__MAX_DIRTY_BYTES_THRESHOLD)
+ else if (config_ptr->dirty_bytes_threshold > H5AC__MAX_DIRTY_BYTES_THRESHOLD)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "dirty_bytes_threshold too big")
- if((config_ptr->metadata_write_strategy != H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY) &&
- (config_ptr->metadata_write_strategy != H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED))
+ if ((config_ptr->metadata_write_strategy != H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY) &&
+ (config_ptr->metadata_write_strategy != H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->metadata_write_strategy out of range")
- if(H5AC__ext_config_2_int_config(config_ptr, &internal_config) < 0)
+ if (H5AC__ext_config_2_int_config(config_ptr, &internal_config) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__ext_config_2_int_config() failed")
- if(H5C_validate_resize_config(&internal_config, H5C_RESIZE_CFG__VALIDATE_ALL) < 0)
+ if (H5C_validate_resize_config(&internal_config, H5C_RESIZE_CFG__VALIDATE_ALL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "error(s) in new config")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_validate_config() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_validate_cache_image_config()
*
@@ -2147,15 +2088,15 @@ herr_t
H5AC_validate_cache_image_config(H5AC_cache_image_config_t *config_ptr)
{
H5C_cache_image_ctl_t internal_config = H5C__DEFAULT_CACHE_IMAGE_CTL;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- if(config_ptr == NULL)
+ if (config_ptr == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "NULL config_ptr on entry")
- if(config_ptr->version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION)
+ if (config_ptr->version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Unknown image config version")
/* don't need to get the current H5C image config here since the
@@ -2167,14 +2108,13 @@ H5AC_validate_cache_image_config(H5AC_cache_image_config_t *config_ptr)
internal_config.save_resize_status = config_ptr->save_resize_status;
internal_config.entry_ageout = config_ptr->entry_ageout;
- if(H5C_validate_cache_image_config(&internal_config) < 0)
+ if (H5C_validate_cache_image_config(&internal_config) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "error(s) in new cache image config")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_validate_cache_image_config() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC__check_if_write_permitted
@@ -2197,14 +2137,15 @@ done:
static herr_t
H5AC__check_if_write_permitted(const H5F_t
#ifndef H5_HAVE_PARALLEL
-H5_ATTR_UNUSED
+ H5_ATTR_UNUSED
#endif /* H5_HAVE_PARALLEL */
- *f, hbool_t *write_permitted_ptr)
+ *f,
+ hbool_t *write_permitted_ptr)
{
#ifdef H5_HAVE_PARALLEL
- H5AC_aux_t * aux_ptr = NULL;
+ H5AC_aux_t *aux_ptr = NULL;
#endif /* H5_HAVE_PARALLEL */
- hbool_t write_permitted = TRUE;
+ hbool_t write_permitted = TRUE;
FUNC_ENTER_STATIC_NOERR
@@ -2214,14 +2155,15 @@ H5_ATTR_UNUSED
HDassert(f->shared != NULL);
HDassert(f->shared->cache != NULL);
aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache);
- if(aux_ptr != NULL) {
+ if (aux_ptr != NULL) {
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
- if((aux_ptr->mpi_rank == 0) || (aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED))
+ if ((aux_ptr->mpi_rank == 0) ||
+ (aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED))
write_permitted = aux_ptr->write_permitted;
else
write_permitted = FALSE;
- } /* end if */
+ } /* end if */
#endif /* H5_HAVE_PARALLEL */
*write_permitted_ptr = write_permitted;
@@ -2229,7 +2171,6 @@ H5_ATTR_UNUSED
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5AC__check_if_write_permitted() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__ext_config_2_int_config()
*
@@ -2249,38 +2190,37 @@ H5_ATTR_UNUSED
*-------------------------------------------------------------------------
*/
static herr_t
-H5AC__ext_config_2_int_config(H5AC_cache_config_t *ext_conf_ptr,
- H5C_auto_size_ctl_t *int_conf_ptr)
+H5AC__ext_config_2_int_config(H5AC_cache_config_t *ext_conf_ptr, H5C_auto_size_ctl_t *int_conf_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
- if((ext_conf_ptr == NULL) || (ext_conf_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION) ||
- (int_conf_ptr == NULL))
+ if ((ext_conf_ptr == NULL) || (ext_conf_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION) ||
+ (int_conf_ptr == NULL))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad ext_conf_ptr or inf_conf_ptr on entry")
- int_conf_ptr->version = H5C__CURR_AUTO_SIZE_CTL_VER;
- if(ext_conf_ptr->rpt_fcn_enabled)
- int_conf_ptr->rpt_fcn = H5C_def_auto_resize_rpt_fcn;
+ int_conf_ptr->version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ if (ext_conf_ptr->rpt_fcn_enabled)
+ int_conf_ptr->rpt_fcn = H5C_def_auto_resize_rpt_fcn;
else
- int_conf_ptr->rpt_fcn = NULL;
-
- int_conf_ptr->set_initial_size = ext_conf_ptr->set_initial_size;
- int_conf_ptr->initial_size = ext_conf_ptr->initial_size;
- int_conf_ptr->min_clean_fraction = ext_conf_ptr->min_clean_fraction;
- int_conf_ptr->max_size = ext_conf_ptr->max_size;
- int_conf_ptr->min_size = ext_conf_ptr->min_size;
- int_conf_ptr->epoch_length = (int64_t)(ext_conf_ptr->epoch_length);
-
- int_conf_ptr->incr_mode = ext_conf_ptr->incr_mode;
- int_conf_ptr->lower_hr_threshold = ext_conf_ptr->lower_hr_threshold;
- int_conf_ptr->increment = ext_conf_ptr->increment;
- int_conf_ptr->apply_max_increment = ext_conf_ptr->apply_max_increment;
- int_conf_ptr->max_increment = ext_conf_ptr->max_increment;
- int_conf_ptr->flash_incr_mode = ext_conf_ptr->flash_incr_mode;
- int_conf_ptr->flash_multiple = ext_conf_ptr->flash_multiple;
- int_conf_ptr->flash_threshold = ext_conf_ptr->flash_threshold;
+ int_conf_ptr->rpt_fcn = NULL;
+
+ int_conf_ptr->set_initial_size = ext_conf_ptr->set_initial_size;
+ int_conf_ptr->initial_size = ext_conf_ptr->initial_size;
+ int_conf_ptr->min_clean_fraction = ext_conf_ptr->min_clean_fraction;
+ int_conf_ptr->max_size = ext_conf_ptr->max_size;
+ int_conf_ptr->min_size = ext_conf_ptr->min_size;
+ int_conf_ptr->epoch_length = (int64_t)(ext_conf_ptr->epoch_length);
+
+ int_conf_ptr->incr_mode = ext_conf_ptr->incr_mode;
+ int_conf_ptr->lower_hr_threshold = ext_conf_ptr->lower_hr_threshold;
+ int_conf_ptr->increment = ext_conf_ptr->increment;
+ int_conf_ptr->apply_max_increment = ext_conf_ptr->apply_max_increment;
+ int_conf_ptr->max_increment = ext_conf_ptr->max_increment;
+ int_conf_ptr->flash_incr_mode = ext_conf_ptr->flash_incr_mode;
+ int_conf_ptr->flash_multiple = ext_conf_ptr->flash_multiple;
+ int_conf_ptr->flash_threshold = ext_conf_ptr->flash_threshold;
int_conf_ptr->decr_mode = ext_conf_ptr->decr_mode;
int_conf_ptr->upper_hr_threshold = ext_conf_ptr->upper_hr_threshold;
@@ -2295,7 +2235,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__ext_config_2_int_config() */
-
/*------------------------------------------------------------------------------
* Function: H5AC_ignore_tags()
*
@@ -2314,7 +2253,7 @@ done:
herr_t
H5AC_ignore_tags(const H5F_t *f)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
@@ -2324,14 +2263,13 @@ H5AC_ignore_tags(const H5F_t *f)
HDassert(f->shared->cache);
/* Set up a new metadata tag */
- if(H5C_ignore_tags(f->shared->cache) < 0)
+ if (H5C_ignore_tags(f->shared->cache) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "H5C_ignore_tags() failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_ignore_tags() */
-
/*------------------------------------------------------------------------------
* Function: H5AC_tag()
*
@@ -2350,7 +2288,7 @@ H5AC_tag(haddr_t metadata_tag, haddr_t *prev_tag)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Get the current tag value and return that (if prev_tag is NOT null) */
- if(prev_tag)
+ if (prev_tag)
*prev_tag = H5CX_get_tag();
/* Set the provided tag */
@@ -2359,7 +2297,6 @@ H5AC_tag(haddr_t metadata_tag, haddr_t *prev_tag)
FUNC_LEAVE_NOAPI_VOID
} /* H5AC_tag */
-
/*------------------------------------------------------------------------------
* Function: H5AC_retag_copied_metadata()
*
@@ -2377,7 +2314,7 @@ H5AC_tag(haddr_t metadata_tag, haddr_t *prev_tag)
herr_t
H5AC_retag_copied_metadata(const H5F_t *f, haddr_t metadata_tag)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2386,14 +2323,13 @@ H5AC_retag_copied_metadata(const H5F_t *f, haddr_t metadata_tag)
HDassert(f->shared);
/* Call cache-level function to re-tag entries with the COPIED tag */
- if(H5C_retag_entries(f->shared->cache, H5AC__COPIED_TAG, metadata_tag) < 0)
+ if (H5C_retag_entries(f->shared->cache, H5AC__COPIED_TAG, metadata_tag) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "Can't retag metadata")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_retag_copied_metadata() */
-
/*------------------------------------------------------------------------------
* Function: H5AC_flush_tagged_metadata()
*
@@ -2421,14 +2357,13 @@ H5AC_flush_tagged_metadata(H5F_t *f, haddr_t metadata_tag)
HDassert(f->shared);
/* Call cache level function to flush metadata entries with specified tag */
- if(H5C_flush_tagged_entries(f, metadata_tag) < 0)
+ if (H5C_flush_tagged_entries(f, metadata_tag) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cannot flush metadata")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_flush_tagged_metadata */
-
/*------------------------------------------------------------------------------
* Function: H5AC_evict_tagged_metadata()
*
@@ -2456,14 +2391,13 @@ H5AC_evict_tagged_metadata(H5F_t *f, haddr_t metadata_tag, hbool_t match_global)
HDassert(f->shared);
/* Call cache level function to evict metadata entries with specified tag */
- if(H5C_evict_tagged_entries(f, metadata_tag, match_global) < 0)
+ if (H5C_evict_tagged_entries(f, metadata_tag, match_global) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cannot evict metadata")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_evict_tagged_metadata() */
-
/*------------------------------------------------------------------------------
* Function: H5AC_expunge_tag_type_metadata()
*
@@ -2490,14 +2424,13 @@ H5AC_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flag
HDassert(f->shared);
/* Call cache level function to expunge entries with specified tag and type id */
- if(H5C_expunge_tag_type_metadata(f, tag, type_id, flags) < 0)
+ if (H5C_expunge_tag_type_metadata(f, tag, type_id, flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cannot expunge tagged type entries")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_expunge_tag_type_metadata*/
-
/*------------------------------------------------------------------------------
* Function: H5AC_get_tag()
*
@@ -2524,14 +2457,13 @@ H5AC_get_tag(const void *thing, haddr_t *tag)
HDassert(tag);
/* Call cache level function to get the tag */
- if(H5C_get_tag(thing, tag) < 0)
+ if (H5C_get_tag(thing, tag) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Cannot get tag for metadata cache entry")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5AC_get_tag() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_cork
*
@@ -2546,7 +2478,7 @@ done:
herr_t
H5AC_cork(H5F_t *f, haddr_t obj_addr, unsigned action, hbool_t *corked)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2562,15 +2494,15 @@ H5AC_cork(H5F_t *f, haddr_t obj_addr, unsigned action, hbool_t *corked)
* Re-visit this optimization when we optimize tag info management
* in the future.
*/
- if(action == H5AC__GET_CORKED) {
+ if (action == H5AC__GET_CORKED) {
HDassert(corked);
- if(H5C_get_num_objs_corked(f->shared->cache) == 0) {
+ if (H5C_get_num_objs_corked(f->shared->cache) == 0) {
*corked = FALSE;
HGOTO_DONE(SUCCEED)
}
}
- if(H5C_cork(f->shared->cache, obj_addr, action, corked) < 0)
+ if (H5C_cork(f->shared->cache, obj_addr, action, corked) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Cannot perform the cork action")
done:
@@ -2578,7 +2510,7 @@ done:
} /* H5AC_cork() */
#if H5AC_DO_TAGGING_SANITY_CHECKS
-
+
/*-------------------------------------------------------------------------
*
* Function: H5AC__verify_tag
@@ -2596,8 +2528,8 @@ done:
static herr_t
H5AC__verify_tag(const H5AC_class_t *type)
{
- haddr_t tag; /* Entry tag to validate */
- herr_t ret_value = SUCCEED; /* Return value */
+ haddr_t tag; /* Entry tag to validate */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2605,7 +2537,7 @@ H5AC__verify_tag(const H5AC_class_t *type)
tag = H5CX_get_tag();
/* Verify legal tag value */
- if(H5C_verify_tag(type->id, tag) < 0)
+ if (H5C_verify_tag(type->id, tag) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "tag verification failed")
done:
@@ -2613,7 +2545,6 @@ done:
} /* H5AC__verify_tag */
#endif /* H5AC_DO_TAGGING_SANITY_CHECKS */
-
/*-------------------------------------------------------------------------
* Function: H5AC_get_entry_ring
*
@@ -2632,7 +2563,7 @@ done:
herr_t
H5AC_get_entry_ring(const H5F_t *f, haddr_t addr, H5AC_ring_t *ring)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2642,14 +2573,13 @@ H5AC_get_entry_ring(const H5F_t *f, haddr_t addr, H5AC_ring_t *ring)
HDassert(ring);
/* Retrieve the ring value for the entry at address */
- if(H5C_get_entry_ring(f, addr, ring) < 0)
+ if (H5C_get_entry_ring(f, addr, ring) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "Can't retrieve ring for entry")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_get_entry_ring() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_set_ring
*
@@ -2671,7 +2601,7 @@ H5AC_set_ring(H5AC_ring_t ring, H5AC_ring_t *orig_ring)
/* Note: orig_ring can be NULL so don't check it with HDassert() */
/* Get the current ring value and return that (if orig_ring is NOT null) */
- if(orig_ring)
+ if (orig_ring)
*orig_ring = H5CX_get_ring();
/* Set the provided ring */
@@ -2680,7 +2610,6 @@ H5AC_set_ring(H5AC_ring_t ring, H5AC_ring_t *orig_ring)
FUNC_LEAVE_NOAPI_VOID
} /* end H5AC_set_ring() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_unsettle_entry_ring()
*
@@ -2712,8 +2641,8 @@ H5AC_set_ring(H5AC_ring_t ring, H5AC_ring_t *orig_ring)
herr_t
H5AC_unsettle_entry_ring(void *_entry)
{
- H5AC_info_t *entry = (H5AC_info_t *)_entry; /* Entry to remove */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_info_t *entry = (H5AC_info_t *)_entry; /* Entry to remove */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2721,14 +2650,13 @@ H5AC_unsettle_entry_ring(void *_entry)
HDassert(entry);
/* Unsettle the entry's ring */
- if(H5C_unsettle_entry_ring(entry) < 0)
+ if (H5C_unsettle_entry_ring(entry) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_unsettle_entry_ring() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_unsettle_ring()
*
@@ -2757,20 +2685,19 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_unsettle_ring(H5F_t * f, H5C_ring_t ring)
+H5AC_unsettle_ring(H5F_t *f, H5C_ring_t ring)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if(FAIL == (ret_value = H5C_unsettle_ring(f, ring)))
+ if (FAIL == (ret_value = H5C_unsettle_ring(f, ring)))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_unsettle_ring() failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_unsettle_ring() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_remove_entry()
*
@@ -2787,9 +2714,9 @@ done:
herr_t
H5AC_remove_entry(void *_entry)
{
- H5AC_info_t *entry = (H5AC_info_t *)_entry; /* Entry to remove */
- H5C_t *cache = NULL; /* Pointer to the entry's associated metadata cache */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_info_t *entry = (H5AC_info_t *)_entry; /* Entry to remove */
+ H5C_t * cache = NULL; /* Pointer to the entry's associated metadata cache */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2799,20 +2726,19 @@ H5AC_remove_entry(void *_entry)
HDassert(cache);
/* Remove the entry from the cache*/
- if(H5C_remove_entry(entry) < 0)
+ if (H5C_remove_entry(entry) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry")
done:
/* If currently logging, generate a message */
- if(cache != NULL && cache->log_info != NULL)
- if(cache->log_info->logging)
- if(H5C_log_write_remove_entry_msg(cache, entry, ret_value) < 0)
+ if (cache != NULL && cache->log_info != NULL)
+ if (cache->log_info->logging)
+ if (H5C_log_write_remove_entry_msg(cache, entry, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_remove_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_get_mdc_image_info
*
@@ -2827,11 +2753,11 @@ done:
herr_t
H5AC_get_mdc_image_info(H5AC_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if(H5C_get_mdc_image_info((H5C_t *)cache_ptr, image_addr, image_len) < 0)
+ if (H5C_get_mdc_image_info((H5C_t *)cache_ptr, image_addr, image_len) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
done:
diff --git a/src/H5ACdbg.c b/src/H5ACdbg.c
index 94f3d83..1aafe56 100644
--- a/src/H5ACdbg.c
+++ b/src/H5ACdbg.c
@@ -23,54 +23,45 @@
/****************/
/* Module Setup */
/****************/
-#include "H5ACmodule.h" /* This source code file is part of the H5AC module */
-#define H5F_FRIEND /* Suppress error about including H5Fpkg */
+#include "H5ACmodule.h" /* This source code file is part of the H5AC module */
+#define H5F_FRIEND /* Suppress error about including H5Fpkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACpkg.h" /* Metadata cache */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* Files */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5ACpkg.h" /* Metadata cache */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5AC_stats
*
@@ -100,7 +91,7 @@ H5AC_stats(const H5F_t *f)
} /* H5AC_stats() */
#ifndef NDEBUG
-
+
/*-------------------------------------------------------------------------
* Function: H5AC_dump_cache
*
@@ -117,7 +108,7 @@ H5AC_stats(const H5F_t *f)
herr_t
H5AC_dump_cache(const H5F_t *f)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -126,7 +117,7 @@ H5AC_dump_cache(const H5F_t *f)
HDassert(f->shared);
HDassert(f->shared->cache);
- if(H5C_dump_cache(f->shared->cache, H5F_OPEN_NAME(f)) < 0)
+ if (H5C_dump_cache(f->shared->cache, H5F_OPEN_NAME(f)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_dump_cache() failed.")
done:
@@ -134,7 +125,6 @@ done:
} /* H5AC_dump_cache() */
#endif /* NDEBUG */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC_get_entry_ptr_from_addr()
@@ -178,8 +168,8 @@ done:
herr_t
H5AC_get_entry_ptr_from_addr(const H5F_t *f, haddr_t addr, void **entry_ptr_ptr)
{
- H5C_t *cache_ptr; /* Ptr to cache */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t *cache_ptr; /* Ptr to cache */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -188,7 +178,7 @@ H5AC_get_entry_ptr_from_addr(const H5F_t *f, haddr_t addr, void **entry_ptr_ptr)
HDassert(f->shared);
cache_ptr = f->shared->cache;
- if(H5C_get_entry_ptr_from_addr(cache_ptr, addr, entry_ptr_ptr) < 0)
+ if (H5C_get_entry_ptr_from_addr(cache_ptr, addr, entry_ptr_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_entry_ptr_from_addr() failed")
done:
@@ -196,7 +186,6 @@ done:
} /* H5AC_get_entry_ptr_from_addr() */
#endif /* NDEBUG */
-
/*-------------------------------------------------------------------------
* Function: H5AC_flush_dependency_exists()
*
@@ -224,11 +213,10 @@ done:
*/
#ifndef NDEBUG
herr_t
-H5AC_flush_dependency_exists(H5F_t *f, haddr_t parent_addr, haddr_t child_addr,
- hbool_t *fd_exists_ptr)
+H5AC_flush_dependency_exists(H5F_t *f, haddr_t parent_addr, haddr_t child_addr, hbool_t *fd_exists_ptr)
{
- H5C_t *cache_ptr; /* Ptr to cache */
- herr_t ret_value = FAIL; /* Return value */
+ H5C_t *cache_ptr; /* Ptr to cache */
+ herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -243,7 +231,6 @@ H5AC_flush_dependency_exists(H5F_t *f, haddr_t parent_addr, haddr_t child_addr,
} /* H5AC_flush_dependency_exists() */
#endif /* NDEBUG */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC_verify_entry_type()
@@ -274,12 +261,11 @@ H5AC_flush_dependency_exists(H5F_t *f, haddr_t parent_addr, haddr_t child_addr,
*/
#ifndef NDEBUG
herr_t
-H5AC_verify_entry_type(const H5F_t *f, haddr_t addr,
- const H5AC_class_t *expected_type, hbool_t *in_cache_ptr,
- hbool_t *type_ok_ptr)
+H5AC_verify_entry_type(const H5F_t *f, haddr_t addr, const H5AC_class_t *expected_type, hbool_t *in_cache_ptr,
+ hbool_t *type_ok_ptr)
{
- H5C_t * cache_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t *cache_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -288,7 +274,7 @@ H5AC_verify_entry_type(const H5F_t *f, haddr_t addr,
HDassert(f->shared);
cache_ptr = f->shared->cache;
- if(H5C_verify_entry_type(cache_ptr, addr, expected_type, in_cache_ptr, type_ok_ptr) < 0)
+ if (H5C_verify_entry_type(cache_ptr, addr, expected_type, in_cache_ptr, type_ok_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_verify_entry_type() failed")
done:
@@ -296,7 +282,6 @@ done:
} /* H5AC_verify_entry_type() */
#endif /* NDEBUG */
-
/*-------------------------------------------------------------------------
* Function: H5AC_get_serialization_in_progress
*
@@ -315,7 +300,7 @@ hbool_t
H5AC_get_serialization_in_progress(H5F_t *f)
{
H5C_t * cache_ptr;
- hbool_t ret_value = FALSE; /* Return value */
+ hbool_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -331,7 +316,6 @@ H5AC_get_serialization_in_progress(H5F_t *f)
} /* H5AC_get_serialization_in_progress() */
#endif /* NDEBUG */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC_cache_is_clean()
@@ -353,8 +337,8 @@ H5AC_get_serialization_in_progress(H5F_t *f)
hbool_t
H5AC_cache_is_clean(const H5F_t *f, H5AC_ring_t inner_ring)
{
- H5C_t *cache_ptr;
- hbool_t ret_value = FALSE; /* Return value */
+ H5C_t * cache_ptr;
+ hbool_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -368,4 +352,3 @@ H5AC_cache_is_clean(const H5F_t *f, H5AC_ring_t inner_ring)
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_cache_is_clean() */
#endif /* NDEBUG */
-
diff --git a/src/H5ACmodule.h b/src/H5ACmodule.h
index 8c6eae2..ec2c6fd 100644
--- a/src/H5ACmodule.h
+++ b/src/H5ACmodule.h
@@ -25,9 +25,8 @@
* reporting macros.
*/
#define H5AC_MODULE
-#define H5_MY_PKG H5AC
-#define H5_MY_PKG_ERR H5E_CACHE
-#define H5_MY_PKG_INIT YES
+#define H5_MY_PKG H5AC
+#define H5_MY_PKG_ERR H5E_CACHE
+#define H5_MY_PKG_INIT YES
#endif /* _H5ACmodule_H */
-
diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c
index 7474460..a806b35 100644
--- a/src/H5ACmpio.c
+++ b/src/H5ACmpio.c
@@ -27,20 +27,19 @@
/* Module Setup */
/****************/
-#include "H5ACmodule.h" /* This source code file is part of the H5AC module */
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
-
+#include "H5ACmodule.h" /* This source code file is part of the H5AC module */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACpkg.h" /* Metadata cache */
-#include "H5Cprivate.h" /* Cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* Files */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACpkg.h" /* Metadata cache */
+#include "H5Cprivate.h" /* Cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
+#include "H5MMprivate.h" /* Memory management */
#ifdef H5_HAVE_PARALLEL
@@ -48,7 +47,6 @@
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
@@ -70,46 +68,41 @@
* removed when they appear in a clean entries broadcast.
*
****************************************************************************/
-typedef struct H5AC_slist_entry_t
-{
- haddr_t addr;
+typedef struct H5AC_slist_entry_t {
+ haddr_t addr;
} H5AC_slist_entry_t;
/* User data for address list building callbacks */
-typedef struct H5AC_addr_list_ud_t
-{
- H5AC_aux_t * aux_ptr; /* 'Auxiliary' parallel cache info */
- haddr_t * addr_buf_ptr; /* Array to store addresses */
- unsigned u; /* Counter for position in array */
+typedef struct H5AC_addr_list_ud_t {
+ H5AC_aux_t *aux_ptr; /* 'Auxiliary' parallel cache info */
+ haddr_t * addr_buf_ptr; /* Array to store addresses */
+ unsigned u; /* Counter for position in array */
} H5AC_addr_list_ud_t;
-
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5AC__broadcast_candidate_list(H5AC_t *cache_ptr,
- unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr);
+static herr_t H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, unsigned *num_entries_ptr,
+ haddr_t **haddr_buf_ptr_ptr);
static herr_t H5AC__broadcast_clean_list(H5AC_t *cache_ptr);
-static herr_t H5AC__construct_candidate_list(H5AC_t *cache_ptr,
- H5AC_aux_t *aux_ptr, int sync_point_op);
-static herr_t H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr,
- unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr);
-static herr_t H5AC__propagate_and_apply_candidate_list(H5F_t *f);
-static herr_t H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f);
+static herr_t H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t *aux_ptr, int sync_point_op);
+static herr_t H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, unsigned *num_entries_ptr,
+ haddr_t **haddr_buf_ptr_ptr);
+static herr_t H5AC__propagate_and_apply_candidate_list(H5F_t *f);
+static herr_t H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f);
static herr_t H5AC__receive_haddr_list(MPI_Comm mpi_comm, unsigned *num_entries_ptr,
- haddr_t **haddr_buf_ptr_ptr);
-static herr_t H5AC__receive_candidate_list(const H5AC_t *cache_ptr,
- unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr);
+ haddr_t **haddr_buf_ptr_ptr);
+static herr_t H5AC__receive_candidate_list(const H5AC_t *cache_ptr, unsigned *num_entries_ptr,
+ haddr_t **haddr_buf_ptr_ptr);
static herr_t H5AC__receive_and_apply_clean_list(H5F_t *f);
static herr_t H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates,
- haddr_t *candidates_list_ptr);
+ haddr_t *candidates_list_ptr);
static herr_t H5AC__rsp__dist_md_write__flush(H5F_t *f);
static herr_t H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f);
static herr_t H5AC__rsp__p0_only__flush(H5F_t *f);
static herr_t H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f);
-
/*********************/
/* Package Variables */
/*********************/
@@ -117,12 +110,10 @@ static herr_t H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f);
/* Declare a free list to manage the H5AC_aux_t struct */
H5FL_DEFINE(H5AC_aux_t);
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -130,8 +121,6 @@ H5FL_DEFINE(H5AC_aux_t);
/* Declare a free list to manage the H5AC_slist_entry_t struct */
H5FL_DEFINE_STATIC(H5AC_slist_entry_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5AC__set_sync_point_done_callback
*
@@ -148,10 +137,10 @@ H5FL_DEFINE_STATIC(H5AC_slist_entry_t);
*-------------------------------------------------------------------------
*/
herr_t
-H5AC__set_sync_point_done_callback(H5C_t * cache_ptr,
- void (* sync_point_done)(unsigned num_writes, haddr_t * written_entries_tbl))
+H5AC__set_sync_point_done_callback(H5C_t *cache_ptr,
+ void (*sync_point_done)(unsigned num_writes, haddr_t *written_entries_tbl))
{
- H5AC_aux_t * aux_ptr;
+ H5AC_aux_t *aux_ptr;
FUNC_ENTER_PACKAGE_NOERR
@@ -166,7 +155,6 @@ H5AC__set_sync_point_done_callback(H5C_t * cache_ptr,
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5AC__set_sync_point_done_callback() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__set_write_done_callback
*
@@ -182,9 +170,9 @@ H5AC__set_sync_point_done_callback(H5C_t * cache_ptr,
*-------------------------------------------------------------------------
*/
herr_t
-H5AC__set_write_done_callback(H5C_t * cache_ptr, void (* write_done)(void))
+H5AC__set_write_done_callback(H5C_t *cache_ptr, void (*write_done)(void))
{
- H5AC_aux_t * aux_ptr;
+ H5AC_aux_t *aux_ptr;
FUNC_ENTER_PACKAGE_NOERR
@@ -199,7 +187,6 @@ H5AC__set_write_done_callback(H5C_t * cache_ptr, void (* write_done)(void))
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5AC__set_write_done_callback() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_add_candidate()
*
@@ -219,11 +206,11 @@ H5AC__set_write_done_callback(H5C_t * cache_ptr, void (* write_done)(void))
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_add_candidate(H5AC_t * cache_ptr, haddr_t addr)
+H5AC_add_candidate(H5AC_t *cache_ptr, haddr_t addr)
{
- H5AC_aux_t * aux_ptr;
- H5AC_slist_entry_t * slist_entry_ptr = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_aux_t * aux_ptr;
+ H5AC_slist_entry_t *slist_entry_ptr = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -238,23 +225,22 @@ H5AC_add_candidate(H5AC_t * cache_ptr, haddr_t addr)
/* Construct an entry for the supplied address, and insert
* it into the candidate slist.
*/
- if(NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t)))
+ if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate candidate slist entry")
- slist_entry_ptr->addr = addr;
+ slist_entry_ptr->addr = addr;
- if(H5SL_insert(aux_ptr->candidate_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0)
+ if (H5SL_insert(aux_ptr->candidate_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist")
done:
/* Clean up on error */
- if(ret_value < 0)
- if(slist_entry_ptr)
+ if (ret_value < 0)
+ if (slist_entry_ptr)
slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_add_candidate() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC__broadcast_candidate_list()
@@ -280,14 +266,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, unsigned *num_entries_ptr,
- haddr_t **haddr_buf_ptr_ptr)
+H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr)
{
- H5AC_aux_t * aux_ptr = NULL;
- haddr_t * haddr_buf_ptr = NULL;
- int mpi_result;
- unsigned num_entries;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_aux_t *aux_ptr = NULL;
+ haddr_t * haddr_buf_ptr = NULL;
+ int mpi_result;
+ unsigned num_entries;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -309,25 +294,26 @@ H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, unsigned *num_entries_ptr,
* any, we are done.
*/
num_entries = (unsigned)H5SL_count(aux_ptr->candidate_slist_ptr);
- if(MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_UNSIGNED, 0, aux_ptr->mpi_comm)))
+ if (MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_UNSIGNED, 0, aux_ptr->mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result)
- if(num_entries > 0) {
- size_t buf_size = 0;
- unsigned chk_num_entries = 0;
+ if (num_entries > 0) {
+ size_t buf_size = 0;
+ unsigned chk_num_entries = 0;
/* convert the candidate list into the format we
* are used to receiving from process 0, and also load it
* into a buffer for transmission.
*/
- if(H5AC__copy_candidate_list_to_buffer(cache_ptr, &chk_num_entries, &haddr_buf_ptr) < 0)
+ if (H5AC__copy_candidate_list_to_buffer(cache_ptr, &chk_num_entries, &haddr_buf_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate buffer.")
HDassert(chk_num_entries == num_entries);
HDassert(haddr_buf_ptr != NULL);
/* Now broadcast the list of candidate entries */
buf_size = sizeof(haddr_t) * num_entries;
- if(MPI_SUCCESS != (mpi_result = MPI_Bcast((void *)haddr_buf_ptr, (int)buf_size, MPI_BYTE, 0, aux_ptr->mpi_comm)))
+ if (MPI_SUCCESS !=
+ (mpi_result = MPI_Bcast((void *)haddr_buf_ptr, (int)buf_size, MPI_BYTE, 0, aux_ptr->mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result)
} /* end if */
@@ -335,18 +321,17 @@ H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, unsigned *num_entries_ptr,
* back to the caller. Do this so that we can use the same code
* to apply the candidate list to all the processes.
*/
- *num_entries_ptr = num_entries;
+ *num_entries_ptr = num_entries;
*haddr_buf_ptr_ptr = haddr_buf_ptr;
done:
- if(ret_value < 0)
- if(haddr_buf_ptr)
+ if (ret_value < 0)
+ if (haddr_buf_ptr)
haddr_buf_ptr = (haddr_t *)H5MM_xfree((void *)haddr_buf_ptr);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__broadcast_candidate_list() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC__broadcast_clean_list_cb()
@@ -361,12 +346,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5AC__broadcast_clean_list_cb(void *_item, void H5_ATTR_UNUSED *_key,
- void *_udata)
+H5AC__broadcast_clean_list_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
{
- H5AC_slist_entry_t * slist_entry_ptr = (H5AC_slist_entry_t *)_item; /* Address of item */
- H5AC_addr_list_ud_t * udata = (H5AC_addr_list_ud_t *)_udata; /* Context for callback */
- haddr_t addr;
+ H5AC_slist_entry_t * slist_entry_ptr = (H5AC_slist_entry_t *)_item; /* Address of item */
+ H5AC_addr_list_ud_t *udata = (H5AC_addr_list_ud_t *)_udata; /* Context for callback */
+ haddr_t addr;
FUNC_ENTER_STATIC_NOERR
@@ -375,7 +359,7 @@ H5AC__broadcast_clean_list_cb(void *_item, void H5_ATTR_UNUSED *_key,
HDassert(udata);
/* Store the entry's address in the buffer */
- addr = slist_entry_ptr->addr;
+ addr = slist_entry_ptr->addr;
udata->addr_buf_ptr[udata->u] = addr;
udata->u++;
@@ -385,13 +369,13 @@ H5AC__broadcast_clean_list_cb(void *_item, void H5_ATTR_UNUSED *_key,
/* and also remove the matching entry from the dirtied list
* if it exists.
*/
- if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(udata->aux_ptr->d_slist_ptr, (void *)(&addr))))
+ if (NULL !=
+ (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(udata->aux_ptr->d_slist_ptr, (void *)(&addr))))
slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5AC__broadcast_clean_list_cb() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC__broadcast_clean_list()
@@ -413,13 +397,13 @@ H5AC__broadcast_clean_list_cb(void *_item, void H5_ATTR_UNUSED *_key,
*-------------------------------------------------------------------------
*/
static herr_t
-H5AC__broadcast_clean_list(H5AC_t * cache_ptr)
+H5AC__broadcast_clean_list(H5AC_t *cache_ptr)
{
- haddr_t * addr_buf_ptr = NULL;
- H5AC_aux_t * aux_ptr;
- int mpi_result;
- unsigned num_entries = 0;
- herr_t ret_value = SUCCEED; /* Return value */
+ haddr_t * addr_buf_ptr = NULL;
+ H5AC_aux_t *aux_ptr;
+ int mpi_result;
+ unsigned num_entries = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -436,30 +420,31 @@ H5AC__broadcast_clean_list(H5AC_t * cache_ptr)
* any, we are done.
*/
num_entries = (unsigned)H5SL_count(aux_ptr->c_slist_ptr);
- if(MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_UNSIGNED, 0, aux_ptr->mpi_comm)))
+ if (MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_UNSIGNED, 0, aux_ptr->mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result)
- if(num_entries > 0) {
+ if (num_entries > 0) {
H5AC_addr_list_ud_t udata;
- size_t buf_size;
+ size_t buf_size;
/* allocate a buffer to store the list of entry base addresses in */
buf_size = sizeof(haddr_t) * num_entries;
- if(NULL == (addr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size)))
+ if (NULL == (addr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for addr buffer")
/* Set up user data for callback */
- udata.aux_ptr = aux_ptr;
+ udata.aux_ptr = aux_ptr;
udata.addr_buf_ptr = addr_buf_ptr;
- udata.u = 0;
+ udata.u = 0;
/* Free all the clean list entries, building the address list in the callback */
/* (Callback also removes the matching entries from the dirtied list) */
- if(H5SL_free(aux_ptr->c_slist_ptr, H5AC__broadcast_clean_list_cb, &udata) < 0)
+ if (H5SL_free(aux_ptr->c_slist_ptr, H5AC__broadcast_clean_list_cb, &udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "Can't build address list for clean entries")
/* Now broadcast the list of cleaned entries */
- if(MPI_SUCCESS != (mpi_result = MPI_Bcast((void *)addr_buf_ptr, (int)buf_size, MPI_BYTE, 0, aux_ptr->mpi_comm)))
+ if (MPI_SUCCESS !=
+ (mpi_result = MPI_Bcast((void *)addr_buf_ptr, (int)buf_size, MPI_BYTE, 0, aux_ptr->mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result)
} /* end if */
@@ -467,17 +452,16 @@ H5AC__broadcast_clean_list(H5AC_t * cache_ptr)
* that this callback is defined purely for testing purposes,
* and should be undefined under normal operating circumstances.
*/
- if(aux_ptr->sync_point_done)
+ if (aux_ptr->sync_point_done)
(aux_ptr->sync_point_done)(num_entries, addr_buf_ptr);
done:
- if(addr_buf_ptr)
+ if (addr_buf_ptr)
addr_buf_ptr = (haddr_t *)H5MM_xfree((void *)addr_buf_ptr);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__broadcast_clean_list() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__construct_candidate_list()
*
@@ -499,9 +483,9 @@ done:
*/
static herr_t
H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t H5_ATTR_NDEBUG_UNUSED *aux_ptr,
- int sync_point_op)
+ int sync_point_op)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -516,29 +500,30 @@ H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t H5_ATTR_NDEBUG_UNUS
HDassert(H5SL_count(aux_ptr->c_slist_ptr) == 0);
HDassert(aux_ptr->candidate_slist_ptr != NULL);
HDassert(H5SL_count(aux_ptr->candidate_slist_ptr) == 0);
- HDassert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) || (sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_CACHE));
+ HDassert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) ||
+ (sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_CACHE));
- switch(sync_point_op) {
- case H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN:
- if(H5C_construct_candidate_list__min_clean((H5C_t *)cache_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_construct_candidate_list__min_clean() failed.")
- break;
+ switch (sync_point_op) {
+ case H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN:
+ if (H5C_construct_candidate_list__min_clean((H5C_t *)cache_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_construct_candidate_list__min_clean() failed.")
+ break;
- case H5AC_SYNC_POINT_OP__FLUSH_CACHE:
- if(H5C_construct_candidate_list__clean_cache((H5C_t *)cache_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_construct_candidate_list__clean_cache() failed.")
- break;
+ case H5AC_SYNC_POINT_OP__FLUSH_CACHE:
+ if (H5C_construct_candidate_list__clean_cache((H5C_t *)cache_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL,
+ "H5C_construct_candidate_list__clean_cache() failed.")
+ break;
default:
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown sync point operation.")
- break;
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown sync point operation.")
+ break;
} /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__construct_candidate_list() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC__copy_candidate_list_to_buffer_cb
@@ -553,11 +538,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5AC__copy_candidate_list_to_buffer_cb(void *_item, void H5_ATTR_UNUSED *_key,
- void *_udata)
+H5AC__copy_candidate_list_to_buffer_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
{
- H5AC_slist_entry_t * slist_entry_ptr = (H5AC_slist_entry_t *)_item; /* Address of item */
- H5AC_addr_list_ud_t * udata = (H5AC_addr_list_ud_t *)_udata; /* Context for callback */
+ H5AC_slist_entry_t * slist_entry_ptr = (H5AC_slist_entry_t *)_item; /* Address of item */
+ H5AC_addr_list_ud_t *udata = (H5AC_addr_list_ud_t *)_udata; /* Context for callback */
FUNC_ENTER_STATIC_NOERR
@@ -575,7 +559,6 @@ H5AC__copy_candidate_list_to_buffer_cb(void *_item, void H5_ATTR_UNUSED *_key,
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5AC__copy_candidate_list_to_buffer_cb() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC__copy_candidate_list_to_buffer
@@ -609,14 +592,14 @@ H5AC__copy_candidate_list_to_buffer_cb(void *_item, void H5_ATTR_UNUSED *_key,
*/
static herr_t
H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, unsigned *num_entries_ptr,
- haddr_t **haddr_buf_ptr_ptr)
+ haddr_t **haddr_buf_ptr_ptr)
{
- H5AC_aux_t * aux_ptr = NULL;
- H5AC_addr_list_ud_t udata;
- haddr_t * haddr_buf_ptr = NULL;
- size_t buf_size;
- unsigned num_entries = 0;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_aux_t * aux_ptr = NULL;
+ H5AC_addr_list_ud_t udata;
+ haddr_t * haddr_buf_ptr = NULL;
+ size_t buf_size;
+ unsigned num_entries = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -639,33 +622,32 @@ H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, unsigned *num_entri
* base addresses in
*/
buf_size = sizeof(haddr_t) * num_entries;
- if(NULL == (haddr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size)))
+ if (NULL == (haddr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for haddr buffer")
/* Set up user data for callback */
- udata.aux_ptr = aux_ptr;
+ udata.aux_ptr = aux_ptr;
udata.addr_buf_ptr = haddr_buf_ptr;
- udata.u = 0;
+ udata.u = 0;
/* Free all the candidate list entries, building the address list in the callback */
- if(H5SL_free(aux_ptr->candidate_slist_ptr, H5AC__copy_candidate_list_to_buffer_cb, &udata) < 0)
+ if (H5SL_free(aux_ptr->candidate_slist_ptr, H5AC__copy_candidate_list_to_buffer_cb, &udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "Can't build address list for candidate entries")
/* Pass the number of entries and the buffer pointer
* back to the caller.
*/
- *num_entries_ptr = num_entries;
+ *num_entries_ptr = num_entries;
*haddr_buf_ptr_ptr = haddr_buf_ptr;
done:
- if(ret_value < 0)
- if(haddr_buf_ptr)
+ if (ret_value < 0)
+ if (haddr_buf_ptr)
haddr_buf_ptr = (haddr_t *)H5MM_xfree((void *)haddr_buf_ptr);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__copy_candidate_list_to_buffer() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC__log_deleted_entry()
@@ -686,16 +668,16 @@ done:
herr_t
H5AC__log_deleted_entry(const H5AC_info_t *entry_ptr)
{
- H5AC_t * cache_ptr;
- H5AC_aux_t * aux_ptr;
- H5AC_slist_entry_t * slist_entry_ptr = NULL;
- haddr_t addr;
+ H5AC_t * cache_ptr;
+ H5AC_aux_t * aux_ptr;
+ H5AC_slist_entry_t *slist_entry_ptr = NULL;
+ haddr_t addr;
FUNC_ENTER_PACKAGE_NOERR
/* Sanity checks */
HDassert(entry_ptr);
- addr = entry_ptr->addr;
+ addr = entry_ptr->addr;
cache_ptr = entry_ptr->cache_ptr;
HDassert(cache_ptr != NULL);
aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
@@ -706,17 +688,16 @@ H5AC__log_deleted_entry(const H5AC_info_t *entry_ptr)
HDassert(aux_ptr->c_slist_ptr != NULL);
/* if the entry appears in the dirtied entry slist, remove it. */
- if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&addr))))
+ if (NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&addr))))
slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr);
/* if the entry appears in the cleaned entry slist, remove it. */
- if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&addr))))
+ if (NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&addr))))
slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5AC__log_deleted_entry() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC__log_dirtied_entry()
@@ -741,9 +722,9 @@ H5AC__log_deleted_entry(const H5AC_info_t *entry_ptr)
herr_t
H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr)
{
- H5AC_t * cache_ptr;
- H5AC_aux_t * aux_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_t * cache_ptr;
+ H5AC_aux_t *aux_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -756,36 +737,37 @@ H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr)
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
- if(aux_ptr->mpi_rank == 0) {
+ if (aux_ptr->mpi_rank == 0) {
H5AC_slist_entry_t *slist_entry_ptr;
- haddr_t addr = entry_ptr->addr;
+ haddr_t addr = entry_ptr->addr;
/* Sanity checks */
HDassert(aux_ptr->d_slist_ptr != NULL);
HDassert(aux_ptr->c_slist_ptr != NULL);
- if(NULL == H5SL_search(aux_ptr->d_slist_ptr, (void *)(&addr))) {
+ if (NULL == H5SL_search(aux_ptr->d_slist_ptr, (void *)(&addr))) {
/* insert the address of the entry in the dirty entry list, and
* add its size to the dirty_bytes count.
*/
- if(NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t)))
+ if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry .")
- slist_entry_ptr->addr = addr;
+ slist_entry_ptr->addr = addr;
- if(H5SL_insert(aux_ptr->d_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0)
+ if (H5SL_insert(aux_ptr->d_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist.")
aux_ptr->dirty_bytes += entry_ptr->size;
#if H5AC_DEBUG_DIRTY_BYTES_CREATION
- aux_ptr->unprotect_dirty_bytes += entry_ptr->size;
- aux_ptr->unprotect_dirty_bytes_updates += 1;
-#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */
+ aux_ptr->unprotect_dirty_bytes += entry_ptr->size;
+ aux_ptr->unprotect_dirty_bytes_updates += 1;
+#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */
} /* end if */
/* the entry is dirty. If it exists on the cleaned entries list,
* remove it.
*/
- if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&addr))))
+ if (NULL !=
+ (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&addr))))
slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr);
} /* end if */
else {
@@ -794,13 +776,12 @@ H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr)
aux_ptr->unprotect_dirty_bytes += entry_ptr->size;
aux_ptr->unprotect_dirty_bytes_updates += 1;
#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */
- } /* end else */
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__log_dirtied_entry() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC__log_cleaned_entry()
@@ -819,8 +800,8 @@ done:
herr_t
H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr)
{
- H5AC_t * cache_ptr;
- H5AC_aux_t * aux_ptr;
+ H5AC_t * cache_ptr;
+ H5AC_aux_t *aux_ptr;
FUNC_ENTER_PACKAGE_NOERR
@@ -833,18 +814,20 @@ H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr)
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
- if(aux_ptr->mpi_rank == 0) {
+ if (aux_ptr->mpi_rank == 0) {
H5AC_slist_entry_t *slist_entry_ptr;
- haddr_t addr = entry_ptr->addr;
+ haddr_t addr = entry_ptr->addr;
/* Sanity checks */
HDassert(aux_ptr->d_slist_ptr != NULL);
HDassert(aux_ptr->c_slist_ptr != NULL);
/* Remove it from both the cleaned list and the dirtied list. */
- if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&addr))))
+ if (NULL !=
+ (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&addr))))
slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr);
- if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&addr))))
+ if (NULL !=
+ (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&addr))))
slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr);
} /* end if */
@@ -855,7 +838,6 @@ H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5AC__log_cleaned_entry() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC__log_flushed_entry()
@@ -878,13 +860,12 @@ H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr)
*-------------------------------------------------------------------------
*/
herr_t
-H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty,
- unsigned flags)
+H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty, unsigned flags)
{
- hbool_t cleared;
- H5AC_aux_t * aux_ptr;
- H5AC_slist_entry_t * slist_entry_ptr = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t cleared;
+ H5AC_aux_t * aux_ptr;
+ H5AC_slist_entry_t *slist_entry_ptr = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -899,32 +880,33 @@ H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty,
/* Set local flags */
cleared = ((flags & H5C__FLUSH_CLEAR_ONLY_FLAG) != 0);
- if(cleared) {
+ if (cleared) {
/* If the entry has been cleared, must remove it from both the
* cleaned list and the dirtied list.
*/
- if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&addr))))
+ if (NULL !=
+ (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&addr))))
slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr);
- if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&addr))))
+ if (NULL !=
+ (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&addr))))
slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr);
} /* end if */
- else if(was_dirty) {
- if(NULL == H5SL_search(aux_ptr->c_slist_ptr, (void *)(&addr))) {
+ else if (was_dirty) {
+ if (NULL == H5SL_search(aux_ptr->c_slist_ptr, (void *)(&addr))) {
/* insert the address of the entry in the clean entry list. */
- if(NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t)))
+ if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate clean slist entry .")
slist_entry_ptr->addr = addr;
- if(H5SL_insert(aux_ptr->c_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0)
+ if (H5SL_insert(aux_ptr->c_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into clean entry slist.")
} /* end if */
- } /* end else-if */
+ } /* end else-if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__log_flushed_entry() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC__log_inserted_entry()
@@ -948,9 +930,9 @@ done:
herr_t
H5AC__log_inserted_entry(const H5AC_info_t *entry_ptr)
{
- H5AC_t * cache_ptr;
- H5AC_aux_t * aux_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_t * cache_ptr;
+ H5AC_aux_t *aux_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -962,27 +944,27 @@ H5AC__log_inserted_entry(const H5AC_info_t *entry_ptr)
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
- if(aux_ptr->mpi_rank == 0) {
+ if (aux_ptr->mpi_rank == 0) {
H5AC_slist_entry_t *slist_entry_ptr;
HDassert(aux_ptr->d_slist_ptr != NULL);
HDassert(aux_ptr->c_slist_ptr != NULL);
/* Entry to insert should not be in dirty list currently */
- if(NULL != H5SL_search(aux_ptr->d_slist_ptr, (const void *)(&entry_ptr->addr)))
+ if (NULL != H5SL_search(aux_ptr->d_slist_ptr, (const void *)(&entry_ptr->addr)))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Inserted entry already in dirty slist.")
/* insert the address of the entry in the dirty entry list, and
* add its size to the dirty_bytes count.
*/
- if(NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t)))
+ if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry .")
- slist_entry_ptr->addr = entry_ptr->addr;
- if(H5SL_insert(aux_ptr->d_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0)
+ slist_entry_ptr->addr = entry_ptr->addr;
+ if (H5SL_insert(aux_ptr->d_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist.")
/* Entry to insert should not be in clean list either */
- if(NULL != H5SL_search(aux_ptr->c_slist_ptr, (const void *)(&entry_ptr->addr)))
+ if (NULL != H5SL_search(aux_ptr->c_slist_ptr, (const void *)(&entry_ptr->addr)))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Inserted entry in clean slist.")
} /* end if */
@@ -997,7 +979,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__log_inserted_entry() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC__log_moved_entry()
@@ -1047,12 +1028,12 @@ done:
herr_t
H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr)
{
- H5AC_t * cache_ptr;
- H5AC_aux_t * aux_ptr;
- hbool_t entry_in_cache;
- hbool_t entry_dirty;
- size_t entry_size;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_t * cache_ptr;
+ H5AC_aux_t *aux_ptr;
+ hbool_t entry_in_cache;
+ hbool_t entry_dirty;
+ size_t entry_size;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1066,14 +1047,14 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr)
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
/* get entry status, size, etc here */
- if(H5C_get_entry_status(f, old_addr, &entry_size, &entry_in_cache,
- &entry_dirty, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ if (H5C_get_entry_status(f, old_addr, &entry_size, &entry_in_cache, &entry_dirty, NULL, NULL, NULL, NULL,
+ NULL, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get entry status.")
- if(!entry_in_cache)
+ if (!entry_in_cache)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry not in cache.")
- if(aux_ptr->mpi_rank == 0) {
- H5AC_slist_entry_t * slist_entry_ptr;
+ if (aux_ptr->mpi_rank == 0) {
+ H5AC_slist_entry_t *slist_entry_ptr;
HDassert(aux_ptr->d_slist_ptr != NULL);
HDassert(aux_ptr->c_slist_ptr != NULL);
@@ -1081,24 +1062,26 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr)
/* if the entry appears in the cleaned entry slist, under its old
* address, remove it.
*/
- if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&old_addr))))
+ if (NULL !=
+ (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&old_addr))))
slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr);
/* if the entry appears in the dirtied entry slist under its old
* address, remove it, but don't free it. Set addr to new_addr.
*/
- if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&old_addr))))
+ if (NULL !=
+ (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&old_addr))))
slist_entry_ptr->addr = new_addr;
else {
- /* otherwise, allocate a new entry that is ready
- * for insertion, and increment dirty_bytes.
- *
- * Note that the fact that the entry wasn't in the dirtied
- * list under its old address implies that it must have
- * been clean to start with.
- */
+ /* otherwise, allocate a new entry that is ready
+ * for insertion, and increment dirty_bytes.
+ *
+ * Note that the fact that the entry wasn't in the dirtied
+ * list under its old address implies that it must have
+ * been clean to start with.
+ */
HDassert(!entry_dirty);
- if(NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t)))
+ if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry .")
slist_entry_ptr->addr = new_addr;
@@ -1107,27 +1090,26 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr)
#if H5AC_DEBUG_DIRTY_BYTES_CREATION
aux_ptr->move_dirty_bytes += entry_size;
aux_ptr->move_dirty_bytes_updates += 1;
-#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */
+#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */
} /* end else */
/* insert / reinsert the entry in the dirty slist */
- if(H5SL_insert(aux_ptr->d_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0)
+ if (H5SL_insert(aux_ptr->d_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist.")
} /* end if */
- else if(!entry_dirty) {
+ else if (!entry_dirty) {
aux_ptr->dirty_bytes += entry_size;
#if H5AC_DEBUG_DIRTY_BYTES_CREATION
aux_ptr->move_dirty_bytes += entry_size;
aux_ptr->move_dirty_bytes_updates += 1;
#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */
- } /* end else-if */
+ } /* end else-if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__log_moved_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__propagate_and_apply_candidate_list
*
@@ -1224,14 +1206,14 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5AC__propagate_and_apply_candidate_list(H5F_t *f)
+H5AC__propagate_and_apply_candidate_list(H5F_t *f)
{
- H5AC_t * cache_ptr;
- H5AC_aux_t * aux_ptr;
- haddr_t * candidates_list_ptr = NULL;
- int mpi_result;
- unsigned num_candidates = 0;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_t * cache_ptr;
+ H5AC_aux_t *aux_ptr;
+ haddr_t * candidates_list_ptr = NULL;
+ int mpi_result;
+ unsigned num_candidates = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1247,22 +1229,22 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f)
/* to prevent "messages from the future" we must synchronize all
* processes before we write any entries.
*/
- if(MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm)))
+ if (MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result)
- if(aux_ptr->mpi_rank == 0) {
- if(H5AC__broadcast_candidate_list(cache_ptr, &num_candidates, &candidates_list_ptr) < 0)
+ if (aux_ptr->mpi_rank == 0) {
+ if (H5AC__broadcast_candidate_list(cache_ptr, &num_candidates, &candidates_list_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't broadcast candidate slist.")
HDassert(H5SL_count(aux_ptr->candidate_slist_ptr) == 0);
} /* end if */
else {
- if(H5AC__receive_candidate_list(cache_ptr, &num_candidates, &candidates_list_ptr) < 0)
+ if (H5AC__receive_candidate_list(cache_ptr, &num_candidates, &candidates_list_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't receive candidate broadcast.")
} /* end else */
- if(num_candidates > 0) {
- herr_t result;
+ if (num_candidates > 0) {
+ herr_t result;
/* all processes apply the candidate list.
* H5C_apply_candidate_list() handles the details of
@@ -1273,34 +1255,34 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f)
aux_ptr->write_permitted = TRUE;
/* Apply the candidate list */
- result = H5C_apply_candidate_list(f, cache_ptr, num_candidates,
- candidates_list_ptr, aux_ptr->mpi_rank, aux_ptr->mpi_size);
+ result = H5C_apply_candidate_list(f, cache_ptr, num_candidates, candidates_list_ptr,
+ aux_ptr->mpi_rank, aux_ptr->mpi_size);
/* Disable writes again */
aux_ptr->write_permitted = FALSE;
/* Check for error on the write operation */
- if(result < 0)
+ if (result < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't apply candidate list.")
/* this code exists primarily for the test bed -- it allows us to
* enforce posix semantics on the server that pretends to be a
* file system in our parallel tests.
*/
- if(aux_ptr->write_done)
- (aux_ptr->write_done)();
+ if (aux_ptr->write_done)
+ (aux_ptr->write_done)();
/* to prevent "messages from the past" we must synchronize all
* processes again before we go on.
*/
- if(MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm)))
+ if (MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result)
- /* if this is process zero, tidy up the dirtied,
+ /* if this is process zero, tidy up the dirtied,
* and flushed and still clean lists.
*/
- if(aux_ptr->mpi_rank == 0)
- if(H5AC__tidy_cache_0_lists(cache_ptr, num_candidates, candidates_list_ptr) < 0)
+ if (aux_ptr->mpi_rank == 0)
+ if (H5AC__tidy_cache_0_lists(cache_ptr, num_candidates, candidates_list_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't tidy up process 0 lists.")
} /* end if */
@@ -1308,17 +1290,16 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f)
* that this callback is defined purely for testing purposes,
* and should be undefined under normal operating circumstances.
*/
- if(aux_ptr->sync_point_done)
+ if (aux_ptr->sync_point_done)
(aux_ptr->sync_point_done)(num_candidates, candidates_list_ptr);
done:
- if(candidates_list_ptr)
+ if (candidates_list_ptr)
candidates_list_ptr = (haddr_t *)H5MM_xfree((void *)candidates_list_ptr);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__propagate_and_apply_candidate_list() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__propagate_flushed_and_still_clean_entries_list
*
@@ -1391,11 +1372,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f)
+H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f)
{
- H5AC_t * cache_ptr;
- H5AC_aux_t * aux_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_t * cache_ptr;
+ H5AC_aux_t *aux_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1408,20 +1389,18 @@ H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f)
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY);
- if(aux_ptr->mpi_rank == 0) {
- if(H5AC__broadcast_clean_list(cache_ptr) < 0)
+ if (aux_ptr->mpi_rank == 0) {
+ if (H5AC__broadcast_clean_list(cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't broadcast clean slist.")
HDassert(H5SL_count(aux_ptr->c_slist_ptr) == 0);
} /* end if */
- else
- if(H5AC__receive_and_apply_clean_list(f) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't receive and/or process clean slist broadcast.")
+ else if (H5AC__receive_and_apply_clean_list(f) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't receive and/or process clean slist broadcast.")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__propagate_flushed_and_still_clean_entries_list() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC__receive_haddr_list()
@@ -1443,13 +1422,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5AC__receive_haddr_list(MPI_Comm mpi_comm, unsigned *num_entries_ptr,
- haddr_t **haddr_buf_ptr_ptr)
+H5AC__receive_haddr_list(MPI_Comm mpi_comm, unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr)
{
- haddr_t * haddr_buf_ptr = NULL;
- int mpi_result;
- unsigned num_entries;
- herr_t ret_value = SUCCEED; /* Return value */
+ haddr_t *haddr_buf_ptr = NULL;
+ int mpi_result;
+ unsigned num_entries;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1463,37 +1441,37 @@ H5AC__receive_haddr_list(MPI_Comm mpi_comm, unsigned *num_entries_ptr,
* can set up a buffer to receive them. If there aren't
* any, we are done.
*/
- if(MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_UNSIGNED, 0, mpi_comm)))
+ if (MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_UNSIGNED, 0, mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result)
- if(num_entries > 0) {
+ if (num_entries > 0) {
size_t buf_size;
/* allocate buffers to store the list of entry base addresses in */
buf_size = sizeof(haddr_t) * num_entries;
- if(NULL == (haddr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size)))
+ if (NULL == (haddr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for haddr buffer")
/* Now receive the list of candidate entries */
- if(MPI_SUCCESS != (mpi_result = MPI_Bcast((void *)haddr_buf_ptr, (int)buf_size, MPI_BYTE, 0, mpi_comm)))
+ if (MPI_SUCCESS !=
+ (mpi_result = MPI_Bcast((void *)haddr_buf_ptr, (int)buf_size, MPI_BYTE, 0, mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result)
} /* end if */
/* finally, pass the number of entries and the buffer pointer
* back to the caller.
*/
- *num_entries_ptr = num_entries;
+ *num_entries_ptr = num_entries;
*haddr_buf_ptr_ptr = haddr_buf_ptr;
done:
- if(ret_value < 0)
- if(haddr_buf_ptr)
+ if (ret_value < 0)
+ if (haddr_buf_ptr)
haddr_buf_ptr = (haddr_t *)H5MM_xfree((void *)haddr_buf_ptr);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__receive_haddr_list() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC__receive_and_apply_clean_list()
@@ -1515,11 +1493,11 @@ done:
static herr_t
H5AC__receive_and_apply_clean_list(H5F_t *f)
{
- H5AC_t * cache_ptr;
- H5AC_aux_t * aux_ptr;
- haddr_t * haddr_buf_ptr = NULL;
- unsigned num_entries = 0;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_t * cache_ptr;
+ H5AC_aux_t *aux_ptr;
+ haddr_t * haddr_buf_ptr = NULL;
+ unsigned num_entries = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1533,29 +1511,28 @@ H5AC__receive_and_apply_clean_list(H5F_t *f)
HDassert(aux_ptr->mpi_rank != 0);
/* Retrieve the clean list from process 0 */
- if(H5AC__receive_haddr_list(aux_ptr->mpi_comm, &num_entries, &haddr_buf_ptr) < 0)
+ if (H5AC__receive_haddr_list(aux_ptr->mpi_comm, &num_entries, &haddr_buf_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't receive clean list")
- if(num_entries > 0)
+ if (num_entries > 0)
/* mark the indicated entries as clean */
- if(H5C_mark_entries_as_clean(f, num_entries, haddr_buf_ptr) < 0)
+ if (H5C_mark_entries_as_clean(f, num_entries, haddr_buf_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't mark entries clean.")
/* if it is defined, call the sync point done callback. Note
* that this callback is defined purely for testing purposes,
* and should be undefined under normal operating circumstances.
*/
- if(aux_ptr->sync_point_done)
+ if (aux_ptr->sync_point_done)
(aux_ptr->sync_point_done)(num_entries, haddr_buf_ptr);
done:
- if(haddr_buf_ptr)
+ if (haddr_buf_ptr)
haddr_buf_ptr = (haddr_t *)H5MM_xfree((void *)haddr_buf_ptr);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__receive_and_apply_clean_list() */
-
/*-------------------------------------------------------------------------
*
* Function: H5AC__receive_candidate_list()
@@ -1577,11 +1554,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5AC__receive_candidate_list(const H5AC_t *cache_ptr, unsigned *num_entries_ptr,
- haddr_t **haddr_buf_ptr_ptr)
+H5AC__receive_candidate_list(const H5AC_t *cache_ptr, unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr)
{
- H5AC_aux_t * aux_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_aux_t *aux_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1591,21 +1567,20 @@ H5AC__receive_candidate_list(const H5AC_t *cache_ptr, unsigned *num_entries_ptr,
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
HDassert(aux_ptr->mpi_rank != 0);
- HDassert(aux_ptr-> metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED);
+ HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED);
HDassert(num_entries_ptr != NULL);
HDassert(*num_entries_ptr == 0);
HDassert(haddr_buf_ptr_ptr != NULL);
HDassert(*haddr_buf_ptr_ptr == NULL);
/* Retrieve the candidate list from process 0 */
- if(H5AC__receive_haddr_list(aux_ptr->mpi_comm, num_entries_ptr, haddr_buf_ptr_ptr) < 0)
+ if (H5AC__receive_haddr_list(aux_ptr->mpi_comm, num_entries_ptr, haddr_buf_ptr_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't receive clean list")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__receive_candidate_list() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__rsp__dist_md_write__flush
*
@@ -1658,12 +1633,12 @@ done:
static herr_t
H5AC__rsp__dist_md_write__flush(H5F_t *f)
{
- H5AC_t * cache_ptr;
- H5AC_aux_t * aux_ptr;
- haddr_t * haddr_buf_ptr = NULL;
- int mpi_result;
- unsigned num_entries = 0;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_t * cache_ptr;
+ H5AC_aux_t *aux_ptr;
+ haddr_t * haddr_buf_ptr = NULL;
+ int mpi_result;
+ unsigned num_entries = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1679,16 +1654,16 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f)
/* first construct the candidate list -- initially, this will be in the
* form of a skip list. We will convert it later.
*/
- if(H5C_construct_candidate_list__clean_cache(cache_ptr) < 0)
+ if (H5C_construct_candidate_list__clean_cache(cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate list.")
- if(H5SL_count(aux_ptr->candidate_slist_ptr) > 0) {
- herr_t result;
+ if (H5SL_count(aux_ptr->candidate_slist_ptr) > 0) {
+ herr_t result;
/* convert the candidate list into the format we
* are used to receiving from process 0.
*/
- if(H5AC__copy_candidate_list_to_buffer(cache_ptr, &num_entries, &haddr_buf_ptr) < 0)
+ if (H5AC__copy_candidate_list_to_buffer(cache_ptr, &num_entries, &haddr_buf_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate buffer.")
/* Initial sync point barrier
@@ -1696,40 +1671,40 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f)
* When flushing from within the close operation from a file,
* it's possible to skip this barrier (on the second flush of the cache).
*/
- if(!H5CX_get_mpi_file_flushing())
- if(MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm)))
+ if (!H5CX_get_mpi_file_flushing())
+ if (MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result)
/* Enable writes during this operation */
aux_ptr->write_permitted = TRUE;
/* Apply the candidate list */
- result = H5C_apply_candidate_list(f, cache_ptr, num_entries,
- haddr_buf_ptr, aux_ptr->mpi_rank, aux_ptr->mpi_size);
+ result = H5C_apply_candidate_list(f, cache_ptr, num_entries, haddr_buf_ptr, aux_ptr->mpi_rank,
+ aux_ptr->mpi_size);
/* Disable writes again */
aux_ptr->write_permitted = FALSE;
/* Check for error on the write operation */
- if(result < 0)
+ if (result < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't apply candidate list.")
/* this code exists primarily for the test bed -- it allows us to
* enforce posix semantics on the server that pretends to be a
* file system in our parallel tests.
*/
- if(aux_ptr->write_done)
+ if (aux_ptr->write_done)
(aux_ptr->write_done)();
/* final sync point barrier */
- if(MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm)))
+ if (MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result)
- /* if this is process zero, tidy up the dirtied,
+ /* if this is process zero, tidy up the dirtied,
* and flushed and still clean lists.
*/
- if(aux_ptr->mpi_rank == 0)
- if(H5AC__tidy_cache_0_lists(cache_ptr, num_entries, haddr_buf_ptr) < 0)
+ if (aux_ptr->mpi_rank == 0)
+ if (H5AC__tidy_cache_0_lists(cache_ptr, num_entries, haddr_buf_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't tidy up process 0 lists.")
} /* end if */
@@ -1737,17 +1712,16 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f)
* that this callback is defined purely for testing purposes,
* and should be undefined under normal operating circumstances.
*/
- if(aux_ptr->sync_point_done)
+ if (aux_ptr->sync_point_done)
(aux_ptr->sync_point_done)(num_entries, haddr_buf_ptr);
done:
- if(haddr_buf_ptr)
+ if (haddr_buf_ptr)
haddr_buf_ptr = (haddr_t *)H5MM_xfree((void *)haddr_buf_ptr);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__rsp__dist_md_write__flush() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__rsp__dist_md_write__flush_to_min_clean
*
@@ -1805,10 +1779,10 @@ done:
static herr_t
H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f)
{
- H5AC_t * cache_ptr;
- H5AC_aux_t * aux_ptr;
- hbool_t evictions_enabled;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_t * cache_ptr;
+ H5AC_aux_t *aux_ptr;
+ hbool_t evictions_enabled;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1822,17 +1796,18 @@ H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f)
HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED);
/* Query if evictions are allowed */
- if(H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled) < 0)
+ if (H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_get_evictions_enabled() failed.")
- if(evictions_enabled) {
+ if (evictions_enabled) {
/* construct candidate list -- process 0 only */
- if(aux_ptr->mpi_rank == 0)
- if(H5AC__construct_candidate_list(cache_ptr, aux_ptr, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0)
+ if (aux_ptr->mpi_rank == 0)
+ if (H5AC__construct_candidate_list(cache_ptr, aux_ptr, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) <
+ 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate list.")
/* propagate and apply candidate list -- all processes */
- if(H5AC__propagate_and_apply_candidate_list(f) < 0)
+ if (H5AC__propagate_and_apply_candidate_list(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate and apply candidate list.")
} /* evictions enabled */
@@ -1840,7 +1815,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__rsp__dist_md_write__flush_to_min_clean() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__rsp__p0_only__flush
*
@@ -1882,10 +1856,10 @@ done:
static herr_t
H5AC__rsp__p0_only__flush(H5F_t *f)
{
- H5AC_t * cache_ptr;
- H5AC_aux_t * aux_ptr;
- int mpi_result;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_t * cache_ptr;
+ H5AC_aux_t *aux_ptr;
+ int mpi_result;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1896,8 +1870,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f)
aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
HDassert(aux_ptr != NULL);
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
- HDassert(aux_ptr->metadata_write_strategy == \
- H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY);
+ HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY);
/* To prevent "messages from the future" we must
* synchronize all processes before we start the flush.
@@ -1906,16 +1879,16 @@ H5AC__rsp__p0_only__flush(H5F_t *f)
* However, when flushing from within the close operation from a file,
* it's possible to skip this barrier (on the second flush of the cache).
*/
- if ( ! H5CX_get_mpi_file_flushing() ) {
+ if (!H5CX_get_mpi_file_flushing()) {
- if ( MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm)) )
+ if (MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result)
}
/* Flush data to disk, from rank 0 process */
- if(aux_ptr->mpi_rank == 0) {
- herr_t result;
+ if (aux_ptr->mpi_rank == 0) {
+ herr_t result;
/* Enable writes during this operation */
aux_ptr->write_permitted = TRUE;
@@ -1927,7 +1900,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f)
aux_ptr->write_permitted = FALSE;
/* Check for error on the write operation */
- if ( result < 0 )
+ if (result < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.")
@@ -1935,17 +1908,16 @@ H5AC__rsp__p0_only__flush(H5F_t *f)
* enforce POSIX semantics on the server that pretends to be a
* file system in our parallel tests.
*/
- if ( aux_ptr->write_done ) {
+ if (aux_ptr->write_done) {
(aux_ptr->write_done)();
}
} /* end if */
/* Propagate cleaned entries to other ranks. */
- if ( H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0 )
+ if (H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "Can't propagate clean entries list.")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.")
done:
@@ -1953,7 +1925,6 @@ done:
} /* H5AC__rsp__p0_only__flush() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__rsp__p0_only__flush_to_min_clean
*
@@ -1999,10 +1970,10 @@ done:
static herr_t
H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f)
{
- H5AC_t * cache_ptr;
- H5AC_aux_t * aux_ptr;
- hbool_t evictions_enabled;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_t * cache_ptr;
+ H5AC_aux_t *aux_ptr;
+ hbool_t evictions_enabled;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2016,7 +1987,7 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f)
HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY);
/* Query if evictions are allowed */
- if(H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled) < 0)
+ if (H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_get_evictions_enabled() failed.")
/* Flush if evictions are allowed -- following call
@@ -2026,18 +1997,18 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f)
*
* Otherwise, do nothing.
*/
- if(evictions_enabled) {
- int mpi_result;
+ if (evictions_enabled) {
+ int mpi_result;
/* to prevent "messages from the future" we must synchronize all
* processes before we start the flush. This synchronization may
* already be done -- hence the do_barrier parameter.
*/
- if(MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm)))
+ if (MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result)
- if(0 == aux_ptr->mpi_rank) {
- herr_t result;
+ if (0 == aux_ptr->mpi_rank) {
+ herr_t result;
/* here, process 0 flushes as many entries as necessary to
* comply with the currently specified min clean size.
@@ -2055,18 +2026,18 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f)
aux_ptr->write_permitted = FALSE;
/* Check for error on the write operation */
- if(result < 0)
+ if (result < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_flush_to_min_clean() failed.")
/* this call exists primarily for the test code -- it is used
- * to enforce POSIX semantics on the process used to simulate
- * reads and writes in t_cache.c.
+ * to enforce POSIX semantics on the process used to simulate
+ * reads and writes in t_cache.c.
*/
- if(aux_ptr->write_done)
+ if (aux_ptr->write_done)
(aux_ptr->write_done)();
} /* end if */
- if(H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0)
+ if (H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.")
} /* end if */
@@ -2074,7 +2045,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__rsp__p0_only__flush_to_min_clean() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__run_sync_point
*
@@ -2109,9 +2079,9 @@ done:
herr_t
H5AC__run_sync_point(H5F_t *f, int sync_point_op)
{
- H5AC_t * cache_ptr;
- H5AC_aux_t * aux_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_t * cache_ptr;
+ H5AC_aux_t *aux_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2129,18 +2099,12 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op)
HDassert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) ||
(sync_point_op == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED));
-
#if H5AC_DEBUG_DIRTY_BYTES_CREATION
-HDfprintf(stdout,
- "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu/%u\n",
- aux_ptr->mpi_rank,
- aux_ptr->dirty_bytes_propagations,
- aux_ptr->unprotect_dirty_bytes,
- aux_ptr->unprotect_dirty_bytes_updates,
- aux_ptr->insert_dirty_bytes,
- aux_ptr->insert_dirty_bytes_updates,
- aux_ptr->rename_dirty_bytes,
- aux_ptr->rename_dirty_bytes_updates);
+ HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu/%u\n", aux_ptr->mpi_rank,
+ aux_ptr->dirty_bytes_propagations, aux_ptr->unprotect_dirty_bytes,
+ aux_ptr->unprotect_dirty_bytes_updates, aux_ptr->insert_dirty_bytes,
+ aux_ptr->insert_dirty_bytes_updates, aux_ptr->rename_dirty_bytes,
+ aux_ptr->rename_dirty_bytes_updates);
#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */
/* clear collective access flag on half of the entries in the
@@ -2148,56 +2112,58 @@ HDfprintf(stdout,
evicted later. All ranks are guaranteed to mark the same entries
since we don't modify the order of the collectively accessed
entries except through collective access. */
- if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
+ if (H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.")
- switch(aux_ptr->metadata_write_strategy) {
+ switch (aux_ptr->metadata_write_strategy) {
case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
- switch(sync_point_op) {
+ switch (sync_point_op) {
case H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN:
- if(H5AC__rsp__p0_only__flush_to_min_clean(f) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5AC__rsp__p0_only__flush_to_min_clean() failed.")
- break;
+ if (H5AC__rsp__p0_only__flush_to_min_clean(f) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL,
+ "H5AC__rsp__p0_only__flush_to_min_clean() failed.")
+ break;
- case H5AC_SYNC_POINT_OP__FLUSH_CACHE:
- if(H5AC__rsp__p0_only__flush(f) < 0)
+ case H5AC_SYNC_POINT_OP__FLUSH_CACHE:
+ if (H5AC__rsp__p0_only__flush(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5AC__rsp__p0_only__flush() failed.")
- break;
+ break;
- default:
+ default:
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown flush op");
- break;
- } /* end switch */
- break;
+ break;
+ } /* end switch */
+ break;
- case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
- switch(sync_point_op) {
+ case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
+ switch (sync_point_op) {
case H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN:
- if(H5AC__rsp__dist_md_write__flush_to_min_clean(f) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5AC__rsp__dist_md_write__flush_to_min_clean() failed.")
- break;
+ if (H5AC__rsp__dist_md_write__flush_to_min_clean(f) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL,
+ "H5AC__rsp__dist_md_write__flush_to_min_clean() failed.")
+ break;
- case H5AC_SYNC_POINT_OP__FLUSH_CACHE:
- if(H5AC__rsp__dist_md_write__flush(f) < 0)
+ case H5AC_SYNC_POINT_OP__FLUSH_CACHE:
+ if (H5AC__rsp__dist_md_write__flush(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5AC__rsp__dist_md_write__flush() failed.")
- break;
+ break;
- default:
+ default:
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown flush op");
- break;
- } /* end switch */
- break;
+ break;
+ } /* end switch */
+ break;
- default:
+ default:
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown metadata write strategy.")
- break;
+ break;
} /* end switch */
/* reset the dirty bytes count */
aux_ptr->dirty_bytes = 0;
#if H5AC_DEBUG_DIRTY_BYTES_CREATION
- aux_ptr->dirty_bytes_propagations += 1;
+ aux_ptr->dirty_bytes_propagations += 1;
aux_ptr->unprotect_dirty_bytes = 0;
aux_ptr->unprotect_dirty_bytes_updates = 0;
aux_ptr->insert_dirty_bytes = 0;
@@ -2211,7 +2177,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__run_sync_point() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__tidy_cache_0_lists()
*
@@ -2248,11 +2213,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates,
- haddr_t *candidates_list_ptr)
+H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates, haddr_t *candidates_list_ptr)
{
- H5AC_aux_t * aux_ptr;
- unsigned u;
+ H5AC_aux_t *aux_ptr;
+ unsigned u;
FUNC_ENTER_STATIC_NOERR
@@ -2273,26 +2237,27 @@ H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates,
* cleaned list. However, for this metadata write strategy,
* we just want to remove all references to the candidate entries.
*/
- for(u = 0; u < num_candidates; u++) {
- H5AC_slist_entry_t * d_slist_entry_ptr;
- H5AC_slist_entry_t * c_slist_entry_ptr;
- haddr_t addr;
+ for (u = 0; u < num_candidates; u++) {
+ H5AC_slist_entry_t *d_slist_entry_ptr;
+ H5AC_slist_entry_t *c_slist_entry_ptr;
+ haddr_t addr;
addr = candidates_list_ptr[u];
/* addr may be either on the dirtied list, or on the flushed
* and still clean list. Remove it.
*/
- if(NULL != (d_slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)&addr)))
+ if (NULL !=
+ (d_slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)&addr)))
d_slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, d_slist_entry_ptr);
- if(NULL != (c_slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)&addr)))
+ if (NULL !=
+ (c_slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)&addr)))
c_slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, c_slist_entry_ptr);
} /* end for */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5AC__tidy_cache_0_lists() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__flush_entries
*
@@ -2311,7 +2276,7 @@ H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates,
herr_t
H5AC__flush_entries(H5F_t *f)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2320,12 +2285,11 @@ H5AC__flush_entries(H5F_t *f)
HDassert(f->shared->cache);
/* Check if we have >1 ranks */
- if(H5C_get_aux_ptr(f->shared->cache))
- if(H5AC__run_sync_point(f, H5AC_SYNC_POINT_OP__FLUSH_CACHE) < 0)
+ if (H5C_get_aux_ptr(f->shared->cache))
+ if (H5AC__run_sync_point(f, H5AC_SYNC_POINT_OP__FLUSH_CACHE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__flush_entries() */
#endif /* H5_HAVE_PARALLEL */
-
diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h
index 86ff385..5ec364a 100644
--- a/src/H5ACpkg.h
+++ b/src/H5ACpkg.h
@@ -34,12 +34,11 @@
#define _H5ACpkg_H
/* Get package's private header */
-#include "H5ACprivate.h" /* Metadata cache */
-
+#include "H5ACprivate.h" /* Metadata cache */
/* Get needed headers */
-#include "H5Cprivate.h" /* Cache */
-#include "H5FLprivate.h" /* Free Lists */
+#include "H5Cprivate.h" /* Cache */
+#include "H5FLprivate.h" /* Free Lists */
/*****************************/
/* Package Private Variables */
@@ -48,12 +47,11 @@
/* Declare extern the free list to manage the H5AC_aux_t struct */
H5FL_EXTERN(H5AC_aux_t);
-
/**************************/
/* Package Private Macros */
/**************************/
-#define H5AC_DEBUG_DIRTY_BYTES_CREATION 0
+#define H5AC_DEBUG_DIRTY_BYTES_CREATION 0
#ifdef H5_HAVE_PARALLEL
@@ -61,8 +59,8 @@ H5FL_EXTERN(H5AC_aux_t);
* at a sync point.
*/
-#define H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN 0
-#define H5AC_SYNC_POINT_OP__FLUSH_CACHE 1
+#define H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN 0
+#define H5AC_SYNC_POINT_OP__FLUSH_CACHE 1
#endif /* H5_HAVE_PARALLEL */
@@ -73,12 +71,9 @@ H5FL_EXTERN(H5AC_aux_t);
*-------------------------------------------------------------------------
*/
-#define H5AC__MIN_DIRTY_BYTES_THRESHOLD (size_t) \
- (H5C__MIN_MAX_CACHE_SIZE / 2)
-#define H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD (256 * 1024)
-#define H5AC__MAX_DIRTY_BYTES_THRESHOLD (size_t) \
- (H5C__MAX_MAX_CACHE_SIZE / 4)
-
+#define H5AC__MIN_DIRTY_BYTES_THRESHOLD (size_t)(H5C__MIN_MAX_CACHE_SIZE / 2)
+#define H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD (256 * 1024)
+#define H5AC__MAX_DIRTY_BYTES_THRESHOLD (size_t)(H5C__MAX_MAX_CACHE_SIZE / 4)
/****************************************************************************
*
@@ -359,57 +354,54 @@ H5FL_EXTERN(H5AC_aux_t);
#ifdef H5_HAVE_PARALLEL
-#define H5AC__H5AC_AUX_T_MAGIC (unsigned)0x00D0A01
+#define H5AC__H5AC_AUX_T_MAGIC (unsigned)0x00D0A01
-typedef struct H5AC_aux_t
-{
- uint32_t magic;
+typedef struct H5AC_aux_t {
+ uint32_t magic;
- MPI_Comm mpi_comm;
+ MPI_Comm mpi_comm;
- int mpi_rank;
+ int mpi_rank;
- int mpi_size;
+ int mpi_size;
- hbool_t write_permitted;
+ hbool_t write_permitted;
- size_t dirty_bytes_threshold;
+ size_t dirty_bytes_threshold;
- size_t dirty_bytes;
+ size_t dirty_bytes;
- int32_t metadata_write_strategy;
+ int32_t metadata_write_strategy;
#if H5AC_DEBUG_DIRTY_BYTES_CREATION
- unsigned dirty_bytes_propagations;
+ unsigned dirty_bytes_propagations;
- size_t unprotect_dirty_bytes;
- unsigned unprotect_dirty_bytes_updates;
+ size_t unprotect_dirty_bytes;
+ unsigned unprotect_dirty_bytes_updates;
- size_t insert_dirty_bytes;
- unsigned insert_dirty_bytes_updates;
+ size_t insert_dirty_bytes;
+ unsigned insert_dirty_bytes_updates;
- size_t move_dirty_bytes;
- unsigned move_dirty_bytes_updates;
+ size_t move_dirty_bytes;
+ unsigned move_dirty_bytes_updates;
#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */
- H5SL_t * d_slist_ptr;
+ H5SL_t *d_slist_ptr;
- H5SL_t * c_slist_ptr;
+ H5SL_t *c_slist_ptr;
- H5SL_t * candidate_slist_ptr;
+ H5SL_t *candidate_slist_ptr;
- void (* write_done)(void);
+ void (*write_done)(void);
- void (* sync_point_done)(unsigned num_writes,
- haddr_t * written_entries_tbl);
+ void (*sync_point_done)(unsigned num_writes, haddr_t *written_entries_tbl);
- unsigned p0_image_len;
+ unsigned p0_image_len;
} H5AC_aux_t; /* struct H5AC_aux_t */
-#endif /* H5_HAVE_PARALLEL */
-
+#endif /* H5_HAVE_PARALLEL */
/******************************/
/* Package Private Prototypes */
@@ -420,18 +412,15 @@ typedef struct H5AC_aux_t
H5_DLL herr_t H5AC__log_deleted_entry(const H5AC_info_t *entry_ptr);
H5_DLL herr_t H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr);
H5_DLL herr_t H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr);
-H5_DLL herr_t H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr,
- hbool_t was_dirty, unsigned flags);
+H5_DLL herr_t H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty, unsigned flags);
H5_DLL herr_t H5AC__log_inserted_entry(const H5AC_info_t *entry_ptr);
-H5_DLL herr_t H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr,
- haddr_t new_addr);
+H5_DLL herr_t H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr);
H5_DLL herr_t H5AC__flush_entries(H5F_t *f);
H5_DLL herr_t H5AC__run_sync_point(H5F_t *f, int sync_point_op);
H5_DLL herr_t H5AC__set_sync_point_done_callback(H5C_t *cache_ptr,
- void (*sync_point_done)(unsigned num_writes, haddr_t *written_entries_tbl));
-H5_DLL herr_t H5AC__set_write_done_callback(H5C_t * cache_ptr,
- void (* write_done)(void));
+ void (*sync_point_done)(unsigned num_writes,
+ haddr_t *written_entries_tbl));
+H5_DLL herr_t H5AC__set_write_done_callback(H5C_t *cache_ptr, void (*write_done)(void));
#endif /* H5_HAVE_PARALLEL */
#endif /* _H5ACpkg_H */
-
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index dffb5cb..7d6ec7b 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -26,57 +26,57 @@
#ifndef _H5ACprivate_H
#define _H5ACprivate_H
-#include "H5ACpublic.h" /*public prototypes */
+#include "H5ACpublic.h" /*public prototypes */
/* Pivate headers needed by this header */
-#include "H5private.h" /* Generic Functions */
-#include "H5Cprivate.h" /* Cache */
-#include "H5Fprivate.h" /* File access */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5SLprivate.h" /* Skip lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5Cprivate.h" /* Cache */
+#include "H5Fprivate.h" /* File access */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5SLprivate.h" /* Skip lists */
/* Global metadata tag values */
-#define H5AC__INVALID_TAG (haddr_t)0
-#define H5AC__IGNORE_TAG (haddr_t)1
-#define H5AC__COPIED_TAG (haddr_t)2
-#define H5AC__SUPERBLOCK_TAG (haddr_t)3
-#define H5AC__FREESPACE_TAG (haddr_t)4
-#define H5AC__SOHM_TAG (haddr_t)5
-#define H5AC__GLOBALHEAP_TAG (haddr_t)6
+#define H5AC__INVALID_TAG (haddr_t)0
+#define H5AC__IGNORE_TAG (haddr_t)1
+#define H5AC__COPIED_TAG (haddr_t)2
+#define H5AC__SUPERBLOCK_TAG (haddr_t)3
+#define H5AC__FREESPACE_TAG (haddr_t)4
+#define H5AC__SOHM_TAG (haddr_t)5
+#define H5AC__GLOBALHEAP_TAG (haddr_t)6
/* Types of metadata objects cached */
typedef enum {
- H5AC_BT_ID = 0, /* ( 0) B-tree nodes */
- H5AC_SNODE_ID, /* ( 1) symbol table nodes */
- H5AC_LHEAP_PRFX_ID, /* ( 2) local heap prefix */
- H5AC_LHEAP_DBLK_ID, /* ( 3) local heap data block */
- H5AC_GHEAP_ID, /* ( 4) global heap */
- H5AC_OHDR_ID, /* ( 5) object header */
- H5AC_OHDR_CHK_ID, /* ( 6) object header chunk */
- H5AC_BT2_HDR_ID, /* ( 7) v2 B-tree header */
- H5AC_BT2_INT_ID, /* ( 8) v2 B-tree internal node */
- H5AC_BT2_LEAF_ID, /* ( 9) v2 B-tree leaf node */
- H5AC_FHEAP_HDR_ID, /* (10) fractal heap header */
- H5AC_FHEAP_DBLOCK_ID, /* (11) fractal heap direct block */
- H5AC_FHEAP_IBLOCK_ID, /* (12) fractal heap indirect block */
- H5AC_FSPACE_HDR_ID, /* (13) free space header */
- H5AC_FSPACE_SINFO_ID, /* (14) free space sections */
- H5AC_SOHM_TABLE_ID, /* (15) shared object header message master table */
- H5AC_SOHM_LIST_ID, /* (16) shared message index stored as a list */
- H5AC_EARRAY_HDR_ID, /* (17) extensible array header */
- H5AC_EARRAY_IBLOCK_ID, /* (18) extensible array index block */
- H5AC_EARRAY_SBLOCK_ID, /* (19) extensible array super block */
- H5AC_EARRAY_DBLOCK_ID, /* (20) extensible array data block */
- H5AC_EARRAY_DBLK_PAGE_ID, /* (21) extensible array data block page */
- H5AC_FARRAY_HDR_ID, /* (22) fixed array header */
- H5AC_FARRAY_DBLOCK_ID, /* (23) fixed array data block */
- H5AC_FARRAY_DBLK_PAGE_ID, /* (24) fixed array data block page */
- H5AC_SUPERBLOCK_ID, /* (25) file superblock */
- H5AC_DRVRINFO_ID, /* (26) driver info block (supplements superblock) */
- H5AC_EPOCH_MARKER_ID, /* (27) epoch marker - always internal to cache */
- H5AC_PROXY_ENTRY_ID, /* (28) cache entry proxy */
- H5AC_PREFETCHED_ENTRY_ID, /* (29) prefetched entry - always internal to cache */
- H5AC_NTYPES /* Number of types, must be last */
+ H5AC_BT_ID = 0, /* ( 0) B-tree nodes */
+ H5AC_SNODE_ID, /* ( 1) symbol table nodes */
+ H5AC_LHEAP_PRFX_ID, /* ( 2) local heap prefix */
+ H5AC_LHEAP_DBLK_ID, /* ( 3) local heap data block */
+ H5AC_GHEAP_ID, /* ( 4) global heap */
+ H5AC_OHDR_ID, /* ( 5) object header */
+ H5AC_OHDR_CHK_ID, /* ( 6) object header chunk */
+ H5AC_BT2_HDR_ID, /* ( 7) v2 B-tree header */
+ H5AC_BT2_INT_ID, /* ( 8) v2 B-tree internal node */
+ H5AC_BT2_LEAF_ID, /* ( 9) v2 B-tree leaf node */
+ H5AC_FHEAP_HDR_ID, /* (10) fractal heap header */
+ H5AC_FHEAP_DBLOCK_ID, /* (11) fractal heap direct block */
+ H5AC_FHEAP_IBLOCK_ID, /* (12) fractal heap indirect block */
+ H5AC_FSPACE_HDR_ID, /* (13) free space header */
+ H5AC_FSPACE_SINFO_ID, /* (14) free space sections */
+ H5AC_SOHM_TABLE_ID, /* (15) shared object header message master table */
+ H5AC_SOHM_LIST_ID, /* (16) shared message index stored as a list */
+ H5AC_EARRAY_HDR_ID, /* (17) extensible array header */
+ H5AC_EARRAY_IBLOCK_ID, /* (18) extensible array index block */
+ H5AC_EARRAY_SBLOCK_ID, /* (19) extensible array super block */
+ H5AC_EARRAY_DBLOCK_ID, /* (20) extensible array data block */
+ H5AC_EARRAY_DBLK_PAGE_ID, /* (21) extensible array data block page */
+ H5AC_FARRAY_HDR_ID, /* (22) fixed array header */
+ H5AC_FARRAY_DBLOCK_ID, /* (23) fixed array data block */
+ H5AC_FARRAY_DBLK_PAGE_ID, /* (24) fixed array data block page */
+ H5AC_SUPERBLOCK_ID, /* (25) file superblock */
+ H5AC_DRVRINFO_ID, /* (26) driver info block (supplements superblock) */
+ H5AC_EPOCH_MARKER_ID, /* (27) epoch marker - always internal to cache */
+ H5AC_PROXY_ENTRY_ID, /* (28) cache entry proxy */
+ H5AC_PREFETCHED_ENTRY_ID, /* (29) prefetched entry - always internal to cache */
+ H5AC_NTYPES /* Number of types, must be last */
} H5AC_type_t;
/* H5AC_DUMP_STATS_ON_CLOSE should always be FALSE when
@@ -107,13 +107,13 @@ typedef enum {
*/
#if H5C_COLLECT_CACHE_STATS
-#define H5AC_DUMP_STATS_ON_CLOSE 0
-#define H5AC_DUMP_IMAGE_STATS_ON_CLOSE 0
+#define H5AC_DUMP_STATS_ON_CLOSE 0
+#define H5AC_DUMP_IMAGE_STATS_ON_CLOSE 0
#else /* H5C_COLLECT_CACHE_STATS */
-#define H5AC_DUMP_STATS_ON_CLOSE 0
-#define H5AC_DUMP_IMAGE_STATS_ON_CLOSE 0
+#define H5AC_DUMP_STATS_ON_CLOSE 0
+#define H5AC_DUMP_IMAGE_STATS_ON_CLOSE 0
#endif /* H5C_COLLECT_CACHE_STATS */
@@ -121,8 +121,8 @@ typedef enum {
* At present, these are the same as those given in H5Cprivate.h.
*/
-#define H5AC__DEFAULT_MAX_CACHE_SIZE H5C__DEFAULT_MAX_CACHE_SIZE
-#define H5AC__DEFAULT_MIN_CLEAN_SIZE H5C__DEFAULT_MIN_CLEAN_SIZE
+#define H5AC__DEFAULT_MAX_CACHE_SIZE H5C__DEFAULT_MAX_CACHE_SIZE
+#define H5AC__DEFAULT_MIN_CLEAN_SIZE H5C__DEFAULT_MIN_CLEAN_SIZE
/* Check if we are sanity checking tagging */
#if H5C_DO_TAGGING_SANITY_CHECKS
@@ -137,16 +137,16 @@ typedef enum {
* to cache the object.
*/
-#define H5AC__SERIALIZE_RESIZED_FLAG H5C__SERIALIZE_RESIZED_FLAG
-#define H5AC__SERIALIZE_MOVED_FLAG H5C__SERIALIZE_MOVED_FLAG
+#define H5AC__SERIALIZE_RESIZED_FLAG H5C__SERIALIZE_RESIZED_FLAG
+#define H5AC__SERIALIZE_MOVED_FLAG H5C__SERIALIZE_MOVED_FLAG
/* Cork actions: cork/uncork/get cork status of an object */
-#define H5AC__SET_CORK H5C__SET_CORK
-#define H5AC__UNCORK H5C__UNCORK
-#define H5AC__GET_CORKED H5C__GET_CORKED
+#define H5AC__SET_CORK H5C__SET_CORK
+#define H5AC__UNCORK H5C__UNCORK
+#define H5AC__GET_CORKED H5C__GET_CORKED
/* Aliases for the "ring" type and values */
-typedef H5C_ring_t H5AC_ring_t;
+typedef H5C_ring_t H5AC_ring_t;
#define H5AC_RING_INV H5C_RING_UNDEFINED
#define H5AC_RING_USER H5C_RING_USER
#define H5AC_RING_RDFSM H5C_RING_RDFSM
@@ -156,72 +156,71 @@ typedef H5C_ring_t H5AC_ring_t;
#define H5AC_RING_NTYPES H5C_RING_NTYPES
/* Aliases for 'notify action' type & values */
-typedef H5C_notify_action_t H5AC_notify_action_t;
-#define H5AC_NOTIFY_ACTION_AFTER_INSERT H5C_NOTIFY_ACTION_AFTER_INSERT
-#define H5AC_NOTIFY_ACTION_AFTER_LOAD H5C_NOTIFY_ACTION_AFTER_LOAD
-#define H5AC_NOTIFY_ACTION_AFTER_FLUSH H5C_NOTIFY_ACTION_AFTER_FLUSH
-#define H5AC_NOTIFY_ACTION_BEFORE_EVICT H5C_NOTIFY_ACTION_BEFORE_EVICT
-#define H5AC_NOTIFY_ACTION_ENTRY_DIRTIED H5C_NOTIFY_ACTION_ENTRY_DIRTIED
-#define H5AC_NOTIFY_ACTION_ENTRY_CLEANED H5C_NOTIFY_ACTION_ENTRY_CLEANED
-#define H5AC_NOTIFY_ACTION_CHILD_DIRTIED H5C_NOTIFY_ACTION_CHILD_DIRTIED
-#define H5AC_NOTIFY_ACTION_CHILD_CLEANED H5C_NOTIFY_ACTION_CHILD_CLEANED
+typedef H5C_notify_action_t H5AC_notify_action_t;
+#define H5AC_NOTIFY_ACTION_AFTER_INSERT H5C_NOTIFY_ACTION_AFTER_INSERT
+#define H5AC_NOTIFY_ACTION_AFTER_LOAD H5C_NOTIFY_ACTION_AFTER_LOAD
+#define H5AC_NOTIFY_ACTION_AFTER_FLUSH H5C_NOTIFY_ACTION_AFTER_FLUSH
+#define H5AC_NOTIFY_ACTION_BEFORE_EVICT H5C_NOTIFY_ACTION_BEFORE_EVICT
+#define H5AC_NOTIFY_ACTION_ENTRY_DIRTIED H5C_NOTIFY_ACTION_ENTRY_DIRTIED
+#define H5AC_NOTIFY_ACTION_ENTRY_CLEANED H5C_NOTIFY_ACTION_ENTRY_CLEANED
+#define H5AC_NOTIFY_ACTION_CHILD_DIRTIED H5C_NOTIFY_ACTION_CHILD_DIRTIED
+#define H5AC_NOTIFY_ACTION_CHILD_CLEANED H5C_NOTIFY_ACTION_CHILD_CLEANED
#define H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED
-#define H5AC_NOTIFY_ACTION_CHILD_SERIALIZED H5C_NOTIFY_ACTION_CHILD_SERIALIZED
+#define H5AC_NOTIFY_ACTION_CHILD_SERIALIZED H5C_NOTIFY_ACTION_CHILD_SERIALIZED
-#define H5AC__CLASS_NO_FLAGS_SET H5C__CLASS_NO_FLAGS_SET
+#define H5AC__CLASS_NO_FLAGS_SET H5C__CLASS_NO_FLAGS_SET
#define H5AC__CLASS_SPECULATIVE_LOAD_FLAG H5C__CLASS_SPECULATIVE_LOAD_FLAG
/* The following flags should only appear in test code */
-#define H5AC__CLASS_SKIP_READS H5C__CLASS_SKIP_READS
-#define H5AC__CLASS_SKIP_WRITES H5C__CLASS_SKIP_WRITES
+#define H5AC__CLASS_SKIP_READS H5C__CLASS_SKIP_READS
+#define H5AC__CLASS_SKIP_WRITES H5C__CLASS_SKIP_WRITES
-typedef H5C_get_initial_load_size_func_t H5AC_get_initial_load_size_func_t;
-typedef H5C_get_final_load_size_func_t H5AC_get_final_load_size_func_t;
-typedef H5C_verify_chksum_func_t H5AC_verify_chksum_func_t;
-typedef H5C_deserialize_func_t H5AC_deserialize_func_t;
-typedef H5C_image_len_func_t H5AC_image_len_func_t;
+typedef H5C_get_initial_load_size_func_t H5AC_get_initial_load_size_func_t;
+typedef H5C_get_final_load_size_func_t H5AC_get_final_load_size_func_t;
+typedef H5C_verify_chksum_func_t H5AC_verify_chksum_func_t;
+typedef H5C_deserialize_func_t H5AC_deserialize_func_t;
+typedef H5C_image_len_func_t H5AC_image_len_func_t;
-#define H5AC__SERIALIZE_NO_FLAGS_SET H5C__SERIALIZE_NO_FLAGS_SET
-#define H5AC__SERIALIZE_RESIZED_FLAG H5C__SERIALIZE_RESIZED_FLAG
-#define H5AC__SERIALIZE_MOVED_FLAG H5C__SERIALIZE_MOVED_FLAG
+#define H5AC__SERIALIZE_NO_FLAGS_SET H5C__SERIALIZE_NO_FLAGS_SET
+#define H5AC__SERIALIZE_RESIZED_FLAG H5C__SERIALIZE_RESIZED_FLAG
+#define H5AC__SERIALIZE_MOVED_FLAG H5C__SERIALIZE_MOVED_FLAG
-typedef H5C_pre_serialize_func_t H5AC_pre_serialize_func_t;
-typedef H5C_serialize_func_t H5AC_serialize_func_t;
+typedef H5C_pre_serialize_func_t H5AC_pre_serialize_func_t;
+typedef H5C_serialize_func_t H5AC_serialize_func_t;
typedef H5C_notify_func_t H5AC_notify_func_t;
-typedef H5C_free_icr_func_t H5AC_free_icr_func_t;
-typedef H5C_get_fsf_size_t H5AC_get_fsf_size_t;
+typedef H5C_free_icr_func_t H5AC_free_icr_func_t;
+typedef H5C_get_fsf_size_t H5AC_get_fsf_size_t;
-typedef H5C_class_t H5AC_class_t;
+typedef H5C_class_t H5AC_class_t;
/* Cache entry info */
-typedef H5C_cache_entry_t H5AC_info_t;
+typedef H5C_cache_entry_t H5AC_info_t;
/* Typedef for metadata cache (defined in H5Cpkg.h) */
-typedef H5C_t H5AC_t;
+typedef H5C_t H5AC_t;
/* Metadata cache proxy entry type */
typedef struct H5AC_proxy_entry_t {
- H5AC_info_t cache_info; /* Information for H5AC cache functions */
- /* (MUST be first field in structure) */
+ H5AC_info_t cache_info; /* Information for H5AC cache functions */
+ /* (MUST be first field in structure) */
/* General fields */
- haddr_t addr; /* Address of the entry in the file */
- /* (Should be in 'temporary' address space) */
+ haddr_t addr; /* Address of the entry in the file */
+ /* (Should be in 'temporary' address space) */
/* Parent fields */
- H5SL_t *parents; /* Skip list to track parent addresses */
+ H5SL_t *parents; /* Skip list to track parent addresses */
/* Child fields */
- size_t nchildren; /* Number of children */
- size_t ndirty_children; /* Number of dirty children */
- /* (Note that this currently duplicates some cache functionality) */
- size_t nunser_children; /* Number of unserialized children */
- /* (Note that this currently duplicates some cache functionality) */
+ size_t nchildren; /* Number of children */
+ size_t ndirty_children; /* Number of dirty children */
+ /* (Note that this currently duplicates some cache functionality) */
+ size_t nunser_children; /* Number of unserialized children */
+ /* (Note that this currently duplicates some cache functionality) */
} H5AC_proxy_entry_t;
/* Default cache configuration. */
-#define H5AC__DEFAULT_METADATA_WRITE_STRATEGY \
- H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED
+#define H5AC__DEFAULT_METADATA_WRITE_STRATEGY H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED
/* clang-format off */
#ifdef H5_HAVE_PARALLEL
@@ -315,35 +314,34 @@ typedef struct H5AC_proxy_entry_t {
* the equivalent flags from H5Cprivate.h.
*/
-#define H5AC__NO_FLAGS_SET H5C__NO_FLAGS_SET
-#define H5AC__SET_FLUSH_MARKER_FLAG H5C__SET_FLUSH_MARKER_FLAG
-#define H5AC__DELETED_FLAG H5C__DELETED_FLAG
-#define H5AC__DIRTIED_FLAG H5C__DIRTIED_FLAG
-#define H5AC__PIN_ENTRY_FLAG H5C__PIN_ENTRY_FLAG
-#define H5AC__UNPIN_ENTRY_FLAG H5C__UNPIN_ENTRY_FLAG
-#define H5AC__FLUSH_INVALIDATE_FLAG H5C__FLUSH_INVALIDATE_FLAG
-#define H5AC__FLUSH_CLEAR_ONLY_FLAG H5C__FLUSH_CLEAR_ONLY_FLAG
+#define H5AC__NO_FLAGS_SET H5C__NO_FLAGS_SET
+#define H5AC__SET_FLUSH_MARKER_FLAG H5C__SET_FLUSH_MARKER_FLAG
+#define H5AC__DELETED_FLAG H5C__DELETED_FLAG
+#define H5AC__DIRTIED_FLAG H5C__DIRTIED_FLAG
+#define H5AC__PIN_ENTRY_FLAG H5C__PIN_ENTRY_FLAG
+#define H5AC__UNPIN_ENTRY_FLAG H5C__UNPIN_ENTRY_FLAG
+#define H5AC__FLUSH_INVALIDATE_FLAG H5C__FLUSH_INVALIDATE_FLAG
+#define H5AC__FLUSH_CLEAR_ONLY_FLAG H5C__FLUSH_CLEAR_ONLY_FLAG
#define H5AC__FLUSH_MARKED_ENTRIES_FLAG H5C__FLUSH_MARKED_ENTRIES_FLAG
#define H5AC__FLUSH_IGNORE_PROTECTED_FLAG H5C__FLUSH_IGNORE_PROTECTED_FLAG
-#define H5AC__READ_ONLY_FLAG H5C__READ_ONLY_FLAG
-#define H5AC__FREE_FILE_SPACE_FLAG H5C__FREE_FILE_SPACE_FLAG
+#define H5AC__READ_ONLY_FLAG H5C__READ_ONLY_FLAG
+#define H5AC__FREE_FILE_SPACE_FLAG H5C__FREE_FILE_SPACE_FLAG
#define H5AC__TAKE_OWNERSHIP_FLAG H5C__TAKE_OWNERSHIP_FLAG
-#define H5AC__FLUSH_LAST_FLAG H5C__FLUSH_LAST_FLAG
-#define H5AC__FLUSH_COLLECTIVELY_FLAG H5C__FLUSH_COLLECTIVELY_FLAG
-
+#define H5AC__FLUSH_LAST_FLAG H5C__FLUSH_LAST_FLAG
+#define H5AC__FLUSH_COLLECTIVELY_FLAG H5C__FLUSH_COLLECTIVELY_FLAG
/* #defines of flags used to report entry status in the
* H5AC_get_entry_status() call.
*/
-#define H5AC_ES__IN_CACHE 0x0001
-#define H5AC_ES__IS_DIRTY 0x0002
-#define H5AC_ES__IS_PROTECTED 0x0004
-#define H5AC_ES__IS_PINNED 0x0008
-#define H5AC_ES__IS_FLUSH_DEP_PARENT 0x0010
-#define H5AC_ES__IS_FLUSH_DEP_CHILD 0x0020
-#define H5AC_ES__IS_CORKED 0x0040
-#define H5AC_ES__IMAGE_IS_UP_TO_DATE 0x0080
+#define H5AC_ES__IN_CACHE 0x0001
+#define H5AC_ES__IS_DIRTY 0x0002
+#define H5AC_ES__IS_PROTECTED 0x0004
+#define H5AC_ES__IS_PINNED 0x0008
+#define H5AC_ES__IS_FLUSH_DEP_PARENT 0x0010
+#define H5AC_ES__IS_FLUSH_DEP_CHILD 0x0020
+#define H5AC_ES__IS_CORKED 0x0040
+#define H5AC_ES__IMAGE_IS_UP_TO_DATE 0x0080
/* Metadata entry class declarations */
H5_DLLVAR const H5AC_class_t H5AC_BT[1];
@@ -377,102 +375,87 @@ H5_DLLVAR const H5AC_class_t H5AC_EPOCH_MARKER[1];
H5_DLLVAR const H5AC_class_t H5AC_PROXY_ENTRY[1];
H5_DLLVAR const H5AC_class_t H5AC_PREFETCHED_ENTRY[1];
-
/* external function declarations: */
H5_DLL herr_t H5AC_init(void);
H5_DLL herr_t H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr,
- H5AC_cache_image_config_t * image_config_ptr);
-H5_DLL herr_t H5AC_get_entry_status(const H5F_t *f, haddr_t addr,
- unsigned *status_ptr);
-H5_DLL herr_t H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type,
- haddr_t addr, void *thing, unsigned int flags);
+ H5AC_cache_image_config_t *image_config_ptr);
+H5_DLL herr_t H5AC_get_entry_status(const H5F_t *f, haddr_t addr, unsigned *status_ptr);
+H5_DLL herr_t H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
+ unsigned int flags);
H5_DLL herr_t H5AC_pin_protected_entry(void *thing);
H5_DLL herr_t H5AC_prep_for_file_close(H5F_t *f);
H5_DLL herr_t H5AC_prep_for_file_flush(H5F_t *f);
H5_DLL herr_t H5AC_secure_from_file_flush(H5F_t *f);
H5_DLL herr_t H5AC_create_flush_dependency(void *parent_thing, void *child_thing);
-H5_DLL void * H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr,
- void *udata, unsigned flags);
+H5_DLL void * H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata, unsigned flags);
H5_DLL herr_t H5AC_resize_entry(void *thing, size_t new_size);
H5_DLL herr_t H5AC_unpin_entry(void *thing);
H5_DLL herr_t H5AC_destroy_flush_dependency(void *parent_thing, void *child_thing);
-H5_DLL herr_t H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr,
- void *thing, unsigned flags);
+H5_DLL herr_t H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned flags);
H5_DLL herr_t H5AC_flush(H5F_t *f);
H5_DLL herr_t H5AC_mark_entry_dirty(void *thing);
H5_DLL herr_t H5AC_mark_entry_clean(void *thing);
H5_DLL herr_t H5AC_mark_entry_unserialized(void *thing);
H5_DLL herr_t H5AC_mark_entry_serialized(void *thing);
-H5_DLL herr_t H5AC_move_entry(H5F_t *f, const H5AC_class_t *type,
- haddr_t old_addr, haddr_t new_addr);
+H5_DLL herr_t H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr);
H5_DLL herr_t H5AC_dest(H5F_t *f);
H5_DLL herr_t H5AC_evict(H5F_t *f);
-H5_DLL herr_t H5AC_expunge_entry(H5F_t *f, const H5AC_class_t *type,
- haddr_t addr, unsigned flags);
+H5_DLL herr_t H5AC_expunge_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, unsigned flags);
H5_DLL herr_t H5AC_remove_entry(void *entry);
-H5_DLL herr_t H5AC_get_cache_auto_resize_config(const H5AC_t * cache_ptr,
- H5AC_cache_config_t *config_ptr);
-H5_DLL herr_t H5AC_get_cache_size(H5AC_t *cache_ptr, size_t *max_size_ptr,
- size_t *min_clean_size_ptr, size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr);
+H5_DLL herr_t H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr);
+H5_DLL herr_t H5AC_get_cache_size(H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr,
+ size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr);
H5_DLL herr_t H5AC_get_cache_flush_in_progress(H5AC_t *cache_ptr, hbool_t *flush_in_progress_ptr);
H5_DLL herr_t H5AC_get_cache_hit_rate(H5AC_t *cache_ptr, double *hit_rate_ptr);
H5_DLL herr_t H5AC_reset_cache_hit_rate_stats(H5AC_t *cache_ptr);
-H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr,
- H5AC_cache_config_t *config_ptr);
+H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr);
H5_DLL herr_t H5AC_validate_config(H5AC_cache_config_t *config_ptr);
/* Cache image routines */
-H5_DLL herr_t H5AC_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr,
- hsize_t len, hbool_t rw);
-H5_DLL herr_t H5AC_validate_cache_image_config(H5AC_cache_image_config_t *config_ptr);
+H5_DLL herr_t H5AC_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len, hbool_t rw);
+H5_DLL herr_t H5AC_validate_cache_image_config(H5AC_cache_image_config_t *config_ptr);
H5_DLL hbool_t H5AC_cache_image_pending(const H5F_t *f);
-H5_DLL herr_t H5AC_force_cache_image_load(H5F_t * f);
-H5_DLL herr_t H5AC_get_mdc_image_info(H5AC_t *cache_ptr, haddr_t *image_addr,
- hsize_t *image_len);
+H5_DLL herr_t H5AC_force_cache_image_load(H5F_t *f);
+H5_DLL herr_t H5AC_get_mdc_image_info(H5AC_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len);
/* Tag & Ring routines */
-H5_DLL void H5AC_tag(haddr_t metadata_tag, haddr_t *prev_tag);
+H5_DLL void H5AC_tag(haddr_t metadata_tag, haddr_t *prev_tag);
H5_DLL herr_t H5AC_flush_tagged_metadata(H5F_t *f, haddr_t metadata_tag);
H5_DLL herr_t H5AC_evict_tagged_metadata(H5F_t *f, haddr_t metadata_tag, hbool_t match_global);
H5_DLL herr_t H5AC_retag_copied_metadata(const H5F_t *f, haddr_t metadata_tag);
H5_DLL herr_t H5AC_ignore_tags(const H5F_t *f);
H5_DLL herr_t H5AC_cork(H5F_t *f, haddr_t obj_addr, unsigned action, hbool_t *corked);
H5_DLL herr_t H5AC_get_entry_ring(const H5F_t *f, haddr_t addr, H5AC_ring_t *ring);
-H5_DLL void H5AC_set_ring(H5AC_ring_t ring, H5AC_ring_t *orig_ring);
+H5_DLL void H5AC_set_ring(H5AC_ring_t ring, H5AC_ring_t *orig_ring);
H5_DLL herr_t H5AC_unsettle_entry_ring(void *entry);
-H5_DLL herr_t H5AC_unsettle_ring(H5F_t * f, H5AC_ring_t ring);
-H5_DLL herr_t H5AC_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id,
- unsigned flags);
+H5_DLL herr_t H5AC_unsettle_ring(H5F_t *f, H5AC_ring_t ring);
+H5_DLL herr_t H5AC_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flags);
H5_DLL herr_t H5AC_get_tag(const void *thing, /*OUT*/ haddr_t *tag);
/* Virtual entry routines */
H5_DLL H5AC_proxy_entry_t *H5AC_proxy_entry_create(void);
-H5_DLL herr_t H5AC_proxy_entry_add_parent(H5AC_proxy_entry_t *pentry, void *parent);
-H5_DLL herr_t H5AC_proxy_entry_remove_parent(H5AC_proxy_entry_t *pentry, void *parent);
-H5_DLL herr_t H5AC_proxy_entry_add_child(H5AC_proxy_entry_t *pentry, H5F_t *f,
- void *child);
-H5_DLL herr_t H5AC_proxy_entry_remove_child(H5AC_proxy_entry_t *pentry, void *child);
-H5_DLL herr_t H5AC_proxy_entry_dest(H5AC_proxy_entry_t *pentry);
+H5_DLL herr_t H5AC_proxy_entry_add_parent(H5AC_proxy_entry_t *pentry, void *parent);
+H5_DLL herr_t H5AC_proxy_entry_remove_parent(H5AC_proxy_entry_t *pentry, void *parent);
+H5_DLL herr_t H5AC_proxy_entry_add_child(H5AC_proxy_entry_t *pentry, H5F_t *f, void *child);
+H5_DLL herr_t H5AC_proxy_entry_remove_child(H5AC_proxy_entry_t *pentry, void *child);
+H5_DLL herr_t H5AC_proxy_entry_dest(H5AC_proxy_entry_t *pentry);
#ifdef H5_HAVE_PARALLEL
-H5_DLL herr_t H5AC_add_candidate(H5AC_t * cache_ptr, haddr_t addr);
+H5_DLL herr_t H5AC_add_candidate(H5AC_t *cache_ptr, haddr_t addr);
#endif /* H5_HAVE_PARALLEL */
/* Debugging functions */
H5_DLL herr_t H5AC_stats(const H5F_t *f);
#ifndef NDEBUG
-H5_DLL herr_t H5AC_dump_cache(const H5F_t *f);
-H5_DLL herr_t H5AC_get_entry_ptr_from_addr(const H5F_t *f, haddr_t addr,
- void **entry_ptr_ptr);
-H5_DLL herr_t H5AC_flush_dependency_exists(H5F_t *f, haddr_t parent_addr,
- haddr_t child_addr, hbool_t *fd_exists_ptr);
-H5_DLL herr_t H5AC_verify_entry_type(const H5F_t *f, haddr_t addr,
- const H5AC_class_t *expected_type, hbool_t *in_cache_ptr,
- hbool_t *type_ok_ptr);
+H5_DLL herr_t H5AC_dump_cache(const H5F_t *f);
+H5_DLL herr_t H5AC_get_entry_ptr_from_addr(const H5F_t *f, haddr_t addr, void **entry_ptr_ptr);
+H5_DLL herr_t H5AC_flush_dependency_exists(H5F_t *f, haddr_t parent_addr, haddr_t child_addr,
+ hbool_t *fd_exists_ptr);
+H5_DLL herr_t H5AC_verify_entry_type(const H5F_t *f, haddr_t addr, const H5AC_class_t *expected_type,
+ hbool_t *in_cache_ptr, hbool_t *type_ok_ptr);
H5_DLL hbool_t H5AC_get_serialization_in_progress(H5F_t *f);
H5_DLL hbool_t H5AC_cache_is_clean(const H5F_t *f, H5AC_ring_t inner_ring);
#endif /* NDEBUG */ /* end debugging functions */
#endif /* !_H5ACprivate_H */
-
diff --git a/src/H5ACproxy_entry.c b/src/H5ACproxy_entry.c
index 498d023..76e885f 100644
--- a/src/H5ACproxy_entry.c
+++ b/src/H5ACproxy_entry.c
@@ -25,40 +25,35 @@
/****************/
/* Module Setup */
/****************/
-#include "H5ACmodule.h" /* This source code file is part of the H5AC module */
+#include "H5ACmodule.h" /* This source code file is part of the H5AC module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACpkg.h" /* Metadata cache */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MFprivate.h" /* File memory management */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5ACpkg.h" /* Metadata cache */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MFprivate.h" /* File memory management */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
/* Metadata cache (H5AC) callbacks */
static herr_t H5AC__proxy_entry_image_len(const void *thing, size_t *image_len);
-static herr_t H5AC__proxy_entry_serialize(const H5F_t *f, void *image_ptr,
- size_t len, void *thing);
+static herr_t H5AC__proxy_entry_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing);
static herr_t H5AC__proxy_entry_notify(H5AC_notify_action_t action, void *thing);
static herr_t H5AC__proxy_entry_free_icr(void *thing);
@@ -68,28 +63,26 @@ static herr_t H5AC__proxy_entry_free_icr(void *thing);
/* H5AC proxy entries inherit cache-like properties from H5AC */
const H5AC_class_t H5AC_PROXY_ENTRY[1] = {{
- H5AC_PROXY_ENTRY_ID, /* Metadata client ID */
- "Proxy entry", /* Metadata client name (for debugging) */
- H5FD_MEM_SUPER, /* File space memory type for client */
- 0, /* Client class behavior flags */
- NULL, /* 'get_initial_load_size' callback */
- NULL, /* 'get_final_load_size' callback */
- NULL, /* 'verify_chksum' callback */
- NULL, /* 'deserialize' callback */
- H5AC__proxy_entry_image_len, /* 'image_len' callback */
- NULL, /* 'pre_serialize' callback */
- H5AC__proxy_entry_serialize, /* 'serialize' callback */
- H5AC__proxy_entry_notify, /* 'notify' callback */
- H5AC__proxy_entry_free_icr, /* 'free_icr' callback */
- NULL, /* 'fsf_size' callback */
+ H5AC_PROXY_ENTRY_ID, /* Metadata client ID */
+ "Proxy entry", /* Metadata client name (for debugging) */
+ H5FD_MEM_SUPER, /* File space memory type for client */
+ 0, /* Client class behavior flags */
+ NULL, /* 'get_initial_load_size' callback */
+ NULL, /* 'get_final_load_size' callback */
+ NULL, /* 'verify_chksum' callback */
+ NULL, /* 'deserialize' callback */
+ H5AC__proxy_entry_image_len, /* 'image_len' callback */
+ NULL, /* 'pre_serialize' callback */
+ H5AC__proxy_entry_serialize, /* 'serialize' callback */
+ H5AC__proxy_entry_notify, /* 'notify' callback */
+ H5AC__proxy_entry_free_icr, /* 'free_icr' callback */
+ NULL, /* 'fsf_size' callback */
}};
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -97,8 +90,6 @@ const H5AC_class_t H5AC_PROXY_ENTRY[1] = {{
/* Declare a free list to manage H5AC_proxy_entry_t objects */
H5FL_DEFINE_STATIC(H5AC_proxy_entry_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5AC_proxy_entry_create
*
@@ -115,13 +106,13 @@ H5FL_DEFINE_STATIC(H5AC_proxy_entry_t);
H5AC_proxy_entry_t *
H5AC_proxy_entry_create(void)
{
- H5AC_proxy_entry_t *pentry = NULL; /* Pointer to new proxy entry */
- H5AC_proxy_entry_t *ret_value = NULL; /* Return value */
+ H5AC_proxy_entry_t *pentry = NULL; /* Pointer to new proxy entry */
+ H5AC_proxy_entry_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
/* Allocate new proxy entry */
- if(NULL == (pentry = H5FL_CALLOC(H5AC_proxy_entry_t)))
+ if (NULL == (pentry = H5FL_CALLOC(H5AC_proxy_entry_t)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "can't allocate proxy entry")
/* Set non-zero fields */
@@ -132,14 +123,13 @@ H5AC_proxy_entry_create(void)
done:
/* Release resources on error */
- if(!ret_value)
- if(pentry)
+ if (!ret_value)
+ if (pentry)
pentry = H5FL_FREE(H5AC_proxy_entry_t, pentry);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5AC_proxy_entry_create() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_proxy_entry_add_parent
*
@@ -155,8 +145,8 @@ done:
herr_t
H5AC_proxy_entry_add_parent(H5AC_proxy_entry_t *pentry, void *_parent)
{
- H5AC_info_t *parent = (H5AC_info_t *)_parent; /* Parent entry's cache info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_info_t *parent = (H5AC_info_t *)_parent; /* Parent entry's cache info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -165,20 +155,21 @@ H5AC_proxy_entry_add_parent(H5AC_proxy_entry_t *pentry, void *_parent)
HDassert(pentry);
/* Add parent to the list of parents */
- if(NULL == pentry->parents)
- if(NULL == (pentry->parents = H5SL_create(H5SL_TYPE_HADDR, NULL)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to create skip list for parents of proxy entry")
+ if (NULL == pentry->parents)
+ if (NULL == (pentry->parents = H5SL_create(H5SL_TYPE_HADDR, NULL)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL,
+ "unable to create skip list for parents of proxy entry")
/* Insert parent address into skip list */
- if(H5SL_insert(pentry->parents, parent, &parent->addr) < 0)
+ if (H5SL_insert(pentry->parents, parent, &parent->addr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "unable to insert parent into proxy's skip list")
/* Add flush dependency on parent */
- if(pentry->nchildren > 0) {
+ if (pentry->nchildren > 0) {
/* Sanity check */
HDassert(H5F_addr_defined(pentry->addr));
- if(H5AC_create_flush_dependency(parent, pentry) < 0)
+ if (H5AC_create_flush_dependency(parent, pentry) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "unable to set flush dependency on proxy entry")
} /* end if */
@@ -186,7 +177,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5AC_proxy_entry_add_parent() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_proxy_entry_remove_parent
*
@@ -202,9 +192,9 @@ done:
herr_t
H5AC_proxy_entry_remove_parent(H5AC_proxy_entry_t *pentry, void *_parent)
{
- H5AC_info_t *parent = (H5AC_info_t *)_parent; /* Pointer to the parent entry */
- H5AC_info_t *rem_parent; /* Pointer to the removed parent entry */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_info_t *parent = (H5AC_info_t *)_parent; /* Pointer to the parent entry */
+ H5AC_info_t *rem_parent; /* Pointer to the removed parent entry */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -214,31 +204,30 @@ H5AC_proxy_entry_remove_parent(H5AC_proxy_entry_t *pentry, void *_parent)
HDassert(parent);
/* Remove parent from skip list */
- if(NULL == (rem_parent = (H5AC_info_t *)H5SL_remove(pentry->parents, &parent->addr)))
+ if (NULL == (rem_parent = (H5AC_info_t *)H5SL_remove(pentry->parents, &parent->addr)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "unable to remove proxy entry parent from skip list")
- if(!H5F_addr_eq(rem_parent->addr, parent->addr))
+ if (!H5F_addr_eq(rem_parent->addr, parent->addr))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "removed proxy entry parent not the same as real parent")
/* Shut down the skip list, if this is the last parent */
- if(0 == H5SL_count(pentry->parents)) {
+ if (0 == H5SL_count(pentry->parents)) {
/* Sanity check */
HDassert(0 == pentry->nchildren);
- if(H5SL_close(pentry->parents) < 0)
+ if (H5SL_close(pentry->parents) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CLOSEERROR, FAIL, "can't close proxy parent skip list")
pentry->parents = NULL;
} /* end if */
/* Remove flush dependency between the proxy entry and a parent */
- if(pentry->nchildren > 0)
- if(H5AC_destroy_flush_dependency(parent, pentry) < 0)
+ if (pentry->nchildren > 0)
+ if (H5AC_destroy_flush_dependency(parent, pentry) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "unable to remove flush dependency on proxy entry")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5AC_proxy_entry_remove_parent() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__proxy_entry_add_child_cb
*
@@ -256,21 +245,21 @@ done:
static int
H5AC__proxy_entry_add_child_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
{
- H5AC_info_t *parent = (H5AC_info_t *)_item; /* Pointer to the parent entry */
- H5AC_proxy_entry_t *pentry = (H5AC_proxy_entry_t *)_udata; /* Pointer to the proxy entry */
- int ret_value = H5_ITER_CONT; /* Callback return value */
+ H5AC_info_t * parent = (H5AC_info_t *)_item; /* Pointer to the parent entry */
+ H5AC_proxy_entry_t *pentry = (H5AC_proxy_entry_t *)_udata; /* Pointer to the proxy entry */
+ int ret_value = H5_ITER_CONT; /* Callback return value */
FUNC_ENTER_STATIC
/* Add flush dependency on parent for proxy entry */
- if(H5AC_create_flush_dependency(parent, pentry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, H5_ITER_ERROR, "unable to set flush dependency for virtual entry")
+ if (H5AC_create_flush_dependency(parent, pentry) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, H5_ITER_ERROR,
+ "unable to set flush dependency for virtual entry")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5AC__proxy_entry_add_child_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_proxy_entry_add_child
*
@@ -286,7 +275,7 @@ done:
herr_t
H5AC_proxy_entry_add_child(H5AC_proxy_entry_t *pentry, H5F_t *f, void *child)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -295,32 +284,34 @@ H5AC_proxy_entry_add_child(H5AC_proxy_entry_t *pentry, H5F_t *f, void *child)
HDassert(child);
/* Check for first child */
- if(0 == pentry->nchildren) {
+ if (0 == pentry->nchildren) {
/* Get an address, if the proxy doesn't already have one */
- if(!H5F_addr_defined(pentry->addr))
- if(HADDR_UNDEF == (pentry->addr = H5MF_alloc_tmp(f, 1)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "temporary file space allocation failed for proxy entry")
+ if (!H5F_addr_defined(pentry->addr))
+ if (HADDR_UNDEF == (pentry->addr = H5MF_alloc_tmp(f, 1)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL,
+ "temporary file space allocation failed for proxy entry")
/* Insert the proxy entry into the cache */
- if(H5AC_insert_entry(f, H5AC_PROXY_ENTRY, pentry->addr, pentry, H5AC__PIN_ENTRY_FLAG) < 0)
+ if (H5AC_insert_entry(f, H5AC_PROXY_ENTRY, pentry->addr, pentry, H5AC__PIN_ENTRY_FLAG) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "unable to cache proxy entry")
/* Proxies start out clean (insertions are automatically marked dirty) */
- if(H5AC_mark_entry_clean(pentry) < 0)
+ if (H5AC_mark_entry_clean(pentry) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTCLEAN, FAIL, "can't mark proxy entry clean")
/* Proxies start out serialized (insertions are automatically marked unserialized) */
- if(H5AC_mark_entry_serialized(pentry) < 0)
+ if (H5AC_mark_entry_serialized(pentry) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "can't mark proxy entry clean")
- /* If there are currently parents, iterate over the list of parents, creating flush dependency on them */
- if(pentry->parents)
- if(H5SL_iterate(pentry->parents, H5AC__proxy_entry_add_child_cb, pentry) < 0)
+ /* If there are currently parents, iterate over the list of parents, creating flush dependency on them
+ */
+ if (pentry->parents)
+ if (H5SL_iterate(pentry->parents, H5AC__proxy_entry_add_child_cb, pentry) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "can't visit parents")
} /* end if */
/* Add flush dependency on proxy entry */
- if(H5AC_create_flush_dependency(pentry, child) < 0)
+ if (H5AC_create_flush_dependency(pentry, child) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "unable to set flush dependency on proxy entry")
/* Increment count of children */
@@ -330,7 +321,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5AC_proxy_entry_add_child() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__proxy_entry_remove_child_cb
*
@@ -348,21 +338,21 @@ done:
static int
H5AC__proxy_entry_remove_child_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
{
- H5AC_info_t *parent = (H5AC_info_t *)_item; /* Pointer to the parent entry */
- H5AC_proxy_entry_t *pentry = (H5AC_proxy_entry_t *)_udata; /* Pointer to the proxy entry */
- int ret_value = H5_ITER_CONT; /* Callback return value */
+ H5AC_info_t * parent = (H5AC_info_t *)_item; /* Pointer to the parent entry */
+ H5AC_proxy_entry_t *pentry = (H5AC_proxy_entry_t *)_udata; /* Pointer to the proxy entry */
+ int ret_value = H5_ITER_CONT; /* Callback return value */
FUNC_ENTER_STATIC
/* Remove flush dependency on parent for proxy entry */
- if(H5AC_destroy_flush_dependency(parent, pentry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, H5_ITER_ERROR, "unable to remove flush dependency for proxy entry")
+ if (H5AC_destroy_flush_dependency(parent, pentry) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, H5_ITER_ERROR,
+ "unable to remove flush dependency for proxy entry")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5AC__proxy_entry_remove_child_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_proxy_entry_remove_child
*
@@ -378,7 +368,7 @@ done:
herr_t
H5AC_proxy_entry_remove_child(H5AC_proxy_entry_t *pentry, void *child)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -387,26 +377,26 @@ H5AC_proxy_entry_remove_child(H5AC_proxy_entry_t *pentry, void *child)
HDassert(child);
/* Remove flush dependency on proxy entry */
- if(H5AC_destroy_flush_dependency(pentry, child) < 0)
+ if (H5AC_destroy_flush_dependency(pentry, child) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "unable to remove flush dependency on proxy entry")
/* Decrement count of children */
pentry->nchildren--;
/* Check for last child */
- if(0 == pentry->nchildren) {
+ if (0 == pentry->nchildren) {
/* Check for flush dependencies on proxy's parents */
- if(pentry->parents)
+ if (pentry->parents)
/* Iterate over the list of parents, removing flush dependency on them */
- if(H5SL_iterate(pentry->parents, H5AC__proxy_entry_remove_child_cb, pentry) < 0)
+ if (H5SL_iterate(pentry->parents, H5AC__proxy_entry_remove_child_cb, pentry) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "can't visit parents")
/* Unpin proxy */
- if(H5AC_unpin_entry(pentry) < 0)
+ if (H5AC_unpin_entry(pentry) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin proxy entry")
/* Remove proxy entry from cache */
- if(H5AC_remove_entry(pentry) < 0)
+ if (H5AC_remove_entry(pentry) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "unable to remove proxy entry")
} /* end if */
@@ -414,7 +404,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5AC_proxy_entry_remove_child() */
-
/*-------------------------------------------------------------------------
* Function: H5AC_proxy_entry_dest
*
@@ -430,7 +419,7 @@ done:
herr_t
H5AC_proxy_entry_dest(H5AC_proxy_entry_t *pentry)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -448,7 +437,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5AC_proxy_entry_dest() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__proxy_entry_image_len
*
@@ -475,7 +463,6 @@ H5AC__proxy_entry_image_len(const void H5_ATTR_UNUSED *thing, size_t *image_len)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5AC__proxy_entry_image_len() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__proxy_entry_serialize
*
@@ -492,19 +479,18 @@ H5AC__proxy_entry_image_len(const void H5_ATTR_UNUSED *thing, size_t *image_len)
*/
static herr_t
H5AC__proxy_entry_serialize(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED *image,
- size_t H5_ATTR_UNUSED len, void H5_ATTR_UNUSED *thing)
+ size_t H5_ATTR_UNUSED len, void H5_ATTR_UNUSED *thing)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- /* Should never be invoked */
- HDassert(0 && "Invalid callback?!?");
+ /* Should never be invoked */
+ HDassert(0 && "Invalid callback?!?");
HERROR(H5E_CACHE, H5E_CANTSERIALIZE, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5AC__proxy_entry_serialize() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__proxy_entry_notify
*
@@ -520,33 +506,33 @@ H5AC__proxy_entry_serialize(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED *
static herr_t
H5AC__proxy_entry_notify(H5AC_notify_action_t action, void *_thing)
{
- H5AC_proxy_entry_t *pentry = (H5AC_proxy_entry_t *)_thing;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_proxy_entry_t *pentry = (H5AC_proxy_entry_t *)_thing;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(pentry);
- switch(action) {
+ switch (action) {
case H5AC_NOTIFY_ACTION_AFTER_INSERT:
- break;
+ break;
- case H5AC_NOTIFY_ACTION_AFTER_LOAD:
+ case H5AC_NOTIFY_ACTION_AFTER_LOAD:
#ifdef NDEBUG
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid notify action from metadata cache")
-#else /* NDEBUG */
+#else /* NDEBUG */
HDassert(0 && "Invalid action?!?");
#endif /* NDEBUG */
break;
- case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
+ case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
#ifdef NDEBUG
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid notify action from metadata cache")
-#else /* NDEBUG */
+#else /* NDEBUG */
HDassert(0 && "Invalid action?!?");
#endif /* NDEBUG */
- break;
+ break;
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Sanity checks */
@@ -575,8 +561,8 @@ H5AC__proxy_entry_notify(H5AC_notify_action_t action, void *_thing)
pentry->ndirty_children++;
/* Check for first dirty child */
- if(1 == pentry->ndirty_children)
- if(H5AC_mark_entry_dirty(pentry) < 0)
+ if (1 == pentry->ndirty_children)
+ if (H5AC_mark_entry_dirty(pentry) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTDIRTY, FAIL, "can't mark proxy entry dirty")
break;
@@ -588,8 +574,8 @@ H5AC__proxy_entry_notify(H5AC_notify_action_t action, void *_thing)
pentry->ndirty_children--;
/* Check for last dirty child */
- if(0 == pentry->ndirty_children)
- if(H5AC_mark_entry_clean(pentry) < 0)
+ if (0 == pentry->ndirty_children)
+ if (H5AC_mark_entry_clean(pentry) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTCLEAN, FAIL, "can't mark proxy entry clean")
break;
@@ -598,8 +584,8 @@ H5AC__proxy_entry_notify(H5AC_notify_action_t action, void *_thing)
pentry->nunser_children++;
/* Check for first unserialized child */
- if(1 == pentry->nunser_children)
- if(H5AC_mark_entry_unserialized(pentry) < 0)
+ if (1 == pentry->nunser_children)
+ if (H5AC_mark_entry_unserialized(pentry) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNSERIALIZE, FAIL, "can't mark proxy entry unserialized")
break;
@@ -611,24 +597,23 @@ H5AC__proxy_entry_notify(H5AC_notify_action_t action, void *_thing)
pentry->nunser_children--;
/* Check for last unserialized child */
- if(0 == pentry->nunser_children)
- if(H5AC_mark_entry_serialized(pentry) < 0)
+ if (0 == pentry->nunser_children)
+ if (H5AC_mark_entry_serialized(pentry) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "can't mark proxy entry serialized")
break;
default:
#ifdef NDEBUG
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unknown notify action from metadata cache")
-#else /* NDEBUG */
+#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
- } /* end switch */
+ } /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5AC__proxy_entry_notify() */
-
/*-------------------------------------------------------------------------
* Function: H5AC__proxy_entry_free_icr
*
@@ -645,16 +630,15 @@ done:
static herr_t
H5AC__proxy_entry_free_icr(void *_thing)
{
- H5AC_proxy_entry_t *pentry = (H5AC_proxy_entry_t *)_thing;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_proxy_entry_t *pentry = (H5AC_proxy_entry_t *)_thing;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Destroy the proxy entry */
- if(H5AC_proxy_entry_dest(pentry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to destroy proxy entry")
+ if (H5AC_proxy_entry_dest(pentry) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to destroy proxy entry")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__proxy_entry_free_icr() */
-
diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h
index e6f4010..448311f 100644
--- a/src/H5ACpublic.h
+++ b/src/H5ACpublic.h
@@ -436,74 +436,69 @@ extern "C" {
*
****************************************************************************/
-#define H5AC__CURR_CACHE_CONFIG_VERSION 1
-#define H5AC__MAX_TRACE_FILE_NAME_LEN 1024
+#define H5AC__CURR_CACHE_CONFIG_VERSION 1
+#define H5AC__MAX_TRACE_FILE_NAME_LEN 1024
-#define H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY 0
-#define H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED 1
+#define H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY 0
+#define H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED 1
-typedef struct H5AC_cache_config_t
-{
+typedef struct H5AC_cache_config_t {
/* general configuration fields: */
- int version;
+ int version;
- hbool_t rpt_fcn_enabled;
+ hbool_t rpt_fcn_enabled;
- hbool_t open_trace_file;
- hbool_t close_trace_file;
- char trace_file_name[H5AC__MAX_TRACE_FILE_NAME_LEN + 1];
+ hbool_t open_trace_file;
+ hbool_t close_trace_file;
+ char trace_file_name[H5AC__MAX_TRACE_FILE_NAME_LEN + 1];
- hbool_t evictions_enabled;
+ hbool_t evictions_enabled;
- hbool_t set_initial_size;
- size_t initial_size;
+ hbool_t set_initial_size;
+ size_t initial_size;
- double min_clean_fraction;
+ double min_clean_fraction;
- size_t max_size;
- size_t min_size;
-
- long int epoch_length;
+ size_t max_size;
+ size_t min_size;
+ long int epoch_length;
/* size increase control fields: */
enum H5C_cache_incr_mode incr_mode;
- double lower_hr_threshold;
-
- double increment;
+ double lower_hr_threshold;
- hbool_t apply_max_increment;
- size_t max_increment;
+ double increment;
- enum H5C_cache_flash_incr_mode flash_incr_mode;
- double flash_multiple;
- double flash_threshold;
+ hbool_t apply_max_increment;
+ size_t max_increment;
+ enum H5C_cache_flash_incr_mode flash_incr_mode;
+ double flash_multiple;
+ double flash_threshold;
/* size decrease control fields: */
enum H5C_cache_decr_mode decr_mode;
- double upper_hr_threshold;
-
- double decrement;
+ double upper_hr_threshold;
- hbool_t apply_max_decrement;
- size_t max_decrement;
+ double decrement;
- int epochs_before_eviction;
+ hbool_t apply_max_decrement;
+ size_t max_decrement;
- hbool_t apply_empty_reserve;
- double empty_reserve;
+ int epochs_before_eviction;
+ hbool_t apply_empty_reserve;
+ double empty_reserve;
/* parallel configuration fields: */
- size_t dirty_bytes_threshold;
- int metadata_write_strategy;
+ size_t dirty_bytes_threshold;
+ int metadata_write_strategy;
} H5AC_cache_config_t;
-
/****************************************************************************
*
* structure H5AC_cache_image_config_t
@@ -553,20 +548,19 @@ typedef struct H5AC_cache_config_t
*
****************************************************************************/
-#define H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION 1
+#define H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION 1
-#define H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE -1
-#define H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX 100
+#define H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE -1
+#define H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX 100
typedef struct H5AC_cache_image_config_t {
- int version;
- hbool_t generate_image;
- hbool_t save_resize_status;
- int entry_ageout;
+ int version;
+ hbool_t generate_image;
+ hbool_t save_resize_status;
+ int entry_ageout;
} H5AC_cache_image_config_t;
#ifdef __cplusplus
}
#endif
#endif
-
diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c
index 0b38a4c..0a1346f 100644
--- a/src/H5Abtree2.c
+++ b/src/H5Abtree2.c
@@ -26,24 +26,21 @@
/* Module Setup */
/****************/
-#include "H5Amodule.h" /* This source code file is part of the H5A module */
-
+#include "H5Amodule.h" /* This source code file is part of the H5A module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Apkg.h" /* Attributes */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5SMprivate.h" /* Shared object header messages */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Apkg.h" /* Attributes */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5SMprivate.h" /* Shared object header messages */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
@@ -54,22 +51,20 @@
*/
typedef struct H5A_fh_ud_cmp_t {
/* downward */
- H5F_t *f; /* Pointer to file that fractal heap is in */
- const char *name; /* Name of attribute to compare */
- const H5A_dense_bt2_name_rec_t *record; /* v2 B-tree record for attribute */
- H5A_bt2_found_t found_op; /* Callback when correct attribute is found */
- void *found_op_data; /* Callback data when correct attribute is found */
+ H5F_t * f; /* Pointer to file that fractal heap is in */
+ const char * name; /* Name of attribute to compare */
+ const H5A_dense_bt2_name_rec_t *record; /* v2 B-tree record for attribute */
+ H5A_bt2_found_t found_op; /* Callback when correct attribute is found */
+ void * found_op_data; /* Callback data when correct attribute is found */
/* upward */
- int cmp; /* Comparison of two attribute names */
+ int cmp; /* Comparison of two attribute names */
} H5A_fh_ud_cmp_t;
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
@@ -79,51 +74,48 @@ typedef struct H5A_fh_ud_cmp_t {
/* v2 B-tree driver callbacks for 'creation order' index */
static herr_t H5A__dense_btree2_corder_store(void *native, const void *udata);
static herr_t H5A__dense_btree2_corder_compare(const void *rec1, const void *rec2, int *result);
-static herr_t H5A__dense_btree2_corder_encode(uint8_t *raw, const void *native,
- void *ctx);
-static herr_t H5A__dense_btree2_corder_decode(const uint8_t *raw, void *native,
- void *ctx);
-static herr_t H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth,
- const void *record, const void *_udata);
+static herr_t H5A__dense_btree2_corder_encode(uint8_t *raw, const void *native, void *ctx);
+static herr_t H5A__dense_btree2_corder_decode(const uint8_t *raw, void *native, void *ctx);
+static herr_t H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *record,
+ const void *_udata);
/* v2 B-tree driver callbacks for 'name' index */
static herr_t H5A__dense_btree2_name_store(void *native, const void *udata);
static herr_t H5A__dense_btree2_name_compare(const void *rec1, const void *rec2, int *result);
-static herr_t H5A__dense_btree2_name_encode(uint8_t *raw, const void *native,
- void *ctx);
-static herr_t H5A__dense_btree2_name_decode(const uint8_t *raw, void *native,
- void *ctx);
-static herr_t H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth,
- const void *record, const void *_udata);
+static herr_t H5A__dense_btree2_name_encode(uint8_t *raw, const void *native, void *ctx);
+static herr_t H5A__dense_btree2_name_decode(const uint8_t *raw, void *native, void *ctx);
+static herr_t H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *record,
+ const void *_udata);
/* Fractal heap function callbacks */
static herr_t H5A__dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data);
-
/*********************/
/* Package Variables */
/*********************/
/* v2 B-tree class for indexing 'name' field of attributes */
-const H5B2_class_t H5A_BT2_NAME[1]={{ /* B-tree class information */
- H5B2_ATTR_DENSE_NAME_ID, /* Type of B-tree */
- "H5B2_ATTR_DENSE_NAME_ID", /* Name of B-tree class */
- sizeof(H5A_dense_bt2_name_rec_t), /* Size of native record */
- NULL, /* Create client callback context */
- NULL, /* Destroy client callback context */
- H5A__dense_btree2_name_store, /* Record storage callback */
- H5A__dense_btree2_name_compare, /* Record comparison callback */
- H5A__dense_btree2_name_encode, /* Record encoding callback */
- H5A__dense_btree2_name_decode, /* Record decoding callback */
- H5A__dense_btree2_name_debug /* Record debugging callback */
+const H5B2_class_t H5A_BT2_NAME[1] = {{
+ /* B-tree class information */
+ H5B2_ATTR_DENSE_NAME_ID, /* Type of B-tree */
+ "H5B2_ATTR_DENSE_NAME_ID", /* Name of B-tree class */
+ sizeof(H5A_dense_bt2_name_rec_t), /* Size of native record */
+ NULL, /* Create client callback context */
+ NULL, /* Destroy client callback context */
+ H5A__dense_btree2_name_store, /* Record storage callback */
+ H5A__dense_btree2_name_compare, /* Record comparison callback */
+ H5A__dense_btree2_name_encode, /* Record encoding callback */
+ H5A__dense_btree2_name_decode, /* Record decoding callback */
+ H5A__dense_btree2_name_debug /* Record debugging callback */
}};
/* v2 B-tree class for indexing 'creation order' field of attributes */
-const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */
- H5B2_ATTR_DENSE_CORDER_ID, /* Type of B-tree */
- "H5B2_ATTR_DENSE_CORDER_ID", /* Name of B-tree class */
- sizeof(H5A_dense_bt2_corder_rec_t),/* Size of native record */
- NULL, /* Create client callback context */
- NULL, /* Destroy client callback context */
+const H5B2_class_t H5A_BT2_CORDER[1] = {{
+ /* B-tree class information */
+ H5B2_ATTR_DENSE_CORDER_ID, /* Type of B-tree */
+ "H5B2_ATTR_DENSE_CORDER_ID", /* Name of B-tree class */
+ sizeof(H5A_dense_bt2_corder_rec_t), /* Size of native record */
+ NULL, /* Create client callback context */
+ NULL, /* Destroy client callback context */
H5A__dense_btree2_corder_store, /* Record storage callback */
H5A__dense_btree2_corder_compare, /* Record comparison callback */
H5A__dense_btree2_corder_encode, /* Record encoding callback */
@@ -131,18 +123,14 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */
H5A__dense_btree2_corder_debug /* Record debugging callback */
}};
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_fh_name_cmp
*
@@ -159,43 +147,43 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */
static herr_t
H5A__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata)
{
- H5A_fh_ud_cmp_t *udata = (H5A_fh_ud_cmp_t *)_udata; /* User data for 'op' callback */
- H5A_t *attr = NULL; /* Pointer to attribute created from heap object */
- hbool_t took_ownership = FALSE; /* Whether the "found" operator took ownership of the attribute */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5A_fh_ud_cmp_t *udata = (H5A_fh_ud_cmp_t *)_udata; /* User data for 'op' callback */
+ H5A_t * attr = NULL; /* Pointer to attribute created from heap object */
+ hbool_t took_ownership = FALSE; /* Whether the "found" operator took ownership of the attribute */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Decode attribute information */
- if(NULL == (attr = (H5A_t *)H5O_msg_decode(udata->f, NULL, H5O_ATTR_ID, obj_len, (const unsigned char *)obj)))
+ if (NULL ==
+ (attr = (H5A_t *)H5O_msg_decode(udata->f, NULL, H5O_ATTR_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "can't decode attribute")
/* Compare the string values */
udata->cmp = HDstrcmp(udata->name, attr->shared->name);
/* Check for correct attribute & callback to make */
- if(udata->cmp == 0 && udata->found_op) {
+ if (udata->cmp == 0 && udata->found_op) {
/* Check whether we should "reconstitute" the shared message info */
- if(udata->record->flags & H5O_MSG_FLAG_SHARED)
+ if (udata->record->flags & H5O_MSG_FLAG_SHARED)
H5SM_reconstitute(&(attr->sh_loc), udata->f, H5O_ATTR_ID, udata->record->id);
/* Set the creation order index for the attribute */
attr->shared->crt_idx = udata->record->corder;
/* Make callback */
- if((udata->found_op)(attr, &took_ownership, udata->found_op_data) < 0)
+ if ((udata->found_op)(attr, &took_ownership, udata->found_op_data) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPERATE, FAIL, "attribute found callback failed")
} /* end if */
done:
/* Release the space allocated for the attrbute */
- if(attr && !took_ownership)
+ if (attr && !took_ownership)
H5O_msg_free(H5O_ATTR_ID, attr);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_fh_name_cmp() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_btree2_name_store
*
@@ -212,21 +200,20 @@ done:
static herr_t
H5A__dense_btree2_name_store(void *_nrecord, const void *_udata)
{
- const H5A_bt2_ud_ins_t *udata = (const H5A_bt2_ud_ins_t *)_udata;
+ const H5A_bt2_ud_ins_t * udata = (const H5A_bt2_ud_ins_t *)_udata;
H5A_dense_bt2_name_rec_t *nrecord = (H5A_dense_bt2_name_rec_t *)_nrecord;
FUNC_ENTER_STATIC_NOERR
/* Copy user information info native record */
- nrecord->id = udata->id;
- nrecord->flags = udata->common.flags;
+ nrecord->id = udata->id;
+ nrecord->flags = udata->common.flags;
nrecord->corder = udata->common.corder;
- nrecord->hash = udata->common.name_hash;
+ nrecord->hash = udata->common.name_hash;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A__dense_btree2_name_store() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_btree2_name_compare
*
@@ -244,9 +231,9 @@ H5A__dense_btree2_name_store(void *_nrecord, const void *_udata)
static herr_t
H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int *result)
{
- const H5A_bt2_ud_common_t *bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata;
- const H5A_dense_bt2_name_rec_t *bt2_rec = (const H5A_dense_bt2_name_rec_t *)_bt2_rec;
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5A_bt2_ud_common_t * bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata;
+ const H5A_dense_bt2_name_rec_t *bt2_rec = (const H5A_dense_bt2_name_rec_t *)_bt2_rec;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -255,37 +242,37 @@ H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int
HDassert(bt2_rec);
/* Check hash value */
- if(bt2_udata->name_hash < bt2_rec->hash)
+ if (bt2_udata->name_hash < bt2_rec->hash)
*result = (-1);
- else if(bt2_udata->name_hash > bt2_rec->hash)
+ else if (bt2_udata->name_hash > bt2_rec->hash)
*result = 1;
else {
- H5A_fh_ud_cmp_t fh_udata; /* User data for fractal heap 'op' callback */
- H5HF_t *fheap; /* Fractal heap handle to use for finding object */
+ H5A_fh_ud_cmp_t fh_udata; /* User data for fractal heap 'op' callback */
+ H5HF_t * fheap; /* Fractal heap handle to use for finding object */
/* Sanity check */
HDassert(bt2_udata->name_hash == bt2_rec->hash);
/* Prepare user data for callback */
/* down */
- fh_udata.f = bt2_udata->f;
- fh_udata.name = bt2_udata->name;
- fh_udata.record = bt2_rec;
- fh_udata.found_op = bt2_udata->found_op;
+ fh_udata.f = bt2_udata->f;
+ fh_udata.name = bt2_udata->name;
+ fh_udata.record = bt2_rec;
+ fh_udata.found_op = bt2_udata->found_op;
fh_udata.found_op_data = bt2_udata->found_op_data;
/* up */
fh_udata.cmp = 0;
/* Check for attribute in shared storage */
- if(bt2_rec->flags & H5O_MSG_FLAG_SHARED)
+ if (bt2_rec->flags & H5O_MSG_FLAG_SHARED)
fheap = bt2_udata->shared_fheap;
else
fheap = bt2_udata->fheap;
HDassert(fheap);
/* Check if the user's attribute and the B-tree's attribute have the same name */
- if(H5HF_op(fheap, &bt2_rec->id, H5A__dense_fh_name_cmp, &fh_udata) < 0)
+ if (H5HF_op(fheap, &bt2_rec->id, H5A__dense_fh_name_cmp, &fh_udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
/* Callback will set comparison value */
@@ -296,7 +283,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__dense_btree2_name_compare() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_btree2_name_encode
*
@@ -327,7 +313,6 @@ H5A__dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_U
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A__dense_btree2_name_encode() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_btree2_name_decode
*
@@ -358,7 +343,6 @@ H5A__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_U
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A__dense_btree2_name_decode() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_btree2_name_debug
*
@@ -373,21 +357,19 @@ H5A__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_U
*-------------------------------------------------------------------------
*/
static herr_t
-H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth,
- const void *_nrecord, const void H5_ATTR_UNUSED *_udata)
+H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_nrecord,
+ const void H5_ATTR_UNUSED *_udata)
{
const H5A_dense_bt2_name_rec_t *nrecord = (const H5A_dense_bt2_name_rec_t *)_nrecord;
FUNC_ENTER_STATIC_NOERR
HDfprintf(stream, "%*s%-*s {%016" PRIx64 ", %02" PRIx8 ", %u, %08" PRIx32 "}\n", indent, "", fwidth,
- "Record:",
- nrecord->id.val, nrecord->flags, (unsigned)nrecord->corder, nrecord->hash);
+ "Record:", nrecord->id.val, nrecord->flags, (unsigned)nrecord->corder, nrecord->hash);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A__dense_btree2_name_debug() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_btree2_corder_store
*
@@ -404,20 +386,19 @@ H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth,
static herr_t
H5A__dense_btree2_corder_store(void *_nrecord, const void *_udata)
{
- const H5A_bt2_ud_ins_t *udata = (const H5A_bt2_ud_ins_t *)_udata;
+ const H5A_bt2_ud_ins_t * udata = (const H5A_bt2_ud_ins_t *)_udata;
H5A_dense_bt2_corder_rec_t *nrecord = (H5A_dense_bt2_corder_rec_t *)_nrecord;
FUNC_ENTER_STATIC_NOERR
/* Copy user information info native record */
- nrecord->id = udata->id;
- nrecord->flags = udata->common.flags;
+ nrecord->id = udata->id;
+ nrecord->flags = udata->common.flags;
nrecord->corder = udata->common.corder;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A__dense_btree2_corder_store() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_btree2_corder_compare
*
@@ -435,8 +416,8 @@ H5A__dense_btree2_corder_store(void *_nrecord, const void *_udata)
static herr_t
H5A__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, int *result)
{
- const H5A_bt2_ud_common_t *bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata;
- const H5A_dense_bt2_corder_rec_t *bt2_rec = (const H5A_dense_bt2_corder_rec_t *)_bt2_rec;
+ const H5A_bt2_ud_common_t * bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata;
+ const H5A_dense_bt2_corder_rec_t *bt2_rec = (const H5A_dense_bt2_corder_rec_t *)_bt2_rec;
FUNC_ENTER_STATIC_NOERR
@@ -445,9 +426,9 @@ H5A__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, i
HDassert(bt2_rec);
/* Check creation order value */
- if(bt2_udata->corder < bt2_rec->corder)
+ if (bt2_udata->corder < bt2_rec->corder)
*result = -1;
- else if(bt2_udata->corder > bt2_rec->corder)
+ else if (bt2_udata->corder > bt2_rec->corder)
*result = 1;
else
*result = 0;
@@ -455,7 +436,6 @@ H5A__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, i
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A__dense_btree2_corder_compare() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_btree2_corder_encode
*
@@ -485,7 +465,6 @@ H5A__dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A__dense_btree2_corder_encode() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_btree2_corder_decode
*
@@ -515,7 +494,6 @@ H5A__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A__dense_btree2_corder_decode() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_btree2_corder_debug
*
@@ -530,17 +508,15 @@ H5A__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR
*-------------------------------------------------------------------------
*/
static herr_t
-H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth,
- const void *_nrecord, const void H5_ATTR_UNUSED *_udata)
+H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *_nrecord,
+ const void H5_ATTR_UNUSED *_udata)
{
const H5A_dense_bt2_corder_rec_t *nrecord = (const H5A_dense_bt2_corder_rec_t *)_nrecord;
FUNC_ENTER_STATIC_NOERR
HDfprintf(stream, "%*s%-*s {%016" PRIx64 ", %02" PRIx8 ", %u}\n", indent, "", fwidth,
- "Record:",
- nrecord->id.val, nrecord->flags, (unsigned)nrecord->corder);
+ "Record:", nrecord->id.val, nrecord->flags, (unsigned)nrecord->corder);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A__dense_btree2_corder_debug() */
-
diff --git a/src/H5Adense.c b/src/H5Adense.c
index ac6501a..3d99202 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -27,39 +27,36 @@
/* Module Setup */
/****************/
-#include "H5Amodule.h" /* This source code file is part of the H5A module */
-#define H5O_FRIEND /*suppress error about including H5Opkg */
-
+#include "H5Amodule.h" /* This source code file is part of the H5A module */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Apkg.h" /* Attributes */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-#include "H5SMprivate.h" /* Shared object header messages */
-#include "H5WBprivate.h" /* Wrapped Buffers */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Apkg.h" /* Attributes */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5SMprivate.h" /* Shared object header messages */
+#include "H5WBprivate.h" /* Wrapped Buffers */
/****************/
/* Local Macros */
/****************/
/* v2 B-tree creation macros for 'name' field index */
-#define H5A_NAME_BT2_NODE_SIZE 512
-#define H5A_NAME_BT2_MERGE_PERC 40
-#define H5A_NAME_BT2_SPLIT_PERC 100
+#define H5A_NAME_BT2_NODE_SIZE 512
+#define H5A_NAME_BT2_MERGE_PERC 40
+#define H5A_NAME_BT2_SPLIT_PERC 100
/* v2 B-tree creation macros for 'corder' field index */
-#define H5A_CORDER_BT2_NODE_SIZE 512
-#define H5A_CORDER_BT2_MERGE_PERC 40
-#define H5A_CORDER_BT2_SPLIT_PERC 100
+#define H5A_CORDER_BT2_NODE_SIZE 512
+#define H5A_CORDER_BT2_MERGE_PERC 40
+#define H5A_CORDER_BT2_SPLIT_PERC 100
/* Size of stack buffer for serialized attributes */
-#define H5A_ATTR_BUF_SIZE 128
-
+#define H5A_ATTR_BUF_SIZE 128
/******************/
/* Local Typedefs */
@@ -71,11 +68,11 @@
*/
typedef struct H5A_bt2_od_wrt_t {
/* downward */
- H5F_t *f; /* Pointer to file that fractal heap is in */
- H5HF_t *fheap; /* Fractal heap handle to operate on */
- H5HF_t *shared_fheap; /* Fractal heap handle for shared messages */
- H5A_t *attr; /* Attribute to write */
- haddr_t corder_bt2_addr; /* v2 B-tree address of creation order index */
+ H5F_t * f; /* Pointer to file that fractal heap is in */
+ H5HF_t *fheap; /* Fractal heap handle to operate on */
+ H5HF_t *shared_fheap; /* Fractal heap handle for shared messages */
+ H5A_t * attr; /* Attribute to write */
+ haddr_t corder_bt2_addr; /* v2 B-tree address of creation order index */
} H5A_bt2_od_wrt_t;
/*
@@ -84,19 +81,19 @@ typedef struct H5A_bt2_od_wrt_t {
*/
typedef struct {
/* downward (internal) */
- H5F_t *f; /* Pointer to file that fractal heap is in */
- H5HF_t *fheap; /* Fractal heap handle */
- H5HF_t *shared_fheap; /* Fractal heap handle for shared messages */
- hsize_t count; /* # of attributes examined */
+ H5F_t * f; /* Pointer to file that fractal heap is in */
+ H5HF_t *fheap; /* Fractal heap handle */
+ H5HF_t *shared_fheap; /* Fractal heap handle for shared messages */
+ hsize_t count; /* # of attributes examined */
/* downward (from application) */
- hid_t loc_id; /* Object ID for application callback */
- hsize_t skip; /* Number of attributes to skip */
- const H5A_attr_iter_op_t *attr_op; /* Callback for each attribute */
- void *op_data; /* Callback data for each attribute */
+ hid_t loc_id; /* Object ID for application callback */
+ hsize_t skip; /* Number of attributes to skip */
+ const H5A_attr_iter_op_t *attr_op; /* Callback for each attribute */
+ void * op_data; /* Callback data for each attribute */
/* upward */
- int op_ret; /* Return value from callback */
+ int op_ret; /* Return value from callback */
} H5A_bt2_ud_it_t;
/*
@@ -106,11 +103,11 @@ typedef struct {
*/
typedef struct {
/* downward (internal) */
- H5F_t *f; /* Pointer to file that fractal heap is in */
- const H5A_dense_bt2_name_rec_t *record; /* v2 B-tree record for attribute */
+ H5F_t * f; /* Pointer to file that fractal heap is in */
+ const H5A_dense_bt2_name_rec_t *record; /* v2 B-tree record for attribute */
/* upward */
- H5A_t *attr; /* Copy of attribute */
+ H5A_t *attr; /* Copy of attribute */
} H5A_fh_ud_cp_t;
/*
@@ -119,8 +116,8 @@ typedef struct {
*/
typedef struct H5A_bt2_ud_rm_t {
/* downward */
- H5A_bt2_ud_common_t common; /* Common info for B-tree user data (must be first) */
- haddr_t corder_bt2_addr; /* v2 B-tree address of creation order index */
+ H5A_bt2_ud_common_t common; /* Common info for B-tree user data (must be first) */
+ haddr_t corder_bt2_addr; /* v2 B-tree address of creation order index */
} H5A_bt2_ud_rm_t;
/*
@@ -129,40 +126,33 @@ typedef struct H5A_bt2_ud_rm_t {
*/
typedef struct H5A_bt2_ud_rmbi_t {
/* downward */
- H5F_t *f; /* Pointer to file that fractal heap is in */
- H5HF_t *fheap; /* Fractal heap handle */
- H5HF_t *shared_fheap; /* Fractal heap handle for shared messages */
- H5_index_t idx_type; /* Index type for operation */
- haddr_t other_bt2_addr; /* v2 B-tree address of "other" index */
+ H5F_t * f; /* Pointer to file that fractal heap is in */
+ H5HF_t * fheap; /* Fractal heap handle */
+ H5HF_t * shared_fheap; /* Fractal heap handle for shared messages */
+ H5_index_t idx_type; /* Index type for operation */
+ haddr_t other_bt2_addr; /* v2 B-tree address of "other" index */
} H5A_bt2_ud_rmbi_t;
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_create
*
@@ -180,10 +170,10 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo)
{
H5HF_create_t fheap_cparam; /* Fractal heap creation parameters */
H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */
- H5HF_t *fheap = NULL; /* Fractal heap handle */
- H5B2_t *bt2_name = NULL; /* v2 B-tree handle for names */
- H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5HF_t * fheap = NULL; /* Fractal heap handle */
+ H5B2_t * bt2_name = NULL; /* v2 B-tree handle for names */
+ H5B2_t * bt2_corder = NULL; /* v2 B-tree handle for creation order */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -192,84 +182,83 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo)
HDassert(ainfo);
/* Set fractal heap creation parameters */
-/* XXX: Give some control of these to applications? */
+ /* XXX: Give some control of these to applications? */
HDmemset(&fheap_cparam, 0, sizeof(fheap_cparam));
- fheap_cparam.managed.width = H5O_FHEAP_MAN_WIDTH;
+ fheap_cparam.managed.width = H5O_FHEAP_MAN_WIDTH;
fheap_cparam.managed.start_block_size = H5O_FHEAP_MAN_START_BLOCK_SIZE;
- fheap_cparam.managed.max_direct_size = H5O_FHEAP_MAN_MAX_DIRECT_SIZE;
- fheap_cparam.managed.max_index = H5O_FHEAP_MAN_MAX_INDEX;
- fheap_cparam.managed.start_root_rows = H5O_FHEAP_MAN_START_ROOT_ROWS;
- fheap_cparam.checksum_dblocks = H5O_FHEAP_CHECKSUM_DBLOCKS;
- fheap_cparam.max_man_size = H5O_FHEAP_MAX_MAN_SIZE;
+ fheap_cparam.managed.max_direct_size = H5O_FHEAP_MAN_MAX_DIRECT_SIZE;
+ fheap_cparam.managed.max_index = H5O_FHEAP_MAN_MAX_INDEX;
+ fheap_cparam.managed.start_root_rows = H5O_FHEAP_MAN_START_ROOT_ROWS;
+ fheap_cparam.checksum_dblocks = H5O_FHEAP_CHECKSUM_DBLOCKS;
+ fheap_cparam.max_man_size = H5O_FHEAP_MAX_MAN_SIZE;
/* Create fractal heap for storing attributes */
- if(NULL == (fheap = H5HF_create(f, &fheap_cparam)))
+ if (NULL == (fheap = H5HF_create(f, &fheap_cparam)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create fractal heap")
/* Retrieve the heap's address in the file */
- if(H5HF_get_heap_addr(fheap, &ainfo->fheap_addr) < 0)
+ if (H5HF_get_heap_addr(fheap, &ainfo->fheap_addr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get fractal heap address")
#ifndef NDEBUG
-{
- size_t fheap_id_len; /* Fractal heap ID length */
+ {
+ size_t fheap_id_len; /* Fractal heap ID length */
- /* Retrieve the heap's ID length in the file */
- if(H5HF_get_id_len(fheap, &fheap_id_len) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length")
- HDassert(fheap_id_len == H5O_FHEAP_ID_LEN);
-}
+ /* Retrieve the heap's ID length in the file */
+ if (H5HF_get_id_len(fheap, &fheap_id_len) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length")
+ HDassert(fheap_id_len == H5O_FHEAP_ID_LEN);
+ }
#endif /* NDEBUG */
/* Create the name index v2 B-tree */
HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam));
- bt2_cparam.cls = H5A_BT2_NAME;
+ bt2_cparam.cls = H5A_BT2_NAME;
bt2_cparam.node_size = (size_t)H5A_NAME_BT2_NODE_SIZE;
- bt2_cparam.rrec_size = 4 + /* Name's hash value */
- 4 + /* Creation order index */
- 1 + /* Message flags */
- H5O_FHEAP_ID_LEN; /* Fractal heap ID */
+ bt2_cparam.rrec_size = 4 + /* Name's hash value */
+ 4 + /* Creation order index */
+ 1 + /* Message flags */
+ H5O_FHEAP_ID_LEN; /* Fractal heap ID */
bt2_cparam.split_percent = H5A_NAME_BT2_SPLIT_PERC;
bt2_cparam.merge_percent = H5A_NAME_BT2_MERGE_PERC;
- if(NULL == (bt2_name = H5B2_create(f, &bt2_cparam, NULL)))
+ if (NULL == (bt2_name = H5B2_create(f, &bt2_cparam, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index")
/* Retrieve the v2 B-tree's address in the file */
- if(H5B2_get_addr(bt2_name, &ainfo->name_bt2_addr) < 0)
+ if (H5B2_get_addr(bt2_name, &ainfo->name_bt2_addr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get v2 B-tree address for name index")
/* Check if we should create a creation order index v2 B-tree */
- if(ainfo->index_corder) {
+ if (ainfo->index_corder) {
/* Create the creation order index v2 B-tree */
HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam));
- bt2_cparam.cls = H5A_BT2_CORDER;
+ bt2_cparam.cls = H5A_BT2_CORDER;
bt2_cparam.node_size = (size_t)H5A_CORDER_BT2_NODE_SIZE;
- bt2_cparam.rrec_size = 4 + /* Creation order index */
- 1 + /* Message flags */
- H5O_FHEAP_ID_LEN; /* Fractal heap ID */
+ bt2_cparam.rrec_size = 4 + /* Creation order index */
+ 1 + /* Message flags */
+ H5O_FHEAP_ID_LEN; /* Fractal heap ID */
bt2_cparam.split_percent = H5A_CORDER_BT2_SPLIT_PERC;
bt2_cparam.merge_percent = H5A_CORDER_BT2_MERGE_PERC;
- if(NULL == (bt2_corder = H5B2_create(f, &bt2_cparam, NULL)))
+ if (NULL == (bt2_corder = H5B2_create(f, &bt2_cparam, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for creation order index")
/* Retrieve the v2 B-tree's address in the file */
- if(H5B2_get_addr(bt2_corder, &ainfo->corder_bt2_addr) < 0)
+ if (H5B2_get_addr(bt2_corder, &ainfo->corder_bt2_addr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get v2 B-tree address for creation order index")
} /* end if */
done:
/* Release resources */
- if(fheap && H5HF_close(fheap) < 0)
+ if (fheap && H5HF_close(fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- if(bt2_name && H5B2_close(bt2_name) < 0)
+ if (bt2_name && H5B2_close(bt2_name) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
- if(bt2_corder && H5B2_close(bt2_corder) < 0)
+ if (bt2_corder && H5B2_close(bt2_corder) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_create() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_fnd_cb
*
@@ -286,7 +275,7 @@ static herr_t
H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr)
{
const H5A_t **user_attr = (const H5A_t **)_user_attr; /* User data from v2 B-tree attribute lookup */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -310,26 +299,25 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr)
* which may be merged/redistributed, we need to free the dynamically
* allocated spaces for the intermediate decoded attribute.
*/
- if(*user_attr != NULL) {
+ if (*user_attr != NULL) {
H5A_t *old_attr = *(H5A_t **)_user_attr;
/* Free any dynamically allocated items */
- if(old_attr->shared)
- if(H5A__shared_free(old_attr) < 0)
+ if (old_attr->shared)
+ if (H5A__shared_free(old_attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info")
old_attr = H5FL_FREE(H5A_t, old_attr);
- } /* end if */
+ } /* end if */
/* Take over attribute ownership */
- *user_attr = attr;
+ *user_attr = attr;
*took_ownership = TRUE;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_fnd_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_open
*
@@ -345,13 +333,13 @@ done:
H5A_t *
H5A__dense_open(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
{
- H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */
- H5HF_t *fheap = NULL; /* Fractal heap handle */
- H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
- H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
- htri_t attr_sharable; /* Flag indicating attributes are sharable */
- htri_t attr_exists; /* Attribute exists in v2 B-tree */
- H5A_t *ret_value = NULL; /* Return value */
+ H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */
+ H5HF_t * fheap = NULL; /* Fractal heap handle */
+ H5HF_t * shared_fheap = NULL; /* Fractal heap handle for shared header messages */
+ H5B2_t * bt2_name = NULL; /* v2 B-tree handle for name index */
+ htri_t attr_sharable; /* Flag indicating attributes are sharable */
+ htri_t attr_exists; /* Attribute exists in v2 B-tree */
+ H5A_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -361,63 +349,62 @@ H5A__dense_open(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
HDassert(name);
/* Open the fractal heap */
- if(NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
+ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open fractal heap")
/* Check if attributes are shared in this file */
- if((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0)
+ if ((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't determine if attributes are shared")
/* Get handle for shared message heap, if attributes are sharable */
- if(attr_sharable) {
- haddr_t shared_fheap_addr; /* Address of fractal heap to use */
+ if (attr_sharable) {
+ haddr_t shared_fheap_addr; /* Address of fractal heap to use */
/* Retrieve the address of the shared message's fractal heap */
- if(H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0)
+ if (H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't get shared message heap address")
/* Check if there are any shared messages currently */
- if(H5F_addr_defined(shared_fheap_addr)) {
+ if (H5F_addr_defined(shared_fheap_addr)) {
/* Open the fractal heap for shared header messages */
- if(NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr)))
+ if (NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open fractal heap")
} /* end if */
- } /* end if */
+ } /* end if */
/* Open the name index v2 B-tree */
- if(NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL)))
+ if (NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open v2 B-tree for name index")
/* Create the "udata" information for v2 B-tree record find */
- udata.f = f;
- udata.fheap = fheap;
- udata.shared_fheap = shared_fheap;
- udata.name = name;
- udata.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0);
- udata.flags = 0;
- udata.corder = 0;
- udata.found_op = H5A__dense_fnd_cb; /* v2 B-tree comparison callback */
+ udata.f = f;
+ udata.fheap = fheap;
+ udata.shared_fheap = shared_fheap;
+ udata.name = name;
+ udata.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0);
+ udata.flags = 0;
+ udata.corder = 0;
+ udata.found_op = H5A__dense_fnd_cb; /* v2 B-tree comparison callback */
udata.found_op_data = &ret_value;
/* Find & copy the attribute in the 'name' index */
- if((attr_exists = H5B2_find(bt2_name, &udata, NULL, NULL)) < 0)
+ if ((attr_exists = H5B2_find(bt2_name, &udata, NULL, NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "can't search for attribute in name index")
- else if(attr_exists == FALSE)
+ else if (attr_exists == FALSE)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "can't locate attribute in name index")
done:
/* Release resources */
- if(shared_fheap && H5HF_close(shared_fheap) < 0)
+ if (shared_fheap && H5HF_close(shared_fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, NULL, "can't close fractal heap")
- if(fheap && H5HF_close(fheap) < 0)
+ if (fheap && H5HF_close(fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, NULL, "can't close fractal heap")
- if(bt2_name && H5B2_close(bt2_name) < 0)
+ if (bt2_name && H5B2_close(bt2_name) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, NULL, "can't close v2 B-tree for name index")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_open() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_insert
*
@@ -433,16 +420,16 @@ done:
herr_t
H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr)
{
- H5A_bt2_ud_ins_t udata; /* User data for v2 B-tree insertion */
- H5HF_t *fheap = NULL; /* Fractal heap handle for attributes */
- H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
- H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
- H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */
- H5WB_t *wb = NULL; /* Wrapped buffer for attribute data */
- uint8_t attr_buf[H5A_ATTR_BUF_SIZE]; /* Buffer for serializing message */
- unsigned mesg_flags = 0; /* Flags for storing message */
- htri_t attr_sharable; /* Flag indicating attributes are sharable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5A_bt2_ud_ins_t udata; /* User data for v2 B-tree insertion */
+ H5HF_t * fheap = NULL; /* Fractal heap handle for attributes */
+ H5HF_t * shared_fheap = NULL; /* Fractal heap handle for shared header messages */
+ H5B2_t * bt2_name = NULL; /* v2 B-tree handle for name index */
+ H5B2_t * bt2_corder = NULL; /* v2 B-tree handle for creation order index */
+ H5WB_t * wb = NULL; /* Wrapped buffer for attribute data */
+ uint8_t attr_buf[H5A_ATTR_BUF_SIZE]; /* Buffer for serializing message */
+ unsigned mesg_flags = 0; /* Flags for storing message */
+ htri_t attr_sharable; /* Flag indicating attributes are sharable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -452,23 +439,23 @@ H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr)
HDassert(attr);
/* Check if attributes are shared in this file */
- if((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0)
+ if ((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared")
/* Get handle for shared message heap, if attributes are sharable */
- if(attr_sharable) {
- haddr_t shared_fheap_addr; /* Address of fractal heap to use */
- htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */
+ if (attr_sharable) {
+ haddr_t shared_fheap_addr; /* Address of fractal heap to use */
+ htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */
/* Check if message is already shared */
- if((shared_mesg = H5O_msg_is_shared(H5O_ATTR_ID, attr)) < 0)
+ if ((shared_mesg = H5O_msg_is_shared(H5O_ATTR_ID, attr)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "error determining if message is shared")
- else if(shared_mesg > 0)
+ else if (shared_mesg > 0)
/* Mark the message as shared */
mesg_flags |= H5O_MSG_FLAG_SHARED;
else {
/* Should this attribute be written as a SOHM? */
- if(H5SM_try_share(f, NULL, 0, H5O_ATTR_ID, attr, &mesg_flags) < 0)
+ if (H5SM_try_share(f, NULL, 0, H5O_ATTR_ID, attr, &mesg_flags) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared")
/* Attributes can't be "unique be shareable" yet */
@@ -476,23 +463,23 @@ H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr)
} /* end else */
/* Retrieve the address of the shared message's fractal heap */
- if(H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0)
+ if (H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address")
/* Check if there are any shared messages currently */
- if(H5F_addr_defined(shared_fheap_addr)) {
+ if (H5F_addr_defined(shared_fheap_addr)) {
/* Open the fractal heap for shared header messages */
- if(NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr)))
+ if (NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
} /* end if */
- } /* end if */
+ } /* end if */
/* Open the fractal heap */
- if(NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
+ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Check for inserting shared attribute */
- if(mesg_flags & H5O_MSG_FLAG_SHARED) {
+ if (mesg_flags & H5O_MSG_FLAG_SHARED) {
/* Sanity check */
HDassert(attr_sharable);
@@ -500,80 +487,79 @@ H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr)
udata.id = attr->sh_loc.u.heap_id;
} /* end if */
else {
- void *attr_ptr; /* Pointer to serialized message */
- size_t attr_size; /* Size of serialized attribute in the heap */
+ void * attr_ptr; /* Pointer to serialized message */
+ size_t attr_size; /* Size of serialized attribute in the heap */
/* Find out the size of buffer needed for serialized message */
- if((attr_size = H5O_msg_raw_size(f, H5O_ATTR_ID, FALSE, attr)) == 0)
+ if ((attr_size = H5O_msg_raw_size(f, H5O_ATTR_ID, FALSE, attr)) == 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get message size")
/* Wrap the local buffer for serialized attributes */
- if(NULL == (wb = H5WB_wrap(attr_buf, sizeof(attr_buf))))
+ if (NULL == (wb = H5WB_wrap(attr_buf, sizeof(attr_buf))))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't wrap buffer")
/* Get a pointer to a buffer that's large enough for attribute */
- if(NULL == (attr_ptr = H5WB_actual(wb, attr_size)))
+ if (NULL == (attr_ptr = H5WB_actual(wb, attr_size)))
HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "can't get actual buffer")
/* Create serialized form of attribute or shared message */
- if(H5O_msg_encode(f, H5O_ATTR_ID, FALSE, (unsigned char *)attr_ptr, attr) < 0)
+ if (H5O_msg_encode(f, H5O_ATTR_ID, FALSE, (unsigned char *)attr_ptr, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute")
/* Insert the serialized attribute into the fractal heap */
/* (sets the heap ID in the user data) */
- if(H5HF_insert(fheap, attr_size, attr_ptr, &udata.id) < 0)
+ if (H5HF_insert(fheap, attr_size, attr_ptr, &udata.id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to insert attribute into fractal heap")
} /* end else */
/* Open the name index v2 B-tree */
- if(NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL)))
+ if (NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Create the callback information for v2 B-tree record insertion */
- udata.common.f = f;
- udata.common.fheap = fheap;
+ udata.common.f = f;
+ udata.common.fheap = fheap;
udata.common.shared_fheap = shared_fheap;
- udata.common.name = attr->shared->name;
- udata.common.name_hash = H5_checksum_lookup3(attr->shared->name, HDstrlen(attr->shared->name), 0);
+ udata.common.name = attr->shared->name;
+ udata.common.name_hash = H5_checksum_lookup3(attr->shared->name, HDstrlen(attr->shared->name), 0);
H5_CHECKED_ASSIGN(udata.common.flags, uint8_t, mesg_flags, unsigned);
- udata.common.corder = attr->shared->crt_idx;
- udata.common.found_op = NULL;
+ udata.common.corder = attr->shared->crt_idx;
+ udata.common.found_op = NULL;
udata.common.found_op_data = NULL;
/* udata.id already set */
/* Insert attribute into 'name' tracking v2 B-tree */
- if(H5B2_insert(bt2_name, &udata) < 0)
+ if (H5B2_insert(bt2_name, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree")
/* Check if we should create a creation order index v2 B-tree record */
- if(ainfo->index_corder) {
+ if (ainfo->index_corder) {
/* Open the creation order index v2 B-tree */
HDassert(H5F_addr_defined(ainfo->corder_bt2_addr));
- if(NULL == (bt2_corder = H5B2_open(f, ainfo->corder_bt2_addr, NULL)))
+ if (NULL == (bt2_corder = H5B2_open(f, ainfo->corder_bt2_addr, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
/* Insert the record into the creation order index v2 B-tree */
- if(H5B2_insert(bt2_corder, &udata) < 0)
+ if (H5B2_insert(bt2_corder, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree")
} /* end if */
done:
/* Release resources */
- if(shared_fheap && H5HF_close(shared_fheap) < 0)
+ if (shared_fheap && H5HF_close(shared_fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- if(fheap && H5HF_close(fheap) < 0)
+ if (fheap && H5HF_close(fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- if(bt2_name && H5B2_close(bt2_name) < 0)
+ if (bt2_name && H5B2_close(bt2_name) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
- if(bt2_corder && H5B2_close(bt2_corder) < 0)
+ if (bt2_corder && H5B2_close(bt2_corder) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index")
- if(wb && H5WB_unwrap(wb) < 0)
+ if (wb && H5WB_unwrap(wb) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_insert() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_write_bt2_cb2
*
@@ -591,7 +577,7 @@ static herr_t
H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed)
{
H5A_dense_bt2_corder_rec_t *record = (H5A_dense_bt2_corder_rec_t *)_record; /* Record from B-tree */
- H5O_fheap_id_t *new_heap_id = (H5O_fheap_id_t *)_op_data; /* "op data" from v2 B-tree modify */
+ H5O_fheap_id_t *new_heap_id = (H5O_fheap_id_t *)_op_data; /* "op data" from v2 B-tree modify */
FUNC_ENTER_STATIC_NOERR
@@ -608,7 +594,6 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5A__dense_write_bt2_cb2() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_write_bt2_cb
*
@@ -624,12 +609,12 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed)
static herr_t
H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed)
{
- H5A_dense_bt2_name_rec_t *record = (H5A_dense_bt2_name_rec_t *)_record; /* Record from B-tree */
- H5A_bt2_od_wrt_t *op_data = (H5A_bt2_od_wrt_t *)_op_data; /* "op data" from v2 B-tree modify */
- H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */
- H5WB_t *wb = NULL; /* Wrapped buffer for attribute data */
- uint8_t attr_buf[H5A_ATTR_BUF_SIZE]; /* Buffer for serializing attribute */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5A_dense_bt2_name_rec_t *record = (H5A_dense_bt2_name_rec_t *)_record; /* Record from B-tree */
+ H5A_bt2_od_wrt_t * op_data = (H5A_bt2_od_wrt_t *)_op_data; /* "op data" from v2 B-tree modify */
+ H5B2_t * bt2_corder = NULL; /* v2 B-tree handle for creation order index */
+ H5WB_t * wb = NULL; /* Wrapped buffer for attribute data */
+ uint8_t attr_buf[H5A_ATTR_BUF_SIZE]; /* Buffer for serializing attribute */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -638,35 +623,37 @@ H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed)
HDassert(op_data);
/* Check for modifying shared attribute */
- if(record->flags & H5O_MSG_FLAG_SHARED) {
+ if (record->flags & H5O_MSG_FLAG_SHARED) {
/* Update the shared attribute in the SOHM info */
- if(H5O__attr_update_shared(op_data->f, NULL, op_data->attr, NULL) < 0)
+ if (H5O__attr_update_shared(op_data->f, NULL, op_data->attr, NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute in shared storage")
/* Update record's heap ID */
record->id = op_data->attr->sh_loc.u.heap_id;
/* Check if we need to modify the creation order index with new heap ID */
- if(H5F_addr_defined(op_data->corder_bt2_addr)) {
- H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */
+ if (H5F_addr_defined(op_data->corder_bt2_addr)) {
+ H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */
/* Open the creation order index v2 B-tree */
- if(NULL == (bt2_corder = H5B2_open(op_data->f, op_data->corder_bt2_addr, NULL)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
+ if (NULL == (bt2_corder = H5B2_open(op_data->f, op_data->corder_bt2_addr, NULL)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL,
+ "unable to open v2 B-tree for creation order index")
/* Create the "udata" information for v2 B-tree record modify */
- udata.f = op_data->f;
- udata.fheap = NULL;
- udata.shared_fheap = NULL;
- udata.name = NULL;
- udata.name_hash = 0;
- udata.flags = 0;
- udata.corder = op_data->attr->shared->crt_idx;
- udata.found_op = NULL;
+ udata.f = op_data->f;
+ udata.fheap = NULL;
+ udata.shared_fheap = NULL;
+ udata.name = NULL;
+ udata.name_hash = 0;
+ udata.flags = 0;
+ udata.corder = op_data->attr->shared->crt_idx;
+ udata.found_op = NULL;
udata.found_op_data = NULL;
/* Modify record for creation order index */
- if(H5B2_modify(bt2_corder, &udata, H5A__dense_write_bt2_cb2, &op_data->attr->sh_loc.u.heap_id) < 0)
+ if (H5B2_modify(bt2_corder, &udata, H5A__dense_write_bt2_cb2, &op_data->attr->sh_loc.u.heap_id) <
+ 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to modify record in v2 B-tree")
} /* end if */
@@ -674,52 +661,51 @@ H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed)
*changed = TRUE;
} /* end if */
else {
- void *attr_ptr; /* Pointer to serialized message */
- size_t attr_size; /* Size of serialized attribute in the heap */
+ void * attr_ptr; /* Pointer to serialized message */
+ size_t attr_size; /* Size of serialized attribute in the heap */
/* Find out the size of buffer needed for serialized attribute */
- if((attr_size = H5O_msg_raw_size(op_data->f, H5O_ATTR_ID, FALSE, op_data->attr)) == 0)
+ if ((attr_size = H5O_msg_raw_size(op_data->f, H5O_ATTR_ID, FALSE, op_data->attr)) == 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get attribute size")
/* Wrap the local buffer for serialized attributes */
- if(NULL == (wb = H5WB_wrap(attr_buf, sizeof(attr_buf))))
+ if (NULL == (wb = H5WB_wrap(attr_buf, sizeof(attr_buf))))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't wrap buffer")
/* Get a pointer to a buffer that's large enough for attribute */
- if(NULL == (attr_ptr = H5WB_actual(wb, attr_size)))
+ if (NULL == (attr_ptr = H5WB_actual(wb, attr_size)))
HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "can't get actual buffer")
/* Create serialized form of attribute */
- if(H5O_msg_encode(op_data->f, H5O_ATTR_ID, FALSE, (unsigned char *)attr_ptr, op_data->attr) < 0)
+ if (H5O_msg_encode(op_data->f, H5O_ATTR_ID, FALSE, (unsigned char *)attr_ptr, op_data->attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute")
/* Sanity check */
#ifndef NDEBUG
-{
- size_t obj_len; /* Length of existing encoded attribute */
+ {
+ size_t obj_len; /* Length of existing encoded attribute */
- if(H5HF_get_obj_len(op_data->fheap, &record->id, &obj_len) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get object size")
- HDassert(obj_len == attr_size);
-}
+ if (H5HF_get_obj_len(op_data->fheap, &record->id, &obj_len) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get object size")
+ HDassert(obj_len == attr_size);
+ }
#endif /* NDEBUG */
/* Update existing attribute in heap */
/* (might be more efficient as fractal heap 'op' callback, but leave that for later -QAK) */
- if(H5HF_write(op_data->fheap, &record->id, changed, attr_ptr) < 0)
+ if (H5HF_write(op_data->fheap, &record->id, changed, attr_ptr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute in heap")
} /* end else */
done:
/* Release resources */
- if(bt2_corder && H5B2_close(bt2_corder) < 0)
+ if (bt2_corder && H5B2_close(bt2_corder) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index")
- if(wb && H5WB_unwrap(wb) < 0)
+ if (wb && H5WB_unwrap(wb) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_write_bt2_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_write
*
@@ -735,13 +721,13 @@ done:
herr_t
H5A__dense_write(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr)
{
- H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */
- H5A_bt2_od_wrt_t op_data; /* "Op data" for v2 B-tree modify */
- H5HF_t *fheap = NULL; /* Fractal heap handle */
- H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
- H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
- htri_t attr_sharable; /* Flag indicating attributes are sharable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */
+ H5A_bt2_od_wrt_t op_data; /* "Op data" for v2 B-tree modify */
+ H5HF_t * fheap = NULL; /* Fractal heap handle */
+ H5HF_t * shared_fheap = NULL; /* Fractal heap handle for shared header messages */
+ H5B2_t * bt2_name = NULL; /* v2 B-tree handle for name index */
+ htri_t attr_sharable; /* Flag indicating attributes are sharable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -753,68 +739,67 @@ H5A__dense_write(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr)
HDassert(attr);
/* Check if attributes are shared in this file */
- if((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0)
+ if ((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared")
/* Get handle for shared message heap, if attributes are sharable */
- if(attr_sharable) {
- haddr_t shared_fheap_addr; /* Address of fractal heap to use */
+ if (attr_sharable) {
+ haddr_t shared_fheap_addr; /* Address of fractal heap to use */
/* Retrieve the address of the shared message's fractal heap */
- if(H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0)
+ if (H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address")
/* Check if there are any shared messages currently */
- if(H5F_addr_defined(shared_fheap_addr)) {
+ if (H5F_addr_defined(shared_fheap_addr)) {
/* Open the fractal heap for shared header messages */
- if(NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr)))
+ if (NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
} /* end if */
- } /* end if */
+ } /* end if */
/* Open the fractal heap */
- if(NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
+ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Open the name index v2 B-tree */
- if(NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL)))
+ if (NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Create the "udata" information for v2 B-tree record modify */
- udata.f = f;
- udata.fheap = fheap;
- udata.shared_fheap = shared_fheap;
- udata.name = attr->shared->name;
- udata.name_hash = H5_checksum_lookup3(attr->shared->name, HDstrlen(attr->shared->name), 0);
- udata.flags = 0;
- udata.corder = 0;
- udata.found_op = NULL;
+ udata.f = f;
+ udata.fheap = fheap;
+ udata.shared_fheap = shared_fheap;
+ udata.name = attr->shared->name;
+ udata.name_hash = H5_checksum_lookup3(attr->shared->name, HDstrlen(attr->shared->name), 0);
+ udata.flags = 0;
+ udata.corder = 0;
+ udata.found_op = NULL;
udata.found_op_data = NULL;
/* Create the "op_data" for the v2 B-tree record 'modify' callback */
- op_data.f = f;
- op_data.fheap = fheap;
- op_data.shared_fheap = shared_fheap;
- op_data.attr = attr;
+ op_data.f = f;
+ op_data.fheap = fheap;
+ op_data.shared_fheap = shared_fheap;
+ op_data.attr = attr;
op_data.corder_bt2_addr = ainfo->corder_bt2_addr;
/* Modify attribute through 'name' tracking v2 B-tree */
- if(H5B2_modify(bt2_name, &udata, H5A__dense_write_bt2_cb, &op_data) < 0)
+ if (H5B2_modify(bt2_name, &udata, H5A__dense_write_bt2_cb, &op_data) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to modify record in v2 B-tree")
done:
/* Release resources */
- if(shared_fheap && H5HF_close(shared_fheap) < 0)
+ if (shared_fheap && H5HF_close(shared_fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- if(fheap && H5HF_close(fheap) < 0)
+ if (fheap && H5HF_close(fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- if(bt2_name && H5B2_close(bt2_name) < 0)
+ if (bt2_name && H5B2_close(bt2_name) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_write() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_copy_fh_cb
*
@@ -831,8 +816,8 @@ done:
static herr_t
H5A__dense_copy_fh_cb(const void *obj, size_t obj_len, void *_udata)
{
- H5A_fh_ud_cp_t *udata = (H5A_fh_ud_cp_t *)_udata; /* User data for fractal heap 'op' callback */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5A_fh_ud_cp_t *udata = (H5A_fh_ud_cp_t *)_udata; /* User data for fractal heap 'op' callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -843,21 +828,21 @@ H5A__dense_copy_fh_cb(const void *obj, size_t obj_len, void *_udata)
* HDF5 routine, it could attempt to re-protect that direct block for the
* heap, causing the HDF5 routine called to fail)
*/
- if(NULL == (udata->attr = (H5A_t *)H5O_msg_decode(udata->f, NULL, H5O_ATTR_ID, obj_len, (const unsigned char *)obj)))
+ if (NULL == (udata->attr = (H5A_t *)H5O_msg_decode(udata->f, NULL, H5O_ATTR_ID, obj_len,
+ (const unsigned char *)obj)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, FAIL, "can't decode attribute")
/* Set the creation order index for the attribute */
udata->attr->shared->crt_idx = udata->record->corder;
/* Check whether we should "reconstitute" the shared message info */
- if(udata->record->flags & H5O_MSG_FLAG_SHARED)
+ if (udata->record->flags & H5O_MSG_FLAG_SHARED)
H5SM_reconstitute(&(udata->attr->sh_loc), udata->f, H5O_ATTR_ID, udata->record->id);
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_copy_fh_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_rename
*
@@ -871,19 +856,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name,
- const char *new_name)
+H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, const char *new_name)
{
- H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */
- H5HF_t *fheap = NULL; /* Fractal heap handle */
- H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
- H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
- H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order ndex */
- H5A_t *attr_copy = NULL; /* Copy of attribute to rename */
- htri_t attr_sharable; /* Flag indicating attributes are sharable */
- htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */
- htri_t attr_exists; /* Attribute exists in v2 B-tree */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */
+ H5HF_t * fheap = NULL; /* Fractal heap handle */
+ H5HF_t * shared_fheap = NULL; /* Fractal heap handle for shared header messages */
+ H5B2_t * bt2_name = NULL; /* v2 B-tree handle for name index */
+ H5B2_t * bt2_corder = NULL; /* v2 B-tree handle for creation order ndex */
+ H5A_t * attr_copy = NULL; /* Copy of attribute to rename */
+ htri_t attr_sharable; /* Flag indicating attributes are sharable */
+ htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */
+ htri_t attr_exists; /* Attribute exists in v2 B-tree */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -894,55 +878,55 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name,
HDassert(new_name);
/* Check if attributes are shared in this file */
- if((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0)
+ if ((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared")
/* Get handle for shared message heap, if attributes are sharable */
- if(attr_sharable) {
- haddr_t shared_fheap_addr; /* Address of fractal heap to use */
+ if (attr_sharable) {
+ haddr_t shared_fheap_addr; /* Address of fractal heap to use */
/* Retrieve the address of the shared message's fractal heap */
- if(H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0)
+ if (H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address")
/* Check if there are any shared messages currently */
- if(H5F_addr_defined(shared_fheap_addr)) {
+ if (H5F_addr_defined(shared_fheap_addr)) {
/* Open the fractal heap for shared header messages */
- if(NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr)))
+ if (NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
} /* end if */
- } /* end if */
+ } /* end if */
/* Open the fractal heap */
- if(NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
+ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Open the name index v2 B-tree */
- if(NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL)))
+ if (NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Create the "udata" information for v2 B-tree record modify */
- udata.f = f;
- udata.fheap = fheap;
- udata.shared_fheap = shared_fheap;
- udata.name = old_name;
- udata.name_hash = H5_checksum_lookup3(old_name, HDstrlen(old_name), 0);
- udata.flags = 0;
- udata.corder = 0;
- udata.found_op = H5A__dense_fnd_cb; /* v2 B-tree comparison callback */
+ udata.f = f;
+ udata.fheap = fheap;
+ udata.shared_fheap = shared_fheap;
+ udata.name = old_name;
+ udata.name_hash = H5_checksum_lookup3(old_name, HDstrlen(old_name), 0);
+ udata.flags = 0;
+ udata.corder = 0;
+ udata.found_op = H5A__dense_fnd_cb; /* v2 B-tree comparison callback */
udata.found_op_data = &attr_copy;
/* Get copy of attribute through 'name' tracking v2 B-tree */
- if((attr_exists = H5B2_find(bt2_name, &udata, NULL, NULL)) < 0)
+ if ((attr_exists = H5B2_find(bt2_name, &udata, NULL, NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't search for attribute in name index")
- else if(attr_exists == FALSE)
+ else if (attr_exists == FALSE)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't locate attribute in name index")
HDassert(attr_copy);
/* Check if message is already shared */
- if((shared_mesg = H5O_msg_is_shared(H5O_ATTR_ID, attr_copy)) < 0)
+ if ((shared_mesg = H5O_msg_is_shared(H5O_ATTR_ID, attr_copy)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "error determining if message is shared")
- else if(shared_mesg > 0) {
+ else if (shared_mesg > 0) {
/* Reset shared status of copy */
/* (so it will get shared again if necessary) */
attr_copy->sh_loc.type = H5O_SHARE_TYPE_UNSHARED;
@@ -953,47 +937,48 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name,
attr_copy->shared->name = H5MM_xstrdup(new_name);
/* Recompute the version to encode the attribute with */
- if(H5A__set_version(f, attr_copy) < 0)
+ if (H5A__set_version(f, attr_copy) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "unable to update attribute version")
/* Need to remove the attribute from the creation order index v2 B-tree */
- if(ainfo->index_corder) {
- htri_t corder_attr_exists; /* Attribute exists in v2 B-tree */
+ if (ainfo->index_corder) {
+ htri_t corder_attr_exists; /* Attribute exists in v2 B-tree */
/* Open the creation order index v2 B-tree */
HDassert(H5F_addr_defined(ainfo->corder_bt2_addr));
- if(NULL == (bt2_corder = H5B2_open(f, ainfo->corder_bt2_addr, NULL)))
+ if (NULL == (bt2_corder = H5B2_open(f, ainfo->corder_bt2_addr, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation index")
/* Set up the creation order to search for */
udata.corder = attr_copy->shared->crt_idx;
- if((corder_attr_exists = H5B2_find(bt2_corder, &udata, NULL, NULL)) < 0)
+ if ((corder_attr_exists = H5B2_find(bt2_corder, &udata, NULL, NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't search for attribute in name index")
- if(corder_attr_exists) {
+ if (corder_attr_exists) {
H5A_bt2_ud_rm_t rm_udata;
/* Set up the creation order in user data for the v2 B-tree 'record remove' callback */
rm_udata.common.corder = attr_copy->shared->crt_idx;
/* Remove the record from the creation order index v2 B-tree */
- if(H5B2_remove(bt2_corder, &rm_udata, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from creation order index v2 B-tree")
+ if (H5B2_remove(bt2_corder, &rm_udata, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL,
+ "unable to remove attribute from creation order index v2 B-tree")
}
}
/* Insert renamed attribute back into dense storage */
/* (Possibly making it shared) */
- if(H5A__dense_insert(f, ainfo, attr_copy) < 0)
+ if (H5A__dense_insert(f, ainfo, attr_copy) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to add to dense storage")
/* Was this attribute shared? */
- if((shared_mesg = H5O_msg_is_shared(H5O_ATTR_ID, attr_copy)) > 0) {
- hsize_t attr_rc; /* Attribute's ref count in shared message storage */
+ if ((shared_mesg = H5O_msg_is_shared(H5O_ATTR_ID, attr_copy)) > 0) {
+ hsize_t attr_rc; /* Attribute's ref count in shared message storage */
/* Retrieve ref count for shared attribute */
- if(H5SM_get_refcount(f, H5O_ATTR_ID, &attr_copy->sh_loc, &attr_rc) < 0)
+ if (H5SM_get_refcount(f, H5O_ATTR_ID, &attr_copy->sh_loc, &attr_rc) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count")
/* If the newly shared attribute needs to share "ownership" of the shared
@@ -1003,42 +988,41 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name,
*
* *ick* -QAK, 2007/01/08
*/
- if(attr_rc == 1) {
+ if (attr_rc == 1) {
/* Increment reference count on attribute components */
- if(H5O__attr_link(f, NULL, attr_copy) < 0)
+ if (H5O__attr_link(f, NULL, attr_copy) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count")
} /* end if */
- } /* end if */
- else if(shared_mesg == 0) {
+ } /* end if */
+ else if (shared_mesg == 0) {
/* Increment reference count on attribute components */
/* (so that they aren't deleted when the attribute is removed shortly) */
- if(H5O__attr_link(f, NULL, attr_copy) < 0)
+ if (H5O__attr_link(f, NULL, attr_copy) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count")
} /* end if */
- else if(shared_mesg < 0)
+ else if (shared_mesg < 0)
HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared")
/* Delete old attribute from dense storage */
- if(H5A__dense_remove(f, ainfo, old_name) < 0)
+ if (H5A__dense_remove(f, ainfo, old_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage")
done:
/* Release resources */
- if(shared_fheap && H5HF_close(shared_fheap) < 0)
+ if (shared_fheap && H5HF_close(shared_fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- if(fheap && H5HF_close(fheap) < 0)
+ if (fheap && H5HF_close(fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- if(bt2_name && H5B2_close(bt2_name) < 0)
+ if (bt2_name && H5B2_close(bt2_name) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
- if(bt2_corder && H5B2_close(bt2_corder) < 0)
+ if (bt2_corder && H5B2_close(bt2_corder) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index")
- if(attr_copy)
+ if (attr_copy)
H5O_msg_free(H5O_ATTR_ID, attr_copy);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_rename() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_iterate_bt2_cb
*
@@ -1054,54 +1038,56 @@ done:
static int
H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata)
{
- const H5A_dense_bt2_name_rec_t *record = (const H5A_dense_bt2_name_rec_t *)_record; /* Record from B-tree */
- H5A_bt2_ud_it_t *bt2_udata = (H5A_bt2_ud_it_t *)_bt2_udata; /* User data for callback */
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ const H5A_dense_bt2_name_rec_t *record =
+ (const H5A_dense_bt2_name_rec_t *)_record; /* Record from B-tree */
+ H5A_bt2_ud_it_t *bt2_udata = (H5A_bt2_ud_it_t *)_bt2_udata; /* User data for callback */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
/* Check for skipping attributes */
- if(bt2_udata->skip > 0)
+ if (bt2_udata->skip > 0)
--bt2_udata->skip;
else {
- H5A_fh_ud_cp_t fh_udata; /* User data for fractal heap 'op' callback */
- H5HF_t *fheap; /* Fractal heap handle for attribute storage */
+ H5A_fh_ud_cp_t fh_udata; /* User data for fractal heap 'op' callback */
+ H5HF_t * fheap; /* Fractal heap handle for attribute storage */
/* Check for iterating over shared attribute */
- if(record->flags & H5O_MSG_FLAG_SHARED)
+ if (record->flags & H5O_MSG_FLAG_SHARED)
fheap = bt2_udata->shared_fheap;
else
fheap = bt2_udata->fheap;
/* Prepare user data for callback */
/* down */
- fh_udata.f = bt2_udata->f;
+ fh_udata.f = bt2_udata->f;
fh_udata.record = record;
- fh_udata.attr = NULL;
+ fh_udata.attr = NULL;
/* Call fractal heap 'op' routine, to copy the attribute information */
- if(H5HF_op(fheap, &record->id, H5A__dense_copy_fh_cb, &fh_udata) < 0)
+ if (H5HF_op(fheap, &record->id, H5A__dense_copy_fh_cb, &fh_udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPERATE, H5_ITER_ERROR, "heap op callback failed")
/* Check which type of callback to make */
- switch(bt2_udata->attr_op->op_type) {
- case H5A_ATTR_OP_APP2:
- {
- H5A_info_t ainfo; /* Info for attribute */
+ switch (bt2_udata->attr_op->op_type) {
+ case H5A_ATTR_OP_APP2: {
+ H5A_info_t ainfo; /* Info for attribute */
/* Get the attribute information */
- if(H5A__get_info(fh_udata.attr, &ainfo) < 0)
+ if (H5A__get_info(fh_udata.attr, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5_ITER_ERROR, "unable to get attribute info")
/* Make the application callback */
- ret_value = (bt2_udata->attr_op->u.app_op2)(bt2_udata->loc_id, fh_udata.attr->shared->name, &ainfo, bt2_udata->op_data);
+ ret_value = (bt2_udata->attr_op->u.app_op2)(bt2_udata->loc_id, fh_udata.attr->shared->name,
+ &ainfo, bt2_udata->op_data);
break;
}
#ifndef H5_NO_DEPRECATED_SYMBOLS
case H5A_ATTR_OP_APP:
/* Make the application callback */
- ret_value = (bt2_udata->attr_op->u.app_op)(bt2_udata->loc_id, fh_udata.attr->shared->name, bt2_udata->op_data);
+ ret_value = (bt2_udata->attr_op->u.app_op)(bt2_udata->loc_id, fh_udata.attr->shared->name,
+ bt2_udata->op_data);
break;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -1114,7 +1100,7 @@ H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata)
HDassert("unknown attribute op type" && 0);
#ifdef NDEBUG
HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unsupported attribute op type")
-#endif /* NDEBUG */
+#endif /* NDEBUG */
} /* end switch */
/* Release the space allocated for the attribute */
@@ -1126,14 +1112,13 @@ H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata)
bt2_udata->count++;
/* Check for callback failure and pass along return value */
- if(ret_value < 0)
+ if (ret_value < 0)
HERROR(H5E_ATTR, H5E_CANTNEXT, "iteration operator failed");
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_iterate_bt2_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_iterate
*
@@ -1147,16 +1132,16 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_attr,
- const H5A_attr_iter_op_t *attr_op, void *op_data)
+H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op,
+ void *op_data)
{
- H5HF_t *fheap = NULL; /* Fractal heap handle */
- H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
- H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */
- H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
- haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */
- herr_t ret_value = FAIL; /* Return value */
+ H5HF_t * fheap = NULL; /* Fractal heap handle */
+ H5HF_t * shared_fheap = NULL; /* Fractal heap handle for shared header messages */
+ H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */
+ H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */
+ haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */
+ herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1168,12 +1153,12 @@ H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo,
HDassert(attr_op);
/* Determine the address of the index to use */
- if(idx_type == H5_INDEX_NAME) {
+ if (idx_type == H5_INDEX_NAME) {
/* Check if "native" order is OK - since names are hashed, getting them
* in strictly increasing or decreasing order requires building a
* table and sorting it.
*/
- if(order == H5_ITER_NATIVE) {
+ if (order == H5_ITER_NATIVE) {
HDassert(H5F_addr_defined(ainfo->name_bt2_addr));
bt2_addr = ainfo->name_bt2_addr;
} /* end if */
@@ -1191,83 +1176,82 @@ H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo,
} /* end else */
/* Check on iteration order */
- if(order == H5_ITER_NATIVE && H5F_addr_defined(bt2_addr)) {
- H5A_bt2_ud_it_t udata; /* User data for iterator callback */
- htri_t attr_sharable; /* Flag indicating attributes are sharable */
+ if (order == H5_ITER_NATIVE && H5F_addr_defined(bt2_addr)) {
+ H5A_bt2_ud_it_t udata; /* User data for iterator callback */
+ htri_t attr_sharable; /* Flag indicating attributes are sharable */
/* Open the fractal heap */
- if(NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
+ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Check if attributes are shared in this file */
- if((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0)
+ if ((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared")
/* Get handle for shared message heap, if attributes are sharable */
- if(attr_sharable) {
- haddr_t shared_fheap_addr; /* Address of fractal heap to use */
+ if (attr_sharable) {
+ haddr_t shared_fheap_addr; /* Address of fractal heap to use */
/* Retrieve the address of the shared message's fractal heap */
- if(H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0)
+ if (H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address")
/* Check if there are any shared messages currently */
- if(H5F_addr_defined(shared_fheap_addr)) {
+ if (H5F_addr_defined(shared_fheap_addr)) {
/* Open the fractal heap for shared header messages */
- if(NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr)))
+ if (NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
} /* end if */
- } /* end if */
+ } /* end if */
/* Open the index v2 B-tree */
- if(NULL == (bt2 = H5B2_open(f, bt2_addr, NULL)))
+ if (NULL == (bt2 = H5B2_open(f, bt2_addr, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index")
/* Construct the user data for v2 B-tree iterator callback */
- udata.f = f;
- udata.fheap = fheap;
+ udata.f = f;
+ udata.fheap = fheap;
udata.shared_fheap = shared_fheap;
- udata.loc_id = loc_id;
- udata.skip = skip;
- udata.count = 0;
- udata.attr_op = attr_op;
- udata.op_data = op_data;
+ udata.loc_id = loc_id;
+ udata.skip = skip;
+ udata.count = 0;
+ udata.attr_op = attr_op;
+ udata.op_data = op_data;
/* Iterate over the records in the v2 B-tree's "native" order */
/* (by hash of name) */
- if((ret_value = H5B2_iterate(bt2, H5A__dense_iterate_bt2_cb, &udata)) < 0)
+ if ((ret_value = H5B2_iterate(bt2, H5A__dense_iterate_bt2_cb, &udata)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed");
/* Update the last attribute examined, if requested */
- if(last_attr)
+ if (last_attr)
*last_attr = udata.count;
} /* end if */
else {
/* Build the table of attributes for this object */
/* (build table using the name index, but sort according to idx_type) */
- if(H5A__dense_build_table(f, ainfo, idx_type, order, &atable) < 0)
+ if (H5A__dense_build_table(f, ainfo, idx_type, order, &atable) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "error building table of attributes")
/* Iterate over attributes in table */
- if((ret_value = H5A__attr_iterate_table(&atable, skip, last_attr, loc_id, attr_op, op_data)) < 0)
+ if ((ret_value = H5A__attr_iterate_table(&atable, skip, last_attr, loc_id, attr_op, op_data)) < 0)
HERROR(H5E_ATTR, H5E_CANTNEXT, "iteration operator failed");
} /* end else */
done:
/* Release resources */
- if(shared_fheap && H5HF_close(shared_fheap) < 0)
+ if (shared_fheap && H5HF_close(shared_fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- if(fheap && H5HF_close(fheap) < 0)
+ if (fheap && H5HF_close(fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- if(bt2 && H5B2_close(bt2) < 0)
+ if (bt2 && H5B2_close(bt2) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index")
- if(atable.attrs && H5A__attr_release_table(&atable) < 0)
+ if (atable.attrs && H5A__attr_release_table(&atable) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_iterate() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_remove_bt2_cb
*
@@ -1284,53 +1268,53 @@ static herr_t
H5A__dense_remove_bt2_cb(const void *_record, void *_udata)
{
const H5A_dense_bt2_name_rec_t *record = (const H5A_dense_bt2_name_rec_t *)_record;
- H5A_bt2_ud_rm_t *udata = (H5A_bt2_ud_rm_t *)_udata; /* User data for callback */
- H5A_t *attr = *(H5A_t **)udata->common.found_op_data; /* Pointer to attribute to remove */
- H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5A_bt2_ud_rm_t * udata = (H5A_bt2_ud_rm_t *)_udata; /* User data for callback */
+ H5A_t * attr = *(H5A_t **)udata->common.found_op_data; /* Pointer to attribute to remove */
+ H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Check for removing the link from the creation order index */
- if(H5F_addr_defined(udata->corder_bt2_addr)) {
+ if (H5F_addr_defined(udata->corder_bt2_addr)) {
/* Open the creation order index v2 B-tree */
- if(NULL == (bt2_corder = H5B2_open(udata->common.f, udata->corder_bt2_addr, NULL)))
+ if (NULL == (bt2_corder = H5B2_open(udata->common.f, udata->corder_bt2_addr, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
/* Set up the user data for the v2 B-tree 'record remove' callback */
udata->common.corder = attr->shared->crt_idx;
/* Remove the record from the creation order index v2 B-tree */
- if(H5B2_remove(bt2_corder, udata, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from creation order index v2 B-tree")
+ if (H5B2_remove(bt2_corder, udata, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL,
+ "unable to remove attribute from creation order index v2 B-tree")
} /* end if */
/* Check for removing shared attribute */
- if(record->flags & H5O_MSG_FLAG_SHARED) {
+ if (record->flags & H5O_MSG_FLAG_SHARED) {
/* Decrement the reference count on the shared attribute message */
- if(H5SM_delete(udata->common.f, NULL, &(attr->sh_loc)) < 0)
+ if (H5SM_delete(udata->common.f, NULL, &(attr->sh_loc)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to delete shared attribute")
} /* end if */
else {
/* Perform the deletion action on the attribute */
/* (takes care of shared & committed datatype/dataspace components) */
- if(H5O__attr_delete(udata->common.f, NULL, attr) < 0)
+ if (H5O__attr_delete(udata->common.f, NULL, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
/* Remove record from fractal heap */
- if(H5HF_remove(udata->common.fheap, &record->id) < 0)
+ if (H5HF_remove(udata->common.fheap, &record->id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from fractal heap")
} /* end else */
done:
/* Release resources */
- if(bt2_corder && H5B2_close(bt2_corder) < 0)
+ if (bt2_corder && H5B2_close(bt2_corder) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_remove_bt2_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_remove
*
@@ -1346,13 +1330,13 @@ done:
herr_t
H5A__dense_remove(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
{
- H5A_bt2_ud_rm_t udata; /* User data for v2 B-tree record removal */
- H5HF_t *fheap = NULL; /* Fractal heap handle */
- H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
- H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
- H5A_t *attr_copy = NULL; /* Copy of attribute to remove */
- htri_t attr_sharable; /* Flag indicating attributes are sharable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5A_bt2_ud_rm_t udata; /* User data for v2 B-tree record removal */
+ H5HF_t * fheap = NULL; /* Fractal heap handle */
+ H5HF_t * shared_fheap = NULL; /* Fractal heap handle for shared header messages */
+ H5B2_t * bt2_name = NULL; /* v2 B-tree handle for name index */
+ H5A_t * attr_copy = NULL; /* Copy of attribute to remove */
+ htri_t attr_sharable; /* Flag indicating attributes are sharable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1362,62 +1346,61 @@ H5A__dense_remove(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
HDassert(name && *name);
/* Open the fractal heap */
- if(NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
+ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Check if attributes are shared in this file */
- if((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0)
+ if ((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared")
/* Get handle for shared message heap, if attributes are sharable */
- if(attr_sharable) {
- haddr_t shared_fheap_addr; /* Address of fractal heap to use */
+ if (attr_sharable) {
+ haddr_t shared_fheap_addr; /* Address of fractal heap to use */
/* Retrieve the address of the shared message's fractal heap */
- if(H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0)
+ if (H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address")
/* Check if there are any shared messages currently */
- if(H5F_addr_defined(shared_fheap_addr)) {
+ if (H5F_addr_defined(shared_fheap_addr)) {
/* Open the fractal heap for shared header messages */
- if(NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr)))
+ if (NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
} /* end if */
- } /* end if */
+ } /* end if */
/* Open the name index v2 B-tree */
- if(NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL)))
+ if (NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Set up the user data for the v2 B-tree 'record remove' callback */
- udata.common.f = f;
- udata.common.fheap = fheap;
- udata.common.shared_fheap = shared_fheap;
- udata.common.name = name;
- udata.common.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0);
- udata.common.found_op = H5A__dense_fnd_cb; /* v2 B-tree comparison callback */
+ udata.common.f = f;
+ udata.common.fheap = fheap;
+ udata.common.shared_fheap = shared_fheap;
+ udata.common.name = name;
+ udata.common.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0);
+ udata.common.found_op = H5A__dense_fnd_cb; /* v2 B-tree comparison callback */
udata.common.found_op_data = &attr_copy;
- udata.corder_bt2_addr = ainfo->corder_bt2_addr;
+ udata.corder_bt2_addr = ainfo->corder_bt2_addr;
/* Remove the record from the name index v2 B-tree */
- if(H5B2_remove(bt2_name, &udata, H5A__dense_remove_bt2_cb, &udata) < 0)
+ if (H5B2_remove(bt2_name, &udata, H5A__dense_remove_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from name index v2 B-tree")
done:
/* Release resources */
- if(shared_fheap && H5HF_close(shared_fheap) < 0)
+ if (shared_fheap && H5HF_close(shared_fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- if(fheap && H5HF_close(fheap) < 0)
+ if (fheap && H5HF_close(fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- if(bt2_name && H5B2_close(bt2_name) < 0)
+ if (bt2_name && H5B2_close(bt2_name) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
- if(attr_copy)
+ if (attr_copy)
H5O_msg_free_real(H5O_MSG_ATTR, attr_copy);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_remove() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_remove_by_idx_bt2_cb
*
@@ -1433,32 +1416,32 @@ done:
static herr_t
H5A__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
{
- H5HF_t *fheap; /* Fractal heap handle */
- H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
+ H5HF_t * fheap; /* Fractal heap handle */
+ H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */
const H5A_dense_bt2_name_rec_t *record = (const H5A_dense_bt2_name_rec_t *)_record; /* v2 B-tree record */
- H5A_bt2_ud_rmbi_t *bt2_udata = (H5A_bt2_ud_rmbi_t *)_bt2_udata; /* User data for callback */
- H5A_fh_ud_cp_t fh_udata; /* User data for fractal heap 'op' callback */
- H5O_shared_t sh_loc; /* Shared message info for attribute */
- hbool_t use_sh_loc; /* Whether to use the attribute's shared location or the separate one */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5A_bt2_ud_rmbi_t * bt2_udata = (H5A_bt2_ud_rmbi_t *)_bt2_udata; /* User data for callback */
+ H5A_fh_ud_cp_t fh_udata; /* User data for fractal heap 'op' callback */
+ H5O_shared_t sh_loc; /* Shared message info for attribute */
+ hbool_t use_sh_loc; /* Whether to use the attribute's shared location or the separate one */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Set up the user data for fractal heap 'op' callback */
- fh_udata.f = bt2_udata->f;
+ fh_udata.f = bt2_udata->f;
fh_udata.record = record;
- fh_udata.attr = NULL;
+ fh_udata.attr = NULL;
/* Get correct fractal heap handle to use for operations */
- if(record->flags & H5O_MSG_FLAG_SHARED)
+ if (record->flags & H5O_MSG_FLAG_SHARED)
fheap = bt2_udata->shared_fheap;
else
fheap = bt2_udata->fheap;
/* Check whether to make a copy of the attribute or just need the shared location info */
- if(H5F_addr_defined(bt2_udata->other_bt2_addr) || !(record->flags & H5O_MSG_FLAG_SHARED)) {
+ if (H5F_addr_defined(bt2_udata->other_bt2_addr) || !(record->flags & H5O_MSG_FLAG_SHARED)) {
/* Call fractal heap 'op' routine, to make copy of attribute to remove */
- if(H5HF_op(fheap, &record->id, H5A__dense_copy_fh_cb, &fh_udata) < 0)
+ if (H5HF_op(fheap, &record->id, H5A__dense_copy_fh_cb, &fh_udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPERATE, FAIL, "attribute removal callback failed")
HDassert(fh_udata.attr);
@@ -1474,11 +1457,11 @@ H5A__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
} /* end else */
/* Check for removing the link from the "other" index (creation order, when name used and vice versa) */
- if(H5F_addr_defined(bt2_udata->other_bt2_addr)) {
- H5A_bt2_ud_common_t other_bt2_udata; /* Info for B-tree callbacks */
+ if (H5F_addr_defined(bt2_udata->other_bt2_addr)) {
+ H5A_bt2_ud_common_t other_bt2_udata; /* Info for B-tree callbacks */
/* Determine the index being used */
- if(bt2_udata->idx_type == H5_INDEX_NAME) {
+ if (bt2_udata->idx_type == H5_INDEX_NAME) {
/* Set up the user data for the v2 B-tree 'record remove' callback */
other_bt2_udata.corder = fh_udata.attr->shared->crt_idx;
} /* end if */
@@ -1486,62 +1469,63 @@ H5A__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
HDassert(bt2_udata->idx_type == H5_INDEX_CRT_ORDER);
/* Set up the user data for the v2 B-tree 'record remove' callback */
- other_bt2_udata.f = bt2_udata->f;
- other_bt2_udata.fheap = bt2_udata->fheap;
+ other_bt2_udata.f = bt2_udata->f;
+ other_bt2_udata.fheap = bt2_udata->fheap;
other_bt2_udata.shared_fheap = bt2_udata->shared_fheap;
- other_bt2_udata.name = fh_udata.attr->shared->name;
- other_bt2_udata.name_hash = H5_checksum_lookup3(fh_udata.attr->shared->name, HDstrlen(fh_udata.attr->shared->name), 0);
- other_bt2_udata.found_op = NULL;
+ other_bt2_udata.name = fh_udata.attr->shared->name;
+ other_bt2_udata.name_hash =
+ H5_checksum_lookup3(fh_udata.attr->shared->name, HDstrlen(fh_udata.attr->shared->name), 0);
+ other_bt2_udata.found_op = NULL;
other_bt2_udata.found_op_data = NULL;
} /* end else */
/* Open the index v2 B-tree */
- if(NULL == (bt2 = H5B2_open(bt2_udata->f, bt2_udata->other_bt2_addr, NULL)))
+ if (NULL == (bt2 = H5B2_open(bt2_udata->f, bt2_udata->other_bt2_addr, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index")
/* Set the common information for the v2 B-tree remove operation */
/* Remove the record from the "other" index v2 B-tree */
- if(H5B2_remove(bt2, &other_bt2_udata, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove record from 'other' index v2 B-tree")
+ if (H5B2_remove(bt2, &other_bt2_udata, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL,
+ "unable to remove record from 'other' index v2 B-tree")
} /* end if */
/* Check for removing shared attribute */
- if(record->flags & H5O_MSG_FLAG_SHARED) {
- H5O_shared_t *sh_loc_ptr; /* Pointer to shared message info for attribute */
+ if (record->flags & H5O_MSG_FLAG_SHARED) {
+ H5O_shared_t *sh_loc_ptr; /* Pointer to shared message info for attribute */
/* Set up pointer to correct shared location */
- if(use_sh_loc)
+ if (use_sh_loc)
sh_loc_ptr = &sh_loc;
else
sh_loc_ptr = &(fh_udata.attr->sh_loc);
/* Decrement the reference count on the shared attribute message */
- if(H5SM_delete(bt2_udata->f, NULL, sh_loc_ptr) < 0)
+ if (H5SM_delete(bt2_udata->f, NULL, sh_loc_ptr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to delete shared attribute")
} /* end if */
else {
/* Perform the deletion action on the attribute */
/* (takes care of shared & committed datatype/dataspace components) */
- if(H5O__attr_delete(bt2_udata->f, NULL, fh_udata.attr) < 0)
+ if (H5O__attr_delete(bt2_udata->f, NULL, fh_udata.attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
/* Remove record from fractal heap */
- if(H5HF_remove(fheap, &record->id) < 0)
+ if (H5HF_remove(fheap, &record->id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from fractal heap")
} /* end else */
done:
/* Release resources */
- if(bt2 && H5B2_close(bt2) < 0)
+ if (bt2 && H5B2_close(bt2) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index")
- if(fh_udata.attr)
+ if (fh_udata.attr)
H5O_msg_free(H5O_ATTR_ID, fh_udata.attr);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_remove_by_idx_bt2_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_remove_by_idx
*
@@ -1556,15 +1540,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n)
+H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n)
{
- H5HF_t *fheap = NULL; /* Fractal heap handle */
- H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
- H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */
- H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */
- haddr_t bt2_addr; /* Address of v2 B-tree to use for operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5HF_t * fheap = NULL; /* Fractal heap handle */
+ H5HF_t * shared_fheap = NULL; /* Fractal heap handle for shared header messages */
+ H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */
+ H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */
+ haddr_t bt2_addr; /* Address of v2 B-tree to use for operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1573,12 +1557,12 @@ H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type
HDassert(ainfo);
/* Determine the address of the index to use */
- if(idx_type == H5_INDEX_NAME) {
+ if (idx_type == H5_INDEX_NAME) {
/* Check if "native" order is OK - since names are hashed, getting them
* in strictly increasing or decreasing order requires building a
* table and sorting it.
*/
- if(order == H5_ITER_NATIVE) {
+ if (order == H5_ITER_NATIVE) {
bt2_addr = ainfo->name_bt2_addr;
HDassert(H5F_addr_defined(bt2_addr));
} /* end if */
@@ -1596,79 +1580,78 @@ H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type
} /* end else */
/* If there is an index defined for the field, use it */
- if(H5F_addr_defined(bt2_addr)) {
- H5A_bt2_ud_rmbi_t udata; /* User data for v2 B-tree record removal */
- htri_t attr_sharable; /* Flag indicating attributes are sharable */
+ if (H5F_addr_defined(bt2_addr)) {
+ H5A_bt2_ud_rmbi_t udata; /* User data for v2 B-tree record removal */
+ htri_t attr_sharable; /* Flag indicating attributes are sharable */
/* Open the fractal heap */
- if(NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
+ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Check if attributes are shared in this file */
- if((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0)
+ if ((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared")
/* Get handle for shared message heap, if attributes are sharable */
- if(attr_sharable) {
- haddr_t shared_fheap_addr; /* Address of fractal heap to use */
+ if (attr_sharable) {
+ haddr_t shared_fheap_addr; /* Address of fractal heap to use */
/* Retrieve the address of the shared message's fractal heap */
- if(H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0)
+ if (H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address")
/* Check if there are any shared messages currently */
- if(H5F_addr_defined(shared_fheap_addr)) {
+ if (H5F_addr_defined(shared_fheap_addr)) {
/* Open the fractal heap for shared header messages */
- if(NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr)))
+ if (NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
} /* end if */
- } /* end if */
+ } /* end if */
/* Open the index v2 B-tree */
- if(NULL == (bt2 = H5B2_open(f, bt2_addr, NULL)))
+ if (NULL == (bt2 = H5B2_open(f, bt2_addr, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index")
/* Set up the user data for the v2 B-tree 'record remove' callback */
- udata.f = f;
- udata.fheap = fheap;
- udata.shared_fheap = shared_fheap;
- udata.idx_type = idx_type;
+ udata.f = f;
+ udata.fheap = fheap;
+ udata.shared_fheap = shared_fheap;
+ udata.idx_type = idx_type;
udata.other_bt2_addr = idx_type == H5_INDEX_NAME ? ainfo->corder_bt2_addr : ainfo->name_bt2_addr;
/* Remove the record from the name index v2 B-tree */
- if(H5B2_remove_by_idx(bt2, order, n, H5A__dense_remove_by_idx_bt2_cb, &udata) < 0)
+ if (H5B2_remove_by_idx(bt2, order, n, H5A__dense_remove_by_idx_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from v2 B-tree index")
} /* end if */
else {
/* Build the table of attributes for this object */
/* (build table using the name index, but sort according to idx_type) */
- if(H5A__dense_build_table(f, ainfo, idx_type, order, &atable) < 0)
+ if (H5A__dense_build_table(f, ainfo, idx_type, order, &atable) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "error building table of attributes")
/* Check for skipping too many attributes */
- if(n >= atable.nattrs)
+ if (n >= atable.nattrs)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified")
/* Delete appropriate attribute from dense storage */
- if(H5A__dense_remove(f, ainfo, ((atable.attrs[n])->shared)->name) < 0)
+ if (H5A__dense_remove(f, ainfo, ((atable.attrs[n])->shared)->name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage")
} /* end else */
done:
/* Release resources */
- if(shared_fheap && H5HF_close(shared_fheap) < 0)
+ if (shared_fheap && H5HF_close(shared_fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- if(fheap && H5HF_close(fheap) < 0)
+ if (fheap && H5HF_close(fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- if(bt2 && H5B2_close(bt2) < 0)
+ if (bt2 && H5B2_close(bt2) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index")
- if(atable.attrs && H5A__attr_release_table(&atable) < 0)
+ if (atable.attrs && H5A__attr_release_table(&atable) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_remove_by_idx() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_exists
*
@@ -1685,12 +1668,12 @@ done:
htri_t
H5A__dense_exists(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
{
- H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */
- H5HF_t *fheap = NULL; /* Fractal heap handle */
- H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
- H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
- htri_t attr_sharable; /* Flag indicating attributes are sharable */
- htri_t ret_value = TRUE; /* Return value */
+ H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */
+ H5HF_t * fheap = NULL; /* Fractal heap handle */
+ H5HF_t * shared_fheap = NULL; /* Fractal heap handle for shared header messages */
+ H5B2_t * bt2_name = NULL; /* v2 B-tree handle for name index */
+ htri_t attr_sharable; /* Flag indicating attributes are sharable */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1700,61 +1683,60 @@ H5A__dense_exists(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
HDassert(name);
/* Open the fractal heap */
- if(NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
+ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Check if attributes are shared in this file */
- if((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0)
+ if ((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared")
/* Get handle for shared message heap, if attributes are sharable */
- if(attr_sharable) {
- haddr_t shared_fheap_addr; /* Address of fractal heap to use */
+ if (attr_sharable) {
+ haddr_t shared_fheap_addr; /* Address of fractal heap to use */
/* Retrieve the address of the shared message's fractal heap */
- if(H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0)
+ if (H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address")
/* Check if there are any shared messages currently */
- if(H5F_addr_defined(shared_fheap_addr)) {
+ if (H5F_addr_defined(shared_fheap_addr)) {
/* Open the fractal heap for shared header messages */
- if(NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr)))
+ if (NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
} /* end if */
- } /* end if */
+ } /* end if */
/* Open the name index v2 B-tree */
- if(NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL)))
+ if (NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Create the "udata" information for v2 B-tree record 'find' */
- udata.f = f;
- udata.fheap = fheap;
- udata.shared_fheap = shared_fheap;
- udata.name = name;
- udata.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0);
- udata.flags = 0;
- udata.corder = 0;
- udata.found_op = NULL; /* v2 B-tree comparison callback */
+ udata.f = f;
+ udata.fheap = fheap;
+ udata.shared_fheap = shared_fheap;
+ udata.name = name;
+ udata.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0);
+ udata.flags = 0;
+ udata.corder = 0;
+ udata.found_op = NULL; /* v2 B-tree comparison callback */
udata.found_op_data = NULL;
/* Find the attribute in the 'name' index */
- if((ret_value = H5B2_find(bt2_name, &udata, NULL, NULL)) < 0)
+ if ((ret_value = H5B2_find(bt2_name, &udata, NULL, NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't search for attribute in name index")
done:
/* Release resources */
- if(shared_fheap && H5HF_close(shared_fheap) < 0)
+ if (shared_fheap && H5HF_close(shared_fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- if(fheap && H5HF_close(fheap) < 0)
+ if (fheap && H5HF_close(fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
- if(bt2_name && H5B2_close(bt2_name) < 0)
+ if (bt2_name && H5B2_close(bt2_name) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_exists() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_delete_bt2_cb
*
@@ -1770,54 +1752,54 @@ done:
static herr_t
H5A__dense_delete_bt2_cb(const void *_record, void *_bt2_udata)
{
- const H5A_dense_bt2_name_rec_t *record = (const H5A_dense_bt2_name_rec_t *)_record; /* Record from B-tree */
- H5A_bt2_ud_common_t *bt2_udata = (H5A_bt2_ud_common_t *)_bt2_udata; /* User data for callback */
- H5A_t *attr = NULL; /* Attribute being removed */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5A_dense_bt2_name_rec_t *record =
+ (const H5A_dense_bt2_name_rec_t *)_record; /* Record from B-tree */
+ H5A_bt2_ud_common_t *bt2_udata = (H5A_bt2_ud_common_t *)_bt2_udata; /* User data for callback */
+ H5A_t * attr = NULL; /* Attribute being removed */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Check for shared attribute */
- if(record->flags & H5O_MSG_FLAG_SHARED) {
- H5O_shared_t sh_mesg; /* Temporary shared message info */
+ if (record->flags & H5O_MSG_FLAG_SHARED) {
+ H5O_shared_t sh_mesg; /* Temporary shared message info */
/* "reconstitute" the shared message info for the attribute */
H5SM_reconstitute(&sh_mesg, bt2_udata->f, H5O_ATTR_ID, record->id);
/* Decrement the reference count on the shared attribute message */
- if(H5SM_delete(bt2_udata->f, NULL, &sh_mesg) < 0)
+ if (H5SM_delete(bt2_udata->f, NULL, &sh_mesg) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to delete shared attribute")
} /* end if */
else {
- H5A_fh_ud_cp_t fh_udata; /* User data for fractal heap 'op' callback */
+ H5A_fh_ud_cp_t fh_udata; /* User data for fractal heap 'op' callback */
/* Prepare user data for callback */
/* down */
- fh_udata.f = bt2_udata->f;
+ fh_udata.f = bt2_udata->f;
fh_udata.record = record;
/* up */
fh_udata.attr = NULL;
/* Call fractal heap 'op' routine, to copy the attribute information */
- if(H5HF_op(bt2_udata->fheap, &record->id, H5A__dense_copy_fh_cb, &fh_udata) < 0)
+ if (H5HF_op(bt2_udata->fheap, &record->id, H5A__dense_copy_fh_cb, &fh_udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPERATE, FAIL, "heap op callback failed")
attr = fh_udata.attr;
/* Perform the deletion action on the attribute */
/* (takes care of shared/committed datatype & dataspace components) */
- if(H5O__attr_delete(bt2_udata->f, NULL, fh_udata.attr) < 0)
+ if (H5O__attr_delete(bt2_udata->f, NULL, fh_udata.attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
} /* end else */
done:
/* Release resources */
- if(attr)
+ if (attr)
H5O_msg_free_real(H5O_MSG_ATTR, attr);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_delete_bt2_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_delete
*
@@ -1833,9 +1815,9 @@ done:
herr_t
H5A__dense_delete(H5F_t *f, H5O_ainfo_t *ainfo)
{
- H5A_bt2_ud_common_t udata; /* v2 B-tree user data for deleting attributes */
- H5HF_t *fheap = NULL; /* Fractal heap handle */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5A_bt2_ud_common_t udata; /* v2 B-tree user data for deleting attributes */
+ H5HF_t * fheap = NULL; /* Fractal heap handle */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1844,47 +1826,46 @@ H5A__dense_delete(H5F_t *f, H5O_ainfo_t *ainfo)
HDassert(ainfo);
/* Open the fractal heap */
- if(NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
+ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
/* Create the "udata" information for v2 B-tree 'delete' */
- udata.f = f;
- udata.fheap = fheap;
- udata.shared_fheap = NULL;
- udata.name = NULL;
- udata.name_hash = 0;
- udata.flags = 0;
- udata.found_op = NULL; /* v2 B-tree comparison callback */
+ udata.f = f;
+ udata.fheap = fheap;
+ udata.shared_fheap = NULL;
+ udata.name = NULL;
+ udata.name_hash = 0;
+ udata.flags = 0;
+ udata.found_op = NULL; /* v2 B-tree comparison callback */
udata.found_op_data = NULL;
/* Delete name index v2 B-tree */
- if(H5B2_delete(f, ainfo->name_bt2_addr, NULL, H5A__dense_delete_bt2_cb, &udata) < 0)
+ if (H5B2_delete(f, ainfo->name_bt2_addr, NULL, H5A__dense_delete_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index")
ainfo->name_bt2_addr = HADDR_UNDEF;
/* Release resources */
- if(H5HF_close(fheap) < 0)
+ if (H5HF_close(fheap) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
fheap = NULL;
/* Check if we should delete the creation order index v2 B-tree */
- if(H5F_addr_defined(ainfo->corder_bt2_addr)) {
+ if (H5F_addr_defined(ainfo->corder_bt2_addr)) {
/* Delete the creation order index, without adjusting the ref. count on the attributes */
- if(H5B2_delete(f, ainfo->corder_bt2_addr, NULL, NULL, NULL) < 0)
+ if (H5B2_delete(f, ainfo->corder_bt2_addr, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for creation order index")
ainfo->corder_bt2_addr = HADDR_UNDEF;
} /* end if */
/* Delete fractal heap */
- if(H5HF_delete(f, ainfo->fheap_addr) < 0)
+ if (H5HF_delete(f, ainfo->fheap_addr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete fractal heap")
ainfo->fheap_addr = HADDR_UNDEF;
done:
/* Release resources */
- if(fheap && H5HF_close(fheap) < 0)
+ if (fheap && H5HF_close(fheap) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_delete() */
-
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index c4d8bb8..3589296 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -29,62 +29,53 @@
/* Module Setup */
/****************/
-#include "H5Amodule.h" /* This source code file is part of the H5A module */
-#define H5O_FRIEND /*suppress error about including H5Opkg */
-
+#include "H5Amodule.h" /* This source code file is part of the H5A module */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Apkg.h" /* Attributes */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Opkg.h" /* Object headers */
-#include "H5VLprivate.h" /* Virtual object layer */
+#include "H5private.h" /* Generic Functions */
+#include "H5Apkg.h" /* Attributes */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Opkg.h" /* Object headers */
+#include "H5VLprivate.h" /* Virtual object layer */
#include "H5VLnative_private.h" /* Native VOL connector */
-
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
-
+
/*--------------------------------------------------------------------------
NAME
H5Acreate1
@@ -113,58 +104,57 @@
--------------------------------------------------------------------------*/
hid_t
-H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
- hid_t acpl_id)
+H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id)
{
- void *attr = NULL; /* attr object from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void * attr = NULL; /* attr object from VOL connector */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, acpl_id);
/* Check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
- if(!name || !*name)
+ if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
/* Set up collective metadata if appropriate */
- if(H5CX_set_loc(loc_id) < 0)
+ if (H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read")
/* Get correct property list */
- if(H5P_DEFAULT == acpl_id)
+ if (H5P_DEFAULT == acpl_id)
acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT;
/* Set location parameters */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the attribute */
- if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, name, type_id, space_id, acpl_id,
- H5P_ATTRIBUTE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if (NULL ==
+ (attr = H5VL_attr_create(vol_obj, &loc_params, name, type_id, space_id, acpl_id,
+ H5P_ATTRIBUTE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
- if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID")
done:
/* Clean up on failure */
- if(H5I_INVALID_HID == ret_value)
- if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value)
+ if (attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* end H5Acreate1() */
-
/*--------------------------------------------------------------------------
NAME
H5Aopen_name
@@ -190,47 +180,46 @@ done:
hid_t
H5Aopen_name(hid_t loc_id, const char *name)
{
- void *attr = NULL; /* attr object from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ void * attr = NULL; /* attr object from VOL connector */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "i*s", loc_id, name);
/* Check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
- if(!name || !*name)
+ if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name")
/* Set location parameters */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
- if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, name, H5P_ATTRIBUTE_ACCESS_DEFAULT,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if (NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, name, H5P_ATTRIBUTE_ACCESS_DEFAULT,
+ H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute")
/* Register the attribute and get an ID for it */
- if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Clean up on failure */
- if(H5I_INVALID_HID == ret_value)
- if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value)
+ if (attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen_name() */
-
/*--------------------------------------------------------------------------
NAME
H5Aopen_idx
@@ -256,50 +245,49 @@ done:
hid_t
H5Aopen_idx(hid_t loc_id, unsigned idx)
{
- void *attr = NULL; /* attr object from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void * attr = NULL; /* attr object from VOL connector */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "iIu", loc_id, idx);
/* Check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute")
/* Set location parameters */
- loc_params.type = H5VL_OBJECT_BY_IDX;
- loc_params.loc_data.loc_by_idx.name = ".";
- loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_CRT_ORDER;
- loc_params.loc_data.loc_by_idx.order = H5_ITER_INC;
- loc_params.loc_data.loc_by_idx.n = (hsize_t)idx;
- loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
- loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.type = H5VL_OBJECT_BY_IDX;
+ loc_params.loc_data.loc_by_idx.name = ".";
+ loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_CRT_ORDER;
+ loc_params.loc_data.loc_by_idx.order = H5_ITER_INC;
+ loc_params.loc_data.loc_by_idx.n = (hsize_t)idx;
+ loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
- if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, H5P_ATTRIBUTE_ACCESS_DEFAULT,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if (NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, H5P_ATTRIBUTE_ACCESS_DEFAULT,
+ H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute")
/* Register the attribute and get an ID for it */
- if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
/* Clean up on failure */
- if(H5I_INVALID_HID == ret_value)
- if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value)
+ if (attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen_idx() */
-
/*--------------------------------------------------------------------------
NAME
H5Aget_num_attrs
@@ -321,10 +309,10 @@ done:
int
H5Aget_num_attrs(hid_t loc_id)
{
- H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5O_info2_t oinfo;
- int ret_value = -1;
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_loc_params_t loc_params;
+ H5O_info2_t oinfo;
+ int ret_value = -1;
FUNC_ENTER_API((-1))
H5TRACE1("Is", "i", loc_id);
@@ -333,11 +321,12 @@ H5Aget_num_attrs(hid_t loc_id)
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Get the number of attributes for the object */
- if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ &oinfo, H5O_INFO_NUM_ATTRS) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute count for object")
H5_CHECKED_ASSIGN(ret_value, int, oinfo.num_attrs, hsize_t);
@@ -346,7 +335,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Aget_num_attrs() */
-
/*--------------------------------------------------------------------------
NAME
H5Aiterate1
@@ -387,26 +375,26 @@ done:
herr_t
H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data)
{
- H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
- herr_t ret_value; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(H5_ITER_ERROR)
H5TRACE4("e", "i*Iux*x", loc_id, attr_num, op, op_data);
/* check arguments */
- if(H5I_ATTR == H5I_get_type(loc_id))
+ if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "location is not valid for an attribute")
/* Get the location object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier")
/* Call attribute iteration routine */
- if((ret_value = H5VL_attr_optional(vol_obj, H5VL_NATIVE_ATTR_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_id, attr_num, op, op_data)) < 0)
+ if ((ret_value = H5VL_attr_optional(vol_obj, H5VL_NATIVE_ATTR_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, loc_id, attr_num, op, op_data)) < 0)
HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes");
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aiterate1() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 5ecfd06..b7e7be6 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -26,79 +26,73 @@
/* Module Setup */
/****************/
-#include "H5Amodule.h" /* This source code file is part of the H5A module */
-#define H5O_FRIEND /*suppress error about including H5Opkg */
-
+#include "H5Amodule.h" /* This source code file is part of the H5A module */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Apkg.h" /* Attributes */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-#include "H5SMprivate.h" /* Shared Object Header Messages */
-#include "H5VLprivate.h" /* Virtual Object Layer */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Apkg.h" /* Attributes */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5SMprivate.h" /* Shared Object Header Messages */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
/* Data exchange structure to use when building table of compact attributes for an object */
typedef struct {
- H5F_t *f; /* Pointer to file that fractal heap is in */
- H5A_attr_table_t *atable; /* Pointer to attribute table to build */
- size_t curr_attr; /* Current attribute to operate on */
- hbool_t bogus_crt_idx; /* Whether bogus creation index values need to be set */
+ H5F_t * f; /* Pointer to file that fractal heap is in */
+ H5A_attr_table_t *atable; /* Pointer to attribute table to build */
+ size_t curr_attr; /* Current attribute to operate on */
+ hbool_t bogus_crt_idx; /* Whether bogus creation index values need to be set */
} H5A_compact_bt_ud_t;
/* Data exchange structure to use when building table of dense attributes for an object */
typedef struct {
- H5A_attr_table_t *atable; /* Pointer to attribute table to build */
- size_t curr_attr; /* Current attribute to operate on */
+ H5A_attr_table_t *atable; /* Pointer to attribute table to build */
+ size_t curr_attr; /* Current attribute to operate on */
} H5A_dense_bt_ud_t;
/* Data exchange structure to use when copying an attribute from _SRC to _DST */
typedef struct {
- const H5O_ainfo_t *ainfo; /* dense information */
- H5F_t *file; /* file */
- hbool_t *recompute_size; /* Flag to indicate if size changed */
- H5O_copy_t *cpy_info; /* Information on copying options */
- const H5O_loc_t *oloc_src;
- H5O_loc_t *oloc_dst;
+ const H5O_ainfo_t *ainfo; /* dense information */
+ H5F_t * file; /* file */
+ hbool_t * recompute_size; /* Flag to indicate if size changed */
+ H5O_copy_t * cpy_info; /* Information on copying options */
+ const H5O_loc_t * oloc_src;
+ H5O_loc_t * oloc_dst;
} H5A_dense_file_cp_ud_t;
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5A__compact_build_table_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
- unsigned sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/);
+static herr_t H5A__compact_build_table_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence,
+ unsigned *oh_flags_ptr, void *_udata /*in,out*/);
static herr_t H5A__dense_build_table_cb(const H5A_t *attr, void *_udata);
-static int H5A__attr_cmp_name_inc(const void *attr1, const void *attr2);
-static int H5A__attr_cmp_name_dec(const void *attr1, const void *attr2);
-static int H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2);
-static int H5A__attr_cmp_corder_dec(const void *attr1, const void *attr2);
-static herr_t H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type,
- H5_iter_order_t order);
-static herr_t H5A__iterate_common(hid_t loc_id, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t *idx, H5A_attr_iter_op_t *attr_op, void *op_data);
+static int H5A__attr_cmp_name_inc(const void *attr1, const void *attr2);
+static int H5A__attr_cmp_name_dec(const void *attr1, const void *attr2);
+static int H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2);
+static int H5A__attr_cmp_corder_dec(const void *attr1, const void *attr2);
+static herr_t H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type, H5_iter_order_t order);
+static herr_t H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx,
+ H5A_attr_iter_op_t *attr_op, void *op_data);
/*********************/
/* Package Variables */
@@ -106,26 +100,24 @@ static herr_t H5A__iterate_common(hid_t loc_id, H5_index_t idx_type,
/* Format version bounds for attribute */
const unsigned H5O_attr_ver_bounds[] = {
- H5O_ATTR_VERSION_1, /* H5F_LIBVER_EARLIEST */
- H5O_ATTR_VERSION_3, /* H5F_LIBVER_V18 */
- H5O_ATTR_VERSION_3, /* H5F_LIBVER_V110 */
- H5O_ATTR_VERSION_3, /* H5F_LIBVER_V112 */
- H5O_ATTR_VERSION_LATEST /* H5F_LIBVER_LATEST */
+ H5O_ATTR_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_ATTR_VERSION_3, /* H5F_LIBVER_V18 */
+ H5O_ATTR_VERSION_3, /* H5F_LIBVER_V110 */
+ H5O_ATTR_VERSION_3, /* H5F_LIBVER_V112 */
+ H5O_ATTR_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-typedef H5A_t* H5A_t_ptr;
+typedef H5A_t *H5A_t_ptr;
H5FL_SEQ_DEFINE(H5A_t_ptr);
-
/*-------------------------------------------------------------------------
* Function: H5A__create
*
@@ -139,14 +131,13 @@ H5FL_SEQ_DEFINE(H5A_t_ptr);
*-------------------------------------------------------------------------
*/
H5A_t *
-H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type,
- const H5S_t *space, hid_t acpl_id)
+H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, const H5S_t *space, hid_t acpl_id)
{
- H5A_t *attr = NULL; /* Attribute created */
- hssize_t snelmts; /* elements in attribute */
- size_t nelmts; /* elements in attribute */
- htri_t exists; /* Whether attribute exists */
- H5A_t *ret_value = NULL; /* Return value */
+ H5A_t * attr = NULL; /* Attribute created */
+ hssize_t snelmts; /* elements in attribute */
+ size_t nelmts; /* elements in attribute */
+ htri_t exists; /* Whether attribute exists */
+ H5A_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE_TAG(loc->oloc->addr)
@@ -161,38 +152,38 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type,
* name, but it's going to be hard to unwind all the special cases on
* failure, so just check first, for now - QAK)
*/
- if((exists = H5O__attr_exists(loc->oloc, attr_name)) < 0)
+ if ((exists = H5O__attr_exists(loc->oloc, attr_name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "error checking attributes")
- else if(exists > 0)
+ else if (exists > 0)
HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, NULL, "attribute already exists")
/* Check if the dataspace has an extent set (or is NULL) */
- if(!(H5S_has_extent(space)))
+ if (!(H5S_has_extent(space)))
HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, NULL, "dataspace extent has not been set")
/* Check if the datatype is "sensible" for use in a dataset */
- if(H5T_is_sensible(type) != TRUE)
+ if (H5T_is_sensible(type) != TRUE)
HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, NULL, "datatype is not sensible")
/* Build the attribute information */
- if(NULL == (attr = H5FL_CALLOC(H5A_t)))
+ if (NULL == (attr = H5FL_CALLOC(H5A_t)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "memory allocation failed for attribute info")
- if(NULL == (attr->shared = H5FL_CALLOC(H5A_shared_t)))
+ if (NULL == (attr->shared = H5FL_CALLOC(H5A_shared_t)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "can't allocate shared attr structure")
/* If the creation property list is H5P_ATTRIBUTE_CREATE_DEFAULT, use the default character encoding */
HDassert(acpl_id != H5P_DEFAULT);
- if(acpl_id == H5P_ATTRIBUTE_CREATE_DEFAULT)
+ if (acpl_id == H5P_ATTRIBUTE_CREATE_DEFAULT)
attr->shared->encoding = H5F_DEFAULT_CSET;
else {
- H5P_genplist_t *ac_plist; /* ACPL Property list */
+ H5P_genplist_t *ac_plist; /* ACPL Property list */
/* Get a local copy of the attribute creation property list */
- if(NULL == (ac_plist = (H5P_genplist_t *)H5I_object(acpl_id)))
+ if (NULL == (ac_plist = (H5P_genplist_t *)H5I_object(acpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
- if(H5P_get(ac_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &(attr->shared->encoding)) < 0)
+ if (H5P_get(ac_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &(attr->shared->encoding)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get character encoding flag")
} /* end else */
@@ -200,52 +191,52 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type,
attr->shared->name = H5MM_xstrdup(attr_name);
/* Copy datatype */
- if(NULL == (attr->shared->dt = H5T_copy(type, H5T_COPY_ALL)))
+ if (NULL == (attr->shared->dt = H5T_copy(type, H5T_COPY_ALL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't get shared datatype info")
/* Convert a datatype (if committed) to a transient type if the committed datatype's file
location is different from the file location where the attribute will be created */
- if(H5T_convert_committed_datatype(attr->shared->dt, loc->oloc->file) < 0)
+ if (H5T_convert_committed_datatype(attr->shared->dt, loc->oloc->file) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't get shared datatype info")
/* Mark datatype as being on disk now */
- if(H5T_set_loc(attr->shared->dt, H5F_VOL_OBJ(loc->oloc->file), H5T_LOC_DISK) < 0)
+ if (H5T_set_loc(attr->shared->dt, H5F_VOL_OBJ(loc->oloc->file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location")
/* Set the version for datatype */
- if(H5T_set_version(loc->oloc->file, attr->shared->dt) < 0)
+ if (H5T_set_version(loc->oloc->file, attr->shared->dt) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set version of datatype")
/* Copy the dataspace for the attribute */
attr->shared->ds = H5S_copy(space, FALSE, TRUE);
/* Set the version for dataspace */
- if(H5S_set_version(loc->oloc->file, attr->shared->ds) < 0)
+ if (H5S_set_version(loc->oloc->file, attr->shared->ds) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set version of dataspace")
/* Copy the object header information */
- if(H5O_loc_copy_deep(&(attr->oloc), loc->oloc) < 0)
+ if (H5O_loc_copy_deep(&(attr->oloc), loc->oloc) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to copy entry")
/* Deep copy of the group hierarchy path */
- if(H5G_name_copy(&(attr->path), loc->path, H5_COPY_DEEP) < 0)
+ if (H5G_name_copy(&(attr->path), loc->path, H5_COPY_DEEP) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "unable to copy path")
/* Check if any of the pieces should be (or are already) shared in the
* SOHM table
*/
- if(H5SM_try_share(attr->oloc.file, NULL, 0, H5O_DTYPE_ID, attr->shared->dt, NULL) < 0)
+ if (H5SM_try_share(attr->oloc.file, NULL, 0, H5O_DTYPE_ID, attr->shared->dt, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share datatype failed")
- if(H5SM_try_share(attr->oloc.file, NULL, 0, H5O_SDSPACE_ID, attr->shared->ds, NULL) < 0)
+ if (H5SM_try_share(attr->oloc.file, NULL, 0, H5O_SDSPACE_ID, attr->shared->ds, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share dataspace failed")
/* Check whether datatype is committed & increment ref count
* (to maintain ref. count incr/decr similarity with "shared message"
* type of datatype sharing)
*/
- if(H5T_is_named(attr->shared->dt))
+ if (H5T_is_named(attr->shared->dt))
/* Increment the reference count on the shared datatype */
- if(H5T_link(attr->shared->dt, 1) < 0)
+ if (H5T_link(attr->shared->dt, 1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, NULL, "unable to adjust shared datatype link count")
/* Compute the size of pieces on disk. This is either the size of the
@@ -256,7 +247,7 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type,
attr->shared->ds_size = H5O_msg_raw_size(attr->oloc.file, H5O_SDSPACE_ID, FALSE, attr->shared->ds);
/* Get # of elements for attribute's dataspace */
- if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0)
+ if ((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, NULL, "dataspace is invalid")
H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t);
@@ -265,16 +256,16 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type,
attr->shared->data_size = nelmts * H5T_GET_SIZE(attr->shared->dt);
/* Hold the symbol table entry (and file) open */
- if(H5O_open(&(attr->oloc)) < 0)
+ if (H5O_open(&(attr->oloc)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open")
attr->obj_opened = TRUE;
/* Set the version to encode the attribute with */
- if(H5A__set_version(attr->oloc.file, attr) < 0)
+ if (H5A__set_version(attr->oloc.file, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, NULL, "unable to update attribute version")
/* Insert the attribute into the object header */
- if(H5O__attr_create(&(attr->oloc), attr) < 0)
+ if (H5O__attr_create(&(attr->oloc), attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, NULL, "unable to create attribute in object header")
/* Set return value */
@@ -282,13 +273,12 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type,
done:
/* Cleanup on failure */
- if(NULL == ret_value && attr && H5A__close(attr))
+ if (NULL == ret_value && attr && H5A__close(attr))
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* H5A__create() */
-
/*-------------------------------------------------------------------------
* Function: H5A__create_by_name
*
@@ -302,15 +292,15 @@ done:
*-------------------------------------------------------------------------
*/
H5A_t *
-H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name,
- const H5T_t *type, const H5S_t *space, hid_t acpl_id)
+H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name, const H5T_t *type,
+ const H5S_t *space, hid_t acpl_id)
{
- H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
- hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
- H5A_t *attr = NULL; /* Attribute from object header */
- H5A_t *ret_value = NULL; /* Return value */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
+ H5A_t * attr = NULL; /* Attribute from object header */
+ H5A_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -325,12 +315,12 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr
H5G_loc_reset(&obj_loc);
/* Find the object's location */
- if(H5G_loc_find(loc, obj_name, &obj_loc/*out*/) < 0)
+ if (H5G_loc_find(loc, obj_name, &obj_loc /*out*/) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "object not found")
loc_found = TRUE;
/* Go do the real work for attaching the attribute to the object */
- if(NULL == (attr = H5A__create(&obj_loc, attr_name, type, space, acpl_id)))
+ if (NULL == (attr = H5A__create(&obj_loc, attr_name, type, space, acpl_id)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute")
/* Set return value */
@@ -338,18 +328,17 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr
done:
/* Release resources */
- if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ if (loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location")
/* Cleanup on failure */
- if(ret_value == NULL)
- if(attr && H5A__close(attr) < 0)
+ if (ret_value == NULL)
+ if (attr && H5A__close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__create_by_name() */
-
/*-------------------------------------------------------------------------
* Function: H5A__open_common
*
@@ -370,7 +359,7 @@ done:
herr_t
H5A__open_common(const H5G_loc_t *loc, H5A_t *attr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -380,24 +369,24 @@ H5A__open_common(const H5G_loc_t *loc, H5A_t *attr)
#if defined(H5_USING_MEMCHECKER) || !defined(NDEBUG)
/* Clear object location */
- if(H5O_loc_reset(&(attr->oloc)) < 0)
+ if (H5O_loc_reset(&(attr->oloc)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to reset location")
#endif /* H5_USING_MEMCHECKER */
/* Free any previous group hier. path */
- if(H5G_name_free(&(attr->path)) < 0)
+ if (H5G_name_free(&(attr->path)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release group hier. path")
/* Deep copy of the symbol table entry */
- if(H5O_loc_copy_deep(&(attr->oloc), loc->oloc) < 0)
+ if (H5O_loc_copy_deep(&(attr->oloc), loc->oloc) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to copy entry")
/* Deep copy of the group hier. path */
- if(H5G_name_copy(&(attr->path), loc->path, H5_COPY_DEEP) < 0)
+ if (H5G_name_copy(&(attr->path), loc->path, H5_COPY_DEEP) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "unable to copy entry")
/* Hold the symbol table entry (and file) open */
- if(H5O_open(&(attr->oloc)) < 0)
+ if (H5O_open(&(attr->oloc)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open")
attr->obj_opened = TRUE;
@@ -405,7 +394,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__open_common() */
-
/*-------------------------------------------------------------------------
* Function: H5A__open
*
@@ -421,8 +409,8 @@ done:
H5A_t *
H5A__open(const H5G_loc_t *loc, const char *attr_name)
{
- H5A_t *attr = NULL; /* Attribute from object header */
- H5A_t *ret_value = NULL; /* Return value */
+ H5A_t *attr = NULL; /* Attribute from object header */
+ H5A_t *ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -431,11 +419,12 @@ H5A__open(const H5G_loc_t *loc, const char *attr_name)
HDassert(attr_name);
/* Read in attribute from object header */
- if(NULL == (attr = H5O__attr_open_by_name(loc->oloc, attr_name)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to load attribute info from object header for attribute: '%s'", attr_name)
+ if (NULL == (attr = H5O__attr_open_by_name(loc->oloc, attr_name)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL,
+ "unable to load attribute info from object header for attribute: '%s'", attr_name)
/* Finish initializing attribute */
- if(H5A__open_common(loc, attr) < 0)
+ if (H5A__open_common(loc, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to initialize attribute")
/* Set return value */
@@ -443,14 +432,13 @@ H5A__open(const H5G_loc_t *loc, const char *attr_name)
done:
/* Cleanup on failure */
- if(ret_value == NULL)
- if(attr && H5A__close(attr) < 0)
+ if (ret_value == NULL)
+ if (attr && H5A__close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__open() */
-
/*-------------------------------------------------------------------------
* Function: H5A__open_by_idx
*
@@ -464,15 +452,15 @@ done:
*-------------------------------------------------------------------------
*/
H5A_t *
-H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n)
+H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n)
{
- H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
- hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
- H5A_t *attr = NULL; /* Attribute from object header */
- H5A_t *ret_value = NULL; /* Return value */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
+ H5A_t * attr = NULL; /* Attribute from object header */
+ H5A_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -486,16 +474,16 @@ H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type
H5G_loc_reset(&obj_loc);
/* Find the object's location */
- if(H5G_loc_find(loc, obj_name, &obj_loc/*out*/) < 0)
+ if (H5G_loc_find(loc, obj_name, &obj_loc /*out*/) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "object not found")
loc_found = TRUE;
/* Read in attribute from object header */
- if(NULL == (attr = H5O__attr_open_by_idx(obj_loc.oloc, idx_type, order, n)))
+ if (NULL == (attr = H5O__attr_open_by_idx(obj_loc.oloc, idx_type, order, n)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to load attribute info from object header")
/* Finish initializing attribute */
- if(H5A__open_common(&obj_loc, attr) < 0)
+ if (H5A__open_common(&obj_loc, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to initialize attribute")
/* Set return value */
@@ -503,18 +491,17 @@ H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type
done:
/* Release resources */
- if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ if (loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location")
/* Cleanup on failure */
- if(ret_value == NULL)
- if(attr && H5A__close(attr) < 0)
+ if (ret_value == NULL)
+ if (attr && H5A__close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__open_by_idx() */
-
/*-------------------------------------------------------------------------
* Function: H5A__open_by_name
*
@@ -530,12 +517,12 @@ done:
H5A_t *
H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name)
{
- H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
- hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
- H5A_t *attr = NULL; /* Attribute from object header */
- H5A_t *ret_value = NULL; /* Return value */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
+ H5A_t * attr = NULL; /* Attribute from object header */
+ H5A_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -550,16 +537,16 @@ H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_n
H5G_loc_reset(&obj_loc);
/* Find the object's location */
- if(H5G_loc_find(loc, obj_name, &obj_loc/*out*/) < 0)
+ if (H5G_loc_find(loc, obj_name, &obj_loc /*out*/) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "object not found")
loc_found = TRUE;
/* Read in attribute from object header */
- if(NULL == (attr = H5O__attr_open_by_name(obj_loc.oloc, attr_name)))
+ if (NULL == (attr = H5O__attr_open_by_name(obj_loc.oloc, attr_name)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to load attribute info from object header")
/* Finish initializing attribute */
- if(H5A__open_common(loc, attr) < 0)
+ if (H5A__open_common(loc, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to initialize attribute")
/* Set return value */
@@ -567,18 +554,17 @@ H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_n
done:
/* Release resources */
- if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ if (loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location")
/* Cleanup on failure */
- if(ret_value == NULL)
- if(attr && H5A__close(attr) < 0)
+ if (ret_value == NULL)
+ if (attr && H5A__close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__open_by_name() */
-
/*--------------------------------------------------------------------------
NAME
H5A__read
@@ -598,16 +584,16 @@ done:
herr_t
H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf)
{
- uint8_t *tconv_buf = NULL; /* datatype conv buffer*/
- uint8_t *bkg_buf = NULL; /* background buffer */
- hssize_t snelmts; /* elements in attribute */
- size_t nelmts; /* elements in attribute*/
- H5T_path_t *tpath = NULL; /* type conversion info */
- hid_t src_id = -1, dst_id = -1;/* temporary type atoms*/
- size_t src_type_size; /* size of source type */
- size_t dst_type_size; /* size of destination type */
- size_t buf_size; /* desired buffer size */
- herr_t ret_value = SUCCEED;
+ uint8_t * tconv_buf = NULL; /* datatype conv buffer*/
+ uint8_t * bkg_buf = NULL; /* background buffer */
+ hssize_t snelmts; /* elements in attribute */
+ size_t nelmts; /* elements in attribute*/
+ H5T_path_t *tpath = NULL; /* type conversion info */
+ hid_t src_id = -1, dst_id = -1; /* temporary type atoms*/
+ size_t src_type_size; /* size of source type */
+ size_t dst_type_size; /* size of destination type */
+ size_t buf_size; /* desired buffer size */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr)
@@ -615,47 +601,49 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf)
HDassert(mem_type);
HDassert(buf);
- /* Patch the top level file pointer in attr->shared->dt->shared->u.vlen.f if needed */
- if(H5T_patch_vlen_file(attr->shared->dt, H5F_VOL_OBJ(attr->oloc.file)) < 0 )
+ /* Patch the top level file pointer in attr->shared->dt->shared->u.vlen.f if needed */
+ if (H5T_patch_vlen_file(attr->shared->dt, H5F_VOL_OBJ(attr->oloc.file)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch VL datatype file pointer")
/* Create buffer for data to store on disk */
- if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0)
+ if ((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t);
- if(nelmts > 0) {
+ if (nelmts > 0) {
/* Get the memory and file datatype sizes */
src_type_size = H5T_GET_SIZE(attr->shared->dt);
dst_type_size = H5T_GET_SIZE(mem_type);
/* Check if the attribute has any data yet, if not, fill with zeroes */
- if(attr->obj_opened && !attr->shared->data)
+ if (attr->obj_opened && !attr->shared->data)
HDmemset(buf, 0, (dst_type_size * nelmts));
- else { /* Attribute exists and has a value */
+ else { /* Attribute exists and has a value */
/* Convert memory buffer into disk buffer */
/* Set up type conversion function */
- if(NULL == (tpath = H5T_path_find(attr->shared->dt, mem_type)))
- HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes")
+ if (NULL == (tpath = H5T_path_find(attr->shared->dt, mem_type)))
+ HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL,
+ "unable to convert between src and dst datatypes")
/* Check for type conversion required */
- if(!H5T_path_noop(tpath)) {
- if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0 ||
- (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0)
+ if (!H5T_path_noop(tpath)) {
+ if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) <
+ 0 ||
+ (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion")
/* Get the maximum buffer size needed and allocate it */
buf_size = nelmts * MAX(src_type_size, dst_type_size);
- if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size)))
+ if (NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size)))
HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed")
- if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size)))
+ if (NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size)))
HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Copy the attribute data into the buffer for conversion */
H5MM_memcpy(tconv_buf, attr->shared->data, (src_type_size * nelmts));
/* Perform datatype conversion. */
- if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf) < 0)
+ if (H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed")
/* Copy the converted data into the user's buffer */
@@ -668,24 +656,23 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf)
/* Copy the attribute data into the user's buffer */
H5MM_memcpy(buf, attr->shared->data, (dst_type_size * nelmts));
} /* end else */
- } /* end else */
- } /* end if */
+ } /* end else */
+ } /* end if */
done:
/* Release resources */
- if(src_id >= 0 && H5I_dec_ref(src_id) < 0)
+ if (src_id >= 0 && H5I_dec_ref(src_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object")
- if(dst_id >= 0 && H5I_dec_ref(dst_id) < 0)
+ if (dst_id >= 0 && H5I_dec_ref(dst_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object")
- if(tconv_buf)
+ if (tconv_buf)
tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf);
- if(bkg_buf)
+ if (bkg_buf)
bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf);
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* H5A__read() */
-
/*--------------------------------------------------------------------------
NAME
H5A__write
@@ -705,17 +692,17 @@ done:
herr_t
H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf)
{
- uint8_t *tconv_buf = NULL; /* datatype conv buffer */
- hbool_t tconv_owned = FALSE; /* Whether the datatype conv buffer is owned by attribute */
- uint8_t *bkg_buf = NULL; /* temp conversion buffer */
- hssize_t snelmts; /* elements in attribute */
- size_t nelmts; /* elements in attribute */
- H5T_path_t *tpath = NULL; /* conversion information*/
- hid_t src_id = -1, dst_id = -1;/* temporary type atoms */
- size_t src_type_size; /* size of source type */
- size_t dst_type_size; /* size of destination type*/
- size_t buf_size; /* desired buffer size */
- herr_t ret_value = SUCCEED;
+ uint8_t * tconv_buf = NULL; /* datatype conv buffer */
+ hbool_t tconv_owned = FALSE; /* Whether the datatype conv buffer is owned by attribute */
+ uint8_t * bkg_buf = NULL; /* temp conversion buffer */
+ hssize_t snelmts; /* elements in attribute */
+ size_t nelmts; /* elements in attribute */
+ H5T_path_t *tpath = NULL; /* conversion information*/
+ hid_t src_id = -1, dst_id = -1; /* temporary type atoms */
+ size_t src_type_size; /* size of source type */
+ size_t dst_type_size; /* size of destination type*/
+ size_t buf_size; /* desired buffer size */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr)
@@ -724,56 +711,56 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf)
HDassert(buf);
/* Get # of elements for attribute's dataspace */
- if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0)
+ if ((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t);
/* If there's actually data elements for the attribute, make a copy of the data passed in */
- if(nelmts > 0) {
+ if (nelmts > 0) {
/* Get the memory and file datatype sizes */
src_type_size = H5T_GET_SIZE(mem_type);
dst_type_size = H5T_GET_SIZE(attr->shared->dt);
/* Convert memory buffer into disk buffer */
/* Set up type conversion function */
- if(NULL == (tpath = H5T_path_find(mem_type, attr->shared->dt)))
+ if (NULL == (tpath = H5T_path_find(mem_type, attr->shared->dt)))
HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes")
/* Check for type conversion required */
- if(!H5T_path_noop(tpath)) {
- if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0 ||
- (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0)
+ if (!H5T_path_noop(tpath)) {
+ if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0 ||
+ (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion")
/* Get the maximum buffer size needed and allocate it */
buf_size = nelmts * MAX(src_type_size, dst_type_size);
- if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size)))
+ if (NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed")
- if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size)))
+ if (NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed")
/* Copy the user's data into the buffer for conversion */
H5MM_memcpy(tconv_buf, buf, (src_type_size * nelmts));
/* Perform datatype conversion */
- if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf) < 0)
+ if (H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed")
/* Free the previous attribute data buffer, if there is one */
- if(attr->shared->data)
+ if (attr->shared->data)
attr->shared->data = H5FL_BLK_FREE(attr_buf, attr->shared->data);
/* Set the pointer to the attribute data to the converted information */
attr->shared->data = tconv_buf;
- tconv_owned = TRUE;
+ tconv_owned = TRUE;
} /* end if */
/* No type conversion necessary */
else {
HDassert(dst_type_size == src_type_size);
/* Allocate the attribute buffer, if there isn't one */
- if(attr->shared->data == NULL)
- if(NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, dst_type_size * nelmts)))
+ if (attr->shared->data == NULL)
+ if (NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, dst_type_size * nelmts)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Copy the attribute data into the attribute data buffer */
@@ -781,25 +768,24 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf)
} /* end else */
/* Modify the attribute in the object header */
- if(H5O__attr_write(&(attr->oloc), attr) < 0)
+ if (H5O__attr_write(&(attr->oloc), attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to modify attribute")
} /* end if */
done:
/* Release resources */
- if(src_id >= 0 && H5I_dec_ref(src_id) < 0)
+ if (src_id >= 0 && H5I_dec_ref(src_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object")
- if(dst_id >= 0 && H5I_dec_ref(dst_id) < 0)
+ if (dst_id >= 0 && H5I_dec_ref(dst_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object")
- if(tconv_buf && !tconv_owned)
+ if (tconv_buf && !tconv_owned)
tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf);
- if(bkg_buf)
+ if (bkg_buf)
bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf);
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* H5A__write() */
-
/*--------------------------------------------------------------------------
NAME
H5A__get_name
@@ -819,8 +805,8 @@ done:
ssize_t
H5A__get_name(H5A_t *attr, size_t buf_size, char *buf)
{
- size_t copy_len, nbytes;
- ssize_t ret_value = -1; /* Return value */
+ size_t copy_len, nbytes;
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_PACKAGE_NOERR
@@ -832,11 +818,11 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf)
copy_len = MIN(buf_size - 1, nbytes);
/* Copy all/some of the name */
- if(buf && copy_len > 0) {
+ if (buf && copy_len > 0) {
H5MM_memcpy(buf, attr->shared->name, copy_len);
/* Terminate the string */
- buf[copy_len]='\0';
+ buf[copy_len] = '\0';
} /* end if */
/* Set return value */
@@ -845,7 +831,6 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf)
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__get_name() */
-
/*-------------------------------------------------------------------------
* Function: H5A_get_space
*
@@ -860,8 +845,8 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf)
hid_t
H5A_get_space(H5A_t *attr)
{
- H5S_t *ds = NULL;
- hid_t ret_value = H5I_INVALID_HID;
+ H5S_t *ds = NULL;
+ hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_NOAPI_NOINIT
@@ -882,7 +867,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A_get_space() */
-
/*-------------------------------------------------------------------------
* Function: H5A__get_type
*
@@ -896,8 +880,8 @@ done:
hid_t
H5A__get_type(H5A_t *attr)
{
- H5T_t *dt = NULL;
- hid_t ret_value = H5I_INVALID_HID;
+ H5T_t *dt = NULL;
+ hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_PACKAGE
@@ -937,14 +921,13 @@ H5A__get_type(H5A_t *attr)
}
done:
- if(H5I_INVALID_HID == ret_value)
- if(dt && H5T_close(dt) < 0)
+ if (H5I_INVALID_HID == ret_value)
+ if (dt && H5T_close(dt) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__get_type() */
-
/*--------------------------------------------------------------------------
NAME
H5A__get_create_plist
@@ -962,26 +945,26 @@ done:
resource leaks will occur.
--------------------------------------------------------------------------*/
hid_t
-H5A__get_create_plist(H5A_t* attr)
+H5A__get_create_plist(H5A_t *attr)
{
- H5P_genplist_t *plist; /* Default property list */
- hid_t new_plist_id; /* ID of ACPL to return */
- H5P_genplist_t *new_plist; /* ACPL to return */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5P_genplist_t *plist; /* Default property list */
+ hid_t new_plist_id; /* ID of ACPL to return */
+ H5P_genplist_t *new_plist; /* ACPL to return */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_PACKAGE
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(H5P_LST_ATTRIBUTE_CREATE_ID_g)))
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object(H5P_LST_ATTRIBUTE_CREATE_ID_g)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get default ACPL")
/* Create the property list object to return */
- if((new_plist_id = H5P_copy_plist(plist, TRUE)) < 0)
+ if ((new_plist_id = H5P_copy_plist(plist, TRUE)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy attribute creation properties")
- if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_plist_id)))
+ if (NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_plist_id)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list")
/* Set the character encoding on the new property list */
- if(H5P_set(new_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &(attr->shared->encoding)) < 0)
+ if (H5P_set(new_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &(attr->shared->encoding)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set character encoding")
ret_value = new_plist_id;
@@ -990,7 +973,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__get_create_plist() */
-
/*-------------------------------------------------------------------------
* Function: H5A__get_info
*
@@ -1007,7 +989,7 @@ done:
herr_t
H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1016,22 +998,21 @@ H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo)
HDassert(ainfo);
/* Set info for attribute */
- ainfo->cset = attr->shared->encoding;
+ ainfo->cset = attr->shared->encoding;
ainfo->data_size = attr->shared->data_size;
- if(attr->shared->crt_idx == H5O_MAX_CRT_ORDER_IDX) {
+ if (attr->shared->crt_idx == H5O_MAX_CRT_ORDER_IDX) {
ainfo->corder_valid = FALSE;
- ainfo->corder = 0;
+ ainfo->corder = 0;
} /* end if */
else {
ainfo->corder_valid = TRUE;
- ainfo->corder = attr->shared->crt_idx;
+ ainfo->corder = attr->shared->crt_idx;
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__get_info() */
-
/*-------------------------------------------------------------------------
* Function: H5A__copy
*
@@ -1048,9 +1029,9 @@ done:
H5A_t *
H5A__copy(H5A_t *_new_attr, const H5A_t *old_attr)
{
- H5A_t *new_attr = NULL;
- hbool_t allocated_attr = FALSE; /* Whether the attribute was allocated */
- H5A_t *ret_value = NULL; /* Return value */
+ H5A_t * new_attr = NULL;
+ hbool_t allocated_attr = FALSE; /* Whether the attribute was allocated */
+ H5A_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1058,8 +1039,8 @@ H5A__copy(H5A_t *_new_attr, const H5A_t *old_attr)
HDassert(old_attr);
/* Allocate attribute structure */
- if(_new_attr == NULL) {
- if(NULL == (new_attr = H5FL_CALLOC(H5A_t)))
+ if (_new_attr == NULL) {
+ if (NULL == (new_attr = H5FL_CALLOC(H5A_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
allocated_attr = TRUE;
} /* end if */
@@ -1070,7 +1051,7 @@ H5A__copy(H5A_t *_new_attr, const H5A_t *old_attr)
new_attr->sh_loc = old_attr->sh_loc;
/* Deep copy of the group hierarchy path */
- if(H5G_name_copy(&(new_attr->path), &(old_attr->path), H5_COPY_DEEP) < 0)
+ if (H5G_name_copy(&(new_attr->path), &(old_attr->path), H5_COPY_DEEP) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "unable to copy path")
/* Share some attribute information */
@@ -1086,14 +1067,13 @@ H5A__copy(H5A_t *_new_attr, const H5A_t *old_attr)
ret_value = new_attr;
done:
- if(ret_value == NULL)
- if(allocated_attr && new_attr && H5A__close(new_attr) < 0)
+ if (ret_value == NULL)
+ if (allocated_attr && new_attr && H5A__close(new_attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__copy() */
-
/*-------------------------------------------------------------------------
* Function: H5A__shared_free
*
@@ -1112,7 +1092,7 @@ done:
herr_t
H5A__shared_free(H5A_t *attr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1122,21 +1102,21 @@ H5A__shared_free(H5A_t *attr)
/* Free dynamically allocated items.
* When possible, keep trying to shut things down (via HDONE_ERROR).
*/
- if(attr->shared->name) {
+ if (attr->shared->name) {
H5MM_xfree(attr->shared->name);
attr->shared->name = NULL;
}
- if(attr->shared->dt) {
- if(H5T_close_real(attr->shared->dt) < 0)
+ if (attr->shared->dt) {
+ if (H5T_close_real(attr->shared->dt) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info")
attr->shared->dt = NULL;
}
- if(attr->shared->ds) {
- if(H5S_close(attr->shared->ds) < 0)
+ if (attr->shared->ds) {
+ if (H5S_close(attr->shared->ds) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info")
attr->shared->ds = NULL;
}
- if(attr->shared->data)
+ if (attr->shared->data)
attr->shared->data = H5FL_BLK_FREE(attr_buf, attr->shared->data);
/* Destroy shared attribute struct */
@@ -1145,7 +1125,6 @@ H5A__shared_free(H5A_t *attr)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__shared_free() */
-
/*-------------------------------------------------------------------------
* Function: H5A__close_cb
*
@@ -1158,7 +1137,7 @@ H5A__shared_free(H5A_t *attr)
herr_t
H5A__close_cb(H5VL_object_t *attr_vol_obj)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1166,18 +1145,17 @@ H5A__close_cb(H5VL_object_t *attr_vol_obj)
HDassert(attr_vol_obj);
/* Close the attribute */
- if((ret_value = H5VL_attr_close(attr_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
+ if ((ret_value = H5VL_attr_close(attr_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute")
/* Free the VOL object */
- if(H5VL_free_object(attr_vol_obj) < 0)
+ if (H5VL_free_object(attr_vol_obj) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__close_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5A__close
*
@@ -1193,7 +1171,7 @@ done:
herr_t
H5A__close(H5A_t *attr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1201,14 +1179,14 @@ H5A__close(H5A_t *attr)
HDassert(attr->shared);
/* Close the object's symbol-table entry */
- if(attr->obj_opened && (H5O_close(&(attr->oloc), NULL) < 0))
+ if (attr->obj_opened && (H5O_close(&(attr->oloc), NULL) < 0))
HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release object header info")
/* Reference count can be 0. It only happens when H5A__create fails. */
- if(attr->shared->nrefs <= 1) {
+ if (attr->shared->nrefs <= 1) {
/* Free dynamically allocated items */
- if(attr->shared)
- if(H5A__shared_free(attr) < 0)
+ if (attr->shared)
+ if (H5A__shared_free(attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info")
} /* end if */
else {
@@ -1218,17 +1196,16 @@ H5A__close(H5A_t *attr)
} /* end else */
/* Free group hierarchy path */
- if(H5G_name_free(&(attr->path)) < 0)
+ if (H5G_name_free(&(attr->path)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release group hier. path")
attr->shared = NULL;
- attr = H5FL_FREE(H5A_t, attr);
+ attr = H5FL_FREE(H5A_t, attr);
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__close() */
-
/*-------------------------------------------------------------------------
* Function: H5A_oloc
*
@@ -1247,7 +1224,7 @@ done:
H5O_loc_t *
H5A_oloc(H5A_t *attr)
{
- H5O_loc_t *ret_value = NULL; /* Return value */
+ H5O_loc_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1260,7 +1237,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A_oloc() */
-
/*-------------------------------------------------------------------------
* Function: H5A_nameof
*
@@ -1279,7 +1255,7 @@ done:
H5G_name_t *
H5A_nameof(H5A_t *attr)
{
- H5G_name_t *ret_value = NULL; /* Return value */
+ H5G_name_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1292,7 +1268,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A_nameof() */
-
/*-------------------------------------------------------------------------
* Function: H5A_type
*
@@ -1309,7 +1284,7 @@ done:
H5T_t *
H5A_type(const H5A_t *attr)
{
- H5T_t *ret_value = NULL; /* Return value */
+ H5T_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1322,7 +1297,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A_type() */
-
/*-------------------------------------------------------------------------
* Function: H5A__exists_by_name
*
@@ -1338,11 +1312,11 @@ done:
htri_t
H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name)
{
- H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
- hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
- htri_t ret_value = FAIL; /* Return value */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1352,23 +1326,22 @@ H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name)
H5G_loc_reset(&obj_loc);
/* Find the object's location */
- if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0)
+ if (H5G_loc_find(&loc, obj_name, &obj_loc /*out*/) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
loc_found = TRUE;
/* Check if the attribute exists */
- if((ret_value = H5O__attr_exists(obj_loc.oloc, attr_name)) < 0)
+ if ((ret_value = H5O__attr_exists(obj_loc.oloc, attr_name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done:
/* Release resources */
- if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ if (loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__exists_by_name() */
-
/*-------------------------------------------------------------------------
* Function: H5A__compact_build_table_cb
*
@@ -1387,11 +1360,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5A__compact_build_table_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
- unsigned sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/)
+H5A__compact_build_table_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence,
+ unsigned H5_ATTR_UNUSED *oh_modified, void *_udata /*in,out*/)
{
- H5A_compact_bt_ud_t *udata = (H5A_compact_bt_ud_t *)_udata; /* Operator user data */
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ H5A_compact_bt_ud_t *udata = (H5A_compact_bt_ud_t *)_udata; /* Operator user data */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -1399,26 +1372,26 @@ H5A__compact_build_table_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/
HDassert(mesg);
/* Re-allocate the table if necessary */
- if(udata->curr_attr == udata->atable->nattrs) {
- H5A_t **new_table; /* New table for attributes */
- size_t new_table_size; /* Number of attributes in new table */
+ if (udata->curr_attr == udata->atable->nattrs) {
+ H5A_t **new_table; /* New table for attributes */
+ size_t new_table_size; /* Number of attributes in new table */
/* Allocate larger table */
new_table_size = MAX(1, 2 * udata->atable->nattrs);
- if(NULL == (new_table = (H5A_t **)H5FL_SEQ_REALLOC(H5A_t_ptr, udata->atable->attrs, new_table_size)))
+ if (NULL == (new_table = (H5A_t **)H5FL_SEQ_REALLOC(H5A_t_ptr, udata->atable->attrs, new_table_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "unable to extend attribute table")
/* Update table information in user data */
- udata->atable->attrs = new_table;
+ udata->atable->attrs = new_table;
udata->atable->nattrs = new_table_size;
} /* end if */
/* Copy attribute into table */
- if(NULL == (udata->atable->attrs[udata->curr_attr] = H5A__copy(NULL, (const H5A_t *)mesg->native)))
+ if (NULL == (udata->atable->attrs[udata->curr_attr] = H5A__copy(NULL, (const H5A_t *)mesg->native)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute")
/* Assign [somewhat arbitrary] creation order value, if requested */
- if(udata->bogus_crt_idx)
+ if (udata->bogus_crt_idx)
((udata->atable->attrs[udata->curr_attr])->shared)->crt_idx = sequence;
/* Increment current attribute */
@@ -1428,7 +1401,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__compact_build_table_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5A__compact_build_table
*
@@ -1446,12 +1418,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5A__compact_build_table(H5F_t *f, H5O_t *oh, H5_index_t idx_type,
- H5_iter_order_t order, H5A_attr_table_t *atable)
+H5A__compact_build_table(H5F_t *f, H5O_t *oh, H5_index_t idx_type, H5_iter_order_t order,
+ H5A_attr_table_t *atable)
{
- H5A_compact_bt_ud_t udata; /* User data for iteration callback */
- H5O_mesg_operator_t op; /* Wrapper for operator */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5A_compact_bt_ud_t udata; /* User data for iteration callback */
+ H5O_mesg_operator_t op; /* Wrapper for operator */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1461,29 +1433,29 @@ H5A__compact_build_table(H5F_t *f, H5O_t *oh, H5_index_t idx_type,
HDassert(atable);
/* Initialize table */
- atable->attrs = NULL;
+ atable->attrs = NULL;
atable->nattrs = 0;
/* Set up user data for iteration */
- udata.f = f;
- udata.atable = atable;
- udata.curr_attr = 0;
- udata.bogus_crt_idx = (hbool_t)((oh->version == H5O_VERSION_1 ||
- !(oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)) ? TRUE : FALSE);
+ udata.f = f;
+ udata.atable = atable;
+ udata.curr_attr = 0;
+ udata.bogus_crt_idx = (hbool_t)(
+ (oh->version == H5O_VERSION_1 || !(oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)) ? TRUE : FALSE);
/* Iterate over existing attributes, checking for attribute with same name */
- op.op_type = H5O_MESG_OP_LIB;
+ op.op_type = H5O_MESG_OP_LIB;
op.u.lib_op = H5A__compact_build_table_cb;
- if(H5O__msg_iterate_real(f, oh, H5O_MSG_ATTR, &op, &udata) < 0)
+ if (H5O__msg_iterate_real(f, oh, H5O_MSG_ATTR, &op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error building attribute table")
/* Correct # of attributes in table */
atable->nattrs = udata.curr_attr;
/* Don't sort an empty table. */
- if(atable->nattrs > 0) {
+ if (atable->nattrs > 0) {
/* Sort attribute table in correct iteration order */
- if(H5A__attr_sort_table(atable, idx_type, order) < 0)
+ if (H5A__attr_sort_table(atable, idx_type, order) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSORT, FAIL, "error sorting attribute table")
} /* end if */
@@ -1491,7 +1463,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__compact_build_table() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_build_table_cb
*
@@ -1508,8 +1479,8 @@ done:
static herr_t
H5A__dense_build_table_cb(const H5A_t *attr, void *_udata)
{
- H5A_dense_bt_ud_t *udata = (H5A_dense_bt_ud_t *)_udata; /* 'User data' passed in */
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ H5A_dense_bt_ud_t *udata = (H5A_dense_bt_ud_t *)_udata; /* 'User data' passed in */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -1519,11 +1490,11 @@ H5A__dense_build_table_cb(const H5A_t *attr, void *_udata)
HDassert(udata->curr_attr < udata->atable->nattrs);
/* Allocate attribute for entry in the table */
- if(NULL == (udata->atable->attrs[udata->curr_attr] = H5FL_CALLOC(H5A_t)))
+ if (NULL == (udata->atable->attrs[udata->curr_attr] = H5FL_CALLOC(H5A_t)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, H5_ITER_ERROR, "can't allocate attribute")
/* Copy attribute information. Share the attribute object in copying. */
- if(NULL == H5A__copy(udata->atable->attrs[udata->curr_attr], attr))
+ if (NULL == H5A__copy(udata->atable->attrs[udata->curr_attr], attr))
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute")
/* Increment number of attributes stored */
@@ -1533,7 +1504,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_build_table_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_build_table
*
@@ -1552,12 +1522,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5A__dense_build_table(H5F_t *f, const H5O_ainfo_t *ainfo,
- H5_index_t idx_type, H5_iter_order_t order, H5A_attr_table_t *atable)
+H5A__dense_build_table(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type, H5_iter_order_t order,
+ H5A_attr_table_t *atable)
{
- H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
- hsize_t nrec; /* # of records in v2 B-tree */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
+ hsize_t nrec; /* # of records in v2 B-tree */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1569,12 +1539,12 @@ H5A__dense_build_table(H5F_t *f, const H5O_ainfo_t *ainfo,
HDassert(atable);
/* Open the name index v2 B-tree */
- if(NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL)))
+ if (NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Retrieve # of records in "name" B-tree */
/* (should be same # of records in all indices) */
- if(H5B2_get_nrec(bt2_name, &nrec) < 0)
+ if (H5B2_get_nrec(bt2_name, &nrec) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve # of records in index")
/* Set size of table */
@@ -1582,29 +1552,29 @@ H5A__dense_build_table(H5F_t *f, const H5O_ainfo_t *ainfo,
atable->nattrs = (size_t)nrec;
/* Allocate space for the table entries */
- if(atable->nattrs > 0) {
- H5A_dense_bt_ud_t udata; /* User data for iteration callback */
- H5A_attr_iter_op_t attr_op; /* Attribute operator */
+ if (atable->nattrs > 0) {
+ H5A_dense_bt_ud_t udata; /* User data for iteration callback */
+ H5A_attr_iter_op_t attr_op; /* Attribute operator */
/* Allocate the table to store the attributes */
- if((atable->attrs = (H5A_t **)H5FL_SEQ_CALLOC(H5A_t_ptr, atable->nattrs)) == NULL)
+ if ((atable->attrs = (H5A_t **)H5FL_SEQ_CALLOC(H5A_t_ptr, atable->nattrs)) == NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Set up user data for iteration */
- udata.atable = atable;
+ udata.atable = atable;
udata.curr_attr = 0;
/* Build iterator operator */
- attr_op.op_type = H5A_ATTR_OP_LIB;
+ attr_op.op_type = H5A_ATTR_OP_LIB;
attr_op.u.lib_op = H5A__dense_build_table_cb;
/* Iterate over the links in the group, building a table of the link messages */
- if(H5A__dense_iterate(f, (hid_t)0, ainfo, H5_INDEX_NAME, H5_ITER_NATIVE,
- (hsize_t)0, NULL, &attr_op, &udata) < 0)
+ if (H5A__dense_iterate(f, (hid_t)0, ainfo, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, NULL, &attr_op,
+ &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table")
/* Sort attribute table in correct iteration order */
- if(H5A__attr_sort_table(atable, idx_type, order) < 0)
+ if (H5A__attr_sort_table(atable, idx_type, order) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSORT, FAIL, "error sorting attribute table")
} /* end if */
else
@@ -1612,13 +1582,12 @@ H5A__dense_build_table(H5F_t *f, const H5O_ainfo_t *ainfo,
done:
/* Release resources */
- if(bt2_name && H5B2_close(bt2_name) < 0)
+ if (bt2_name && H5B2_close(bt2_name) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_build_table() */
-
/*-------------------------------------------------------------------------
* Function: H5A__attr_cmp_name_inc
*
@@ -1641,11 +1610,10 @@ H5A__attr_cmp_name_inc(const void *attr1, const void *attr2)
{
FUNC_ENTER_STATIC_NOERR
- FUNC_LEAVE_NOAPI(HDstrcmp((*(const H5A_t * const *)attr1)->shared->name,
- (*(const H5A_t * const *)attr2)->shared->name))
+ FUNC_LEAVE_NOAPI(
+ HDstrcmp((*(const H5A_t *const *)attr1)->shared->name, (*(const H5A_t *const *)attr2)->shared->name))
} /* end H5A__attr_cmp_name_inc() */
-
/*-------------------------------------------------------------------------
* Function: H5A__attr_cmp_name_dec
*
@@ -1668,11 +1636,10 @@ H5A__attr_cmp_name_dec(const void *attr1, const void *attr2)
{
FUNC_ENTER_STATIC_NOERR
- FUNC_LEAVE_NOAPI(HDstrcmp((*(const H5A_t * const *)attr2)->shared->name,
- (*(const H5A_t * const *)attr1)->shared->name))
+ FUNC_LEAVE_NOAPI(
+ HDstrcmp((*(const H5A_t *const *)attr2)->shared->name, (*(const H5A_t *const *)attr1)->shared->name))
} /* end H5A__attr_cmp_name_dec() */
-
/*-------------------------------------------------------------------------
* Function: H5A__attr_cmp_corder_inc
*
@@ -1692,13 +1659,14 @@ H5A__attr_cmp_name_dec(const void *attr1, const void *attr2)
static int
H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2)
{
- int ret_value = 0; /* Return value */
+ int ret_value = 0; /* Return value */
FUNC_ENTER_STATIC_NOERR
- if((*(const H5A_t * const *)attr1)->shared->crt_idx < (*(const H5A_t * const *)attr2)->shared->crt_idx)
+ if ((*(const H5A_t *const *)attr1)->shared->crt_idx < (*(const H5A_t *const *)attr2)->shared->crt_idx)
ret_value = -1;
- else if((*(const H5A_t * const *)attr1)->shared->crt_idx > (*(const H5A_t * const *)attr2)->shared->crt_idx)
+ else if ((*(const H5A_t *const *)attr1)->shared->crt_idx >
+ (*(const H5A_t *const *)attr2)->shared->crt_idx)
ret_value = 1;
else
ret_value = 0;
@@ -1706,7 +1674,6 @@ H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__attr_cmp_corder_inc() */
-
/*-------------------------------------------------------------------------
* Function: H5A__attr_cmp_corder_dec
*
@@ -1726,13 +1693,14 @@ H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2)
static int
H5A__attr_cmp_corder_dec(const void *attr1, const void *attr2)
{
- int ret_value = 0; /* Return value */
+ int ret_value = 0; /* Return value */
FUNC_ENTER_STATIC_NOERR
- if((*(const H5A_t * const *)attr1)->shared->crt_idx < (*(const H5A_t * const *)attr2)->shared->crt_idx)
+ if ((*(const H5A_t *const *)attr1)->shared->crt_idx < (*(const H5A_t *const *)attr2)->shared->crt_idx)
ret_value = 1;
- else if((*(const H5A_t * const *)attr1)->shared->crt_idx > (*(const H5A_t * const *)attr2)->shared->crt_idx)
+ else if ((*(const H5A_t *const *)attr1)->shared->crt_idx >
+ (*(const H5A_t *const *)attr2)->shared->crt_idx)
ret_value = -1;
else
ret_value = 0;
@@ -1740,7 +1708,6 @@ H5A__attr_cmp_corder_dec(const void *attr1, const void *attr2)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__attr_cmp_corder_dec() */
-
/*-------------------------------------------------------------------------
* Function: H5A__attr_sort_table
*
@@ -1754,8 +1721,7 @@ H5A__attr_cmp_corder_dec(const void *attr1, const void *attr2)
*-------------------------------------------------------------------------
*/
static herr_t
-H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type,
- H5_iter_order_t order)
+H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type, H5_iter_order_t order)
{
FUNC_ENTER_STATIC_NOERR
@@ -1763,20 +1729,20 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type,
HDassert(atable);
/* Pick appropriate comparison routine */
- if(idx_type == H5_INDEX_NAME) {
- if(order == H5_ITER_INC)
- HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t*), H5A__attr_cmp_name_inc);
- else if(order == H5_ITER_DEC)
- HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t*), H5A__attr_cmp_name_dec);
+ if (idx_type == H5_INDEX_NAME) {
+ if (order == H5_ITER_INC)
+ HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_name_inc);
+ else if (order == H5_ITER_DEC)
+ HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_name_dec);
else
HDassert(order == H5_ITER_NATIVE);
} /* end if */
else {
HDassert(idx_type == H5_INDEX_CRT_ORDER);
- if(order == H5_ITER_INC)
- HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t*), H5A__attr_cmp_corder_inc);
- else if(order == H5_ITER_DEC)
- HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t*), H5A__attr_cmp_corder_dec);
+ if (order == H5_ITER_INC)
+ HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_corder_inc);
+ else if (order == H5_ITER_DEC)
+ HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_corder_dec);
else
HDassert(order == H5_ITER_NATIVE);
} /* end else */
@@ -1784,7 +1750,6 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type,
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5A__attr_sort_table() */
-
/*-------------------------------------------------------------------------
* Function: H5A__attr_iterate_table
*
@@ -1799,12 +1764,11 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type,
*-------------------------------------------------------------------------
*/
herr_t
-H5A__attr_iterate_table(const H5A_attr_table_t *atable, hsize_t skip,
- hsize_t *last_attr, hid_t loc_id, const H5A_attr_iter_op_t *attr_op,
- void *op_data)
+H5A__attr_iterate_table(const H5A_attr_table_t *atable, hsize_t skip, hsize_t *last_attr, hid_t loc_id,
+ const H5A_attr_iter_op_t *attr_op, void *op_data)
{
- size_t u; /* Local index variable */
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ size_t u; /* Local index variable */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1813,20 +1777,19 @@ H5A__attr_iterate_table(const H5A_attr_table_t *atable, hsize_t skip,
HDassert(attr_op);
/* Skip over attributes, if requested */
- if(last_attr)
+ if (last_attr)
*last_attr = skip;
/* Iterate over attribute messages */
H5_CHECKED_ASSIGN(u, size_t, skip, hsize_t)
- for(; u < atable->nattrs && !ret_value; u++) {
+ for (; u < atable->nattrs && !ret_value; u++) {
/* Check which type of callback to make */
- switch(attr_op->op_type) {
- case H5A_ATTR_OP_APP2:
- {
- H5A_info_t ainfo; /* Info for attribute */
+ switch (attr_op->op_type) {
+ case H5A_ATTR_OP_APP2: {
+ H5A_info_t ainfo; /* Info for attribute */
/* Get the attribute information */
- if(H5A__get_info(atable->attrs[u], &ainfo) < 0)
+ if (H5A__get_info(atable->attrs[u], &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5_ITER_ERROR, "unable to get attribute info")
/* Make the application callback */
@@ -1850,23 +1813,22 @@ H5A__attr_iterate_table(const H5A_attr_table_t *atable, hsize_t skip,
HDassert("unknown attribute op type" && 0);
#ifdef NDEBUG
HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unsupported attribute op type")
-#endif /* NDEBUG */
+#endif /* NDEBUG */
} /* end switch */
/* Increment the number of entries passed through */
- if(last_attr)
+ if (last_attr)
(*last_attr)++;
} /* end for */
/* Check for callback failure and pass along return value */
- if(ret_value < 0)
+ if (ret_value < 0)
HERROR(H5E_ATTR, H5E_CANTNEXT, "iteration operator failed");
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__attr_iterate_table() */
-
/*-------------------------------------------------------------------------
* Function: H5A__attr_release_table
*
@@ -1882,7 +1844,7 @@ done:
herr_t
H5A__attr_release_table(H5A_attr_table_t *atable)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1890,12 +1852,12 @@ H5A__attr_release_table(H5A_attr_table_t *atable)
HDassert(atable);
/* Release attribute info, if any. */
- if(atable->nattrs > 0) {
- size_t u; /* Local index variable */
+ if (atable->nattrs > 0) {
+ size_t u; /* Local index variable */
/* Free attribute message information */
- for(u = 0; u < atable->nattrs; u++)
- if(atable->attrs[u] && H5A__close(atable->attrs[u]) < 0)
+ for (u = 0; u < atable->nattrs; u++)
+ if (atable->attrs[u] && H5A__close(atable->attrs[u]) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute")
} /* end if */
else
@@ -1907,7 +1869,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__attr_release_table() */
-
/*-------------------------------------------------------------------------
* Function: H5A__get_ainfo
*
@@ -1924,8 +1885,8 @@ done:
htri_t
H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo)
{
- H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
- htri_t ret_value = FAIL; /* Return value */
+ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI_TAG(oh->cache_info.addr, FAIL)
@@ -1935,41 +1896,40 @@ H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo)
HDassert(ainfo);
/* Check if the "attribute info" message exists */
- if((ret_value = H5O_msg_exists_oh(oh, H5O_AINFO_ID)) < 0)
+ if ((ret_value = H5O_msg_exists_oh(oh, H5O_AINFO_ID)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "unable to check object header")
- if(ret_value > 0) {
+ if (ret_value > 0) {
/* Retrieve the "attribute info" structure */
- if(NULL == H5O_msg_read_oh(f, oh, H5O_AINFO_ID, ainfo))
+ if (NULL == H5O_msg_read_oh(f, oh, H5O_AINFO_ID, ainfo))
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't read AINFO message")
/* Check if we don't know how many attributes there are */
- if(ainfo->nattrs == HSIZET_MAX) {
+ if (ainfo->nattrs == HSIZET_MAX) {
/* Check if we are using "dense" attribute storage */
- if(H5F_addr_defined(ainfo->fheap_addr)) {
+ if (H5F_addr_defined(ainfo->fheap_addr)) {
/* Open the name index v2 B-tree */
- if(NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL)))
+ if (NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Retrieve # of records in "name" B-tree */
/* (should be same # of records in all indices) */
- if(H5B2_get_nrec(bt2_name, &ainfo->nattrs) < 0)
+ if (H5B2_get_nrec(bt2_name, &ainfo->nattrs) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve # of records in index")
} /* end if */
else
/* Retrieve # of attributes from object header */
ainfo->nattrs = oh->attr_msgs_seen;
} /* end if */
- } /* end if */
+ } /* end if */
done:
/* Release resources */
- if(bt2_name && H5B2_close(bt2_name) < 0)
+ if (bt2_name && H5B2_close(bt2_name) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5A__get_ainfo() */
-
/*-------------------------------------------------------------------------
* Function: H5A__set_version
*
@@ -1987,9 +1947,10 @@ done:
herr_t
H5A__set_version(const H5F_t *f, H5A_t *attr)
{
- hbool_t type_shared, space_shared; /* Flags to indicate that shared messages are used for this attribute */
- uint8_t version; /* Message version */
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t type_shared,
+ space_shared; /* Flags to indicate that shared messages are used for this attribute */
+ uint8_t version; /* Message version */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1998,29 +1959,30 @@ H5A__set_version(const H5F_t *f, H5A_t *attr)
HDassert(attr);
/* Check whether datatype and dataspace are shared */
- if(H5O_msg_is_shared(H5O_DTYPE_ID, attr->shared->dt) > 0)
+ if (H5O_msg_is_shared(H5O_DTYPE_ID, attr->shared->dt) > 0)
type_shared = TRUE;
else
type_shared = FALSE;
- if(H5O_msg_is_shared(H5O_SDSPACE_ID, attr->shared->ds) > 0)
+ if (H5O_msg_is_shared(H5O_SDSPACE_ID, attr->shared->ds) > 0)
space_shared = TRUE;
else
space_shared = FALSE;
/* Check which version to encode attribute with */
- if(attr->shared->encoding != H5T_CSET_ASCII)
- version = H5O_ATTR_VERSION_3; /* Write version which includes the character encoding */
- else if(type_shared || space_shared)
- version = H5O_ATTR_VERSION_2; /* Write out version with flag for indicating shared datatype or dataspace */
+ if (attr->shared->encoding != H5T_CSET_ASCII)
+ version = H5O_ATTR_VERSION_3; /* Write version which includes the character encoding */
+ else if (type_shared || space_shared)
+ version =
+ H5O_ATTR_VERSION_2; /* Write out version with flag for indicating shared datatype or dataspace */
else
- version = H5O_ATTR_VERSION_1; /* Write out basic version */
+ version = H5O_ATTR_VERSION_1; /* Write out basic version */
/* Upgrade to the version indicated by the file's low bound if higher */
version = (uint8_t)MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]);
/* Version bounds check */
- if(version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(f)])
+ if (version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(f)])
HGOTO_ERROR(H5E_ATTR, H5E_BADRANGE, FAIL, "attribute version out of bounds")
/* Set the message version */
@@ -2030,7 +1992,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__set_version() */
-
/*-------------------------------------------------------------------------
* Function: H5A__attr_copy_file
*
@@ -2053,20 +2014,20 @@ done:
*/
H5A_t *
H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_size,
- H5O_copy_t H5_ATTR_NDEBUG_UNUSED *cpy_info)
+ H5O_copy_t H5_ATTR_NDEBUG_UNUSED *cpy_info)
{
- H5A_t *attr_dst = NULL; /* Destination attribute */
- hid_t tid_src = -1; /* Datatype ID for source datatype */
- hid_t tid_dst = -1; /* Datatype ID for destination datatype */
- hid_t tid_mem = -1; /* Datatype ID for memory datatype */
- void *buf = NULL; /* Buffer for copying data */
- void *reclaim_buf = NULL; /* Buffer for reclaiming data */
- void *bkg_buf = NULL; /* Background buffer */
- hid_t buf_sid = -1; /* ID for buffer dataspace */
- hssize_t sdst_nelmts; /* # of elements in destination attribute (signed) */
- size_t dst_nelmts; /* # of elements in destination attribute */
- size_t dst_dt_size; /* Size of destination attribute datatype */
- H5A_t *ret_value = NULL; /* Return value */
+ H5A_t * attr_dst = NULL; /* Destination attribute */
+ hid_t tid_src = -1; /* Datatype ID for source datatype */
+ hid_t tid_dst = -1; /* Datatype ID for destination datatype */
+ hid_t tid_mem = -1; /* Datatype ID for memory datatype */
+ void * buf = NULL; /* Buffer for copying data */
+ void * reclaim_buf = NULL; /* Buffer for reclaiming data */
+ void * bkg_buf = NULL; /* Background buffer */
+ hid_t buf_sid = -1; /* ID for buffer dataspace */
+ hssize_t sdst_nelmts; /* # of elements in destination attribute (signed) */
+ size_t dst_nelmts; /* # of elements in destination attribute */
+ size_t dst_dt_size; /* Size of destination attribute datatype */
+ H5A_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2077,13 +2038,13 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
HDassert(!cpy_info->copy_without_attr);
/* Allocate space for the destination message */
- if(NULL == (attr_dst = H5FL_CALLOC(H5A_t)))
+ if (NULL == (attr_dst = H5FL_CALLOC(H5A_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the top level of the attribute */
*attr_dst = *attr_src;
- if(NULL == (attr_dst->shared = H5FL_CALLOC(H5A_shared_t)))
+ if (NULL == (attr_dst->shared = H5FL_CALLOC(H5A_shared_t)))
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared attr structure")
/* Don't have an opened group location for copy */
@@ -2102,19 +2063,19 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
/* Copy attribute's datatype */
/* If source is named, we will keep dst as named, but we will not actually
* copy the target and update the message until post copy */
- if(NULL == (attr_dst->shared->dt = H5T_copy(attr_src->shared->dt, H5T_COPY_ALL)))
+ if (NULL == (attr_dst->shared->dt = H5T_copy(attr_src->shared->dt, H5T_COPY_ALL)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "cannot copy datatype")
/* Set the location of the destination datatype */
- if(H5T_set_loc(attr_dst->shared->dt, H5F_VOL_OBJ(file_dst), H5T_LOC_DISK) < 0)
+ if (H5T_set_loc(attr_dst->shared->dt, H5F_VOL_OBJ(file_dst), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "cannot mark datatype on disk")
- if(!H5T_is_named(attr_src->shared->dt)) {
+ if (!H5T_is_named(attr_src->shared->dt)) {
/* If the datatype is not named, it may have been shared in the
* source file's heap. Un-share it for now. We'll try to shared
* it in the destination file below.
*/
- if(H5O_msg_reset_share(H5O_DTYPE_ID, attr_dst->shared->dt) < 0)
+ if (H5O_msg_reset_share(H5O_DTYPE_ID, attr_dst->shared->dt) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to reset datatype sharing")
}
@@ -2126,16 +2087,16 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
/* Reset the dataspace's sharing in the source file before trying to share
* it in the destination.
*/
- if(H5O_msg_reset_share(H5O_SDSPACE_ID, attr_dst->shared->ds) < 0)
+ if (H5O_msg_reset_share(H5O_SDSPACE_ID, attr_dst->shared->ds) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to reset dataspace sharing")
/* Simulate trying to share both the datatype and dataset, to determine the
* final size of the messages. This does nothing if the datatype is
* committed or sharing is disabled.
*/
- if(H5SM_try_share(file_dst, NULL, H5SM_DEFER, H5O_DTYPE_ID, attr_dst->shared->dt, NULL) < 0)
+ if (H5SM_try_share(file_dst, NULL, H5SM_DEFER, H5O_DTYPE_ID, attr_dst->shared->dt, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute datatype")
- if(H5SM_try_share(file_dst, NULL, H5SM_DEFER, H5O_SDSPACE_ID, attr_dst->shared->ds, NULL) < 0)
+ if (H5SM_try_share(file_dst, NULL, H5SM_DEFER, H5O_SDSPACE_ID, attr_dst->shared->ds, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute dataspace")
/* Compute the sizes of the datatype and dataspace. This is their raw
@@ -2148,70 +2109,74 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
/* Check whether to recompute the size of the attribute */
/* (happens when the datatype or dataspace changes sharing status) */
- if(attr_dst->shared->dt_size != attr_src->shared->dt_size || attr_dst->shared->ds_size != attr_src->shared->ds_size)
+ if (attr_dst->shared->dt_size != attr_src->shared->dt_size ||
+ attr_dst->shared->ds_size != attr_src->shared->ds_size)
*recompute_size = TRUE;
/* Get # of elements for destination attribute's dataspace */
- if((sdst_nelmts = H5S_GET_EXTENT_NPOINTS(attr_dst->shared->ds)) < 0)
+ if ((sdst_nelmts = H5S_GET_EXTENT_NPOINTS(attr_dst->shared->ds)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, NULL, "dataspace is invalid")
H5_CHECKED_ASSIGN(dst_nelmts, size_t, sdst_nelmts, hssize_t);
/* Get size of destination attribute's datatype */
- if(0 == (dst_dt_size = H5T_get_size(attr_dst->shared->dt)))
+ if (0 == (dst_dt_size = H5T_get_size(attr_dst->shared->dt)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size")
/* Compute the size of the data */
- attr_dst->shared->data_size = dst_nelmts * dst_dt_size;
+ attr_dst->shared->data_size = dst_nelmts * dst_dt_size;
/* Copy (& convert) the data, if necessary */
- if(attr_src->shared->data) {
- if(NULL == (attr_dst->shared->data = H5FL_BLK_MALLOC(attr_buf, attr_dst->shared->data_size)))
+ if (attr_src->shared->data) {
+ if (NULL == (attr_dst->shared->data = H5FL_BLK_MALLOC(attr_buf, attr_dst->shared->data_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Check if we need to convert data */
- if(H5T_detect_class(attr_src->shared->dt, H5T_VLEN, FALSE) > 0) {
- H5T_path_t *tpath_src_mem, *tpath_mem_dst; /* Datatype conversion paths */
- H5T_t *dt_mem; /* Memory datatype */
- size_t src_dt_size; /* Source datatype size */
- size_t tmp_dt_size; /* Temp. datatype size */
- size_t max_dt_size; /* Max atatype size */
- H5S_t *buf_space; /* Dataspace describing buffer */
- hsize_t buf_dim; /* Dimension for buffer */
- size_t nelmts; /* Number of elements in buffer */
- size_t buf_size; /* Size of copy buffer */
+ if (H5T_detect_class(attr_src->shared->dt, H5T_VLEN, FALSE) > 0) {
+ H5T_path_t *tpath_src_mem, *tpath_mem_dst; /* Datatype conversion paths */
+ H5T_t * dt_mem; /* Memory datatype */
+ size_t src_dt_size; /* Source datatype size */
+ size_t tmp_dt_size; /* Temp. datatype size */
+ size_t max_dt_size; /* Max atatype size */
+ H5S_t * buf_space; /* Dataspace describing buffer */
+ hsize_t buf_dim; /* Dimension for buffer */
+ size_t nelmts; /* Number of elements in buffer */
+ size_t buf_size; /* Size of copy buffer */
/* Create datatype ID for src datatype */
- if((tid_src = H5I_register(H5I_DATATYPE, attr_src->shared->dt, FALSE)) < 0)
+ if ((tid_src = H5I_register(H5I_DATATYPE, attr_src->shared->dt, FALSE)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register source file datatype")
/* create a memory copy of the variable-length datatype */
- if(NULL == (dt_mem = H5T_copy(attr_src->shared->dt, H5T_COPY_TRANSIENT)))
+ if (NULL == (dt_mem = H5T_copy(attr_src->shared->dt, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy")
- if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0)
+ if ((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register memory datatype")
/* create variable-length datatype at the destinaton file */
- if((tid_dst = H5I_register(H5I_DATATYPE, attr_dst->shared->dt, FALSE)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register destination file datatype")
+ if ((tid_dst = H5I_register(H5I_DATATYPE, attr_dst->shared->dt, FALSE)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL,
+ "unable to register destination file datatype")
/* Set up the conversion functions */
- if(NULL == (tpath_src_mem = H5T_path_find(attr_src->shared->dt, dt_mem)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to convert between src and mem datatypes")
- if(NULL == (tpath_mem_dst = H5T_path_find(dt_mem, attr_dst->shared->dt)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to convert between mem and dst datatypes")
+ if (NULL == (tpath_src_mem = H5T_path_find(attr_src->shared->dt, dt_mem)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL,
+ "unable to convert between src and mem datatypes")
+ if (NULL == (tpath_mem_dst = H5T_path_find(dt_mem, attr_dst->shared->dt)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL,
+ "unable to convert between mem and dst datatypes")
/* Determine largest datatype size */
- if(0 == (src_dt_size = H5T_get_size(attr_src->shared->dt)))
+ if (0 == (src_dt_size = H5T_get_size(attr_src->shared->dt)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size")
- if(0 == (tmp_dt_size = H5T_get_size(dt_mem)))
+ if (0 == (tmp_dt_size = H5T_get_size(dt_mem)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size")
max_dt_size = MAX(src_dt_size, tmp_dt_size);
- if(0 == (tmp_dt_size = H5T_get_size(attr_dst->shared->dt)))
+ if (0 == (tmp_dt_size = H5T_get_size(attr_dst->shared->dt)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size")
max_dt_size = MAX(max_dt_size, tmp_dt_size);
/* Set number of whole elements that fit in buffer */
- if(0 == (nelmts = attr_src->shared->data_size / src_dt_size))
+ if (0 == (nelmts = attr_src->shared->data_size / src_dt_size))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "element size too large")
/* Set up number of bytes to copy, and initial buffer size */
@@ -2221,99 +2186,98 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s
buf_dim = nelmts;
/* Create the space and set the initial extent */
- if(NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL)))
+ if (NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "can't create simple dataspace")
/* Atomize */
- if((buf_sid = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) {
+ if ((buf_sid = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) {
H5S_close(buf_space);
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, NULL, "unable to register dataspace ID")
} /* end if */
/* Allocate memory for recclaim buf */
- if(NULL == (reclaim_buf = H5FL_BLK_MALLOC(attr_buf, buf_size)))
+ if (NULL == (reclaim_buf = H5FL_BLK_MALLOC(attr_buf, buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation NULLed for raw data chunk")
/* Allocate memory for copying the chunk */
- if(NULL == (buf = H5FL_BLK_MALLOC(attr_buf, buf_size)))
+ if (NULL == (buf = H5FL_BLK_MALLOC(attr_buf, buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation NULLed for raw data chunk")
H5MM_memcpy(buf, attr_src->shared->data, attr_src->shared->data_size);
/* Allocate background memory */
- if(H5T_path_bkg(tpath_src_mem) || H5T_path_bkg(tpath_mem_dst))
- if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size)))
+ if (H5T_path_bkg(tpath_src_mem) || H5T_path_bkg(tpath_mem_dst))
+ if (NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "memory allocation failed")
/* Convert from source file to memory */
- if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg_buf) < 0)
+ if (H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg_buf) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "datatype conversion NULLed")
H5MM_memcpy(reclaim_buf, buf, buf_size);
/* Set background buffer to all zeros */
- if(bkg_buf)
+ if (bkg_buf)
HDmemset(bkg_buf, 0, buf_size);
/* Convert from memory to destination file */
- if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg_buf) < 0)
+ if (H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg_buf) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "datatype conversion NULLed")
H5MM_memcpy(attr_dst->shared->data, buf, attr_dst->shared->data_size);
- if(H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
+ if (H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, NULL, "unable to reclaim variable-length data")
- } /* end if */
+ } /* end if */
else {
HDassert(attr_dst->shared->data_size == attr_src->shared->data_size);
H5MM_memcpy(attr_dst->shared->data, attr_src->shared->data, attr_src->shared->data_size);
} /* end else */
- } /* end if(attr_src->shared->data) */
+ } /* end if(attr_src->shared->data) */
/* Copy the creation order */
attr_dst->shared->crt_idx = attr_src->shared->crt_idx;
/* Recompute the version to encode the destination attribute */
- if(H5A__set_version(file_dst, attr_dst) < 0)
+ if (H5A__set_version(file_dst, attr_dst) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, NULL, "unable to update attribute version")
/* Recompute the destination attribute's size, if it's a different version */
- if(attr_src->shared->version != attr_dst->shared->version)
+ if (attr_src->shared->version != attr_dst->shared->version)
*recompute_size = TRUE;
/* Set return value */
ret_value = attr_dst;
done:
- if(buf_sid > 0 && H5I_dec_ref(buf_sid) < 0)
+ if (buf_sid > 0 && H5I_dec_ref(buf_sid) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "Can't decrement temporary dataspace ID")
- if(tid_src > 0)
+ if (tid_src > 0)
/* Don't decrement ID, we want to keep underlying datatype */
- if(NULL == H5I_remove(tid_src))
+ if (NULL == H5I_remove(tid_src))
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "Can't decrement temporary datatype ID")
- if(tid_dst > 0)
+ if (tid_dst > 0)
/* Don't decrement ID, we want to keep underlying datatype */
- if(NULL == H5I_remove(tid_dst))
+ if (NULL == H5I_remove(tid_dst))
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "Can't decrement temporary datatype ID")
- if(tid_mem > 0)
+ if (tid_mem > 0)
/* Decrement the memory datatype ID, it's transient */
- if(H5I_dec_ref(tid_mem) < 0)
+ if (H5I_dec_ref(tid_mem) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "Can't decrement temporary datatype ID")
- if(buf)
+ if (buf)
buf = H5FL_BLK_FREE(attr_buf, buf);
- if(reclaim_buf)
+ if (reclaim_buf)
reclaim_buf = H5FL_BLK_FREE(attr_buf, reclaim_buf);
- if(bkg_buf)
+ if (bkg_buf)
bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf);
/* Release destination attribute information on failure */
- if(!ret_value && attr_dst && H5A__close(attr_dst) < 0)
+ if (!ret_value && attr_dst && H5A__close(attr_dst) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__attr_copy_file() */
-
/*-------------------------------------------------------------------------
* Function: H5A__attr_post_copy_file
*
@@ -2331,11 +2295,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src,
- H5O_loc_t *dst_oloc, const H5A_t *attr_dst, H5O_copy_t *cpy_info)
+H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, H5O_loc_t *dst_oloc,
+ const H5A_t *attr_dst, H5O_copy_t *cpy_info)
{
- H5F_t *file_src, *file_dst;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *file_src, *file_dst;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2352,8 +2316,8 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src,
HDassert(file_dst);
if (H5T_is_named(attr_src->shared->dt)) {
- H5O_loc_t *src_oloc_dt; /* Pointer to source datatype's object location */
- H5O_loc_t *dst_oloc_dt; /* Pointer to dest. datatype's object location */
+ H5O_loc_t *src_oloc_dt; /* Pointer to source datatype's object location */
+ H5O_loc_t *dst_oloc_dt; /* Pointer to dest. datatype's object location */
/* Get group entries for source & destination */
src_oloc_dt = H5T_oloc(attr_src->shared->dt);
@@ -2366,7 +2330,7 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src,
dst_oloc_dt->file = file_dst;
/* Copy the shared object from source to destination */
- if(H5O_copy_header_map(src_oloc_dt, dst_oloc_dt, cpy_info, FALSE, NULL, NULL) < 0)
+ if (H5O_copy_header_map(src_oloc_dt, dst_oloc_dt, cpy_info, FALSE, NULL, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
/* Update shared message info from named datatype info */
@@ -2376,25 +2340,26 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src,
/* Try to share both the datatype and dataset. This does nothing if the
* datatype is committed or sharing is disabled.
*/
- if(H5SM_try_share(file_dst, NULL, H5SM_WAS_DEFERRED, H5O_DTYPE_ID, attr_dst->shared->dt, NULL) < 0)
+ if (H5SM_try_share(file_dst, NULL, H5SM_WAS_DEFERRED, H5O_DTYPE_ID, attr_dst->shared->dt, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "can't share attribute datatype")
- if(H5SM_try_share(file_dst, NULL, H5SM_WAS_DEFERRED, H5O_SDSPACE_ID, attr_dst->shared->ds, NULL) < 0)
+ if (H5SM_try_share(file_dst, NULL, H5SM_WAS_DEFERRED, H5O_SDSPACE_ID, attr_dst->shared->ds, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "can't share attribute dataspace")
/* Only need to fix reference attribute with real data being copied to
* another file.
*/
- if((NULL != attr_dst->shared->data) && (H5T_get_class(attr_dst->shared->dt, FALSE) == H5T_REFERENCE) ) {
+ if ((NULL != attr_dst->shared->data) && (H5T_get_class(attr_dst->shared->dt, FALSE) == H5T_REFERENCE)) {
/* copy object pointed by reference. The current implementation does not
* deal with nested reference such as reference in a compound structure
*/
/* Check for expanding references */
- if(cpy_info->expand_ref) {
+ if (cpy_info->expand_ref) {
/* Copy objects referenced in source buffer to destination file and set destination elements */
- if(H5O_copy_expand_ref(file_src, H5I_INVALID_HID, attr_src->shared->dt,
- attr_src->shared->data, attr_src->shared->data_size, file_dst, attr_dst->shared->data, cpy_info) < 0)
+ if (H5O_copy_expand_ref(file_src, H5I_INVALID_HID, attr_src->shared->dt, attr_src->shared->data,
+ attr_src->shared->data_size, file_dst, attr_dst->shared->data,
+ cpy_info) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "unable to copy reference attribute")
} /* end if */
else
@@ -2406,7 +2371,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__attr_post_copy_file() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_post_copy_file_cb
*
@@ -2423,9 +2387,9 @@ done:
static herr_t
H5A__dense_post_copy_file_cb(const H5A_t *attr_src, void *_udata)
{
- H5A_dense_file_cp_ud_t *udata = (H5A_dense_file_cp_ud_t *)_udata;
- H5A_t *attr_dst = NULL;
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ H5A_dense_file_cp_ud_t *udata = (H5A_dense_file_cp_ud_t *)_udata;
+ H5A_t * attr_dst = NULL;
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -2436,34 +2400,34 @@ H5A__dense_post_copy_file_cb(const H5A_t *attr_src, void *_udata)
HDassert(udata->file);
HDassert(udata->cpy_info);
- if(NULL == (attr_dst = H5A__attr_copy_file(attr_src, udata->file, udata->recompute_size, udata->cpy_info)))
+ if (NULL ==
+ (attr_dst = H5A__attr_copy_file(attr_src, udata->file, udata->recompute_size, udata->cpy_info)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute")
- if(H5A__attr_post_copy_file(udata->oloc_src, attr_src, udata->oloc_dst, attr_dst, udata->cpy_info) < 0)
+ if (H5A__attr_post_copy_file(udata->oloc_src, attr_src, udata->oloc_dst, attr_dst, udata->cpy_info) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute")
/* Reset shared location information */
- if(H5O_msg_reset_share(H5O_ATTR_ID, attr_dst) < 0)
+ if (H5O_msg_reset_share(H5O_ATTR_ID, attr_dst) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to reset attribute sharing")
/* Set COPIED tag for destination object's metadata */
H5_BEGIN_TAG(H5AC__COPIED_TAG);
/* Insert attribute into dense storage */
- if(H5A__dense_insert(udata->file, udata->ainfo, attr_dst) < 0)
+ if (H5A__dense_insert(udata->file, udata->ainfo, attr_dst) < 0)
HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to add to dense storage")
/* Reset metadata tag */
H5_END_TAG
done:
- if(attr_dst && H5A__close(attr_dst) < 0)
+ if (attr_dst && H5A__close(attr_dst) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close destination attribute")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_post_copy_file_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5A__dense_post_copy_file_all
*
@@ -2477,13 +2441,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5A__dense_post_copy_file_all(const H5O_loc_t *src_oloc, const H5O_ainfo_t *ainfo_src,
- H5O_loc_t *dst_oloc, H5O_ainfo_t *ainfo_dst, H5O_copy_t *cpy_info)
+H5A__dense_post_copy_file_all(const H5O_loc_t *src_oloc, const H5O_ainfo_t *ainfo_src, H5O_loc_t *dst_oloc,
+ H5O_ainfo_t *ainfo_dst, H5O_copy_t *cpy_info)
{
- H5A_dense_file_cp_ud_t udata; /* User data for iteration callback */
- H5A_attr_iter_op_t attr_op; /* Attribute operator */
- hbool_t recompute_size = FALSE; /* recompute the size */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5A_dense_file_cp_ud_t udata; /* User data for iteration callback */
+ H5A_attr_iter_op_t attr_op; /* Attribute operator */
+ hbool_t recompute_size = FALSE; /* recompute the size */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2491,25 +2455,24 @@ H5A__dense_post_copy_file_all(const H5O_loc_t *src_oloc, const H5O_ainfo_t *ainf
HDassert(ainfo_src);
HDassert(ainfo_dst);
- udata.ainfo = ainfo_dst; /* Destination dense information */
- udata.file = dst_oloc->file; /* Destination file */
- udata.recompute_size = &recompute_size; /* Flag to indicate if size changed */
- udata.cpy_info = cpy_info; /* Information on copying options */
- udata.oloc_src = src_oloc;
- udata.oloc_dst = dst_oloc;
+ udata.ainfo = ainfo_dst; /* Destination dense information */
+ udata.file = dst_oloc->file; /* Destination file */
+ udata.recompute_size = &recompute_size; /* Flag to indicate if size changed */
+ udata.cpy_info = cpy_info; /* Information on copying options */
+ udata.oloc_src = src_oloc;
+ udata.oloc_dst = dst_oloc;
- attr_op.op_type = H5A_ATTR_OP_LIB;
+ attr_op.op_type = H5A_ATTR_OP_LIB;
attr_op.u.lib_op = H5A__dense_post_copy_file_cb;
- if(H5A__dense_iterate(src_oloc->file, (hid_t)0, ainfo_src, H5_INDEX_NAME,
- H5_ITER_NATIVE, (hsize_t)0, NULL, &attr_op, &udata) < 0)
+ if (H5A__dense_iterate(src_oloc->file, (hid_t)0, ainfo_src, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0,
+ NULL, &attr_op, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_post_copy_file_all */
-
/*-------------------------------------------------------------------------
* Function: H5A__rename_by_name
*
@@ -2523,43 +2486,41 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_name,
- const char *new_attr_name)
+H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_name, const char *new_attr_name)
{
- H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
- hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Avoid thrashing things if the names are the same */
- if(HDstrcmp(old_attr_name, new_attr_name)) {
+ if (HDstrcmp(old_attr_name, new_attr_name)) {
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
obj_loc.path = &obj_path;
H5G_loc_reset(&obj_loc);
/* Find the object's location */
- if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0)
+ if (H5G_loc_find(&loc, obj_name, &obj_loc /*out*/) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
loc_found = TRUE;
/* Call attribute rename routine */
- if(H5O__attr_rename(obj_loc.oloc, old_attr_name, new_attr_name) < 0)
+ if (H5O__attr_rename(obj_loc.oloc, old_attr_name, new_attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
} /* end if */
done:
/* Release resources */
- if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ if (loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__rename_by_name() */
-
/*-------------------------------------------------------------------------
* Function: H5A__iterate_common
*
@@ -2573,28 +2534,27 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t *idx, H5A_attr_iter_op_t *attr_op, void *op_data)
+H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx,
+ H5A_attr_iter_op_t *attr_op, void *op_data)
{
- hsize_t start_idx; /* Index of attribute to start iterating at */
- hsize_t last_attr; /* Index of last attribute examined */
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t start_idx; /* Index of attribute to start iterating at */
+ hsize_t last_attr; /* Index of last attribute examined */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Call attribute iteration routine */
last_attr = start_idx = (idx ? *idx : 0);
- if((ret_value = H5O__attr_iterate(loc_id, idx_type, order, start_idx, &last_attr, attr_op, op_data)) < 0)
+ if ((ret_value = H5O__attr_iterate(loc_id, idx_type, order, start_idx, &last_attr, attr_op, op_data)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
/* Set the last attribute information */
- if(idx)
+ if (idx)
*idx = last_attr;
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__iterate_common() */
-
/*-------------------------------------------------------------------------
* Function: H5A__iterate
*
@@ -2606,22 +2566,22 @@ H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
*/
herr_t
H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t *idx, H5A_operator2_t op, void *op_data)
+ hsize_t *idx, H5A_operator2_t op, void *op_data)
{
- H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
- hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
- hid_t obj_loc_id = H5I_INVALID_HID; /* ID for object located */
- H5A_attr_iter_op_t attr_op; /* Attribute operator */
- void *temp_obj = NULL;
- H5I_type_t obj_type;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
+ hid_t obj_loc_id = H5I_INVALID_HID; /* ID for object located */
+ H5A_attr_iter_op_t attr_op; /* Attribute operator */
+ void * temp_obj = NULL;
+ H5I_type_t obj_type;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Build attribute operator info */
- attr_op.op_type = H5A_ATTR_OP_APP2;
+ attr_op.op_type = H5A_ATTR_OP_APP2;
attr_op.u.app_op2 = op;
/* Set up opened group location to fill in */
@@ -2630,36 +2590,36 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5
H5G_loc_reset(&obj_loc);
/* Find the object's location */
- if(H5G_loc_find(loc, obj_name, &obj_loc) < 0)
+ if (H5G_loc_find(loc, obj_name, &obj_loc) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found");
loc_found = TRUE;
/* Open the object */
- if(NULL == (temp_obj = H5O_open_by_loc(&obj_loc, &obj_type)))
+ if (NULL == (temp_obj = H5O_open_by_loc(&obj_loc, &obj_type)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object");
/* Get an ID for the object */
- if((obj_loc_id = H5VL_wrap_register(obj_type, temp_obj, TRUE)) < 0)
+ if ((obj_loc_id = H5VL_wrap_register(obj_type, temp_obj, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype");
/* Call internal attribute iteration routine */
- if((ret_value = H5A__iterate_common(obj_loc_id, idx_type, order, idx, &attr_op, op_data)) < 0)
+ if ((ret_value = H5A__iterate_common(obj_loc_id, idx_type, order, idx, &attr_op, op_data)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes")
done:
/* Release resources */
- if(obj_loc_id != H5I_INVALID_HID) {
- if(H5I_dec_app_ref(obj_loc_id) < 0)
+ if (obj_loc_id != H5I_INVALID_HID) {
+ if (H5I_dec_app_ref(obj_loc_id) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object");
} /* end if */
- else if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ else if (loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location");
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__iterate() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
-
+
/*-------------------------------------------------------------------------
* Function: H5A__iterate_old
*
@@ -2673,35 +2633,34 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op,
- void *op_data)
+H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data)
{
- H5A_attr_iter_op_t attr_op; /* Attribute operator */
- hsize_t idx; /* Index of attribute to start iterating at */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5A_attr_iter_op_t attr_op; /* Attribute operator */
+ hsize_t idx; /* Index of attribute to start iterating at */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_NOERR
/* Build attribute operator info */
- attr_op.op_type = H5A_ATTR_OP_APP;
+ attr_op.op_type = H5A_ATTR_OP_APP;
attr_op.u.app_op = op;
/* Set up index */
idx = (hsize_t)(attr_num ? *attr_num : 0);
/* Call internal attribute iteration routine */
- if((ret_value = H5A__iterate_common(loc_id, H5_INDEX_CRT_ORDER, H5_ITER_INC, &idx, &attr_op, op_data)) < 0)
+ if ((ret_value = H5A__iterate_common(loc_id, H5_INDEX_CRT_ORDER, H5_ITER_INC, &idx, &attr_op, op_data)) <
+ 0)
HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
/* Translate hsize_t index value to legacy unsigned index value*/
- if(attr_num)
+ if (attr_num)
*attr_num = (unsigned)idx;
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__iterate_old() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/*-------------------------------------------------------------------------
* Function: H5A__delete_by_name
*
@@ -2717,11 +2676,11 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op,
herr_t
H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name)
{
- H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
- hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2731,23 +2690,22 @@ H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr
H5G_loc_reset(&obj_loc);
/* Find the object's location */
- if(H5G_loc_find(loc, obj_name, &obj_loc/*out*/) < 0)
+ if (H5G_loc_find(loc, obj_name, &obj_loc /*out*/) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
loc_found = TRUE;
/* Delete the attribute from the location */
- if(H5O__attr_remove(obj_loc.oloc, attr_name) < 0)
+ if (H5O__attr_remove(obj_loc.oloc, attr_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
/* Release resources */
- if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ if (loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__delete_by_name() */
-
/*-------------------------------------------------------------------------
* Function: H5A__delete_by_idx
*
@@ -2761,14 +2719,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n)
+H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n)
{
- H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
- hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2778,19 +2736,18 @@ H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ty
H5G_loc_reset(&obj_loc);
/* Find the object's location */
- if(H5G_loc_find(loc, obj_name, &obj_loc/*out*/) < 0)
+ if (H5G_loc_find(loc, obj_name, &obj_loc /*out*/) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
loc_found = TRUE;
/* Delete the attribute from the location */
- if(H5O__attr_remove_by_idx(obj_loc.oloc, idx_type, order, n) < 0)
+ if (H5O__attr_remove_by_idx(obj_loc.oloc, idx_type, order, n) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
/* Release resources */
- if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ if (loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__delete_by_idx() */
-
diff --git a/src/H5Amodule.h b/src/H5Amodule.h
index 6b835e1..707fc54 100644
--- a/src/H5Amodule.h
+++ b/src/H5Amodule.h
@@ -25,9 +25,8 @@
* reporting macros.
*/
#define H5A_MODULE
-#define H5_MY_PKG H5A
-#define H5_MY_PKG_ERR H5E_ATTR
-#define H5_MY_PKG_INIT YES
+#define H5_MY_PKG H5A
+#define H5_MY_PKG_ERR H5E_ATTR
+#define H5_MY_PKG_INIT YES
#endif /* _H5Amodule_H */
-
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index 39fdea3..49d86b1 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -30,72 +30,70 @@
* Define this to enable debugging.
*/
#ifdef NDEBUG
-# undef H5A_DEBUG
+#undef H5A_DEBUG
#endif
/* Get package's private header */
#include "H5Aprivate.h"
/* Other private headers needed by this file */
-#include "H5B2private.h" /* v2 B-trees */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5HFprivate.h" /* Fractal heaps */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Sprivate.h" /* Dataspace */
-#include "H5Tprivate.h" /* Datatype functions */
-
+#include "H5B2private.h" /* v2 B-trees */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5HFprivate.h" /* Fractal heaps */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Sprivate.h" /* Dataspace */
+#include "H5Tprivate.h" /* Datatype functions */
/**************************/
/* Package Private Macros */
/**************************/
/* This is the initial version, which does not have support for shared datatypes */
-#define H5O_ATTR_VERSION_1 1
+#define H5O_ATTR_VERSION_1 1
/* This version allows support for shared datatypes & dataspaces by adding a
* 'flag' byte indicating when those components are shared. This version
* also dropped the alignment on all the components.
*/
-#define H5O_ATTR_VERSION_2 2
+#define H5O_ATTR_VERSION_2 2
/* Add support for different character encodings of attribute names */
-#define H5O_ATTR_VERSION_3 3
+#define H5O_ATTR_VERSION_3 3
/* The latest version of the format. Look through the 'encode', 'decode'
* and 'size' message callbacks for places to change when updating this.
*/
#define H5O_ATTR_VERSION_LATEST H5O_ATTR_VERSION_3
-
/****************************/
/* Package Private Typedefs */
/****************************/
/* Define the shared attribute structure */
typedef struct H5A_shared_t {
- uint8_t version; /* Version to encode attribute with */
+ uint8_t version; /* Version to encode attribute with */
- char *name; /* Attribute's name */
- H5T_cset_t encoding; /* Character encoding of attribute name */
+ char * name; /* Attribute's name */
+ H5T_cset_t encoding; /* Character encoding of attribute name */
- H5T_t *dt; /* Attribute's datatype */
- size_t dt_size; /* Size of datatype on disk */
+ H5T_t *dt; /* Attribute's datatype */
+ size_t dt_size; /* Size of datatype on disk */
- H5S_t *ds; /* Attribute's dataspace */
- size_t ds_size; /* Size of dataspace on disk */
+ H5S_t *ds; /* Attribute's dataspace */
+ size_t ds_size; /* Size of dataspace on disk */
- void *data; /* Attribute data (on a temporary basis) */
- size_t data_size; /* Size of data on disk */
- H5O_msg_crt_idx_t crt_idx; /* Attribute's creation index in the object header */
- unsigned nrefs; /* Ref count for times this object is referred */
+ void * data; /* Attribute data (on a temporary basis) */
+ size_t data_size; /* Size of data on disk */
+ H5O_msg_crt_idx_t crt_idx; /* Attribute's creation index in the object header */
+ unsigned nrefs; /* Ref count for times this object is referred */
} H5A_shared_t;
/* Define the main attribute structure */
struct H5A_t {
- H5O_shared_t sh_loc; /* Shared message info (must be first) */
- H5O_loc_t oloc; /* Object location for object attribute is on */
- hbool_t obj_opened; /* Object header entry opened? */
- H5G_name_t path; /* Group hierarchy path */
- H5A_shared_t *shared; /* Shared attribute information */
+ H5O_shared_t sh_loc; /* Shared message info (must be first) */
+ H5O_loc_t oloc; /* Object location for object attribute is on */
+ hbool_t obj_opened; /* Object header entry opened? */
+ H5G_name_t path; /* Group hierarchy path */
+ H5A_shared_t *shared; /* Shared attribute information */
};
/* Typedefs for "dense" attribute storage */
@@ -104,18 +102,18 @@ struct H5A_t {
/* Typedef for native 'name' field index records in the v2 B-tree */
/* (Keep 'id' field first so generic record handling in callbacks works) */
typedef struct H5A_dense_bt2_name_rec_t {
- H5O_fheap_id_t id; /* Heap ID for attribute */
- uint8_t flags; /* Object header message flags for attribute */
- H5O_msg_crt_idx_t corder; /* 'creation order' field value */
- uint32_t hash; /* Hash of 'name' field value */
+ H5O_fheap_id_t id; /* Heap ID for attribute */
+ uint8_t flags; /* Object header message flags for attribute */
+ H5O_msg_crt_idx_t corder; /* 'creation order' field value */
+ uint32_t hash; /* Hash of 'name' field value */
} H5A_dense_bt2_name_rec_t;
/* Typedef for native 'creation order' field index records in the v2 B-tree */
/* (Keep 'id' field first so generic record handling in callbacks works) */
typedef struct H5A_dense_bt2_corder_rec_t {
- H5O_fheap_id_t id; /* Heap ID for attribute */
- uint8_t flags; /* Object header message flags for attribute */
- H5O_msg_crt_idx_t corder; /* 'creation order' field value */
+ H5O_fheap_id_t id; /* Heap ID for attribute */
+ uint8_t flags; /* Object header message flags for attribute */
+ H5O_msg_crt_idx_t corder; /* 'creation order' field value */
} H5A_dense_bt2_corder_rec_t;
/* Define the 'found' callback function pointer for matching an attribute record in a v2 B-tree */
@@ -128,15 +126,15 @@ typedef herr_t (*H5A_bt2_found_t)(const H5A_t *attr, hbool_t *took_ownership, vo
*/
typedef struct H5A_bt2_ud_common_t {
/* downward */
- H5F_t *f; /* Pointer to file that fractal heap is in */
- H5HF_t *fheap; /* Fractal heap handle */
- H5HF_t *shared_fheap; /* Fractal heap handle for shared messages */
- const char *name; /* Name of attribute to compare */
- uint32_t name_hash; /* Hash of name of attribute to compare */
- uint8_t flags; /* Flags for attribute storage location */
- H5O_msg_crt_idx_t corder; /* Creation order value of attribute to compare */
- H5A_bt2_found_t found_op; /* Callback when correct attribute is found */
- void *found_op_data; /* Callback data when correct attribute is found */
+ H5F_t * f; /* Pointer to file that fractal heap is in */
+ H5HF_t * fheap; /* Fractal heap handle */
+ H5HF_t * shared_fheap; /* Fractal heap handle for shared messages */
+ const char * name; /* Name of attribute to compare */
+ uint32_t name_hash; /* Hash of name of attribute to compare */
+ uint8_t flags; /* Flags for attribute storage location */
+ H5O_msg_crt_idx_t corder; /* Creation order value of attribute to compare */
+ H5A_bt2_found_t found_op; /* Callback when correct attribute is found */
+ void * found_op_data; /* Callback data when correct attribute is found */
} H5A_bt2_ud_common_t;
/*
@@ -145,17 +143,16 @@ typedef struct H5A_bt2_ud_common_t {
*/
typedef struct H5A_bt2_ud_ins_t {
/* downward */
- H5A_bt2_ud_common_t common; /* Common info for B-tree user data (must be first) */
- H5O_fheap_id_t id; /* Heap ID of attribute to insert */
+ H5A_bt2_ud_common_t common; /* Common info for B-tree user data (must be first) */
+ H5O_fheap_id_t id; /* Heap ID of attribute to insert */
} H5A_bt2_ud_ins_t;
/* Data structure to hold table of attributes for an object */
typedef struct {
- size_t nattrs; /* # of attributes in table */
- H5A_t **attrs; /* Pointer to array of attribute pointers */
+ size_t nattrs; /* # of attributes in table */
+ H5A_t **attrs; /* Pointer to array of attribute pointers */
} H5A_attr_table_t;
-
/*****************************/
/* Package Private Variables */
/*****************************/
@@ -175,47 +172,42 @@ H5_DLLVAR const H5B2_class_t H5A_BT2_NAME[1];
/* The v2 B-tree class for indexing 'creation order' field on attributes */
H5_DLLVAR const H5B2_class_t H5A_BT2_CORDER[1];
-
/******************************/
/* Package Private Prototypes */
/******************************/
/* Function prototypes for H5A package scope */
-H5_DLL H5A_t *H5A__create(const H5G_loc_t *loc, const char *attr_name,
- const H5T_t *type, const H5S_t *space, hid_t acpl_id);
-H5_DLL H5A_t *H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name,
- const char *attr_name, const H5T_t *type, const H5S_t *space,
- hid_t acpl_id);
+H5_DLL H5A_t *H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, const H5S_t *space,
+ hid_t acpl_id);
+H5_DLL H5A_t *H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name,
+ const H5T_t *type, const H5S_t *space, hid_t acpl_id);
H5_DLL H5A_t *H5A__open(const H5G_loc_t *loc, const char *attr_name);
-H5_DLL H5A_t *H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name,
- const char *attr_name);
-H5_DLL H5A_t *H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
+H5_DLL H5A_t *H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name);
+H5_DLL H5A_t *H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n);
H5_DLL herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr);
H5_DLL H5A_t *H5A__copy(H5A_t *new_attr, const H5A_t *old_attr);
-H5_DLL hid_t H5A__get_type(H5A_t *attr);
+H5_DLL hid_t H5A__get_type(H5A_t *attr);
H5_DLL herr_t H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo);
-H5_DLL hid_t H5A__get_create_plist(H5A_t* attr);
+H5_DLL hid_t H5A__get_create_plist(H5A_t *attr);
H5_DLL herr_t H5A__shared_free(H5A_t *attr);
H5_DLL herr_t H5A__close(H5A_t *attr);
H5_DLL herr_t H5A__close_cb(H5VL_object_t *attr_vol_obj);
H5_DLL htri_t H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo);
H5_DLL herr_t H5A__set_version(const H5F_t *f, H5A_t *attr);
H5_DLL herr_t H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_name,
- const char *new_attr_name);
-H5_DLL herr_t H5A__iterate(const H5G_loc_t *loc, const char *obj_name,H5_index_t idx_type, H5_iter_order_t order,
- hsize_t *idx, H5A_operator2_t op, void *op_data);
+ const char *new_attr_name);
+H5_DLL herr_t H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data);
#ifndef H5_NO_DEPRECATED_SYMBOLS
-H5_DLL herr_t H5A__iterate_old(hid_t loc_id, unsigned *attr_num,
- H5A_operator1_t op, void *op_data);
+H5_DLL herr_t H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-H5_DLL herr_t H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name,
- const char *attr_name);
-H5_DLL herr_t H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
-H5_DLL htri_t H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name);
-H5_DLL herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf);
-H5_DLL herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf);
+H5_DLL herr_t H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name);
+H5_DLL herr_t H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n);
+H5_DLL htri_t H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name);
+H5_DLL herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf);
+H5_DLL herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf);
H5_DLL ssize_t H5A__get_name(H5A_t *attr, size_t buf_size, char *buf);
/* Attribute "dense" storage routines */
@@ -223,52 +215,47 @@ H5_DLL herr_t H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo);
H5_DLL H5A_t *H5A__dense_open(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name);
H5_DLL herr_t H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr);
H5_DLL herr_t H5A__dense_write(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr);
-H5_DLL herr_t H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo,
- const char *old_name, const char *new_name);
-H5_DLL herr_t H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_attr,
- const H5A_attr_iter_op_t *attr_op, void *op_data);
-H5_DLL herr_t H5A__dense_remove(H5F_t *f, const H5O_ainfo_t *ainfo,
- const char *name);
-H5_DLL herr_t H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
-H5_DLL htri_t H5A__dense_exists(H5F_t *f, const H5O_ainfo_t *ainfo,
- const char *name);
+H5_DLL herr_t H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name,
+ const char *new_name);
+H5_DLL herr_t H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t skip, hsize_t *last_attr,
+ const H5A_attr_iter_op_t *attr_op, void *op_data);
+H5_DLL herr_t H5A__dense_remove(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name);
+H5_DLL herr_t H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n);
+H5_DLL htri_t H5A__dense_exists(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name);
H5_DLL herr_t H5A__dense_delete(H5F_t *f, H5O_ainfo_t *ainfo);
/* Attribute table operations */
-H5_DLL herr_t H5A__compact_build_table(H5F_t *f, H5O_t *oh, H5_index_t idx_type,
- H5_iter_order_t order, H5A_attr_table_t *atable);
-H5_DLL herr_t H5A__dense_build_table(H5F_t *f, const H5O_ainfo_t *ainfo,
- H5_index_t idx_type, H5_iter_order_t order, H5A_attr_table_t *atable);
-H5_DLL herr_t H5A__attr_iterate_table(const H5A_attr_table_t *atable,
- hsize_t skip, hsize_t *last_attr, hid_t loc_id,
- const H5A_attr_iter_op_t *attr_op, void *op_data);
+H5_DLL herr_t H5A__compact_build_table(H5F_t *f, H5O_t *oh, H5_index_t idx_type, H5_iter_order_t order,
+ H5A_attr_table_t *atable);
+H5_DLL herr_t H5A__dense_build_table(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type,
+ H5_iter_order_t order, H5A_attr_table_t *atable);
+H5_DLL herr_t H5A__attr_iterate_table(const H5A_attr_table_t *atable, hsize_t skip, hsize_t *last_attr,
+ hid_t loc_id, const H5A_attr_iter_op_t *attr_op, void *op_data);
H5_DLL herr_t H5A__attr_release_table(H5A_attr_table_t *atable);
/* Attribute operations */
H5_DLL herr_t H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr);
H5_DLL H5A_t *H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name);
-H5_DLL H5A_t *H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n);
-H5_DLL herr_t H5O__attr_update_shared(H5F_t *f, H5O_t *oh, H5A_t *attr,
- H5O_shared_t *sh_mesg);
+H5_DLL H5A_t *H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n);
+H5_DLL herr_t H5O__attr_update_shared(H5F_t *f, H5O_t *oh, H5A_t *attr, H5O_shared_t *sh_mesg);
H5_DLL herr_t H5O__attr_write(const H5O_loc_t *loc, H5A_t *attr);
-H5_DLL herr_t H5O__attr_rename(const H5O_loc_t *loc, const char *old_name,
- const char *new_name);
-H5_DLL herr_t H5O__attr_iterate(hid_t loc_id, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t skip, hsize_t *last_attr,
- const H5A_attr_iter_op_t *op, void *op_data);
+H5_DLL herr_t H5O__attr_rename(const H5O_loc_t *loc, const char *old_name, const char *new_name);
+H5_DLL herr_t H5O__attr_iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip,
+ hsize_t *last_attr, const H5A_attr_iter_op_t *op, void *op_data);
H5_DLL herr_t H5O__attr_remove(const H5O_loc_t *loc, const char *name);
-H5_DLL herr_t H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n);
H5_DLL htri_t H5O__attr_exists(const H5O_loc_t *loc, const char *name);
H5_DLL H5A_t *H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_size,
- H5O_copy_t *cpy_info);
-H5_DLL herr_t H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *mesg_src,
- H5O_loc_t *dst_oloc, const H5A_t *mesg_dst, H5O_copy_t *cpy_info);
-H5_DLL herr_t H5A__dense_post_copy_file_all(const H5O_loc_t *src_oloc, const H5O_ainfo_t * ainfo_src,
- H5O_loc_t *dst_oloc, H5O_ainfo_t *ainfo_dst, H5O_copy_t *cpy_info);
+ H5O_copy_t *cpy_info);
+H5_DLL herr_t H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *mesg_src, H5O_loc_t *dst_oloc,
+ const H5A_t *mesg_dst, H5O_copy_t *cpy_info);
+H5_DLL herr_t H5A__dense_post_copy_file_all(const H5O_loc_t *src_oloc, const H5O_ainfo_t *ainfo_src,
+ H5O_loc_t *dst_oloc, H5O_ainfo_t *ainfo_dst,
+ H5O_copy_t *cpy_info);
/* Testing functions */
#ifdef H5A_TESTING
@@ -277,4 +264,3 @@ H5_DLL herr_t H5A__get_shared_rc_test(hid_t attr_id, hsize_t *ref_count);
#endif /* H5A_TESTING */
#endif /* _H5Apkg_H */
-
diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h
index b288228..4164154 100644
--- a/src/H5Aprivate.h
+++ b/src/H5Aprivate.h
@@ -21,17 +21,15 @@
#include "H5Apublic.h"
/* Private headers needed by this file */
-#include "H5Gprivate.h" /* Groups */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Sprivate.h" /* Dataspace */
-#include "H5Tprivate.h" /* Datatypes */
-
+#include "H5Gprivate.h" /* Groups */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Sprivate.h" /* Dataspace */
+#include "H5Tprivate.h" /* Datatypes */
/**************************/
/* Library Private Macros */
/**************************/
-
/****************************/
/* Library Private Typedefs */
/****************************/
@@ -45,42 +43,39 @@ typedef herr_t (*H5A_lib_iterate_t)(const H5A_t *attr, void *op_data);
/* Describe kind of callback to make for each attribute */
typedef enum H5A_attr_iter_op_type_t {
#ifndef H5_NO_DEPRECATED_SYMBOLS
- H5A_ATTR_OP_APP, /* Application callback */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
- H5A_ATTR_OP_APP2, /* Revised application callback */
- H5A_ATTR_OP_LIB /* Library internal callback */
+ H5A_ATTR_OP_APP, /* Application callback */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ H5A_ATTR_OP_APP2, /* Revised application callback */
+ H5A_ATTR_OP_LIB /* Library internal callback */
} H5A_attr_iter_op_type_t;
typedef struct H5A_attr_iter_op_t {
H5A_attr_iter_op_type_t op_type;
union {
#ifndef H5_NO_DEPRECATED_SYMBOLS
- H5A_operator1_t app_op; /* Application callback for each attribute */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
- H5A_operator2_t app_op2; /* Revised application callback for each attribute */
- H5A_lib_iterate_t lib_op; /* Library internal callback for each attribute */
+ H5A_operator1_t app_op; /* Application callback for each attribute */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ H5A_operator2_t app_op2; /* Revised application callback for each attribute */
+ H5A_lib_iterate_t lib_op; /* Library internal callback for each attribute */
} u;
} H5A_attr_iter_op_t;
-
/*****************************/
/* Library-private Variables */
/*****************************/
-
/***************************************/
/* Library-private Function Prototypes */
/***************************************/
/* General attribute routines */
-H5_DLL herr_t H5A_init(void);
+H5_DLL herr_t H5A_init(void);
H5_DLL struct H5O_loc_t *H5A_oloc(H5A_t *attr);
H5_DLL H5G_name_t *H5A_nameof(H5A_t *attr);
H5_DLL H5T_t *H5A_type(const H5A_t *attr);
-H5_DLL hid_t H5A_get_space(H5A_t *attr);
-H5_DLL herr_t H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t skip,
- hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data);
+H5_DLL hid_t H5A_get_space(H5A_t *attr);
+H5_DLL herr_t H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t skip, hsize_t *last_attr,
+ const H5A_attr_iter_op_t *attr_op, void *op_data);
#endif /* _H5Aprivate_H */
-
diff --git a/src/H5Apublic.h b/src/H5Apublic.h
index 7162f6e..89a3b04 100644
--- a/src/H5Apublic.h
+++ b/src/H5Apublic.h
@@ -18,28 +18,26 @@
#define _H5Apublic_H
/* Public headers needed by this file */
-#include "H5Ipublic.h" /* IDs */
-#include "H5Opublic.h" /* Object Headers */
-#include "H5Tpublic.h" /* Datatypes */
+#include "H5Ipublic.h" /* IDs */
+#include "H5Opublic.h" /* Object Headers */
+#include "H5Tpublic.h" /* Datatypes */
/* Information struct for attribute (for H5Aget_info/H5Aget_info_by_idx) */
typedef struct {
- hbool_t corder_valid; /* Indicate if creation order is valid */
- H5O_msg_crt_idx_t corder; /* Creation order */
- H5T_cset_t cset; /* Character set of attribute name */
- hsize_t data_size; /* Size of raw data */
+ hbool_t corder_valid; /* Indicate if creation order is valid */
+ H5O_msg_crt_idx_t corder; /* Creation order */
+ H5T_cset_t cset; /* Character set of attribute name */
+ hsize_t data_size; /* Size of raw data */
} H5A_info_t;
/* Typedef for H5Aiterate2() callbacks */
-typedef herr_t (*H5A_operator2_t)(hid_t location_id/*in*/,
- const char *attr_name/*in*/, const H5A_info_t *ainfo/*in*/, void *op_data/*in,out*/);
-
+typedef herr_t (*H5A_operator2_t)(hid_t location_id /*in*/, const char *attr_name /*in*/,
+ const H5A_info_t *ainfo /*in*/, void *op_data /*in,out*/);
/********************/
/* Public Variables */
/********************/
-
/*********************/
/* Public Prototypes */
/*********************/
@@ -47,16 +45,15 @@ typedef herr_t (*H5A_operator2_t)(hid_t location_id/*in*/,
extern "C" {
#endif
-H5_DLL hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id,
- hid_t space_id, hid_t acpl_id, hid_t aapl_id);
-H5_DLL hid_t H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
- hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id);
+H5_DLL hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id,
+ hid_t aapl_id);
+H5_DLL hid_t H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id,
+ hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id);
H5_DLL hid_t H5Aopen(hid_t obj_id, const char *attr_name, hid_t aapl_id);
-H5_DLL hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name,
- const char *attr_name, hid_t aapl_id, hid_t lapl_id);
-H5_DLL hid_t H5Aopen_by_idx(hid_t loc_id, const char *obj_name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t aapl_id,
- hid_t lapl_id);
+H5_DLL hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id,
+ hid_t lapl_id);
+H5_DLL hid_t H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n, hid_t aapl_id, hid_t lapl_id);
H5_DLL herr_t H5Awrite(hid_t attr_id, hid_t type_id, const void *buf);
H5_DLL herr_t H5Aread(hid_t attr_id, hid_t type_id, void *buf);
H5_DLL herr_t H5Aclose(hid_t attr_id);
@@ -64,32 +61,29 @@ H5_DLL hid_t H5Aget_space(hid_t attr_id);
H5_DLL hid_t H5Aget_type(hid_t attr_id);
H5_DLL hid_t H5Aget_create_plist(hid_t attr_id);
H5_DLL ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf);
-H5_DLL ssize_t H5Aget_name_by_idx(hid_t loc_id, const char *obj_name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
- char *name /*out*/, size_t size, hid_t lapl_id);
+H5_DLL ssize_t H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size,
+ hid_t lapl_id);
H5_DLL hsize_t H5Aget_storage_size(hid_t attr_id);
H5_DLL herr_t H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/);
-H5_DLL herr_t H5Aget_info_by_name(hid_t loc_id, const char *obj_name,
- const char *attr_name, H5A_info_t *ainfo /*out*/, hid_t lapl_id);
-H5_DLL herr_t H5Aget_info_by_idx(hid_t loc_id, const char *obj_name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
- H5A_info_t *ainfo /*out*/, hid_t lapl_id);
+H5_DLL herr_t H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
+ H5A_info_t *ainfo /*out*/, hid_t lapl_id);
+H5_DLL herr_t H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, H5A_info_t *ainfo /*out*/, hid_t lapl_id);
H5_DLL herr_t H5Arename(hid_t loc_id, const char *old_name, const char *new_name);
-H5_DLL herr_t H5Arename_by_name(hid_t loc_id, const char *obj_name,
- const char *old_attr_name, const char *new_attr_name, hid_t lapl_id);
-H5_DLL herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data);
+H5_DLL herr_t H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
+ const char *new_attr_name, hid_t lapl_id);
+H5_DLL herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx,
+ H5A_operator2_t op, void *op_data);
H5_DLL herr_t H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data,
- hid_t lapd_id);
+ H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data,
+ hid_t lapd_id);
H5_DLL herr_t H5Adelete(hid_t loc_id, const char *name);
-H5_DLL herr_t H5Adelete_by_name(hid_t loc_id, const char *obj_name,
- const char *attr_name, hid_t lapl_id);
-H5_DLL herr_t H5Adelete_by_idx(hid_t loc_id, const char *obj_name,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id);
+H5_DLL herr_t H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id);
+H5_DLL herr_t H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t n, hid_t lapl_id);
H5_DLL htri_t H5Aexists(hid_t obj_id, const char *attr_name);
-H5_DLL htri_t H5Aexists_by_name(hid_t obj_id, const char *obj_name,
- const char *attr_name, hid_t lapl_id);
+H5_DLL htri_t H5Aexists_by_name(hid_t obj_id, const char *obj_name, const char *attr_name, hid_t lapl_id);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -99,22 +93,18 @@ H5_DLL htri_t H5Aexists_by_name(hid_t obj_id, const char *obj_name,
/* Macros */
-
/* Typedefs */
/* Typedef for H5Aiterate1() callbacks */
-typedef herr_t (*H5A_operator1_t)(hid_t location_id/*in*/,
- const char *attr_name/*in*/, void *operator_data/*in,out*/);
-
+typedef herr_t (*H5A_operator1_t)(hid_t location_id /*in*/, const char *attr_name /*in*/,
+ void *operator_data /*in,out*/);
/* Function prototypes */
-H5_DLL hid_t H5Acreate1(hid_t loc_id, const char *name, hid_t type_id,
- hid_t space_id, hid_t acpl_id);
-H5_DLL hid_t H5Aopen_name(hid_t loc_id, const char *name);
-H5_DLL hid_t H5Aopen_idx(hid_t loc_id, unsigned idx);
-H5_DLL int H5Aget_num_attrs(hid_t loc_id);
-H5_DLL herr_t H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op,
- void *op_data);
+H5_DLL hid_t H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id);
+H5_DLL hid_t H5Aopen_name(hid_t loc_id, const char *name);
+H5_DLL hid_t H5Aopen_idx(hid_t loc_id, unsigned idx);
+H5_DLL int H5Aget_num_attrs(hid_t loc_id);
+H5_DLL herr_t H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -123,4 +113,3 @@ H5_DLL herr_t H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op,
#endif
#endif /* _H5Apublic_H */
-
diff --git a/src/H5Atest.c b/src/H5Atest.c
index 6fc1cbf..dcbb4e3 100644
--- a/src/H5Atest.c
+++ b/src/H5Atest.c
@@ -24,58 +24,49 @@
/* Module Setup */
/****************/
-#include "H5Amodule.h" /* This source code file is part of the H5A module */
-#define H5A_TESTING /* Suppress warning about H5A testing funcs */
-
+#include "H5Amodule.h" /* This source code file is part of the H5A module */
+#define H5A_TESTING /* Suppress warning about H5A testing funcs */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Apkg.h" /* Attributes */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
-#include "H5SMprivate.h" /* Shared object header messages */
-#include "H5VLprivate.h" /* Virtual Object Layer */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Apkg.h" /* Attributes */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5SMprivate.h" /* Shared object header messages */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
/*-------------------------------------------------------------------------
* Function: H5A__is_shared_test
*
@@ -91,13 +82,13 @@
htri_t
H5A__is_shared_test(hid_t attr_id)
{
- H5A_t *attr; /* Attribute object for ID */
- htri_t ret_value = FAIL; /* Return value */
+ H5A_t *attr; /* Attribute object for ID */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE
/* Check arguments */
- if(NULL == (attr = (H5A_t *)H5VL_object_verify(attr_id, H5I_ATTR)))
+ if (NULL == (attr = (H5A_t *)H5VL_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
/* Check if attribute is shared */
@@ -107,7 +98,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__is_shared_test() */
-
/*-------------------------------------------------------------------------
* Function: H5A__get_shared_rc_test
*
@@ -123,18 +113,18 @@ done:
herr_t
H5A__get_shared_rc_test(hid_t attr_id, hsize_t *ref_count)
{
- H5A_t *attr; /* Attribute object for ID */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5A_t * attr; /* Attribute object for ID */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Check arguments */
- if(NULL == (attr = (H5A_t *)H5VL_object_verify(attr_id, H5I_ATTR)))
+ if (NULL == (attr = (H5A_t *)H5VL_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
/* Push API context */
- if(H5CX_push() < 0)
+ if (H5CX_push() < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context")
api_ctx_pushed = TRUE;
@@ -142,13 +132,12 @@ H5A__get_shared_rc_test(hid_t attr_id, hsize_t *ref_count)
HDassert(H5O_msg_is_shared(H5O_ATTR_ID, attr));
/* Retrieve ref count for shared or shareable attribute */
- if(H5SM_get_refcount(attr->oloc.file, H5O_ATTR_ID, &attr->sh_loc, ref_count) < 0)
+ if (H5SM_get_refcount(attr->oloc.file, H5O_ATTR_ID, &attr->sh_loc, ref_count) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count")
done:
- if(api_ctx_pushed && H5CX_pop() < 0)
+ if (api_ctx_pushed && H5CX_pop() < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__get_shared_rc_test() */
-
diff --git a/src/H5B.c b/src/H5B.c
index 1c6ab21..c92d429 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -95,32 +95,33 @@
/* Module Setup */
/****************/
-#include "H5Bmodule.h" /* This source code file is part of the H5B module */
-
+#include "H5Bmodule.h" /* This source code file is part of the H5B module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Bpkg.h" /* B-link trees */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Bpkg.h" /* B-link trees */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
/****************/
/* Local Macros */
/****************/
-#define H5B_SIZEOF_HDR(F) \
- (H5_SIZEOF_MAGIC + /*magic number */ \
- 4 + /*type, level, num entries */ \
- 2*H5F_SIZEOF_ADDR(F)) /*left and right sibling addresses */
+#define H5B_SIZEOF_HDR(F) \
+ (H5_SIZEOF_MAGIC + /*magic number */ \
+ 4 + /*type, level, num entries */ \
+ 2 * H5F_SIZEOF_ADDR(F)) /*left and right sibling addresses */
/* Default initializer for H5B_ins_ud_t */
-#define H5B_INS_UD_T_NULL {NULL, HADDR_UNDEF, H5AC__NO_FLAGS_SET}
+#define H5B_INS_UD_T_NULL \
+ { \
+ NULL, HADDR_UNDEF, H5AC__NO_FLAGS_SET \
+ }
/******************/
/* Local Typedefs */
@@ -128,33 +129,29 @@
/* "user data" for iterating over B-tree (collects B-tree metadata size) */
typedef struct H5B_iter_ud_t {
- H5B_info_t *bt_info; /* Information about B-tree */
- void *udata; /* Node type's 'udata' for loading & iterator callback */
+ H5B_info_t *bt_info; /* Information about B-tree */
+ void * udata; /* Node type's 'udata' for loading & iterator callback */
} H5B_info_ud_t;
/* Convenience struct for the arguments needed to unprotect a b-tree after a
* call to H5B__iterate_helper() or H5B__split() */
typedef struct H5B_ins_ud_t {
- H5B_t *bt; /* B-tree */
- haddr_t addr; /* B-tree address */
- unsigned cache_flags; /* Cache flags for H5AC_unprotect() */
+ H5B_t * bt; /* B-tree */
+ haddr_t addr; /* B-tree address */
+ unsigned cache_flags; /* Cache flags for H5AC_unprotect() */
} H5B_ins_ud_t;
-
/********************/
/* Local Prototypes */
/********************/
-static H5B_ins_t H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud,
- const H5B_class_t *type, uint8_t *lt_key, hbool_t *lt_key_changed,
- uint8_t *md_key, void *udata, uint8_t *rt_key, hbool_t *rt_key_changed,
- H5B_ins_ud_t *split_bt_ud/*out*/);
-static herr_t H5B__insert_child(H5B_t *bt, unsigned *bt_flags,
- unsigned idx, haddr_t child,
- H5B_ins_t anchor, const void *md_key);
-static herr_t H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
- void *udata, H5B_ins_ud_t *split_bt_ud/*out*/);
-static H5B_t * H5B__copy(const H5B_t *old_bt);
-
+static H5B_ins_t H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8_t *lt_key,
+ hbool_t *lt_key_changed, uint8_t *md_key, void *udata, uint8_t *rt_key,
+ hbool_t *rt_key_changed, H5B_ins_ud_t *split_bt_ud /*out*/);
+static herr_t H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, haddr_t child, H5B_ins_t anchor,
+ const void *md_key);
+static herr_t H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx, void *udata,
+ H5B_ins_ud_t *split_bt_ud /*out*/);
+static H5B_t *H5B__copy(const H5B_t *old_bt);
/*********************/
/* Package Variables */
@@ -172,12 +169,10 @@ H5FL_BLK_DEFINE(native_block);
/* Declare a free list to manage the H5B_t struct */
H5FL_DEFINE(H5B_t);
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -191,8 +186,6 @@ H5FL_BLK_DEFINE_STATIC(page);
/* Declare a free list to manage the native key offset sequence information */
H5FL_SEQ_DEFINE_STATIC(size_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5B_create
*
@@ -211,11 +204,11 @@ H5FL_SEQ_DEFINE_STATIC(size_t);
*-------------------------------------------------------------------------
*/
herr_t
-H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *addr_p/*out*/)
+H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *addr_p /*out*/)
{
- H5B_t *bt = NULL;
- H5B_shared_t *shared=NULL; /* Pointer to shared B-tree info */
- herr_t ret_value = SUCCEED;
+ H5B_t * bt = NULL;
+ H5B_shared_t *shared = NULL; /* Pointer to shared B-tree info */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
@@ -229,49 +222,48 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *addr_p/*out*
/*
* Allocate file and memory data structures.
*/
- if(NULL == (bt = H5FL_MALLOC(H5B_t)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node")
+ if (NULL == (bt = H5FL_MALLOC(H5B_t)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node")
HDmemset(&bt->cache_info, 0, sizeof(H5AC_info_t));
- bt->level = 0;
- bt->left = HADDR_UNDEF;
- bt->right = HADDR_UNDEF;
+ bt->level = 0;
+ bt->left = HADDR_UNDEF;
+ bt->right = HADDR_UNDEF;
bt->nchildren = 0;
- if(NULL == (bt->rc_shared = (type->get_shared)(f, udata)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree node buffer")
+ if (NULL == (bt->rc_shared = (type->get_shared)(f, udata)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree node buffer")
H5UC_INC(bt->rc_shared);
- shared=(H5B_shared_t *)H5UC_GET_OBJ(bt->rc_shared);
+ shared = (H5B_shared_t *)H5UC_GET_OBJ(bt->rc_shared);
HDassert(shared);
- if(NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) ||
- NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node")
- if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, (hsize_t)shared->sizeof_rnode)))
+ if (NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) ||
+ NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node")
+ if (HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, (hsize_t)shared->sizeof_rnode)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "file allocation failed for B-tree root node")
/*
* Cache the new B-tree node.
*/
- if(H5AC_insert_entry(f, H5AC_BT, *addr_p, bt, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree root node to cache")
+ if (H5AC_insert_entry(f, H5AC_BT, *addr_p, bt, H5AC__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree root node to cache")
#ifdef H5B_DEBUG
H5B__assert(f, *addr_p, shared->type, udata);
#endif
done:
- if(ret_value < 0) {
- if(shared && shared->sizeof_rnode>0) {
- H5_CHECK_OVERFLOW(shared->sizeof_rnode,size_t,hsize_t);
+ if (ret_value < 0) {
+ if (shared && shared->sizeof_rnode > 0) {
+ H5_CHECK_OVERFLOW(shared->sizeof_rnode, size_t, hsize_t);
(void)H5MF_xfree(f, H5FD_MEM_BTREE, *addr_p, (hsize_t)shared->sizeof_rnode);
} /* end if */
- if(bt)
+ if (bt)
/* Destroy B-tree node */
- if(H5B__node_dest(bt) < 0)
+ if (H5B__node_dest(bt) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5B_create() */ /*lint !e818 Can't make udata a pointer to const */
+} /* end H5B_create() */ /*lint !e818 Can't make udata a pointer to const */
-
/*-------------------------------------------------------------------------
* Function: H5B_find
*
@@ -297,13 +289,13 @@ done:
htri_t
H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
{
- H5B_t *bt = NULL;
- H5UC_t *rc_shared; /* Ref-counted shared info */
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_t * bt = NULL;
+ H5UC_t * rc_shared; /* Ref-counted shared info */
+ H5B_shared_t * shared; /* Pointer to shared B-tree info */
H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
- unsigned idx = 0, lt = 0, rt; /* Final, left & right key indices */
- int cmp = 1; /* Key comparison value */
- htri_t ret_value = FAIL; /* Return value */
+ unsigned idx = 0, lt = 0, rt; /* Final, left & right key indices */
+ int cmp = 1; /* Key comparison value */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -318,7 +310,7 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
HDassert(H5F_addr_defined(addr));
/* Get shared info for B-tree */
- if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ if (NULL == (rc_shared = (type->get_shared)(f, udata)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared);
HDassert(shared);
@@ -327,47 +319,46 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
* Perform a binary search to locate the child which contains
* the thing for which we're searching.
*/
- cache_udata.f = f;
- cache_udata.type = type;
+ cache_udata.f = f;
+ cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
rt = bt->nchildren;
- while(lt < rt && cmp) {
- idx = (lt + rt) / 2;
- /* compare */
- if((cmp = (type->cmp3)(H5B_NKEY(bt, shared, idx), udata, H5B_NKEY(bt, shared, (idx + 1)))) < 0)
- rt = idx;
- else
- lt = idx + 1;
+ while (lt < rt && cmp) {
+ idx = (lt + rt) / 2;
+ /* compare */
+ if ((cmp = (type->cmp3)(H5B_NKEY(bt, shared, idx), udata, H5B_NKEY(bt, shared, (idx + 1)))) < 0)
+ rt = idx;
+ else
+ lt = idx + 1;
} /* end while */
/* Check if not found */
- if(cmp)
- HGOTO_DONE(FALSE)
+ if (cmp)
+ HGOTO_DONE(FALSE)
/*
* Follow the link to the subtree or to the data node.
*/
HDassert(idx < bt->nchildren);
- if(bt->level > 0) {
- if((ret_value = H5B_find(f, type, bt->child[idx], udata)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't lookup key in subtree")
+ if (bt->level > 0) {
+ if ((ret_value = H5B_find(f, type, bt->child[idx], udata)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't lookup key in subtree")
} /* end if */
else {
- if((ret_value = (type->found)(f, bt->child[idx], H5B_NKEY(bt, shared, idx), udata)) < 0)
+ if ((ret_value = (type->found)(f, bt->child[idx], H5B_NKEY(bt, shared, idx), udata)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't lookup key in leaf node")
} /* end else */
done:
- if(bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release node")
+ if (bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_find() */
-
/*-------------------------------------------------------------------------
* Function: H5B__split
*
@@ -390,14 +381,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
- void *udata, H5B_ins_ud_t *split_bt_ud/*out*/)
+H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx, void *udata, H5B_ins_ud_t *split_bt_ud /*out*/)
{
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_shared_t * shared; /* Pointer to shared B-tree info */
H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
- unsigned nleft, nright; /* Number of keys in left & right halves */
- double split_ratios[3]; /* B-tree split ratios */
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned nleft, nright; /* Number of keys in left & right halves */
+ double split_ratios[3]; /* B-tree split ratios */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -419,23 +409,23 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
HDassert(bt_ud->bt->nchildren == shared->two_k);
/* Get B-tree split ratios */
- if(H5CX_get_btree_split_ratios(split_ratios) < 0)
+ if (H5CX_get_btree_split_ratios(split_ratios) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree split ratios")
#ifdef H5B_DEBUG
- if(H5DEBUG(B)) {
- const char *side;
-
- if(!H5F_addr_defined(bt_ud->bt->left) && !H5F_addr_defined(bt_ud->bt->right))
- side = "ONLY";
- else if(!H5F_addr_defined(bt_ud->bt->right))
- side = "RIGHT";
- else if(!H5F_addr_defined(bt_ud->bt->left))
- side = "LEFT";
- else
- side = "MIDDLE";
- HDfprintf(H5DEBUG(B), "H5B__split: %3u {%5.3f,%5.3f,%5.3f} %6s",
- shared->two_k, split_ratios[0], split_ratios[1], split_ratios[2], side);
+ if (H5DEBUG(B)) {
+ const char *side;
+
+ if (!H5F_addr_defined(bt_ud->bt->left) && !H5F_addr_defined(bt_ud->bt->right))
+ side = "ONLY";
+ else if (!H5F_addr_defined(bt_ud->bt->right))
+ side = "RIGHT";
+ else if (!H5F_addr_defined(bt_ud->bt->left))
+ side = "LEFT";
+ else
+ side = "MIDDLE";
+ HDfprintf(H5DEBUG(B), "H5B__split: %3u {%5.3f,%5.3f,%5.3f} %6s", shared->two_k, split_ratios[0],
+ split_ratios[1], split_ratios[2], side);
}
#endif
@@ -443,37 +433,38 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
* Decide how to split the children of the old node among the old node
* and the new node.
*/
- if(!H5F_addr_defined(bt_ud->bt->right))
- nleft = (unsigned)((double)shared->two_k * split_ratios[2]); /*right*/
- else if(!H5F_addr_defined(bt_ud->bt->left))
- nleft = (unsigned)((double)shared->two_k * split_ratios[0]); /*left*/
+ if (!H5F_addr_defined(bt_ud->bt->right))
+ nleft = (unsigned)((double)shared->two_k * split_ratios[2]); /*right*/
+ else if (!H5F_addr_defined(bt_ud->bt->left))
+ nleft = (unsigned)((double)shared->two_k * split_ratios[0]); /*left*/
else
- nleft = (unsigned)((double)shared->two_k * split_ratios[1]); /*middle*/
+ nleft = (unsigned)((double)shared->two_k * split_ratios[1]); /*middle*/
/*
* Keep the new child in the same node as the child that split. This can
* result in nodes that have an unused child when data is written
* sequentially, but it simplifies stuff below.
*/
- if(idx < nleft && nleft == shared->two_k)
- --nleft;
- else if(idx >= nleft && 0 == nleft)
- nleft++;
+ if (idx < nleft && nleft == shared->two_k)
+ --nleft;
+ else if (idx >= nleft && 0 == nleft)
+ nleft++;
nright = shared->two_k - nleft;
#ifdef H5B_DEBUG
- if(H5DEBUG(B))
+ if (H5DEBUG(B))
HDfprintf(H5DEBUG(B), " split %3d/%-3d\n", nleft, nright);
#endif
/*
* Create the new B-tree node.
*/
- if(H5B_create(f, shared->type, udata, &split_bt_ud->addr/*out*/) < 0)
+ if (H5B_create(f, shared->type, udata, &split_bt_ud->addr /*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree")
- cache_udata.f = f;
- cache_udata.type = shared->type;
+ cache_udata.f = f;
+ cache_udata.type = shared->type;
cache_udata.rc_shared = bt_ud->bt->rc_shared;
- if(NULL == (split_bt_ud->bt = (H5B_t *)H5AC_protect(f, H5AC_BT, split_bt_ud->addr, &cache_udata, H5AC__NO_FLAGS_SET)))
+ if (NULL == (split_bt_ud->bt =
+ (H5B_t *)H5AC_protect(f, H5AC_BT, split_bt_ud->addr, &cache_udata, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree")
split_bt_ud->bt->level = bt_ud->bt->level;
@@ -482,12 +473,9 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
*/
split_bt_ud->cache_flags = H5AC__DIRTIED_FLAG;
- H5MM_memcpy(split_bt_ud->bt->native,
- bt_ud->bt->native + nleft * shared->type->sizeof_nkey,
- (nright + 1) * shared->type->sizeof_nkey);
- H5MM_memcpy(split_bt_ud->bt->child,
- &bt_ud->bt->child[nleft],
- nright * sizeof(haddr_t));
+ H5MM_memcpy(split_bt_ud->bt->native, bt_ud->bt->native + nleft * shared->type->sizeof_nkey,
+ (nright + 1) * shared->type->sizeof_nkey);
+ H5MM_memcpy(split_bt_ud->bt->child, &bt_ud->bt->child[nleft], nright * sizeof(haddr_t));
split_bt_ud->bt->nchildren = nright;
@@ -500,18 +488,19 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
/*
* Update other sibling pointers.
*/
- split_bt_ud->bt->left = bt_ud->addr;
+ split_bt_ud->bt->left = bt_ud->addr;
split_bt_ud->bt->right = bt_ud->bt->right;
- if(H5F_addr_defined(bt_ud->bt->right)) {
- H5B_t *tmp_bt;
+ if (H5F_addr_defined(bt_ud->bt->right)) {
+ H5B_t *tmp_bt;
- if(NULL == (tmp_bt = (H5B_t *)H5AC_protect(f, H5AC_BT, bt_ud->bt->right, &cache_udata, H5AC__NO_FLAGS_SET)))
+ if (NULL ==
+ (tmp_bt = (H5B_t *)H5AC_protect(f, H5AC_BT, bt_ud->bt->right, &cache_udata, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load right sibling")
tmp_bt->left = split_bt_ud->addr;
- if(H5AC_unprotect(f, H5AC_BT, bt_ud->bt->right, tmp_bt, H5AC__DIRTIED_FLAG) < 0)
+ if (H5AC_unprotect(f, H5AC_BT, bt_ud->bt->right, tmp_bt, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
} /* end if */
@@ -519,18 +508,18 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
HDassert(bt_ud->cache_flags & H5AC__DIRTIED_FLAG);
done:
- if(ret_value < 0) {
- if(split_bt_ud->bt && H5AC_unprotect(f, H5AC_BT, split_bt_ud->addr, split_bt_ud->bt, split_bt_ud->cache_flags) < 0)
+ if (ret_value < 0) {
+ if (split_bt_ud->bt &&
+ H5AC_unprotect(f, H5AC_BT, split_bt_ud->addr, split_bt_ud->bt, split_bt_ud->cache_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
- split_bt_ud->bt = NULL;
- split_bt_ud->addr = HADDR_UNDEF;
+ split_bt_ud->bt = NULL;
+ split_bt_ud->addr = HADDR_UNDEF;
split_bt_ud->cache_flags = H5AC__NO_FLAGS_SET;
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B__split() */
-
/*-------------------------------------------------------------------------
* Function: H5B_insert
*
@@ -549,22 +538,22 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
/*
* These are defined this way to satisfy alignment constraints.
*/
- uint64_t _lt_key[128], _md_key[128], _rt_key[128];
- uint8_t *lt_key=(uint8_t*)_lt_key;
- uint8_t *md_key=(uint8_t*)_md_key;
- uint8_t *rt_key=(uint8_t*)_rt_key;
-
- hbool_t lt_key_changed = FALSE, rt_key_changed = FALSE;
- haddr_t old_root_addr = HADDR_UNDEF;
- unsigned level;
- H5B_ins_ud_t bt_ud = H5B_INS_UD_T_NULL; /* (Old) root node */
- H5B_ins_ud_t split_bt_ud = H5B_INS_UD_T_NULL; /* Split B-tree node */
- H5B_t *new_root_bt = NULL; /* New root node */
- H5UC_t *rc_shared; /* Ref-counted shared info */
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
- H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
- H5B_ins_t my_ins = H5B_INS_ERROR;
- herr_t ret_value = SUCCEED;
+ uint64_t _lt_key[128], _md_key[128], _rt_key[128];
+ uint8_t *lt_key = (uint8_t *)_lt_key;
+ uint8_t *md_key = (uint8_t *)_md_key;
+ uint8_t *rt_key = (uint8_t *)_rt_key;
+
+ hbool_t lt_key_changed = FALSE, rt_key_changed = FALSE;
+ haddr_t old_root_addr = HADDR_UNDEF;
+ unsigned level;
+ H5B_ins_ud_t bt_ud = H5B_INS_UD_T_NULL; /* (Old) root node */
+ H5B_ins_ud_t split_bt_ud = H5B_INS_UD_T_NULL; /* Split B-tree node */
+ H5B_t * new_root_bt = NULL; /* New root node */
+ H5UC_t * rc_shared; /* Ref-counted shared info */
+ H5B_shared_t * shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
+ H5B_ins_t my_ins = H5B_INS_ERROR;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
@@ -575,27 +564,26 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
HDassert(H5F_addr_defined(addr));
/* Get shared info for B-tree */
- if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ if (NULL == (rc_shared = (type->get_shared)(f, udata)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared);
HDassert(shared);
/* Protect the root node */
- cache_udata.f = f;
- cache_udata.type = type;
+ cache_udata.f = f;
+ cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- bt_ud.addr = addr;
- if(NULL == (bt_ud.bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__NO_FLAGS_SET)))
+ bt_ud.addr = addr;
+ if (NULL == (bt_ud.bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to locate root of B-tree")
/* Insert the object */
- if((int)(my_ins = H5B__insert_helper(f, &bt_ud, type, lt_key,
- &lt_key_changed, md_key, udata, rt_key, &rt_key_changed,
- &split_bt_ud/*out*/)) < 0)
+ if ((int)(my_ins = H5B__insert_helper(f, &bt_ud, type, lt_key, &lt_key_changed, md_key, udata, rt_key,
+ &rt_key_changed, &split_bt_ud /*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to insert key")
/* Check if the root node split */
- if(H5B_INS_NOOP == my_ins) {
+ if (H5B_INS_NOOP == my_ins) {
/* The root node did not split - just return */
HDassert(!split_bt_ud.bt);
HGOTO_DONE(SUCCEED)
@@ -608,18 +596,18 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
level = bt_ud.bt->level;
/* update left and right keys */
- if(!lt_key_changed)
- H5MM_memcpy(lt_key, H5B_NKEY(bt_ud.bt,shared,0), type->sizeof_nkey);
- if(!rt_key_changed)
- H5MM_memcpy(rt_key, H5B_NKEY(split_bt_ud.bt,shared,split_bt_ud.bt->nchildren), type->sizeof_nkey);
+ if (!lt_key_changed)
+ H5MM_memcpy(lt_key, H5B_NKEY(bt_ud.bt, shared, 0), type->sizeof_nkey);
+ if (!rt_key_changed)
+ H5MM_memcpy(rt_key, H5B_NKEY(split_bt_ud.bt, shared, split_bt_ud.bt->nchildren), type->sizeof_nkey);
/*
* Copy the old root node to some other file location and make the new root
* at the old root's previous address. This prevents the B-tree from
* "moving".
*/
- H5_CHECK_OVERFLOW(shared->sizeof_rnode,size_t,hsize_t);
- if(HADDR_UNDEF == (old_root_addr = H5MF_alloc(f, H5FD_MEM_BTREE, (hsize_t)shared->sizeof_rnode)))
+ H5_CHECK_OVERFLOW(shared->sizeof_rnode, size_t, hsize_t);
+ if (HADDR_UNDEF == (old_root_addr = H5MF_alloc(f, H5FD_MEM_BTREE, (hsize_t)shared->sizeof_rnode)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move root")
/*
@@ -627,17 +615,17 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
*/
/* Make a copy of the old root information */
- if(NULL == (new_root_bt = H5B__copy(bt_ud.bt)))
+ if (NULL == (new_root_bt = H5B__copy(bt_ud.bt)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to copy old root")
/* Unprotect the old root so we can move it. Also force it to be marked
* dirty so it is written to the new location. */
- if(H5AC_unprotect(f, H5AC_BT, bt_ud.addr, bt_ud.bt, H5AC__DIRTIED_FLAG) < 0)
+ if (H5AC_unprotect(f, H5AC_BT, bt_ud.addr, bt_ud.bt, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release old root")
- bt_ud.bt = NULL; /* Make certain future references will be caught */
+ bt_ud.bt = NULL; /* Make certain future references will be caught */
/* Move the location of the old root on the disk */
- if(H5AC_move_entry(f, H5AC_BT, bt_ud.addr, old_root_addr) < 0)
+ if (H5AC_move_entry(f, H5AC_BT, bt_ud.addr, old_root_addr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node")
bt_ud.addr = old_root_addr;
@@ -646,11 +634,11 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
split_bt_ud.cache_flags |= H5AC__DIRTIED_FLAG;
/* clear the old root info at the old address (we already copied it) */
- new_root_bt->left = HADDR_UNDEF;
+ new_root_bt->left = HADDR_UNDEF;
new_root_bt->right = HADDR_UNDEF;
/* Set the new information for the copy */
- new_root_bt->level = level + 1;
+ new_root_bt->level = level + 1;
new_root_bt->nchildren = 2;
new_root_bt->child[0] = bt_ud.addr;
@@ -661,31 +649,30 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
H5MM_memcpy(H5B_NKEY(new_root_bt, shared, 2), rt_key, shared->type->sizeof_nkey);
/* Insert the modified copy of the old root into the file again */
- if(H5AC_insert_entry(f, H5AC_BT, addr, new_root_bt, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_insert_entry(f, H5AC_BT, addr, new_root_bt, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to add old B-tree root node to cache")
done:
- if(ret_value < 0)
- if(new_root_bt && H5B__node_dest(new_root_bt) < 0)
+ if (ret_value < 0)
+ if (new_root_bt && H5B__node_dest(new_root_bt) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to free B-tree root node");
- if(bt_ud.bt)
- if(H5AC_unprotect(f, H5AC_BT, bt_ud.addr, bt_ud.bt, bt_ud.cache_flags) < 0)
+ if (bt_ud.bt)
+ if (H5AC_unprotect(f, H5AC_BT, bt_ud.addr, bt_ud.bt, bt_ud.cache_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to unprotect old root")
- if(split_bt_ud.bt)
- if(H5AC_unprotect(f, H5AC_BT, split_bt_ud.addr, split_bt_ud.bt, split_bt_ud.cache_flags) < 0)
+ if (split_bt_ud.bt)
+ if (H5AC_unprotect(f, H5AC_BT, split_bt_ud.addr, split_bt_ud.bt, split_bt_ud.cache_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to unprotect new child")
#ifdef H5B_DEBUG
- if(ret_value >= 0)
+ if (ret_value >= 0)
H5B__assert(f, addr, type, udata);
#endif
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_insert() */
-
/*-------------------------------------------------------------------------
* Function: H5B__insert_child
*
@@ -701,11 +688,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx,
- haddr_t child, H5B_ins_t anchor, const void *md_key)
+H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, haddr_t child, H5B_ins_t anchor,
+ const void *md_key)
{
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
- uint8_t *base; /* Base offset for move */
+ H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ uint8_t * base; /* Base offset for move */
FUNC_ENTER_STATIC_NOERR
@@ -720,32 +707,30 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx,
* records to an unlimited dimension chunked dataset)
*/
base = H5B_NKEY(bt, shared, (idx + 1));
- if((idx + 1) == bt->nchildren) {
+ if ((idx + 1) == bt->nchildren) {
/* Make room for the new key */
H5MM_memcpy(base + shared->type->sizeof_nkey, base,
- shared->type->sizeof_nkey); /* No overlap possible - memcpy() OK */
+ shared->type->sizeof_nkey); /* No overlap possible - memcpy() OK */
H5MM_memcpy(base, md_key, shared->type->sizeof_nkey);
/* The MD_KEY is the left key of the new node */
- if(H5B_INS_RIGHT == anchor)
- idx++; /* Don't have to memmove() child addresses down, just add new child */
+ if (H5B_INS_RIGHT == anchor)
+ idx++; /* Don't have to memmove() child addresses down, just add new child */
else
/* Make room for the new child address */
bt->child[idx + 1] = bt->child[idx];
} /* end if */
else {
/* Make room for the new key */
- HDmemmove(base + shared->type->sizeof_nkey, base,
- (bt->nchildren - idx) * shared->type->sizeof_nkey);
+ HDmemmove(base + shared->type->sizeof_nkey, base, (bt->nchildren - idx) * shared->type->sizeof_nkey);
H5MM_memcpy(base, md_key, shared->type->sizeof_nkey);
/* The MD_KEY is the left key of the new node */
- if(H5B_INS_RIGHT == anchor)
+ if (H5B_INS_RIGHT == anchor)
idx++;
/* Make room for the new child address */
- HDmemmove(bt->child + idx + 1, bt->child + idx,
- (bt->nchildren - idx) * sizeof(haddr_t));
+ HDmemmove(bt->child + idx + 1, bt->child + idx, (bt->nchildren - idx) * sizeof(haddr_t));
} /* end if */
bt->child[idx] = child;
@@ -757,7 +742,6 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx,
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5B_insert_child() */
-
/*-------------------------------------------------------------------------
* Function: H5B__insert_helper
*
@@ -789,20 +773,20 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx,
*-------------------------------------------------------------------------
*/
static H5B_ins_t
-H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
- uint8_t *lt_key, hbool_t *lt_key_changed, uint8_t *md_key, void *udata,
- uint8_t *rt_key, hbool_t *rt_key_changed, H5B_ins_ud_t *split_bt_ud/*out*/)
+H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8_t *lt_key,
+ hbool_t *lt_key_changed, uint8_t *md_key, void *udata, uint8_t *rt_key,
+ hbool_t *rt_key_changed, H5B_ins_ud_t *split_bt_ud /*out*/)
{
- H5B_t *bt; /* Convenience pointer to B-tree */
- H5UC_t *rc_shared; /* Ref-counted shared info */
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
- H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
- unsigned lt = 0, idx = 0, rt; /* Left, final & right index values */
- int cmp = -1; /* Key comparison value */
- H5B_ins_ud_t child_bt_ud = H5B_INS_UD_T_NULL; /* Child B-tree */
- H5B_ins_ud_t new_child_bt_ud = H5B_INS_UD_T_NULL; /* Newly split child B-tree */
- H5B_ins_t my_ins = H5B_INS_ERROR;
- H5B_ins_t ret_value = H5B_INS_ERROR; /* Return value */
+ H5B_t * bt; /* Convenience pointer to B-tree */
+ H5UC_t * rc_shared; /* Ref-counted shared info */
+ H5B_shared_t * shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
+ unsigned lt = 0, idx = 0, rt; /* Left, final & right index values */
+ int cmp = -1; /* Key comparison value */
+ H5B_ins_ud_t child_bt_ud = H5B_INS_UD_T_NULL; /* Child B-tree */
+ H5B_ins_ud_t new_child_bt_ud = H5B_INS_UD_T_NULL; /* Newly split child B-tree */
+ H5B_ins_t my_ins = H5B_INS_ERROR;
+ H5B_ins_t ret_value = H5B_INS_ERROR; /* Return value */
FUNC_ENTER_STATIC
@@ -832,7 +816,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
*rt_key_changed = FALSE;
/* Get shared info for B-tree */
- if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ if (NULL == (rc_shared = (type->get_shared)(f, udata)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, H5B_INS_ERROR, "can't retrieve B-tree's shared ref. count object")
shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared);
HDassert(shared);
@@ -844,75 +828,78 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
*/
rt = bt->nchildren;
- while(lt < rt && cmp) {
- idx = (lt + rt) / 2;
- if((cmp = (type->cmp3)(H5B_NKEY(bt, shared, idx), udata, H5B_NKEY(bt, shared, idx + 1))) < 0)
- rt = idx;
- else
- lt = idx + 1;
+ while (lt < rt && cmp) {
+ idx = (lt + rt) / 2;
+ if ((cmp = (type->cmp3)(H5B_NKEY(bt, shared, idx), udata, H5B_NKEY(bt, shared, idx + 1))) < 0)
+ rt = idx;
+ else
+ lt = idx + 1;
} /* end while */
/* Set up user data for cache callbacks */
- cache_udata.f = f;
- cache_udata.type = type;
+ cache_udata.f = f;
+ cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(0 == bt->nchildren) {
- /*
- * The value being inserted will be the only value in this tree. We
- * must necessarily be at level zero.
- */
- HDassert(0 == bt->level);
- if((type->new_node)(f, H5B_INS_FIRST, H5B_NKEY(bt, shared, 0), udata,
- H5B_NKEY(bt, shared, 1), bt->child + 0/*out*/) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, H5B_INS_ERROR, "unable to create leaf node")
- bt->nchildren = 1;
+ if (0 == bt->nchildren) {
+ /*
+ * The value being inserted will be the only value in this tree. We
+ * must necessarily be at level zero.
+ */
+ HDassert(0 == bt->level);
+ if ((type->new_node)(f, H5B_INS_FIRST, H5B_NKEY(bt, shared, 0), udata, H5B_NKEY(bt, shared, 1),
+ bt->child + 0 /*out*/) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, H5B_INS_ERROR, "unable to create leaf node")
+ bt->nchildren = 1;
bt_ud->cache_flags |= H5AC__DIRTIED_FLAG;
- idx = 0;
-
- if(type->follow_min) {
- if((int)(my_ins = (type->insert)(f, bt->child[idx], H5B_NKEY(bt, shared, idx),
- lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1),
- rt_key_changed, &new_child_bt_ud.addr/*out*/)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "unable to insert first leaf node")
- } /* end if */
+ idx = 0;
+
+ if (type->follow_min) {
+ if ((int)(my_ins = (type->insert)(f, bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed,
+ md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed,
+ &new_child_bt_ud.addr /*out*/)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "unable to insert first leaf node")
+ } /* end if */
else
- my_ins = H5B_INS_NOOP;
- } else if(cmp < 0 && idx == 0) {
- if(bt->level > 0) {
+ my_ins = H5B_INS_NOOP;
+ }
+ else if (cmp < 0 && idx == 0) {
+ if (bt->level > 0) {
/*
* The value being inserted is less than any value in this tree.
* Follow the minimum branch out of this node to a subtree.
*/
child_bt_ud.addr = bt->child[idx];
- if(NULL == (child_bt_ud.bt = (H5B_t *)H5AC_protect(f, H5AC_BT, child_bt_ud.addr, &cache_udata, H5AC__NO_FLAGS_SET)))
+ if (NULL == (child_bt_ud.bt = (H5B_t *)H5AC_protect(f, H5AC_BT, child_bt_ud.addr, &cache_udata,
+ H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node")
- if((int)(my_ins = H5B__insert_helper(f, &child_bt_ud, type,
- H5B_NKEY(bt,shared,idx), lt_key_changed, md_key,
- udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed,
- &new_child_bt_ud/*out*/)) < 0)
+ if ((int)(my_ins = H5B__insert_helper(
+ f, &child_bt_ud, type, H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata,
+ H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &new_child_bt_ud /*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum subtree")
- } else if(type->follow_min) {
+ }
+ else if (type->follow_min) {
/*
* The value being inserted is less than any leaf node out of this
* current node. Follow the minimum branch to a leaf node and let
* the subclass handle the problem.
*/
- if((int)(my_ins = (type->insert)(f, bt->child[idx], H5B_NKEY(bt, shared, idx),
- lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1),
- rt_key_changed, &new_child_bt_ud.addr/*out*/)) < 0)
+ if ((int)(my_ins = (type->insert)(f, bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed,
+ md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed,
+ &new_child_bt_ud.addr /*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node")
- } else {
+ }
+ else {
/*
* The value being inserted is less than any leaf node out of the
* current node. Create a new minimum leaf node out of this B-tree
* node. This node is not empty (handled above).
*/
my_ins = H5B_INS_LEFT;
- H5MM_memcpy(md_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey);
- if((type->new_node)(f, H5B_INS_LEFT, H5B_NKEY(bt, shared, idx), udata,
- md_key, &new_child_bt_ud.addr/*out*/) < 0)
+ H5MM_memcpy(md_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
+ if ((type->new_node)(f, H5B_INS_LEFT, H5B_NKEY(bt, shared, idx), udata, md_key,
+ &new_child_bt_ud.addr /*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node")
*lt_key_changed = TRUE;
} /* end else */
@@ -920,47 +907,50 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
#ifdef H5_STRICT_FORMAT_CHECKS
/* Since we are to the left of the leftmost key there must not be a left
* sibling */
- if(H5F_addr_defined(bt->left))
+ if (H5F_addr_defined(bt->left))
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "internal error: likely corrupt key values")
#endif /* H5_STRICT_FORMAT_CHECKS */
- } else if(cmp > 0 && idx + 1 >= bt->nchildren) {
+ }
+ else if (cmp > 0 && idx + 1 >= bt->nchildren) {
if (bt->level > 0) {
/*
- * The value being inserted is larger than any value in this tree.
- * Follow the maximum branch out of this node to a subtree.
- */
- idx = bt->nchildren - 1;
+ * The value being inserted is larger than any value in this tree.
+ * Follow the maximum branch out of this node to a subtree.
+ */
+ idx = bt->nchildren - 1;
child_bt_ud.addr = bt->child[idx];
- if(NULL == (child_bt_ud.bt = (H5B_t *)H5AC_protect(f, H5AC_BT, child_bt_ud.addr, &cache_udata, H5AC__NO_FLAGS_SET)))
+ if (NULL == (child_bt_ud.bt = (H5B_t *)H5AC_protect(f, H5AC_BT, child_bt_ud.addr, &cache_udata,
+ H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node")
- if((int)(my_ins = H5B__insert_helper(f, &child_bt_ud, type,
- H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata,
- H5B_NKEY(bt, shared, idx + 1), rt_key_changed,
- &new_child_bt_ud/*out*/)) < 0)
+ if ((int)(my_ins = H5B__insert_helper(
+ f, &child_bt_ud, type, H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata,
+ H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &new_child_bt_ud /*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum subtree")
- } else if(type->follow_max) {
+ }
+ else if (type->follow_max) {
/*
* The value being inserted is larger than any leaf node out of the
* current node. Follow the maximum branch to a leaf node and let
* the subclass handle the problem.
*/
idx = bt->nchildren - 1;
- if((int)(my_ins = (type->insert)(f, bt->child[idx], H5B_NKEY(bt, shared, idx),
- lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1),
- rt_key_changed, &new_child_bt_ud.addr/*out*/)) < 0)
+ if ((int)(my_ins = (type->insert)(f, bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed,
+ md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed,
+ &new_child_bt_ud.addr /*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node")
- } else {
+ }
+ else {
/*
* The value being inserted is larger than any leaf node out of the
* current node. Create a new maximum leaf node out of this B-tree
* node.
*/
- idx = bt->nchildren - 1;
+ idx = bt->nchildren - 1;
my_ins = H5B_INS_RIGHT;
H5MM_memcpy(md_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
- if((type->new_node)(f, H5B_INS_RIGHT, md_key, udata,
- H5B_NKEY(bt, shared, idx + 1), &new_child_bt_ud.addr/*out*/) < 0)
+ if ((type->new_node)(f, H5B_INS_RIGHT, md_key, udata, H5B_NKEY(bt, shared, idx + 1),
+ &new_child_bt_ud.addr /*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node")
*rt_key_changed = TRUE;
} /* end else */
@@ -968,49 +958,53 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
#ifdef H5_STRICT_FORMAT_CHECKS
/* Since we are to the right of the rightmost key there must not be a
* right sibling */
- if(H5F_addr_defined(bt->right))
+ if (H5F_addr_defined(bt->right))
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "internal error: likely corrupt key values")
#endif /* H5_STRICT_FORMAT_CHECKS */
- } else if(cmp) {
- /*
- * We couldn't figure out which branch to follow out of this node. THIS
- * IS A MAJOR PROBLEM THAT NEEDS TO BE FIXED --rpm.
- */
- HDassert("INTERNAL HDF5 ERROR (contact rpm)" && 0);
+ }
+ else if (cmp) {
+ /*
+ * We couldn't figure out which branch to follow out of this node. THIS
+ * IS A MAJOR PROBLEM THAT NEEDS TO BE FIXED --rpm.
+ */
+ HDassert("INTERNAL HDF5 ERROR (contact rpm)" && 0);
#ifdef NDEBUG
- HDabort();
+ HDabort();
#endif /* NDEBUG */
- } else if(bt->level > 0) {
- /*
- * Follow a branch out of this node to another subtree.
- */
- HDassert(idx < bt->nchildren);
- child_bt_ud.addr = bt->child[idx];
- if(NULL == (child_bt_ud.bt = (H5B_t *)H5AC_protect(f, H5AC_BT, child_bt_ud.addr, &cache_udata, H5AC__NO_FLAGS_SET)))
+ }
+ else if (bt->level > 0) {
+ /*
+ * Follow a branch out of this node to another subtree.
+ */
+ HDassert(idx < bt->nchildren);
+ child_bt_ud.addr = bt->child[idx];
+ if (NULL == (child_bt_ud.bt = (H5B_t *)H5AC_protect(f, H5AC_BT, child_bt_ud.addr, &cache_udata,
+ H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node")
- if((int)(my_ins = H5B__insert_helper(f, &child_bt_ud, type,
- H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata,
- H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &new_child_bt_ud/*out*/)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert subtree")
- } else {
- /*
- * Follow a branch out of this node to a leaf node of some other type.
- */
- HDassert(idx < bt->nchildren);
- if((int)(my_ins = (type->insert)(f, bt->child[idx], H5B_NKEY(bt, shared, idx),
- lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1),
- rt_key_changed, &new_child_bt_ud.addr/*out*/)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert leaf node")
+ if ((int)(my_ins = H5B__insert_helper(f, &child_bt_ud, type, H5B_NKEY(bt, shared, idx),
+ lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1),
+ rt_key_changed, &new_child_bt_ud /*out*/)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert subtree")
+ }
+ else {
+ /*
+ * Follow a branch out of this node to a leaf node of some other type.
+ */
+ HDassert(idx < bt->nchildren);
+ if ((int)(my_ins = (type->insert)(f, bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed,
+ md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed,
+ &new_child_bt_ud.addr /*out*/)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert leaf node")
}
HDassert((int)my_ins >= 0);
/*
* Update the left and right keys of the current node.
*/
- if(*lt_key_changed) {
+ if (*lt_key_changed) {
bt_ud->cache_flags |= H5AC__DIRTIED_FLAG;
- if(idx > 0) {
+ if (idx > 0) {
HDassert(type->critical_key == H5B_LEFT);
HDassert(!(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins));
*lt_key_changed = FALSE;
@@ -1018,9 +1012,9 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
else
H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
} /* end if */
- if(*rt_key_changed) {
+ if (*rt_key_changed) {
bt_ud->cache_flags |= H5AC__DIRTIED_FLAG;
- if(idx + 1 < bt->nchildren) {
+ if (idx + 1 < bt->nchildren) {
HDassert(type->critical_key == H5B_RIGHT);
HDassert(!(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins));
*rt_key_changed = FALSE;
@@ -1033,76 +1027,77 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
* Handle changes/additions to children
*/
HDassert(!(bt->level == 0) != !(child_bt_ud.bt));
- if(H5B_INS_CHANGE == my_ins) {
- /*
- * The insertion simply changed the address for the child.
- */
- HDassert(!child_bt_ud.bt);
- HDassert(bt->level == 0);
- bt->child[idx] = new_child_bt_ud.addr;
+ if (H5B_INS_CHANGE == my_ins) {
+ /*
+ * The insertion simply changed the address for the child.
+ */
+ HDassert(!child_bt_ud.bt);
+ HDassert(bt->level == 0);
+ bt->child[idx] = new_child_bt_ud.addr;
bt_ud->cache_flags |= H5AC__DIRTIED_FLAG;
- } else if(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins) {
+ }
+ else if (H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins) {
unsigned *tmp_bt_flags_ptr = NULL;
- H5B_t *tmp_bt;
-
- /*
- * If this node is full then split it before inserting the new child.
- */
- if(bt->nchildren == shared->two_k) {
- if(H5B__split(f, bt_ud, idx, udata, split_bt_ud/*out*/) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR, "unable to split node")
- if(idx < bt->nchildren) {
- tmp_bt = bt;
+ H5B_t * tmp_bt;
+
+ /*
+ * If this node is full then split it before inserting the new child.
+ */
+ if (bt->nchildren == shared->two_k) {
+ if (H5B__split(f, bt_ud, idx, udata, split_bt_ud /*out*/) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR, "unable to split node")
+ if (idx < bt->nchildren) {
+ tmp_bt = bt;
tmp_bt_flags_ptr = &bt_ud->cache_flags;
- } else {
- idx -= bt->nchildren;
- tmp_bt = split_bt_ud->bt;
+ }
+ else {
+ idx -= bt->nchildren;
+ tmp_bt = split_bt_ud->bt;
tmp_bt_flags_ptr = &split_bt_ud->cache_flags;
- }
- } /* end if */
+ }
+ } /* end if */
else {
- tmp_bt = bt;
+ tmp_bt = bt;
tmp_bt_flags_ptr = &bt_ud->cache_flags;
- } /* end else */
+ } /* end else */
- /* Insert the child */
- if(H5B__insert_child(tmp_bt, tmp_bt_flags_ptr, idx, new_child_bt_ud.addr, my_ins, md_key) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert child")
+ /* Insert the child */
+ if (H5B__insert_child(tmp_bt, tmp_bt_flags_ptr, idx, new_child_bt_ud.addr, my_ins, md_key) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert child")
} /* end else-if */
/*
* If this node split, return the mid key (the one that is shared
* by the left and right node).
*/
- if(split_bt_ud->bt) {
- H5MM_memcpy(md_key, H5B_NKEY(split_bt_ud->bt, shared, 0), type->sizeof_nkey);
- ret_value = H5B_INS_RIGHT;
+ if (split_bt_ud->bt) {
+ H5MM_memcpy(md_key, H5B_NKEY(split_bt_ud->bt, shared, 0), type->sizeof_nkey);
+ ret_value = H5B_INS_RIGHT;
#ifdef H5B_DEBUG
- /*
- * The max key in the original left node must be equal to the min key
- * in the new node.
- */
- cmp = (type->cmp2)(H5B_NKEY(bt, shared, bt->nchildren), udata,
- H5B_NKEY(split_bt_ud->bt, shared, 0));
- HDassert(0 == cmp);
+ /*
+ * The max key in the original left node must be equal to the min key
+ * in the new node.
+ */
+ cmp = (type->cmp2)(H5B_NKEY(bt, shared, bt->nchildren), udata, H5B_NKEY(split_bt_ud->bt, shared, 0));
+ HDassert(0 == cmp);
#endif
} /* end if */
else
- ret_value = H5B_INS_NOOP;
+ ret_value = H5B_INS_NOOP;
done:
- if(child_bt_ud.bt)
- if(H5AC_unprotect(f, H5AC_BT, child_bt_ud.addr, child_bt_ud.bt, child_bt_ud.cache_flags) < 0)
+ if (child_bt_ud.bt)
+ if (H5AC_unprotect(f, H5AC_BT, child_bt_ud.addr, child_bt_ud.bt, child_bt_ud.cache_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to unprotect child")
- if(new_child_bt_ud.bt)
- if(H5AC_unprotect(f, H5AC_BT, new_child_bt_ud.addr, new_child_bt_ud.bt, new_child_bt_ud.cache_flags) < 0)
+ if (new_child_bt_ud.bt)
+ if (H5AC_unprotect(f, H5AC_BT, new_child_bt_ud.addr, new_child_bt_ud.bt,
+ new_child_bt_ud.cache_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to unprotect new child")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_insert_helper() */
-
/*-------------------------------------------------------------------------
* Function: H5B__iterate_helper
*
@@ -1117,15 +1112,14 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B__iterate_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr,
- H5B_operator_t op, void *udata)
+H5B__iterate_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_operator_t op, void *udata)
{
- H5B_t *bt = NULL; /* Pointer to current B-tree node */
- H5UC_t *rc_shared; /* Ref-counted shared info */
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
- H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
- unsigned u; /* Local index variable */
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ H5B_t * bt = NULL; /* Pointer to current B-tree node */
+ H5UC_t * rc_shared; /* Ref-counted shared info */
+ H5B_shared_t * shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -1139,36 +1133,35 @@ H5B__iterate_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr,
HDassert(udata);
/* Get shared info for B-tree */
- if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ if (NULL == (rc_shared = (type->get_shared)(f, udata)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared);
HDassert(shared);
/* Protect the initial/current node */
- cache_udata.f = f;
- cache_udata.type = type;
+ cache_udata.f = f;
+ cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load B-tree node")
/* Iterate over node's children */
- for(u = 0; u < bt->nchildren && ret_value == H5_ITER_CONT; u++) {
- if(bt->level > 0)
+ for (u = 0; u < bt->nchildren && ret_value == H5_ITER_CONT; u++) {
+ if (bt->level > 0)
ret_value = H5B__iterate_helper(f, type, bt->child[u], op, udata);
else
ret_value = (*op)(f, H5B_NKEY(bt, shared, u), bt->child[u], H5B_NKEY(bt, shared, u + 1), udata);
- if(ret_value < 0)
+ if (ret_value < 0)
HERROR(H5E_BTREE, H5E_BADITER, "B-tree iteration failed");
} /* end for */
done:
- if(bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B__iterate_helper() */
-
/*-------------------------------------------------------------------------
* Function: H5B_iterate
*
@@ -1183,10 +1176,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B_iterate(H5F_t *f, const H5B_class_t *type, haddr_t addr,
- H5B_operator_t op, void *udata)
+H5B_iterate(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_operator_t op, void *udata)
{
- herr_t ret_value = FAIL; /* Return value */
+ herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI_NOERR
@@ -1200,13 +1192,12 @@ H5B_iterate(H5F_t *f, const H5B_class_t *type, haddr_t addr,
HDassert(udata);
/* Iterate over the B-tree records */
- if((ret_value = H5B__iterate_helper(f, type, addr, op, udata)) < 0)
+ if ((ret_value = H5B__iterate_helper(f, type, addr, op, udata)) < 0)
HERROR(H5E_BTREE, H5E_BADITER, "B-tree iteration failed");
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_iterate() */
-
/*-------------------------------------------------------------------------
* Function: H5B__remove_helper
*
@@ -1232,18 +1223,18 @@ H5B_iterate(H5F_t *f, const H5B_class_t *type, haddr_t addr,
*-------------------------------------------------------------------------
*/
static H5B_ins_t
-H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
- uint8_t *lt_key/*out*/, hbool_t *lt_key_changed/*out*/, void *udata,
- uint8_t *rt_key/*out*/, hbool_t *rt_key_changed/*out*/)
+H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, uint8_t *lt_key /*out*/,
+ hbool_t *lt_key_changed /*out*/, void *udata, uint8_t *rt_key /*out*/,
+ hbool_t *rt_key_changed /*out*/)
{
- H5B_t *bt = NULL, *sibling = NULL;
- unsigned bt_flags = H5AC__NO_FLAGS_SET;
- H5UC_t *rc_shared; /* Ref-counted shared info */
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_t * bt = NULL, *sibling = NULL;
+ unsigned bt_flags = H5AC__NO_FLAGS_SET;
+ H5UC_t * rc_shared; /* Ref-counted shared info */
+ H5B_shared_t * shared; /* Pointer to shared B-tree info */
H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
- unsigned idx = 0, lt = 0, rt; /* Final, left & right indices */
- int cmp = 1; /* Key comparison value */
- H5B_ins_t ret_value = H5B_INS_ERROR;
+ unsigned idx = 0, lt = 0, rt; /* Final, left & right indices */
+ int cmp = 1; /* Key comparison value */
+ H5B_ins_t ret_value = H5B_INS_ERROR;
FUNC_ENTER_STATIC
@@ -1257,7 +1248,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
HDassert(rt_key && rt_key_changed);
/* Get shared info for B-tree */
- if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ if (NULL == (rc_shared = (type->get_shared)(f, udata)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, H5B_INS_ERROR, "can't retrieve B-tree's shared ref. count object")
shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared);
HDassert(shared);
@@ -1266,54 +1257,55 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
* Perform a binary search to locate the child which contains the thing
* for which we're searching.
*/
- cache_udata.f = f;
- cache_udata.type = type;
+ cache_udata.f = f;
+ cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__NO_FLAGS_SET)))
+ if (NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load B-tree node")
rt = bt->nchildren;
- while(lt < rt && cmp) {
- idx = (lt + rt) / 2;
- if((cmp = (type->cmp3)(H5B_NKEY(bt, shared, idx), udata, H5B_NKEY(bt, shared, idx + 1))) < 0)
- rt = idx;
- else
- lt = idx + 1;
+ while (lt < rt && cmp) {
+ idx = (lt + rt) / 2;
+ if ((cmp = (type->cmp3)(H5B_NKEY(bt, shared, idx), udata, H5B_NKEY(bt, shared, idx + 1))) < 0)
+ rt = idx;
+ else
+ lt = idx + 1;
} /* end while */
- if(cmp)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "B-tree key not found")
+ if (cmp)
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "B-tree key not found")
/*
* Follow the link to the subtree or to the data node. The return value
* will be one of H5B_INS_ERROR, H5B_INS_NOOP, or H5B_INS_REMOVE.
*/
HDassert(idx < bt->nchildren);
- if(bt->level > 0) {
- /* We're at an internal node -- call recursively */
- if((int)(ret_value = H5B__remove_helper(f, bt->child[idx], type,
- level + 1, H5B_NKEY(bt, shared, idx)/*out*/,
- lt_key_changed/*out*/, udata, H5B_NKEY(bt, shared, idx + 1)/*out*/,
- rt_key_changed/*out*/)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in subtree")
- } else if(type->remove) {
- /*
- * We're at a leaf node but the leaf node points to an object that
- * has a removal method. Pass the removal request to the pointed-to
- * object and let it decide how to progress.
- */
- if((int)(ret_value = (type->remove)(f, bt->child[idx],
- H5B_NKEY(bt, shared, idx), lt_key_changed, udata,
- H5B_NKEY(bt, shared, idx + 1), rt_key_changed)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in leaf node")
- } else {
- /*
- * We're at a leaf node which points to an object that has no removal
- * method. The best we can do is to leave the object alone but
- * remove the B-tree reference to the object.
- */
- *lt_key_changed = FALSE;
- *rt_key_changed = FALSE;
- ret_value = H5B_INS_REMOVE;
+ if (bt->level > 0) {
+ /* We're at an internal node -- call recursively */
+ if ((int)(ret_value =
+ H5B__remove_helper(f, bt->child[idx], type, level + 1,
+ H5B_NKEY(bt, shared, idx) /*out*/, lt_key_changed /*out*/, udata,
+ H5B_NKEY(bt, shared, idx + 1) /*out*/, rt_key_changed /*out*/)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in subtree")
+ }
+ else if (type->remove) {
+ /*
+ * We're at a leaf node but the leaf node points to an object that
+ * has a removal method. Pass the removal request to the pointed-to
+ * object and let it decide how to progress.
+ */
+ if ((int)(ret_value = (type->remove)(f, bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed,
+ udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in leaf node")
+ }
+ else {
+ /*
+ * We're at a leaf node which points to an object that has no removal
+ * method. The best we can do is to leave the object alone but
+ * remove the B-tree reference to the object.
+ */
+ *lt_key_changed = FALSE;
+ *rt_key_changed = FALSE;
+ ret_value = H5B_INS_REMOVE;
}
/*
@@ -1324,20 +1316,20 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
* key changed and it's the right most key of this node we must update
* our right key and indicate that it changed.
*/
- if(*lt_key_changed) {
+ if (*lt_key_changed) {
HDassert(type->critical_key == H5B_LEFT);
bt_flags |= H5AC__DIRTIED_FLAG;
- if(idx > 0)
+ if (idx > 0)
/* Don't propagate change out of this B-tree node */
*lt_key_changed = FALSE;
else
H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
} /* end if */
- if(*rt_key_changed) {
+ if (*rt_key_changed) {
HDassert(type->critical_key == H5B_RIGHT);
bt_flags |= H5AC__DIRTIED_FLAG;
- if(idx + 1 < bt->nchildren)
+ if (idx + 1 < bt->nchildren)
/* Don't propagate change out of this B-tree node */
*rt_key_changed = FALSE;
else
@@ -1348,14 +1340,14 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
* If the subtree returned H5B_INS_REMOVE then we should remove the
* subtree entry from the current node. There are four cases:
*/
- if(H5B_INS_REMOVE == ret_value) {
+ if (H5B_INS_REMOVE == ret_value) {
/* Clients should not change keys when a node is removed. This function
* will handle it as appropriate, based on the value of bt->critical_key
*/
HDassert(!(*lt_key_changed));
HDassert(!(*rt_key_changed));
- if(1 == bt->nchildren) {
+ if (1 == bt->nchildren) {
/*
* The subtree is the only child of this node. Discard both
* keys and the subtree pointer. Free this node (unless it's the
@@ -1363,116 +1355,123 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
*/
/* Only delete the node if it is not the root node. Note that this
* "level" is the opposite of bt->level */
- if(level > 0) {
+ if (level > 0) {
/* Fix siblings, making sure that the keys remain consistent
* between siblings. Overwrite the key that that is not
* "critical" for any child in its node to maintain this
* consistency (and avoid breaking key/child consistency) */
- if(H5F_addr_defined(bt->left)) {
- if(NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->left, &cache_udata, H5AC__NO_FLAGS_SET)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node from tree")
+ if (H5F_addr_defined(bt->left)) {
+ if (NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->left, &cache_udata,
+ H5AC__NO_FLAGS_SET)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR,
+ "unable to load node from tree")
/* Copy right-most key from deleted node to right-most key
* in its left neighbor, but only if it is not the critical
* key for the right-most child of the left neighbor */
- if(type->critical_key == H5B_LEFT)
- H5MM_memcpy(H5B_NKEY(sibling, shared, sibling->nchildren),
- H5B_NKEY(bt, shared, 1), type->sizeof_nkey);
+ if (type->critical_key == H5B_LEFT)
+ H5MM_memcpy(H5B_NKEY(sibling, shared, sibling->nchildren), H5B_NKEY(bt, shared, 1),
+ type->sizeof_nkey);
sibling->right = bt->right;
- if(H5AC_unprotect(f, H5AC_BT, bt->left, sibling, H5AC__DIRTIED_FLAG) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node from tree")
- sibling = NULL; /* Make certain future references will be caught */
- } /* end if */
- if(H5F_addr_defined(bt->right)) {
- if(NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->right, &cache_udata, H5AC__NO_FLAGS_SET)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to unlink node from tree")
+ if (H5AC_unprotect(f, H5AC_BT, bt->left, sibling, H5AC__DIRTIED_FLAG) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR,
+ "unable to release node from tree")
+ sibling = NULL; /* Make certain future references will be caught */
+ } /* end if */
+ if (H5F_addr_defined(bt->right)) {
+ if (NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->right, &cache_udata,
+ H5AC__NO_FLAGS_SET)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR,
+ "unable to unlink node from tree")
/* Copy left-most key from deleted node to left-most key in
* its right neighbor, but only if it is not the critical
* key for the left-most child of the right neighbor */
- if(type->critical_key == H5B_RIGHT)
- H5MM_memcpy(H5B_NKEY(sibling, shared, 0),
- H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
+ if (type->critical_key == H5B_RIGHT)
+ H5MM_memcpy(H5B_NKEY(sibling, shared, 0), H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
sibling->left = bt->left;
- if(H5AC_unprotect(f, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node from tree")
- sibling = NULL; /* Make certain future references will be caught */
- } /* end if */
+ if (H5AC_unprotect(f, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR,
+ "unable to release node from tree")
+ sibling = NULL; /* Make certain future references will be caught */
+ } /* end if */
/* Update bt struct */
- bt->left = HADDR_UNDEF;
- bt->right = HADDR_UNDEF;
+ bt->left = HADDR_UNDEF;
+ bt->right = HADDR_UNDEF;
bt->nchildren = 0;
/* Delete the node from disk (via the metadata cache) */
bt_flags |= H5AC__DIRTIED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
H5_CHECK_OVERFLOW(shared->sizeof_rnode, size_t, hsize_t);
- if(H5AC_unprotect(f, H5AC_BT, addr, bt, bt_flags | H5AC__DELETED_FLAG) < 0) {
- bt = NULL;
+ if (H5AC_unprotect(f, H5AC_BT, addr, bt, bt_flags | H5AC__DELETED_FLAG) < 0) {
+ bt = NULL;
bt_flags = H5AC__NO_FLAGS_SET;
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to free B-tree node")
} /* end if */
- bt = NULL;
+ bt = NULL;
bt_flags = H5AC__NO_FLAGS_SET;
- } else {
+ }
+ else {
/* We removed the last child in the root node, set the level
* back to 0 (as well as nchildren) */
bt->nchildren = 0;
- bt->level = 0;
+ bt->level = 0;
bt_flags |= H5AC__DIRTIED_FLAG;
} /* end else */
- } else if(0 == idx) {
+ }
+ else if (0 == idx) {
/*
* The subtree is the left-most child of this node. We update the
* key and child arrays and lt_key as appropriate, depending on the
* status of bt->critical_key. Return H5B_INS_NOOP.
*/
- if(type->critical_key == H5B_LEFT) {
+ if (type->critical_key == H5B_LEFT) {
/* Slide all keys down 1, update lt_key */
HDmemmove(H5B_NKEY(bt, shared, 0), H5B_NKEY(bt, shared, 1),
- bt->nchildren * type->sizeof_nkey);
+ bt->nchildren * type->sizeof_nkey);
H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
*lt_key_changed = TRUE;
- } else
+ }
+ else
/* Slide all but the leftmost 2 keys down, leaving the leftmost
* key intact (the right key of the leftmost child is
* overwritten) */
HDmemmove(H5B_NKEY(bt, shared, 1), H5B_NKEY(bt, shared, 2),
- (bt->nchildren - 1) * type->sizeof_nkey);
+ (bt->nchildren - 1) * type->sizeof_nkey);
- HDmemmove(bt->child,
- bt->child + 1,
- (bt->nchildren - 1) * sizeof(haddr_t));
+ HDmemmove(bt->child, bt->child + 1, (bt->nchildren - 1) * sizeof(haddr_t));
bt->nchildren -= 1;
bt_flags |= H5AC__DIRTIED_FLAG;
ret_value = H5B_INS_NOOP;
- } else if(idx + 1 == bt->nchildren) {
+ }
+ else if (idx + 1 == bt->nchildren) {
/*
* The subtree is the right-most child of this node. We update the
* key and child arrays and rt_key as appropriate, depending on the
* status of bt->critical_key. Return H5B_INS_NOOP.
*/
- if(type->critical_key == H5B_LEFT)
+ if (type->critical_key == H5B_LEFT)
/* Slide the rightmost key down one, overwriting the left key of
* the deleted (righmost) child */
- HDmemmove(H5B_NKEY(bt, shared, bt->nchildren - 1),
- H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey);
+ HDmemmove(H5B_NKEY(bt, shared, bt->nchildren - 1), H5B_NKEY(bt, shared, bt->nchildren),
+ type->sizeof_nkey);
else {
/* Just update rt_key */
- H5MM_memcpy(rt_key, H5B_NKEY(bt, shared, bt->nchildren - 1),
- type->sizeof_nkey);
+ H5MM_memcpy(rt_key, H5B_NKEY(bt, shared, bt->nchildren - 1), type->sizeof_nkey);
*rt_key_changed = TRUE;
} /* end else */
bt->nchildren -= 1;
bt_flags |= H5AC__DIRTIED_FLAG;
ret_value = H5B_INS_NOOP;
- } else {
+ }
+ else {
/*
* There are subtrees out of this node to both the left and right of
* the subtree being removed. The subtree and its critical key are
@@ -1480,66 +1479,62 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
* shifted left by one place. The subtree has already been freed.
* Return H5B_INS_NOOP.
*/
- if(type->critical_key == H5B_LEFT)
- HDmemmove(H5B_NKEY(bt, shared, idx),
- H5B_NKEY(bt, shared, idx + 1),
- (bt->nchildren - idx) * type->sizeof_nkey);
+ if (type->critical_key == H5B_LEFT)
+ HDmemmove(H5B_NKEY(bt, shared, idx), H5B_NKEY(bt, shared, idx + 1),
+ (bt->nchildren - idx) * type->sizeof_nkey);
else
- HDmemmove(H5B_NKEY(bt, shared, idx + 1),
- H5B_NKEY(bt, shared, idx + 2),
- (bt->nchildren - 1 - idx) * type->sizeof_nkey);
+ HDmemmove(H5B_NKEY(bt, shared, idx + 1), H5B_NKEY(bt, shared, idx + 2),
+ (bt->nchildren - 1 - idx) * type->sizeof_nkey);
- HDmemmove(bt->child + idx,
- bt->child + idx + 1,
- (bt->nchildren - 1 - idx) * sizeof(haddr_t));
+ HDmemmove(bt->child + idx, bt->child + idx + 1, (bt->nchildren - 1 - idx) * sizeof(haddr_t));
bt->nchildren -= 1;
bt_flags |= H5AC__DIRTIED_FLAG;
ret_value = H5B_INS_NOOP;
} /* end else */
- } else /* H5B_INS_REMOVE != ret_value */
+ }
+ else /* H5B_INS_REMOVE != ret_value */
ret_value = H5B_INS_NOOP;
/* Patch keys in neighboring trees if necessary */
- if(*lt_key_changed && H5F_addr_defined(bt->left)) {
+ if (*lt_key_changed && H5F_addr_defined(bt->left)) {
HDassert(type->critical_key == H5B_LEFT);
HDassert(level > 0);
/* Update the rightmost key in the left sibling */
- if(NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->left, &cache_udata, H5AC__NO_FLAGS_SET)))
+ if (NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->left, &cache_udata, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to protect node")
- H5MM_memcpy(H5B_NKEY(sibling, shared, sibling->nchildren),
- H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
+ H5MM_memcpy(H5B_NKEY(sibling, shared, sibling->nchildren), H5B_NKEY(bt, shared, 0),
+ type->sizeof_nkey);
- if(H5AC_unprotect(f, H5AC_BT, bt->left, sibling, H5AC__DIRTIED_FLAG) < 0)
+ if (H5AC_unprotect(f, H5AC_BT, bt->left, sibling, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node from tree")
- sibling = NULL; /* Make certain future references will be caught */
- } /* end if */
- else if(*rt_key_changed && H5F_addr_defined(bt->right)) {
+ sibling = NULL; /* Make certain future references will be caught */
+ } /* end if */
+ else if (*rt_key_changed && H5F_addr_defined(bt->right)) {
HDassert(type->critical_key == H5B_RIGHT);
HDassert(level > 0);
/* Update the lefttmost key in the right sibling */
- if(NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->right, &cache_udata, H5AC__NO_FLAGS_SET)))
+ if (NULL ==
+ (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->right, &cache_udata, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to protect node")
- H5MM_memcpy(H5B_NKEY(sibling, shared, 0),
- H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey);
+ H5MM_memcpy(H5B_NKEY(sibling, shared, 0), H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey);
- if(H5AC_unprotect(f, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0)
+ if (H5AC_unprotect(f, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node from tree")
- sibling = NULL; /* Make certain future references will be caught */
- } /* end else */
+ sibling = NULL; /* Make certain future references will be caught */
+ } /* end else */
done:
- if(bt && H5AC_unprotect(f, H5AC_BT, addr, bt, bt_flags) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node")
+ if (bt && H5AC_unprotect(f, H5AC_BT, addr, bt, bt_flags) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B__remove_helper() */
-
/*-------------------------------------------------------------------------
* Function: H5B_remove
*
@@ -1560,12 +1555,12 @@ herr_t
H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
{
/* These are defined this way to satisfy alignment constraints */
- uint64_t _lt_key[128], _rt_key[128];
- uint8_t *lt_key = (uint8_t*)_lt_key; /*left key*/
- uint8_t *rt_key = (uint8_t*)_rt_key; /*right key*/
- hbool_t lt_key_changed = FALSE; /*left key changed?*/
- hbool_t rt_key_changed = FALSE; /*right key changed?*/
- herr_t ret_value = SUCCEED; /* Return value */
+ uint64_t _lt_key[128], _rt_key[128];
+ uint8_t *lt_key = (uint8_t *)_lt_key; /*left key*/
+ uint8_t *rt_key = (uint8_t *)_rt_key; /*right key*/
+ hbool_t lt_key_changed = FALSE; /*left key changed?*/
+ hbool_t rt_key_changed = FALSE; /*right key changed?*/
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1576,8 +1571,9 @@ H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
HDassert(H5F_addr_defined(addr));
/* The actual removal */
- if(H5B_INS_ERROR == H5B__remove_helper(f, addr, type, 0, lt_key, &lt_key_changed, udata, rt_key, &rt_key_changed))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to remove entry from B-tree")
+ if (H5B_INS_ERROR ==
+ H5B__remove_helper(f, addr, type, 0, lt_key, &lt_key_changed, udata, rt_key, &rt_key_changed))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to remove entry from B-tree")
#ifdef H5B_DEBUG
H5B__assert(f, addr, type, udata);
@@ -1586,7 +1582,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_remove() */
-
/*-------------------------------------------------------------------------
* Function: H5B_delete
*
@@ -1603,12 +1598,12 @@ done:
herr_t
H5B_delete(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
{
- H5B_t *bt = NULL; /* B-tree node being operated on */
- H5UC_t *rc_shared; /* Ref-counted shared info */
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_t * bt = NULL; /* B-tree node being operated on */
+ H5UC_t * rc_shared; /* Ref-counted shared info */
+ H5B_shared_t * shared; /* Pointer to shared B-tree info */
H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1618,23 +1613,23 @@ H5B_delete(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
HDassert(H5F_addr_defined(addr));
/* Get shared info for B-tree */
- if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ if (NULL == (rc_shared = (type->get_shared)(f, udata)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared);
HDassert(shared);
/* Lock this B-tree node into memory for now */
- cache_udata.f = f;
- cache_udata.type = type;
+ cache_udata.f = f;
+ cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__NO_FLAGS_SET)))
+ if (NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
/* Iterate over all children in tree, deleting them */
- if(bt->level > 0) {
+ if (bt->level > 0) {
/* Iterate over all children in node, deleting them */
- for(u = 0; u < bt->nchildren; u++)
- if(H5B_delete(f, type, bt->child[u], udata) < 0)
+ for (u = 0; u < bt->nchildren; u++)
+ if (H5B_delete(f, type, bt->child[u], udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "unable to delete B-tree node")
} /* end if */
@@ -1642,26 +1637,24 @@ H5B_delete(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
hbool_t lt_key_changed, rt_key_changed; /* Whether key changed (unused here, just for callback) */
/* Check for removal callback */
- if(type->remove) {
+ if (type->remove) {
/* Iterate over all entries in node, calling callback */
- for(u = 0; u < bt->nchildren; u++) {
+ for (u = 0; u < bt->nchildren; u++) {
/* Call user's callback for each entry */
- if((type->remove)(f, bt->child[u], H5B_NKEY(bt, shared, u),
- &lt_key_changed, udata, H5B_NKEY(bt, shared, u + 1),
- &rt_key_changed) < H5B_INS_NOOP)
+ if ((type->remove)(f, bt->child[u], H5B_NKEY(bt, shared, u), &lt_key_changed, udata,
+ H5B_NKEY(bt, shared, u + 1), &rt_key_changed) < H5B_INS_NOOP)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't remove B-tree node")
} /* end for */
- } /* end if */
- } /* end else */
+ } /* end if */
+ } /* end else */
done:
- if(bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
+ if (bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node in cache")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5B_shared_new
*
@@ -1678,9 +1671,9 @@ done:
H5B_shared_t *
H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey)
{
- H5B_shared_t *shared = NULL; /* New shared B-tree struct */
- size_t u; /* Local index variable */
- H5B_shared_t *ret_value = NULL; /* Return value */
+ H5B_shared_t *shared = NULL; /* New shared B-tree struct */
+ size_t u; /* Local index variable */
+ H5B_shared_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1690,43 +1683,43 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey)
HDassert(type);
/* Allocate space for the shared structure */
- if(NULL == (shared = H5FL_CALLOC(H5B_shared_t)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for shared B-tree info")
+ if (NULL == (shared = H5FL_CALLOC(H5B_shared_t)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for shared B-tree info")
/* Set up the "global" information for this file's groups */
- shared->type = type;
- shared->two_k = 2 * H5F_KVALUE(f, type);
+ shared->type = type;
+ shared->two_k = 2 * H5F_KVALUE(f, type);
shared->sizeof_addr = H5F_SIZEOF_ADDR(f);
- shared->sizeof_len = H5F_SIZEOF_SIZE(f);
+ shared->sizeof_len = H5F_SIZEOF_SIZE(f);
shared->sizeof_rkey = sizeof_rkey;
HDassert(shared->sizeof_rkey);
- shared->sizeof_keys = (shared->two_k + 1) * type->sizeof_nkey;
- shared->sizeof_rnode = ((size_t)H5B_SIZEOF_HDR(f) + /*node header */
- shared->two_k * H5F_SIZEOF_ADDR(f) + /*child pointers */
- (shared->two_k + 1) * shared->sizeof_rkey); /*keys */
+ shared->sizeof_keys = (shared->two_k + 1) * type->sizeof_nkey;
+ shared->sizeof_rnode = ((size_t)H5B_SIZEOF_HDR(f) + /*node header */
+ shared->two_k * H5F_SIZEOF_ADDR(f) + /*child pointers */
+ (shared->two_k + 1) * shared->sizeof_rkey); /*keys */
HDassert(shared->sizeof_rnode);
/* Allocate and clear shared buffers */
- if(NULL == (shared->page = H5FL_BLK_MALLOC(page, shared->sizeof_rnode)))
+ if (NULL == (shared->page = H5FL_BLK_MALLOC(page, shared->sizeof_rnode)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree page")
HDmemset(shared->page, 0, shared->sizeof_rnode);
- if(NULL == (shared->nkey = H5FL_SEQ_MALLOC(size_t, (size_t)(shared->two_k + 1))))
+ if (NULL == (shared->nkey = H5FL_SEQ_MALLOC(size_t, (size_t)(shared->two_k + 1))))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree native keys")
/* Initialize the offsets into the native key buffer */
- for(u = 0; u < (shared->two_k + 1); u++)
+ for (u = 0; u < (shared->two_k + 1); u++)
shared->nkey[u] = u * type->sizeof_nkey;
/* Set return value */
ret_value = shared;
done:
- if(NULL == ret_value)
- if(shared) {
- if(shared->page)
+ if (NULL == ret_value)
+ if (shared) {
+ if (shared->page)
shared->page = H5FL_BLK_FREE(page, shared->page);
- if(shared->nkey)
+ if (shared->nkey)
shared->nkey = H5FL_SEQ_FREE(size_t, shared->nkey);
shared = H5FL_FREE(H5B_shared_t, shared);
} /* end if */
@@ -1734,7 +1727,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_shared_new() */
-
/*-------------------------------------------------------------------------
* Function: H5B_shared_free
*
@@ -1766,7 +1758,6 @@ H5B_shared_free(void *_shared)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5B_shared_free() */
-
/*-------------------------------------------------------------------------
* Function: H5B__copy
*
@@ -1784,9 +1775,9 @@ H5B_shared_free(void *_shared)
static H5B_t *
H5B__copy(const H5B_t *old_bt)
{
- H5B_t *new_node = NULL;
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
- H5B_t *ret_value = NULL; /* Return value */
+ H5B_t * new_node = NULL;
+ H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_t * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -1798,7 +1789,7 @@ H5B__copy(const H5B_t *old_bt)
HDassert(shared);
/* Allocate memory for the new H5B_t object */
- if(NULL == (new_node = H5FL_MALLOC(H5B_t)))
+ if (NULL == (new_node = H5FL_MALLOC(H5B_t)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node")
/* Copy the main structure */
@@ -1807,8 +1798,8 @@ H5B__copy(const H5B_t *old_bt)
/* Reset cache info */
HDmemset(&new_node->cache_info, 0, sizeof(H5AC_info_t));
- if(NULL == (new_node->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) ||
- NULL == (new_node->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k)))
+ if (NULL == (new_node->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) ||
+ NULL == (new_node->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node")
/* Copy the other structures */
@@ -1822,18 +1813,17 @@ H5B__copy(const H5B_t *old_bt)
ret_value = new_node;
done:
- if(NULL == ret_value) {
- if(new_node) {
- new_node->native = H5FL_BLK_FREE(native_block, new_node->native);
- new_node->child = H5FL_SEQ_FREE(haddr_t, new_node->child);
- new_node = H5FL_FREE(H5B_t, new_node);
+ if (NULL == ret_value) {
+ if (new_node) {
+ new_node->native = H5FL_BLK_FREE(native_block, new_node->native);
+ new_node->child = H5FL_SEQ_FREE(haddr_t, new_node->child);
+ new_node = H5FL_FREE(H5B_t, new_node);
} /* end if */
- } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B__copy() */
-
/*-------------------------------------------------------------------------
* Function: H5B__get_info_helper
*
@@ -1847,18 +1837,17 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B__get_info_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr,
- const H5B_info_ud_t *info_udata)
+H5B__get_info_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr, const H5B_info_ud_t *info_udata)
{
- H5B_t *bt = NULL; /* Pointer to current B-tree node */
- H5UC_t *rc_shared; /* Ref-counted shared info */
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
- H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
- unsigned level; /* Node level */
- size_t sizeof_rnode; /* Size of raw (disk) node */
- haddr_t next_addr; /* Address of next node to the right */
- haddr_t left_child; /* Address of left-most child in node */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B_t * bt = NULL; /* Pointer to current B-tree node */
+ H5UC_t * rc_shared; /* Ref-counted shared info */
+ H5B_shared_t * shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
+ unsigned level; /* Node level */
+ size_t sizeof_rnode; /* Size of raw (disk) node */
+ haddr_t next_addr; /* Address of next node to the right */
+ haddr_t left_child; /* Address of left-most child in node */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1873,7 +1862,7 @@ H5B__get_info_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr,
HDassert(info_udata->udata);
/* Get shared info for B-tree */
- if(NULL == (rc_shared = (type->get_shared)(f, info_udata->udata)))
+ if (NULL == (rc_shared = (type->get_shared)(f, info_udata->udata)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared);
HDassert(shared);
@@ -1882,23 +1871,23 @@ H5B__get_info_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr,
sizeof_rnode = shared->sizeof_rnode;
/* Protect the initial/current node */
- cache_udata.f = f;
- cache_udata.type = type;
+ cache_udata.f = f;
+ cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
/* Cache information from this node */
left_child = bt->child[0];
- next_addr = bt->right;
- level = bt->level;
+ next_addr = bt->right;
+ level = bt->level;
/* Update B-tree info */
info_udata->bt_info->size += sizeof_rnode;
info_udata->bt_info->num_nodes++;
/* Release current node */
- if(H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
bt = NULL;
@@ -1906,10 +1895,10 @@ H5B__get_info_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr,
* Follow the right-sibling pointer from node to node until we've
* processed all nodes.
*/
- while(H5F_addr_defined(next_addr)) {
+ while (H5F_addr_defined(next_addr)) {
/* Protect the next node to the right */
addr = next_addr;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "B-tree node")
/* Cache information from this node */
@@ -1920,26 +1909,25 @@ H5B__get_info_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr,
info_udata->bt_info->num_nodes++;
/* Unprotect node */
- if(H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
bt = NULL;
} /* end while */
/* Check for another "row" of B-tree nodes to iterate over */
- if(level > 0) {
- /* Keep following the left-most child until we reach a leaf node. */
- if(H5B__get_info_helper(f, type, left_child, info_udata) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "unable to list B-tree node")
+ if (level > 0) {
+ /* Keep following the left-most child until we reach a leaf node. */
+ if (H5B__get_info_helper(f, type, left_child, info_udata) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "unable to list B-tree node")
} /* end if */
done:
- if(bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B__get_info_helper() */
-
/*-------------------------------------------------------------------------
* Function: H5B_get_info
*
@@ -1953,11 +1941,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B_get_info(H5F_t *f, const H5B_class_t *type, haddr_t addr,
- H5B_info_t *bt_info, H5B_operator_t op, void *udata)
+H5B_get_info(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_info_t *bt_info, H5B_operator_t op,
+ void *udata)
{
- H5B_info_ud_t info_udata; /* User-data for B-tree size iteration */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B_info_ud_t info_udata; /* User-data for B-tree size iteration */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1975,23 +1963,22 @@ H5B_get_info(H5F_t *f, const H5B_class_t *type, haddr_t addr,
/* Set up internal user-data for the B-tree 'get info' helper routine */
info_udata.bt_info = bt_info;
- info_udata.udata = udata;
+ info_udata.udata = udata;
/* Iterate over the B-tree nodes */
- if(H5B__get_info_helper(f, type, addr, &info_udata) < 0)
+ if (H5B__get_info_helper(f, type, addr, &info_udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_BADITER, FAIL, "B-tree iteration failed")
/* Iterate over the B-tree records, making any "leaf" callbacks */
/* (Only if operator defined) */
- if(op)
- if((ret_value = H5B__iterate_helper(f, type, addr, op, udata)) < 0)
+ if (op)
+ if ((ret_value = H5B__iterate_helper(f, type, addr, op, udata)) < 0)
HERROR(H5E_BTREE, H5E_BADITER, "B-tree iteration failed");
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_get_info() */
-
/*-------------------------------------------------------------------------
* Function: H5B_valid
*
@@ -2007,10 +1994,10 @@ done:
htri_t
H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr)
{
- H5B_t *bt = NULL; /* The B-tree */
- H5UC_t *rc_shared; /* Ref-counted shared info */
- H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
- htri_t ret_value = SUCCEED; /* Return value */
+ H5B_t * bt = NULL; /* The B-tree */
+ H5UC_t * rc_shared; /* Ref-counted shared info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
+ htri_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2020,32 +2007,31 @@ H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr)
HDassert(f);
HDassert(type);
- if(!H5F_addr_defined(addr))
+ if (!H5F_addr_defined(addr))
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, FAIL, "address is undefined")
/* Get shared info for B-tree */
- if(NULL == (rc_shared = (type->get_shared)(f, NULL)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
+ if (NULL == (rc_shared = (type->get_shared)(f, NULL)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
HDassert(H5UC_GET_OBJ(rc_shared) != NULL);
/*
* Load the tree node.
*/
- cache_udata.f = f;
- cache_udata.type = type;
+ cache_udata.f = f;
+ cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree node")
+ if (NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree node")
done:
/* Release the node */
- if(bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_valid() */
-
/*-------------------------------------------------------------------------
* Function: H5B__node_dest
*
@@ -2068,11 +2054,10 @@ H5B__node_dest(H5B_t *bt)
HDassert(bt);
HDassert(bt->rc_shared);
- bt->child = H5FL_SEQ_FREE(haddr_t, bt->child);
+ bt->child = H5FL_SEQ_FREE(haddr_t, bt->child);
bt->native = H5FL_BLK_FREE(native_block, bt->native);
H5UC_DEC(bt->rc_shared);
bt = H5FL_FREE(H5B_t, bt);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5B__node_dest() */
-
diff --git a/src/H5B2.c b/src/H5B2.c
index 06806aa..2b889dc 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -31,38 +31,32 @@
/* Module Setup */
/****************/
-#include "H5B2module.h" /* This source code file is part of the H5B2 module */
-
+#include "H5B2module.h" /* This source code file is part of the H5B2 module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5B2pkg.h" /* v2 B-trees */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5B2pkg.h" /* v2 B-trees */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
@@ -90,27 +84,25 @@ extern const H5B2_class_t H5D_BT2_FILT[1];
extern const H5B2_class_t H5B2_TEST2[1];
const H5B2_class_t *const H5B2_client_class_g[] = {
- H5B2_TEST, /* 0 - H5B2_TEST_ID */
- H5HF_HUGE_BT2_INDIR, /* 1 - H5B2_FHEAP_HUGE_INDIR_ID */
- H5HF_HUGE_BT2_FILT_INDIR, /* 2 - H5B2_FHEAP_HUGE_FILT_INDIR_ID */
- H5HF_HUGE_BT2_DIR, /* 3 - H5B2_FHEAP_HUGE_DIR_ID */
- H5HF_HUGE_BT2_FILT_DIR, /* 4 - H5B2_FHEAP_HUGE_FILT_DIR_ID */
- H5G_BT2_NAME, /* 5 - H5B2_GRP_DENSE_NAME_ID */
- H5G_BT2_CORDER, /* 6 - H5B2_GRP_DENSE_CORDER_ID */
- H5SM_INDEX, /* 7 - H5B2_SOHM_INDEX_ID */
- H5A_BT2_NAME, /* 8 - H5B2_ATTR_DENSE_NAME_ID */
- H5A_BT2_CORDER, /* 9 - H5B2_ATTR_DENSE_CORDER_ID */
- H5D_BT2, /* 10 - H5B2_CDSET_ID */
- H5D_BT2_FILT, /* 11 - H5B2_CDSET_FILT_ID */
- H5B2_TEST2 /* 12 - H5B2_TEST_ID */
+ H5B2_TEST, /* 0 - H5B2_TEST_ID */
+ H5HF_HUGE_BT2_INDIR, /* 1 - H5B2_FHEAP_HUGE_INDIR_ID */
+ H5HF_HUGE_BT2_FILT_INDIR, /* 2 - H5B2_FHEAP_HUGE_FILT_INDIR_ID */
+ H5HF_HUGE_BT2_DIR, /* 3 - H5B2_FHEAP_HUGE_DIR_ID */
+ H5HF_HUGE_BT2_FILT_DIR, /* 4 - H5B2_FHEAP_HUGE_FILT_DIR_ID */
+ H5G_BT2_NAME, /* 5 - H5B2_GRP_DENSE_NAME_ID */
+ H5G_BT2_CORDER, /* 6 - H5B2_GRP_DENSE_CORDER_ID */
+ H5SM_INDEX, /* 7 - H5B2_SOHM_INDEX_ID */
+ H5A_BT2_NAME, /* 8 - H5B2_ATTR_DENSE_NAME_ID */
+ H5A_BT2_CORDER, /* 9 - H5B2_ATTR_DENSE_CORDER_ID */
+ H5D_BT2, /* 10 - H5B2_CDSET_ID */
+ H5D_BT2_FILT, /* 11 - H5B2_CDSET_FILT_ID */
+ H5B2_TEST2 /* 12 - H5B2_TEST_ID */
};
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -118,8 +110,6 @@ const H5B2_class_t *const H5B2_client_class_g[] = {
/* Declare a free list to manage the H5B2_t struct */
H5FL_DEFINE_STATIC(H5B2_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5B2_create
*
@@ -136,10 +126,10 @@ H5FL_DEFINE_STATIC(H5B2_t);
H5B2_t *
H5B2_create(H5F_t *f, const H5B2_create_t *cparam, void *ctx_udata)
{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
- H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
- haddr_t hdr_addr; /* B-tree header address */
- H5B2_t *ret_value = NULL; /* Return value */
+ H5B2_t * bt2 = NULL; /* Pointer to the B-tree */
+ H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
+ haddr_t hdr_addr; /* B-tree header address */
+ H5B2_t * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -153,25 +143,27 @@ H5B2_create(H5F_t *f, const H5B2_create_t *cparam, void *ctx_udata)
HDcompile_assert(H5B2_NUM_BTREE_ID == NELMTS(H5B2_client_class_g));
/* Create shared v2 B-tree header */
- if(HADDR_UNDEF == (hdr_addr = H5B2__hdr_create(f, cparam, ctx_udata)))
+ if (HADDR_UNDEF == (hdr_addr = H5B2__hdr_create(f, cparam, ctx_udata)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't create v2 B-tree header")
/* Create v2 B-tree wrapper */
- if(NULL == (bt2 = H5FL_MALLOC(H5B2_t)))
+ if (NULL == (bt2 = H5FL_MALLOC(H5B2_t)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for v2 B-tree info")
/* Look up the B-tree header */
- if(NULL == (hdr = H5B2__hdr_protect(f, hdr_addr, ctx_udata, H5AC__NO_FLAGS_SET)))
+ if (NULL == (hdr = H5B2__hdr_protect(f, hdr_addr, ctx_udata, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header")
/* Point v2 B-tree wrapper at header and bump it's ref count */
bt2->hdr = hdr;
- if(H5B2__hdr_incr(bt2->hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment reference count on shared v2 B-tree header")
+ if (H5B2__hdr_incr(bt2->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL,
+ "can't increment reference count on shared v2 B-tree header")
/* Increment # of files using this v2 B-tree header */
- if(H5B2__hdr_fuse_incr(bt2->hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment file reference count on shared v2 B-tree header")
+ if (H5B2__hdr_fuse_incr(bt2->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL,
+ "can't increment file reference count on shared v2 B-tree header")
/* Set file pointer for this v2 B-tree open context */
bt2->f = f;
@@ -180,16 +172,15 @@ H5B2_create(H5F_t *f, const H5B2_create_t *cparam, void *ctx_udata)
ret_value = bt2;
done:
- if(hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
+ if (hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to release v2 B-tree header")
- if(!ret_value && bt2)
- if(H5B2_close(bt2) < 0)
+ if (!ret_value && bt2)
+ if (H5B2_close(bt2) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, NULL, "unable to close v2 B-tree")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2_create() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_open
*
@@ -206,9 +197,9 @@ done:
H5B2_t *
H5B2_open(H5F_t *f, haddr_t addr, void *ctx_udata)
{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
- H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
- H5B2_t *ret_value = NULL; /* Return value */
+ H5B2_t * bt2 = NULL; /* Pointer to the B-tree */
+ H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
+ H5B2_t * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -217,25 +208,27 @@ H5B2_open(H5F_t *f, haddr_t addr, void *ctx_udata)
HDassert(H5F_addr_defined(addr));
/* Look up the B-tree header */
- if(NULL == (hdr = H5B2__hdr_protect(f, addr, ctx_udata, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (hdr = H5B2__hdr_protect(f, addr, ctx_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header")
/* Check for pending heap deletion */
- if(hdr->pending_delete)
+ if (hdr->pending_delete)
HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, NULL, "can't open v2 B-tree pending deletion")
/* Create v2 B-tree info */
- if(NULL == (bt2 = H5FL_MALLOC(H5B2_t)))
+ if (NULL == (bt2 = H5FL_MALLOC(H5B2_t)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for v2 B-tree info")
/* Point v2 B-tree wrapper at header */
bt2->hdr = hdr;
- if(H5B2__hdr_incr(bt2->hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment reference count on shared v2 B-tree header")
+ if (H5B2__hdr_incr(bt2->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL,
+ "can't increment reference count on shared v2 B-tree header")
/* Increment # of files using this v2 B-tree header */
- if(H5B2__hdr_fuse_incr(bt2->hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment file reference count on shared v2 B-tree header")
+ if (H5B2__hdr_fuse_incr(bt2->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL,
+ "can't increment file reference count on shared v2 B-tree header")
/* Set file pointer for this v2 B-tree open context */
bt2->f = f;
@@ -244,16 +237,15 @@ H5B2_open(H5F_t *f, haddr_t addr, void *ctx_udata)
ret_value = bt2;
done:
- if(hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
+ if (hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to release v2 B-tree header")
- if(!ret_value && bt2)
- if(H5B2_close(bt2) < 0)
+ if (!ret_value && bt2)
+ if (H5B2_close(bt2) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, NULL, "unable to close v2 B-tree")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_open() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_insert
*
@@ -269,8 +261,8 @@ done:
herr_t
H5B2_insert(H5B2_t *bt2, void *udata)
{
- H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -285,14 +277,13 @@ H5B2_insert(H5B2_t *bt2, void *udata)
hdr = bt2->hdr;
/* Insert the record */
- if(H5B2__insert(hdr, udata) < 0)
+ if (H5B2__insert(hdr, udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_insert() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_update
*
@@ -311,9 +302,9 @@ done:
herr_t
H5B2_update(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data)
{
- H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
- H5B2_update_status_t status = H5B2_UPDATE_UNKNOWN; /* Whether the record was inserted/modified */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t * hdr; /* Pointer to the B-tree header */
+ H5B2_update_status_t status = H5B2_UPDATE_UNKNOWN; /* Whether the record was inserted/modified */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -328,19 +319,20 @@ H5B2_update(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data)
hdr = bt2->hdr;
/* Check if the root node is allocated yet */
- if(!H5F_addr_defined(hdr->root.addr)) {
+ if (!H5F_addr_defined(hdr->root.addr)) {
/* Create root node as leaf node in B-tree */
- if(H5B2__create_leaf(hdr, hdr, &(hdr->root)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node")
+ if (H5B2__create_leaf(hdr, hdr, &(hdr->root)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node")
} /* end if */
/* Attempt to insert record into B-tree */
- if(hdr->depth > 0) {
- if(H5B2__update_internal(hdr, hdr->depth, NULL, &hdr->root, &status, H5B2_POS_ROOT, hdr, udata, op, op_data) < 0)
+ if (hdr->depth > 0) {
+ if (H5B2__update_internal(hdr, hdr->depth, NULL, &hdr->root, &status, H5B2_POS_ROOT, hdr, udata, op,
+ op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in B-tree internal node")
} /* end if */
else {
- if(H5B2__update_leaf(hdr, &hdr->root, &status, H5B2_POS_ROOT, hdr, udata, op, op_data) < 0)
+ if (H5B2__update_leaf(hdr, &hdr->root, &status, H5B2_POS_ROOT, hdr, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in B-tree leaf node")
} /* end else */
@@ -348,13 +340,13 @@ H5B2_update(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data)
HDassert(H5B2_UPDATE_UNKNOWN != status);
/* Use insert algorithm if nodes to leaf full */
- if(H5B2_UPDATE_INSERT_CHILD_FULL == status) {
- if(H5B2__insert(hdr, udata) < 0)
+ if (H5B2_UPDATE_INSERT_CHILD_FULL == status) {
+ if (H5B2__insert(hdr, udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree")
} /* end if */
- else if(H5B2_UPDATE_SHADOW_DONE == status || H5B2_UPDATE_INSERT_DONE == status) {
+ else if (H5B2_UPDATE_SHADOW_DONE == status || H5B2_UPDATE_INSERT_DONE == status) {
/* Mark B-tree header as dirty */
- if(H5B2__hdr_dirty(hdr) < 0)
+ if (H5B2__hdr_dirty(hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty")
} /* end else-if */
else {
@@ -366,7 +358,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_update() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_get_addr
*
@@ -396,7 +387,6 @@ H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr_p)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5B2_get_addr() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_iterate
*
@@ -416,8 +406,8 @@ H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr_p)
herr_t
H5B2_iterate(H5B2_t *bt2, H5B2_operator_t op, void *op_data)
{
- H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOERR
@@ -432,15 +422,14 @@ H5B2_iterate(H5B2_t *bt2, H5B2_operator_t op, void *op_data)
hdr = bt2->hdr;
/* Iterate through records */
- if(hdr->root.node_nrec > 0)
+ if (hdr->root.node_nrec > 0)
/* Iterate through nodes */
- if((ret_value = H5B2__iterate_node(hdr, hdr->depth, &hdr->root, hdr, op, op_data)) < 0)
+ if ((ret_value = H5B2__iterate_node(hdr, hdr->depth, &hdr->root, hdr, op, op_data)) < 0)
HERROR(H5E_BTREE, H5E_CANTLIST, "node iteration failed");
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_iterate() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_find
*
@@ -466,14 +455,14 @@ H5B2_iterate(H5B2_t *bt2, H5B2_operator_t op, void *op_data)
htri_t
H5B2_find(H5B2_t *bt2, void *udata, H5B2_found_t op, void *op_data)
{
- H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
- H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */
- void *parent = NULL; /* Parent of current node */
- uint16_t depth; /* Current depth of the tree */
- int cmp; /* Comparison value of records */
- unsigned idx; /* Location of record which matches key */
- H5B2_nodepos_t curr_pos; /* Position of the current node */
- htri_t ret_value = TRUE; /* Return value */
+ H5B2_hdr_t * hdr; /* Pointer to the B-tree header */
+ H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */
+ void * parent = NULL; /* Parent of current node */
+ uint16_t depth; /* Current depth of the tree */
+ int cmp; /* Comparison value of records */
+ unsigned idx; /* Location of record which matches key */
+ H5B2_nodepos_t curr_pos; /* Position of the current node */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -490,83 +479,87 @@ H5B2_find(H5B2_t *bt2, void *udata, H5B2_found_t op, void *op_data)
curr_node_ptr = hdr->root;
/* Check for empty tree */
- if(curr_node_ptr.node_nrec == 0)
+ if (curr_node_ptr.node_nrec == 0)
HGOTO_DONE(FALSE)
/* Check record against min & max records in tree, to attempt to quickly
* find candidates or avoid further searching.
*/
- if(hdr->min_native_rec != NULL) {
- if((hdr->cls->compare)(udata, hdr->min_native_rec, &cmp) < 0)
+ if (hdr->min_native_rec != NULL) {
+ if ((hdr->cls->compare)(udata, hdr->min_native_rec, &cmp) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
- if(cmp < 0)
- HGOTO_DONE(FALSE) /* Less than the least record--not found */
- else if(cmp == 0) { /* Record is found */
- if(op && (op)(hdr->min_native_rec, op_data) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
- HGOTO_DONE(TRUE)
- } /* end if */
- } /* end if */
- if(hdr->max_native_rec != NULL) {
- if((hdr->cls->compare)(udata, hdr->max_native_rec, &cmp) < 0)
+ if (cmp < 0)
+ HGOTO_DONE(FALSE) /* Less than the least record--not found */
+ else if (cmp == 0) { /* Record is found */
+ if (op && (op)(hdr->min_native_rec, op_data) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL,
+ "'found' callback failed for B-tree find operation")
+ HGOTO_DONE(TRUE)
+ } /* end if */
+ } /* end if */
+ if (hdr->max_native_rec != NULL) {
+ if ((hdr->cls->compare)(udata, hdr->max_native_rec, &cmp) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
- if(cmp > 0)
- HGOTO_DONE(FALSE) /* Less than the least record--not found */
- else if(cmp == 0) { /* Record is found */
- if(op && (op)(hdr->max_native_rec, op_data) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
- HGOTO_DONE(TRUE)
- } /* end if */
- } /* end if */
+ if (cmp > 0)
+ HGOTO_DONE(FALSE) /* Less than the least record--not found */
+ else if (cmp == 0) { /* Record is found */
+ if (op && (op)(hdr->max_native_rec, op_data) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL,
+ "'found' callback failed for B-tree find operation")
+ HGOTO_DONE(TRUE)
+ } /* end if */
+ } /* end if */
/* Current depth of the tree */
depth = hdr->depth;
/* Set initial parent, if doing swmr writes */
- if(hdr->swmr_write)
+ if (hdr->swmr_write)
parent = hdr;
/* Walk down B-tree to find record or leaf node where record is located */
- cmp = -1;
+ cmp = -1;
curr_pos = H5B2_POS_ROOT;
- while(depth > 0) {
- H5B2_internal_t *internal; /* Pointer to internal node in B-tree */
- H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
+ while (depth > 0) {
+ H5B2_internal_t *internal; /* Pointer to internal node in B-tree */
+ H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
/* Lock B-tree current node */
- if(NULL == (internal = H5B2__protect_internal(hdr, parent, &curr_node_ptr, depth, FALSE, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (internal = H5B2__protect_internal(hdr, parent, &curr_node_ptr, depth, FALSE,
+ H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Unpin parent if necessary */
- if(parent) {
- if(parent != hdr && H5AC_unpin_entry(parent) < 0)
+ if (parent) {
+ if (parent != hdr && H5AC_unpin_entry(parent) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry")
parent = NULL;
} /* end if */
/* Locate node pointer for child */
- if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0) {
+ if (H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx,
+ &cmp) < 0) {
/* Unlock current node before failing */
H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET);
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
} /* end if */
- if(cmp > 0)
+ if (cmp > 0)
idx++;
- if(cmp != 0) {
+ if (cmp != 0) {
/* Get node pointer for next node to search */
- next_node_ptr=internal->node_ptrs[idx];
+ next_node_ptr = internal->node_ptrs[idx];
/* Set the position of the next node */
- if(H5B2_POS_MIDDLE != curr_pos) {
- if(idx == 0) {
- if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos)
+ if (H5B2_POS_MIDDLE != curr_pos) {
+ if (idx == 0) {
+ if (H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos)
curr_pos = H5B2_POS_LEFT;
else
curr_pos = H5B2_POS_MIDDLE;
} /* end if */
- else if(idx == internal->nrec) {
- if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos)
+ else if (idx == internal->nrec) {
+ if (H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos)
curr_pos = H5B2_POS_RIGHT;
else
curr_pos = H5B2_POS_MIDDLE;
@@ -576,11 +569,12 @@ H5B2_find(H5B2_t *bt2, void *udata, H5B2_found_t op, void *op_data)
} /* end if */
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal,
+ (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Keep track of parent if necessary */
- if(hdr->swmr_write)
+ if (hdr->swmr_write)
parent = internal;
/* Set pointer to next node to load */
@@ -588,16 +582,18 @@ H5B2_find(H5B2_t *bt2, void *udata, H5B2_found_t op, void *op_data)
} /* end if */
else {
/* Make callback for current record */
- if(op && (op)(H5B2_INT_NREC(internal, hdr, idx), op_data) < 0) {
+ if (op && (op)(H5B2_INT_NREC(internal, hdr, idx), op_data) < 0) {
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) <
+ 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL,
+ "'found' callback failed for B-tree find operation")
} /* end if */
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Indicate record found */
@@ -609,29 +605,30 @@ H5B2_find(H5B2_t *bt2, void *udata, H5B2_found_t op, void *op_data)
} /* end while */
{
- H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
+ H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
/* Lock B-tree leaf node */
- if(NULL == (leaf = H5B2__protect_leaf(hdr, parent, &curr_node_ptr, FALSE, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, &curr_node_ptr, FALSE, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
/* Unpin parent if necessary */
- if(parent) {
- if(parent != hdr && H5AC_unpin_entry(parent) < 0)
+ if (parent) {
+ if (parent != hdr && H5AC_unpin_entry(parent) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry")
parent = NULL;
} /* end if */
/* Locate record */
- if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0) {
+ if (H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) <
+ 0) {
/* Unlock current node before failing */
H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET);
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
} /* end if */
- if(cmp != 0) {
+ if (cmp != 0) {
/* Unlock leaf node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Record not found */
@@ -639,52 +636,54 @@ H5B2_find(H5B2_t *bt2, void *udata, H5B2_found_t op, void *op_data)
} /* end if */
else {
/* Make callback for current record */
- if(op && (op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data) < 0) {
+ if (op && (op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data) < 0) {
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL,
+ "'found' callback failed for B-tree find operation")
} /* end if */
/* Check for record being the min or max for the tree */
/* (Don't use 'else' for the idx check, to allow for root leaf node) */
- if(H5B2_POS_MIDDLE != curr_pos) {
- if(idx == 0) {
- if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
- if(hdr->min_native_rec == NULL)
- if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info")
+ if (H5B2_POS_MIDDLE != curr_pos) {
+ if (idx == 0) {
+ if (H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
+ if (hdr->min_native_rec == NULL)
+ if (NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for v2 B-tree min record info")
H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
- } /* end if */
- if(idx == (unsigned)(leaf->nrec - 1)) {
- if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
- if(hdr->max_native_rec == NULL)
- if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info")
+ } /* end if */
+ if (idx == (unsigned)(leaf->nrec - 1)) {
+ if (H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
+ if (hdr->max_native_rec == NULL)
+ if (NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for v2 B-tree max record info")
H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
- } /* end if */
- } /* end if */
- } /* end else */
+ } /* end if */
+ } /* end if */
+ } /* end else */
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
} /* end block */
done:
- if(parent) {
+ if (parent) {
HDassert(ret_value < 0);
- if(parent != hdr && H5AC_unpin_entry(parent) < 0)
+ if (parent != hdr && H5AC_unpin_entry(parent) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_find() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_index
*
@@ -703,14 +702,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op,
- void *op_data)
+H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op, void *op_data)
{
- H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
- H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */
- void *parent = NULL; /* Parent of current node */
- uint16_t depth; /* Current depth of the tree */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t * hdr; /* Pointer to the B-tree header */
+ H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */
+ void * parent = NULL; /* Parent of current node */
+ uint16_t depth; /* Current depth of the tree */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -728,54 +726,57 @@ H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op,
curr_node_ptr = hdr->root;
/* Check for empty tree */
- if(curr_node_ptr.node_nrec == 0)
+ if (curr_node_ptr.node_nrec == 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree has no records")
/* Check for index greater than the number of records in the tree */
- if(idx >= curr_node_ptr.all_nrec)
+ if (idx >= curr_node_ptr.all_nrec)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree doesn't have that many records")
/* Current depth of the tree */
depth = hdr->depth;
/* Set initial parent, if doing swmr writes */
- if(hdr->swmr_write)
+ if (hdr->swmr_write)
parent = hdr;
/* Check for reverse indexing and map requested index to appropriate forward index */
- if(order == H5_ITER_DEC)
+ if (order == H5_ITER_DEC)
idx = curr_node_ptr.all_nrec - (idx + 1);
/* Walk down B-tree to find record or leaf node where record is located */
- while(depth > 0) {
- H5B2_internal_t *internal; /* Pointer to internal node in B-tree */
- H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
- unsigned u; /* Local index variable */
+ while (depth > 0) {
+ H5B2_internal_t *internal; /* Pointer to internal node in B-tree */
+ H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
+ unsigned u; /* Local index variable */
/* Lock B-tree current node */
- if(NULL == (internal = H5B2__protect_internal(hdr, parent, &curr_node_ptr, depth, FALSE, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (internal = H5B2__protect_internal(hdr, parent, &curr_node_ptr, depth, FALSE,
+ H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Unpin parent if necessary */
- if(parent) {
- if(parent != hdr && H5AC_unpin_entry(parent) < 0)
+ if (parent) {
+ if (parent != hdr && H5AC_unpin_entry(parent) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry")
parent = NULL;
} /* end if */
/* Search for record with correct index */
- for(u = 0; u < internal->nrec; u++) {
+ for (u = 0; u < internal->nrec; u++) {
/* Check if record is in child node */
- if(internal->node_ptrs[u].all_nrec > idx) {
+ if (internal->node_ptrs[u].all_nrec > idx) {
/* Get node pointer for next node to search */
next_node_ptr = internal->node_ptrs[u];
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal,
+ (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) <
+ 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Keep track of parent if necessary */
- if(hdr->swmr_write)
+ if (hdr->swmr_write)
parent = internal;
/* Set pointer to next node to load */
@@ -786,18 +787,21 @@ H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op,
} /* end if */
/* Check if record is in this node */
- if(internal->node_ptrs[u].all_nrec == idx) {
+ if (internal->node_ptrs[u].all_nrec == idx) {
/* Make callback for current record */
- if((op)(H5B2_INT_NREC(internal, hdr, u), op_data) < 0) {
+ if ((op)(H5B2_INT_NREC(internal, hdr, u), op_data) < 0) {
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal,
+ H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL,
+ "'found' callback failed for B-tree find operation")
} /* end if */
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) <
+ 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_DONE(SUCCEED);
@@ -810,18 +814,20 @@ H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op,
} /* end for */
/* Check last node pointer */
- if(u == internal->nrec) {
+ if (u == internal->nrec) {
/* Check if record is in child node */
- if(internal->node_ptrs[u].all_nrec > idx) {
+ if (internal->node_ptrs[u].all_nrec > idx) {
/* Get node pointer for next node to search */
next_node_ptr = internal->node_ptrs[u];
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal,
+ (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) <
+ 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Keep track of parent if necessary */
- if(hdr->swmr_write)
+ if (hdr->swmr_write)
parent = internal;
/* Set pointer to next node to load */
@@ -837,15 +843,15 @@ H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op,
} /* end while */
{
- H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
+ H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
/* Lock B-tree leaf node */
- if(NULL == (leaf = H5B2__protect_leaf(hdr, parent, &curr_node_ptr, FALSE, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, &curr_node_ptr, FALSE, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
/* Unpin parent if necessary */
- if(parent) {
- if(parent != hdr && H5AC_unpin_entry(parent) < 0)
+ if (parent) {
+ if (parent != hdr && H5AC_unpin_entry(parent) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry")
parent = NULL;
} /* end if */
@@ -854,30 +860,29 @@ H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op,
HDassert(idx < leaf->nrec);
/* Make callback for correct record */
- if((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data) < 0) {
+ if ((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data) < 0) {
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
} /* end if */
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
} /* end block */
done:
- if(parent) {
+ if (parent) {
HDassert(ret_value < 0);
- if(parent != hdr && H5AC_unpin_entry(parent) < 0)
+ if (parent != hdr && H5AC_unpin_entry(parent) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_index() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_remove
*
@@ -893,8 +898,8 @@ done:
herr_t
H5B2_remove(H5B2_t *bt2, void *udata, H5B2_remove_t op, void *op_data)
{
- H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -908,34 +913,35 @@ H5B2_remove(H5B2_t *bt2, void *udata, H5B2_remove_t op, void *op_data)
hdr = bt2->hdr;
/* Check for empty B-tree */
- if(0 == hdr->root.all_nrec)
+ if (0 == hdr->root.all_nrec)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree")
/* Attempt to remove record from B-tree */
- if(hdr->depth > 0) {
- hbool_t depth_decreased = FALSE; /* Flag to indicate whether the depth of the B-tree decreased */
+ if (hdr->depth > 0) {
+ hbool_t depth_decreased = FALSE; /* Flag to indicate whether the depth of the B-tree decreased */
- if(H5B2__remove_internal(hdr, &depth_decreased, NULL, NULL,
- hdr->depth, &(hdr->cache_info), NULL, H5B2_POS_ROOT, &hdr->root,
- udata, op, op_data) < 0)
+ if (H5B2__remove_internal(hdr, &depth_decreased, NULL, NULL, hdr->depth, &(hdr->cache_info), NULL,
+ H5B2_POS_ROOT, &hdr->root, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node")
/* Check for decreasing the depth of the B-tree */
- if(depth_decreased) {
+ if (depth_decreased) {
/* Destroy free list factories for previous depth */
- if(hdr->node_info[hdr->depth].nat_rec_fac)
- if(H5FL_fac_term(hdr->node_info[hdr->depth].nat_rec_fac) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy node's native record block factory")
- if(hdr->node_info[hdr->depth].node_ptr_fac)
- if(H5FL_fac_term(hdr->node_info[hdr->depth].node_ptr_fac) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy node's node pointer block factory")
+ if (hdr->node_info[hdr->depth].nat_rec_fac)
+ if (H5FL_fac_term(hdr->node_info[hdr->depth].nat_rec_fac) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL,
+ "can't destroy node's native record block factory")
+ if (hdr->node_info[hdr->depth].node_ptr_fac)
+ if (H5FL_fac_term(hdr->node_info[hdr->depth].node_ptr_fac) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL,
+ "can't destroy node's node pointer block factory")
HDassert((uint16_t)(hdr->depth - depth_decreased) < hdr->depth);
hdr->depth = (uint16_t)(hdr->depth - depth_decreased);
} /* end for */
- } /* end if */
+ } /* end if */
else {
- if(H5B2__remove_leaf(hdr, &hdr->root, H5B2_POS_ROOT, hdr, udata, op, op_data) < 0)
+ if (H5B2__remove_leaf(hdr, &hdr->root, H5B2_POS_ROOT, hdr, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node")
} /* end else */
@@ -943,14 +949,13 @@ H5B2_remove(H5B2_t *bt2, void *udata, H5B2_remove_t op, void *op_data)
hdr->root.all_nrec--;
/* Mark B-tree header as dirty */
- if(H5B2__hdr_dirty(hdr) < 0)
+ if (H5B2__hdr_dirty(hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_remove() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_remove_by_idx
*
@@ -964,11 +969,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_remove_by_idx(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx,
- H5B2_remove_t op, void *op_data)
+H5B2_remove_by_idx(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_remove_t op, void *op_data)
{
- H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -982,42 +986,43 @@ H5B2_remove_by_idx(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx,
hdr = bt2->hdr;
/* Check for empty B-tree */
- if(0 == hdr->root.all_nrec)
+ if (0 == hdr->root.all_nrec)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree")
/* Check for index greater than the number of records in the tree */
- if(idx >= hdr->root.all_nrec)
+ if (idx >= hdr->root.all_nrec)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree doesn't have that many records")
/* Check for reverse indexing and map requested index to appropriate forward index */
- if(H5_ITER_DEC == order)
+ if (H5_ITER_DEC == order)
idx = hdr->root.all_nrec - (idx + 1);
/* Attempt to remove record from B-tree */
- if(hdr->depth > 0) {
- hbool_t depth_decreased = FALSE; /* Flag to indicate whether the depth of the B-tree decreased */
+ if (hdr->depth > 0) {
+ hbool_t depth_decreased = FALSE; /* Flag to indicate whether the depth of the B-tree decreased */
- if(H5B2__remove_internal_by_idx(hdr, &depth_decreased, NULL, NULL,
- hdr->depth, &(hdr->cache_info), NULL, &hdr->root, H5B2_POS_ROOT,
- idx, op, op_data) < 0)
+ if (H5B2__remove_internal_by_idx(hdr, &depth_decreased, NULL, NULL, hdr->depth, &(hdr->cache_info),
+ NULL, &hdr->root, H5B2_POS_ROOT, idx, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node")
/* Check for decreasing the depth of the B-tree */
- if(depth_decreased) {
+ if (depth_decreased) {
/* Destroy free list factories for previous depth */
- if(hdr->node_info[hdr->depth].nat_rec_fac)
- if(H5FL_fac_term(hdr->node_info[hdr->depth].nat_rec_fac) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy node's native record block factory")
- if(hdr->node_info[hdr->depth].node_ptr_fac)
- if(H5FL_fac_term(hdr->node_info[hdr->depth].node_ptr_fac) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy node's node pointer block factory")
+ if (hdr->node_info[hdr->depth].nat_rec_fac)
+ if (H5FL_fac_term(hdr->node_info[hdr->depth].nat_rec_fac) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL,
+ "can't destroy node's native record block factory")
+ if (hdr->node_info[hdr->depth].node_ptr_fac)
+ if (H5FL_fac_term(hdr->node_info[hdr->depth].node_ptr_fac) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL,
+ "can't destroy node's node pointer block factory")
HDassert((uint16_t)(hdr->depth - depth_decreased) < hdr->depth);
hdr->depth = (uint16_t)(hdr->depth - depth_decreased);
} /* end for */
- } /* end if */
+ } /* end if */
else {
- if(H5B2__remove_leaf_by_idx(hdr, &hdr->root, H5B2_POS_ROOT, hdr, (unsigned)idx, op, op_data) < 0)
+ if (H5B2__remove_leaf_by_idx(hdr, &hdr->root, H5B2_POS_ROOT, hdr, (unsigned)idx, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node")
} /* end else */
@@ -1025,14 +1030,13 @@ H5B2_remove_by_idx(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx,
hdr->root.all_nrec--;
/* Mark B-tree header as dirty */
- if(H5B2__hdr_dirty(hdr) < 0)
+ if (H5B2__hdr_dirty(hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_remove_by_idx() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_get_nrec
*
@@ -1060,7 +1064,6 @@ H5B2_get_nrec(const H5B2_t *bt2, hsize_t *nrec)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2_get_nrec() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_neighbor
*
@@ -1086,11 +1089,10 @@ H5B2_get_nrec(const H5B2_t *bt2, hsize_t *nrec)
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_neighbor(H5B2_t *bt2, H5B2_compare_t range, void *udata,
- H5B2_found_t op, void *op_data)
+H5B2_neighbor(H5B2_t *bt2, H5B2_compare_t range, void *udata, H5B2_found_t op, void *op_data)
{
- H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1105,16 +1107,17 @@ H5B2_neighbor(H5B2_t *bt2, H5B2_compare_t range, void *udata,
hdr = bt2->hdr;
/* Check for empty tree */
- if(!H5F_addr_defined(hdr->root.addr))
+ if (!H5F_addr_defined(hdr->root.addr))
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree has no records")
/* Attempt to find neighbor record in B-tree */
- if(hdr->depth > 0) {
- if(H5B2__neighbor_internal(hdr, hdr->depth, &hdr->root, NULL, range, hdr, udata, op, op_data) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree internal node")
+ if (hdr->depth > 0) {
+ if (H5B2__neighbor_internal(hdr, hdr->depth, &hdr->root, NULL, range, hdr, udata, op, op_data) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL,
+ "unable to find neighbor record in B-tree internal node")
} /* end if */
else {
- if(H5B2__neighbor_leaf(hdr, &hdr->root, NULL, range, hdr, udata, op, op_data) < 0)
+ if (H5B2__neighbor_leaf(hdr, &hdr->root, NULL, range, hdr, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree leaf node")
} /* end else */
@@ -1122,7 +1125,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_neighbor() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_modify
*
@@ -1145,14 +1147,14 @@ done:
herr_t
H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data)
{
- H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
- H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */
- void *parent = NULL; /* Parent of current node */
- H5B2_nodepos_t curr_pos; /* Position of current node */
- uint16_t depth; /* Current depth of the tree */
- int cmp; /* Comparison value of records */
- unsigned idx; /* Location of record which matches key */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t * hdr; /* Pointer to the B-tree header */
+ H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */
+ void * parent = NULL; /* Parent of current node */
+ H5B2_nodepos_t curr_pos; /* Position of current node */
+ uint16_t depth; /* Current depth of the tree */
+ int cmp; /* Comparison value of records */
+ unsigned idx; /* Location of record which matches key */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1170,59 +1172,61 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data)
curr_node_ptr = hdr->root;
/* Check for empty tree */
- if(0 == curr_node_ptr.node_nrec)
+ if (0 == curr_node_ptr.node_nrec)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree has no records")
/* Current depth of the tree */
depth = hdr->depth;
/* Set initial parent, if doing swmr writes */
- if(hdr->swmr_write)
+ if (hdr->swmr_write)
parent = hdr;
/* Walk down B-tree to find record or leaf node where record is located */
- cmp = -1;
+ cmp = -1;
curr_pos = H5B2_POS_ROOT;
- while(depth > 0) {
- unsigned internal_flags = H5AC__NO_FLAGS_SET;
- H5B2_internal_t *internal; /* Pointer to internal node in B-tree */
- H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
+ while (depth > 0) {
+ unsigned internal_flags = H5AC__NO_FLAGS_SET;
+ H5B2_internal_t *internal; /* Pointer to internal node in B-tree */
+ H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
/* Lock B-tree current node */
- if(NULL == (internal = H5B2__protect_internal(hdr, parent, &curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL == (internal = H5B2__protect_internal(hdr, parent, &curr_node_ptr, depth, FALSE,
+ H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Unpin parent if necessary */
- if(parent) {
- if(parent != hdr && H5AC_unpin_entry(parent) < 0)
+ if (parent) {
+ if (parent != hdr && H5AC_unpin_entry(parent) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry")
parent = NULL;
} /* end if */
/* Locate node pointer for child */
- if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0) {
+ if (H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx,
+ &cmp) < 0) {
/* Unlock current node before failing */
H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET);
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
} /* end if */
- if(cmp > 0)
+ if (cmp > 0)
idx++;
- if(cmp != 0) {
+ if (cmp != 0) {
/* Get node pointer for next node to search */
next_node_ptr = internal->node_ptrs[idx];
/* Set the position of the next node */
- if(H5B2_POS_MIDDLE != curr_pos) {
- if(idx == 0) {
- if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos)
+ if (H5B2_POS_MIDDLE != curr_pos) {
+ if (idx == 0) {
+ if (H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos)
curr_pos = H5B2_POS_LEFT;
else
curr_pos = H5B2_POS_MIDDLE;
} /* end if */
- else if(idx == internal->nrec) {
- if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos)
+ else if (idx == internal->nrec) {
+ if (H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos)
curr_pos = H5B2_POS_RIGHT;
else
curr_pos = H5B2_POS_MIDDLE;
@@ -1232,36 +1236,39 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data)
} /* end if */
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal,
+ (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Keep track of parent if necessary */
- if(hdr->swmr_write)
+ if (hdr->swmr_write)
parent = internal;
/* Set pointer to next node to load */
curr_node_ptr = next_node_ptr;
} /* end if */
else {
- hbool_t changed; /* Whether the 'modify' callback changed the record */
+ hbool_t changed; /* Whether the 'modify' callback changed the record */
/* Make callback for current record */
- if((op)(H5B2_INT_NREC(internal, hdr, idx), op_data, &changed) < 0) {
+ if ((op)(H5B2_INT_NREC(internal, hdr, idx), op_data, &changed) < 0) {
/* Make certain that the callback didn't modify the value if it failed */
HDassert(changed == FALSE);
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) <
+ 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
- HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree find operation")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL,
+ "'modify' callback failed for B-tree find operation")
} /* end if */
/* Mark the node as dirty if it changed */
internal_flags |= changed ? H5AC__DIRTIED_FLAG : 0;
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_flags) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_flags) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_DONE(SUCCEED);
@@ -1272,97 +1279,100 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data)
} /* end while */
{
- H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
- unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting the leaf node */
- hbool_t changed = FALSE;/* Whether the 'modify' callback changed the record */
+ H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
+ unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting the leaf node */
+ hbool_t changed = FALSE; /* Whether the 'modify' callback changed the record */
/* Lock B-tree leaf node */
- if(NULL == (leaf = H5B2__protect_leaf(hdr, parent, &curr_node_ptr, FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, &curr_node_ptr, FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
/* Unpin parent if necessary */
- if(parent) {
- if(parent != hdr && H5AC_unpin_entry(parent) < 0)
+ if (parent) {
+ if (parent != hdr && H5AC_unpin_entry(parent) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry")
parent = NULL;
} /* end if */
/* Locate record */
- if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0) {
+ if (H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) <
+ 0) {
/* Unlock current node before failing */
H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET);
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
} /* end if */
- if(cmp != 0) {
+ if (cmp != 0) {
/* Unlock leaf node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
- /* Note: don't push error on stack, leave that to next higher level,
- * since many times the B-tree is searched in order to determine
- * if an object exists in the B-tree or not. -QAK
- */
+ /* Note: don't push error on stack, leave that to next higher level,
+ * since many times the B-tree is searched in order to determine
+ * if an object exists in the B-tree or not. -QAK
+ */
#ifdef OLD_WAY
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "key not found in leaf node")
-#else /* OLD_WAY */
- HGOTO_DONE(FAIL)
-#endif /* OLD_WAY */
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "key not found in leaf node")
+#else /* OLD_WAY */
+ HGOTO_DONE(FAIL)
+#endif /* OLD_WAY */
} /* end if */
else {
/* Make callback for current record */
- if((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data, &changed) < 0) {
+ if ((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data, &changed) < 0) {
/* Make certain that the callback didn't modify the value if it failed */
HDassert(changed == FALSE);
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
- HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree find operation")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL,
+ "'modify' callback failed for B-tree find operation")
} /* end if */
/* Check for modified record being the min or max for the tree */
/* (Don't use 'else' for the idx check, to allow for root leaf node) */
- if(H5B2_POS_MIDDLE != curr_pos) {
- if(idx == 0) {
- if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
- if(hdr->min_native_rec == NULL)
- if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info")
+ if (H5B2_POS_MIDDLE != curr_pos) {
+ if (idx == 0) {
+ if (H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
+ if (hdr->min_native_rec == NULL)
+ if (NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for v2 B-tree min record info")
H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
- } /* end if */
- if(idx == (unsigned)(leaf->nrec - 1)) {
- if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
- if(hdr->max_native_rec == NULL)
- if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info")
+ } /* end if */
+ if (idx == (unsigned)(leaf->nrec - 1)) {
+ if (H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
+ if (hdr->max_native_rec == NULL)
+ if (NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for v2 B-tree max record info")
H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
- } /* end if */
- } /* end if */
- } /* end else */
+ } /* end if */
+ } /* end if */
+ } /* end else */
/* Mark the node as dirty if it changed */
leaf_flags |= (changed ? H5AC__DIRTIED_FLAG : 0);
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_flags) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_flags) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
} /* end block */
done:
- if(parent) {
+ if (parent) {
HDassert(ret_value < 0);
- if(parent != hdr && H5AC_unpin_entry(parent) < 0)
+ if (parent != hdr && H5AC_unpin_entry(parent) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_modify() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_close
*
@@ -1378,9 +1388,9 @@ done:
herr_t
H5B2_close(H5B2_t *bt2)
{
- haddr_t bt2_addr = HADDR_UNDEF; /* Address of v2 B-tree (for deletion) */
- hbool_t pending_delete = FALSE; /* Whether the v2 B-tree is pending deletion */
- herr_t ret_value = SUCCEED; /* Return value */
+ haddr_t bt2_addr = HADDR_UNDEF; /* Address of v2 B-tree (for deletion) */
+ hbool_t pending_delete = FALSE; /* Whether the v2 B-tree is pending deletion */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1389,45 +1399,47 @@ H5B2_close(H5B2_t *bt2)
HDassert(bt2->f);
/* Decrement file reference & check if this is the last open v2 B-tree using the shared B-tree header */
- if(0 == H5B2__hdr_fuse_decr(bt2->hdr)) {
+ if (0 == H5B2__hdr_fuse_decr(bt2->hdr)) {
/* Set the shared v2 B-tree header's file context for this operation */
bt2->hdr->f = bt2->f;
/* Check for pending B-tree deletion */
- if(bt2->hdr->pending_delete) {
+ if (bt2->hdr->pending_delete) {
/* Set local info, so B-tree deletion can occur after decrementing the
* header's ref count
*/
pending_delete = TRUE;
- bt2_addr = bt2->hdr->addr;
+ bt2_addr = bt2->hdr->addr;
} /* end if */
- } /* end if */
+ } /* end if */
/* Check for pending v2 B-tree deletion */
- if(pending_delete) {
- H5B2_hdr_t *hdr; /* Another pointer to v2 B-tree header */
+ if (pending_delete) {
+ H5B2_hdr_t *hdr; /* Another pointer to v2 B-tree header */
/* Sanity check */
HDassert(H5F_addr_defined(bt2_addr));
#ifndef NDEBUG
-{
- unsigned hdr_status = 0; /* Header's status in the metadata cache */
-
- /* Check the header's status in the metadata cache */
- if(H5AC_get_entry_status(bt2->f, bt2_addr, &hdr_status) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to check metadata cache status for v2 B-tree header, address = %llu", (unsigned long long)bt2_addr)
-
- /* Sanity checks on header */
- HDassert(hdr_status & H5AC_ES__IN_CACHE);
- HDassert(hdr_status & H5AC_ES__IS_PINNED);
- HDassert(!(hdr_status & H5AC_ES__IS_PROTECTED));
-}
+ {
+ unsigned hdr_status = 0; /* Header's status in the metadata cache */
+
+ /* Check the header's status in the metadata cache */
+ if (H5AC_get_entry_status(bt2->f, bt2_addr, &hdr_status) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL,
+ "unable to check metadata cache status for v2 B-tree header, address = %llu",
+ (unsigned long long)bt2_addr)
+
+ /* Sanity checks on header */
+ HDassert(hdr_status & H5AC_ES__IN_CACHE);
+ HDassert(hdr_status & H5AC_ES__IS_PINNED);
+ HDassert(!(hdr_status & H5AC_ES__IS_PROTECTED));
+ }
#endif /* NDEBUG */
/* Lock the v2 B-tree header into memory */
/* (OK to pass in NULL for callback context, since we know the header must be in the cache) */
- if(NULL == (hdr = H5B2__hdr_protect(bt2->f, bt2_addr, NULL, H5AC__NO_FLAGS_SET)))
+ if (NULL == (hdr = H5B2__hdr_protect(bt2->f, bt2_addr, NULL, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header")
/* Set the shared v2 B-tree header's file context for this operation */
@@ -1437,11 +1449,12 @@ H5B2_close(H5B2_t *bt2)
/* (don't put in H5B2__hdr_fuse_decr() as the B-tree header may be evicted
* immediately -QAK)
*/
- if(H5B2__hdr_decr(bt2->hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement reference count on shared v2 B-tree header")
+ if (H5B2__hdr_decr(bt2->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared v2 B-tree header")
/* Delete v2 B-tree, starting with header (unprotects header) */
- if(H5B2__hdr_delete(hdr) < 0)
+ if (H5B2__hdr_delete(hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree")
} /* end if */
else {
@@ -1449,8 +1462,9 @@ H5B2_close(H5B2_t *bt2)
/* (don't put in H5B2__hdr_fuse_decr() as the B-tree header may be evicted
* immediately -QAK)
*/
- if(H5B2__hdr_decr(bt2->hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement reference count on shared v2 B-tree header")
+ if (H5B2__hdr_decr(bt2->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared v2 B-tree header")
} /* end else */
@@ -1461,7 +1475,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_close() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_delete
*
@@ -1484,11 +1497,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_delete(H5F_t *f, haddr_t addr, void *ctx_udata, H5B2_remove_t op,
- void *op_data)
+H5B2_delete(H5F_t *f, haddr_t addr, void *ctx_udata, H5B2_remove_t op, void *op_data)
{
- H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1497,35 +1509,34 @@ H5B2_delete(H5F_t *f, haddr_t addr, void *ctx_udata, H5B2_remove_t op,
HDassert(H5F_addr_defined(addr));
/* Lock the v2 B-tree header into memory */
- if(NULL == (hdr = H5B2__hdr_protect(f, addr, ctx_udata, H5AC__NO_FLAGS_SET)))
+ if (NULL == (hdr = H5B2__hdr_protect(f, addr, ctx_udata, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header")
/* Remember the callback & context for later */
- hdr->remove_op = op;
+ hdr->remove_op = op;
hdr->remove_op_data = op_data;
/* Check for files using shared v2 B-tree header */
- if(hdr->file_rc)
+ if (hdr->file_rc)
hdr->pending_delete = TRUE;
else {
/* Set the shared v2 B-tree header's file context for this operation */
hdr->f = f;
/* Delete v2 B-tree now, starting with header (unprotects header) */
- if(H5B2__hdr_delete(hdr) < 0)
+ if (H5B2__hdr_delete(hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree")
hdr = NULL;
} /* end if */
done:
/* Unprotect the header, if an error occurred */
- if(hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
+ if (hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release v2 B-tree header")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_depend
*
@@ -1543,8 +1554,8 @@ herr_t
H5B2_depend(H5B2_t *bt2, H5AC_proxy_entry_t *parent)
{
/* Local variables */
- H5B2_hdr_t *hdr = bt2->hdr; /* Header for B-tree */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t *hdr = bt2->hdr; /* Header for B-tree */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(SUCCEED)
@@ -1561,7 +1572,7 @@ H5B2_depend(H5B2_t *bt2, H5AC_proxy_entry_t *parent)
* and the v2 B-tree header has already been setup. If it hasn't, then
* set it up.
*/
- if(NULL == hdr->parent) {
+ if (NULL == hdr->parent) {
/* Sanity check */
HDassert(hdr->top_proxy);
@@ -1569,16 +1580,15 @@ H5B2_depend(H5B2_t *bt2, H5AC_proxy_entry_t *parent)
hdr->f = bt2->f;
/* Add the v2 B-tree as a child of the parent (proxy) */
- if(H5AC_proxy_entry_add_child(parent, hdr->f, hdr->top_proxy) < 0)
+ if (H5AC_proxy_entry_add_child(parent, hdr->f, hdr->top_proxy) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, FAIL, "unable to add v2 B-tree as child of proxy")
- hdr->parent = parent;
+ hdr->parent = parent;
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2_depend() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_patch_file
*
@@ -1602,9 +1612,8 @@ H5B2_patch_file(H5B2_t *bt2, H5F_t *f)
HDassert(bt2);
HDassert(f);
- if(bt2->f != f || bt2->hdr->f != f)
+ if (bt2->f != f || bt2->hdr->f != f)
bt2->f = bt2->hdr->f = f;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2_patch_file() */
-
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index 3b7dd5d..ce91085 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -26,38 +26,33 @@
/* Module Setup */
/****************/
-#include "H5B2module.h" /* This source code file is part of the H5B2 module */
-
+#include "H5B2module.h" /* This source code file is part of the H5B2 module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5B2pkg.h" /* v2 B-trees */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5WBprivate.h" /* Wrapped Buffers */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5B2pkg.h" /* v2 B-trees */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5WBprivate.h" /* Wrapped Buffers */
/****************/
/* Local Macros */
/****************/
/* B-tree format version #'s */
-#define H5B2_HDR_VERSION 0 /* Header */
-#define H5B2_INT_VERSION 0 /* Internal node */
-#define H5B2_LEAF_VERSION 0 /* Leaf node */
-
+#define H5B2_HDR_VERSION 0 /* Header */
+#define H5B2_INT_VERSION 0 /* Internal node */
+#define H5B2_LEAF_VERSION 0 /* Leaf node */
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
@@ -65,31 +60,25 @@
/* Metadata cache callbacks */
static herr_t H5B2__cache_hdr_get_initial_load_size(void *udata, size_t *image_len);
static htri_t H5B2__cache_hdr_verify_chksum(const void *image_ptr, size_t len, void *udata);
-static void *H5B2__cache_hdr_deserialize(const void *image, size_t len,
- void *udata, hbool_t *dirty);
+static void * H5B2__cache_hdr_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty);
static herr_t H5B2__cache_hdr_image_len(const void *thing, size_t *image_len);
-static herr_t H5B2__cache_hdr_serialize(const H5F_t *f, void *image, size_t len,
- void *thing);
+static herr_t H5B2__cache_hdr_serialize(const H5F_t *f, void *image, size_t len, void *thing);
static herr_t H5B2__cache_hdr_notify(H5AC_notify_action_t action, void *thing);
static herr_t H5B2__cache_hdr_free_icr(void *thing);
static herr_t H5B2__cache_int_get_initial_load_size(void *udata, size_t *image_len);
static htri_t H5B2__cache_int_verify_chksum(const void *image_ptr, size_t len, void *udata);
-static void *H5B2__cache_int_deserialize(const void *image, size_t len,
- void *udata, hbool_t *dirty);
+static void * H5B2__cache_int_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty);
static herr_t H5B2__cache_int_image_len(const void *thing, size_t *image_len);
-static herr_t H5B2__cache_int_serialize(const H5F_t *f, void *image, size_t len,
- void *thing);
+static herr_t H5B2__cache_int_serialize(const H5F_t *f, void *image, size_t len, void *thing);
static herr_t H5B2__cache_int_notify(H5AC_notify_action_t action, void *thing);
static herr_t H5B2__cache_int_free_icr(void *thing);
static herr_t H5B2__cache_leaf_get_initial_load_size(void *udata, size_t *image_len);
static htri_t H5B2__cache_leaf_verify_chksum(const void *image_ptr, size_t len, void *udata);
-static void *H5B2__cache_leaf_deserialize(const void *image, size_t len,
- void *udata, hbool_t *dirty);
+static void * H5B2__cache_leaf_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty);
static herr_t H5B2__cache_leaf_image_len(const void *thing, size_t *image_len);
-static herr_t H5B2__cache_leaf_serialize(const H5F_t *f, void *image, size_t len,
- void *thing);
+static herr_t H5B2__cache_leaf_serialize(const H5F_t *f, void *image, size_t len, void *thing);
static herr_t H5B2__cache_leaf_notify(H5AC_notify_action_t action, void *thing);
static herr_t H5B2__cache_leaf_free_icr(void *thing);
@@ -99,70 +88,66 @@ static herr_t H5B2__cache_leaf_free_icr(void *thing);
/* H5B2 inherits cache-like properties from H5AC */
const H5AC_class_t H5AC_BT2_HDR[1] = {{
- H5AC_BT2_HDR_ID, /* Metadata client ID */
- "v2 B-tree header", /* Metadata client name (for debugging) */
- H5FD_MEM_BTREE, /* File space memory type for client */
- H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
+ H5AC_BT2_HDR_ID, /* Metadata client ID */
+ "v2 B-tree header", /* Metadata client name (for debugging) */
+ H5FD_MEM_BTREE, /* File space memory type for client */
+ H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
H5B2__cache_hdr_get_initial_load_size, /* 'get_initial_load_size' callback */
- NULL, /* 'get_final_load_size' callback */
- H5B2__cache_hdr_verify_chksum, /* 'verify_chksum' callback */
- H5B2__cache_hdr_deserialize, /* 'deserialize' callback */
- H5B2__cache_hdr_image_len, /* 'image_len' callback */
- NULL, /* 'pre_serialize' callback */
- H5B2__cache_hdr_serialize, /* 'serialize' callback */
- H5B2__cache_hdr_notify, /* 'notify' callback */
- H5B2__cache_hdr_free_icr, /* 'free_icr' callback */
- NULL, /* 'fsf_size' callback */
+ NULL, /* 'get_final_load_size' callback */
+ H5B2__cache_hdr_verify_chksum, /* 'verify_chksum' callback */
+ H5B2__cache_hdr_deserialize, /* 'deserialize' callback */
+ H5B2__cache_hdr_image_len, /* 'image_len' callback */
+ NULL, /* 'pre_serialize' callback */
+ H5B2__cache_hdr_serialize, /* 'serialize' callback */
+ H5B2__cache_hdr_notify, /* 'notify' callback */
+ H5B2__cache_hdr_free_icr, /* 'free_icr' callback */
+ NULL, /* 'fsf_size' callback */
}};
/* H5B2 inherits cache-like properties from H5AC */
const H5AC_class_t H5AC_BT2_INT[1] = {{
- H5AC_BT2_INT_ID, /* Metadata client ID */
- "v2 B-tree internal node", /* Metadata client name (for debugging) */
- H5FD_MEM_BTREE, /* File space memory type for client */
- H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
+ H5AC_BT2_INT_ID, /* Metadata client ID */
+ "v2 B-tree internal node", /* Metadata client name (for debugging) */
+ H5FD_MEM_BTREE, /* File space memory type for client */
+ H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
H5B2__cache_int_get_initial_load_size, /* 'get_initial_load_size' callback */
- NULL, /* 'get_final_load_size' callback */
- H5B2__cache_int_verify_chksum, /* 'verify_chksum' callback */
- H5B2__cache_int_deserialize, /* 'deserialize' callback */
- H5B2__cache_int_image_len, /* 'image_len' callback */
- NULL, /* 'pre_serialize' callback */
- H5B2__cache_int_serialize, /* 'serialize' callback */
- H5B2__cache_int_notify, /* 'notify' callback */
- H5B2__cache_int_free_icr, /* 'free_icr' callback */
- NULL, /* 'fsf_size' callback */
+ NULL, /* 'get_final_load_size' callback */
+ H5B2__cache_int_verify_chksum, /* 'verify_chksum' callback */
+ H5B2__cache_int_deserialize, /* 'deserialize' callback */
+ H5B2__cache_int_image_len, /* 'image_len' callback */
+ NULL, /* 'pre_serialize' callback */
+ H5B2__cache_int_serialize, /* 'serialize' callback */
+ H5B2__cache_int_notify, /* 'notify' callback */
+ H5B2__cache_int_free_icr, /* 'free_icr' callback */
+ NULL, /* 'fsf_size' callback */
}};
/* H5B2 inherits cache-like properties from H5AC */
const H5AC_class_t H5AC_BT2_LEAF[1] = {{
- H5AC_BT2_LEAF_ID, /* Metadata client ID */
- "v2 B-tree leaf node", /* Metadata client name (for debugging) */
- H5FD_MEM_BTREE, /* File space memory type for client */
- H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
+ H5AC_BT2_LEAF_ID, /* Metadata client ID */
+ "v2 B-tree leaf node", /* Metadata client name (for debugging) */
+ H5FD_MEM_BTREE, /* File space memory type for client */
+ H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
H5B2__cache_leaf_get_initial_load_size, /* 'get_initial_load_size' callback */
- NULL, /* 'get_final_load_size' callback */
- H5B2__cache_leaf_verify_chksum, /* 'verify_chksum' callback */
- H5B2__cache_leaf_deserialize, /* 'deserialize' callback */
- H5B2__cache_leaf_image_len, /* 'image_len' callback */
- NULL, /* 'pre_serialize' callback */
- H5B2__cache_leaf_serialize, /* 'serialize' callback */
- H5B2__cache_leaf_notify, /* 'notify' callback */
- H5B2__cache_leaf_free_icr, /* 'free_icr' callback */
- NULL, /* 'fsf_size' callback */
+ NULL, /* 'get_final_load_size' callback */
+ H5B2__cache_leaf_verify_chksum, /* 'verify_chksum' callback */
+ H5B2__cache_leaf_deserialize, /* 'deserialize' callback */
+ H5B2__cache_leaf_image_len, /* 'image_len' callback */
+ NULL, /* 'pre_serialize' callback */
+ H5B2__cache_leaf_serialize, /* 'serialize' callback */
+ H5B2__cache_leaf_notify, /* 'notify' callback */
+ H5B2__cache_leaf_free_icr, /* 'free_icr' callback */
+ NULL, /* 'fsf_size' callback */
}};
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_hdr_get_initial_load_size
*
@@ -193,7 +178,6 @@ H5B2__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5B2__cache_hdr_get_initial_load_size() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_hdr_verify_chksum
*
@@ -210,10 +194,10 @@ H5B2__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len)
static htri_t
H5B2__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
{
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t stored_chksum; /* Stored metadata checksum value */
- uint32_t computed_chksum; /* Computed metadata checksum value */
- htri_t ret_value = TRUE; /* Return value */
+ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+ uint32_t stored_chksum; /* Stored metadata checksum value */
+ uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -223,13 +207,12 @@ H5B2__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE
/* Get stored and computed checksums */
H5F_get_checksums(image, len, &stored_chksum, &computed_chksum);
- if(stored_chksum != computed_chksum)
- ret_value = FALSE;
+ if (stored_chksum != computed_chksum)
+ ret_value = FALSE;
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__cache_hdr_verify_chksum() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_hdr_deserialize
*
@@ -244,17 +227,17 @@ H5B2__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE
*-------------------------------------------------------------------------
*/
static void *
-H5B2__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_UNUSED len,
- void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
+H5B2__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_udata,
+ hbool_t H5_ATTR_UNUSED *dirty)
{
- H5B2_hdr_t *hdr = NULL; /* B-tree header */
+ H5B2_hdr_t * hdr = NULL; /* B-tree header */
H5B2_hdr_cache_ud_t *udata = (H5B2_hdr_cache_ud_t *)_udata;
- H5B2_create_t cparam; /* B-tree creation parameters */
- H5B2_subid_t id; /* ID of B-tree class, as found in file */
- uint16_t depth; /* Depth of B-tree */
- uint32_t stored_chksum; /* Stored metadata checksum value */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- H5B2_hdr_t *ret_value = NULL; /* Return value */
+ H5B2_create_t cparam; /* B-tree creation parameters */
+ H5B2_subid_t id; /* ID of B-tree class, as found in file */
+ uint16_t depth; /* Depth of B-tree */
+ uint32_t stored_chksum; /* Stored metadata checksum value */
+ const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+ H5B2_hdr_t * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -263,21 +246,21 @@ H5B2__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_UNUSED len,
HDassert(udata);
/* Allocate new B-tree header and reset cache info */
- if(NULL == (hdr = H5B2__hdr_alloc(udata->f)))
+ if (NULL == (hdr = H5B2__hdr_alloc(udata->f)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "allocation failed for B-tree header")
/* Magic number */
- if(HDmemcmp(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
- HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree header signature")
+ if (HDmemcmp(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree header signature")
image += H5_SIZEOF_MAGIC;
/* Version */
- if(*image++ != H5B2_HDR_VERSION)
- HGOTO_ERROR(H5E_BTREE, H5E_BADRANGE, NULL, "wrong B-tree header version")
+ if (*image++ != H5B2_HDR_VERSION)
+ HGOTO_ERROR(H5E_BTREE, H5E_BADRANGE, NULL, "wrong B-tree header version")
/* B-tree class */
id = (H5B2_subid_t)*image++;
- if(id >= H5B2_NUM_BTREE_ID)
+ if (id >= H5B2_NUM_BTREE_ID)
HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type")
/* Node size (in bytes) */
@@ -308,7 +291,7 @@ H5B2__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_UNUSED len,
/* Initialize B-tree header info */
cparam.cls = H5B2_client_class_g[id];
- if(H5B2__hdr_init(hdr, &cparam, udata->ctx_udata, depth) < 0)
+ if (H5B2__hdr_init(hdr, &cparam, udata->ctx_udata, depth) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't initialize B-tree header info")
/* Set the B-tree header's address */
@@ -321,14 +304,13 @@ H5B2__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_UNUSED len,
ret_value = hdr;
done:
- if(!ret_value && hdr)
- if(H5B2__hdr_free(hdr) < 0)
+ if (!ret_value && hdr)
+ if (H5B2__hdr_free(hdr) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, NULL, "can't release v2 B-tree header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__cache_hdr_deserialize() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_hdr_image_len
*
@@ -344,7 +326,7 @@ done:
static herr_t
H5B2__cache_hdr_image_len(const void *_thing, size_t *image_len)
{
- const H5B2_hdr_t *hdr = (const H5B2_hdr_t *)_thing; /* Pointer to the B-tree header */
+ const H5B2_hdr_t *hdr = (const H5B2_hdr_t *)_thing; /* Pointer to the B-tree header */
FUNC_ENTER_STATIC_NOERR
@@ -358,7 +340,6 @@ H5B2__cache_hdr_image_len(const void *_thing, size_t *image_len)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5B2__cache_hdr_image_len() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_hdr_serialize
*
@@ -372,12 +353,11 @@ H5B2__cache_hdr_image_len(const void *_thing, size_t *image_len)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing)
+H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)
{
- H5B2_hdr_t *hdr = (H5B2_hdr_t *)_thing; /* Pointer to the B-tree header */
- uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t metadata_chksum; /* Computed metadata checksum value */
+ H5B2_hdr_t *hdr = (H5B2_hdr_t *)_thing; /* Pointer to the B-tree header */
+ uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
+ uint32_t metadata_chksum; /* Computed metadata checksum value */
FUNC_ENTER_STATIC_NOERR
@@ -429,7 +409,6 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__cache_hdr_serialize() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_hdr_notify
*
@@ -445,8 +424,8 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
static herr_t
H5B2__cache_hdr_notify(H5AC_notify_action_t action, void *_thing)
{
- H5B2_hdr_t *hdr = (H5B2_hdr_t *)_thing;
- herr_t ret_value = SUCCEED;
+ H5B2_hdr_t *hdr = (H5B2_hdr_t *)_thing;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -456,14 +435,14 @@ H5B2__cache_hdr_notify(H5AC_notify_action_t action, void *_thing)
HDassert(hdr);
/* Check if the file was opened with SWMR-write access */
- if(hdr->swmr_write) {
- switch(action) {
+ if (hdr->swmr_write) {
+ switch (action) {
case H5AC_NOTIFY_ACTION_AFTER_INSERT:
- case H5AC_NOTIFY_ACTION_AFTER_LOAD:
- /* do nothing */
+ case H5AC_NOTIFY_ACTION_AFTER_LOAD:
+ /* do nothing */
break;
- case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
+ case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
/* Increment the shadow epoch, forcing new modifications to
* internal and leaf nodes to create new shadow copies */
hdr->shadow_epoch++;
@@ -475,39 +454,43 @@ H5B2__cache_hdr_notify(H5AC_notify_action_t action, void *_thing)
case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED:
case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED:
- /* do nothing */
+ /* do nothing */
break;
- case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
+ case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* If hdr->parent != NULL, hdr->parent is used to destroy
* the flush dependency before the header is evicted.
*/
- if(hdr->parent) {
+ if (hdr->parent) {
/* Sanity check */
HDassert(hdr->top_proxy);
- /* Destroy flush dependency on object header proxy */
- if(H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent, (void *)hdr->top_proxy) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between v2 B-tree and proxy")
+ /* Destroy flush dependency on object header proxy */
+ if (H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent,
+ (void *)hdr->top_proxy) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between v2 B-tree and proxy")
hdr->parent = NULL;
- } /* end if */
+ } /* end if */
/* Detach from 'top' proxy for extensible array */
- if(hdr->top_proxy) {
- if(H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between header and v2 B-tree 'top' proxy")
+ if (hdr->top_proxy) {
+ if (H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0)
+ HGOTO_ERROR(
+ H5E_BTREE, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between header and v2 B-tree 'top' proxy")
/* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */
} /* end if */
- break;
+ break;
default:
#ifdef NDEBUG
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
-#else /* NDEBUG */
+#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
-#endif /* NDEBUG */
+#endif /* NDEBUG */
} /* end switch */
- } /* end if */
+ } /* end if */
else
HDassert(NULL == hdr->parent);
@@ -515,7 +498,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__cache_hdr_notify() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_hdr_free_icr
*
@@ -532,7 +514,7 @@ done:
static herr_t
H5B2__cache_hdr_free_icr(void *thing)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -540,14 +522,13 @@ H5B2__cache_hdr_free_icr(void *thing)
HDassert(thing);
/* Destroy v2 B-tree header */
- if(H5B2__hdr_free((H5B2_hdr_t *)thing) < 0)
+ if (H5B2__hdr_free((H5B2_hdr_t *)thing) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree header")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__cache_hdr_free_icr() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_int_get_initial_load_size
*
@@ -578,7 +559,6 @@ H5B2__cache_int_get_initial_load_size(void *_udata, size_t *image_len)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5B2__cache_int_get_initial_load_size() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_int_verify_chksum
*
@@ -595,12 +575,12 @@ H5B2__cache_int_get_initial_load_size(void *_udata, size_t *image_len)
static htri_t
H5B2__cache_int_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, void *_udata)
{
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- H5B2_internal_cache_ud_t *udata = (H5B2_internal_cache_ud_t *)_udata; /* Pointer to user data */
- size_t chk_size; /* Exact size of the node with checksum at the end */
- uint32_t stored_chksum; /* Stored metadata checksum value */
- uint32_t computed_chksum; /* Computed metadata checksum value */
- htri_t ret_value = TRUE; /* Return value */
+ const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+ H5B2_internal_cache_ud_t *udata = (H5B2_internal_cache_ud_t *)_udata; /* Pointer to user data */
+ size_t chk_size; /* Exact size of the node with checksum at the end */
+ uint32_t stored_chksum; /* Stored metadata checksum value */
+ uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -609,18 +589,18 @@ H5B2__cache_int_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, voi
HDassert(udata);
/* Internal node prefix header + records + child pointer triplets: size with checksum at the end */
- chk_size = H5B2_INT_PREFIX_SIZE + (udata->nrec * udata->hdr->rrec_size) + ((size_t)(udata->nrec + 1) * H5B2_INT_POINTER_SIZE(udata->hdr, udata->depth));
+ chk_size = H5B2_INT_PREFIX_SIZE + (udata->nrec * udata->hdr->rrec_size) +
+ ((size_t)(udata->nrec + 1) * H5B2_INT_POINTER_SIZE(udata->hdr, udata->depth));
/* Get stored and computed checksums */
H5F_get_checksums(image, chk_size, &stored_chksum, &computed_chksum);
- if(stored_chksum != computed_chksum)
- ret_value = FALSE;
+ if (stored_chksum != computed_chksum)
+ ret_value = FALSE;
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__cache_int_verify_chksum() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_int_deserialize
*
@@ -635,18 +615,18 @@ H5B2__cache_int_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, voi
*-------------------------------------------------------------------------
*/
static void *
-H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len,
- void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
+H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_udata,
+ hbool_t H5_ATTR_UNUSED *dirty)
{
- H5B2_internal_cache_ud_t *udata = (H5B2_internal_cache_ud_t *)_udata; /* Pointer to user data */
- H5B2_internal_t *internal = NULL; /* Internal node read */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- uint8_t *native; /* Pointer to native record info */
- H5B2_node_ptr_t *int_node_ptr; /* Pointer to node pointer info */
- uint32_t stored_chksum; /* Stored metadata checksum value */
- unsigned u; /* Local index variable */
- H5B2_internal_t *ret_value = NULL; /* Return value */
- int node_nrec = 0;
+ H5B2_internal_cache_ud_t *udata = (H5B2_internal_cache_ud_t *)_udata; /* Pointer to user data */
+ H5B2_internal_t * internal = NULL; /* Internal node read */
+ const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+ uint8_t * native; /* Pointer to native record info */
+ H5B2_node_ptr_t * int_node_ptr; /* Pointer to node pointer info */
+ uint32_t stored_chksum; /* Stored metadata checksum value */
+ unsigned u; /* Local index variable */
+ H5B2_internal_t * ret_value = NULL; /* Return value */
+ int node_nrec = 0;
FUNC_ENTER_STATIC
@@ -655,48 +635,52 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len,
HDassert(udata);
/* Allocate new internal node and reset cache info */
- if(NULL == (internal = H5FL_CALLOC(H5B2_internal_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ if (NULL == (internal = H5FL_CALLOC(H5B2_internal_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Increment ref. count on B-tree header */
- if(H5B2__hdr_incr(udata->hdr) < 0)
+ if (H5B2__hdr_incr(udata->hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment ref. count on B-tree header")
/* Share B-tree information */
- internal->hdr = udata->hdr;
- internal->parent = udata->parent;
+ internal->hdr = udata->hdr;
+ internal->parent = udata->parent;
internal->shadow_epoch = udata->hdr->shadow_epoch;
/* Magic number */
- if(HDmemcmp(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ if (HDmemcmp(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree internal node signature")
image += H5_SIZEOF_MAGIC;
/* Version */
- if(*image++ != H5B2_INT_VERSION)
+ if (*image++ != H5B2_INT_VERSION)
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree internal node version")
/* B-tree type */
- if(*image++ != (uint8_t)udata->hdr->cls->id)
+ if (*image++ != (uint8_t)udata->hdr->cls->id)
HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type")
/* Allocate space for the native keys in memory */
- if(NULL == (internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(udata->hdr->node_info[udata->depth].nat_rec_fac)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree internal native keys")
+ if (NULL ==
+ (internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(udata->hdr->node_info[udata->depth].nat_rec_fac)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
+ "memory allocation failed for B-tree internal native keys")
/* Allocate space for the node pointers in memory */
- if(NULL == (internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(udata->hdr->node_info[udata->depth].node_ptr_fac)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree internal node pointers")
+ if (NULL == (internal->node_ptrs =
+ (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(udata->hdr->node_info[udata->depth].node_ptr_fac)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
+ "memory allocation failed for B-tree internal node pointers")
/* Set the number of records in the leaf & it's depth */
- internal->nrec = udata->nrec;
+ internal->nrec = udata->nrec;
internal->depth = udata->depth;
/* Deserialize records for internal node */
native = internal->int_native;
- for(u = 0; u < internal->nrec; u++) {
+ for (u = 0; u < internal->nrec; u++) {
/* Decode record */
- if((udata->hdr->cls->decode)(image, native, udata->hdr->cb_ctx) < 0)
+ if ((udata->hdr->cls->decode)(image, native, udata->hdr->cb_ctx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode B-tree record")
/* Move to next record */
@@ -706,13 +690,14 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len,
/* Deserialize node pointers for internal node */
int_node_ptr = internal->node_ptrs;
- for(u = 0; u < (unsigned)(internal->nrec + 1); u++) {
+ for (u = 0; u < (unsigned)(internal->nrec + 1); u++) {
/* Decode node pointer */
H5F_addr_decode(udata->f, (const uint8_t **)&image, &(int_node_ptr->addr));
UINT64DECODE_VAR(image, node_nrec, udata->hdr->max_nrec_size);
H5_CHECKED_ASSIGN(int_node_ptr->node_nrec, uint16_t, node_nrec, int);
- if(udata->depth > 1)
- UINT64DECODE_VAR(image, int_node_ptr->all_nrec, udata->hdr->node_info[udata->depth - 1].cum_max_nrec_size)
+ if (udata->depth > 1)
+ UINT64DECODE_VAR(image, int_node_ptr->all_nrec,
+ udata->hdr->node_info[udata->depth - 1].cum_max_nrec_size)
else
int_node_ptr->all_nrec = int_node_ptr->node_nrec;
@@ -732,14 +717,13 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len,
ret_value = internal;
done:
- if(!ret_value && internal)
- if(H5B2__internal_free(internal) < 0)
+ if (!ret_value && internal)
+ if (H5B2__internal_free(internal) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to destroy B-tree internal node")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__cache_int_deserialize() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_int_image_len
*
@@ -755,7 +739,8 @@ done:
static herr_t
H5B2__cache_int_image_len(const void *_thing, size_t *image_len)
{
- const H5B2_internal_t *internal = (const H5B2_internal_t *)_thing; /* Pointer to the B-tree internal node */
+ const H5B2_internal_t *internal =
+ (const H5B2_internal_t *)_thing; /* Pointer to the B-tree internal node */
FUNC_ENTER_STATIC_NOERR
@@ -770,7 +755,6 @@ H5B2__cache_int_image_len(const void *_thing, size_t *image_len)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5B2__cache_int_image_len() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_int_serialize
*
@@ -784,16 +768,15 @@ H5B2__cache_int_image_len(const void *_thing, size_t *image_len)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing)
+H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)
{
- H5B2_internal_t *internal = (H5B2_internal_t *)_thing; /* Pointer to the B-tree internal node */
- uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */
- uint8_t *native; /* Pointer to native record info */
- H5B2_node_ptr_t *int_node_ptr; /* Pointer to node pointer info */
- uint32_t metadata_chksum; /* Computed metadata checksum value */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_internal_t *internal = (H5B2_internal_t *)_thing; /* Pointer to the B-tree internal node */
+ uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
+ uint8_t * native; /* Pointer to native record info */
+ H5B2_node_ptr_t *int_node_ptr; /* Pointer to node pointer info */
+ uint32_t metadata_chksum; /* Computed metadata checksum value */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -817,9 +800,9 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
/* Serialize records for internal node */
native = internal->int_native;
- for(u = 0; u < internal->nrec; u++) {
+ for (u = 0; u < internal->nrec; u++) {
/* Encode record */
- if((internal->hdr->cls->encode)(image, native, internal->hdr->cb_ctx) < 0)
+ if ((internal->hdr->cls->encode)(image, native, internal->hdr->cb_ctx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record")
/* Move to next record */
@@ -829,12 +812,13 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
/* Serialize node pointers for internal node */
int_node_ptr = internal->node_ptrs;
- for(u = 0; u < (unsigned)(internal->nrec + 1); u++) {
+ for (u = 0; u < (unsigned)(internal->nrec + 1); u++) {
/* Encode node pointer */
H5F_addr_encode(f, &image, int_node_ptr->addr);
UINT64ENCODE_VAR(image, int_node_ptr->node_nrec, internal->hdr->max_nrec_size);
- if(internal->depth > 1)
- UINT64ENCODE_VAR(image, int_node_ptr->all_nrec, internal->hdr->node_info[internal->depth - 1].cum_max_nrec_size);
+ if (internal->depth > 1)
+ UINT64ENCODE_VAR(image, int_node_ptr->all_nrec,
+ internal->hdr->node_info[internal->depth - 1].cum_max_nrec_size);
/* Move to next node pointer */
int_node_ptr++;
@@ -856,7 +840,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__cache_int_serialize() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_int_notify
*
@@ -872,8 +855,8 @@ done:
static herr_t
H5B2__cache_int_notify(H5AC_notify_action_t action, void *_thing)
{
- H5B2_internal_t *internal = (H5B2_internal_t *)_thing;
- herr_t ret_value = SUCCEED;
+ H5B2_internal_t *internal = (H5B2_internal_t *)_thing;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -884,34 +867,36 @@ H5B2__cache_int_notify(H5AC_notify_action_t action, void *_thing)
HDassert(internal->hdr);
/* Check if the file was opened with SWMR-write access */
- if(internal->hdr->swmr_write) {
- switch(action) {
+ if (internal->hdr->swmr_write) {
+ switch (action) {
case H5AC_NOTIFY_ACTION_AFTER_INSERT:
- case H5AC_NOTIFY_ACTION_AFTER_LOAD:
+ case H5AC_NOTIFY_ACTION_AFTER_LOAD:
/* Create flush dependency on parent */
- if(H5B2__create_flush_depend((H5AC_info_t *)internal->parent, (H5AC_info_t *)internal) < 0)
+ if (H5B2__create_flush_depend((H5AC_info_t *)internal->parent, (H5AC_info_t *)internal) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency")
break;
- case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
+ case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED:
case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED:
- /* do nothing */
- break;
+ /* do nothing */
+ break;
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
- /* Destroy flush dependency on parent */
- if(H5B2__destroy_flush_depend((H5AC_info_t *)internal->parent, (H5AC_info_t *)internal) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency")
+ /* Destroy flush dependency on parent */
+ if (H5B2__destroy_flush_depend((H5AC_info_t *)internal->parent, (H5AC_info_t *)internal) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency")
/* Detach from 'top' proxy for v2 B-tree */
- if(internal->top_proxy) {
- if(H5AC_proxy_entry_remove_child(internal->top_proxy, internal) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between internal node and v2 B-tree 'top' proxy")
+ if (internal->top_proxy) {
+ if (H5AC_proxy_entry_remove_child(internal->top_proxy, internal) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between internal node and v2 B-tree "
+ "'top' proxy")
internal->top_proxy = NULL;
} /* end if */
break;
@@ -919,11 +904,11 @@ H5B2__cache_int_notify(H5AC_notify_action_t action, void *_thing)
default:
#ifdef NDEBUG
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
-#else /* NDEBUG */
+#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
-#endif /* NDEBUG */
+#endif /* NDEBUG */
} /* end switch */
- } /* end if */
+ } /* end if */
else
HDassert(NULL == internal->top_proxy);
@@ -931,7 +916,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__cache_int_notify() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_int_free_icr
*
@@ -948,8 +932,8 @@ done:
static herr_t
H5B2__cache_int_free_icr(void *_thing)
{
- H5B2_internal_t *internal = (H5B2_internal_t *)_thing;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_internal_t *internal = (H5B2_internal_t *)_thing;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -957,14 +941,13 @@ H5B2__cache_int_free_icr(void *_thing)
HDassert(internal);
/* Release v2 B-tree internal node */
- if(H5B2__internal_free(internal) < 0)
+ if (H5B2__internal_free(internal) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree internal node")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__cache_int_free_icr() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_leaf_get_initial_load_size
*
@@ -995,7 +978,6 @@ H5B2__cache_leaf_get_initial_load_size(void *_udata, size_t *image_len)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5B2__cache_leaf_get_initial_load_size() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_leaf_verify_chksum
*
@@ -1012,12 +994,12 @@ H5B2__cache_leaf_get_initial_load_size(void *_udata, size_t *image_len)
static htri_t
H5B2__cache_leaf_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, void *_udata)
{
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- H5B2_internal_cache_ud_t *udata = (H5B2_internal_cache_ud_t *)_udata; /* Pointer to user data */
- size_t chk_size; /* Exact size of the node with checksum at the end */
- uint32_t stored_chksum; /* Stored metadata checksum value */
- uint32_t computed_chksum; /* Computed metadata checksum value */
- htri_t ret_value = TRUE; /* Return value */
+ const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+ H5B2_internal_cache_ud_t *udata = (H5B2_internal_cache_ud_t *)_udata; /* Pointer to user data */
+ size_t chk_size; /* Exact size of the node with checksum at the end */
+ uint32_t stored_chksum; /* Stored metadata checksum value */
+ uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -1031,13 +1013,12 @@ H5B2__cache_leaf_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, vo
/* Get stored and computed checksums */
H5F_get_checksums(image, chk_size, &stored_chksum, &computed_chksum);
- if(stored_chksum != computed_chksum)
- ret_value = FALSE;
+ if (stored_chksum != computed_chksum)
+ ret_value = FALSE;
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__cache_leaf_verify_chksum() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_leaf_deserialize
*
@@ -1052,16 +1033,16 @@ H5B2__cache_leaf_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, vo
*-------------------------------------------------------------------------
*/
static void *
-H5B2__cache_leaf_deserialize(const void *_image, size_t H5_ATTR_UNUSED len,
- void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
+H5B2__cache_leaf_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_udata,
+ hbool_t H5_ATTR_UNUSED *dirty)
{
H5B2_leaf_cache_ud_t *udata = (H5B2_leaf_cache_ud_t *)_udata;
- H5B2_leaf_t *leaf = NULL; /* Pointer to lead node loaded */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- uint8_t *native; /* Pointer to native keys */
- uint32_t stored_chksum; /* Stored metadata checksum value */
- unsigned u; /* Local index variable */
- H5B2_leaf_t *ret_value = NULL; /* Return value */
+ H5B2_leaf_t * leaf = NULL; /* Pointer to lead node loaded */
+ const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+ uint8_t * native; /* Pointer to native keys */
+ uint32_t stored_chksum; /* Stored metadata checksum value */
+ unsigned u; /* Local index variable */
+ H5B2_leaf_t * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -1070,43 +1051,43 @@ H5B2__cache_leaf_deserialize(const void *_image, size_t H5_ATTR_UNUSED len,
HDassert(udata);
/* Allocate new leaf node and reset cache info */
- if(NULL == (leaf = H5FL_CALLOC(H5B2_leaf_t)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed")
+ if (NULL == (leaf = H5FL_CALLOC(H5B2_leaf_t)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed")
/* Increment ref. count on B-tree header */
- if(H5B2__hdr_incr(udata->hdr) < 0)
+ if (H5B2__hdr_incr(udata->hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment ref. count on B-tree header")
/* Share B-tree header information */
- leaf->hdr = udata->hdr;
- leaf->parent = udata->parent;
+ leaf->hdr = udata->hdr;
+ leaf->parent = udata->parent;
leaf->shadow_epoch = udata->hdr->shadow_epoch;
/* Magic number */
- if(HDmemcmp(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC))
- HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree leaf node signature")
+ if (HDmemcmp(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree leaf node signature")
image += H5_SIZEOF_MAGIC;
/* Version */
- if(*image++ != H5B2_LEAF_VERSION)
- HGOTO_ERROR(H5E_BTREE, H5E_BADRANGE, NULL, "wrong B-tree leaf node version")
+ if (*image++ != H5B2_LEAF_VERSION)
+ HGOTO_ERROR(H5E_BTREE, H5E_BADRANGE, NULL, "wrong B-tree leaf node version")
/* B-tree type */
- if(*image++ != (uint8_t)udata->hdr->cls->id)
+ if (*image++ != (uint8_t)udata->hdr->cls->id)
HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type")
/* Allocate space for the native keys in memory */
- if(NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(udata->hdr->node_info[0].nat_rec_fac)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree leaf native keys")
+ if (NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(udata->hdr->node_info[0].nat_rec_fac)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree leaf native keys")
/* Set the number of records in the leaf */
leaf->nrec = udata->nrec;
/* Deserialize records for leaf node */
native = leaf->leaf_native;
- for(u = 0; u < leaf->nrec; u++) {
+ for (u = 0; u < leaf->nrec; u++) {
/* Decode record */
- if((udata->hdr->cls->decode)(image, native, udata->hdr->cb_ctx) < 0)
+ if ((udata->hdr->cls->decode)(image, native, udata->hdr->cb_ctx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, NULL, "unable to decode B-tree record")
/* Move to next record */
@@ -1129,14 +1110,13 @@ H5B2__cache_leaf_deserialize(const void *_image, size_t H5_ATTR_UNUSED len,
ret_value = leaf;
done:
- if(!ret_value && leaf)
- if(H5B2__leaf_free(leaf) < 0)
+ if (!ret_value && leaf)
+ if (H5B2__leaf_free(leaf) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to destroy B-tree leaf node")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__cache_leaf_deserialize() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_leaf_image_len
*
@@ -1152,7 +1132,7 @@ done:
static herr_t
H5B2__cache_leaf_image_len(const void *_thing, size_t *image_len)
{
- const H5B2_leaf_t *leaf = (const H5B2_leaf_t *)_thing; /* Pointer to the B-tree leaf node */
+ const H5B2_leaf_t *leaf = (const H5B2_leaf_t *)_thing; /* Pointer to the B-tree leaf node */
FUNC_ENTER_STATIC_NOERR
@@ -1167,7 +1147,6 @@ H5B2__cache_leaf_image_len(const void *_thing, size_t *image_len)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5B2__cache_leaf_image_len() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_leaf_serialize
*
@@ -1182,14 +1161,14 @@ H5B2__cache_leaf_image_len(const void *_thing, size_t *image_len)
*/
static herr_t
H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing)
+ void *_thing)
{
- H5B2_leaf_t *leaf = (H5B2_leaf_t *)_thing; /* Pointer to the B-tree leaf node */
- uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */
- uint8_t *native; /* Pointer to native keys */
- uint32_t metadata_chksum; /* Computed metadata checksum value */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_leaf_t *leaf = (H5B2_leaf_t *)_thing; /* Pointer to the B-tree leaf node */
+ uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
+ uint8_t * native; /* Pointer to native keys */
+ uint32_t metadata_chksum; /* Computed metadata checksum value */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1213,9 +1192,9 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H
/* Serialize records for leaf node */
native = leaf->leaf_native;
- for(u = 0; u < leaf->nrec; u++) {
+ for (u = 0; u < leaf->nrec; u++) {
/* Encode record */
- if((leaf->hdr->cls->encode)(image, native, leaf->hdr->cb_ctx) < 0)
+ if ((leaf->hdr->cls->encode)(image, native, leaf->hdr->cb_ctx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record")
/* Move to next record */
@@ -1224,7 +1203,8 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H
} /* end for */
/* Compute metadata checksum */
- metadata_chksum = H5_checksum_metadata(_image, (size_t)((const uint8_t *)image - (const uint8_t *)_image), 0);
+ metadata_chksum =
+ H5_checksum_metadata(_image, (size_t)((const uint8_t *)image - (const uint8_t *)_image), 0);
/* Metadata checksum */
UINT32ENCODE(image, metadata_chksum);
@@ -1239,7 +1219,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__cache_leaf_serialize() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_leaf_notify
*
@@ -1255,8 +1234,8 @@ done:
static herr_t
H5B2__cache_leaf_notify(H5AC_notify_action_t action, void *_thing)
{
- H5B2_leaf_t *leaf = (H5B2_leaf_t *)_thing;
- herr_t ret_value = SUCCEED;
+ H5B2_leaf_t *leaf = (H5B2_leaf_t *)_thing;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1267,16 +1246,16 @@ H5B2__cache_leaf_notify(H5AC_notify_action_t action, void *_thing)
HDassert(leaf->hdr);
/* Check if the file was opened with SWMR-write access */
- if(leaf->hdr->swmr_write) {
- switch(action) {
+ if (leaf->hdr->swmr_write) {
+ switch (action) {
case H5AC_NOTIFY_ACTION_AFTER_INSERT:
- case H5AC_NOTIFY_ACTION_AFTER_LOAD:
+ case H5AC_NOTIFY_ACTION_AFTER_LOAD:
/* Create flush dependency on parent */
- if(H5B2__create_flush_depend((H5AC_info_t *)leaf->parent, (H5AC_info_t *)leaf) < 0)
+ if (H5B2__create_flush_depend((H5AC_info_t *)leaf->parent, (H5AC_info_t *)leaf) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency")
break;
- case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
+ case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
@@ -1287,14 +1266,16 @@ H5B2__cache_leaf_notify(H5AC_notify_action_t action, void *_thing)
break;
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
- /* Destroy flush dependency on parent */
- if(H5B2__destroy_flush_depend((H5AC_info_t *)leaf->parent, (H5AC_info_t *)leaf) < 0)
+ /* Destroy flush dependency on parent */
+ if (H5B2__destroy_flush_depend((H5AC_info_t *)leaf->parent, (H5AC_info_t *)leaf) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency")
/* Detach from 'top' proxy for v2 B-tree */
- if(leaf->top_proxy) {
- if(H5AC_proxy_entry_remove_child(leaf->top_proxy, leaf) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between leaf node and v2 B-tree 'top' proxy")
+ if (leaf->top_proxy) {
+ if (H5AC_proxy_entry_remove_child(leaf->top_proxy, leaf) < 0)
+ HGOTO_ERROR(
+ H5E_BTREE, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between leaf node and v2 B-tree 'top' proxy")
leaf->top_proxy = NULL;
} /* end if */
break;
@@ -1302,11 +1283,11 @@ H5B2__cache_leaf_notify(H5AC_notify_action_t action, void *_thing)
default:
#ifdef NDEBUG
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
-#else /* NDEBUG */
+#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
-#endif /* NDEBUG */
+#endif /* NDEBUG */
} /* end switch */
- } /* end if */
+ } /* end if */
else
HDassert(NULL == leaf->top_proxy);
@@ -1314,7 +1295,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__cache_leaf_notify() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__cache_leaf_free_icr
*
@@ -1331,8 +1311,8 @@ done:
static herr_t
H5B2__cache_leaf_free_icr(void *_thing)
{
- H5B2_leaf_t *leaf = (H5B2_leaf_t *)_thing;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_leaf_t *leaf = (H5B2_leaf_t *)_thing;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1340,10 +1320,9 @@ H5B2__cache_leaf_free_icr(void *_thing)
HDassert(leaf);
/* Destroy v2 B-tree leaf node */
- if(H5B2__leaf_free(leaf) < 0)
+ if (H5B2__leaf_free(leaf) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree leaf node")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__cache_leaf_free_icr() */
-
diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c
index 1917987..b738d78 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -26,52 +26,44 @@
/* Module Setup */
/****************/
-#include "H5B2module.h" /* This source code file is part of the H5B2 module */
-
+#include "H5B2module.h" /* This source code file is part of the H5B2 module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5B2pkg.h" /* v2 B-trees */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5B2pkg.h" /* v2 B-trees */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
/*-------------------------------------------------------------------------
* Function: H5B2__hdr_debug
*
@@ -86,12 +78,12 @@
*/
herr_t
H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5B2_class_t H5_ATTR_NDEBUG_UNUSED *type, haddr_t H5_ATTR_NDEBUG_UNUSED obj_addr)
+ const H5B2_class_t H5_ATTR_NDEBUG_UNUSED *type, haddr_t H5_ATTR_NDEBUG_UNUSED obj_addr)
{
- H5B2_hdr_t *hdr = NULL; /* B-tree header info */
- unsigned u; /* Local index variable */
- char temp_str[128]; /* Temporary string, for formatting */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t *hdr = NULL; /* B-tree header info */
+ unsigned u; /* Local index variable */
+ char temp_str[128]; /* Temporary string, for formatting */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -107,7 +99,7 @@ H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
HDassert(type);
/* Load the B-tree header */
- if(NULL == (hdr = H5B2__hdr_protect(f, addr, f, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (hdr = H5B2__hdr_protect(f, addr, f, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
/* Set file pointer for this B-tree operation */
@@ -119,53 +111,38 @@ H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
/*
* Print the values.
*/
- HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
- "Tree type ID:", hdr->cls->name, (unsigned)hdr->cls->id);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Size of node:",
- (unsigned)hdr->node_size);
+ HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Tree type ID:", hdr->cls->name,
+ (unsigned)hdr->cls->id);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Size of node:", (unsigned)hdr->node_size);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Size of raw (disk) record:",
- (unsigned)hdr->rrec_size);
+ "Size of raw (disk) record:", (unsigned)hdr->rrec_size);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Dirty flag:",
- hdr->cache_info.is_dirty ? "True" : "False");
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Depth:",
- hdr->depth);
+ "Dirty flag:", hdr->cache_info.is_dirty ? "True" : "False");
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Depth:", hdr->depth);
HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
- "Number of records in tree:",
- hdr->root.all_nrec);
+ "Number of records in tree:", hdr->root.all_nrec);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Number of records in root node:",
- hdr->root.node_nrec);
+ "Number of records in root node:", hdr->root.node_nrec);
HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
- "Address of root node:",
- hdr->root.addr);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Split percent:",
- hdr->split_percent);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Merge percent:",
- hdr->merge_percent);
+ "Address of root node:", hdr->root.addr);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Split percent:", hdr->split_percent);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Merge percent:", hdr->merge_percent);
/* Print relevant node info */
HDfprintf(stream, "%*sNode Info: (max_nrec/split_nrec/merge_nrec)\n", indent, "");
- for(u = 0; u < (unsigned)(hdr->depth + 1); u++) {
+ for (u = 0; u < (unsigned)(hdr->depth + 1); u++) {
HDsnprintf(temp_str, sizeof(temp_str), "Depth %u:", u);
- HDfprintf(stream, "%*s%-*s (%u/%u/%u)\n", indent + 3, "", MAX(0, fwidth - 3),
- temp_str,
- hdr->node_info[u].max_nrec, hdr->node_info[u].split_nrec, hdr->node_info[u].merge_nrec);
+ HDfprintf(stream, "%*s%-*s (%u/%u/%u)\n", indent + 3, "", MAX(0, fwidth - 3), temp_str,
+ hdr->node_info[u].max_nrec, hdr->node_info[u].split_nrec, hdr->node_info[u].merge_nrec);
} /* end for */
done:
- if(hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
+ if (hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release v2 B-tree header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__hdr_debug() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__int_debug
*
@@ -179,15 +156,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, unsigned depth, haddr_t H5_ATTR_NDEBUG_UNUSED obj_addr)
+H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B2_class_t *type,
+ haddr_t hdr_addr, unsigned nrec, unsigned depth, haddr_t H5_ATTR_NDEBUG_UNUSED obj_addr)
{
- H5B2_hdr_t *hdr = NULL; /* B-tree header */
- H5B2_internal_t *internal = NULL; /* B-tree internal node */
- H5B2_node_ptr_t node_ptr; /* Fake node pointer for protect */
- unsigned u; /* Local index variable */
- char temp_str[128]; /* Temporary string, for formatting */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5B2_hdr_t * hdr = NULL; /* B-tree header */
+ H5B2_internal_t *internal = NULL; /* B-tree internal node */
+ H5B2_node_ptr_t node_ptr; /* Fake node pointer for protect */
+ unsigned u; /* Local index variable */
+ char temp_str[128]; /* Temporary string, for formatting */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -205,7 +182,7 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
HDassert(nrec > 0);
/* Load the B-tree header */
- if(NULL == (hdr = H5B2__hdr_protect(f, hdr_addr, f, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (hdr = H5B2__hdr_protect(f, hdr_addr, f, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header")
/* Set file pointer for this B-tree operation */
@@ -217,7 +194,8 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
H5_CHECK_OVERFLOW(depth, unsigned, uint16_t);
node_ptr.addr = addr;
H5_CHECKED_ASSIGN(node_ptr.node_nrec, uint16_t, nrec, unsigned)
- if(NULL == (internal = H5B2__protect_internal(hdr, NULL, &node_ptr, (uint16_t)depth, FALSE, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (internal = H5B2__protect_internal(hdr, NULL, &node_ptr, (uint16_t)depth, FALSE,
+ H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node")
/* Print opening message */
@@ -226,57 +204,46 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
/*
* Print the values.
*/
- HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
- "Tree type ID:", hdr->cls->name, (unsigned)hdr->cls->id);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Size of node:",
- (unsigned)hdr->node_size);
+ HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Tree type ID:", hdr->cls->name,
+ (unsigned)hdr->cls->id);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Size of node:", (unsigned)hdr->node_size);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Size of raw (disk) record:",
- (unsigned)hdr->rrec_size);
+ "Size of raw (disk) record:", (unsigned)hdr->rrec_size);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Dirty flag:",
- internal->cache_info.is_dirty ? "True" : "False");
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Number of records in node:",
- internal->nrec);
+ "Dirty flag:", internal->cache_info.is_dirty ? "True" : "False");
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of records in node:", internal->nrec);
/* Print all node pointers and records */
- for(u = 0; u < internal->nrec; u++) {
+ for (u = 0; u < internal->nrec; u++) {
/* Print node pointer */
HDsnprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u);
HDfprintf(stream, "%*s%-*s (%" PRIuHSIZE "/%u/%" PRIuHADDR ")\n", indent + 3, "", MAX(0, fwidth - 3),
- temp_str,
- internal->node_ptrs[u].all_nrec,
- internal->node_ptrs[u].node_nrec,
+ temp_str, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec,
internal->node_ptrs[u].addr);
/* Print record */
HDsnprintf(temp_str, sizeof(temp_str), "Record #%u:", u);
- HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
- temp_str);
+ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str);
HDassert(H5B2_INT_NREC(internal, hdr, u));
- (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_INT_NREC(internal, hdr, u), hdr->cb_ctx);
+ (void)(type->debug)(stream, indent + 6, MAX(0, fwidth - 6), H5B2_INT_NREC(internal, hdr, u),
+ hdr->cb_ctx);
} /* end for */
/* Print final node pointer */
HDsnprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u);
HDfprintf(stream, "%*s%-*s (%" PRIuHSIZE "/%u/%" PRIuHADDR ")\n", indent + 3, "", MAX(0, fwidth - 3),
- temp_str,
- internal->node_ptrs[u].all_nrec,
- internal->node_ptrs[u].node_nrec,
+ temp_str, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec,
internal->node_ptrs[u].addr);
done:
- if(hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
+ if (hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release v2 B-tree header")
- if(internal && H5AC_unprotect(f, H5AC_BT2_INT, addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (internal && H5AC_unprotect(f, H5AC_BT2_INT, addr, internal, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree internal node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__int_debug() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__leaf_debug
*
@@ -290,15 +257,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, haddr_t H5_ATTR_NDEBUG_UNUSED obj_addr)
+H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B2_class_t *type,
+ haddr_t hdr_addr, unsigned nrec, haddr_t H5_ATTR_NDEBUG_UNUSED obj_addr)
{
- H5B2_hdr_t *hdr = NULL; /* B-tree header */
- H5B2_leaf_t *leaf = NULL; /* B-tree leaf node */
- H5B2_node_ptr_t node_ptr; /* Fake node pointer for protect */
- unsigned u; /* Local index variable */
- char temp_str[128]; /* Temporary string, for formatting */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t * hdr = NULL; /* B-tree header */
+ H5B2_leaf_t * leaf = NULL; /* B-tree leaf node */
+ H5B2_node_ptr_t node_ptr; /* Fake node pointer for protect */
+ unsigned u; /* Local index variable */
+ char temp_str[128]; /* Temporary string, for formatting */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -316,7 +283,7 @@ H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
HDassert(nrec > 0);
/* Load the B-tree header */
- if(NULL == (hdr = H5B2__hdr_protect(f, hdr_addr, f, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (hdr = H5B2__hdr_protect(f, hdr_addr, f, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header")
/* Set file pointer for this B-tree operation */
@@ -328,7 +295,7 @@ H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
H5_CHECK_OVERFLOW(nrec, unsigned, uint16_t);
node_ptr.addr = addr;
H5_CHECKED_ASSIGN(node_ptr.node_nrec, uint16_t, nrec, unsigned)
- if(NULL == (leaf = H5B2__protect_leaf(hdr, NULL, &node_ptr, FALSE, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (leaf = H5B2__protect_leaf(hdr, NULL, &node_ptr, FALSE, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
/* Print opening message */
@@ -337,37 +304,30 @@ H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
/*
* Print the values.
*/
- HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
- "Tree type ID:", hdr->cls->name, (unsigned)hdr->cls->id);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Size of node:",
- (unsigned)hdr->node_size);
+ HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Tree type ID:", hdr->cls->name,
+ (unsigned)hdr->cls->id);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Size of node:", (unsigned)hdr->node_size);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Size of raw (disk) record:",
- (unsigned)hdr->rrec_size);
+ "Size of raw (disk) record:", (unsigned)hdr->rrec_size);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Dirty flag:",
- leaf->cache_info.is_dirty ? "True" : "False");
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Number of records in node:",
- leaf->nrec);
+ "Dirty flag:", leaf->cache_info.is_dirty ? "True" : "False");
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of records in node:", leaf->nrec);
/* Print all node pointers and records */
- for(u = 0; u < leaf->nrec; u++) {
+ for (u = 0; u < leaf->nrec; u++) {
/* Print record */
HDsnprintf(temp_str, sizeof(temp_str), "Record #%u:", u);
- HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
- temp_str);
+ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str);
HDassert(H5B2_LEAF_NREC(leaf, hdr, u));
- (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_LEAF_NREC(leaf, hdr, u), hdr->cb_ctx);
+ (void)(type->debug)(stream, indent + 6, MAX(0, fwidth - 6), H5B2_LEAF_NREC(leaf, hdr, u),
+ hdr->cb_ctx);
} /* end for */
done:
- if(hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
+ if (hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
- if(leaf && H5AC_unprotect(f, H5AC_BT2_LEAF, addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (leaf && H5AC_unprotect(f, H5AC_BT2_LEAF, addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree leaf node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__leaf_debug() */
-
diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c
index 7b8b564..86f4570 100644
--- a/src/H5B2hdr.c
+++ b/src/H5B2hdr.c
@@ -26,26 +26,24 @@
/* Module Setup */
/****************/
-#include "H5B2module.h" /* This source code file is part of the H5B2 module */
-
+#include "H5B2module.h" /* This source code file is part of the H5B2 module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5B2pkg.h" /* v2 B-trees */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5private.h" /* Generic Functions */
+#include "H5B2pkg.h" /* v2 B-trees */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VMprivate.h" /* Vectors and arrays */
/****************/
/* Local Macros */
/****************/
/* Number of records that fit into leaf node */
-#define H5B2_NUM_LEAF_REC(n, r) \
- (((n) - H5B2_LEAF_PREFIX_SIZE) / (r))
+#define H5B2_NUM_LEAF_REC(n, r) (((n)-H5B2_LEAF_PREFIX_SIZE) / (r))
/* Uncomment this macro to enable extra sanity checking */
/* #define H5B2_DEBUG */
@@ -54,27 +52,22 @@
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -91,8 +84,6 @@ H5FL_SEQ_DEFINE_STATIC(size_t);
/* Declare a free list to manage the 'H5B2_node_info_t' sequence information */
H5FL_SEQ_DEFINE(H5B2_node_info_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5B2__hdr_init
*
@@ -106,13 +97,12 @@ H5FL_SEQ_DEFINE(H5B2_node_info_t);
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata,
- uint16_t depth)
+H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, uint16_t depth)
{
- size_t sz_max_nrec; /* Temporary variable for range checking */
- unsigned u_max_nrec_size; /* Temporary variable for range checking */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t sz_max_nrec; /* Temporary variable for range checking */
+ unsigned u_max_nrec_size; /* Temporary variable for range checking */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -123,7 +113,7 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata,
HDassert(cparam);
HDassert(cparam->cls);
HDassert((cparam->cls->crt_context && cparam->cls->dst_context) ||
- (NULL == cparam->cls->crt_context && NULL == cparam->cls->dst_context));
+ (NULL == cparam->cls->crt_context && NULL == cparam->cls->dst_context));
HDassert(cparam->node_size > 0);
HDassert(cparam->rrec_size > 0);
HDassert(cparam->merge_percent > 0 && cparam->merge_percent <= 100);
@@ -136,40 +126,41 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata,
/* Assign user's information */
hdr->split_percent = cparam->split_percent;
hdr->merge_percent = cparam->merge_percent;
- hdr->node_size = cparam->node_size;
- hdr->rrec_size = cparam->rrec_size;
+ hdr->node_size = cparam->node_size;
+ hdr->rrec_size = cparam->rrec_size;
/* Assign common type information */
hdr->cls = cparam->cls;
/* Allocate "page" for node I/O */
- if(NULL == (hdr->page = H5FL_BLK_MALLOC(node_page, hdr->node_size)))
+ if (NULL == (hdr->page = H5FL_BLK_MALLOC(node_page, hdr->node_size)))
HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed")
HDmemset(hdr->page, 0, hdr->node_size);
/* Allocate array of node info structs */
- if(NULL == (hdr->node_info = H5FL_SEQ_MALLOC(H5B2_node_info_t, (size_t)(hdr->depth + 1))))
+ if (NULL == (hdr->node_info = H5FL_SEQ_MALLOC(H5B2_node_info_t, (size_t)(hdr->depth + 1))))
HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Initialize leaf node info */
sz_max_nrec = H5B2_NUM_LEAF_REC(hdr->node_size, hdr->rrec_size);
H5_CHECKED_ASSIGN(hdr->node_info[0].max_nrec, unsigned, sz_max_nrec, size_t)
- hdr->node_info[0].split_nrec = (hdr->node_info[0].max_nrec * hdr->split_percent) / 100;
- hdr->node_info[0].merge_nrec = (hdr->node_info[0].max_nrec * hdr->merge_percent) / 100;
- hdr->node_info[0].cum_max_nrec = hdr->node_info[0].max_nrec;
+ hdr->node_info[0].split_nrec = (hdr->node_info[0].max_nrec * hdr->split_percent) / 100;
+ hdr->node_info[0].merge_nrec = (hdr->node_info[0].max_nrec * hdr->merge_percent) / 100;
+ hdr->node_info[0].cum_max_nrec = hdr->node_info[0].max_nrec;
hdr->node_info[0].cum_max_nrec_size = 0;
- if(NULL == (hdr->node_info[0].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[0].max_nrec)))
+ if (NULL ==
+ (hdr->node_info[0].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[0].max_nrec)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't create node native key block factory")
hdr->node_info[0].node_ptr_fac = NULL;
/* Allocate array of pointers to internal node native keys */
/* (uses leaf # of records because its the largest) */
- if(NULL == (hdr->nat_off = H5FL_SEQ_MALLOC(size_t, (size_t)hdr->node_info[0].max_nrec)))
+ if (NULL == (hdr->nat_off = H5FL_SEQ_MALLOC(size_t, (size_t)hdr->node_info[0].max_nrec)))
HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Initialize offsets in native key block */
/* (uses leaf # of records because its the largest) */
- for(u = 0; u < hdr->node_info[0].max_nrec; u++)
+ for (u = 0; u < hdr->node_info[0].max_nrec; u++)
hdr->nat_off[u] = hdr->cls->nrec_size * u;
/* Compute size to store # of records in each node */
@@ -179,8 +170,8 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata,
HDassert(hdr->max_nrec_size <= H5B2_SIZEOF_RECORDS_PER_NODE);
/* Initialize internal node info */
- if(depth > 0) {
- for(u = 1; u < (unsigned)(depth + 1); u++) {
+ if (depth > 0) {
+ for (u = 1; u < (unsigned)(depth + 1); u++) {
sz_max_nrec = H5B2_NUM_INT_REC(hdr, u);
H5_CHECKED_ASSIGN(hdr->node_info[u].max_nrec, unsigned, sz_max_nrec, size_t)
HDassert(hdr->node_info[u].max_nrec <= hdr->node_info[u - 1].max_nrec);
@@ -188,39 +179,42 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata,
hdr->node_info[u].split_nrec = (hdr->node_info[u].max_nrec * hdr->split_percent) / 100;
hdr->node_info[u].merge_nrec = (hdr->node_info[u].max_nrec * hdr->merge_percent) / 100;
- hdr->node_info[u].cum_max_nrec = ((hdr->node_info[u].max_nrec + 1) *
- hdr->node_info[u - 1].cum_max_nrec) + hdr->node_info[u].max_nrec;
+ hdr->node_info[u].cum_max_nrec =
+ ((hdr->node_info[u].max_nrec + 1) * hdr->node_info[u - 1].cum_max_nrec) +
+ hdr->node_info[u].max_nrec;
u_max_nrec_size = H5VM_limit_enc_size((uint64_t)hdr->node_info[u].cum_max_nrec);
H5_CHECKED_ASSIGN(hdr->node_info[u].cum_max_nrec_size, uint8_t, u_max_nrec_size, unsigned)
- if(NULL == (hdr->node_info[u].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[u].max_nrec)))
+ if (NULL == (hdr->node_info[u].nat_rec_fac =
+ H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[u].max_nrec)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't create node native key block factory")
- if(NULL == (hdr->node_info[u].node_ptr_fac = H5FL_fac_init(sizeof(H5B2_node_ptr_t) * (hdr->node_info[u].max_nrec + 1))))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't create internal 'branch' node node pointer block factory")
+ if (NULL == (hdr->node_info[u].node_ptr_fac =
+ H5FL_fac_init(sizeof(H5B2_node_ptr_t) * (hdr->node_info[u].max_nrec + 1))))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL,
+ "can't create internal 'branch' node node pointer block factory")
} /* end for */
- } /* end if */
+ } /* end if */
/* Determine if we are doing SWMR writes. Only enable for data chunks for now. */
- hdr->swmr_write = (H5F_INTENT(hdr->f) & H5F_ACC_SWMR_WRITE) > 0
- && (hdr->cls->id == H5B2_CDSET_ID || hdr->cls->id == H5B2_CDSET_FILT_ID);
+ hdr->swmr_write = (H5F_INTENT(hdr->f) & H5F_ACC_SWMR_WRITE) > 0 &&
+ (hdr->cls->id == H5B2_CDSET_ID || hdr->cls->id == H5B2_CDSET_FILT_ID);
/* Reset the shadow epoch */
hdr->shadow_epoch = 0;
/* Create the callback context, if the callback exists */
- if(hdr->cls->crt_context)
- if(NULL == (hdr->cb_ctx = (*hdr->cls->crt_context)(ctx_udata)))
+ if (hdr->cls->crt_context)
+ if (NULL == (hdr->cb_ctx = (*hdr->cls->crt_context)(ctx_udata)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, FAIL, "unable to create v2 B-tree client callback context")
done:
- if(ret_value < 0)
- if(H5B2__hdr_free(hdr) < 0)
+ if (ret_value < 0)
+ if (H5B2__hdr_free(hdr) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free shared v2 B-tree info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__hdr_init() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__hdr_alloc
*
@@ -236,8 +230,8 @@ done:
H5B2_hdr_t *
H5B2__hdr_alloc(H5F_t *f)
{
- H5B2_hdr_t *hdr = NULL; /* v2 B-tree header */
- H5B2_hdr_t *ret_value = NULL; /* Return value */
+ H5B2_hdr_t *hdr = NULL; /* v2 B-tree header */
+ H5B2_hdr_t *ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -247,15 +241,15 @@ H5B2__hdr_alloc(H5F_t *f)
HDassert(f);
/* Allocate space for the shared information */
- if(NULL == (hdr = H5FL_CALLOC(H5B2_hdr_t)))
+ if (NULL == (hdr = H5FL_CALLOC(H5B2_hdr_t)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree header")
/* Assign non-zero information */
- hdr->f = f;
+ hdr->f = f;
hdr->sizeof_addr = H5F_SIZEOF_ADDR(f);
hdr->sizeof_size = H5F_SIZEOF_SIZE(f);
- hdr->hdr_size = H5B2_HEADER_SIZE_HDR(hdr);
- hdr->root.addr = HADDR_UNDEF;
+ hdr->hdr_size = H5B2_HEADER_SIZE_HDR(hdr);
+ hdr->root.addr = HADDR_UNDEF;
/* Set return value */
ret_value = hdr;
@@ -265,7 +259,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__hdr_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__hdr_create
*
@@ -281,9 +274,9 @@ done:
haddr_t
H5B2__hdr_create(H5F_t *f, const H5B2_create_t *cparam, void *ctx_udata)
{
- H5B2_hdr_t *hdr = NULL; /* The new v2 B-tree header information */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
- haddr_t ret_value = HADDR_UNDEF; /* Return value */
+ H5B2_hdr_t *hdr = NULL; /* The new v2 B-tree header information */
+ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ haddr_t ret_value = HADDR_UNDEF; /* Return value */
FUNC_ENTER_PACKAGE
@@ -294,56 +287,58 @@ H5B2__hdr_create(H5F_t *f, const H5B2_create_t *cparam, void *ctx_udata)
HDassert(cparam);
/* Allocate v2 B-tree header */
- if(NULL == (hdr = H5B2__hdr_alloc(f)))
+ if (NULL == (hdr = H5B2__hdr_alloc(f)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed for B-tree header")
/* Initialize shared B-tree info */
- if(H5B2__hdr_init(hdr, cparam, ctx_udata, (uint16_t)0) < 0)
+ if (H5B2__hdr_init(hdr, cparam, ctx_udata, (uint16_t)0) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, HADDR_UNDEF, "can't create shared B-tree info")
/* Allocate space for the header on disk */
- if(HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_BTREE, (hsize_t)hdr->hdr_size)))
+ if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_BTREE, (hsize_t)hdr->hdr_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for B-tree header")
/* Create 'top' proxy for extensible array entries */
- if(hdr->swmr_write)
- if(NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
+ if (hdr->swmr_write)
+ if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, HADDR_UNDEF, "can't create v2 B-tree proxy")
/* Cache the new B-tree node */
- if(H5AC_insert_entry(f, H5AC_BT2_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_insert_entry(f, H5AC_BT2_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, HADDR_UNDEF, "can't add B-tree header to cache")
inserted = TRUE;
/* Add header as child of 'top' proxy */
- if(hdr->top_proxy)
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, HADDR_UNDEF, "unable to add v2 B-tree header as child of array proxy")
+ if (hdr->top_proxy)
+ if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, HADDR_UNDEF,
+ "unable to add v2 B-tree header as child of array proxy")
/* Set address of v2 B-tree header to return */
ret_value = hdr->addr;
done:
- if(!H5F_addr_defined(ret_value))
- if(hdr) {
+ if (!H5F_addr_defined(ret_value))
+ if (hdr) {
/* Remove from cache, if inserted */
- if(inserted)
- if(H5AC_remove_entry(hdr) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTREMOVE, HADDR_UNDEF, "unable to remove v2 B-tree header from cache")
+ if (inserted)
+ if (H5AC_remove_entry(hdr) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTREMOVE, HADDR_UNDEF,
+ "unable to remove v2 B-tree header from cache")
/* Release header's disk space */
- if(H5F_addr_defined(hdr->addr) && H5MF_xfree(f, H5FD_MEM_BTREE, hdr->addr, (hsize_t)hdr->hdr_size) < 0)
+ if (H5F_addr_defined(hdr->addr) &&
+ H5MF_xfree(f, H5FD_MEM_BTREE, hdr->addr, (hsize_t)hdr->hdr_size) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, HADDR_UNDEF, "unable to free v2 B-tree header")
/* Destroy header */
- if(H5B2__hdr_free(hdr) < 0)
+ if (H5B2__hdr_free(hdr) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, HADDR_UNDEF, "unable to release v2 B-tree header")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__hdr_create() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__hdr_incr
*
@@ -359,7 +354,7 @@ done:
herr_t
H5B2__hdr_incr(H5B2_hdr_t *hdr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -367,8 +362,8 @@ H5B2__hdr_incr(H5B2_hdr_t *hdr)
HDassert(hdr);
/* Mark header as un-evictable when a B-tree node is depending on it */
- if(hdr->rc == 0)
- if(H5AC_pin_protected_entry(hdr) < 0)
+ if (hdr->rc == 0)
+ if (H5AC_pin_protected_entry(hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTPIN, FAIL, "unable to pin v2 B-tree header")
/* Increment reference count on B-tree header */
@@ -378,7 +373,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__hdr_incr() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__hdr_decr
*
@@ -394,7 +388,7 @@ done:
herr_t
H5B2__hdr_decr(H5B2_hdr_t *hdr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -406,15 +400,14 @@ H5B2__hdr_decr(H5B2_hdr_t *hdr)
hdr->rc--;
/* Mark header as evictable again when no nodes depend on it */
- if(hdr->rc == 0)
- if(H5AC_unpin_entry(hdr) < 0)
+ if (hdr->rc == 0)
+ if (H5AC_unpin_entry(hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin v2 B-tree header")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__hdr_decr() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__hdr_fuse_incr
*
@@ -441,7 +434,6 @@ H5B2__hdr_fuse_incr(H5B2_hdr_t *hdr)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5B2__hdr_fuse_incr() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__hdr_fuse_decr
*
@@ -469,7 +461,6 @@ H5B2__hdr_fuse_decr(H5B2_hdr_t *hdr)
FUNC_LEAVE_NOAPI(hdr->file_rc)
} /* end H5B2__hdr_fuse_decr() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__hdr_dirty
*
@@ -485,7 +476,7 @@ H5B2__hdr_fuse_decr(H5B2_hdr_t *hdr)
herr_t
H5B2__hdr_dirty(H5B2_hdr_t *hdr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -493,14 +484,13 @@ H5B2__hdr_dirty(H5B2_hdr_t *hdr)
HDassert(hdr);
/* Mark B-tree header as dirty in cache */
- if(H5AC_mark_entry_dirty(hdr) < 0)
+ if (H5AC_mark_entry_dirty(hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark v2 B-tree header as dirty")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__hdr_dirty() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__hdr_protect
*
@@ -516,9 +506,9 @@ done:
H5B2_hdr_t *
H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, unsigned flags)
{
- H5B2_hdr_cache_ud_t udata; /* User data for cache callbacks */
- H5B2_hdr_t *hdr = NULL; /* v2 B-tree header */
- H5B2_hdr_t *ret_value = NULL; /* Return value */
+ H5B2_hdr_cache_ud_t udata; /* User data for cache callbacks */
+ H5B2_hdr_t * hdr = NULL; /* v2 B-tree header */
+ H5B2_hdr_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -530,23 +520,24 @@ H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, unsigned flags)
HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
/* Set up user data for cache callbacks */
- udata.f = f;
- udata.addr = hdr_addr;
+ udata.f = f;
+ udata.addr = hdr_addr;
udata.ctx_udata = ctx_udata;
/* Protect the header */
- if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, H5AC_BT2_HDR, hdr_addr, &udata, flags)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to load v2 B-tree header, address = %llu", (unsigned long long)hdr_addr)
- hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */
+ if (NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, H5AC_BT2_HDR, hdr_addr, &udata, flags)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to load v2 B-tree header, address = %llu",
+ (unsigned long long)hdr_addr)
+ hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */
/* Create top proxy, if it doesn't exist */
- if(hdr->swmr_write && NULL == hdr->top_proxy) {
+ if (hdr->swmr_write && NULL == hdr->top_proxy) {
/* Create 'top' proxy for v2 B-tree entries */
- if(NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
+ if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, NULL, "can't create v2 B-tree proxy")
/* Add header as child of 'top' proxy */
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
+ if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, NULL, "unable to add v2 B-tree header as child of proxy")
} /* end if */
@@ -555,16 +546,16 @@ H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, unsigned flags)
done:
/* Clean up on error */
- if(!ret_value) {
+ if (!ret_value) {
/* Release the header, if it was protected */
- if(hdr && H5AC_unprotect(hdr->f, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to unprotect v2 B-tree header, address = %llu", (unsigned long long)hdr_addr)
+ if (hdr && H5AC_unprotect(hdr->f, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL,
+ "unable to unprotect v2 B-tree header, address = %llu", (unsigned long long)hdr_addr)
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__hdr_protect() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__hdr_unprotect
*
@@ -580,7 +571,7 @@ done:
herr_t
H5B2__hdr_unprotect(H5B2_hdr_t *hdr, unsigned cache_flags)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -588,14 +579,14 @@ H5B2__hdr_unprotect(H5B2_hdr_t *hdr, unsigned cache_flags)
HDassert(hdr);
/* Unprotect the header */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_HDR, hdr->addr, hdr, cache_flags) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to unprotect v2 B-tree header, address = %llu", (unsigned long long)hdr->addr)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_HDR, hdr->addr, hdr, cache_flags) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect v2 B-tree header, address = %llu", (unsigned long long)hdr->addr)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__hdr_unprotect() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__hdr_free
*
@@ -611,7 +602,7 @@ done:
herr_t
H5B2__hdr_free(H5B2_hdr_t *hdr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -619,32 +610,34 @@ H5B2__hdr_free(H5B2_hdr_t *hdr)
HDassert(hdr);
/* Destroy the callback context */
- if(hdr->cb_ctx) {
- if((*hdr->cls->dst_context)(hdr->cb_ctx) < 0)
+ if (hdr->cb_ctx) {
+ if ((*hdr->cls->dst_context)(hdr->cb_ctx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "can't destroy v2 B-tree client callback context")
hdr->cb_ctx = NULL;
} /* end if */
/* Free the B-tree node buffer */
- if(hdr->page)
+ if (hdr->page)
hdr->page = H5FL_BLK_FREE(node_page, hdr->page);
/* Free the array of offsets into the native key block */
- if(hdr->nat_off)
+ if (hdr->nat_off)
hdr->nat_off = H5FL_SEQ_FREE(size_t, hdr->nat_off);
/* Release the node info */
- if(hdr->node_info) {
- unsigned u; /* Local index variable */
+ if (hdr->node_info) {
+ unsigned u; /* Local index variable */
/* Destroy free list factories */
- for(u = 0; u < (unsigned)(hdr->depth + 1); u++) {
- if(hdr->node_info[u].nat_rec_fac)
- if(H5FL_fac_term(hdr->node_info[u].nat_rec_fac) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "can't destroy node's native record block factory")
- if(hdr->node_info[u].node_ptr_fac)
- if(H5FL_fac_term(hdr->node_info[u].node_ptr_fac) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "can't destroy node's node pointer block factory")
+ for (u = 0; u < (unsigned)(hdr->depth + 1); u++) {
+ if (hdr->node_info[u].nat_rec_fac)
+ if (H5FL_fac_term(hdr->node_info[u].nat_rec_fac) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL,
+ "can't destroy node's native record block factory")
+ if (hdr->node_info[u].node_ptr_fac)
+ if (H5FL_fac_term(hdr->node_info[u].node_ptr_fac) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL,
+ "can't destroy node's node pointer block factory")
} /* end for */
/* Free the array of node info structs */
@@ -652,14 +645,14 @@ H5B2__hdr_free(H5B2_hdr_t *hdr)
} /* end if */
/* Release the min & max record info, if set */
- if(hdr->min_native_rec)
- hdr->min_native_rec = H5MM_xfree(hdr->min_native_rec);
- if(hdr->max_native_rec)
- hdr->max_native_rec = H5MM_xfree(hdr->max_native_rec);
+ if (hdr->min_native_rec)
+ hdr->min_native_rec = H5MM_xfree(hdr->min_native_rec);
+ if (hdr->max_native_rec)
+ hdr->max_native_rec = H5MM_xfree(hdr->max_native_rec);
/* Destroy the 'top' proxy */
- if(hdr->top_proxy) {
- if(H5AC_proxy_entry_dest(hdr->top_proxy) < 0)
+ if (hdr->top_proxy) {
+ if (H5AC_proxy_entry_dest(hdr->top_proxy) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to destroy v2 B-tree 'top' proxy")
hdr->top_proxy = NULL;
} /* end if */
@@ -671,7 +664,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__hdr_free() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__hdr_delete
*
@@ -687,8 +679,8 @@ done:
herr_t
H5B2__hdr_delete(H5B2_hdr_t *hdr)
{
- unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting v2 B-tree header */
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting v2 B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -696,22 +688,23 @@ H5B2__hdr_delete(H5B2_hdr_t *hdr)
HDassert(hdr);
#ifndef NDEBUG
-{
- unsigned hdr_status = 0; /* v2 B-tree header's status in the metadata cache */
-
- /* Check the v2 B-tree header's status in the metadata cache */
- if(H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to check metadata cache status for v2 B-tree header")
-
- /* Sanity checks on v2 B-tree header */
- HDassert(hdr_status & H5AC_ES__IN_CACHE);
- HDassert(hdr_status & H5AC_ES__IS_PROTECTED);
-} /* end block */
+ {
+ unsigned hdr_status = 0; /* v2 B-tree header's status in the metadata cache */
+
+ /* Check the v2 B-tree header's status in the metadata cache */
+ if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL,
+ "unable to check metadata cache status for v2 B-tree header")
+
+ /* Sanity checks on v2 B-tree header */
+ HDassert(hdr_status & H5AC_ES__IN_CACHE);
+ HDassert(hdr_status & H5AC_ES__IS_PROTECTED);
+ } /* end block */
#endif /* NDEBUG */
/* Delete all nodes in B-tree */
- if(H5F_addr_defined(hdr->root.addr))
- if(H5B2__delete_node(hdr, hdr->depth, &hdr->root, hdr, hdr->remove_op, hdr->remove_op_data) < 0)
+ if (H5F_addr_defined(hdr->root.addr))
+ if (H5B2__delete_node(hdr, hdr->depth, &hdr->root, hdr, hdr->remove_op, hdr->remove_op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete B-tree nodes")
/* Indicate that the heap header should be deleted & file space freed */
@@ -719,9 +712,8 @@ H5B2__hdr_delete(H5B2_hdr_t *hdr)
done:
/* Unprotect the header with appropriate flags */
- if(H5B2__hdr_unprotect(hdr, cache_flags) < 0)
+ if (H5B2__hdr_unprotect(hdr, cache_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release v2 B-tree header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__hdr_delete() */
-
diff --git a/src/H5B2int.c b/src/H5B2int.c
index 816d8f8..6d704a0 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -26,52 +26,44 @@
/* Module Setup */
/****************/
-#include "H5B2module.h" /* This source code file is part of the H5B2 module */
-
+#include "H5B2module.h" /* This source code file is part of the H5B2 module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5B2pkg.h" /* v2 B-trees */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5VMprivate.h" /* Vectors and arrays */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5B2pkg.h" /* v2 B-trees */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VMprivate.h" /* Vectors and arrays */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5B2__update_child_flush_depends(H5B2_hdr_t *hdr,
- unsigned depth, const H5B2_node_ptr_t *node_ptrs, unsigned start_idx,
- unsigned end_idx, void *old_parent, void *new_parent);
-
+static herr_t H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth,
+ const H5B2_node_ptr_t *node_ptrs, unsigned start_idx,
+ unsigned end_idx, void *old_parent, void *new_parent);
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -79,8 +71,6 @@ static herr_t H5B2__update_child_flush_depends(H5B2_hdr_t *hdr,
/* Declare a free list to manage the 'H5B2_node_info_t' sequence information */
H5FL_SEQ_EXTERN(H5B2_node_info_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5B2__locate_record
*
@@ -102,23 +92,23 @@ H5FL_SEQ_EXTERN(H5B2_node_info_t);
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off,
- const uint8_t *native, const void *udata, unsigned *idx, int *cmp)
+H5B2__locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off, const uint8_t *native,
+ const void *udata, unsigned *idx, int *cmp)
{
- unsigned lo = 0, hi; /* Low & high index values */
- unsigned my_idx = 0; /* Final index value */
- herr_t ret_value = SUCCEED;
+ unsigned lo = 0, hi; /* Low & high index values */
+ unsigned my_idx = 0; /* Final index value */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
*cmp = -1;
hi = nrec;
- while(lo < hi && *cmp) {
+ while (lo < hi && *cmp) {
my_idx = (lo + hi) / 2;
- if((type->compare)(udata, native + rec_off[my_idx], cmp) < 0)
+ if ((type->compare)(udata, native + rec_off[my_idx], cmp) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
- if(*cmp < 0)
+ if (*cmp < 0)
hi = my_idx;
else
lo = my_idx + 1;
@@ -130,7 +120,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__locate_record */
-
/*-------------------------------------------------------------------------
* Function: H5B2__split1
*
@@ -146,19 +135,21 @@ done:
*/
herr_t
H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
- unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal,
- unsigned *internal_flags_ptr, unsigned idx)
+ unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr,
+ unsigned idx)
{
- const H5AC_class_t *child_class; /* Pointer to child node's class info */
- haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- void *left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
- uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */
- uint8_t *left_native, *right_native;/* Pointers to childs' native records */
- H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL;/* Pointers to childs' node pointer info */
- uint16_t mid_record; /* Index of "middle" record in current node */
- uint16_t old_node_nrec; /* Number of records in internal node split */
- unsigned left_child_flags = H5AC__NO_FLAGS_SET, right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5AC_class_t *child_class; /* Pointer to child node's class info */
+ haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
+ void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
+ uint16_t * left_nrec, *right_nrec; /* Pointers to child # of records */
+ uint8_t * left_native, *right_native; /* Pointers to childs' native records */
+ H5B2_node_ptr_t * left_node_ptrs = NULL,
+ *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
+ uint16_t mid_record; /* Index of "middle" record in current node */
+ uint16_t old_node_nrec; /* Number of records in internal node split */
+ unsigned left_child_flags = H5AC__NO_FLAGS_SET,
+ right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -168,68 +159,75 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
HDassert(internal_flags_ptr);
/* Slide records in parent node up one space, to make room for promoted record */
- if(idx < internal->nrec) {
- HDmemmove(H5B2_INT_NREC(internal, hdr, idx + 1), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size * (internal->nrec - idx));
- HDmemmove(&(internal->node_ptrs[idx + 2]), &(internal->node_ptrs[idx + 1]), sizeof(H5B2_node_ptr_t) * (internal->nrec - idx));
+ if (idx < internal->nrec) {
+ HDmemmove(H5B2_INT_NREC(internal, hdr, idx + 1), H5B2_INT_NREC(internal, hdr, idx),
+ hdr->cls->nrec_size * (internal->nrec - idx));
+ HDmemmove(&(internal->node_ptrs[idx + 2]), &(internal->node_ptrs[idx + 1]),
+ sizeof(H5B2_node_ptr_t) * (internal->nrec - idx));
} /* end if */
/* Check for the kind of B-tree node to split */
- if(depth > 1) {
- H5B2_internal_t *left_int = NULL, *right_int = NULL; /* Pointers to old & new internal nodes */
+ if (depth > 1) {
+ H5B2_internal_t *left_int = NULL, *right_int = NULL; /* Pointers to old & new internal nodes */
/* Create new internal node */
internal->node_ptrs[idx + 1].all_nrec = internal->node_ptrs[idx + 1].node_nrec = 0;
- if(H5B2__create_internal(hdr, internal, &(internal->node_ptrs[idx + 1]), (uint16_t)(depth - 1)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new internal node")
+ if (H5B2__create_internal(hdr, internal, &(internal->node_ptrs[idx + 1]), (uint16_t)(depth - 1)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new internal node")
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_INT;
/* Protect both leaves */
/* (Shadow left node if doing SWMR writes) */
- if(NULL == (left_int = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL ==
+ (left_int = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx],
+ (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
left_addr = internal->node_ptrs[idx].addr;
- if(NULL == (right_int = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx + 1], (uint16_t)(depth - 1), FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL == (right_int = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx + 1],
+ (uint16_t)(depth - 1), FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
right_addr = internal->node_ptrs[idx + 1].addr;
/* More setup for child nodes */
- left_child = left_int;
- right_child = right_int;
- left_nrec = &(left_int->nrec);
- right_nrec = &(right_int->nrec);
- left_native = left_int->int_native;
- right_native = right_int->int_native;
- left_node_ptrs = left_int->node_ptrs;
+ left_child = left_int;
+ right_child = right_int;
+ left_nrec = &(left_int->nrec);
+ right_nrec = &(right_int->nrec);
+ left_native = left_int->int_native;
+ right_native = right_int->int_native;
+ left_node_ptrs = left_int->node_ptrs;
right_node_ptrs = right_int->node_ptrs;
} /* end if */
else {
- H5B2_leaf_t *left_leaf = NULL, *right_leaf = NULL; /* Pointers to old & new leaf nodes */
+ H5B2_leaf_t *left_leaf = NULL, *right_leaf = NULL; /* Pointers to old & new leaf nodes */
/* Create new leaf node */
internal->node_ptrs[idx + 1].all_nrec = internal->node_ptrs[idx + 1].node_nrec = 0;
- if(H5B2__create_leaf(hdr, internal, &(internal->node_ptrs[idx + 1])) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new leaf node")
+ if (H5B2__create_leaf(hdr, internal, &(internal->node_ptrs[idx + 1])) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new leaf node")
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_LEAF;
/* Protect both leaves */
/* (Shadow the left node if doing SWMR writes) */
- if(NULL == (left_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx], hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (left_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx], hdr->swmr_write,
+ H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
left_addr = internal->node_ptrs[idx].addr;
- if(NULL == (right_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx + 1], FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL == (right_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx + 1], FALSE,
+ H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
right_addr = internal->node_ptrs[idx + 1].addr;
/* More setup for child nodes */
- left_child = left_leaf;
- right_child = right_leaf;
- left_nrec = &(left_leaf->nrec);
- right_nrec = &(right_leaf->nrec);
- left_native = left_leaf->leaf_native;
+ left_child = left_leaf;
+ right_child = right_leaf;
+ left_nrec = &(left_leaf->nrec);
+ right_nrec = &(right_leaf->nrec);
+ left_native = left_leaf->leaf_native;
right_native = right_leaf->leaf_native;
} /* end if */
@@ -241,16 +239,17 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
/* Copy "upper half" of records to new child */
H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0),
- H5B2_NAT_NREC(left_native, hdr, mid_record + (unsigned)1),
- hdr->cls->nrec_size * (old_node_nrec - (mid_record + (unsigned)1)));
+ H5B2_NAT_NREC(left_native, hdr, mid_record + (unsigned)1),
+ hdr->cls->nrec_size * (old_node_nrec - (mid_record + (unsigned)1)));
/* Copy "upper half" of node pointers, if the node is an internal node */
- if(depth > 1)
+ if (depth > 1)
H5MM_memcpy(&(right_node_ptrs[0]), &(left_node_ptrs[mid_record + (unsigned)1]),
- sizeof(H5B2_node_ptr_t) * (size_t)(old_node_nrec - mid_record));
+ sizeof(H5B2_node_ptr_t) * (size_t)(old_node_nrec - mid_record));
/* Copy "middle" record to internal node */
- H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, mid_record), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, mid_record),
+ hdr->cls->nrec_size);
/* Mark nodes as dirty */
left_child_flags |= H5AC__DIRTIED_FLAG;
@@ -261,25 +260,25 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
internal->node_ptrs[idx + 1].node_nrec = *right_nrec = (uint16_t)(old_node_nrec - (mid_record + 1));
/* Determine total number of records in new child nodes */
- if(depth > 1) {
- unsigned u; /* Local index variable */
- hsize_t new_left_all_nrec; /* New total number of records in left child */
- hsize_t new_right_all_nrec; /* New total number of records in right child */
+ if (depth > 1) {
+ unsigned u; /* Local index variable */
+ hsize_t new_left_all_nrec; /* New total number of records in left child */
+ hsize_t new_right_all_nrec; /* New total number of records in right child */
/* Compute total of all records in each child node */
new_left_all_nrec = internal->node_ptrs[idx].node_nrec;
- for(u = 0; u < (*left_nrec + (unsigned)1); u++)
+ for (u = 0; u < (*left_nrec + (unsigned)1); u++)
new_left_all_nrec += left_node_ptrs[u].all_nrec;
new_right_all_nrec = internal->node_ptrs[idx + 1].node_nrec;
- for(u = 0; u < (*right_nrec + (unsigned)1); u++)
+ for (u = 0; u < (*right_nrec + (unsigned)1); u++)
new_right_all_nrec += right_node_ptrs[u].all_nrec;
- internal->node_ptrs[idx].all_nrec = new_left_all_nrec;
+ internal->node_ptrs[idx].all_nrec = new_left_all_nrec;
internal->node_ptrs[idx + 1].all_nrec = new_right_all_nrec;
} /* end if */
else {
- internal->node_ptrs[idx].all_nrec = internal->node_ptrs[idx].node_nrec;
+ internal->node_ptrs[idx].all_nrec = internal->node_ptrs[idx].node_nrec;
internal->node_ptrs[idx + 1].all_nrec = internal->node_ptrs[idx + 1].node_nrec;
} /* end else */
@@ -293,38 +292,39 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
curr_node_ptr->node_nrec++;
/* Mark grandparent as dirty, if given */
- if(parent_cache_info_flags_ptr)
+ if (parent_cache_info_flags_ptr)
*parent_cache_info_flags_ptr |= H5AC__DIRTIED_FLAG;
/* Update flush dependencies for grandchildren, if using SWMR */
- if(hdr->swmr_write && depth > 1)
- if(H5B2__update_child_flush_depends(hdr, depth, right_node_ptrs,
- 0, (unsigned)(*right_nrec + 1), left_child, right_child) < 0)
+ if (hdr->swmr_write && depth > 1)
+ if (H5B2__update_child_flush_depends(hdr, depth, right_node_ptrs, 0, (unsigned)(*right_nrec + 1),
+ left_child, right_child) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent")
#ifdef H5B2_DEBUG
H5B2__assert_internal((hsize_t)0, hdr, internal);
- if(depth > 1) {
- H5B2__assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)right_child);
- H5B2__assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)left_child);
+ if (depth > 1) {
+ H5B2__assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child,
+ (H5B2_internal_t *)right_child);
+ H5B2__assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child,
+ (H5B2_internal_t *)left_child);
} /* end if */
else {
H5B2__assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)right_child);
H5B2__assert_leaf(hdr, (H5B2_leaf_t *)right_child);
- } /* end else */
+ } /* end else */
#endif /* H5B2_DEBUG */
done:
/* Release child nodes (marked as dirty) */
- if(left_child && H5AC_unprotect(hdr->f, child_class, left_addr, left_child, left_child_flags) < 0)
+ if (left_child && H5AC_unprotect(hdr->f, child_class, left_addr, left_child, left_child_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node")
- if(right_child && H5AC_unprotect(hdr->f, child_class, right_addr, right_child, right_child_flags) < 0)
+ if (right_child && H5AC_unprotect(hdr->f, child_class, right_addr, right_child, right_child_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__split1() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__split_root
*
@@ -341,12 +341,12 @@ done:
herr_t
H5B2__split_root(H5B2_hdr_t *hdr)
{
- H5B2_internal_t *new_root = NULL; /* Pointer to new root node */
- unsigned new_root_flags = H5AC__NO_FLAGS_SET; /* Cache flags for new root node */
- H5B2_node_ptr_t old_root_ptr; /* Old node pointer to root node in B-tree */
- size_t sz_max_nrec; /* Temporary variable for range checking */
- unsigned u_max_nrec_size; /* Temporary variable for range checking */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_internal_t *new_root = NULL; /* Pointer to new root node */
+ unsigned new_root_flags = H5AC__NO_FLAGS_SET; /* Cache flags for new root node */
+ H5B2_node_ptr_t old_root_ptr; /* Old node pointer to root node in B-tree */
+ size_t sz_max_nrec; /* Temporary variable for range checking */
+ unsigned u_max_nrec_size; /* Temporary variable for range checking */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -357,7 +357,8 @@ H5B2__split_root(H5B2_hdr_t *hdr)
hdr->depth++;
/* Re-allocate array of node info structs */
- if(NULL == (hdr->node_info = H5FL_SEQ_REALLOC(H5B2_node_info_t, hdr->node_info, (size_t)(hdr->depth + 1))))
+ if (NULL ==
+ (hdr->node_info = H5FL_SEQ_REALLOC(H5B2_node_info_t, hdr->node_info, (size_t)(hdr->depth + 1))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Update node info for new depth of tree */
@@ -365,43 +366,47 @@ H5B2__split_root(H5B2_hdr_t *hdr)
H5_CHECKED_ASSIGN(hdr->node_info[hdr->depth].max_nrec, unsigned, sz_max_nrec, size_t)
hdr->node_info[hdr->depth].split_nrec = (hdr->node_info[hdr->depth].max_nrec * hdr->split_percent) / 100;
hdr->node_info[hdr->depth].merge_nrec = (hdr->node_info[hdr->depth].max_nrec * hdr->merge_percent) / 100;
- hdr->node_info[hdr->depth].cum_max_nrec = ((hdr->node_info[hdr->depth].max_nrec + 1) *
- hdr->node_info[hdr->depth - 1].cum_max_nrec) + hdr->node_info[hdr->depth].max_nrec;
+ hdr->node_info[hdr->depth].cum_max_nrec =
+ ((hdr->node_info[hdr->depth].max_nrec + 1) * hdr->node_info[hdr->depth - 1].cum_max_nrec) +
+ hdr->node_info[hdr->depth].max_nrec;
u_max_nrec_size = H5VM_limit_enc_size((uint64_t)hdr->node_info[hdr->depth].cum_max_nrec);
H5_CHECKED_ASSIGN(hdr->node_info[hdr->depth].cum_max_nrec_size, uint8_t, u_max_nrec_size, unsigned)
- if(NULL == (hdr->node_info[hdr->depth].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[hdr->depth].max_nrec)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory")
- if(NULL == (hdr->node_info[hdr->depth].node_ptr_fac = H5FL_fac_init(sizeof(H5B2_node_ptr_t) * (hdr->node_info[hdr->depth].max_nrec + 1))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create internal 'branch' node node pointer block factory")
+ if (NULL == (hdr->node_info[hdr->depth].nat_rec_fac =
+ H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[hdr->depth].max_nrec)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory")
+ if (NULL == (hdr->node_info[hdr->depth].node_ptr_fac =
+ H5FL_fac_init(sizeof(H5B2_node_ptr_t) * (hdr->node_info[hdr->depth].max_nrec + 1))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL,
+ "can't create internal 'branch' node node pointer block factory")
/* Keep old root node pointer info */
old_root_ptr = hdr->root;
/* Create new internal node to use as root */
hdr->root.node_nrec = 0;
- if(H5B2__create_internal(hdr, hdr, &(hdr->root), hdr->depth) < 0)
+ if (H5B2__create_internal(hdr, hdr, &(hdr->root), hdr->depth) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new internal node")
/* Protect new root node */
- if(NULL == (new_root = H5B2__protect_internal(hdr, hdr, &hdr->root, hdr->depth, FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL ==
+ (new_root = H5B2__protect_internal(hdr, hdr, &hdr->root, hdr->depth, FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Set first node pointer in root node to old root node pointer info */
new_root->node_ptrs[0] = old_root_ptr;
/* Split original root node */
- if(H5B2__split1(hdr, hdr->depth, &(hdr->root), NULL, new_root, &new_root_flags, 0) < 0)
+ if (H5B2__split1(hdr, hdr->depth, &(hdr->root), NULL, new_root, &new_root_flags, 0) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split old root node")
done:
/* Release new root node (marked as dirty) */
- if(new_root && H5AC_unprotect(hdr->f, H5AC_BT2_INT, hdr->root.addr, new_root, new_root_flags) < 0)
+ if (new_root && H5AC_unprotect(hdr->f, H5AC_BT2_INT, hdr->root.addr, new_root, new_root_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree internal node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__split_root() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__redistribute2
*
@@ -416,18 +421,19 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
- unsigned idx)
+H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned idx)
{
- const H5AC_class_t *child_class; /* Pointer to child node's class info */
- haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- void *left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
- uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */
- uint8_t *left_native, *right_native; /* Pointers to childs' native records */
- H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL;/* Pointers to childs' node pointer info */
+ const H5AC_class_t *child_class; /* Pointer to child node's class info */
+ haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
+ void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
+ uint16_t * left_nrec, *right_nrec; /* Pointers to child # of records */
+ uint8_t * left_native, *right_native; /* Pointers to childs' native records */
+ H5B2_node_ptr_t * left_node_ptrs = NULL,
+ *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
hssize_t left_moved_nrec = 0, right_moved_nrec = 0; /* Number of records moved, for internal redistrib */
- unsigned left_child_flags = H5AC__NO_FLAGS_SET, right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned left_child_flags = H5AC__NO_FLAGS_SET,
+ right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -436,115 +442,132 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
HDassert(internal);
/* Check for the kind of B-tree node to redistribute */
- if(depth > 1) {
- H5B2_internal_t *left_internal; /* Pointer to left internal node */
- H5B2_internal_t *right_internal; /* Pointer to right internal node */
+ if (depth > 1) {
+ H5B2_internal_t *left_internal; /* Pointer to left internal node */
+ H5B2_internal_t *right_internal; /* Pointer to right internal node */
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_INT;
/* Lock left & right B-tree child nodes */
/* (Shadow both nodes if doing SWMR writes) */
- if(NULL == (left_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (left_internal =
+ H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx],
+ (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
left_addr = internal->node_ptrs[idx].addr;
- if(NULL == (right_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx + 1], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (right_internal =
+ H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx + 1],
+ (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
right_addr = internal->node_ptrs[idx + 1].addr;
/* More setup for child nodes */
- left_child = left_internal;
- right_child = right_internal;
- left_nrec = &(left_internal->nrec);
- right_nrec = &(right_internal->nrec);
- left_native = left_internal->int_native;
- right_native = right_internal->int_native;
- left_node_ptrs = left_internal->node_ptrs;
+ left_child = left_internal;
+ right_child = right_internal;
+ left_nrec = &(left_internal->nrec);
+ right_nrec = &(right_internal->nrec);
+ left_native = left_internal->int_native;
+ right_native = right_internal->int_native;
+ left_node_ptrs = left_internal->node_ptrs;
right_node_ptrs = right_internal->node_ptrs;
} /* end if */
else {
- H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
- H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
+ H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
+ H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_LEAF;
/* Lock left & right B-tree child nodes */
/* (Shadow both nodes if doing SWMR writes) */
- if(NULL == (left_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx], hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (left_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx], hdr->swmr_write,
+ H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
left_addr = internal->node_ptrs[idx].addr;
- if(NULL == (right_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx + 1], hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (right_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx + 1],
+ hdr->swmr_write, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
right_addr = internal->node_ptrs[idx + 1].addr;
/* More setup for child nodes */
- left_child = left_leaf;
- right_child = right_leaf;
- left_nrec = &(left_leaf->nrec);
- right_nrec = &(right_leaf->nrec);
- left_native = left_leaf->leaf_native;
+ left_child = left_leaf;
+ right_child = right_leaf;
+ left_nrec = &(left_leaf->nrec);
+ right_nrec = &(right_leaf->nrec);
+ left_native = left_leaf->leaf_native;
right_native = right_leaf->leaf_native;
} /* end else */
#ifdef H5B2_DEBUG
H5B2__assert_internal((hsize_t)0, hdr, internal);
- if(depth > 1) {
- H5B2__assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)right_child);
- H5B2__assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)left_child);
+ if (depth > 1) {
+ H5B2__assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child,
+ (H5B2_internal_t *)right_child);
+ H5B2__assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child,
+ (H5B2_internal_t *)left_child);
} /* end if */
else {
H5B2__assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)right_child);
H5B2__assert_leaf(hdr, (H5B2_leaf_t *)right_child);
- } /* end else */
+ } /* end else */
#endif /* H5B2_DEBUG */
/* Determine whether to shuffle records left or right */
- if(*left_nrec < *right_nrec) {
+ if (*left_nrec < *right_nrec) {
/* Moving record from right node to left */
- uint16_t new_right_nrec = (uint16_t)((*left_nrec + *right_nrec) / 2); /* New number of records for right child */
- uint16_t move_nrec = (uint16_t)(*right_nrec - new_right_nrec); /* Number of records to move from right node to left */
+ uint16_t new_right_nrec =
+ (uint16_t)((*left_nrec + *right_nrec) / 2); /* New number of records for right child */
+ uint16_t move_nrec =
+ (uint16_t)(*right_nrec - new_right_nrec); /* Number of records to move from right node to left */
/* Copy record from parent node down into left child */
- H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx),
+ hdr->cls->nrec_size);
/* See if we need to move records from right node */
- if(move_nrec > 1)
- H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, (*left_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (size_t)(move_nrec - 1));
+ if (move_nrec > 1)
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, (*left_nrec + 1)),
+ H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (size_t)(move_nrec - 1));
/* Move record from right node into parent node */
- H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)),
+ hdr->cls->nrec_size);
/* Slide records in right node down */
- HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, move_nrec), hdr->cls->nrec_size * new_right_nrec);
+ HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, move_nrec),
+ hdr->cls->nrec_size * new_right_nrec);
/* Handle node pointers, if we have an internal node */
- if(depth > 1) {
- hsize_t moved_nrec = move_nrec; /* Total number of records moved, for internal redistrib */
- unsigned u; /* Local index variable */
+ if (depth > 1) {
+ hsize_t moved_nrec = move_nrec; /* Total number of records moved, for internal redistrib */
+ unsigned u; /* Local index variable */
/* Count the number of records being moved */
- for(u = 0; u < move_nrec; u++)
+ for (u = 0; u < move_nrec; u++)
moved_nrec += right_node_ptrs[u].all_nrec;
H5_CHECKED_ASSIGN(left_moved_nrec, hssize_t, moved_nrec, hsize_t)
right_moved_nrec -= (hssize_t)moved_nrec;
/* Copy node pointers from right node to left */
- H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * move_nrec);
+ H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]),
+ sizeof(H5B2_node_ptr_t) * move_nrec);
/* Slide node pointers in right node down */
- HDmemmove(&(right_node_ptrs[0]), &(right_node_ptrs[move_nrec]), sizeof(H5B2_node_ptr_t) * (new_right_nrec + (unsigned)1));
+ HDmemmove(&(right_node_ptrs[0]), &(right_node_ptrs[move_nrec]),
+ sizeof(H5B2_node_ptr_t) * (new_right_nrec + (unsigned)1));
} /* end if */
/* Update flush dependencies for grandchildren, if using SWMR */
- if(hdr->swmr_write && depth > 1)
- if(H5B2__update_child_flush_depends(hdr, depth, left_node_ptrs,
- (unsigned)(*left_nrec + 1), (unsigned)(*left_nrec + move_nrec + 1), right_child, left_child) < 0)
+ if (hdr->swmr_write && depth > 1)
+ if (H5B2__update_child_flush_depends(hdr, depth, left_node_ptrs, (unsigned)(*left_nrec + 1),
+ (unsigned)(*left_nrec + move_nrec + 1), right_child,
+ left_child) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent")
/* Update number of records in child nodes */
- *left_nrec = (uint16_t)(*left_nrec + move_nrec);
+ *left_nrec = (uint16_t)(*left_nrec + move_nrec);
*right_nrec = new_right_nrec;
/* Mark nodes as dirty */
@@ -554,53 +577,60 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
else {
/* Moving record from left node to right */
- uint16_t new_left_nrec = (uint16_t)((*left_nrec + *right_nrec) / 2); /* New number of records for left child */
- uint16_t move_nrec = (uint16_t)(*left_nrec - new_left_nrec); /* Number of records to move from left node to right */
+ uint16_t new_left_nrec =
+ (uint16_t)((*left_nrec + *right_nrec) / 2); /* New number of records for left child */
+ uint16_t move_nrec =
+ (uint16_t)(*left_nrec - new_left_nrec); /* Number of records to move from left node to right */
/* Sanity check */
HDassert(*left_nrec > *right_nrec);
/* Slide records in right node up */
- HDmemmove(H5B2_NAT_NREC(right_native, hdr, move_nrec),
- H5B2_NAT_NREC(right_native, hdr, 0),
- hdr->cls->nrec_size * (*right_nrec));
+ HDmemmove(H5B2_NAT_NREC(right_native, hdr, move_nrec), H5B2_NAT_NREC(right_native, hdr, 0),
+ hdr->cls->nrec_size * (*right_nrec));
/* Copy record from parent node down into right child */
- H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), H5B2_INT_NREC(internal, hdr, idx),
+ hdr->cls->nrec_size);
/* See if we need to move records from left node */
- if(move_nrec > 1)
- H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, ((*left_nrec - move_nrec) + 1)), hdr->cls->nrec_size * (size_t)(move_nrec - 1));
+ if (move_nrec > 1)
+ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0),
+ H5B2_NAT_NREC(left_native, hdr, ((*left_nrec - move_nrec) + 1)),
+ hdr->cls->nrec_size * (size_t)(move_nrec - 1));
/* Move record from left node into parent node */
- H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, (*left_nrec - move_nrec)), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx),
+ H5B2_NAT_NREC(left_native, hdr, (*left_nrec - move_nrec)), hdr->cls->nrec_size);
/* Handle node pointers, if we have an internal node */
- if(depth > 1) {
- hsize_t moved_nrec = move_nrec; /* Total number of records moved, for internal redistrib */
- unsigned u; /* Local index variable */
+ if (depth > 1) {
+ hsize_t moved_nrec = move_nrec; /* Total number of records moved, for internal redistrib */
+ unsigned u; /* Local index variable */
/* Slide node pointers in right node up */
- HDmemmove(&(right_node_ptrs[move_nrec]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
+ HDmemmove(&(right_node_ptrs[move_nrec]), &(right_node_ptrs[0]),
+ sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
/* Copy node pointers from left node to right */
- H5MM_memcpy(&(right_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), sizeof(H5B2_node_ptr_t) * move_nrec);
+ H5MM_memcpy(&(right_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]),
+ sizeof(H5B2_node_ptr_t) * move_nrec);
/* Count the number of records being moved */
- for(u = 0; u < move_nrec; u++)
+ for (u = 0; u < move_nrec; u++)
moved_nrec += right_node_ptrs[u].all_nrec;
left_moved_nrec -= (hssize_t)moved_nrec;
H5_CHECKED_ASSIGN(right_moved_nrec, hssize_t, moved_nrec, hsize_t)
} /* end if */
/* Update flush dependencies for grandchildren, if using SWMR */
- if(hdr->swmr_write && depth > 1)
- if(H5B2__update_child_flush_depends(hdr, depth, right_node_ptrs,
- 0, (unsigned)move_nrec, left_child, right_child) < 0)
+ if (hdr->swmr_write && depth > 1)
+ if (H5B2__update_child_flush_depends(hdr, depth, right_node_ptrs, 0, (unsigned)move_nrec,
+ left_child, right_child) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent")
/* Update number of records in child nodes */
- *left_nrec = new_left_nrec;
+ *left_nrec = new_left_nrec;
*right_nrec = (uint16_t)(*right_nrec + move_nrec);
/* Mark nodes as dirty */
@@ -609,42 +639,45 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
} /* end else */
/* Update # of records in child nodes */
- internal->node_ptrs[idx].node_nrec = *left_nrec;
+ internal->node_ptrs[idx].node_nrec = *left_nrec;
internal->node_ptrs[idx + 1].node_nrec = *right_nrec;
/* Update total # of records in child B-trees */
- if(depth > 1) {
- internal->node_ptrs[idx].all_nrec = (hsize_t)((hssize_t)internal->node_ptrs[idx].all_nrec + left_moved_nrec);
- internal->node_ptrs[idx + 1].all_nrec = (hsize_t)((hssize_t)internal->node_ptrs[idx + 1].all_nrec + right_moved_nrec);
+ if (depth > 1) {
+ internal->node_ptrs[idx].all_nrec =
+ (hsize_t)((hssize_t)internal->node_ptrs[idx].all_nrec + left_moved_nrec);
+ internal->node_ptrs[idx + 1].all_nrec =
+ (hsize_t)((hssize_t)internal->node_ptrs[idx + 1].all_nrec + right_moved_nrec);
} /* end if */
else {
- internal->node_ptrs[idx].all_nrec = internal->node_ptrs[idx].node_nrec;
+ internal->node_ptrs[idx].all_nrec = internal->node_ptrs[idx].node_nrec;
internal->node_ptrs[idx + 1].all_nrec = internal->node_ptrs[idx + 1].node_nrec;
} /* end else */
#ifdef H5B2_DEBUG
H5B2__assert_internal((hsize_t)0, hdr, internal);
- if(depth > 1) {
- H5B2__assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)right_child);
- H5B2__assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)left_child);
+ if (depth > 1) {
+ H5B2__assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child,
+ (H5B2_internal_t *)right_child);
+ H5B2__assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child,
+ (H5B2_internal_t *)left_child);
} /* end if */
else {
H5B2__assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)right_child);
H5B2__assert_leaf(hdr, (H5B2_leaf_t *)right_child);
- } /* end else */
+ } /* end else */
#endif /* H5B2_DEBUG */
done:
/* Release child nodes (marked as dirty) */
- if(left_child && H5AC_unprotect(hdr->f, child_class, left_addr, left_child, left_child_flags) < 0)
+ if (left_child && H5AC_unprotect(hdr->f, child_class, left_addr, left_child, left_child_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if(right_child && H5AC_unprotect(hdr->f, child_class, right_addr, right_child, right_child_flags) < 0)
+ if (right_child && H5AC_unprotect(hdr->f, child_class, right_addr, right_child, right_child_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__redistribute2() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__redistribute3
*
@@ -659,25 +692,27 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
- unsigned *internal_flags_ptr, unsigned idx)
+H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned *internal_flags_ptr,
+ unsigned idx)
{
- H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
- H5B2_node_ptr_t *middle_node_ptrs = NULL; /* Pointers to childs' node pointer info */
- const H5AC_class_t *child_class; /* Pointer to child node's class info */
- haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- haddr_t middle_addr; /* Address of middle child node */
- void *left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
- void *middle_child = NULL; /* Pointers to middle child node */
- uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */
- uint16_t *middle_nrec; /* Pointers to middle child # of records */
- uint8_t *left_native, *right_native; /* Pointers to childs' native records */
- uint8_t *middle_native; /* Pointers to middle child's native records */
+ H5B2_node_ptr_t *left_node_ptrs = NULL,
+ *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
+ H5B2_node_ptr_t * middle_node_ptrs = NULL; /* Pointers to childs' node pointer info */
+ const H5AC_class_t *child_class; /* Pointer to child node's class info */
+ haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
+ haddr_t middle_addr; /* Address of middle child node */
+ void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
+ void * middle_child = NULL; /* Pointers to middle child node */
+ uint16_t * left_nrec, *right_nrec; /* Pointers to child # of records */
+ uint16_t * middle_nrec; /* Pointers to middle child # of records */
+ uint8_t * left_native, *right_native; /* Pointers to childs' native records */
+ uint8_t * middle_native; /* Pointers to middle child's native records */
hssize_t left_moved_nrec = 0, right_moved_nrec = 0; /* Number of records moved, for internal split */
- hssize_t middle_moved_nrec = 0; /* Number of records moved, for internal split */
- unsigned left_child_flags = H5AC__NO_FLAGS_SET, right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
- unsigned middle_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
- herr_t ret_value = SUCCEED; /* Return value */
+ hssize_t middle_moved_nrec = 0; /* Number of records moved, for internal split */
+ unsigned left_child_flags = H5AC__NO_FLAGS_SET,
+ right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
+ unsigned middle_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -687,79 +722,88 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
HDassert(internal_flags_ptr);
/* Check for the kind of B-tree node to redistribute */
- if(depth > 1) {
- H5B2_internal_t *left_internal; /* Pointer to left internal node */
- H5B2_internal_t *middle_internal; /* Pointer to middle internal node */
- H5B2_internal_t *right_internal; /* Pointer to right internal node */
+ if (depth > 1) {
+ H5B2_internal_t *left_internal; /* Pointer to left internal node */
+ H5B2_internal_t *middle_internal; /* Pointer to middle internal node */
+ H5B2_internal_t *right_internal; /* Pointer to right internal node */
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_INT;
/* Lock B-tree child nodes */
/* (Shadow all nodes if doing SWMR writes) */
- if(NULL == (left_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx - 1], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (left_internal =
+ H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx - 1],
+ (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
left_addr = internal->node_ptrs[idx - 1].addr;
- if(NULL == (middle_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (middle_internal =
+ H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx],
+ (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
middle_addr = internal->node_ptrs[idx].addr;
- if(NULL == (right_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx + 1], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (right_internal =
+ H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx + 1],
+ (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
right_addr = internal->node_ptrs[idx + 1].addr;
/* More setup for child nodes */
- left_child = left_internal;
- middle_child = middle_internal;
- right_child = right_internal;
- left_nrec = &(left_internal->nrec);
- middle_nrec = &(middle_internal->nrec);
- right_nrec = &(right_internal->nrec);
- left_native = left_internal->int_native;
- middle_native = middle_internal->int_native;
- right_native = right_internal->int_native;
- left_node_ptrs = left_internal->node_ptrs;
+ left_child = left_internal;
+ middle_child = middle_internal;
+ right_child = right_internal;
+ left_nrec = &(left_internal->nrec);
+ middle_nrec = &(middle_internal->nrec);
+ right_nrec = &(right_internal->nrec);
+ left_native = left_internal->int_native;
+ middle_native = middle_internal->int_native;
+ right_native = right_internal->int_native;
+ left_node_ptrs = left_internal->node_ptrs;
middle_node_ptrs = middle_internal->node_ptrs;
- right_node_ptrs = right_internal->node_ptrs;
+ right_node_ptrs = right_internal->node_ptrs;
} /* end if */
else {
- H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
- H5B2_leaf_t *middle_leaf; /* Pointer to middle leaf node */
- H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
+ H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
+ H5B2_leaf_t *middle_leaf; /* Pointer to middle leaf node */
+ H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_LEAF;
/* Lock B-tree child nodes */
/* (Shadow all nodes if doing SWMR writes) */
- if(NULL == (left_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx - 1], hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (left_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx - 1],
+ hdr->swmr_write, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
left_addr = internal->node_ptrs[idx - 1].addr;
- if(NULL == (middle_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx], hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (middle_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx],
+ hdr->swmr_write, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
middle_addr = internal->node_ptrs[idx].addr;
- if(NULL == (right_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx + 1], hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (right_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx + 1],
+ hdr->swmr_write, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
right_addr = internal->node_ptrs[idx + 1].addr;
/* More setup for child nodes */
- left_child = left_leaf;
- middle_child = middle_leaf;
- right_child = right_leaf;
- left_nrec = &(left_leaf->nrec);
- middle_nrec = &(middle_leaf->nrec);
- right_nrec = &(right_leaf->nrec);
- left_native = left_leaf->leaf_native;
+ left_child = left_leaf;
+ middle_child = middle_leaf;
+ right_child = right_leaf;
+ left_nrec = &(left_leaf->nrec);
+ middle_nrec = &(middle_leaf->nrec);
+ right_nrec = &(right_leaf->nrec);
+ left_native = left_leaf->leaf_native;
middle_native = middle_leaf->leaf_native;
- right_native = right_leaf->leaf_native;
+ right_native = right_leaf->leaf_native;
} /* end else */
/* Redistribute records */
{
/* Compute new # of records in each node */
- unsigned total_nrec = (unsigned)(*left_nrec + *middle_nrec + *right_nrec + 2);
+ unsigned total_nrec = (unsigned)(*left_nrec + *middle_nrec + *right_nrec + 2);
uint16_t new_middle_nrec = (uint16_t)((total_nrec - 2) / 3);
- uint16_t new_left_nrec = (uint16_t)(((total_nrec - 2) - new_middle_nrec) / 2);
- uint16_t new_right_nrec = (uint16_t)((total_nrec - 2) - (unsigned)(new_left_nrec + new_middle_nrec));
+ uint16_t new_left_nrec = (uint16_t)(((total_nrec - 2) - new_middle_nrec) / 2);
+ uint16_t new_right_nrec = (uint16_t)((total_nrec - 2) - (unsigned)(new_left_nrec + new_middle_nrec));
uint16_t curr_middle_nrec = *middle_nrec;
/* Sanity check rounding */
@@ -767,49 +811,57 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
HDassert(new_middle_nrec <= new_right_nrec);
/* Move records into left node */
- if(new_left_nrec > *left_nrec) {
- uint16_t moved_middle_nrec = 0; /* Number of records moved into left node */
+ if (new_left_nrec > *left_nrec) {
+ uint16_t moved_middle_nrec = 0; /* Number of records moved into left node */
/* Move left parent record down to left node */
- H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1),
+ hdr->cls->nrec_size);
/* Move records from middle node into left node */
- if((new_left_nrec - 1) > *left_nrec) {
+ if ((new_left_nrec - 1) > *left_nrec) {
moved_middle_nrec = (uint16_t)(new_left_nrec - (*left_nrec + 1));
- H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * moved_middle_nrec);
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1),
+ H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * moved_middle_nrec);
} /* end if */
/* Move record from middle node up to parent node */
- H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx - 1),
+ H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), hdr->cls->nrec_size);
moved_middle_nrec++;
/* Slide records in middle node down */
- HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), hdr->cls->nrec_size * (size_t)(*middle_nrec - moved_middle_nrec));
+ HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0),
+ H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec),
+ hdr->cls->nrec_size * (size_t)(*middle_nrec - moved_middle_nrec));
/* Move node pointers also if this is an internal node */
- if(depth > 1) {
- hsize_t moved_nrec; /* Total number of records moved, for internal redistrib */
- unsigned move_nptrs; /* Number of node pointers to move */
- unsigned u; /* Local index variable */
+ if (depth > 1) {
+ hsize_t moved_nrec; /* Total number of records moved, for internal redistrib */
+ unsigned move_nptrs; /* Number of node pointers to move */
+ unsigned u; /* Local index variable */
/* Move middle node pointers into left node */
move_nptrs = (unsigned)(new_left_nrec - *left_nrec);
- H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t)*move_nptrs);
+ H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]),
+ sizeof(H5B2_node_ptr_t) * move_nptrs);
/* Count the number of records being moved into the left node */
- for(u = 0, moved_nrec = 0; u < move_nptrs; u++)
+ for (u = 0, moved_nrec = 0; u < move_nptrs; u++)
moved_nrec += middle_node_ptrs[u].all_nrec;
left_moved_nrec = (hssize_t)(moved_nrec + move_nptrs);
middle_moved_nrec -= (hssize_t)(moved_nrec + move_nptrs);
/* Slide the node pointers in middle node down */
- HDmemmove(&(middle_node_ptrs[0]), &(middle_node_ptrs[move_nptrs]), sizeof(H5B2_node_ptr_t) * ((*middle_nrec - move_nptrs) + 1));
+ HDmemmove(&(middle_node_ptrs[0]), &(middle_node_ptrs[move_nptrs]),
+ sizeof(H5B2_node_ptr_t) * ((*middle_nrec - move_nptrs) + 1));
} /* end if */
/* Update flush dependencies for grandchildren, if using SWMR */
- if(hdr->swmr_write && depth > 1)
- if(H5B2__update_child_flush_depends(hdr, depth, left_node_ptrs,
- (unsigned)(*left_nrec + 1), (unsigned)(*left_nrec + moved_middle_nrec + 1), middle_child, left_child) < 0)
+ if (hdr->swmr_write && depth > 1)
+ if (H5B2__update_child_flush_depends(hdr, depth, left_node_ptrs, (unsigned)(*left_nrec + 1),
+ (unsigned)(*left_nrec + moved_middle_nrec + 1),
+ middle_child, left_child) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent")
/* Update the current number of records in middle node */
@@ -821,44 +873,55 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
} /* end if */
/* Move records into right node */
- if(new_right_nrec > *right_nrec) {
- unsigned right_nrec_move = (unsigned)(new_right_nrec - *right_nrec); /* Number of records to move out of right node */
+ if (new_right_nrec > *right_nrec) {
+ unsigned right_nrec_move =
+ (unsigned)(new_right_nrec - *right_nrec); /* Number of records to move out of right node */
/* Slide records in right node up */
- HDmemmove(H5B2_NAT_NREC(right_native, hdr, right_nrec_move), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec));
+ HDmemmove(H5B2_NAT_NREC(right_native, hdr, right_nrec_move), H5B2_NAT_NREC(right_native, hdr, 0),
+ hdr->cls->nrec_size * (*right_nrec));
/* Move right parent record down to right node */
- H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1),
+ H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* Move records from middle node into right node */
- if(right_nrec_move > 1)
- H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, ((curr_middle_nrec - right_nrec_move) + 1)), hdr->cls->nrec_size * (right_nrec_move - 1));
+ if (right_nrec_move > 1)
+ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0),
+ H5B2_NAT_NREC(middle_native, hdr, ((curr_middle_nrec - right_nrec_move) + 1)),
+ hdr->cls->nrec_size * (right_nrec_move - 1));
/* Move record from middle node up to parent node */
- H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec - right_nrec_move)), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx),
+ H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec - right_nrec_move)),
+ hdr->cls->nrec_size);
/* Move node pointers also if this is an internal node */
- if(depth > 1) {
- hsize_t moved_nrec; /* Total number of records moved, for internal redistrib */
- unsigned u; /* Local index variable */
+ if (depth > 1) {
+ hsize_t moved_nrec; /* Total number of records moved, for internal redistrib */
+ unsigned u; /* Local index variable */
/* Slide the node pointers in right node up */
- HDmemmove(&(right_node_ptrs[right_nrec_move]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
+ HDmemmove(&(right_node_ptrs[right_nrec_move]), &(right_node_ptrs[0]),
+ sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
/* Move middle node pointers into right node */
- H5MM_memcpy(&(right_node_ptrs[0]), &(middle_node_ptrs[(curr_middle_nrec - right_nrec_move) + 1]), sizeof(H5B2_node_ptr_t) * right_nrec_move);
+ H5MM_memcpy(&(right_node_ptrs[0]),
+ &(middle_node_ptrs[(curr_middle_nrec - right_nrec_move) + 1]),
+ sizeof(H5B2_node_ptr_t) * right_nrec_move);
/* Count the number of records being moved into the right node */
- for(u = 0, moved_nrec = 0; u < right_nrec_move; u++)
+ for (u = 0, moved_nrec = 0; u < right_nrec_move; u++)
moved_nrec += right_node_ptrs[u].all_nrec;
right_moved_nrec = (hssize_t)(moved_nrec + right_nrec_move);
middle_moved_nrec -= (hssize_t)(moved_nrec + right_nrec_move);
} /* end if */
/* Update flush dependencies for grandchildren, if using SWMR */
- if(hdr->swmr_write && depth > 1)
- if(H5B2__update_child_flush_depends(hdr, depth, right_node_ptrs,
- 0, (unsigned)right_nrec_move, middle_child, right_child) < 0)
+ if (hdr->swmr_write && depth > 1)
+ if (H5B2__update_child_flush_depends(hdr, depth, right_node_ptrs, 0,
+ (unsigned)right_nrec_move, middle_child,
+ right_child) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent")
/* Update the current number of records in middle node */
@@ -870,44 +933,52 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
} /* end if */
/* Move records out of left node */
- if(new_left_nrec < *left_nrec) {
- unsigned left_nrec_move = (unsigned)(*left_nrec - new_left_nrec); /* Number of records to move out of left node */
+ if (new_left_nrec < *left_nrec) {
+ unsigned left_nrec_move =
+ (unsigned)(*left_nrec - new_left_nrec); /* Number of records to move out of left node */
/* Slide middle records up */
- HDmemmove(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * curr_middle_nrec);
+ HDmemmove(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move), H5B2_NAT_NREC(middle_native, hdr, 0),
+ hdr->cls->nrec_size * curr_middle_nrec);
/* Move left parent record down to middle node */
- H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move - 1),
+ H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
/* Move left records to middle node */
- if(left_nrec_move > 1)
- HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, new_left_nrec + 1), hdr->cls->nrec_size * (left_nrec_move - 1));
+ if (left_nrec_move > 1)
+ HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0),
+ H5B2_NAT_NREC(left_native, hdr, new_left_nrec + 1),
+ hdr->cls->nrec_size * (left_nrec_move - 1));
/* Move left parent record up from left node */
- H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(left_native, hdr, new_left_nrec), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(left_native, hdr, new_left_nrec),
+ hdr->cls->nrec_size);
/* Move node pointers also if this is an internal node */
- if(depth > 1) {
- hsize_t moved_nrec; /* Total number of records moved, for internal redistrib */
- unsigned u; /* Local index variable */
+ if (depth > 1) {
+ hsize_t moved_nrec; /* Total number of records moved, for internal redistrib */
+ unsigned u; /* Local index variable */
/* Slide the node pointers in middle node up */
- HDmemmove(&(middle_node_ptrs[left_nrec_move]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(curr_middle_nrec + 1));
+ HDmemmove(&(middle_node_ptrs[left_nrec_move]), &(middle_node_ptrs[0]),
+ sizeof(H5B2_node_ptr_t) * (size_t)(curr_middle_nrec + 1));
/* Move left node pointers into middle node */
- H5MM_memcpy(&(middle_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), sizeof(H5B2_node_ptr_t) * left_nrec_move);
+ H5MM_memcpy(&(middle_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]),
+ sizeof(H5B2_node_ptr_t) * left_nrec_move);
/* Count the number of records being moved into the left node */
- for(u = 0, moved_nrec = 0; u < left_nrec_move; u++)
+ for (u = 0, moved_nrec = 0; u < left_nrec_move; u++)
moved_nrec += middle_node_ptrs[u].all_nrec;
left_moved_nrec -= (hssize_t)(moved_nrec + left_nrec_move);
middle_moved_nrec += (hssize_t)(moved_nrec + left_nrec_move);
} /* end if */
/* Update flush dependencies for grandchildren, if using SWMR */
- if(hdr->swmr_write && depth > 1)
- if(H5B2__update_child_flush_depends(hdr, depth, middle_node_ptrs,
- 0, (unsigned)left_nrec_move, left_child, middle_child) < 0)
+ if (hdr->swmr_write && depth > 1)
+ if (H5B2__update_child_flush_depends(hdr, depth, middle_node_ptrs, 0,
+ (unsigned)left_nrec_move, left_child, middle_child) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent")
/* Update the current number of records in middle node */
@@ -919,43 +990,51 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
} /* end if */
/* Move records out of right node */
- if(new_right_nrec < *right_nrec) {
- unsigned right_nrec_move = (unsigned)(*right_nrec - new_right_nrec); /* Number of records to move out of right node */
+ if (new_right_nrec < *right_nrec) {
+ unsigned right_nrec_move =
+ (unsigned)(*right_nrec - new_right_nrec); /* Number of records to move out of right node */
/* Move right parent record down to middle node */
- H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, curr_middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, curr_middle_nrec),
+ H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
/* Move right records to middle node */
- HDmemmove(H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (right_nrec_move - 1));
+ HDmemmove(H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec + 1)),
+ H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (right_nrec_move - 1));
/* Move right parent record up from right node */
- H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx),
+ H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), hdr->cls->nrec_size);
/* Slide right records down */
- HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, right_nrec_move), hdr->cls->nrec_size * new_right_nrec);
+ HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, right_nrec_move),
+ hdr->cls->nrec_size * new_right_nrec);
/* Move node pointers also if this is an internal node */
- if(depth > 1) {
- hsize_t moved_nrec; /* Total number of records moved, for internal redistrib */
- unsigned u; /* Local index variable */
+ if (depth > 1) {
+ hsize_t moved_nrec; /* Total number of records moved, for internal redistrib */
+ unsigned u; /* Local index variable */
/* Move right node pointers into middle node */
- H5MM_memcpy(&(middle_node_ptrs[curr_middle_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * right_nrec_move);
+ H5MM_memcpy(&(middle_node_ptrs[curr_middle_nrec + 1]), &(right_node_ptrs[0]),
+ sizeof(H5B2_node_ptr_t) * right_nrec_move);
/* Count the number of records being moved into the right node */
- for(u = 0, moved_nrec = 0; u < right_nrec_move; u++)
+ for (u = 0, moved_nrec = 0; u < right_nrec_move; u++)
moved_nrec += right_node_ptrs[u].all_nrec;
right_moved_nrec -= (hssize_t)(moved_nrec + right_nrec_move);
middle_moved_nrec += (hssize_t)(moved_nrec + right_nrec_move);
/* Slide the node pointers in right node down */
- HDmemmove(&(right_node_ptrs[0]), &(right_node_ptrs[right_nrec_move]), sizeof(H5B2_node_ptr_t) * (size_t)(new_right_nrec + 1));
+ HDmemmove(&(right_node_ptrs[0]), &(right_node_ptrs[right_nrec_move]),
+ sizeof(H5B2_node_ptr_t) * (size_t)(new_right_nrec + 1));
} /* end if */
/* Update flush dependencies for grandchildren, if using SWMR */
- if(hdr->swmr_write && depth > 1)
- if(H5B2__update_child_flush_depends(hdr, depth, middle_node_ptrs,
- (unsigned)(curr_middle_nrec + 1), (unsigned)(curr_middle_nrec + right_nrec_move + 1), right_child, middle_child) < 0)
+ if (hdr->swmr_write && depth > 1)
+ if (H5B2__update_child_flush_depends(
+ hdr, depth, middle_node_ptrs, (unsigned)(curr_middle_nrec + 1),
+ (unsigned)(curr_middle_nrec + right_nrec_move + 1), right_child, middle_child) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent")
/* Mark nodes as dirty */
@@ -964,25 +1043,28 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
} /* end if */
/* Update # of records in nodes */
- *left_nrec = new_left_nrec;
+ *left_nrec = new_left_nrec;
*middle_nrec = new_middle_nrec;
- *right_nrec = new_right_nrec;
+ *right_nrec = new_right_nrec;
} /* end block */
/* Update # of records in child nodes */
internal->node_ptrs[idx - 1].node_nrec = *left_nrec;
- internal->node_ptrs[idx].node_nrec = *middle_nrec;
+ internal->node_ptrs[idx].node_nrec = *middle_nrec;
internal->node_ptrs[idx + 1].node_nrec = *right_nrec;
/* Update total # of records in child B-trees */
- if(depth > 1) {
- internal->node_ptrs[idx - 1].all_nrec = (hsize_t)((hssize_t)internal->node_ptrs[idx - 1].all_nrec + left_moved_nrec);
- internal->node_ptrs[idx].all_nrec = (hsize_t)((hssize_t)internal->node_ptrs[idx].all_nrec + middle_moved_nrec);
- internal->node_ptrs[idx + 1].all_nrec = (hsize_t)((hssize_t)internal->node_ptrs[idx + 1].all_nrec + right_moved_nrec);
+ if (depth > 1) {
+ internal->node_ptrs[idx - 1].all_nrec =
+ (hsize_t)((hssize_t)internal->node_ptrs[idx - 1].all_nrec + left_moved_nrec);
+ internal->node_ptrs[idx].all_nrec =
+ (hsize_t)((hssize_t)internal->node_ptrs[idx].all_nrec + middle_moved_nrec);
+ internal->node_ptrs[idx + 1].all_nrec =
+ (hsize_t)((hssize_t)internal->node_ptrs[idx + 1].all_nrec + right_moved_nrec);
} /* end if */
else {
internal->node_ptrs[idx - 1].all_nrec = internal->node_ptrs[idx - 1].node_nrec;
- internal->node_ptrs[idx].all_nrec = internal->node_ptrs[idx].node_nrec;
+ internal->node_ptrs[idx].all_nrec = internal->node_ptrs[idx].node_nrec;
internal->node_ptrs[idx + 1].all_nrec = internal->node_ptrs[idx + 1].node_nrec;
} /* end else */
@@ -991,32 +1073,36 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
#ifdef H5B2_DEBUG
H5B2__assert_internal((hsize_t)0, hdr, internal);
- if(depth > 1) {
- H5B2__assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)middle_child);
- H5B2__assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child, (H5B2_internal_t *)left_child);
- H5B2__assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child, (H5B2_internal_t *)right_child);
- H5B2__assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)middle_child);
+ if (depth > 1) {
+ H5B2__assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, (H5B2_internal_t *)left_child,
+ (H5B2_internal_t *)middle_child);
+ H5B2__assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child,
+ (H5B2_internal_t *)left_child);
+ H5B2__assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child,
+ (H5B2_internal_t *)right_child);
+ H5B2__assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child,
+ (H5B2_internal_t *)middle_child);
} /* end if */
else {
H5B2__assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)middle_child);
H5B2__assert_leaf2(hdr, (H5B2_leaf_t *)middle_child, (H5B2_leaf_t *)right_child);
H5B2__assert_leaf(hdr, (H5B2_leaf_t *)right_child);
- } /* end else */
+ } /* end else */
#endif /* H5B2_DEBUG */
done:
/* Unlock child nodes (marked as dirty) */
- if(left_child && H5AC_unprotect(hdr->f, child_class, left_addr, left_child, left_child_flags) < 0)
+ if (left_child && H5AC_unprotect(hdr->f, child_class, left_addr, left_child, left_child_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if(middle_child && H5AC_unprotect(hdr->f, child_class, middle_addr, middle_child, middle_child_flags) < 0)
+ if (middle_child &&
+ H5AC_unprotect(hdr->f, child_class, middle_addr, middle_child, middle_child_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if(right_child && H5AC_unprotect(hdr->f, child_class, right_addr, right_child, right_child_flags) < 0)
+ if (right_child && H5AC_unprotect(hdr->f, child_class, right_addr, right_child, right_child_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__redistribute3() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__merge2
*
@@ -1033,17 +1119,19 @@ done:
*/
herr_t
H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
- unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal,
- unsigned *internal_flags_ptr, unsigned idx)
+ unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr,
+ unsigned idx)
{
- const H5AC_class_t *child_class; /* Pointer to child node's class info */
- haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- void *left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */
- uint16_t *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
- uint8_t *left_native, *right_native; /* Pointers to left & right children's native records */
- H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL;/* Pointers to childs' node pointer info */
- unsigned left_child_flags = H5AC__NO_FLAGS_SET, right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5AC_class_t *child_class; /* Pointer to child node's class info */
+ haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
+ void * left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */
+ uint16_t * left_nrec, *right_nrec; /* Pointers to left & right child # of records */
+ uint8_t * left_native, *right_native; /* Pointers to left & right children's native records */
+ H5B2_node_ptr_t * left_node_ptrs = NULL,
+ *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
+ unsigned left_child_flags = H5AC__NO_FLAGS_SET,
+ right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1054,73 +1142,83 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
HDassert(internal_flags_ptr);
/* Check for the kind of B-tree node to split */
- if(depth > 1) {
- H5B2_internal_t *left_internal; /* Pointer to left internal node */
- H5B2_internal_t *right_internal; /* Pointer to right internal node */
+ if (depth > 1) {
+ H5B2_internal_t *left_internal; /* Pointer to left internal node */
+ H5B2_internal_t *right_internal; /* Pointer to right internal node */
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_INT;
/* Lock left & right B-tree child nodes */
/* (Shadow the left node if doing SWMR writes) */
- if(NULL == (left_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (left_internal =
+ H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx],
+ (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
left_addr = internal->node_ptrs[idx].addr;
- if(NULL == (right_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx + 1], (uint16_t)(depth - 1), FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL ==
+ (right_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx + 1],
+ (uint16_t)(depth - 1), FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
right_addr = internal->node_ptrs[idx + 1].addr;
/* More setup for accessing child node information */
- left_child = left_internal;
- right_child = right_internal;
- left_nrec = &(left_internal->nrec);
- right_nrec = &(right_internal->nrec);
- left_native = left_internal->int_native;
- right_native = right_internal->int_native;
- left_node_ptrs = left_internal->node_ptrs;
+ left_child = left_internal;
+ right_child = right_internal;
+ left_nrec = &(left_internal->nrec);
+ right_nrec = &(right_internal->nrec);
+ left_native = left_internal->int_native;
+ right_native = right_internal->int_native;
+ left_node_ptrs = left_internal->node_ptrs;
right_node_ptrs = right_internal->node_ptrs;
} /* end if */
else {
- H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
- H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
+ H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
+ H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_LEAF;
/* Lock left & right B-tree child nodes */
/* (Shadow the left node if doing SWMR writes) */
- if(NULL == (left_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx], hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (left_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx], hdr->swmr_write,
+ H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
left_addr = internal->node_ptrs[idx].addr;
- if(NULL == (right_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx + 1], FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL == (right_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx + 1], FALSE,
+ H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
right_addr = internal->node_ptrs[idx + 1].addr;
/* More setup for accessing child node information */
- left_child = left_leaf;
- right_child = right_leaf;
- left_nrec = &(left_leaf->nrec);
- right_nrec = &(right_leaf->nrec);
- left_native = left_leaf->leaf_native;
+ left_child = left_leaf;
+ right_child = right_leaf;
+ left_nrec = &(left_leaf->nrec);
+ right_nrec = &(right_leaf->nrec);
+ left_native = left_leaf->leaf_native;
right_native = right_leaf->leaf_native;
} /* end else */
/* Redistribute records into left node */
{
/* Copy record from parent node to proper location */
- H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx),
+ hdr->cls->nrec_size);
/* Copy records from right node to left node */
- H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec));
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0),
+ hdr->cls->nrec_size * (*right_nrec));
/* Copy node pointers from right node into left node */
- if(depth > 1)
- H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
+ if (depth > 1)
+ H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]),
+ sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
/* Update flush dependencies for grandchildren, if using SWMR */
- if(hdr->swmr_write && depth > 1)
- if(H5B2__update_child_flush_depends(hdr, depth, left_node_ptrs,
- (unsigned)(*left_nrec + 1), (unsigned)(*left_nrec + *right_nrec + 2), right_child, left_child) < 0)
+ if (hdr->swmr_write && depth > 1)
+ if (H5B2__update_child_flush_depends(hdr, depth, left_node_ptrs, (unsigned)(*left_nrec + 1),
+ (unsigned)(*left_nrec + *right_nrec + 2), right_child,
+ left_child) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent")
/* Update # of records in left node */
@@ -1129,7 +1227,7 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
/* Mark nodes as dirty */
left_child_flags |= H5AC__DIRTIED_FLAG;
right_child_flags |= H5AC__DELETED_FLAG;
- if(!(hdr->swmr_write))
+ if (!(hdr->swmr_write))
right_child_flags |= H5AC__DIRTIED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
} /* end block */
@@ -1140,9 +1238,11 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
internal->node_ptrs[idx].all_nrec += internal->node_ptrs[idx + 1].all_nrec + 1;
/* Slide records in parent node down, to eliminate demoted record */
- if((idx + 1) < internal->nrec) {
- HDmemmove(H5B2_INT_NREC(internal, hdr, idx), H5B2_INT_NREC(internal, hdr, idx + 1), hdr->cls->nrec_size * (internal->nrec - (idx + 1)));
- HDmemmove(&(internal->node_ptrs[idx + 1]), &(internal->node_ptrs[idx + 2]), sizeof(H5B2_node_ptr_t) * (internal->nrec - (idx + 1)));
+ if ((idx + 1) < internal->nrec) {
+ HDmemmove(H5B2_INT_NREC(internal, hdr, idx), H5B2_INT_NREC(internal, hdr, idx + 1),
+ hdr->cls->nrec_size * (internal->nrec - (idx + 1)));
+ HDmemmove(&(internal->node_ptrs[idx + 1]), &(internal->node_ptrs[idx + 2]),
+ sizeof(H5B2_node_ptr_t) * (internal->nrec - (idx + 1)));
} /* end if */
/* Update # of records in parent node */
@@ -1155,12 +1255,12 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
curr_node_ptr->node_nrec--;
/* Mark grandparent as dirty, if given */
- if(parent_cache_info_flags_ptr)
+ if (parent_cache_info_flags_ptr)
*parent_cache_info_flags_ptr |= H5AC__DIRTIED_FLAG;
#ifdef H5B2_DEBUG
H5B2__assert_internal((hsize_t)0, hdr, internal);
- if(depth > 1)
+ if (depth > 1)
H5B2__assert_internal(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child);
else
H5B2__assert_leaf(hdr, (H5B2_leaf_t *)left_child);
@@ -1168,17 +1268,16 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
done:
/* Unlock left node (marked as dirty) */
- if(left_child && H5AC_unprotect(hdr->f, child_class, left_addr, left_child, left_child_flags) < 0)
+ if (left_child && H5AC_unprotect(hdr->f, child_class, left_addr, left_child, left_child_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
/* Delete right node & remove from cache (marked as dirty) */
- if(right_child && H5AC_unprotect(hdr->f, child_class, right_addr, right_child, right_child_flags) < 0)
+ if (right_child && H5AC_unprotect(hdr->f, child_class, right_addr, right_child, right_child_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__merge2() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__merge3
*
@@ -1195,24 +1294,26 @@ done:
*/
herr_t
H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
- unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal,
- unsigned *internal_flags_ptr, unsigned idx)
+ unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr,
+ unsigned idx)
{
- const H5AC_class_t *child_class; /* Pointer to child node's class info */
- haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- haddr_t middle_addr; /* Address of middle child node */
- void *left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */
- void *middle_child = NULL; /* Pointer to middle child node */
- uint16_t *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
- uint16_t *middle_nrec; /* Pointer to middle child # of records */
- uint8_t *left_native, *right_native; /* Pointers to left & right children's native records */
- uint8_t *middle_native; /* Pointer to middle child's native records */
- H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL;/* Pointers to childs' node pointer info */
- H5B2_node_ptr_t *middle_node_ptrs = NULL;/* Pointer to child's node pointer info */
- hsize_t middle_moved_nrec; /* Number of records moved, for internal split */
- unsigned left_child_flags = H5AC__NO_FLAGS_SET, right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
- unsigned middle_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5AC_class_t *child_class; /* Pointer to child node's class info */
+ haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
+ haddr_t middle_addr; /* Address of middle child node */
+ void * left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */
+ void * middle_child = NULL; /* Pointer to middle child node */
+ uint16_t * left_nrec, *right_nrec; /* Pointers to left & right child # of records */
+ uint16_t * middle_nrec; /* Pointer to middle child # of records */
+ uint8_t * left_native, *right_native; /* Pointers to left & right children's native records */
+ uint8_t * middle_native; /* Pointer to middle child's native records */
+ H5B2_node_ptr_t * left_node_ptrs = NULL,
+ *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
+ H5B2_node_ptr_t *middle_node_ptrs = NULL; /* Pointer to child's node pointer info */
+ hsize_t middle_moved_nrec; /* Number of records moved, for internal split */
+ unsigned left_child_flags = H5AC__NO_FLAGS_SET,
+ right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
+ unsigned middle_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1223,115 +1324,131 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
HDassert(internal_flags_ptr);
/* Check for the kind of B-tree node to split */
- if(depth > 1) {
- H5B2_internal_t *left_internal; /* Pointer to left internal node */
- H5B2_internal_t *middle_internal; /* Pointer to middle internal node */
- H5B2_internal_t *right_internal; /* Pointer to right internal node */
+ if (depth > 1) {
+ H5B2_internal_t *left_internal; /* Pointer to left internal node */
+ H5B2_internal_t *middle_internal; /* Pointer to middle internal node */
+ H5B2_internal_t *right_internal; /* Pointer to right internal node */
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_INT;
/* Lock B-tree child nodes */
/* (Shadow left and middle nodes if doing SWMR writes) */
- if(NULL == (left_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx - 1], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (left_internal =
+ H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx - 1],
+ (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
left_addr = internal->node_ptrs[idx - 1].addr;
- if(NULL == (middle_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (middle_internal =
+ H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx],
+ (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
middle_addr = internal->node_ptrs[idx].addr;
- if(NULL == (right_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx + 1], (uint16_t)(depth - 1), FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL ==
+ (right_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx + 1],
+ (uint16_t)(depth - 1), FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
right_addr = internal->node_ptrs[idx + 1].addr;
/* More setup for accessing child node information */
- left_child = left_internal;
- middle_child = middle_internal;
- right_child = right_internal;
- left_nrec = &(left_internal->nrec);
- middle_nrec = &(middle_internal->nrec);
- right_nrec = &(right_internal->nrec);
- left_native = left_internal->int_native;
- middle_native = middle_internal->int_native;
- right_native = right_internal->int_native;
- left_node_ptrs = left_internal->node_ptrs;
+ left_child = left_internal;
+ middle_child = middle_internal;
+ right_child = right_internal;
+ left_nrec = &(left_internal->nrec);
+ middle_nrec = &(middle_internal->nrec);
+ right_nrec = &(right_internal->nrec);
+ left_native = left_internal->int_native;
+ middle_native = middle_internal->int_native;
+ right_native = right_internal->int_native;
+ left_node_ptrs = left_internal->node_ptrs;
middle_node_ptrs = middle_internal->node_ptrs;
- right_node_ptrs = right_internal->node_ptrs;
+ right_node_ptrs = right_internal->node_ptrs;
} /* end if */
else {
- H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
- H5B2_leaf_t *middle_leaf; /* Pointer to middle leaf node */
- H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
+ H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
+ H5B2_leaf_t *middle_leaf; /* Pointer to middle leaf node */
+ H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_LEAF;
/* Lock B-tree child nodes */
/* (Shadow left and middle nodes if doing SWMR writes) */
- if(NULL == (left_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx - 1], hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (left_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx - 1],
+ hdr->swmr_write, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
left_addr = internal->node_ptrs[idx - 1].addr;
- if(NULL == (middle_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx], hdr->swmr_write, H5AC__NO_FLAGS_SET)))
+ if (NULL == (middle_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx],
+ hdr->swmr_write, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
middle_addr = internal->node_ptrs[idx].addr;
- if(NULL == (right_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx + 1], FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL == (right_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx + 1], FALSE,
+ H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
right_addr = internal->node_ptrs[idx + 1].addr;
/* More setup for accessing child node information */
- left_child = left_leaf;
- middle_child = middle_leaf;
- right_child = right_leaf;
- left_nrec = &(left_leaf->nrec);
- middle_nrec = &(middle_leaf->nrec);
- right_nrec = &(right_leaf->nrec);
- left_native = left_leaf->leaf_native;
+ left_child = left_leaf;
+ middle_child = middle_leaf;
+ right_child = right_leaf;
+ left_nrec = &(left_leaf->nrec);
+ middle_nrec = &(middle_leaf->nrec);
+ right_nrec = &(right_leaf->nrec);
+ left_native = left_leaf->leaf_native;
middle_native = middle_leaf->leaf_native;
- right_native = right_leaf->leaf_native;
+ right_native = right_leaf->leaf_native;
} /* end else */
/* Redistribute records into left node */
{
- unsigned total_nrec = (unsigned)(*left_nrec + *middle_nrec + *right_nrec + 2);
+ unsigned total_nrec = (unsigned)(*left_nrec + *middle_nrec + *right_nrec + 2);
unsigned middle_nrec_move = ((total_nrec - 1) / 2) - *left_nrec;
/* Set the base number of records moved from middle node */
middle_moved_nrec = middle_nrec_move;
/* Copy record from parent node to proper location in left node */
- H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1),
+ hdr->cls->nrec_size);
/* Copy records from middle node to left node */
- H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * (middle_nrec_move - 1));
+ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0),
+ hdr->cls->nrec_size * (middle_nrec_move - 1));
/* Copy record from middle node to proper location in parent node */
- H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, (middle_nrec_move - 1)), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx - 1),
+ H5B2_NAT_NREC(middle_native, hdr, (middle_nrec_move - 1)), hdr->cls->nrec_size);
/* Slide records in middle node down */
- HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, middle_nrec_move), hdr->cls->nrec_size * (*middle_nrec - middle_nrec_move));
+ HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, middle_nrec_move),
+ hdr->cls->nrec_size * (*middle_nrec - middle_nrec_move));
/* Move node pointers also if this is an internal node */
- if(depth > 1) {
- unsigned u; /* Local index variable */
+ if (depth > 1) {
+ unsigned u; /* Local index variable */
/* Copy node pointers from middle node into left node */
- H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * middle_nrec_move);
+ H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]),
+ sizeof(H5B2_node_ptr_t) * middle_nrec_move);
/* Count the number of records being moved into the left node */
- for(u = 0; u < middle_nrec_move; u++)
+ for (u = 0; u < middle_nrec_move; u++)
middle_moved_nrec += middle_node_ptrs[u].all_nrec;
/* Slide the node pointers in middle node down */
- HDmemmove(&(middle_node_ptrs[0]), &(middle_node_ptrs[middle_nrec_move]), sizeof(H5B2_node_ptr_t) * (size_t)((unsigned)(*middle_nrec + 1) - middle_nrec_move));
+ HDmemmove(&(middle_node_ptrs[0]), &(middle_node_ptrs[middle_nrec_move]),
+ sizeof(H5B2_node_ptr_t) * (size_t)((unsigned)(*middle_nrec + 1) - middle_nrec_move));
} /* end if */
/* Update flush dependencies for grandchildren, if using SWMR */
- if(hdr->swmr_write && depth > 1)
- if(H5B2__update_child_flush_depends(hdr, depth, left_node_ptrs,
- (unsigned)(*left_nrec + 1), (unsigned)(*left_nrec + middle_nrec_move + 1), middle_child, left_child) < 0)
+ if (hdr->swmr_write && depth > 1)
+ if (H5B2__update_child_flush_depends(hdr, depth, left_node_ptrs, (unsigned)(*left_nrec + 1),
+ (unsigned)(*left_nrec + middle_nrec_move + 1), middle_child,
+ left_child) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent")
/* Update # of records in left & middle nodes */
- *left_nrec = (uint16_t)(*left_nrec + middle_nrec_move);
+ *left_nrec = (uint16_t)(*left_nrec + middle_nrec_move);
*middle_nrec = (uint16_t)(*middle_nrec - middle_nrec_move);
/* Mark nodes as dirty */
@@ -1342,20 +1459,24 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
/* Redistribute records into middle node */
{
/* Copy record from parent node to proper location in middle node */
- H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
+ H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec), H5B2_INT_NREC(internal, hdr, idx),
+ hdr->cls->nrec_size);
/* Copy records from right node to middle node */
- H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec));
+ H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0),
+ hdr->cls->nrec_size * (*right_nrec));
/* Move node pointers also if this is an internal node */
- if(depth > 1)
+ if (depth > 1)
/* Copy node pointers from right node into middle node */
- H5MM_memcpy(&(middle_node_ptrs[*middle_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
+ H5MM_memcpy(&(middle_node_ptrs[*middle_nrec + 1]), &(right_node_ptrs[0]),
+ sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1));
/* Update flush dependencies for grandchildren, if using SWMR */
- if(hdr->swmr_write && depth > 1)
- if(H5B2__update_child_flush_depends(hdr, depth, middle_node_ptrs,
- (unsigned)(*middle_nrec + 1), (unsigned)(*middle_nrec + *right_nrec + 2), right_child, middle_child) < 0)
+ if (hdr->swmr_write && depth > 1)
+ if (H5B2__update_child_flush_depends(hdr, depth, middle_node_ptrs, (unsigned)(*middle_nrec + 1),
+ (unsigned)(*middle_nrec + *right_nrec + 2), right_child,
+ middle_child) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent")
/* Update # of records in middle node */
@@ -1364,22 +1485,24 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
/* Mark nodes as dirty */
middle_child_flags |= H5AC__DIRTIED_FLAG;
right_child_flags |= H5AC__DELETED_FLAG;
- if(!(hdr->swmr_write))
+ if (!(hdr->swmr_write))
right_child_flags |= H5AC__DIRTIED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
} /* end block */
/* Update # of records in child nodes */
internal->node_ptrs[idx - 1].node_nrec = *left_nrec;
- internal->node_ptrs[idx].node_nrec = *middle_nrec;
+ internal->node_ptrs[idx].node_nrec = *middle_nrec;
/* Update total # of records in child B-trees */
internal->node_ptrs[idx - 1].all_nrec += middle_moved_nrec;
internal->node_ptrs[idx].all_nrec += (internal->node_ptrs[idx + 1].all_nrec + 1) - middle_moved_nrec;
/* Slide records in parent node down, to eliminate demoted record */
- if((idx + 1) < internal->nrec) {
- HDmemmove(H5B2_INT_NREC(internal, hdr, idx), H5B2_INT_NREC(internal, hdr, idx + 1), hdr->cls->nrec_size * (internal->nrec - (idx + 1)));
- HDmemmove(&(internal->node_ptrs[idx + 1]), &(internal->node_ptrs[idx + 2]), sizeof(H5B2_node_ptr_t) * (internal->nrec - (idx + 1)));
+ if ((idx + 1) < internal->nrec) {
+ HDmemmove(H5B2_INT_NREC(internal, hdr, idx), H5B2_INT_NREC(internal, hdr, idx + 1),
+ hdr->cls->nrec_size * (internal->nrec - (idx + 1)));
+ HDmemmove(&(internal->node_ptrs[idx + 1]), &(internal->node_ptrs[idx + 2]),
+ sizeof(H5B2_node_ptr_t) * (internal->nrec - (idx + 1)));
} /* end if */
/* Update # of records in parent node */
@@ -1392,36 +1515,37 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
curr_node_ptr->node_nrec--;
/* Mark grandparent as dirty, if given */
- if(parent_cache_info_flags_ptr)
+ if (parent_cache_info_flags_ptr)
*parent_cache_info_flags_ptr |= H5AC__DIRTIED_FLAG;
#ifdef H5B2_DEBUG
H5B2__assert_internal((hsize_t)0, hdr, internal);
- if(depth > 1) {
- H5B2__assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)middle_child);
+ if (depth > 1) {
+ H5B2__assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, (H5B2_internal_t *)left_child,
+ (H5B2_internal_t *)middle_child);
H5B2__assert_internal(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child);
} /* end if */
else {
H5B2__assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)middle_child);
H5B2__assert_leaf(hdr, (H5B2_leaf_t *)middle_child);
- } /* end else */
+ } /* end else */
#endif /* H5B2_DEBUG */
done:
/* Unlock left & middle nodes (marked as dirty) */
- if(left_child && H5AC_unprotect(hdr->f, child_class, left_addr, left_child, left_child_flags) < 0)
+ if (left_child && H5AC_unprotect(hdr->f, child_class, left_addr, left_child, left_child_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if(middle_child && H5AC_unprotect(hdr->f, child_class, middle_addr, middle_child, middle_child_flags) < 0)
+ if (middle_child &&
+ H5AC_unprotect(hdr->f, child_class, middle_addr, middle_child, middle_child_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
/* Delete right node & remove from cache (marked as dirty) */
- if(right_child && H5AC_unprotect(hdr->f, child_class, right_addr, right_child, right_child_flags) < 0)
+ if (right_child && H5AC_unprotect(hdr->f, child_class, right_addr, right_child, right_child_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__merge3() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__insert
*
@@ -1437,7 +1561,7 @@ done:
herr_t
H5B2__insert(H5B2_hdr_t *hdr, void *udata)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1446,37 +1570,36 @@ H5B2__insert(H5B2_hdr_t *hdr, void *udata)
HDassert(udata);
/* Check if the root node is allocated yet */
- if(!H5F_addr_defined(hdr->root.addr)) {
+ if (!H5F_addr_defined(hdr->root.addr)) {
/* Create root node as leaf node in B-tree */
- if(H5B2__create_leaf(hdr, hdr, &(hdr->root)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node")
+ if (H5B2__create_leaf(hdr, hdr, &(hdr->root)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node")
} /* end if */
/* Check if we need to split the root node (equiv. to a 1->2 node split) */
- else if(hdr->root.node_nrec == hdr->node_info[hdr->depth].split_nrec) {
+ else if (hdr->root.node_nrec == hdr->node_info[hdr->depth].split_nrec) {
/* Split root node */
- if(H5B2__split_root(hdr) < 0)
+ if (H5B2__split_root(hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split root node")
} /* end if */
/* Attempt to insert record into B-tree */
- if(hdr->depth > 0) {
- if(H5B2__insert_internal(hdr, hdr->depth, NULL, &hdr->root, H5B2_POS_ROOT, hdr, udata) < 0)
+ if (hdr->depth > 0) {
+ if (H5B2__insert_internal(hdr, hdr->depth, NULL, &hdr->root, H5B2_POS_ROOT, hdr, udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node")
} /* end if */
else {
- if(H5B2__insert_leaf(hdr, &hdr->root, H5B2_POS_ROOT, hdr, udata) < 0)
+ if (H5B2__insert_leaf(hdr, &hdr->root, H5B2_POS_ROOT, hdr, udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node")
} /* end else */
/* Mark B-tree header as dirty */
- if(H5B2__hdr_dirty(hdr) < 0)
+ if (H5B2__hdr_dirty(hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__insert() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__iterate_node
*
@@ -1494,17 +1617,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node,
- void *parent, H5B2_operator_t op, void *op_data)
+H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent,
+ H5B2_operator_t op, void *op_data)
{
- const H5AC_class_t *curr_node_class = NULL; /* Pointer to current node's class info */
- void *node = NULL; /* Pointers to current node */
- uint8_t *node_native; /* Pointers to node's native records */
- uint8_t *native = NULL; /* Pointers to copy of node's native records */
- H5B2_node_ptr_t *node_ptrs = NULL; /* Pointers to node's node pointers */
- hbool_t node_pinned = FALSE; /* Whether node is pinned */
- unsigned u; /* Local index */
- herr_t ret_value = H5_ITER_CONT; /* Iterator return value */
+ const H5AC_class_t *curr_node_class = NULL; /* Pointer to current node's class info */
+ void * node = NULL; /* Pointers to current node */
+ uint8_t * node_native; /* Pointers to node's native records */
+ uint8_t * native = NULL; /* Pointers to copy of node's native records */
+ H5B2_node_ptr_t * node_ptrs = NULL; /* Pointers to node's node pointers */
+ hbool_t node_pinned = FALSE; /* Whether node is pinned */
+ unsigned u; /* Local index */
+ herr_t ret_value = H5_ITER_CONT; /* Iterator return value */
FUNC_ENTER_PACKAGE
@@ -1514,86 +1637,94 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_
HDassert(op);
/* Protect current node & set up variables */
- if(depth > 0) {
- H5B2_internal_t *internal; /* Pointer to internal node */
+ if (depth > 0) {
+ H5B2_internal_t *internal; /* Pointer to internal node */
/* Lock the current B-tree node */
- if(NULL == (internal = H5B2__protect_internal(hdr, parent, (H5B2_node_ptr_t *)curr_node, depth, FALSE, H5AC__READ_ONLY_FLAG))) /* Casting away const OK -QAK */
+ if (NULL ==
+ (internal = H5B2__protect_internal(hdr, parent, (H5B2_node_ptr_t *)curr_node, depth, FALSE,
+ H5AC__READ_ONLY_FLAG))) /* Casting away const OK -QAK */
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Set up information about current node */
curr_node_class = H5AC_BT2_INT;
- node = internal;
- node_native = internal->int_native;
+ node = internal;
+ node_native = internal->int_native;
/* Allocate space for the node pointers in memory */
- if(NULL == (node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].node_ptr_fac)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers")
+ if (NULL == (node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].node_ptr_fac)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory allocation failed for B-tree internal node pointers")
/* Copy the node pointers */
- H5MM_memcpy(node_ptrs, internal->node_ptrs, (sizeof(H5B2_node_ptr_t) * (size_t)(curr_node->node_nrec + 1)));
+ H5MM_memcpy(node_ptrs, internal->node_ptrs,
+ (sizeof(H5B2_node_ptr_t) * (size_t)(curr_node->node_nrec + 1)));
} /* end if */
else {
- H5B2_leaf_t *leaf; /* Pointer to leaf node */
+ H5B2_leaf_t *leaf; /* Pointer to leaf node */
/* Lock the current B-tree node */
- if(NULL == (leaf = H5B2__protect_leaf(hdr, parent, (H5B2_node_ptr_t *)curr_node, FALSE, H5AC__READ_ONLY_FLAG))) /* Casting away const OK -QAK */
+ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, (H5B2_node_ptr_t *)curr_node, FALSE,
+ H5AC__READ_ONLY_FLAG))) /* Casting away const OK -QAK */
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
/* Set up information about current node */
curr_node_class = H5AC_BT2_LEAF;
- node = leaf;
- node_native = leaf->leaf_native;
+ node = leaf;
+ node_native = leaf->leaf_native;
} /* end else */
/* Allocate space for the native keys in memory */
- if(NULL == (native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].nat_rec_fac)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys")
+ if (NULL == (native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].nat_rec_fac)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory allocation failed for B-tree internal native keys")
/* Copy the native keys */
H5MM_memcpy(native, node_native, (hdr->cls->nrec_size * curr_node->node_nrec));
/* Unlock the node */
- if(H5AC_unprotect(hdr->f, curr_node_class, curr_node->addr, node, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0)
+ if (H5AC_unprotect(hdr->f, curr_node_class, curr_node->addr, node,
+ (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
- if(hdr->swmr_write)
+ if (hdr->swmr_write)
node_pinned = TRUE;
else
node = NULL;
/* Iterate through records, in order */
- for(u = 0; u < curr_node->node_nrec && !ret_value; u++) {
+ for (u = 0; u < curr_node->node_nrec && !ret_value; u++) {
/* Descend into child node, if current node is an internal node */
- if(depth > 0)
- if((ret_value = H5B2__iterate_node(hdr, (uint16_t)(depth - 1), &(node_ptrs[u]), node, op, op_data)) < 0)
+ if (depth > 0)
+ if ((ret_value =
+ H5B2__iterate_node(hdr, (uint16_t)(depth - 1), &(node_ptrs[u]), node, op, op_data)) < 0)
HERROR(H5E_BTREE, H5E_CANTLIST, "node iteration failed");
/* Make callback for current record */
- if(!ret_value)
- if((ret_value = (op)(H5B2_NAT_NREC(native, hdr, u), op_data)) < 0)
+ if (!ret_value)
+ if ((ret_value = (op)(H5B2_NAT_NREC(native, hdr, u), op_data)) < 0)
HERROR(H5E_BTREE, H5E_CANTLIST, "iterator function failed");
} /* end for */
/* Descend into last child node, if current node is an internal node */
- if(!ret_value && depth > 0)
- if((ret_value = H5B2__iterate_node(hdr, (uint16_t)(depth - 1), &(node_ptrs[u]), node, op, op_data)) < 0)
+ if (!ret_value && depth > 0)
+ if ((ret_value = H5B2__iterate_node(hdr, (uint16_t)(depth - 1), &(node_ptrs[u]), node, op, op_data)) <
+ 0)
HERROR(H5E_BTREE, H5E_CANTLIST, "node iteration failed");
done:
/* Unpin the node if it was pinned */
- if(node_pinned && H5AC_unpin_entry(node) < 0)
+ if (node_pinned && H5AC_unpin_entry(node) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "can't unpin node")
/* Release the node pointers & native records, if they were copied */
- if(node_ptrs)
+ if (node_ptrs)
node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_FREE(hdr->node_info[depth].node_ptr_fac, node_ptrs);
- if(native)
+ if (native)
native = (uint8_t *)H5FL_FAC_FREE(hdr->node_info[depth].nat_rec_fac, native);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__iterate_node() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__delete_node
*
@@ -1608,13 +1739,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node,
- void *parent, H5B2_remove_t op, void *op_data)
+H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent,
+ H5B2_remove_t op, void *op_data)
{
const H5AC_class_t *curr_node_class = NULL; /* Pointer to current node's class info */
- void *node = NULL; /* Pointers to current node */
- uint8_t *native; /* Pointers to node's native records */
- herr_t ret_value = SUCCEED; /* Return value */
+ void * node = NULL; /* Pointers to current node */
+ uint8_t * native; /* Pointers to node's native records */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1622,58 +1753,63 @@ H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_n
HDassert(hdr);
HDassert(curr_node);
- if(depth > 0) {
- H5B2_internal_t *internal; /* Pointer to internal node */
- unsigned u; /* Local index */
+ if (depth > 0) {
+ H5B2_internal_t *internal; /* Pointer to internal node */
+ unsigned u; /* Local index */
/* Lock the current B-tree node */
- if(NULL == (internal = H5B2__protect_internal(hdr, parent, (H5B2_node_ptr_t *)curr_node, depth, FALSE, H5AC__NO_FLAGS_SET))) /* Casting away const OK -QAK */
+ if (NULL ==
+ (internal = H5B2__protect_internal(hdr, parent, (H5B2_node_ptr_t *)curr_node, depth, FALSE,
+ H5AC__NO_FLAGS_SET))) /* Casting away const OK -QAK */
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Set up information about current node */
curr_node_class = H5AC_BT2_INT;
- node = internal;
- native = internal->int_native;
+ node = internal;
+ native = internal->int_native;
/* Descend into children */
- for(u = 0; u < internal->nrec + (unsigned)1; u++)
- if(H5B2__delete_node(hdr, (uint16_t)(depth - 1), &(internal->node_ptrs[u]), internal, op, op_data) < 0)
+ for (u = 0; u < internal->nrec + (unsigned)1; u++)
+ if (H5B2__delete_node(hdr, (uint16_t)(depth - 1), &(internal->node_ptrs[u]), internal, op,
+ op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node descent failed")
} /* end if */
else {
- H5B2_leaf_t *leaf; /* Pointer to leaf node */
+ H5B2_leaf_t *leaf; /* Pointer to leaf node */
/* Lock the current B-tree node */
- if(NULL == (leaf = H5B2__protect_leaf(hdr, parent, (H5B2_node_ptr_t *)curr_node, FALSE, H5AC__NO_FLAGS_SET))) /* Casting away const OK -QAK */
+ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, (H5B2_node_ptr_t *)curr_node, FALSE,
+ H5AC__NO_FLAGS_SET))) /* Casting away const OK -QAK */
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
/* Set up information about current node */
curr_node_class = H5AC_BT2_LEAF;
- node = leaf;
- native = leaf->leaf_native;
+ node = leaf;
+ native = leaf->leaf_native;
} /* end else */
/* If there's a callback defined, iterate over the records in this node */
- if(op) {
- unsigned u; /* Local index */
+ if (op) {
+ unsigned u; /* Local index */
/* Iterate through records in this node */
- for(u = 0; u < curr_node->node_nrec; u++) {
+ for (u = 0; u < curr_node->node_nrec; u++) {
/* Make callback for each record */
- if((op)(H5B2_NAT_NREC(native, hdr, u), op_data) < 0)
+ if ((op)(H5B2_NAT_NREC(native, hdr, u), op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "iterator function failed")
} /* end for */
- } /* end if */
+ } /* end if */
done:
/* Unlock & delete current node */
- if(node && H5AC_unprotect(hdr->f, curr_node_class, curr_node->addr, node, (unsigned)(H5AC__DELETED_FLAG | (hdr->swmr_write ? 0 : H5AC__FREE_FILE_SPACE_FLAG))) < 0)
+ if (node && H5AC_unprotect(
+ hdr->f, curr_node_class, curr_node->addr, node,
+ (unsigned)(H5AC__DELETED_FLAG | (hdr->swmr_write ? 0 : H5AC__FREE_FILE_SPACE_FLAG))) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__delete_node() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__node_size
*
@@ -1688,11 +1824,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node,
- void *parent, hsize_t *btree_size)
+H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent,
+ hsize_t *btree_size)
{
- H5B2_internal_t *internal = NULL; /* Pointer to internal node */
- herr_t ret_value = SUCCEED; /* Iterator return value */
+ H5B2_internal_t *internal = NULL; /* Pointer to internal node */
+ herr_t ret_value = SUCCEED; /* Iterator return value */
FUNC_ENTER_PACKAGE
@@ -1703,18 +1839,20 @@ H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_nod
HDassert(depth > 0);
/* Lock the current B-tree node */
- if(NULL == (internal = H5B2__protect_internal(hdr, parent, (H5B2_node_ptr_t *)curr_node, depth, FALSE, H5AC__READ_ONLY_FLAG))) /* Casting away const OK -QAK */
+ if (NULL == (internal = H5B2__protect_internal(hdr, parent, (H5B2_node_ptr_t *)curr_node, depth, FALSE,
+ H5AC__READ_ONLY_FLAG))) /* Casting away const OK -QAK */
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Recursively descend into child nodes, if we are above the "twig" level in the B-tree */
- if(depth > 1) {
- unsigned u; /* Local index */
+ if (depth > 1) {
+ unsigned u; /* Local index */
/* Descend into children */
- for(u = 0; u < internal->nrec + (unsigned)1; u++)
- if(H5B2__node_size(hdr, (uint16_t)(depth - 1), &(internal->node_ptrs[u]), internal, btree_size) < 0)
+ for (u = 0; u < internal->nrec + (unsigned)1; u++)
+ if (H5B2__node_size(hdr, (uint16_t)(depth - 1), &(internal->node_ptrs[u]), internal, btree_size) <
+ 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed")
- } /* end if */
+ } /* end if */
else /* depth is 1: count all the leaf nodes from this node */
*btree_size += (hsize_t)(internal->nrec + 1) * hdr->node_size;
@@ -1722,13 +1860,12 @@ H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_nod
*btree_size += hdr->node_size;
done:
- if(internal && H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node->addr, internal, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
+ if (internal && H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node->addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__node_size() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__create_flush_depend
*
@@ -1744,7 +1881,7 @@ done:
herr_t
H5B2__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1753,14 +1890,13 @@ H5B2__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)
HDassert(child_entry);
/* Create a flush dependency between parent and child entry */
- if(H5AC_create_flush_dependency(parent_entry, child_entry) < 0)
+ if (H5AC_create_flush_dependency(parent_entry, child_entry) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__create_flush_depend() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__update_flush_depend
*
@@ -1774,13 +1910,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth,
- const H5B2_node_ptr_t *node_ptr, void *old_parent, void *new_parent)
+H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t *node_ptr, void *old_parent,
+ void *new_parent)
{
- const H5AC_class_t *child_class; /* Pointer to child node's class info */
- void *child = NULL; /* Pointer to child node */
- unsigned node_status = 0; /* Node's status in the metadata cache */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5AC_class_t *child_class; /* Pointer to child node's class info */
+ void * child = NULL; /* Pointer to child node */
+ unsigned node_status = 0; /* Node's status in the metadata cache */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1792,26 +1928,28 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth,
HDassert(new_parent);
/* Check the node's entry status in the metadata cache */
- if(H5AC_get_entry_status(hdr->f, node_ptr->addr, &node_status) < 0)
+ if (H5AC_get_entry_status(hdr->f, node_ptr->addr, &node_status) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to check status of B-tree node")
/* If the node is in the cache, check for retargeting its parent */
- if(node_status & H5AC_ES__IN_CACHE) {
- void **parent_ptr; /* Pointer to child node's parent */
- hbool_t update_deps = FALSE; /* Whether to update flush dependencies */
+ if (node_status & H5AC_ES__IN_CACHE) {
+ void ** parent_ptr; /* Pointer to child node's parent */
+ hbool_t update_deps = FALSE; /* Whether to update flush dependencies */
/* Get child node pointer */
- if(depth > 1) {
+ if (depth > 1) {
H5B2_internal_t *child_int;
/* Protect child */
- if(NULL == (child_int = H5B2__protect_internal(hdr, new_parent, (H5B2_node_ptr_t *)node_ptr, (uint16_t)(depth - 1), FALSE, H5AC__NO_FLAGS_SET))) /* Casting away const OK -QAK */
+ if (NULL == (child_int = H5B2__protect_internal(
+ hdr, new_parent, (H5B2_node_ptr_t *)node_ptr, (uint16_t)(depth - 1), FALSE,
+ H5AC__NO_FLAGS_SET))) /* Casting away const OK -QAK */
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
child_class = H5AC_BT2_INT;
- child = child_int;
+ child = child_int;
- if(child_int->parent == old_parent) {
- parent_ptr = &child_int->parent;
+ if (child_int->parent == old_parent) {
+ parent_ptr = &child_int->parent;
update_deps = TRUE;
} /* end if */
else
@@ -1821,13 +1959,15 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth,
H5B2_leaf_t *child_leaf;
/* Protect child */
- if(NULL == (child_leaf = H5B2__protect_leaf(hdr, new_parent, (H5B2_node_ptr_t *)node_ptr, FALSE, H5AC__NO_FLAGS_SET))) /* Casting away const OK -QAK */
+ if (NULL ==
+ (child_leaf = H5B2__protect_leaf(hdr, new_parent, (H5B2_node_ptr_t *)node_ptr, FALSE,
+ H5AC__NO_FLAGS_SET))) /* Casting away const OK -QAK */
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
child_class = H5AC_BT2_LEAF;
- child = child_leaf;
+ child = child_leaf;
- if(child_leaf->parent == old_parent) {
- parent_ptr = &child_leaf->parent;
+ if (child_leaf->parent == old_parent) {
+ parent_ptr = &child_leaf->parent;
update_deps = TRUE;
} /* end if */
else
@@ -1835,29 +1975,28 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth,
} /* end else */
/* Update flush dependencies if necessary */
- if(update_deps) {
+ if (update_deps) {
/* Sanity check */
HDassert(parent_ptr);
/* Switch the flush dependency for the node */
- if(H5B2__destroy_flush_depend((H5AC_info_t *)old_parent, (H5AC_info_t *)child) < 0)
+ if (H5B2__destroy_flush_depend((H5AC_info_t *)old_parent, (H5AC_info_t *)child) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency")
*parent_ptr = new_parent;
- if(H5B2__create_flush_depend((H5AC_info_t *)new_parent, (H5AC_info_t *)child) < 0)
+ if (H5B2__create_flush_depend((H5AC_info_t *)new_parent, (H5AC_info_t *)child) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency")
} /* end if */
- } /* end if */
+ } /* end if */
done:
/* Unprotect the child */
- if(child)
- if(H5AC_unprotect(hdr->f, child_class, node_ptr->addr, child, H5AC__NO_FLAGS_SET) < 0)
+ if (child)
+ if (H5AC_unprotect(hdr->f, child_class, node_ptr->addr, child, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__update_flush_depend() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__update_child_flush_depends
*
@@ -1871,12 +2010,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth,
- const H5B2_node_ptr_t *node_ptrs, unsigned start_idx, unsigned end_idx,
- void *old_parent, void *new_parent)
+H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t *node_ptrs,
+ unsigned start_idx, unsigned end_idx, void *old_parent, void *new_parent)
{
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1889,16 +2027,15 @@ H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth,
HDassert(new_parent);
/* Loop over children */
- for(u = start_idx; u < end_idx; u++)
+ for (u = start_idx; u < end_idx; u++)
/* Update parent for children */
- if(H5B2__update_flush_depend(hdr, depth - 1, &node_ptrs[u], old_parent, new_parent) < 0)
+ if (H5B2__update_flush_depend(hdr, depth - 1, &node_ptrs[u], old_parent, new_parent) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child node to new parent")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__update_child_flush_depends() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__destroy_flush_depend
*
@@ -1914,7 +2051,7 @@ done:
herr_t
H5B2__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1923,10 +2060,9 @@ H5B2__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)
HDassert(child_entry);
/* Destroy a flush dependency between parent and child entry */
- if(H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0)
+ if (H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__destroy_flush_depend() */
-
diff --git a/src/H5B2internal.c b/src/H5B2internal.c
index 82f676f..5a60a7f 100644
--- a/src/H5B2internal.c
+++ b/src/H5B2internal.c
@@ -26,39 +26,33 @@
/* Module Setup */
/****************/
-#include "H5B2module.h" /* This source code file is part of the H5B2 module */
-
+#include "H5B2module.h" /* This source code file is part of the H5B2 module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5B2pkg.h" /* v2 B-trees */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MFprivate.h" /* File memory management */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5B2pkg.h" /* v2 B-trees */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MFprivate.h" /* File memory management */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
static herr_t H5B2__shadow_internal(H5B2_internal_t *internal, H5B2_node_ptr_t *curr_node_ptr);
-
/*********************/
/* Package Variables */
/*********************/
@@ -66,18 +60,14 @@ static herr_t H5B2__shadow_internal(H5B2_internal_t *internal, H5B2_node_ptr_t *
/* Declare a free list to manage the H5B2_internal_t struct */
H5FL_DEFINE(H5B2_internal_t);
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5B2__create_internal
*
@@ -92,12 +82,11 @@ H5FL_DEFINE(H5B2_internal_t);
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__create_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr,
- uint16_t depth)
+H5B2__create_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, uint16_t depth)
{
- H5B2_internal_t *internal = NULL; /* Pointer to new internal node created */
- hbool_t inserted = FALSE; /* Whether the internal node was inserted into cache */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_internal_t *internal = NULL; /* Pointer to new internal node created */
+ hbool_t inserted = FALSE; /* Whether the internal node was inserted into cache */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -107,24 +96,27 @@ H5B2__create_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr,
HDassert(depth > 0);
/* Allocate memory for internal node information */
- if(NULL == (internal = H5FL_CALLOC(H5B2_internal_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal info")
+ if (NULL == (internal = H5FL_CALLOC(H5B2_internal_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal info")
/* Increment ref. count on B-tree header */
- if(H5B2__hdr_incr(hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header")
+ if (H5B2__hdr_incr(hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header")
/* Share B-tree header information */
internal->hdr = hdr;
/* Allocate space for the native keys in memory */
- if(NULL == (internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].nat_rec_fac)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys")
+ if (NULL == (internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].nat_rec_fac)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory allocation failed for B-tree internal native keys")
HDmemset(internal->int_native, 0, hdr->cls->nrec_size * hdr->node_info[depth].max_nrec);
/* Allocate space for the node pointers in memory */
- if(NULL == (internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].node_ptr_fac)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers")
+ if (NULL ==
+ (internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].node_ptr_fac)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory allocation failed for B-tree internal node pointers")
HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth].max_nrec + 1));
/* Set depth of the node */
@@ -137,43 +129,45 @@ H5B2__create_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr,
internal->shadow_epoch = hdr->shadow_epoch;
/* Allocate space on disk for the internal node */
- if(HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, (hsize_t)hdr->node_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree internal node")
+ if (HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, (hsize_t)hdr->node_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree internal node")
/* Cache the new B-tree node */
- if(H5AC_insert_entry(hdr->f, H5AC_BT2_INT, node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree internal node to cache")
+ if (H5AC_insert_entry(hdr->f, H5AC_BT2_INT, node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree internal node to cache")
inserted = TRUE;
/* Add internal node as child of 'top' proxy */
- if(hdr->top_proxy) {
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, internal) < 0)
+ if (hdr->top_proxy) {
+ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, internal) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, FAIL, "unable to add v2 B-tree node as child of proxy")
internal->top_proxy = hdr->top_proxy;
} /* end if */
done:
- if(ret_value < 0) {
- if(internal) {
+ if (ret_value < 0) {
+ if (internal) {
/* Remove from cache, if inserted */
- if(inserted)
- if(H5AC_remove_entry(internal) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTREMOVE, FAIL, "unable to remove v2 B-tree internal node from cache")
+ if (inserted)
+ if (H5AC_remove_entry(internal) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTREMOVE, FAIL,
+ "unable to remove v2 B-tree internal node from cache")
/* Release internal node's disk space */
- if(H5F_addr_defined(node_ptr->addr) && H5MF_xfree(hdr->f, H5FD_MEM_BTREE, node_ptr->addr, (hsize_t)hdr->node_size) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release file space for v2 B-tree internal node")
+ if (H5F_addr_defined(node_ptr->addr) &&
+ H5MF_xfree(hdr->f, H5FD_MEM_BTREE, node_ptr->addr, (hsize_t)hdr->node_size) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL,
+ "unable to release file space for v2 B-tree internal node")
/* Destroy internal node */
- if(H5B2__internal_free(internal) < 0)
+ if (H5B2__internal_free(internal) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree internal node")
} /* end if */
- } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__create_internal() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__protect_internal
*
@@ -187,12 +181,12 @@ done:
*-------------------------------------------------------------------------
*/
H5B2_internal_t *
-H5B2__protect_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr,
- uint16_t depth, hbool_t shadow, unsigned flags)
+H5B2__protect_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, uint16_t depth,
+ hbool_t shadow, unsigned flags)
{
- H5B2_internal_cache_ud_t udata; /* User data to pass through to cache 'deserialize' callback */
- H5B2_internal_t *internal = NULL; /* v2 B-tree internal node */
- H5B2_internal_t *ret_value = NULL; /* Return value */
+ H5B2_internal_cache_ud_t udata; /* User data to pass through to cache 'deserialize' callback */
+ H5B2_internal_t * internal = NULL; /* v2 B-tree internal node */
+ H5B2_internal_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -206,27 +200,29 @@ H5B2__protect_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr,
HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
/* Set up user data for callback */
- udata.f = hdr->f;
- udata.hdr = hdr;
+ udata.f = hdr->f;
+ udata.hdr = hdr;
udata.parent = parent;
- udata.nrec = node_ptr->node_nrec;
- udata.depth = depth;
+ udata.nrec = node_ptr->node_nrec;
+ udata.depth = depth;
/* Protect the internal node */
- if(NULL == (internal = (H5B2_internal_t *)H5AC_protect(hdr->f, H5AC_BT2_INT, node_ptr->addr, &udata, flags)))
+ if (NULL ==
+ (internal = (H5B2_internal_t *)H5AC_protect(hdr->f, H5AC_BT2_INT, node_ptr->addr, &udata, flags)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect B-tree internal node")
/* Create top proxy, if it doesn't exist */
- if(hdr->top_proxy && NULL == internal->top_proxy) {
+ if (hdr->top_proxy && NULL == internal->top_proxy) {
/* Add internal node as child of 'top' proxy */
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, internal) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, NULL, "unable to add v2 B-tree internal node as child of proxy")
+ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, internal) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, NULL,
+ "unable to add v2 B-tree internal node as child of proxy")
internal->top_proxy = hdr->top_proxy;
} /* end if */
/* Shadow the node, if requested */
- if(shadow)
- if(H5B2__shadow_internal(internal, node_ptr) < 0)
+ if (shadow)
+ if (H5B2__shadow_internal(internal, node_ptr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, NULL, "unable to shadow internal node")
/* Set return value */
@@ -234,26 +230,29 @@ H5B2__protect_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr,
done:
/* Clean up on error */
- if(!ret_value) {
+ if (!ret_value) {
/* Release the internal node, if it was protected */
- if(internal) {
+ if (internal) {
/* Remove from v2 B-tree's proxy, if added */
- if(internal->top_proxy) {
- if(H5AC_proxy_entry_remove_child(internal->top_proxy, internal) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, NULL, "unable to destroy flush dependency between internal node and v2 B-tree 'top' proxy")
+ if (internal->top_proxy) {
+ if (H5AC_proxy_entry_remove_child(internal->top_proxy, internal) < 0)
+ HDONE_ERROR(
+ H5E_BTREE, H5E_CANTUNDEPEND, NULL,
+ "unable to destroy flush dependency between internal node and v2 B-tree 'top' proxy")
internal->top_proxy = NULL;
} /* end if */
/* Unprotect internal node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to unprotect v2 B-tree internal node, address = %llu", (unsigned long long)node_ptr->addr)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL,
+ "unable to unprotect v2 B-tree internal node, address = %llu",
+ (unsigned long long)node_ptr->addr)
} /* end if */
- } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__protect_internal() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__neighbor_internal
*
@@ -280,14 +279,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__neighbor_internal(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
- void *neighbor_loc, H5B2_compare_t comp, void *parent, void *udata,
- H5B2_found_t op, void *op_data)
+H5B2__neighbor_internal(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc,
+ H5B2_compare_t comp, void *parent, void *udata, H5B2_found_t op, void *op_data)
{
- H5B2_internal_t *internal; /* Pointer to internal node */
- unsigned idx = 0; /* Location of record which matches key */
- int cmp = 0; /* Comparison value of records */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_internal_t *internal; /* Pointer to internal node */
+ unsigned idx = 0; /* Location of record which matches key */
+ int cmp = 0; /* Comparison value of records */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -299,46 +297,51 @@ H5B2__neighbor_internal(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_n
HDassert(op);
/* Lock current B-tree node */
- if(NULL == (internal = H5B2__protect_internal(hdr, parent, curr_node_ptr, depth, FALSE, H5AC__READ_ONLY_FLAG)))
+ if (NULL ==
+ (internal = H5B2__protect_internal(hdr, parent, curr_node_ptr, depth, FALSE, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Locate node pointer for child */
- if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0)
+ if (H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) <
+ 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
- if(cmp > 0)
+ if (cmp > 0)
idx++;
/* Set the neighbor location, if appropriate */
- if(comp == H5B2_COMPARE_LESS) {
- if(idx > 0)
+ if (comp == H5B2_COMPARE_LESS) {
+ if (idx > 0)
neighbor_loc = H5B2_INT_NREC(internal, hdr, idx - 1);
} /* end if */
else {
HDassert(comp == H5B2_COMPARE_GREATER);
- if(idx < internal->nrec)
+ if (idx < internal->nrec)
neighbor_loc = H5B2_INT_NREC(internal, hdr, idx);
} /* end else */
/* Attempt to find neighboring record */
- if(depth > 1) {
- if(H5B2__neighbor_internal(hdr, (uint16_t)(depth - 1), &internal->node_ptrs[idx], neighbor_loc, comp, internal, udata, op, op_data) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree internal node")
+ if (depth > 1) {
+ if (H5B2__neighbor_internal(hdr, (uint16_t)(depth - 1), &internal->node_ptrs[idx], neighbor_loc, comp,
+ internal, udata, op, op_data) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL,
+ "unable to find neighbor record in B-tree internal node")
} /* end if */
else {
- if(H5B2__neighbor_leaf(hdr, &internal->node_ptrs[idx], neighbor_loc, comp, internal, udata, op, op_data) < 0)
+ if (H5B2__neighbor_leaf(hdr, &internal->node_ptrs[idx], neighbor_loc, comp, internal, udata, op,
+ op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree leaf node")
} /* end else */
done:
/* Release the B-tree internal node */
- if(internal && H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (internal &&
+ H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__neighbor_internal() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__insert_internal
*
@@ -353,14 +356,13 @@ done:
*/
herr_t
H5B2__insert_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_info_flags_ptr,
- H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *parent,
- void *udata)
+ H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *parent, void *udata)
{
- H5B2_internal_t *internal = NULL; /* Pointer to internal node */
- unsigned internal_flags = H5AC__NO_FLAGS_SET;
- unsigned idx = 0; /* Location of record which matches key */
- H5B2_nodepos_t next_pos = H5B2_POS_MIDDLE; /* Position of node */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_internal_t *internal = NULL; /* Pointer to internal node */
+ unsigned internal_flags = H5AC__NO_FLAGS_SET;
+ unsigned idx = 0; /* Location of record which matches key */
+ H5B2_nodepos_t next_pos = H5B2_POS_MIDDLE; /* Position of node */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -371,7 +373,8 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock current B-tree node */
- if(NULL == (internal = H5B2__protect_internal(hdr, parent, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL ==
+ (internal = H5B2__protect_internal(hdr, parent, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Sanity check number of records */
@@ -379,17 +382,17 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in
/* Split or redistribute child node pointers, if necessary */
{
- int cmp; /* Comparison value of records */
- unsigned retries; /* Number of times to attempt redistribution */
- size_t split_nrec; /* Number of records to split node at */
+ int cmp; /* Comparison value of records */
+ unsigned retries; /* Number of times to attempt redistribution */
+ size_t split_nrec; /* Number of records to split node at */
/* Locate node pointer for child */
- if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
- udata, &idx, &cmp) < 0)
+ if (H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx,
+ &cmp) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
- if(cmp == 0)
+ if (cmp == 0)
HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree")
- if(cmp > 0)
+ if (cmp > 0)
idx++;
/* Set the number of redistribution retries */
@@ -404,74 +407,82 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in
split_nrec = hdr->node_info[depth - 1].split_nrec;
/* Preemptively split/redistribute a node we will enter */
- while(internal->node_ptrs[idx].node_nrec == split_nrec) {
+ while (internal->node_ptrs[idx].node_nrec == split_nrec) {
/* Attempt to redistribute records among children */
- if(idx == 0) { /* Left-most child */
- if(retries > 0 && (internal->node_ptrs[idx + 1].node_nrec < split_nrec)) {
- if(H5B2__redistribute2(hdr, depth, internal, idx) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
+ if (idx == 0) { /* Left-most child */
+ if (retries > 0 && (internal->node_ptrs[idx + 1].node_nrec < split_nrec)) {
+ if (H5B2__redistribute2(hdr, depth, internal, idx) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL,
+ "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__split1(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
+ if (H5B2__split1(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal,
+ &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
- } /* end else */
- } /* end if */
- else if(idx == internal->nrec) { /* Right-most child */
- if(retries > 0 && (internal->node_ptrs[idx - 1].node_nrec < split_nrec)) {
- if(H5B2__redistribute2(hdr, depth, internal, (idx - 1)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
+ } /* end else */
+ } /* end if */
+ else if (idx == internal->nrec) { /* Right-most child */
+ if (retries > 0 && (internal->node_ptrs[idx - 1].node_nrec < split_nrec)) {
+ if (H5B2__redistribute2(hdr, depth, internal, (idx - 1)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL,
+ "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__split1(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
+ if (H5B2__split1(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal,
+ &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
- } /* end else */
- } /* end if */
+ } /* end else */
+ } /* end if */
else { /* Middle child */
- if(retries > 0 && ((internal->node_ptrs[idx + 1].node_nrec < split_nrec) ||
- (internal->node_ptrs[idx - 1].node_nrec < split_nrec))) {
- if(H5B2__redistribute3(hdr, depth, internal, &internal_flags, idx) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
+ if (retries > 0 && ((internal->node_ptrs[idx + 1].node_nrec < split_nrec) ||
+ (internal->node_ptrs[idx - 1].node_nrec < split_nrec))) {
+ if (H5B2__redistribute3(hdr, depth, internal, &internal_flags, idx) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL,
+ "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__split1(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
+ if (H5B2__split1(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal,
+ &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
} /* end else */
- } /* end else */
+ } /* end else */
/* Locate node pointer for child (after split/redistribute) */
- /* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */
- if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
- udata, &idx, &cmp) < 0)
+ /* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching
+ */
+ if (H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx,
+ &cmp) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
- if(cmp == 0)
+ if (cmp == 0)
HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree")
- if(cmp > 0)
+ if (cmp > 0)
idx++;
/* Decrement the number of redistribution retries left */
retries--;
} /* end while */
- } /* end block */
+ } /* end block */
/* Check if this node is left/right-most */
- if(H5B2_POS_MIDDLE != curr_pos) {
- if(idx == 0) {
- if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos)
+ if (H5B2_POS_MIDDLE != curr_pos) {
+ if (idx == 0) {
+ if (H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos)
next_pos = H5B2_POS_LEFT;
} /* end if */
- else if(idx == internal->nrec) {
- if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos)
+ else if (idx == internal->nrec) {
+ if (H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos)
next_pos = H5B2_POS_RIGHT;
} /* end else */
- } /* end if */
+ } /* end if */
/* Attempt to insert node */
- if(depth > 1) {
- if(H5B2__insert_internal(hdr, (uint16_t)(depth - 1), &internal_flags, &internal->node_ptrs[idx], next_pos, internal, udata) < 0)
+ if (depth > 1) {
+ if (H5B2__insert_internal(hdr, (uint16_t)(depth - 1), &internal_flags, &internal->node_ptrs[idx],
+ next_pos, internal, udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node")
} /* end if */
else {
- if(H5B2__insert_leaf(hdr, &internal->node_ptrs[idx], next_pos, internal, udata) < 0)
+ if (H5B2__insert_leaf(hdr, &internal->node_ptrs[idx], next_pos, internal, udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node")
} /* end else */
@@ -483,21 +494,20 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in
done:
/* Release the B-tree internal node */
- if(internal) {
+ if (internal) {
/* Shadow the node if doing SWMR writes */
- if(hdr->swmr_write && (internal_flags & H5AC__DIRTIED_FLAG))
- if(H5B2__shadow_internal(internal, curr_node_ptr) < 0)
+ if (hdr->swmr_write && (internal_flags & H5AC__DIRTIED_FLAG))
+ if (H5B2__shadow_internal(internal, curr_node_ptr) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal B-tree node")
/* Unprotect node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__insert_internal() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__update_internal
*
@@ -514,17 +524,16 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth,
- unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr,
- H5B2_update_status_t *status, H5B2_nodepos_t curr_pos, void *parent,
- void *udata, H5B2_modify_t op, void *op_data)
+H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_info_flags_ptr,
+ H5B2_node_ptr_t *curr_node_ptr, H5B2_update_status_t *status, H5B2_nodepos_t curr_pos,
+ void *parent, void *udata, H5B2_modify_t op, void *op_data)
{
- H5B2_internal_t *internal = NULL; /* Pointer to internal node */
- unsigned internal_flags = H5AC__NO_FLAGS_SET;
- int cmp; /* Comparison value of records */
- unsigned idx = 0; /* Location of record which matches key */
- H5B2_nodepos_t next_pos = H5B2_POS_MIDDLE; /* Position of node */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_internal_t *internal = NULL; /* Pointer to internal node */
+ unsigned internal_flags = H5AC__NO_FLAGS_SET;
+ int cmp; /* Comparison value of records */
+ unsigned idx = 0; /* Location of record which matches key */
+ H5B2_nodepos_t next_pos = H5B2_POS_MIDDLE; /* Position of node */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -535,26 +544,29 @@ H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth,
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock current B-tree node */
- if(NULL == (internal = H5B2__protect_internal(hdr, parent, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL ==
+ (internal = H5B2__protect_internal(hdr, parent, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Sanity check number of records */
HDassert(internal->nrec == curr_node_ptr->node_nrec);
/* Locate node pointer for child */
- if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0)
+ if (H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) <
+ 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
/* Check for modifying existing record */
- if(0 == cmp) {
- hbool_t changed = FALSE; /* Whether the 'modify' callback changed the record */
+ if (0 == cmp) {
+ hbool_t changed = FALSE; /* Whether the 'modify' callback changed the record */
/* Make callback for current record */
- if((op)(H5B2_INT_NREC(internal, hdr, idx), op_data, &changed) < 0) {
+ if ((op)(H5B2_INT_NREC(internal, hdr, idx), op_data, &changed) < 0) {
/* Make certain that the callback didn't modify the value if it failed */
HDassert(changed == FALSE);
- HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree update operation")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL,
+ "'modify' callback failed for B-tree update operation")
} /* end if */
/* Mark the node as dirty if it changed */
@@ -565,43 +577,47 @@ H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth,
} /* end if */
else {
/* Adjust index to leave room for node to insert */
- if(cmp > 0)
+ if (cmp > 0)
idx++;
/* Check if this node is left/right-most */
- if(H5B2_POS_MIDDLE != curr_pos) {
- if(idx == 0) {
- if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos)
+ if (H5B2_POS_MIDDLE != curr_pos) {
+ if (idx == 0) {
+ if (H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos)
next_pos = H5B2_POS_LEFT;
} /* end if */
- else if(idx == internal->nrec) {
- if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos)
+ else if (idx == internal->nrec) {
+ if (H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos)
next_pos = H5B2_POS_RIGHT;
} /* end else */
- } /* end if */
+ } /* end if */
/* Attempt to update record in child */
- if(depth > 1) {
- if(H5B2__update_internal(hdr, (uint16_t)(depth - 1), &internal_flags, &internal->node_ptrs[idx], status, next_pos, internal, udata, op, op_data) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in internal B-tree node")
+ if (depth > 1) {
+ if (H5B2__update_internal(hdr, (uint16_t)(depth - 1), &internal_flags, &internal->node_ptrs[idx],
+ status, next_pos, internal, udata, op, op_data) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL,
+ "unable to update record in internal B-tree node")
} /* end if */
else {
- if(H5B2__update_leaf(hdr, &internal->node_ptrs[idx], status, next_pos, internal, udata, op, op_data) < 0)
+ if (H5B2__update_leaf(hdr, &internal->node_ptrs[idx], status, next_pos, internal, udata, op,
+ op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in leaf B-tree node")
} /* end else */
/* Take actions based on child's status report */
- switch(*status) {
+ switch (*status) {
case H5B2_UPDATE_MODIFY_DONE:
/* No action */
break;
case H5B2_UPDATE_SHADOW_DONE:
/* If child node was shadowed (if SWMR is enabled), mark this node dirty */
- if(hdr->swmr_write)
+ if (hdr->swmr_write)
internal_flags |= H5AC__DIRTIED_FLAG;
- /* No further modifications up the tree are necessary though, so downgrade to merely "modified" */
+ /* No further modifications up the tree are necessary though, so downgrade to merely
+ * "modified" */
*status = H5B2_UPDATE_MODIFY_DONE;
break;
@@ -615,29 +631,30 @@ H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth,
case H5B2_UPDATE_INSERT_CHILD_FULL:
/* Split/redistribute this node */
- if(internal->nrec == hdr->node_info[depth].split_nrec) {
- hbool_t could_split = FALSE; /* Whether the child node could split */
+ if (internal->nrec == hdr->node_info[depth].split_nrec) {
+ hbool_t could_split = FALSE; /* Whether the child node could split */
- if(idx == 0) { /* Left-most child */
+ if (idx == 0) { /* Left-most child */
/* Check for left-most child and its neighbor being close to full */
- if((internal->node_ptrs[idx].node_nrec + internal->node_ptrs[idx + 1].node_nrec)
- >= ((hdr->node_info[depth - 1].split_nrec * 2) - 1))
+ if ((internal->node_ptrs[idx].node_nrec + internal->node_ptrs[idx + 1].node_nrec) >=
+ ((hdr->node_info[depth - 1].split_nrec * 2) - 1))
could_split = TRUE;
- } /* end if */
- else if(idx == internal->nrec) { /* Right-most child */
+ } /* end if */
+ else if (idx == internal->nrec) { /* Right-most child */
/* Check for right-most child and its neighbor being close to full */
- if((internal->node_ptrs[idx - 1].node_nrec + internal->node_ptrs[idx].node_nrec)
- >= ((hdr->node_info[depth - 1].split_nrec * 2) - 1))
+ if ((internal->node_ptrs[idx - 1].node_nrec + internal->node_ptrs[idx].node_nrec) >=
+ ((hdr->node_info[depth - 1].split_nrec * 2) - 1))
could_split = TRUE;
- } /* end else-if */
- else { /* Middle child */
+ } /* end else-if */
+ else { /* Middle child */
/* Check for middle child and its left neighbor being close to full */
- if((internal->node_ptrs[idx - 1].node_nrec + internal->node_ptrs[idx].node_nrec)
- >= ((hdr->node_info[depth - 1].split_nrec * 2) - 1))
+ if ((internal->node_ptrs[idx - 1].node_nrec + internal->node_ptrs[idx].node_nrec) >=
+ ((hdr->node_info[depth - 1].split_nrec * 2) - 1))
could_split = TRUE;
/* Check for middle child and its right neighbor being close to full */
- else if((internal->node_ptrs[idx].node_nrec + internal->node_ptrs[idx + 1].node_nrec)
- >= ((hdr->node_info[depth - 1].split_nrec * 2) - 1))
+ else if ((internal->node_ptrs[idx].node_nrec +
+ internal->node_ptrs[idx + 1].node_nrec) >=
+ ((hdr->node_info[depth - 1].split_nrec * 2) - 1))
could_split = TRUE;
} /* end if */
@@ -645,19 +662,21 @@ H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth,
* cause a split, punt back up to caller, leaving the
* "insert child full" status.
*/
- if(could_split) {
+ if (could_split) {
/* Release the internal B-tree node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal,
+ internal_flags) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL,
+ "unable to release internal B-tree node")
internal = NULL;
/* Punt back to caller */
HGOTO_DONE(SUCCEED);
} /* end if */
- } /* end if */
+ } /* end if */
/* Release the internal B-tree node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
internal = NULL;
@@ -665,8 +684,10 @@ H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth,
*status = H5B2_UPDATE_INSERT_DONE;
/* Dodge sideways into inserting a record into this node */
- if(H5B2__insert_internal(hdr, depth, parent_cache_info_flags_ptr, curr_node_ptr, curr_pos, parent, udata) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into internal B-tree node")
+ if (H5B2__insert_internal(hdr, depth, parent_cache_info_flags_ptr, curr_node_ptr, curr_pos,
+ parent, udata) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL,
+ "unable to insert record into internal B-tree node")
break;
case H5B2_UPDATE_UNKNOWN:
@@ -674,32 +695,31 @@ H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth,
HDassert(0 && "Invalid update status");
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "invalid update status")
} /* end switch */
- } /* end else */
+ } /* end else */
done:
/* Release the internal B-tree node */
- if(internal) {
+ if (internal) {
/* Check if we should shadow this node */
- if(hdr->swmr_write && (internal_flags & H5AC__DIRTIED_FLAG)) {
+ if (hdr->swmr_write && (internal_flags & H5AC__DIRTIED_FLAG)) {
/* Attempt to shadow the node if doing SWMR writes */
- if(H5B2__shadow_internal(internal, curr_node_ptr) < 0)
+ if (H5B2__shadow_internal(internal, curr_node_ptr) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal B-tree node")
/* Change the state to "shadowed" if only modified currently */
/* (Triggers parent to be marked dirty) */
- if(*status == H5B2_UPDATE_MODIFY_DONE)
+ if (*status == H5B2_UPDATE_MODIFY_DONE)
*status = H5B2_UPDATE_SHADOW_DONE;
} /* end if */
/* Unprotect node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__update_internal() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__shadow_internal
*
@@ -719,8 +739,8 @@ done:
static herr_t
H5B2__shadow_internal(H5B2_internal_t *internal, H5B2_node_ptr_t *curr_node_ptr)
{
- H5B2_hdr_t *hdr; /* B-tree header */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t *hdr; /* B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -739,8 +759,8 @@ H5B2__shadow_internal(H5B2_internal_t *internal, H5B2_node_ptr_t *curr_node_ptr)
* the readers so there will be no need to shadow. To check if it has been
* shadowed, compare the epoch of this node and the header. If this node's
* epoch is <= to the header's, it hasn't been shadowed yet. */
- if(internal->shadow_epoch <= hdr->shadow_epoch) {
- haddr_t new_node_addr; /* Address to move node to */
+ if (internal->shadow_epoch <= hdr->shadow_epoch) {
+ haddr_t new_node_addr; /* Address to move node to */
/*
* We must clone the old node so readers with an out-of-date version of
@@ -748,11 +768,11 @@ H5B2__shadow_internal(H5B2_internal_t *internal, H5B2_node_ptr_t *curr_node_ptr)
* shadowed node. Remove it from cache but do not mark it free on disk.
*/
/* Allocate space for the cloned node */
- if(HADDR_UNDEF == (new_node_addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, (hsize_t)hdr->node_size)))
+ if (HADDR_UNDEF == (new_node_addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, (hsize_t)hdr->node_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move B-tree node")
/* Move the location of the node on the disk */
- if(H5AC_move_entry(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, new_node_addr) < 0)
+ if (H5AC_move_entry(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, new_node_addr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTMOVE, FAIL, "unable to move B-tree node")
curr_node_ptr->addr = new_node_addr;
@@ -768,7 +788,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__shadow_internal() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__remove_internal
*
@@ -782,21 +801,21 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
- void *swap_loc, void *swap_parent, uint16_t depth, H5AC_info_t *parent_cache_info,
- unsigned *parent_cache_info_flags_ptr, H5B2_nodepos_t curr_pos,
- H5B2_node_ptr_t *curr_node_ptr, void *udata, H5B2_remove_t op, void *op_data)
+H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *swap_loc, void *swap_parent,
+ uint16_t depth, H5AC_info_t *parent_cache_info, unsigned *parent_cache_info_flags_ptr,
+ H5B2_nodepos_t curr_pos, H5B2_node_ptr_t *curr_node_ptr, void *udata, H5B2_remove_t op,
+ void *op_data)
{
- H5AC_info_t *new_cache_info; /* Pointer to new cache info */
- unsigned *new_cache_info_flags_ptr = NULL;
- H5B2_node_ptr_t *new_node_ptr; /* Pointer to new node pointer */
- H5B2_internal_t *internal; /* Pointer to internal node */
- H5B2_nodepos_t next_pos = H5B2_POS_MIDDLE; /* Position of next node */
- unsigned internal_flags = H5AC__NO_FLAGS_SET;
- haddr_t internal_addr = HADDR_UNDEF; /* Address of internal node */
- size_t merge_nrec; /* Number of records to merge node at */
- hbool_t collapsed_root = FALSE; /* Whether the root was collapsed */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_info_t * new_cache_info; /* Pointer to new cache info */
+ unsigned * new_cache_info_flags_ptr = NULL;
+ H5B2_node_ptr_t *new_node_ptr; /* Pointer to new node pointer */
+ H5B2_internal_t *internal; /* Pointer to internal node */
+ H5B2_nodepos_t next_pos = H5B2_POS_MIDDLE; /* Position of next node */
+ unsigned internal_flags = H5AC__NO_FLAGS_SET;
+ haddr_t internal_addr = HADDR_UNDEF; /* Address of internal node */
+ size_t merge_nrec; /* Number of records to merge node at */
+ hbool_t collapsed_root = FALSE; /* Whether the root was collapsed */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -808,7 +827,8 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock current B-tree node */
- if(NULL == (internal = H5B2__protect_internal(hdr, parent_cache_info, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL == (internal = H5B2__protect_internal(hdr, parent_cache_info, curr_node_ptr, depth, FALSE,
+ H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
internal_addr = curr_node_ptr->addr;
@@ -817,34 +837,35 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
/* Check for needing to collapse the root node */
/* (The root node is the only internal node allowed to have 1 record) */
- if(internal->nrec == 1 &&
- ((internal->node_ptrs[0].node_nrec + internal->node_ptrs[1].node_nrec) <= ((merge_nrec * 2) + 1))) {
+ if (internal->nrec == 1 &&
+ ((internal->node_ptrs[0].node_nrec + internal->node_ptrs[1].node_nrec) <= ((merge_nrec * 2) + 1))) {
/* Merge children of root node */
- if(H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, 0) < 0)
+ if (H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags,
+ 0) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
/* Let the cache know that the object is deleted */
internal_flags |= H5AC__DELETED_FLAG;
- if(!hdr->swmr_write)
+ if (!hdr->swmr_write)
internal_flags |= H5AC__FREE_FILE_SPACE_FLAG;
/* Reset information in header's root node pointer */
- curr_node_ptr->addr = internal->node_ptrs[0].addr;
+ curr_node_ptr->addr = internal->node_ptrs[0].addr;
curr_node_ptr->node_nrec = internal->node_ptrs[0].node_nrec;
/* Update flush dependency for child, if using SWMR */
- if(hdr->swmr_write)
- if(H5B2__update_flush_depend(hdr, depth, curr_node_ptr, internal, hdr) < 0)
+ if (hdr->swmr_write)
+ if (H5B2__update_flush_depend(hdr, depth, curr_node_ptr, internal, hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child node to new parent")
/* Indicate that the level of the B-tree decreased */
*depth_decreased = TRUE;
/* Set pointers for advancing to child node */
- new_cache_info = parent_cache_info;
+ new_cache_info = parent_cache_info;
new_cache_info_flags_ptr = parent_cache_info_flags_ptr;
- new_node_ptr = curr_node_ptr;
+ new_node_ptr = curr_node_ptr;
/* Set flag to indicate root was collapsed */
collapsed_root = TRUE;
@@ -854,24 +875,25 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
} /* end if */
/* Merge or redistribute child node pointers, if necessary */
else {
- unsigned idx = 0; /* Location of record which matches key */
- int cmp = 0; /* Comparison value of records */
- unsigned retries; /* Number of times to attempt redistribution */
+ unsigned idx = 0; /* Location of record which matches key */
+ int cmp = 0; /* Comparison value of records */
+ unsigned retries; /* Number of times to attempt redistribution */
/* Shadow the node if doing SWMR writes */
- if(hdr->swmr_write) {
- if(H5B2__shadow_internal(internal, curr_node_ptr) < 0)
+ if (hdr->swmr_write) {
+ if (H5B2__shadow_internal(internal, curr_node_ptr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node")
internal_addr = curr_node_ptr->addr;
} /* end if */
/* Locate node pointer for child */
- if(swap_loc)
+ if (swap_loc)
idx = 0;
else {
- if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0)
+ if (H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx,
+ &cmp) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
- if(cmp >= 0)
+ if (cmp >= 0)
idx++;
} /* end else */
@@ -884,7 +906,7 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
retries = 2;
/* Preemptively merge/redistribute a node we will enter */
- while(internal->node_ptrs[idx].node_nrec == merge_nrec) {
+ while (internal->node_ptrs[idx].node_nrec == merge_nrec) {
/* Attempt to redistribute records among children */
/* (NOTE: These 2-node redistributions should actually get the
* record to promote from the node with more records. - QAK)
@@ -892,46 +914,54 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
/* (NOTE: This code is the same in both H5B2__remove_internal() and
* H5B2__remove_internal_by_idx(), fix bugs in both places! - QAK)
*/
- if(idx == 0) { /* Left-most child */
- if(retries > 0 && (internal->node_ptrs[idx + 1].node_nrec > merge_nrec)) {
- if(H5B2__redistribute2(hdr, depth, internal, idx) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
+ if (idx == 0) { /* Left-most child */
+ if (retries > 0 && (internal->node_ptrs[idx + 1].node_nrec > merge_nrec)) {
+ if (H5B2__redistribute2(hdr, depth, internal, idx) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL,
+ "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
+ if (H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal,
+ &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
- } /* end else */
- } /* end if */
- else if(idx == internal->nrec) { /* Right-most child */
- if(retries > 0 && (internal->node_ptrs[idx - 1].node_nrec > merge_nrec)) {
- if(H5B2__redistribute2(hdr, depth, internal, (idx - 1)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
+ } /* end else */
+ } /* end if */
+ else if (idx == internal->nrec) { /* Right-most child */
+ if (retries > 0 && (internal->node_ptrs[idx - 1].node_nrec > merge_nrec)) {
+ if (H5B2__redistribute2(hdr, depth, internal, (idx - 1)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL,
+ "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, (idx - 1)) < 0)
+ if (H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal,
+ &internal_flags, (idx - 1)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
- } /* end else */
- } /* end if */
+ } /* end else */
+ } /* end if */
else { /* Middle child */
- if(retries > 0 && ((internal->node_ptrs[idx + 1].node_nrec > merge_nrec) ||
- (internal->node_ptrs[idx - 1].node_nrec > merge_nrec))) {
- if(H5B2__redistribute3(hdr, depth, internal, &internal_flags, idx) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
+ if (retries > 0 && ((internal->node_ptrs[idx + 1].node_nrec > merge_nrec) ||
+ (internal->node_ptrs[idx - 1].node_nrec > merge_nrec))) {
+ if (H5B2__redistribute3(hdr, depth, internal, &internal_flags, idx) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL,
+ "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__merge3(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
+ if (H5B2__merge3(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal,
+ &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
- } /* end else */
+ } /* end else */
/* Locate node pointer for child (after merge/redistribute) */
- if(swap_loc)
+ if (swap_loc)
idx = 0;
else {
-/* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */
- if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0)
+ /* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require
+ * re-searching */
+ if (H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata,
+ &idx, &cmp) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
- if(cmp >= 0)
+ if (cmp >= 0)
idx++;
} /* end else */
@@ -940,66 +970,67 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
} /* end while */
/* Handle deleting a record from an internal node */
- if(!swap_loc && cmp == 0) {
- swap_loc = H5B2_INT_NREC(internal, hdr, idx - 1);
+ if (!swap_loc && cmp == 0) {
+ swap_loc = H5B2_INT_NREC(internal, hdr, idx - 1);
swap_parent = internal;
} /* end if */
/* Swap record to delete with record from leaf, if we are the last internal node */
- if(swap_loc && depth == 1)
- if(H5B2__swap_leaf(hdr, depth, internal, &internal_flags, idx, swap_loc) < 0)
+ if (swap_loc && depth == 1)
+ if (H5B2__swap_leaf(hdr, depth, internal, &internal_flags, idx, swap_loc) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSWAP, FAIL, "Can't swap records in B-tree")
/* Set pointers for advancing to child node */
new_cache_info_flags_ptr = &internal_flags;
- new_cache_info = &internal->cache_info;
- new_node_ptr = &internal->node_ptrs[idx];
+ new_cache_info = &internal->cache_info;
+ new_node_ptr = &internal->node_ptrs[idx];
/* Indicate position of next node */
- if(H5B2_POS_MIDDLE != curr_pos) {
- if(idx == 0) {
- if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos)
+ if (H5B2_POS_MIDDLE != curr_pos) {
+ if (idx == 0) {
+ if (H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos)
next_pos = H5B2_POS_LEFT;
} /* end if */
- else if(idx == internal->nrec) {
- if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos)
+ else if (idx == internal->nrec) {
+ if (H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos)
next_pos = H5B2_POS_RIGHT;
} /* end if */
- } /* end if */
- } /* end else */
+ } /* end if */
+ } /* end else */
/* Attempt to remove record from child node */
- if(depth > 1) {
- if(H5B2__remove_internal(hdr, depth_decreased, swap_loc, swap_parent, (uint16_t)(depth - 1),
- new_cache_info, new_cache_info_flags_ptr, next_pos, new_node_ptr, udata, op, op_data) < 0)
+ if (depth > 1) {
+ if (H5B2__remove_internal(hdr, depth_decreased, swap_loc, swap_parent, (uint16_t)(depth - 1),
+ new_cache_info, new_cache_info_flags_ptr, next_pos, new_node_ptr, udata, op,
+ op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node")
} /* end if */
else {
- if(H5B2__remove_leaf(hdr, new_node_ptr, next_pos, new_cache_info, udata, op, op_data) < 0)
+ if (H5B2__remove_leaf(hdr, new_node_ptr, next_pos, new_cache_info, udata, op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node")
} /* end else */
/* Update record count for node pointer to current node */
- if(!collapsed_root)
+ if (!collapsed_root)
new_node_ptr->all_nrec--;
/* Mark node as dirty */
- if(!(hdr->swmr_write && collapsed_root))
+ if (!(hdr->swmr_write && collapsed_root))
internal_flags |= H5AC__DIRTIED_FLAG;
#ifdef H5B2_DEBUG
- H5B2__assert_internal((!collapsed_root ? (curr_node_ptr->all_nrec - 1) : new_node_ptr->all_nrec), hdr, internal);
+ H5B2__assert_internal((!collapsed_root ? (curr_node_ptr->all_nrec - 1) : new_node_ptr->all_nrec), hdr,
+ internal);
#endif /* H5B2_DEBUG */
done:
/* Release the B-tree internal node */
- if(internal && H5AC_unprotect(hdr->f, H5AC_BT2_INT, internal_addr, internal, internal_flags) < 0)
+ if (internal && H5AC_unprotect(hdr->f, H5AC_BT2_INT, internal_addr, internal, internal_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__remove_internal() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__remove_internal_by_idx
*
@@ -1014,21 +1045,21 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
- void *swap_loc, void *swap_parent, uint16_t depth, H5AC_info_t *parent_cache_info,
- unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr,
- H5B2_nodepos_t curr_pos, hsize_t n, H5B2_remove_t op, void *op_data)
+H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *swap_loc, void *swap_parent,
+ uint16_t depth, H5AC_info_t *parent_cache_info,
+ unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr,
+ H5B2_nodepos_t curr_pos, hsize_t n, H5B2_remove_t op, void *op_data)
{
- H5AC_info_t *new_cache_info; /* Pointer to new cache info */
- unsigned *new_cache_info_flags_ptr = NULL;
- H5B2_node_ptr_t *new_node_ptr; /* Pointer to new node pointer */
- H5B2_internal_t *internal; /* Pointer to internal node */
- H5B2_nodepos_t next_pos = H5B2_POS_MIDDLE; /* Position of next node */
- unsigned internal_flags = H5AC__NO_FLAGS_SET;
- haddr_t internal_addr = HADDR_UNDEF; /* Address of internal node */
- size_t merge_nrec; /* Number of records to merge node at */
- hbool_t collapsed_root = FALSE; /* Whether the root was collapsed */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5AC_info_t * new_cache_info; /* Pointer to new cache info */
+ unsigned * new_cache_info_flags_ptr = NULL;
+ H5B2_node_ptr_t *new_node_ptr; /* Pointer to new node pointer */
+ H5B2_internal_t *internal; /* Pointer to internal node */
+ H5B2_nodepos_t next_pos = H5B2_POS_MIDDLE; /* Position of next node */
+ unsigned internal_flags = H5AC__NO_FLAGS_SET;
+ haddr_t internal_addr = HADDR_UNDEF; /* Address of internal node */
+ size_t merge_nrec; /* Number of records to merge node at */
+ hbool_t collapsed_root = FALSE; /* Whether the root was collapsed */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1040,7 +1071,8 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock current B-tree node */
- if(NULL == (internal = H5B2__protect_internal(hdr, parent_cache_info, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL == (internal = H5B2__protect_internal(hdr, parent_cache_info, curr_node_ptr, depth, FALSE,
+ H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
internal_addr = curr_node_ptr->addr;
HDassert(internal->nrec == curr_node_ptr->node_nrec);
@@ -1051,35 +1083,36 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
/* Check for needing to collapse the root node */
/* (The root node is the only internal node allowed to have 1 record) */
- if(internal->nrec == 1 &&
- ((internal->node_ptrs[0].node_nrec + internal->node_ptrs[1].node_nrec) <= ((merge_nrec * 2) + 1))) {
+ if (internal->nrec == 1 &&
+ ((internal->node_ptrs[0].node_nrec + internal->node_ptrs[1].node_nrec) <= ((merge_nrec * 2) + 1))) {
HDassert(depth == hdr->depth);
/* Merge children of root node */
- if(H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, 0) < 0)
+ if (H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags,
+ 0) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
/* Let the cache know that the object is deleted */
internal_flags |= H5AC__DELETED_FLAG;
- if(!hdr->swmr_write)
+ if (!hdr->swmr_write)
internal_flags |= H5AC__FREE_FILE_SPACE_FLAG;
/* Reset information in header's root node pointer */
- curr_node_ptr->addr = internal->node_ptrs[0].addr;
+ curr_node_ptr->addr = internal->node_ptrs[0].addr;
curr_node_ptr->node_nrec = internal->node_ptrs[0].node_nrec;
/* Update flush dependency for child, if using SWMR */
- if(hdr->swmr_write)
- if(H5B2__update_flush_depend(hdr, depth, curr_node_ptr, internal, hdr) < 0)
+ if (hdr->swmr_write)
+ if (H5B2__update_flush_depend(hdr, depth, curr_node_ptr, internal, hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child node to new parent")
/* Indicate that the level of the B-tree decreased */
*depth_decreased = TRUE;
/* Set pointers for advancing to child node */
- new_cache_info = parent_cache_info;
+ new_cache_info = parent_cache_info;
new_cache_info_flags_ptr = parent_cache_info_flags_ptr;
- new_node_ptr = curr_node_ptr;
+ new_node_ptr = curr_node_ptr;
/* Set flag to indicate root was collapsed */
collapsed_root = TRUE;
@@ -1089,33 +1122,33 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
} /* end if */
/* Merge or redistribute child node pointers, if necessary */
else {
- hsize_t orig_n = n; /* Original index looked for */
+ hsize_t orig_n = n; /* Original index looked for */
unsigned idx; /* Location of record which matches key */
- hbool_t found = FALSE; /* Comparison value of records */
+ hbool_t found = FALSE; /* Comparison value of records */
unsigned retries; /* Number of times to attempt redistribution */
/* Shadow the node if doing SWMR writes */
- if(hdr->swmr_write) {
- if(H5B2__shadow_internal(internal, curr_node_ptr) < 0)
+ if (hdr->swmr_write) {
+ if (H5B2__shadow_internal(internal, curr_node_ptr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node")
internal_addr = curr_node_ptr->addr;
} /* end if */
/* Locate node pointer for child */
- if(swap_loc)
+ if (swap_loc)
idx = 0;
else {
/* Search for record with correct index */
- for(idx = 0; idx < internal->nrec; idx++) {
+ for (idx = 0; idx < internal->nrec; idx++) {
/* Check which child node contains indexed record */
- if(internal->node_ptrs[idx].all_nrec >= n) {
+ if (internal->node_ptrs[idx].all_nrec >= n) {
/* Check if record is in this node */
- if(internal->node_ptrs[idx].all_nrec == n) {
+ if (internal->node_ptrs[idx].all_nrec == n) {
/* Indicate the record was found and that the index
* in child nodes is zero from now on
*/
found = TRUE;
- n = 0;
+ n = 0;
/* Increment to next record */
idx++;
@@ -1130,7 +1163,7 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
*/
n -= (internal->node_ptrs[idx].all_nrec + 1);
} /* end for */
- } /* end else */
+ } /* end else */
/* Set the number of redistribution retries */
/* This takes care of the case where a B-tree node needs to be
@@ -1141,7 +1174,7 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
retries = 2;
/* Preemptively merge/redistribute a node we will enter */
- while(internal->node_ptrs[idx].node_nrec == merge_nrec) {
+ while (internal->node_ptrs[idx].node_nrec == merge_nrec) {
/* Attempt to redistribute records among children */
/* (NOTE: These 2-node redistributions should actually get the
* record to promote from the node with more records. - QAK)
@@ -1149,40 +1182,46 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
/* (NOTE: This code is the same in both H5B2__remove_internal() and
* H5B2__remove_internal_by_idx(), fix bugs in both places! - QAK)
*/
- if(idx == 0) { /* Left-most child */
- if(retries > 0 && (internal->node_ptrs[idx + 1].node_nrec > merge_nrec)) {
- if(H5B2__redistribute2(hdr, depth, internal, idx) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
+ if (idx == 0) { /* Left-most child */
+ if (retries > 0 && (internal->node_ptrs[idx + 1].node_nrec > merge_nrec)) {
+ if (H5B2__redistribute2(hdr, depth, internal, idx) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL,
+ "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
+ if (H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal,
+ &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
- } /* end else */
- } /* end if */
- else if(idx == internal->nrec) { /* Right-most child */
- if(retries > 0 && (internal->node_ptrs[idx - 1].node_nrec > merge_nrec)) {
- if(H5B2__redistribute2(hdr, depth, internal, (idx - 1)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
+ } /* end else */
+ } /* end if */
+ else if (idx == internal->nrec) { /* Right-most child */
+ if (retries > 0 && (internal->node_ptrs[idx - 1].node_nrec > merge_nrec)) {
+ if (H5B2__redistribute2(hdr, depth, internal, (idx - 1)) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL,
+ "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, (idx - 1)) < 0)
+ if (H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal,
+ &internal_flags, (idx - 1)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
- } /* end else */
- } /* end if */
+ } /* end else */
+ } /* end if */
else { /* Middle child */
- if(retries > 0 && ((internal->node_ptrs[idx + 1].node_nrec > merge_nrec) ||
- (internal->node_ptrs[idx - 1].node_nrec > merge_nrec))) {
- if(H5B2__redistribute3(hdr, depth, internal, &internal_flags, idx) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
+ if (retries > 0 && ((internal->node_ptrs[idx + 1].node_nrec > merge_nrec) ||
+ (internal->node_ptrs[idx - 1].node_nrec > merge_nrec))) {
+ if (H5B2__redistribute3(hdr, depth, internal, &internal_flags, idx) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL,
+ "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2__merge3(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0)
+ if (H5B2__merge3(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal,
+ &internal_flags, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
- } /* end else */
+ } /* end else */
/* Locate node pointer for child (after merge/redistribute) */
- if(swap_loc)
+ if (swap_loc)
idx = 0;
else {
/* Count from the original index value again */
@@ -1194,16 +1233,16 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
found = FALSE;
/* Search for record with correct index */
- for(idx = 0; idx < internal->nrec; idx++) {
+ for (idx = 0; idx < internal->nrec; idx++) {
/* Check which child node contains indexed record */
- if(internal->node_ptrs[idx].all_nrec >= n) {
+ if (internal->node_ptrs[idx].all_nrec >= n) {
/* Check if record is in this node */
- if(internal->node_ptrs[idx].all_nrec == n) {
+ if (internal->node_ptrs[idx].all_nrec == n) {
/* Indicate the record was found and that the index
* in child nodes is zero from now on
*/
found = TRUE;
- n = 0;
+ n = 0;
/* Increment to next record */
idx++;
@@ -1218,73 +1257,75 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
*/
n -= (internal->node_ptrs[idx].all_nrec + 1);
} /* end for */
- } /* end else */
+ } /* end else */
/* Decrement the number of redistribution retries left */
retries--;
} /* end while */
/* Handle deleting a record from an internal node */
- if(!swap_loc && found) {
- swap_loc = H5B2_INT_NREC(internal, hdr, idx - 1);
+ if (!swap_loc && found) {
+ swap_loc = H5B2_INT_NREC(internal, hdr, idx - 1);
swap_parent = internal;
} /* end if */
/* Swap record to delete with record from leaf, if we are the last internal node */
- if(swap_loc && depth == 1)
- if(H5B2__swap_leaf(hdr, depth, internal, &internal_flags, idx, swap_loc) < 0)
+ if (swap_loc && depth == 1)
+ if (H5B2__swap_leaf(hdr, depth, internal, &internal_flags, idx, swap_loc) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSWAP, FAIL, "can't swap records in B-tree")
/* Set pointers for advancing to child node */
new_cache_info_flags_ptr = &internal_flags;
- new_cache_info = &internal->cache_info;
- new_node_ptr = &internal->node_ptrs[idx];
+ new_cache_info = &internal->cache_info;
+ new_node_ptr = &internal->node_ptrs[idx];
/* Indicate position of next node */
- if(H5B2_POS_MIDDLE != curr_pos) {
- if(idx == 0) {
- if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos)
+ if (H5B2_POS_MIDDLE != curr_pos) {
+ if (idx == 0) {
+ if (H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos)
next_pos = H5B2_POS_LEFT;
} /* end if */
- else if(idx == internal->nrec) {
- if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos)
+ else if (idx == internal->nrec) {
+ if (H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos)
next_pos = H5B2_POS_RIGHT;
} /* end if */
- } /* end if */
- } /* end else */
+ } /* end if */
+ } /* end else */
/* Attempt to remove record from child node */
- if(depth > 1) {
- if(H5B2__remove_internal_by_idx(hdr, depth_decreased, swap_loc, swap_parent, (uint16_t)(depth - 1),
- new_cache_info, new_cache_info_flags_ptr, new_node_ptr, next_pos, n, op, op_data) < 0)
+ if (depth > 1) {
+ if (H5B2__remove_internal_by_idx(hdr, depth_decreased, swap_loc, swap_parent, (uint16_t)(depth - 1),
+ new_cache_info, new_cache_info_flags_ptr, new_node_ptr, next_pos, n,
+ op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node")
} /* end if */
else {
- if(H5B2__remove_leaf_by_idx(hdr, new_node_ptr, next_pos, new_cache_info, (unsigned)n, op, op_data) < 0)
+ if (H5B2__remove_leaf_by_idx(hdr, new_node_ptr, next_pos, new_cache_info, (unsigned)n, op, op_data) <
+ 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node")
} /* end else */
/* Update record count for node pointer to child node */
- if(!collapsed_root)
+ if (!collapsed_root)
new_node_ptr->all_nrec--;
/* Mark node as dirty */
- if(!(hdr->swmr_write && collapsed_root))
+ if (!(hdr->swmr_write && collapsed_root))
internal_flags |= H5AC__DIRTIED_FLAG;
#ifdef H5B2_DEBUG
- H5B2__assert_internal((!collapsed_root ? (curr_node_ptr->all_nrec - 1) : new_node_ptr->all_nrec), hdr, internal);
+ H5B2__assert_internal((!collapsed_root ? (curr_node_ptr->all_nrec - 1) : new_node_ptr->all_nrec), hdr,
+ internal);
#endif /* H5B2_DEBUG */
done:
/* Release the B-tree internal node */
- if(internal && H5AC_unprotect(hdr->f, H5AC_BT2_INT, internal_addr, internal, internal_flags) < 0)
+ if (internal && H5AC_unprotect(hdr->f, H5AC_BT2_INT, internal_addr, internal, internal_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__remove_internal_by_idx() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__internal_free
*
@@ -1300,7 +1341,7 @@ done:
herr_t
H5B2__internal_free(H5B2_internal_t *internal)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1310,16 +1351,18 @@ H5B2__internal_free(H5B2_internal_t *internal)
HDassert(internal);
/* Release internal node's native key buffer */
- if(internal->int_native)
- internal->int_native = (uint8_t *)H5FL_FAC_FREE(internal->hdr->node_info[internal->depth].nat_rec_fac, internal->int_native);
+ if (internal->int_native)
+ internal->int_native = (uint8_t *)H5FL_FAC_FREE(internal->hdr->node_info[internal->depth].nat_rec_fac,
+ internal->int_native);
/* Release internal node's node pointer buffer */
- if(internal->node_ptrs)
- internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_FREE(internal->hdr->node_info[internal->depth].node_ptr_fac, internal->node_ptrs);
+ if (internal->node_ptrs)
+ internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_FREE(
+ internal->hdr->node_info[internal->depth].node_ptr_fac, internal->node_ptrs);
/* Decrement ref. count on B-tree header */
- if(H5B2__hdr_decr(internal->hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement ref. count on B-tree header")
+ if (H5B2__hdr_decr(internal->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement ref. count on B-tree header")
/* Sanity check */
HDassert(NULL == internal->top_proxy);
@@ -1332,7 +1375,7 @@ done:
} /* end H5B2__internal_free() */
#ifdef H5B2_DEBUG
-
+
/*-------------------------------------------------------------------------
* Function: H5B2__assert_internal
*
@@ -1346,33 +1389,33 @@ done:
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE herr_t
-H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_internal_t *internal)
+H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr,
+ const H5B2_internal_t *internal)
{
- hsize_t tot_all_nrec; /* Total number of records at or below this node */
- uint16_t u, v; /* Local index variables */
+ hsize_t tot_all_nrec; /* Total number of records at or below this node */
+ uint16_t u, v; /* Local index variables */
/* General sanity checking on node */
HDassert(internal->nrec <= hdr->node_info->split_nrec);
/* Sanity checking on node pointers */
tot_all_nrec = internal->nrec;
- for(u = 0; u < internal->nrec + 1; u++) {
+ for (u = 0; u < internal->nrec + 1; u++) {
tot_all_nrec += internal->node_ptrs[u].all_nrec;
HDassert(H5F_addr_defined(internal->node_ptrs[u].addr));
HDassert(internal->node_ptrs[u].addr > 0);
- for(v = 0; v < u; v++)
+ for (v = 0; v < u; v++)
HDassert(internal->node_ptrs[u].addr != internal->node_ptrs[v].addr);
} /* end for */
/* Sanity check all_nrec total in parent */
- if(parent_all_nrec > 0)
+ if (parent_all_nrec > 0)
HDassert(tot_all_nrec == parent_all_nrec);
- return(0);
+ return (0);
} /* end H5B2__assert_internal() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__assert_internal2
*
@@ -1386,32 +1429,32 @@ H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t H5_ATTR_NDEBUG_U
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE herr_t
-H5B2__assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2)
+H5B2__assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr,
+ const H5B2_internal_t *internal, const H5B2_internal_t *internal2)
{
- hsize_t tot_all_nrec; /* Total number of records at or below this node */
- uint16_t u, v; /* Local index variables */
+ hsize_t tot_all_nrec; /* Total number of records at or below this node */
+ uint16_t u, v; /* Local index variables */
/* General sanity checking on node */
HDassert(internal->nrec <= hdr->node_info->split_nrec);
/* Sanity checking on node pointers */
- tot_all_nrec =internal->nrec;
- for(u =0; u < internal->nrec + 1; u++) {
+ tot_all_nrec = internal->nrec;
+ for (u = 0; u < internal->nrec + 1; u++) {
tot_all_nrec += internal->node_ptrs[u].all_nrec;
HDassert(H5F_addr_defined(internal->node_ptrs[u].addr));
HDassert(internal->node_ptrs[u].addr > 0);
- for(v = 0; v < u; v++)
+ for (v = 0; v < u; v++)
HDassert(internal->node_ptrs[u].addr != internal->node_ptrs[v].addr);
- for(v = 0; v < internal2->nrec + 1; v++)
+ for (v = 0; v < internal2->nrec + 1; v++)
HDassert(internal->node_ptrs[u].addr != internal2->node_ptrs[v].addr);
} /* end for */
/* Sanity check all_nrec total in parent */
- if(parent_all_nrec > 0)
+ if (parent_all_nrec > 0)
HDassert(tot_all_nrec == parent_all_nrec);
- return(0);
+ return (0);
} /* end H5B2__assert_internal2() */
#endif /* H5B2_DEBUG */
-
diff --git a/src/H5B2leaf.c b/src/H5B2leaf.c
index d2cfbe0..9917431 100644
--- a/src/H5B2leaf.c
+++ b/src/H5B2leaf.c
@@ -26,40 +26,34 @@
/* Module Setup */
/****************/
-#include "H5B2module.h" /* This source code file is part of the H5B2 module */
-
+#include "H5B2module.h" /* This source code file is part of the H5B2 module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5B2pkg.h" /* v2 B-trees */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5B2pkg.h" /* v2 B-trees */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
static herr_t H5B2__shadow_leaf(H5B2_leaf_t *leaf, H5B2_node_ptr_t *curr_node_ptr);
-
/*********************/
/* Package Variables */
/*********************/
@@ -67,18 +61,14 @@ static herr_t H5B2__shadow_leaf(H5B2_leaf_t *leaf, H5B2_node_ptr_t *curr_node_pt
/* Declare a free list to manage the H5B2_leaf_t struct */
H5FL_DEFINE(H5B2_leaf_t);
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5B2__create_leaf
*
@@ -95,9 +85,9 @@ H5FL_DEFINE(H5B2_leaf_t);
herr_t
H5B2__create_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr)
{
- H5B2_leaf_t *leaf = NULL; /* Pointer to new leaf node created */
- hbool_t inserted = FALSE; /* Whether the leaf node was inserted into cache */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_leaf_t *leaf = NULL; /* Pointer to new leaf node created */
+ hbool_t inserted = FALSE; /* Whether the leaf node was inserted into cache */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -106,18 +96,18 @@ H5B2__create_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr)
HDassert(node_ptr);
/* Allocate memory for leaf information */
- if(NULL == (leaf = H5FL_CALLOC(H5B2_leaf_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf info")
+ if (NULL == (leaf = H5FL_CALLOC(H5B2_leaf_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf info")
/* Increment ref. count on B-tree header */
- if(H5B2__hdr_incr(hdr) < 0)
+ if (H5B2__hdr_incr(hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header")
/* Share B-tree header information */
leaf->hdr = hdr;
/* Allocate space for the native keys in memory */
- if(NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[0].nat_rec_fac)))
+ if (NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[0].nat_rec_fac)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf native keys")
HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec);
@@ -128,43 +118,45 @@ H5B2__create_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr)
leaf->shadow_epoch = hdr->shadow_epoch;
/* Allocate space on disk for the leaf */
- if(HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, (hsize_t)hdr->node_size)))
+ if (HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, (hsize_t)hdr->node_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree leaf node")
/* Cache the new B-tree node */
- if(H5AC_insert_entry(hdr->f, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_insert_entry(hdr->f, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree leaf to cache")
inserted = TRUE;
/* Add leaf node as child of 'top' proxy */
- if(hdr->top_proxy) {
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, leaf) < 0)
+ if (hdr->top_proxy) {
+ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, leaf) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, FAIL, "unable to add v2 B-tree node as child of proxy")
leaf->top_proxy = hdr->top_proxy;
} /* end if */
done:
- if(ret_value < 0) {
- if(leaf) {
+ if (ret_value < 0) {
+ if (leaf) {
/* Remove from cache, if inserted */
- if(inserted)
- if(H5AC_remove_entry(leaf) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTREMOVE, FAIL, "unable to remove v2 B-tree leaf node from cache")
+ if (inserted)
+ if (H5AC_remove_entry(leaf) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTREMOVE, FAIL,
+ "unable to remove v2 B-tree leaf node from cache")
/* Release leaf node's disk space */
- if(H5F_addr_defined(node_ptr->addr) && H5MF_xfree(hdr->f, H5FD_MEM_BTREE, node_ptr->addr, (hsize_t)hdr->node_size) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release file space for v2 B-tree leaf node")
+ if (H5F_addr_defined(node_ptr->addr) &&
+ H5MF_xfree(hdr->f, H5FD_MEM_BTREE, node_ptr->addr, (hsize_t)hdr->node_size) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL,
+ "unable to release file space for v2 B-tree leaf node")
/* Destroy leaf node */
- if(H5B2__leaf_free(leaf) < 0)
+ if (H5B2__leaf_free(leaf) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree leaf node")
} /* end if */
- } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__create_leaf() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__protect_leaf
*
@@ -178,12 +170,11 @@ done:
*-------------------------------------------------------------------------
*/
H5B2_leaf_t *
-H5B2__protect_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr,
- hbool_t shadow, unsigned flags)
+H5B2__protect_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, hbool_t shadow, unsigned flags)
{
- H5B2_leaf_cache_ud_t udata; /* User-data for callback */
- H5B2_leaf_t *leaf; /* v2 B-tree leaf node */
- H5B2_leaf_t *ret_value = NULL; /* Return value */
+ H5B2_leaf_cache_ud_t udata; /* User-data for callback */
+ H5B2_leaf_t * leaf; /* v2 B-tree leaf node */
+ H5B2_leaf_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -196,26 +187,26 @@ H5B2__protect_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr,
HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
/* Set up user data for callback */
- udata.f = hdr->f;
- udata.hdr = hdr;
+ udata.f = hdr->f;
+ udata.hdr = hdr;
udata.parent = parent;
- udata.nrec = node_ptr->node_nrec;
+ udata.nrec = node_ptr->node_nrec;
/* Protect the leaf node */
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, H5AC_BT2_LEAF, node_ptr->addr, &udata, flags)))
+ if (NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, H5AC_BT2_LEAF, node_ptr->addr, &udata, flags)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect B-tree leaf node")
/* Create top proxy, if it doesn't exist */
- if(hdr->top_proxy && NULL == leaf->top_proxy) {
+ if (hdr->top_proxy && NULL == leaf->top_proxy) {
/* Add leaf node as child of 'top' proxy */
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, leaf) < 0)
+ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, leaf) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, NULL, "unable to add v2 B-tree leaf node as child of proxy")
leaf->top_proxy = hdr->top_proxy;
} /* end if */
/* Shadow the node, if requested */
- if(shadow)
- if(H5B2__shadow_leaf(leaf, node_ptr) < 0)
+ if (shadow)
+ if (H5B2__shadow_leaf(leaf, node_ptr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, NULL, "unable to shadow leaf node")
/* Set return value */
@@ -223,26 +214,29 @@ H5B2__protect_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr,
done:
/* Clean up on error */
- if(!ret_value) {
+ if (!ret_value) {
/* Release the leaf node, if it was protected */
- if(leaf) {
+ if (leaf) {
/* Remove from v2 B-tree's proxy, if added */
- if(leaf->top_proxy) {
- if(H5AC_proxy_entry_remove_child(leaf->top_proxy, leaf) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, NULL, "unable to destroy flush dependency between leaf node and v2 B-tree 'top' proxy")
+ if (leaf->top_proxy) {
+ if (H5AC_proxy_entry_remove_child(leaf->top_proxy, leaf) < 0)
+ HDONE_ERROR(
+ H5E_BTREE, H5E_CANTUNDEPEND, NULL,
+ "unable to destroy flush dependency between leaf node and v2 B-tree 'top' proxy")
leaf->top_proxy = NULL;
} /* end if */
/* Unprotect leaf node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to unprotect v2 B-tree leaf node, address = %llu", (unsigned long long)node_ptr->addr)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL,
+ "unable to unprotect v2 B-tree leaf node, address = %llu",
+ (unsigned long long)node_ptr->addr)
} /* end if */
- } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__protect_leaf() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__neighbor_leaf
*
@@ -269,14 +263,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__neighbor_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
- void *neighbor_loc, H5B2_compare_t comp, void *parent, void *udata, H5B2_found_t op,
- void *op_data)
+H5B2__neighbor_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc, H5B2_compare_t comp,
+ void *parent, void *udata, H5B2_found_t op, void *op_data)
{
- H5B2_leaf_t *leaf; /* Pointer to leaf node */
- unsigned idx = 0; /* Location of record which matches key */
- int cmp = 0; /* Comparison value of records */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_leaf_t *leaf; /* Pointer to leaf node */
+ unsigned idx = 0; /* Location of record which matches key */
+ int cmp = 0; /* Comparison value of records */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -287,48 +280,47 @@ H5B2__neighbor_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
HDassert(op);
/* Lock current B-tree node */
- if(NULL == (leaf = H5B2__protect_leaf(hdr, parent, curr_node_ptr, FALSE, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, curr_node_ptr, FALSE, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
/* Locate node pointer for child */
- if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0)
+ if (H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
- if(cmp > 0)
+ if (cmp > 0)
+ idx++;
+ else if (cmp == 0 && comp == H5B2_COMPARE_GREATER)
idx++;
- else
- if(cmp == 0 && comp == H5B2_COMPARE_GREATER)
- idx++;
/* Set the neighbor location, if appropriate */
- if(comp == H5B2_COMPARE_LESS) {
- if(idx > 0)
+ if (comp == H5B2_COMPARE_LESS) {
+ if (idx > 0)
neighbor_loc = H5B2_LEAF_NREC(leaf, hdr, idx - 1);
} /* end if */
else {
HDassert(comp == H5B2_COMPARE_GREATER);
- if(idx < leaf->nrec)
+ if (idx < leaf->nrec)
neighbor_loc = H5B2_LEAF_NREC(leaf, hdr, idx);
} /* end else */
/* Make callback if neighbor record has been found */
- if(neighbor_loc) {
+ if (neighbor_loc) {
/* Make callback for current record */
- if((op)(neighbor_loc, op_data) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree neighbor operation")
+ if ((op)(neighbor_loc, op_data) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL,
+ "'found' callback failed for B-tree neighbor operation")
} /* end if */
else
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree")
done:
/* Release the B-tree leaf node */
- if(leaf && H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (leaf && H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__neighbor_leaf() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__insert_leaf
*
@@ -342,14 +334,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
- H5B2_nodepos_t curr_pos, void *parent, void *udata)
+H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *parent,
+ void *udata)
{
- H5B2_leaf_t *leaf; /* Pointer to leaf node */
- unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting the leaf node */
- int cmp; /* Comparison value of records */
- unsigned idx = 0; /* Location of record which matches key */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_leaf_t *leaf; /* Pointer to leaf node */
+ unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting the leaf node */
+ int cmp; /* Comparison value of records */
+ unsigned idx = 0; /* Location of record which matches key */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -359,7 +351,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock current B-tree node */
- if(NULL == (leaf = H5B2__protect_leaf(hdr, parent, curr_node_ptr, FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, curr_node_ptr, FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
/* Must have a leaf node with enough space to insert a record now */
@@ -370,24 +362,25 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
HDassert(leaf->nrec == curr_node_ptr->node_nrec);
/* Check for inserting into empty leaf */
- if(leaf->nrec == 0)
+ if (leaf->nrec == 0)
idx = 0;
else {
/* Find correct location to insert this record */
- if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0)
+ if (H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
- if(cmp == 0)
+ if (cmp == 0)
HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree")
- if(cmp > 0)
+ if (cmp > 0)
idx++;
/* Make room for new record */
- if(idx < leaf->nrec)
- HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx + 1), H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size * (leaf->nrec - idx));
+ if (idx < leaf->nrec)
+ HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx + 1), H5B2_LEAF_NREC(leaf, hdr, idx),
+ hdr->cls->nrec_size * (leaf->nrec - idx));
} /* end else */
/* Make callback to store record in native form */
- if((hdr->cls->store)(H5B2_LEAF_NREC(leaf, hdr, idx), udata) < 0)
+ if ((hdr->cls->store)(H5B2_LEAF_NREC(leaf, hdr, idx), udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into leaf node")
/* Mark the node as dirty */
@@ -402,42 +395,43 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
/* Check for new record being the min or max for the tree */
/* (Don't use 'else' for the idx check, to allow for root leaf node) */
- if(H5B2_POS_MIDDLE != curr_pos) {
- if(idx == 0) {
- if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
- if(hdr->min_native_rec == NULL)
- if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info")
+ if (H5B2_POS_MIDDLE != curr_pos) {
+ if (idx == 0) {
+ if (H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
+ if (hdr->min_native_rec == NULL)
+ if (NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for v2 B-tree min record info")
H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
- } /* end if */
- if(idx == (unsigned)(leaf->nrec - 1)) {
- if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
- if(hdr->max_native_rec == NULL)
- if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info")
+ } /* end if */
+ if (idx == (unsigned)(leaf->nrec - 1)) {
+ if (H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
+ if (hdr->max_native_rec == NULL)
+ if (NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for v2 B-tree max record info")
H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
done:
/* Release the B-tree leaf node (marked as dirty) */
- if(leaf) {
+ if (leaf) {
/* Shadow the node if doing SWMR writes */
- if(hdr->swmr_write && (leaf_flags & H5AC__DIRTIED_FLAG))
- if(H5B2__shadow_leaf(leaf, curr_node_ptr) < 0)
+ if (hdr->swmr_write && (leaf_flags & H5AC__DIRTIED_FLAG))
+ if (H5B2__shadow_leaf(leaf, curr_node_ptr) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf B-tree node")
/* Unprotect leaf node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, leaf_flags) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, leaf_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__insert_leaf() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__update_leaf
*
@@ -454,15 +448,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
- H5B2_update_status_t *status, H5B2_nodepos_t curr_pos, void *parent,
- void *udata, H5B2_modify_t op, void *op_data)
+H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_update_status_t *status,
+ H5B2_nodepos_t curr_pos, void *parent, void *udata, H5B2_modify_t op, void *op_data)
{
- H5B2_leaf_t *leaf; /* Pointer to leaf node */
- unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting the leaf node */
- int cmp = -1; /* Comparison value of records */
- unsigned idx = 0; /* Location of record which matches key */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_leaf_t *leaf; /* Pointer to leaf node */
+ unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting the leaf node */
+ int cmp = -1; /* Comparison value of records */
+ unsigned idx = 0; /* Location of record which matches key */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -472,7 +465,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock current B-tree node */
- if(NULL == (leaf = H5B2__protect_leaf(hdr, parent, curr_node_ptr, FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, curr_node_ptr, FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
/* Sanity check number of records */
@@ -480,17 +473,17 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
HDassert(leaf->nrec == curr_node_ptr->node_nrec);
/* Check for inserting into empty leaf */
- if(leaf->nrec == 0)
+ if (leaf->nrec == 0)
idx = 0;
else {
/* Find correct location to insert this record */
- if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0)
+ if (H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
/* Check for inserting a record */
- if(0 != cmp) {
+ if (0 != cmp) {
/* Check if the leaf node is full */
- if(curr_node_ptr->node_nrec == hdr->node_info[0].split_nrec) {
+ if (curr_node_ptr->node_nrec == hdr->node_info[0].split_nrec) {
/* Indicate that the leaf is full, but we need to insert */
*status = H5B2_UPDATE_INSERT_CHILD_FULL;
@@ -499,25 +492,27 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
} /* end if */
/* Adjust index to leave room for record to insert */
- if(cmp > 0)
+ if (cmp > 0)
idx++;
/* Make room for new record */
- if(idx < leaf->nrec)
- HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx + 1), H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size * (leaf->nrec - idx));
+ if (idx < leaf->nrec)
+ HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx + 1), H5B2_LEAF_NREC(leaf, hdr, idx),
+ hdr->cls->nrec_size * (leaf->nrec - idx));
} /* end if */
- } /* end else */
+ } /* end else */
/* Check for modifying existing record */
- if(0 == cmp) {
- hbool_t changed = FALSE; /* Whether the 'modify' callback changed the record */
+ if (0 == cmp) {
+ hbool_t changed = FALSE; /* Whether the 'modify' callback changed the record */
/* Make callback for current record */
- if((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data, &changed) < 0) {
+ if ((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data, &changed) < 0) {
/* Make certain that the callback didn't modify the value if it failed */
HDassert(changed == FALSE);
- HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree update operation")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL,
+ "'modify' callback failed for B-tree update operation")
} /* end if */
/* Mark the node as dirty if it changed */
@@ -531,7 +526,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
HDassert(curr_node_ptr->node_nrec < hdr->node_info[0].max_nrec);
/* Make callback to store record in native form */
- if((hdr->cls->store)(H5B2_LEAF_NREC(leaf, hdr, idx), udata) < 0)
+ if ((hdr->cls->store)(H5B2_LEAF_NREC(leaf, hdr, idx), udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into leaf node")
/* Mark the node as dirty */
@@ -550,49 +545,50 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
/* Check for new record being the min or max for the tree */
/* (Don't use 'else' for the idx check, to allow for root leaf node) */
- if(H5B2_POS_MIDDLE != curr_pos) {
- if(idx == 0) {
- if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
- if(hdr->min_native_rec == NULL)
- if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info")
+ if (H5B2_POS_MIDDLE != curr_pos) {
+ if (idx == 0) {
+ if (H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
+ if (hdr->min_native_rec == NULL)
+ if (NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for v2 B-tree min record info")
H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
- } /* end if */
- if(idx == (unsigned)(leaf->nrec - 1)) {
- if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
- if(hdr->max_native_rec == NULL)
- if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info")
+ } /* end if */
+ if (idx == (unsigned)(leaf->nrec - 1)) {
+ if (H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
+ if (hdr->max_native_rec == NULL)
+ if (NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for v2 B-tree max record info")
H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size);
} /* end if */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
done:
/* Release the B-tree leaf node */
- if(leaf) {
+ if (leaf) {
/* Check if we should shadow this node */
- if(hdr->swmr_write && (leaf_flags & H5AC__DIRTIED_FLAG)) {
+ if (hdr->swmr_write && (leaf_flags & H5AC__DIRTIED_FLAG)) {
/* Attempt to shadow the node if doing SWMR writes */
- if(H5B2__shadow_leaf(leaf, curr_node_ptr) < 0)
+ if (H5B2__shadow_leaf(leaf, curr_node_ptr) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf B-tree node")
/* Change the state to "shadowed" if only modified currently */
/* (Triggers parent to be marked dirty) */
- if(*status == H5B2_UPDATE_MODIFY_DONE)
+ if (*status == H5B2_UPDATE_MODIFY_DONE)
*status = H5B2_UPDATE_SHADOW_DONE;
} /* end if */
/* Unprotect leaf node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, leaf_flags) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, leaf_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__update_leaf() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__swap_leaf
*
@@ -608,14 +604,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
- unsigned *internal_flags_ptr, unsigned idx, void *swap_loc)
+H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned *internal_flags_ptr,
+ unsigned idx, void *swap_loc)
{
- const H5AC_class_t *child_class; /* Pointer to child node's class info */
- haddr_t child_addr; /* Address of child node */
- void *child = NULL; /* Pointer to child node */
- uint8_t *child_native; /* Pointer to child's native records */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5AC_class_t *child_class; /* Pointer to child node's class info */
+ haddr_t child_addr; /* Address of child node */
+ void * child = NULL; /* Pointer to child node */
+ uint8_t * child_native; /* Pointer to child's native records */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -626,34 +622,37 @@ H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
HDassert(idx <= internal->nrec);
/* Check for the kind of B-tree node to swap */
- if(depth > 1) {
- H5B2_internal_t *child_internal; /* Pointer to internal node */
+ if (depth > 1) {
+ H5B2_internal_t *child_internal; /* Pointer to internal node */
/* Setup information for unlocking child node */
child_class = H5AC_BT2_INT;
/* Lock B-tree child nodes */
- if(NULL == (child_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx], (uint16_t)(depth - 1), FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL ==
+ (child_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx],
+ (uint16_t)(depth - 1), FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
child_addr = internal->node_ptrs[idx].addr;
/* More setup for accessing child node information */
- child = child_internal;
+ child = child_internal;
child_native = child_internal->int_native;
} /* end if */
else {
- H5B2_leaf_t *child_leaf; /* Pointer to leaf node */
+ H5B2_leaf_t *child_leaf; /* Pointer to leaf node */
/* Setup information for unlocking child nodes */
child_class = H5AC_BT2_LEAF;
/* Lock B-tree child node */
- if(NULL == (child_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx], FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL == (child_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx], FALSE,
+ H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
child_addr = internal->node_ptrs[idx].addr;
/* More setup for accessing child node information */
- child = child_leaf;
+ child = child_leaf;
child_native = child_leaf->leaf_native;
} /* end else */
@@ -667,7 +666,7 @@ H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
#ifdef H5B2_DEBUG
H5B2__assert_internal((hsize_t)0, hdr, internal);
- if(depth > 1)
+ if (depth > 1)
H5B2__assert_internal(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)child);
else
H5B2__assert_leaf(hdr, (H5B2_leaf_t *)child);
@@ -675,13 +674,12 @@ H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
done:
/* Unlock child node */
- if(child && H5AC_unprotect(hdr->f, child_class, child_addr, child, H5AC__DIRTIED_FLAG) < 0)
+ if (child && H5AC_unprotect(hdr->f, child_class, child_addr, child, H5AC__DIRTIED_FLAG) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__swap_leaf() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__shadow_leaf
*
@@ -701,8 +699,8 @@ done:
static herr_t
H5B2__shadow_leaf(H5B2_leaf_t *leaf, H5B2_node_ptr_t *curr_node_ptr)
{
- H5B2_hdr_t *hdr; /* B-tree header */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t *hdr; /* B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -721,20 +719,20 @@ H5B2__shadow_leaf(H5B2_leaf_t *leaf, H5B2_node_ptr_t *curr_node_ptr)
* the readers so there will be no need to shadow. To check if it has been
* shadowed, compare the epoch of this node and the header. If this node's
* epoch is <= to the header's, it hasn't been shadowed yet. */
- if(leaf->shadow_epoch <= hdr->shadow_epoch) {
- haddr_t new_node_addr; /* Address to move node to */
+ if (leaf->shadow_epoch <= hdr->shadow_epoch) {
+ haddr_t new_node_addr; /* Address to move node to */
/*
- * We must clone the old node so readers with an out-of-date version of
- * the parent can still see the correct number of children, via the
- * shadowed node. Remove it from cache but do not mark it free on disk.
- */
+ * We must clone the old node so readers with an out-of-date version of
+ * the parent can still see the correct number of children, via the
+ * shadowed node. Remove it from cache but do not mark it free on disk.
+ */
/* Allocate space for the cloned node */
- if(HADDR_UNDEF == (new_node_addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, (hsize_t)hdr->node_size)))
+ if (HADDR_UNDEF == (new_node_addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, (hsize_t)hdr->node_size)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move B-tree node")
/* Move the location of the old child on the disk */
- if(H5AC_move_entry(hdr->f, H5AC_BT2_LEAF, curr_node_ptr->addr, new_node_addr) < 0)
+ if (H5AC_move_entry(hdr->f, H5AC_BT2_LEAF, curr_node_ptr->addr, new_node_addr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTMOVE, FAIL, "unable to move B-tree node")
curr_node_ptr->addr = new_node_addr;
@@ -750,7 +748,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2__shadow_leaf() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__remove_leaf
*
@@ -764,16 +761,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__remove_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
- H5B2_nodepos_t curr_pos, void *parent, void *udata, H5B2_remove_t op,
- void *op_data)
+H5B2__remove_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *parent,
+ void *udata, H5B2_remove_t op, void *op_data)
{
- H5B2_leaf_t *leaf; /* Pointer to leaf node */
- haddr_t leaf_addr = HADDR_UNDEF; /* Leaf address on disk */
- unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting leaf node */
- unsigned idx = 0; /* Location of record which matches key */
- int cmp; /* Comparison value of records */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_leaf_t *leaf; /* Pointer to leaf node */
+ haddr_t leaf_addr = HADDR_UNDEF; /* Leaf address on disk */
+ unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting leaf node */
+ unsigned idx = 0; /* Location of record which matches key */
+ int cmp; /* Comparison value of records */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -783,7 +779,7 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock current B-tree node */
- if(NULL == (leaf = H5B2__protect_leaf(hdr, parent, curr_node_ptr, FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, curr_node_ptr, FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
leaf_addr = curr_node_ptr->addr;
@@ -792,47 +788,48 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
HDassert(leaf->nrec == curr_node_ptr->node_nrec);
/* Find correct location to remove this record */
- if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0)
+ if (H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
- if(cmp != 0)
+ if (cmp != 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree")
/* Check for invalidating the min/max record for the tree */
- if(H5B2_POS_MIDDLE != curr_pos) {
+ if (H5B2_POS_MIDDLE != curr_pos) {
/* (Don't use 'else' for the idx check, to allow for root leaf node) */
- if(idx == 0) {
- if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
- if(hdr->min_native_rec)
+ if (idx == 0) {
+ if (H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
+ if (hdr->min_native_rec)
hdr->min_native_rec = H5MM_xfree(hdr->min_native_rec);
} /* end if */
- } /* end if */
- if(idx == (unsigned)(leaf->nrec - 1)) {
- if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
- if(hdr->max_native_rec)
+ } /* end if */
+ if (idx == (unsigned)(leaf->nrec - 1)) {
+ if (H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
+ if (hdr->max_native_rec)
hdr->max_native_rec = H5MM_xfree(hdr->max_native_rec);
} /* end if */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
/* Make 'remove' callback if there is one */
- if(op)
- if((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data) < 0)
+ if (op)
+ if ((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record into leaf node")
/* Update number of records in node */
leaf->nrec--;
- if(leaf->nrec > 0) {
+ if (leaf->nrec > 0) {
/* Shadow the node if doing SWMR writes */
- if(hdr->swmr_write) {
- if(H5B2__shadow_leaf(leaf, curr_node_ptr) < 0)
+ if (hdr->swmr_write) {
+ if (H5B2__shadow_leaf(leaf, curr_node_ptr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node")
leaf_addr = curr_node_ptr->addr;
} /* end if */
/* Pack record out of leaf */
- if(idx < leaf->nrec)
- HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx), H5B2_LEAF_NREC(leaf, hdr, (idx + 1)), hdr->cls->nrec_size * (leaf->nrec - idx));
+ if (idx < leaf->nrec)
+ HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx), H5B2_LEAF_NREC(leaf, hdr, (idx + 1)),
+ hdr->cls->nrec_size * (leaf->nrec - idx));
/* Mark leaf node as dirty also */
leaf_flags |= H5AC__DIRTIED_FLAG;
@@ -840,7 +837,7 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
else {
/* Let the cache know that the object is deleted */
leaf_flags |= H5AC__DELETED_FLAG;
- if(!hdr->swmr_write)
+ if (!hdr->swmr_write)
leaf_flags |= H5AC__DIRTIED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
/* Reset address of parent node pointer */
@@ -852,13 +849,12 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
done:
/* Release the B-tree leaf node */
- if(leaf && H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, leaf_addr, leaf, leaf_flags) < 0)
+ if (leaf && H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, leaf_addr, leaf, leaf_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__remove_leaf() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__remove_leaf_by_idx
*
@@ -873,14 +869,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
- H5B2_nodepos_t curr_pos, void *parent, unsigned idx, H5B2_remove_t op,
- void *op_data)
+H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos,
+ void *parent, unsigned idx, H5B2_remove_t op, void *op_data)
{
- H5B2_leaf_t *leaf; /* Pointer to leaf node */
- haddr_t leaf_addr = HADDR_UNDEF; /* Leaf address on disk */
- unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting leaf node */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_leaf_t *leaf; /* Pointer to leaf node */
+ haddr_t leaf_addr = HADDR_UNDEF; /* Leaf address on disk */
+ unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting leaf node */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -890,7 +885,7 @@ H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
HDassert(H5F_addr_defined(curr_node_ptr->addr));
/* Lock B-tree leaf node */
- if(NULL == (leaf = H5B2__protect_leaf(hdr, parent, curr_node_ptr, FALSE, H5AC__NO_FLAGS_SET)))
+ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, curr_node_ptr, FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
leaf_addr = curr_node_ptr->addr;
@@ -900,41 +895,42 @@ H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
HDassert(idx < leaf->nrec);
/* Check for invalidating the min/max record for the tree */
- if(H5B2_POS_MIDDLE != curr_pos) {
+ if (H5B2_POS_MIDDLE != curr_pos) {
/* (Don't use 'else' for the idx check, to allow for root leaf node) */
- if(idx == 0) {
- if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
- if(hdr->min_native_rec)
+ if (idx == 0) {
+ if (H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) {
+ if (hdr->min_native_rec)
hdr->min_native_rec = H5MM_xfree(hdr->min_native_rec);
} /* end if */
- } /* end if */
- if(idx == (unsigned)(leaf->nrec - 1)) {
- if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
- if(hdr->max_native_rec)
+ } /* end if */
+ if (idx == (unsigned)(leaf->nrec - 1)) {
+ if (H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) {
+ if (hdr->max_native_rec)
hdr->max_native_rec = H5MM_xfree(hdr->max_native_rec);
} /* end if */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
/* Make 'remove' callback if there is one */
- if(op)
- if((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data) < 0)
+ if (op)
+ if ((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record into leaf node")
/* Update number of records in node */
leaf->nrec--;
- if(leaf->nrec > 0) {
+ if (leaf->nrec > 0) {
/* Shadow the node if doing SWMR writes */
- if(hdr->swmr_write) {
- if(H5B2__shadow_leaf(leaf, curr_node_ptr) < 0)
+ if (hdr->swmr_write) {
+ if (H5B2__shadow_leaf(leaf, curr_node_ptr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node")
leaf_addr = curr_node_ptr->addr;
} /* end if */
/* Pack record out of leaf */
- if(idx < leaf->nrec)
- HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx), H5B2_LEAF_NREC(leaf, hdr, (idx + 1)), hdr->cls->nrec_size * (leaf->nrec - idx));
+ if (idx < leaf->nrec)
+ HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx), H5B2_LEAF_NREC(leaf, hdr, (idx + 1)),
+ hdr->cls->nrec_size * (leaf->nrec - idx));
/* Mark leaf node as dirty also */
leaf_flags |= H5AC__DIRTIED_FLAG;
@@ -942,7 +938,7 @@ H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
else {
/* Let the cache know that the object is deleted */
leaf_flags |= H5AC__DELETED_FLAG;
- if(!hdr->swmr_write)
+ if (!hdr->swmr_write)
leaf_flags |= H5AC__DIRTIED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
/* Reset address of parent node pointer */
@@ -954,13 +950,12 @@ H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
done:
/* Release the B-tree leaf node */
- if(leaf && H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, leaf_addr, leaf, leaf_flags) < 0)
+ if (leaf && H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, leaf_addr, leaf, leaf_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__remove_leaf_by_idx() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__leaf_free
*
@@ -976,7 +971,7 @@ done:
herr_t
H5B2__leaf_free(H5B2_leaf_t *leaf)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -986,12 +981,12 @@ H5B2__leaf_free(H5B2_leaf_t *leaf)
HDassert(leaf);
/* Release leaf's native key buffer */
- if(leaf->leaf_native)
+ if (leaf->leaf_native)
leaf->leaf_native = (uint8_t *)H5FL_FAC_FREE(leaf->hdr->node_info[0].nat_rec_fac, leaf->leaf_native);
/* Decrement ref. count on B-tree header */
- if(H5B2__hdr_decr(leaf->hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement ref. count on B-tree header")
+ if (H5B2__hdr_decr(leaf->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement ref. count on B-tree header")
/* Sanity check */
HDassert(NULL == leaf->top_proxy);
@@ -1004,7 +999,7 @@ done:
} /* end H5B2__leaf_free() */
#ifdef H5B2_DEBUG
-
+
/*-------------------------------------------------------------------------
* Function: H5B2__assert_leaf
*
@@ -1018,16 +1013,14 @@ done:
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE herr_t
-H5B2__assert_leaf(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr,
- const H5B2_leaf_t H5_ATTR_NDEBUG_UNUSED *leaf)
+H5B2__assert_leaf(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_leaf_t H5_ATTR_NDEBUG_UNUSED *leaf)
{
/* General sanity checking on node */
HDassert(leaf->nrec <= hdr->node_info->split_nrec);
- return(0);
+ return (0);
} /* end H5B2__assert_leaf() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__assert_leaf2
*
@@ -1041,12 +1034,12 @@ H5B2__assert_leaf(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr,
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE herr_t
-H5B2__assert_leaf2(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_leaf_t H5_ATTR_NDEBUG_UNUSED *leaf, const H5B2_leaf_t H5_ATTR_UNUSED *leaf2)
+H5B2__assert_leaf2(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_leaf_t H5_ATTR_NDEBUG_UNUSED *leaf,
+ const H5B2_leaf_t H5_ATTR_UNUSED *leaf2)
{
/* General sanity checking on node */
HDassert(leaf->nrec <= hdr->node_info->split_nrec);
- return(0);
+ return (0);
} /* end H5B2__assert_leaf2() */
#endif /* H5B2_DEBUG */
-
diff --git a/src/H5B2module.h b/src/H5B2module.h
index 6e8c92a..a41e093 100644
--- a/src/H5B2module.h
+++ b/src/H5B2module.h
@@ -25,10 +25,8 @@
* reporting macros.
*/
#define H5B2_MODULE
-#define H5_MY_PKG H5B2
-#define H5_MY_PKG_ERR H5E_BTREE
-#define H5_MY_PKG_INIT NO
+#define H5_MY_PKG H5B2
+#define H5_MY_PKG_ERR H5E_BTREE
+#define H5_MY_PKG_INIT NO
#endif /* _H5B2module_H */
-
-
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index 7d73752..0b5833b 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -30,123 +30,113 @@
#include "H5B2private.h"
/* Other private headers needed by this file */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5FLprivate.h" /* Free Lists */
-
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5FLprivate.h" /* Free Lists */
/**************************/
/* Package Private Macros */
/**************************/
/* Size of storage for number of records per node (on disk) */
-#define H5B2_SIZEOF_RECORDS_PER_NODE (unsigned)2
+#define H5B2_SIZEOF_RECORDS_PER_NODE (unsigned)2
/* Size of a "tree pointer" (on disk) */
/* (essentially, the largest internal pointer allowed) */
-#define H5B2_TREE_POINTER_SIZE(sizeof_addr, sizeof_size) ( \
- (sizeof_addr) + \
- H5B2_SIZEOF_RECORDS_PER_NODE + \
- (sizeof_size) \
- )
+#define H5B2_TREE_POINTER_SIZE(sizeof_addr, sizeof_size) \
+ ((sizeof_addr) + H5B2_SIZEOF_RECORDS_PER_NODE + (sizeof_size))
/* Size of a internal node pointer (on disk) */
-#define H5B2_INT_POINTER_SIZE(h, d) ( \
- (unsigned)(h)->sizeof_addr /* Address of child node */ \
- + (h)->max_nrec_size /* # of records in child node */ \
- + (h)->node_info[(d) - 1].cum_max_nrec_size /* Total # of records in child & below */ \
+#define H5B2_INT_POINTER_SIZE(h, d) \
+ ((unsigned)(h)->sizeof_addr /* Address of child node */ \
+ + (h)->max_nrec_size /* # of records in child node */ \
+ + (h)->node_info[(d)-1].cum_max_nrec_size /* Total # of records in child & below */ \
)
/* Size of checksum information (on disk) */
-#define H5B2_SIZEOF_CHKSUM 4
+#define H5B2_SIZEOF_CHKSUM 4
/* Format overhead for all v2 B-tree metadata in the file */
-#define H5B2_METADATA_PREFIX_SIZE ( \
- (unsigned)H5_SIZEOF_MAGIC /* Signature */ \
- + (unsigned)1 /* Version */ \
- + (unsigned)1 /* Tree type */ \
- + (unsigned)H5B2_SIZEOF_CHKSUM /* Metadata checksum */ \
+#define H5B2_METADATA_PREFIX_SIZE \
+ ((unsigned)H5_SIZEOF_MAGIC /* Signature */ \
+ + (unsigned)1 /* Version */ \
+ + (unsigned)1 /* Tree type */ \
+ + (unsigned)H5B2_SIZEOF_CHKSUM /* Metadata checksum */ \
)
/* Size of the v2 B-tree header on disk */
-#define H5B2_HEADER_SIZE(sizeof_addr, sizeof_size) ( \
- /* General metadata fields */ \
- H5B2_METADATA_PREFIX_SIZE \
- \
- /* Header specific fields */ \
- + (unsigned)4 /* Node size, in bytes */ \
- + (unsigned)2 /* Record size, in bytes */ \
- + (unsigned)2 /* Depth of tree */ \
- + (unsigned)1 /* Split % of full (as integer, ie. "98" means 98%) */ \
- + (unsigned)1 /* Merge % of full (as integer, ie. "98" means 98%) */ \
- + H5B2_TREE_POINTER_SIZE(sizeof_addr, sizeof_size) /* Node pointer to root node in tree */ \
+#define H5B2_HEADER_SIZE(sizeof_addr, sizeof_size) \
+ (/* General metadata fields */ \
+ H5B2_METADATA_PREFIX_SIZE \
+ \
+ /* Header specific fields */ \
+ + (unsigned)4 /* Node size, in bytes */ \
+ + (unsigned)2 /* Record size, in bytes */ \
+ + (unsigned)2 /* Depth of tree */ \
+ + (unsigned)1 /* Split % of full (as integer, ie. "98" means 98%) */ \
+ + (unsigned)1 /* Merge % of full (as integer, ie. "98" means 98%) */ \
+ + H5B2_TREE_POINTER_SIZE(sizeof_addr, sizeof_size) /* Node pointer to root node in tree */ \
)
/* Size of the v2 B-tree header on disk (via file pointer) */
-#define H5B2_HEADER_SIZE_FILE(f) ( \
- H5B2_HEADER_SIZE(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)) \
- )
+#define H5B2_HEADER_SIZE_FILE(f) (H5B2_HEADER_SIZE(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)))
/* Size of the v2 B-tree header on disk (via v2 B-tree header) */
-#define H5B2_HEADER_SIZE_HDR(h) ( \
- H5B2_HEADER_SIZE((h)->sizeof_addr, (h)->sizeof_size) \
- )
+#define H5B2_HEADER_SIZE_HDR(h) (H5B2_HEADER_SIZE((h)->sizeof_addr, (h)->sizeof_size))
/* Size of the v2 B-tree internal node prefix */
-#define H5B2_INT_PREFIX_SIZE ( \
- /* General metadata fields */ \
- H5B2_METADATA_PREFIX_SIZE \
- \
- /* Header specific fields */ \
- /* <none> */ \
+#define H5B2_INT_PREFIX_SIZE \
+ (/* General metadata fields */ \
+ H5B2_METADATA_PREFIX_SIZE \
+ \
+ /* Header specific fields */ /* <none> */ \
)
/* Size of the v2 B-tree leaf node prefix */
-#define H5B2_LEAF_PREFIX_SIZE ( \
- /* General metadata fields */ \
- H5B2_METADATA_PREFIX_SIZE \
- \
- /* Header specific fields */ \
- /* <none> */ \
+#define H5B2_LEAF_PREFIX_SIZE \
+ (/* General metadata fields */ \
+ H5B2_METADATA_PREFIX_SIZE \
+ \
+ /* Header specific fields */ /* <none> */ \
)
/* Macro to retrieve pointer to i'th native record for native record buffer */
-#define H5B2_NAT_NREC(b, hdr, idx) ((b) + (hdr)->nat_off[(idx)])
+#define H5B2_NAT_NREC(b, hdr, idx) ((b) + (hdr)->nat_off[(idx)])
/* Macro to retrieve pointer to i'th native record for internal node */
-#define H5B2_INT_NREC(i, hdr, idx) H5B2_NAT_NREC((i)->int_native, (hdr), (idx))
+#define H5B2_INT_NREC(i, hdr, idx) H5B2_NAT_NREC((i)->int_native, (hdr), (idx))
/* Macro to retrieve pointer to i'th native record for leaf node */
-#define H5B2_LEAF_NREC(l, hdr, idx) H5B2_NAT_NREC((l)->leaf_native, (hdr), (idx))
+#define H5B2_LEAF_NREC(l, hdr, idx) H5B2_NAT_NREC((l)->leaf_native, (hdr), (idx))
/* Number of records that fit into internal node */
/* (accounts for extra node pointer by counting it in with the prefix bytes) */
-#define H5B2_NUM_INT_REC(h, d) \
- (((h)->node_size - (H5B2_INT_PREFIX_SIZE + H5B2_INT_POINTER_SIZE(h, d))) / ((h)->rrec_size + H5B2_INT_POINTER_SIZE(h, d)))
+#define H5B2_NUM_INT_REC(h, d) \
+ (((h)->node_size - (H5B2_INT_PREFIX_SIZE + H5B2_INT_POINTER_SIZE(h, d))) / \
+ ((h)->rrec_size + H5B2_INT_POINTER_SIZE(h, d)))
/* Uncomment this macro to enable extra sanity checking */
/* #define H5B2_DEBUG */
-
/****************************/
/* Package Private Typedefs */
/****************************/
/* A "node pointer" to another B-tree node */
typedef struct {
- haddr_t addr; /* Address of other node */
- uint16_t node_nrec; /* Number of records used in node pointed to */
- hsize_t all_nrec; /* Number of records in node pointed to and all it's children */
+ haddr_t addr; /* Address of other node */
+ uint16_t node_nrec; /* Number of records used in node pointed to */
+ hsize_t all_nrec; /* Number of records in node pointed to and all it's children */
} H5B2_node_ptr_t;
/* Information about a node at a given depth */
typedef struct {
- unsigned max_nrec; /* Max. number of records in node */
- unsigned split_nrec; /* Number of records to split node at */
- unsigned merge_nrec; /* Number of records to merge node at */
- hsize_t cum_max_nrec; /* Cumulative max. # of records below this node's depth */
- uint8_t cum_max_nrec_size; /* Size to store cumulative max. # of records for this node (in bytes) */
- H5FL_fac_head_t *nat_rec_fac; /* Factory for native record blocks */
- H5FL_fac_head_t *node_ptr_fac; /* Factory for node pointer blocks */
+ unsigned max_nrec; /* Max. number of records in node */
+ unsigned split_nrec; /* Number of records to split node at */
+ unsigned merge_nrec; /* Number of records to merge node at */
+ hsize_t cum_max_nrec; /* Cumulative max. # of records below this node's depth */
+ uint8_t cum_max_nrec_size; /* Size to store cumulative max. # of records for this node (in bytes) */
+ H5FL_fac_head_t *nat_rec_fac; /* Factory for native record blocks */
+ H5FL_fac_head_t *node_ptr_fac; /* Factory for node pointer blocks */
} H5B2_node_info_t;
/* The B-tree header information */
@@ -155,60 +145,60 @@ typedef struct H5B2_hdr_t {
H5AC_info_t cache_info;
/* Internal B-tree information (stored) */
- H5B2_node_ptr_t root; /* Node pointer to root node in B-tree */
+ H5B2_node_ptr_t root; /* Node pointer to root node in B-tree */
/* Information set by user (stored) */
- uint8_t split_percent; /* Percent full at which to split the node, when inserting */
- uint8_t merge_percent; /* Percent full at which to merge the node, when deleting */
- uint32_t node_size; /* Size of B-tree nodes, in bytes */
- uint32_t rrec_size; /* Size of "raw" (on disk) record, in bytes */
+ uint8_t split_percent; /* Percent full at which to split the node, when inserting */
+ uint8_t merge_percent; /* Percent full at which to merge the node, when deleting */
+ uint32_t node_size; /* Size of B-tree nodes, in bytes */
+ uint32_t rrec_size; /* Size of "raw" (on disk) record, in bytes */
/* Dynamic information (stored) */
- uint16_t depth; /* B-tree's overall depth */
+ uint16_t depth; /* B-tree's overall depth */
/* Derived information from user's information (not stored) */
- uint8_t max_nrec_size; /* Size to store max. # of records in any node (in bytes) */
+ uint8_t max_nrec_size; /* Size to store max. # of records in any node (in bytes) */
/* Shared internal data structures (not stored) */
- H5F_t *f; /* Pointer to the file that the B-tree is in */
- haddr_t addr; /* Address of B-tree header in the file */
- size_t hdr_size; /* Size of the B-tree header on disk */
- size_t rc; /* Reference count of nodes using this header */
- size_t file_rc; /* Reference count of files using this header */
- hbool_t pending_delete; /* B-tree is pending deletion */
- uint8_t sizeof_size; /* Size of file sizes */
- uint8_t sizeof_addr; /* Size of file addresses */
- H5B2_remove_t remove_op; /* Callback operator for deleting B-tree */
- void *remove_op_data;/* B-tree deletion callback's context */
- uint8_t *page; /* Common disk page for I/O */
- size_t *nat_off; /* Array of offsets of native records */
- H5B2_node_info_t *node_info; /* Table of node info structs for current depth of B-tree */
- void *min_native_rec; /* Pointer to minimum native record */
- void *max_native_rec; /* Pointer to maximum native record */
+ H5F_t * f; /* Pointer to the file that the B-tree is in */
+ haddr_t addr; /* Address of B-tree header in the file */
+ size_t hdr_size; /* Size of the B-tree header on disk */
+ size_t rc; /* Reference count of nodes using this header */
+ size_t file_rc; /* Reference count of files using this header */
+ hbool_t pending_delete; /* B-tree is pending deletion */
+ uint8_t sizeof_size; /* Size of file sizes */
+ uint8_t sizeof_addr; /* Size of file addresses */
+ H5B2_remove_t remove_op; /* Callback operator for deleting B-tree */
+ void * remove_op_data; /* B-tree deletion callback's context */
+ uint8_t * page; /* Common disk page for I/O */
+ size_t * nat_off; /* Array of offsets of native records */
+ H5B2_node_info_t *node_info; /* Table of node info structs for current depth of B-tree */
+ void * min_native_rec; /* Pointer to minimum native record */
+ void * max_native_rec; /* Pointer to maximum native record */
/* SWMR / Flush dependency information (not stored) */
- hbool_t swmr_write; /* Whether we are doing SWMR writes */
+ hbool_t swmr_write; /* Whether we are doing SWMR writes */
H5AC_proxy_entry_t *top_proxy; /* 'Top' proxy cache entry for all B-tree entries */
- void *parent; /* Pointer to 'top' proxy flush dependency
- * parent, if it exists, otherwise NULL.
- * If the v2 B-tree is being used to index a
- * chunked dataset and the dataset metadata is
- * modified by a SWMR writer, this field will
- * be set equal to the object header proxy
- * that is the flush dependency parent
- * of the v2 B-tree header.
- *
- * The field is used to avoid duplicate setups
- * of the flush dependency relationship, and to
- * allow the v2 B-tree header to destroy the
- * flush dependency on receipt of an eviction
- * notification from the metadata cache.
- */
- uint64_t shadow_epoch; /* Epoch of header, for making shadow copies */
+ void * parent; /* Pointer to 'top' proxy flush dependency
+ * parent, if it exists, otherwise NULL.
+ * If the v2 B-tree is being used to index a
+ * chunked dataset and the dataset metadata is
+ * modified by a SWMR writer, this field will
+ * be set equal to the object header proxy
+ * that is the flush dependency parent
+ * of the v2 B-tree header.
+ *
+ * The field is used to avoid duplicate setups
+ * of the flush dependency relationship, and to
+ * allow the v2 B-tree header to destroy the
+ * flush dependency on receipt of an eviction
+ * notification from the metadata cache.
+ */
+ uint64_t shadow_epoch; /* Epoch of header, for making shadow copies */
/* Client information (not stored) */
- const H5B2_class_t *cls; /* Class of B-tree client */
- void *cb_ctx; /* Client callback context */
+ const H5B2_class_t *cls; /* Class of B-tree client */
+ void * cb_ctx; /* Client callback context */
} H5B2_hdr_t;
/* B-tree leaf node information */
@@ -217,14 +207,14 @@ typedef struct H5B2_leaf_t {
H5AC_info_t cache_info;
/* Internal B-tree information */
- H5B2_hdr_t *hdr; /* Pointer to the [pinned] v2 B-tree header */
- uint8_t *leaf_native; /* Pointer to native records */
- uint16_t nrec; /* Number of records in node */
+ H5B2_hdr_t *hdr; /* Pointer to the [pinned] v2 B-tree header */
+ uint8_t * leaf_native; /* Pointer to native records */
+ uint16_t nrec; /* Number of records in node */
/* SWMR / Flush dependency information (not stored) */
- H5AC_proxy_entry_t *top_proxy; /* 'Top' proxy cache entry for all B-tree entries */
- void *parent; /* Flush dependency parent for leaf */
- uint64_t shadow_epoch; /* Epoch of node, for making shadow copies */
+ H5AC_proxy_entry_t *top_proxy; /* 'Top' proxy cache entry for all B-tree entries */
+ void * parent; /* Flush dependency parent for leaf */
+ uint64_t shadow_epoch; /* Epoch of node, for making shadow copies */
} H5B2_leaf_t;
/* B-tree internal node information */
@@ -233,74 +223,73 @@ typedef struct H5B2_internal_t {
H5AC_info_t cache_info;
/* Internal B-tree information */
- H5B2_hdr_t *hdr; /* Pointer to the [pinned] v2 B-tree header */
- uint8_t *int_native; /* Pointer to native records */
- H5B2_node_ptr_t *node_ptrs; /* Pointer to node pointers */
- uint16_t nrec; /* Number of records in node */
- uint16_t depth; /* Depth of this node in the B-tree */
+ H5B2_hdr_t * hdr; /* Pointer to the [pinned] v2 B-tree header */
+ uint8_t * int_native; /* Pointer to native records */
+ H5B2_node_ptr_t *node_ptrs; /* Pointer to node pointers */
+ uint16_t nrec; /* Number of records in node */
+ uint16_t depth; /* Depth of this node in the B-tree */
/* SWMR / Flush dependency information (not stored) */
- H5AC_proxy_entry_t *top_proxy; /* 'Top' proxy cache entry for all B-tree entries */
- void *parent; /* Flush dependency parent for internal node */
- uint64_t shadow_epoch; /* Epoch of node, for making shadow copies */
+ H5AC_proxy_entry_t *top_proxy; /* 'Top' proxy cache entry for all B-tree entries */
+ void * parent; /* Flush dependency parent for internal node */
+ uint64_t shadow_epoch; /* Epoch of node, for making shadow copies */
} H5B2_internal_t;
/* v2 B-tree */
struct H5B2_t {
- H5B2_hdr_t *hdr; /* Pointer to internal v2 B-tree header info */
- H5F_t *f; /* Pointer to file for v2 B-tree */
+ H5B2_hdr_t *hdr; /* Pointer to internal v2 B-tree header info */
+ H5F_t * f; /* Pointer to file for v2 B-tree */
};
/* Node position, for min/max determination */
typedef enum H5B2_nodepos_t {
- H5B2_POS_ROOT, /* Node is root (i.e. both right & left-most in tree) */
- H5B2_POS_RIGHT, /* Node is right-most in tree, at a given depth */
- H5B2_POS_LEFT, /* Node is left-most in tree, at a given depth */
- H5B2_POS_MIDDLE /* Node is neither right or left-most in tree */
+ H5B2_POS_ROOT, /* Node is root (i.e. both right & left-most in tree) */
+ H5B2_POS_RIGHT, /* Node is right-most in tree, at a given depth */
+ H5B2_POS_LEFT, /* Node is left-most in tree, at a given depth */
+ H5B2_POS_MIDDLE /* Node is neither right or left-most in tree */
} H5B2_nodepos_t;
/* Update status */
typedef enum H5B2_update_status_t {
- H5B2_UPDATE_UNKNOWN, /* Unknown update status (initial state) */
- H5B2_UPDATE_MODIFY_DONE, /* Update successfully modified existing record */
- H5B2_UPDATE_SHADOW_DONE, /* Update modified existing record and modified node was shadowed */
- H5B2_UPDATE_INSERT_DONE, /* Update inserted record successfully */
- H5B2_UPDATE_INSERT_CHILD_FULL /* Update will insert record, but child is full */
+ H5B2_UPDATE_UNKNOWN, /* Unknown update status (initial state) */
+ H5B2_UPDATE_MODIFY_DONE, /* Update successfully modified existing record */
+ H5B2_UPDATE_SHADOW_DONE, /* Update modified existing record and modified node was shadowed */
+ H5B2_UPDATE_INSERT_DONE, /* Update inserted record successfully */
+ H5B2_UPDATE_INSERT_CHILD_FULL /* Update will insert record, but child is full */
} H5B2_update_status_t;
/* Callback info for loading a v2 B-tree header into the cache */
typedef struct H5B2_hdr_cache_ud_t {
- H5F_t *f; /* File that v2 b-tree header is within */
- haddr_t addr; /* Address of B-tree header in the file */
- void *ctx_udata; /* User-data for protecting */
+ H5F_t * f; /* File that v2 b-tree header is within */
+ haddr_t addr; /* Address of B-tree header in the file */
+ void * ctx_udata; /* User-data for protecting */
} H5B2_hdr_cache_ud_t;
/* Callback info for loading a v2 B-tree internal node into the cache */
typedef struct H5B2_internal_cache_ud_t {
- H5F_t *f; /* File that v2 b-tree header is within */
- H5B2_hdr_t *hdr; /* v2 B-tree header */
- void *parent; /* Flush dependency parent */
- uint16_t nrec; /* Number of records in node to load */
- uint16_t depth; /* Depth of node to load */
+ H5F_t * f; /* File that v2 b-tree header is within */
+ H5B2_hdr_t *hdr; /* v2 B-tree header */
+ void * parent; /* Flush dependency parent */
+ uint16_t nrec; /* Number of records in node to load */
+ uint16_t depth; /* Depth of node to load */
} H5B2_internal_cache_ud_t;
/* Callback info for loading a v2 B-tree leaf node into the cache */
typedef struct H5B2_leaf_cache_ud_t {
- H5F_t *f; /* File that v2 b-tree header is within */
- H5B2_hdr_t *hdr; /* v2 B-tree header */
- void *parent; /* Flush dependency parent */
- uint16_t nrec; /* Number of records in node to load */
+ H5F_t * f; /* File that v2 b-tree header is within */
+ H5B2_hdr_t *hdr; /* v2 B-tree header */
+ void * parent; /* Flush dependency parent */
+ uint16_t nrec; /* Number of records in node to load */
} H5B2_leaf_cache_ud_t;
#ifdef H5B2_TESTING
/* Node information for testing */
typedef struct H5B2_node_info_test_t {
- uint16_t depth; /* Depth of node */
- uint16_t nrec; /* Number of records in node */
+ uint16_t depth; /* Depth of node */
+ uint16_t nrec; /* Number of records in node */
} H5B2_node_info_test_t;
#endif /* H5B2_TESTING */
-
/*****************************/
/* Package Private Variables */
/*****************************/
@@ -318,73 +307,65 @@ H5_DLLVAR const H5B2_class_t H5B2_TEST2[1];
/* B-tree record for testing H5B2_TEST2 class */
typedef struct H5B2_test_rec_t {
- hsize_t key; /* Key for record */
- hsize_t val; /* Value for record */
+ hsize_t key; /* Key for record */
+ hsize_t val; /* Value for record */
} H5B2_test_rec_t;
#endif /* H5B2_TESTING */
/* Array of v2 B-tree client ID -> client class mappings */
extern const H5B2_class_t *const H5B2_client_class_g[H5B2_NUM_BTREE_ID];
-
/******************************/
/* Package Private Prototypes */
/******************************/
/* Generic routines */
-H5_DLL herr_t H5B2__create_flush_depend(H5AC_info_t *parent_entry,
- H5AC_info_t *child_entry);
-H5_DLL herr_t H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth,
- const H5B2_node_ptr_t *node_ptr, void *old_parent, void *new_parent);
-H5_DLL herr_t H5B2__destroy_flush_depend(H5AC_info_t *parent_entry,
- H5AC_info_t *child_entry);
+H5_DLL herr_t H5B2__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry);
+H5_DLL herr_t H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t *node_ptr,
+ void *old_parent, void *new_parent);
+H5_DLL herr_t H5B2__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry);
/* Internal node management routines */
H5_DLL herr_t H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
- unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal,
- unsigned *internal_flags_ptr, unsigned idx);
-H5_DLL herr_t H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth,
- H5B2_internal_t *internal, unsigned idx);
-H5_DLL herr_t H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth,
- H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx);
+ unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal,
+ unsigned *internal_flags_ptr, unsigned idx);
+H5_DLL herr_t H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned idx);
+H5_DLL herr_t H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
+ unsigned *internal_flags_ptr, unsigned idx);
H5_DLL herr_t H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
- unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal,
- unsigned *internal_flags_ptr, unsigned idx);
+ unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal,
+ unsigned *internal_flags_ptr, unsigned idx);
H5_DLL herr_t H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
- unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal,
- unsigned *internal_flags_ptr, unsigned idx);
+ unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal,
+ unsigned *internal_flags_ptr, unsigned idx);
/* Routines for managing B-tree header info */
H5_DLL H5B2_hdr_t *H5B2__hdr_alloc(H5F_t *f);
-H5_DLL haddr_t H5B2__hdr_create(H5F_t *f, const H5B2_create_t *cparam, void *ctx_udata);
-H5_DLL herr_t H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam,
- void *ctx_udata, uint16_t depth);
+H5_DLL haddr_t H5B2__hdr_create(H5F_t *f, const H5B2_create_t *cparam, void *ctx_udata);
+H5_DLL herr_t H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, uint16_t depth);
H5_DLL herr_t H5B2__hdr_incr(H5B2_hdr_t *hdr);
H5_DLL herr_t H5B2__hdr_decr(H5B2_hdr_t *hdr);
H5_DLL herr_t H5B2__hdr_fuse_incr(H5B2_hdr_t *hdr);
H5_DLL size_t H5B2__hdr_fuse_decr(H5B2_hdr_t *hdr);
H5_DLL herr_t H5B2__hdr_dirty(H5B2_hdr_t *hdr);
-H5_DLL H5B2_hdr_t *H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr,
- void *ctx_udata, unsigned flags);
-H5_DLL herr_t H5B2__hdr_unprotect(H5B2_hdr_t *hdr, unsigned cache_flags);
-H5_DLL herr_t H5B2__hdr_delete(H5B2_hdr_t *hdr);
+H5_DLL H5B2_hdr_t *H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, unsigned flags);
+H5_DLL herr_t H5B2__hdr_unprotect(H5B2_hdr_t *hdr, unsigned cache_flags);
+H5_DLL herr_t H5B2__hdr_delete(H5B2_hdr_t *hdr);
/* Routines for operating on leaf nodes */
-H5_DLL H5B2_leaf_t * H5B2__protect_leaf(H5B2_hdr_t *hdr, void *parent,
- H5B2_node_ptr_t *node_ptr, hbool_t shadow, unsigned flags);
-H5_DLL herr_t H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
- unsigned *internal_flags_ptr, unsigned idx, void *swap_loc);
+H5_DLL H5B2_leaf_t *H5B2__protect_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr,
+ hbool_t shadow, unsigned flags);
+H5_DLL herr_t H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal,
+ unsigned *internal_flags_ptr, unsigned idx, void *swap_loc);
/* Routines for operating on internal nodes */
-H5_DLL H5B2_internal_t *H5B2__protect_internal(H5B2_hdr_t *hdr, void *parent,
- H5B2_node_ptr_t *node_ptr, uint16_t depth, hbool_t shadow, unsigned flags);
+H5_DLL H5B2_internal_t *H5B2__protect_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr,
+ uint16_t depth, hbool_t shadow, unsigned flags);
/* Routines for allocating nodes */
H5_DLL herr_t H5B2__split_root(H5B2_hdr_t *hdr);
-H5_DLL herr_t H5B2__create_leaf(H5B2_hdr_t *hdr, void *parent,
- H5B2_node_ptr_t *node_ptr);
-H5_DLL herr_t H5B2__create_internal(H5B2_hdr_t *hdr, void *parent,
- H5B2_node_ptr_t *node_ptr, uint16_t depth);
+H5_DLL herr_t H5B2__create_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr);
+H5_DLL herr_t H5B2__create_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, uint16_t depth);
/* Routines for releasing structures */
H5_DLL herr_t H5B2__hdr_free(H5B2_hdr_t *hdr);
@@ -393,74 +374,74 @@ H5_DLL herr_t H5B2__internal_free(H5B2_internal_t *i);
/* Routines for inserting records */
H5_DLL herr_t H5B2__insert(H5B2_hdr_t *hdr, void *udata);
-H5_DLL herr_t H5B2__insert_internal(H5B2_hdr_t *hdr, uint16_t depth,
- unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr,
- H5B2_nodepos_t curr_pos, void *parent, void *udata);
-H5_DLL herr_t H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
- H5B2_nodepos_t curr_pos, void *parent, void *udata);
+H5_DLL herr_t H5B2__insert_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_info_flags_ptr,
+ H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *parent,
+ void *udata);
+H5_DLL herr_t H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos,
+ void *parent, void *udata);
/* Routines for update records */
-H5_DLL herr_t H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth,
- unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr,
- H5B2_update_status_t *status, H5B2_nodepos_t curr_pos, void *parent,
- void *udata, H5B2_modify_t op, void *op_data);
-H5_DLL herr_t H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
- H5B2_update_status_t *status, H5B2_nodepos_t curr_pos, void *parent,
- void *udata, H5B2_modify_t op, void *op_data);
+H5_DLL herr_t H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_info_flags_ptr,
+ H5B2_node_ptr_t *curr_node_ptr, H5B2_update_status_t *status,
+ H5B2_nodepos_t curr_pos, void *parent, void *udata, H5B2_modify_t op,
+ void *op_data);
+H5_DLL herr_t H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_update_status_t *status,
+ H5B2_nodepos_t curr_pos, void *parent, void *udata, H5B2_modify_t op,
+ void *op_data);
/* Routines for iterating over nodes/records */
-H5_DLL herr_t H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth,
- const H5B2_node_ptr_t *curr_node, void *parent, H5B2_operator_t op, void *op_data);
-H5_DLL herr_t H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth,
- const H5B2_node_ptr_t *curr_node, void *parent, hsize_t *op_data);
+H5_DLL herr_t H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node,
+ void *parent, H5B2_operator_t op, void *op_data);
+H5_DLL herr_t H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent,
+ hsize_t *op_data);
/* Routines for locating records */
-H5_DLL herr_t H5B2__locate_record(const H5B2_class_t *type, unsigned nrec,
- size_t *rec_off, const uint8_t *native, const void *udata, unsigned *idx, int *result);
-H5_DLL herr_t H5B2__neighbor_internal(H5B2_hdr_t *hdr, uint16_t depth,
- H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc, H5B2_compare_t comp,
- void *parent, void *udata, H5B2_found_t op, void *op_data);
-H5_DLL herr_t H5B2__neighbor_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
- void *neighbor_loc, H5B2_compare_t comp, void *parent, void *udata,
- H5B2_found_t op, void *op_data);
+H5_DLL herr_t H5B2__locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off,
+ const uint8_t *native, const void *udata, unsigned *idx, int *result);
+H5_DLL herr_t H5B2__neighbor_internal(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr,
+ void *neighbor_loc, H5B2_compare_t comp, void *parent, void *udata,
+ H5B2_found_t op, void *op_data);
+H5_DLL herr_t H5B2__neighbor_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc,
+ H5B2_compare_t comp, void *parent, void *udata, H5B2_found_t op,
+ void *op_data);
/* Routines for removing records */
-H5_DLL herr_t H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased,
- void *swap_loc, void *swap_parent, uint16_t depth, H5AC_info_t *parent_cache_info,
- unsigned *parent_cache_info_flags_ptr, H5B2_nodepos_t curr_pos,
- H5B2_node_ptr_t *curr_node_ptr, void *udata, H5B2_remove_t op,
- void *op_data);
-H5_DLL herr_t H5B2__remove_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
- H5B2_nodepos_t curr_pos, void *parent, void *udata, H5B2_remove_t op,
- void *op_data);
-H5_DLL herr_t H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr,
- hbool_t *depth_decreased, void *swap_loc, void *swap_parent, uint16_t depth,
- H5AC_info_t *parent_cache_info, unsigned *parent_cache_info_flags_ptr,
- H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, hsize_t n,
- H5B2_remove_t op, void *op_data);
+H5_DLL herr_t H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *swap_loc,
+ void *swap_parent, uint16_t depth, H5AC_info_t *parent_cache_info,
+ unsigned *parent_cache_info_flags_ptr, H5B2_nodepos_t curr_pos,
+ H5B2_node_ptr_t *curr_node_ptr, void *udata, H5B2_remove_t op,
+ void *op_data);
+H5_DLL herr_t H5B2__remove_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos,
+ void *parent, void *udata, H5B2_remove_t op, void *op_data);
+H5_DLL herr_t H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *swap_loc,
+ void *swap_parent, uint16_t depth, H5AC_info_t *parent_cache_info,
+ unsigned * parent_cache_info_flags_ptr,
+ H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, hsize_t n,
+ H5B2_remove_t op, void *op_data);
H5_DLL herr_t H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
- H5B2_nodepos_t curr_pos, void *parent, unsigned idx, H5B2_remove_t op,
- void *op_data);
+ H5B2_nodepos_t curr_pos, void *parent, unsigned idx, H5B2_remove_t op,
+ void *op_data);
/* Routines for deleting nodes */
-H5_DLL herr_t H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth,
- const H5B2_node_ptr_t *curr_node, void *parent, H5B2_remove_t op,
- void *op_data);
+H5_DLL herr_t H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node,
+ void *parent, H5B2_remove_t op, void *op_data);
/* Debugging routines for dumping file structures */
-H5_DLL herr_t H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent,
- int fwidth, const H5B2_class_t *type, haddr_t obj_addr);
-H5_DLL herr_t H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent,
- int fwidth, const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, unsigned depth,
- haddr_t obj_addr);
-H5_DLL herr_t H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent,
- int fwidth, const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, haddr_t obj_addr);
+H5_DLL herr_t H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
+ const H5B2_class_t *type, haddr_t obj_addr);
+H5_DLL herr_t H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
+ const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, unsigned depth,
+ haddr_t obj_addr);
+H5_DLL herr_t H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
+ const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, haddr_t obj_addr);
/* Sanity checking routines */
#ifdef H5B2_DEBUG
/* Don't label these with H5_ATTR_PURE or you'll get even more warnings... */
-H5_DLL herr_t H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal);
-H5_DLL herr_t H5B2__assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2);
+H5_DLL herr_t H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr,
+ const H5B2_internal_t *internal);
+H5_DLL herr_t H5B2__assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr,
+ const H5B2_internal_t *internal, const H5B2_internal_t *internal2);
H5_DLL herr_t H5B2__assert_leaf(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf);
H5_DLL herr_t H5B2__assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, const H5B2_leaf_t *leaf2);
#endif /* H5B2_DEBUG */
@@ -468,10 +449,8 @@ H5_DLL herr_t H5B2__assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf,
/* Testing routines */
#ifdef H5B2_TESTING
H5_DLL herr_t H5B2__get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr);
-H5_DLL int H5B2__get_node_depth_test(H5B2_t *bt2, void *udata);
-H5_DLL herr_t H5B2__get_node_info_test(H5B2_t *bt2, void *udata,
- H5B2_node_info_test_t *ninfo);
+H5_DLL int H5B2__get_node_depth_test(H5B2_t *bt2, void *udata);
+H5_DLL herr_t H5B2__get_node_info_test(H5B2_t *bt2, void *udata, H5B2_node_info_test_t *ninfo);
#endif /* H5B2_TESTING */
#endif /* _H5B2pkg_H */
-
diff --git a/src/H5B2private.h b/src/H5B2private.h
index 9303d4f..e511897 100644
--- a/src/H5B2private.h
+++ b/src/H5B2private.h
@@ -26,34 +26,38 @@
#define _H5B2private_H
/* Private headers needed by this file */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Fprivate.h" /* File access */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Fprivate.h" /* File access */
/**************************/
/* Library Private Macros */
/**************************/
-
/****************************/
/* Library Private Typedefs */
/****************************/
/* B-tree IDs for various internal things. */
typedef enum H5B2_subid_t {
- H5B2_TEST_ID = 0, /* B-tree is for testing (do not use for actual data) */
- H5B2_FHEAP_HUGE_INDIR_ID, /* B-tree is for fractal heap indirectly accessed, non-filtered 'huge' objects */
- H5B2_FHEAP_HUGE_FILT_INDIR_ID, /* B-tree is for fractal heap indirectly accessed, filtered 'huge' objects */
- H5B2_FHEAP_HUGE_DIR_ID, /* B-tree is for fractal heap directly accessed, non-filtered 'huge' objects */
+ H5B2_TEST_ID = 0, /* B-tree is for testing (do not use for actual data) */
+ H5B2_FHEAP_HUGE_INDIR_ID, /* B-tree is for fractal heap indirectly accessed, non-filtered 'huge' objects
+ */
+ H5B2_FHEAP_HUGE_FILT_INDIR_ID, /* B-tree is for fractal heap indirectly accessed, filtered 'huge' objects
+ */
+ H5B2_FHEAP_HUGE_DIR_ID, /* B-tree is for fractal heap directly accessed, non-filtered 'huge' objects */
H5B2_FHEAP_HUGE_FILT_DIR_ID, /* B-tree is for fractal heap directly accessed, filtered 'huge' objects */
- H5B2_GRP_DENSE_NAME_ID, /* B-tree is for indexing 'name' field for "dense" link storage in groups */
- H5B2_GRP_DENSE_CORDER_ID, /* B-tree is for indexing 'creation order' field for "dense" link storage in groups */
- H5B2_SOHM_INDEX_ID, /* B-tree is an index for shared object header messages */
- H5B2_ATTR_DENSE_NAME_ID, /* B-tree is for indexing 'name' field for "dense" attribute storage on objects */
- H5B2_ATTR_DENSE_CORDER_ID, /* B-tree is for indexing 'creation order' field for "dense" attribute storage on objects */
- H5B2_CDSET_ID, /* B-tree is for non-filtered chunked dataset storage w/ >1 unlim dims */
- H5B2_CDSET_FILT_ID, /* B-tree is for filtered chunked dataset storage w/ >1 unlim dims */
- H5B2_TEST2_ID, /* Another B-tree is for testing (do not use for actual data) */
- H5B2_NUM_BTREE_ID /* Number of B-tree IDs (must be last) */
+ H5B2_GRP_DENSE_NAME_ID, /* B-tree is for indexing 'name' field for "dense" link storage in groups */
+ H5B2_GRP_DENSE_CORDER_ID, /* B-tree is for indexing 'creation order' field for "dense" link storage in
+ groups */
+ H5B2_SOHM_INDEX_ID, /* B-tree is an index for shared object header messages */
+ H5B2_ATTR_DENSE_NAME_ID, /* B-tree is for indexing 'name' field for "dense" attribute storage on objects
+ */
+ H5B2_ATTR_DENSE_CORDER_ID, /* B-tree is for indexing 'creation order' field for "dense" attribute storage
+ on objects */
+ H5B2_CDSET_ID, /* B-tree is for non-filtered chunked dataset storage w/ >1 unlim dims */
+ H5B2_CDSET_FILT_ID, /* B-tree is for filtered chunked dataset storage w/ >1 unlim dims */
+ H5B2_TEST2_ID, /* Another B-tree is for testing (do not use for actual data) */
+ H5B2_NUM_BTREE_ID /* Number of B-tree IDs (must be last) */
} H5B2_subid_t;
/* Define the operator callback function pointer for H5B2_iterate() */
@@ -70,8 +74,8 @@ typedef herr_t (*H5B2_remove_t)(const void *record, void *op_data);
/* Comparisons for H5B2_neighbor() call */
typedef enum H5B2_compare_t {
- H5B2_COMPARE_LESS, /* Records with keys less than query value */
- H5B2_COMPARE_GREATER /* Records with keys greater than query value */
+ H5B2_COMPARE_LESS, /* Records with keys less than query value */
+ H5B2_COMPARE_GREATER /* Records with keys greater than query value */
} H5B2_compare_t;
/*
@@ -80,77 +84,69 @@ typedef enum H5B2_compare_t {
*/
typedef struct H5B2_class_t H5B2_class_t;
struct H5B2_class_t {
- H5B2_subid_t id; /* ID of B-tree class, as found in file */
- const char *name; /* Name of B-tree class, for debugging */
- size_t nrec_size; /* Size of native (memory) record */
+ H5B2_subid_t id; /* ID of B-tree class, as found in file */
+ const char * name; /* Name of B-tree class, for debugging */
+ size_t nrec_size; /* Size of native (memory) record */
/* Extensible array client callback methods */
- void *(*crt_context)(void *udata); /* Create context for other client callbacks */
- herr_t (*dst_context)(void *ctx); /* Destroy client callback context */
- herr_t (*store)(void *nrecord, const void *udata); /* Store application record in native record table */
+ void *(*crt_context)(void *udata); /* Create context for other client callbacks */
+ herr_t (*dst_context)(void *ctx); /* Destroy client callback context */
+ herr_t (*store)(void *nrecord, const void *udata); /* Store application record in native record table */
herr_t (*compare)(const void *rec1, const void *rec2, int *result); /* Compare two native records */
- herr_t (*encode)(uint8_t *raw, const void *record, void *ctx); /* Encode record from native form to disk storage form */
- herr_t (*decode)(const uint8_t *raw, void *record, void *ctx); /* Decode record from disk storage form to native form */
- herr_t (*debug)(FILE *stream, int indent, int fwidth, /* Print a record for debugging */
- const void *record, const void *ctx);
+ herr_t (*encode)(uint8_t *raw, const void *record,
+ void *ctx); /* Encode record from native form to disk storage form */
+ herr_t (*decode)(const uint8_t *raw, void *record,
+ void *ctx); /* Decode record from disk storage form to native form */
+ herr_t (*debug)(FILE *stream, int indent, int fwidth, /* Print a record for debugging */
+ const void *record, const void *ctx);
};
/* v2 B-tree creation parameters */
typedef struct H5B2_create_t {
- const H5B2_class_t *cls; /* v2 B-tree client class */
- uint32_t node_size; /* Size of each node (in bytes) */
- uint32_t rrec_size; /* Size of raw record (in bytes) */
- uint8_t split_percent; /* % full to split nodes */
- uint8_t merge_percent; /* % full to merge nodes */
+ const H5B2_class_t *cls; /* v2 B-tree client class */
+ uint32_t node_size; /* Size of each node (in bytes) */
+ uint32_t rrec_size; /* Size of raw record (in bytes) */
+ uint8_t split_percent; /* % full to split nodes */
+ uint8_t merge_percent; /* % full to merge nodes */
} H5B2_create_t;
/* v2 B-tree metadata statistics info */
typedef struct H5B2_stat_t {
- unsigned depth; /* Depth of B-tree */
- hsize_t nrecords; /* Number of records */
+ unsigned depth; /* Depth of B-tree */
+ hsize_t nrecords; /* Number of records */
} H5B2_stat_t;
/* v2 B-tree info (forward decl - defined in H5B2pkg.h) */
typedef struct H5B2_t H5B2_t;
-
/*****************************/
/* Library-private Variables */
/*****************************/
-
/***************************************/
/* Library-private Function Prototypes */
/***************************************/
-H5_DLL H5B2_t *H5B2_create(H5F_t *f, const H5B2_create_t *cparam,
- void *ctx_udata);
+H5_DLL H5B2_t *H5B2_create(H5F_t *f, const H5B2_create_t *cparam, void *ctx_udata);
H5_DLL H5B2_t *H5B2_open(H5F_t *f, haddr_t addr, void *ctx_udata);
-H5_DLL herr_t H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr/*out*/);
-H5_DLL herr_t H5B2_insert(H5B2_t *bt2, void *udata);
-H5_DLL herr_t H5B2_iterate(H5B2_t *bt2, H5B2_operator_t op, void *op_data);
-H5_DLL htri_t H5B2_find(H5B2_t *bt2, void *udata, H5B2_found_t op, void *op_data);
-H5_DLL herr_t H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx,
- H5B2_found_t op, void *op_data);
-H5_DLL herr_t H5B2_neighbor(H5B2_t *bt2, H5B2_compare_t range, void *udata,
- H5B2_found_t op, void *op_data);
-H5_DLL herr_t H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op,
- void *op_data);
-H5_DLL herr_t H5B2_update(H5B2_t *bt2, void *udata, H5B2_modify_t op,
- void *op_data);
-H5_DLL herr_t H5B2_remove(H5B2_t *b2, void *udata, H5B2_remove_t op,
- void *op_data);
-H5_DLL herr_t H5B2_remove_by_idx(H5B2_t *bt2, H5_iter_order_t order,
- hsize_t idx, H5B2_remove_t op, void *op_data);
-H5_DLL herr_t H5B2_get_nrec(const H5B2_t *bt2, hsize_t *nrec);
-H5_DLL herr_t H5B2_size(H5B2_t *bt2, hsize_t *btree_size);
-H5_DLL herr_t H5B2_close(H5B2_t *bt2);
-H5_DLL herr_t H5B2_delete(H5F_t *f, haddr_t addr, void *ctx_udata,
- H5B2_remove_t op, void *op_data);
-H5_DLL herr_t H5B2_depend(H5B2_t *bt2, H5AC_proxy_entry_t *parent);
-H5_DLL herr_t H5B2_patch_file(H5B2_t *fa, H5F_t *f);
+H5_DLL herr_t H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr /*out*/);
+H5_DLL herr_t H5B2_insert(H5B2_t *bt2, void *udata);
+H5_DLL herr_t H5B2_iterate(H5B2_t *bt2, H5B2_operator_t op, void *op_data);
+H5_DLL htri_t H5B2_find(H5B2_t *bt2, void *udata, H5B2_found_t op, void *op_data);
+H5_DLL herr_t H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op, void *op_data);
+H5_DLL herr_t H5B2_neighbor(H5B2_t *bt2, H5B2_compare_t range, void *udata, H5B2_found_t op, void *op_data);
+H5_DLL herr_t H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data);
+H5_DLL herr_t H5B2_update(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data);
+H5_DLL herr_t H5B2_remove(H5B2_t *b2, void *udata, H5B2_remove_t op, void *op_data);
+H5_DLL herr_t H5B2_remove_by_idx(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_remove_t op,
+ void *op_data);
+H5_DLL herr_t H5B2_get_nrec(const H5B2_t *bt2, hsize_t *nrec);
+H5_DLL herr_t H5B2_size(H5B2_t *bt2, hsize_t *btree_size);
+H5_DLL herr_t H5B2_close(H5B2_t *bt2);
+H5_DLL herr_t H5B2_delete(H5F_t *f, haddr_t addr, void *ctx_udata, H5B2_remove_t op, void *op_data);
+H5_DLL herr_t H5B2_depend(H5B2_t *bt2, H5AC_proxy_entry_t *parent);
+H5_DLL herr_t H5B2_patch_file(H5B2_t *fa, H5F_t *f);
/* Statistics routines */
H5_DLL herr_t H5B2_stat_info(H5B2_t *bt2, H5B2_stat_t *info);
#endif /* _H5B2private_H */
-
diff --git a/src/H5B2stat.c b/src/H5B2stat.c
index 5c09b3d..b362984 100644
--- a/src/H5B2stat.c
+++ b/src/H5B2stat.c
@@ -22,52 +22,43 @@
/* Module Setup */
/****************/
-#include "H5B2module.h" /* This source code file is part of the H5B2 module */
-
+#include "H5B2module.h" /* This source code file is part of the H5B2 module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5B2pkg.h" /* v2 B-trees */
-#include "H5Eprivate.h" /* Error handling */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5B2pkg.h" /* v2 B-trees */
+#include "H5Eprivate.h" /* Error handling */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
/*-------------------------------------------------------------------------
* Function: H5B2_stat_info
*
@@ -89,13 +80,12 @@ H5B2_stat_info(H5B2_t *bt2, H5B2_stat_t *info)
HDassert(info);
/* Get information about the B-tree */
- info->depth = bt2->hdr->depth;
+ info->depth = bt2->hdr->depth;
info->nrecords = bt2->hdr->root.all_nrec;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2_stat_info() */
-
/*-------------------------------------------------------------------------
* Function: H5B2_size
*
@@ -112,8 +102,8 @@ H5B2_stat_info(H5B2_t *bt2, H5B2_stat_t *info)
herr_t
H5B2_size(H5B2_t *bt2, hsize_t *btree_size)
{
- H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -131,17 +121,16 @@ H5B2_size(H5B2_t *bt2, hsize_t *btree_size)
*btree_size += hdr->hdr_size;
/* Iterate through records */
- if(hdr->root.node_nrec > 0) {
+ if (hdr->root.node_nrec > 0) {
/* Check for root node being a leaf */
- if(hdr->depth == 0)
+ if (hdr->depth == 0)
*btree_size += hdr->node_size;
else
/* Iterate through nodes */
- if(H5B2__node_size(hdr, hdr->depth, &hdr->root, hdr, btree_size) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed")
+ if (H5B2__node_size(hdr, hdr->depth, &hdr->root, hdr, btree_size) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed")
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_size() */
-
diff --git a/src/H5B2test.c b/src/H5B2test.c
index faa81f0..9f9d012 100644
--- a/src/H5B2test.c
+++ b/src/H5B2test.c
@@ -18,113 +18,102 @@
*
*/
-
/****************/
/* Module Setup */
/****************/
-#include "H5B2module.h" /* This source code file is part of the H5B2 module */
-#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/
-
+#include "H5B2module.h" /* This source code file is part of the H5B2 module */
+#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5B2pkg.h" /* v2 B-trees */
-#include "H5Eprivate.h" /* Error handling */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5B2pkg.h" /* v2 B-trees */
+#include "H5Eprivate.h" /* Error handling */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
/* v2 B-tree client callback context */
typedef struct H5B2_test_ctx_t {
- uint8_t sizeof_size; /* Size of file sizes */
+ uint8_t sizeof_size; /* Size of file sizes */
} H5B2_test_ctx_t;
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
/* v2 B-tree driver callbacks for 'test' B-trees */
-static void *H5B2__test_crt_context(void *udata);
+static void * H5B2__test_crt_context(void *udata);
static herr_t H5B2__test_dst_context(void *ctx);
static herr_t H5B2__test_store(void *nrecord, const void *udata);
static herr_t H5B2__test_compare(const void *rec1, const void *rec2, int *result);
static herr_t H5B2__test_encode(uint8_t *raw, const void *nrecord, void *ctx);
static herr_t H5B2__test_decode(const uint8_t *raw, void *nrecord, void *ctx);
-static herr_t H5B2__test_debug(FILE *stream, int indent, int fwidth,
- const void *record, const void *_udata);
+static herr_t H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record, const void *_udata);
/* v2 B-tree driver callbacks for 'test2' B-trees */
static herr_t H5B2__test2_store(void *nrecord, const void *udata);
static herr_t H5B2__test2_compare(const void *rec1, const void *rec2, int *result);
static herr_t H5B2__test2_encode(uint8_t *raw, const void *nrecord, void *ctx);
static herr_t H5B2__test2_decode(const uint8_t *raw, void *nrecord, void *ctx);
-static herr_t H5B2__test2_debug(FILE *stream, int indent, int fwidth,
- const void *record, const void *_udata);
-
+static herr_t H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record, const void *_udata);
/*********************/
/* Package Variables */
/*********************/
/* Class structure for testing simple B-tree records */
-const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */
- H5B2_TEST_ID, /* Type of B-tree */
- "H5B2_TEST_ID", /* Name of B-tree class */
- sizeof(hsize_t), /* Size of native record */
- H5B2__test_crt_context, /* Create client callback context */
- H5B2__test_dst_context, /* Destroy client callback context */
- H5B2__test_store, /* Record storage callback */
- H5B2__test_compare, /* Record comparison callback */
- H5B2__test_encode, /* Record encoding callback */
- H5B2__test_decode, /* Record decoding callback */
- H5B2__test_debug /* Record debugging callback */
+const H5B2_class_t H5B2_TEST[1] = {{
+ /* B-tree class information */
+ H5B2_TEST_ID, /* Type of B-tree */
+ "H5B2_TEST_ID", /* Name of B-tree class */
+ sizeof(hsize_t), /* Size of native record */
+ H5B2__test_crt_context, /* Create client callback context */
+ H5B2__test_dst_context, /* Destroy client callback context */
+ H5B2__test_store, /* Record storage callback */
+ H5B2__test_compare, /* Record comparison callback */
+ H5B2__test_encode, /* Record encoding callback */
+ H5B2__test_decode, /* Record decoding callback */
+ H5B2__test_debug /* Record debugging callback */
}};
/* Class structure for testing key/value B-tree records */
-const H5B2_class_t H5B2_TEST2[1]={{ /* B-tree class information */
- H5B2_TEST2_ID, /* Type of B-tree */
- "H5B2_TEST2_ID", /* Name of B-tree class */
- sizeof(H5B2_test_rec_t), /* Size of native record */
- H5B2__test_crt_context, /* Create client callback context */
- H5B2__test_dst_context, /* Destroy client callback context */
- H5B2__test2_store, /* Record storage callback */
- H5B2__test2_compare, /* Record comparison callback */
- H5B2__test2_encode, /* Record encoding callback */
- H5B2__test2_decode, /* Record decoding callback */
- H5B2__test2_debug /* Record debugging callback */
+const H5B2_class_t H5B2_TEST2[1] = {{
+ /* B-tree class information */
+ H5B2_TEST2_ID, /* Type of B-tree */
+ "H5B2_TEST2_ID", /* Name of B-tree class */
+ sizeof(H5B2_test_rec_t), /* Size of native record */
+ H5B2__test_crt_context, /* Create client callback context */
+ H5B2__test_dst_context, /* Destroy client callback context */
+ H5B2__test2_store, /* Record storage callback */
+ H5B2__test2_compare, /* Record comparison callback */
+ H5B2__test2_encode, /* Record encoding callback */
+ H5B2__test2_decode, /* Record decoding callback */
+ H5B2__test2_debug /* Record debugging callback */
}};
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
/* Declare a free list to manage the H5B2_test_ctx_t struct */
H5FL_DEFINE_STATIC(H5B2_test_ctx_t);
-
/*-------------------------------------------------------------------------
* Function: H5B2__test_crt_context
*
@@ -141,9 +130,9 @@ H5FL_DEFINE_STATIC(H5B2_test_ctx_t);
static void *
H5B2__test_crt_context(void *_f)
{
- H5F_t *f = (H5F_t *)_f; /* User data for building callback context */
- H5B2_test_ctx_t *ctx; /* Callback context structure */
- void *ret_value = NULL; /* Return value */
+ H5F_t * f = (H5F_t *)_f; /* User data for building callback context */
+ H5B2_test_ctx_t *ctx; /* Callback context structure */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -151,7 +140,7 @@ H5B2__test_crt_context(void *_f)
HDassert(f);
/* Allocate callback context */
- if(NULL == (ctx = H5FL_MALLOC(H5B2_test_ctx_t)))
+ if (NULL == (ctx = H5FL_MALLOC(H5B2_test_ctx_t)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate callback context")
/* Determine the size of lengths in the file */
@@ -164,7 +153,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__test_crt_context() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__test_dst_context
*
@@ -181,7 +169,7 @@ done:
static herr_t
H5B2__test_dst_context(void *_ctx)
{
- H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */
+ H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */
FUNC_ENTER_STATIC_NOERR
@@ -194,7 +182,6 @@ H5B2__test_dst_context(void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__test_dst_context() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__test_store
*
@@ -218,7 +205,6 @@ H5B2__test_store(void *nrecord, const void *udata)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__test_store() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__test_compare
*
@@ -243,7 +229,6 @@ H5B2__test_compare(const void *rec1, const void *rec2, int *result)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__test_compare() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__test_encode
*
@@ -260,7 +245,7 @@ H5B2__test_compare(const void *rec1, const void *rec2, int *result)
static herr_t
H5B2__test_encode(uint8_t *raw, const void *nrecord, void *_ctx)
{
- H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */
+ H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */
FUNC_ENTER_STATIC_NOERR
@@ -272,7 +257,6 @@ H5B2__test_encode(uint8_t *raw, const void *nrecord, void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__test_encode() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__test_decode
*
@@ -289,7 +273,7 @@ H5B2__test_encode(uint8_t *raw, const void *nrecord, void *_ctx)
static herr_t
H5B2__test_decode(const uint8_t *raw, void *nrecord, void *_ctx)
{
- H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */
+ H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */
FUNC_ENTER_STATIC_NOERR
@@ -301,7 +285,6 @@ H5B2__test_decode(const uint8_t *raw, void *nrecord, void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__test_decode() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__test_debug
*
@@ -316,20 +299,17 @@ H5B2__test_decode(const uint8_t *raw, void *nrecord, void *_ctx)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record,
- const void H5_ATTR_UNUSED *_udata)
+H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record, const void H5_ATTR_UNUSED *_udata)
{
FUNC_ENTER_STATIC_NOERR
HDassert(record);
- HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Record:",
- *(const hsize_t *)record);
+ HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Record:", *(const hsize_t *)record);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__test_debug() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__test2_store
*
@@ -353,7 +333,6 @@ H5B2__test2_store(void *nrecord, const void *udata)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__test2_store() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__test2_compare
*
@@ -378,7 +357,6 @@ H5B2__test2_compare(const void *rec1, const void *rec2, int *result)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__test2_compare() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__test2_encode
*
@@ -395,7 +373,7 @@ H5B2__test2_compare(const void *rec1, const void *rec2, int *result)
static herr_t
H5B2__test2_encode(uint8_t *raw, const void *nrecord, void *_ctx)
{
- H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */
+ H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */
FUNC_ENTER_STATIC_NOERR
@@ -408,7 +386,6 @@ H5B2__test2_encode(uint8_t *raw, const void *nrecord, void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__test2_encode() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__test2_decode
*
@@ -425,7 +402,7 @@ H5B2__test2_encode(uint8_t *raw, const void *nrecord, void *_ctx)
static herr_t
H5B2__test2_decode(const uint8_t *raw, void *nrecord, void *_ctx)
{
- H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */
+ H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */
FUNC_ENTER_STATIC_NOERR
@@ -438,7 +415,6 @@ H5B2__test2_decode(const uint8_t *raw, void *nrecord, void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__test2_decode() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__test2_debug
*
@@ -453,21 +429,18 @@ H5B2__test2_decode(const uint8_t *raw, void *nrecord, void *_ctx)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record,
- const void H5_ATTR_UNUSED *_udata)
+H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record, const void H5_ATTR_UNUSED *_udata)
{
FUNC_ENTER_STATIC_NOERR
HDassert(record);
- HDfprintf(stream, "%*s%-*s (%" PRIuHSIZE ", %" PRIuHSIZE ")\n", indent, "", fwidth, "Record:",
- ((const H5B2_test_rec_t *)record)->key,
- ((const H5B2_test_rec_t *)record)->val);
+ HDfprintf(stream, "%*s%-*s (%" PRIuHSIZE ", %" PRIuHSIZE ")\n", indent, "", fwidth,
+ "Record:", ((const H5B2_test_rec_t *)record)->key, ((const H5B2_test_rec_t *)record)->val);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__test2_debug() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__get_root_addr_test
*
@@ -495,7 +468,6 @@ H5B2__get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__get_root_addr_test() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__get_node_info_test
*
@@ -511,13 +483,13 @@ H5B2__get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr)
herr_t
H5B2__get_node_info_test(H5B2_t *bt2, void *udata, H5B2_node_info_test_t *ninfo)
{
- H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
- H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */
- void *parent = NULL; /* Parent of current node */
- uint16_t depth; /* Current depth of the tree */
- int cmp; /* Comparison value of records */
- unsigned idx; /* Location of record which matches key */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t * hdr; /* Pointer to the B-tree header */
+ H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */
+ void * parent = NULL; /* Parent of current node */
+ uint16_t depth; /* Current depth of the tree */
+ int cmp; /* Comparison value of records */
+ unsigned idx; /* Location of record which matches key */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -533,52 +505,54 @@ H5B2__get_node_info_test(H5B2_t *bt2, void *udata, H5B2_node_info_test_t *ninfo)
/* Make copy of the root node pointer to start search with */
curr_node_ptr = hdr->root;
- /* Set initial parent, if doing swmr writes */
- if(hdr->swmr_write)
+ /* Set initial parent, if doing swmr writes */
+ if (hdr->swmr_write)
parent = hdr;
/* Current depth of the tree */
depth = hdr->depth;
/* Check for empty tree */
- if(0 == curr_node_ptr.node_nrec)
+ if (0 == curr_node_ptr.node_nrec)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree has no records")
/* Walk down B-tree to find record or leaf node where record is located */
cmp = -1;
- while(depth > 0 && cmp != 0) {
- H5B2_internal_t *internal; /* Pointer to internal node in B-tree */
- H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
+ while (depth > 0 && cmp != 0) {
+ H5B2_internal_t *internal; /* Pointer to internal node in B-tree */
+ H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
/* Lock B-tree current node */
- if(NULL == (internal = H5B2__protect_internal(hdr, parent, &curr_node_ptr, depth, FALSE, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (internal = H5B2__protect_internal(hdr, parent, &curr_node_ptr, depth, FALSE,
+ H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Unpin parent if necessary */
- if(parent) {
- if(parent != hdr && H5AC_unpin_entry(parent) < 0)
+ if (parent) {
+ if (parent != hdr && H5AC_unpin_entry(parent) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry")
parent = NULL;
} /* end if */
/* Locate node pointer for child */
- if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native,
- udata, &idx, &cmp) < 0)
+ if (H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx,
+ &cmp) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
- if(cmp > 0)
+ if (cmp > 0)
idx++;
- if(cmp != 0) {
+ if (cmp != 0) {
/* Get node pointer for next node to search */
next_node_ptr = internal->node_ptrs[idx];
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal,
+ (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Keep track of parent if necessary */
- if(hdr->swmr_write)
+ if (hdr->swmr_write)
parent = internal;
/* Set pointer to next node to load */
@@ -586,12 +560,12 @@ H5B2__get_node_info_test(H5B2_t *bt2, void *udata, H5B2_node_info_test_t *ninfo)
} /* end if */
else {
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Fill in information about the node */
ninfo->depth = depth;
- ninfo->nrec = curr_node_ptr.node_nrec;
+ ninfo->nrec = curr_node_ptr.node_nrec;
/* Indicate success */
HGOTO_DONE(SUCCEED)
@@ -602,48 +576,46 @@ H5B2__get_node_info_test(H5B2_t *bt2, void *udata, H5B2_node_info_test_t *ninfo)
} /* end while */
{
- H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
+ H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
/* Lock B-tree leaf node */
- if(NULL == (leaf = H5B2__protect_leaf(hdr, parent, &curr_node_ptr, FALSE, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, &curr_node_ptr, FALSE, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node")
/* Unpin parent if necessary */
- if(parent) {
- if(parent != hdr && H5AC_unpin_entry(parent) < 0)
+ if (parent) {
+ if (parent != hdr && H5AC_unpin_entry(parent) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry")
parent = NULL;
} /* end if */
/* Locate record */
- if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native,
- udata, &idx, &cmp) < 0)
+ if (H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records")
/* Unlock current node */
- if(H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Indicate the depth that the record was found */
- if(cmp != 0)
+ if (cmp != 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record not in B-tree")
} /* end block */
/* Fill in information about the leaf node */
ninfo->depth = depth;
- ninfo->nrec = curr_node_ptr.node_nrec;
+ ninfo->nrec = curr_node_ptr.node_nrec;
done:
- if(parent) {
+ if (parent) {
HDassert(ret_value < 0);
- if(parent != hdr && H5AC_unpin_entry(parent) < 0)
+ if (parent != hdr && H5AC_unpin_entry(parent) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__get_node_info_test() */
-
/*-------------------------------------------------------------------------
* Function: H5B2__get_node_depth_test
*
@@ -664,8 +636,8 @@ done:
int
H5B2__get_node_depth_test(H5B2_t *bt2, void *udata)
{
- H5B2_node_info_test_t ninfo; /* Node information */
- int ret_value = -1; /* Return information */
+ H5B2_node_info_test_t ninfo; /* Node information */
+ int ret_value = -1; /* Return information */
FUNC_ENTER_PACKAGE
@@ -673,7 +645,7 @@ H5B2__get_node_depth_test(H5B2_t *bt2, void *udata)
HDassert(bt2);
/* Get information abou the node */
- if(H5B2__get_node_info_test(bt2, udata, &ninfo) < 0)
+ if (H5B2__get_node_info_test(bt2, udata, &ninfo) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, (-1), "error looking up node info")
/* Set return value */
@@ -682,4 +654,3 @@ H5B2__get_node_depth_test(H5B2_t *bt2, void *udata)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__get_node_depth_test() */
-
diff --git a/src/H5Bcache.c b/src/H5Bcache.c
index 80fb200..e5e29bd 100644
--- a/src/H5Bcache.c
+++ b/src/H5Bcache.c
@@ -26,70 +26,61 @@
/* Module Setup */
/****************/
-#include "H5Bmodule.h" /* This source code file is part of the H5B module */
-
+#include "H5Bmodule.h" /* This source code file is part of the H5B module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Bpkg.h" /* B-link trees */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Bpkg.h" /* B-link trees */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
/* Metadata cache callbacks */
static herr_t H5B__cache_get_initial_load_size(void *udata, size_t *image_len);
-static void *H5B__cache_deserialize(const void *image, size_t len, void *udata,
- hbool_t *dirty);
+static void * H5B__cache_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty);
static herr_t H5B__cache_image_len(const void *thing, size_t *image_len);
-static herr_t H5B__cache_serialize(const H5F_t *f, void *image, size_t len,
- void *thing);
+static herr_t H5B__cache_serialize(const H5F_t *f, void *image, size_t len, void *thing);
static herr_t H5B__cache_free_icr(void *thing);
-
/*********************/
/* Package Variables */
/*********************/
/* H5B inherits cache-like properties from H5AC */
const H5AC_class_t H5AC_BT[1] = {{
- H5AC_BT_ID, /* Metadata client ID */
- "v1 B-tree", /* Metadata client name (for debugging) */
- H5FD_MEM_BTREE, /* File space memory type for client */
- H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
- H5B__cache_get_initial_load_size, /* 'get_initial_load_size' callback */
- NULL, /* 'get_final_load_size' callback */
- NULL, /* 'verify_chksum' callback */
- H5B__cache_deserialize, /* 'deserialize' callback */
- H5B__cache_image_len, /* 'image_len' callback */
- NULL, /* 'pre_serialize' callback */
- H5B__cache_serialize, /* 'serialize' callback */
- NULL, /* 'notify' callback */
- H5B__cache_free_icr, /* 'free_icr' callback */
- NULL, /* 'fsf_size' callback */
+ H5AC_BT_ID, /* Metadata client ID */
+ "v1 B-tree", /* Metadata client name (for debugging) */
+ H5FD_MEM_BTREE, /* File space memory type for client */
+ H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
+ H5B__cache_get_initial_load_size, /* 'get_initial_load_size' callback */
+ NULL, /* 'get_final_load_size' callback */
+ NULL, /* 'verify_chksum' callback */
+ H5B__cache_deserialize, /* 'deserialize' callback */
+ H5B__cache_image_len, /* 'image_len' callback */
+ NULL, /* 'pre_serialize' callback */
+ H5B__cache_serialize, /* 'serialize' callback */
+ NULL, /* 'notify' callback */
+ H5B__cache_free_icr, /* 'free_icr' callback */
+ NULL, /* 'fsf_size' callback */
}};
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5B__cache_get_initial_load_size
*
@@ -105,8 +96,8 @@ const H5AC_class_t H5AC_BT[1] = {{
static herr_t
H5B__cache_get_initial_load_size(void *_udata, size_t *image_len)
{
- H5B_cache_ud_t *udata = (H5B_cache_ud_t *)_udata; /* User data for callback */
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t *udata = (H5B_cache_ud_t *)_udata; /* User data for callback */
+ H5B_shared_t * shared; /* Pointer to shared B-tree info */
FUNC_ENTER_STATIC_NOERR
@@ -124,7 +115,6 @@ H5B__cache_get_initial_load_size(void *_udata, size_t *image_len)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5B__cache_get_initial_load_size() */
-
/*-------------------------------------------------------------------------
* Function: H5B__cache_deserialize
*
@@ -140,15 +130,15 @@ H5B__cache_get_initial_load_size(void *_udata, size_t *image_len)
*/
static void *
H5B__cache_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty)
+ hbool_t H5_ATTR_UNUSED *dirty)
{
- H5B_t *bt = NULL; /* Pointer to the deserialized B-tree node */
- H5B_cache_ud_t *udata = (H5B_cache_ud_t *)_udata; /* User data for callback */
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into image buffer */
- uint8_t *native; /* Pointer to native keys */
- unsigned u; /* Local index variable */
- H5B_t *ret_value = NULL; /* Return value */
+ H5B_t * bt = NULL; /* Pointer to the deserialized B-tree node */
+ H5B_cache_ud_t *udata = (H5B_cache_ud_t *)_udata; /* User data for callback */
+ H5B_shared_t * shared; /* Pointer to shared B-tree info */
+ const uint8_t * image = (const uint8_t *)_image; /* Pointer into image buffer */
+ uint8_t * native; /* Pointer to native keys */
+ unsigned u; /* Local index variable */
+ H5B_t * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -157,8 +147,8 @@ H5B__cache_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_uda
HDassert(udata);
/* Allocate the B-tree node in memory */
- if(NULL == (bt = H5FL_MALLOC(H5B_t)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate B-tree struct")
+ if (NULL == (bt = H5FL_MALLOC(H5B_t)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate B-tree struct")
HDmemset(&bt->cache_info, 0, sizeof(H5AC_info_t));
/* Set & increment the ref-counted "shared" B-tree information for the node */
@@ -170,26 +160,26 @@ H5B__cache_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_uda
HDassert(shared);
/* Allocate space for the native keys and child addresses */
- if(NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for native keys")
- if(NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for child addresses")
+ if (NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for native keys")
+ if (NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for child addresses")
/* magic number */
- if(HDmemcmp(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC))
- HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree signature")
+ if (HDmemcmp(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree signature")
image += H5_SIZEOF_MAGIC;
/* node type and level */
- if(*image++ != (uint8_t)udata->type->id)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "incorrect B-tree node type")
+ if (*image++ != (uint8_t)udata->type->id)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "incorrect B-tree node type")
bt->level = *image++;
/* entries used */
UINT16DECODE(image, bt->nchildren);
/* Check if bt->nchildren is greater than two_k */
- if(bt->nchildren > shared->two_k)
+ if (bt->nchildren > shared->two_k)
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "number of children is greater than maximum")
/* sibling pointers */
@@ -198,9 +188,9 @@ H5B__cache_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_uda
/* the child/key pairs */
native = bt->native;
- for(u = 0; u < bt->nchildren; u++) {
+ for (u = 0; u < bt->nchildren; u++) {
/* Decode native key value */
- if((udata->type->decode)(shared, image, native) < 0)
+ if ((udata->type->decode)(shared, image, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key")
image += shared->sizeof_rkey;
native += udata->type->sizeof_nkey;
@@ -210,9 +200,9 @@ H5B__cache_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_uda
} /* end for */
/* Decode final key */
- if(bt->nchildren > 0) {
+ if (bt->nchildren > 0) {
/* Decode native key value */
- if((udata->type->decode)(shared, image, native) < 0)
+ if ((udata->type->decode)(shared, image, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key")
} /* end if */
@@ -223,14 +213,13 @@ H5B__cache_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_uda
ret_value = bt;
done:
- if(!ret_value && bt)
- if(H5B__node_dest(bt) < 0)
+ if (!ret_value && bt)
+ if (H5B__node_dest(bt) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to destroy B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B__cache_deserialize() */
-
/*-------------------------------------------------------------------------
* Function: H5B__cache_image_len
*
@@ -246,8 +235,8 @@ done:
static herr_t
H5B__cache_image_len(const void *_thing, size_t *image_len)
{
- const H5B_t *bt = (const H5B_t *)_thing; /* Pointer to the B-tree node */
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ const H5B_t * bt = (const H5B_t *)_thing; /* Pointer to the B-tree node */
+ H5B_shared_t *shared; /* Pointer to shared B-tree info */
FUNC_ENTER_STATIC_NOERR
@@ -265,7 +254,6 @@ H5B__cache_image_len(const void *_thing, size_t *image_len)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5B__cache_image_len() */
-
/*-------------------------------------------------------------------------
* Function: H5B__cache_serialize
*
@@ -279,15 +267,14 @@ H5B__cache_image_len(const void *_thing, size_t *image_len)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B__cache_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing)
+H5B__cache_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)
{
- H5B_t *bt = (H5B_t *)_thing; /* Pointer to the B-tree node */
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
- uint8_t *image = (uint8_t *)_image; /* Pointer into image buffer */
- uint8_t *native; /* Pointer to native keys */
- unsigned u; /* Local index counter */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B_t * bt = (H5B_t *)_thing; /* Pointer to the B-tree node */
+ H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ uint8_t * image = (uint8_t *)_image; /* Pointer into image buffer */
+ uint8_t * native; /* Pointer to native keys */
+ unsigned u; /* Local index counter */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -308,8 +295,8 @@ H5B__cache_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
*image++ = (uint8_t)shared->type->id;
/* 2^8 limit: only 1 byte is used to store node level */
- if(bt->level >= HDpow(2, LEVEL_BITS))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode node level")
+ if (bt->level >= HDpow(2, LEVEL_BITS))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode node level")
H5_CHECK_OVERFLOW(bt->level, unsigned, uint8_t);
*image++ = (uint8_t)bt->level;
@@ -323,9 +310,9 @@ H5B__cache_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
/* child keys and pointers */
native = bt->native;
- for(u = 0; u < bt->nchildren; ++u) {
+ for (u = 0; u < bt->nchildren; ++u) {
/* encode the key */
- if(shared->type->encode(shared, image, native) < 0)
+ if (shared->type->encode(shared, image, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key")
image += shared->sizeof_rkey;
native += shared->type->sizeof_nkey;
@@ -333,9 +320,9 @@ H5B__cache_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
/* encode the child address */
H5F_addr_encode(f, &image, bt->child[u]);
} /* end for */
- if(bt->nchildren > 0) {
+ if (bt->nchildren > 0) {
/* Encode the final key */
- if(shared->type->encode(shared, image, native) < 0)
+ if (shared->type->encode(shared, image, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key")
image += shared->sizeof_rkey;
} /* end if */
@@ -350,7 +337,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B__cache_serialize() */
-
/*-------------------------------------------------------------------------
* Function: H5B__cache_free_icr
*
@@ -366,7 +352,7 @@ done:
static herr_t
H5B__cache_free_icr(void *thing)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -374,10 +360,9 @@ H5B__cache_free_icr(void *thing)
HDassert(thing);
/* Destroy B-tree node */
- if(H5B__node_dest((H5B_t *)thing) < 0)
+ if (H5B__node_dest((H5B_t *)thing) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B__cache_free_icr() */
-
diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c
index 0d0a56d..c27ab1c 100644
--- a/src/H5Bdbg.c
+++ b/src/H5Bdbg.c
@@ -26,19 +26,16 @@
/* Module Setup */
/****************/
-#include "H5Bmodule.h" /* This source code file is part of the H5B module */
-
+#include "H5Bmodule.h" /* This source code file is part of the H5B module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Bpkg.h" /* B-link trees */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Bpkg.h" /* B-link trees */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
-
/*-------------------------------------------------------------------------
* Function: H5B_debug
*
@@ -54,12 +51,12 @@
herr_t
H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B_class_t *type, void *udata)
{
- H5B_t *bt = NULL;
- H5UC_t *rc_shared; /* Ref-counted shared info */
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_t * bt = NULL;
+ H5UC_t * rc_shared; /* Ref-counted shared info */
+ H5B_shared_t * shared; /* Pointer to shared B-tree info */
H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -77,7 +74,7 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5
HDassert(!(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE));
/* Get shared info for B-tree */
- if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ if (NULL == (rc_shared = (type->get_shared)(f, udata)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared);
HDassert(shared);
@@ -85,73 +82,59 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5
/*
* Load the tree node.
*/
- cache_udata.f = f;
- cache_udata.type = type;
+ cache_udata.f = f;
+ cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
+ if (NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
/*
* Print the values.
*/
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Tree type ID:",
+ ((shared->type->id) == H5B_SNODE_ID
+ ? "H5B_SNODE_ID"
+ : ((shared->type->id) == H5B_CHUNK_ID ? "H5B_CHUNK_ID" : "Unknown!")));
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of node:", shared->sizeof_rnode);
+ HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of raw (disk) key:", shared->sizeof_rkey);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Tree type ID:",
- ((shared->type->id) == H5B_SNODE_ID ? "H5B_SNODE_ID" :
- ((shared->type->id) == H5B_CHUNK_ID ? "H5B_CHUNK_ID" : "Unknown!")));
- HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
- "Size of node:",
- shared->sizeof_rnode);
- HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
- "Size of raw (disk) key:",
- shared->sizeof_rkey);
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Dirty flag:",
- bt->cache_info.is_dirty ? "True" : "False");
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Level:",
- bt->level);
- HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
- "Address of left sibling:",
- bt->left);
- HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
- "Address of right sibling:",
- bt->right);
- HDfprintf(stream, "%*s%-*s %u (%u)\n", indent, "", fwidth,
- "Number of children (max):",
- bt->nchildren, shared->two_k);
+ "Dirty flag:", bt->cache_info.is_dirty ? "True" : "False");
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Level:", bt->level);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of left sibling:", bt->left);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of right sibling:", bt->right);
+ HDfprintf(stream, "%*s%-*s %u (%u)\n", indent, "", fwidth, "Number of children (max):", bt->nchildren,
+ shared->two_k);
/*
* Print the child addresses
*/
- for(u = 0; u < bt->nchildren; u++) {
+ for (u = 0; u < bt->nchildren; u++) {
HDfprintf(stream, "%*sChild %d...\n", indent, "", u);
HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(0, fwidth - 3),
- "Address:", bt->child[u]);
+ "Address:", bt->child[u]);
/* If there is a key debugging routine, use it to display the left & right keys */
- if(type->debug_key) {
+ if (type->debug_key) {
/* Decode the 'left' key & print it */
- HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
- "Left Key:");
- HDassert(H5B_NKEY(bt,shared,u));
+ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), "Left Key:");
+ HDassert(H5B_NKEY(bt, shared, u));
(void)(type->debug_key)(stream, indent + 6, MAX(0, fwidth - 6), H5B_NKEY(bt, shared, u), udata);
/* Decode the 'right' key & print it */
- HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
- "Right Key:");
+ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), "Right Key:");
HDassert(H5B_NKEY(bt, shared, u + 1));
- (void)(type->debug_key)(stream, indent + 6, MAX (0, fwidth - 6), H5B_NKEY(bt, shared, u + 1), udata);
+ (void)(type->debug_key)(stream, indent + 6, MAX(0, fwidth - 6), H5B_NKEY(bt, shared, u + 1),
+ udata);
} /* end if */
- } /* end for */
+ } /* end for */
done:
- if(bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_debug() */
-
/*-------------------------------------------------------------------------
* Function: H5B__assert
*
@@ -170,52 +153,52 @@ done:
herr_t
H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata)
{
- H5B_t *bt = NULL;
- H5UC_t *rc_shared; /* Ref-counted shared info */
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
- H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
- int ncell, cmp;
- static int ncalls = 0;
- herr_t status;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B_t * bt = NULL;
+ H5UC_t * rc_shared; /* Ref-counted shared info */
+ H5B_shared_t * shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
+ int ncell, cmp;
+ static int ncalls = 0;
+ herr_t status;
+ herr_t ret_value = SUCCEED; /* Return value */
/* A queue of child data */
struct child_t {
- haddr_t addr;
- unsigned level;
- struct child_t *next;
+ haddr_t addr;
+ unsigned level;
+ struct child_t *next;
} *head = NULL, *tail = NULL, *prev = NULL, *cur = NULL, *tmp = NULL;
FUNC_ENTER_PACKAGE
- if(0 == ncalls++) {
- if(H5DEBUG(B))
+ if (0 == ncalls++) {
+ if (H5DEBUG(B))
HDfprintf(H5DEBUG(B), "H5B: debugging B-trees (expensive)\n");
} /* end if */
/* Get shared info for B-tree */
- if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ if (NULL == (rc_shared = (type->get_shared)(f, udata)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared);
HDassert(shared);
/* Initialize the queue */
- cache_udata.f = f;
- cache_udata.type = type;
+ cache_udata.f = f;
+ cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG);
+ bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG);
HDassert(bt);
shared = (H5B_shared_t *)H5UC_GET_OBJ(bt->rc_shared);
HDassert(shared);
cur = (struct child_t *)H5MM_calloc(sizeof(struct child_t));
HDassert(cur);
- cur->addr = addr;
+ cur->addr = addr;
cur->level = bt->level;
head = tail = cur;
status = H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET);
HDassert(status >= 0);
- bt = NULL; /* Make certain future references will be caught */
+ bt = NULL; /* Make certain future references will be caught */
/*
* Do a breadth-first search of the tree. New nodes are added to the end
@@ -223,58 +206,58 @@ H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata)
* remove any nodes from the queue because we need them in the uniqueness
* test.
*/
- for(ncell = 0; cur; ncell++) {
+ for (ncell = 0; cur; ncell++) {
bt = (H5B_t *)H5AC_protect(f, H5AC_BT, cur->addr, &cache_udata, H5AC__READ_ONLY_FLAG);
HDassert(bt);
/* Check node header */
HDassert(bt->level == cur->level);
- if(cur->next && cur->next->level == bt->level)
+ if (cur->next && cur->next->level == bt->level)
HDassert(H5F_addr_eq(bt->right, cur->next->addr));
else
HDassert(!H5F_addr_defined(bt->right));
- if(prev && prev->level == bt->level)
+ if (prev && prev->level == bt->level)
HDassert(H5F_addr_eq(bt->left, prev->addr));
else
HDassert(!H5F_addr_defined(bt->left));
- if(cur->level > 0) {
+ if (cur->level > 0) {
unsigned u;
- for(u = 0; u < bt->nchildren; u++) {
+ for (u = 0; u < bt->nchildren; u++) {
/*
* Check that child nodes haven't already been seen. If they
* have then the tree has a cycle.
*/
- for(tmp = head; tmp; tmp = tmp->next)
+ for (tmp = head; tmp; tmp = tmp->next)
HDassert(H5F_addr_ne(tmp->addr, bt->child[u]));
/* Add the child node to the end of the queue */
tmp = (struct child_t *)H5MM_calloc(sizeof(struct child_t));
HDassert(tmp);
- tmp->addr = bt->child[u];
+ tmp->addr = bt->child[u];
tmp->level = bt->level - 1;
tail->next = tmp;
- tail = tmp;
+ tail = tmp;
/* Check that the keys are monotonically increasing */
cmp = (type->cmp2)(H5B_NKEY(bt, shared, u), udata, H5B_NKEY(bt, shared, u + 1));
HDassert(cmp < 0);
} /* end for */
- } /* end if */
+ } /* end if */
/* Release node */
status = H5AC_unprotect(f, H5AC_BT, cur->addr, bt, H5AC__NO_FLAGS_SET);
HDassert(status >= 0);
- bt = NULL; /* Make certain future references will be caught */
+ bt = NULL; /* Make certain future references will be caught */
/* Advance current location in queue */
prev = cur;
- cur = cur->next;
+ cur = cur->next;
} /* end for */
/* Free all entries from queue */
- while(head) {
+ while (head) {
tmp = head->next;
H5MM_xfree(head);
head = tmp;
@@ -284,4 +267,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B__assert() */
#endif /* H5B_DEBUG */
-
diff --git a/src/H5Bmodule.h b/src/H5Bmodule.h
index c8e1546..a756541 100644
--- a/src/H5Bmodule.h
+++ b/src/H5Bmodule.h
@@ -25,9 +25,8 @@
* reporting macros.
*/
#define H5B_MODULE
-#define H5_MY_PKG H5B
-#define H5_MY_PKG_ERR H5E_BTREE
-#define H5_MY_PKG_INIT NO
+#define H5_MY_PKG H5B
+#define H5_MY_PKG_ERR H5E_BTREE
+#define H5_MY_PKG_INIT NO
#endif /* _H5Bmodule_H */
-
diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h
index a57584e..37be7f2 100644
--- a/src/H5Bpkg.h
+++ b/src/H5Bpkg.h
@@ -30,18 +30,16 @@
#include "H5Bprivate.h"
/* Other private headers needed by this file */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5FLprivate.h" /* Free Lists */
-
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5FLprivate.h" /* Free Lists */
/**************************/
/* Package Private Macros */
/**************************/
/* Get the native key at a given index */
-#define H5B_NKEY(b, shared, idx) ((b)->native + (shared)->nkey[(idx)])
-#define LEVEL_BITS 8 /* # of bits for node level: 1 byte */
-
+#define H5B_NKEY(b, shared, idx) ((b)->native + (shared)->nkey[(idx)])
+#define LEVEL_BITS 8 /* # of bits for node level: 1 byte */
/****************************/
/* Package Private Typedefs */
@@ -49,22 +47,22 @@
/* The B-tree node as stored in memory... */
typedef struct H5B_t {
- H5AC_info_t cache_info; /* Information for H5AC cache functions */
- /* _must_ be first field in structure */
- H5UC_t *rc_shared; /*ref-counted shared info */
- unsigned level; /*node level */
- unsigned nchildren; /*number of child pointers */
- haddr_t left; /*address of left sibling */
- haddr_t right; /*address of right sibling */
- uint8_t *native; /*array of keys in native format */
- haddr_t *child; /*2k child pointers */
+ H5AC_info_t cache_info; /* Information for H5AC cache functions */
+ /* _must_ be first field in structure */
+ H5UC_t * rc_shared; /*ref-counted shared info */
+ unsigned level; /*node level */
+ unsigned nchildren; /*number of child pointers */
+ haddr_t left; /*address of left sibling */
+ haddr_t right; /*address of right sibling */
+ uint8_t *native; /*array of keys in native format */
+ haddr_t *child; /*2k child pointers */
} H5B_t;
/* Callback info for loading a B-tree node into the cache */
typedef struct H5B_cache_ud_t {
- H5F_t *f; /* File that B-tree node is within */
- const struct H5B_class_t *type; /* Type of tree */
- H5UC_t *rc_shared; /* Ref-counted shared info */
+ H5F_t * f; /* File that B-tree node is within */
+ const struct H5B_class_t *type; /* Type of tree */
+ H5UC_t * rc_shared; /* Ref-counted shared info */
} H5B_cache_ud_t;
/*****************************/
@@ -80,7 +78,6 @@ H5FL_BLK_EXTERN(native_block);
/* Declare a free list to manage the H5B_t struct */
H5FL_EXTERN(H5B_t);
-
/******************************/
/* Package Private Prototypes */
/******************************/
@@ -90,4 +87,3 @@ herr_t H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata)
#endif
#endif /*_H5Bpkg_H*/
-
diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h
index 55bf5b3..ae47162 100644
--- a/src/H5Bprivate.h
+++ b/src/H5Bprivate.h
@@ -25,11 +25,10 @@
#ifndef _H5Bprivate_H
#define _H5Bprivate_H
-
/* Private headers needed by this file */
-#include "H5private.h" /* Generic Functions */
-#include "H5Fprivate.h" /* File access */
-#include "H5UCprivate.h" /* Reference counted object functions */
+#include "H5private.h" /* Generic Functions */
+#include "H5Fprivate.h" /* File access */
+#include "H5UCprivate.h" /* Reference counted object functions */
/**************************/
/* Library Private Macros */
@@ -42,10 +41,9 @@
* being enabled.
*/
#ifdef NDEBUG
-# undef H5B_DEBUG
+#undef H5B_DEBUG
#endif
-
/****************************/
/* Library Private Typedefs */
/****************************/
@@ -55,47 +53,46 @@
* nodes) they use will need to be stored in the file somewhere. -QAK
*/
typedef enum H5B_subid_t {
- H5B_SNODE_ID = 0, /*B-tree is for symbol table nodes */
- H5B_CHUNK_ID = 1, /*B-tree is for chunked dataset storage */
- H5B_NUM_BTREE_ID /* Number of B-tree key IDs (must be last) */
+ H5B_SNODE_ID = 0, /*B-tree is for symbol table nodes */
+ H5B_CHUNK_ID = 1, /*B-tree is for chunked dataset storage */
+ H5B_NUM_BTREE_ID /* Number of B-tree key IDs (must be last) */
} H5B_subid_t;
/* Define return values from B-tree insertion callbacks */
typedef enum H5B_ins_t {
- H5B_INS_ERROR = -1, /*error return value */
- H5B_INS_NOOP = 0, /*insert made no changes */
- H5B_INS_LEFT = 1, /*insert new node to left of cur node */
- H5B_INS_RIGHT = 2, /*insert new node to right of cur node */
- H5B_INS_CHANGE = 3, /*change child address for cur node */
- H5B_INS_FIRST = 4, /*insert first node in (sub)tree */
- H5B_INS_REMOVE = 5 /*remove current node */
+ H5B_INS_ERROR = -1, /*error return value */
+ H5B_INS_NOOP = 0, /*insert made no changes */
+ H5B_INS_LEFT = 1, /*insert new node to left of cur node */
+ H5B_INS_RIGHT = 2, /*insert new node to right of cur node */
+ H5B_INS_CHANGE = 3, /*change child address for cur node */
+ H5B_INS_FIRST = 4, /*insert first node in (sub)tree */
+ H5B_INS_REMOVE = 5 /*remove current node */
} H5B_ins_t;
/* Enum for specifying the direction of the critical key in relation to the
* child */
typedef enum H5B_dir_t {
- H5B_LEFT = 0, /* Critical key is to the left */
- H5B_RIGHT = 1 /* Critical key is to the right */
+ H5B_LEFT = 0, /* Critical key is to the left */
+ H5B_RIGHT = 1 /* Critical key is to the right */
} H5B_dir_t;
/* Define the operator callback function pointer for H5B_iterate() */
-typedef int (*H5B_operator_t)(H5F_t *f, const void *_lt_key, haddr_t addr,
- const void *_rt_key, void *_udata);
+typedef int (*H5B_operator_t)(H5F_t *f, const void *_lt_key, haddr_t addr, const void *_rt_key, void *_udata);
/* Each B-tree has certain information that can be shared across all
* the instances of nodes in that B-tree.
*/
typedef struct H5B_shared_t {
- const struct H5B_class_t *type; /* Type of tree */
- unsigned two_k; /* 2*"K" value for tree's nodes */
- size_t sizeof_rkey; /* Size of raw (disk) key */
- size_t sizeof_rnode; /* Size of raw (disk) node */
- size_t sizeof_keys; /* Size of native (memory) key node */
- size_t sizeof_addr; /* Size of file address (in bytes) */
- size_t sizeof_len; /* Size of file lengths (in bytes) */
- uint8_t *page; /* Disk page */
- size_t *nkey; /* Offsets of each native key in native key buffer */
- void *udata; /* 'Local' info for a B-tree */
+ const struct H5B_class_t *type; /* Type of tree */
+ unsigned two_k; /* 2*"K" value for tree's nodes */
+ size_t sizeof_rkey; /* Size of raw (disk) key */
+ size_t sizeof_rnode; /* Size of raw (disk) node */
+ size_t sizeof_keys; /* Size of native (memory) key node */
+ size_t sizeof_addr; /* Size of file address (in bytes) */
+ size_t sizeof_len; /* Size of file lengths (in bytes) */
+ uint8_t * page; /* Disk page */
+ size_t * nkey; /* Offsets of each native key in native key buffer */
+ void * udata; /* 'Local' info for a B-tree */
} H5B_shared_t;
/*
@@ -107,69 +104,57 @@ typedef struct H5B_shared_t {
*/
typedef struct H5B_class_t {
- H5B_subid_t id; /*id as found in file*/
- size_t sizeof_nkey; /*size of native (memory) key*/
- H5UC_t * (*get_shared)(const H5F_t*, const void*); /*shared info for node */
- herr_t (*new_node)(H5F_t*, H5B_ins_t, void*, void*, void*, haddr_t*);
- int (*cmp2)(void*, void*, void*); /*compare 2 keys */
- int (*cmp3)(void*, void*, void*); /*compare 3 keys */
- htri_t (*found)(H5F_t*, haddr_t, const void*, void*);
+ H5B_subid_t id; /*id as found in file*/
+ size_t sizeof_nkey; /*size of native (memory) key*/
+ H5UC_t *(*get_shared)(const H5F_t *, const void *); /*shared info for node */
+ herr_t (*new_node)(H5F_t *, H5B_ins_t, void *, void *, void *, haddr_t *);
+ int (*cmp2)(void *, void *, void *); /*compare 2 keys */
+ int (*cmp3)(void *, void *, void *); /*compare 3 keys */
+ htri_t (*found)(H5F_t *, haddr_t, const void *, void *);
/* insert new data */
- H5B_ins_t (*insert)(H5F_t*, haddr_t, void*, hbool_t*, void*, void*,
- void*, hbool_t*, haddr_t*);
+ H5B_ins_t (*insert)(H5F_t *, haddr_t, void *, hbool_t *, void *, void *, void *, hbool_t *, haddr_t *);
/* min insert uses min leaf, not new(), similarly for max insert */
- hbool_t follow_min;
- hbool_t follow_max;
+ hbool_t follow_min;
+ hbool_t follow_max;
/* The direction of the key that is intrinsically associated with each node */
- H5B_dir_t critical_key;
+ H5B_dir_t critical_key;
/* remove existing data */
- H5B_ins_t (*remove)(H5F_t*, haddr_t, void*, hbool_t*, void*, void*, hbool_t*);
+ H5B_ins_t (*remove)(H5F_t *, haddr_t, void *, hbool_t *, void *, void *, hbool_t *);
/* encode, decode, debug key values */
- herr_t (*decode)(const H5B_shared_t*, const uint8_t*, void*);
- herr_t (*encode)(const H5B_shared_t*, uint8_t*, const void*);
- herr_t (*debug_key)(FILE*, int, int, const void*, const void*);
+ herr_t (*decode)(const H5B_shared_t *, const uint8_t *, void *);
+ herr_t (*encode)(const H5B_shared_t *, uint8_t *, const void *);
+ herr_t (*debug_key)(FILE *, int, int, const void *, const void *);
} H5B_class_t;
/* Information about B-tree */
typedef struct H5B_info_t {
- hsize_t size; /* Size of B-tree nodes */
- hsize_t num_nodes; /* Number of B-tree nodes */
+ hsize_t size; /* Size of B-tree nodes */
+ hsize_t num_nodes; /* Number of B-tree nodes */
} H5B_info_t;
-
-
/*****************************/
/* Library-private Variables */
/*****************************/
-
/***************************************/
/* Library-private Function Prototypes */
/***************************************/
-H5_DLL herr_t H5B_create(H5F_t *f, const H5B_class_t *type, void *udata,
- haddr_t *addr_p/*out*/);
-H5_DLL herr_t H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr,
- void *udata);
-H5_DLL herr_t H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr,
- void *udata);
-H5_DLL herr_t H5B_iterate(H5F_t *f, const H5B_class_t *type, haddr_t addr,
- H5B_operator_t op, void *udata);
-H5_DLL herr_t H5B_get_info(H5F_t *f, const H5B_class_t *type, haddr_t addr,
- H5B_info_t *bt_info, H5B_operator_t op, void *udata);
-H5_DLL herr_t H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr,
- void *udata);
-H5_DLL herr_t H5B_delete(H5F_t *f, const H5B_class_t *type, haddr_t addr,
- void *udata);
-H5_DLL H5B_shared_t *H5B_shared_new(const H5F_t *f, const H5B_class_t *type,
- size_t sizeof_rkey);
-H5_DLL herr_t H5B_shared_free(void *_shared);
-H5_DLL herr_t H5B_debug(H5F_t *f, haddr_t addr, FILE * stream,
- int indent, int fwidth, const H5B_class_t *type, void *udata);
+H5_DLL herr_t H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *addr_p /*out*/);
+H5_DLL herr_t H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata);
+H5_DLL herr_t H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata);
+H5_DLL herr_t H5B_iterate(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_operator_t op, void *udata);
+H5_DLL herr_t H5B_get_info(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_info_t *bt_info,
+ H5B_operator_t op, void *udata);
+H5_DLL herr_t H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata);
+H5_DLL herr_t H5B_delete(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata);
+H5_DLL H5B_shared_t *H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey);
+H5_DLL herr_t H5B_shared_free(void *_shared);
+H5_DLL herr_t H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B_class_t *type,
+ void *udata);
H5_DLL htri_t H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr);
#endif /* _H5Bprivate_H */
-
diff --git a/src/H5C.c b/src/H5C.c
index 0b4b231..1cbefdf 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -72,36 +72,33 @@
/* Module Setup */
/****************/
-#include "H5Cmodule.h" /* This source code file is part of the H5C module */
-#define H5F_FRIEND /* suppress error about including H5Fpkg */
-
+#include "H5Cmodule.h" /* This source code file is part of the H5C module */
+#define H5F_FRIEND /* suppress error about including H5Fpkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Cpkg.h" /* Cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* Files */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Cpkg.h" /* Cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
/****************/
/* Local Macros */
/****************/
#if H5C_DO_MEMORY_SANITY_CHECKS
-#define H5C_IMAGE_EXTRA_SPACE 8
+#define H5C_IMAGE_EXTRA_SPACE 8
#define H5C_IMAGE_SANITY_VALUE "DeadBeef"
#else /* H5C_DO_MEMORY_SANITY_CHECKS */
#define H5C_IMAGE_EXTRA_SPACE 0
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
-
/******************/
/* Local Typedefs */
/******************/
@@ -109,41 +106,32 @@
/* Alias for pointer to cache entry, for use when allocating sequences of them */
typedef H5C_cache_entry_t *H5C_cache_entry_ptr_t;
-
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5C__pin_entry_from_client(H5C_t *cache_ptr,
- H5C_cache_entry_t *entry_ptr);
+static herr_t H5C__pin_entry_from_client(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr);
-static herr_t H5C__unpin_entry_real(H5C_t *cache_ptr,
- H5C_cache_entry_t *entry_ptr, hbool_t update_rp);
+static herr_t H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hbool_t update_rp);
-static herr_t H5C__unpin_entry_from_client(H5C_t *cache_ptr,
- H5C_cache_entry_t *entry_ptr, hbool_t update_rp);
+static herr_t H5C__unpin_entry_from_client(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hbool_t update_rp);
static herr_t H5C__auto_adjust_cache_size(H5F_t *f, hbool_t write_permitted);
-static herr_t H5C__autoadjust__ageout(H5F_t * f,
- double hit_rate,
- enum H5C_resize_status * status_ptr,
- size_t * new_max_cache_size_ptr,
- hbool_t write_permitted);
+static herr_t H5C__autoadjust__ageout(H5F_t *f, double hit_rate, enum H5C_resize_status *status_ptr,
+ size_t *new_max_cache_size_ptr, hbool_t write_permitted);
-static herr_t H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t * cache_ptr);
+static herr_t H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t *cache_ptr);
-static herr_t H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f,
- hbool_t write_permitted);
+static herr_t H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *f, hbool_t write_permitted);
-static herr_t H5C__autoadjust__ageout__insert_new_marker(H5C_t * cache_ptr);
+static herr_t H5C__autoadjust__ageout__insert_new_marker(H5C_t *cache_ptr);
-static herr_t H5C__autoadjust__ageout__remove_all_markers(H5C_t * cache_ptr);
+static herr_t H5C__autoadjust__ageout__remove_all_markers(H5C_t *cache_ptr);
-static herr_t H5C__autoadjust__ageout__remove_excess_markers(H5C_t * cache_ptr);
+static herr_t H5C__autoadjust__ageout__remove_excess_markers(H5C_t *cache_ptr);
-static herr_t H5C__flash_increase_cache_size(H5C_t * cache_ptr,
- size_t old_entry_size, size_t new_entry_size);
+static herr_t H5C__flash_increase_cache_size(H5C_t *cache_ptr, size_t old_entry_size, size_t new_entry_size);
static herr_t H5C__flush_invalidate_cache(H5F_t *f, unsigned flags);
@@ -151,43 +139,37 @@ static herr_t H5C__flush_invalidate_ring(H5F_t *f, H5C_ring_t ring, unsigned fla
static herr_t H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags);
-static void * H5C__load_entry(H5F_t * f,
+static void *H5C__load_entry(H5F_t *f,
#ifdef H5_HAVE_PARALLEL
- hbool_t coll_access,
+ hbool_t coll_access,
#endif /* H5_HAVE_PARALLEL */
- const H5C_class_t * type,
- haddr_t addr,
- void * udata);
+ const H5C_class_t *type, haddr_t addr, void *udata);
-static herr_t H5C__mark_flush_dep_dirty(H5C_cache_entry_t * entry);
+static herr_t H5C__mark_flush_dep_dirty(H5C_cache_entry_t *entry);
-static herr_t H5C__mark_flush_dep_clean(H5C_cache_entry_t * entry);
+static herr_t H5C__mark_flush_dep_clean(H5C_cache_entry_t *entry);
static herr_t H5C__serialize_ring(H5F_t *f, H5C_ring_t ring);
-static herr_t H5C__serialize_single_entry(H5F_t *f, H5C_t *cache_ptr,
- H5C_cache_entry_t *entry_ptr);
-static herr_t H5C__generate_image(H5F_t *f, H5C_t *cache_ptr,
- H5C_cache_entry_t *entry_ptr);
-static herr_t H5C__verify_len_eoa(H5F_t *f, const H5C_class_t * type,
- haddr_t addr, size_t *len, hbool_t actual);
+static herr_t H5C__serialize_single_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr);
+static herr_t H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr);
+static herr_t H5C__verify_len_eoa(H5F_t *f, const H5C_class_t *type, haddr_t addr, size_t *len,
+ hbool_t actual);
#if H5C_DO_SLIST_SANITY_CHECKS
-static hbool_t H5C__entry_in_skip_list(H5C_t * cache_ptr,
- H5C_cache_entry_t *target_ptr);
+static hbool_t H5C__entry_in_skip_list(H5C_t *cache_ptr, H5C_cache_entry_t *target_ptr);
#endif /* H5C_DO_SLIST_SANITY_CHECKS */
#if H5C_DO_EXTREME_SANITY_CHECKS
-static herr_t H5C__validate_lru_list(H5C_t * cache_ptr);
-static herr_t H5C__validate_pinned_entry_list(H5C_t * cache_ptr);
-static herr_t H5C__validate_protected_entry_list(H5C_t * cache_ptr);
+static herr_t H5C__validate_lru_list(H5C_t *cache_ptr);
+static herr_t H5C__validate_pinned_entry_list(H5C_t *cache_ptr);
+static herr_t H5C__validate_protected_entry_list(H5C_t *cache_ptr);
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
#ifndef NDEBUG
-static void H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t * entry,
- const H5C_cache_entry_t * base_entry);
+static void H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t *entry,
+ const H5C_cache_entry_t *base_entry);
#endif /* NDEBUG */
-
/*********************/
/* Package Variables */
/*********************/
@@ -198,12 +180,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Declare a free list to manage the tag info struct */
H5FL_DEFINE(H5C_tag_info_t);
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -214,8 +194,6 @@ H5FL_DEFINE_STATIC(H5C_t);
/* Declare a free list to manage arrays of cache entries */
H5FL_SEQ_DEFINE_STATIC(H5C_cache_entry_ptr_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5C_create
*
@@ -317,207 +295,200 @@ H5FL_SEQ_DEFINE_STATIC(H5C_cache_entry_ptr_t);
*-------------------------------------------------------------------------
*/
H5C_t *
-H5C_create(size_t max_cache_size,
- size_t min_clean_size,
- int max_type_id,
- const H5C_class_t * const * class_table_ptr,
- H5C_write_permitted_func_t check_write_permitted,
- hbool_t write_permitted,
- H5C_log_flush_func_t log_flush,
- void * aux_ptr)
+H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id,
+ const H5C_class_t *const *class_table_ptr, H5C_write_permitted_func_t check_write_permitted,
+ hbool_t write_permitted, H5C_log_flush_func_t log_flush, void *aux_ptr)
{
- int i;
- H5C_t * cache_ptr = NULL;
- H5C_t * ret_value = NULL; /* Return value */
+ int i;
+ H5C_t *cache_ptr = NULL;
+ H5C_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
- HDassert( max_cache_size >= H5C__MIN_MAX_CACHE_SIZE );
- HDassert( max_cache_size <= H5C__MAX_MAX_CACHE_SIZE );
- HDassert( min_clean_size <= max_cache_size );
+ HDassert(max_cache_size >= H5C__MIN_MAX_CACHE_SIZE);
+ HDassert(max_cache_size <= H5C__MAX_MAX_CACHE_SIZE);
+ HDassert(min_clean_size <= max_cache_size);
- HDassert( max_type_id >= 0 );
- HDassert( max_type_id < H5C__MAX_NUM_TYPE_IDS );
- HDassert( class_table_ptr );
+ HDassert(max_type_id >= 0);
+ HDassert(max_type_id < H5C__MAX_NUM_TYPE_IDS);
+ HDassert(class_table_ptr);
- for ( i = 0; i <= max_type_id; i++ ) {
- HDassert( (class_table_ptr)[i] );
+ for (i = 0; i <= max_type_id; i++) {
+ HDassert((class_table_ptr)[i]);
HDassert(HDstrlen((class_table_ptr)[i]->name) > 0);
} /* end for */
- if(NULL == (cache_ptr = H5FL_CALLOC(H5C_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ if (NULL == (cache_ptr = H5FL_CALLOC(H5C_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- if(NULL == (cache_ptr->slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
+ if (NULL == (cache_ptr->slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, NULL, "can't create skip list")
- if(NULL == (cache_ptr->tag_list = H5SL_create(H5SL_TYPE_HADDR, NULL)))
+ if (NULL == (cache_ptr->tag_list = H5SL_create(H5SL_TYPE_HADDR, NULL)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, NULL, "can't create skip list for tagged entry addresses")
/* If we get this far, we should succeed. Go ahead and initialize all
* the fields.
*/
- cache_ptr->magic = H5C__H5C_T_MAGIC;
+ cache_ptr->magic = H5C__H5C_T_MAGIC;
- cache_ptr->flush_in_progress = FALSE;
+ cache_ptr->flush_in_progress = FALSE;
- if(NULL == (cache_ptr->log_info = (H5C_log_info_t *)H5MM_calloc(sizeof(H5C_log_info_t))))
+ if (NULL == (cache_ptr->log_info = (H5C_log_info_t *)H5MM_calloc(sizeof(H5C_log_info_t))))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed")
- cache_ptr->aux_ptr = aux_ptr;
+ cache_ptr->aux_ptr = aux_ptr;
- cache_ptr->max_type_id = max_type_id;
+ cache_ptr->max_type_id = max_type_id;
- cache_ptr->class_table_ptr = class_table_ptr;
+ cache_ptr->class_table_ptr = class_table_ptr;
- cache_ptr->max_cache_size = max_cache_size;
- cache_ptr->min_clean_size = min_clean_size;
+ cache_ptr->max_cache_size = max_cache_size;
+ cache_ptr->min_clean_size = min_clean_size;
- cache_ptr->check_write_permitted = check_write_permitted;
- cache_ptr->write_permitted = write_permitted;
+ cache_ptr->check_write_permitted = check_write_permitted;
+ cache_ptr->write_permitted = write_permitted;
- cache_ptr->log_flush = log_flush;
+ cache_ptr->log_flush = log_flush;
- cache_ptr->evictions_enabled = TRUE;
- cache_ptr->close_warning_received = FALSE;
+ cache_ptr->evictions_enabled = TRUE;
+ cache_ptr->close_warning_received = FALSE;
- cache_ptr->index_len = 0;
- cache_ptr->index_size = (size_t)0;
- cache_ptr->clean_index_size = (size_t)0;
- cache_ptr->dirty_index_size = (size_t)0;
+ cache_ptr->index_len = 0;
+ cache_ptr->index_size = (size_t)0;
+ cache_ptr->clean_index_size = (size_t)0;
+ cache_ptr->dirty_index_size = (size_t)0;
- for(i = 0; i < H5C_RING_NTYPES; i++) {
- cache_ptr->index_ring_len[i] = 0;
- cache_ptr->index_ring_size[i] = (size_t)0;
- cache_ptr->clean_index_ring_size[i] = (size_t)0;
- cache_ptr->dirty_index_ring_size[i] = (size_t)0;
+ for (i = 0; i < H5C_RING_NTYPES; i++) {
+ cache_ptr->index_ring_len[i] = 0;
+ cache_ptr->index_ring_size[i] = (size_t)0;
+ cache_ptr->clean_index_ring_size[i] = (size_t)0;
+ cache_ptr->dirty_index_ring_size[i] = (size_t)0;
- cache_ptr->slist_ring_len[i] = 0;
- cache_ptr->slist_ring_size[i] = (size_t)0;
+ cache_ptr->slist_ring_len[i] = 0;
+ cache_ptr->slist_ring_size[i] = (size_t)0;
} /* end for */
- for(i = 0; i < H5C__HASH_TABLE_LEN; i++)
+ for (i = 0; i < H5C__HASH_TABLE_LEN; i++)
(cache_ptr->index)[i] = NULL;
- cache_ptr->il_len = 0;
- cache_ptr->il_size = (size_t)0;
- cache_ptr->il_head = NULL;
- cache_ptr->il_tail = NULL;
+ cache_ptr->il_len = 0;
+ cache_ptr->il_size = (size_t)0;
+ cache_ptr->il_head = NULL;
+ cache_ptr->il_tail = NULL;
/* Tagging Field Initializations */
- cache_ptr->ignore_tags = FALSE;
- cache_ptr->num_objs_corked = 0;
+ cache_ptr->ignore_tags = FALSE;
+ cache_ptr->num_objs_corked = 0;
/* slist field initializations */
- cache_ptr->slist_enabled = ! H5C__SLIST_OPT_ENABLED;
- cache_ptr->slist_changed = FALSE;
- cache_ptr->slist_len = 0;
- cache_ptr->slist_size = (size_t)0;
+ cache_ptr->slist_enabled = !H5C__SLIST_OPT_ENABLED;
+ cache_ptr->slist_changed = FALSE;
+ cache_ptr->slist_len = 0;
+ cache_ptr->slist_size = (size_t)0;
/* slist_ring_len, slist_ring_size, and
* slist_ptr initializaed above.
*/
#if H5C_DO_SANITY_CHECKS
- cache_ptr->slist_len_increase = 0;
- cache_ptr->slist_size_increase = 0;
+ cache_ptr->slist_len_increase = 0;
+ cache_ptr->slist_size_increase = 0;
#endif /* H5C_DO_SANITY_CHECKS */
- cache_ptr->entries_removed_counter = 0;
- cache_ptr->last_entry_removed_ptr = NULL;
- cache_ptr->entry_watched_for_removal = NULL;
+ cache_ptr->entries_removed_counter = 0;
+ cache_ptr->last_entry_removed_ptr = NULL;
+ cache_ptr->entry_watched_for_removal = NULL;
- cache_ptr->pl_len = 0;
- cache_ptr->pl_size = (size_t)0;
- cache_ptr->pl_head_ptr = NULL;
- cache_ptr->pl_tail_ptr = NULL;
+ cache_ptr->pl_len = 0;
+ cache_ptr->pl_size = (size_t)0;
+ cache_ptr->pl_head_ptr = NULL;
+ cache_ptr->pl_tail_ptr = NULL;
- cache_ptr->pel_len = 0;
- cache_ptr->pel_size = (size_t)0;
- cache_ptr->pel_head_ptr = NULL;
- cache_ptr->pel_tail_ptr = NULL;
+ cache_ptr->pel_len = 0;
+ cache_ptr->pel_size = (size_t)0;
+ cache_ptr->pel_head_ptr = NULL;
+ cache_ptr->pel_tail_ptr = NULL;
- cache_ptr->LRU_list_len = 0;
- cache_ptr->LRU_list_size = (size_t)0;
- cache_ptr->LRU_head_ptr = NULL;
- cache_ptr->LRU_tail_ptr = NULL;
+ cache_ptr->LRU_list_len = 0;
+ cache_ptr->LRU_list_size = (size_t)0;
+ cache_ptr->LRU_head_ptr = NULL;
+ cache_ptr->LRU_tail_ptr = NULL;
#ifdef H5_HAVE_PARALLEL
- cache_ptr->coll_list_len = 0;
- cache_ptr->coll_list_size = (size_t)0;
- cache_ptr->coll_head_ptr = NULL;
- cache_ptr->coll_tail_ptr = NULL;
- cache_ptr->coll_write_list = NULL;
+ cache_ptr->coll_list_len = 0;
+ cache_ptr->coll_list_size = (size_t)0;
+ cache_ptr->coll_head_ptr = NULL;
+ cache_ptr->coll_tail_ptr = NULL;
+ cache_ptr->coll_write_list = NULL;
#endif /* H5_HAVE_PARALLEL */
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
- cache_ptr->cLRU_list_len = 0;
- cache_ptr->cLRU_list_size = (size_t)0;
- cache_ptr->cLRU_head_ptr = NULL;
- cache_ptr->cLRU_tail_ptr = NULL;
-
- cache_ptr->dLRU_list_len = 0;
- cache_ptr->dLRU_list_size = (size_t)0;
- cache_ptr->dLRU_head_ptr = NULL;
- cache_ptr->dLRU_tail_ptr = NULL;
+ cache_ptr->cLRU_list_len = 0;
+ cache_ptr->cLRU_list_size = (size_t)0;
+ cache_ptr->cLRU_head_ptr = NULL;
+ cache_ptr->cLRU_tail_ptr = NULL;
+
+ cache_ptr->dLRU_list_len = 0;
+ cache_ptr->dLRU_list_size = (size_t)0;
+ cache_ptr->dLRU_head_ptr = NULL;
+ cache_ptr->dLRU_tail_ptr = NULL;
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
cache_ptr->size_increase_possible = FALSE;
- cache_ptr->flash_size_increase_possible = FALSE;
- cache_ptr->flash_size_increase_threshold = 0;
+ cache_ptr->flash_size_increase_possible = FALSE;
+ cache_ptr->flash_size_increase_threshold = 0;
cache_ptr->size_decrease_possible = FALSE;
- cache_ptr->resize_enabled = FALSE;
- cache_ptr->cache_full = FALSE;
- cache_ptr->size_decreased = FALSE;
- cache_ptr->resize_in_progress = FALSE;
- cache_ptr->msic_in_progress = FALSE;
-
- (cache_ptr->resize_ctl).version = H5C__CURR_AUTO_SIZE_CTL_VER;
- (cache_ptr->resize_ctl).rpt_fcn = NULL;
- (cache_ptr->resize_ctl).set_initial_size = FALSE;
- (cache_ptr->resize_ctl).initial_size = H5C__DEF_AR_INIT_SIZE;
- (cache_ptr->resize_ctl).min_clean_fraction = H5C__DEF_AR_MIN_CLEAN_FRAC;
- (cache_ptr->resize_ctl).max_size = H5C__DEF_AR_MAX_SIZE;
- (cache_ptr->resize_ctl).min_size = H5C__DEF_AR_MIN_SIZE;
- (cache_ptr->resize_ctl).epoch_length = H5C__DEF_AR_EPOCH_LENGTH;
-
- (cache_ptr->resize_ctl).incr_mode = H5C_incr__off;
- (cache_ptr->resize_ctl).lower_hr_threshold = H5C__DEF_AR_LOWER_THRESHHOLD;
- (cache_ptr->resize_ctl).increment = H5C__DEF_AR_INCREMENT;
- (cache_ptr->resize_ctl).apply_max_increment = TRUE;
- (cache_ptr->resize_ctl).max_increment = H5C__DEF_AR_MAX_INCREMENT;
-
- (cache_ptr->resize_ctl).flash_incr_mode = H5C_flash_incr__off;
- (cache_ptr->resize_ctl).flash_multiple = (double)1.0f;
- (cache_ptr->resize_ctl).flash_threshold = (double)0.25f;
-
- (cache_ptr->resize_ctl).decr_mode = H5C_decr__off;
- (cache_ptr->resize_ctl).upper_hr_threshold = (double)H5C__DEF_AR_UPPER_THRESHHOLD;
- (cache_ptr->resize_ctl).decrement = (double)H5C__DEF_AR_DECREMENT;
+ cache_ptr->resize_enabled = FALSE;
+ cache_ptr->cache_full = FALSE;
+ cache_ptr->size_decreased = FALSE;
+ cache_ptr->resize_in_progress = FALSE;
+ cache_ptr->msic_in_progress = FALSE;
+
+ (cache_ptr->resize_ctl).version = H5C__CURR_AUTO_SIZE_CTL_VER;
+ (cache_ptr->resize_ctl).rpt_fcn = NULL;
+ (cache_ptr->resize_ctl).set_initial_size = FALSE;
+ (cache_ptr->resize_ctl).initial_size = H5C__DEF_AR_INIT_SIZE;
+ (cache_ptr->resize_ctl).min_clean_fraction = H5C__DEF_AR_MIN_CLEAN_FRAC;
+ (cache_ptr->resize_ctl).max_size = H5C__DEF_AR_MAX_SIZE;
+ (cache_ptr->resize_ctl).min_size = H5C__DEF_AR_MIN_SIZE;
+ (cache_ptr->resize_ctl).epoch_length = H5C__DEF_AR_EPOCH_LENGTH;
+
+ (cache_ptr->resize_ctl).incr_mode = H5C_incr__off;
+ (cache_ptr->resize_ctl).lower_hr_threshold = H5C__DEF_AR_LOWER_THRESHHOLD;
+ (cache_ptr->resize_ctl).increment = H5C__DEF_AR_INCREMENT;
+ (cache_ptr->resize_ctl).apply_max_increment = TRUE;
+ (cache_ptr->resize_ctl).max_increment = H5C__DEF_AR_MAX_INCREMENT;
+
+ (cache_ptr->resize_ctl).flash_incr_mode = H5C_flash_incr__off;
+ (cache_ptr->resize_ctl).flash_multiple = (double)1.0f;
+ (cache_ptr->resize_ctl).flash_threshold = (double)0.25f;
+
+ (cache_ptr->resize_ctl).decr_mode = H5C_decr__off;
+ (cache_ptr->resize_ctl).upper_hr_threshold = (double)H5C__DEF_AR_UPPER_THRESHHOLD;
+ (cache_ptr->resize_ctl).decrement = (double)H5C__DEF_AR_DECREMENT;
(cache_ptr->resize_ctl).apply_max_decrement = TRUE;
- (cache_ptr->resize_ctl).max_decrement = H5C__DEF_AR_MAX_DECREMENT;
+ (cache_ptr->resize_ctl).max_decrement = H5C__DEF_AR_MAX_DECREMENT;
(cache_ptr->resize_ctl).epochs_before_eviction = H5C__DEF_AR_EPCHS_B4_EVICT;
- (cache_ptr->resize_ctl).apply_empty_reserve = TRUE;
- (cache_ptr->resize_ctl).empty_reserve = (double)H5C__DEF_AR_EMPTY_RESERVE;
+ (cache_ptr->resize_ctl).apply_empty_reserve = TRUE;
+ (cache_ptr->resize_ctl).empty_reserve = (double)H5C__DEF_AR_EMPTY_RESERVE;
- cache_ptr->epoch_markers_active = 0;
+ cache_ptr->epoch_markers_active = 0;
/* no need to initialize the ring buffer itself */
- cache_ptr->epoch_marker_ringbuf_first = 1;
- cache_ptr->epoch_marker_ringbuf_last = 0;
- cache_ptr->epoch_marker_ringbuf_size = 0;
+ cache_ptr->epoch_marker_ringbuf_first = 1;
+ cache_ptr->epoch_marker_ringbuf_last = 0;
+ cache_ptr->epoch_marker_ringbuf_size = 0;
/* Initialize all epoch marker entries' fields to zero/FALSE/NULL */
HDmemset(cache_ptr->epoch_markers, 0, sizeof(cache_ptr->epoch_markers));
/* Set non-zero/FALSE/NULL fields for epoch markers */
- for ( i = 0; i < H5C__MAX_EPOCH_MARKERS; i++ )
- {
- ((cache_ptr->epoch_markers)[i]).magic =
- H5C__H5C_CACHE_ENTRY_T_MAGIC;
- ((cache_ptr->epoch_markers)[i]).addr = (haddr_t)i;
- ((cache_ptr->epoch_markers)[i]).type = H5AC_EPOCH_MARKER;
+ for (i = 0; i < H5C__MAX_EPOCH_MARKERS; i++) {
+ ((cache_ptr->epoch_markers)[i]).magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
+ ((cache_ptr->epoch_markers)[i]).addr = (haddr_t)i;
+ ((cache_ptr->epoch_markers)[i]).type = H5AC_EPOCH_MARKER;
}
/* Initialize cache image generation on file close related fields.
@@ -530,63 +501,62 @@ H5C_create(size_t max_cache_size,
cache_ptr->image_ctl.entry_ageout = -1;
cache_ptr->image_ctl.flags = H5C_CI__ALL_FLAGS;
- cache_ptr->serialization_in_progress= FALSE;
- cache_ptr->load_image = FALSE;
- cache_ptr->image_loaded = FALSE;
- cache_ptr->delete_image = FALSE;
- cache_ptr->image_addr = HADDR_UNDEF;
- cache_ptr->image_len = 0;
- cache_ptr->image_data_len = 0;
-
- cache_ptr->entries_loaded_counter = 0;
- cache_ptr->entries_inserted_counter = 0;
- cache_ptr->entries_relocated_counter = 0;
- cache_ptr->entry_fd_height_change_counter = 0;
-
- cache_ptr->num_entries_in_image = 0;
+ cache_ptr->serialization_in_progress = FALSE;
+ cache_ptr->load_image = FALSE;
+ cache_ptr->image_loaded = FALSE;
+ cache_ptr->delete_image = FALSE;
+ cache_ptr->image_addr = HADDR_UNDEF;
+ cache_ptr->image_len = 0;
+ cache_ptr->image_data_len = 0;
+
+ cache_ptr->entries_loaded_counter = 0;
+ cache_ptr->entries_inserted_counter = 0;
+ cache_ptr->entries_relocated_counter = 0;
+ cache_ptr->entry_fd_height_change_counter = 0;
+
+ cache_ptr->num_entries_in_image = 0;
cache_ptr->image_entries = NULL;
- cache_ptr->image_buffer = NULL;
+ cache_ptr->image_buffer = NULL;
/* initialize free space manager related fields: */
- cache_ptr->rdfsm_settled = FALSE;
- cache_ptr->mdfsm_settled = FALSE;
+ cache_ptr->rdfsm_settled = FALSE;
+ cache_ptr->mdfsm_settled = FALSE;
- if(H5C_reset_cache_hit_rate_stats(cache_ptr) < 0)
+ if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0)
/* this should be impossible... */
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "H5C_reset_cache_hit_rate_stats failed")
H5C_stats__reset(cache_ptr);
- cache_ptr->prefix[0] = '\0'; /* empty string */
+ cache_ptr->prefix[0] = '\0'; /* empty string */
#ifndef NDEBUG
- cache_ptr->get_entry_ptr_from_addr_counter = 0;
+ cache_ptr->get_entry_ptr_from_addr_counter = 0;
#endif /* NDEBUG */
/* Set return value */
ret_value = cache_ptr;
done:
- if(NULL == ret_value) {
- if(cache_ptr != NULL) {
- if(cache_ptr->slist_ptr != NULL)
+ if (NULL == ret_value) {
+ if (cache_ptr != NULL) {
+ if (cache_ptr->slist_ptr != NULL)
H5SL_close(cache_ptr->slist_ptr);
- if(cache_ptr->tag_list != NULL)
+ if (cache_ptr->tag_list != NULL)
H5SL_close(cache_ptr->tag_list);
- if(cache_ptr->log_info != NULL)
+ if (cache_ptr->log_info != NULL)
H5MM_xfree(cache_ptr->log_info);
cache_ptr->magic = 0;
- cache_ptr = H5FL_FREE(H5C_t, cache_ptr);
+ cache_ptr = H5FL_FREE(H5C_t, cache_ptr);
} /* end if */
- } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_create() */
-
/*-------------------------------------------------------------------------
* Function: H5C_def_auto_resize_rpt_fcn
*
@@ -603,168 +573,120 @@ done:
*-------------------------------------------------------------------------
*/
void
-H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr,
+H5C_def_auto_resize_rpt_fcn(H5C_t *cache_ptr,
#ifndef NDEBUG
int32_t version,
-#else /* NDEBUG */
+#else /* NDEBUG */
int32_t H5_ATTR_UNUSED version,
#endif /* NDEBUG */
- double hit_rate,
- enum H5C_resize_status status,
- size_t old_max_cache_size,
- size_t new_max_cache_size,
- size_t old_min_clean_size,
- size_t new_min_clean_size)
+ double hit_rate, enum H5C_resize_status status, size_t old_max_cache_size,
+ size_t new_max_cache_size, size_t old_min_clean_size, size_t new_min_clean_size)
{
- HDassert( cache_ptr != NULL );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( version == H5C__CURR_AUTO_RESIZE_RPT_FCN_VER );
+ HDassert(cache_ptr != NULL);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(version == H5C__CURR_AUTO_RESIZE_RPT_FCN_VER);
- switch ( status )
- {
+ switch (status) {
case in_spec:
- HDfprintf(stdout,
- "%sAuto cache resize -- no change. (hit rate = %lf)\n",
- cache_ptr->prefix, hit_rate);
+ HDfprintf(stdout, "%sAuto cache resize -- no change. (hit rate = %lf)\n", cache_ptr->prefix,
+ hit_rate);
break;
case increase:
- HDassert( hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold );
- HDassert( old_max_cache_size < new_max_cache_size );
-
- HDfprintf(stdout,
- "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n",
- cache_ptr->prefix, hit_rate,
- (cache_ptr->resize_ctl).lower_hr_threshold);
-
- HDfprintf(stdout,
- "%scache size increased from (%zu/%zu) to (%zu/%zu).\n",
- cache_ptr->prefix,
- old_max_cache_size,
- old_min_clean_size,
- new_max_cache_size,
- new_min_clean_size);
+ HDassert(hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold);
+ HDassert(old_max_cache_size < new_max_cache_size);
+
+ HDfprintf(stdout, "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n",
+ cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).lower_hr_threshold);
+
+ HDfprintf(stdout, "%scache size increased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix,
+ old_max_cache_size, old_min_clean_size, new_max_cache_size, new_min_clean_size);
break;
case flash_increase:
- HDassert( old_max_cache_size < new_max_cache_size );
-
- HDfprintf(stdout,
- "%sflash cache resize(%d) -- size threshold = %zu.\n",
- cache_ptr->prefix,
- (int)((cache_ptr->resize_ctl).flash_incr_mode),
- cache_ptr->flash_size_increase_threshold);
-
- HDfprintf(stdout,
- "%s cache size increased from (%zu/%zu) to (%zu/%zu).\n",
- cache_ptr->prefix,
- old_max_cache_size,
- old_min_clean_size,
- new_max_cache_size,
- new_min_clean_size);
- break;
+ HDassert(old_max_cache_size < new_max_cache_size);
+
+ HDfprintf(stdout, "%sflash cache resize(%d) -- size threshold = %zu.\n", cache_ptr->prefix,
+ (int)((cache_ptr->resize_ctl).flash_incr_mode),
+ cache_ptr->flash_size_increase_threshold);
+
+ HDfprintf(stdout, "%s cache size increased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix,
+ old_max_cache_size, old_min_clean_size, new_max_cache_size, new_min_clean_size);
+ break;
case decrease:
- HDassert( old_max_cache_size > new_max_cache_size );
+ HDassert(old_max_cache_size > new_max_cache_size);
- switch ( (cache_ptr->resize_ctl).decr_mode )
- {
+ switch ((cache_ptr->resize_ctl).decr_mode) {
case H5C_decr__off:
- HDfprintf(stdout,
- "%sAuto cache resize -- decrease off. HR = %lf\n",
- cache_ptr->prefix, hit_rate);
+ HDfprintf(stdout, "%sAuto cache resize -- decrease off. HR = %lf\n", cache_ptr->prefix,
+ hit_rate);
break;
case H5C_decr__threshold:
- HDassert( hit_rate >
- (cache_ptr->resize_ctl).upper_hr_threshold );
+ HDassert(hit_rate > (cache_ptr->resize_ctl).upper_hr_threshold);
- HDfprintf(stdout,
- "%sAuto cache resize -- decrease by threshold. HR = %lf > %6.5lf\n",
- cache_ptr->prefix, hit_rate,
- (cache_ptr->resize_ctl).upper_hr_threshold);
+ HDfprintf(stdout, "%sAuto cache resize -- decrease by threshold. HR = %lf > %6.5lf\n",
+ cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).upper_hr_threshold);
- HDfprintf(stdout, "%sout of bounds high (%6.5lf).\n",
- cache_ptr->prefix,
+ HDfprintf(stdout, "%sout of bounds high (%6.5lf).\n", cache_ptr->prefix,
(cache_ptr->resize_ctl).upper_hr_threshold);
break;
case H5C_decr__age_out:
- HDfprintf(stdout,
- "%sAuto cache resize -- decrease by ageout. HR = %lf\n",
+ HDfprintf(stdout, "%sAuto cache resize -- decrease by ageout. HR = %lf\n",
cache_ptr->prefix, hit_rate);
break;
case H5C_decr__age_out_with_threshold:
- HDassert( hit_rate >
- (cache_ptr->resize_ctl).upper_hr_threshold );
+ HDassert(hit_rate > (cache_ptr->resize_ctl).upper_hr_threshold);
HDfprintf(stdout,
"%sAuto cache resize -- decrease by ageout with threshold. HR = %lf > %6.5lf\n",
- cache_ptr->prefix, hit_rate,
- (cache_ptr->resize_ctl).upper_hr_threshold);
+ cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).upper_hr_threshold);
break;
default:
- HDfprintf(stdout,
- "%sAuto cache resize -- decrease by unknown mode. HR = %lf\n",
+ HDfprintf(stdout, "%sAuto cache resize -- decrease by unknown mode. HR = %lf\n",
cache_ptr->prefix, hit_rate);
}
- HDfprintf(stdout,
- "%s cache size decreased from (%zu/%zu) to (%zu/%zu).\n",
- cache_ptr->prefix,
- old_max_cache_size,
- old_min_clean_size,
- new_max_cache_size,
- new_min_clean_size);
+ HDfprintf(stdout, "%s cache size decreased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix,
+ old_max_cache_size, old_min_clean_size, new_max_cache_size, new_min_clean_size);
break;
case at_max_size:
- HDfprintf(stdout,
- "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n",
- cache_ptr->prefix, hit_rate,
- (cache_ptr->resize_ctl).lower_hr_threshold);
- HDfprintf(stdout,
- "%s cache already at maximum size so no change.\n",
- cache_ptr->prefix);
+ HDfprintf(stdout, "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n",
+ cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).lower_hr_threshold);
+ HDfprintf(stdout, "%s cache already at maximum size so no change.\n", cache_ptr->prefix);
break;
case at_min_size:
- HDfprintf(stdout,
- "%sAuto cache resize -- hit rate (%lf) -- can't decrease.\n",
- cache_ptr->prefix, hit_rate);
- HDfprintf(stdout, "%s cache already at minimum size.\n",
- cache_ptr->prefix);
+ HDfprintf(stdout, "%sAuto cache resize -- hit rate (%lf) -- can't decrease.\n", cache_ptr->prefix,
+ hit_rate);
+ HDfprintf(stdout, "%s cache already at minimum size.\n", cache_ptr->prefix);
break;
case increase_disabled:
- HDfprintf(stdout,
- "%sAuto cache resize -- increase disabled -- HR = %lf.",
- cache_ptr->prefix, hit_rate);
+ HDfprintf(stdout, "%sAuto cache resize -- increase disabled -- HR = %lf.", cache_ptr->prefix,
+ hit_rate);
break;
case decrease_disabled:
- HDfprintf(stdout,
- "%sAuto cache resize -- decrease disabled -- HR = %lf.\n",
- cache_ptr->prefix, hit_rate);
+ HDfprintf(stdout, "%sAuto cache resize -- decrease disabled -- HR = %lf.\n", cache_ptr->prefix,
+ hit_rate);
break;
case not_full:
- HDassert( hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold );
-
- HDfprintf(stdout,
- "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n",
- cache_ptr->prefix, hit_rate,
- (cache_ptr->resize_ctl).lower_hr_threshold);
- HDfprintf(stdout,
- "%s cache not full so no increase in size.\n",
- cache_ptr->prefix);
+ HDassert(hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold);
+
+ HDfprintf(stdout, "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n",
+ cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).lower_hr_threshold);
+ HDfprintf(stdout, "%s cache not full so no increase in size.\n", cache_ptr->prefix);
break;
default:
- HDfprintf(stdout, "%sAuto cache resize -- unknown status code.\n",
- cache_ptr->prefix);
+ HDfprintf(stdout, "%sAuto cache resize -- unknown status code.\n", cache_ptr->prefix);
break;
}
@@ -772,7 +694,6 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr,
} /* H5C_def_auto_resize_rpt_fcn() */
-
/*-------------------------------------------------------------------------
* Function: H5C__free_tag_list_cb
*
@@ -798,8 +719,7 @@ H5C__free_tag_list_cb(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED
tag_info = H5FL_FREE(H5C_tag_info_t, tag_info);
FUNC_LEAVE_NOAPI(0)
-} /* H5C__free_tag_list_cb() */
-
+} /* H5C__free_tag_list_cb() */
/*-------------------------------------------------------------------------
*
@@ -819,9 +739,9 @@ H5C__free_tag_list_cb(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED
herr_t
H5C_prep_for_file_close(H5F_t *f)
{
- H5C_t * cache_ptr;
- hbool_t image_generated = FALSE; /* Whether a cache image was generated */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr;
+ hbool_t image_generated = FALSE; /* Whether a cache image was generated */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -837,7 +757,7 @@ H5C_prep_for_file_close(H5F_t *f)
* close warning more than once -- the following
* if statement handles this.
*/
- if(cache_ptr->close_warning_received)
+ if (cache_ptr->close_warning_received)
HGOTO_DONE(SUCCEED)
cache_ptr->close_warning_received = TRUE;
@@ -845,14 +765,12 @@ H5C_prep_for_file_close(H5F_t *f)
HDassert(cache_ptr->pl_len == 0);
/* Prepare cache image */
- if(H5C__prep_image_for_file_close(f, &image_generated) < 0)
+ if (H5C__prep_image_for_file_close(f, &image_generated) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create cache image")
#ifdef H5_HAVE_PARALLEL
- if ( ( H5F_INTENT(f) & H5F_ACC_RDWR ) &&
- ( ! image_generated ) &&
- ( cache_ptr->aux_ptr != NULL ) &&
- ( f->shared->fs_persist ) ) {
+ if ((H5F_INTENT(f) & H5F_ACC_RDWR) && (!image_generated) && (cache_ptr->aux_ptr != NULL) &&
+ (f->shared->fs_persist)) {
/* If persistent free space managers are enabled, flushing the
* metadata cache may result in the deletion, insertion, and/or
* dirtying of entries.
@@ -886,16 +804,15 @@ H5C_prep_for_file_close(H5F_t *f)
* during a flush, and thus avoid any resulting entrie dirties,
* deletions, insertion, or moves during the flush.
*/
- if(H5C__serialize_cache(f) < 0)
+ if (H5C__serialize_cache(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "serialization of the cache failed")
- } /* end if */
+ } /* end if */
#endif /* H5_HAVE_PARALLEL */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_prep_for_file_close() */
-
/*-------------------------------------------------------------------------
* Function: H5C_dest
*
@@ -928,10 +845,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_dest(H5F_t * f)
+H5C_dest(H5F_t *f)
{
- H5C_t * cache_ptr = f->shared->cache;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t *cache_ptr = f->shared->cache;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -941,33 +858,32 @@ H5C_dest(H5F_t * f)
HDassert(cache_ptr->close_warning_received);
#if H5AC_DUMP_IMAGE_STATS_ON_CLOSE
- if(H5C_image_stats(cache_ptr, TRUE) < 0)
+ if (H5C_image_stats(cache_ptr, TRUE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't display cache image stats")
#endif /* H5AC_DUMP_IMAGE_STATS_ON_CLOSE */
/* Enable the slist, as it is needed in the flush */
- if ( H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0 )
+ if (H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed")
/* Flush and invalidate all cache entries */
- if ( H5C__flush_invalidate_cache(f, H5C__NO_FLAGS_SET) < 0 )
+ if (H5C__flush_invalidate_cache(f, H5C__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
/* Generate & write cache image if requested */
- if ( cache_ptr->image_ctl.generate_image ) {
+ if (cache_ptr->image_ctl.generate_image) {
- if ( H5C__generate_cache_image(f, cache_ptr) < 0 )
+ if (H5C__generate_cache_image(f, cache_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, \
- "Can't generate metadata cache image")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "Can't generate metadata cache image")
}
/* Question: Is it possible for cache_ptr->slist be non-null at this
* point? If no, shouldn't this if statement be an assert?
*/
- if ( cache_ptr->slist_ptr != NULL ) {
+ if (cache_ptr->slist_ptr != NULL) {
HDassert(cache_ptr->slist_len == 0);
HDassert(cache_ptr->slist_size == 0);
@@ -978,7 +894,7 @@ H5C_dest(H5F_t * f)
} /* end if */
- if(cache_ptr->tag_list != NULL) {
+ if (cache_ptr->tag_list != NULL) {
H5SL_destroy(cache_ptr->tag_list, H5C__free_tag_list_cb, NULL);
@@ -986,7 +902,7 @@ H5C_dest(H5F_t * f)
} /* end if */
- if(cache_ptr->log_info != NULL) {
+ if (cache_ptr->log_info != NULL) {
H5MM_xfree(cache_ptr->log_info);
}
@@ -994,11 +910,10 @@ H5C_dest(H5F_t * f)
#ifndef NDEBUG
#if H5C_DO_SANITY_CHECKS
- if ( cache_ptr->get_entry_ptr_from_addr_counter > 0 ) {
+ if (cache_ptr->get_entry_ptr_from_addr_counter > 0) {
- HDfprintf(stdout,
- "*** %" PRId64 " calls to H5C_get_entry_ptr_from_add(). ***\n",
- cache_ptr->get_entry_ptr_from_addr_counter);
+ HDfprintf(stdout, "*** %" PRId64 " calls to H5C_get_entry_ptr_from_add(). ***\n",
+ cache_ptr->get_entry_ptr_from_addr_counter);
}
#endif /* H5C_DO_SANITY_CHECKS */
@@ -1009,21 +924,19 @@ H5C_dest(H5F_t * f)
done:
- if ( ( ret_value < 0 ) && ( cache_ptr ) && ( cache_ptr->slist_ptr ) ) {
+ if ((ret_value < 0) && (cache_ptr) && (cache_ptr->slist_ptr)) {
/* need this for test code -- see change note for details */
- if ( H5C_set_slist_enabled(f->shared->cache, FALSE, FALSE) < 0 )
+ if (H5C_set_slist_enabled(f->shared->cache, FALSE, FALSE) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "disable slist on flush dest failure failed")
+ HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "disable slist on flush dest failure failed")
}
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_dest() */
-
/*-------------------------------------------------------------------------
* Function: H5C_evict
*
@@ -1045,9 +958,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_evict(H5F_t * f)
+H5C_evict(H5F_t *f)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1055,18 +968,17 @@ H5C_evict(H5F_t * f)
HDassert(f);
/* Enable the slist, as it is needed in the flush */
- if ( H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0 )
+ if (H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed")
/* Flush and invalidate all cache entries except the pinned entries */
- if ( H5C__flush_invalidate_cache(f, H5C__EVICT_ALLOW_LAST_PINS_FLAG) < 0 )
+ if (H5C__flush_invalidate_cache(f, H5C__EVICT_ALLOW_LAST_PINS_FLAG) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL,
- "unable to evict entries in the cache")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict entries in the cache")
/* Disable the slist */
- if ( H5C_set_slist_enabled(f->shared->cache, FALSE, TRUE) < 0)
+ if (H5C_set_slist_enabled(f->shared->cache, FALSE, TRUE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist disabled failed")
@@ -1074,7 +986,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_evict() */
-
/*-------------------------------------------------------------------------
* Function: H5C_expunge_entry
*
@@ -1092,10 +1003,10 @@ done:
herr_t
H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, unsigned flags)
{
- H5C_t * cache_ptr;
- H5C_cache_entry_t * entry_ptr = NULL;
- unsigned flush_flags = (H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG);
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t *entry_ptr = NULL;
+ unsigned flush_flags = (H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG);
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1108,13 +1019,13 @@ H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, unsigned flag
HDassert(H5F_addr_defined(addr));
#if H5C_DO_EXTREME_SANITY_CHECKS
- if(H5C__validate_lru_list(cache_ptr) < 0)
+ if (H5C__validate_lru_list(cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on entry")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
/* Look for entry in cache */
H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL)
- if((entry_ptr == NULL) || (entry_ptr->type != type))
+ if ((entry_ptr == NULL) || (entry_ptr->type != type))
/* the target doesn't exist in the cache, so we are done. */
HGOTO_DONE(SUCCEED)
@@ -1122,9 +1033,9 @@ H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, unsigned flag
HDassert(entry_ptr->type == type);
/* Check for entry being pinned or protected */
- if(entry_ptr->is_protected)
+ if (entry_ptr->is_protected)
HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is protected")
- if(entry_ptr->is_pinned)
+ if (entry_ptr->is_pinned)
HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is pinned")
/* If we get this far, call H5C__flush_single_entry() with the
@@ -1138,19 +1049,18 @@ H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, unsigned flag
/* Delete the entry from the skip list on destroy */
flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG;
- if(H5C__flush_single_entry(f, entry_ptr, flush_flags) < 0)
+ if (H5C__flush_single_entry(f, entry_ptr, flush_flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "can't flush entry")
done:
#if H5C_DO_EXTREME_SANITY_CHECKS
- if(H5C__validate_lru_list(cache_ptr) < 0)
+ if (H5C__validate_lru_list(cache_ptr) < 0)
HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on exit")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_expunge_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5C_flush_cache
*
@@ -1202,18 +1112,18 @@ herr_t
H5C_flush_cache(H5F_t *f, unsigned flags)
{
#if H5C_DO_SANITY_CHECKS
- int i;
- uint32_t index_len = 0;
- size_t index_size = (size_t)0;
- size_t clean_index_size = (size_t)0;
- size_t dirty_index_size = (size_t)0;
- size_t slist_size = (size_t)0;
- uint32_t slist_len = 0;
+ int i;
+ uint32_t index_len = 0;
+ size_t index_size = (size_t)0;
+ size_t clean_index_size = (size_t)0;
+ size_t dirty_index_size = (size_t)0;
+ size_t slist_size = (size_t)0;
+ uint32_t slist_len = 0;
#endif /* H5C_DO_SANITY_CHECKS */
- H5C_ring_t ring;
- H5C_t * cache_ptr;
- hbool_t destroy;
- herr_t ret_value = SUCCEED;
+ H5C_ring_t ring;
+ H5C_t * cache_ptr;
+ hbool_t destroy;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
@@ -1232,13 +1142,13 @@ H5C_flush_cache(H5F_t *f, unsigned flags)
HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0);
HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
- for(i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) {
+ for (i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) {
index_len += cache_ptr->index_ring_len[i];
index_size += cache_ptr->index_ring_size[i];
clean_index_size += cache_ptr->clean_index_ring_size[i];
dirty_index_size += cache_ptr->dirty_index_ring_size[i];
- slist_len += cache_ptr->slist_ring_len[i];
+ slist_len += cache_ptr->slist_ring_len[i];
slist_size += cache_ptr->slist_ring_size[i];
} /* end for */
@@ -1251,66 +1161,65 @@ H5C_flush_cache(H5F_t *f, unsigned flags)
#endif /* H5C_DO_SANITY_CHECKS */
#if H5C_DO_EXTREME_SANITY_CHECKS
- if((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C__validate_pinned_entry_list(cache_ptr) < 0) ||
- (H5C__validate_lru_list(cache_ptr) < 0))
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
- destroy = ( (flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 );
- HDassert( ! ( destroy && ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 )) );
- HDassert( ! ( cache_ptr->flush_in_progress ) );
+ destroy = ((flags & H5C__FLUSH_INVALIDATE_FLAG) != 0);
+ HDassert(!(destroy && ((flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0)));
+ HDassert(!(cache_ptr->flush_in_progress));
cache_ptr->flush_in_progress = TRUE;
- if(destroy) {
- if(H5C__flush_invalidate_cache(f, flags) < 0)
+ if (destroy) {
+ if (H5C__flush_invalidate_cache(f, flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate failed")
} /* end if */
else {
- /* flush each ring, starting from the outermost ring and
+ /* flush each ring, starting from the outermost ring and
* working inward.
*/
ring = H5C_RING_USER;
- while(ring < H5C_RING_NTYPES) {
+ while (ring < H5C_RING_NTYPES) {
/* Only call the free space manager settle routines when close
* warning has been received.
*/
- if(cache_ptr->close_warning_received) {
- switch(ring) {
- case H5C_RING_USER:
- break;
+ if (cache_ptr->close_warning_received) {
+ switch (ring) {
+ case H5C_RING_USER:
+ break;
- case H5C_RING_RDFSM:
+ case H5C_RING_RDFSM:
/* Settle raw data FSM */
- if(!cache_ptr->rdfsm_settled)
- if(H5MF_settle_raw_data_fsm(f, &cache_ptr->rdfsm_settled) < 0)
+ if (!cache_ptr->rdfsm_settled)
+ if (H5MF_settle_raw_data_fsm(f, &cache_ptr->rdfsm_settled) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "RD FSM settle failed")
- break;
+ break;
- case H5C_RING_MDFSM:
+ case H5C_RING_MDFSM:
/* Settle metadata FSM */
- if(!cache_ptr->mdfsm_settled)
- if(H5MF_settle_meta_data_fsm(f, &cache_ptr->mdfsm_settled) < 0)
+ if (!cache_ptr->mdfsm_settled)
+ if (H5MF_settle_meta_data_fsm(f, &cache_ptr->mdfsm_settled) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "MD FSM settle failed")
- break;
+ break;
- case H5C_RING_SBE:
- case H5C_RING_SB:
- break;
+ case H5C_RING_SBE:
+ case H5C_RING_SB:
+ break;
- default:
+ default:
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown ring?!?!")
- break;
- } /* end switch */
- } /* end if */
+ break;
+ } /* end switch */
+ } /* end if */
- if(H5C__flush_ring(f, ring, flags) < 0)
+ if (H5C__flush_ring(f, ring, flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush ring failed")
ring++;
} /* end while */
- } /* end else */
+ } /* end else */
done:
cache_ptr->flush_in_progress = FALSE;
@@ -1318,7 +1227,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_flush_cache() */
-
/*-------------------------------------------------------------------------
* Function: H5C_flush_to_min_clean
*
@@ -1344,40 +1252,39 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_flush_to_min_clean(H5F_t * f)
+H5C_flush_to_min_clean(H5F_t *f)
{
- H5C_t * cache_ptr;
- hbool_t write_permitted;
- herr_t ret_value = SUCCEED;
+ H5C_t * cache_ptr;
+ hbool_t write_permitted;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
- HDassert( f );
- HDassert( f->shared );
+ HDassert(f);
+ HDassert(f->shared);
cache_ptr = f->shared->cache;
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- if(cache_ptr->check_write_permitted != NULL) {
- if((cache_ptr->check_write_permitted)(f, &write_permitted) < 0)
+ if (cache_ptr->check_write_permitted != NULL) {
+ if ((cache_ptr->check_write_permitted)(f, &write_permitted) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't get write_permitted")
} /* end if */
else
write_permitted = cache_ptr->write_permitted;
- if(!write_permitted)
+ if (!write_permitted)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "cache write is not permitted!?!")
- if(H5C__make_space_in_cache(f, (size_t)0, write_permitted) < 0)
+ if (H5C__make_space_in_cache(f, (size_t)0, write_permitted) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C__make_space_in_cache failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_flush_to_min_clean() */
-
/*-------------------------------------------------------------------------
* Function: H5C_insert_entry
*
@@ -1395,54 +1302,49 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_insert_entry(H5F_t * f,
- const H5C_class_t * type,
- haddr_t addr,
- void * thing,
- unsigned int flags)
+H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, unsigned int flags)
{
- H5C_t *cache_ptr;
- H5AC_ring_t ring = H5C_RING_UNDEFINED;
- hbool_t insert_pinned;
- hbool_t flush_last;
+ H5C_t * cache_ptr;
+ H5AC_ring_t ring = H5C_RING_UNDEFINED;
+ hbool_t insert_pinned;
+ hbool_t flush_last;
#ifdef H5_HAVE_PARALLEL
- hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */
-#endif /* H5_HAVE_PARALLEL */
- hbool_t set_flush_marker;
- hbool_t write_permitted = TRUE;
- size_t empty_space;
- H5C_cache_entry_t *entry_ptr = NULL;
- H5C_cache_entry_t *test_entry_ptr;
- hbool_t entry_tagged = FALSE;
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */
+#endif /* H5_HAVE_PARALLEL */
+ hbool_t set_flush_marker;
+ hbool_t write_permitted = TRUE;
+ size_t empty_space;
+ H5C_cache_entry_t *entry_ptr = NULL;
+ H5C_cache_entry_t *test_entry_ptr;
+ hbool_t entry_tagged = FALSE;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- HDassert( f );
- HDassert( f->shared );
+ HDassert(f);
+ HDassert(f->shared);
cache_ptr = f->shared->cache;
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( type );
- HDassert( type->mem_type == cache_ptr->class_table_ptr[type->id]->mem_type );
- HDassert( type->image_len );
- HDassert( H5F_addr_defined(addr) );
- HDassert( thing );
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(type);
+ HDassert(type->mem_type == cache_ptr->class_table_ptr[type->id]->mem_type);
+ HDassert(type->image_len);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(thing);
#if H5C_DO_EXTREME_SANITY_CHECKS
/* no need to verify that entry is not already in the index as */
/* we already make that check below. */
- if((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C__validate_pinned_entry_list(cache_ptr) < 0) ||
- (H5C__validate_lru_list(cache_ptr) < 0))
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
- set_flush_marker = ( (flags & H5C__SET_FLUSH_MARKER_FLAG) != 0 );
- insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 );
- flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 );
+ set_flush_marker = ((flags & H5C__SET_FLUSH_MARKER_FLAG) != 0);
+ insert_pinned = ((flags & H5C__PIN_ENTRY_FLAG) != 0);
+ flush_last = ((flags & H5C__FLUSH_LAST_FLAG) != 0);
/* Get the ring type from the API context */
ring = H5CX_get_ring();
@@ -1455,60 +1357,60 @@ H5C_insert_entry(H5F_t * f,
H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL)
- if(test_entry_ptr != NULL) {
- if(test_entry_ptr == entry_ptr)
+ if (test_entry_ptr != NULL) {
+ if (test_entry_ptr == entry_ptr)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "entry already in cache")
else
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "duplicate entry in cache")
} /* end if */
- entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
+ entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
entry_ptr->cache_ptr = cache_ptr;
- entry_ptr->addr = addr;
- entry_ptr->type = type;
+ entry_ptr->addr = addr;
+ entry_ptr->type = type;
- entry_ptr->image_ptr = NULL;
+ entry_ptr->image_ptr = NULL;
entry_ptr->image_up_to_date = FALSE;
entry_ptr->is_protected = FALSE;
entry_ptr->is_read_only = FALSE;
entry_ptr->ro_ref_count = 0;
- entry_ptr->is_pinned = insert_pinned;
+ entry_ptr->is_pinned = insert_pinned;
entry_ptr->pinned_from_client = insert_pinned;
- entry_ptr->pinned_from_cache = FALSE;
- entry_ptr->flush_me_last = flush_last;
+ entry_ptr->pinned_from_cache = FALSE;
+ entry_ptr->flush_me_last = flush_last;
/* newly inserted entries are assumed to be dirty */
entry_ptr->is_dirty = TRUE;
/* not protected, so can't be dirtied */
- entry_ptr->dirtied = FALSE;
+ entry_ptr->dirtied = FALSE;
/* Retrieve the size of the thing */
- if((type->image_len)(thing, &(entry_ptr->size)) < 0)
+ if ((type->image_len)(thing, &(entry_ptr->size)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGETSIZE, FAIL, "can't get size of thing")
- HDassert(entry_ptr->size > 0 && entry_ptr->size < H5C_MAX_ENTRY_SIZE);
+ HDassert(entry_ptr->size > 0 && entry_ptr->size < H5C_MAX_ENTRY_SIZE);
entry_ptr->in_slist = FALSE;
#ifdef H5_HAVE_PARALLEL
entry_ptr->clear_on_unprotect = FALSE;
- entry_ptr->flush_immediately = FALSE;
+ entry_ptr->flush_immediately = FALSE;
#endif /* H5_HAVE_PARALLEL */
- entry_ptr->flush_in_progress = FALSE;
+ entry_ptr->flush_in_progress = FALSE;
entry_ptr->destroy_in_progress = FALSE;
entry_ptr->ring = ring;
/* Initialize flush dependency fields */
- entry_ptr->flush_dep_parent = NULL;
- entry_ptr->flush_dep_nparents = 0;
- entry_ptr->flush_dep_parent_nalloc = 0;
- entry_ptr->flush_dep_nchildren = 0;
- entry_ptr->flush_dep_ndirty_children = 0;
- entry_ptr->flush_dep_nunser_children = 0;
+ entry_ptr->flush_dep_parent = NULL;
+ entry_ptr->flush_dep_nparents = 0;
+ entry_ptr->flush_dep_parent_nalloc = 0;
+ entry_ptr->flush_dep_nchildren = 0;
+ entry_ptr->flush_dep_ndirty_children = 0;
+ entry_ptr->flush_dep_nunser_children = 0;
entry_ptr->ht_next = NULL;
entry_ptr->ht_prev = NULL;
@@ -1529,20 +1431,20 @@ H5C_insert_entry(H5F_t * f,
#endif /* H5_HAVE_PARALLEL */
/* initialize cache image related fields */
- entry_ptr->include_in_image = FALSE;
- entry_ptr->lru_rank = 0;
- entry_ptr->image_dirty = FALSE;
- entry_ptr->fd_parent_count = 0;
- entry_ptr->fd_parent_addrs = NULL;
- entry_ptr->fd_child_count = 0;
- entry_ptr->fd_dirty_child_count = 0;
- entry_ptr->image_fd_height = 0;
- entry_ptr->prefetched = FALSE;
- entry_ptr->prefetch_type_id = 0;
- entry_ptr->age = 0;
- entry_ptr->prefetched_dirty = FALSE;
-#ifndef NDEBUG /* debugging field */
- entry_ptr->serialization_count = 0;
+ entry_ptr->include_in_image = FALSE;
+ entry_ptr->lru_rank = 0;
+ entry_ptr->image_dirty = FALSE;
+ entry_ptr->fd_parent_count = 0;
+ entry_ptr->fd_parent_addrs = NULL;
+ entry_ptr->fd_child_count = 0;
+ entry_ptr->fd_dirty_child_count = 0;
+ entry_ptr->image_fd_height = 0;
+ entry_ptr->prefetched = FALSE;
+ entry_ptr->prefetch_type_id = 0;
+ entry_ptr->age = 0;
+ entry_ptr->prefetched_dirty = FALSE;
+#ifndef NDEBUG /* debugging field */
+ entry_ptr->serialization_count = 0;
#endif /* NDEBUG */
entry_ptr->tl_next = NULL;
@@ -1550,33 +1452,32 @@ H5C_insert_entry(H5F_t * f,
entry_ptr->tag_info = NULL;
/* Apply tag to newly inserted entry */
- if(H5C__tag_entry(cache_ptr, entry_ptr) < 0)
+ if (H5C__tag_entry(cache_ptr, entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Cannot tag metadata entry")
entry_tagged = TRUE;
H5C__RESET_CACHE_ENTRY_STATS(entry_ptr)
- if(cache_ptr->flash_size_increase_possible &&
- (entry_ptr->size > cache_ptr->flash_size_increase_threshold))
- if(H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0)
+ if (cache_ptr->flash_size_increase_possible &&
+ (entry_ptr->size > cache_ptr->flash_size_increase_threshold))
+ if (H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C__flash_increase_cache_size failed")
- if(cache_ptr->index_size >= cache_ptr->max_cache_size)
+ if (cache_ptr->index_size >= cache_ptr->max_cache_size)
empty_space = 0;
else
empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
- if(cache_ptr->evictions_enabled &&
- (((cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size)
- ||
- (((empty_space + cache_ptr->clean_index_size) < cache_ptr->min_clean_size)))) {
+ if (cache_ptr->evictions_enabled &&
+ (((cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size) ||
+ (((empty_space + cache_ptr->clean_index_size) < cache_ptr->min_clean_size)))) {
size_t space_needed;
- if(empty_space <= entry_ptr->size)
+ if (empty_space <= entry_ptr->size)
cache_ptr->cache_full = TRUE;
- if(cache_ptr->check_write_permitted != NULL) {
- if((cache_ptr->check_write_permitted)(f, &write_permitted) < 0)
+ if (cache_ptr->check_write_permitted != NULL) {
+ if ((cache_ptr->check_write_permitted)(f, &write_permitted) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "Can't get write_permitted")
} /* end if */
else
@@ -1584,7 +1485,7 @@ H5C_insert_entry(H5F_t * f,
HDassert(entry_ptr->size <= H5C_MAX_ENTRY_SIZE);
space_needed = entry_ptr->size;
- if(space_needed > cache_ptr->max_cache_size)
+ if (space_needed > cache_ptr->max_cache_size)
space_needed = cache_ptr->max_cache_size;
/* Note that space_needed is just the amount of space that
@@ -1612,7 +1513,7 @@ H5C_insert_entry(H5F_t * f,
* no point in worrying about the third.
*/
- if(H5C__make_space_in_cache(f, space_needed, write_permitted) < 0)
+ if (H5C__make_space_in_cache(f, space_needed, write_permitted) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C__make_space_in_cache failed")
} /* end if */
@@ -1625,52 +1526,48 @@ H5C_insert_entry(H5F_t * f,
H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, FAIL)
#if H5C_DO_EXTREME_SANITY_CHECKS
- if((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C__validate_pinned_entry_list(cache_ptr) < 0) ||
- (H5C__validate_lru_list(cache_ptr) < 0))
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed just before done")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
/* If the entry's type has a 'notify' callback send a 'after insertion'
* notice now that the entry is fully integrated into the cache.
*/
- if(entry_ptr->type->notify &&
- (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_INSERT, entry_ptr) < 0)
+ if (entry_ptr->type->notify && (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_INSERT, entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry inserted into cache")
H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr)
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI))
+ if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI))
coll_access = H5CX_get_coll_metadata_read();
entry_ptr->coll_access = coll_access;
- if(coll_access) {
+ if (coll_access) {
H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, FAIL)
/* Make sure the size of the collective entries in the cache remain in check */
- if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100)
- if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
+ if (cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100)
+ if (H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries")
} /* end if */
#endif
done:
#if H5C_DO_EXTREME_SANITY_CHECKS
- if((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C__validate_pinned_entry_list(cache_ptr) < 0) ||
- (H5C__validate_lru_list(cache_ptr) < 0))
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0))
HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
- if(ret_value < 0 && entry_tagged)
- if(H5C__untag_entry(cache_ptr, entry_ptr) < 0)
+ if (ret_value < 0 && entry_tagged)
+ if (H5C__untag_entry(cache_ptr, entry_ptr) < 0)
HDONE_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_insert_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5C_mark_entry_dirty
*
@@ -1701,9 +1598,9 @@ done:
herr_t
H5C_mark_entry_dirty(void *thing)
{
- H5C_t * cache_ptr;
- H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)thing;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1714,62 +1611,64 @@ H5C_mark_entry_dirty(void *thing)
HDassert(cache_ptr);
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- if ( entry_ptr->is_protected ) {
- HDassert( ! ((entry_ptr)->is_read_only) );
+ if (entry_ptr->is_protected) {
+ HDassert(!((entry_ptr)->is_read_only));
/* set the dirtied flag */
entry_ptr->dirtied = TRUE;
/* reset image_up_to_date */
- if(entry_ptr->image_up_to_date) {
+ if (entry_ptr->image_up_to_date) {
entry_ptr->image_up_to_date = FALSE;
- if(entry_ptr->flush_dep_nparents > 0)
- if(H5C__mark_flush_dep_unserialized(entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "Can't propagate serialization status to fd parents")
- }/* end if */
- } /* end if */
- else if ( entry_ptr->is_pinned ) {
- hbool_t was_clean; /* Whether the entry was previously clean */
- hbool_t image_was_up_to_date;
+ if (entry_ptr->flush_dep_nparents > 0)
+ if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "Can't propagate serialization status to fd parents")
+ } /* end if */
+ } /* end if */
+ else if (entry_ptr->is_pinned) {
+ hbool_t was_clean; /* Whether the entry was previously clean */
+ hbool_t image_was_up_to_date;
/* Remember previous dirty status */
- was_clean = !entry_ptr->is_dirty;
+ was_clean = !entry_ptr->is_dirty;
/* Check if image is up to date */
image_was_up_to_date = entry_ptr->image_up_to_date;
/* Mark the entry as dirty if it isn't already */
- entry_ptr->is_dirty = TRUE;
- entry_ptr->image_up_to_date = FALSE;
+ entry_ptr->is_dirty = TRUE;
+ entry_ptr->image_up_to_date = FALSE;
/* Modify cache data structures */
- if(was_clean)
+ if (was_clean)
H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr)
- if(!entry_ptr->in_slist)
+ if (!entry_ptr->in_slist)
H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
/* Update stats for entry being marked dirty */
H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr)
/* Check for entry changing status and do notifications, etc. */
- if(was_clean) {
+ if (was_clean) {
/* If the entry's type has a 'notify' callback send a 'entry dirtied'
* notice now that the entry is fully integrated into the cache.
*/
- if(entry_ptr->type->notify &&
- (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0)
+ if (entry_ptr->type->notify &&
+ (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag set")
/* Propagate the dirty flag up the flush dependency chain if appropriate */
- if(entry_ptr->flush_dep_nparents > 0)
- if(H5C__mark_flush_dep_dirty(entry_ptr) < 0)
+ if (entry_ptr->flush_dep_nparents > 0)
+ if (H5C__mark_flush_dep_dirty(entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag")
} /* end if */
- if(image_was_up_to_date)
- if(entry_ptr->flush_dep_nparents > 0)
- if(H5C__mark_flush_dep_unserialized(entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "Can't propagate serialization status to fd parents")
+ if (image_was_up_to_date)
+ if (entry_ptr->flush_dep_nparents > 0)
+ if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "Can't propagate serialization status to fd parents")
} /* end if */
else
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry is neither pinned nor protected??")
@@ -1778,7 +1677,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_mark_entry_dirty() */
-
/*-------------------------------------------------------------------------
* Function: H5C_mark_entry_clean
*
@@ -1798,9 +1696,9 @@ done:
herr_t
H5C_mark_entry_clean(void *_thing)
{
- H5C_t * cache_ptr;
- H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)_thing;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)_thing;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1812,10 +1710,10 @@ H5C_mark_entry_clean(void *_thing)
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* Operate on pinned entry */
- if(entry_ptr->is_protected)
+ if (entry_ptr->is_protected)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "entry is protected")
- else if(entry_ptr->is_pinned) {
- hbool_t was_dirty; /* Whether the entry was previously dirty */
+ else if (entry_ptr->is_pinned) {
+ hbool_t was_dirty; /* Whether the entry was previously dirty */
/* Remember previous dirty status */
was_dirty = entry_ptr->is_dirty;
@@ -1827,29 +1725,30 @@ H5C_mark_entry_clean(void *_thing)
entry_ptr->flush_marker = FALSE;
/* Modify cache data structures */
- if(was_dirty)
+ if (was_dirty)
H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr)
- if(entry_ptr->in_slist)
+ if (entry_ptr->in_slist)
H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE)
/* Update stats for entry being marked clean */
H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr)
/* Check for entry changing status and do notifications, etc. */
- if(was_dirty) {
+ if (was_dirty) {
/* If the entry's type has a 'notify' callback send a 'entry cleaned'
* notice now that the entry is fully integrated into the cache.
*/
- if(entry_ptr->type->notify &&
- (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag cleared")
+ if (entry_ptr->type->notify &&
+ (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify client about entry dirty flag cleared")
/* Propagate the clean up the flush dependency chain, if appropriate */
- if(entry_ptr->flush_dep_nparents > 0)
- if(H5C__mark_flush_dep_clean(entry_ptr) < 0)
+ if (entry_ptr->flush_dep_nparents > 0)
+ if (H5C__mark_flush_dep_clean(entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "Can't propagate flush dep clean")
} /* end if */
- } /* end if */
+ } /* end if */
else
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "Entry is not pinned??")
@@ -1857,7 +1756,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_mark_entry_clean() */
-
/*-------------------------------------------------------------------------
* Function: H5C_mark_entry_unserialized
*
@@ -1874,8 +1772,8 @@ done:
herr_t
H5C_mark_entry_unserialized(void *thing)
{
- H5C_cache_entry_t *entry = (H5C_cache_entry_t *)thing;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_cache_entry_t *entry = (H5C_cache_entry_t *)thing;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1883,26 +1781,27 @@ H5C_mark_entry_unserialized(void *thing)
HDassert(entry);
HDassert(H5F_addr_defined(entry->addr));
- if(entry->is_protected || entry->is_pinned) {
+ if (entry->is_protected || entry->is_pinned) {
HDassert(!entry->is_read_only);
/* Reset image_up_to_date */
- if(entry->image_up_to_date) {
- entry->image_up_to_date = FALSE;
+ if (entry->image_up_to_date) {
+ entry->image_up_to_date = FALSE;
- if(entry->flush_dep_nparents > 0)
- if(H5C__mark_flush_dep_unserialized(entry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "Can't propagate serialization status to fd parents")
- }/* end if */
- } /* end if */
+ if (entry->flush_dep_nparents > 0)
+ if (H5C__mark_flush_dep_unserialized(entry) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL,
+ "Can't propagate serialization status to fd parents")
+ } /* end if */
+ } /* end if */
else
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKUNSERIALIZED, FAIL, "Entry to unserialize is neither pinned nor protected??")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKUNSERIALIZED, FAIL,
+ "Entry to unserialize is neither pinned nor protected??")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_mark_entry_unserialized() */
-
/*-------------------------------------------------------------------------
* Function: H5C_mark_entry_serialized
*
@@ -1919,8 +1818,8 @@ done:
herr_t
H5C_mark_entry_serialized(void *_thing)
{
- H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_thing;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_thing;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1929,20 +1828,21 @@ H5C_mark_entry_serialized(void *_thing)
HDassert(H5F_addr_defined(entry->addr));
/* Operate on pinned entry */
- if(entry->is_protected)
+ if (entry->is_protected)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKSERIALIZED, FAIL, "entry is protected")
- else if(entry->is_pinned) {
+ else if (entry->is_pinned) {
/* Check for entry changing status and do notifications, etc. */
- if(!entry->image_up_to_date) {
- /* Set the image_up_to_date flag */
+ if (!entry->image_up_to_date) {
+ /* Set the image_up_to_date flag */
entry->image_up_to_date = TRUE;
/* Propagate the serialize up the flush dependency chain, if appropriate */
- if(entry->flush_dep_nparents > 0)
- if(H5C__mark_flush_dep_serialized(entry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKSERIALIZED, FAIL, "Can't propagate flush dep serialize")
+ if (entry->flush_dep_nparents > 0)
+ if (H5C__mark_flush_dep_serialized(entry) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKSERIALIZED, FAIL,
+ "Can't propagate flush dep serialize")
} /* end if */
- } /* end if */
+ } /* end if */
else
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKSERIALIZED, FAIL, "Entry is not pinned??")
@@ -1950,7 +1850,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_mark_entry_serialized() */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_move_entry
@@ -1966,14 +1865,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_move_entry(H5C_t * cache_ptr,
- const H5C_class_t * type,
- haddr_t old_addr,
- haddr_t new_addr)
+H5C_move_entry(H5C_t *cache_ptr, const H5C_class_t *type, haddr_t old_addr, haddr_t new_addr)
{
- H5C_cache_entry_t * entry_ptr = NULL;
- H5C_cache_entry_t * test_entry_ptr = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_cache_entry_t *entry_ptr = NULL;
+ H5C_cache_entry_t *test_entry_ptr = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1985,15 +1881,14 @@ H5C_move_entry(H5C_t * cache_ptr,
HDassert(H5F_addr_ne(old_addr, new_addr));
#if H5C_DO_EXTREME_SANITY_CHECKS
- if((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C__validate_pinned_entry_list(cache_ptr) < 0) ||
- (H5C__validate_lru_list(cache_ptr) < 0))
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
H5C__SEARCH_INDEX(cache_ptr, old_addr, entry_ptr, FAIL)
- if(entry_ptr == NULL || entry_ptr->type != type)
+ if (entry_ptr == NULL || entry_ptr->type != type)
/* the old item doesn't exist in the cache, so we are done. */
HGOTO_DONE(SUCCEED)
@@ -2004,13 +1899,13 @@ H5C_move_entry(H5C_t * cache_ptr,
/* (Moving a R/O entry would mark it dirty, which shouldn't
* happen. QAK - 2016/12/02)
*/
- if(entry_ptr->is_read_only)
+ if (entry_ptr->is_read_only)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "can't move R/O entry")
H5C__SEARCH_INDEX(cache_ptr, new_addr, test_entry_ptr, FAIL)
- if(test_entry_ptr != NULL) { /* we are hosed */
- if(test_entry_ptr->type == type)
+ if (test_entry_ptr != NULL) { /* we are hosed */
+ if (test_entry_ptr->type == type)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "target already moved & reinserted???")
else
HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "new address already in use?")
@@ -2031,32 +1926,33 @@ H5C_move_entry(H5C_t * cache_ptr,
* change the addr. If the entry is only in the process of being flushed,
* don't mark it as dirty either, lest we confuse the flush call back.
*/
- if(!entry_ptr->destroy_in_progress) {
+ if (!entry_ptr->destroy_in_progress) {
H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL)
- if(entry_ptr->in_slist) {
+ if (entry_ptr->in_slist) {
HDassert(cache_ptr->slist_ptr);
H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE)
} /* end if */
- } /* end if */
+ } /* end if */
entry_ptr->addr = new_addr;
- if(!entry_ptr->destroy_in_progress) {
- hbool_t was_dirty; /* Whether the entry was previously dirty */
+ if (!entry_ptr->destroy_in_progress) {
+ hbool_t was_dirty; /* Whether the entry was previously dirty */
/* Remember previous dirty status */
was_dirty = entry_ptr->is_dirty;
/* Mark the entry as dirty if it isn't already */
- entry_ptr->is_dirty = TRUE;
+ entry_ptr->is_dirty = TRUE;
- /* This shouldn't be needed, but it keeps the test code happy */
- if(entry_ptr->image_up_to_date) {
+ /* This shouldn't be needed, but it keeps the test code happy */
+ if (entry_ptr->image_up_to_date) {
entry_ptr->image_up_to_date = FALSE;
- if(entry_ptr->flush_dep_nparents > 0)
- if(H5C__mark_flush_dep_unserialized(entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "Can't propagate serialization status to fd parents")
+ if (entry_ptr->flush_dep_nparents > 0)
+ if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "Can't propagate serialization status to fd parents")
} /* end if */
/* Modify cache data structures */
@@ -2064,41 +1960,41 @@ H5C_move_entry(H5C_t * cache_ptr,
H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
/* Skip some actions if we're in the middle of flushing the entry */
- if(!entry_ptr->flush_in_progress) {
+ if (!entry_ptr->flush_in_progress) {
/* Update the replacement policy for the entry */
H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, FAIL)
/* Check for entry changing status and do notifications, etc. */
- if(!was_dirty) {
+ if (!was_dirty) {
/* If the entry's type has a 'notify' callback send a 'entry dirtied'
* notice now that the entry is fully integrated into the cache.
*/
- if(entry_ptr->type->notify &&
- (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag set")
+ if (entry_ptr->type->notify &&
+ (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify client about entry dirty flag set")
/* Propagate the dirty flag up the flush dependency chain if appropriate */
- if(entry_ptr->flush_dep_nparents > 0)
- if(H5C__mark_flush_dep_dirty(entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag")
+ if (entry_ptr->flush_dep_nparents > 0)
+ if (H5C__mark_flush_dep_dirty(entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL,
+ "Can't propagate flush dep dirty flag")
} /* end if */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr)
done:
#if H5C_DO_EXTREME_SANITY_CHECKS
- if((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C__validate_pinned_entry_list(cache_ptr) < 0) ||
- (H5C__validate_lru_list(cache_ptr) < 0))
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0))
HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_move_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5C_resize_entry
*
@@ -2118,9 +2014,9 @@ done:
herr_t
H5C_resize_entry(void *thing, size_t new_size)
{
- H5C_t * cache_ptr;
- H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)thing;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2132,20 +2028,20 @@ H5C_resize_entry(void *thing, size_t new_size)
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* Check for usage errors */
- if(new_size <= 0)
+ if (new_size <= 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "New size is non-positive")
- if(!(entry_ptr->is_pinned || entry_ptr->is_protected))
+ if (!(entry_ptr->is_pinned || entry_ptr->is_protected))
HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "Entry isn't pinned or protected??")
#if H5C_DO_EXTREME_SANITY_CHECKS
- if((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C__validate_pinned_entry_list(cache_ptr) < 0))
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
/* update for change in entry size if necessary */
- if ( entry_ptr->size != new_size ) {
- hbool_t was_clean;
+ if (entry_ptr->size != new_size) {
+ hbool_t was_clean;
/* make note of whether the entry was clean to begin with */
was_clean = !entry_ptr->is_dirty;
@@ -2154,99 +2050,95 @@ H5C_resize_entry(void *thing, size_t new_size)
entry_ptr->is_dirty = TRUE;
/* Reset the image up-to-date status */
- if(entry_ptr->image_up_to_date) {
+ if (entry_ptr->image_up_to_date) {
entry_ptr->image_up_to_date = FALSE;
- if(entry_ptr->flush_dep_nparents > 0)
- if(H5C__mark_flush_dep_unserialized(entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "Can't propagate serialization status to fd parents")
+ if (entry_ptr->flush_dep_nparents > 0)
+ if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "Can't propagate serialization status to fd parents")
} /* end if */
/* Release the current image */
- if(entry_ptr->image_ptr)
+ if (entry_ptr->image_ptr)
entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr);
/* do a flash cache size increase if appropriate */
- if ( cache_ptr->flash_size_increase_possible ) {
+ if (cache_ptr->flash_size_increase_possible) {
- if ( new_size > entry_ptr->size ) {
- size_t size_increase;
+ if (new_size > entry_ptr->size) {
+ size_t size_increase;
size_increase = new_size - entry_ptr->size;
- if(size_increase >= cache_ptr->flash_size_increase_threshold) {
- if(H5C__flash_increase_cache_size(cache_ptr, entry_ptr->size, new_size) < 0)
+ if (size_increase >= cache_ptr->flash_size_increase_threshold) {
+ if (H5C__flash_increase_cache_size(cache_ptr, entry_ptr->size, new_size) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "flash cache increase failed")
}
}
}
/* update the pinned and/or protected entry list */
- if(entry_ptr->is_pinned) {
- H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pel_len), \
- (cache_ptr->pel_size), \
- (entry_ptr->size), (new_size))
+ if (entry_ptr->is_pinned) {
+ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pel_len), (cache_ptr->pel_size), (entry_ptr->size),
+ (new_size))
} /* end if */
- if(entry_ptr->is_protected) {
- H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pl_len), \
- (cache_ptr->pl_size), \
- (entry_ptr->size), (new_size))
+ if (entry_ptr->is_protected) {
+ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pl_len), (cache_ptr->pl_size), (entry_ptr->size),
+ (new_size))
} /* end if */
#ifdef H5_HAVE_PARALLEL
- if(entry_ptr->coll_access) {
- H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->coll_list_len), \
- (cache_ptr->coll_list_size), \
+ if (entry_ptr->coll_access) {
+ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->coll_list_len), (cache_ptr->coll_list_size),
(entry_ptr->size), (new_size))
} /* end if */
-#endif /* H5_HAVE_PARALLEL */
+#endif /* H5_HAVE_PARALLEL */
/* update statistics just before changing the entry size */
- H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_size);
+ H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_size);
/* update the hash table */
- H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \
- new_size, entry_ptr, was_clean);
+ H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_size, entry_ptr, was_clean);
/* if the entry is in the skip list, update that too */
- if(entry_ptr->in_slist)
- H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_size);
+ if (entry_ptr->in_slist)
+ H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_size);
- /* finally, update the entry size proper */
- entry_ptr->size = new_size;
+ /* finally, update the entry size proper */
+ entry_ptr->size = new_size;
- if(!entry_ptr->in_slist)
+ if (!entry_ptr->in_slist)
H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
- if(entry_ptr->is_pinned)
+ if (entry_ptr->is_pinned)
H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr)
/* Check for entry changing status and do notifications, etc. */
- if(was_clean) {
+ if (was_clean) {
/* If the entry's type has a 'notify' callback send a 'entry dirtied'
* notice now that the entry is fully integrated into the cache.
*/
- if(entry_ptr->type->notify &&
- (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0)
+ if (entry_ptr->type->notify &&
+ (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag set")
/* Propagate the dirty flag up the flush dependency chain if appropriate */
- if(entry_ptr->flush_dep_nparents > 0)
- if(H5C__mark_flush_dep_dirty(entry_ptr) < 0)
+ if (entry_ptr->flush_dep_nparents > 0)
+ if (H5C__mark_flush_dep_dirty(entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag")
} /* end if */
- } /* end if */
+ } /* end if */
done:
#if H5C_DO_EXTREME_SANITY_CHECKS
- if((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C__validate_pinned_entry_list(cache_ptr) < 0))
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0))
HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_resize_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5C_pin_protected_entry()
*
@@ -2266,9 +2158,9 @@ done:
herr_t
H5C_pin_protected_entry(void *thing)
{
- H5C_t * cache_ptr;
- H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; /* Pointer to entry to pin */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)thing; /* Pointer to entry to pin */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2280,33 +2172,29 @@ H5C_pin_protected_entry(void *thing)
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
#if H5C_DO_EXTREME_SANITY_CHECKS
- if((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C__validate_pinned_entry_list(cache_ptr) < 0) ||
- (H5C__validate_lru_list(cache_ptr) < 0))
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
-
/* Only protected entries can be pinned */
- if(!entry_ptr->is_protected)
+ if (!entry_ptr->is_protected)
HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Entry isn't protected")
/* Pin the entry from a client */
- if(H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0)
+ if (H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client")
done:
#if H5C_DO_EXTREME_SANITY_CHECKS
- if((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C__validate_pinned_entry_list(cache_ptr) < 0) ||
- (H5C__validate_lru_list(cache_ptr) < 0))
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0))
HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_pin_protected_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5C_protect
*
@@ -2330,82 +2218,77 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5C_protect(H5F_t * f,
- const H5C_class_t * type,
- haddr_t addr,
- void * udata,
- unsigned flags)
+H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *udata, unsigned flags)
{
- H5C_t * cache_ptr;
- H5AC_ring_t ring = H5C_RING_UNDEFINED;
- hbool_t hit;
- hbool_t have_write_permitted = FALSE;
- hbool_t read_only = FALSE;
- hbool_t flush_last;
+ H5C_t * cache_ptr;
+ H5AC_ring_t ring = H5C_RING_UNDEFINED;
+ hbool_t hit;
+ hbool_t have_write_permitted = FALSE;
+ hbool_t read_only = FALSE;
+ hbool_t flush_last;
#ifdef H5_HAVE_PARALLEL
- hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */
-#endif /* H5_HAVE_PARALLEL */
- hbool_t write_permitted;
- hbool_t was_loaded = FALSE; /* Whether the entry was loaded as a result of the protect */
- size_t empty_space;
- void * thing;
- H5C_cache_entry_t * entry_ptr;
- void * ret_value = NULL; /* Return value */
+ hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */
+#endif /* H5_HAVE_PARALLEL */
+ hbool_t write_permitted;
+ hbool_t was_loaded = FALSE; /* Whether the entry was loaded as a result of the protect */
+ size_t empty_space;
+ void * thing;
+ H5C_cache_entry_t *entry_ptr;
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
/* check args */
- HDassert( f );
- HDassert( f->shared );
+ HDassert(f);
+ HDassert(f->shared);
cache_ptr = f->shared->cache;
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( type );
- HDassert( type->mem_type == cache_ptr->class_table_ptr[type->id]->mem_type );
- HDassert( H5F_addr_defined(addr) );
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(type);
+ HDassert(type->mem_type == cache_ptr->class_table_ptr[type->id]->mem_type);
+ HDassert(H5F_addr_defined(addr));
#if H5C_DO_EXTREME_SANITY_CHECKS
- if((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C__validate_pinned_entry_list(cache_ptr) < 0) ||
- (H5C__validate_lru_list(cache_ptr) < 0))
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on entry")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
/* Load the cache image, if requested */
- if(cache_ptr->load_image) {
+ if (cache_ptr->load_image) {
cache_ptr->load_image = FALSE;
- if(H5C__load_cache_image(f) < 0)
+ if (H5C__load_cache_image(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't load cache image")
} /* end if */
- read_only = ( (flags & H5C__READ_ONLY_FLAG) != 0 );
- flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 );
+ read_only = ((flags & H5C__READ_ONLY_FLAG) != 0);
+ flush_last = ((flags & H5C__FLUSH_LAST_FLAG) != 0);
/* Get the ring type from the API context */
ring = H5CX_get_ring();
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI))
+ if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI))
coll_access = H5CX_get_coll_metadata_read();
#endif /* H5_HAVE_PARALLEL */
/* first check to see if the target is in cache */
H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, NULL)
- if(entry_ptr != NULL) {
- if(entry_ptr->ring != ring)
+ if (entry_ptr != NULL) {
+ if (entry_ptr->ring != ring)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "ring type mismatch occurred for cache entry")
HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- if(entry_ptr->prefetched) {
+ if (entry_ptr->prefetched) {
/* This call removes the prefetched entry from the cache,
* and replaces it with an entry deserialized from the
* image of the prefetched entry.
*/
- if(H5C__deserialize_prefetched_entry(f, cache_ptr, &entry_ptr, type, addr, udata) < 0)
+ if (H5C__deserialize_prefetched_entry(f, cache_ptr, &entry_ptr, type, addr, udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't deserialize prefetched entry")
HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
@@ -2414,154 +2297,151 @@ H5C_protect(H5F_t * f,
} /* end if */
/* Check for trying to load the wrong type of entry from an address */
- if(entry_ptr->type != type)
+ if (entry_ptr->type != type)
HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, NULL, "incorrect cache entry type")
- /* if this is a collective metadata read, the entry is not
- marked as collective, and is clean, it is possible that
- other processes will not have it in its cache and will
- expect a bcast of the entry from process 0. So process 0
- will bcast the entry to all other ranks. Ranks that _do_ have
- the entry in their cache still have to participate in the
- bcast. */
+ /* if this is a collective metadata read, the entry is not
+ marked as collective, and is clean, it is possible that
+ other processes will not have it in its cache and will
+ expect a bcast of the entry from process 0. So process 0
+ will bcast the entry to all other ranks. Ranks that _do_ have
+ the entry in their cache still have to participate in the
+ bcast. */
#ifdef H5_HAVE_PARALLEL
- if(coll_access) {
- if(!(entry_ptr->is_dirty) && !(entry_ptr->coll_access)) {
- MPI_Comm comm; /* File MPI Communicator */
- int mpi_code; /* MPI error code */
- int buf_size;
+ if (coll_access) {
+ if (!(entry_ptr->is_dirty) && !(entry_ptr->coll_access)) {
+ MPI_Comm comm; /* File MPI Communicator */
+ int mpi_code; /* MPI error code */
+ int buf_size;
- if(MPI_COMM_NULL == (comm = H5F_mpi_get_comm(f)))
+ if (MPI_COMM_NULL == (comm = H5F_mpi_get_comm(f)))
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed")
- if(entry_ptr->image_ptr == NULL) {
+ if (entry_ptr->image_ptr == NULL) {
int mpi_rank;
- if((mpi_rank = H5F_mpi_get_rank(f)) < 0)
+ if ((mpi_rank = H5F_mpi_get_rank(f)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank")
- if(NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer")
+ if (NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL,
+ "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE,
+ H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
- if(0 == mpi_rank)
- if(H5C__generate_image(f, cache_ptr, entry_ptr) < 0)
+ if (0 == mpi_rank)
+ if (H5C__generate_image(f, cache_ptr, entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't generate entry's image")
} /* end if */
HDassert(entry_ptr->image_ptr);
H5_CHECKED_ASSIGN(buf_size, int, entry_ptr->size, size_t);
- if(MPI_SUCCESS != (mpi_code = MPI_Bcast(entry_ptr->image_ptr, buf_size, MPI_BYTE, 0, comm)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Bcast(entry_ptr->image_ptr, buf_size, MPI_BYTE, 0, comm)))
HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
/* Mark the entry as collective and insert into the collective list */
entry_ptr->coll_access = TRUE;
H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL)
} /* end if */
- else if(entry_ptr->coll_access) {
+ else if (entry_ptr->coll_access) {
H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, NULL)
} /* end else-if */
- } /* end if */
-#endif /* H5_HAVE_PARALLEL */
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
#if H5C_DO_TAGGING_SANITY_CHECKS
-{
- /* Verify tag value */
- if(cache_ptr->ignore_tags != TRUE) {
- haddr_t tag; /* Tag value */
-
- /* The entry is already in the cache, but make sure that the tag value
- * is still legal. This will ensure that had the entry NOT been in the
- * cache, tagging was still set up correctly and it would have received
- * a legal tag value after getting loaded from disk.
- */
+ {
+ /* Verify tag value */
+ if (cache_ptr->ignore_tags != TRUE) {
+ haddr_t tag; /* Tag value */
+
+ /* The entry is already in the cache, but make sure that the tag value
+ * is still legal. This will ensure that had the entry NOT been in the
+ * cache, tagging was still set up correctly and it would have received
+ * a legal tag value after getting loaded from disk.
+ */
- /* Get the tag */
- tag = H5CX_get_tag();
+ /* Get the tag */
+ tag = H5CX_get_tag();
- if(H5C_verify_tag(entry_ptr->type->id, tag) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "tag verification failed")
- } /* end if */
-}
+ if (H5C_verify_tag(entry_ptr->type->id, tag) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "tag verification failed")
+ } /* end if */
+ }
#endif
- hit = TRUE;
+ hit = TRUE;
thing = (void *)entry_ptr;
-
- } else {
+ }
+ else {
/* must try to load the entry from disk. */
hit = FALSE;
- if(NULL == (thing = H5C__load_entry(f,
+ if (NULL == (thing = H5C__load_entry(f,
#ifdef H5_HAVE_PARALLEL
- coll_access,
+ coll_access,
#endif /* H5_HAVE_PARALLEL */
- type, addr, udata)))
+ type, addr, udata)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't load entry")
entry_ptr = (H5C_cache_entry_t *)thing;
cache_ptr->entries_loaded_counter++;
- entry_ptr->ring = ring;
+ entry_ptr->ring = ring;
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && entry_ptr->coll_access)
+ if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && entry_ptr->coll_access)
H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL)
#endif /* H5_HAVE_PARALLEL */
/* Apply tag to newly protected entry */
- if(H5C__tag_entry(cache_ptr, entry_ptr) < 0)
+ if (H5C__tag_entry(cache_ptr, entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Cannot tag metadata entry")
/* If the entry is very large, and we are configured to allow it,
* we may wish to perform a flash cache size increase.
*/
- if ( ( cache_ptr->flash_size_increase_possible ) &&
- ( entry_ptr->size > cache_ptr->flash_size_increase_threshold ) ) {
+ if ((cache_ptr->flash_size_increase_possible) &&
+ (entry_ptr->size > cache_ptr->flash_size_increase_threshold)) {
- if(H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0)
+ if (H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__flash_increase_cache_size failed")
}
- if(cache_ptr->index_size >= cache_ptr->max_cache_size)
- empty_space = 0;
+ if (cache_ptr->index_size >= cache_ptr->max_cache_size)
+ empty_space = 0;
else
- empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
+ empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
/* try to free up if necceary and if evictions are permitted. Note
* that if evictions are enabled, we will call H5C__make_space_in_cache()
* regardless if the min_free_space requirement is not met.
*/
- if ( ( cache_ptr->evictions_enabled ) &&
- ( ( (cache_ptr->index_size + entry_ptr->size) >
- cache_ptr->max_cache_size)
- ||
- ( ( empty_space + cache_ptr->clean_index_size ) <
- cache_ptr->min_clean_size )
- )
- ) {
+ if ((cache_ptr->evictions_enabled) &&
+ (((cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size) ||
+ ((empty_space + cache_ptr->clean_index_size) < cache_ptr->min_clean_size))) {
size_t space_needed;
- if(empty_space <= entry_ptr->size)
+ if (empty_space <= entry_ptr->size)
cache_ptr->cache_full = TRUE;
- if(cache_ptr->check_write_permitted != NULL) {
- if((cache_ptr->check_write_permitted)(f, &write_permitted) < 0)
+ if (cache_ptr->check_write_permitted != NULL) {
+ if ((cache_ptr->check_write_permitted)(f, &write_permitted) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Can't get write_permitted 1")
else
have_write_permitted = TRUE;
} /* end if */
else {
- write_permitted = cache_ptr->write_permitted;
+ write_permitted = cache_ptr->write_permitted;
have_write_permitted = TRUE;
} /* end else */
HDassert(entry_ptr->size <= H5C_MAX_ENTRY_SIZE);
space_needed = entry_ptr->size;
- if(space_needed > cache_ptr->max_cache_size)
+ if (space_needed > cache_ptr->max_cache_size)
space_needed = cache_ptr->max_cache_size;
/* Note that space_needed is just the amount of space that
@@ -2593,7 +2473,7 @@ H5C_protect(H5F_t * f,
* see no point in worrying about the fourth.
*/
- if(H5C__make_space_in_cache(f, space_needed, write_permitted) < 0 )
+ if (H5C__make_space_in_cache(f, space_needed, write_permitted) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__make_space_in_cache failed")
} /* end if */
@@ -2618,7 +2498,7 @@ H5C_protect(H5F_t * f,
H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, NULL)
- if ( ( entry_ptr->is_dirty ) && ( ! (entry_ptr->in_slist) ) ) {
+ if ((entry_ptr->is_dirty) && (!(entry_ptr->in_slist))) {
H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, NULL)
}
@@ -2638,11 +2518,11 @@ H5C_protect(H5F_t * f,
HDassert(entry_ptr->addr == addr);
HDassert(entry_ptr->type == type);
- if(entry_ptr->is_protected) {
- if(read_only && entry_ptr->is_read_only) {
- HDassert(entry_ptr->ro_ref_count > 0);
- (entry_ptr->ro_ref_count)++;
- } /* end if */
+ if (entry_ptr->is_protected) {
+ if (read_only && entry_ptr->is_read_only) {
+ HDassert(entry_ptr->ro_ref_count > 0);
+ (entry_ptr->ro_ref_count)++;
+ } /* end if */
else
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Target already protected & not read only?!?")
} /* end if */
@@ -2651,10 +2531,10 @@ H5C_protect(H5F_t * f,
entry_ptr->is_protected = TRUE;
- if ( read_only ) {
- entry_ptr->is_read_only = TRUE;
- entry_ptr->ro_ref_count = 1;
- } /* end if */
+ if (read_only) {
+ entry_ptr->is_read_only = TRUE;
+ entry_ptr->ro_ref_count = 1;
+ } /* end if */
entry_ptr->dirtied = FALSE;
} /* end else */
@@ -2665,36 +2545,35 @@ H5C_protect(H5F_t * f,
ret_value = thing;
- if ( ( cache_ptr->evictions_enabled ) &&
- ( ( cache_ptr->size_decreased ) ||
- ( ( cache_ptr->resize_enabled ) &&
- ( cache_ptr->cache_accesses >=
- (cache_ptr->resize_ctl).epoch_length ) ) ) ) {
+ if ((cache_ptr->evictions_enabled) &&
+ ((cache_ptr->size_decreased) ||
+ ((cache_ptr->resize_enabled) &&
+ (cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length)))) {
- if ( ! have_write_permitted ) {
+ if (!have_write_permitted) {
- if ( cache_ptr->check_write_permitted != NULL ) {
- if((cache_ptr->check_write_permitted)(f, &write_permitted) < 0)
+ if (cache_ptr->check_write_permitted != NULL) {
+ if ((cache_ptr->check_write_permitted)(f, &write_permitted) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Can't get write_permitted")
else
have_write_permitted = TRUE;
- } else {
+ }
+ else {
write_permitted = cache_ptr->write_permitted;
have_write_permitted = TRUE;
-
}
}
- if(cache_ptr->resize_enabled &&
- (cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length)) {
+ if (cache_ptr->resize_enabled &&
+ (cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length)) {
- if(H5C__auto_adjust_cache_size(f, write_permitted) < 0)
+ if (H5C__auto_adjust_cache_size(f, write_permitted) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Cache auto-resize failed")
} /* end if */
- if(cache_ptr->size_decreased) {
+ if (cache_ptr->size_decreased) {
cache_ptr->size_decreased = FALSE;
/* check to see if the cache is now oversized due to the cache
@@ -2706,20 +2585,18 @@ H5C_protect(H5F_t * f,
* into complience.
*/
- if(cache_ptr->index_size >= cache_ptr->max_cache_size)
- empty_space = 0;
+ if (cache_ptr->index_size >= cache_ptr->max_cache_size)
+ empty_space = 0;
else
- empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
+ empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
- if ( ( cache_ptr->index_size > cache_ptr->max_cache_size )
- ||
- ( ( empty_space + cache_ptr->clean_index_size ) <
- cache_ptr->min_clean_size) ) {
+ if ((cache_ptr->index_size > cache_ptr->max_cache_size) ||
+ ((empty_space + cache_ptr->clean_index_size) < cache_ptr->min_clean_size)) {
- if(cache_ptr->index_size > cache_ptr->max_cache_size)
+ if (cache_ptr->index_size > cache_ptr->max_cache_size)
cache_ptr->cache_full = TRUE;
- if(H5C__make_space_in_cache(f, (size_t)0, write_permitted) < 0 )
+ if (H5C__make_space_in_cache(f, (size_t)0, write_permitted) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__make_space_in_cache failed")
}
} /* end if */
@@ -2730,35 +2607,33 @@ H5C_protect(H5F_t * f,
* the cache and protected. We must wait until it is protected so it is not
* evicted during the notify callback.
*/
- if(was_loaded) {
+ if (was_loaded) {
/* If the entry's type has a 'notify' callback send a 'after load'
* notice now that the entry is fully integrated into the cache.
*/
- if(entry_ptr->type->notify &&
- (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_LOAD, entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, NULL, "can't notify client about entry inserted into cache")
+ if (entry_ptr->type->notify && (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_LOAD, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, NULL,
+ "can't notify client about entry inserted into cache")
} /* end if */
#ifdef H5_HAVE_PARALLEL
/* Make sure the size of the collective entries in the cache remain in check */
- if(coll_access)
- if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100)
- if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
+ if (coll_access)
+ if (cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100)
+ if (H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries")
#endif /* H5_HAVE_PARALLEL */
done:
#if H5C_DO_EXTREME_SANITY_CHECKS
- if((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C__validate_pinned_entry_list(cache_ptr) < 0) ||
- (H5C__validate_lru_list(cache_ptr) < 0))
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0))
HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on exit")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_protect() */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_reset_cache_hit_rate_stats()
@@ -2772,23 +2647,22 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_reset_cache_hit_rate_stats(H5C_t * cache_ptr)
+H5C_reset_cache_hit_rate_stats(H5C_t *cache_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry")
- cache_ptr->cache_hits = 0;
- cache_ptr->cache_accesses = 0;
+ cache_ptr->cache_hits = 0;
+ cache_ptr->cache_accesses = 0;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_reset_cache_hit_rate_stats() */
-
/*-------------------------------------------------------------------------
* Function: H5C_set_cache_auto_resize_config
*
@@ -2809,36 +2683,35 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
- H5C_auto_size_ctl_t *config_ptr)
+H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr)
{
- size_t new_max_cache_size;
- size_t new_min_clean_size;
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t new_max_cache_size;
+ size_t new_min_clean_size;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry")
- if(config_ptr == NULL)
+ if (config_ptr == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL config_ptr on entry")
- if(config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER)
+ if (config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unknown config version")
/* check general configuration section of the config: */
- if(H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_GENERAL) < 0)
+ if (H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_GENERAL) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in general configuration fields of new config")
/* check size increase control fields of the config: */
- if(H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_INCREMENT) < 0)
+ if (H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_INCREMENT) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in the size increase control fields of new config")
/* check size decrease control fields of the config: */
- if(H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_DECREMENT) < 0)
+ if (H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_DECREMENT) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in the size decrease control fields of new config")
/* check for conflicts between size increase and size decrease controls: */
- if(H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_INTERACTIONS) < 0)
+ if (H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_INTERACTIONS) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "conflicting threshold fields in new config")
/* will set the increase possible fields to FALSE later if needed */
@@ -2846,16 +2719,15 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
cache_ptr->flash_size_increase_possible = TRUE;
cache_ptr->size_decrease_possible = TRUE;
- switch(config_ptr->incr_mode) {
+ switch (config_ptr->incr_mode) {
case H5C_incr__off:
cache_ptr->size_increase_possible = FALSE;
break;
case H5C_incr__threshold:
- if((config_ptr->lower_hr_threshold <= (double)0.0f) ||
- (config_ptr->increment <= (double)1.0f) ||
- ((config_ptr->apply_max_increment) && (config_ptr->max_increment <= 0)))
- cache_ptr->size_increase_possible = FALSE;
+ if ((config_ptr->lower_hr_threshold <= (double)0.0f) || (config_ptr->increment <= (double)1.0f) ||
+ ((config_ptr->apply_max_increment) && (config_ptr->max_increment <= 0)))
+ cache_ptr->size_increase_possible = FALSE;
break;
default: /* should be unreachable */
@@ -2867,28 +2739,27 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
* we wait until the end of the function, when this field is set.
*/
- switch(config_ptr->decr_mode) {
+ switch (config_ptr->decr_mode) {
case H5C_decr__off:
cache_ptr->size_decrease_possible = FALSE;
break;
case H5C_decr__threshold:
- if((config_ptr->upper_hr_threshold >= (double)1.0f) ||
- (config_ptr->decrement >= (double)1.0f) ||
- ((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)))
+ if ((config_ptr->upper_hr_threshold >= (double)1.0f) || (config_ptr->decrement >= (double)1.0f) ||
+ ((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)))
cache_ptr->size_decrease_possible = FALSE;
break;
case H5C_decr__age_out:
- if(((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= (double)1.0f)) ||
- ((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)))
+ if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= (double)1.0f)) ||
+ ((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)))
cache_ptr->size_decrease_possible = FALSE;
break;
case H5C_decr__age_out_with_threshold:
- if(((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= (double)1.0f)) ||
- ((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)) ||
- (config_ptr->upper_hr_threshold >= (double)1.0f))
+ if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= (double)1.0f)) ||
+ ((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)) ||
+ (config_ptr->upper_hr_threshold >= (double)1.0f))
cache_ptr->size_decrease_possible = FALSE;
break;
@@ -2896,17 +2767,16 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown decr_mode?!?!?")
} /* end switch */
- if(config_ptr->max_size == config_ptr->min_size) {
- cache_ptr->size_increase_possible = FALSE;
- cache_ptr->flash_size_increase_possible = FALSE;
- cache_ptr->size_decrease_possible = FALSE;
+ if (config_ptr->max_size == config_ptr->min_size) {
+ cache_ptr->size_increase_possible = FALSE;
+ cache_ptr->flash_size_increase_possible = FALSE;
+ cache_ptr->size_decrease_possible = FALSE;
} /* end if */
/* flash_size_increase_possible is intentionally omitted from the
* following:
*/
- cache_ptr->resize_enabled = cache_ptr->size_increase_possible ||
- cache_ptr->size_decrease_possible;
+ cache_ptr->resize_enabled = cache_ptr->size_increase_possible || cache_ptr->size_decrease_possible;
cache_ptr->resize_ctl = *config_ptr;
@@ -2918,18 +2788,16 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
* go through the exercise even if the current size is within
* range and an initial size has not been provided.
*/
- if(cache_ptr->resize_ctl.set_initial_size)
+ if (cache_ptr->resize_ctl.set_initial_size)
new_max_cache_size = cache_ptr->resize_ctl.initial_size;
- else if(cache_ptr->max_cache_size > cache_ptr->resize_ctl.max_size)
+ else if (cache_ptr->max_cache_size > cache_ptr->resize_ctl.max_size)
new_max_cache_size = cache_ptr->resize_ctl.max_size;
- else if(cache_ptr->max_cache_size < cache_ptr->resize_ctl.min_size)
+ else if (cache_ptr->max_cache_size < cache_ptr->resize_ctl.min_size)
new_max_cache_size = cache_ptr->resize_ctl.min_size;
else
new_max_cache_size = cache_ptr->max_cache_size;
- new_min_clean_size = (size_t)((double)new_max_cache_size *
- ((cache_ptr->resize_ctl).min_clean_fraction));
-
+ new_min_clean_size = (size_t)((double)new_max_cache_size * ((cache_ptr->resize_ctl).min_clean_fraction));
/* since new_min_clean_size is of type size_t, we have
*
@@ -2941,25 +2809,25 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
HDassert(cache_ptr->resize_ctl.min_size <= new_max_cache_size);
HDassert(new_max_cache_size <= cache_ptr->resize_ctl.max_size);
- if(new_max_cache_size < cache_ptr->max_cache_size)
+ if (new_max_cache_size < cache_ptr->max_cache_size)
cache_ptr->size_decreased = TRUE;
cache_ptr->max_cache_size = new_max_cache_size;
cache_ptr->min_clean_size = new_min_clean_size;
- if(H5C_reset_cache_hit_rate_stats(cache_ptr) < 0)
+ if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0)
/* this should be impossible... */
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed")
/* remove excess epoch markers if any */
- if((config_ptr->decr_mode == H5C_decr__age_out_with_threshold) ||
- (config_ptr->decr_mode == H5C_decr__age_out)) {
- if(cache_ptr->epoch_markers_active > cache_ptr->resize_ctl.epochs_before_eviction)
- if(H5C__autoadjust__ageout__remove_excess_markers(cache_ptr) < 0)
+ if ((config_ptr->decr_mode == H5C_decr__age_out_with_threshold) ||
+ (config_ptr->decr_mode == H5C_decr__age_out)) {
+ if (cache_ptr->epoch_markers_active > cache_ptr->resize_ctl.epochs_before_eviction)
+ if (H5C__autoadjust__ageout__remove_excess_markers(cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't remove excess epoch markers")
} /* end if */
- else if(cache_ptr->epoch_markers_active > 0) {
- if(H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0)
+ else if (cache_ptr->epoch_markers_active > 0) {
+ if (H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers")
}
@@ -2971,29 +2839,28 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
* go ahead and configure it.
*/
- if(cache_ptr->flash_size_increase_possible) {
- switch(config_ptr->flash_incr_mode) {
+ if (cache_ptr->flash_size_increase_possible) {
+ switch (config_ptr->flash_incr_mode) {
case H5C_flash_incr__off:
cache_ptr->flash_size_increase_possible = FALSE;
break;
case H5C_flash_incr__add_space:
- cache_ptr->flash_size_increase_possible = TRUE;
- cache_ptr->flash_size_increase_threshold = (size_t)(((double)(cache_ptr->max_cache_size)) *
- ((cache_ptr->resize_ctl).flash_threshold));
+ cache_ptr->flash_size_increase_possible = TRUE;
+ cache_ptr->flash_size_increase_threshold = (size_t)(
+ ((double)(cache_ptr->max_cache_size)) * ((cache_ptr->resize_ctl).flash_threshold));
break;
default: /* should be unreachable */
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?")
- break;
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?")
+ break;
} /* end switch */
- } /* end if */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_set_cache_auto_resize_config() */
-
/*-------------------------------------------------------------------------
* Function: H5C_set_evictions_enabled()
*
@@ -3010,11 +2877,11 @@ done:
herr_t
H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry")
/* There is no fundamental reason why we should not permit
@@ -3023,9 +2890,8 @@ H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled)
* want to, and allowing it would greatly complicate testing
* the feature. Hence the following:
*/
- if((evictions_enabled != TRUE) &&
- ((cache_ptr->resize_ctl.incr_mode != H5C_incr__off) ||
- (cache_ptr->resize_ctl.decr_mode != H5C_decr__off)))
+ if ((evictions_enabled != TRUE) && ((cache_ptr->resize_ctl.incr_mode != H5C_incr__off) ||
+ (cache_ptr->resize_ctl.decr_mode != H5C_decr__off)))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't disable evictions when auto resize enabled")
cache_ptr->evictions_enabled = evictions_enabled;
@@ -3034,7 +2900,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_set_evictions_enabled() */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_set_slist_enabled()
@@ -3098,50 +2963,46 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_set_slist_enabled(H5C_t *cache_ptr, hbool_t slist_enabled,
- hbool_t clear_slist)
+H5C_set_slist_enabled(H5C_t *cache_ptr, hbool_t slist_enabled, hbool_t clear_slist)
{
- H5C_cache_entry_t * entry_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_cache_entry_t *entry_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) )
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry")
#if H5C__SLIST_OPT_ENABLED
- if ( slist_enabled ) {
+ if (slist_enabled) {
- if ( cache_ptr->slist_enabled ) {
+ if (cache_ptr->slist_enabled) {
HDassert(FALSE);
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist already enabled?")
}
- if ( ( cache_ptr->slist_len != 0 ) ||
- ( cache_ptr->slist_size != 0 ) ) {
+ if ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0)) {
HDassert(FALSE);
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist not empty (1)?")
}
-
/* set cache_ptr->slist_enabled to TRUE so that the slist
* mainenance macros will be enabled.
*/
cache_ptr->slist_enabled = TRUE;
-
/* scan the index list and insert all dirty entries in the slist */
entry_ptr = cache_ptr->il_head;
- while ( entry_ptr != NULL ) {
+ while (entry_ptr != NULL) {
- HDassert( entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC );
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- if ( entry_ptr->is_dirty ) {
+ if (entry_ptr->is_dirty) {
H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
}
@@ -3155,26 +3016,25 @@ H5C_set_slist_enabled(H5C_t *cache_ptr, hbool_t slist_enabled,
* and in any case, there is no requirement that all dirty entries
* will reside on the dirty LRU.
*/
- HDassert( cache_ptr->dirty_index_size == cache_ptr->slist_size );
-
- } else { /* take down the skip list */
+ HDassert(cache_ptr->dirty_index_size == cache_ptr->slist_size);
+ }
+ else { /* take down the skip list */
- if ( ! cache_ptr->slist_enabled ) {
+ if (!cache_ptr->slist_enabled) {
HDassert(FALSE);
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist already disabled?")
}
- if ( ( cache_ptr->slist_len != 0 ) ||
- ( cache_ptr->slist_size != 0 ) ) {
+ if ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0)) {
- if ( clear_slist ) {
+ if (clear_slist) {
H5SL_node_t *node_ptr;
node_ptr = H5SL_first(cache_ptr->slist_ptr);
- while ( node_ptr != NULL ) {
+ while (node_ptr != NULL) {
entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
@@ -3182,7 +3042,8 @@ H5C_set_slist_enabled(H5C_t *cache_ptr, hbool_t slist_enabled,
node_ptr = H5SL_first(cache_ptr->slist_ptr);
}
- } else {
+ }
+ else {
HDassert(FALSE);
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist not empty (2)?")
@@ -3191,8 +3052,8 @@ H5C_set_slist_enabled(H5C_t *cache_ptr, hbool_t slist_enabled,
cache_ptr->slist_enabled = FALSE;
- HDassert( 0 == cache_ptr->slist_len );
- HDassert( 0 == cache_ptr->slist_size );
+ HDassert(0 == cache_ptr->slist_len);
+ HDassert(0 == cache_ptr->slist_size);
}
#else /* H5C__SLIST_OPT_ENABLED is FALSE */
@@ -3207,7 +3068,6 @@ done:
} /* H5C_set_slist_enabled() */
-
/*-------------------------------------------------------------------------
* Function: H5C_unpin_entry()
*
@@ -3227,9 +3087,9 @@ done:
herr_t
H5C_unpin_entry(void *_entry_ptr)
{
- H5C_t * cache_ptr;
- H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)_entry_ptr; /* Pointer to entry to unpin */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)_entry_ptr; /* Pointer to entry to unpin */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -3240,29 +3100,25 @@ H5C_unpin_entry(void *_entry_ptr)
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
#if H5C_DO_EXTREME_SANITY_CHECKS
- if((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C__validate_pinned_entry_list(cache_ptr) < 0) ||
- (H5C__validate_lru_list(cache_ptr) < 0))
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
-
/* Unpin the entry */
- if(H5C__unpin_entry_from_client(cache_ptr, entry_ptr, TRUE) < 0)
+ if (H5C__unpin_entry_from_client(cache_ptr, entry_ptr, TRUE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry from client")
done:
#if H5C_DO_EXTREME_SANITY_CHECKS
- if((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C__validate_pinned_entry_list(cache_ptr) < 0) ||
- (H5C__validate_lru_list(cache_ptr) < 0))
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0))
HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_unpin_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5C_unprotect
*
@@ -3364,120 +3220,115 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
+H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
{
- H5C_t * cache_ptr;
- hbool_t deleted;
- hbool_t dirtied;
- hbool_t set_flush_marker;
- hbool_t pin_entry;
- hbool_t unpin_entry;
- hbool_t free_file_space;
- hbool_t take_ownership;
- hbool_t was_clean;
+ H5C_t * cache_ptr;
+ hbool_t deleted;
+ hbool_t dirtied;
+ hbool_t set_flush_marker;
+ hbool_t pin_entry;
+ hbool_t unpin_entry;
+ hbool_t free_file_space;
+ hbool_t take_ownership;
+ hbool_t was_clean;
#ifdef H5_HAVE_PARALLEL
- hbool_t clear_entry = FALSE;
+ hbool_t clear_entry = FALSE;
#endif /* H5_HAVE_PARALLEL */
- H5C_cache_entry_t * entry_ptr;
- H5C_cache_entry_t * test_entry_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_cache_entry_t *entry_ptr;
+ H5C_cache_entry_t *test_entry_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- deleted = ((flags & H5C__DELETED_FLAG) != 0);
- dirtied = ((flags & H5C__DIRTIED_FLAG) != 0);
- set_flush_marker = ((flags & H5C__SET_FLUSH_MARKER_FLAG) != 0);
- pin_entry = ((flags & H5C__PIN_ENTRY_FLAG) != 0);
- unpin_entry = ((flags & H5C__UNPIN_ENTRY_FLAG) != 0);
- free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0);
- take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0);
+ deleted = ((flags & H5C__DELETED_FLAG) != 0);
+ dirtied = ((flags & H5C__DIRTIED_FLAG) != 0);
+ set_flush_marker = ((flags & H5C__SET_FLUSH_MARKER_FLAG) != 0);
+ pin_entry = ((flags & H5C__PIN_ENTRY_FLAG) != 0);
+ unpin_entry = ((flags & H5C__UNPIN_ENTRY_FLAG) != 0);
+ free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0);
+ take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0);
- HDassert( f );
- HDassert( f->shared );
+ HDassert(f);
+ HDassert(f->shared);
cache_ptr = f->shared->cache;
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( H5F_addr_defined(addr) );
- HDassert( thing );
- HDassert( ! ( pin_entry && unpin_entry ) );
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(thing);
+ HDassert(!(pin_entry && unpin_entry));
/* deleted flag must accompany free_file_space */
- HDassert( ( ! free_file_space ) || ( deleted ) );
+ HDassert((!free_file_space) || (deleted));
/* deleted flag must accompany take_ownership */
- HDassert( ( ! take_ownership ) || ( deleted ) );
+ HDassert((!take_ownership) || (deleted));
/* can't have both free_file_space & take_ownership */
- HDassert( ! ( free_file_space && take_ownership ) );
+ HDassert(!(free_file_space && take_ownership));
entry_ptr = (H5C_cache_entry_t *)thing;
- HDassert( entry_ptr->addr == addr );
+ HDassert(entry_ptr->addr == addr);
/* also set the dirtied variable if the dirtied field is set in
* the entry.
*/
dirtied |= entry_ptr->dirtied;
- was_clean = ! ( entry_ptr->is_dirty );
+ was_clean = !(entry_ptr->is_dirty);
#if H5C_DO_EXTREME_SANITY_CHECKS
- if ( ( H5C__validate_protected_entry_list(cache_ptr) < 0 ) ||
- ( H5C__validate_pinned_entry_list(cache_ptr) < 0 ) ||
- ( H5C__validate_lru_list(cache_ptr) < 0 ) )
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "an extreme sanity check failed on entry")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
/* if the entry has multiple read only protects, just decrement
* the ro_ref_counter. Don't actually unprotect until the ref count
* drops to zero.
*/
- if ( entry_ptr->ro_ref_count > 1 ) {
+ if (entry_ptr->ro_ref_count > 1) {
/* Sanity check */
HDassert(entry_ptr->is_protected);
HDassert(entry_ptr->is_read_only);
- if ( dirtied )
+ if (dirtied)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
- "Read only entry modified??")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Read only entry modified??")
/* Reduce the RO ref count */
(entry_ptr->ro_ref_count)--;
/* Pin or unpin the entry as requested. */
- if ( pin_entry ) {
+ if (pin_entry) {
/* Pin the entry from a client */
- if ( H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0 )
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, \
- "Can't pin entry by client")
+ if (H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0)
- } else if ( unpin_entry ) {
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client")
+ }
+ else if (unpin_entry) {
/* Unpin the entry from a client */
- if ( H5C__unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0 )
+ if (H5C__unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, \
- "Can't unpin entry by client")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry by client")
} /* end if */
- } else {
+ }
+ else {
- if ( entry_ptr->is_read_only ) {
+ if (entry_ptr->is_read_only) {
/* Sanity check */
HDassert(entry_ptr->ro_ref_count == 1);
- if ( dirtied )
+ if (dirtied)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
- "Read only entry modified??")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Read only entry modified??")
entry_ptr->is_read_only = FALSE;
entry_ptr->ro_ref_count = 0;
@@ -3500,43 +3351,42 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
* are contiguous, with only one dirty flag, we have to let the supplied
* functions deal with the resetting the is_dirty flag.
*/
- if(entry_ptr->clear_on_unprotect) {
+ if (entry_ptr->clear_on_unprotect) {
/* Sanity check */
HDassert(entry_ptr->is_dirty);
entry_ptr->clear_on_unprotect = FALSE;
- if(!dirtied)
+ if (!dirtied)
clear_entry = TRUE;
} /* end if */
-#endif /* H5_HAVE_PARALLEL */
+#endif /* H5_HAVE_PARALLEL */
- if ( ! entry_ptr->is_protected )
+ if (!entry_ptr->is_protected)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
- "Entry already unprotected??")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Entry already unprotected??")
/* Mark the entry as dirty if appropriate */
entry_ptr->is_dirty = (entry_ptr->is_dirty || dirtied);
- if ( dirtied ) {
+ if (dirtied) {
- if ( entry_ptr->image_up_to_date ) {
+ if (entry_ptr->image_up_to_date) {
entry_ptr->image_up_to_date = FALSE;
- if ( entry_ptr->flush_dep_nparents > 0 ) {
+ if (entry_ptr->flush_dep_nparents > 0) {
- if ( H5C__mark_flush_dep_unserialized(entry_ptr) < 0 )
+ if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, \
- "Can't propagate serialization status to fd parents")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "Can't propagate serialization status to fd parents")
} /* end if */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
/* Check for newly dirtied entry */
- if ( was_clean && entry_ptr->is_dirty ) {
+ if (was_clean && entry_ptr->is_dirty) {
/* Update index for newly dirtied entry */
H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr)
@@ -3545,67 +3395,59 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
* 'entry dirtied' notice now that the entry is fully
* integrated into the cache.
*/
- if ( ( entry_ptr->type->notify ) &&
- ( (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED,
- entry_ptr) < 0 ) )
+ if ((entry_ptr->type->notify) &&
+ ((entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, \
- "can't notify client about entry dirty flag set")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag set")
/* Propagate the flush dep dirty flag up the flush dependency chain
* if appropriate
*/
- if ( entry_ptr->flush_dep_nparents > 0 ) {
+ if (entry_ptr->flush_dep_nparents > 0) {
- if ( H5C__mark_flush_dep_dirty(entry_ptr) < 0 )
+ if (H5C__mark_flush_dep_dirty(entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "Can't propagate flush dep dirty flag")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag")
}
} /* end if */
/* Check for newly clean entry */
- else if ( ! was_clean && ! entry_ptr->is_dirty ) {
+ else if (!was_clean && !entry_ptr->is_dirty) {
/* If the entry's type has a 'notify' callback send a
* 'entry cleaned' notice now that the entry is fully
* integrated into the cache.
*/
- if ( ( entry_ptr->type->notify ) &&
- ( (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED,
- entry_ptr) < 0 ) )
+ if ((entry_ptr->type->notify) &&
+ ((entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, \
- "can't notify client about entry dirty flag cleared")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify client about entry dirty flag cleared")
/* Propagate the flush dep clean flag up the flush dependency chain
* if appropriate
*/
- if ( entry_ptr->flush_dep_nparents > 0 ) {
+ if (entry_ptr->flush_dep_nparents > 0) {
- if ( H5C__mark_flush_dep_clean(entry_ptr) < 0 )
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "Can't propagate flush dep dirty flag")
+ if (H5C__mark_flush_dep_clean(entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag")
}
} /* end else-if */
/* Pin or unpin the entry as requested. */
- if ( pin_entry ) {
+ if (pin_entry) {
/* Pin the entry from a client */
- if ( H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0 )
+ if (H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, \
- "Can't pin entry by client")
-
- } else if ( unpin_entry ) {
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client")
+ }
+ else if (unpin_entry) {
/* Unpin the entry from a client */
- if ( H5C__unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0 )
+ if (H5C__unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, \
- "Can't unpin entry by client")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry by client")
} /* end if */
/* H5C__UPDATE_RP_FOR_UNPROTECT will place the unprotected entry on
@@ -3618,11 +3460,11 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
/* if the entry is dirty, 'or' its flush_marker with the set flush flag,
* and then add it to the skip list if it isn't there already.
*/
- if ( entry_ptr->is_dirty ) {
+ if (entry_ptr->is_dirty) {
entry_ptr->flush_marker |= set_flush_marker;
- if ( !entry_ptr->in_slist ) {
+ if (!entry_ptr->in_slist) {
/* this is a no-op if cache_ptr->slist_enabled is FALSE */
H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
@@ -3638,32 +3480,30 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
* makes good use of existing code.
* JRM - 5/19/04
*/
- if ( deleted ) {
+ if (deleted) {
- unsigned flush_flags = (H5C__FLUSH_CLEAR_ONLY_FLAG |
- H5C__FLUSH_INVALIDATE_FLAG);
+ unsigned flush_flags = (H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_INVALIDATE_FLAG);
/* verify that the target entry is in the cache. */
H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL)
- if ( test_entry_ptr == NULL )
+ if (test_entry_ptr == NULL)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
- "entry not in hash table?!?")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "entry not in hash table?!?")
- else if ( test_entry_ptr != entry_ptr )
+ else if (test_entry_ptr != entry_ptr)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
- "hash table contains multiple entries for addr?!?")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL,
+ "hash table contains multiple entries for addr?!?")
/* Set the 'free file space' flag for the flush, if needed */
- if ( free_file_space ) {
+ if (free_file_space) {
flush_flags |= H5C__FREE_FILE_SPACE_FLAG;
}
/* Set the "take ownership" flag for the flush, if needed */
- if ( take_ownership ) {
+ if (take_ownership) {
flush_flags |= H5C__TAKE_OWNERSHIP_FLAG;
}
@@ -3671,40 +3511,34 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
/* Delete the entry from the skip list on destroy */
flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG;
- HDassert( ( ! cache_ptr->slist_enabled ) || \
- ( ( ( ! was_clean ) || dirtied ) == \
- ( entry_ptr->in_slist ) ) );
+ HDassert((!cache_ptr->slist_enabled) || (((!was_clean) || dirtied) == (entry_ptr->in_slist)));
- if ( H5C__flush_single_entry(f, entry_ptr, flush_flags) < 0 )
+ if (H5C__flush_single_entry(f, entry_ptr, flush_flags) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
- "Can't flush entry")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't flush entry")
} /* end if */
#ifdef H5_HAVE_PARALLEL
- else if ( clear_entry ) {
+ else if (clear_entry) {
/* verify that the target entry is in the cache. */
H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL)
- if ( test_entry_ptr == NULL )
+ if (test_entry_ptr == NULL)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
- "entry not in hash table?!?")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "entry not in hash table?!?")
- else if ( test_entry_ptr != entry_ptr )
+ else if (test_entry_ptr != entry_ptr)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL,
"hash table contains multiple entries for addr?!?")
- if ( H5C__flush_single_entry(f, entry_ptr,
- H5C__FLUSH_CLEAR_ONLY_FLAG |
- H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0 )
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
- "Can't clear entry")
+ if (H5C__flush_single_entry(f, entry_ptr,
+ H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't clear entry")
} /* end else if */
-#endif /* H5_HAVE_PARALLEL */
+#endif /* H5_HAVE_PARALLEL */
}
H5C__UPDATE_STATS_FOR_UNPROTECT(cache_ptr)
@@ -3712,585 +3546,586 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags)
done:
#if H5C_DO_EXTREME_SANITY_CHECKS
- if ( ( H5C__validate_protected_entry_list(cache_ptr) < 0 ) ||
- ( H5C__validate_pinned_entry_list(cache_ptr) < 0 ) ||
- ( H5C__validate_lru_list(cache_ptr) < 0 ) ) {
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0)) {
- HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "an extreme sanity check failed on exit")
+ HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_unprotect() */
+ } /* H5C_unprotect() */
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C_unsettle_entry_ring
+ *
+ * Purpose: Advise the metadata cache that the specified entry's free space
+ * manager ring is no longer settled (if it was on entry).
+ *
+ * If the target free space manager ring is already
+ * unsettled, do nothing, and return SUCCEED.
+ *
+ * If the target free space manager ring is settled, and
+ * we are not in the process of a file shutdown, mark
+ * the ring as unsettled, and return SUCCEED.
+ *
+ * If the target free space manager is settled, and we
+ * are in the process of a file shutdown, post an error
+ * message, and return FAIL.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * January 3, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+ herr_t H5C_unsettle_entry_ring(void *_entry)
+ {
+ H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_entry; /* Entry whose ring to unsettle */
+ H5C_t * cache; /* Cache for file */
+ herr_t ret_value = SUCCEED; /* Return value */
-/*-------------------------------------------------------------------------
- *
- * Function: H5C_unsettle_entry_ring
- *
- * Purpose: Advise the metadata cache that the specified entry's free space
- * manager ring is no longer settled (if it was on entry).
- *
- * If the target free space manager ring is already
- * unsettled, do nothing, and return SUCCEED.
- *
- * If the target free space manager ring is settled, and
- * we are not in the process of a file shutdown, mark
- * the ring as unsettled, and return SUCCEED.
- *
- * If the target free space manager is settled, and we
- * are in the process of a file shutdown, post an error
- * message, and return FAIL.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * January 3, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5C_unsettle_entry_ring(void *_entry)
-{
- H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_entry; /* Entry whose ring to unsettle */
- H5C_t *cache; /* Cache for file */
- herr_t ret_value = SUCCEED; /* Return value */
+ FUNC_ENTER_NOAPI(FAIL)
- FUNC_ENTER_NOAPI(FAIL)
+ /* Sanity checks */
+ HDassert(entry);
+ HDassert(entry->ring != H5C_RING_UNDEFINED);
+ HDassert((H5C_RING_USER == entry->ring) || (H5C_RING_RDFSM == entry->ring) ||
+ (H5C_RING_MDFSM == entry->ring));
+ cache = entry->cache_ptr;
+ HDassert(cache);
+ HDassert(cache->magic == H5C__H5C_T_MAGIC);
+
+ switch (entry->ring) {
+ case H5C_RING_USER:
+ /* Do nothing */
+ break;
- /* Sanity checks */
- HDassert(entry);
- HDassert(entry->ring != H5C_RING_UNDEFINED);
- HDassert((H5C_RING_USER == entry->ring) || (H5C_RING_RDFSM == entry->ring) || (H5C_RING_MDFSM == entry->ring));
- cache = entry->cache_ptr;
- HDassert(cache);
- HDassert(cache->magic == H5C__H5C_T_MAGIC);
-
- switch(entry->ring) {
- case H5C_RING_USER:
- /* Do nothing */
- break;
-
- case H5C_RING_RDFSM:
- if(cache->rdfsm_settled) {
- if(cache->flush_in_progress || cache->close_warning_received)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle")
- cache->rdfsm_settled = FALSE;
- } /* end if */
- break;
+ case H5C_RING_RDFSM:
+ if (cache->rdfsm_settled) {
+ if (cache->flush_in_progress || cache->close_warning_received)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle")
+ cache->rdfsm_settled = FALSE;
+ } /* end if */
+ break;
- case H5C_RING_MDFSM:
- if(cache->mdfsm_settled) {
- if(cache->flush_in_progress || cache->close_warning_received)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle")
- cache->mdfsm_settled = FALSE;
- } /* end if */
- break;
+ case H5C_RING_MDFSM:
+ if (cache->mdfsm_settled) {
+ if (cache->flush_in_progress || cache->close_warning_received)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle")
+ cache->mdfsm_settled = FALSE;
+ } /* end if */
+ break;
- default:
- HDassert(FALSE); /* this should be un-reachable */
- break;
- } /* end switch */
+ default:
+ HDassert(FALSE); /* this should be un-reachable */
+ break;
+ } /* end switch */
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_unsettle_entry_ring() */
-
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C_unsettle_entry_ring() */
-/*-------------------------------------------------------------------------
- * Function: H5C_unsettle_ring()
- *
- * Purpose: Advise the metadata cache that the specified free space
- * manager ring is no longer settled (if it was on entry).
- *
- * If the target free space manager ring is already
- * unsettled, do nothing, and return SUCCEED.
- *
- * If the target free space manager ring is settled, and
- * we are not in the process of a file shutdown, mark
- * the ring as unsettled, and return SUCCEED.
- *
- * If the target free space manager is settled, and we
- * are in the process of a file shutdown, post an error
- * message, and return FAIL.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 10/15/16
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5C_unsettle_ring(H5F_t * f, H5C_ring_t ring)
-{
- H5C_t * cache_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
+ /*-------------------------------------------------------------------------
+ * Function: H5C_unsettle_ring()
+ *
+ * Purpose: Advise the metadata cache that the specified free space
+ * manager ring is no longer settled (if it was on entry).
+ *
+ * If the target free space manager ring is already
+ * unsettled, do nothing, and return SUCCEED.
+ *
+ * If the target free space manager ring is settled, and
+ * we are not in the process of a file shutdown, mark
+ * the ring as unsettled, and return SUCCEED.
+ *
+ * If the target free space manager is settled, and we
+ * are in the process of a file shutdown, post an error
+ * message, and return FAIL.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: John Mainzer
+ * 10/15/16
+ *
+ *-------------------------------------------------------------------------
+ */
+ herr_t H5C_unsettle_ring(H5F_t * f, H5C_ring_t ring)
+ {
+ H5C_t *cache_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
- /* Sanity checks */
- HDassert(f);
- HDassert(f->shared);
- HDassert(f->shared->cache);
- HDassert((H5C_RING_RDFSM == ring) || (H5C_RING_MDFSM == ring));
- cache_ptr = f->shared->cache;
- HDassert(H5C__H5C_T_MAGIC == cache_ptr->magic);
-
- switch(ring) {
- case H5C_RING_RDFSM:
- if(cache_ptr->rdfsm_settled) {
- if(cache_ptr->close_warning_received)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle")
- cache_ptr->rdfsm_settled = FALSE;
- } /* end if */
- break;
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(f->shared->cache);
+ HDassert((H5C_RING_RDFSM == ring) || (H5C_RING_MDFSM == ring));
+ cache_ptr = f->shared->cache;
+ HDassert(H5C__H5C_T_MAGIC == cache_ptr->magic);
+
+ switch (ring) {
+ case H5C_RING_RDFSM:
+ if (cache_ptr->rdfsm_settled) {
+ if (cache_ptr->close_warning_received)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle")
+ cache_ptr->rdfsm_settled = FALSE;
+ } /* end if */
+ break;
- case H5C_RING_MDFSM:
- if(cache_ptr->mdfsm_settled) {
- if(cache_ptr->close_warning_received)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle")
- cache_ptr->mdfsm_settled = FALSE;
- } /* end if */
- break;
+ case H5C_RING_MDFSM:
+ if (cache_ptr->mdfsm_settled) {
+ if (cache_ptr->close_warning_received)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle")
+ cache_ptr->mdfsm_settled = FALSE;
+ } /* end if */
+ break;
- default:
- HDassert(FALSE); /* this should be un-reachable */
- break;
- } /* end switch */
+ default:
+ HDassert(FALSE); /* this should be un-reachable */
+ break;
+ } /* end switch */
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_unsettle_ring() */
-
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C_unsettle_ring() */
-/*-------------------------------------------------------------------------
- * Function: H5C_validate_resize_config()
- *
- * Purpose: Run a sanity check on the specified sections of the
- * provided instance of struct H5C_auto_size_ctl_t.
- *
- * Do nothing and return SUCCEED if no errors are detected,
- * and flag an error and return FAIL otherwise.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 3/23/05
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr,
- unsigned int tests)
-{
- herr_t ret_value = SUCCEED; /* Return value */
+ /*-------------------------------------------------------------------------
+ * Function: H5C_validate_resize_config()
+ *
+ * Purpose: Run a sanity check on the specified sections of the
+ * provided instance of struct H5C_auto_size_ctl_t.
+ *
+ * Do nothing and return SUCCEED if no errors are detected,
+ * and flag an error and return FAIL otherwise.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: John Mainzer
+ * 3/23/05
+ *
+ *-------------------------------------------------------------------------
+ */
+ herr_t H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, unsigned int tests)
+ {
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
- if(config_ptr == NULL)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL config_ptr on entry")
+ if (config_ptr == NULL)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL config_ptr on entry")
- if(config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown config version")
+ if (config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown config version")
- if((tests & H5C_RESIZE_CFG__VALIDATE_GENERAL) != 0) {
+ if ((tests & H5C_RESIZE_CFG__VALIDATE_GENERAL) != 0) {
- if(config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big")
+ if (config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big")
- if(config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small")
+ if (config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small")
- if(config_ptr->min_size > config_ptr->max_size)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size")
+ if (config_ptr->min_size > config_ptr->max_size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size")
- if(config_ptr->set_initial_size &&
- ((config_ptr->initial_size < config_ptr->min_size) ||
- (config_ptr->initial_size > config_ptr->max_size)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "initial_size must be in the interval [min_size, max_size]")
+ if (config_ptr->set_initial_size && ((config_ptr->initial_size < config_ptr->min_size) ||
+ (config_ptr->initial_size > config_ptr->max_size)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "initial_size must be in the interval [min_size, max_size]")
- if((config_ptr->min_clean_fraction < (double)0.0f) ||
+ if ((config_ptr->min_clean_fraction < (double)0.0f) ||
(config_ptr->min_clean_fraction > (double)1.0f))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_clean_fraction must be in the interval [0.0, 1.0]")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "min_clean_fraction must be in the interval [0.0, 1.0]")
- if(config_ptr->epoch_length < H5C__MIN_AR_EPOCH_LENGTH)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too small")
+ if (config_ptr->epoch_length < H5C__MIN_AR_EPOCH_LENGTH)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too small")
- if(config_ptr->epoch_length > H5C__MAX_AR_EPOCH_LENGTH)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too big")
- } /* H5C_RESIZE_CFG__VALIDATE_GENERAL */
+ if (config_ptr->epoch_length > H5C__MAX_AR_EPOCH_LENGTH)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too big")
+ } /* H5C_RESIZE_CFG__VALIDATE_GENERAL */
+ if ((tests & H5C_RESIZE_CFG__VALIDATE_INCREMENT) != 0) {
+ if ((config_ptr->incr_mode != H5C_incr__off) && (config_ptr->incr_mode != H5C_incr__threshold))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid incr_mode")
- if((tests & H5C_RESIZE_CFG__VALIDATE_INCREMENT) != 0) {
- if((config_ptr->incr_mode != H5C_incr__off) &&
- (config_ptr->incr_mode != H5C_incr__threshold))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid incr_mode")
-
- if(config_ptr->incr_mode == H5C_incr__threshold) {
- if((config_ptr->lower_hr_threshold < (double)0.0f) ||
+ if (config_ptr->incr_mode == H5C_incr__threshold) {
+ if ((config_ptr->lower_hr_threshold < (double)0.0f) ||
(config_ptr->lower_hr_threshold > (double)1.0f))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "lower_hr_threshold must be in the range [0.0, 1.0]")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "lower_hr_threshold must be in the range [0.0, 1.0]")
- if(config_ptr->increment < (double)1.0f)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "increment must be greater than or equal to 1.0")
+ if (config_ptr->increment < (double)1.0f)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "increment must be greater than or equal to 1.0")
- /* no need to check max_increment, as it is a size_t,
- * and thus must be non-negative.
- */
- } /* H5C_incr__threshold */
+ /* no need to check max_increment, as it is a size_t,
+ * and thus must be non-negative.
+ */
+ } /* H5C_incr__threshold */
- switch(config_ptr->flash_incr_mode) {
- case H5C_flash_incr__off:
- /* nothing to do here */
- break;
+ switch (config_ptr->flash_incr_mode) {
+ case H5C_flash_incr__off:
+ /* nothing to do here */
+ break;
- case H5C_flash_incr__add_space:
- if((config_ptr->flash_multiple < (double)0.1f) ||
+ case H5C_flash_incr__add_space:
+ if ((config_ptr->flash_multiple < (double)0.1f) ||
(config_ptr->flash_multiple > (double)10.0f))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "flash_multiple must be in the range [0.1, 10.0]")
- if((config_ptr->flash_threshold < (double)0.1f) ||
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "flash_multiple must be in the range [0.1, 10.0]")
+ if ((config_ptr->flash_threshold < (double)0.1f) ||
(config_ptr->flash_threshold > (double)1.0f))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "flash_threshold must be in the range [0.1, 1.0]")
- break;
-
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid flash_incr_mode")
- break;
- } /* end switch */
- } /* H5C_RESIZE_CFG__VALIDATE_INCREMENT */
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "flash_threshold must be in the range [0.1, 1.0]")
+ break;
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid flash_incr_mode")
+ break;
+ } /* end switch */
+ } /* H5C_RESIZE_CFG__VALIDATE_INCREMENT */
- if ( (tests & H5C_RESIZE_CFG__VALIDATE_DECREMENT) != 0 ) {
+ if ((tests & H5C_RESIZE_CFG__VALIDATE_DECREMENT) != 0) {
- if ( ( config_ptr->decr_mode != H5C_decr__off ) &&
- ( config_ptr->decr_mode != H5C_decr__threshold ) &&
- ( config_ptr->decr_mode != H5C_decr__age_out ) &&
- ( config_ptr->decr_mode != H5C_decr__age_out_with_threshold )
- ) {
+ if ((config_ptr->decr_mode != H5C_decr__off) && (config_ptr->decr_mode != H5C_decr__threshold) &&
+ (config_ptr->decr_mode != H5C_decr__age_out) &&
+ (config_ptr->decr_mode != H5C_decr__age_out_with_threshold)) {
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid decr_mode")
- }
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid decr_mode")
+ }
- if ( config_ptr->decr_mode == H5C_decr__threshold ) {
- if(config_ptr->upper_hr_threshold > (double)1.0f)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "upper_hr_threshold must be <= 1.0")
+ if (config_ptr->decr_mode == H5C_decr__threshold) {
+ if (config_ptr->upper_hr_threshold > (double)1.0f)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "upper_hr_threshold must be <= 1.0")
- if((config_ptr->decrement > (double)1.0f) ||
- (config_ptr->decrement < (double)0.0f))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "decrement must be in the interval [0.0, 1.0]")
+ if ((config_ptr->decrement > (double)1.0f) || (config_ptr->decrement < (double)0.0f))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "decrement must be in the interval [0.0, 1.0]")
- /* no need to check max_decrement as it is a size_t
- * and thus must be non-negative.
- */
- } /* H5C_decr__threshold */
+ /* no need to check max_decrement as it is a size_t
+ * and thus must be non-negative.
+ */
+ } /* H5C_decr__threshold */
- if((config_ptr->decr_mode == H5C_decr__age_out) ||
+ if ((config_ptr->decr_mode == H5C_decr__age_out) ||
(config_ptr->decr_mode == H5C_decr__age_out_with_threshold)) {
- if(config_ptr->epochs_before_eviction < 1)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction must be positive")
- if(config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big")
+ if (config_ptr->epochs_before_eviction < 1)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction must be positive")
+ if (config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big")
- if((config_ptr->apply_empty_reserve) &&
- ((config_ptr->empty_reserve > (double)1.0f) ||
- (config_ptr->empty_reserve < (double)0.0f)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty_reserve must be in the interval [0.0, 1.0]")
+ if ((config_ptr->apply_empty_reserve) && ((config_ptr->empty_reserve > (double)1.0f) ||
+ (config_ptr->empty_reserve < (double)0.0f)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "empty_reserve must be in the interval [0.0, 1.0]")
- /* no need to check max_decrement as it is a size_t
- * and thus must be non-negative.
- */
- } /* H5C_decr__age_out || H5C_decr__age_out_with_threshold */
+ /* no need to check max_decrement as it is a size_t
+ * and thus must be non-negative.
+ */
+ } /* H5C_decr__age_out || H5C_decr__age_out_with_threshold */
- if(config_ptr->decr_mode == H5C_decr__age_out_with_threshold) {
- if((config_ptr->upper_hr_threshold > (double)1.0f) ||
+ if (config_ptr->decr_mode == H5C_decr__age_out_with_threshold) {
+ if ((config_ptr->upper_hr_threshold > (double)1.0f) ||
(config_ptr->upper_hr_threshold < (double)0.0f))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "upper_hr_threshold must be in the interval [0.0, 1.0]")
- } /* H5C_decr__age_out_with_threshold */
- } /* H5C_RESIZE_CFG__VALIDATE_DECREMENT */
-
-
- if ( (tests & H5C_RESIZE_CFG__VALIDATE_INTERACTIONS) != 0 ) {
- if((config_ptr->incr_mode == H5C_incr__threshold)
- && ((config_ptr->decr_mode == H5C_decr__threshold) ||
- (config_ptr->decr_mode == H5C_decr__age_out_with_threshold))
- && (config_ptr->lower_hr_threshold >= config_ptr->upper_hr_threshold))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "conflicting threshold fields in config")
- } /* H5C_RESIZE_CFG__VALIDATE_INTERACTIONS */
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "upper_hr_threshold must be in the interval [0.0, 1.0]")
+ } /* H5C_decr__age_out_with_threshold */
+ } /* H5C_RESIZE_CFG__VALIDATE_DECREMENT */
+
+ if ((tests & H5C_RESIZE_CFG__VALIDATE_INTERACTIONS) != 0) {
+ if ((config_ptr->incr_mode == H5C_incr__threshold) &&
+ ((config_ptr->decr_mode == H5C_decr__threshold) ||
+ (config_ptr->decr_mode == H5C_decr__age_out_with_threshold)) &&
+ (config_ptr->lower_hr_threshold >= config_ptr->upper_hr_threshold))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "conflicting threshold fields in config")
+ } /* H5C_RESIZE_CFG__VALIDATE_INTERACTIONS */
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_validate_resize_config() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5C_create_flush_dependency()
- *
- * Purpose: Initiates a parent<->child entry flush dependency. The parent
- * entry must be pinned or protected at the time of call, and must
- * have all dependencies removed before the cache can shut down.
- *
- * Note: Flush dependencies in the cache indicate that a child entry
- * must be flushed to the file before its parent. (This is
- * currently used to implement Single-Writer/Multiple-Reader (SWMR)
- * I/O access for data structures in the file).
- *
- * Creating a flush dependency between two entries will also pin
- * the parent entry.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * 3/05/09
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5C_create_flush_dependency(void * parent_thing, void * child_thing)
-{
- H5C_t * cache_ptr;
- H5C_cache_entry_t * parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent thing's entry */
- H5C_cache_entry_t * child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child thing's entry */
- herr_t ret_value = SUCCEED; /* Return value */
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C_validate_resize_config() */
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(parent_entry);
- HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(H5F_addr_defined(parent_entry->addr));
- HDassert(child_entry);
- HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(H5F_addr_defined(child_entry->addr));
- cache_ptr = parent_entry->cache_ptr;
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_ptr == child_entry->cache_ptr);
-#ifndef NDEBUG
- /* Make sure the parent is not already a parent */
+ /*-------------------------------------------------------------------------
+ * Function: H5C_create_flush_dependency()
+ *
+ * Purpose: Initiates a parent<->child entry flush dependency. The parent
+ * entry must be pinned or protected at the time of call, and must
+ * have all dependencies removed before the cache can shut down.
+ *
+ * Note: Flush dependencies in the cache indicate that a child entry
+ * must be flushed to the file before its parent. (This is
+ * currently used to implement Single-Writer/Multiple-Reader (SWMR)
+ * I/O access for data structures in the file).
+ *
+ * Creating a flush dependency between two entries will also pin
+ * the parent entry.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * 3/05/09
+ *
+ *-------------------------------------------------------------------------
+ */
+ herr_t H5C_create_flush_dependency(void *parent_thing, void *child_thing)
{
- unsigned u;
-
- for(u = 0; u < child_entry->flush_dep_nparents; u++)
- HDassert(child_entry->flush_dep_parent[u] != parent_entry);
- } /* end block */
-#endif /* NDEBUG */
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t *parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent thing's entry */
+ H5C_cache_entry_t *child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child thing's entry */
+ herr_t ret_value = SUCCEED; /* Return value */
- /* More sanity checks */
- if(child_entry == parent_entry)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Child entry flush dependency parent can't be itself")
- if(!(parent_entry->is_protected || parent_entry->is_pinned))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Parent entry isn't pinned or protected")
+ FUNC_ENTER_NOAPI(FAIL)
- /* Check for parent not pinned */
- if(!parent_entry->is_pinned) {
- /* Sanity check */
- HDassert(parent_entry->flush_dep_nchildren == 0);
- HDassert(!parent_entry->pinned_from_client);
- HDassert(!parent_entry->pinned_from_cache);
+ /* Sanity checks */
+ HDassert(parent_entry);
+ HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(H5F_addr_defined(parent_entry->addr));
+ HDassert(child_entry);
+ HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(H5F_addr_defined(child_entry->addr));
+ cache_ptr = parent_entry->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr == child_entry->cache_ptr);
+#ifndef NDEBUG
+ /* Make sure the parent is not already a parent */
+ {
+ unsigned u;
+
+ for (u = 0; u < child_entry->flush_dep_nparents; u++)
+ HDassert(child_entry->flush_dep_parent[u] != parent_entry);
+ } /* end block */
+#endif /* NDEBUG */
+
+ /* More sanity checks */
+ if (child_entry == parent_entry)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL,
+ "Child entry flush dependency parent can't be itself")
+ if (!(parent_entry->is_protected || parent_entry->is_pinned))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Parent entry isn't pinned or protected")
+
+ /* Check for parent not pinned */
+ if (!parent_entry->is_pinned) {
+ /* Sanity check */
+ HDassert(parent_entry->flush_dep_nchildren == 0);
+ HDassert(!parent_entry->pinned_from_client);
+ HDassert(!parent_entry->pinned_from_cache);
- /* Pin the parent entry */
- parent_entry->is_pinned = TRUE;
- H5C__UPDATE_STATS_FOR_PIN(cache_ptr, parent_entry)
- } /* end else */
+ /* Pin the parent entry */
+ parent_entry->is_pinned = TRUE;
+ H5C__UPDATE_STATS_FOR_PIN(cache_ptr, parent_entry)
+ } /* end else */
- /* Mark the entry as pinned from the cache's action (possibly redundantly) */
- parent_entry->pinned_from_cache = TRUE;
+ /* Mark the entry as pinned from the cache's action (possibly redundantly) */
+ parent_entry->pinned_from_cache = TRUE;
- /* Check if we need to resize the child's parent array */
- if(child_entry->flush_dep_nparents >= child_entry->flush_dep_parent_nalloc) {
- if(child_entry->flush_dep_parent_nalloc == 0) {
- /* Array does not exist yet, allocate it */
- HDassert(!child_entry->flush_dep_parent);
+ /* Check if we need to resize the child's parent array */
+ if (child_entry->flush_dep_nparents >= child_entry->flush_dep_parent_nalloc) {
+ if (child_entry->flush_dep_parent_nalloc == 0) {
+ /* Array does not exist yet, allocate it */
+ HDassert(!child_entry->flush_dep_parent);
- if(NULL == (child_entry->flush_dep_parent = H5FL_SEQ_MALLOC(H5C_cache_entry_ptr_t, H5C_FLUSH_DEP_PARENT_INIT)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flush dependency parent list")
- child_entry->flush_dep_parent_nalloc = H5C_FLUSH_DEP_PARENT_INIT;
+ if (NULL == (child_entry->flush_dep_parent =
+ H5FL_SEQ_MALLOC(H5C_cache_entry_ptr_t, H5C_FLUSH_DEP_PARENT_INIT)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory allocation failed for flush dependency parent list")
+ child_entry->flush_dep_parent_nalloc = H5C_FLUSH_DEP_PARENT_INIT;
+ } /* end if */
+ else {
+ /* Resize existing array */
+ HDassert(child_entry->flush_dep_parent);
+
+ if (NULL == (child_entry->flush_dep_parent =
+ H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent,
+ 2 * child_entry->flush_dep_parent_nalloc)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory allocation failed for flush dependency parent list")
+ child_entry->flush_dep_parent_nalloc *= 2;
+ } /* end else */
+ cache_ptr->entry_fd_height_change_counter++;
} /* end if */
- else {
- /* Resize existing array */
- HDassert(child_entry->flush_dep_parent);
-
- if(NULL == (child_entry->flush_dep_parent = H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent, 2 * child_entry->flush_dep_parent_nalloc)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flush dependency parent list")
- child_entry->flush_dep_parent_nalloc *= 2;
- } /* end else */
- cache_ptr->entry_fd_height_change_counter++;
- } /* end if */
- /* Add the dependency to the child's parent array */
- child_entry->flush_dep_parent[child_entry->flush_dep_nparents] = parent_entry;
- child_entry->flush_dep_nparents++;
+ /* Add the dependency to the child's parent array */
+ child_entry->flush_dep_parent[child_entry->flush_dep_nparents] = parent_entry;
+ child_entry->flush_dep_nparents++;
- /* Increment parent's number of children */
- parent_entry->flush_dep_nchildren++;
+ /* Increment parent's number of children */
+ parent_entry->flush_dep_nchildren++;
- /* Adjust the number of dirty children */
- if(child_entry->is_dirty) {
- /* Sanity check */
- HDassert(parent_entry->flush_dep_ndirty_children < parent_entry->flush_dep_nchildren);
+ /* Adjust the number of dirty children */
+ if (child_entry->is_dirty) {
+ /* Sanity check */
+ HDassert(parent_entry->flush_dep_ndirty_children < parent_entry->flush_dep_nchildren);
- parent_entry->flush_dep_ndirty_children++;
+ parent_entry->flush_dep_ndirty_children++;
- /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */
- if(parent_entry->type->notify &&
+ /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */
+ if (parent_entry->type->notify &&
(parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED, parent_entry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify parent about child entry dirty flag set")
- } /* end if */
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify parent about child entry dirty flag set")
+ } /* end if */
- /* adjust the parent's number of unserialized children. Note
- * that it is possible for and entry to be clean and unserialized.
- */
- if(!child_entry->image_up_to_date) {
- HDassert(parent_entry->flush_dep_nunser_children < parent_entry->flush_dep_nchildren);
+ /* adjust the parent's number of unserialized children. Note
+ * that it is possible for and entry to be clean and unserialized.
+ */
+ if (!child_entry->image_up_to_date) {
+ HDassert(parent_entry->flush_dep_nunser_children < parent_entry->flush_dep_nchildren);
- parent_entry->flush_dep_nunser_children++;
+ parent_entry->flush_dep_nunser_children++;
- /* If the parent has a 'notify' callback, send a 'child entry unserialized' notice */
- if(parent_entry->type->notify &&
+ /* If the parent has a 'notify' callback, send a 'child entry unserialized' notice */
+ if (parent_entry->type->notify &&
(parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED, parent_entry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify parent about child entry serialized flag reset")
- } /* end if */
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify parent about child entry serialized flag reset")
+ } /* end if */
- /* Post-conditions, for successful operation */
- HDassert(parent_entry->is_pinned);
- HDassert(parent_entry->flush_dep_nchildren > 0);
- HDassert(child_entry->flush_dep_parent);
- HDassert(child_entry->flush_dep_nparents > 0);
- HDassert(child_entry->flush_dep_parent_nalloc > 0);
+ /* Post-conditions, for successful operation */
+ HDassert(parent_entry->is_pinned);
+ HDassert(parent_entry->flush_dep_nchildren > 0);
+ HDassert(child_entry->flush_dep_parent);
+ HDassert(child_entry->flush_dep_nparents > 0);
+ HDassert(child_entry->flush_dep_parent_nalloc > 0);
#ifndef NDEBUG
- H5C__assert_flush_dep_nocycle(parent_entry, child_entry);
+ H5C__assert_flush_dep_nocycle(parent_entry, child_entry);
#endif /* NDEBUG */
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_create_flush_dependency() */
-
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C_create_flush_dependency() */
-/*-------------------------------------------------------------------------
- * Function: H5C_destroy_flush_dependency()
- *
- * Purpose: Terminates a parent<-> child entry flush dependency. The
- * parent entry must be pinned.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * 3/05/09
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5C_destroy_flush_dependency(void *parent_thing, void * child_thing)
-{
- H5C_t * cache_ptr;
- H5C_cache_entry_t * parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent entry */
- H5C_cache_entry_t * child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child entry */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ /*-------------------------------------------------------------------------
+ * Function: H5C_destroy_flush_dependency()
+ *
+ * Purpose: Terminates a parent<-> child entry flush dependency. The
+ * parent entry must be pinned.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * 3/05/09
+ *
+ *-------------------------------------------------------------------------
+ */
+ herr_t H5C_destroy_flush_dependency(void *parent_thing, void *child_thing)
+ {
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t *parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent entry */
+ H5C_cache_entry_t *child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child entry */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
- /* Sanity checks */
- HDassert(parent_entry);
- HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(H5F_addr_defined(parent_entry->addr));
- HDassert(child_entry);
- HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(H5F_addr_defined(child_entry->addr));
- cache_ptr = parent_entry->cache_ptr;
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_ptr == child_entry->cache_ptr);
-
- /* Usage checks */
- if(!parent_entry->is_pinned)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Parent entry isn't pinned")
- if(NULL == child_entry->flush_dep_parent)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Child entry doesn't have a flush dependency parent array")
- if(0 == parent_entry->flush_dep_nchildren)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Parent entry flush dependency ref. count has no child dependencies")
-
- /* Search for parent in child's parent array. This is a linear search
- * because we do not expect large numbers of parents. If this changes, we
- * may wish to change the parent array to a skip list */
- for(u = 0; u < child_entry->flush_dep_nparents; u++)
- if(child_entry->flush_dep_parent[u] == parent_entry)
- break;
- if(u == child_entry->flush_dep_nparents)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Parent entry isn't a flush dependency parent for child entry")
-
- /* Remove parent entry from child's parent array */
- if(u < (child_entry->flush_dep_nparents - 1))
- HDmemmove(&child_entry->flush_dep_parent[u],
- &child_entry->flush_dep_parent[u + 1],
- (child_entry->flush_dep_nparents - u - 1) * sizeof(child_entry->flush_dep_parent[0]));
- child_entry->flush_dep_nparents--;
-
- /* Adjust parent entry's nchildren and unpin parent if it goes to zero */
- parent_entry->flush_dep_nchildren--;
- if(0 == parent_entry->flush_dep_nchildren) {
- /* Sanity check */
- HDassert(parent_entry->pinned_from_cache);
+ /* Sanity checks */
+ HDassert(parent_entry);
+ HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(H5F_addr_defined(parent_entry->addr));
+ HDassert(child_entry);
+ HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(H5F_addr_defined(child_entry->addr));
+ cache_ptr = parent_entry->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr == child_entry->cache_ptr);
+
+ /* Usage checks */
+ if (!parent_entry->is_pinned)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Parent entry isn't pinned")
+ if (NULL == child_entry->flush_dep_parent)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL,
+ "Child entry doesn't have a flush dependency parent array")
+ if (0 == parent_entry->flush_dep_nchildren)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL,
+ "Parent entry flush dependency ref. count has no child dependencies")
+
+ /* Search for parent in child's parent array. This is a linear search
+ * because we do not expect large numbers of parents. If this changes, we
+ * may wish to change the parent array to a skip list */
+ for (u = 0; u < child_entry->flush_dep_nparents; u++)
+ if (child_entry->flush_dep_parent[u] == parent_entry)
+ break;
+ if (u == child_entry->flush_dep_nparents)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL,
+ "Parent entry isn't a flush dependency parent for child entry")
+
+ /* Remove parent entry from child's parent array */
+ if (u < (child_entry->flush_dep_nparents - 1))
+ HDmemmove(&child_entry->flush_dep_parent[u], &child_entry->flush_dep_parent[u + 1],
+ (child_entry->flush_dep_nparents - u - 1) * sizeof(child_entry->flush_dep_parent[0]));
+ child_entry->flush_dep_nparents--;
+
+ /* Adjust parent entry's nchildren and unpin parent if it goes to zero */
+ parent_entry->flush_dep_nchildren--;
+ if (0 == parent_entry->flush_dep_nchildren) {
+ /* Sanity check */
+ HDassert(parent_entry->pinned_from_cache);
- /* Check if we should unpin parent entry now */
- if(!parent_entry->pinned_from_client)
- if(H5C__unpin_entry_real(cache_ptr, parent_entry, TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry")
+ /* Check if we should unpin parent entry now */
+ if (!parent_entry->pinned_from_client)
+ if (H5C__unpin_entry_real(cache_ptr, parent_entry, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry")
- /* Mark the entry as unpinned from the cache's action */
- parent_entry->pinned_from_cache = FALSE;
- } /* end if */
+ /* Mark the entry as unpinned from the cache's action */
+ parent_entry->pinned_from_cache = FALSE;
+ } /* end if */
- /* Adjust parent entry's ndirty_children */
- if(child_entry->is_dirty) {
- /* Sanity check */
- HDassert(parent_entry->flush_dep_ndirty_children > 0);
+ /* Adjust parent entry's ndirty_children */
+ if (child_entry->is_dirty) {
+ /* Sanity check */
+ HDassert(parent_entry->flush_dep_ndirty_children > 0);
- parent_entry->flush_dep_ndirty_children--;
+ parent_entry->flush_dep_ndirty_children--;
- /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */
- if(parent_entry->type->notify &&
+ /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */
+ if (parent_entry->type->notify &&
(parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED, parent_entry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify parent about child entry dirty flag reset")
- } /* end if */
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify parent about child entry dirty flag reset")
+ } /* end if */
- /* adjust parent entry's number of unserialized children */
- if(!child_entry->image_up_to_date) {
- HDassert(parent_entry->flush_dep_nunser_children > 0);
+ /* adjust parent entry's number of unserialized children */
+ if (!child_entry->image_up_to_date) {
+ HDassert(parent_entry->flush_dep_nunser_children > 0);
- parent_entry->flush_dep_nunser_children--;
+ parent_entry->flush_dep_nunser_children--;
- /* If the parent has a 'notify' callback, send a 'child entry serialized' notice */
- if(parent_entry->type->notify &&
+ /* If the parent has a 'notify' callback, send a 'child entry serialized' notice */
+ if (parent_entry->type->notify &&
(parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_SERIALIZED, parent_entry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify parent about child entry serialized flag set")
- } /* end if */
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify parent about child entry serialized flag set")
+ } /* end if */
- /* Shrink or free the parent array if apporpriate */
- if(child_entry->flush_dep_nparents == 0) {
- child_entry->flush_dep_parent = H5FL_SEQ_FREE(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent);
- child_entry->flush_dep_parent_nalloc = 0;
- } /* end if */
- else if(child_entry->flush_dep_parent_nalloc > H5C_FLUSH_DEP_PARENT_INIT
- && child_entry->flush_dep_nparents <= (child_entry->flush_dep_parent_nalloc / 4)) {
- if(NULL == (child_entry->flush_dep_parent = H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent, child_entry->flush_dep_parent_nalloc / 4)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flush dependency parent list")
- child_entry->flush_dep_parent_nalloc /= 4;
- } /* end if */
+ /* Shrink or free the parent array if apporpriate */
+ if (child_entry->flush_dep_nparents == 0) {
+ child_entry->flush_dep_parent =
+ H5FL_SEQ_FREE(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent);
+ child_entry->flush_dep_parent_nalloc = 0;
+ } /* end if */
+ else if (child_entry->flush_dep_parent_nalloc > H5C_FLUSH_DEP_PARENT_INIT &&
+ child_entry->flush_dep_nparents <= (child_entry->flush_dep_parent_nalloc / 4)) {
+ if (NULL == (child_entry->flush_dep_parent =
+ H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent,
+ child_entry->flush_dep_parent_nalloc / 4)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory allocation failed for flush dependency parent list")
+ child_entry->flush_dep_parent_nalloc /= 4;
+ } /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_destroy_flush_dependency() */
-
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C_destroy_flush_dependency() */
/*************************************************************************/
/**************************** Private Functions: *************************/
/*************************************************************************/
-
/*-------------------------------------------------------------------------
* Function: H5C__pin_entry_from_client()
*
@@ -4304,3825 +4139,3605 @@ done:
*-------------------------------------------------------------------------
*/
#if H5C_COLLECT_CACHE_STATS
-static herr_t
-H5C__pin_entry_from_client(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr)
+ static herr_t H5C__pin_entry_from_client(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr)
#else
static herr_t
H5C__pin_entry_from_client(H5C_t H5_ATTR_UNUSED *cache_ptr, H5C_cache_entry_t *entry_ptr)
#endif
-{
- herr_t ret_value = SUCCEED; /* Return value */
+ {
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- /* Sanity checks */
- HDassert(cache_ptr);
- HDassert(entry_ptr);
- HDassert(entry_ptr->is_protected);
+ /* Sanity checks */
+ HDassert(cache_ptr);
+ HDassert(entry_ptr);
+ HDassert(entry_ptr->is_protected);
- /* Check if the entry is already pinned */
- if(entry_ptr->is_pinned) {
- /* Check if the entry was pinned through an explicit pin from a client */
- if(entry_ptr->pinned_from_client)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "entry is already pinned")
- } /* end if */
- else {
- entry_ptr->is_pinned = TRUE;
+ /* Check if the entry is already pinned */
+ if (entry_ptr->is_pinned) {
+ /* Check if the entry was pinned through an explicit pin from a client */
+ if (entry_ptr->pinned_from_client)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "entry is already pinned")
+ } /* end if */
+ else {
+ entry_ptr->is_pinned = TRUE;
- H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr)
- } /* end else */
+ H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr)
+ } /* end else */
- /* Mark that the entry was pinned through an explicit pin from a client */
- entry_ptr->pinned_from_client = TRUE;
+ /* Mark that the entry was pinned through an explicit pin from a client */
+ entry_ptr->pinned_from_client = TRUE;
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__pin_entry_from_client() */
-
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__pin_entry_from_client() */
-/*-------------------------------------------------------------------------
- * Function: H5C__unpin_entry_real()
- *
- * Purpose: Internal routine to unpin a cache entry.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * 1/6/18
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr,
- hbool_t update_rp)
-{
- herr_t ret_value = SUCCEED; /* Return value */
+ /*-------------------------------------------------------------------------
+ * Function: H5C__unpin_entry_real()
+ *
+ * Purpose: Internal routine to unpin a cache entry.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * 1/6/18
+ *
+ *-------------------------------------------------------------------------
+ */
+ static herr_t H5C__unpin_entry_real(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr, hbool_t update_rp)
+ {
+ herr_t ret_value = SUCCEED; /* Return value */
#if H5C_DO_SANITY_CHECKS
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
#else
FUNC_ENTER_STATIC_NOERR
#endif
- /* Sanity checking */
- HDassert(cache_ptr);
- HDassert(entry_ptr);
- HDassert(entry_ptr->is_pinned);
+ /* Sanity checking */
+ HDassert(cache_ptr);
+ HDassert(entry_ptr);
+ HDassert(entry_ptr->is_pinned);
- /* If requested, update the replacement policy if the entry is not protected */
- if(update_rp && !entry_ptr->is_protected)
- H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, FAIL)
+ /* If requested, update the replacement policy if the entry is not protected */
+ if (update_rp && !entry_ptr->is_protected)
+ H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, FAIL)
- /* Unpin the entry now */
- entry_ptr->is_pinned = FALSE;
+ /* Unpin the entry now */
+ entry_ptr->is_pinned = FALSE;
- /* Update the stats for an unpin operation */
- H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr)
+ /* Update the stats for an unpin operation */
+ H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr)
#if H5C_DO_SANITY_CHECKS
done:
#endif
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__unpin_entry_real() */
-
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__unpin_entry_real() */
-/*-------------------------------------------------------------------------
- * Function: H5C__unpin_entry_from_client()
- *
- * Purpose: Internal routine to unpin a cache entry from a client action.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * 3/24/09
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__unpin_entry_from_client(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr,
- hbool_t update_rp)
-{
- herr_t ret_value = SUCCEED; /* Return value */
+ /*-------------------------------------------------------------------------
+ * Function: H5C__unpin_entry_from_client()
+ *
+ * Purpose: Internal routine to unpin a cache entry from a client action.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * 3/24/09
+ *
+ *-------------------------------------------------------------------------
+ */
+ static herr_t H5C__unpin_entry_from_client(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr,
+ hbool_t update_rp)
+ {
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- /* Sanity checking */
- HDassert(cache_ptr);
- HDassert(entry_ptr);
+ /* Sanity checking */
+ HDassert(cache_ptr);
+ HDassert(entry_ptr);
- /* Error checking (should be sanity checks?) */
- if(!entry_ptr->is_pinned)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "entry isn't pinned")
- if(!entry_ptr->pinned_from_client)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "entry wasn't pinned by cache client")
+ /* Error checking (should be sanity checks?) */
+ if (!entry_ptr->is_pinned)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "entry isn't pinned")
+ if (!entry_ptr->pinned_from_client)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "entry wasn't pinned by cache client")
- /* Check if the entry is not pinned from a flush dependency */
- if(!entry_ptr->pinned_from_cache)
- if(H5C__unpin_entry_real(cache_ptr, entry_ptr, update_rp) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry")
+ /* Check if the entry is not pinned from a flush dependency */
+ if (!entry_ptr->pinned_from_cache)
+ if (H5C__unpin_entry_real(cache_ptr, entry_ptr, update_rp) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry")
- /* Mark the entry as explicitly unpinned by the client */
- entry_ptr->pinned_from_client = FALSE;
+ /* Mark the entry as explicitly unpinned by the client */
+ entry_ptr->pinned_from_client = FALSE;
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__unpin_entry_from_client() */
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__unpin_entry_from_client() */
-/*-------------------------------------------------------------------------
- *
- * Function: H5C__auto_adjust_cache_size
- *
- * Purpose: Obtain the current full cache hit rate, and compare it
- * with the hit rate thresholds for modifying cache size.
- * If one of the thresholds has been crossed, adjusts the
- * size of the cache accordingly.
- *
- * The function then resets the full cache hit rate
- * statistics, and exits.
- *
- * Return: Non-negative on success/Negative on failure or if there was
- * an attempt to flush a protected item.
- *
- *
- * Programmer: John Mainzer, 10/7/04
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__auto_adjust_cache_size(H5F_t *f, hbool_t write_permitted)
-{
- H5C_t * cache_ptr = f->shared->cache;
- hbool_t reentrant_call = FALSE;
- hbool_t inserted_epoch_marker = FALSE;
- size_t new_max_cache_size = 0;
- size_t old_max_cache_size = 0;
- size_t new_min_clean_size = 0;
- size_t old_min_clean_size = 0;
- double hit_rate;
- enum H5C_resize_status status = in_spec; /* will change if needed */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- HDassert( f );
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( cache_ptr->cache_accesses >=
- (cache_ptr->resize_ctl).epoch_length );
- HDassert( (double)0.0f <= (cache_ptr->resize_ctl).min_clean_fraction );
- HDassert( (cache_ptr->resize_ctl).min_clean_fraction <= (double)100.0f );
-
- /* check to see if cache_ptr->resize_in_progress is TRUE. If it, this
- * is a re-entrant call via a client callback called in the resize
- * process. To avoid an infinite recursion, set reentrant_call to
- * TRUE, and goto done.
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C__auto_adjust_cache_size
+ *
+ * Purpose: Obtain the current full cache hit rate, and compare it
+ * with the hit rate thresholds for modifying cache size.
+ * If one of the thresholds has been crossed, adjusts the
+ * size of the cache accordingly.
+ *
+ * The function then resets the full cache hit rate
+ * statistics, and exits.
+ *
+ * Return: Non-negative on success/Negative on failure or if there was
+ * an attempt to flush a protected item.
+ *
+ *
+ * Programmer: John Mainzer, 10/7/04
+ *
+ *-------------------------------------------------------------------------
*/
- if(cache_ptr->resize_in_progress) {
- reentrant_call = TRUE;
- HGOTO_DONE(SUCCEED)
- } /* end if */
-
- cache_ptr->resize_in_progress = TRUE;
-
- if(!cache_ptr->resize_enabled)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Auto cache resize disabled")
+ static herr_t H5C__auto_adjust_cache_size(H5F_t * f, hbool_t write_permitted)
+ {
+ H5C_t * cache_ptr = f->shared->cache;
+ hbool_t reentrant_call = FALSE;
+ hbool_t inserted_epoch_marker = FALSE;
+ size_t new_max_cache_size = 0;
+ size_t old_max_cache_size = 0;
+ size_t new_min_clean_size = 0;
+ size_t old_min_clean_size = 0;
+ double hit_rate;
+ enum H5C_resize_status status = in_spec; /* will change if needed */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ HDassert(f);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length);
+ HDassert((double)0.0f <= (cache_ptr->resize_ctl).min_clean_fraction);
+ HDassert((cache_ptr->resize_ctl).min_clean_fraction <= (double)100.0f);
+
+ /* check to see if cache_ptr->resize_in_progress is TRUE. If it, this
+ * is a re-entrant call via a client callback called in the resize
+ * process. To avoid an infinite recursion, set reentrant_call to
+ * TRUE, and goto done.
+ */
+ if (cache_ptr->resize_in_progress) {
+ reentrant_call = TRUE;
+ HGOTO_DONE(SUCCEED)
+ } /* end if */
- HDassert(((cache_ptr->resize_ctl).incr_mode != H5C_incr__off) || \
- ((cache_ptr->resize_ctl).decr_mode != H5C_decr__off));
+ cache_ptr->resize_in_progress = TRUE;
- if(H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate")
+ if (!cache_ptr->resize_enabled)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Auto cache resize disabled")
- HDassert( ( (double)0.0f <= hit_rate ) && ( hit_rate <= (double)1.0f ) );
+ HDassert(((cache_ptr->resize_ctl).incr_mode != H5C_incr__off) ||
+ ((cache_ptr->resize_ctl).decr_mode != H5C_decr__off));
- switch((cache_ptr->resize_ctl).incr_mode) {
- case H5C_incr__off:
- if(cache_ptr->size_increase_possible)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "size_increase_possible but H5C_incr__off?!?!?")
- break;
+ if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate")
- case H5C_incr__threshold:
- if ( hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold ) {
+ HDassert(((double)0.0f <= hit_rate) && (hit_rate <= (double)1.0f));
- if ( ! cache_ptr->size_increase_possible ) {
+ switch ((cache_ptr->resize_ctl).incr_mode) {
+ case H5C_incr__off:
+ if (cache_ptr->size_increase_possible)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "size_increase_possible but H5C_incr__off?!?!?")
+ break;
- status = increase_disabled;
+ case H5C_incr__threshold:
+ if (hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold) {
- } else if ( cache_ptr->max_cache_size >=
- (cache_ptr->resize_ctl).max_size ) {
+ if (!cache_ptr->size_increase_possible) {
- HDassert( cache_ptr->max_cache_size == \
- (cache_ptr->resize_ctl).max_size );
- status = at_max_size;
+ status = increase_disabled;
+ }
+ else if (cache_ptr->max_cache_size >= (cache_ptr->resize_ctl).max_size) {
- } else if ( ! cache_ptr->cache_full ) {
+ HDassert(cache_ptr->max_cache_size == (cache_ptr->resize_ctl).max_size);
+ status = at_max_size;
+ }
+ else if (!cache_ptr->cache_full) {
- status = not_full;
+ status = not_full;
+ }
+ else {
- } else {
+ new_max_cache_size = (size_t)(((double)(cache_ptr->max_cache_size)) *
+ (cache_ptr->resize_ctl).increment);
- new_max_cache_size = (size_t)
- (((double)(cache_ptr->max_cache_size)) *
- (cache_ptr->resize_ctl).increment);
+ /* clip to max size if necessary */
+ if (new_max_cache_size > (cache_ptr->resize_ctl).max_size) {
- /* clip to max size if necessary */
- if ( new_max_cache_size >
- (cache_ptr->resize_ctl).max_size ) {
+ new_max_cache_size = (cache_ptr->resize_ctl).max_size;
+ }
- new_max_cache_size = (cache_ptr->resize_ctl).max_size;
- }
+ /* clip to max increment if necessary */
+ if (((cache_ptr->resize_ctl).apply_max_increment) &&
+ ((cache_ptr->max_cache_size + (cache_ptr->resize_ctl).max_increment) <
+ new_max_cache_size)) {
- /* clip to max increment if necessary */
- if ( ( (cache_ptr->resize_ctl).apply_max_increment ) &&
- ( (cache_ptr->max_cache_size +
- (cache_ptr->resize_ctl).max_increment) <
- new_max_cache_size ) ) {
+ new_max_cache_size =
+ cache_ptr->max_cache_size + (cache_ptr->resize_ctl).max_increment;
+ }
- new_max_cache_size = cache_ptr->max_cache_size +
- (cache_ptr->resize_ctl).max_increment;
+ status = increase;
}
-
- status = increase;
}
- }
- break;
+ break;
- default:
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode")
- }
+ default:
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode")
+ }
- /* If the decr_mode is either age out or age out with threshold, we
- * must run the marker maintenance code, whether we run the size
- * reduction code or not. We do this in two places -- here we
- * insert a new marker if the number of active epoch markers is
- * is less than the the current epochs before eviction, and after
- * the ageout call, we cycle the markers.
- *
- * However, we can't call the ageout code or cycle the markers
- * unless there was a full complement of markers in place on
- * entry. The inserted_epoch_marker flag is used to track this.
- */
+ /* If the decr_mode is either age out or age out with threshold, we
+ * must run the marker maintenance code, whether we run the size
+ * reduction code or not. We do this in two places -- here we
+ * insert a new marker if the number of active epoch markers is
+ * is less than the the current epochs before eviction, and after
+ * the ageout call, we cycle the markers.
+ *
+ * However, we can't call the ageout code or cycle the markers
+ * unless there was a full complement of markers in place on
+ * entry. The inserted_epoch_marker flag is used to track this.
+ */
- if ( ( ( (cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out )
- ||
- ( (cache_ptr->resize_ctl).decr_mode ==
- H5C_decr__age_out_with_threshold
- )
- )
- &&
- ( cache_ptr->epoch_markers_active <
- (cache_ptr->resize_ctl).epochs_before_eviction
- )
- ) {
-
- if(H5C__autoadjust__ageout__insert_new_marker(cache_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't insert new epoch marker")
-
- inserted_epoch_marker = TRUE;
- }
+ if ((((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) ||
+ ((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold)) &&
+ (cache_ptr->epoch_markers_active < (cache_ptr->resize_ctl).epochs_before_eviction)) {
- /* don't run the cache size decrease code unless the cache size
- * increase code is disabled, or the size increase code sees no need
- * for action. In either case, status == in_spec at this point.
- */
+ if (H5C__autoadjust__ageout__insert_new_marker(cache_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't insert new epoch marker")
- if ( status == in_spec ) {
+ inserted_epoch_marker = TRUE;
+ }
- switch ( (cache_ptr->resize_ctl).decr_mode )
- {
- case H5C_decr__off:
- break;
+ /* don't run the cache size decrease code unless the cache size
+ * increase code is disabled, or the size increase code sees no need
+ * for action. In either case, status == in_spec at this point.
+ */
+
+ if (status == in_spec) {
- case H5C_decr__threshold:
- if ( hit_rate > (cache_ptr->resize_ctl).upper_hr_threshold ) {
+ switch ((cache_ptr->resize_ctl).decr_mode) {
+ case H5C_decr__off:
+ break;
- if ( ! cache_ptr->size_decrease_possible ) {
+ case H5C_decr__threshold:
+ if (hit_rate > (cache_ptr->resize_ctl).upper_hr_threshold) {
- status = decrease_disabled;
+ if (!cache_ptr->size_decrease_possible) {
- } else if ( cache_ptr->max_cache_size <=
- (cache_ptr->resize_ctl).min_size ) {
+ status = decrease_disabled;
+ }
+ else if (cache_ptr->max_cache_size <= (cache_ptr->resize_ctl).min_size) {
- HDassert( cache_ptr->max_cache_size ==
- (cache_ptr->resize_ctl).min_size );
- status = at_min_size;
+ HDassert(cache_ptr->max_cache_size == (cache_ptr->resize_ctl).min_size);
+ status = at_min_size;
+ }
+ else {
- } else {
+ new_max_cache_size = (size_t)(((double)(cache_ptr->max_cache_size)) *
+ (cache_ptr->resize_ctl).decrement);
- new_max_cache_size = (size_t)
- (((double)(cache_ptr->max_cache_size)) *
- (cache_ptr->resize_ctl).decrement);
+ /* clip to min size if necessary */
+ if (new_max_cache_size < (cache_ptr->resize_ctl).min_size) {
- /* clip to min size if necessary */
- if ( new_max_cache_size <
- (cache_ptr->resize_ctl).min_size ) {
+ new_max_cache_size = (cache_ptr->resize_ctl).min_size;
+ }
- new_max_cache_size =
- (cache_ptr->resize_ctl).min_size;
- }
+ /* clip to max decrement if necessary */
+ if (((cache_ptr->resize_ctl).apply_max_decrement) &&
+ (((cache_ptr->resize_ctl).max_decrement + new_max_cache_size) <
+ cache_ptr->max_cache_size)) {
- /* clip to max decrement if necessary */
- if ( ( (cache_ptr->resize_ctl).apply_max_decrement ) &&
- ( ((cache_ptr->resize_ctl).max_decrement +
- new_max_cache_size) <
- cache_ptr->max_cache_size ) ) {
+ new_max_cache_size =
+ cache_ptr->max_cache_size - (cache_ptr->resize_ctl).max_decrement;
+ }
- new_max_cache_size = cache_ptr->max_cache_size -
- (cache_ptr->resize_ctl).max_decrement;
+ status = decrease;
}
-
- status = decrease;
}
- }
- break;
+ break;
- case H5C_decr__age_out_with_threshold:
- case H5C_decr__age_out:
- if(!inserted_epoch_marker) {
- if(!cache_ptr->size_decrease_possible)
- status = decrease_disabled;
- else {
- if(H5C__autoadjust__ageout(f, hit_rate, &status, &new_max_cache_size, write_permitted) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ageout code failed")
- } /* end else */
- } /* end if */
- break;
+ case H5C_decr__age_out_with_threshold:
+ case H5C_decr__age_out:
+ if (!inserted_epoch_marker) {
+ if (!cache_ptr->size_decrease_possible)
+ status = decrease_disabled;
+ else {
+ if (H5C__autoadjust__ageout(f, hit_rate, &status, &new_max_cache_size,
+ write_permitted) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ageout code failed")
+ } /* end else */
+ } /* end if */
+ break;
- default:
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode")
+ default:
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode")
+ }
}
- }
- /* cycle the epoch markers here if appropriate */
- if ( ( ( (cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out )
- ||
- ( (cache_ptr->resize_ctl).decr_mode ==
- H5C_decr__age_out_with_threshold
- )
- )
- &&
- ( ! inserted_epoch_marker )
- ) {
-
- /* move last epoch marker to the head of the LRU list */
- if(H5C__autoadjust__ageout__cycle_epoch_marker(cache_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error cycling epoch marker")
- }
+ /* cycle the epoch markers here if appropriate */
+ if ((((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) ||
+ ((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold)) &&
+ (!inserted_epoch_marker)) {
- if ( ( status == increase ) || ( status == decrease ) ) {
+ /* move last epoch marker to the head of the LRU list */
+ if (H5C__autoadjust__ageout__cycle_epoch_marker(cache_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error cycling epoch marker")
+ }
- old_max_cache_size = cache_ptr->max_cache_size;
- old_min_clean_size = cache_ptr->min_clean_size;
+ if ((status == increase) || (status == decrease)) {
- new_min_clean_size = (size_t)
- ((double)new_max_cache_size *
- ((cache_ptr->resize_ctl).min_clean_fraction));
+ old_max_cache_size = cache_ptr->max_cache_size;
+ old_min_clean_size = cache_ptr->min_clean_size;
- /* new_min_clean_size is of size_t, and thus must be non-negative.
- * Hence we have
- *
- * ( 0 <= new_min_clean_size ).
- *
- * by definition.
- */
- HDassert( new_min_clean_size <= new_max_cache_size );
- HDassert( (cache_ptr->resize_ctl).min_size <= new_max_cache_size );
- HDassert( new_max_cache_size <= (cache_ptr->resize_ctl).max_size );
+ new_min_clean_size =
+ (size_t)((double)new_max_cache_size * ((cache_ptr->resize_ctl).min_clean_fraction));
- cache_ptr->max_cache_size = new_max_cache_size;
- cache_ptr->min_clean_size = new_min_clean_size;
+ /* new_min_clean_size is of size_t, and thus must be non-negative.
+ * Hence we have
+ *
+ * ( 0 <= new_min_clean_size ).
+ *
+ * by definition.
+ */
+ HDassert(new_min_clean_size <= new_max_cache_size);
+ HDassert((cache_ptr->resize_ctl).min_size <= new_max_cache_size);
+ HDassert(new_max_cache_size <= (cache_ptr->resize_ctl).max_size);
- if ( status == increase ) {
+ cache_ptr->max_cache_size = new_max_cache_size;
+ cache_ptr->min_clean_size = new_min_clean_size;
- cache_ptr->cache_full = FALSE;
+ if (status == increase) {
- } else if ( status == decrease ) {
+ cache_ptr->cache_full = FALSE;
+ }
+ else if (status == decrease) {
- cache_ptr->size_decreased = TRUE;
- }
+ cache_ptr->size_decreased = TRUE;
+ }
- /* update flash cache size increase fields as appropriate */
- if ( cache_ptr->flash_size_increase_possible ) {
+ /* update flash cache size increase fields as appropriate */
+ if (cache_ptr->flash_size_increase_possible) {
- switch ( (cache_ptr->resize_ctl).flash_incr_mode )
- {
- case H5C_flash_incr__off:
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "flash_size_increase_possible but H5C_flash_incr__off?!")
- break;
+ switch ((cache_ptr->resize_ctl).flash_incr_mode) {
+ case H5C_flash_incr__off:
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL,
+ "flash_size_increase_possible but H5C_flash_incr__off?!")
+ break;
- case H5C_flash_incr__add_space:
- cache_ptr->flash_size_increase_threshold =
- (size_t)
- (((double)(cache_ptr->max_cache_size)) *
- ((cache_ptr->resize_ctl).flash_threshold));
- break;
+ case H5C_flash_incr__add_space:
+ cache_ptr->flash_size_increase_threshold =
+ (size_t)(((double)(cache_ptr->max_cache_size)) *
+ ((cache_ptr->resize_ctl).flash_threshold));
+ break;
- default: /* should be unreachable */
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?")
- break;
+ default: /* should be unreachable */
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?")
+ break;
+ }
}
}
- }
- if ( (cache_ptr->resize_ctl).rpt_fcn != NULL ) {
- (*((cache_ptr->resize_ctl).rpt_fcn))
- (cache_ptr,
- H5C__CURR_AUTO_RESIZE_RPT_FCN_VER,
- hit_rate,
- status,
- old_max_cache_size,
- new_max_cache_size,
- old_min_clean_size,
- new_min_clean_size);
- }
+ if ((cache_ptr->resize_ctl).rpt_fcn != NULL) {
+ (*((cache_ptr->resize_ctl).rpt_fcn))(cache_ptr, H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, hit_rate,
+ status, old_max_cache_size, new_max_cache_size,
+ old_min_clean_size, new_min_clean_size);
+ }
- if(H5C_reset_cache_hit_rate_stats(cache_ptr) < 0)
- /* this should be impossible... */
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed")
+ if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0)
+ /* this should be impossible... */
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed")
done:
- /* Sanity checks */
- HDassert(cache_ptr->resize_in_progress);
- if(!reentrant_call)
- cache_ptr->resize_in_progress = FALSE;
- HDassert((!reentrant_call) || (cache_ptr->resize_in_progress));
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__auto_adjust_cache_size() */
+ /* Sanity checks */
+ HDassert(cache_ptr->resize_in_progress);
+ if (!reentrant_call)
+ cache_ptr->resize_in_progress = FALSE;
+ HDassert((!reentrant_call) || (cache_ptr->resize_in_progress));
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__auto_adjust_cache_size() */
-/*-------------------------------------------------------------------------
- *
- * Function: H5C__autoadjust__ageout
- *
- * Purpose: Implement the ageout automatic cache size decrement
- * algorithm. Note that while this code evicts aged out
- * entries, the code does not change the maximum cache size.
- * Instead, the function simply computes the new value (if
- * any change is indicated) and reports this value in
- * *new_max_cache_size_ptr.
- *
- * Return: Non-negative on success/Negative on failure or if there was
- * an attempt to flush a protected item.
- *
- *
- * Programmer: John Mainzer, 11/18/04
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__autoadjust__ageout(H5F_t * f, double hit_rate, enum H5C_resize_status * status_ptr,
- size_t * new_max_cache_size_ptr, hbool_t write_permitted)
-{
- H5C_t * cache_ptr = f->shared->cache;
- size_t test_size;
- herr_t ret_value = SUCCEED; /* Return value */
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C__autoadjust__ageout
+ *
+ * Purpose: Implement the ageout automatic cache size decrement
+ * algorithm. Note that while this code evicts aged out
+ * entries, the code does not change the maximum cache size.
+ * Instead, the function simply computes the new value (if
+ * any change is indicated) and reports this value in
+ * *new_max_cache_size_ptr.
+ *
+ * Return: Non-negative on success/Negative on failure or if there was
+ * an attempt to flush a protected item.
+ *
+ *
+ * Programmer: John Mainzer, 11/18/04
+ *
+ *-------------------------------------------------------------------------
+ */
+ static herr_t H5C__autoadjust__ageout(H5F_t * f, double hit_rate, enum H5C_resize_status *status_ptr,
+ size_t *new_max_cache_size_ptr, hbool_t write_permitted)
+ {
+ H5C_t *cache_ptr = f->shared->cache;
+ size_t test_size;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- HDassert( f );
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( ( status_ptr ) && ( *status_ptr == in_spec ) );
- HDassert( ( new_max_cache_size_ptr ) && ( *new_max_cache_size_ptr == 0 ) );
+ HDassert(f);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert((status_ptr) && (*status_ptr == in_spec));
+ HDassert((new_max_cache_size_ptr) && (*new_max_cache_size_ptr == 0));
- /* remove excess epoch markers if any */
- if(cache_ptr->epoch_markers_active > (cache_ptr->resize_ctl).epochs_before_eviction)
- if(H5C__autoadjust__ageout__remove_excess_markers(cache_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't remove excess epoch markers")
+ /* remove excess epoch markers if any */
+ if (cache_ptr->epoch_markers_active > (cache_ptr->resize_ctl).epochs_before_eviction)
+ if (H5C__autoadjust__ageout__remove_excess_markers(cache_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't remove excess epoch markers")
- if ( ( (cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out )
- ||
- ( ( (cache_ptr->resize_ctl).decr_mode ==
- H5C_decr__age_out_with_threshold
- )
- &&
- ( hit_rate >= (cache_ptr->resize_ctl).upper_hr_threshold )
- )
- ) {
+ if (((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) ||
+ (((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold) &&
+ (hit_rate >= (cache_ptr->resize_ctl).upper_hr_threshold))) {
- if ( cache_ptr->max_cache_size > (cache_ptr->resize_ctl).min_size ){
+ if (cache_ptr->max_cache_size > (cache_ptr->resize_ctl).min_size) {
- /* evict aged out cache entries if appropriate... */
- if(H5C__autoadjust__ageout__evict_aged_out_entries(f, write_permitted) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error flushing aged out entries")
+ /* evict aged out cache entries if appropriate... */
+ if (H5C__autoadjust__ageout__evict_aged_out_entries(f, write_permitted) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error flushing aged out entries")
- /* ... and then reduce cache size if appropriate */
- if ( cache_ptr->index_size < cache_ptr->max_cache_size ) {
+ /* ... and then reduce cache size if appropriate */
+ if (cache_ptr->index_size < cache_ptr->max_cache_size) {
- if ( (cache_ptr->resize_ctl).apply_empty_reserve ) {
+ if ((cache_ptr->resize_ctl).apply_empty_reserve) {
- test_size = (size_t)(((double)cache_ptr->index_size) /
- (1 - (cache_ptr->resize_ctl).empty_reserve));
+ test_size = (size_t)(((double)cache_ptr->index_size) /
+ (1 - (cache_ptr->resize_ctl).empty_reserve));
- if ( test_size < cache_ptr->max_cache_size ) {
+ if (test_size < cache_ptr->max_cache_size) {
- *status_ptr = decrease;
- *new_max_cache_size_ptr = test_size;
+ *status_ptr = decrease;
+ *new_max_cache_size_ptr = test_size;
+ }
}
- } else {
+ else {
- *status_ptr = decrease;
- *new_max_cache_size_ptr = cache_ptr->index_size;
- }
+ *status_ptr = decrease;
+ *new_max_cache_size_ptr = cache_ptr->index_size;
+ }
- if ( *status_ptr == decrease ) {
+ if (*status_ptr == decrease) {
- /* clip to min size if necessary */
- if ( *new_max_cache_size_ptr <
- (cache_ptr->resize_ctl).min_size ) {
+ /* clip to min size if necessary */
+ if (*new_max_cache_size_ptr < (cache_ptr->resize_ctl).min_size) {
- *new_max_cache_size_ptr =
- (cache_ptr->resize_ctl).min_size;
- }
+ *new_max_cache_size_ptr = (cache_ptr->resize_ctl).min_size;
+ }
- /* clip to max decrement if necessary */
- if ( ( (cache_ptr->resize_ctl).apply_max_decrement ) &&
- ( ((cache_ptr->resize_ctl).max_decrement +
- *new_max_cache_size_ptr) <
- cache_ptr->max_cache_size ) ) {
+ /* clip to max decrement if necessary */
+ if (((cache_ptr->resize_ctl).apply_max_decrement) &&
+ (((cache_ptr->resize_ctl).max_decrement + *new_max_cache_size_ptr) <
+ cache_ptr->max_cache_size)) {
- *new_max_cache_size_ptr = cache_ptr->max_cache_size -
- (cache_ptr->resize_ctl).max_decrement;
+ *new_max_cache_size_ptr =
+ cache_ptr->max_cache_size - (cache_ptr->resize_ctl).max_decrement;
+ }
}
}
}
- } else {
+ else {
- *status_ptr = at_min_size;
+ *status_ptr = at_min_size;
+ }
}
- }
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__autoadjust__ageout() */
+ } /* H5C__autoadjust__ageout() */
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C__autoadjust__ageout__cycle_epoch_marker
+ *
+ * Purpose: Remove the oldest epoch marker from the LRU list,
+ * and reinsert it at the head of the LRU list. Also
+ * remove the epoch marker's index from the head of the
+ * ring buffer, and re-insert it at the tail of the ring
+ * buffer.
+ *
+ * Return: SUCCEED on success/FAIL on failure.
+ *
+ * Programmer: John Mainzer, 11/22/04
+ *
+ *-------------------------------------------------------------------------
+ */
+ static herr_t H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t * cache_ptr)
+ {
+ int i;
+ herr_t ret_value = SUCCEED; /* Return value */
-/*-------------------------------------------------------------------------
- *
- * Function: H5C__autoadjust__ageout__cycle_epoch_marker
- *
- * Purpose: Remove the oldest epoch marker from the LRU list,
- * and reinsert it at the head of the LRU list. Also
- * remove the epoch marker's index from the head of the
- * ring buffer, and re-insert it at the tail of the ring
- * buffer.
- *
- * Return: SUCCEED on success/FAIL on failure.
- *
- * Programmer: John Mainzer, 11/22/04
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t * cache_ptr)
-{
- int i;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- if(cache_ptr->epoch_markers_active <= 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "No active epoch markers on entry?!?!?")
+ if (cache_ptr->epoch_markers_active <= 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "No active epoch markers on entry?!?!?")
- /* remove the last marker from both the ring buffer and the LRU list */
+ /* remove the last marker from both the ring buffer and the LRU list */
- i = cache_ptr->epoch_marker_ringbuf[cache_ptr->epoch_marker_ringbuf_first];
+ i = cache_ptr->epoch_marker_ringbuf[cache_ptr->epoch_marker_ringbuf_first];
- cache_ptr->epoch_marker_ringbuf_first =
- (cache_ptr->epoch_marker_ringbuf_first + 1) %
- (H5C__MAX_EPOCH_MARKERS + 1);
+ cache_ptr->epoch_marker_ringbuf_first =
+ (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
- cache_ptr->epoch_marker_ringbuf_size -= 1;
+ cache_ptr->epoch_marker_ringbuf_size -= 1;
- if(cache_ptr->epoch_marker_ringbuf_size < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow")
- if((cache_ptr->epoch_marker_active)[i] != TRUE)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?")
+ if (cache_ptr->epoch_marker_ringbuf_size < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow")
+ if ((cache_ptr->epoch_marker_active)[i] != TRUE)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?")
- H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), \
- (cache_ptr)->LRU_head_ptr, \
- (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, \
- (cache_ptr)->LRU_list_size, \
- (FAIL))
+ H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr,
+ (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size,
+ (FAIL))
- /* now, re-insert it at the head of the LRU list, and at the tail of
- * the ring buffer.
- */
+ /* now, re-insert it at the head of the LRU list, and at the tail of
+ * the ring buffer.
+ */
- HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i);
- HDassert(((cache_ptr->epoch_markers)[i]).next == NULL);
- HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL);
+ HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i);
+ HDassert(((cache_ptr->epoch_markers)[i]).next == NULL);
+ HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL);
- cache_ptr->epoch_marker_ringbuf_last =
- (cache_ptr->epoch_marker_ringbuf_last + 1) %
- (H5C__MAX_EPOCH_MARKERS + 1);
+ cache_ptr->epoch_marker_ringbuf_last =
+ (cache_ptr->epoch_marker_ringbuf_last + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
- (cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i;
+ (cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i;
- cache_ptr->epoch_marker_ringbuf_size += 1;
+ cache_ptr->epoch_marker_ringbuf_size += 1;
- if(cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow")
+ if (cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow")
- H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), \
- (cache_ptr)->LRU_head_ptr, \
- (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, \
- (cache_ptr)->LRU_list_size, \
- (FAIL))
+ H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr,
+ (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size,
+ (FAIL))
done:
- FUNC_LEAVE_NOAPI(ret_value)
-
-} /* H5C__autoadjust__ageout__cycle_epoch_marker() */
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__autoadjust__ageout__cycle_epoch_marker() */
-/*-------------------------------------------------------------------------
- *
- * Function: H5C__autoadjust__ageout__evict_aged_out_entries
- *
- * Purpose: Evict clean entries in the cache that haven't
- * been accessed for at least
- * (cache_ptr->resize_ctl).epochs_before_eviction epochs,
- * and flush dirty entries that haven't been accessed for
- * that amount of time.
- *
- * Depending on configuration, the function will either
- * flush or evict all such entries, or all such entries it
- * encounters until it has freed the maximum amount of space
- * allowed under the maximum decrement.
- *
- * If we are running in parallel mode, writes may not be
- * permitted. If so, the function simply skips any dirty
- * entries it may encounter.
- *
- * The function makes no attempt to maintain the minimum
- * clean size, as there is no guarantee that the cache size
- * will be changed.
- *
- * If there is no cache size change, the minimum clean size
- * constraint will be met through a combination of clean
- * entries and free space in the cache.
- *
- * If there is a cache size reduction, the minimum clean size
- * will be re-calculated, and will be enforced the next time
- * we have to make space in the cache.
- *
- * Observe that this function cannot occasion a read.
- *
- * Return: Non-negative on success/Negative on failure.
- *
- * Programmer: John Mainzer, 11/22/04
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *f, hbool_t write_permitted)
-{
- H5C_t * cache_ptr = f->shared->cache;
- size_t eviction_size_limit;
- size_t bytes_evicted = 0;
- hbool_t prev_is_dirty = FALSE;
- hbool_t restart_scan;
- H5C_cache_entry_t * entry_ptr;
- H5C_cache_entry_t * next_ptr;
- H5C_cache_entry_t * prev_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- HDassert( f );
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
-
- /* if there is a limit on the amount that the cache size can be decrease
- * in any one round of the cache size reduction algorithm, load that
- * limit into eviction_size_limit. Otherwise, set eviction_size_limit
- * to the equivalent of infinity. The current size of the index will
- * do nicely.
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C__autoadjust__ageout__evict_aged_out_entries
+ *
+ * Purpose: Evict clean entries in the cache that haven't
+ * been accessed for at least
+ * (cache_ptr->resize_ctl).epochs_before_eviction epochs,
+ * and flush dirty entries that haven't been accessed for
+ * that amount of time.
+ *
+ * Depending on configuration, the function will either
+ * flush or evict all such entries, or all such entries it
+ * encounters until it has freed the maximum amount of space
+ * allowed under the maximum decrement.
+ *
+ * If we are running in parallel mode, writes may not be
+ * permitted. If so, the function simply skips any dirty
+ * entries it may encounter.
+ *
+ * The function makes no attempt to maintain the minimum
+ * clean size, as there is no guarantee that the cache size
+ * will be changed.
+ *
+ * If there is no cache size change, the minimum clean size
+ * constraint will be met through a combination of clean
+ * entries and free space in the cache.
+ *
+ * If there is a cache size reduction, the minimum clean size
+ * will be re-calculated, and will be enforced the next time
+ * we have to make space in the cache.
+ *
+ * Observe that this function cannot occasion a read.
+ *
+ * Return: Non-negative on success/Negative on failure.
+ *
+ * Programmer: John Mainzer, 11/22/04
+ *
+ *-------------------------------------------------------------------------
*/
- if ( (cache_ptr->resize_ctl).apply_max_decrement ) {
+ static herr_t H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, hbool_t write_permitted)
+ {
+ H5C_t * cache_ptr = f->shared->cache;
+ size_t eviction_size_limit;
+ size_t bytes_evicted = 0;
+ hbool_t prev_is_dirty = FALSE;
+ hbool_t restart_scan;
+ H5C_cache_entry_t *entry_ptr;
+ H5C_cache_entry_t *next_ptr;
+ H5C_cache_entry_t *prev_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
- eviction_size_limit = (cache_ptr->resize_ctl).max_decrement;
+ FUNC_ENTER_STATIC
- } else {
+ HDassert(f);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- eviction_size_limit = cache_ptr->index_size; /* i.e. infinity */
- }
+ /* if there is a limit on the amount that the cache size can be decrease
+ * in any one round of the cache size reduction algorithm, load that
+ * limit into eviction_size_limit. Otherwise, set eviction_size_limit
+ * to the equivalent of infinity. The current size of the index will
+ * do nicely.
+ */
+ if ((cache_ptr->resize_ctl).apply_max_decrement) {
- if ( write_permitted ) {
+ eviction_size_limit = (cache_ptr->resize_ctl).max_decrement;
+ }
+ else {
- restart_scan = FALSE;
- entry_ptr = cache_ptr->LRU_tail_ptr;
+ eviction_size_limit = cache_ptr->index_size; /* i.e. infinity */
+ }
- while ( ( entry_ptr != NULL ) &&
- ( (entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID ) &&
- ( bytes_evicted < eviction_size_limit ) )
- {
- hbool_t skipping_entry = FALSE;
+ if (write_permitted) {
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert( ! (entry_ptr->is_protected) );
- HDassert( ! (entry_ptr->is_read_only) );
- HDassert( (entry_ptr->ro_ref_count) == 0 );
+ restart_scan = FALSE;
+ entry_ptr = cache_ptr->LRU_tail_ptr;
- next_ptr = entry_ptr->next;
- prev_ptr = entry_ptr->prev;
+ while ((entry_ptr != NULL) && ((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) &&
+ (bytes_evicted < eviction_size_limit)) {
+ hbool_t skipping_entry = FALSE;
- if(prev_ptr != NULL)
- prev_is_dirty = prev_ptr->is_dirty;
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(!(entry_ptr->is_protected));
+ HDassert(!(entry_ptr->is_read_only));
+ HDassert((entry_ptr->ro_ref_count) == 0);
- if(entry_ptr->is_dirty ) {
- HDassert(!entry_ptr->prefetched_dirty);
+ next_ptr = entry_ptr->next;
+ prev_ptr = entry_ptr->prev;
- /* dirty corked entry is skipped */
- if(entry_ptr->tag_info && entry_ptr->tag_info->corked)
- skipping_entry = TRUE;
- else {
- /* reset entries_removed_counter and
- * last_entry_removed_ptr prior to the call to
- * H5C__flush_single_entry() so that we can spot
- * unexpected removals of entries from the cache,
- * and set the restart_scan flag if proceeding
- * would be likely to cause us to scan an entry
- * that is no longer in the cache.
- */
- cache_ptr->entries_removed_counter = 0;
- cache_ptr->last_entry_removed_ptr = NULL;
+ if (prev_ptr != NULL)
+ prev_is_dirty = prev_ptr->is_dirty;
- if(H5C__flush_single_entry(f, entry_ptr, H5C__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
+ if (entry_ptr->is_dirty) {
+ HDassert(!entry_ptr->prefetched_dirty);
- if(cache_ptr->entries_removed_counter > 1 || cache_ptr->last_entry_removed_ptr == prev_ptr)
- restart_scan = TRUE;
- } /* end else */
- } /* end if */
- else if(!entry_ptr->prefetched_dirty) {
+ /* dirty corked entry is skipped */
+ if (entry_ptr->tag_info && entry_ptr->tag_info->corked)
+ skipping_entry = TRUE;
+ else {
+ /* reset entries_removed_counter and
+ * last_entry_removed_ptr prior to the call to
+ * H5C__flush_single_entry() so that we can spot
+ * unexpected removals of entries from the cache,
+ * and set the restart_scan flag if proceeding
+ * would be likely to cause us to scan an entry
+ * that is no longer in the cache.
+ */
+ cache_ptr->entries_removed_counter = 0;
+ cache_ptr->last_entry_removed_ptr = NULL;
- bytes_evicted += entry_ptr->size;
+ if (H5C__flush_single_entry(f, entry_ptr, H5C__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
- if(H5C__flush_single_entry(f, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0 )
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
- } /* end else-if */
- else {
- HDassert(!entry_ptr->is_dirty);
- HDassert(entry_ptr->prefetched_dirty);
-
- skipping_entry = TRUE;
- } /* end else */
+ if (cache_ptr->entries_removed_counter > 1 ||
+ cache_ptr->last_entry_removed_ptr == prev_ptr)
+ restart_scan = TRUE;
+ } /* end else */
+ } /* end if */
+ else if (!entry_ptr->prefetched_dirty) {
- if(prev_ptr != NULL) {
- if(skipping_entry)
- entry_ptr = prev_ptr;
- else if(restart_scan || (prev_ptr->is_dirty != prev_is_dirty)
- || (prev_ptr->next != next_ptr)
- || (prev_ptr->is_protected)
- || (prev_ptr->is_pinned)) {
- /* Something has happened to the LRU -- start over
- * from the tail.
- */
- restart_scan = FALSE;
- entry_ptr = cache_ptr->LRU_tail_ptr;
+ bytes_evicted += entry_ptr->size;
- H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr)
+ if (H5C__flush_single_entry(f, entry_ptr,
+ H5C__FLUSH_INVALIDATE_FLAG |
+ H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
} /* end else-if */
- else
- entry_ptr = prev_ptr;
- } /* end if */
- else
- entry_ptr = NULL;
- } /* end while */
+ else {
+ HDassert(!entry_ptr->is_dirty);
+ HDassert(entry_ptr->prefetched_dirty);
- /* for now at least, don't bother to maintain the minimum clean size,
- * as the cache should now be less than its maximum size. Due to
- * the vaguries of the cache size reduction algorthim, we may not
- * reduce the size of the cache.
- *
- * If we do, we will calculate a new minimum clean size, which will
- * be enforced the next time we try to make space in the cache.
- *
- * If we don't, no action is necessary, as we have just evicted and/or
- * or flushed a bunch of entries and therefore the sum of the clean
- * and free space in the cache must be greater than or equal to the
- * min clean space requirement (assuming that requirement was met on
- * entry).
- */
+ skipping_entry = TRUE;
+ } /* end else */
- } /* end if */
- else /* ! write_permitted */ {
- /* Since we are not allowed to write, all we can do is evict
- * any clean entries that we may encounter before we either
- * hit the eviction size limit, or encounter the epoch marker.
- *
- * If we are operating read only, this isn't an issue, as there
- * will not be any dirty entries.
- *
- * If we are operating in R/W mode, all the dirty entries we
- * skip will be flushed the next time we attempt to make space
- * when writes are permitted. This may have some local
- * performance implications, but it shouldn't cause any net
- * slowdown.
- */
- HDassert(H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS);
- entry_ptr = cache_ptr->LRU_tail_ptr;
- while(entry_ptr != NULL &&
- ((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) &&
- (bytes_evicted < eviction_size_limit)) {
- HDassert(!(entry_ptr->is_protected));
+ if (prev_ptr != NULL) {
+ if (skipping_entry)
+ entry_ptr = prev_ptr;
+ else if (restart_scan || (prev_ptr->is_dirty != prev_is_dirty) ||
+ (prev_ptr->next != next_ptr) || (prev_ptr->is_protected) ||
+ (prev_ptr->is_pinned)) {
+ /* Something has happened to the LRU -- start over
+ * from the tail.
+ */
+ restart_scan = FALSE;
+ entry_ptr = cache_ptr->LRU_tail_ptr;
- prev_ptr = entry_ptr->prev;
+ H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr)
+ } /* end else-if */
+ else
+ entry_ptr = prev_ptr;
+ } /* end if */
+ else
+ entry_ptr = NULL;
+ } /* end while */
- if(!(entry_ptr->is_dirty) && !(entry_ptr->prefetched_dirty))
- if(H5C__flush_single_entry(f, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush clean entry")
+ /* for now at least, don't bother to maintain the minimum clean size,
+ * as the cache should now be less than its maximum size. Due to
+ * the vaguries of the cache size reduction algorthim, we may not
+ * reduce the size of the cache.
+ *
+ * If we do, we will calculate a new minimum clean size, which will
+ * be enforced the next time we try to make space in the cache.
+ *
+ * If we don't, no action is necessary, as we have just evicted and/or
+ * or flushed a bunch of entries and therefore the sum of the clean
+ * and free space in the cache must be greater than or equal to the
+ * min clean space requirement (assuming that requirement was met on
+ * entry).
+ */
- /* just skip the entry if it is dirty, as we can't do
- * anything with it now since we can't write.
+ } /* end if */
+ else /* ! write_permitted */ {
+ /* Since we are not allowed to write, all we can do is evict
+ * any clean entries that we may encounter before we either
+ * hit the eviction size limit, or encounter the epoch marker.
*
- * Since all entries are clean, serialize() will not be called,
- * and thus we needn't test to see if the LRU has been changed
- * out from under us.
+ * If we are operating read only, this isn't an issue, as there
+ * will not be any dirty entries.
+ *
+ * If we are operating in R/W mode, all the dirty entries we
+ * skip will be flushed the next time we attempt to make space
+ * when writes are permitted. This may have some local
+ * performance implications, but it shouldn't cause any net
+ * slowdown.
*/
- entry_ptr = prev_ptr;
- } /* end while */
- } /* end else */
+ HDassert(H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS);
+ entry_ptr = cache_ptr->LRU_tail_ptr;
+ while (entry_ptr != NULL && ((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) &&
+ (bytes_evicted < eviction_size_limit)) {
+ HDassert(!(entry_ptr->is_protected));
+
+ prev_ptr = entry_ptr->prev;
+
+ if (!(entry_ptr->is_dirty) && !(entry_ptr->prefetched_dirty))
+ if (H5C__flush_single_entry(f, entry_ptr,
+ H5C__FLUSH_INVALIDATE_FLAG |
+ H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush clean entry")
+
+ /* just skip the entry if it is dirty, as we can't do
+ * anything with it now since we can't write.
+ *
+ * Since all entries are clean, serialize() will not be called,
+ * and thus we needn't test to see if the LRU has been changed
+ * out from under us.
+ */
+ entry_ptr = prev_ptr;
+ } /* end while */
+ } /* end else */
- if(cache_ptr->index_size < cache_ptr->max_cache_size)
- cache_ptr->cache_full = FALSE;
+ if (cache_ptr->index_size < cache_ptr->max_cache_size)
+ cache_ptr->cache_full = FALSE;
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__autoadjust__ageout__evict_aged_out_entries() */
-
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__autoadjust__ageout__evict_aged_out_entries() */
-/*-------------------------------------------------------------------------
- *
- * Function: H5C__autoadjust__ageout__insert_new_marker
- *
- * Purpose: Find an unused marker cache entry, mark it as used, and
- * insert it at the head of the LRU list. Also add the
- * marker's index in the epoch_markers array.
- *
- * Return: SUCCEED on success/FAIL on failure.
- *
- * Programmer: John Mainzer, 11/19/04
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__autoadjust__ageout__insert_new_marker(H5C_t * cache_ptr)
-{
- int i;
- herr_t ret_value = SUCCEED; /* Return value */
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C__autoadjust__ageout__insert_new_marker
+ *
+ * Purpose: Find an unused marker cache entry, mark it as used, and
+ * insert it at the head of the LRU list. Also add the
+ * marker's index in the epoch_markers array.
+ *
+ * Return: SUCCEED on success/FAIL on failure.
+ *
+ * Programmer: John Mainzer, 11/19/04
+ *
+ *-------------------------------------------------------------------------
+ */
+ static herr_t H5C__autoadjust__ageout__insert_new_marker(H5C_t * cache_ptr)
+ {
+ int i;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- if(cache_ptr->epoch_markers_active >= (cache_ptr->resize_ctl).epochs_before_eviction)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Already have a full complement of markers")
+ if (cache_ptr->epoch_markers_active >= (cache_ptr->resize_ctl).epochs_before_eviction)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Already have a full complement of markers")
- /* find an unused marker */
- i = 0;
- while((cache_ptr->epoch_marker_active)[i] && i < H5C__MAX_EPOCH_MARKERS)
- i++;
+ /* find an unused marker */
+ i = 0;
+ while ((cache_ptr->epoch_marker_active)[i] && i < H5C__MAX_EPOCH_MARKERS)
+ i++;
- if(i >= H5C__MAX_EPOCH_MARKERS)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't find unused marker")
+ if (i >= H5C__MAX_EPOCH_MARKERS)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't find unused marker")
- HDassert( ((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i );
- HDassert( ((cache_ptr->epoch_markers)[i]).next == NULL );
- HDassert( ((cache_ptr->epoch_markers)[i]).prev == NULL );
+ HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i);
+ HDassert(((cache_ptr->epoch_markers)[i]).next == NULL);
+ HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL);
- (cache_ptr->epoch_marker_active)[i] = TRUE;
+ (cache_ptr->epoch_marker_active)[i] = TRUE;
- cache_ptr->epoch_marker_ringbuf_last =
- (cache_ptr->epoch_marker_ringbuf_last + 1) %
- (H5C__MAX_EPOCH_MARKERS + 1);
+ cache_ptr->epoch_marker_ringbuf_last =
+ (cache_ptr->epoch_marker_ringbuf_last + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
- (cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i;
+ (cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i;
- cache_ptr->epoch_marker_ringbuf_size += 1;
+ cache_ptr->epoch_marker_ringbuf_size += 1;
- if ( cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS ) {
+ if (cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow")
- }
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow")
+ }
- H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), \
- (cache_ptr)->LRU_head_ptr, \
- (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, \
- (cache_ptr)->LRU_list_size, \
- (FAIL))
+ H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr,
+ (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size,
+ (FAIL))
- cache_ptr->epoch_markers_active += 1;
+ cache_ptr->epoch_markers_active += 1;
done:
- FUNC_LEAVE_NOAPI(ret_value)
-
-} /* H5C__autoadjust__ageout__insert_new_marker() */
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__autoadjust__ageout__insert_new_marker() */
-/*-------------------------------------------------------------------------
- *
- * Function: H5C__autoadjust__ageout__remove_all_markers
- *
- * Purpose: Remove all epoch markers from the LRU list and mark them
- * as inactive.
- *
- * Return: SUCCEED on success/FAIL on failure.
- *
- * Programmer: John Mainzer, 11/22/04
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__autoadjust__ageout__remove_all_markers(H5C_t * cache_ptr)
-{
- int ring_buf_index;
- int i;
- herr_t ret_value = SUCCEED; /* Return value */
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C__autoadjust__ageout__remove_all_markers
+ *
+ * Purpose: Remove all epoch markers from the LRU list and mark them
+ * as inactive.
+ *
+ * Return: SUCCEED on success/FAIL on failure.
+ *
+ * Programmer: John Mainzer, 11/22/04
+ *
+ *-------------------------------------------------------------------------
+ */
+ static herr_t H5C__autoadjust__ageout__remove_all_markers(H5C_t * cache_ptr)
+ {
+ int ring_buf_index;
+ int i;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- while ( cache_ptr->epoch_markers_active > 0 )
- {
- /* get the index of the last epoch marker in the LRU list
- * and remove it from the ring buffer.
- */
+ while (cache_ptr->epoch_markers_active > 0) {
+ /* get the index of the last epoch marker in the LRU list
+ * and remove it from the ring buffer.
+ */
- ring_buf_index = cache_ptr->epoch_marker_ringbuf_first;
- i = (cache_ptr->epoch_marker_ringbuf)[ring_buf_index];
+ ring_buf_index = cache_ptr->epoch_marker_ringbuf_first;
+ i = (cache_ptr->epoch_marker_ringbuf)[ring_buf_index];
- cache_ptr->epoch_marker_ringbuf_first =
- (cache_ptr->epoch_marker_ringbuf_first + 1) %
- (H5C__MAX_EPOCH_MARKERS + 1);
+ cache_ptr->epoch_marker_ringbuf_first =
+ (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
- cache_ptr->epoch_marker_ringbuf_size -= 1;
+ cache_ptr->epoch_marker_ringbuf_size -= 1;
- if(cache_ptr->epoch_marker_ringbuf_size < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow")
+ if (cache_ptr->epoch_marker_ringbuf_size < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow")
- if((cache_ptr->epoch_marker_active)[i] != TRUE)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?")
+ if ((cache_ptr->epoch_marker_active)[i] != TRUE)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?")
- /* remove the epoch marker from the LRU list */
- H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), \
- (cache_ptr)->LRU_head_ptr, \
- (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, \
- (cache_ptr)->LRU_list_size, \
- (FAIL))
+ /* remove the epoch marker from the LRU list */
+ H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr,
+ (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size,
+ (FAIL))
- /* mark the epoch marker as unused. */
- (cache_ptr->epoch_marker_active)[i] = FALSE;
+ /* mark the epoch marker as unused. */
+ (cache_ptr->epoch_marker_active)[i] = FALSE;
- HDassert( ((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i );
- HDassert( ((cache_ptr->epoch_markers)[i]).next == NULL );
- HDassert( ((cache_ptr->epoch_markers)[i]).prev == NULL );
+ HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i);
+ HDassert(((cache_ptr->epoch_markers)[i]).next == NULL);
+ HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL);
- /* decrement the number of active epoch markers */
- cache_ptr->epoch_markers_active -= 1;
+ /* decrement the number of active epoch markers */
+ cache_ptr->epoch_markers_active -= 1;
- HDassert( cache_ptr->epoch_markers_active == \
- cache_ptr->epoch_marker_ringbuf_size );
- }
+ HDassert(cache_ptr->epoch_markers_active == cache_ptr->epoch_marker_ringbuf_size);
+ }
done:
- FUNC_LEAVE_NOAPI(ret_value)
-
-} /* H5C__autoadjust__ageout__remove_all_markers() */
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__autoadjust__ageout__remove_all_markers() */
-/*-------------------------------------------------------------------------
- *
- * Function: H5C__autoadjust__ageout__remove_excess_markers
- *
- * Purpose: Remove epoch markers from the end of the LRU list and
- * mark them as inactive until the number of active markers
- * equals the the current value of
- * (cache_ptr->resize_ctl).epochs_before_eviction.
- *
- * Return: SUCCEED on success/FAIL on failure.
- *
- * Programmer: John Mainzer, 11/19/04
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__autoadjust__ageout__remove_excess_markers(H5C_t * cache_ptr)
-{
- int ring_buf_index;
- int i;
- herr_t ret_value = SUCCEED; /* Return value */
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C__autoadjust__ageout__remove_excess_markers
+ *
+ * Purpose: Remove epoch markers from the end of the LRU list and
+ * mark them as inactive until the number of active markers
+ * equals the the current value of
+ * (cache_ptr->resize_ctl).epochs_before_eviction.
+ *
+ * Return: SUCCEED on success/FAIL on failure.
+ *
+ * Programmer: John Mainzer, 11/19/04
+ *
+ *-------------------------------------------------------------------------
+ */
+ static herr_t H5C__autoadjust__ageout__remove_excess_markers(H5C_t * cache_ptr)
+ {
+ int ring_buf_index;
+ int i;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- if(cache_ptr->epoch_markers_active <= (cache_ptr->resize_ctl).epochs_before_eviction)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "no excess markers on entry")
+ if (cache_ptr->epoch_markers_active <= (cache_ptr->resize_ctl).epochs_before_eviction)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "no excess markers on entry")
- while(cache_ptr->epoch_markers_active > (cache_ptr->resize_ctl).epochs_before_eviction) {
- /* get the index of the last epoch marker in the LRU list
- * and remove it from the ring buffer.
- */
+ while (cache_ptr->epoch_markers_active > (cache_ptr->resize_ctl).epochs_before_eviction) {
+ /* get the index of the last epoch marker in the LRU list
+ * and remove it from the ring buffer.
+ */
- ring_buf_index = cache_ptr->epoch_marker_ringbuf_first;
- i = (cache_ptr->epoch_marker_ringbuf)[ring_buf_index];
+ ring_buf_index = cache_ptr->epoch_marker_ringbuf_first;
+ i = (cache_ptr->epoch_marker_ringbuf)[ring_buf_index];
- cache_ptr->epoch_marker_ringbuf_first =
- (cache_ptr->epoch_marker_ringbuf_first + 1) %
- (H5C__MAX_EPOCH_MARKERS + 1);
+ cache_ptr->epoch_marker_ringbuf_first =
+ (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
- cache_ptr->epoch_marker_ringbuf_size -= 1;
+ cache_ptr->epoch_marker_ringbuf_size -= 1;
- if(cache_ptr->epoch_marker_ringbuf_size < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow")
- if((cache_ptr->epoch_marker_active)[i] != TRUE)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?")
+ if (cache_ptr->epoch_marker_ringbuf_size < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow")
+ if ((cache_ptr->epoch_marker_active)[i] != TRUE)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?")
- /* remove the epoch marker from the LRU list */
- H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), \
- (cache_ptr)->LRU_head_ptr, \
- (cache_ptr)->LRU_tail_ptr, \
- (cache_ptr)->LRU_list_len, \
- (cache_ptr)->LRU_list_size, \
- (FAIL))
+ /* remove the epoch marker from the LRU list */
+ H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr,
+ (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size,
+ (FAIL))
- /* mark the epoch marker as unused. */
- (cache_ptr->epoch_marker_active)[i] = FALSE;
+ /* mark the epoch marker as unused. */
+ (cache_ptr->epoch_marker_active)[i] = FALSE;
- HDassert( ((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i );
- HDassert( ((cache_ptr->epoch_markers)[i]).next == NULL );
- HDassert( ((cache_ptr->epoch_markers)[i]).prev == NULL );
+ HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i);
+ HDassert(((cache_ptr->epoch_markers)[i]).next == NULL);
+ HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL);
- /* decrement the number of active epoch markers */
- cache_ptr->epoch_markers_active -= 1;
+ /* decrement the number of active epoch markers */
+ cache_ptr->epoch_markers_active -= 1;
- HDassert( cache_ptr->epoch_markers_active == \
- cache_ptr->epoch_marker_ringbuf_size );
- }
+ HDassert(cache_ptr->epoch_markers_active == cache_ptr->epoch_marker_ringbuf_size);
+ }
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__autoadjust__ageout__remove_excess_markers() */
+ } /* H5C__autoadjust__ageout__remove_excess_markers() */
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C__flash_increase_cache_size
+ *
+ * Purpose: If there is not at least new_entry_size - old_entry_size
+ * bytes of free space in the cache and the current
+ * max_cache_size is less than (cache_ptr->resize_ctl).max_size,
+ * perform a flash increase in the cache size and then reset
+ * the full cache hit rate statistics, and exit.
+ *
+ * Return: Non-negative on success/Negative on failure.
+ *
+ * Programmer: John Mainzer, 12/31/07
+ *
+ *-------------------------------------------------------------------------
+ */
+ static herr_t H5C__flash_increase_cache_size(H5C_t * cache_ptr, size_t old_entry_size,
+ size_t new_entry_size)
+ {
+ size_t new_max_cache_size = 0;
+ size_t old_max_cache_size = 0;
+ size_t new_min_clean_size = 0;
+ size_t old_min_clean_size = 0;
+ size_t space_needed;
+ enum H5C_resize_status status = flash_increase; /* may change */
+ double hit_rate;
+ herr_t ret_value = SUCCEED; /* Return value */
-/*-------------------------------------------------------------------------
- *
- * Function: H5C__flash_increase_cache_size
- *
- * Purpose: If there is not at least new_entry_size - old_entry_size
- * bytes of free space in the cache and the current
- * max_cache_size is less than (cache_ptr->resize_ctl).max_size,
- * perform a flash increase in the cache size and then reset
- * the full cache hit rate statistics, and exit.
- *
- * Return: Non-negative on success/Negative on failure.
- *
- * Programmer: John Mainzer, 12/31/07
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__flash_increase_cache_size(H5C_t * cache_ptr,
- size_t old_entry_size,
- size_t new_entry_size)
-{
- size_t new_max_cache_size = 0;
- size_t old_max_cache_size = 0;
- size_t new_min_clean_size = 0;
- size_t old_min_clean_size = 0;
- size_t space_needed;
- enum H5C_resize_status status = flash_increase; /* may change */
- double hit_rate;
- herr_t ret_value = SUCCEED; /* Return value */
+ FUNC_ENTER_STATIC
- FUNC_ENTER_STATIC
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr->flash_size_increase_possible);
+ HDassert(new_entry_size > cache_ptr->flash_size_increase_threshold);
+ HDassert(old_entry_size < new_entry_size);
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( cache_ptr->flash_size_increase_possible );
- HDassert( new_entry_size > cache_ptr->flash_size_increase_threshold );
- HDassert( old_entry_size < new_entry_size );
+ if (old_entry_size >= new_entry_size)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "old_entry_size >= new_entry_size")
- if(old_entry_size >= new_entry_size)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "old_entry_size >= new_entry_size")
+ space_needed = new_entry_size - old_entry_size;
- space_needed = new_entry_size - old_entry_size;
+ if (((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) &&
+ (cache_ptr->max_cache_size < (cache_ptr->resize_ctl).max_size)) {
- if ( ( (cache_ptr->index_size + space_needed) >
- cache_ptr->max_cache_size ) &&
- ( cache_ptr->max_cache_size < (cache_ptr->resize_ctl).max_size ) ) {
+ /* we have work to do */
- /* we have work to do */
+ switch ((cache_ptr->resize_ctl).flash_incr_mode) {
+ case H5C_flash_incr__off:
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL,
+ "flash_size_increase_possible but H5C_flash_incr__off?!")
+ break;
- switch ( (cache_ptr->resize_ctl).flash_incr_mode )
- {
- case H5C_flash_incr__off:
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "flash_size_increase_possible but H5C_flash_incr__off?!")
- break;
+ case H5C_flash_incr__add_space:
+ if (cache_ptr->index_size < cache_ptr->max_cache_size) {
- case H5C_flash_incr__add_space:
- if ( cache_ptr->index_size < cache_ptr->max_cache_size ) {
+ HDassert((cache_ptr->max_cache_size - cache_ptr->index_size) < space_needed);
+ space_needed -= cache_ptr->max_cache_size - cache_ptr->index_size;
+ }
+ space_needed = (size_t)(((double)space_needed) * (cache_ptr->resize_ctl).flash_multiple);
- HDassert( (cache_ptr->max_cache_size - cache_ptr->index_size)
- < space_needed );
- space_needed -= cache_ptr->max_cache_size -
- cache_ptr->index_size;
- }
- space_needed =
- (size_t)(((double)space_needed) *
- (cache_ptr->resize_ctl).flash_multiple);
+ new_max_cache_size = cache_ptr->max_cache_size + space_needed;
- new_max_cache_size = cache_ptr->max_cache_size + space_needed;
+ break;
- break;
+ default: /* should be unreachable */
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?")
+ break;
+ }
- default: /* should be unreachable */
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?")
- break;
- }
+ if (new_max_cache_size > (cache_ptr->resize_ctl).max_size) {
- if ( new_max_cache_size > (cache_ptr->resize_ctl).max_size ) {
+ new_max_cache_size = (cache_ptr->resize_ctl).max_size;
+ }
- new_max_cache_size = (cache_ptr->resize_ctl).max_size;
- }
+ HDassert(new_max_cache_size > cache_ptr->max_cache_size);
- HDassert( new_max_cache_size > cache_ptr->max_cache_size );
+ new_min_clean_size =
+ (size_t)((double)new_max_cache_size * ((cache_ptr->resize_ctl).min_clean_fraction));
- new_min_clean_size = (size_t)
- ((double)new_max_cache_size *
- ((cache_ptr->resize_ctl).min_clean_fraction));
+ HDassert(new_min_clean_size <= new_max_cache_size);
- HDassert( new_min_clean_size <= new_max_cache_size );
+ old_max_cache_size = cache_ptr->max_cache_size;
+ old_min_clean_size = cache_ptr->min_clean_size;
- old_max_cache_size = cache_ptr->max_cache_size;
- old_min_clean_size = cache_ptr->min_clean_size;
+ cache_ptr->max_cache_size = new_max_cache_size;
+ cache_ptr->min_clean_size = new_min_clean_size;
- cache_ptr->max_cache_size = new_max_cache_size;
- cache_ptr->min_clean_size = new_min_clean_size;
+ /* update flash cache size increase fields as appropriate */
+ HDassert(cache_ptr->flash_size_increase_possible);
- /* update flash cache size increase fields as appropriate */
- HDassert ( cache_ptr->flash_size_increase_possible );
+ switch ((cache_ptr->resize_ctl).flash_incr_mode) {
+ case H5C_flash_incr__off:
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL,
+ "flash_size_increase_possible but H5C_flash_incr__off?!")
+ break;
- switch ( (cache_ptr->resize_ctl).flash_incr_mode )
- {
- case H5C_flash_incr__off:
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "flash_size_increase_possible but H5C_flash_incr__off?!")
- break;
+ case H5C_flash_incr__add_space:
+ cache_ptr->flash_size_increase_threshold = (size_t)(
+ ((double)(cache_ptr->max_cache_size)) * ((cache_ptr->resize_ctl).flash_threshold));
+ break;
- case H5C_flash_incr__add_space:
- cache_ptr->flash_size_increase_threshold =
- (size_t)
- (((double)(cache_ptr->max_cache_size)) *
- ((cache_ptr->resize_ctl).flash_threshold));
- break;
+ default: /* should be unreachable */
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?")
+ break;
+ }
- default: /* should be unreachable */
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?")
- break;
- }
+ /* note that we don't cycle the epoch markers. We can
+ * argue either way as to whether we should, but for now
+ * we don't.
+ */
- /* note that we don't cycle the epoch markers. We can
- * argue either way as to whether we should, but for now
- * we don't.
- */
+ if ((cache_ptr->resize_ctl).rpt_fcn != NULL) {
- if ( (cache_ptr->resize_ctl).rpt_fcn != NULL ) {
+ /* get the hit rate for the reporting function. Should still
+ * be good as we haven't reset the hit rate statistics.
+ */
+ if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate")
- /* get the hit rate for the reporting function. Should still
- * be good as we haven't reset the hit rate statistics.
- */
- if(H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate")
-
- (*((cache_ptr->resize_ctl).rpt_fcn))
- (cache_ptr,
- H5C__CURR_AUTO_RESIZE_RPT_FCN_VER,
- hit_rate,
- status,
- old_max_cache_size,
- new_max_cache_size,
- old_min_clean_size,
- new_min_clean_size);
- }
+ (*((cache_ptr->resize_ctl).rpt_fcn))(cache_ptr, H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, hit_rate,
+ status, old_max_cache_size, new_max_cache_size,
+ old_min_clean_size, new_min_clean_size);
+ }
- if(H5C_reset_cache_hit_rate_stats(cache_ptr) < 0)
- /* this should be impossible... */
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed")
- }
+ if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0)
+ /* this should be impossible... */
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed")
+ }
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__flash_increase_cache_size() */
+ } /* H5C__flash_increase_cache_size() */
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C__flush_invalidate_cache
+ *
+ * Purpose: Flush and destroy the entries contained in the target
+ * cache.
+ *
+ * If the cache contains protected entries, the function will
+ * fail, as protected entries cannot be either flushed or
+ * destroyed. However all unprotected entries should be
+ * flushed and destroyed before the function returns failure.
+ *
+ * While pinned entries can usually be flushed, they cannot
+ * be destroyed. However, they should be unpinned when all
+ * the entries that reference them have been destroyed (thus
+ * reduding the pinned entry's reference count to 0, allowing
+ * it to be unpinned).
+ *
+ * If pinned entries are present, the function makes repeated
+ * passes through the cache, flushing all dirty entries
+ * (including the pinned dirty entries where permitted) and
+ * destroying all unpinned entries. This process is repeated
+ * until either the cache is empty, or the number of pinned
+ * entries stops decreasing on each pass.
+ *
+ * Return: Non-negative on success/Negative on failure or if there was
+ * a request to flush all items and something was protected.
+ *
+ * Programmer: John Mainzer
+ * 3/24/065
+ *
+ * Modifications:
+ *
+ * To support the fractal heap, the cache must now deal with
+ * entries being dirtied, resized, and/or renamed inside
+ * flush callbacks. Updated function to support this.
+ *
+ * -- JRM 8/27/06
+ *
+ * Added code to detect and manage the case in which a
+ * flush callback changes the s-list out from under
+ * the function. The only way I can think of in which this
+ * can happen is if a flush function loads an entry
+ * into the cache that isn't there already. Quincey tells
+ * me that this will never happen, but I'm not sure I
+ * believe him.
+ *
+ * Note that this is a pretty bad scenario if it ever
+ * happens. The code I have added should allow us to
+ * handle the situation under all but the worst conditions,
+ * but one can argue that we should just scream and die if
+ * we ever detect the condition.
+ *
+ * -- JRM 10/13/07
+ *
+ * Missing entries?
+ *
+ *
+ * Added support for the H5C__EVICT_ALLOW_LAST_PINS_FLAG.
+ * This flag is used to flush and evict all entries in
+ * the metadata cache that are not pinned -- typically,
+ * everything other than the superblock.
+ *
+ * ??? -- ??/??/??
+ *
+ * Added sanity checks to verify that the skip list is
+ * enabled on entry. On the face of it, it would make
+ * sense to enable the slist on entry, and disable it
+ * on exit, as this function is not called repeatedly.
+ * However, since this function can be called from
+ * H5C_flush_cache(), this would create cases in the test
+ * code where we would have to check the flags to determine
+ * whether we must setup and take down the slist.
+ *
+ * JRM -- 5/5/20
+ *
+ *-------------------------------------------------------------------------
+ */
+ static herr_t H5C__flush_invalidate_cache(H5F_t * f, unsigned flags)
+ {
+ H5C_t * cache_ptr;
+ H5C_ring_t ring;
+ herr_t ret_value = SUCCEED;
-/*-------------------------------------------------------------------------
- *
- * Function: H5C__flush_invalidate_cache
- *
- * Purpose: Flush and destroy the entries contained in the target
- * cache.
- *
- * If the cache contains protected entries, the function will
- * fail, as protected entries cannot be either flushed or
- * destroyed. However all unprotected entries should be
- * flushed and destroyed before the function returns failure.
- *
- * While pinned entries can usually be flushed, they cannot
- * be destroyed. However, they should be unpinned when all
- * the entries that reference them have been destroyed (thus
- * reduding the pinned entry's reference count to 0, allowing
- * it to be unpinned).
- *
- * If pinned entries are present, the function makes repeated
- * passes through the cache, flushing all dirty entries
- * (including the pinned dirty entries where permitted) and
- * destroying all unpinned entries. This process is repeated
- * until either the cache is empty, or the number of pinned
- * entries stops decreasing on each pass.
- *
- * Return: Non-negative on success/Negative on failure or if there was
- * a request to flush all items and something was protected.
- *
- * Programmer: John Mainzer
- * 3/24/065
- *
- * Modifications:
- *
- * To support the fractal heap, the cache must now deal with
- * entries being dirtied, resized, and/or renamed inside
- * flush callbacks. Updated function to support this.
- *
- * -- JRM 8/27/06
- *
- * Added code to detect and manage the case in which a
- * flush callback changes the s-list out from under
- * the function. The only way I can think of in which this
- * can happen is if a flush function loads an entry
- * into the cache that isn't there already. Quincey tells
- * me that this will never happen, but I'm not sure I
- * believe him.
- *
- * Note that this is a pretty bad scenario if it ever
- * happens. The code I have added should allow us to
- * handle the situation under all but the worst conditions,
- * but one can argue that we should just scream and die if
- * we ever detect the condition.
- *
- * -- JRM 10/13/07
- *
- * Missing entries?
- *
- *
- * Added support for the H5C__EVICT_ALLOW_LAST_PINS_FLAG.
- * This flag is used to flush and evict all entries in
- * the metadata cache that are not pinned -- typically,
- * everything other than the superblock.
- *
- * ??? -- ??/??/??
- *
- * Added sanity checks to verify that the skip list is
- * enabled on entry. On the face of it, it would make
- * sense to enable the slist on entry, and disable it
- * on exit, as this function is not called repeatedly.
- * However, since this function can be called from
- * H5C_flush_cache(), this would create cases in the test
- * code where we would have to check the flags to determine
- * whether we must setup and take down the slist.
- *
- * JRM -- 5/5/20
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__flush_invalidate_cache(H5F_t *f, unsigned flags)
-{
- H5C_t * cache_ptr;
- H5C_ring_t ring;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- HDassert(f);
- HDassert(f->shared);
- cache_ptr = f->shared->cache;
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_ptr->slist_ptr);
- HDassert(cache_ptr->slist_enabled);
+ HDassert(f);
+ HDassert(f->shared);
+ cache_ptr = f->shared->cache;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr->slist_ptr);
+ HDassert(cache_ptr->slist_enabled);
#if H5C_DO_SANITY_CHECKS
-{
- int32_t i;
- uint32_t index_len = 0;
- uint32_t slist_len = 0;
- size_t index_size = (size_t)0;
- size_t clean_index_size = (size_t)0;
- size_t dirty_index_size = (size_t)0;
- size_t slist_size = (size_t)0;
-
- HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0);
- HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
- HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
- HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
- HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0);
- HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
-
- for ( i = H5C_RING_USER; i < H5C_RING_NTYPES; i++ ) {
-
- index_len += cache_ptr->index_ring_len[i];
- index_size += cache_ptr->index_ring_size[i];
- clean_index_size += cache_ptr->clean_index_ring_size[i];
- dirty_index_size += cache_ptr->dirty_index_ring_size[i];
-
- slist_len += cache_ptr->slist_ring_len[i];
- slist_size += cache_ptr->slist_ring_size[i];
-
- } /* end for */
-
- HDassert(cache_ptr->index_len == index_len);
- HDassert(cache_ptr->index_size == index_size);
- HDassert(cache_ptr->clean_index_size == clean_index_size);
- HDassert(cache_ptr->dirty_index_size == dirty_index_size);
- HDassert(cache_ptr->slist_len == slist_len);
- HDassert(cache_ptr->slist_size == slist_size);
-}
+ {
+ int32_t i;
+ uint32_t index_len = 0;
+ uint32_t slist_len = 0;
+ size_t index_size = (size_t)0;
+ size_t clean_index_size = (size_t)0;
+ size_t dirty_index_size = (size_t)0;
+ size_t slist_size = (size_t)0;
+
+ HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0);
+ HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0);
+ HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+
+ for (i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) {
+
+ index_len += cache_ptr->index_ring_len[i];
+ index_size += cache_ptr->index_ring_size[i];
+ clean_index_size += cache_ptr->clean_index_ring_size[i];
+ dirty_index_size += cache_ptr->dirty_index_ring_size[i];
+
+ slist_len += cache_ptr->slist_ring_len[i];
+ slist_size += cache_ptr->slist_ring_size[i];
+
+ } /* end for */
+
+ HDassert(cache_ptr->index_len == index_len);
+ HDassert(cache_ptr->index_size == index_size);
+ HDassert(cache_ptr->clean_index_size == clean_index_size);
+ HDassert(cache_ptr->dirty_index_size == dirty_index_size);
+ HDassert(cache_ptr->slist_len == slist_len);
+ HDassert(cache_ptr->slist_size == slist_size);
+ }
#endif /* H5C_DO_SANITY_CHECKS */
- /* remove ageout markers if present */
- if ( cache_ptr->epoch_markers_active > 0 ) {
+ /* remove ageout markers if present */
+ if (cache_ptr->epoch_markers_active > 0) {
- if ( H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0 )
+ if (H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "error removing all epoch markers")
- }
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers")
+ }
- /* flush invalidate each ring, starting from the outermost ring and
- * working inward.
- */
- ring = H5C_RING_USER;
+ /* flush invalidate each ring, starting from the outermost ring and
+ * working inward.
+ */
+ ring = H5C_RING_USER;
- while ( ring < H5C_RING_NTYPES) {
+ while (ring < H5C_RING_NTYPES) {
- if(H5C__flush_invalidate_ring(f, ring, flags) < 0)
+ if (H5C__flush_invalidate_ring(f, ring, flags) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL,
- "flush invalidate ring failed")
- ring++;
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate ring failed")
+ ring++;
- } /* end while */
+ } /* end while */
- /* Invariants, after destroying all entries in the hash table */
- if( ! ( flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG ) ) {
+ /* Invariants, after destroying all entries in the hash table */
+ if (!(flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG)) {
- HDassert(cache_ptr->index_size == 0);
- HDassert(cache_ptr->clean_index_size == 0);
- HDassert(cache_ptr->pel_len == 0);
- HDassert(cache_ptr->pel_size == 0);
+ HDassert(cache_ptr->index_size == 0);
+ HDassert(cache_ptr->clean_index_size == 0);
+ HDassert(cache_ptr->pel_len == 0);
+ HDassert(cache_ptr->pel_size == 0);
- } /* end if */
- else {
+ } /* end if */
+ else {
- H5C_cache_entry_t *entry_ptr; /* Cache entry */
- unsigned u; /* Local index variable */
+ H5C_cache_entry_t *entry_ptr; /* Cache entry */
+ unsigned u; /* Local index variable */
- /* All rings except ring 4 should be empty now */
- /* (Ring 4 has the superblock) */
- for ( u = H5C_RING_USER; u < H5C_RING_SB; u++ ) {
+ /* All rings except ring 4 should be empty now */
+ /* (Ring 4 has the superblock) */
+ for (u = H5C_RING_USER; u < H5C_RING_SB; u++) {
- HDassert(cache_ptr->index_ring_len[u] == 0);
- HDassert(cache_ptr->index_ring_size[u] == 0);
- HDassert(cache_ptr->clean_index_ring_size[u] == 0);
+ HDassert(cache_ptr->index_ring_len[u] == 0);
+ HDassert(cache_ptr->index_ring_size[u] == 0);
+ HDassert(cache_ptr->clean_index_ring_size[u] == 0);
- } /* end for */
+ } /* end for */
- /* Check that any remaining pinned entries are in the superblock ring */
+ /* Check that any remaining pinned entries are in the superblock ring */
- entry_ptr = cache_ptr->pel_head_ptr;
+ entry_ptr = cache_ptr->pel_head_ptr;
- while(entry_ptr) {
+ while (entry_ptr) {
- /* Check ring */
- HDassert(entry_ptr->ring == H5C_RING_SB);
+ /* Check ring */
+ HDassert(entry_ptr->ring == H5C_RING_SB);
- /* Advance to next entry in pinned entry list */
- entry_ptr = entry_ptr->next;
+ /* Advance to next entry in pinned entry list */
+ entry_ptr = entry_ptr->next;
- } /* end while */
- } /* end else */
+ } /* end while */
+ } /* end else */
- HDassert(cache_ptr->dirty_index_size == 0);
- HDassert(cache_ptr->slist_len == 0);
- HDassert(cache_ptr->slist_size == 0);
- HDassert(cache_ptr->pl_len == 0);
- HDassert(cache_ptr->pl_size == 0);
- HDassert(cache_ptr->LRU_list_len == 0);
- HDassert(cache_ptr->LRU_list_size == 0);
+ HDassert(cache_ptr->dirty_index_size == 0);
+ HDassert(cache_ptr->slist_len == 0);
+ HDassert(cache_ptr->slist_size == 0);
+ HDassert(cache_ptr->pl_len == 0);
+ HDassert(cache_ptr->pl_size == 0);
+ HDassert(cache_ptr->LRU_list_len == 0);
+ HDassert(cache_ptr->LRU_list_size == 0);
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__flush_invalidate_cache() */
+ } /* H5C__flush_invalidate_cache() */
-
-/*-------------------------------------------------------------------------
- * Function: H5C__flush_invalidate_ring
- *
- * Purpose: Flush and destroy the entries contained in the target
- * cache and ring.
- *
- * If the ring contains protected entries, the function will
- * fail, as protected entries cannot be either flushed or
- * destroyed. However all unprotected entries should be
- * flushed and destroyed before the function returns failure.
- *
- * While pinned entries can usually be flushed, they cannot
- * be destroyed. However, they should be unpinned when all
- * the entries that reference them have been destroyed (thus
- * reduding the pinned entry's reference count to 0, allowing
- * it to be unpinned).
- *
- * If pinned entries are present, the function makes repeated
- * passes through the cache, flushing all dirty entries
- * (including the pinned dirty entries where permitted) and
- * destroying all unpinned entries. This process is repeated
- * until either the cache is empty, or the number of pinned
- * entries stops decreasing on each pass.
- *
- * If flush dependencies appear in the target ring, the
- * function makes repeated passes through the cache flushing
- * entries in flush dependency order.
- *
- * Return: Non-negative on success/Negative on failure or if there was
- * a request to flush all items and something was protected.
- *
- * Programmer: John Mainzer
- * 9/1/15
- *
- * Changes: Added support for the H5C__EVICT_ALLOW_LAST_PINS_FLAG.
- * This flag is used to flush and evict all entries in
- * the metadata cache that are not pinned -- typically,
- * everything other than the superblock.
- *
- * ??? -- ??/??/??
- *
- * A recent optimization turns off the slist unless a flush
- * is in progress. This should not effect this function, as
- * it is only called during a flush. Added an assertion to
- * verify this.
- *
- * JRM -- 5/6/20
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags)
-{
- H5C_t *cache_ptr;
- hbool_t restart_slist_scan;
- uint32_t protected_entries = 0;
- int32_t i;
- int32_t cur_ring_pel_len;
- int32_t old_ring_pel_len;
- unsigned cooked_flags;
- unsigned evict_flags;
- H5SL_node_t *node_ptr = NULL;
- H5C_cache_entry_t *entry_ptr = NULL;
- H5C_cache_entry_t *next_entry_ptr = NULL;
+ /*-------------------------------------------------------------------------
+ * Function: H5C__flush_invalidate_ring
+ *
+ * Purpose: Flush and destroy the entries contained in the target
+ * cache and ring.
+ *
+ * If the ring contains protected entries, the function will
+ * fail, as protected entries cannot be either flushed or
+ * destroyed. However all unprotected entries should be
+ * flushed and destroyed before the function returns failure.
+ *
+ * While pinned entries can usually be flushed, they cannot
+ * be destroyed. However, they should be unpinned when all
+ * the entries that reference them have been destroyed (thus
+ * reduding the pinned entry's reference count to 0, allowing
+ * it to be unpinned).
+ *
+ * If pinned entries are present, the function makes repeated
+ * passes through the cache, flushing all dirty entries
+ * (including the pinned dirty entries where permitted) and
+ * destroying all unpinned entries. This process is repeated
+ * until either the cache is empty, or the number of pinned
+ * entries stops decreasing on each pass.
+ *
+ * If flush dependencies appear in the target ring, the
+ * function makes repeated passes through the cache flushing
+ * entries in flush dependency order.
+ *
+ * Return: Non-negative on success/Negative on failure or if there was
+ * a request to flush all items and something was protected.
+ *
+ * Programmer: John Mainzer
+ * 9/1/15
+ *
+ * Changes: Added support for the H5C__EVICT_ALLOW_LAST_PINS_FLAG.
+ * This flag is used to flush and evict all entries in
+ * the metadata cache that are not pinned -- typically,
+ * everything other than the superblock.
+ *
+ * ??? -- ??/??/??
+ *
+ * A recent optimization turns off the slist unless a flush
+ * is in progress. This should not effect this function, as
+ * it is only called during a flush. Added an assertion to
+ * verify this.
+ *
+ * JRM -- 5/6/20
+ *
+ *-------------------------------------------------------------------------
+ */
+ static herr_t H5C__flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags)
+ {
+ H5C_t * cache_ptr;
+ hbool_t restart_slist_scan;
+ uint32_t protected_entries = 0;
+ int32_t i;
+ int32_t cur_ring_pel_len;
+ int32_t old_ring_pel_len;
+ unsigned cooked_flags;
+ unsigned evict_flags;
+ H5SL_node_t * node_ptr = NULL;
+ H5C_cache_entry_t *entry_ptr = NULL;
+ H5C_cache_entry_t *next_entry_ptr = NULL;
#if H5C_DO_SANITY_CHECKS
- uint32_t initial_slist_len = 0;
- size_t initial_slist_size = 0;
+ uint32_t initial_slist_len = 0;
+ size_t initial_slist_size = 0;
#endif /* H5C_DO_SANITY_CHECKS */
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- HDassert(f);
- HDassert(f->shared);
+ HDassert(f);
+ HDassert(f->shared);
- cache_ptr = f->shared->cache;
+ cache_ptr = f->shared->cache;
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_ptr->slist_enabled);
- HDassert(cache_ptr->slist_ptr);
- HDassert(ring > H5C_RING_UNDEFINED);
- HDassert(ring < H5C_RING_NTYPES);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr->slist_enabled);
+ HDassert(cache_ptr->slist_ptr);
+ HDassert(ring > H5C_RING_UNDEFINED);
+ HDassert(ring < H5C_RING_NTYPES);
- HDassert(cache_ptr->epoch_markers_active == 0);
+ HDassert(cache_ptr->epoch_markers_active == 0);
- /* Filter out the flags that are not relevant to the flush/invalidate.
- */
- cooked_flags = flags & H5C__FLUSH_CLEAR_ONLY_FLAG;
- evict_flags = flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG;
-
- /* The flush procedure here is a bit strange.
- *
- * In the outer while loop we make at least one pass through the
- * cache, and then repeat until either all the pinned entries in
- * the ring unpin themselves, or until the number of pinned entries
- * in the ring stops declining. In this later case, we scream and die.
- *
- * Since the fractal heap can dirty, resize, and/or move entries
- * in is flush callback, it is possible that the cache will still
- * contain dirty entries at this point. If so, we must make more
- * passes through the skip list to allow it to empty.
- *
- * Further, since clean entries can be dirtied, resized, and/or moved
- * as the result of a flush call back (either the entries own, or that
- * for some other cache entry), we can no longer promise to flush
- * the cache entries in increasing address order.
- *
- * Instead, we just do the best we can -- making a pass through
- * the skip list, and then a pass through the "clean" entries, and
- * then repeating as needed. Thus it is quite possible that an
- * entry will be evicted from the cache only to be re-loaded later
- * in the flush process (From what Quincey tells me, the pin
- * mechanism makes this impossible, but even it it is true now,
- * we shouldn't count on it in the future.)
- *
- * The bottom line is that entries will probably be flushed in close
- * to increasing address order, but there are no guarantees.
- */
+ /* Filter out the flags that are not relevant to the flush/invalidate.
+ */
+ cooked_flags = flags & H5C__FLUSH_CLEAR_ONLY_FLAG;
+ evict_flags = flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG;
- /* compute the number of pinned entries in this ring */
+ /* The flush procedure here is a bit strange.
+ *
+ * In the outer while loop we make at least one pass through the
+ * cache, and then repeat until either all the pinned entries in
+ * the ring unpin themselves, or until the number of pinned entries
+ * in the ring stops declining. In this later case, we scream and die.
+ *
+ * Since the fractal heap can dirty, resize, and/or move entries
+ * in is flush callback, it is possible that the cache will still
+ * contain dirty entries at this point. If so, we must make more
+ * passes through the skip list to allow it to empty.
+ *
+ * Further, since clean entries can be dirtied, resized, and/or moved
+ * as the result of a flush call back (either the entries own, or that
+ * for some other cache entry), we can no longer promise to flush
+ * the cache entries in increasing address order.
+ *
+ * Instead, we just do the best we can -- making a pass through
+ * the skip list, and then a pass through the "clean" entries, and
+ * then repeating as needed. Thus it is quite possible that an
+ * entry will be evicted from the cache only to be re-loaded later
+ * in the flush process (From what Quincey tells me, the pin
+ * mechanism makes this impossible, but even it it is true now,
+ * we shouldn't count on it in the future.)
+ *
+ * The bottom line is that entries will probably be flushed in close
+ * to increasing address order, but there are no guarantees.
+ */
- entry_ptr = cache_ptr->pel_head_ptr;
- cur_ring_pel_len = 0;
+ /* compute the number of pinned entries in this ring */
- while ( entry_ptr != NULL ) {
+ entry_ptr = cache_ptr->pel_head_ptr;
+ cur_ring_pel_len = 0;
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->ring >= ring);
- if(entry_ptr->ring == ring)
- cur_ring_pel_len++;
+ while (entry_ptr != NULL) {
- entry_ptr = entry_ptr->next;
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->ring >= ring);
+ if (entry_ptr->ring == ring)
+ cur_ring_pel_len++;
- } /* end while */
+ entry_ptr = entry_ptr->next;
- old_ring_pel_len = cur_ring_pel_len;
+ } /* end while */
- while(cache_ptr->index_ring_len[ring] > 0) {
+ old_ring_pel_len = cur_ring_pel_len;
- /* first, try to flush-destroy any dirty entries. Do this by
- * making a scan through the slist. Note that new dirty entries
- * may be created by the flush call backs. Thus it is possible
- * that the slist will not be empty after we finish the scan.
- */
+ while (cache_ptr->index_ring_len[ring] > 0) {
+
+ /* first, try to flush-destroy any dirty entries. Do this by
+ * making a scan through the slist. Note that new dirty entries
+ * may be created by the flush call backs. Thus it is possible
+ * that the slist will not be empty after we finish the scan.
+ */
#if H5C_DO_SANITY_CHECKS
- /* Depending on circumstances, H5C__flush_single_entry() will
- * remove dirty entries from the slist as it flushes them.
- * Thus for sanity checks we must make note of the initial
- * slist length and size before we do any flushes.
- */
- initial_slist_len = cache_ptr->slist_len;
- initial_slist_size = cache_ptr->slist_size;
-
- /* There is also the possibility that entries will be
- * dirtied, resized, moved, and/or removed from the cache
- * as the result of calls to the flush callbacks. We use
- * the slist_len_increase and slist_size_increase increase
- * fields in struct H5C_t to track these changes for purpose
- * of sanity checking.
- *
- * To this end, we must zero these fields before we start
- * the pass through the slist.
- */
- cache_ptr->slist_len_increase = 0;
- cache_ptr->slist_size_increase = 0;
+ /* Depending on circumstances, H5C__flush_single_entry() will
+ * remove dirty entries from the slist as it flushes them.
+ * Thus for sanity checks we must make note of the initial
+ * slist length and size before we do any flushes.
+ */
+ initial_slist_len = cache_ptr->slist_len;
+ initial_slist_size = cache_ptr->slist_size;
+
+ /* There is also the possibility that entries will be
+ * dirtied, resized, moved, and/or removed from the cache
+ * as the result of calls to the flush callbacks. We use
+ * the slist_len_increase and slist_size_increase increase
+ * fields in struct H5C_t to track these changes for purpose
+ * of sanity checking.
+ *
+ * To this end, we must zero these fields before we start
+ * the pass through the slist.
+ */
+ cache_ptr->slist_len_increase = 0;
+ cache_ptr->slist_size_increase = 0;
#endif /* H5C_DO_SANITY_CHECKS */
- /* Set the cache_ptr->slist_changed to false.
- *
- * This flag is set to TRUE by H5C__flush_single_entry if the slist
- * is modified by a pre_serialize, serialize, or notify callback.
- *
- * H5C__flush_invalidate_ring() uses this flag to detect any
- * modifications to the slist that might corrupt the scan of
- * the slist -- and restart the scan in this event.
- */
- cache_ptr->slist_changed = FALSE;
-
- /* this done, start the scan of the slist */
- restart_slist_scan = TRUE;
+ /* Set the cache_ptr->slist_changed to false.
+ *
+ * This flag is set to TRUE by H5C__flush_single_entry if the slist
+ * is modified by a pre_serialize, serialize, or notify callback.
+ *
+ * H5C__flush_invalidate_ring() uses this flag to detect any
+ * modifications to the slist that might corrupt the scan of
+ * the slist -- and restart the scan in this event.
+ */
+ cache_ptr->slist_changed = FALSE;
- while ( restart_slist_scan || ( node_ptr != NULL ) ) {
+ /* this done, start the scan of the slist */
+ restart_slist_scan = TRUE;
- if ( restart_slist_scan ) {
+ while (restart_slist_scan || (node_ptr != NULL)) {
- restart_slist_scan = FALSE;
+ if (restart_slist_scan) {
- /* Start at beginning of skip list */
- node_ptr = H5SL_first(cache_ptr->slist_ptr);
+ restart_slist_scan = FALSE;
- if ( node_ptr == NULL )
- /* the slist is empty -- break out of inner loop */
- break;
+ /* Start at beginning of skip list */
+ node_ptr = H5SL_first(cache_ptr->slist_ptr);
- /* Get cache entry for this node */
- next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
+ if (node_ptr == NULL)
+ /* the slist is empty -- break out of inner loop */
+ break;
- if ( NULL == next_entry_ptr )
+ /* Get cache entry for this node */
+ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "next_entry_ptr == NULL ?!?!")
+ if (NULL == next_entry_ptr)
- HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(next_entry_ptr->is_dirty);
- HDassert(next_entry_ptr->in_slist);
- HDassert(next_entry_ptr->ring >= ring);
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!")
- } /* end if */
+ HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(next_entry_ptr->is_dirty);
+ HDassert(next_entry_ptr->in_slist);
+ HDassert(next_entry_ptr->ring >= ring);
- entry_ptr = next_entry_ptr;
+ } /* end if */
- /* It is possible that entries will be dirtied, resized,
- * flushed, or removed from the cache via the take ownership
- * flag as the result of pre_serialize or serialized callbacks.
- *
- * This in turn can corrupt the scan through the slist.
- *
- * We test for slist modifications in the pre_serialize
- * and serialize callbacks, and restart the scan of the
- * slist if we find them. However, best we do some extra
- * sanity checking just in case.
- */
- HDassert(entry_ptr != NULL);
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->in_slist);
- HDassert(entry_ptr->is_dirty);
- HDassert(entry_ptr->ring >= ring);
+ entry_ptr = next_entry_ptr;
+
+ /* It is possible that entries will be dirtied, resized,
+ * flushed, or removed from the cache via the take ownership
+ * flag as the result of pre_serialize or serialized callbacks.
+ *
+ * This in turn can corrupt the scan through the slist.
+ *
+ * We test for slist modifications in the pre_serialize
+ * and serialize callbacks, and restart the scan of the
+ * slist if we find them. However, best we do some extra
+ * sanity checking just in case.
+ */
+ HDassert(entry_ptr != NULL);
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->in_slist);
+ HDassert(entry_ptr->is_dirty);
+ HDassert(entry_ptr->ring >= ring);
- /* increment node pointer now, before we delete its target
- * from the slist.
- */
- node_ptr = H5SL_next(node_ptr);
+ /* increment node pointer now, before we delete its target
+ * from the slist.
+ */
+ node_ptr = H5SL_next(node_ptr);
- if(node_ptr != NULL) {
+ if (node_ptr != NULL) {
- next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
+ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
- if(NULL == next_entry_ptr)
+ if (NULL == next_entry_ptr)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "next_entry_ptr == NULL ?!?!")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!")
- HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(next_entry_ptr->is_dirty);
- HDassert(next_entry_ptr->in_slist);
- HDassert(next_entry_ptr->ring >= ring);
- HDassert(entry_ptr != next_entry_ptr);
- } /* end if */
- else {
+ HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(next_entry_ptr->is_dirty);
+ HDassert(next_entry_ptr->in_slist);
+ HDassert(next_entry_ptr->ring >= ring);
+ HDassert(entry_ptr != next_entry_ptr);
+ } /* end if */
+ else {
- next_entry_ptr = NULL;
- }
+ next_entry_ptr = NULL;
+ }
- /* Note that we now remove nodes from the slist as we flush
- * the associated entries, instead of leaving them there
- * until we are done, and then destroying all nodes in
- * the slist.
- *
- * While this optimization used to be easy, with the possibility
- * of new entries being added to the slist in the midst of the
- * flush, we must keep the slist in canonical form at all
- * times.
- */
- if ( ( ( !entry_ptr->flush_me_last ) ||
- ( ( entry_ptr->flush_me_last ) &&
- ( cache_ptr->num_last_entries >= cache_ptr->slist_len ) )
- ) &&
- ( entry_ptr->flush_dep_nchildren == 0 ) &&
- ( entry_ptr->ring == ring ) ) {
+ /* Note that we now remove nodes from the slist as we flush
+ * the associated entries, instead of leaving them there
+ * until we are done, and then destroying all nodes in
+ * the slist.
+ *
+ * While this optimization used to be easy, with the possibility
+ * of new entries being added to the slist in the midst of the
+ * flush, we must keep the slist in canonical form at all
+ * times.
+ */
+ if (((!entry_ptr->flush_me_last) ||
+ ((entry_ptr->flush_me_last) && (cache_ptr->num_last_entries >= cache_ptr->slist_len))) &&
+ (entry_ptr->flush_dep_nchildren == 0) && (entry_ptr->ring == ring)) {
- if ( entry_ptr->is_protected ) {
+ if (entry_ptr->is_protected) {
- /* we have major problems -- but lets flush
- * everything we can before we flag an error.
- */
- protected_entries++;
+ /* we have major problems -- but lets flush
+ * everything we can before we flag an error.
+ */
+ protected_entries++;
- } /* end if */
- else if ( entry_ptr->is_pinned ) {
+ } /* end if */
+ else if (entry_ptr->is_pinned) {
- if ( H5C__flush_single_entry(f, entry_ptr,
- H5C__DURING_FLUSH_FLAG) < 0 )
+ if (H5C__flush_single_entry(f, entry_ptr, H5C__DURING_FLUSH_FLAG) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "dirty pinned entry flush failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed")
- if ( cache_ptr->slist_changed ) {
+ if (cache_ptr->slist_changed) {
- /* The slist has been modified by something
- * other than the simple removal of the
- * of the flushed entry after the flush.
- *
- * This has the potential to corrupt the
- * scan through the slist, so restart it.
- */
- restart_slist_scan = TRUE;
- cache_ptr->slist_changed = FALSE;
- H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr);
+ /* The slist has been modified by something
+ * other than the simple removal of the
+ * of the flushed entry after the flush.
+ *
+ * This has the potential to corrupt the
+ * scan through the slist, so restart it.
+ */
+ restart_slist_scan = TRUE;
+ cache_ptr->slist_changed = FALSE;
+ H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr);
- } /* end if */
- } /* end else-if */
- else {
+ } /* end if */
+ } /* end else-if */
+ else {
- if ( H5C__flush_single_entry(f, entry_ptr,
- (cooked_flags |
- H5C__DURING_FLUSH_FLAG |
- H5C__FLUSH_INVALIDATE_FLAG |
- H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) ) < 0)
+ if (H5C__flush_single_entry(f, entry_ptr,
+ (cooked_flags | H5C__DURING_FLUSH_FLAG |
+ H5C__FLUSH_INVALIDATE_FLAG |
+ H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG)) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL,
- "dirty entry flush destroy failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry flush destroy failed")
- if ( cache_ptr->slist_changed ) {
+ if (cache_ptr->slist_changed) {
- /* The slist has been modified by something
- * other than the simple removal of the
- * of the flushed entry after the flush.
- *
- * This has the potential to corrupt the
- * scan through the slist, so restart it.
- */
- restart_slist_scan = TRUE;
- cache_ptr->slist_changed = FALSE;
- H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr)
- } /* end if */
- } /* end else */
- } /* end if */
- } /* end while loop scanning skip list */
+ /* The slist has been modified by something
+ * other than the simple removal of the
+ * of the flushed entry after the flush.
+ *
+ * This has the potential to corrupt the
+ * scan through the slist, so restart it.
+ */
+ restart_slist_scan = TRUE;
+ cache_ptr->slist_changed = FALSE;
+ H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr)
+ } /* end if */
+ } /* end else */
+ } /* end if */
+ } /* end while loop scanning skip list */
#if H5C_DO_SANITY_CHECKS
- /* It is possible that entries were added to the slist during
- * the scan, either before or after scan pointer. The following
- * asserts take this into account.
- *
- * Don't bother with the sanity checks if node_ptr != NULL, as
- * in this case we broke out of the loop because it got changed
- * out from under us.
- */
+ /* It is possible that entries were added to the slist during
+ * the scan, either before or after scan pointer. The following
+ * asserts take this into account.
+ *
+ * Don't bother with the sanity checks if node_ptr != NULL, as
+ * in this case we broke out of the loop because it got changed
+ * out from under us.
+ */
- if ( node_ptr == NULL ) {
+ if (node_ptr == NULL) {
- HDassert(cache_ptr->slist_len ==
- (uint32_t)((int32_t)initial_slist_len +
- cache_ptr->slist_len_increase));
+ HDassert(cache_ptr->slist_len ==
+ (uint32_t)((int32_t)initial_slist_len + cache_ptr->slist_len_increase));
- HDassert(cache_ptr->slist_size ==
- (size_t)((ssize_t)initial_slist_size +
- cache_ptr->slist_size_increase));
- } /* end if */
-#endif /* H5C_DO_SANITY_CHECKS */
+ HDassert(cache_ptr->slist_size ==
+ (size_t)((ssize_t)initial_slist_size + cache_ptr->slist_size_increase));
+ } /* end if */
+#endif /* H5C_DO_SANITY_CHECKS */
- /* Since we are doing a destroy, we must make a pass through
- * the hash table and try to flush - destroy all entries that
- * remain.
- *
- * It used to be that all entries remaining in the cache at
- * this point had to be clean, but with the fractal heap mods
- * this may not be the case. If so, we will flush entries out
- * in increasing address order.
- *
- * Writes to disk are possible here.
- */
+ /* Since we are doing a destroy, we must make a pass through
+ * the hash table and try to flush - destroy all entries that
+ * remain.
+ *
+ * It used to be that all entries remaining in the cache at
+ * this point had to be clean, but with the fractal heap mods
+ * this may not be the case. If so, we will flush entries out
+ * in increasing address order.
+ *
+ * Writes to disk are possible here.
+ */
- /* reset the counters so that we can detect insertions, loads,
- * and moves caused by the pre_serialize and serialize calls.
- */
- cache_ptr->entries_loaded_counter = 0;
- cache_ptr->entries_inserted_counter = 0;
- cache_ptr->entries_relocated_counter = 0;
+ /* reset the counters so that we can detect insertions, loads,
+ * and moves caused by the pre_serialize and serialize calls.
+ */
+ cache_ptr->entries_loaded_counter = 0;
+ cache_ptr->entries_inserted_counter = 0;
+ cache_ptr->entries_relocated_counter = 0;
- next_entry_ptr = cache_ptr->il_head;
+ next_entry_ptr = cache_ptr->il_head;
- while ( next_entry_ptr != NULL ) {
+ while (next_entry_ptr != NULL) {
- entry_ptr = next_entry_ptr;
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->ring >= ring);
+ entry_ptr = next_entry_ptr;
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->ring >= ring);
- next_entry_ptr = entry_ptr->il_next;
- HDassert((next_entry_ptr == NULL) ||
- (next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC));
+ next_entry_ptr = entry_ptr->il_next;
+ HDassert((next_entry_ptr == NULL) || (next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC));
- if ( ( ( ! entry_ptr->flush_me_last ) ||
- ( entry_ptr->flush_me_last &&
- ( cache_ptr->num_last_entries >= cache_ptr->slist_len ) )
- ) &&
- ( entry_ptr->flush_dep_nchildren == 0 ) &&
- ( entry_ptr->ring == ring ) ) {
+ if (((!entry_ptr->flush_me_last) ||
+ (entry_ptr->flush_me_last && (cache_ptr->num_last_entries >= cache_ptr->slist_len))) &&
+ (entry_ptr->flush_dep_nchildren == 0) && (entry_ptr->ring == ring)) {
- if ( entry_ptr->is_protected ) {
+ if (entry_ptr->is_protected) {
- /* we have major problems -- but lets flush and
- * destroy everything we can before we flag an
- * error.
- */
- protected_entries++;
+ /* we have major problems -- but lets flush and
+ * destroy everything we can before we flag an
+ * error.
+ */
+ protected_entries++;
- if ( ! entry_ptr->in_slist ) {
+ if (!entry_ptr->in_slist) {
- HDassert(!(entry_ptr->is_dirty));
- }
- } /* end if */
- else if ( ! ( entry_ptr->is_pinned ) ) {
-
- /* if *entry_ptr is dirty, it is possible
- * that one or more other entries may be
- * either removed from the cache, loaded
- * into the cache, or moved to a new location
- * in the file as a side effect of the flush.
- *
- * It's also possible that removing a clean
- * entry will remove the last child of a proxy
- * entry, allowing it to be removed also and
- * invalidating the next_entry_ptr.
- *
- * If either of these happen, and one of the target
- * or proxy entries happens to be the next entry in
- * the hash bucket, we could either find ourselves
- * either scanning a non-existant entry, scanning
- * through a different bucket, or skipping an entry.
- *
- * Neither of these are good, so restart the
- * the scan at the head of the hash bucket
- * after the flush if we detect that the next_entry_ptr
- * becomes invalid.
- *
- * This is not as inefficient at it might seem,
- * as hash buckets typically have at most two
- * or three entries.
- */
- cache_ptr->entry_watched_for_removal = next_entry_ptr;
-
- if ( H5C__flush_single_entry(f, entry_ptr,
- (cooked_flags |
- H5C__DURING_FLUSH_FLAG |
- H5C__FLUSH_INVALIDATE_FLAG |
- H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG)) < 0 )
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "Entry flush destroy failed")
-
- /* Restart the index list scan if necessary. Must
- * do this if the next entry is evicted, and also if
- * one or more entries are inserted, loaded, or moved
- * as these operations can result in part of the scan
- * being skipped -- which can cause a spurious failure
- * if this results in the size of the pinned entry
- * failing to decline during the pass.
- */
- if ( ( ( NULL != next_entry_ptr ) &&
- ( NULL == cache_ptr->entry_watched_for_removal )
- ) ||
- ( cache_ptr->entries_loaded_counter > 0 ) ||
- ( cache_ptr->entries_inserted_counter > 0 ) ||
- ( cache_ptr->entries_relocated_counter > 0 ) ) {
+ HDassert(!(entry_ptr->is_dirty));
+ }
+ } /* end if */
+ else if (!(entry_ptr->is_pinned)) {
- next_entry_ptr = cache_ptr->il_head;
+ /* if *entry_ptr is dirty, it is possible
+ * that one or more other entries may be
+ * either removed from the cache, loaded
+ * into the cache, or moved to a new location
+ * in the file as a side effect of the flush.
+ *
+ * It's also possible that removing a clean
+ * entry will remove the last child of a proxy
+ * entry, allowing it to be removed also and
+ * invalidating the next_entry_ptr.
+ *
+ * If either of these happen, and one of the target
+ * or proxy entries happens to be the next entry in
+ * the hash bucket, we could either find ourselves
+ * either scanning a non-existant entry, scanning
+ * through a different bucket, or skipping an entry.
+ *
+ * Neither of these are good, so restart the
+ * the scan at the head of the hash bucket
+ * after the flush if we detect that the next_entry_ptr
+ * becomes invalid.
+ *
+ * This is not as inefficient at it might seem,
+ * as hash buckets typically have at most two
+ * or three entries.
+ */
+ cache_ptr->entry_watched_for_removal = next_entry_ptr;
+
+ if (H5C__flush_single_entry(f, entry_ptr,
+ (cooked_flags | H5C__DURING_FLUSH_FLAG |
+ H5C__FLUSH_INVALIDATE_FLAG |
+ H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG)) < 0)
+
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Entry flush destroy failed")
+
+ /* Restart the index list scan if necessary. Must
+ * do this if the next entry is evicted, and also if
+ * one or more entries are inserted, loaded, or moved
+ * as these operations can result in part of the scan
+ * being skipped -- which can cause a spurious failure
+ * if this results in the size of the pinned entry
+ * failing to decline during the pass.
+ */
+ if (((NULL != next_entry_ptr) && (NULL == cache_ptr->entry_watched_for_removal)) ||
+ (cache_ptr->entries_loaded_counter > 0) ||
+ (cache_ptr->entries_inserted_counter > 0) ||
+ (cache_ptr->entries_relocated_counter > 0)) {
- cache_ptr->entries_loaded_counter = 0;
- cache_ptr->entries_inserted_counter = 0;
- cache_ptr->entries_relocated_counter = 0;
+ next_entry_ptr = cache_ptr->il_head;
- H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr)
+ cache_ptr->entries_loaded_counter = 0;
+ cache_ptr->entries_inserted_counter = 0;
+ cache_ptr->entries_relocated_counter = 0;
- } /* end if */
- else {
+ H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr)
- cache_ptr->entry_watched_for_removal = NULL;
- }
- } /* end if */
- } /* end if */
- } /* end for loop scanning hash table */
+ } /* end if */
+ else {
- /* We can't do anything if entries are pinned. The
- * hope is that the entries will be unpinned as the
- * result of destroys of entries that reference them.
- *
- * We detect this by noting the change in the number
- * of pinned entries from pass to pass. If it stops
- * shrinking before it hits zero, we scream and die.
- */
- old_ring_pel_len = cur_ring_pel_len;
- entry_ptr = cache_ptr->pel_head_ptr;
- cur_ring_pel_len = 0;
+ cache_ptr->entry_watched_for_removal = NULL;
+ }
+ } /* end if */
+ } /* end if */
+ } /* end for loop scanning hash table */
- while ( entry_ptr != NULL ) {
+ /* We can't do anything if entries are pinned. The
+ * hope is that the entries will be unpinned as the
+ * result of destroys of entries that reference them.
+ *
+ * We detect this by noting the change in the number
+ * of pinned entries from pass to pass. If it stops
+ * shrinking before it hits zero, we scream and die.
+ */
+ old_ring_pel_len = cur_ring_pel_len;
+ entry_ptr = cache_ptr->pel_head_ptr;
+ cur_ring_pel_len = 0;
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->ring >= ring);
+ while (entry_ptr != NULL) {
- if ( entry_ptr->ring == ring ) {
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->ring >= ring);
- cur_ring_pel_len++;
- }
+ if (entry_ptr->ring == ring) {
- entry_ptr = entry_ptr->next;
+ cur_ring_pel_len++;
+ }
- } /* end while */
+ entry_ptr = entry_ptr->next;
- /* Check if the number of pinned entries in the ring is positive, and
- * it is not declining. Scream and die if so.
- */
- if ( ( cur_ring_pel_len > 0 ) &&
- ( cur_ring_pel_len >= old_ring_pel_len ) ) {
+ } /* end while */
- /* Don't error if allowed to have pinned entries remaining */
- if ( evict_flags ) {
+ /* Check if the number of pinned entries in the ring is positive, and
+ * it is not declining. Scream and die if so.
+ */
+ if ((cur_ring_pel_len > 0) && (cur_ring_pel_len >= old_ring_pel_len)) {
- HGOTO_DONE(TRUE)
- }
+ /* Don't error if allowed to have pinned entries remaining */
+ if (evict_flags) {
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "Pinned entry count not decreasing, cur_ring_pel_len = %d, old_ring_pel_len = %d, ring = %d", \
- (int)cur_ring_pel_len, \
- (int)old_ring_pel_len, (int)ring)
- } /* end if */
+ HGOTO_DONE(TRUE)
+ }
- HDassert(protected_entries == cache_ptr->pl_len);
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL,
+ "Pinned entry count not decreasing, cur_ring_pel_len = %d, old_ring_pel_len = "
+ "%d, ring = %d",
+ (int)cur_ring_pel_len, (int)old_ring_pel_len, (int)ring)
+ } /* end if */
- if ( ( protected_entries > 0 ) &&
- ( protected_entries == cache_ptr->index_len ) )
+ HDassert(protected_entries == cache_ptr->pl_len);
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "Only protected entries left in cache, protected_entries = %d",\
- (int)protected_entries)
+ if ((protected_entries > 0) && (protected_entries == cache_ptr->index_len))
- } /* main while loop */
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL,
+ "Only protected entries left in cache, protected_entries = %d",
+ (int)protected_entries)
- /* Invariants, after destroying all entries in the ring */
- for ( i = (int)H5C_RING_UNDEFINED; i <= (int)ring; i++ ) {
+ } /* main while loop */
- HDassert(cache_ptr->index_ring_len[i] == 0);
- HDassert(cache_ptr->index_ring_size[i] == (size_t)0);
- HDassert(cache_ptr->clean_index_ring_size[i] == (size_t)0);
- HDassert(cache_ptr->dirty_index_ring_size[i] == (size_t)0);
+ /* Invariants, after destroying all entries in the ring */
+ for (i = (int)H5C_RING_UNDEFINED; i <= (int)ring; i++) {
- HDassert(cache_ptr->slist_ring_len[i] == 0);
- HDassert(cache_ptr->slist_ring_size[i] == (size_t)0);
+ HDassert(cache_ptr->index_ring_len[i] == 0);
+ HDassert(cache_ptr->index_ring_size[i] == (size_t)0);
+ HDassert(cache_ptr->clean_index_ring_size[i] == (size_t)0);
+ HDassert(cache_ptr->dirty_index_ring_size[i] == (size_t)0);
- } /* end for */
+ HDassert(cache_ptr->slist_ring_len[i] == 0);
+ HDassert(cache_ptr->slist_ring_size[i] == (size_t)0);
- HDassert(protected_entries <= cache_ptr->pl_len);
+ } /* end for */
- if ( protected_entries > 0 ) {
+ HDassert(protected_entries <= cache_ptr->pl_len);
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "Cache has protected entries")
+ if (protected_entries > 0) {
- } else if ( cur_ring_pel_len > 0 ) {
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cache has protected entries")
+ }
+ else if (cur_ring_pel_len > 0) {
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "Can't unpin all pinned entries in ring")
- }
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't unpin all pinned entries in ring")
+ }
done:
- FUNC_LEAVE_NOAPI(ret_value)
-
-} /* H5C__flush_invalidate_ring() */
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__flush_invalidate_ring() */
-/*-------------------------------------------------------------------------
- *
- * Function: H5C__flush_ring
- *
- * Purpose: Flush the entries contained in the specified cache and
- * ring. All entries in rings outside the specified ring
- * must have been flushed on entry.
- *
- * If the cache contains protected entries in the specified
- * ring, the function will fail, as protected entries cannot
- * be flushed. However all unprotected entries in the target
- * ring should be flushed before the function returns failure.
- *
- * If flush dependencies appear in the target ring, the
- * function makes repeated passes through the slist flushing
- * entries in flush dependency order.
- *
- * Return: Non-negative on success/Negative on failure or if there was
- * a request to flush all items and something was protected.
- *
- * Programmer: John Mainzer
- * 9/1/15
- *
- * Changes: A recent optimization turns off the slist unless a flush
- * is in progress. This should not effect this function, as
- * it is only called during a flush. Added an assertion to
- * verify this.
- *
- * JRM -- 5/6/20
- *
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags)
-{
- H5C_t * cache_ptr = f->shared->cache;
- hbool_t flushed_entries_last_pass;
- hbool_t flush_marked_entries;
- hbool_t ignore_protected;
- hbool_t tried_to_flush_protected_entry = FALSE;
- hbool_t restart_slist_scan;
- uint32_t protected_entries = 0;
- H5SL_node_t * node_ptr = NULL;
- H5C_cache_entry_t * entry_ptr = NULL;
- H5C_cache_entry_t * next_entry_ptr = NULL;
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C__flush_ring
+ *
+ * Purpose: Flush the entries contained in the specified cache and
+ * ring. All entries in rings outside the specified ring
+ * must have been flushed on entry.
+ *
+ * If the cache contains protected entries in the specified
+ * ring, the function will fail, as protected entries cannot
+ * be flushed. However all unprotected entries in the target
+ * ring should be flushed before the function returns failure.
+ *
+ * If flush dependencies appear in the target ring, the
+ * function makes repeated passes through the slist flushing
+ * entries in flush dependency order.
+ *
+ * Return: Non-negative on success/Negative on failure or if there was
+ * a request to flush all items and something was protected.
+ *
+ * Programmer: John Mainzer
+ * 9/1/15
+ *
+ * Changes: A recent optimization turns off the slist unless a flush
+ * is in progress. This should not effect this function, as
+ * it is only called during a flush. Added an assertion to
+ * verify this.
+ *
+ * JRM -- 5/6/20
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
+ static herr_t H5C__flush_ring(H5F_t * f, H5C_ring_t ring, unsigned flags)
+ {
+ H5C_t * cache_ptr = f->shared->cache;
+ hbool_t flushed_entries_last_pass;
+ hbool_t flush_marked_entries;
+ hbool_t ignore_protected;
+ hbool_t tried_to_flush_protected_entry = FALSE;
+ hbool_t restart_slist_scan;
+ uint32_t protected_entries = 0;
+ H5SL_node_t * node_ptr = NULL;
+ H5C_cache_entry_t *entry_ptr = NULL;
+ H5C_cache_entry_t *next_entry_ptr = NULL;
#if H5C_DO_SANITY_CHECKS
- uint32_t initial_slist_len = 0;
- size_t initial_slist_size = 0;
+ uint32_t initial_slist_len = 0;
+ size_t initial_slist_size = 0;
#endif /* H5C_DO_SANITY_CHECKS */
- int i;
- herr_t ret_value = SUCCEED;
+ int i;
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_ptr->slist_enabled);
- HDassert(cache_ptr->slist_ptr);
- HDassert((flags & H5C__FLUSH_INVALIDATE_FLAG) == 0);
- HDassert(ring > H5C_RING_UNDEFINED);
- HDassert(ring < H5C_RING_NTYPES);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr->slist_enabled);
+ HDassert(cache_ptr->slist_ptr);
+ HDassert((flags & H5C__FLUSH_INVALIDATE_FLAG) == 0);
+ HDassert(ring > H5C_RING_UNDEFINED);
+ HDassert(ring < H5C_RING_NTYPES);
#if H5C_DO_EXTREME_SANITY_CHECKS
- if ( ( H5C__validate_protected_entry_list(cache_ptr) < 0 ) ||
- ( H5C__validate_pinned_entry_list(cache_ptr ) < 0 ) ||
- ( H5C__validate_lru_list(cache_ptr) < 0 ) )
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL,
- "an extreme sanity check failed on entry")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
- ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 );
- flush_marked_entries = ( (flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0 );
+ ignore_protected = ((flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0);
+ flush_marked_entries = ((flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0);
- if ( ! flush_marked_entries ) {
+ if (!flush_marked_entries) {
- for ( i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++ ) {
+ for (i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++) {
- HDassert(cache_ptr->slist_ring_len[i] == 0);
+ HDassert(cache_ptr->slist_ring_len[i] == 0);
+ }
}
- }
- HDassert(cache_ptr->flush_in_progress);
+ HDassert(cache_ptr->flush_in_progress);
- /* When we are only flushing marked entries, the slist will usually
- * still contain entries when we have flushed everything we should.
- * Thus we track whether we have flushed any entries in the last
- * pass, and terminate if we haven't.
- */
- flushed_entries_last_pass = TRUE;
+ /* When we are only flushing marked entries, the slist will usually
+ * still contain entries when we have flushed everything we should.
+ * Thus we track whether we have flushed any entries in the last
+ * pass, and terminate if we haven't.
+ */
+ flushed_entries_last_pass = TRUE;
- /* Set the cache_ptr->slist_changed to false.
- *
- * This flag is set to TRUE by H5C__flush_single_entry if the
- * slist is modified by a pre_serialize, serialize, or notify callback.
- * H5C_flush_cache uses this flag to detect any modifications
- * to the slist that might corrupt the scan of the slist -- and
- * restart the scan in this event.
- */
- cache_ptr->slist_changed = FALSE;
+ /* Set the cache_ptr->slist_changed to false.
+ *
+ * This flag is set to TRUE by H5C__flush_single_entry if the
+ * slist is modified by a pre_serialize, serialize, or notify callback.
+ * H5C_flush_cache uses this flag to detect any modifications
+ * to the slist that might corrupt the scan of the slist -- and
+ * restart the scan in this event.
+ */
+ cache_ptr->slist_changed = FALSE;
- while ( ( cache_ptr->slist_ring_len[ring] > 0 ) &&
- ( protected_entries == 0 ) &&
- ( flushed_entries_last_pass ) ) {
+ while ((cache_ptr->slist_ring_len[ring] > 0) && (protected_entries == 0) &&
+ (flushed_entries_last_pass)) {
- flushed_entries_last_pass = FALSE;
+ flushed_entries_last_pass = FALSE;
#if H5C_DO_SANITY_CHECKS
- /* For sanity checking, try to verify that the skip list has
- * the expected size and number of entries at the end of each
- * internal while loop (see below).
- *
- * Doing this get a bit tricky, as depending on flags, we may
- * or may not flush all the entries in the slist.
- *
- * To make things more entertaining, with the advent of the
- * fractal heap, the entry serialize callback can cause entries
- * to be dirtied, resized, and/or moved. Also, the
- * pre_serialize callback can result in an entry being
- * removed from the cache via the take ownership flag.
- *
- * To deal with this, we first make note of the initial
- * skip list length and size:
- */
- initial_slist_len = cache_ptr->slist_len;
- initial_slist_size = cache_ptr->slist_size;
-
- /* As mentioned above, there is the possibility that
- * entries will be dirtied, resized, flushed, or removed
- * from the cache via the take ownership flag during
- * our pass through the skip list. To capture the number
- * of entries added, and the skip list size delta,
- * zero the slist_len_increase and slist_size_increase of
- * the cache's instance of H5C_t. These fields will be
- * updated elsewhere to account for slist insertions and/or
- * dirty entry size changes.
- */
- cache_ptr->slist_len_increase = 0;
- cache_ptr->slist_size_increase = 0;
+ /* For sanity checking, try to verify that the skip list has
+ * the expected size and number of entries at the end of each
+ * internal while loop (see below).
+ *
+ * Doing this get a bit tricky, as depending on flags, we may
+ * or may not flush all the entries in the slist.
+ *
+ * To make things more entertaining, with the advent of the
+ * fractal heap, the entry serialize callback can cause entries
+ * to be dirtied, resized, and/or moved. Also, the
+ * pre_serialize callback can result in an entry being
+ * removed from the cache via the take ownership flag.
+ *
+ * To deal with this, we first make note of the initial
+ * skip list length and size:
+ */
+ initial_slist_len = cache_ptr->slist_len;
+ initial_slist_size = cache_ptr->slist_size;
+
+ /* As mentioned above, there is the possibility that
+ * entries will be dirtied, resized, flushed, or removed
+ * from the cache via the take ownership flag during
+ * our pass through the skip list. To capture the number
+ * of entries added, and the skip list size delta,
+ * zero the slist_len_increase and slist_size_increase of
+ * the cache's instance of H5C_t. These fields will be
+ * updated elsewhere to account for slist insertions and/or
+ * dirty entry size changes.
+ */
+ cache_ptr->slist_len_increase = 0;
+ cache_ptr->slist_size_increase = 0;
- /* at the end of the loop, use these values to compute the
- * expected slist length and size and compare this with the
- * value recorded in the cache's instance of H5C_t.
- */
+ /* at the end of the loop, use these values to compute the
+ * expected slist length and size and compare this with the
+ * value recorded in the cache's instance of H5C_t.
+ */
#endif /* H5C_DO_SANITY_CHECKS */
- restart_slist_scan = TRUE;
-
- while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) {
+ restart_slist_scan = TRUE;
- if ( restart_slist_scan ) {
+ while ((restart_slist_scan) || (node_ptr != NULL)) {
- restart_slist_scan = FALSE;
+ if (restart_slist_scan) {
- /* Start at beginning of skip list */
- node_ptr = H5SL_first(cache_ptr->slist_ptr);
+ restart_slist_scan = FALSE;
- if ( node_ptr == NULL ) {
+ /* Start at beginning of skip list */
+ node_ptr = H5SL_first(cache_ptr->slist_ptr);
- /* the slist is empty -- break out of inner loop */
- break;
- }
+ if (node_ptr == NULL) {
- /* Get cache entry for this node */
- next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
+ /* the slist is empty -- break out of inner loop */
+ break;
+ }
- if ( NULL == next_entry_ptr )
+ /* Get cache entry for this node */
+ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "next_entry_ptr == NULL ?!?!")
+ if (NULL == next_entry_ptr)
- HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(next_entry_ptr->is_dirty);
- HDassert(next_entry_ptr->in_slist);
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!")
- } /* end if */
+ HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(next_entry_ptr->is_dirty);
+ HDassert(next_entry_ptr->in_slist);
- entry_ptr = next_entry_ptr;
+ } /* end if */
- /* With the advent of the fractal heap, the free space
- * manager, and the version 3 cache, it is possible
- * that the pre-serialize or serialize callback will
- * dirty, resize, or take ownership of other entries
- * in the cache.
- *
- * To deal with this, I have inserted code to detect any
- * change in the skip list not directly under the control
- * of this function. If such modifications are detected,
- * we must re-start the scan of the skip list to avoid
- * the possibility that the target of the next_entry_ptr
- * may have been flushed or deleted from the cache.
- *
- * To verify that all such possibilities have been dealt
- * with, we do a bit of extra sanity checking on
- * entry_ptr.
- */
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->in_slist);
- HDassert(entry_ptr->is_dirty);
+ entry_ptr = next_entry_ptr;
+
+ /* With the advent of the fractal heap, the free space
+ * manager, and the version 3 cache, it is possible
+ * that the pre-serialize or serialize callback will
+ * dirty, resize, or take ownership of other entries
+ * in the cache.
+ *
+ * To deal with this, I have inserted code to detect any
+ * change in the skip list not directly under the control
+ * of this function. If such modifications are detected,
+ * we must re-start the scan of the skip list to avoid
+ * the possibility that the target of the next_entry_ptr
+ * may have been flushed or deleted from the cache.
+ *
+ * To verify that all such possibilities have been dealt
+ * with, we do a bit of extra sanity checking on
+ * entry_ptr.
+ */
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->in_slist);
+ HDassert(entry_ptr->is_dirty);
- if ( ( ! flush_marked_entries ) || ( entry_ptr->flush_marker ) ) {
+ if ((!flush_marked_entries) || (entry_ptr->flush_marker)) {
- HDassert(entry_ptr->ring >= ring);
- }
+ HDassert(entry_ptr->ring >= ring);
+ }
- /* Advance node pointer now, before we delete its target
- * from the slist.
- */
- node_ptr = H5SL_next(node_ptr);
+ /* Advance node pointer now, before we delete its target
+ * from the slist.
+ */
+ node_ptr = H5SL_next(node_ptr);
- if ( node_ptr != NULL ) {
+ if (node_ptr != NULL) {
- next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
+ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
- if ( NULL == next_entry_ptr )
+ if (NULL == next_entry_ptr)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "next_entry_ptr == NULL ?!?!")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!")
- HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(next_entry_ptr->is_dirty);
- HDassert(next_entry_ptr->in_slist);
+ HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(next_entry_ptr->is_dirty);
+ HDassert(next_entry_ptr->in_slist);
- if ( ! flush_marked_entries || next_entry_ptr->flush_marker ) {
+ if (!flush_marked_entries || next_entry_ptr->flush_marker) {
- HDassert(next_entry_ptr->ring >= ring);
- }
+ HDassert(next_entry_ptr->ring >= ring);
+ }
- HDassert(entry_ptr != next_entry_ptr);
+ HDassert(entry_ptr != next_entry_ptr);
- } /* end if */
- else {
+ } /* end if */
+ else {
- next_entry_ptr = NULL;
- }
+ next_entry_ptr = NULL;
+ }
- if ( ( ! flush_marked_entries || entry_ptr->flush_marker ) &&
- ( ( ! entry_ptr->flush_me_last ) ||
- ( ( entry_ptr->flush_me_last ) &&
- ( ( cache_ptr->num_last_entries >= cache_ptr->slist_len )||
- ( flush_marked_entries && entry_ptr->flush_marker ) )
- )
- ) &&
- ( ( entry_ptr->flush_dep_nchildren == 0 ) ||
- ( entry_ptr->flush_dep_ndirty_children == 0 ) ) &&
- ( entry_ptr->ring == ring ) ) {
+ if ((!flush_marked_entries || entry_ptr->flush_marker) &&
+ ((!entry_ptr->flush_me_last) ||
+ ((entry_ptr->flush_me_last) && ((cache_ptr->num_last_entries >= cache_ptr->slist_len) ||
+ (flush_marked_entries && entry_ptr->flush_marker)))) &&
+ ((entry_ptr->flush_dep_nchildren == 0) || (entry_ptr->flush_dep_ndirty_children == 0)) &&
+ (entry_ptr->ring == ring)) {
- HDassert(entry_ptr->flush_dep_nunser_children == 0);
+ HDassert(entry_ptr->flush_dep_nunser_children == 0);
- if ( entry_ptr->is_protected ) {
+ if (entry_ptr->is_protected) {
- /* we probably have major problems -- but lets
- * flush everything we can before we decide
- * whether to flag an error.
- */
- tried_to_flush_protected_entry = TRUE;
- protected_entries++;
+ /* we probably have major problems -- but lets
+ * flush everything we can before we decide
+ * whether to flag an error.
+ */
+ tried_to_flush_protected_entry = TRUE;
+ protected_entries++;
- } /* end if */
- else {
+ } /* end if */
+ else {
- if ( H5C__flush_single_entry(f, entry_ptr,
- (flags | H5C__DURING_FLUSH_FLAG)) < 0 )
+ if (H5C__flush_single_entry(f, entry_ptr, (flags | H5C__DURING_FLUSH_FLAG)) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "Can't flush entry")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry")
- if ( cache_ptr->slist_changed ) {
+ if (cache_ptr->slist_changed) {
- /* The slist has been modified by something
- * other than the simple removal of the
- * of the flushed entry after the flush.
- *
- * This has the potential to corrupt the
- * scan through the slist, so restart it.
- */
- restart_slist_scan = TRUE;
- cache_ptr->slist_changed = FALSE;
- H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr)
+ /* The slist has been modified by something
+ * other than the simple removal of the
+ * of the flushed entry after the flush.
+ *
+ * This has the potential to corrupt the
+ * scan through the slist, so restart it.
+ */
+ restart_slist_scan = TRUE;
+ cache_ptr->slist_changed = FALSE;
+ H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr)
- } /* end if */
+ } /* end if */
- flushed_entries_last_pass = TRUE;
+ flushed_entries_last_pass = TRUE;
- } /* end else */
- } /* end if */
- } /* while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) */
+ } /* end else */
+ } /* end if */
+ } /* while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) */
#if H5C_DO_SANITY_CHECKS
- /* Verify that the slist size and length are as expected. */
- HDassert((uint32_t)((int32_t)initial_slist_len + \
- cache_ptr->slist_len_increase) == cache_ptr->slist_len);
- HDassert((size_t)((ssize_t)initial_slist_size + \
- cache_ptr->slist_size_increase) == cache_ptr->slist_size);
+ /* Verify that the slist size and length are as expected. */
+ HDassert((uint32_t)((int32_t)initial_slist_len + cache_ptr->slist_len_increase) ==
+ cache_ptr->slist_len);
+ HDassert((size_t)((ssize_t)initial_slist_size + cache_ptr->slist_size_increase) ==
+ cache_ptr->slist_size);
#endif /* H5C_DO_SANITY_CHECKS */
- } /* while */
+ } /* while */
- HDassert(protected_entries <= cache_ptr->pl_len);
+ HDassert(protected_entries <= cache_ptr->pl_len);
- if ( ( ( cache_ptr->pl_len > 0 ) && ( ! ignore_protected ) ) ||
- ( tried_to_flush_protected_entry ) )
+ if (((cache_ptr->pl_len > 0) && (!ignore_protected)) || (tried_to_flush_protected_entry))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "cache has protected items")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "cache has protected items")
#if H5C_DO_SANITY_CHECKS
- if ( ! flush_marked_entries ) {
+ if (!flush_marked_entries) {
- HDassert(cache_ptr->slist_ring_len[ring] == 0);
- HDassert(cache_ptr->slist_ring_size[ring] == 0);
+ HDassert(cache_ptr->slist_ring_len[ring] == 0);
+ HDassert(cache_ptr->slist_ring_size[ring] == 0);
- } /* end if */
-#endif /* H5C_DO_SANITY_CHECKS */
+ } /* end if */
+#endif /* H5C_DO_SANITY_CHECKS */
done:
- FUNC_LEAVE_NOAPI(ret_value)
-
-} /* H5C__flush_ring() */
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__flush_ring() */
-/*-------------------------------------------------------------------------
- *
- * Function: H5C__flush_single_entry
- *
- * Purpose: Flush or clear (and evict if requested) the cache entry
- * with the specified address and type. If the type is NULL,
- * any unprotected entry at the specified address will be
- * flushed (and possibly evicted).
- *
- * Attempts to flush a protected entry will result in an
- * error.
- *
- * If the H5C__FLUSH_INVALIDATE_FLAG flag is set, the entry will
- * be cleared and not flushed, and the call can't be part of a
- * sequence of flushes.
- *
- * The function does nothing silently if there is no entry
- * at the supplied address, or if the entry found has the
- * wrong type.
- *
- * Return: Non-negative on success/Negative on failure or if there was
- * an attempt to flush a protected item.
- *
- * Programmer: John Mainzer, 5/5/04
- *
- * Modifications:
- *
- * JRM -- 7/21/04
- * Updated function for the addition of the hash table.
- *
- * QAK -- 11/26/04
- * Updated function for the switch from TBBTs to skip lists.
- *
- * JRM -- 1/6/05
- * Updated function to reset the flush_marker field.
- * Also replace references to H5F_FLUSH_INVALIDATE and
- * H5F_FLUSH_CLEAR_ONLY with references to
- * H5C__FLUSH_INVALIDATE_FLAG and H5C__FLUSH_CLEAR_ONLY_FLAG
- * respectively.
- *
- * JRM -- 6/24/05
- * Added code to remove dirty entries from the slist after
- * they have been flushed. Also added a sanity check that
- * will scream if we attempt a write when writes are
- * completely disabled.
- *
- * JRM -- 7/5/05
- * Added code to call the new log_flush callback whenever
- * a dirty entry is written to disk. Note that the callback
- * is not called if the H5C__FLUSH_CLEAR_ONLY_FLAG is set,
- * as there is no write to file in this case.
- *
- * JRM -- 8/21/06
- * Added code maintaining the flush_in_progress and
- * destroy_in_progress fields in H5C_cache_entry_t.
- *
- * Also added flush_flags parameter to the call to
- * type_ptr->flush() so that the flush routine can report
- * whether the entry has been resized or renamed. Added
- * code using the flush_flags variable to detect the case
- * in which the target entry is resized during flush, and
- * update the caches data structures accordingly.
- *
- * JRM -- 3/29/07
- * Added sanity checks on the new is_read_only and
- * ro_ref_count fields.
- *
- * QAK -- 2/07/08
- * Separated "destroy entry" concept from "remove entry from
- * cache" concept, by adding the 'take_ownership' flag and
- * the "destroy_entry" variable.
- *
- * JRM -- 11/5/08
- * Added call to H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN() to
- * maintain the new clean_index_size and clean_index_size
- * fields of H5C_t.
- *
- *
- * Missing entries??
- *
- *
- * JRM -- 5/8/20
- * Updated sanity checks for the possibility that the slist
- * is disabled.
- *
- * Also updated main comment to conform more closely with
- * the current state of the code.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags)
-{
- H5C_t * cache_ptr; /* Cache for file */
- hbool_t destroy; /* external flag */
- hbool_t clear_only; /* external flag */
- hbool_t free_file_space; /* external flag */
- hbool_t take_ownership; /* external flag */
- hbool_t del_from_slist_on_destroy; /* external flag */
- hbool_t during_flush; /* external flag */
- hbool_t write_entry; /* internal flag */
- hbool_t destroy_entry; /* internal flag */
- hbool_t generate_image; /* internal flag */
- hbool_t update_page_buffer; /* internal flag */
- hbool_t was_dirty;
- hbool_t suppress_image_entry_writes = FALSE;
- hbool_t suppress_image_entry_frees = FALSE;
- haddr_t entry_addr = HADDR_UNDEF;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- HDassert(f);
- cache_ptr = f->shared->cache;
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(entry_ptr);
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->ring != H5C_RING_UNDEFINED);
- HDassert(entry_ptr->type);
-
- /* setup external flags from the flags parameter */
- destroy = ((flags & H5C__FLUSH_INVALIDATE_FLAG) != 0);
- clear_only = ((flags & H5C__FLUSH_CLEAR_ONLY_FLAG) != 0);
- free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0);
- take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0);
- del_from_slist_on_destroy =
- ((flags & H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) != 0);
- during_flush = ((flags & H5C__DURING_FLUSH_FLAG) != 0);
- generate_image = ((flags & H5C__GENERATE_IMAGE_FLAG) != 0);
- update_page_buffer = ((flags & H5C__UPDATE_PAGE_BUFFER_FLAG) != 0);
-
- /* Set the flag for destroying the entry, based on the 'take ownership'
- * and 'destroy' flags
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C__flush_single_entry
+ *
+ * Purpose: Flush or clear (and evict if requested) the cache entry
+ * with the specified address and type. If the type is NULL,
+ * any unprotected entry at the specified address will be
+ * flushed (and possibly evicted).
+ *
+ * Attempts to flush a protected entry will result in an
+ * error.
+ *
+ * If the H5C__FLUSH_INVALIDATE_FLAG flag is set, the entry will
+ * be cleared and not flushed, and the call can't be part of a
+ * sequence of flushes.
+ *
+ * The function does nothing silently if there is no entry
+ * at the supplied address, or if the entry found has the
+ * wrong type.
+ *
+ * Return: Non-negative on success/Negative on failure or if there was
+ * an attempt to flush a protected item.
+ *
+ * Programmer: John Mainzer, 5/5/04
+ *
+ * Modifications:
+ *
+ * JRM -- 7/21/04
+ * Updated function for the addition of the hash table.
+ *
+ * QAK -- 11/26/04
+ * Updated function for the switch from TBBTs to skip lists.
+ *
+ * JRM -- 1/6/05
+ * Updated function to reset the flush_marker field.
+ * Also replace references to H5F_FLUSH_INVALIDATE and
+ * H5F_FLUSH_CLEAR_ONLY with references to
+ * H5C__FLUSH_INVALIDATE_FLAG and H5C__FLUSH_CLEAR_ONLY_FLAG
+ * respectively.
+ *
+ * JRM -- 6/24/05
+ * Added code to remove dirty entries from the slist after
+ * they have been flushed. Also added a sanity check that
+ * will scream if we attempt a write when writes are
+ * completely disabled.
+ *
+ * JRM -- 7/5/05
+ * Added code to call the new log_flush callback whenever
+ * a dirty entry is written to disk. Note that the callback
+ * is not called if the H5C__FLUSH_CLEAR_ONLY_FLAG is set,
+ * as there is no write to file in this case.
+ *
+ * JRM -- 8/21/06
+ * Added code maintaining the flush_in_progress and
+ * destroy_in_progress fields in H5C_cache_entry_t.
+ *
+ * Also added flush_flags parameter to the call to
+ * type_ptr->flush() so that the flush routine can report
+ * whether the entry has been resized or renamed. Added
+ * code using the flush_flags variable to detect the case
+ * in which the target entry is resized during flush, and
+ * update the caches data structures accordingly.
+ *
+ * JRM -- 3/29/07
+ * Added sanity checks on the new is_read_only and
+ * ro_ref_count fields.
+ *
+ * QAK -- 2/07/08
+ * Separated "destroy entry" concept from "remove entry from
+ * cache" concept, by adding the 'take_ownership' flag and
+ * the "destroy_entry" variable.
+ *
+ * JRM -- 11/5/08
+ * Added call to H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN() to
+ * maintain the new clean_index_size and clean_index_size
+ * fields of H5C_t.
+ *
+ *
+ * Missing entries??
+ *
+ *
+ * JRM -- 5/8/20
+ * Updated sanity checks for the possibility that the slist
+ * is disabled.
+ *
+ * Also updated main comment to conform more closely with
+ * the current state of the code.
+ *
+ *-------------------------------------------------------------------------
*/
- if ( take_ownership ) {
-
- destroy_entry = FALSE;
-
- } else {
+ herr_t H5C__flush_single_entry(H5F_t * f, H5C_cache_entry_t * entry_ptr, unsigned flags)
+ {
+ H5C_t * cache_ptr; /* Cache for file */
+ hbool_t destroy; /* external flag */
+ hbool_t clear_only; /* external flag */
+ hbool_t free_file_space; /* external flag */
+ hbool_t take_ownership; /* external flag */
+ hbool_t del_from_slist_on_destroy; /* external flag */
+ hbool_t during_flush; /* external flag */
+ hbool_t write_entry; /* internal flag */
+ hbool_t destroy_entry; /* internal flag */
+ hbool_t generate_image; /* internal flag */
+ hbool_t update_page_buffer; /* internal flag */
+ hbool_t was_dirty;
+ hbool_t suppress_image_entry_writes = FALSE;
+ hbool_t suppress_image_entry_frees = FALSE;
+ haddr_t entry_addr = HADDR_UNDEF;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ HDassert(f);
+ cache_ptr = f->shared->cache;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(entry_ptr);
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->ring != H5C_RING_UNDEFINED);
+ HDassert(entry_ptr->type);
+
+ /* setup external flags from the flags parameter */
+ destroy = ((flags & H5C__FLUSH_INVALIDATE_FLAG) != 0);
+ clear_only = ((flags & H5C__FLUSH_CLEAR_ONLY_FLAG) != 0);
+ free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0);
+ take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0);
+ del_from_slist_on_destroy = ((flags & H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) != 0);
+ during_flush = ((flags & H5C__DURING_FLUSH_FLAG) != 0);
+ generate_image = ((flags & H5C__GENERATE_IMAGE_FLAG) != 0);
+ update_page_buffer = ((flags & H5C__UPDATE_PAGE_BUFFER_FLAG) != 0);
+
+ /* Set the flag for destroying the entry, based on the 'take ownership'
+ * and 'destroy' flags
+ */
+ if (take_ownership) {
- destroy_entry = destroy;
- }
+ destroy_entry = FALSE;
+ }
+ else {
- /* we will write the entry to disk if it exists, is dirty, and if the
- * clear only flag is not set.
- */
- if ( entry_ptr->is_dirty && !clear_only ) {
+ destroy_entry = destroy;
+ }
- write_entry = TRUE;
+ /* we will write the entry to disk if it exists, is dirty, and if the
+ * clear only flag is not set.
+ */
+ if (entry_ptr->is_dirty && !clear_only) {
- } else {
+ write_entry = TRUE;
+ }
+ else {
- write_entry = FALSE;
- }
+ write_entry = FALSE;
+ }
- /* if we have received close warning, and we have been instructed to
- * generate a metadata cache image, and we have actually constructed
- * the entry images, set suppress_image_entry_frees to TRUE.
- *
- * Set suppress_image_entry_writes to TRUE if indicated by the
- * image_ctl flags.
- */
- if ( ( cache_ptr->close_warning_received ) &&
- ( cache_ptr->image_ctl.generate_image ) &&
- ( cache_ptr->num_entries_in_image > 0 ) &&
- ( cache_ptr->image_entries != NULL ) ) {
+ /* if we have received close warning, and we have been instructed to
+ * generate a metadata cache image, and we have actually constructed
+ * the entry images, set suppress_image_entry_frees to TRUE.
+ *
+ * Set suppress_image_entry_writes to TRUE if indicated by the
+ * image_ctl flags.
+ */
+ if ((cache_ptr->close_warning_received) && (cache_ptr->image_ctl.generate_image) &&
+ (cache_ptr->num_entries_in_image > 0) && (cache_ptr->image_entries != NULL)) {
- /* Sanity checks */
- HDassert(entry_ptr->image_up_to_date || !(entry_ptr->include_in_image));
- HDassert(entry_ptr->image_ptr || !(entry_ptr->include_in_image));
- HDassert((!clear_only) || !(entry_ptr->include_in_image));
- HDassert((!take_ownership) || !(entry_ptr->include_in_image));
- HDassert((!free_file_space) || !(entry_ptr->include_in_image));
+ /* Sanity checks */
+ HDassert(entry_ptr->image_up_to_date || !(entry_ptr->include_in_image));
+ HDassert(entry_ptr->image_ptr || !(entry_ptr->include_in_image));
+ HDassert((!clear_only) || !(entry_ptr->include_in_image));
+ HDassert((!take_ownership) || !(entry_ptr->include_in_image));
+ HDassert((!free_file_space) || !(entry_ptr->include_in_image));
- suppress_image_entry_frees = TRUE;
+ suppress_image_entry_frees = TRUE;
- if ( cache_ptr->image_ctl.flags & H5C_CI__SUPRESS_ENTRY_WRITES ) {
+ if (cache_ptr->image_ctl.flags & H5C_CI__SUPRESS_ENTRY_WRITES) {
- suppress_image_entry_writes = TRUE;
+ suppress_image_entry_writes = TRUE;
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
- /* run initial sanity checks */
+ /* run initial sanity checks */
#if H5C_DO_SANITY_CHECKS
- if ( cache_ptr->slist_enabled ) {
-
- if ( entry_ptr->in_slist ) {
+ if (cache_ptr->slist_enabled) {
- HDassert(entry_ptr->is_dirty);
+ if (entry_ptr->in_slist) {
- if ( ( entry_ptr->flush_marker ) && ( ! entry_ptr->is_dirty ) )
+ HDassert(entry_ptr->is_dirty);
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "entry in slist failed sanity checks")
- } /* end if */
- else {
+ if ((entry_ptr->flush_marker) && (!entry_ptr->is_dirty))
- HDassert(!entry_ptr->is_dirty);
- HDassert(!entry_ptr->flush_marker);
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry in slist failed sanity checks")
+ } /* end if */
+ else {
- if ( ( entry_ptr->is_dirty ) || ( entry_ptr->flush_marker ) )
+ HDassert(!entry_ptr->is_dirty);
+ HDassert(!entry_ptr->flush_marker);
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "entry failed sanity checks")
+ if ((entry_ptr->is_dirty) || (entry_ptr->flush_marker))
- } /* end else */
- } else { /* slist is disabled */
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry failed sanity checks")
- HDassert( ! entry_ptr->in_slist );
+ } /* end else */
+ }
+ else { /* slist is disabled */
- if ( ! entry_ptr->is_dirty ) {
+ HDassert(!entry_ptr->in_slist);
- if ( entry_ptr->flush_marker )
+ if (!entry_ptr->is_dirty) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "flush marked clean entry?")
+ if (entry_ptr->flush_marker)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "flush marked clean entry?")
+ }
}
- }
#endif /* H5C_DO_SANITY_CHECKS */
- if ( entry_ptr->is_protected ) {
+ if (entry_ptr->is_protected) {
- HDassert(!entry_ptr->is_protected);
+ HDassert(!entry_ptr->is_protected);
- /* Attempt to flush a protected entry -- scream and die. */
- HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, \
- "Attempt to flush a protected entry")
+ /* Attempt to flush a protected entry -- scream and die. */
+ HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, "Attempt to flush a protected entry")
- } /* end if */
+ } /* end if */
- /* Set entry_ptr->flush_in_progress = TRUE and set
- * entry_ptr->flush_marker = FALSE
- *
- * We will set flush_in_progress back to FALSE at the end if the
- * entry still exists at that point.
- */
- entry_ptr->flush_in_progress = TRUE;
- entry_ptr->flush_marker = FALSE;
+ /* Set entry_ptr->flush_in_progress = TRUE and set
+ * entry_ptr->flush_marker = FALSE
+ *
+ * We will set flush_in_progress back to FALSE at the end if the
+ * entry still exists at that point.
+ */
+ entry_ptr->flush_in_progress = TRUE;
+ entry_ptr->flush_marker = FALSE;
- /* Preserve current dirty state for later */
- was_dirty = entry_ptr->is_dirty;
+ /* Preserve current dirty state for later */
+ was_dirty = entry_ptr->is_dirty;
- /* The entry is dirty, and we are doing a flush, a flush destroy or have
- * been requested to generate an image. In those cases, serialize the
- * entry.
- */
- if ( write_entry || generate_image ) {
+ /* The entry is dirty, and we are doing a flush, a flush destroy or have
+ * been requested to generate an image. In those cases, serialize the
+ * entry.
+ */
+ if (write_entry || generate_image) {
- HDassert(entry_ptr->is_dirty);
+ HDassert(entry_ptr->is_dirty);
- if ( NULL == entry_ptr->image_ptr ) {
+ if (NULL == entry_ptr->image_ptr) {
- if ( NULL == (entry_ptr->image_ptr =
- H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)) )
+ if (NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, \
- "memory allocation failed for on disk image buffer")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size,
- H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE,
+ H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
- } /* end if */
+ } /* end if */
- if ( ! ( entry_ptr->image_up_to_date ) ) {
+ if (!(entry_ptr->image_up_to_date)) {
- /* Sanity check */
- HDassert(!entry_ptr->prefetched);
+ /* Sanity check */
+ HDassert(!entry_ptr->prefetched);
- /* Generate the entry's image */
- if ( H5C__generate_image(f, cache_ptr, entry_ptr) < 0 )
+ /* Generate the entry's image */
+ if (H5C__generate_image(f, cache_ptr, entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, \
- "can't generate entry's image")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't generate entry's image")
- } /* end if ( ! (entry_ptr->image_up_to_date) ) */
- } /* end if */
+ } /* end if ( ! (entry_ptr->image_up_to_date) ) */
+ } /* end if */
- /* Finally, write the image to disk.
- *
- * Note that if the H5AC__CLASS_SKIP_WRITES flag is set in the
- * in the entry's type, we silently skip the write. This
- * flag should only be used in test code.
- */
- if ( write_entry ) {
+ /* Finally, write the image to disk.
+ *
+ * Note that if the H5AC__CLASS_SKIP_WRITES flag is set in the
+ * in the entry's type, we silently skip the write. This
+ * flag should only be used in test code.
+ */
+ if (write_entry) {
- HDassert(entry_ptr->is_dirty);
+ HDassert(entry_ptr->is_dirty);
#if H5C_DO_SANITY_CHECKS
- if ( ( cache_ptr->check_write_permitted ) &&
- ( ! ( cache_ptr->write_permitted ) ) )
+ if ((cache_ptr->check_write_permitted) && (!(cache_ptr->write_permitted)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "Write when writes are always forbidden!?!?!")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Write when writes are always forbidden!?!?!")
#endif /* H5C_DO_SANITY_CHECKS */
- /* Write the image to disk unless the write is suppressed.
- *
- * This happens if both suppress_image_entry_writes and
- * entry_ptr->include_in_image are TRUE, or if the
- * H5AC__CLASS_SKIP_WRITES is set in the entry's type. This
- * flag should only be used in test code
- */
- if ( ( ( ! suppress_image_entry_writes ) ||
- ( ! entry_ptr->include_in_image ) ) &&
- ( ( (entry_ptr->type->flags) & H5C__CLASS_SKIP_WRITES) == 0 ) ) {
+ /* Write the image to disk unless the write is suppressed.
+ *
+ * This happens if both suppress_image_entry_writes and
+ * entry_ptr->include_in_image are TRUE, or if the
+ * H5AC__CLASS_SKIP_WRITES is set in the entry's type. This
+ * flag should only be used in test code
+ */
+ if (((!suppress_image_entry_writes) || (!entry_ptr->include_in_image)) &&
+ (((entry_ptr->type->flags) & H5C__CLASS_SKIP_WRITES) == 0)) {
- H5FD_mem_t mem_type = H5FD_MEM_DEFAULT;
+ H5FD_mem_t mem_type = H5FD_MEM_DEFAULT;
#ifdef H5_HAVE_PARALLEL
- if ( cache_ptr->coll_write_list ) {
+ if (cache_ptr->coll_write_list) {
- if ( H5SL_insert(cache_ptr->coll_write_list, entry_ptr,
- &entry_ptr->addr) < 0 )
+ if (H5SL_insert(cache_ptr->coll_write_list, entry_ptr, &entry_ptr->addr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, \
- "unable to insert skip list item")
- } /* end if */
- else
- {
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "unable to insert skip list item")
+ } /* end if */
+ else {
#endif /* H5_HAVE_PARALLEL */
- if ( entry_ptr->prefetched ) {
+ if (entry_ptr->prefetched) {
- HDassert(entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID);
+ HDassert(entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID);
- mem_type = cache_ptr->
- class_table_ptr[entry_ptr->prefetch_type_id]->
- mem_type;
- } /* end if */
- else {
+ mem_type = cache_ptr->class_table_ptr[entry_ptr->prefetch_type_id]->mem_type;
+ } /* end if */
+ else {
- mem_type = entry_ptr->type->mem_type;
- }
+ mem_type = entry_ptr->type->mem_type;
+ }
- if ( H5F_block_write(f, mem_type, entry_ptr->addr,
- entry_ptr->size, entry_ptr->image_ptr) < 0 )
+ if (H5F_block_write(f, mem_type, entry_ptr->addr, entry_ptr->size, entry_ptr->image_ptr) <
+ 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "Can't write image to file")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write image to file")
#ifdef H5_HAVE_PARALLEL
- }
+ }
#endif /* H5_HAVE_PARALLEL */
- } /* end if */
-
- /* if the entry has a notify callback, notify it that we have
- * just flushed the entry.
- */
- if ( ( entry_ptr->type->notify ) &&
- ( (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_FLUSH,
- entry_ptr) < 0 ) )
+ } /* end if */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, \
- "can't notify client of entry flush")
+ /* if the entry has a notify callback, notify it that we have
+ * just flushed the entry.
+ */
+ if ((entry_ptr->type->notify) &&
+ ((entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_FLUSH, entry_ptr) < 0))
- } /* if ( write_entry ) */
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client of entry flush")
- /* At this point, all pre-serialize and serialize calls have been
- * made if it was appropriate to make them. Similarly, the entry
- * has been written to disk if desired.
- *
- * Thus it is now safe to update the cache data structures for the
- * flush.
- */
+ } /* if ( write_entry ) */
- /* start by updating the statistics */
- if ( clear_only ) {
+ /* At this point, all pre-serialize and serialize calls have been
+ * made if it was appropriate to make them. Similarly, the entry
+ * has been written to disk if desired.
+ *
+ * Thus it is now safe to update the cache data structures for the
+ * flush.
+ */
- /* only log a clear if the entry was dirty */
- if ( was_dirty ) {
+ /* start by updating the statistics */
+ if (clear_only) {
- H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr)
+ /* only log a clear if the entry was dirty */
+ if (was_dirty) {
- } /* end if */
- } else if(write_entry) {
+ H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr)
- HDassert(was_dirty);
+ } /* end if */
+ }
+ else if (write_entry) {
- /* only log a flush if we actually wrote to disk */
- H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr)
+ HDassert(was_dirty);
- } /* end else if */
+ /* only log a flush if we actually wrote to disk */
+ H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr)
- /* Note that the algorithm below is (very) similar to the set of operations
- * in H5C_remove_entry() and should be kept in sync with changes
- * to that code. - QAK, 2016/11/30
- */
+ } /* end else if */
- /* Update the cache internal data structures. */
- if ( destroy ) {
+ /* Note that the algorithm below is (very) similar to the set of operations
+ * in H5C_remove_entry() and should be kept in sync with changes
+ * to that code. - QAK, 2016/11/30
+ */
- /* Sanity checks */
- if ( take_ownership ) {
+ /* Update the cache internal data structures. */
+ if (destroy) {
- HDassert(!destroy_entry);
+ /* Sanity checks */
+ if (take_ownership) {
- } else {
+ HDassert(!destroy_entry);
+ }
+ else {
- HDassert(destroy_entry);
- }
+ HDassert(destroy_entry);
+ }
- HDassert(!entry_ptr->is_pinned);
+ HDassert(!entry_ptr->is_pinned);
- /* Update stats, while entry is still in the cache */
- H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership)
+ /* Update stats, while entry is still in the cache */
+ H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership)
- /* If the entry's type has a 'notify' callback and the entry is about
- * to be removed from the cache, send a 'before eviction' notice while
- * the entry is still fully integrated in the cache.
- */
- if ( ( entry_ptr->type->notify ) &&
- ( (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT,
- entry_ptr) < 0 ) )
+ /* If the entry's type has a 'notify' callback and the entry is about
+ * to be removed from the cache, send a 'before eviction' notice while
+ * the entry is still fully integrated in the cache.
+ */
+ if ((entry_ptr->type->notify) &&
+ ((entry_ptr->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, entry_ptr) < 0))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, \
- "can't notify client about entry to evict")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry to evict")
- /* Update the cache internal data structures as appropriate
- * for a destroy. Specifically:
- *
- * 1) Delete it from the index
- *
- * 2) Delete it from the skip list if requested.
- *
- * 3) Delete it from the collective read access list.
- *
- * 4) Update the replacement policy for eviction
- *
- * 5) Remove it from the tag list for this object
- *
- * Finally, if the destroy_entry flag is set, discard the
- * entry.
- */
- H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL)
+ /* Update the cache internal data structures as appropriate
+ * for a destroy. Specifically:
+ *
+ * 1) Delete it from the index
+ *
+ * 2) Delete it from the skip list if requested.
+ *
+ * 3) Delete it from the collective read access list.
+ *
+ * 4) Update the replacement policy for eviction
+ *
+ * 5) Remove it from the tag list for this object
+ *
+ * Finally, if the destroy_entry flag is set, discard the
+ * entry.
+ */
+ H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL)
- if ( ( entry_ptr->in_slist ) && ( del_from_slist_on_destroy ) ) {
+ if ((entry_ptr->in_slist) && (del_from_slist_on_destroy)) {
- H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush)
- }
+ H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush)
+ }
#ifdef H5_HAVE_PARALLEL
- /* Check for collective read access flag */
- if ( entry_ptr->coll_access ) {
+ /* Check for collective read access flag */
+ if (entry_ptr->coll_access) {
- entry_ptr->coll_access = FALSE;
+ entry_ptr->coll_access = FALSE;
- H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL)
+ H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL)
- } /* end if */
-#endif /* H5_HAVE_PARALLEL */
-
- H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, FAIL)
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
- /* Remove entry from tag list */
- if ( H5C__untag_entry(cache_ptr, entry_ptr) < 0 )
+ H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, FAIL)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, \
- "can't remove entry from tag list")
+ /* Remove entry from tag list */
+ if (H5C__untag_entry(cache_ptr, entry_ptr) < 0)
- /* verify that the entry is no longer part of any flush dependencies */
- HDassert(entry_ptr->flush_dep_nparents == 0);
- HDassert(entry_ptr->flush_dep_nchildren == 0);
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list")
- } /* end if */
- else {
+ /* verify that the entry is no longer part of any flush dependencies */
+ HDassert(entry_ptr->flush_dep_nparents == 0);
+ HDassert(entry_ptr->flush_dep_nchildren == 0);
- HDassert(clear_only || write_entry);
- HDassert(entry_ptr->is_dirty);
- HDassert((!cache_ptr->slist_enabled) || (entry_ptr->in_slist));
-
- /* We are either doing a flush or a clear.
- *
- * A clear and a flush are the same from the point of
- * view of the replacement policy and the slist.
- * Hence no differentiation between them.
- *
- * JRM -- 7/7/07
- */
-
- H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, FAIL)
+ } /* end if */
+ else {
- H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush)
+ HDassert(clear_only || write_entry);
+ HDassert(entry_ptr->is_dirty);
+ HDassert((!cache_ptr->slist_enabled) || (entry_ptr->in_slist));
- /* mark the entry as clean and update the index for
- * entry clean. Also, call the clear callback
- * if defined.
- */
- entry_ptr->is_dirty = FALSE;
+ /* We are either doing a flush or a clear.
+ *
+ * A clear and a flush are the same from the point of
+ * view of the replacement policy and the slist.
+ * Hence no differentiation between them.
+ *
+ * JRM -- 7/7/07
+ */
- H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr);
+ H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, FAIL)
- /* Check for entry changing status and do notifications, etc. */
- if ( was_dirty ) {
+ H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush)
- /* If the entry's type has a 'notify' callback send a
- * 'entry cleaned' notice now that the entry is fully
- * integrated into the cache.
+ /* mark the entry as clean and update the index for
+ * entry clean. Also, call the clear callback
+ * if defined.
*/
- if ( ( entry_ptr->type->notify ) &&
- ( (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED,
- entry_ptr) < 0 ) )
+ entry_ptr->is_dirty = FALSE;
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, \
- "can't notify client about entry dirty flag cleared")
+ H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr);
- /* Propagate the clean flag up the flush dependency chain
- * if appropriate
- */
- if ( entry_ptr->flush_dep_ndirty_children != 0 ) {
+ /* Check for entry changing status and do notifications, etc. */
+ if (was_dirty) {
- HDassert(entry_ptr->flush_dep_ndirty_children == 0);
- }
+ /* If the entry's type has a 'notify' callback send a
+ * 'entry cleaned' notice now that the entry is fully
+ * integrated into the cache.
+ */
+ if ((entry_ptr->type->notify) &&
+ ((entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0))
- if ( entry_ptr->flush_dep_nparents > 0 ) {
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify client about entry dirty flag cleared")
- if ( H5C__mark_flush_dep_clean(entry_ptr) < 0 )
+ /* Propagate the clean flag up the flush dependency chain
+ * if appropriate
+ */
+ if (entry_ptr->flush_dep_ndirty_children != 0) {
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, \
- "Can't propagate flush dep clean flag")
- }
- } /* end if */
- } /* end else */
+ HDassert(entry_ptr->flush_dep_ndirty_children == 0);
+ }
- /* reset the flush_in progress flag */
- entry_ptr->flush_in_progress = FALSE;
+ if (entry_ptr->flush_dep_nparents > 0) {
- /* capture the cache entry address for the log_flush call at the
- * end before the entry_ptr gets freed
- */
- entry_addr = entry_ptr->addr;
+ if (H5C__mark_flush_dep_clean(entry_ptr) < 0)
- /* Internal cache data structures should now be up to date, and
- * consistent with the status of the entry.
- *
- * Now discard the entry if appropriate.
- */
- if ( destroy ) {
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL,
+ "Can't propagate flush dep clean flag")
+ }
+ } /* end if */
+ } /* end else */
- /* Sanity check */
- HDassert(0 == entry_ptr->flush_dep_nparents);
+ /* reset the flush_in progress flag */
+ entry_ptr->flush_in_progress = FALSE;
+
+ /* capture the cache entry address for the log_flush call at the
+ * end before the entry_ptr gets freed
+ */
+ entry_addr = entry_ptr->addr;
- /* if both suppress_image_entry_frees and entry_ptr->include_in_image
- * are true, simply set entry_ptr->image_ptr to NULL, as we have
- * another pointer to the buffer in an instance of H5C_image_entry_t
- * in cache_ptr->image_entries.
+ /* Internal cache data structures should now be up to date, and
+ * consistent with the status of the entry.
*
- * Otherwise, free the buffer if it exists.
+ * Now discard the entry if appropriate.
*/
- if ( suppress_image_entry_frees && entry_ptr->include_in_image ) {
+ if (destroy) {
+
+ /* Sanity check */
+ HDassert(0 == entry_ptr->flush_dep_nparents);
- entry_ptr->image_ptr = NULL;
+ /* if both suppress_image_entry_frees and entry_ptr->include_in_image
+ * are true, simply set entry_ptr->image_ptr to NULL, as we have
+ * another pointer to the buffer in an instance of H5C_image_entry_t
+ * in cache_ptr->image_entries.
+ *
+ * Otherwise, free the buffer if it exists.
+ */
+ if (suppress_image_entry_frees && entry_ptr->include_in_image) {
- } else if ( entry_ptr->image_ptr != NULL ) {
+ entry_ptr->image_ptr = NULL;
+ }
+ else if (entry_ptr->image_ptr != NULL) {
- entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr);
- }
+ entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr);
+ }
- /* If the entry is not a prefetched entry, verify that the flush
- * dependency parents addresses array has been transferred.
- *
- * If the entry is prefetched, the free_isr routine will dispose of
- * the flush dependency parents addresses array if necessary.
- */
- if ( ! entry_ptr->prefetched ) {
+ /* If the entry is not a prefetched entry, verify that the flush
+ * dependency parents addresses array has been transferred.
+ *
+ * If the entry is prefetched, the free_isr routine will dispose of
+ * the flush dependency parents addresses array if necessary.
+ */
+ if (!entry_ptr->prefetched) {
- HDassert(0 == entry_ptr->fd_parent_count);
- HDassert(NULL == entry_ptr->fd_parent_addrs);
+ HDassert(0 == entry_ptr->fd_parent_count);
+ HDassert(NULL == entry_ptr->fd_parent_addrs);
- } /* end if */
+ } /* end if */
- /* Check whether we should free the space in the file that
- * the entry occupies
- */
- if ( free_file_space ) {
+ /* Check whether we should free the space in the file that
+ * the entry occupies
+ */
+ if (free_file_space) {
- hsize_t fsf_size;
+ hsize_t fsf_size;
- /* Sanity checks */
- HDassert(H5F_addr_defined(entry_ptr->addr));
- HDassert(!H5F_IS_TMP_ADDR(f, entry_ptr->addr));
+ /* Sanity checks */
+ HDassert(H5F_addr_defined(entry_ptr->addr));
+ HDassert(!H5F_IS_TMP_ADDR(f, entry_ptr->addr));
#ifndef NDEBUG
- {
- size_t curr_len;
+ {
+ size_t curr_len;
- /* Get the actual image size for the thing again */
- entry_ptr->type->image_len((void *)entry_ptr, &curr_len);
- HDassert(curr_len == entry_ptr->size);
- }
+ /* Get the actual image size for the thing again */
+ entry_ptr->type->image_len((void *)entry_ptr, &curr_len);
+ HDassert(curr_len == entry_ptr->size);
+ }
#endif /* NDEBUG */
- /* If the file space free size callback is defined, use
- * it to get the size of the block of file space to free.
- * Otherwise use entry_ptr->size.
- */
- if ( entry_ptr->type->fsf_size ) {
+ /* If the file space free size callback is defined, use
+ * it to get the size of the block of file space to free.
+ * Otherwise use entry_ptr->size.
+ */
+ if (entry_ptr->type->fsf_size) {
- if ( (entry_ptr->type->fsf_size)((void *)entry_ptr, &fsf_size)
- < 0 )
+ if ((entry_ptr->type->fsf_size)((void *)entry_ptr, &fsf_size) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, \
- "unable to get file space free size")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to get file space free size")
- } /* end if */
- else { /* no file space free size callback -- use entry size */
+ } /* end if */
+ else { /* no file space free size callback -- use entry size */
- fsf_size = entry_ptr->size;
- }
+ fsf_size = entry_ptr->size;
+ }
- /* Release the space on disk */
- if ( H5MF_xfree(f, entry_ptr->type->mem_type,
- entry_ptr->addr, fsf_size) < 0 )
+ /* Release the space on disk */
+ if (H5MF_xfree(f, entry_ptr->type->mem_type, entry_ptr->addr, fsf_size) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, \
- "unable to free file space for cache entry")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to free file space for cache entry")
- } /* end if ( free_file_space ) */
+ } /* end if ( free_file_space ) */
- /* Reset the pointer to the cache the entry is within. -QAK */
- entry_ptr->cache_ptr = NULL;
+ /* Reset the pointer to the cache the entry is within. -QAK */
+ entry_ptr->cache_ptr = NULL;
- /* increment entries_removed_counter and set
- * last_entry_removed_ptr. As we are likely abuut to
- * free the entry, recall that last_entry_removed_ptr
- * must NEVER be dereferenced.
- *
- * Recall that these fields are maintained to allow functions
- * that perform scans of lists of entries to detect the
- * unexpected removal of entries (via expunge, eviction,
- * or take ownership at present), so that they can re-start
- * their scans if necessary.
- *
- * Also check if the entry we are watching for removal is being
- * removed (usually the 'next' entry for an iteration) and reset
- * it to indicate that it was removed.
- */
- cache_ptr->entries_removed_counter++;
- cache_ptr->last_entry_removed_ptr = entry_ptr;
+ /* increment entries_removed_counter and set
+ * last_entry_removed_ptr. As we are likely abuut to
+ * free the entry, recall that last_entry_removed_ptr
+ * must NEVER be dereferenced.
+ *
+ * Recall that these fields are maintained to allow functions
+ * that perform scans of lists of entries to detect the
+ * unexpected removal of entries (via expunge, eviction,
+ * or take ownership at present), so that they can re-start
+ * their scans if necessary.
+ *
+ * Also check if the entry we are watching for removal is being
+ * removed (usually the 'next' entry for an iteration) and reset
+ * it to indicate that it was removed.
+ */
+ cache_ptr->entries_removed_counter++;
+ cache_ptr->last_entry_removed_ptr = entry_ptr;
- if ( entry_ptr == cache_ptr->entry_watched_for_removal ) {
+ if (entry_ptr == cache_ptr->entry_watched_for_removal) {
- cache_ptr->entry_watched_for_removal = NULL;
- }
+ cache_ptr->entry_watched_for_removal = NULL;
+ }
- /* Check for actually destroying the entry in memory */
- /* (As opposed to taking ownership of it) */
- if ( destroy_entry ) {
+ /* Check for actually destroying the entry in memory */
+ /* (As opposed to taking ownership of it) */
+ if (destroy_entry) {
- if ( entry_ptr->is_dirty ) {
+ if (entry_ptr->is_dirty) {
- /* Reset dirty flag */
- entry_ptr->is_dirty = FALSE;
+ /* Reset dirty flag */
+ entry_ptr->is_dirty = FALSE;
- /* If the entry's type has a 'notify' callback send a
- * 'entry cleaned' notice now that the entry is fully
- * integrated into the cache.
- */
- if ( ( entry_ptr->type->notify ) &&
- ( (entry_ptr->type->notify)
- (H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0 ) )
+ /* If the entry's type has a 'notify' callback send a
+ * 'entry cleaned' notice now that the entry is fully
+ * integrated into the cache.
+ */
+ if ((entry_ptr->type->notify) &&
+ ((entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, \
- "can't notify client about entry dirty flag cleared")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify client about entry dirty flag cleared")
- } /* end if */
+ } /* end if */
- /* we are about to discard the in core representation --
- * set the magic field to bad magic so we can detect a
- * freed entry if we see one.
- */
- entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
+ /* we are about to discard the in core representation --
+ * set the magic field to bad magic so we can detect a
+ * freed entry if we see one.
+ */
+ entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
- /* verify that the image has been freed */
- HDassert(entry_ptr->image_ptr == NULL);
+ /* verify that the image has been freed */
+ HDassert(entry_ptr->image_ptr == NULL);
- if ( entry_ptr->type->free_icr((void *)entry_ptr) < 0 )
+ if (entry_ptr->type->free_icr((void *)entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "free_icr callback failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "free_icr callback failed")
- } /* end if */
- else {
+ } /* end if */
+ else {
- HDassert(take_ownership);
+ HDassert(take_ownership);
- /* client is taking ownership of the entry.
- * set bad magic here too so the cache will choke
- * unless the entry is re-inserted properly
- */
- entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
+ /* client is taking ownership of the entry.
+ * set bad magic here too so the cache will choke
+ * unless the entry is re-inserted properly
+ */
+ entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
- } /* end else */
- } /* if (destroy) */
+ } /* end else */
+ } /* if (destroy) */
- /* Check if we have to update the page buffer with cleared entries
- * so it doesn't go out of date
- */
- if ( update_page_buffer ) {
+ /* Check if we have to update the page buffer with cleared entries
+ * so it doesn't go out of date
+ */
+ if (update_page_buffer) {
- /* Sanity check */
- HDassert(!destroy);
- HDassert(entry_ptr->image_ptr);
+ /* Sanity check */
+ HDassert(!destroy);
+ HDassert(entry_ptr->image_ptr);
- if ( ( f->shared->page_buf ) &&
- ( f->shared->page_buf->page_size >= entry_ptr->size ) ) {
+ if ((f->shared->page_buf) && (f->shared->page_buf->page_size >= entry_ptr->size)) {
- if ( H5PB_update_entry(f->shared->page_buf, entry_ptr->addr,
- entry_ptr->size, entry_ptr->image_ptr) > 0 )
+ if (H5PB_update_entry(f->shared->page_buf, entry_ptr->addr, entry_ptr->size,
+ entry_ptr->image_ptr) > 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "Failed to update PB with metadata cache")
- } /* end if */
- } /* end if */
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Failed to update PB with metadata cache")
+ } /* end if */
+ } /* end if */
- if ( cache_ptr->log_flush ) {
+ if (cache_ptr->log_flush) {
- if ( (cache_ptr->log_flush)(cache_ptr, entry_addr,
- was_dirty, flags) < 0 )
+ if ((cache_ptr->log_flush)(cache_ptr, entry_addr, was_dirty, flags) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "log_flush callback failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "log_flush callback failed")
- } /* end if */
+ } /* end if */
done:
- HDassert( ( ret_value != SUCCEED ) || ( destroy_entry ) ||
- ( ! entry_ptr->flush_in_progress ) );
+ HDassert((ret_value != SUCCEED) || (destroy_entry) || (!entry_ptr->flush_in_progress));
- HDassert( ( ret_value != SUCCEED ) || ( destroy_entry ) ||
- ( take_ownership ) || ( ! entry_ptr->is_dirty ) );
-
- FUNC_LEAVE_NOAPI(ret_value)
+ HDassert((ret_value != SUCCEED) || (destroy_entry) || (take_ownership) || (!entry_ptr->is_dirty));
-} /* H5C__flush_single_entry() */
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__flush_single_entry() */
-/*-------------------------------------------------------------------------
- *
- * Function: H5C__verify_len_eoa
- *
- * Purpose: Verify that 'len' does not exceed eoa when 'actual' is
- * false i.e. 'len" is the initial speculative length from
- * get_load_size callback with null image pointer.
- * If exceed, adjust 'len' accordingly.
- *
- * Verify that 'len' should not exceed eoa when 'actual' is
- * true i.e. 'len' is the actual length from get_load_size
- * callback with non-null image pointer.
- * If exceed, return error.
- *
- * Return: FAIL if error is detected, SUCCEED otherwise.
- *
- * Programmer: Vailin Choi
- * 9/6/15
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__verify_len_eoa(H5F_t *f, const H5C_class_t *type, haddr_t addr,
- size_t *len, hbool_t actual)
-{
- H5FD_mem_t cooked_type; /* Modified type, accounting for switching global heaps */
- haddr_t eoa; /* End-of-allocation in the file */
- herr_t ret_value = SUCCEED; /* Return value */
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C__verify_len_eoa
+ *
+ * Purpose: Verify that 'len' does not exceed eoa when 'actual' is
+ * false i.e. 'len" is the initial speculative length from
+ * get_load_size callback with null image pointer.
+ * If exceed, adjust 'len' accordingly.
+ *
+ * Verify that 'len' should not exceed eoa when 'actual' is
+ * true i.e. 'len' is the actual length from get_load_size
+ * callback with non-null image pointer.
+ * If exceed, return error.
+ *
+ * Return: FAIL if error is detected, SUCCEED otherwise.
+ *
+ * Programmer: Vailin Choi
+ * 9/6/15
+ *
+ *-------------------------------------------------------------------------
+ */
+ static herr_t H5C__verify_len_eoa(H5F_t * f, const H5C_class_t *type, haddr_t addr, size_t *len,
+ hbool_t actual)
+ {
+ H5FD_mem_t cooked_type; /* Modified type, accounting for switching global heaps */
+ haddr_t eoa; /* End-of-allocation in the file */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- /* if type == H5FD_MEM_GHEAP, H5F_block_read() forces
- * type to H5FD_MEM_DRAW via its call to H5F__accum_read().
- * Thus we do the same for purposes of computing the EOA
- * for sanity checks.
- */
- cooked_type = (type->mem_type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type->mem_type;
+ /* if type == H5FD_MEM_GHEAP, H5F_block_read() forces
+ * type to H5FD_MEM_DRAW via its call to H5F__accum_read().
+ * Thus we do the same for purposes of computing the EOA
+ * for sanity checks.
+ */
+ cooked_type = (type->mem_type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type->mem_type;
- /* Get the file's end-of-allocation value */
- eoa = H5F_get_eoa(f, cooked_type);
- if(!H5F_addr_defined(eoa))
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid EOA address for file")
+ /* Get the file's end-of-allocation value */
+ eoa = H5F_get_eoa(f, cooked_type);
+ if (!H5F_addr_defined(eoa))
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid EOA address for file")
- /* Check for bad address in general */
- if(H5F_addr_gt(addr, eoa))
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "address of object past end of allocation")
+ /* Check for bad address in general */
+ if (H5F_addr_gt(addr, eoa))
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "address of object past end of allocation")
- /* Check if the amount of data to read will be past the EOA */
- if(H5F_addr_gt((addr + *len), eoa)) {
- if(actual)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "actual len exceeds EOA")
- else
- /* Trim down the length of the metadata */
- *len = (size_t)(eoa - addr);
- } /* end if */
+ /* Check if the amount of data to read will be past the EOA */
+ if (H5F_addr_gt((addr + *len), eoa)) {
+ if (actual)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "actual len exceeds EOA")
+ else
+ /* Trim down the length of the metadata */
+ *len = (size_t)(eoa - addr);
+ } /* end if */
- if(*len <= 0)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "len not positive after adjustment for EOA")
+ if (*len <= 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "len not positive after adjustment for EOA")
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__verify_len_eoa() */
-
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__verify_len_eoa() */
-/*-------------------------------------------------------------------------
- *
- * Function: H5C__load_entry
- *
- * Purpose: Attempt to load the entry at the specified disk address
- * and with the specified type into memory. If successful.
- * return the in memory address of the entry. Return NULL
- * on failure.
- *
- * Note that this function simply loads the entry into
- * core. It does not insert it into the cache.
- *
- * Return: Non-NULL on success / NULL on failure.
- *
- * Programmer: John Mainzer, 5/18/04
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5C__load_entry(H5F_t * f,
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C__load_entry
+ *
+ * Purpose: Attempt to load the entry at the specified disk address
+ * and with the specified type into memory. If successful.
+ * return the in memory address of the entry. Return NULL
+ * on failure.
+ *
+ * Note that this function simply loads the entry into
+ * core. It does not insert it into the cache.
+ *
+ * Return: Non-NULL on success / NULL on failure.
+ *
+ * Programmer: John Mainzer, 5/18/04
+ *
+ *-------------------------------------------------------------------------
+ */
+ static void *H5C__load_entry(H5F_t * f,
#ifdef H5_HAVE_PARALLEL
- hbool_t coll_access,
+ hbool_t coll_access,
#endif /* H5_HAVE_PARALLEL */
- const H5C_class_t * type,
- haddr_t addr,
- void * udata)
-{
- hbool_t dirty = FALSE; /* Flag indicating whether thing was dirtied during deserialize */
- uint8_t * image = NULL; /* Buffer for disk image */
- void * thing = NULL; /* Pointer to thing loaded */
- H5C_cache_entry_t *entry = NULL; /* Alias for thing loaded, as cache entry */
- size_t len; /* Size of image in file */
+ const H5C_class_t *type, haddr_t addr, void *udata)
+ {
+ hbool_t dirty = FALSE; /* Flag indicating whether thing was dirtied during deserialize */
+ uint8_t * image = NULL; /* Buffer for disk image */
+ void * thing = NULL; /* Pointer to thing loaded */
+ H5C_cache_entry_t *entry = NULL; /* Alias for thing loaded, as cache entry */
+ size_t len; /* Size of image in file */
#ifdef H5_HAVE_PARALLEL
- int mpi_rank = 0; /* MPI process rank */
- MPI_Comm comm = MPI_COMM_NULL; /* File MPI Communicator */
- int mpi_code; /* MPI error code */
-#endif /* H5_HAVE_PARALLEL */
- void * ret_value = NULL; /* Return value */
+ int mpi_rank = 0; /* MPI process rank */
+ MPI_Comm comm = MPI_COMM_NULL; /* File MPI Communicator */
+ int mpi_code; /* MPI error code */
+#endif /* H5_HAVE_PARALLEL */
+ void *ret_value = NULL; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- /* Sanity checks */
- HDassert(f);
- HDassert(f->shared);
- HDassert(f->shared->cache);
- HDassert(type);
- HDassert(H5F_addr_defined(addr));
- HDassert(type->get_initial_load_size);
- if(type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG)
- HDassert(type->get_final_load_size);
- else
- HDassert(NULL == type->get_final_load_size);
- HDassert(type->deserialize);
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(f->shared->cache);
+ HDassert(type);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(type->get_initial_load_size);
+ if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG)
+ HDassert(type->get_final_load_size);
+ else
+ HDassert(NULL == type->get_final_load_size);
+ HDassert(type->deserialize);
- /* Can't see how skip reads could be usefully combined with
- * the speculative read flag. Hence disallow.
- */
- HDassert(!((type->flags & H5C__CLASS_SKIP_READS) &&
- (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG)));
-
- /* Call the get_initial_load_size callback, to retrieve the initial size of image */
- if(type->get_initial_load_size(udata, &len) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't retrieve image size")
- HDassert(len > 0);
-
- /* Check for possible speculative read off the end of the file */
- if(type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG)
- if(H5C__verify_len_eoa(f, type, addr, &len, FALSE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid len with respect to EOA")
-
- /* Allocate the buffer for reading the on-disk entry image */
- if(NULL == (image = (uint8_t *)H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer")
+ /* Can't see how skip reads could be usefully combined with
+ * the speculative read flag. Hence disallow.
+ */
+ HDassert(
+ !((type->flags & H5C__CLASS_SKIP_READS) && (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG)));
+
+ /* Call the get_initial_load_size callback, to retrieve the initial size of image */
+ if (type->get_initial_load_size(udata, &len) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't retrieve image size")
+ HDassert(len > 0);
+
+ /* Check for possible speculative read off the end of the file */
+ if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG)
+ if (H5C__verify_len_eoa(f, type, addr, &len, FALSE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid len with respect to EOA")
+
+ /* Allocate the buffer for reading the on-disk entry image */
+ if (NULL == (image = (uint8_t *)H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
- if((mpi_rank = H5F_mpi_get_rank(f)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank")
- if((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed")
- } /* end if */
-#endif /* H5_HAVE_PARALLEL */
-
- /* Get the on-disk entry image */
- if(0 == (type->flags & H5C__CLASS_SKIP_READS)) {
- unsigned tries, max_tries; /* The # of read attempts */
- unsigned retries; /* The # of retries */
- htri_t chk_ret; /* return from verify_chksum callback */
- size_t actual_len = len; /* The actual length, after speculative reads have been resolved */
- uint64_t nanosec = 1; /* # of nanoseconds to sleep between retries */
- void *new_image; /* Pointer to image */
- hbool_t len_changed = TRUE; /* Whether to re-check speculative entries */
-
- /* Get the # of read attempts */
- max_tries = tries = H5F_GET_READ_ATTEMPTS(f);
-
- /*
- * This do/while loop performs the following till the metadata checksum
- * is correct or the file's number of allowed read attempts are reached.
- * --read the metadata
- * --determine the actual size of the metadata
- * --perform checksum verification
- */
- do {
- if(actual_len != len) {
- if(NULL == (new_image = H5MM_realloc(image, len + H5C_IMAGE_EXTRA_SPACE)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()")
- image = (uint8_t *)new_image;
+ if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
+ if ((mpi_rank = H5F_mpi_get_rank(f)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank")
+ if ((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed")
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
+
+ /* Get the on-disk entry image */
+ if (0 == (type->flags & H5C__CLASS_SKIP_READS)) {
+ unsigned tries, max_tries; /* The # of read attempts */
+ unsigned retries; /* The # of retries */
+ htri_t chk_ret; /* return from verify_chksum callback */
+ size_t actual_len = len; /* The actual length, after speculative reads have been resolved */
+ uint64_t nanosec = 1; /* # of nanoseconds to sleep between retries */
+ void * new_image; /* Pointer to image */
+ hbool_t len_changed = TRUE; /* Whether to re-check speculative entries */
+
+ /* Get the # of read attempts */
+ max_tries = tries = H5F_GET_READ_ATTEMPTS(f);
+
+ /*
+ * This do/while loop performs the following till the metadata checksum
+ * is correct or the file's number of allowed read attempts are reached.
+ * --read the metadata
+ * --determine the actual size of the metadata
+ * --perform checksum verification
+ */
+ do {
+ if (actual_len != len) {
+ if (NULL == (new_image = H5MM_realloc(image, len + H5C_IMAGE_EXTRA_SPACE)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()")
+ image = (uint8_t *)new_image;
#if H5C_DO_MEMORY_SANITY_CHECKS
- H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
-#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
- } /* end if */
+ H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
+ } /* end if */
#ifdef H5_HAVE_PARALLEL
- if(!coll_access || 0 == mpi_rank) {
+ if (!coll_access || 0 == mpi_rank) {
#endif /* H5_HAVE_PARALLEL */
- if(H5F_block_read(f, type->mem_type, addr, len, image) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*")
+ if (H5F_block_read(f, type->mem_type, addr, len, image) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*")
#ifdef H5_HAVE_PARALLEL
- } /* end if */
- /* if the collective metadata read optimization is turned on,
- * bcast the metadata read from process 0 to all ranks in the file
- * communicator
- */
- if(coll_access) {
- int buf_size;
+ } /* end if */
+ /* if the collective metadata read optimization is turned on,
+ * bcast the metadata read from process 0 to all ranks in the file
+ * communicator
+ */
+ if (coll_access) {
+ int buf_size;
- H5_CHECKED_ASSIGN(buf_size, int, len, size_t);
- if(MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm)))
- HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
- } /* end if */
-#endif /* H5_HAVE_PARALLEL */
+ H5_CHECKED_ASSIGN(buf_size, int, len, size_t);
+ if (MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm)))
+ HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
- /* If the entry could be read speculatively and the length is still
- * changing, check for updating the actual size
- */
- if((type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) && len_changed) {
- /* Retrieve the actual length */
- actual_len = len;
- if(type->get_final_load_size(image, len, udata, &actual_len) < 0)
- continue; /* Transfer control to while() and count towards retries */
-
- /* Check for the length changing */
- if(actual_len != len) {
- /* Verify that the length isn't past the EOA for the file */
- if(H5C__verify_len_eoa(f, type, addr, &actual_len, TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "actual_len exceeds EOA")
-
- /* Expand buffer to new size */
- if(NULL == (new_image = H5MM_realloc(image, actual_len + H5C_IMAGE_EXTRA_SPACE)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()")
- image = (uint8_t *)new_image;
+ /* If the entry could be read speculatively and the length is still
+ * changing, check for updating the actual size
+ */
+ if ((type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) && len_changed) {
+ /* Retrieve the actual length */
+ actual_len = len;
+ if (type->get_final_load_size(image, len, udata, &actual_len) < 0)
+ continue; /* Transfer control to while() and count towards retries */
+
+ /* Check for the length changing */
+ if (actual_len != len) {
+ /* Verify that the length isn't past the EOA for the file */
+ if (H5C__verify_len_eoa(f, type, addr, &actual_len, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "actual_len exceeds EOA")
+
+ /* Expand buffer to new size */
+ if (NULL == (new_image = H5MM_realloc(image, actual_len + H5C_IMAGE_EXTRA_SPACE)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()")
+ image = (uint8_t *)new_image;
#if H5C_DO_MEMORY_SANITY_CHECKS
- H5MM_memcpy(image + actual_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(image + actual_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
- if(actual_len > len) {
+ if (actual_len > len) {
#ifdef H5_HAVE_PARALLEL
- if(!coll_access || 0 == mpi_rank) {
+ if (!coll_access || 0 == mpi_rank) {
#endif /* H5_HAVE_PARALLEL */
- /* If the thing's image needs to be bigger for a speculatively
- * loaded thing, go get the on-disk image again (the extra portion).
- */
- if(H5F_block_read(f, type->mem_type, addr + len, actual_len - len, image + len) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't read image")
+ /* If the thing's image needs to be bigger for a speculatively
+ * loaded thing, go get the on-disk image again (the extra portion).
+ */
+ if (H5F_block_read(f, type->mem_type, addr + len, actual_len - len,
+ image + len) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't read image")
#ifdef H5_HAVE_PARALLEL
- }
- /* If the collective metadata read optimization is turned on,
- * Bcast the metadata read from process 0 to all ranks in the file
- * communicator */
- if(coll_access) {
- int buf_size;
-
- H5_CHECKED_ASSIGN(buf_size, int, actual_len - len, size_t);
- if(MPI_SUCCESS != (mpi_code = MPI_Bcast(image + len, buf_size, MPI_BYTE, 0, comm)))
- HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
- } /* end if */
-#endif /* H5_HAVE_PARALLEL */
- } /* end if */
- } /* end if (actual_len != len) */
- else {
- /* The length has stabilized */
- len_changed = FALSE;
+ }
+ /* If the collective metadata read optimization is turned on,
+ * Bcast the metadata read from process 0 to all ranks in the file
+ * communicator */
+ if (coll_access) {
+ int buf_size;
+
+ H5_CHECKED_ASSIGN(buf_size, int, actual_len - len, size_t);
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Bcast(image + len, buf_size, MPI_BYTE, 0, comm)))
+ HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
+ } /* end if */
+ } /* end if (actual_len != len) */
+ else {
+ /* The length has stabilized */
+ len_changed = FALSE;
- /* Set the final length */
- len = actual_len;
- } /* else */
- } /* end if */
+ /* Set the final length */
+ len = actual_len;
+ } /* else */
+ } /* end if */
- /* If there's no way to verify the checksum for a piece of metadata
- * (usually because there's no checksum in the file), leave now
- */
- if(type->verify_chksum == NULL)
- break;
+ /* If there's no way to verify the checksum for a piece of metadata
+ * (usually because there's no checksum in the file), leave now
+ */
+ if (type->verify_chksum == NULL)
+ break;
- /* Verify the checksum for the metadata image */
- if((chk_ret = type->verify_chksum(image, actual_len, udata)) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "failure from verify_chksum callback")
- if(chk_ret == TRUE)
- break;
+ /* Verify the checksum for the metadata image */
+ if ((chk_ret = type->verify_chksum(image, actual_len, udata)) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "failure from verify_chksum callback")
+ if (chk_ret == TRUE)
+ break;
- /* Sleep for some time */
- H5_nanosleep(nanosec);
- nanosec *= 2; /* Double the sleep time next time */
- } while(--tries);
+ /* Sleep for some time */
+ H5_nanosleep(nanosec);
+ nanosec *= 2; /* Double the sleep time next time */
+ } while (--tries);
- /* Check for too many tries */
- if(tries == 0)
- HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "incorrect metadatda checksum after all read attempts")
+ /* Check for too many tries */
+ if (tries == 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL,
+ "incorrect metadatda checksum after all read attempts")
- /* Calculate and track the # of retries */
- retries = max_tries - tries;
- if(retries) /* Does not track 0 retry */
- if(H5F_track_metadata_read_retries(f, (unsigned)type->mem_type, retries) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "cannot track read tries = %u ", retries)
+ /* Calculate and track the # of retries */
+ retries = max_tries - tries;
+ if (retries) /* Does not track 0 retry */
+ if (H5F_track_metadata_read_retries(f, (unsigned)type->mem_type, retries) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "cannot track read tries = %u ", retries)
- /* Set the final length (in case it wasn't set earlier) */
- len = actual_len;
- } /* end if !H5C__CLASS_SKIP_READS */
+ /* Set the final length (in case it wasn't set earlier) */
+ len = actual_len;
+ } /* end if !H5C__CLASS_SKIP_READS */
- /* Deserialize the on-disk image into the native memory form */
- if(NULL == (thing = type->deserialize(image, len, udata, &dirty)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't deserialize image")
+ /* Deserialize the on-disk image into the native memory form */
+ if (NULL == (thing = type->deserialize(image, len, udata, &dirty)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't deserialize image")
- entry = (H5C_cache_entry_t *)thing;
+ entry = (H5C_cache_entry_t *)thing;
- /* In general, an entry should be clean just after it is loaded.
- *
- * However, when this code is used in the metadata cache, it is
- * possible that object headers will be dirty at this point, as
- * the deserialize function will alter object headers if necessary to
- * fix an old bug.
- *
- * In the following assert:
- *
- * HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6 ) );
- *
- * note that type ids 5 & 6 are associated with object headers in the
- * metadata cache.
- *
- * When we get to using H5C for other purposes, we may wish to
- * tighten up the assert so that the loophole only applies to the
- * metadata cache.
- */
+ /* In general, an entry should be clean just after it is loaded.
+ *
+ * However, when this code is used in the metadata cache, it is
+ * possible that object headers will be dirty at this point, as
+ * the deserialize function will alter object headers if necessary to
+ * fix an old bug.
+ *
+ * In the following assert:
+ *
+ * HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6 ) );
+ *
+ * note that type ids 5 & 6 are associated with object headers in the
+ * metadata cache.
+ *
+ * When we get to using H5C for other purposes, we may wish to
+ * tighten up the assert so that the loophole only applies to the
+ * metadata cache.
+ */
- HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6) );
-
- entry->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
- entry->cache_ptr = f->shared->cache;
- entry->addr = addr;
- entry->size = len;
- HDassert(entry->size < H5C_MAX_ENTRY_SIZE);
- entry->image_ptr = image;
- entry->image_up_to_date = !dirty;
- entry->type = type;
- entry->is_dirty = dirty;
- entry->dirtied = FALSE;
- entry->is_protected = FALSE;
- entry->is_read_only = FALSE;
- entry->ro_ref_count = 0;
- entry->is_pinned = FALSE;
- entry->in_slist = FALSE;
- entry->flush_marker = FALSE;
+ HDassert((dirty == FALSE) || (type->id == 5 || type->id == 6));
+
+ entry->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
+ entry->cache_ptr = f->shared->cache;
+ entry->addr = addr;
+ entry->size = len;
+ HDassert(entry->size < H5C_MAX_ENTRY_SIZE);
+ entry->image_ptr = image;
+ entry->image_up_to_date = !dirty;
+ entry->type = type;
+ entry->is_dirty = dirty;
+ entry->dirtied = FALSE;
+ entry->is_protected = FALSE;
+ entry->is_read_only = FALSE;
+ entry->ro_ref_count = 0;
+ entry->is_pinned = FALSE;
+ entry->in_slist = FALSE;
+ entry->flush_marker = FALSE;
#ifdef H5_HAVE_PARALLEL
- entry->clear_on_unprotect = FALSE;
- entry->flush_immediately = FALSE;
- entry->coll_access = coll_access;
+ entry->clear_on_unprotect = FALSE;
+ entry->flush_immediately = FALSE;
+ entry->coll_access = coll_access;
#endif /* H5_HAVE_PARALLEL */
- entry->flush_in_progress = FALSE;
- entry->destroy_in_progress = FALSE;
-
- entry->ring = H5C_RING_UNDEFINED;
-
- /* Initialize flush dependency fields */
- entry->flush_dep_parent = NULL;
- entry->flush_dep_nparents = 0;
- entry->flush_dep_parent_nalloc = 0;
- entry->flush_dep_nchildren = 0;
- entry->flush_dep_ndirty_children = 0;
- entry->flush_dep_nunser_children = 0;
- entry->ht_next = NULL;
- entry->ht_prev = NULL;
- entry->il_next = NULL;
- entry->il_prev = NULL;
-
- entry->next = NULL;
- entry->prev = NULL;
+ entry->flush_in_progress = FALSE;
+ entry->destroy_in_progress = FALSE;
+
+ entry->ring = H5C_RING_UNDEFINED;
+
+ /* Initialize flush dependency fields */
+ entry->flush_dep_parent = NULL;
+ entry->flush_dep_nparents = 0;
+ entry->flush_dep_parent_nalloc = 0;
+ entry->flush_dep_nchildren = 0;
+ entry->flush_dep_ndirty_children = 0;
+ entry->flush_dep_nunser_children = 0;
+ entry->ht_next = NULL;
+ entry->ht_prev = NULL;
+ entry->il_next = NULL;
+ entry->il_prev = NULL;
+
+ entry->next = NULL;
+ entry->prev = NULL;
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
- entry->aux_next = NULL;
- entry->aux_prev = NULL;
+ entry->aux_next = NULL;
+ entry->aux_prev = NULL;
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
#ifdef H5_HAVE_PARALLEL
- entry->coll_next = NULL;
- entry->coll_prev = NULL;
+ entry->coll_next = NULL;
+ entry->coll_prev = NULL;
#endif /* H5_HAVE_PARALLEL */
- /* initialize cache image related fields */
- entry->include_in_image = FALSE;
- entry->lru_rank = 0;
- entry->image_dirty = FALSE;
- entry->fd_parent_count = 0;
- entry->fd_parent_addrs = NULL;
- entry->fd_child_count = 0;
- entry->fd_dirty_child_count = 0;
- entry->image_fd_height = 0;
- entry->prefetched = FALSE;
- entry->prefetch_type_id = 0;
- entry->age = 0;
- entry->prefetched_dirty = FALSE;
-#ifndef NDEBUG /* debugging field */
- entry->serialization_count = 0;
+ /* initialize cache image related fields */
+ entry->include_in_image = FALSE;
+ entry->lru_rank = 0;
+ entry->image_dirty = FALSE;
+ entry->fd_parent_count = 0;
+ entry->fd_parent_addrs = NULL;
+ entry->fd_child_count = 0;
+ entry->fd_dirty_child_count = 0;
+ entry->image_fd_height = 0;
+ entry->prefetched = FALSE;
+ entry->prefetch_type_id = 0;
+ entry->age = 0;
+ entry->prefetched_dirty = FALSE;
+#ifndef NDEBUG /* debugging field */
+ entry->serialization_count = 0;
#endif /* NDEBUG */
- entry->tl_next = NULL;
- entry->tl_prev = NULL;
- entry->tag_info = NULL;
+ entry->tl_next = NULL;
+ entry->tl_prev = NULL;
+ entry->tag_info = NULL;
- H5C__RESET_CACHE_ENTRY_STATS(entry);
+ H5C__RESET_CACHE_ENTRY_STATS(entry);
- ret_value = thing;
+ ret_value = thing;
done:
- /* Cleanup on error */
- if(NULL == ret_value) {
- /* Release resources */
- if(thing && type->free_icr(thing) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "free_icr callback failed")
- if(image)
- image = (uint8_t *)H5MM_xfree(image);
- } /* end if */
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__load_entry() */
+ /* Cleanup on error */
+ if (NULL == ret_value) {
+ /* Release resources */
+ if (thing && type->free_icr(thing) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "free_icr callback failed")
+ if (image)
+ image = (uint8_t *)H5MM_xfree(image);
+ } /* end if */
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__load_entry() */
-/*-------------------------------------------------------------------------
- *
- * Function: H5C__make_space_in_cache
- *
- * Purpose: Attempt to evict cache entries until the index_size
- * is at least needed_space below max_cache_size.
- *
- * In passing, also attempt to bring cLRU_list_size to a
- * value greater than min_clean_size.
- *
- * Depending on circumstances, both of these goals may
- * be impossible, as in parallel mode, we must avoid generating
- * a write as part of a read (to avoid deadlock in collective
- * I/O), and in all cases, it is possible (though hopefully
- * highly unlikely) that the protected list may exceed the
- * maximum size of the cache.
- *
- * Thus the function simply does its best, returning success
- * unless an error is encountered.
- *
- * Observe that this function cannot occasion a read.
- *
- * Return: Non-negative on success/Negative on failure.
- *
- * Programmer: John Mainzer, 5/14/04
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5C__make_space_in_cache(H5F_t *f, size_t space_needed, hbool_t write_permitted)
-{
- H5C_t * cache_ptr = f->shared->cache;
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C__make_space_in_cache
+ *
+ * Purpose: Attempt to evict cache entries until the index_size
+ * is at least needed_space below max_cache_size.
+ *
+ * In passing, also attempt to bring cLRU_list_size to a
+ * value greater than min_clean_size.
+ *
+ * Depending on circumstances, both of these goals may
+ * be impossible, as in parallel mode, we must avoid generating
+ * a write as part of a read (to avoid deadlock in collective
+ * I/O), and in all cases, it is possible (though hopefully
+ * highly unlikely) that the protected list may exceed the
+ * maximum size of the cache.
+ *
+ * Thus the function simply does its best, returning success
+ * unless an error is encountered.
+ *
+ * Observe that this function cannot occasion a read.
+ *
+ * Return: Non-negative on success/Negative on failure.
+ *
+ * Programmer: John Mainzer, 5/14/04
+ *
+ *-------------------------------------------------------------------------
+ */
+ herr_t H5C__make_space_in_cache(H5F_t * f, size_t space_needed, hbool_t write_permitted)
+ {
+ H5C_t *cache_ptr = f->shared->cache;
#if H5C_COLLECT_CACHE_STATS
- int32_t clean_entries_skipped = 0;
- int32_t dirty_pf_entries_skipped = 0;
- int32_t total_entries_scanned = 0;
+ int32_t clean_entries_skipped = 0;
+ int32_t dirty_pf_entries_skipped = 0;
+ int32_t total_entries_scanned = 0;
#endif /* H5C_COLLECT_CACHE_STATS */
- uint32_t entries_examined = 0;
- uint32_t initial_list_len;
- size_t empty_space;
- hbool_t reentrant_call = FALSE;
- hbool_t prev_is_dirty = FALSE;
- hbool_t didnt_flush_entry = FALSE;
- hbool_t restart_scan;
- H5C_cache_entry_t * entry_ptr;
- H5C_cache_entry_t * prev_ptr;
- H5C_cache_entry_t * next_ptr;
- uint32_t num_corked_entries = 0;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
+ uint32_t entries_examined = 0;
+ uint32_t initial_list_len;
+ size_t empty_space;
+ hbool_t reentrant_call = FALSE;
+ hbool_t prev_is_dirty = FALSE;
+ hbool_t didnt_flush_entry = FALSE;
+ hbool_t restart_scan;
+ H5C_cache_entry_t *entry_ptr;
+ H5C_cache_entry_t *prev_ptr;
+ H5C_cache_entry_t *next_ptr;
+ uint32_t num_corked_entries = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Sanity checks */
- HDassert(f);
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_ptr->index_size == (cache_ptr->clean_index_size + cache_ptr->dirty_index_size));
+ FUNC_ENTER_PACKAGE
- /* check to see if cache_ptr->msic_in_progress is TRUE. If it, this
- * is a re-entrant call via a client callback called in the make
- * space in cache process. To avoid an infinite recursion, set
- * reentrant_call to TRUE, and goto done.
- */
- if(cache_ptr->msic_in_progress) {
- reentrant_call = TRUE;
- HGOTO_DONE(SUCCEED);
- } /* end if */
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr->index_size == (cache_ptr->clean_index_size + cache_ptr->dirty_index_size));
+
+ /* check to see if cache_ptr->msic_in_progress is TRUE. If it, this
+ * is a re-entrant call via a client callback called in the make
+ * space in cache process. To avoid an infinite recursion, set
+ * reentrant_call to TRUE, and goto done.
+ */
+ if (cache_ptr->msic_in_progress) {
+ reentrant_call = TRUE;
+ HGOTO_DONE(SUCCEED);
+ } /* end if */
- cache_ptr->msic_in_progress = TRUE;
+ cache_ptr->msic_in_progress = TRUE;
- if ( write_permitted ) {
- restart_scan = FALSE;
- initial_list_len = cache_ptr->LRU_list_len;
- entry_ptr = cache_ptr->LRU_tail_ptr;
+ if (write_permitted) {
+ restart_scan = FALSE;
+ initial_list_len = cache_ptr->LRU_list_len;
+ entry_ptr = cache_ptr->LRU_tail_ptr;
- if(cache_ptr->index_size >= cache_ptr->max_cache_size)
- empty_space = 0;
- else
- empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
-
- while ( ( ( (cache_ptr->index_size + space_needed)
- >
- cache_ptr->max_cache_size
- )
- ||
- (
- ( empty_space + cache_ptr->clean_index_size )
- <
- ( cache_ptr->min_clean_size )
- )
- )
- &&
- ( entries_examined <= (2 * initial_list_len) )
- &&
- ( entry_ptr != NULL )
- )
- {
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert( !(entry_ptr->is_protected) );
- HDassert( ! (entry_ptr->is_read_only) );
- HDassert( (entry_ptr->ro_ref_count) == 0 );
+ if (cache_ptr->index_size >= cache_ptr->max_cache_size)
+ empty_space = 0;
+ else
+ empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
- next_ptr = entry_ptr->next;
- prev_ptr = entry_ptr->prev;
+ while ((((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) ||
+ ((empty_space + cache_ptr->clean_index_size) < (cache_ptr->min_clean_size))) &&
+ (entries_examined <= (2 * initial_list_len)) && (entry_ptr != NULL)) {
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(!(entry_ptr->is_protected));
+ HDassert(!(entry_ptr->is_read_only));
+ HDassert((entry_ptr->ro_ref_count) == 0);
- if(prev_ptr != NULL)
- prev_is_dirty = prev_ptr->is_dirty;
+ next_ptr = entry_ptr->next;
+ prev_ptr = entry_ptr->prev;
- if(entry_ptr->is_dirty &&
- (entry_ptr->tag_info && entry_ptr->tag_info->corked)) {
+ if (prev_ptr != NULL)
+ prev_is_dirty = prev_ptr->is_dirty;
- /* Skip "dirty" corked entries. */
- ++num_corked_entries;
- didnt_flush_entry = TRUE;
+ if (entry_ptr->is_dirty && (entry_ptr->tag_info && entry_ptr->tag_info->corked)) {
- } else if ( ( (entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID ) &&
- ( ! entry_ptr->flush_in_progress ) &&
- ( ! entry_ptr->prefetched_dirty ) ) {
+ /* Skip "dirty" corked entries. */
+ ++num_corked_entries;
+ didnt_flush_entry = TRUE;
+ }
+ else if (((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) && (!entry_ptr->flush_in_progress) &&
+ (!entry_ptr->prefetched_dirty)) {
- didnt_flush_entry = FALSE;
+ didnt_flush_entry = FALSE;
- if ( entry_ptr->is_dirty ) {
+ if (entry_ptr->is_dirty) {
#if H5C_COLLECT_CACHE_STATS
- if ( (cache_ptr->index_size + space_needed)
- >
- cache_ptr->max_cache_size ) {
+ if ((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) {
- cache_ptr->entries_scanned_to_make_space++;
- }
+ cache_ptr->entries_scanned_to_make_space++;
+ }
#endif /* H5C_COLLECT_CACHE_STATS */
- /* reset entries_removed_counter and
- * last_entry_removed_ptr prior to the call to
- * H5C__flush_single_entry() so that we can spot
- * unexpected removals of entries from the cache,
- * and set the restart_scan flag if proceeding
- * would be likely to cause us to scan an entry
- * that is no longer in the cache.
- */
- cache_ptr->entries_removed_counter = 0;
- cache_ptr->last_entry_removed_ptr = NULL;
-
- if(H5C__flush_single_entry(f, entry_ptr, H5C__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
+ /* reset entries_removed_counter and
+ * last_entry_removed_ptr prior to the call to
+ * H5C__flush_single_entry() so that we can spot
+ * unexpected removals of entries from the cache,
+ * and set the restart_scan flag if proceeding
+ * would be likely to cause us to scan an entry
+ * that is no longer in the cache.
+ */
+ cache_ptr->entries_removed_counter = 0;
+ cache_ptr->last_entry_removed_ptr = NULL;
- if ( ( cache_ptr->entries_removed_counter > 1 ) ||
- ( cache_ptr->last_entry_removed_ptr == prev_ptr ) )
+ if (H5C__flush_single_entry(f, entry_ptr, H5C__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
- restart_scan = TRUE;
+ if ((cache_ptr->entries_removed_counter > 1) ||
+ (cache_ptr->last_entry_removed_ptr == prev_ptr))
- } else if ( (cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size
+ restart_scan = TRUE;
+ }
+ else if ((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size
#ifdef H5_HAVE_PARALLEL
- && !(entry_ptr->coll_access)
+ && !(entry_ptr->coll_access)
#endif /* H5_HAVE_PARALLEL */
- ) {
+ ) {
#if H5C_COLLECT_CACHE_STATS
- cache_ptr->entries_scanned_to_make_space++;
+ cache_ptr->entries_scanned_to_make_space++;
#endif /* H5C_COLLECT_CACHE_STATS */
- if(H5C__flush_single_entry(f, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
- } else {
- /* We have enough space so don't flush clean entry. */
+ if (H5C__flush_single_entry(f, entry_ptr,
+ H5C__FLUSH_INVALIDATE_FLAG |
+ H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
+ }
+ else {
+ /* We have enough space so don't flush clean entry. */
#if H5C_COLLECT_CACHE_STATS
- clean_entries_skipped++;
+ clean_entries_skipped++;
#endif /* H5C_COLLECT_CACHE_STATS */
- didnt_flush_entry = TRUE;
- }
+ didnt_flush_entry = TRUE;
+ }
#if H5C_COLLECT_CACHE_STATS
- total_entries_scanned++;
+ total_entries_scanned++;
#endif /* H5C_COLLECT_CACHE_STATS */
+ }
+ else {
- } else {
-
- /* Skip epoch markers, entries that are in the process
- * of being flushed, and entries marked as prefetched_dirty
- * (occurs in the R/O case only).
- */
- didnt_flush_entry = TRUE;
+ /* Skip epoch markers, entries that are in the process
+ * of being flushed, and entries marked as prefetched_dirty
+ * (occurs in the R/O case only).
+ */
+ didnt_flush_entry = TRUE;
#if H5C_COLLECT_CACHE_STATS
- if(entry_ptr->prefetched_dirty)
- dirty_pf_entries_skipped++;
+ if (entry_ptr->prefetched_dirty)
+ dirty_pf_entries_skipped++;
#endif /* H5C_COLLECT_CACHE_STATS */
- }
-
- if ( prev_ptr != NULL ) {
-
- if ( didnt_flush_entry ) {
-
- /* epoch markers don't get flushed, and we don't touch
- * entries that are in the process of being flushed.
- * Hence no need for sanity checks, as we haven't
- * flushed anything. Thus just set entry_ptr to prev_ptr
- * and go on.
- */
- entry_ptr = prev_ptr;
-
- } else if ( ( restart_scan )
- ||
- ( prev_ptr->is_dirty != prev_is_dirty )
- ||
- ( prev_ptr->next != next_ptr )
- ||
- ( prev_ptr->is_protected )
- ||
- ( prev_ptr->is_pinned ) ) {
-
- /* something has happened to the LRU -- start over
- * from the tail.
- */
- restart_scan = FALSE;
- entry_ptr = cache_ptr->LRU_tail_ptr;
- H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr)
-
- } else {
+ }
- entry_ptr = prev_ptr;
+ if (prev_ptr != NULL) {
- }
- } else {
+ if (didnt_flush_entry) {
- entry_ptr = NULL;
+ /* epoch markers don't get flushed, and we don't touch
+ * entries that are in the process of being flushed.
+ * Hence no need for sanity checks, as we haven't
+ * flushed anything. Thus just set entry_ptr to prev_ptr
+ * and go on.
+ */
+ entry_ptr = prev_ptr;
+ }
+ else if ((restart_scan) || (prev_ptr->is_dirty != prev_is_dirty) ||
+ (prev_ptr->next != next_ptr) || (prev_ptr->is_protected) ||
+ (prev_ptr->is_pinned)) {
- }
+ /* something has happened to the LRU -- start over
+ * from the tail.
+ */
+ restart_scan = FALSE;
+ entry_ptr = cache_ptr->LRU_tail_ptr;
+ H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr)
+ }
+ else {
- entries_examined++;
+ entry_ptr = prev_ptr;
+ }
+ }
+ else {
- if ( cache_ptr->index_size >= cache_ptr->max_cache_size ) {
+ entry_ptr = NULL;
+ }
- empty_space = 0;
+ entries_examined++;
- } else {
+ if (cache_ptr->index_size >= cache_ptr->max_cache_size) {
- empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
-
- }
+ empty_space = 0;
+ }
+ else {
- HDassert( cache_ptr->index_size ==
- (cache_ptr->clean_index_size +
- cache_ptr->dirty_index_size) );
+ empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
+ }
- }
+ HDassert(cache_ptr->index_size ==
+ (cache_ptr->clean_index_size + cache_ptr->dirty_index_size));
+ }
#if H5C_COLLECT_CACHE_STATS
- cache_ptr->calls_to_msic++;
+ cache_ptr->calls_to_msic++;
- cache_ptr->total_entries_skipped_in_msic += clean_entries_skipped;
- cache_ptr->total_dirty_pf_entries_skipped_in_msic += dirty_pf_entries_skipped;
- cache_ptr->total_entries_scanned_in_msic += total_entries_scanned;
+ cache_ptr->total_entries_skipped_in_msic += clean_entries_skipped;
+ cache_ptr->total_dirty_pf_entries_skipped_in_msic += dirty_pf_entries_skipped;
+ cache_ptr->total_entries_scanned_in_msic += total_entries_scanned;
- if ( clean_entries_skipped > cache_ptr->max_entries_skipped_in_msic ) {
+ if (clean_entries_skipped > cache_ptr->max_entries_skipped_in_msic) {
- cache_ptr->max_entries_skipped_in_msic = clean_entries_skipped;
- }
+ cache_ptr->max_entries_skipped_in_msic = clean_entries_skipped;
+ }
- if(dirty_pf_entries_skipped > cache_ptr->max_dirty_pf_entries_skipped_in_msic)
- cache_ptr->max_dirty_pf_entries_skipped_in_msic = dirty_pf_entries_skipped;
+ if (dirty_pf_entries_skipped > cache_ptr->max_dirty_pf_entries_skipped_in_msic)
+ cache_ptr->max_dirty_pf_entries_skipped_in_msic = dirty_pf_entries_skipped;
- if ( total_entries_scanned > cache_ptr->max_entries_scanned_in_msic ) {
+ if (total_entries_scanned > cache_ptr->max_entries_scanned_in_msic) {
- cache_ptr->max_entries_scanned_in_msic = total_entries_scanned;
- }
+ cache_ptr->max_entries_scanned_in_msic = total_entries_scanned;
+ }
#endif /* H5C_COLLECT_CACHE_STATS */
-
- /* NEED: work on a better assert for corked entries */
- HDassert( ( entries_examined > (2 * initial_list_len) ) ||
- ( (cache_ptr->pl_size + cache_ptr->pel_size + cache_ptr->min_clean_size) >
- cache_ptr->max_cache_size ) ||
- ( ( cache_ptr->clean_index_size + empty_space )
- >= cache_ptr->min_clean_size ) ||
- ( ( num_corked_entries )));
+ /* NEED: work on a better assert for corked entries */
+ HDassert((entries_examined > (2 * initial_list_len)) ||
+ ((cache_ptr->pl_size + cache_ptr->pel_size + cache_ptr->min_clean_size) >
+ cache_ptr->max_cache_size) ||
+ ((cache_ptr->clean_index_size + empty_space) >= cache_ptr->min_clean_size) ||
+ ((num_corked_entries)));
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
- HDassert( ( entries_examined > (2 * initial_list_len) ) ||
- ( cache_ptr->cLRU_list_size <= cache_ptr->clean_index_size ) );
- HDassert( ( entries_examined > (2 * initial_list_len) ) ||
- ( cache_ptr->dLRU_list_size <= cache_ptr->dirty_index_size ) );
+ HDassert((entries_examined > (2 * initial_list_len)) ||
+ (cache_ptr->cLRU_list_size <= cache_ptr->clean_index_size));
+ HDassert((entries_examined > (2 * initial_list_len)) ||
+ (cache_ptr->dLRU_list_size <= cache_ptr->dirty_index_size));
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
+ }
+ else {
- } else {
-
- HDassert( H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS );
+ HDassert(H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS);
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
- initial_list_len = cache_ptr->cLRU_list_len;
- entry_ptr = cache_ptr->cLRU_tail_ptr;
-
- while ( ( (cache_ptr->index_size + space_needed)
- >
- cache_ptr->max_cache_size
- )
- &&
- ( entries_examined <= initial_list_len )
- &&
- ( entry_ptr != NULL )
- )
- {
- HDassert( ! (entry_ptr->is_protected) );
- HDassert( ! (entry_ptr->is_read_only) );
- HDassert( (entry_ptr->ro_ref_count) == 0 );
- HDassert( ! (entry_ptr->is_dirty) );
+ initial_list_len = cache_ptr->cLRU_list_len;
+ entry_ptr = cache_ptr->cLRU_tail_ptr;
+
+ while (((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) &&
+ (entries_examined <= initial_list_len) && (entry_ptr != NULL)) {
+ HDassert(!(entry_ptr->is_protected));
+ HDassert(!(entry_ptr->is_read_only));
+ HDassert((entry_ptr->ro_ref_count) == 0);
+ HDassert(!(entry_ptr->is_dirty));
- prev_ptr = entry_ptr->aux_prev;
+ prev_ptr = entry_ptr->aux_prev;
- if ( ( !(entry_ptr->prefetched_dirty) )
+ if ((!(entry_ptr->prefetched_dirty))
#ifdef H5_HAVE_PARALLEL
- && ( ! (entry_ptr->coll_access) )
+ && (!(entry_ptr->coll_access))
#endif /* H5_HAVE_PARALLEL */
- ) {
- if(H5C__flush_single_entry(f, entry_ptr,
- H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
+ ) {
+ if (H5C__flush_single_entry(f, entry_ptr,
+ H5C__FLUSH_INVALIDATE_FLAG |
+ H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
- } /* end if */
+ } /* end if */
- /* we are scanning the clean LRU, so the serialize function
- * will not be called on any entry -- thus there is no
- * concern about the list being modified out from under
- * this function.
- */
+ /* we are scanning the clean LRU, so the serialize function
+ * will not be called on any entry -- thus there is no
+ * concern about the list being modified out from under
+ * this function.
+ */
- entry_ptr = prev_ptr;
- entries_examined++;
- }
+ entry_ptr = prev_ptr;
+ entries_examined++;
+ }
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
- }
+ }
done:
- /* Sanity checks */
- HDassert(cache_ptr->msic_in_progress);
- if(!reentrant_call)
- cache_ptr->msic_in_progress = FALSE;
- HDassert((!reentrant_call) || (cache_ptr->msic_in_progress));
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__make_space_in_cache() */
+ /* Sanity checks */
+ HDassert(cache_ptr->msic_in_progress);
+ if (!reentrant_call)
+ cache_ptr->msic_in_progress = FALSE;
+ HDassert((!reentrant_call) || (cache_ptr->msic_in_progress));
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__make_space_in_cache() */
/*-------------------------------------------------------------------------
*
@@ -8141,67 +7756,64 @@ done:
*-------------------------------------------------------------------------
*/
#if H5C_DO_EXTREME_SANITY_CHECKS
-static herr_t
-H5C__validate_lru_list(H5C_t * cache_ptr)
-{
- int32_t len = 0;
- size_t size = 0;
- H5C_cache_entry_t * entry_ptr = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ static herr_t H5C__validate_lru_list(H5C_t * cache_ptr)
+ {
+ int32_t len = 0;
+ size_t size = 0;
+ H5C_cache_entry_t *entry_ptr = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- if(((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_tail_ptr == NULL))
- && (cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
+ if (((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_tail_ptr == NULL)) &&
+ (cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
- if(cache_ptr->LRU_list_len < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
+ if (cache_ptr->LRU_list_len < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
- if((cache_ptr->LRU_list_len == 1) &&
- ((cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr) ||
- (cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_head_ptr->size != cache_ptr->LRU_list_size)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed")
+ if ((cache_ptr->LRU_list_len == 1) &&
+ ((cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr) || (cache_ptr->LRU_head_ptr == NULL) ||
+ (cache_ptr->LRU_head_ptr->size != cache_ptr->LRU_list_size)))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed")
- if((cache_ptr->LRU_list_len >= 1) &&
- ((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_head_ptr->prev != NULL)
- || (cache_ptr->LRU_tail_ptr == NULL) || (cache_ptr->LRU_tail_ptr->next != NULL)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed")
+ if ((cache_ptr->LRU_list_len >= 1) &&
+ ((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_head_ptr->prev != NULL) ||
+ (cache_ptr->LRU_tail_ptr == NULL) || (cache_ptr->LRU_tail_ptr->next != NULL)))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed")
- entry_ptr = cache_ptr->LRU_head_ptr;
- while(entry_ptr != NULL) {
- if((entry_ptr != cache_ptr->LRU_head_ptr) &&
- ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
+ entry_ptr = cache_ptr->LRU_head_ptr;
+ while (entry_ptr != NULL) {
+ if ((entry_ptr != cache_ptr->LRU_head_ptr) &&
+ ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr)))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
- if((entry_ptr != cache_ptr->LRU_tail_ptr) &&
- ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed")
+ if ((entry_ptr != cache_ptr->LRU_tail_ptr) &&
+ ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr)))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed")
- if((entry_ptr->is_pinned) ||
- (entry_ptr->pinned_from_client) || (entry_ptr->pinned_from_cache))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed")
+ if ((entry_ptr->is_pinned) || (entry_ptr->pinned_from_client) || (entry_ptr->pinned_from_cache))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed")
- len++;
- size += entry_ptr->size;
- entry_ptr = entry_ptr->next;
- }
+ len++;
+ size += entry_ptr->size;
+ entry_ptr = entry_ptr->next;
+ }
- if((cache_ptr->LRU_list_len != len) || (cache_ptr->LRU_list_size != size))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
+ if ((cache_ptr->LRU_list_len != len) || (cache_ptr->LRU_list_size != size))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
done:
- if(ret_value != SUCCEED)
- HDassert(0);
+ if (ret_value != SUCCEED)
+ HDassert(0);
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__validate_lru_list() */
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__validate_lru_list() */
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
-
/*-------------------------------------------------------------------------
*
* Function: H5C__validate_pinned_entry_list
@@ -8220,72 +7832,67 @@ done:
*-------------------------------------------------------------------------
*/
#if H5C_DO_EXTREME_SANITY_CHECKS
-static herr_t
-H5C__validate_pinned_entry_list(H5C_t * cache_ptr)
-{
- int32_t len = 0;
- size_t size = 0;
- H5C_cache_entry_t * entry_ptr = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ static herr_t H5C__validate_pinned_entry_list(H5C_t * cache_ptr)
+ {
+ int32_t len = 0;
+ size_t size = 0;
+ H5C_cache_entry_t *entry_ptr = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- if(((cache_ptr->pel_head_ptr == NULL) || (cache_ptr->pel_tail_ptr == NULL))
- && (cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
-
- if(cache_ptr->pel_len < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
-
- if((cache_ptr->pel_len == 1) &&
- ((cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr) ||
- (cache_ptr->pel_head_ptr == NULL) ||
- (cache_ptr->pel_head_ptr->size != cache_ptr->pel_size)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed")
-
- if((cache_ptr->pel_len >= 1) &&
- ((cache_ptr->pel_head_ptr == NULL) ||
- (cache_ptr->pel_head_ptr->prev != NULL) ||
- (cache_ptr->pel_tail_ptr == NULL) ||
- (cache_ptr->pel_tail_ptr->next != NULL)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed")
-
- entry_ptr = cache_ptr->pel_head_ptr;
- while(entry_ptr != NULL) {
- if((entry_ptr != cache_ptr->pel_head_ptr) &&
+ if (((cache_ptr->pel_head_ptr == NULL) || (cache_ptr->pel_tail_ptr == NULL)) &&
+ (cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
+
+ if (cache_ptr->pel_len < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
+
+ if ((cache_ptr->pel_len == 1) &&
+ ((cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr) || (cache_ptr->pel_head_ptr == NULL) ||
+ (cache_ptr->pel_head_ptr->size != cache_ptr->pel_size)))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed")
+
+ if ((cache_ptr->pel_len >= 1) &&
+ ((cache_ptr->pel_head_ptr == NULL) || (cache_ptr->pel_head_ptr->prev != NULL) ||
+ (cache_ptr->pel_tail_ptr == NULL) || (cache_ptr->pel_tail_ptr->next != NULL)))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed")
+
+ entry_ptr = cache_ptr->pel_head_ptr;
+ while (entry_ptr != NULL) {
+ if ((entry_ptr != cache_ptr->pel_head_ptr) &&
((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
- if((entry_ptr != cache_ptr->pel_tail_ptr) &&
+ if ((entry_ptr != cache_ptr->pel_tail_ptr) &&
((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed")
- if(!entry_ptr->is_pinned)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed")
+ if (!entry_ptr->is_pinned)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed")
- if(!(entry_ptr->pinned_from_client || entry_ptr->pinned_from_cache))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
+ if (!(entry_ptr->pinned_from_client || entry_ptr->pinned_from_cache))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
- len++;
- size += entry_ptr->size;
- entry_ptr = entry_ptr->next;
- }
+ len++;
+ size += entry_ptr->size;
+ entry_ptr = entry_ptr->next;
+ }
- if((cache_ptr->pel_len != len) || (cache_ptr->pel_size != size))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed")
+ if ((cache_ptr->pel_len != len) || (cache_ptr->pel_size != size))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed")
done:
- if(ret_value != SUCCEED)
- HDassert(0);
+ if (ret_value != SUCCEED)
+ HDassert(0);
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__validate_pinned_entry_list() */
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__validate_pinned_entry_list() */
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
-
/*-------------------------------------------------------------------------
*
* Function: H5C__validate_protected_entry_list
@@ -8304,72 +7911,67 @@ done:
*-------------------------------------------------------------------------
*/
#if H5C_DO_EXTREME_SANITY_CHECKS
-static herr_t
-H5C__validate_protected_entry_list(H5C_t * cache_ptr)
-{
- int32_t len = 0;
- size_t size = 0;
- H5C_cache_entry_t * entry_ptr = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ static herr_t H5C__validate_protected_entry_list(H5C_t * cache_ptr)
+ {
+ int32_t len = 0;
+ size_t size = 0;
+ H5C_cache_entry_t *entry_ptr = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+
+ if (((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_tail_ptr == NULL)) &&
+ (cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
+
+ if (cache_ptr->pl_len < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
+
+ if ((cache_ptr->pl_len == 1) &&
+ ((cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr) || (cache_ptr->pl_head_ptr == NULL) ||
+ (cache_ptr->pl_head_ptr->size != cache_ptr->pl_size)))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed")
- if(((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_tail_ptr == NULL))
- && (cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
-
- if(cache_ptr->pl_len < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
-
- if((cache_ptr->pl_len == 1) &&
- ((cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr) ||
- (cache_ptr->pl_head_ptr == NULL) ||
- (cache_ptr->pl_head_ptr->size != cache_ptr->pl_size)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed")
-
- if((cache_ptr->pl_len >= 1) &&
- ((cache_ptr->pl_head_ptr == NULL) ||
- (cache_ptr->pl_head_ptr->prev != NULL) ||
- (cache_ptr->pl_tail_ptr == NULL) ||
- (cache_ptr->pl_tail_ptr->next != NULL)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed")
-
- entry_ptr = cache_ptr->pl_head_ptr;
- while(entry_ptr != NULL) {
- if((entry_ptr != cache_ptr->pl_head_ptr) &&
+ if ((cache_ptr->pl_len >= 1) &&
+ ((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_head_ptr->prev != NULL) ||
+ (cache_ptr->pl_tail_ptr == NULL) || (cache_ptr->pl_tail_ptr->next != NULL)))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed")
+
+ entry_ptr = cache_ptr->pl_head_ptr;
+ while (entry_ptr != NULL) {
+ if ((entry_ptr != cache_ptr->pl_head_ptr) &&
((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
- if((entry_ptr != cache_ptr->pl_tail_ptr) &&
+ if ((entry_ptr != cache_ptr->pl_tail_ptr) &&
((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed")
- if(!entry_ptr->is_protected)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed")
+ if (!entry_ptr->is_protected)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed")
- if(entry_ptr->is_read_only && (entry_ptr->ro_ref_count <= 0))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
+ if (entry_ptr->is_read_only && (entry_ptr->ro_ref_count <= 0))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
- len++;
- size += entry_ptr->size;
- entry_ptr = entry_ptr->next;
- }
+ len++;
+ size += entry_ptr->size;
+ entry_ptr = entry_ptr->next;
+ }
- if((cache_ptr->pl_len != len) || (cache_ptr->pl_size != size))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed")
+ if ((cache_ptr->pl_len != len) || (cache_ptr->pl_size != size))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed")
done:
- if(ret_value != SUCCEED)
- HDassert(0);
+ if (ret_value != SUCCEED)
+ HDassert(0);
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__validate_protected_entry_list() */
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__validate_protected_entry_list() */
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
-
/*-------------------------------------------------------------------------
*
* Function: H5C__entry_in_skip_list
@@ -8386,1295 +7988,1267 @@ done:
*-------------------------------------------------------------------------
*/
#if H5C_DO_SLIST_SANITY_CHECKS
-static hbool_t
-H5C__entry_in_skip_list(H5C_t * cache_ptr, H5C_cache_entry_t *target_ptr)
-{
- H5SL_node_t *node_ptr;
- hbool_t in_slist;
+ static hbool_t H5C__entry_in_skip_list(H5C_t * cache_ptr, H5C_cache_entry_t * target_ptr)
+ {
+ H5SL_node_t *node_ptr;
+ hbool_t in_slist;
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_ptr->slist_ptr);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr->slist_ptr);
- node_ptr = H5SL_first(cache_ptr->slist_ptr);
- in_slist = FALSE;
- while((node_ptr != NULL) && (!in_slist)) {
- H5C_cache_entry_t *entry_ptr;
+ node_ptr = H5SL_first(cache_ptr->slist_ptr);
+ in_slist = FALSE;
+ while ((node_ptr != NULL) && (!in_slist)) {
+ H5C_cache_entry_t *entry_ptr;
- entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
+ entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
- HDassert(entry_ptr);
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->is_dirty);
- HDassert(entry_ptr->in_slist);
+ HDassert(entry_ptr);
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->is_dirty);
+ HDassert(entry_ptr->in_slist);
- if(entry_ptr == target_ptr)
- in_slist = TRUE;
- else
- node_ptr = H5SL_next(node_ptr);
- }
+ if (entry_ptr == target_ptr)
+ in_slist = TRUE;
+ else
+ node_ptr = H5SL_next(node_ptr);
+ }
- return(in_slist);
-} /* H5C__entry_in_skip_list() */
+ return (in_slist);
+ } /* H5C__entry_in_skip_list() */
#endif /* H5C_DO_SLIST_SANITY_CHECKS */
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C__flush_marked_entries
+ *
+ * Purpose: Flushes all marked entries in the cache.
+ *
+ * Return: FAIL if error is detected, SUCCEED otherwise.
+ *
+ * Programmer: Mike McGreevy
+ * November 3, 2010
+ *
+ * Changes: Modified function to setup the slist before calling
+ * H%C_flush_cache(), and take it down afterwards. Note
+ * that the slist need not be empty after the call to
+ * H5C_flush_cache() since we are only flushing marked
+ * entries. Thus must set the clear_slist parameter
+ * of H5C_set_slist_enabled to TRUE.
+ *
+ * JRM -- 5/6/20
+ *
+ *-------------------------------------------------------------------------
+ */
-/*-------------------------------------------------------------------------
- *
- * Function: H5C__flush_marked_entries
- *
- * Purpose: Flushes all marked entries in the cache.
- *
- * Return: FAIL if error is detected, SUCCEED otherwise.
- *
- * Programmer: Mike McGreevy
- * November 3, 2010
- *
- * Changes: Modified function to setup the slist before calling
- * H%C_flush_cache(), and take it down afterwards. Note
- * that the slist need not be empty after the call to
- * H5C_flush_cache() since we are only flushing marked
- * entries. Thus must set the clear_slist parameter
- * of H5C_set_slist_enabled to TRUE.
- *
- * JRM -- 5/6/20
- *
- *-------------------------------------------------------------------------
- */
-
-herr_t
-H5C__flush_marked_entries(H5F_t * f)
-{
- herr_t ret_value = SUCCEED;
+ herr_t H5C__flush_marked_entries(H5F_t * f)
+ {
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_PACKAGE
- /* Assertions */
- HDassert(f != NULL);
+ /* Assertions */
+ HDassert(f != NULL);
+ /* Enable the slist, as it is needed in the flush */
+ if (H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0)
- /* Enable the slist, as it is needed in the flush */
- if ( H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0 )
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed")
+ /* Flush all marked entries */
+ if (H5C_flush_cache(f, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache")
- /* Flush all marked entries */
- if ( H5C_flush_cache(f, H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0 )
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache")
-
- /* Disable the slist. Set the clear_slist parameter to TRUE
- * since we called H5C_flush_cache() with the
- * H5C__FLUSH_MARKED_ENTRIES_FLAG.
- */
- if ( H5C_set_slist_enabled(f->shared->cache, FALSE, TRUE) < 0 )
+ /* Disable the slist. Set the clear_slist parameter to TRUE
+ * since we called H5C_flush_cache() with the
+ * H5C__FLUSH_MARKED_ENTRIES_FLAG.
+ */
+ if (H5C_set_slist_enabled(f->shared->cache, FALSE, TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "disable slist failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "disable slist failed")
done:
- FUNC_LEAVE_NOAPI(ret_value)
-
-} /* H5C__flush_marked_entries */
-
-
-/*-------------------------------------------------------------------------
- *
- * Function: H5C_cork
- *
- * Purpose: To cork/uncork/get cork status of an object depending on "action":
- * H5C__SET_CORK:
- * To cork the object
- * Return error if the object is already corked
- * H5C__UNCORK:
- * To uncork the obejct
- * Return error if the object is not corked
- * H5C__GET_CORKED:
- * To retrieve the cork status of an object in
- * the parameter "corked"
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Vailin Choi
- * January 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked)
-{
- H5C_tag_info_t *tag_info; /* Points to a tag info struct */
- herr_t ret_value = SUCCEED;
+ FUNC_LEAVE_NOAPI(ret_value)
- FUNC_ENTER_NOAPI_NOINIT
+ } /* H5C__flush_marked_entries */
- /* Assertions */
- HDassert(cache_ptr != NULL);
- HDassert(H5F_addr_defined(obj_addr));
- HDassert(action == H5C__SET_CORK || action == H5C__UNCORK || action == H5C__GET_CORKED);
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C_cork
+ *
+ * Purpose: To cork/uncork/get cork status of an object depending on "action":
+ * H5C__SET_CORK:
+ * To cork the object
+ * Return error if the object is already corked
+ * H5C__UNCORK:
+ * To uncork the obejct
+ * Return error if the object is not corked
+ * H5C__GET_CORKED:
+ * To retrieve the cork status of an object in
+ * the parameter "corked"
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Vailin Choi
+ * January 2014
+ *
+ *-------------------------------------------------------------------------
+ */
+ herr_t H5C_cork(H5C_t * cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked)
+ {
+ H5C_tag_info_t *tag_info; /* Points to a tag info struct */
+ herr_t ret_value = SUCCEED;
- /* Search the list of corked object addresses in the cache */
- tag_info = (H5C_tag_info_t *)H5SL_search(cache_ptr->tag_list, &obj_addr);
+ FUNC_ENTER_NOAPI_NOINIT
- if(H5C__GET_CORKED == action) {
- HDassert(corked);
- if(tag_info != NULL && tag_info->corked)
- *corked = TRUE;
- else
- *corked = FALSE;
- } /* end if */
- else {
- /* Sanity check */
- HDassert(H5C__SET_CORK == action || H5C__UNCORK == action);
-
- /* Perform appropriate action */
- if(H5C__SET_CORK == action) {
- /* Check if this is the first entry for this tagged object */
- if(NULL == tag_info) {
- /* Allocate new tag info struct */
- if(NULL == (tag_info = H5FL_CALLOC(H5C_tag_info_t)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate tag info for cache entry")
-
- /* Set the tag for all entries */
- tag_info->tag = obj_addr;
-
- /* Insert tag info into skip list */
- if(H5SL_insert(cache_ptr->tag_list, tag_info, &(tag_info->tag)) < 0 )
- HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert tag info in skip list")
- } /* end if */
- else {
- /* Check for object already corked */
- if(tag_info->corked)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTCORK, FAIL, "object already corked")
- HDassert(tag_info->entry_cnt > 0 && tag_info->head);
- } /* end else */
+ /* Assertions */
+ HDassert(cache_ptr != NULL);
+ HDassert(H5F_addr_defined(obj_addr));
+ HDassert(action == H5C__SET_CORK || action == H5C__UNCORK || action == H5C__GET_CORKED);
- /* Set the corked status for the entire object */
- tag_info->corked = TRUE;
- cache_ptr->num_objs_corked++;
+ /* Search the list of corked object addresses in the cache */
+ tag_info = (H5C_tag_info_t *)H5SL_search(cache_ptr->tag_list, &obj_addr);
+ if (H5C__GET_CORKED == action) {
+ HDassert(corked);
+ if (tag_info != NULL && tag_info->corked)
+ *corked = TRUE;
+ else
+ *corked = FALSE;
} /* end if */
else {
/* Sanity check */
- HDassert(tag_info);
-
- /* Check for already uncorked */
- if(!tag_info->corked)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNCORK, FAIL, "object already uncorked")
+ HDassert(H5C__SET_CORK == action || H5C__UNCORK == action);
+
+ /* Perform appropriate action */
+ if (H5C__SET_CORK == action) {
+ /* Check if this is the first entry for this tagged object */
+ if (NULL == tag_info) {
+ /* Allocate new tag info struct */
+ if (NULL == (tag_info = H5FL_CALLOC(H5C_tag_info_t)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate tag info for cache entry")
+
+ /* Set the tag for all entries */
+ tag_info->tag = obj_addr;
+
+ /* Insert tag info into skip list */
+ if (H5SL_insert(cache_ptr->tag_list, tag_info, &(tag_info->tag)) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert tag info in skip list")
+ } /* end if */
+ else {
+ /* Check for object already corked */
+ if (tag_info->corked)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTCORK, FAIL, "object already corked")
+ HDassert(tag_info->entry_cnt > 0 && tag_info->head);
+ } /* end else */
- /* Set the corked status for the entire object */
- tag_info->corked = FALSE;
- cache_ptr->num_objs_corked--;
+ /* Set the corked status for the entire object */
+ tag_info->corked = TRUE;
+ cache_ptr->num_objs_corked++;
- /* Remove the tag info from the tag list, if there's no more entries with this tag */
- if(0 == tag_info->entry_cnt) {
+ } /* end if */
+ else {
/* Sanity check */
- HDassert(NULL == tag_info->head);
+ HDassert(tag_info);
- if(H5SL_remove(cache_ptr->tag_list, &(tag_info->tag)) != tag_info)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove tag info from list")
+ /* Check for already uncorked */
+ if (!tag_info->corked)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNCORK, FAIL, "object already uncorked")
- /* Release the tag info */
- tag_info = H5FL_FREE(H5C_tag_info_t, tag_info);
- } /* end if */
- else
- HDassert(NULL != tag_info->head);
- } /* end else */
- } /* end else */
+ /* Set the corked status for the entire object */
+ tag_info->corked = FALSE;
+ cache_ptr->num_objs_corked--;
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_cork() */
+ /* Remove the tag info from the tag list, if there's no more entries with this tag */
+ if (0 == tag_info->entry_cnt) {
+ /* Sanity check */
+ HDassert(NULL == tag_info->head);
+ if (H5SL_remove(cache_ptr->tag_list, &(tag_info->tag)) != tag_info)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove tag info from list")
-/*-------------------------------------------------------------------------
- * Function: H5C__mark_flush_dep_dirty()
- *
- * Purpose: Recursively propagate the flush_dep_ndirty_children flag
- * up the dependency chain in response to entry either
- * becoming dirty or having its flush_dep_ndirty_children
- * increased from 0.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Neil Fortner
- * 11/13/12
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__mark_flush_dep_dirty(H5C_cache_entry_t * entry)
-{
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ /* Release the tag info */
+ tag_info = H5FL_FREE(H5C_tag_info_t, tag_info);
+ } /* end if */
+ else
+ HDassert(NULL != tag_info->head);
+ } /* end else */
+ } /* end else */
- FUNC_ENTER_STATIC
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C_cork() */
- /* Sanity checks */
- HDassert(entry);
+ /*-------------------------------------------------------------------------
+ * Function: H5C__mark_flush_dep_dirty()
+ *
+ * Purpose: Recursively propagate the flush_dep_ndirty_children flag
+ * up the dependency chain in response to entry either
+ * becoming dirty or having its flush_dep_ndirty_children
+ * increased from 0.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * 11/13/12
+ *
+ *-------------------------------------------------------------------------
+ */
+ static herr_t H5C__mark_flush_dep_dirty(H5C_cache_entry_t * entry)
+ {
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Iterate over the parent entries, if any */
- for(u = 0; u < entry->flush_dep_nparents; u++) {
- /* Sanity check */
- HDassert(entry->flush_dep_parent[u]->flush_dep_ndirty_children < entry->flush_dep_parent[u]->flush_dep_nchildren);
+ FUNC_ENTER_STATIC
- /* Adjust the parent's number of dirty children */
- entry->flush_dep_parent[u]->flush_dep_ndirty_children++;
+ /* Sanity checks */
+ HDassert(entry);
- /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */
- if(entry->flush_dep_parent[u]->type->notify &&
- (entry->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED, entry->flush_dep_parent[u]) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify parent about child entry dirty flag set")
- } /* end for */
+ /* Iterate over the parent entries, if any */
+ for (u = 0; u < entry->flush_dep_nparents; u++) {
+ /* Sanity check */
+ HDassert(entry->flush_dep_parent[u]->flush_dep_ndirty_children <
+ entry->flush_dep_parent[u]->flush_dep_nchildren);
+
+ /* Adjust the parent's number of dirty children */
+ entry->flush_dep_parent[u]->flush_dep_ndirty_children++;
+
+ /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */
+ if (entry->flush_dep_parent[u]->type->notify &&
+ (entry->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED,
+ entry->flush_dep_parent[u]) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify parent about child entry dirty flag set")
+ } /* end for */
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__mark_flush_dep_dirty() */
-
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__mark_flush_dep_dirty() */
-/*-------------------------------------------------------------------------
- * Function: H5C__mark_flush_dep_clean()
- *
- * Purpose: Recursively propagate the flush_dep_ndirty_children flag
- * up the dependency chain in response to entry either
- * becoming clean or having its flush_dep_ndirty_children
- * reduced to 0.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Neil Fortner
- * 11/13/12
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__mark_flush_dep_clean(H5C_cache_entry_t * entry)
-{
- int i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Sanity checks */
- HDassert(entry);
-
- /* Iterate over the parent entries, if any */
- /* Note reverse iteration order, in case the callback removes the flush
- * dependency - QAK, 2017/08/12
+ /*-------------------------------------------------------------------------
+ * Function: H5C__mark_flush_dep_clean()
+ *
+ * Purpose: Recursively propagate the flush_dep_ndirty_children flag
+ * up the dependency chain in response to entry either
+ * becoming clean or having its flush_dep_ndirty_children
+ * reduced to 0.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * 11/13/12
+ *
+ *-------------------------------------------------------------------------
*/
- for(i = ((int)entry->flush_dep_nparents) - 1; i >= 0; i--) {
- /* Sanity check */
- HDassert(entry->flush_dep_parent[i]->flush_dep_ndirty_children > 0);
+ static herr_t H5C__mark_flush_dep_clean(H5C_cache_entry_t * entry)
+ {
+ int i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Adjust the parent's number of dirty children */
- entry->flush_dep_parent[i]->flush_dep_ndirty_children--;
+ FUNC_ENTER_STATIC
- /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */
- if(entry->flush_dep_parent[i]->type->notify &&
- (entry->flush_dep_parent[i]->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED, entry->flush_dep_parent[i]) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify parent about child entry dirty flag reset")
- } /* end for */
+ /* Sanity checks */
+ HDassert(entry);
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__mark_flush_dep_clean() */
+ /* Iterate over the parent entries, if any */
+ /* Note reverse iteration order, in case the callback removes the flush
+ * dependency - QAK, 2017/08/12
+ */
+ for (i = ((int)entry->flush_dep_nparents) - 1; i >= 0; i--) {
+ /* Sanity check */
+ HDassert(entry->flush_dep_parent[i]->flush_dep_ndirty_children > 0);
+ /* Adjust the parent's number of dirty children */
+ entry->flush_dep_parent[i]->flush_dep_ndirty_children--;
-/*-------------------------------------------------------------------------
- * Function: H5C__mark_flush_dep_serialized()
- *
- * Purpose: Decrement the flush_dep_nunser_children fields of all the
- * target entry's flush dependency parents in response to
- * the target entry becoming serialized.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 8/30/16
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5C__mark_flush_dep_serialized(H5C_cache_entry_t * entry_ptr)
-{
- int i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
+ /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */
+ if (entry->flush_dep_parent[i]->type->notify &&
+ (entry->flush_dep_parent[i]->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED,
+ entry->flush_dep_parent[i]) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify parent about child entry dirty flag reset")
+ } /* end for */
- /* Sanity checks */
- HDassert(entry_ptr);
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__mark_flush_dep_clean() */
- /* Iterate over the parent entries, if any */
- /* Note reverse iteration order, in case the callback removes the flush
- * dependency - QAK, 2017/08/12
+ /*-------------------------------------------------------------------------
+ * Function: H5C__mark_flush_dep_serialized()
+ *
+ * Purpose: Decrement the flush_dep_nunser_children fields of all the
+ * target entry's flush dependency parents in response to
+ * the target entry becoming serialized.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: John Mainzer
+ * 8/30/16
+ *
+ *-------------------------------------------------------------------------
*/
- for(i = ((int)entry_ptr->flush_dep_nparents) - 1; i >= 0; i--) {
- /* Sanity checks */
- HDassert(entry_ptr->flush_dep_parent);
- HDassert(entry_ptr->flush_dep_parent[i]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->flush_dep_parent[i]->flush_dep_nunser_children > 0);
+ herr_t H5C__mark_flush_dep_serialized(H5C_cache_entry_t * entry_ptr)
+ {
+ int i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- /* decrement the parents number of unserialized children */
- entry_ptr->flush_dep_parent[i]->flush_dep_nunser_children--;
+ FUNC_ENTER_STATIC
- /* If the parent has a 'notify' callback, send a 'child entry serialized' notice */
- if(entry_ptr->flush_dep_parent[i]->type->notify &&
- (entry_ptr->flush_dep_parent[i]->type->notify)(H5C_NOTIFY_ACTION_CHILD_SERIALIZED, entry_ptr->flush_dep_parent[i]) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify parent about child entry serialized flag set")
- } /* end for */
+ /* Sanity checks */
+ HDassert(entry_ptr);
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__mark_flush_dep_serialized() */
+ /* Iterate over the parent entries, if any */
+ /* Note reverse iteration order, in case the callback removes the flush
+ * dependency - QAK, 2017/08/12
+ */
+ for (i = ((int)entry_ptr->flush_dep_nparents) - 1; i >= 0; i--) {
+ /* Sanity checks */
+ HDassert(entry_ptr->flush_dep_parent);
+ HDassert(entry_ptr->flush_dep_parent[i]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->flush_dep_parent[i]->flush_dep_nunser_children > 0);
+
+ /* decrement the parents number of unserialized children */
+ entry_ptr->flush_dep_parent[i]->flush_dep_nunser_children--;
+
+ /* If the parent has a 'notify' callback, send a 'child entry serialized' notice */
+ if (entry_ptr->flush_dep_parent[i]->type->notify &&
+ (entry_ptr->flush_dep_parent[i]->type->notify)(H5C_NOTIFY_ACTION_CHILD_SERIALIZED,
+ entry_ptr->flush_dep_parent[i]) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify parent about child entry serialized flag set")
+ } /* end for */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__mark_flush_dep_serialized() */
-/*-------------------------------------------------------------------------
- * Function: H5C__mark_flush_dep_unserialized()
- *
- * Purpose: Increment the flush_dep_nunser_children fields of all the
- * target entry's flush dependency parents in response to
- * the target entry becoming unserialized.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 8/30/16
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5C__mark_flush_dep_unserialized(H5C_cache_entry_t * entry_ptr)
-{
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ /*-------------------------------------------------------------------------
+ * Function: H5C__mark_flush_dep_unserialized()
+ *
+ * Purpose: Increment the flush_dep_nunser_children fields of all the
+ * target entry's flush dependency parents in response to
+ * the target entry becoming unserialized.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: John Mainzer
+ * 8/30/16
+ *
+ *-------------------------------------------------------------------------
+ */
+ herr_t H5C__mark_flush_dep_unserialized(H5C_cache_entry_t * entry_ptr)
+ {
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- /* Sanity checks */
- HDassert(entry_ptr);
+ /* Sanity checks */
+ HDassert(entry_ptr);
- /* Iterate over the parent entries, if any */
- for(u = 0; u < entry_ptr->flush_dep_nparents; u++) {
- /* Sanity check */
- HDassert(entry_ptr->flush_dep_parent);
- HDassert(entry_ptr->flush_dep_parent[u]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->flush_dep_parent[u]->flush_dep_nunser_children <
- entry_ptr->flush_dep_parent[u]->flush_dep_nchildren);
-
- /* increment parents number of usserialized children */
- entry_ptr->flush_dep_parent[u]->flush_dep_nunser_children++;
-
- /* If the parent has a 'notify' callback, send a 'child entry unserialized' notice */
- if(entry_ptr->flush_dep_parent[u]->type->notify &&
- (entry_ptr->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED, entry_ptr->flush_dep_parent[u]) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify parent about child entry serialized flag reset")
- } /* end for */
+ /* Iterate over the parent entries, if any */
+ for (u = 0; u < entry_ptr->flush_dep_nparents; u++) {
+ /* Sanity check */
+ HDassert(entry_ptr->flush_dep_parent);
+ HDassert(entry_ptr->flush_dep_parent[u]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->flush_dep_parent[u]->flush_dep_nunser_children <
+ entry_ptr->flush_dep_parent[u]->flush_dep_nchildren);
+
+ /* increment parents number of usserialized children */
+ entry_ptr->flush_dep_parent[u]->flush_dep_nunser_children++;
+
+ /* If the parent has a 'notify' callback, send a 'child entry unserialized' notice */
+ if (entry_ptr->flush_dep_parent[u]->type->notify &&
+ (entry_ptr->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED,
+ entry_ptr->flush_dep_parent[u]) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "can't notify parent about child entry serialized flag reset")
+ } /* end for */
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__mark_flush_dep_unserialized() */
-
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__mark_flush_dep_unserialized() */
#ifndef NDEBUG
-/*-------------------------------------------------------------------------
- * Function: H5C__assert_flush_dep_nocycle()
- *
- * Purpose: Assert recursively that base_entry is not the same as
- * entry, and perform the same assertion on all of entry's
- * flush dependency parents. This is used to detect cycles
- * created by flush dependencies.
- *
- * Return: void
- *
- * Programmer: Neil Fortner
- * 12/10/12
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t * entry,
- const H5C_cache_entry_t * base_entry)
-{
- unsigned u; /* Local index variable */
+ /*-------------------------------------------------------------------------
+ * Function: H5C__assert_flush_dep_nocycle()
+ *
+ * Purpose: Assert recursively that base_entry is not the same as
+ * entry, and perform the same assertion on all of entry's
+ * flush dependency parents. This is used to detect cycles
+ * created by flush dependencies.
+ *
+ * Return: void
+ *
+ * Programmer: Neil Fortner
+ * 12/10/12
+ *
+ *-------------------------------------------------------------------------
+ */
+ static void H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t *entry,
+ const H5C_cache_entry_t *base_entry)
+ {
+ unsigned u; /* Local index variable */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC_NOERR
- /* Sanity checks */
- HDassert(entry);
- HDassert(base_entry);
+ /* Sanity checks */
+ HDassert(entry);
+ HDassert(base_entry);
- /* Make sure the entries are not the same */
- HDassert(base_entry != entry);
+ /* Make sure the entries are not the same */
+ HDassert(base_entry != entry);
- /* Iterate over entry's parents (if any) */
- for(u = 0; u < entry->flush_dep_nparents; u++)
- H5C__assert_flush_dep_nocycle(entry->flush_dep_parent[u], base_entry);
+ /* Iterate over entry's parents (if any) */
+ for (u = 0; u < entry->flush_dep_nparents; u++)
+ H5C__assert_flush_dep_nocycle(entry->flush_dep_parent[u], base_entry);
- FUNC_LEAVE_NOAPI_VOID
-} /* H5C__assert_flush_dep_nocycle() */
+ FUNC_LEAVE_NOAPI_VOID
+ } /* H5C__assert_flush_dep_nocycle() */
#endif /* NDEBUG */
-
-/*-------------------------------------------------------------------------
- * Function: H5C__serialize_cache
- *
- * Purpose: Serialize (i.e. construct an on disk image) for all entries
- * in the metadata cache including clean entries.
- *
- * Note that flush dependencies and "flush me last" flags
- * must be observed in the serialization process.
- *
- * Note also that entries may be loaded, flushed, evicted,
- * expunged, relocated, resized, or removed from the cache
- * during this process, just as these actions may occur during
- * a regular flush.
- *
- * However, we are given that the cache will contain no protected
- * entries on entry to this routine (although entries may be
- * briefly protected and then unprotected during the serialize
- * process).
- *
- * The objective of this routine is serialize all entries and
- * to force all entries into their actual locations on disk.
- *
- * The initial need for this routine is to settle all entries
- * in the cache prior to construction of the metadata cache
- * image so that the size of the cache image can be calculated.
- * However, I gather that other uses for the routine are
- * under consideration.
- *
- * Return: Non-negative on success/Negative on failure or if there was
- * a request to flush all items and something was protected.
- *
- * Programmer: John Mainzer
- * 7/22/15
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5C__serialize_cache(H5F_t *f)
-{
+ /*-------------------------------------------------------------------------
+ * Function: H5C__serialize_cache
+ *
+ * Purpose: Serialize (i.e. construct an on disk image) for all entries
+ * in the metadata cache including clean entries.
+ *
+ * Note that flush dependencies and "flush me last" flags
+ * must be observed in the serialization process.
+ *
+ * Note also that entries may be loaded, flushed, evicted,
+ * expunged, relocated, resized, or removed from the cache
+ * during this process, just as these actions may occur during
+ * a regular flush.
+ *
+ * However, we are given that the cache will contain no protected
+ * entries on entry to this routine (although entries may be
+ * briefly protected and then unprotected during the serialize
+ * process).
+ *
+ * The objective of this routine is serialize all entries and
+ * to force all entries into their actual locations on disk.
+ *
+ * The initial need for this routine is to settle all entries
+ * in the cache prior to construction of the metadata cache
+ * image so that the size of the cache image can be calculated.
+ * However, I gather that other uses for the routine are
+ * under consideration.
+ *
+ * Return: Non-negative on success/Negative on failure or if there was
+ * a request to flush all items and something was protected.
+ *
+ * Programmer: John Mainzer
+ * 7/22/15
+ *
+ *-------------------------------------------------------------------------
+ */
+ herr_t H5C__serialize_cache(H5F_t * f)
+ {
#if H5C_DO_SANITY_CHECKS
- int i;
- uint32_t index_len = 0;
- size_t index_size = (size_t)0;
- size_t clean_index_size = (size_t)0;
- size_t dirty_index_size = (size_t)0;
- size_t slist_size = (size_t)0;
- uint32_t slist_len = 0;
+ int i;
+ uint32_t index_len = 0;
+ size_t index_size = (size_t)0;
+ size_t clean_index_size = (size_t)0;
+ size_t dirty_index_size = (size_t)0;
+ size_t slist_size = (size_t)0;
+ uint32_t slist_len = 0;
#endif /* H5C_DO_SANITY_CHECKS */
- H5C_ring_t ring;
- H5C_t * cache_ptr;
- herr_t ret_value = SUCCEED;
+ H5C_ring_t ring;
+ H5C_t * cache_ptr;
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_PACKAGE
- /* Sanity checks */
- HDassert(f);
- HDassert(f->shared);
- cache_ptr = f->shared->cache;
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_ptr->slist_ptr);
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(f->shared);
+ cache_ptr = f->shared->cache;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr->slist_ptr);
#if H5C_DO_SANITY_CHECKS
- HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0);
- HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
- HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
- HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
- HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0);
- HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
-
- for(i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) {
- index_len += cache_ptr->index_ring_len[i];
- index_size += cache_ptr->index_ring_size[i];
- clean_index_size += cache_ptr->clean_index_ring_size[i];
- dirty_index_size += cache_ptr->dirty_index_ring_size[i];
-
- slist_len += cache_ptr->slist_ring_len[i];
- slist_size += cache_ptr->slist_ring_size[i];
- } /* end for */
+ HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0);
+ HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0);
+ HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+
+ for (i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) {
+ index_len += cache_ptr->index_ring_len[i];
+ index_size += cache_ptr->index_ring_size[i];
+ clean_index_size += cache_ptr->clean_index_ring_size[i];
+ dirty_index_size += cache_ptr->dirty_index_ring_size[i];
+
+ slist_len += cache_ptr->slist_ring_len[i];
+ slist_size += cache_ptr->slist_ring_size[i];
+ } /* end for */
- HDassert(cache_ptr->index_len == index_len);
- HDassert(cache_ptr->index_size == index_size);
- HDassert(cache_ptr->clean_index_size == clean_index_size);
- HDassert(cache_ptr->dirty_index_size == dirty_index_size);
- HDassert(cache_ptr->slist_len == slist_len);
- HDassert(cache_ptr->slist_size == slist_size);
+ HDassert(cache_ptr->index_len == index_len);
+ HDassert(cache_ptr->index_size == index_size);
+ HDassert(cache_ptr->clean_index_size == clean_index_size);
+ HDassert(cache_ptr->dirty_index_size == dirty_index_size);
+ HDassert(cache_ptr->slist_len == slist_len);
+ HDassert(cache_ptr->slist_size == slist_size);
#endif /* H5C_DO_SANITY_CHECKS */
#if H5C_DO_EXTREME_SANITY_CHECKS
- if((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C__validate_pinned_entry_list(cache_ptr) < 0) ||
- (H5C__validate_lru_list(cache_ptr) < 0))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry")
+ if ((H5C__validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
#ifndef NDEBUG
- /* if this is a debug build, set the serialization_count field of
- * each entry in the cache to zero before we start the serialization.
- * This allows us to detect the case in which any entry is serialized
- * more than once (a performance issues), and more importantly, the
- * case is which any flush depencency parent is serializes more than
- * once (a correctness issue).
- */
- {
- H5C_cache_entry_t * scan_ptr = NULL;
-
- scan_ptr = cache_ptr->il_head;
- while(scan_ptr != NULL) {
- HDassert(scan_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- scan_ptr->serialization_count = 0;
- scan_ptr = scan_ptr->il_next;
- } /* end while */
- } /* end block */
-#endif /* NDEBUG */
-
- /* set cache_ptr->serialization_in_progress to TRUE, and back
- * to FALSE at the end of the function. Must maintain this flag
- * to support H5C_get_serialization_in_progress(), which is in
- * turn required to support sanity checking in some cache
- * clients.
- */
- HDassert(!cache_ptr->serialization_in_progress);
- cache_ptr->serialization_in_progress = TRUE;
+ /* if this is a debug build, set the serialization_count field of
+ * each entry in the cache to zero before we start the serialization.
+ * This allows us to detect the case in which any entry is serialized
+ * more than once (a performance issues), and more importantly, the
+ * case is which any flush depencency parent is serializes more than
+ * once (a correctness issue).
+ */
+ {
+ H5C_cache_entry_t *scan_ptr = NULL;
+
+ scan_ptr = cache_ptr->il_head;
+ while (scan_ptr != NULL) {
+ HDassert(scan_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ scan_ptr->serialization_count = 0;
+ scan_ptr = scan_ptr->il_next;
+ } /* end while */
+ } /* end block */
+#endif /* NDEBUG */
+
+ /* set cache_ptr->serialization_in_progress to TRUE, and back
+ * to FALSE at the end of the function. Must maintain this flag
+ * to support H5C_get_serialization_in_progress(), which is in
+ * turn required to support sanity checking in some cache
+ * clients.
+ */
+ HDassert(!cache_ptr->serialization_in_progress);
+ cache_ptr->serialization_in_progress = TRUE;
- /* Serialize each ring, starting from the outermost ring and
- * working inward.
- */
- ring = H5C_RING_USER;
- while(ring < H5C_RING_NTYPES) {
- HDassert(cache_ptr->close_warning_received);
- switch(ring) {
- case H5C_RING_USER:
- break;
+ /* Serialize each ring, starting from the outermost ring and
+ * working inward.
+ */
+ ring = H5C_RING_USER;
+ while (ring < H5C_RING_NTYPES) {
+ HDassert(cache_ptr->close_warning_received);
+ switch (ring) {
+ case H5C_RING_USER:
+ break;
- case H5C_RING_RDFSM:
- /* Settle raw data FSM */
- if(!cache_ptr->rdfsm_settled)
- if(H5MF_settle_raw_data_fsm(f, &cache_ptr->rdfsm_settled) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "RD FSM settle failed")
- break;
+ case H5C_RING_RDFSM:
+ /* Settle raw data FSM */
+ if (!cache_ptr->rdfsm_settled)
+ if (H5MF_settle_raw_data_fsm(f, &cache_ptr->rdfsm_settled) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "RD FSM settle failed")
+ break;
- case H5C_RING_MDFSM:
- /* Settle metadata FSM */
- if(!cache_ptr->mdfsm_settled)
- if(H5MF_settle_meta_data_fsm(f, &cache_ptr->mdfsm_settled) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "MD FSM settle failed")
- break;
+ case H5C_RING_MDFSM:
+ /* Settle metadata FSM */
+ if (!cache_ptr->mdfsm_settled)
+ if (H5MF_settle_meta_data_fsm(f, &cache_ptr->mdfsm_settled) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "MD FSM settle failed")
+ break;
- case H5C_RING_SBE:
- case H5C_RING_SB:
- break;
+ case H5C_RING_SBE:
+ case H5C_RING_SB:
+ break;
- default:
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown ring?!?!")
- break;
- } /* end switch */
+ default:
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown ring?!?!")
+ break;
+ } /* end switch */
- if(H5C__serialize_ring(f, ring) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "serialize ring failed")
+ if (H5C__serialize_ring(f, ring) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "serialize ring failed")
- ring++;
- } /* end while */
+ ring++;
+ } /* end while */
#ifndef NDEBUG
- /* Verify that no entry has been serialized more than once.
- * FD parents with multiple serializations should have been caught
- * elsewhere, so no specific check for them here.
- */
- {
- H5C_cache_entry_t * scan_ptr = NULL;
+ /* Verify that no entry has been serialized more than once.
+ * FD parents with multiple serializations should have been caught
+ * elsewhere, so no specific check for them here.
+ */
+ {
+ H5C_cache_entry_t *scan_ptr = NULL;
- scan_ptr = cache_ptr->il_head;
- while(scan_ptr != NULL) {
- HDassert(scan_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(scan_ptr->serialization_count <= 1);
+ scan_ptr = cache_ptr->il_head;
+ while (scan_ptr != NULL) {
+ HDassert(scan_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(scan_ptr->serialization_count <= 1);
- scan_ptr = scan_ptr->il_next;
- } /* end while */
- } /* end block */
-#endif /* NDEBUG */
+ scan_ptr = scan_ptr->il_next;
+ } /* end while */
+ } /* end block */
+#endif /* NDEBUG */
done:
- cache_ptr->serialization_in_progress = FALSE;
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__serialize_cache() */
-
+ cache_ptr->serialization_in_progress = FALSE;
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__serialize_cache() */
-/*-------------------------------------------------------------------------
- * Function: H5C__serialize_ring
- *
- * Purpose: Serialize the entries contained in the specified cache and
- * ring. All entries in rings outside the specified ring
- * must have been serialized on entry.
- *
- * If the cache contains protected entries in the specified
- * ring, the function will fail, as protected entries cannot
- * be serialized. However all unprotected entries in the
- * target ring should be serialized before the function
- * returns failure.
- *
- * If flush dependencies appear in the target ring, the
- * function makes repeated passes through the index list
- * serializing entries in flush dependency order.
- *
- * All entries outside the H5C_RING_SBE are marked for
- * inclusion in the cache image. Entries in H5C_RING_SBE
- * and below are marked for exclusion from the image.
- *
- * Return: Non-negative on success/Negative on failure or if there was
- * a request to flush all items and something was protected.
- *
- * Programmer: John Mainzer
- * 9/11/15
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__serialize_ring(H5F_t *f, H5C_ring_t ring)
-{
- hbool_t done = FALSE;
- H5C_t * cache_ptr;
- H5C_cache_entry_t * entry_ptr;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_STATIC
-
- /* Sanity checks */
- HDassert(f);
- HDassert(f->shared);
- cache_ptr = f->shared->cache;
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(ring > H5C_RING_UNDEFINED);
- HDassert(ring < H5C_RING_NTYPES);
-
- HDassert(cache_ptr->serialization_in_progress);
-
- /* The objective here is to serialize all entries in the cache ring
- * in flush dependency order.
- *
- * The basic algorithm is to scan the cache index list looking for
- * unserialized entries that are either not in a flush dependency
- * relationship, or which have no unserialized children. Any such
- * entry is serialized and its flush dependency parents (if any) are
- * informed -- allowing them to decrement their userialized child counts.
- *
- * However, this algorithm is complicated by the ability
- * of client serialization callbacks to perform operations on
- * on the cache which can result in the insertion, deletion,
- * relocation, resize, dirty, flush, eviction, or removal (via the
- * take ownership flag) of entries. Changes in the flush dependency
- * structure are also possible.
- *
- * On the other hand, the algorithm is simplified by the fact that
- * we are serializing, not flushing. Thus, as long as all entries
- * are serialized correctly, it doesn't matter if we have to go back
- * and serialize an entry a second time.
- *
- * These possible actions result in the following modfications to
- * tha basic algorithm:
- *
- * 1) In the event of an entry expunge, eviction or removal, we must
- * restart the scan as it is possible that the next entry in our
- * scan is no longer in the cache. Were we to examine this entry,
- * we would be accessing deallocated memory.
- *
- * 2) A resize, dirty, or insertion of an entry may result in the
- * the increment of a flush dependency parent's dirty and/or
- * unserialized child count. In the context of serializing the
- * the cache, this is a non-issue, as even if we have already
- * serialized the parent, it will be marked dirty and its image
- * marked out of date if appropriate when the child is serialized.
- *
- * However, this is a major issue for a flush, as were this to happen
- * in a flush, it would violate the invariant that the flush dependency
- * feature is intended to enforce. As the metadata cache has no
- * control over the behavior of cache clients, it has no way of
- * preventing this behaviour. However, it should detect it if at all
- * possible.
- *
- * Do this by maintaining a count of the number of times each entry is
- * serialized during a cache serialization. If any flush dependency
- * parent is serialized more than once, throw an assertion failure.
- *
- * 3) An entry relocation will typically change the location of the
- * entry in the index list. This shouldn't cause problems as we
- * will scan the index list until we make a complete pass without
- * finding anything to serialize -- making relocations of either
- * the current or next entries irrelevant.
- *
- * Note that since a relocation may result in our skipping part of
- * the index list, we must always do at least one more pass through
- * the index list after an entry relocation.
- *
- * 4) Changes in the flush dependency structure are possible on
- * entry insertion, load, expunge, evict, or remove. Destruction
- * of a flush dependency has no effect, as it can only relax the
- * flush dependencies. Creation of a flush dependency can create
- * an unserialized child of a flush dependency parent where all
- * flush dependency children were previously serialized. Should
- * this child dirty the flush dependency parent when it is serialized,
- * the parent will be re-serialized.
- *
- * Per the discussion of 2) above, this is a non issue for cache
- * serialization, and a major problem for cache flush. Using the
- * same detection mechanism, throw an assertion failure if this
- * condition appears.
- *
- * Observe that either eviction or removal of entries as a result of
- * a serialization is not a problem as long as the flush depencency
- * tree does not change beyond the removal of a leaf.
+ /*-------------------------------------------------------------------------
+ * Function: H5C__serialize_ring
+ *
+ * Purpose: Serialize the entries contained in the specified cache and
+ * ring. All entries in rings outside the specified ring
+ * must have been serialized on entry.
+ *
+ * If the cache contains protected entries in the specified
+ * ring, the function will fail, as protected entries cannot
+ * be serialized. However all unprotected entries in the
+ * target ring should be serialized before the function
+ * returns failure.
+ *
+ * If flush dependencies appear in the target ring, the
+ * function makes repeated passes through the index list
+ * serializing entries in flush dependency order.
+ *
+ * All entries outside the H5C_RING_SBE are marked for
+ * inclusion in the cache image. Entries in H5C_RING_SBE
+ * and below are marked for exclusion from the image.
+ *
+ * Return: Non-negative on success/Negative on failure or if there was
+ * a request to flush all items and something was protected.
+ *
+ * Programmer: John Mainzer
+ * 9/11/15
+ *
+ *-------------------------------------------------------------------------
*/
- while(!done) {
- /* Reset the counters so that we can detect insertions, loads,
- * moves, and flush dependency height changes caused by the pre_serialize
- * and serialize callbacks.
- */
- cache_ptr->entries_loaded_counter = 0;
- cache_ptr->entries_inserted_counter = 0;
- cache_ptr->entries_relocated_counter = 0;
+ static herr_t H5C__serialize_ring(H5F_t * f, H5C_ring_t ring)
+ {
+ hbool_t done = FALSE;
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t *entry_ptr;
+ herr_t ret_value = SUCCEED;
- done = TRUE; /* set to FALSE if any activity in inner loop */
- entry_ptr = cache_ptr->il_head;
- while(entry_ptr != NULL) {
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ FUNC_ENTER_STATIC
- /* Verify that either the entry is already serialized, or
- * that it is assigned to either the target or an inner
- * ring.
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(f->shared);
+ cache_ptr = f->shared->cache;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(ring > H5C_RING_UNDEFINED);
+ HDassert(ring < H5C_RING_NTYPES);
+
+ HDassert(cache_ptr->serialization_in_progress);
+
+ /* The objective here is to serialize all entries in the cache ring
+ * in flush dependency order.
+ *
+ * The basic algorithm is to scan the cache index list looking for
+ * unserialized entries that are either not in a flush dependency
+ * relationship, or which have no unserialized children. Any such
+ * entry is serialized and its flush dependency parents (if any) are
+ * informed -- allowing them to decrement their userialized child counts.
+ *
+ * However, this algorithm is complicated by the ability
+ * of client serialization callbacks to perform operations on
+ * on the cache which can result in the insertion, deletion,
+ * relocation, resize, dirty, flush, eviction, or removal (via the
+ * take ownership flag) of entries. Changes in the flush dependency
+ * structure are also possible.
+ *
+ * On the other hand, the algorithm is simplified by the fact that
+ * we are serializing, not flushing. Thus, as long as all entries
+ * are serialized correctly, it doesn't matter if we have to go back
+ * and serialize an entry a second time.
+ *
+ * These possible actions result in the following modfications to
+ * tha basic algorithm:
+ *
+ * 1) In the event of an entry expunge, eviction or removal, we must
+ * restart the scan as it is possible that the next entry in our
+ * scan is no longer in the cache. Were we to examine this entry,
+ * we would be accessing deallocated memory.
+ *
+ * 2) A resize, dirty, or insertion of an entry may result in the
+ * the increment of a flush dependency parent's dirty and/or
+ * unserialized child count. In the context of serializing the
+ * the cache, this is a non-issue, as even if we have already
+ * serialized the parent, it will be marked dirty and its image
+ * marked out of date if appropriate when the child is serialized.
+ *
+ * However, this is a major issue for a flush, as were this to happen
+ * in a flush, it would violate the invariant that the flush dependency
+ * feature is intended to enforce. As the metadata cache has no
+ * control over the behavior of cache clients, it has no way of
+ * preventing this behaviour. However, it should detect it if at all
+ * possible.
+ *
+ * Do this by maintaining a count of the number of times each entry is
+ * serialized during a cache serialization. If any flush dependency
+ * parent is serialized more than once, throw an assertion failure.
+ *
+ * 3) An entry relocation will typically change the location of the
+ * entry in the index list. This shouldn't cause problems as we
+ * will scan the index list until we make a complete pass without
+ * finding anything to serialize -- making relocations of either
+ * the current or next entries irrelevant.
+ *
+ * Note that since a relocation may result in our skipping part of
+ * the index list, we must always do at least one more pass through
+ * the index list after an entry relocation.
+ *
+ * 4) Changes in the flush dependency structure are possible on
+ * entry insertion, load, expunge, evict, or remove. Destruction
+ * of a flush dependency has no effect, as it can only relax the
+ * flush dependencies. Creation of a flush dependency can create
+ * an unserialized child of a flush dependency parent where all
+ * flush dependency children were previously serialized. Should
+ * this child dirty the flush dependency parent when it is serialized,
+ * the parent will be re-serialized.
+ *
+ * Per the discussion of 2) above, this is a non issue for cache
+ * serialization, and a major problem for cache flush. Using the
+ * same detection mechanism, throw an assertion failure if this
+ * condition appears.
+ *
+ * Observe that either eviction or removal of entries as a result of
+ * a serialization is not a problem as long as the flush depencency
+ * tree does not change beyond the removal of a leaf.
+ */
+ while (!done) {
+ /* Reset the counters so that we can detect insertions, loads,
+ * moves, and flush dependency height changes caused by the pre_serialize
+ * and serialize callbacks.
*/
- HDassert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date));
+ cache_ptr->entries_loaded_counter = 0;
+ cache_ptr->entries_inserted_counter = 0;
+ cache_ptr->entries_relocated_counter = 0;
+
+ done = TRUE; /* set to FALSE if any activity in inner loop */
+ entry_ptr = cache_ptr->il_head;
+ while (entry_ptr != NULL) {
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+
+ /* Verify that either the entry is already serialized, or
+ * that it is assigned to either the target or an inner
+ * ring.
+ */
+ HDassert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date));
- /* Skip flush me last entries or inner ring entries */
- if(!entry_ptr->flush_me_last && entry_ptr->ring == ring) {
+ /* Skip flush me last entries or inner ring entries */
+ if (!entry_ptr->flush_me_last && entry_ptr->ring == ring) {
- /* if we encounter an unserialized entry in the current
- * ring that is not marked flush me last, we are not done.
- */
- if(!entry_ptr->image_up_to_date)
- done = FALSE;
+ /* if we encounter an unserialized entry in the current
+ * ring that is not marked flush me last, we are not done.
+ */
+ if (!entry_ptr->image_up_to_date)
+ done = FALSE;
- /* Serialize the entry if its image is not up to date
- * and it has no unserialized flush dependency children.
- */
- if(!entry_ptr->image_up_to_date && entry_ptr->flush_dep_nunser_children == 0) {
- HDassert(entry_ptr->serialization_count == 0);
+ /* Serialize the entry if its image is not up to date
+ * and it has no unserialized flush dependency children.
+ */
+ if (!entry_ptr->image_up_to_date && entry_ptr->flush_dep_nunser_children == 0) {
+ HDassert(entry_ptr->serialization_count == 0);
- /* Serialize the entry */
- if(H5C__serialize_single_entry(f, cache_ptr, entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed")
+ /* Serialize the entry */
+ if (H5C__serialize_single_entry(f, cache_ptr, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed")
- HDassert(entry_ptr->flush_dep_nunser_children == 0);
- HDassert(entry_ptr->serialization_count == 0);
+ HDassert(entry_ptr->flush_dep_nunser_children == 0);
+ HDassert(entry_ptr->serialization_count == 0);
#ifndef NDEBUG
- /* Increment serialization counter (to detect multiple serializations) */
- entry_ptr->serialization_count++;
-#endif /* NDEBUG */
- } /* end if */
- } /* end if */
+ /* Increment serialization counter (to detect multiple serializations) */
+ entry_ptr->serialization_count++;
+#endif /* NDEBUG */
+ } /* end if */
+ } /* end if */
- /* Check for the cache being perturbed during the entry serialize */
- if((cache_ptr->entries_loaded_counter > 0) ||
- (cache_ptr->entries_inserted_counter > 0) ||
+ /* Check for the cache being perturbed during the entry serialize */
+ if ((cache_ptr->entries_loaded_counter > 0) || (cache_ptr->entries_inserted_counter > 0) ||
(cache_ptr->entries_relocated_counter > 0)) {
#if H5C_COLLECT_CACHE_STATS
- H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr);
+ H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr);
#endif /* H5C_COLLECT_CACHE_STATS */
- /* Reset the counters */
- cache_ptr->entries_loaded_counter = 0;
- cache_ptr->entries_inserted_counter = 0;
- cache_ptr->entries_relocated_counter = 0;
+ /* Reset the counters */
+ cache_ptr->entries_loaded_counter = 0;
+ cache_ptr->entries_inserted_counter = 0;
+ cache_ptr->entries_relocated_counter = 0;
- /* Restart scan */
- entry_ptr = cache_ptr->il_head;
- } /* end if */
- else
- /* Advance to next entry */
- entry_ptr = entry_ptr->il_next;
- } /* while ( entry_ptr != NULL ) */
- } /* while ( ! done ) */
+ /* Restart scan */
+ entry_ptr = cache_ptr->il_head;
+ } /* end if */
+ else
+ /* Advance to next entry */
+ entry_ptr = entry_ptr->il_next;
+ } /* while ( entry_ptr != NULL ) */
+ } /* while ( ! done ) */
+ /* Reset the counters so that we can detect insertions, loads,
+ * moves, and flush dependency height changes caused by the pre_serialize
+ * and serialize callbacks.
+ */
+ cache_ptr->entries_loaded_counter = 0;
+ cache_ptr->entries_inserted_counter = 0;
+ cache_ptr->entries_relocated_counter = 0;
+
+ /* At this point, all entries not marked "flush me last" and in
+ * the current ring or outside it should be serialized and have up
+ * to date images. Scan the index list again to serialize the
+ * "flush me last" entries (if they are in the current ring) and to
+ * verify that all other entries have up to date images.
+ */
+ entry_ptr = cache_ptr->il_head;
+ while (entry_ptr != NULL) {
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->ring > H5C_RING_UNDEFINED);
+ HDassert(entry_ptr->ring < H5C_RING_NTYPES);
+ HDassert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date));
- /* Reset the counters so that we can detect insertions, loads,
- * moves, and flush dependency height changes caused by the pre_serialize
- * and serialize callbacks.
- */
- cache_ptr->entries_loaded_counter = 0;
- cache_ptr->entries_inserted_counter = 0;
- cache_ptr->entries_relocated_counter = 0;
-
- /* At this point, all entries not marked "flush me last" and in
- * the current ring or outside it should be serialized and have up
- * to date images. Scan the index list again to serialize the
- * "flush me last" entries (if they are in the current ring) and to
- * verify that all other entries have up to date images.
- */
- entry_ptr = cache_ptr->il_head;
- while(entry_ptr != NULL) {
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->ring > H5C_RING_UNDEFINED);
- HDassert(entry_ptr->ring < H5C_RING_NTYPES);
- HDassert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date));
-
- if(entry_ptr->ring == ring) {
- if(entry_ptr->flush_me_last) {
- if(!entry_ptr->image_up_to_date) {
- HDassert(entry_ptr->serialization_count == 0);
- HDassert(entry_ptr->flush_dep_nunser_children == 0);
+ if (entry_ptr->ring == ring) {
+ if (entry_ptr->flush_me_last) {
+ if (!entry_ptr->image_up_to_date) {
+ HDassert(entry_ptr->serialization_count == 0);
+ HDassert(entry_ptr->flush_dep_nunser_children == 0);
- /* Serialize the entry */
- if(H5C__serialize_single_entry(f, cache_ptr, entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed")
+ /* Serialize the entry */
+ if (H5C__serialize_single_entry(f, cache_ptr, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed")
- /* Check for the cache changing */
- if((cache_ptr->entries_loaded_counter > 0) ||
+ /* Check for the cache changing */
+ if ((cache_ptr->entries_loaded_counter > 0) ||
(cache_ptr->entries_inserted_counter > 0) ||
(cache_ptr->entries_relocated_counter > 0))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "flush_me_last entry serialization triggered restart")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL,
+ "flush_me_last entry serialization triggered restart")
- HDassert(entry_ptr->flush_dep_nunser_children == 0);
- HDassert(entry_ptr->serialization_count == 0);
+ HDassert(entry_ptr->flush_dep_nunser_children == 0);
+ HDassert(entry_ptr->serialization_count == 0);
#ifndef NDEBUG
- /* Increment serialization counter (to detect multiple serializations) */
- entry_ptr->serialization_count++;
-#endif /* NDEBUG */
- } /* end if */
- } /* end if */
- else {
- HDassert(entry_ptr->image_up_to_date);
- HDassert(entry_ptr->serialization_count <= 1);
- HDassert(entry_ptr->flush_dep_nunser_children == 0);
- } /* end else */
- } /* if ( entry_ptr->ring == ring ) */
+ /* Increment serialization counter (to detect multiple serializations) */
+ entry_ptr->serialization_count++;
+#endif /* NDEBUG */
+ } /* end if */
+ } /* end if */
+ else {
+ HDassert(entry_ptr->image_up_to_date);
+ HDassert(entry_ptr->serialization_count <= 1);
+ HDassert(entry_ptr->flush_dep_nunser_children == 0);
+ } /* end else */
+ } /* if ( entry_ptr->ring == ring ) */
- entry_ptr = entry_ptr->il_next;
- } /* while ( entry_ptr != NULL ) */
+ entry_ptr = entry_ptr->il_next;
+ } /* while ( entry_ptr != NULL ) */
done:
- HDassert(cache_ptr->serialization_in_progress);
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__serialize_ring() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5C__serialize_single_entry
- *
- * Purpose: Serialize the cache entry pointed to by the entry_ptr
- * parameter.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer, 7/24/15
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__serialize_single_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr)
-{
- herr_t ret_value = SUCCEED; /* Return value */
+ HDassert(cache_ptr->serialization_in_progress);
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__serialize_ring() */
- FUNC_ENTER_STATIC
+ /*-------------------------------------------------------------------------
+ * Function: H5C__serialize_single_entry
+ *
+ * Purpose: Serialize the cache entry pointed to by the entry_ptr
+ * parameter.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: John Mainzer, 7/24/15
+ *
+ *-------------------------------------------------------------------------
+ */
+ static herr_t H5C__serialize_single_entry(H5F_t * f, H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr)
+ {
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Sanity checks */
- HDassert(f);
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(entry_ptr);
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(!entry_ptr->prefetched);
- HDassert(!entry_ptr->image_up_to_date);
- HDassert(entry_ptr->is_dirty);
- HDassert(!entry_ptr->is_protected);
- HDassert(!entry_ptr->flush_in_progress);
- HDassert(entry_ptr->type);
+ FUNC_ENTER_STATIC
- /* Set entry_ptr->flush_in_progress to TRUE so the the target entry
- * will not be evicted out from under us. Must set it back to FALSE
- * when we are done.
- */
- entry_ptr->flush_in_progress = TRUE;
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(entry_ptr);
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(!entry_ptr->prefetched);
+ HDassert(!entry_ptr->image_up_to_date);
+ HDassert(entry_ptr->is_dirty);
+ HDassert(!entry_ptr->is_protected);
+ HDassert(!entry_ptr->flush_in_progress);
+ HDassert(entry_ptr->type);
- /* Allocate buffer for the entry image if required. */
- if(NULL == entry_ptr->image_ptr) {
- HDassert(entry_ptr->size > 0);
- if(NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)) )
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer")
+ /* Set entry_ptr->flush_in_progress to TRUE so the the target entry
+ * will not be evicted out from under us. Must set it back to FALSE
+ * when we are done.
+ */
+ entry_ptr->flush_in_progress = TRUE;
+
+ /* Allocate buffer for the entry image if required. */
+ if (NULL == entry_ptr->image_ptr) {
+ HDassert(entry_ptr->size > 0);
+ if (NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
-#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
- } /* end if */
+ H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE,
+ H5C_IMAGE_EXTRA_SPACE);
+#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
+ } /* end if */
- /* Generate image for entry */
- if(H5C__generate_image(f, cache_ptr, entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "Can't generate image for cache entry")
+ /* Generate image for entry */
+ if (H5C__generate_image(f, cache_ptr, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "Can't generate image for cache entry")
- /* Reset the flush_in progress flag */
- entry_ptr->flush_in_progress = FALSE;
+ /* Reset the flush_in progress flag */
+ entry_ptr->flush_in_progress = FALSE;
done:
- HDassert((ret_value != SUCCEED) || (!entry_ptr->flush_in_progress));
- HDassert((ret_value != SUCCEED) || (entry_ptr->image_up_to_date));
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__serialize_single_entry() */
-
+ HDassert((ret_value != SUCCEED) || (!entry_ptr->flush_in_progress));
+ HDassert((ret_value != SUCCEED) || (entry_ptr->image_up_to_date));
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__serialize_single_entry() */
-/*-------------------------------------------------------------------------
- * Function: H5C__generate_image
- *
- * Purpose: Serialize an entry and generate its image.
- *
- * Note: This may cause the entry to be re-sized and/or moved in
- * the cache.
- *
- * As we will not update the metadata cache's data structures
- * until we we finish the write, we must touch up these
- * data structures for size and location changes even if we
- * are about to delete the entry from the cache (i.e. on a
- * flush destroy).
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Mohamad Chaarawi
- * 2/10/16
- *
- * Changes: Updated sanity checks for the possibility that the skip
- * list is disabled.
- * JRM 5/16/20
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr)
-{
- haddr_t new_addr = HADDR_UNDEF;
- haddr_t old_addr = HADDR_UNDEF;
- size_t new_len = 0;
- unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET;
- herr_t ret_value = SUCCEED;
+ /*-------------------------------------------------------------------------
+ * Function: H5C__generate_image
+ *
+ * Purpose: Serialize an entry and generate its image.
+ *
+ * Note: This may cause the entry to be re-sized and/or moved in
+ * the cache.
+ *
+ * As we will not update the metadata cache's data structures
+ * until we we finish the write, we must touch up these
+ * data structures for size and location changes even if we
+ * are about to delete the entry from the cache (i.e. on a
+ * flush destroy).
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * 2/10/16
+ *
+ * Changes: Updated sanity checks for the possibility that the skip
+ * list is disabled.
+ * JRM 5/16/20
+ *
+ *-------------------------------------------------------------------------
+ */
+ static herr_t H5C__generate_image(H5F_t * f, H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr)
+ {
+ haddr_t new_addr = HADDR_UNDEF;
+ haddr_t old_addr = HADDR_UNDEF;
+ size_t new_len = 0;
+ unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET;
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC
- /* Sanity check */
- HDassert(f);
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(entry_ptr);
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(!entry_ptr->image_up_to_date);
- HDassert(entry_ptr->is_dirty);
- HDassert(!entry_ptr->is_protected);
- HDassert(entry_ptr->type);
+ /* Sanity check */
+ HDassert(f);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(entry_ptr);
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(!entry_ptr->image_up_to_date);
+ HDassert(entry_ptr->is_dirty);
+ HDassert(!entry_ptr->is_protected);
+ HDassert(entry_ptr->type);
- /* make note of the entry's current address */
- old_addr = entry_ptr->addr;
+ /* make note of the entry's current address */
+ old_addr = entry_ptr->addr;
- /* Call client's pre-serialize callback, if there's one */
- if ( ( entry_ptr->type->pre_serialize ) &&
- ( (entry_ptr->type->pre_serialize)(f, (void *)entry_ptr,
- entry_ptr->addr, entry_ptr->size,
- &new_addr, &new_len,
- &serialize_flags) < 0 ) )
+ /* Call client's pre-serialize callback, if there's one */
+ if ((entry_ptr->type->pre_serialize) &&
+ ((entry_ptr->type->pre_serialize)(f, (void *)entry_ptr, entry_ptr->addr, entry_ptr->size,
+ &new_addr, &new_len, &serialize_flags) < 0))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "unable to pre-serialize entry")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to pre-serialize entry")
- /* Check for any flags set in the pre-serialize callback */
- if ( serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET ) {
+ /* Check for any flags set in the pre-serialize callback */
+ if (serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) {
- /* Check for unexpected flags from serialize callback */
- if ( serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG |
- H5C__SERIALIZE_MOVED_FLAG) )
+ /* Check for unexpected flags from serialize callback */
+ if (serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | H5C__SERIALIZE_MOVED_FLAG))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "unknown serialize flag(s)")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unknown serialize flag(s)")
#ifdef H5_HAVE_PARALLEL
- /* In the parallel case, resizes and moves in
- * the serialize operation can cause problems.
- * If they occur, scream and die.
- *
- * At present, in the parallel case, the aux_ptr
- * will only be set if there is more than one
- * process. Thus we can use this to detect
- * the parallel case.
- *
- * This works for now, but if we start using the
- * aux_ptr for other purposes, we will have to
- * change this test accordingly.
- *
- * NB: While this test detects entryies that attempt
- * to resize or move themselves during a flush
- * in the parallel case, it will not detect an
- * entry that dirties, resizes, and/or moves
- * other entries during its flush.
- *
- * From what Quincey tells me, this test is
- * sufficient for now, as any flush routine that
- * does the latter will also do the former.
- *
- * If that ceases to be the case, further
- * tests will be necessary.
- */
- if ( cache_ptr->aux_ptr != NULL )
+ /* In the parallel case, resizes and moves in
+ * the serialize operation can cause problems.
+ * If they occur, scream and die.
+ *
+ * At present, in the parallel case, the aux_ptr
+ * will only be set if there is more than one
+ * process. Thus we can use this to detect
+ * the parallel case.
+ *
+ * This works for now, but if we start using the
+ * aux_ptr for other purposes, we will have to
+ * change this test accordingly.
+ *
+ * NB: While this test detects entryies that attempt
+ * to resize or move themselves during a flush
+ * in the parallel case, it will not detect an
+ * entry that dirties, resizes, and/or moves
+ * other entries during its flush.
+ *
+ * From what Quincey tells me, this test is
+ * sufficient for now, as any flush routine that
+ * does the latter will also do the former.
+ *
+ * If that ceases to be the case, further
+ * tests will be necessary.
+ */
+ if (cache_ptr->aux_ptr != NULL)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "resize/move in serialize occurred in parallel case")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occurred in parallel case")
#endif
- /* If required, resize the buffer and update the entry and the cache
- * data structures
- */
- if ( serialize_flags & H5C__SERIALIZE_RESIZED_FLAG ) {
+ /* If required, resize the buffer and update the entry and the cache
+ * data structures
+ */
+ if (serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) {
- /* Sanity check */
- HDassert(new_len > 0);
+ /* Sanity check */
+ HDassert(new_len > 0);
- /* Allocate a new image buffer */
- if ( NULL == (entry_ptr->image_ptr =
- H5MM_realloc(entry_ptr->image_ptr,
- new_len + H5C_IMAGE_EXTRA_SPACE)) )
+ /* Allocate a new image buffer */
+ if (NULL == (entry_ptr->image_ptr =
+ H5MM_realloc(entry_ptr->image_ptr, new_len + H5C_IMAGE_EXTRA_SPACE)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, \
- "memory allocation failed for on disk image buffer")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
- H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + new_len,
- H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + new_len, H5C_IMAGE_SANITY_VALUE,
+ H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
- /* Update statistics for resizing the entry */
- H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, \
- new_len);
+ /* Update statistics for resizing the entry */
+ H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_len);
- /* Update the hash table for the size change */
- H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \
- new_len, entry_ptr, !(entry_ptr->is_dirty));
+ /* Update the hash table for the size change */
+ H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len, entry_ptr,
+ !(entry_ptr->is_dirty));
- /* The entry can't be protected since we are in the process of
- * flushing it. Thus we must update the replacement policy data
- * structures for the size change. The macro deals with the pinned
- * case.
- */
- H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_len);
+ /* The entry can't be protected since we are in the process of
+ * flushing it. Thus we must update the replacement policy data
+ * structures for the size change. The macro deals with the pinned
+ * case.
+ */
+ H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_len);
- /* As we haven't updated the cache data structures for
- * for the flush or flush destroy yet, the entry should
- * be in the slist if the slist is enabled. Since
- * H5C__UPDATE_SLIST_FOR_SIZE_CHANGE() is a no-op if the
- * slist is enabled, call it un-conditionally.
- */
- HDassert(entry_ptr->is_dirty);
- HDassert((entry_ptr->in_slist) || (!cache_ptr->slist_enabled));
+ /* As we haven't updated the cache data structures for
+ * for the flush or flush destroy yet, the entry should
+ * be in the slist if the slist is enabled. Since
+ * H5C__UPDATE_SLIST_FOR_SIZE_CHANGE() is a no-op if the
+ * slist is enabled, call it un-conditionally.
+ */
+ HDassert(entry_ptr->is_dirty);
+ HDassert((entry_ptr->in_slist) || (!cache_ptr->slist_enabled));
- H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \
- new_len);
+ H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len);
- /* Finally, update the entry for its new size */
- entry_ptr->size = new_len;
+ /* Finally, update the entry for its new size */
+ entry_ptr->size = new_len;
- } /* end if */
+ } /* end if */
- /* If required, udate the entry and the cache data structures
- * for a move
- */
- if ( serialize_flags & H5C__SERIALIZE_MOVED_FLAG ) {
+ /* If required, udate the entry and the cache data structures
+ * for a move
+ */
+ if (serialize_flags & H5C__SERIALIZE_MOVED_FLAG) {
- /* Update stats and entries relocated counter */
- H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr)
+ /* Update stats and entries relocated counter */
+ H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr)
- /* We must update cache data structures for the change in address */
- if ( entry_ptr->addr == old_addr ) {
+ /* We must update cache data structures for the change in address */
+ if (entry_ptr->addr == old_addr) {
- /* Delete the entry from the hash table and the slist */
- H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL);
- H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE);
+ /* Delete the entry from the hash table and the slist */
+ H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL);
+ H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE);
- /* Update the entry for its new address */
- entry_ptr->addr = new_addr;
+ /* Update the entry for its new address */
+ entry_ptr->addr = new_addr;
- /* And then reinsert in the index and slist */
- H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL);
- H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL);
+ /* And then reinsert in the index and slist */
+ H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL);
+ H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL);
- } /* end if */
- else { /* move is already done for us -- just do sanity checks */
+ } /* end if */
+ else { /* move is already done for us -- just do sanity checks */
- HDassert(entry_ptr->addr == new_addr);
- }
- } /* end if */
- } /* end if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) */
+ HDassert(entry_ptr->addr == new_addr);
+ }
+ } /* end if */
+ } /* end if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) */
- /* Serialize object into buffer */
- if ( entry_ptr->type->serialize(f, entry_ptr->image_ptr, entry_ptr->size,
- (void *)entry_ptr) < 0 )
+ /* Serialize object into buffer */
+ if (entry_ptr->type->serialize(f, entry_ptr->image_ptr, entry_ptr->size, (void *)entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to serialize entry")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to serialize entry")
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size,\
- H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE));
+ HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE,
+ H5C_IMAGE_EXTRA_SPACE));
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
- entry_ptr->image_up_to_date = TRUE;
+ entry_ptr->image_up_to_date = TRUE;
- /* Propagate the fact that the entry is serialized up the
- * flush dependency chain if appropriate. Since the image must
- * have been out of date for this function to have been called
- * (see assertion on entry), no need to check that -- only check
- * for flush dependency parents.
- */
- HDassert(entry_ptr->flush_dep_nunser_children == 0);
+ /* Propagate the fact that the entry is serialized up the
+ * flush dependency chain if appropriate. Since the image must
+ * have been out of date for this function to have been called
+ * (see assertion on entry), no need to check that -- only check
+ * for flush dependency parents.
+ */
+ HDassert(entry_ptr->flush_dep_nunser_children == 0);
- if ( entry_ptr->flush_dep_nparents > 0 ) {
+ if (entry_ptr->flush_dep_nparents > 0) {
- if ( H5C__mark_flush_dep_serialized(entry_ptr) < 0 )
+ if (H5C__mark_flush_dep_serialized(entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, \
- "Can't propagate serialization status to fd parents")
- }
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL,
+ "Can't propagate serialization status to fd parents")
+ }
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__generate_image */
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__generate_image */
+ /*-------------------------------------------------------------------------
+ *
+ * Function: H5C_remove_entry
+ *
+ * Purpose: Remove an entry from the cache. Must be not protected, pinned,
+ * dirty, involved in flush dependencies, etc.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * September 17, 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+ herr_t H5C_remove_entry(void *_entry)
+ {
+ H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_entry; /* Entry to remove */
+ H5C_t * cache; /* Cache for file */
+ herr_t ret_value = SUCCEED; /* Return value */
-/*-------------------------------------------------------------------------
- *
- * Function: H5C_remove_entry
- *
- * Purpose: Remove an entry from the cache. Must be not protected, pinned,
- * dirty, involved in flush dependencies, etc.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * September 17, 2016
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5C_remove_entry(void *_entry)
-{
- H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_entry; /* Entry to remove */
- H5C_t *cache; /* Cache for file */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
- /* Sanity checks */
- HDassert(entry);
- HDassert(entry->ring != H5C_RING_UNDEFINED);
- cache = entry->cache_ptr;
- HDassert(cache);
- HDassert(cache->magic == H5C__H5C_T_MAGIC);
-
- /* Check for error conditions */
- if(entry->is_dirty)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove dirty entry from cache")
- if(entry->is_protected)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove protected entry from cache")
- if(entry->is_pinned)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove pinned entry from cache")
- /* NOTE: If these two errors are getting tripped because the entry is
- * in a flush dependency with a freedspace entry, move the checks
- * after the "before evict" message is sent, and add the
- * "child being evicted" message to the "before evict" notify
- * section below. QAK - 2017/08/03
- */
- if(entry->flush_dep_nparents > 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry with flush dependency parents from cache")
- if(entry->flush_dep_nchildren > 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry with flush dependency children from cache")
-
- /* Additional internal cache consistency checks */
- HDassert(!entry->in_slist);
- HDassert(!entry->flush_marker);
- HDassert(!entry->flush_in_progress);
-
- /* Note that the algorithm below is (very) similar to the set of operations
- * in H5C__flush_single_entry() and should be kept in sync with changes
- * to that code. - QAK, 2016/11/30
- */
+ /* Sanity checks */
+ HDassert(entry);
+ HDassert(entry->ring != H5C_RING_UNDEFINED);
+ cache = entry->cache_ptr;
+ HDassert(cache);
+ HDassert(cache->magic == H5C__H5C_T_MAGIC);
+
+ /* Check for error conditions */
+ if (entry->is_dirty)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove dirty entry from cache")
+ if (entry->is_protected)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove protected entry from cache")
+ if (entry->is_pinned)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove pinned entry from cache")
+ /* NOTE: If these two errors are getting tripped because the entry is
+ * in a flush dependency with a freedspace entry, move the checks
+ * after the "before evict" message is sent, and add the
+ * "child being evicted" message to the "before evict" notify
+ * section below. QAK - 2017/08/03
+ */
+ if (entry->flush_dep_nparents > 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL,
+ "can't remove entry with flush dependency parents from cache")
+ if (entry->flush_dep_nchildren > 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL,
+ "can't remove entry with flush dependency children from cache")
+
+ /* Additional internal cache consistency checks */
+ HDassert(!entry->in_slist);
+ HDassert(!entry->flush_marker);
+ HDassert(!entry->flush_in_progress);
+
+ /* Note that the algorithm below is (very) similar to the set of operations
+ * in H5C__flush_single_entry() and should be kept in sync with changes
+ * to that code. - QAK, 2016/11/30
+ */
- /* Update stats, as if we are "destroying" and taking ownership of the entry */
- H5C__UPDATE_STATS_FOR_EVICTION(cache, entry, TRUE)
+ /* Update stats, as if we are "destroying" and taking ownership of the entry */
+ H5C__UPDATE_STATS_FOR_EVICTION(cache, entry, TRUE)
- /* If the entry's type has a 'notify' callback, send a 'before eviction'
- * notice while the entry is still fully integrated in the cache.
- */
- if(entry->type->notify && (entry->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, entry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry to evict")
-
- /* Update the cache internal data structures as appropriate for a destroy.
- * Specifically:
- * 1) Delete it from the index
- * 2) Delete it from the collective read access list
- * 3) Update the replacement policy for eviction
- * 4) Remove it from the tag list for this object
- */
+ /* If the entry's type has a 'notify' callback, send a 'before eviction'
+ * notice while the entry is still fully integrated in the cache.
+ */
+ if (entry->type->notify && (entry->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, entry) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry to evict")
+
+ /* Update the cache internal data structures as appropriate for a destroy.
+ * Specifically:
+ * 1) Delete it from the index
+ * 2) Delete it from the collective read access list
+ * 3) Update the replacement policy for eviction
+ * 4) Remove it from the tag list for this object
+ */
- H5C__DELETE_FROM_INDEX(cache, entry, FAIL)
+ H5C__DELETE_FROM_INDEX(cache, entry, FAIL)
#ifdef H5_HAVE_PARALLEL
- /* Check for collective read access flag */
- if(entry->coll_access) {
- entry->coll_access = FALSE;
- H5C__REMOVE_FROM_COLL_LIST(cache, entry, FAIL)
- } /* end if */
-#endif /* H5_HAVE_PARALLEL */
+ /* Check for collective read access flag */
+ if (entry->coll_access) {
+ entry->coll_access = FALSE;
+ H5C__REMOVE_FROM_COLL_LIST(cache, entry, FAIL)
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
- H5C__UPDATE_RP_FOR_EVICTION(cache, entry, FAIL)
+ H5C__UPDATE_RP_FOR_EVICTION(cache, entry, FAIL)
- /* Remove entry from tag list */
- if(H5C__untag_entry(cache, entry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list")
+ /* Remove entry from tag list */
+ if (H5C__untag_entry(cache, entry) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list")
- /* Increment entries_removed_counter and set last_entry_removed_ptr.
- * As we me be about to free the entry, recall that last_entry_removed_ptr
- * must NEVER be dereferenced.
- *
- * Recall that these fields are maintained to allow functions that perform
- * scans of lists of entries to detect the unexpected removal of entries
- * (via expunge, eviction, or take ownership at present), so that they can
- * re-start their scans if necessary.
- *
- * Also check if the entry we are watching for removal is being
- * removed (usually the 'next' entry for an iteration) and reset
- * it to indicate that it was removed.
- */
- cache->entries_removed_counter++;
- cache->last_entry_removed_ptr = entry;
- if(entry == cache->entry_watched_for_removal)
- cache->entry_watched_for_removal = NULL;
+ /* Increment entries_removed_counter and set last_entry_removed_ptr.
+ * As we me be about to free the entry, recall that last_entry_removed_ptr
+ * must NEVER be dereferenced.
+ *
+ * Recall that these fields are maintained to allow functions that perform
+ * scans of lists of entries to detect the unexpected removal of entries
+ * (via expunge, eviction, or take ownership at present), so that they can
+ * re-start their scans if necessary.
+ *
+ * Also check if the entry we are watching for removal is being
+ * removed (usually the 'next' entry for an iteration) and reset
+ * it to indicate that it was removed.
+ */
+ cache->entries_removed_counter++;
+ cache->last_entry_removed_ptr = entry;
+ if (entry == cache->entry_watched_for_removal)
+ cache->entry_watched_for_removal = NULL;
- /* Internal cache data structures should now be up to date, and
- * consistent with the status of the entry.
- *
- * Now clean up internal cache fields if appropriate.
- */
+ /* Internal cache data structures should now be up to date, and
+ * consistent with the status of the entry.
+ *
+ * Now clean up internal cache fields if appropriate.
+ */
- /* Free the buffer for the on disk image */
- if(entry->image_ptr != NULL)
- entry->image_ptr = H5MM_xfree(entry->image_ptr);
+ /* Free the buffer for the on disk image */
+ if (entry->image_ptr != NULL)
+ entry->image_ptr = H5MM_xfree(entry->image_ptr);
- /* Reset the pointer to the cache the entry is within */
- entry->cache_ptr = NULL;
+ /* Reset the pointer to the cache the entry is within */
+ entry->cache_ptr = NULL;
- /* Client is taking ownership of the entry. Set bad magic here so the
- * cache will choke unless the entry is re-inserted properly
- */
- entry->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
+ /* Client is taking ownership of the entry. Set bad magic here so the
+ * cache will choke unless the entry is re-inserted properly
+ */
+ entry->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C__remove_entry() */
-
+ FUNC_LEAVE_NOAPI(ret_value)
+ } /* H5C__remove_entry() */
diff --git a/src/H5CS.c b/src/H5CS.c
index 324d383..5a93c87 100644
--- a/src/H5CS.c
+++ b/src/H5CS.c
@@ -25,20 +25,19 @@
*
*/
-
-#include "H5private.h" /* Generic Functions */
-#include "H5CSprivate.h" /* Function stack */
-#include "H5Eprivate.h" /* Error handling */
+#include "H5private.h" /* Generic Functions */
+#include "H5CSprivate.h" /* Function stack */
+#include "H5Eprivate.h" /* Error handling */
#ifdef H5_HAVE_CODESTACK
-#define H5CS_MIN_NSLOTS 16 /* Minimum number of records in an function stack */
+#define H5CS_MIN_NSLOTS 16 /* Minimum number of records in an function stack */
/* A function stack */
typedef struct H5CS_t {
- unsigned nused; /* Number of records currently used in stack */
- unsigned nalloc; /* Number of records current allocated for stack */
- const char **rec; /* Array of function records */
+ unsigned nused; /* Number of records currently used in stack */
+ unsigned nalloc; /* Number of records current allocated for stack */
+ const char **rec; /* Array of function records */
} H5CS_t;
#ifdef H5_HAVE_THREADSAFE
@@ -52,17 +51,16 @@ typedef struct H5CS_t {
* by "H5CS_t *fstack =".
*/
static H5CS_t *H5CS__get_stack(void);
-#define H5CS_get_my_stack() H5CS__get_stack()
+#define H5CS_get_my_stack() H5CS__get_stack()
#else /* H5_HAVE_THREADSAFE */
/*
* The function stack. Eventually we'll have some sort of global table so each
* thread has it's own stack. The stacks will be created on demand when the
* thread first calls H5CS_push(). */
-H5CS_t H5CS_stack_g[1];
-#define H5CS_get_my_stack() (H5CS_stack_g+0)
+H5CS_t H5CS_stack_g[1];
+#define H5CS_get_my_stack() (H5CS_stack_g + 0)
#endif /* H5_HAVE_THREADSAFE */
-
#ifdef H5_HAVE_THREADSAFE
/*-------------------------------------------------------------------------
* Function: H5CS__get_stack
@@ -87,19 +85,21 @@ H5CS__get_stack(void)
FUNC_ENTER_STATIC_NOERR_NOFS
fstack = H5TS_get_thread_local_value(H5TS_funcstk_key_g);
- if(!fstack) {
+ if (!fstack) {
/* No associated value with current thread - create one */
#ifdef H5_HAVE_WIN_THREADS
- fstack = (H5CS_t *)LocalAlloc(LPTR, sizeof(H5CS_t)); /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */
+ fstack = (H5CS_t *)LocalAlloc(
+ LPTR, sizeof(H5CS_t)); /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */
#else
- fstack = (H5CS_t *)HDmalloc(sizeof(H5CS_t)); /* Don't use H5MM_malloc() here, it causes infinite recursion */
+ fstack = (H5CS_t *)HDmalloc(
+ sizeof(H5CS_t)); /* Don't use H5MM_malloc() here, it causes infinite recursion */
#endif /* H5_HAVE_WIN_THREADS */
HDassert(fstack);
/* Set the thread-specific info */
- fstack->nused = 0;
+ fstack->nused = 0;
fstack->nalloc = 0;
- fstack->rec = NULL;
+ fstack->rec = NULL;
/* (It's not necessary to release this in this API, it is
* released by the "key destructor" set up in the H5TS
@@ -110,9 +110,8 @@ H5CS__get_stack(void)
FUNC_LEAVE_NOAPI_NOFS(fstack)
} /* end H5CS__get_stack() */
-#endif /* H5_HAVE_THREADSAFE */
+#endif /* H5_HAVE_THREADSAFE */
-
/*-------------------------------------------------------------------------
* Function: H5CS_print_stack
*
@@ -128,8 +127,8 @@ H5CS__get_stack(void)
herr_t
H5CS_print_stack(const H5CS_t *fstack, FILE *stream)
{
- const int indent = 2; /* Indention level */
- int i; /* Local index ariable */
+ const int indent = 2; /* Indention level */
+ int i; /* Local index ariable */
/* Don't push this function on the function stack... :-) */
FUNC_ENTER_NOAPI_NOERR_NOFS
@@ -138,23 +137,22 @@ H5CS_print_stack(const H5CS_t *fstack, FILE *stream)
HDassert(fstack);
/* Default to outputting information to stderr */
- if(!stream)
+ if (!stream)
stream = stderr;
HDfprintf(stream, "HDF5-DIAG: Function stack from %s ", H5_lib_vers_info_g);
/* try show the process or thread id in multiple processes cases*/
HDfprintf(stream, "thread %" PRIu64 ".", H5TS_thread_id());
- if(fstack && fstack->nused>0)
+ if (fstack && fstack->nused > 0)
HDfprintf(stream, " Back trace follows.");
HDfputc('\n', stream);
- for(i = fstack->nused - 1; i >= 0; --i)
+ for (i = fstack->nused - 1; i >= 0; --i)
HDfprintf(stream, "%*s#%03d: Routine: %s\n", indent, "", i, fstack->rec[i]);
FUNC_LEAVE_NOAPI_NOFS(SUCCEED)
} /* end H5CS_print_stack() */
-
/*-------------------------------------------------------------------------
* Function: H5CS_push
*
@@ -171,7 +169,7 @@ H5CS_print_stack(const H5CS_t *fstack, FILE *stream)
herr_t
H5CS_push(const char *func_name)
{
- H5CS_t *fstack = H5CS_get_my_stack(); /* Current function stack for library */
+ H5CS_t *fstack = H5CS_get_my_stack(); /* Current function stack for library */
/* Don't push this function on the function stack... :-) */
FUNC_ENTER_NOAPI_NOERR_NOFS
@@ -182,7 +180,7 @@ H5CS_push(const char *func_name)
HDassert(func_name);
/* Check if we need to expand the stack of records */
- if(fstack->nused == fstack->nalloc) {
+ if (fstack->nused == fstack->nalloc) {
size_t na = MAX((fstack->nalloc * 2), H5CS_MIN_NSLOTS);
/* Don't use H5MM_realloc here */
@@ -190,7 +188,7 @@ H5CS_push(const char *func_name)
/* (Avoid returning an error from this routine, currently -QAK) */
HDassert(x);
- fstack->rec = x;
+ fstack->rec = x;
fstack->nalloc = na;
} /* end if */
@@ -201,7 +199,6 @@ H5CS_push(const char *func_name)
FUNC_LEAVE_NOAPI_NOFS(SUCCEED)
} /* end H5CS_push() */
-
/*-------------------------------------------------------------------------
* Function: H5CS_pop
*
@@ -217,7 +214,7 @@ H5CS_push(const char *func_name)
herr_t
H5CS_pop(void)
{
- H5CS_t *fstack = H5CS_get_my_stack();
+ H5CS_t *fstack = H5CS_get_my_stack();
/* Don't push this function on the function stack... :-) */
FUNC_ENTER_NOAPI_NOERR_NOFS
@@ -232,7 +229,6 @@ H5CS_pop(void)
FUNC_LEAVE_NOAPI_NOFS(SUCCEED);
} /* end H5CS_pop() */
-
/*-------------------------------------------------------------------------
* Function: H5CS_copy_stack
*
@@ -248,10 +244,10 @@ H5CS_pop(void)
H5CS_t *
H5CS_copy_stack(void)
{
- H5CS_t *old_stack = H5CS_get_my_stack(); /* Existing function stack for library */
- H5CS_t *new_stack; /* New function stack, for copy */
- unsigned u; /* Local index variable */
- H5CS_t *ret_value = NULL; /* Return value */
+ H5CS_t * old_stack = H5CS_get_my_stack(); /* Existing function stack for library */
+ H5CS_t * new_stack; /* New function stack, for copy */
+ unsigned u; /* Local index variable */
+ H5CS_t * ret_value = NULL; /* Return value */
/* Don't push this function on the function stack... :-) */
FUNC_ENTER_NOAPI_NOFS
@@ -261,13 +257,13 @@ H5CS_copy_stack(void)
/* Allocate a new stack */
/* (Don't use library allocate code, since this code stack supports it) */
- if(NULL == (new_stack = HDcalloc(1, sizeof(H5CS_t))))
+ if (NULL == (new_stack = HDcalloc(1, sizeof(H5CS_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack")
- if(NULL == (new_stack->rec = HDcalloc(old_stack->nused, sizeof(const char *))))
+ if (NULL == (new_stack->rec = HDcalloc(old_stack->nused, sizeof(const char *))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack records")
/* Copy old stack to new one, duplicating the strings */
- for(u = 0; u < old_stack->nused; u++)
+ for (u = 0; u < old_stack->nused; u++)
new_stack->rec[u] = HDstrdup(old_stack->rec[u]);
new_stack->nused = new_stack->nalloc = old_stack->nused;
@@ -278,7 +274,6 @@ done:
FUNC_LEAVE_NOAPI_NOFS(ret_value)
} /* end H5CS_copy_stack() */
-
/*-------------------------------------------------------------------------
* Function: H5CS_close_stack
*
@@ -294,7 +289,7 @@ done:
herr_t
H5CS_close_stack(H5CS_t *stack)
{
- unsigned u; /* Local index variable */
+ unsigned u; /* Local index variable */
/* Don't push this function on the function stack... :-) */
FUNC_ENTER_NOAPI_NOERR_NOFS
@@ -303,20 +298,19 @@ H5CS_close_stack(H5CS_t *stack)
HDassert(stack);
/* Free stack */
- for(u = 0; u < stack->nused; u++) {
- if(stack->rec[u])
+ for (u = 0; u < stack->nused; u++) {
+ if (stack->rec[u])
HDfree((void *)stack->rec[u]);
stack->rec[u] = NULL;
} /* end for */
- if(stack->rec) {
+ if (stack->rec) {
HDfree(stack->rec);
stack->rec = NULL;
} /* end if */
- if(stack)
+ if (stack)
HDfree(stack);
FUNC_LEAVE_NOAPI_NOFS(SUCCEED)
} /* end H5CS_close_stack() */
#endif /* H5_HAVE_CODESTACK */
-
diff --git a/src/H5CSprivate.h b/src/H5CSprivate.h
index 467dd9d..c86b209 100644
--- a/src/H5CSprivate.h
+++ b/src/H5CSprivate.h
@@ -26,11 +26,10 @@
/* Forward declarations for structure fields */
struct H5CS_t;
-H5_DLL herr_t H5CS_push(const char *func_name);
-H5_DLL herr_t H5CS_pop(void);
-H5_DLL herr_t H5CS_print_stack(const struct H5CS_t *stack, FILE *stream);
+H5_DLL herr_t H5CS_push(const char *func_name);
+H5_DLL herr_t H5CS_pop(void);
+H5_DLL herr_t H5CS_print_stack(const struct H5CS_t *stack, FILE *stream);
H5_DLL struct H5CS_t *H5CS_copy_stack(void);
-H5_DLL herr_t H5CS_close_stack(struct H5CS_t *stack);
+H5_DLL herr_t H5CS_close_stack(struct H5CS_t *stack);
#endif /* _H5CSprivate_H */
-
diff --git a/src/H5CX.c b/src/H5CX.c
index 6beaf56..d276b94 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -24,23 +24,20 @@
/* Module Setup */
/****************/
-#include "H5CXmodule.h" /* This source code file is part of the H5CX module */
-
-
+#include "H5CXmodule.h" /* This source code file is part of the H5CX module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
/****************/
/* Local Macros */
@@ -56,7 +53,7 @@
* In order for this macro to work, H5CX_get_my_context() must be preceeded
* by "H5CX_node_t *ctx =".
*/
-#define H5CX_get_my_context() H5CX__get_context()
+#define H5CX_get_my_context() H5CX__get_context()
#else /* H5_HAVE_THREADSAFE */
/*
* The current API context.
@@ -65,84 +62,84 @@
#endif /* H5_HAVE_THREADSAFE */
/* Common macro for the retrieving the pointer to a property list */
-#define H5CX_RETRIEVE_PLIST(PL, FAILVAL) \
- /* Check if the property list is already available */ \
- if(NULL == (*head)->ctx.PL) \
- /* Get the property list pointer */ \
- if(NULL == ((*head)->ctx.PL = (H5P_genplist_t *)H5I_object((*head)->ctx.H5_GLUE(PL,_id)))) \
+#define H5CX_RETRIEVE_PLIST(PL, FAILVAL) \
+ /* Check if the property list is already available */ \
+ if (NULL == (*head)->ctx.PL) \
+ /* Get the property list pointer */ \
+ if (NULL == ((*head)->ctx.PL = (H5P_genplist_t *)H5I_object((*head)->ctx.H5_GLUE(PL, _id)))) \
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, (FAILVAL), "can't get property list")
/* Common macro for the duplicated code to retrieve properties from a property list */
-#define H5CX_RETRIEVE_PROP_COMMON(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
- /* Check for default property list */ \
- if((*head)->ctx.H5_GLUE(PL,_id) == (DEF_PL)) \
- H5MM_memcpy(&(*head)->ctx.PROP_FIELD, &H5_GLUE3(H5CX_def_,PL,_cache).PROP_FIELD, sizeof(H5_GLUE3(H5CX_def_,PL,_cache).PROP_FIELD)); \
- else { \
- /* Retrieve the property list */ \
- H5CX_RETRIEVE_PLIST(PL, FAIL) \
- \
- /* Get the property */ \
- if(H5P_get((*head)->ctx.PL, (PROP_NAME), &(*head)->ctx.PROP_FIELD) < 0) \
- HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't retrieve value from API context") \
- } /* end else */ \
- \
- /* Mark the field as valid */ \
- (*head)->ctx.H5_GLUE(PROP_FIELD,_valid) = TRUE;
+#define H5CX_RETRIEVE_PROP_COMMON(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
+ /* Check for default property list */ \
+ if ((*head)->ctx.H5_GLUE(PL, _id) == (DEF_PL)) \
+ H5MM_memcpy(&(*head)->ctx.PROP_FIELD, &H5_GLUE3(H5CX_def_, PL, _cache).PROP_FIELD, \
+ sizeof(H5_GLUE3(H5CX_def_, PL, _cache).PROP_FIELD)); \
+ else { \
+ /* Retrieve the property list */ \
+ H5CX_RETRIEVE_PLIST(PL, FAIL) \
+ \
+ /* Get the property */ \
+ if (H5P_get((*head)->ctx.PL, (PROP_NAME), &(*head)->ctx.PROP_FIELD) < 0) \
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't retrieve value from API context") \
+ } /* end else */ \
+ \
+ /* Mark the field as valid */ \
+ (*head)->ctx.H5_GLUE(PROP_FIELD, _valid) = TRUE;
/* Macro for the duplicated code to retrieve properties from a property list */
-#define H5CX_RETRIEVE_PROP_VALID(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
- /* Check if the value has been retrieved already */ \
- if(!(*head)->ctx.H5_GLUE(PROP_FIELD,_valid)) { \
- H5CX_RETRIEVE_PROP_COMMON(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
+#define H5CX_RETRIEVE_PROP_VALID(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
+ /* Check if the value has been retrieved already */ \
+ if (!(*head)->ctx.H5_GLUE(PROP_FIELD, _valid)) { \
+ H5CX_RETRIEVE_PROP_COMMON(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
} /* end if */
#ifdef H5_HAVE_PARALLEL
/* Macro for the duplicated code to retrieve possibly set properties from a property list */
-#define H5CX_RETRIEVE_PROP_VALID_SET(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
- /* Check if the value has been retrieved already */ \
- if(!((*head)->ctx.H5_GLUE(PROP_FIELD,_valid) || (*head)->ctx.H5_GLUE(PROP_FIELD,_set))) { \
- H5CX_RETRIEVE_PROP_COMMON(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
- } /* end if */
+#define H5CX_RETRIEVE_PROP_VALID_SET(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
+ /* Check if the value has been retrieved already */ \
+ if (!((*head)->ctx.H5_GLUE(PROP_FIELD, _valid) || (*head)->ctx.H5_GLUE(PROP_FIELD, _set))) { \
+ H5CX_RETRIEVE_PROP_COMMON(PL, DEF_PL, PROP_NAME, PROP_FIELD) \
+ } /* end if */
#endif /* H5_HAVE_PARALLEL */
#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_INSTRUMENTED_LIBRARY)
/* Macro for the duplicated code to test and set properties for a property list */
-#define H5CX_TEST_SET_PROP(PROP_NAME, PROP_FIELD) \
-{ \
- htri_t check_prop = 0; /* Whether the property exists in the API context's DXPL */ \
- \
- /* Check if property exists in DXPL */ \
- if(!(*head)->ctx.H5_GLUE(PROP_FIELD,_set)) { \
- /* Retrieve the dataset transfer property list */ \
- H5CX_RETRIEVE_PLIST(dxpl, FAIL) \
- \
- if((check_prop = H5P_exist_plist((*head)->ctx.dxpl, PROP_NAME)) < 0) \
- HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "error checking for property") \
- } /* end if */ \
- \
- /* If property was already set or exists (for first set), update it */ \
- if((*head)->ctx.H5_GLUE(PROP_FIELD,_set) || check_prop > 0) { \
- /* Cache the value for later, marking it to set in DXPL when context popped */ \
- (*head)->ctx.PROP_FIELD = PROP_FIELD; \
- (*head)->ctx.H5_GLUE(PROP_FIELD,_set) = TRUE; \
- } /* end if */ \
-}
+#define H5CX_TEST_SET_PROP(PROP_NAME, PROP_FIELD) \
+ { \
+ htri_t check_prop = 0; /* Whether the property exists in the API context's DXPL */ \
+ \
+ /* Check if property exists in DXPL */ \
+ if (!(*head)->ctx.H5_GLUE(PROP_FIELD, _set)) { \
+ /* Retrieve the dataset transfer property list */ \
+ H5CX_RETRIEVE_PLIST(dxpl, FAIL) \
+ \
+ if ((check_prop = H5P_exist_plist((*head)->ctx.dxpl, PROP_NAME)) < 0) \
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "error checking for property") \
+ } /* end if */ \
+ \
+ /* If property was already set or exists (for first set), update it */ \
+ if ((*head)->ctx.H5_GLUE(PROP_FIELD, _set) || check_prop > 0) { \
+ /* Cache the value for later, marking it to set in DXPL when context popped */ \
+ (*head)->ctx.PROP_FIELD = PROP_FIELD; \
+ (*head)->ctx.H5_GLUE(PROP_FIELD, _set) = TRUE; \
+ } /* end if */ \
+ }
#endif /* defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_INSTRUMENTED_LIBRARY) */
#ifdef H5_HAVE_PARALLEL
/* Macro for the duplicated code to test and set properties for a property list */
-#define H5CX_SET_PROP(PROP_NAME, PROP_FIELD) \
- if((*head)->ctx.H5_GLUE(PROP_FIELD,_set)) { \
- /* Retrieve the dataset transfer property list */ \
- H5CX_RETRIEVE_PLIST(dxpl, NULL) \
- \
- /* Set the property */ \
- if(H5P_set((*head)->ctx.dxpl, PROP_NAME, &(*head)->ctx.PROP_FIELD) < 0) \
- HGOTO_ERROR(H5E_CONTEXT, H5E_CANTSET, NULL, "error setting data xfer property") \
- } /* end if */
+#define H5CX_SET_PROP(PROP_NAME, PROP_FIELD) \
+ if ((*head)->ctx.H5_GLUE(PROP_FIELD, _set)) { \
+ /* Retrieve the dataset transfer property list */ \
+ H5CX_RETRIEVE_PLIST(dxpl, NULL) \
+ \
+ /* Set the property */ \
+ if (H5P_set((*head)->ctx.dxpl, PROP_NAME, &(*head)->ctx.PROP_FIELD) < 0) \
+ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTSET, NULL, "error setting data xfer property") \
+ } /* end if */
#endif /* H5_HAVE_PARALLEL */
-
/******************/
/* Local Typedefs */
/******************/
@@ -180,142 +177,162 @@
*/
typedef struct H5CX_t {
/* DXPL */
- hid_t dxpl_id; /* DXPL ID for API operation */
- H5P_genplist_t *dxpl; /* Dataset Transfer Property List */
+ hid_t dxpl_id; /* DXPL ID for API operation */
+ H5P_genplist_t *dxpl; /* Dataset Transfer Property List */
/* LCPL */
- hid_t lcpl_id; /* LCPL ID for API operation */
- H5P_genplist_t *lcpl; /* Link Creation Property List */
+ hid_t lcpl_id; /* LCPL ID for API operation */
+ H5P_genplist_t *lcpl; /* Link Creation Property List */
/* LAPL */
- hid_t lapl_id; /* LAPL ID for API operation */
- H5P_genplist_t *lapl; /* Link Access Property List */
+ hid_t lapl_id; /* LAPL ID for API operation */
+ H5P_genplist_t *lapl; /* Link Access Property List */
/* DCPL */
- hid_t dcpl_id; /* DCPL ID for API operation */
- H5P_genplist_t *dcpl; /* Dataset Creation Property List */
+ hid_t dcpl_id; /* DCPL ID for API operation */
+ H5P_genplist_t *dcpl; /* Dataset Creation Property List */
/* DAPL */
- hid_t dapl_id; /* DAPL ID for API operation */
- H5P_genplist_t *dapl; /* Dataset Access Property List */
+ hid_t dapl_id; /* DAPL ID for API operation */
+ H5P_genplist_t *dapl; /* Dataset Access Property List */
/* FAPL */
- hid_t fapl_id; /* FAPL ID for API operation */
- H5P_genplist_t *fapl; /* File Access Property List */
+ hid_t fapl_id; /* FAPL ID for API operation */
+ H5P_genplist_t *fapl; /* File Access Property List */
/* Internal: Object tagging info */
- haddr_t tag; /* Current object's tag (ohdr chunk #0 address) */
+ haddr_t tag; /* Current object's tag (ohdr chunk #0 address) */
/* Internal: Metadata cache info */
- H5AC_ring_t ring; /* Current metadata cache ring for entries */
+ H5AC_ring_t ring; /* Current metadata cache ring for entries */
#ifdef H5_HAVE_PARALLEL
/* Internal: Parallel I/O settings */
- hbool_t coll_metadata_read; /* Whether to use collective I/O for metadata read */
- MPI_Datatype btype; /* MPI datatype for buffer, when using collective I/O */
- MPI_Datatype ftype; /* MPI datatype for file, when using collective I/O */
- hbool_t mpi_file_flushing; /* Whether an MPI-opened file is being flushed */
- hbool_t rank0_bcast; /* Whether a dataset meets read-with-rank0-and-bcast requirements */
-#endif /* H5_HAVE_PARALLEL */
+ hbool_t coll_metadata_read; /* Whether to use collective I/O for metadata read */
+ MPI_Datatype btype; /* MPI datatype for buffer, when using collective I/O */
+ MPI_Datatype ftype; /* MPI datatype for file, when using collective I/O */
+ hbool_t mpi_file_flushing; /* Whether an MPI-opened file is being flushed */
+ hbool_t rank0_bcast; /* Whether a dataset meets read-with-rank0-and-bcast requirements */
+#endif /* H5_HAVE_PARALLEL */
/* Cached DXPL properties */
- size_t max_temp_buf; /* Maximum temporary buffer size */
- hbool_t max_temp_buf_valid; /* Whether maximum temporary buffer size is valid */
- void *tconv_buf; /* Temporary conversion buffer (H5D_XFER_TCONV_BUF_NAME) */
- hbool_t tconv_buf_valid; /* Whether temporary conversion buffer is valid */
- void *bkgr_buf; /* Background conversion buffer (H5D_XFER_BKGR_BUF_NAME) */
- hbool_t bkgr_buf_valid; /* Whether background conversion buffer is valid */
- H5T_bkg_t bkgr_buf_type; /* Background buffer type (H5D_XFER_BKGR_BUF_NAME) */
- hbool_t bkgr_buf_type_valid;/* Whether background buffer type is valid */
- double btree_split_ratio[3]; /* B-tree split ratios */
- hbool_t btree_split_ratio_valid; /* Whether B-tree split ratios are valid */
- size_t vec_size; /* Size of hyperslab vector (H5D_XFER_HYPER_VECTOR_SIZE_NAME) */
- hbool_t vec_size_valid; /* Whether hyperslab vector is valid */
+ size_t max_temp_buf; /* Maximum temporary buffer size */
+ hbool_t max_temp_buf_valid; /* Whether maximum temporary buffer size is valid */
+ void * tconv_buf; /* Temporary conversion buffer (H5D_XFER_TCONV_BUF_NAME) */
+ hbool_t tconv_buf_valid; /* Whether temporary conversion buffer is valid */
+ void * bkgr_buf; /* Background conversion buffer (H5D_XFER_BKGR_BUF_NAME) */
+ hbool_t bkgr_buf_valid; /* Whether background conversion buffer is valid */
+ H5T_bkg_t bkgr_buf_type; /* Background buffer type (H5D_XFER_BKGR_BUF_NAME) */
+ hbool_t bkgr_buf_type_valid; /* Whether background buffer type is valid */
+ double btree_split_ratio[3]; /* B-tree split ratios */
+ hbool_t btree_split_ratio_valid; /* Whether B-tree split ratios are valid */
+ size_t vec_size; /* Size of hyperslab vector (H5D_XFER_HYPER_VECTOR_SIZE_NAME) */
+ hbool_t vec_size_valid; /* Whether hyperslab vector is valid */
#ifdef H5_HAVE_PARALLEL
H5FD_mpio_xfer_t io_xfer_mode; /* Parallel transfer mode for this request (H5D_XFER_IO_XFER_MODE_NAME) */
- hbool_t io_xfer_mode_valid; /* Whether parallel transfer mode is valid */
- H5FD_mpio_collective_opt_t mpio_coll_opt; /* Parallel transfer with independent IO or collective IO with this mode (H5D_XFER_MPIO_COLLECTIVE_OPT_NAME) */
- hbool_t mpio_coll_opt_valid; /* Whether parallel transfer option is valid */
- H5FD_mpio_chunk_opt_t mpio_chunk_opt_mode; /* Collective chunk option (H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME) */
- hbool_t mpio_chunk_opt_mode_valid; /* Whether collective chunk option is valid */
- unsigned mpio_chunk_opt_num; /* Collective chunk thrreshold (H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME) */
- hbool_t mpio_chunk_opt_num_valid; /* Whether collective chunk threshold is valid */
- unsigned mpio_chunk_opt_ratio; /* Collective chunk ratio (H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME) */
- hbool_t mpio_chunk_opt_ratio_valid; /* Whether collective chunk ratio is valid */
-#endif /* H5_HAVE_PARALLEL */
- H5Z_EDC_t err_detect; /* Error detection info (H5D_XFER_EDC_NAME) */
- hbool_t err_detect_valid; /* Whether error detection info is valid */
- H5Z_cb_t filter_cb; /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */
- hbool_t filter_cb_valid; /* Whether filter callback function is valid */
- H5Z_data_xform_t *data_transform; /* Data transform info (H5D_XFER_XFORM_NAME) */
- hbool_t data_transform_valid; /* Whether data transform info is valid */
- H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */
- hbool_t vl_alloc_info_valid; /* Whether VL datatype alloc info is valid */
- H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */
- hbool_t dt_conv_cb_valid; /* Whether datatype conversion struct is valid */
+ hbool_t io_xfer_mode_valid; /* Whether parallel transfer mode is valid */
+ H5FD_mpio_collective_opt_t mpio_coll_opt; /* Parallel transfer with independent IO or collective IO with
+ this mode (H5D_XFER_MPIO_COLLECTIVE_OPT_NAME) */
+ hbool_t mpio_coll_opt_valid; /* Whether parallel transfer option is valid */
+ H5FD_mpio_chunk_opt_t
+ mpio_chunk_opt_mode; /* Collective chunk option (H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME) */
+ hbool_t mpio_chunk_opt_mode_valid; /* Whether collective chunk option is valid */
+ unsigned mpio_chunk_opt_num; /* Collective chunk thrreshold (H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME) */
+ hbool_t mpio_chunk_opt_num_valid; /* Whether collective chunk threshold is valid */
+ unsigned mpio_chunk_opt_ratio; /* Collective chunk ratio (H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME) */
+ hbool_t mpio_chunk_opt_ratio_valid; /* Whether collective chunk ratio is valid */
+#endif /* H5_HAVE_PARALLEL */
+ H5Z_EDC_t err_detect; /* Error detection info (H5D_XFER_EDC_NAME) */
+ hbool_t err_detect_valid; /* Whether error detection info is valid */
+ H5Z_cb_t filter_cb; /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */
+ hbool_t filter_cb_valid; /* Whether filter callback function is valid */
+ H5Z_data_xform_t * data_transform; /* Data transform info (H5D_XFER_XFORM_NAME) */
+ hbool_t data_transform_valid; /* Whether data transform info is valid */
+ H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */
+ hbool_t vl_alloc_info_valid; /* Whether VL datatype alloc info is valid */
+ H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */
+ hbool_t dt_conv_cb_valid; /* Whether datatype conversion struct is valid */
/* Return-only DXPL properties to return to application */
#ifdef H5_HAVE_PARALLEL
- H5D_mpio_actual_chunk_opt_mode_t mpio_actual_chunk_opt; /* Chunk optimization mode used for parallel I/O (H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME) */
+ H5D_mpio_actual_chunk_opt_mode_t mpio_actual_chunk_opt; /* Chunk optimization mode used for parallel I/O
+ (H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME) */
hbool_t mpio_actual_chunk_opt_set; /* Whether chunk optimization mode used for parallel I/O is set */
- H5D_mpio_actual_io_mode_t mpio_actual_io_mode; /* Actual I/O mode used for parallel I/O (H5D_MPIO_ACTUAL_IO_MODE_NAME) */
- hbool_t mpio_actual_io_mode_set; /* Whether actual I/O mode used for parallel I/O is set */
- uint32_t mpio_local_no_coll_cause; /* Local reason for breaking collective I/O (H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME) */
- hbool_t mpio_local_no_coll_cause_set; /* Whether local reason for breaking collective I/O is set */
- hbool_t mpio_local_no_coll_cause_valid; /* Whether local reason for breaking collective I/O is valid */
- uint32_t mpio_global_no_coll_cause; /* Global reason for breaking collective I/O (H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME) */
- hbool_t mpio_global_no_coll_cause_set; /* Whether global reason for breaking collective I/O is set */
+ H5D_mpio_actual_io_mode_t
+ mpio_actual_io_mode; /* Actual I/O mode used for parallel I/O (H5D_MPIO_ACTUAL_IO_MODE_NAME) */
+ hbool_t mpio_actual_io_mode_set; /* Whether actual I/O mode used for parallel I/O is set */
+ uint32_t mpio_local_no_coll_cause; /* Local reason for breaking collective I/O
+ (H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME) */
+ hbool_t mpio_local_no_coll_cause_set; /* Whether local reason for breaking collective I/O is set */
+ hbool_t mpio_local_no_coll_cause_valid; /* Whether local reason for breaking collective I/O is valid */
+ uint32_t mpio_global_no_coll_cause; /* Global reason for breaking collective I/O
+ (H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME) */
+ hbool_t mpio_global_no_coll_cause_set; /* Whether global reason for breaking collective I/O is set */
hbool_t mpio_global_no_coll_cause_valid; /* Whether global reason for breaking collective I/O is valid */
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
- int mpio_coll_chunk_link_hard; /* Instrumented "collective chunk link hard" value (H5D_XFER_COLL_CHUNK_LINK_HARD_NAME) */
- hbool_t mpio_coll_chunk_link_hard_set; /* Whether instrumented "collective chunk link hard" value is set */
- int mpio_coll_chunk_multi_hard; /* Instrumented "collective chunk multi hard" value (H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME) */
- hbool_t mpio_coll_chunk_multi_hard_set; /* Whether instrumented "collective chunk multi hard" value is set */
- int mpio_coll_chunk_link_num_true; /* Instrumented "collective chunk link num true" value (H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME) */
- hbool_t mpio_coll_chunk_link_num_true_set; /* Whether instrumented "collective chunk link num true" value is set */
- int mpio_coll_chunk_link_num_false; /* Instrumented "collective chunk link num false" value (H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME) */
- hbool_t mpio_coll_chunk_link_num_false_set; /* Whether instrumented "collective chunk link num false" value is set */
- int mpio_coll_chunk_multi_ratio_coll; /* Instrumented "collective chunk multi ratio coll" value (H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME) */
- hbool_t mpio_coll_chunk_multi_ratio_coll_set; /* Whether instrumented "collective chunk multi ratio coll" value is set */
- int mpio_coll_chunk_multi_ratio_ind; /* Instrumented "collective chunk multi ratio ind" value (H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME) */
- hbool_t mpio_coll_chunk_multi_ratio_ind_set; /* Whether instrumented "collective chunk multi ratio ind" value is set */
- hbool_t mpio_coll_rank0_bcast; /* Instrumented "collective chunk multi ratio ind" value (H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME) */
- hbool_t mpio_coll_rank0_bcast_set; /* Whether instrumented "collective chunk multi ratio ind" value is set */
-#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
-#endif /* H5_HAVE_PARALLEL */
+ int mpio_coll_chunk_link_hard; /* Instrumented "collective chunk link hard" value
+ (H5D_XFER_COLL_CHUNK_LINK_HARD_NAME) */
+ hbool_t
+ mpio_coll_chunk_link_hard_set; /* Whether instrumented "collective chunk link hard" value is set */
+ int mpio_coll_chunk_multi_hard; /* Instrumented "collective chunk multi hard" value
+ (H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME) */
+ hbool_t
+ mpio_coll_chunk_multi_hard_set; /* Whether instrumented "collective chunk multi hard" value is set */
+ int mpio_coll_chunk_link_num_true; /* Instrumented "collective chunk link num true" value
+ (H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME) */
+ hbool_t mpio_coll_chunk_link_num_true_set; /* Whether instrumented "collective chunk link num true" value
+ is set */
+ int mpio_coll_chunk_link_num_false; /* Instrumented "collective chunk link num false" value
+ (H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME) */
+ hbool_t mpio_coll_chunk_link_num_false_set; /* Whether instrumented "collective chunk link num false"
+ value is set */
+ int mpio_coll_chunk_multi_ratio_coll; /* Instrumented "collective chunk multi ratio coll" value
+ (H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME) */
+ hbool_t mpio_coll_chunk_multi_ratio_coll_set; /* Whether instrumented "collective chunk multi ratio coll"
+ value is set */
+ int mpio_coll_chunk_multi_ratio_ind; /* Instrumented "collective chunk multi ratio ind" value
+ (H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME) */
+ hbool_t mpio_coll_chunk_multi_ratio_ind_set; /* Whether instrumented "collective chunk multi ratio ind"
+ value is set */
+ hbool_t mpio_coll_rank0_bcast; /* Instrumented "collective chunk multi ratio ind" value
+ (H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME) */
+ hbool_t
+ mpio_coll_rank0_bcast_set; /* Whether instrumented "collective chunk multi ratio ind" value is set */
+#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
+#endif /* H5_HAVE_PARALLEL */
/* Cached LCPL properties */
- H5T_cset_t encoding; /* Link name character encoding */
- hbool_t encoding_valid; /* Whether link name character encoding is valid */
- unsigned intermediate_group; /* Whether to create intermediate groups */
- hbool_t intermediate_group_valid; /* Whether create intermediate group flag is valid */
+ H5T_cset_t encoding; /* Link name character encoding */
+ hbool_t encoding_valid; /* Whether link name character encoding is valid */
+ unsigned intermediate_group; /* Whether to create intermediate groups */
+ hbool_t intermediate_group_valid; /* Whether create intermediate group flag is valid */
/* Cached LAPL properties */
- size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
- hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */
+ size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
+ hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */
/* Cached DCPL properties */
- hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */
- hbool_t do_min_dset_ohdr_valid; /* Whether minimize dataset object header flag is valid */
- uint8_t ohdr_flags; /* Object header flags */
- hbool_t ohdr_flags_valid; /* Whether the object headers flags are valid */
+ hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */
+ hbool_t do_min_dset_ohdr_valid; /* Whether minimize dataset object header flag is valid */
+ uint8_t ohdr_flags; /* Object header flags */
+ hbool_t ohdr_flags_valid; /* Whether the object headers flags are valid */
/* Cached DAPL properties */
- const char *extfile_prefix; /* Prefix for external file */
- hbool_t extfile_prefix_valid; /* Whether the prefix for external file is valid */
- const char *vds_prefix; /* Prefix for VDS */
- hbool_t vds_prefix_valid; /* Whether the prefix for VDS is valid */
+ const char *extfile_prefix; /* Prefix for external file */
+ hbool_t extfile_prefix_valid; /* Whether the prefix for external file is valid */
+ const char *vds_prefix; /* Prefix for VDS */
+ hbool_t vds_prefix_valid; /* Whether the prefix for VDS is valid */
/* Cached FAPL properties */
- H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds() */
- hbool_t low_bound_valid; /* Whether low_bound property is valid */
- H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds */
- hbool_t high_bound_valid; /* Whether high_bound property is valid */
+ H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds() */
+ hbool_t low_bound_valid; /* Whether low_bound property is valid */
+ H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds */
+ hbool_t high_bound_valid; /* Whether high_bound property is valid */
/* Cached VOL settings */
- H5VL_connector_prop_t vol_connector_prop; /* Property for VOL connector ID & info */
- hbool_t vol_connector_prop_valid; /* Whether property for VOL connector ID & info is valid */
- void *vol_wrap_ctx; /* VOL connector's "wrap context" for creating IDs */
+ H5VL_connector_prop_t vol_connector_prop; /* Property for VOL connector ID & info */
+ hbool_t vol_connector_prop_valid; /* Whether property for VOL connector ID & info is valid */
+ void * vol_wrap_ctx; /* VOL connector's "wrap context" for creating IDs */
hbool_t vol_wrap_ctx_valid; /* Whether VOL connector's "wrap context" for creating IDs is valid */
} H5CX_t;
@@ -326,8 +343,8 @@ typedef struct H5CX_t {
* in H5CX__push_common().
*/
typedef struct H5CX_node_t {
- H5CX_t ctx; /* Context for current API call */
- struct H5CX_node_t *next; /* Pointer to previous context, on stack */
+ H5CX_t ctx; /* Context for current API call */
+ struct H5CX_node_t *next; /* Pointer to previous context, on stack */
} H5CX_node_t;
/* Typedef for cached default dataset transfer property list information */
@@ -338,46 +355,50 @@ typedef struct H5CX_node_t {
* up the property in the DXPL.
*/
typedef struct H5CX_dxpl_cache_t {
- size_t max_temp_buf; /* Maximum temporary buffer size (H5D_XFER_MAX_TEMP_BUF_NAME) */
- void *tconv_buf; /* Temporary conversion buffer (H5D_XFER_TCONV_BUF_NAME) */
- void *bkgr_buf; /* Background conversion buffer (H5D_XFER_BKGR_BUF_NAME) */
+ size_t max_temp_buf; /* Maximum temporary buffer size (H5D_XFER_MAX_TEMP_BUF_NAME) */
+ void * tconv_buf; /* Temporary conversion buffer (H5D_XFER_TCONV_BUF_NAME) */
+ void * bkgr_buf; /* Background conversion buffer (H5D_XFER_BKGR_BUF_NAME) */
H5T_bkg_t bkgr_buf_type; /* Background buffer type (H5D_XFER_BKGR_BUF_NAME) */
- double btree_split_ratio[3]; /* B-tree split ratios (H5D_XFER_BTREE_SPLIT_RATIO_NAME) */
- size_t vec_size; /* Size of hyperslab vector (H5D_XFER_HYPER_VECTOR_SIZE_NAME) */
+ double btree_split_ratio[3]; /* B-tree split ratios (H5D_XFER_BTREE_SPLIT_RATIO_NAME) */
+ size_t vec_size; /* Size of hyperslab vector (H5D_XFER_HYPER_VECTOR_SIZE_NAME) */
#ifdef H5_HAVE_PARALLEL
- H5FD_mpio_xfer_t io_xfer_mode; /* Parallel transfer mode for this request (H5D_XFER_IO_XFER_MODE_NAME) */
- H5FD_mpio_collective_opt_t mpio_coll_opt; /* Parallel transfer with independent IO or collective IO with this mode (H5D_XFER_MPIO_COLLECTIVE_OPT_NAME) */
- uint32_t mpio_local_no_coll_cause; /* Local reason for breaking collective I/O (H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME) */
- uint32_t mpio_global_no_coll_cause; /* Global reason for breaking collective I/O (H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME) */
- H5FD_mpio_chunk_opt_t mpio_chunk_opt_mode; /* Collective chunk option (H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME) */
- unsigned mpio_chunk_opt_num; /* Collective chunk thrreshold (H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME) */
- unsigned mpio_chunk_opt_ratio; /* Collective chunk ratio (H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME) */
-#endif /* H5_HAVE_PARALLEL */
- H5Z_EDC_t err_detect; /* Error detection info (H5D_XFER_EDC_NAME) */
- H5Z_cb_t filter_cb; /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */
- H5Z_data_xform_t *data_transform; /* Data transform info (H5D_XFER_XFORM_NAME) */
- H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */
- H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */
+ H5FD_mpio_xfer_t io_xfer_mode; /* Parallel transfer mode for this request (H5D_XFER_IO_XFER_MODE_NAME) */
+ H5FD_mpio_collective_opt_t mpio_coll_opt; /* Parallel transfer with independent IO or collective IO with
+ this mode (H5D_XFER_MPIO_COLLECTIVE_OPT_NAME) */
+ uint32_t mpio_local_no_coll_cause; /* Local reason for breaking collective I/O
+ (H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME) */
+ uint32_t mpio_global_no_coll_cause; /* Global reason for breaking collective I/O
+ (H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME) */
+ H5FD_mpio_chunk_opt_t
+ mpio_chunk_opt_mode; /* Collective chunk option (H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME) */
+ unsigned mpio_chunk_opt_num; /* Collective chunk thrreshold (H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME) */
+ unsigned mpio_chunk_opt_ratio; /* Collective chunk ratio (H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME) */
+#endif /* H5_HAVE_PARALLEL */
+ H5Z_EDC_t err_detect; /* Error detection info (H5D_XFER_EDC_NAME) */
+ H5Z_cb_t filter_cb; /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */
+ H5Z_data_xform_t * data_transform; /* Data transform info (H5D_XFER_XFORM_NAME) */
+ H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */
+ H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */
} H5CX_dxpl_cache_t;
/* Typedef for cached default link creation property list information */
/* (Same as the cached DXPL struct, above, except for the default LCPL) */
typedef struct H5CX_lcpl_cache_t {
- H5T_cset_t encoding; /* Link name character encoding */
- unsigned intermediate_group; /* Whether to create intermediate groups */
+ H5T_cset_t encoding; /* Link name character encoding */
+ unsigned intermediate_group; /* Whether to create intermediate groups */
} H5CX_lcpl_cache_t;
/* Typedef for cached default link access property list information */
/* (Same as the cached DXPL struct, above, except for the default LAPL) */
typedef struct H5CX_lapl_cache_t {
- size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
+ size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
} H5CX_lapl_cache_t;
/* Typedef for cached default dataset creation property list information */
/* (Same as the cached DXPL struct, above, except for the default DCPL) */
typedef struct H5CX_dcpl_cache_t {
- hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */
- uint8_t ohdr_flags; /* Object header flags */
+ hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */
+ uint8_t ohdr_flags; /* Object header flags */
} H5CX_dcpl_cache_t;
/* Typedef for cached default dataset access property list information */
@@ -390,8 +411,8 @@ typedef struct H5CX_dapl_cache_t {
/* Typedef for cached default file access property list information */
/* (Same as the cached DXPL struct, above, except for the default DCPL) */
typedef struct H5CX_fapl_cache_t {
- H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds() */
- H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds */
+ H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds() */
+ H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds */
} H5CX_fapl_cache_t;
/********************/
@@ -400,10 +421,9 @@ typedef struct H5CX_fapl_cache_t {
#ifdef H5_HAVE_THREADSAFE
static H5CX_node_t **H5CX__get_context(void);
#endif /* H5_HAVE_THREADSAFE */
-static void H5CX__push_common(H5CX_node_t *cnode);
+static void H5CX__push_common(H5CX_node_t *cnode);
static H5CX_node_t *H5CX__pop_common(void);
-
/*********************/
/* Package Variables */
/*********************/
@@ -411,14 +431,13 @@ static H5CX_node_t *H5CX__pop_common(void);
/* Package initialization variable */
hbool_t H5_PKG_INIT_VAR = FALSE;
-
/*******************/
/* Local Variables */
/*******************/
#ifndef H5_HAVE_THREADSAFE
-static H5CX_node_t *H5CX_head_g = NULL; /* Pointer to head of context stack */
-#endif /* H5_HAVE_THREADSAFE */
+static H5CX_node_t *H5CX_head_g = NULL; /* Pointer to head of context stack */
+#endif /* H5_HAVE_THREADSAFE */
/* Define a "default" dataset transfer property list cache structure to use for default DXPLs */
static H5CX_dxpl_cache_t H5CX_def_dxpl_cache;
@@ -444,8 +463,6 @@ H5FL_DEFINE_STATIC(H5CX_node_t);
/* Declare a static free list to manage H5CX_state_t structs */
H5FL_DEFINE_STATIC(H5CX_state_t);
-
-
/*--------------------------------------------------------------------------
NAME
H5CX__init_package -- Initialize interface-specific information
@@ -459,13 +476,13 @@ DESCRIPTION
herr_t
H5CX__init_package(void)
{
- H5P_genplist_t *dx_plist; /* Data transfer property list */
- H5P_genplist_t *lc_plist; /* Link creation property list */
- H5P_genplist_t *la_plist; /* Link access property list */
- H5P_genplist_t *dc_plist; /* Dataset creation property list */
- H5P_genplist_t *da_plist; /* Dataset access property list */
- H5P_genplist_t *fa_plist; /* File access property list */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *dx_plist; /* Data transfer property list */
+ H5P_genplist_t *lc_plist; /* Link creation property list */
+ H5P_genplist_t *la_plist; /* Link access property list */
+ H5P_genplist_t *dc_plist; /* Dataset creation property list */
+ H5P_genplist_t *da_plist; /* Dataset access property list */
+ H5P_genplist_t *fa_plist; /* File access property list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -475,80 +492,82 @@ H5CX__init_package(void)
/* Get the default DXPL cache information */
/* Get the default dataset transfer property list */
- if(NULL == (dx_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT)))
+ if (NULL == (dx_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT)))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
/* Get B-tree split ratios */
- if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &H5CX_def_dxpl_cache.btree_split_ratio) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &H5CX_def_dxpl_cache.btree_split_ratio) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve B-tree split ratios")
/* Get maximum temporary buffer size value */
- if(H5P_get(dx_plist, H5D_XFER_MAX_TEMP_BUF_NAME, &H5CX_def_dxpl_cache.max_temp_buf) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_MAX_TEMP_BUF_NAME, &H5CX_def_dxpl_cache.max_temp_buf) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve maximum temporary buffer size")
/* Get temporary buffer pointer */
- if(H5P_get(dx_plist, H5D_XFER_TCONV_BUF_NAME, &H5CX_def_dxpl_cache.tconv_buf) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_TCONV_BUF_NAME, &H5CX_def_dxpl_cache.tconv_buf) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve temporary buffer pointer")
/* Get background buffer pointer */
- if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_NAME, &H5CX_def_dxpl_cache.bkgr_buf) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_BKGR_BUF_NAME, &H5CX_def_dxpl_cache.bkgr_buf) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve background buffer pointer")
/* Get background buffer type */
- if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &H5CX_def_dxpl_cache.bkgr_buf_type) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &H5CX_def_dxpl_cache.bkgr_buf_type) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve background buffer type")
/* Get I/O vector size */
- if(H5P_get(dx_plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &H5CX_def_dxpl_cache.vec_size) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &H5CX_def_dxpl_cache.vec_size) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve I/O vector size")
#ifdef H5_HAVE_PARALLEL
/* Collect Parallel I/O information for possible later use */
- if(H5P_get(dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &H5CX_def_dxpl_cache.io_xfer_mode) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &H5CX_def_dxpl_cache.io_xfer_mode) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method")
- if(H5P_get(dx_plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, &H5CX_def_dxpl_cache.mpio_coll_opt) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, &H5CX_def_dxpl_cache.mpio_coll_opt) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve collective transfer option")
- if(H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, &H5CX_def_dxpl_cache.mpio_chunk_opt_mode) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, &H5CX_def_dxpl_cache.mpio_chunk_opt_mode) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve chunk optimization option")
- if(H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, &H5CX_def_dxpl_cache.mpio_chunk_opt_num) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, &H5CX_def_dxpl_cache.mpio_chunk_opt_num) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve chunk optimization threshold")
- if(H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, &H5CX_def_dxpl_cache.mpio_chunk_opt_ratio) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, &H5CX_def_dxpl_cache.mpio_chunk_opt_ratio) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve chunk optimization ratio")
/* Get the local & global reasons for breaking collective I/O values */
- if(H5P_get(dx_plist, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, &H5CX_def_dxpl_cache.mpio_local_no_coll_cause) < 0)
+ if (H5P_get(dx_plist, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME,
+ &H5CX_def_dxpl_cache.mpio_local_no_coll_cause) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve local cause for breaking collective I/O")
- if(H5P_get(dx_plist, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, &H5CX_def_dxpl_cache.mpio_global_no_coll_cause) < 0)
+ if (H5P_get(dx_plist, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME,
+ &H5CX_def_dxpl_cache.mpio_global_no_coll_cause) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve global cause for breaking collective I/O")
#endif /* H5_HAVE_PARALLEL */
/* Get error detection properties */
- if(H5P_get(dx_plist, H5D_XFER_EDC_NAME, &H5CX_def_dxpl_cache.err_detect) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_EDC_NAME, &H5CX_def_dxpl_cache.err_detect) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve error detection info")
/* Get filter callback function */
- if(H5P_get(dx_plist, H5D_XFER_FILTER_CB_NAME, &H5CX_def_dxpl_cache.filter_cb) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_FILTER_CB_NAME, &H5CX_def_dxpl_cache.filter_cb) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve filter callback function")
/* Look at the data transform property */
/* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need
* to copy it and free this in the H5CX terminate routine. -QAK)
*/
- if(H5P_peek(dx_plist, H5D_XFER_XFORM_NAME, &H5CX_def_dxpl_cache.data_transform) < 0)
+ if (H5P_peek(dx_plist, H5D_XFER_XFORM_NAME, &H5CX_def_dxpl_cache.data_transform) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve data transform info")
/* Get VL datatype alloc info */
- if(H5P_get(dx_plist, H5D_XFER_VLEN_ALLOC_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.alloc_func) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_VLEN_ALLOC_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.alloc_func) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info")
- if(H5P_get(dx_plist, H5D_XFER_VLEN_ALLOC_INFO_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.alloc_info) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_VLEN_ALLOC_INFO_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.alloc_info) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info")
- if(H5P_get(dx_plist, H5D_XFER_VLEN_FREE_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.free_func) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_VLEN_FREE_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.free_func) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info")
- if(H5P_get(dx_plist, H5D_XFER_VLEN_FREE_INFO_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.free_info) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_VLEN_FREE_INFO_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.free_info) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info")
/* Get datatype conversion struct */
- if(H5P_get(dx_plist, H5D_XFER_CONV_CB_NAME, &H5CX_def_dxpl_cache.dt_conv_cb) < 0)
+ if (H5P_get(dx_plist, H5D_XFER_CONV_CB_NAME, &H5CX_def_dxpl_cache.dt_conv_cb) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve datatype conversion exception callback")
/* Reset the "default LCPL cache" information */
@@ -557,15 +576,15 @@ H5CX__init_package(void)
/* Get the default LCPL cache information */
/* Get the default link creation property list */
- if(NULL == (lc_plist = (H5P_genplist_t *)H5I_object(H5P_LINK_CREATE_DEFAULT)))
+ if (NULL == (lc_plist = (H5P_genplist_t *)H5I_object(H5P_LINK_CREATE_DEFAULT)))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a link creation property list")
/* Get link name character encoding */
- if(H5P_get(lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &H5CX_def_lcpl_cache.encoding) < 0)
+ if (H5P_get(lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &H5CX_def_lcpl_cache.encoding) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve link name encoding")
/* Get flag whether to create intermediate groups */
- if(H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &H5CX_def_lcpl_cache.intermediate_group) < 0)
+ if (H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &H5CX_def_lcpl_cache.intermediate_group) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve intermediate group creation flag")
/* Reset the "default LAPL cache" information */
@@ -574,11 +593,11 @@ H5CX__init_package(void)
/* Get the default LAPL cache information */
/* Get the default link access property list */
- if(NULL == (la_plist = (H5P_genplist_t *)H5I_object(H5P_LINK_ACCESS_DEFAULT)))
+ if (NULL == (la_plist = (H5P_genplist_t *)H5I_object(H5P_LINK_ACCESS_DEFAULT)))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a link access property list")
/* Get number of soft / UD links to traverse */
- if(H5P_get(la_plist, H5L_ACS_NLINKS_NAME, &H5CX_def_lapl_cache.nlinks) < 0)
+ if (H5P_get(la_plist, H5L_ACS_NLINKS_NAME, &H5CX_def_lapl_cache.nlinks) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve number of soft / UD links to traverse")
/* Reset the "default DCPL cache" information */
@@ -587,15 +606,15 @@ H5CX__init_package(void)
/* Get the default DCPL cache information */
/* Get the default dataset creation property list */
- if(NULL == (dc_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_CREATE_DEFAULT)))
+ if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_CREATE_DEFAULT)))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list")
/* Get flag to indicate whether to minimize dataset object header */
- if(H5P_get(dc_plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &H5CX_def_dcpl_cache.do_min_dset_ohdr) < 0)
+ if (H5P_get(dc_plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &H5CX_def_dcpl_cache.do_min_dset_ohdr) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag")
/* Get object header flags */
- if(H5P_get(dc_plist, H5O_CRT_OHDR_FLAGS_NAME, &H5CX_def_dcpl_cache.ohdr_flags) < 0)
+ if (H5P_get(dc_plist, H5O_CRT_OHDR_FLAGS_NAME, &H5CX_def_dcpl_cache.ohdr_flags) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve object header flags")
/* Reset the "default DAPL cache" information */
@@ -604,15 +623,15 @@ H5CX__init_package(void)
/* Get the default DAPL cache information */
/* Get the default dataset access property list */
- if(NULL == (da_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_ACCESS_DEFAULT)))
+ if (NULL == (da_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_ACCESS_DEFAULT)))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list")
/* Get the prefix for the external file */
- if(H5P_peek(da_plist, H5D_ACS_EFILE_PREFIX_NAME, &H5CX_def_dapl_cache.extfile_prefix) < 0)
+ if (H5P_peek(da_plist, H5D_ACS_EFILE_PREFIX_NAME, &H5CX_def_dapl_cache.extfile_prefix) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for external file")
/* Get the prefix for the VDS file */
- if(H5P_peek(da_plist, H5D_ACS_VDS_PREFIX_NAME, &H5CX_def_dapl_cache.vds_prefix) < 0)
+ if (H5P_peek(da_plist, H5D_ACS_VDS_PREFIX_NAME, &H5CX_def_dapl_cache.vds_prefix) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for VDS")
/* Reset the "default FAPL cache" information */
@@ -621,21 +640,20 @@ H5CX__init_package(void)
/* Get the default FAPL cache information */
/* Get the default file access property list */
- if(NULL == (fa_plist = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT)))
+ if (NULL == (fa_plist = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT)))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list")
/* Get low_bound */
- if(H5P_get(fa_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &H5CX_def_fapl_cache.low_bound) < 0)
+ if (H5P_get(fa_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &H5CX_def_fapl_cache.low_bound) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag")
- if(H5P_get(fa_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &H5CX_def_fapl_cache.high_bound) < 0)
+ if (H5P_get(fa_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &H5CX_def_fapl_cache.high_bound) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX__init_package() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_term_package
*
@@ -655,8 +673,8 @@ H5CX_term_package(void)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(H5_PKG_INIT_VAR) {
- H5CX_node_t *cnode; /* Context node */
+ if (H5_PKG_INIT_VAR) {
+ H5CX_node_t *cnode; /* Context node */
/* Pop the top context node from the stack */
/* (Can't check for errors, as rest of library is shut down) */
@@ -676,7 +694,6 @@ H5CX_term_package(void)
FUNC_LEAVE_NOAPI(0)
} /* end H5CX_term_package() */
-
#ifdef H5_HAVE_THREADSAFE
/*-------------------------------------------------------------------------
* Function: H5CX__get_context
@@ -701,7 +718,7 @@ H5CX__get_context(void)
ctx = (H5CX_node_t **)H5TS_get_thread_local_value(H5TS_apictx_key_g);
- if(!ctx) {
+ if (!ctx) {
/* No associated value with current thread - create one */
#ifdef H5_HAVE_WIN_THREADS
/* Win32 has to use LocalAlloc to match the LocalFree in DllMain */
@@ -727,9 +744,8 @@ H5CX__get_context(void)
/* Set return value */
FUNC_LEAVE_NOAPI(ctx)
} /* end H5CX__get_context() */
-#endif /* H5_HAVE_THREADSAFE */
+#endif /* H5_HAVE_THREADSAFE */
-
/*-------------------------------------------------------------------------
* Function: H5CX__push_common
*
@@ -745,7 +761,8 @@ H5CX__get_context(void)
static void
H5CX__push_common(H5CX_node_t *cnode)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_STATIC_NOERR
@@ -759,17 +776,16 @@ H5CX__push_common(H5CX_node_t *cnode)
cnode->ctx.lcpl_id = H5P_LINK_CREATE_DEFAULT;
cnode->ctx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
cnode->ctx.fapl_id = H5P_FILE_ACCESS_DEFAULT;
- cnode->ctx.tag = H5AC__INVALID_TAG;
- cnode->ctx.ring = H5AC_RING_USER;
+ cnode->ctx.tag = H5AC__INVALID_TAG;
+ cnode->ctx.ring = H5AC_RING_USER;
/* Push context node onto stack */
cnode->next = *head;
- *head = cnode;
+ *head = cnode;
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX__push_common() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_push
*
@@ -785,13 +801,13 @@ H5CX__push_common(H5CX_node_t *cnode)
herr_t
H5CX_push(void)
{
- H5CX_node_t *cnode = NULL; /* Context node */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t *cnode = NULL; /* Context node */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Allocate & clear API context node */
- if(NULL == (cnode = H5FL_CALLOC(H5CX_node_t)))
+ if (NULL == (cnode = H5FL_CALLOC(H5CX_node_t)))
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTALLOC, FAIL, "unable to allocate new struct")
/* Set context info */
@@ -801,7 +817,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_push() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_push_special
*
@@ -819,7 +834,7 @@ done:
void
H5CX_push_special(void)
{
- H5CX_node_t *cnode; /* Context node */
+ H5CX_node_t *cnode; /* Context node */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -833,7 +848,6 @@ H5CX_push_special(void)
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_push_special() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_retrieve_state
*
@@ -854,8 +868,9 @@ H5CX_push_special(void)
herr_t
H5CX_retrieve_state(H5CX_state_t **api_state)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -864,52 +879,52 @@ H5CX_retrieve_state(H5CX_state_t **api_state)
HDassert(api_state);
/* Allocate & clear API context state */
- if(NULL == (*api_state = H5FL_CALLOC(H5CX_state_t)))
+ if (NULL == (*api_state = H5FL_CALLOC(H5CX_state_t)))
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTALLOC, FAIL, "unable to allocate new API context state")
/* Check for non-default DCPL */
- if(H5P_DATASET_CREATE_DEFAULT != (*head)->ctx.dcpl_id) {
+ if (H5P_DATASET_CREATE_DEFAULT != (*head)->ctx.dcpl_id) {
/* Retrieve the DCPL property list */
H5CX_RETRIEVE_PLIST(dcpl, FAIL)
/* Copy the DCPL ID */
- if(((*api_state)->dcpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.dcpl, FALSE)) < 0)
+ if (((*api_state)->dcpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.dcpl, FALSE)) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list")
} /* end if */
else
(*api_state)->dcpl_id = H5P_DATASET_CREATE_DEFAULT;
/* Check for non-default DXPL */
- if(H5P_DATASET_XFER_DEFAULT != (*head)->ctx.dxpl_id) {
+ if (H5P_DATASET_XFER_DEFAULT != (*head)->ctx.dxpl_id) {
/* Retrieve the DXPL property list */
H5CX_RETRIEVE_PLIST(dxpl, FAIL)
/* Copy the DXPL ID */
- if(((*api_state)->dxpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.dxpl, FALSE)) < 0)
+ if (((*api_state)->dxpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.dxpl, FALSE)) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list")
} /* end if */
else
(*api_state)->dxpl_id = H5P_DATASET_XFER_DEFAULT;
/* Check for non-default LAPL */
- if(H5P_LINK_ACCESS_DEFAULT != (*head)->ctx.lapl_id) {
+ if (H5P_LINK_ACCESS_DEFAULT != (*head)->ctx.lapl_id) {
/* Retrieve the LAPL property list */
H5CX_RETRIEVE_PLIST(lapl, FAIL)
/* Copy the LAPL ID */
- if(((*api_state)->lapl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.lapl, FALSE)) < 0)
+ if (((*api_state)->lapl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.lapl, FALSE)) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list")
} /* end if */
else
(*api_state)->lapl_id = H5P_LINK_ACCESS_DEFAULT;
/* Check for non-default LCPL */
- if(H5P_LINK_CREATE_DEFAULT != (*head)->ctx.lcpl_id) {
+ if (H5P_LINK_CREATE_DEFAULT != (*head)->ctx.lcpl_id) {
/* Retrieve the LCPL property list */
H5CX_RETRIEVE_PLIST(lcpl, FAIL)
/* Copy the LCPL ID */
- if(((*api_state)->lcpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.lcpl, FALSE)) < 0)
+ if (((*api_state)->lcpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.lcpl, FALSE)) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list")
} /* end if */
else
@@ -917,37 +932,40 @@ H5CX_retrieve_state(H5CX_state_t **api_state)
/* Keep a reference to the current VOL wrapping context */
(*api_state)->vol_wrap_ctx = (*head)->ctx.vol_wrap_ctx;
- if(NULL != (*api_state)->vol_wrap_ctx)
- if(H5VL_inc_vol_wrapper((*api_state)->vol_wrap_ctx) < 0)
+ if (NULL != (*api_state)->vol_wrap_ctx)
+ if (H5VL_inc_vol_wrapper((*api_state)->vol_wrap_ctx) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTINC, FAIL, "can't increment refcount on VOL wrapping context")
/* Keep a copy of the VOL connector property, if there is one */
- if((*head)->ctx.vol_connector_prop_valid && (*head)->ctx.vol_connector_prop.connector_id > 0) {
+ if ((*head)->ctx.vol_connector_prop_valid && (*head)->ctx.vol_connector_prop.connector_id > 0) {
/* Get the connector property */
- H5MM_memcpy(&(*api_state)->vol_connector_prop, &(*head)->ctx.vol_connector_prop, sizeof(H5VL_connector_prop_t));
+ H5MM_memcpy(&(*api_state)->vol_connector_prop, &(*head)->ctx.vol_connector_prop,
+ sizeof(H5VL_connector_prop_t));
/* Check for actual VOL connector property */
- if((*api_state)->vol_connector_prop.connector_id) {
+ if ((*api_state)->vol_connector_prop.connector_id) {
/* Copy connector info, if it exists */
- if((*api_state)->vol_connector_prop.connector_info) {
- H5VL_class_t *connector; /* Pointer to connector */
- void *new_connector_info = NULL; /* Copy of connector info */
+ if ((*api_state)->vol_connector_prop.connector_info) {
+ H5VL_class_t *connector; /* Pointer to connector */
+ void * new_connector_info = NULL; /* Copy of connector info */
/* Retrieve the connector for the ID */
- if(NULL == (connector = (H5VL_class_t *)H5I_object((*api_state)->vol_connector_prop.connector_id)))
+ if (NULL ==
+ (connector = (H5VL_class_t *)H5I_object((*api_state)->vol_connector_prop.connector_id)))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Allocate and copy connector info */
- if(H5VL_copy_connector_info(connector, &new_connector_info, (*api_state)->vol_connector_prop.connector_info) < 0)
+ if (H5VL_copy_connector_info(connector, &new_connector_info,
+ (*api_state)->vol_connector_prop.connector_info) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "connector info copy failed")
(*api_state)->vol_connector_prop.connector_info = new_connector_info;
} /* end if */
/* Increment the refcount on the connector ID */
- if(H5I_inc_ref((*api_state)->vol_connector_prop.connector_id, FALSE) < 0)
+ if (H5I_inc_ref((*api_state)->vol_connector_prop.connector_id, FALSE) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed")
} /* end if */
- } /* end if */
+ } /* end if */
#ifdef H5_HAVE_PARALLEL
/* Save parallel I/O settings */
@@ -958,7 +976,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_retrieve_state() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_restore_state
*
@@ -979,7 +996,8 @@ done:
herr_t
H5CX_restore_state(const H5CX_state_t *api_state)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -989,26 +1007,27 @@ H5CX_restore_state(const H5CX_state_t *api_state)
/* Restore the DCPL info */
(*head)->ctx.dcpl_id = api_state->dcpl_id;
- (*head)->ctx.dcpl = NULL;
+ (*head)->ctx.dcpl = NULL;
/* Restore the DXPL info */
(*head)->ctx.dxpl_id = api_state->dxpl_id;
- (*head)->ctx.dxpl = NULL;
+ (*head)->ctx.dxpl = NULL;
/* Restore the LAPL info */
(*head)->ctx.lapl_id = api_state->lapl_id;
- (*head)->ctx.lapl = NULL;
+ (*head)->ctx.lapl = NULL;
/* Restore the LCPL info */
(*head)->ctx.lcpl_id = api_state->lcpl_id;
- (*head)->ctx.lcpl = NULL;
+ (*head)->ctx.lcpl = NULL;
/* Restore the VOL wrapper context */
(*head)->ctx.vol_wrap_ctx = api_state->vol_wrap_ctx;
/* Restore the VOL connector info */
- if(api_state->vol_connector_prop.connector_id) {
- H5MM_memcpy(&(*head)->ctx.vol_connector_prop, &api_state->vol_connector_prop, sizeof(H5VL_connector_prop_t));
+ if (api_state->vol_connector_prop.connector_id) {
+ H5MM_memcpy(&(*head)->ctx.vol_connector_prop, &api_state->vol_connector_prop,
+ sizeof(H5VL_connector_prop_t));
(*head)->ctx.vol_connector_prop_valid = TRUE;
} /* end if */
@@ -1020,7 +1039,6 @@ H5CX_restore_state(const H5CX_state_t *api_state)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5CX_restore_state() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_free_state
*
@@ -1036,7 +1054,7 @@ H5CX_restore_state(const H5CX_state_t *api_state)
herr_t
H5CX_free_state(H5CX_state_t *api_state)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1044,38 +1062,39 @@ H5CX_free_state(H5CX_state_t *api_state)
HDassert(api_state);
/* Release the DCPL */
- if(api_state->dcpl_id != H5P_DATASET_CREATE_DEFAULT)
- if(H5I_dec_ref(api_state->dcpl_id) < 0)
+ if (api_state->dcpl_id != H5P_DATASET_CREATE_DEFAULT)
+ if (H5I_dec_ref(api_state->dcpl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DCPL")
/* Release the DXPL */
- if(api_state->dxpl_id != H5P_DATASET_XFER_DEFAULT)
- if(H5I_dec_ref(api_state->dxpl_id) < 0)
+ if (api_state->dxpl_id != H5P_DATASET_XFER_DEFAULT)
+ if (H5I_dec_ref(api_state->dxpl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DXPL")
/* Release the LAPL */
- if(api_state->lapl_id != H5P_LINK_ACCESS_DEFAULT)
- if(H5I_dec_ref(api_state->lapl_id) < 0)
+ if (api_state->lapl_id != H5P_LINK_ACCESS_DEFAULT)
+ if (H5I_dec_ref(api_state->lapl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LAPL")
/* Release the LCPL */
- if(api_state->lcpl_id != H5P_LINK_CREATE_DEFAULT)
- if(H5I_dec_ref(api_state->lcpl_id) < 0)
+ if (api_state->lcpl_id != H5P_LINK_CREATE_DEFAULT)
+ if (H5I_dec_ref(api_state->lcpl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LCPL")
/* Release the VOL wrapper context */
- if(api_state->vol_wrap_ctx)
- if(H5VL_dec_vol_wrapper(api_state->vol_wrap_ctx) < 0)
+ if (api_state->vol_wrap_ctx)
+ if (H5VL_dec_vol_wrapper(api_state->vol_wrap_ctx) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on VOL wrapping context")
/* Release the VOL connector property, if it was set */
- if(api_state->vol_connector_prop.connector_id) {
+ if (api_state->vol_connector_prop.connector_id) {
/* Clean up any VOL connector info */
- if(api_state->vol_connector_prop.connector_info)
- if(H5VL_free_connector_info(api_state->vol_connector_prop.connector_id, api_state->vol_connector_prop.connector_info) < 0)
+ if (api_state->vol_connector_prop.connector_info)
+ if (H5VL_free_connector_info(api_state->vol_connector_prop.connector_id,
+ api_state->vol_connector_prop.connector_info) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object")
/* Decrement connector ID */
- if(H5I_dec_ref(api_state->vol_connector_prop.connector_id) < 0)
+ if (H5I_dec_ref(api_state->vol_connector_prop.connector_id) < 0)
HDONE_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't close VOL connector ID")
} /* end if */
@@ -1086,7 +1105,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_free_state() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_is_def_dxpl
*
@@ -1102,7 +1120,8 @@ done:
hbool_t
H5CX_is_def_dxpl(void)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1112,7 +1131,6 @@ H5CX_is_def_dxpl(void)
FUNC_LEAVE_NOAPI((*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT);
} /* end H5CX_is_def_dxpl() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_dxpl
*
@@ -1128,7 +1146,8 @@ H5CX_is_def_dxpl(void)
void
H5CX_set_dxpl(hid_t dxpl_id)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1141,7 +1160,6 @@ H5CX_set_dxpl(hid_t dxpl_id)
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_dxpl() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_dcpl
*
@@ -1157,7 +1175,8 @@ H5CX_set_dxpl(hid_t dxpl_id)
void
H5CX_set_dcpl(hid_t dcpl_id)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1170,7 +1189,6 @@ H5CX_set_dcpl(hid_t dcpl_id)
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_dcpl() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_libver_bounds
*
@@ -1187,8 +1205,9 @@ H5CX_set_dcpl(hid_t dcpl_id)
herr_t
H5CX_set_libver_bounds(H5F_t *f)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1196,18 +1215,17 @@ H5CX_set_libver_bounds(H5F_t *f)
HDassert(head && *head);
/* Set the API context value */
- (*head)->ctx.low_bound = (f == NULL) ? H5F_LIBVER_LATEST : H5F_LOW_BOUND(f);
+ (*head)->ctx.low_bound = (f == NULL) ? H5F_LIBVER_LATEST : H5F_LOW_BOUND(f);
(*head)->ctx.high_bound = (f == NULL) ? H5F_LIBVER_LATEST : H5F_HIGH_BOUND(f);
/* Mark the values as valid */
- (*head)->ctx.low_bound_valid = TRUE;
+ (*head)->ctx.low_bound_valid = TRUE;
(*head)->ctx.high_bound_valid = TRUE;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_set_libver_bounds() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_lcpl
*
@@ -1223,7 +1241,8 @@ done:
void
H5CX_set_lcpl(hid_t lcpl_id)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1236,7 +1255,6 @@ H5CX_set_lcpl(hid_t lcpl_id)
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_lcpl() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_lapl
*
@@ -1252,7 +1270,8 @@ H5CX_set_lcpl(hid_t lcpl_id)
void
H5CX_set_lapl(hid_t lapl_id)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1265,7 +1284,6 @@ H5CX_set_lapl(hid_t lapl_id)
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_lapl() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_apl
*
@@ -1281,18 +1299,20 @@ H5CX_set_lapl(hid_t lapl_id)
*/
herr_t
H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
- hid_t
+ hid_t
#ifndef H5_HAVE_PARALLEL
- H5_ATTR_UNUSED
+ H5_ATTR_UNUSED
#endif /* H5_HAVE_PARALLEL */
- loc_id, hbool_t
+ loc_id,
+ hbool_t
#ifndef H5_HAVE_PARALLEL
- H5_ATTR_UNUSED
+ H5_ATTR_UNUSED
#endif /* H5_HAVE_PARALLEL */
- is_collective)
+ is_collective)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1302,35 +1322,38 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
HDassert(head && *head);
/* Set access plist to the default property list of the appropriate class if it's the generic default */
- if(H5P_DEFAULT == *acspl_id)
+ if (H5P_DEFAULT == *acspl_id)
*acspl_id = *libclass->def_plist_id;
else {
- htri_t is_lapl; /* Whether the access property list is (or is derived from) a link access property list */
- htri_t is_dapl; /* Whether the access property list is (or is derived from) a dataset access property list */
- htri_t is_fapl; /* Whether the access property list is (or is derived from) a file access property list */
+ htri_t is_lapl; /* Whether the access property list is (or is derived from) a link access property
+ list */
+ htri_t is_dapl; /* Whether the access property list is (or is derived from) a dataset access property
+ list */
+ htri_t is_fapl; /* Whether the access property list is (or is derived from) a file access property
+ list */
#ifdef H5CX_DEBUG
/* Sanity check the access property list class */
- if(TRUE != H5P_isa_class(*acspl_id, *libclass->class_id))
+ if (TRUE != H5P_isa_class(*acspl_id, *libclass->class_id))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not the required access property list")
#endif /* H5CX_DEBUG*/
/* Check for link access property and set API context if so */
- if((is_lapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_LACC->pclass)) < 0)
+ if ((is_lapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_LACC->pclass)) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for link access class")
- else if(is_lapl)
+ else if (is_lapl)
(*head)->ctx.lapl_id = *acspl_id;
/* Check for dataset access property and set API context if so */
- if((is_dapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_DACC->pclass)) < 0)
+ if ((is_dapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_DACC->pclass)) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for dataset access class")
- else if(is_dapl)
+ else if (is_dapl)
(*head)->ctx.dapl_id = *acspl_id;
/* Check for file access property and set API context if so */
- if((is_fapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_FACC->pclass)) < 0)
+ if ((is_fapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_FACC->pclass)) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for file access class")
- else if(is_fapl)
+ else if (is_fapl)
(*head)->ctx.fapl_id = *acspl_id;
#ifdef H5_HAVE_PARALLEL
@@ -1338,28 +1361,28 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
* modify the structural metadata in a file), check if the application
* specified a collective metadata read for just this operation.
*/
- if(!is_collective) {
- H5P_genplist_t *plist; /* Property list pointer */
- H5P_coll_md_read_flag_t md_coll_read; /* Collective metadata read flag */
+ if (!is_collective) {
+ H5P_genplist_t * plist; /* Property list pointer */
+ H5P_coll_md_read_flag_t md_coll_read; /* Collective metadata read flag */
/* Get the plist structure for the access property list */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(*acspl_id)))
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object(*acspl_id)))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get the collective metadata read flag */
- if(H5P_peek(plist, H5_COLL_MD_READ_FLAG_NAME, &md_coll_read) < 0)
+ if (H5P_peek(plist, H5_COLL_MD_READ_FLAG_NAME, &md_coll_read) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't get core collective metadata read flag")
/* If collective metadata read requested, set collective metadata read flag */
- if(H5P_USER_TRUE == md_coll_read)
+ if (H5P_USER_TRUE == md_coll_read)
is_collective = TRUE;
} /* end if */
-#endif /* H5_HAVE_PARALLEL */
- } /* end else */
+#endif /* H5_HAVE_PARALLEL */
+ } /* end else */
#ifdef H5_HAVE_PARALLEL
/* Check for collective operation */
- if(is_collective) {
+ if (is_collective) {
/* Set collective metadata read flag */
(*head)->ctx.coll_metadata_read = TRUE;
@@ -1369,25 +1392,24 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
* happens only when the environment variable H5_COLL_BARRIER is set
* to non 0.
*/
- if(H5_coll_api_sanity_check_g) {
- MPI_Comm mpi_comm; /* File communicator */
+ if (H5_coll_api_sanity_check_g) {
+ MPI_Comm mpi_comm; /* File communicator */
/* Retrieve the MPI communicator from the loc_id or the fapl_id */
- if(H5F_mpi_retrieve_comm(loc_id, *acspl_id, &mpi_comm) < 0)
+ if (H5F_mpi_retrieve_comm(loc_id, *acspl_id, &mpi_comm) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator")
/* issue the barrier */
- if(mpi_comm != MPI_COMM_NULL)
+ if (mpi_comm != MPI_COMM_NULL)
MPI_Barrier(mpi_comm);
} /* end if */
- } /* end if */
-#endif /* H5_HAVE_PARALLEL */
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_set_apl() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_loc
*
@@ -1406,13 +1428,14 @@ done:
herr_t
H5CX_set_loc(hid_t
#ifndef H5_HAVE_PARALLEL
- H5_ATTR_UNUSED
+ H5_ATTR_UNUSED
#endif /* H5_HAVE_PARALLEL */
- loc_id)
+ loc_id)
{
#ifdef H5_HAVE_PARALLEL
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1428,28 +1451,27 @@ H5CX_set_loc(hid_t
* happens only when the environment variable H5_COLL_BARRIER is set
* to non 0.
*/
- if(H5_coll_api_sanity_check_g) {
- MPI_Comm mpi_comm; /* File communicator */
+ if (H5_coll_api_sanity_check_g) {
+ MPI_Comm mpi_comm; /* File communicator */
/* Retrieve the MPI communicator from the loc_id or the fapl_id */
- if(H5F_mpi_retrieve_comm(loc_id, H5P_DEFAULT, &mpi_comm) < 0)
+ if (H5F_mpi_retrieve_comm(loc_id, H5P_DEFAULT, &mpi_comm) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator")
/* issue the barrier */
- if(mpi_comm != MPI_COMM_NULL)
+ if (mpi_comm != MPI_COMM_NULL)
MPI_Barrier(mpi_comm);
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-#else /* H5_HAVE_PARALLEL */
+#else /* H5_HAVE_PARALLEL */
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_LEAVE_NOAPI(SUCCEED)
#endif /* H5_HAVE_PARALLEL */
} /* end H5CX_set_loc() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_vol_wrap_ctx
*
@@ -1465,8 +1487,9 @@ done:
herr_t
H5CX_set_vol_wrap_ctx(void *vol_wrap_ctx)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1483,7 +1506,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_set_vol_wrap_ctx() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_vol_connector_prop
*
@@ -1499,8 +1521,9 @@ done:
herr_t
H5CX_set_vol_connector_prop(const H5VL_connector_prop_t *vol_connector_prop)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1517,7 +1540,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_set_vol_connector_prop() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_dxpl
*
@@ -1533,7 +1555,8 @@ done:
hid_t
H5CX_get_dxpl(void)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1543,7 +1566,6 @@ H5CX_get_dxpl(void)
FUNC_LEAVE_NOAPI((*head)->ctx.dxpl_id)
} /* end H5CX_get_dxpl() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_lapl
*
@@ -1559,7 +1581,8 @@ H5CX_get_dxpl(void)
hid_t
H5CX_get_lapl(void)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1569,7 +1592,6 @@ H5CX_get_lapl(void)
FUNC_LEAVE_NOAPI((*head)->ctx.lapl_id)
} /* end H5CX_get_lapl() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_vol_wrap_ctx
*
@@ -1585,8 +1607,9 @@ H5CX_get_lapl(void)
herr_t
H5CX_get_vol_wrap_ctx(void **vol_wrap_ctx)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1595,7 +1618,7 @@ H5CX_get_vol_wrap_ctx(void **vol_wrap_ctx)
HDassert(head && *head);
/* Check for value that was set */
- if((*head)->ctx.vol_wrap_ctx_valid)
+ if ((*head)->ctx.vol_wrap_ctx_valid)
/* Get the value */
*vol_wrap_ctx = (*head)->ctx.vol_wrap_ctx;
else
@@ -1605,7 +1628,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_vol_wrap_ctx() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_vol_connector_prop
*
@@ -1621,8 +1643,9 @@ done:
herr_t
H5CX_get_vol_connector_prop(H5VL_connector_prop_t *vol_connector_prop)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1631,7 +1654,7 @@ H5CX_get_vol_connector_prop(H5VL_connector_prop_t *vol_connector_prop)
HDassert(head && *head);
/* Check for value that was set */
- if((*head)->ctx.vol_connector_prop_valid)
+ if ((*head)->ctx.vol_connector_prop_valid)
/* Get the value */
H5MM_memcpy(vol_connector_prop, &(*head)->ctx.vol_connector_prop, sizeof(H5VL_connector_prop_t));
else
@@ -1641,7 +1664,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_vol_connector_prop() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_tag
*
@@ -1657,7 +1679,8 @@ done:
haddr_t
H5CX_get_tag(void)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1667,7 +1690,6 @@ H5CX_get_tag(void)
FUNC_LEAVE_NOAPI((*head)->ctx.tag)
} /* end H5CX_get_tag() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_ring
*
@@ -1683,7 +1705,8 @@ H5CX_get_tag(void)
H5AC_ring_t
H5CX_get_ring(void)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1694,7 +1717,7 @@ H5CX_get_ring(void)
} /* end H5CX_get_ring() */
#ifdef H5_HAVE_PARALLEL
-
+
/*-------------------------------------------------------------------------
* Function: H5CX_get_coll_metadata_read
*
@@ -1710,7 +1733,8 @@ H5CX_get_ring(void)
hbool_t
H5CX_get_coll_metadata_read(void)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1720,7 +1744,6 @@ H5CX_get_coll_metadata_read(void)
FUNC_LEAVE_NOAPI((*head)->ctx.coll_metadata_read)
} /* end H5CX_get_coll_metadata_read() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_mpi_coll_datatypes
*
@@ -1738,8 +1761,9 @@ H5CX_get_coll_metadata_read(void)
herr_t
H5CX_get_mpi_coll_datatypes(MPI_Datatype *btype, MPI_Datatype *ftype)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1756,7 +1780,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_mpi_coll_datatypes() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_mpi_file_flushing
*
@@ -1772,7 +1795,8 @@ done:
hbool_t
H5CX_get_mpi_file_flushing(void)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1782,11 +1806,11 @@ H5CX_get_mpi_file_flushing(void)
FUNC_LEAVE_NOAPI((*head)->ctx.mpi_file_flushing)
} /* end H5CX_get_mpi_file_flushing() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_mpio_rank0_bcast
*
- * Purpose: Retrieves if the dataset meets read-with-rank0-and-bcast requirements for the current API call context.
+ * Purpose: Retrieves if the dataset meets read-with-rank0-and-bcast requirements for the current API call
+ *context.
*
* Return: Non-negative on success / Negative on failure
*
@@ -1798,7 +1822,8 @@ H5CX_get_mpi_file_flushing(void)
hbool_t
H5CX_get_mpio_rank0_bcast(void)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1809,7 +1834,6 @@ H5CX_get_mpio_rank0_bcast(void)
} /* end H5CX_get_mpio_rank0_bcast() */
#endif /* H5_HAVE_PARALLEL */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_btree_split_ratios
*
@@ -1825,8 +1849,9 @@ H5CX_get_mpio_rank0_bcast(void)
herr_t
H5CX_get_btree_split_ratios(double split_ratio[3])
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1835,7 +1860,8 @@ H5CX_get_btree_split_ratios(double split_ratio[3])
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
- H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_BTREE_SPLIT_RATIO_NAME, btree_split_ratio)
+ H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_BTREE_SPLIT_RATIO_NAME,
+ btree_split_ratio)
/* Get the B-tree split ratio values */
H5MM_memcpy(split_ratio, &(*head)->ctx.btree_split_ratio, sizeof((*head)->ctx.btree_split_ratio));
@@ -1844,7 +1870,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_btree_split_ratios() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_max_temp_buf
*
@@ -1860,8 +1885,9 @@ done:
herr_t
H5CX_get_max_temp_buf(size_t *max_temp_buf)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1879,7 +1905,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_max_temp_buf() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_tconv_buf
*
@@ -1895,8 +1920,9 @@ done:
herr_t
H5CX_get_tconv_buf(void **tconv_buf)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1914,7 +1940,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_tconv_buf() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_bkgr_buf
*
@@ -1930,8 +1955,9 @@ done:
herr_t
H5CX_get_bkgr_buf(void **bkgr_buf)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1949,7 +1975,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_bkgr_buf() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_bkgr_buf_type
*
@@ -1965,8 +1990,9 @@ done:
herr_t
H5CX_get_bkgr_buf_type(H5T_bkg_t *bkgr_buf_type)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1984,7 +2010,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_bkgr_buf_type() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_vec_size
*
@@ -2000,8 +2025,9 @@ done:
herr_t
H5CX_get_vec_size(size_t *vec_size)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2020,7 +2046,7 @@ done:
} /* end H5CX_get_vec_size() */
#ifdef H5_HAVE_PARALLEL
-
+
/*-------------------------------------------------------------------------
* Function: H5CX_get_io_xfer_mode
*
@@ -2036,8 +2062,9 @@ done:
herr_t
H5CX_get_io_xfer_mode(H5FD_mpio_xfer_t *io_xfer_mode)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2055,7 +2082,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_io_xfer_mode() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_mpio_coll_opt
*
@@ -2071,8 +2097,9 @@ done:
herr_t
H5CX_get_mpio_coll_opt(H5FD_mpio_collective_opt_t *mpio_coll_opt)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2090,7 +2117,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_mpio_coll_opt() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_mpio_local_no_coll_cause
*
@@ -2106,8 +2132,9 @@ done:
herr_t
H5CX_get_mpio_local_no_coll_cause(uint32_t *mpio_local_no_coll_cause)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2116,7 +2143,8 @@ H5CX_get_mpio_local_no_coll_cause(uint32_t *mpio_local_no_coll_cause)
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
- H5CX_RETRIEVE_PROP_VALID_SET(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, mpio_local_no_coll_cause)
+ H5CX_RETRIEVE_PROP_VALID_SET(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME,
+ mpio_local_no_coll_cause)
/* Get the value */
*mpio_local_no_coll_cause = (*head)->ctx.mpio_local_no_coll_cause;
@@ -2125,7 +2153,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_mpio_local_no_coll_cause() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_mpio_global_no_coll_cause
*
@@ -2141,8 +2168,9 @@ done:
herr_t
H5CX_get_mpio_global_no_coll_cause(uint32_t *mpio_global_no_coll_cause)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2151,7 +2179,8 @@ H5CX_get_mpio_global_no_coll_cause(uint32_t *mpio_global_no_coll_cause)
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
- H5CX_RETRIEVE_PROP_VALID_SET(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, mpio_global_no_coll_cause)
+ H5CX_RETRIEVE_PROP_VALID_SET(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME,
+ mpio_global_no_coll_cause)
/* Get the value */
*mpio_global_no_coll_cause = (*head)->ctx.mpio_global_no_coll_cause;
@@ -2160,7 +2189,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_mpio_global_no_coll_cause() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_mpio_chunk_opt_mode
*
@@ -2176,8 +2204,9 @@ done:
herr_t
H5CX_get_mpio_chunk_opt_mode(H5FD_mpio_chunk_opt_t *mpio_chunk_opt_mode)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2186,7 +2215,8 @@ H5CX_get_mpio_chunk_opt_mode(H5FD_mpio_chunk_opt_t *mpio_chunk_opt_mode)
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
- H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, mpio_chunk_opt_mode)
+ H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME,
+ mpio_chunk_opt_mode)
/* Get the value */
*mpio_chunk_opt_mode = (*head)->ctx.mpio_chunk_opt_mode;
@@ -2195,7 +2225,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_mpio_chunk_opt_mode() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_mpio_chunk_opt_num
*
@@ -2211,8 +2240,9 @@ done:
herr_t
H5CX_get_mpio_chunk_opt_num(unsigned *mpio_chunk_opt_num)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2221,7 +2251,8 @@ H5CX_get_mpio_chunk_opt_num(unsigned *mpio_chunk_opt_num)
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
- H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, mpio_chunk_opt_num)
+ H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME,
+ mpio_chunk_opt_num)
/* Get the value */
*mpio_chunk_opt_num = (*head)->ctx.mpio_chunk_opt_num;
@@ -2230,7 +2261,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_mpio_chunk_opt_num() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_mpio_chunk_opt_ratio
*
@@ -2246,8 +2276,9 @@ done:
herr_t
H5CX_get_mpio_chunk_opt_ratio(unsigned *mpio_chunk_opt_ratio)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2256,7 +2287,8 @@ H5CX_get_mpio_chunk_opt_ratio(unsigned *mpio_chunk_opt_ratio)
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
- H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, mpio_chunk_opt_ratio)
+ H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME,
+ mpio_chunk_opt_ratio)
/* Get the value */
*mpio_chunk_opt_ratio = (*head)->ctx.mpio_chunk_opt_ratio;
@@ -2266,7 +2298,6 @@ done:
} /* end H5CX_get_mpio_chunk_opt_ratio() */
#endif /* H5_HAVE_PARALLEL */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_err_detect
*
@@ -2282,8 +2313,9 @@ done:
herr_t
H5CX_get_err_detect(H5Z_EDC_t *err_detect)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2301,7 +2333,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_err_detect() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_filter_cb
*
@@ -2317,8 +2348,9 @@ done:
herr_t
H5CX_get_filter_cb(H5Z_cb_t *filter_cb)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2336,7 +2368,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_filter_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_data_transform
*
@@ -2352,8 +2383,9 @@ done:
herr_t
H5CX_get_data_transform(H5Z_data_xform_t **data_transform)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2363,22 +2395,23 @@ H5CX_get_data_transform(H5Z_data_xform_t **data_transform)
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
/* Check if the value has been retrieved already */
- if(!(*head)->ctx.data_transform_valid) {
+ if (!(*head)->ctx.data_transform_valid) {
/* Check for default DXPL */
- if((*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)
+ if ((*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)
(*head)->ctx.data_transform = H5CX_def_dxpl_cache.data_transform;
else {
/* Check if the property list is already available */
- if(NULL == (*head)->ctx.dxpl)
+ if (NULL == (*head)->ctx.dxpl)
/* Get the dataset transfer property list pointer */
- if(NULL == ((*head)->ctx.dxpl = (H5P_genplist_t *)H5I_object((*head)->ctx.dxpl_id)))
- HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "can't get default dataset transfer property list")
+ if (NULL == ((*head)->ctx.dxpl = (H5P_genplist_t *)H5I_object((*head)->ctx.dxpl_id)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL,
+ "can't get default dataset transfer property list")
/* Get data transform info value */
/* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need
* to copy it and free this in the H5CX pop routine. -QAK)
*/
- if(H5P_peek((*head)->ctx.dxpl, H5D_XFER_XFORM_NAME, &(*head)->ctx.data_transform) < 0)
+ if (H5P_peek((*head)->ctx.dxpl, H5D_XFER_XFORM_NAME, &(*head)->ctx.data_transform) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve data transform info")
} /* end else */
@@ -2393,7 +2426,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_data_transform() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_vlen_alloc_info
*
@@ -2409,8 +2441,9 @@ done:
herr_t
H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2420,25 +2453,30 @@ H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info)
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
/* Check if the value has been retrieved already */
- if(!(*head)->ctx.vl_alloc_info_valid) {
+ if (!(*head)->ctx.vl_alloc_info_valid) {
/* Check for default DXPL */
- if((*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)
+ if ((*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)
(*head)->ctx.vl_alloc_info = H5CX_def_dxpl_cache.vl_alloc_info;
else {
/* Check if the property list is already available */
- if(NULL == (*head)->ctx.dxpl)
+ if (NULL == (*head)->ctx.dxpl)
/* Get the dataset transfer property list pointer */
- if(NULL == ((*head)->ctx.dxpl = (H5P_genplist_t *)H5I_object((*head)->ctx.dxpl_id)))
- HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "can't get default dataset transfer property list")
+ if (NULL == ((*head)->ctx.dxpl = (H5P_genplist_t *)H5I_object((*head)->ctx.dxpl_id)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL,
+ "can't get default dataset transfer property list")
/* Get VL datatype alloc info values */
- if(H5P_get((*head)->ctx.dxpl, H5D_XFER_VLEN_ALLOC_NAME, &(*head)->ctx.vl_alloc_info.alloc_func) < 0)
+ if (H5P_get((*head)->ctx.dxpl, H5D_XFER_VLEN_ALLOC_NAME, &(*head)->ctx.vl_alloc_info.alloc_func) <
+ 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info")
- if(H5P_get((*head)->ctx.dxpl, H5D_XFER_VLEN_ALLOC_INFO_NAME, &(*head)->ctx.vl_alloc_info.alloc_info) < 0)
+ if (H5P_get((*head)->ctx.dxpl, H5D_XFER_VLEN_ALLOC_INFO_NAME,
+ &(*head)->ctx.vl_alloc_info.alloc_info) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info")
- if(H5P_get((*head)->ctx.dxpl, H5D_XFER_VLEN_FREE_NAME, &(*head)->ctx.vl_alloc_info.free_func) < 0)
+ if (H5P_get((*head)->ctx.dxpl, H5D_XFER_VLEN_FREE_NAME, &(*head)->ctx.vl_alloc_info.free_func) <
+ 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info")
- if(H5P_get((*head)->ctx.dxpl, H5D_XFER_VLEN_FREE_INFO_NAME, &(*head)->ctx.vl_alloc_info.free_info) < 0)
+ if (H5P_get((*head)->ctx.dxpl, H5D_XFER_VLEN_FREE_INFO_NAME,
+ &(*head)->ctx.vl_alloc_info.free_info) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info")
} /* end else */
@@ -2453,7 +2491,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_vlen_alloc_info() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_dt_conv_cb
*
@@ -2469,8 +2506,9 @@ done:
herr_t
H5CX_get_dt_conv_cb(H5T_conv_cb_t *dt_conv_cb)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2488,7 +2526,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_dt_conv_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_encoding
*
@@ -2502,10 +2539,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5CX_get_encoding(H5T_cset_t* encoding)
+H5CX_get_encoding(H5T_cset_t *encoding)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2523,7 +2561,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_encoding() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_intermediate_group
*
@@ -2537,10 +2574,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5CX_get_intermediate_group(unsigned* crt_intermed_group)
+H5CX_get_intermediate_group(unsigned *crt_intermed_group)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2549,7 +2587,8 @@ H5CX_get_intermediate_group(unsigned* crt_intermed_group)
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.lcpl_id);
- H5CX_RETRIEVE_PROP_VALID(lcpl, H5P_LINK_CREATE_DEFAULT, H5L_CRT_INTERMEDIATE_GROUP_NAME, intermediate_group)
+ H5CX_RETRIEVE_PROP_VALID(lcpl, H5P_LINK_CREATE_DEFAULT, H5L_CRT_INTERMEDIATE_GROUP_NAME,
+ intermediate_group)
/* Get the value */
*crt_intermed_group = (*head)->ctx.intermediate_group;
@@ -2558,7 +2597,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_create_intermediate_group() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_nlinks
*
@@ -2574,8 +2612,9 @@ done:
herr_t
H5CX_get_nlinks(size_t *nlinks)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2593,7 +2632,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_nlinks() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_libver_bounds
*
@@ -2609,8 +2647,9 @@ done:
herr_t
H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2624,14 +2663,13 @@ H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound)
H5CX_RETRIEVE_PROP_VALID(fapl, H5P_FILE_ACCESS_DEFAULT, H5F_ACS_LIBVER_HIGH_BOUND_NAME, high_bound)
/* Get the values */
- *low_bound = (*head)->ctx.low_bound;
+ *low_bound = (*head)->ctx.low_bound;
*high_bound = (*head)->ctx.high_bound;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_libver_bounds() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_dset_min_ohdr_flag
*
@@ -2648,8 +2686,9 @@ done:
herr_t
H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2658,7 +2697,8 @@ H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag)
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id);
- H5CX_RETRIEVE_PROP_VALID(dcpl, H5P_DATASET_CREATE_DEFAULT, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, do_min_dset_ohdr)
+ H5CX_RETRIEVE_PROP_VALID(dcpl, H5P_DATASET_CREATE_DEFAULT, H5D_CRT_MIN_DSET_HDR_SIZE_NAME,
+ do_min_dset_ohdr)
/* Get the value */
*dset_min_ohdr_flag = (*head)->ctx.do_min_dset_ohdr;
@@ -2667,7 +2707,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_dset_min_ohdr_flag() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_ext_file_prefix
*
@@ -2683,8 +2722,9 @@ done:
herr_t
H5CX_get_ext_file_prefix(const char **extfile_prefix)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2694,22 +2734,23 @@ H5CX_get_ext_file_prefix(const char **extfile_prefix)
HDassert(H5P_DEFAULT != (*head)->ctx.dapl_id);
/* Check if the value has been retrieved already */
- if(!(*head)->ctx.extfile_prefix_valid) {
+ if (!(*head)->ctx.extfile_prefix_valid) {
/* Check for default DAPL */
- if((*head)->ctx.dapl_id == H5P_DATASET_ACCESS_DEFAULT)
+ if ((*head)->ctx.dapl_id == H5P_DATASET_ACCESS_DEFAULT)
(*head)->ctx.extfile_prefix = H5CX_def_dapl_cache.extfile_prefix;
else {
/* Check if the property list is already available */
- if(NULL == (*head)->ctx.dapl)
+ if (NULL == (*head)->ctx.dapl)
/* Get the dataset access property list pointer */
- if(NULL == ((*head)->ctx.dapl = (H5P_genplist_t *)H5I_object((*head)->ctx.dapl_id)))
- HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "can't get default dataset access property list")
+ if (NULL == ((*head)->ctx.dapl = (H5P_genplist_t *)H5I_object((*head)->ctx.dapl_id)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL,
+ "can't get default dataset access property list")
/* Get the prefix for the external file */
/* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need
* to copy it and free this in the H5CX pop routine. -QAK)
*/
- if(H5P_peek((*head)->ctx.dapl, H5D_ACS_EFILE_PREFIX_NAME, &(*head)->ctx.extfile_prefix) < 0)
+ if (H5P_peek((*head)->ctx.dapl, H5D_ACS_EFILE_PREFIX_NAME, &(*head)->ctx.extfile_prefix) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve external file prefix")
} /* end else */
@@ -2724,7 +2765,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_ext_file_prefix() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_vds_prefix
*
@@ -2740,8 +2780,9 @@ done:
herr_t
H5CX_get_vds_prefix(const char **vds_prefix)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2751,22 +2792,23 @@ H5CX_get_vds_prefix(const char **vds_prefix)
HDassert(H5P_DEFAULT != (*head)->ctx.dapl_id);
/* Check if the value has been retrieved already */
- if(!(*head)->ctx.vds_prefix_valid) {
+ if (!(*head)->ctx.vds_prefix_valid) {
/* Check for default DAPL */
- if((*head)->ctx.dapl_id == H5P_DATASET_ACCESS_DEFAULT)
+ if ((*head)->ctx.dapl_id == H5P_DATASET_ACCESS_DEFAULT)
(*head)->ctx.vds_prefix = H5CX_def_dapl_cache.vds_prefix;
else {
/* Check if the property list is already available */
- if(NULL == (*head)->ctx.dapl)
+ if (NULL == (*head)->ctx.dapl)
/* Get the dataset access property list pointer */
- if(NULL == ((*head)->ctx.dapl = (H5P_genplist_t *)H5I_object((*head)->ctx.dapl_id)))
- HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "can't get default dataset access property list")
+ if (NULL == ((*head)->ctx.dapl = (H5P_genplist_t *)H5I_object((*head)->ctx.dapl_id)))
+ HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL,
+ "can't get default dataset access property list")
/* Get the prefix for the VDS */
/* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need
* to copy it and free this in the H5CX pop routine. -QAK)
*/
- if(H5P_peek((*head)->ctx.dapl, H5D_ACS_VDS_PREFIX_NAME, &(*head)->ctx.vds_prefix) < 0)
+ if (H5P_peek((*head)->ctx.dapl, H5D_ACS_VDS_PREFIX_NAME, &(*head)->ctx.vds_prefix) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VDS prefix")
} /* end else */
@@ -2781,7 +2823,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_vds_prefix() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_tag
*
@@ -2797,7 +2838,8 @@ done:
void
H5CX_set_tag(haddr_t tag)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -2809,7 +2851,6 @@ H5CX_set_tag(haddr_t tag)
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_tag() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_ring
*
@@ -2825,7 +2866,8 @@ H5CX_set_tag(haddr_t tag)
void
H5CX_set_ring(H5AC_ring_t ring)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -2838,7 +2880,7 @@ H5CX_set_ring(H5AC_ring_t ring)
} /* end H5CX_set_ring() */
#ifdef H5_HAVE_PARALLEL
-
+
/*-------------------------------------------------------------------------
* Function: H5CX_set_coll_metadata_read
*
@@ -2854,7 +2896,8 @@ H5CX_set_ring(H5AC_ring_t ring)
void
H5CX_set_coll_metadata_read(hbool_t cmdr)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -2866,7 +2909,6 @@ H5CX_set_coll_metadata_read(hbool_t cmdr)
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_coll_metadata_read() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_mpi_coll_datatypes
*
@@ -2884,9 +2926,10 @@ H5CX_set_coll_metadata_read(hbool_t cmdr)
herr_t
H5CX_set_mpi_coll_datatypes(MPI_Datatype btype, MPI_Datatype ftype)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2901,7 +2944,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_set_mpi_coll_datatypes() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_io_xfer_mode
*
@@ -2917,8 +2959,9 @@ done:
herr_t
H5CX_set_io_xfer_mode(H5FD_mpio_xfer_t io_xfer_mode)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2935,7 +2978,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_set_io_xfer_mode() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_mpio_coll_opt
*
@@ -2951,8 +2993,9 @@ done:
herr_t
H5CX_set_mpio_coll_opt(H5FD_mpio_collective_opt_t mpio_coll_opt)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2969,7 +3012,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_set_mpio_coll_opt() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_mpi_file_flushing
*
@@ -2985,7 +3027,8 @@ done:
void
H5CX_set_mpi_file_flushing(hbool_t flushing)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -2997,11 +3040,11 @@ H5CX_set_mpi_file_flushing(hbool_t flushing)
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_mpi_file_flushing() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_mpio_rank0_bcast
*
- * Purpose: Sets the "dataset meets read-with-rank0-and-bcast requirements" flag for the current API call context.
+ * Purpose: Sets the "dataset meets read-with-rank0-and-bcast requirements" flag for the current API call
+ *context.
*
* Return: <none>
*
@@ -3013,7 +3056,8 @@ H5CX_set_mpi_file_flushing(hbool_t flushing)
void
H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -3026,7 +3070,6 @@ H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast)
} /* end H5CX_set_mpio_rank0_bcast() */
#endif /* H5_HAVE_PARALLEL */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_vlen_alloc_info
*
@@ -3040,11 +3083,11 @@ H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast)
*-------------------------------------------------------------------------
*/
herr_t
-H5CX_set_vlen_alloc_info(H5MM_allocate_t alloc_func,
- void *alloc_info, H5MM_free_t free_func, void *free_info)
+H5CX_set_vlen_alloc_info(H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func, void *free_info)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -3054,8 +3097,8 @@ H5CX_set_vlen_alloc_info(H5MM_allocate_t alloc_func,
/* Set the API context value */
(*head)->ctx.vl_alloc_info.alloc_func = alloc_func;
(*head)->ctx.vl_alloc_info.alloc_info = alloc_info;
- (*head)->ctx.vl_alloc_info.free_func = free_func;
- (*head)->ctx.vl_alloc_info.free_info = free_info;
+ (*head)->ctx.vl_alloc_info.free_func = free_func;
+ (*head)->ctx.vl_alloc_info.free_info = free_info;
/* Mark the value as valid */
(*head)->ctx.vl_alloc_info_valid = TRUE;
@@ -3064,7 +3107,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_set_vlen_alloc_info() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_nlinks
*
@@ -3080,8 +3122,9 @@ done:
herr_t
H5CX_set_nlinks(size_t nlinks)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -3099,7 +3142,7 @@ done:
} /* end H5CX_set_nlinks() */
#ifdef H5_HAVE_PARALLEL
-
+
/*-------------------------------------------------------------------------
* Function: H5CX_set_mpio_actual_chunk_opt
*
@@ -3115,23 +3158,22 @@ done:
void
H5CX_set_mpio_actual_chunk_opt(H5D_mpio_actual_chunk_opt_mode_t mpio_actual_chunk_opt)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
HDassert(head && *head);
- HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT ||
- (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
+ HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
/* Cache the value for later, marking it to set in DXPL when context popped */
- (*head)->ctx.mpio_actual_chunk_opt = mpio_actual_chunk_opt;
+ (*head)->ctx.mpio_actual_chunk_opt = mpio_actual_chunk_opt;
(*head)->ctx.mpio_actual_chunk_opt_set = TRUE;
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_mpio_actual_chunk_opt() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_mpio_actual_io_mode
*
@@ -3147,23 +3189,22 @@ H5CX_set_mpio_actual_chunk_opt(H5D_mpio_actual_chunk_opt_mode_t mpio_actual_chun
void
H5CX_set_mpio_actual_io_mode(H5D_mpio_actual_io_mode_t mpio_actual_io_mode)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
HDassert(head && *head);
- HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT ||
- (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
+ HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
/* Cache the value for later, marking it to set in DXPL when context popped */
- (*head)->ctx.mpio_actual_io_mode = mpio_actual_io_mode;
+ (*head)->ctx.mpio_actual_io_mode = mpio_actual_io_mode;
(*head)->ctx.mpio_actual_io_mode_set = TRUE;
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_mpio_actual_chunk_opt() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_mpio_local_no_coll_cause
*
@@ -3179,7 +3220,8 @@ H5CX_set_mpio_actual_io_mode(H5D_mpio_actual_io_mode_t mpio_actual_io_mode)
void
H5CX_set_mpio_local_no_coll_cause(uint32_t mpio_local_no_coll_cause)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -3188,16 +3230,15 @@ H5CX_set_mpio_local_no_coll_cause(uint32_t mpio_local_no_coll_cause)
HDassert((*head)->ctx.dxpl_id != H5P_DEFAULT);
/* If we're using the default DXPL, don't modify it */
- if((*head)->ctx.dxpl_id != H5P_DATASET_XFER_DEFAULT) {
+ if ((*head)->ctx.dxpl_id != H5P_DATASET_XFER_DEFAULT) {
/* Cache the value for later, marking it to set in DXPL when context popped */
- (*head)->ctx.mpio_local_no_coll_cause = mpio_local_no_coll_cause;
+ (*head)->ctx.mpio_local_no_coll_cause = mpio_local_no_coll_cause;
(*head)->ctx.mpio_local_no_coll_cause_set = TRUE;
} /* end if */
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_mpio_local_no_coll_cause() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_set_mpio_global_no_coll_cause
*
@@ -3213,7 +3254,8 @@ H5CX_set_mpio_local_no_coll_cause(uint32_t mpio_local_no_coll_cause)
void
H5CX_set_mpio_global_no_coll_cause(uint32_t mpio_global_no_coll_cause)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -3222,9 +3264,9 @@ H5CX_set_mpio_global_no_coll_cause(uint32_t mpio_global_no_coll_cause)
HDassert((*head)->ctx.dxpl_id != H5P_DEFAULT);
/* If we're using the default DXPL, don't modify it */
- if((*head)->ctx.dxpl_id != H5P_DATASET_XFER_DEFAULT) {
+ if ((*head)->ctx.dxpl_id != H5P_DATASET_XFER_DEFAULT) {
/* Cache the value for later, marking it to set in DXPL when context popped */
- (*head)->ctx.mpio_global_no_coll_cause = mpio_global_no_coll_cause;
+ (*head)->ctx.mpio_global_no_coll_cause = mpio_global_no_coll_cause;
(*head)->ctx.mpio_global_no_coll_cause_set = TRUE;
} /* end if */
@@ -3232,7 +3274,7 @@ H5CX_set_mpio_global_no_coll_cause(uint32_t mpio_global_no_coll_cause)
} /* end H5CX_set_mpio_global_no_coll_cause() */
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
-
+
/*-------------------------------------------------------------------------
* Function: H5CX_test_set_mpio_coll_chunk_link_hard
*
@@ -3250,15 +3292,15 @@ H5CX_set_mpio_global_no_coll_cause(uint32_t mpio_global_no_coll_cause)
herr_t
H5CX_test_set_mpio_coll_chunk_link_hard(int mpio_coll_chunk_link_hard)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
HDassert(head && *head);
- HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT ||
- (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
+ HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
H5CX_TEST_SET_PROP(H5D_XFER_COLL_CHUNK_LINK_HARD_NAME, mpio_coll_chunk_link_hard)
@@ -3266,7 +3308,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_test_set_mpio_coll_chunk_link_hard() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_test_set_mpio_coll_chunk_multi_hard
*
@@ -3284,15 +3325,15 @@ done:
herr_t
H5CX_test_set_mpio_coll_chunk_multi_hard(int mpio_coll_chunk_multi_hard)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
HDassert(head && *head);
- HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT ||
- (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
+ HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
H5CX_TEST_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME, mpio_coll_chunk_multi_hard)
@@ -3300,7 +3341,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_test_set_mpio_coll_chunk_multi_hard() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_test_set_mpio_coll_chunk_link_num_true
*
@@ -3318,15 +3358,15 @@ done:
herr_t
H5CX_test_set_mpio_coll_chunk_link_num_true(int mpio_coll_chunk_link_num_true)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
HDassert(head && *head);
- HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT ||
- (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
+ HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
H5CX_TEST_SET_PROP(H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME, mpio_coll_chunk_link_num_true)
@@ -3334,11 +3374,11 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_test_set_mpio_coll_chunk_link_num_true() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_test_set_mpio_coll_chunk_link_num_false
*
- * Purpose: Sets the instrumented "collective chunk link num false" value for the current API call context.
+ * Purpose: Sets the instrumented "collective chunk link num false" value for the current API call
+ *context.
*
* Note: Only sets value if property set in DXPL
*
@@ -3352,15 +3392,15 @@ done:
herr_t
H5CX_test_set_mpio_coll_chunk_link_num_false(int mpio_coll_chunk_link_num_false)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
HDassert(head && *head);
- HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT ||
- (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
+ HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
H5CX_TEST_SET_PROP(H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME, mpio_coll_chunk_link_num_false)
@@ -3368,11 +3408,11 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_test_set_mpio_coll_chunk_link_num_false() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_test_set_mpio_coll_chunk_multi_ratio_coll
*
- * Purpose: Sets the instrumented "collective chunk multi ratio coll" value for the current API call context.
+ * Purpose: Sets the instrumented "collective chunk multi ratio coll" value for the current API call
+ *context.
*
* Note: Only sets value if property set in DXPL
*
@@ -3386,15 +3426,15 @@ done:
herr_t
H5CX_test_set_mpio_coll_chunk_multi_ratio_coll(int mpio_coll_chunk_multi_ratio_coll)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
HDassert(head && *head);
- HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT ||
- (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
+ HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
H5CX_TEST_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME, mpio_coll_chunk_multi_ratio_coll)
@@ -3402,11 +3442,11 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_test_set_mpio_coll_chunk_multi_ratio_coll() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_test_set_mpio_coll_chunk_multi_ratio_ind
*
- * Purpose: Sets the instrumented "collective chunk multi ratio ind" value for the current API call context.
+ * Purpose: Sets the instrumented "collective chunk multi ratio ind" value for the current API call
+ *context.
*
* Note: Only sets value if property set in DXPL
*
@@ -3420,15 +3460,15 @@ done:
herr_t
H5CX_test_set_mpio_coll_chunk_multi_ratio_ind(int mpio_coll_chunk_multi_ratio_ind)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
HDassert(head && *head);
- HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT ||
- (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
+ HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
H5CX_TEST_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME, mpio_coll_chunk_multi_ratio_ind)
@@ -3436,7 +3476,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_test_set_mpio_coll_chunk_multi_ratio_ind() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_test_set_mpio_coll_rank0_bcast
*
@@ -3454,15 +3493,15 @@ done:
herr_t
H5CX_test_set_mpio_coll_rank0_bcast(hbool_t mpio_coll_rank0_bcast)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
HDassert(head && *head);
- HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT ||
- (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
+ HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
H5CX_TEST_SET_PROP(H5D_XFER_COLL_RANK0_BCAST_NAME, mpio_coll_rank0_bcast)
@@ -3472,7 +3511,6 @@ done:
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
-
/*-------------------------------------------------------------------------
* Function: H5CX_get_ohdr_flags
*
@@ -3488,8 +3526,9 @@ done:
herr_t
H5CX_get_ohdr_flags(uint8_t *ohdr_flags)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -3507,7 +3546,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* End H5CX_get_ohdr_flags() */
-
/*-------------------------------------------------------------------------
* Function: H5CX__pop_common
*
@@ -3523,8 +3561,9 @@ done:
static H5CX_node_t *
H5CX__pop_common(void)
{
- H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- H5CX_node_t *ret_value = NULL; /* Return value */
+ H5CX_node_t **head =
+ H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t *ret_value = NULL; /* Return value */
#ifdef H5_HAVE_PARALLEL
FUNC_ENTER_STATIC
@@ -3554,7 +3593,7 @@ H5CX__pop_common(void)
/* Pop the top context node from the stack */
ret_value = (*head);
- (*head) = (*head)->next;
+ (*head) = (*head)->next;
#ifdef H5_HAVE_PARALLEL
done:
@@ -3562,7 +3601,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX__pop_common() */
-
/*-------------------------------------------------------------------------
* Function: H5CX_pop
*
@@ -3578,13 +3616,13 @@ done:
herr_t
H5CX_pop(void)
{
- H5CX_node_t *cnode; /* Context node */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t *cnode; /* Context node */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Perform common operations and get top context from stack */
- if(NULL == (cnode = H5CX__pop_common()))
+ if (NULL == (cnode = H5CX__pop_common()))
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "error getting API context node")
/* Free the context node */
@@ -3593,4 +3631,3 @@ H5CX_pop(void)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_pop() */
-
diff --git a/src/H5CXmodule.h b/src/H5CXmodule.h
index 186f8aa..6bfad98 100644
--- a/src/H5CXmodule.h
+++ b/src/H5CXmodule.h
@@ -25,9 +25,8 @@
* reporting macros.
*/
#define H5CX_MODULE
-#define H5_MY_PKG H5CX
-#define H5_MY_PKG_ERR H5E_CONTEXT
-#define H5_MY_PKG_INIT YES
+#define H5_MY_PKG H5CX
+#define H5_MY_PKG_ERR H5E_CONTEXT
+#define H5_MY_PKG_INIT YES
#endif /* _H5CXmodule_H */
-
diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h
index 2ae71f3..767ccf1 100644
--- a/src/H5CXprivate.h
+++ b/src/H5CXprivate.h
@@ -22,44 +22,40 @@
#endif /* NOT_YET */
/* Private headers needed by this file */
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
#ifdef H5_HAVE_PARALLEL
-#include "H5FDprivate.h" /* File drivers */
-#endif /* H5_HAVE_PARALLEL */
-#include "H5Zprivate.h" /* Data filters */
-
+#include "H5FDprivate.h" /* File drivers */
+#endif /* H5_HAVE_PARALLEL */
+#include "H5Zprivate.h" /* Data filters */
/**************************/
/* Library Private Macros */
/**************************/
-
/****************************/
/* Library Private Typedefs */
/****************************/
/* API context state */
typedef struct H5CX_state_t {
- hid_t dcpl_id; /* DCPL for operation */
- hid_t dxpl_id; /* DXPL for operation */
- hid_t lapl_id; /* LAPL for operation */
- hid_t lcpl_id; /* LCPL for operation */
- void *vol_wrap_ctx; /* VOL connector's "wrap context" for creating IDs */
- H5VL_connector_prop_t vol_connector_prop; /* VOL connector property */
+ hid_t dcpl_id; /* DCPL for operation */
+ hid_t dxpl_id; /* DXPL for operation */
+ hid_t lapl_id; /* LAPL for operation */
+ hid_t lcpl_id; /* LCPL for operation */
+ void * vol_wrap_ctx; /* VOL connector's "wrap context" for creating IDs */
+ H5VL_connector_prop_t vol_connector_prop; /* VOL connector property */
#ifdef H5_HAVE_PARALLEL
/* Internal: Parallel I/O settings */
hbool_t coll_metadata_read; /* Whether to use collective I/O for metadata read */
-#endif /* H5_HAVE_PARALLEL */
+#endif /* H5_HAVE_PARALLEL */
} H5CX_state_t;
-
/*****************************/
/* Library-private Variables */
/*****************************/
-
/***************************************/
/* Library-private Function Prototypes */
/***************************************/
@@ -68,8 +64,8 @@ typedef struct H5CX_state_t {
#ifndef _H5private_H
H5_DLL herr_t H5CX_push(void);
H5_DLL herr_t H5CX_pop(void);
-#endif /* _H5private_H */
-H5_DLL void H5CX_push_special(void);
+#endif /* _H5private_H */
+H5_DLL void H5CX_push_special(void);
H5_DLL hbool_t H5CX_is_def_dxpl(void);
/* API context state routines */
@@ -78,27 +74,27 @@ H5_DLL herr_t H5CX_restore_state(const H5CX_state_t *api_state);
H5_DLL herr_t H5CX_free_state(H5CX_state_t *api_state);
/* "Setter" routines for API context info */
-H5_DLL void H5CX_set_dxpl(hid_t dxpl_id);
-H5_DLL void H5CX_set_lcpl(hid_t lcpl_id);
-H5_DLL void H5CX_set_lapl(hid_t lapl_id);
-H5_DLL void H5CX_set_dcpl(hid_t dcpl_id);
+H5_DLL void H5CX_set_dxpl(hid_t dxpl_id);
+H5_DLL void H5CX_set_lcpl(hid_t lcpl_id);
+H5_DLL void H5CX_set_lapl(hid_t lapl_id);
+H5_DLL void H5CX_set_dcpl(hid_t dcpl_id);
H5_DLL herr_t H5CX_set_libver_bounds(H5F_t *f);
-H5_DLL herr_t H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
- hid_t loc_id, hbool_t is_collective);
+H5_DLL herr_t H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t loc_id,
+ hbool_t is_collective);
H5_DLL herr_t H5CX_set_loc(hid_t loc_id);
H5_DLL herr_t H5CX_set_vol_wrap_ctx(void *wrap_ctx);
H5_DLL herr_t H5CX_set_vol_connector_prop(const H5VL_connector_prop_t *vol_connector_prop);
/* "Getter" routines for API context info */
-H5_DLL hid_t H5CX_get_dxpl(void);
-H5_DLL hid_t H5CX_get_lapl(void);
-H5_DLL herr_t H5CX_get_vol_wrap_ctx(void **wrap_ctx);
-H5_DLL herr_t H5CX_get_vol_connector_prop(H5VL_connector_prop_t *vol_connector_prop);
-H5_DLL haddr_t H5CX_get_tag(void);
+H5_DLL hid_t H5CX_get_dxpl(void);
+H5_DLL hid_t H5CX_get_lapl(void);
+H5_DLL herr_t H5CX_get_vol_wrap_ctx(void **wrap_ctx);
+H5_DLL herr_t H5CX_get_vol_connector_prop(H5VL_connector_prop_t *vol_connector_prop);
+H5_DLL haddr_t H5CX_get_tag(void);
H5_DLL H5AC_ring_t H5CX_get_ring(void);
#ifdef H5_HAVE_PARALLEL
H5_DLL hbool_t H5CX_get_coll_metadata_read(void);
-H5_DLL herr_t H5CX_get_mpi_coll_datatypes(MPI_Datatype *btype, MPI_Datatype *ftype);
+H5_DLL herr_t H5CX_get_mpi_coll_datatypes(MPI_Datatype *btype, MPI_Datatype *ftype);
H5_DLL hbool_t H5CX_get_mpi_file_flushing(void);
H5_DLL hbool_t H5CX_get_mpio_rank0_bcast(void);
#endif /* H5_HAVE_PARALLEL */
@@ -126,8 +122,8 @@ H5_DLL herr_t H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info);
H5_DLL herr_t H5CX_get_dt_conv_cb(H5T_conv_cb_t *cb_struct);
/* "Getter" routines for LCPL properties cached in API context */
-H5_DLL herr_t H5CX_get_encoding(H5T_cset_t* encoding);
-H5_DLL herr_t H5CX_get_intermediate_group(unsigned* crt_intermed_group);
+H5_DLL herr_t H5CX_get_encoding(H5T_cset_t *encoding);
+H5_DLL herr_t H5CX_get_intermediate_group(unsigned *crt_intermed_group);
/* "Getter" routines for LAPL properties cached in API context */
H5_DLL herr_t H5CX_get_nlinks(size_t *nlinks);
@@ -147,19 +143,19 @@ H5_DLL herr_t H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high
H5_DLL void H5CX_set_tag(haddr_t tag);
H5_DLL void H5CX_set_ring(H5AC_ring_t ring);
#ifdef H5_HAVE_PARALLEL
-H5_DLL void H5CX_set_coll_metadata_read(hbool_t cmdr);
+H5_DLL void H5CX_set_coll_metadata_read(hbool_t cmdr);
H5_DLL herr_t H5CX_set_mpi_coll_datatypes(MPI_Datatype btype, MPI_Datatype ftype);
H5_DLL herr_t H5CX_set_mpio_coll_opt(H5FD_mpio_collective_opt_t mpio_coll_opt);
-H5_DLL void H5CX_set_mpi_file_flushing(hbool_t flushing);
-H5_DLL void H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast);
+H5_DLL void H5CX_set_mpi_file_flushing(hbool_t flushing);
+H5_DLL void H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast);
#endif /* H5_HAVE_PARALLEL */
/* "Setter" routines for DXPL properties cached in API context */
#ifdef H5_HAVE_PARALLEL
H5_DLL herr_t H5CX_set_io_xfer_mode(H5FD_mpio_xfer_t io_xfer_mode);
#endif /* H5_HAVE_PARALLEL */
-H5_DLL herr_t H5CX_set_vlen_alloc_info(H5MM_allocate_t alloc_func,
- void *alloc_info, H5MM_free_t free_func, void *free_info);
+H5_DLL herr_t H5CX_set_vlen_alloc_info(H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func,
+ void *free_info);
/* "Setter" routines for LAPL properties cached in API context */
H5_DLL herr_t H5CX_set_nlinks(size_t nlinks);
@@ -182,4 +178,3 @@ H5_DLL herr_t H5CX_test_set_mpio_coll_rank0_bcast(hbool_t rank0_bcast);
#endif /* H5_HAVE_PARALLEL */
#endif /* _H5CXprivate_H */
-
diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c
index dae735d..a8917ea 100644
--- a/src/H5Cdbg.c
+++ b/src/H5Cdbg.c
@@ -26,50 +26,42 @@
/* Module Setup */
/****************/
-#include "H5Cmodule.h" /* This source code file is part of the H5C module */
-
+#include "H5Cmodule.h" /* This source code file is part of the H5C module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata Cache */
-#include "H5Cpkg.h" /* Cache */
-#include "H5Eprivate.h" /* Error Handling */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata Cache */
+#include "H5Cpkg.h" /* Cache */
+#include "H5Eprivate.h" /* Error Handling */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
#ifndef NDEBUG
-
+
/*-------------------------------------------------------------------------
* Function: H5C_dump_cache
*
@@ -84,39 +76,39 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5C_dump_cache(H5C_t * cache_ptr, const char * cache_name)
+H5C_dump_cache(H5C_t *cache_ptr, const char *cache_name)
{
- H5C_cache_entry_t * entry_ptr;
- H5SL_t * slist_ptr = NULL;
- int i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_cache_entry_t *entry_ptr;
+ H5SL_t * slist_ptr = NULL;
+ int i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(cache_ptr != NULL);
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_name != NULL );
+ HDassert(cache_name != NULL);
/* First, create a skip list */
- if(NULL == (slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
+ if (NULL == (slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create skip list")
/* Next, scan the index, and insert all entries in the skip list.
* Do this, as we want to display cache entries in increasing address
* order.
*/
- for(i = 0; i < H5C__HASH_TABLE_LEN; i++) {
+ for (i = 0; i < H5C__HASH_TABLE_LEN; i++) {
entry_ptr = cache_ptr->index[i];
- while(entry_ptr != NULL) {
+ while (entry_ptr != NULL) {
HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- if(H5SL_insert(slist_ptr, entry_ptr, &(entry_ptr->addr)) < 0)
+ if (H5SL_insert(slist_ptr, entry_ptr, &(entry_ptr->addr)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "can't insert entry in skip list")
entry_ptr = entry_ptr->ht_next;
} /* end while */
- } /* end for */
+ } /* end for */
/* If we get this far, all entries in the cache are listed in the
* skip list -- scan the skip list generating the desired output.
@@ -134,17 +126,18 @@ H5C_dump_cache(H5C_t * cache_ptr, const char * cache_name)
HDfprintf(stdout, "| Prot/Pin/Dirty");
HDfprintf(stdout, "\n");
- HDfprintf(stdout, "----------------------------------------------------------------------------------------------------------------\n");
+ HDfprintf(stdout, "--------------------------------------------------------------------------------------"
+ "--------------------------\n");
- i = 0;
+ i = 0;
entry_ptr = (H5C_cache_entry_t *)H5SL_remove_first(slist_ptr);
- while(entry_ptr != NULL) {
+ while (entry_ptr != NULL) {
HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
/* Print entry */
HDfprintf(stdout, "%s%5d ", cache_ptr->prefix, i);
HDfprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->addr));
- if(NULL == entry_ptr->tag_info)
+ if (NULL == entry_ptr->tag_info)
HDfprintf(stdout, " %16s ", "N/A");
else
HDfprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->tag_info->tag));
@@ -169,7 +162,7 @@ H5C_dump_cache(H5C_t * cache_ptr, const char * cache_name)
done:
/* Discard the skip list */
- if(slist_ptr)
+ if (slist_ptr)
H5SL_close(slist_ptr);
FUNC_LEAVE_NOAPI(ret_value)
@@ -177,7 +170,7 @@ done:
#endif /* NDEBUG */
#ifndef NDEBUG
-
+
/*-------------------------------------------------------------------------
* Function: H5C_dump_cache_LRU
*
@@ -194,21 +187,21 @@ done:
herr_t
H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name)
{
- H5C_cache_entry_t * entry_ptr;
- int i = 0;
+ H5C_cache_entry_t *entry_ptr;
+ int i = 0;
FUNC_ENTER_NOAPI_NOERR
/* Sanity check */
HDassert(cache_ptr != NULL);
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_name != NULL );
+ HDassert(cache_name != NULL);
HDfprintf(stdout, "\n\nDump of metadata cache LRU \"%s\"\n", cache_name);
- HDfprintf(stdout, "LRU len = %d, LRU size = %d\n",
- cache_ptr->LRU_list_len, (int)(cache_ptr->LRU_list_size));
- HDfprintf(stdout, "index_size = %d, max_cache_size = %d, delta = %d\n\n",
- (int)(cache_ptr->index_size), (int)(cache_ptr->max_cache_size),
+ HDfprintf(stdout, "LRU len = %d, LRU size = %d\n", cache_ptr->LRU_list_len,
+ (int)(cache_ptr->LRU_list_size));
+ HDfprintf(stdout, "index_size = %d, max_cache_size = %d, delta = %d\n\n", (int)(cache_ptr->index_size),
+ (int)(cache_ptr->max_cache_size),
(int)(cache_ptr->max_cache_size) - (int)(cache_ptr->index_size));
/* Print header */
@@ -221,26 +214,25 @@ H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name)
HDfprintf(stdout, "| Dirty");
HDfprintf(stdout, "\n");
- HDfprintf(stdout, "----------------------------------------------------------------------------------------------------------------\n");
+ HDfprintf(stdout, "--------------------------------------------------------------------------------------"
+ "--------------------------\n");
entry_ptr = cache_ptr->LRU_head_ptr;
- while(entry_ptr != NULL) {
+ while (entry_ptr != NULL) {
HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
/* Print entry */
HDfprintf(stdout, "%s%5d ", cache_ptr->prefix, i);
HDfprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->addr));
- if(NULL == entry_ptr->tag_info)
+ if (NULL == entry_ptr->tag_info)
HDfprintf(stdout, " %16s ", "N/A");
else
- HDfprintf(stdout, " 0x%16llx ",
- (long long)(entry_ptr->tag_info->tag));
+ HDfprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->tag_info->tag));
HDfprintf(stdout, " %5lld ", (long long)(entry_ptr->size));
HDfprintf(stdout, " %d ", (int)(entry_ptr->ring));
- HDfprintf(stdout, " %2d %-32s ", (int)(entry_ptr->type->id),
- (entry_ptr->type->name));
+ HDfprintf(stdout, " %2d %-32s ", (int)(entry_ptr->type->id), (entry_ptr->type->name));
HDfprintf(stdout, " %d", (int)(entry_ptr->is_dirty));
HDfprintf(stdout, "\n");
@@ -248,13 +240,13 @@ H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name)
entry_ptr = entry_ptr->next;
} /* end while */
- HDfprintf(stdout, "----------------------------------------------------------------------------------------------------------------\n");
+ HDfprintf(stdout, "--------------------------------------------------------------------------------------"
+ "--------------------------\n");
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5C_dump_cache_LRU() */
#endif /* NDEBUG */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_dump_cache_skip_list
@@ -269,7 +261,7 @@ H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name)
* 11/15/14
*
* Changes: Updated function for the slist_enabled field in H5C_t.
- * Recall that to minimize slist overhead, the slist is
+ * Recall that to minimize slist overhead, the slist is
* empty and not maintained if cache_ptr->slist_enabled is
* false.
* JRM -- 5/6/20
@@ -278,12 +270,12 @@ H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name)
*/
#ifndef NDEBUG
herr_t
-H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn)
+H5C_dump_cache_skip_list(H5C_t *cache_ptr, char *calling_fcn)
{
- herr_t ret_value = SUCCEED; /* Return value */
- int i;
- H5C_cache_entry_t * entry_ptr = NULL;
- H5SL_node_t * node_ptr = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
+ int i;
+ H5C_cache_entry_t *entry_ptr = NULL;
+ H5SL_node_t * node_ptr = NULL;
FUNC_ENTER_NOAPI_NOERR
@@ -291,60 +283,51 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn)
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
HDassert(calling_fcn != NULL);
- HDfprintf(stdout, "\n\nDumping metadata cache skip list from %s.\n",
- calling_fcn);
- HDfprintf(stdout, " slist %s.\n",
- cache_ptr->slist_enabled ? "enabled" : "disabled");
+ HDfprintf(stdout, "\n\nDumping metadata cache skip list from %s.\n", calling_fcn);
+ HDfprintf(stdout, " slist %s.\n", cache_ptr->slist_enabled ? "enabled" : "disabled");
HDfprintf(stdout, " slist len = %" PRIu32 ".\n", cache_ptr->slist_len);
HDfprintf(stdout, " slist size = %zu.\n", cache_ptr->slist_size);
- if(cache_ptr->slist_len > 0) {
+ if (cache_ptr->slist_len > 0) {
/* If we get this far, all entries in the cache are listed in the
* skip list -- scan the skip list generating the desired output.
*/
- HDfprintf(stdout,
- "Num: Addr: Len: Prot/Pind: Dirty: Type:\n");
+ HDfprintf(stdout, "Num: Addr: Len: Prot/Pind: Dirty: Type:\n");
i = 0;
node_ptr = H5SL_first(cache_ptr->slist_ptr);
- if ( node_ptr != NULL ) {
+ if (node_ptr != NULL) {
entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
-
- } else {
+ }
+ else {
entry_ptr = NULL;
}
- while ( entry_ptr != NULL ) {
+ while (entry_ptr != NULL) {
- HDassert( entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC );
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDfprintf(stdout,
- "%s%d 0x%016llx %4lld %d/%d %d %s\n",
- cache_ptr->prefix, i,
- (long long)(entry_ptr->addr),
- (long long)(entry_ptr->size),
- (int)(entry_ptr->is_protected),
- (int)(entry_ptr->is_pinned),
- (int)(entry_ptr->is_dirty),
- entry_ptr->type->name);
+ HDfprintf(stdout, "%s%d 0x%016llx %4lld %d/%d %d %s\n", cache_ptr->prefix, i,
+ (long long)(entry_ptr->addr), (long long)(entry_ptr->size),
+ (int)(entry_ptr->is_protected), (int)(entry_ptr->is_pinned), (int)(entry_ptr->is_dirty),
+ entry_ptr->type->name);
- HDfprintf(stdout, " node_ptr = %p, item = %p\n",
- (void *)node_ptr, H5SL_item(node_ptr));
+ HDfprintf(stdout, " node_ptr = %p, item = %p\n", (void *)node_ptr, H5SL_item(node_ptr));
/* increment node_ptr before we delete its target */
node_ptr = H5SL_next(node_ptr);
- if ( node_ptr != NULL ) {
+ if (node_ptr != NULL) {
entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
-
- } else {
+ }
+ else {
entry_ptr = NULL;
}
@@ -352,7 +335,7 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn)
i++;
} /* end while */
- } /* end if */
+ } /* end if */
HDfprintf(stdout, "\n\n");
@@ -361,7 +344,6 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn)
} /* H5C_dump_cache_skip_list() */
#endif /* NDEBUG */
-
/*-------------------------------------------------------------------------
* Function: H5C_set_prefix
*
@@ -376,14 +358,14 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn)
*-------------------------------------------------------------------------
*/
herr_t
-H5C_set_prefix(H5C_t * cache_ptr, char * prefix)
+H5C_set_prefix(H5C_t *cache_ptr, char *prefix)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC) ||
- (prefix == NULL) || (HDstrlen(prefix) >= H5C__PREFIX_LEN))
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC) || (prefix == NULL) ||
+ (HDstrlen(prefix) >= H5C__PREFIX_LEN))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry")
HDstrncpy(&(cache_ptr->prefix[0]), prefix, (size_t)(H5C__PREFIX_LEN));
@@ -394,7 +376,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_set_prefix() */
-
/*-------------------------------------------------------------------------
* Function: H5C_stats
*
@@ -408,479 +389,328 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_stats(H5C_t * cache_ptr,
- const char * cache_name,
+H5C_stats(H5C_t *cache_ptr, const char *cache_name,
hbool_t
#if !H5C_COLLECT_CACHE_STATS
- H5_ATTR_UNUSED
+ H5_ATTR_UNUSED
#endif /* H5C_COLLECT_CACHE_STATS */
- display_detailed_stats)
+ display_detailed_stats)
{
#if H5C_COLLECT_CACHE_STATS
- int i;
- int64_t total_hits = 0;
- int64_t total_misses = 0;
- int64_t total_write_protects = 0;
- int64_t total_read_protects = 0;
- int64_t max_read_protects = 0;
- int64_t total_insertions = 0;
- int64_t total_pinned_insertions = 0;
- int64_t total_clears = 0;
- int64_t total_flushes = 0;
- int64_t total_evictions = 0;
- int64_t total_take_ownerships = 0;
- int64_t total_moves = 0;
- int64_t total_entry_flush_moves = 0;
- int64_t total_cache_flush_moves = 0;
- int64_t total_size_increases = 0;
- int64_t total_size_decreases = 0;
- int64_t total_entry_flush_size_changes = 0;
- int64_t total_cache_flush_size_changes = 0;
- int64_t total_pins = 0;
- int64_t total_unpins = 0;
- int64_t total_dirty_pins = 0;
- int64_t total_pinned_flushes = 0;
- int64_t total_pinned_clears = 0;
- int32_t aggregate_max_accesses = 0;
- int32_t aggregate_min_accesses = 1000000;
- int32_t aggregate_max_clears = 0;
- int32_t aggregate_max_flushes = 0;
- size_t aggregate_max_size = 0;
- int32_t aggregate_max_pins = 0;
- double hit_rate;
- double prefetch_use_rate;
- double average_successful_search_depth = 0.0f;
- double average_failed_search_depth = 0.0f;
- double average_entries_skipped_per_calls_to_msic = 0.0f;
- double average_dirty_pf_entries_skipped_per_call_to_msic = 0.0f;
- double average_entries_scanned_per_calls_to_msic = 0.0f;
-#endif /* H5C_COLLECT_CACHE_STATS */
- herr_t ret_value = SUCCEED; /* Return value */
+ int i;
+ int64_t total_hits = 0;
+ int64_t total_misses = 0;
+ int64_t total_write_protects = 0;
+ int64_t total_read_protects = 0;
+ int64_t max_read_protects = 0;
+ int64_t total_insertions = 0;
+ int64_t total_pinned_insertions = 0;
+ int64_t total_clears = 0;
+ int64_t total_flushes = 0;
+ int64_t total_evictions = 0;
+ int64_t total_take_ownerships = 0;
+ int64_t total_moves = 0;
+ int64_t total_entry_flush_moves = 0;
+ int64_t total_cache_flush_moves = 0;
+ int64_t total_size_increases = 0;
+ int64_t total_size_decreases = 0;
+ int64_t total_entry_flush_size_changes = 0;
+ int64_t total_cache_flush_size_changes = 0;
+ int64_t total_pins = 0;
+ int64_t total_unpins = 0;
+ int64_t total_dirty_pins = 0;
+ int64_t total_pinned_flushes = 0;
+ int64_t total_pinned_clears = 0;
+ int32_t aggregate_max_accesses = 0;
+ int32_t aggregate_min_accesses = 1000000;
+ int32_t aggregate_max_clears = 0;
+ int32_t aggregate_max_flushes = 0;
+ size_t aggregate_max_size = 0;
+ int32_t aggregate_max_pins = 0;
+ double hit_rate;
+ double prefetch_use_rate;
+ double average_successful_search_depth = 0.0f;
+ double average_failed_search_depth = 0.0f;
+ double average_entries_skipped_per_calls_to_msic = 0.0f;
+ double average_dirty_pf_entries_skipped_per_call_to_msic = 0.0f;
+ double average_entries_scanned_per_calls_to_msic = 0.0f;
+#endif /* H5C_COLLECT_CACHE_STATS */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* This would normally be an assert, but we need to use an HGOTO_ERROR
* call to shut up the compiler.
*/
- if((NULL == cache_ptr) || (cache_ptr->magic != H5C__H5C_T_MAGIC) ||
- (NULL == cache_name))
+ if ((NULL == cache_ptr) || (cache_ptr->magic != H5C__H5C_T_MAGIC) || (NULL == cache_name))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr or cache_name")
#if H5C_COLLECT_CACHE_STATS
- for(i = 0; i <= cache_ptr->max_type_id; i++ ) {
- total_hits += cache_ptr->hits[i];
- total_misses += cache_ptr->misses[i];
- total_write_protects += cache_ptr->write_protects[i];
- total_read_protects += cache_ptr->read_protects[i];
- if(max_read_protects < cache_ptr->max_read_protects[i])
- max_read_protects = cache_ptr->max_read_protects[i];
- total_insertions += cache_ptr->insertions[i];
+ for (i = 0; i <= cache_ptr->max_type_id; i++) {
+ total_hits += cache_ptr->hits[i];
+ total_misses += cache_ptr->misses[i];
+ total_write_protects += cache_ptr->write_protects[i];
+ total_read_protects += cache_ptr->read_protects[i];
+ if (max_read_protects < cache_ptr->max_read_protects[i])
+ max_read_protects = cache_ptr->max_read_protects[i];
+ total_insertions += cache_ptr->insertions[i];
total_pinned_insertions += cache_ptr->pinned_insertions[i];
- total_clears += cache_ptr->clears[i];
- total_flushes += cache_ptr->flushes[i];
- total_evictions += cache_ptr->evictions[i];
- total_take_ownerships += cache_ptr->take_ownerships[i];
- total_moves += cache_ptr->moves[i];
- total_entry_flush_moves += cache_ptr->entry_flush_moves[i];
- total_cache_flush_moves += cache_ptr->cache_flush_moves[i];
- total_size_increases += cache_ptr->size_increases[i];
- total_size_decreases += cache_ptr->size_decreases[i];
- total_entry_flush_size_changes
- += cache_ptr->entry_flush_size_changes[i];
- total_cache_flush_size_changes
- += cache_ptr->cache_flush_size_changes[i];
- total_pins += cache_ptr->pins[i];
- total_unpins += cache_ptr->unpins[i];
- total_dirty_pins += cache_ptr->dirty_pins[i];
- total_pinned_flushes += cache_ptr->pinned_flushes[i];
- total_pinned_clears += cache_ptr->pinned_clears[i];
+ total_clears += cache_ptr->clears[i];
+ total_flushes += cache_ptr->flushes[i];
+ total_evictions += cache_ptr->evictions[i];
+ total_take_ownerships += cache_ptr->take_ownerships[i];
+ total_moves += cache_ptr->moves[i];
+ total_entry_flush_moves += cache_ptr->entry_flush_moves[i];
+ total_cache_flush_moves += cache_ptr->cache_flush_moves[i];
+ total_size_increases += cache_ptr->size_increases[i];
+ total_size_decreases += cache_ptr->size_decreases[i];
+ total_entry_flush_size_changes += cache_ptr->entry_flush_size_changes[i];
+ total_cache_flush_size_changes += cache_ptr->cache_flush_size_changes[i];
+ total_pins += cache_ptr->pins[i];
+ total_unpins += cache_ptr->unpins[i];
+ total_dirty_pins += cache_ptr->dirty_pins[i];
+ total_pinned_flushes += cache_ptr->pinned_flushes[i];
+ total_pinned_clears += cache_ptr->pinned_clears[i];
#if H5C_COLLECT_CACHE_ENTRY_STATS
- if(aggregate_max_accesses < cache_ptr->max_accesses[i])
+ if (aggregate_max_accesses < cache_ptr->max_accesses[i])
aggregate_max_accesses = cache_ptr->max_accesses[i];
- if(aggregate_min_accesses > aggregate_max_accesses)
+ if (aggregate_min_accesses > aggregate_max_accesses)
aggregate_min_accesses = aggregate_max_accesses;
- if(aggregate_min_accesses > cache_ptr->min_accesses[i])
+ if (aggregate_min_accesses > cache_ptr->min_accesses[i])
aggregate_min_accesses = cache_ptr->min_accesses[i];
- if(aggregate_max_clears < cache_ptr->max_clears[i])
+ if (aggregate_max_clears < cache_ptr->max_clears[i])
aggregate_max_clears = cache_ptr->max_clears[i];
- if(aggregate_max_flushes < cache_ptr->max_flushes[i])
+ if (aggregate_max_flushes < cache_ptr->max_flushes[i])
aggregate_max_flushes = cache_ptr->max_flushes[i];
- if(aggregate_max_size < cache_ptr->max_size[i])
+ if (aggregate_max_size < cache_ptr->max_size[i])
aggregate_max_size = cache_ptr->max_size[i];
- if(aggregate_max_pins < cache_ptr->max_pins[i])
+ if (aggregate_max_pins < cache_ptr->max_pins[i])
aggregate_max_pins = cache_ptr->max_pins[i];
#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */
- } /* end for */
+ } /* end for */
- if((total_hits > 0) || (total_misses > 0))
- hit_rate = (double)100.0f * ((double)(total_hits)) /
- ((double)(total_hits + total_misses));
+ if ((total_hits > 0) || (total_misses > 0))
+ hit_rate = (double)100.0f * ((double)(total_hits)) / ((double)(total_hits + total_misses));
else
hit_rate = 0.0f;
- if(cache_ptr->successful_ht_searches > 0)
- average_successful_search_depth =
- ((double)(cache_ptr->total_successful_ht_search_depth)) /
- ((double)(cache_ptr->successful_ht_searches));
+ if (cache_ptr->successful_ht_searches > 0)
+ average_successful_search_depth = ((double)(cache_ptr->total_successful_ht_search_depth)) /
+ ((double)(cache_ptr->successful_ht_searches));
- if(cache_ptr->failed_ht_searches > 0)
+ if (cache_ptr->failed_ht_searches > 0)
average_failed_search_depth =
- ((double)(cache_ptr->total_failed_ht_search_depth)) /
- ((double)(cache_ptr->failed_ht_searches));
+ ((double)(cache_ptr->total_failed_ht_search_depth)) / ((double)(cache_ptr->failed_ht_searches));
-
- HDfprintf(stdout, "\n%sH5C: cache statistics for %s\n",
- cache_ptr->prefix, cache_name);
+ HDfprintf(stdout, "\n%sH5C: cache statistics for %s\n", cache_ptr->prefix, cache_name);
HDfprintf(stdout, "\n");
- HDfprintf(stdout,
- "%s hash table insertion / deletions = %ld / %ld\n",
- cache_ptr->prefix,
- (long)(cache_ptr->total_ht_insertions),
- (long)(cache_ptr->total_ht_deletions));
-
- HDfprintf(stdout,
- "%s HT successful / failed searches = %ld / %ld\n",
- cache_ptr->prefix,
- (long)(cache_ptr->successful_ht_searches),
- (long)(cache_ptr->failed_ht_searches));
-
- HDfprintf(stdout,
- "%s Av. HT suc / failed search depth = %f / %f\n",
- cache_ptr->prefix,
- average_successful_search_depth,
- average_failed_search_depth);
-
- HDfprintf(stdout,
- "%s current (max) index size / length = %ld (%ld) / %lu (%lu)\n",
- cache_ptr->prefix,
- (long)(cache_ptr->index_size),
- (long)(cache_ptr->max_index_size),
- (unsigned long)(cache_ptr->index_len),
- (unsigned long)(cache_ptr->max_index_len));
-
- HDfprintf(stdout,
- "%s current (max) clean/dirty idx size = %ld (%ld) / %ld (%ld)\n",
- cache_ptr->prefix,
- (long)(cache_ptr->clean_index_size),
- (long)(cache_ptr->max_clean_index_size),
- (long)(cache_ptr->dirty_index_size),
- (long)(cache_ptr->max_dirty_index_size));
-
- HDfprintf(stdout,
- "%s current (max) slist size / length = %ld (%ld) / %lu (%lu)\n",
- cache_ptr->prefix,
- (long)(cache_ptr->slist_size),
- (long)(cache_ptr->max_slist_size),
- (unsigned long)(cache_ptr->slist_len),
- (unsigned long)(cache_ptr->max_slist_len));
-
- HDfprintf(stdout,
- "%s current (max) PL size / length = %ld (%ld) / %lu (%lu)\n",
- cache_ptr->prefix,
- (long)(cache_ptr->pl_size),
- (long)(cache_ptr->max_pl_size),
- (unsigned long)(cache_ptr->pl_len),
+ HDfprintf(stdout, "%s hash table insertion / deletions = %ld / %ld\n", cache_ptr->prefix,
+ (long)(cache_ptr->total_ht_insertions), (long)(cache_ptr->total_ht_deletions));
+
+ HDfprintf(stdout, "%s HT successful / failed searches = %ld / %ld\n", cache_ptr->prefix,
+ (long)(cache_ptr->successful_ht_searches), (long)(cache_ptr->failed_ht_searches));
+
+ HDfprintf(stdout, "%s Av. HT suc / failed search depth = %f / %f\n", cache_ptr->prefix,
+ average_successful_search_depth, average_failed_search_depth);
+
+ HDfprintf(stdout, "%s current (max) index size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix,
+ (long)(cache_ptr->index_size), (long)(cache_ptr->max_index_size),
+ (unsigned long)(cache_ptr->index_len), (unsigned long)(cache_ptr->max_index_len));
+
+ HDfprintf(stdout, "%s current (max) clean/dirty idx size = %ld (%ld) / %ld (%ld)\n", cache_ptr->prefix,
+ (long)(cache_ptr->clean_index_size), (long)(cache_ptr->max_clean_index_size),
+ (long)(cache_ptr->dirty_index_size), (long)(cache_ptr->max_dirty_index_size));
+
+ HDfprintf(stdout, "%s current (max) slist size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix,
+ (long)(cache_ptr->slist_size), (long)(cache_ptr->max_slist_size),
+ (unsigned long)(cache_ptr->slist_len), (unsigned long)(cache_ptr->max_slist_len));
+
+ HDfprintf(stdout, "%s current (max) PL size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix,
+ (long)(cache_ptr->pl_size), (long)(cache_ptr->max_pl_size), (unsigned long)(cache_ptr->pl_len),
(unsigned long)(cache_ptr->max_pl_len));
- HDfprintf(stdout,
- "%s current (max) PEL size / length = %ld (%ld) / %lu (%lu)\n",
- cache_ptr->prefix,
- (long)(cache_ptr->pel_size),
- (long)(cache_ptr->max_pel_size),
- (unsigned long)(cache_ptr->pel_len),
- (unsigned long)(cache_ptr->max_pel_len));
+ HDfprintf(stdout, "%s current (max) PEL size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix,
+ (long)(cache_ptr->pel_size), (long)(cache_ptr->max_pel_size),
+ (unsigned long)(cache_ptr->pel_len), (unsigned long)(cache_ptr->max_pel_len));
- HDfprintf(stdout,
- "%s current LRU list size / length = %ld / %lu\n",
- cache_ptr->prefix,
- (long)(cache_ptr->LRU_list_size),
- (unsigned long)(cache_ptr->LRU_list_len));
+ HDfprintf(stdout, "%s current LRU list size / length = %ld / %lu\n", cache_ptr->prefix,
+ (long)(cache_ptr->LRU_list_size), (unsigned long)(cache_ptr->LRU_list_len));
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
- HDfprintf(stdout,
- "%s current clean LRU size / length = %ld / %lu\n",
- cache_ptr->prefix,
- (long)(cache_ptr->cLRU_list_size),
- (unsigned long)(cache_ptr->cLRU_list_len));
-
- HDfprintf(stdout,
- "%s current dirty LRU size / length = %ld / %lu\n",
- cache_ptr->prefix,
- (long)(cache_ptr->dLRU_list_size),
- (unsigned long)(cache_ptr->dLRU_list_len));
+ HDfprintf(stdout, "%s current clean LRU size / length = %ld / %lu\n", cache_ptr->prefix,
+ (long)(cache_ptr->cLRU_list_size), (unsigned long)(cache_ptr->cLRU_list_len));
+
+ HDfprintf(stdout, "%s current dirty LRU size / length = %ld / %lu\n", cache_ptr->prefix,
+ (long)(cache_ptr->dLRU_list_size), (unsigned long)(cache_ptr->dLRU_list_len));
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
- HDfprintf(stdout,
- "%s Total hits / misses / hit_rate = %ld / %ld / %f\n",
- cache_ptr->prefix,
- (long)total_hits,
- (long)total_misses,
- hit_rate);
-
- HDfprintf(stdout,
- "%s Total write / read (max) protects = %ld / %ld (%ld)\n",
- cache_ptr->prefix,
- (long)total_write_protects,
- (long)total_read_protects,
- (long)max_read_protects);
-
- HDfprintf(stdout,
- "%s Total clears / flushes = %ld / %ld\n",
- cache_ptr->prefix,
- (long)total_clears,
- (long)total_flushes);
-
- HDfprintf(stdout,
- "%s Total evictions / take ownerships = %ld / %ld\n",
- cache_ptr->prefix,
- (long)total_evictions,
- (long)total_take_ownerships);
-
- HDfprintf(stdout,
- "%s Total insertions(pinned) / moves = %ld(%ld) / %ld\n",
- cache_ptr->prefix,
- (long)total_insertions,
- (long)total_pinned_insertions,
- (long)total_moves);
-
- HDfprintf(stdout,
- "%s Total entry / cache flush moves = %ld / %ld\n",
- cache_ptr->prefix,
- (long)total_entry_flush_moves,
- (long)total_cache_flush_moves);
-
- HDfprintf(stdout, "%s Total entry size incrs / decrs = %ld / %ld\n",
- cache_ptr->prefix,
- (long)total_size_increases,
- (long)total_size_decreases);
-
- HDfprintf(stdout, "%s Ttl entry/cache flush size changes = %ld / %ld\n",
- cache_ptr->prefix,
- (long)total_entry_flush_size_changes,
- (long)total_cache_flush_size_changes);
-
- HDfprintf(stdout,
- "%s Total entry pins (dirty) / unpins = %ld (%ld) / %ld\n",
- cache_ptr->prefix,
- (long)total_pins,
- (long)total_dirty_pins,
- (long)total_unpins);
-
- HDfprintf(stdout, "%s Total pinned flushes / clears = %ld / %ld\n",
- cache_ptr->prefix,
- (long)total_pinned_flushes,
- (long)total_pinned_clears);
-
- HDfprintf(stdout, "%s MSIC: (make space in cache) calls = %lld\n",
- cache_ptr->prefix,
+ HDfprintf(stdout, "%s Total hits / misses / hit_rate = %ld / %ld / %f\n", cache_ptr->prefix,
+ (long)total_hits, (long)total_misses, hit_rate);
+
+ HDfprintf(stdout, "%s Total write / read (max) protects = %ld / %ld (%ld)\n", cache_ptr->prefix,
+ (long)total_write_protects, (long)total_read_protects, (long)max_read_protects);
+
+ HDfprintf(stdout, "%s Total clears / flushes = %ld / %ld\n", cache_ptr->prefix,
+ (long)total_clears, (long)total_flushes);
+
+ HDfprintf(stdout, "%s Total evictions / take ownerships = %ld / %ld\n", cache_ptr->prefix,
+ (long)total_evictions, (long)total_take_ownerships);
+
+ HDfprintf(stdout, "%s Total insertions(pinned) / moves = %ld(%ld) / %ld\n", cache_ptr->prefix,
+ (long)total_insertions, (long)total_pinned_insertions, (long)total_moves);
+
+ HDfprintf(stdout, "%s Total entry / cache flush moves = %ld / %ld\n", cache_ptr->prefix,
+ (long)total_entry_flush_moves, (long)total_cache_flush_moves);
+
+ HDfprintf(stdout, "%s Total entry size incrs / decrs = %ld / %ld\n", cache_ptr->prefix,
+ (long)total_size_increases, (long)total_size_decreases);
+
+ HDfprintf(stdout, "%s Ttl entry/cache flush size changes = %ld / %ld\n", cache_ptr->prefix,
+ (long)total_entry_flush_size_changes, (long)total_cache_flush_size_changes);
+
+ HDfprintf(stdout, "%s Total entry pins (dirty) / unpins = %ld (%ld) / %ld\n", cache_ptr->prefix,
+ (long)total_pins, (long)total_dirty_pins, (long)total_unpins);
+
+ HDfprintf(stdout, "%s Total pinned flushes / clears = %ld / %ld\n", cache_ptr->prefix,
+ (long)total_pinned_flushes, (long)total_pinned_clears);
+
+ HDfprintf(stdout, "%s MSIC: (make space in cache) calls = %lld\n", cache_ptr->prefix,
(long long)(cache_ptr->calls_to_msic));
if (cache_ptr->calls_to_msic > 0)
average_entries_skipped_per_calls_to_msic =
- (((double)(cache_ptr->total_entries_skipped_in_msic)) /
- ((double)(cache_ptr->calls_to_msic)));
+ (((double)(cache_ptr->total_entries_skipped_in_msic)) / ((double)(cache_ptr->calls_to_msic)));
- HDfprintf(stdout, "%s MSIC: Average/max entries skipped = %lf / %ld\n",
- cache_ptr->prefix,
+ HDfprintf(stdout, "%s MSIC: Average/max entries skipped = %lf / %ld\n", cache_ptr->prefix,
(double)average_entries_skipped_per_calls_to_msic,
(long)(cache_ptr->max_entries_skipped_in_msic));
- if(cache_ptr->calls_to_msic > 0)
+ if (cache_ptr->calls_to_msic > 0)
average_dirty_pf_entries_skipped_per_call_to_msic =
(((double)(cache_ptr->total_dirty_pf_entries_skipped_in_msic)) /
- ((double)(cache_ptr->calls_to_msic)));
+ ((double)(cache_ptr->calls_to_msic)));
- HDfprintf(stdout,
- "%s MSIC: Average/max dirty pf entries skipped = %lf / %ld\n",
- cache_ptr->prefix,
+ HDfprintf(stdout, "%s MSIC: Average/max dirty pf entries skipped = %lf / %ld\n", cache_ptr->prefix,
average_dirty_pf_entries_skipped_per_call_to_msic,
(long)(cache_ptr->max_dirty_pf_entries_skipped_in_msic));
- if(cache_ptr->calls_to_msic > 0)
+ if (cache_ptr->calls_to_msic > 0)
average_entries_scanned_per_calls_to_msic =
- (((double)(cache_ptr->total_entries_scanned_in_msic)) /
- ((double)(cache_ptr->calls_to_msic)));
+ (((double)(cache_ptr->total_entries_scanned_in_msic)) / ((double)(cache_ptr->calls_to_msic)));
- HDfprintf(stdout, "%s MSIC: Average/max entries scanned = %lf / %ld\n",
- cache_ptr->prefix,
+ HDfprintf(stdout, "%s MSIC: Average/max entries scanned = %lf / %ld\n", cache_ptr->prefix,
(double)average_entries_scanned_per_calls_to_msic,
(long)(cache_ptr->max_entries_scanned_in_msic));
- HDfprintf(stdout, "%s MSIC: Scanned to make space(evict) = %lld\n",
- cache_ptr->prefix,
+ HDfprintf(stdout, "%s MSIC: Scanned to make space(evict) = %lld\n", cache_ptr->prefix,
(long long)(cache_ptr->entries_scanned_to_make_space));
- HDfprintf(stdout, "%s MSIC: Scanned to satisfy min_clean = %lld\n",
- cache_ptr->prefix,
- (long long)(cache_ptr->total_entries_scanned_in_msic -
- cache_ptr->entries_scanned_to_make_space));
+ HDfprintf(
+ stdout, "%s MSIC: Scanned to satisfy min_clean = %lld\n", cache_ptr->prefix,
+ (long long)(cache_ptr->total_entries_scanned_in_msic - cache_ptr->entries_scanned_to_make_space));
- HDfprintf(stdout,
- "%s slist/LRU/index scan restarts = %lld / %lld / %lld.\n",
- cache_ptr->prefix,
- (long long)(cache_ptr->slist_scan_restarts),
- (long long)(cache_ptr->LRU_scan_restarts),
+ HDfprintf(stdout, "%s slist/LRU/index scan restarts = %lld / %lld / %lld.\n", cache_ptr->prefix,
+ (long long)(cache_ptr->slist_scan_restarts), (long long)(cache_ptr->LRU_scan_restarts),
(long long)(cache_ptr->index_scan_restarts));
- HDfprintf(stdout,
- "%s cache image creations/reads/loads/size = %d / %d /%d / %" PRIuHSIZE "\n",
- cache_ptr->prefix,
- cache_ptr->images_created,
- cache_ptr->images_read,
- cache_ptr->images_loaded,
+ HDfprintf(stdout, "%s cache image creations/reads/loads/size = %d / %d /%d / %" PRIuHSIZE "\n",
+ cache_ptr->prefix, cache_ptr->images_created, cache_ptr->images_read, cache_ptr->images_loaded,
cache_ptr->last_image_size);
- HDfprintf(stdout,
- "%s prefetches / dirty prefetches = %lld / %lld\n",
- cache_ptr->prefix,
- (long long)(cache_ptr->prefetches),
- (long long)(cache_ptr->dirty_prefetches));
+ HDfprintf(stdout, "%s prefetches / dirty prefetches = %lld / %lld\n", cache_ptr->prefix,
+ (long long)(cache_ptr->prefetches), (long long)(cache_ptr->dirty_prefetches));
- HDfprintf(stdout,
- "%s prefetch hits/flushes/evictions = %lld / %lld / %lld\n",
- cache_ptr->prefix,
+ HDfprintf(stdout, "%s prefetch hits/flushes/evictions = %lld / %lld / %lld\n", cache_ptr->prefix,
(long long)(cache_ptr->prefetch_hits),
(long long)(cache_ptr->flushes[H5AC_PREFETCHED_ENTRY_ID]),
(long long)(cache_ptr->evictions[H5AC_PREFETCHED_ENTRY_ID]));
- if(cache_ptr->prefetches > 0)
+ if (cache_ptr->prefetches > 0)
prefetch_use_rate =
- (double)100.0f * ((double)(cache_ptr->prefetch_hits)) /
- ((double)(cache_ptr->prefetches));
+ (double)100.0f * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
else
prefetch_use_rate = 0.0f;
- HDfprintf(stdout,
- "%s prefetched entry use rate = %lf\n",
- cache_ptr->prefix,
- prefetch_use_rate);
+ HDfprintf(stdout, "%s prefetched entry use rate = %lf\n", cache_ptr->prefix, prefetch_use_rate);
#if H5C_COLLECT_CACHE_ENTRY_STATS
- HDfprintf(stdout, "%s aggregate max / min accesses = %d / %d\n",
- cache_ptr->prefix,
- (int)aggregate_max_accesses,
- (int)aggregate_min_accesses);
+ HDfprintf(stdout, "%s aggregate max / min accesses = %d / %d\n", cache_ptr->prefix,
+ (int)aggregate_max_accesses, (int)aggregate_min_accesses);
- HDfprintf(stdout, "%s aggregate max_clears / max_flushes = %d / %d\n",
- cache_ptr->prefix,
- (int)aggregate_max_clears,
- (int)aggregate_max_flushes);
+ HDfprintf(stdout, "%s aggregate max_clears / max_flushes = %d / %d\n", cache_ptr->prefix,
+ (int)aggregate_max_clears, (int)aggregate_max_flushes);
- HDfprintf(stdout, "%s aggregate max_size / max_pins = %d / %d\n",
- cache_ptr->prefix,
- (int)aggregate_max_size,
- (int)aggregate_max_pins);
+ HDfprintf(stdout, "%s aggregate max_size / max_pins = %d / %d\n", cache_ptr->prefix,
+ (int)aggregate_max_size, (int)aggregate_max_pins);
#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */
- if(display_detailed_stats) {
- for(i = 0; i <= cache_ptr->max_type_id; i++) {
+ if (display_detailed_stats) {
+ for (i = 0; i <= cache_ptr->max_type_id; i++) {
HDfprintf(stdout, "\n");
- HDfprintf(stdout, "%s Stats on %s:\n",
- cache_ptr->prefix,
+ HDfprintf(stdout, "%s Stats on %s:\n", cache_ptr->prefix,
((cache_ptr->class_table_ptr))[i]->name);
- if((cache_ptr->hits[i] > 0) || (cache_ptr->misses[i] > 0))
+ if ((cache_ptr->hits[i] > 0) || (cache_ptr->misses[i] > 0))
hit_rate = (double)100.0f * ((double)(cache_ptr->hits[i])) /
- ((double)(cache_ptr->hits[i] + cache_ptr->misses[i]));
+ ((double)(cache_ptr->hits[i] + cache_ptr->misses[i]));
else
hit_rate = 0.0f;
- HDfprintf(stdout,
- "%s hits / misses / hit_rate = %ld / %ld / %f\n",
- cache_ptr->prefix,
- (long)(cache_ptr->hits[i]),
- (long)(cache_ptr->misses[i]),
- hit_rate);
-
- HDfprintf(stdout,
- "%s write / read (max) protects = %ld / %ld (%d)\n",
- cache_ptr->prefix,
- (long)(cache_ptr->write_protects[i]),
- (long)(cache_ptr->read_protects[i]),
+ HDfprintf(stdout, "%s hits / misses / hit_rate = %ld / %ld / %f\n", cache_ptr->prefix,
+ (long)(cache_ptr->hits[i]), (long)(cache_ptr->misses[i]), hit_rate);
+
+ HDfprintf(stdout, "%s write / read (max) protects = %ld / %ld (%d)\n", cache_ptr->prefix,
+ (long)(cache_ptr->write_protects[i]), (long)(cache_ptr->read_protects[i]),
(int)(cache_ptr->max_read_protects[i]));
- HDfprintf(stdout,
- "%s clears / flushes = %ld / %ld\n",
- cache_ptr->prefix,
- (long)(cache_ptr->clears[i]),
- (long)(cache_ptr->flushes[i]));
-
- HDfprintf(stdout,
- "%s evictions / take ownerships = %ld / %ld\n",
- cache_ptr->prefix,
- (long)(cache_ptr->evictions[i]),
- (long)(cache_ptr->take_ownerships[i]));
-
- HDfprintf(stdout,
- "%s insertions(pinned) / moves = %ld(%ld) / %ld\n",
- cache_ptr->prefix,
- (long)(cache_ptr->insertions[i]),
- (long)(cache_ptr->pinned_insertions[i]),
+ HDfprintf(stdout, "%s clears / flushes = %ld / %ld\n", cache_ptr->prefix,
+ (long)(cache_ptr->clears[i]), (long)(cache_ptr->flushes[i]));
+
+ HDfprintf(stdout, "%s evictions / take ownerships = %ld / %ld\n", cache_ptr->prefix,
+ (long)(cache_ptr->evictions[i]), (long)(cache_ptr->take_ownerships[i]));
+
+ HDfprintf(stdout, "%s insertions(pinned) / moves = %ld(%ld) / %ld\n", cache_ptr->prefix,
+ (long)(cache_ptr->insertions[i]), (long)(cache_ptr->pinned_insertions[i]),
(long)(cache_ptr->moves[i]));
- HDfprintf(stdout,
- "%s entry / cache flush moves = %ld / %ld\n",
- cache_ptr->prefix,
- (long)(cache_ptr->entry_flush_moves[i]),
- (long)(cache_ptr->cache_flush_moves[i]));
-
- HDfprintf(stdout,
- "%s size increases / decreases = %ld / %ld\n",
- cache_ptr->prefix,
- (long)(cache_ptr->size_increases[i]),
- (long)(cache_ptr->size_decreases[i]));
-
- HDfprintf(stdout,
- "%s entry/cache flush size changes = %ld / %ld\n",
- cache_ptr->prefix,
+ HDfprintf(stdout, "%s entry / cache flush moves = %ld / %ld\n", cache_ptr->prefix,
+ (long)(cache_ptr->entry_flush_moves[i]), (long)(cache_ptr->cache_flush_moves[i]));
+
+ HDfprintf(stdout, "%s size increases / decreases = %ld / %ld\n", cache_ptr->prefix,
+ (long)(cache_ptr->size_increases[i]), (long)(cache_ptr->size_decreases[i]));
+
+ HDfprintf(stdout, "%s entry/cache flush size changes = %ld / %ld\n", cache_ptr->prefix,
(long)(cache_ptr->entry_flush_size_changes[i]),
(long)(cache_ptr->cache_flush_size_changes[i]));
+ HDfprintf(stdout, "%s entry pins / unpins = %ld / %ld\n", cache_ptr->prefix,
+ (long)(cache_ptr->pins[i]), (long)(cache_ptr->unpins[i]));
- HDfprintf(stdout,
- "%s entry pins / unpins = %ld / %ld\n",
- cache_ptr->prefix,
- (long)(cache_ptr->pins[i]),
- (long)(cache_ptr->unpins[i]));
-
- HDfprintf(stdout,
- "%s entry dirty pins/pin'd flushes = %ld / %ld\n",
- cache_ptr->prefix,
- (long)(cache_ptr->dirty_pins[i]),
- (long)(cache_ptr->pinned_flushes[i]));
+ HDfprintf(stdout, "%s entry dirty pins/pin'd flushes = %ld / %ld\n", cache_ptr->prefix,
+ (long)(cache_ptr->dirty_pins[i]), (long)(cache_ptr->pinned_flushes[i]));
#if H5C_COLLECT_CACHE_ENTRY_STATS
- HDfprintf(stdout,
- "%s entry max / min accesses = %d / %d\n",
- cache_ptr->prefix,
- cache_ptr->max_accesses[i],
- cache_ptr->min_accesses[i]);
+ HDfprintf(stdout, "%s entry max / min accesses = %d / %d\n", cache_ptr->prefix,
+ cache_ptr->max_accesses[i], cache_ptr->min_accesses[i]);
- HDfprintf(stdout,
- "%s entry max_clears / max_flushes = %d / %d\n",
- cache_ptr->prefix,
- cache_ptr->max_clears[i],
- cache_ptr->max_flushes[i]);
-
- HDfprintf(stdout,
- "%s entry max_size / max_pins = %d / %d\n",
- cache_ptr->prefix,
- (int)(cache_ptr->max_size[i]),
- (int)(cache_ptr->max_pins[i]));
+ HDfprintf(stdout, "%s entry max_clears / max_flushes = %d / %d\n", cache_ptr->prefix,
+ cache_ptr->max_clears[i], cache_ptr->max_flushes[i]);
+ HDfprintf(stdout, "%s entry max_size / max_pins = %d / %d\n", cache_ptr->prefix,
+ (int)(cache_ptr->max_size[i]), (int)(cache_ptr->max_pins[i]));
#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */
} /* end for */
- } /* end if */
+ } /* end if */
HDfprintf(stdout, "\n");
@@ -890,7 +720,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_stats() */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_stats__reset
@@ -905,12 +734,12 @@ done:
*/
void
#ifndef NDEBUG
-H5C_stats__reset(H5C_t * cache_ptr)
+H5C_stats__reset(H5C_t *cache_ptr)
#else /* NDEBUG */
#if H5C_COLLECT_CACHE_STATS
-H5C_stats__reset(H5C_t * cache_ptr)
-#else /* H5C_COLLECT_CACHE_STATS */
-H5C_stats__reset(H5C_t H5_ATTR_UNUSED * cache_ptr)
+H5C_stats__reset(H5C_t *cache_ptr)
+#else /* H5C_COLLECT_CACHE_STATS */
+H5C_stats__reset(H5C_t H5_ATTR_UNUSED *cache_ptr)
#endif /* H5C_COLLECT_CACHE_STATS */
#endif /* NDEBUG */
{
@@ -922,52 +751,52 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED * cache_ptr)
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
#if H5C_COLLECT_CACHE_STATS
- for(i = 0; i <= cache_ptr->max_type_id; i++) {
- cache_ptr->hits[i] = 0;
- cache_ptr->misses[i] = 0;
- cache_ptr->write_protects[i] = 0;
- cache_ptr->read_protects[i] = 0;
- cache_ptr->max_read_protects[i] = 0;
- cache_ptr->insertions[i] = 0;
- cache_ptr->pinned_insertions[i] = 0;
- cache_ptr->clears[i] = 0;
- cache_ptr->flushes[i] = 0;
- cache_ptr->evictions[i] = 0;
- cache_ptr->take_ownerships[i] = 0;
- cache_ptr->moves[i] = 0;
- cache_ptr->entry_flush_moves[i] = 0;
- cache_ptr->cache_flush_moves[i] = 0;
- cache_ptr->pins[i] = 0;
- cache_ptr->unpins[i] = 0;
- cache_ptr->dirty_pins[i] = 0;
- cache_ptr->pinned_flushes[i] = 0;
- cache_ptr->pinned_clears[i] = 0;
- cache_ptr->size_increases[i] = 0;
- cache_ptr->size_decreases[i] = 0;
- cache_ptr->entry_flush_size_changes[i] = 0;
- cache_ptr->cache_flush_size_changes[i] = 0;
+ for (i = 0; i <= cache_ptr->max_type_id; i++) {
+ cache_ptr->hits[i] = 0;
+ cache_ptr->misses[i] = 0;
+ cache_ptr->write_protects[i] = 0;
+ cache_ptr->read_protects[i] = 0;
+ cache_ptr->max_read_protects[i] = 0;
+ cache_ptr->insertions[i] = 0;
+ cache_ptr->pinned_insertions[i] = 0;
+ cache_ptr->clears[i] = 0;
+ cache_ptr->flushes[i] = 0;
+ cache_ptr->evictions[i] = 0;
+ cache_ptr->take_ownerships[i] = 0;
+ cache_ptr->moves[i] = 0;
+ cache_ptr->entry_flush_moves[i] = 0;
+ cache_ptr->cache_flush_moves[i] = 0;
+ cache_ptr->pins[i] = 0;
+ cache_ptr->unpins[i] = 0;
+ cache_ptr->dirty_pins[i] = 0;
+ cache_ptr->pinned_flushes[i] = 0;
+ cache_ptr->pinned_clears[i] = 0;
+ cache_ptr->size_increases[i] = 0;
+ cache_ptr->size_decreases[i] = 0;
+ cache_ptr->entry_flush_size_changes[i] = 0;
+ cache_ptr->cache_flush_size_changes[i] = 0;
} /* end for */
- cache_ptr->total_ht_insertions = 0;
- cache_ptr->total_ht_deletions = 0;
- cache_ptr->successful_ht_searches = 0;
- cache_ptr->total_successful_ht_search_depth = 0;
- cache_ptr->failed_ht_searches = 0;
- cache_ptr->total_failed_ht_search_depth = 0;
+ cache_ptr->total_ht_insertions = 0;
+ cache_ptr->total_ht_deletions = 0;
+ cache_ptr->successful_ht_searches = 0;
+ cache_ptr->total_successful_ht_search_depth = 0;
+ cache_ptr->failed_ht_searches = 0;
+ cache_ptr->total_failed_ht_search_depth = 0;
- cache_ptr->max_index_len = 0;
- cache_ptr->max_index_size = (size_t)0;
- cache_ptr->max_clean_index_size = (size_t)0;
- cache_ptr->max_dirty_index_size = (size_t)0;
+ cache_ptr->max_index_len = 0;
+ cache_ptr->max_index_size = (size_t)0;
+ cache_ptr->max_clean_index_size = (size_t)0;
+ cache_ptr->max_dirty_index_size = (size_t)0;
- cache_ptr->max_slist_len = 0;
- cache_ptr->max_slist_size = (size_t)0;
+ cache_ptr->max_slist_len = 0;
+ cache_ptr->max_slist_size = (size_t)0;
- cache_ptr->max_pl_len = 0;
- cache_ptr->max_pl_size = (size_t)0;
+ cache_ptr->max_pl_len = 0;
+ cache_ptr->max_pl_size = (size_t)0;
- cache_ptr->max_pel_len = 0;
- cache_ptr->max_pel_size = (size_t)0;
+ cache_ptr->max_pel_len = 0;
+ cache_ptr->max_pel_size = (size_t)0;
cache_ptr->calls_to_msic = 0;
cache_ptr->total_entries_skipped_in_msic = 0;
@@ -978,27 +807,27 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED * cache_ptr)
cache_ptr->max_entries_scanned_in_msic = 0;
cache_ptr->entries_scanned_to_make_space = 0;
- cache_ptr->slist_scan_restarts = 0;
- cache_ptr->LRU_scan_restarts = 0;
- cache_ptr->index_scan_restarts = 0;
+ cache_ptr->slist_scan_restarts = 0;
+ cache_ptr->LRU_scan_restarts = 0;
+ cache_ptr->index_scan_restarts = 0;
- cache_ptr->images_created = 0;
- cache_ptr->images_read = 0;
- cache_ptr->images_loaded = 0;
- cache_ptr->last_image_size = (hsize_t)0;
+ cache_ptr->images_created = 0;
+ cache_ptr->images_read = 0;
+ cache_ptr->images_loaded = 0;
+ cache_ptr->last_image_size = (hsize_t)0;
- cache_ptr->prefetches = 0;
- cache_ptr->dirty_prefetches = 0;
- cache_ptr->prefetch_hits = 0;
+ cache_ptr->prefetches = 0;
+ cache_ptr->dirty_prefetches = 0;
+ cache_ptr->prefetch_hits = 0;
#if H5C_COLLECT_CACHE_ENTRY_STATS
- for(i = 0; i <= cache_ptr->max_type_id; i++) {
- cache_ptr->max_accesses[i] = 0;
- cache_ptr->min_accesses[i] = 1000000;
- cache_ptr->max_clears[i] = 0;
- cache_ptr->max_flushes[i] = 0;
- cache_ptr->max_size[i] = (size_t)0;
- cache_ptr->max_pins[i] = 0;
+ for (i = 0; i <= cache_ptr->max_type_id; i++) {
+ cache_ptr->max_accesses[i] = 0;
+ cache_ptr->min_accesses[i] = 1000000;
+ cache_ptr->max_clears[i] = 0;
+ cache_ptr->max_flushes[i] = 0;
+ cache_ptr->max_size[i] = (size_t)0;
+ cache_ptr->max_pins[i] = 0;
} /* end for */
#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */
@@ -1007,7 +836,6 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED * cache_ptr)
return;
} /* H5C_stats__reset() */
-
/*-------------------------------------------------------------------------
* Function: H5C_flush_dependency_exists()
*
@@ -1035,13 +863,12 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED * cache_ptr)
*/
#ifndef NDEBUG
herr_t
-H5C_flush_dependency_exists(H5C_t *cache_ptr, haddr_t parent_addr, haddr_t child_addr,
- hbool_t *fd_exists_ptr)
+H5C_flush_dependency_exists(H5C_t *cache_ptr, haddr_t parent_addr, haddr_t child_addr, hbool_t *fd_exists_ptr)
{
- hbool_t fd_exists = FALSE; /* whether flush dependency exists */
- H5C_cache_entry_t * parent_ptr; /* Ptr to parent entry */
- H5C_cache_entry_t * child_ptr; /* Ptr to child entry */
- hbool_t ret_value = FALSE; /* Return value */
+ hbool_t fd_exists = FALSE; /* whether flush dependency exists */
+ H5C_cache_entry_t *parent_ptr; /* Ptr to parent entry */
+ H5C_cache_entry_t *child_ptr; /* Ptr to child entry */
+ hbool_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1055,25 +882,25 @@ H5C_flush_dependency_exists(H5C_t *cache_ptr, haddr_t parent_addr, haddr_t child
H5C__SEARCH_INDEX(cache_ptr, parent_addr, parent_ptr, FAIL)
H5C__SEARCH_INDEX(cache_ptr, child_addr, child_ptr, FAIL)
- if(parent_ptr && child_ptr) {
+ if (parent_ptr && child_ptr) {
HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(child_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- if(child_ptr->flush_dep_nparents > 0) {
- unsigned u; /* Local index variable */
+ if (child_ptr->flush_dep_nparents > 0) {
+ unsigned u; /* Local index variable */
HDassert(child_ptr->flush_dep_parent);
HDassert(child_ptr->flush_dep_parent_nalloc >= child_ptr->flush_dep_nparents);
- for(u = 0; u < child_ptr->flush_dep_nparents; u++) {
- if(child_ptr->flush_dep_parent[u] == parent_ptr) {
+ for (u = 0; u < child_ptr->flush_dep_nparents; u++) {
+ if (child_ptr->flush_dep_parent[u] == parent_ptr) {
fd_exists = TRUE;
HDassert(parent_ptr->flush_dep_nchildren > 0);
break;
} /* end if */
- } /* end for */
- } /* end if */
- } /* end if */
+ } /* end for */
+ } /* end if */
+ } /* end if */
*fd_exists_ptr = fd_exists;
@@ -1082,7 +909,6 @@ done:
} /* H5C_flush_dependency_exists() */
#endif /* NDEBUG */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_validate_index_list
@@ -1103,17 +929,17 @@ done:
herr_t
H5C_validate_index_list(H5C_t *cache_ptr)
{
- H5C_cache_entry_t * entry_ptr = NULL;
- uint32_t len = 0;
- int32_t index_ring_len[H5C_RING_NTYPES];
- size_t size = 0;
- size_t clean_size = 0;
- size_t dirty_size = 0;
- size_t index_ring_size[H5C_RING_NTYPES];
- size_t clean_index_ring_size[H5C_RING_NTYPES];
- size_t dirty_index_ring_size[H5C_RING_NTYPES];
- int i;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_cache_entry_t *entry_ptr = NULL;
+ uint32_t len = 0;
+ int32_t index_ring_len[H5C_RING_NTYPES];
+ size_t size = 0;
+ size_t clean_size = 0;
+ size_t dirty_size = 0;
+ size_t index_ring_size[H5C_RING_NTYPES];
+ size_t clean_index_ring_size[H5C_RING_NTYPES];
+ size_t dirty_index_ring_size[H5C_RING_NTYPES];
+ int i;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1121,89 +947,84 @@ H5C_validate_index_list(H5C_t *cache_ptr)
HDassert(cache_ptr);
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- for(i = 0; i < H5C_RING_NTYPES; i++) {
- index_ring_len[i] = 0;
- index_ring_size[i] = 0;
- clean_index_ring_size[i] = 0;
- dirty_index_ring_size[i] = 0;
+ for (i = 0; i < H5C_RING_NTYPES; i++) {
+ index_ring_len[i] = 0;
+ index_ring_size[i] = 0;
+ clean_index_ring_size[i] = 0;
+ dirty_index_ring_size[i] = 0;
} /* end if */
- if(((cache_ptr->il_head == NULL) || (cache_ptr->il_tail == NULL))
- && (cache_ptr->il_head != cache_ptr->il_tail))
+ if (((cache_ptr->il_head == NULL) || (cache_ptr->il_tail == NULL)) &&
+ (cache_ptr->il_head != cache_ptr->il_tail))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointer validation failed")
- if((cache_ptr->index_len == 1) && ((cache_ptr->il_head != cache_ptr->il_tail)
- || (cache_ptr->il_head == NULL) || (cache_ptr->il_head->size != cache_ptr->index_size)))
+ if ((cache_ptr->index_len == 1) &&
+ ((cache_ptr->il_head != cache_ptr->il_tail) || (cache_ptr->il_head == NULL) ||
+ (cache_ptr->il_head->size != cache_ptr->index_size)))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointer sanity checks failed")
- if((cache_ptr->index_len >= 1)
- && ((cache_ptr->il_head == NULL)
- || (cache_ptr->il_head->il_prev != NULL)
- || (cache_ptr->il_tail == NULL)
- || (cache_ptr->il_tail->il_next != NULL)))
+ if ((cache_ptr->index_len >= 1) &&
+ ((cache_ptr->il_head == NULL) || (cache_ptr->il_head->il_prev != NULL) ||
+ (cache_ptr->il_tail == NULL) || (cache_ptr->il_tail->il_next != NULL)))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list length sanity checks failed")
entry_ptr = cache_ptr->il_head;
- while(entry_ptr != NULL) {
- if((entry_ptr != cache_ptr->il_head)
- && ((entry_ptr->il_prev == NULL) || (entry_ptr->il_prev->il_next != entry_ptr)))
+ while (entry_ptr != NULL) {
+ if ((entry_ptr != cache_ptr->il_head) &&
+ ((entry_ptr->il_prev == NULL) || (entry_ptr->il_prev->il_next != entry_ptr)))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointers for entry are invalid")
- if((entry_ptr != cache_ptr->il_tail)
- && ((entry_ptr->il_next == NULL) || (entry_ptr->il_next->il_prev != entry_ptr)))
+ if ((entry_ptr != cache_ptr->il_tail) &&
+ ((entry_ptr->il_next == NULL) || (entry_ptr->il_next->il_prev != entry_ptr)))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointers for entry are invalid")
- HDassert(entry_ptr->ring > 0);
- HDassert(entry_ptr->ring < H5C_RING_NTYPES);
+ HDassert(entry_ptr->ring > 0);
+ HDassert(entry_ptr->ring < H5C_RING_NTYPES);
len++;
- index_ring_len[entry_ptr->ring] += 1;
+ index_ring_len[entry_ptr->ring] += 1;
size += entry_ptr->size;
index_ring_size[entry_ptr->ring] += entry_ptr->size;
- if(entry_ptr->is_dirty) {
- dirty_size += entry_ptr->size;
- dirty_index_ring_size[entry_ptr->ring] += entry_ptr->size;
- } /* end if */
+ if (entry_ptr->is_dirty) {
+ dirty_size += entry_ptr->size;
+ dirty_index_ring_size[entry_ptr->ring] += entry_ptr->size;
+ } /* end if */
else {
- clean_size += entry_ptr->size;
- clean_index_ring_size[entry_ptr->ring] += entry_ptr->size;
- } /* end else */
+ clean_size += entry_ptr->size;
+ clean_index_ring_size[entry_ptr->ring] += entry_ptr->size;
+ } /* end else */
entry_ptr = entry_ptr->il_next;
} /* end while */
- if((cache_ptr->index_len != len) || (cache_ptr->il_len != len)
- || (cache_ptr->index_size != size) || (cache_ptr->il_size != size)
- || (cache_ptr->clean_index_size != clean_size)
- || (cache_ptr->dirty_index_size != dirty_size)
- || (clean_size + dirty_size != size))
+ if ((cache_ptr->index_len != len) || (cache_ptr->il_len != len) || (cache_ptr->index_size != size) ||
+ (cache_ptr->il_size != size) || (cache_ptr->clean_index_size != clean_size) ||
+ (cache_ptr->dirty_index_size != dirty_size) || (clean_size + dirty_size != size))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index, clean and dirty sizes for cache are invalid")
- size = 0;
+ size = 0;
clean_size = 0;
dirty_size = 0;
- for(i = 0; i < H5C_RING_NTYPES; i++) {
- size += clean_index_ring_size[i] + dirty_index_ring_size[i];
- clean_size += clean_index_ring_size[i];
- dirty_size += dirty_index_ring_size[i];
+ for (i = 0; i < H5C_RING_NTYPES; i++) {
+ size += clean_index_ring_size[i] + dirty_index_ring_size[i];
+ clean_size += clean_index_ring_size[i];
+ dirty_size += dirty_index_ring_size[i];
} /* end for */
- if((cache_ptr->index_size != size)
- || (cache_ptr->clean_index_size != clean_size)
- || (cache_ptr->dirty_index_size != dirty_size))
+ if ((cache_ptr->index_size != size) || (cache_ptr->clean_index_size != clean_size) ||
+ (cache_ptr->dirty_index_size != dirty_size))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index, clean and dirty sizes for cache are invalid")
done:
- if(ret_value != SUCCEED)
+ if (ret_value != SUCCEED)
HDassert(0);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_validate_index_list() */
#endif /* NDEBUG */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_get_entry_ptr_from_addr()
@@ -1244,8 +1065,8 @@ done:
herr_t
H5C_get_entry_ptr_from_addr(H5C_t *cache_ptr, haddr_t addr, void **entry_ptr_ptr)
{
- H5C_cache_entry_t * entry_ptr = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_cache_entry_t *entry_ptr = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1257,7 +1078,7 @@ H5C_get_entry_ptr_from_addr(H5C_t *cache_ptr, haddr_t addr, void **entry_ptr_ptr
H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL)
- if(entry_ptr == NULL)
+ if (entry_ptr == NULL)
/* the entry doesn't exist in the cache -- report this
* and quit.
*/
@@ -1265,8 +1086,8 @@ H5C_get_entry_ptr_from_addr(H5C_t *cache_ptr, haddr_t addr, void **entry_ptr_ptr
else {
*entry_ptr_ptr = entry_ptr;
- /* increment call counter */
- (cache_ptr->get_entry_ptr_from_addr_counter)++;
+ /* increment call counter */
+ (cache_ptr->get_entry_ptr_from_addr_counter)++;
} /* end else */
done:
@@ -1274,7 +1095,6 @@ done:
} /* H5C_get_entry_ptr_from_addr() */
#endif /* NDEBUG */
-
/*-------------------------------------------------------------------------
* Function: H5C_get_serialization_in_progress
*
@@ -1302,7 +1122,6 @@ H5C_get_serialization_in_progress(const H5C_t *cache_ptr)
} /* H5C_get_serialization_in_progress() */
#endif /* NDEBUG */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_cache_is_clean()
@@ -1324,8 +1143,8 @@ H5C_get_serialization_in_progress(const H5C_t *cache_ptr)
hbool_t
H5C_cache_is_clean(const H5C_t *cache_ptr, H5C_ring_t inner_ring)
{
- H5C_ring_t ring = H5C_RING_USER;
- hbool_t ret_value = TRUE; /* Return value */
+ H5C_ring_t ring = H5C_RING_USER;
+ hbool_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1335,11 +1154,11 @@ H5C_cache_is_clean(const H5C_t *cache_ptr, H5C_ring_t inner_ring)
HDassert(inner_ring >= H5C_RING_USER);
HDassert(inner_ring <= H5C_RING_SB);
- while(ring <= inner_ring) {
- if(cache_ptr->dirty_index_ring_size[ring] > 0)
+ while (ring <= inner_ring) {
+ if (cache_ptr->dirty_index_ring_size[ring] > 0)
HGOTO_DONE(FALSE)
- ring++;
+ ring++;
} /* end while */
done:
@@ -1347,7 +1166,6 @@ done:
} /* H5C_cache_is_clean() */
#endif /* NDEBUG */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_verify_entry_type()
@@ -1375,12 +1193,11 @@ done:
*/
#ifndef NDEBUG
herr_t
-H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr,
- const H5C_class_t *expected_type, hbool_t *in_cache_ptr,
- hbool_t *type_ok_ptr)
+H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr, const H5C_class_t *expected_type, hbool_t *in_cache_ptr,
+ hbool_t *type_ok_ptr)
{
- H5C_cache_entry_t * entry_ptr = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_cache_entry_t *entry_ptr = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1394,7 +1211,7 @@ H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr,
H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL)
- if(entry_ptr == NULL)
+ if (entry_ptr == NULL)
/* the entry doesn't exist in the cache -- report this
* and quit.
*/
@@ -1402,14 +1219,13 @@ H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr,
else {
*in_cache_ptr = TRUE;
- if(entry_ptr->prefetched)
- *type_ok_ptr = (expected_type->id == entry_ptr->prefetch_type_id);
- else
- *type_ok_ptr = (expected_type == entry_ptr->type);
+ if (entry_ptr->prefetched)
+ *type_ok_ptr = (expected_type->id == entry_ptr->prefetch_type_id);
+ else
+ *type_ok_ptr = (expected_type == entry_ptr->type);
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_verify_entry_type() */
#endif /* NDEBUG */
-
diff --git a/src/H5Cepoch.c b/src/H5Cepoch.c
index 6451019..4d15632 100644
--- a/src/H5Cepoch.c
+++ b/src/H5Cepoch.c
@@ -22,24 +22,20 @@
*-------------------------------------------------------------------------
*/
-
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
@@ -54,42 +50,34 @@
* epochs so that they can be evicted from the cache.
*
****************************************************************************/
-static herr_t H5C__epoch_marker_get_initial_load_size(void *udata_ptr,
- size_t *image_len_ptr);
-static herr_t H5C__epoch_marker_get_final_load_size(const void *image_ptr,
- size_t image_len_ptr, void *udata_ptr, size_t *actual_len);
-static htri_t H5C__epoch_marker_verify_chksum(const void *image_ptr,
- size_t len, void *udata_ptr);
-static void * H5C__epoch_marker_deserialize(const void * image_ptr,
- size_t len, void * udata, hbool_t * dirty_ptr);
-static herr_t H5C__epoch_marker_image_len(const void * thing,
- size_t *image_len_ptr);
-static herr_t H5C__epoch_marker_pre_serialize(H5F_t *f, void *thing,
- haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr,
- unsigned *flags_ptr);
-static herr_t H5C__epoch_marker_serialize(const H5F_t *f,
- void * image_ptr, size_t len, void * thing);
+static herr_t H5C__epoch_marker_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr);
+static herr_t H5C__epoch_marker_get_final_load_size(const void *image_ptr, size_t image_len_ptr,
+ void *udata_ptr, size_t *actual_len);
+static htri_t H5C__epoch_marker_verify_chksum(const void *image_ptr, size_t len, void *udata_ptr);
+static void * H5C__epoch_marker_deserialize(const void *image_ptr, size_t len, void *udata,
+ hbool_t *dirty_ptr);
+static herr_t H5C__epoch_marker_image_len(const void *thing, size_t *image_len_ptr);
+static herr_t H5C__epoch_marker_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len,
+ haddr_t *new_addr_ptr, size_t *new_len_ptr,
+ unsigned *flags_ptr);
+static herr_t H5C__epoch_marker_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing);
static herr_t H5C__epoch_marker_notify(H5C_notify_action_t action, void *thing);
-static herr_t H5C__epoch_marker_free_icr(void * thing);
-static herr_t H5C__epoch_marker_fsf_size(const void H5_ATTR_UNUSED * thing,
- hsize_t H5_ATTR_UNUSED * fsf_size_ptr);
-
+static herr_t H5C__epoch_marker_free_icr(void *thing);
+static herr_t H5C__epoch_marker_fsf_size(const void H5_ATTR_UNUSED *thing,
+ hsize_t H5_ATTR_UNUSED *fsf_size_ptr);
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
const H5AC_class_t H5AC_EPOCH_MARKER[1] = {{
/* id = */ H5AC_EPOCH_MARKER_ID,
/* name = */ "epoch marker",
@@ -107,7 +95,6 @@ const H5AC_class_t H5AC_EPOCH_MARKER[1] = {{
/* fsf_size = */ H5C__epoch_marker_fsf_size,
}};
-
/***************************************************************************
* Class functions for H5C__EPOCH_MAKER_TYPE:
*
@@ -117,124 +104,109 @@ const H5AC_class_t H5AC_EPOCH_MARKER[1] = {{
*
***************************************************************************/
-
static herr_t
-H5C__epoch_marker_get_initial_load_size(void H5_ATTR_UNUSED *udata_ptr,
- size_t H5_ATTR_UNUSED *image_len_ptr)
+H5C__epoch_marker_get_initial_load_size(void H5_ATTR_UNUSED *udata_ptr, size_t H5_ATTR_UNUSED *image_len_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_get_initial_load_size() */
-
static herr_t
-H5C__epoch_marker_get_final_load_size(const void H5_ATTR_UNUSED *image_ptr,
- size_t H5_ATTR_UNUSED image_len, void H5_ATTR_UNUSED *udata_ptr,
- size_t H5_ATTR_UNUSED *actual_len)
+H5C__epoch_marker_get_final_load_size(const void H5_ATTR_UNUSED *image_ptr, size_t H5_ATTR_UNUSED image_len,
+ void H5_ATTR_UNUSED *udata_ptr, size_t H5_ATTR_UNUSED *actual_len)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_final_get_load_size() */
-
static htri_t
H5C__epoch_marker_verify_chksum(const void H5_ATTR_UNUSED *image_ptr, size_t H5_ATTR_UNUSED len,
- void H5_ATTR_UNUSED *udata_ptr)
+ void H5_ATTR_UNUSED *udata_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FALSE)
} /* end H5C__epoch_marker_verify_chksum() */
-
static void *
-H5C__epoch_marker_deserialize(const void H5_ATTR_UNUSED * image_ptr, size_t H5_ATTR_UNUSED len,
- void H5_ATTR_UNUSED * udata, hbool_t H5_ATTR_UNUSED * dirty_ptr)
+H5C__epoch_marker_deserialize(const void H5_ATTR_UNUSED *image_ptr, size_t H5_ATTR_UNUSED len,
+ void H5_ATTR_UNUSED *udata, hbool_t H5_ATTR_UNUSED *dirty_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(NULL)
} /* end H5C__epoch_marker_deserialize() */
-
static herr_t
-H5C__epoch_marker_image_len(const void H5_ATTR_UNUSED *thing,
- size_t H5_ATTR_UNUSED *image_len_ptr)
+H5C__epoch_marker_image_len(const void H5_ATTR_UNUSED *thing, size_t H5_ATTR_UNUSED *image_len_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_image_len() */
-
static herr_t
-H5C__epoch_marker_pre_serialize(H5F_t H5_ATTR_UNUSED *f,
- void H5_ATTR_UNUSED *thing, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED len,
- haddr_t H5_ATTR_UNUSED *new_addr_ptr, size_t H5_ATTR_UNUSED *new_len_ptr,
- unsigned H5_ATTR_UNUSED *flags_ptr)
+H5C__epoch_marker_pre_serialize(H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED *thing,
+ haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED len,
+ haddr_t H5_ATTR_UNUSED *new_addr_ptr, size_t H5_ATTR_UNUSED *new_len_ptr,
+ unsigned H5_ATTR_UNUSED *flags_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_pre_serialize() */
-
static herr_t
H5C__epoch_marker_serialize(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED *image_ptr,
- size_t H5_ATTR_UNUSED len, void H5_ATTR_UNUSED *thing)
+ size_t H5_ATTR_UNUSED len, void H5_ATTR_UNUSED *thing)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_serialize() */
-
static herr_t
-H5C__epoch_marker_notify(H5C_notify_action_t H5_ATTR_UNUSED action,
- void H5_ATTR_UNUSED * thing)
+H5C__epoch_marker_notify(H5C_notify_action_t H5_ATTR_UNUSED action, void H5_ATTR_UNUSED *thing)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_notify() */
-
static herr_t
-H5C__epoch_marker_free_icr(void H5_ATTR_UNUSED * thing)
+H5C__epoch_marker_free_icr(void H5_ATTR_UNUSED *thing)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_free_icr() */
-
static herr_t
-H5C__epoch_marker_fsf_size(const void H5_ATTR_UNUSED * thing, hsize_t H5_ATTR_UNUSED *fsf_size_ptr)
+H5C__epoch_marker_fsf_size(const void H5_ATTR_UNUSED *thing, hsize_t H5_ATTR_UNUSED *fsf_size_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__epoch_marker_fsf_size() */
-
diff --git a/src/H5Cimage.c b/src/H5Cimage.c
index 41e401e..b3f6c12 100644
--- a/src/H5Cimage.c
+++ b/src/H5Cimage.c
@@ -27,68 +27,64 @@
/* Module Setup */
/****************/
-#include "H5Cmodule.h" /* This source code file is part of the H5C module */
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
-
+#include "H5Cmodule.h" /* This source code file is part of the H5C module */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
#ifdef H5_HAVE_PARALLEL
-#define H5AC_FRIEND /*suppress error about including H5ACpkg */
-#include "H5ACpkg.h" /* Metadata cache */
-#endif /* H5_HAVE_PARALLEL */
-#include "H5Cpkg.h" /* Cache */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* Files */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-
+#define H5AC_FRIEND /*suppress error about including H5ACpkg */
+#include "H5ACpkg.h" /* Metadata cache */
+#endif /* H5_HAVE_PARALLEL */
+#include "H5Cpkg.h" /* Cache */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
/****************/
/* Local Macros */
/****************/
#if H5C_DO_MEMORY_SANITY_CHECKS
-#define H5C_IMAGE_EXTRA_SPACE 8
+#define H5C_IMAGE_EXTRA_SPACE 8
#define H5C_IMAGE_SANITY_VALUE "DeadBeef"
#else /* H5C_DO_MEMORY_SANITY_CHECKS */
#define H5C_IMAGE_EXTRA_SPACE 0
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
/* Cache image buffer components, on disk */
-#define H5C__MDCI_BLOCK_SIGNATURE "MDCI"
-#define H5C__MDCI_BLOCK_SIGNATURE_LEN 4
-#define H5C__MDCI_BLOCK_VERSION_0 0
+#define H5C__MDCI_BLOCK_SIGNATURE "MDCI"
+#define H5C__MDCI_BLOCK_SIGNATURE_LEN 4
+#define H5C__MDCI_BLOCK_VERSION_0 0
/* Metadata cache image header flags -- max 8 bits */
-#define H5C__MDCI_HEADER_HAVE_RESIZE_STATUS 0x01
+#define H5C__MDCI_HEADER_HAVE_RESIZE_STATUS 0x01
/* Metadata cache image entry flags -- max 8 bits */
-#define H5C__MDCI_ENTRY_DIRTY_FLAG 0x01
-#define H5C__MDCI_ENTRY_IN_LRU_FLAG 0x02
-#define H5C__MDCI_ENTRY_IS_FD_PARENT_FLAG 0x04
-#define H5C__MDCI_ENTRY_IS_FD_CHILD_FLAG 0x08
+#define H5C__MDCI_ENTRY_DIRTY_FLAG 0x01
+#define H5C__MDCI_ENTRY_IN_LRU_FLAG 0x02
+#define H5C__MDCI_ENTRY_IS_FD_PARENT_FLAG 0x04
+#define H5C__MDCI_ENTRY_IS_FD_CHILD_FLAG 0x08
/* Limits on flush dependency values, stored in 16-bit values on disk */
-#define H5C__MDCI_MAX_FD_CHILDREN USHRT_MAX
-#define H5C__MDCI_MAX_FD_PARENTS USHRT_MAX
+#define H5C__MDCI_MAX_FD_CHILDREN USHRT_MAX
+#define H5C__MDCI_MAX_FD_PARENTS USHRT_MAX
/* Values for image entry magic field */
-#define H5C_IMAGE_ENTRY_T_MAGIC 0x005CAC08
-#define H5C_IMAGE_ENTRY_T_BAD_MAGIC 0xBeefDead
+#define H5C_IMAGE_ENTRY_T_MAGIC 0x005CAC08
+#define H5C_IMAGE_ENTRY_T_BAD_MAGIC 0xBeefDead
/* Maximum ring allowed in image */
-#define H5C_MAX_RING_IN_IMAGE H5C_RING_MDFSM
-
+#define H5C_MAX_RING_IN_IMAGE H5C_RING_MDFSM
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
@@ -96,33 +92,27 @@
/* Helper routines */
static size_t H5C__cache_image_block_entry_header_size(const H5F_t *f);
static size_t H5C__cache_image_block_header_size(const H5F_t *f);
-static herr_t H5C__decode_cache_image_header(const H5F_t *f,
- H5C_t *cache_ptr, const uint8_t **buf);
-#ifndef NDEBUG /* only used in assertions */
-static herr_t H5C__decode_cache_image_entry(const H5F_t *f,
- const H5C_t *cache_ptr, const uint8_t **buf, unsigned entry_num);
+static herr_t H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **buf);
+#ifndef NDEBUG /* only used in assertions */
+static herr_t H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr, const uint8_t **buf,
+ unsigned entry_num);
#endif /* NDEBUG */ /* only used in assertions */
-static herr_t H5C__destroy_pf_entry_child_flush_deps(H5C_t *cache_ptr,
- H5C_cache_entry_t *pf_entry_ptr, H5C_cache_entry_t **fd_children);
-static herr_t H5C__encode_cache_image_header(const H5F_t *f,
- const H5C_t *cache_ptr, uint8_t **buf);
-static herr_t H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr,
- uint8_t **buf, unsigned entry_num);
+static herr_t H5C__destroy_pf_entry_child_flush_deps(H5C_t *cache_ptr, H5C_cache_entry_t *pf_entry_ptr,
+ H5C_cache_entry_t **fd_children);
+static herr_t H5C__encode_cache_image_header(const H5F_t *f, const H5C_t *cache_ptr, uint8_t **buf);
+static herr_t H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf, unsigned entry_num);
static herr_t H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr);
-static void H5C__prep_for_file_close__compute_fd_heights_real(
- H5C_cache_entry_t *entry_ptr, uint32_t fd_height);
+static void H5C__prep_for_file_close__compute_fd_heights_real(H5C_cache_entry_t *entry_ptr,
+ uint32_t fd_height);
static herr_t H5C__prep_for_file_close__setup_image_entries_array(H5C_t *cache_ptr);
-static herr_t H5C__prep_for_file_close__scan_entries(const H5F_t *f,
- H5C_t *cache_ptr);
+static herr_t H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr);
static herr_t H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr);
-static H5C_cache_entry_t *H5C__reconstruct_cache_entry(const H5F_t *f,
- H5C_t *cache_ptr, const uint8_t **buf);
-static herr_t H5C__write_cache_image_superblock_msg(H5F_t *f, hbool_t create);
-static herr_t H5C__read_cache_image(H5F_t * f, H5C_t *cache_ptr);
-static herr_t H5C__write_cache_image(H5F_t *f, const H5C_t *cache_ptr);
-static herr_t H5C__construct_cache_image_buffer(H5F_t *f, H5C_t *cache_ptr);
-static herr_t H5C__free_image_entries_array(H5C_t *cache_ptr);
-
+static H5C_cache_entry_t *H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **buf);
+static herr_t H5C__write_cache_image_superblock_msg(H5F_t *f, hbool_t create);
+static herr_t H5C__read_cache_image(H5F_t *f, H5C_t *cache_ptr);
+static herr_t H5C__write_cache_image(H5F_t *f, const H5C_t *cache_ptr);
+static herr_t H5C__construct_cache_image_buffer(H5F_t *f, H5C_t *cache_ptr);
+static herr_t H5C__free_image_entries_array(H5C_t *cache_ptr);
/*********************/
/* Package Variables */
@@ -131,17 +121,14 @@ static herr_t H5C__free_image_entries_array(H5C_t *cache_ptr);
/* Declare a free list to manage H5C_cache_entry_t objects */
H5FL_DEFINE(H5C_cache_entry_t);
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
/*-------------------------------------------------------------------------
*
* Function: H5C_cache_image_pending()
@@ -162,7 +149,7 @@ H5FL_DEFINE(H5C_cache_entry_t);
hbool_t
H5C_cache_image_pending(const H5C_t *cache_ptr)
{
- hbool_t ret_value = TRUE; /* Return value */
+ hbool_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -175,7 +162,6 @@ H5C_cache_image_pending(const H5C_t *cache_ptr)
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_cache_image_pending() */
-
/*-------------------------------------------------------------------------
* Function: H5C_cache_image_status()
*
@@ -199,9 +185,9 @@ H5C_cache_image_pending(const H5C_t *cache_ptr)
*-------------------------------------------------------------------------
*/
herr_t
-H5C_cache_image_status(H5F_t * f, hbool_t *load_ci_ptr, hbool_t *write_ci_ptr)
+H5C_cache_image_status(H5F_t *f, hbool_t *load_ci_ptr, hbool_t *write_ci_ptr)
{
- H5C_t * cache_ptr;
+ H5C_t *cache_ptr;
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -214,13 +200,12 @@ H5C_cache_image_status(H5F_t * f, hbool_t *load_ci_ptr, hbool_t *write_ci_ptr)
HDassert(load_ci_ptr);
HDassert(write_ci_ptr);
- *load_ci_ptr = cache_ptr->load_image || cache_ptr->image_loaded;
+ *load_ci_ptr = cache_ptr->load_image || cache_ptr->image_loaded;
*write_ci_ptr = cache_ptr->image_ctl.generate_image;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5C_cache_image_status() */
-
/*-------------------------------------------------------------------------
* Function: H5C__construct_cache_image_buffer()
*
@@ -238,12 +223,12 @@ H5C_cache_image_status(H5F_t * f, hbool_t *load_ci_ptr, hbool_t *write_ci_ptr)
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__construct_cache_image_buffer(H5F_t * f, H5C_t *cache_ptr)
+H5C__construct_cache_image_buffer(H5F_t *f, H5C_t *cache_ptr)
{
- uint8_t * p; /* Pointer into image buffer */
- uint32_t chksum;
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ uint8_t *p; /* Pointer into image buffer */
+ uint32_t chksum;
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -261,25 +246,26 @@ H5C__construct_cache_image_buffer(H5F_t * f, H5C_t *cache_ptr)
HDassert(cache_ptr->image_data_len <= cache_ptr->image_len);
/* Allocate the buffer in which to construct the cache image block */
- if(NULL == (cache_ptr->image_buffer = H5MM_malloc(cache_ptr->image_len + 1)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for cache image buffer")
+ if (NULL == (cache_ptr->image_buffer = H5MM_malloc(cache_ptr->image_len + 1)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for cache image buffer")
/* Construct the cache image block header image */
p = (uint8_t *)cache_ptr->image_buffer;
- if(H5C__encode_cache_image_header(f, cache_ptr, &p) < 0)
+ if (H5C__encode_cache_image_header(f, cache_ptr, &p) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTENCODE, FAIL, "header image construction failed")
HDassert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) < cache_ptr->image_data_len);
/* Construct the cache entry images */
- for(u = 0; u < cache_ptr->num_entries_in_image; u++)
- if(H5C__encode_cache_image_entry(f, cache_ptr, &p, u) < 0)
+ for (u = 0; u < cache_ptr->num_entries_in_image; u++)
+ if (H5C__encode_cache_image_entry(f, cache_ptr, &p, u) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTENCODE, FAIL, "entry image construction failed")
HDassert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) < cache_ptr->image_data_len);
/* Construct the adaptive resize status image -- not yet */
/* Compute the checksum and encode */
- chksum = H5_checksum_metadata(cache_ptr->image_buffer, (size_t)(cache_ptr->image_data_len - H5F_SIZEOF_CHKSUM), 0);
+ chksum = H5_checksum_metadata(cache_ptr->image_buffer,
+ (size_t)(cache_ptr->image_data_len - H5F_SIZEOF_CHKSUM), 0);
UINT32ENCODE(p, chksum);
HDassert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) == cache_ptr->image_data_len);
HDassert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) <= cache_ptr->image_len);
@@ -289,92 +275,99 @@ H5C__construct_cache_image_buffer(H5F_t * f, H5C_t *cache_ptr)
* and comparing the result with the original data.
*/
{
- uint32_t old_chksum;
- const uint8_t * q;
- H5C_t * fake_cache_ptr = NULL;
- unsigned v;
- herr_t status; /* Status from decoding */
+ uint32_t old_chksum;
+ const uint8_t *q;
+ H5C_t * fake_cache_ptr = NULL;
+ unsigned v;
+ herr_t status; /* Status from decoding */
- fake_cache_ptr = (H5C_t *)H5MM_malloc(sizeof(H5C_t));
+ fake_cache_ptr = (H5C_t *)H5MM_malloc(sizeof(H5C_t));
HDassert(fake_cache_ptr);
fake_cache_ptr->magic = H5C__H5C_T_MAGIC;
- /* needed for sanity checks */
- fake_cache_ptr->image_len = cache_ptr->image_len;
- q = (const uint8_t *)cache_ptr->image_buffer;
- status = H5C__decode_cache_image_header(f, fake_cache_ptr, &q);
+ /* needed for sanity checks */
+ fake_cache_ptr->image_len = cache_ptr->image_len;
+ q = (const uint8_t *)cache_ptr->image_buffer;
+ status = H5C__decode_cache_image_header(f, fake_cache_ptr, &q);
HDassert(status >= 0);
HDassert(NULL != p);
HDassert(fake_cache_ptr->num_entries_in_image == cache_ptr->num_entries_in_image);
- fake_cache_ptr->image_entries = (H5C_image_entry_t *)H5MM_malloc(sizeof(H5C_image_entry_t) *
- (size_t)(fake_cache_ptr->num_entries_in_image + 1));
- HDassert(fake_cache_ptr->image_entries);
+ fake_cache_ptr->image_entries = (H5C_image_entry_t *)H5MM_malloc(
+ sizeof(H5C_image_entry_t) * (size_t)(fake_cache_ptr->num_entries_in_image + 1));
+ HDassert(fake_cache_ptr->image_entries);
- for(u = 0; u < fake_cache_ptr->num_entries_in_image; u++) {
- (fake_cache_ptr->image_entries)[u].magic = H5C_IMAGE_ENTRY_T_MAGIC;
+ for (u = 0; u < fake_cache_ptr->num_entries_in_image; u++) {
+ (fake_cache_ptr->image_entries)[u].magic = H5C_IMAGE_ENTRY_T_MAGIC;
(fake_cache_ptr->image_entries)[u].image_ptr = NULL;
- /* touch up f->shared->cache to satisfy sanity checks... */
+ /* touch up f->shared->cache to satisfy sanity checks... */
f->shared->cache = fake_cache_ptr;
- status = H5C__decode_cache_image_entry(f, fake_cache_ptr, &q, u);
- HDassert(status >= 0);
+ status = H5C__decode_cache_image_entry(f, fake_cache_ptr, &q, u);
+ HDassert(status >= 0);
- /* ...and then return f->shared->cache to its correct value */
+ /* ...and then return f->shared->cache to its correct value */
f->shared->cache = cache_ptr;
- /* verify expected contents */
- HDassert((cache_ptr->image_entries)[u].addr == (fake_cache_ptr->image_entries)[u].addr);
- HDassert((cache_ptr->image_entries)[u].size == (fake_cache_ptr->image_entries)[u].size);
- HDassert((cache_ptr->image_entries)[u].type_id == (fake_cache_ptr->image_entries)[u].type_id);
- HDassert((cache_ptr->image_entries)[u].lru_rank == (fake_cache_ptr->image_entries)[u].lru_rank);
- HDassert((cache_ptr->image_entries)[u].is_dirty == (fake_cache_ptr->image_entries)[u].is_dirty);
- /* don't check image_fd_height as it is not stored in
+ /* verify expected contents */
+ HDassert((cache_ptr->image_entries)[u].addr == (fake_cache_ptr->image_entries)[u].addr);
+ HDassert((cache_ptr->image_entries)[u].size == (fake_cache_ptr->image_entries)[u].size);
+ HDassert((cache_ptr->image_entries)[u].type_id == (fake_cache_ptr->image_entries)[u].type_id);
+ HDassert((cache_ptr->image_entries)[u].lru_rank == (fake_cache_ptr->image_entries)[u].lru_rank);
+ HDassert((cache_ptr->image_entries)[u].is_dirty == (fake_cache_ptr->image_entries)[u].is_dirty);
+ /* don't check image_fd_height as it is not stored in
* the metadata cache image block.
*/
- HDassert((cache_ptr->image_entries)[u].fd_child_count == (fake_cache_ptr->image_entries)[u].fd_child_count);
- HDassert((cache_ptr->image_entries)[u].fd_dirty_child_count == (fake_cache_ptr->image_entries)[u].fd_dirty_child_count);
- HDassert((cache_ptr->image_entries)[u].fd_parent_count == (fake_cache_ptr->image_entries)[u].fd_parent_count);
-
- for(v = 0; v < (cache_ptr->image_entries)[u].fd_parent_count; v++)
- HDassert((cache_ptr->image_entries)[u].fd_parent_addrs[v] == (fake_cache_ptr->image_entries)[u].fd_parent_addrs[v]);
-
- /* free the fd_parent_addrs array if it exists */
- if((fake_cache_ptr->image_entries)[u].fd_parent_addrs) {
- HDassert((fake_cache_ptr->image_entries)[u].fd_parent_count > 0);
- (fake_cache_ptr->image_entries)[u].fd_parent_addrs = (haddr_t *)H5MM_xfree((fake_cache_ptr->image_entries)[u].fd_parent_addrs);
- (fake_cache_ptr->image_entries)[u].fd_parent_count = 0;
- } /* end if */
+ HDassert((cache_ptr->image_entries)[u].fd_child_count ==
+ (fake_cache_ptr->image_entries)[u].fd_child_count);
+ HDassert((cache_ptr->image_entries)[u].fd_dirty_child_count ==
+ (fake_cache_ptr->image_entries)[u].fd_dirty_child_count);
+ HDassert((cache_ptr->image_entries)[u].fd_parent_count ==
+ (fake_cache_ptr->image_entries)[u].fd_parent_count);
+
+ for (v = 0; v < (cache_ptr->image_entries)[u].fd_parent_count; v++)
+ HDassert((cache_ptr->image_entries)[u].fd_parent_addrs[v] ==
+ (fake_cache_ptr->image_entries)[u].fd_parent_addrs[v]);
+
+ /* free the fd_parent_addrs array if it exists */
+ if ((fake_cache_ptr->image_entries)[u].fd_parent_addrs) {
+ HDassert((fake_cache_ptr->image_entries)[u].fd_parent_count > 0);
+ (fake_cache_ptr->image_entries)[u].fd_parent_addrs =
+ (haddr_t *)H5MM_xfree((fake_cache_ptr->image_entries)[u].fd_parent_addrs);
+ (fake_cache_ptr->image_entries)[u].fd_parent_count = 0;
+ } /* end if */
else
- HDassert((fake_cache_ptr->image_entries)[u].fd_parent_count == 0);
+ HDassert((fake_cache_ptr->image_entries)[u].fd_parent_count == 0);
- HDassert((cache_ptr->image_entries)[u].image_ptr);
+ HDassert((cache_ptr->image_entries)[u].image_ptr);
HDassert((fake_cache_ptr->image_entries)[u].image_ptr);
HDassert(!HDmemcmp((cache_ptr->image_entries)[u].image_ptr,
(fake_cache_ptr->image_entries)[u].image_ptr,
(cache_ptr->image_entries)[u].size));
- (fake_cache_ptr->image_entries)[u].image_ptr = H5MM_xfree((fake_cache_ptr->image_entries)[u].image_ptr);
- } /* end for */
+ (fake_cache_ptr->image_entries)[u].image_ptr =
+ H5MM_xfree((fake_cache_ptr->image_entries)[u].image_ptr);
+ } /* end for */
- HDassert((size_t)(q - (const uint8_t *)cache_ptr->image_buffer) == cache_ptr->image_data_len - H5F_SIZEOF_CHKSUM);
+ HDassert((size_t)(q - (const uint8_t *)cache_ptr->image_buffer) ==
+ cache_ptr->image_data_len - H5F_SIZEOF_CHKSUM);
/* compute the checksum */
old_chksum = chksum;
- chksum = H5_checksum_metadata(cache_ptr->image_buffer, (size_t)(cache_ptr->image_data_len - H5F_SIZEOF_CHKSUM), 0);
- HDassert(chksum == old_chksum);
+ chksum = H5_checksum_metadata(cache_ptr->image_buffer,
+ (size_t)(cache_ptr->image_data_len - H5F_SIZEOF_CHKSUM), 0);
+ HDassert(chksum == old_chksum);
- fake_cache_ptr->image_entries = (H5C_image_entry_t *)H5MM_xfree(fake_cache_ptr->image_entries);
- fake_cache_ptr = (H5C_t *)H5MM_xfree(fake_cache_ptr);
- } /* end block */
+ fake_cache_ptr->image_entries = (H5C_image_entry_t *)H5MM_xfree(fake_cache_ptr->image_entries);
+ fake_cache_ptr = (H5C_t *)H5MM_xfree(fake_cache_ptr);
+ } /* end block */
#endif /* NDEBUG */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__construct_cache_image_buffer() */
-
/*-------------------------------------------------------------------------
* Function: H5C__generate_cache_image()
*
@@ -391,7 +384,7 @@ done:
herr_t
H5C__generate_cache_image(H5F_t *f, H5C_t *cache_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -403,16 +396,16 @@ H5C__generate_cache_image(H5F_t *f, H5C_t *cache_ptr)
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* Construct cache image */
- if(H5C__construct_cache_image_buffer(f, cache_ptr) < 0)
+ if (H5C__construct_cache_image_buffer(f, cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't create metadata cache image")
/* Free image entries array */
- if(H5C__free_image_entries_array(cache_ptr) < 0)
+ if (H5C__free_image_entries_array(cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't free image entries array")
/* Write cache image block if so configured */
- if(cache_ptr->image_ctl.flags & H5C_CI__GEN_MDC_IMAGE_BLK) {
- if(H5C__write_cache_image(f, cache_ptr) < 0)
+ if (cache_ptr->image_ctl.flags & H5C_CI__GEN_MDC_IMAGE_BLK) {
+ if (H5C__write_cache_image(f, cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write metadata cache image block to file")
H5C__UPDATE_STATS_FOR_CACHE_IMAGE_CREATE(cache_ptr);
@@ -426,7 +419,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__generate_cache_image() */
-
/*-------------------------------------------------------------------------
* Function: H5C__deserialize_prefetched_entry()
*
@@ -461,36 +453,34 @@ done:
*
* Programmer: John Mainzer, 8/10/15
*
- * Changes: Updated sanity checks for possibility that the slist
+ * Changes: Updated sanity checks for possibility that the slist
* is disabled.
* JRM -- 5/17/20
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr,
- H5C_cache_entry_t **entry_ptr_ptr, const H5C_class_t *type,
- haddr_t addr, void *udata)
+H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t **entry_ptr_ptr,
+ const H5C_class_t *type, haddr_t addr, void *udata)
{
- hbool_t dirty = FALSE; /* Flag indicating whether thing was
- * dirtied during deserialize
- */
- size_t len; /* Size of image in file */
- void * thing = NULL; /* Pointer to thing loaded */
- H5C_cache_entry_t * pf_entry_ptr; /* pointer to the prefetched entry */
- /* supplied in *entry_ptr_ptr. */
- H5C_cache_entry_t * ds_entry_ptr; /* Alias for thing loaded, as cache
- * entry
- */
- H5C_cache_entry_t** fd_children = NULL; /* Pointer to a dynamically */
- /* allocated array of pointers to */
- /* the flush dependency children of */
- /* the prefetched entry, or NULL if */
- /* that array does not exist. */
- unsigned flush_flags = (H5C__FLUSH_INVALIDATE_FLAG |
- H5C__FLUSH_CLEAR_ONLY_FLAG);
- int i;
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t dirty = FALSE; /* Flag indicating whether thing was
+ * dirtied during deserialize
+ */
+ size_t len; /* Size of image in file */
+ void * thing = NULL; /* Pointer to thing loaded */
+ H5C_cache_entry_t *pf_entry_ptr; /* pointer to the prefetched entry */
+ /* supplied in *entry_ptr_ptr. */
+ H5C_cache_entry_t *ds_entry_ptr; /* Alias for thing loaded, as cache
+ * entry
+ */
+ H5C_cache_entry_t **fd_children = NULL; /* Pointer to a dynamically */
+ /* allocated array of pointers to */
+ /* the flush dependency children of */
+ /* the prefetched entry, or NULL if */
+ /* that array does not exist. */
+ unsigned flush_flags = (H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG);
+ int i;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -521,8 +511,7 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr,
/* Can't see how skip reads could be usefully combined with
* either the speculative read flag. Hence disallow.
*/
- HDassert(!((type->flags & H5C__CLASS_SKIP_READS) &&
- (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG)));
+ HDassert(!((type->flags & H5C__CLASS_SKIP_READS) && (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG)));
HDassert(H5F_addr_defined(addr));
HDassert(type->get_initial_load_size);
HDassert(type->deserialize);
@@ -532,7 +521,7 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr,
* the deserialized entry if appropriate.
*/
HDassert(pf_entry_ptr->fd_parent_count == pf_entry_ptr->flush_dep_nparents);
- for(i = (int)(pf_entry_ptr->fd_parent_count) - 1; i >= 0; i--) {
+ for (i = (int)(pf_entry_ptr->fd_parent_count) - 1; i >= 0; i--) {
HDassert(pf_entry_ptr->flush_dep_parent);
HDassert(pf_entry_ptr->flush_dep_parent[i]);
HDassert(pf_entry_ptr->flush_dep_parent[i]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
@@ -540,7 +529,7 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr,
HDassert(pf_entry_ptr->fd_parent_addrs);
HDassert(pf_entry_ptr->flush_dep_parent[i]->addr == pf_entry_ptr->fd_parent_addrs[i]);
- if(H5C_destroy_flush_dependency(pf_entry_ptr->flush_dep_parent[i], pf_entry_ptr) < 0)
+ if (H5C_destroy_flush_dependency(pf_entry_ptr->flush_dep_parent[i], pf_entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "can't destroy pf entry parent flush dependency")
pf_entry_ptr->fd_parent_addrs[i] = HADDR_UNDEF;
@@ -557,12 +546,14 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr,
* pointers to the flush dependency children of *pf_enty_ptr for later
* use.
*/
- if(pf_entry_ptr->fd_child_count > 0) {
- if(NULL == (fd_children = (H5C_cache_entry_t **)H5MM_calloc(sizeof(H5C_cache_entry_t **) * (size_t)(pf_entry_ptr->fd_child_count + 1))))
+ if (pf_entry_ptr->fd_child_count > 0) {
+ if (NULL == (fd_children = (H5C_cache_entry_t **)H5MM_calloc(
+ sizeof(H5C_cache_entry_t **) * (size_t)(pf_entry_ptr->fd_child_count + 1))))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for fd child ptr array")
- if(H5C__destroy_pf_entry_child_flush_deps(cache_ptr, pf_entry_ptr, fd_children) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "can't destroy pf entry child flush dependency(s).")
+ if (H5C__destroy_pf_entry_child_flush_deps(cache_ptr, pf_entry_ptr, fd_children) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL,
+ "can't destroy pf entry child flush dependency(s).")
} /* end if */
/* Since the size of the on disk image is known exactly, there is
@@ -576,7 +567,7 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr,
/* Deserialize the prefetched on-disk image of the entry into the
* native memory form
*/
- if(NULL == (thing = type->deserialize(pf_entry_ptr->image_ptr, len, udata, &dirty)))
+ if (NULL == (thing = type->deserialize(pf_entry_ptr->image_ptr, len, udata, &dirty)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "Can't deserialize image")
ds_entry_ptr = (H5C_cache_entry_t *)thing;
@@ -606,33 +597,33 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr,
* hence the value assigned to ds_entry_ptr->is_dirty below.
*/
- HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6) );
+ HDassert((dirty == FALSE) || (type->id == 5 || type->id == 6));
- ds_entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
- ds_entry_ptr->cache_ptr = f->shared->cache;
- ds_entry_ptr->addr = addr;
- ds_entry_ptr->size = len;
+ ds_entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
+ ds_entry_ptr->cache_ptr = f->shared->cache;
+ ds_entry_ptr->addr = addr;
+ ds_entry_ptr->size = len;
HDassert(ds_entry_ptr->size < H5C_MAX_ENTRY_SIZE);
- ds_entry_ptr->image_ptr = pf_entry_ptr->image_ptr;
- ds_entry_ptr->image_up_to_date = !dirty;
- ds_entry_ptr->type = type;
- ds_entry_ptr->is_dirty = dirty | pf_entry_ptr->is_dirty;
- ds_entry_ptr->dirtied = FALSE;
- ds_entry_ptr->is_protected = FALSE;
- ds_entry_ptr->is_read_only = FALSE;
- ds_entry_ptr->ro_ref_count = 0;
- ds_entry_ptr->is_pinned = FALSE;
- ds_entry_ptr->in_slist = FALSE;
- ds_entry_ptr->flush_marker = FALSE;
+ ds_entry_ptr->image_ptr = pf_entry_ptr->image_ptr;
+ ds_entry_ptr->image_up_to_date = !dirty;
+ ds_entry_ptr->type = type;
+ ds_entry_ptr->is_dirty = dirty | pf_entry_ptr->is_dirty;
+ ds_entry_ptr->dirtied = FALSE;
+ ds_entry_ptr->is_protected = FALSE;
+ ds_entry_ptr->is_read_only = FALSE;
+ ds_entry_ptr->ro_ref_count = 0;
+ ds_entry_ptr->is_pinned = FALSE;
+ ds_entry_ptr->in_slist = FALSE;
+ ds_entry_ptr->flush_marker = FALSE;
#ifdef H5_HAVE_PARALLEL
- ds_entry_ptr->clear_on_unprotect = FALSE;
- ds_entry_ptr->flush_immediately = FALSE;
- ds_entry_ptr->coll_access = FALSE;
+ ds_entry_ptr->clear_on_unprotect = FALSE;
+ ds_entry_ptr->flush_immediately = FALSE;
+ ds_entry_ptr->coll_access = FALSE;
#endif /* H5_HAVE_PARALLEL */
- ds_entry_ptr->flush_in_progress = FALSE;
- ds_entry_ptr->destroy_in_progress = FALSE;
+ ds_entry_ptr->flush_in_progress = FALSE;
+ ds_entry_ptr->destroy_in_progress = FALSE;
- ds_entry_ptr->ring = pf_entry_ptr->ring;
+ ds_entry_ptr->ring = pf_entry_ptr->ring;
/* Initialize flush dependency height fields */
ds_entry_ptr->flush_dep_parent = NULL;
@@ -643,44 +634,44 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr,
ds_entry_ptr->flush_dep_nunser_children = 0;
/* Initialize fields supporting the hash table: */
- ds_entry_ptr->ht_next = NULL;
- ds_entry_ptr->ht_prev = NULL;
- ds_entry_ptr->il_next = NULL;
- ds_entry_ptr->il_prev = NULL;
+ ds_entry_ptr->ht_next = NULL;
+ ds_entry_ptr->ht_prev = NULL;
+ ds_entry_ptr->il_next = NULL;
+ ds_entry_ptr->il_prev = NULL;
/* Initialize fields supporting replacement policies: */
- ds_entry_ptr->next = NULL;
- ds_entry_ptr->prev = NULL;
+ ds_entry_ptr->next = NULL;
+ ds_entry_ptr->prev = NULL;
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
- ds_entry_ptr->aux_next = NULL;
- ds_entry_ptr->aux_prev = NULL;
+ ds_entry_ptr->aux_next = NULL;
+ ds_entry_ptr->aux_prev = NULL;
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
#ifdef H5_HAVE_PARALLEL
- pf_entry_ptr->coll_next = NULL;
- pf_entry_ptr->coll_prev = NULL;
+ pf_entry_ptr->coll_next = NULL;
+ pf_entry_ptr->coll_prev = NULL;
#endif /* H5_HAVE_PARALLEL */
/* Initialize cache image related fields */
- ds_entry_ptr->include_in_image = FALSE;
- ds_entry_ptr->lru_rank = 0;
- ds_entry_ptr->image_dirty = FALSE;
- ds_entry_ptr->fd_parent_count = 0;
- ds_entry_ptr->fd_parent_addrs = NULL;
- ds_entry_ptr->fd_child_count = pf_entry_ptr->fd_child_count;
- ds_entry_ptr->fd_dirty_child_count = 0;
- ds_entry_ptr->image_fd_height = 0;
- ds_entry_ptr->prefetched = FALSE;
- ds_entry_ptr->prefetch_type_id = 0;
- ds_entry_ptr->age = 0;
- ds_entry_ptr->prefetched_dirty = pf_entry_ptr->prefetched_dirty;
-#ifndef NDEBUG /* debugging field */
- ds_entry_ptr->serialization_count = 0;
+ ds_entry_ptr->include_in_image = FALSE;
+ ds_entry_ptr->lru_rank = 0;
+ ds_entry_ptr->image_dirty = FALSE;
+ ds_entry_ptr->fd_parent_count = 0;
+ ds_entry_ptr->fd_parent_addrs = NULL;
+ ds_entry_ptr->fd_child_count = pf_entry_ptr->fd_child_count;
+ ds_entry_ptr->fd_dirty_child_count = 0;
+ ds_entry_ptr->image_fd_height = 0;
+ ds_entry_ptr->prefetched = FALSE;
+ ds_entry_ptr->prefetch_type_id = 0;
+ ds_entry_ptr->age = 0;
+ ds_entry_ptr->prefetched_dirty = pf_entry_ptr->prefetched_dirty;
+#ifndef NDEBUG /* debugging field */
+ ds_entry_ptr->serialization_count = 0;
#endif /* NDEBUG */
H5C__RESET_CACHE_ENTRY_STATS(ds_entry_ptr);
/* Apply to to the newly deserialized entry */
- if(H5C__tag_entry(cache_ptr, ds_entry_ptr) < 0)
+ if (H5C__tag_entry(cache_ptr, ds_entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Cannot tag metadata entry")
/* We have successfully deserialized the prefetched entry.
@@ -705,16 +696,16 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr,
*/
pf_entry_ptr->image_ptr = NULL;
- if ( pf_entry_ptr->is_dirty ) {
+ if (pf_entry_ptr->is_dirty) {
- HDassert(((cache_ptr->slist_enabled) && (pf_entry_ptr->in_slist)) || \
+ HDassert(((cache_ptr->slist_enabled) && (pf_entry_ptr->in_slist)) ||
((!cache_ptr->slist_enabled) && (!pf_entry_ptr->in_slist)));
flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG;
} /* end if */
- if(H5C__flush_single_entry(f, pf_entry_ptr, flush_flags) < 0)
+ if (H5C__flush_single_entry(f, pf_entry_ptr, flush_flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "can't expunge prefetched entry")
#ifndef NDEGUG /* verify deletion */
@@ -727,7 +718,7 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr,
H5C__INSERT_IN_INDEX(cache_ptr, ds_entry_ptr, FAIL)
HDassert(!ds_entry_ptr->in_slist);
- if(ds_entry_ptr->is_dirty)
+ if (ds_entry_ptr->is_dirty)
H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, ds_entry_ptr, FAIL)
H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, ds_entry_ptr, FAIL)
@@ -737,8 +728,8 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr,
* send an "after load" notice now that the deserialized entry is fully
* integrated into the cache.
*/
- if(ds_entry_ptr->type->notify &&
- (ds_entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_LOAD, ds_entry_ptr) < 0)
+ if (ds_entry_ptr->type->notify &&
+ (ds_entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_LOAD, ds_entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry loaded into cache")
/* Restore flush dependencies with the flush dependency children of
@@ -747,10 +738,10 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr,
* then unprotect it afterwards.
*/
i = 0;
- if(fd_children != NULL) {
+ if (fd_children != NULL) {
H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, ds_entry_ptr, FAIL)
ds_entry_ptr->is_protected = TRUE;
- while(fd_children[i] != NULL) {
+ while (fd_children[i] != NULL) {
/* Sanity checks */
HDassert((fd_children[i])->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert((fd_children[i])->prefetched);
@@ -759,13 +750,13 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr,
#ifndef NDEBUG
{
- int j;
+ int j;
hbool_t found;
- j = 0;
+ j = 0;
found = FALSE;
- while((j < (int)((fd_children[i])->fd_parent_count)) && (!found)) {
- if((fd_children[i])->fd_parent_addrs[j] == ds_entry_ptr->addr)
+ while ((j < (int)((fd_children[i])->fd_parent_count)) && (!found)) {
+ if ((fd_children[i])->fd_parent_addrs[j] == ds_entry_ptr->addr)
found = TRUE;
j++;
@@ -774,7 +765,7 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr,
}
#endif /* NDEBUG */
- if(H5C_create_flush_dependency(ds_entry_ptr, fd_children[i]) < 0)
+ if (H5C_create_flush_dependency(ds_entry_ptr, fd_children[i]) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Can't restore child flush dependency")
i++;
@@ -792,18 +783,17 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr,
*entry_ptr_ptr = ds_entry_ptr;
done:
- if(fd_children)
+ if (fd_children)
fd_children = (H5C_cache_entry_t **)H5MM_xfree((void *)fd_children);
/* Release resources on error */
- if(FAIL == ret_value)
- if(thing && type->free_icr(thing) < 0)
+ if (FAIL == ret_value)
+ if (thing && type->free_icr(thing) < 0)
HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "free_icr callback failed")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__deserialize_prefetched_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5C__free_image_entries_array
*
@@ -822,7 +812,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__free_image_entries_array(H5C_t * cache_ptr)
+H5C__free_image_entries_array(H5C_t *cache_ptr)
{
FUNC_ENTER_STATIC_NOERR
@@ -834,44 +824,43 @@ H5C__free_image_entries_array(H5C_t * cache_ptr)
HDassert(cache_ptr->index_len == 0);
/* Check for entries to free */
- if(cache_ptr->image_entries != NULL) {
- unsigned u; /* Local index variable */
+ if (cache_ptr->image_entries != NULL) {
+ unsigned u; /* Local index variable */
- for(u = 0; u < cache_ptr->num_entries_in_image; u++) {
- H5C_image_entry_t *ie_ptr; /* Image entry to release */
+ for (u = 0; u < cache_ptr->num_entries_in_image; u++) {
+ H5C_image_entry_t *ie_ptr; /* Image entry to release */
/* Get pointer to image entry */
- ie_ptr = &((cache_ptr->image_entries)[u]);
+ ie_ptr = &((cache_ptr->image_entries)[u]);
/* Sanity checks */
- HDassert(ie_ptr);
+ HDassert(ie_ptr);
HDassert(ie_ptr->magic == H5C_IMAGE_ENTRY_T_MAGIC);
- HDassert(ie_ptr->image_ptr);
+ HDassert(ie_ptr->image_ptr);
- /* Free the parent addrs array if appropriate */
- if(ie_ptr->fd_parent_addrs) {
- HDassert(ie_ptr->fd_parent_count > 0);
+ /* Free the parent addrs array if appropriate */
+ if (ie_ptr->fd_parent_addrs) {
+ HDassert(ie_ptr->fd_parent_count > 0);
- ie_ptr->fd_parent_addrs = (haddr_t *)H5MM_xfree(ie_ptr->fd_parent_addrs);
+ ie_ptr->fd_parent_addrs = (haddr_t *)H5MM_xfree(ie_ptr->fd_parent_addrs);
} /* end if */
else
- HDassert(ie_ptr->fd_parent_count == 0);
+ HDassert(ie_ptr->fd_parent_count == 0);
/* Free the image */
ie_ptr->image_ptr = H5MM_xfree(ie_ptr->image_ptr);
- /* Set magic field to bad magic so we can detect freed entries */
- ie_ptr->magic = H5C_IMAGE_ENTRY_T_BAD_MAGIC;
- } /* end for */
+ /* Set magic field to bad magic so we can detect freed entries */
+ ie_ptr->magic = H5C_IMAGE_ENTRY_T_BAD_MAGIC;
+ } /* end for */
- /* Free the image entries array */
- cache_ptr->image_entries = (H5C_image_entry_t *)H5MM_xfree(cache_ptr->image_entries);
+ /* Free the image entries array */
+ cache_ptr->image_entries = (H5C_image_entry_t *)H5MM_xfree(cache_ptr->image_entries);
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5C__free_image_entries_array() */
-
/*-------------------------------------------------------------------------
* Function: H5C_get_cache_image_config
*
@@ -887,16 +876,15 @@ H5C__free_image_entries_array(H5C_t * cache_ptr)
*-------------------------------------------------------------------------
*/
herr_t
-H5C_get_cache_image_config(const H5C_t * cache_ptr,
- H5C_cache_image_ctl_t *config_ptr)
+H5C_get_cache_image_config(const H5C_t *cache_ptr, H5C_cache_image_ctl_t *config_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache_ptr on entry")
- if(config_ptr == NULL)
+ if (config_ptr == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad config_ptr on entry")
*config_ptr = cache_ptr->image_ctl;
@@ -905,7 +893,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_get_cache_image_config() */
-
/*-------------------------------------------------------------------------
* Function: H5C_image_stats
*
@@ -920,66 +907,59 @@ done:
*/
herr_t
#if H5C_COLLECT_CACHE_STATS
-H5C_image_stats(H5C_t * cache_ptr, hbool_t print_header)
-#else /* H5C_COLLECT_CACHE_STATS */
-H5C_image_stats(H5C_t * cache_ptr, hbool_t H5_ATTR_UNUSED print_header)
+H5C_image_stats(H5C_t *cache_ptr, hbool_t print_header)
+#else /* H5C_COLLECT_CACHE_STATS */
+H5C_image_stats(H5C_t *cache_ptr, hbool_t H5_ATTR_UNUSED print_header)
#endif /* H5C_COLLECT_CACHE_STATS */
{
#if H5C_COLLECT_CACHE_STATS
- int i;
- int64_t total_hits = 0;
- int64_t total_misses = 0;
- double hit_rate;
- double prefetch_use_rate;
-#endif /* H5C_COLLECT_CACHE_STATS */
- herr_t ret_value = SUCCEED; /* Return value */
+ int i;
+ int64_t total_hits = 0;
+ int64_t total_misses = 0;
+ double hit_rate;
+ double prefetch_use_rate;
+#endif /* H5C_COLLECT_CACHE_STATS */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if(!cache_ptr || cache_ptr->magic != H5C__H5C_T_MAGIC)
+ if (!cache_ptr || cache_ptr->magic != H5C__H5C_T_MAGIC)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr")
#if H5C_COLLECT_CACHE_STATS
- for(i = 0; i <= cache_ptr->max_type_id; i++) {
- total_hits += cache_ptr->hits[i];
- total_misses += cache_ptr->misses[i];
+ for (i = 0; i <= cache_ptr->max_type_id; i++) {
+ total_hits += cache_ptr->hits[i];
+ total_misses += cache_ptr->misses[i];
} /* end for */
- if((total_hits > 0) || (total_misses > 0))
+ if ((total_hits > 0) || (total_misses > 0))
hit_rate = (double)100.0f * ((double)(total_hits)) / ((double)(total_hits + total_misses));
else
hit_rate = 0.0f;
- if(cache_ptr->prefetches > 0)
- prefetch_use_rate = (double)100.0f * ((double)(cache_ptr->prefetch_hits)) /
- ((double)(cache_ptr->prefetches));
+ if (cache_ptr->prefetches > 0)
+ prefetch_use_rate =
+ (double)100.0f * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches));
else
prefetch_use_rate = 0.0f;
- if(print_header) {
- HDfprintf(stdout,
- "\nhit prefetches prefetch image pf hit\n");
- HDfprintf(stdout,
- "rate: total: dirty: hits: flshs: evct: size: rate:\n");
+ if (print_header) {
+ HDfprintf(stdout, "\nhit prefetches prefetch image pf hit\n");
+ HDfprintf(stdout, "rate: total: dirty: hits: flshs: evct: size: rate:\n");
} /* end if */
- HDfprintf(stdout,
- "%3.1lf %5lld %5lld %5lld %5lld %5lld %5lld %3.1lf\n",
- hit_rate,
- (long long)(cache_ptr->prefetches),
- (long long)(cache_ptr->dirty_prefetches),
- (long long)(cache_ptr->prefetch_hits),
- (long long)(cache_ptr->flushes[H5AC_PREFETCHED_ENTRY_ID]),
- (long long)(cache_ptr->evictions[H5AC_PREFETCHED_ENTRY_ID]),
- (long long)(cache_ptr->last_image_size),
- prefetch_use_rate);
+ HDfprintf(stdout, "%3.1lf %5lld %5lld %5lld %5lld %5lld %5lld %3.1lf\n", hit_rate,
+ (long long)(cache_ptr->prefetches), (long long)(cache_ptr->dirty_prefetches),
+ (long long)(cache_ptr->prefetch_hits),
+ (long long)(cache_ptr->flushes[H5AC_PREFETCHED_ENTRY_ID]),
+ (long long)(cache_ptr->evictions[H5AC_PREFETCHED_ENTRY_ID]),
+ (long long)(cache_ptr->last_image_size), prefetch_use_rate);
#endif /* H5C_COLLECT_CACHE_STATS */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_image_stats() */
-
/*-------------------------------------------------------------------------
* Function: H5C__read_cache_image
*
@@ -996,7 +976,7 @@ done:
static herr_t
H5C__read_cache_image(H5F_t *f, H5C_t *cache_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1008,55 +988,48 @@ H5C__read_cache_image(H5F_t *f, H5C_t *cache_ptr)
HDassert(cache_ptr->image_buffer);
#ifdef H5_HAVE_PARALLEL
-{
- H5AC_aux_t *aux_ptr = (H5AC_aux_t *)cache_ptr->aux_ptr;
- int mpi_result;
+ {
+ H5AC_aux_t *aux_ptr = (H5AC_aux_t *)cache_ptr->aux_ptr;
+ int mpi_result;
- if ( ( NULL == aux_ptr ) || ( aux_ptr->mpi_rank == 0 ) ) {
+ if ((NULL == aux_ptr) || (aux_ptr->mpi_rank == 0)) {
- HDassert((NULL == aux_ptr) ||
- (aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC));
+ HDassert((NULL == aux_ptr) || (aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC));
#endif /* H5_HAVE_PARALLEL */
- /* Read the buffer (if serial access, or rank 0 of parallel access) */
- if(H5F_block_read(f, H5FD_MEM_SUPER, cache_ptr->image_addr,
- cache_ptr->image_len, cache_ptr->image_buffer) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, "Can't read metadata cache image block")
+ /* Read the buffer (if serial access, or rank 0 of parallel access) */
+ if (H5F_block_read(f, H5FD_MEM_SUPER, cache_ptr->image_addr, cache_ptr->image_len,
+ cache_ptr->image_buffer) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, "Can't read metadata cache image block")
- H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr)
+ H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr)
#ifdef H5_HAVE_PARALLEL
- if ( aux_ptr ) {
+ if (aux_ptr) {
- /* Broadcast cache image */
- if ( MPI_SUCCESS !=
- (mpi_result = MPI_Bcast(cache_ptr->image_buffer,
- (int)cache_ptr->image_len, MPI_BYTE,
- 0, aux_ptr->mpi_comm)) )
+ /* Broadcast cache image */
+ if (MPI_SUCCESS != (mpi_result = MPI_Bcast(cache_ptr->image_buffer, (int)cache_ptr->image_len,
+ MPI_BYTE, 0, aux_ptr->mpi_comm)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result)
+ HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result)
- } /* end if */
- } /* end if */
- else if ( aux_ptr ) {
-
- /* Retrieve the contents of the metadata cache image from process 0 */
- if ( MPI_SUCCESS !=
- (mpi_result = MPI_Bcast(cache_ptr->image_buffer,
- (int)cache_ptr->image_len, MPI_BYTE,
- 0, aux_ptr->mpi_comm)) )
-
- HMPI_GOTO_ERROR(FAIL, "can't receive cache image MPI_Bcast", \
- mpi_result)
- } /* end else-if */
-} /* end block */
-#endif /* H5_HAVE_PARALLEL */
+ } /* end if */
+ } /* end if */
+ else if (aux_ptr) {
+
+ /* Retrieve the contents of the metadata cache image from process 0 */
+ if (MPI_SUCCESS != (mpi_result = MPI_Bcast(cache_ptr->image_buffer, (int)cache_ptr->image_len,
+ MPI_BYTE, 0, aux_ptr->mpi_comm)))
+
+ HMPI_GOTO_ERROR(FAIL, "can't receive cache image MPI_Bcast", mpi_result)
+ } /* end else-if */
+ } /* end block */
+#endif /* H5_HAVE_PARALLEL */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__read_cache_image() */
-
/*-------------------------------------------------------------------------
* Function: H5C__load_cache_image
*
@@ -1077,8 +1050,8 @@ done:
herr_t
H5C__load_cache_image(H5F_t *f)
{
- H5C_t * cache_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t *cache_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1098,21 +1071,21 @@ H5C__load_cache_image(H5F_t *f)
* no image exists, and that the load operation should be skipped
* silently.
*/
- if(H5F_addr_defined(cache_ptr->image_addr)) {
+ if (H5F_addr_defined(cache_ptr->image_addr)) {
/* Sanity checks */
HDassert(cache_ptr->image_len > 0);
HDassert(cache_ptr->image_buffer == NULL);
/* Allocate space for the image */
- if(NULL == (cache_ptr->image_buffer = H5MM_malloc(cache_ptr->image_len + 1)))
+ if (NULL == (cache_ptr->image_buffer = H5MM_malloc(cache_ptr->image_len + 1)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for cache image buffer")
/* Load the image from file */
- if(H5C__read_cache_image(f, cache_ptr) < 0)
+ if (H5C__read_cache_image(f, cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, "Can't read metadata cache image block")
/* Reconstruct cache contents, from image */
- if(H5C__reconstruct_cache_contents(f, cache_ptr) < 0)
+ if (H5C__reconstruct_cache_contents(f, cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTDECODE, FAIL, "Can't reconstruct cache contents from image block")
/* Free the image buffer */
@@ -1127,21 +1100,21 @@ H5C__load_cache_image(H5F_t *f)
} /* end if */
/* If directed, free the on disk metadata cache image */
- if(cache_ptr->delete_image) {
- if(H5F__super_ext_remove_msg(f, H5O_MDCI_MSG_ID) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove metadata cache image message from superblock extension")
+ if (cache_ptr->delete_image) {
+ if (H5F__super_ext_remove_msg(f, H5O_MDCI_MSG_ID) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL,
+ "can't remove metadata cache image message from superblock extension")
/* Reset image block values */
- cache_ptr->image_len = 0;
+ cache_ptr->image_len = 0;
cache_ptr->image_data_len = 0;
- cache_ptr->image_addr = HADDR_UNDEF;
+ cache_ptr->image_addr = HADDR_UNDEF;
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__load_cache_image() */
-
/*-------------------------------------------------------------------------
* Function: H5C_load_cache_image_on_next_protect()
*
@@ -1171,8 +1144,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len,
- hbool_t rw)
+H5C_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len, hbool_t rw)
{
H5C_t *cache_ptr;
@@ -1186,15 +1158,13 @@ H5C_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len,
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* Set information needed to load cache image */
- cache_ptr->image_addr = addr,
- cache_ptr->image_len = len;
+ cache_ptr->image_addr = addr, cache_ptr->image_len = len;
cache_ptr->load_image = TRUE;
cache_ptr->delete_image = rw;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5C_load_cache_image_on_next_protect() */
-
/*-------------------------------------------------------------------------
* Function: H5C__image_entry_cmp
*
@@ -1220,9 +1190,11 @@ H5C_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len,
static int
H5C__image_entry_cmp(const void *_entry1, const void *_entry2)
{
- const H5C_image_entry_t *entry1 = (const H5C_image_entry_t *)_entry1; /* Pointer to first image entry to compare */
- const H5C_image_entry_t *entry2 = (const H5C_image_entry_t *)_entry2; /* Pointer to second image entry to compare */
- int ret_value = 0; /* Return value */
+ const H5C_image_entry_t *entry1 =
+ (const H5C_image_entry_t *)_entry1; /* Pointer to first image entry to compare */
+ const H5C_image_entry_t *entry2 =
+ (const H5C_image_entry_t *)_entry2; /* Pointer to second image entry to compare */
+ int ret_value = 0; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -1230,25 +1202,24 @@ H5C__image_entry_cmp(const void *_entry1, const void *_entry2)
HDassert(entry1);
HDassert(entry2);
- if(entry1->image_fd_height > entry2->image_fd_height)
+ if (entry1->image_fd_height > entry2->image_fd_height)
ret_value = -1;
- else if(entry1->image_fd_height < entry2->image_fd_height)
+ else if (entry1->image_fd_height < entry2->image_fd_height)
ret_value = 1;
else {
/* Sanity check */
HDassert(entry1->lru_rank >= -1);
HDassert(entry2->lru_rank >= -1);
- if(entry1->lru_rank < entry2->lru_rank)
+ if (entry1->lru_rank < entry2->lru_rank)
ret_value = -1;
- else if(entry1->lru_rank > entry2->lru_rank)
+ else if (entry1->lru_rank > entry2->lru_rank)
ret_value = 1;
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__image_entry_cmp() */
-
/*-------------------------------------------------------------------------
* Function: H5C__prep_image_for_file_close
*
@@ -1299,10 +1270,10 @@ H5C__image_entry_cmp(const void *_entry1, const void *_entry2)
herr_t
H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated)
{
- H5C_t * cache_ptr = NULL;
- haddr_t eoa_frag_addr = HADDR_UNDEF;
- hsize_t eoa_frag_size = 0;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr = NULL;
+ haddr_t eoa_frag_addr = HADDR_UNDEF;
+ hsize_t eoa_frag_size = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1319,10 +1290,10 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated)
* any group or data set, it is possible that the cache image (if
* it exists) has not been read yet. Do this now if required.
*/
- if(cache_ptr->load_image) {
+ if (cache_ptr->load_image) {
cache_ptr->load_image = FALSE;
- if(H5C__load_cache_image(f) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "can't load cache image")
+ if (H5C__load_cache_image(f) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "can't load cache image")
} /* end if */
/* Before we start to generate the cache image (if requested), verify
@@ -1339,9 +1310,8 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated)
* Also verify that the file's high_bound is at least release
* 1.10.x, otherwise cancel the request for a cache image
*/
- if((NULL == f->shared->sblock) ||
- (f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2) ||
- (f->shared->high_bound < H5F_LIBVER_V110)) {
+ if ((NULL == f->shared->sblock) || (f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2) ||
+ (f->shared->high_bound < H5F_LIBVER_V110)) {
H5C_cache_image_ctl_t default_image_ctl = H5C__DEFAULT_CACHE_IMAGE_CTL;
cache_ptr->image_ctl = default_image_ctl;
@@ -1349,7 +1319,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated)
} /* end if */
/* Generate the cache image, if requested */
- if(cache_ptr->image_ctl.generate_image) {
+ if (cache_ptr->image_ctl.generate_image) {
/* Create the cache image super block extension message.
*
* Note that the base address and length of the metadata cache
@@ -1364,12 +1334,12 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated)
* H5C_CI__GEN_MDCI_SBE_MESG bit is set in
* cache_ptr->image_ctl.flags.
*/
- if(cache_ptr->image_ctl.flags & H5C_CI__GEN_MDCI_SBE_MESG)
- if(H5C__write_cache_image_superblock_msg(f, TRUE) < 0)
+ if (cache_ptr->image_ctl.flags & H5C_CI__GEN_MDCI_SBE_MESG)
+ if (H5C__write_cache_image_superblock_msg(f, TRUE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "creation of cache image SB mesg failed.")
/* Serialize the cache */
- if(H5C__serialize_cache(f) < 0)
+ if (H5C__serialize_cache(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "serialization of the cache failed")
/* Scan the cache and record data needed to construct the
@@ -1388,7 +1358,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated)
* image. With the recent modifications of the free space
* manager code, this size should be correct.
*/
- if(H5C__prep_for_file_close__scan_entries(f, cache_ptr) < 0)
+ if (H5C__prep_for_file_close__scan_entries(f, cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C__prep_for_file_close__scan_entries failed")
HDassert(HADDR_UNDEF == cache_ptr->image_addr);
@@ -1396,23 +1366,25 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated)
/* In the parallel case, overwrite the image_len with the
* value computed by process 0.
*/
- if(cache_ptr->aux_ptr) { /* we have multiple processes */
- int mpi_result;
- unsigned p0_image_len;
- H5AC_aux_t * aux_ptr;
+ if (cache_ptr->aux_ptr) { /* we have multiple processes */
+ int mpi_result;
+ unsigned p0_image_len;
+ H5AC_aux_t *aux_ptr;
aux_ptr = (H5AC_aux_t *)cache_ptr->aux_ptr;
- if(aux_ptr->mpi_rank == 0) {
+ if (aux_ptr->mpi_rank == 0) {
aux_ptr->p0_image_len = (unsigned)cache_ptr->image_data_len;
- p0_image_len = aux_ptr->p0_image_len;
+ p0_image_len = aux_ptr->p0_image_len;
- if(MPI_SUCCESS != (mpi_result = MPI_Bcast(&p0_image_len, 1, MPI_UNSIGNED, 0, aux_ptr->mpi_comm)))
+ if (MPI_SUCCESS !=
+ (mpi_result = MPI_Bcast(&p0_image_len, 1, MPI_UNSIGNED, 0, aux_ptr->mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result)
HDassert(p0_image_len == aux_ptr->p0_image_len);
} /* end if */
else {
- if(MPI_SUCCESS != (mpi_result = MPI_Bcast(&p0_image_len, 1, MPI_UNSIGNED, 0, aux_ptr->mpi_comm)))
+ if (MPI_SUCCESS !=
+ (mpi_result = MPI_Bcast(&p0_image_len, 1, MPI_UNSIGNED, 0, aux_ptr->mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result)
aux_ptr->p0_image_len = p0_image_len;
@@ -1427,9 +1399,11 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated)
* Note that we allocate the cache image directly from the file
* driver so as to avoid unsettling the free space managers.
*/
- if(HADDR_UNDEF == (cache_ptr->image_addr = H5FD_alloc(f->shared->lf, H5FD_MEM_SUPER, f,
- (hsize_t)p0_image_len, &eoa_frag_addr, &eoa_frag_size)))
- HGOTO_ERROR(H5E_CACHE, H5E_NOSPACE, FAIL, "can't allocate file space for metadata cache image")
+ if (HADDR_UNDEF ==
+ (cache_ptr->image_addr = H5FD_alloc(f->shared->lf, H5FD_MEM_SUPER, f, (hsize_t)p0_image_len,
+ &eoa_frag_addr, &eoa_frag_size)))
+ HGOTO_ERROR(H5E_CACHE, H5E_NOSPACE, FAIL,
+ "can't allocate file space for metadata cache image")
} /* end if */
else
#endif /* H5_HAVE_PARALLEL */
@@ -1437,9 +1411,10 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated)
* this space directly from the file driver so as to avoid
* unsettling the free space managers.
*/
- if(HADDR_UNDEF == (cache_ptr->image_addr = H5FD_alloc(f->shared->lf, H5FD_MEM_SUPER, f,
- (hsize_t)(cache_ptr->image_data_len), &eoa_frag_addr, &eoa_frag_size)))
- HGOTO_ERROR(H5E_CACHE, H5E_NOSPACE, FAIL, "can't allocate file space for metadata cache image")
+ if (HADDR_UNDEF == (cache_ptr->image_addr = H5FD_alloc(f->shared->lf, H5FD_MEM_SUPER, f,
+ (hsize_t)(cache_ptr->image_data_len),
+ &eoa_frag_addr, &eoa_frag_size)))
+ HGOTO_ERROR(H5E_CACHE, H5E_NOSPACE, FAIL, "can't allocate file space for metadata cache image")
/* Make note of the eoa after allocation of the cache image
* block. This value is used for sanity checking when we
@@ -1447,7 +1422,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated)
* we destroy the metadata cache.
*/
HDassert(HADDR_UNDEF == f->shared->eoa_post_mdci_fsalloc);
- if(HADDR_UNDEF == (f->shared->eoa_post_mdci_fsalloc = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT)) )
+ if (HADDR_UNDEF == (f->shared->eoa_post_mdci_fsalloc = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT)))
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size")
/* For now, drop any fragment left over from the allocation of the
@@ -1479,8 +1454,8 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated)
* H5C_CI__GEN_MDC_IMAGE_BLK bit is set in
* cache_ptr->image_ctl.flags.
*/
- if(cache_ptr->image_ctl.flags & H5C_CI__GEN_MDC_IMAGE_BLK)
- if(H5C__write_cache_image_superblock_msg(f, FALSE) < 0)
+ if (cache_ptr->image_ctl.flags & H5C_CI__GEN_MDC_IMAGE_BLK)
+ if (H5C__write_cache_image_superblock_msg(f, FALSE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "update of cache image SB mesg failed")
/* At this point:
@@ -1517,14 +1492,14 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated)
* allow the file close to continue normally without the
* unnecessary generation of the metadata cache image.
*/
- if(cache_ptr->num_entries_in_image > 0) {
- if(H5C__prep_for_file_close__setup_image_entries_array(cache_ptr) < 0)
+ if (cache_ptr->num_entries_in_image > 0) {
+ if (H5C__prep_for_file_close__setup_image_entries_array(cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINIT, FAIL, "can't setup image entries array.")
/* Sort the entries */
HDqsort(cache_ptr->image_entries, (size_t)cache_ptr->num_entries_in_image,
sizeof(H5C_image_entry_t), H5C__image_entry_cmp);
- } /* end if */
+ } /* end if */
else { /* cancel creation of metadata cache image */
HDassert(cache_ptr->image_entries == NULL);
@@ -1533,9 +1508,10 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated)
* H5C_CI__GEN_MDC_IMAGE_BLK flag is set in
* cache_ptr->image_ctl.flags.
*/
- if(cache_ptr->image_ctl.flags & H5C_CI__GEN_MDC_IMAGE_BLK)
- if(H5F__super_ext_remove_msg(f, H5O_MDCI_MSG_ID) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove MDC image msg from superblock ext")
+ if (cache_ptr->image_ctl.flags & H5C_CI__GEN_MDC_IMAGE_BLK)
+ if (H5F__super_ext_remove_msg(f, H5O_MDCI_MSG_ID) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL,
+ "can't remove MDC image msg from superblock ext")
cache_ptr->image_ctl.generate_image = FALSE;
} /* end else */
@@ -1548,7 +1524,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__prep_image_for_file_close() */
-
/*-------------------------------------------------------------------------
* Function: H5C_set_cache_image_config
*
@@ -1578,10 +1553,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr,
- H5C_cache_image_ctl_t *config_ptr)
+H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_image_ctl_t *config_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1591,11 +1565,11 @@ H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr,
HDassert(f->shared->cache == f->shared->cache);
/* Check arguments */
- if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache_ptr on entry")
/* Validate the config: */
- if(H5C_validate_cache_image_config(config_ptr) < 0)
+ if (H5C_validate_cache_image_config(config_ptr) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid cache image configuration")
#ifdef H5_HAVE_PARALLEL
@@ -1604,11 +1578,11 @@ H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr,
* if there is more than one process.
* JRM -- 11/8/16
*/
- if(cache_ptr->aux_ptr) {
- H5C_cache_image_ctl_t default_image_ctl = H5C__DEFAULT_CACHE_IMAGE_CTL;
+ if (cache_ptr->aux_ptr) {
+ H5C_cache_image_ctl_t default_image_ctl = H5C__DEFAULT_CACHE_IMAGE_CTL;
cache_ptr->image_ctl = default_image_ctl;
- HDassert(!(cache_ptr->image_ctl.generate_image));
+ HDassert(!(cache_ptr->image_ctl.generate_image));
} /* end if */
else {
#endif /* H5_HAVE_PARALLEL */
@@ -1624,7 +1598,7 @@ H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr,
* If it is not, set the image configuration to the default, which has
* the effect of silently disabling the cache image if it was requested.
*/
- if(H5F_INTENT(f) & H5F_ACC_RDWR)
+ if (H5F_INTENT(f) & H5F_ACC_RDWR)
cache_ptr->image_ctl = *config_ptr;
else {
H5C_cache_image_ctl_t default_image_ctl = H5C__DEFAULT_CACHE_IMAGE_CTL;
@@ -1633,14 +1607,13 @@ H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr,
HDassert(!(cache_ptr->image_ctl.generate_image));
} /* end else */
#ifdef H5_HAVE_PARALLEL
- } /* end else */
+ } /* end else */
#endif /* H5_HAVE_PARALLEL */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_set_cache_image_config() */
-
/*-------------------------------------------------------------------------
* Function: H5C_validate_cache_image_config()
*
@@ -1658,39 +1631,38 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_validate_cache_image_config(H5C_cache_image_ctl_t * ctl_ptr)
+H5C_validate_cache_image_config(H5C_cache_image_ctl_t *ctl_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if(ctl_ptr == NULL)
+ if (ctl_ptr == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL ctl_ptr on entry")
- if(ctl_ptr->version != H5C__CURR_CACHE_IMAGE_CTL_VER)
+ if (ctl_ptr->version != H5C__CURR_CACHE_IMAGE_CTL_VER)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown cache image control version")
/* At present, we do not support inclusion of the adaptive resize
* configuration in the cache image. Thus the save_resize_status
* field must be FALSE.
*/
- if(ctl_ptr->save_resize_status != FALSE)
+ if (ctl_ptr->save_resize_status != FALSE)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unexpected value in save_resize_status field")
/* At present, we do not support prefetched entry ageouts. Thus
* the entry_ageout field must be set to
* H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE.
*/
- if(ctl_ptr->entry_ageout != H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE)
+ if (ctl_ptr->entry_ageout != H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unexpected value in entry_ageout field")
- if((ctl_ptr->flags & ~H5C_CI__ALL_FLAGS) != 0)
+ if ((ctl_ptr->flags & ~H5C_CI__ALL_FLAGS) != 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unknown flag set")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_validate_cache_image_config() */
-
/*************************************************************************/
/**************************** Private Functions: *************************/
/*************************************************************************/
@@ -1710,28 +1682,27 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5C__cache_image_block_entry_header_size(const H5F_t * f)
+H5C__cache_image_block_entry_header_size(const H5F_t *f)
{
- size_t ret_value = 0; /* Return value */
+ size_t ret_value = 0; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Set return value */
- ret_value = (size_t)( 1 + /* type */
- 1 + /* flags */
- 1 + /* ring */
- 1 + /* age */
- 2 + /* dependency child count */
- 2 + /* dirty dep child count */
- 2 + /* dependency parent count */
- 4 + /* index in LRU */
- H5F_SIZEOF_ADDR(f) + /* entry offset */
- H5F_SIZEOF_SIZE(f) ); /* entry length */
+ ret_value = (size_t)(1 + /* type */
+ 1 + /* flags */
+ 1 + /* ring */
+ 1 + /* age */
+ 2 + /* dependency child count */
+ 2 + /* dirty dep child count */
+ 2 + /* dependency parent count */
+ 4 + /* index in LRU */
+ H5F_SIZEOF_ADDR(f) + /* entry offset */
+ H5F_SIZEOF_SIZE(f)); /* entry length */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__cache_image_block_entry_header_size() */
-
/*-------------------------------------------------------------------------
* Function: H5C__cache_image_block_header_size
*
@@ -1747,23 +1718,22 @@ H5C__cache_image_block_entry_header_size(const H5F_t * f)
*-------------------------------------------------------------------------
*/
static size_t
-H5C__cache_image_block_header_size(const H5F_t * f)
+H5C__cache_image_block_header_size(const H5F_t *f)
{
- size_t ret_value = 0; /* Return value */
+ size_t ret_value = 0; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Set return value */
- ret_value = (size_t)( 4 + /* signature */
- 1 + /* version */
- 1 + /* flags */
- H5F_SIZEOF_SIZE(f) + /* image data length */
- 4 ); /* num_entries */
+ ret_value = (size_t)(4 + /* signature */
+ 1 + /* version */
+ 1 + /* flags */
+ H5F_SIZEOF_SIZE(f) + /* image data length */
+ 4); /* num_entries */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__cache_image_block_header_size() */
-
/*-------------------------------------------------------------------------
* Function: H5C__decode_cache_image_header()
*
@@ -1780,16 +1750,15 @@ H5C__cache_image_block_header_size(const H5F_t * f)
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr,
- const uint8_t **buf)
+H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **buf)
{
- uint8_t version;
- uint8_t flags;
- hbool_t have_resize_status = FALSE;
- size_t actual_header_len;
- size_t expected_header_len;
- const uint8_t * p;
- herr_t ret_value = SUCCEED; /* Return value */
+ uint8_t version;
+ uint8_t flags;
+ hbool_t have_resize_status = FALSE;
+ size_t actual_header_len;
+ size_t expected_header_len;
+ const uint8_t *p;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1803,38 +1772,38 @@ H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr,
p = *buf;
/* Check signature */
- if(HDmemcmp(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN))
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image header signature")
+ if (HDmemcmp(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN))
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image header signature")
p += H5C__MDCI_BLOCK_SIGNATURE_LEN;
/* Check version */
version = *p++;
- if(version != (uint8_t)H5C__MDCI_BLOCK_VERSION_0)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image version")
+ if (version != (uint8_t)H5C__MDCI_BLOCK_VERSION_0)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image version")
/* Decode flags */
flags = *p++;
- if(flags & H5C__MDCI_HEADER_HAVE_RESIZE_STATUS)
- have_resize_status = TRUE;
- if(have_resize_status)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "MDC resize status not yet supported")
+ if (flags & H5C__MDCI_HEADER_HAVE_RESIZE_STATUS)
+ have_resize_status = TRUE;
+ if (have_resize_status)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "MDC resize status not yet supported")
/* Read image data length */
H5F_DECODE_LENGTH(f, p, cache_ptr->image_data_len);
/* For now -- will become <= eventually */
- if(cache_ptr->image_data_len != cache_ptr->image_len)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image data length")
+ if (cache_ptr->image_data_len != cache_ptr->image_len)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image data length")
/* Read num entries */
UINT32DECODE(p, cache_ptr->num_entries_in_image);
- if(cache_ptr->num_entries_in_image == 0)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache entry count")
+ if (cache_ptr->num_entries_in_image == 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache entry count")
/* Verify expected length of header */
- actual_header_len = (size_t)(p - *buf);
+ actual_header_len = (size_t)(p - *buf);
expected_header_len = H5C__cache_image_block_header_size(f);
- if(actual_header_len != expected_header_len)
+ if (actual_header_len != expected_header_len)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad header image len")
/* Update buffer pointer */
@@ -1845,7 +1814,7 @@ done:
} /* H5C__decode_cache_image_header() */
#ifndef NDEBUG
-
+
/*-------------------------------------------------------------------------
* Function: H5C__decode_cache_image_entry()
*
@@ -1866,28 +1835,27 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr,
- const uint8_t **buf, unsigned entry_num)
+H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr, const uint8_t **buf, unsigned entry_num)
{
- hbool_t is_dirty = FALSE;
- hbool_t in_lru = FALSE; /* Only used in assertions */
- hbool_t is_fd_parent = FALSE; /* Only used in assertions */
- hbool_t is_fd_child = FALSE; /* Only used in assertions */
- haddr_t addr;
- hsize_t size = 0;
- void * image_ptr;
- uint8_t flags = 0;
- uint8_t type_id;
- uint8_t ring;
- uint8_t age;
- uint16_t fd_child_count;
- uint16_t fd_dirty_child_count;
- uint16_t fd_parent_count;
- haddr_t * fd_parent_addrs = NULL;
- int32_t lru_rank;
- H5C_image_entry_t * ie_ptr = NULL;
- const uint8_t * p;
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t is_dirty = FALSE;
+ hbool_t in_lru = FALSE; /* Only used in assertions */
+ hbool_t is_fd_parent = FALSE; /* Only used in assertions */
+ hbool_t is_fd_child = FALSE; /* Only used in assertions */
+ haddr_t addr;
+ hsize_t size = 0;
+ void * image_ptr;
+ uint8_t flags = 0;
+ uint8_t type_id;
+ uint8_t ring;
+ uint8_t age;
+ uint16_t fd_child_count;
+ uint16_t fd_dirty_child_count;
+ uint16_t fd_parent_count;
+ haddr_t * fd_parent_addrs = NULL;
+ int32_t lru_rank;
+ H5C_image_entry_t *ie_ptr = NULL;
+ const uint8_t * p;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1912,13 +1880,13 @@ H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr,
/* Decode flags */
flags = *p++;
- if(flags & H5C__MDCI_ENTRY_DIRTY_FLAG)
+ if (flags & H5C__MDCI_ENTRY_DIRTY_FLAG)
is_dirty = TRUE;
- if(flags & H5C__MDCI_ENTRY_IN_LRU_FLAG)
+ if (flags & H5C__MDCI_ENTRY_IN_LRU_FLAG)
in_lru = TRUE;
- if(flags & H5C__MDCI_ENTRY_IS_FD_PARENT_FLAG)
+ if (flags & H5C__MDCI_ENTRY_IS_FD_PARENT_FLAG)
is_fd_parent = TRUE;
- if(flags & H5C__MDCI_ENTRY_IS_FD_CHILD_FLAG)
+ if (flags & H5C__MDCI_ENTRY_IS_FD_CHILD_FLAG)
is_fd_child = TRUE;
/* Decode ring */
@@ -1935,7 +1903,7 @@ H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr,
/* Decode dirty dependency child count */
UINT16DECODE(p, fd_dirty_child_count);
- if(fd_dirty_child_count > fd_child_count)
+ if (fd_dirty_child_count > fd_child_count)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid dirty flush dependency child count")
/* Decode dependency parent count */
@@ -1948,37 +1916,37 @@ H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr,
/* Decode entry offset */
H5F_addr_decode(f, &p, &addr);
- if(!H5F_addr_defined(addr))
+ if (!H5F_addr_defined(addr))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid entry offset")
/* Decode entry length */
H5F_DECODE_LENGTH(f, p, size);
- if(size == 0)
+ if (size == 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid entry size")
/* Verify expected length of entry image */
- if((size_t)(p - *buf) != H5C__cache_image_block_entry_header_size(f))
+ if ((size_t)(p - *buf) != H5C__cache_image_block_entry_header_size(f))
HGOTO_ERROR(H5E_CACHE, H5E_BADSIZE, FAIL, "Bad entry image len")
/* If parent count greater than zero, allocate array for parent
* addresses, and decode addresses into the array.
*/
- if(fd_parent_count > 0) {
- int i; /* Local index variable */
+ if (fd_parent_count > 0) {
+ int i; /* Local index variable */
- if(NULL == (fd_parent_addrs = (haddr_t *)H5MM_malloc((size_t)(fd_parent_count) * H5F_SIZEOF_ADDR(f))))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for fd parent addrs buffer")
+ if (NULL == (fd_parent_addrs = (haddr_t *)H5MM_malloc((size_t)(fd_parent_count)*H5F_SIZEOF_ADDR(f))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for fd parent addrs buffer")
- for(i = 0; i < fd_parent_count; i++) {
+ for (i = 0; i < fd_parent_count; i++) {
H5F_addr_decode(f, &p, &(fd_parent_addrs[i]));
- if(!H5F_addr_defined(fd_parent_addrs[i]))
+ if (!H5F_addr_defined(fd_parent_addrs[i]))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid flush dependency parent offset")
} /* end for */
- } /* end if */
+ } /* end if */
/* Allocate buffer for entry image */
- if(NULL == (image_ptr = H5MM_malloc(size + H5C_IMAGE_EXTRA_SPACE)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer")
+ if (NULL == (image_ptr = H5MM_malloc(size + H5C_IMAGE_EXTRA_SPACE)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
H5MM_memcpy(((uint8_t *)image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
@@ -2010,7 +1978,6 @@ done:
} /* H5C__decode_cache_image_entry() */
#endif /* NDEBUG */
-
/*-------------------------------------------------------------------------
* Function: H5C__destroy_pf_entry_child_flush_deps()
*
@@ -2037,14 +2004,14 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__destroy_pf_entry_child_flush_deps(H5C_t *cache_ptr,
- H5C_cache_entry_t *pf_entry_ptr, H5C_cache_entry_t **fd_children)
+H5C__destroy_pf_entry_child_flush_deps(H5C_t *cache_ptr, H5C_cache_entry_t *pf_entry_ptr,
+ H5C_cache_entry_t **fd_children)
{
- H5C_cache_entry_t * entry_ptr;
- unsigned entries_visited = 0;
- int fd_children_found = 0;
- hbool_t found;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_cache_entry_t *entry_ptr;
+ unsigned entries_visited = 0;
+ int fd_children_found = 0;
+ hbool_t found;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2061,68 +2028,69 @@ H5C__destroy_pf_entry_child_flush_deps(H5C_t *cache_ptr,
/* Scan each entry on the index list */
entry_ptr = cache_ptr->il_head;
- while(entry_ptr != NULL) {
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ while (entry_ptr != NULL) {
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- /* Here we look at entry_ptr->flush_dep_nparents and not
+ /* Here we look at entry_ptr->flush_dep_nparents and not
* entry_ptr->fd_parent_count as it is possible that some
- * or all of the prefetched flush dependency child relationships
- * have already been destroyed.
+ * or all of the prefetched flush dependency child relationships
+ * have already been destroyed.
*/
- if(entry_ptr->prefetched && (entry_ptr->flush_dep_nparents > 0)) {
- unsigned u; /* Local index variable */
+ if (entry_ptr->prefetched && (entry_ptr->flush_dep_nparents > 0)) {
+ unsigned u; /* Local index variable */
/* Re-init */
- u = 0;
- found = FALSE;
+ u = 0;
+ found = FALSE;
/* Sanity checks */
HDassert(entry_ptr->type);
HDassert(entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID);
- HDassert(entry_ptr->fd_parent_count >= entry_ptr->flush_dep_nparents);
- HDassert(entry_ptr->fd_parent_addrs);
- HDassert(entry_ptr->flush_dep_parent);
+ HDassert(entry_ptr->fd_parent_count >= entry_ptr->flush_dep_nparents);
+ HDassert(entry_ptr->fd_parent_addrs);
+ HDassert(entry_ptr->flush_dep_parent);
/* Look for correct entry */
- while(!found && (u < entry_ptr->fd_parent_count)) {
+ while (!found && (u < entry_ptr->fd_parent_count)) {
/* Sanity check entry */
- HDassert(entry_ptr->flush_dep_parent[u]);
- HDassert(entry_ptr->flush_dep_parent[u]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->flush_dep_parent[u]);
+ HDassert(entry_ptr->flush_dep_parent[u]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
/* Correct entry? */
- if(pf_entry_ptr == entry_ptr->flush_dep_parent[u])
- found = TRUE;
+ if (pf_entry_ptr == entry_ptr->flush_dep_parent[u])
+ found = TRUE;
- u++;
+ u++;
} /* end while */
- if(found) {
- HDassert(NULL == fd_children[fd_children_found]);
+ if (found) {
+ HDassert(NULL == fd_children[fd_children_found]);
/* Remove flush dependency */
- fd_children[fd_children_found] = entry_ptr;
- fd_children_found++;
- if(H5C_destroy_flush_dependency(pf_entry_ptr, entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "can't destroy pf entry child flush dependency")
+ fd_children[fd_children_found] = entry_ptr;
+ fd_children_found++;
+ if (H5C_destroy_flush_dependency(pf_entry_ptr, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL,
+ "can't destroy pf entry child flush dependency")
#ifndef NDEBUG
- /* Sanity check -- verify that the address of the parent
+ /* Sanity check -- verify that the address of the parent
* appears in entry_ptr->fd_parent_addrs. Must do a search,
* as with flush dependency creates and destroys,
* entry_ptr->fd_parent_addrs and entry_ptr->flush_dep_parent
* can list parents in different order.
*/
- found = FALSE;
- u = 0;
- while(!found && u < entry_ptr->fd_parent_count) {
- if(pf_entry_ptr->addr == entry_ptr->fd_parent_addrs[u])
- found = TRUE;
- u++;
+ found = FALSE;
+ u = 0;
+ while (!found && u < entry_ptr->fd_parent_count) {
+ if (pf_entry_ptr->addr == entry_ptr->fd_parent_addrs[u])
+ found = TRUE;
+ u++;
} /* end while */
- HDassert(found);
-#endif /* NDEBUG */
- } /* end if */
- } /* end if */
+ HDassert(found);
+#endif /* NDEBUG */
+ } /* end if */
+ } /* end if */
entries_visited++;
entry_ptr = entry_ptr->il_next;
@@ -2138,7 +2106,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__destroy_pf_entry_child_flush_deps() */
-
/*-------------------------------------------------------------------------
* Function: H5C__encode_cache_image_header()
*
@@ -2154,14 +2121,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__encode_cache_image_header(const H5F_t *f, const H5C_t *cache_ptr,
- uint8_t **buf)
+H5C__encode_cache_image_header(const H5F_t *f, const H5C_t *cache_ptr, uint8_t **buf)
{
- size_t actual_header_len;
- size_t expected_header_len;
- uint8_t flags = 0;
- uint8_t * p; /* Pointer into cache image buffer */
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t actual_header_len;
+ size_t expected_header_len;
+ uint8_t flags = 0;
+ uint8_t *p; /* Pointer into cache image buffer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2190,8 +2156,8 @@ H5C__encode_cache_image_header(const H5F_t *f, const H5C_t *cache_ptr,
/* at present we don't support saving resize status */
HDassert(!cache_ptr->image_ctl.save_resize_status);
- if(cache_ptr->image_ctl.save_resize_status)
- flags |= H5C__MDCI_HEADER_HAVE_RESIZE_STATUS;
+ if (cache_ptr->image_ctl.save_resize_status)
+ flags |= H5C__MDCI_HEADER_HAVE_RESIZE_STATUS;
*p++ = flags;
@@ -2204,9 +2170,9 @@ H5C__encode_cache_image_header(const H5F_t *f, const H5C_t *cache_ptr,
UINT32ENCODE(p, cache_ptr->num_entries_in_image);
/* verify expected length of header */
- actual_header_len = (size_t)(p - *buf);
+ actual_header_len = (size_t)(p - *buf);
expected_header_len = H5C__cache_image_block_header_size(f);
- if(actual_header_len != expected_header_len)
+ if (actual_header_len != expected_header_len)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad header image len")
/* Update buffer pointer */
@@ -2216,7 +2182,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__encode_cache_image_header() */
-
/*-------------------------------------------------------------------------
* Function: H5C__encode_cache_image_entry()
*
@@ -2232,14 +2197,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf,
- unsigned entry_num)
+H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf, unsigned entry_num)
{
- H5C_image_entry_t * ie_ptr; /* Pointer to entry to encode */
- uint8_t flags = 0; /* Flags for entry */
- uint8_t * p; /* Pointer into cache image buffer */
- unsigned u; /* Local index value */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_image_entry_t *ie_ptr; /* Pointer to entry to encode */
+ uint8_t flags = 0; /* Flags for entry */
+ uint8_t * p; /* Pointer into cache image buffer */
+ unsigned u; /* Local index value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2262,19 +2226,19 @@ H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf,
p = *buf;
/* Encode type */
- if((ie_ptr->type_id < 0) || (ie_ptr->type_id > 255))
+ if ((ie_ptr->type_id < 0) || (ie_ptr->type_id > 255))
HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "type_id out of range.")
*p++ = (uint8_t)(ie_ptr->type_id);
/* Compose and encode flags */
- if(ie_ptr->is_dirty)
- flags |= H5C__MDCI_ENTRY_DIRTY_FLAG;
- if(ie_ptr->lru_rank > 0)
- flags |= H5C__MDCI_ENTRY_IN_LRU_FLAG;
- if(ie_ptr->fd_child_count > 0)
- flags |= H5C__MDCI_ENTRY_IS_FD_PARENT_FLAG;
- if(ie_ptr->fd_parent_count > 0)
- flags |= H5C__MDCI_ENTRY_IS_FD_CHILD_FLAG;
+ if (ie_ptr->is_dirty)
+ flags |= H5C__MDCI_ENTRY_DIRTY_FLAG;
+ if (ie_ptr->lru_rank > 0)
+ flags |= H5C__MDCI_ENTRY_IN_LRU_FLAG;
+ if (ie_ptr->fd_child_count > 0)
+ flags |= H5C__MDCI_ENTRY_IS_FD_PARENT_FLAG;
+ if (ie_ptr->fd_parent_count > 0)
+ flags |= H5C__MDCI_ENTRY_IS_FD_CHILD_FLAG;
*p++ = flags;
/* Encode ring */
@@ -2284,17 +2248,17 @@ H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf,
*p++ = (uint8_t)(ie_ptr->age);
/* Validate and encode dependency child count */
- if(ie_ptr->fd_child_count > H5C__MDCI_MAX_FD_CHILDREN)
+ if (ie_ptr->fd_child_count > H5C__MDCI_MAX_FD_CHILDREN)
HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "fd_child_count out of range")
UINT16ENCODE(p, (uint16_t)(ie_ptr->fd_child_count));
/* Validate and encode dirty dependency child count */
- if(ie_ptr->fd_dirty_child_count > H5C__MDCI_MAX_FD_CHILDREN)
+ if (ie_ptr->fd_dirty_child_count > H5C__MDCI_MAX_FD_CHILDREN)
HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "fd_dirty_child_count out of range")
UINT16ENCODE(p, (uint16_t)(ie_ptr->fd_dirty_child_count));
/* Validate and encode dependency parent count */
- if(ie_ptr->fd_parent_count > H5C__MDCI_MAX_FD_PARENTS)
+ if (ie_ptr->fd_parent_count > H5C__MDCI_MAX_FD_PARENTS)
HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "fd_parent_count out of range")
UINT16ENCODE(p, (uint16_t)(ie_ptr->fd_parent_count));
@@ -2308,12 +2272,12 @@ H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf,
H5F_ENCODE_LENGTH(f, p, ie_ptr->size);
/* Verify expected length of entry image */
- if((size_t)(p - *buf) != H5C__cache_image_block_entry_header_size(f))
+ if ((size_t)(p - *buf) != H5C__cache_image_block_entry_header_size(f))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad entry image len")
/* Encode dependency parent offsets -- if any */
- for(u = 0; u < ie_ptr->fd_parent_count; u++)
- H5F_addr_encode(f, &p, ie_ptr->fd_parent_addrs[u]);
+ for (u = 0; u < ie_ptr->fd_parent_count; u++)
+ H5F_addr_encode(f, &p, ie_ptr->fd_parent_addrs[u]);
/* Copy entry image */
H5MM_memcpy(p, ie_ptr->image_ptr, ie_ptr->size);
@@ -2326,7 +2290,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__encode_cache_image_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5C__prep_for_file_close__compute_fd_heights
*
@@ -2393,14 +2356,14 @@ done:
static herr_t
H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr)
{
- H5C_cache_entry_t * entry_ptr;
- H5C_cache_entry_t * parent_ptr;
- unsigned entries_removed_from_image = 0;
- unsigned external_parent_fd_refs_removed = 0;
- unsigned external_child_fd_refs_removed = 0;
- hbool_t done = FALSE;
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED;
+ H5C_cache_entry_t *entry_ptr;
+ H5C_cache_entry_t *parent_ptr;
+ unsigned entries_removed_from_image = 0;
+ unsigned external_parent_fd_refs_removed = 0;
+ unsigned external_child_fd_refs_removed = 0;
+ hbool_t done = FALSE;
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -2416,36 +2379,35 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr)
* multiple passes through the index list.
*/
done = FALSE;
- while(!done) {
- done = TRUE;
- entry_ptr = cache_ptr->il_head;
- while(entry_ptr != NULL) {
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ while (!done) {
+ done = TRUE;
+ entry_ptr = cache_ptr->il_head;
+ while (entry_ptr != NULL) {
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
/* Should this entry be in the image */
- if(entry_ptr->image_dirty && entry_ptr->include_in_image &&
- (entry_ptr->fd_parent_count > 0)) {
- HDassert(entry_ptr->flush_dep_parent != NULL);
- for(u = 0; u < entry_ptr->flush_dep_nparents; u++ ) {
- parent_ptr = entry_ptr->flush_dep_parent[u];
+ if (entry_ptr->image_dirty && entry_ptr->include_in_image && (entry_ptr->fd_parent_count > 0)) {
+ HDassert(entry_ptr->flush_dep_parent != NULL);
+ for (u = 0; u < entry_ptr->flush_dep_nparents; u++) {
+ parent_ptr = entry_ptr->flush_dep_parent[u];
/* Sanity check parent */
- HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->ring == parent_ptr->ring);
+ HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->ring == parent_ptr->ring);
- if(parent_ptr->is_dirty && !parent_ptr->include_in_image &&
- entry_ptr->include_in_image) {
+ if (parent_ptr->is_dirty && !parent_ptr->include_in_image &&
+ entry_ptr->include_in_image) {
- /* Must remove child from image -- only do this once */
- entries_removed_from_image++;
- entry_ptr->include_in_image = FALSE;
- } /* end if */
- } /* for */
- } /* end if */
+ /* Must remove child from image -- only do this once */
+ entries_removed_from_image++;
+ entry_ptr->include_in_image = FALSE;
+ } /* end if */
+ } /* for */
+ } /* end if */
- entry_ptr = entry_ptr->il_next;
+ entry_ptr = entry_ptr->il_next;
} /* while ( entry_ptr != NULL ) */
- } /* while ( ! done ) */
+ } /* while ( ! done ) */
/* at present, entries are included in the cache image if they reside
* in a specified set of rings. Thus it should be impossible for
@@ -2459,79 +2421,81 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr)
* flush dependency parents or children that are not in the cache image.
*/
entry_ptr = cache_ptr->il_head;
- while(entry_ptr != NULL) {
- if(!entry_ptr->include_in_image && entry_ptr->flush_dep_nparents > 0) {
- HDassert(entry_ptr->flush_dep_parent != NULL);
+ while (entry_ptr != NULL) {
+ if (!entry_ptr->include_in_image && entry_ptr->flush_dep_nparents > 0) {
+ HDassert(entry_ptr->flush_dep_parent != NULL);
- for(u = 0; u < entry_ptr->flush_dep_nparents; u++ ) {
- parent_ptr = entry_ptr->flush_dep_parent[u];
+ for (u = 0; u < entry_ptr->flush_dep_nparents; u++) {
+ parent_ptr = entry_ptr->flush_dep_parent[u];
/* Sanity check parent */
- HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->ring == parent_ptr->ring);
-
- if(parent_ptr->include_in_image) {
- /* Must remove reference to child */
- HDassert(parent_ptr->fd_child_count > 0);
- parent_ptr->fd_child_count--;
-
- if(entry_ptr->is_dirty) {
- HDassert(parent_ptr->fd_dirty_child_count > 0);
- parent_ptr->fd_dirty_child_count--;
- } /* end if */
-
- external_child_fd_refs_removed++;
- } /* end if */
- } /* for */
- } /* end if */
- else if(entry_ptr->include_in_image && entry_ptr->flush_dep_nparents > 0) {
+ HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->ring == parent_ptr->ring);
+
+ if (parent_ptr->include_in_image) {
+ /* Must remove reference to child */
+ HDassert(parent_ptr->fd_child_count > 0);
+ parent_ptr->fd_child_count--;
+
+ if (entry_ptr->is_dirty) {
+ HDassert(parent_ptr->fd_dirty_child_count > 0);
+ parent_ptr->fd_dirty_child_count--;
+ } /* end if */
+
+ external_child_fd_refs_removed++;
+ } /* end if */
+ } /* for */
+ } /* end if */
+ else if (entry_ptr->include_in_image && entry_ptr->flush_dep_nparents > 0) {
/* Sanity checks */
- HDassert(entry_ptr->flush_dep_parent != NULL);
- HDassert(entry_ptr->flush_dep_nparents == entry_ptr->fd_parent_count);
- HDassert(entry_ptr->fd_parent_addrs);
+ HDassert(entry_ptr->flush_dep_parent != NULL);
+ HDassert(entry_ptr->flush_dep_nparents == entry_ptr->fd_parent_count);
+ HDassert(entry_ptr->fd_parent_addrs);
- for(u = 0; u < entry_ptr->flush_dep_nparents; u++ ) {
- parent_ptr = entry_ptr->flush_dep_parent[u];
+ for (u = 0; u < entry_ptr->flush_dep_nparents; u++) {
+ parent_ptr = entry_ptr->flush_dep_parent[u];
/* Sanity check parent */
- HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->ring == parent_ptr->ring);
-
- if(!parent_ptr->include_in_image) {
- /* Must remove reference to parent */
- HDassert(entry_ptr->fd_parent_count > 0);
- parent_ptr->fd_child_count--;
-
- HDassert(parent_ptr->addr == entry_ptr->fd_parent_addrs[u]);
-
- entry_ptr->fd_parent_addrs[u] = HADDR_UNDEF;
- external_parent_fd_refs_removed++;
- } /* end if */
- } /* for */
-
- /* Touch up fd_parent_addrs array if necessary */
- if(entry_ptr->fd_parent_count == 0) {
- H5MM_xfree(entry_ptr->fd_parent_addrs);
- entry_ptr->fd_parent_addrs = NULL;
- } /* end if */
- else if(entry_ptr->flush_dep_nparents > entry_ptr->fd_parent_count) {
- haddr_t * old_fd_parent_addrs = entry_ptr->fd_parent_addrs;
+ HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->ring == parent_ptr->ring);
+
+ if (!parent_ptr->include_in_image) {
+ /* Must remove reference to parent */
+ HDassert(entry_ptr->fd_parent_count > 0);
+ parent_ptr->fd_child_count--;
+
+ HDassert(parent_ptr->addr == entry_ptr->fd_parent_addrs[u]);
+
+ entry_ptr->fd_parent_addrs[u] = HADDR_UNDEF;
+ external_parent_fd_refs_removed++;
+ } /* end if */
+ } /* for */
+
+ /* Touch up fd_parent_addrs array if necessary */
+ if (entry_ptr->fd_parent_count == 0) {
+ H5MM_xfree(entry_ptr->fd_parent_addrs);
+ entry_ptr->fd_parent_addrs = NULL;
+ } /* end if */
+ else if (entry_ptr->flush_dep_nparents > entry_ptr->fd_parent_count) {
+ haddr_t *old_fd_parent_addrs = entry_ptr->fd_parent_addrs;
unsigned v;
- if(NULL == (entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_calloc(sizeof(haddr_t) * (size_t)(entry_ptr->fd_parent_addrs))))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for fd parent addr array")
+ if (NULL == (entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_calloc(
+ sizeof(haddr_t) * (size_t)(entry_ptr->fd_parent_addrs))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for fd parent addr array")
- v = 0;
- for(u = 0; u < entry_ptr->flush_dep_nparents; u++) {
- if(old_fd_parent_addrs[u] != HADDR_UNDEF) {
- entry_ptr->fd_parent_addrs[v] = old_fd_parent_addrs[u];
- v++;
- } /* end if */
- } /* end for */
+ v = 0;
+ for (u = 0; u < entry_ptr->flush_dep_nparents; u++) {
+ if (old_fd_parent_addrs[u] != HADDR_UNDEF) {
+ entry_ptr->fd_parent_addrs[v] = old_fd_parent_addrs[u];
+ v++;
+ } /* end if */
+ } /* end for */
- HDassert(v == entry_ptr->fd_parent_count);
- } /* end else-if */
- } /* end else-if */
+ HDassert(v == entry_ptr->fd_parent_count);
+ } /* end else-if */
+ } /* end else-if */
entry_ptr = entry_ptr->il_next;
} /* while (entry_ptr != NULL) */
@@ -2554,17 +2518,16 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr)
* for all entries that may appear in the cache image.
*/
entry_ptr = cache_ptr->il_head;
- while(entry_ptr != NULL) {
- if(entry_ptr->include_in_image && entry_ptr->fd_child_count == 0 &&
- entry_ptr->fd_parent_count > 0) {
- for(u = 0; u < entry_ptr->fd_parent_count; u++) {
- parent_ptr = entry_ptr->flush_dep_parent[u];
-
- HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- if(parent_ptr->include_in_image && parent_ptr->image_fd_height <= 0)
- H5C__prep_for_file_close__compute_fd_heights_real(parent_ptr, 1);
- } /* end for */
- } /* end if */
+ while (entry_ptr != NULL) {
+ if (entry_ptr->include_in_image && entry_ptr->fd_child_count == 0 && entry_ptr->fd_parent_count > 0) {
+ for (u = 0; u < entry_ptr->fd_parent_count; u++) {
+ parent_ptr = entry_ptr->flush_dep_parent[u];
+
+ HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ if (parent_ptr->include_in_image && parent_ptr->image_fd_height <= 0)
+ H5C__prep_for_file_close__compute_fd_heights_real(parent_ptr, 1);
+ } /* end for */
+ } /* end if */
entry_ptr = entry_ptr->il_next;
} /* while (entry_ptr != NULL) */
@@ -2573,7 +2536,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__prep_for_file_close__compute_fd_heights() */
-
/*-------------------------------------------------------------------------
* Function: H5C__prep_for_file_close__compute_fd_heights_real
*
@@ -2623,8 +2585,7 @@ done:
*-------------------------------------------------------------------------
*/
static void
-H5C__prep_for_file_close__compute_fd_heights_real(H5C_cache_entry_t *entry_ptr,
- uint32_t fd_height)
+H5C__prep_for_file_close__compute_fd_heights_real(H5C_cache_entry_t *entry_ptr, uint32_t fd_height)
{
FUNC_ENTER_STATIC_NOERR
@@ -2633,28 +2594,28 @@ H5C__prep_for_file_close__compute_fd_heights_real(H5C_cache_entry_t *entry_ptr,
HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(entry_ptr->include_in_image);
HDassert((entry_ptr->image_fd_height == 0) || (entry_ptr->image_fd_height < fd_height));
- HDassert(((fd_height == 0) && (entry_ptr->fd_child_count == 0)) || ((fd_height > 0) && (entry_ptr->fd_child_count > 0)));
+ HDassert(((fd_height == 0) && (entry_ptr->fd_child_count == 0)) ||
+ ((fd_height > 0) && (entry_ptr->fd_child_count > 0)));
entry_ptr->image_fd_height = fd_height;
- if(entry_ptr->flush_dep_nparents > 0) {
+ if (entry_ptr->flush_dep_nparents > 0) {
unsigned u;
- HDassert(entry_ptr->flush_dep_parent);
- for(u = 0; u < entry_ptr->fd_parent_count; u++) {
+ HDassert(entry_ptr->flush_dep_parent);
+ for (u = 0; u < entry_ptr->fd_parent_count; u++) {
H5C_cache_entry_t *parent_ptr;
- parent_ptr = entry_ptr->flush_dep_parent[u];
- HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ parent_ptr = entry_ptr->flush_dep_parent[u];
+ HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- if(parent_ptr->include_in_image && parent_ptr->image_fd_height <= fd_height)
- H5C__prep_for_file_close__compute_fd_heights_real(parent_ptr, fd_height + 1);
+ if (parent_ptr->include_in_image && parent_ptr->image_fd_height <= fd_height)
+ H5C__prep_for_file_close__compute_fd_heights_real(parent_ptr, fd_height + 1);
} /* end for */
- } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI_VOID
} /* H5C__prep_for_file_close__compute_fd_heights_real() */
-
/*-------------------------------------------------------------------------
* Function: H5C__prep_for_file_close__setup_image_entries_array
*
@@ -2672,11 +2633,11 @@ H5C__prep_for_file_close__compute_fd_heights_real(H5C_cache_entry_t *entry_ptr,
static herr_t
H5C__prep_for_file_close__setup_image_entries_array(H5C_t *cache_ptr)
{
- H5C_cache_entry_t * entry_ptr;
- H5C_image_entry_t * image_entries = NULL;
- uint32_t entries_visited = 0;
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_cache_entry_t *entry_ptr;
+ H5C_image_entry_t *image_entries = NULL;
+ uint32_t entries_visited = 0;
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2689,73 +2650,73 @@ H5C__prep_for_file_close__setup_image_entries_array(H5C_t *cache_ptr)
HDassert(cache_ptr->image_entries == NULL);
/* Allocate and initialize image_entries array */
- if(NULL == (image_entries = (H5C_image_entry_t *)H5MM_calloc(sizeof(H5C_image_entry_t) * (size_t)(cache_ptr->num_entries_in_image + 1))))
+ if (NULL == (image_entries = (H5C_image_entry_t *)H5MM_calloc(
+ sizeof(H5C_image_entry_t) * (size_t)(cache_ptr->num_entries_in_image + 1))))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for image_entries")
/* Initialize (non-zero/NULL/FALSE) fields */
- for(u = 0; u <= cache_ptr->num_entries_in_image; u++) {
- image_entries[u].magic = H5C_IMAGE_ENTRY_T_MAGIC;
- image_entries[u].addr = HADDR_UNDEF;
- image_entries[u].ring = H5C_RING_UNDEFINED;
- image_entries[u].type_id = -1;
+ for (u = 0; u <= cache_ptr->num_entries_in_image; u++) {
+ image_entries[u].magic = H5C_IMAGE_ENTRY_T_MAGIC;
+ image_entries[u].addr = HADDR_UNDEF;
+ image_entries[u].ring = H5C_RING_UNDEFINED;
+ image_entries[u].type_id = -1;
} /* end for */
/* Scan each entry on the index list and populate the image_entries array */
- u = 0;
+ u = 0;
entry_ptr = cache_ptr->il_head;
- while(entry_ptr != NULL) {
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ while (entry_ptr != NULL) {
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- if(entry_ptr->include_in_image) {
- /* Since we have already serialized the cache, the following
+ if (entry_ptr->include_in_image) {
+ /* Since we have already serialized the cache, the following
* should hold.
*/
HDassert(entry_ptr->image_up_to_date);
HDassert(entry_ptr->image_ptr);
- HDassert(entry_ptr->type);
+ HDassert(entry_ptr->type);
- image_entries[u].addr = entry_ptr->addr;
- image_entries[u].size = entry_ptr->size;
- image_entries[u].ring = entry_ptr->ring;
+ image_entries[u].addr = entry_ptr->addr;
+ image_entries[u].size = entry_ptr->size;
+ image_entries[u].ring = entry_ptr->ring;
- /* When a prefetched entry is included in the image, store
+ /* When a prefetched entry is included in the image, store
* its underlying type id in the image entry, not
* H5AC_PREFETCHED_ENTRY_ID. In passing, also increment
- * the age (up to H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX).
+ * the age (up to H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX).
*/
- if(entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID) {
- image_entries[u].type_id = entry_ptr->prefetch_type_id;
- image_entries[u].age = entry_ptr->age + 1;
+ if (entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID) {
+ image_entries[u].type_id = entry_ptr->prefetch_type_id;
+ image_entries[u].age = entry_ptr->age + 1;
- if(image_entries[u].age > H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX)
- image_entries[u].age = H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX;
- } /* end if */
+ if (image_entries[u].age > H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX)
+ image_entries[u].age = H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX;
+ } /* end if */
else {
- image_entries[u].type_id = entry_ptr->type->id;
- image_entries[u].age = 0;
- } /* end else */
-
- image_entries[u].lru_rank = entry_ptr->lru_rank;
- image_entries[u].is_dirty = entry_ptr->is_dirty;
- image_entries[u].image_fd_height = entry_ptr->image_fd_height;
- image_entries[u].fd_parent_count = entry_ptr->fd_parent_count;
- image_entries[u].fd_parent_addrs = entry_ptr->fd_parent_addrs;
- image_entries[u].fd_child_count = entry_ptr->fd_child_count;
- image_entries[u].fd_dirty_child_count =
- entry_ptr->fd_dirty_child_count;
- image_entries[u].image_ptr = entry_ptr->image_ptr;
-
- /* Null out entry_ptr->fd_parent_addrs and set
+ image_entries[u].type_id = entry_ptr->type->id;
+ image_entries[u].age = 0;
+ } /* end else */
+
+ image_entries[u].lru_rank = entry_ptr->lru_rank;
+ image_entries[u].is_dirty = entry_ptr->is_dirty;
+ image_entries[u].image_fd_height = entry_ptr->image_fd_height;
+ image_entries[u].fd_parent_count = entry_ptr->fd_parent_count;
+ image_entries[u].fd_parent_addrs = entry_ptr->fd_parent_addrs;
+ image_entries[u].fd_child_count = entry_ptr->fd_child_count;
+ image_entries[u].fd_dirty_child_count = entry_ptr->fd_dirty_child_count;
+ image_entries[u].image_ptr = entry_ptr->image_ptr;
+
+ /* Null out entry_ptr->fd_parent_addrs and set
* entry_ptr->fd_parent_count to zero so that ownership of the
* flush dependency parents address array is transferred to the
- * image entry.
+ * image entry.
*/
- entry_ptr->fd_parent_count = 0;
- entry_ptr->fd_parent_addrs = NULL;
+ entry_ptr->fd_parent_count = 0;
+ entry_ptr->fd_parent_addrs = NULL;
u++;
- HDassert(u <= cache_ptr->num_entries_in_image);
+ HDassert(u <= cache_ptr->num_entries_in_image);
} /* end if */
entries_visited++;
@@ -2776,7 +2737,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__prep_for_file_close__setup_image_entries_array() */
-
/*-------------------------------------------------------------------------
* Function: H5C__prep_for_file_close__scan_entries
*
@@ -2810,18 +2770,18 @@ done:
static herr_t
H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr)
{
- H5C_cache_entry_t * entry_ptr;
- hbool_t include_in_image;
- unsigned entries_visited = 0;
- int lru_rank = 1;
- uint32_t num_entries_tentatively_in_image = 0;
- uint32_t num_entries_in_image = 0;
- size_t image_len;
- size_t entry_header_len;
- size_t fd_parents_list_len;
- int i;
- unsigned j;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_cache_entry_t *entry_ptr;
+ hbool_t include_in_image;
+ unsigned entries_visited = 0;
+ int lru_rank = 1;
+ uint32_t num_entries_tentatively_in_image = 0;
+ uint32_t num_entries_in_image = 0;
+ size_t image_len;
+ size_t entry_header_len;
+ size_t fd_parents_list_len;
+ int i;
+ unsigned j;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2842,85 +2802,87 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr)
/* Scan each entry on the index list */
entry_ptr = cache_ptr->il_head;
- while(entry_ptr != NULL) {
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ while (entry_ptr != NULL) {
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- /* Since we have already serialized the cache, the following
+ /* Since we have already serialized the cache, the following
* should hold.
*/
HDassert(entry_ptr->image_up_to_date);
HDassert(entry_ptr->image_ptr);
- /* Initially, we mark all entries in the rings included
+ /* Initially, we mark all entries in the rings included
* in the cache image as being included in the in the
* image. Depending on circumstances, we may exclude some
* of these entries later.
*/
- if(entry_ptr->ring > H5C_MAX_RING_IN_IMAGE)
- include_in_image = FALSE;
+ if (entry_ptr->ring > H5C_MAX_RING_IN_IMAGE)
+ include_in_image = FALSE;
else
- include_in_image = TRUE;
+ include_in_image = TRUE;
entry_ptr->include_in_image = include_in_image;
- if(include_in_image) {
- entry_ptr->lru_rank = -1;
- entry_ptr->image_dirty = entry_ptr->is_dirty;
- entry_ptr->image_fd_height = 0; /* will compute this later */
+ if (include_in_image) {
+ entry_ptr->lru_rank = -1;
+ entry_ptr->image_dirty = entry_ptr->is_dirty;
+ entry_ptr->image_fd_height = 0; /* will compute this later */
- /* Initially, include all flush dependency parents in the
+ /* Initially, include all flush dependency parents in the
* the list of flush dependencies to be stored in the
* image. We may remove some or all of these later.
*/
- if(entry_ptr->flush_dep_nparents > 0) {
- /* The parents addresses array may already exist -- reallocate
+ if (entry_ptr->flush_dep_nparents > 0) {
+ /* The parents addresses array may already exist -- reallocate
* as needed.
*/
- if(entry_ptr->flush_dep_nparents == entry_ptr->fd_parent_count ) {
- /* parent addresses array should already be allocated
+ if (entry_ptr->flush_dep_nparents == entry_ptr->fd_parent_count) {
+ /* parent addresses array should already be allocated
* and of the correct size.
*/
- HDassert(entry_ptr->fd_parent_addrs);
- } /* end if */
- else if(entry_ptr->fd_parent_count > 0) {
- HDassert(entry_ptr->fd_parent_addrs);
+ HDassert(entry_ptr->fd_parent_addrs);
+ } /* end if */
+ else if (entry_ptr->fd_parent_count > 0) {
+ HDassert(entry_ptr->fd_parent_addrs);
entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_xfree(entry_ptr->fd_parent_addrs);
- } /* end else-if */
+ } /* end else-if */
else {
- HDassert(entry_ptr->fd_parent_count == 0);
- HDassert(entry_ptr->fd_parent_addrs == NULL);
- } /* end else */
-
- entry_ptr->fd_parent_count = entry_ptr->flush_dep_nparents;
- if(NULL == entry_ptr->fd_parent_addrs)
- if(NULL == (entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_malloc(sizeof(haddr_t) * (size_t)(entry_ptr->fd_parent_count))))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for fd parent addrs buffer")
-
- for(i = 0; i < (int)(entry_ptr->fd_parent_count); i++) {
- entry_ptr->fd_parent_addrs[i] = entry_ptr->flush_dep_parent[i]->addr;
- HDassert(H5F_addr_defined(entry_ptr->fd_parent_addrs[i]));
- } /* end for */
- } /* end if */
- else if(entry_ptr->fd_parent_count > 0) {
- HDassert(entry_ptr->fd_parent_addrs);
- entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_xfree(entry_ptr->fd_parent_addrs);
- } /* end else-if */
+ HDassert(entry_ptr->fd_parent_count == 0);
+ HDassert(entry_ptr->fd_parent_addrs == NULL);
+ } /* end else */
+
+ entry_ptr->fd_parent_count = entry_ptr->flush_dep_nparents;
+ if (NULL == entry_ptr->fd_parent_addrs)
+ if (NULL == (entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_malloc(
+ sizeof(haddr_t) * (size_t)(entry_ptr->fd_parent_count))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for fd parent addrs buffer")
+
+ for (i = 0; i < (int)(entry_ptr->fd_parent_count); i++) {
+ entry_ptr->fd_parent_addrs[i] = entry_ptr->flush_dep_parent[i]->addr;
+ HDassert(H5F_addr_defined(entry_ptr->fd_parent_addrs[i]));
+ } /* end for */
+ } /* end if */
+ else if (entry_ptr->fd_parent_count > 0) {
+ HDassert(entry_ptr->fd_parent_addrs);
+ entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_xfree(entry_ptr->fd_parent_addrs);
+ } /* end else-if */
else
- HDassert(entry_ptr->fd_parent_addrs == NULL);
+ HDassert(entry_ptr->fd_parent_addrs == NULL);
- /* Initially, all flush dependency children are included int
+ /* Initially, all flush dependency children are included int
* the count of flush dependency child relationships to be
* represented in the cache image. Some or all of these
* may be dropped from the image later.
*/
- if(entry_ptr->flush_dep_nchildren > 0) {
- if(!entry_ptr->is_pinned)
+ if (entry_ptr->flush_dep_nchildren > 0) {
+ if (!entry_ptr->is_pinned)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "encountered unpinned fd parent?!?")
- entry_ptr->fd_child_count = entry_ptr->flush_dep_nchildren;
- entry_ptr->fd_dirty_child_count = entry_ptr->flush_dep_ndirty_children;
- } /* end if */
+ entry_ptr->fd_child_count = entry_ptr->flush_dep_nchildren;
+ entry_ptr->fd_dirty_child_count = entry_ptr->flush_dep_ndirty_children;
+ } /* end if */
- num_entries_tentatively_in_image++;
+ num_entries_tentatively_in_image++;
} /* end if */
entries_visited++;
@@ -2951,7 +2913,7 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr)
* exact contents of the image cannot be known until after this
* call, computation of the image size is delayed.
*/
- if(H5C__prep_for_file_close__compute_fd_heights(cache_ptr) < 0)
+ if (H5C__prep_for_file_close__compute_fd_heights(cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "computation of flush dependency heights failed?!?")
/* At this point, all entries that will appear in the cache
@@ -2959,12 +2921,12 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr)
* cache image.
*/
entries_visited = 0;
- entry_ptr = cache_ptr->il_head;
- while(entry_ptr != NULL) {
+ entry_ptr = cache_ptr->il_head;
+ while (entry_ptr != NULL) {
HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- if(entry_ptr->include_in_image) {
- if(entry_ptr->fd_parent_count > 0)
+ if (entry_ptr->include_in_image) {
+ if (entry_ptr->fd_parent_count > 0)
fd_parents_list_len = (size_t)(H5F_SIZEOF_ADDR(f) * entry_ptr->fd_parent_count);
else
fd_parents_list_len = (size_t)0;
@@ -2980,14 +2942,14 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr)
HDassert(num_entries_in_image <= num_entries_tentatively_in_image);
j = 0;
- for(i = H5C_MAX_RING_IN_IMAGE + 1; i <= H5C_RING_SB; i++)
+ for (i = H5C_MAX_RING_IN_IMAGE + 1; i <= H5C_RING_SB; i++)
j += cache_ptr->index_ring_len[i];
/* This will change */
HDassert(entries_visited == (num_entries_tentatively_in_image + j));
cache_ptr->num_entries_in_image = num_entries_in_image;
- entries_visited = 0;
+ entries_visited = 0;
/* Now scan the LRU list to set the lru_rank fields of all entries
* on the LRU.
@@ -3000,8 +2962,8 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr)
* the reconstructed LRU should be appropriate.
*/
entry_ptr = cache_ptr->LRU_head_ptr;
- while(entry_ptr != NULL) {
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ while (entry_ptr != NULL) {
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(entry_ptr->type != NULL);
/* to avoid confusion, don't set lru_rank on epoch markers.
@@ -3013,10 +2975,10 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr)
* Do not set lru_rank or increment lru_rank for entries
* that will not be included in the cache image.
*/
- if(entry_ptr->type->id == H5AC_EPOCH_MARKER_ID)
- lru_rank++;
- else if(entry_ptr->include_in_image) {
- entry_ptr->lru_rank = lru_rank;
+ if (entry_ptr->type->id == H5AC_EPOCH_MARKER_ID)
+ lru_rank++;
+ else if (entry_ptr->include_in_image) {
+ entry_ptr->lru_rank = lru_rank;
lru_rank++;
} /* end else-if */
@@ -3032,7 +2994,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__prep_for_file_close__scan_entries() */
-
/*-------------------------------------------------------------------------
* Function: H5C__reconstruct_cache_contents()
*
@@ -3052,11 +3013,11 @@ done:
static herr_t
H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr)
{
- H5C_cache_entry_t * pf_entry_ptr; /* Pointer to prefetched entry */
- H5C_cache_entry_t * parent_ptr; /* Pointer to parent of prefetched entry */
- const uint8_t * p; /* Pointer into image buffer */
- unsigned u, v; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_cache_entry_t *pf_entry_ptr; /* Pointer to prefetched entry */
+ H5C_cache_entry_t *parent_ptr; /* Pointer to parent of prefetched entry */
+ const uint8_t * p; /* Pointer into image buffer */
+ unsigned u, v; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -3071,7 +3032,7 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr)
/* Decode metadata cache image header */
p = (uint8_t *)cache_ptr->image_buffer;
- if(H5C__decode_cache_image_header(f, cache_ptr, &p) < 0)
+ if (H5C__decode_cache_image_header(f, cache_ptr, &p) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTDECODE, FAIL, "cache image header decode failed")
HDassert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) < cache_ptr->image_len);
@@ -3081,14 +3042,14 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr)
HDassert(cache_ptr->num_entries_in_image > 0);
/* Reconstruct entries in image */
- for(u = 0; u < cache_ptr->num_entries_in_image; u++) {
- /* Create the prefetched entry described by the ith
+ for (u = 0; u < cache_ptr->num_entries_in_image; u++) {
+ /* Create the prefetched entry described by the ith
* entry in cache_ptr->image_entrise.
*/
- if(NULL == (pf_entry_ptr = H5C__reconstruct_cache_entry(f, cache_ptr, &p)))
+ if (NULL == (pf_entry_ptr = H5C__reconstruct_cache_entry(f, cache_ptr, &p)))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "reconstruction of cache entry failed")
- /* Note that we make no checks on available cache space before
+ /* Note that we make no checks on available cache space before
* inserting the reconstructed entry into the metadata cache.
*
* This is OK since the cache must be almost empty at the beginning
@@ -3096,66 +3057,66 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr)
* reconstruction process.
*/
- /* Insert the prefetched entry in the index */
- H5C__INSERT_IN_INDEX(cache_ptr, pf_entry_ptr, FAIL)
+ /* Insert the prefetched entry in the index */
+ H5C__INSERT_IN_INDEX(cache_ptr, pf_entry_ptr, FAIL)
- /* If dirty, insert the entry into the slist. */
- if(pf_entry_ptr->is_dirty)
- H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, pf_entry_ptr, FAIL)
+ /* If dirty, insert the entry into the slist. */
+ if (pf_entry_ptr->is_dirty)
+ H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, pf_entry_ptr, FAIL)
/* Append the entry to the LRU */
- H5C__UPDATE_RP_FOR_INSERT_APPEND(cache_ptr, pf_entry_ptr, FAIL)
+ H5C__UPDATE_RP_FOR_INSERT_APPEND(cache_ptr, pf_entry_ptr, FAIL)
- H5C__UPDATE_STATS_FOR_PREFETCH(cache_ptr, pf_entry_ptr->is_dirty)
+ H5C__UPDATE_STATS_FOR_PREFETCH(cache_ptr, pf_entry_ptr->is_dirty)
- /* If the prefetched entry is the child in one or more flush
+ /* If the prefetched entry is the child in one or more flush
* dependency relationships, recreate those flush dependencies.
*/
- for(v = 0; v < pf_entry_ptr->fd_parent_count; v++) {
+ for (v = 0; v < pf_entry_ptr->fd_parent_count; v++) {
/* Sanity checks */
- HDassert(pf_entry_ptr->fd_parent_addrs);
- HDassert(H5F_addr_defined(pf_entry_ptr->fd_parent_addrs[v]));
+ HDassert(pf_entry_ptr->fd_parent_addrs);
+ HDassert(H5F_addr_defined(pf_entry_ptr->fd_parent_addrs[v]));
/* Find the parent entry */
- parent_ptr = NULL;
- H5C__SEARCH_INDEX(cache_ptr, pf_entry_ptr->fd_parent_addrs[v], parent_ptr, FAIL)
- if(parent_ptr == NULL)
+ parent_ptr = NULL;
+ H5C__SEARCH_INDEX(cache_ptr, pf_entry_ptr->fd_parent_addrs[v], parent_ptr, FAIL)
+ if (parent_ptr == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "fd parent not in cache?!?")
/* Sanity checks */
- HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(parent_ptr->addr == pf_entry_ptr->fd_parent_addrs[v]);
HDassert(parent_ptr->lru_rank == -1);
- /* Must protect parent entry to set up a flush dependency.
+ /* Must protect parent entry to set up a flush dependency.
* Do this now, and then uprotect when done.
*/
H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, parent_ptr, FAIL)
parent_ptr->is_protected = TRUE;
- /* Setup the flush dependency */
- if(H5C_create_flush_dependency(parent_ptr, pf_entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Can't restore flush dependency")
+ /* Setup the flush dependency */
+ if (H5C_create_flush_dependency(parent_ptr, pf_entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Can't restore flush dependency")
- /* And now unprotect */
- H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, parent_ptr, FAIL)
- parent_ptr->is_protected = FALSE;
+ /* And now unprotect */
+ H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, parent_ptr, FAIL)
+ parent_ptr->is_protected = FALSE;
} /* end for */
- } /* end for */
+ } /* end for */
#ifndef NDEBUG
/* Scan the cache entries, and verify that each entry has
* the expected flush dependency status.
*/
pf_entry_ptr = cache_ptr->il_head;
- while(pf_entry_ptr != NULL) {
+ while (pf_entry_ptr != NULL) {
HDassert(pf_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert((pf_entry_ptr->prefetched && pf_entry_ptr->type == H5AC_PREFETCHED_ENTRY)
- || (!pf_entry_ptr->prefetched && pf_entry_ptr->type != H5AC_PREFETCHED_ENTRY));
- if(pf_entry_ptr->type == H5AC_PREFETCHED_ENTRY)
+ HDassert((pf_entry_ptr->prefetched && pf_entry_ptr->type == H5AC_PREFETCHED_ENTRY) ||
+ (!pf_entry_ptr->prefetched && pf_entry_ptr->type != H5AC_PREFETCHED_ENTRY));
+ if (pf_entry_ptr->type == H5AC_PREFETCHED_ENTRY)
HDassert(pf_entry_ptr->fd_parent_count == pf_entry_ptr->flush_dep_nparents);
- for(v = 0; v < pf_entry_ptr->fd_parent_count; v++) {
+ for (v = 0; v < pf_entry_ptr->fd_parent_count; v++) {
parent_ptr = pf_entry_ptr->flush_dep_parent[v];
HDassert(parent_ptr);
HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
@@ -3164,7 +3125,7 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr)
HDassert(parent_ptr->flush_dep_nchildren > 0);
} /* end for */
- if(pf_entry_ptr->type == H5AC_PREFETCHED_ENTRY) {
+ if (pf_entry_ptr->type == H5AC_PREFETCHED_ENTRY) {
HDassert(pf_entry_ptr->fd_child_count == pf_entry_ptr->flush_dep_nchildren);
HDassert(pf_entry_ptr->fd_dirty_child_count == pf_entry_ptr->flush_dep_ndirty_children);
} /* end if */
@@ -3176,26 +3137,24 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr)
* prefetched entries.
*/
{
- int lru_rank_holes = 0;
+ int lru_rank_holes = 0;
H5C_cache_entry_t *entry_ptr;
- int i; /* Local index variable */
+ int i; /* Local index variable */
- i = -1;
+ i = -1;
entry_ptr = cache_ptr->LRU_head_ptr;
- while(entry_ptr != NULL) {
+ while (entry_ptr != NULL) {
HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(entry_ptr->type != NULL);
- if ( entry_ptr->prefetched ) {
+ if (entry_ptr->prefetched) {
HDassert(entry_ptr->lru_rank != 0);
- HDassert((entry_ptr->lru_rank == -1) ||
- (entry_ptr->lru_rank > i));
+ HDassert((entry_ptr->lru_rank == -1) || (entry_ptr->lru_rank > i));
- if ( ( entry_ptr->lru_rank > 1 ) &&
- ( entry_ptr->lru_rank > i + 1 ) )
+ if ((entry_ptr->lru_rank > 1) && (entry_ptr->lru_rank > i + 1))
lru_rank_holes += entry_ptr->lru_rank - (i + 1);
@@ -3206,41 +3165,40 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr)
entry_ptr = entry_ptr->next;
} /* end while */
- /* Holes in the sequences of LRU ranks can appear due to epoch
+ /* Holes in the sequences of LRU ranks can appear due to epoch
* markers. They are left in to allow re-insertion of the
* epoch markers on reconstruction of the cache -- thus
* the following sanity check will have to be revised when
* we add code to store and restore adaptive resize status.
*/
- HDassert(lru_rank_holes <= H5C__MAX_EPOCH_MARKERS);
- } /* end block */
+ HDassert(lru_rank_holes <= H5C__MAX_EPOCH_MARKERS);
+ } /* end block */
#endif /* NDEBUG */
/* Check to see if the cache is oversize, and evict entries as
* necessary to remain within limits.
*/
- if(cache_ptr->index_size >= cache_ptr->max_cache_size) {
- /* cache is oversized -- call H5C__make_space_in_cache() with zero
+ if (cache_ptr->index_size >= cache_ptr->max_cache_size) {
+ /* cache is oversized -- call H5C__make_space_in_cache() with zero
* space needed to repair the situation if possible.
*/
hbool_t write_permitted = FALSE;
- if(cache_ptr->check_write_permitted != NULL) {
- if((cache_ptr->check_write_permitted)(f, &write_permitted) < 0)
+ if (cache_ptr->check_write_permitted != NULL) {
+ if ((cache_ptr->check_write_permitted)(f, &write_permitted) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "Can't get write_permitted")
} /* end if */
else
write_permitted = cache_ptr->write_permitted;
- if(H5C__make_space_in_cache(f, 0, write_permitted) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "H5C__make_space_in_cache failed")
+ if (H5C__make_space_in_cache(f, 0, write_permitted) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "H5C__make_space_in_cache failed")
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__reconstruct_cache_contents() */
-
/*-------------------------------------------------------------------------
* Function: H5C__reconstruct_cache_entry()
*
@@ -3259,20 +3217,19 @@ done:
*-------------------------------------------------------------------------
*/
static H5C_cache_entry_t *
-H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr,
- const uint8_t **buf)
+H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **buf)
{
- H5C_cache_entry_t *pf_entry_ptr = NULL; /* Reconstructed cache entry */
- uint8_t flags = 0;
- hbool_t is_dirty = FALSE;
-#ifndef NDEBUG /* only used in assertions */
- hbool_t in_lru = FALSE;
- hbool_t is_fd_parent = FALSE;
- hbool_t is_fd_child = FALSE;
+ H5C_cache_entry_t *pf_entry_ptr = NULL; /* Reconstructed cache entry */
+ uint8_t flags = 0;
+ hbool_t is_dirty = FALSE;
+#ifndef NDEBUG /* only used in assertions */
+ hbool_t in_lru = FALSE;
+ hbool_t is_fd_parent = FALSE;
+ hbool_t is_fd_child = FALSE;
#endif /* NDEBUG */ /* only used in assertions */
- const uint8_t * p;
+ const uint8_t * p;
hbool_t file_is_rw;
- H5C_cache_entry_t *ret_value = NULL; /* Return value */
+ H5C_cache_entry_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -3286,8 +3243,8 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr,
file_is_rw = cache_ptr->delete_image;
/* Allocate space for the prefetched cache entry */
- if(NULL == (pf_entry_ptr = H5FL_CALLOC(H5C_cache_entry_t)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for prefetched cache entry")
+ if (NULL == (pf_entry_ptr = H5FL_CALLOC(H5C_cache_entry_t)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for prefetched cache entry")
/* Get pointer to buffer */
p = *buf;
@@ -3297,14 +3254,14 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr,
/* Decode flags */
flags = *p++;
- if(flags & H5C__MDCI_ENTRY_DIRTY_FLAG)
+ if (flags & H5C__MDCI_ENTRY_DIRTY_FLAG)
is_dirty = TRUE;
-#ifndef NDEBUG /* only used in assertions */
- if(flags & H5C__MDCI_ENTRY_IN_LRU_FLAG)
+#ifndef NDEBUG /* only used in assertions */
+ if (flags & H5C__MDCI_ENTRY_IN_LRU_FLAG)
in_lru = TRUE;
- if(flags & H5C__MDCI_ENTRY_IS_FD_PARENT_FLAG)
+ if (flags & H5C__MDCI_ENTRY_IS_FD_PARENT_FLAG)
is_fd_parent = TRUE;
- if(flags & H5C__MDCI_ENTRY_IS_FD_CHILD_FLAG)
+ if (flags & H5C__MDCI_ENTRY_IS_FD_CHILD_FLAG)
is_fd_child = TRUE;
#endif /* NDEBUG */ /* only used in assertions */
@@ -3332,18 +3289,20 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr,
/* Decode dependency child count */
UINT16DECODE(p, pf_entry_ptr->fd_child_count);
- HDassert((is_fd_parent && pf_entry_ptr->fd_child_count > 0) || (!is_fd_parent && pf_entry_ptr->fd_child_count == 0));
+ HDassert((is_fd_parent && pf_entry_ptr->fd_child_count > 0) ||
+ (!is_fd_parent && pf_entry_ptr->fd_child_count == 0));
/* Decode dirty dependency child count */
UINT16DECODE(p, pf_entry_ptr->fd_dirty_child_count);
- if(!file_is_rw)
- pf_entry_ptr->fd_dirty_child_count = 0;
- if(pf_entry_ptr->fd_dirty_child_count > pf_entry_ptr->fd_child_count)
+ if (!file_is_rw)
+ pf_entry_ptr->fd_dirty_child_count = 0;
+ if (pf_entry_ptr->fd_dirty_child_count > pf_entry_ptr->fd_child_count)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid dirty flush dependency child count")
/* Decode dependency parent count */
UINT16DECODE(p, pf_entry_ptr->fd_parent_count);
- HDassert((is_fd_child && pf_entry_ptr->fd_parent_count > 0) || (!is_fd_child && pf_entry_ptr->fd_parent_count == 0));
+ HDassert((is_fd_child && pf_entry_ptr->fd_parent_count > 0) ||
+ (!is_fd_child && pf_entry_ptr->fd_parent_count == 0));
/* Decode index in LRU */
INT32DECODE(p, pf_entry_ptr->lru_rank);
@@ -3351,37 +3310,38 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr,
/* Decode entry offset */
H5F_addr_decode(f, &p, &pf_entry_ptr->addr);
- if(!H5F_addr_defined(pf_entry_ptr->addr))
+ if (!H5F_addr_defined(pf_entry_ptr->addr))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid entry offset")
/* Decode entry length */
H5F_DECODE_LENGTH(f, p, pf_entry_ptr->size);
- if(pf_entry_ptr->size == 0)
+ if (pf_entry_ptr->size == 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid entry size")
/* Verify expected length of entry image */
- if((size_t)(p - *buf) != H5C__cache_image_block_entry_header_size(f))
+ if ((size_t)(p - *buf) != H5C__cache_image_block_entry_header_size(f))
HGOTO_ERROR(H5E_CACHE, H5E_BADSIZE, NULL, "Bad entry image len")
/* If parent count greater than zero, allocate array for parent
* addresses, and decode addresses into the array.
*/
- if(pf_entry_ptr->fd_parent_count > 0) {
- unsigned u; /* Local index variable */
+ if (pf_entry_ptr->fd_parent_count > 0) {
+ unsigned u; /* Local index variable */
- if(NULL == (pf_entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_malloc((size_t)(pf_entry_ptr->fd_parent_count) * H5F_SIZEOF_ADDR(f))))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for fd parent addrs buffer")
+ if (NULL == (pf_entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_malloc(
+ (size_t)(pf_entry_ptr->fd_parent_count) * H5F_SIZEOF_ADDR(f))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for fd parent addrs buffer")
- for(u = 0; u < pf_entry_ptr->fd_parent_count; u++) {
+ for (u = 0; u < pf_entry_ptr->fd_parent_count; u++) {
H5F_addr_decode(f, &p, &(pf_entry_ptr->fd_parent_addrs[u]));
- if(!H5F_addr_defined(pf_entry_ptr->fd_parent_addrs[u]))
+ if (!H5F_addr_defined(pf_entry_ptr->fd_parent_addrs[u]))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid flush dependency parent offset")
} /* end for */
- } /* end if */
+ } /* end if */
/* Allocate buffer for entry image */
- if(NULL == (pf_entry_ptr->image_ptr = H5MM_malloc(pf_entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer")
+ if (NULL == (pf_entry_ptr->image_ptr = H5MM_malloc(pf_entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer")
#if H5C_DO_MEMORY_SANITY_CHECKS
H5MM_memcpy(((uint8_t *)pf_entry_ptr->image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
@@ -3392,12 +3352,12 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr,
/* Initialize the rest of the fields in the prefetched entry */
/* (Only need to set non-zero/NULL/FALSE fields, due to calloc() above) */
- pf_entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
- pf_entry_ptr->cache_ptr = cache_ptr;
- pf_entry_ptr->image_up_to_date = TRUE;
- pf_entry_ptr->type = H5AC_PREFETCHED_ENTRY;
- pf_entry_ptr->prefetched = TRUE;
- pf_entry_ptr->prefetched_dirty = is_dirty && (!file_is_rw);
+ pf_entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
+ pf_entry_ptr->cache_ptr = cache_ptr;
+ pf_entry_ptr->image_up_to_date = TRUE;
+ pf_entry_ptr->type = H5AC_PREFETCHED_ENTRY;
+ pf_entry_ptr->prefetched = TRUE;
+ pf_entry_ptr->prefetched_dirty = is_dirty && (!file_is_rw);
/* Sanity checks */
HDassert(pf_entry_ptr->size > 0 && pf_entry_ptr->size < H5C_MAX_ENTRY_SIZE);
@@ -3408,13 +3368,12 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr,
ret_value = pf_entry_ptr;
done:
- if(NULL == ret_value && pf_entry_ptr)
+ if (NULL == ret_value && pf_entry_ptr)
pf_entry_ptr = H5FL_FREE(H5C_cache_entry_t, pf_entry_ptr);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__reconstruct_cache_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5C__write_cache_image_superblock_msg
*
@@ -3435,12 +3394,12 @@ done:
static herr_t
H5C__write_cache_image_superblock_msg(H5F_t *f, hbool_t create)
{
- H5C_t * cache_ptr;
- H5O_mdci_t mdci_msg; /* metadata cache image message */
- /* to insert in the superblock */
- /* extension. */
- unsigned mesg_flags = H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr;
+ H5O_mdci_t mdci_msg; /* metadata cache image message */
+ /* to insert in the superblock */
+ /* extension. */
+ unsigned mesg_flags = H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -3459,8 +3418,8 @@ H5C__write_cache_image_superblock_msg(H5F_t *f, hbool_t create)
*/
mdci_msg.addr = cache_ptr->image_addr;
#ifdef H5_HAVE_PARALLEL
- if(cache_ptr->aux_ptr) { /* we have multiple processes */
- H5AC_aux_t * aux_ptr;
+ if (cache_ptr->aux_ptr) { /* we have multiple processes */
+ H5AC_aux_t *aux_ptr;
aux_ptr = (H5AC_aux_t *)cache_ptr->aux_ptr;
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
@@ -3471,14 +3430,14 @@ H5C__write_cache_image_superblock_msg(H5F_t *f, hbool_t create)
mdci_msg.size = cache_ptr->image_len;
/* Write metadata cache image message to superblock extension */
- if(H5F__super_ext_write_msg(f, H5O_MDCI_MSG_ID, &mdci_msg, create, mesg_flags) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "can't write metadata cache image message to superblock extension")
+ if (H5F__super_ext_write_msg(f, H5O_MDCI_MSG_ID, &mdci_msg, create, mesg_flags) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL,
+ "can't write metadata cache image message to superblock extension")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__write_cache_image_superblock_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__write_cache_image
*
@@ -3495,7 +3454,7 @@ done:
static herr_t
H5C__write_cache_image(H5F_t *f, const H5C_t *cache_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -3507,22 +3466,22 @@ H5C__write_cache_image(H5F_t *f, const H5C_t *cache_ptr)
HDassert(cache_ptr->image_buffer);
#ifdef H5_HAVE_PARALLEL
-{
- H5AC_aux_t *aux_ptr = (H5AC_aux_t *)cache_ptr->aux_ptr;
+ {
+ H5AC_aux_t *aux_ptr = (H5AC_aux_t *)cache_ptr->aux_ptr;
- if((NULL == aux_ptr) || (aux_ptr->mpi_rank == 0)) {
- HDassert((NULL == aux_ptr) || (aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC));
+ if ((NULL == aux_ptr) || (aux_ptr->mpi_rank == 0)) {
+ HDassert((NULL == aux_ptr) || (aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC));
#endif /* H5_HAVE_PARALLEL */
- /* Write the buffer (if serial access, or rank 0 for parallel access) */
- if(H5F_block_write(f, H5FD_MEM_SUPER, cache_ptr->image_addr, cache_ptr->image_len, cache_ptr->image_buffer) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't write metadata cache image block to file")
+ /* Write the buffer (if serial access, or rank 0 for parallel access) */
+ if (H5F_block_write(f, H5FD_MEM_SUPER, cache_ptr->image_addr, cache_ptr->image_len,
+ cache_ptr->image_buffer) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't write metadata cache image block to file")
#ifdef H5_HAVE_PARALLEL
- } /* end if */
-} /* end block */
-#endif /* H5_HAVE_PARALLEL */
+ } /* end if */
+ } /* end block */
+#endif /* H5_HAVE_PARALLEL */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__write_cache_image() */
-
diff --git a/src/H5Clog.c b/src/H5Clog.c
index 794d6bb..d48b7b1 100644
--- a/src/H5Clog.c
+++ b/src/H5Clog.c
@@ -23,55 +23,46 @@
/****************/
/* Module Setup */
/****************/
-#include "H5Cmodule.h" /* This source code file is part of the H5C module */
+#include "H5Cmodule.h" /* This source code file is part of the H5C module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
#define H5AC_FRIEND /* Suppress error about including H5ACpkg */
-#include "H5ACpkg.h" /* Metadata cache */
-#include "H5Cpkg.h" /* Cache */
-#include "H5Clog.h" /* Cache logging */
-#include "H5Eprivate.h" /* Error handling */
-
+#include "H5ACpkg.h" /* Metadata cache */
+#include "H5Cpkg.h" /* Cache */
+#include "H5Clog.h" /* Cache logging */
+#include "H5Eprivate.h" /* Error handling */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5C_log_set_up
*
@@ -87,8 +78,8 @@
herr_t
H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, hbool_t start_immediately)
{
- int mpi_rank = -1; /* -1 indicates serial (no MPI rank) */
- herr_t ret_value = SUCCEED; /* Return value */
+ int mpi_rank = -1; /* -1 indicates serial (no MPI rank) */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -97,24 +88,24 @@ H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, h
HDassert(log_location);
/* Check logging flags */
- if(cache->log_info->enabled)
+ if (cache->log_info->enabled)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging already set up")
- /* Get the rank when MPI is in use. Logging clients will usually
- * use that to create per-process logs.
- */
+ /* Get the rank when MPI is in use. Logging clients will usually
+ * use that to create per-process logs.
+ */
#ifdef H5_HAVE_PARALLEL
- if(NULL != cache->aux_ptr)
+ if (NULL != cache->aux_ptr)
mpi_rank = ((H5AC_aux_t *)(cache->aux_ptr))->mpi_rank;
#endif /*H5_HAVE_PARALLEL*/
/* Set up logging */
- if(H5C_LOG_STYLE_JSON == style) {
- if(H5C_log_json_set_up(cache->log_info, log_location, mpi_rank) < 0)
+ if (H5C_LOG_STYLE_JSON == style) {
+ if (H5C_log_json_set_up(cache->log_info, log_location, mpi_rank) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to set up json logging")
}
- else if(H5C_LOG_STYLE_TRACE == style) {
- if(H5C_log_trace_set_up(cache->log_info, log_location, mpi_rank) < 0)
+ else if (H5C_LOG_STYLE_TRACE == style) {
+ if (H5C_log_trace_set_up(cache->log_info, log_location, mpi_rank) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to set up trace logging")
}
else
@@ -124,16 +115,15 @@ H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, h
cache->log_info->enabled = TRUE;
/* Start logging if requested */
- if(start_immediately)
- if(H5C_start_logging(cache) < 0)
+ if (start_immediately)
+ if (H5C_start_logging(cache) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to start logging")
- done:
+done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_set_up() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_tear_down
*
@@ -149,7 +139,7 @@ H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, h
herr_t
H5C_log_tear_down(H5C_t *cache)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -157,27 +147,26 @@ H5C_log_tear_down(H5C_t *cache)
HDassert(cache);
/* Check logging flags */
- if(FALSE == cache->log_info->enabled)
+ if (FALSE == cache->log_info->enabled)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled")
/* Stop logging if that's going on */
- if(cache->log_info->logging)
- if(H5C_stop_logging(cache) < 0)
+ if (cache->log_info->logging)
+ if (H5C_stop_logging(cache) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to stop logging")
/* Tear down logging */
- if(cache->log_info->cls->tear_down_logging)
- if(cache->log_info->cls->tear_down_logging(cache->log_info) < 0)
+ if (cache->log_info->cls->tear_down_logging)
+ if (cache->log_info->cls->tear_down_logging(cache->log_info) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific tear down call failed")
/* Unset logging flags */
cache->log_info->enabled = FALSE;
- done:
+done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_tear_down() */
-
/*-------------------------------------------------------------------------
* Function: H5C_start_logging
*
@@ -193,7 +182,7 @@ H5C_log_tear_down(H5C_t *cache)
herr_t
H5C_start_logging(H5C_t *cache)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -201,27 +190,26 @@ H5C_start_logging(H5C_t *cache)
HDassert(cache);
/* Check logging flags */
- if(FALSE == cache->log_info->enabled)
+ if (FALSE == cache->log_info->enabled)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled")
/* Start logging */
- if(cache->log_info->cls->start_logging)
- if(cache->log_info->cls->start_logging(cache->log_info) < 0)
+ if (cache->log_info->cls->start_logging)
+ if (cache->log_info->cls->start_logging(cache->log_info) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific start call failed")
/* Set logging flags */
cache->log_info->logging = TRUE;
/* Write a log message */
- if(cache->log_info->cls->write_start_log_msg)
- if(cache->log_info->cls->write_start_log_msg(cache->log_info->udata) < 0)
+ if (cache->log_info->cls->write_start_log_msg)
+ if (cache->log_info->cls->write_start_log_msg(cache->log_info->udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write start call failed")
- done:
+done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_start_logging() */
-
/*-------------------------------------------------------------------------
* Function: H5C_stop_logging
*
@@ -237,7 +225,7 @@ H5C_start_logging(H5C_t *cache)
herr_t
H5C_stop_logging(H5C_t *cache)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -245,29 +233,28 @@ H5C_stop_logging(H5C_t *cache)
HDassert(cache);
/* Check logging flags */
- if(FALSE == cache->log_info->enabled)
+ if (FALSE == cache->log_info->enabled)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled")
- if(FALSE == cache->log_info->logging)
+ if (FALSE == cache->log_info->logging)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not in progress")
/* Write a log message */
- if(cache->log_info->cls->write_stop_log_msg)
- if(cache->log_info->cls->write_stop_log_msg(cache->log_info->udata) < 0)
+ if (cache->log_info->cls->write_stop_log_msg)
+ if (cache->log_info->cls->write_stop_log_msg(cache->log_info->udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write stop call failed")
/* Stop logging */
- if(cache->log_info->cls->stop_logging)
- if(cache->log_info->cls->stop_logging(cache->log_info) < 0)
+ if (cache->log_info->cls->stop_logging)
+ if (cache->log_info->cls->stop_logging(cache->log_info) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific stop call failed")
/* Set logging flags */
cache->log_info->logging = FALSE;
- done:
+done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_stop_logging() */
-
/*-------------------------------------------------------------------------
* Function: H5C_get_logging_status
*
@@ -293,13 +280,12 @@ H5C_get_logging_status(const H5C_t *cache, /*OUT*/ hbool_t *is_enabled,
HDassert(is_currently_logging);
/* Get logging flags */
- *is_enabled = cache->log_info->enabled;
+ *is_enabled = cache->log_info->enabled;
*is_currently_logging = cache->log_info->logging;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5C_get_logging_status() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_create_cache_msg
*
@@ -315,7 +301,7 @@ H5C_get_logging_status(const H5C_t *cache, /*OUT*/ hbool_t *is_enabled,
herr_t
H5C_log_write_create_cache_msg(H5C_t *cache, herr_t fxn_ret_value)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -323,8 +309,8 @@ H5C_log_write_create_cache_msg(H5C_t *cache, herr_t fxn_ret_value)
HDassert(cache);
/* Write a log message */
- if(cache->log_info->cls->write_create_cache_log_msg)
- if(cache->log_info->cls->write_create_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_create_cache_log_msg)
+ if (cache->log_info->cls->write_create_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write create cache call failed")
done:
@@ -350,7 +336,7 @@ done:
herr_t
H5C_log_write_destroy_cache_msg(H5C_t *cache)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -358,15 +344,14 @@ H5C_log_write_destroy_cache_msg(H5C_t *cache)
HDassert(cache);
/* Write a log message */
- if(cache->log_info->cls->write_destroy_cache_log_msg)
- if(cache->log_info->cls->write_destroy_cache_log_msg(cache->log_info->udata) < 0)
+ if (cache->log_info->cls->write_destroy_cache_log_msg)
+ if (cache->log_info->cls->write_destroy_cache_log_msg(cache->log_info->udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write destroy cache call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_destroy_cache_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_evict_cache_msg
*
@@ -390,15 +375,14 @@ H5C_log_write_evict_cache_msg(H5C_t *cache, herr_t fxn_ret_value)
HDassert(cache);
/* Write a log message */
- if(cache->log_info->cls->write_evict_cache_log_msg)
- if(cache->log_info->cls->write_evict_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_evict_cache_log_msg)
+ if (cache->log_info->cls->write_evict_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write evict cache call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_evict_cache_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_expunge_entry_msg
*
@@ -412,8 +396,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_expunge_entry_msg(H5C_t *cache, haddr_t address,
- int type_id, herr_t fxn_ret_value)
+H5C_log_write_expunge_entry_msg(H5C_t *cache, haddr_t address, int type_id, herr_t fxn_ret_value)
{
herr_t ret_value = SUCCEED;
@@ -423,15 +406,15 @@ H5C_log_write_expunge_entry_msg(H5C_t *cache, haddr_t address,
HDassert(cache);
/* Write a log message */
- if(cache->log_info->cls->write_expunge_entry_log_msg)
- if(cache->log_info->cls->write_expunge_entry_log_msg(cache->log_info->udata, address, type_id, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_expunge_entry_log_msg)
+ if (cache->log_info->cls->write_expunge_entry_log_msg(cache->log_info->udata, address, type_id,
+ fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write expunge entry call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_expunge_entry_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_flush_cache_msg
*
@@ -455,15 +438,14 @@ H5C_log_write_flush_cache_msg(H5C_t *cache, herr_t fxn_ret_value)
HDassert(cache);
/* Write a log message */
- if(cache->log_info->cls->write_flush_cache_log_msg)
- if(cache->log_info->cls->write_flush_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_flush_cache_log_msg)
+ if (cache->log_info->cls->write_flush_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific flush cache call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_flush_cache_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_insert_entry_msg
*
@@ -477,8 +459,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_insert_entry_msg(H5C_t *cache, haddr_t address,
- int type_id, unsigned flags, size_t size, herr_t fxn_ret_value)
+H5C_log_write_insert_entry_msg(H5C_t *cache, haddr_t address, int type_id, unsigned flags, size_t size,
+ herr_t fxn_ret_value)
{
herr_t ret_value = SUCCEED;
@@ -488,15 +470,15 @@ H5C_log_write_insert_entry_msg(H5C_t *cache, haddr_t address,
HDassert(cache);
/* Write a log message */
- if(cache->log_info->cls->write_insert_entry_log_msg)
- if(cache->log_info->cls->write_insert_entry_log_msg(cache->log_info->udata, address, type_id, flags, size, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_insert_entry_log_msg)
+ if (cache->log_info->cls->write_insert_entry_log_msg(cache->log_info->udata, address, type_id, flags,
+ size, fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific insert entry call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_insert_entry_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_mark_entry_dirty_msg
*
@@ -510,8 +492,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_mark_entry_dirty_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+H5C_log_write_mark_entry_dirty_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
herr_t ret_value = SUCCEED;
@@ -522,15 +503,15 @@ H5C_log_write_mark_entry_dirty_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
/* Write a log message */
HDassert(entry);
- if(cache->log_info->cls->write_mark_entry_dirty_log_msg)
- if(cache->log_info->cls->write_mark_entry_dirty_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_mark_entry_dirty_log_msg)
+ if (cache->log_info->cls->write_mark_entry_dirty_log_msg(cache->log_info->udata, entry,
+ fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark dirty entry call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_mark_entry_dirty_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_mark_entry_clean_msg
*
@@ -544,10 +525,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_mark_entry_clean_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+H5C_log_write_mark_entry_clean_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -556,15 +536,15 @@ H5C_log_write_mark_entry_clean_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
/* Write a log message */
HDassert(entry);
- if(cache->log_info->cls->write_mark_entry_clean_log_msg)
- if(cache->log_info->cls->write_mark_entry_clean_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_mark_entry_clean_log_msg)
+ if (cache->log_info->cls->write_mark_entry_clean_log_msg(cache->log_info->udata, entry,
+ fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark clean entry call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_mark_entry_clean_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_mark_unserialized_entry_msg
*
@@ -578,8 +558,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_mark_unserialized_entry_msg(H5C_t *cache,
- const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
+H5C_log_write_mark_unserialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
herr_t ret_value = SUCCEED;
@@ -590,15 +569,15 @@ H5C_log_write_mark_unserialized_entry_msg(H5C_t *cache,
/* Write a log message */
HDassert(entry);
- if(cache->log_info->cls->write_mark_unserialized_entry_log_msg)
- if(cache->log_info->cls->write_mark_unserialized_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_mark_unserialized_entry_log_msg)
+ if (cache->log_info->cls->write_mark_unserialized_entry_log_msg(cache->log_info->udata, entry,
+ fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark unserialized entry call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_mark_unserialized_entry_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_mark_serialized_entry_msg
*
@@ -612,10 +591,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_mark_serialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+H5C_log_write_mark_serialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -624,15 +602,15 @@ H5C_log_write_mark_serialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *e
/* Write a log message */
HDassert(entry);
- if(cache->log_info->cls->write_mark_serialized_entry_log_msg)
- if(cache->log_info->cls->write_mark_serialized_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_mark_serialized_entry_log_msg)
+ if (cache->log_info->cls->write_mark_serialized_entry_log_msg(cache->log_info->udata, entry,
+ fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark serialized entry call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_mark_serialized_entry_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_move_entry_msg
*
@@ -646,8 +624,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_move_entry_msg(H5C_t *cache, haddr_t old_addr, haddr_t new_addr,
- int type_id, herr_t fxn_ret_value)
+H5C_log_write_move_entry_msg(H5C_t *cache, haddr_t old_addr, haddr_t new_addr, int type_id,
+ herr_t fxn_ret_value)
{
herr_t ret_value = SUCCEED;
@@ -657,15 +635,15 @@ H5C_log_write_move_entry_msg(H5C_t *cache, haddr_t old_addr, haddr_t new_addr,
HDassert(cache);
/* Write a log message */
- if(cache->log_info->cls->write_move_entry_log_msg)
- if(cache->log_info->cls->write_move_entry_log_msg(cache->log_info->udata, old_addr, new_addr, type_id, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_move_entry_log_msg)
+ if (cache->log_info->cls->write_move_entry_log_msg(cache->log_info->udata, old_addr, new_addr,
+ type_id, fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific move entry call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_move_entry_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_pin_entry_msg
*
@@ -679,8 +657,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_pin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+H5C_log_write_pin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
herr_t ret_value = SUCCEED;
@@ -691,15 +668,14 @@ H5C_log_write_pin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
/* Write a log message */
HDassert(entry);
- if(cache->log_info->cls->write_pin_entry_log_msg)
- if(cache->log_info->cls->write_pin_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_pin_entry_log_msg)
+ if (cache->log_info->cls->write_pin_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific pin entry call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_pin_entry_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_create_fd_msg
*
@@ -714,8 +690,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_create_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent,
- const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+H5C_log_write_create_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child,
+ herr_t fxn_ret_value)
{
herr_t ret_value = SUCCEED;
@@ -727,15 +703,15 @@ H5C_log_write_create_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent,
/* Write a log message */
HDassert(parent);
HDassert(child);
- if(cache->log_info->cls->write_create_fd_log_msg)
- if(cache->log_info->cls->write_create_fd_log_msg(cache->log_info->udata, parent, child, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_create_fd_log_msg)
+ if (cache->log_info->cls->write_create_fd_log_msg(cache->log_info->udata, parent, child,
+ fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific create fd call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_create_fd_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_protect_entry_msg
*
@@ -749,8 +725,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_protect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
- int type_id, unsigned flags, herr_t fxn_ret_value)
+H5C_log_write_protect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, int type_id, unsigned flags,
+ herr_t fxn_ret_value)
{
herr_t ret_value = SUCCEED;
@@ -761,15 +737,15 @@ H5C_log_write_protect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
/* Write a log message */
HDassert(entry);
- if(cache->log_info->cls->write_protect_entry_log_msg)
- if(cache->log_info->cls->write_protect_entry_log_msg(cache->log_info->udata, entry, type_id, flags, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_protect_entry_log_msg)
+ if (cache->log_info->cls->write_protect_entry_log_msg(cache->log_info->udata, entry, type_id, flags,
+ fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific protect entry call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_protect_entry_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_resize_entry_msg
*
@@ -783,8 +759,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_resize_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
- size_t new_size, herr_t fxn_ret_value)
+H5C_log_write_resize_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, size_t new_size,
+ herr_t fxn_ret_value)
{
herr_t ret_value = SUCCEED;
@@ -795,15 +771,15 @@ H5C_log_write_resize_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
/* Write a log message */
HDassert(entry);
- if(cache->log_info->cls->write_resize_entry_log_msg)
- if(cache->log_info->cls->write_resize_entry_log_msg(cache->log_info->udata, entry, new_size, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_resize_entry_log_msg)
+ if (cache->log_info->cls->write_resize_entry_log_msg(cache->log_info->udata, entry, new_size,
+ fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific resize entry call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_resize_entry_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_unpin_entry_msg
*
@@ -817,8 +793,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_unpin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+H5C_log_write_unpin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
herr_t ret_value = SUCCEED;
@@ -829,15 +804,14 @@ H5C_log_write_unpin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
/* Write a log message */
HDassert(entry);
- if(cache->log_info->cls->write_unpin_entry_log_msg)
- if(cache->log_info->cls->write_unpin_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_unpin_entry_log_msg)
+ if (cache->log_info->cls->write_unpin_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific unpin entry call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_unpin_entry_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_destroy_fd_msg
*
@@ -852,8 +826,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_destroy_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent,
- const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+H5C_log_write_destroy_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child,
+ herr_t fxn_ret_value)
{
herr_t ret_value = SUCCEED;
@@ -865,15 +839,15 @@ H5C_log_write_destroy_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent,
/* Write a log message */
HDassert(parent);
HDassert(child);
- if(cache->log_info->cls->write_destroy_fd_log_msg)
- if(cache->log_info->cls->write_destroy_fd_log_msg(cache->log_info->udata, parent, child, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_destroy_fd_log_msg)
+ if (cache->log_info->cls->write_destroy_fd_log_msg(cache->log_info->udata, parent, child,
+ fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific destroy fd call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_destroy_fd_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_unprotect_entry_msg
*
@@ -887,8 +861,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_unprotect_entry_msg(H5C_t *cache, haddr_t address,
- int type_id, unsigned flags, herr_t fxn_ret_value)
+H5C_log_write_unprotect_entry_msg(H5C_t *cache, haddr_t address, int type_id, unsigned flags,
+ herr_t fxn_ret_value)
{
herr_t ret_value = SUCCEED;
@@ -898,15 +872,15 @@ H5C_log_write_unprotect_entry_msg(H5C_t *cache, haddr_t address,
HDassert(cache);
/* Write a log message */
- if(cache->log_info->cls->write_unprotect_entry_log_msg)
- if(cache->log_info->cls->write_unprotect_entry_log_msg(cache->log_info->udata, address, type_id, flags, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_unprotect_entry_log_msg)
+ if (cache->log_info->cls->write_unprotect_entry_log_msg(cache->log_info->udata, address, type_id,
+ flags, fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific unprotect entry call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_unprotect_entry_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_set_cache_config_msg
*
@@ -920,8 +894,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_set_cache_config_msg(H5C_t *cache, const H5AC_cache_config_t *config,
- herr_t fxn_ret_value)
+H5C_log_write_set_cache_config_msg(H5C_t *cache, const H5AC_cache_config_t *config, herr_t fxn_ret_value)
{
herr_t ret_value = SUCCEED;
@@ -932,15 +905,15 @@ H5C_log_write_set_cache_config_msg(H5C_t *cache, const H5AC_cache_config_t *conf
/* Write a log message */
HDassert(config);
- if(cache->log_info->cls->write_set_cache_config_log_msg)
- if(cache->log_info->cls->write_set_cache_config_log_msg(cache->log_info->udata, config, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_set_cache_config_log_msg)
+ if (cache->log_info->cls->write_set_cache_config_log_msg(cache->log_info->udata, config,
+ fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific set cache config call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_set_cache_config_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_write_remove_entry_msg
*
@@ -954,8 +927,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_remove_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+H5C_log_write_remove_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
herr_t ret_value = SUCCEED;
@@ -966,11 +938,11 @@ H5C_log_write_remove_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
/* Write a log message */
HDassert(entry);
- if(cache->log_info->cls->write_remove_entry_log_msg)
- if(cache->log_info->cls->write_remove_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ if (cache->log_info->cls->write_remove_entry_log_msg)
+ if (cache->log_info->cls->write_remove_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) <
+ 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific remove entry call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_write_remove_entry_msg() */
-
diff --git a/src/H5Clog.h b/src/H5Clog.h
index 0235c4a..e49c453 100644
--- a/src/H5Clog.h
+++ b/src/H5Clog.h
@@ -19,7 +19,7 @@
#define _H5Clog_H
/* Get package's private header */
-#include "H5Cprivate.h" /* Cache */
+#include "H5Cprivate.h" /* Cache */
/**************************/
/* Package Private Macros */
@@ -34,7 +34,7 @@ typedef struct H5C_log_info_t H5C_log_info_t;
/* Class for generating logging messages */
typedef struct H5C_log_class_t {
- const char *name; /* String for debugging */
+ const char *name; /* String for debugging */
/* Callbacks for writing log messages */
herr_t (*tear_down_logging)(H5C_log_info_t *log_info);
@@ -47,68 +47,93 @@ typedef struct H5C_log_class_t {
herr_t (*write_evict_cache_log_msg)(void *udata, herr_t fxn_ret_value);
herr_t (*write_expunge_entry_log_msg)(void *udata, haddr_t address, int type_id, herr_t fxn_ret_value);
herr_t (*write_flush_cache_log_msg)(void *udata, herr_t fxn_ret_value);
- herr_t (*write_insert_entry_log_msg)(void *udata, haddr_t address, int type_id, unsigned flags, size_t size, herr_t fxn_ret_value);
- herr_t (*write_mark_entry_dirty_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
- herr_t (*write_mark_entry_clean_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
- herr_t (*write_mark_unserialized_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
- herr_t (*write_mark_serialized_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
- herr_t (*write_move_entry_log_msg)(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id, herr_t fxn_ret_value);
+ herr_t (*write_insert_entry_log_msg)(void *udata, haddr_t address, int type_id, unsigned flags,
+ size_t size, herr_t fxn_ret_value);
+ herr_t (*write_mark_entry_dirty_log_msg)(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+ herr_t (*write_mark_entry_clean_log_msg)(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+ herr_t (*write_mark_unserialized_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+ herr_t (*write_mark_serialized_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+ herr_t (*write_move_entry_log_msg)(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id,
+ herr_t fxn_ret_value);
herr_t (*write_pin_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
- herr_t (*write_create_fd_log_msg)(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
- herr_t (*write_protect_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value);
- herr_t (*write_resize_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value);
+ herr_t (*write_create_fd_log_msg)(void *udata, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+ herr_t (*write_protect_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, int type_id,
+ unsigned flags, herr_t fxn_ret_value);
+ herr_t (*write_resize_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, size_t new_size,
+ herr_t fxn_ret_value);
herr_t (*write_unpin_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
- herr_t (*write_destroy_fd_log_msg)(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
- herr_t (*write_unprotect_entry_log_msg)(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value);
- herr_t (*write_set_cache_config_log_msg)(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value);
+ herr_t (*write_destroy_fd_log_msg)(void *udata, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+ herr_t (*write_unprotect_entry_log_msg)(void *udata, haddr_t address, int type_id, unsigned flags,
+ herr_t fxn_ret_value);
+ herr_t (*write_set_cache_config_log_msg)(void *udata, const H5AC_cache_config_t *config,
+ herr_t fxn_ret_value);
herr_t (*write_remove_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
} H5C_log_class_t;
/* Logging information */
struct H5C_log_info_t {
- hbool_t enabled; /* Was the logging set up? */
- hbool_t logging; /* Are we currently logging? */
- H5C_log_class_t *cls; /* Callbacks for writing log messages */
- void *udata; /* Log-specific data */
+ hbool_t enabled; /* Was the logging set up? */
+ hbool_t logging; /* Are we currently logging? */
+ H5C_log_class_t *cls; /* Callbacks for writing log messages */
+ void * udata; /* Log-specific data */
};
-
/*****************************/
/* Package Private Variables */
/*****************************/
-
/******************************/
/* Package Private Prototypes */
/******************************/
-H5_DLL herr_t H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, hbool_t start_immediately);
+H5_DLL herr_t H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style,
+ hbool_t start_immediately);
H5_DLL herr_t H5C_log_tear_down(H5C_t *cache);
H5_DLL herr_t H5C_log_write_create_cache_msg(H5C_t *cache, herr_t fxn_ret_value);
H5_DLL herr_t H5C_log_write_destroy_cache_msg(H5C_t *cache);
H5_DLL herr_t H5C_log_write_evict_cache_msg(H5C_t *cache, herr_t fxn_ret_value);
-H5_DLL herr_t H5C_log_write_expunge_entry_msg(H5C_t *cache, haddr_t address, int type_id, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_expunge_entry_msg(H5C_t *cache, haddr_t address, int type_id,
+ herr_t fxn_ret_value);
H5_DLL herr_t H5C_log_write_flush_cache_msg(H5C_t *cache, herr_t fxn_ret_value);
-H5_DLL herr_t H5C_log_write_insert_entry_msg(H5C_t *cache, haddr_t address, int type_id, unsigned flags, size_t size, herr_t fxn_ret_value);
-H5_DLL herr_t H5C_log_write_mark_entry_dirty_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-H5_DLL herr_t H5C_log_write_mark_entry_clean_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-H5_DLL herr_t H5C_log_write_mark_unserialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-H5_DLL herr_t H5C_log_write_mark_serialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-H5_DLL herr_t H5C_log_write_move_entry_msg(H5C_t *cache, haddr_t old_addr, haddr_t new_addr, int type_id, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_insert_entry_msg(H5C_t *cache, haddr_t address, int type_id, unsigned flags,
+ size_t size, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_mark_entry_dirty_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_mark_entry_clean_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_mark_unserialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_mark_serialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_move_entry_msg(H5C_t *cache, haddr_t old_addr, haddr_t new_addr, int type_id,
+ herr_t fxn_ret_value);
H5_DLL herr_t H5C_log_write_pin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-H5_DLL herr_t H5C_log_write_create_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
-H5_DLL herr_t H5C_log_write_protect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value);
-H5_DLL herr_t H5C_log_write_resize_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value);
-H5_DLL herr_t H5C_log_write_unpin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-H5_DLL herr_t H5C_log_write_destroy_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
-H5_DLL herr_t H5C_log_write_unprotect_entry_msg(H5C_t *cache, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value);
-H5_DLL herr_t H5C_log_write_set_cache_config_msg(H5C_t *cache, const H5AC_cache_config_t *config, herr_t fxn_ret_value);
-H5_DLL herr_t H5C_log_write_remove_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_create_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_protect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, int type_id,
+ unsigned flags, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_resize_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, size_t new_size,
+ herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_unpin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_destroy_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_unprotect_entry_msg(H5C_t *cache, haddr_t address, int type_id, unsigned flags,
+ herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_set_cache_config_msg(H5C_t *cache, const H5AC_cache_config_t *config,
+ herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_remove_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
/* Logging-specific setup functions */
H5_DLL herr_t H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank);
H5_DLL herr_t H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank);
#endif /* _H5Clog_H */
-
diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c
index ab25a55..b77ab63 100644
--- a/src/H5Clog_json.c
+++ b/src/H5Clog_json.c
@@ -24,17 +24,16 @@
/****************/
/* Module Setup */
/****************/
-#include "H5Cmodule.h" /* This source code file is part of the H5C module */
+#include "H5Cmodule.h" /* This source code file is part of the H5C module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Cpkg.h" /* Cache */
-#include "H5Clog.h" /* Cache logging */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Cpkg.h" /* Cache */
+#include "H5Clog.h" /* Cache logging */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
/****************/
/* Local Macros */
@@ -43,12 +42,10 @@
/* Max log message size */
#define H5C_MAX_JSON_LOG_MSG_SIZE 1024
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
@@ -58,7 +55,6 @@ typedef struct H5C_log_json_udata_t {
char *message;
} H5C_log_json_udata_t;
-
/********************/
/* Local Prototypes */
/********************/
@@ -73,35 +69,48 @@ static herr_t H5C__json_write_stop_log_msg(void *udata);
static herr_t H5C__json_write_create_cache_log_msg(void *udata, herr_t fxn_ret_value);
static herr_t H5C__json_write_destroy_cache_log_msg(void *udata);
static herr_t H5C__json_write_evict_cache_log_msg(void *udata, herr_t fxn_ret_value);
-static herr_t H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id, herr_t fxn_ret_value);
+static herr_t H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id,
+ herr_t fxn_ret_value);
static herr_t H5C__json_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value);
-static herr_t H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, size_t size, herr_t fxn_ret_value);
-static herr_t H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-static herr_t H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-static herr_t H5C__json_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-static herr_t H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-static herr_t H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id, herr_t fxn_ret_value);
-static herr_t H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-static herr_t H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
-static herr_t H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value);
-static herr_t H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value);
-static herr_t H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-static herr_t H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
-static herr_t H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value);
-static herr_t H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value);
-static herr_t H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-
+static herr_t H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags,
+ size_t size, herr_t fxn_ret_value);
+static herr_t H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+static herr_t H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+static herr_t H5C__json_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+static herr_t H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+static herr_t H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id,
+ herr_t fxn_ret_value);
+static herr_t H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+static herr_t H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+static herr_t H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id,
+ unsigned flags, herr_t fxn_ret_value);
+static herr_t H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ size_t new_size, herr_t fxn_ret_value);
+static herr_t H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+static herr_t H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+static herr_t H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id,
+ unsigned flags, herr_t fxn_ret_value);
+static herr_t H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config,
+ herr_t fxn_ret_value);
+static herr_t H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -109,37 +118,33 @@ static herr_t H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_
/* Note that there's no cache set up call since that's the
* place where this struct is wired into the cache.
*/
-static H5C_log_class_t H5C_json_log_class_g = {
- "json",
- H5C__json_tear_down_logging,
- NULL, /* start logging */
- NULL, /* stop logging */
- H5C__json_write_start_log_msg,
- H5C__json_write_stop_log_msg,
- H5C__json_write_create_cache_log_msg,
- H5C__json_write_destroy_cache_log_msg,
- H5C__json_write_evict_cache_log_msg,
- H5C__json_write_expunge_entry_log_msg,
- H5C__json_write_flush_cache_log_msg,
- H5C__json_write_insert_entry_log_msg,
- H5C__json_write_mark_entry_dirty_log_msg,
- H5C__json_write_mark_entry_clean_log_msg,
- H5C__json_write_mark_unserialized_entry_log_msg,
- H5C__json_write_mark_serialized_entry_log_msg,
- H5C__json_write_move_entry_log_msg,
- H5C__json_write_pin_entry_log_msg,
- H5C__json_write_create_fd_log_msg,
- H5C__json_write_protect_entry_log_msg,
- H5C__json_write_resize_entry_log_msg,
- H5C__json_write_unpin_entry_log_msg,
- H5C__json_write_destroy_fd_log_msg,
- H5C__json_write_unprotect_entry_log_msg,
- H5C__json_write_set_cache_config_log_msg,
- H5C__json_write_remove_entry_log_msg
-};
-
-
-
+static H5C_log_class_t H5C_json_log_class_g = {"json",
+ H5C__json_tear_down_logging,
+ NULL, /* start logging */
+ NULL, /* stop logging */
+ H5C__json_write_start_log_msg,
+ H5C__json_write_stop_log_msg,
+ H5C__json_write_create_cache_log_msg,
+ H5C__json_write_destroy_cache_log_msg,
+ H5C__json_write_evict_cache_log_msg,
+ H5C__json_write_expunge_entry_log_msg,
+ H5C__json_write_flush_cache_log_msg,
+ H5C__json_write_insert_entry_log_msg,
+ H5C__json_write_mark_entry_dirty_log_msg,
+ H5C__json_write_mark_entry_clean_log_msg,
+ H5C__json_write_mark_unserialized_entry_log_msg,
+ H5C__json_write_mark_serialized_entry_log_msg,
+ H5C__json_write_move_entry_log_msg,
+ H5C__json_write_pin_entry_log_msg,
+ H5C__json_write_create_fd_log_msg,
+ H5C__json_write_protect_entry_log_msg,
+ H5C__json_write_resize_entry_log_msg,
+ H5C__json_write_unpin_entry_log_msg,
+ H5C__json_write_destroy_fd_log_msg,
+ H5C__json_write_unprotect_entry_log_msg,
+ H5C__json_write_set_cache_config_log_msg,
+ H5C__json_write_remove_entry_log_msg};
+
/*-------------------------------------------------------------------------
* Function: H5C__json_write_log_message
*
@@ -157,7 +162,7 @@ static herr_t
H5C__json_write_log_message(H5C_log_json_udata_t *json_udata)
{
size_t n_chars;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -168,7 +173,7 @@ H5C__json_write_log_message(H5C_log_json_udata_t *json_udata)
/* Write the log message and flush */
n_chars = HDstrlen(json_udata->message);
- if((int)n_chars != HDfprintf(json_udata->outfile, json_udata->message))
+ if ((int)n_chars != HDfprintf(json_udata->outfile, json_udata->message))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message")
HDmemset((void *)(json_udata->message), 0, (size_t)(n_chars * sizeof(char)));
@@ -176,7 +181,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_log_message() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_json_set_up
*
@@ -205,9 +209,9 @@ herr_t
H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank)
{
H5C_log_json_udata_t *json_udata = NULL;
- char *file_name = NULL;
- size_t n_chars;
- herr_t ret_value = SUCCEED; /* Return value */
+ char * file_name = NULL;
+ size_t n_chars;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -219,12 +223,12 @@ H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi
log_info->cls = &H5C_json_log_class_g;
/* Allocate memory for the JSON-specific data */
- if(NULL == (log_info->udata = H5MM_calloc(sizeof(H5C_log_json_udata_t))))
+ if (NULL == (log_info->udata = H5MM_calloc(sizeof(H5C_log_json_udata_t))))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
json_udata = (H5C_log_json_udata_t *)(log_info->udata);
/* Allocate memory for the message buffer */
- if(NULL == (json_udata->message = (char *)H5MM_calloc(H5C_MAX_JSON_LOG_MSG_SIZE * sizeof(char))))
+ if (NULL == (json_udata->message = (char *)H5MM_calloc(H5C_MAX_JSON_LOG_MSG_SIZE * sizeof(char))))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
/* Possibly fix up the log file name.
@@ -235,41 +239,41 @@ H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi
* allocation size = "RANK_" + <rank # length> + dot + <path length> + \0
*/
n_chars = 5 + 39 + 1 + HDstrlen(log_location) + 1;
- if(NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char))))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate memory for mdc log file name manipulation")
+ if (NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL,
+ "can't allocate memory for mdc log file name manipulation")
/* Add the rank to the log file name when MPI is in use */
- if(-1 == mpi_rank)
+ if (-1 == mpi_rank)
HDsnprintf(file_name, n_chars, "%s", log_location);
else
HDsnprintf(file_name, n_chars, "RANK_%d.%s", mpi_rank, log_location);
/* Open log file and set it to be unbuffered */
- if(NULL == (json_udata->outfile = HDfopen(file_name, "w")))
+ if (NULL == (json_udata->outfile = HDfopen(file_name, "w")))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file")
HDsetbuf(json_udata->outfile, NULL);
- done:
- if(file_name)
+done:
+ if (file_name)
H5MM_xfree(file_name);
/* Free and reset the log info struct on errors */
- if(FAIL == ret_value) {
+ if (FAIL == ret_value) {
/* Free */
- if(json_udata && json_udata->message)
+ if (json_udata && json_udata->message)
H5MM_xfree(json_udata->message);
- if(json_udata)
+ if (json_udata)
H5MM_xfree(json_udata);
/* Reset */
log_info->udata = NULL;
- log_info->cls = NULL;
+ log_info->cls = NULL;
}
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_json_set_up() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_tear_down_logging
*
@@ -286,7 +290,7 @@ static herr_t
H5C__json_tear_down_logging(H5C_log_info_t *log_info)
{
H5C_log_json_udata_t *json_udata = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -300,7 +304,7 @@ H5C__json_tear_down_logging(H5C_log_info_t *log_info)
H5MM_xfree(json_udata->message);
/* Close log file */
- if(EOF == HDfclose(json_udata->outfile))
+ if (EOF == HDfclose(json_udata->outfile))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file")
json_udata->outfile = NULL;
@@ -308,14 +312,13 @@ H5C__json_tear_down_logging(H5C_log_info_t *log_info)
H5MM_xfree(json_udata);
/* Reset the log class info and udata */
- log_info->cls = NULL;
+ log_info->cls = NULL;
log_info->udata = NULL;
- done:
+done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_tear_down_logging() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_start_log_msg
*
@@ -332,7 +335,7 @@ static herr_t
H5C__json_write_start_log_msg(void *udata)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -341,26 +344,24 @@ H5C__json_write_start_log_msg(void *udata)
HDassert(json_udata->message);
/* Create the log message string (opens the JSON array) */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\n\
\"HDF5 metadata cache log messages\" : [\n\
{\
\"timestamp\":%lld,\
\"action\":\"logging start\"\
},\n\
-"
- , (long long)HDtime(NULL));
+",
+ (long long)HDtime(NULL));
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_start_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_stop_log_msg
*
@@ -377,7 +378,7 @@ static herr_t
H5C__json_write_stop_log_msg(void *udata)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -386,25 +387,23 @@ H5C__json_write_stop_log_msg(void *udata)
HDassert(json_udata->message);
/* Create the log message string (closes the JSON array) */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"logging stop\"\
}\n\
]}\n\
-"
- , (long long)HDtime(NULL));
+",
+ (long long)HDtime(NULL));
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_stop_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_create_cache_log_msg
*
@@ -421,7 +420,7 @@ static herr_t
H5C__json_write_create_cache_log_msg(void *udata, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -430,25 +429,23 @@ H5C__json_write_create_cache_log_msg(void *udata, herr_t fxn_ret_value)
HDassert(json_udata->message);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"create\",\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_create_cache_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_destroy_cache_log_msg
*
@@ -465,7 +462,7 @@ static herr_t
H5C__json_write_destroy_cache_log_msg(void *udata)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -474,24 +471,22 @@ H5C__json_write_destroy_cache_log_msg(void *udata)
HDassert(json_udata->message);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"destroy\"\
},\n\
-"
- , (long long)HDtime(NULL));
+",
+ (long long)HDtime(NULL));
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_destroy_cache_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_evict_cache_log_msg
*
@@ -508,7 +503,7 @@ static herr_t
H5C__json_write_evict_cache_log_msg(void *udata, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -517,25 +512,23 @@ H5C__json_write_evict_cache_log_msg(void *udata, herr_t fxn_ret_value)
HDassert(json_udata->message);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"evict\",\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_evict_cache_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_expunge_entry_log_msg
*
@@ -549,11 +542,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address,
- int type_id, herr_t fxn_ret_value)
+H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -562,8 +554,7 @@ H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address,
HDassert(json_udata->message);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"expunge\",\
@@ -571,19 +562,17 @@ H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address,
\"type_id\":%d,\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)address, (int)type_id, (int)fxn_ret_value);
-
+",
+ (long long)HDtime(NULL), (unsigned long)address, (int)type_id, (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_expunge_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_flush_cache_log_msg
*
@@ -600,7 +589,7 @@ static herr_t
H5C__json_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -609,25 +598,23 @@ H5C__json_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value)
HDassert(json_udata->message);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"flush\",\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_flush_cache_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_insert_entry_log_msg
*
@@ -641,11 +628,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address,
- int type_id, unsigned flags, size_t size, herr_t fxn_ret_value)
+H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, size_t size,
+ herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -654,8 +641,7 @@ H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address,
HDassert(json_udata->message);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"insert\",\
@@ -665,19 +651,18 @@ H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address,
\"size\":%d,\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)address, type_id, flags,
- (int)size, (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (unsigned long)address, type_id, flags, (int)size,
+ (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_insert_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_mark_entry_dirty_log_msg
*
@@ -691,11 +676,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -705,26 +689,24 @@ H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *e
HDassert(entry);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"dirty\",\
\"address\":0x%lx,\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_mark_entry_dirty_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_mark_entry_clean_log_msg
*
@@ -738,11 +720,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -752,26 +733,24 @@ H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *e
HDassert(entry);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"clean\",\
\"address\":0x%lx,\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_mark_entry_clean_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_mark_unserialized_entry_log_msg
*
@@ -785,11 +764,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__json_write_mark_unserialized_entry_log_msg(void *udata,
- const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
+H5C__json_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -799,26 +778,24 @@ H5C__json_write_mark_unserialized_entry_log_msg(void *udata,
HDassert(entry);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"unserialized\",\
\"address\":0x%lx,\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_mark_unserialized_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_mark_serialize_entry_log_msg
*
@@ -833,10 +810,10 @@ done:
*/
static herr_t
H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+ herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -846,26 +823,24 @@ H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry
HDassert(entry);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"serialized\",\
\"address\":0x%lx,\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_mark_serialized_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_move_entry_log_msg
*
@@ -879,11 +854,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr,
- int type_id, herr_t fxn_ret_value)
+H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id,
+ herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -892,8 +867,7 @@ H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_ad
HDassert(json_udata->message);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"move\",\
@@ -902,19 +876,18 @@ H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_ad
\"type_id\":%d,\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)old_addr,
- (unsigned long)new_addr, type_id, (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (unsigned long)old_addr, (unsigned long)new_addr, type_id,
+ (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_move_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_pin_entry_log_msg
*
@@ -928,11 +901,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -942,27 +914,24 @@ H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
HDassert(entry);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"pin\",\
\"address\":0x%lx,\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_pin_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_create_fd_log_msg
*
@@ -978,10 +947,10 @@ done:
*/
static herr_t
H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
- const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -992,8 +961,7 @@ H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
HDassert(child);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"create_fd\",\
@@ -1001,19 +969,18 @@ H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
\"child_addr\":0x%lx,\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)parent->addr,
- (unsigned long)child->addr, (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (unsigned long)parent->addr, (unsigned long)child->addr,
+ (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_create_fd_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_protect_entry_log_msg
*
@@ -1027,12 +994,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
- int type_id, unsigned flags, herr_t fxn_ret_value)
+H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id,
+ unsigned flags, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- char rw_s[16];
- herr_t ret_value = SUCCEED;
+ char rw_s[16];
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1041,14 +1008,13 @@ H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entr
HDassert(json_udata->message);
HDassert(entry);
- if(H5C__READ_ONLY_FLAG == flags)
+ if (H5C__READ_ONLY_FLAG == flags)
HDstrcpy(rw_s, "READ");
else
HDstrcpy(rw_s, "WRITE");
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"protect\",\
@@ -1058,19 +1024,18 @@ H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entr
\"size\":%d,\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- type_id, rw_s, (int)entry->size, (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (unsigned long)entry->addr, type_id, rw_s, (int)entry->size,
+ (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_protect_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_resize_entry_log_msg
*
@@ -1084,11 +1049,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
- size_t new_size, herr_t fxn_ret_value)
+H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, size_t new_size,
+ herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1098,8 +1063,7 @@ H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry
HDassert(entry);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"resize\",\
@@ -1107,19 +1071,17 @@ H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry
\"new_size\":%d,\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- (int)new_size, (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (unsigned long)entry->addr, (int)new_size, (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_resize_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_unpin_entry_log_msg
*
@@ -1133,11 +1095,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1147,27 +1108,24 @@ H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
HDassert(entry);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"unpin\",\
\"address\":0x%lx,\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_unpin_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_destroy_fd_log_msg
*
@@ -1183,10 +1141,10 @@ done:
*/
static herr_t
H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
- const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1197,8 +1155,7 @@ H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
HDassert(child);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"destroy_fd\",\
@@ -1206,19 +1163,18 @@ H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
\"child_addr\":0x%lx,\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)parent->addr,
- (unsigned long)child->addr, (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (unsigned long)parent->addr, (unsigned long)child->addr,
+ (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_destroy_fd_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_unprotect_entry_log_msg
*
@@ -1232,11 +1188,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address,
- int type_id, unsigned flags, herr_t fxn_ret_value)
+H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags,
+ herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1245,8 +1201,7 @@ H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address,
HDassert(json_udata->message);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"unprotect\",\
@@ -1255,19 +1210,17 @@ H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address,
\"flags\":%x,\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)address,
- type_id, flags, (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (unsigned long)address, type_id, flags, (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_unprotect_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_set_cache_config_log_msg
*
@@ -1282,10 +1235,10 @@ done:
*/
static herr_t
H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t H5_ATTR_NDEBUG_UNUSED *config,
- herr_t fxn_ret_value)
+ herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1295,26 +1248,23 @@ H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t
HDassert(config);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"set_config\",\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (int)fxn_ret_value);
-
+",
+ (long long)HDtime(NULL), (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_set_cache_config_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__json_write_remove_entry_log_msg
*
@@ -1328,11 +1278,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1342,23 +1291,20 @@ H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry
HDassert(entry);
/* Create the log message string */
- HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
-"\
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"remove\",\
\"address\":0x%lx,\
\"returned\":%d\
},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- (int)fxn_ret_value);
+",
+ (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__json_write_log_message(json_udata) < 0)
+ if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_remove_entry_log_msg() */
-
diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c
index 63fe382..002b3f9 100644
--- a/src/H5Clog_trace.c
+++ b/src/H5Clog_trace.c
@@ -24,17 +24,16 @@
/****************/
/* Module Setup */
/****************/
-#include "H5Cmodule.h" /* This source code file is part of the H5C module */
+#include "H5Cmodule.h" /* This source code file is part of the H5C module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Cpkg.h" /* Cache */
-#include "H5Clog.h" /* Cache logging */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Cpkg.h" /* Cache */
+#include "H5Clog.h" /* Cache logging */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
/****************/
/* Local Macros */
@@ -43,12 +42,10 @@
/* Max log message size */
#define H5C_MAX_TRACE_LOG_MSG_SIZE 4096
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
@@ -58,7 +55,6 @@ typedef struct H5C_log_trace_udata_t {
char *message;
} H5C_log_trace_udata_t;
-
/********************/
/* Local Prototypes */
/********************/
@@ -68,35 +64,48 @@ static herr_t H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata);
/* Log message callbacks */
static herr_t H5C__trace_tear_down_logging(H5C_log_info_t *log_info);
-static herr_t H5C__trace_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id,
+ herr_t fxn_ret_value);
static herr_t H5C__trace_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value);
-static herr_t H5C__trace_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, size_t size, herr_t fxn_ret_value);
-static herr_t H5C__trace_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-static herr_t H5C__trace_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-static herr_t H5C__trace_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-static herr_t H5C__trace_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-static herr_t H5C__trace_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id, herr_t fxn_ret_value);
-static herr_t H5C__trace_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-static herr_t H5C__trace_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
-static herr_t H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value);
-static herr_t H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value);
-static herr_t H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-static herr_t H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
-static herr_t H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value);
-static herr_t H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value);
-static herr_t H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
-
+static herr_t H5C__trace_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags,
+ size_t size, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+static herr_t H5C__trace_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+static herr_t H5C__trace_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+static herr_t H5C__trace_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+static herr_t H5C__trace_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr,
+ int type_id, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+static herr_t H5C__trace_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id,
+ unsigned flags, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ size_t new_size, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
+static herr_t H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id,
+ unsigned flags, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config,
+ herr_t fxn_ret_value);
+static herr_t H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value);
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -104,37 +113,33 @@ static herr_t H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache
/* Note that there's no cache set up call since that's the
* place where this struct is wired into the cache.
*/
-static H5C_log_class_t H5C_trace_log_class_g = {
- "trace",
- H5C__trace_tear_down_logging,
- NULL, /* start logging */
- NULL, /* stop logging */
- NULL, /* write start message */
- NULL, /* write stop message */
- NULL, /* write create cache message */
- NULL, /* write destroy cache message */
- NULL, /* write evict cache message */
- H5C__trace_write_expunge_entry_log_msg,
- H5C__trace_write_flush_cache_log_msg,
- H5C__trace_write_insert_entry_log_msg,
- H5C__trace_write_mark_entry_dirty_log_msg,
- H5C__trace_write_mark_entry_clean_log_msg,
- H5C__trace_write_mark_unserialized_entry_log_msg,
- H5C__trace_write_mark_serialized_entry_log_msg,
- H5C__trace_write_move_entry_log_msg,
- H5C__trace_write_pin_entry_log_msg,
- H5C__trace_write_create_fd_log_msg,
- H5C__trace_write_protect_entry_log_msg,
- H5C__trace_write_resize_entry_log_msg,
- H5C__trace_write_unpin_entry_log_msg,
- H5C__trace_write_destroy_fd_log_msg,
- H5C__trace_write_unprotect_entry_log_msg,
- H5C__trace_write_set_cache_config_log_msg,
- H5C__trace_write_remove_entry_log_msg
-};
-
-
-
+static H5C_log_class_t H5C_trace_log_class_g = {"trace",
+ H5C__trace_tear_down_logging,
+ NULL, /* start logging */
+ NULL, /* stop logging */
+ NULL, /* write start message */
+ NULL, /* write stop message */
+ NULL, /* write create cache message */
+ NULL, /* write destroy cache message */
+ NULL, /* write evict cache message */
+ H5C__trace_write_expunge_entry_log_msg,
+ H5C__trace_write_flush_cache_log_msg,
+ H5C__trace_write_insert_entry_log_msg,
+ H5C__trace_write_mark_entry_dirty_log_msg,
+ H5C__trace_write_mark_entry_clean_log_msg,
+ H5C__trace_write_mark_unserialized_entry_log_msg,
+ H5C__trace_write_mark_serialized_entry_log_msg,
+ H5C__trace_write_move_entry_log_msg,
+ H5C__trace_write_pin_entry_log_msg,
+ H5C__trace_write_create_fd_log_msg,
+ H5C__trace_write_protect_entry_log_msg,
+ H5C__trace_write_resize_entry_log_msg,
+ H5C__trace_write_unpin_entry_log_msg,
+ H5C__trace_write_destroy_fd_log_msg,
+ H5C__trace_write_unprotect_entry_log_msg,
+ H5C__trace_write_set_cache_config_log_msg,
+ H5C__trace_write_remove_entry_log_msg};
+
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_log_message
*
@@ -152,7 +157,7 @@ static herr_t
H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata)
{
size_t n_chars;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -163,7 +168,7 @@ H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata)
/* Write the log message and flush */
n_chars = HDstrlen(trace_udata->message);
- if((int)n_chars != HDfprintf(trace_udata->outfile, trace_udata->message))
+ if ((int)n_chars != HDfprintf(trace_udata->outfile, trace_udata->message))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message")
HDmemset((void *)(trace_udata->message), 0, (size_t)(n_chars * sizeof(char)));
@@ -171,7 +176,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_log_message() */
-
/*-------------------------------------------------------------------------
* Function: H5C_log_trace_set_up
*
@@ -200,9 +204,9 @@ herr_t
H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank)
{
H5C_log_trace_udata_t *trace_udata = NULL;
- char *file_name = NULL;
- size_t n_chars;
- herr_t ret_value = SUCCEED; /* Return value */
+ char * file_name = NULL;
+ size_t n_chars;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -214,12 +218,12 @@ H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mp
log_info->cls = &H5C_trace_log_class_g;
/* Allocate memory for the JSON-specific data */
- if(NULL == (log_info->udata = H5MM_calloc(sizeof(H5C_log_trace_udata_t))))
+ if (NULL == (log_info->udata = H5MM_calloc(sizeof(H5C_log_trace_udata_t))))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
trace_udata = (H5C_log_trace_udata_t *)(log_info->udata);
/* Allocate memory for the message buffer */
- if(NULL == (trace_udata->message = (char *)H5MM_calloc(H5C_MAX_TRACE_LOG_MSG_SIZE * sizeof(char))))
+ if (NULL == (trace_udata->message = (char *)H5MM_calloc(H5C_MAX_TRACE_LOG_MSG_SIZE * sizeof(char))))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
/* Possibly fix up the log file name.
@@ -230,44 +234,44 @@ H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mp
* allocation size = <path length> + dot + <rank # length> + \0
*/
n_chars = HDstrlen(log_location) + 1 + 39 + 1;
- if(NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char))))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate memory for mdc log file name manipulation")
+ if (NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL,
+ "can't allocate memory for mdc log file name manipulation")
/* Add the rank to the log file name when MPI is in use */
- if(-1 == mpi_rank)
+ if (-1 == mpi_rank)
HDsnprintf(file_name, n_chars, "%s", log_location);
else
HDsnprintf(file_name, n_chars, "%s.%d", log_location, mpi_rank);
/* Open log file and set it to be unbuffered */
- if(NULL == (trace_udata->outfile = HDfopen(file_name, "w")))
+ if (NULL == (trace_udata->outfile = HDfopen(file_name, "w")))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file")
HDsetbuf(trace_udata->outfile, NULL);
/* Write the header */
HDfprintf(trace_udata->outfile, "### HDF5 metadata cache trace file version 1 ###\n");
- done:
- if(file_name)
+done:
+ if (file_name)
H5MM_xfree(file_name);
/* Free and reset the log info struct on errors */
- if(FAIL == ret_value) {
+ if (FAIL == ret_value) {
/* Free */
- if(trace_udata && trace_udata->message)
+ if (trace_udata && trace_udata->message)
H5MM_xfree(trace_udata->message);
- if(trace_udata)
+ if (trace_udata)
H5MM_xfree(trace_udata);
/* Reset */
log_info->udata = NULL;
- log_info->cls = NULL;
+ log_info->cls = NULL;
}
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_trace_set_up() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_tear_down_logging
*
@@ -284,7 +288,7 @@ static herr_t
H5C__trace_tear_down_logging(H5C_log_info_t *log_info)
{
H5C_log_trace_udata_t *trace_udata = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -298,7 +302,7 @@ H5C__trace_tear_down_logging(H5C_log_info_t *log_info)
H5MM_xfree(trace_udata->message);
/* Close log file */
- if(EOF == HDfclose(trace_udata->outfile))
+ if (EOF == HDfclose(trace_udata->outfile))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file")
trace_udata->outfile = NULL;
@@ -306,14 +310,13 @@ H5C__trace_tear_down_logging(H5C_log_info_t *log_info)
H5MM_xfree(trace_udata);
/* Reset the log class info and udata */
- log_info->cls = NULL;
+ log_info->cls = NULL;
log_info->udata = NULL;
- done:
+done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_tear_down_logging() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_expunge_entry_log_msg
*
@@ -327,11 +330,10 @@ H5C__trace_tear_down_logging(H5C_log_info_t *log_info)
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__trace_write_expunge_entry_log_msg(void *udata, haddr_t address,
- int type_id, herr_t fxn_ret_value)
+H5C__trace_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id, herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -341,17 +343,16 @@ H5C__trace_write_expunge_entry_log_msg(void *udata, haddr_t address,
/* Create the log message string */
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_expunge_entry 0x%lx %d %d\n",
- (unsigned long)address, type_id, (int)fxn_ret_value);
+ (unsigned long)address, type_id, (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_expunge_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_flush_cache_log_msg
*
@@ -368,7 +369,7 @@ static herr_t
H5C__trace_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -377,18 +378,16 @@ H5C__trace_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value)
HDassert(trace_udata->message);
/* Create the log message string */
- HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_flush %d\n",
- (int)fxn_ret_value);
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_flush %d\n", (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_flush_cache_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_insert_entry_log_msg
*
@@ -402,11 +401,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__trace_write_insert_entry_log_msg(void *udata, haddr_t address,
- int type_id, unsigned flags, size_t size, herr_t fxn_ret_value)
+H5C__trace_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, size_t size,
+ herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -416,17 +415,16 @@ H5C__trace_write_insert_entry_log_msg(void *udata, haddr_t address,
/* Create the log message string */
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_insert_entry 0x%lx %d 0x%x %d %d\n",
- (unsigned long)address, type_id, flags, (int)size, (int)fxn_ret_value);
+ (unsigned long)address, type_id, flags, (int)size, (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_insert_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_mark_entry_dirty_log_msg
*
@@ -440,11 +438,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__trace_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+H5C__trace_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -455,17 +452,16 @@ H5C__trace_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *
/* Create the log message string */
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_dirty 0x%lx %d\n",
- (unsigned long)(entry->addr), (int)fxn_ret_value);
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_mark_entry_dirty_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_mark_entry_clean_log_msg
*
@@ -479,11 +475,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__trace_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+H5C__trace_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -494,17 +489,16 @@ H5C__trace_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *
/* Create the log message string */
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_clean 0x%lx %d\n",
- (unsigned long)(entry->addr), (int)fxn_ret_value);
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_mark_entry_clean_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_mark_unserialized_entry_log_msg
*
@@ -518,11 +512,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__trace_write_mark_unserialized_entry_log_msg(void *udata,
- const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
+H5C__trace_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -533,17 +527,16 @@ H5C__trace_write_mark_unserialized_entry_log_msg(void *udata,
/* Create the log message string */
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_unserialized 0x%lx %d\n",
- (unsigned long)(entry->addr), (int)fxn_ret_value);
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_mark_unserialized_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_mark_serialized_entry_log_msg
*
@@ -558,10 +551,10 @@ done:
*/
static herr_t
H5C__trace_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+ herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -572,17 +565,16 @@ H5C__trace_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entr
/* Create the log message string */
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_serialized 0x%lx %d\n",
- (unsigned long)(entry->addr), (int)fxn_ret_value);
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_mark_serialized_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_move_entry_log_msg
*
@@ -596,11 +588,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__trace_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr,
- int type_id, herr_t fxn_ret_value)
+H5C__trace_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id,
+ herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -610,17 +602,16 @@ H5C__trace_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_a
/* Create the log message string */
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_move_entry 0x%lx 0x%lx %d %d\n",
- (unsigned long)old_addr, (unsigned long)new_addr, type_id, (int)fxn_ret_value);
+ (unsigned long)old_addr, (unsigned long)new_addr, type_id, (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_move_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_pin_entry_log_msg
*
@@ -634,11 +625,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__trace_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+H5C__trace_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -649,17 +639,16 @@ H5C__trace_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
/* Create the log message string */
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_pin_protected_entry 0x%lx %d\n",
- (unsigned long)(entry->addr), (int)fxn_ret_value);
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_pin_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_create_fd_log_msg
*
@@ -675,10 +664,10 @@ done:
*/
static herr_t
H5C__trace_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
- const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -689,18 +678,18 @@ H5C__trace_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
HDassert(child);
/* Create the log message string */
- HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_create_flush_dependency 0x%lx 0x%lx %d\n",
- (unsigned long)(parent->addr), (unsigned long)(child->addr), (int)fxn_ret_value);
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE,
+ "H5AC_create_flush_dependency 0x%lx 0x%lx %d\n", (unsigned long)(parent->addr),
+ (unsigned long)(child->addr), (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_create_fd_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_protect_entry_log_msg
*
@@ -714,11 +703,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
- int type_id, unsigned flags, herr_t fxn_ret_value)
+H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id,
+ unsigned flags, herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -729,17 +718,16 @@ H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *ent
/* Create the log message string */
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_protect 0x%lx %d 0x%x %d %d\n",
- (unsigned long)(entry->addr), type_id, flags, (int)(entry->size), (int)fxn_ret_value);
+ (unsigned long)(entry->addr), type_id, flags, (int)(entry->size), (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_protect_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_resize_entry_log_msg
*
@@ -753,11 +741,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
- size_t new_size, herr_t fxn_ret_value)
+H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, size_t new_size,
+ herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -768,17 +756,16 @@ H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entr
/* Create the log message string */
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_resize_entry 0x%lx %d %d\n",
- (unsigned long)(entry->addr), (int)new_size, (int)fxn_ret_value);
+ (unsigned long)(entry->addr), (int)new_size, (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_resize_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_unpin_entry_log_msg
*
@@ -792,11 +779,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -807,17 +793,16 @@ H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry
/* Create the log message string */
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unpin_entry 0x%lx %d\n",
- (unsigned long)(entry->addr), (int)fxn_ret_value);
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_unpin_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_destroy_fd_log_msg
*
@@ -833,10 +818,10 @@ done:
*/
static herr_t
H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
- const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -847,18 +832,18 @@ H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent
HDassert(child);
/* Create the log message string */
- HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_destroy_flush_dependency 0x%lx 0x%lx %d\n",
- (unsigned long)(parent->addr), (unsigned long)(child->addr), (int)fxn_ret_value);
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE,
+ "H5AC_destroy_flush_dependency 0x%lx 0x%lx %d\n", (unsigned long)(parent->addr),
+ (unsigned long)(child->addr), (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_destroy_fd_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_unprotect_entry_log_msg
*
@@ -872,11 +857,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address,
- int type_id, unsigned flags, herr_t fxn_ret_value)
+H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags,
+ herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -886,17 +871,16 @@ H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address,
/* Create the log message string */
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unprotect 0x%lx %d 0x%x %d\n",
- (unsigned long)(address), type_id, flags, (int)fxn_ret_value);
+ (unsigned long)(address), type_id, flags, (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_unprotect_entry_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_set_cache_config_log_msg
*
@@ -911,10 +895,10 @@ done:
*/
static herr_t
H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config,
- herr_t fxn_ret_value)
+ herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -925,48 +909,28 @@ H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t
/* Create the log message string */
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE,
- "H5AC_set_cache_auto_resize_config %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f %d %d %d %f %f %d %d %d %d %f %zu %d %d\n",
- config->version,
- (int)(config->rpt_fcn_enabled),
- (int)(config->open_trace_file),
- (int)(config->close_trace_file),
- config->trace_file_name,
- (int)(config->evictions_enabled),
- (int)(config->set_initial_size),
- (int)(config->initial_size),
- config->min_clean_fraction,
- (int)(config->max_size),
- (int)(config->min_size),
- config->epoch_length,
- (int)(config->incr_mode),
- config->lower_hr_threshold,
- config->increment,
- (int)(config->flash_incr_mode),
- config->flash_multiple,
- config->flash_threshold,
- (int)(config->apply_max_increment),
- (int)(config->max_increment),
- (int)(config->decr_mode),
- config->upper_hr_threshold,
- config->decrement,
- (int)(config->apply_max_decrement),
- (int)(config->max_decrement),
- config->epochs_before_eviction,
- (int)(config->apply_empty_reserve),
- config->empty_reserve,
- config->dirty_bytes_threshold,
- config->metadata_write_strategy,
- (int)fxn_ret_value);
+ "H5AC_set_cache_auto_resize_config %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f "
+ "%d %d %d %f %f %d %d %d %d %f %zu %d %d\n",
+ config->version, (int)(config->rpt_fcn_enabled), (int)(config->open_trace_file),
+ (int)(config->close_trace_file), config->trace_file_name, (int)(config->evictions_enabled),
+ (int)(config->set_initial_size), (int)(config->initial_size), config->min_clean_fraction,
+ (int)(config->max_size), (int)(config->min_size), config->epoch_length,
+ (int)(config->incr_mode), config->lower_hr_threshold, config->increment,
+ (int)(config->flash_incr_mode), config->flash_multiple, config->flash_threshold,
+ (int)(config->apply_max_increment), (int)(config->max_increment), (int)(config->decr_mode),
+ config->upper_hr_threshold, config->decrement, (int)(config->apply_max_decrement),
+ (int)(config->max_decrement), config->epochs_before_eviction,
+ (int)(config->apply_empty_reserve), config->empty_reserve, config->dirty_bytes_threshold,
+ config->metadata_write_strategy, (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_set_cache_config_log_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5C__trace_write_remove_entry_log_msg
*
@@ -980,11 +944,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
- herr_t fxn_ret_value)
+H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -995,13 +958,12 @@ H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entr
/* Create the log message string */
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_remove_entry 0x%lx %d\n",
- (unsigned long)(entry->addr), (int)fxn_ret_value);
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
/* Write the log message to the file */
- if(H5C__trace_write_log_message(trace_udata) < 0)
+ if (H5C__trace_write_log_message(trace_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__trace_write_remove_entry_log_msg() */
-
diff --git a/src/H5Cmodule.h b/src/H5Cmodule.h
index 5b23490..bf0e24d 100644
--- a/src/H5Cmodule.h
+++ b/src/H5Cmodule.h
@@ -25,9 +25,8 @@
* reporting macros.
*/
#define H5C_MODULE
-#define H5_MY_PKG H5C
-#define H5_MY_PKG_ERR H5E_CACHE
-#define H5_MY_PKG_INIT NO
+#define H5_MY_PKG H5C
+#define H5_MY_PKG_ERR H5E_CACHE
+#define H5_MY_PKG_INIT NO
#endif /* _H5Cmodule_H */
-
diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c
index 9171cf7..4a3a2d8 100644
--- a/src/H5Cmpio.c
+++ b/src/H5Cmpio.c
@@ -27,22 +27,20 @@
/* Module Setup */
/****************/
-#include "H5Cmodule.h" /* This source code file is part of the H5C module */
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
-
+#include "H5Cmodule.h" /* This source code file is part of the H5C module */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Cpkg.h" /* Cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* Files */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5MMprivate.h" /* Memory management */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Cpkg.h" /* Cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5MMprivate.h" /* Memory management */
#ifdef H5_HAVE_PARALLEL
/****************/
@@ -50,38 +48,31 @@
/****************/
#define H5C_APPLY_CANDIDATE_LIST__DEBUG 0
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
static herr_t H5C__collective_write(H5F_t *f);
static herr_t H5C__flush_candidate_entries(H5F_t *f, unsigned entries_to_flush[H5C_RING_NTYPES],
- unsigned entries_to_clear[H5C_RING_NTYPES]);
-static herr_t H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring,
- unsigned entries_to_flush, unsigned entries_to_clear);
-
+ unsigned entries_to_clear[H5C_RING_NTYPES]);
+static herr_t H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flush,
+ unsigned entries_to_clear);
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5C_apply_candidate_list
*
@@ -163,43 +154,39 @@ static herr_t H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring,
* Programmer: John Mainzer
* 3/17/10
*
- * Changes: Updated sanity checks to allow for the possibility that
+ * Changes: Updated sanity checks to allow for the possibility that
* the slist is disabled.
* JRM -- 8/3/20
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C_apply_candidate_list(H5F_t * f,
- H5C_t * cache_ptr,
- unsigned num_candidates,
- haddr_t * candidates_list_ptr,
- int mpi_rank,
- int mpi_size)
+H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, haddr_t *candidates_list_ptr,
+ int mpi_rank, int mpi_size)
{
- int i;
- int m;
- unsigned n;
- unsigned first_entry_to_flush;
- unsigned last_entry_to_flush;
- unsigned total_entries_to_clear = 0;
- unsigned total_entries_to_flush = 0;
- unsigned * candidate_assignment_table = NULL;
- unsigned entries_to_flush[H5C_RING_NTYPES];
- unsigned entries_to_clear[H5C_RING_NTYPES];
- haddr_t addr;
- H5C_cache_entry_t * entry_ptr = NULL;
+ int i;
+ int m;
+ unsigned n;
+ unsigned first_entry_to_flush;
+ unsigned last_entry_to_flush;
+ unsigned total_entries_to_clear = 0;
+ unsigned total_entries_to_flush = 0;
+ unsigned * candidate_assignment_table = NULL;
+ unsigned entries_to_flush[H5C_RING_NTYPES];
+ unsigned entries_to_clear[H5C_RING_NTYPES];
+ haddr_t addr;
+ H5C_cache_entry_t *entry_ptr = NULL;
#if H5C_DO_SANITY_CHECKS
- haddr_t last_addr;
+ haddr_t last_addr;
#endif /* H5C_DO_SANITY_CHECKS */
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
- char tbl_buf[1024];
+ char tbl_buf[1024];
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -207,8 +194,7 @@ H5C_apply_candidate_list(H5F_t * f,
HDassert(cache_ptr != NULL);
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
HDassert(num_candidates > 0);
- HDassert( ( ! cache_ptr->slist_enabled ) ||
- ( num_candidates <= cache_ptr->slist_len ));
+ HDassert((!cache_ptr->slist_enabled) || (num_candidates <= cache_ptr->slist_len));
HDassert(candidates_list_ptr != NULL);
HDassert(0 <= mpi_rank);
HDassert(mpi_rank < mpi_size);
@@ -223,93 +209,95 @@ H5C_apply_candidate_list(H5F_t * f,
HDmemset(tbl_buf, 0, sizeof(tbl_buf));
HDsprintf(&(tbl_buf[0]), "candidate list = ");
- for(u = 0; u < num_candidates; u++)
+ for (u = 0; u < num_candidates; u++)
HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " 0x%llx", (long long)(*(candidates_list_ptr + u)));
HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
HDfprintf(stdout, "%s", tbl_buf);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
- if(f->shared->coll_md_write) {
+ if (f->shared->coll_md_write) {
/* Sanity check */
HDassert(NULL == cache_ptr->coll_write_list);
/* Create skip list of entries for collective write */
- if(NULL == (cache_ptr->coll_write_list = H5SL_create(H5SL_TYPE_HADDR, NULL)))
+ if (NULL == (cache_ptr->coll_write_list = H5SL_create(H5SL_TYPE_HADDR, NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for entries")
} /* end if */
n = num_candidates / (unsigned)mpi_size;
- if(num_candidates % (unsigned)mpi_size > INT_MAX)
+ if (num_candidates % (unsigned)mpi_size > INT_MAX)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "m overflow")
m = (int)(num_candidates % (unsigned)mpi_size);
- if(NULL == (candidate_assignment_table = (unsigned *)H5MM_malloc(sizeof(unsigned) * (size_t)(mpi_size + 1))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for candidate assignment table")
+ if (NULL ==
+ (candidate_assignment_table = (unsigned *)H5MM_malloc(sizeof(unsigned) * (size_t)(mpi_size + 1))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory allocation failed for candidate assignment table")
- candidate_assignment_table[0] = 0;
+ candidate_assignment_table[0] = 0;
candidate_assignment_table[mpi_size] = num_candidates;
- if(m == 0) { /* mpi_size is an even divisor of num_candidates */
- for(i = 1; i < mpi_size; i++)
+ if (m == 0) { /* mpi_size is an even divisor of num_candidates */
+ for (i = 1; i < mpi_size; i++)
candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n;
} /* end if */
else {
- for(i = 1; i <= m; i++)
+ for (i = 1; i <= m; i++)
candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n + 1;
- if(num_candidates < (unsigned)mpi_size) {
- for(i = m + 1; i < mpi_size; i++)
+ if (num_candidates < (unsigned)mpi_size) {
+ for (i = m + 1; i < mpi_size; i++)
candidate_assignment_table[i] = num_candidates;
} /* end if */
else {
- for(i = m + 1; i < mpi_size; i++)
+ for (i = m + 1; i < mpi_size; i++)
candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n;
} /* end else */
- } /* end else */
+ } /* end else */
HDassert((candidate_assignment_table[mpi_size - 1] + n) == num_candidates);
#if H5C_DO_SANITY_CHECKS
/* Verify that the candidate assignment table has the expected form */
- for(i = 1; i < mpi_size - 1; i++) {
+ for (i = 1; i < mpi_size - 1; i++) {
unsigned a, b;
a = candidate_assignment_table[i] - candidate_assignment_table[i - 1];
b = candidate_assignment_table[i + 1] - candidate_assignment_table[i];
- HDassert( n + 1 >= a );
- HDassert( a >= b );
- HDassert( b >= n );
+ HDassert(n + 1 >= a);
+ HDassert(a >= b);
+ HDassert(b >= n);
}
#endif /* H5C_DO_SANITY_CHECKS */
first_entry_to_flush = candidate_assignment_table[mpi_rank];
- last_entry_to_flush = candidate_assignment_table[mpi_rank + 1] - 1;
+ last_entry_to_flush = candidate_assignment_table[mpi_rank + 1] - 1;
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
- for ( i = 0; i < 1024; i++ )
+ for (i = 0; i < 1024; i++)
tbl_buf[i] = '\0';
HDsprintf(&(tbl_buf[0]), "candidate assignment table = ");
- for(i = 0; i <= mpi_size; i++)
+ for (i = 0; i <= mpi_size; i++)
HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %u", candidate_assignment_table[i]);
HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
HDfprintf(stdout, "%s", tbl_buf);
- HDfprintf(stdout, "%s:%d: flush entries [%u, %u].\n",
- FUNC, mpi_rank, first_entry_to_flush, last_entry_to_flush);
+ HDfprintf(stdout, "%s:%d: flush entries [%u, %u].\n", FUNC, mpi_rank, first_entry_to_flush,
+ last_entry_to_flush);
HDfprintf(stdout, "%s:%d: marking entries.\n", FUNC, mpi_rank);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
- for(u = 0; u < num_candidates; u++) {
+ for (u = 0; u < num_candidates; u++) {
addr = candidates_list_ptr[u];
HDassert(H5F_addr_defined(addr));
#if H5C_DO_SANITY_CHECKS
- if(u > 0) {
- if(last_addr == addr)
+ if (u > 0) {
+ if (last_addr == addr)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "duplicate entry in cleaned list")
- else if(last_addr > addr)
+ else if (last_addr > addr)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "candidate list not sorted")
} /* end if */
@@ -317,11 +305,11 @@ H5C_apply_candidate_list(H5F_t * f,
#endif /* H5C_DO_SANITY_CHECKS */
H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL)
- if(entry_ptr == NULL)
+ if (entry_ptr == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "listed candidate entry not in cache?!?!?")
- if(!entry_ptr->is_dirty)
+ if (!entry_ptr->is_dirty)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not dirty?!?!?")
- if(entry_ptr->is_protected)
+ if (entry_ptr->is_protected)
/* For now at least, we can't deal with protected entries.
* If we encounter one, scream and die. If it becomes an
* issue, we should be able to work around this.
@@ -340,7 +328,7 @@ H5C_apply_candidate_list(H5F_t * f,
* pinned list shortly, and clear or flush according to these
* markings.
*/
- if(u >= first_entry_to_flush && u <= last_entry_to_flush) {
+ if (u >= first_entry_to_flush && u <= last_entry_to_flush) {
total_entries_to_flush++;
entries_to_flush[entry_ptr->ring]++;
entry_ptr->flush_immediately = TRUE;
@@ -357,16 +345,16 @@ H5C_apply_candidate_list(H5F_t * f,
* candidate list is collective and uniform across all
* ranks.
*/
- if(entry_ptr->coll_access) {
+ if (entry_ptr->coll_access) {
entry_ptr->coll_access = FALSE;
H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL)
} /* end if */
- } /* end for */
+ } /* end for */
#if H5C_DO_SANITY_CHECKS
m = 0;
n = 0;
- for(i = 0; i < H5C_RING_NTYPES; i++) {
+ for (i = 0; i < H5C_RING_NTYPES; i++) {
m += (int)entries_to_flush[i];
n += entries_to_clear[i];
} /* end if */
@@ -376,9 +364,8 @@ H5C_apply_candidate_list(H5F_t * f,
#endif /* H5C_DO_SANITY_CHECKS */
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
- HDfprintf(stdout, "%s:%d: num candidates/to clear/to flush = %u/%u/%u.\n",
- FUNC, mpi_rank, num_candidates, total_entries_to_clear,
- total_entries_to_flush);
+ HDfprintf(stdout, "%s:%d: num candidates/to clear/to flush = %u/%u/%u.\n", FUNC, mpi_rank, num_candidates,
+ total_entries_to_clear, total_entries_to_flush);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
/* We have now marked all the entries on the candidate list for
@@ -391,24 +378,24 @@ H5C_apply_candidate_list(H5F_t * f,
* If we don't do this, my experiments indicate that we will have a
* noticeably poorer hit ratio as a result.
*/
- if(H5C__flush_candidate_entries(f, entries_to_flush, entries_to_clear) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush candidates failed")
+ if (H5C__flush_candidate_entries(f, entries_to_flush, entries_to_clear) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush candidates failed")
/* If we've deferred writing to do it collectively, take care of that now */
- if(f->shared->coll_md_write) {
+ if (f->shared->coll_md_write) {
/* Sanity check */
HDassert(cache_ptr->coll_write_list);
/* Write collective list */
- if(H5C__collective_write(f) < 0)
+ if (H5C__collective_write(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "can't write metadata collectively")
} /* end if */
done:
- if(candidate_assignment_table != NULL)
+ if (candidate_assignment_table != NULL)
candidate_assignment_table = (unsigned *)H5MM_xfree((void *)candidate_assignment_table);
- if(cache_ptr->coll_write_list) {
- if(H5SL_close(cache_ptr->coll_write_list) < 0)
+ if (cache_ptr->coll_write_list) {
+ if (H5SL_close(cache_ptr->coll_write_list) < 0)
HDONE_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "failed to destroy skip list")
cache_ptr->coll_write_list = NULL;
} /* end if */
@@ -416,7 +403,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_apply_candidate_list() */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_construct_candidate_list__clean_cache
@@ -436,82 +422,73 @@ done:
*
* Changes: With the slist optimization, the slist is not maintained
* unless a flush is in progress. Thus we can not longer use
- * cache_ptr->slist_size to determine the total size of
+ * cache_ptr->slist_size to determine the total size of
* the entries we must insert in the candidate list.
*
* To address this, we now use cache_ptr->dirty_index_size
- * instead.
+ * instead.
*
* JRM -- 7/27/20
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C_construct_candidate_list__clean_cache(H5C_t * cache_ptr)
+H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr)
{
- size_t space_needed;
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t space_needed;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- HDassert( cache_ptr != NULL );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
+ HDassert(cache_ptr != NULL);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* As a sanity check, set space needed to the dirty_index_size. This
* should be the sum total of the sizes of all the dirty entries
- * in the metadata cache. Note that if the slist is enabled,
+ * in the metadata cache. Note that if the slist is enabled,
* cache_ptr->slist_size should equal cache_ptr->dirty_index_size.
*/
space_needed = cache_ptr->dirty_index_size;
- HDassert( ( ! cache_ptr->slist_enabled ) ||
- ( space_needed == cache_ptr->slist_size ) );
-
+ HDassert((!cache_ptr->slist_enabled) || (space_needed == cache_ptr->slist_size));
/* Recall that while we shouldn't have any protected entries at this
* point, it is possible that some dirty entries may reside on the
* pinned list at this point.
*/
- HDassert( cache_ptr->dirty_index_size <=
- (cache_ptr->dLRU_list_size + cache_ptr->pel_size) );
- HDassert( ( ! cache_ptr->slist_enabled ) ||
- ( cache_ptr->slist_len <=
- (cache_ptr->dLRU_list_len + cache_ptr->pel_len) ) );
-
+ HDassert(cache_ptr->dirty_index_size <= (cache_ptr->dLRU_list_size + cache_ptr->pel_size));
+ HDassert((!cache_ptr->slist_enabled) ||
+ (cache_ptr->slist_len <= (cache_ptr->dLRU_list_len + cache_ptr->pel_len)));
- if(space_needed > 0) { /* we have work to do */
+ if (space_needed > 0) { /* we have work to do */
H5C_cache_entry_t *entry_ptr;
- unsigned nominated_entries_count = 0;
- size_t nominated_entries_size = 0;
- haddr_t nominated_addr;
+ unsigned nominated_entries_count = 0;
+ size_t nominated_entries_size = 0;
+ haddr_t nominated_addr;
- HDassert( ( ! cache_ptr->slist_enabled ) ||
- ( cache_ptr->slist_len > 0 ) );
+ HDassert((!cache_ptr->slist_enabled) || (cache_ptr->slist_len > 0));
/* Scan the dirty LRU list from tail forward and nominate sufficient
* entries to free up the necessary space.
*/
entry_ptr = cache_ptr->dLRU_tail_ptr;
- while ( ( nominated_entries_size < space_needed ) &&
- ( ( ! cache_ptr->slist_enabled ) ||
- ( nominated_entries_count < cache_ptr->slist_len ) ) &&
- ( entry_ptr != NULL ) ) {
+ while ((nominated_entries_size < space_needed) &&
+ ((!cache_ptr->slist_enabled) || (nominated_entries_count < cache_ptr->slist_len)) &&
+ (entry_ptr != NULL)) {
- HDassert( ! (entry_ptr->is_protected) );
- HDassert( ! (entry_ptr->is_read_only) );
- HDassert( entry_ptr->ro_ref_count == 0 );
- HDassert( entry_ptr->is_dirty );
- HDassert( ( ! cache_ptr->slist_enabled ) ||
- ( entry_ptr->in_slist ) );
+ HDassert(!(entry_ptr->is_protected));
+ HDassert(!(entry_ptr->is_read_only));
+ HDassert(entry_ptr->ro_ref_count == 0);
+ HDassert(entry_ptr->is_dirty);
+ HDassert((!cache_ptr->slist_enabled) || (entry_ptr->in_slist));
nominated_addr = entry_ptr->addr;
- if(H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0)
+ if (H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "H5AC_add_candidate() failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed")
nominated_entries_size += entry_ptr->size;
nominated_entries_count++;
@@ -519,32 +496,30 @@ H5C_construct_candidate_list__clean_cache(H5C_t * cache_ptr)
} /* end while */
- HDassert( entry_ptr == NULL );
+ HDassert(entry_ptr == NULL);
/* it is possible that there are some dirty entries on the
* protected entry list as well -- scan it too if necessary
*/
entry_ptr = cache_ptr->pel_head_ptr;
- while ( ( nominated_entries_size < space_needed ) &&
- ( ( ! cache_ptr->slist_enabled ) ||
- ( nominated_entries_count < cache_ptr->slist_len ) ) &&
- ( entry_ptr != NULL ) ) {
+ while ((nominated_entries_size < space_needed) &&
+ ((!cache_ptr->slist_enabled) || (nominated_entries_count < cache_ptr->slist_len)) &&
+ (entry_ptr != NULL)) {
- if(entry_ptr->is_dirty) {
+ if (entry_ptr->is_dirty) {
- HDassert( ! (entry_ptr->is_protected) );
- HDassert( ! (entry_ptr->is_read_only) );
- HDassert( entry_ptr->ro_ref_count == 0 );
- HDassert( entry_ptr->is_dirty );
- HDassert( entry_ptr->in_slist );
+ HDassert(!(entry_ptr->is_protected));
+ HDassert(!(entry_ptr->is_read_only));
+ HDassert(entry_ptr->ro_ref_count == 0);
+ HDassert(entry_ptr->is_dirty);
+ HDassert(entry_ptr->in_slist);
nominated_addr = entry_ptr->addr;
- if(H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0)
+ if (H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "H5AC_add_candidate() failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed")
nominated_entries_size += entry_ptr->size;
nominated_entries_count++;
@@ -555,9 +530,8 @@ H5C_construct_candidate_list__clean_cache(H5C_t * cache_ptr)
} /* end while */
- HDassert( ( ! cache_ptr->slist_enabled ) ||
- ( nominated_entries_count == cache_ptr->slist_len ) );
- HDassert( nominated_entries_size == space_needed );
+ HDassert((!cache_ptr->slist_enabled) || (nominated_entries_count == cache_ptr->slist_len));
+ HDassert(nominated_entries_size == space_needed);
} /* end if */
@@ -567,7 +541,6 @@ done:
} /* H5C_construct_candidate_list__clean_cache() */
-
/*-------------------------------------------------------------------------
* Function: H5C_construct_candidate_list__min_clean
*
@@ -585,7 +558,7 @@ done:
* 3/17/10
*
* Changes: With the slist optimization, the slist is not maintained
- * unless a flush is in progress. Updated sanity checks to
+ * unless a flush is in progress. Updated sanity checks to
* reflect this.
*
* JRM -- 7/27/20
@@ -593,81 +566,74 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_construct_candidate_list__min_clean(H5C_t * cache_ptr)
+H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr)
{
- size_t space_needed = 0;
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t space_needed = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- HDassert( cache_ptr != NULL );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
+ HDassert(cache_ptr != NULL);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* compute the number of bytes (if any) that must be flushed to get the
* cache back within its min clean constraints.
*/
- if(cache_ptr->max_cache_size > cache_ptr->index_size) {
+ if (cache_ptr->max_cache_size > cache_ptr->index_size) {
- if ( ( (cache_ptr->max_cache_size - cache_ptr->index_size) +
- cache_ptr->cLRU_list_size) >= cache_ptr->min_clean_size ) {
-
- space_needed = 0;
+ if (((cache_ptr->max_cache_size - cache_ptr->index_size) + cache_ptr->cLRU_list_size) >=
+ cache_ptr->min_clean_size) {
- } else {
+ space_needed = 0;
+ }
+ else {
space_needed = cache_ptr->min_clean_size -
- ((cache_ptr->max_cache_size - cache_ptr->index_size) +
- cache_ptr->cLRU_list_size);
+ ((cache_ptr->max_cache_size - cache_ptr->index_size) + cache_ptr->cLRU_list_size);
}
} /* end if */
else {
- if(cache_ptr->min_clean_size <= cache_ptr->cLRU_list_size) {
+ if (cache_ptr->min_clean_size <= cache_ptr->cLRU_list_size) {
- space_needed = 0;
-
- } else {
+ space_needed = 0;
+ }
+ else {
- space_needed = cache_ptr->min_clean_size -
- cache_ptr->cLRU_list_size;
+ space_needed = cache_ptr->min_clean_size - cache_ptr->cLRU_list_size;
}
} /* end else */
- if(space_needed > 0) { /* we have work to do */
+ if (space_needed > 0) { /* we have work to do */
H5C_cache_entry_t *entry_ptr;
- unsigned nominated_entries_count = 0;
- size_t nominated_entries_size = 0;
+ unsigned nominated_entries_count = 0;
+ size_t nominated_entries_size = 0;
- HDassert( ( ! cache_ptr->slist_enabled ) ||
- ( cache_ptr->slist_len > 0 ) );
+ HDassert((!cache_ptr->slist_enabled) || (cache_ptr->slist_len > 0));
/* Scan the dirty LRU list from tail forward and nominate sufficient
* entries to free up the necessary space.
*/
entry_ptr = cache_ptr->dLRU_tail_ptr;
- while ( ( nominated_entries_size < space_needed ) &&
- ( ( ! cache_ptr->slist_enabled ) ||
- ( nominated_entries_count < cache_ptr->slist_len ) ) &&
- ( entry_ptr != NULL ) &&
- ( ! entry_ptr->flush_me_last ) ) {
+ while ((nominated_entries_size < space_needed) &&
+ ((!cache_ptr->slist_enabled) || (nominated_entries_count < cache_ptr->slist_len)) &&
+ (entry_ptr != NULL) && (!entry_ptr->flush_me_last)) {
- haddr_t nominated_addr;
+ haddr_t nominated_addr;
- HDassert( ! (entry_ptr->is_protected) );
- HDassert( ! (entry_ptr->is_read_only) );
- HDassert( entry_ptr->ro_ref_count == 0 );
- HDassert( entry_ptr->is_dirty );
- HDassert( ( ! cache_ptr->slist_enabled ) ||
- ( entry_ptr->in_slist ) );
+ HDassert(!(entry_ptr->is_protected));
+ HDassert(!(entry_ptr->is_read_only));
+ HDassert(entry_ptr->ro_ref_count == 0);
+ HDassert(entry_ptr->is_dirty);
+ HDassert((!cache_ptr->slist_enabled) || (entry_ptr->in_slist));
nominated_addr = entry_ptr->addr;
- if(H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0)
+ if (H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "H5AC_add_candidate() failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed")
nominated_entries_size += entry_ptr->size;
nominated_entries_count++;
@@ -675,17 +641,15 @@ H5C_construct_candidate_list__min_clean(H5C_t * cache_ptr)
} /* end while */
- HDassert( ( ! cache_ptr->slist_enabled ) ||
- ( nominated_entries_count <= cache_ptr->slist_len ) );
- HDassert( nominated_entries_size <= cache_ptr->dirty_index_size );
- HDassert( nominated_entries_size >= space_needed );
+ HDassert((!cache_ptr->slist_enabled) || (nominated_entries_count <= cache_ptr->slist_len));
+ HDassert(nominated_entries_size <= cache_ptr->dirty_index_size);
+ HDassert(nominated_entries_size >= space_needed);
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_construct_candidate_list__min_clean() */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_mark_entries_as_clean
@@ -718,84 +682,77 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_mark_entries_as_clean(H5F_t * f,
- unsigned ce_array_len,
- haddr_t * ce_array_ptr)
+H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr)
{
- H5C_t * cache_ptr;
- unsigned entries_cleared;
- unsigned pinned_entries_cleared;
- hbool_t progress;
- unsigned entries_examined;
- unsigned initial_list_len;
- haddr_t addr;
- unsigned pinned_entries_marked = 0;
+ H5C_t * cache_ptr;
+ unsigned entries_cleared;
+ unsigned pinned_entries_cleared;
+ hbool_t progress;
+ unsigned entries_examined;
+ unsigned initial_list_len;
+ haddr_t addr;
+ unsigned pinned_entries_marked = 0;
#if H5C_DO_SANITY_CHECKS
- unsigned protected_entries_marked = 0;
- unsigned other_entries_marked = 0;
- haddr_t last_addr;
+ unsigned protected_entries_marked = 0;
+ unsigned other_entries_marked = 0;
+ haddr_t last_addr;
#endif /* H5C_DO_SANITY_CHECKS */
- H5C_cache_entry_t * clear_ptr = NULL;
- H5C_cache_entry_t * entry_ptr = NULL;
- unsigned u;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_cache_entry_t *clear_ptr = NULL;
+ H5C_cache_entry_t *entry_ptr = NULL;
+ unsigned u;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- HDassert( f );
- HDassert( f->shared );
+ HDassert(f);
+ HDassert(f->shared);
cache_ptr = f->shared->cache;
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert( ce_array_len > 0 );
- HDassert( ce_array_ptr != NULL );
+ HDassert(ce_array_len > 0);
+ HDassert(ce_array_ptr != NULL);
#if H5C_DO_EXTREME_SANITY_CHECKS
- if(H5C_validate_protected_entry_list(cache_ptr) < 0 ||
- H5C_validate_pinned_entry_list(cache_ptr) < 0 ||
- H5C_validate_lru_list(cache_ptr) < 0)
+ if (H5C_validate_protected_entry_list(cache_ptr) < 0 || H5C_validate_pinned_entry_list(cache_ptr) < 0 ||
+ H5C_validate_lru_list(cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
- for(u = 0; u < ce_array_len; u++) {
+ for (u = 0; u < ce_array_len; u++) {
addr = ce_array_ptr[u];
#if H5C_DO_SANITY_CHECKS
- if(u == 0)
+ if (u == 0)
last_addr = addr;
else {
- if(last_addr == addr)
+ if (last_addr == addr)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Duplicate entry in cleaned list")
- if(last_addr > addr)
+ if (last_addr > addr)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "cleaned list not sorted")
} /* end else */
#if H5C_DO_EXTREME_SANITY_CHECKS
- if(H5C_validate_protected_entry_list(cache_ptr) < 0
- || H5C_validate_pinned_entry_list(cache_ptr) < 0
- || H5C_validate_lru_list(cache_ptr) < 0)
+ if (H5C_validate_protected_entry_list(cache_ptr) < 0 ||
+ H5C_validate_pinned_entry_list(cache_ptr) < 0 || H5C_validate_lru_list(cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed in for loop")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
#endif /* H5C_DO_SANITY_CHECKS */
- HDassert( H5F_addr_defined(addr) );
+ HDassert(H5F_addr_defined(addr));
H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL)
- if(entry_ptr == NULL) {
+ if (entry_ptr == NULL) {
#if H5C_DO_SANITY_CHECKS
- HDfprintf(stdout,
- "H5C_mark_entries_as_clean: entry[%u] = %" PRIuHADDR
- " not in cache.\n", u, addr);
+ HDfprintf(stdout, "H5C_mark_entries_as_clean: entry[%u] = %" PRIuHADDR " not in cache.\n", u,
+ addr);
#endif /* H5C_DO_SANITY_CHECKS */
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not in cache?!?!?")
} /* end if */
- else if(!entry_ptr->is_dirty) {
+ else if (!entry_ptr->is_dirty) {
#if H5C_DO_SANITY_CHECKS
- HDfprintf(stdout,
- "H5C_mark_entries_as_clean: entry %" PRIuHADDR
- " is not dirty!?!\n", addr);
+ HDfprintf(stdout, "H5C_mark_entries_as_clean: entry %" PRIuHADDR " is not dirty!?!\n", addr);
#endif /* H5C_DO_SANITY_CHECKS */
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not dirty?!?!?")
} /* end else-if */
@@ -807,16 +764,16 @@ H5C_mark_entries_as_clean(H5F_t * f,
/* Make sure first that we clear the collective flag from
it so it can be cleared */
- if(TRUE == entry_ptr->coll_access) {
+ if (TRUE == entry_ptr->coll_access) {
entry_ptr->coll_access = FALSE;
H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL)
} /* end if */
entry_ptr->clear_on_unprotect = TRUE;
- if(entry_ptr->is_pinned)
+ if (entry_ptr->is_pinned)
pinned_entries_marked++;
#if H5C_DO_SANITY_CHECKS
- else if(entry_ptr->is_protected)
+ else if (entry_ptr->is_protected)
protected_entries_marked++;
else
other_entries_marked++;
@@ -849,20 +806,20 @@ H5C_mark_entries_as_clean(H5F_t * f,
* point.
* JRM -- 4/7/15
*/
- entries_cleared = 0;
+ entries_cleared = 0;
entries_examined = 0;
initial_list_len = cache_ptr->LRU_list_len;
- entry_ptr = cache_ptr->LRU_tail_ptr;
- while(entry_ptr != NULL && entries_examined <= initial_list_len &&
- entries_cleared < ce_array_len) {
- if(entry_ptr->clear_on_unprotect) {
+ entry_ptr = cache_ptr->LRU_tail_ptr;
+ while (entry_ptr != NULL && entries_examined <= initial_list_len && entries_cleared < ce_array_len) {
+ if (entry_ptr->clear_on_unprotect) {
entry_ptr->clear_on_unprotect = FALSE;
- clear_ptr = entry_ptr;
- entry_ptr = entry_ptr->prev;
+ clear_ptr = entry_ptr;
+ entry_ptr = entry_ptr->prev;
entries_cleared++;
- if(H5C__flush_single_entry(f, clear_ptr,
- (H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__GENERATE_IMAGE_FLAG | H5C__UPDATE_PAGE_BUFFER_FLAG)) < 0)
+ if (H5C__flush_single_entry(f, clear_ptr,
+ (H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__GENERATE_IMAGE_FLAG |
+ H5C__UPDATE_PAGE_BUFFER_FLAG)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear entry")
} /* end if */
else
@@ -871,69 +828,66 @@ H5C_mark_entries_as_clean(H5F_t * f,
} /* end while */
#if H5C_DO_SANITY_CHECKS
- HDassert( entries_cleared == other_entries_marked );
+ HDassert(entries_cleared == other_entries_marked);
#endif /* H5C_DO_SANITY_CHECKS */
/* It is also possible that some of the cleared entries are on the
* pinned list. Must scan that also.
*/
pinned_entries_cleared = 0;
- progress = TRUE;
- while((pinned_entries_cleared < pinned_entries_marked) && progress) {
- progress = FALSE;
+ progress = TRUE;
+ while ((pinned_entries_cleared < pinned_entries_marked) && progress) {
+ progress = FALSE;
entry_ptr = cache_ptr->pel_head_ptr;
- while(entry_ptr != NULL) {
- if(entry_ptr->clear_on_unprotect && entry_ptr->flush_dep_ndirty_children == 0) {
+ while (entry_ptr != NULL) {
+ if (entry_ptr->clear_on_unprotect && entry_ptr->flush_dep_ndirty_children == 0) {
entry_ptr->clear_on_unprotect = FALSE;
- clear_ptr = entry_ptr;
- entry_ptr = entry_ptr->next;
+ clear_ptr = entry_ptr;
+ entry_ptr = entry_ptr->next;
entries_cleared++;
pinned_entries_cleared++;
progress = TRUE;
- if(H5C__flush_single_entry(f, clear_ptr,
- (H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__GENERATE_IMAGE_FLAG | H5C__UPDATE_PAGE_BUFFER_FLAG)) < 0)
+ if (H5C__flush_single_entry(f, clear_ptr,
+ (H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__GENERATE_IMAGE_FLAG |
+ H5C__UPDATE_PAGE_BUFFER_FLAG)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear entry")
} /* end if */
else
entry_ptr = entry_ptr->next;
- } /* end while */
- } /* end while */
+ } /* end while */
+ } /* end while */
#if H5C_DO_SANITY_CHECKS
- HDassert( entries_cleared == pinned_entries_marked + other_entries_marked );
- HDassert( entries_cleared + protected_entries_marked == ce_array_len );
+ HDassert(entries_cleared == pinned_entries_marked + other_entries_marked);
+ HDassert(entries_cleared + protected_entries_marked == ce_array_len);
#endif /* H5C_DO_SANITY_CHECKS */
- HDassert( ( entries_cleared == ce_array_len ) ||
- ( (ce_array_len - entries_cleared) <= cache_ptr->pl_len ) );
+ HDassert((entries_cleared == ce_array_len) || ((ce_array_len - entries_cleared) <= cache_ptr->pl_len));
#if H5C_DO_SANITY_CHECKS
- u = 0;
+ u = 0;
entry_ptr = cache_ptr->pl_head_ptr;
- while ( entry_ptr != NULL )
- {
- if ( entry_ptr->clear_on_unprotect ) {
+ while (entry_ptr != NULL) {
+ if (entry_ptr->clear_on_unprotect) {
u++;
}
entry_ptr = entry_ptr->next;
}
- HDassert( (entries_cleared + u) == ce_array_len );
+ HDassert((entries_cleared + u) == ce_array_len);
#endif /* H5C_DO_SANITY_CHECKS */
done:
#if H5C_DO_EXTREME_SANITY_CHECKS
- if(H5C_validate_protected_entry_list(cache_ptr) < 0
- || H5C_validate_pinned_entry_list(cache_ptr) < 0
- || H5C_validate_lru_list(cache_ptr) < 0)
+ if (H5C_validate_protected_entry_list(cache_ptr) < 0 || H5C_validate_pinned_entry_list(cache_ptr) < 0 ||
+ H5C_validate_lru_list(cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_mark_entries_as_clean() */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_clear_coll_entries
@@ -951,15 +905,15 @@ done:
herr_t
H5C_clear_coll_entries(H5C_t *cache_ptr, hbool_t partial)
{
- uint32_t clear_cnt;
- H5C_cache_entry_t * entry_ptr = NULL;
- herr_t ret_value = SUCCEED;
+ uint32_t clear_cnt;
+ H5C_cache_entry_t *entry_ptr = NULL;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
entry_ptr = cache_ptr->coll_tail_ptr;
clear_cnt = (partial ? cache_ptr->coll_list_len / 2 : cache_ptr->coll_list_len);
- while(entry_ptr && clear_cnt > 0) {
+ while (entry_ptr && clear_cnt > 0) {
H5C_cache_entry_t *prev_ptr = entry_ptr->coll_prev;
/* Sanity check */
@@ -980,7 +934,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_clear_coll_entries */
-
/*-------------------------------------------------------------------------
*
* Function: H5C__collective_write
@@ -997,21 +950,21 @@ done:
static herr_t
H5C__collective_write(H5F_t *f)
{
- H5AC_t *cache_ptr;
- H5FD_mpio_xfer_t orig_xfer_mode = H5FD_MPIO_COLLECTIVE;
- void *base_buf;
- int count;
- int *length_array = NULL;
- MPI_Aint *buf_array = NULL;
- MPI_Aint *offset_array = NULL;
- MPI_Datatype btype;
- hbool_t btype_created = FALSE;
- MPI_Datatype ftype;
- hbool_t ftype_created = FALSE;
- int mpi_code;
- char unused = 0; /* Unused, except for non-NULL pointer value */
- size_t buf_count;
- herr_t ret_value = SUCCEED;
+ H5AC_t * cache_ptr;
+ H5FD_mpio_xfer_t orig_xfer_mode = H5FD_MPIO_COLLECTIVE;
+ void * base_buf;
+ int count;
+ int * length_array = NULL;
+ MPI_Aint * buf_array = NULL;
+ MPI_Aint * offset_array = NULL;
+ MPI_Datatype btype;
+ hbool_t btype_created = FALSE;
+ MPI_Datatype ftype;
+ hbool_t ftype_created = FALSE;
+ int mpi_code;
+ char unused = 0; /* Unused, except for non-NULL pointer value */
+ size_t buf_count;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1022,49 +975,52 @@ H5C__collective_write(H5F_t *f)
HDassert(cache_ptr->coll_write_list != NULL);
/* Get original transfer mode */
- if(H5CX_get_io_xfer_mode(&orig_xfer_mode) < 0)
+ if (H5CX_get_io_xfer_mode(&orig_xfer_mode) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode")
/* Set transfer mode */
- if(H5CX_set_io_xfer_mode(H5FD_MPIO_COLLECTIVE) < 0)
+ if (H5CX_set_io_xfer_mode(H5FD_MPIO_COLLECTIVE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode")
/* Get number of entries in collective write list */
count = (int)H5SL_count(cache_ptr->coll_write_list);
- if(count > 0) {
- H5SL_node_t *node;
- H5C_cache_entry_t *entry_ptr;
- int i;
+ if (count > 0) {
+ H5SL_node_t * node;
+ H5C_cache_entry_t *entry_ptr;
+ int i;
/* Allocate arrays */
- if(NULL == (length_array = (int *)H5MM_malloc((size_t)count * sizeof(int))) )
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for collective write table length array")
- if(NULL == (buf_array = (MPI_Aint *)H5MM_malloc((size_t)count * sizeof(MPI_Aint))) )
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for collective buf table length array")
- if(NULL == (offset_array = (MPI_Aint *)H5MM_malloc((size_t)count * sizeof(MPI_Aint))) )
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for collective offset table length array")
+ if (NULL == (length_array = (int *)H5MM_malloc((size_t)count * sizeof(int))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for collective write table length array")
+ if (NULL == (buf_array = (MPI_Aint *)H5MM_malloc((size_t)count * sizeof(MPI_Aint))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for collective buf table length array")
+ if (NULL == (offset_array = (MPI_Aint *)H5MM_malloc((size_t)count * sizeof(MPI_Aint))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for collective offset table length array")
/* Fill arrays */
node = H5SL_first(cache_ptr->coll_write_list);
HDassert(node);
- if(NULL == (entry_ptr = (H5C_cache_entry_t *)H5SL_item(node)))
+ if (NULL == (entry_ptr = (H5C_cache_entry_t *)H5SL_item(node)))
HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item")
/* Set up initial array position & buffer base address */
length_array[0] = (int)entry_ptr->size;
- base_buf = entry_ptr->image_ptr;
- buf_array[0] = (MPI_Aint)0;
+ base_buf = entry_ptr->image_ptr;
+ buf_array[0] = (MPI_Aint)0;
offset_array[0] = (MPI_Aint)entry_ptr->addr;
node = H5SL_next(node);
- i = 1;
- while(node) {
- if(NULL == (entry_ptr = (H5C_cache_entry_t *)H5SL_item(node)))
+ i = 1;
+ while (node) {
+ if (NULL == (entry_ptr = (H5C_cache_entry_t *)H5SL_item(node)))
HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item")
/* Set up array position */
length_array[i] = (int)entry_ptr->size;
- buf_array[i] = (MPI_Aint)entry_ptr->image_ptr - (MPI_Aint)base_buf;
+ buf_array[i] = (MPI_Aint)entry_ptr->image_ptr - (MPI_Aint)base_buf;
offset_array[i] = (MPI_Aint)entry_ptr->addr;
/* Advance to next node & array location */
@@ -1073,17 +1029,19 @@ H5C__collective_write(H5F_t *f)
} /* end while */
/* Create memory MPI type */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed(count, length_array, buf_array, MPI_BYTE, &btype)))
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Type_create_hindexed(count, length_array, buf_array, MPI_BYTE, &btype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
btype_created = TRUE;
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&btype)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&btype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
/* Create file MPI type */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed(count, length_array, offset_array, MPI_BYTE, &ftype)))
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Type_create_hindexed(count, length_array, offset_array, MPI_BYTE, &ftype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
ftype_created = TRUE;
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&ftype)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&ftype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
/* MPI count to write */
@@ -1102,34 +1060,33 @@ H5C__collective_write(H5F_t *f)
} /* end else */
/* Pass buf type, file type to the file driver */
- if(H5CX_set_mpi_coll_datatypes(btype, ftype) < 0)
+ if (H5CX_set_mpi_coll_datatypes(btype, ftype) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O properties")
/* Write data */
- if(H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)0, buf_count, base_buf) < 0)
+ if (H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)0, buf_count, base_buf) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "unable to write entries collectively")
done:
/* Free arrays */
length_array = (int *)H5MM_xfree(length_array);
- buf_array = (MPI_Aint *)H5MM_xfree(buf_array);
+ buf_array = (MPI_Aint *)H5MM_xfree(buf_array);
offset_array = (MPI_Aint *)H5MM_xfree(offset_array);
/* Free MPI Types */
- if(btype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&btype)))
+ if (btype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&btype)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
- if(ftype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&ftype)))
+ if (ftype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&ftype)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
/* Reset transfer mode in API context, if changed */
- if(orig_xfer_mode != H5FD_MPIO_COLLECTIVE)
- if(H5CX_set_io_xfer_mode(orig_xfer_mode) < 0)
+ if (orig_xfer_mode != H5FD_MPIO_COLLECTIVE)
+ if (H5CX_set_io_xfer_mode(orig_xfer_mode) < 0)
HDONE_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode")
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5C__collective_write() */
-
/*-------------------------------------------------------------------------
* Function: H5C__flush_candidate_entries
*
@@ -1170,20 +1127,20 @@ done:
*/
static herr_t
H5C__flush_candidate_entries(H5F_t *f, unsigned entries_to_flush[H5C_RING_NTYPES],
- unsigned entries_to_clear[H5C_RING_NTYPES])
+ unsigned entries_to_clear[H5C_RING_NTYPES])
{
#if H5C_DO_SANITY_CHECKS
- int i;
- uint32_t index_len = 0;
- size_t index_size = (size_t)0;
- size_t clean_index_size = (size_t)0;
- size_t dirty_index_size = (size_t)0;
- size_t slist_size = (size_t)0;
- uint32_t slist_len = 0;
+ int i;
+ uint32_t index_len = 0;
+ size_t index_size = (size_t)0;
+ size_t clean_index_size = (size_t)0;
+ size_t dirty_index_size = (size_t)0;
+ size_t slist_size = (size_t)0;
+ uint32_t slist_len = 0;
#endif /* H5C_DO_SANITY_CHECKS */
- H5C_ring_t ring;
- H5C_t * cache_ptr;
- herr_t ret_value = SUCCEED;
+ H5C_ring_t ring;
+ H5C_t * cache_ptr;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1207,7 +1164,7 @@ H5C__flush_candidate_entries(H5F_t *f, unsigned entries_to_flush[H5C_RING_NTYPES
HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0);
HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
- for(i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) {
+ for (i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) {
index_len += cache_ptr->index_ring_len[i];
index_size += cache_ptr->index_ring_size[i];
clean_index_size += cache_ptr->clean_index_ring_size[i];
@@ -1226,9 +1183,8 @@ H5C__flush_candidate_entries(H5F_t *f, unsigned entries_to_flush[H5C_RING_NTYPES
#endif /* H5C_DO_SANITY_CHECKS */
#if H5C_DO_EXTREME_SANITY_CHECKS
- if(H5C_validate_protected_entry_list(cache_ptr) < 0
- || H5C_validate_pinned_entry_list(cache_ptr) < 0
- || H5C_validate_lru_list(cache_ptr) < 0)
+ if (H5C_validate_protected_entry_list(cache_ptr) < 0 || H5C_validate_pinned_entry_list(cache_ptr) < 0 ||
+ H5C_validate_lru_list(cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
@@ -1238,12 +1194,12 @@ H5C__flush_candidate_entries(H5F_t *f, unsigned entries_to_flush[H5C_RING_NTYPES
* working inward.
*/
ring = H5C_RING_USER;
- while(ring < H5C_RING_NTYPES) {
- if(H5C__flush_candidates_in_ring(f, ring, entries_to_flush[ring], entries_to_clear[ring]) < 0)
+ while (ring < H5C_RING_NTYPES) {
+ if (H5C__flush_candidates_in_ring(f, ring, entries_to_flush[ring], entries_to_clear[ring]) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush candidates in ring failed")
ring++;
- } /* end while */
+ } /* end while */
done:
cache_ptr->flush_in_progress = FALSE;
@@ -1251,7 +1207,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__flush_candidate_entries() */
-
/*-------------------------------------------------------------------------
* Function: H5C__flush_candidates_in_ring
*
@@ -1289,25 +1244,23 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring,
- unsigned entries_to_flush, unsigned entries_to_clear)
+H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flush, unsigned entries_to_clear)
{
- H5C_t * cache_ptr;
- hbool_t progress;
- hbool_t restart_scan = FALSE;
- unsigned entries_flushed = 0;
- unsigned entries_cleared = 0;
+ H5C_t * cache_ptr;
+ hbool_t progress;
+ hbool_t restart_scan = FALSE;
+ unsigned entries_flushed = 0;
+ unsigned entries_cleared = 0;
#if H5C_DO_SANITY_CHECKS
- unsigned init_index_len;
+ unsigned init_index_len;
#endif /* H5C_DO_SANITY_CHECKS */
- unsigned clear_flags = H5C__FLUSH_CLEAR_ONLY_FLAG |
- H5C__GENERATE_IMAGE_FLAG |
- H5C__UPDATE_PAGE_BUFFER_FLAG;
- unsigned flush_flags = H5C__NO_FLAGS_SET;
- unsigned op_flags;
+ unsigned clear_flags =
+ H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__GENERATE_IMAGE_FLAG | H5C__UPDATE_PAGE_BUFFER_FLAG;
+ unsigned flush_flags = H5C__NO_FLAGS_SET;
+ unsigned op_flags;
H5C_cache_entry_t *op_ptr;
H5C_cache_entry_t *entry_ptr;
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1322,9 +1275,8 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring,
HDassert(ring < H5C_RING_NTYPES);
#if H5C_DO_EXTREME_SANITY_CHECKS
- if((H5C_validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C_validate_pinned_entry_list(cache_ptr) < 0) ||
- (H5C_validate_lru_list(cache_ptr) < 0))
+ if ((H5C_validate_protected_entry_list(cache_ptr) < 0) ||
+ (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
@@ -1343,27 +1295,27 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring,
* It is possible that this will change -- hence the assertion.
*/
restart_scan = FALSE;
- entry_ptr = cache_ptr->LRU_tail_ptr;
- while(((entries_flushed < entries_to_flush) || (entries_cleared < entries_to_clear))
- && (entry_ptr != NULL)) {
- hbool_t prev_is_dirty = FALSE;
+ entry_ptr = cache_ptr->LRU_tail_ptr;
+ while (((entries_flushed < entries_to_flush) || (entries_cleared < entries_to_clear)) &&
+ (entry_ptr != NULL)) {
+ hbool_t prev_is_dirty = FALSE;
H5C_cache_entry_t *next_ptr;
/* Entries in the LRU must not have flush dependency children */
HDassert(entry_ptr->flush_dep_nchildren == 0);
/* Remember dirty state of entry to advance to */
- if(entry_ptr->prev != NULL)
+ if (entry_ptr->prev != NULL)
prev_is_dirty = entry_ptr->prev->is_dirty;
/* If the entry is in the ring */
- if(entry_ptr->ring == ring) {
+ if (entry_ptr->ring == ring) {
/* If this process needs to clear this entry. */
- if(entry_ptr->clear_on_unprotect) {
+ if (entry_ptr->clear_on_unprotect) {
HDassert(entry_ptr->is_dirty);
/* Set entry and flags for operation */
- op_ptr = entry_ptr;
+ op_ptr = entry_ptr;
op_flags = clear_flags;
/* Set next entry appropriately */
@@ -1373,11 +1325,11 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring,
entry_ptr->clear_on_unprotect = FALSE;
entries_cleared++;
} /* end if */
- else if(entry_ptr->flush_immediately) {
+ else if (entry_ptr->flush_immediately) {
HDassert(entry_ptr->is_dirty);
/* Set entry and flags for operation */
- op_ptr = entry_ptr;
+ op_ptr = entry_ptr;
op_flags = flush_flags;
/* Set next entry appropriately */
@@ -1399,7 +1351,7 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring,
entry_ptr = entry_ptr->prev;
/* Check for operation */
- if(op_ptr) {
+ if (op_ptr) {
/* reset entries_removed_counter and
* last_entry_removed_ptr prior to the call to
* H5C__flush_single_entry() so that we can spot
@@ -1418,14 +1370,13 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring,
cache_ptr->entries_removed_counter = 0;
cache_ptr->last_entry_removed_ptr = NULL;
- if(H5C__flush_single_entry(f, op_ptr, op_flags) < 0)
+ if (H5C__flush_single_entry(f, op_ptr, op_flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't flush entry")
- if(cache_ptr->entries_removed_counter != 0
- || cache_ptr->last_entry_removed_ptr != NULL)
+ if (cache_ptr->entries_removed_counter != 0 || cache_ptr->last_entry_removed_ptr != NULL)
restart_scan = TRUE;
} /* end if */
- } /* end if */
+ } /* end if */
else {
/* Remember "next" pointer (after advancing entries) */
next_ptr = entry_ptr;
@@ -1435,10 +1386,9 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring,
} /* end else */
/* Check for restarts, etc. */
- if((entry_ptr != NULL) &&
- (restart_scan || (entry_ptr->is_dirty != prev_is_dirty)
- || (entry_ptr->next != next_ptr) || entry_ptr->is_protected
- || entry_ptr->is_pinned)) {
+ if ((entry_ptr != NULL) &&
+ (restart_scan || (entry_ptr->is_dirty != prev_is_dirty) || (entry_ptr->next != next_ptr) ||
+ entry_ptr->is_protected || entry_ptr->is_pinned)) {
/* Something has happened to the LRU -- start over
* from the tail.
@@ -1458,11 +1408,11 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring,
HDassert(FALSE); /* see comment above */
restart_scan = FALSE;
- entry_ptr = cache_ptr->LRU_tail_ptr;
+ entry_ptr = cache_ptr->LRU_tail_ptr;
H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr)
} /* end if */
- } /* end while */
+ } /* end while */
/* It is also possible that some of the cleared entries are on the
* pinned list. Must scan that also.
@@ -1486,26 +1436,26 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring,
* such changes and cause this function to fail if they are detected.
*/
progress = TRUE;
- while(progress && ((entries_flushed < entries_to_flush) || (entries_cleared < entries_to_clear))) {
- progress = FALSE;
+ while (progress && ((entries_flushed < entries_to_flush) || (entries_cleared < entries_to_clear))) {
+ progress = FALSE;
entry_ptr = cache_ptr->pel_head_ptr;
- while((entry_ptr != NULL) &&
- ((entries_flushed < entries_to_flush) || (entries_cleared < entries_to_clear))) {
+ while ((entry_ptr != NULL) &&
+ ((entries_flushed < entries_to_flush) || (entries_cleared < entries_to_clear))) {
H5C_cache_entry_t *prev_ptr;
- hbool_t next_is_dirty = FALSE;
+ hbool_t next_is_dirty = FALSE;
HDassert(entry_ptr->is_pinned);
/* Remember dirty state of entry to advance to */
- if(entry_ptr->next != NULL)
+ if (entry_ptr->next != NULL)
next_is_dirty = entry_ptr->next->is_dirty;
- if(entry_ptr->ring == ring && entry_ptr->flush_dep_ndirty_children == 0) {
- if(entry_ptr->clear_on_unprotect) {
+ if (entry_ptr->ring == ring && entry_ptr->flush_dep_ndirty_children == 0) {
+ if (entry_ptr->clear_on_unprotect) {
HDassert(entry_ptr->is_dirty);
/* Set entry and flags for operation */
- op_ptr = entry_ptr;
+ op_ptr = entry_ptr;
op_flags = clear_flags;
/* Reset entry flag */
@@ -1513,11 +1463,11 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring,
entries_cleared++;
progress = TRUE;
} /* end if */
- else if(entry_ptr->flush_immediately) {
+ else if (entry_ptr->flush_immediately) {
HDassert(entry_ptr->is_dirty);
/* Set entry and flags for operation */
- op_ptr = entry_ptr;
+ op_ptr = entry_ptr;
op_flags = flush_flags;
/* Reset entry flag */
@@ -1530,7 +1480,7 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring,
op_ptr = NULL;
/* Check for operation */
- if(op_ptr) {
+ if (op_ptr) {
/* reset entries_removed_counter and
* last_entry_removed_ptr prior to the call to
* H5C__flush_single_entry() so that we can spot
@@ -1556,14 +1506,13 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring,
*
* JRM -- 2/9/17
*/
- if(H5C__flush_single_entry(f, op_ptr, op_flags) < 0)
+ if (H5C__flush_single_entry(f, op_ptr, op_flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't flush entry")
- if(cache_ptr->entries_removed_counter != 0
- || cache_ptr->last_entry_removed_ptr != NULL)
+ if (cache_ptr->entries_removed_counter != 0 || cache_ptr->last_entry_removed_ptr != NULL)
restart_scan = TRUE;
} /* end if */
- } /* end if */
+ } /* end if */
/* Remember "previous" pointer (after advancing entries) */
prev_ptr = entry_ptr;
@@ -1572,10 +1521,9 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring,
entry_ptr = entry_ptr->next;
/* Check for restarts, etc. */
- if((entry_ptr != NULL) &&
- (restart_scan || (entry_ptr->is_dirty != next_is_dirty)
- || (entry_ptr->prev != prev_ptr) || entry_ptr->is_protected
- || !entry_ptr->is_pinned)) {
+ if ((entry_ptr != NULL) &&
+ (restart_scan || (entry_ptr->is_dirty != next_is_dirty) || (entry_ptr->prev != prev_ptr) ||
+ entry_ptr->is_protected || !entry_ptr->is_pinned)) {
/* Something has happened to the pinned entry list -- start
* over from the head.
*
@@ -1606,22 +1554,22 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring,
* H5C__UPDATE_STATS_FOR_PEL_SCAN_RESTART(cache_ptr)
*/
} /* end if */
- } /* end while ( ( entry_ptr != NULL ) &&
- * ( ( entries_flushed > entries_to_flush ) ||
- * ( entries_cleared > entries_to_clear ) ) )
- */
- } /* end while ( ( ( entries_flushed > entries_to_flush ) ||
- * ( entries_cleared > entries_to_clear ) ) &&
- * ( progress ) )
- */
+ } /* end while ( ( entry_ptr != NULL ) &&
+ * ( ( entries_flushed > entries_to_flush ) ||
+ * ( entries_cleared > entries_to_clear ) ) )
+ */
+ } /* end while ( ( ( entries_flushed > entries_to_flush ) ||
+ * ( entries_cleared > entries_to_clear ) ) &&
+ * ( progress ) )
+ */
#if H5C_DO_SANITY_CHECKS
HDassert(init_index_len == cache_ptr->index_len);
#endif /* H5C_DO_SANITY_CHECKS */
- if(entries_flushed != entries_to_flush || entries_cleared != entries_to_clear) {
+ if (entries_flushed != entries_to_flush || entries_cleared != entries_to_clear) {
entry_ptr = cache_ptr->il_head;
- while(entry_ptr != NULL) {
+ while (entry_ptr != NULL) {
HDassert(!entry_ptr->clear_on_unprotect || (entry_ptr->ring > ring));
HDassert(!entry_ptr->flush_immediately || (entry_ptr->ring > ring));
entry_ptr = entry_ptr->il_next;
@@ -1634,4 +1582,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__flush_candidates_in_ring() */
#endif /* H5_HAVE_PARALLEL */
-
diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h
index 614e480..410fc3e 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -5092,4 +5092,3 @@ H5_DLL herr_t H5C__verify_cork_tag_test(hid_t fid, H5O_token_t tag_token, hbool_
#endif /* _H5Cpkg_H */
/* clang-format on */
-
diff --git a/src/H5Cprefetched.c b/src/H5Cprefetched.c
index 954dd60..53002b0 100644
--- a/src/H5Cprefetched.c
+++ b/src/H5Cprefetched.c
@@ -22,26 +22,22 @@
*-------------------------------------------------------------------------
*/
-
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5MMprivate.h" /* Memory management */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MMprivate.h" /* Memory management */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
@@ -51,27 +47,20 @@
* Declarations for prefetched cache entry callbacks.
*
****************************************************************************/
-static herr_t H5C__prefetched_entry_get_initial_load_size(void *udata_ptr,
- size_t *image_len_ptr);
-static herr_t H5C__prefetched_entry_get_final_load_size(const void *image_ptr,
- size_t image_len, void *udata_ptr, size_t *actual_len_ptr);
-static htri_t H5C__prefetched_entry_verify_chksum(const void *image_ptr,
- size_t len, void *udata_ptr);
-static void * H5C__prefetched_entry_deserialize(const void *image_ptr,
- size_t len, void *udata, hbool_t *dirty_ptr);
-static herr_t H5C__prefetched_entry_image_len(const void *thing,
- size_t *image_len_ptr);
-static herr_t H5C__prefetched_entry_pre_serialize(H5F_t *f, void *thing,
- haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr,
- unsigned *flags_ptr);
-static herr_t H5C__prefetched_entry_serialize(const H5F_t *f, void *image_ptr,
- size_t len, void *thing);
-static herr_t H5C__prefetched_entry_notify(H5C_notify_action_t action,
- void *thing);
+static herr_t H5C__prefetched_entry_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr);
+static herr_t H5C__prefetched_entry_get_final_load_size(const void *image_ptr, size_t image_len,
+ void *udata_ptr, size_t *actual_len_ptr);
+static htri_t H5C__prefetched_entry_verify_chksum(const void *image_ptr, size_t len, void *udata_ptr);
+static void * H5C__prefetched_entry_deserialize(const void *image_ptr, size_t len, void *udata,
+ hbool_t *dirty_ptr);
+static herr_t H5C__prefetched_entry_image_len(const void *thing, size_t *image_len_ptr);
+static herr_t H5C__prefetched_entry_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len,
+ haddr_t *new_addr_ptr, size_t *new_len_ptr,
+ unsigned *flags_ptr);
+static herr_t H5C__prefetched_entry_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing);
+static herr_t H5C__prefetched_entry_notify(H5C_notify_action_t action, void *thing);
static herr_t H5C__prefetched_entry_free_icr(void *thing);
-static herr_t H5C__prefetched_entry_fsf_size(const void *thing,
- hsize_t *fsf_size_ptr);
-
+static herr_t H5C__prefetched_entry_fsf_size(const void *thing, hsize_t *fsf_size_ptr);
/*********************/
/* Package Variables */
@@ -80,17 +69,14 @@ static herr_t H5C__prefetched_entry_fsf_size(const void *thing,
/* Declare external the free list for H5C_cache_entry_t's */
H5FL_EXTERN(H5C_cache_entry_t);
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
const H5AC_class_t H5AC_PREFETCHED_ENTRY[1] = {{
/* id = */ H5AC_PREFETCHED_ENTRY_ID,
/* name = */ "prefetched entry",
@@ -108,8 +94,6 @@ const H5AC_class_t H5AC_PREFETCHED_ENTRY[1] = {{
/* fsf_size = */ H5C__prefetched_entry_fsf_size,
}};
-
-
/***************************************************************************
* With two exceptions, these functions should never be called, and thus
* there is little point in documenting them separately as they all simply
@@ -123,91 +107,83 @@ const H5AC_class_t H5AC_PREFETCHED_ENTRY[1] = {{
static herr_t
H5C__prefetched_entry_get_initial_load_size(void H5_ATTR_UNUSED *udata_ptr,
- size_t H5_ATTR_UNUSED *image_len_ptr)
+ size_t H5_ATTR_UNUSED *image_len_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__prefetched_entry_get_initial_load_size() */
static herr_t
H5C__prefetched_entry_get_final_load_size(const void H5_ATTR_UNUSED *image_ptr,
- size_t H5_ATTR_UNUSED image_len, void H5_ATTR_UNUSED *udata_ptr,
- size_t H5_ATTR_UNUSED *actual_len_ptr)
+ size_t H5_ATTR_UNUSED image_len, void H5_ATTR_UNUSED *udata_ptr,
+ size_t H5_ATTR_UNUSED *actual_len_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__prefetched_entry_get_final_load_size() */
static htri_t
-H5C__prefetched_entry_verify_chksum(const void H5_ATTR_UNUSED *image_ptr,
- size_t H5_ATTR_UNUSED len, void H5_ATTR_UNUSED *udata_ptr)
+H5C__prefetched_entry_verify_chksum(const void H5_ATTR_UNUSED *image_ptr, size_t H5_ATTR_UNUSED len,
+ void H5_ATTR_UNUSED *udata_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__prefetched_verify_chksum() */
-
static void *
-H5C__prefetched_entry_deserialize(const void H5_ATTR_UNUSED * image_ptr,
- size_t H5_ATTR_UNUSED len, void H5_ATTR_UNUSED * udata,
- hbool_t H5_ATTR_UNUSED * dirty_ptr)
+H5C__prefetched_entry_deserialize(const void H5_ATTR_UNUSED *image_ptr, size_t H5_ATTR_UNUSED len,
+ void H5_ATTR_UNUSED *udata, hbool_t H5_ATTR_UNUSED *dirty_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(NULL)
} /* end H5C__prefetched_entry_deserialize() */
-
static herr_t
-H5C__prefetched_entry_image_len(const void H5_ATTR_UNUSED *thing,
- size_t H5_ATTR_UNUSED *image_len_ptr)
+H5C__prefetched_entry_image_len(const void H5_ATTR_UNUSED *thing, size_t H5_ATTR_UNUSED *image_len_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__prefetched_entry_image_len() */
-
static herr_t
H5C__prefetched_entry_pre_serialize(H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED *thing,
- haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED len,
- haddr_t H5_ATTR_UNUSED *new_addr_ptr, size_t H5_ATTR_UNUSED *new_len_ptr,
- unsigned H5_ATTR_UNUSED *flags_ptr)
+ haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED len,
+ haddr_t H5_ATTR_UNUSED *new_addr_ptr, size_t H5_ATTR_UNUSED *new_len_ptr,
+ unsigned H5_ATTR_UNUSED *flags_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__prefetched_entry_pre_serialize() */
-
static herr_t
-H5C__prefetched_entry_serialize(const H5F_t H5_ATTR_UNUSED *f,
- void H5_ATTR_UNUSED *image_ptr,
- size_t H5_ATTR_UNUSED len, void H5_ATTR_UNUSED *thing)
+H5C__prefetched_entry_serialize(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED *image_ptr,
+ size_t H5_ATTR_UNUSED len, void H5_ATTR_UNUSED *thing)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__prefetched_entry_serialize() */
-
/*-------------------------------------------------------------------------
* Function: H5C__prefetched_entry_notify
*
@@ -228,9 +204,9 @@ H5C__prefetched_entry_serialize(const H5F_t H5_ATTR_UNUSED *f,
static herr_t
H5C__prefetched_entry_notify(H5C_notify_action_t action, void *_thing)
{
- H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)_thing;
- unsigned u;
- herr_t ret_value = SUCCEED;
+ H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)_thing;
+ unsigned u;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -239,7 +215,7 @@ H5C__prefetched_entry_notify(H5C_notify_action_t action, void *_thing)
HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(entry_ptr->prefetched);
- switch(action) {
+ switch (action) {
case H5C_NOTIFY_ACTION_AFTER_INSERT:
case H5C_NOTIFY_ACTION_AFTER_LOAD:
case H5C_NOTIFY_ACTION_AFTER_FLUSH:
@@ -253,8 +229,8 @@ H5C__prefetched_entry_notify(H5C_notify_action_t action, void *_thing)
break;
case H5C_NOTIFY_ACTION_BEFORE_EVICT:
- for(u = 0; u < entry_ptr->flush_dep_nparents; u++) {
- H5C_cache_entry_t * parent_ptr;
+ for (u = 0; u < entry_ptr->flush_dep_nparents; u++) {
+ H5C_cache_entry_t *parent_ptr;
/* Sanity checks */
HDassert(entry_ptr->flush_dep_parent);
@@ -264,10 +240,11 @@ H5C__prefetched_entry_notify(H5C_notify_action_t action, void *_thing)
HDassert(parent_ptr->flush_dep_nchildren > 0);
/* Destroy flush dependency with flush dependency parent */
- if(H5C_destroy_flush_dependency(parent_ptr, entry_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "unable to destroy prefetched entry flush dependency")
+ if (H5C_destroy_flush_dependency(parent_ptr, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy prefetched entry flush dependency")
- if(parent_ptr->prefetched) {
+ if (parent_ptr->prefetched) {
/* In prefetched entries, the fd_child_count field is
* used in sanity checks elsewhere. Thus update this
* field to reflect the destruction of the flush
@@ -276,7 +253,7 @@ H5C__prefetched_entry_notify(H5C_notify_action_t action, void *_thing)
HDassert(parent_ptr->fd_child_count > 0);
(parent_ptr->fd_child_count)--;
} /* end if */
- } /* end for */
+ } /* end for */
break;
default:
@@ -288,7 +265,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5C__prefetched_entry_notify() */
-
/*-------------------------------------------------------------------------
* Function: H5C__prefetched_entry_free_icr
*
@@ -308,7 +284,7 @@ static herr_t
H5C__prefetched_entry_free_icr(void *_thing)
{
H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)_thing;
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -318,15 +294,15 @@ H5C__prefetched_entry_free_icr(void *_thing)
HDassert(entry_ptr->prefetched);
/* Release array for flush dependency parent addresses */
- if(entry_ptr->fd_parent_addrs != NULL) {
- HDassert(entry_ptr->fd_parent_count > 0);
- entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_xfree((void *)entry_ptr->fd_parent_addrs);
+ if (entry_ptr->fd_parent_addrs != NULL) {
+ HDassert(entry_ptr->fd_parent_count > 0);
+ entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_xfree((void *)entry_ptr->fd_parent_addrs);
} /* end if */
else
- HDassert(entry_ptr->fd_parent_count == 0);
+ HDassert(entry_ptr->fd_parent_count == 0);
- if(entry_ptr->image_ptr != NULL)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "prefetched entry image buffer still attatched?")
+ if (entry_ptr->image_ptr != NULL)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "prefetched entry image buffer still attatched?")
entry_ptr = H5FL_FREE(H5C_cache_entry_t, entry_ptr);
@@ -334,15 +310,12 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5C__prefetched_entry_free_icr() */
-
static herr_t
-H5C__prefetched_entry_fsf_size(const void H5_ATTR_UNUSED *thing,
- hsize_t H5_ATTR_UNUSED *fsf_size_ptr)
+H5C__prefetched_entry_fsf_size(const void H5_ATTR_UNUSED *thing, hsize_t H5_ATTR_UNUSED *fsf_size_ptr)
{
FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */
- HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
+ HERROR(H5E_CACHE, H5E_SYSTEM, "called unreachable fcn.");
FUNC_LEAVE_NOAPI(FAIL)
} /* end H5C__prefetched_entry_fsf_size() */
-
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 6909a4d..ac597bf 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -26,19 +26,19 @@
#ifndef _H5Cprivate_H
#define _H5Cprivate_H
-#include "H5Cpublic.h" /* public prototypes */
+#include "H5Cpublic.h" /* public prototypes */
/* Private headers needed by this header */
-#include "H5private.h" /* Generic Functions */
-#include "H5Fprivate.h" /* File access */
+#include "H5private.h" /* Generic Functions */
+#include "H5Fprivate.h" /* File access */
/**************************/
/* Library Private Macros */
/**************************/
/* Cache configuration settings */
-#define H5C__MAX_NUM_TYPE_IDS 30
-#define H5C__PREFIX_LEN 32
+#define H5C__MAX_NUM_TYPE_IDS 30
+#define H5C__PREFIX_LEN 32
/* This sanity checking constant was picked out of the air. Increase
* or decrease it if appropriate. Its purposes is to detect corrupt
@@ -46,32 +46,32 @@
*
* JRM - 5/17/04
*/
-#define H5C_MAX_ENTRY_SIZE ((size_t)(32 * 1024 * 1024))
+#define H5C_MAX_ENTRY_SIZE ((size_t)(32 * 1024 * 1024))
#ifdef H5_HAVE_PARALLEL
/* we must maintain the clean and dirty LRU lists when we are compiled
* with parallel support.
*/
-#define H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS 1
+#define H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS 1
#else /* H5_HAVE_PARALLEL */
/* The clean and dirty LRU lists don't buy us anything here -- we may
* want them on for testing on occasion, but in general they should be
* off.
*/
-#define H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS 0
+#define H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS 0
#endif /* H5_HAVE_PARALLEL */
/* Flags for cache client class behavior */
-#define H5C__CLASS_NO_FLAGS_SET ((unsigned)0x0)
-#define H5C__CLASS_SPECULATIVE_LOAD_FLAG ((unsigned)0x1)
+#define H5C__CLASS_NO_FLAGS_SET ((unsigned)0x0)
+#define H5C__CLASS_SPECULATIVE_LOAD_FLAG ((unsigned)0x1)
/* The following flags may only appear in test code */
-#define H5C__CLASS_SKIP_READS ((unsigned)0x2)
-#define H5C__CLASS_SKIP_WRITES ((unsigned)0x4)
+#define H5C__CLASS_SKIP_READS ((unsigned)0x2)
+#define H5C__CLASS_SKIP_WRITES ((unsigned)0x4)
/* Flags for pre-serialize callback */
-#define H5C__SERIALIZE_NO_FLAGS_SET ((unsigned)0)
-#define H5C__SERIALIZE_RESIZED_FLAG ((unsigned)0x1)
-#define H5C__SERIALIZE_MOVED_FLAG ((unsigned)0x2)
+#define H5C__SERIALIZE_NO_FLAGS_SET ((unsigned)0)
+#define H5C__SERIALIZE_RESIZED_FLAG ((unsigned)0x1)
+#define H5C__SERIALIZE_MOVED_FLAG ((unsigned)0x2)
/* Upper and lower limits on cache size. These limits are picked
* out of a hat -- you should be able to change them as necessary.
@@ -81,24 +81,24 @@
* upper bound on cache size is rather large for the current hash table
* size.
*/
-#define H5C__MAX_MAX_CACHE_SIZE ((size_t)(128 * 1024 * 1024))
-#define H5C__MIN_MAX_CACHE_SIZE ((size_t)(1024))
+#define H5C__MAX_MAX_CACHE_SIZE ((size_t)(128 * 1024 * 1024))
+#define H5C__MIN_MAX_CACHE_SIZE ((size_t)(1024))
/* Default max cache size and min clean size are give here to make
* them generally accessible.
*/
-#define H5C__DEFAULT_MAX_CACHE_SIZE ((size_t)(4 * 1024 * 1024))
-#define H5C__DEFAULT_MIN_CLEAN_SIZE ((size_t)(2 * 1024 * 1024))
+#define H5C__DEFAULT_MAX_CACHE_SIZE ((size_t)(4 * 1024 * 1024))
+#define H5C__DEFAULT_MIN_CLEAN_SIZE ((size_t)(2 * 1024 * 1024))
/* Values for cache entry magic field */
-#define H5C__H5C_CACHE_ENTRY_T_MAGIC 0x005CAC0A
-#define H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC 0xDeadBeef
+#define H5C__H5C_CACHE_ENTRY_T_MAGIC 0x005CAC0A
+#define H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC 0xDeadBeef
/* Cache configuration validation definitions */
-#define H5C_RESIZE_CFG__VALIDATE_GENERAL 0x1
-#define H5C_RESIZE_CFG__VALIDATE_INCREMENT 0x2
-#define H5C_RESIZE_CFG__VALIDATE_DECREMENT 0x4
-#define H5C_RESIZE_CFG__VALIDATE_INTERACTIONS 0x8
+#define H5C_RESIZE_CFG__VALIDATE_GENERAL 0x1
+#define H5C_RESIZE_CFG__VALIDATE_INCREMENT 0x2
+#define H5C_RESIZE_CFG__VALIDATE_DECREMENT 0x4
+#define H5C_RESIZE_CFG__VALIDATE_INTERACTIONS 0x8
/* clang-format off */
#define H5C_RESIZE_CFG__VALIDATE_ALL \
( \
@@ -110,28 +110,28 @@
/* clang-format on */
/* Cache configuration versions */
-#define H5C__CURR_AUTO_SIZE_CTL_VER 1
-#define H5C__CURR_AUTO_RESIZE_RPT_FCN_VER 1
-#define H5C__CURR_CACHE_IMAGE_CTL_VER 1
+#define H5C__CURR_AUTO_SIZE_CTL_VER 1
+#define H5C__CURR_AUTO_RESIZE_RPT_FCN_VER 1
+#define H5C__CURR_CACHE_IMAGE_CTL_VER 1
/* Default configuration settings */
-#define H5C__DEF_AR_UPPER_THRESHHOLD 0.9999f
-#define H5C__DEF_AR_LOWER_THRESHHOLD 0.9f
-#define H5C__DEF_AR_MAX_SIZE ((size_t)(16 * 1024 * 1024))
-#define H5C__DEF_AR_INIT_SIZE ((size_t)( 1 * 1024 * 1024))
-#define H5C__DEF_AR_MIN_SIZE ((size_t)( 1 * 1024 * 1024))
-#define H5C__DEF_AR_MIN_CLEAN_FRAC 0.5f
-#define H5C__DEF_AR_INCREMENT 2.0f
-#define H5C__DEF_AR_MAX_INCREMENT ((size_t)( 2 * 1024 * 1024))
-#define H5C__DEF_AR_FLASH_MULTIPLE 1.0f
-#define H5C__DEV_AR_FLASH_THRESHOLD 0.25f
-#define H5C__DEF_AR_DECREMENT 0.9f
-#define H5C__DEF_AR_MAX_DECREMENT ((size_t)( 1 * 1024 * 1024))
-#define H5C__DEF_AR_EPCHS_B4_EVICT 3
-#define H5C__DEF_AR_EMPTY_RESERVE 0.05f
-#define H5C__MIN_AR_EPOCH_LENGTH 100
-#define H5C__DEF_AR_EPOCH_LENGTH 50000
-#define H5C__MAX_AR_EPOCH_LENGTH 1000000
+#define H5C__DEF_AR_UPPER_THRESHHOLD 0.9999f
+#define H5C__DEF_AR_LOWER_THRESHHOLD 0.9f
+#define H5C__DEF_AR_MAX_SIZE ((size_t)(16 * 1024 * 1024))
+#define H5C__DEF_AR_INIT_SIZE ((size_t)(1 * 1024 * 1024))
+#define H5C__DEF_AR_MIN_SIZE ((size_t)(1 * 1024 * 1024))
+#define H5C__DEF_AR_MIN_CLEAN_FRAC 0.5f
+#define H5C__DEF_AR_INCREMENT 2.0f
+#define H5C__DEF_AR_MAX_INCREMENT ((size_t)(2 * 1024 * 1024))
+#define H5C__DEF_AR_FLASH_MULTIPLE 1.0f
+#define H5C__DEV_AR_FLASH_THRESHOLD 0.25f
+#define H5C__DEF_AR_DECREMENT 0.9f
+#define H5C__DEF_AR_MAX_DECREMENT ((size_t)(1 * 1024 * 1024))
+#define H5C__DEF_AR_EPCHS_B4_EVICT 3
+#define H5C__DEF_AR_EMPTY_RESERVE 0.05f
+#define H5C__MIN_AR_EPOCH_LENGTH 100
+#define H5C__DEF_AR_EPOCH_LENGTH 50000
+#define H5C__MAX_AR_EPOCH_LENGTH 1000000
/* #defines of flags used in the flags parameters in some of the
* following function calls. Note that not all flags are applicable
@@ -185,47 +185,47 @@
* H5C__GENERATE_IMAGE_FLAG
* H5C__UPDATE_PAGE_BUFFER_FLAG
*/
-#define H5C__NO_FLAGS_SET 0x00000
-#define H5C__SET_FLUSH_MARKER_FLAG 0x00001
-#define H5C__DELETED_FLAG 0x00002
-#define H5C__DIRTIED_FLAG 0x00004
-#define H5C__PIN_ENTRY_FLAG 0x00008
-#define H5C__UNPIN_ENTRY_FLAG 0x00010
-#define H5C__FLUSH_INVALIDATE_FLAG 0x00020
-#define H5C__FLUSH_CLEAR_ONLY_FLAG 0x00040
-#define H5C__FLUSH_MARKED_ENTRIES_FLAG 0x00080
+#define H5C__NO_FLAGS_SET 0x00000
+#define H5C__SET_FLUSH_MARKER_FLAG 0x00001
+#define H5C__DELETED_FLAG 0x00002
+#define H5C__DIRTIED_FLAG 0x00004
+#define H5C__PIN_ENTRY_FLAG 0x00008
+#define H5C__UNPIN_ENTRY_FLAG 0x00010
+#define H5C__FLUSH_INVALIDATE_FLAG 0x00020
+#define H5C__FLUSH_CLEAR_ONLY_FLAG 0x00040
+#define H5C__FLUSH_MARKED_ENTRIES_FLAG 0x00080
#define H5C__FLUSH_IGNORE_PROTECTED_FLAG 0x00100
-#define H5C__READ_ONLY_FLAG 0x00200
-#define H5C__FREE_FILE_SPACE_FLAG 0x00400
-#define H5C__TAKE_OWNERSHIP_FLAG 0x00800
-#define H5C__FLUSH_LAST_FLAG 0x01000
+#define H5C__READ_ONLY_FLAG 0x00200
+#define H5C__FREE_FILE_SPACE_FLAG 0x00400
+#define H5C__TAKE_OWNERSHIP_FLAG 0x00800
+#define H5C__FLUSH_LAST_FLAG 0x01000
#define H5C__FLUSH_COLLECTIVELY_FLAG 0x02000
-#define H5C__EVICT_ALLOW_LAST_PINS_FLAG 0x04000
-#define H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG 0x08000
-#define H5C__DURING_FLUSH_FLAG 0x10000 /* Set when the entire cache is being flushed */
-#define H5C__GENERATE_IMAGE_FLAG 0x20000 /* Set during parallel I/O */
-#define H5C__UPDATE_PAGE_BUFFER_FLAG 0x40000 /* Set during parallel I/O */
+#define H5C__EVICT_ALLOW_LAST_PINS_FLAG 0x04000
+#define H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG 0x08000
+#define H5C__DURING_FLUSH_FLAG 0x10000 /* Set when the entire cache is being flushed */
+#define H5C__GENERATE_IMAGE_FLAG 0x20000 /* Set during parallel I/O */
+#define H5C__UPDATE_PAGE_BUFFER_FLAG 0x40000 /* Set during parallel I/O */
/* Debugging/sanity checking/statistics settings */
#ifndef NDEBUG
-#define H5C_DO_SANITY_CHECKS 1
-#define H5C_DO_SLIST_SANITY_CHECKS 0
-#define H5C_DO_TAGGING_SANITY_CHECKS 1
-#define H5C_DO_EXTREME_SANITY_CHECKS 0
+#define H5C_DO_SANITY_CHECKS 1
+#define H5C_DO_SLIST_SANITY_CHECKS 0
+#define H5C_DO_TAGGING_SANITY_CHECKS 1
+#define H5C_DO_EXTREME_SANITY_CHECKS 0
#else /* NDEBUG */
/* With rare execptions, the following defines should be set
* to 0 if NDEBUG is defined
*/
-#define H5C_DO_SANITY_CHECKS 0
-#define H5C_DO_SLIST_SANITY_CHECKS 0
-#define H5C_DO_TAGGING_SANITY_CHECKS 0
-#define H5C_DO_EXTREME_SANITY_CHECKS 0
+#define H5C_DO_SANITY_CHECKS 0
+#define H5C_DO_SLIST_SANITY_CHECKS 0
+#define H5C_DO_TAGGING_SANITY_CHECKS 0
+#define H5C_DO_EXTREME_SANITY_CHECKS 0
#endif /* NDEBUG */
/* Cork actions: cork/uncork/get cork status of an object */
-#define H5C__SET_CORK 0x1
-#define H5C__UNCORK 0x2
-#define H5C__GET_CORKED 0x4
+#define H5C__SET_CORK 0x1
+#define H5C__UNCORK 0x2
+#define H5C__GET_CORKED 0x4
/* Note: The memory sanity checks aren't going to work until I/O filters are
* changed to call a particular alloc/free routine for their buffers,
@@ -235,7 +235,7 @@
* routines that the fractal heap direct block (and global heap) serialize
* calls can use when resizing (and re-allocating) their image in the
* cache. -QAK */
-#define H5C_DO_MEMORY_SANITY_CHECKS 0
+#define H5C_DO_MEMORY_SANITY_CHECKS 0
/* H5C_COLLECT_CACHE_STATS controls overall collection of statistics
* on cache activity. In general, this #define should be set to 1 in
@@ -243,9 +243,9 @@
*/
#ifndef NDEBUG
-#define H5C_COLLECT_CACHE_STATS 1
+#define H5C_COLLECT_CACHE_STATS 1
#else /* NDEBUG */
-#define H5C_COLLECT_CACHE_STATS 0
+#define H5C_COLLECT_CACHE_STATS 0
#endif /* NDEBUG */
/* H5C_COLLECT_CACHE_ENTRY_STATS controls collection of statistics
@@ -255,12 +255,11 @@
* H5C_COLLECT_CACHE_STATS is also defined to true.
*/
#if H5C_COLLECT_CACHE_STATS
-#define H5C_COLLECT_CACHE_ENTRY_STATS 1
+#define H5C_COLLECT_CACHE_ENTRY_STATS 1
#else
-#define H5C_COLLECT_CACHE_ENTRY_STATS 0
+#define H5C_COLLECT_CACHE_ENTRY_STATS 0
#endif /* H5C_COLLECT_CACHE_STATS */
-
/****************************/
/* Library Private Typedefs */
/****************************/
@@ -847,65 +846,62 @@ typedef struct H5C_t H5C_t;
/* Actions that can be reported to 'notify' client callback */
typedef enum H5C_notify_action_t {
- H5C_NOTIFY_ACTION_AFTER_INSERT, /* Entry has been added to the cache
- * via the insert call
- */
- H5C_NOTIFY_ACTION_AFTER_LOAD, /* Entry has been loaded into the
- * from file via the protect call
- */
- H5C_NOTIFY_ACTION_AFTER_FLUSH, /* Entry has just been flushed to
- * file.
- */
- H5C_NOTIFY_ACTION_BEFORE_EVICT, /* Entry is about to be evicted
- * from cache.
- */
- H5C_NOTIFY_ACTION_ENTRY_DIRTIED, /* Entry has been marked dirty. */
- H5C_NOTIFY_ACTION_ENTRY_CLEANED, /* Entry has been marked clean. */
- H5C_NOTIFY_ACTION_CHILD_DIRTIED, /* Dependent child has been marked dirty. */
- H5C_NOTIFY_ACTION_CHILD_CLEANED, /* Dependent child has been marked clean. */
+ H5C_NOTIFY_ACTION_AFTER_INSERT, /* Entry has been added to the cache
+ * via the insert call
+ */
+ H5C_NOTIFY_ACTION_AFTER_LOAD, /* Entry has been loaded into the
+ * from file via the protect call
+ */
+ H5C_NOTIFY_ACTION_AFTER_FLUSH, /* Entry has just been flushed to
+ * file.
+ */
+ H5C_NOTIFY_ACTION_BEFORE_EVICT, /* Entry is about to be evicted
+ * from cache.
+ */
+ H5C_NOTIFY_ACTION_ENTRY_DIRTIED, /* Entry has been marked dirty. */
+ H5C_NOTIFY_ACTION_ENTRY_CLEANED, /* Entry has been marked clean. */
+ H5C_NOTIFY_ACTION_CHILD_DIRTIED, /* Dependent child has been marked dirty. */
+ H5C_NOTIFY_ACTION_CHILD_CLEANED, /* Dependent child has been marked clean. */
H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED, /* Dependent child has been marked unserialized. */
- H5C_NOTIFY_ACTION_CHILD_SERIALIZED /* Dependent child has been marked serialized. */
+ H5C_NOTIFY_ACTION_CHILD_SERIALIZED /* Dependent child has been marked serialized. */
} H5C_notify_action_t;
/* Cache client callback function pointers */
typedef herr_t (*H5C_get_initial_load_size_func_t)(void *udata_ptr, size_t *image_len_ptr);
-typedef herr_t (*H5C_get_final_load_size_func_t)(const void *image_ptr,
- size_t image_len, void *udata_ptr, size_t *actual_len_ptr);
+typedef herr_t (*H5C_get_final_load_size_func_t)(const void *image_ptr, size_t image_len, void *udata_ptr,
+ size_t *actual_len_ptr);
typedef htri_t (*H5C_verify_chksum_func_t)(const void *image_ptr, size_t len, void *udata_ptr);
-typedef void *(*H5C_deserialize_func_t)(const void *image_ptr,
- size_t len, void *udata_ptr, hbool_t *dirty_ptr);
+typedef void *(*H5C_deserialize_func_t)(const void *image_ptr, size_t len, void *udata_ptr,
+ hbool_t *dirty_ptr);
typedef herr_t (*H5C_image_len_func_t)(const void *thing, size_t *image_len_ptr);
-typedef herr_t (*H5C_pre_serialize_func_t)(H5F_t *f, void *thing, haddr_t addr,
- size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr);
-typedef herr_t (*H5C_serialize_func_t)(const H5F_t *f, void *image_ptr,
- size_t len, void *thing);
+typedef herr_t (*H5C_pre_serialize_func_t)(H5F_t *f, void *thing, haddr_t addr, size_t len,
+ haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr);
+typedef herr_t (*H5C_serialize_func_t)(const H5F_t *f, void *image_ptr, size_t len, void *thing);
typedef herr_t (*H5C_notify_func_t)(H5C_notify_action_t action, void *thing);
typedef herr_t (*H5C_free_icr_func_t)(void *thing);
-typedef herr_t (*H5C_get_fsf_size_t)(const void * thing, hsize_t *fsf_size_ptr);
+typedef herr_t (*H5C_get_fsf_size_t)(const void *thing, hsize_t *fsf_size_ptr);
/* Metadata cache client class definition */
typedef struct H5C_class_t {
- int id;
- const char * name;
- H5FD_mem_t mem_type;
- unsigned flags;
- H5C_get_initial_load_size_func_t get_initial_load_size;
- H5C_get_final_load_size_func_t get_final_load_size;
- H5C_verify_chksum_func_t verify_chksum;
- H5C_deserialize_func_t deserialize;
- H5C_image_len_func_t image_len;
- H5C_pre_serialize_func_t pre_serialize;
- H5C_serialize_func_t serialize;
- H5C_notify_func_t notify;
- H5C_free_icr_func_t free_icr;
- H5C_get_fsf_size_t fsf_size;
+ int id;
+ const char * name;
+ H5FD_mem_t mem_type;
+ unsigned flags;
+ H5C_get_initial_load_size_func_t get_initial_load_size;
+ H5C_get_final_load_size_func_t get_final_load_size;
+ H5C_verify_chksum_func_t verify_chksum;
+ H5C_deserialize_func_t deserialize;
+ H5C_image_len_func_t image_len;
+ H5C_pre_serialize_func_t pre_serialize;
+ H5C_serialize_func_t serialize;
+ H5C_notify_func_t notify;
+ H5C_free_icr_func_t free_icr;
+ H5C_get_fsf_size_t fsf_size;
} H5C_class_t;
/* Type definitions of callback functions used by the cache as a whole */
-typedef herr_t (*H5C_write_permitted_func_t)(const H5F_t *f,
- hbool_t *write_permitted_ptr);
-typedef herr_t (*H5C_log_flush_func_t)(H5C_t *cache_ptr, haddr_t addr,
- hbool_t was_dirty, unsigned flags);
+typedef herr_t (*H5C_write_permitted_func_t)(const H5F_t *f, hbool_t *write_permitted_ptr);
+typedef herr_t (*H5C_log_flush_func_t)(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty, unsigned flags);
/****************************************************************************
*
@@ -953,17 +949,16 @@ typedef herr_t (*H5C_log_flush_func_t)(H5C_t *cache_ptr, haddr_t addr,
* debugging.
*/
-#define H5C_RING_UNDEFINED 0 /* shouldn't appear in the cache */
-#define H5C_RING_USER 1 /* outermost ring */
-#define H5C_RING_RDFSM 2
-#define H5C_RING_MDFSM 3
-#define H5C_RING_SBE 4
-#define H5C_RING_SB 5 /* innermost ring */
-#define H5C_RING_NTYPES 6
+#define H5C_RING_UNDEFINED 0 /* shouldn't appear in the cache */
+#define H5C_RING_USER 1 /* outermost ring */
+#define H5C_RING_RDFSM 2
+#define H5C_RING_MDFSM 3
+#define H5C_RING_SBE 4
+#define H5C_RING_SB 5 /* innermost ring */
+#define H5C_RING_NTYPES 6
typedef int H5C_ring_t;
-
/****************************************************************************
*
* structure H5C_cache_entry_t
@@ -1595,13 +1590,13 @@ typedef int H5C_ring_t;
*
****************************************************************************/
typedef struct H5C_cache_entry_t {
- uint32_t magic;
- H5C_t *cache_ptr;
+ uint32_t magic;
+ H5C_t * cache_ptr;
haddr_t addr;
- size_t size;
- void *image_ptr;
+ size_t size;
+ void * image_ptr;
hbool_t image_up_to_date;
- const H5C_class_t *type;
+ const H5C_class_t *type;
hbool_t is_dirty;
hbool_t dirtied;
hbool_t is_protected;
@@ -1610,79 +1605,78 @@ typedef struct H5C_cache_entry_t {
hbool_t is_pinned;
hbool_t in_slist;
hbool_t flush_marker;
- hbool_t flush_me_last;
+ hbool_t flush_me_last;
#ifdef H5_HAVE_PARALLEL
- hbool_t clear_on_unprotect;
- hbool_t flush_immediately;
- hbool_t coll_access;
+ hbool_t clear_on_unprotect;
+ hbool_t flush_immediately;
+ hbool_t coll_access;
#endif /* H5_HAVE_PARALLEL */
- hbool_t flush_in_progress;
- hbool_t destroy_in_progress;
+ hbool_t flush_in_progress;
+ hbool_t destroy_in_progress;
/* fields supporting rings for purposes of flush ordering */
- H5C_ring_t ring;
+ H5C_ring_t ring;
/* fields supporting the 'flush dependency' feature: */
- struct H5C_cache_entry_t ** flush_dep_parent;
- unsigned flush_dep_nparents;
- unsigned flush_dep_parent_nalloc;
- unsigned flush_dep_nchildren;
- unsigned flush_dep_ndirty_children;
- unsigned flush_dep_nunser_children;
- hbool_t pinned_from_client;
- hbool_t pinned_from_cache;
+ struct H5C_cache_entry_t **flush_dep_parent;
+ unsigned flush_dep_nparents;
+ unsigned flush_dep_parent_nalloc;
+ unsigned flush_dep_nchildren;
+ unsigned flush_dep_ndirty_children;
+ unsigned flush_dep_nunser_children;
+ hbool_t pinned_from_client;
+ hbool_t pinned_from_cache;
/* fields supporting the hash table: */
- struct H5C_cache_entry_t *ht_next;
- struct H5C_cache_entry_t *ht_prev;
- struct H5C_cache_entry_t *il_next;
- struct H5C_cache_entry_t *il_prev;
+ struct H5C_cache_entry_t *ht_next;
+ struct H5C_cache_entry_t *ht_prev;
+ struct H5C_cache_entry_t *il_next;
+ struct H5C_cache_entry_t *il_prev;
/* fields supporting replacement policies: */
- struct H5C_cache_entry_t *next;
- struct H5C_cache_entry_t *prev;
+ struct H5C_cache_entry_t *next;
+ struct H5C_cache_entry_t *prev;
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
- struct H5C_cache_entry_t *aux_next;
- struct H5C_cache_entry_t *aux_prev;
+ struct H5C_cache_entry_t *aux_next;
+ struct H5C_cache_entry_t *aux_prev;
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
#ifdef H5_HAVE_PARALLEL
- struct H5C_cache_entry_t *coll_next;
- struct H5C_cache_entry_t *coll_prev;
+ struct H5C_cache_entry_t *coll_next;
+ struct H5C_cache_entry_t *coll_prev;
#endif /* H5_HAVE_PARALLEL */
/* fields supporting cache image */
- hbool_t include_in_image;
- int32_t lru_rank;
- hbool_t image_dirty;
- uint64_t fd_parent_count;
- haddr_t *fd_parent_addrs;
- uint64_t fd_child_count;
- uint64_t fd_dirty_child_count;
- uint32_t image_fd_height;
- hbool_t prefetched;
- int prefetch_type_id;
- int32_t age;
- hbool_t prefetched_dirty;
-
-#ifndef NDEBUG /* debugging field */
- int serialization_count;
+ hbool_t include_in_image;
+ int32_t lru_rank;
+ hbool_t image_dirty;
+ uint64_t fd_parent_count;
+ haddr_t *fd_parent_addrs;
+ uint64_t fd_child_count;
+ uint64_t fd_dirty_child_count;
+ uint32_t image_fd_height;
+ hbool_t prefetched;
+ int prefetch_type_id;
+ int32_t age;
+ hbool_t prefetched_dirty;
+
+#ifndef NDEBUG /* debugging field */
+ int serialization_count;
#endif /* NDEBUG */
/* fields supporting tag lists */
- struct H5C_cache_entry_t *tl_next;
- struct H5C_cache_entry_t *tl_prev;
- struct H5C_tag_info_t *tag_info;
+ struct H5C_cache_entry_t *tl_next;
+ struct H5C_cache_entry_t *tl_prev;
+ struct H5C_tag_info_t * tag_info;
#if H5C_COLLECT_CACHE_ENTRY_STATS
/* cache entry stats fields */
- int32_t accesses;
- int32_t clears;
- int32_t flushes;
- int32_t pins;
+ int32_t accesses;
+ int32_t clears;
+ int32_t flushes;
+ int32_t pins;
#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */
} H5C_cache_entry_t;
-
/****************************************************************************
*
* structure H5C_image_entry_t
@@ -1828,20 +1822,20 @@ typedef struct H5C_cache_entry_t {
****************************************************************************/
typedef struct H5C_image_entry_t {
- uint32_t magic;
- haddr_t addr;
- size_t size;
- H5C_ring_t ring;
- int32_t age;
- int32_t type_id;
- int32_t lru_rank;
- hbool_t is_dirty;
- unsigned image_fd_height;
- uint64_t fd_parent_count;
- haddr_t *fd_parent_addrs;
- uint64_t fd_child_count;
- uint64_t fd_dirty_child_count;
- void *image_ptr;
+ uint32_t magic;
+ haddr_t addr;
+ size_t size;
+ H5C_ring_t ring;
+ int32_t age;
+ int32_t type_id;
+ int32_t lru_rank;
+ hbool_t is_dirty;
+ unsigned image_fd_height;
+ uint64_t fd_parent_count;
+ haddr_t * fd_parent_addrs;
+ uint64_t fd_child_count;
+ uint64_t fd_dirty_child_count;
+ void * image_ptr;
} H5C_image_entry_t;
/****************************************************************************
@@ -2084,8 +2078,7 @@ typedef struct H5C_image_entry_t {
*
****************************************************************************/
-enum H5C_resize_status
-{
+enum H5C_resize_status {
in_spec,
increase,
flash_increase,
@@ -2097,40 +2090,41 @@ enum H5C_resize_status
not_full
}; /* enum H5C_resize_conditions */
-typedef void (*H5C_auto_resize_rpt_fcn)(H5C_t * cache_ptr, int32_t version,
- double hit_rate, enum H5C_resize_status status, size_t old_max_cache_size,
- size_t new_max_cache_size, size_t old_min_clean_size, size_t new_min_clean_size);
+typedef void (*H5C_auto_resize_rpt_fcn)(H5C_t *cache_ptr, int32_t version, double hit_rate,
+ enum H5C_resize_status status, size_t old_max_cache_size,
+ size_t new_max_cache_size, size_t old_min_clean_size,
+ size_t new_min_clean_size);
typedef struct H5C_auto_size_ctl_t {
/* general configuration fields: */
- int32_t version;
- H5C_auto_resize_rpt_fcn rpt_fcn;
- hbool_t set_initial_size;
- size_t initial_size;
- double min_clean_fraction;
- size_t max_size;
- size_t min_size;
- int64_t epoch_length;
+ int32_t version;
+ H5C_auto_resize_rpt_fcn rpt_fcn;
+ hbool_t set_initial_size;
+ size_t initial_size;
+ double min_clean_fraction;
+ size_t max_size;
+ size_t min_size;
+ int64_t epoch_length;
/* size increase control fields: */
- enum H5C_cache_incr_mode incr_mode;
- double lower_hr_threshold;
- double increment;
- hbool_t apply_max_increment;
- size_t max_increment;
- enum H5C_cache_flash_incr_mode flash_incr_mode;
- double flash_multiple;
- double flash_threshold;
+ enum H5C_cache_incr_mode incr_mode;
+ double lower_hr_threshold;
+ double increment;
+ hbool_t apply_max_increment;
+ size_t max_increment;
+ enum H5C_cache_flash_incr_mode flash_incr_mode;
+ double flash_multiple;
+ double flash_threshold;
/* size decrease control fields: */
- enum H5C_cache_decr_mode decr_mode;
- double upper_hr_threshold;
- double decrement;
- hbool_t apply_max_decrement;
- size_t max_decrement;
- int32_t epochs_before_eviction;
- hbool_t apply_empty_reserve;
- double empty_reserve;
+ enum H5C_cache_decr_mode decr_mode;
+ double upper_hr_threshold;
+ double decrement;
+ hbool_t apply_max_decrement;
+ size_t max_decrement;
+ int32_t epochs_before_eviction;
+ hbool_t apply_empty_reserve;
+ double empty_reserve;
} H5C_auto_size_ctl_t;
/****************************************************************************
@@ -2193,54 +2187,50 @@ typedef struct H5C_auto_size_ctl_t {
#define H5C_CI__GEN_MDCI_SBE_MESG ((unsigned)0x0001)
#define H5C_CI__GEN_MDC_IMAGE_BLK ((unsigned)0x0002)
-#define H5C_CI__SUPRESS_ENTRY_WRITES ((unsigned)0x0004)
+#define H5C_CI__SUPRESS_ENTRY_WRITES ((unsigned)0x0004)
#define H5C_CI__WRITE_CACHE_IMAGE ((unsigned)0x0008)
/* This #define must set all defined H5C_CI flags. It is
* used in the default value for instances of H5C_cache_image_ctl_t.
* This value will only be modified in test code.
*/
-#define H5C_CI__ALL_FLAGS ((unsigned)0x000F)
+#define H5C_CI__ALL_FLAGS ((unsigned)0x000F)
-#define H5C__DEFAULT_CACHE_IMAGE_CTL \
-{ \
- H5C__CURR_CACHE_IMAGE_CTL_VER, /* = version */ \
- FALSE, /* = generate_image */ \
- FALSE, /* = save_resize_status */ \
- H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE, /* = entry_ageout */ \
- H5C_CI__ALL_FLAGS /* = flags */ \
-}
+#define H5C__DEFAULT_CACHE_IMAGE_CTL \
+ { \
+ H5C__CURR_CACHE_IMAGE_CTL_VER, /* = version */ \
+ FALSE, /* = generate_image */ \
+ FALSE, /* = save_resize_status */ \
+ H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE, /* = entry_ageout */ \
+ H5C_CI__ALL_FLAGS /* = flags */ \
+ }
typedef struct H5C_cache_image_ctl_t {
- int32_t version;
- hbool_t generate_image;
- hbool_t save_resize_status;
- int32_t entry_ageout;
- unsigned flags;
+ int32_t version;
+ hbool_t generate_image;
+ hbool_t save_resize_status;
+ int32_t entry_ageout;
+ unsigned flags;
} H5C_cache_image_ctl_t;
/* The cache logging output style */
-typedef enum H5C_log_style_t {
- H5C_LOG_STYLE_JSON,
- H5C_LOG_STYLE_TRACE
-} H5C_log_style_t;
+typedef enum H5C_log_style_t { H5C_LOG_STYLE_JSON, H5C_LOG_STYLE_TRACE } H5C_log_style_t;
/***************************************/
/* Library-private Function Prototypes */
/***************************************/
-H5_DLL H5C_t *H5C_create(size_t max_cache_size, size_t min_clean_size,
- int max_type_id, const H5C_class_t * const *class_table_ptr,
- H5C_write_permitted_func_t check_write_permitted, hbool_t write_permitted,
- H5C_log_flush_func_t log_flush, void *aux_ptr);
-H5_DLL void H5C_def_auto_resize_rpt_fcn(H5C_t *cache_ptr, int32_t version,
- double hit_rate, enum H5C_resize_status status,
- size_t old_max_cache_size, size_t new_max_cache_size,
- size_t old_min_clean_size, size_t new_min_clean_size);
+H5_DLL H5C_t *H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id,
+ const H5C_class_t *const * class_table_ptr,
+ H5C_write_permitted_func_t check_write_permitted, hbool_t write_permitted,
+ H5C_log_flush_func_t log_flush, void *aux_ptr);
+H5_DLL void H5C_def_auto_resize_rpt_fcn(H5C_t *cache_ptr, int32_t version, double hit_rate,
+ enum H5C_resize_status status, size_t old_max_cache_size,
+ size_t new_max_cache_size, size_t old_min_clean_size,
+ size_t new_min_clean_size);
H5_DLL herr_t H5C_dest(H5F_t *f);
H5_DLL herr_t H5C_evict(H5F_t *f);
-H5_DLL herr_t H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr,
- unsigned flags);
+H5_DLL herr_t H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, unsigned flags);
H5_DLL herr_t H5C_flush_cache(H5F_t *f, unsigned flags);
H5_DLL herr_t H5C_flush_tagged_entries(H5F_t *f, haddr_t tag);
H5_DLL herr_t H5C_evict_tagged_entries(H5F_t *f, haddr_t tag, hbool_t match_global);
@@ -2250,103 +2240,85 @@ H5_DLL herr_t H5C_get_tag(const void *thing, /*OUT*/ haddr_t *tag);
herr_t H5C_verify_tag(int id, haddr_t tag);
#endif
H5_DLL herr_t H5C_flush_to_min_clean(H5F_t *f);
-H5_DLL herr_t H5C_get_cache_auto_resize_config(const H5C_t *cache_ptr,
- H5C_auto_size_ctl_t *config_ptr);
-H5_DLL herr_t H5C_get_cache_image_config(const H5C_t * cache_ptr,
- H5C_cache_image_ctl_t *config_ptr);
-H5_DLL herr_t H5C_get_cache_size(H5C_t *cache_ptr, size_t *max_size_ptr,
- size_t *min_clean_size_ptr, size_t *cur_size_ptr,
- uint32_t *cur_num_entries_ptr);
+H5_DLL herr_t H5C_get_cache_auto_resize_config(const H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr);
+H5_DLL herr_t H5C_get_cache_image_config(const H5C_t *cache_ptr, H5C_cache_image_ctl_t *config_ptr);
+H5_DLL herr_t H5C_get_cache_size(H5C_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr,
+ size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr);
H5_DLL herr_t H5C_get_cache_flush_in_progress(H5C_t *cache_ptr, hbool_t *flush_in_progress_ptr);
H5_DLL herr_t H5C_get_cache_hit_rate(H5C_t *cache_ptr, double *hit_rate_ptr);
-H5_DLL herr_t H5C_get_entry_status(const H5F_t *f, haddr_t addr,
- size_t *size_ptr, hbool_t *in_cache_ptr, hbool_t *is_dirty_ptr,
- hbool_t *is_protected_ptr, hbool_t *is_pinned_ptr, hbool_t *is_corked_ptr,
- hbool_t *is_flush_dep_parent_ptr, hbool_t *is_flush_dep_child_ptr,
- hbool_t *image_up_to_date_ptr);
+H5_DLL herr_t H5C_get_entry_status(const H5F_t *f, haddr_t addr, size_t *size_ptr, hbool_t *in_cache_ptr,
+ hbool_t *is_dirty_ptr, hbool_t *is_protected_ptr, hbool_t *is_pinned_ptr,
+ hbool_t *is_corked_ptr, hbool_t *is_flush_dep_parent_ptr,
+ hbool_t *is_flush_dep_child_ptr, hbool_t *image_up_to_date_ptr);
H5_DLL herr_t H5C_get_evictions_enabled(const H5C_t *cache_ptr, hbool_t *evictions_enabled_ptr);
H5_DLL void * H5C_get_aux_ptr(const H5C_t *cache_ptr);
-H5_DLL herr_t H5C_image_stats(H5C_t * cache_ptr, hbool_t print_header);
-H5_DLL herr_t H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr,
- void *thing, unsigned int flags);
-H5_DLL herr_t H5C_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr,
- hsize_t len, hbool_t rw);
+H5_DLL herr_t H5C_image_stats(H5C_t *cache_ptr, hbool_t print_header);
+H5_DLL herr_t H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing,
+ unsigned int flags);
+H5_DLL herr_t H5C_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len, hbool_t rw);
H5_DLL herr_t H5C_mark_entry_dirty(void *thing);
H5_DLL herr_t H5C_mark_entry_clean(void *thing);
H5_DLL herr_t H5C_mark_entry_unserialized(void *thing);
H5_DLL herr_t H5C_mark_entry_serialized(void *thing);
-H5_DLL herr_t H5C_move_entry(H5C_t *cache_ptr, const H5C_class_t *type,
- haddr_t old_addr, haddr_t new_addr);
+H5_DLL herr_t H5C_move_entry(H5C_t *cache_ptr, const H5C_class_t *type, haddr_t old_addr, haddr_t new_addr);
H5_DLL herr_t H5C_pin_protected_entry(void *thing);
H5_DLL herr_t H5C_prep_for_file_close(H5F_t *f);
H5_DLL herr_t H5C_create_flush_dependency(void *parent_thing, void *child_thing);
-H5_DLL void * H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr,
- void *udata, unsigned flags);
+H5_DLL void * H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *udata, unsigned flags);
H5_DLL herr_t H5C_reset_cache_hit_rate_stats(H5C_t *cache_ptr);
H5_DLL herr_t H5C_resize_entry(void *thing, size_t new_size);
H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr);
-H5_DLL herr_t H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr,
- H5C_cache_image_ctl_t *config_ptr);
-H5_DLL herr_t H5C_set_evictions_enabled(H5C_t *cache_ptr,
- hbool_t evictions_enabled);
-H5_DLL herr_t H5C_set_slist_enabled(H5C_t *cache_ptr, hbool_t slist_enabled,
- hbool_t clear_slist);
+H5_DLL herr_t H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_image_ctl_t *config_ptr);
+H5_DLL herr_t H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled);
+H5_DLL herr_t H5C_set_slist_enabled(H5C_t *cache_ptr, hbool_t slist_enabled, hbool_t clear_slist);
H5_DLL herr_t H5C_set_prefix(H5C_t *cache_ptr, char *prefix);
-H5_DLL herr_t H5C_stats(H5C_t *cache_ptr, const char *cache_name,
- hbool_t display_detailed_stats);
-H5_DLL void H5C_stats__reset(H5C_t *cache_ptr);
+H5_DLL herr_t H5C_stats(H5C_t *cache_ptr, const char *cache_name, hbool_t display_detailed_stats);
+H5_DLL void H5C_stats__reset(H5C_t *cache_ptr);
H5_DLL herr_t H5C_unpin_entry(void *thing);
H5_DLL herr_t H5C_destroy_flush_dependency(void *parent_thing, void *child_thing);
-H5_DLL herr_t H5C_unprotect(H5F_t *f, haddr_t addr, void *thing,
- unsigned int flags);
-H5_DLL herr_t H5C_validate_cache_image_config(H5C_cache_image_ctl_t * ctl_ptr);
-H5_DLL herr_t H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr,
- unsigned int tests);
+H5_DLL herr_t H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned int flags);
+H5_DLL herr_t H5C_validate_cache_image_config(H5C_cache_image_ctl_t *ctl_ptr);
+H5_DLL herr_t H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests);
H5_DLL herr_t H5C_ignore_tags(H5C_t *cache_ptr);
-H5_DLL hbool_t H5C_get_ignore_tags(const H5C_t *cache_ptr);
+H5_DLL hbool_t H5C_get_ignore_tags(const H5C_t *cache_ptr);
H5_DLL uint32_t H5C_get_num_objs_corked(const H5C_t *cache_ptr);
-H5_DLL herr_t H5C_retag_entries(H5C_t * cache_ptr, haddr_t src_tag, haddr_t dest_tag);
-H5_DLL herr_t H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked);
-H5_DLL herr_t H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring);
-H5_DLL herr_t H5C_unsettle_entry_ring(void *thing);
-H5_DLL herr_t H5C_unsettle_ring(H5F_t * f, H5C_ring_t ring);
-H5_DLL herr_t H5C_remove_entry(void *thing);
-H5_DLL herr_t H5C_cache_image_status(H5F_t * f, hbool_t *load_ci_ptr,
- hbool_t *write_ci_ptr);
-H5_DLL hbool_t H5C_cache_image_pending(const H5C_t *cache_ptr);
-H5_DLL herr_t H5C_get_mdc_image_info(H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len);
+H5_DLL herr_t H5C_retag_entries(H5C_t *cache_ptr, haddr_t src_tag, haddr_t dest_tag);
+H5_DLL herr_t H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked);
+H5_DLL herr_t H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring);
+H5_DLL herr_t H5C_unsettle_entry_ring(void *thing);
+H5_DLL herr_t H5C_unsettle_ring(H5F_t *f, H5C_ring_t ring);
+H5_DLL herr_t H5C_remove_entry(void *thing);
+H5_DLL herr_t H5C_cache_image_status(H5F_t *f, hbool_t *load_ci_ptr, hbool_t *write_ci_ptr);
+H5_DLL hbool_t H5C_cache_image_pending(const H5C_t *cache_ptr);
+H5_DLL herr_t H5C_get_mdc_image_info(H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len);
/* Logging functions */
H5_DLL herr_t H5C_start_logging(H5C_t *cache);
H5_DLL herr_t H5C_stop_logging(H5C_t *cache);
-H5_DLL herr_t H5C_get_logging_status(const H5C_t *cache, /*OUT*/ hbool_t *is_enabled, /*OUT*/ hbool_t *is_currently_logging);
+H5_DLL herr_t H5C_get_logging_status(const H5C_t *cache, /*OUT*/ hbool_t *is_enabled,
+ /*OUT*/ hbool_t *is_currently_logging);
#ifdef H5_HAVE_PARALLEL
-H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr,
- unsigned num_candidates, haddr_t *candidates_list_ptr, int mpi_rank,
- int mpi_size);
+H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates,
+ haddr_t *candidates_list_ptr, int mpi_rank, int mpi_size);
H5_DLL herr_t H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr);
H5_DLL herr_t H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr);
-H5_DLL herr_t H5C_clear_coll_entries(H5C_t * cache_ptr, hbool_t partial);
-H5_DLL herr_t H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len,
- haddr_t *ce_array_ptr);
+H5_DLL herr_t H5C_clear_coll_entries(H5C_t *cache_ptr, hbool_t partial);
+H5_DLL herr_t H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr);
#endif /* H5_HAVE_PARALLEL */
-#ifndef NDEBUG /* debugging functions */
-H5_DLL herr_t H5C_dump_cache(H5C_t *cache_ptr, const char *cache_name);
-H5_DLL herr_t H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name);
+#ifndef NDEBUG /* debugging functions */
+H5_DLL herr_t H5C_dump_cache(H5C_t *cache_ptr, const char *cache_name);
+H5_DLL herr_t H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name);
H5_DLL hbool_t H5C_get_serialization_in_progress(const H5C_t *cache_ptr);
H5_DLL hbool_t H5C_cache_is_clean(const H5C_t *cache_ptr, H5C_ring_t inner_ring);
-H5_DLL herr_t H5C_dump_cache_skip_list(H5C_t *cache_ptr, char *calling_fcn);
-H5_DLL herr_t H5C_get_entry_ptr_from_addr(H5C_t *cache_ptr, haddr_t addr,
- void **entry_ptr_ptr);
-H5_DLL herr_t H5C_flush_dependency_exists(H5C_t *cache_ptr, haddr_t parent_addr,
- haddr_t child_addr, hbool_t *fd_exists_ptr);
-H5_DLL herr_t H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr,
- const H5C_class_t *expected_type, hbool_t *in_cache_ptr,
- hbool_t *type_ok_ptr);
-H5_DLL herr_t H5C_validate_index_list(H5C_t *cache_ptr);
+H5_DLL herr_t H5C_dump_cache_skip_list(H5C_t *cache_ptr, char *calling_fcn);
+H5_DLL herr_t H5C_get_entry_ptr_from_addr(H5C_t *cache_ptr, haddr_t addr, void **entry_ptr_ptr);
+H5_DLL herr_t H5C_flush_dependency_exists(H5C_t *cache_ptr, haddr_t parent_addr, haddr_t child_addr,
+ hbool_t *fd_exists_ptr);
+H5_DLL herr_t H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr, const H5C_class_t *expected_type,
+ hbool_t *in_cache_ptr, hbool_t *type_ok_ptr);
+H5_DLL herr_t H5C_validate_index_list(H5C_t *cache_ptr);
#endif /* NDEBUG */
#endif /* !_H5Cprivate_H */
-
diff --git a/src/H5Cpublic.h b/src/H5Cpublic.h
index 565f41b..075d91f 100644
--- a/src/H5Cpublic.h
+++ b/src/H5Cpublic.h
@@ -31,20 +31,11 @@
extern "C" {
#endif
-enum H5C_cache_incr_mode
-{
- H5C_incr__off,
- H5C_incr__threshold
-};
+enum H5C_cache_incr_mode { H5C_incr__off, H5C_incr__threshold };
-enum H5C_cache_flash_incr_mode
-{
- H5C_flash_incr__off,
- H5C_flash_incr__add_space
-};
+enum H5C_cache_flash_incr_mode { H5C_flash_incr__off, H5C_flash_incr__add_space };
-enum H5C_cache_decr_mode
-{
+enum H5C_cache_decr_mode {
H5C_decr__off,
H5C_decr__threshold,
H5C_decr__age_out,
diff --git a/src/H5Cquery.c b/src/H5Cquery.c
index 9f1ec31..56f5289 100644
--- a/src/H5Cquery.c
+++ b/src/H5Cquery.c
@@ -27,50 +27,41 @@
/* Module Setup */
/****************/
-#include "H5Cmodule.h" /* This source code file is part of the H5C module */
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
-
+#include "H5Cmodule.h" /* This source code file is part of the H5C module */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Cpkg.h" /* Cache */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* Files */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Cpkg.h" /* Cache */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5C_get_cache_auto_resize_config
*
@@ -86,28 +77,26 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5C_get_cache_auto_resize_config(const H5C_t * cache_ptr,
- H5C_auto_size_ctl_t *config_ptr)
+H5C_get_cache_auto_resize_config(const H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
- if(config_ptr == NULL)
+ if (config_ptr == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad config_ptr on entry.")
*config_ptr = cache_ptr->resize_ctl;
config_ptr->set_initial_size = FALSE;
- config_ptr->initial_size = cache_ptr->max_cache_size;
+ config_ptr->initial_size = cache_ptr->max_cache_size;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_get_cache_auto_resize_config() */
-
/*-------------------------------------------------------------------------
* Function: H5C_get_cache_size
*
@@ -125,36 +114,32 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_get_cache_size(H5C_t * cache_ptr,
- size_t * max_size_ptr,
- size_t * min_clean_size_ptr,
- size_t * cur_size_ptr,
- uint32_t * cur_num_entries_ptr)
+H5C_get_cache_size(H5C_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr,
+ uint32_t *cur_num_entries_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
- if(max_size_ptr != NULL)
+ if (max_size_ptr != NULL)
*max_size_ptr = cache_ptr->max_cache_size;
- if(min_clean_size_ptr != NULL)
+ if (min_clean_size_ptr != NULL)
*min_clean_size_ptr = cache_ptr->min_clean_size;
- if(cur_size_ptr != NULL)
+ if (cur_size_ptr != NULL)
*cur_size_ptr = cache_ptr->index_size;
- if(cur_num_entries_ptr != NULL)
+ if (cur_num_entries_ptr != NULL)
*cur_num_entries_ptr = cache_ptr->index_len;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_get_cache_size() */
-
/*-------------------------------------------------------------------------
* Function: H5C_get_cache_flush_in_progress
*
@@ -166,23 +151,22 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_get_cache_flush_in_progress(H5C_t * cache_ptr, hbool_t *flush_in_progress_ptr)
+H5C_get_cache_flush_in_progress(H5C_t *cache_ptr, hbool_t *flush_in_progress_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
- if(flush_in_progress_ptr != NULL)
+ if (flush_in_progress_ptr != NULL)
*flush_in_progress_ptr = cache_ptr->flush_in_progress;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_get_cache_flush_in_progress() */
-
/*-------------------------------------------------------------------------
* Function: H5C_get_cache_hit_rate
*
@@ -200,23 +184,22 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_get_cache_hit_rate(H5C_t * cache_ptr, double * hit_rate_ptr)
+H5C_get_cache_hit_rate(H5C_t *cache_ptr, double *hit_rate_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
- if(hit_rate_ptr == NULL)
+ if (hit_rate_ptr == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad hit_rate_ptr on entry.")
HDassert(cache_ptr->cache_hits >= 0);
HDassert(cache_ptr->cache_accesses >= cache_ptr->cache_hits);
- if(cache_ptr->cache_accesses > 0)
- *hit_rate_ptr = ((double)(cache_ptr->cache_hits)) /
- ((double)(cache_ptr->cache_accesses));
+ if (cache_ptr->cache_accesses > 0)
+ *hit_rate_ptr = ((double)(cache_ptr->cache_hits)) / ((double)(cache_ptr->cache_accesses));
else
*hit_rate_ptr = 0.0f;
@@ -224,7 +207,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_get_cache_hit_rate() */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_get_entry_status
@@ -248,21 +230,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_get_entry_status(const H5F_t *f,
- haddr_t addr,
- size_t * size_ptr,
- hbool_t * in_cache_ptr,
- hbool_t * is_dirty_ptr,
- hbool_t * is_protected_ptr,
- hbool_t * is_pinned_ptr,
- hbool_t * is_corked_ptr,
- hbool_t * is_flush_dep_parent_ptr,
- hbool_t * is_flush_dep_child_ptr,
- hbool_t * image_up_to_date_ptr)
+H5C_get_entry_status(const H5F_t *f, haddr_t addr, size_t *size_ptr, hbool_t *in_cache_ptr,
+ hbool_t *is_dirty_ptr, hbool_t *is_protected_ptr, hbool_t *is_pinned_ptr,
+ hbool_t *is_corked_ptr, hbool_t *is_flush_dep_parent_ptr,
+ hbool_t *is_flush_dep_child_ptr, hbool_t *image_up_to_date_ptr)
{
- H5C_t * cache_ptr;
- H5C_cache_entry_t * entry_ptr = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t *entry_ptr = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -280,12 +255,12 @@ H5C_get_entry_status(const H5F_t *f,
/* this test duplicates two of the above asserts, but we need an
* invocation of HGOTO_ERROR to keep the compiler happy.
*/
- if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL)
- if(entry_ptr == NULL) {
+ if (entry_ptr == NULL) {
/* the entry doesn't exist in the cache -- report this
* and quit.
*/
@@ -293,21 +268,21 @@ H5C_get_entry_status(const H5F_t *f,
} /* end if */
else {
*in_cache_ptr = TRUE;
- if(size_ptr != NULL)
+ if (size_ptr != NULL)
*size_ptr = entry_ptr->size;
- if(is_dirty_ptr != NULL)
+ if (is_dirty_ptr != NULL)
*is_dirty_ptr = entry_ptr->is_dirty;
- if(is_protected_ptr != NULL)
+ if (is_protected_ptr != NULL)
*is_protected_ptr = entry_ptr->is_protected;
- if(is_pinned_ptr != NULL)
+ if (is_pinned_ptr != NULL)
*is_pinned_ptr = entry_ptr->is_pinned;
- if(is_corked_ptr != NULL)
+ if (is_corked_ptr != NULL)
*is_corked_ptr = entry_ptr->tag_info ? entry_ptr->tag_info->corked : FALSE;
- if(is_flush_dep_parent_ptr != NULL)
+ if (is_flush_dep_parent_ptr != NULL)
*is_flush_dep_parent_ptr = (entry_ptr->flush_dep_nchildren > 0);
- if(is_flush_dep_child_ptr != NULL)
+ if (is_flush_dep_child_ptr != NULL)
*is_flush_dep_child_ptr = (entry_ptr->flush_dep_nparents > 0);
- if(image_up_to_date_ptr != NULL )
+ if (image_up_to_date_ptr != NULL)
*image_up_to_date_ptr = entry_ptr->image_up_to_date;
} /* end else */
@@ -315,7 +290,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_get_entry_status() */
-
/*-------------------------------------------------------------------------
* Function: H5C_get_evictions_enabled()
*
@@ -330,17 +304,16 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_get_evictions_enabled(const H5C_t *cache_ptr,
- hbool_t * evictions_enabled_ptr)
+H5C_get_evictions_enabled(const H5C_t *cache_ptr, hbool_t *evictions_enabled_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if((cache_ptr == NULL ) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
- if(evictions_enabled_ptr == NULL)
+ if (evictions_enabled_ptr == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad evictions_enabled_ptr on entry.")
*evictions_enabled_ptr = cache_ptr->evictions_enabled;
@@ -349,7 +322,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_get_evictions_enabled() */
-
/*-------------------------------------------------------------------------
* Function: H5C_get_aux_ptr
*
@@ -377,7 +349,6 @@ H5C_get_aux_ptr(const H5C_t *cache_ptr)
FUNC_LEAVE_NOAPI(cache_ptr->aux_ptr)
} /* H5C_get_aux_ptr() */
-
/*-------------------------------------------------------------------------
* Function: H5C_get_entry_ring
*
@@ -396,9 +367,9 @@ H5C_get_aux_ptr(const H5C_t *cache_ptr)
herr_t
H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring)
{
- H5C_t *cache_ptr; /* Pointer to cache */
- H5C_cache_entry_t *entry_ptr; /* Pointer to cache entry at address */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache_ptr; /* Pointer to cache */
+ H5C_cache_entry_t *entry_ptr; /* Pointer to cache entry at address */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -412,7 +383,7 @@ H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring)
/* Locate the entry at the address */
H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL)
- if(entry_ptr == NULL)
+ if (entry_ptr == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't find entry in index")
/* Return the ring value */
@@ -434,21 +405,20 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_get_mdc_image_info(H5C_t * cache_ptr, haddr_t *image_addr, hsize_t *image_len)
+H5C_get_mdc_image_info(H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
+ if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry")
- if(image_addr)
+ if (image_addr)
*image_addr = cache_ptr->image_addr;
- if(image_len)
+ if (image_len)
*image_len = cache_ptr->image_len;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_get_mdc_image_info() */
-
diff --git a/src/H5Ctag.c b/src/H5Ctag.c
index e92d0e4..a3eb173 100644
--- a/src/H5Ctag.c
+++ b/src/H5Ctag.c
@@ -27,68 +27,63 @@
/* Module Setup */
/****************/
-#include "H5Cmodule.h" /* This source code file is part of the H5C module */
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
-
+#include "H5Cmodule.h" /* This source code file is part of the H5C module */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Cpkg.h" /* Cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* Files */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Pprivate.h" /* Property lists */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Cpkg.h" /* Cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Pprivate.h" /* Property lists */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
/* Typedef for tagged entry iterator callback context - evict tagged entries */
typedef struct {
- H5F_t *f; /* File pointer for evicting entry */
- hbool_t evicted_entries_last_pass; /* Flag to indicate that an entry
- * was evicted when iterating over
- * cache
- */
- hbool_t pinned_entries_need_evicted;/* Flag to indicate that a pinned
- * entry was attempted to be evicted
- */
- hbool_t skipped_pf_dirty_entries; /* Flag indicating that one or more
- * entries marked prefetched_dirty
- * were encountered and not
- * evicted.
- */
+ H5F_t * f; /* File pointer for evicting entry */
+ hbool_t evicted_entries_last_pass; /* Flag to indicate that an entry
+ * was evicted when iterating over
+ * cache
+ */
+ hbool_t pinned_entries_need_evicted; /* Flag to indicate that a pinned
+ * entry was attempted to be evicted
+ */
+ hbool_t skipped_pf_dirty_entries; /* Flag indicating that one or more
+ * entries marked prefetched_dirty
+ * were encountered and not
+ * evicted.
+ */
} H5C_tag_iter_evict_ctx_t;
/* Typedef for tagged entry iterator callback context - expunge tag type metadata */
typedef struct {
- H5F_t *f; /* File pointer for evicting entry */
- int type_id; /* Cache entry type to expunge */
- unsigned flags; /* Flags for expunging entry */
+ H5F_t * f; /* File pointer for evicting entry */
+ int type_id; /* Cache entry type to expunge */
+ unsigned flags; /* Flags for expunging entry */
} H5C_tag_iter_ettm_ctx_t;
/* Typedef for tagged entry iterator callback context - mark corked */
typedef struct {
- hbool_t cork_val; /* Corked value */
+ hbool_t cork_val; /* Corked value */
} H5C_tag_iter_cork_ctx_t;
-
/********************/
/* Local Prototypes */
/********************/
static herr_t H5C__mark_tagged_entries(H5C_t *cache_ptr, haddr_t tag);
-
/*********************/
/* Package Variables */
/*********************/
@@ -96,18 +91,14 @@ static herr_t H5C__mark_tagged_entries(H5C_t *cache_ptr, haddr_t tag);
/* Declare extern free list to manage the tag info struct */
H5FL_EXTERN(H5C_tag_info_t);
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
*
* Function: H5C_ignore_tags
@@ -131,7 +122,7 @@ H5FL_EXTERN(H5C_tag_info_t);
*-------------------------------------------------------------------------
*/
herr_t
-H5C_ignore_tags(H5C_t * cache_ptr)
+H5C_ignore_tags(H5C_t *cache_ptr)
{
FUNC_ENTER_NOAPI_NOERR
@@ -145,7 +136,6 @@ H5C_ignore_tags(H5C_t * cache_ptr)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5C_ignore_tags */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_get_ignore_tags
@@ -172,7 +162,6 @@ H5C_get_ignore_tags(const H5C_t *cache_ptr)
FUNC_LEAVE_NOAPI(cache_ptr->ignore_tags)
} /* H5C_get_ignore_tags */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_get_num_objs_corked
@@ -198,7 +187,6 @@ H5C_get_num_objs_corked(const H5C_t *cache_ptr)
FUNC_LEAVE_NOAPI(cache_ptr->num_objs_corked)
} /* H5C_get_num_objs_corked */
-
/*-------------------------------------------------------------------------
*
* Function: H5C__tag_entry
@@ -218,9 +206,9 @@ H5C_get_num_objs_corked(const H5C_t *cache_ptr)
herr_t
H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry)
{
- H5C_tag_info_t *tag_info; /* Points to a tag info struct */
- haddr_t tag; /* Tag value */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_tag_info_t *tag_info; /* Points to a tag info struct */
+ haddr_t tag; /* Tag value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -232,7 +220,7 @@ H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry)
/* Get the tag */
tag = H5CX_get_tag();
- if(cache->ignore_tags) {
+ if (cache->ignore_tags) {
/* if we're ignoring tags, it's because we're running
tests on internal functions and may not have inserted a tag
value into a given API context before creating some metadata. Thus,
@@ -240,13 +228,13 @@ H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry)
arbitrarily set it to something for the sake of passing the tests.
If the tag value is set, then we'll just let it get assigned without
additional checking for correctness. */
- if(!H5F_addr_defined(tag))
+ if (!H5F_addr_defined(tag))
tag = H5AC__IGNORE_TAG;
} /* end if */
#if H5C_DO_TAGGING_SANITY_CHECKS
else {
/* Perform some sanity checks to ensure that a correct tag is being applied */
- if(H5C_verify_tag(entry->type->id, tag) < 0)
+ if (H5C_verify_tag(entry->type->id, tag) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "tag verification failed")
} /* end else */
#endif
@@ -255,16 +243,16 @@ H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry)
tag_info = (H5C_tag_info_t *)H5SL_search(cache->tag_list, &tag);
/* Check if this is the first entry for this tagged object */
- if(NULL == tag_info) {
+ if (NULL == tag_info) {
/* Allocate new tag info struct */
- if(NULL == (tag_info = H5FL_CALLOC(H5C_tag_info_t)))
+ if (NULL == (tag_info = H5FL_CALLOC(H5C_tag_info_t)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate tag info for cache entry")
/* Set the tag for all entries */
tag_info->tag = tag;
/* Insert tag info into skip list */
- if(H5SL_insert(cache->tag_list, tag_info, &(tag_info->tag)) < 0 )
+ if (H5SL_insert(cache->tag_list, tag_info, &(tag_info->tag)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert tag info in skip list")
} /* end if */
else
@@ -276,9 +264,9 @@ H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry)
HDassert(entry->tag_info == NULL);
/* Add the entry to the list for the tagged object */
- entry->tl_next = tag_info->head;
+ entry->tl_next = tag_info->head;
entry->tag_info = tag_info;
- if(tag_info->head)
+ if (tag_info->head)
tag_info->head->tl_prev = entry;
tag_info->head = entry;
tag_info->entry_cnt++;
@@ -287,7 +275,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__tag_entry */
-
/*-------------------------------------------------------------------------
*
* Function: H5C__untag_entry
@@ -305,8 +292,8 @@ done:
herr_t
H5C__untag_entry(H5C_t *cache, H5C_cache_entry_t *entry)
{
- H5C_tag_info_t *tag_info; /* Points to a tag info struct */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_tag_info_t *tag_info; /* Points to a tag info struct */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -316,27 +303,27 @@ H5C__untag_entry(H5C_t *cache, H5C_cache_entry_t *entry)
HDassert(cache->magic == H5C__H5C_T_MAGIC);
/* Get the entry's tag info struct */
- if(NULL != (tag_info = entry->tag_info)) {
+ if (NULL != (tag_info = entry->tag_info)) {
/* Remove the entry from the list */
- if(entry->tl_next)
+ if (entry->tl_next)
entry->tl_next->tl_prev = entry->tl_prev;
- if(entry->tl_prev)
+ if (entry->tl_prev)
entry->tl_prev->tl_next = entry->tl_next;
- if(tag_info->head == entry)
+ if (tag_info->head == entry)
tag_info->head = entry->tl_next;
tag_info->entry_cnt--;
/* Reset pointers, to avoid confusion */
- entry->tl_next = NULL;
- entry->tl_prev = NULL;
+ entry->tl_next = NULL;
+ entry->tl_prev = NULL;
entry->tag_info = NULL;
/* Remove the tag info from the tag list, if there's no more entries with this tag */
- if(!tag_info->corked && 0 == tag_info->entry_cnt) {
+ if (!tag_info->corked && 0 == tag_info->entry_cnt) {
/* Sanity check */
HDassert(NULL == tag_info->head);
- if(H5SL_remove(cache->tag_list, &(tag_info->tag)) != tag_info)
+ if (H5SL_remove(cache->tag_list, &(tag_info->tag)) != tag_info)
HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove tag info from list")
/* Release the tag info */
@@ -350,7 +337,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__untag_entry */
-
/*-------------------------------------------------------------------------
*
* Function: H5C__iter_tagged_entries_real
@@ -365,11 +351,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__iter_tagged_entries_real(H5C_t *cache, haddr_t tag, H5C_tag_iter_cb_t cb,
- void *cb_ctx)
+H5C__iter_tagged_entries_real(H5C_t *cache, haddr_t tag, H5C_tag_iter_cb_t cb, void *cb_ctx)
{
- H5C_tag_info_t *tag_info; /* Points to a tag info struct */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_tag_info_t *tag_info; /* Points to a tag info struct */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Function enter macro */
FUNC_ENTER_STATIC
@@ -382,9 +367,9 @@ H5C__iter_tagged_entries_real(H5C_t *cache, haddr_t tag, H5C_tag_iter_cb_t cb,
tag_info = (H5C_tag_info_t *)H5SL_search(cache->tag_list, &tag);
/* If there's any entries for this tag, iterate over them */
- if(tag_info) {
- H5C_cache_entry_t *entry; /* Pointer to current entry */
- H5C_cache_entry_t *next_entry; /* Pointer to next entry in hash bucket chain */
+ if (tag_info) {
+ H5C_cache_entry_t *entry; /* Pointer to current entry */
+ H5C_cache_entry_t *next_entry; /* Pointer to next entry in hash bucket chain */
/* Sanity check */
HDassert(tag_info->head);
@@ -392,24 +377,23 @@ H5C__iter_tagged_entries_real(H5C_t *cache, haddr_t tag, H5C_tag_iter_cb_t cb,
/* Iterate over the entries for this tag */
entry = tag_info->head;
- while(entry) {
+ while (entry) {
/* Acquire pointer to next entry */
next_entry = entry->tl_next;
/* Make callback for entry */
- if((cb)(entry, cb_ctx) != H5_ITER_CONT)
+ if ((cb)(entry, cb_ctx) != H5_ITER_CONT)
HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "tagged entry iteration callback failed")
/* Advance to next entry */
entry = next_entry;
} /* end while */
- } /* end if */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__iter_tagged_entries_real() */
-
/*-------------------------------------------------------------------------
*
* Function: H5C__iter_tagged_entries
@@ -424,10 +408,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C__iter_tagged_entries(H5C_t *cache, haddr_t tag, hbool_t match_global,
- H5C_tag_iter_cb_t cb, void *cb_ctx)
+H5C__iter_tagged_entries(H5C_t *cache, haddr_t tag, hbool_t match_global, H5C_tag_iter_cb_t cb, void *cb_ctx)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Function enter macro */
FUNC_ENTER_PACKAGE
@@ -437,17 +420,17 @@ H5C__iter_tagged_entries(H5C_t *cache, haddr_t tag, hbool_t match_global,
HDassert(cache->magic == H5C__H5C_T_MAGIC);
/* Iterate over the entries for this tag */
- if(H5C__iter_tagged_entries_real(cache, tag, cb, cb_ctx) < 0)
+ if (H5C__iter_tagged_entries_real(cache, tag, cb, cb_ctx) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "iteration of tagged entries failed")
/* Check for iterating over global metadata */
- if(match_global) {
+ if (match_global) {
/* Iterate over the entries for SOHM entries */
- if(H5C__iter_tagged_entries_real(cache, H5AC__SOHM_TAG, cb, cb_ctx) < 0)
+ if (H5C__iter_tagged_entries_real(cache, H5AC__SOHM_TAG, cb, cb_ctx) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "iteration of tagged entries failed")
/* Iterate over the entries for global heap entries */
- if(H5C__iter_tagged_entries_real(cache, H5AC__GLOBALHEAP_TAG, cb, cb_ctx) < 0)
+ if (H5C__iter_tagged_entries_real(cache, H5AC__GLOBALHEAP_TAG, cb, cb_ctx) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "iteration of tagged entries failed")
} /* end if */
@@ -455,7 +438,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__iter_tagged_entries() */
-
/*-------------------------------------------------------------------------
*
* Function: H5C__evict_tagged_entries_cb
@@ -473,7 +455,7 @@ static int
H5C__evict_tagged_entries_cb(H5C_cache_entry_t *entry, void *_ctx)
{
H5C_tag_iter_evict_ctx_t *ctx = (H5C_tag_iter_evict_ctx_t *)_ctx; /* Get pointer to iterator context */
- int ret_value = H5_ITER_CONT; /* Return value */
+ int ret_value = H5_ITER_CONT; /* Return value */
/* Function enter macro */
FUNC_ENTER_STATIC
@@ -483,18 +465,20 @@ H5C__evict_tagged_entries_cb(H5C_cache_entry_t *entry, void *_ctx)
HDassert(ctx);
/* Attempt to evict entry */
- if(entry->is_protected)
+ if (entry->is_protected)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Cannot evict protected entry")
- else if(entry->is_dirty)
+ else if (entry->is_dirty)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Cannot evict dirty entry")
- else if(entry->is_pinned)
+ else if (entry->is_pinned)
/* Can't evict at this time, but let's note that we hit a pinned
entry and we'll loop back around again (as evicting other
entries will hopefully unpin this entry) */
ctx->pinned_entries_need_evicted = TRUE;
- else if(!entry->prefetched_dirty) {
+ else if (!entry->prefetched_dirty) {
/* Evict the Entry */
- if(H5C__flush_single_entry(ctx->f, entry, H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
+ if (H5C__flush_single_entry(ctx->f, entry,
+ H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG |
+ H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Entry eviction failed.")
ctx->evicted_entries_last_pass = TRUE;
}
@@ -505,7 +489,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__evict_tagged_entries_cb() */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_evict_tagged_entries
@@ -520,11 +503,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_evict_tagged_entries(H5F_t * f, haddr_t tag, hbool_t match_global)
+H5C_evict_tagged_entries(H5F_t *f, haddr_t tag, hbool_t match_global)
{
- H5C_t *cache; /* Pointer to cache structure */
- H5C_tag_iter_evict_ctx_t ctx; /* Context for iterator callback */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache; /* Pointer to cache structure */
+ H5C_tag_iter_evict_ctx_t ctx; /* Context for iterator callback */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Function enter macro */
FUNC_ENTER_NOAPI(FAIL)
@@ -532,7 +515,7 @@ H5C_evict_tagged_entries(H5F_t * f, haddr_t tag, hbool_t match_global)
/* Sanity checks */
HDassert(f);
HDassert(f->shared);
- cache = f->shared->cache; /* Get cache pointer */
+ cache = f->shared->cache; /* Get cache pointer */
HDassert(cache != NULL);
HDassert(cache->magic == H5C__H5C_T_MAGIC);
@@ -543,15 +526,15 @@ H5C_evict_tagged_entries(H5F_t * f, haddr_t tag, hbool_t match_global)
do {
/* Reset pinned/evicted tracking flags */
ctx.pinned_entries_need_evicted = FALSE;
- ctx.evicted_entries_last_pass = FALSE;
- ctx.skipped_pf_dirty_entries = FALSE;
+ ctx.evicted_entries_last_pass = FALSE;
+ ctx.skipped_pf_dirty_entries = FALSE;
/* Iterate through entries in the cache */
- if(H5C__iter_tagged_entries(cache, tag, match_global, H5C__evict_tagged_entries_cb, &ctx) < 0)
+ if (H5C__iter_tagged_entries(cache, tag, match_global, H5C__evict_tagged_entries_cb, &ctx) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed")
/* Keep doing this until we have stopped evicted entries */
- } while(TRUE == ctx.evicted_entries_last_pass);
+ } while (TRUE == ctx.evicted_entries_last_pass);
/* In most cases, fail if we have finished evicting entries and pinned
* entries still need evicted
@@ -578,14 +561,13 @@ H5C_evict_tagged_entries(H5F_t * f, haddr_t tag, hbool_t match_global)
* Thus we must ignore ctx.pinned_entries_need_evicted if
* ctx.skipped_pf_dirty_entries is TRUE.
*/
- if((!ctx.skipped_pf_dirty_entries) && (ctx.pinned_entries_need_evicted))
+ if ((!ctx.skipped_pf_dirty_entries) && (ctx.pinned_entries_need_evicted))
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Pinned entries still need evicted?!")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_evict_tagged_entries() */
-
/*-------------------------------------------------------------------------
*
* Function: H5C__mark_tagged_entries_cb
@@ -610,13 +592,12 @@ H5C__mark_tagged_entries_cb(H5C_cache_entry_t *entry, void H5_ATTR_UNUSED *_ctx)
/* We only want to set the flush marker on entries that
* actually need flushed (i.e., dirty ones) */
- if(entry->is_dirty)
+ if (entry->is_dirty)
entry->flush_marker = TRUE;
FUNC_LEAVE_NOAPI(H5_ITER_CONT)
} /* H5C__mark_tagged_entries_cb() */
-
/*-------------------------------------------------------------------------
*
* Function: H5C__mark_tagged_entries
@@ -634,7 +615,7 @@ H5C__mark_tagged_entries_cb(H5C_cache_entry_t *entry, void H5_ATTR_UNUSED *_ctx)
static herr_t
H5C__mark_tagged_entries(H5C_t *cache, haddr_t tag)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Function enter macro */
FUNC_ENTER_STATIC
@@ -646,7 +627,7 @@ H5C__mark_tagged_entries(H5C_t *cache, haddr_t tag)
/* Iterate through hash table entries, marking those with specified tag, as
* well as any major global entries which should always be flushed
* when flushing based on tag value */
- if(H5C__iter_tagged_entries(cache, tag, TRUE, H5C__mark_tagged_entries_cb, NULL) < 0)
+ if (H5C__iter_tagged_entries(cache, tag, TRUE, H5C__mark_tagged_entries_cb, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed")
done:
@@ -654,7 +635,7 @@ done:
} /* H5C__mark_tagged_entries() */
#if H5C_DO_TAGGING_SANITY_CHECKS
-
+
/*-------------------------------------------------------------------------
*
* Function: H5C_verify_tag
@@ -678,10 +659,10 @@ H5C_verify_tag(int id, haddr_t tag)
/* Perform some sanity checks on tag value. Certain entry
* types require certain tag values, so check that these
* constraints are met. */
- if(tag == H5AC__IGNORE_TAG)
+ if (tag == H5AC__IGNORE_TAG)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "cannot ignore a tag while doing verification.")
- else if(tag == H5AC__INVALID_TAG) {
- if(id != H5AC_PROXY_ENTRY_ID)
+ else if (tag == H5AC__INVALID_TAG) {
+ if (id != H5AC_PROXY_ENTRY_ID)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "no metadata tag provided")
} /* end else-if */
else {
@@ -690,41 +671,42 @@ H5C_verify_tag(int id, haddr_t tag)
* constraints are met. */
/* Superblock */
- if((id == H5AC_SUPERBLOCK_ID) || (id == H5AC_DRVRINFO_ID)) {
- if(tag != H5AC__SUPERBLOCK_TAG)
+ if ((id == H5AC_SUPERBLOCK_ID) || (id == H5AC_DRVRINFO_ID)) {
+ if (tag != H5AC__SUPERBLOCK_TAG)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "superblock not tagged with H5AC__SUPERBLOCK_TAG")
} /* end if */
else {
- if(tag == H5AC__SUPERBLOCK_TAG)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__SUPERBLOCK_TAG applied to non-superblock entry")
+ if (tag == H5AC__SUPERBLOCK_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL,
+ "H5AC__SUPERBLOCK_TAG applied to non-superblock entry")
} /* end else */
/* Free Space Manager */
- if(tag == H5AC__FREESPACE_TAG && ((id != H5AC_FSPACE_HDR_ID) && (id != H5AC_FSPACE_SINFO_ID)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__FREESPACE_TAG applied to non-freespace entry")
+ if (tag == H5AC__FREESPACE_TAG && ((id != H5AC_FSPACE_HDR_ID) && (id != H5AC_FSPACE_SINFO_ID)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__FREESPACE_TAG applied to non-freespace entry")
/* SOHM */
- if((id == H5AC_SOHM_TABLE_ID) || (id == H5AC_SOHM_LIST_ID))
- if(tag != H5AC__SOHM_TAG)
+ if ((id == H5AC_SOHM_TABLE_ID) || (id == H5AC_SOHM_LIST_ID))
+ if (tag != H5AC__SOHM_TAG)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "sohm entry not tagged with H5AC__SOHM_TAG")
/* Global Heap */
- if(id == H5AC_GHEAP_ID) {
- if(tag != H5AC__GLOBALHEAP_TAG)
+ if (id == H5AC_GHEAP_ID) {
+ if (tag != H5AC__GLOBALHEAP_TAG)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "global heap not tagged with H5AC__GLOBALHEAP_TAG")
} /* end if */
else {
- if(tag == H5AC__GLOBALHEAP_TAG)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__GLOBALHEAP_TAG applied to non-globalheap entry")
+ if (tag == H5AC__GLOBALHEAP_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL,
+ "H5AC__GLOBALHEAP_TAG applied to non-globalheap entry")
} /* end else */
- } /* end else */
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_verify_tag */
#endif
-
/*-------------------------------------------------------------------------
*
* Function: H5C_flush_tagged_entries
@@ -742,8 +724,8 @@ herr_t
H5C_flush_tagged_entries(H5F_t *f, haddr_t tag)
{
/* Variable Declarations */
- H5C_t *cache_ptr = NULL;
- herr_t ret_value = SUCCEED;
+ H5C_t *cache_ptr = NULL;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
@@ -755,18 +737,17 @@ H5C_flush_tagged_entries(H5F_t *f, haddr_t tag)
cache_ptr = f->shared->cache;
/* Mark all entries with specified tag */
- if(H5C__mark_tagged_entries(cache_ptr, tag) < 0)
+ if (H5C__mark_tagged_entries(cache_ptr, tag) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't mark tagged entries")
/* Flush all marked entries */
- if(H5C__flush_marked_entries(f) < 0)
+ if (H5C__flush_marked_entries(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush marked entries")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_flush_tagged_entries */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_retag_entries
@@ -785,8 +766,8 @@ done:
herr_t
H5C_retag_entries(H5C_t *cache, haddr_t src_tag, haddr_t dest_tag)
{
- H5C_tag_info_t *tag_info; /* Points to a tag info struct */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_tag_info_t *tag_info; /* Points to a tag info struct */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Function enter macro */
FUNC_ENTER_NOAPI(FAIL)
@@ -795,12 +776,12 @@ H5C_retag_entries(H5C_t *cache, haddr_t src_tag, haddr_t dest_tag)
HDassert(cache);
/* Remove tag info from tag list */
- if(NULL != (tag_info = (H5C_tag_info_t *)H5SL_remove(cache->tag_list, &src_tag))) {
+ if (NULL != (tag_info = (H5C_tag_info_t *)H5SL_remove(cache->tag_list, &src_tag))) {
/* Change to new tag */
tag_info->tag = dest_tag;
/* Re-insert tag info into skip list */
- if(H5SL_insert(cache->tag_list, tag_info, &(tag_info->tag)) < 0)
+ if (H5SL_insert(cache->tag_list, tag_info, &(tag_info->tag)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert tag info in skip list")
} /* end if */
@@ -808,7 +789,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_retag_entries() */
-
/*-------------------------------------------------------------------------
*
* Function: H5C__expunge_tag_type_metadata_cb
@@ -827,7 +807,7 @@ static int
H5C__expunge_tag_type_metadata_cb(H5C_cache_entry_t *entry, void *_ctx)
{
H5C_tag_iter_ettm_ctx_t *ctx = (H5C_tag_iter_ettm_ctx_t *)_ctx; /* Get pointer to iterator context */
- int ret_value = H5_ITER_CONT; /* Return value */
+ int ret_value = H5_ITER_CONT; /* Return value */
/* Function enter macro */
FUNC_ENTER_STATIC
@@ -837,15 +817,14 @@ H5C__expunge_tag_type_metadata_cb(H5C_cache_entry_t *entry, void *_ctx)
HDassert(ctx);
/* Found one with the same tag and type id */
- if(entry->type->id == ctx->type_id)
- if(H5C_expunge_entry(ctx->f, entry->type, entry->addr, ctx->flags) < 0)
+ if (entry->type->id == ctx->type_id)
+ if (H5C_expunge_entry(ctx->f, entry->type, entry->addr, ctx->flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, H5_ITER_ERROR, "can't expunge entry")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__expunge_tag_type_metadata_cb() */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_expunge_tag_type_metadata
@@ -863,9 +842,9 @@ done:
herr_t
H5C_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flags)
{
- H5C_t *cache; /* Pointer to cache structure */
- H5C_tag_iter_ettm_ctx_t ctx; /* Context for iterator callback */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5C_t * cache; /* Pointer to cache structure */
+ H5C_tag_iter_ettm_ctx_t ctx; /* Context for iterator callback */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Function enter macro */
FUNC_ENTER_NOAPI(FAIL)
@@ -873,24 +852,23 @@ H5C_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flags
/* Sanity checks */
HDassert(f);
HDassert(f->shared);
- cache = f->shared->cache; /* Get cache pointer */
+ cache = f->shared->cache; /* Get cache pointer */
HDassert(cache != NULL);
HDassert(cache->magic == H5C__H5C_T_MAGIC);
/* Construct context for iterator callbacks */
- ctx.f = f;
+ ctx.f = f;
ctx.type_id = type_id;
- ctx.flags = flags;
+ ctx.flags = flags;
/* Iterate through hash table entries, expunge those with specified tag and type id */
- if(H5C__iter_tagged_entries(cache, tag, FALSE, H5C__expunge_tag_type_metadata_cb, &ctx) < 0)
+ if (H5C__iter_tagged_entries(cache, tag, FALSE, H5C__expunge_tag_type_metadata_cb, &ctx) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_expunge_tag_type_metadata() */
-
/*-------------------------------------------------------------------------
*
* Function: H5C_get_tag()
@@ -907,7 +885,7 @@ done:
herr_t
H5C_get_tag(const void *thing, haddr_t *tag /*OUT*/)
{
- const H5C_cache_entry_t *entry = (const H5C_cache_entry_t *)thing; /* Pointer to cache entry */
+ const H5C_cache_entry_t *entry = (const H5C_cache_entry_t *)thing; /* Pointer to cache entry */
FUNC_ENTER_NOAPI_NOERR
@@ -920,4 +898,3 @@ H5C_get_tag(const void *thing, haddr_t *tag /*OUT*/)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5C_get_tag() */
-
diff --git a/src/H5Ctest.c b/src/H5Ctest.c
index 7f24302..8a4f22e 100644
--- a/src/H5Ctest.c
+++ b/src/H5Ctest.c
@@ -27,60 +27,50 @@
/* Module Setup */
/****************/
-#include "H5Cmodule.h" /* This source code file is part of the H5C module */
-#define H5C_TESTING /*suppress warning about H5C testing funcs*/
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
-
+#include "H5Cmodule.h" /* This source code file is part of the H5C module */
+#define H5C_TESTING /*suppress warning about H5C testing funcs*/
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Cpkg.h" /* Cache */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* Files */
-#include "H5Iprivate.h" /* IDs */
+#include "H5private.h" /* Generic Functions */
+#include "H5Cpkg.h" /* Cache */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
+#include "H5Iprivate.h" /* IDs */
#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5VLnative_private.h" /* Native VOL connector */
-
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
/* Typedef for tagged entry iterator callback context - verify cork tag */
typedef struct {
- hbool_t status; /* Corked status */
+ hbool_t status; /* Corked status */
} H5C_tag_iter_vct_ctx_t;
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
-
/*-------------------------------------------------------------------------
* Function: H5C__verify_cork_tag_test_cb
*
@@ -97,8 +87,8 @@ static int
H5C__verify_cork_tag_test_cb(H5C_cache_entry_t *entry, void *_ctx)
{
H5C_tag_iter_vct_ctx_t *ctx = (H5C_tag_iter_vct_ctx_t *)_ctx; /* Get pointer to iterator context */
- hbool_t is_corked; /* Corked status for entry */
- int ret_value = H5_ITER_CONT; /* Return value */
+ hbool_t is_corked; /* Corked status for entry */
+ int ret_value = H5_ITER_CONT; /* Return value */
/* Function enter macro */
FUNC_ENTER_STATIC
@@ -111,14 +101,13 @@ H5C__verify_cork_tag_test_cb(H5C_cache_entry_t *entry, void *_ctx)
is_corked = entry->tag_info ? entry->tag_info->corked : FALSE;
/* Verify corked status for entry */
- if(is_corked != ctx->status)
+ if (is_corked != ctx->status)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, H5_ITER_ERROR, "bad cork status")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__verify_cork_tag_test_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5C__verify_cork_tag_test
*
@@ -135,22 +124,22 @@ done:
herr_t
H5C__verify_cork_tag_test(hid_t fid, H5O_token_t tag_token, hbool_t status)
{
- H5F_t * f; /* File Pointer */
- H5C_t * cache; /* Cache Pointer */
- H5C_tag_iter_vct_ctx_t ctx; /* Context for iterator callback */
- haddr_t tag; /* Tagged address */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t * f; /* File Pointer */
+ H5C_t * cache; /* Cache Pointer */
+ H5C_tag_iter_vct_ctx_t ctx; /* Context for iterator callback */
+ haddr_t tag; /* Tagged address */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Function enter macro */
FUNC_ENTER_PACKAGE
/* Get file pointer */
- if(NULL == (f = (H5F_t *)H5VL_object_verify(fid, H5I_FILE)))
+ if (NULL == (f = (H5F_t *)H5VL_object_verify(fid, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
/* Convert token to address */
tag = HADDR_UNDEF;
- if(H5VL_native_token_to_addr(f, H5I_FILE, tag_token, &tag) < 0)
+ if (H5VL_native_token_to_addr(f, H5I_FILE, tag_token, &tag) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't get address for token")
/* Get cache pointer */
@@ -160,10 +149,9 @@ H5C__verify_cork_tag_test(hid_t fid, H5O_token_t tag_token, hbool_t status)
ctx.status = status;
/* Iterate through tagged entries in the cache */
- if(H5C__iter_tagged_entries(cache, tag, FALSE, H5C__verify_cork_tag_test_cb, &ctx) < 0)
+ if (H5C__iter_tagged_entries(cache, tag, FALSE, H5C__verify_cork_tag_test_cb, &ctx) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "iteration of tagged entries failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__verify_cork_tag_test() */
-
diff --git a/src/H5D.c b/src/H5D.c
index 3428d77..b8b6f65 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -15,38 +15,33 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5VLprivate.h" /* Virtual Object Layer */
#include "H5VLnative_private.h" /* Native VOL connector */
-
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
@@ -54,7 +49,6 @@
/* Package initialization variable */
hbool_t H5_PKG_INIT_VAR = FALSE;
-
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -62,13 +56,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Declare extern the free list to manage blocks of type conversion data */
H5FL_BLK_EXTERN(type_conv);
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5Dcreate2
*
@@ -96,37 +87,35 @@ H5FL_BLK_EXTERN(type_conv);
*-------------------------------------------------------------------------
*/
hid_t
-H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
- hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id)
+H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t lcpl_id, hid_t dcpl_id,
+ hid_t dapl_id)
{
- void *dset = NULL; /* New dataset's info */
- H5VL_object_t *vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void * dset = NULL; /* New dataset's info */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
- H5TRACE7("i", "i*siiiii", loc_id, name, type_id, space_id, lcpl_id, dcpl_id,
- dapl_id);
+ H5TRACE7("i", "i*siiiii", loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id);
/* Check arguments */
- if(!name)
+ if (!name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
- if(!*name)
+ if (!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Get link creation property list */
- if(H5P_DEFAULT == lcpl_id)
+ if (H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
- else
- if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "lcpl_id is not a link creation property list")
+ else if (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "lcpl_id is not a link creation property list")
/* Get dataset creation property list */
- if(H5P_DEFAULT == dcpl_id)
+ if (H5P_DEFAULT == dcpl_id)
dcpl_id = H5P_DATASET_CREATE_DEFAULT;
- else
- if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "dcpl_id is not a dataset create property list ID")
+ else if (TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID,
+ "dcpl_id is not a dataset create property list ID")
/* Set the DCPL for the API context */
H5CX_set_dcpl(dcpl_id);
@@ -135,34 +124,34 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
H5CX_set_lcpl(lcpl_id);
/* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
+ if (H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* Get the location object */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Set location parameters */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
/* Create the dataset */
- if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if (NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, lcpl_id, type_id, space_id, dcpl_id,
+ dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an ID for the dataset */
- if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
- if(H5I_INVALID_HID == ret_value)
- if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value)
+ if (dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dcreate2() */
-
/*-------------------------------------------------------------------------
* Function: H5Dcreate_anon
*
@@ -196,33 +185,31 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
- hid_t dapl_id)
+H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id)
{
- void *dset = NULL; /* dset object from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void * dset = NULL; /* dset object from VOL connector */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "iiiii", loc_id, type_id, space_id, dcpl_id, dapl_id);
/* Check arguments */
- if(H5P_DEFAULT == dcpl_id)
+ if (H5P_DEFAULT == dcpl_id)
dcpl_id = H5P_DATASET_CREATE_DEFAULT;
- else
- if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID")
+ else if (TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID")
/* Set the DCPL for the API context */
H5CX_set_dcpl(dcpl_id);
/* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
+ if (H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* get the location object */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Set location parameters */
@@ -230,23 +217,24 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Create the dataset */
- if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, NULL, H5P_LINK_CREATE_DEFAULT, type_id, space_id, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if (NULL ==
+ (dset = H5VL_dataset_create(vol_obj, &loc_params, NULL, H5P_LINK_CREATE_DEFAULT, type_id, space_id,
+ dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */
- if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
/* Cleanup on failure */
- if(H5I_INVALID_HID == ret_value)
- if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value)
+ if (dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dcreate_anon() */
-
/*-------------------------------------------------------------------------
* Function: H5Dopen2
*
@@ -265,49 +253,49 @@ done:
hid_t
H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id)
{
- void *dset = NULL; /* dset object from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void * dset = NULL; /* dset object from VOL connector */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
+ H5VL_loc_params_t loc_params;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "i*si", loc_id, name, dapl_id);
/* Check args */
- if(!name)
+ if (!name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
- if(!*name)
+ if (!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
- if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, FALSE) < 0)
+ if (H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* get the location object */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Set the location parameters */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(loc_id);
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
/* Open the dataset */
- if(NULL == (dset = H5VL_dataset_open(vol_obj, &loc_params, name, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if (NULL == (dset = H5VL_dataset_open(vol_obj, &loc_params, name, dapl_id, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset")
/* Register an atom for the dataset */
- if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
done:
- if(H5I_INVALID_HID == ret_value)
- if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value)
+ if (dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dopen2() */
-
/*-------------------------------------------------------------------------
* Function: H5Dclose
*
@@ -322,26 +310,25 @@ done:
herr_t
H5Dclose(hid_t dset_id)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", dset_id);
/* Check args */
- if(H5I_DATASET != H5I_get_type(dset_id))
+ if (H5I_DATASET != H5I_get_type(dset_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset ID")
/* Decrement the counter on the dataset. It will be freed if the count
* reaches zero.
*/
- if(H5I_dec_app_ref_always_close(dset_id) < 0)
+ if (H5I_dec_app_ref_always_close(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dclose() */
-
/*-------------------------------------------------------------------------
* Function: H5Dget_space
*
@@ -358,25 +345,25 @@ done:
hid_t
H5Dget_space(hid_t dset_id)
{
- H5VL_object_t *vol_obj = NULL; /* Dataset structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Dataset structure */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
/* Check args */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
/* Get the dataspace */
- if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_space() */
-
/*-------------------------------------------------------------------------
* Function: H5Dget_space_status
*
@@ -389,25 +376,25 @@ done:
herr_t
H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation)
{
- H5VL_object_t *vol_obj = NULL; /* Dataset structure */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Dataset structure */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*Ds", dset_id, allocation);
/* Check args */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
/* Get dataspace status */
- if((ret_value = H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE_STATUS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, allocation)) < 0)
+ if ((ret_value = H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE_STATUS, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, allocation)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Dget_space_status() */
-
/*-------------------------------------------------------------------------
* Function: H5Dget_type
*
@@ -424,25 +411,25 @@ done:
hid_t
H5Dget_type(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset structure */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
/* Check args */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
/* Get the datatype */
- if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_type() */
-
/*-------------------------------------------------------------------------
* Function: H5Dget_create_plist
*
@@ -462,25 +449,25 @@ done:
hid_t
H5Dget_create_plist(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset structure */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
/* Check args */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
/* Get the dataset creation property list */
- if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_create_plist() */
-
/*-------------------------------------------------------------------------
* Function: H5Dget_access_plist
*
@@ -517,25 +504,25 @@ done:
hid_t
H5Dget_access_plist(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset structure */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
/* Check args */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
/* Get the dataset access property list */
- if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_access_plist() */
-
/*-------------------------------------------------------------------------
* Function: H5Dget_storage_size
*
@@ -554,25 +541,25 @@ done:
hsize_t
H5Dget_storage_size(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- hsize_t ret_value = 0; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset for this operation */
+ hsize_t ret_value = 0; /* Return value */
FUNC_ENTER_API(0)
H5TRACE1("h", "i", dset_id);
/* Check args */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier")
/* Get the storage size */
- if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_storage_size() */
-
/*-------------------------------------------------------------------------
* Function: H5Dget_offset
*
@@ -587,25 +574,25 @@ done:
haddr_t
H5Dget_offset(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- haddr_t ret_value = HADDR_UNDEF; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset for this operation */
+ haddr_t ret_value = HADDR_UNDEF; /* Return value */
FUNC_ENTER_API(HADDR_UNDEF)
H5TRACE1("a", "i", dset_id);
/* Check args */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier")
/* Get the offset */
- if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_offset() */
-
/*-------------------------------------------------------------------------
* Function: H5Diterate
*
@@ -666,42 +653,40 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op,
- void *operator_data)
+H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op, void *operator_data)
{
- H5T_t *type; /* Datatype */
- H5S_t *space; /* Dataspace for iteration */
- H5S_sel_iter_op_t dset_op; /* Operator for iteration */
- herr_t ret_value; /* Return value */
+ H5T_t * type; /* Datatype */
+ H5S_t * space; /* Dataspace for iteration */
+ H5S_sel_iter_op_t dset_op; /* Operator for iteration */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "*xiix*x", buf, type_id, space_id, op, operator_data);
/* Check args */
- if(NULL == op)
+ if (NULL == op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid operator")
- if(NULL == buf)
+ if (NULL == buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer")
- if(H5I_DATATYPE != H5I_get_type(type_id))
+ if (H5I_DATATYPE != H5I_get_type(type_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid datatype")
- if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype")
- if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
- if(!(H5S_has_extent(space)))
+ if (!(H5S_has_extent(space)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
- dset_op.op_type = H5S_SEL_ITER_OP_APP;
- dset_op.u.app_op.op = op;
+ dset_op.op_type = H5S_SEL_ITER_OP_APP;
+ dset_op.u.app_op.op = op;
dset_op.u.app_op.type_id = type_id;
ret_value = H5S_select_iterate(buf, type, space, &dset_op, operator_data);
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Diterate() */
+} /* end H5Diterate() */
-
/*-------------------------------------------------------------------------
* Function: H5Dvlen_get_buf_size
*
@@ -721,35 +706,37 @@ done:
herr_t
H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- hbool_t supported; /* Whether 'get vlen buf size' operation is supported by VOL connector */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset for this operation */
+ hbool_t supported; /* Whether 'get vlen buf size' operation is supported by VOL connector */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iii*h", dataset_id, type_id, space_id, size);
/* Check args */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(dataset_id)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(dataset_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
- if(H5I_DATATYPE != H5I_get_type(type_id))
+ if (H5I_DATATYPE != H5I_get_type(type_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid datatype identifier")
- if(H5I_DATASPACE != H5I_get_type(space_id))
+ if (H5I_DATASPACE != H5I_get_type(space_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace identifier")
- if(size == NULL)
+ if (size == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid 'size' pointer")
/* Check if the 'get_vlen_buf_size' callback is supported */
supported = FALSE;
- if(H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_DATASET, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, &supported) < 0)
+ if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_DATASET, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE,
+ &supported) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'get vlen buf size' operation")
- if(supported) {
+ if (supported) {
/* Make the 'get_vlen_buf_size' callback */
- if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id, space_id, size) < 0)
+ if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, type_id, space_id, size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get vlen buf size")
} /* end if */
else {
/* Perform a generic operation that will work with all VOL connectors */
- if(H5D__vlen_get_buf_size_gen(vol_obj, type_id, space_id, size) < 0)
+ if (H5D__vlen_get_buf_size_gen(vol_obj, type_id, space_id, size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get vlen buf size")
} /* end else */
@@ -757,7 +744,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dvlen_get_buf_size() */
-
/*-------------------------------------------------------------------------
* Function: H5Dset_extent
*
@@ -771,31 +757,31 @@ done:
herr_t
H5Dset_extent(hid_t dset_id, const hsize_t size[])
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", dset_id, size);
/* Check args */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier")
- if(!size)
+ if (!size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size array cannot be NULL")
/* Set up collective metadata if appropriate */
- if(H5CX_set_loc(dset_id) < 0)
+ if (H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Set the extent */
- if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size)) < 0)
+ if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, size)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dset_extent() */
-
/*-------------------------------------------------------------------------
* Function: H5Dflush
*
@@ -808,32 +794,32 @@ done:
herr_t
H5Dflush(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", dset_id);
/* Check args */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier")
/* Set up collective metadata if appropriate */
- if(H5CX_set_loc(dset_id) < 0)
+ if (H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Flush dataset information cached in memory
* XXX: Note that we need to pass the ID to the VOL since the H5F_flush_cb_t
* callback needs it and that's in the public API.
*/
- if((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0)
+ if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_FLUSH, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, dset_id)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Dflush */
-
/*-------------------------------------------------------------------------
* Function: H5Drefresh
*
@@ -846,29 +832,29 @@ done:
herr_t
H5Drefresh(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", dset_id);
/* Check args */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier")
/* Set up collective metadata if appropriate */
- if(H5CX_set_loc(dset_id) < 0)
+ if (H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Refresh the dataset object */
- if((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0)
+ if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_REFRESH, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, dset_id)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Drefresh() */
-
/*-------------------------------------------------------------------------
* Function: H5Dformat_convert (Internal)
*
@@ -889,29 +875,29 @@ done:
herr_t
H5Dformat_convert(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", dset_id);
/* Check args */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier")
/* Set up collective metadata if appropriate */
- if(H5CX_set_loc(dset_id) < 0)
+ if (H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Convert the dataset */
- if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_FORMAT_CONVERT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_FORMAT_CONVERT, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Dformat_convert */
-
/*-------------------------------------------------------------------------
* Function: H5Dget_chunk_index_type (Internal)
*
@@ -927,27 +913,27 @@ done:
herr_t
H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*Dk", dset_id, idx_type);
/* Check args */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier")
- if(NULL == idx_type)
+ if (NULL == idx_type)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL")
/* Get the chunk indexing type */
- if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type) < 0)
+ if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, idx_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type")
done:
FUNC_LEAVE_API(ret_value)
} /* H5Dget_chunk_index_type() */
-
/*-------------------------------------------------------------------------
* Function: H5Dget_chunk_storage_size
*
@@ -966,29 +952,29 @@ done:
herr_t
H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_nbytes)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*h*h", dset_id, offset, chunk_nbytes);
/* Check arguments */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier")
- if(NULL == offset)
+ if (NULL == offset)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset parameter cannot be NULL")
- if(NULL == chunk_nbytes)
+ if (NULL == chunk_nbytes)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL")
/* Get the dataset creation property list */
- if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, offset, chunk_nbytes) < 0)
+ if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, offset, chunk_nbytes) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk")
done:
FUNC_LEAVE_API(ret_value);
} /* H5Dget_chunk_storage_size() */
-
/*-------------------------------------------------------------------------
* Function: H5Dget_num_chunks
*
@@ -1013,27 +999,27 @@ done:
herr_t
H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks)
{
- H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */
- herr_t ret_value = SUCCEED;
+ H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ii*h", dset_id, fspace_id, nchunks);
/* Check arguments */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
- if(NULL == nchunks)
+ if (NULL == nchunks)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
/* Get the number of written chunks */
- if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fspace_id, nchunks) < 0)
+ if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, fspace_id, nchunks) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get number of chunks")
done:
FUNC_LEAVE_API(ret_value);
} /* H5Dget_num_chunks() */
-
/*-------------------------------------------------------------------------
* Function: H5Dget_chunk_info
*
@@ -1057,39 +1043,41 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *offset, unsigned *filter_mask, haddr_t *addr, hsize_t *size)
+H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *offset, unsigned *filter_mask,
+ haddr_t *addr, hsize_t *size)
{
- H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */
- hsize_t nchunks = 0;
+ H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */
+ hsize_t nchunks = 0;
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "iih*h*Iu*a*h", dset_id, fspace_id, chk_index, offset,
- filter_mask, addr, size);
+ H5TRACE7("e", "iih*h*Iu*a*h", dset_id, fspace_id, chk_index, offset, filter_mask, addr, size);
/* Check arguments */
- if(NULL == offset && NULL == filter_mask && NULL == addr && NULL == size)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid arguments, must have at least one non-null output argument")
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == offset && NULL == filter_mask && NULL == addr && NULL == size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "invalid arguments, must have at least one non-null output argument")
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
/* Get the number of written chunks to check range */
- if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fspace_id, &nchunks) < 0)
+ if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, fspace_id, &nchunks) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get number of chunks")
/* Check range for chunk index */
- if(chk_index >= nchunks)
+ if (chk_index >= nchunks)
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk index is out of range")
/* Call private function to get the chunk info given the chunk's index */
- if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fspace_id, chk_index, offset, filter_mask, addr, size) < 0)
+ if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, fspace_id, chk_index, offset, filter_mask, addr, size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by index")
done:
FUNC_LEAVE_API(ret_value);
} /* H5Dget_chunk_info() */
-
/*-------------------------------------------------------------------------
* Function: H5Dget_chunk_info_by_coord
*
@@ -1112,24 +1100,27 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filter_mask, haddr_t *addr, hsize_t *size)
+H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filter_mask, haddr_t *addr,
+ hsize_t *size)
{
- H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */
- herr_t ret_value = SUCCEED;
+ H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*h*Iu*a*h", dset_id, offset, filter_mask, addr, size);
/* Check arguments */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
- if(NULL == filter_mask && NULL == addr && NULL == size)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid arguments, must have at least one non-null output argument")
- if(NULL == offset)
+ if (NULL == filter_mask && NULL == addr && NULL == size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "invalid arguments, must have at least one non-null output argument")
+ if (NULL == offset)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
/* Call private function to get the chunk info given the chunk's index */
- if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, offset, filter_mask, addr, size) < 0)
+ if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, offset, filter_mask, addr, size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by its logical coordinates")
done:
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c
index 6da858f..d0a191f 100644
--- a/src/H5Dbtree.c
+++ b/src/H5Dbtree.c
@@ -24,31 +24,29 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Bprivate.h" /* B-link trees */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MFprivate.h" /* File space management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Sprivate.h" /* Dataspaces */
-#include "H5VMprivate.h" /* Vector and array functions */
+#include "H5private.h" /* Generic Functions */
+#include "H5Bprivate.h" /* B-link trees */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MFprivate.h" /* File space management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Sprivate.h" /* Dataspaces */
+#include "H5VMprivate.h" /* Vector and array functions */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
@@ -68,82 +66,72 @@
* The chunk's file address is part of the B-tree and not part of the key.
*/
typedef struct H5D_btree_key_t {
- hsize_t scaled[H5O_LAYOUT_NDIMS]; /*logical offset to start*/
- uint32_t nbytes; /*size of stored data */
- unsigned filter_mask; /*excluded filters */
+ hsize_t scaled[H5O_LAYOUT_NDIMS]; /*logical offset to start*/
+ uint32_t nbytes; /*size of stored data */
+ unsigned filter_mask; /*excluded filters */
} H5D_btree_key_t;
/* B-tree callback info for iteration over chunks */
typedef struct H5D_btree_it_ud_t {
- H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */
- H5D_chunk_cb_func_t cb; /* Chunk callback routine */
- void *udata; /* User data for chunk callback routine */
+ H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */
+ H5D_chunk_cb_func_t cb; /* Chunk callback routine */
+ void * udata; /* User data for chunk callback routine */
} H5D_btree_it_ud_t;
/* B-tree callback info for debugging */
typedef struct H5D_btree_dbg_t {
- H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */
- unsigned ndims; /* Number of dimensions */
+ H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */
+ unsigned ndims; /* Number of dimensions */
} H5D_btree_dbg_t;
-
/********************/
/* Local Prototypes */
/********************/
static herr_t H5D__btree_shared_free(void *_shared);
static herr_t H5D__btree_shared_create(const H5F_t *f, H5O_storage_chunk_t *store,
- const H5O_layout_chunk_t *layout);
+ const H5O_layout_chunk_t *layout);
/* B-tree iterator callbacks */
-static int H5D__btree_idx_iterate_cb(H5F_t *f, const void *left_key,
- haddr_t addr, const void *right_key, void *_udata);
+static int H5D__btree_idx_iterate_cb(H5F_t *f, const void *left_key, haddr_t addr, const void *right_key,
+ void *_udata);
/* B-tree callbacks */
-static H5UC_t *H5D__btree_get_shared(const H5F_t *f, const void *_udata);
-static herr_t H5D__btree_new_node(H5F_t *f, H5B_ins_t, void *_lt_key,
- void *_udata, void *_rt_key, haddr_t *addr_p /*out*/);
-static int H5D__btree_cmp2(void *_lt_key, void *_udata, void *_rt_key);
-static int H5D__btree_cmp3(void *_lt_key, void *_udata, void *_rt_key);
-static htri_t H5D__btree_found(H5F_t *f, haddr_t addr,
- const void *_lt_key, void *_udata);
-static H5B_ins_t H5D__btree_insert(H5F_t *f, haddr_t addr,
- void *_lt_key, hbool_t *lt_key_changed, void *_md_key, void *_udata,
- void *_rt_key, hbool_t *rt_key_changed, haddr_t *new_node/*out*/);
-static H5B_ins_t H5D__btree_remove( H5F_t *f, haddr_t addr, void *_lt_key,
- hbool_t *lt_key_changed, void *_udata, void *_rt_key, hbool_t *rt_key_changed);
-static herr_t H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw,
- void *_key);
-static herr_t H5D__btree_encode_key(const H5B_shared_t *shared, uint8_t *raw,
- const void *_key);
-static herr_t H5D__btree_debug_key(FILE *stream, int indent, int fwidth,
- const void *key, const void *udata);
+static H5UC_t * H5D__btree_get_shared(const H5F_t *f, const void *_udata);
+static herr_t H5D__btree_new_node(H5F_t *f, H5B_ins_t, void *_lt_key, void *_udata, void *_rt_key,
+ haddr_t *addr_p /*out*/);
+static int H5D__btree_cmp2(void *_lt_key, void *_udata, void *_rt_key);
+static int H5D__btree_cmp3(void *_lt_key, void *_udata, void *_rt_key);
+static htri_t H5D__btree_found(H5F_t *f, haddr_t addr, const void *_lt_key, void *_udata);
+static H5B_ins_t H5D__btree_insert(H5F_t *f, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed,
+ void *_md_key, void *_udata, void *_rt_key, hbool_t *rt_key_changed,
+ haddr_t *new_node /*out*/);
+static H5B_ins_t H5D__btree_remove(H5F_t *f, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed,
+ void *_udata, void *_rt_key, hbool_t *rt_key_changed);
+static herr_t H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key);
+static herr_t H5D__btree_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key);
+static herr_t H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *key, const void *udata);
/* Chunked layout indexing callbacks */
-static herr_t H5D__btree_idx_init(const H5D_chk_idx_info_t *idx_info,
- const H5S_t *space, haddr_t dset_ohdr_addr);
-static herr_t H5D__btree_idx_create(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__btree_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space,
+ haddr_t dset_ohdr_addr);
+static herr_t H5D__btree_idx_create(const H5D_chk_idx_info_t *idx_info);
static hbool_t H5D__btree_idx_is_space_alloc(const H5O_storage_chunk_t *storage);
-static herr_t H5D__btree_idx_insert(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_ud_t *udata, const H5D_t *dset);
-static herr_t H5D__btree_idx_get_addr(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_ud_t *udata);
-static int H5D__btree_idx_iterate(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_cb_func_t chunk_cb, void *chunk_udata);
-static herr_t H5D__btree_idx_remove(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_common_ud_t *udata);
-static herr_t H5D__btree_idx_delete(const H5D_chk_idx_info_t *idx_info);
-static herr_t H5D__btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
- const H5D_chk_idx_info_t *idx_info_dst);
-static herr_t H5D__btree_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
- H5O_storage_chunk_t *storage_dst);
-static herr_t H5D__btree_idx_size(const H5D_chk_idx_info_t *idx_info,
- hsize_t *size);
-static herr_t H5D__btree_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
-static herr_t H5D__btree_idx_dump(const H5O_storage_chunk_t *storage,
- FILE *stream);
-static herr_t H5D__btree_idx_dest(const H5D_chk_idx_info_t *idx_info);
-
+static herr_t H5D__btree_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
+ const H5D_t *dset);
+static herr_t H5D__btree_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata);
+static int H5D__btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb,
+ void *chunk_udata);
+static herr_t H5D__btree_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata);
+static herr_t H5D__btree_idx_delete(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+ const H5D_chk_idx_info_t *idx_info_dst);
+static herr_t H5D__btree_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
+ H5O_storage_chunk_t *storage_dst);
+static herr_t H5D__btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size);
+static herr_t H5D__btree_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
+static herr_t H5D__btree_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream);
+static herr_t H5D__btree_idx_dest(const H5D_chk_idx_info_t *idx_info);
/*********************/
/* Package Variables */
@@ -151,49 +139,47 @@ static herr_t H5D__btree_idx_dest(const H5D_chk_idx_info_t *idx_info);
/* v1 B-tree indexed chunk I/O ops */
const H5D_chunk_ops_t H5D_COPS_BTREE[1] = {{
- FALSE, /* v1 B-tree indices does not support SWMR access */
- H5D__btree_idx_init, /* insert */
- H5D__btree_idx_create, /* create */
- H5D__btree_idx_is_space_alloc, /* is_space_alloc */
- H5D__btree_idx_insert, /* insert */
- H5D__btree_idx_get_addr, /* get_addr */
- NULL, /* resize */
- H5D__btree_idx_iterate, /* iterate */
- H5D__btree_idx_remove, /* remove */
- H5D__btree_idx_delete, /* delete */
- H5D__btree_idx_copy_setup, /* copy_setup */
- H5D__btree_idx_copy_shutdown, /* copy_shutdown */
- H5D__btree_idx_size, /* size */
- H5D__btree_idx_reset, /* reset */
- H5D__btree_idx_dump, /* dump */
- H5D__btree_idx_dest /* destroy */
+ FALSE, /* v1 B-tree indices does not support SWMR access */
+ H5D__btree_idx_init, /* insert */
+ H5D__btree_idx_create, /* create */
+ H5D__btree_idx_is_space_alloc, /* is_space_alloc */
+ H5D__btree_idx_insert, /* insert */
+ H5D__btree_idx_get_addr, /* get_addr */
+ NULL, /* resize */
+ H5D__btree_idx_iterate, /* iterate */
+ H5D__btree_idx_remove, /* remove */
+ H5D__btree_idx_delete, /* delete */
+ H5D__btree_idx_copy_setup, /* copy_setup */
+ H5D__btree_idx_copy_shutdown, /* copy_shutdown */
+ H5D__btree_idx_size, /* size */
+ H5D__btree_idx_reset, /* reset */
+ H5D__btree_idx_dump, /* dump */
+ H5D__btree_idx_dest /* destroy */
}};
-
/*****************************/
/* Library Private Variables */
/*****************************/
/* inherits B-tree like properties from H5B */
H5B_class_t H5B_BTREE[1] = {{
- H5B_CHUNK_ID, /*id */
- sizeof(H5D_btree_key_t), /*sizeof_nkey */
- H5D__btree_get_shared, /*get_shared */
- H5D__btree_new_node, /*new */
- H5D__btree_cmp2, /*cmp2 */
- H5D__btree_cmp3, /*cmp3 */
- H5D__btree_found, /*found */
- H5D__btree_insert, /*insert */
- FALSE, /*follow min branch? */
- FALSE, /*follow max branch? */
- H5B_LEFT, /*critical key */
- H5D__btree_remove, /*remove */
- H5D__btree_decode_key, /*decode */
- H5D__btree_encode_key, /*encode */
- H5D__btree_debug_key /*debug */
+ H5B_CHUNK_ID, /*id */
+ sizeof(H5D_btree_key_t), /*sizeof_nkey */
+ H5D__btree_get_shared, /*get_shared */
+ H5D__btree_new_node, /*new */
+ H5D__btree_cmp2, /*cmp2 */
+ H5D__btree_cmp3, /*cmp3 */
+ H5D__btree_found, /*found */
+ H5D__btree_insert, /*insert */
+ FALSE, /*follow min branch? */
+ FALSE, /*follow max branch? */
+ H5B_LEFT, /*critical key */
+ H5D__btree_remove, /*remove */
+ H5D__btree_decode_key, /*decode */
+ H5D__btree_encode_key, /*encode */
+ H5D__btree_debug_key /*debug */
}};
-
/*******************/
/* Local Variables */
/*******************/
@@ -201,8 +187,6 @@ H5B_class_t H5B_BTREE[1] = {{
/* Declare a free list to manage H5O_layout_chunk_t objects */
H5FL_DEFINE_STATIC(H5O_layout_chunk_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_get_shared
*
@@ -220,7 +204,7 @@ H5FL_DEFINE_STATIC(H5O_layout_chunk_t);
static H5UC_t *
H5D__btree_get_shared(const H5F_t H5_ATTR_UNUSED *f, const void *_udata)
{
- const H5D_chunk_common_ud_t *udata = (const H5D_chunk_common_ud_t *) _udata;
+ const H5D_chunk_common_ud_t *udata = (const H5D_chunk_common_ud_t *)_udata;
FUNC_ENTER_STATIC_NOERR
@@ -233,7 +217,6 @@ H5D__btree_get_shared(const H5F_t H5_ATTR_UNUSED *f, const void *_udata)
FUNC_LEAVE_NOAPI(udata->storage->u.btree.shared)
} /* end H5D__btree_get_shared() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_new_node
*
@@ -253,14 +236,14 @@ H5D__btree_get_shared(const H5F_t H5_ATTR_UNUSED *f, const void *_udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__btree_new_node(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5B_ins_t op, void *_lt_key, void *_udata,
- void *_rt_key, haddr_t *addr_p/*out*/)
+H5D__btree_new_node(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5B_ins_t op, void *_lt_key, void *_udata, void *_rt_key,
+ haddr_t *addr_p /*out*/)
{
- H5D_btree_key_t *lt_key = (H5D_btree_key_t *) _lt_key;
- H5D_btree_key_t *rt_key = (H5D_btree_key_t *) _rt_key;
- H5D_chunk_ud_t *udata = (H5D_chunk_ud_t *) _udata;
- unsigned u;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_btree_key_t *lt_key = (H5D_btree_key_t *)_lt_key;
+ H5D_btree_key_t *rt_key = (H5D_btree_key_t *)_rt_key;
+ H5D_chunk_ud_t * udata = (H5D_chunk_ud_t *)_udata;
+ unsigned u;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -283,26 +266,25 @@ H5D__btree_new_node(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5B_ins_t op, void *_lt_key,
*/
H5_CHECKED_ASSIGN(lt_key->nbytes, uint32_t, udata->chunk_block.length, hsize_t);
lt_key->filter_mask = udata->filter_mask;
- for(u = 0; u < udata->common.layout->ndims; u++)
+ for (u = 0; u < udata->common.layout->ndims; u++)
lt_key->scaled[u] = udata->common.scaled[u];
/*
* The right key might already be present. If not, then add a zero-width
* chunk.
*/
- if(H5B_INS_LEFT != op) {
- rt_key->nbytes = 0;
+ if (H5B_INS_LEFT != op) {
+ rt_key->nbytes = 0;
rt_key->filter_mask = 0;
- for(u = 0; u < udata->common.layout->ndims; u++) {
+ for (u = 0; u < udata->common.layout->ndims; u++) {
HDassert(udata->common.scaled[u] + 1 > udata->common.scaled[u]);
rt_key->scaled[u] = udata->common.scaled[u] + 1;
} /* end if */
- } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_new_node() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_cmp2
*
@@ -325,10 +307,10 @@ H5D__btree_new_node(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5B_ins_t op, void *_lt_key,
static int
H5D__btree_cmp2(void *_lt_key, void *_udata, void *_rt_key)
{
- H5D_btree_key_t *lt_key = (H5D_btree_key_t *) _lt_key;
- H5D_btree_key_t *rt_key = (H5D_btree_key_t *) _rt_key;
- H5D_chunk_common_ud_t *udata = (H5D_chunk_common_ud_t *) _udata;
- int ret_value = -1; /* Return value */
+ H5D_btree_key_t * lt_key = (H5D_btree_key_t *)_lt_key;
+ H5D_btree_key_t * rt_key = (H5D_btree_key_t *)_rt_key;
+ H5D_chunk_common_ud_t *udata = (H5D_chunk_common_ud_t *)_udata;
+ int ret_value = -1; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -343,7 +325,6 @@ H5D__btree_cmp2(void *_lt_key, void *_udata, void *_rt_key)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_cmp2() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_cmp3
*
@@ -374,10 +355,10 @@ H5D__btree_cmp2(void *_lt_key, void *_udata, void *_rt_key)
static int
H5D__btree_cmp3(void *_lt_key, void *_udata, void *_rt_key)
{
- H5D_btree_key_t *lt_key = (H5D_btree_key_t *) _lt_key;
- H5D_btree_key_t *rt_key = (H5D_btree_key_t *) _rt_key;
- H5D_chunk_common_ud_t *udata = (H5D_chunk_common_ud_t *) _udata;
- int ret_value = 0;
+ H5D_btree_key_t * lt_key = (H5D_btree_key_t *)_lt_key;
+ H5D_btree_key_t * rt_key = (H5D_btree_key_t *)_rt_key;
+ H5D_chunk_common_ud_t *udata = (H5D_chunk_common_ud_t *)_udata;
+ int ret_value = 0;
FUNC_ENTER_STATIC_NOERR
@@ -392,26 +373,24 @@ H5D__btree_cmp3(void *_lt_key, void *_udata, void *_rt_key)
/* slightly odd way the library initializes the right-most node in the */
/* indexed storage B-tree... */
/* (Dump the B-tree with h5debug to look at it) -QAK */
- if(udata->layout->ndims == 2) {
- if(udata->scaled[0] > rt_key->scaled[0])
+ if (udata->layout->ndims == 2) {
+ if (udata->scaled[0] > rt_key->scaled[0])
ret_value = 1;
- else if(udata->scaled[0] == rt_key->scaled[0] &&
- udata->scaled[1] >= rt_key->scaled[1])
+ else if (udata->scaled[0] == rt_key->scaled[0] && udata->scaled[1] >= rt_key->scaled[1])
ret_value = 1;
- else if(udata->scaled[0] < lt_key->scaled[0])
+ else if (udata->scaled[0] < lt_key->scaled[0])
ret_value = (-1);
} /* end if */
else {
- if(H5VM_vector_ge_u(udata->layout->ndims, udata->scaled, rt_key->scaled))
+ if (H5VM_vector_ge_u(udata->layout->ndims, udata->scaled, rt_key->scaled))
ret_value = 1;
- else if(H5VM_vector_lt_u(udata->layout->ndims, udata->scaled, lt_key->scaled))
+ else if (H5VM_vector_lt_u(udata->layout->ndims, udata->scaled, lt_key->scaled))
ret_value = (-1);
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_cmp3() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_found
*
@@ -437,13 +416,12 @@ H5D__btree_cmp3(void *_lt_key, void *_udata, void *_rt_key)
*-------------------------------------------------------------------------
*/
static htri_t
-H5D__btree_found(H5F_t H5_ATTR_UNUSED *f, haddr_t addr, const void *_lt_key,
- void *_udata)
+H5D__btree_found(H5F_t H5_ATTR_UNUSED *f, haddr_t addr, const void *_lt_key, void *_udata)
{
- H5D_chunk_ud_t *udata = (H5D_chunk_ud_t *) _udata;
- const H5D_btree_key_t *lt_key = (const H5D_btree_key_t *) _lt_key;
- unsigned u;
- htri_t ret_value = TRUE; /* Return value */
+ H5D_chunk_ud_t * udata = (H5D_chunk_ud_t *)_udata;
+ const H5D_btree_key_t *lt_key = (const H5D_btree_key_t *)_lt_key;
+ unsigned u;
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -454,21 +432,20 @@ H5D__btree_found(H5F_t H5_ATTR_UNUSED *f, haddr_t addr, const void *_lt_key,
HDassert(lt_key);
/* Is this *really* the requested chunk? */
- for(u = 0; u < udata->common.layout->ndims; u++)
- if(udata->common.scaled[u] >= (lt_key->scaled[u] + 1))
+ for (u = 0; u < udata->common.layout->ndims; u++)
+ if (udata->common.scaled[u] >= (lt_key->scaled[u] + 1))
HGOTO_DONE(FALSE)
/* Initialize return values */
HDassert(lt_key->nbytes > 0);
udata->chunk_block.offset = addr;
udata->chunk_block.length = lt_key->nbytes;
- udata->filter_mask = lt_key->filter_mask;
+ udata->filter_mask = lt_key->filter_mask;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_found() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_disjoint
*
@@ -487,8 +464,8 @@ done:
static hbool_t
H5D__chunk_disjoint(unsigned n, const hsize_t *scaled1, const hsize_t *scaled2)
{
- unsigned u; /* Local index variable */
- hbool_t ret_value = FALSE; /* Return value */
+ unsigned u; /* Local index variable */
+ hbool_t ret_value = FALSE; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -498,15 +475,14 @@ H5D__chunk_disjoint(unsigned n, const hsize_t *scaled1, const hsize_t *scaled2)
HDassert(scaled2);
/* Loop over two chunks, detecting disjointness and getting out quickly */
- for(u = 0; u < n; u++)
- if((scaled1[u] + 1) <= scaled2[u] || (scaled2[u] + 1) <= scaled1[u])
+ for (u = 0; u < n; u++)
+ if ((scaled1[u] + 1) <= scaled2[u] || (scaled2[u] + 1) <= scaled1[u])
HGOTO_DONE(TRUE)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_disjoint() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_insert
*
@@ -536,17 +512,17 @@ done:
*-------------------------------------------------------------------------
*/
static H5B_ins_t
-H5D__btree_insert(H5F_t H5_ATTR_NDEBUG_UNUSED *f, haddr_t H5_ATTR_NDEBUG_UNUSED addr, void *_lt_key, hbool_t *lt_key_changed,
- void *_md_key, void *_udata, void *_rt_key, hbool_t H5_ATTR_UNUSED *rt_key_changed,
- haddr_t *new_node_p/*out*/)
+H5D__btree_insert(H5F_t H5_ATTR_NDEBUG_UNUSED *f, haddr_t H5_ATTR_NDEBUG_UNUSED addr, void *_lt_key,
+ hbool_t *lt_key_changed, void *_md_key, void *_udata, void *_rt_key,
+ hbool_t H5_ATTR_UNUSED *rt_key_changed, haddr_t *new_node_p /*out*/)
{
- H5D_btree_key_t *lt_key = (H5D_btree_key_t *) _lt_key;
- H5D_btree_key_t *md_key = (H5D_btree_key_t *) _md_key;
- H5D_btree_key_t *rt_key = (H5D_btree_key_t *) _rt_key;
- H5D_chunk_ud_t *udata = (H5D_chunk_ud_t *) _udata;
- int cmp;
- unsigned u;
- H5B_ins_t ret_value = H5B_INS_ERROR; /* Return value */
+ H5D_btree_key_t *lt_key = (H5D_btree_key_t *)_lt_key;
+ H5D_btree_key_t *md_key = (H5D_btree_key_t *)_md_key;
+ H5D_btree_key_t *rt_key = (H5D_btree_key_t *)_rt_key;
+ H5D_chunk_ud_t * udata = (H5D_chunk_ud_t *)_udata;
+ int cmp;
+ unsigned u;
+ H5B_ins_t ret_value = H5B_INS_ERROR; /* Return value */
FUNC_ENTER_STATIC
@@ -563,48 +539,47 @@ H5D__btree_insert(H5F_t H5_ATTR_NDEBUG_UNUSED *f, haddr_t H5_ATTR_NDEBUG_UNUSED
cmp = H5D__btree_cmp3(lt_key, udata, rt_key);
HDassert(cmp <= 0);
- if(cmp < 0) {
+ if (cmp < 0) {
/* Negative indices not supported yet */
HGOTO_ERROR(H5E_STORAGE, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error")
-
- } else if(H5VM_vector_eq_u(udata->common.layout->ndims,
- udata->common.scaled, lt_key->scaled) && lt_key->nbytes > 0) {
+ }
+ else if (H5VM_vector_eq_u(udata->common.layout->ndims, udata->common.scaled, lt_key->scaled) &&
+ lt_key->nbytes > 0) {
/*
* Already exists. If the new size is not the same as the old size
* then we should reallocate storage.
*/
- if(lt_key->nbytes != udata->chunk_block.length) {
- /* Set node's address (already re-allocated by main chunk routines) */
- HDassert(H5F_addr_defined(udata->chunk_block.offset));
+ if (lt_key->nbytes != udata->chunk_block.length) {
+ /* Set node's address (already re-allocated by main chunk routines) */
+ HDassert(H5F_addr_defined(udata->chunk_block.offset));
*new_node_p = udata->chunk_block.offset;
H5_CHECKED_ASSIGN(lt_key->nbytes, uint32_t, udata->chunk_block.length, hsize_t);
lt_key->filter_mask = udata->filter_mask;
- *lt_key_changed = TRUE;
- ret_value = H5B_INS_CHANGE;
- } else {
- /* Already have address in udata, from main chunk routines */
- HDassert(H5F_addr_defined(udata->chunk_block.offset));
+ *lt_key_changed = TRUE;
+ ret_value = H5B_INS_CHANGE;
+ }
+ else {
+ /* Already have address in udata, from main chunk routines */
+ HDassert(H5F_addr_defined(udata->chunk_block.offset));
ret_value = H5B_INS_NOOP;
}
-
- } else if (H5D__chunk_disjoint(udata->common.layout->ndims,
- lt_key->scaled, udata->common.scaled)) {
- HDassert(H5D__chunk_disjoint(udata->common.layout->ndims,
- rt_key->scaled, udata->common.scaled));
+ }
+ else if (H5D__chunk_disjoint(udata->common.layout->ndims, lt_key->scaled, udata->common.scaled)) {
+ HDassert(H5D__chunk_disjoint(udata->common.layout->ndims, rt_key->scaled, udata->common.scaled));
/*
* Split this node, inserting the new new node to the right of the
* current node. The MD_KEY is where the split occurs.
*/
H5_CHECKED_ASSIGN(md_key->nbytes, uint32_t, udata->chunk_block.length, hsize_t);
md_key->filter_mask = udata->filter_mask;
- for(u = 0; u < udata->common.layout->ndims; u++)
+ for (u = 0; u < udata->common.layout->ndims; u++)
md_key->scaled[u] = udata->common.scaled[u];
- HDassert(H5F_addr_defined(udata->chunk_block.offset));
+ HDassert(H5F_addr_defined(udata->chunk_block.offset));
*new_node_p = udata->chunk_block.offset;
- ret_value = H5B_INS_RIGHT;
-
- } else {
+ ret_value = H5B_INS_RIGHT;
+ }
+ else {
HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error")
}
@@ -612,7 +587,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_insert() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_remove
*
@@ -626,21 +600,19 @@ done:
*-------------------------------------------------------------------------
*/
static H5B_ins_t
-H5D__btree_remove(H5F_t *f, haddr_t addr, void *_lt_key /*in,out */ ,
- hbool_t *lt_key_changed /*out */ ,
- void H5_ATTR_UNUSED * _udata /*in,out */ ,
- void H5_ATTR_UNUSED * _rt_key /*in,out */ ,
- hbool_t *rt_key_changed /*out */ )
+H5D__btree_remove(H5F_t *f, haddr_t addr, void *_lt_key /*in,out */, hbool_t *lt_key_changed /*out */,
+ void H5_ATTR_UNUSED *_udata /*in,out */, void H5_ATTR_UNUSED *_rt_key /*in,out */,
+ hbool_t *rt_key_changed /*out */)
{
- H5D_btree_key_t *lt_key = (H5D_btree_key_t *)_lt_key;
- H5B_ins_t ret_value=H5B_INS_REMOVE; /* Return value */
+ H5D_btree_key_t *lt_key = (H5D_btree_key_t *)_lt_key;
+ H5B_ins_t ret_value = H5B_INS_REMOVE; /* Return value */
FUNC_ENTER_STATIC
/* Remove raw data chunk from file */
H5_CHECK_OVERFLOW(lt_key->nbytes, uint32_t, hsize_t);
- if(H5MF_xfree(f, H5FD_MEM_DRAW, addr, (hsize_t)lt_key->nbytes) < 0)
- HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk")
+ if (H5MF_xfree(f, H5FD_MEM_DRAW, addr, (hsize_t)lt_key->nbytes) < 0)
+ HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk")
/* Mark keys as unchanged */
*lt_key_changed = FALSE;
@@ -650,7 +622,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_remove() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_decode_key
*
@@ -666,11 +637,11 @@ done:
static herr_t
H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key)
{
- const H5O_layout_chunk_t *layout; /* Chunk layout description */
- H5D_btree_key_t *key = (H5D_btree_key_t *) _key; /* Pointer to decoded key */
- hsize_t tmp_offset; /* Temporary coordinate offset, from file */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5O_layout_chunk_t *layout; /* Chunk layout description */
+ H5D_btree_key_t * key = (H5D_btree_key_t *)_key; /* Pointer to decoded key */
+ hsize_t tmp_offset; /* Temporary coordinate offset, from file */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -685,8 +656,8 @@ H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key
/* decode */
UINT32DECODE(raw, key->nbytes);
UINT32DECODE(raw, key->filter_mask);
- for(u = 0; u < layout->ndims; u++) {
- if(layout->dim[u] == 0)
+ for (u = 0; u < layout->ndims; u++) {
+ if (layout->dim[u] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u)
/* Retrieve coordinate offset */
@@ -701,7 +672,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_decode_key() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_encode_key
*
@@ -717,10 +687,10 @@ done:
static herr_t
H5D__btree_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key)
{
- const H5O_layout_chunk_t *layout; /* Chunk layout description */
- const H5D_btree_key_t *key = (const H5D_btree_key_t *)_key;
- hsize_t tmp_offset; /* Temporary coordinate offset, from file */
- unsigned u; /* Local index variable */
+ const H5O_layout_chunk_t *layout; /* Chunk layout description */
+ const H5D_btree_key_t * key = (const H5D_btree_key_t *)_key;
+ hsize_t tmp_offset; /* Temporary coordinate offset, from file */
+ unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
@@ -735,16 +705,15 @@ H5D__btree_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key
/* encode */
UINT32ENCODE(raw, key->nbytes);
UINT32ENCODE(raw, key->filter_mask);
- for(u = 0; u < layout->ndims; u++) {
+ for (u = 0; u < layout->ndims; u++) {
/* Compute coordinate offset from scaled offset */
tmp_offset = key->scaled[u] * layout->dim[u];
- UINT64ENCODE(raw, tmp_offset);
+ UINT64ENCODE(raw, tmp_offset);
} /* end for */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__btree_encode_key() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_debug_key
*
@@ -758,12 +727,11 @@ H5D__btree_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *_key,
- const void *_udata)
+H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *_key, const void *_udata)
{
- const H5D_btree_key_t *key = (const H5D_btree_key_t *)_key;
- const H5D_btree_dbg_t *udata = (const H5D_btree_dbg_t *)_udata;
- unsigned u;
+ const H5D_btree_key_t *key = (const H5D_btree_key_t *)_key;
+ const H5D_btree_dbg_t *udata = (const H5D_btree_dbg_t *)_udata;
+ unsigned u;
FUNC_ENTER_STATIC_NOERR
@@ -772,14 +740,13 @@ H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *_key,
HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, "Chunk size:", (unsigned)key->nbytes);
HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", key->filter_mask);
HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:");
- for(u = 0; u < udata->ndims; u++)
- HDfprintf(stream, "%s%" PRIuHSIZE, u?", ":"", (key->scaled[u] * udata->common.layout->dim[u]));
+ for (u = 0; u < udata->ndims; u++)
+ HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", (key->scaled[u] * udata->common.layout->dim[u]));
HDfputs("}\n", stream);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__btree_debug_key() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_shared_free
*
@@ -795,8 +762,8 @@ H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *_key,
static herr_t
H5D__btree_shared_free(void *_shared)
{
- H5B_shared_t *shared = (H5B_shared_t *)_shared;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B_shared_t *shared = (H5B_shared_t *)_shared;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -804,14 +771,13 @@ H5D__btree_shared_free(void *_shared)
shared->udata = H5FL_FREE(H5O_layout_chunk_t, shared->udata);
/* Chain up to the generic B-tree shared info free routine */
- if(H5B_shared_free(shared) < 0)
+ if (H5B_shared_free(shared) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't free shared B-tree info")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_shared_free() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_shared_create
*
@@ -825,44 +791,42 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__btree_shared_create(const H5F_t *f, H5O_storage_chunk_t *store,
- const H5O_layout_chunk_t *layout)
+H5D__btree_shared_create(const H5F_t *f, H5O_storage_chunk_t *store, const H5O_layout_chunk_t *layout)
{
- H5B_shared_t *shared; /* Shared B-tree node info */
- H5O_layout_chunk_t *my_layout = NULL; /* Pointer to copy of layout info */
- size_t sizeof_rkey; /* Size of raw (disk) key */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B_shared_t * shared; /* Shared B-tree node info */
+ H5O_layout_chunk_t *my_layout = NULL; /* Pointer to copy of layout info */
+ size_t sizeof_rkey; /* Size of raw (disk) key */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Set the raw key size */
- sizeof_rkey = 4 + /*storage size */
- 4 + /*filter mask */
- layout->ndims * 8; /*dimension indices */
+ sizeof_rkey = 4 + /*storage size */
+ 4 + /*filter mask */
+ layout->ndims * 8; /*dimension indices */
/* Allocate & initialize global info for the shared structure */
- if(NULL == (shared = H5B_shared_new(f, H5B_BTREE, sizeof_rkey)))
- HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "memory allocation failed for shared B-tree info")
+ if (NULL == (shared = H5B_shared_new(f, H5B_BTREE, sizeof_rkey)))
+ HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "memory allocation failed for shared B-tree info")
/* Set up the "local" information for this dataset's chunks */
- if(NULL == (my_layout = H5FL_MALLOC(H5O_layout_chunk_t)))
+ if (NULL == (my_layout = H5FL_MALLOC(H5O_layout_chunk_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk layout")
H5MM_memcpy(my_layout, layout, sizeof(H5O_layout_chunk_t));
shared->udata = my_layout;
/* Make shared B-tree info reference counted */
- if(NULL == (store->u.btree.shared = H5UC_create(shared, H5D__btree_shared_free)))
- HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info")
+ if (NULL == (store->u.btree.shared = H5UC_create(shared, H5D__btree_shared_free)))
+ HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info")
done:
- if(ret_value < 0)
- if(my_layout)
+ if (ret_value < 0)
+ if (my_layout)
my_layout = H5FL_FREE(H5O_layout_chunk_t, my_layout);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_shared_create() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_idx_init
*
@@ -877,9 +841,9 @@ done:
*/
static herr_t
H5D__btree_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNUSED *space,
- haddr_t dset_ohdr_addr)
+ haddr_t dset_ohdr_addr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -894,14 +858,13 @@ H5D__btree_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNUS
idx_info->storage->u.btree.dset_ohdr_addr = dset_ohdr_addr;
/* Allocate the shared structure */
- if(H5D__btree_shared_create(idx_info->f, idx_info->storage, idx_info->layout) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info")
+ if (H5D__btree_shared_create(idx_info->f, idx_info->storage, idx_info->layout) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_idx_init() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_idx_create
*
@@ -923,8 +886,8 @@ done:
static herr_t
H5D__btree_idx_create(const H5D_chk_idx_info_t *idx_info)
{
- H5D_chunk_common_ud_t udata; /* User data for B-tree callback */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chunk_common_ud_t udata; /* User data for B-tree callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -937,18 +900,17 @@ H5D__btree_idx_create(const H5D_chk_idx_info_t *idx_info)
HDassert(!H5F_addr_defined(idx_info->storage->idx_addr));
/* Initialize "user" data for B-tree callbacks, etc. */
- udata.layout = idx_info->layout;
+ udata.layout = idx_info->layout;
udata.storage = idx_info->storage;
/* Create the v1 B-tree for the chunk index */
- if(H5B_create(idx_info->f, H5B_BTREE, &udata, &(idx_info->storage->idx_addr)/*out*/) < 0)
+ if (H5B_create(idx_info->f, H5B_BTREE, &udata, &(idx_info->storage->idx_addr) /*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_idx_create() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_idx_is_space_alloc
*
@@ -972,7 +934,6 @@ H5D__btree_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr))
} /* end H5D__btree_idx_is_space_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_idx_insert
*
@@ -987,9 +948,9 @@ H5D__btree_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
*/
static herr_t
H5D__btree_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
- const H5D_t H5_ATTR_UNUSED *dset)
+ const H5D_t H5_ATTR_UNUSED *dset)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1005,14 +966,13 @@ H5D__btree_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
* Create the chunk it if it doesn't exist, or reallocate the chunk if
* its size changed.
*/
- if(H5B_insert(idx_info->f, H5B_BTREE, idx_info->storage->idx_addr, udata) < 0)
+ if (H5B_insert(idx_info->f, H5B_BTREE, idx_info->storage->idx_addr, udata) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__btree_idx_insert() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_idx_get_addr
*
@@ -1030,7 +990,7 @@ done:
static herr_t
H5D__btree_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1044,14 +1004,13 @@ H5D__btree_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udat
HDassert(udata);
/* Go get the chunk information from the B-tree */
- if(H5B_find(idx_info->f, H5B_BTREE, idx_info->storage->idx_addr, udata) < 0)
+ if (H5B_find(idx_info->f, H5B_BTREE, idx_info->storage->idx_addr, udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__btree_idx_get_addr() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_idx_iterate_cb
*
@@ -1068,13 +1027,13 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5D__btree_idx_iterate_cb(H5F_t H5_ATTR_UNUSED *f, const void *_lt_key,
- haddr_t addr, const void H5_ATTR_UNUSED *_rt_key, void *_udata)
+H5D__btree_idx_iterate_cb(H5F_t H5_ATTR_UNUSED *f, const void *_lt_key, haddr_t addr,
+ const void H5_ATTR_UNUSED *_rt_key, void *_udata)
{
- H5D_btree_it_ud_t *udata = (H5D_btree_it_ud_t *)_udata; /* User data */
- const H5D_btree_key_t *lt_key = (const H5D_btree_key_t *)_lt_key; /* B-tree key for chunk */
- H5D_chunk_rec_t chunk_rec; /* Generic chunk record for callback */
- int ret_value = -1; /* Return value */
+ H5D_btree_it_ud_t * udata = (H5D_btree_it_ud_t *)_udata; /* User data */
+ const H5D_btree_key_t *lt_key = (const H5D_btree_key_t *)_lt_key; /* B-tree key for chunk */
+ H5D_chunk_rec_t chunk_rec; /* Generic chunk record for callback */
+ int ret_value = -1; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -1091,13 +1050,12 @@ H5D__btree_idx_iterate_cb(H5F_t H5_ATTR_UNUSED *f, const void *_lt_key,
chunk_rec.chunk_addr = addr;
/* Make "generic chunk" callback */
- if((ret_value = (udata->cb)(&chunk_rec, udata->udata)) < 0)
+ if ((ret_value = (udata->cb)(&chunk_rec, udata->udata)) < 0)
HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback");
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__btree_idx_iterate_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_idx_iterate
*
@@ -1112,11 +1070,10 @@ H5D__btree_idx_iterate_cb(H5F_t H5_ATTR_UNUSED *f, const void *_lt_key,
*-------------------------------------------------------------------------
*/
static int
-H5D__btree_idx_iterate(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
+H5D__btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
{
- H5D_btree_it_ud_t udata; /* User data for B-tree iterator callback */
- int ret_value = -1; /* Return value */
+ H5D_btree_it_ud_t udata; /* User data for B-tree iterator callback */
+ int ret_value = -1; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -1131,19 +1088,19 @@ H5D__btree_idx_iterate(const H5D_chk_idx_info_t *idx_info,
/* Initialize userdata */
HDmemset(&udata, 0, sizeof udata);
- udata.common.layout = idx_info->layout;
+ udata.common.layout = idx_info->layout;
udata.common.storage = idx_info->storage;
- udata.cb = chunk_cb;
- udata.udata = chunk_udata;
+ udata.cb = chunk_cb;
+ udata.udata = chunk_udata;
/* Iterate over existing chunks */
- if((ret_value = H5B_iterate(idx_info->f, H5B_BTREE, idx_info->storage->idx_addr, H5D__btree_idx_iterate_cb, &udata)) < 0)
+ if ((ret_value = H5B_iterate(idx_info->f, H5B_BTREE, idx_info->storage->idx_addr,
+ H5D__btree_idx_iterate_cb, &udata)) < 0)
HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over chunk B-tree");
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_idx_iterate() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_idx_remove
*
@@ -1159,7 +1116,7 @@ H5D__btree_idx_iterate(const H5D_chk_idx_info_t *idx_info,
static herr_t
H5D__btree_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1174,14 +1131,13 @@ H5D__btree_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t
/* Remove the chunk from the v1 B-tree index and release the space for the
* chunk (in the B-tree callback).
*/
- if(H5B_remove(idx_info->f, H5B_BTREE, idx_info->storage->idx_addr, udata) < 0)
+ if (H5B_remove(idx_info->f, H5B_BTREE, idx_info->storage->idx_addr, udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to remove chunk entry")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__btree_idx_remove() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_idx_delete
*
@@ -1199,7 +1155,7 @@ done:
static herr_t
H5D__btree_idx_delete(const H5D_chk_idx_info_t *idx_info)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1211,30 +1167,30 @@ H5D__btree_idx_delete(const H5D_chk_idx_info_t *idx_info)
HDassert(idx_info->storage);
/* Check if the index data structure has been allocated */
- if(H5F_addr_defined(idx_info->storage->idx_addr)) {
- H5O_storage_chunk_t tmp_storage; /* Local copy of storage info */
- H5D_chunk_common_ud_t udata; /* User data for B-tree operations */
+ if (H5F_addr_defined(idx_info->storage->idx_addr)) {
+ H5O_storage_chunk_t tmp_storage; /* Local copy of storage info */
+ H5D_chunk_common_ud_t udata; /* User data for B-tree operations */
/* Set up temporary chunked storage info */
tmp_storage = *idx_info->storage;
/* Set up the shared structure */
- if(H5D__btree_shared_create(idx_info->f, &tmp_storage, idx_info->layout) < 0)
+ if (H5D__btree_shared_create(idx_info->f, &tmp_storage, idx_info->layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info")
/* Set up B-tree user data */
HDmemset(&udata, 0, sizeof udata);
- udata.layout = idx_info->layout;
+ udata.layout = idx_info->layout;
udata.storage = &tmp_storage;
/* Delete entire B-tree */
- if(H5B_delete(idx_info->f, H5B_BTREE, tmp_storage.idx_addr, &udata) < 0)
+ if (H5B_delete(idx_info->f, H5B_BTREE, tmp_storage.idx_addr, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk B-tree")
/* Release the shared B-tree page */
- if(NULL == tmp_storage.u.btree.shared)
+ if (NULL == tmp_storage.u.btree.shared)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "ref-counted page nil")
- if(H5UC_DEC(tmp_storage.u.btree.shared) < 0)
+ if (H5UC_DEC(tmp_storage.u.btree.shared) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
} /* end if */
@@ -1242,7 +1198,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_idx_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_idx_copy_setup
*
@@ -1256,10 +1211,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
- const H5D_chk_idx_info_t *idx_info_dst)
+H5D__btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_TAG(H5AC__COPIED_TAG)
@@ -1276,13 +1230,14 @@ H5D__btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr));
/* Create shared B-tree info for each file */
- if(H5D__btree_shared_create(idx_info_src->f, idx_info_src->storage, idx_info_src->layout) < 0)
+ if (H5D__btree_shared_create(idx_info_src->f, idx_info_src->storage, idx_info_src->layout) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for source shared B-tree info")
- if(H5D__btree_shared_create(idx_info_dst->f, idx_info_dst->storage, idx_info_dst->layout) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for destination shared B-tree info")
+ if (H5D__btree_shared_create(idx_info_dst->f, idx_info_dst->storage, idx_info_dst->layout) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL,
+ "can't create wrapper for destination shared B-tree info")
/* Create the root of the B-tree that describes chunked storage in the dest. file */
- if(H5D__btree_idx_create(idx_info_dst) < 0)
+ if (H5D__btree_idx_create(idx_info_dst) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr));
@@ -1290,7 +1245,6 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__btree_idx_copy_setup() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_idx_copy_shutdown
*
@@ -1304,10 +1258,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__btree_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
- H5O_storage_chunk_t *storage_dst)
+H5D__btree_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, H5O_storage_chunk_t *storage_dst)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1315,16 +1268,15 @@ H5D__btree_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
HDassert(storage_dst);
/* Decrement refcount on shared B-tree info */
- if(H5UC_DEC(storage_src->u.btree.shared) < 0)
+ if (H5UC_DEC(storage_src->u.btree.shared) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref-counted page")
- if(H5UC_DEC(storage_dst->u.btree.shared) < 0)
+ if (H5UC_DEC(storage_dst->u.btree.shared) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref-counted page")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_idx_copy_shutdown() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_idx_size
*
@@ -1341,9 +1293,9 @@ done:
static herr_t
H5D__btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size)
{
- H5D_chunk_common_ud_t udata; /* User-data for loading B-tree nodes */
- H5B_info_t bt_info; /* B-tree info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chunk_common_ud_t udata; /* User-data for loading B-tree nodes */
+ H5B_info_t bt_info; /* B-tree info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1357,11 +1309,11 @@ H5D__btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size)
/* Initialize B-tree node user-data */
HDmemset(&udata, 0, sizeof udata);
- udata.layout = idx_info->layout;
+ udata.layout = idx_info->layout;
udata.storage = idx_info->storage;
/* Get metadata information for B-tree */
- if(H5B_get_info(idx_info->f, H5B_BTREE, idx_info->storage->idx_addr, &bt_info, NULL, &udata) < 0)
+ if (H5B_get_info(idx_info->f, H5B_BTREE, idx_info->storage->idx_addr, &bt_info, NULL, &udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to iterate over chunk B-tree")
/* Set the size of the B-tree */
@@ -1371,7 +1323,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_idx_size() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_idx_reset
*
@@ -1392,14 +1343,13 @@ H5D__btree_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
HDassert(storage);
/* Reset index info */
- if(reset_addr)
- storage->idx_addr = HADDR_UNDEF;
+ if (reset_addr)
+ storage->idx_addr = HADDR_UNDEF;
storage->u.btree.shared = NULL;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__btree_idx_reset() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_idx_dump
*
@@ -1425,7 +1375,6 @@ H5D__btree_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__btree_idx_dump() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree_idx_dest
*
@@ -1441,7 +1390,7 @@ H5D__btree_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
static herr_t
H5D__btree_idx_dest(const H5D_chk_idx_info_t *idx_info)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1452,16 +1401,15 @@ H5D__btree_idx_dest(const H5D_chk_idx_info_t *idx_info)
HDassert(idx_info->storage);
/* Free the raw B-tree node buffer */
- if(NULL == idx_info->storage->u.btree.shared)
+ if (NULL == idx_info->storage->u.btree.shared)
HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil")
- if(H5UC_DEC(idx_info->storage->u.btree.shared) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
+ if (H5UC_DEC(idx_info->storage->u.btree.shared) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_idx_dest() */
-
/*-------------------------------------------------------------------------
* Function: H5D_btree_debug
*
@@ -1475,15 +1423,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D_btree_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent,
- int fwidth, unsigned ndims, const uint32_t *dim)
+H5D_btree_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, unsigned ndims,
+ const uint32_t *dim)
{
- H5D_btree_dbg_t udata; /* User data for B-tree callback */
- H5O_storage_chunk_t storage; /* Storage information for B-tree callback */
- H5O_layout_chunk_t layout; /* Layout information for B-tree callback */
- hbool_t shared_init = FALSE; /* Whether B-tree shared info is initialized */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_btree_dbg_t udata; /* User data for B-tree callback */
+ H5O_storage_chunk_t storage; /* Storage information for B-tree callback */
+ H5O_layout_chunk_t layout; /* Layout information for B-tree callback */
+ hbool_t shared_init = FALSE; /* Whether B-tree shared info is initialized */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1494,33 +1442,31 @@ H5D_btree_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent,
/* Reset "fake" layout info */
HDmemset(&layout, 0, sizeof(layout));
layout.ndims = ndims;
- for(u = 0; u < ndims; u++)
+ for (u = 0; u < ndims; u++)
layout.dim[u] = dim[u];
/* Allocate the shared structure */
- if(H5D__btree_shared_create(f, &storage, &layout) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info")
+ if (H5D__btree_shared_create(f, &storage, &layout) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info")
shared_init = TRUE;
/* Set up user data for callback */
- udata.common.layout = &layout;
+ udata.common.layout = &layout;
udata.common.storage = &storage;
- udata.common.scaled = NULL;
- udata.ndims = ndims;
+ udata.common.scaled = NULL;
+ udata.ndims = ndims;
/* Dump the records for the B-tree */
(void)H5B_debug(f, addr, stream, indent, fwidth, H5B_BTREE, &udata);
done:
- if(shared_init) {
+ if (shared_init) {
/* Free the raw B-tree node buffer */
- if(NULL == storage.u.btree.shared)
+ if (NULL == storage.u.btree.shared)
HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted shared info nil")
- else
- if(H5UC_DEC(storage.u.btree.shared) < 0)
- HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted shared info")
+ else if (H5UC_DEC(storage.u.btree.shared) < 0)
+ HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted shared info")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_btree_debug() */
-
diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c
index 567db94..866b794 100644
--- a/src/H5Dbtree2.c
+++ b/src/H5Dbtree2.c
@@ -22,64 +22,60 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5MFprivate.h" /* File space management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5VMprivate.h" /* Vector and array functions */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File space management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VMprivate.h" /* Vector and array functions */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
/* User data for creating callback context */
typedef struct H5D_bt2_ctx_ud_t {
- const H5F_t *f; /* Pointer to file info */
- uint32_t chunk_size; /* Size of chunk (bytes; for filtered object) */
- unsigned ndims; /* Number of dimensions */
- uint32_t *dim; /* Size of chunk in elements */
+ const H5F_t *f; /* Pointer to file info */
+ uint32_t chunk_size; /* Size of chunk (bytes; for filtered object) */
+ unsigned ndims; /* Number of dimensions */
+ uint32_t * dim; /* Size of chunk in elements */
} H5D_bt2_ctx_ud_t;
/* The callback context */
typedef struct H5D_bt2_ctx_t {
- uint32_t chunk_size; /* Size of chunk (bytes; constant for unfiltered object) */
- size_t sizeof_addr; /* Size of file addresses in the file (bytes) */
- size_t chunk_size_len; /* Size of chunk sizes in the file (bytes) */
- unsigned ndims; /* Number of dimensions in chunk */
- uint32_t *dim; /* Size of chunk in elements */
+ uint32_t chunk_size; /* Size of chunk (bytes; constant for unfiltered object) */
+ size_t sizeof_addr; /* Size of file addresses in the file (bytes) */
+ size_t chunk_size_len; /* Size of chunk sizes in the file (bytes) */
+ unsigned ndims; /* Number of dimensions in chunk */
+ uint32_t *dim; /* Size of chunk in elements */
} H5D_bt2_ctx_t;
/* Callback info for iteration over chunks in v2 B-tree */
typedef struct H5D_bt2_it_ud_t {
- H5D_chunk_cb_func_t cb; /* Callback routine for the chunk */
- void *udata; /* User data for the chunk's callback routine */
+ H5D_chunk_cb_func_t cb; /* Callback routine for the chunk */
+ void * udata; /* User data for the chunk's callback routine */
} H5D_bt2_it_ud_t;
/* User data for compare callback */
typedef struct H5D_bt2_ud_t {
- H5D_chunk_rec_t rec; /* The record to search for */
- unsigned ndims; /* Number of dimensions for the chunked dataset */
+ H5D_chunk_rec_t rec; /* The record to search for */
+ unsigned ndims; /* Number of dimensions for the chunked dataset */
} H5D_bt2_ud_t;
-
/********************/
/* Local Prototypes */
/********************/
/* Shared v2 B-tree methods for indexing filtered and non-filtered chunked datasets */
-static void *H5D__bt2_crt_context(void *udata);
+static void * H5D__bt2_crt_context(void *udata);
static herr_t H5D__bt2_dst_context(void *ctx);
static herr_t H5D__bt2_store(void *native, const void *udata);
static herr_t H5D__bt2_compare(const void *rec1, const void *rec2, int *result);
@@ -87,14 +83,14 @@ static herr_t H5D__bt2_compare(const void *rec1, const void *rec2, int *result);
/* v2 B-tree class for indexing non-filtered chunked datasets */
static herr_t H5D__bt2_unfilt_encode(uint8_t *raw, const void *native, void *ctx);
static herr_t H5D__bt2_unfilt_decode(const uint8_t *raw, void *native, void *ctx);
-static herr_t H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth,
- const void *record, const void *u_ctx);
+static herr_t H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth, const void *record,
+ const void *u_ctx);
/* v2 B-tree class for indexing filtered chunked datasets */
static herr_t H5D__bt2_filt_encode(uint8_t *raw, const void *native, void *ctx);
static herr_t H5D__bt2_filt_decode(const uint8_t *raw, void *native, void *ctx);
-static herr_t H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth,
- const void *record, const void *u_ctx);
+static herr_t H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth, const void *record,
+ const void *u_ctx);
/* Helper routine */
static herr_t H5D__bt2_idx_open(const H5D_chk_idx_info_t *idx_info);
@@ -116,29 +112,24 @@ static herr_t H5D__bt2_remove_cb(const void *nrecord, void *_udata);
static herr_t H5D__bt2_mod_cb(void *_record, void *_op_data, hbool_t *changed);
/* Chunked layout indexing callbacks for v2 B-tree indexing */
-static herr_t H5D__bt2_idx_init(const H5D_chk_idx_info_t *idx_info,
- const H5S_t *space, haddr_t dset_ohdr_addr);
-static herr_t H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__bt2_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space,
+ haddr_t dset_ohdr_addr);
+static herr_t H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info);
static hbool_t H5D__bt2_idx_is_space_alloc(const H5O_storage_chunk_t *storage);
-static herr_t H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_ud_t *udata, const H5D_t *dset);
-static herr_t H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_ud_t *udata);
-static int H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_cb_func_t chunk_cb, void *chunk_udata);
-static herr_t H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_common_ud_t *udata);
-static herr_t H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info);
-static herr_t H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
- const H5D_chk_idx_info_t *idx_info_dst);
-static herr_t H5D__bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
- H5O_storage_chunk_t *storage_dst);
-static herr_t H5D__bt2_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size);
-static herr_t H5D__bt2_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
-static herr_t H5D__bt2_idx_dump(const H5O_storage_chunk_t *storage,
- FILE *stream);
-static herr_t H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info);
-
+static herr_t H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
+ const H5D_t *dset);
+static herr_t H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata);
+static int H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb,
+ void *chunk_udata);
+static herr_t H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata);
+static herr_t H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+ const H5D_chk_idx_info_t *idx_info_dst);
+static herr_t H5D__bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, H5O_storage_chunk_t *storage_dst);
+static herr_t H5D__bt2_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size);
+static herr_t H5D__bt2_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
+static herr_t H5D__bt2_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream);
+static herr_t H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info);
/*********************/
/* Package Variables */
@@ -146,58 +137,58 @@ static herr_t H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info);
/* Chunked dataset I/O ops for v2 B-tree indexing */
const H5D_chunk_ops_t H5D_COPS_BT2[1] = {{
- TRUE, /* Fixed array indices support SWMR access */
- H5D__bt2_idx_init, /* init */
- H5D__bt2_idx_create, /* create */
- H5D__bt2_idx_is_space_alloc, /* is_space_alloc */
- H5D__bt2_idx_insert, /* insert */
- H5D__bt2_idx_get_addr, /* get_addr */
- NULL, /* resize */
- H5D__bt2_idx_iterate, /* iterate */
- H5D__bt2_idx_remove, /* remove */
- H5D__bt2_idx_delete, /* delete */
- H5D__bt2_idx_copy_setup, /* copy_setup */
- H5D__bt2_idx_copy_shutdown, /* copy_shutdown */
- H5D__bt2_idx_size, /* size */
- H5D__bt2_idx_reset, /* reset */
- H5D__bt2_idx_dump, /* dump */
- H5D__bt2_idx_dest /* destroy */
+ TRUE, /* Fixed array indices support SWMR access */
+ H5D__bt2_idx_init, /* init */
+ H5D__bt2_idx_create, /* create */
+ H5D__bt2_idx_is_space_alloc, /* is_space_alloc */
+ H5D__bt2_idx_insert, /* insert */
+ H5D__bt2_idx_get_addr, /* get_addr */
+ NULL, /* resize */
+ H5D__bt2_idx_iterate, /* iterate */
+ H5D__bt2_idx_remove, /* remove */
+ H5D__bt2_idx_delete, /* delete */
+ H5D__bt2_idx_copy_setup, /* copy_setup */
+ H5D__bt2_idx_copy_shutdown, /* copy_shutdown */
+ H5D__bt2_idx_size, /* size */
+ H5D__bt2_idx_reset, /* reset */
+ H5D__bt2_idx_dump, /* dump */
+ H5D__bt2_idx_dest /* destroy */
}};
-
/*****************************/
/* Library Private Variables */
/*****************************/
/* v2 B-tree class for indexing non-filtered chunked datasets */
-const H5B2_class_t H5D_BT2[1] = {{ /* B-tree class information */
- H5B2_CDSET_ID, /* Type of B-tree */
- "H5B2_CDSET_ID", /* Name of B-tree class */
- sizeof(H5D_chunk_rec_t), /* Size of native record */
- H5D__bt2_crt_context, /* Create client callback context */
- H5D__bt2_dst_context, /* Destroy client callback context */
- H5D__bt2_store, /* Record storage callback */
- H5D__bt2_compare, /* Record comparison callback */
- H5D__bt2_unfilt_encode, /* Record encoding callback */
- H5D__bt2_unfilt_decode, /* Record decoding callback */
- H5D__bt2_unfilt_debug /* Record debugging callback */
+const H5B2_class_t H5D_BT2[1] = {{
+ /* B-tree class information */
+ H5B2_CDSET_ID, /* Type of B-tree */
+ "H5B2_CDSET_ID", /* Name of B-tree class */
+ sizeof(H5D_chunk_rec_t), /* Size of native record */
+ H5D__bt2_crt_context, /* Create client callback context */
+ H5D__bt2_dst_context, /* Destroy client callback context */
+ H5D__bt2_store, /* Record storage callback */
+ H5D__bt2_compare, /* Record comparison callback */
+ H5D__bt2_unfilt_encode, /* Record encoding callback */
+ H5D__bt2_unfilt_decode, /* Record decoding callback */
+ H5D__bt2_unfilt_debug /* Record debugging callback */
}};
/* v2 B-tree class for indexing filtered chunked datasets */
-const H5B2_class_t H5D_BT2_FILT[1] = {{ /* B-tree class information */
- H5B2_CDSET_FILT_ID, /* Type of B-tree */
- "H5B2_CDSET_FILT_ID", /* Name of B-tree class */
- sizeof(H5D_chunk_rec_t), /* Size of native record */
- H5D__bt2_crt_context, /* Create client callback context */
- H5D__bt2_dst_context, /* Destroy client callback context */
- H5D__bt2_store, /* Record storage callback */
- H5D__bt2_compare, /* Record comparison callback */
- H5D__bt2_filt_encode, /* Record encoding callback */
- H5D__bt2_filt_decode, /* Record decoding callback */
- H5D__bt2_filt_debug /* Record debugging callback */
+const H5B2_class_t H5D_BT2_FILT[1] = {{
+ /* B-tree class information */
+ H5B2_CDSET_FILT_ID, /* Type of B-tree */
+ "H5B2_CDSET_FILT_ID", /* Name of B-tree class */
+ sizeof(H5D_chunk_rec_t), /* Size of native record */
+ H5D__bt2_crt_context, /* Create client callback context */
+ H5D__bt2_dst_context, /* Destroy client callback context */
+ H5D__bt2_store, /* Record storage callback */
+ H5D__bt2_compare, /* Record comparison callback */
+ H5D__bt2_filt_encode, /* Record encoding callback */
+ H5D__bt2_filt_decode, /* Record decoding callback */
+ H5D__bt2_filt_debug /* Record debugging callback */
}};
-
/*******************/
/* Local Variables */
/*******************/
@@ -208,8 +199,6 @@ H5FL_DEFINE_STATIC(H5D_bt2_ctx_t);
/* Declare a free list to manage the page elements */
H5FL_ARR_DEFINE_STATIC(uint32_t, H5O_LAYOUT_NDIMS);
-
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_crt_context
*
@@ -226,9 +215,9 @@ static void *
H5D__bt2_crt_context(void *_udata)
{
H5D_bt2_ctx_ud_t *udata = (H5D_bt2_ctx_ud_t *)_udata; /* User data for building callback context */
- H5D_bt2_ctx_t *ctx; /* Callback context structure */
- uint32_t *my_dim = NULL; /* Pointer to copy of chunk dimension size */
- void *ret_value = NULL; /* Return value */
+ H5D_bt2_ctx_t * ctx; /* Callback context structure */
+ uint32_t * my_dim = NULL; /* Pointer to copy of chunk dimension size */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -238,16 +227,16 @@ H5D__bt2_crt_context(void *_udata)
HDassert(udata->ndims > 0 && udata->ndims < H5O_LAYOUT_NDIMS);
/* Allocate callback context */
- if(NULL == (ctx = H5FL_MALLOC(H5D_bt2_ctx_t)))
+ if (NULL == (ctx = H5FL_MALLOC(H5D_bt2_ctx_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate callback context")
/* Determine the size of addresses and set the chunk size and # of dimensions for the dataset */
ctx->sizeof_addr = H5F_SIZEOF_ADDR(udata->f);
- ctx->chunk_size = udata->chunk_size;
- ctx->ndims = udata->ndims;
+ ctx->chunk_size = udata->chunk_size;
+ ctx->ndims = udata->ndims;
/* Set up the "local" information for this dataset's chunk dimension sizes */
- if(NULL == (my_dim = (uint32_t *)H5FL_ARR_MALLOC(uint32_t, H5O_LAYOUT_NDIMS)))
+ if (NULL == (my_dim = (uint32_t *)H5FL_ARR_MALLOC(uint32_t, H5O_LAYOUT_NDIMS)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate chunk dims")
H5MM_memcpy(my_dim, udata->dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t));
ctx->dim = my_dim;
@@ -257,7 +246,7 @@ H5D__bt2_crt_context(void *_udata)
* allowing for an extra byte, in case the filter makes the chunk larger.
*/
ctx->chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)udata->chunk_size) + 8) / 8);
- if(ctx->chunk_size_len > 8)
+ if (ctx->chunk_size_len > 8)
ctx->chunk_size_len = 8;
/* Set return value */
@@ -267,7 +256,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__bt2_crt_context() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_dst_context
*
@@ -283,7 +271,7 @@ done:
static herr_t
H5D__bt2_dst_context(void *_ctx)
{
- H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
+ H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
FUNC_ENTER_STATIC_NOERR
@@ -291,7 +279,7 @@ H5D__bt2_dst_context(void *_ctx)
HDassert(ctx);
/* Free array for chunk dimension sizes */
- if(ctx->dim)
+ if (ctx->dim)
H5FL_ARR_FREE(uint32_t, ctx->dim);
/* Release callback context */
ctx = H5FL_FREE(H5D_bt2_ctx_t, ctx);
@@ -299,7 +287,6 @@ H5D__bt2_dst_context(void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_dst_context() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_store
*
@@ -316,7 +303,7 @@ H5D__bt2_dst_context(void *_ctx)
static herr_t
H5D__bt2_store(void *record, const void *_udata)
{
- const H5D_bt2_ud_t *udata = (const H5D_bt2_ud_t *)_udata; /* User data */
+ const H5D_bt2_ud_t *udata = (const H5D_bt2_ud_t *)_udata; /* User data */
FUNC_ENTER_STATIC_NOERR
@@ -325,7 +312,6 @@ H5D__bt2_store(void *record, const void *_udata)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_store() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_compare
*
@@ -343,10 +329,10 @@ H5D__bt2_store(void *record, const void *_udata)
static herr_t
H5D__bt2_compare(const void *_udata, const void *_rec2, int *result)
{
- const H5D_bt2_ud_t *udata = (const H5D_bt2_ud_t *)_udata; /* User data */
- const H5D_chunk_rec_t *rec1 = &(udata->rec); /* The search record */
- const H5D_chunk_rec_t *rec2 = (const H5D_chunk_rec_t *)_rec2; /* The native record */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5D_bt2_ud_t * udata = (const H5D_bt2_ud_t *)_udata; /* User data */
+ const H5D_chunk_rec_t *rec1 = &(udata->rec); /* The search record */
+ const H5D_chunk_rec_t *rec2 = (const H5D_chunk_rec_t *)_rec2; /* The native record */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -360,7 +346,6 @@ H5D__bt2_compare(const void *_udata, const void *_rec2, int *result)
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__bt2_compare() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_unfilt_encode
*
@@ -377,9 +362,9 @@ H5D__bt2_compare(const void *_udata, const void *_rec2, int *result)
static herr_t
H5D__bt2_unfilt_encode(uint8_t *raw, const void *_record, void *_ctx)
{
- H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
+ H5D_bt2_ctx_t * ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
- unsigned u; /* Local index variable */
+ unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
@@ -389,13 +374,12 @@ H5D__bt2_unfilt_encode(uint8_t *raw, const void *_record, void *_ctx)
/* Encode the record's fields */
H5F_addr_encode_len(ctx->sizeof_addr, &raw, record->chunk_addr);
/* (Don't encode the chunk size & filter mask for non-filtered B-tree records) */
- for(u = 0; u < ctx->ndims; u++)
- UINT64ENCODE(raw, record->scaled[u]);
+ for (u = 0; u < ctx->ndims; u++)
+ UINT64ENCODE(raw, record->scaled[u]);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_unfilt_encode() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_unfilt_decode
*
@@ -412,9 +396,9 @@ H5D__bt2_unfilt_encode(uint8_t *raw, const void *_record, void *_ctx)
static herr_t
H5D__bt2_unfilt_decode(const uint8_t *raw, void *_record, void *_ctx)
{
- H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
- H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* The native record */
- unsigned u; /* Local index variable */
+ H5D_bt2_ctx_t * ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
+ H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* The native record */
+ unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
@@ -423,15 +407,14 @@ H5D__bt2_unfilt_decode(const uint8_t *raw, void *_record, void *_ctx)
/* Decode the record's fields */
H5F_addr_decode_len(ctx->sizeof_addr, &raw, &record->chunk_addr);
- record->nbytes = ctx->chunk_size;
+ record->nbytes = ctx->chunk_size;
record->filter_mask = 0;
- for(u = 0; u < ctx->ndims; u++)
- UINT64DECODE(raw, record->scaled[u]);
+ for (u = 0; u < ctx->ndims; u++)
+ UINT64DECODE(raw, record->scaled[u]);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_unfilt_decode() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_unfilt_debug
*
@@ -445,12 +428,11 @@ H5D__bt2_unfilt_decode(const uint8_t *raw, void *_record, void *_ctx)
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth,
- const void *_record, const void *_ctx)
+H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth, const void *_record, const void *_ctx)
{
const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
- const H5D_bt2_ctx_t *ctx = (const H5D_bt2_ctx_t *)_ctx; /* Callback context */
- unsigned u; /* Local index variable */
+ const H5D_bt2_ctx_t * ctx = (const H5D_bt2_ctx_t *)_ctx; /* Callback context */
+ unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
@@ -462,14 +444,13 @@ H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth,
HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Chunk address:", record->chunk_addr);
HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:");
- for(u = 0; u < ctx->ndims; u++)
- HDfprintf(stream, "%s%" PRIuHSIZE, u?", ":"", record->scaled[u] * ctx->dim[u]);
+ for (u = 0; u < ctx->ndims; u++)
+ HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", record->scaled[u] * ctx->dim[u]);
HDfputs("}\n", stream);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_unfilt_debug() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_filt_encode
*
@@ -486,9 +467,9 @@ H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth,
static herr_t
H5D__bt2_filt_encode(uint8_t *raw, const void *_record, void *_ctx)
{
- H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
- const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
- unsigned u; /* Local index variable */
+ H5D_bt2_ctx_t * ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
+ const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
+ unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
@@ -502,13 +483,12 @@ H5D__bt2_filt_encode(uint8_t *raw, const void *_record, void *_ctx)
H5F_addr_encode_len(ctx->sizeof_addr, &raw, record->chunk_addr);
UINT64ENCODE_VAR(raw, record->nbytes, ctx->chunk_size_len);
UINT32ENCODE(raw, record->filter_mask);
- for(u = 0; u < ctx->ndims; u++)
- UINT64ENCODE(raw, record->scaled[u]);
+ for (u = 0; u < ctx->ndims; u++)
+ UINT64ENCODE(raw, record->scaled[u]);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_filt_encode() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_filt_decode
*
@@ -525,9 +505,9 @@ H5D__bt2_filt_encode(uint8_t *raw, const void *_record, void *_ctx)
static herr_t
H5D__bt2_filt_decode(const uint8_t *raw, void *_record, void *_ctx)
{
- H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
- H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* The native record */
- unsigned u; /* Local index variable */
+ H5D_bt2_ctx_t * ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
+ H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* The native record */
+ unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
@@ -539,8 +519,8 @@ H5D__bt2_filt_decode(const uint8_t *raw, void *_record, void *_ctx)
H5F_addr_decode_len(ctx->sizeof_addr, &raw, &record->chunk_addr);
UINT64DECODE_VAR(raw, record->nbytes, ctx->chunk_size_len);
UINT32DECODE(raw, record->filter_mask);
- for(u = 0; u < ctx->ndims; u++)
- UINT64DECODE(raw, record->scaled[u]);
+ for (u = 0; u < ctx->ndims; u++)
+ UINT64DECODE(raw, record->scaled[u]);
/* Sanity checks */
HDassert(H5F_addr_defined(record->chunk_addr));
@@ -549,7 +529,6 @@ H5D__bt2_filt_decode(const uint8_t *raw, void *_record, void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_filt_decode() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_filt_debug
*
@@ -563,12 +542,11 @@ H5D__bt2_filt_decode(const uint8_t *raw, void *_record, void *_ctx)
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth,
- const void *_record, const void *_ctx)
+H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth, const void *_record, const void *_ctx)
{
- const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
- const H5D_bt2_ctx_t *ctx = (const H5D_bt2_ctx_t *)_ctx; /* Callback context */
- unsigned u; /* Local index variable */
+ const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
+ const H5D_bt2_ctx_t * ctx = (const H5D_bt2_ctx_t *)_ctx; /* Callback context */
+ unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
@@ -582,14 +560,13 @@ H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth,
HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", record->filter_mask);
HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:");
- for(u = 0; u < ctx->ndims; u++)
- HDfprintf(stream, "%s%" PRIuHSIZE, u?", ":"", record->scaled[u] * ctx->dim[u]);
+ for (u = 0; u < ctx->ndims; u++)
+ HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", record->scaled[u] * ctx->dim[u]);
HDfputs("}\n", stream);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_filt_debug() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_init
*
@@ -603,8 +580,8 @@ H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth,
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__bt2_idx_init(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info,
- const H5S_t H5_ATTR_UNUSED *space, haddr_t dset_ohdr_addr)
+H5D__bt2_idx_init(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, const H5S_t H5_ATTR_UNUSED *space,
+ haddr_t dset_ohdr_addr)
{
FUNC_ENTER_STATIC_NOERR
@@ -616,7 +593,6 @@ H5D__bt2_idx_init(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info,
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__bt2_idx_init() */
-
/*-------------------------------------------------------------------------
* Function: H5D__btree2_idx_depend
*
@@ -634,10 +610,10 @@ H5D__bt2_idx_init(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info,
static herr_t
H5D__btree2_idx_depend(const H5D_chk_idx_info_t *idx_info)
{
- H5O_t *oh = NULL; /* Object header */
- H5O_loc_t oloc; /* Temporary object header location for dataset */
- H5AC_proxy_entry_t *oh_proxy; /* Dataset's object header proxy */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_t * oh = NULL; /* Object header */
+ H5O_loc_t oloc; /* Temporary object header location for dataset */
+ H5AC_proxy_entry_t *oh_proxy; /* Dataset's object header proxy */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -659,26 +635,26 @@ H5D__btree2_idx_depend(const H5D_chk_idx_info_t *idx_info)
oloc.addr = idx_info->storage->u.btree.dset_ohdr_addr;
/* Get header */
- if(NULL == (oh = H5O_protect(&oloc, H5AC__READ_ONLY_FLAG, TRUE)))
+ if (NULL == (oh = H5O_protect(&oloc, H5AC__READ_ONLY_FLAG, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect object header")
/* Retrieve the dataset's object header proxy */
- if(NULL == (oh_proxy = H5O_get_proxy(oh)))
+ if (NULL == (oh_proxy = H5O_get_proxy(oh)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataset object header proxy")
/* Make the v2 B-tree a child flush dependency of the dataset's object header proxy */
- if(H5B2_depend(idx_info->storage->u.btree2.bt2, oh_proxy) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header proxy")
+ if (H5B2_depend(idx_info->storage->u.btree2.bt2, oh_proxy) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency on object header proxy")
done:
/* Release the object header from the cache */
- if(oh && H5O_unprotect(&oloc, oh, H5AC__NO_FLAGS_SET) < 0)
+ if (oh && H5O_unprotect(&oloc, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree2_idx_depend() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_open()
*
@@ -699,8 +675,8 @@ done:
static herr_t
H5D__bt2_idx_open(const H5D_chk_idx_info_t *idx_info)
{
- H5D_bt2_ctx_ud_t u_ctx; /* user data for creating context */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_bt2_ctx_ud_t u_ctx; /* user data for creating context */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -715,25 +691,26 @@ H5D__bt2_idx_open(const H5D_chk_idx_info_t *idx_info)
HDassert(NULL == idx_info->storage->u.btree2.bt2);
/* Set up the user data */
- u_ctx.f = idx_info->f;
- u_ctx.ndims = idx_info->layout->ndims - 1;
+ u_ctx.f = idx_info->f;
+ u_ctx.ndims = idx_info->layout->ndims - 1;
u_ctx.chunk_size = idx_info->layout->size;
- u_ctx.dim = idx_info->layout->dim;
+ u_ctx.dim = idx_info->layout->dim;
/* Open v2 B-tree for the chunk index */
- if(NULL == (idx_info->storage->u.btree2.bt2 = H5B2_open(idx_info->f, idx_info->storage->idx_addr, &u_ctx)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open v2 B-tree for tracking chunked dataset")
+ if (NULL ==
+ (idx_info->storage->u.btree2.bt2 = H5B2_open(idx_info->f, idx_info->storage->idx_addr, &u_ctx)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open v2 B-tree for tracking chunked dataset")
/* Check for SWMR writes to the file */
- if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
- if(H5D__btree2_idx_depend(idx_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header")
+ if (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
+ if (H5D__btree2_idx_depend(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency on object header")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__bt2_idx_open() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_create
*
@@ -748,9 +725,9 @@ done:
static herr_t
H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info)
{
- H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */
- H5D_bt2_ctx_ud_t u_ctx; /* data for context call */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */
+ H5D_bt2_ctx_ud_t u_ctx; /* data for context call */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -762,54 +739,55 @@ H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info)
HDassert(idx_info->storage);
HDassert(!H5F_addr_defined(idx_info->storage->idx_addr));
- bt2_cparam.rrec_size = H5F_SIZEOF_ADDR(idx_info->f) /* Address of chunk */
- + (idx_info->layout->ndims - 1) * 8; /* # of dimensions x 64-bit chunk offsets */
+ bt2_cparam.rrec_size = H5F_SIZEOF_ADDR(idx_info->f) /* Address of chunk */
+ + (idx_info->layout->ndims - 1) * 8; /* # of dimensions x 64-bit chunk offsets */
/* General parameters */
- if(idx_info->pline->nused > 0) {
- unsigned chunk_size_len; /* Size of encoded chunk size */
+ if (idx_info->pline->nused > 0) {
+ unsigned chunk_size_len; /* Size of encoded chunk size */
/*
- * Compute the size required for encoding the size of a chunk,
+ * Compute the size required for encoding the size of a chunk,
* allowing for an extra byte, in case the filter makes the chunk larger.
*/
chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)idx_info->layout->size) + 8) / 8);
- if(chunk_size_len > 8)
+ if (chunk_size_len > 8)
chunk_size_len = 8;
- bt2_cparam.rrec_size += chunk_size_len + 4; /* Size of encoded chunk size & filter mask */
- bt2_cparam.cls = H5D_BT2_FILT;
+ bt2_cparam.rrec_size += chunk_size_len + 4; /* Size of encoded chunk size & filter mask */
+ bt2_cparam.cls = H5D_BT2_FILT;
} /* end if */
else
- bt2_cparam.cls = H5D_BT2;
+ bt2_cparam.cls = H5D_BT2;
- bt2_cparam.node_size = idx_info->layout->u.btree2.cparam.node_size;
+ bt2_cparam.node_size = idx_info->layout->u.btree2.cparam.node_size;
bt2_cparam.split_percent = idx_info->layout->u.btree2.cparam.split_percent;
bt2_cparam.merge_percent = idx_info->layout->u.btree2.cparam.merge_percent;
- u_ctx.f = idx_info->f;
- u_ctx.ndims = idx_info->layout->ndims - 1;
+ u_ctx.f = idx_info->f;
+ u_ctx.ndims = idx_info->layout->ndims - 1;
u_ctx.chunk_size = idx_info->layout->size;
- u_ctx.dim = idx_info->layout->dim;
+ u_ctx.dim = idx_info->layout->dim;
/* Create the v2 B-tree for the chunked dataset */
- if(NULL == (idx_info->storage->u.btree2.bt2 = H5B2_create(idx_info->f, &bt2_cparam, &u_ctx)))
+ if (NULL == (idx_info->storage->u.btree2.bt2 = H5B2_create(idx_info->f, &bt2_cparam, &u_ctx)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking chunked dataset")
/* Retrieve the v2 B-tree's address in the file */
- if(H5B2_get_addr(idx_info->storage->u.btree2.bt2, &(idx_info->storage->idx_addr)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get v2 B-tree address for tracking chunked dataset")
+ if (H5B2_get_addr(idx_info->storage->u.btree2.bt2, &(idx_info->storage->idx_addr)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't get v2 B-tree address for tracking chunked dataset")
/* Check for SWMR writes to the file */
- if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
- if(H5D__btree2_idx_depend(idx_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header")
+ if (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
+ if (H5D__btree2_idx_depend(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency on object header")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__bt2_idx_create() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_is_space_alloc
*
@@ -832,7 +810,6 @@ H5D__bt2_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr))
} /* end H5D__bt2_idx_is_space_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_mod_cb
*
@@ -850,19 +827,19 @@ H5D__bt2_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
static herr_t
H5D__bt2_mod_cb(void *_record, void *_op_data, hbool_t *changed)
{
- H5D_bt2_ud_t *op_data = (H5D_bt2_ud_t *)_op_data; /* User data for v2 B-tree calls */
- H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* Chunk record */
+ H5D_bt2_ud_t * op_data = (H5D_bt2_ud_t *)_op_data; /* User data for v2 B-tree calls */
+ H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* Chunk record */
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
#ifndef NDEBUG
-{
- unsigned u; /* Local index variable */
+ {
+ unsigned u; /* Local index variable */
- for(u = 0; u < op_data->ndims; u++)
- HDassert(record->scaled[u] == op_data->rec.scaled[u]);
-}
+ for (u = 0; u < op_data->ndims; u++)
+ HDassert(record->scaled[u] == op_data->rec.scaled[u]);
+ }
#endif /* NDEBUG */
/* Modify record */
@@ -874,7 +851,6 @@ H5D__bt2_mod_cb(void *_record, void *_op_data, hbool_t *changed)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__bt2_mod_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_insert
*
@@ -895,12 +871,12 @@ H5D__bt2_mod_cb(void *_record, void *_op_data, hbool_t *changed)
*/
static herr_t
H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
- const H5D_t H5_ATTR_UNUSED *dset)
+ const H5D_t H5_ATTR_UNUSED *dset)
{
- H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */
- H5D_bt2_ud_t bt2_udata; /* User data for v2 B-tree calls */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_t * bt2; /* v2 B-tree handle for indexing chunks */
+ H5D_bt2_ud_t bt2_udata; /* User data for v2 B-tree calls */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -915,41 +891,40 @@ H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
HDassert(H5F_addr_defined(udata->chunk_block.offset));
/* Check if the v2 B-tree is open yet */
- if(NULL == idx_info->storage->u.btree2.bt2) {
- /* Open existing v2 B-tree */
- if(H5D__bt2_idx_open(idx_info) < 0)
+ if (NULL == idx_info->storage->u.btree2.bt2) {
+ /* Open existing v2 B-tree */
+ if (H5D__bt2_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
- } /* end if */
- else /* Patch the top level file pointer contained in bt2 if needed */
- if(H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
+ } /* end if */
+ else /* Patch the top level file pointer contained in bt2 if needed */
+ if (H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
/* Set convenience pointer to v2 B-tree structure */
bt2 = idx_info->storage->u.btree2.bt2;
/* Set up callback info */
- bt2_udata.ndims = idx_info->layout->ndims - 1;
+ bt2_udata.ndims = idx_info->layout->ndims - 1;
bt2_udata.rec.chunk_addr = udata->chunk_block.offset;
- if(idx_info->pline->nused > 0) { /* filtered chunk */
+ if (idx_info->pline->nused > 0) { /* filtered chunk */
H5_CHECKED_ASSIGN(bt2_udata.rec.nbytes, uint32_t, udata->chunk_block.length, hsize_t);
bt2_udata.rec.filter_mask = udata->filter_mask;
- } /* end if */
+ } /* end if */
else { /* non-filtered chunk */
- bt2_udata.rec.nbytes = idx_info->layout->size;
+ bt2_udata.rec.nbytes = idx_info->layout->size;
bt2_udata.rec.filter_mask = 0;
} /* end else */
- for(u = 0; u < (idx_info->layout->ndims - 1); u++)
+ for (u = 0; u < (idx_info->layout->ndims - 1); u++)
bt2_udata.rec.scaled[u] = udata->common.scaled[u];
/* Update record for v2 B-tree (could be insert or modify) */
- if(H5B2_update(bt2, &bt2_udata, H5D__bt2_mod_cb, &bt2_udata) < 0)
+ if (H5B2_update(bt2, &bt2_udata, H5D__bt2_mod_cb, &bt2_udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTUPDATE, FAIL, "unable to update record in v2 B-tree")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__bt2_idx_insert() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_found_cb
*
@@ -974,7 +949,6 @@ H5D__bt2_found_cb(const void *nrecord, void *op_data)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_found_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_get_addr
*
@@ -991,11 +965,11 @@ H5D__bt2_found_cb(const void *nrecord, void *op_data)
static herr_t
H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata)
{
- H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */
- H5D_bt2_ud_t bt2_udata; /* User data for v2 B-tree calls */
- H5D_chunk_rec_t found_rec; /* Record found from searching for object */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_t * bt2; /* v2 B-tree handle for indexing chunks */
+ H5D_bt2_ud_t bt2_udata; /* User data for v2 B-tree calls */
+ H5D_chunk_rec_t found_rec; /* Record found from searching for object */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1010,63 +984,62 @@ H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata)
HDassert(udata);
/* Check if the v2 B-tree is open yet */
- if(NULL == idx_info->storage->u.btree2.bt2) {
- /* Open existing v2 B-tree */
- if(H5D__bt2_idx_open(idx_info) < 0)
+ if (NULL == idx_info->storage->u.btree2.bt2) {
+ /* Open existing v2 B-tree */
+ if (H5D__bt2_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
- } /* end if */
- else /* Patch the top level file pointer contained in bt2 if needed */
- if(H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
+ } /* end if */
+ else /* Patch the top level file pointer contained in bt2 if needed */
+ if (H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
/* Set convenience pointer to v2 B-tree structure */
bt2 = idx_info->storage->u.btree2.bt2;
/* Clear the found record */
- found_rec.chunk_addr = HADDR_UNDEF;
- found_rec.nbytes = 0;
+ found_rec.chunk_addr = HADDR_UNDEF;
+ found_rec.nbytes = 0;
found_rec.filter_mask = 0;
/* Prepare user data for compare callback */
bt2_udata.rec.chunk_addr = HADDR_UNDEF;
- bt2_udata.ndims = idx_info->layout->ndims - 1;
+ bt2_udata.ndims = idx_info->layout->ndims - 1;
/* Set the chunk offset to be searched for */
- for(u = 0; u < (idx_info->layout->ndims - 1); u++)
+ for (u = 0; u < (idx_info->layout->ndims - 1); u++)
bt2_udata.rec.scaled[u] = udata->common.scaled[u];
/* Go get chunk information from v2 B-tree */
- if(H5B2_find(bt2, &bt2_udata, H5D__bt2_found_cb, &found_rec) < 0)
+ if (H5B2_find(bt2, &bt2_udata, H5D__bt2_found_cb, &found_rec) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree")
/* Set common info for the chunk */
udata->chunk_block.offset = found_rec.chunk_addr;
/* Check for setting other info */
- if(H5F_addr_defined(udata->chunk_block.offset)) {
+ if (H5F_addr_defined(udata->chunk_block.offset)) {
/* Sanity check */
HDassert(0 != found_rec.nbytes);
/* Set other info for the chunk */
- if(idx_info->pline->nused > 0) { /* filtered chunk */
+ if (idx_info->pline->nused > 0) { /* filtered chunk */
udata->chunk_block.length = found_rec.nbytes;
- udata->filter_mask = found_rec.filter_mask;
- } /* end if */
+ udata->filter_mask = found_rec.filter_mask;
+ } /* end if */
else { /* non-filtered chunk */
udata->chunk_block.length = idx_info->layout->size;
- udata->filter_mask = 0;
+ udata->filter_mask = 0;
} /* end else */
- } /* end if */
+ } /* end if */
else {
udata->chunk_block.length = 0;
- udata->filter_mask = 0;
+ udata->filter_mask = 0;
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__bt2_idx_get_addr() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_iterate_cb
*
@@ -1086,20 +1059,19 @@ done:
static int
H5D__bt2_idx_iterate_cb(const void *_record, void *_udata)
{
- H5D_bt2_it_ud_t *udata = (H5D_bt2_it_ud_t *)_udata; /* User data */
- const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* Native record */
- int ret_value = -1; /* Return value */
+ H5D_bt2_it_ud_t * udata = (H5D_bt2_it_ud_t *)_udata; /* User data */
+ const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* Native record */
+ int ret_value = -1; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Make "generic chunk" callback */
- if((ret_value = (udata->cb)(record, udata->udata)) < 0)
+ if ((ret_value = (udata->cb)(record, udata->udata)) < 0)
HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback");
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__bt2_idx_iterate_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_iterate
*
@@ -1113,12 +1085,11 @@ H5D__bt2_idx_iterate_cb(const void *_record, void *_udata)
*-------------------------------------------------------------------------
*/
static int
-H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
+H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
{
- H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */
- H5D_bt2_it_ud_t udata; /* User data for B-tree iterator callback */
- int ret_value = FAIL; /* Return value */
+ H5B2_t * bt2; /* v2 B-tree handle for indexing chunks */
+ H5D_bt2_it_ud_t udata; /* User data for B-tree iterator callback */
+ int ret_value = FAIL; /* Return value */
FUNC_ENTER_STATIC
@@ -1133,31 +1104,30 @@ H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info,
HDassert(chunk_udata);
/* Check if the v2 B-tree is open yet */
- if(NULL == idx_info->storage->u.btree2.bt2) {
- /* Open existing v2 B-tree */
- if(H5D__bt2_idx_open(idx_info) < 0)
+ if (NULL == idx_info->storage->u.btree2.bt2) {
+ /* Open existing v2 B-tree */
+ if (H5D__bt2_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
- } /* end if */
- else /* Patch the top level file pointer contained in bt2 if needed */
- if(H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
+ } /* end if */
+ else /* Patch the top level file pointer contained in bt2 if needed */
+ if (H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
/* Set convenience pointer to v2 B-tree structure */
bt2 = idx_info->storage->u.btree2.bt2;
/* Prepare user data for iterate callback */
- udata.cb = chunk_cb;
+ udata.cb = chunk_cb;
udata.udata = chunk_udata;
/* Iterate over the records in the v2 B-tree */
- if((ret_value = H5B2_iterate(bt2, H5D__bt2_idx_iterate_cb, &udata)) < 0)
+ if ((ret_value = H5B2_iterate(bt2, H5D__bt2_idx_iterate_cb, &udata)) < 0)
HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over chunk v2 B-tree");
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__bt2_idx_iterate() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_remove_cb()
*
@@ -1176,9 +1146,9 @@ done:
static herr_t
H5D__bt2_remove_cb(const void *_record, void *_udata)
{
- const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
- H5F_t *f = (H5F_t *)_udata; /* User data for removal callback */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
+ H5F_t * f = (H5F_t *)_udata; /* User data for removal callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1187,14 +1157,13 @@ H5D__bt2_remove_cb(const void *_record, void *_udata)
/* Free the space in the file for the object being removed */
H5_CHECK_OVERFLOW(record->nbytes, uint32_t, hsize_t);
- if(H5MF_xfree(f, H5FD_MEM_DRAW, record->chunk_addr, (hsize_t)record->nbytes) < 0)
+ if (H5MF_xfree(f, H5FD_MEM_DRAW, record->chunk_addr, (hsize_t)record->nbytes) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__bt2_remove_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_remove
*
@@ -1209,10 +1178,10 @@ done:
static herr_t
H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata)
{
- H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */
- H5D_bt2_ud_t bt2_udata; /* User data for v2 B-tree find call */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_t * bt2; /* v2 B-tree handle for indexing chunks */
+ H5D_bt2_ud_t bt2_udata; /* User data for v2 B-tree find call */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1226,14 +1195,14 @@ H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *u
HDassert(udata);
/* Check if the v2 B-tree is open yet */
- if(NULL == idx_info->storage->u.btree2.bt2) {
- /* Open existing v2 B-tree */
- if(H5D__bt2_idx_open(idx_info) < 0)
+ if (NULL == idx_info->storage->u.btree2.bt2) {
+ /* Open existing v2 B-tree */
+ if (H5D__bt2_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
- } /* end if */
- else /* Patch the top level file pointer contained in bt2 if needed */
- if(H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
+ } /* end if */
+ else /* Patch the top level file pointer contained in bt2 if needed */
+ if (H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
/* Set convenience pointer to v2 B-tree structure */
bt2 = idx_info->storage->u.btree2.bt2;
@@ -1242,19 +1211,20 @@ H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *u
bt2_udata.ndims = idx_info->layout->ndims - 1;
/* Initialize the record to search for */
- for(u = 0; u < (idx_info->layout->ndims - 1); u++)
+ for (u = 0; u < (idx_info->layout->ndims - 1); u++)
bt2_udata.rec.scaled[u] = udata->scaled[u];
/* Remove the record for the "dataset chunk" object from the v2 B-tree */
/* (space in the file for the object is freed in the 'remove' callback) */
- if(H5B2_remove(bt2, &bt2_udata, (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) ? NULL : H5D__bt2_remove_cb, idx_info->f) < 0)
+ if (H5B2_remove(bt2, &bt2_udata,
+ (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) ? NULL : H5D__bt2_remove_cb,
+ idx_info->f) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__bt2_idx_remove() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_delete
*
@@ -1271,9 +1241,9 @@ done:
static herr_t
H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info)
{
- H5B2_remove_t remove_op; /* The removal callback */
- H5D_bt2_ctx_ud_t u_ctx; /* data for context call */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_remove_t remove_op; /* The removal callback */
+ H5D_bt2_ctx_ud_t u_ctx; /* data for context call */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1285,32 +1255,31 @@ H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info)
HDassert(idx_info->storage);
/* Check if the index data structure has been allocated */
- if(H5F_addr_defined(idx_info->storage->idx_addr)) {
- /* Set up user data for creating context */
- u_ctx.f = idx_info->f;
- u_ctx.ndims = idx_info->layout->ndims - 1;
- u_ctx.chunk_size = idx_info->layout->size;
- u_ctx.dim = idx_info->layout->dim;
-
- /* Set remove operation. Do not remove chunks in SWMR_WRITE mode */
- if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
+ if (H5F_addr_defined(idx_info->storage->idx_addr)) {
+ /* Set up user data for creating context */
+ u_ctx.f = idx_info->f;
+ u_ctx.ndims = idx_info->layout->ndims - 1;
+ u_ctx.chunk_size = idx_info->layout->size;
+ u_ctx.dim = idx_info->layout->dim;
+
+ /* Set remove operation. Do not remove chunks in SWMR_WRITE mode */
+ if (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
remove_op = NULL;
else
remove_op = H5D__bt2_remove_cb;
- /* Delete the v2 B-tree */
- /*(space in the file for each object is freed in the 'remove' callback) */
- if(H5B2_delete(idx_info->f, idx_info->storage->idx_addr, &u_ctx, remove_op, idx_info->f) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree")
+ /* Delete the v2 B-tree */
+ /*(space in the file for each object is freed in the 'remove' callback) */
+ if (H5B2_delete(idx_info->f, idx_info->storage->idx_addr, &u_ctx, remove_op, idx_info->f) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree")
- idx_info->storage->idx_addr = HADDR_UNDEF;
+ idx_info->storage->idx_addr = HADDR_UNDEF;
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__bt2_idx_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_copy_setup
*
@@ -1323,10 +1292,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
- const H5D_chk_idx_info_t *idx_info_dst)
+H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1346,15 +1314,15 @@ H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr));
/* Check if the source v2 B-tree is open yet */
- if(NULL == idx_info_src->storage->u.btree2.bt2)
- if(H5D__bt2_idx_open(idx_info_src) < 0)
+ if (NULL == idx_info_src->storage->u.btree2.bt2)
+ if (H5D__bt2_idx_open(idx_info_src) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
/* Set copied metadata tag */
H5_BEGIN_TAG(H5AC__COPIED_TAG);
/* Create v2 B-tree that describes the chunked dataset in the destination file */
- if(H5D__bt2_idx_create(idx_info_dst) < 0)
+ if (H5D__bt2_idx_create(idx_info_dst) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr));
@@ -1365,7 +1333,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__bt2_idx_copy_setup() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_copy_shutdown
*
@@ -1378,10 +1345,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
- H5O_storage_chunk_t *storage_dst)
+H5D__bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, H5O_storage_chunk_t *storage_dst)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1392,12 +1358,12 @@ H5D__bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
HDassert(storage_dst->u.btree2.bt2);
/* Close v2 B-tree for source file */
- if(H5B2_close(storage_src->u.btree2.bt2) < 0)
+ if (H5B2_close(storage_src->u.btree2.bt2) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close v2 B-tree")
storage_src->u.btree2.bt2 = NULL;
/* Close v2 B-tree for destination file */
- if(H5B2_close(storage_dst->u.btree2.bt2) < 0)
+ if (H5B2_close(storage_dst->u.btree2.bt2) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close v2 B-tree")
storage_dst->u.btree2.bt2 = NULL;
@@ -1405,7 +1371,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__bt2_idx_copy_shutdown() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_size
*
@@ -1421,8 +1386,8 @@ done:
static herr_t
H5D__bt2_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size)
{
- H5B2_t *bt2_cdset = NULL; /* Pointer to v2 B-tree structure */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_t *bt2_cdset = NULL; /* Pointer to v2 B-tree structure */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1436,26 +1401,25 @@ H5D__bt2_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size)
HDassert(index_size);
/* Open v2 B-tree */
- if(H5D__bt2_idx_open(idx_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
+ if (H5D__bt2_idx_open(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
/* Set convenience pointer to v2 B-tree structure */
bt2_cdset = idx_info->storage->u.btree2.bt2;
/* Get v2 B-tree size for indexing chunked dataset */
- if(H5B2_size(bt2_cdset, index_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve v2 B-tree storage info for chunked dataset")
+ if (H5B2_size(bt2_cdset, index_size) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve v2 B-tree storage info for chunked dataset")
done:
/* Close v2 B-tree index */
- if(bt2_cdset && H5B2_close(bt2_cdset) < 0)
+ if (bt2_cdset && H5B2_close(bt2_cdset) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for tracking chunked dataset")
idx_info->storage->u.btree2.bt2 = NULL;
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__bt2_idx_size() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_reset
*
@@ -1476,14 +1440,13 @@ H5D__bt2_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
HDassert(storage);
/* Reset index info */
- if(reset_addr)
- storage->idx_addr = HADDR_UNDEF;
+ if (reset_addr)
+ storage->idx_addr = HADDR_UNDEF;
storage->u.btree2.bt2 = NULL;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__bt2_idx_reset() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_dump
*
@@ -1509,7 +1472,6 @@ H5D__bt2_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__bt2_idx_dump() */
-
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_dest
*
@@ -1524,7 +1486,7 @@ H5D__bt2_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
static herr_t
H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1534,14 +1496,14 @@ H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info)
HDassert(idx_info->storage);
/* Check if the v2-btree is open */
- if(idx_info->storage->u.btree2.bt2) {
+ if (idx_info->storage->u.btree2.bt2) {
- /* Patch the top level file pointer contained in bt2 if needed */
- if(H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0)
+ /* Patch the top level file pointer contained in bt2 if needed */
+ if (H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
/* Close v2 B-tree */
- if(H5B2_close(idx_info->storage->u.btree2.bt2) < 0)
+ if (H5B2_close(idx_info->storage->u.btree2.bt2) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree")
idx_info->storage->u.btree2.bt2 = NULL;
} /* end if */
@@ -1549,4 +1511,3 @@ H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__bt2_idx_dest() */
-
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 557dd95..60bf57e 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -42,26 +42,24 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
#ifdef H5_HAVE_PARALLEL
-#include "H5ACprivate.h" /* Metadata cache */
-#endif /* H5_HAVE_PARALLEL */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File functions */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5VMprivate.h" /* Vector and array functions */
-
+#include "H5ACprivate.h" /* Metadata cache */
+#endif /* H5_HAVE_PARALLEL */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Dataset functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File functions */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5VMprivate.h" /* Vector and array functions */
/****************/
/* Local Macros */
@@ -69,16 +67,17 @@
/* Macros for iterating over chunks to operate on */
#define H5D_CHUNK_GET_FIRST_NODE(map) (map->use_single ? (H5SL_node_t *)(1) : H5SL_first(map->sel_chunks))
-#define H5D_CHUNK_GET_NODE_INFO(map, node) (map->use_single ? map->single_chunk_info : (H5D_chunk_info_t *)H5SL_item(node))
-#define H5D_CHUNK_GET_NEXT_NODE(map, node) (map->use_single ? (H5SL_node_t *)NULL : H5SL_next(node))
+#define H5D_CHUNK_GET_NODE_INFO(map, node) \
+ (map->use_single ? map->single_chunk_info : (H5D_chunk_info_t *)H5SL_item(node))
+#define H5D_CHUNK_GET_NEXT_NODE(map, node) (map->use_single ? (H5SL_node_t *)NULL : H5SL_next(node))
/* Sanity check on chunk index types: commonly used by a lot of routines in this file */
-#define H5D_CHUNK_STORAGE_INDEX_CHK(storage) \
- HDassert((H5D_CHUNK_IDX_EARRAY == (storage)->idx_type && H5D_COPS_EARRAY == (storage)->ops) || \
- (H5D_CHUNK_IDX_FARRAY == (storage)->idx_type && H5D_COPS_FARRAY == (storage)->ops) || \
- (H5D_CHUNK_IDX_BT2 == (storage)->idx_type && H5D_COPS_BT2 == (storage)->ops) || \
- (H5D_CHUNK_IDX_BTREE == (storage)->idx_type && H5D_COPS_BTREE == (storage)->ops) || \
- (H5D_CHUNK_IDX_SINGLE == (storage)->idx_type && H5D_COPS_SINGLE == (storage)->ops) || \
+#define H5D_CHUNK_STORAGE_INDEX_CHK(storage) \
+ HDassert((H5D_CHUNK_IDX_EARRAY == (storage)->idx_type && H5D_COPS_EARRAY == (storage)->ops) || \
+ (H5D_CHUNK_IDX_FARRAY == (storage)->idx_type && H5D_COPS_FARRAY == (storage)->ops) || \
+ (H5D_CHUNK_IDX_BT2 == (storage)->idx_type && H5D_COPS_BT2 == (storage)->ops) || \
+ (H5D_CHUNK_IDX_BTREE == (storage)->idx_type && H5D_COPS_BTREE == (storage)->ops) || \
+ (H5D_CHUNK_IDX_SINGLE == (storage)->idx_type && H5D_COPS_SINGLE == (storage)->ops) || \
(H5D_CHUNK_IDX_NONE == (storage)->idx_type && H5D_COPS_NONE == (storage)->ops));
/*
@@ -108,10 +107,10 @@
/*#define H5D_CHUNK_DEBUG */
/* Flags for the "edge_chunk_state" field below */
-#define H5D_RDCC_DISABLE_FILTERS 0x01u /* Disable filters on this chunk */
-#define H5D_RDCC_NEWLY_DISABLED_FILTERS 0x02u /* Filters have been disabled since
- * the last flush */
-
+#define H5D_RDCC_DISABLE_FILTERS 0x01u /* Disable filters on this chunk */
+#define H5D_RDCC_NEWLY_DISABLED_FILTERS \
+ 0x02u /* Filters have been disabled since \
+ * the last flush */
/******************/
/* Local Typedefs */
@@ -119,129 +118,130 @@
/* Raw data chunks are cached. Each entry in the cache is: */
typedef struct H5D_rdcc_ent_t {
- hbool_t locked; /*entry is locked in cache */
- hbool_t dirty; /*needs to be written to disk? */
- hbool_t deleted; /*chunk about to be deleted */
- unsigned edge_chunk_state; /*states related to edge chunks (see above) */
- hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled chunk 'name' (coordinates) */
- uint32_t rd_count; /*bytes remaining to be read */
- uint32_t wr_count; /*bytes remaining to be written */
- H5F_block_t chunk_block; /*offset/length of chunk in file */
- hsize_t chunk_idx; /*index of chunk in dataset */
- uint8_t *chunk; /*the unfiltered chunk data */
- unsigned idx; /*index in hash table */
- struct H5D_rdcc_ent_t *next;/*next item in doubly-linked list */
- struct H5D_rdcc_ent_t *prev;/*previous item in doubly-linked list */
- struct H5D_rdcc_ent_t *tmp_next;/*next item in temporary doubly-linked list */
- struct H5D_rdcc_ent_t *tmp_prev;/*previous item in temporary doubly-linked list */
+ hbool_t locked; /*entry is locked in cache */
+ hbool_t dirty; /*needs to be written to disk? */
+ hbool_t deleted; /*chunk about to be deleted */
+ unsigned edge_chunk_state; /*states related to edge chunks (see above) */
+ hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled chunk 'name' (coordinates) */
+ uint32_t rd_count; /*bytes remaining to be read */
+ uint32_t wr_count; /*bytes remaining to be written */
+ H5F_block_t chunk_block; /*offset/length of chunk in file */
+ hsize_t chunk_idx; /*index of chunk in dataset */
+ uint8_t * chunk; /*the unfiltered chunk data */
+ unsigned idx; /*index in hash table */
+ struct H5D_rdcc_ent_t *next; /*next item in doubly-linked list */
+ struct H5D_rdcc_ent_t *prev; /*previous item in doubly-linked list */
+ struct H5D_rdcc_ent_t *tmp_next; /*next item in temporary doubly-linked list */
+ struct H5D_rdcc_ent_t *tmp_prev; /*previous item in temporary doubly-linked list */
} H5D_rdcc_ent_t;
typedef H5D_rdcc_ent_t *H5D_rdcc_ent_ptr_t; /* For free lists */
/* Callback info for iteration to prune chunks */
typedef struct H5D_chunk_it_ud1_t {
- H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */
- const H5D_chk_idx_info_t *idx_info; /* Chunked index info */
- const H5D_io_info_t *io_info; /* I/O info for dataset operation */
- const hsize_t *space_dim; /* New dataset dimensions */
- const hbool_t *shrunk_dim; /* Dimensions which have been shrunk */
- H5S_t *chunk_space; /* Dataspace for a chunk */
- uint32_t elmts_per_chunk;/* Elements in chunk */
- hsize_t *hyper_start; /* Starting location of hyperslab */
- H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
- hbool_t fb_info_init; /* Whether the fill value buffer has been initialized */
+ H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */
+ const H5D_chk_idx_info_t *idx_info; /* Chunked index info */
+ const H5D_io_info_t * io_info; /* I/O info for dataset operation */
+ const hsize_t * space_dim; /* New dataset dimensions */
+ const hbool_t * shrunk_dim; /* Dimensions which have been shrunk */
+ H5S_t * chunk_space; /* Dataspace for a chunk */
+ uint32_t elmts_per_chunk; /* Elements in chunk */
+ hsize_t * hyper_start; /* Starting location of hyperslab */
+ H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
+ hbool_t fb_info_init; /* Whether the fill value buffer has been initialized */
} H5D_chunk_it_ud1_t;
-/* Callback info for iteration to obtain chunk address and the index of the chunk for all chunks in the B-tree. */
+/* Callback info for iteration to obtain chunk address and the index of the chunk for all chunks in the
+ * B-tree. */
typedef struct H5D_chunk_it_ud2_t {
/* down */
- H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */
+ H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */
/* up */
- haddr_t *chunk_addr; /* Array of chunk addresses to fill in */
+ haddr_t *chunk_addr; /* Array of chunk addresses to fill in */
} H5D_chunk_it_ud2_t;
/* Callback info for iteration to copy data */
typedef struct H5D_chunk_it_ud3_t {
- H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */
- H5F_t *file_src; /* Source file for copy */
- H5D_chk_idx_info_t *idx_info_dst; /* Dest. chunk index info object */
- void *buf; /* Buffer to hold chunk data for read/write */
- void *bkg; /* Buffer for background information during type conversion */
- size_t buf_size; /* Buffer size */
- hbool_t do_convert; /* Whether to perform type conversions */
+ H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */
+ H5F_t * file_src; /* Source file for copy */
+ H5D_chk_idx_info_t * idx_info_dst; /* Dest. chunk index info object */
+ void * buf; /* Buffer to hold chunk data for read/write */
+ void * bkg; /* Buffer for background information during type conversion */
+ size_t buf_size; /* Buffer size */
+ hbool_t do_convert; /* Whether to perform type conversions */
/* needed for converting variable-length data */
- hid_t tid_src; /* Datatype ID for source datatype */
- hid_t tid_dst; /* Datatype ID for destination datatype */
- hid_t tid_mem; /* Datatype ID for memory datatype */
- const H5T_t *dt_src; /* Source datatype */
- H5T_path_t *tpath_src_mem; /* Datatype conversion path from source file to memory */
- H5T_path_t *tpath_mem_dst; /* Datatype conversion path from memory to dest. file */
- void *reclaim_buf; /* Buffer for reclaiming data */
- size_t reclaim_buf_size; /* Reclaim buffer size */
- uint32_t nelmts; /* Number of elements in buffer */
- H5S_t *buf_space; /* Dataspace describing buffer */
+ hid_t tid_src; /* Datatype ID for source datatype */
+ hid_t tid_dst; /* Datatype ID for destination datatype */
+ hid_t tid_mem; /* Datatype ID for memory datatype */
+ const H5T_t *dt_src; /* Source datatype */
+ H5T_path_t * tpath_src_mem; /* Datatype conversion path from source file to memory */
+ H5T_path_t * tpath_mem_dst; /* Datatype conversion path from memory to dest. file */
+ void * reclaim_buf; /* Buffer for reclaiming data */
+ size_t reclaim_buf_size; /* Reclaim buffer size */
+ uint32_t nelmts; /* Number of elements in buffer */
+ H5S_t * buf_space; /* Dataspace describing buffer */
/* needed for compressed variable-length data */
- const H5O_pline_t *pline; /* Filter pipeline */
- unsigned dset_ndims; /* Number of dimensions in dataset */
- const hsize_t *dset_dims; /* Dataset dimensions */
+ const H5O_pline_t *pline; /* Filter pipeline */
+ unsigned dset_ndims; /* Number of dimensions in dataset */
+ const hsize_t * dset_dims; /* Dataset dimensions */
/* needed for copy object pointed by refs */
- H5O_copy_t *cpy_info; /* Copy options */
+ H5O_copy_t *cpy_info; /* Copy options */
/* needed for getting raw data from chunk cache */
- hbool_t chunk_in_cache;
- uint8_t *chunk; /* the unfiltered chunk data */
+ hbool_t chunk_in_cache;
+ uint8_t *chunk; /* the unfiltered chunk data */
} H5D_chunk_it_ud3_t;
/* Callback info for iteration to dump index */
typedef struct H5D_chunk_it_ud4_t {
- FILE *stream; /* Output stream */
- hbool_t header_displayed; /* Node's header is displayed? */
- unsigned ndims; /* Number of dimensions for chunk/dataset */
- uint32_t *chunk_dim; /* Chunk dimensions */
+ FILE * stream; /* Output stream */
+ hbool_t header_displayed; /* Node's header is displayed? */
+ unsigned ndims; /* Number of dimensions for chunk/dataset */
+ uint32_t *chunk_dim; /* Chunk dimensions */
} H5D_chunk_it_ud4_t;
/* Callback info for iteration to format convert chunks */
typedef struct H5D_chunk_it_ud5_t {
- H5D_chk_idx_info_t *new_idx_info; /* Dest. chunk index info object */
- unsigned dset_ndims; /* Number of dimensions in dataset */
- hsize_t *dset_dims; /* Dataset dimensions */
+ H5D_chk_idx_info_t *new_idx_info; /* Dest. chunk index info object */
+ unsigned dset_ndims; /* Number of dimensions in dataset */
+ hsize_t * dset_dims; /* Dataset dimensions */
} H5D_chunk_it_ud5_t;
/* Callback info for nonexistent readvv operation */
typedef struct H5D_chunk_readvv_ud_t {
- unsigned char *rbuf; /* Read buffer to initialize */
- const H5D_t *dset; /* Dataset to operate on */
+ unsigned char *rbuf; /* Read buffer to initialize */
+ const H5D_t * dset; /* Dataset to operate on */
} H5D_chunk_readvv_ud_t;
/* Typedef for chunk info iterator callback */
typedef struct H5D_chunk_info_iter_ud_t {
- hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Logical offset of the chunk */
- hsize_t ndims; /* Number of dimensions in the dataset */
- uint32_t nbytes; /* Size of stored data in the chunk */
- unsigned filter_mask; /* Excluded filters */
- haddr_t chunk_addr; /* Address of the chunk in file */
- hsize_t chunk_idx; /* Chunk index, where the iteration needs to stop */
- hsize_t curr_idx; /* Current index, where the iteration is */
- unsigned idx_hint; /* Index of chunk in cache, if present */
- hbool_t found; /* Whether the chunk was found */
+ hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Logical offset of the chunk */
+ hsize_t ndims; /* Number of dimensions in the dataset */
+ uint32_t nbytes; /* Size of stored data in the chunk */
+ unsigned filter_mask; /* Excluded filters */
+ haddr_t chunk_addr; /* Address of the chunk in file */
+ hsize_t chunk_idx; /* Chunk index, where the iteration needs to stop */
+ hsize_t curr_idx; /* Current index, where the iteration is */
+ unsigned idx_hint; /* Index of chunk in cache, if present */
+ hbool_t found; /* Whether the chunk was found */
} H5D_chunk_info_iter_ud_t;
/* Callback info for file selection iteration */
typedef struct H5D_chunk_file_iter_ud_t {
- H5D_chunk_map_t *fm; /* File->memory chunk mapping info */
+ H5D_chunk_map_t *fm; /* File->memory chunk mapping info */
#ifdef H5_HAVE_PARALLEL
- const H5D_io_info_t *io_info; /* I/O info for operation */
-#endif /* H5_HAVE_PARALLEL */
+ const H5D_io_info_t *io_info; /* I/O info for operation */
+#endif /* H5_HAVE_PARALLEL */
} H5D_chunk_file_iter_ud_t;
#ifdef H5_HAVE_PARALLEL
/* information to construct a collective I/O operation for filling chunks */
typedef struct H5D_chunk_coll_info_t {
- size_t num_io; /* Number of write operations */
- haddr_t *addr; /* array of the file addresses of the write operation */
+ size_t num_io; /* Number of write operations */
+ haddr_t *addr; /* array of the file addresses of the write operation */
} H5D_chunk_coll_info_t;
#endif /* H5_HAVE_PARALLEL */
@@ -252,17 +252,15 @@ typedef struct H5D_chunk_coll_info_t {
/* Chunked layout operation callbacks */
static herr_t H5D__chunk_construct(H5F_t *f, H5D_t *dset);
static herr_t H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id);
-static herr_t H5D__chunk_io_init(const H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space,
- const H5S_t *mem_space, H5D_chunk_map_t *fm);
-static herr_t H5D__chunk_io_init_selections(const H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, H5D_chunk_map_t *fm);
-static herr_t H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t *fm);
-static herr_t H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t *fm);
+static herr_t H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ H5D_chunk_map_t *fm);
+static herr_t H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ H5D_chunk_map_t *fm);
+static herr_t H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm);
+static herr_t H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm);
static herr_t H5D__chunk_flush(H5D_t *dset);
static herr_t H5D__chunk_io_term(const H5D_chunk_map_t *fm);
static herr_t H5D__chunk_dest(H5D_t *dset);
@@ -273,56 +271,48 @@ static int H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata
static int H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata);
/* "Nonexistent" layout operation callback */
-static ssize_t
-H5D__nonexistent_readvv(const H5D_io_info_t *io_info,
- size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
+static ssize_t H5D__nonexistent_readvv(const H5D_io_info_t *io_info, size_t chunk_max_nseq,
+ size_t *chunk_curr_seq, size_t chunk_len_arr[],
+ hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq,
+ size_t mem_len_arr[], hsize_t mem_offset_arr[]);
/* Format convert cb */
static int H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata);
/* Helper routines */
-static herr_t H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims,
- const hsize_t *curr_dims, const hsize_t *max_dims);
-static void *H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline);
-static void *H5D__chunk_mem_xfree(void *chk, const void *pline);
-static void *H5D__chunk_mem_realloc(void *chk, size_t size,
- const H5O_pline_t *pline);
-static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last);
-static herr_t H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last,
- const H5D_chunk_ud_t *udata);
-static hbool_t H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last,
- H5D_chunk_ud_t *udata);
-static herr_t H5D__free_chunk_info(void *item, void *key, void *opdata);
-static herr_t H5D__create_chunk_map_single(H5D_chunk_map_t *fm,
- const H5D_io_info_t *io_info);
-static herr_t H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm,
- const H5D_io_info_t *io_info);
-static herr_t H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm,
- const H5D_io_info_t *io_info);
-static herr_t H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm);
-static herr_t H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm);
-static herr_t H5D__chunk_file_cb(void *elem, const H5T_t *type, unsigned ndims,
- const hsize_t *coords, void *fm);
-static herr_t H5D__chunk_mem_cb(void *elem, const H5T_t *type, unsigned ndims,
- const hsize_t *coords, void *fm);
+static herr_t H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize_t *curr_dims,
+ const hsize_t *max_dims);
+static void * H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline);
+static void * H5D__chunk_mem_xfree(void *chk, const void *pline);
+static void * H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline);
+static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last);
+static herr_t H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *udata);
+static hbool_t H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *udata);
+static herr_t H5D__free_chunk_info(void *item, void *key, void *opdata);
+static herr_t H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info);
+static herr_t H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info);
+static herr_t H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info);
+static herr_t H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm);
+static herr_t H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm);
+static herr_t H5D__chunk_file_cb(void *elem, const H5T_t *type, unsigned ndims, const hsize_t *coords,
+ void *fm);
+static herr_t H5D__chunk_mem_cb(void *elem, const H5T_t *type, unsigned ndims, const hsize_t *coords,
+ void *fm);
static unsigned H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled);
-static herr_t H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent,
- hbool_t reset);
-static herr_t H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent,
- hbool_t flush);
-static hbool_t H5D__chunk_is_partial_edge_chunk(unsigned dset_ndims,
- const uint32_t *chunk_dims, const hsize_t *chunk_scaled, const hsize_t *dset_dims);
-static void *H5D__chunk_lock(const H5D_io_info_t *io_info,
- H5D_chunk_ud_t *udata, hbool_t relax, hbool_t prev_unfilt_chunk);
-static herr_t H5D__chunk_unlock(const H5D_io_info_t *io_info,
- const H5D_chunk_ud_t *udata, hbool_t dirty, void *chunk, uint32_t naccessed);
-static herr_t H5D__chunk_cache_prune(const H5D_t *dset, size_t size);
-static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk);
+static herr_t H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset);
+static herr_t H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush);
+static hbool_t H5D__chunk_is_partial_edge_chunk(unsigned dset_ndims, const uint32_t *chunk_dims,
+ const hsize_t *chunk_scaled, const hsize_t *dset_dims);
+static void * H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t relax,
+ hbool_t prev_unfilt_chunk);
+static herr_t H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, hbool_t dirty,
+ void *chunk, uint32_t naccessed);
+static herr_t H5D__chunk_cache_prune(const H5D_t *dset, size_t size);
+static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk);
#ifdef H5_HAVE_PARALLEL
-static herr_t H5D__chunk_collective_fill(const H5D_t *dset,
- H5D_chunk_coll_info_t *chunk_info, size_t chunk_size, const void *fill_buf);
-static int H5D__chunk_cmp_addr(const void *addr1, const void *addr2);
+static herr_t H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
+ size_t chunk_size, const void *fill_buf);
+static int H5D__chunk_cmp_addr(const void *addr1, const void *addr2);
#endif /* H5_HAVE_PARALLEL */
/* Debugging helper routine callback */
@@ -333,49 +323,24 @@ static int H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_uda
/*********************/
/* Chunked storage layout I/O ops */
-const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {{
- H5D__chunk_construct,
- H5D__chunk_init,
- H5D__chunk_is_space_alloc,
- H5D__chunk_is_data_cached,
- H5D__chunk_io_init,
- H5D__chunk_read,
- H5D__chunk_write,
+const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {
+ {H5D__chunk_construct, H5D__chunk_init, H5D__chunk_is_space_alloc, H5D__chunk_is_data_cached,
+ H5D__chunk_io_init, H5D__chunk_read, H5D__chunk_write,
#ifdef H5_HAVE_PARALLEL
- H5D__chunk_collective_read,
- H5D__chunk_collective_write,
+ H5D__chunk_collective_read, H5D__chunk_collective_write,
#endif /* H5_HAVE_PARALLEL */
- NULL,
- NULL,
- H5D__chunk_flush,
- H5D__chunk_io_term,
- H5D__chunk_dest
-}};
-
+ NULL, NULL, H5D__chunk_flush, H5D__chunk_io_term, H5D__chunk_dest}};
/*******************/
/* Local Variables */
/*******************/
/* "nonexistent" storage layout I/O ops */
-const H5D_layout_ops_t H5D_LOPS_NONEXISTENT[1] = {{
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+const H5D_layout_ops_t H5D_LOPS_NONEXISTENT[1] = {{NULL, NULL, NULL, NULL, NULL, NULL, NULL,
#ifdef H5_HAVE_PARALLEL
- NULL,
- NULL,
+ NULL, NULL,
#endif /* H5_HAVE_PARALLEL */
- H5D__nonexistent_readvv,
- NULL,
- NULL,
- NULL,
- NULL
-}};
+ H5D__nonexistent_readvv, NULL, NULL, NULL, NULL}};
/* Declare a free list to manage the H5F_rdcc_ent_ptr_t sequence information */
H5FL_SEQ_DEFINE_STATIC(H5D_rdcc_ent_ptr_t);
@@ -392,7 +357,6 @@ H5FL_BLK_DEFINE_STATIC(chunk);
/* Declare extern free list to manage the H5S_sel_iter_t struct */
H5FL_EXTERN(H5S_sel_iter_t);
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_direct_write
*
@@ -406,16 +370,16 @@ H5FL_EXTERN(H5S_sel_iter_t);
*-------------------------------------------------------------------------
*/
herr_t
-H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset,
- uint32_t data_size, const void *buf)
+H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, uint32_t data_size,
+ const void *buf)
{
- const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
- H5D_chunk_ud_t udata; /* User data for querying chunk info */
- H5F_block_t old_chunk; /* Offset/length of old chunk */
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
- hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
- hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
+ H5D_chunk_ud_t udata; /* User data for querying chunk info */
+ H5F_block_t old_chunk; /* Offset/length of old chunk */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
+ hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
@@ -423,14 +387,14 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset,
HDassert(layout->type == H5D_CHUNKED);
/* Allocate dataspace and initialize it if it hasn't been. */
- if(!H5D__chunk_is_space_alloc(&layout->storage)) {
- H5D_io_info_t io_info; /* to hold the dset info */
+ if (!H5D__chunk_is_space_alloc(&layout->storage)) {
+ H5D_io_info_t io_info; /* to hold the dset info */
io_info.dset = dset;
io_info.f_sh = H5F_SHARED(dset->oloc.file);
/* Allocate storage */
- if(H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, FALSE, NULL) < 0)
+ if (H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, FALSE, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
}
@@ -439,12 +403,12 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset,
scaled[dset->shared->ndims] = 0;
/* Find out the file address of the chunk (if any) */
- if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
+ if (H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
/* Sanity check */
HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) ||
- (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0));
+ (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0));
/* Set the file block information for the old chunk */
/* (Which is only defined when overwriting an existing chunk) */
@@ -456,22 +420,22 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset,
*/
/* Compose chunked index info struct */
- idx_info.f = dset->oloc.file;
- idx_info.pline = &(dset->shared->dcpl_cache.pline);
- idx_info.layout = &(dset->shared->layout.u.chunk);
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &(dset->shared->dcpl_cache.pline);
+ idx_info.layout = &(dset->shared->layout.u.chunk);
idx_info.storage = &(dset->shared->layout.storage.u.chunk);
/* Set up the size of chunk for user data */
udata.chunk_block.length = data_size;
- if(0 == idx_info.pline->nused && H5F_addr_defined(old_chunk.offset))
+ if (0 == idx_info.pline->nused && H5F_addr_defined(old_chunk.offset))
/* If there are no filters and we are overwriting the chunk we can just set values */
need_insert = FALSE;
else {
/* Otherwise, create the chunk it if it doesn't exist, or reallocate the chunk
* if its size has changed.
*/
- if(H5D__chunk_file_alloc(&idx_info, &old_chunk, &udata.chunk_block, &need_insert, scaled) < 0)
+ if (H5D__chunk_file_alloc(&idx_info, &old_chunk, &udata.chunk_block, &need_insert, scaled) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk")
/* Cache the new chunk information */
@@ -479,28 +443,29 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset,
} /* end else */
/* Make sure the address of the chunk is returned. */
- if(!H5F_addr_defined(udata.chunk_block.offset))
+ if (!H5F_addr_defined(udata.chunk_block.offset))
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk address isn't defined")
/* Evict the (old) entry from the cache if present, but do not flush
* it to disk */
- if(UINT_MAX != udata.idx_hint) {
- const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */
+ if (UINT_MAX != udata.idx_hint) {
+ const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */
- if(H5D__chunk_cache_evict(dset, rdcc->slot[udata.idx_hint], FALSE) < 0)
+ if (H5D__chunk_cache_evict(dset, rdcc->slot[udata.idx_hint], FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk")
} /* end if */
/* Write the data to the file */
- if(H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset, data_size, buf) < 0)
+ if (H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset,
+ data_size, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
/* Insert the chunk record into the index */
- if(need_insert && layout->storage.u.chunk.ops->insert) {
+ if (need_insert && layout->storage.u.chunk.ops->insert) {
/* Set the chunk's filter mask to the new settings */
udata.filter_mask = filters;
- if((layout->storage.u.chunk.ops->insert)(&idx_info, &udata, dset) < 0)
+ if ((layout->storage.u.chunk.ops->insert)(&idx_info, &udata, dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index")
} /* end if */
@@ -508,7 +473,6 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__chunk_direct_write() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_direct_read
*
@@ -522,14 +486,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters,
- void *buf)
+H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t *filters, void *buf)
{
- const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
- const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* raw data chunk cache */
- H5D_chunk_ud_t udata; /* User data for querying chunk info */
- hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
+ const H5D_rdcc_t * rdcc = &(dset->shared->cache.chunk); /* raw data chunk cache */
+ H5D_chunk_ud_t udata; /* User data for querying chunk info */
+ hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
@@ -542,8 +505,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters,
*filters = 0;
/* Allocate dataspace and initialize it if it hasn't been. */
- if(!H5D__chunk_is_space_alloc(&layout->storage)
- && !H5D__chunk_is_data_cached(dset->shared))
+ if (!H5D__chunk_is_space_alloc(&layout->storage) && !H5D__chunk_is_data_cached(dset->shared))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "storage is not initialized")
/* Calculate the index of this chunk */
@@ -551,23 +513,23 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters,
scaled[dset->shared->ndims] = 0;
/* Reset fields about the chunk we are looking for */
- udata.filter_mask = 0;
+ udata.filter_mask = 0;
udata.chunk_block.offset = HADDR_UNDEF;
udata.chunk_block.length = 0;
- udata.idx_hint = UINT_MAX;
+ udata.idx_hint = UINT_MAX;
/* Find out the file address of the chunk */
- if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
+ if (H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
/* Sanity check */
HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) ||
- (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0));
+ (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0));
/* Check if the requested chunk exists in the chunk cache */
- if(UINT_MAX != udata.idx_hint) {
+ if (UINT_MAX != udata.idx_hint) {
H5D_rdcc_ent_t *ent = rdcc->slot[udata.idx_hint];
- hbool_t flush;
+ hbool_t flush;
/* Sanity checks */
HDassert(udata.idx_hint < rdcc->nslots);
@@ -576,26 +538,27 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters,
flush = (ent->dirty == TRUE) ? TRUE : FALSE;
/* Flush the chunk to disk and clear the cache entry */
- if(H5D__chunk_cache_evict(dset, rdcc->slot[udata.idx_hint], flush) < 0)
+ if (H5D__chunk_cache_evict(dset, rdcc->slot[udata.idx_hint], flush) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk")
/* Reset fields about the chunk we are looking for */
- udata.filter_mask = 0;
+ udata.filter_mask = 0;
udata.chunk_block.offset = HADDR_UNDEF;
udata.chunk_block.length = 0;
- udata.idx_hint = UINT_MAX;
+ udata.idx_hint = UINT_MAX;
/* Get the new file address / chunk size after flushing */
- if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
+ if (H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
}
/* Make sure the address of the chunk is returned. */
- if(!H5F_addr_defined(udata.chunk_block.offset))
+ if (!H5F_addr_defined(udata.chunk_block.offset))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined")
/* Read the chunk data into the supplied buffer */
- if(H5F_shared_block_read(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset, udata.chunk_block.length, buf) < 0)
+ if (H5F_shared_block_read(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset,
+ udata.chunk_block.length, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk")
/* Return the filter mask */
@@ -605,7 +568,6 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__chunk_direct_read() */
-
/*-------------------------------------------------------------------------
* Function: H5D__get_chunk_storage_size
*
@@ -621,11 +583,11 @@ done:
herr_t
H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage_size)
{
- const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
- const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* raw data chunk cache */
- hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
- H5D_chunk_ud_t udata; /* User data for querying chunk info */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
+ const H5D_rdcc_t * rdcc = &(dset->shared->cache.chunk); /* raw data chunk cache */
+ hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
+ H5D_chunk_ud_t udata; /* User data for querying chunk info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
@@ -637,7 +599,7 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage
*storage_size = 0;
/* Allocate dataspace and initialize it if it hasn't been. */
- if(!(*layout->ops->is_space_alloc)(&layout->storage))
+ if (!(*layout->ops->is_space_alloc)(&layout->storage))
HGOTO_DONE(SUCCEED)
/* Calculate the index of this chunk */
@@ -647,24 +609,24 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage
/* Reset fields about the chunk we are looking for */
udata.chunk_block.offset = HADDR_UNDEF;
udata.chunk_block.length = 0;
- udata.idx_hint = UINT_MAX;
+ udata.idx_hint = UINT_MAX;
/* Find out the file address of the chunk */
- if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
+ if (H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
/* Sanity check */
HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) ||
- (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0));
+ (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0));
/* The requested chunk is not in cache or on disk */
- if(!H5F_addr_defined(udata.chunk_block.offset) && UINT_MAX == udata.idx_hint)
+ if (!H5F_addr_defined(udata.chunk_block.offset) && UINT_MAX == udata.idx_hint)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk storage is not allocated")
/* Check if there are filters registered to the dataset */
- if( dset->shared->dcpl_cache.pline.nused > 0 ) {
+ if (dset->shared->dcpl_cache.pline.nused > 0) {
/* Check if the requested chunk exists in the chunk cache */
- if(UINT_MAX != udata.idx_hint) {
+ if (UINT_MAX != udata.idx_hint) {
H5D_rdcc_ent_t *ent = rdcc->slot[udata.idx_hint];
/* Sanity checks */
@@ -672,24 +634,24 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage
HDassert(rdcc->slot[udata.idx_hint]);
/* If the cached chunk is dirty, it must be flushed to get accurate size */
- if( ent->dirty == TRUE ) {
+ if (ent->dirty == TRUE) {
/* Flush the chunk to disk and clear the cache entry */
- if(H5D__chunk_cache_evict(dset, rdcc->slot[udata.idx_hint], TRUE) < 0)
+ if (H5D__chunk_cache_evict(dset, rdcc->slot[udata.idx_hint], TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk")
/* Reset fields about the chunk we are looking for */
udata.chunk_block.offset = HADDR_UNDEF;
udata.chunk_block.length = 0;
- udata.idx_hint = UINT_MAX;
+ udata.idx_hint = UINT_MAX;
/* Get the new file address / chunk size after flushing */
- if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
+ if (H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
}
}
/* Make sure the address of the chunk is returned. */
- if(!H5F_addr_defined(udata.chunk_block.offset))
+ if (!H5F_addr_defined(udata.chunk_block.offset))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined")
/* Return the chunk size on disk */
@@ -703,7 +665,6 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* H5D__get_chunk_storage_size */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_set_info_real
*
@@ -717,11 +678,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims,
- const hsize_t *curr_dims, const hsize_t *max_dims)
+H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize_t *curr_dims,
+ const hsize_t *max_dims)
{
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -731,15 +692,14 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims,
HDassert(curr_dims);
/* Compute the # of chunks in dataset dimensions */
- for(u = 0, layout->nchunks = 1, layout->max_nchunks = 1; u < ndims; u++) {
+ for (u = 0, layout->nchunks = 1, layout->max_nchunks = 1; u < ndims; u++) {
/* Round up to the next integer # of chunks, to accommodate partial chunks */
layout->chunks[u] = ((curr_dims[u] + layout->dim[u]) - 1) / layout->dim[u];
- if(H5S_UNLIMITED == max_dims[u])
+ if (H5S_UNLIMITED == max_dims[u])
layout->max_chunks[u] = H5S_UNLIMITED;
- else
- {
+ else {
/* Sanity check */
- if(layout->dim[u] == 0)
+ if (layout->dim[u] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dimension size must be > 0, dim = %u ", u)
layout->max_chunks[u] = ((max_dims[u] + layout->dim[u]) - 1) / layout->dim[u];
@@ -751,16 +711,15 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims,
} /* end for */
/* Get the "down" sizes for each dimension */
- if(H5VM_array_down(ndims, layout->chunks, layout->down_chunks) < 0)
+ if (H5VM_array_down(ndims, layout->chunks, layout->down_chunks) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value")
- if(H5VM_array_down(ndims, layout->max_chunks, layout->max_down_chunks) < 0)
+ if (H5VM_array_down(ndims, layout->max_chunks, layout->max_down_chunks) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_set_info_real() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_set_info
*
@@ -776,7 +735,7 @@ done:
herr_t
H5D__chunk_set_info(const H5D_t *dset)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -784,18 +743,19 @@ H5D__chunk_set_info(const H5D_t *dset)
HDassert(dset);
/* Set the base layout information */
- if(H5D__chunk_set_info_real(&dset->shared->layout.u.chunk, dset->shared->ndims, dset->shared->curr_dims, dset->shared->max_dims) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info")
+ if (H5D__chunk_set_info_real(&dset->shared->layout.u.chunk, dset->shared->ndims, dset->shared->curr_dims,
+ dset->shared->max_dims) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info")
/* Call the index's "resize" callback */
- if(dset->shared->layout.storage.u.chunk.ops->resize && (dset->shared->layout.storage.u.chunk.ops->resize)(&dset->shared->layout.u.chunk) < 0)
+ if (dset->shared->layout.storage.u.chunk.ops->resize &&
+ (dset->shared->layout.storage.u.chunk.ops->resize)(&dset->shared->layout.u.chunk) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to resize chunk index information")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_set_info() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_set_sizes
*
@@ -814,7 +774,7 @@ H5D__chunk_set_sizes(H5D_t *dset)
uint64_t chunk_size; /* Size of chunk in bytes */
unsigned max_enc_bytes_per_dim; /* Max. number of bytes required to encode this dimension */
unsigned u; /* Iterator */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -825,18 +785,19 @@ H5D__chunk_set_sizes(H5D_t *dset)
dset->shared->layout.u.chunk.ndims++;
/* Set the last dimension of the chunk size to the size of the datatype */
- dset->shared->layout.u.chunk.dim[dset->shared->layout.u.chunk.ndims - 1] = (uint32_t)H5T_GET_SIZE(dset->shared->type);
+ dset->shared->layout.u.chunk.dim[dset->shared->layout.u.chunk.ndims - 1] =
+ (uint32_t)H5T_GET_SIZE(dset->shared->type);
/* Compute number of bytes to use for encoding chunk dimensions */
max_enc_bytes_per_dim = 0;
- for(u = 0; u < (unsigned)dset->shared->layout.u.chunk.ndims; u++) {
- unsigned enc_bytes_per_dim; /* Number of bytes required to encode this dimension */
+ for (u = 0; u < (unsigned)dset->shared->layout.u.chunk.ndims; u++) {
+ unsigned enc_bytes_per_dim; /* Number of bytes required to encode this dimension */
/* Get encoded size of dim, in bytes */
enc_bytes_per_dim = (H5VM_log2_gen(dset->shared->layout.u.chunk.dim[u]) + 8) / 8;
/* Check if this is the largest value so far */
- if(enc_bytes_per_dim > max_enc_bytes_per_dim)
+ if (enc_bytes_per_dim > max_enc_bytes_per_dim)
max_enc_bytes_per_dim = enc_bytes_per_dim;
} /* end for */
HDassert(max_enc_bytes_per_dim > 0 && max_enc_bytes_per_dim <= 8);
@@ -844,12 +805,13 @@ H5D__chunk_set_sizes(H5D_t *dset)
/* Compute and store the total size of a chunk */
/* (Use 64-bit value to ensure that we can detect >4GB chunks) */
- for(u = 1, chunk_size = (uint64_t)dset->shared->layout.u.chunk.dim[0]; u < dset->shared->layout.u.chunk.ndims; u++)
+ for (u = 1, chunk_size = (uint64_t)dset->shared->layout.u.chunk.dim[0];
+ u < dset->shared->layout.u.chunk.ndims; u++)
chunk_size *= (uint64_t)dset->shared->layout.u.chunk.dim[u];
/* Check for chunk larger than can be represented in 32-bits */
/* (Chunk size is encoded in 32-bit value in v1 B-tree records) */
- if(chunk_size > (uint64_t)0xffffffff)
+ if (chunk_size > (uint64_t)0xffffffff)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be < 4GB")
H5_CHECKED_ASSIGN(dset->shared->layout.u.chunk.size, uint32_t, chunk_size, uint64_t);
@@ -858,7 +820,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_set_sizes */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_construct
*
@@ -874,8 +835,8 @@ done:
static herr_t
H5D__chunk_construct(H5F_t H5_ATTR_UNUSED *f, H5D_t *dset)
{
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -884,24 +845,24 @@ H5D__chunk_construct(H5F_t H5_ATTR_UNUSED *f, H5D_t *dset)
HDassert(dset);
/* Check for invalid chunk dimension rank */
- if(0 == dset->shared->layout.u.chunk.ndims)
+ if (0 == dset->shared->layout.u.chunk.ndims)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "no chunk information set?")
- if(dset->shared->layout.u.chunk.ndims != dset->shared->ndims)
+ if (dset->shared->layout.u.chunk.ndims != dset->shared->ndims)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dimensionality of chunks doesn't match the dataspace")
/* Set chunk sizes */
- if(H5D__chunk_set_sizes(dset) < 0)
+ if (H5D__chunk_set_sizes(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to set chunk sizes")
HDassert((unsigned)(dset->shared->layout.u.chunk.ndims) <= NELMTS(dset->shared->layout.u.chunk.dim));
/* Chunked storage is not compatible with external storage (currently) */
- if(dset->shared->dcpl_cache.efl.nused > 0)
+ if (dset->shared->dcpl_cache.efl.nused > 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "external storage not supported with chunked layout")
/* Sanity check dimensions */
- for(u = 0; u < dset->shared->layout.u.chunk.ndims - 1; u++) {
+ for (u = 0; u < dset->shared->layout.u.chunk.ndims - 1; u++) {
/* Don't allow zero-sized chunk dimensions */
- if(0 == dset->shared->layout.u.chunk.dim[u])
+ if (0 == dset->shared->layout.u.chunk.dim[u])
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be > 0, dim = %u ", u)
/*
@@ -909,19 +870,20 @@ H5D__chunk_construct(H5F_t H5_ATTR_UNUSED *f, H5D_t *dset)
* the maximum dimension size. If any dimension size is zero, there
* will be no such restriction.
*/
- if(dset->shared->curr_dims[u] && dset->shared->max_dims[u] != H5S_UNLIMITED && dset->shared->max_dims[u] < dset->shared->layout.u.chunk.dim[u])
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be <= maximum dimension size for fixed-sized dimensions")
+ if (dset->shared->curr_dims[u] && dset->shared->max_dims[u] != H5S_UNLIMITED &&
+ dset->shared->max_dims[u] < dset->shared->layout.u.chunk.dim[u])
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "chunk size must be <= maximum dimension size for fixed-sized dimensions")
} /* end for */
/* Reset address and pointer of the array struct for the chunked storage index */
- if(H5D_chunk_idx_reset(&dset->shared->layout.storage.u.chunk, TRUE) < 0)
+ if (H5D_chunk_idx_reset(&dset->shared->layout.storage.u.chunk, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_construct() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_init
*
@@ -936,13 +898,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_init(H5F_t *f, const H5D_t * const dset, hid_t dapl_id)
+H5D__chunk_init(H5F_t *f, const H5D_t *const dset, hid_t dapl_id)
{
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Convenience pointer to dataset's chunk cache */
- H5P_genplist_t *dapl; /* Data access property list object pointer */
- H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ H5D_rdcc_t * rdcc = &(dset->shared->cache.chunk); /* Convenience pointer to dataset's chunk cache */
+ H5P_genplist_t * dapl; /* Data access property list object pointer */
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -951,31 +913,31 @@ H5D__chunk_init(H5F_t *f, const H5D_t * const dset, hid_t dapl_id)
HDassert(dset);
H5D_CHUNK_STORAGE_INDEX_CHK(sc);
- if(NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id)))
+ if (NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for fapl ID")
/* Use the properties in dapl_id if they have been set, otherwise use the properties from the file */
- if(H5P_get(dapl, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &rdcc->nslots) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache number of slots")
- if(rdcc->nslots == H5D_CHUNK_CACHE_NSLOTS_DEFAULT)
+ if (H5P_get(dapl, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &rdcc->nslots) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get data cache number of slots")
+ if (rdcc->nslots == H5D_CHUNK_CACHE_NSLOTS_DEFAULT)
rdcc->nslots = H5F_RDCC_NSLOTS(f);
- if(H5P_get(dapl, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc->nbytes_max) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache byte size")
- if(rdcc->nbytes_max == H5D_CHUNK_CACHE_NBYTES_DEFAULT)
+ if (H5P_get(dapl, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc->nbytes_max) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get data cache byte size")
+ if (rdcc->nbytes_max == H5D_CHUNK_CACHE_NBYTES_DEFAULT)
rdcc->nbytes_max = H5F_RDCC_NBYTES(f);
- if(H5P_get(dapl, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc->w0) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get preempt read chunks")
- if(rdcc->w0 < 0)
+ if (H5P_get(dapl, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc->w0) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get preempt read chunks")
+ if (rdcc->w0 < 0)
rdcc->w0 = H5F_RDCC_W0(f);
/* If nbytes_max or nslots is 0, set them both to 0 and avoid allocating space */
- if(!rdcc->nbytes_max || !rdcc->nslots)
+ if (!rdcc->nbytes_max || !rdcc->nslots)
rdcc->nbytes_max = rdcc->nslots = 0;
else {
rdcc->slot = H5FL_SEQ_CALLOC(H5D_rdcc_ent_ptr_t, rdcc->nslots);
- if(NULL == rdcc->slot)
+ if (NULL == rdcc->slot)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Reset any cached chunk info for this dataset */
@@ -983,21 +945,21 @@ H5D__chunk_init(H5F_t *f, const H5D_t * const dset, hid_t dapl_id)
} /* end else */
/* Compute scaled dimension info, if dataset dims > 1 */
- if(dset->shared->ndims > 1) {
- unsigned u; /* Local index value */
+ if (dset->shared->ndims > 1) {
+ unsigned u; /* Local index value */
- for(u = 0; u < dset->shared->ndims; u++) {
- hsize_t scaled_power2up; /* Scaled value, rounded to next power of 2 */
+ for (u = 0; u < dset->shared->ndims; u++) {
+ hsize_t scaled_power2up; /* Scaled value, rounded to next power of 2 */
/* Initial scaled dimension sizes */
- if(dset->shared->layout.u.chunk.dim[u] == 0)
+ if (dset->shared->layout.u.chunk.dim[u] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u)
/* Round up to the next integer # of chunks, to accommodate partial chunks */
rdcc->scaled_dims[u] = (dset->shared->curr_dims[u] + dset->shared->layout.u.chunk.dim[u] - 1) /
- dset->shared->layout.u.chunk.dim[u];
+ dset->shared->layout.u.chunk.dim[u];
- if(!(scaled_power2up = H5VM_power2up(rdcc->scaled_dims[u])))
+ if (!(scaled_power2up = H5VM_power2up(rdcc->scaled_dims[u])))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2")
/* Inital 'power2up' values for scaled dimensions */
@@ -1006,27 +968,26 @@ H5D__chunk_init(H5F_t *f, const H5D_t * const dset, hid_t dapl_id)
/* Number of bits required to encode scaled dimension size */
rdcc->scaled_encode_bits[u] = H5VM_log2_gen(rdcc->scaled_power2up[u]);
} /* end for */
- } /* end if */
+ } /* end if */
/* Compose chunked index info struct */
- idx_info.f = f;
- idx_info.pline = &dset->shared->dcpl_cache.pline;
- idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.f = f;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
idx_info.storage = sc;
/* Allocate any indexing structures */
- if(sc->ops->init && (sc->ops->init)(&idx_info, dset->shared->space, dset->oloc.addr) < 0)
+ if (sc->ops->init && (sc->ops->init)(&idx_info, dset->shared->space, dset->oloc.addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information")
/* Set the number of chunks in dataset, etc. */
- if(H5D__chunk_set_info(dset) < 0)
+ if (H5D__chunk_set_info(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set # of chunks for dataset")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_init() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_is_space_alloc
*
@@ -1042,8 +1003,8 @@ done:
hbool_t
H5D__chunk_is_space_alloc(const H5O_storage_t *storage)
{
- const H5O_storage_chunk_t *sc = &(storage->u.chunk);
- hbool_t ret_value = FALSE; /* Return value */
+ const H5O_storage_chunk_t *sc = &(storage->u.chunk);
+ hbool_t ret_value = FALSE; /* Return value */
FUNC_ENTER_PACKAGE_NOERR
@@ -1057,7 +1018,6 @@ H5D__chunk_is_space_alloc(const H5O_storage_t *storage)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_is_space_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_is_data_cached
*
@@ -1081,7 +1041,6 @@ H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset)
FUNC_LEAVE_NOAPI(shared_dset->cache.chunk.nused > 0)
} /* end H5D__chunk_is_data_cached() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_io_init
*
@@ -1095,17 +1054,16 @@ H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset)
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t *fm)
+H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm)
{
- const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */
- hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset */
- htri_t file_space_normalized = FALSE; /* File dataspace was normalized */
- unsigned f_ndims; /* The number of dimensions of the file's dataspace */
- int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */
+ hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset */
+ htri_t file_space_normalized = FALSE; /* File dataspace was normalized */
+ unsigned f_ndims; /* The number of dimensions of the file's dataspace */
+ int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1114,7 +1072,7 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
fm->nelmts = nelmts;
/* Check if the memory space is scalar & make equivalent memory space */
- if((sm_ndims = H5S_GET_EXTENT_NDIMS(mem_space)) < 0)
+ if ((sm_ndims = H5S_GET_EXTENT_NDIMS(mem_space)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimension number")
/* Set the number of dimensions for the memory dataspace */
H5_CHECKED_ASSIGN(fm->m_ndims, unsigned, sm_ndims, int);
@@ -1128,50 +1086,50 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
* speed up hyperslab calculations by removing the extra checks and/or
* additions involving the offset and the hyperslab selection -QAK)
*/
- if((file_space_normalized = H5S_hyper_normalize_offset((H5S_t *)file_space, old_offset)) < 0)
+ if ((file_space_normalized = H5S_hyper_normalize_offset((H5S_t *)file_space, old_offset)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to normalize selection")
/* Decide the number of chunks in each dimension */
- for(u = 0; u < f_ndims; u++)
+ for (u = 0; u < f_ndims; u++)
/* Keep the size of the chunk dimensions as hsize_t for various routines */
fm->chunk_dim[u] = fm->layout->u.chunk.dim[u];
#ifdef H5_HAVE_PARALLEL
/* Calculate total chunk in file map*/
fm->select_chunk = NULL;
- if(io_info->using_mpi_vfd) {
+ if (io_info->using_mpi_vfd) {
H5_CHECK_OVERFLOW(fm->layout->u.chunk.nchunks, hsize_t, size_t);
- if(fm->layout->u.chunk.nchunks)
- if(NULL == (fm->select_chunk = (H5D_chunk_info_t **)H5MM_calloc((size_t)fm->layout->u.chunk.nchunks * sizeof(H5D_chunk_info_t *))))
+ if (fm->layout->u.chunk.nchunks)
+ if (NULL == (fm->select_chunk = (H5D_chunk_info_t **)H5MM_calloc(
+ (size_t)fm->layout->u.chunk.nchunks * sizeof(H5D_chunk_info_t *))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
- } /* end if */
+ } /* end if */
#endif /* H5_HAVE_PARALLEL */
-
/* Initialize "last chunk" information */
- fm->last_index = (hsize_t)-1;
+ fm->last_index = (hsize_t)-1;
fm->last_chunk_info = NULL;
/* Point at the dataspaces */
fm->file_space = file_space;
- fm->mem_space = mem_space;
+ fm->mem_space = mem_space;
- if(H5D__chunk_io_init_selections(io_info, type_info, fm) < 0)
+ if (H5D__chunk_io_init_selections(io_info, type_info, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file and memory chunk selections")
done:
/* Reset the global dataspace info */
fm->file_space = NULL;
- fm->mem_space = NULL;
+ fm->mem_space = NULL;
- if(file_space_normalized == TRUE)
- if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0) /* (Casting away const OK -QAK) */
+ if (file_space_normalized == TRUE)
+ if (H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) <
+ 0) /* (Casting away const OK -QAK) */
HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't denormalize selection")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_io_init() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_io_init_selections
*
@@ -1185,49 +1143,50 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5D_chunk_map_t *fm)
+H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ H5D_chunk_map_t *fm)
{
- const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */
- const H5T_t *mem_type = type_info->mem_type; /* Local pointer to memory datatype */
- H5S_t *tmp_mspace = NULL; /* Temporary memory dataspace */
- H5T_t *file_type = NULL; /* Temporary copy of file datatype for iteration */
- hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
- char bogus; /* "bogus" buffer to pass to selection iterator */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */
+ const H5T_t *mem_type = type_info->mem_type; /* Local pointer to memory datatype */
+ H5S_t * tmp_mspace = NULL; /* Temporary memory dataspace */
+ H5T_t * file_type = NULL; /* Temporary copy of file datatype for iteration */
+ hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
+ char bogus; /* "bogus" buffer to pass to selection iterator */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Special case for only one element in selection */
/* (usually appending a record) */
- if(fm->nelmts == 1
+ if (fm->nelmts == 1
#ifdef H5_HAVE_PARALLEL
- && !(io_info->using_mpi_vfd)
+ && !(io_info->using_mpi_vfd)
#endif /* H5_HAVE_PARALLEL */
- && H5S_SEL_ALL != H5S_GET_SELECT_TYPE(fm->file_space)) {
+ && H5S_SEL_ALL != H5S_GET_SELECT_TYPE(fm->file_space)) {
/* Initialize skip list for chunk selections */
fm->sel_chunks = NULL;
fm->use_single = TRUE;
/* Initialize single chunk dataspace */
- if(NULL == dataset->shared->cache.chunk.single_space) {
+ if (NULL == dataset->shared->cache.chunk.single_space) {
/* Make a copy of the dataspace for the dataset */
- if((dataset->shared->cache.chunk.single_space = H5S_copy(fm->file_space, TRUE, FALSE)) == NULL)
+ if ((dataset->shared->cache.chunk.single_space = H5S_copy(fm->file_space, TRUE, FALSE)) == NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file space")
/* Resize chunk's dataspace dimensions to size of chunk */
- if(H5S_set_extent_real(dataset->shared->cache.chunk.single_space, fm->chunk_dim) < 0)
+ if (H5S_set_extent_real(dataset->shared->cache.chunk.single_space, fm->chunk_dim) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust chunk dimensions")
/* Set the single chunk dataspace to 'all' selection */
- if(H5S_select_all(dataset->shared->cache.chunk.single_space, TRUE) < 0)
+ if (H5S_select_all(dataset->shared->cache.chunk.single_space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "unable to set all selection")
} /* end if */
fm->single_space = dataset->shared->cache.chunk.single_space;
HDassert(fm->single_space);
/* Allocate the single chunk information */
- if(NULL == dataset->shared->cache.chunk.single_chunk_info)
- if(NULL == (dataset->shared->cache.chunk.single_chunk_info = H5FL_MALLOC(H5D_chunk_info_t)))
+ if (NULL == dataset->shared->cache.chunk.single_chunk_info)
+ if (NULL == (dataset->shared->cache.chunk.single_chunk_info = H5FL_MALLOC(H5D_chunk_info_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
fm->single_chunk_info = dataset->shared->cache.chunk.single_chunk_info;
HDassert(fm->single_chunk_info);
@@ -1236,15 +1195,16 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_
fm->mchunk_tmpl = NULL;
/* Set up chunk mapping for single element */
- if(H5D__create_chunk_map_single(fm, io_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create chunk selections for single element")
+ if (H5D__create_chunk_map_single(fm, io_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to create chunk selections for single element")
} /* end if */
else {
- hbool_t sel_hyper_flag; /* Whether file selection is a hyperslab */
+ hbool_t sel_hyper_flag; /* Whether file selection is a hyperslab */
/* Initialize skip list for chunk selections */
- if(NULL == dataset->shared->cache.chunk.sel_chunks)
- if(NULL == (dataset->shared->cache.chunk.sel_chunks = H5SL_create(H5SL_TYPE_HSIZE, NULL)))
+ if (NULL == dataset->shared->cache.chunk.sel_chunks)
+ if (NULL == (dataset->shared->cache.chunk.sel_chunks = H5SL_create(H5SL_TYPE_HSIZE, NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for chunk selections")
fm->sel_chunks = dataset->shared->cache.chunk.sel_chunks;
HDassert(fm->sel_chunks);
@@ -1253,38 +1213,38 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_
fm->use_single = FALSE;
/* Get type of selection on disk & in memory */
- if((fm->fsel_type = H5S_GET_SELECT_TYPE(fm->file_space)) < H5S_SEL_NONE)
+ if ((fm->fsel_type = H5S_GET_SELECT_TYPE(fm->file_space)) < H5S_SEL_NONE)
HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to get type of selection")
- if((fm->msel_type = H5S_GET_SELECT_TYPE(fm->mem_space)) < H5S_SEL_NONE)
+ if ((fm->msel_type = H5S_GET_SELECT_TYPE(fm->mem_space)) < H5S_SEL_NONE)
HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to get type of selection")
/* If the selection is NONE or POINTS, set the flag to FALSE */
- if(fm->fsel_type == H5S_SEL_POINTS || fm->fsel_type == H5S_SEL_NONE)
+ if (fm->fsel_type == H5S_SEL_POINTS || fm->fsel_type == H5S_SEL_NONE)
sel_hyper_flag = FALSE;
else
sel_hyper_flag = TRUE;
/* Check if file selection is a not a hyperslab selection */
- if(sel_hyper_flag) {
+ if (sel_hyper_flag) {
/* Build the file selection for each chunk */
- if(H5S_SEL_ALL == fm->fsel_type) {
- if(H5D__create_chunk_file_map_all(fm, io_info) < 0)
+ if (H5S_SEL_ALL == fm->fsel_type) {
+ if (H5D__create_chunk_file_map_all(fm, io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
} /* end if */
else {
/* Sanity check */
HDassert(fm->fsel_type == H5S_SEL_HYPERSLABS);
- if(H5D__create_chunk_file_map_hyper(fm, io_info) < 0)
+ if (H5D__create_chunk_file_map_hyper(fm, io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
} /* end else */
- } /* end if */
+ } /* end if */
else {
- H5S_sel_iter_op_t iter_op; /* Operator for iteration */
- H5D_chunk_file_iter_ud_t udata; /* User data for iteration */
+ H5S_sel_iter_op_t iter_op; /* Operator for iteration */
+ H5D_chunk_file_iter_ud_t udata; /* User data for iteration */
/* Create temporary datatypes for selection iteration */
- if(NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL)))
+ if (NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype")
/* Initialize the user data */
@@ -1293,89 +1253,89 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_
udata.io_info = io_info;
#endif /* H5_HAVE_PARALLEL */
- iter_op.op_type = H5S_SEL_ITER_OP_LIB;
+ iter_op.op_type = H5S_SEL_ITER_OP_LIB;
iter_op.u.lib_op = H5D__chunk_file_cb;
/* Spaces might not be the same shape, iterate over the file selection directly */
- if(H5S_select_iterate(&bogus, file_type, fm->file_space, &iter_op, &udata) < 0)
+ if (H5S_select_iterate(&bogus, file_type, fm->file_space, &iter_op, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
/* Reset "last chunk" info */
- fm->last_index = (hsize_t)-1;
+ fm->last_index = (hsize_t)-1;
fm->last_chunk_info = NULL;
} /* end else */
/* Build the memory selection for each chunk */
- if(sel_hyper_flag && H5S_SELECT_SHAPE_SAME(fm->file_space, fm->mem_space) == TRUE) {
+ if (sel_hyper_flag && H5S_SELECT_SHAPE_SAME(fm->file_space, fm->mem_space) == TRUE) {
/* Reset chunk template information */
fm->mchunk_tmpl = NULL;
/* If the selections are the same shape, use the file chunk information
* to generate the memory chunk information quickly.
*/
- if(H5D__create_chunk_mem_map_hyper(fm) < 0)
+ if (H5D__create_chunk_mem_map_hyper(fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections")
} /* end if */
- else if(sel_hyper_flag && fm->f_ndims == 1 && fm->m_ndims == 1 &&
- H5S_SELECT_IS_REGULAR(fm->mem_space) && H5S_SELECT_IS_SINGLE(fm->mem_space)) {
- if(H5D__create_chunk_mem_map_1d(fm) < 0)
+ else if (sel_hyper_flag && fm->f_ndims == 1 && fm->m_ndims == 1 &&
+ H5S_SELECT_IS_REGULAR(fm->mem_space) && H5S_SELECT_IS_SINGLE(fm->mem_space)) {
+ if (H5D__create_chunk_mem_map_1d(fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections")
} /* end else-if */
else {
- H5S_sel_iter_op_t iter_op; /* Operator for iteration */
- size_t elmt_size; /* Memory datatype size */
+ H5S_sel_iter_op_t iter_op; /* Operator for iteration */
+ size_t elmt_size; /* Memory datatype size */
/* Make a copy of equivalent memory space */
- if((tmp_mspace = H5S_copy(fm->mem_space, TRUE, FALSE)) == NULL)
+ if ((tmp_mspace = H5S_copy(fm->mem_space, TRUE, FALSE)) == NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
/* De-select the mem space copy */
- if(H5S_select_none(tmp_mspace) < 0)
+ if (H5S_select_none(tmp_mspace) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to de-select memory space")
/* Save chunk template information */
fm->mchunk_tmpl = tmp_mspace;
/* Create temporary datatypes for selection iteration */
- if(!file_type)
- if(NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL)))
+ if (!file_type)
+ if (NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype")
/* Create selection iterator for memory selection */
- if(0 == (elmt_size = H5T_get_size(mem_type)))
+ if (0 == (elmt_size = H5T_get_size(mem_type)))
HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "datatype size invalid")
- if(H5S_select_iter_init(&(fm->mem_iter), fm->mem_space, elmt_size, 0) < 0)
+ if (H5S_select_iter_init(&(fm->mem_iter), fm->mem_space, elmt_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
- iter_init = TRUE; /* Selection iteration info has been initialized */
+ iter_init = TRUE; /* Selection iteration info has been initialized */
- iter_op.op_type = H5S_SEL_ITER_OP_LIB;
+ iter_op.op_type = H5S_SEL_ITER_OP_LIB;
iter_op.u.lib_op = H5D__chunk_mem_cb;
/* Spaces aren't the same shape, iterate over the memory selection directly */
- if(H5S_select_iterate(&bogus, file_type, fm->file_space, &iter_op, fm) < 0)
+ if (H5S_select_iterate(&bogus, file_type, fm->file_space, &iter_op, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections")
} /* end else */
- } /* end else */
+ } /* end else */
done:
/* Release the [potentially partially built] chunk mapping information if an error occurs */
- if(ret_value < 0) {
- if(tmp_mspace && !fm->mchunk_tmpl)
- if(H5S_close(tmp_mspace) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template")
- if(H5D__chunk_io_term(fm) < 0)
+ if (ret_value < 0) {
+ if (tmp_mspace && !fm->mchunk_tmpl)
+ if (H5S_close(tmp_mspace) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL,
+ "can't release memory chunk dataspace template")
+ if (H5D__chunk_io_term(fm) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release chunk mapping")
} /* end if */
- if(iter_init && H5S_SELECT_ITER_RELEASE(&(fm->mem_iter)) < 0)
+ if (iter_init && H5S_SELECT_ITER_RELEASE(&(fm->mem_iter)) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
- if(file_type && (H5T_close_real(file_type) < 0))
+ if (file_type && (H5T_close_real(file_type) < 0))
HDONE_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Can't free temporary datatype")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_io_init_selections() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_mem_alloc
*
@@ -1393,13 +1353,13 @@ done:
static void *
H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline)
{
- void *ret_value = NULL; /* Return value */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC_NOERR
HDassert(size);
- if(pline && pline->nused)
+ if (pline && pline->nused)
ret_value = H5MM_malloc(size);
else
ret_value = H5FL_BLK_MALLOC(chunk, size);
@@ -1407,7 +1367,6 @@ H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline)
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_mem_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_mem_xfree
*
@@ -1429,8 +1388,8 @@ H5D__chunk_mem_xfree(void *chk, const void *_pline)
FUNC_ENTER_STATIC_NOERR
- if(chk) {
- if(pline && pline->nused)
+ if (chk) {
+ if (pline && pline->nused)
H5MM_xfree(chk);
else
chk = H5FL_BLK_FREE(chunk, chk);
@@ -1439,7 +1398,6 @@ H5D__chunk_mem_xfree(void *chk, const void *_pline)
FUNC_LEAVE_NOAPI(NULL)
} /* H5D__chunk_mem_xfree() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_mem_realloc
*
@@ -1457,14 +1415,14 @@ H5D__chunk_mem_xfree(void *chk, const void *_pline)
static void *
H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline)
{
- void *ret_value = NULL; /* Return value */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC_NOERR
HDassert(size);
HDassert(pline);
- if(pline->nused > 0)
+ if (pline->nused > 0)
ret_value = H5MM_realloc(chk, size);
else
ret_value = H5FL_BLK_REALLOC(chunk, chk, size);
@@ -1472,7 +1430,6 @@ H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline)
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_mem_realloc() */
-
/*--------------------------------------------------------------------------
NAME
H5D__free_chunk_info
@@ -1500,21 +1457,20 @@ H5D__free_chunk_info(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *
HDassert(chunk_info);
/* Close the chunk's file dataspace, if it's not shared */
- if(!chunk_info->fspace_shared)
+ if (!chunk_info->fspace_shared)
(void)H5S_close(chunk_info->fspace);
else
H5S_select_all(chunk_info->fspace, TRUE);
/* Close the chunk's memory dataspace, if it's not shared */
- if(!chunk_info->mspace_shared && chunk_info->mspace)
+ if (!chunk_info->mspace_shared && chunk_info->mspace)
(void)H5S_close(chunk_info->mspace);
/* Free the actual chunk info */
chunk_info = H5FL_FREE(H5D_chunk_info_t, chunk_info);
FUNC_LEAVE_NOAPI(0)
-} /* H5D__free_chunk_info() */
-
+} /* H5D__free_chunk_info() */
/*-------------------------------------------------------------------------
* Function: H5D__create_chunk_map_single
@@ -1531,16 +1487,16 @@ H5D__free_chunk_info(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *
static herr_t
H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t
#ifndef H5_HAVE_PARALLEL
- H5_ATTR_UNUSED
+ H5_ATTR_UNUSED
#endif /* H5_HAVE_PARALLEL */
- *io_info)
+ *io_info)
{
- H5D_chunk_info_t *chunk_info; /* Chunk information to insert into skip list */
- hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of chunk */
- hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
- hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chunk_info_t *chunk_info; /* Chunk information to insert into skip list */
+ hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of chunk */
+ hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
+ hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1548,38 +1504,39 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t
HDassert(fm->f_ndims > 0);
/* Get coordinate for selection */
- if(H5S_SELECT_BOUNDS(fm->file_space, sel_start, sel_end) < 0)
+ if (H5S_SELECT_BOUNDS(fm->file_space, sel_start, sel_end) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Initialize the 'single chunk' file & memory chunk information */
- chunk_info = fm->single_chunk_info;
+ chunk_info = fm->single_chunk_info;
chunk_info->chunk_points = 1;
/* Set chunk location & hyperslab size */
- for(u = 0; u < fm->f_ndims; u++) {
+ for (u = 0; u < fm->f_ndims; u++) {
/* Validate this chunk dimension */
- if(fm->layout->u.chunk.dim[u] == 0)
+ if (fm->layout->u.chunk.dim[u] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u)
HDassert(sel_start[u] == sel_end[u]);
chunk_info->scaled[u] = sel_start[u] / fm->layout->u.chunk.dim[u];
- coords[u] = chunk_info->scaled[u] * fm->layout->u.chunk.dim[u];
+ coords[u] = chunk_info->scaled[u] * fm->layout->u.chunk.dim[u];
} /* end for */
chunk_info->scaled[fm->f_ndims] = 0;
/* Calculate the index of this chunk */
- chunk_info->index = H5VM_array_offset_pre(fm->f_ndims, fm->layout->u.chunk.down_chunks, chunk_info->scaled);
+ chunk_info->index =
+ H5VM_array_offset_pre(fm->f_ndims, fm->layout->u.chunk.down_chunks, chunk_info->scaled);
/* Copy selection for file's dataspace into chunk dataspace */
- if(H5S_select_copy(fm->single_space, fm->file_space, FALSE) < 0)
+ if (H5S_select_copy(fm->single_space, fm->file_space, FALSE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file selection")
/* Move selection back to have correct offset in chunk */
- if(H5S_SELECT_ADJUST_U(fm->single_space, coords) < 0)
+ if (H5S_SELECT_ADJUST_U(fm->single_space, coords) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
#ifdef H5_HAVE_PARALLEL
/* store chunk selection information */
- if(io_info->using_mpi_vfd)
+ if (io_info->using_mpi_vfd)
fm->select_chunk[chunk_info->index] = chunk_info;
#endif /* H5_HAVE_PARALLEL */
@@ -1600,7 +1557,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_chunk_map_single() */
-
/*-------------------------------------------------------------------------
* Function: H5D__create_chunk_file_map_all
*
@@ -1616,24 +1572,25 @@ done:
static herr_t
H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t
#ifndef H5_HAVE_PARALLEL
- H5_ATTR_UNUSED
+ H5_ATTR_UNUSED
#endif /* H5_HAVE_PARALLEL */
- *io_info)
+ *io_info)
{
- H5S_t *tmp_fchunk = NULL; /* Temporary file dataspace */
- hsize_t file_dims[H5S_MAX_RANK]; /* File dataspace dims */
- hsize_t sel_points; /* Number of elements in file selection */
- hsize_t zeros[H5S_MAX_RANK]; /* All zero vector (for start parameter to setting hyperslab on partial chunks) */
- hsize_t coords[H5S_MAX_RANK]; /* Current coordinates of chunk */
- hsize_t end[H5S_MAX_RANK]; /* Final coordinates of chunk */
- hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
- hsize_t chunk_index; /* "Index" of chunk */
- hsize_t curr_partial_clip[H5S_MAX_RANK]; /* Current partial dimension sizes to clip against */
- hsize_t partial_dim_size[H5S_MAX_RANK]; /* Size of a partial dimension */
- hbool_t is_partial_dim[H5S_MAX_RANK]; /* Whether a dimension is currently a partial chunk */
- unsigned num_partial_dims; /* Current number of partial dimensions */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5S_t * tmp_fchunk = NULL; /* Temporary file dataspace */
+ hsize_t file_dims[H5S_MAX_RANK]; /* File dataspace dims */
+ hsize_t sel_points; /* Number of elements in file selection */
+ hsize_t zeros[H5S_MAX_RANK]; /* All zero vector (for start parameter to setting hyperslab on partial
+ chunks) */
+ hsize_t coords[H5S_MAX_RANK]; /* Current coordinates of chunk */
+ hsize_t end[H5S_MAX_RANK]; /* Final coordinates of chunk */
+ hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
+ hsize_t chunk_index; /* "Index" of chunk */
+ hsize_t curr_partial_clip[H5S_MAX_RANK]; /* Current partial dimension sizes to clip against */
+ hsize_t partial_dim_size[H5S_MAX_RANK]; /* Size of a partial dimension */
+ hbool_t is_partial_dim[H5S_MAX_RANK]; /* Whether a dimension is currently a partial chunk */
+ unsigned num_partial_dims; /* Current number of partial dimensions */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1644,51 +1601,51 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t
sel_points = fm->nelmts;
/* Get dataspace dimensions */
- if(H5S_get_simple_extent_dims(fm->file_space, file_dims, NULL) < 0)
+ if (H5S_get_simple_extent_dims(fm->file_space, file_dims, NULL) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Set initial chunk location, partial dimensions, etc */
num_partial_dims = 0;
HDmemset(zeros, 0, sizeof(zeros));
- for(u = 0; u < fm->f_ndims; u++) {
+ for (u = 0; u < fm->f_ndims; u++) {
/* Validate this chunk dimension */
- if(fm->layout->u.chunk.dim[u] == 0)
+ if (fm->layout->u.chunk.dim[u] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u)
/* Set up start / end coordinates for first chunk */
scaled[u] = 0;
coords[u] = 0;
- end[u] = fm->chunk_dim[u] - 1;
+ end[u] = fm->chunk_dim[u] - 1;
/* Iniitialize partial chunk dimension information */
partial_dim_size[u] = file_dims[u] % fm->chunk_dim[u];
- if(file_dims[u] < fm->chunk_dim[u]) {
+ if (file_dims[u] < fm->chunk_dim[u]) {
curr_partial_clip[u] = partial_dim_size[u];
- is_partial_dim[u] = TRUE;
+ is_partial_dim[u] = TRUE;
num_partial_dims++;
} /* end if */
else {
curr_partial_clip[u] = fm->chunk_dim[u];
- is_partial_dim[u] = FALSE;
+ is_partial_dim[u] = FALSE;
} /* end else */
- } /* end for */
+ } /* end for */
/* Set the index of this chunk */
chunk_index = 0;
/* Create "temporary" chunk for selection operations (copy file space) */
- if(NULL == (tmp_fchunk = H5S_create_simple(fm->f_ndims, fm->chunk_dim, NULL)))
+ if (NULL == (tmp_fchunk = H5S_create_simple(fm->f_ndims, fm->chunk_dim, NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "unable to create dataspace for chunk")
/* Iterate through each chunk in the dataset */
- while(sel_points) {
- H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */
- hsize_t chunk_points; /* Number of elements in chunk selection */
+ while (sel_points) {
+ H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */
+ hsize_t chunk_points; /* Number of elements in chunk selection */
/* Add temporary chunk to the list of chunks */
/* Allocate the file & memory chunk information */
- if(NULL == (new_chunk_info = H5FL_MALLOC(H5D_chunk_info_t)))
+ if (NULL == (new_chunk_info = H5FL_MALLOC(H5D_chunk_info_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk info")
/* Initialize the chunk information */
@@ -1698,22 +1655,23 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t
#ifdef H5_HAVE_PARALLEL
/* Store chunk selection information, for multi-chunk I/O */
- if(io_info->using_mpi_vfd)
+ if (io_info->using_mpi_vfd)
fm->select_chunk[chunk_index] = new_chunk_info;
#endif /* H5_HAVE_PARALLEL */
/* Set the file chunk dataspace */
- if(NULL == (new_chunk_info->fspace = H5S_copy(tmp_fchunk, TRUE, FALSE)))
+ if (NULL == (new_chunk_info->fspace = H5S_copy(tmp_fchunk, TRUE, FALSE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy chunk dataspace")
new_chunk_info->fspace_shared = FALSE;
/* If there are partial dimensions for this chunk, set the hyperslab for them */
- if(num_partial_dims > 0)
- if(H5S_select_hyperslab(new_chunk_info->fspace, H5S_SELECT_SET, zeros, NULL, curr_partial_clip, NULL) < 0)
+ if (num_partial_dims > 0)
+ if (H5S_select_hyperslab(new_chunk_info->fspace, H5S_SELECT_SET, zeros, NULL, curr_partial_clip,
+ NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk selection")
/* Set the memory chunk dataspace */
- new_chunk_info->mspace = NULL;
+ new_chunk_info->mspace = NULL;
new_chunk_info->mspace_shared = FALSE;
/* Copy the chunk's scaled coordinates */
@@ -1721,7 +1679,7 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t
new_chunk_info->scaled[fm->f_ndims] = 0;
/* Insert the new chunk into the skip list */
- if(H5SL_insert(fm->sel_chunks, new_chunk_info, &new_chunk_info->index) < 0) {
+ if (H5SL_insert(fm->sel_chunks, new_chunk_info, &new_chunk_info->index) < 0) {
H5D__free_chunk_info(new_chunk_info, NULL, NULL);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert chunk into skip list")
} /* end if */
@@ -1734,8 +1692,8 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t
sel_points -= chunk_points;
/* Advance to next chunk if we are not done */
- if(sel_points > 0) {
- int curr_dim; /* Current dimension to increment */
+ if (sel_points > 0) {
+ int curr_dim; /* Current dimension to increment */
/* Increment chunk index */
chunk_index++;
@@ -1749,21 +1707,21 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t
end[curr_dim] += fm->chunk_dim[curr_dim];
/* Bring chunk location back into bounds, if necessary */
- if(coords[curr_dim] >= file_dims[curr_dim]) {
+ if (coords[curr_dim] >= file_dims[curr_dim]) {
do {
/* Reset current dimension's location to 0 */
coords[curr_dim] = 0;
scaled[curr_dim] = 0;
- end[curr_dim] = fm->chunk_dim[curr_dim] - 1;
+ end[curr_dim] = fm->chunk_dim[curr_dim] - 1;
/* Check for previous partial chunk in this dimension */
- if(is_partial_dim[curr_dim] && end[curr_dim] < file_dims[curr_dim]) {
+ if (is_partial_dim[curr_dim] && end[curr_dim] < file_dims[curr_dim]) {
/* Sanity check */
HDassert(num_partial_dims > 0);
/* Reset partial chunk information for this dimension */
curr_partial_clip[curr_dim] = fm->chunk_dim[curr_dim];
- is_partial_dim[curr_dim] = FALSE;
+ is_partial_dim[curr_dim] = FALSE;
num_partial_dims--;
} /* end if */
@@ -1771,40 +1729,39 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t
curr_dim--;
/* Check for valid current dim */
- if(curr_dim >= 0) {
+ if (curr_dim >= 0) {
/* Increment chunk location in current dimension */
coords[curr_dim] += fm->chunk_dim[curr_dim];
scaled[curr_dim]++;
end[curr_dim] = (coords[curr_dim] + fm->chunk_dim[curr_dim]) - 1;
} /* end if */
- } while(curr_dim >= 0 && (coords[curr_dim] >= file_dims[curr_dim]));
+ } while (curr_dim >= 0 && (coords[curr_dim] >= file_dims[curr_dim]));
} /* end if */
/* Check for valid current dim */
- if(curr_dim >= 0) {
+ if (curr_dim >= 0) {
/* Check for partial chunk in this dimension */
- if(!is_partial_dim[curr_dim] && file_dims[curr_dim] <= end[curr_dim]) {
+ if (!is_partial_dim[curr_dim] && file_dims[curr_dim] <= end[curr_dim]) {
/* Set partial chunk information for this dimension */
curr_partial_clip[curr_dim] = partial_dim_size[curr_dim];
- is_partial_dim[curr_dim] = TRUE;
+ is_partial_dim[curr_dim] = TRUE;
num_partial_dims++;
/* Sanity check */
HDassert(num_partial_dims <= fm->f_ndims);
} /* end if */
- } /* end if */
- } /* end if */
- } /* end while */
+ } /* end if */
+ } /* end if */
+ } /* end while */
done:
/* Clean up */
- if(tmp_fchunk && H5S_close(tmp_fchunk) < 0)
+ if (tmp_fchunk && H5S_close(tmp_fchunk) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't release temporary dataspace")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_chunk_file_map_all() */
-
/*-------------------------------------------------------------------------
* Function: H5D__create_chunk_file_map_hyper
*
@@ -1820,23 +1777,23 @@ done:
static herr_t
H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
#ifndef H5_HAVE_PARALLEL
- H5_ATTR_UNUSED
+ H5_ATTR_UNUSED
#endif /* H5_HAVE_PARALLEL */
- *io_info)
+ *io_info)
{
- H5S_t *tmp_fchunk = NULL; /* Temporary file dataspace */
- hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
- hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
- hsize_t sel_points; /* Number of elements in file selection */
- hsize_t start_coords[H5O_LAYOUT_NDIMS]; /* Starting coordinates of selection */
- hsize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */
- hsize_t end[H5O_LAYOUT_NDIMS]; /* Final coordinates of chunk */
- hsize_t chunk_index; /* Index of chunk */
- hsize_t start_scaled[H5S_MAX_RANK]; /* Starting scaled coordinates of selection */
- hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
- int curr_dim; /* Current dimension to increment */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5S_t * tmp_fchunk = NULL; /* Temporary file dataspace */
+ hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */
+ hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */
+ hsize_t sel_points; /* Number of elements in file selection */
+ hsize_t start_coords[H5O_LAYOUT_NDIMS]; /* Starting coordinates of selection */
+ hsize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */
+ hsize_t end[H5O_LAYOUT_NDIMS]; /* Final coordinates of chunk */
+ hsize_t chunk_index; /* Index of chunk */
+ hsize_t start_scaled[H5S_MAX_RANK]; /* Starting scaled coordinates of selection */
+ hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
+ int curr_dim; /* Current dimension to increment */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1847,48 +1804,50 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
sel_points = fm->nelmts;
/* Get bounding box for selection (to reduce the number of chunks to iterate over) */
- if(H5S_SELECT_BOUNDS(fm->file_space, sel_start, sel_end) < 0)
+ if (H5S_SELECT_BOUNDS(fm->file_space, sel_start, sel_end) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Set initial chunk location & hyperslab size */
- for(u = 0; u < fm->f_ndims; u++) {
+ for (u = 0; u < fm->f_ndims; u++) {
/* Validate this chunk dimension */
- if(fm->layout->u.chunk.dim[u] == 0)
+ if (fm->layout->u.chunk.dim[u] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u)
scaled[u] = start_scaled[u] = sel_start[u] / fm->layout->u.chunk.dim[u];
coords[u] = start_coords[u] = scaled[u] * fm->layout->u.chunk.dim[u];
- end[u] = (coords[u] + fm->chunk_dim[u]) - 1;
+ end[u] = (coords[u] + fm->chunk_dim[u]) - 1;
} /* end for */
/* Calculate the index of this chunk */
chunk_index = H5VM_array_offset_pre(fm->f_ndims, fm->layout->u.chunk.down_chunks, scaled);
/* Iterate through each chunk in the dataset */
- while(sel_points) {
+ while (sel_points) {
/* Check for intersection of current chunk and file selection */
/* (Casting away const OK - QAK) */
- if(TRUE == H5S_SELECT_INTERSECT_BLOCK(fm->file_space, coords, end)) {
- H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */
- hsize_t chunk_points; /* Number of elements in chunk selection */
+ if (TRUE == H5S_SELECT_INTERSECT_BLOCK(fm->file_space, coords, end)) {
+ H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */
+ hsize_t chunk_points; /* Number of elements in chunk selection */
/* Create dataspace for chunk, 'AND'ing the overall selection with
* the current chunk.
*/
- if(H5S_combine_hyperslab(fm->file_space, H5S_SELECT_AND, coords, NULL, fm->chunk_dim, NULL, &tmp_fchunk) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to combine file space selection with chunk block")
+ if (H5S_combine_hyperslab(fm->file_space, H5S_SELECT_AND, coords, NULL, fm->chunk_dim, NULL,
+ &tmp_fchunk) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL,
+ "unable to combine file space selection with chunk block")
/* Resize chunk's dataspace dimensions to size of chunk */
- if(H5S_set_extent_real(tmp_fchunk, fm->chunk_dim) < 0)
+ if (H5S_set_extent_real(tmp_fchunk, fm->chunk_dim) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't adjust chunk dimensions")
/* Move selection back to have correct offset in chunk */
- if(H5S_SELECT_ADJUST_U(tmp_fchunk, coords) < 0)
+ if (H5S_SELECT_ADJUST_U(tmp_fchunk, coords) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
/* Add temporary chunk to the list of chunks */
/* Allocate the file & memory chunk information */
- if(NULL == (new_chunk_info = H5FL_MALLOC(H5D_chunk_info_t)))
+ if (NULL == (new_chunk_info = H5FL_MALLOC(H5D_chunk_info_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk info")
/* Initialize the chunk information */
@@ -1898,17 +1857,17 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
#ifdef H5_HAVE_PARALLEL
/* Store chunk selection information, for multi-chunk I/O */
- if(io_info->using_mpi_vfd)
+ if (io_info->using_mpi_vfd)
fm->select_chunk[chunk_index] = new_chunk_info;
#endif /* H5_HAVE_PARALLEL */
/* Set the file chunk dataspace */
- new_chunk_info->fspace = tmp_fchunk;
+ new_chunk_info->fspace = tmp_fchunk;
new_chunk_info->fspace_shared = FALSE;
- tmp_fchunk = NULL;
+ tmp_fchunk = NULL;
/* Set the memory chunk dataspace */
- new_chunk_info->mspace = NULL;
+ new_chunk_info->mspace = NULL;
new_chunk_info->mspace_shared = FALSE;
/* Copy the chunk's scaled coordinates */
@@ -1916,7 +1875,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
new_chunk_info->scaled[fm->f_ndims] = 0;
/* Insert the new chunk into the skip list */
- if(H5SL_insert(fm->sel_chunks, new_chunk_info, &new_chunk_info->index) < 0) {
+ if (H5SL_insert(fm->sel_chunks, new_chunk_info, &new_chunk_info->index) < 0) {
H5D__free_chunk_info(new_chunk_info, NULL, NULL);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert chunk into skip list")
} /* end if */
@@ -1929,7 +1888,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
sel_points -= chunk_points;
/* Leave if we are done */
- if(sel_points == 0)
+ if (sel_points == 0)
HGOTO_DONE(SUCCEED)
} /* end if */
@@ -1945,40 +1904,40 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
scaled[curr_dim]++;
/* Bring chunk location back into bounds, if necessary */
- if(coords[curr_dim] > sel_end[curr_dim]) {
+ if (coords[curr_dim] > sel_end[curr_dim]) {
do {
/* Reset current dimension's location to 0 */
scaled[curr_dim] = start_scaled[curr_dim];
- coords[curr_dim] = start_coords[curr_dim]; /*lint !e771 The start_coords will always be initialized */
+ coords[curr_dim] =
+ start_coords[curr_dim]; /*lint !e771 The start_coords will always be initialized */
end[curr_dim] = (coords[curr_dim] + fm->chunk_dim[curr_dim]) - 1;
/* Decrement current dimension */
curr_dim--;
/* Check for valid current dim */
- if(curr_dim >= 0) {
+ if (curr_dim >= 0) {
/* Increment chunk location in current dimension */
scaled[curr_dim]++;
coords[curr_dim] += fm->chunk_dim[curr_dim];
end[curr_dim] = (coords[curr_dim] + fm->chunk_dim[curr_dim]) - 1;
} /* end if */
- } while(curr_dim >= 0 && (coords[curr_dim] > sel_end[curr_dim]));
+ } while (curr_dim >= 0 && (coords[curr_dim] > sel_end[curr_dim]));
/* Re-calculate the index of this chunk */
chunk_index = H5VM_array_offset_pre(fm->f_ndims, fm->layout->u.chunk.down_chunks, scaled);
} /* end if */
- } /* end while */
+ } /* end while */
done:
/* Clean up on failure */
- if(ret_value < 0)
- if(tmp_fchunk && H5S_close(tmp_fchunk) < 0)
+ if (ret_value < 0)
+ if (tmp_fchunk && H5S_close(tmp_fchunk) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't release temporary dataspace")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_chunk_file_map_hyper() */
-
/*-------------------------------------------------------------------------
* Function: H5D__create_chunk_mem_map_hyper
*
@@ -1998,23 +1957,23 @@ done:
static herr_t
H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
{
- H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */
- H5SL_node_t *curr_node; /* Current node in skip list */
- hsize_t file_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
- hsize_t file_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
- hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
- hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
- hssize_t adjust[H5S_MAX_RANK]; /* Adjustment to make to all file chunks */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */
+ H5SL_node_t * curr_node; /* Current node in skip list */
+ hsize_t file_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
+ hsize_t file_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
+ hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
+ hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
+ hssize_t adjust[H5S_MAX_RANK]; /* Adjustment to make to all file chunks */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
- HDassert(fm->f_ndims>0);
+ HDassert(fm->f_ndims > 0);
/* Check for all I/O going to a single chunk */
- if(H5SL_count(fm->sel_chunks)==1) {
+ if (H5SL_count(fm->sel_chunks) == 1) {
/* Get the node */
curr_node = H5SL_first(fm->sel_chunks);
@@ -2031,16 +1990,16 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
} /* end if */
else {
/* Get bounding box for file selection */
- if(H5S_SELECT_BOUNDS(fm->file_space, file_sel_start, file_sel_end) < 0)
+ if (H5S_SELECT_BOUNDS(fm->file_space, file_sel_start, file_sel_end) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Get bounding box for memory selection */
- if(H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end) < 0)
+ if (H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Calculate the adjustment for memory selection from file selection */
HDassert(fm->m_ndims == fm->f_ndims);
- for(u = 0; u < fm->f_ndims; u++) {
+ for (u = 0; u < fm->f_ndims; u++) {
H5_CHECK_OVERFLOW(file_sel_start[u], hsize_t, hssize_t);
H5_CHECK_OVERFLOW(mem_sel_start[u], hsize_t, hssize_t);
adjust[u] = (hssize_t)file_sel_start[u] - (hssize_t)mem_sel_start[u];
@@ -2048,37 +2007,38 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
/* Iterate over each chunk in the chunk list */
curr_node = H5SL_first(fm->sel_chunks);
- while(curr_node) {
- hsize_t coords[H5S_MAX_RANK]; /* Current coordinates of chunk */
- hssize_t chunk_adjust[H5S_MAX_RANK]; /* Adjustment to make to a particular chunk */
- H5S_sel_type chunk_sel_type; /* Chunk's selection type */
+ while (curr_node) {
+ hsize_t coords[H5S_MAX_RANK]; /* Current coordinates of chunk */
+ hssize_t chunk_adjust[H5S_MAX_RANK]; /* Adjustment to make to a particular chunk */
+ H5S_sel_type chunk_sel_type; /* Chunk's selection type */
/* Get pointer to chunk's information */
chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node);
HDassert(chunk_info);
/* Compute the chunk coordinates from the scaled coordinates */
- for(u = 0; u < fm->f_ndims; u++)
+ for (u = 0; u < fm->f_ndims; u++)
coords[u] = chunk_info->scaled[u] * fm->layout->u.chunk.dim[u];
/* Copy the information */
/* Copy the memory dataspace */
- if((chunk_info->mspace = H5S_copy(fm->mem_space, TRUE, FALSE)) == NULL)
+ if ((chunk_info->mspace = H5S_copy(fm->mem_space, TRUE, FALSE)) == NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
/* Get the chunk's selection type */
- if((chunk_sel_type = H5S_GET_SELECT_TYPE(chunk_info->fspace)) < H5S_SEL_NONE)
+ if ((chunk_sel_type = H5S_GET_SELECT_TYPE(chunk_info->fspace)) < H5S_SEL_NONE)
HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to get type of selection")
/* Set memory selection for "all" chunk selections */
- if(H5S_SEL_ALL == chunk_sel_type) {
+ if (H5S_SEL_ALL == chunk_sel_type) {
/* Adjust the chunk coordinates */
- for(u = 0; u < fm->f_ndims; u++)
+ for (u = 0; u < fm->f_ndims; u++)
coords[u] = (hsize_t)((hssize_t)coords[u] - adjust[u]);
/* Set to same shape as chunk */
- if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, coords, NULL, fm->chunk_dim, NULL) < 0)
+ if (H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, coords, NULL, fm->chunk_dim,
+ NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection")
} /* end if */
else {
@@ -2086,31 +2046,30 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
HDassert(H5S_SEL_HYPERSLABS == chunk_sel_type);
/* Copy the file chunk's selection */
- if(H5S_SELECT_COPY(chunk_info->mspace, chunk_info->fspace, FALSE) < 0)
+ if (H5S_SELECT_COPY(chunk_info->mspace, chunk_info->fspace, FALSE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy selection")
/* Compute the adjustment for this chunk */
- for(u = 0; u < fm->f_ndims; u++) {
+ for (u = 0; u < fm->f_ndims; u++) {
/* Compensate for the chunk offset */
H5_CHECK_OVERFLOW(coords[u], hsize_t, hssize_t);
chunk_adjust[u] = adjust[u] - (hssize_t)coords[u];
} /* end for */
/* Adjust the selection */
- if(H5S_SELECT_ADJUST_S(chunk_info->mspace, chunk_adjust) < 0)
+ if (H5S_SELECT_ADJUST_S(chunk_info->mspace, chunk_adjust) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection")
} /* end else */
/* Get the next chunk node in the skip list */
curr_node = H5SL_next(curr_node);
} /* end while */
- } /* end else */
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_chunk_mem_map_hyper() */
-
/*-------------------------------------------------------------------------
* Function: H5D__create_mem_map_1d
*
@@ -2127,17 +2086,17 @@ done:
static herr_t
H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm)
{
- H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */
- H5SL_node_t *curr_node; /* Current node in skip list */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */
+ H5SL_node_t * curr_node; /* Current node in skip list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
- HDassert(fm->f_ndims>0);
+ HDassert(fm->f_ndims > 0);
/* Check for all I/O going to a single chunk */
- if(H5SL_count(fm->sel_chunks)==1) {
+ if (H5SL_count(fm->sel_chunks) == 1) {
/* Get the node */
curr_node = H5SL_first(fm->sel_chunks);
@@ -2153,31 +2112,32 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm)
chunk_info->mspace_shared = TRUE;
} /* end if */
else {
- hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
- hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
+ hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
+ hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
HDassert(fm->m_ndims == 1);
- if(H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end) < 0)
+ if (H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Iterate over each chunk in the chunk list */
curr_node = H5SL_first(fm->sel_chunks);
- while(curr_node) {
- hsize_t chunk_points; /* Number of elements in chunk selection */
- hsize_t tmp_count = 1;
+ while (curr_node) {
+ hsize_t chunk_points; /* Number of elements in chunk selection */
+ hsize_t tmp_count = 1;
/* Get pointer to chunk's information */
chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node);
HDassert(chunk_info);
/* Copy the memory dataspace */
- if((chunk_info->mspace = H5S_copy(fm->mem_space, TRUE, FALSE)) == NULL)
+ if ((chunk_info->mspace = H5S_copy(fm->mem_space, TRUE, FALSE)) == NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
chunk_points = H5S_GET_SELECT_NPOINTS(chunk_info->fspace);
- if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, mem_sel_start, NULL, &tmp_count, &chunk_points) < 0)
+ if (H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, mem_sel_start, NULL, &tmp_count,
+ &chunk_points) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection")
mem_sel_start[0] += chunk_points;
@@ -2185,13 +2145,12 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm)
/* Get the next chunk node in the skip list */
curr_node = H5SL_next(curr_node);
} /* end while */
- } /* end else */
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_chunk_mem_map_1d() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_file_cb
*
@@ -2206,24 +2165,26 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_file_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, unsigned ndims, const hsize_t *coords, void *_udata)
+H5D__chunk_file_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, unsigned ndims,
+ const hsize_t *coords, void *_udata)
{
- H5D_chunk_file_iter_ud_t *udata = (H5D_chunk_file_iter_ud_t *)_udata; /* User data for operation */
- H5D_chunk_map_t *fm = udata->fm; /* File<->memory chunk mapping info */
- H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */
- hsize_t coords_in_chunk[H5O_LAYOUT_NDIMS]; /* Coordinates of element in chunk */
- hsize_t chunk_index; /* Chunk index */
- hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chunk_file_iter_ud_t *udata = (H5D_chunk_file_iter_ud_t *)_udata; /* User data for operation */
+ H5D_chunk_map_t * fm = udata->fm; /* File<->memory chunk mapping info */
+ H5D_chunk_info_t * chunk_info; /* Chunk information for current chunk */
+ hsize_t coords_in_chunk[H5O_LAYOUT_NDIMS]; /* Coordinates of element in chunk */
+ hsize_t chunk_index; /* Chunk index */
+ hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Calculate the index of this chunk */
- chunk_index = H5VM_chunk_index_scaled(ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, scaled);
+ chunk_index = H5VM_chunk_index_scaled(ndims, coords, fm->layout->u.chunk.dim,
+ fm->layout->u.chunk.down_chunks, scaled);
/* Find correct chunk in file & memory skip list */
- if(chunk_index==fm->last_index) {
+ if (chunk_index == fm->last_index) {
/* If the chunk index is the same as the last chunk index we used,
* get the cached info to operate on.
*/
@@ -2234,37 +2195,37 @@ H5D__chunk_file_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type,
* find the chunk in the skip list.
*/
/* Get the chunk node from the skip list */
- if(NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_search(fm->sel_chunks, &chunk_index))) {
- H5S_t *fspace; /* Memory chunk's dataspace */
+ if (NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_search(fm->sel_chunks, &chunk_index))) {
+ H5S_t *fspace; /* Memory chunk's dataspace */
/* Allocate the file & memory chunk information */
- if (NULL==(chunk_info = H5FL_MALLOC (H5D_chunk_info_t)))
+ if (NULL == (chunk_info = H5FL_MALLOC(H5D_chunk_info_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info")
/* Initialize the chunk information */
/* Set the chunk index */
- chunk_info->index=chunk_index;
+ chunk_info->index = chunk_index;
/* Create a dataspace for the chunk */
- if((fspace = H5S_create_simple(fm->f_ndims,fm->chunk_dim,NULL))==NULL) {
+ if ((fspace = H5S_create_simple(fm->f_ndims, fm->chunk_dim, NULL)) == NULL) {
chunk_info = H5FL_FREE(H5D_chunk_info_t, chunk_info);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace for chunk")
} /* end if */
/* De-select the chunk space */
- if(H5S_select_none(fspace) < 0) {
+ if (H5S_select_none(fspace) < 0) {
(void)H5S_close(fspace);
chunk_info = H5FL_FREE(H5D_chunk_info_t, chunk_info);
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to de-select dataspace")
} /* end if */
/* Set the file chunk dataspace */
- chunk_info->fspace = fspace;
+ chunk_info->fspace = fspace;
chunk_info->fspace_shared = FALSE;
/* Set the memory chunk dataspace */
- chunk_info->mspace = NULL;
+ chunk_info->mspace = NULL;
chunk_info->mspace_shared = FALSE;
/* Set the number of selected elements in chunk to zero */
@@ -2276,29 +2237,29 @@ H5D__chunk_file_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type,
H5MM_memcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims);
/* Insert the new chunk into the skip list */
- if(H5SL_insert(fm->sel_chunks,chunk_info,&chunk_info->index) < 0) {
- H5D__free_chunk_info(chunk_info,NULL,NULL);
- HGOTO_ERROR(H5E_DATASPACE,H5E_CANTINSERT,FAIL,"can't insert chunk into skip list")
+ if (H5SL_insert(fm->sel_chunks, chunk_info, &chunk_info->index) < 0) {
+ H5D__free_chunk_info(chunk_info, NULL, NULL);
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert chunk into skip list")
} /* end if */
- } /* end if */
+ } /* end if */
#ifdef H5_HAVE_PARALLEL
/* Store chunk selection information, for collective multi-chunk I/O */
- if(udata->io_info->using_mpi_vfd)
+ if (udata->io_info->using_mpi_vfd)
fm->select_chunk[chunk_index] = chunk_info;
#endif /* H5_HAVE_PARALLEL */
/* Update the "last chunk seen" information */
- fm->last_index = chunk_index;
+ fm->last_index = chunk_index;
fm->last_chunk_info = chunk_info;
} /* end else */
/* Get the offset of the element within the chunk */
- for(u = 0; u < fm->f_ndims; u++)
+ for (u = 0; u < fm->f_ndims; u++)
coords_in_chunk[u] = coords[u] - (scaled[u] * fm->layout->u.chunk.dim[u]);
/* Add point to file selection for chunk */
- if(H5S_select_elements(chunk_info->fspace, H5S_SELECT_APPEND, (size_t)1, coords_in_chunk) < 0)
+ if (H5S_select_elements(chunk_info->fspace, H5S_SELECT_APPEND, (size_t)1, coords_in_chunk) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
/* Increment the number of elemented selected in chunk */
@@ -2308,7 +2269,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_file_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_mem_cb
*
@@ -2323,13 +2283,14 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, unsigned ndims, const hsize_t *coords, void *_fm)
+H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, unsigned ndims,
+ const hsize_t *coords, void *_fm)
{
- H5D_chunk_map_t *fm = (H5D_chunk_map_t *)_fm; /* File<->memory chunk mapping info */
- H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */
- hsize_t coords_in_mem[H5S_MAX_RANK]; /* Coordinates of element in memory */
- hsize_t chunk_index; /* Chunk index */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chunk_map_t * fm = (H5D_chunk_map_t *)_fm; /* File<->memory chunk mapping info */
+ H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */
+ hsize_t coords_in_mem[H5S_MAX_RANK]; /* Coordinates of element in memory */
+ hsize_t chunk_index; /* Chunk index */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2337,7 +2298,7 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u
chunk_index = H5VM_chunk_index(ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks);
/* Find correct chunk in file & memory skip list */
- if(chunk_index == fm->last_index) {
+ if (chunk_index == fm->last_index) {
/* If the chunk index is the same as the last chunk index we used,
* get the cached spaces to operate on.
*/
@@ -2348,43 +2309,42 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u
* find the chunk in the skip list.
*/
/* Get the chunk node from the skip list */
- if(NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_search(fm->sel_chunks, &chunk_index)))
+ if (NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_search(fm->sel_chunks, &chunk_index)))
HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, H5_ITER_ERROR, "can't locate chunk in skip list")
/* Check if the chunk already has a memory space */
- if(NULL == chunk_info->mspace)
+ if (NULL == chunk_info->mspace)
/* Copy the template memory chunk dataspace */
- if(NULL == (chunk_info->mspace = H5S_copy(fm->mchunk_tmpl, FALSE, FALSE)))
+ if (NULL == (chunk_info->mspace = H5S_copy(fm->mchunk_tmpl, FALSE, FALSE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy file space")
/* Update the "last chunk seen" information */
- fm->last_index = chunk_index;
+ fm->last_index = chunk_index;
fm->last_chunk_info = chunk_info;
} /* end else */
/* Get coordinates of selection iterator for memory */
- if(H5S_SELECT_ITER_COORDS(&fm->mem_iter, coords_in_mem) < 0)
+ if (H5S_SELECT_ITER_COORDS(&fm->mem_iter, coords_in_mem) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, H5_ITER_ERROR, "unable to get iterator coordinates")
/* Add point to memory selection for chunk */
- if(fm->msel_type == H5S_SEL_POINTS) {
- if(H5S_select_elements(chunk_info->mspace, H5S_SELECT_APPEND, (size_t)1, coords_in_mem) < 0)
+ if (fm->msel_type == H5S_SEL_POINTS) {
+ if (H5S_select_elements(chunk_info->mspace, H5S_SELECT_APPEND, (size_t)1, coords_in_mem) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, H5_ITER_ERROR, "unable to select element")
} /* end if */
else {
- if(H5S_hyper_add_span_element(chunk_info->mspace, fm->m_ndims, coords_in_mem) < 0)
+ if (H5S_hyper_add_span_element(chunk_info->mspace, fm->m_ndims, coords_in_mem) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, H5_ITER_ERROR, "unable to select element")
} /* end else */
/* Move memory selection iterator to next element in selection */
- if(H5S_SELECT_ITER_NEXT(&fm->mem_iter, (size_t)1) < 0)
+ if (H5S_SELECT_ITER_NEXT(&fm->mem_iter, (size_t)1) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, H5_ITER_ERROR, "unable to move to next iterator location")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_mem_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_cacheable
*
@@ -2401,9 +2361,9 @@ done:
htri_t
H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_op)
{
- const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */
- hbool_t has_filters = FALSE; /* Whether there are filters on the chunk or not */
- htri_t ret_value = FAIL; /* Return value */
+ const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */
+ hbool_t has_filters = FALSE; /* Whether there are filters on the chunk or not */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2414,29 +2374,26 @@ H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_
/* Must bring the whole chunk in if there are any filters on the chunk.
* Make sure to check if filters are on the dataset but disabled for the
* chunk because it is a partial edge chunk. */
- if(dataset->shared->dcpl_cache.pline.nused > 0) {
- if(dataset->shared->layout.u.chunk.flags
- & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) {
+ if (dataset->shared->dcpl_cache.pline.nused > 0) {
+ if (dataset->shared->layout.u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) {
has_filters = !H5D__chunk_is_partial_edge_chunk(
- io_info->dset->shared->ndims,
- io_info->dset->shared->layout.u.chunk.dim,
- io_info->store->chunk.scaled,
- io_info->dset->shared->curr_dims);
+ io_info->dset->shared->ndims, io_info->dset->shared->layout.u.chunk.dim,
+ io_info->store->chunk.scaled, io_info->dset->shared->curr_dims);
} /* end if */
else
has_filters = TRUE;
} /* end if */
- if(has_filters)
+ if (has_filters)
ret_value = TRUE;
else {
#ifdef H5_HAVE_PARALLEL
- /* If MPI based VFD is used and the file is opened for write access, must
- * bypass the chunk-cache scheme because other MPI processes could
- * be writing to other elements in the same chunk. Do a direct
- * write-through of only the elements requested.
- */
- if(io_info->using_mpi_vfd && (H5F_ACC_RDWR & H5F_INTENT(dataset->oloc.file)))
+ /* If MPI based VFD is used and the file is opened for write access, must
+ * bypass the chunk-cache scheme because other MPI processes could
+ * be writing to other elements in the same chunk. Do a direct
+ * write-through of only the elements requested.
+ */
+ if (io_info->using_mpi_vfd && (H5F_ACC_RDWR & H5F_INTENT(dataset->oloc.file)))
ret_value = FALSE;
else {
#endif /* H5_HAVE_PARALLEL */
@@ -2445,38 +2402,39 @@ H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_
* cache, just write the data to it directly.
*/
H5_CHECK_OVERFLOW(dataset->shared->layout.u.chunk.size, uint32_t, size_t);
- if((size_t)dataset->shared->layout.u.chunk.size > dataset->shared->cache.chunk.nbytes_max) {
- if(write_op && !H5F_addr_defined(caddr)) {
+ if ((size_t)dataset->shared->layout.u.chunk.size > dataset->shared->cache.chunk.nbytes_max) {
+ if (write_op && !H5F_addr_defined(caddr)) {
const H5O_fill_t *fill = &(dataset->shared->dcpl_cache.fill); /* Fill value info */
- H5D_fill_value_t fill_status; /* Fill value status */
+ H5D_fill_value_t fill_status; /* Fill value status */
/* Revtrieve the fill value status */
- if(H5P_is_fill_value_defined(fill, &fill_status) < 0)
+ if (H5P_is_fill_value_defined(fill, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
/* If the fill value needs to be written then we will need
* to use the cache to write the fill value */
- if(fill->fill_time == H5D_FILL_TIME_ALLOC ||
- (fill->fill_time == H5D_FILL_TIME_IFSET &&
- (fill_status == H5D_FILL_VALUE_USER_DEFINED ||
- fill_status == H5D_FILL_VALUE_DEFAULT)))
+ if (fill->fill_time == H5D_FILL_TIME_ALLOC ||
+ (fill->fill_time == H5D_FILL_TIME_IFSET &&
+ (fill_status == H5D_FILL_VALUE_USER_DEFINED ||
+ fill_status == H5D_FILL_VALUE_DEFAULT)))
ret_value = TRUE;
else
ret_value = FALSE;
- } else
+ }
+ else
ret_value = FALSE;
- } else
+ }
+ else
ret_value = TRUE;
#ifdef H5_HAVE_PARALLEL
} /* end else */
-#endif /* H5_HAVE_PARALLEL */
- } /* end else */
+#endif /* H5_HAVE_PARALLEL */
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_cacheable() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_read
*
@@ -2490,20 +2448,20 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space, const H5S_t H5_ATTR_UNUSED *mem_space,
- H5D_chunk_map_t *fm)
+H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t H5_ATTR_UNUSED nelmts,
+ const H5S_t H5_ATTR_UNUSED *file_space, const H5S_t H5_ATTR_UNUSED *mem_space,
+ H5D_chunk_map_t *fm)
{
- H5SL_node_t *chunk_node; /* Current node in chunk skip list */
- H5D_io_info_t nonexistent_io_info; /* "nonexistent" I/O info object */
- H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */
- H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */
- H5D_io_info_t cpt_io_info; /* Compact I/O info object */
- H5D_storage_t cpt_store; /* Chunk storage information as compact dataset */
- hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */
- uint32_t src_accessed_bytes = 0; /* Total accessed size in a chunk */
- hbool_t skip_missing_chunks = FALSE; /* Whether to skip missing chunks */
- herr_t ret_value = SUCCEED; /*return value */
+ H5SL_node_t * chunk_node; /* Current node in chunk skip list */
+ H5D_io_info_t nonexistent_io_info; /* "nonexistent" I/O info object */
+ H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */
+ H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */
+ H5D_io_info_t cpt_io_info; /* Compact I/O info object */
+ H5D_storage_t cpt_store; /* Chunk storage information as compact dataset */
+ hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */
+ uint32_t src_accessed_bytes = 0; /* Total accessed size in a chunk */
+ hbool_t skip_missing_chunks = FALSE; /* Whether to skip missing chunks */
+ herr_t ret_value = SUCCEED; /*return value */
FUNC_ENTER_STATIC
@@ -2519,69 +2477,69 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
/* Set up contiguous I/O info object */
H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
- ctg_io_info.store = &ctg_store;
+ ctg_io_info.store = &ctg_store;
ctg_io_info.layout_ops = *H5D_LOPS_CONTIG;
/* Initialize temporary contiguous storage info */
- H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, io_info->dset->shared->layout.u.chunk.size, uint32_t);
+ H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, io_info->dset->shared->layout.u.chunk.size,
+ uint32_t);
/* Set up compact I/O info object */
H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info));
- cpt_io_info.store = &cpt_store;
+ cpt_io_info.store = &cpt_store;
cpt_io_info.layout_ops = *H5D_LOPS_COMPACT;
/* Initialize temporary compact storage info */
cpt_store.compact.dirty = &cpt_dirty;
{
- const H5O_fill_t *fill = &(io_info->dset->shared->dcpl_cache.fill); /* Fill value info */
- H5D_fill_value_t fill_status; /* Fill value status */
+ const H5O_fill_t *fill = &(io_info->dset->shared->dcpl_cache.fill); /* Fill value info */
+ H5D_fill_value_t fill_status; /* Fill value status */
/* Check the fill value status */
- if(H5P_is_fill_value_defined(fill, &fill_status) < 0)
+ if (H5P_is_fill_value_defined(fill, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
/* If we are never to return fill values, or if we would return them
* but they aren't set, set the flag to skip missing chunks.
*/
- if(fill->fill_time == H5D_FILL_TIME_NEVER ||
- (fill->fill_time == H5D_FILL_TIME_IFSET &&
- fill_status != H5D_FILL_VALUE_USER_DEFINED &&
- fill_status != H5D_FILL_VALUE_DEFAULT))
+ if (fill->fill_time == H5D_FILL_TIME_NEVER ||
+ (fill->fill_time == H5D_FILL_TIME_IFSET && fill_status != H5D_FILL_VALUE_USER_DEFINED &&
+ fill_status != H5D_FILL_VALUE_DEFAULT))
skip_missing_chunks = TRUE;
}
/* Iterate through nodes in chunk skip list */
chunk_node = H5D_CHUNK_GET_FIRST_NODE(fm);
- while(chunk_node) {
- H5D_chunk_info_t *chunk_info; /* Chunk information */
- H5D_chunk_ud_t udata; /* Chunk index pass-through */
+ while (chunk_node) {
+ H5D_chunk_info_t *chunk_info; /* Chunk information */
+ H5D_chunk_ud_t udata; /* Chunk index pass-through */
/* Get the actual chunk information from the skip list node */
chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node);
/* Get the info for the chunk in the file */
- if(H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0)
+ if (H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
/* Sanity check */
HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) ||
- (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0));
+ (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0));
/* Check for non-existant chunk & skip it if appropriate */
- if(H5F_addr_defined(udata.chunk_block.offset) || UINT_MAX != udata.idx_hint
- || !skip_missing_chunks) {
- H5D_io_info_t *chk_io_info; /* Pointer to I/O info object for this chunk */
- void *chunk = NULL; /* Pointer to locked chunk buffer */
- htri_t cacheable; /* Whether the chunk is cacheable */
+ if (H5F_addr_defined(udata.chunk_block.offset) || UINT_MAX != udata.idx_hint ||
+ !skip_missing_chunks) {
+ H5D_io_info_t *chk_io_info; /* Pointer to I/O info object for this chunk */
+ void * chunk = NULL; /* Pointer to locked chunk buffer */
+ htri_t cacheable; /* Whether the chunk is cacheable */
/* Set chunk's [scaled] coordinates */
io_info->store->chunk.scaled = chunk_info->scaled;
/* Determine if we should use the chunk cache */
- if((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, FALSE)) < 0)
+ if ((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable")
- if(cacheable) {
+ if (cacheable) {
/* Load the chunk into cache and lock it. */
/* Compute # of bytes accessed in chunk */
@@ -2589,7 +2547,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
src_accessed_bytes = chunk_info->chunk_points * (uint32_t)type_info->src_type_size;
/* Lock the chunk into the cache */
- if(NULL == (chunk = H5D__chunk_lock(io_info, &udata, FALSE, FALSE)))
+ if (NULL == (chunk = H5D__chunk_lock(io_info, &udata, FALSE, FALSE)))
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk")
/* Set up the storage buffer information for this chunk */
@@ -2598,7 +2556,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
/* Point I/O info at contiguous I/O info for this chunk */
chk_io_info = &cpt_io_info;
} /* end if */
- else if(H5F_addr_defined(udata.chunk_block.offset)) {
+ else if (H5F_addr_defined(udata.chunk_block.offset)) {
/* Set up the storage address information for this chunk */
ctg_store.contig.dset_addr = udata.chunk_block.offset;
@@ -2611,12 +2569,12 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
} /* end else */
/* Perform the actual read operation */
- if((io_info->io_ops.single_read)(chk_io_info, type_info,
- (hsize_t)chunk_info->chunk_points, chunk_info->fspace, chunk_info->mspace) < 0)
+ if ((io_info->io_ops.single_read)(chk_io_info, type_info, (hsize_t)chunk_info->chunk_points,
+ chunk_info->fspace, chunk_info->mspace) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked read failed")
/* Release the cache lock on the chunk. */
- if(chunk && H5D__chunk_unlock(io_info, &udata, FALSE, chunk, src_accessed_bytes) < 0)
+ if (chunk && H5D__chunk_unlock(io_info, &udata, FALSE, chunk, src_accessed_bytes) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk")
} /* end if */
@@ -2628,7 +2586,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_read() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_write
*
@@ -2642,18 +2599,18 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space, const H5S_t H5_ATTR_UNUSED *mem_space,
- H5D_chunk_map_t *fm)
+H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t H5_ATTR_UNUSED nelmts,
+ const H5S_t H5_ATTR_UNUSED *file_space, const H5S_t H5_ATTR_UNUSED *mem_space,
+ H5D_chunk_map_t *fm)
{
- H5SL_node_t *chunk_node; /* Current node in chunk skip list */
- H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */
- H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */
- H5D_io_info_t cpt_io_info; /* Compact I/O info object */
- H5D_storage_t cpt_store; /* Chunk storage information as compact dataset */
- hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */
- uint32_t dst_accessed_bytes = 0; /* Total accessed size in a chunk */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5SL_node_t * chunk_node; /* Current node in chunk skip list */
+ H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */
+ H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */
+ H5D_io_info_t cpt_io_info; /* Compact I/O info object */
+ H5D_storage_t cpt_store; /* Chunk storage information as compact dataset */
+ hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */
+ uint32_t dst_accessed_bytes = 0; /* Total accessed size in a chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2665,15 +2622,16 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
/* Set up contiguous I/O info object */
H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
- ctg_io_info.store = &ctg_store;
+ ctg_io_info.store = &ctg_store;
ctg_io_info.layout_ops = *H5D_LOPS_CONTIG;
/* Initialize temporary contiguous storage info */
- H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, io_info->dset->shared->layout.u.chunk.size, uint32_t);
+ H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, io_info->dset->shared->layout.u.chunk.size,
+ uint32_t);
/* Set up compact I/O info object */
H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info));
- cpt_io_info.store = &cpt_store;
+ cpt_io_info.store = &cpt_store;
cpt_io_info.layout_ops = *H5D_LOPS_COMPACT;
/* Initialize temporary compact storage info */
@@ -2681,49 +2639,49 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
/* Iterate through nodes in chunk skip list */
chunk_node = H5D_CHUNK_GET_FIRST_NODE(fm);
- while(chunk_node) {
- H5D_chunk_info_t *chunk_info; /* Chunk information */
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5D_io_info_t *chk_io_info; /* Pointer to I/O info object for this chunk */
- void *chunk; /* Pointer to locked chunk buffer */
- H5D_chunk_ud_t udata; /* Index pass-through */
- htri_t cacheable; /* Whether the chunk is cacheable */
- hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
+ while (chunk_node) {
+ H5D_chunk_info_t * chunk_info; /* Chunk information */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ H5D_io_info_t * chk_io_info; /* Pointer to I/O info object for this chunk */
+ void * chunk; /* Pointer to locked chunk buffer */
+ H5D_chunk_ud_t udata; /* Index pass-through */
+ htri_t cacheable; /* Whether the chunk is cacheable */
+ hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
/* Get the actual chunk information from the skip list node */
chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node);
/* Look up the chunk */
- if(H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0)
+ if (H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
/* Sanity check */
HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) ||
- (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0));
+ (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0));
- /* Set chunk's [scaled] coordinates */
- io_info->store->chunk.scaled = chunk_info->scaled;
+ /* Set chunk's [scaled] coordinates */
+ io_info->store->chunk.scaled = chunk_info->scaled;
/* Determine if we should use the chunk cache */
- if((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, TRUE)) < 0)
+ if ((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable")
- if(cacheable) {
+ if (cacheable) {
/* Load the chunk into cache. But if the whole chunk is written,
* simply allocate space instead of load the chunk. */
- hbool_t entire_chunk = TRUE; /* Whether whole chunk is selected */
+ hbool_t entire_chunk = TRUE; /* Whether whole chunk is selected */
/* Compute # of bytes accessed in chunk */
H5_CHECK_OVERFLOW(type_info->dst_type_size, /*From:*/ size_t, /*To:*/ uint32_t);
dst_accessed_bytes = chunk_info->chunk_points * (uint32_t)type_info->dst_type_size;
/* Determine if we will access all the data in the chunk */
- if(dst_accessed_bytes != ctg_store.contig.dset_size ||
- (chunk_info->chunk_points * type_info->src_type_size) != ctg_store.contig.dset_size ||
- fm->fsel_type == H5S_SEL_POINTS)
+ if (dst_accessed_bytes != ctg_store.contig.dset_size ||
+ (chunk_info->chunk_points * type_info->src_type_size) != ctg_store.contig.dset_size ||
+ fm->fsel_type == H5S_SEL_POINTS)
entire_chunk = FALSE;
/* Lock the chunk into the cache */
- if(NULL == (chunk = H5D__chunk_lock(io_info, &udata, entire_chunk, FALSE)))
+ if (NULL == (chunk = H5D__chunk_lock(io_info, &udata, entire_chunk, FALSE)))
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk")
/* Set up the storage buffer information for this chunk */
@@ -2734,22 +2692,24 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
} /* end if */
else {
/* If the chunk hasn't been allocated on disk, do so now. */
- if(!H5F_addr_defined(udata.chunk_block.offset)) {
+ if (!H5F_addr_defined(udata.chunk_block.offset)) {
/* Compose chunked index info struct */
- idx_info.f = io_info->dset->oloc.file;
- idx_info.pline = &(io_info->dset->shared->dcpl_cache.pline);
- idx_info.layout = &(io_info->dset->shared->layout.u.chunk);
+ idx_info.f = io_info->dset->oloc.file;
+ idx_info.pline = &(io_info->dset->shared->dcpl_cache.pline);
+ idx_info.layout = &(io_info->dset->shared->layout.u.chunk);
idx_info.storage = &(io_info->dset->shared->layout.storage.u.chunk);
/* Set up the size of chunk for user data */
udata.chunk_block.length = io_info->dset->shared->layout.u.chunk.size;
/* Allocate the chunk */
- if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, chunk_info->scaled) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level")
+ if (H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert,
+ chunk_info->scaled) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL,
+ "unable to insert/resize chunk on chunk level")
/* Make sure the address of the chunk is returned. */
- if(!H5F_addr_defined(udata.chunk_block.offset))
+ if (!H5F_addr_defined(udata.chunk_block.offset))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined")
/* Cache the new chunk information */
@@ -2767,20 +2727,20 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
} /* end else */
/* Perform the actual write operation */
- if((io_info->io_ops.single_write)(chk_io_info, type_info,
- (hsize_t)chunk_info->chunk_points, chunk_info->fspace, chunk_info->mspace) < 0)
+ if ((io_info->io_ops.single_write)(chk_io_info, type_info, (hsize_t)chunk_info->chunk_points,
+ chunk_info->fspace, chunk_info->mspace) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked write failed")
- /* Release the cache lock on the chunk, or insert chunk into index. */
- if(chunk) {
- if(H5D__chunk_unlock(io_info, &udata, TRUE, chunk, dst_accessed_bytes) < 0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk")
- } /* end if */
- else {
- if(need_insert && io_info->dset->shared->layout.storage.u.chunk.ops->insert)
- if((io_info->dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata, NULL) < 0)
+ /* Release the cache lock on the chunk, or insert chunk into index. */
+ if (chunk) {
+ if (H5D__chunk_unlock(io_info, &udata, TRUE, chunk, dst_accessed_bytes) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk")
+ } /* end if */
+ else {
+ if (need_insert && io_info->dset->shared->layout.storage.u.chunk.ops->insert)
+ if ((io_info->dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index")
- } /* end else */
+ } /* end else */
/* Advance to next chunk in list */
chunk_node = H5D_CHUNK_GET_NEXT_NODE(fm, chunk_node);
@@ -2790,7 +2750,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_write() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_flush
*
@@ -2807,10 +2766,10 @@ done:
static herr_t
H5D__chunk_flush(H5D_t *dset)
{
- H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
- H5D_rdcc_ent_t *ent, *next;
- unsigned nerrors = 0; /* Count of any errors encountered when flushing chunks */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_rdcc_t * rdcc = &(dset->shared->cache.chunk);
+ H5D_rdcc_ent_t *ent, *next;
+ unsigned nerrors = 0; /* Count of any errors encountered when flushing chunks */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2818,19 +2777,18 @@ H5D__chunk_flush(H5D_t *dset)
HDassert(dset);
/* Loop over all entries in the chunk cache */
- for(ent = rdcc->head; ent; ent = next) {
+ for (ent = rdcc->head; ent; ent = next) {
next = ent->next;
- if(H5D__chunk_flush_entry(dset, ent, FALSE) < 0)
+ if (H5D__chunk_flush_entry(dset, ent, FALSE) < 0)
nerrors++;
} /* end for */
- if(nerrors)
+ if (nerrors)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_flush() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_io_term
*
@@ -2846,12 +2804,12 @@ done:
static herr_t
H5D__chunk_io_term(const H5D_chunk_map_t *fm)
{
- herr_t ret_value = SUCCEED; /*return value */
+ herr_t ret_value = SUCCEED; /*return value */
FUNC_ENTER_STATIC
/* Single element I/O vs. multiple element I/O cleanup */
- if(fm->use_single) {
+ if (fm->use_single) {
/* Sanity checks */
HDassert(fm->sel_chunks == NULL);
HDassert(fm->single_chunk_info);
@@ -2863,17 +2821,17 @@ H5D__chunk_io_term(const H5D_chunk_map_t *fm)
} /* end if */
else {
/* Release the nodes on the list of selected chunks */
- if(fm->sel_chunks)
- if(H5SL_free(fm->sel_chunks, H5D__free_chunk_info, NULL) < 0)
+ if (fm->sel_chunks)
+ if (H5SL_free(fm->sel_chunks, H5D__free_chunk_info, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTNEXT, FAIL, "can't iterate over chunks")
} /* end else */
/* Free the memory chunk dataspace template */
- if(fm->mchunk_tmpl)
- if(H5S_close(fm->mchunk_tmpl) < 0)
+ if (fm->mchunk_tmpl)
+ if (H5S_close(fm->mchunk_tmpl) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template")
#ifdef H5_HAVE_PARALLEL
- if(fm->select_chunk)
+ if (fm->select_chunk)
H5MM_xfree(fm->select_chunk);
#endif /* H5_HAVE_PARALLEL */
@@ -2881,7 +2839,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_io_term() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_dest
*
@@ -2898,12 +2855,12 @@ done:
static herr_t
H5D__chunk_dest(H5D_t *dset)
{
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Dataset's chunk cache */
- H5D_rdcc_ent_t *ent = NULL, *next = NULL; /* Pointer to current & next cache entries */
- int nerrors = 0; /* Accumulated count of errors */
- H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ H5D_rdcc_t * rdcc = &(dset->shared->cache.chunk); /* Dataset's chunk cache */
+ H5D_rdcc_ent_t * ent = NULL, *next = NULL; /* Pointer to current & next cache entries */
+ int nerrors = 0; /* Accumulated count of errors */
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_TAG(dset->oloc.addr)
@@ -2912,36 +2869,35 @@ H5D__chunk_dest(H5D_t *dset)
H5D_CHUNK_STORAGE_INDEX_CHK(sc);
/* Flush all the cached chunks */
- for(ent = rdcc->head; ent; ent = next) {
+ for (ent = rdcc->head; ent; ent = next) {
next = ent->next;
- if(H5D__chunk_cache_evict(dset, ent, TRUE) < 0)
+ if (H5D__chunk_cache_evict(dset, ent, TRUE) < 0)
nerrors++;
} /* end for */
/* Continue even if there are failures. */
- if(nerrors)
+ if (nerrors)
HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
/* Release cache structures */
- if(rdcc->slot)
+ if (rdcc->slot)
rdcc->slot = H5FL_SEQ_FREE(H5D_rdcc_ent_ptr_t, rdcc->slot);
HDmemset(rdcc, 0, sizeof(H5D_rdcc_t));
/* Compose chunked index info struct */
- idx_info.f = dset->oloc.file;
- idx_info.pline = &dset->shared->dcpl_cache.pline;
- idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
idx_info.storage = sc;
/* Free any index structures */
- if(sc->ops->dest && (sc->ops->dest)(&idx_info) < 0)
+ if (sc->ops->dest && (sc->ops->dest)(&idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info")
done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__chunk_dest() */
-
/*-------------------------------------------------------------------------
* Function: H5D_chunk_idx_reset
*
@@ -2957,7 +2913,7 @@ done:
herr_t
H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2967,14 +2923,13 @@ H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
H5D_CHUNK_STORAGE_INDEX_CHK(storage);
/* Reset index structures */
- if((storage->ops->reset)(storage, reset_addr) < 0)
+ if ((storage->ops->reset)(storage, reset_addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset chunk index info")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_chunk_idx_reset() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_cinfo_cache_reset
*
@@ -3001,7 +2956,6 @@ H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__chunk_cinfo_cache_reset() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_cinfo_cache_update
*
@@ -3029,7 +2983,7 @@ H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *ud
H5MM_memcpy(last->scaled, udata->common.scaled, sizeof(hsize_t) * udata->common.layout->ndims);
last->addr = udata->chunk_block.offset;
H5_CHECKED_ASSIGN(last->nbytes, uint32_t, udata->chunk_block.length, hsize_t);
- last->chunk_idx = udata->chunk_idx;
+ last->chunk_idx = udata->chunk_idx;
last->filter_mask = udata->filter_mask;
/* Indicate that the cached info is valid */
@@ -3038,7 +2992,6 @@ H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *ud
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__chunk_cinfo_cache_update() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_cinfo_cache_found
*
@@ -3054,7 +3007,7 @@ H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *ud
static hbool_t
H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *udata)
{
- hbool_t ret_value = FALSE; /* Return value */
+ hbool_t ret_value = FALSE; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -3065,19 +3018,19 @@ H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *uda
HDassert(udata->common.scaled);
/* Check if the cached information is what is desired */
- if(last->valid) {
- unsigned u; /* Local index variable */
+ if (last->valid) {
+ unsigned u; /* Local index variable */
/* Check that the scaled offset is the same */
- for(u = 0; u < udata->common.layout->ndims; u++)
- if(last->scaled[u] != udata->common.scaled[u])
+ for (u = 0; u < udata->common.layout->ndims; u++)
+ if (last->scaled[u] != udata->common.scaled[u])
HGOTO_DONE(FALSE)
/* Retrieve the information from the cache */
udata->chunk_block.offset = last->addr;
udata->chunk_block.length = last->nbytes;
- udata->chunk_idx = last->chunk_idx;
- udata->filter_mask = last->filter_mask;
+ udata->chunk_idx = last->chunk_idx;
+ udata->filter_mask = last->filter_mask;
/* Indicate that the data was found */
HGOTO_DONE(TRUE)
@@ -3087,7 +3040,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_cinfo_cache_found() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_create
*
@@ -3106,42 +3058,42 @@ done:
herr_t
H5D__chunk_create(const H5D_t *dset /*in,out*/)
{
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Check args */
HDassert(dset);
HDassert(H5D_CHUNKED == dset->shared->layout.type);
- HDassert(dset->shared->layout.u.chunk.ndims > 0 && dset->shared->layout.u.chunk.ndims <= H5O_LAYOUT_NDIMS);
+ HDassert(dset->shared->layout.u.chunk.ndims > 0 &&
+ dset->shared->layout.u.chunk.ndims <= H5O_LAYOUT_NDIMS);
H5D_CHUNK_STORAGE_INDEX_CHK(sc);
#ifndef NDEBUG
-{
- unsigned u; /* Local index variable */
+ {
+ unsigned u; /* Local index variable */
- for(u = 0; u < dset->shared->layout.u.chunk.ndims; u++)
- HDassert(dset->shared->layout.u.chunk.dim[u] > 0);
-}
+ for (u = 0; u < dset->shared->layout.u.chunk.ndims; u++)
+ HDassert(dset->shared->layout.u.chunk.dim[u] > 0);
+ }
#endif
/* Compose chunked index info struct */
- idx_info.f = dset->oloc.file;
- idx_info.pline = &dset->shared->dcpl_cache.pline;
- idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
idx_info.storage = sc;
/* Create the index for the chunks */
- if((sc->ops->create)(&idx_info) < 0)
+ if ((sc->ops->create)(&idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_create() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_hash_val
*
@@ -3157,10 +3109,10 @@ done:
static unsigned
H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled)
{
- hsize_t val; /* Intermediate value */
- unsigned ndims = shared->ndims; /* Rank of dataset */
- unsigned ret = 0; /* Value to return */
- unsigned u; /* Local index variable */
+ hsize_t val; /* Intermediate value */
+ unsigned ndims = shared->ndims; /* Rank of dataset */
+ unsigned ret = 0; /* Value to return */
+ unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
@@ -3172,7 +3124,7 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled)
* other dimensions too
*/
val = scaled[0];
- for(u = 1; u < ndims; u++) {
+ for (u = 1; u < ndims; u++) {
val <<= shared->cache.chunk.scaled_encode_bits[u];
val ^= scaled[u];
} /* end for */
@@ -3183,7 +3135,6 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled)
FUNC_LEAVE_NOAPI(ret)
} /* H5D__chunk_hash_val() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_lookup
*
@@ -3198,14 +3149,13 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled)
*-------------------------------------------------------------------------
*/
herr_t
-H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled,
- H5D_chunk_ud_t *udata)
+H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udata)
{
- H5D_rdcc_ent_t *ent = NULL; /* Cache entry */
- H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
- unsigned idx; /* Index of chunk in cache, if present */
- hbool_t found = FALSE; /* In cache? */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_rdcc_ent_t * ent = NULL; /* Cache entry */
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
+ unsigned idx; /* Index of chunk in cache, if present */
+ hbool_t found = FALSE; /* In cache? */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -3217,43 +3167,44 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled,
HDassert(udata);
/* Initialize the query information about the chunk we are looking for */
- udata->common.layout = &(dset->shared->layout.u.chunk);
+ udata->common.layout = &(dset->shared->layout.u.chunk);
udata->common.storage = sc;
- udata->common.scaled = scaled;
+ udata->common.scaled = scaled;
/* Reset information about the chunk we are looking for */
udata->chunk_block.offset = HADDR_UNDEF;
udata->chunk_block.length = 0;
- udata->filter_mask = 0;
- udata->new_unfilt_chunk = FALSE;
+ udata->filter_mask = 0;
+ udata->new_unfilt_chunk = FALSE;
/* Check for chunk in cache */
- if(dset->shared->cache.chunk.nslots > 0) {
+ if (dset->shared->cache.chunk.nslots > 0) {
/* Determine the chunk's location in the hash table */
idx = H5D__chunk_hash_val(dset->shared, scaled);
/* Get the chunk cache entry for that location */
ent = dset->shared->cache.chunk.slot[idx];
- if(ent) {
- unsigned u; /* Counter */
+ if (ent) {
+ unsigned u; /* Counter */
/* Speculatively set the 'found' flag */
found = TRUE;
/* Verify that the cache entry is the correct chunk */
- for(u = 0; u < dset->shared->ndims; u++)
- if(scaled[u] != ent->scaled[u]) {
+ for (u = 0; u < dset->shared->ndims; u++)
+ if (scaled[u] != ent->scaled[u]) {
found = FALSE;
break;
} /* end if */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
/* Retrieve chunk addr */
- if(found) {
- udata->idx_hint = idx;
+ if (found) {
+ udata->idx_hint = idx;
udata->chunk_block.offset = ent->chunk_block.offset;
- udata->chunk_block.length = ent->chunk_block.length;;
+ udata->chunk_block.length = ent->chunk_block.length;
+ ;
udata->chunk_idx = ent->chunk_idx;
} /* end if */
else {
@@ -3261,13 +3212,13 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled,
udata->idx_hint = UINT_MAX;
/* Check for cached information */
- if(!H5D__chunk_cinfo_cache_found(&dset->shared->cache.chunk.last, udata)) {
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ if (!H5D__chunk_cinfo_cache_found(&dset->shared->cache.chunk.last, udata)) {
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
/* Compose chunked index info struct */
- idx_info.f = dset->oloc.file;
- idx_info.pline = &dset->shared->dcpl_cache.pline;
- idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
idx_info.storage = sc;
#ifdef H5_HAVE_PARALLEL
@@ -3275,57 +3226,53 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled,
* highly unlikely that users would read the same chunks from all
* processes.
*/
- if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI))
+ if (H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI))
H5CX_set_coll_metadata_read(FALSE);
#endif /* H5_HAVE_PARALLEL */
/* Go get the chunk information */
- if((sc->ops->get_addr)(&idx_info, udata) < 0)
+ if ((sc->ops->get_addr)(&idx_info, udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address")
- /*
- * Cache the information retrieved.
- *
- * Note that if we are writing to the dataset in parallel and filters
- * are involved, we skip caching this information as it is highly likely
- * that the chunk information will be invalidated as a result of the
- * filter operation (e.g. the chunk gets re-allocated to a different
- * address in the file and/or gets re-allocated with a different size).
- * If we were to cache this information, subsequent reads/writes would
- * retrieve the invalid information and cause a variety of issues.
- *
- * It has been verified that in the serial library, when writing to chunks
- * with the real chunk cache disabled and with filters involved, the
- * functions within this file are correctly called in such a manner that
- * this single chunk cache is always updated correctly. Therefore, this
- * check is not needed for the serial library.
- *
- * This is an ugly and potentially frail check, but the
- * H5D__chunk_cinfo_cache_reset() function is not currently available
- * to functions outside of this file, so outside functions can not
- * invalidate this single chunk cache. Even if the function were available,
- * this check prevents us from doing the work of going through and caching
- * each chunk in the write operation, when we're only going to invalidate
- * the cache at the end of a parallel write anyway.
- *
- * - JTH (7/13/2018)
- */
+ /*
+ * Cache the information retrieved.
+ *
+ * Note that if we are writing to the dataset in parallel and filters
+ * are involved, we skip caching this information as it is highly likely
+ * that the chunk information will be invalidated as a result of the
+ * filter operation (e.g. the chunk gets re-allocated to a different
+ * address in the file and/or gets re-allocated with a different size).
+ * If we were to cache this information, subsequent reads/writes would
+ * retrieve the invalid information and cause a variety of issues.
+ *
+ * It has been verified that in the serial library, when writing to chunks
+ * with the real chunk cache disabled and with filters involved, the
+ * functions within this file are correctly called in such a manner that
+ * this single chunk cache is always updated correctly. Therefore, this
+ * check is not needed for the serial library.
+ *
+ * This is an ugly and potentially frail check, but the
+ * H5D__chunk_cinfo_cache_reset() function is not currently available
+ * to functions outside of this file, so outside functions can not
+ * invalidate this single chunk cache. Even if the function were available,
+ * this check prevents us from doing the work of going through and caching
+ * each chunk in the write operation, when we're only going to invalidate
+ * the cache at the end of a parallel write anyway.
+ *
+ * - JTH (7/13/2018)
+ */
#ifdef H5_HAVE_PARALLEL
- if ( !( (H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI))
- && (H5F_INTENT(dset->oloc.file) & H5F_ACC_RDWR)
- && dset->shared->dcpl_cache.pline.nused
- )
- )
+ if (!((H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI)) &&
+ (H5F_INTENT(dset->oloc.file) & H5F_ACC_RDWR) && dset->shared->dcpl_cache.pline.nused))
#endif
H5D__chunk_cinfo_cache_update(&dset->shared->cache.chunk.last, udata);
} /* end if */
- } /* end else */
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_lookup() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_flush_entry
*
@@ -3344,10 +3291,10 @@ done:
static herr_t
H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
{
- void *buf = NULL; /* Temporary buffer */
- hbool_t point_of_no_return = FALSE;
- H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
- herr_t ret_value = SUCCEED; /* Return value */
+ void * buf = NULL; /* Temporary buffer */
+ hbool_t point_of_no_return = FALSE;
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -3358,42 +3305,41 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
HDassert(!ent->locked);
buf = ent->chunk;
- if(ent->dirty) {
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5D_chunk_ud_t udata; /* pass through B-tree */
- hbool_t must_alloc = FALSE; /* Whether the chunk must be allocated */
- hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
+ if (ent->dirty) {
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ H5D_chunk_ud_t udata; /* pass through B-tree */
+ hbool_t must_alloc = FALSE; /* Whether the chunk must be allocated */
+ hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
/* Set up user data for index callbacks */
- udata.common.layout = &dset->shared->layout.u.chunk;
- udata.common.storage = sc;
- udata.common.scaled = ent->scaled;
+ udata.common.layout = &dset->shared->layout.u.chunk;
+ udata.common.storage = sc;
+ udata.common.scaled = ent->scaled;
udata.chunk_block.offset = ent->chunk_block.offset;
udata.chunk_block.length = dset->shared->layout.u.chunk.size;
- udata.filter_mask = 0;
- udata.chunk_idx = ent->chunk_idx;
+ udata.filter_mask = 0;
+ udata.chunk_idx = ent->chunk_idx;
/* Should the chunk be filtered before writing it to disk? */
- if(dset->shared->dcpl_cache.pline.nused
- && !(ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS)) {
- H5Z_EDC_t err_detect; /* Error detection info */
- H5Z_cb_t filter_cb; /* I/O filter callback function */
- size_t alloc = udata.chunk_block.length; /* Bytes allocated for BUF */
- size_t nbytes; /* Chunk size (in bytes) */
+ if (dset->shared->dcpl_cache.pline.nused && !(ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS)) {
+ H5Z_EDC_t err_detect; /* Error detection info */
+ H5Z_cb_t filter_cb; /* I/O filter callback function */
+ size_t alloc = udata.chunk_block.length; /* Bytes allocated for BUF */
+ size_t nbytes; /* Chunk size (in bytes) */
/* Retrieve filter settings from API context */
- if(H5CX_get_err_detect(&err_detect) < 0)
+ if (H5CX_get_err_detect(&err_detect) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get error detection info")
- if(H5CX_get_filter_cb(&filter_cb) < 0)
+ if (H5CX_get_filter_cb(&filter_cb) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O filter callback function")
- if(!reset) {
+ if (!reset) {
/*
* Copy the chunk to a new buffer before running it through
* the pipeline because we'll want to save the original buffer
* for later.
*/
- if(NULL == (buf = H5MM_malloc(alloc)))
+ if (NULL == (buf = H5MM_malloc(alloc)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline")
H5MM_memcpy(buf, ent->chunk, alloc);
} /* end if */
@@ -3406,15 +3352,15 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
* even if we can't write the data to disk.
*/
point_of_no_return = TRUE;
- ent->chunk = NULL;
+ ent->chunk = NULL;
} /* end else */
H5_CHECKED_ASSIGN(nbytes, size_t, udata.chunk_block.length, hsize_t);
- if(H5Z_pipeline(&(dset->shared->dcpl_cache.pline), 0, &(udata.filter_mask),
- err_detect, filter_cb, &nbytes, &alloc, &buf) < 0)
+ if (H5Z_pipeline(&(dset->shared->dcpl_cache.pline), 0, &(udata.filter_mask), err_detect,
+ filter_cb, &nbytes, &alloc, &buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFILTER, FAIL, "output pipeline failed")
#if H5_SIZEOF_SIZE_T > 4
/* Check for the chunk expanding too much to encode in a 32-bit value */
- if(nbytes > ((size_t)0xffffffff))
+ if (nbytes > ((size_t)0xffffffff))
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length")
#endif /* H5_SIZEOF_SIZE_T > 4 */
H5_CHECKED_ASSIGN(udata.chunk_block.length, hsize_t, nbytes, size_t);
@@ -3422,7 +3368,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
/* Indicate that the chunk must be allocated */
must_alloc = TRUE;
} /* end if */
- else if(!H5F_addr_defined(udata.chunk_block.offset)) {
+ else if (!H5F_addr_defined(udata.chunk_block.offset)) {
/* Indicate that the chunk must be allocated */
must_alloc = TRUE;
@@ -3430,7 +3376,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
*/
ent->edge_chunk_state &= ~H5D_RDCC_NEWLY_DISABLED_FILTERS;
} /* end else */
- else if(ent->edge_chunk_state & H5D_RDCC_NEWLY_DISABLED_FILTERS) {
+ else if (ent->edge_chunk_state & H5D_RDCC_NEWLY_DISABLED_FILTERS) {
/* Chunk on disk is still filtered, must insert to allocate correct
* size */
must_alloc = TRUE;
@@ -3446,17 +3392,18 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
/* Check if the chunk needs to be allocated (it also could exist already
* and the chunk alloc operation could resize it)
*/
- if(must_alloc) {
+ if (must_alloc) {
/* Compose chunked index info struct */
- idx_info.f = dset->oloc.file;
- idx_info.pline = &dset->shared->dcpl_cache.pline;
- idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
idx_info.storage = sc;
/* Create the chunk it if it doesn't exist, or reallocate the chunk
* if its size changed.
*/
- if(H5D__chunk_file_alloc(&idx_info, &(ent->chunk_block), &udata.chunk_block, &need_insert, ent->scaled) < 0)
+ if (H5D__chunk_file_alloc(&idx_info, &(ent->chunk_block), &udata.chunk_block, &need_insert,
+ ent->scaled) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level")
/* Update the chunk entry's info, in case it was allocated or relocated */
@@ -3467,12 +3414,13 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
/* Write the data to the file */
HDassert(H5F_addr_defined(udata.chunk_block.offset));
H5_CHECK_OVERFLOW(udata.chunk_block.length, hsize_t, size_t);
- if(H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset, (size_t)udata.chunk_block.length, buf) < 0)
+ if (H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset,
+ (size_t)udata.chunk_block.length, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
/* Insert the chunk record into the index */
- if(need_insert && sc->ops->insert)
- if((sc->ops->insert)(&idx_info, &udata, dset) < 0)
+ if (need_insert && sc->ops->insert)
+ if ((sc->ops->insert)(&idx_info, &udata, dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index")
/* Cache the chunk's info, in case it's accessed again shortly */
@@ -3486,19 +3434,20 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset)
} /* end if */
/* Reset, but do not free or removed from list */
- if(reset) {
+ if (reset) {
point_of_no_return = FALSE;
- if(buf == ent->chunk)
+ if (buf == ent->chunk)
buf = NULL;
- if(ent->chunk != NULL)
+ if (ent->chunk != NULL)
ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk,
- ((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS) ? NULL
- : &(dset->shared->dcpl_cache.pline)));
+ ((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS)
+ ? NULL
+ : &(dset->shared->dcpl_cache.pline)));
} /* end if */
done:
/* Free the temp buffer only if it's different than the entry chunk */
- if(buf != ent->chunk)
+ if (buf != ent->chunk)
H5MM_xfree(buf);
/*
@@ -3507,16 +3456,16 @@ done:
* output pipeline failed. Do not free the entry or remove it from the
* list.
*/
- if(ret_value < 0 && point_of_no_return)
- if(ent->chunk)
+ if (ret_value < 0 && point_of_no_return)
+ if (ent->chunk)
ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk,
- ((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS) ? NULL
- : &(dset->shared->dcpl_cache.pline)));
+ ((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS)
+ ? NULL
+ : &(dset->shared->dcpl_cache.pline)));
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_flush_entry() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_cache_evict
*
@@ -3533,8 +3482,8 @@ done:
static herr_t
H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush)
{
- H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -3544,37 +3493,38 @@ H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush)
HDassert(!ent->locked);
HDassert(ent->idx < rdcc->nslots);
- if(flush) {
+ if (flush) {
/* Flush */
- if(H5D__chunk_flush_entry(dset, ent, TRUE) < 0)
+ if (H5D__chunk_flush_entry(dset, ent, TRUE) < 0)
HDONE_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer")
} /* end if */
else {
/* Don't flush, just free chunk */
- if(ent->chunk != NULL)
+ if (ent->chunk != NULL)
ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk,
- ((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS) ? NULL
- : &(dset->shared->dcpl_cache.pline)));
+ ((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS)
+ ? NULL
+ : &(dset->shared->dcpl_cache.pline)));
} /* end else */
/* Unlink from list */
- if(ent->prev)
+ if (ent->prev)
ent->prev->next = ent->next;
else
rdcc->head = ent->next;
- if(ent->next)
+ if (ent->next)
ent->next->prev = ent->prev;
else
rdcc->tail = ent->prev;
ent->prev = ent->next = NULL;
/* Unlink from temporary list */
- if(ent->tmp_prev) {
+ if (ent->tmp_prev) {
HDassert(rdcc->tmp_head->tmp_next);
ent->tmp_prev->tmp_next = ent->tmp_next;
- if(ent->tmp_next) {
+ if (ent->tmp_next) {
ent->tmp_next->tmp_prev = ent->tmp_prev;
- ent->tmp_next = NULL;
+ ent->tmp_next = NULL;
} /* end if */
ent->tmp_prev = NULL;
} /* end if */
@@ -3595,7 +3545,6 @@ H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_cache_evict() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_cache_prune
*
@@ -3613,14 +3562,14 @@ H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush)
static herr_t
H5D__chunk_cache_prune(const H5D_t *dset, size_t size)
{
- const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
- size_t total = rdcc->nbytes_max;
- const int nmeth = 2; /* Number of methods */
- int w[1]; /* Weighting as an interval */
- H5D_rdcc_ent_t *p[2], *cur; /* List pointers */
- H5D_rdcc_ent_t *n[2]; /* List next pointers */
- int nerrors = 0; /* Accumulated error count during preemptions */
- herr_t ret_value = SUCCEED;/* Return value */
+ const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
+ size_t total = rdcc->nbytes_max;
+ const int nmeth = 2; /* Number of methods */
+ int w[1]; /* Weighting as an interval */
+ H5D_rdcc_ent_t * p[2], *cur; /* List pointers */
+ H5D_rdcc_ent_t * n[2]; /* List next pointers */
+ int nerrors = 0; /* Accumulated error count during preemptions */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -3638,71 +3587,72 @@ H5D__chunk_cache_prune(const H5D_t *dset, size_t size)
p[0] = rdcc->head;
p[1] = NULL;
- while((p[0] || p[1]) && (rdcc->nbytes_used + size) > total) {
- int i; /* Local index variable */
+ while ((p[0] || p[1]) && (rdcc->nbytes_used + size) > total) {
+ int i; /* Local index variable */
/* Introduce new pointers */
- for(i = 0; i < nmeth - 1; i++)
- if(0 == w[i])
+ for (i = 0; i < nmeth - 1; i++)
+ if (0 == w[i])
p[i + 1] = rdcc->head;
/* Compute next value for each pointer */
- for(i = 0; i < nmeth; i++)
+ for (i = 0; i < nmeth; i++)
n[i] = p[i] ? p[i]->next : NULL;
/* Give each method a chance */
- for(i = 0; i < nmeth && (rdcc->nbytes_used + size) > total; i++) {
- if(0 == i && p[0] && !p[0]->locked &&
- ((0 == p[0]->rd_count && 0 == p[0]->wr_count) ||
- (0 == p[0]->rd_count && dset->shared->layout.u.chunk.size == p[0]->wr_count) ||
- (dset->shared->layout.u.chunk.size == p[0]->rd_count && 0 == p[0]->wr_count))) {
+ for (i = 0; i < nmeth && (rdcc->nbytes_used + size) > total; i++) {
+ if (0 == i && p[0] && !p[0]->locked &&
+ ((0 == p[0]->rd_count && 0 == p[0]->wr_count) ||
+ (0 == p[0]->rd_count && dset->shared->layout.u.chunk.size == p[0]->wr_count) ||
+ (dset->shared->layout.u.chunk.size == p[0]->rd_count && 0 == p[0]->wr_count))) {
/*
- * Method 0: Preempt entries that have been completely written
- * and/or completely read but not entries that are partially
- * written or partially read.
- */
+ * Method 0: Preempt entries that have been completely written
+ * and/or completely read but not entries that are partially
+ * written or partially read.
+ */
cur = p[0];
- } else if(1 == i && p[1] && !p[1]->locked) {
+ }
+ else if (1 == i && p[1] && !p[1]->locked) {
/*
- * Method 1: Preempt the entry without regard to
- * considerations other than being locked. This is the last
- * resort preemption.
- */
+ * Method 1: Preempt the entry without regard to
+ * considerations other than being locked. This is the last
+ * resort preemption.
+ */
cur = p[1];
- } else {
+ }
+ else {
/* Nothing to preempt at this point */
cur = NULL;
}
- if(cur) {
- int j; /* Local index variable */
+ if (cur) {
+ int j; /* Local index variable */
- for(j = 0; j < nmeth; j++) {
- if(p[j] == cur)
+ for (j = 0; j < nmeth; j++) {
+ if (p[j] == cur)
p[j] = NULL;
- if(n[j] == cur)
+ if (n[j] == cur)
n[j] = cur->next;
} /* end for */
- if(H5D__chunk_cache_evict(dset, cur, TRUE) < 0)
+ if (H5D__chunk_cache_evict(dset, cur, TRUE) < 0)
nerrors++;
} /* end if */
- } /* end for */
+ } /* end for */
/* Advance pointers */
- for(i = 0; i < nmeth; i++)
+ for (i = 0; i < nmeth; i++)
p[i] = n[i];
- for(i = 0; i < nmeth - 1; i++)
+ for (i = 0; i < nmeth - 1; i++)
w[i] -= 1;
} /* end while */
- if(nerrors)
+ if (nerrors)
HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to preempt one or more raw data cache entry")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_cache_prune() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_lock
*
@@ -3731,22 +3681,23 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
- hbool_t relax, hbool_t prev_unfilt_chunk)
+H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t relax, hbool_t prev_unfilt_chunk)
{
- const H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */
- const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info - always equal to the pline passed to H5D__chunk_mem_alloc */
- const H5O_pline_t *old_pline = pline; /* Old pipeline, i.e. pipeline used to read the chunk */
- const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
- const H5O_fill_t *fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */
- H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
- hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
- H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache*/
- H5D_rdcc_ent_t *ent; /*cache entry */
- size_t chunk_size; /*size of a chunk */
+ const H5D_t * dset = io_info->dset; /* Local pointer to the dataset info */
+ const H5O_pline_t *pline =
+ &(dset->shared->dcpl_cache
+ .pline); /* I/O pipeline info - always equal to the pline passed to H5D__chunk_mem_alloc */
+ const H5O_pline_t * old_pline = pline; /* Old pipeline, i.e. pipeline used to read the chunk */
+ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
+ const H5O_fill_t * fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */
+ H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
+ hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
+ H5D_rdcc_t * rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache*/
+ H5D_rdcc_ent_t * ent; /*cache entry */
+ size_t chunk_size; /*size of a chunk */
hbool_t disable_filters = FALSE; /* Whether to disable filters (when adding to cache) */
- void *chunk = NULL; /*the file chunk */
- void *ret_value = NULL; /* Return value */
+ void * chunk = NULL; /*the file chunk */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -3763,7 +3714,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
H5_CHECKED_ASSIGN(chunk_size, size_t, layout->u.chunk.size, uint32_t);
/* Check if the chunk is in the cache */
- if(UINT_MAX != udata->idx_hint) {
+ if (UINT_MAX != udata->idx_hint) {
/* Sanity check */
HDassert(udata->idx_hint < rdcc->nslots);
HDassert(rdcc->slot[udata->idx_hint]);
@@ -3772,13 +3723,13 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
ent = rdcc->slot[udata->idx_hint];
#ifndef NDEBUG
-{
- unsigned u; /*counters */
+ {
+ unsigned u; /*counters */
- /* Make sure this is the right chunk */
- for(u = 0; u < layout->u.chunk.ndims - 1; u++)
- HDassert(io_info->store->chunk.scaled[u] == ent->scaled[u]);
-}
+ /* Make sure this is the right chunk */
+ for (u = 0; u < layout->u.chunk.ndims - 1; u++)
+ HDassert(io_info->store->chunk.scaled[u] == ent->scaled[u]);
+ }
#endif /* NDEBUG */
/*
@@ -3787,15 +3738,14 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
rdcc->stats.nhits++;
/* Make adjustments if the edge chunk status changed recently */
- if(pline->nused) {
+ if (pline->nused) {
/* If the chunk recently became an unfiltered partial edge chunk
* while in cache, we must make some changes to the entry */
- if(udata->new_unfilt_chunk) {
+ if (udata->new_unfilt_chunk) {
/* If this flag is set then partial chunk filters must be
* disabled, and the chunk must not have previously been a
* partial chunk (with disabled filters) */
- HDassert(layout->u.chunk.flags
- & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
+ HDassert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
HDassert(!(ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS));
HDassert(old_pline->nused);
@@ -3806,24 +3756,24 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
/* Reallocate the chunk so H5D__chunk_mem_xfree doesn't get confused
*/
- if(NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
+ if (NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
+ "memory allocation failed for raw data chunk")
H5MM_memcpy(chunk, ent->chunk, chunk_size);
ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, old_pline);
ent->chunk = (uint8_t *)chunk;
- chunk = NULL;
+ chunk = NULL;
/* Mark the chunk as having filters disabled as well as "newly
* disabled" so it is inserted on flush */
ent->edge_chunk_state |= H5D_RDCC_DISABLE_FILTERS;
ent->edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS;
} /* end if */
- else if(prev_unfilt_chunk) {
+ else if (prev_unfilt_chunk) {
/* If this flag is set then partial chunk filters must be
* disabled, and the chunk must have previously been a partial
* chunk (with disabled filters) */
- HDassert(layout->u.chunk.flags
- & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
+ HDassert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
HDassert((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS));
HDassert(pline->nused);
@@ -3832,82 +3782,79 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
/* Reallocate the chunk so H5D__chunk_mem_xfree doesn't get confused
*/
- if(NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
+ if (NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
+ "memory allocation failed for raw data chunk")
H5MM_memcpy(chunk, ent->chunk, chunk_size);
ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, old_pline);
ent->chunk = (uint8_t *)chunk;
- chunk = NULL;
+ chunk = NULL;
/* Mark the chunk as having filters enabled */
- ent->edge_chunk_state &= ~(H5D_RDCC_DISABLE_FILTERS
- | H5D_RDCC_NEWLY_DISABLED_FILTERS);
+ ent->edge_chunk_state &= ~(H5D_RDCC_DISABLE_FILTERS | H5D_RDCC_NEWLY_DISABLED_FILTERS);
} /* end else */
- } /* end if */
+ } /* end if */
/*
* If the chunk is not at the beginning of the cache; move it backward
* by one slot. This is how we implement the LRU preemption
* algorithm.
*/
- if(ent->next) {
- if(ent->next->next)
+ if (ent->next) {
+ if (ent->next->next)
ent->next->next->prev = ent;
else
rdcc->tail = ent;
ent->next->prev = ent->prev;
- if(ent->prev)
+ if (ent->prev)
ent->prev->next = ent->next;
else
rdcc->head = ent->next;
- ent->prev = ent->next;
- ent->next = ent->next->next;
+ ent->prev = ent->next;
+ ent->next = ent->next->next;
ent->prev->next = ent;
} /* end if */
- } /* end if */
+ } /* end if */
else {
- haddr_t chunk_addr; /* Address of chunk on disk */
- hsize_t chunk_alloc; /* Length of chunk on disk */
+ haddr_t chunk_addr; /* Address of chunk on disk */
+ hsize_t chunk_alloc; /* Length of chunk on disk */
/* Save the chunk info so the cache stays consistent */
- chunk_addr = udata->chunk_block.offset;
+ chunk_addr = udata->chunk_block.offset;
chunk_alloc = udata->chunk_block.length;
/* Check if we should disable filters on this chunk */
- if(pline->nused) {
- if(udata->new_unfilt_chunk) {
- HDassert(layout->u.chunk.flags
- & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
+ if (pline->nused) {
+ if (udata->new_unfilt_chunk) {
+ HDassert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
/* Disable the filters for writing */
disable_filters = TRUE;
- pline = NULL;
+ pline = NULL;
} /* end if */
- else if(prev_unfilt_chunk) {
- HDassert(layout->u.chunk.flags
- & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
+ else if (prev_unfilt_chunk) {
+ HDassert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
/* Mark the filters as having been previously disabled (for the
* chunk as currently on disk) - disable the filters for reading
*/
old_pline = NULL;
} /* end if */
- else if(layout->u.chunk.flags
- & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) {
+ else if (layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) {
/* Check if this is an edge chunk */
- if(H5D__chunk_is_partial_edge_chunk(io_info->dset->shared->ndims,
- layout->u.chunk.dim, io_info->store->chunk.scaled,
- io_info->dset->shared->curr_dims)) {
+ if (H5D__chunk_is_partial_edge_chunk(io_info->dset->shared->ndims, layout->u.chunk.dim,
+ io_info->store->chunk.scaled,
+ io_info->dset->shared->curr_dims)) {
/* Disable the filters for both writing and reading */
disable_filters = TRUE;
- old_pline = NULL;
- pline = NULL;
+ old_pline = NULL;
+ pline = NULL;
} /* end if */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
- if(relax) {
+ if (relax) {
/*
* Not in the cache, but we're about to overwrite the whole thing
* anyway, so just allocate a buffer for it but don't initialize that
@@ -3916,7 +3863,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
*/
rdcc->stats.nhits++;
- if(NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline)))
+ if (NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
/* In the case that some dataset functions look through this data,
@@ -3930,65 +3877,69 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
*/
/* Check if the chunk exists on disk */
- if(H5F_addr_defined(chunk_addr)) {
- size_t my_chunk_alloc = chunk_alloc; /* Allocated buffer size */
- size_t buf_alloc = chunk_alloc; /* [Re-]allocated buffer size */
+ if (H5F_addr_defined(chunk_addr)) {
+ size_t my_chunk_alloc = chunk_alloc; /* Allocated buffer size */
+ size_t buf_alloc = chunk_alloc; /* [Re-]allocated buffer size */
/* Chunk size on disk isn't [likely] the same size as the final chunk
* size in memory, so allocate memory big enough. */
- if(NULL == (chunk = H5D__chunk_mem_alloc(my_chunk_alloc, (udata->new_unfilt_chunk ? old_pline : pline))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
- if(H5F_shared_block_read(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, chunk_addr, my_chunk_alloc, chunk) < 0)
+ if (NULL == (chunk = H5D__chunk_mem_alloc(my_chunk_alloc,
+ (udata->new_unfilt_chunk ? old_pline : pline))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
+ "memory allocation failed for raw data chunk")
+ if (H5F_shared_block_read(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, chunk_addr,
+ my_chunk_alloc, chunk) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk")
- if(old_pline && old_pline->nused) {
- H5Z_EDC_t err_detect; /* Error detection info */
- H5Z_cb_t filter_cb; /* I/O filter callback function */
+ if (old_pline && old_pline->nused) {
+ H5Z_EDC_t err_detect; /* Error detection info */
+ H5Z_cb_t filter_cb; /* I/O filter callback function */
/* Retrieve filter settings from API context */
- if(H5CX_get_err_detect(&err_detect) < 0)
+ if (H5CX_get_err_detect(&err_detect) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get error detection info")
- if(H5CX_get_filter_cb(&filter_cb) < 0)
+ if (H5CX_get_filter_cb(&filter_cb) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get I/O filter callback function")
- if(H5Z_pipeline(old_pline, H5Z_FLAG_REVERSE, &(udata->filter_mask),
- err_detect, filter_cb, &my_chunk_alloc, &buf_alloc, &chunk) < 0)
+ if (H5Z_pipeline(old_pline, H5Z_FLAG_REVERSE, &(udata->filter_mask), err_detect,
+ filter_cb, &my_chunk_alloc, &buf_alloc, &chunk) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFILTER, NULL, "data pipeline read failed")
/* Reallocate chunk if necessary */
- if(udata->new_unfilt_chunk) {
+ if (udata->new_unfilt_chunk) {
void *tmp_chunk = chunk;
- if(NULL == (chunk = H5D__chunk_mem_alloc(my_chunk_alloc, pline))) {
+ if (NULL == (chunk = H5D__chunk_mem_alloc(my_chunk_alloc, pline))) {
(void)H5D__chunk_mem_xfree(tmp_chunk, old_pline);
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
+ "memory allocation failed for raw data chunk")
} /* end if */
H5MM_memcpy(chunk, tmp_chunk, chunk_size);
(void)H5D__chunk_mem_xfree(tmp_chunk, old_pline);
} /* end if */
- } /* end if */
+ } /* end if */
/* Increment # of cache misses */
rdcc->stats.nmisses++;
} /* end if */
else {
- H5D_fill_value_t fill_status;
+ H5D_fill_value_t fill_status;
/* Sanity check */
HDassert(fill->alloc_time != H5D_ALLOC_TIME_EARLY);
/* Chunk size on disk isn't [likely] the same size as the final chunk
* size in memory, so allocate memory big enough. */
- if(NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk")
+ if (NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
+ "memory allocation failed for raw data chunk")
- if(H5P_is_fill_value_defined(fill, &fill_status) < 0)
+ if (H5P_is_fill_value_defined(fill, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't tell if fill value defined")
- if(fill->fill_time == H5D_FILL_TIME_ALLOC ||
- (fill->fill_time == H5D_FILL_TIME_IFSET &&
- (fill_status == H5D_FILL_VALUE_USER_DEFINED ||
- fill_status == H5D_FILL_VALUE_DEFAULT))) {
+ if (fill->fill_time == H5D_FILL_TIME_ALLOC ||
+ (fill->fill_time == H5D_FILL_TIME_IFSET &&
+ (fill_status == H5D_FILL_VALUE_USER_DEFINED || fill_status == H5D_FILL_VALUE_DEFAULT))) {
/*
* The chunk doesn't exist in the file. Replicate the fill
* value throughout the chunk, if the fill value is defined.
@@ -3996,16 +3947,16 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
/* Initialize the fill value buffer */
/* (use the compact dataset storage buffer as the fill value buffer) */
- if(H5D__fill_init(&fb_info, chunk, NULL, NULL, NULL, NULL,
- &dset->shared->dcpl_cache.fill, dset->shared->type,
- dset->shared->type_id, (size_t)0, chunk_size) < 0)
+ if (H5D__fill_init(&fb_info, chunk, NULL, NULL, NULL, NULL,
+ &dset->shared->dcpl_cache.fill, dset->shared->type,
+ dset->shared->type_id, (size_t)0, chunk_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't initialize fill buffer info")
fb_info_init = TRUE;
/* Check for VL datatype & non-default fill value */
- if(fb_info.has_vlen_fill_type)
+ if (fb_info.has_vlen_fill_type)
/* Fill the buffer with VL datatype fill values */
- if(H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf) < 0)
+ if (H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, NULL, "can't refill fill value buffer")
} /* end if */
else
@@ -4014,36 +3965,36 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
/* Increment # of creations */
rdcc->stats.ninits++;
} /* end else */
- } /* end else */
+ } /* end else */
/* See if the chunk can be cached */
- if(rdcc->nslots > 0 && chunk_size <= rdcc->nbytes_max) {
+ if (rdcc->nslots > 0 && chunk_size <= rdcc->nbytes_max) {
/* Calculate the index */
udata->idx_hint = H5D__chunk_hash_val(io_info->dset->shared, udata->common.scaled);
/* Add the chunk to the cache only if the slot is not already locked */
ent = rdcc->slot[udata->idx_hint];
- if(!ent || !ent->locked) {
+ if (!ent || !ent->locked) {
/* Preempt enough things from the cache to make room */
- if(ent) {
- if(H5D__chunk_cache_evict(io_info->dset, ent, TRUE) < 0)
+ if (ent) {
+ if (H5D__chunk_cache_evict(io_info->dset, ent, TRUE) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk from cache")
} /* end if */
- if(H5D__chunk_cache_prune(io_info->dset, chunk_size) < 0)
+ if (H5D__chunk_cache_prune(io_info->dset, chunk_size) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk(s) from cache")
/* Create a new entry */
- if(NULL == (ent = H5FL_CALLOC(H5D_rdcc_ent_t)))
+ if (NULL == (ent = H5FL_CALLOC(H5D_rdcc_ent_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate raw data chunk entry")
ent->edge_chunk_state = disable_filters ? H5D_RDCC_DISABLE_FILTERS : 0;
- if(udata->new_unfilt_chunk)
+ if (udata->new_unfilt_chunk)
ent->edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS;
/* Initialize the new entry */
ent->chunk_block.offset = chunk_addr;
ent->chunk_block.length = chunk_alloc;
- ent->chunk_idx = udata->chunk_idx;
+ ent->chunk_idx = udata->chunk_idx;
H5MM_memcpy(ent->scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims);
H5_CHECKED_ASSIGN(ent->rd_count, uint32_t, chunk_size, size_t);
H5_CHECKED_ASSIGN(ent->wr_count, uint32_t, chunk_size, size_t);
@@ -4052,15 +4003,15 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
/* Add it to the cache */
HDassert(NULL == rdcc->slot[udata->idx_hint]);
rdcc->slot[udata->idx_hint] = ent;
- ent->idx = udata->idx_hint;
+ ent->idx = udata->idx_hint;
rdcc->nbytes_used += chunk_size;
rdcc->nused++;
/* Add it to the linked list */
- if(rdcc->tail) {
+ if (rdcc->tail) {
rdcc->tail->next = ent;
- ent->prev = rdcc->tail;
- rdcc->tail = ent;
+ ent->prev = rdcc->tail;
+ rdcc->tail = ent;
} /* end if */
else
rdcc->head = rdcc->tail = ent;
@@ -4071,16 +4022,16 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
else
/* We did not add the chunk to cache */
ent = NULL;
- } /* end else */
+ } /* end else */
else /* No cache set up, or chunk is too large: chunk is uncacheable */
ent = NULL;
} /* end else */
/* Lock the chunk into the cache */
- if(ent) {
+ if (ent) {
HDassert(!ent->locked);
ent->locked = TRUE;
- chunk = ent->chunk;
+ chunk = ent->chunk;
} /* end if */
else
/*
@@ -4095,18 +4046,17 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata,
done:
/* Release the fill buffer info, if it's been initialized */
- if(fb_info_init && H5D__fill_term(&fb_info) < 0)
+ if (fb_info_init && H5D__fill_term(&fb_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, NULL, "Can't release fill buffer info")
/* Release the chunk allocated, on error */
- if(!ret_value)
- if(chunk)
+ if (!ret_value)
+ if (chunk)
chunk = H5D__chunk_mem_xfree(chunk, pline);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_lock() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_unlock
*
@@ -4130,12 +4080,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata,
- hbool_t dirty, void *chunk, uint32_t naccessed)
+H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, hbool_t dirty, void *chunk,
+ uint32_t naccessed)
{
- const H5O_layout_t *layout = &(io_info->dset->shared->layout); /* Dataset layout */
- const H5D_rdcc_t *rdcc = &(io_info->dset->shared->cache.chunk);
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5O_layout_t *layout = &(io_info->dset->shared->layout); /* Dataset layout */
+ const H5D_rdcc_t * rdcc = &(io_info->dset->shared->cache.chunk);
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -4143,7 +4093,7 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata,
HDassert(io_info);
HDassert(udata);
- if(UINT_MAX == udata->idx_hint) {
+ if (UINT_MAX == udata->idx_hint) {
/*
* It's not in the cache, probably because it's too big. If it's
* dirty then flush it to disk. In any case, free the chunk.
@@ -4151,57 +4101,57 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata,
hbool_t is_unfiltered_edge_chunk = FALSE; /* Whether the chunk is an unfiltered edge chunk */
/* Check if we should disable filters on this chunk */
- if(udata->new_unfilt_chunk) {
+ if (udata->new_unfilt_chunk) {
HDassert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
is_unfiltered_edge_chunk = TRUE;
} /* end if */
- else if(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) {
+ else if (layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) {
/* Check if the chunk is an edge chunk, and disable filters if so */
is_unfiltered_edge_chunk = H5D__chunk_is_partial_edge_chunk(
- io_info->dset->shared->ndims, layout->u.chunk.dim,
- io_info->store->chunk.scaled, io_info->dset->shared->curr_dims);
+ io_info->dset->shared->ndims, layout->u.chunk.dim, io_info->store->chunk.scaled,
+ io_info->dset->shared->curr_dims);
} /* end if */
- if(dirty) {
- H5D_rdcc_ent_t fake_ent; /* "fake" chunk cache entry */
+ if (dirty) {
+ H5D_rdcc_ent_t fake_ent; /* "fake" chunk cache entry */
HDmemset(&fake_ent, 0, sizeof(fake_ent));
fake_ent.dirty = TRUE;
- if(is_unfiltered_edge_chunk)
+ if (is_unfiltered_edge_chunk)
fake_ent.edge_chunk_state = H5D_RDCC_DISABLE_FILTERS;
- if(udata->new_unfilt_chunk)
+ if (udata->new_unfilt_chunk)
fake_ent.edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS;
- H5MM_memcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims);
+ H5MM_memcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims);
HDassert(layout->u.chunk.size > 0);
- fake_ent.chunk_idx = udata->chunk_idx;
+ fake_ent.chunk_idx = udata->chunk_idx;
fake_ent.chunk_block.offset = udata->chunk_block.offset;
fake_ent.chunk_block.length = udata->chunk_block.length;
- fake_ent.chunk = (uint8_t *)chunk;
+ fake_ent.chunk = (uint8_t *)chunk;
- if(H5D__chunk_flush_entry(io_info->dset, &fake_ent, TRUE) < 0)
+ if (H5D__chunk_flush_entry(io_info->dset, &fake_ent, TRUE) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer")
} /* end if */
else {
- if(chunk)
- chunk = H5D__chunk_mem_xfree(chunk, (is_unfiltered_edge_chunk ? NULL
- : &(io_info->dset->shared->dcpl_cache.pline)));
+ if (chunk)
+ chunk = H5D__chunk_mem_xfree(
+ chunk, (is_unfiltered_edge_chunk ? NULL : &(io_info->dset->shared->dcpl_cache.pline)));
} /* end else */
- } /* end if */
+ } /* end if */
else {
- H5D_rdcc_ent_t *ent; /* Chunk's entry in the cache */
+ H5D_rdcc_ent_t *ent; /* Chunk's entry in the cache */
/* Sanity check */
- HDassert(udata->idx_hint < rdcc->nslots);
- HDassert(rdcc->slot[udata->idx_hint]);
- HDassert(rdcc->slot[udata->idx_hint]->chunk == chunk);
+ HDassert(udata->idx_hint < rdcc->nslots);
+ HDassert(rdcc->slot[udata->idx_hint]);
+ HDassert(rdcc->slot[udata->idx_hint]->chunk == chunk);
/*
* It's in the cache so unlock it.
*/
ent = rdcc->slot[udata->idx_hint];
HDassert(ent->locked);
- if(dirty) {
+ if (dirty) {
ent->dirty = TRUE;
ent->wr_count -= MIN(ent->wr_count, naccessed);
} /* end if */
@@ -4214,7 +4164,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_unlock() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_allocated_cb
*
@@ -4240,7 +4189,6 @@ H5D__chunk_allocated_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
FUNC_LEAVE_NOAPI(H5_ITER_CONT)
} /* H5D__chunk_allocated_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_allocated
*
@@ -4258,12 +4206,12 @@ H5D__chunk_allocated_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
herr_t
H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes)
{
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
- const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Raw data chunk cache */
- H5D_rdcc_ent_t *ent; /* Cache entry */
- hsize_t chunk_bytes = 0; /* Number of bytes allocated for chunks */
- H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ const H5D_rdcc_t * rdcc = &(dset->shared->cache.chunk); /* Raw data chunk cache */
+ H5D_rdcc_ent_t * ent; /* Cache entry */
+ hsize_t chunk_bytes = 0; /* Number of bytes allocated for chunks */
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -4272,20 +4220,21 @@ H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes)
H5D_CHUNK_STORAGE_INDEX_CHK(sc);
/* Search for cached chunks that haven't been written out */
- for(ent = rdcc->head; ent; ent = ent->next)
+ for (ent = rdcc->head; ent; ent = ent->next)
/* Flush the chunk out to disk, to make certain the size is correct later */
- if(H5D__chunk_flush_entry(dset, ent, FALSE) < 0)
+ if (H5D__chunk_flush_entry(dset, ent, FALSE) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer")
/* Compose chunked index info struct */
- idx_info.f = dset->oloc.file;
- idx_info.pline = &dset->shared->dcpl_cache.pline;
- idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
idx_info.storage = sc;
/* Iterate over the chunks */
- if((sc->ops->iterate)(&idx_info, H5D__chunk_allocated_cb, &chunk_bytes) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve allocated chunk information from index")
+ if ((sc->ops->iterate)(&idx_info, H5D__chunk_allocated_cb, &chunk_bytes) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "unable to retrieve allocated chunk information from index")
/* Set number of bytes for caller */
*nbytes = chunk_bytes;
@@ -4294,7 +4243,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_allocated() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_allocate
*
@@ -4312,41 +4260,46 @@ done:
herr_t
H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[])
{
- const H5D_t *dset = io_info->dset; /* the dataset pointer */
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
- const H5D_chunk_ops_t *ops = dset->shared->layout.storage.u.chunk.ops; /* Chunk operations */
- hsize_t min_unalloc[H5O_LAYOUT_NDIMS]; /* First chunk in each dimension that is unallocated (in scaled coordinates) */
- hsize_t max_unalloc[H5O_LAYOUT_NDIMS]; /* Last chunk in each dimension that is unallocated (in scaled coordinates) */
- hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Offset of current chunk (in scaled coordinates) */
- size_t orig_chunk_size; /* Original size of chunk in bytes */
- size_t chunk_size; /* Actual size of chunk in bytes, possibly filtered */
- unsigned filter_mask = 0; /* Filter mask for chunks that have them */
- const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
- const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info */
- const H5O_pline_t def_pline = H5O_CRT_PIPELINE_DEF; /* Default pipeline */
- const H5O_fill_t *fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */
- H5D_fill_value_t fill_status; /* The fill value status */
- hbool_t should_fill = FALSE; /* Whether fill values should be written */
- void *unfilt_fill_buf = NULL; /* Unfiltered fill value buffer */
- void **fill_buf = NULL; /* Pointer to the fill buffer to use for a chunk */
+ const H5D_t * dset = io_info->dset; /* the dataset pointer */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ const H5D_chunk_ops_t *ops = dset->shared->layout.storage.u.chunk.ops; /* Chunk operations */
+ hsize_t min_unalloc[H5O_LAYOUT_NDIMS]; /* First chunk in each dimension that is unallocated (in scaled
+ coordinates) */
+ hsize_t max_unalloc[H5O_LAYOUT_NDIMS]; /* Last chunk in each dimension that is unallocated (in scaled
+ coordinates) */
+ hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Offset of current chunk (in scaled coordinates) */
+ size_t orig_chunk_size; /* Original size of chunk in bytes */
+ size_t chunk_size; /* Actual size of chunk in bytes, possibly filtered */
+ unsigned filter_mask = 0; /* Filter mask for chunks that have them */
+ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
+ const H5O_pline_t * pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info */
+ const H5O_pline_t def_pline = H5O_CRT_PIPELINE_DEF; /* Default pipeline */
+ const H5O_fill_t * fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */
+ H5D_fill_value_t fill_status; /* The fill value status */
+ hbool_t should_fill = FALSE; /* Whether fill values should be written */
+ void * unfilt_fill_buf = NULL; /* Unfiltered fill value buffer */
+ void ** fill_buf = NULL; /* Pointer to the fill buffer to use for a chunk */
#ifdef H5_HAVE_PARALLEL
- hbool_t blocks_written = FALSE; /* Flag to indicate that chunk was actually written */
- hbool_t using_mpi = FALSE; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */
+ hbool_t blocks_written = FALSE; /* Flag to indicate that chunk was actually written */
+ hbool_t using_mpi =
+ FALSE; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */
H5D_chunk_coll_info_t chunk_info; /* chunk address information for doing I/O */
-#endif /* H5_HAVE_PARALLEL */
- hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */
- unsigned space_ndims; /* Dataset's space rank */
- const hsize_t *space_dim; /* Dataset's dataspace dimensions */
- const uint32_t *chunk_dim = layout->u.chunk.dim; /* Convenience pointer to chunk dimensions */
- unsigned op_dim; /* Current operating dimension */
- H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
- hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
- hbool_t has_unfilt_edge_chunks = FALSE; /* Whether there are partial edge chunks with disabled filters */
- hbool_t unfilt_edge_chunk_dim[H5O_LAYOUT_NDIMS]; /* Whether there are unfiltered edge chunks at the edge of each dimension */
- hsize_t edge_chunk_scaled[H5O_LAYOUT_NDIMS]; /* Offset of the unfiltered edge chunks at the edge of each dimension */
- unsigned nunfilt_edge_chunk_dims = 0; /* Number of dimensions on an edge */
- H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); /* Convenience variable */
- herr_t ret_value = SUCCEED; /* Return value */
+#endif /* H5_HAVE_PARALLEL */
+ hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */
+ unsigned space_ndims; /* Dataset's space rank */
+ const hsize_t * space_dim; /* Dataset's dataspace dimensions */
+ const uint32_t * chunk_dim = layout->u.chunk.dim; /* Convenience pointer to chunk dimensions */
+ unsigned op_dim; /* Current operating dimension */
+ H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
+ hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
+ hbool_t has_unfilt_edge_chunks = FALSE; /* Whether there are partial edge chunks with disabled filters */
+ hbool_t unfilt_edge_chunk_dim[H5O_LAYOUT_NDIMS]; /* Whether there are unfiltered edge chunks at the edge
+ of each dimension */
+ hsize_t edge_chunk_scaled[H5O_LAYOUT_NDIMS]; /* Offset of the unfiltered edge chunks at the edge of each
+ dimension */
+ unsigned nunfilt_edge_chunk_dims = 0; /* Number of dimensions on an edge */
+ H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); /* Convenience variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -4356,7 +4309,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
H5D_CHUNK_STORAGE_INDEX_CHK(sc);
/* Retrieve the dataset dimensions */
- space_dim = dset->shared->curr_dims;
+ space_dim = dset->shared->curr_dims;
space_ndims = dset->shared->ndims;
/* The last dimension in scaled chunk coordinates is always 0 */
@@ -4364,8 +4317,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
/* Check if any space dimensions are 0, if so we do not have to do anything
*/
- for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++)
- if(space_dim[op_dim] == 0) {
+ for (op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++)
+ if (space_dim[op_dim] == 0) {
/* Reset any cached chunk info for this dataset */
H5D__chunk_cinfo_cache_reset(&dset->shared->cache.chunk.last);
HGOTO_DONE(SUCCEED)
@@ -4373,23 +4326,23 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
#ifdef H5_HAVE_PARALLEL
/* Retrieve MPI parameters */
- if(H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI)) {
+ if (H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI)) {
/* Set the MPI-capable file driver flag */
using_mpi = TRUE;
/* init chunk info stuff for collective I/O */
chunk_info.num_io = 0;
- chunk_info.addr = NULL;
- } /* end if */
-#endif /* H5_HAVE_PARALLEL */
+ chunk_info.addr = NULL;
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
/* Calculate the minimum and maximum chunk offsets in each dimension, and
* determine if there are any unfiltered partial edge chunks. Note that we
* assume here that all elements of space_dim are > 0. This is checked at
* the top of this function. */
- for(op_dim=0; op_dim<space_ndims; op_dim++) {
+ for (op_dim = 0; op_dim < space_ndims; op_dim++) {
/* Validate this chunk dimension */
- if(chunk_dim[op_dim] == 0)
+ if (chunk_dim[op_dim] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim)
min_unalloc[op_dim] = (old_dim[op_dim] + chunk_dim[op_dim] - 1) / chunk_dim[op_dim];
max_unalloc[op_dim] = (space_dim[op_dim] - 1) / chunk_dim[op_dim];
@@ -4397,13 +4350,11 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
/* Calculate if there are unfiltered edge chunks at the edge of this
* dimension. Note the edge_chunk_scaled is uninitialized for
* dimensions where unfilt_edge_chunk_dim is FALSE. Also */
- if((layout->u.chunk.flags
- & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS)
- && pline->nused > 0
- && space_dim[op_dim] % chunk_dim[op_dim] != 0) {
- has_unfilt_edge_chunks = TRUE;
+ if ((layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) && pline->nused > 0 &&
+ space_dim[op_dim] % chunk_dim[op_dim] != 0) {
+ has_unfilt_edge_chunks = TRUE;
unfilt_edge_chunk_dim[op_dim] = TRUE;
- edge_chunk_scaled[op_dim] = max_unalloc[op_dim];
+ edge_chunk_scaled[op_dim] = max_unalloc[op_dim];
} /* end if */
else
unfilt_edge_chunk_dim[op_dim] = FALSE;
@@ -4413,7 +4364,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
H5_CHECKED_ASSIGN(orig_chunk_size, size_t, layout->u.chunk.size, uint32_t);
/* Check the dataset's fill-value status */
- if(H5P_is_fill_value_defined(fill, &fill_status) < 0)
+ if (H5P_is_fill_value_defined(fill, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
/* If we are filling the dataset on allocation or "if set" and
@@ -4421,22 +4372,21 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
* or if there are any pipeline filters defined,
* set the "should fill" flag
*/
- if((!full_overwrite && (fill->fill_time == H5D_FILL_TIME_ALLOC ||
- (fill->fill_time == H5D_FILL_TIME_IFSET &&
- (fill_status == H5D_FILL_VALUE_USER_DEFINED ||
- fill_status == H5D_FILL_VALUE_DEFAULT))))
- || pline->nused > 0)
+ if ((!full_overwrite &&
+ (fill->fill_time == H5D_FILL_TIME_ALLOC ||
+ (fill->fill_time == H5D_FILL_TIME_IFSET &&
+ (fill_status == H5D_FILL_VALUE_USER_DEFINED || fill_status == H5D_FILL_VALUE_DEFAULT)))) ||
+ pline->nused > 0)
should_fill = TRUE;
/* Check if fill values should be written to chunks */
- if(should_fill) {
+ if (should_fill) {
/* Initialize the fill value buffer */
/* (delay allocating fill buffer for VL datatypes until refilling) */
/* (casting away const OK - QAK) */
- if(H5D__fill_init(&fb_info, NULL, (H5MM_allocate_t)H5D__chunk_mem_alloc,
- (void *)pline, (H5MM_free_t)H5D__chunk_mem_xfree, (void *)pline,
- &dset->shared->dcpl_cache.fill, dset->shared->type,
- dset->shared->type_id, (size_t)0, orig_chunk_size) < 0)
+ if (H5D__fill_init(&fb_info, NULL, (H5MM_allocate_t)H5D__chunk_mem_alloc, (void *)pline,
+ (H5MM_free_t)H5D__chunk_mem_xfree, (void *)pline, &dset->shared->dcpl_cache.fill,
+ dset->shared->type, dset->shared->type_id, (size_t)0, orig_chunk_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
fb_info_init = TRUE;
@@ -4449,40 +4399,42 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
/* (only do this in advance when the chunk info can be re-used (i.e.
* it doesn't contain any non-default VL datatype fill values)
*/
- if(!fb_info.has_vlen_fill_type && pline->nused > 0) {
- H5Z_EDC_t err_detect; /* Error detection info */
- H5Z_cb_t filter_cb; /* I/O filter callback function */
- size_t buf_size = orig_chunk_size;
+ if (!fb_info.has_vlen_fill_type && pline->nused > 0) {
+ H5Z_EDC_t err_detect; /* Error detection info */
+ H5Z_cb_t filter_cb; /* I/O filter callback function */
+ size_t buf_size = orig_chunk_size;
/* If the dataset has disabled partial chunk filters, create a copy
* of the unfiltered fill_buf to use for partial chunks */
- if(has_unfilt_edge_chunks) {
- if(NULL == (unfilt_fill_buf = H5D__chunk_mem_alloc(orig_chunk_size, &def_pline)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk")
+ if (has_unfilt_edge_chunks) {
+ if (NULL == (unfilt_fill_buf = H5D__chunk_mem_alloc(orig_chunk_size, &def_pline)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory allocation failed for raw data chunk")
H5MM_memcpy(unfilt_fill_buf, fb_info.fill_buf, orig_chunk_size);
} /* end if */
/* Retrieve filter settings from API context */
- if(H5CX_get_err_detect(&err_detect) < 0)
+ if (H5CX_get_err_detect(&err_detect) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get error detection info")
- if(H5CX_get_filter_cb(&filter_cb) < 0)
+ if (H5CX_get_filter_cb(&filter_cb) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O filter callback function")
/* Push the chunk through the filters */
- if(H5Z_pipeline(pline, 0, &filter_mask, err_detect, filter_cb, &orig_chunk_size, &buf_size, &fb_info.fill_buf) < 0)
+ if (H5Z_pipeline(pline, 0, &filter_mask, err_detect, filter_cb, &orig_chunk_size, &buf_size,
+ &fb_info.fill_buf) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed")
#if H5_SIZEOF_SIZE_T > 4
/* Check for the chunk expanding too much to encode in a 32-bit value */
- if(orig_chunk_size > ((size_t)0xffffffff))
+ if (orig_chunk_size > ((size_t)0xffffffff))
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length")
-#endif /* H5_SIZEOF_SIZE_T > 4 */
+#endif /* H5_SIZEOF_SIZE_T > 4 */
} /* end if */
- } /* end if */
+ } /* end if */
/* Compose chunked index info struct */
- idx_info.f = dset->oloc.file;
- idx_info.pline = &dset->shared->dcpl_cache.pline;
- idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
idx_info.storage = sc;
/* Loop over all chunks */
@@ -4507,113 +4459,115 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
*
*/
chunk_size = orig_chunk_size;
- for(op_dim = 0; op_dim < space_ndims; op_dim++) {
- H5D_chunk_ud_t udata; /* User data for querying chunk info */
- unsigned u; /* Local index variable */
- int i; /* Local index variable */
+ for (op_dim = 0; op_dim < space_ndims; op_dim++) {
+ H5D_chunk_ud_t udata; /* User data for querying chunk info */
+ unsigned u; /* Local index variable */
+ int i; /* Local index variable */
/* Check if allocation along this dimension is really necessary */
- if(min_unalloc[op_dim] > max_unalloc[op_dim])
+ if (min_unalloc[op_dim] > max_unalloc[op_dim])
continue;
else {
/* Reset the chunk offset indices */
HDmemset(scaled, 0, (space_ndims * sizeof(scaled[0])));
scaled[op_dim] = min_unalloc[op_dim];
- if(has_unfilt_edge_chunks) {
+ if (has_unfilt_edge_chunks) {
/* Initialize nunfilt_edge_chunk_dims */
nunfilt_edge_chunk_dims = 0;
- for(u = 0; u < space_ndims; u++)
- if(unfilt_edge_chunk_dim[u] && scaled[u]
- == edge_chunk_scaled[u])
+ for (u = 0; u < space_ndims; u++)
+ if (unfilt_edge_chunk_dim[u] && scaled[u] == edge_chunk_scaled[u])
nunfilt_edge_chunk_dims++;
/* Initialize chunk_size and fill_buf */
- if(should_fill && !fb_info.has_vlen_fill_type) {
+ if (should_fill && !fb_info.has_vlen_fill_type) {
HDassert(fb_info_init);
HDassert(unfilt_fill_buf);
- if(nunfilt_edge_chunk_dims) {
- fill_buf = &unfilt_fill_buf;
+ if (nunfilt_edge_chunk_dims) {
+ fill_buf = &unfilt_fill_buf;
chunk_size = layout->u.chunk.size;
} /* end if */
else {
- fill_buf = &fb_info.fill_buf;
+ fill_buf = &fb_info.fill_buf;
chunk_size = orig_chunk_size;
} /* end else */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
carry = FALSE;
} /* end else */
- while(!carry) {
- hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
+ while (!carry) {
+ hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
/* Look up this chunk */
- if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
+ if (H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
#ifndef NDEBUG
/* None of the chunks should be allocated */
- if(H5D_CHUNK_IDX_NONE != sc->idx_type)
+ if (H5D_CHUNK_IDX_NONE != sc->idx_type)
HDassert(!H5F_addr_defined(udata.chunk_block.offset));
/* Make sure the chunk is really in the dataset and outside the
* original dimensions */
{
- unsigned v; /* Local index variable */
- hbool_t outside_orig = FALSE;
+ unsigned v; /* Local index variable */
+ hbool_t outside_orig = FALSE;
- for(v = 0; v < space_ndims; v++) {
+ for (v = 0; v < space_ndims; v++) {
HDassert((scaled[v] * chunk_dim[v]) < space_dim[v]);
- if((scaled[v] * chunk_dim[v]) >= old_dim[v])
+ if ((scaled[v] * chunk_dim[v]) >= old_dim[v])
outside_orig = TRUE;
} /* end for */
HDassert(outside_orig);
} /* end block */
-#endif /* NDEBUG */
+#endif /* NDEBUG */
/* Check for VL datatype & non-default fill value */
- if(fb_info_init && fb_info.has_vlen_fill_type) {
+ if (fb_info_init && fb_info.has_vlen_fill_type) {
/* Sanity check */
HDassert(should_fill);
HDassert(!unfilt_fill_buf);
#ifdef H5_HAVE_PARALLEL
- HDassert(!using_mpi); /* Can't write VL datatypes in parallel currently */
+ HDassert(!using_mpi); /* Can't write VL datatypes in parallel currently */
#endif
/* Check to make sure the buffer is large enough. It is
* possible (though ill-advised) for the filter to shrink the
* buffer.
*/
- if(fb_info.fill_buf_size < orig_chunk_size) {
- if(NULL == (fb_info.fill_buf = H5D__chunk_mem_realloc(fb_info.fill_buf, orig_chunk_size, pline)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory reallocation failed for raw data chunk")
+ if (fb_info.fill_buf_size < orig_chunk_size) {
+ if (NULL ==
+ (fb_info.fill_buf = H5D__chunk_mem_realloc(fb_info.fill_buf, orig_chunk_size, pline)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory reallocation failed for raw data chunk")
fb_info.fill_buf_size = orig_chunk_size;
} /* end if */
/* Fill the buffer with VL datatype fill values */
- if(H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf) < 0)
+ if (H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer")
/* Check if there are filters which need to be applied to the chunk */
- if((pline->nused > 0) && !nunfilt_edge_chunk_dims) {
- H5Z_EDC_t err_detect; /* Error detection info */
- H5Z_cb_t filter_cb; /* I/O filter callback function */
- size_t nbytes = orig_chunk_size;
+ if ((pline->nused > 0) && !nunfilt_edge_chunk_dims) {
+ H5Z_EDC_t err_detect; /* Error detection info */
+ H5Z_cb_t filter_cb; /* I/O filter callback function */
+ size_t nbytes = orig_chunk_size;
/* Retrieve filter settings from API context */
- if(H5CX_get_err_detect(&err_detect) < 0)
+ if (H5CX_get_err_detect(&err_detect) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get error detection info")
- if(H5CX_get_filter_cb(&filter_cb) < 0)
+ if (H5CX_get_filter_cb(&filter_cb) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O filter callback function")
/* Push the chunk through the filters */
- if(H5Z_pipeline(pline, 0, &filter_mask, err_detect, filter_cb, &nbytes, &fb_info.fill_buf_size, &fb_info.fill_buf) < 0)
+ if (H5Z_pipeline(pline, 0, &filter_mask, err_detect, filter_cb, &nbytes,
+ &fb_info.fill_buf_size, &fb_info.fill_buf) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed")
#if H5_SIZEOF_SIZE_T > 4
/* Check for the chunk expanding too much to encode in a 32-bit value */
- if(nbytes > ((size_t)0xffffffff))
+ if (nbytes > ((size_t)0xffffffff))
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length")
#endif /* H5_SIZEOF_SIZE_T > 4 */
@@ -4627,36 +4581,38 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
} /* end if */
/* Initialize the chunk information */
- udata.common.layout = &layout->u.chunk;
- udata.common.storage = sc;
- udata.common.scaled = scaled;
+ udata.common.layout = &layout->u.chunk;
+ udata.common.storage = sc;
+ udata.common.scaled = scaled;
udata.chunk_block.offset = HADDR_UNDEF;
H5_CHECKED_ASSIGN(udata.chunk_block.length, uint32_t, chunk_size, size_t);
udata.filter_mask = filter_mask;
/* Allocate the chunk (with all processes) */
- if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, scaled) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level")
+ if (H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, scaled) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level")
HDassert(H5F_addr_defined(udata.chunk_block.offset));
/* Check if fill values should be written to chunks */
- if(should_fill) {
+ if (should_fill) {
/* Sanity check */
HDassert(fb_info_init);
HDassert(udata.chunk_block.length == chunk_size);
#ifdef H5_HAVE_PARALLEL
/* Check if this file is accessed with an MPI-capable file driver */
- if(using_mpi) {
+ if (using_mpi) {
/* collect all chunk addresses to be written to
write collectively at the end */
/* allocate/resize address array if no more space left */
/* Note that if we add support for parallel filters we must
* also store an array of chunk sizes and pass it to the
* apporpriate collective write function */
- if(0 == chunk_info.num_io % 1024)
- if(NULL == (chunk_info.addr = (haddr_t *)H5MM_realloc(chunk_info.addr, (chunk_info.num_io + 1024) * sizeof(haddr_t))))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed for chunk addresses")
+ if (0 == chunk_info.num_io % 1024)
+ if (NULL == (chunk_info.addr = (haddr_t *)H5MM_realloc(
+ chunk_info.addr, (chunk_info.num_io + 1024) * sizeof(haddr_t))))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for chunk addresses")
/* Store the chunk's address for later */
chunk_info.addr[chunk_info.num_io] = udata.chunk_block.offset;
@@ -4667,62 +4623,64 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
} /* end if */
else {
#endif /* H5_HAVE_PARALLEL */
- if(H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset, chunk_size, *fill_buf) < 0)
+ if (H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW,
+ udata.chunk_block.offset, chunk_size, *fill_buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
#ifdef H5_HAVE_PARALLEL
} /* end else */
-#endif /* H5_HAVE_PARALLEL */
- } /* end if */
+#endif /* H5_HAVE_PARALLEL */
+ } /* end if */
/* Insert the chunk record into the index */
- if(need_insert && ops->insert)
- if((ops->insert)(&idx_info, &udata, dset) < 0)
+ if (need_insert && ops->insert)
+ if ((ops->insert)(&idx_info, &udata, dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index")
/* Increment indices and adjust the edge chunk state */
carry = TRUE;
- for(i = ((int)space_ndims - 1); i >= 0; --i) {
+ for (i = ((int)space_ndims - 1); i >= 0; --i) {
scaled[i]++;
- if(scaled[i] > max_unalloc[i]) {
- if((unsigned)i == op_dim)
+ if (scaled[i] > max_unalloc[i]) {
+ if ((unsigned)i == op_dim)
scaled[i] = min_unalloc[i];
else
scaled[i] = 0;
/* Check if we just left the edge in this dimension */
- if(unfilt_edge_chunk_dim[i]
- && edge_chunk_scaled[i] == max_unalloc[i]
- && scaled[i] < edge_chunk_scaled[i]) {
+ if (unfilt_edge_chunk_dim[i] && edge_chunk_scaled[i] == max_unalloc[i] &&
+ scaled[i] < edge_chunk_scaled[i]) {
nunfilt_edge_chunk_dims--;
- if(should_fill && nunfilt_edge_chunk_dims == 0 && !fb_info.has_vlen_fill_type) {
- HDassert(!H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, scaled, space_dim));
- fill_buf = &fb_info.fill_buf;
+ if (should_fill && nunfilt_edge_chunk_dims == 0 && !fb_info.has_vlen_fill_type) {
+ HDassert(
+ !H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, scaled, space_dim));
+ fill_buf = &fb_info.fill_buf;
chunk_size = orig_chunk_size;
} /* end if */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
else {
/* Check if we just entered the edge in this dimension */
- if(unfilt_edge_chunk_dim[i] && scaled[i] == edge_chunk_scaled[i]) {
+ if (unfilt_edge_chunk_dim[i] && scaled[i] == edge_chunk_scaled[i]) {
HDassert(edge_chunk_scaled[i] == max_unalloc[i]);
nunfilt_edge_chunk_dims++;
- if(should_fill && nunfilt_edge_chunk_dims == 1 && !fb_info.has_vlen_fill_type) {
- HDassert(H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, scaled, space_dim));
- fill_buf = &unfilt_fill_buf;
+ if (should_fill && nunfilt_edge_chunk_dims == 1 && !fb_info.has_vlen_fill_type) {
+ HDassert(
+ H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, scaled, space_dim));
+ fill_buf = &unfilt_fill_buf;
chunk_size = layout->u.chunk.size;
} /* end if */
- } /* end if */
+ } /* end if */
carry = FALSE;
break;
} /* end else */
- } /* end for */
- } /* end while(!carry) */
+ } /* end for */
+ } /* end while(!carry) */
/* Adjust max_unalloc so we don't allocate the same chunk twice. Also
* check if this dimension started from 0 (and hence allocated all of
* the chunks. */
- if(min_unalloc[op_dim] == 0)
+ if (min_unalloc[op_dim] == 0)
break;
else
max_unalloc[op_dim] = min_unalloc[op_dim] - 1;
@@ -4730,8 +4688,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
#ifdef H5_HAVE_PARALLEL
/* do final collective I/O */
- if(using_mpi && blocks_written)
- if(H5D__chunk_collective_fill(dset, &chunk_info, chunk_size, fb_info.fill_buf) < 0)
+ if (using_mpi && blocks_written)
+ if (H5D__chunk_collective_fill(dset, &chunk_info, chunk_size, fb_info.fill_buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
#endif /* H5_HAVE_PARALLEL */
@@ -4740,21 +4698,20 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
done:
/* Release the fill buffer info, if it's been initialized */
- if(fb_info_init && H5D__fill_term(&fb_info) < 0)
+ if (fb_info_init && H5D__fill_term(&fb_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info")
/* Free the unfiltered fill value buffer */
unfilt_fill_buf = H5D__chunk_mem_xfree(unfilt_fill_buf, &def_pline);
#ifdef H5_HAVE_PARALLEL
- if(using_mpi && chunk_info.addr)
+ if (using_mpi && chunk_info.addr)
H5MM_free(chunk_info.addr);
#endif
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_allocate() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_update_old_edge_chunks
*
@@ -4774,21 +4731,24 @@ done:
herr_t
H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
{
- hsize_t old_edge_chunk_sc[H5O_LAYOUT_NDIMS]; /* Offset of first previously incomplete chunk in each dimension */
- hsize_t max_edge_chunk_sc[H5O_LAYOUT_NDIMS]; /* largest offset of chunks that might need to be modified in each dimension */
- hbool_t new_full_dim[H5O_LAYOUT_NDIMS]; /* Whether the plane of chunks in this dimension needs to be modified */
+ hsize_t old_edge_chunk_sc[H5O_LAYOUT_NDIMS]; /* Offset of first previously incomplete chunk in each
+ dimension */
+ hsize_t max_edge_chunk_sc[H5O_LAYOUT_NDIMS]; /* largest offset of chunks that might need to be modified in
+ each dimension */
+ hbool_t new_full_dim[H5O_LAYOUT_NDIMS]; /* Whether the plane of chunks in this dimension needs to be
+ modified */
const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
- hsize_t chunk_sc[H5O_LAYOUT_NDIMS]; /* Offset of current chunk */
- const uint32_t *chunk_dim = layout->u.chunk.dim; /* Convenience pointer to chunk dimensions */
- unsigned space_ndims; /* Dataset's space rank */
- const hsize_t *space_dim; /* Dataset's dataspace dimensions */
- unsigned op_dim; /* Current operationg dimension */
- H5D_io_info_t chk_io_info; /* Chunked I/O info object */
- H5D_chunk_ud_t chk_udata; /* User data for locking chunk */
- H5D_storage_t chk_store; /* Chunk storage information */
- void *chunk; /* The file chunk */
- hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t chunk_sc[H5O_LAYOUT_NDIMS]; /* Offset of current chunk */
+ const uint32_t * chunk_dim = layout->u.chunk.dim; /* Convenience pointer to chunk dimensions */
+ unsigned space_ndims; /* Dataset's space rank */
+ const hsize_t * space_dim; /* Dataset's dataspace dimensions */
+ unsigned op_dim; /* Current operationg dimension */
+ H5D_io_info_t chk_io_info; /* Chunked I/O info object */
+ H5D_chunk_ud_t chk_udata; /* User data for locking chunk */
+ H5D_storage_t chk_store; /* Chunk storage information */
+ void * chunk; /* The file chunk */
+ hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -4797,11 +4757,10 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
H5D_CHUNK_STORAGE_INDEX_CHK(&layout->storage.u.chunk);
HDassert(dset->shared->dcpl_cache.pline.nused > 0);
- HDassert(layout->u.chunk.flags
- & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
+ HDassert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS);
/* Retrieve the dataset dimensions */
- space_dim = dset->shared->curr_dims;
+ space_dim = dset->shared->curr_dims;
space_ndims = dset->shared->ndims;
/* The last dimension in chunk_offset is always 0 */
@@ -4809,8 +4768,8 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
/* Check if any current dimensions are smaller than the chunk size, or if
* any old dimensions are 0. If so we do not have to do anything. */
- for(op_dim=0; op_dim<space_ndims; op_dim++)
- if((space_dim[op_dim] < chunk_dim[op_dim]) || old_dim[op_dim] == 0) {
+ for (op_dim = 0; op_dim < space_ndims; op_dim++)
+ if ((space_dim[op_dim] < chunk_dim[op_dim]) || old_dim[op_dim] == 0) {
/* Reset any cached chunk info for this dataset */
H5D__chunk_cinfo_cache_reset(&dset->shared->cache.chunk.last);
HGOTO_DONE(SUCCEED)
@@ -4825,12 +4784,12 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
/*
* Determine the edges of the dataset which need to be modified
*/
- for(op_dim=0; op_dim<space_ndims; op_dim++) {
+ for (op_dim = 0; op_dim < space_ndims; op_dim++) {
/* Start off with this dimension marked as not needing to be modified */
new_full_dim[op_dim] = FALSE;
/* Validate this chunk dimension */
- if(chunk_dim[op_dim] == 0)
+ if (chunk_dim[op_dim] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim)
/* Calculate offset of first previously incomplete chunk in this
@@ -4840,24 +4799,24 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
/* Calculate the largest offset of chunks that might need to be
* modified in this dimension */
max_edge_chunk_sc[op_dim] = MIN((old_dim[op_dim] - 1) / chunk_dim[op_dim],
- MAX((space_dim[op_dim] / chunk_dim[op_dim]), 1) - 1);
+ MAX((space_dim[op_dim] / chunk_dim[op_dim]), 1) - 1);
/* Check for old_dim aligned with chunk boundary in this dimension, if
* so we do not need to modify chunks along the edge in this dimension
*/
- if(old_dim[op_dim] % chunk_dim[op_dim] == 0)
+ if (old_dim[op_dim] % chunk_dim[op_dim] == 0)
continue;
/* Check if the dataspace expanded enough to cause the old edge chunks
* in this dimension to become full */
- if((space_dim[op_dim]/chunk_dim[op_dim]) >= (old_edge_chunk_sc[op_dim] + 1))
+ if ((space_dim[op_dim] / chunk_dim[op_dim]) >= (old_edge_chunk_sc[op_dim] + 1))
new_full_dim[op_dim] = TRUE;
} /* end for */
/* Main loop: fix old edge chunks */
- for(op_dim=0; op_dim<space_ndims; op_dim++) {
+ for (op_dim = 0; op_dim < space_ndims; op_dim++) {
/* Check if allocation along this dimension is really necessary */
- if(!new_full_dim[op_dim])
+ if (!new_full_dim[op_dim])
continue;
else {
HDassert(max_edge_chunk_sc[op_dim] == old_edge_chunk_sc[op_dim]);
@@ -4869,50 +4828,49 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
carry = FALSE;
} /* end if */
- while(!carry) {
- int i; /* Local index variable */
+ while (!carry) {
+ int i; /* Local index variable */
/* Make sure the chunk is really a former edge chunk */
- HDassert(H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, chunk_sc, old_dim)
- && !H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, chunk_sc, space_dim));
+ HDassert(H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, chunk_sc, old_dim) &&
+ !H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, chunk_sc, space_dim));
/* Lookup the chunk */
- if(H5D__chunk_lookup(dset, chunk_sc, &chk_udata) < 0)
+ if (H5D__chunk_lookup(dset, chunk_sc, &chk_udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
/* If this chunk does not exist in cache or on disk, no need to do
* anything */
- if(H5F_addr_defined(chk_udata.chunk_block.offset)
- || (UINT_MAX != chk_udata.idx_hint)) {
+ if (H5F_addr_defined(chk_udata.chunk_block.offset) || (UINT_MAX != chk_udata.idx_hint)) {
/* Lock the chunk into cache. H5D__chunk_lock will take care of
- * updating the chunk to no longer be an edge chunk. */
- if(NULL == (chunk = (void *)H5D__chunk_lock(&chk_io_info, &chk_udata, FALSE, TRUE)))
+ * updating the chunk to no longer be an edge chunk. */
+ if (NULL == (chunk = (void *)H5D__chunk_lock(&chk_io_info, &chk_udata, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to lock raw data chunk")
/* Unlock the chunk */
- if(H5D__chunk_unlock(&chk_io_info, &chk_udata, TRUE, chunk, (uint32_t)0) < 0)
+ if (H5D__chunk_unlock(&chk_io_info, &chk_udata, TRUE, chunk, (uint32_t)0) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to unlock raw data chunk")
} /* end if */
/* Increment indices */
carry = TRUE;
- for(i = ((int)space_ndims - 1); i >= 0; --i) {
- if((unsigned)i != op_dim) {
- ++chunk_sc[i];
- if(chunk_sc[i] > (hsize_t) max_edge_chunk_sc[i])
+ for (i = ((int)space_ndims - 1); i >= 0; --i) {
+ if ((unsigned)i != op_dim) {
+ ++chunk_sc[i];
+ if (chunk_sc[i] > (hsize_t)max_edge_chunk_sc[i])
chunk_sc[i] = 0;
else {
carry = FALSE;
break;
} /* end else */
- } /* end if */
- } /* end for */
- } /* end while(!carry) */
+ } /* end if */
+ } /* end for */
+ } /* end while(!carry) */
/* Adjust max_edge_chunk_sc so we don't modify the same chunk twice.
* Also check if this dimension started from 0 (and hence modified all
* of the old edge chunks. */
- if(old_edge_chunk_sc[op_dim] == 0)
+ if (old_edge_chunk_sc[op_dim] == 0)
break;
else
--max_edge_chunk_sc[op_dim];
@@ -4942,41 +4900,41 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
- size_t chunk_size, const void *fill_buf)
+H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, size_t chunk_size,
+ const void *fill_buf)
{
- MPI_Comm mpi_comm = MPI_COMM_NULL; /* MPI communicator for file */
- int mpi_rank = (-1); /* This process's rank */
- int mpi_size = (-1); /* MPI Comm size */
- int mpi_code; /* MPI return code */
- size_t num_blocks; /* Number of blocks between processes. */
- size_t leftover_blocks; /* Number of leftover blocks to handle */
- int blocks, leftover, block_len; /* converted to int for MPI */
- MPI_Aint *chunk_disp_array = NULL;
- int *block_lens = NULL;
- MPI_Datatype mem_type = MPI_BYTE, file_type = MPI_BYTE;
- H5FD_mpio_xfer_t prev_xfer_mode; /* Previous data xfer mode */
- hbool_t have_xfer_mode = FALSE; /* Whether the previous xffer mode has been retrieved */
- hbool_t need_addr_sort = FALSE;
- int i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ MPI_Comm mpi_comm = MPI_COMM_NULL; /* MPI communicator for file */
+ int mpi_rank = (-1); /* This process's rank */
+ int mpi_size = (-1); /* MPI Comm size */
+ int mpi_code; /* MPI return code */
+ size_t num_blocks; /* Number of blocks between processes. */
+ size_t leftover_blocks; /* Number of leftover blocks to handle */
+ int blocks, leftover, block_len; /* converted to int for MPI */
+ MPI_Aint * chunk_disp_array = NULL;
+ int * block_lens = NULL;
+ MPI_Datatype mem_type = MPI_BYTE, file_type = MPI_BYTE;
+ H5FD_mpio_xfer_t prev_xfer_mode; /* Previous data xfer mode */
+ hbool_t have_xfer_mode = FALSE; /* Whether the previous xffer mode has been retrieved */
+ hbool_t need_addr_sort = FALSE;
+ int i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Get the MPI communicator */
- if(MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(dset->oloc.file)))
+ if (MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(dset->oloc.file)))
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator")
/* Get the MPI rank */
- if((mpi_rank = H5F_mpi_get_rank(dset->oloc.file)) < 0)
+ if ((mpi_rank = H5F_mpi_get_rank(dset->oloc.file)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank")
/* Get the MPI size */
- if((mpi_size = H5F_mpi_get_size(dset->oloc.file)) < 0)
+ if ((mpi_size = H5F_mpi_get_size(dset->oloc.file)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size")
/* Distribute evenly the number of blocks between processes. */
- if(mpi_size == 0)
+ if (mpi_size == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Resulted in division by zero")
num_blocks = (size_t)(chunk_info->num_io / (size_t)mpi_size); /* value should be the same on all procs */
@@ -4988,18 +4946,18 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
/* Cast values to types needed by MPI */
H5_CHECKED_ASSIGN(blocks, int, num_blocks, size_t);
H5_CHECKED_ASSIGN(leftover, int, leftover_blocks, size_t);
- H5_CHECKED_ASSIGN(block_len, int, chunk_size, size_t);
+ H5_CHECKED_ASSIGN(block_len, int, chunk_size, size_t);
/* Check if we have any chunks to write on this rank */
- if(num_blocks > 0 || (leftover && leftover > mpi_rank)) {
+ if (num_blocks > 0 || (leftover && leftover > mpi_rank)) {
/* Allocate buffers */
/* (MSC - should not need block_lens if MPI_type_create_hindexed_block is working) */
- if(NULL == (block_lens = (int *)H5MM_malloc((size_t)(blocks + 1) * sizeof(int))))
+ if (NULL == (block_lens = (int *)H5MM_malloc((size_t)(blocks + 1) * sizeof(int))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk lengths buffer")
- if(NULL == (chunk_disp_array = (MPI_Aint *)H5MM_malloc((size_t)(blocks + 1) * sizeof(MPI_Aint))))
+ if (NULL == (chunk_disp_array = (MPI_Aint *)H5MM_malloc((size_t)(blocks + 1) * sizeof(MPI_Aint))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file displacement buffer")
- for(i = 0 ; i < blocks ; i++) {
+ for (i = 0; i < blocks; i++) {
/* store the chunk address as an MPI_Aint */
chunk_disp_array[i] = (MPI_Aint)(chunk_info->addr[i + (mpi_rank * blocks)]);
@@ -5009,7 +4967,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
/* Make sure that the addresses in the datatype are
* monotonically non-decreasing
*/
- if(i && (chunk_disp_array[i] < chunk_disp_array[i - 1]))
+ if (i && (chunk_disp_array[i] < chunk_disp_array[i - 1]))
need_addr_sort = TRUE;
} /* end for */
@@ -5017,9 +4975,9 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
* distributing. If there are, then round-robin the distribution
* to processes 0 -> leftover.
*/
- if(leftover && leftover > mpi_rank) {
+ if (leftover && leftover > mpi_rank) {
chunk_disp_array[blocks] = (MPI_Aint)chunk_info->addr[(blocks * mpi_size) + mpi_rank];
- if(blocks && (chunk_disp_array[blocks] < chunk_disp_array[blocks - 1]))
+ if (blocks && (chunk_disp_array[blocks] < chunk_disp_array[blocks - 1]))
need_addr_sort = TRUE;
block_lens[blocks] = block_len;
blocks++;
@@ -5028,60 +4986,62 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
/* Ensure that the blocks are sorted in monotonically non-decreasing
* order of offset in the file.
*/
- if(need_addr_sort)
+ if (need_addr_sort)
HDqsort(chunk_disp_array, blocks, sizeof(MPI_Aint), H5D__chunk_cmp_addr);
/* MSC - should use this if MPI_type_create_hindexed block is working:
- * mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, MPI_BYTE, &file_type);
+ * mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, MPI_BYTE,
+ * &file_type);
*/
mpi_code = MPI_Type_create_hindexed(blocks, block_lens, chunk_disp_array, MPI_BYTE, &file_type);
- if(mpi_code != MPI_SUCCESS)
+ if (mpi_code != MPI_SUCCESS)
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&file_type)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&file_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
mpi_code = MPI_Type_create_hvector(blocks, block_len, 0, MPI_BYTE, &mem_type);
- if(mpi_code != MPI_SUCCESS)
+ if (mpi_code != MPI_SUCCESS)
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&mem_type)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&mem_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
} /* end if */
/* Set MPI-IO VFD properties */
/* Set MPI datatypes for operation */
- if(H5CX_set_mpi_coll_datatypes(mem_type, file_type) < 0)
+ if (H5CX_set_mpi_coll_datatypes(mem_type, file_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set MPI-I/O properties")
/* Get current transfer mode */
- if(H5CX_get_io_xfer_mode(&prev_xfer_mode) < 0)
+ if (H5CX_get_io_xfer_mode(&prev_xfer_mode) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode")
have_xfer_mode = TRUE;
/* Set transfer mode */
- if(H5CX_set_io_xfer_mode(H5FD_MPIO_COLLECTIVE) < 0)
+ if (H5CX_set_io_xfer_mode(H5FD_MPIO_COLLECTIVE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode")
/* Low-level write (collective) */
- if(H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, (haddr_t)0, (blocks) ? (size_t)1 : (size_t)0, fill_buf) < 0)
+ if (H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, (haddr_t)0,
+ (blocks) ? (size_t)1 : (size_t)0, fill_buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
/* Barrier so processes don't race ahead */
- if(MPI_SUCCESS != (mpi_code = MPI_Barrier(mpi_comm)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Barrier(mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code)
done:
- if(have_xfer_mode)
+ if (have_xfer_mode)
/* Set transfer mode */
- if(H5CX_set_io_xfer_mode(prev_xfer_mode) < 0)
+ if (H5CX_set_io_xfer_mode(prev_xfer_mode) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode")
/* free things */
- if(MPI_BYTE != file_type)
- if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type)))
+ if (MPI_BYTE != file_type)
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
- if(MPI_BYTE != mem_type)
- if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type)))
+ if (MPI_BYTE != mem_type)
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
H5MM_xfree(chunk_disp_array);
H5MM_xfree(block_lens);
@@ -5089,25 +5049,24 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_collective_fill() */
-
static int
H5D__chunk_cmp_addr(const void *addr1, const void *addr2)
{
MPI_Aint _addr1 = (MPI_Aint)0, _addr2 = (MPI_Aint)0;
- int ret_value = 0;
+ int ret_value = 0;
FUNC_ENTER_STATIC_NOERR
- _addr1 = *((const MPI_Aint *) addr1);
- _addr2 = *((const MPI_Aint *) addr2);
+ _addr1 = *((const MPI_Aint *)addr1);
+ _addr2 = *((const MPI_Aint *)addr2);
#if MPI_VERSION >= 3 && MPI_SUBVERSION >= 1
{
MPI_Aint diff = MPI_Aint_diff(_addr1, _addr2);
- if(diff < (MPI_Aint)0)
+ if (diff < (MPI_Aint)0)
ret_value = -1;
- else if(diff > (MPI_Aint)0)
+ else if (diff > (MPI_Aint)0)
ret_value = 1;
else
ret_value = 0;
@@ -5120,7 +5079,6 @@ H5D__chunk_cmp_addr(const void *addr1, const void *addr2)
} /* end H5D__chunk_cmp_addr() */
#endif /* H5_HAVE_PARALLEL */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_prune_fill
*
@@ -5137,21 +5095,21 @@ H5D__chunk_cmp_addr(const void *addr1, const void *addr2)
static herr_t
H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk)
{
- const H5D_io_info_t *io_info = udata->io_info; /* Local pointer to I/O info */
- const H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */
- const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset's layout */
- unsigned rank = udata->common.layout->ndims - 1; /* Dataset rank */
- const hsize_t *scaled = udata->common.scaled; /* Scaled chunk offset */
- H5S_sel_iter_t *chunk_iter = NULL; /* Memory selection iteration info */
- hbool_t chunk_iter_init = FALSE; /* Whether the chunk iterator has been initialized */
- hsize_t sel_nelmts; /* Number of elements in selection */
- hsize_t count[H5O_LAYOUT_NDIMS]; /* Element count of hyperslab */
- size_t chunk_size; /*size of a chunk */
- void *chunk; /* The file chunk */
- H5D_chunk_ud_t chk_udata; /* User data for locking chunk */
- uint32_t bytes_accessed; /* Bytes accessed in chunk */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5D_io_info_t *io_info = udata->io_info; /* Local pointer to I/O info */
+ const H5D_t * dset = io_info->dset; /* Local pointer to the dataset info */
+ const H5O_layout_t * layout = &(dset->shared->layout); /* Dataset's layout */
+ unsigned rank = udata->common.layout->ndims - 1; /* Dataset rank */
+ const hsize_t * scaled = udata->common.scaled; /* Scaled chunk offset */
+ H5S_sel_iter_t * chunk_iter = NULL; /* Memory selection iteration info */
+ hbool_t chunk_iter_init = FALSE; /* Whether the chunk iterator has been initialized */
+ hsize_t sel_nelmts; /* Number of elements in selection */
+ hsize_t count[H5O_LAYOUT_NDIMS]; /* Element count of hyperslab */
+ size_t chunk_size; /*size of a chunk */
+ void * chunk; /* The file chunk */
+ H5D_chunk_ud_t chk_udata; /* User data for locking chunk */
+ uint32_t bytes_accessed; /* Bytes accessed in chunk */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -5160,44 +5118,42 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk)
H5_CHECKED_ASSIGN(chunk_size, size_t, layout->u.chunk.size, uint32_t);
/* Get the info for the chunk in the file */
- if(H5D__chunk_lookup(dset, scaled, &chk_udata) < 0)
+ if (H5D__chunk_lookup(dset, scaled, &chk_udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
chk_udata.new_unfilt_chunk = new_unfilt_chunk;
/* If this chunk does not exist in cache or on disk, no need to do anything */
- if(!H5F_addr_defined(chk_udata.chunk_block.offset) && UINT_MAX == chk_udata.idx_hint)
+ if (!H5F_addr_defined(chk_udata.chunk_block.offset) && UINT_MAX == chk_udata.idx_hint)
HGOTO_DONE(SUCCEED)
/* Initialize the fill value buffer, if necessary */
- if(!udata->fb_info_init) {
+ if (!udata->fb_info_init) {
H5_CHECK_OVERFLOW(udata->elmts_per_chunk, uint32_t, size_t);
- if(H5D__fill_init(&udata->fb_info, NULL, NULL, NULL, NULL, NULL,
- &dset->shared->dcpl_cache.fill,
- dset->shared->type, dset->shared->type_id, (size_t)udata->elmts_per_chunk,
- chunk_size) < 0)
+ if (H5D__fill_init(&udata->fb_info, NULL, NULL, NULL, NULL, NULL, &dset->shared->dcpl_cache.fill,
+ dset->shared->type, dset->shared->type_id, (size_t)udata->elmts_per_chunk,
+ chunk_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
udata->fb_info_init = TRUE;
} /* end if */
/* Compute the # of elements to leave with existing value, in each dimension */
- for(u = 0; u < rank; u++) {
+ for (u = 0; u < rank; u++) {
count[u] = MIN(layout->u.chunk.dim[u], (udata->space_dim[u] - (scaled[u] * layout->u.chunk.dim[u])));
HDassert(count[u] > 0);
} /* end for */
/* Select all elements in chunk, to begin with */
- if(H5S_select_all(udata->chunk_space, TRUE) < 0)
+ if (H5S_select_all(udata->chunk_space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "unable to select space")
/* "Subtract out" the elements to keep */
- if(H5S_select_hyperslab(udata->chunk_space, H5S_SELECT_NOTB, udata->hyper_start, NULL, count, NULL) < 0)
+ if (H5S_select_hyperslab(udata->chunk_space, H5S_SELECT_NOTB, udata->hyper_start, NULL, count, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "unable to select hyperslab")
/* Lock the chunk into the cache, to get a pointer to the chunk buffer */
- if(NULL == (chunk = (void *)H5D__chunk_lock(io_info, &chk_udata, FALSE, FALSE)))
+ if (NULL == (chunk = (void *)H5D__chunk_lock(io_info, &chk_udata, FALSE, FALSE)))
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to lock raw data chunk")
-
/* Fill the selection in the memory buffer */
/* Use the size of the elements in the chunk directly instead of */
/* relying on the fill.size, which might be set to 0 if there is */
@@ -5208,45 +5164,43 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk)
H5_CHECK_OVERFLOW(sel_nelmts, hsize_t, size_t);
/* Check for VL datatype & non-default fill value */
- if(udata->fb_info.has_vlen_fill_type)
+ if (udata->fb_info.has_vlen_fill_type)
/* Re-fill the buffer to use for this I/O operation */
- if(H5D__fill_refill_vl(&udata->fb_info, (size_t)sel_nelmts) < 0)
+ if (H5D__fill_refill_vl(&udata->fb_info, (size_t)sel_nelmts) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer")
/* Allocate the chunk selection iterator */
- if(NULL == (chunk_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ if (NULL == (chunk_iter = H5FL_MALLOC(H5S_sel_iter_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk selection iterator")
/* Create a selection iterator for scattering the elements to memory buffer */
- if(H5S_select_iter_init(chunk_iter, udata->chunk_space, layout->u.chunk.dim[rank], 0) < 0)
+ if (H5S_select_iter_init(chunk_iter, udata->chunk_space, layout->u.chunk.dim[rank], 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunk selection information")
chunk_iter_init = TRUE;
/* Scatter the data into memory */
- if(H5D__scatter_mem(udata->fb_info.fill_buf, chunk_iter, (size_t)sel_nelmts, chunk/*out*/) < 0)
+ if (H5D__scatter_mem(udata->fb_info.fill_buf, chunk_iter, (size_t)sel_nelmts, chunk /*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed")
-
/* The number of bytes accessed in the chunk */
/* (i.e. the bytes replaced with fill values) */
H5_CHECK_OVERFLOW(sel_nelmts, hssize_t, uint32_t);
bytes_accessed = (uint32_t)sel_nelmts * layout->u.chunk.dim[rank];
/* Release lock on chunk */
- if(H5D__chunk_unlock(io_info, &chk_udata, TRUE, chunk, bytes_accessed) < 0)
+ if (H5D__chunk_unlock(io_info, &chk_udata, TRUE, chunk, bytes_accessed) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to unlock raw data chunk")
done:
/* Release the selection iterator */
- if(chunk_iter_init && H5S_SELECT_ITER_RELEASE(chunk_iter) < 0)
+ if (chunk_iter_init && H5S_SELECT_ITER_RELEASE(chunk_iter) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- if(chunk_iter)
+ if (chunk_iter)
chunk_iter = H5FL_FREE(H5S_sel_iter_t, chunk_iter);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_prune_fill */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_prune_by_extent
*
@@ -5349,34 +5303,38 @@ done:
herr_t
H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
{
- hsize_t min_mod_chunk_sc[H5O_LAYOUT_NDIMS]; /* Scaled offset of first chunk to modify in each dimension */
- hsize_t max_mod_chunk_sc[H5O_LAYOUT_NDIMS]; /* Scaled offset of last chunk to modify in each dimension */
- hssize_t max_fill_chunk_sc[H5O_LAYOUT_NDIMS]; /* Scaled offset of last chunk that might be filled in each dimension */
- hbool_t fill_dim[H5O_LAYOUT_NDIMS]; /* Whether the plane of edge chunks in this dimension needs to be filled */
- hsize_t min_partial_chunk_sc[H5O_LAYOUT_NDIMS]; /* Offset of first partial (or empty) chunk in each dimension */
- hbool_t new_unfilt_dim[H5O_LAYOUT_NDIMS]; /* Whether the plane of edge chunks in this dimension are newly unfiltered */
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5D_io_info_t chk_io_info; /* Chunked I/O info object */
- H5D_storage_t chk_store; /* Chunk storage information */
- const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset's layout */
- const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */
- unsigned space_ndims; /* Dataset's space rank */
- const hsize_t *space_dim; /* Current dataspace dimensions */
- unsigned op_dim; /* Current operating dimension */
- hbool_t shrunk_dim[H5O_LAYOUT_NDIMS]; /* Dimensions which have shrunk */
- H5D_chunk_it_ud1_t udata; /* Chunk index iterator user data */
- hbool_t udata_init = FALSE; /* Whether the chunk index iterator user data has been initialized */
- H5D_chunk_common_ud_t idx_udata; /* User data for index removal routine */
- H5S_t *chunk_space = NULL; /* Dataspace for a chunk */
- hsize_t chunk_dim[H5O_LAYOUT_NDIMS]; /* Chunk dimensions */
- hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Scaled offset of current chunk */
- hsize_t hyper_start[H5O_LAYOUT_NDIMS]; /* Starting location of hyperslab */
- uint32_t elmts_per_chunk; /* Elements in chunk */
- hbool_t disable_edge_filters = FALSE; /* Whether to disable filters on partial edge chunks */
- hbool_t new_unfilt_chunk = FALSE; /* Whether the chunk is newly unfiltered */
- unsigned u; /* Local index variable */
- const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk);
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t min_mod_chunk_sc[H5O_LAYOUT_NDIMS]; /* Scaled offset of first chunk to modify in each dimension */
+ hsize_t max_mod_chunk_sc[H5O_LAYOUT_NDIMS]; /* Scaled offset of last chunk to modify in each dimension */
+ hssize_t max_fill_chunk_sc[H5O_LAYOUT_NDIMS]; /* Scaled offset of last chunk that might be filled in each
+ dimension */
+ hbool_t fill_dim[H5O_LAYOUT_NDIMS]; /* Whether the plane of edge chunks in this dimension needs to be
+ filled */
+ hsize_t min_partial_chunk_sc[H5O_LAYOUT_NDIMS]; /* Offset of first partial (or empty) chunk in each
+ dimension */
+ hbool_t new_unfilt_dim[H5O_LAYOUT_NDIMS]; /* Whether the plane of edge chunks in this dimension are newly
+ unfiltered */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ H5D_io_info_t chk_io_info; /* Chunked I/O info object */
+ H5D_storage_t chk_store; /* Chunk storage information */
+ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset's layout */
+ const H5D_rdcc_t * rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */
+ unsigned space_ndims; /* Dataset's space rank */
+ const hsize_t * space_dim; /* Current dataspace dimensions */
+ unsigned op_dim; /* Current operating dimension */
+ hbool_t shrunk_dim[H5O_LAYOUT_NDIMS]; /* Dimensions which have shrunk */
+ H5D_chunk_it_ud1_t udata; /* Chunk index iterator user data */
+ hbool_t udata_init = FALSE; /* Whether the chunk index iterator user data has been initialized */
+ H5D_chunk_common_ud_t idx_udata; /* User data for index removal routine */
+ H5S_t * chunk_space = NULL; /* Dataspace for a chunk */
+ hsize_t chunk_dim[H5O_LAYOUT_NDIMS]; /* Chunk dimensions */
+ hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Scaled offset of current chunk */
+ hsize_t hyper_start[H5O_LAYOUT_NDIMS]; /* Starting location of hyperslab */
+ uint32_t elmts_per_chunk; /* Elements in chunk */
+ hbool_t disable_edge_filters = FALSE; /* Whether to disable filters on partial edge chunks */
+ hbool_t new_unfilt_chunk = FALSE; /* Whether the chunk is newly unfiltered */
+ unsigned u; /* Local index variable */
+ const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk);
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -5386,15 +5344,15 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
H5D_CHUNK_STORAGE_INDEX_CHK(sc);
/* Go get the rank & dimensions (including the element size) */
- space_dim = dset->shared->curr_dims;
+ space_dim = dset->shared->curr_dims;
space_ndims = dset->shared->ndims;
/* The last dimension in scaled is always 0 */
scaled[space_ndims] = (hsize_t)0;
/* Check if any old dimensions are 0, if so we do not have to do anything */
- for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++)
- if(old_dim[op_dim] == 0) {
+ for (op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++)
+ if (old_dim[op_dim] == 0) {
/* Reset any cached chunk info for this dataset */
H5D__chunk_cinfo_cache_reset(&dset->shared->cache.chunk.last);
HGOTO_DONE(SUCCEED)
@@ -5406,14 +5364,14 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
/* (also copy the chunk dimensions into 'hsize_t' array for creating dataspace) */
/* (also compute the dimensions which have been shrunk) */
elmts_per_chunk = 1;
- for(u = 0; u < space_ndims; u++) {
+ for (u = 0; u < space_ndims; u++) {
elmts_per_chunk *= layout->u.chunk.dim[u];
- chunk_dim[u] = layout->u.chunk.dim[u];
+ chunk_dim[u] = layout->u.chunk.dim[u];
shrunk_dim[u] = (space_dim[u] < old_dim[u]);
} /* end for */
/* Create a dataspace for a chunk & set the extent */
- if(NULL == (chunk_space = H5S_create_simple(space_ndims, chunk_dim, NULL)))
+ if (NULL == (chunk_space = H5S_create_simple(space_ndims, chunk_dim, NULL)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
/* Reset hyperslab start array */
@@ -5427,42 +5385,41 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
H5D_BUILD_IO_INFO_RD(&chk_io_info, dset, &chk_store, NULL);
/* Compose chunked index info struct */
- idx_info.f = dset->oloc.file;
- idx_info.pline = &dset->shared->dcpl_cache.pline;
- idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
idx_info.storage = &dset->shared->layout.storage.u.chunk;
/* Initialize the user data for the iteration */
HDmemset(&udata, 0, sizeof udata);
- udata.common.layout = &layout->u.chunk;
- udata.common.storage = sc;
- udata.common.scaled = scaled;
- udata.io_info = &chk_io_info;
- udata.idx_info = &idx_info;
- udata.space_dim = space_dim;
- udata.shrunk_dim = shrunk_dim;
+ udata.common.layout = &layout->u.chunk;
+ udata.common.storage = sc;
+ udata.common.scaled = scaled;
+ udata.io_info = &chk_io_info;
+ udata.idx_info = &idx_info;
+ udata.space_dim = space_dim;
+ udata.shrunk_dim = shrunk_dim;
udata.elmts_per_chunk = elmts_per_chunk;
- udata.chunk_space = chunk_space;
- udata.hyper_start = hyper_start;
- udata_init = TRUE;
+ udata.chunk_space = chunk_space;
+ udata.hyper_start = hyper_start;
+ udata_init = TRUE;
/* Initialize user data for removal */
- idx_udata.layout = &layout->u.chunk;
+ idx_udata.layout = &layout->u.chunk;
idx_udata.storage = sc;
/* Determine if partial edge chunk filters are disabled */
- disable_edge_filters = (layout->u.chunk.flags
- & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS)
- && (idx_info.pline->nused > 0);
+ disable_edge_filters = (layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) &&
+ (idx_info.pline->nused > 0);
/*
* Determine the chunks which need to be filled or removed
*/
HDmemset(min_mod_chunk_sc, 0, sizeof(min_mod_chunk_sc));
HDmemset(max_mod_chunk_sc, 0, sizeof(max_mod_chunk_sc));
- for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) {
+ for (op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) {
/* Validate this chunk dimension */
- if(chunk_dim[op_dim] == 0)
+ if (chunk_dim[op_dim] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim)
/* Calculate the largest offset of chunks that might need to be
@@ -5471,13 +5428,13 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
/* Calculate the largest offset of chunks that might need to be
* filled in this dimension */
- if(0 == space_dim[op_dim])
+ if (0 == space_dim[op_dim])
max_fill_chunk_sc[op_dim] = -1;
else
- max_fill_chunk_sc[op_dim] = (hssize_t)(((MIN(space_dim[op_dim], old_dim[op_dim]) - 1)
- / chunk_dim[op_dim]));
+ max_fill_chunk_sc[op_dim] =
+ (hssize_t)(((MIN(space_dim[op_dim], old_dim[op_dim]) - 1) / chunk_dim[op_dim]));
- if(shrunk_dim[op_dim]) {
+ if (shrunk_dim[op_dim]) {
/* Calculate the smallest offset of chunks that might need to be
* modified in this dimension. Note that this array contains
* garbage for all dimensions which are not shrunk. These locations
@@ -5485,41 +5442,41 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
min_mod_chunk_sc[op_dim] = space_dim[op_dim] / chunk_dim[op_dim];
/* Determine if we need to fill chunks in this dimension */
- if((hssize_t)min_mod_chunk_sc[op_dim] == max_fill_chunk_sc[op_dim]) {
+ if ((hssize_t)min_mod_chunk_sc[op_dim] == max_fill_chunk_sc[op_dim]) {
fill_dim[op_dim] = TRUE;
/* If necessary, check if chunks in this dimension that need to
* be filled are new partial edge chunks */
- if(disable_edge_filters && old_dim[op_dim] >= (min_mod_chunk_sc[op_dim] + 1))
+ if (disable_edge_filters && old_dim[op_dim] >= (min_mod_chunk_sc[op_dim] + 1))
new_unfilt_dim[op_dim] = TRUE;
else
new_unfilt_dim[op_dim] = FALSE;
} /* end if */
else {
- fill_dim[op_dim] = FALSE;
+ fill_dim[op_dim] = FALSE;
new_unfilt_dim[op_dim] = FALSE;
} /* end else */
- } /* end if */
+ } /* end if */
else {
- fill_dim[op_dim] = FALSE;
+ fill_dim[op_dim] = FALSE;
new_unfilt_dim[op_dim] = FALSE;
} /* end else */
/* If necessary, calculate the smallest offset of non-previously full
* chunks in this dimension, so we know these chunks were previously
* unfiltered */
- if(disable_edge_filters)
+ if (disable_edge_filters)
min_partial_chunk_sc[op_dim] = old_dim[op_dim] / chunk_dim[op_dim];
} /* end for */
/* Main loop: fill or remove chunks */
- for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) {
+ for (op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) {
hbool_t dims_outside_fill[H5O_LAYOUT_NDIMS]; /* Dimensions in chunk offset outside fill dimensions */
- int ndims_outside_fill; /* Number of dimensions in chunk offset outside fill dimensions */
- hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */
+ int ndims_outside_fill; /* Number of dimensions in chunk offset outside fill dimensions */
+ hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */
/* Check if modification along this dimension is really necessary */
- if(!shrunk_dim[op_dim])
+ if (!shrunk_dim[op_dim])
continue;
else {
HDassert(max_mod_chunk_sc[op_dim] >= min_mod_chunk_sc[op_dim]);
@@ -5530,8 +5487,8 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
/* Initialize "dims_outside_fill" array */
ndims_outside_fill = 0;
- for(u = 0; u < space_ndims; u++)
- if((hssize_t)scaled[u] > max_fill_chunk_sc[u]) {
+ for (u = 0; u < space_ndims; u++)
+ if ((hssize_t)scaled[u] > max_fill_chunk_sc[u]) {
dims_outside_fill[u] = TRUE;
ndims_outside_fill++;
} /* end if */
@@ -5540,101 +5497,104 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
} /* end else */
carry = FALSE;
- while(!carry) {
- int i; /* Local index variable */
+ while (!carry) {
+ int i; /* Local index variable */
udata.common.scaled = scaled;
- if(0 == ndims_outside_fill) {
+ if (0 == ndims_outside_fill) {
HDassert(fill_dim[op_dim]);
HDassert(scaled[op_dim] == min_mod_chunk_sc[op_dim]);
/* Make sure this is an edge chunk */
- HDassert(H5D__chunk_is_partial_edge_chunk(space_ndims, layout->u.chunk.dim, scaled, space_dim));
+ HDassert(
+ H5D__chunk_is_partial_edge_chunk(space_ndims, layout->u.chunk.dim, scaled, space_dim));
/* Determine if the chunk just became an unfiltered chunk */
- if(new_unfilt_dim[op_dim]) {
+ if (new_unfilt_dim[op_dim]) {
new_unfilt_chunk = TRUE;
- for(u = 0; u < space_ndims; u++)
- if(scaled[u] == min_partial_chunk_sc[u]) {
+ for (u = 0; u < space_ndims; u++)
+ if (scaled[u] == min_partial_chunk_sc[u]) {
new_unfilt_chunk = FALSE;
break;
} /* end if */
- } /* end if */
+ } /* end if */
/* Make sure that, if we think this is a new unfiltered chunk,
* it was previously not an edge chunk */
- HDassert(!new_unfilt_dim[op_dim] || (!new_unfilt_chunk !=
- !H5D__chunk_is_partial_edge_chunk(space_ndims, layout->u.chunk.dim, scaled, old_dim)));
+ HDassert(!new_unfilt_dim[op_dim] ||
+ (!new_unfilt_chunk != !H5D__chunk_is_partial_edge_chunk(
+ space_ndims, layout->u.chunk.dim, scaled, old_dim)));
HDassert(!new_unfilt_chunk || new_unfilt_dim[op_dim]);
/* Fill the unused parts of the chunk */
- if(H5D__chunk_prune_fill(&udata, new_unfilt_chunk) < 0)
+ if (H5D__chunk_prune_fill(&udata, new_unfilt_chunk) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write fill value")
} /* end if */
else {
- H5D_chunk_ud_t chk_udata; /* User data for getting chunk info */
+ H5D_chunk_ud_t chk_udata; /* User data for getting chunk info */
#ifndef NDEBUG
/* Make sure this chunk is really outside the new dimensions */
{
hbool_t outside_dim = FALSE;
- for(u = 0; u < space_ndims; u++)
- if((scaled[u] * chunk_dim[u]) >= space_dim[u]) {
+ for (u = 0; u < space_ndims; u++)
+ if ((scaled[u] * chunk_dim[u]) >= space_dim[u]) {
outside_dim = TRUE;
break;
} /* end if */
HDassert(outside_dim);
} /* end block */
-#endif /* NDEBUG */
+#endif /* NDEBUG */
/* Check if the chunk exists in cache or on disk */
- if(H5D__chunk_lookup(dset, scaled, &chk_udata) < 0)
+ if (H5D__chunk_lookup(dset, scaled, &chk_udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk")
/* Evict the entry from the cache if present, but do not flush
* it to disk */
- if(UINT_MAX != chk_udata.idx_hint)
- if(H5D__chunk_cache_evict(dset, rdcc->slot[chk_udata.idx_hint], FALSE) < 0)
+ if (UINT_MAX != chk_udata.idx_hint)
+ if (H5D__chunk_cache_evict(dset, rdcc->slot[chk_udata.idx_hint], FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk")
/* Remove the chunk from disk, if present */
- if(H5F_addr_defined(chk_udata.chunk_block.offset)) {
+ if (H5F_addr_defined(chk_udata.chunk_block.offset)) {
/* Update the offset in idx_udata */
idx_udata.scaled = udata.common.scaled;
/* Remove the chunk from disk */
- if((sc->ops->remove)(&idx_info, &idx_udata) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to remove chunk entry from index")
+ if ((sc->ops->remove)(&idx_info, &idx_udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL,
+ "unable to remove chunk entry from index")
} /* end if */
- } /* end else */
+ } /* end else */
/* Increment indices */
carry = TRUE;
- for(i = (int)(space_ndims - 1); i >= 0; --i) {
+ for (i = (int)(space_ndims - 1); i >= 0; --i) {
scaled[i]++;
- if(scaled[i] > max_mod_chunk_sc[i]) {
+ if (scaled[i] > max_mod_chunk_sc[i]) {
/* Left maximum dimensions, "wrap around" and check if this
* dimension is no longer outside the fill dimension */
- if((unsigned)i == op_dim) {
+ if ((unsigned)i == op_dim) {
scaled[i] = min_mod_chunk_sc[i];
- if(dims_outside_fill[i] && fill_dim[i]) {
+ if (dims_outside_fill[i] && fill_dim[i]) {
dims_outside_fill[i] = FALSE;
ndims_outside_fill--;
} /* end if */
- } /* end if */
+ } /* end if */
else {
scaled[i] = 0;
- if(dims_outside_fill[i] && max_fill_chunk_sc[i] >= 0) {
+ if (dims_outside_fill[i] && max_fill_chunk_sc[i] >= 0) {
dims_outside_fill[i] = FALSE;
ndims_outside_fill--;
} /* end if */
- } /* end else */
- } /* end if */
+ } /* end else */
+ } /* end if */
else {
/* Check if we just went outside the fill dimension */
- if(!dims_outside_fill[i] && (hssize_t)scaled[i] > max_fill_chunk_sc[i]) {
+ if (!dims_outside_fill[i] && (hssize_t)scaled[i] > max_fill_chunk_sc[i]) {
dims_outside_fill[i] = TRUE;
ndims_outside_fill++;
} /* end if */
@@ -5643,13 +5603,13 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
carry = FALSE;
break;
} /* end else */
- } /* end for */
- } /* end while(!carry) */
+ } /* end for */
+ } /* end while(!carry) */
/* Adjust max_mod_chunk_sc so we don't modify the same chunk twice.
* Also check if this dimension started from 0 (and hence removed all
* of the chunks). */
- if(min_mod_chunk_sc[op_dim] == 0)
+ if (min_mod_chunk_sc[op_dim] == 0)
break;
else
max_mod_chunk_sc[op_dim] = min_mod_chunk_sc[op_dim] - 1;
@@ -5660,10 +5620,10 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
done:
/* Release resources */
- if(chunk_space && H5S_close(chunk_space) < 0)
+ if (chunk_space && H5S_close(chunk_space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
- if(udata_init)
- if(udata.fb_info_init && H5D__fill_term(&udata.fb_info) < 0)
+ if (udata_init)
+ if (udata.fb_info_init && H5D__fill_term(&udata.fb_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -5687,9 +5647,9 @@ done:
static int
H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
{
- H5D_chunk_it_ud2_t *udata = (H5D_chunk_it_ud2_t *)_udata; /* User data for callback */
- unsigned rank = udata->common.layout->ndims - 1; /* # of dimensions of dataset */
- hsize_t chunk_index;
+ H5D_chunk_it_ud2_t *udata = (H5D_chunk_it_ud2_t *)_udata; /* User data for callback */
+ unsigned rank = udata->common.layout->ndims - 1; /* # of dimensions of dataset */
+ hsize_t chunk_index;
FUNC_ENTER_STATIC_NOERR
@@ -5702,7 +5662,6 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
FUNC_LEAVE_NOAPI(H5_ITER_CONT)
} /* H5D__chunk_addrmap_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_addrmap
*
@@ -5719,11 +5678,11 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
herr_t
H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[])
{
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
- const H5D_t *dset = io_info->dset; /* Local pointer to dataset info */
- H5D_chunk_it_ud2_t udata; /* User data for iteration callback */
- H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ const H5D_t * dset = io_info->dset; /* Local pointer to dataset info */
+ H5D_chunk_it_ud2_t udata; /* User data for iteration callback */
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -5734,18 +5693,18 @@ H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[])
/* Set up user data for B-tree callback */
HDmemset(&udata, 0, sizeof(udata));
- udata.common.layout = &dset->shared->layout.u.chunk;
+ udata.common.layout = &dset->shared->layout.u.chunk;
udata.common.storage = sc;
- udata.chunk_addr = chunk_addr;
+ udata.chunk_addr = chunk_addr;
/* Compose chunked index info struct */
- idx_info.f = dset->oloc.file;
- idx_info.pline = &dset->shared->dcpl_cache.pline;
- idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
idx_info.storage = sc;
/* Iterate over chunks to build mapping of chunk addresses */
- if((sc->ops->iterate)(&idx_info, H5D__chunk_addrmap_cb, &udata) < 0)
+ if ((sc->ops->iterate)(&idx_info, H5D__chunk_addrmap_cb, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to iterate over chunk index to build address map")
done:
@@ -5753,7 +5712,6 @@ done:
} /* end H5D__chunk_addrmap() */
#endif /* H5_HAVE_PARALLEL */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_delete
*
@@ -5770,13 +5728,13 @@ done:
herr_t
H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *storage)
{
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5O_layout_t layout; /* Dataset layout message */
- hbool_t layout_read = FALSE; /* Whether the layout message was read from the file */
- H5O_pline_t pline; /* I/O pipeline message */
- hbool_t pline_read = FALSE; /* Whether the I/O pipeline message was read from the file */
- htri_t exists; /* Flag if header message of interest exists */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ H5O_layout_t layout; /* Dataset layout message */
+ hbool_t layout_read = FALSE; /* Whether the layout message was read from the file */
+ H5O_pline_t pline; /* I/O pipeline message */
+ hbool_t pline_read = FALSE; /* Whether the I/O pipeline message was read from the file */
+ htri_t exists; /* Flag if header message of interest exists */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -5787,10 +5745,10 @@ H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *storage)
H5D_CHUNK_STORAGE_INDEX_CHK(&storage->u.chunk);
/* Check for I/O pipeline message */
- if((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0)
+ if ((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to check for object header message")
- else if(exists) {
- if(NULL == H5O_msg_read_oh(f, oh, H5O_PLINE_ID, &pline))
+ else if (exists) {
+ if (NULL == H5O_msg_read_oh(f, oh, H5O_PLINE_ID, &pline))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O pipeline message")
pline_read = TRUE;
} /* end else if */
@@ -5798,10 +5756,10 @@ H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *storage)
HDmemset(&pline, 0, sizeof(pline));
/* Retrieve dataset layout message */
- if((exists = H5O_msg_exists_oh(oh, H5O_LAYOUT_ID)) < 0)
+ if ((exists = H5O_msg_exists_oh(oh, H5O_LAYOUT_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to check for object header message")
- else if(exists) {
- if(NULL == H5O_msg_read_oh(f, oh, H5O_LAYOUT_ID, &layout))
+ else if (exists) {
+ if (NULL == H5O_msg_read_oh(f, oh, H5O_LAYOUT_ID, &layout))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout message")
layout_read = TRUE;
} /* end else if */
@@ -5809,28 +5767,27 @@ H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *storage)
HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "can't find layout message")
/* Compose chunked index info struct */
- idx_info.f = f;
- idx_info.pline = &pline;
- idx_info.layout = &layout.u.chunk;
+ idx_info.f = f;
+ idx_info.pline = &pline;
+ idx_info.layout = &layout.u.chunk;
idx_info.storage = &storage->u.chunk;
/* Delete the chunked storage information in the file */
- if((storage->u.chunk.ops->idx_delete)(&idx_info) < 0)
+ if ((storage->u.chunk.ops->idx_delete)(&idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk index")
done:
/* Clean up any messages read in */
- if(pline_read)
- if(H5O_msg_reset(H5O_PLINE_ID, &pline) < 0)
+ if (pline_read)
+ if (H5O_msg_reset(H5O_PLINE_ID, &pline) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset I/O pipeline message")
- if(layout_read)
- if(H5O_msg_reset(H5O_LAYOUT_ID, &layout) < 0)
+ if (layout_read)
+ if (H5O_msg_reset(H5O_LAYOUT_ID, &layout) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout message")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_update_cache
*
@@ -5848,17 +5805,18 @@ done:
herr_t
H5D__chunk_update_cache(H5D_t *dset)
{
- H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */
- H5D_rdcc_ent_t *ent, *next; /*cache entry */
- H5D_rdcc_ent_t tmp_head; /* Sentinel entry for temporary entry list */
- H5D_rdcc_ent_t *tmp_tail; /* Tail pointer for temporary entry list */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_rdcc_t * rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */
+ H5D_rdcc_ent_t *ent, *next; /*cache entry */
+ H5D_rdcc_ent_t tmp_head; /* Sentinel entry for temporary entry list */
+ H5D_rdcc_ent_t *tmp_tail; /* Tail pointer for temporary entry list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Check args */
HDassert(dset && H5D_CHUNKED == dset->shared->layout.type);
- HDassert(dset->shared->layout.u.chunk.ndims > 0 && dset->shared->layout.u.chunk.ndims <= H5O_LAYOUT_NDIMS);
+ HDassert(dset->shared->layout.u.chunk.ndims > 0 &&
+ dset->shared->layout.u.chunk.ndims <= H5O_LAYOUT_NDIMS);
/* Check the rank */
HDassert((dset->shared->layout.u.chunk.ndims - 1) > 1);
@@ -5866,25 +5824,25 @@ H5D__chunk_update_cache(H5D_t *dset)
/* Add temporary entry list to rdcc */
(void)HDmemset(&tmp_head, 0, sizeof(tmp_head));
rdcc->tmp_head = &tmp_head;
- tmp_tail = &tmp_head;
+ tmp_tail = &tmp_head;
/* Recompute the index for each cached chunk that is in a dataset */
- for(ent = rdcc->head; ent; ent = next) {
- unsigned old_idx; /* Previous index number */
+ for (ent = rdcc->head; ent; ent = next) {
+ unsigned old_idx; /* Previous index number */
/* Get the pointer to the next cache entry */
next = ent->next;
/* Compute the index for the chunk entry */
- old_idx = ent->idx; /* Save for later */
+ old_idx = ent->idx; /* Save for later */
ent->idx = H5D__chunk_hash_val(dset->shared, ent->scaled);
- if(old_idx != ent->idx) {
- H5D_rdcc_ent_t *old_ent; /* Old cache entry */
+ if (old_idx != ent->idx) {
+ H5D_rdcc_ent_t *old_ent; /* Old cache entry */
/* Check if there is already a chunk at this chunk's new location */
old_ent = rdcc->slot[ent->idx];
- if(old_ent != NULL) {
+ if (old_ent != NULL) {
HDassert(old_ent->locked == FALSE);
HDassert(old_ent->deleted == FALSE);
@@ -5894,8 +5852,8 @@ H5D__chunk_update_cache(H5D_t *dset)
HDassert(!old_ent->tmp_next);
HDassert(!old_ent->tmp_prev);
tmp_tail->tmp_next = old_ent;
- old_ent->tmp_prev = tmp_tail;
- tmp_tail = old_ent;
+ old_ent->tmp_prev = tmp_tail;
+ tmp_tail = old_ent;
} /* end if */
/* Insert this chunk into correct location in hash table */
@@ -5904,13 +5862,13 @@ H5D__chunk_update_cache(H5D_t *dset)
/* If this chunk was previously on the temporary list and therefore
* not in the hash table, remove it from the temporary list.
* Otherwise clear the old hash table slot. */
- if(ent->tmp_prev) {
+ if (ent->tmp_prev) {
HDassert(tmp_head.tmp_next);
HDassert(tmp_tail != &tmp_head);
ent->tmp_prev->tmp_next = ent->tmp_next;
- if(ent->tmp_next) {
+ if (ent->tmp_next) {
ent->tmp_next->tmp_prev = ent->tmp_prev;
- ent->tmp_next = NULL;
+ ent->tmp_next = NULL;
} /* end if */
else {
HDassert(tmp_tail == ent);
@@ -5921,18 +5879,18 @@ H5D__chunk_update_cache(H5D_t *dset)
else
rdcc->slot[old_idx] = NULL;
} /* end if */
- } /* end for */
+ } /* end for */
/* tmp_tail is no longer needed, and will be invalidated by
* H5D_chunk_cache_evict anyways. */
tmp_tail = NULL;
/* Evict chunks that are still on the temporary list */
- while(tmp_head.tmp_next) {
+ while (tmp_head.tmp_next) {
ent = tmp_head.tmp_next;
/* Remove the old entry from the cache */
- if(H5D__chunk_cache_evict(dset, ent, TRUE) < 0)
+ if (H5D__chunk_cache_evict(dset, ent, TRUE) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
} /* end while */
@@ -5943,7 +5901,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_update_cache() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_copy_cb
*
@@ -5960,23 +5917,23 @@ done:
static int
H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
{
- H5D_chunk_it_ud3_t *udata = (H5D_chunk_it_ud3_t *)_udata; /* User data for callback */
- H5D_chunk_ud_t udata_dst; /* User data about new destination chunk */
- hbool_t is_vlen = FALSE; /* Whether datatype is variable-length */
- hbool_t fix_ref = FALSE; /* Whether to fix up references in the dest. file */
- hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
+ H5D_chunk_it_ud3_t *udata = (H5D_chunk_it_ud3_t *)_udata; /* User data for callback */
+ H5D_chunk_ud_t udata_dst; /* User data about new destination chunk */
+ hbool_t is_vlen = FALSE; /* Whether datatype is variable-length */
+ hbool_t fix_ref = FALSE; /* Whether to fix up references in the dest. file */
+ hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
/* General information about chunk copy */
- void *bkg = udata->bkg; /* Background buffer for datatype conversion */
- void *buf = udata->buf; /* Chunk buffer for I/O & datatype conversions */
- size_t buf_size = udata->buf_size; /* Size of chunk buffer */
- const H5O_pline_t *pline = udata->pline; /* I/O pipeline for applying filters */
+ void * bkg = udata->bkg; /* Background buffer for datatype conversion */
+ void * buf = udata->buf; /* Chunk buffer for I/O & datatype conversions */
+ size_t buf_size = udata->buf_size; /* Size of chunk buffer */
+ const H5O_pline_t *pline = udata->pline; /* I/O pipeline for applying filters */
/* needed for commpressed variable length data */
- hbool_t must_filter = FALSE; /* Whether chunk must be filtered during copy */
- size_t nbytes; /* Size of chunk in file (in bytes) */
- H5Z_cb_t filter_cb; /* Filter failure callback struct */
- int ret_value = H5_ITER_CONT; /* Return value */
+ hbool_t must_filter = FALSE; /* Whether chunk must be filtered during copy */
+ size_t nbytes; /* Size of chunk in file (in bytes) */
+ H5Z_cb_t filter_cb; /* Filter failure callback struct */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -5985,81 +5942,85 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
/* Initialize the filter callback struct */
filter_cb.op_data = NULL;
- filter_cb.func = NULL; /* no callback function when failed */
+ filter_cb.func = NULL; /* no callback function when failed */
/* Check for filtered chunks */
/* Check for an edge chunk that is not filtered */
- if(pline && pline->nused) {
+ if (pline && pline->nused) {
must_filter = TRUE;
- if((udata->common.layout->flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) &&
- H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, udata->common.layout->dim, chunk_rec->scaled, udata->dset_dims))
+ if ((udata->common.layout->flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) &&
+ H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, udata->common.layout->dim, chunk_rec->scaled,
+ udata->dset_dims))
must_filter = FALSE;
}
/* Check parameter for type conversion */
- if(udata->do_convert) {
- if(H5T_detect_class(udata->dt_src, H5T_VLEN, FALSE) > 0)
+ if (udata->do_convert) {
+ if (H5T_detect_class(udata->dt_src, H5T_VLEN, FALSE) > 0)
is_vlen = TRUE;
- else if((H5T_get_class(udata->dt_src, FALSE) == H5T_REFERENCE) && (udata->file_src != udata->idx_info_dst->f))
+ else if ((H5T_get_class(udata->dt_src, FALSE) == H5T_REFERENCE) &&
+ (udata->file_src != udata->idx_info_dst->f))
fix_ref = TRUE;
else
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy dataset elements")
} /* end if */
/* Resize the buf if it is too small to hold the data */
- if(nbytes > buf_size) {
- void *new_buf; /* New buffer for data */
+ if (nbytes > buf_size) {
+ void *new_buf; /* New buffer for data */
/* Re-allocate memory for copying the chunk */
- if(NULL == (new_buf = H5MM_realloc(udata->buf, nbytes)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed for raw data chunk")
+ if (NULL == (new_buf = H5MM_realloc(udata->buf, nbytes)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR,
+ "memory allocation failed for raw data chunk")
udata->buf = new_buf;
- if(udata->bkg) {
- if(NULL == (new_buf = H5MM_realloc(udata->bkg, nbytes)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed for raw data chunk")
+ if (udata->bkg) {
+ if (NULL == (new_buf = H5MM_realloc(udata->bkg, nbytes)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR,
+ "memory allocation failed for raw data chunk")
udata->bkg = new_buf;
- if(!udata->cpy_info->expand_ref)
+ if (!udata->cpy_info->expand_ref)
HDmemset((uint8_t *)udata->bkg + buf_size, 0, (size_t)(nbytes - buf_size));
bkg = udata->bkg;
} /* end if */
- buf = udata->buf;
+ buf = udata->buf;
udata->buf_size = buf_size = nbytes;
} /* end if */
- if(udata->chunk_in_cache && udata->chunk) {
+ if (udata->chunk_in_cache && udata->chunk) {
HDassert(!H5F_addr_defined(chunk_rec->chunk_addr));
H5MM_memcpy(buf, udata->chunk, nbytes);
udata->chunk = NULL;
}
else {
- H5D_rdcc_ent_t *ent = NULL; /* Cache entry */
- unsigned idx; /* Index of chunk in cache, if present */
- unsigned u; /* Counter */
- H5D_shared_t *shared_fo = (H5D_shared_t *)udata->cpy_info->shared_fo;
+ H5D_rdcc_ent_t *ent = NULL; /* Cache entry */
+ unsigned idx; /* Index of chunk in cache, if present */
+ unsigned u; /* Counter */
+ H5D_shared_t * shared_fo = (H5D_shared_t *)udata->cpy_info->shared_fo;
/* See if the written chunk is in the chunk cache */
- if(shared_fo && shared_fo->cache.chunk.nslots > 0) {
+ if (shared_fo && shared_fo->cache.chunk.nslots > 0) {
/* Determine the chunk's location in the hash table */
idx = H5D__chunk_hash_val(shared_fo, chunk_rec->scaled);
/* Get the chunk cache entry for that location */
ent = shared_fo->cache.chunk.slot[idx];
- if(ent) {
+ if (ent) {
/* Speculatively set the 'found' flag */
udata->chunk_in_cache = TRUE;
/* Verify that the cache entry is the correct chunk */
- for(u = 0; u < shared_fo->ndims; u++)
- if(chunk_rec->scaled[u] != ent->scaled[u]) {
+ for (u = 0; u < shared_fo->ndims; u++)
+ if (chunk_rec->scaled[u] != ent->scaled[u]) {
udata->chunk_in_cache = FALSE;
break;
} /* end if */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
- if(udata->chunk_in_cache) {
+ if (udata->chunk_in_cache) {
HDassert(H5F_addr_defined(chunk_rec->chunk_addr));
HDassert(H5F_addr_defined(ent->chunk_block.offset));
@@ -6068,33 +6029,36 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
}
else {
/* read chunk data from the source file */
- if(H5F_block_read(udata->file_src, H5FD_MEM_DRAW, chunk_rec->chunk_addr, nbytes, buf) < 0)
+ if (H5F_block_read(udata->file_src, H5FD_MEM_DRAW, chunk_rec->chunk_addr, nbytes, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk")
}
}
- /* Need to uncompress filtered variable-length & reference data elements that are not found in chunk cache */
- if(must_filter && (is_vlen || fix_ref) && !udata->chunk_in_cache) {
+ /* Need to uncompress filtered variable-length & reference data elements that are not found in chunk cache
+ */
+ if (must_filter && (is_vlen || fix_ref) && !udata->chunk_in_cache) {
unsigned filter_mask = chunk_rec->filter_mask;
- if(H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &filter_mask, H5Z_NO_EDC, filter_cb, &nbytes, &buf_size, &buf) < 0)
+ if (H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &filter_mask, H5Z_NO_EDC, filter_cb, &nbytes, &buf_size,
+ &buf) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "data pipeline read failed")
} /* end if */
/* Perform datatype conversion, if necessary */
- if(is_vlen) {
- H5T_path_t *tpath_src_mem = udata->tpath_src_mem;
- H5T_path_t *tpath_mem_dst = udata->tpath_mem_dst;
- H5S_t *buf_space = udata->buf_space;
- hid_t tid_src = udata->tid_src;
- hid_t tid_dst = udata->tid_dst;
- hid_t tid_mem = udata->tid_mem;
- void *reclaim_buf = udata->reclaim_buf;
- size_t reclaim_buf_size = udata->reclaim_buf_size;
+ if (is_vlen) {
+ H5T_path_t *tpath_src_mem = udata->tpath_src_mem;
+ H5T_path_t *tpath_mem_dst = udata->tpath_mem_dst;
+ H5S_t * buf_space = udata->buf_space;
+ hid_t tid_src = udata->tid_src;
+ hid_t tid_dst = udata->tid_dst;
+ hid_t tid_mem = udata->tid_mem;
+ void * reclaim_buf = udata->reclaim_buf;
+ size_t reclaim_buf_size = udata->reclaim_buf_size;
/* Convert from source file to memory */
H5_CHECK_OVERFLOW(udata->nelmts, uint32_t, size_t);
- if(H5T_convert(tpath_src_mem, tid_src, tid_mem, (size_t)udata->nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
+ if (H5T_convert(tpath_src_mem, tid_src, tid_mem, (size_t)udata->nelmts, (size_t)0, (size_t)0, buf,
+ bkg) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "datatype conversion failed")
/* Copy into another buffer, to reclaim memory later */
@@ -6104,19 +6068,20 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HDmemset(bkg, 0, buf_size);
/* Convert from memory to destination file */
- if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, udata->nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
+ if (H5T_convert(tpath_mem_dst, tid_mem, tid_dst, udata->nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "datatype conversion failed")
/* Reclaim space from variable length data */
- if(H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
+ if (H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, H5_ITER_ERROR, "unable to reclaim variable-length data")
} /* end if */
- else if(fix_ref) {
+ else if (fix_ref) {
/* Check for expanding references */
/* (background buffer has already been zeroed out, if not expanding) */
- if(udata->cpy_info->expand_ref) {
+ if (udata->cpy_info->expand_ref) {
/* Copy the reference elements */
- if(H5O_copy_expand_ref(udata->file_src, udata->tid_src, udata->dt_src, buf, nbytes, udata->idx_info_dst->f, bkg, udata->cpy_info) < 0)
+ if (H5O_copy_expand_ref(udata->file_src, udata->tid_src, udata->dt_src, buf, nbytes,
+ udata->idx_info_dst->f, bkg, udata->cpy_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy reference attribute")
} /* end if */
@@ -6125,48 +6090,53 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
} /* end if */
/* Set up destination chunk callback information for insertion */
- udata_dst.common.layout = udata->idx_info_dst->layout;
- udata_dst.common.storage = udata->idx_info_dst->storage;
- udata_dst.common.scaled = chunk_rec->scaled;
+ udata_dst.common.layout = udata->idx_info_dst->layout;
+ udata_dst.common.storage = udata->idx_info_dst->storage;
+ udata_dst.common.scaled = chunk_rec->scaled;
udata_dst.chunk_block.offset = HADDR_UNDEF;
udata_dst.chunk_block.length = chunk_rec->nbytes;
- udata_dst.filter_mask = chunk_rec->filter_mask;
+ udata_dst.filter_mask = chunk_rec->filter_mask;
- /* Need to compress variable-length or reference data elements or a chunk found in cache before writing to file */
- if(must_filter && (is_vlen || fix_ref || udata->chunk_in_cache) ) {
- if(H5Z_pipeline(pline, 0, &(udata_dst.filter_mask), H5Z_NO_EDC, filter_cb, &nbytes, &buf_size, &buf) < 0)
+ /* Need to compress variable-length or reference data elements or a chunk found in cache before writing to
+ * file */
+ if (must_filter && (is_vlen || fix_ref || udata->chunk_in_cache)) {
+ if (H5Z_pipeline(pline, 0, &(udata_dst.filter_mask), H5Z_NO_EDC, filter_cb, &nbytes, &buf_size,
+ &buf) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "output pipeline failed")
#if H5_SIZEOF_SIZE_T > 4
/* Check for the chunk expanding too much to encode in a 32-bit value */
- if(nbytes > ((size_t)0xffffffff))
+ if (nbytes > ((size_t)0xffffffff))
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, H5_ITER_ERROR, "chunk too large for 32-bit length")
#endif /* H5_SIZEOF_SIZE_T > 4 */
H5_CHECKED_ASSIGN(udata_dst.chunk_block.length, uint32_t, nbytes, size_t);
- udata->buf = buf;
+ udata->buf = buf;
udata->buf_size = buf_size;
} /* end if */
udata->chunk_in_cache = FALSE;
- udata_dst.chunk_idx = H5VM_array_offset_pre(udata_dst.common.layout->ndims - 1,
- udata_dst.common.layout->max_down_chunks, udata_dst.common.scaled);
+ udata_dst.chunk_idx =
+ H5VM_array_offset_pre(udata_dst.common.layout->ndims - 1, udata_dst.common.layout->max_down_chunks,
+ udata_dst.common.scaled);
/* Allocate chunk in the file */
- if(H5D__chunk_file_alloc(udata->idx_info_dst, NULL, &udata_dst.chunk_block, &need_insert, udata_dst.common.scaled) < 0)
+ if (H5D__chunk_file_alloc(udata->idx_info_dst, NULL, &udata_dst.chunk_block, &need_insert,
+ udata_dst.common.scaled) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level")
/* Write chunk data to destination file */
HDassert(H5F_addr_defined(udata_dst.chunk_block.offset));
- if(H5F_block_write(udata->idx_info_dst->f, H5FD_MEM_DRAW, udata_dst.chunk_block.offset, nbytes, buf) < 0)
+ if (H5F_block_write(udata->idx_info_dst->f, H5FD_MEM_DRAW, udata_dst.chunk_block.offset, nbytes, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to write raw data to file")
/* Set metadata tag in API context */
H5_BEGIN_TAG(H5AC__COPIED_TAG);
/* Insert chunk record into index */
- if(need_insert && udata->idx_info_dst->storage->ops->insert)
- if((udata->idx_info_dst->storage->ops->insert)(udata->idx_info_dst, &udata_dst, NULL) < 0)
- HGOTO_ERROR_TAG(H5E_DATASET, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert chunk addr into index")
+ if (need_insert && udata->idx_info_dst->storage->ops->insert)
+ if ((udata->idx_info_dst->storage->ops->insert)(udata->idx_info_dst, &udata_dst, NULL) < 0)
+ HGOTO_ERROR_TAG(H5E_DATASET, H5E_CANTINSERT, H5_ITER_ERROR,
+ "unable to insert chunk addr into index")
/* Reset metadata tag in API context */
H5_END_TAG
@@ -6175,7 +6145,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_copy_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_copy
*
@@ -6190,34 +6159,33 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src,
- H5O_layout_chunk_t *layout_src, H5F_t *f_dst, H5O_storage_chunk_t *storage_dst,
- const H5S_extent_t *ds_extent_src, const H5T_t *dt_src,
- const H5O_pline_t *pline_src, H5O_copy_t *cpy_info)
+H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk_t *layout_src, H5F_t *f_dst,
+ H5O_storage_chunk_t *storage_dst, const H5S_extent_t *ds_extent_src, const H5T_t *dt_src,
+ const H5O_pline_t *pline_src, H5O_copy_t *cpy_info)
{
- H5D_chunk_it_ud3_t udata; /* User data for iteration callback */
- H5D_chk_idx_info_t idx_info_dst; /* Dest. chunked index info */
- H5D_chk_idx_info_t idx_info_src; /* Source chunked index info */
- int sndims; /* Rank of dataspace */
- hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /* Curr. size of dataset dimensions */
- hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Curr. size of dataset dimensions */
- H5O_pline_t _pline; /* Temporary pipeline info */
- const H5O_pline_t *pline; /* Pointer to pipeline info to use */
- H5T_path_t *tpath_src_mem = NULL, *tpath_mem_dst = NULL; /* Datatype conversion paths */
- hid_t tid_src = -1; /* Datatype ID for source datatype */
- hid_t tid_dst = -1; /* Datatype ID for destination datatype */
- hid_t tid_mem = -1; /* Datatype ID for memory datatype */
- size_t buf_size; /* Size of copy buffer */
- size_t reclaim_buf_size; /* Size of reclaim buffer */
- void *buf = NULL; /* Buffer for copying data */
- void *bkg = NULL; /* Buffer for background during type conversion */
- void *reclaim_buf = NULL; /* Buffer for reclaiming data */
- H5S_t *buf_space = NULL; /* Dataspace describing buffer */
- hid_t sid_buf = -1; /* ID for buffer dataspace */
- uint32_t nelmts = 0; /* Number of elements in buffer */
- hbool_t do_convert = FALSE; /* Indicate that type conversions should be performed */
- hbool_t copy_setup_done = FALSE; /* Indicate that 'copy setup' is done */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chunk_it_ud3_t udata; /* User data for iteration callback */
+ H5D_chk_idx_info_t idx_info_dst; /* Dest. chunked index info */
+ H5D_chk_idx_info_t idx_info_src; /* Source chunked index info */
+ int sndims; /* Rank of dataspace */
+ hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /* Curr. size of dataset dimensions */
+ hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Curr. size of dataset dimensions */
+ H5O_pline_t _pline; /* Temporary pipeline info */
+ const H5O_pline_t *pline; /* Pointer to pipeline info to use */
+ H5T_path_t * tpath_src_mem = NULL, *tpath_mem_dst = NULL; /* Datatype conversion paths */
+ hid_t tid_src = -1; /* Datatype ID for source datatype */
+ hid_t tid_dst = -1; /* Datatype ID for destination datatype */
+ hid_t tid_mem = -1; /* Datatype ID for memory datatype */
+ size_t buf_size; /* Size of copy buffer */
+ size_t reclaim_buf_size; /* Size of reclaim buffer */
+ void * buf = NULL; /* Buffer for copying data */
+ void * bkg = NULL; /* Buffer for background during type conversion */
+ void * reclaim_buf = NULL; /* Buffer for reclaiming data */
+ H5S_t * buf_space = NULL; /* Dataspace describing buffer */
+ hid_t sid_buf = -1; /* ID for buffer dataspace */
+ uint32_t nelmts = 0; /* Number of elements in buffer */
+ hbool_t do_convert = FALSE; /* Indicate that type conversions should be performed */
+ hbool_t copy_setup_done = FALSE; /* Indicate that 'copy setup' is done */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -6233,7 +6201,7 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src,
HDassert(dt_src);
/* Initialize the temporary pipeline info */
- if(NULL == pline_src) {
+ if (NULL == pline_src) {
HDmemset(&_pline, 0, sizeof(_pline));
pline = &_pline;
} /* end if */
@@ -6241,118 +6209,119 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src,
pline = pline_src;
/* Layout is not created in the destination file, reset index address */
- if(H5D_chunk_idx_reset(storage_dst, TRUE) < 0)
+ if (H5D_chunk_idx_reset(storage_dst, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest")
/* Initialize layout information */
{
- unsigned ndims; /* Rank of dataspace */
+ unsigned ndims; /* Rank of dataspace */
/* Get the dim info for dataset */
- if((sndims = H5S_extent_get_dims(ds_extent_src, curr_dims, max_dims)) < 0)
+ if ((sndims = H5S_extent_get_dims(ds_extent_src, curr_dims, max_dims)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions")
H5_CHECKED_ASSIGN(ndims, unsigned, sndims, int);
/* Set the source layout chunk information */
- if(H5D__chunk_set_info_real(layout_src, ndims, curr_dims, max_dims) < 0)
+ if (H5D__chunk_set_info_real(layout_src, ndims, curr_dims, max_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info")
} /* end block */
/* Compose source & dest chunked index info structs */
- idx_info_src.f = f_src;
- idx_info_src.pline = pline;
- idx_info_src.layout = layout_src;
+ idx_info_src.f = f_src;
+ idx_info_src.pline = pline;
+ idx_info_src.layout = layout_src;
idx_info_src.storage = storage_src;
- idx_info_dst.f = f_dst;
- idx_info_dst.pline = pline; /* Use same I/O filter pipeline for dest. */
- idx_info_dst.layout = layout_src /* Use same layout for dest. */;
+ idx_info_dst.f = f_dst;
+ idx_info_dst.pline = pline; /* Use same I/O filter pipeline for dest. */
+ idx_info_dst.layout = layout_src /* Use same layout for dest. */;
idx_info_dst.storage = storage_dst;
/* Call the index-specific "copy setup" routine */
- if((storage_src->ops->copy_setup)(&idx_info_src, &idx_info_dst) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up index-specific chunk copying information")
+ if ((storage_src->ops->copy_setup)(&idx_info_src, &idx_info_dst) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to set up index-specific chunk copying information")
copy_setup_done = TRUE;
/* Create datatype ID for src datatype */
- if((tid_src = H5I_register(H5I_DATATYPE, dt_src, FALSE)) < 0)
+ if ((tid_src = H5I_register(H5I_DATATYPE, dt_src, FALSE)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register source file datatype")
/* If there's a VLEN source datatype, set up type conversion information */
- if(H5T_detect_class(dt_src, H5T_VLEN, FALSE) > 0) {
- H5T_t *dt_dst; /* Destination datatype */
- H5T_t *dt_mem; /* Memory datatype */
- size_t mem_dt_size; /* Memory datatype size */
- size_t tmp_dt_size; /* Temp. datatype size */
- size_t max_dt_size; /* Max atatype size */
- hsize_t buf_dim; /* Dimension for buffer */
+ if (H5T_detect_class(dt_src, H5T_VLEN, FALSE) > 0) {
+ H5T_t * dt_dst; /* Destination datatype */
+ H5T_t * dt_mem; /* Memory datatype */
+ size_t mem_dt_size; /* Memory datatype size */
+ size_t tmp_dt_size; /* Temp. datatype size */
+ size_t max_dt_size; /* Max atatype size */
+ hsize_t buf_dim; /* Dimension for buffer */
unsigned u;
/* create a memory copy of the variable-length datatype */
- if(NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
+ if (NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) {
+ if ((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) {
(void)H5T_close_real(dt_mem);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype")
} /* end if */
/* create variable-length datatype at the destinaton file */
- if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
+ if (NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if(H5T_set_loc(dt_dst, H5F_VOL_OBJ(f_dst), H5T_LOC_DISK) < 0) {
+ if (H5T_set_loc(dt_dst, H5F_VOL_OBJ(f_dst), H5T_LOC_DISK) < 0) {
(void)H5T_close_real(dt_dst);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
} /* end if */
- if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) {
+ if ((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) {
(void)H5T_close_real(dt_dst);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype")
} /* end if */
/* Set up the conversion functions */
- if(NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem)))
+ if (NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes")
- if(NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst)))
+ if (NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes")
/* Determine largest datatype size */
- if(0 == (max_dt_size = H5T_get_size(dt_src)))
+ if (0 == (max_dt_size = H5T_get_size(dt_src)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
- if(0 == (mem_dt_size = H5T_get_size(dt_mem)))
+ if (0 == (mem_dt_size = H5T_get_size(dt_mem)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
max_dt_size = MAX(max_dt_size, mem_dt_size);
- if(0 == (tmp_dt_size = H5T_get_size(dt_dst)))
+ if (0 == (tmp_dt_size = H5T_get_size(dt_dst)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
max_dt_size = MAX(max_dt_size, tmp_dt_size);
/* Compute the number of elements per chunk */
nelmts = 1;
- for(u = 0; u < (layout_src->ndims - 1); u++)
+ for (u = 0; u < (layout_src->ndims - 1); u++)
nelmts *= layout_src->dim[u];
/* Create the space and set the initial extent */
buf_dim = nelmts;
- if(NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL)))
+ if (NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
/* Atomize */
- if((sid_buf = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) {
+ if ((sid_buf = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) {
(void)H5S_close(buf_space);
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
} /* end if */
/* Set initial buffer sizes */
- buf_size = nelmts * max_dt_size;
+ buf_size = nelmts * max_dt_size;
reclaim_buf_size = nelmts * mem_dt_size;
/* Allocate memory for reclaim buf */
- if(NULL == (reclaim_buf = H5MM_malloc(reclaim_buf_size)))
+ if (NULL == (reclaim_buf = H5MM_malloc(reclaim_buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk")
/* Indicate that type conversion should be performed */
do_convert = TRUE;
} /* end if */
else {
- if(H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) {
+ if (H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) {
/* Indicate that type conversion should be performed */
do_convert = TRUE;
} /* end if */
@@ -6362,69 +6331,68 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src,
} /* end else */
/* Set up conversion buffer, if appropriate */
- if(do_convert) {
+ if (do_convert) {
/* Allocate background memory for converting the chunk */
- if(NULL == (bkg = H5MM_malloc(buf_size)))
+ if (NULL == (bkg = H5MM_malloc(buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk")
/* Check for reference datatype and no expanding references & clear background buffer */
- if(!cpy_info->expand_ref &&
- ((H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) && (f_src != f_dst)))
+ if (!cpy_info->expand_ref && ((H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) && (f_src != f_dst)))
/* Reset value to zero */
HDmemset(bkg, 0, buf_size);
} /* end if */
/* Allocate memory for copying the chunk */
- if(NULL == (buf = H5MM_malloc(buf_size)))
+ if (NULL == (buf = H5MM_malloc(buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk")
/* Initialize the callback structure for the source */
HDmemset(&udata, 0, sizeof udata);
- udata.common.layout = layout_src;
- udata.common.storage = storage_src;
- udata.file_src = f_src;
- udata.idx_info_dst = &idx_info_dst;
- udata.buf = buf;
- udata.bkg = bkg;
- udata.buf_size = buf_size;
- udata.tid_src = tid_src;
- udata.tid_mem = tid_mem;
- udata.tid_dst = tid_dst;
- udata.dt_src = dt_src;
- udata.do_convert = do_convert;
- udata.tpath_src_mem = tpath_src_mem;
- udata.tpath_mem_dst = tpath_mem_dst;
- udata.reclaim_buf = reclaim_buf;
+ udata.common.layout = layout_src;
+ udata.common.storage = storage_src;
+ udata.file_src = f_src;
+ udata.idx_info_dst = &idx_info_dst;
+ udata.buf = buf;
+ udata.bkg = bkg;
+ udata.buf_size = buf_size;
+ udata.tid_src = tid_src;
+ udata.tid_mem = tid_mem;
+ udata.tid_dst = tid_dst;
+ udata.dt_src = dt_src;
+ udata.do_convert = do_convert;
+ udata.tpath_src_mem = tpath_src_mem;
+ udata.tpath_mem_dst = tpath_mem_dst;
+ udata.reclaim_buf = reclaim_buf;
udata.reclaim_buf_size = reclaim_buf_size;
- udata.buf_space = buf_space;
- udata.nelmts = nelmts;
- udata.pline = pline;
- udata.dset_ndims = (unsigned)sndims;
- udata.dset_dims = curr_dims;
- udata.cpy_info = cpy_info;
- udata.chunk_in_cache = FALSE;
- udata.chunk = NULL;
+ udata.buf_space = buf_space;
+ udata.nelmts = nelmts;
+ udata.pline = pline;
+ udata.dset_ndims = (unsigned)sndims;
+ udata.dset_dims = curr_dims;
+ udata.cpy_info = cpy_info;
+ udata.chunk_in_cache = FALSE;
+ udata.chunk = NULL;
/* Iterate over chunks to copy data */
- if((storage_src->ops->iterate)(&idx_info_src, H5D__chunk_copy_cb, &udata) < 0)
+ if ((storage_src->ops->iterate)(&idx_info_src, H5D__chunk_copy_cb, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to copy data")
/* Iterate over the chunk cache to copy data for chunks with undefined address */
- if(udata.cpy_info->shared_fo) {
- H5D_rdcc_ent_t *ent, *next;
+ if (udata.cpy_info->shared_fo) {
+ H5D_rdcc_ent_t *ent, *next;
H5D_chunk_rec_t chunk_rec;
- H5D_shared_t *shared_fo = (H5D_shared_t *)udata.cpy_info->shared_fo;
+ H5D_shared_t * shared_fo = (H5D_shared_t *)udata.cpy_info->shared_fo;
- chunk_rec.nbytes = layout_src->size;
+ chunk_rec.nbytes = layout_src->size;
chunk_rec.filter_mask = 0;
- chunk_rec.chunk_addr = HADDR_UNDEF;
+ chunk_rec.chunk_addr = HADDR_UNDEF;
- for(ent = shared_fo->cache.chunk.head; ent; ent = next) {
- if(!H5F_addr_defined(ent->chunk_block.offset)) {
+ for (ent = shared_fo->cache.chunk.head; ent; ent = next) {
+ if (!H5F_addr_defined(ent->chunk_block.offset)) {
H5MM_memcpy(chunk_rec.scaled, ent->scaled, sizeof(chunk_rec.scaled));
- udata.chunk = ent->chunk;
+ udata.chunk = ent->chunk;
udata.chunk_in_cache = TRUE;
- if(H5D__chunk_copy_cb(&chunk_rec, &udata) < 0)
+ if (H5D__chunk_copy_cb(&chunk_rec, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy chunk data in cache")
}
next = ent->next;
@@ -6436,30 +6404,30 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src,
bkg = udata.bkg;
done:
- if(sid_buf > 0 && H5I_dec_ref(sid_buf) < 0)
+ if (sid_buf > 0 && H5I_dec_ref(sid_buf) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID")
- if(tid_src > 0 && H5I_dec_ref(tid_src) < 0)
+ if (tid_src > 0 && H5I_dec_ref(tid_src) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
- if(tid_dst > 0 && H5I_dec_ref(tid_dst) < 0)
+ if (tid_dst > 0 && H5I_dec_ref(tid_dst) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
- if(tid_mem > 0 && H5I_dec_ref(tid_mem) < 0)
+ if (tid_mem > 0 && H5I_dec_ref(tid_mem) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
- if(buf)
+ if (buf)
H5MM_xfree(buf);
- if(bkg)
+ if (bkg)
H5MM_xfree(bkg);
- if(reclaim_buf)
+ if (reclaim_buf)
H5MM_xfree(reclaim_buf);
/* Clean up any index information */
- if(copy_setup_done)
- if(storage_src->ops->copy_shutdown && (storage_src->ops->copy_shutdown)(storage_src, storage_dst) < 0)
+ if (copy_setup_done)
+ if (storage_src->ops->copy_shutdown &&
+ (storage_src->ops->copy_shutdown)(storage_src, storage_dst) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to shut down index copying info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_copy() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_bh_info
*
@@ -6474,17 +6442,16 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5O_layout_t *layout,
- hsize_t *index_size)
+H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5O_layout_t *layout, hsize_t *index_size)
{
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5S_t *space = NULL; /* Dataset's dataspace */
- H5O_pline_t pline; /* I/O pipeline message */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ H5S_t * space = NULL; /* Dataset's dataspace */
+ H5O_pline_t pline; /* I/O pipeline message */
H5O_storage_chunk_t *sc = &(layout->storage.u.chunk);
- htri_t exists; /* Flag if header message of interest exists */
- hbool_t idx_info_init = FALSE; /* Whether the chunk index info has been initialized */
- hbool_t pline_read = FALSE; /* Whether the I/O pipeline message was read */
- herr_t ret_value = SUCCEED; /* Return value */
+ htri_t exists; /* Flag if header message of interest exists */
+ hbool_t idx_info_init = FALSE; /* Whether the chunk index info has been initialized */
+ hbool_t pline_read = FALSE; /* Whether the I/O pipeline message was read */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -6497,10 +6464,10 @@ H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5O_layout_t *layout,
HDassert(index_size);
/* Check for I/O pipeline message */
- if((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0)
+ if ((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
- else if(exists) {
- if(NULL == H5O_msg_read_oh(loc->file, oh, H5O_PLINE_ID, &pline))
+ else if (exists) {
+ if (NULL == H5O_msg_read_oh(loc->file, oh, H5O_PLINE_ID, &pline))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't find I/O pipeline message")
pline_read = TRUE;
} /* end else if */
@@ -6508,37 +6475,36 @@ H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5O_layout_t *layout,
HDmemset(&pline, 0, sizeof(pline));
/* Compose chunked index info struct */
- idx_info.f = loc->file;
- idx_info.pline = &pline;
- idx_info.layout = &layout->u.chunk;
+ idx_info.f = loc->file;
+ idx_info.pline = &pline;
+ idx_info.layout = &layout->u.chunk;
idx_info.storage = sc;
/* Get the dataspace for the dataset */
- if(NULL == (space = H5S_read(loc)))
+ if (NULL == (space = H5S_read(loc)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header")
/* Allocate any indexing structures */
- if(sc->ops->init && (sc->ops->init)(&idx_info, space, loc->addr) < 0)
+ if (sc->ops->init && (sc->ops->init)(&idx_info, space, loc->addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information")
idx_info_init = TRUE;
/* Get size of index structure */
- if(sc->ops->size && (sc->ops->size)(&idx_info, index_size) < 0)
+ if (sc->ops->size && (sc->ops->size)(&idx_info, index_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve chunk index info")
done:
/* Free resources, if they've been initialized */
- if(idx_info_init && sc->ops->dest && (sc->ops->dest)(&idx_info) < 0)
+ if (idx_info_init && sc->ops->dest && (sc->ops->dest)(&idx_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info")
- if(pline_read && H5O_msg_reset(H5O_PLINE_ID, &pline) < 0)
+ if (pline_read && H5O_msg_reset(H5O_PLINE_ID, &pline) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset I/O pipeline message")
- if(space && H5S_close(space) < 0)
+ if (space && H5S_close(space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_bh_info() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_dump_index_cb
*
@@ -6557,33 +6523,35 @@ done:
static int
H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
{
- H5D_chunk_it_ud4_t *udata = (H5D_chunk_it_ud4_t *)_udata; /* User data from caller */
+ H5D_chunk_it_ud4_t *udata = (H5D_chunk_it_ud4_t *)_udata; /* User data from caller */
FUNC_ENTER_STATIC_NOERR
- if(udata->stream) {
- unsigned u; /* Local index variable */
+ if (udata->stream) {
+ unsigned u; /* Local index variable */
/* Print header if not already displayed */
- if(!udata->header_displayed) {
+ if (!udata->header_displayed) {
HDfprintf(udata->stream, " Flags Bytes Address Logical Offset\n");
- HDfprintf(udata->stream, " ========== ======== ========== ==============================\n");
+ HDfprintf(udata->stream,
+ " ========== ======== ========== ==============================\n");
/* Set flag that the headers has been printed */
udata->header_displayed = TRUE;
} /* end if */
/* Print information about this chunk */
- HDfprintf(udata->stream, " 0x%08x %8" PRIu32 " %10" PRIuHADDR " [", chunk_rec->filter_mask, chunk_rec->nbytes, chunk_rec->chunk_addr);
- for(u = 0; u < udata->ndims; u++)
- HDfprintf(udata->stream, "%s%" PRIuHSIZE, (u ? ", " : ""), (chunk_rec->scaled[u] * udata->chunk_dim[u]));
+ HDfprintf(udata->stream, " 0x%08x %8" PRIu32 " %10" PRIuHADDR " [", chunk_rec->filter_mask,
+ chunk_rec->nbytes, chunk_rec->chunk_addr);
+ for (u = 0; u < udata->ndims; u++)
+ HDfprintf(udata->stream, "%s%" PRIuHSIZE, (u ? ", " : ""),
+ (chunk_rec->scaled[u] * udata->chunk_dim[u]));
HDfputs("]\n", udata->stream);
} /* end if */
FUNC_LEAVE_NOAPI(H5_ITER_CONT)
} /* H5D__chunk_dump_index_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_dump_index
*
@@ -6601,8 +6569,8 @@ H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
herr_t
H5D__chunk_dump_index(H5D_t *dset, FILE *stream)
{
- H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -6611,29 +6579,30 @@ H5D__chunk_dump_index(H5D_t *dset, FILE *stream)
H5D_CHUNK_STORAGE_INDEX_CHK(sc);
/* Only display info if stream is defined */
- if(stream) {
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5D_chunk_it_ud4_t udata; /* User data for callback */
+ if (stream) {
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ H5D_chunk_it_ud4_t udata; /* User data for callback */
/* Display info for index */
- if((sc->ops->dump)(sc, stream) < 0)
+ if ((sc->ops->dump)(sc, stream) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to dump chunk index info")
/* Compose chunked index info struct */
- idx_info.f = dset->oloc.file;
- idx_info.pline = &dset->shared->dcpl_cache.pline;
- idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
idx_info.storage = sc;
/* Set up user data for callback */
- udata.stream = stream;
+ udata.stream = stream;
udata.header_displayed = FALSE;
- udata.ndims = dset->shared->layout.u.chunk.ndims;
- udata.chunk_dim = dset->shared->layout.u.chunk.dim;
+ udata.ndims = dset->shared->layout.u.chunk.ndims;
+ udata.chunk_dim = dset->shared->layout.u.chunk.dim;
/* Iterate over index and dump chunk info */
- if((sc->ops->iterate)(&idx_info, H5D__chunk_dump_index_cb, &udata) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to dump chunk info")
+ if ((sc->ops->iterate)(&idx_info, H5D__chunk_dump_index_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL,
+ "unable to iterate over chunk index to dump chunk info")
} /* end if */
done:
@@ -6659,10 +6628,10 @@ done:
herr_t
H5D__chunk_stats(const H5D_t *dset, hbool_t headers)
{
- H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
- double miss_rate;
- char ascii[32];
- herr_t ret_value=SUCCEED; /* Return value */
+ H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
+ double miss_rate;
+ char ascii[32];
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_NOERR
@@ -6671,10 +6640,10 @@ H5D__chunk_stats(const H5D_t *dset, hbool_t headers)
if (headers) {
HDfprintf(H5DEBUG(AC), "H5D: raw data cache statistics\n");
- HDfprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s+%-8s\n",
- "Layer", "Hits", "Misses", "MissRate", "Inits", "Flushes");
- HDfprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s-%-8s\n",
- "-----", "----", "------", "--------", "-----", "-------");
+ HDfprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s+%-8s\n", "Layer", "Hits", "Misses", "MissRate",
+ "Inits", "Flushes");
+ HDfprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s-%-8s\n", "-----", "----", "------", "--------",
+ "-----", "-------");
}
#ifdef H5AC_DEBUG
@@ -6683,21 +6652,22 @@ H5D__chunk_stats(const H5D_t *dset, hbool_t headers)
#endif
if (headers) {
- if (rdcc->stats.nhits>0 || rdcc->stats.nmisses>0) {
- miss_rate = 100.0 * rdcc->stats.nmisses /
- (rdcc->stats.nhits + rdcc->stats.nmisses);
- } else {
+ if (rdcc->stats.nhits > 0 || rdcc->stats.nmisses > 0) {
+ miss_rate = 100.0 * rdcc->stats.nmisses / (rdcc->stats.nhits + rdcc->stats.nmisses);
+ }
+ else {
miss_rate = 0.0;
}
if (miss_rate > 100) {
- HDsprintf(ascii, "%7d%%", (int) (miss_rate + 0.5));
- } else {
+ HDsprintf(ascii, "%7d%%", (int)(miss_rate + 0.5));
+ }
+ else {
HDsprintf(ascii, "%7.2f%%", miss_rate);
}
- HDfprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n",
- "raw data chunks", rdcc->stats.nhits, rdcc->stats.nmisses, ascii,
- rdcc->stats.ninits, (long)(rdcc->stats.nflushes)-(long)(rdcc->stats.ninits));
+ HDfprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n", "raw data chunks", rdcc->stats.nhits,
+ rdcc->stats.nmisses, ascii, rdcc->stats.ninits,
+ (long)(rdcc->stats.nflushes) - (long)(rdcc->stats.ninits));
}
done:
@@ -6705,7 +6675,6 @@ done:
} /* end H5D__chunk_stats() */
#endif /* H5D_CHUNK_DEBUG */
-
/*-------------------------------------------------------------------------
* Function: H5D__nonexistent_readvv_cb
*
@@ -6725,36 +6694,34 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__nonexistent_readvv_cb(hsize_t H5_ATTR_UNUSED dst_off, hsize_t src_off, size_t len,
- void *_udata)
+H5D__nonexistent_readvv_cb(hsize_t H5_ATTR_UNUSED dst_off, hsize_t src_off, size_t len, void *_udata)
{
H5D_chunk_readvv_ud_t *udata = (H5D_chunk_readvv_ud_t *)_udata; /* User data for H5VM_opvv() operator */
- H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
- hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
+ hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Initialize the fill value buffer */
- if(H5D__fill_init(&fb_info, (udata->rbuf + src_off), NULL, NULL, NULL, NULL,
- &udata->dset->shared->dcpl_cache.fill, udata->dset->shared->type,
- udata->dset->shared->type_id, (size_t)0, len) < 0)
+ if (H5D__fill_init(&fb_info, (udata->rbuf + src_off), NULL, NULL, NULL, NULL,
+ &udata->dset->shared->dcpl_cache.fill, udata->dset->shared->type,
+ udata->dset->shared->type_id, (size_t)0, len) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
fb_info_init = TRUE;
/* Check for VL datatype & fill the buffer with VL datatype fill values */
- if(fb_info.has_vlen_fill_type && H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf) < 0)
+ if (fb_info.has_vlen_fill_type && H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer")
done:
/* Release the fill buffer info, if it's been initialized */
- if(fb_info_init && H5D__fill_term(&fb_info) < 0)
+ if (fb_info_init && H5D__fill_term(&fb_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__nonexistent_readvv_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__nonexistent_readvv
*
@@ -6776,12 +6743,12 @@ done:
*-------------------------------------------------------------------------
*/
static ssize_t
-H5D__nonexistent_readvv(const H5D_io_info_t *io_info,
- size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_off_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[])
+H5D__nonexistent_readvv(const H5D_io_info_t *io_info, size_t chunk_max_nseq, size_t *chunk_curr_seq,
+ size_t chunk_len_arr[], hsize_t chunk_off_arr[], size_t mem_max_nseq,
+ size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[])
{
- H5D_chunk_readvv_ud_t udata; /* User data for H5VM_opvv() operator */
- ssize_t ret_value = -1; /* Return value */
+ H5D_chunk_readvv_ud_t udata; /* User data for H5VM_opvv() operator */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_STATIC
@@ -6799,16 +6766,15 @@ H5D__nonexistent_readvv(const H5D_io_info_t *io_info,
udata.dset = io_info->dset;
/* Call generic sequence operation routine */
- if((ret_value = H5VM_opvv(chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_off_arr,
- mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr,
- H5D__nonexistent_readvv_cb, &udata)) < 0)
+ if ((ret_value = H5VM_opvv(chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_off_arr, mem_max_nseq,
+ mem_curr_seq, mem_len_arr, mem_off_arr, H5D__nonexistent_readvv_cb, &udata)) <
+ 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized fill value init")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__nonexistent_readvv() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_is_partial_edge_chunk
*
@@ -6824,11 +6790,11 @@ done:
*-------------------------------------------------------------------------
*/
static hbool_t
-H5D__chunk_is_partial_edge_chunk(unsigned dset_ndims, const uint32_t *chunk_dims,
- const hsize_t scaled[], const hsize_t *dset_dims)
+H5D__chunk_is_partial_edge_chunk(unsigned dset_ndims, const uint32_t *chunk_dims, const hsize_t scaled[],
+ const hsize_t *dset_dims)
{
- unsigned u; /* Local index variable */
- hbool_t ret_value = FALSE; /* Return value */
+ unsigned u; /* Local index variable */
+ hbool_t ret_value = FALSE; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -6839,15 +6805,14 @@ H5D__chunk_is_partial_edge_chunk(unsigned dset_ndims, const uint32_t *chunk_dims
HDassert(chunk_dims);
/* check if this is a partial edge chunk */
- for(u = 0; u < dset_ndims; u++)
- if(((scaled[u] + 1) * chunk_dims[u]) > dset_dims[u])
+ for (u = 0; u < dset_ndims; u++)
+ if (((scaled[u] + 1) * chunk_dims[u]) > dset_dims[u])
HGOTO_DONE(TRUE);
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_is_partial_edge_chunk() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_file_alloc()
*
@@ -6864,10 +6829,10 @@ done:
*/
herr_t
H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk,
- H5F_block_t *new_chunk, hbool_t *need_insert, const hsize_t *scaled)
+ H5F_block_t *new_chunk, hbool_t *need_insert, const hsize_t *scaled)
{
- hbool_t alloc_chunk = FALSE; /* Whether to allocate chunk */
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t alloc_chunk = FALSE; /* Whether to allocate chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -6883,72 +6848,72 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old
*need_insert = FALSE;
/* Check for filters on chunks */
- if(idx_info->pline->nused > 0) {
+ if (idx_info->pline->nused > 0) {
/* Sanity/error checking block */
- HDassert(idx_info->storage->idx_type != H5D_CHUNK_IDX_NONE);
+ HDassert(idx_info->storage->idx_type != H5D_CHUNK_IDX_NONE);
{
- unsigned allow_chunk_size_len; /* Allowed size of encoded chunk size */
- unsigned new_chunk_size_len; /* Size of encoded chunk size */
+ unsigned allow_chunk_size_len; /* Allowed size of encoded chunk size */
+ unsigned new_chunk_size_len; /* Size of encoded chunk size */
/* Compute the size required for encoding the size of a chunk, allowing
* for an extra byte, in case the filter makes the chunk larger.
*/
allow_chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)(idx_info->layout->size)) + 8) / 8);
- if(allow_chunk_size_len > 8)
+ if (allow_chunk_size_len > 8)
allow_chunk_size_len = 8;
/* Compute encoded size of chunk */
new_chunk_size_len = (H5VM_log2_gen((uint64_t)(new_chunk->length)) + 8) / 8;
- if(new_chunk_size_len > 8)
+ if (new_chunk_size_len > 8)
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "encoded chunk size is more than 8 bytes?!?")
/* Check if the chunk became too large to be encoded */
- if(new_chunk_size_len > allow_chunk_size_len)
+ if (new_chunk_size_len > allow_chunk_size_len)
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk size can't be encoded")
} /* end block */
- if(old_chunk && H5F_addr_defined(old_chunk->offset)) {
+ if (old_chunk && H5F_addr_defined(old_chunk->offset)) {
/* Sanity check */
- HDassert(!H5F_addr_defined(new_chunk->offset) || H5F_addr_eq(new_chunk->offset, old_chunk->offset));
+ HDassert(!H5F_addr_defined(new_chunk->offset) ||
+ H5F_addr_eq(new_chunk->offset, old_chunk->offset));
/* Check for chunk being same size */
- if(new_chunk->length != old_chunk->length) {
+ if (new_chunk->length != old_chunk->length) {
/* Release previous chunk */
/* Only free the old location if not doing SWMR writes - otherwise
* we must keep the old chunk around in case a reader has an
* outdated version of the B-tree node
*/
- if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE))
- if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0)
+ if (!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE))
+ if (H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
alloc_chunk = TRUE;
} /* end if */
else {
/* Don't need to reallocate chunk, but send its address back up */
- if(!H5F_addr_defined(new_chunk->offset))
+ if (!H5F_addr_defined(new_chunk->offset))
new_chunk->offset = old_chunk->offset;
} /* end else */
- } /* end if */
+ } /* end if */
else {
HDassert(!H5F_addr_defined(new_chunk->offset));
alloc_chunk = TRUE;
} /* end else */
- } /* end if */
+ } /* end if */
else {
HDassert(!H5F_addr_defined(new_chunk->offset));
HDassert(new_chunk->length == idx_info->layout->size);
alloc_chunk = TRUE;
- } /* end else */
+ } /* end else */
/* Actually allocate space for the chunk in the file */
- if(alloc_chunk) {
- switch(idx_info->storage->idx_type) {
- case H5D_CHUNK_IDX_NONE:
- {
+ if (alloc_chunk) {
+ switch (idx_info->storage->idx_type) {
+ case H5D_CHUNK_IDX_NONE: {
H5D_chunk_ud_t udata;
udata.common.scaled = scaled;
- if((idx_info->storage->ops->get_addr)(idx_info, &udata) < 0)
+ if ((idx_info->storage->ops->get_addr)(idx_info, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address")
new_chunk->offset = udata.chunk_block.offset;
HDassert(new_chunk->length == udata.chunk_block.length);
@@ -6961,9 +6926,9 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old
case H5D_CHUNK_IDX_BTREE:
case H5D_CHUNK_IDX_SINGLE:
HDassert(new_chunk->length > 0);
- H5_CHECK_OVERFLOW(new_chunk->length, /*From: */uint32_t, /*To: */hsize_t);
+ H5_CHECK_OVERFLOW(new_chunk->length, /*From: */ uint32_t, /*To: */ hsize_t);
new_chunk->offset = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, (hsize_t)new_chunk->length);
- if(!H5F_addr_defined(new_chunk->offset))
+ if (!H5F_addr_defined(new_chunk->offset))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed")
*need_insert = TRUE;
break;
@@ -6973,7 +6938,7 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old
HDassert(0 && "This should never be executed!");
break;
} /* end switch */
- } /* end if */
+ } /* end if */
HDassert(H5F_addr_defined(new_chunk->offset));
@@ -6981,7 +6946,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_file_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_format_convert_cb
*
@@ -6999,13 +6963,13 @@ done:
static int
H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
{
- H5D_chunk_it_ud5_t *udata = (H5D_chunk_it_ud5_t *)_udata; /* User data */
- H5D_chk_idx_info_t *new_idx_info; /* The new chunk index information */
- H5D_chunk_ud_t insert_udata; /* Chunk information to be inserted */
- haddr_t chunk_addr; /* Chunk address */
- size_t nbytes; /* Chunk size */
- void *buf = NULL; /* Pointer to buffer of chunk data */
- int ret_value = H5_ITER_CONT; /* Return value */
+ H5D_chunk_it_ud5_t *udata = (H5D_chunk_it_ud5_t *)_udata; /* User data */
+ H5D_chk_idx_info_t *new_idx_info; /* The new chunk index information */
+ H5D_chunk_ud_t insert_udata; /* Chunk information to be inserted */
+ haddr_t chunk_addr; /* Chunk address */
+ size_t nbytes; /* Chunk size */
+ void * buf = NULL; /* Pointer to buffer of chunk data */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -7015,32 +6979,35 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
chunk_addr = chunk_rec->chunk_addr;
if (new_idx_info->pline->nused &&
- (new_idx_info->layout->flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) &&
- (H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, new_idx_info->layout->dim, chunk_rec->scaled, udata->dset_dims))) {
+ (new_idx_info->layout->flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) &&
+ (H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, new_idx_info->layout->dim, chunk_rec->scaled,
+ udata->dset_dims))) {
/* This is a partial non-filtered edge chunk */
/* Convert the chunk to a filtered edge chunk for v1 B-tree chunk index */
unsigned filter_mask = chunk_rec->filter_mask;
- H5Z_cb_t filter_cb; /* Filter failure callback struct */
- size_t read_size = nbytes; /* Bytes to read */
+ H5Z_cb_t filter_cb; /* Filter failure callback struct */
+ size_t read_size = nbytes; /* Bytes to read */
HDassert(read_size == new_idx_info->layout->size);
/* Initialize the filter callback struct */
filter_cb.op_data = NULL;
- filter_cb.func = NULL; /* no callback function when failed */
+ filter_cb.func = NULL; /* no callback function when failed */
/* Allocate buffer for chunk data */
if (NULL == (buf = H5MM_malloc(read_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed for raw data chunk")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR,
+ "memory allocation failed for raw data chunk")
/* Read the non-filtered edge chunk */
if (H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk")
/* Pass the chunk through the pipeline */
- if (H5Z_pipeline(new_idx_info->pline, 0, &filter_mask, H5Z_NO_EDC, filter_cb, &nbytes, &read_size, &buf) < 0)
+ if (H5Z_pipeline(new_idx_info->pline, 0, &filter_mask, H5Z_NO_EDC, filter_cb, &nbytes, &read_size,
+ &buf) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "output pipeline failed")
#if H5_SIZEOF_SIZE_T > 4
@@ -7062,10 +7029,10 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
/* Set up chunk information for insertion to chunk index */
insert_udata.chunk_block.offset = chunk_addr;
insert_udata.chunk_block.length = nbytes;
- insert_udata.filter_mask = chunk_rec->filter_mask;
- insert_udata.common.scaled = chunk_rec->scaled;
- insert_udata.common.layout = new_idx_info->layout;
- insert_udata.common.storage = new_idx_info->storage;
+ insert_udata.filter_mask = chunk_rec->filter_mask;
+ insert_udata.common.scaled = chunk_rec->scaled;
+ insert_udata.common.layout = new_idx_info->layout;
+ insert_udata.common.storage = new_idx_info->storage;
/* Insert chunk into the v1 B-tree chunk index */
if ((new_idx_info->storage->ops->insert)(new_idx_info, &insert_udata, NULL) < 0)
@@ -7078,7 +7045,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_format_convert_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_format_convert
*
@@ -7095,8 +7061,8 @@ done:
herr_t
H5D__chunk_format_convert(H5D_t *dset, H5D_chk_idx_info_t *idx_info, H5D_chk_idx_info_t *new_idx_info)
{
- H5D_chunk_it_ud5_t udata; /* User data */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chunk_it_ud5_t udata; /* User data */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -7105,18 +7071,18 @@ H5D__chunk_format_convert(H5D_t *dset, H5D_chk_idx_info_t *idx_info, H5D_chk_idx
/* Set up user data */
udata.new_idx_info = new_idx_info;
- udata.dset_ndims = dset->shared->ndims;
- udata.dset_dims = dset->shared->curr_dims;
+ udata.dset_ndims = dset->shared->ndims;
+ udata.dset_dims = dset->shared->curr_dims;
- /* Iterate over the chunks in the current index and insert the chunk addresses into version 1 B-tree index */
- if((idx_info->storage->ops->iterate)(idx_info, H5D__chunk_format_convert_cb, &udata) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to chunk info")
+ /* Iterate over the chunks in the current index and insert the chunk addresses into version 1 B-tree index
+ */
+ if ((idx_info->storage->ops->iterate)(idx_info, H5D__chunk_format_convert_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to chunk info")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_format_convert() */
-
/*-------------------------------------------------------------------------
* Function: H5D__get_num_chunks_cb
*
@@ -7137,7 +7103,7 @@ static int
H5D__get_num_chunks_cb(const H5D_chunk_rec_t H5_ATTR_UNUSED *chunk_rec, void *_udata)
{
hsize_t *num_chunks = (hsize_t *)_udata;
- int ret_value = H5_ITER_CONT; /* Callback return value */
+ int ret_value = H5_ITER_CONT; /* Callback return value */
FUNC_ENTER_STATIC_NOERR
@@ -7148,7 +7114,6 @@ H5D__get_num_chunks_cb(const H5D_chunk_rec_t H5_ATTR_UNUSED *chunk_rec, void *_u
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__get_num_chunks_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__get_num_chunks
*
@@ -7168,11 +7133,11 @@ H5D__get_num_chunks_cb(const H5D_chunk_rec_t H5_ATTR_UNUSED *chunk_rec, void *_u
herr_t
H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_t *nchunks)
{
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
- hsize_t num_chunks = 0; /* Number of written chunks */
- H5D_rdcc_ent_t *ent; /* Cache entry */
- const H5D_rdcc_t *rdcc = NULL; /* Raw data chunk cache */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ hsize_t num_chunks = 0; /* Number of written chunks */
+ H5D_rdcc_ent_t * ent; /* Cache entry */
+ const H5D_rdcc_t * rdcc = NULL; /* Raw data chunk cache */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
@@ -7185,24 +7150,26 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_
HDassert(rdcc);
/* Search for cached chunks that haven't been written out */
- for(ent = rdcc->head; ent; ent = ent->next)
+ for (ent = rdcc->head; ent; ent = ent->next)
/* Flush the chunk out to disk, to make certain the size is correct later */
- if(H5D__chunk_flush_entry(dset, ent, FALSE) < 0)
+ if (H5D__chunk_flush_entry(dset, ent, FALSE) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer")
/* Compose chunked index info struct */
- idx_info.f = dset->oloc.file;
- idx_info.pline = &dset->shared->dcpl_cache.pline;
- idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
idx_info.storage = &dset->shared->layout.storage.u.chunk;
/* If the dataset is not written, number of chunks will be 0 */
- if(!H5F_addr_defined(idx_info.storage->idx_addr))
+ if (!H5F_addr_defined(idx_info.storage->idx_addr))
*nchunks = 0;
else {
/* Iterate over the allocated chunks */
- if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_num_chunks_cb, &num_chunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve allocated chunk information from index")
+ if ((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_num_chunks_cb,
+ &num_chunks) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "unable to retrieve allocated chunk information from index")
*nchunks = num_chunks;
}
@@ -7210,7 +7177,6 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__get_num_chunks() */
-
/*-------------------------------------------------------------------------
* Function: H5D__get_chunk_info_cb
*
@@ -7229,7 +7195,7 @@ static int
H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
{
H5D_chunk_info_iter_ud_t *chunk_info = (H5D_chunk_info_iter_ud_t *)_udata;
- int ret_value = H5_ITER_CONT; /* Callback return value */
+ int ret_value = H5_ITER_CONT; /* Callback return value */
FUNC_ENTER_STATIC_NOERR
@@ -7238,14 +7204,14 @@ H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HDassert(chunk_info);
/* If this is the queried chunk, retrieve its info and stop iterating */
- if(chunk_info->curr_idx == chunk_info->chunk_idx) {
- hsize_t ii = 0; /* Dimension index */
+ if (chunk_info->curr_idx == chunk_info->chunk_idx) {
+ hsize_t ii = 0; /* Dimension index */
/* Copy info */
chunk_info->filter_mask = chunk_rec->filter_mask;
- chunk_info->chunk_addr = chunk_rec->chunk_addr;
- chunk_info->nbytes = chunk_rec->nbytes;
- for(ii = 0; ii < chunk_info->ndims; ii++)
+ chunk_info->chunk_addr = chunk_rec->chunk_addr;
+ chunk_info->nbytes = chunk_rec->nbytes;
+ for (ii = 0; ii < chunk_info->ndims; ii++)
chunk_info->scaled[ii] = chunk_rec->scaled[ii];
chunk_info->found = TRUE;
@@ -7259,7 +7225,6 @@ H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__get_chunk_info_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__get_chunk_info
*
@@ -7278,14 +7243,15 @@ H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
*-------------------------------------------------------------------------
*/
herr_t
-H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_t chk_index, hsize_t *offset, unsigned *filter_mask, haddr_t *addr, hsize_t *size)
+H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_t chk_index, hsize_t *offset,
+ unsigned *filter_mask, haddr_t *addr, hsize_t *size)
{
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5D_chunk_info_iter_ud_t udata; /* User data for callback */
- const H5D_rdcc_t *rdcc = NULL; /* Raw data chunk cache */
- H5D_rdcc_ent_t *ent; /* Cache entry index */
- hsize_t ii = 0; /* Dimension index */
- herr_t ret_value = SUCCEED;/* Return value */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ H5D_chunk_info_iter_ud_t udata; /* User data for callback */
+ const H5D_rdcc_t * rdcc = NULL; /* Raw data chunk cache */
+ H5D_rdcc_ent_t * ent; /* Cache entry index */
+ hsize_t ii = 0; /* Dimension index */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
@@ -7298,15 +7264,15 @@ H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_
HDassert(rdcc);
/* Search for cached chunks that haven't been written out */
- for(ent = rdcc->head; ent; ent = ent->next)
+ for (ent = rdcc->head; ent; ent = ent->next)
/* Flush the chunk out to disk, to make certain the size is correct later */
- if(H5D__chunk_flush_entry(dset, ent, FALSE) < 0)
+ if (H5D__chunk_flush_entry(dset, ent, FALSE) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer")
/* Compose chunked index info struct */
- idx_info.f = dset->oloc.file;
- idx_info.pline = &dset->shared->dcpl_cache.pline;
- idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
idx_info.storage = &dset->shared->layout.storage.u.chunk;
/* Set addr & size for when dset is not written or queried chunk is not found */
@@ -7316,39 +7282,40 @@ H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_
*size = 0;
/* If the chunk is written, get its info, otherwise, return without error */
- if(H5F_addr_defined(idx_info.storage->idx_addr)) {
+ if (H5F_addr_defined(idx_info.storage->idx_addr)) {
/* Initialize before iteration */
- udata.chunk_idx = chk_index;
- udata.curr_idx = 0;
- udata.ndims = dset->shared->ndims;
- udata.nbytes = 0;
+ udata.chunk_idx = chk_index;
+ udata.curr_idx = 0;
+ udata.ndims = dset->shared->ndims;
+ udata.nbytes = 0;
udata.filter_mask = 0;
- udata.chunk_addr = HADDR_UNDEF;
- udata.found = FALSE;
+ udata.chunk_addr = HADDR_UNDEF;
+ udata.found = FALSE;
/* Iterate over the allocated chunks */
- if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_chunk_info_cb, &udata) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve allocated chunk information from index")
+ if ((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_chunk_info_cb, &udata) <
+ 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "unable to retrieve allocated chunk information from index")
/* Obtain requested info if the chunk is found */
- if(udata.found) {
- if(filter_mask)
+ if (udata.found) {
+ if (filter_mask)
*filter_mask = udata.filter_mask;
- if(addr)
+ if (addr)
*addr = udata.chunk_addr;
- if(size)
+ if (size)
*size = udata.nbytes;
- if(offset)
- for(ii = 0; ii < udata.ndims; ii++)
+ if (offset)
+ for (ii = 0; ii < udata.ndims; ii++)
offset[ii] = udata.scaled[ii] * dset->shared->layout.u.chunk.dim[ii];
} /* end if */
- } /* end if H5F_addr_defined */
+ } /* end if H5F_addr_defined */
done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__get_chunk_info() */
-
/*-------------------------------------------------------------------------
* Function: H5D__get_chunk_info_by_coord_cb
*
@@ -7367,9 +7334,9 @@ static int
H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
{
H5D_chunk_info_iter_ud_t *chunk_info = (H5D_chunk_info_iter_ud_t *)_udata;
- hbool_t different = FALSE; /* TRUE when a scaled value pair mismatch */
- hsize_t ii; /* Local index value */
- int ret_value = H5_ITER_CONT; /* Callback return value */
+ hbool_t different = FALSE; /* TRUE when a scaled value pair mismatch */
+ hsize_t ii; /* Local index value */
+ int ret_value = H5_ITER_CONT; /* Callback return value */
FUNC_ENTER_STATIC_NOERR
@@ -7384,10 +7351,10 @@ H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
/* Same scaled coords means the chunk is found, copy the chunk info */
if (!different) {
- chunk_info->nbytes = chunk_rec->nbytes;
+ chunk_info->nbytes = chunk_rec->nbytes;
chunk_info->filter_mask = chunk_rec->filter_mask;
- chunk_info->chunk_addr = chunk_rec->chunk_addr;
- chunk_info->found = TRUE;
+ chunk_info->chunk_addr = chunk_rec->chunk_addr;
+ chunk_info->found = TRUE;
/* Stop iterating */
ret_value = H5_ITER_STOP;
@@ -7396,7 +7363,6 @@ H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__get_chunk_info_by_coord_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__get_chunk_info_by_coord
*
@@ -7412,14 +7378,15 @@ H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
*-------------------------------------------------------------------------
*/
herr_t
-H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned* filter_mask, haddr_t *addr, hsize_t *size)
+H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned *filter_mask, haddr_t *addr,
+ hsize_t *size)
{
- const H5O_layout_t *layout = NULL; /* Dataset layout */
- const H5D_rdcc_t *rdcc = NULL; /* Raw data chunk cache */
- H5D_rdcc_ent_t *ent; /* Cache entry index */
- H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5D_chunk_info_iter_ud_t udata; /* User data for callback */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5O_layout_t * layout = NULL; /* Dataset layout */
+ const H5D_rdcc_t * rdcc = NULL; /* Raw data chunk cache */
+ H5D_rdcc_ent_t * ent; /* Cache entry index */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ H5D_chunk_info_iter_ud_t udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
@@ -7430,58 +7397,59 @@ H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned*
/* Get dataset layout and raw data chunk cache */
layout = &(dset->shared->layout);
- rdcc = &(dset->shared->cache.chunk);
+ rdcc = &(dset->shared->cache.chunk);
HDassert(layout);
HDassert(rdcc);
HDassert(H5D_CHUNKED == layout->type);
/* Search for cached chunks that haven't been written out */
- for(ent = rdcc->head; ent; ent = ent->next)
+ for (ent = rdcc->head; ent; ent = ent->next)
/* Flush the chunk out to disk, to make certain the size is correct later */
- if(H5D__chunk_flush_entry(dset, ent, FALSE) < 0)
+ if (H5D__chunk_flush_entry(dset, ent, FALSE) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer")
/* Set addr & size for when dset is not written or queried chunk is not found */
- if(addr)
+ if (addr)
*addr = HADDR_UNDEF;
- if(size)
+ if (size)
*size = 0;
/* Compose chunked index info struct */
- idx_info.f = dset->oloc.file;
- idx_info.pline = &dset->shared->dcpl_cache.pline;
- idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
idx_info.storage = &dset->shared->layout.storage.u.chunk;
/* If the dataset is not written, return without errors */
- if(H5F_addr_defined(idx_info.storage->idx_addr)) {
+ if (H5F_addr_defined(idx_info.storage->idx_addr)) {
/* Calculate the scaled of this chunk */
H5VM_chunk_scaled(dset->shared->ndims, offset, layout->u.chunk.dim, udata.scaled);
udata.scaled[dset->shared->ndims] = 0;
/* Initialize before iteration */
- udata.ndims = dset->shared->ndims;
- udata.nbytes = 0;
+ udata.ndims = dset->shared->ndims;
+ udata.nbytes = 0;
udata.filter_mask = 0;
- udata.chunk_addr = HADDR_UNDEF;
- udata.found = FALSE;
+ udata.chunk_addr = HADDR_UNDEF;
+ udata.found = FALSE;
/* Iterate over the allocated chunks to find the requested chunk */
- if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_chunk_info_by_coord_cb, &udata) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve information of the chunk by its scaled coordinates")
+ if ((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_chunk_info_by_coord_cb,
+ &udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "unable to retrieve information of the chunk by its scaled coordinates")
/* Obtain requested info if the chunk is found */
- if(udata.found) {
- if(filter_mask)
+ if (udata.found) {
+ if (filter_mask)
*filter_mask = udata.filter_mask;
- if(addr)
+ if (addr)
*addr = udata.chunk_addr;
- if(size)
+ if (size)
*size = udata.nbytes;
} /* end if */
- } /* end if H5F_addr_defined */
+ } /* end if H5F_addr_defined */
done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__get_chunk_info_by_coord() */
-
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index 1792fa2..601fffa 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -23,78 +23,61 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5VMprivate.h" /* Vector and array functions */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Dataset functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5VMprivate.h" /* Vector and array functions */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
/* Layout operation callbacks */
-static herr_t H5D__compact_construct(H5F_t *f, H5D_t *dset);
+static herr_t H5D__compact_construct(H5F_t *f, H5D_t *dset);
static hbool_t H5D__compact_is_space_alloc(const H5O_storage_t *storage);
-static herr_t H5D__compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t *cm);
-static ssize_t H5D__compact_readvv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]);
-static ssize_t H5D__compact_writevv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]);
-static herr_t H5D__compact_flush(H5D_t *dset);
-static herr_t H5D__compact_dest(H5D_t *dset);
-
+static herr_t H5D__compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ H5D_chunk_map_t *cm);
+static ssize_t H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
+ size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
+ size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]);
+static ssize_t H5D__compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
+ size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
+ size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]);
+static herr_t H5D__compact_flush(H5D_t *dset);
+static herr_t H5D__compact_dest(H5D_t *dset);
/*********************/
/* Package Variables */
/*********************/
/* Compact storage layout I/O ops */
-const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {{
- H5D__compact_construct,
- NULL,
- H5D__compact_is_space_alloc,
- NULL,
- H5D__compact_io_init,
- H5D__contig_read,
- H5D__contig_write,
+const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {
+ {H5D__compact_construct, NULL, H5D__compact_is_space_alloc, NULL, H5D__compact_io_init, H5D__contig_read,
+ H5D__contig_write,
#ifdef H5_HAVE_PARALLEL
- NULL,
- NULL,
+ NULL, NULL,
#endif /* H5_HAVE_PARALLEL */
- H5D__compact_readvv,
- H5D__compact_writevv,
- H5D__compact_flush,
- NULL,
- H5D__compact_dest
-}};
-
+ H5D__compact_readvv, H5D__compact_writevv, H5D__compact_flush, NULL, H5D__compact_dest}};
/*******************/
/* Local Variables */
@@ -103,8 +86,6 @@ const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {{
/* Declare extern the free list to manage blocks of type conversion data */
H5FL_BLK_EXTERN(type_conv);
-
-
/*-------------------------------------------------------------------------
* Function: H5D__compact_fill
*
@@ -120,9 +101,9 @@ H5FL_BLK_EXTERN(type_conv);
herr_t
H5D__compact_fill(const H5D_t *dset)
{
- H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
- hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
+ hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -134,28 +115,26 @@ H5D__compact_fill(const H5D_t *dset)
/* Initialize the fill value buffer */
/* (use the compact dataset storage buffer as the fill value buffer) */
- if(H5D__fill_init(&fb_info, dset->shared->layout.storage.u.compact.buf,
- NULL, NULL, NULL, NULL,
- &dset->shared->dcpl_cache.fill, dset->shared->type,
- dset->shared->type_id, (size_t)0, dset->shared->layout.storage.u.compact.size) < 0)
+ if (H5D__fill_init(&fb_info, dset->shared->layout.storage.u.compact.buf, NULL, NULL, NULL, NULL,
+ &dset->shared->dcpl_cache.fill, dset->shared->type, dset->shared->type_id, (size_t)0,
+ dset->shared->layout.storage.u.compact.size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
fb_info_init = TRUE;
/* Check for VL datatype & non-default fill value */
- if(fb_info.has_vlen_fill_type)
+ if (fb_info.has_vlen_fill_type)
/* Fill the buffer with VL datatype fill values */
- if(H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf) < 0)
+ if (H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer")
done:
/* Release the fill buffer info, if it's been initialized */
- if(fb_info_init && H5D__fill_term(&fb_info) < 0)
+ if (fb_info_init && H5D__fill_term(&fb_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__compact_fill() */
-
/*-------------------------------------------------------------------------
* Function: H5D__compact_construct
*
@@ -171,11 +150,11 @@ done:
static herr_t
H5D__compact_construct(H5F_t *f, H5D_t *dset)
{
- hssize_t stmp_size; /* Temporary holder for raw data size */
- hsize_t tmp_size; /* Temporary holder for raw data size */
- hsize_t max_comp_data_size; /* Max. allowed size of compact data */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ hssize_t stmp_size; /* Temporary holder for raw data size */
+ hsize_t tmp_size; /* Temporary holder for raw data size */
+ hsize_t max_comp_data_size; /* Max. allowed size of compact data */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -184,8 +163,8 @@ H5D__compact_construct(H5F_t *f, H5D_t *dset)
HDassert(dset);
/* Check for invalid dataset dimensions */
- for(u = 0; u < dset->shared->ndims; u++)
- if(dset->shared->max_dims[u] > dset->shared->curr_dims[u])
+ for (u = 0; u < dset->shared->ndims; u++)
+ if (dset->shared->max_dims[u] > dset->shared->curr_dims[u])
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "extendible compact dataset not allowed")
/*
@@ -203,14 +182,14 @@ H5D__compact_construct(H5F_t *f, H5D_t *dset)
* (64KB) minus other layout message fields.
*/
max_comp_data_size = H5O_MESG_MAX_SIZE - H5D__layout_meta_size(f, &(dset->shared->layout), FALSE);
- if(dset->shared->layout.storage.u.compact.size > max_comp_data_size)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "compact dataset size is bigger than header message maximum size")
+ if (dset->shared->layout.storage.u.compact.size > max_comp_data_size)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "compact dataset size is bigger than header message maximum size")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__compact_construct() */
-
/*-------------------------------------------------------------------------
* Function: H5D__compact_is_space_alloc
*
@@ -235,7 +214,6 @@ H5D__compact_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage)
FUNC_LEAVE_NOAPI(TRUE)
} /* end H5D__compact_is_space_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5D__compact_io_init
*
@@ -250,18 +228,17 @@ H5D__compact_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage)
*/
static herr_t
H5D__compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info,
- hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space, const H5S_t H5_ATTR_UNUSED *mem_space,
- H5D_chunk_map_t H5_ATTR_UNUSED *cm)
+ hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space,
+ const H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm)
{
FUNC_ENTER_STATIC_NOERR
- io_info->store->compact.buf = io_info->dset->shared->layout.storage.u.compact.buf;
+ io_info->store->compact.buf = io_info->dset->shared->layout.storage.u.compact.buf;
io_info->store->compact.dirty = &io_info->dset->shared->layout.storage.u.compact.dirty;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__compact_io_init() */
-
/*-------------------------------------------------------------------------
* Function: H5D__compact_readvv
*
@@ -281,25 +258,26 @@ H5D__compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR
*-------------------------------------------------------------------------
*/
static ssize_t
-H5D__compact_readvv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[])
+H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
+ size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
+ size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[])
{
- ssize_t ret_value = -1; /* Return value */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_STATIC
HDassert(io_info);
/* Use the vectorized memory copy routine to do actual work */
- if((ret_value = H5VM_memcpyvv(io_info->u.rbuf, mem_max_nseq, mem_curr_seq, mem_size_arr, mem_offset_arr, io_info->store->compact.buf, dset_max_nseq, dset_curr_seq, dset_size_arr, dset_offset_arr)) < 0)
+ if ((ret_value = H5VM_memcpyvv(io_info->u.rbuf, mem_max_nseq, mem_curr_seq, mem_size_arr, mem_offset_arr,
+ io_info->store->compact.buf, dset_max_nseq, dset_curr_seq, dset_size_arr,
+ dset_offset_arr)) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__compact_readvv() */
+} /* end H5D__compact_readvv() */
-
/*-------------------------------------------------------------------------
* Function: H5D__compact_writevv
*
@@ -322,18 +300,20 @@ done:
*-------------------------------------------------------------------------
*/
static ssize_t
-H5D__compact_writevv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[])
+H5D__compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
+ size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
+ size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[])
{
- ssize_t ret_value = -1; /* Return value */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_STATIC
HDassert(io_info);
/* Use the vectorized memory copy routine to do actual work */
- if((ret_value = H5VM_memcpyvv(io_info->store->compact.buf, dset_max_nseq, dset_curr_seq, dset_size_arr, dset_offset_arr, io_info->u.wbuf, mem_max_nseq, mem_curr_seq, mem_size_arr, mem_offset_arr)) < 0)
+ if ((ret_value = H5VM_memcpyvv(io_info->store->compact.buf, dset_max_nseq, dset_curr_seq, dset_size_arr,
+ dset_offset_arr, io_info->u.wbuf, mem_max_nseq, mem_curr_seq, mem_size_arr,
+ mem_offset_arr)) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed")
/* Mark the compact dataset's buffer as dirty */
@@ -341,9 +321,8 @@ H5D__compact_writevv(const H5D_io_info_t *io_info,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__compact_writevv() */
+} /* end H5D__compact_writevv() */
-
/*-------------------------------------------------------------------------
* Function: H5D__compact_flush
*
@@ -359,7 +338,7 @@ done:
static herr_t
H5D__compact_flush(H5D_t *dset)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -367,9 +346,9 @@ H5D__compact_flush(H5D_t *dset)
HDassert(dset);
/* Check if the buffered compact information is dirty */
- if(dset->shared->layout.storage.u.compact.dirty) {
+ if (dset->shared->layout.storage.u.compact.dirty) {
dset->shared->layout.storage.u.compact.dirty = FALSE;
- if(H5O_msg_write(&(dset->oloc), H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &(dset->shared->layout)) < 0) {
+ if (H5O_msg_write(&(dset->oloc), H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &(dset->shared->layout)) < 0) {
dset->shared->layout.storage.u.compact.dirty = TRUE;
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message")
}
@@ -379,7 +358,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__compact_flush() */
-
/*-------------------------------------------------------------------------
* Function: H5D__compact_dest
*
@@ -406,7 +384,6 @@ H5D__compact_dest(H5D_t *dset)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__compact_dest() */
-
/*-------------------------------------------------------------------------
* Function: H5D__compact_copy
*
@@ -421,18 +398,19 @@ H5D__compact_dest(H5D_t *dset)
*/
herr_t
H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_dst,
- H5O_storage_compact_t *storage_dst, H5T_t *dt_src, H5O_copy_t *cpy_info)
+ H5O_storage_compact_t *storage_dst, H5T_t *dt_src, H5O_copy_t *cpy_info)
{
- hid_t tid_src = -1; /* Datatype ID for source datatype */
- hid_t tid_dst = -1; /* Datatype ID for destination datatype */
- hid_t tid_mem = -1; /* Datatype ID for memory datatype */
- void *buf = NULL; /* Buffer for copying data */
- void *bkg = NULL; /* Temporary buffer for copying data */
- void *reclaim_buf = NULL; /* Buffer for reclaiming data */
- hid_t buf_sid = -1; /* ID for buffer dataspace */
- H5D_shared_t *shared_fo = (H5D_shared_t *)cpy_info->shared_fo; /* Pointer to the shared struct for dataset object */
- H5O_storage_compact_t *storage_src = _storage_src; /* Pointer to storage_src */
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t tid_src = -1; /* Datatype ID for source datatype */
+ hid_t tid_dst = -1; /* Datatype ID for destination datatype */
+ hid_t tid_mem = -1; /* Datatype ID for memory datatype */
+ void * buf = NULL; /* Buffer for copying data */
+ void * bkg = NULL; /* Temporary buffer for copying data */
+ void * reclaim_buf = NULL; /* Buffer for reclaiming data */
+ hid_t buf_sid = -1; /* ID for buffer dataspace */
+ H5D_shared_t *shared_fo =
+ (H5D_shared_t *)cpy_info->shared_fo; /* Pointer to the shared struct for dataset object */
+ H5O_storage_compact_t *storage_src = _storage_src; /* Pointer to storage_src */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -445,64 +423,64 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
HDassert(dt_src);
/* If the dataset is open in the file, point to "layout" in the shared struct */
- if(shared_fo != NULL)
+ if (shared_fo != NULL)
storage_src = &(shared_fo->layout.storage.u.compact);
/* Create datatype ID for src datatype, so it gets freed */
- if((tid_src = H5I_register(H5I_DATATYPE, dt_src, FALSE)) < 0)
+ if ((tid_src = H5I_register(H5I_DATATYPE, dt_src, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register source file datatype")
/* If there's a VLEN source datatype, do type conversion information */
- if(H5T_detect_class(dt_src, H5T_VLEN, FALSE) > 0) {
- H5T_path_t *tpath_src_mem, *tpath_mem_dst; /* Datatype conversion paths */
- H5T_t *dt_dst; /* Destination datatype */
- H5T_t *dt_mem; /* Memory datatype */
- H5S_t *buf_space; /* Dataspace describing buffer */
- size_t buf_size; /* Size of copy buffer */
- size_t nelmts; /* Number of elements in buffer */
- size_t src_dt_size; /* Source datatype size */
- size_t tmp_dt_size; /* Temporary datatype size */
- size_t max_dt_size; /* Max atatype size */
- hsize_t buf_dim; /* Dimension for buffer */
+ if (H5T_detect_class(dt_src, H5T_VLEN, FALSE) > 0) {
+ H5T_path_t *tpath_src_mem, *tpath_mem_dst; /* Datatype conversion paths */
+ H5T_t * dt_dst; /* Destination datatype */
+ H5T_t * dt_mem; /* Memory datatype */
+ H5S_t * buf_space; /* Dataspace describing buffer */
+ size_t buf_size; /* Size of copy buffer */
+ size_t nelmts; /* Number of elements in buffer */
+ size_t src_dt_size; /* Source datatype size */
+ size_t tmp_dt_size; /* Temporary datatype size */
+ size_t max_dt_size; /* Max atatype size */
+ hsize_t buf_dim; /* Dimension for buffer */
/* create a memory copy of the variable-length datatype */
- if(NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
+ if (NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) {
+ if ((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) {
(void)H5T_close_real(dt_mem);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype")
} /* end if */
/* create variable-length datatype at the destinaton file */
- if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
+ if (NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if(H5T_set_loc(dt_dst, H5F_VOL_OBJ(f_dst), H5T_LOC_DISK) < 0) {
+ if (H5T_set_loc(dt_dst, H5F_VOL_OBJ(f_dst), H5T_LOC_DISK) < 0) {
(void)H5T_close_real(dt_dst);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
} /* end if */
- if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) {
+ if ((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) {
(void)H5T_close_real(dt_dst);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype")
} /* end if */
/* Set up the conversion functions */
- if(NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem)))
+ if (NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes")
- if(NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst)))
+ if (NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes")
/* Determine largest datatype size */
- if(0 == (src_dt_size = H5T_get_size(dt_src)))
+ if (0 == (src_dt_size = H5T_get_size(dt_src)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
- if(0 == (tmp_dt_size = H5T_get_size(dt_mem)))
+ if (0 == (tmp_dt_size = H5T_get_size(dt_mem)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
max_dt_size = MAX(src_dt_size, tmp_dt_size);
- if(0 == (tmp_dt_size = H5T_get_size(dt_dst)))
+ if (0 == (tmp_dt_size = H5T_get_size(dt_dst)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
max_dt_size = MAX(max_dt_size, tmp_dt_size);
/* Set number of whole elements that fit in buffer */
- if(0 == (nelmts = storage_src->size / src_dt_size))
+ if (0 == (nelmts = storage_src->size / src_dt_size))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "element size too large")
/* Set up number of bytes to copy, and initial buffer size */
@@ -512,31 +490,31 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
buf_dim = nelmts;
/* Create the space and set the initial extent */
- if(NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL)))
+ if (NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
/* Atomize */
- if((buf_sid = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) {
+ if ((buf_sid = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) {
H5S_close(buf_space);
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
} /* end if */
/* Allocate memory for recclaim buf */
- if(NULL == (reclaim_buf = H5FL_BLK_MALLOC(type_conv, buf_size)))
+ if (NULL == (reclaim_buf = H5FL_BLK_MALLOC(type_conv, buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Allocate memory for copying the chunk */
- if(NULL == (buf = H5FL_BLK_MALLOC(type_conv, buf_size)))
+ if (NULL == (buf = H5FL_BLK_MALLOC(type_conv, buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
H5MM_memcpy(buf, storage_src->buf, storage_src->size);
/* allocate temporary bkg buff for data conversion */
- if(NULL == (bkg = H5FL_BLK_MALLOC(type_conv, buf_size)))
+ if (NULL == (bkg = H5FL_BLK_MALLOC(type_conv, buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Convert from source file to memory */
- if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
+ if (H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
/* Copy into another buffer, to reclaim memory later */
@@ -546,21 +524,22 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
HDmemset(bkg, 0, buf_size);
/* Convert from memory to destination file */
- if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
+ if (H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
H5MM_memcpy(storage_dst->buf, buf, storage_dst->size);
- if(H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
+ if (H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data")
} /* end if */
- else if(H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) {
- if(f_src != f_dst) {
+ else if (H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) {
+ if (f_src != f_dst) {
/* Check for expanding references */
- if(cpy_info->expand_ref) {
- /* Copy objects referenced in source buffer to destination file and set destination elements */
- if (H5O_copy_expand_ref(f_src, tid_src, dt_src, storage_src->buf,
- storage_src->size, f_dst, storage_dst->buf, cpy_info) < 0)
+ if (cpy_info->expand_ref) {
+ /* Copy objects referenced in source buffer to destination file and set destination elements
+ */
+ if (H5O_copy_expand_ref(f_src, tid_src, dt_src, storage_src->buf, storage_src->size, f_dst,
+ storage_dst->buf, cpy_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute")
} /* end if */
else
@@ -579,21 +558,20 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
storage_dst->dirty = TRUE;
done:
- if(buf_sid > 0 && H5I_dec_ref(buf_sid) < 0)
+ if (buf_sid > 0 && H5I_dec_ref(buf_sid) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID")
- if(tid_src > 0 && H5I_dec_ref(tid_src) < 0)
+ if (tid_src > 0 && H5I_dec_ref(tid_src) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
- if(tid_dst > 0 && H5I_dec_ref(tid_dst) < 0)
+ if (tid_dst > 0 && H5I_dec_ref(tid_dst) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
- if(tid_mem > 0 && H5I_dec_ref(tid_mem) < 0)
+ if (tid_mem > 0 && H5I_dec_ref(tid_mem) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
- if(buf)
+ if (buf)
buf = H5FL_BLK_FREE(type_conv, buf);
- if(reclaim_buf)
+ if (reclaim_buf)
reclaim_buf = H5FL_BLK_FREE(type_conv, reclaim_buf);
- if(bkg)
+ if (bkg)
bkg = H5FL_BLK_FREE(type_conv, bkg);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__compact_copy() */
-
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 662be69..9417c40 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -25,115 +25,97 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5FOprivate.h" /* File objects */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5VMprivate.h" /* Vector and array functions */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Dataset functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5FOprivate.h" /* File objects */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5VMprivate.h" /* Vector and array functions */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
/* Callback info for sieve buffer readvv operation */
typedef struct H5D_contig_readvv_sieve_ud_t {
- H5F_shared_t *f_sh; /* Shared file for dataset */
- H5D_rdcdc_t *dset_contig; /* Cached information about contiguous data */
- const H5D_contig_storage_t *store_contig; /* Contiguous storage info for this I/O operation */
- unsigned char *rbuf; /* Pointer to buffer to fill */
+ H5F_shared_t * f_sh; /* Shared file for dataset */
+ H5D_rdcdc_t * dset_contig; /* Cached information about contiguous data */
+ const H5D_contig_storage_t *store_contig; /* Contiguous storage info for this I/O operation */
+ unsigned char * rbuf; /* Pointer to buffer to fill */
} H5D_contig_readvv_sieve_ud_t;
/* Callback info for [plain] readvv operation */
typedef struct H5D_contig_readvv_ud_t {
- H5F_shared_t *f_sh; /* Shared file for dataset */
- haddr_t dset_addr; /* Address of dataset */
- unsigned char *rbuf; /* Pointer to buffer to fill */
+ H5F_shared_t * f_sh; /* Shared file for dataset */
+ haddr_t dset_addr; /* Address of dataset */
+ unsigned char *rbuf; /* Pointer to buffer to fill */
} H5D_contig_readvv_ud_t;
/* Callback info for sieve buffer writevv operation */
typedef struct H5D_contig_writevv_sieve_ud_t {
- H5F_shared_t *f_sh; /* Shared file for dataset */
- H5D_rdcdc_t *dset_contig; /* Cached information about contiguous data */
- const H5D_contig_storage_t *store_contig; /* Contiguous storage info for this I/O operation */
- const unsigned char *wbuf; /* Pointer to buffer to write */
+ H5F_shared_t * f_sh; /* Shared file for dataset */
+ H5D_rdcdc_t * dset_contig; /* Cached information about contiguous data */
+ const H5D_contig_storage_t *store_contig; /* Contiguous storage info for this I/O operation */
+ const unsigned char * wbuf; /* Pointer to buffer to write */
} H5D_contig_writevv_sieve_ud_t;
/* Callback info for [plain] writevv operation */
typedef struct H5D_contig_writevv_ud_t {
- H5F_shared_t *f_sh; /* Shared file for dataset */
- haddr_t dset_addr; /* Address of dataset */
- const unsigned char *wbuf; /* Pointer to buffer to write */
+ H5F_shared_t * f_sh; /* Shared file for dataset */
+ haddr_t dset_addr; /* Address of dataset */
+ const unsigned char *wbuf; /* Pointer to buffer to write */
} H5D_contig_writevv_ud_t;
-
/********************/
/* Local Prototypes */
/********************/
/* Layout operation callbacks */
-static herr_t H5D__contig_construct(H5F_t *f, H5D_t *dset);
-static herr_t H5D__contig_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id);
-static herr_t H5D__contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t *cm);
-static ssize_t H5D__contig_readvv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
-static ssize_t H5D__contig_writevv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
-static herr_t H5D__contig_flush(H5D_t *dset);
+static herr_t H5D__contig_construct(H5F_t *f, H5D_t *dset);
+static herr_t H5D__contig_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id);
+static herr_t H5D__contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ H5D_chunk_map_t *cm);
+static ssize_t H5D__contig_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
+ size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
+ size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
+static ssize_t H5D__contig_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
+ size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
+ size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
+static herr_t H5D__contig_flush(H5D_t *dset);
/* Helper routines */
-static herr_t H5D__contig_write_one(H5D_io_info_t *io_info, hsize_t offset,
- size_t size);
-
+static herr_t H5D__contig_write_one(H5D_io_info_t *io_info, hsize_t offset, size_t size);
/*********************/
/* Package Variables */
/*********************/
/* Contiguous storage layout I/O ops */
-const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {{
- H5D__contig_construct,
- H5D__contig_init,
- H5D__contig_is_space_alloc,
- H5D__contig_is_data_cached,
- H5D__contig_io_init,
- H5D__contig_read,
- H5D__contig_write,
+const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {
+ {H5D__contig_construct, H5D__contig_init, H5D__contig_is_space_alloc, H5D__contig_is_data_cached,
+ H5D__contig_io_init, H5D__contig_read, H5D__contig_write,
#ifdef H5_HAVE_PARALLEL
- H5D__contig_collective_read,
- H5D__contig_collective_write,
+ H5D__contig_collective_read, H5D__contig_collective_write,
#endif /* H5_HAVE_PARALLEL */
- H5D__contig_readvv,
- H5D__contig_writevv,
- H5D__contig_flush,
- NULL,
- NULL
-}};
-
+ H5D__contig_readvv, H5D__contig_writevv, H5D__contig_flush, NULL, NULL}};
/*******************/
/* Local Variables */
@@ -145,8 +127,6 @@ H5FL_BLK_DEFINE(sieve_buf);
/* Declare extern the free list to manage blocks of type conversion data */
H5FL_BLK_EXTERN(type_conv);
-
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_alloc
*
@@ -160,9 +140,9 @@ H5FL_BLK_EXTERN(type_conv);
*-------------------------------------------------------------------------
*/
herr_t
-H5D__contig_alloc(H5F_t *f, H5O_storage_contig_t *storage /*out */ )
+H5D__contig_alloc(H5F_t *f, H5O_storage_contig_t *storage /*out */)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -171,14 +151,13 @@ H5D__contig_alloc(H5F_t *f, H5O_storage_contig_t *storage /*out */ )
HDassert(storage);
/* Allocate space for the contiguous data */
- if(HADDR_UNDEF == (storage->addr = H5MF_alloc(f, H5FD_MEM_DRAW, storage->size)))
+ if (HADDR_UNDEF == (storage->addr = H5MF_alloc(f, H5FD_MEM_DRAW, storage->size)))
HGOTO_ERROR(H5E_IO, H5E_NOSPACE, FAIL, "unable to reserve file space")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__contig_alloc */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_fill
*
@@ -194,23 +173,24 @@ done:
herr_t
H5D__contig_fill(const H5D_io_info_t *io_info)
{
- const H5D_t *dset = io_info->dset; /* the dataset pointer */
- H5D_io_info_t ioinfo; /* Dataset I/O info */
- H5D_storage_t store; /* Union of storage info for dataset */
- hssize_t snpoints; /* Number of points in space (for error checking) */
- size_t npoints; /* Number of points in space */
- hsize_t offset; /* Offset of dataset */
- size_t max_temp_buf; /* Maximum size of temporary buffer */
+ const H5D_t * dset = io_info->dset; /* the dataset pointer */
+ H5D_io_info_t ioinfo; /* Dataset I/O info */
+ H5D_storage_t store; /* Union of storage info for dataset */
+ hssize_t snpoints; /* Number of points in space (for error checking) */
+ size_t npoints; /* Number of points in space */
+ hsize_t offset; /* Offset of dataset */
+ size_t max_temp_buf; /* Maximum size of temporary buffer */
#ifdef H5_HAVE_PARALLEL
- MPI_Comm mpi_comm = MPI_COMM_NULL; /* MPI communicator for file */
- int mpi_rank = (-1); /* This process's rank */
- int mpi_code; /* MPI return code */
- hbool_t blocks_written = FALSE; /* Flag to indicate that chunk was actually written */
- hbool_t using_mpi = FALSE; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */
-#endif /* H5_HAVE_PARALLEL */
- H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
- hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
- herr_t ret_value = SUCCEED; /* Return value */
+ MPI_Comm mpi_comm = MPI_COMM_NULL; /* MPI communicator for file */
+ int mpi_rank = (-1); /* This process's rank */
+ int mpi_code; /* MPI return code */
+ hbool_t blocks_written = FALSE; /* Flag to indicate that chunk was actually written */
+ hbool_t using_mpi =
+ FALSE; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */
+#endif /* H5_HAVE_PARALLEL */
+ H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
+ hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -223,37 +203,36 @@ H5D__contig_fill(const H5D_io_info_t *io_info)
#ifdef H5_HAVE_PARALLEL
/* Retrieve MPI parameters */
- if(H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI)) {
+ if (H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI)) {
/* Get the MPI communicator */
- if(MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(dset->oloc.file)))
+ if (MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(dset->oloc.file)))
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator")
/* Get the MPI rank */
- if((mpi_rank = H5F_mpi_get_rank(dset->oloc.file)) < 0)
+ if ((mpi_rank = H5F_mpi_get_rank(dset->oloc.file)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank")
/* Set the MPI-capable file driver flag */
using_mpi = TRUE;
- } /* end if */
-#endif /* H5_HAVE_PARALLEL */
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
/* Initialize storage info for this dataset */
store.contig.dset_addr = dset->shared->layout.storage.u.contig.addr;
store.contig.dset_size = dset->shared->layout.storage.u.contig.size;
/* Get the number of elements in the dataset's dataspace */
- if((snpoints = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0)
+ if ((snpoints = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "dataset has negative number of elements")
H5_CHECKED_ASSIGN(npoints, size_t, snpoints, hssize_t);
/* Get the maximum size of temporary buffers */
- if(H5CX_get_max_temp_buf(&max_temp_buf) < 0)
+ if (H5CX_get_max_temp_buf(&max_temp_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve max. temp. buf size")
/* Initialize the fill value buffer */
- if(H5D__fill_init(&fb_info, NULL, NULL, NULL, NULL, NULL,
- &dset->shared->dcpl_cache.fill,
- dset->shared->type, dset->shared->type_id, npoints, max_temp_buf) < 0)
+ if (H5D__fill_init(&fb_info, NULL, NULL, NULL, NULL, NULL, &dset->shared->dcpl_cache.fill,
+ dset->shared->type, dset->shared->type_id, npoints, max_temp_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
fb_info_init = TRUE;
@@ -270,67 +249,66 @@ H5D__contig_fill(const H5D_io_info_t *io_info)
*/
/* Loop through writing the fill value to the dataset */
- while(npoints > 0) {
- size_t curr_points; /* Number of elements to write on this iteration of the loop */
- size_t size; /* Size of buffer to write */
+ while (npoints > 0) {
+ size_t curr_points; /* Number of elements to write on this iteration of the loop */
+ size_t size; /* Size of buffer to write */
/* Compute # of elements and buffer size to write for this iteration */
curr_points = MIN(fb_info.elmts_per_buf, npoints);
- size = curr_points * fb_info.file_elmt_size;
+ size = curr_points * fb_info.file_elmt_size;
/* Check for VL datatype & non-default fill value */
- if(fb_info.has_vlen_fill_type)
+ if (fb_info.has_vlen_fill_type)
/* Re-fill the buffer to use for this I/O operation */
- if(H5D__fill_refill_vl(&fb_info, curr_points) < 0)
+ if (H5D__fill_refill_vl(&fb_info, curr_points) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer")
#ifdef H5_HAVE_PARALLEL
- /* Check if this file is accessed with an MPI-capable file driver */
- if(using_mpi) {
- /* Write the chunks out from only one process */
- /* !! Use the internal "independent" DXPL!! -QAK */
- if(H5_PAR_META_WRITE == mpi_rank)
- if(H5D__contig_write_one(&ioinfo, offset, size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset")
-
- /* Indicate that blocks are being written */
- blocks_written = TRUE;
- } /* end if */
- else {
-#endif /* H5_HAVE_PARALLEL */
- H5_CHECK_OVERFLOW(size, size_t, hsize_t);
- if(H5D__contig_write_one(&ioinfo, offset, size) < 0)
+ /* Check if this file is accessed with an MPI-capable file driver */
+ if (using_mpi) {
+ /* Write the chunks out from only one process */
+ /* !! Use the internal "independent" DXPL!! -QAK */
+ if (H5_PAR_META_WRITE == mpi_rank)
+ if (H5D__contig_write_one(&ioinfo, offset, size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset")
-#ifdef H5_HAVE_PARALLEL
- } /* end else */
+
+ /* Indicate that blocks are being written */
+ blocks_written = TRUE;
+ } /* end if */
+ else {
#endif /* H5_HAVE_PARALLEL */
+ H5_CHECK_OVERFLOW(size, size_t, hsize_t);
+ if (H5D__contig_write_one(&ioinfo, offset, size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset")
+#ifdef H5_HAVE_PARALLEL
+ } /* end else */
+#endif /* H5_HAVE_PARALLEL */
- npoints -= curr_points;
- offset += size;
- } /* end while */
+ npoints -= curr_points;
+ offset += size;
+ } /* end while */
#ifdef H5_HAVE_PARALLEL
/* Only need to block at the barrier if we actually wrote fill values */
/* And if we are using an MPI-capable file driver */
- if(using_mpi && blocks_written) {
+ if (using_mpi && blocks_written) {
/* Wait at barrier to avoid race conditions where some processes are
* still writing out fill values and other processes race ahead to data
* in, getting bogus data.
*/
- if(MPI_SUCCESS != (mpi_code = MPI_Barrier(mpi_comm)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Barrier(mpi_comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code)
- } /* end if */
+ } /* end if */
#endif /* H5_HAVE_PARALLEL */
done:
/* Release the fill buffer info, if it's been initialized */
- if(fb_info_init && H5D__fill_term(&fb_info) < 0)
+ if (fb_info_init && H5D__fill_term(&fb_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__contig_fill() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_delete
*
@@ -346,7 +324,7 @@ done:
herr_t
H5D__contig_delete(H5F_t *f, const H5O_storage_t *storage)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -355,14 +333,13 @@ H5D__contig_delete(H5F_t *f, const H5O_storage_t *storage)
HDassert(storage);
/* Free the file space for the chunk */
- if(H5MF_xfree(f, H5FD_MEM_DRAW, storage->u.contig.addr, storage->u.contig.size) < 0)
+ if (H5MF_xfree(f, H5FD_MEM_DRAW, storage->u.contig.addr, storage->u.contig.size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free contiguous storage space")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__contig_delete */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_construct
*
@@ -378,13 +355,13 @@ done:
static herr_t
H5D__contig_construct(H5F_t *f, H5D_t *dset)
{
- hssize_t snelmts; /* Temporary holder for number of elements in dataspace */
- hsize_t nelmts; /* Number of elements in dataspace */
- size_t dt_size; /* Size of datatype */
- hsize_t tmp_size; /* Temporary holder for raw data size */
- size_t tmp_sieve_buf_size; /* Temporary holder for sieve buffer size */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ hssize_t snelmts; /* Temporary holder for number of elements in dataspace */
+ hsize_t nelmts; /* Number of elements in dataspace */
+ size_t dt_size; /* Size of datatype */
+ hsize_t tmp_size; /* Temporary holder for raw data size */
+ size_t tmp_sieve_buf_size; /* Temporary holder for sieve buffer size */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -399,24 +376,25 @@ H5D__contig_construct(H5F_t *f, H5D_t *dset)
*/
/* Check for invalid dataset dimensions */
- for(u = 0; u < dset->shared->ndims; u++)
- if(dset->shared->max_dims[u] > dset->shared->curr_dims[u])
- HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "extendible contiguous non-external dataset not allowed")
+ for (u = 0; u < dset->shared->ndims; u++)
+ if (dset->shared->max_dims[u] > dset->shared->curr_dims[u])
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
+ "extendible contiguous non-external dataset not allowed")
/* Retrieve the number of elements in the dataspace */
- if((snelmts = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0)
+ if ((snelmts = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve number of elements in dataspace")
nelmts = (hsize_t)snelmts;
/* Get the datatype's size */
- if(0 == (dt_size = H5T_GET_SIZE(dset->shared->type)))
+ if (0 == (dt_size = H5T_GET_SIZE(dset->shared->type)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of datatype")
/* Compute the size of the dataset's contiguous storage */
tmp_size = nelmts * dt_size;
/* Check for overflow during multiplication */
- if(nelmts != (tmp_size / dt_size))
+ if (nelmts != (tmp_size / dt_size))
HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed")
/* Assign the dataset's contiguous storage size */
@@ -427,7 +405,7 @@ H5D__contig_construct(H5F_t *f, H5D_t *dset)
/* Adjust the sieve buffer size to the smaller one between the dataset size and the buffer size
* from the file access property. (SLU - 2012/3/30) */
- if(tmp_size < tmp_sieve_buf_size)
+ if (tmp_size < tmp_sieve_buf_size)
dset->shared->cache.contig.sieve_buf_size = tmp_size;
else
dset->shared->cache.contig.sieve_buf_size = tmp_sieve_buf_size;
@@ -436,7 +414,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__contig_construct() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_init
*
@@ -451,12 +428,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__contig_init(H5F_t H5_ATTR_UNUSED *f, const H5D_t *dset,
- hid_t H5_ATTR_UNUSED dapl_id)
+H5D__contig_init(H5F_t H5_ATTR_UNUSED *f, const H5D_t *dset, hid_t H5_ATTR_UNUSED dapl_id)
{
- hsize_t tmp_size; /* Temporary holder for raw data size */
- size_t tmp_sieve_buf_size; /* Temporary holder for sieve buffer size */
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t tmp_size; /* Temporary holder for raw data size */
+ size_t tmp_sieve_buf_size; /* Temporary holder for sieve buffer size */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -468,25 +444,25 @@ H5D__contig_init(H5F_t H5_ATTR_UNUSED *f, const H5D_t *dset,
* layout message less than version 3 because versions 1 & 2 would
* truncate the dimension sizes to 32-bits of information. - QAK 5/26/04
*/
- if(dset->shared->layout.version < 3) {
- hssize_t snelmts; /* Temporary holder for number of elements in dataspace */
- hsize_t nelmts; /* Number of elements in dataspace */
- size_t dt_size; /* Size of datatype */
+ if (dset->shared->layout.version < 3) {
+ hssize_t snelmts; /* Temporary holder for number of elements in dataspace */
+ hsize_t nelmts; /* Number of elements in dataspace */
+ size_t dt_size; /* Size of datatype */
/* Retrieve the number of elements in the dataspace */
- if((snelmts = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0)
+ if ((snelmts = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve number of elements in dataspace")
nelmts = (hsize_t)snelmts;
/* Get the datatype's size */
- if(0 == (dt_size = H5T_GET_SIZE(dset->shared->type)))
+ if (0 == (dt_size = H5T_GET_SIZE(dset->shared->type)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of datatype")
/* Compute the size of the dataset's contiguous storage */
tmp_size = nelmts * dt_size;
/* Check for overflow during multiplication */
- if(nelmts != (tmp_size / dt_size))
+ if (nelmts != (tmp_size / dt_size))
HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed")
/* Assign the dataset's contiguous storage size */
@@ -500,7 +476,7 @@ H5D__contig_init(H5F_t H5_ATTR_UNUSED *f, const H5D_t *dset,
/* Adjust the sieve buffer size to the smaller one between the dataset size and the buffer size
* from the file access property. (SLU - 2012/3/30) */
- if(tmp_size < tmp_sieve_buf_size)
+ if (tmp_size < tmp_sieve_buf_size)
dset->shared->cache.contig.sieve_buf_size = tmp_size;
else
dset->shared->cache.contig.sieve_buf_size = tmp_sieve_buf_size;
@@ -509,7 +485,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__contig_init() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_is_space_alloc
*
@@ -525,7 +500,7 @@ done:
hbool_t
H5D__contig_is_space_alloc(const H5O_storage_t *storage)
{
- hbool_t ret_value = FALSE; /* Return value */
+ hbool_t ret_value = FALSE; /* Return value */
FUNC_ENTER_PACKAGE_NOERR
@@ -538,7 +513,6 @@ H5D__contig_is_space_alloc(const H5O_storage_t *storage)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__contig_is_space_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_is_data_cached
*
@@ -562,7 +536,6 @@ H5D__contig_is_data_cached(const H5D_shared_t *shared_dset)
FUNC_LEAVE_NOAPI(shared_dset->cache.contig.sieve_size > 0)
} /* end H5D__contig_is_data_cached() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_io_init
*
@@ -577,8 +550,8 @@ H5D__contig_is_data_cached(const H5D_shared_t *shared_dset)
*/
static herr_t
H5D__contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info,
- hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space, const H5S_t H5_ATTR_UNUSED *mem_space,
- H5D_chunk_map_t H5_ATTR_UNUSED *cm)
+ hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space,
+ const H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm)
{
FUNC_ENTER_STATIC_NOERR
@@ -588,7 +561,6 @@ H5D__contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__contig_io_init() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_read
*
@@ -602,11 +574,10 @@ H5D__contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_
*-------------------------------------------------------------------------
*/
herr_t
-H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t H5_ATTR_UNUSED *fm)
+H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
{
- herr_t ret_value = SUCCEED; /*return value */
+ herr_t ret_value = SUCCEED; /*return value */
FUNC_ENTER_PACKAGE
@@ -618,14 +589,13 @@ H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
HDassert(file_space);
/* Read data */
- if((io_info->io_ops.single_read)(io_info, type_info, nelmts, file_space, mem_space) < 0)
+ if ((io_info->io_ops.single_read)(io_info, type_info, nelmts, file_space, mem_space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "contiguous read failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__contig_read() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_write
*
@@ -639,11 +609,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t H5_ATTR_UNUSED *fm)
+H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
{
- herr_t ret_value = SUCCEED; /*return value */
+ herr_t ret_value = SUCCEED; /*return value */
FUNC_ENTER_PACKAGE
@@ -655,14 +624,13 @@ H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
HDassert(file_space);
/* Write data */
- if((io_info->io_ops.single_write)(io_info, type_info, nelmts, file_space, mem_space) < 0)
+ if ((io_info->io_ops.single_write)(io_info, type_info, nelmts, file_space, mem_space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "contiguous write failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__contig_write() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_write_one
*
@@ -680,27 +648,26 @@ done:
static herr_t
H5D__contig_write_one(H5D_io_info_t *io_info, hsize_t offset, size_t size)
{
- hsize_t dset_off = offset; /* Offset in dataset */
- size_t dset_len = size; /* Length in dataset */
- size_t dset_curr_seq = 0; /* "Current sequence" in dataset */
- hsize_t mem_off = 0; /* Offset in memory */
- size_t mem_len = size; /* Length in memory */
- size_t mem_curr_seq = 0; /* "Current sequence" in memory */
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t dset_off = offset; /* Offset in dataset */
+ size_t dset_len = size; /* Length in dataset */
+ size_t dset_curr_seq = 0; /* "Current sequence" in dataset */
+ hsize_t mem_off = 0; /* Offset in memory */
+ size_t mem_len = size; /* Length in memory */
+ size_t mem_curr_seq = 0; /* "Current sequence" in memory */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
HDassert(io_info);
- if(H5D__contig_writevv(io_info, (size_t)1, &dset_curr_seq, &dset_len, &dset_off,
- (size_t)1, &mem_curr_seq, &mem_len, &mem_off) < 0)
+ if (H5D__contig_writevv(io_info, (size_t)1, &dset_curr_seq, &dset_len, &dset_off, (size_t)1,
+ &mem_curr_seq, &mem_len, &mem_off) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vector write failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__contig_write_one() */
+} /* end H5D__contig_write_one() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_readvv_sieve_cb
*
@@ -714,30 +681,31 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
- void *_udata)
+H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata)
{
- H5D_contig_readvv_sieve_ud_t *udata = (H5D_contig_readvv_sieve_ud_t *)_udata; /* User data for H5VM_opvv() operator */
- H5F_shared_t *f_sh = udata->f_sh; /* Shared file for dataset */
- H5D_rdcdc_t *dset_contig = udata->dset_contig; /* Cached information about contiguous data */
- const H5D_contig_storage_t *store_contig = udata->store_contig; /* Contiguous storage info for this I/O operation */
- unsigned char *buf; /* Pointer to buffer to fill */
- haddr_t addr; /* Actual address to read */
- haddr_t sieve_start = HADDR_UNDEF, sieve_end = HADDR_UNDEF; /* Start & end locations of sieve buffer */
- haddr_t contig_end; /* End locations of block to write */
- size_t sieve_size = (size_t)-1; /* Size of sieve buffer */
- haddr_t rel_eoa; /* Relative end of file address */
- hsize_t max_data; /* Actual maximum size of data to cache */
- hsize_t min; /* temporary minimum value (avoids some ugly macro nesting) */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_contig_readvv_sieve_ud_t *udata =
+ (H5D_contig_readvv_sieve_ud_t *)_udata; /* User data for H5VM_opvv() operator */
+ H5F_shared_t *f_sh = udata->f_sh; /* Shared file for dataset */
+ H5D_rdcdc_t * dset_contig = udata->dset_contig; /* Cached information about contiguous data */
+ const H5D_contig_storage_t *store_contig =
+ udata->store_contig; /* Contiguous storage info for this I/O operation */
+ unsigned char *buf; /* Pointer to buffer to fill */
+ haddr_t addr; /* Actual address to read */
+ haddr_t sieve_start = HADDR_UNDEF, sieve_end = HADDR_UNDEF; /* Start & end locations of sieve buffer */
+ haddr_t contig_end; /* End locations of block to write */
+ size_t sieve_size = (size_t)-1; /* Size of sieve buffer */
+ haddr_t rel_eoa; /* Relative end of file address */
+ hsize_t max_data; /* Actual maximum size of data to cache */
+ hsize_t min; /* temporary minimum value (avoids some ugly macro nesting) */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Stash local copies of these value */
- if(dset_contig->sieve_buf != NULL) {
+ if (dset_contig->sieve_buf != NULL) {
sieve_start = dset_contig->sieve_loc;
- sieve_size = dset_contig->sieve_size;
- sieve_end = sieve_start + sieve_size;
+ sieve_size = dset_contig->sieve_size;
+ sieve_end = sieve_start + sieve_size;
} /* end if */
/* Compute offset on disk */
@@ -747,22 +715,22 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
buf = udata->rbuf + src_off;
/* Check if the sieve buffer is allocated yet */
- if(NULL == dset_contig->sieve_buf) {
+ if (NULL == dset_contig->sieve_buf) {
/* Check if we can actually hold the I/O request in the sieve buffer */
- if(len > dset_contig->sieve_buf_size) {
- if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0)
+ if (len > dset_contig->sieve_buf_size) {
+ if (H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed")
} /* end if */
else {
/* Allocate room for the data sieve buffer */
- if(NULL == (dset_contig->sieve_buf = H5FL_BLK_CALLOC(sieve_buf, dset_contig->sieve_buf_size)))
+ if (NULL == (dset_contig->sieve_buf = H5FL_BLK_CALLOC(sieve_buf, dset_contig->sieve_buf_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed")
/* Determine the new sieve buffer size & location */
dset_contig->sieve_loc = addr;
/* Make certain we don't read off the end of the file */
- if(HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW)))
+ if (HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size")
/* Set up the buffer parameters */
@@ -773,7 +741,8 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
H5_CHECKED_ASSIGN(dset_contig->sieve_size, size_t, min, hsize_t);
/* Read the new sieve buffer */
- if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0)
+ if (H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size,
+ dset_contig->sieve_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed")
/* Grab the data out of the buffer (must be first piece of data in buffer ) */
@@ -782,13 +751,13 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
/* Reset sieve buffer dirty flag */
dset_contig->sieve_dirty = FALSE;
} /* end else */
- } /* end if */
+ } /* end if */
else {
/* Compute end of sequence to retrieve */
contig_end = addr + len - 1;
/* If entire read is within the sieve buffer, read it from the buffer */
- if(addr >= sieve_start && contig_end < sieve_end) {
+ if (addr >= sieve_start && contig_end < sieve_end) {
unsigned char *base_sieve_buf = dset_contig->sieve_buf + (addr - sieve_start);
/* Grab the data out of the buffer */
@@ -797,31 +766,33 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
/* Entire request is not within this data sieve buffer */
else {
/* Check if we can actually hold the I/O request in the sieve buffer */
- if(len > dset_contig->sieve_buf_size) {
+ if (len > dset_contig->sieve_buf_size) {
/* Check for any overlap with the current sieve buffer */
- if((sieve_start >= addr && sieve_start < (contig_end + 1))
- || ((sieve_end - 1) >= addr && (sieve_end - 1) < (contig_end + 1))) {
+ if ((sieve_start >= addr && sieve_start < (contig_end + 1)) ||
+ ((sieve_end - 1) >= addr && (sieve_end - 1) < (contig_end + 1))) {
/* Flush the sieve buffer, if it's dirty */
- if(dset_contig->sieve_dirty) {
+ if (dset_contig->sieve_dirty) {
/* Write to file */
- if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0)
+ if (H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size,
+ dset_contig->sieve_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed")
/* Reset sieve buffer dirty flag */
dset_contig->sieve_dirty = FALSE;
} /* end if */
- } /* end if */
+ } /* end if */
/* Read directly into the user's buffer */
- if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0)
+ if (H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed")
} /* end if */
/* Element size fits within the buffer size */
else {
/* Flush the sieve buffer if it's dirty */
- if(dset_contig->sieve_dirty) {
+ if (dset_contig->sieve_dirty) {
/* Write to file */
- if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0)
+ if (H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size,
+ dset_contig->sieve_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed")
/* Reset sieve buffer dirty flag */
@@ -832,7 +803,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
dset_contig->sieve_loc = addr;
/* Make certain we don't read off the end of the file */
- if(HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW)))
+ if (HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size")
/* Only need this when resizing sieve buffer */
@@ -847,7 +818,8 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
H5_CHECKED_ASSIGN(dset_contig->sieve_size, size_t, min, hsize_t);
/* Read the new sieve buffer */
- if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0)
+ if (H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc,
+ dset_contig->sieve_size, dset_contig->sieve_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed")
/* Grab the data out of the buffer (must be first piece of data in buffer ) */
@@ -856,14 +828,13 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
/* Reset sieve buffer dirty flag */
dset_contig->sieve_dirty = FALSE;
} /* end else */
- } /* end else */
- } /* end else */
+ } /* end else */
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__contig_readvv_sieve_cb() */
+} /* end H5D__contig_readvv_sieve_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_readvv_cb
*
@@ -880,20 +851,19 @@ static herr_t
H5D__contig_readvv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata)
{
H5D_contig_readvv_ud_t *udata = (H5D_contig_readvv_ud_t *)_udata; /* User data for H5VM_opvv() operator */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Write data */
- if(H5F_shared_block_read(udata->f_sh, H5FD_MEM_DRAW, (udata->dset_addr + dst_off),
- len, (udata->rbuf + src_off)) < 0)
+ if (H5F_shared_block_read(udata->f_sh, H5FD_MEM_DRAW, (udata->dset_addr + dst_off), len,
+ (udata->rbuf + src_off)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__contig_readvv_cb() */
+} /* end H5D__contig_readvv_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_readvv
*
@@ -913,11 +883,11 @@ done:
*-------------------------------------------------------------------------
*/
static ssize_t
-H5D__contig_readvv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[])
+H5D__contig_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
+ size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq,
+ size_t mem_len_arr[], hsize_t mem_off_arr[])
{
- ssize_t ret_value = -1; /* Return value */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_STATIC
@@ -931,41 +901,40 @@ H5D__contig_readvv(const H5D_io_info_t *io_info,
HDassert(mem_off_arr);
/* Check if data sieving is enabled */
- if(H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_DATA_SIEVE)) {
- H5D_contig_readvv_sieve_ud_t udata; /* User data for H5VM_opvv() operator */
+ if (H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_DATA_SIEVE)) {
+ H5D_contig_readvv_sieve_ud_t udata; /* User data for H5VM_opvv() operator */
/* Set up user data for H5VM_opvv() */
- udata.f_sh = io_info->f_sh;
- udata.dset_contig = &(io_info->dset->shared->cache.contig);
+ udata.f_sh = io_info->f_sh;
+ udata.dset_contig = &(io_info->dset->shared->cache.contig);
udata.store_contig = &(io_info->store->contig);
- udata.rbuf = (unsigned char *)io_info->u.rbuf;
+ udata.rbuf = (unsigned char *)io_info->u.rbuf;
/* Call generic sequence operation routine */
- if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr,
- mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr,
- H5D__contig_readvv_sieve_cb, &udata)) < 0)
+ if ((ret_value =
+ H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq,
+ mem_curr_seq, mem_len_arr, mem_off_arr, H5D__contig_readvv_sieve_cb, &udata)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized sieve buffer read")
} /* end if */
else {
- H5D_contig_readvv_ud_t udata; /* User data for H5VM_opvv() operator */
+ H5D_contig_readvv_ud_t udata; /* User data for H5VM_opvv() operator */
/* Set up user data for H5VM_opvv() */
- udata.f_sh = io_info->f_sh;
+ udata.f_sh = io_info->f_sh;
udata.dset_addr = io_info->store->contig.dset_addr;
- udata.rbuf = (unsigned char *)io_info->u.rbuf;
+ udata.rbuf = (unsigned char *)io_info->u.rbuf;
/* Call generic sequence operation routine */
- if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr,
- mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr,
- H5D__contig_readvv_cb, &udata)) < 0)
+ if ((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq,
+ mem_curr_seq, mem_len_arr, mem_off_arr, H5D__contig_readvv_cb, &udata)) <
+ 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized read")
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__contig_readvv() */
+} /* end H5D__contig_readvv() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_writevv_sieve_cb
*
@@ -979,30 +948,31 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
- void *_udata)
+H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata)
{
- H5D_contig_writevv_sieve_ud_t *udata = (H5D_contig_writevv_sieve_ud_t *)_udata; /* User data for H5VM_opvv() operator */
- H5F_shared_t *f_sh = udata->f_sh; /* Shared file for dataset */
- H5D_rdcdc_t *dset_contig = udata->dset_contig; /* Cached information about contiguous data */
- const H5D_contig_storage_t *store_contig = udata->store_contig; /* Contiguous storage info for this I/O operation */
- const unsigned char *buf; /* Pointer to buffer to fill */
- haddr_t addr; /* Actual address to read */
- haddr_t sieve_start = HADDR_UNDEF, sieve_end = HADDR_UNDEF; /* Start & end locations of sieve buffer */
- haddr_t contig_end; /* End locations of block to write */
- size_t sieve_size = (size_t)-1; /* size of sieve buffer */
- haddr_t rel_eoa; /* Relative end of file address */
- hsize_t max_data; /* Actual maximum size of data to cache */
- hsize_t min; /* temporary minimum value (avoids some ugly macro nesting) */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_contig_writevv_sieve_ud_t *udata =
+ (H5D_contig_writevv_sieve_ud_t *)_udata; /* User data for H5VM_opvv() operator */
+ H5F_shared_t *f_sh = udata->f_sh; /* Shared file for dataset */
+ H5D_rdcdc_t * dset_contig = udata->dset_contig; /* Cached information about contiguous data */
+ const H5D_contig_storage_t *store_contig =
+ udata->store_contig; /* Contiguous storage info for this I/O operation */
+ const unsigned char *buf; /* Pointer to buffer to fill */
+ haddr_t addr; /* Actual address to read */
+ haddr_t sieve_start = HADDR_UNDEF, sieve_end = HADDR_UNDEF; /* Start & end locations of sieve buffer */
+ haddr_t contig_end; /* End locations of block to write */
+ size_t sieve_size = (size_t)-1; /* size of sieve buffer */
+ haddr_t rel_eoa; /* Relative end of file address */
+ hsize_t max_data; /* Actual maximum size of data to cache */
+ hsize_t min; /* temporary minimum value (avoids some ugly macro nesting) */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Stash local copies of these values */
- if(dset_contig->sieve_buf != NULL) {
+ if (dset_contig->sieve_buf != NULL) {
sieve_start = dset_contig->sieve_loc;
- sieve_size = dset_contig->sieve_size;
- sieve_end = sieve_start + sieve_size;
+ sieve_size = dset_contig->sieve_size;
+ sieve_end = sieve_start + sieve_size;
} /* end if */
/* Compute offset on disk */
@@ -1012,26 +982,26 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
buf = udata->wbuf + src_off;
/* No data sieve buffer yet, go allocate one */
- if(NULL == dset_contig->sieve_buf) {
+ if (NULL == dset_contig->sieve_buf) {
/* Check if we can actually hold the I/O request in the sieve buffer */
- if(len > dset_contig->sieve_buf_size) {
- if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0)
+ if (len > dset_contig->sieve_buf_size) {
+ if (H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed")
} /* end if */
else {
/* Allocate room for the data sieve buffer */
- if(NULL == (dset_contig->sieve_buf = H5FL_BLK_CALLOC(sieve_buf, dset_contig->sieve_buf_size)))
+ if (NULL == (dset_contig->sieve_buf = H5FL_BLK_CALLOC(sieve_buf, dset_contig->sieve_buf_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed")
/* Clear memory */
- if(dset_contig->sieve_size > len)
+ if (dset_contig->sieve_size > len)
HDmemset(dset_contig->sieve_buf + len, 0, (dset_contig->sieve_size - len));
/* Determine the new sieve buffer size & location */
dset_contig->sieve_loc = addr;
/* Make certain we don't read off the end of the file */
- if(HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW)))
+ if (HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size")
/* Set up the buffer parameters */
@@ -1042,9 +1012,10 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
H5_CHECKED_ASSIGN(dset_contig->sieve_size, size_t, min, hsize_t);
/* Check if there is any point in reading the data from the file */
- if(dset_contig->sieve_size > len) {
+ if (dset_contig->sieve_size > len) {
/* Read the new sieve buffer */
- if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0)
+ if (H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc,
+ dset_contig->sieve_size, dset_contig->sieve_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed")
} /* end if */
@@ -1056,16 +1027,16 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
/* Stash local copies of these values */
sieve_start = dset_contig->sieve_loc;
- sieve_size = dset_contig->sieve_size;
- sieve_end = sieve_start + sieve_size;
+ sieve_size = dset_contig->sieve_size;
+ sieve_end = sieve_start + sieve_size;
} /* end else */
- } /* end if */
+ } /* end if */
else {
/* Compute end of sequence to retrieve */
contig_end = addr + len - 1;
/* If entire write is within the sieve buffer, write it to the buffer */
- if(addr >= sieve_start && contig_end < sieve_end) {
+ if (addr >= sieve_start && contig_end < sieve_end) {
unsigned char *base_sieve_buf = dset_contig->sieve_buf + (addr - sieve_start);
/* Put the data into the sieve buffer */
@@ -1077,14 +1048,15 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
/* Entire request is not within this data sieve buffer */
else {
/* Check if we can actually hold the I/O request in the sieve buffer */
- if(len > dset_contig->sieve_buf_size) {
+ if (len > dset_contig->sieve_buf_size) {
/* Check for any overlap with the current sieve buffer */
- if((sieve_start >= addr && sieve_start < (contig_end + 1))
- || ((sieve_end - 1) >= addr && (sieve_end - 1) < (contig_end + 1))) {
+ if ((sieve_start >= addr && sieve_start < (contig_end + 1)) ||
+ ((sieve_end - 1) >= addr && (sieve_end - 1) < (contig_end + 1))) {
/* Flush the sieve buffer, if it's dirty */
- if(dset_contig->sieve_dirty) {
+ if (dset_contig->sieve_dirty) {
/* Write to file */
- if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0)
+ if (H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size,
+ dset_contig->sieve_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed")
/* Reset sieve buffer dirty flag */
@@ -1092,24 +1064,24 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
} /* end if */
/* Force the sieve buffer to be re-read the next time */
- dset_contig->sieve_loc = HADDR_UNDEF;
+ dset_contig->sieve_loc = HADDR_UNDEF;
dset_contig->sieve_size = 0;
} /* end if */
/* Write directly from the user's buffer */
- if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0)
+ if (H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed")
} /* end if */
/* Element size fits within the buffer size */
else {
/* Check if it is possible to (exactly) prepend or append to existing (dirty) sieve buffer */
- if(((addr + len) == sieve_start || addr == sieve_end) &&
- (len + sieve_size) <= dset_contig->sieve_buf_size &&
- dset_contig->sieve_dirty) {
+ if (((addr + len) == sieve_start || addr == sieve_end) &&
+ (len + sieve_size) <= dset_contig->sieve_buf_size && dset_contig->sieve_dirty) {
/* Prepend to existing sieve buffer */
- if((addr + len) == sieve_start) {
+ if ((addr + len) == sieve_start) {
/* Move existing sieve information to correct location */
- HDmemmove(dset_contig->sieve_buf + len, dset_contig->sieve_buf, dset_contig->sieve_size);
+ HDmemmove(dset_contig->sieve_buf + len, dset_contig->sieve_buf,
+ dset_contig->sieve_size);
/* Copy in new information (must be first in sieve buffer) */
H5MM_memcpy(dset_contig->sieve_buf, buf, len);
@@ -1130,9 +1102,10 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
/* Can't add the new data onto the existing sieve buffer */
else {
/* Flush the sieve buffer if it's dirty */
- if(dset_contig->sieve_dirty) {
+ if (dset_contig->sieve_dirty) {
/* Write to file */
- if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0)
+ if (H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size,
+ dset_contig->sieve_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed")
/* Reset sieve buffer dirty flag */
@@ -1143,7 +1116,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
dset_contig->sieve_loc = addr;
/* Make certain we don't read off the end of the file */
- if(HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW)))
+ if (HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size")
/* Only need this when resizing sieve buffer */
@@ -1158,9 +1131,10 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
H5_CHECKED_ASSIGN(dset_contig->sieve_size, size_t, min, hsize_t);
/* Check if there is any point in reading the data from the file */
- if(dset_contig->sieve_size > len) {
+ if (dset_contig->sieve_size > len) {
/* Read the new sieve buffer */
- if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0)
+ if (H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc,
+ dset_contig->sieve_size, dset_contig->sieve_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed")
} /* end if */
@@ -1170,15 +1144,14 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
/* Set sieve buffer dirty flag */
dset_contig->sieve_dirty = TRUE;
} /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ } /* end else */
+ } /* end else */
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__contig_writevv_sieve_cb() */
+} /* end H5D__contig_writevv_sieve_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_writevv_cb
*
@@ -1194,20 +1167,21 @@ done:
static herr_t
H5D__contig_writevv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata)
{
- H5D_contig_writevv_ud_t *udata = (H5D_contig_writevv_ud_t *)_udata; /* User data for H5VM_opvv() operator */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_contig_writevv_ud_t *udata =
+ (H5D_contig_writevv_ud_t *)_udata; /* User data for H5VM_opvv() operator */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Write data */
- if(H5F_shared_block_write(udata->f_sh, H5FD_MEM_DRAW, (udata->dset_addr + dst_off), len, (udata->wbuf + src_off)) < 0)
+ if (H5F_shared_block_write(udata->f_sh, H5FD_MEM_DRAW, (udata->dset_addr + dst_off), len,
+ (udata->wbuf + src_off)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__contig_writevv_cb() */
+} /* end H5D__contig_writevv_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_writevv
*
@@ -1227,11 +1201,11 @@ done:
*-------------------------------------------------------------------------
*/
static ssize_t
-H5D__contig_writevv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[])
+H5D__contig_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
+ size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq,
+ size_t mem_len_arr[], hsize_t mem_off_arr[])
{
- ssize_t ret_value = -1; /* Return value (Size of sequence in bytes) */
+ ssize_t ret_value = -1; /* Return value (Size of sequence in bytes) */
FUNC_ENTER_STATIC
@@ -1245,41 +1219,40 @@ H5D__contig_writevv(const H5D_io_info_t *io_info,
HDassert(mem_off_arr);
/* Check if data sieving is enabled */
- if(H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_DATA_SIEVE)) {
- H5D_contig_writevv_sieve_ud_t udata; /* User data for H5VM_opvv() operator */
+ if (H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_DATA_SIEVE)) {
+ H5D_contig_writevv_sieve_ud_t udata; /* User data for H5VM_opvv() operator */
/* Set up user data for H5VM_opvv() */
- udata.f_sh = io_info->f_sh;
- udata.dset_contig = &(io_info->dset->shared->cache.contig);
+ udata.f_sh = io_info->f_sh;
+ udata.dset_contig = &(io_info->dset->shared->cache.contig);
udata.store_contig = &(io_info->store->contig);
- udata.wbuf = (const unsigned char *)io_info->u.wbuf;
+ udata.wbuf = (const unsigned char *)io_info->u.wbuf;
/* Call generic sequence operation routine */
- if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr,
- mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr,
- H5D__contig_writevv_sieve_cb, &udata)) < 0)
+ if ((ret_value =
+ H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq,
+ mem_curr_seq, mem_len_arr, mem_off_arr, H5D__contig_writevv_sieve_cb, &udata)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized sieve buffer write")
} /* end if */
else {
- H5D_contig_writevv_ud_t udata; /* User data for H5VM_opvv() operator */
+ H5D_contig_writevv_ud_t udata; /* User data for H5VM_opvv() operator */
/* Set up user data for H5VM_opvv() */
- udata.f_sh = io_info->f_sh;
+ udata.f_sh = io_info->f_sh;
udata.dset_addr = io_info->store->contig.dset_addr;
- udata.wbuf = (const unsigned char *)io_info->u.wbuf;
+ udata.wbuf = (const unsigned char *)io_info->u.wbuf;
/* Call generic sequence operation routine */
- if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr,
- mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr,
- H5D__contig_writevv_cb, &udata)) < 0)
+ if ((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq,
+ mem_curr_seq, mem_len_arr, mem_off_arr, H5D__contig_writevv_cb, &udata)) <
+ 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized read")
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__contig_writevv() */
+} /* end H5D__contig_writevv() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_flush
*
@@ -1295,7 +1268,7 @@ done:
static herr_t
H5D__contig_flush(H5D_t *dset)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1303,14 +1276,13 @@ H5D__contig_flush(H5D_t *dset)
HDassert(dset);
/* Flush any data in sieve buffer */
- if(H5D__flush_sieve_buf(dset) < 0)
+ if (H5D__flush_sieve_buf(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush sieve buffer")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__contig_flush() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_copy
*
@@ -1324,41 +1296,41 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
- H5F_t *f_dst, H5O_storage_contig_t *storage_dst, H5T_t *dt_src,
- H5O_copy_t *cpy_info)
+H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f_dst,
+ H5O_storage_contig_t *storage_dst, H5T_t *dt_src, H5O_copy_t *cpy_info)
{
- haddr_t addr_src; /* File offset in source dataset */
- haddr_t addr_dst; /* File offset in destination dataset */
- H5T_path_t *tpath_src_mem = NULL, *tpath_mem_dst = NULL; /* Datatype conversion paths */
- H5T_t *dt_dst = NULL; /* Destination datatype */
- H5T_t *dt_mem = NULL; /* Memory datatype */
- hid_t tid_src = -1; /* Datatype ID for source datatype */
- hid_t tid_dst = -1; /* Datatype ID for destination datatype */
- hid_t tid_mem = -1; /* Datatype ID for memory datatype */
- size_t src_dt_size = 0; /* Source datatype size */
- size_t mem_dt_size = 0; /* Memory datatype size */
- size_t dst_dt_size = 0; /* Destination datatype size */
- size_t max_dt_size; /* Max. datatype size */
- size_t nelmts = 0; /* Number of elements in buffer */
- size_t src_nbytes; /* Number of bytes to read from source */
- size_t mem_nbytes; /* Number of bytes to convert in memory */
- size_t dst_nbytes; /* Number of bytes to write to destination */
- hsize_t total_src_nbytes; /* Total number of bytes to copy */
- size_t buf_size; /* Size of copy buffer */
- void *buf = NULL; /* Buffer for copying data */
- void *bkg = NULL; /* Temporary buffer for copying data */
- void *reclaim_buf = NULL; /* Buffer for reclaiming data */
- H5S_t *buf_space = NULL; /* Dataspace describing buffer */
- hid_t buf_sid = -1; /* ID for buffer dataspace */
- hsize_t buf_dim[1] = {0}; /* Dimension for buffer */
- hbool_t is_vlen = FALSE; /* Flag to indicate that VL type conversion should occur */
- hbool_t fix_ref = FALSE; /* Flag to indicate that ref values should be fixed */
- H5D_shared_t *shared_fo = (H5D_shared_t *)cpy_info->shared_fo; /* Pointer to the shared struct for dataset object */
- hbool_t try_sieve = FALSE; /* Try to get data from the sieve buffer */
- haddr_t sieve_start = HADDR_UNDEF; /* Start location of sieve buffer */
- haddr_t sieve_end = HADDR_UNDEF; /* End locations of sieve buffer */
- herr_t ret_value = SUCCEED; /* Return value */
+ haddr_t addr_src; /* File offset in source dataset */
+ haddr_t addr_dst; /* File offset in destination dataset */
+ H5T_path_t * tpath_src_mem = NULL, *tpath_mem_dst = NULL; /* Datatype conversion paths */
+ H5T_t * dt_dst = NULL; /* Destination datatype */
+ H5T_t * dt_mem = NULL; /* Memory datatype */
+ hid_t tid_src = -1; /* Datatype ID for source datatype */
+ hid_t tid_dst = -1; /* Datatype ID for destination datatype */
+ hid_t tid_mem = -1; /* Datatype ID for memory datatype */
+ size_t src_dt_size = 0; /* Source datatype size */
+ size_t mem_dt_size = 0; /* Memory datatype size */
+ size_t dst_dt_size = 0; /* Destination datatype size */
+ size_t max_dt_size; /* Max. datatype size */
+ size_t nelmts = 0; /* Number of elements in buffer */
+ size_t src_nbytes; /* Number of bytes to read from source */
+ size_t mem_nbytes; /* Number of bytes to convert in memory */
+ size_t dst_nbytes; /* Number of bytes to write to destination */
+ hsize_t total_src_nbytes; /* Total number of bytes to copy */
+ size_t buf_size; /* Size of copy buffer */
+ void * buf = NULL; /* Buffer for copying data */
+ void * bkg = NULL; /* Temporary buffer for copying data */
+ void * reclaim_buf = NULL; /* Buffer for reclaiming data */
+ H5S_t * buf_space = NULL; /* Dataspace describing buffer */
+ hid_t buf_sid = -1; /* ID for buffer dataspace */
+ hsize_t buf_dim[1] = {0}; /* Dimension for buffer */
+ hbool_t is_vlen = FALSE; /* Flag to indicate that VL type conversion should occur */
+ hbool_t fix_ref = FALSE; /* Flag to indicate that ref values should be fixed */
+ H5D_shared_t *shared_fo =
+ (H5D_shared_t *)cpy_info->shared_fo; /* Pointer to the shared struct for dataset object */
+ hbool_t try_sieve = FALSE; /* Try to get data from the sieve buffer */
+ haddr_t sieve_start = HADDR_UNDEF; /* Start location of sieve buffer */
+ haddr_t sieve_end = HADDR_UNDEF; /* End locations of sieve buffer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1370,7 +1342,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
HDassert(dt_src);
/* Allocate space for destination raw data */
- if(H5D__contig_alloc(f_dst, storage_dst) < 0)
+ if (H5D__contig_alloc(f_dst, storage_dst) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to allocate contiguous storage")
/* Set up number of bytes to copy, and initial buffer size */
@@ -1382,49 +1354,49 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
/* Create datatype ID for src datatype. We may or may not use this ID,
* but this ensures that the src datatype will be freed.
*/
- if((tid_src = H5I_register(H5I_DATATYPE, dt_src, FALSE)) < 0)
+ if ((tid_src = H5I_register(H5I_DATATYPE, dt_src, FALSE)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register source file datatype")
/* If there's a VLEN source datatype, set up type conversion information */
- if(H5T_detect_class(dt_src, H5T_VLEN, FALSE) > 0) {
+ if (H5T_detect_class(dt_src, H5T_VLEN, FALSE) > 0) {
/* create a memory copy of the variable-length datatype */
- if(NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
+ if (NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) {
+ if ((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) {
(void)H5T_close_real(dt_mem);
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register memory datatype")
} /* end if */
/* create variable-length datatype at the destinaton file */
- if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
+ if (NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy")
- if(H5T_set_loc(dt_dst, H5F_VOL_OBJ(f_dst), H5T_LOC_DISK) < 0) {
+ if (H5T_set_loc(dt_dst, H5F_VOL_OBJ(f_dst), H5T_LOC_DISK) < 0) {
(void)H5T_close_real(dt_dst);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
} /* end if */
- if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) {
+ if ((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) {
(void)H5T_close_real(dt_dst);
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype")
} /* end if */
/* Set up the conversion functions */
- if(NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem)))
+ if (NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes")
- if(NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst)))
+ if (NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes")
/* Determine largest datatype size */
- if(0 == (src_dt_size = H5T_get_size(dt_src)))
+ if (0 == (src_dt_size = H5T_get_size(dt_src)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size")
- if(0 == (mem_dt_size = H5T_get_size(dt_mem)))
+ if (0 == (mem_dt_size = H5T_get_size(dt_mem)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size")
max_dt_size = MAX(src_dt_size, mem_dt_size);
- if(0 == (dst_dt_size = H5T_get_size(dt_dst)))
+ if (0 == (dst_dt_size = H5T_get_size(dt_dst)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size")
max_dt_size = MAX(max_dt_size, dst_dt_size);
/* Set maximum number of whole elements that fit in buffer */
- if(0 == (nelmts = buf_size / max_dt_size))
+ if (0 == (nelmts = buf_size / max_dt_size))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "element size too large")
/* Set the number of bytes to transfer */
@@ -1439,11 +1411,11 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
buf_dim[0] = nelmts;
/* Create the space and set the initial extent */
- if(NULL == (buf_space = H5S_create_simple((unsigned)1, buf_dim, NULL)))
+ if (NULL == (buf_space = H5S_create_simple((unsigned)1, buf_dim, NULL)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
/* Atomize */
- if((buf_sid = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) {
+ if ((buf_sid = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) {
H5S_close(buf_space);
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
} /* end if */
@@ -1453,9 +1425,9 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
} /* end if */
else {
/* Check for reference datatype */
- if(H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) {
+ if (H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) {
/* Need to fix values of references when copying across files */
- if(f_src != f_dst)
+ if (f_src != f_dst)
fix_ref = TRUE;
} /* end if */
@@ -1465,16 +1437,16 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
/* Allocate space for copy buffer */
HDassert(buf_size);
- if(NULL == (buf = H5FL_BLK_MALLOC(type_conv, buf_size)))
+ if (NULL == (buf = H5FL_BLK_MALLOC(type_conv, buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer")
/* Need extra buffer for datatype conversions, to prevent stranding/leaking memory */
- if(is_vlen || fix_ref) {
- if(NULL == (reclaim_buf = H5FL_BLK_MALLOC(type_conv, buf_size)))
+ if (is_vlen || fix_ref) {
+ if (NULL == (reclaim_buf = H5FL_BLK_MALLOC(type_conv, buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer")
/* allocate temporary bkg buff for data conversion */
- if(NULL == (bkg = H5FL_BLK_MALLOC(type_conv, buf_size)))
+ if (NULL == (bkg = H5FL_BLK_MALLOC(type_conv, buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer")
} /* end if */
@@ -1484,23 +1456,22 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
/* If data sieving is enabled and the dataset is open in the file,
set up to copy data out of the sieve buffer if deemed possible later */
- if(H5F_HAS_FEATURE(f_src, H5FD_FEAT_DATA_SIEVE) &&
- shared_fo && shared_fo->cache.contig.sieve_buf) {
- try_sieve = TRUE;
+ if (H5F_HAS_FEATURE(f_src, H5FD_FEAT_DATA_SIEVE) && shared_fo && shared_fo->cache.contig.sieve_buf) {
+ try_sieve = TRUE;
sieve_start = shared_fo->cache.contig.sieve_loc;
- sieve_end = sieve_start + shared_fo->cache.contig.sieve_size;
+ sieve_end = sieve_start + shared_fo->cache.contig.sieve_size;
}
- while(total_src_nbytes > 0) {
+ while (total_src_nbytes > 0) {
/* Check if we should reduce the number of bytes to transfer */
- if(total_src_nbytes < src_nbytes) {
+ if (total_src_nbytes < src_nbytes) {
/* Adjust bytes to transfer */
src_nbytes = (size_t)total_src_nbytes;
/* Adjust dataspace describing buffer */
- if(is_vlen) {
+ if (is_vlen) {
/* Adjust destination & memory bytes to transfer */
- nelmts = src_nbytes / src_dt_size;
+ nelmts = src_nbytes / src_dt_size;
dst_nbytes = nelmts * dst_dt_size;
mem_nbytes = nelmts * mem_dt_size;
@@ -1508,7 +1479,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
buf_dim[0] = nelmts;
/* Adjust size of buffer's dataspace */
- if(H5S_set_extent_real(buf_space, buf_dim) < 0)
+ if (H5S_set_extent_real(buf_space, buf_dim) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to change buffer dataspace size")
} /* end if */
else
@@ -1517,19 +1488,20 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
} /* end if */
/* If the entire copy is within the sieve buffer, copy data from the sieve buffer */
- if(try_sieve && (addr_src >= sieve_start) && ((addr_src + src_nbytes -1) < sieve_end)) {
+ if (try_sieve && (addr_src >= sieve_start) && ((addr_src + src_nbytes - 1) < sieve_end)) {
unsigned char *base_sieve_buf = shared_fo->cache.contig.sieve_buf + (addr_src - sieve_start);
H5MM_memcpy(buf, base_sieve_buf, src_nbytes);
- } else
+ }
+ else
/* Read raw data from source file */
- if(H5F_block_read(f_src, H5FD_MEM_DRAW, addr_src, src_nbytes, buf) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read raw data")
+ if (H5F_block_read(f_src, H5FD_MEM_DRAW, addr_src, src_nbytes, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read raw data")
/* Perform datatype conversion, if necessary */
- if(is_vlen) {
+ if (is_vlen) {
/* Convert from source file to memory */
- if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
+ if (H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
/* Copy into another buffer, to reclaim memory later */
@@ -1539,22 +1511,22 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
HDmemset(bkg, 0, buf_size);
/* Convert from memory to destination file */
- if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
+ if (H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
/* Reclaim space from variable length data */
- if(H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
+ if (H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data")
} /* end if */
- else if(fix_ref) {
+ else if (fix_ref) {
/* Check for expanding references */
- if(cpy_info->expand_ref) {
+ if (cpy_info->expand_ref) {
/* Copy the reference elements */
- if(H5O_copy_expand_ref(f_src, tid_src, dt_src, buf, buf_size, f_dst, bkg, cpy_info) < 0)
+ if (H5O_copy_expand_ref(f_src, tid_src, dt_src, buf, buf_size, f_dst, bkg, cpy_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute")
/* After fix ref, copy the new reference elements to the buffer to write out */
- H5MM_memcpy(buf, bkg, buf_size);
+ H5MM_memcpy(buf, bkg, buf_size);
} /* end if */
else
/* Reset value to zero */
@@ -1562,7 +1534,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
} /* end if */
/* Write raw data to destination file */
- if(H5F_block_write(f_dst, H5FD_MEM_DRAW, addr_dst, dst_nbytes, buf) < 0)
+ if (H5F_block_write(f_dst, H5FD_MEM_DRAW, addr_dst, dst_nbytes, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data")
/* Adjust loop variables */
@@ -1572,21 +1544,20 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
} /* end while */
done:
- if(buf_sid > 0 && H5I_dec_ref(buf_sid) < 0)
+ if (buf_sid > 0 && H5I_dec_ref(buf_sid) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID")
- if(tid_src > 0 && H5I_dec_ref(tid_src) < 0)
+ if (tid_src > 0 && H5I_dec_ref(tid_src) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
- if(tid_dst > 0 && H5I_dec_ref(tid_dst) < 0)
+ if (tid_dst > 0 && H5I_dec_ref(tid_dst) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
- if(tid_mem > 0 && H5I_dec_ref(tid_mem) < 0)
+ if (tid_mem > 0 && H5I_dec_ref(tid_mem) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
- if(buf)
+ if (buf)
buf = H5FL_BLK_FREE(type_conv, buf);
- if(reclaim_buf)
+ if (reclaim_buf)
reclaim_buf = H5FL_BLK_FREE(type_conv, reclaim_buf);
- if(bkg)
+ if (bkg)
bkg = H5FL_BLK_FREE(type_conv, bkg);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__contig_copy() */
-
diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c
index 8725bd3..9509de3 100644
--- a/src/H5Ddbg.c
+++ b/src/H5Ddbg.c
@@ -15,51 +15,42 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
-#include "H5VLprivate.h" /* Virtual Object Layer */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5Ddebug
*
@@ -73,23 +64,23 @@
herr_t
H5Ddebug(hid_t dset_id)
{
- H5D_t *dset; /* Dataset to debug */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t *dset; /* Dataset to debug */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", dset_id);
/* Check args */
- if(NULL == (dset = (H5D_t *)H5VL_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (dset = (H5D_t *)H5VL_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
/* Print B-tree information */
- if(H5D_CHUNKED == dset->shared->layout.type)
+ if (H5D_CHUNKED == dset->shared->layout.type)
(void)H5D__chunk_dump_index(dset, stdout);
- else if(H5D_CONTIGUOUS == dset->shared->layout.type)
- HDfprintf(stdout, " %-10s %" PRIuHADDR "\n", "Address:", dset->shared->layout.storage.u.contig.addr);
+ else if (H5D_CONTIGUOUS == dset->shared->layout.type)
+ HDfprintf(stdout, " %-10s %" PRIuHADDR "\n",
+ "Address:", dset->shared->layout.storage.u.contig.addr);
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Ddebug() */
-
diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c
index 312bd4b..a091152 100644
--- a/src/H5Ddeprec.c
+++ b/src/H5Ddeprec.c
@@ -29,57 +29,48 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
-#include "H5VLprivate.h" /* Virtual Object Layer */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
-
+
/*-------------------------------------------------------------------------
* Function: H5Dcreate1
*
@@ -110,62 +101,60 @@
*-------------------------------------------------------------------------
*/
hid_t
-H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
- hid_t dcpl_id)
+H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id)
{
- void *dset = NULL; /* dset object from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object of loc_id */
+ void * dset = NULL; /* dset object from VOL connector */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, dcpl_id);
/* Check arguments */
- if(!name)
+ if (!name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL")
- if(!*name)
+ if (!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Set up collective metadata if appropriate */
- if(H5CX_set_loc(loc_id) < 0)
+ if (H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read")
- if(H5P_DEFAULT == dcpl_id)
+ if (H5P_DEFAULT == dcpl_id)
dcpl_id = H5P_DATASET_CREATE_DEFAULT;
- else
- if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID")
+ else if (TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID")
/* Set the DCPL for the API context */
H5CX_set_dcpl(dcpl_id);
/* Set location parameters */
- loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
/* get the location object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the dataset */
- if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, H5P_LINK_CREATE_DEFAULT, type_id, space_id, dcpl_id,
- H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if (NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, H5P_LINK_CREATE_DEFAULT, type_id,
+ space_id, dcpl_id, H5P_DATASET_ACCESS_DEFAULT,
+ H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Register the new dataset to get an ID for it */
- if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
if (H5I_INVALID_HID == ret_value)
- if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dcreate1() */
-
/*-------------------------------------------------------------------------
* Function: H5Dopen1
*
@@ -186,10 +175,10 @@ done:
hid_t
H5Dopen1(hid_t loc_id, const char *name)
{
- void *dset = NULL; /* dset object from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object of loc_id */
+ void * dset = NULL; /* dset object from VOL connector */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "i*s", loc_id, name);
@@ -201,30 +190,30 @@ H5Dopen1(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
/* Set location parameters */
- loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
/* get the location object */
- if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the dataset */
- if(NULL == (dset = H5VL_dataset_open(vol_obj, &loc_params, name, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
+ if (NULL == (dset = H5VL_dataset_open(vol_obj, &loc_params, name, H5P_DATASET_ACCESS_DEFAULT,
+ H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset")
/* Get an atom for the dataset */
- if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
done:
- if(H5I_INVALID_HID == ret_value)
- if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value)
+ if (dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Dopen1() */
-
/*-------------------------------------------------------------------------
* Function: H5Dextend
*
@@ -244,33 +233,34 @@ done:
herr_t
H5Dextend(hid_t dset_id, const hsize_t size[])
{
- H5VL_object_t *vol_obj = NULL; /* Dataset structure */
- hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
- H5S_t *ds = NULL; /* Dataspace struct */
- int ndims; /* Dataset/space rank */
- hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */
- int i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL; /* Dataset structure */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ H5S_t * ds = NULL; /* Dataspace struct */
+ int ndims; /* Dataset/space rank */
+ hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */
+ int i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", dset_id, size);
/* Check args */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
- if(!size)
+ if (!size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified")
/* Get the dataspace pointer for the dataset */
- if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) < 0)
+ if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) <
+ 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataspace")
- if(H5I_INVALID_HID == sid)
+ if (H5I_INVALID_HID == sid)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "received an invalid dataspace from the dataset")
- if(NULL == (ds = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE)))
+ if (NULL == (ds = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get dataspace structure from ID")
/* Get the dataset's current extent */
- if(H5S_get_simple_extent_dims(ds, dset_dims, NULL) < 0)
+ if (H5S_get_simple_extent_dims(ds, dset_dims, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions")
/* Get the dataset dimensions */
@@ -283,21 +273,22 @@ H5Dextend(hid_t dset_id, const hsize_t size[])
* XXX (VOL_MERGE): I feel like we should fail here instead of just silently
* not doing what we're supposed to do.
*/
- for(i = 0; i < ndims; i++)
- if(size[i] > dset_dims[i])
+ for (i = 0; i < ndims; i++)
+ if (size[i] > dset_dims[i])
dset_dims[i] = size[i];
/* Set up collective metadata if appropriate */
- if(H5CX_set_loc(dset_id) < 0)
+ if (H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Increase size */
- if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_dims)) < 0)
+ if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL, dset_dims)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to extend dataset")
done:
/* Close the dataspace */
- if(sid != H5I_INVALID_HID && H5I_dec_app_ref(sid) < 0)
+ if (sid != H5I_INVALID_HID && H5I_dec_app_ref(sid) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close dataspace")
FUNC_LEAVE_API(ret_value)
@@ -321,26 +312,25 @@ done:
herr_t
H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf)
{
- H5S_t *space; /* Dataspace for iteration */
- herr_t ret_value; /* Return value */
+ H5S_t *space; /* Dataspace for iteration */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iii*x", type_id, space_id, dxpl_id, buf);
/* Check args */
- if(H5I_DATATYPE != H5I_get_type(type_id) || buf == NULL)
+ if (H5I_DATATYPE != H5I_get_type(type_id) || buf == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
- if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
- if(!(H5S_has_extent(space)))
+ if (!(H5S_has_extent(space)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
/* Get the default dataset transfer property list if the user didn't provide one */
- if(H5P_DEFAULT == dxpl_id)
+ if (H5P_DEFAULT == dxpl_id)
dxpl_id = H5P_DATASET_XFER_DEFAULT;
- else
- if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
+ else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
@@ -350,7 +340,6 @@ H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf)
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Dvlen_reclaim() */
+} /* end H5Dvlen_reclaim() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
diff --git a/src/H5Dearray.c b/src/H5Dearray.c
index f1a6a5e..8a30054 100644
--- a/src/H5Dearray.c
+++ b/src/H5Dearray.c
@@ -25,30 +25,30 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5EAprivate.h" /* Extensible arrays */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5MFprivate.h" /* File space management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5VMprivate.h" /* Vector functions */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5EAprivate.h" /* Extensible arrays */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File space management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VMprivate.h" /* Vector functions */
/****************/
/* Local Macros */
/****************/
/* Value to fill unset array elements with */
-#define H5D_EARRAY_FILL HADDR_UNDEF
-#define H5D_EARRAY_FILT_FILL {HADDR_UNDEF, 0, 0}
-
+#define H5D_EARRAY_FILL HADDR_UNDEF
+#define H5D_EARRAY_FILT_FILL \
+ { \
+ HADDR_UNDEF, 0, 0 \
+ }
/******************/
/* Local Typedefs */
@@ -56,33 +56,32 @@
/* Extensible array create/open user data */
typedef struct H5D_earray_ctx_ud_t {
- const H5F_t *f; /* Pointer to file info */
- uint32_t chunk_size; /* Size of chunk (bytes) */
+ const H5F_t *f; /* Pointer to file info */
+ uint32_t chunk_size; /* Size of chunk (bytes) */
} H5D_earray_ctx_ud_t;
/* Extensible array callback context */
typedef struct H5D_earray_ctx_t {
- size_t file_addr_len; /* Size of addresses in the file (bytes) */
- size_t chunk_size_len; /* Size of chunk sizes in the file (bytes) */
+ size_t file_addr_len; /* Size of addresses in the file (bytes) */
+ size_t chunk_size_len; /* Size of chunk sizes in the file (bytes) */
} H5D_earray_ctx_t;
/* Extensible Array callback info for iteration over chunks */
typedef struct H5D_earray_it_ud_t {
- H5D_chunk_common_ud_t common; /* Common info for Fixed Array user data (must be first) */
- H5D_chunk_rec_t chunk_rec; /* Generic chunk record for callback */
- hbool_t filtered; /* Whether the chunks are filtered */
- H5D_chunk_cb_func_t cb; /* Chunk callback routine */
- void *udata; /* User data for chunk callback routine */
+ H5D_chunk_common_ud_t common; /* Common info for Fixed Array user data (must be first) */
+ H5D_chunk_rec_t chunk_rec; /* Generic chunk record for callback */
+ hbool_t filtered; /* Whether the chunks are filtered */
+ H5D_chunk_cb_func_t cb; /* Chunk callback routine */
+ void * udata; /* User data for chunk callback routine */
} H5D_earray_it_ud_t;
/* Native extensible array element for chunks w/filters */
typedef struct H5D_earray_filt_elmt_t {
- haddr_t addr; /* Address of chunk */
- uint32_t nbytes; /* Size of chunk (in file) */
- uint32_t filter_mask; /* Excluded filters for chunk */
+ haddr_t addr; /* Address of chunk */
+ uint32_t nbytes; /* Size of chunk (in file) */
+ uint32_t filter_mask; /* Excluded filters for chunk */
} H5D_earray_filt_elmt_t;
-
/********************/
/* Local Prototypes */
/********************/
@@ -91,119 +90,106 @@ static int H5D__earray_idx_iterate_cb(hsize_t idx, const void *_elmt, void *_uda
static int H5D__earray_idx_delete_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata);
/* Extensible array class callbacks for chunks w/o filters */
-static void *H5D__earray_crt_context(void *udata);
+static void * H5D__earray_crt_context(void *udata);
static herr_t H5D__earray_dst_context(void *ctx);
static herr_t H5D__earray_fill(void *nat_blk, size_t nelmts);
-static herr_t H5D__earray_encode(void *raw, const void *elmt, size_t nelmts,
- void *ctx);
-static herr_t H5D__earray_decode(const void *raw, void *elmt, size_t nelmts,
- void *ctx);
-static herr_t H5D__earray_debug(FILE *stream, int indent, int fwidth,
- hsize_t idx, const void *elmt);
-static void *H5D__earray_crt_dbg_context(H5F_t *f, haddr_t obj_addr);
+static herr_t H5D__earray_encode(void *raw, const void *elmt, size_t nelmts, void *ctx);
+static herr_t H5D__earray_decode(const void *raw, void *elmt, size_t nelmts, void *ctx);
+static herr_t H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt);
+static void * H5D__earray_crt_dbg_context(H5F_t *f, haddr_t obj_addr);
static herr_t H5D__earray_dst_dbg_context(void *dbg_ctx);
/* Extensible array class callbacks for chunks w/filters */
/* (some shared with callbacks for chunks w/o filters) */
static herr_t H5D__earray_filt_fill(void *nat_blk, size_t nelmts);
-static herr_t H5D__earray_filt_encode(void *raw, const void *elmt, size_t nelmts,
- void *ctx);
-static herr_t H5D__earray_filt_decode(const void *raw, void *elmt, size_t nelmts,
- void *ctx);
-static herr_t H5D__earray_filt_debug(FILE *stream, int indent, int fwidth,
- hsize_t idx, const void *elmt);
+static herr_t H5D__earray_filt_encode(void *raw, const void *elmt, size_t nelmts, void *ctx);
+static herr_t H5D__earray_filt_decode(const void *raw, void *elmt, size_t nelmts, void *ctx);
+static herr_t H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt);
/* Chunked layout indexing callbacks */
-static herr_t H5D__earray_idx_init(const H5D_chk_idx_info_t *idx_info,
- const H5S_t *space, haddr_t dset_ohdr_addr);
-static herr_t H5D__earray_idx_create(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__earray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space,
+ haddr_t dset_ohdr_addr);
+static herr_t H5D__earray_idx_create(const H5D_chk_idx_info_t *idx_info);
static hbool_t H5D__earray_idx_is_space_alloc(const H5O_storage_chunk_t *storage);
-static herr_t H5D__earray_idx_insert(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_ud_t *udata, const H5D_t *dset);
-static herr_t H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_ud_t *udata);
-static herr_t H5D__earray_idx_resize(H5O_layout_chunk_t *layout);
-static int H5D__earray_idx_iterate(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_cb_func_t chunk_cb, void *chunk_udata);
-static herr_t H5D__earray_idx_remove(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_common_ud_t *udata);
-static herr_t H5D__earray_idx_delete(const H5D_chk_idx_info_t *idx_info);
-static herr_t H5D__earray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
- const H5D_chk_idx_info_t *idx_info_dst);
-static herr_t H5D__earray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
- H5O_storage_chunk_t *storage_dst);
-static herr_t H5D__earray_idx_size(const H5D_chk_idx_info_t *idx_info,
- hsize_t *size);
-static herr_t H5D__earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
-static herr_t H5D__earray_idx_dump(const H5O_storage_chunk_t *storage,
- FILE *stream);
-static herr_t H5D__earray_idx_dest(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
+ const H5D_t *dset);
+static herr_t H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata);
+static herr_t H5D__earray_idx_resize(H5O_layout_chunk_t *layout);
+static int H5D__earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb,
+ void *chunk_udata);
+static herr_t H5D__earray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata);
+static herr_t H5D__earray_idx_delete(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__earray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+ const H5D_chk_idx_info_t *idx_info_dst);
+static herr_t H5D__earray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
+ H5O_storage_chunk_t *storage_dst);
+static herr_t H5D__earray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size);
+static herr_t H5D__earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
+static herr_t H5D__earray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream);
+static herr_t H5D__earray_idx_dest(const H5D_chk_idx_info_t *idx_info);
/* Generic extensible array routines */
static herr_t H5D__earray_idx_open(const H5D_chk_idx_info_t *idx_info);
static herr_t H5D__earray_idx_depend(const H5D_chk_idx_info_t *idx_info);
-
/*********************/
/* Package Variables */
/*********************/
/* Extensible array indexed chunk I/O ops */
const H5D_chunk_ops_t H5D_COPS_EARRAY[1] = {{
- TRUE, /* Extensible array indices support SWMR access */
- H5D__earray_idx_init, /* init */
- H5D__earray_idx_create, /* create */
- H5D__earray_idx_is_space_alloc, /* is_space_alloc */
- H5D__earray_idx_insert, /* insert */
- H5D__earray_idx_get_addr, /* get_addr */
- H5D__earray_idx_resize, /* resize */
- H5D__earray_idx_iterate, /* iterate */
- H5D__earray_idx_remove, /* remove */
- H5D__earray_idx_delete, /* delete */
- H5D__earray_idx_copy_setup, /* copy_setup */
- H5D__earray_idx_copy_shutdown, /* copy_shutdown */
- H5D__earray_idx_size, /* size */
- H5D__earray_idx_reset, /* reset */
- H5D__earray_idx_dump, /* dump */
- H5D__earray_idx_dest /* destroy */
+ TRUE, /* Extensible array indices support SWMR access */
+ H5D__earray_idx_init, /* init */
+ H5D__earray_idx_create, /* create */
+ H5D__earray_idx_is_space_alloc, /* is_space_alloc */
+ H5D__earray_idx_insert, /* insert */
+ H5D__earray_idx_get_addr, /* get_addr */
+ H5D__earray_idx_resize, /* resize */
+ H5D__earray_idx_iterate, /* iterate */
+ H5D__earray_idx_remove, /* remove */
+ H5D__earray_idx_delete, /* delete */
+ H5D__earray_idx_copy_setup, /* copy_setup */
+ H5D__earray_idx_copy_shutdown, /* copy_shutdown */
+ H5D__earray_idx_size, /* size */
+ H5D__earray_idx_reset, /* reset */
+ H5D__earray_idx_dump, /* dump */
+ H5D__earray_idx_dest /* destroy */
}};
-
/*****************************/
/* Library Private Variables */
/*****************************/
/* Extensible array class callbacks for dataset chunks w/o filters */
-const H5EA_class_t H5EA_CLS_CHUNK[1]={{
- H5EA_CLS_CHUNK_ID, /* Type of extensible array */
- "Chunk w/o filters", /* Name of extensible array class */
- sizeof(haddr_t), /* Size of native element */
- H5D__earray_crt_context, /* Create context */
- H5D__earray_dst_context, /* Destroy context */
- H5D__earray_fill, /* Fill block of missing elements callback */
- H5D__earray_encode, /* Element encoding callback */
- H5D__earray_decode, /* Element decoding callback */
- H5D__earray_debug, /* Element debugging callback */
+const H5EA_class_t H5EA_CLS_CHUNK[1] = {{
+ H5EA_CLS_CHUNK_ID, /* Type of extensible array */
+ "Chunk w/o filters", /* Name of extensible array class */
+ sizeof(haddr_t), /* Size of native element */
+ H5D__earray_crt_context, /* Create context */
+ H5D__earray_dst_context, /* Destroy context */
+ H5D__earray_fill, /* Fill block of missing elements callback */
+ H5D__earray_encode, /* Element encoding callback */
+ H5D__earray_decode, /* Element decoding callback */
+ H5D__earray_debug, /* Element debugging callback */
H5D__earray_crt_dbg_context, /* Create debugging context */
H5D__earray_dst_dbg_context /* Destroy debugging context */
}};
/* Extensible array class callbacks for dataset chunks w/filters */
-const H5EA_class_t H5EA_CLS_FILT_CHUNK[1]={{
- H5EA_CLS_FILT_CHUNK_ID, /* Type of extensible array */
- "Chunk w/filters", /* Name of extensible array class */
+const H5EA_class_t H5EA_CLS_FILT_CHUNK[1] = {{
+ H5EA_CLS_FILT_CHUNK_ID, /* Type of extensible array */
+ "Chunk w/filters", /* Name of extensible array class */
sizeof(H5D_earray_filt_elmt_t), /* Size of native element */
- H5D__earray_crt_context, /* Create context */
- H5D__earray_dst_context, /* Destroy context */
- H5D__earray_filt_fill, /* Fill block of missing elements callback */
- H5D__earray_filt_encode, /* Element encoding callback */
- H5D__earray_filt_decode, /* Element decoding callback */
- H5D__earray_filt_debug, /* Element debugging callback */
- H5D__earray_crt_dbg_context, /* Create debugging context */
- H5D__earray_dst_dbg_context /* Destroy debugging context */
+ H5D__earray_crt_context, /* Create context */
+ H5D__earray_dst_context, /* Destroy context */
+ H5D__earray_filt_fill, /* Fill block of missing elements callback */
+ H5D__earray_filt_encode, /* Element encoding callback */
+ H5D__earray_filt_decode, /* Element decoding callback */
+ H5D__earray_filt_debug, /* Element debugging callback */
+ H5D__earray_crt_dbg_context, /* Create debugging context */
+ H5D__earray_dst_dbg_context /* Destroy debugging context */
}};
-
/*******************/
/* Local Variables */
/*******************/
@@ -213,8 +199,6 @@ const H5EA_class_t H5EA_CLS_FILT_CHUNK[1]={{
H5FL_DEFINE_STATIC(H5D_earray_ctx_t);
H5FL_DEFINE_STATIC(H5D_earray_ctx_ud_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_crt_context
*
@@ -231,9 +215,9 @@ H5FL_DEFINE_STATIC(H5D_earray_ctx_ud_t);
static void *
H5D__earray_crt_context(void *_udata)
{
- H5D_earray_ctx_t *ctx; /* Extensible array callback context */
+ H5D_earray_ctx_t * ctx; /* Extensible array callback context */
H5D_earray_ctx_ud_t *udata = (H5D_earray_ctx_ud_t *)_udata; /* User data for extensible array context */
- void *ret_value = NULL; /* Return value */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -243,8 +227,9 @@ H5D__earray_crt_context(void *_udata)
HDassert(udata->chunk_size > 0);
/* Allocate new context structure */
- if(NULL == (ctx = H5FL_MALLOC(H5D_earray_ctx_t)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate extensible array client callback context")
+ if (NULL == (ctx = H5FL_MALLOC(H5D_earray_ctx_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL,
+ "can't allocate extensible array client callback context")
/* Initialize the context */
ctx->file_addr_len = H5F_SIZEOF_ADDR(udata->f);
@@ -253,7 +238,7 @@ H5D__earray_crt_context(void *_udata)
* for an extra byte, in case the filter makes the chunk larger.
*/
ctx->chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)udata->chunk_size) + 8) / 8);
- if(ctx->chunk_size_len > 8)
+ if (ctx->chunk_size_len > 8)
ctx->chunk_size_len = 8;
/* Set return value */
@@ -263,7 +248,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__earray_crt_context() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_dst_context
*
@@ -280,7 +264,7 @@ done:
static herr_t
H5D__earray_dst_context(void *_ctx)
{
- H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */
+ H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */
FUNC_ENTER_STATIC_NOERR
@@ -293,7 +277,6 @@ H5D__earray_dst_context(void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_dst_context() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_fill
*
@@ -310,7 +293,7 @@ H5D__earray_dst_context(void *_ctx)
static herr_t
H5D__earray_fill(void *nat_blk, size_t nelmts)
{
- haddr_t fill_val = H5D_EARRAY_FILL; /* Value to fill elements with */
+ haddr_t fill_val = H5D_EARRAY_FILL; /* Value to fill elements with */
FUNC_ENTER_STATIC_NOERR
@@ -323,7 +306,6 @@ H5D__earray_fill(void *nat_blk, size_t nelmts)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_fill() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_encode
*
@@ -340,8 +322,8 @@ H5D__earray_fill(void *nat_blk, size_t nelmts)
static herr_t
H5D__earray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)
{
- H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */
- const haddr_t *elmt = (const haddr_t *)_elmt; /* Convenience pointer to native elements */
+ H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */
+ const haddr_t * elmt = (const haddr_t *)_elmt; /* Convenience pointer to native elements */
FUNC_ENTER_STATIC_NOERR
@@ -352,7 +334,7 @@ H5D__earray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)
HDassert(ctx);
/* Encode native elements into raw elements */
- while(nelmts) {
+ while (nelmts) {
/* Encode element */
/* (advances 'raw' pointer) */
H5F_addr_encode_len(ctx->file_addr_len, (uint8_t **)&raw, *elmt);
@@ -367,7 +349,6 @@ H5D__earray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_encode() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_decode
*
@@ -384,9 +365,9 @@ H5D__earray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)
static herr_t
H5D__earray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
{
- H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */
- haddr_t *elmt = (haddr_t *)_elmt; /* Convenience pointer to native elements */
- const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
+ H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */
+ haddr_t * elmt = (haddr_t *)_elmt; /* Convenience pointer to native elements */
+ const uint8_t * raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
FUNC_ENTER_STATIC_NOERR
@@ -396,7 +377,7 @@ H5D__earray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
HDassert(nelmts);
/* Decode raw elements into native elements */
- while(nelmts) {
+ while (nelmts) {
/* Decode element */
/* (advances 'raw' pointer) */
H5F_addr_decode_len(ctx->file_addr_len, &raw, elmt);
@@ -411,7 +392,6 @@ H5D__earray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_decode() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_debug
*
@@ -426,10 +406,9 @@ H5D__earray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
- const void *elmt)
+H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt)
{
- char temp_str[128]; /* Temporary string, for formatting */
+ char temp_str[128]; /* Temporary string, for formatting */
FUNC_ENTER_STATIC_NOERR
@@ -439,13 +418,11 @@ H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
/* Print element */
HDsprintf(temp_str, "Element #%" PRIuHSIZE ":", idx);
- HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str,
- *(const haddr_t *)elmt);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_debug() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_filt_fill
*
@@ -462,7 +439,7 @@ H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
static herr_t
H5D__earray_filt_fill(void *nat_blk, size_t nelmts)
{
- H5D_earray_filt_elmt_t fill_val = H5D_EARRAY_FILT_FILL; /* Value to fill elements with */
+ H5D_earray_filt_elmt_t fill_val = H5D_EARRAY_FILT_FILL; /* Value to fill elements with */
FUNC_ENTER_STATIC_NOERR
@@ -476,7 +453,6 @@ H5D__earray_filt_fill(void *nat_blk, size_t nelmts)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_filt_fill() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_filt_encode
*
@@ -493,9 +469,10 @@ H5D__earray_filt_fill(void *nat_blk, size_t nelmts)
static herr_t
H5D__earray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx)
{
- H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */
- uint8_t *raw = (uint8_t *)_raw; /* Convenience pointer to raw elements */
- const H5D_earray_filt_elmt_t *elmt = (const H5D_earray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
+ H5D_earray_ctx_t * ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */
+ uint8_t * raw = (uint8_t *)_raw; /* Convenience pointer to raw elements */
+ const H5D_earray_filt_elmt_t *elmt =
+ (const H5D_earray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
FUNC_ENTER_STATIC_NOERR
@@ -506,7 +483,7 @@ H5D__earray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx
HDassert(ctx);
/* Encode native elements into raw elements */
- while(nelmts) {
+ while (nelmts) {
/* Encode element */
/* (advances 'raw' pointer) */
H5F_addr_encode_len(ctx->file_addr_len, &raw, elmt->addr);
@@ -523,7 +500,6 @@ H5D__earray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_filt_encode() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_filt_decode
*
@@ -540,8 +516,9 @@ H5D__earray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx
static herr_t
H5D__earray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
{
- H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */
- H5D_earray_filt_elmt_t *elmt = (H5D_earray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
+ H5D_earray_ctx_t * ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */
+ H5D_earray_filt_elmt_t *elmt =
+ (H5D_earray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
FUNC_ENTER_STATIC_NOERR
@@ -552,7 +529,7 @@ H5D__earray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx
HDassert(nelmts);
/* Decode raw elements into native elements */
- while(nelmts) {
+ while (nelmts) {
/* Decode element */
/* (advances 'raw' pointer) */
H5F_addr_decode_len(ctx->file_addr_len, &raw, &elmt->addr);
@@ -569,7 +546,6 @@ H5D__earray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_filt_decode() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_filt_debug
*
@@ -584,11 +560,11 @@ H5D__earray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
- const void *_elmt)
+H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *_elmt)
{
- const H5D_earray_filt_elmt_t *elmt = (const H5D_earray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
- char temp_str[128]; /* Temporary string, for formatting */
+ const H5D_earray_filt_elmt_t *elmt =
+ (const H5D_earray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
+ char temp_str[128]; /* Temporary string, for formatting */
FUNC_ENTER_STATIC_NOERR
@@ -598,13 +574,12 @@ H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
/* Print element */
HDsprintf(temp_str, "Element #%" PRIuHSIZE ":", idx);
- HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str,
- elmt->addr, elmt->nbytes, elmt->filter_mask);
+ HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr,
+ elmt->nbytes, elmt->filter_mask);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_filt_debug() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_crt_dbg_context
*
@@ -621,11 +596,11 @@ H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
static void *
H5D__earray_crt_dbg_context(H5F_t *f, haddr_t obj_addr)
{
- H5D_earray_ctx_ud_t *dbg_ctx = NULL; /* Context for fixed array callback */
- H5O_loc_t obj_loc; /* Pointer to an object's location */
- hbool_t obj_opened = FALSE; /* Flag to indicate that the object header was opened */
- H5O_layout_t layout; /* Layout message */
- void *ret_value = NULL; /* Return value */
+ H5D_earray_ctx_ud_t *dbg_ctx = NULL; /* Context for fixed array callback */
+ H5O_loc_t obj_loc; /* Pointer to an object's location */
+ hbool_t obj_opened = FALSE; /* Flag to indicate that the object header was opened */
+ H5O_layout_t layout; /* Layout message */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -634,8 +609,9 @@ H5D__earray_crt_dbg_context(H5F_t *f, haddr_t obj_addr)
HDassert(H5F_addr_defined(obj_addr));
/* Allocate context for debugging callback */
- if(NULL == (dbg_ctx = H5FL_MALLOC(H5D_earray_ctx_ud_t)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate extensible array client callback context")
+ if (NULL == (dbg_ctx = H5FL_MALLOC(H5D_earray_ctx_ud_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL,
+ "can't allocate extensible array client callback context")
/* Set up the object header location info */
H5O_loc_reset(&obj_loc);
@@ -643,20 +619,20 @@ H5D__earray_crt_dbg_context(H5F_t *f, haddr_t obj_addr)
obj_loc.addr = obj_addr;
/* Open the object header where the layout message resides */
- if(H5O_open(&obj_loc) < 0)
+ if (H5O_open(&obj_loc) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "can't open object header")
obj_opened = TRUE;
/* Read the layout message */
- if(NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, &layout))
+ if (NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, &layout))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get layout info")
/* close the object header */
- if(H5O_close(&obj_loc, NULL) < 0)
+ if (H5O_close(&obj_loc, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header")
/* Create user data */
- dbg_ctx->f = f;
+ dbg_ctx->f = f;
dbg_ctx->chunk_size = layout.u.chunk.size;
/* Set return value */
@@ -664,21 +640,20 @@ H5D__earray_crt_dbg_context(H5F_t *f, haddr_t obj_addr)
done:
/* Cleanup on error */
- if(ret_value == NULL) {
+ if (ret_value == NULL) {
/* Release context structure */
- if(dbg_ctx)
+ if (dbg_ctx)
dbg_ctx = H5FL_FREE(H5D_earray_ctx_ud_t, dbg_ctx);
/* Close object header */
- if(obj_opened)
- if(H5O_close(&obj_loc, NULL) < 0)
+ if (obj_opened)
+ if (H5O_close(&obj_loc, NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__earray_crt_dbg_context() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_dst_dbg_context
*
@@ -695,7 +670,8 @@ done:
static herr_t
H5D__earray_dst_dbg_context(void *_dbg_ctx)
{
- H5D_earray_ctx_ud_t *dbg_ctx = (H5D_earray_ctx_ud_t *)_dbg_ctx; /* Context for extensible array callback */
+ H5D_earray_ctx_ud_t *dbg_ctx =
+ (H5D_earray_ctx_ud_t *)_dbg_ctx; /* Context for extensible array callback */
FUNC_ENTER_STATIC_NOERR
@@ -708,7 +684,6 @@ H5D__earray_dst_dbg_context(void *_dbg_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_dst_dbg_context() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_depend
*
@@ -726,10 +701,10 @@ H5D__earray_dst_dbg_context(void *_dbg_ctx)
static herr_t
H5D__earray_idx_depend(const H5D_chk_idx_info_t *idx_info)
{
- H5O_t *oh = NULL; /* Object header */
- H5O_loc_t oloc; /* Temporary object header location for dataset */
- H5AC_proxy_entry_t *oh_proxy; /* Dataset's object header proxy */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_t * oh = NULL; /* Object header */
+ H5O_loc_t oloc; /* Temporary object header location for dataset */
+ H5AC_proxy_entry_t *oh_proxy; /* Dataset's object header proxy */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -751,26 +726,26 @@ H5D__earray_idx_depend(const H5D_chk_idx_info_t *idx_info)
oloc.addr = idx_info->storage->u.earray.dset_ohdr_addr;
/* Get header */
- if(NULL == (oh = H5O_protect(&oloc, H5AC__READ_ONLY_FLAG, TRUE)))
+ if (NULL == (oh = H5O_protect(&oloc, H5AC__READ_ONLY_FLAG, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect object header")
/* Retrieve the dataset's object header proxy */
- if(NULL == (oh_proxy = H5O_get_proxy(oh)))
+ if (NULL == (oh_proxy = H5O_get_proxy(oh)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataset object header proxy")
/* Make the extensible array a child flush dependency of the dataset's object header */
- if(H5EA_depend(idx_info->storage->u.earray.ea, oh_proxy) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header proxy")
+ if (H5EA_depend(idx_info->storage->u.earray.ea, oh_proxy) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency on object header proxy")
done:
/* Release the object header from the cache */
- if(oh && H5O_unprotect(&oloc, oh, H5AC__NO_FLAGS_SET) < 0)
+ if (oh && H5O_unprotect(&oloc, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__earray_idx_depend() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_open
*
@@ -792,8 +767,8 @@ done:
static herr_t
H5D__earray_idx_open(const H5D_chk_idx_info_t *idx_info)
{
- H5D_earray_ctx_ud_t udata; /* User data for extensible array open call */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_earray_ctx_ud_t udata; /* User data for extensible array open call */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -809,23 +784,24 @@ H5D__earray_idx_open(const H5D_chk_idx_info_t *idx_info)
HDassert(NULL == idx_info->storage->u.earray.ea);
/* Set up the user data */
- udata.f = idx_info->f;
+ udata.f = idx_info->f;
udata.chunk_size = idx_info->layout->size;
/* Open the extensible array for the chunk index */
- if(NULL == (idx_info->storage->u.earray.ea = H5EA_open(idx_info->f, idx_info->storage->idx_addr, &udata)))
+ if (NULL ==
+ (idx_info->storage->u.earray.ea = H5EA_open(idx_info->f, idx_info->storage->idx_addr, &udata)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open extensible array")
/* Check for SWMR writes to the file */
- if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
- if(H5D__earray_idx_depend(idx_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header")
+ if (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
+ if (H5D__earray_idx_depend(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency on object header")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__earray_idx_open() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_init
*
@@ -839,15 +815,14 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__earray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space,
- haddr_t dset_ohdr_addr)
+H5D__earray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space, haddr_t dset_ohdr_addr)
{
- hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Max. size of dataset dimensions */
- int unlim_dim; /* Rank of the dataset's unlimited dimension */
- int sndims; /* Rank of dataspace */
- unsigned ndims; /* Rank of dataspace */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Max. size of dataset dimensions */
+ int unlim_dim; /* Rank of the dataset's unlimited dimension */
+ int sndims; /* Rank of dataspace */
+ unsigned ndims; /* Rank of dataspace */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -861,26 +836,26 @@ H5D__earray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space,
HDassert(H5F_addr_defined(dset_ohdr_addr));
/* Get the dim info for dataset */
- if((sndims = H5S_get_simple_extent_dims(space, NULL, max_dims)) < 0)
+ if ((sndims = H5S_get_simple_extent_dims(space, NULL, max_dims)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions")
H5_CHECKED_ASSIGN(ndims, unsigned, sndims, int);
/* Find the rank of the unlimited dimension */
unlim_dim = (-1);
- for(u = 0; u < ndims; u++) {
+ for (u = 0; u < ndims; u++) {
/* Check for unlimited dimension */
- if(H5S_UNLIMITED == max_dims[u]) {
+ if (H5S_UNLIMITED == max_dims[u]) {
/* Check if we've already found an unlimited dimension */
- if(unlim_dim >= 0)
+ if (unlim_dim >= 0)
HGOTO_ERROR(H5E_DATASET, H5E_ALREADYINIT, FAIL, "already found unlimited dimension")
/* Set the unlimited dimension */
unlim_dim = (int)u;
} /* end if */
- } /* end for */
+ } /* end for */
/* Check if we didn't find an unlimited dimension */
- if(unlim_dim < 0)
+ if (unlim_dim < 0)
HGOTO_ERROR(H5E_DATASET, H5E_UNINITIALIZED, FAIL, "didn't find unlimited dimension")
/* Set the unlimited dimension for the layout's future use */
@@ -893,7 +868,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__earray_idx_init() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_create
*
@@ -915,9 +889,9 @@ done:
static herr_t
H5D__earray_idx_create(const H5D_chk_idx_info_t *idx_info)
{
- H5EA_create_t cparam; /* Extensible array creation parameters */
- H5D_earray_ctx_ud_t udata; /* User data for extensible array create call */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5EA_create_t cparam; /* Extensible array creation parameters */
+ H5D_earray_ctx_ud_t udata; /* User data for extensible array create call */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -931,21 +905,21 @@ H5D__earray_idx_create(const H5D_chk_idx_info_t *idx_info)
HDassert(NULL == idx_info->storage->u.earray.ea);
/* General parameters */
- if(idx_info->pline->nused > 0) {
- unsigned chunk_size_len; /* Size of encoded chunk size */
+ if (idx_info->pline->nused > 0) {
+ unsigned chunk_size_len; /* Size of encoded chunk size */
/* Compute the size required for encoding the size of a chunk, allowing
* for an extra byte, in case the filter makes the chunk larger.
*/
chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)idx_info->layout->size) + 8) / 8);
- if(chunk_size_len > 8)
+ if (chunk_size_len > 8)
chunk_size_len = 8;
- cparam.cls = H5EA_CLS_FILT_CHUNK;
+ cparam.cls = H5EA_CLS_FILT_CHUNK;
cparam.raw_elmt_size = (uint8_t)(H5F_SIZEOF_ADDR(idx_info->f) + chunk_size_len + 4);
} /* end if */
else {
- cparam.cls = H5EA_CLS_CHUNK;
+ cparam.cls = H5EA_CLS_CHUNK;
cparam.raw_elmt_size = (uint8_t)H5F_SIZEOF_ADDR(idx_info->f);
} /* end else */
cparam.max_nelmts_bits = idx_info->layout->u.earray.cparam.max_nelmts_bits;
@@ -960,27 +934,27 @@ H5D__earray_idx_create(const H5D_chk_idx_info_t *idx_info)
HDassert(cparam.max_dblk_page_nelmts_bits > 0);
/* Set up the user data */
- udata.f = idx_info->f;
+ udata.f = idx_info->f;
udata.chunk_size = idx_info->layout->size;
/* Create the extensible array for the chunk index */
- if(NULL == (idx_info->storage->u.earray.ea = H5EA_create(idx_info->f, &cparam, &udata)))
+ if (NULL == (idx_info->storage->u.earray.ea = H5EA_create(idx_info->f, &cparam, &udata)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create extensible array")
/* Get the address of the extensible array in file */
- if(H5EA_get_addr(idx_info->storage->u.earray.ea, &(idx_info->storage->idx_addr)) < 0)
+ if (H5EA_get_addr(idx_info->storage->u.earray.ea, &(idx_info->storage->idx_addr)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array address")
/* Check for SWMR writes to the file */
- if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
- if(H5D__earray_idx_depend(idx_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header")
+ if (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
+ if (H5D__earray_idx_depend(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency on object header")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__earray_idx_create() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_is_space_alloc
*
@@ -1004,7 +978,6 @@ H5D__earray_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr))
} /* end H5D__earray_idx_is_space_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_insert
*
@@ -1018,10 +991,10 @@ H5D__earray_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
*/
static herr_t
H5D__earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
- const H5D_t H5_ATTR_UNUSED *dset)
+ const H5D_t H5_ATTR_UNUSED *dset)
{
- H5EA_t *ea; /* Pointer to extensible array structure */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5EA_t *ea; /* Pointer to extensible array structure */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1035,36 +1008,37 @@ H5D__earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata
HDassert(udata);
/* Check if the extensible array is open yet */
- if(NULL == idx_info->storage->u.earray.ea) {
+ if (NULL == idx_info->storage->u.earray.ea) {
/* Open the extensible array in file */
- if(H5D__earray_idx_open(idx_info) < 0)
+ if (H5D__earray_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array")
- } else /* Patch the top level file pointer contained in ea if needed */
+ }
+ else /* Patch the top level file pointer contained in ea if needed */
H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f);
/* Set convenience pointer to extensible array structure */
ea = idx_info->storage->u.earray.ea;
- if(!H5F_addr_defined(udata->chunk_block.offset))
+ if (!H5F_addr_defined(udata->chunk_block.offset))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "The chunk should have allocated already")
- if(udata->chunk_idx != (udata->chunk_idx & 0xffffffff)) /* negative value */
+ if (udata->chunk_idx != (udata->chunk_idx & 0xffffffff)) /* negative value */
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk index must be less than 2^32")
/* Check for filters on chunks */
- if(idx_info->pline->nused > 0) {
- H5D_earray_filt_elmt_t elmt; /* Extensible array element */
+ if (idx_info->pline->nused > 0) {
+ H5D_earray_filt_elmt_t elmt; /* Extensible array element */
elmt.addr = udata->chunk_block.offset;
H5_CHECKED_ASSIGN(elmt.nbytes, uint32_t, udata->chunk_block.length, hsize_t);
elmt.filter_mask = udata->filter_mask;
/* Set the info for the chunk */
- if(H5EA_set(ea, udata->chunk_idx, &elmt) < 0)
+ if (H5EA_set(ea, udata->chunk_idx, &elmt) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info")
} /* end if */
else {
/* Set the address for the chunk */
- if(H5EA_set(ea, udata->chunk_idx, &udata->chunk_block.offset) < 0)
+ if (H5EA_set(ea, udata->chunk_idx, &udata->chunk_block.offset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk address")
} /* end else */
@@ -1072,7 +1046,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__earray_idx_insert() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_get_addr
*
@@ -1090,9 +1063,9 @@ done:
static herr_t
H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata)
{
- H5EA_t *ea; /* Pointer to extensible array structure */
- hsize_t idx; /* Array index of chunk */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5EA_t *ea; /* Pointer to extensible array structure */
+ hsize_t idx; /* Array index of chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1106,69 +1079,71 @@ H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda
HDassert(udata);
/* Check if the extensible array is open yet */
- if(NULL == idx_info->storage->u.earray.ea) {
+ if (NULL == idx_info->storage->u.earray.ea) {
/* Open the extensible array in file */
- if(H5D__earray_idx_open(idx_info) < 0)
+ if (H5D__earray_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array")
- } else /* Patch the top level file pointer contained in ea if needed */
+ }
+ else /* Patch the top level file pointer contained in ea if needed */
H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f);
/* Set convenience pointer to extensible array structure */
ea = idx_info->storage->u.earray.ea;
/* Check for unlimited dim. not being the slowest-changing dim. */
- if(idx_info->layout->u.earray.unlim_dim > 0) {
- hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */
+ if (idx_info->layout->u.earray.unlim_dim > 0) {
+ hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */
unsigned ndims = (idx_info->layout->ndims - 1); /* Number of dimensions */
unsigned u;
/* Compute coordinate offset from scaled offset */
- for(u = 0; u < ndims; u++)
+ for (u = 0; u < ndims; u++)
swizzled_coords[u] = udata->common.scaled[u] * idx_info->layout->dim[u];
H5VM_swizzle_coords(hsize_t, swizzled_coords, idx_info->layout->u.earray.unlim_dim);
/* Calculate the index of this chunk */
- idx = H5VM_chunk_index(ndims, swizzled_coords, idx_info->layout->u.earray.swizzled_dim, idx_info->layout->u.earray.swizzled_max_down_chunks);
+ idx = H5VM_chunk_index(ndims, swizzled_coords, idx_info->layout->u.earray.swizzled_dim,
+ idx_info->layout->u.earray.swizzled_max_down_chunks);
} /* end if */
else {
/* Calculate the index of this chunk */
- idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks, udata->common.scaled);
+ idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks,
+ udata->common.scaled);
} /* end else */
udata->chunk_idx = idx;
/* Check for filters on chunks */
- if(idx_info->pline->nused > 0) {
- H5D_earray_filt_elmt_t elmt; /* Extensible array element */
+ if (idx_info->pline->nused > 0) {
+ H5D_earray_filt_elmt_t elmt; /* Extensible array element */
/* Get the information for the chunk */
- if(H5EA_get(ea, idx, &elmt) < 0)
+ if (H5EA_get(ea, idx, &elmt) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info")
/* Set the info for the chunk */
udata->chunk_block.offset = elmt.addr;
udata->chunk_block.length = elmt.nbytes;
- udata->filter_mask = elmt.filter_mask;
+ udata->filter_mask = elmt.filter_mask;
} /* end if */
else {
/* Get the address for the chunk */
- if(H5EA_get(ea, idx, &udata->chunk_block.offset) < 0)
+ if (H5EA_get(ea, idx, &udata->chunk_block.offset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address")
/* Update the other (constant) information for the chunk */
udata->chunk_block.length = idx_info->layout->size;
- udata->filter_mask = 0;
+ udata->filter_mask = 0;
} /* end else */
- if(!H5F_addr_defined(udata->chunk_block.offset))
+ if (!H5F_addr_defined(udata->chunk_block.offset))
udata->chunk_block.length = 0;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__earray_idx_get_addr() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_resize
*
@@ -1185,7 +1160,7 @@ done:
static herr_t
H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1193,9 +1168,10 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
HDassert(layout);
/* "Swizzle" constant dimensions for this dataset */
- if(layout->u.earray.unlim_dim > 0) {
- hsize_t swizzled_chunks[H5O_LAYOUT_NDIMS]; /* Swizzled form of # of chunks in each dimension */
- hsize_t swizzled_max_chunks[H5O_LAYOUT_NDIMS]; /* Swizzled form of max # of chunks in each dimension */
+ if (layout->u.earray.unlim_dim > 0) {
+ hsize_t swizzled_chunks[H5O_LAYOUT_NDIMS]; /* Swizzled form of # of chunks in each dimension */
+ hsize_t
+ swizzled_max_chunks[H5O_LAYOUT_NDIMS]; /* Swizzled form of max # of chunks in each dimension */
/* Get the swizzled chunk dimensions */
H5MM_memcpy(layout->u.earray.swizzled_dim, layout->dim, (layout->ndims - 1) * sizeof(layout->dim[0]));
@@ -1206,15 +1182,17 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
H5VM_swizzle_coords(hsize_t, swizzled_chunks, layout->u.earray.unlim_dim);
/* Get the swizzled "down" sizes for each dimension */
- if(H5VM_array_down((layout->ndims - 1), swizzled_chunks, layout->u.earray.swizzled_down_chunks) < 0)
+ if (H5VM_array_down((layout->ndims - 1), swizzled_chunks, layout->u.earray.swizzled_down_chunks) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value")
/* Get the swizzled max number of chunks in each dimension */
- H5MM_memcpy(swizzled_max_chunks, layout->max_chunks, (layout->ndims - 1) * sizeof(swizzled_max_chunks[0]));
+ H5MM_memcpy(swizzled_max_chunks, layout->max_chunks,
+ (layout->ndims - 1) * sizeof(swizzled_max_chunks[0]));
H5VM_swizzle_coords(hsize_t, swizzled_max_chunks, layout->u.earray.unlim_dim);
/* Get the swizzled max "down" sizes for each dimension */
- if(H5VM_array_down((layout->ndims - 1), swizzled_max_chunks, layout->u.earray.swizzled_max_down_chunks) < 0)
+ if (H5VM_array_down((layout->ndims - 1), swizzled_max_chunks,
+ layout->u.earray.swizzled_max_down_chunks) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value")
} /* end if */
@@ -1222,7 +1200,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__earray_idx_resize() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_iterate_cb
*
@@ -1237,39 +1214,39 @@ done:
static int
H5D__earray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void *_udata)
{
- H5D_earray_it_ud_t *udata = (H5D_earray_it_ud_t *)_udata; /* User data */
- unsigned ndims; /* Rank of chunk */
- int curr_dim; /* Current dimension */
- int ret_value = H5_ITER_CONT; /* Return value */
+ H5D_earray_it_ud_t *udata = (H5D_earray_it_ud_t *)_udata; /* User data */
+ unsigned ndims; /* Rank of chunk */
+ int curr_dim; /* Current dimension */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Compose generic chunk record for callback */
- if(udata->filtered) {
+ if (udata->filtered) {
const H5D_earray_filt_elmt_t *filt_elmt = (const H5D_earray_filt_elmt_t *)_elmt;
- udata->chunk_rec.chunk_addr = filt_elmt->addr;
- udata->chunk_rec.nbytes = filt_elmt->nbytes;
+ udata->chunk_rec.chunk_addr = filt_elmt->addr;
+ udata->chunk_rec.nbytes = filt_elmt->nbytes;
udata->chunk_rec.filter_mask = filt_elmt->filter_mask;
} /* end if */
else
udata->chunk_rec.chunk_addr = *(const haddr_t *)_elmt;
/* Make "generic chunk" callback */
- if(H5F_addr_defined(udata->chunk_rec.chunk_addr))
- if((ret_value = (udata->cb)(&udata->chunk_rec, udata->udata)) < 0)
+ if (H5F_addr_defined(udata->chunk_rec.chunk_addr))
+ if ((ret_value = (udata->cb)(&udata->chunk_rec, udata->udata)) < 0)
HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback");
/* Update coordinates of chunk in dataset */
ndims = udata->common.layout->ndims - 1;
HDassert(ndims > 0);
curr_dim = (int)(ndims - 1);
- while(curr_dim >= 0) {
+ while (curr_dim >= 0) {
/* Increment coordinate in current dimension */
udata->chunk_rec.scaled[curr_dim]++;
/* Check if we went off the end of the current dimension */
- if(udata->chunk_rec.scaled[curr_dim] >= udata->common.layout->max_chunks[curr_dim]) {
+ if (udata->chunk_rec.scaled[curr_dim] >= udata->common.layout->max_chunks[curr_dim]) {
/* Reset coordinate & move to next faster dimension */
udata->chunk_rec.scaled[curr_dim] = 0;
curr_dim--;
@@ -1281,7 +1258,6 @@ H5D__earray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void *
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__earray_idx_iterate_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_iterate
*
@@ -1300,12 +1276,11 @@ H5D__earray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void *
*-------------------------------------------------------------------------
*/
static int
-H5D__earray_idx_iterate(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
+H5D__earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
{
- H5EA_t *ea; /* Pointer to extensible array structure */
- H5EA_stat_t ea_stat; /* Extensible array statistics */
- int ret_value = H5_ITER_CONT; /* Return value */
+ H5EA_t * ea; /* Pointer to extensible array structure */
+ H5EA_stat_t ea_stat; /* Extensible array statistics */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -1320,38 +1295,39 @@ H5D__earray_idx_iterate(const H5D_chk_idx_info_t *idx_info,
HDassert(chunk_udata);
/* Check if the extensible array is open yet */
- if(NULL == idx_info->storage->u.earray.ea) {
+ if (NULL == idx_info->storage->u.earray.ea) {
/* Open the extensible array in file */
- if(H5D__earray_idx_open(idx_info) < 0)
+ if (H5D__earray_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array")
- } else /* Patch the top level file pointer contained in ea if needed */
+ }
+ else /* Patch the top level file pointer contained in ea if needed */
H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f);
/* Set convenience pointer to extensible array structure */
ea = idx_info->storage->u.earray.ea;
/* Get the extensible array statistics */
- if(H5EA_get_stats(ea, &ea_stat) < 0)
+ if (H5EA_get_stats(ea, &ea_stat) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array statistics")
- if(ea_stat.stored.max_idx_set > 0) {
- H5D_earray_it_ud_t udata; /* User data for iteration callback */
+ if (ea_stat.stored.max_idx_set > 0) {
+ H5D_earray_it_ud_t udata; /* User data for iteration callback */
/* Initialize userdata */
HDmemset(&udata, 0, sizeof udata);
- udata.common.layout = idx_info->layout;
+ udata.common.layout = idx_info->layout;
udata.common.storage = idx_info->storage;
HDmemset(&udata.chunk_rec, 0, sizeof(udata.chunk_rec));
udata.filtered = (idx_info->pline->nused > 0);
- if(!udata.filtered) {
- udata.chunk_rec.nbytes = idx_info->layout->size;
+ if (!udata.filtered) {
+ udata.chunk_rec.nbytes = idx_info->layout->size;
udata.chunk_rec.filter_mask = 0;
} /* end if */
- udata.cb = chunk_cb;
+ udata.cb = chunk_cb;
udata.udata = chunk_udata;
/* Iterate over the extensible array elements */
- if((ret_value = H5EA_iterate(ea, H5D__earray_idx_iterate_cb, &udata)) < 0)
+ if ((ret_value = H5EA_iterate(ea, H5D__earray_idx_iterate_cb, &udata)) < 0)
HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over fixed array chunk index");
} /* end if */
@@ -1359,7 +1335,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__earray_idx_iterate() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_remove
*
@@ -1375,9 +1350,9 @@ done:
static herr_t
H5D__earray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata)
{
- H5EA_t *ea; /* Pointer to extensible array structure */
- hsize_t idx; /* Array index of chunk */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5EA_t *ea; /* Pointer to extensible array structure */
+ hsize_t idx; /* Array index of chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1391,78 +1366,81 @@ H5D__earray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t
HDassert(udata);
/* Check if the extensible array is open yet */
- if(NULL == idx_info->storage->u.earray.ea) {
+ if (NULL == idx_info->storage->u.earray.ea) {
/* Open the extensible array in file */
- if(H5D__earray_idx_open(idx_info) < 0)
+ if (H5D__earray_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array")
- } else /* Patch the top level file pointer contained in ea if needed */
- if(H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch earray file pointer")
+ }
+ else /* Patch the top level file pointer contained in ea if needed */
+ if (H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch earray file pointer")
/* Set convenience pointer to extensible array structure */
ea = idx_info->storage->u.earray.ea;
/* Check for unlimited dim. not being the slowest-changing dim. */
- if(idx_info->layout->u.earray.unlim_dim > 0) {
- hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */
+ if (idx_info->layout->u.earray.unlim_dim > 0) {
+ hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */
unsigned ndims = (idx_info->layout->ndims - 1); /* Number of dimensions */
unsigned u;
/* Compute coordinate offset from scaled offset */
- for(u = 0; u < ndims; u++)
+ for (u = 0; u < ndims; u++)
swizzled_coords[u] = udata->scaled[u] * idx_info->layout->dim[u];
H5VM_swizzle_coords(hsize_t, swizzled_coords, idx_info->layout->u.earray.unlim_dim);
/* Calculate the index of this chunk */
- idx = H5VM_chunk_index(ndims, swizzled_coords, idx_info->layout->u.earray.swizzled_dim, idx_info->layout->u.earray.swizzled_max_down_chunks);
+ idx = H5VM_chunk_index(ndims, swizzled_coords, idx_info->layout->u.earray.swizzled_dim,
+ idx_info->layout->u.earray.swizzled_max_down_chunks);
} /* end if */
else {
/* Calculate the index of this chunk */
- idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks, udata->scaled);
+ idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks,
+ udata->scaled);
} /* end else */
/* Check for filters on chunks */
- if(idx_info->pline->nused > 0) {
- H5D_earray_filt_elmt_t elmt; /* Extensible array element */
+ if (idx_info->pline->nused > 0) {
+ H5D_earray_filt_elmt_t elmt; /* Extensible array element */
/* Get the info about the chunk for the index */
- if(H5EA_get(ea, idx, &elmt) < 0)
+ if (H5EA_get(ea, idx, &elmt) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info")
/* Remove raw data chunk from file if not doing SWMR writes */
HDassert(H5F_addr_defined(elmt.addr));
- if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) {
- H5_CHECK_OVERFLOW(elmt.nbytes, /*From: */uint32_t, /*To: */hsize_t);
- if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, elmt.addr, (hsize_t)elmt.nbytes) < 0)
+ if (!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) {
+ H5_CHECK_OVERFLOW(elmt.nbytes, /*From: */ uint32_t, /*To: */ hsize_t);
+ if (H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, elmt.addr, (hsize_t)elmt.nbytes) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
} /* end if */
/* Reset the info about the chunk for the index */
- elmt.addr = HADDR_UNDEF;
- elmt.nbytes = 0;
+ elmt.addr = HADDR_UNDEF;
+ elmt.nbytes = 0;
elmt.filter_mask = 0;
- if(H5EA_set(ea, idx, &elmt) < 0)
+ if (H5EA_set(ea, idx, &elmt) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk info")
} /* end if */
else {
- haddr_t addr = HADDR_UNDEF; /* Chunk address */
+ haddr_t addr = HADDR_UNDEF; /* Chunk address */
/* Get the address of the chunk for the index */
- if(H5EA_get(ea, idx, &addr) < 0)
+ if (H5EA_get(ea, idx, &addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address")
/* Remove raw data chunk from file if not doing SWMR writes */
HDassert(H5F_addr_defined(addr));
- if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) {
- H5_CHECK_OVERFLOW(idx_info->layout->size, /*From: */uint32_t, /*To: */hsize_t);
- if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, addr, (hsize_t)idx_info->layout->size) < 0)
+ if (!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) {
+ H5_CHECK_OVERFLOW(idx_info->layout->size, /*From: */ uint32_t, /*To: */ hsize_t);
+ if (H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, addr, (hsize_t)idx_info->layout->size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
} /* end if */
/* Reset the address of the chunk for the index */
addr = HADDR_UNDEF;
- if(H5EA_set(ea, idx, &addr) < 0)
+ if (H5EA_set(ea, idx, &addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk address")
} /* end else */
@@ -1470,7 +1448,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__earray_idx_remove() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_delete_cb
*
@@ -1487,8 +1464,8 @@ done:
static int
H5D__earray_idx_delete_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
{
- H5F_t *f = (H5F_t *)_udata; /* User data for callback */
- int ret_value = H5_ITER_CONT; /* Return value */
+ H5F_t *f = (H5F_t *)_udata; /* User data for callback */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -1499,15 +1476,14 @@ H5D__earray_idx_delete_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HDassert(f);
/* Remove raw data chunk from file */
- H5_CHECK_OVERFLOW(chunk_rec->nbytes, /*From: */uint32_t, /*To: */hsize_t);
- if(H5MF_xfree(f, H5FD_MEM_DRAW, chunk_rec->chunk_addr, (hsize_t)chunk_rec->nbytes) < 0)
+ H5_CHECK_OVERFLOW(chunk_rec->nbytes, /*From: */ uint32_t, /*To: */ hsize_t);
+ if (H5MF_xfree(f, H5FD_MEM_DRAW, chunk_rec->chunk_addr, (hsize_t)chunk_rec->nbytes) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free chunk")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__earray_idx_delete_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_delete
*
@@ -1529,7 +1505,7 @@ done:
static herr_t
H5D__earray_idx_delete(const H5D_chk_idx_info_t *idx_info)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1541,24 +1517,24 @@ H5D__earray_idx_delete(const H5D_chk_idx_info_t *idx_info)
HDassert(idx_info->storage);
/* Check if the index data structure has been allocated */
- if(H5F_addr_defined(idx_info->storage->idx_addr)) {
+ if (H5F_addr_defined(idx_info->storage->idx_addr)) {
H5D_earray_ctx_ud_t ctx_udata; /* User data for extensible array open call */
/* Iterate over the chunk addresses in the extensible array, deleting each chunk */
- if(H5D__earray_idx_iterate(idx_info, H5D__earray_idx_delete_cb, idx_info->f) < 0)
+ if (H5D__earray_idx_iterate(idx_info, H5D__earray_idx_delete_cb, idx_info->f) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk addresses")
/* Close extensible array */
- if(H5EA_close(idx_info->storage->u.earray.ea) < 0)
+ if (H5EA_close(idx_info->storage->u.earray.ea) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array")
idx_info->storage->u.earray.ea = NULL;
/* Set up the context user data */
- ctx_udata.f = idx_info->f;
+ ctx_udata.f = idx_info->f;
ctx_udata.chunk_size = idx_info->layout->size;
/* Delete extensible array */
- if(H5EA_delete(idx_info->f, idx_info->storage->idx_addr, &ctx_udata) < 0)
+ if (H5EA_delete(idx_info->f, idx_info->storage->idx_addr, &ctx_udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk extensible array")
idx_info->storage->idx_addr = HADDR_UNDEF;
} /* end if */
@@ -1569,7 +1545,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__earray_idx_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_copy_setup
*
@@ -1583,10 +1558,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__earray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
- const H5D_chk_idx_info_t *idx_info_dst)
+H5D__earray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1604,16 +1578,16 @@ H5D__earray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr));
/* Check if the source extensible array is open yet */
- if(NULL == idx_info_src->storage->u.earray.ea)
+ if (NULL == idx_info_src->storage->u.earray.ea)
/* Open the extensible array in file */
- if(H5D__earray_idx_open(idx_info_src) < 0)
+ if (H5D__earray_idx_open(idx_info_src) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array")
/* Set copied metadata tag */
H5_BEGIN_TAG(H5AC__COPIED_TAG);
/* Create the extensible array that describes chunked storage in the dest. file */
- if(H5D__earray_idx_create(idx_info_dst) < 0)
+ if (H5D__earray_idx_create(idx_info_dst) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr));
@@ -1624,7 +1598,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__earray_idx_copy_setup() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_copy_shutdown
*
@@ -1638,10 +1611,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__earray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
- H5O_storage_chunk_t *storage_dst)
+H5D__earray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, H5O_storage_chunk_t *storage_dst)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1652,10 +1624,10 @@ H5D__earray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
HDassert(storage_dst->u.earray.ea);
/* Close extensible arrays */
- if(H5EA_close(storage_src->u.earray.ea) < 0)
+ if (H5EA_close(storage_src->u.earray.ea) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array")
storage_src->u.earray.ea = NULL;
- if(H5EA_close(storage_dst->u.earray.ea) < 0)
+ if (H5EA_close(storage_dst->u.earray.ea) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array")
storage_dst->u.earray.ea = NULL;
@@ -1663,7 +1635,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__earray_idx_copy_shutdown() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_size
*
@@ -1680,9 +1651,9 @@ done:
static herr_t
H5D__earray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size)
{
- H5EA_t *ea; /* Pointer to extensible array structure */
- H5EA_stat_t ea_stat; /* Extensible array statistics */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5EA_t * ea; /* Pointer to extensible array structure */
+ H5EA_stat_t ea_stat; /* Extensible array statistics */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1696,23 +1667,23 @@ H5D__earray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size)
HDassert(index_size);
/* Open the extensible array in file */
- if(H5D__earray_idx_open(idx_info) < 0)
+ if (H5D__earray_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array")
/* Set convenience pointer to extensible array structure */
ea = idx_info->storage->u.earray.ea;
/* Get the extensible array statistics */
- if(H5EA_get_stats(ea, &ea_stat) < 0)
+ if (H5EA_get_stats(ea, &ea_stat) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array statistics")
/* Set the size of the extensible array */
- *index_size = ea_stat.computed.hdr_size + ea_stat.computed.index_blk_size
- + ea_stat.stored.super_blk_size + ea_stat.stored.data_blk_size;
+ *index_size = ea_stat.computed.hdr_size + ea_stat.computed.index_blk_size +
+ ea_stat.stored.super_blk_size + ea_stat.stored.data_blk_size;
done:
- if(idx_info->storage->u.earray.ea) {
- if(H5EA_close(idx_info->storage->u.earray.ea) < 0)
+ if (idx_info->storage->u.earray.ea) {
+ if (H5EA_close(idx_info->storage->u.earray.ea) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array")
idx_info->storage->u.earray.ea = NULL;
} /* end if */
@@ -1720,7 +1691,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__earray_idx_size() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_reset
*
@@ -1742,8 +1712,8 @@ H5D__earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
HDassert(storage);
/* Reset index info */
- if(reset_addr) {
- storage->idx_addr = HADDR_UNDEF;
+ if (reset_addr) {
+ storage->idx_addr = HADDR_UNDEF;
storage->u.earray.dset_ohdr_addr = HADDR_UNDEF;
} /* end if */
storage->u.earray.ea = NULL;
@@ -1751,7 +1721,6 @@ H5D__earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_idx_reset() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_dump
*
@@ -1778,7 +1747,6 @@ H5D__earray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_idx_dump() */
-
/*-------------------------------------------------------------------------
* Function: H5D__earray_idx_dest
*
@@ -1794,7 +1762,7 @@ H5D__earray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
static herr_t
H5D__earray_idx_dest(const H5D_chk_idx_info_t *idx_info)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1804,14 +1772,14 @@ H5D__earray_idx_dest(const H5D_chk_idx_info_t *idx_info)
HDassert(idx_info->storage);
/* Check if the extensible array is open */
- if(idx_info->storage->u.earray.ea) {
+ if (idx_info->storage->u.earray.ea) {
/* Patch the top level file pointer contained in ea if needed */
- if(H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f) < 0)
+ if (H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch earray file pointer")
/* Close extensible array */
- if(H5EA_close(idx_info->storage->u.earray.ea) < 0)
+ if (H5EA_close(idx_info->storage->u.earray.ea) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array")
idx_info->storage->u.earray.ea = NULL;
} /* end if */
@@ -1819,4 +1787,3 @@ H5D__earray_idx_dest(const H5D_chk_idx_info_t *idx_info)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__earray_idx_dest() */
-
diff --git a/src/H5Defl.c b/src/H5Defl.c
index 79cec8c..1ab677a 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -20,99 +20,77 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5HLprivate.h" /* Local Heaps */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5VMprivate.h" /* Vector and array functions */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5HLprivate.h" /* Local Heaps */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VMprivate.h" /* Vector and array functions */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
/* Callback info for readvv operation */
typedef struct H5D_efl_readvv_ud_t {
- const H5O_efl_t *efl; /* Pointer to efl info */
- const H5D_t *dset; /* The dataset */
- unsigned char *rbuf; /* Read buffer */
+ const H5O_efl_t *efl; /* Pointer to efl info */
+ const H5D_t * dset; /* The dataset */
+ unsigned char * rbuf; /* Read buffer */
} H5D_efl_readvv_ud_t;
/* Callback info for writevv operation */
typedef struct H5D_efl_writevv_ud_t {
- const H5O_efl_t *efl; /* Pointer to efl info */
- const H5D_t *dset; /* The dataset */
- const unsigned char *wbuf; /* Write buffer */
+ const H5O_efl_t * efl; /* Pointer to efl info */
+ const H5D_t * dset; /* The dataset */
+ const unsigned char *wbuf; /* Write buffer */
} H5D_efl_writevv_ud_t;
-
/********************/
/* Local Prototypes */
/********************/
/* Layout operation callbacks */
static herr_t H5D__efl_construct(H5F_t *f, H5D_t *dset);
-static herr_t H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t *cm);
-static ssize_t H5D__efl_readvv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
-static ssize_t H5D__efl_writevv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
+static herr_t H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *cm);
+static ssize_t H5D__efl_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
+ size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
+ size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
+static ssize_t H5D__efl_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
+ size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
+ size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
/* Helper routines */
-static herr_t H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size,
- uint8_t *buf);
+static herr_t H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, uint8_t *buf);
static herr_t H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size,
- const uint8_t *buf);
-
+ const uint8_t *buf);
/*********************/
/* Package Variables */
/*********************/
/* External File List (EFL) storage layout I/O ops */
-const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{
- H5D__efl_construct,
- NULL,
- H5D__efl_is_space_alloc,
- NULL,
- H5D__efl_io_init,
- H5D__contig_read,
- H5D__contig_write,
+const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{H5D__efl_construct, NULL, H5D__efl_is_space_alloc, NULL,
+ H5D__efl_io_init, H5D__contig_read, H5D__contig_write,
#ifdef H5_HAVE_PARALLEL
- NULL,
- NULL,
+ NULL, NULL,
#endif /* H5_HAVE_PARALLEL */
- H5D__efl_readvv,
- H5D__efl_writevv,
- NULL,
- NULL,
- NULL
-}};
-
+ H5D__efl_readvv, H5D__efl_writevv, NULL, NULL, NULL}};
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5D__efl_construct
*
@@ -128,13 +106,13 @@ const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{
static herr_t
H5D__efl_construct(H5F_t *f, H5D_t *dset)
{
- size_t dt_size; /* Size of datatype */
- hssize_t stmp_size; /* Temporary holder for raw data size */
- hsize_t tmp_size; /* Temporary holder for raw data size */
- hsize_t max_points; /* Maximum elements */
- hsize_t max_storage; /* Maximum storage size */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t dt_size; /* Size of datatype */
+ hssize_t stmp_size; /* Temporary holder for raw data size */
+ hsize_t tmp_size; /* Temporary holder for raw data size */
+ hsize_t max_points; /* Maximum elements */
+ hsize_t max_storage; /* Maximum storage size */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -149,24 +127,24 @@ H5D__efl_construct(H5F_t *f, H5D_t *dset)
*/
/* Check for invalid dataset dimensions */
- for(u = 1; u < dset->shared->ndims; u++)
- if(dset->shared->max_dims[u] > dset->shared->curr_dims[u])
+ for (u = 1; u < dset->shared->ndims; u++)
+ if (dset->shared->max_dims[u] > dset->shared->curr_dims[u])
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "only the first dimension can be extendible")
/* Retrieve the size of the dataset's datatype */
- if(0 == (dt_size = H5T_get_size(dset->shared->type)))
+ if (0 == (dt_size = H5T_get_size(dset->shared->type)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size")
/* Check for storage overflows */
- max_points = H5S_get_npoints_max(dset->shared->space);
+ max_points = H5S_get_npoints_max(dset->shared->space);
max_storage = H5O_efl_total_size(&dset->shared->dcpl_cache.efl);
- if(H5S_UNLIMITED == max_points) {
- if(H5O_EFL_UNLIMITED != max_storage)
+ if (H5S_UNLIMITED == max_points) {
+ if (H5O_EFL_UNLIMITED != max_storage)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unlimited dataspace but finite storage")
} /* end if */
- else if((max_points * dt_size) < max_points)
+ else if ((max_points * dt_size) < max_points)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "dataspace * type size overflowed")
- else if((max_points * dt_size) > max_storage)
+ else if ((max_points * dt_size) > max_storage)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "dataspace size exceeds external storage size")
/* Compute the total size of dataset */
@@ -182,7 +160,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__efl_construct() */
-
/*-------------------------------------------------------------------------
* Function: H5D__efl_is_space_alloc
*
@@ -207,7 +184,6 @@ H5D__efl_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage)
FUNC_LEAVE_NOAPI(TRUE)
} /* end H5D__efl_is_space_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5D__efl_io_init
*
@@ -222,8 +198,8 @@ H5D__efl_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage)
*/
static herr_t
H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info,
- hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space, const H5S_t H5_ATTR_UNUSED *mem_space,
- H5D_chunk_map_t H5_ATTR_UNUSED *cm)
+ hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space,
+ const H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm)
{
FUNC_ENTER_STATIC_NOERR
@@ -232,7 +208,6 @@ H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNU
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__efl_io_init() */
-
/*-------------------------------------------------------------------------
* Function: H5D__efl_read
*
@@ -251,17 +226,17 @@ H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNU
static herr_t
H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, uint8_t *buf)
{
- int fd = -1;
- size_t to_read;
+ int fd = -1;
+ size_t to_read;
#ifndef NDEBUG
- hsize_t tempto_read;
+ hsize_t tempto_read;
#endif /* NDEBUG */
- hsize_t skip = 0;
- haddr_t cur;
- ssize_t n;
- size_t u; /* Local index variable */
- char *full_name = NULL; /* File name with prefix */
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t skip = 0;
+ haddr_t cur;
+ ssize_t n;
+ size_t u; /* Local index variable */
+ char * full_name = NULL; /* File name with prefix */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -272,8 +247,8 @@ H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size
HDassert(buf || 0 == size);
/* Find the first efl member from which to read */
- for (u=0, cur=0; u<efl->nused; u++) {
- if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) {
+ for (u = 0, cur = 0; u < efl->nused; u++) {
+ if (H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) {
skip = addr - cur;
break;
} /* end if */
@@ -281,28 +256,28 @@ H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size
} /* end for */
/* Read the data */
- while(size) {
+ while (size) {
HDassert(buf);
- if(u >= efl->nused)
+ if (u >= efl->nused)
HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file")
- if(H5F_OVERFLOW_HSIZET2OFFT((hsize_t)efl->slot[u].offset + skip))
+ if (H5F_OVERFLOW_HSIZET2OFFT((hsize_t)efl->slot[u].offset + skip))
HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed")
- if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0)
+ if (H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0)
HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name")
- if((fd = HDopen(full_name, O_RDONLY)) < 0)
+ if ((fd = HDopen(full_name, O_RDONLY)) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file")
- if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + (HDoff_t)skip), SEEK_SET) < 0)
+ if (HDlseek(fd, (HDoff_t)(efl->slot[u].offset + (HDoff_t)skip), SEEK_SET) < 0)
HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file")
#ifndef NDEBUG
- tempto_read = MIN((size_t)(efl->slot[u].size-skip), (hsize_t)size);
+ tempto_read = MIN((size_t)(efl->slot[u].size - skip), (hsize_t)size);
H5_CHECK_OVERFLOW(tempto_read, hsize_t, size_t);
to_read = (size_t)tempto_read;
-#else /* NDEBUG */
- to_read = MIN((size_t)(efl->slot[u].size - skip), (hsize_t)size);
+#else /* NDEBUG */
+ to_read = MIN((size_t)(efl->slot[u].size - skip), (hsize_t)size);
#endif /* NDEBUG */
- if((n = HDread(fd, buf, to_read)) < 0)
+ if ((n = HDread(fd, buf, to_read)) < 0)
HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "read error in external raw data file")
- else if((size_t)n < to_read)
+ else if ((size_t)n < to_read)
HDmemset(buf + n, 0, to_read - (size_t)n);
full_name = (char *)H5MM_xfree(full_name);
HDclose(fd);
@@ -314,15 +289,14 @@ H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size
} /* end while */
done:
- if(full_name)
+ if (full_name)
full_name = (char *)H5MM_xfree(full_name);
- if(fd >= 0)
+ if (fd >= 0)
HDclose(fd);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__efl_read() */
-
/*-------------------------------------------------------------------------
* Function: H5D__efl_write
*
@@ -341,16 +315,16 @@ done:
static herr_t
H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, const uint8_t *buf)
{
- int fd = -1;
- size_t to_write;
+ int fd = -1;
+ size_t to_write;
#ifndef NDEBUG
- hsize_t tempto_write;
+ hsize_t tempto_write;
#endif /* NDEBUG */
- haddr_t cur;
- hsize_t skip = 0;
- size_t u; /* Local index variable */
- char *full_name = NULL; /* File name with prefix */
- herr_t ret_value = SUCCEED; /* Return value */
+ haddr_t cur;
+ hsize_t skip = 0;
+ size_t u; /* Local index variable */
+ char * full_name = NULL; /* File name with prefix */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -361,8 +335,8 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz
HDassert(buf || 0 == size);
/* Find the first efl member in which to write */
- for(u = 0, cur = 0; u < efl->nused; u++) {
- if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) {
+ for (u = 0, cur = 0; u < efl->nused; u++) {
+ if (H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) {
skip = addr - cur;
break;
} /* end if */
@@ -370,33 +344,33 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz
} /* end for */
/* Write the data */
- while(size) {
+ while (size) {
HDassert(buf);
- if(u >= efl->nused)
+ if (u >= efl->nused)
HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file")
- if(H5F_OVERFLOW_HSIZET2OFFT((hsize_t)efl->slot[u].offset + skip))
+ if (H5F_OVERFLOW_HSIZET2OFFT((hsize_t)efl->slot[u].offset + skip))
HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed")
- if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0)
+ if (H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0)
HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name")
- if((fd = HDopen(full_name, O_CREAT | O_RDWR, H5_POSIX_CREATE_MODE_RW)) < 0) {
- if(HDaccess(full_name, F_OK) < 0)
+ if ((fd = HDopen(full_name, O_CREAT | O_RDWR, H5_POSIX_CREATE_MODE_RW)) < 0) {
+ if (HDaccess(full_name, F_OK) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist")
else
HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file")
- } /* end if */
- if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + (HDoff_t)skip), SEEK_SET) < 0)
+ } /* end if */
+ if (HDlseek(fd, (HDoff_t)(efl->slot[u].offset + (HDoff_t)skip), SEEK_SET) < 0)
HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file")
#ifndef NDEBUG
tempto_write = MIN(efl->slot[u].size - skip, (hsize_t)size);
H5_CHECK_OVERFLOW(tempto_write, hsize_t, size_t);
to_write = (size_t)tempto_write;
-#else /* NDEBUG */
+#else /* NDEBUG */
to_write = MIN((size_t)(efl->slot[u].size - skip), size);
#endif /* NDEBUG */
- if((size_t)HDwrite(fd, buf, to_write) != to_write)
+ if ((size_t)HDwrite(fd, buf, to_write) != to_write)
HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file")
full_name = (char *)H5MM_xfree(full_name);
- HDclose (fd);
+ HDclose(fd);
fd = -1;
size -= to_write;
buf += to_write;
@@ -405,15 +379,14 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz
} /* end while */
done:
- if(full_name)
+ if (full_name)
full_name = (char *)H5MM_xfree(full_name);
- if(fd >= 0)
+ if (fd >= 0)
HDclose(fd);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__efl_write() */
-
/*-------------------------------------------------------------------------
* Function: H5D__efl_readvv_cb
*
@@ -429,20 +402,19 @@ done:
static herr_t
H5D__efl_readvv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata)
{
- H5D_efl_readvv_ud_t *udata = (H5D_efl_readvv_ud_t *)_udata; /* User data for H5VM_opvv() operator */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_efl_readvv_ud_t *udata = (H5D_efl_readvv_ud_t *)_udata; /* User data for H5VM_opvv() operator */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Read data */
- if(H5D__efl_read(udata->efl, udata->dset, dst_off, len, (udata->rbuf + src_off)) < 0)
+ if (H5D__efl_read(udata->efl, udata->dset, dst_off, len, (udata->rbuf + src_off)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "EFL read failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__efl_readvv_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__efl_readvv
*
@@ -459,12 +431,12 @@ done:
*-------------------------------------------------------------------------
*/
static ssize_t
-H5D__efl_readvv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[])
+H5D__efl_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
+ size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq,
+ size_t mem_len_arr[], hsize_t mem_off_arr[])
{
- H5D_efl_readvv_ud_t udata; /* User data for H5VM_opvv() operator */
- ssize_t ret_value = -1; /* Return value (Total size of sequence in bytes) */
+ H5D_efl_readvv_ud_t udata; /* User data for H5VM_opvv() operator */
+ ssize_t ret_value = -1; /* Return value (Total size of sequence in bytes) */
FUNC_ENTER_STATIC
@@ -482,21 +454,19 @@ H5D__efl_readvv(const H5D_io_info_t *io_info,
HDassert(mem_off_arr);
/* Set up user data for H5VM_opvv() */
- udata.efl = &(io_info->store->efl);
+ udata.efl = &(io_info->store->efl);
udata.dset = io_info->dset;
udata.rbuf = (unsigned char *)io_info->u.rbuf;
/* Call generic sequence operation routine */
- if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr,
- mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr,
- H5D__efl_readvv_cb, &udata)) < 0)
+ if ((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq,
+ mem_curr_seq, mem_len_arr, mem_off_arr, H5D__efl_readvv_cb, &udata)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized EFL read")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__efl_readvv() */
-
/*-------------------------------------------------------------------------
* Function: H5D__efl_writevv_cb
*
@@ -512,20 +482,19 @@ done:
static herr_t
H5D__efl_writevv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata)
{
- H5D_efl_writevv_ud_t *udata = (H5D_efl_writevv_ud_t *)_udata; /* User data for H5VM_opvv() operator */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_efl_writevv_ud_t *udata = (H5D_efl_writevv_ud_t *)_udata; /* User data for H5VM_opvv() operator */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Write data */
- if(H5D__efl_write(udata->efl, udata->dset, dst_off, len, (udata->wbuf + src_off)) < 0)
+ if (H5D__efl_write(udata->efl, udata->dset, dst_off, len, (udata->wbuf + src_off)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "EFL write failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__efl_writevv_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__efl_writevv
*
@@ -542,12 +511,12 @@ done:
*-------------------------------------------------------------------------
*/
static ssize_t
-H5D__efl_writevv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[])
+H5D__efl_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
+ size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq,
+ size_t mem_len_arr[], hsize_t mem_off_arr[])
{
- H5D_efl_writevv_ud_t udata; /* User data for H5VM_opvv() operator */
- ssize_t ret_value = -1; /* Return value (Total size of sequence in bytes) */
+ H5D_efl_writevv_ud_t udata; /* User data for H5VM_opvv() operator */
+ ssize_t ret_value = -1; /* Return value (Total size of sequence in bytes) */
FUNC_ENTER_STATIC
@@ -565,20 +534,18 @@ H5D__efl_writevv(const H5D_io_info_t *io_info,
HDassert(mem_off_arr);
/* Set up user data for H5VM_opvv() */
- udata.efl = &(io_info->store->efl);
+ udata.efl = &(io_info->store->efl);
udata.dset = io_info->dset;
udata.wbuf = (const unsigned char *)io_info->u.wbuf;
/* Call generic sequence operation routine */
- if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr,
- mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr,
- H5D__efl_writevv_cb, &udata)) < 0)
+ if ((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq,
+ mem_curr_seq, mem_len_arr, mem_off_arr, H5D__efl_writevv_cb, &udata)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized EFL write")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__efl_writevv() */
-
/*-------------------------------------------------------------------------
* Function: H5D__efl_bh_info
*
@@ -595,7 +562,7 @@ done:
herr_t
H5D__efl_bh_info(H5F_t *f, H5O_efl_t *efl, hsize_t *heap_size)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -606,7 +573,7 @@ H5D__efl_bh_info(H5F_t *f, H5O_efl_t *efl, hsize_t *heap_size)
HDassert(heap_size);
/* Get the size of the local heap for EFL's file list */
- if(H5HL_heapsize(f, efl->heap_addr, heap_size) < 0)
+ if (H5HL_heapsize(f, efl->heap_addr, heap_size) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTINIT, FAIL, "unable to retrieve local heap info")
done:
diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c
index d83c191..bf1274f 100644
--- a/src/H5Dfarray.c
+++ b/src/H5Dfarray.c
@@ -24,29 +24,29 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FAprivate.h" /* Fixed arrays */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5MFprivate.h" /* File space management */
-#include "H5VMprivate.h" /* Vector functions */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FAprivate.h" /* Fixed arrays */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File space management */
+#include "H5VMprivate.h" /* Vector functions */
/****************/
/* Local Macros */
/****************/
/* Value to fill unset array elements with */
-#define H5D_FARRAY_FILL HADDR_UNDEF
-#define H5D_FARRAY_FILT_FILL {HADDR_UNDEF, 0, 0}
-
+#define H5D_FARRAY_FILL HADDR_UNDEF
+#define H5D_FARRAY_FILT_FILL \
+ { \
+ HADDR_UNDEF, 0, 0 \
+ }
/******************/
/* Local Typedefs */
@@ -54,33 +54,32 @@
/* Fixed array create/open user data */
typedef struct H5D_farray_ctx_ud_t {
- const H5F_t *f; /* Pointer to file info */
- uint32_t chunk_size; /* Size of chunk (bytes) */
+ const H5F_t *f; /* Pointer to file info */
+ uint32_t chunk_size; /* Size of chunk (bytes) */
} H5D_farray_ctx_ud_t;
/* Fixed array callback context */
typedef struct H5D_farray_ctx_t {
- size_t file_addr_len; /* Size of addresses in the file (bytes) */
- size_t chunk_size_len; /* Size of chunk sizes in the file (bytes) */
+ size_t file_addr_len; /* Size of addresses in the file (bytes) */
+ size_t chunk_size_len; /* Size of chunk sizes in the file (bytes) */
} H5D_farray_ctx_t;
/* Fixed Array callback info for iteration over chunks */
typedef struct H5D_farray_it_ud_t {
- H5D_chunk_common_ud_t common; /* Common info for Fixed Array user data (must be first) */
- H5D_chunk_rec_t chunk_rec; /* Generic chunk record for callback */
- hbool_t filtered; /* Whether the chunks are filtered */
- H5D_chunk_cb_func_t cb; /* Chunk callback routine */
- void *udata; /* User data for chunk callback routine */
+ H5D_chunk_common_ud_t common; /* Common info for Fixed Array user data (must be first) */
+ H5D_chunk_rec_t chunk_rec; /* Generic chunk record for callback */
+ hbool_t filtered; /* Whether the chunks are filtered */
+ H5D_chunk_cb_func_t cb; /* Chunk callback routine */
+ void * udata; /* User data for chunk callback routine */
} H5D_farray_it_ud_t;
/* Native fixed array element for chunks w/filters */
typedef struct H5D_farray_filt_elmt_t {
- haddr_t addr; /* Address of chunk */
- uint32_t nbytes; /* Size of chunk (in file) */
- uint32_t filter_mask; /* Excluded filters for chunk */
+ haddr_t addr; /* Address of chunk */
+ uint32_t nbytes; /* Size of chunk (in file) */
+ uint32_t filter_mask; /* Excluded filters for chunk */
} H5D_farray_filt_elmt_t;
-
/********************/
/* Local Prototypes */
/********************/
@@ -90,51 +89,42 @@ static int H5D__farray_idx_iterate_cb(hsize_t idx, const void *_elmt, void *_uda
static int H5D__farray_idx_delete_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata);
/* Fixed array class callbacks for chunks w/o filters */
-static void *H5D__farray_crt_context(void *udata);
+static void * H5D__farray_crt_context(void *udata);
static herr_t H5D__farray_dst_context(void *ctx);
static herr_t H5D__farray_fill(void *nat_blk, size_t nelmts);
-static herr_t H5D__farray_encode(void *raw, const void *elmt, size_t nelmts,
- void *ctx);
-static herr_t H5D__farray_decode(const void *raw, void *elmt, size_t nelmts,
- void *ctx);
-static herr_t H5D__farray_debug(FILE *stream, int indent, int fwidth,
- hsize_t idx, const void *elmt);
-static void *H5D__farray_crt_dbg_context(H5F_t *f, haddr_t obj_addr);
+static herr_t H5D__farray_encode(void *raw, const void *elmt, size_t nelmts, void *ctx);
+static herr_t H5D__farray_decode(const void *raw, void *elmt, size_t nelmts, void *ctx);
+static herr_t H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt);
+static void * H5D__farray_crt_dbg_context(H5F_t *f, haddr_t obj_addr);
static herr_t H5D__farray_dst_dbg_context(void *dbg_ctx);
/* Fixed array class callbacks for chunks w/filters */
/* (some shared with callbacks for chunks w/o filters) */
static herr_t H5D__farray_filt_fill(void *nat_blk, size_t nelmts);
-static herr_t H5D__farray_filt_encode(void *raw, const void *elmt, size_t nelmts,
- void *ctx);
-static herr_t H5D__farray_filt_decode(const void *raw, void *elmt, size_t nelmts,
- void *ctx);
-static herr_t H5D__farray_filt_debug(FILE *stream, int indent, int fwidth,
- hsize_t idx, const void *elmt);
+static herr_t H5D__farray_filt_encode(void *raw, const void *elmt, size_t nelmts, void *ctx);
+static herr_t H5D__farray_filt_decode(const void *raw, void *elmt, size_t nelmts, void *ctx);
+static herr_t H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt);
/* Chunked layout indexing callbacks */
-static herr_t H5D__farray_idx_init(const H5D_chk_idx_info_t *idx_info,
- const H5S_t *space, haddr_t dset_ohdr_addr);
-static herr_t H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__farray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space,
+ haddr_t dset_ohdr_addr);
+static herr_t H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info);
static hbool_t H5D__farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage);
-static herr_t H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_ud_t *udata, const H5D_t *dset);
-static herr_t H5D__farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_ud_t *udata);
-static int H5D__farray_idx_iterate(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_cb_func_t chunk_cb, void *chunk_udata);
-static herr_t H5D__farray_idx_remove(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_common_ud_t *udata);
-static herr_t H5D__farray_idx_delete(const H5D_chk_idx_info_t *idx_info);
-static herr_t H5D__farray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
- const H5D_chk_idx_info_t *idx_info_dst);
-static herr_t H5D__farray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
- H5O_storage_chunk_t *storage_dst);
-static herr_t H5D__farray_idx_size(const H5D_chk_idx_info_t *idx_info,
- hsize_t *size);
-static herr_t H5D__farray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
-static herr_t H5D__farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream);
-static herr_t H5D__farray_idx_dest(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
+ const H5D_t *dset);
+static herr_t H5D__farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata);
+static int H5D__farray_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb,
+ void *chunk_udata);
+static herr_t H5D__farray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata);
+static herr_t H5D__farray_idx_delete(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__farray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+ const H5D_chk_idx_info_t *idx_info_dst);
+static herr_t H5D__farray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
+ H5O_storage_chunk_t *storage_dst);
+static herr_t H5D__farray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size);
+static herr_t H5D__farray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
+static herr_t H5D__farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream);
+static herr_t H5D__farray_idx_dest(const H5D_chk_idx_info_t *idx_info);
/* Generic fixed array routines */
static herr_t H5D__farray_idx_open(const H5D_chk_idx_info_t *idx_info);
@@ -146,62 +136,60 @@ static herr_t H5D__farray_idx_depend(const H5D_chk_idx_info_t *idx_info);
/* Fixed array indexed chunk I/O ops */
const H5D_chunk_ops_t H5D_COPS_FARRAY[1] = {{
- TRUE, /* Fixed array indices support SWMR access */
- H5D__farray_idx_init, /* init */
- H5D__farray_idx_create, /* create */
- H5D__farray_idx_is_space_alloc, /* is_space_alloc */
- H5D__farray_idx_insert, /* insert */
- H5D__farray_idx_get_addr, /* get_addr */
- NULL, /* resize */
- H5D__farray_idx_iterate, /* iterate */
- H5D__farray_idx_remove, /* remove */
- H5D__farray_idx_delete, /* delete */
- H5D__farray_idx_copy_setup, /* copy_setup */
- H5D__farray_idx_copy_shutdown, /* copy_shutdown */
- H5D__farray_idx_size, /* size */
- H5D__farray_idx_reset, /* reset */
- H5D__farray_idx_dump, /* dump */
- H5D__farray_idx_dest /* destroy */
+ TRUE, /* Fixed array indices support SWMR access */
+ H5D__farray_idx_init, /* init */
+ H5D__farray_idx_create, /* create */
+ H5D__farray_idx_is_space_alloc, /* is_space_alloc */
+ H5D__farray_idx_insert, /* insert */
+ H5D__farray_idx_get_addr, /* get_addr */
+ NULL, /* resize */
+ H5D__farray_idx_iterate, /* iterate */
+ H5D__farray_idx_remove, /* remove */
+ H5D__farray_idx_delete, /* delete */
+ H5D__farray_idx_copy_setup, /* copy_setup */
+ H5D__farray_idx_copy_shutdown, /* copy_shutdown */
+ H5D__farray_idx_size, /* size */
+ H5D__farray_idx_reset, /* reset */
+ H5D__farray_idx_dump, /* dump */
+ H5D__farray_idx_dest /* destroy */
}};
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
/* Fixed array class callbacks for dataset chunks w/o filters */
-const H5FA_class_t H5FA_CLS_CHUNK[1]={{
- H5FA_CLS_CHUNK_ID, /* Type of fixed array */
- "Chunk w/o filters", /* Name of fixed array class */
- sizeof(haddr_t), /* Size of native element */
- H5D__farray_crt_context, /* Create context */
- H5D__farray_dst_context, /* Destroy context */
- H5D__farray_fill, /* Fill block of missing elements callback */
- H5D__farray_encode, /* Element encoding callback */
- H5D__farray_decode, /* Element decoding callback */
- H5D__farray_debug, /* Element debugging callback */
+const H5FA_class_t H5FA_CLS_CHUNK[1] = {{
+ H5FA_CLS_CHUNK_ID, /* Type of fixed array */
+ "Chunk w/o filters", /* Name of fixed array class */
+ sizeof(haddr_t), /* Size of native element */
+ H5D__farray_crt_context, /* Create context */
+ H5D__farray_dst_context, /* Destroy context */
+ H5D__farray_fill, /* Fill block of missing elements callback */
+ H5D__farray_encode, /* Element encoding callback */
+ H5D__farray_decode, /* Element decoding callback */
+ H5D__farray_debug, /* Element debugging callback */
H5D__farray_crt_dbg_context, /* Create debugging context */
- H5D__farray_dst_dbg_context /* Destroy debugging context */
+ H5D__farray_dst_dbg_context /* Destroy debugging context */
}};
/* Fixed array class callbacks for dataset chunks w/filters */
-const H5FA_class_t H5FA_CLS_FILT_CHUNK[1]={{
- H5FA_CLS_FILT_CHUNK_ID, /* Type of fixed array */
- "Chunk w/filters", /* Name of fixed array class */
+const H5FA_class_t H5FA_CLS_FILT_CHUNK[1] = {{
+ H5FA_CLS_FILT_CHUNK_ID, /* Type of fixed array */
+ "Chunk w/filters", /* Name of fixed array class */
sizeof(H5D_farray_filt_elmt_t), /* Size of native element */
- H5D__farray_crt_context, /* Create context */
- H5D__farray_dst_context, /* Destroy context */
- H5D__farray_filt_fill, /* Fill block of missing elements callback */
- H5D__farray_filt_encode, /* Element encoding callback */
- H5D__farray_filt_decode, /* Element decoding callback */
- H5D__farray_filt_debug, /* Element debugging callback */
- H5D__farray_crt_dbg_context, /* Create debugging context */
- H5D__farray_dst_dbg_context /* Destroy debugging context */
+ H5D__farray_crt_context, /* Create context */
+ H5D__farray_dst_context, /* Destroy context */
+ H5D__farray_filt_fill, /* Fill block of missing elements callback */
+ H5D__farray_filt_encode, /* Element encoding callback */
+ H5D__farray_filt_decode, /* Element decoding callback */
+ H5D__farray_filt_debug, /* Element debugging callback */
+ H5D__farray_crt_dbg_context, /* Create debugging context */
+ H5D__farray_dst_dbg_context /* Destroy debugging context */
}};
/* Declare a free list to manage the H5D_farray_ctx_t struct */
@@ -210,7 +198,6 @@ H5FL_DEFINE_STATIC(H5D_farray_ctx_t);
/* Declare a free list to manage the H5D_farray_ctx_ud_t struct */
H5FL_DEFINE_STATIC(H5D_farray_ctx_ud_t);
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_crt_context
*
@@ -227,9 +214,9 @@ H5FL_DEFINE_STATIC(H5D_farray_ctx_ud_t);
static void *
H5D__farray_crt_context(void *_udata)
{
- H5D_farray_ctx_t *ctx; /* Fixed array callback context */
- H5D_farray_ctx_ud_t *udata = (H5D_farray_ctx_ud_t *)_udata; /* User data for fixed array context */
- void *ret_value = NULL; /* Return value */
+ H5D_farray_ctx_t * ctx; /* Fixed array callback context */
+ H5D_farray_ctx_ud_t *udata = (H5D_farray_ctx_ud_t *)_udata; /* User data for fixed array context */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -239,17 +226,17 @@ H5D__farray_crt_context(void *_udata)
HDassert(udata->chunk_size > 0);
/* Allocate new context structure */
- if(NULL == (ctx = H5FL_MALLOC(H5D_farray_ctx_t)))
+ if (NULL == (ctx = H5FL_MALLOC(H5D_farray_ctx_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context")
- /* Initialize the context */
+ /* Initialize the context */
ctx->file_addr_len = H5F_SIZEOF_ADDR(udata->f);
/* Compute the size required for encoding the size of a chunk, allowing
* for an extra byte, in case the filter makes the chunk larger.
*/
ctx->chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)udata->chunk_size) + 8) / 8);
- if(ctx->chunk_size_len > 8)
+ if (ctx->chunk_size_len > 8)
ctx->chunk_size_len = 8;
/* Set return value */
@@ -259,7 +246,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_crt_context() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_dst_context
*
@@ -276,7 +262,7 @@ done:
static herr_t
H5D__farray_dst_context(void *_ctx)
{
- H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */
+ H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */
FUNC_ENTER_STATIC_NOERR
@@ -289,7 +275,6 @@ H5D__farray_dst_context(void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_dst_context() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_fill
*
@@ -306,7 +291,7 @@ H5D__farray_dst_context(void *_ctx)
static herr_t
H5D__farray_fill(void *nat_blk, size_t nelmts)
{
- haddr_t fill_val = H5D_FARRAY_FILL; /* Value to fill elements with */
+ haddr_t fill_val = H5D_FARRAY_FILL; /* Value to fill elements with */
FUNC_ENTER_STATIC_NOERR
@@ -319,7 +304,6 @@ H5D__farray_fill(void *nat_blk, size_t nelmts)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_fill() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_encode
*
@@ -336,8 +320,8 @@ H5D__farray_fill(void *nat_blk, size_t nelmts)
static herr_t
H5D__farray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)
{
- H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */
- const haddr_t *elmt = (const haddr_t *)_elmt; /* Convenience pointer to native elements */
+ H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */
+ const haddr_t * elmt = (const haddr_t *)_elmt; /* Convenience pointer to native elements */
FUNC_ENTER_STATIC_NOERR
@@ -348,7 +332,7 @@ H5D__farray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)
HDassert(ctx);
/* Encode native elements into raw elements */
- while(nelmts) {
+ while (nelmts) {
/* Encode element */
/* (advances 'raw' pointer) */
H5F_addr_encode_len(ctx->file_addr_len, (uint8_t **)&raw, *elmt);
@@ -363,7 +347,6 @@ H5D__farray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_encode() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_decode
*
@@ -380,9 +363,9 @@ H5D__farray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)
static herr_t
H5D__farray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
{
- H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */
- haddr_t *elmt = (haddr_t *)_elmt; /* Convenience pointer to native elements */
- const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
+ H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */
+ haddr_t * elmt = (haddr_t *)_elmt; /* Convenience pointer to native elements */
+ const uint8_t * raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
FUNC_ENTER_STATIC_NOERR
@@ -392,7 +375,7 @@ H5D__farray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
HDassert(nelmts);
/* Decode raw elements into native elements */
- while(nelmts) {
+ while (nelmts) {
/* Decode element */
/* (advances 'raw' pointer) */
H5F_addr_decode_len(ctx->file_addr_len, &raw, elmt);
@@ -407,7 +390,6 @@ H5D__farray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_decode() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_debug
*
@@ -422,10 +404,9 @@ H5D__farray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
- const void *elmt)
+H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt)
{
- char temp_str[128]; /* Temporary string, for formatting */
+ char temp_str[128]; /* Temporary string, for formatting */
FUNC_ENTER_STATIC_NOERR
@@ -435,13 +416,11 @@ H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
/* Print element */
HDsprintf(temp_str, "Element #%" PRIuHSIZE ":", idx);
- HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str,
- *(const haddr_t *)elmt);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_debug() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_crt_dbg_context
*
@@ -459,11 +438,11 @@ H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
static void *
H5D__farray_crt_dbg_context(H5F_t *f, haddr_t obj_addr)
{
- H5D_farray_ctx_ud_t *dbg_ctx = NULL; /* Context for fixed array callback */
- H5O_loc_t obj_loc; /* Pointer to an object's location */
- hbool_t obj_opened = FALSE; /* Flag to indicate that the object header was opened */
- H5O_layout_t layout; /* Layout message */
- void *ret_value = NULL; /* Return value */
+ H5D_farray_ctx_ud_t *dbg_ctx = NULL; /* Context for fixed array callback */
+ H5O_loc_t obj_loc; /* Pointer to an object's location */
+ hbool_t obj_opened = FALSE; /* Flag to indicate that the object header was opened */
+ H5O_layout_t layout; /* Layout message */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -472,7 +451,7 @@ H5D__farray_crt_dbg_context(H5F_t *f, haddr_t obj_addr)
HDassert(H5F_addr_defined(obj_addr));
/* Allocate context for debugging callback */
- if(NULL == (dbg_ctx = H5FL_MALLOC(H5D_farray_ctx_ud_t)))
+ if (NULL == (dbg_ctx = H5FL_MALLOC(H5D_farray_ctx_ud_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context")
/* Set up the object header location info */
@@ -481,20 +460,20 @@ H5D__farray_crt_dbg_context(H5F_t *f, haddr_t obj_addr)
obj_loc.addr = obj_addr;
/* Open the object header where the layout message resides */
- if(H5O_open(&obj_loc) < 0)
+ if (H5O_open(&obj_loc) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "can't open object header")
obj_opened = TRUE;
/* Read the layout message */
- if(NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, &layout))
+ if (NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, &layout))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get layout info")
/* close the object header */
- if(H5O_close(&obj_loc, NULL) < 0)
+ if (H5O_close(&obj_loc, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header")
/* Create user data */
- dbg_ctx->f = f;
+ dbg_ctx->f = f;
dbg_ctx->chunk_size = layout.u.chunk.size;
/* Set return value */
@@ -502,21 +481,20 @@ H5D__farray_crt_dbg_context(H5F_t *f, haddr_t obj_addr)
done:
/* Cleanup on error */
- if(ret_value == NULL) {
+ if (ret_value == NULL) {
/* Release context structure */
- if(dbg_ctx)
+ if (dbg_ctx)
dbg_ctx = H5FL_FREE(H5D_farray_ctx_ud_t, dbg_ctx);
/* Close object header */
- if(obj_opened)
- if(H5O_close(&obj_loc, NULL) < 0)
+ if (obj_opened)
+ if (H5O_close(&obj_loc, NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_crt_dbg_context() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_dst_dbg_context
*
@@ -547,7 +525,6 @@ H5D__farray_dst_dbg_context(void *_dbg_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_dst_dbg_context() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_filt_fill
*
@@ -564,7 +541,7 @@ H5D__farray_dst_dbg_context(void *_dbg_ctx)
static herr_t
H5D__farray_filt_fill(void *nat_blk, size_t nelmts)
{
- H5D_farray_filt_elmt_t fill_val = H5D_FARRAY_FILT_FILL; /* Value to fill elements with */
+ H5D_farray_filt_elmt_t fill_val = H5D_FARRAY_FILT_FILL; /* Value to fill elements with */
FUNC_ENTER_STATIC_NOERR
@@ -578,7 +555,6 @@ H5D__farray_filt_fill(void *nat_blk, size_t nelmts)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_filt_fill() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_filt_encode
*
@@ -595,9 +571,10 @@ H5D__farray_filt_fill(void *nat_blk, size_t nelmts)
static herr_t
H5D__farray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx)
{
- H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */
- uint8_t *raw = (uint8_t *)_raw; /* Convenience pointer to raw elements */
- const H5D_farray_filt_elmt_t *elmt = (const H5D_farray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
+ H5D_farray_ctx_t * ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */
+ uint8_t * raw = (uint8_t *)_raw; /* Convenience pointer to raw elements */
+ const H5D_farray_filt_elmt_t *elmt =
+ (const H5D_farray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
FUNC_ENTER_STATIC_NOERR
@@ -608,7 +585,7 @@ H5D__farray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx
HDassert(ctx);
/* Encode native elements into raw elements */
- while(nelmts) {
+ while (nelmts) {
/* Encode element */
/* (advances 'raw' pointer) */
H5F_addr_encode_len(ctx->file_addr_len, &raw, elmt->addr);
@@ -625,7 +602,6 @@ H5D__farray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_filt_encode() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_filt_decode
*
@@ -642,8 +618,9 @@ H5D__farray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx
static herr_t
H5D__farray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)
{
- H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */
- H5D_farray_filt_elmt_t *elmt = (H5D_farray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
+ H5D_farray_ctx_t * ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */
+ H5D_farray_filt_elmt_t *elmt =
+ (H5D_farray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
FUNC_ENTER_STATIC_NOERR
@@ -654,7 +631,7 @@ H5D__farray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx
HDassert(nelmts);
/* Decode raw elements into native elements */
- while(nelmts) {
+ while (nelmts) {
/* Decode element */
/* (advances 'raw' pointer) */
H5F_addr_decode_len(ctx->file_addr_len, &raw, &elmt->addr);
@@ -671,7 +648,6 @@ H5D__farray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_filt_decode() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_filt_debug
*
@@ -686,11 +662,11 @@ H5D__farray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
- const void *_elmt)
+H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *_elmt)
{
- const H5D_farray_filt_elmt_t *elmt = (const H5D_farray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
- char temp_str[128]; /* Temporary string, for formatting */
+ const H5D_farray_filt_elmt_t *elmt =
+ (const H5D_farray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */
+ char temp_str[128]; /* Temporary string, for formatting */
FUNC_ENTER_STATIC_NOERR
@@ -700,13 +676,12 @@ H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
/* Print element */
HDsprintf(temp_str, "Element #%" PRIuHSIZE ":", idx);
- HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str,
- elmt->addr, elmt->nbytes, elmt->filter_mask);
+ HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr,
+ elmt->nbytes, elmt->filter_mask);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_filt_debug() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_depend
*
@@ -724,10 +699,10 @@ H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
static herr_t
H5D__farray_idx_depend(const H5D_chk_idx_info_t *idx_info)
{
- H5O_t *oh = NULL; /* Object header */
- H5O_loc_t oloc; /* Temporary object header location for dataset */
- H5AC_proxy_entry_t *oh_proxy; /* Dataset's object header proxy */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_t * oh = NULL; /* Object header */
+ H5O_loc_t oloc; /* Temporary object header location for dataset */
+ H5AC_proxy_entry_t *oh_proxy; /* Dataset's object header proxy */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -749,26 +724,26 @@ H5D__farray_idx_depend(const H5D_chk_idx_info_t *idx_info)
oloc.addr = idx_info->storage->u.farray.dset_ohdr_addr;
/* Get header */
- if(NULL == (oh = H5O_protect(&oloc, H5AC__READ_ONLY_FLAG, TRUE)))
+ if (NULL == (oh = H5O_protect(&oloc, H5AC__READ_ONLY_FLAG, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect object header")
/* Retrieve the dataset's object header proxy */
- if(NULL == (oh_proxy = H5O_get_proxy(oh)))
+ if (NULL == (oh_proxy = H5O_get_proxy(oh)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataset object header proxy")
/* Make the fixed array a child flush dependency of the dataset's object header proxy */
- if(H5FA_depend(idx_info->storage->u.farray.fa, oh_proxy) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header proxy")
+ if (H5FA_depend(idx_info->storage->u.farray.fa, oh_proxy) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency on object header proxy")
done:
/* Release the object header from the cache */
- if(oh && H5O_unprotect(&oloc, oh, H5AC__NO_FLAGS_SET) < 0)
+ if (oh && H5O_unprotect(&oloc, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_depend() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_init
*
@@ -782,7 +757,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__farray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNUSED *space, haddr_t dset_ohdr_addr)
+H5D__farray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNUSED *space,
+ haddr_t dset_ohdr_addr)
{
FUNC_ENTER_STATIC_NOERR
@@ -796,7 +772,6 @@ H5D__farray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNU
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_idx_init() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_open
*
@@ -814,8 +789,8 @@ H5D__farray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNU
static herr_t
H5D__farray_idx_open(const H5D_chk_idx_info_t *idx_info)
{
- H5D_farray_ctx_ud_t udata; /* User data for fixed array open call */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_farray_ctx_ud_t udata; /* User data for fixed array open call */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -831,23 +806,24 @@ H5D__farray_idx_open(const H5D_chk_idx_info_t *idx_info)
HDassert(NULL == idx_info->storage->u.farray.fa);
/* Set up the user data */
- udata.f = idx_info->f;
+ udata.f = idx_info->f;
udata.chunk_size = idx_info->layout->size;
/* Open the fixed array for the chunk index */
- if(NULL == (idx_info->storage->u.farray.fa = H5FA_open(idx_info->f, idx_info->storage->idx_addr, &udata)))
+ if (NULL ==
+ (idx_info->storage->u.farray.fa = H5FA_open(idx_info->f, idx_info->storage->idx_addr, &udata)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open fixed array")
- /* Check for SWMR writes to the file */
- if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
- if(H5D__farray_idx_depend(idx_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header")
+ /* Check for SWMR writes to the file */
+ if (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
+ if (H5D__farray_idx_depend(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency on object header")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_open() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_create
*
@@ -869,9 +845,9 @@ done:
static herr_t
H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info)
{
- H5FA_create_t cparam; /* Fixed array creation parameters */
- H5D_farray_ctx_ud_t udata; /* User data for fixed array create call */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FA_create_t cparam; /* Fixed array creation parameters */
+ H5D_farray_ctx_ud_t udata; /* User data for fixed array create call */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -886,21 +862,21 @@ H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info)
HDassert(idx_info->layout->nchunks);
/* General parameters */
- if(idx_info->pline->nused > 0) {
- unsigned chunk_size_len; /* Size of encoded chunk size */
+ if (idx_info->pline->nused > 0) {
+ unsigned chunk_size_len; /* Size of encoded chunk size */
/* Compute the size required for encoding the size of a chunk, allowing
* for an extra byte, in case the filter makes the chunk larger.
*/
chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)idx_info->layout->size) + 8) / 8);
- if(chunk_size_len > 8)
+ if (chunk_size_len > 8)
chunk_size_len = 8;
- cparam.cls = H5FA_CLS_FILT_CHUNK;
+ cparam.cls = H5FA_CLS_FILT_CHUNK;
cparam.raw_elmt_size = (uint8_t)(H5F_SIZEOF_ADDR(idx_info->f) + chunk_size_len + 4);
} /* end if */
else {
- cparam.cls = H5FA_CLS_CHUNK;
+ cparam.cls = H5FA_CLS_CHUNK;
cparam.raw_elmt_size = (uint8_t)H5F_SIZEOF_ADDR(idx_info->f);
} /* end else */
cparam.max_dblk_page_nelmts_bits = idx_info->layout->u.farray.cparam.max_dblk_page_nelmts_bits;
@@ -908,27 +884,27 @@ H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info)
cparam.nelmts = idx_info->layout->max_nchunks;
/* Set up the user data */
- udata.f = idx_info->f;
+ udata.f = idx_info->f;
udata.chunk_size = idx_info->layout->size;
/* Create the fixed array for the chunk index */
- if(NULL == (idx_info->storage->u.farray.fa = H5FA_create(idx_info->f, &cparam, &udata)))
+ if (NULL == (idx_info->storage->u.farray.fa = H5FA_create(idx_info->f, &cparam, &udata)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create fixed array")
/* Get the address of the fixed array in file */
- if(H5FA_get_addr(idx_info->storage->u.farray.fa, &(idx_info->storage->idx_addr)) < 0)
+ if (H5FA_get_addr(idx_info->storage->u.farray.fa, &(idx_info->storage->idx_addr)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array address")
/* Check for SWMR writes to the file */
- if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
- if(H5D__farray_idx_depend(idx_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header")
+ if (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
+ if (H5D__farray_idx_depend(idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency on object header")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_create() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_is_space_alloc
*
@@ -952,7 +928,6 @@ H5D__farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr))
} /* end H5D__farray_idx_is_space_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_insert
*
@@ -966,10 +941,10 @@ H5D__farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
*/
static herr_t
H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
- const H5D_t H5_ATTR_UNUSED *dset)
+ const H5D_t H5_ATTR_UNUSED *dset)
{
- H5FA_t *fa; /* Pointer to fixed array structure */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FA_t *fa; /* Pointer to fixed array structure */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -983,36 +958,37 @@ H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata
HDassert(udata);
/* Check if the fixed array is open yet */
- if(NULL == idx_info->storage->u.farray.fa) {
+ if (NULL == idx_info->storage->u.farray.fa) {
/* Open the fixed array in file */
- if(H5D__farray_idx_open(idx_info) < 0)
+ if (H5D__farray_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
- } else /* Patch the top level file pointer contained in fa if needed */
+ }
+ else /* Patch the top level file pointer contained in fa if needed */
H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f);
/* Set convenience pointer to fixed array structure */
fa = idx_info->storage->u.farray.fa;
- if(!H5F_addr_defined(udata->chunk_block.offset))
+ if (!H5F_addr_defined(udata->chunk_block.offset))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "The chunk should have allocated already")
- if(udata->chunk_idx != (udata->chunk_idx & 0xffffffff)) /* negative value */
+ if (udata->chunk_idx != (udata->chunk_idx & 0xffffffff)) /* negative value */
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk index must be less than 2^32")
/* Check for filters on chunks */
- if(idx_info->pline->nused > 0) {
- H5D_farray_filt_elmt_t elmt; /* Fixed array element */
+ if (idx_info->pline->nused > 0) {
+ H5D_farray_filt_elmt_t elmt; /* Fixed array element */
elmt.addr = udata->chunk_block.offset;
H5_CHECKED_ASSIGN(elmt.nbytes, uint32_t, udata->chunk_block.length, hsize_t);
elmt.filter_mask = udata->filter_mask;
/* Set the info for the chunk */
- if(H5FA_set(fa, udata->chunk_idx, &elmt) < 0)
+ if (H5FA_set(fa, udata->chunk_idx, &elmt) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info")
} /* end if */
else {
/* Set the address for the chunk */
- if(H5FA_set(fa, udata->chunk_idx, &udata->chunk_block.offset) < 0)
+ if (H5FA_set(fa, udata->chunk_idx, &udata->chunk_block.offset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk address")
} /* end else */
@@ -1020,7 +996,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__farray_idx_insert() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_get_addr
*
@@ -1038,9 +1013,9 @@ done:
static herr_t
H5D__farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata)
{
- H5FA_t *fa; /* Pointer to fixed array structure */
- hsize_t idx; /* Array index of chunk */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FA_t *fa; /* Pointer to fixed array structure */
+ hsize_t idx; /* Array index of chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1054,52 +1029,53 @@ H5D__farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda
HDassert(udata);
/* Check if the fixed array is open yet */
- if(NULL == idx_info->storage->u.farray.fa) {
+ if (NULL == idx_info->storage->u.farray.fa) {
/* Open the fixed array in file */
- if(H5D__farray_idx_open(idx_info) < 0)
+ if (H5D__farray_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
- } else /* Patch the top level file pointer contained in fa if needed */
+ }
+ else /* Patch the top level file pointer contained in fa if needed */
H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f);
/* Set convenience pointer to fixed array structure */
fa = idx_info->storage->u.farray.fa;
/* Calculate the index of this chunk */
- idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks, udata->common.scaled);
+ idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks,
+ udata->common.scaled);
udata->chunk_idx = idx;
/* Check for filters on chunks */
- if(idx_info->pline->nused > 0) {
- H5D_farray_filt_elmt_t elmt; /* Fixed array element */
+ if (idx_info->pline->nused > 0) {
+ H5D_farray_filt_elmt_t elmt; /* Fixed array element */
/* Get the information for the chunk */
- if(H5FA_get(fa, idx, &elmt) < 0)
+ if (H5FA_get(fa, idx, &elmt) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info")
/* Set the info for the chunk */
udata->chunk_block.offset = elmt.addr;
udata->chunk_block.length = elmt.nbytes;
- udata->filter_mask = elmt.filter_mask;
+ udata->filter_mask = elmt.filter_mask;
} /* end if */
else {
/* Get the address for the chunk */
- if(H5FA_get(fa, idx, &udata->chunk_block.offset) < 0)
+ if (H5FA_get(fa, idx, &udata->chunk_block.offset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address")
/* Update the other (constant) information for the chunk */
udata->chunk_block.length = idx_info->layout->size;
- udata->filter_mask = 0;
+ udata->filter_mask = 0;
} /* end else */
- if(!H5F_addr_defined(udata->chunk_block.offset))
+ if (!H5F_addr_defined(udata->chunk_block.offset))
udata->chunk_block.length = 0;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__farray_idx_get_addr() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_iterate_cb
*
@@ -1115,39 +1091,39 @@ done:
static int
H5D__farray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void *_udata)
{
- H5D_farray_it_ud_t *udata = (H5D_farray_it_ud_t *)_udata; /* User data */
- unsigned ndims; /* Rank of chunk */
- int curr_dim; /* Current dimension */
- int ret_value = H5_ITER_CONT; /* Return value */
+ H5D_farray_it_ud_t *udata = (H5D_farray_it_ud_t *)_udata; /* User data */
+ unsigned ndims; /* Rank of chunk */
+ int curr_dim; /* Current dimension */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Compose generic chunk record for callback */
- if(udata->filtered) {
+ if (udata->filtered) {
const H5D_farray_filt_elmt_t *filt_elmt = (const H5D_farray_filt_elmt_t *)_elmt;
- udata->chunk_rec.chunk_addr = filt_elmt->addr;
- udata->chunk_rec.nbytes = filt_elmt->nbytes;
+ udata->chunk_rec.chunk_addr = filt_elmt->addr;
+ udata->chunk_rec.nbytes = filt_elmt->nbytes;
udata->chunk_rec.filter_mask = filt_elmt->filter_mask;
} /* end if */
else
udata->chunk_rec.chunk_addr = *(const haddr_t *)_elmt;
/* Make "generic chunk" callback */
- if(H5F_addr_defined(udata->chunk_rec.chunk_addr))
- if((ret_value = (udata->cb)(&udata->chunk_rec, udata->udata)) < 0)
+ if (H5F_addr_defined(udata->chunk_rec.chunk_addr))
+ if ((ret_value = (udata->cb)(&udata->chunk_rec, udata->udata)) < 0)
HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback");
/* Update coordinates of chunk in dataset */
ndims = udata->common.layout->ndims - 1;
HDassert(ndims > 0);
curr_dim = (int)(ndims - 1);
- while(curr_dim >= 0) {
+ while (curr_dim >= 0) {
/* Increment coordinate in current dimension */
udata->chunk_rec.scaled[curr_dim]++;
/* Check if we went off the end of the current dimension */
- if(udata->chunk_rec.scaled[curr_dim] >= udata->common.layout->max_chunks[curr_dim]) {
+ if (udata->chunk_rec.scaled[curr_dim] >= udata->common.layout->max_chunks[curr_dim]) {
/* Reset coordinate & move to next faster dimension */
udata->chunk_rec.scaled[curr_dim] = 0;
curr_dim--;
@@ -1159,7 +1135,6 @@ H5D__farray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void *
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__farray_idx_iterate_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_iterate
*
@@ -1174,12 +1149,11 @@ H5D__farray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void *
*-------------------------------------------------------------------------
*/
static int
-H5D__farray_idx_iterate(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
+H5D__farray_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
{
- H5FA_t *fa; /* Pointer to fixed array structure */
- H5FA_stat_t fa_stat; /* Fixed array statistics */
- int ret_value = FAIL; /* Return value */
+ H5FA_t * fa; /* Pointer to fixed array structure */
+ H5FA_stat_t fa_stat; /* Fixed array statistics */
+ int ret_value = FAIL; /* Return value */
FUNC_ENTER_STATIC
@@ -1194,39 +1168,40 @@ H5D__farray_idx_iterate(const H5D_chk_idx_info_t *idx_info,
HDassert(chunk_udata);
/* Check if the fixed array is open yet */
- if(NULL == idx_info->storage->u.farray.fa) {
+ if (NULL == idx_info->storage->u.farray.fa) {
/* Open the fixed array in file */
- if(H5D__farray_idx_open(idx_info) < 0)
+ if (H5D__farray_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
- } else /* Patch the top level file pointer contained in fa if needed */
+ }
+ else /* Patch the top level file pointer contained in fa if needed */
H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f);
/* Set convenience pointer to fixed array structure */
fa = idx_info->storage->u.farray.fa;
/* Get the fixed array statistics */
- if(H5FA_get_stats(fa, &fa_stat) < 0)
+ if (H5FA_get_stats(fa, &fa_stat) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array statistics")
/* Check if there are any array elements */
- if(fa_stat.nelmts > 0) {
- H5D_farray_it_ud_t udata; /* User data for iteration callback */
+ if (fa_stat.nelmts > 0) {
+ H5D_farray_it_ud_t udata; /* User data for iteration callback */
/* Initialize userdata */
HDmemset(&udata, 0, sizeof udata);
- udata.common.layout = idx_info->layout;
+ udata.common.layout = idx_info->layout;
udata.common.storage = idx_info->storage;
HDmemset(&udata.chunk_rec, 0, sizeof(udata.chunk_rec));
udata.filtered = (idx_info->pline->nused > 0);
- if(!udata.filtered) {
- udata.chunk_rec.nbytes = idx_info->layout->size;
+ if (!udata.filtered) {
+ udata.chunk_rec.nbytes = idx_info->layout->size;
udata.chunk_rec.filter_mask = 0;
} /* end if */
- udata.cb = chunk_cb;
+ udata.cb = chunk_cb;
udata.udata = chunk_udata;
/* Iterate over the fixed array elements */
- if((ret_value = H5FA_iterate(fa, H5D__farray_idx_iterate_cb, &udata)) < 0)
+ if ((ret_value = H5FA_iterate(fa, H5D__farray_idx_iterate_cb, &udata)) < 0)
HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over fixed array chunk index");
} /* end if */
@@ -1234,7 +1209,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_iterate() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_remove
*
@@ -1250,9 +1224,9 @@ done:
static herr_t
H5D__farray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata)
{
- H5FA_t *fa; /* Pointer to fixed array structure */
- hsize_t idx; /* Array index of chunk */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FA_t *fa; /* Pointer to fixed array structure */
+ hsize_t idx; /* Array index of chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1266,61 +1240,63 @@ H5D__farray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t
HDassert(udata);
/* Check if the fixed array is open yet */
- if(NULL == idx_info->storage->u.farray.fa) {
+ if (NULL == idx_info->storage->u.farray.fa) {
/* Open the fixed array in file */
- if(H5D__farray_idx_open(idx_info) < 0)
+ if (H5D__farray_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
- } else /* Patch the top level file pointer contained in fa if needed */
- if(H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch fixed array file pointer")
+ }
+ else /* Patch the top level file pointer contained in fa if needed */
+ if (H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch fixed array file pointer")
/* Set convenience pointer to fixed array structure */
fa = idx_info->storage->u.farray.fa;
/* Calculate the index of this chunk */
- idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks, udata->scaled);
+ idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks,
+ udata->scaled);
/* Check for filters on chunks */
- if(idx_info->pline->nused > 0) {
- H5D_farray_filt_elmt_t elmt; /* Fixed array element */
+ if (idx_info->pline->nused > 0) {
+ H5D_farray_filt_elmt_t elmt; /* Fixed array element */
/* Get the info about the chunk for the index */
- if(H5FA_get(fa, idx, &elmt) < 0)
+ if (H5FA_get(fa, idx, &elmt) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info")
/* Remove raw data chunk from file if not doing SWMR writes */
HDassert(H5F_addr_defined(elmt.addr));
- if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) {
- H5_CHECK_OVERFLOW(elmt.nbytes, /*From: */uint32_t, /*To: */hsize_t);
- if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, elmt.addr, (hsize_t)elmt.nbytes) < 0)
+ if (!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) {
+ H5_CHECK_OVERFLOW(elmt.nbytes, /*From: */ uint32_t, /*To: */ hsize_t);
+ if (H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, elmt.addr, (hsize_t)elmt.nbytes) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
} /* end if */
/* Reset the info about the chunk for the index */
- elmt.addr = HADDR_UNDEF;
- elmt.nbytes = 0;
+ elmt.addr = HADDR_UNDEF;
+ elmt.nbytes = 0;
elmt.filter_mask = 0;
- if(H5FA_set(fa, idx, &elmt) < 0)
+ if (H5FA_set(fa, idx, &elmt) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk info")
} /* end if */
else {
- haddr_t addr = HADDR_UNDEF; /* Chunk address */
+ haddr_t addr = HADDR_UNDEF; /* Chunk address */
/* Get the address of the chunk for the index */
- if(H5FA_get(fa, idx, &addr) < 0)
+ if (H5FA_get(fa, idx, &addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address")
/* Remove raw data chunk from file if not doing SWMR writes */
HDassert(H5F_addr_defined(addr));
- if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) {
- H5_CHECK_OVERFLOW(idx_info->layout->size, /*From: */uint32_t, /*To: */hsize_t);
- if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, addr, (hsize_t)idx_info->layout->size) < 0)
+ if (!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) {
+ H5_CHECK_OVERFLOW(idx_info->layout->size, /*From: */ uint32_t, /*To: */ hsize_t);
+ if (H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, addr, (hsize_t)idx_info->layout->size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
} /* end if */
/* Reset the address of the chunk for the index */
addr = HADDR_UNDEF;
- if(H5FA_set(fa, idx, &addr) < 0)
+ if (H5FA_set(fa, idx, &addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk address")
} /* end else */
@@ -1328,7 +1304,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__farray_idx_remove() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_delete_cb
*
@@ -1345,8 +1320,8 @@ done:
static int
H5D__farray_idx_delete_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
{
- H5F_t *f = (H5F_t *)_udata; /* User data for callback */
- int ret_value = H5_ITER_CONT; /* Return value */
+ H5F_t *f = (H5F_t *)_udata; /* User data for callback */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -1357,15 +1332,14 @@ H5D__farray_idx_delete_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HDassert(f);
/* Remove raw data chunk from file */
- H5_CHECK_OVERFLOW(chunk_rec->nbytes, /*From: */uint32_t, /*To: */hsize_t);
- if(H5MF_xfree(f, H5FD_MEM_DRAW, chunk_rec->chunk_addr, (hsize_t)chunk_rec->nbytes) < 0)
+ H5_CHECK_OVERFLOW(chunk_rec->nbytes, /*From: */ uint32_t, /*To: */ hsize_t);
+ if (H5MF_xfree(f, H5FD_MEM_DRAW, chunk_rec->chunk_addr, (hsize_t)chunk_rec->nbytes) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free chunk")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_delete_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_delete
*
@@ -1383,7 +1357,7 @@ done:
static herr_t
H5D__farray_idx_delete(const H5D_chk_idx_info_t *idx_info)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1395,24 +1369,24 @@ H5D__farray_idx_delete(const H5D_chk_idx_info_t *idx_info)
HDassert(idx_info->storage);
/* Check if the index data structure has been allocated */
- if(H5F_addr_defined(idx_info->storage->idx_addr)) {
- H5D_farray_ctx_ud_t ctx_udata; /* User data for fixed array open call */
+ if (H5F_addr_defined(idx_info->storage->idx_addr)) {
+ H5D_farray_ctx_ud_t ctx_udata; /* User data for fixed array open call */
/* Iterate over the chunk addresses in the fixed array, deleting each chunk */
- if(H5D__farray_idx_iterate(idx_info, H5D__farray_idx_delete_cb, idx_info->f) < 0)
+ if (H5D__farray_idx_iterate(idx_info, H5D__farray_idx_delete_cb, idx_info->f) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk addresses")
/* Close fixed array */
- if(H5FA_close(idx_info->storage->u.farray.fa) < 0)
+ if (H5FA_close(idx_info->storage->u.farray.fa) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array")
idx_info->storage->u.farray.fa = NULL;
/* Set up the user data */
- ctx_udata.f = idx_info->f;
+ ctx_udata.f = idx_info->f;
ctx_udata.chunk_size = idx_info->layout->size;
/* Delete fixed array */
- if(H5FA_delete(idx_info->f, idx_info->storage->idx_addr, &ctx_udata) < 0)
+ if (H5FA_delete(idx_info->f, idx_info->storage->idx_addr, &ctx_udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk fixed array")
idx_info->storage->idx_addr = HADDR_UNDEF;
} /* end if */
@@ -1423,7 +1397,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_copy_setup
*
@@ -1437,10 +1410,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__farray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
- const H5D_chk_idx_info_t *idx_info_dst)
+H5D__farray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1458,16 +1430,16 @@ H5D__farray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr));
/* Check if the source fixed array is open yet */
- if(NULL == idx_info_src->storage->u.farray.fa)
+ if (NULL == idx_info_src->storage->u.farray.fa)
/* Open the fixed array in file */
- if(H5D__farray_idx_open(idx_info_src) < 0)
+ if (H5D__farray_idx_open(idx_info_src) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
/* Set copied metadata tag */
H5_BEGIN_TAG(H5AC__COPIED_TAG);
/* Create the fixed array that describes chunked storage in the dest. file */
- if(H5D__farray_idx_create(idx_info_dst) < 0)
+ if (H5D__farray_idx_create(idx_info_dst) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr));
@@ -1478,7 +1450,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_copy_setup() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_copy_shutdown
*
@@ -1492,10 +1463,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__farray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
- H5O_storage_chunk_t *storage_dst)
+H5D__farray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, H5O_storage_chunk_t *storage_dst)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1506,10 +1476,10 @@ H5D__farray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
HDassert(storage_dst->u.farray.fa);
/* Close fixed arrays */
- if(H5FA_close(storage_src->u.farray.fa) < 0)
+ if (H5FA_close(storage_src->u.farray.fa) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array")
storage_src->u.farray.fa = NULL;
- if(H5FA_close(storage_dst->u.farray.fa) < 0)
+ if (H5FA_close(storage_dst->u.farray.fa) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array")
storage_dst->u.farray.fa = NULL;
@@ -1517,7 +1487,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_copy_shutdown() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_size
*
@@ -1534,9 +1503,9 @@ done:
static herr_t
H5D__farray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size)
{
- H5FA_t *fa; /* Pointer to fixed array structure */
- H5FA_stat_t fa_stat; /* Fixed array statistics */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FA_t * fa; /* Pointer to fixed array structure */
+ H5FA_stat_t fa_stat; /* Fixed array statistics */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1550,22 +1519,22 @@ H5D__farray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size)
HDassert(index_size);
/* Open the fixed array in file */
- if(H5D__farray_idx_open(idx_info) < 0)
+ if (H5D__farray_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
/* Set convenience pointer to fixed array structure */
fa = idx_info->storage->u.farray.fa;
/* Get the fixed array statistics */
- if(H5FA_get_stats(fa, &fa_stat) < 0)
+ if (H5FA_get_stats(fa, &fa_stat) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array statistics")
*index_size = fa_stat.hdr_size;
*index_size += fa_stat.dblk_size;
done:
- if(idx_info->storage->u.farray.fa) {
- if(H5FA_close(idx_info->storage->u.farray.fa) < 0)
+ if (idx_info->storage->u.farray.fa) {
+ if (H5FA_close(idx_info->storage->u.farray.fa) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array")
idx_info->storage->u.farray.fa = NULL;
} /* end if */
@@ -1573,7 +1542,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_size() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_reset
*
@@ -1595,14 +1563,13 @@ H5D__farray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
HDassert(storage);
/* Reset index info */
- if(reset_addr)
+ if (reset_addr)
storage->idx_addr = HADDR_UNDEF;
storage->u.farray.fa = NULL;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_idx_reset() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_dump
*
@@ -1629,7 +1596,6 @@ H5D__farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__farray_idx_dump() */
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_idx_dest
*
@@ -1645,7 +1611,7 @@ H5D__farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
static herr_t
H5D__farray_idx_dest(const H5D_chk_idx_info_t *idx_info)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1655,14 +1621,14 @@ H5D__farray_idx_dest(const H5D_chk_idx_info_t *idx_info)
HDassert(idx_info->storage);
/* Check if the fixed array is open */
- if(idx_info->storage->u.farray.fa) {
+ if (idx_info->storage->u.farray.fa) {
/* Patch the top level file pointer contained in fa if needed */
- if(H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f) < 0)
+ if (H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch fixed array file pointer")
/* Close fixed array */
- if(H5FA_close(idx_info->storage->u.farray.fa) < 0)
+ if (H5FA_close(idx_info->storage->u.farray.fa) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array")
idx_info->storage->u.farray.fa = NULL;
} /* end if */
@@ -1670,4 +1636,3 @@ H5D__farray_idx_dest(const H5D_chk_idx_info_t *idx_info)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_idx_dest() */
-
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index 0efe98a..03a128d8 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -26,45 +26,39 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5VMprivate.h" /* Vector and array functions */
-#include "H5WBprivate.h" /* Wrapped Buffers */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Dataset functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VMprivate.h" /* Vector and array functions */
+#include "H5WBprivate.h" /* Wrapped Buffers */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
static herr_t H5D__fill_release(H5D_fill_buf_info_t *fb_info);
-
/*********************/
/* Package Variables */
/*********************/
@@ -72,12 +66,10 @@ static herr_t H5D__fill_release(H5D_fill_buf_info_t *fb_info);
/* Declare extern the free list to manage blocks of type conversion data */
H5FL_BLK_EXTERN(type_conv);
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -91,7 +83,6 @@ H5FL_BLK_DEFINE_STATIC(zero_fill);
/* Declare extern free list to manage the H5S_sel_iter_t struct */
H5FL_EXTERN(H5S_sel_iter_t);
-
/*--------------------------------------------------------------------------
NAME
H5Dfill
@@ -127,24 +118,23 @@ H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_
H5TRACE5("e", "*xi*xii", fill, fill_type_id, buf, buf_type_id, space_id);
/* Check args */
- if(buf == NULL)
+ if (buf == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer")
- if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataspace")
- if(NULL == (fill_type = (H5T_t *)H5I_object_verify(fill_type_id, H5I_DATATYPE)))
+ if (NULL == (fill_type = (H5T_t *)H5I_object_verify(fill_type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype")
- if(NULL == (buf_type = (H5T_t *)H5I_object_verify(buf_type_id, H5I_DATATYPE)))
+ if (NULL == (buf_type = (H5T_t *)H5I_object_verify(buf_type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype")
/* Fill the selection in the memory buffer */
- if(H5D__fill(fill, fill_type, buf, buf_type, space) < 0)
+ if (H5D__fill(fill, fill_type, buf, buf_type, space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed")
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Dfill() */
+} /* H5Dfill() */
-
/*--------------------------------------------------------------------------
NAME
H5D__fill
@@ -174,20 +164,19 @@ done:
on each element so that each of them has a copy of the VL data.
--------------------------------------------------------------------------*/
herr_t
-H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
- const H5T_t *buf_type, const H5S_t *space)
+H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_type, const H5S_t *space)
{
- H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */
- hbool_t mem_iter_init = FALSE; /* Whether the memory selection iterator has been initialized */
- H5WB_t *elem_wb = NULL; /* Wrapped buffer for element data */
- uint8_t elem_buf[H5T_ELEM_BUF_SIZE]; /* Buffer for element data */
- H5WB_t *bkg_elem_wb = NULL; /* Wrapped buffer for background data */
- uint8_t bkg_elem_buf[H5T_ELEM_BUF_SIZE]; /* Buffer for background data */
- uint8_t *bkg_buf = NULL; /* Background conversion buffer */
- uint8_t *tmp_buf = NULL; /* Temp conversion buffer */
- hid_t src_id = -1, dst_id = -1; /* Temporary type IDs */
- size_t dst_type_size; /* Size of destination type*/
- herr_t ret_value = SUCCEED; /* Return value */
+ H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */
+ hbool_t mem_iter_init = FALSE; /* Whether the memory selection iterator has been initialized */
+ H5WB_t * elem_wb = NULL; /* Wrapped buffer for element data */
+ uint8_t elem_buf[H5T_ELEM_BUF_SIZE]; /* Buffer for element data */
+ H5WB_t * bkg_elem_wb = NULL; /* Wrapped buffer for background data */
+ uint8_t bkg_elem_buf[H5T_ELEM_BUF_SIZE]; /* Buffer for background data */
+ uint8_t * bkg_buf = NULL; /* Background conversion buffer */
+ uint8_t * tmp_buf = NULL; /* Temp conversion buffer */
+ hid_t src_id = -1, dst_id = -1; /* Temporary type IDs */
+ size_t dst_type_size; /* Size of destination type*/
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -198,32 +187,32 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
HDassert(space);
/* Make sure the dataspace has an extent set (or is NULL) */
- if(!(H5S_has_extent(space)))
+ if (!(H5S_has_extent(space)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace extent has not been set")
/* Get the memory datatype size */
dst_type_size = H5T_get_size(buf_type);
/* If there's no fill value, just use zeros */
- if(fill == NULL) {
- void *elem_ptr; /* Pointer to element to use for fill value */
+ if (fill == NULL) {
+ void *elem_ptr; /* Pointer to element to use for fill value */
/* Wrap the local buffer for elements */
- if(NULL == (elem_wb = H5WB_wrap(elem_buf, sizeof(elem_buf))))
+ if (NULL == (elem_wb = H5WB_wrap(elem_buf, sizeof(elem_buf))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't wrap buffer")
/* Get a pointer to a buffer that's large enough for element */
- if(NULL == (elem_ptr = H5WB_actual_clear(elem_wb, dst_type_size)))
+ if (NULL == (elem_ptr = H5WB_actual_clear(elem_wb, dst_type_size)))
HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't get actual buffer")
/* Fill the selection in the memory buffer */
- if(H5S_select_fill(elem_ptr, dst_type_size, space, buf) < 0)
+ if (H5S_select_fill(elem_ptr, dst_type_size, space, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed")
} /* end if */
else {
- H5T_path_t *tpath; /* Conversion path information */
- size_t src_type_size; /* Size of source type */
- size_t buf_size; /* Desired buffer size */
+ H5T_path_t *tpath; /* Conversion path information */
+ size_t src_type_size; /* Size of source type */
+ size_t buf_size; /* Desired buffer size */
/* Get the file datatype size */
src_type_size = H5T_get_size(fill_type);
@@ -232,15 +221,15 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
buf_size = MAX(src_type_size, dst_type_size);
/* Set up type conversion function */
- if(NULL == (tpath = H5T_path_find(fill_type, buf_type)))
+ if (NULL == (tpath = H5T_path_find(fill_type, buf_type)))
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype")
/* Construct source & destination datatype IDs, if we will need them */
- if(!H5T_path_noop(tpath)) {
- if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(fill_type, H5T_COPY_ALL), FALSE)) < 0)
+ if (!H5T_path_noop(tpath)) {
+ if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(fill_type, H5T_COPY_ALL), FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion")
- if((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(buf_type, H5T_COPY_ALL), FALSE)) < 0)
+ if ((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(buf_type, H5T_COPY_ALL), FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion")
} /* end if */
@@ -248,55 +237,58 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
* then do conversion on each element so that each of them has a copy
* of the VL data.
*/
- if(TRUE == H5T_detect_class(fill_type, H5T_VLEN, FALSE)) {
- hsize_t nelmts; /* Number of data elements */
+ if (TRUE == H5T_detect_class(fill_type, H5T_VLEN, FALSE)) {
+ hsize_t nelmts; /* Number of data elements */
/* Get the number of elements in the selection */
nelmts = H5S_GET_SELECT_NPOINTS(space);
H5_CHECK_OVERFLOW(nelmts, hsize_t, size_t);
/* Allocate a temporary buffer */
- if(NULL == (tmp_buf = H5FL_BLK_MALLOC(type_conv, (size_t)nelmts * buf_size)))
+ if (NULL == (tmp_buf = H5FL_BLK_MALLOC(type_conv, (size_t)nelmts * buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Allocate a background buffer, if necessary */
- if(H5T_path_bkg(tpath) && NULL == (bkg_buf = H5FL_BLK_CALLOC(type_conv, (size_t)nelmts * buf_size)))
+ if (H5T_path_bkg(tpath) &&
+ NULL == (bkg_buf = H5FL_BLK_CALLOC(type_conv, (size_t)nelmts * buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Replicate the file's fill value into the temporary buffer */
H5VM_array_fill(tmp_buf, fill, src_type_size, (size_t)nelmts);
/* Convert from file's fill value into memory form */
- if(H5T_convert(tpath, src_id, dst_id, (size_t)nelmts, (size_t)0, (size_t)0, tmp_buf, bkg_buf) < 0)
+ if (H5T_convert(tpath, src_id, dst_id, (size_t)nelmts, (size_t)0, (size_t)0, tmp_buf, bkg_buf) <
+ 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed")
/* Allocate the chunk selection iterator */
- if(NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory selection iterator")
/* Create a selection iterator for scattering the elements to memory buffer */
- if(H5S_select_iter_init(mem_iter, space, dst_type_size, 0) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
+ if (H5S_select_iter_init(mem_iter, space, dst_type_size, 0) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to initialize memory selection information")
mem_iter_init = TRUE;
/* Scatter the data into memory */
- if(H5D__scatter_mem(tmp_buf, mem_iter, (size_t)nelmts, buf/*out*/) < 0)
+ if (H5D__scatter_mem(tmp_buf, mem_iter, (size_t)nelmts, buf /*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
} /* end if */
else {
- const uint8_t *fill_buf; /* Buffer to use for writing fill values */
+ const uint8_t *fill_buf; /* Buffer to use for writing fill values */
/* Convert disk buffer into memory buffer */
- if(!H5T_path_noop(tpath)) {
- void *elem_ptr; /* Pointer to element to use for fill value */
- void *bkg_ptr = NULL; /* Pointer to background element to use for fill value */
+ if (!H5T_path_noop(tpath)) {
+ void *elem_ptr; /* Pointer to element to use for fill value */
+ void *bkg_ptr = NULL; /* Pointer to background element to use for fill value */
/* Wrap the local buffer for elements */
- if(NULL == (elem_wb = H5WB_wrap(elem_buf, sizeof(elem_buf))))
+ if (NULL == (elem_wb = H5WB_wrap(elem_buf, sizeof(elem_buf))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't wrap buffer")
/* Get a pointer to a buffer that's large enough for element */
- if(NULL == (elem_ptr = H5WB_actual(elem_wb, buf_size)))
+ if (NULL == (elem_ptr = H5WB_actual(elem_wb, buf_size)))
HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't get actual buffer")
/* Copy the user's data into the buffer for conversion */
@@ -304,18 +296,19 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
/* If there's no VL type of data, do conversion first then fill the data into
* the memory buffer. */
- if(H5T_path_bkg(tpath)) {
+ if (H5T_path_bkg(tpath)) {
/* Wrap the local buffer for background elements */
- if(NULL == (bkg_elem_wb = H5WB_wrap(bkg_elem_buf, sizeof(bkg_elem_buf))))
+ if (NULL == (bkg_elem_wb = H5WB_wrap(bkg_elem_buf, sizeof(bkg_elem_buf))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't wrap buffer")
/* Get a pointer to a buffer that's large enough for element */
- if(NULL == (bkg_ptr = H5WB_actual_clear(bkg_elem_wb, buf_size)))
+ if (NULL == (bkg_ptr = H5WB_actual_clear(bkg_elem_wb, buf_size)))
HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't get actual buffer")
} /* end if */
/* Perform datatype conversion */
- if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, elem_ptr, bkg_ptr) < 0)
+ if (H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, elem_ptr, bkg_ptr) <
+ 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed")
/* Point at element buffer */
@@ -325,33 +318,32 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
fill_buf = (const uint8_t *)fill;
/* Fill the selection in the memory buffer */
- if(H5S_select_fill(fill_buf, dst_type_size, space, buf) < 0)
+ if (H5S_select_fill(fill_buf, dst_type_size, space, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed")
} /* end else */
- } /* end else */
+ } /* end else */
done:
- if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- if(mem_iter)
+ if (mem_iter)
mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter);
- if(src_id != (-1) && H5I_dec_ref(src_id) < 0)
+ if (src_id != (-1) && H5I_dec_ref(src_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
- if(dst_id != (-1) && H5I_dec_ref(dst_id) < 0)
+ if (dst_id != (-1) && H5I_dec_ref(dst_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
- if(tmp_buf)
+ if (tmp_buf)
tmp_buf = H5FL_BLK_FREE(type_conv, tmp_buf);
- if(elem_wb && H5WB_unwrap(elem_wb) < 0)
+ if (elem_wb && H5WB_unwrap(elem_wb) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer")
- if(bkg_elem_wb && H5WB_unwrap(bkg_elem_wb) < 0)
+ if (bkg_elem_wb && H5WB_unwrap(bkg_elem_wb) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer")
- if(bkg_buf)
+ if (bkg_buf)
bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__fill() */
-
/*-------------------------------------------------------------------------
* Function: H5D__fill_init
*
@@ -365,13 +357,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf,
- H5MM_allocate_t alloc_func, void *alloc_info,
- H5MM_free_t free_func, void *free_info,
- const H5O_fill_t *fill, const H5T_t *dset_type, hid_t dset_type_id,
- size_t total_nelmts, size_t max_buf_size)
+H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocate_t alloc_func,
+ void *alloc_info, H5MM_free_t free_func, void *free_info, const H5O_fill_t *fill,
+ const H5T_t *dset_type, hid_t dset_type_id, size_t total_nelmts, size_t max_buf_size)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -385,29 +375,29 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf,
HDmemset(fb_info, 0, sizeof(*fb_info));
/* Cache constant information from the dataset */
- fb_info->fill = fill;
- fb_info->file_type = dset_type;
- fb_info->file_tid = dset_type_id;
+ fb_info->fill = fill;
+ fb_info->file_type = dset_type;
+ fb_info->file_tid = dset_type_id;
fb_info->fill_alloc_func = alloc_func;
fb_info->fill_alloc_info = alloc_info;
- fb_info->fill_free_func = free_func;
- fb_info->fill_free_info = free_info;
+ fb_info->fill_free_func = free_func;
+ fb_info->fill_free_info = free_info;
/* Fill the buffer with the user's fill value */
- if(fill->buf) {
- htri_t has_vlen_type; /* Whether the datatype has a VL component */
+ if (fill->buf) {
+ htri_t has_vlen_type; /* Whether the datatype has a VL component */
/* Detect whether the datatype has a VL component */
- if((has_vlen_type = H5T_detect_class(dset_type, H5T_VLEN, FALSE)) < 0)
+ if ((has_vlen_type = H5T_detect_class(dset_type, H5T_VLEN, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to detect vlen datatypes?")
fb_info->has_vlen_fill_type = (hbool_t)has_vlen_type;
/* If necessary, convert fill value datatypes (which copies VL components, etc.) */
- if(fb_info->has_vlen_fill_type) {
+ if (fb_info->has_vlen_fill_type) {
/* Create temporary datatype for conversion operation */
- if(NULL == (fb_info->mem_type = H5T_copy(dset_type, H5T_COPY_TRANSIENT)))
+ if (NULL == (fb_info->mem_type = H5T_copy(dset_type, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy file datatype")
- if((fb_info->mem_tid = H5I_register(H5I_DATATYPE, fb_info->mem_type, FALSE)) < 0)
+ if ((fb_info->mem_tid = H5I_register(H5I_DATATYPE, fb_info->mem_type, FALSE)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype")
/* Retrieve sizes of memory & file datatypes */
@@ -420,7 +410,7 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf,
fb_info->max_elmt_size = MAX(fb_info->mem_elmt_size, fb_info->file_elmt_size);
/* Compute the number of elements that fit within a buffer to write */
- if(total_nelmts > 0)
+ if (total_nelmts > 0)
fb_info->elmts_per_buf = MIN(total_nelmts, MAX(1, (max_buf_size / fb_info->max_elmt_size)));
else
fb_info->elmts_per_buf = max_buf_size / fb_info->max_elmt_size;
@@ -430,48 +420,50 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf,
fb_info->fill_buf_size = MIN(max_buf_size, (fb_info->elmts_per_buf * fb_info->max_elmt_size));
/* Allocate fill buffer */
- if(caller_fill_buf) {
- fb_info->fill_buf = caller_fill_buf;
+ if (caller_fill_buf) {
+ fb_info->fill_buf = caller_fill_buf;
fb_info->use_caller_fill_buf = TRUE;
} /* end if */
else {
- if(alloc_func)
+ if (alloc_func)
fb_info->fill_buf = alloc_func(fb_info->fill_buf_size, alloc_info);
else
fb_info->fill_buf = H5FL_BLK_MALLOC(non_zero_fill, fb_info->fill_buf_size);
- if(NULL == fb_info->fill_buf)
+ if (NULL == fb_info->fill_buf)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer")
} /* end else */
/* Get the datatype conversion path for this operation */
- if(NULL == (fb_info->fill_to_mem_tpath = H5T_path_find(dset_type, fb_info->mem_type)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
+ if (NULL == (fb_info->fill_to_mem_tpath = H5T_path_find(dset_type, fb_info->mem_type)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
+ "unable to convert between src and dst datatypes")
/* Get the inverse datatype conversion path for this operation */
- if(NULL == (fb_info->mem_to_dset_tpath = H5T_path_find(fb_info->mem_type, dset_type)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
+ if (NULL == (fb_info->mem_to_dset_tpath = H5T_path_find(fb_info->mem_type, dset_type)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
+ "unable to convert between src and dst datatypes")
/* Check if we need to allocate a background buffer */
- if(H5T_path_bkg(fb_info->fill_to_mem_tpath) || H5T_path_bkg(fb_info->mem_to_dset_tpath)) {
+ if (H5T_path_bkg(fb_info->fill_to_mem_tpath) || H5T_path_bkg(fb_info->mem_to_dset_tpath)) {
/* Check for inverse datatype conversion needing a background buffer */
/* (do this first, since it needs a larger buffer) */
- if(H5T_path_bkg(fb_info->mem_to_dset_tpath))
+ if (H5T_path_bkg(fb_info->mem_to_dset_tpath))
fb_info->bkg_buf_size = fb_info->elmts_per_buf * fb_info->max_elmt_size;
else
fb_info->bkg_buf_size = fb_info->max_elmt_size;
/* Allocate the background buffer */
- if(NULL == (fb_info->bkg_buf = H5FL_BLK_MALLOC(type_conv, fb_info->bkg_buf_size)))
+ if (NULL == (fb_info->bkg_buf = H5FL_BLK_MALLOC(type_conv, fb_info->bkg_buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
} /* end if */
- } /* end if */
+ } /* end if */
else {
/* If fill value is not library default, use it to set the element size */
HDassert(fill->size >= 0);
fb_info->max_elmt_size = fb_info->file_elmt_size = fb_info->mem_elmt_size = (size_t)fill->size;
/* Compute the number of elements that fit within a buffer to write */
- if(total_nelmts > 0)
+ if (total_nelmts > 0)
fb_info->elmts_per_buf = MIN(total_nelmts, MAX(1, (max_buf_size / fb_info->max_elmt_size)));
else
fb_info->elmts_per_buf = max_buf_size / fb_info->max_elmt_size;
@@ -481,30 +473,30 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf,
fb_info->fill_buf_size = MIN(max_buf_size, fb_info->elmts_per_buf * fb_info->max_elmt_size);
/* Allocate temporary buffer */
- if(caller_fill_buf) {
- fb_info->fill_buf = caller_fill_buf;
+ if (caller_fill_buf) {
+ fb_info->fill_buf = caller_fill_buf;
fb_info->use_caller_fill_buf = TRUE;
} /* end if */
else {
- if(alloc_func)
+ if (alloc_func)
fb_info->fill_buf = alloc_func(fb_info->fill_buf_size, alloc_info);
else
fb_info->fill_buf = H5FL_BLK_MALLOC(non_zero_fill, fb_info->fill_buf_size);
- if(NULL == fb_info->fill_buf)
+ if (NULL == fb_info->fill_buf)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer")
} /* end else */
/* Replicate the fill value into the cached buffer */
H5VM_array_fill(fb_info->fill_buf, fill->buf, fb_info->max_elmt_size, fb_info->elmts_per_buf);
- } /* end else */
- } /* end if */
- else { /* Fill the buffer with the default fill value */
+ } /* end else */
+ } /* end if */
+ else { /* Fill the buffer with the default fill value */
/* Retrieve size of elements */
fb_info->max_elmt_size = fb_info->file_elmt_size = fb_info->mem_elmt_size = H5T_get_size(dset_type);
HDassert(fb_info->max_elmt_size > 0);
/* Compute the number of elements that fit within a buffer to write */
- if(total_nelmts > 0)
+ if (total_nelmts > 0)
fb_info->elmts_per_buf = MIN(total_nelmts, MAX(1, (max_buf_size / fb_info->max_elmt_size)));
else
fb_info->elmts_per_buf = max_buf_size / fb_info->max_elmt_size;
@@ -514,43 +506,44 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf,
fb_info->fill_buf_size = MIN(max_buf_size, (fb_info->elmts_per_buf * fb_info->max_elmt_size));
/* Use (and zero) caller's buffer, if provided */
- if(caller_fill_buf) {
- fb_info->fill_buf = caller_fill_buf;
+ if (caller_fill_buf) {
+ fb_info->fill_buf = caller_fill_buf;
fb_info->use_caller_fill_buf = TRUE;
HDmemset(fb_info->fill_buf, 0, fb_info->fill_buf_size);
} /* end if */
else {
- if(alloc_func) {
+ if (alloc_func) {
fb_info->fill_buf = alloc_func(fb_info->fill_buf_size, alloc_info);
HDmemset(fb_info->fill_buf, 0, fb_info->fill_buf_size);
} /* end if */
else {
- htri_t buf_avail = H5FL_BLK_AVAIL(zero_fill, fb_info->fill_buf_size); /* Check if there is an already zeroed out buffer available */
+ htri_t buf_avail = H5FL_BLK_AVAIL(
+ zero_fill,
+ fb_info->fill_buf_size); /* Check if there is an already zeroed out buffer available */
HDassert(buf_avail != FAIL);
/* Allocate temporary buffer (zeroing it if no buffer is available) */
- if(!buf_avail)
+ if (!buf_avail)
fb_info->fill_buf = H5FL_BLK_CALLOC(zero_fill, fb_info->fill_buf_size);
else
fb_info->fill_buf = H5FL_BLK_MALLOC(zero_fill, fb_info->fill_buf_size);
} /* end else */
- if(fb_info->fill_buf == NULL)
+ if (fb_info->fill_buf == NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer")
} /* end else */
- } /* end else */
+ } /* end else */
done:
/* Cleanup on error */
- if(ret_value < 0)
- if(H5D__fill_term(fb_info) < 0)
+ if (ret_value < 0)
+ if (H5D__fill_term(fb_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__fill_init() */
-
/*-------------------------------------------------------------------------
* Function: H5D__fill_refill_vl
*
@@ -566,8 +559,8 @@ done:
herr_t
H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts)
{
- herr_t ret_value = SUCCEED; /* Return value */
- void * buf = NULL; /* Temporary fill buffer */
+ herr_t ret_value = SUCCEED; /* Return value */
+ void * buf = NULL; /* Temporary fill buffer */
FUNC_ENTER_PACKAGE
@@ -580,49 +573,52 @@ H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts)
H5MM_memcpy(fb_info->fill_buf, fb_info->fill->buf, fb_info->file_elmt_size);
/* Reset first element of background buffer, if necessary */
- if(H5T_path_bkg(fb_info->fill_to_mem_tpath))
+ if (H5T_path_bkg(fb_info->fill_to_mem_tpath))
HDmemset(fb_info->bkg_buf, 0, fb_info->max_elmt_size);
/* Type convert the dataset buffer, to copy any VL components */
- if(H5T_convert(fb_info->fill_to_mem_tpath, fb_info->file_tid, fb_info->mem_tid, (size_t)1, (size_t)0, (size_t)0, fb_info->fill_buf, fb_info->bkg_buf) < 0)
+ if (H5T_convert(fb_info->fill_to_mem_tpath, fb_info->file_tid, fb_info->mem_tid, (size_t)1, (size_t)0,
+ (size_t)0, fb_info->fill_buf, fb_info->bkg_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed")
/* Replicate the fill value into the cached buffer */
- if(nelmts > 1)
- H5VM_array_fill((void *)((unsigned char *)fb_info->fill_buf + fb_info->mem_elmt_size), fb_info->fill_buf, fb_info->mem_elmt_size, (nelmts - 1));
+ if (nelmts > 1)
+ H5VM_array_fill((void *)((unsigned char *)fb_info->fill_buf + fb_info->mem_elmt_size),
+ fb_info->fill_buf, fb_info->mem_elmt_size, (nelmts - 1));
/* Reset the entire background buffer, if necessary */
- if(H5T_path_bkg(fb_info->mem_to_dset_tpath))
+ if (H5T_path_bkg(fb_info->mem_to_dset_tpath))
HDmemset(fb_info->bkg_buf, 0, fb_info->bkg_buf_size);
/* Make a copy of the fill buffer so we can free dynamic elements after conversion */
- if(fb_info->fill_alloc_func)
+ if (fb_info->fill_alloc_func)
buf = fb_info->fill_alloc_func(fb_info->fill_buf_size, fb_info->fill_alloc_info);
else
buf = H5FL_BLK_MALLOC(non_zero_fill, fb_info->fill_buf_size);
- if(!buf)
+ if (!buf)
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary fill buffer")
H5MM_memcpy(buf, fb_info->fill_buf, fb_info->fill_buf_size);
/* Type convert the dataset buffer, to copy any VL components */
- if(H5T_convert(fb_info->mem_to_dset_tpath, fb_info->mem_tid, fb_info->file_tid, nelmts, (size_t)0, (size_t)0, fb_info->fill_buf, fb_info->bkg_buf) < 0)
+ if (H5T_convert(fb_info->mem_to_dset_tpath, fb_info->mem_tid, fb_info->file_tid, nelmts, (size_t)0,
+ (size_t)0, fb_info->fill_buf, fb_info->bkg_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed")
done:
- if(buf) {
+ if (buf) {
/* Free dynamically allocated VL elements in fill buffer */
- if(fb_info->fill->type) {
- if(H5T_vlen_reclaim_elmt(buf, fb_info->fill->type) < 0)
+ if (fb_info->fill->type) {
+ if (H5T_vlen_reclaim_elmt(buf, fb_info->fill->type) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't reclaim vlen element")
} /* end if */
else {
- if(H5T_vlen_reclaim_elmt(buf, fb_info->mem_type) < 0)
+ if (H5T_vlen_reclaim_elmt(buf, fb_info->mem_type) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't reclaim vlen element")
} /* end else */
/* Free temporary fill buffer */
- if(fb_info->fill_free_func)
+ if (fb_info->fill_free_func)
fb_info->fill_free_func(buf, fb_info->fill_free_info);
else
buf = H5FL_BLK_FREE(non_zero_fill, buf);
@@ -631,7 +627,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__fill_refill_vl() */
-
/*-------------------------------------------------------------------------
* Function: H5D__fill_release
*
@@ -654,11 +649,11 @@ H5D__fill_release(H5D_fill_buf_info_t *fb_info)
HDassert(fb_info->fill);
/* Free the buffer for fill values */
- if(!fb_info->use_caller_fill_buf && fb_info->fill_buf) {
- if(fb_info->fill_free_func)
+ if (!fb_info->use_caller_fill_buf && fb_info->fill_buf) {
+ if (fb_info->fill_free_func)
fb_info->fill_free_func(fb_info->fill_buf, fb_info->fill_free_info);
else {
- if(fb_info->fill->buf)
+ if (fb_info->fill->buf)
fb_info->fill_buf = H5FL_BLK_FREE(non_zero_fill, fb_info->fill_buf);
else
fb_info->fill_buf = H5FL_BLK_FREE(zero_fill, fb_info->fill_buf);
@@ -669,7 +664,6 @@ H5D__fill_release(H5D_fill_buf_info_t *fb_info)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__fill_release() */
-
/*-------------------------------------------------------------------------
* Function: H5D__fill_term
*
@@ -694,15 +688,14 @@ H5D__fill_term(H5D_fill_buf_info_t *fb_info)
H5D__fill_release(fb_info);
/* Free other resources for vlen fill values */
- if(fb_info->has_vlen_fill_type) {
- if(fb_info->mem_tid > 0)
+ if (fb_info->has_vlen_fill_type) {
+ if (fb_info->mem_tid > 0)
H5I_dec_ref(fb_info->mem_tid);
- else if(fb_info->mem_type)
+ else if (fb_info->mem_type)
(void)H5T_close_real(fb_info->mem_type);
- if(fb_info->bkg_buf)
+ if (fb_info->bkg_buf)
fb_info->bkg_buf = H5FL_BLK_FREE(type_conv, fb_info->bkg_buf);
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__fill_term() */
-
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 6e247fc..7a2b93b 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -15,30 +15,27 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5FOprivate.h" /* File objects */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5VLprivate.h" /* Virtual Object Layer */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5FOprivate.h" /* File objects */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
@@ -46,60 +43,57 @@
/* Shared data structure for computing variable-length dataset's total size */
/* (Used for both native and generic 'get vlen buf size' operation) */
typedef struct {
- void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */
- void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */
- size_t vl_tbuf_size; /* Current size of the temp. buffer for VL data */
- hsize_t size; /* Accumulated number of bytes for the selection */
+ void * fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */
+ void * vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */
+ size_t vl_tbuf_size; /* Current size of the temp. buffer for VL data */
+ hsize_t size; /* Accumulated number of bytes for the selection */
} H5D_vlen_bufsize_common_t;
/* Internal data structure for computing variable-length dataset's total size */
/* (Used for native 'get vlen buf size' operation) */
typedef struct {
- H5D_t *dset; /* Dataset for operation */
- H5S_t *fspace; /* Dataset's dataspace for operation */
- H5S_t *mspace; /* Memory dataspace for operation */
- H5D_vlen_bufsize_common_t common; /* VL data buffers & accumulatd size */
+ H5D_t * dset; /* Dataset for operation */
+ H5S_t * fspace; /* Dataset's dataspace for operation */
+ H5S_t * mspace; /* Memory dataspace for operation */
+ H5D_vlen_bufsize_common_t common; /* VL data buffers & accumulatd size */
} H5D_vlen_bufsize_native_t;
/* Internal data structure for computing variable-length dataset's total size */
/* (Used for generic 'get vlen buf size' operation) */
typedef struct {
- H5VL_object_t *dset_vol_obj; /* VOL object for the dataset */
- hid_t fspace_id; /* Dataset dataspace ID of the dataset we are working on */
- H5S_t *fspace; /* Dataset's dataspace for operation */
- hid_t mspace_id; /* Memory dataspace ID of the dataset we are working on */
- hid_t dxpl_id; /* Dataset transfer property list to pass to dataset read */
- H5D_vlen_bufsize_common_t common; /* VL data buffers & accumulatd size */
+ H5VL_object_t * dset_vol_obj; /* VOL object for the dataset */
+ hid_t fspace_id; /* Dataset dataspace ID of the dataset we are working on */
+ H5S_t * fspace; /* Dataset's dataspace for operation */
+ hid_t mspace_id; /* Memory dataspace ID of the dataset we are working on */
+ hid_t dxpl_id; /* Dataset transfer property list to pass to dataset read */
+ H5D_vlen_bufsize_common_t common; /* VL data buffers & accumulatd size */
} H5D_vlen_bufsize_generic_t;
-
/********************/
/* Local Prototypes */
/********************/
/* General stuff */
static H5D_shared_t *H5D__new(hid_t dcpl_id, hid_t dapl_id, hbool_t creating, hbool_t vl_type);
-static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type);
-static herr_t H5D__cache_dataspace_info(const H5D_t *dset);
-static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space);
-static herr_t H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id);
+static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type);
+static herr_t H5D__cache_dataspace_info(const H5D_t *dset);
+static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space);
+static herr_t H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id);
static herr_t H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char **file_prefix);
static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id);
-static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite,
- hsize_t old_dim[]);
+static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]);
static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id);
static herr_t H5D__close_cb(H5VL_object_t *dset_vol_obj);
static herr_t H5D__use_minimized_dset_headers(H5F_t *file, hbool_t *minimize);
static herr_t H5D__prepare_minimized_oh(H5F_t *file, H5D_t *dset, H5O_loc_t *oloc);
static size_t H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr);
-static void *H5D__vlen_get_buf_size_alloc(size_t size, void *info);
-static herr_t H5D__vlen_get_buf_size_cb(void *elem, hid_t type_id, unsigned ndim,
- const hsize_t *point, void *op_data);
-static herr_t H5D__vlen_get_buf_size_gen_cb(void *elem, hid_t type_id, unsigned ndim,
- const hsize_t *point, void *op_data);
+static void * H5D__vlen_get_buf_size_alloc(size_t size, void *info);
+static herr_t H5D__vlen_get_buf_size_cb(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point,
+ void *op_data);
+static herr_t H5D__vlen_get_buf_size_gen_cb(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point,
+ void *op_data);
static herr_t H5D__check_filters(H5D_t *dataset);
-
/*********************/
/* Package Variables */
/*********************/
@@ -110,12 +104,10 @@ H5FL_BLK_DEFINE(vlen_vl_buf);
/* Declare a free list to manage other blocks of VL data */
H5FL_BLK_DEFINE(vlen_fl_buf);
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -141,10 +133,10 @@ H5_GCC_DIAG_ON("larger-than=")
/* Dataset ID class */
static const H5I_class_t H5I_DATASET_CLS[1] = {{
- H5I_DATASET, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
- (H5I_free_t)H5D__close_cb /* Callback routine for closing objects of this class */
+ H5I_DATASET, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5D__close_cb /* Callback routine for closing objects of this class */
}};
/* Flag indicating "top" of interface has been initialized */
@@ -155,7 +147,6 @@ static hbool_t H5D_top_package_initialize_s = FALSE;
static const char *H5D_prefix_ext_env = NULL;
static const char *H5D_prefix_vds_env = NULL;
-
/*-------------------------------------------------------------------------
* Function: H5D_init
*
@@ -169,7 +160,7 @@ static const char *H5D_prefix_vds_env = NULL;
herr_t
H5D_init(void)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* FUNC_ENTER() does all the work */
@@ -178,7 +169,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_init() */
-
/*--------------------------------------------------------------------------
NAME
H5D__init_package -- Initialize interface-specific information
@@ -197,13 +187,13 @@ NOTES
herr_t
H5D__init_package(void)
{
- H5P_genplist_t *def_dcpl; /* Default Dataset Creation Property list */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *def_dcpl; /* Default Dataset Creation Property list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Initialize the atom group for the dataset IDs */
- if(H5I_register_type(H5I_DATASET_CLS) < 0)
+ if (H5I_register_type(H5I_DATASET_CLS) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* Reset the "default dataset" information */
@@ -215,19 +205,19 @@ H5D__init_package(void)
/* Get the default dataset creation property list values and initialize the
* default dataset with them.
*/
- if(NULL == (def_dcpl = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_CREATE_ID_g)))
+ if (NULL == (def_dcpl = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_CREATE_ID_g)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get default dataset creation property list")
/* Get the default data storage layout */
- if(H5P_get(def_dcpl, H5D_CRT_LAYOUT_NAME, &H5D_def_dset.layout) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout")
+ if (H5P_get(def_dcpl, H5D_CRT_LAYOUT_NAME, &H5D_def_dset.layout) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout")
/* Get the default dataset creation properties */
- if(H5P_get(def_dcpl, H5D_CRT_EXT_FILE_LIST_NAME, &H5D_def_dset.dcpl_cache.efl) < 0)
+ if (H5P_get(def_dcpl, H5D_CRT_EXT_FILE_LIST_NAME, &H5D_def_dset.dcpl_cache.efl) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve external file list")
- if(H5P_get(def_dcpl, H5D_CRT_FILL_VALUE_NAME, &H5D_def_dset.dcpl_cache.fill) < 0)
+ if (H5P_get(def_dcpl, H5D_CRT_FILL_VALUE_NAME, &H5D_def_dset.dcpl_cache.fill) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill value")
- if(H5P_get(def_dcpl, H5O_CRT_PIPELINE_NAME, &H5D_def_dset.dcpl_cache.pline) < 0)
+ if (H5P_get(def_dcpl, H5O_CRT_PIPELINE_NAME, &H5D_def_dset.dcpl_cache.pline) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter")
/* Mark "top" of interface as initialized, too */
@@ -241,7 +231,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__init_package() */
-
/*-------------------------------------------------------------------------
* Function: H5D_top_term_package
*
@@ -255,12 +244,12 @@ done:
int
H5D_top_term_package(void)
{
- int n = 0;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(H5D_top_package_initialize_s) {
- if(H5I_nmembers(H5I_DATASET) > 0) {
+ if (H5D_top_package_initialize_s) {
+ if (H5I_nmembers(H5I_DATASET) > 0) {
/* The dataset API uses the "force" flag set to true because it
* is using the "file objects" (H5FO) API functions to track open
* objects in the file. Using the H5FO code means that dataset
@@ -285,17 +274,16 @@ H5D_top_term_package(void)
*/
(void)H5I_clear_type(H5I_DATASET, TRUE, FALSE);
n++; /*H5I*/
- } /* end if */
+ } /* end if */
/* Mark closed */
- if(0 == n)
+ if (0 == n)
H5D_top_package_initialize_s = FALSE;
} /* end if */
FUNC_LEAVE_NOAPI(n)
} /* end H5D_top_term_package() */
-
/*-------------------------------------------------------------------------
* Function: H5D_term_package
*
@@ -312,11 +300,11 @@ H5D_top_term_package(void)
int
H5D_term_package(void)
{
- int n = 0;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(H5_PKG_INIT_VAR) {
+ if (H5_PKG_INIT_VAR) {
/* Sanity checks */
HDassert(0 == H5I_nmembers(H5I_DATASET));
HDassert(FALSE == H5D_top_package_initialize_s);
@@ -325,14 +313,13 @@ H5D_term_package(void)
n += (H5I_dec_type_ref(H5I_DATASET) > 0);
/* Mark closed */
- if(0 == n)
+ if (0 == n)
H5_PKG_INIT_VAR = FALSE;
} /* end if */
FUNC_LEAVE_NOAPI(n)
} /* end H5D_term_package() */
-
/*-------------------------------------------------------------------------
* Function: H5D__close_cb
*
@@ -345,7 +332,7 @@ H5D_term_package(void)
static herr_t
H5D__close_cb(H5VL_object_t *dset_vol_obj)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -353,7 +340,7 @@ H5D__close_cb(H5VL_object_t *dset_vol_obj)
HDassert(dset_vol_obj);
/* Close the dataset */
- if(H5VL_dataset_close(dset_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5VL_dataset_close(dset_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset");
done:
@@ -363,13 +350,12 @@ done:
*/
/* Free the VOL object */
- if(H5VL_free_object(dset_vol_obj) < 0)
+ if (H5VL_free_object(dset_vol_obj) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object");
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__close_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__create_named
*
@@ -381,12 +367,12 @@ done:
*-------------------------------------------------------------------------
*/
H5D_t *
-H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id,
- const H5S_t *space, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id)
+H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, const H5S_t *space, hid_t lcpl_id,
+ hid_t dcpl_id, hid_t dapl_id)
{
- H5O_obj_create_t ocrt_info; /* Information for object creation */
- H5D_obj_create_t dcrt_info; /* Information for dataset creation */
- H5D_t *ret_value = NULL; /* Return value */
+ H5O_obj_create_t ocrt_info; /* Information for object creation */
+ H5D_obj_create_t dcrt_info; /* Information for dataset creation */
+ H5D_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -401,17 +387,17 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id,
/* Set up dataset creation info */
dcrt_info.type_id = type_id;
- dcrt_info.space = space;
+ dcrt_info.space = space;
dcrt_info.dcpl_id = dcpl_id;
dcrt_info.dapl_id = dapl_id;
/* Set up object creation information */
ocrt_info.obj_type = H5O_TYPE_DATASET;
ocrt_info.crt_info = &dcrt_info;
- ocrt_info.new_obj = NULL;
+ ocrt_info.new_obj = NULL;
/* Create the new dataset and link it to its parent group */
- if(H5L_link_object(loc, name, &ocrt_info, lcpl_id) < 0)
+ if (H5L_link_object(loc, name, &ocrt_info, lcpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create and link to dataset")
HDassert(ocrt_info.new_obj);
@@ -422,7 +408,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_named() */
-
/*-------------------------------------------------------------------------
* Function: H5D__get_space_status
*
@@ -436,48 +421,48 @@ done:
herr_t
H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
HDassert(dset);
/* Check for chunked layout */
- if(dset->shared->layout.type == H5D_CHUNKED) {
- hsize_t space_allocated; /* The number of bytes allocated for chunks */
- hssize_t snelmts; /* Temporary holder for number of elements in dataspace */
- hsize_t nelmts; /* Number of elements in dataspace */
- size_t dt_size; /* Size of datatype */
- hsize_t full_size; /* The number of bytes in the dataset when fully populated */
+ if (dset->shared->layout.type == H5D_CHUNKED) {
+ hsize_t space_allocated; /* The number of bytes allocated for chunks */
+ hssize_t snelmts; /* Temporary holder for number of elements in dataspace */
+ hsize_t nelmts; /* Number of elements in dataspace */
+ size_t dt_size; /* Size of datatype */
+ hsize_t full_size; /* The number of bytes in the dataset when fully populated */
/* For chunked layout set the space status by the storage size */
/* Get the dataset's dataspace */
HDassert(dset->shared->space);
/* Get the total number of elements in dataset's dataspace */
- if((snelmts = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0)
+ if ((snelmts = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve number of elements in dataspace")
nelmts = (hsize_t)snelmts;
/* Get the size of the dataset's datatype */
- if(0 == (dt_size = H5T_GET_SIZE(dset->shared->type)))
+ if (0 == (dt_size = H5T_GET_SIZE(dset->shared->type)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of datatype")
/* Compute the maximum size of the dataset in bytes */
full_size = nelmts * dt_size;
/* Check for overflow during multiplication */
- if(nelmts != (full_size / dt_size))
+ if (nelmts != (full_size / dt_size))
HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed")
/* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */
- if(H5D__get_storage_size(dset, &space_allocated) < 0)
+ if (H5D__get_storage_size(dset, &space_allocated) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage")
/* Decide on how much of the space is allocated */
- if(space_allocated == 0)
+ if (space_allocated == 0)
*allocation = H5D_SPACE_STATUS_NOT_ALLOCATED;
- else if(space_allocated == full_size)
+ else if (space_allocated == full_size)
*allocation = H5D_SPACE_STATUS_ALLOCATED;
else
*allocation = H5D_SPACE_STATUS_PART_ALLOCATED;
@@ -485,7 +470,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation)
else {
/* For non-chunked layouts set space status by result of is_space_alloc
* function */
- if(dset->shared->layout.ops->is_space_alloc(&dset->shared->layout.storage))
+ if (dset->shared->layout.ops->is_space_alloc(&dset->shared->layout.storage))
*allocation = H5D_SPACE_STATUS_ALLOCATED;
else
*allocation = H5D_SPACE_STATUS_NOT_ALLOCATED;
@@ -495,7 +480,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__get_space_status() */
-
/*-------------------------------------------------------------------------
* Function: H5D__new
*
@@ -508,14 +492,14 @@ done:
static H5D_shared_t *
H5D__new(hid_t dcpl_id, hid_t dapl_id, hbool_t creating, hbool_t vl_type)
{
- H5D_shared_t *new_dset = NULL; /* New dataset object */
- H5P_genplist_t *plist; /* Property list created */
- H5D_shared_t *ret_value = NULL; /* Return value */
+ H5D_shared_t * new_dset = NULL; /* New dataset object */
+ H5P_genplist_t *plist; /* Property list created */
+ H5D_shared_t * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
/* Allocate new shared dataset structure */
- if(NULL == (new_dset = H5FL_MALLOC(H5D_shared_t)))
+ if (NULL == (new_dset = H5FL_MALLOC(H5D_shared_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the default dataset information */
@@ -524,27 +508,27 @@ H5D__new(hid_t dcpl_id, hid_t dapl_id, hbool_t creating, hbool_t vl_type)
/* If we are using the default dataset creation property list, during creation
* don't bother to copy it, just increment the reference count
*/
- if(!vl_type && creating && dcpl_id == H5P_DATASET_CREATE_DEFAULT) {
- if(H5I_inc_ref(dcpl_id, FALSE) < 0)
+ if (!vl_type && creating && dcpl_id == H5P_DATASET_CREATE_DEFAULT) {
+ if (H5I_inc_ref(dcpl_id, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment default DCPL ID")
new_dset->dcpl_id = dcpl_id;
} /* end if */
else {
/* Get the property list */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
new_dset->dcpl_id = H5P_copy_plist(plist, FALSE);
} /* end else */
- if(!vl_type && creating && dapl_id == H5P_DATASET_ACCESS_DEFAULT) {
- if(H5I_inc_ref(dapl_id, FALSE) < 0)
+ if (!vl_type && creating && dapl_id == H5P_DATASET_ACCESS_DEFAULT) {
+ if (H5I_inc_ref(dapl_id, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment default DAPL ID")
new_dset->dapl_id = dapl_id;
} /* end if */
else {
/* Get the property list */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(dapl_id)))
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object(dapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
new_dset->dapl_id = H5P_copy_plist(plist, FALSE);
@@ -554,11 +538,11 @@ H5D__new(hid_t dcpl_id, hid_t dapl_id, hbool_t creating, hbool_t vl_type)
ret_value = new_dset;
done:
- if(ret_value == NULL)
- if(new_dset != NULL) {
- if(new_dset->dcpl_id != 0 && H5I_dec_ref(new_dset->dcpl_id) < 0)
+ if (ret_value == NULL)
+ if (new_dset != NULL) {
+ if (new_dset->dcpl_id != 0 && H5I_dec_ref(new_dset->dcpl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "can't decrement temporary datatype ID")
- if(new_dset->dapl_id != 0 && H5I_dec_ref(new_dset->dapl_id) < 0)
+ if (new_dset->dapl_id != 0 && H5I_dec_ref(new_dset->dapl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "can't decrement temporary datatype ID")
new_dset = H5FL_FREE(H5D_shared_t, new_dset);
} /* end if */
@@ -566,7 +550,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__new() */
-
/*-------------------------------------------------------------------------
* Function: H5D__init_type
*
@@ -580,10 +563,10 @@ done:
static herr_t
H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
{
- htri_t relocatable; /* Flag whether the type is relocatable */
- htri_t immutable; /* Flag whether the type is immutable */
- hbool_t use_at_least_v18; /* Flag indicating to use at least v18 format versions */
- herr_t ret_value = SUCCEED; /* Return value */
+ htri_t relocatable; /* Flag whether the type is relocatable */
+ htri_t immutable; /* Flag whether the type is immutable */
+ hbool_t use_at_least_v18; /* Flag indicating to use at least v18 format versions */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -593,55 +576,54 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
HDassert(type);
/* Check whether the datatype is relocatable */
- if((relocatable = H5T_is_relocatable(type)) < 0)
+ if ((relocatable = H5T_is_relocatable(type)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't check datatype?")
/* Check whether the datatype is immutable */
- if((immutable = H5T_is_immutable(type)) < 0)
+ if ((immutable = H5T_is_immutable(type)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't check datatype?")
/* To use at least v18 format versions or not */
use_at_least_v18 = (H5F_LOW_BOUND(file) >= H5F_LIBVER_V18);
/* Copy the datatype if it's a custom datatype or if it'll change when its location is changed */
- if(!immutable || relocatable || use_at_least_v18) {
+ if (!immutable || relocatable || use_at_least_v18) {
/* Copy datatype for dataset */
- if((dset->shared->type = H5T_copy(type, H5T_COPY_ALL)) == NULL)
+ if ((dset->shared->type = H5T_copy(type, H5T_COPY_ALL)) == NULL)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy datatype")
/* Convert a datatype (if committed) to a transient type if the committed datatype's file
* location is different from the file location where the dataset will be created.
*/
- if(H5T_convert_committed_datatype(dset->shared->type, file) < 0)
+ if (H5T_convert_committed_datatype(dset->shared->type, file) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info")
/* Mark any datatypes as being on disk now */
- if(H5T_set_loc(dset->shared->type, H5F_VOL_OBJ(file), H5T_LOC_DISK) < 0)
+ if (H5T_set_loc(dset->shared->type, H5F_VOL_OBJ(file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't set datatype location")
/* Set the version for datatype */
- if(H5T_set_version(file, dset->shared->type) < 0)
+ if (H5T_set_version(file, dset->shared->type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set version of datatype")
/* Get a datatype ID for the dataset's datatype */
- if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0)
+ if ((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
} /* end if */
/* Not a custom datatype, just use it directly */
else {
- if(H5I_inc_ref(type_id, FALSE) < 0)
+ if (H5I_inc_ref(type_id, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, FAIL, "Can't increment datatype ID")
/* Use existing datatype */
dset->shared->type_id = type_id;
- dset->shared->type = (H5T_t *)type; /* (Cast away const OK - QAK) */
- } /* end else */
+ dset->shared->type = (H5T_t *)type; /* (Cast away const OK - QAK) */
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__init_type() */
-
/*-------------------------------------------------------------------------
* Function: H5D__cache_dataspace_info
*
@@ -654,9 +636,9 @@ done:
static herr_t
H5D__cache_dataspace_info(const H5D_t *dset)
{
- int sndims; /* Signed number of dimensions of dataspace rank */
- unsigned u; /* Local index value */
- herr_t ret_value = SUCCEED; /* Return value */
+ int sndims; /* Signed number of dimensions of dataspace rank */
+ unsigned u; /* Local index value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -664,15 +646,16 @@ H5D__cache_dataspace_info(const H5D_t *dset)
HDassert(dset);
/* Cache info for dataset's dataspace */
- if((sndims = H5S_get_simple_extent_dims(dset->shared->space, dset->shared->curr_dims, dset->shared->max_dims)) < 0)
+ if ((sndims = H5S_get_simple_extent_dims(dset->shared->space, dset->shared->curr_dims,
+ dset->shared->max_dims)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't cache dataspace dimensions")
dset->shared->ndims = (unsigned)sndims;
/* Compute the initial 'power2up' values */
- for(u = 0; u < dset->shared->ndims; u++) {
- hsize_t scaled_power2up; /* Scaled value, rounded to next power of 2 */
+ for (u = 0; u < dset->shared->ndims; u++) {
+ hsize_t scaled_power2up; /* Scaled value, rounded to next power of 2 */
- if(!(scaled_power2up = H5VM_power2up(dset->shared->curr_dims[u])))
+ if (!(scaled_power2up = H5VM_power2up(dset->shared->curr_dims[u])))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2")
dset->shared->curr_power2up[u] = scaled_power2up;
}
@@ -681,7 +664,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__cache_dataspace_info() */
-
/*-------------------------------------------------------------------------
* Function: H5D__init_space
*
@@ -695,7 +677,7 @@ done:
static herr_t
H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -705,26 +687,25 @@ H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
HDassert(space);
/* Copy dataspace for dataset */
- if(NULL == (dset->shared->space = H5S_copy(space, FALSE, TRUE)))
+ if (NULL == (dset->shared->space = H5S_copy(space, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace")
/* Cache the dataset's dataspace info */
- if(H5D__cache_dataspace_info(dset) < 0)
+ if (H5D__cache_dataspace_info(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info")
/* Set the version for dataspace */
- if(H5S_set_version(file, dset->shared->space) < 0)
+ if (H5S_set_version(file, dset->shared->space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
/* Set the dataset's dataspace to 'all' selection */
- if(H5S_select_all(dset->shared->space, TRUE) < 0)
+ if (H5S_select_all(dset->shared->space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set all selection")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__init_space() */
-
/*-------------------------------------------------------------------------
* Function: H5D__use_minimized_dset_headers
*
@@ -742,7 +723,7 @@ done:
static herr_t
H5D__use_minimized_dset_headers(H5F_t *file, hbool_t *minimize)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -750,19 +731,19 @@ H5D__use_minimized_dset_headers(H5F_t *file, hbool_t *minimize)
HDassert(minimize);
/* Get the dataset object header minimize flag for this call */
- if(H5CX_get_dset_min_ohdr_flag(minimize) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset object header minimize flag from API context")
+ if (H5CX_get_dset_min_ohdr_flag(minimize) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't get dataset object header minimize flag from API context")
- if(FALSE == *minimize)
+ if (FALSE == *minimize)
*minimize = H5F_get_min_dset_ohdr(file);
done:
- if(FAIL == ret_value)
+ if (FAIL == ret_value)
*minimize = FALSE;
FUNC_LEAVE_NOAPI(ret_value);
} /* H5D__use_minimized_dset_headers */
-
/*-------------------------------------------------------------------------
* Function: H5D__calculate_minimium_header_size
*
@@ -778,7 +759,7 @@ done:
static size_t
H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr)
{
- H5T_t *type = NULL;
+ H5T_t * type = NULL;
H5O_fill_t *fill_prop = NULL;
hbool_t use_at_least_v18 = FALSE;
const char continuation[1] = ""; /* requred for work-around */
@@ -791,8 +772,8 @@ H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr)
HDassert(dset);
HDassert(ohdr);
- type = dset->shared->type;
- fill_prop = &(dset->shared->dcpl_cache.fill);
+ type = dset->shared->type;
+ fill_prop = &(dset->shared->dcpl_cache.fill);
use_at_least_v18 = (H5F_LOW_BOUND(file) >= H5F_LIBVER_V18);
/* Datatype message size */
@@ -829,7 +810,7 @@ H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr)
ret_value += get_value;
/* Fill Value (backwards compatability) message size */
- if(fill_prop->buf && !use_at_least_v18) {
+ if (fill_prop->buf && !use_at_least_v18) {
H5O_fill_t old_fill_prop; /* Copy for writing "old" fill value */
/* Shallow copy the fill value property */
@@ -841,14 +822,15 @@ H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr)
get_value = H5O_msg_size_oh(file, ohdr, H5O_FILL_ID, &old_fill_prop, 0);
if (get_value == 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of fill value (backwards compat) message")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0,
+ "can't get size of fill value (backwards compat) message")
ret_value += get_value;
}
/* Filter/Pipeline message size */
- if(H5D_CHUNKED == dset->shared->layout.type) {
+ if (H5D_CHUNKED == dset->shared->layout.type) {
H5O_pline_t *pline = &dset->shared->dcpl_cache.pline;
- if(pline->nused > 0) {
+ if (pline->nused > 0) {
get_value = H5O_msg_size_oh(file, ohdr, H5O_PLINE_ID, pline, 0);
if (get_value == 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of filter message")
@@ -857,7 +839,7 @@ H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr)
}
/* External File Link message size */
- if(dset->shared->dcpl_cache.efl.nused > 0) {
+ if (dset->shared->dcpl_cache.efl.nused > 0) {
get_value = H5O_msg_size_oh(file, ohdr, H5O_EFL_ID, &dset->shared->dcpl_cache.efl, 0);
if (get_value == 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of external file link message")
@@ -865,10 +847,10 @@ H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr)
}
/* Modification Time message size */
- if(H5O_HDR_STORE_TIMES & H5O_OH_GET_FLAGS(ohdr)) {
+ if (H5O_HDR_STORE_TIMES & H5O_OH_GET_FLAGS(ohdr)) {
HDassert(H5O_OH_GET_VERSION(ohdr) >= 1); /* 1 :: H5O_VERSION_1 (H5Opkg.h) */
- if(H5O_OH_GET_VERSION(ohdr) == 1) {
+ if (H5O_OH_GET_VERSION(ohdr) == 1) {
/* v1 object headers store modification time as a message */
time_t mtime;
get_value = H5O_msg_size_oh(file, ohdr, H5O_MTIME_NEW_ID, &mtime, 0);
@@ -882,7 +864,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5D__calculate_minimum_header_size */
-
/*-------------------------------------------------------------------------
* Function: H5D__prepare_minimized_oh
*
@@ -899,9 +880,9 @@ done:
static herr_t
H5D__prepare_minimized_oh(H5F_t *file, H5D_t *dset, H5O_loc_t *oloc)
{
- H5O_t *oh = NULL;
- size_t ohdr_size = 0;
- herr_t ret_value = SUCCEED;
+ H5O_t *oh = NULL;
+ size_t ohdr_size = 0;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -910,22 +891,21 @@ H5D__prepare_minimized_oh(H5F_t *file, H5D_t *dset, H5O_loc_t *oloc)
HDassert(oloc);
oh = H5O_create_ohdr(file, dset->shared->dcpl_id);
- if(NULL == oh)
+ if (NULL == oh)
HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "can't instantiate object header")
ohdr_size = H5D__calculate_minimum_header_size(file, dset, oh);
if (ohdr_size == 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "computed header size is invalid")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "computed header size is invalid")
/* Special allocation of space for compact datsets is handled by the call here. */
- if(H5O_apply_ohdr(file, oh, dset->shared->dcpl_id, ohdr_size, (size_t)1, oloc) == FAIL)
+ if (H5O_apply_ohdr(file, oh, dset->shared->dcpl_id, ohdr_size, (size_t)1, oloc) == FAIL)
HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "can't apply object header to file")
done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5D__prepare_minimized_oh */
-
/*-------------------------------------------------------------------------
* Function: H5D__update_oh_info
*
@@ -938,18 +918,18 @@ done:
static herr_t
H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
{
- H5O_t *oh = NULL; /* Pointer to dataset's object header */
- size_t ohdr_size = H5D_MINHDR_SIZE; /* Size of dataset's object header */
- H5O_loc_t *oloc = NULL; /* Dataset's object location */
- H5O_layout_t *layout; /* Dataset's layout information */
- H5T_t *type; /* Dataset's datatype */
- H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
- H5D_fill_value_t fill_status; /* Fill value status */
- hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */
- hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
- hbool_t use_at_least_v18; /* Flag indicating to use at least v18 format versions */
- hbool_t use_minimized_header = FALSE; /* Flag to use minimized dataset object headers */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_t * oh = NULL; /* Pointer to dataset's object header */
+ size_t ohdr_size = H5D_MINHDR_SIZE; /* Size of dataset's object header */
+ H5O_loc_t * oloc = NULL; /* Dataset's object location */
+ H5O_layout_t * layout; /* Dataset's layout information */
+ H5T_t * type; /* Dataset's datatype */
+ H5O_fill_t * fill_prop; /* Pointer to dataset's fill value information */
+ H5D_fill_value_t fill_status; /* Fill value status */
+ hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */
+ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
+ hbool_t use_at_least_v18; /* Flag indicating to use at least v18 format versions */
+ hbool_t use_minimized_header = FALSE; /* Flag to use minimized dataset object headers */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -958,22 +938,22 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
HDassert(dset);
/* Set some local variables, for convenience */
- oloc = &dset->oloc;
- layout = &dset->shared->layout;
- type = dset->shared->type;
+ oloc = &dset->oloc;
+ layout = &dset->shared->layout;
+ type = dset->shared->type;
fill_prop = &dset->shared->dcpl_cache.fill;
/* To use at least v18 format versions or not */
use_at_least_v18 = (H5F_LOW_BOUND(file) >= H5F_LIBVER_V18);
/* Retrieve "defined" status of fill value */
- if(H5P_is_fill_value_defined(fill_prop, &fill_status) < 0)
+ if (H5P_is_fill_value_defined(fill_prop, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
/* Special case handling for variable-length types */
- if(H5T_detect_class(type, H5T_VLEN, FALSE)) {
+ if (H5T_detect_class(type, H5T_VLEN, FALSE)) {
/* If the default fill value is chosen for variable-length types, always write it */
- if(fill_prop->fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_DEFAULT) {
+ if (fill_prop->fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_DEFAULT) {
/* Update dataset creation property */
fill_prop->fill_time = H5D_FILL_TIME_ALLOC;
@@ -982,82 +962,84 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
} /* end if */
/* Don't allow never writing fill values with variable-length types */
- if(fill_prop->fill_time == H5D_FILL_TIME_NEVER)
- HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Dataset doesn't support VL datatype when fill value is not defined")
+ if (fill_prop->fill_time == H5D_FILL_TIME_NEVER)
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
+ "Dataset doesn't support VL datatype when fill value is not defined")
} /* end if */
/* Determine whether fill value is defined or not */
- if(fill_status == H5D_FILL_VALUE_DEFAULT || fill_status == H5D_FILL_VALUE_USER_DEFINED) {
+ if (fill_status == H5D_FILL_VALUE_DEFAULT || fill_status == H5D_FILL_VALUE_USER_DEFINED) {
/* Convert fill value buffer to dataset's datatype */
- if(fill_prop->buf && fill_prop->size > 0 && H5O_fill_convert(fill_prop, type, &fill_changed) < 0)
+ if (fill_prop->buf && fill_prop->size > 0 && H5O_fill_convert(fill_prop, type, &fill_changed) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert fill value to dataset type")
fill_prop->fill_defined = TRUE;
}
- else if(fill_status == H5D_FILL_VALUE_UNDEFINED)
+ else if (fill_status == H5D_FILL_VALUE_UNDEFINED)
fill_prop->fill_defined = FALSE;
else
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine if fill value is defined")
/* Check for invalid fill & allocation time setting */
- if(fill_prop->fill_defined == FALSE && fill_prop->fill_time == H5D_FILL_TIME_ALLOC)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "fill value writing on allocation set, but no fill value defined")
+ if (fill_prop->fill_defined == FALSE && fill_prop->fill_time == H5D_FILL_TIME_ALLOC)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "fill value writing on allocation set, but no fill value defined")
/* Check if the fill value info changed */
- if(fill_changed) {
- H5P_genplist_t *dc_plist; /* Dataset's creation property list */
+ if (fill_changed) {
+ H5P_genplist_t *dc_plist; /* Dataset's creation property list */
/* Get dataset's property list object */
HDassert(dset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT);
- if(NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dset->shared->dcpl_id)))
+ if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dset->shared->dcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
/* Update dataset creation property */
- if(H5P_set(dc_plist, H5D_CRT_FILL_VALUE_NAME, fill_prop) < 0)
+ if (H5P_set(dc_plist, H5D_CRT_FILL_VALUE_NAME, fill_prop) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value info")
} /* end if */
- if(H5D__use_minimized_dset_headers(file, &use_minimized_header) == FAIL)
+ if (H5D__use_minimized_dset_headers(file, &use_minimized_header) == FAIL)
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get minimize settings")
- if(TRUE == use_minimized_header) {
- if(H5D__prepare_minimized_oh(file, dset, oloc) == FAIL)
+ if (TRUE == use_minimized_header) {
+ if (H5D__prepare_minimized_oh(file, dset, oloc) == FAIL)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create minimized dataset object header")
} /* end if */
else {
/* Add the dataset's raw data size to the size of the header, if the
* raw data will be stored as compact
*/
- if(H5D_COMPACT == layout->type)
+ if (H5D_COMPACT == layout->type)
ohdr_size += layout->storage.u.compact.size;
/* Create an object header for the dataset */
- if(H5O_create(file, ohdr_size, (size_t)1, dset->shared->dcpl_id, oloc/*out*/) < 0)
+ if (H5O_create(file, ohdr_size, (size_t)1, dset->shared->dcpl_id, oloc /*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset object header")
} /* if using default/minimized object headers */
HDassert(file == dset->oloc.file);
/* Pin the object header */
- if(NULL == (oh = H5O_pin(oloc)))
+ if (NULL == (oh = H5O_pin(oloc)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header")
/* Write the dataspace header message */
- if(H5S_append(file, oh, dset->shared->space) < 0)
+ if (H5S_append(file, oh, dset->shared->space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update dataspace header message")
/* Write the datatype header message */
- if(H5O_msg_append_oh(file, oh, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT, 0, type) < 0)
+ if (H5O_msg_append_oh(file, oh, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT, 0, type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update datatype header message")
/* Write new fill value message */
- if(H5O_msg_append_oh(file, oh, H5O_FILL_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, fill_prop) < 0)
+ if (H5O_msg_append_oh(file, oh, H5O_FILL_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, fill_prop) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update new fill value header message")
/* If there is valid information for the old fill value struct, add it */
/* (only if we aren't using v18 format versions and above */
- if(fill_prop->buf && !use_at_least_v18) {
- H5O_fill_t old_fill_prop; /* Copy of fill value property, for writing as "old" fill value */
+ if (fill_prop->buf && !use_at_least_v18) {
+ H5O_fill_t old_fill_prop; /* Copy of fill value property, for writing as "old" fill value */
/* Shallow copy the fill value property */
/* (we only want to make certain that the shared component isn't modified) */
@@ -1067,72 +1049,70 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
H5O_msg_reset_share(H5O_FILL_ID, &old_fill_prop);
/* Write old fill value */
- if(H5O_msg_append_oh(file, oh, H5O_FILL_ID, H5O_MSG_FLAG_CONSTANT, 0, &old_fill_prop) < 0)
+ if (H5O_msg_append_oh(file, oh, H5O_FILL_ID, H5O_MSG_FLAG_CONSTANT, 0, &old_fill_prop) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update old fill value header message")
} /* end if */
/* Update/create the layout (and I/O pipeline & EFL) messages */
- if(H5D__layout_oh_create(file, oh, dset, dapl_id) < 0)
+ if (H5D__layout_oh_create(file, oh, dset, dapl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout/pline/efl header message")
/* Indicate that the layout information was initialized */
layout_init = TRUE;
#ifdef H5O_ENABLE_BOGUS
-{
- H5P_genplist_t *dc_plist; /* Dataset's creation property list */
+ {
+ H5P_genplist_t *dc_plist; /* Dataset's creation property list */
- /* Get dataset's property list object */
- if(NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dset->shared->dcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
+ /* Get dataset's property list object */
+ if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dset->shared->dcpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
- /* Check whether to add a "bogus" message */
- if( (H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME) > 0) &&
- (H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_ID_NAME) > 0) ) {
+ /* Check whether to add a "bogus" message */
+ if ((H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME) > 0) &&
+ (H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_ID_NAME) > 0)) {
- uint8_t bogus_flags = 0; /* Flags for creating "bogus" message */
- unsigned bogus_id; /* "bogus" ID */
+ uint8_t bogus_flags = 0; /* Flags for creating "bogus" message */
+ unsigned bogus_id; /* "bogus" ID */
- /* Retrieve "bogus" message ID */
- if(H5P_get(dc_plist, H5O_BOGUS_MSG_ID_NAME, &bogus_id) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options")
- /* Retrieve "bogus" message flags */
- if(H5P_get(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus message options")
+ /* Retrieve "bogus" message ID */
+ if (H5P_get(dc_plist, H5O_BOGUS_MSG_ID_NAME, &bogus_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options")
+ /* Retrieve "bogus" message flags */
+ if (H5P_get(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus message options")
- /* Add a "bogus" message (for error testing). */
- if(H5O_bogus_oh(file, oh, bogus_id, (unsigned)bogus_flags) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create 'bogus' message")
- } /* end if */
-}
+ /* Add a "bogus" message (for error testing). */
+ if (H5O_bogus_oh(file, oh, bogus_id, (unsigned)bogus_flags) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create 'bogus' message")
+ } /* end if */
+ }
#endif /* H5O_ENABLE_BOGUS */
/* Add a modification time message, if using older format. */
/* (If using v18 format versions and above, the the modification time is part of the object
* header and doesn't use a separate message -QAK)
*/
- if(!use_at_least_v18)
- if(H5O_touch_oh(file, oh, TRUE) < 0)
+ if (!use_at_least_v18)
+ if (H5O_touch_oh(file, oh, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time message")
done:
/* Release pointer to object header itself */
- if(oh != NULL)
- if(H5O_unpin(oh) < 0)
+ if (oh != NULL)
+ if (H5O_unpin(oh) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header")
/* Error cleanup */
- if(ret_value < 0)
- if(layout_init)
+ if (ret_value < 0)
+ if (layout_init)
/* Destroy the layout information for the dataset */
- if(dset->shared->layout.ops->dest && (dset->shared->layout.ops->dest)(dset) < 0)
+ if (dset->shared->layout.ops->dest && (dset->shared->layout.ops->dest)(dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__update_oh_info() */
-
-
/*--------------------------------------------------------------------------
* Function: H5D__build_file_prefix
*
@@ -1146,12 +1126,12 @@ done:
static herr_t
H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char **file_prefix /*out*/)
{
- const char *prefix = NULL; /* prefix used to look for the file */
- char *filepath = NULL; /* absolute path of directory the HDF5 file is in */
- size_t filepath_len; /* length of file path */
- size_t prefix_len; /* length of prefix */
- size_t file_prefix_len; /* length of expanded prefix */
- herr_t ret_value = SUCCEED; /* Return value */
+ const char *prefix = NULL; /* prefix used to look for the file */
+ char * filepath = NULL; /* absolute path of directory the HDF5 file is in */
+ size_t filepath_len; /* length of file path */
+ size_t prefix_len; /* length of prefix */
+ size_t file_prefix_len; /* length of expanded prefix */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1164,19 +1144,19 @@ H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char **
/* XXX: Future thread-safety note - getenv is not required
* to be reentrant.
*/
- if(H5F_PREFIX_VDS == prefix_type) {
+ if (H5F_PREFIX_VDS == prefix_type) {
prefix = H5D_prefix_vds_env;
- if(prefix == NULL || *prefix == '\0') {
- if(H5CX_get_vds_prefix(&prefix) < 0)
+ if (prefix == NULL || *prefix == '\0') {
+ if (H5CX_get_vds_prefix(&prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for vds file")
}
}
- else if(H5F_PREFIX_EFILE == prefix_type) {
+ else if (H5F_PREFIX_EFILE == prefix_type) {
prefix = H5D_prefix_ext_env;
- if(prefix == NULL || *prefix == '\0') {
- if(H5CX_get_ext_file_prefix(&prefix) < 0)
+ if (prefix == NULL || *prefix == '\0') {
+ if (H5CX_get_ext_file_prefix(&prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for the external file")
}
}
@@ -1186,34 +1166,33 @@ H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char **
/* Prefix has to be checked for NULL / empty string again because the
* code above might have updated it.
*/
- if(prefix == NULL || *prefix == '\0' || HDstrcmp(prefix, ".") == 0) {
+ if (prefix == NULL || *prefix == '\0' || HDstrcmp(prefix, ".") == 0) {
/* filename is interpreted as relative to the current directory,
* does not need to be expanded
*/
*file_prefix = NULL;
} /* end if */
else {
- if(HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) {
+ if (HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) {
/* Replace ${ORIGIN} at beginning of prefix by directory of HDF5 file */
- filepath_len = HDstrlen(filepath);
- prefix_len = HDstrlen(prefix);
+ filepath_len = HDstrlen(filepath);
+ prefix_len = HDstrlen(prefix);
file_prefix_len = filepath_len + prefix_len - HDstrlen("${ORIGIN}") + 1;
- if(NULL == (*file_prefix = (char *)H5MM_malloc(file_prefix_len)))
+ if (NULL == (*file_prefix = (char *)H5MM_malloc(file_prefix_len)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer")
HDsnprintf(*file_prefix, file_prefix_len, "%s%s", filepath, prefix + HDstrlen("${ORIGIN}"));
} /* end if */
else {
- if(NULL == (*file_prefix = (char *)H5MM_strdup(prefix)))
+ if (NULL == (*file_prefix = (char *)H5MM_strdup(prefix)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
} /* end else */
- } /* end else */
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__build_file_prefix() */
-
/*-------------------------------------------------------------------------
* Function: H5D__create
*
@@ -1230,21 +1209,20 @@ done:
*-------------------------------------------------------------------------
*/
H5D_t *
-H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
- hid_t dapl_id)
+H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t dapl_id)
{
- H5T_t *type = NULL; /* Datatype for dataset (VOL pointer) */
- H5T_t *dt = NULL; /* Datatype for dataset (non-VOL pointer) */
- H5D_t *new_dset = NULL;
- H5P_genplist_t *dc_plist = NULL; /* New Property list */
- hbool_t has_vl_type = FALSE; /* Flag to indicate a VL-type for dataset */
- hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
- hbool_t layout_copied = FALSE; /* Flag to indicate that layout message was copied */
- hbool_t fill_copied = FALSE; /* Flag to indicate that fill-value message was copied */
- hbool_t pline_copied = FALSE; /* Flag to indicate that pipeline message was copied */
- hbool_t efl_copied = FALSE; /* Flag to indicate that external file list message was copied */
- H5G_loc_t dset_loc; /* Dataset location */
- H5D_t *ret_value = NULL; /* Return value */
+ H5T_t * type = NULL; /* Datatype for dataset (VOL pointer) */
+ H5T_t * dt = NULL; /* Datatype for dataset (non-VOL pointer) */
+ H5D_t * new_dset = NULL;
+ H5P_genplist_t *dc_plist = NULL; /* New Property list */
+ hbool_t has_vl_type = FALSE; /* Flag to indicate a VL-type for dataset */
+ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
+ hbool_t layout_copied = FALSE; /* Flag to indicate that layout message was copied */
+ hbool_t fill_copied = FALSE; /* Flag to indicate that fill-value message was copied */
+ hbool_t pline_copied = FALSE; /* Flag to indicate that pipeline message was copied */
+ hbool_t efl_copied = FALSE; /* Flag to indicate that external file list message was copied */
+ H5G_loc_t dset_loc; /* Dataset location */
+ H5D_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1255,26 +1233,26 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id));
/* Get the dataset's datatype */
- if(NULL == (dt = (H5T_t *)H5I_object(type_id)))
+ if (NULL == (dt = (H5T_t *)H5I_object(type_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype")
/* If this is a named datatype, get the pointer via the VOL plugin */
type = H5T_get_actual_type(dt);
/* Check if the datatype is "sensible" for use in a dataset */
- if(H5T_is_sensible(type) != TRUE)
+ if (H5T_is_sensible(type) != TRUE)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "datatype is not sensible")
/* Check if the datatype is/contains a VL-type */
- if(H5T_detect_class(type, H5T_VLEN, FALSE))
+ if (H5T_detect_class(type, H5T_VLEN, FALSE))
has_vl_type = TRUE;
/* Check if the dataspace has an extent set (or is NULL) */
- if(!H5S_has_extent(space))
+ if (!H5S_has_extent(space))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "dataspace extent has not been set.")
/* Initialize the dataset object */
- if(NULL == (new_dset = H5FL_CALLOC(H5D_t)))
+ if (NULL == (new_dset = H5FL_CALLOC(H5D_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set up & reset dataset location */
@@ -1283,131 +1261,133 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
H5G_loc_reset(&dset_loc);
/* Initialize the shared dataset space */
- if(NULL == (new_dset->shared = H5D__new(dcpl_id, dapl_id, TRUE, has_vl_type)))
+ if (NULL == (new_dset->shared = H5D__new(dcpl_id, dapl_id, TRUE, has_vl_type)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy & initialize datatype for dataset */
- if(H5D__init_type(file, new_dset, type_id, type) < 0)
+ if (H5D__init_type(file, new_dset, type_id, type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't copy datatype")
/* Copy & initialize dataspace for dataset */
- if(H5D__init_space(file, new_dset, space) < 0)
+ if (H5D__init_space(file, new_dset, space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't copy dataspace")
/* Set the dataset's checked_filters flag to enable writing */
new_dset->shared->checked_filters = TRUE;
/* Check if the dataset has a non-default DCPL & get important values, if so */
- if(new_dset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT) {
- H5O_layout_t *layout; /* Dataset's layout information */
- H5O_pline_t *pline; /* Dataset's I/O pipeline information */
- H5O_fill_t *fill; /* Dataset's fill value info */
- H5O_efl_t *efl; /* Dataset's external file list info */
- htri_t ignore_filters = FALSE; /* Ignore optional filters or not */
-
- if((ignore_filters = H5Z_ignore_filters(new_dset->shared->dcpl_id, dt, space))<0)
+ if (new_dset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT) {
+ H5O_layout_t *layout; /* Dataset's layout information */
+ H5O_pline_t * pline; /* Dataset's I/O pipeline information */
+ H5O_fill_t * fill; /* Dataset's fill value info */
+ H5O_efl_t * efl; /* Dataset's external file list info */
+ htri_t ignore_filters = FALSE; /* Ignore optional filters or not */
+
+ if ((ignore_filters = H5Z_ignore_filters(new_dset->shared->dcpl_id, dt, space)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, NULL, "H5Z_has_optional_filter() failed")
- if(FALSE == ignore_filters) {
+ if (FALSE == ignore_filters) {
/* Check if the filters in the DCPL can be applied to this dataset */
- if(H5Z_can_apply(new_dset->shared->dcpl_id, new_dset->shared->type_id) < 0)
+ if (H5Z_can_apply(new_dset->shared->dcpl_id, new_dset->shared->type_id) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, NULL, "I/O filters can't operate on this dataset")
/* Make the "set local" filter callbacks for this dataset */
- if(H5Z_set_local(new_dset->shared->dcpl_id, new_dset->shared->type_id) < 0)
+ if (H5Z_set_local(new_dset->shared->dcpl_id, new_dset->shared->type_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set local filter parameters")
} /* ignore_filters */
/* Get new dataset's property list object */
- if(NULL == (dc_plist = (H5P_genplist_t *)H5I_object(new_dset->shared->dcpl_id)))
+ if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(new_dset->shared->dcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "can't get dataset creation property list")
/* Retrieve the properties we need */
pline = &new_dset->shared->dcpl_cache.pline;
- if(H5P_get(dc_plist, H5O_CRT_PIPELINE_NAME, pline) < 0)
+ if (H5P_get(dc_plist, H5O_CRT_PIPELINE_NAME, pline) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve pipeline filter")
pline_copied = TRUE;
- layout = &new_dset->shared->layout;
- if(H5P_get(dc_plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
+ layout = &new_dset->shared->layout;
+ if (H5P_get(dc_plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve layout")
layout_copied = TRUE;
- fill = &new_dset->shared->dcpl_cache.fill;
- if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, fill) < 0)
+ fill = &new_dset->shared->dcpl_cache.fill;
+ if (H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, fill) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve fill value info")
fill_copied = TRUE;
- efl = &new_dset->shared->dcpl_cache.efl;
- if(H5P_get(dc_plist, H5D_CRT_EXT_FILE_LIST_NAME, efl) < 0)
+ efl = &new_dset->shared->dcpl_cache.efl;
+ if (H5P_get(dc_plist, H5D_CRT_EXT_FILE_LIST_NAME, efl) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve external file list")
efl_copied = TRUE;
- if(FALSE == ignore_filters) {
+ if (FALSE == ignore_filters) {
/* Check that chunked layout is used if filters are enabled */
- if(pline->nused > 0 && H5D_CHUNKED != layout->type)
+ if (pline->nused > 0 && H5D_CHUNKED != layout->type)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "filters can only be used with chunked layout")
}
/* Check if the alloc_time is the default and error out */
- if(fill->alloc_time == H5D_ALLOC_TIME_DEFAULT)
+ if (fill->alloc_time == H5D_ALLOC_TIME_DEFAULT)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "invalid space allocation state")
/* Don't allow compact datasets to allocate space later */
- if(layout->type == H5D_COMPACT && fill->alloc_time != H5D_ALLOC_TIME_EARLY)
+ if (layout->type == H5D_COMPACT && fill->alloc_time != H5D_ALLOC_TIME_EARLY)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "compact dataset must have early space allocation")
} /* end if */
/* Set the version for the I/O pipeline message */
- if(H5O_pline_set_version(file, &new_dset->shared->dcpl_cache.pline) < 0)
+ if (H5O_pline_set_version(file, &new_dset->shared->dcpl_cache.pline) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline")
/* Set the version for the fill message */
- if(H5O_fill_set_version(file, &new_dset->shared->dcpl_cache.fill) < 0)
+ if (H5O_fill_set_version(file, &new_dset->shared->dcpl_cache.fill) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value")
/* Set the latest version for the layout message */
- if(H5D__layout_set_version(file, &new_dset->shared->layout) < 0)
+ if (H5D__layout_set_version(file, &new_dset->shared->layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout")
- if(new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) {
+ if (new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) {
/* Use latest indexing type for layout message version >= 4 */
- if(H5D__layout_set_latest_indexing(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0)
+ if (H5D__layout_set_latest_indexing(&new_dset->shared->layout, new_dset->shared->space,
+ &new_dset->shared->dcpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest indexing")
} /* end if */
/* Check if this dataset is going into a parallel file and set space allocation time */
- if(H5F_HAS_FEATURE(file, H5FD_FEAT_ALLOCATE_EARLY))
+ if (H5F_HAS_FEATURE(file, H5FD_FEAT_ALLOCATE_EARLY))
new_dset->shared->dcpl_cache.fill.alloc_time = H5D_ALLOC_TIME_EARLY;
/* Set the dataset's I/O operations */
- if(H5D__layout_set_io_ops(new_dset) < 0)
+ if (H5D__layout_set_io_ops(new_dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize I/O operations")
/* Create the layout information for the new dataset */
- if(new_dset->shared->layout.ops->construct && (new_dset->shared->layout.ops->construct)(file, new_dset) < 0)
+ if (new_dset->shared->layout.ops->construct &&
+ (new_dset->shared->layout.ops->construct)(file, new_dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to construct layout information")
/* Update the dataset's object header info. */
- if(H5D__update_oh_info(file, new_dset, new_dset->shared->dapl_id) < 0)
+ if (H5D__update_oh_info(file, new_dset, new_dset->shared->dapl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't update the metadata cache")
/* Indicate that the layout information was initialized */
layout_init = TRUE;
/* Set up append flush parameters for the dataset */
- if(H5D__append_flush_setup(new_dset, new_dset->shared->dapl_id) < 0)
+ if (H5D__append_flush_setup(new_dset, new_dset->shared->dapl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property")
/* Set the external file prefix */
- if(H5D__build_file_prefix(new_dset, H5F_PREFIX_EFILE, &new_dset->shared->extfile_prefix) < 0)
+ if (H5D__build_file_prefix(new_dset, H5F_PREFIX_EFILE, &new_dset->shared->extfile_prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix")
/* Set the VDS file prefix */
- if(H5D__build_file_prefix(new_dset, H5F_PREFIX_VDS, &new_dset->shared->vds_prefix) < 0)
+ if (H5D__build_file_prefix(new_dset, H5F_PREFIX_VDS, &new_dset->shared->vds_prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize VDS prefix")
/* Add the dataset to the list of opened objects in the file */
- if(H5FO_top_incr(new_dset->oloc.file, new_dset->oloc.addr) < 0)
+ if (H5FO_top_incr(new_dset->oloc.file, new_dset->oloc.addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't incr object ref. count")
- if(H5FO_insert(new_dset->oloc.file, new_dset->oloc.addr, new_dset->shared, TRUE) < 0)
+ if (H5FO_insert(new_dset->oloc.file, new_dset->oloc.addr, new_dset->shared, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, NULL, "can't insert dataset into list of open objects")
new_dset->shared->fo_count = 1;
@@ -1415,63 +1395,63 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
ret_value = new_dset;
done:
- if(!ret_value && new_dset) {
- if(new_dset->shared) {
- if(layout_init)
- if(new_dset->shared->layout.ops->dest && (new_dset->shared->layout.ops->dest)(new_dset) < 0)
+ if (!ret_value && new_dset) {
+ if (new_dset->shared) {
+ if (layout_init)
+ if (new_dset->shared->layout.ops->dest && (new_dset->shared->layout.ops->dest)(new_dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "unable to destroy layout info")
- if(pline_copied)
- if(H5O_msg_reset(H5O_PLINE_ID, &new_dset->shared->dcpl_cache.pline) < 0)
+ if (pline_copied)
+ if (H5O_msg_reset(H5O_PLINE_ID, &new_dset->shared->dcpl_cache.pline) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset I/O pipeline info")
- if(layout_copied)
- if(H5O_msg_reset(H5O_LAYOUT_ID, &new_dset->shared->layout) < 0)
+ if (layout_copied)
+ if (H5O_msg_reset(H5O_LAYOUT_ID, &new_dset->shared->layout) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset layout info")
- if(fill_copied)
- if(H5O_msg_reset(H5O_FILL_ID, &new_dset->shared->dcpl_cache.fill) < 0)
+ if (fill_copied)
+ if (H5O_msg_reset(H5O_FILL_ID, &new_dset->shared->dcpl_cache.fill) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset fill-value info")
- if(efl_copied)
- if(H5O_msg_reset(H5O_EFL_ID, &new_dset->shared->dcpl_cache.efl) < 0)
+ if (efl_copied)
+ if (H5O_msg_reset(H5O_EFL_ID, &new_dset->shared->dcpl_cache.efl) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset external file list info")
- if(new_dset->shared->space && H5S_close(new_dset->shared->space) < 0)
+ if (new_dset->shared->space && H5S_close(new_dset->shared->space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataspace")
- if(new_dset->shared->type) {
- if(new_dset->shared->type_id > 0) {
- if(H5I_dec_ref(new_dset->shared->type_id) < 0)
+ if (new_dset->shared->type) {
+ if (new_dset->shared->type_id > 0) {
+ if (H5I_dec_ref(new_dset->shared->type_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype")
} /* end if */
else {
- if(H5T_close_real(new_dset->shared->type) < 0)
+ if (H5T_close_real(new_dset->shared->type) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype")
} /* end else */
- } /* end if */
+ } /* end if */
- if(H5F_addr_defined(new_dset->oloc.addr)) {
- if(H5O_dec_rc_by_loc(&(new_dset->oloc)) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object")
- if(H5O_close(&(new_dset->oloc), NULL) < 0)
+ if (H5F_addr_defined(new_dset->oloc.addr)) {
+ if (H5O_dec_rc_by_loc(&(new_dset->oloc)) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL,
+ "unable to decrement refcount on newly created object")
+ if (H5O_close(&(new_dset->oloc), NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release object header")
- if(file) {
- if(H5O_delete(file, new_dset->oloc.addr) < 0)
+ if (file) {
+ if (H5O_delete(file, new_dset->oloc.addr) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDELETE, NULL, "unable to delete object header")
} /* end if */
- } /* end if */
- if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id) < 0)
+ } /* end if */
+ if (new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list")
- if(new_dset->shared->dapl_id != 0 && H5I_dec_ref(new_dset->shared->dapl_id) < 0)
+ if (new_dset->shared->dapl_id != 0 && H5I_dec_ref(new_dset->shared->dapl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list")
new_dset->shared->extfile_prefix = (char *)H5MM_xfree(new_dset->shared->extfile_prefix);
- new_dset->shared->vds_prefix = (char *)H5MM_xfree(new_dset->shared->vds_prefix);
- new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared);
+ new_dset->shared->vds_prefix = (char *)H5MM_xfree(new_dset->shared->vds_prefix);
+ new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared);
} /* end if */
new_dset->oloc.file = NULL;
- new_dset = H5FL_FREE(H5D_t, new_dset);
+ new_dset = H5FL_FREE(H5D_t, new_dset);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create() */
-
/*-------------------------------------------------------------------------
* Function: H5D__open_name
*
@@ -1484,13 +1464,13 @@ done:
H5D_t *
H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id)
{
- H5D_t *dset = NULL;
- H5G_loc_t dset_loc; /* Object location of dataset */
- H5G_name_t path; /* Dataset group hier. path */
- H5O_loc_t oloc; /* Dataset object location */
- H5O_type_t obj_type; /* Type of object at location */
- hbool_t loc_found = FALSE; /* Location at 'name' found */
- H5D_t *ret_value = NULL; /* Return value */
+ H5D_t * dset = NULL;
+ H5G_loc_t dset_loc; /* Object location of dataset */
+ H5G_name_t path; /* Dataset group hier. path */
+ H5O_loc_t oloc; /* Dataset object location */
+ H5O_type_t obj_type; /* Type of object at location */
+ hbool_t loc_found = FALSE; /* Location at 'name' found */
+ H5D_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1504,32 +1484,31 @@ H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id)
H5G_loc_reset(&dset_loc);
/* Find the dataset object */
- if(H5G_loc_find(loc, name, &dset_loc) < 0)
+ if (H5G_loc_find(loc, name, &dset_loc) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, NULL, "not found")
loc_found = TRUE;
/* Check that the object found is the correct type */
- if(H5O_obj_type(&oloc, &obj_type) < 0)
+ if (H5O_obj_type(&oloc, &obj_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get object type")
- if(obj_type != H5O_TYPE_DATASET)
+ if (obj_type != H5O_TYPE_DATASET)
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, NULL, "not a dataset")
/* Open the dataset */
- if(NULL == (dset = H5D_open(&dset_loc, dapl_id)))
+ if (NULL == (dset = H5D_open(&dset_loc, dapl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't open dataset")
/* Set return value */
ret_value = dset;
done:
- if(!ret_value)
- if(loc_found && H5G_loc_free(&dset_loc) < 0)
+ if (!ret_value)
+ if (loc_found && H5G_loc_free(&dset_loc) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "can't free location")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__open_name() */
-
/*
*-------------------------------------------------------------------------
* Function: H5D_open
@@ -1544,11 +1523,11 @@ done:
H5D_t *
H5D_open(const H5G_loc_t *loc, hid_t dapl_id)
{
- H5D_shared_t *shared_fo = NULL;
- H5D_t *dataset = NULL;
- char *extfile_prefix = NULL; /* Expanded external file prefix */
- char *vds_prefix = NULL; /* Expanded vds prefix */
- H5D_t *ret_value = NULL; /* Return value */
+ H5D_shared_t *shared_fo = NULL;
+ H5D_t * dataset = NULL;
+ char * extfile_prefix = NULL; /* Expanded external file prefix */
+ char * vds_prefix = NULL; /* Expanded vds prefix */
+ H5D_t * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1556,40 +1535,40 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id)
HDassert(loc);
/* Allocate the dataset structure */
- if(NULL == (dataset = H5FL_CALLOC(H5D_t)))
+ if (NULL == (dataset = H5FL_CALLOC(H5D_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Shallow copy (take ownership) of the object location object */
- if(H5O_loc_copy_shallow(&(dataset->oloc), loc->oloc) < 0)
+ if (H5O_loc_copy_shallow(&(dataset->oloc), loc->oloc) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy object location")
/* Shallow copy (take ownership) of the group hier. path */
- if(H5G_name_copy(&(dataset->path), loc->path, H5_COPY_SHALLOW) < 0)
+ if (H5G_name_copy(&(dataset->path), loc->path, H5_COPY_SHALLOW) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path")
/* Get the external file prefix */
- if(H5D__build_file_prefix(dataset, H5F_PREFIX_EFILE, &extfile_prefix) < 0)
+ if (H5D__build_file_prefix(dataset, H5F_PREFIX_EFILE, &extfile_prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix")
/* Get the VDS prefix */
- if(H5D__build_file_prefix(dataset, H5F_PREFIX_VDS, &vds_prefix) < 0)
+ if (H5D__build_file_prefix(dataset, H5F_PREFIX_VDS, &vds_prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize VDS prefix")
/* Check if dataset was already open */
- if(NULL == (shared_fo = (H5D_shared_t *)H5FO_opened(dataset->oloc.file, dataset->oloc.addr))) {
+ if (NULL == (shared_fo = (H5D_shared_t *)H5FO_opened(dataset->oloc.file, dataset->oloc.addr))) {
/* Clear any errors from H5FO_opened() */
H5E_clear_stack(NULL);
/* Open the dataset object */
- if(H5D__open_oid(dataset, dapl_id) < 0)
+ if (H5D__open_oid(dataset, dapl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, NULL, "not found")
/* Add the dataset to the list of opened objects in the file */
- if(H5FO_insert(dataset->oloc.file, dataset->oloc.addr, dataset->shared, FALSE) < 0)
+ if (H5FO_insert(dataset->oloc.file, dataset->oloc.addr, dataset->shared, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, NULL, "can't insert dataset into list of open objects")
/* Increment object count for the object in the top file */
- if(H5FO_top_incr(dataset->oloc.file, dataset->oloc.addr) < 0)
+ if (H5FO_top_incr(dataset->oloc.file, dataset->oloc.addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment object count")
/* We're the first dataset to use the the shared info */
@@ -1616,23 +1595,28 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id)
/* Check whether the external file prefix of the already open dataset
* matches the new external file prefix
*/
- if(extfile_prefix && dataset->shared->extfile_prefix) {
- if(HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset")
- } else {
- if(extfile_prefix || dataset->shared->extfile_prefix)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset")
+ if (extfile_prefix && dataset->shared->extfile_prefix) {
+ if (HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0)
+ HGOTO_ERROR(
+ H5E_DATASET, H5E_CANTOPENOBJ, NULL,
+ "new external file prefix does not match external file prefix of already open dataset")
+ }
+ else {
+ if (extfile_prefix || dataset->shared->extfile_prefix)
+ HGOTO_ERROR(
+ H5E_DATASET, H5E_CANTOPENOBJ, NULL,
+ "new external file prefix does not match external file prefix of already open dataset")
}
/* Check if the object has been opened through the top file yet */
- if(H5FO_top_count(dataset->oloc.file, dataset->oloc.addr) == 0) {
+ if (H5FO_top_count(dataset->oloc.file, dataset->oloc.addr) == 0) {
/* Open the object through this top file */
- if(H5O_open(&(dataset->oloc)) < 0)
+ if (H5O_open(&(dataset->oloc)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open object header")
} /* end if */
/* Increment object count for the object in the top file */
- if(H5FO_top_incr(dataset->oloc.file, dataset->oloc.addr) < 0)
+ if (H5FO_top_incr(dataset->oloc.file, dataset->oloc.addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment object count")
} /* end else */
@@ -1641,15 +1625,15 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id)
done:
extfile_prefix = (char *)H5MM_xfree(extfile_prefix);
- vds_prefix = (char *)H5MM_xfree(vds_prefix);
+ vds_prefix = (char *)H5MM_xfree(vds_prefix);
- if(ret_value == NULL) {
+ if (ret_value == NULL) {
/* Free the location--casting away const*/
- if(dataset) {
- if(shared_fo == NULL && dataset->shared) { /* Need to free shared fo */
+ if (dataset) {
+ if (shared_fo == NULL && dataset->shared) { /* Need to free shared fo */
dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix);
- dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix);
- dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared);
+ dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix);
+ dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared);
}
H5O_loc_free(&(dataset->oloc));
@@ -1657,14 +1641,13 @@ done:
dataset = H5FL_FREE(H5D_t, dataset);
} /* end if */
- if(shared_fo)
+ if (shared_fo)
shared_fo->fo_count--;
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_open() */
-
/*
*-------------------------------------------------------------------------
* Function: H5D__flush_append_setup
@@ -1677,7 +1660,7 @@ done:
static herr_t
H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id)
{
- herr_t ret_value = SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_STATIC
@@ -1686,60 +1669,60 @@ H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id)
HDassert(dset->shared);
/* Set default append flush values */
- HDmemset(&dset->shared->append_flush, 0, sizeof(dset->shared->append_flush));
+ HDmemset(&dset->shared->append_flush, 0, sizeof(dset->shared->append_flush));
/* If the dataset is chunked and there is a non-default DAPL */
- if(dapl_id != H5P_DATASET_ACCESS_DEFAULT && dset->shared->layout.type == H5D_CHUNKED) {
- H5P_genplist_t *dapl; /* data access property list object pointer */
+ if (dapl_id != H5P_DATASET_ACCESS_DEFAULT && dset->shared->layout.type == H5D_CHUNKED) {
+ H5P_genplist_t *dapl; /* data access property list object pointer */
/* Get dataset access property list */
- if(NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id)))
+ if (NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for dapl ID");
/* Check if append flush property exists */
- if(H5P_exist_plist(dapl, H5D_ACS_APPEND_FLUSH_NAME) > 0) {
+ if (H5P_exist_plist(dapl, H5D_ACS_APPEND_FLUSH_NAME) > 0) {
H5D_append_flush_t info;
/* Get append flush property */
- if(H5P_get(dapl, H5D_ACS_APPEND_FLUSH_NAME, &info) < 0)
+ if (H5P_get(dapl, H5D_ACS_APPEND_FLUSH_NAME, &info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get append flush info")
- if(info.ndims > 0) {
- hsize_t curr_dims[H5S_MAX_RANK]; /* current dimension sizes */
- hsize_t max_dims[H5S_MAX_RANK]; /* current dimension sizes */
- int rank; /* dataspace # of dimensions */
- unsigned u; /* local index variable */
+ if (info.ndims > 0) {
+ hsize_t curr_dims[H5S_MAX_RANK]; /* current dimension sizes */
+ hsize_t max_dims[H5S_MAX_RANK]; /* current dimension sizes */
+ int rank; /* dataspace # of dimensions */
+ unsigned u; /* local index variable */
/* Get dataset rank */
- if((rank = H5S_get_simple_extent_dims(dset->shared->space, curr_dims, max_dims)) < 0)
+ if ((rank = H5S_get_simple_extent_dims(dset->shared->space, curr_dims, max_dims)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions")
- if(info.ndims != (unsigned)rank)
- HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "boundary dimension rank does not match dataset rank")
+ if (info.ndims != (unsigned)rank)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL,
+ "boundary dimension rank does not match dataset rank")
/* Validate boundary sizes */
- for(u = 0; u < info.ndims; u++)
- if(info.boundary[u] != 0) /* when a non-zero boundary is set */
+ for (u = 0; u < info.ndims; u++)
+ if (info.boundary[u] != 0) /* when a non-zero boundary is set */
/* the dimension is extendible? */
- if(max_dims[u] != H5S_UNLIMITED && max_dims[u] == curr_dims[u])
+ if (max_dims[u] != H5S_UNLIMITED && max_dims[u] == curr_dims[u])
break;
/* At least one boundary dimension is not extendible */
- if(u != info.ndims)
+ if (u != info.ndims)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "boundary dimension is not valid")
/* Copy append flush settings */
dset->shared->append_flush.ndims = info.ndims;
- dset->shared->append_flush.func = info.func;
+ dset->shared->append_flush.func = info.func;
dset->shared->append_flush.udata = info.udata;
H5MM_memcpy(dset->shared->append_flush.boundary, info.boundary, sizeof(info.boundary));
} /* end if */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__append_flush_setup() */
-
/*-------------------------------------------------------------------------
* Function: H5D__open_oid
*
@@ -1751,12 +1734,12 @@ done:
static herr_t
H5D__open_oid(H5D_t *dataset, hid_t dapl_id)
{
- H5P_genplist_t *plist; /* Property list */
- H5O_fill_t *fill_prop; /* Pointer to dataset's fill value info */
- unsigned alloc_time_state; /* Allocation time state */
- htri_t msg_exists; /* Whether a particular type of message exists */
- hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *plist; /* Property list */
+ H5O_fill_t * fill_prop; /* Pointer to dataset's fill value info */
+ unsigned alloc_time_state; /* Allocation time state */
+ htri_t msg_exists; /* Whether a particular type of message exists */
+ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_TAG(dataset->oloc.addr)
@@ -1764,67 +1747,67 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id)
HDassert(dataset);
/* (Set the 'vl_type' parameter to FALSE since it doesn't matter from here) */
- if(NULL == (dataset->shared = H5D__new(H5P_DATASET_CREATE_DEFAULT, dapl_id, FALSE, FALSE)))
+ if (NULL == (dataset->shared = H5D__new(H5P_DATASET_CREATE_DEFAULT, dapl_id, FALSE, FALSE)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Open the dataset object */
- if(H5O_open(&(dataset->oloc)) < 0)
+ if (H5O_open(&(dataset->oloc)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open")
/* Get the type and space */
- if(NULL == (dataset->shared->type = (H5T_t *)H5O_msg_read(&(dataset->oloc), H5O_DTYPE_ID, NULL)))
+ if (NULL == (dataset->shared->type = (H5T_t *)H5O_msg_read(&(dataset->oloc), H5O_DTYPE_ID, NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load type info from dataset header")
- if(H5T_set_loc(dataset->shared->type, H5F_VOL_OBJ(dataset->oloc.file), H5T_LOC_DISK) < 0)
+ if (H5T_set_loc(dataset->shared->type, H5F_VOL_OBJ(dataset->oloc.file), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
- if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc))))
+ if (NULL == (dataset->shared->space = H5S_read(&(dataset->oloc))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header")
/* Cache the dataset's dataspace info */
- if(H5D__cache_dataspace_info(dataset) < 0)
+ if (H5D__cache_dataspace_info(dataset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info")
/* Get a datatype ID for the dataset's datatype */
- if((dataset->shared->type_id = H5I_register(H5I_DATATYPE, dataset->shared->type, FALSE)) < 0)
+ if ((dataset->shared->type_id = H5I_register(H5I_DATATYPE, dataset->shared->type, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
/* Get dataset creation property list object */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(dataset->shared->dcpl_id)))
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object(dataset->shared->dcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
/* Get the layout/pline/efl message information */
- if(H5D__layout_oh_read(dataset, dapl_id, plist) < 0)
+ if (H5D__layout_oh_read(dataset, dapl_id, plist) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout/pline/efl info")
/* Indicate that the layout information was initialized */
layout_init = TRUE;
/* Set up flush append property */
- if(H5D__append_flush_setup(dataset, dapl_id))
+ if (H5D__append_flush_setup(dataset, dapl_id))
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set up flush append property")
/* Point at dataset's copy, to cache it for later */
fill_prop = &dataset->shared->dcpl_cache.fill;
/* Try to get the new fill value message from the object header */
- if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_FILL_NEW_ID)) < 0)
+ if ((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_FILL_NEW_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists")
- if(msg_exists) {
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_NEW_ID, fill_prop))
+ if (msg_exists) {
+ if (NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_NEW_ID, fill_prop))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message")
} /* end if */
else {
- /* For backward compatibility, try to retrieve the old fill value message */
- if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_FILL_ID)) < 0)
+ /* For backward compatibility, try to retrieve the old fill value message */
+ if ((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_FILL_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists")
- if(msg_exists) {
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_ID, fill_prop))
+ if (msg_exists) {
+ if (NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_ID, fill_prop))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message")
} /* end if */
else {
/* Set the space allocation time appropriately, based on the type of dataset storage */
- switch(dataset->shared->layout.type) {
+ switch (dataset->shared->layout.type) {
case H5D_COMPACT:
fill_prop->alloc_time = H5D_ALLOC_TIME_EARLY;
break;
@@ -1846,24 +1829,24 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id)
default:
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "not implemented yet")
} /* end switch */ /*lint !e788 All appropriate cases are covered */
- } /* end else */
+ } /* end else */
/* If "old" fill value size is 0 (undefined), map it to -1 */
- if(fill_prop->size == 0)
+ if (fill_prop->size == 0)
fill_prop->size = (ssize_t)-1;
} /* end if */
alloc_time_state = 0;
- if((dataset->shared->layout.type == H5D_COMPACT && fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY)
- || (dataset->shared->layout.type == H5D_CONTIGUOUS && fill_prop->alloc_time == H5D_ALLOC_TIME_LATE)
- || (dataset->shared->layout.type == H5D_CHUNKED && fill_prop->alloc_time == H5D_ALLOC_TIME_INCR)
- || (dataset->shared->layout.type == H5D_VIRTUAL && fill_prop->alloc_time == H5D_ALLOC_TIME_INCR))
+ if ((dataset->shared->layout.type == H5D_COMPACT && fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY) ||
+ (dataset->shared->layout.type == H5D_CONTIGUOUS && fill_prop->alloc_time == H5D_ALLOC_TIME_LATE) ||
+ (dataset->shared->layout.type == H5D_CHUNKED && fill_prop->alloc_time == H5D_ALLOC_TIME_INCR) ||
+ (dataset->shared->layout.type == H5D_VIRTUAL && fill_prop->alloc_time == H5D_ALLOC_TIME_INCR))
alloc_time_state = 1;
/* Set revised fill value properties, if they are different from the defaults */
- if(H5P_fill_value_cmp(&H5D_def_dset.dcpl_cache.fill, fill_prop, sizeof(H5O_fill_t))) {
- if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, fill_prop) < 0)
+ if (H5P_fill_value_cmp(&H5D_def_dset.dcpl_cache.fill, fill_prop, sizeof(H5O_fill_t))) {
+ if (H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, fill_prop) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set fill value")
- if(H5P_set(plist, H5D_CRT_ALLOC_TIME_STATE_NAME, &alloc_time_state) < 0)
+ if (H5P_set(plist, H5D_CRT_ALLOC_TIME_STATE_NAME, &alloc_time_state) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set allocation time state")
} /* end if */
@@ -1872,44 +1855,43 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id)
* This is important only for parallel I/O where the space must
* be fully allocated before I/O can happen.
*/
- if((H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR)
- && !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage)
- && H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_ALLOCATE_EARLY)) {
+ if ((H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR) &&
+ !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) &&
+ H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_ALLOCATE_EARLY)) {
H5D_io_info_t io_info;
io_info.dset = dataset;
- if(H5D__alloc_storage(&io_info, H5D_ALLOC_OPEN, FALSE, NULL) < 0)
+ if (H5D__alloc_storage(&io_info, H5D_ALLOC_OPEN, FALSE, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file storage")
} /* end if */
done:
- if(ret_value < 0) {
- if(H5F_addr_defined(dataset->oloc.addr) && H5O_close(&(dataset->oloc), NULL) < 0)
+ if (ret_value < 0) {
+ if (H5F_addr_defined(dataset->oloc.addr) && H5O_close(&(dataset->oloc), NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header")
- if(dataset->shared) {
- if(layout_init)
- if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset) < 0)
+ if (dataset->shared) {
+ if (layout_init)
+ if (dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info")
- if(dataset->shared->space && H5S_close(dataset->shared->space) < 0)
+ if (dataset->shared->space && H5S_close(dataset->shared->space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
- if(dataset->shared->type) {
- if(dataset->shared->type_id > 0) {
- if(H5I_dec_ref(dataset->shared->type_id) < 0)
+ if (dataset->shared->type) {
+ if (dataset->shared->type_id > 0) {
+ if (H5I_dec_ref(dataset->shared->type_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
} /* end if */
else {
- if(H5T_close_real(dataset->shared->type) < 0)
+ if (H5T_close_real(dataset->shared->type) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
} /* end else */
- } /* end if */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__open_oid() */
-
/*-------------------------------------------------------------------------
* Function: H5D_close
*
@@ -1923,10 +1905,10 @@ done:
herr_t
H5D_close(H5D_t *dataset)
{
- hbool_t free_failed = FALSE; /* Set if freeing sub-components failed */
- hbool_t corked; /* Whether the dataset is corked or not */
- hbool_t file_closed = TRUE; /* H5O_close also closed the file? */
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t free_failed = FALSE; /* Set if freeing sub-components failed */
+ hbool_t corked; /* Whether the dataset is corked or not */
+ hbool_t file_closed = TRUE; /* H5O_close also closed the file? */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1940,10 +1922,10 @@ H5D_close(H5D_t *dataset)
#endif /* H5D_CHUNK_DEBUG */
dataset->shared->fo_count--;
- if(dataset->shared->fo_count == 0) {
+ if (dataset->shared->fo_count == 0) {
/* Flush the dataset's information. Continue to close even if it fails. */
- if(H5D__flush_real(dataset) < 0)
+ if (H5D__flush_real(dataset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info")
/* Set a flag to indicate the dataset is closing, before we start freeing things */
@@ -1953,30 +1935,32 @@ H5D_close(H5D_t *dataset)
dataset->shared->closing = TRUE;
/* Free cached information for each kind of dataset */
- switch(dataset->shared->layout.type) {
+ switch (dataset->shared->layout.type) {
case H5D_CONTIGUOUS:
/* Free the data sieve buffer, if it's been allocated */
- if(dataset->shared->cache.contig.sieve_buf)
- dataset->shared->cache.contig.sieve_buf = (unsigned char *)H5FL_BLK_FREE(sieve_buf,dataset->shared->cache.contig.sieve_buf);
+ if (dataset->shared->cache.contig.sieve_buf)
+ dataset->shared->cache.contig.sieve_buf =
+ (unsigned char *)H5FL_BLK_FREE(sieve_buf, dataset->shared->cache.contig.sieve_buf);
break;
case H5D_CHUNKED:
/* Check for skip list for iterating over chunks during I/O to close */
- if(dataset->shared->cache.chunk.sel_chunks) {
+ if (dataset->shared->cache.chunk.sel_chunks) {
HDassert(H5SL_count(dataset->shared->cache.chunk.sel_chunks) == 0);
H5SL_close(dataset->shared->cache.chunk.sel_chunks);
dataset->shared->cache.chunk.sel_chunks = NULL;
} /* end if */
/* Check for cached single chunk dataspace */
- if(dataset->shared->cache.chunk.single_space) {
+ if (dataset->shared->cache.chunk.single_space) {
(void)H5S_close(dataset->shared->cache.chunk.single_space);
dataset->shared->cache.chunk.single_space = NULL;
} /* end if */
/* Check for cached single element chunk info */
- if(dataset->shared->cache.chunk.single_chunk_info) {
- dataset->shared->cache.chunk.single_chunk_info = H5FL_FREE(H5D_chunk_info_t, dataset->shared->cache.chunk.single_chunk_info);
+ if (dataset->shared->cache.chunk.single_chunk_info) {
+ dataset->shared->cache.chunk.single_chunk_info =
+ H5FL_FREE(H5D_chunk_info_t, dataset->shared->cache.chunk.single_chunk_info);
dataset->shared->cache.chunk.single_chunk_info = NULL;
} /* end if */
break;
@@ -1985,32 +1969,35 @@ H5D_close(H5D_t *dataset)
/* Nothing special to do (info freed in the layout destroy) */
break;
- case H5D_VIRTUAL:
- {
+ case H5D_VIRTUAL: {
size_t i, j;
- HDassert(dataset->shared->layout.storage.u.virt.list || (dataset->shared->layout.storage.u.virt.list_nused == 0));
+ HDassert(dataset->shared->layout.storage.u.virt.list ||
+ (dataset->shared->layout.storage.u.virt.list_nused == 0));
/* Close source datasets */
- for(i = 0; i < dataset->shared->layout.storage.u.virt.list_nused; i++) {
+ for (i = 0; i < dataset->shared->layout.storage.u.virt.list_nused; i++) {
/* Close source dataset */
- if(dataset->shared->layout.storage.u.virt.list[i].source_dset.dset) {
+ if (dataset->shared->layout.storage.u.virt.list[i].source_dset.dset) {
HDassert(dataset->shared->layout.storage.u.virt.list[i].source_dset.dset != dataset);
- if(H5D_close(dataset->shared->layout.storage.u.virt.list[i].source_dset.dset) < 0)
+ if (H5D_close(dataset->shared->layout.storage.u.virt.list[i].source_dset.dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close source dataset")
dataset->shared->layout.storage.u.virt.list[i].source_dset.dset = NULL;
} /* end if */
/* Close sub datasets */
- for(j = 0; j < dataset->shared->layout.storage.u.virt.list[i].sub_dset_nused; j++)
- if(dataset->shared->layout.storage.u.virt.list[i].sub_dset[j].dset) {
- HDassert(dataset->shared->layout.storage.u.virt.list[i].sub_dset[j].dset != dataset);
- if(H5D_close(dataset->shared->layout.storage.u.virt.list[i].sub_dset[j].dset) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close source dataset")
+ for (j = 0; j < dataset->shared->layout.storage.u.virt.list[i].sub_dset_nused; j++)
+ if (dataset->shared->layout.storage.u.virt.list[i].sub_dset[j].dset) {
+ HDassert(dataset->shared->layout.storage.u.virt.list[i].sub_dset[j].dset !=
+ dataset);
+ if (H5D_close(dataset->shared->layout.storage.u.virt.list[i].sub_dset[j].dset) <
+ 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL,
+ "unable to close source dataset")
dataset->shared->layout.storage.u.virt.list[i].sub_dset[j].dset = NULL;
} /* end if */
- } /* end for */
- } /* end block */
+ } /* end for */
+ } /* end block */
break;
case H5D_LAYOUT_ERROR:
@@ -2019,11 +2006,11 @@ H5D_close(H5D_t *dataset)
HDassert("not implemented yet" && 0);
#ifdef NDEBUG
HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
-#endif /* NDEBUG */
+#endif /* NDEBUG */
} /* end switch */ /*lint !e788 All appropriate cases are covered */
/* Destroy any cached layout information for the dataset */
- if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset) < 0)
+ if (dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info")
/* Free the external file prefix */
@@ -2033,43 +2020,42 @@ H5D_close(H5D_t *dataset)
dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix);
/* Release layout, fill-value, efl & pipeline messages */
- if(dataset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT)
+ if (dataset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT)
free_failed |= (H5O_msg_reset(H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline) < 0) ||
- (H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0) ||
- (H5O_msg_reset(H5O_FILL_ID, &dataset->shared->dcpl_cache.fill) < 0) ||
- (H5O_msg_reset(H5O_EFL_ID, &dataset->shared->dcpl_cache.efl) < 0);
+ (H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0) ||
+ (H5O_msg_reset(H5O_FILL_ID, &dataset->shared->dcpl_cache.fill) < 0) ||
+ (H5O_msg_reset(H5O_EFL_ID, &dataset->shared->dcpl_cache.efl) < 0);
/* Uncork cache entries with object address tag */
- if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__GET_CORKED, &corked) < 0)
+ if (H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__GET_CORKED, &corked) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status")
- if(corked)
- if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0)
+ if (corked)
+ if (H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object")
/* Release datatype, dataspace, and creation and access property lists -- there isn't
* much we can do if one of these fails, so we just continue.
*/
- free_failed |= (H5I_dec_ref(dataset->shared->type_id) < 0) ||
- (H5S_close(dataset->shared->space) < 0) ||
- (H5I_dec_ref(dataset->shared->dcpl_id) < 0) ||
- (H5I_dec_ref(dataset->shared->dapl_id) < 0);
+ free_failed |=
+ (H5I_dec_ref(dataset->shared->type_id) < 0) || (H5S_close(dataset->shared->space) < 0) ||
+ (H5I_dec_ref(dataset->shared->dcpl_id) < 0) || (H5I_dec_ref(dataset->shared->dapl_id) < 0);
/* Remove the dataset from the list of opened objects in the file */
- if(H5FO_top_decr(dataset->oloc.file, dataset->oloc.addr) < 0)
+ if (H5FO_top_decr(dataset->oloc.file, dataset->oloc.addr) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object")
- if(H5FO_delete(dataset->oloc.file, dataset->oloc.addr) < 0)
+ if (H5FO_delete(dataset->oloc.file, dataset->oloc.addr) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't remove dataset from list of open objects")
/* Close the dataset object */
/* (This closes the file, if this is the last object open) */
- if(H5O_close(&(dataset->oloc), &file_closed) < 0)
+ if (H5O_close(&(dataset->oloc), &file_closed) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header")
/* Evict dataset metadata if evicting on close */
- if(!file_closed && H5F_SHARED(dataset->oloc.file) && H5F_EVICT_ON_CLOSE(dataset->oloc.file)) {
- if(H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr) < 0)
+ if (!file_closed && H5F_SHARED(dataset->oloc.file) && H5F_EVICT_ON_CLOSE(dataset->oloc.file)) {
+ if (H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr) < 0)
HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata")
- if(H5AC_evict_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, FALSE) < 0)
+ if (H5AC_evict_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, FALSE) < 0)
HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata")
} /* end if */
@@ -2080,41 +2066,41 @@ H5D_close(H5D_t *dataset)
* above).
*/
dataset->oloc.file = NULL;
- dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared);
+ dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared);
} /* end if */
else {
/* Decrement the ref. count for this object in the top file */
- if(H5FO_top_decr(dataset->oloc.file, dataset->oloc.addr) < 0)
+ if (H5FO_top_decr(dataset->oloc.file, dataset->oloc.addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object")
/* Check reference count for this object in the top file */
- if(H5FO_top_count(dataset->oloc.file, dataset->oloc.addr) == 0) {
- if(H5O_close(&(dataset->oloc), NULL) < 0)
+ if (H5FO_top_count(dataset->oloc.file, dataset->oloc.addr) == 0) {
+ if (H5O_close(&(dataset->oloc), NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to close")
} /* end if */
else
/* Free object location (i.e. "unhold" the file if appropriate) */
- if(H5O_loc_free(&(dataset->oloc)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "problem attempting to free location")
+ if (H5O_loc_free(&(dataset->oloc)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "problem attempting to free location")
} /* end else */
/* Release the dataset's path info */
- if(H5G_name_free(&(dataset->path)) < 0)
+ if (H5G_name_free(&(dataset->path)) < 0)
free_failed = TRUE;
/* Free the dataset's memory structure */
dataset = H5FL_FREE(H5D_t, dataset);
/* Check if anything failed in the middle... */
- if(free_failed)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't free a component of the dataset, but the dataset was freed anyway.")
+ if (free_failed)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "couldn't free a component of the dataset, but the dataset was freed anyway.")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_close() */
-
/*-------------------------------------------------------------------------
* Function: H5D_mult_refresh_close
*
@@ -2127,12 +2113,12 @@ done:
herr_t
H5D_mult_refresh_close(hid_t dset_id)
{
- H5D_t *dataset; /* Dataset to refresh */
- herr_t ret_value = SUCCEED; /* return value */
+ H5D_t *dataset; /* Dataset to refresh */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_NOAPI(FAIL)
- if(NULL == (dataset = (H5D_t *)H5VL_object_verify(dset_id, H5I_DATASET)))
+ if (NULL == (dataset = (H5D_t *)H5VL_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
/* check args */
@@ -2141,32 +2127,34 @@ H5D_mult_refresh_close(hid_t dset_id)
HDassert(dataset->shared);
HDassert(dataset->shared->fo_count > 0);
- if(dataset->shared->fo_count > 1) {
+ if (dataset->shared->fo_count > 1) {
/* Free cached information for each kind of dataset */
- switch(dataset->shared->layout.type) {
+ switch (dataset->shared->layout.type) {
case H5D_CONTIGUOUS:
/* Free the data sieve buffer, if it's been allocated */
- if(dataset->shared->cache.contig.sieve_buf)
- dataset->shared->cache.contig.sieve_buf = (unsigned char *)H5FL_BLK_FREE(sieve_buf,dataset->shared->cache.contig.sieve_buf);
+ if (dataset->shared->cache.contig.sieve_buf)
+ dataset->shared->cache.contig.sieve_buf =
+ (unsigned char *)H5FL_BLK_FREE(sieve_buf, dataset->shared->cache.contig.sieve_buf);
break;
case H5D_CHUNKED:
/* Check for skip list for iterating over chunks during I/O to close */
- if(dataset->shared->cache.chunk.sel_chunks) {
+ if (dataset->shared->cache.chunk.sel_chunks) {
HDassert(H5SL_count(dataset->shared->cache.chunk.sel_chunks) == 0);
H5SL_close(dataset->shared->cache.chunk.sel_chunks);
dataset->shared->cache.chunk.sel_chunks = NULL;
} /* end if */
/* Check for cached single chunk dataspace */
- if(dataset->shared->cache.chunk.single_space) {
+ if (dataset->shared->cache.chunk.single_space) {
(void)H5S_close(dataset->shared->cache.chunk.single_space);
dataset->shared->cache.chunk.single_space = NULL;
} /* end if */
/* Check for cached single element chunk info */
- if(dataset->shared->cache.chunk.single_chunk_info) {
- dataset->shared->cache.chunk.single_chunk_info = H5FL_FREE(H5D_chunk_info_t, dataset->shared->cache.chunk.single_chunk_info);
+ if (dataset->shared->cache.chunk.single_chunk_info) {
+ dataset->shared->cache.chunk.single_chunk_info =
+ H5FL_FREE(H5D_chunk_info_t, dataset->shared->cache.chunk.single_chunk_info);
dataset->shared->cache.chunk.single_chunk_info = NULL;
} /* end if */
break;
@@ -2182,11 +2170,11 @@ H5D_mult_refresh_close(hid_t dset_id)
HDassert("not implemented yet" && 0);
#ifdef NDEBUG
HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
-#endif /* NDEBUG */
+#endif /* NDEBUG */
} /* end switch */ /*lint !e788 All appropriate cases are covered */
/* Destroy any cached layout information for the dataset */
- if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset) < 0)
+ if (dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info")
} /* end if */
@@ -2194,7 +2182,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_mult_refresh_close() */
-
/*-------------------------------------------------------------------------
* Function: H5D_mult_refresh_reopen
*
@@ -2207,7 +2194,7 @@ done:
herr_t
H5D_mult_refresh_reopen(H5D_t *dataset)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2215,25 +2202,25 @@ H5D_mult_refresh_reopen(H5D_t *dataset)
HDassert(dataset && dataset->oloc.file && dataset->shared);
HDassert(dataset->shared->fo_count > 0);
- if(dataset->shared->fo_count > 1) {
+ if (dataset->shared->fo_count > 1) {
/* Release dataspace info */
- if(H5S_close(dataset->shared->space) < 0)
+ if (H5S_close(dataset->shared->space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
/* Re-load dataspace info */
- if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc))))
+ if (NULL == (dataset->shared->space = H5S_read(&(dataset->oloc))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header")
/* Cache the dataset's dataspace info */
- if(H5D__cache_dataspace_info(dataset) < 0)
+ if (H5D__cache_dataspace_info(dataset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info")
/* Release layout info */
- if(H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0)
+ if (H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout info")
/* Re-load layout message info */
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout)))
+ if (NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message")
} /* end if */
@@ -2241,7 +2228,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D_mult_refresh_reopen() */
-
/*-------------------------------------------------------------------------
* Function: H5D_oloc
*
@@ -2260,7 +2246,6 @@ H5D_oloc(H5D_t *dataset)
FUNC_LEAVE_NOAPI(dataset ? &(dataset->oloc) : (H5O_loc_t *)NULL)
} /* end H5D_oloc() */
-
/*-------------------------------------------------------------------------
* Function: H5D_nameof
*
@@ -2279,7 +2264,6 @@ H5D_nameof(const H5D_t *dataset)
FUNC_LEAVE_NOAPI(dataset ? &(dataset->path) : NULL)
} /* end H5D_nameof() */
-
/*-------------------------------------------------------------------------
* Function: H5D__alloc_storage
*
@@ -2289,15 +2273,15 @@ H5D_nameof(const H5D_t *dataset)
*-------------------------------------------------------------------------
*/
herr_t
-H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
- hbool_t full_overwrite, hsize_t old_dim[])
+H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hbool_t full_overwrite,
+ hsize_t old_dim[])
{
- const H5D_t *dset = io_info->dset; /* The dataset object */
- H5F_t *f = dset->oloc.file; /* The dataset's file pointer */
- H5O_layout_t *layout; /* The dataset's layout information */
- hbool_t must_init_space = FALSE; /* Flag to indicate that space should be initialized */
- hbool_t addr_set = FALSE; /* Flag to indicate that the dataset's storage address was set */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5D_t * dset = io_info->dset; /* The dataset object */
+ H5F_t * f = dset->oloc.file; /* The dataset's file pointer */
+ H5O_layout_t *layout; /* The dataset's layout information */
+ hbool_t must_init_space = FALSE; /* Flag to indicate that space should be initialized */
+ hbool_t addr_set = FALSE; /* Flag to indicate that the dataset's storage address was set */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2309,17 +2293,17 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
* We assume that external storage is already
* allocated by the caller, or at least will be before I/O is performed.
*/
- if(!(0 == H5S_GET_EXTENT_NPOINTS(dset->shared->space) || dset->shared->dcpl_cache.efl.nused > 0)) {
+ if (!(0 == H5S_GET_EXTENT_NPOINTS(dset->shared->space) || dset->shared->dcpl_cache.efl.nused > 0)) {
/* Get a pointer to the dataset's layout information */
layout = &(dset->shared->layout);
- switch(layout->type) {
+ switch (layout->type) {
case H5D_CONTIGUOUS:
- if(!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) {
+ if (!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) {
/* Check if we have a zero-sized dataset */
- if(layout->storage.u.contig.size > 0) {
+ if (layout->storage.u.contig.size > 0) {
/* Reserve space in the file for the entire array */
- if(H5D__contig_alloc(f, &layout->storage.u.contig/*out*/) < 0)
+ if (H5D__contig_alloc(f, &layout->storage.u.contig /*out*/) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize contiguous storage")
/* Indicate that we should initialize storage space */
@@ -2334,9 +2318,9 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
break;
case H5D_CHUNKED:
- if(!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) {
+ if (!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) {
/* Create the root of the index that manages chunked storage */
- if(H5D__chunk_create(dset /*in,out*/) < 0)
+ if (H5D__chunk_create(dset /*in,out*/) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
/* Indicate that we set the storage addr */
@@ -2350,21 +2334,24 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
* the dataset, indicate that space should be allocated, so the
* index gets expanded. -QAK
*/
- if(dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY && time_alloc == H5D_ALLOC_EXTEND)
+ if (dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY &&
+ time_alloc == H5D_ALLOC_EXTEND)
must_init_space = TRUE;
break;
case H5D_COMPACT:
/* Check if space is already allocated */
- if(NULL == layout->storage.u.compact.buf) {
+ if (NULL == layout->storage.u.compact.buf) {
/* Reserve space in layout header message for the entire array.
* Starting from the 1.8.7 release, we allow dataspace to have
* zero dimension size. So the storage size can be zero.
* SLU 2011/4/4 */
- if(layout->storage.u.compact.size > 0) {
- if(NULL == (layout->storage.u.compact.buf = H5MM_malloc(layout->storage.u.compact.size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for compact dataset")
- if(!full_overwrite)
+ if (layout->storage.u.compact.size > 0) {
+ if (NULL ==
+ (layout->storage.u.compact.buf = H5MM_malloc(layout->storage.u.compact.size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "unable to allocate memory for compact dataset")
+ if (!full_overwrite)
HDmemset(layout->storage.u.compact.buf, 0, layout->storage.u.compact.size);
layout->storage.u.compact.dirty = TRUE;
@@ -2373,7 +2360,7 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
}
else {
layout->storage.u.compact.dirty = FALSE;
- must_init_space = FALSE;
+ must_init_space = FALSE;
}
} /* end if */
break;
@@ -2393,12 +2380,12 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
HDassert("not implemented yet" && 0);
#ifdef NDEBUG
HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
-#endif /* NDEBUG */
+#endif /* NDEBUG */
} /* end switch */ /*lint !e788 All appropriate cases are covered */
/* Check if we need to initialize the space */
- if(must_init_space) {
- if(layout->type == H5D_CHUNKED) {
+ if (must_init_space) {
+ if (layout->type == H5D_CHUNKED) {
/* If we are doing incremental allocation and the index got
* created during a H5Dwrite call, don't initialize the storage
* now, wait for the actual writes to each block and let the
@@ -2408,25 +2395,29 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
* fill values to the chunks they allocate space for. Yes,
* this is icky. -QAK
*/
- if(!(dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_INCR && time_alloc == H5D_ALLOC_WRITE))
- if(H5D__init_storage(io_info, full_overwrite, old_dim) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value")
+ if (!(dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_INCR &&
+ time_alloc == H5D_ALLOC_WRITE))
+ if (H5D__init_storage(io_info, full_overwrite, old_dim) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to initialize dataset with fill value")
} /* end if */
else {
- H5D_fill_value_t fill_status; /* The fill value status */
+ H5D_fill_value_t fill_status; /* The fill value status */
/* Check the dataset's fill-value status */
- if(H5P_is_fill_value_defined(&dset->shared->dcpl_cache.fill, &fill_status) < 0)
+ if (H5P_is_fill_value_defined(&dset->shared->dcpl_cache.fill, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
/* If we are filling the dataset on allocation or "if set" and
* the fill value _is_ set, do that now */
- if(dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC ||
- (dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_USER_DEFINED))
- if(H5D__init_storage(io_info, full_overwrite, old_dim) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value")
+ if (dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC ||
+ (dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET &&
+ fill_status == H5D_FILL_VALUE_USER_DEFINED))
+ if (H5D__init_storage(io_info, full_overwrite, old_dim) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to initialize dataset with fill value")
} /* end else */
- } /* end if */
+ } /* end if */
/* If we set the address (and aren't in the middle of creating the
* dataset), mark the layout header message for later writing to
@@ -2435,9 +2426,9 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
/* (The layout message is already in the dataset's object header, this
* operation just sets the address and makes it constant)
*/
- if(time_alloc != H5D_ALLOC_CREATE && addr_set)
+ if (time_alloc != H5D_ALLOC_CREATE && addr_set)
/* Mark the layout as dirty, for later writing to the file */
- if(H5D__mark(dset, H5D_MARK_LAYOUT) < 0)
+ if (H5D__mark(dset, H5D_MARK_LAYOUT) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty")
} /* end if */
@@ -2445,7 +2436,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__alloc_storage() */
-
/*-------------------------------------------------------------------------
* Function: H5D__init_storage
*
@@ -2459,8 +2449,8 @@ done:
static herr_t
H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[])
{
- const H5D_t *dset = io_info->dset; /* dataset pointer */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5D_t *dset = io_info->dset; /* dataset pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2469,18 +2459,20 @@ H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t
switch (dset->shared->layout.type) {
case H5D_COMPACT:
/* If we will be immediately overwriting the values, don't bother to clear them */
- if(!full_overwrite) {
+ if (!full_overwrite) {
/* Fill the compact dataset storage */
- if(H5D__compact_fill(dset) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize compact dataset storage")
+ if (H5D__compact_fill(dset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to initialize compact dataset storage")
} /* end if */
break;
case H5D_CONTIGUOUS:
/* Don't write default fill values to external files */
/* If we will be immediately overwriting the values, don't bother to clear them */
- if((dset->shared->dcpl_cache.efl.nused == 0 || dset->shared->dcpl_cache.fill.buf) && !full_overwrite)
- if(H5D__contig_fill(io_info) < 0)
+ if ((dset->shared->dcpl_cache.efl.nused == 0 || dset->shared->dcpl_cache.fill.buf) &&
+ !full_overwrite)
+ if (H5D__contig_fill(io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate all chunks of dataset")
break;
@@ -2490,13 +2482,13 @@ H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t
* for all chunks now and initialize each chunk with the fill value.
*/
{
- hsize_t zero_dim[H5O_LAYOUT_NDIMS] = {0};
+ hsize_t zero_dim[H5O_LAYOUT_NDIMS] = {0};
/* Use zeros for old dimensions if not specified */
- if(old_dim == NULL)
+ if (old_dim == NULL)
old_dim = zero_dim;
- if(H5D__chunk_allocate(io_info, full_overwrite, old_dim) < 0)
+ if (H5D__chunk_allocate(io_info, full_overwrite, old_dim) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate all chunks of dataset")
break;
} /* end block */
@@ -2510,14 +2502,13 @@ H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t
HDassert("not implemented yet" && 0);
#ifdef NDEBUG
HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout")
-#endif /* NDEBUG */
+#endif /* NDEBUG */
} /* end switch */ /*lint !e788 All appropriate cases are covered */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__init_storage() */
-
/*-------------------------------------------------------------------------
* Function: H5D__get_storage_size
*
@@ -2530,15 +2521,16 @@ done:
herr_t
H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
- switch(dset->shared->layout.type) {
+ switch (dset->shared->layout.type) {
case H5D_CHUNKED:
- if((*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) {
- if(H5D__chunk_allocated(dset, storage_size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve chunked dataset allocated size")
+ if ((*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) {
+ if (H5D__chunk_allocated(dset, storage_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't retrieve chunked dataset allocated size")
} /* end if */
else
*storage_size = 0;
@@ -2546,7 +2538,7 @@ H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size)
case H5D_CONTIGUOUS:
/* Datasets which are not allocated yet are using no space on disk */
- if((*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage))
+ if ((*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage))
*storage_size = dset->shared->layout.storage.u.contig.size;
else
*storage_size = 0;
@@ -2572,7 +2564,6 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__get_storage_size() */
-
/*-------------------------------------------------------------------------
* Function: H5D__get_offset
*
@@ -2588,13 +2579,13 @@ done:
haddr_t
H5D__get_offset(const H5D_t *dset)
{
- haddr_t ret_value = HADDR_UNDEF;
+ haddr_t ret_value = HADDR_UNDEF;
FUNC_ENTER_PACKAGE
HDassert(dset);
- switch(dset->shared->layout.type) {
+ switch (dset->shared->layout.type) {
case H5D_VIRTUAL:
case H5D_CHUNKED:
case H5D_COMPACT:
@@ -2604,7 +2595,8 @@ H5D__get_offset(const H5D_t *dset)
/* If dataspace hasn't been allocated or dataset is stored in
* an external file, the value will be HADDR_UNDEF.
*/
- if(dset->shared->dcpl_cache.efl.nused == 0 || H5F_addr_defined(dset->shared->layout.storage.u.contig.addr))
+ if (dset->shared->dcpl_cache.efl.nused == 0 ||
+ H5F_addr_defined(dset->shared->layout.storage.u.contig.addr))
/* Return the absolute dataset offset from the beginning of file. */
ret_value = dset->shared->layout.storage.u.contig.addr + H5F_BASE_ADDR(dset->oloc.file);
break;
@@ -2619,7 +2611,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__get_offset() */
-
/*-------------------------------------------------------------------------
* Function: H5D__vlen_get_buf_size_alloc
*
@@ -2636,13 +2627,14 @@ static void *
H5D__vlen_get_buf_size_alloc(size_t size, void *info)
{
H5D_vlen_bufsize_common_t *vlen_bufsize_com = (H5D_vlen_bufsize_common_t *)info;
- void *ret_value = NULL; /* Return value */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
/* Check for increasing the size of the temporary space for VL data */
- if(size > vlen_bufsize_com->vl_tbuf_size) {
- if(NULL == (vlen_bufsize_com->vl_tbuf = H5FL_BLK_REALLOC(vlen_vl_buf, vlen_bufsize_com->vl_tbuf, size)))
+ if (size > vlen_bufsize_com->vl_tbuf_size) {
+ if (NULL ==
+ (vlen_bufsize_com->vl_tbuf = H5FL_BLK_REALLOC(vlen_vl_buf, vlen_bufsize_com->vl_tbuf, size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't reallocate temporary VL data buffer")
vlen_bufsize_com->vl_tbuf_size = size;
} /* end if */
@@ -2657,7 +2649,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__vlen_get_buf_size_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5D__vlen_get_buf_size_cb
*
@@ -2668,11 +2659,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__vlen_get_buf_size_cb(void H5_ATTR_UNUSED *elem, hid_t type_id,
- unsigned H5_ATTR_UNUSED ndim, const hsize_t *point, void *op_data)
+H5D__vlen_get_buf_size_cb(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned H5_ATTR_UNUSED ndim,
+ const hsize_t *point, void *op_data)
{
H5D_vlen_bufsize_native_t *vlen_bufsize = (H5D_vlen_bufsize_native_t *)op_data;
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -2682,18 +2673,18 @@ H5D__vlen_get_buf_size_cb(void H5_ATTR_UNUSED *elem, hid_t type_id,
HDassert(op_data);
/* Select point to read in */
- if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0)
+ if (H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, H5_ITER_ERROR, "can't select point")
/* Read in the point (with the custom VL memory allocator) */
- if(H5D__read(vlen_bufsize->dset, type_id, vlen_bufsize->mspace, vlen_bufsize->fspace, vlen_bufsize->common.fl_tbuf) < 0)
+ if (H5D__read(vlen_bufsize->dset, type_id, vlen_bufsize->mspace, vlen_bufsize->fspace,
+ vlen_bufsize->common.fl_tbuf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, H5_ITER_ERROR, "can't read point")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__vlen_get_buf_size_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__vlen_get_buf_size
*
@@ -2719,80 +2710,78 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__vlen_get_buf_size(H5D_t *dset, hid_t type_id, hid_t space_id,
- hsize_t *size)
+H5D__vlen_get_buf_size(H5D_t *dset, hid_t type_id, hid_t space_id, hsize_t *size)
{
H5D_vlen_bufsize_native_t vlen_bufsize = {NULL, NULL, NULL, {NULL, NULL, 0, 0}};
- H5S_t *fspace = NULL; /* Dataset's dataspace */
- H5S_t *mspace = NULL; /* Memory dataspace */
- char bogus; /* bogus value to pass to H5Diterate() */
- H5S_t *space; /* Dataspace for iteration */
- H5T_t *type; /* Datatype */
- H5S_sel_iter_op_t dset_op; /* Operator for iteration */
- herr_t ret_value = FAIL; /* Return value */
+ H5S_t * fspace = NULL; /* Dataset's dataspace */
+ H5S_t * mspace = NULL; /* Memory dataspace */
+ char bogus; /* bogus value to pass to H5Diterate() */
+ H5S_t * space; /* Dataspace for iteration */
+ H5T_t * type; /* Datatype */
+ H5S_sel_iter_op_t dset_op; /* Operator for iteration */
+ herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE
/* Check args */
- if(NULL == (type = (H5T_t *)H5I_object(type_id)))
+ if (NULL == (type = (H5T_t *)H5I_object(type_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype")
- if(NULL == (space = (H5S_t *)H5I_object(space_id)))
+ if (NULL == (space = (H5S_t *)H5I_object(space_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
- if(!(H5S_has_extent(space)))
+ if (!(H5S_has_extent(space)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
/* Save the dataset */
vlen_bufsize.dset = dset;
/* Get a copy of the dataset's dataspace */
- if(NULL == (fspace = H5S_copy(dset->shared->space, FALSE, TRUE)))
+ if (NULL == (fspace = H5S_copy(dset->shared->space, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to get dataspace")
vlen_bufsize.fspace = fspace;
/* Create a scalar for the memory dataspace */
- if(NULL == (mspace = H5S_create(H5S_SCALAR)))
+ if (NULL == (mspace = H5S_create(H5S_SCALAR)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace")
vlen_bufsize.mspace = mspace;
/* Grab the temporary buffers required */
- if(NULL == (vlen_bufsize.common.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, H5T_get_size(type))))
+ if (NULL == (vlen_bufsize.common.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, H5T_get_size(type))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available")
- if(NULL == (vlen_bufsize.common.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1)))
+ if (NULL == (vlen_bufsize.common.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available")
vlen_bufsize.common.vl_tbuf_size = 1;
/* Set the memory manager to the special allocation routine */
- if(H5CX_set_vlen_alloc_info(H5D__vlen_get_buf_size_alloc, &vlen_bufsize.common, NULL, NULL) < 0)
+ if (H5CX_set_vlen_alloc_info(H5D__vlen_get_buf_size_alloc, &vlen_bufsize.common, NULL, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine")
/* Set the initial number of bytes required */
vlen_bufsize.common.size = 0;
/* Call H5S_select_iterate with args, etc. */
- dset_op.op_type = H5S_SEL_ITER_OP_APP;
- dset_op.u.app_op.op = H5D__vlen_get_buf_size_cb;
- dset_op.u.app_op.type_id = type_id;
+ dset_op.op_type = H5S_SEL_ITER_OP_APP;
+ dset_op.u.app_op.op = H5D__vlen_get_buf_size_cb;
+ dset_op.u.app_op.type_id = type_id;
ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize);
/* Get the size if we succeeded */
- if(ret_value >= 0)
+ if (ret_value >= 0)
*size = vlen_bufsize.common.size;
done:
- if(fspace && H5S_close(fspace) < 0)
+ if (fspace && H5S_close(fspace) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
- if(mspace && H5S_close(mspace) < 0)
+ if (mspace && H5S_close(mspace) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
- if(vlen_bufsize.common.fl_tbuf != NULL)
+ if (vlen_bufsize.common.fl_tbuf != NULL)
vlen_bufsize.common.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.common.fl_tbuf);
- if(vlen_bufsize.common.vl_tbuf != NULL)
+ if (vlen_bufsize.common.vl_tbuf != NULL)
vlen_bufsize.common.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.common.vl_tbuf);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__vlen_get_buf_size() */
-
/*-------------------------------------------------------------------------
* Function: H5D__vlen_get_buf_size_gen_cb
*
@@ -2815,12 +2804,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__vlen_get_buf_size_gen_cb(void H5_ATTR_UNUSED *elem, hid_t type_id,
- unsigned H5_ATTR_UNUSED ndim, const hsize_t *point, void *op_data)
+H5D__vlen_get_buf_size_gen_cb(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned H5_ATTR_UNUSED ndim,
+ const hsize_t *point, void *op_data)
{
H5D_vlen_bufsize_generic_t *vlen_bufsize = (H5D_vlen_bufsize_generic_t *)op_data;
- H5T_t *dt; /* Datatype for operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5T_t * dt; /* Datatype for operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2829,26 +2818,28 @@ H5D__vlen_get_buf_size_gen_cb(void H5_ATTR_UNUSED *elem, hid_t type_id,
HDassert(op_data);
/* Check args */
- if(NULL == (dt = (H5T_t *)H5I_object(type_id)))
+ if (NULL == (dt = (H5T_t *)H5I_object(type_id)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a datatype")
/* Make certain there is enough fixed-length buffer available */
- if(NULL == (vlen_bufsize->common.fl_tbuf = H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->common.fl_tbuf, H5T_get_size(dt))))
+ if (NULL == (vlen_bufsize->common.fl_tbuf =
+ H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->common.fl_tbuf, H5T_get_size(dt))))
HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't resize tbuf")
/* Select point to read in */
- if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0)
+ if (H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point")
/* Read in the point (with the custom VL memory allocator) */
- if(H5VL_dataset_read(vlen_bufsize->dset_vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, vlen_bufsize->dxpl_id, vlen_bufsize->common.fl_tbuf, H5_REQUEST_NULL) < 0)
+ if (H5VL_dataset_read(vlen_bufsize->dset_vol_obj, type_id, vlen_bufsize->mspace_id,
+ vlen_bufsize->fspace_id, vlen_bufsize->dxpl_id, vlen_bufsize->common.fl_tbuf,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__vlen_get_buf_size_gen_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D__vlen_get_buf_size_gen
*
@@ -2863,105 +2854,105 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id,
- hsize_t *size)
+H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id, hsize_t *size)
{
- H5D_vlen_bufsize_generic_t vlen_bufsize = {NULL, H5I_INVALID_HID, NULL, H5I_INVALID_HID, H5I_INVALID_HID, {NULL, NULL, 0, 0}};
- H5P_genplist_t *dxpl = NULL; /* DXPL for operation */
- H5S_t *mspace = NULL; /* Memory dataspace */
- char bogus; /* Bogus value to pass to H5Diterate() */
- H5S_t *space; /* Dataspace for iteration */
- H5T_t *type; /* Datatype */
- H5S_sel_iter_op_t dset_op; /* Operator for iteration */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_vlen_bufsize_generic_t vlen_bufsize = {
+ NULL, H5I_INVALID_HID, NULL, H5I_INVALID_HID, H5I_INVALID_HID, {NULL, NULL, 0, 0}};
+ H5P_genplist_t * dxpl = NULL; /* DXPL for operation */
+ H5S_t * mspace = NULL; /* Memory dataspace */
+ char bogus; /* Bogus value to pass to H5Diterate() */
+ H5S_t * space; /* Dataspace for iteration */
+ H5T_t * type; /* Datatype */
+ H5S_sel_iter_op_t dset_op; /* Operator for iteration */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Check args */
- if(NULL == (type = (H5T_t *)H5I_object(type_id)))
+ if (NULL == (type = (H5T_t *)H5I_object(type_id)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not an valid datatype")
- if(NULL == (space = (H5S_t *)H5I_object(space_id)))
+ if (NULL == (space = (H5S_t *)H5I_object(space_id)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "invalid dataspace")
- if(!(H5S_has_extent(space)))
+ if (!(H5S_has_extent(space)))
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
/* Save the dataset */
vlen_bufsize.dset_vol_obj = vol_obj;
/* Get a copy of the dataset's dataspace */
- if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0)
+ if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ &vlen_bufsize.fspace_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace")
- if(NULL == (vlen_bufsize.fspace = (H5S_t *)H5I_object(vlen_bufsize.fspace_id)))
+ if (NULL == (vlen_bufsize.fspace = (H5S_t *)H5I_object(vlen_bufsize.fspace_id)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataspace")
/* Create a scalar for the memory dataspace */
- if(NULL == (mspace = H5S_create(H5S_SCALAR)))
+ if (NULL == (mspace = H5S_create(H5S_SCALAR)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create dataspace")
- if((vlen_bufsize.mspace_id = H5I_register(H5I_DATASPACE, mspace, TRUE)) < 0)
+ if ((vlen_bufsize.mspace_id = H5I_register(H5I_DATASPACE, mspace, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
/* Grab the temporary buffers required */
- if(NULL == (vlen_bufsize.common.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, H5T_get_size(type))))
+ if (NULL == (vlen_bufsize.common.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, H5T_get_size(type))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "no temporary buffers available")
- if(NULL == (vlen_bufsize.common.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1)))
+ if (NULL == (vlen_bufsize.common.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "no temporary buffers available")
vlen_bufsize.common.vl_tbuf_size = 1;
/* Set the VL allocation callbacks on a DXPL */
- if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT)))
+ if (NULL == (dxpl = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get default DXPL")
- if((vlen_bufsize.dxpl_id = H5P_copy_plist(dxpl, TRUE)) < 0)
+ if ((vlen_bufsize.dxpl_id = H5P_copy_plist(dxpl, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy property list");
- if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(vlen_bufsize.dxpl_id)))
+ if (NULL == (dxpl = (H5P_genplist_t *)H5I_object(vlen_bufsize.dxpl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get copied DXPL")
- if(H5P_set_vlen_mem_manager(dxpl, H5D__vlen_get_buf_size_alloc, &vlen_bufsize.common, NULL, NULL) < 0)
+ if (H5P_set_vlen_mem_manager(dxpl, H5D__vlen_get_buf_size_alloc, &vlen_bufsize.common, NULL, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine on DXPL")
/* Set the initial number of bytes required */
vlen_bufsize.common.size = 0;
/* Call H5S_select_iterate with args, etc. */
- dset_op.op_type = H5S_SEL_ITER_OP_APP;
- dset_op.u.app_op.op = H5D__vlen_get_buf_size_gen_cb;
- dset_op.u.app_op.type_id = type_id;
+ dset_op.op_type = H5S_SEL_ITER_OP_APP;
+ dset_op.u.app_op.op = H5D__vlen_get_buf_size_gen_cb;
+ dset_op.u.app_op.type_id = type_id;
ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize);
/* Get the size if we succeeded */
- if(ret_value >= 0)
+ if (ret_value >= 0)
*size = vlen_bufsize.common.size;
done:
- if(vlen_bufsize.fspace_id >= 0) {
- if(H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0)
+ if (vlen_bufsize.fspace_id >= 0) {
+ if (H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "problem freeing id")
vlen_bufsize.fspace = NULL;
} /* end if */
- if(vlen_bufsize.fspace && H5S_close(vlen_bufsize.fspace) < 0)
+ if (vlen_bufsize.fspace && H5S_close(vlen_bufsize.fspace) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
- if(vlen_bufsize.mspace_id >= 0) {
- if(H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0)
+ if (vlen_bufsize.mspace_id >= 0) {
+ if (H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "problem freeing id")
mspace = NULL;
} /* end if */
- if(mspace && H5S_close(mspace) < 0)
+ if (mspace && H5S_close(mspace) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
- if(vlen_bufsize.common.fl_tbuf != NULL)
+ if (vlen_bufsize.common.fl_tbuf != NULL)
vlen_bufsize.common.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.common.fl_tbuf);
- if(vlen_bufsize.common.vl_tbuf != NULL)
+ if (vlen_bufsize.common.vl_tbuf != NULL)
vlen_bufsize.common.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.common.vl_tbuf);
- if(vlen_bufsize.dxpl_id != H5I_INVALID_HID) {
- if(H5I_dec_app_ref(vlen_bufsize.dxpl_id) < 0)
+ if (vlen_bufsize.dxpl_id != H5I_INVALID_HID) {
+ if (H5I_dec_app_ref(vlen_bufsize.dxpl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close property list")
dxpl = NULL;
} /* end if */
- if(dxpl && H5P_close(dxpl) < 0)
+ if (dxpl && H5P_close(dxpl) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release DXPL")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__vlen_get_buf_size_gen() */
-
/*-------------------------------------------------------------------------
* Function: H5D__check_filters
*
@@ -2973,8 +2964,8 @@ done:
static herr_t
H5D__check_filters(H5D_t *dataset)
{
- H5O_fill_t *fill; /* Dataset's fill value */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_fill_t *fill; /* Dataset's fill value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2987,31 +2978,30 @@ H5D__check_filters(H5D_t *dataset)
* that requires writing on an extend.
*/
fill = &dataset->shared->dcpl_cache.fill;
- if(!dataset->shared->checked_filters) {
- H5D_fill_value_t fill_status; /* Whether the fill value is defined */
+ if (!dataset->shared->checked_filters) {
+ H5D_fill_value_t fill_status; /* Whether the fill value is defined */
/* Retrieve the "defined" status of the fill value */
- if(H5P_is_fill_value_defined(fill, &fill_status) < 0)
+ if (H5P_is_fill_value_defined(fill, &fill_status) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Couldn't retrieve fill value from dataset.")
/* See if we can check the filter status */
- if(fill_status == H5D_FILL_VALUE_DEFAULT || fill_status == H5D_FILL_VALUE_USER_DEFINED) {
- if(fill->fill_time == H5D_FILL_TIME_ALLOC ||
- (fill->fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_USER_DEFINED)) {
+ if (fill_status == H5D_FILL_VALUE_DEFAULT || fill_status == H5D_FILL_VALUE_USER_DEFINED) {
+ if (fill->fill_time == H5D_FILL_TIME_ALLOC ||
+ (fill->fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_USER_DEFINED)) {
/* Filters must have encoding enabled. Ensure that all filters can be applied */
- if(H5Z_can_apply(dataset->shared->dcpl_id, dataset->shared->type_id) < 0)
+ if (H5Z_can_apply(dataset->shared->dcpl_id, dataset->shared->type_id) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "can't apply filters")
dataset->shared->checked_filters = TRUE;
} /* end if */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__check_filters() */
-
/*-------------------------------------------------------------------------
* Function: H5D__set_extent
*
@@ -3024,11 +3014,11 @@ done:
herr_t
H5D__set_extent(H5D_t *dset, const hsize_t *size)
{
- hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */
- htri_t changed; /* Whether the dataspace changed size */
- size_t u, v; /* Local index variable */
- unsigned dim_idx; /* Dimension index */
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */
+ htri_t changed; /* Whether the dataspace changed size */
+ size_t u, v; /* Local index variable */
+ unsigned dim_idx; /* Dimension index */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
@@ -3037,17 +3027,18 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
HDassert(size);
/* Check if we are allowed to modify this file */
- if(0 == (H5F_INTENT(dset->oloc.file) & H5F_ACC_RDWR))
+ if (0 == (H5F_INTENT(dset->oloc.file) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "no write intent on file")
- /* Check if we are allowed to modify the space; only datasets with chunked and external storage are allowed to be modified */
- if(H5D_COMPACT == dset->shared->layout.type)
+ /* Check if we are allowed to modify the space; only datasets with chunked and external storage are
+ * allowed to be modified */
+ if (H5D_COMPACT == dset->shared->layout.type)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "dataset has compact storage")
- if(H5D_CONTIGUOUS == dset->shared->layout.type && 0 == dset->shared->dcpl_cache.efl.nused)
+ if (H5D_CONTIGUOUS == dset->shared->layout.type && 0 == dset->shared->dcpl_cache.efl.nused)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "dataset has contiguous storage")
/* Check if the filters in the DCPL will need to encode, and if so, can they? */
- if(H5D__check_filters(dset) < 0)
+ if (H5D__check_filters(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't apply filters")
/* Keep the current dataspace dimensions for later */
@@ -3055,61 +3046,63 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
H5MM_memcpy(curr_dims, dset->shared->curr_dims, H5S_MAX_RANK * sizeof(curr_dims[0]));
/* Modify the size of the dataspace */
- if((changed = H5S_set_extent(dset->shared->space, size)) < 0)
+ if ((changed = H5S_set_extent(dset->shared->space, size)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace")
/* Don't bother updating things, unless they've changed */
- if(changed) {
- hbool_t shrink = FALSE; /* Flag to indicate a dimension has shrank */
- hbool_t expand = FALSE; /* Flag to indicate a dimension has grown */
- hbool_t update_chunks = FALSE; /* Flag to indicate chunk cache update is needed */
+ if (changed) {
+ hbool_t shrink = FALSE; /* Flag to indicate a dimension has shrank */
+ hbool_t expand = FALSE; /* Flag to indicate a dimension has grown */
+ hbool_t update_chunks = FALSE; /* Flag to indicate chunk cache update is needed */
/* Determine if we are shrinking and/or expanding any dimensions */
- for(dim_idx = 0; dim_idx < dset->shared->ndims; dim_idx++) {
+ for (dim_idx = 0; dim_idx < dset->shared->ndims; dim_idx++) {
/* Check for various status changes */
- if(size[dim_idx] < curr_dims[dim_idx])
+ if (size[dim_idx] < curr_dims[dim_idx])
shrink = TRUE;
- if(size[dim_idx] > curr_dims[dim_idx])
+ if (size[dim_idx] > curr_dims[dim_idx])
expand = TRUE;
/* Chunked storage specific checks */
- if(H5D_CHUNKED == dset->shared->layout.type && dset->shared->ndims > 1) {
- hsize_t scaled; /* Scaled value */
+ if (H5D_CHUNKED == dset->shared->layout.type && dset->shared->ndims > 1) {
+ hsize_t scaled; /* Scaled value */
/* Compute the scaled dimension size value */
- if(dset->shared->layout.u.chunk.dim[dim_idx] == 0)
+ if (dset->shared->layout.u.chunk.dim[dim_idx] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", dim_idx)
scaled = size[dim_idx] / dset->shared->layout.u.chunk.dim[dim_idx];
/* Check if scaled dimension size changed */
- if(scaled != dset->shared->cache.chunk.scaled_dims[dim_idx]) {
- hsize_t scaled_power2up; /* Scaled value, rounded to next power of 2 */
+ if (scaled != dset->shared->cache.chunk.scaled_dims[dim_idx]) {
+ hsize_t scaled_power2up; /* Scaled value, rounded to next power of 2 */
/* Update the scaled dimension size value for the current dimension */
dset->shared->cache.chunk.scaled_dims[dim_idx] = scaled;
/* Check if algorithm for computing hash values will change */
- if((scaled > dset->shared->cache.chunk.nslots &&
- dset->shared->cache.chunk.scaled_dims[dim_idx] <= dset->shared->cache.chunk.nslots)
- || (scaled <= dset->shared->cache.chunk.nslots &&
- dset->shared->cache.chunk.scaled_dims[dim_idx] > dset->shared->cache.chunk.nslots))
+ if ((scaled > dset->shared->cache.chunk.nslots &&
+ dset->shared->cache.chunk.scaled_dims[dim_idx] <=
+ dset->shared->cache.chunk.nslots) ||
+ (scaled <= dset->shared->cache.chunk.nslots &&
+ dset->shared->cache.chunk.scaled_dims[dim_idx] > dset->shared->cache.chunk.nslots))
update_chunks = TRUE;
- if(!(scaled_power2up = H5VM_power2up(scaled)))
+ if (!(scaled_power2up = H5VM_power2up(scaled)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2")
/* Check if the number of bits required to encode the scaled size value changed */
- if(dset->shared->cache.chunk.scaled_power2up[dim_idx] != scaled_power2up) {
+ if (dset->shared->cache.chunk.scaled_power2up[dim_idx] != scaled_power2up) {
/* Update the 'power2up' & 'encode_bits' values for the current dimension */
dset->shared->cache.chunk.scaled_power2up[dim_idx] = scaled_power2up;
- dset->shared->cache.chunk.scaled_encode_bits[dim_idx] = H5VM_log2_gen(scaled_power2up);
+ dset->shared->cache.chunk.scaled_encode_bits[dim_idx] =
+ H5VM_log2_gen(scaled_power2up);
/* Indicate that the cached chunk indices need to be updated */
update_chunks = TRUE;
} /* end if */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
/* Update the cached copy of the dataset's dimensions */
dset->shared->curr_dims[dim_idx] = size[dim_idx];
@@ -3120,34 +3113,38 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
*-------------------------------------------------------------------------
*/
/* Update the index values for the cached chunks for this dataset */
- if(H5D_CHUNKED == dset->shared->layout.type) {
+ if (H5D_CHUNKED == dset->shared->layout.type) {
/* Set the cached chunk info */
- if(H5D__chunk_set_info(dset) < 0)
+ if (H5D__chunk_set_info(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to update # of chunks")
/* Check if updating the chunk cache indices is necessary */
- if(update_chunks)
+ if (update_chunks)
/* Update the chunk cache indices */
- if(H5D__chunk_update_cache(dset) < 0)
+ if (H5D__chunk_update_cache(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update cached chunk indices")
} /* end if */
/* Operations for virtual datasets */
- if(H5D_VIRTUAL == dset->shared->layout.type) {
+ if (H5D_VIRTUAL == dset->shared->layout.type) {
/* Check that the dimensions of the VDS are large enough */
- if(H5D_virtual_check_min_dims(dset) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "virtual dataset dimensions not large enough to contain all limited dimensions in all selections")
+ if (H5D_virtual_check_min_dims(dset) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "virtual dataset dimensions not large enough to contain all limited dimensions "
+ "in all selections")
/* Patch the virtual selection dataspaces */
- for(u = 0; u < dset->shared->layout.storage.u.virt.list_nused; u++) {
+ for (u = 0; u < dset->shared->layout.storage.u.virt.list_nused; u++) {
/* Patch extent */
- if(H5S_set_extent(dset->shared->layout.storage.u.virt.list[u].source_dset.virtual_select, size) < 0)
+ if (H5S_set_extent(dset->shared->layout.storage.u.virt.list[u].source_dset.virtual_select,
+ size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace")
dset->shared->layout.storage.u.virt.list[u].virtual_space_status = H5O_VIRTUAL_STATUS_CORRECT;
/* Patch sub-source datasets */
- for(v = 0; v < dset->shared->layout.storage.u.virt.list[u].sub_dset_nused; v++)
- if(H5S_set_extent(dset->shared->layout.storage.u.virt.list[u].sub_dset[v].virtual_select, size) < 0)
+ for (v = 0; v < dset->shared->layout.storage.u.virt.list[u].sub_dset_nused; v++)
+ if (H5S_set_extent(dset->shared->layout.storage.u.virt.list[u].sub_dset[v].virtual_select,
+ size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace")
} /* end for */
@@ -3157,12 +3154,12 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
} /* end if */
/* Allocate space for the new parts of the dataset, if appropriate */
- if(expand && dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY) {
+ if (expand && dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY) {
H5D_io_info_t io_info;
io_info.dset = dset;
- if(H5D__alloc_storage(&io_info, H5D_ALLOC_EXTEND, FALSE, curr_dims) < 0)
+ if (H5D__alloc_storage(&io_info, H5D_ALLOC_EXTEND, FALSE, curr_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset storage")
}
/*-------------------------------------------------------------------------
@@ -3171,23 +3168,25 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
* and if the chunks are written
*-------------------------------------------------------------------------
*/
- if(H5D_CHUNKED == dset->shared->layout.type) {
- if(shrink && ((*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)
- || (dset->shared->layout.ops->is_data_cached && (*dset->shared->layout.ops->is_data_cached)(dset->shared))))
+ if (H5D_CHUNKED == dset->shared->layout.type) {
+ if (shrink && ((*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage) ||
+ (dset->shared->layout.ops->is_data_cached &&
+ (*dset->shared->layout.ops->is_data_cached)(dset->shared))))
/* Remove excess chunks */
- if(H5D__chunk_prune_by_extent(dset, curr_dims) < 0)
+ if (H5D__chunk_prune_by_extent(dset, curr_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to remove chunks")
/* Update chunks that are no longer edge chunks as a result of
* expansion */
- if(expand && (dset->shared->layout.u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS)
- && (dset->shared->dcpl_cache.pline.nused > 0))
- if(H5D__chunk_update_old_edge_chunks(dset, curr_dims) < 0)
+ if (expand &&
+ (dset->shared->layout.u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) &&
+ (dset->shared->dcpl_cache.pline.nused > 0))
+ if (H5D__chunk_update_old_edge_chunks(dset, curr_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to do update old edge chunks")
} /* end if */
/* Mark the dataspace as dirty, for later writing to the file */
- if(H5D__mark(dset, H5D_MARK_SPACE) < 0)
+ if (H5D__mark(dset, H5D_MARK_SPACE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty")
} /* end if */
@@ -3195,7 +3194,6 @@ done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__set_extent() */
-
/*-------------------------------------------------------------------------
* Function: H5D__flush_sieve_buf
*
@@ -3208,7 +3206,7 @@ done:
herr_t
H5D__flush_sieve_buf(H5D_t *dataset)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -3216,11 +3214,13 @@ H5D__flush_sieve_buf(H5D_t *dataset)
HDassert(dataset);
/* Flush the raw data buffer, if we have a dirty one */
- if(dataset->shared->cache.contig.sieve_buf && dataset->shared->cache.contig.sieve_dirty) {
- HDassert(dataset->shared->layout.type != H5D_COMPACT); /* We should never have a sieve buffer for compact storage */
+ if (dataset->shared->cache.contig.sieve_buf && dataset->shared->cache.contig.sieve_dirty) {
+ HDassert(dataset->shared->layout.type !=
+ H5D_COMPACT); /* We should never have a sieve buffer for compact storage */
/* Write dirty data sieve buffer to file */
- if(H5F_shared_block_write(H5F_SHARED(dataset->oloc.file), H5FD_MEM_DRAW, dataset->shared->cache.contig.sieve_loc,
+ if (H5F_shared_block_write(
+ H5F_SHARED(dataset->oloc.file), H5FD_MEM_DRAW, dataset->shared->cache.contig.sieve_loc,
dataset->shared->cache.contig.sieve_size, dataset->shared->cache.contig.sieve_buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
@@ -3232,7 +3232,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__flush_sieve_buf() */
-
/*-------------------------------------------------------------------------
* Function: H5D__flush_real
*
@@ -3245,7 +3244,7 @@ done:
herr_t
H5D__flush_real(H5D_t *dataset)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr)
@@ -3254,16 +3253,15 @@ H5D__flush_real(H5D_t *dataset)
HDassert(dataset->shared);
/* Avoid flushing the dataset (again) if it's closing */
- if(!dataset->shared->closing)
+ if (!dataset->shared->closing)
/* Flush cached raw data for each kind of dataset layout */
- if(dataset->shared->layout.ops->flush && (dataset->shared->layout.ops->flush)(dataset) < 0)
+ if (dataset->shared->layout.ops->flush && (dataset->shared->layout.ops->flush)(dataset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush raw data")
done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__flush_real() */
-
/*-------------------------------------------------------------------------
* Function: H5D__flush
*
@@ -3276,7 +3274,7 @@ done:
herr_t
H5D__flush(H5D_t *dset, hid_t dset_id)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -3285,18 +3283,17 @@ H5D__flush(H5D_t *dset, hid_t dset_id)
HDassert(dset->shared);
/* Flush any dataset information still cached in memory */
- if(H5D__flush_real(dset) < 0)
+ if (H5D__flush_real(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush cached dataset info")
/* Flush object's metadata to file */
- if(H5O_flush_common(&dset->oloc, dset_id) < 0)
+ if (H5O_flush_common(&dset->oloc, dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset and object flush callback")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__flush() */
-
/*-------------------------------------------------------------------------
* Function: H5D__format_convert
*
@@ -3310,81 +3307,83 @@ done:
herr_t
H5D__format_convert(H5D_t *dataset)
{
- H5D_chk_idx_info_t new_idx_info; /* Index info for the new layout */
- H5D_chk_idx_info_t idx_info; /* Index info for the current layout */
- H5O_layout_t *newlayout = NULL; /* The new layout */
- hbool_t init_new_index = FALSE; /* Indicate that the new chunk index is initialized */
- hbool_t delete_old_layout = FALSE; /* Indicate that the old layout message is deleted */
- hbool_t add_new_layout = FALSE; /* Indicate that the new layout message is added */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chk_idx_info_t new_idx_info; /* Index info for the new layout */
+ H5D_chk_idx_info_t idx_info; /* Index info for the current layout */
+ H5O_layout_t * newlayout = NULL; /* The new layout */
+ hbool_t init_new_index = FALSE; /* Indicate that the new chunk index is initialized */
+ hbool_t delete_old_layout = FALSE; /* Indicate that the old layout message is deleted */
+ hbool_t add_new_layout = FALSE; /* Indicate that the new layout message is added */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr)
/* Check args */
HDassert(dataset);
- switch(dataset->shared->layout.type) {
+ switch (dataset->shared->layout.type) {
case H5D_CHUNKED:
HDassert(dataset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE);
- if(NULL == (newlayout = (H5O_layout_t *)H5MM_calloc(sizeof(H5O_layout_t))))
+ if (NULL == (newlayout = (H5O_layout_t *)H5MM_calloc(sizeof(H5O_layout_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer")
/* Set up the current index info */
- idx_info.f = dataset->oloc.file;
- idx_info.pline = &dataset->shared->dcpl_cache.pline;
- idx_info.layout = &dataset->shared->layout.u.chunk;
+ idx_info.f = dataset->oloc.file;
+ idx_info.pline = &dataset->shared->dcpl_cache.pline;
+ idx_info.layout = &dataset->shared->layout.u.chunk;
idx_info.storage = &dataset->shared->layout.storage.u.chunk;
/* Copy the current layout info to the new layout */
H5MM_memcpy(newlayout, &dataset->shared->layout, sizeof(H5O_layout_t));
/* Set up info for version 1 B-tree in the new layout */
- newlayout->version = H5O_LAYOUT_VERSION_3;
- newlayout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE;
- newlayout->storage.u.chunk.idx_addr = HADDR_UNDEF;
- newlayout->storage.u.chunk.ops = H5D_COPS_BTREE;
+ newlayout->version = H5O_LAYOUT_VERSION_3;
+ newlayout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE;
+ newlayout->storage.u.chunk.idx_addr = HADDR_UNDEF;
+ newlayout->storage.u.chunk.ops = H5D_COPS_BTREE;
newlayout->storage.u.chunk.u.btree.shared = NULL;
/* Set up the index info to version 1 B-tree */
- new_idx_info.f = dataset->oloc.file;
- new_idx_info.pline = &dataset->shared->dcpl_cache.pline;
- new_idx_info.layout = &(newlayout->u).chunk;
+ new_idx_info.f = dataset->oloc.file;
+ new_idx_info.pline = &dataset->shared->dcpl_cache.pline;
+ new_idx_info.layout = &(newlayout->u).chunk;
new_idx_info.storage = &(newlayout->storage).u.chunk;
/* Initialize version 1 B-tree */
- if(new_idx_info.storage->ops->init && (new_idx_info.storage->ops->init)(&new_idx_info, dataset->shared->space, dataset->oloc.addr) < 0)
+ if (new_idx_info.storage->ops->init &&
+ (new_idx_info.storage->ops->init)(&new_idx_info, dataset->shared->space, dataset->oloc.addr) <
+ 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information")
init_new_index = TRUE;
/* If the current chunk index exists */
- if(H5F_addr_defined(idx_info.storage->idx_addr)) {
+ if (H5F_addr_defined(idx_info.storage->idx_addr)) {
/* Create v1 B-tree chunk index */
- if((new_idx_info.storage->ops->create)(&new_idx_info) < 0)
+ if ((new_idx_info.storage->ops->create)(&new_idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index")
/* Iterate over the chunks in the current index and insert the chunk addresses
* into the version 1 B-tree chunk index
*/
- if(H5D__chunk_format_convert(dataset, &idx_info, &new_idx_info) < 0)
+ if (H5D__chunk_format_convert(dataset, &idx_info, &new_idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate/convert chunk index")
} /* end if */
/* Delete the old "current" layout message */
- if(H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, FALSE) < 0)
+ if (H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message")
delete_old_layout = TRUE;
/* Append the new layout message to the object header */
- if(H5O_msg_create(&dataset->oloc, H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, newlayout) < 0)
+ if (H5O_msg_create(&dataset->oloc, H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, newlayout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout header message")
add_new_layout = TRUE;
/* Release the old (current) chunk index */
- if(idx_info.storage->ops->dest && (idx_info.storage->ops->dest)(&idx_info) < 0)
+ if (idx_info.storage->ops->dest && (idx_info.storage->ops->dest)(&idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info")
/* Copy the new layout to the dataset's layout */
@@ -3396,7 +3395,8 @@ H5D__format_convert(H5D_t *dataset)
case H5D_COMPACT:
HDassert(dataset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT);
dataset->shared->layout.version = H5O_LAYOUT_VERSION_DEFAULT;
- if(H5O_msg_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &(dataset->shared->layout)) < 0)
+ if (H5O_msg_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME,
+ &(dataset->shared->layout)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message")
break;
@@ -3412,42 +3412,43 @@ H5D__format_convert(H5D_t *dataset)
} /* end switch */
done:
- if(ret_value < 0 && dataset->shared->layout.type == H5D_CHUNKED) {
+ if (ret_value < 0 && dataset->shared->layout.type == H5D_CHUNKED) {
/* Remove new layout message */
- if(add_new_layout)
- if(H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, FALSE) < 0)
+ if (add_new_layout)
+ if (H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, FALSE) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message")
/* Add back old layout message */
- if(delete_old_layout)
- if(H5O_msg_create(&dataset->oloc, H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &dataset->shared->layout) < 0)
+ if (delete_old_layout)
+ if (H5O_msg_create(&dataset->oloc, H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &dataset->shared->layout) <
+ 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to add layout header message")
/* Clean up v1 b-tree chunk index */
- if(init_new_index) {
- if(H5F_addr_defined(new_idx_info.storage->idx_addr)) {
+ if (init_new_index) {
+ if (H5F_addr_defined(new_idx_info.storage->idx_addr)) {
/* Check for valid address i.e. tag */
- if(!H5F_addr_defined(dataset->oloc.addr))
+ if (!H5F_addr_defined(dataset->oloc.addr))
HDONE_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "address undefined")
/* Expunge from cache all v1 B-tree type entries associated with tag */
- if(H5AC_expunge_tag_type_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_BT_ID, H5AC__NO_FLAGS_SET))
+ if (H5AC_expunge_tag_type_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_BT_ID,
+ H5AC__NO_FLAGS_SET))
HDONE_ERROR(H5E_DATASET, H5E_CANTEXPUNGE, FAIL, "unable to expunge index metadata")
} /* end if */
/* Delete v1 B-tree chunk index */
- if(new_idx_info.storage->ops->dest && (new_idx_info.storage->ops->dest)(&new_idx_info) < 0)
+ if (new_idx_info.storage->ops->dest && (new_idx_info.storage->ops->dest)(&new_idx_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info")
} /* end if */
- } /* end if */
+ } /* end if */
- if(newlayout != NULL)
+ if (newlayout != NULL)
newlayout = (H5O_layout_t *)H5MM_xfree(newlayout);
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__format_convert() */
-
/*-------------------------------------------------------------------------
* Function: H5D__mark
*
@@ -3460,8 +3461,8 @@ done:
herr_t
H5D__mark(const H5D_t *dataset, unsigned flags)
{
- H5O_t *oh = NULL; /* Pointer to dataset's object header */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_t *oh = NULL; /* Pointer to dataset's object header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -3470,16 +3471,16 @@ H5D__mark(const H5D_t *dataset, unsigned flags)
HDassert(!(flags & (unsigned)~(H5D_MARK_SPACE | H5D_MARK_LAYOUT)));
/* Mark aspects of the dataset as dirty */
- if(flags) {
- unsigned update_flags = H5O_UPDATE_TIME; /* Modification time flag */
+ if (flags) {
+ unsigned update_flags = H5O_UPDATE_TIME; /* Modification time flag */
/* Pin the object header */
- if(NULL == (oh = H5O_pin(&dataset->oloc)))
+ if (NULL == (oh = H5O_pin(&dataset->oloc)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header")
/* Update the layout on disk, if it's been changed */
- if(flags & H5D_MARK_LAYOUT) {
- if(H5D__layout_oh_write(dataset, oh, update_flags) < 0)
+ if (flags & H5D_MARK_LAYOUT) {
+ if (H5D__layout_oh_write(dataset, oh, update_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout info")
/* Reset the "update the modification time" flag, so we only do it once */
@@ -3487,8 +3488,8 @@ H5D__mark(const H5D_t *dataset, unsigned flags)
} /* end if */
/* Update the dataspace on disk, if it's been changed */
- if(flags & H5D_MARK_SPACE) {
- if(H5S_write(dataset->oloc.file, oh, update_flags, dataset->shared->space) < 0)
+ if (flags & H5D_MARK_SPACE) {
+ if (H5S_write(dataset->oloc.file, oh, update_flags, dataset->shared->space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update file with new dataspace")
/* Reset the "update the modification time" flag, so we only do it once */
@@ -3501,14 +3502,13 @@ H5D__mark(const H5D_t *dataset, unsigned flags)
done:
/* Release pointer to object header */
- if(oh != NULL)
- if(H5O_unpin(oh) < 0)
+ if (oh != NULL)
+ if (H5O_unpin(oh) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__mark() */
-
/*-------------------------------------------------------------------------
* Function: H5D__flush_all_cb
*
@@ -3521,9 +3521,9 @@ done:
static int
H5D__flush_all_cb(void *_dataset, hid_t H5_ATTR_UNUSED id, void *_udata)
{
- H5D_t *dataset = (H5D_t *)_dataset; /* Dataset pointer */
- H5F_t *f = (H5F_t *)_udata; /* User data for callback */
- int ret_value = H5_ITER_CONT; /* Return value */
+ H5D_t *dataset = (H5D_t *)_dataset; /* Dataset pointer */
+ H5F_t *f = (H5F_t *)_udata; /* User data for callback */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -3532,16 +3532,15 @@ H5D__flush_all_cb(void *_dataset, hid_t H5_ATTR_UNUSED id, void *_udata)
HDassert(f);
/* Check for dataset in same file */
- if(f == dataset->oloc.file)
+ if (f == dataset->oloc.file)
/* Flush the dataset's information */
- if(H5D__flush_real(dataset) < 0)
+ if (H5D__flush_real(dataset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to flush cached dataset info")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__flush_all_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5D_flush_all
*
@@ -3554,7 +3553,7 @@ done:
herr_t
H5D_flush_all(H5F_t *f)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -3562,14 +3561,13 @@ H5D_flush_all(H5F_t *f)
HDassert(f);
/* Iterate over all the open datasets */
- if(H5I_iterate(H5I_DATASET, H5D__flush_all_cb, f, FALSE) < 0) /* Casting away const OK -QAK */
+ if (H5I_iterate(H5I_DATASET, H5D__flush_all_cb, f, FALSE) < 0) /* Casting away const OK -QAK */
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to flush cached dataset info")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_flush_all() */
-
/*-------------------------------------------------------------------------
* Function: H5D_get_create_plist
*
@@ -3584,37 +3582,37 @@ done:
hid_t
H5D_get_create_plist(const H5D_t *dset)
{
- H5P_genplist_t *dcpl_plist; /* Dataset's DCPL */
- H5P_genplist_t *new_plist; /* Copy of dataset's DCPL */
- H5O_layout_t copied_layout; /* Layout to tweak */
- H5O_fill_t copied_fill; /* Fill value to tweak */
- H5O_efl_t copied_efl; /* External file list to tweak */
- hid_t new_dcpl_id = FAIL;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5P_genplist_t *dcpl_plist; /* Dataset's DCPL */
+ H5P_genplist_t *new_plist; /* Copy of dataset's DCPL */
+ H5O_layout_t copied_layout; /* Layout to tweak */
+ H5O_fill_t copied_fill; /* Fill value to tweak */
+ H5O_efl_t copied_efl; /* External file list to tweak */
+ hid_t new_dcpl_id = FAIL;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- if(NULL == (dcpl_plist = (H5P_genplist_t *)H5I_object(dset->shared->dcpl_id)))
+ if (NULL == (dcpl_plist = (H5P_genplist_t *)H5I_object(dset->shared->dcpl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list")
/* Copy the creation property list */
- if((new_dcpl_id = H5P_copy_plist(dcpl_plist, TRUE)) < 0)
+ if ((new_dcpl_id = H5P_copy_plist(dcpl_plist, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to copy the creation property list")
- if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_dcpl_id)))
+ if (NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_dcpl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list")
/* Retrieve any object creation properties */
- if(H5O_get_create_plist(&dset->oloc, new_plist) < 0)
+ if (H5O_get_create_plist(&dset->oloc, new_plist) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object creation info")
/* Get the layout property */
- if(H5P_peek(new_plist, H5D_CRT_LAYOUT_NAME, &copied_layout) < 0)
+ if (H5P_peek(new_plist, H5D_CRT_LAYOUT_NAME, &copied_layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout")
/* Reset layout values set when dataset is created */
copied_layout.ops = NULL;
- switch(copied_layout.type) {
+ switch (copied_layout.type) {
case H5D_COMPACT:
copied_layout.storage.u.compact.buf = H5MM_xfree(copied_layout.storage.u.compact.buf);
HDmemset(&copied_layout.storage.u.compact, 0, sizeof(copied_layout.storage.u.compact));
@@ -3630,10 +3628,11 @@ H5D_get_create_plist(const H5D_t *dset)
copied_layout.u.chunk.size = 0;
/* Reset index info, if the chunk ops are set */
- if(copied_layout.storage.u.chunk.ops)
+ if (copied_layout.storage.u.chunk.ops)
/* Reset address and pointer of the array struct for the chunked storage index */
- if(H5D_chunk_idx_reset(&copied_layout.storage.u.chunk, TRUE) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest")
+ if (H5D_chunk_idx_reset(&copied_layout.storage.u.chunk, TRUE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to reset chunked storage index in dest")
/* Reset chunk index ops */
copied_layout.storage.u.chunk.ops = NULL;
@@ -3641,7 +3640,7 @@ H5D_get_create_plist(const H5D_t *dset)
case H5D_VIRTUAL:
copied_layout.storage.u.virt.serial_list_hobjid.addr = HADDR_UNDEF;
- copied_layout.storage.u.virt.serial_list_hobjid.idx = 0;
+ copied_layout.storage.u.virt.serial_list_hobjid.idx = 0;
break;
case H5D_LAYOUT_ERROR:
@@ -3651,102 +3650,103 @@ H5D_get_create_plist(const H5D_t *dset)
} /* end switch */
/* Set back the (possibly modified) layout property to property list */
- if(H5P_poke(new_plist, H5D_CRT_LAYOUT_NAME, &copied_layout) < 0)
+ if (H5P_poke(new_plist, H5D_CRT_LAYOUT_NAME, &copied_layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set layout")
/* Get the fill value property */
- if(H5P_peek(new_plist, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0)
+ if (H5P_peek(new_plist, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value")
/* Check if there is a fill value, but no type yet */
- if(copied_fill.buf != NULL && copied_fill.type == NULL) {
- H5T_path_t *tpath; /* Conversion information*/
+ if (copied_fill.buf != NULL && copied_fill.type == NULL) {
+ H5T_path_t *tpath; /* Conversion information*/
/* Copy the dataset type into the fill value message */
- if(NULL == (copied_fill.type = H5T_copy(dset->shared->type, H5T_COPY_TRANSIENT)))
+ if (NULL == (copied_fill.type = H5T_copy(dset->shared->type, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy dataset datatype for fill value")
/* Set up type conversion function */
- if(NULL == (tpath = H5T_path_find(dset->shared->type, copied_fill.type)))
- HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types")
+ if (NULL == (tpath = H5T_path_find(dset->shared->type, copied_fill.type)))
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
+ "unable to convert between src and dest data types")
/* Convert disk form of fill value into memory form */
- if(!H5T_path_noop(tpath)) {
- hid_t dst_id, src_id; /* Source & destination datatypes for type conversion */
- uint8_t *bkg_buf = NULL; /* Background conversion buffer */
- size_t bkg_size; /* Size of background buffer */
+ if (!H5T_path_noop(tpath)) {
+ hid_t dst_id, src_id; /* Source & destination datatypes for type conversion */
+ uint8_t *bkg_buf = NULL; /* Background conversion buffer */
+ size_t bkg_size; /* Size of background buffer */
/* Wrap copies of types to convert */
dst_id = H5I_register(H5I_DATATYPE, H5T_copy(copied_fill.type, H5T_COPY_TRANSIENT), FALSE);
- if(dst_id < 0)
+ if (dst_id < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register datatype")
src_id = H5I_register(H5I_DATATYPE, H5T_copy(dset->shared->type, H5T_COPY_ALL), FALSE);
- if(src_id < 0) {
+ if (src_id < 0) {
H5I_dec_ref(dst_id);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy/register datatype")
} /* end if */
/* Allocate a background buffer */
bkg_size = MAX(H5T_GET_SIZE(copied_fill.type), H5T_GET_SIZE(dset->shared->type));
- if(H5T_path_bkg(tpath) && NULL == (bkg_buf = H5FL_BLK_CALLOC(type_conv, bkg_size))) {
+ if (H5T_path_bkg(tpath) && NULL == (bkg_buf = H5FL_BLK_CALLOC(type_conv, bkg_size))) {
H5I_dec_ref(src_id);
H5I_dec_ref(dst_id);
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed")
} /* end if */
/* Convert fill value */
- if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, copied_fill.buf, bkg_buf) < 0) {
+ if (H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, copied_fill.buf,
+ bkg_buf) < 0) {
H5I_dec_ref(src_id);
H5I_dec_ref(dst_id);
- if(bkg_buf)
+ if (bkg_buf)
bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf);
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed")
} /* end if */
/* Release local resources */
- if(H5I_dec_ref(src_id) < 0)
+ if (H5I_dec_ref(src_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to close temporary object")
- if(H5I_dec_ref(dst_id) < 0)
+ if (H5I_dec_ref(dst_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to close temporary object")
- if(bkg_buf)
+ if (bkg_buf)
bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf);
} /* end if */
- } /* end if */
+ } /* end if */
/* Set back the (possibly modified) fill value property to property list */
- if(H5P_poke(new_plist, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0)
+ if (H5P_poke(new_plist, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set fill value")
/* Get the fill value property */
- if(H5P_peek(new_plist, H5D_CRT_EXT_FILE_LIST_NAME, &copied_efl) < 0)
+ if (H5P_peek(new_plist, H5D_CRT_EXT_FILE_LIST_NAME, &copied_efl) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get external file list")
/* Reset efl name_offset and heap_addr, these are the values when the dataset is created */
- if(copied_efl.slot) {
+ if (copied_efl.slot) {
unsigned u;
copied_efl.heap_addr = HADDR_UNDEF;
- for(u = 0; u < copied_efl.nused; u++)
+ for (u = 0; u < copied_efl.nused; u++)
copied_efl.slot[u].name_offset = 0;
} /* end if */
/* Set back the (possibly modified) external file list property to property list */
- if(H5P_poke(new_plist, H5D_CRT_EXT_FILE_LIST_NAME, &copied_efl) < 0)
+ if (H5P_poke(new_plist, H5D_CRT_EXT_FILE_LIST_NAME, &copied_efl) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set external file list")
/* Set the return value */
ret_value = new_dcpl_id;
done:
- if(ret_value < 0)
- if(new_dcpl_id > 0)
- if(H5I_dec_app_ref(new_dcpl_id) < 0)
+ if (ret_value < 0)
+ if (new_dcpl_id > 0)
+ if (H5I_dec_app_ref(new_dcpl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to close temporary object")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_get_create_plist() */
-
/*-------------------------------------------------------------------------
* Function: H5D_get_access_plist
*
@@ -3760,90 +3760,92 @@ done:
hid_t
H5D_get_access_plist(const H5D_t *dset)
{
- H5P_genplist_t *old_plist; /* Stored DAPL from dset */
- H5P_genplist_t *new_plist; /* New DAPL */
- H5P_genplist_t *def_fapl; /* Default FAPL */
- H5D_append_flush_t def_append_flush_info = {0}; /* Default append flush property */
- H5D_rdcc_t def_chunk_info; /* Default chunk cache property */
- hid_t new_dapl_id = FAIL;
- hid_t ret_value = FAIL;
+ H5P_genplist_t * old_plist; /* Stored DAPL from dset */
+ H5P_genplist_t * new_plist; /* New DAPL */
+ H5P_genplist_t * def_fapl; /* Default FAPL */
+ H5D_append_flush_t def_append_flush_info = {0}; /* Default append flush property */
+ H5D_rdcc_t def_chunk_info; /* Default chunk cache property */
+ hid_t new_dapl_id = FAIL;
+ hid_t ret_value = FAIL;
FUNC_ENTER_NOAPI_NOINIT
/* Make a copy of the dataset's dataset access property list */
- if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(dset->shared->dapl_id)))
+ if (NULL == (old_plist = (H5P_genplist_t *)H5I_object(dset->shared->dapl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list")
- if((new_dapl_id = H5P_copy_plist(old_plist, TRUE)) < 0)
+ if ((new_dapl_id = H5P_copy_plist(old_plist, TRUE)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy dataset access property list")
- if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_dapl_id)))
+ if (NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_dapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* If the dataset is chunked then copy the rdcc & append flush parameters.
* Otherwise, use the default values. */
- if(dset->shared->layout.type == H5D_CHUNKED) {
- if(H5P_set(new_plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(dset->shared->cache.chunk.nslots)) < 0)
+ if (dset->shared->layout.type == H5D_CHUNKED) {
+ if (H5P_set(new_plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(dset->shared->cache.chunk.nslots)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache number of slots")
- if(H5P_set(new_plist, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(dset->shared->cache.chunk.nbytes_max)) < 0)
+ if (H5P_set(new_plist, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(dset->shared->cache.chunk.nbytes_max)) <
+ 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache byte size")
- if(H5P_set(new_plist, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &(dset->shared->cache.chunk.w0)) < 0)
+ if (H5P_set(new_plist, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &(dset->shared->cache.chunk.w0)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks")
- if(H5P_set(new_plist, H5D_ACS_APPEND_FLUSH_NAME, &dset->shared->append_flush) < 0)
+ if (H5P_set(new_plist, H5D_ACS_APPEND_FLUSH_NAME, &dset->shared->append_flush) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set append flush property")
- } else {
+ }
+ else {
/* Get the default FAPL */
- if(NULL == (def_fapl = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g)))
+ if (NULL == (def_fapl = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a property list")
/* Set the data cache number of slots to the value of the default FAPL */
if (H5P_get(def_fapl, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &def_chunk_info.nslots) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET,FAIL, "can't get data number of slots");
- if(H5P_set(new_plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &def_chunk_info.nslots) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data number of slots");
+ if (H5P_set(new_plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &def_chunk_info.nslots) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set data cache number of slots")
/* Set the data cache byte size to the value of the default FAPL */
if (H5P_get(def_fapl, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &def_chunk_info.nbytes_max) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET,FAIL, "can't get data cache byte size");
- if(H5P_set(new_plist, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &def_chunk_info.nbytes_max) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data cache byte size");
+ if (H5P_set(new_plist, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &def_chunk_info.nbytes_max) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set data cache byte size")
/* Set the preempt read chunks property to the value of the default FAPL */
if (H5P_get(def_fapl, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &def_chunk_info.w0) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET,FAIL, "can't get preempt read chunks");
- if(H5P_set(new_plist, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &def_chunk_info.w0) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get preempt read chunks");
+ if (H5P_set(new_plist, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &def_chunk_info.w0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set preempt read chunks")
/* Set the append flush property to its default value */
- if(H5P_set(new_plist, H5D_ACS_APPEND_FLUSH_NAME, &def_append_flush_info) < 0)
+ if (H5P_set(new_plist, H5D_ACS_APPEND_FLUSH_NAME, &def_append_flush_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set append flush property")
- }/* end if-else */
+ } /* end if-else */
/* Set the VDS view & printf gap options */
- if(H5P_set(new_plist, H5D_ACS_VDS_VIEW_NAME, &(dset->shared->layout.storage.u.virt.view)) < 0)
+ if (H5P_set(new_plist, H5D_ACS_VDS_VIEW_NAME, &(dset->shared->layout.storage.u.virt.view)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS view")
- if(H5P_set(new_plist, H5D_ACS_VDS_PRINTF_GAP_NAME, &(dset->shared->layout.storage.u.virt.printf_gap)) < 0)
+ if (H5P_set(new_plist, H5D_ACS_VDS_PRINTF_GAP_NAME, &(dset->shared->layout.storage.u.virt.printf_gap)) <
+ 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS printf gap")
/* Set the vds prefix option */
- if(H5P_set(new_plist, H5D_ACS_VDS_PREFIX_NAME, &(dset->shared->vds_prefix)) < 0)
+ if (H5P_set(new_plist, H5D_ACS_VDS_PREFIX_NAME, &(dset->shared->vds_prefix)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vds prefix")
/* Set the external file prefix option */
- if(H5P_set(new_plist, H5D_ACS_EFILE_PREFIX_NAME, &(dset->shared->extfile_prefix)) < 0)
+ if (H5P_set(new_plist, H5D_ACS_EFILE_PREFIX_NAME, &(dset->shared->extfile_prefix)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file prefix")
/* Set the return value */
ret_value = new_dapl_id;
done:
- if(ret_value < 0)
- if(new_dapl_id > 0)
- if(H5I_dec_app_ref(new_dapl_id) < 0)
+ if (ret_value < 0)
+ if (new_dapl_id > 0)
+ if (H5I_dec_app_ref(new_dapl_id) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't free")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_get_access_plist() */
-
/*-------------------------------------------------------------------------
* Function: H5D__get_space
*
@@ -3856,34 +3858,33 @@ done:
hid_t
H5D__get_space(const H5D_t *dset)
{
- H5S_t *space = NULL;
- hid_t ret_value = H5I_INVALID_HID;
+ H5S_t *space = NULL;
+ hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_PACKAGE
/* If the layout is virtual, update the extent */
- if(dset->shared->layout.type == H5D_VIRTUAL)
- if(H5D__virtual_set_extent_unlim(dset) < 0)
+ if (dset->shared->layout.type == H5D_VIRTUAL)
+ if (H5D__virtual_set_extent_unlim(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update virtual dataset extent")
/* Read the dataspace message and return a dataspace object */
- if(NULL == (space = H5S_copy(dset->shared->space, FALSE, TRUE)))
+ if (NULL == (space = H5S_copy(dset->shared->space, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get dataspace")
/* Create an atom */
- if((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0)
+ if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace")
done:
- if(ret_value < 0)
- if(space != NULL)
- if(H5S_close(space) < 0)
+ if (ret_value < 0)
+ if (space != NULL)
+ if (H5S_close(space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__get_space() */
-
/*-------------------------------------------------------------------------
* Function: H5D__get_type
*
@@ -3897,49 +3898,47 @@ done:
hid_t
H5D__get_type(const H5D_t *dset)
{
- H5T_t *dt = NULL;
- hid_t ret_value = FAIL;
+ H5T_t *dt = NULL;
+ hid_t ret_value = FAIL;
FUNC_ENTER_PACKAGE
/* Patch the datatype's "top level" file pointer */
- if(H5T_patch_file(dset->shared->type, dset->oloc.file) < 0)
+ if (H5T_patch_file(dset->shared->type, dset->oloc.file) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to patch datatype's file pointer")
/* Copy the dataset's datatype */
- if(NULL == (dt = H5T_copy_reopen(dset->shared->type)))
+ if (NULL == (dt = H5T_copy_reopen(dset->shared->type)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy datatype")
/* Mark any datatypes as being in memory now */
- if(H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0)
+ if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
/* Lock copied type */
- if(H5T_lock(dt, FALSE) < 0)
+ if (H5T_lock(dt, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to lock transient datatype")
/* Create an atom */
- if(H5T_is_named(dt)) {
+ if (H5T_is_named(dt)) {
/* If this is a committed datatype, we need to recreate the
* two-level IDs, where the VOL object is a copy of the
* returned datatype.
*/
- if((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0)
+ if ((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
} /* end if */
- else
- if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
+ else if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
done:
- if(ret_value < 0)
- if(dt && H5T_close(dt) < 0)
+ if (ret_value < 0)
+ if (dt && H5T_close(dt) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__get_type() */
-
/*-------------------------------------------------------------------------
* Function: H5D__refresh
*
@@ -3951,9 +3950,9 @@ done:
herr_t
H5D__refresh(hid_t dset_id, H5D_t *dset)
{
- H5D_virtual_held_file_t *head = NULL; /* Pointer to list of files held open */
- hbool_t virt_dsets_held = FALSE; /* Whether virtual datasets' files are held open */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_virtual_held_file_t *head = NULL; /* Pointer to list of files held open */
+ hbool_t virt_dsets_held = FALSE; /* Whether virtual datasets' files are held open */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -3962,27 +3961,26 @@ H5D__refresh(hid_t dset_id, H5D_t *dset)
HDassert(dset->shared);
/* If the layout is virtual... */
- if(dset->shared->layout.type == H5D_VIRTUAL) {
+ if (dset->shared->layout.type == H5D_VIRTUAL) {
/* Hold open the source datasets' files */
- if(H5D__virtual_hold_source_dset_files(dset, &head) < 0)
+ if (H5D__virtual_hold_source_dset_files(dset, &head) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, FAIL, "unable to hold VDS source files open")
virt_dsets_held = TRUE;
/* Refresh source datasets for virtual dataset */
- if(H5D__virtual_refresh_source_dsets(dset) < 0)
+ if (H5D__virtual_refresh_source_dsets(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh VDS source datasets")
} /* end if */
/* Refresh dataset object */
- if((H5O_refresh_metadata(dset_id, dset->oloc)) < 0)
+ if ((H5O_refresh_metadata(dset_id, dset->oloc)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh dataset")
done:
/* Release hold on (source) virtual datasets' files */
- if(virt_dsets_held)
- if(H5D__virtual_release_source_dset_files(head) < 0)
+ if (virt_dsets_held)
+ if (H5D__virtual_release_source_dset_files(head) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't release VDS source files held open")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__refresh() */
-
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 63ae221..50c474b 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -15,55 +15,49 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Sprivate.h" /* Dataspace */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Dataset functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Sprivate.h" /* Dataspace */
#include "H5VLnative_private.h" /* Native VOL connector */
-
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
/* Setup/teardown routines */
-static herr_t H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info,
- H5D_storage_t *store, H5D_io_info_t *io_info);
-static herr_t H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id,
- hbool_t do_write, H5D_type_info_t *type_info);
+static herr_t H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info, H5D_storage_t *store,
+ H5D_io_info_t *io_info);
+static herr_t H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write,
+ H5D_type_info_t *type_info);
#ifdef H5_HAVE_PARALLEL
-static herr_t H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
- const H5S_t *file_space, const H5S_t *mem_space, const H5D_type_info_t *type_info);
+static herr_t H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_space,
+ const H5S_t *mem_space, const H5D_type_info_t *type_info);
#endif /* H5_HAVE_PARALLEL */
static herr_t H5D__typeinfo_term(const H5D_type_info_t *type_info);
-
/*********************/
/* Package Variables */
/*********************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -74,8 +68,6 @@ H5FL_BLK_DEFINE(type_conv);
/* Declare a free list to manage the H5D_chunk_map_t struct */
H5FL_DEFINE(H5D_chunk_map_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5D__get_offset_copy
*
@@ -93,7 +85,7 @@ herr_t
H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy)
{
unsigned u;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -125,7 +117,6 @@ done:
} /* end H5D__get_offset_copy() */
-
/*-------------------------------------------------------------------------
* Function: H5Dread
*
@@ -157,15 +148,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
- hid_t file_space_id, hid_t dxpl_id, void *buf/*out*/)
+H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
+ void *buf /*out*/)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "iiiiix", dset_id, mem_type_id, mem_space_id, file_space_id,
- dxpl_id, buf);
+ H5TRACE6("e", "iiiiix", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf);
/* Check arguments */
if (mem_space_id < 0)
@@ -180,19 +170,18 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
/* Get the default dataset transfer property list if the user didn't provide one */
if (H5P_DEFAULT == dxpl_id)
dxpl_id = H5P_DATASET_XFER_DEFAULT;
- else
- if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
+ else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
/* Read the data */
- if ((ret_value = H5VL_dataset_read(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0)
+ if ((ret_value = H5VL_dataset_read(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dread() */
-
/*-------------------------------------------------------------------------
* Function: H5Dread_chunk
*
@@ -206,11 +195,10 @@ done:
*---------------------------------------------------------------------------
*/
herr_t
-H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters,
- void *buf)
+H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, void *buf)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf);
@@ -228,19 +216,18 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil
/* Get the default dataset transfer property list if the user didn't provide one */
if (H5P_DEFAULT == dxpl_id)
dxpl_id = H5P_DATASET_XFER_DEFAULT;
- else
- if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID")
+ else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID")
/* Read the raw chunk */
- if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_READ, dxpl_id, H5_REQUEST_NULL, offset, filters, buf) < 0)
+ if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_READ, dxpl_id, H5_REQUEST_NULL, offset,
+ filters, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dread_chunk() */
-
/*-------------------------------------------------------------------------
* Function: H5Dwrite
*
@@ -273,15 +260,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
- hid_t file_space_id, hid_t dxpl_id, const void *buf)
+H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
+ const void *buf)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id,
- dxpl_id, buf);
+ H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf);
/* Check arguments */
if (mem_space_id < 0)
@@ -296,19 +282,18 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
/* Get the default dataset transfer property list if the user didn't provide one */
if (H5P_DEFAULT == dxpl_id)
dxpl_id = H5P_DATASET_XFER_DEFAULT;
- else
- if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
+ else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
/* Write the data */
- if ((ret_value = H5VL_dataset_write(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0)
+ if ((ret_value = H5VL_dataset_write(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dwrite() */
-
/*-------------------------------------------------------------------------
* Function: H5Dwrite_chunk
*
@@ -322,12 +307,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset,
- size_t data_size, const void *buf)
+H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, size_t data_size,
+ const void *buf)
{
- H5VL_object_t *vol_obj = NULL;
- uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *vol_obj = NULL;
+ uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iiIu*hz*x", dset_id, dxpl_id, filters, offset, data_size, buf);
@@ -350,19 +335,18 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of
/* Get the default dataset transfer property list if the user didn't provide one */
if (H5P_DEFAULT == dxpl_id)
dxpl_id = H5P_DATASET_XFER_DEFAULT;
- else
- if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID")
+ else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID")
/* Write chunk */
- if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_WRITE, dxpl_id, H5_REQUEST_NULL, filters, offset, data_size_32, buf) < 0)
+ if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_WRITE, dxpl_id, H5_REQUEST_NULL, filters,
+ offset, data_size_32, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dwrite_chunk() */
-
/*-------------------------------------------------------------------------
* Function: H5D__read
*
@@ -377,84 +361,85 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
- const H5S_t *file_space, void *buf/*out*/)
+H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space,
+ void *buf /*out*/)
{
- H5D_chunk_map_t *fm = NULL; /* Chunk file<->memory mapping */
- H5D_io_info_t io_info; /* Dataset I/O info */
- H5D_type_info_t type_info; /* Datatype info for operation */
- hbool_t type_info_init = FALSE; /* Whether the datatype info has been initialized */
- H5S_t * projected_mem_space = NULL; /* If not NULL, ptr to dataspace containing a */
- /* projection of the supplied mem_space to a new */
- /* dataspace with rank equal to that of */
- /* file_space. */
- /* */
- /* This field is only used if */
- /* H5S_select_shape_same() returns TRUE when */
- /* comparing the mem_space and the data_space, */
- /* and the mem_space have different rank. */
- /* */
- /* Note that if this variable is used, the */
- /* projected mem space must be discarded at the */
- /* end of the function to avoid a memory leak. */
- H5D_storage_t store; /* union of EFL and chunk pointer in file space */
- hsize_t nelmts; /* total number of elmts */
- hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */
- char fake_char; /* Temporary variable for NULL buffer pointers */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chunk_map_t *fm = NULL; /* Chunk file<->memory mapping */
+ H5D_io_info_t io_info; /* Dataset I/O info */
+ H5D_type_info_t type_info; /* Datatype info for operation */
+ hbool_t type_info_init = FALSE; /* Whether the datatype info has been initialized */
+ H5S_t * projected_mem_space = NULL; /* If not NULL, ptr to dataspace containing a */
+ /* projection of the supplied mem_space to a new */
+ /* dataspace with rank equal to that of */
+ /* file_space. */
+ /* */
+ /* This field is only used if */
+ /* H5S_select_shape_same() returns TRUE when */
+ /* comparing the mem_space and the data_space, */
+ /* and the mem_space have different rank. */
+ /* */
+ /* Note that if this variable is used, the */
+ /* projected mem space must be discarded at the */
+ /* end of the function to avoid a memory leak. */
+ H5D_storage_t store; /* union of EFL and chunk pointer in file space */
+ hsize_t nelmts; /* total number of elmts */
+ hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */
+ char fake_char; /* Temporary variable for NULL buffer pointers */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr)
/* check args */
HDassert(dataset && dataset->oloc.file);
- if(!file_space)
+ if (!file_space)
file_space = dataset->shared->space;
- if(!mem_space)
+ if (!mem_space)
mem_space = file_space;
nelmts = H5S_GET_SELECT_NPOINTS(mem_space);
/* Set up datatype info for operation */
- if(H5D__typeinfo_init(dataset, mem_type_id, FALSE, &type_info) < 0)
+ if (H5D__typeinfo_init(dataset, mem_type_id, FALSE, &type_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info")
type_info_init = TRUE;
#ifdef H5_HAVE_PARALLEL
/* Check for non-MPI-based VFD */
- if(!(H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI))) {
- H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */
+ if (!(H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI))) {
+ H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */
/* Get I/O transfer mode */
- if(H5CX_get_io_xfer_mode(&io_xfer_mode) < 0)
+ if (H5CX_get_io_xfer_mode(&io_xfer_mode) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode")
/* Collective access is not permissible without a MPI based VFD */
- if(io_xfer_mode == H5FD_MPIO_COLLECTIVE)
+ if (io_xfer_mode == H5FD_MPIO_COLLECTIVE)
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based drivers only")
- } /* end if */
+ } /* end if */
#endif /*H5_HAVE_PARALLEL*/
/* Make certain that the number of elements in each selection is the same */
- if(nelmts != H5S_GET_SELECT_NPOINTS(file_space))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest dataspaces have different number of elements selected")
+ if (nelmts != H5S_GET_SELECT_NPOINTS(file_space))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "src and dest dataspaces have different number of elements selected")
/* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */
- if(NULL == buf) {
+ if (NULL == buf) {
/* Check for any elements selected (which is invalid) */
- if(nelmts > 0)
+ if (nelmts > 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer")
- /* If the buffer is nil, and 0 element is selected, make a fake buffer.
- * This is for some MPI package like ChaMPIon on NCSA's tungsten which
- * doesn't support this feature.
- */
+ /* If the buffer is nil, and 0 element is selected, make a fake buffer.
+ * This is for some MPI package like ChaMPIon on NCSA's tungsten which
+ * doesn't support this feature.
+ */
buf = &fake_char;
} /* end if */
/* Make sure that both selections have their extents set */
- if(!(H5S_has_extent(file_space)))
+ if (!(H5S_has_extent(file_space)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file dataspace does not have extent set")
- if(!(H5S_has_extent(mem_space)))
+ if (!(H5S_has_extent(mem_space)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "memory dataspace does not have extent set")
/* H5S_select_shape_same() has been modified to accept topologically identical
@@ -470,23 +455,23 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
* Note that in general, this requires us to touch up the memory buffer as
* well.
*/
- if(TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) &&
- H5S_GET_EXTENT_NDIMS(mem_space) != H5S_GET_EXTENT_NDIMS(file_space)) {
- const void *adj_buf = NULL; /* Pointer to the location in buf corresponding */
- /* to the beginning of the projected mem space. */
+ if (TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) &&
+ H5S_GET_EXTENT_NDIMS(mem_space) != H5S_GET_EXTENT_NDIMS(file_space)) {
+ const void *adj_buf = NULL; /* Pointer to the location in buf corresponding */
+ /* to the beginning of the projected mem space. */
/* Attempt to construct projected dataspace for memory dataspace */
- if(H5S_select_construct_projection(mem_space, &projected_mem_space,
- (unsigned)H5S_GET_EXTENT_NDIMS(file_space), buf, &adj_buf, type_info.dst_type_size) < 0)
+ if (H5S_select_construct_projection(mem_space, &projected_mem_space,
+ (unsigned)H5S_GET_EXTENT_NDIMS(file_space), buf, &adj_buf,
+ type_info.dst_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to construct projected memory dataspace")
HDassert(projected_mem_space);
HDassert(adj_buf);
/* Switch to using projected memory dataspace & adjusted buffer */
mem_space = projected_mem_space;
- buf = (void *)adj_buf; /* Casting away 'const' OK -QAK */
- } /* end if */
-
+ buf = (void *)adj_buf; /* Casting away 'const' OK -QAK */
+ } /* end if */
/* Retrieve dataset properties */
/* <none needed in the general case> */
@@ -497,26 +482,30 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
* fill time is NEVER, there is no way to tell whether part of data
* has been overwritten. So just proceed in reading.
*/
- if(nelmts > 0 && dataset->shared->dcpl_cache.efl.nused == 0 &&
- !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) &&
- !(dataset->shared->layout.ops->is_data_cached && (*dataset->shared->layout.ops->is_data_cached)(dataset->shared))) {
- H5D_fill_value_t fill_status; /* Whether/How the fill value is defined */
+ if (nelmts > 0 && dataset->shared->dcpl_cache.efl.nused == 0 &&
+ !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) &&
+ !(dataset->shared->layout.ops->is_data_cached &&
+ (*dataset->shared->layout.ops->is_data_cached)(dataset->shared))) {
+ H5D_fill_value_t fill_status; /* Whether/How the fill value is defined */
/* Retrieve dataset's fill-value properties */
- if(H5P_is_fill_value_defined(&dataset->shared->dcpl_cache.fill, &fill_status) < 0)
+ if (H5P_is_fill_value_defined(&dataset->shared->dcpl_cache.fill, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
/* Should be impossible, but check anyway... */
- if(fill_status == H5D_FILL_VALUE_UNDEFINED &&
- (dataset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC || dataset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET))
- HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "read failed: dataset doesn't exist, no data can be read")
+ if (fill_status == H5D_FILL_VALUE_UNDEFINED &&
+ (dataset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC ||
+ dataset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET))
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL,
+ "read failed: dataset doesn't exist, no data can be read")
/* If we're never going to fill this dataset, just leave the junk in the user's buffer */
- if(dataset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_NEVER)
+ if (dataset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_NEVER)
HGOTO_DONE(SUCCEED)
/* Go fill the user's selection with the dataset's fill value */
- if(H5D__fill(dataset->shared->dcpl_cache.fill.buf, dataset->shared->type, buf, type_info.mem_type, mem_space) < 0)
+ if (H5D__fill(dataset->shared->dcpl_cache.fill.buf, dataset->shared->type, buf, type_info.mem_type,
+ mem_space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "filling buf failed")
else
HGOTO_DONE(SUCCEED)
@@ -524,56 +513,56 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Set up I/O operation */
io_info.op_type = H5D_IO_OP_READ;
- io_info.u.rbuf = buf;
- if(H5D__ioinfo_init(dataset, &type_info, &store, &io_info) < 0)
+ io_info.u.rbuf = buf;
+ if (H5D__ioinfo_init(dataset, &type_info, &store, &io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to set up I/O operation")
/* Sanity check that space is allocated, if there are elements */
- if(nelmts > 0)
- HDassert((*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage)
- || (dataset->shared->layout.ops->is_data_cached && (*dataset->shared->layout.ops->is_data_cached)(dataset->shared))
- || dataset->shared->dcpl_cache.efl.nused > 0
- || dataset->shared->layout.type == H5D_COMPACT);
+ if (nelmts > 0)
+ HDassert((*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) ||
+ (dataset->shared->layout.ops->is_data_cached &&
+ (*dataset->shared->layout.ops->is_data_cached)(dataset->shared)) ||
+ dataset->shared->dcpl_cache.efl.nused > 0 || dataset->shared->layout.type == H5D_COMPACT);
/* Allocate the chunk map */
- if(NULL == (fm = H5FL_CALLOC(H5D_chunk_map_t)))
+ if (NULL == (fm = H5FL_CALLOC(H5D_chunk_map_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk map")
/* Call storage method's I/O initialization routine */
- if(io_info.layout_ops.io_init && (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0)
+ if (io_info.layout_ops.io_init &&
+ (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info")
io_op_init = TRUE;
#ifdef H5_HAVE_PARALLEL
/* Adjust I/O info for any parallel I/O */
- if(H5D__ioinfo_adjust(&io_info, dataset, file_space, mem_space, &type_info) < 0)
+ if (H5D__ioinfo_adjust(&io_info, dataset, file_space, mem_space, &type_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to adjust I/O info for parallel I/O")
#endif /*H5_HAVE_PARALLEL*/
/* Invoke correct "high level" I/O routine */
- if((*io_info.io_ops.multi_read)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0)
+ if ((*io_info.io_ops.multi_read)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
done:
/* Shut down the I/O op information */
- if(io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(fm) < 0)
+ if (io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(fm) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down I/O op info")
- if(fm)
+ if (fm)
fm = H5FL_FREE(H5D_chunk_map_t, fm);
/* Shut down datatype info for operation */
- if(type_info_init && H5D__typeinfo_term(&type_info) < 0)
+ if (type_info_init && H5D__typeinfo_term(&type_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down type info")
/* discard projected mem space if it was created */
- if(NULL != projected_mem_space)
- if(H5S_close(projected_mem_space) < 0)
+ if (NULL != projected_mem_space)
+ if (H5S_close(projected_mem_space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down projected memory dataspace")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__read() */
-
/*-------------------------------------------------------------------------
* Function: H5D__write
*
@@ -588,31 +577,31 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
- const H5S_t *file_space, const void *buf)
+H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space,
+ const void *buf)
{
- H5D_chunk_map_t *fm = NULL; /* Chunk file<->memory mapping */
- H5D_io_info_t io_info; /* Dataset I/O info */
- H5D_type_info_t type_info; /* Datatype info for operation */
- hbool_t type_info_init = FALSE; /* Whether the datatype info has been initialized */
- H5S_t * projected_mem_space = NULL; /* If not NULL, ptr to dataspace containing a */
- /* projection of the supplied mem_space to a new */
- /* dataspace with rank equal to that of */
- /* file_space. */
- /* */
- /* This field is only used if */
- /* H5S_select_shape_same() returns TRUE when */
- /* comparing the mem_space and the data_space, */
- /* and the mem_space have different rank. */
- /* */
- /* Note that if this variable is used, the */
- /* projected mem space must be discarded at the */
- /* end of the function to avoid a memory leak. */
- H5D_storage_t store; /* union of EFL and chunk pointer in file space */
- hsize_t nelmts; /* total number of elmts */
- hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */
- char fake_char; /* Temporary variable for NULL buffer pointers */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_chunk_map_t *fm = NULL; /* Chunk file<->memory mapping */
+ H5D_io_info_t io_info; /* Dataset I/O info */
+ H5D_type_info_t type_info; /* Datatype info for operation */
+ hbool_t type_info_init = FALSE; /* Whether the datatype info has been initialized */
+ H5S_t * projected_mem_space = NULL; /* If not NULL, ptr to dataspace containing a */
+ /* projection of the supplied mem_space to a new */
+ /* dataspace with rank equal to that of */
+ /* file_space. */
+ /* */
+ /* This field is only used if */
+ /* H5S_select_shape_same() returns TRUE when */
+ /* comparing the mem_space and the data_space, */
+ /* and the mem_space have different rank. */
+ /* */
+ /* Note that if this variable is used, the */
+ /* projected mem space must be discarded at the */
+ /* end of the function to avoid a memory leak. */
+ H5D_storage_t store; /* union of EFL and chunk pointer in file space */
+ hsize_t nelmts; /* total number of elmts */
+ hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */
+ char fake_char; /* Temporary variable for NULL buffer pointers */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr)
@@ -620,73 +609,75 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
HDassert(dataset && dataset->oloc.file);
/* All filters in the DCPL must have encoding enabled. */
- if(!dataset->shared->checked_filters) {
- if(H5Z_can_apply(dataset->shared->dcpl_id, dataset->shared->type_id) < 0)
+ if (!dataset->shared->checked_filters) {
+ if (H5Z_can_apply(dataset->shared->dcpl_id, dataset->shared->type_id) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "can't apply filters")
dataset->shared->checked_filters = TRUE;
} /* end if */
/* Check if we are allowed to write to this file */
- if(0 == (H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR))
+ if (0 == (H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "no write intent on file")
/* Set up datatype info for operation */
- if(H5D__typeinfo_init(dataset, mem_type_id, TRUE, &type_info) < 0)
+ if (H5D__typeinfo_init(dataset, mem_type_id, TRUE, &type_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info")
type_info_init = TRUE;
/* Various MPI based checks */
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI)) {
+ if (H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI)) {
/* If MPI based VFD is used, no VL or region reference datatype support yet. */
/* This is because they use the global heap in the file and we don't */
/* support parallel access of that yet */
- if(H5T_is_vl_storage(type_info.mem_type) > 0)
- HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing VL or region reference datatypes yet")
+ if (H5T_is_vl_storage(type_info.mem_type) > 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
+ "Parallel IO does not support writing VL or region reference datatypes yet")
} /* end if */
else {
- H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */
+ H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */
/* Get I/O transfer mode */
- if(H5CX_get_io_xfer_mode(&io_xfer_mode) < 0)
+ if (H5CX_get_io_xfer_mode(&io_xfer_mode) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode")
/* Collective access is not permissible without a MPI based VFD */
- if(io_xfer_mode == H5FD_MPIO_COLLECTIVE)
+ if (io_xfer_mode == H5FD_MPIO_COLLECTIVE)
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based driver only")
- } /* end else */
+ } /* end else */
#endif /*H5_HAVE_PARALLEL*/
/* Initialize dataspace information */
- if(!file_space)
+ if (!file_space)
file_space = dataset->shared->space;
- if(!mem_space)
+ if (!mem_space)
mem_space = file_space;
nelmts = H5S_GET_SELECT_NPOINTS(mem_space);
/* Make certain that the number of elements in each selection is the same */
- if(nelmts != H5S_GET_SELECT_NPOINTS(file_space))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest dataspaces have different number of elements selected")
+ if (nelmts != H5S_GET_SELECT_NPOINTS(file_space))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "src and dest dataspaces have different number of elements selected")
/* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */
- if(NULL == buf) {
+ if (NULL == buf) {
/* Check for any elements selected (which is invalid) */
- if(nelmts > 0)
+ if (nelmts > 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer")
- /* If the buffer is nil, and 0 element is selected, make a fake buffer.
- * This is for some MPI package like ChaMPIon on NCSA's tungsten which
- * doesn't support this feature.
- */
+ /* If the buffer is nil, and 0 element is selected, make a fake buffer.
+ * This is for some MPI package like ChaMPIon on NCSA's tungsten which
+ * doesn't support this feature.
+ */
buf = &fake_char;
} /* end if */
/* Make sure that both selections have their extents set */
- if(!(H5S_has_extent(file_space)))
+ if (!(H5S_has_extent(file_space)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file dataspace does not have extent set")
- if(!(H5S_has_extent(mem_space)))
+ if (!(H5S_has_extent(mem_space)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "memory dataspace does not have extent set")
/* H5S_select_shape_same() has been modified to accept topologically
@@ -702,21 +693,22 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
* Note that in general, this requires us to touch up the memory buffer
* as well.
*/
- if(TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) &&
- H5S_GET_EXTENT_NDIMS(mem_space) != H5S_GET_EXTENT_NDIMS(file_space)) {
- const void *adj_buf = NULL; /* Pointer to the location in buf corresponding */
- /* to the beginning of the projected mem space. */
+ if (TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) &&
+ H5S_GET_EXTENT_NDIMS(mem_space) != H5S_GET_EXTENT_NDIMS(file_space)) {
+ const void *adj_buf = NULL; /* Pointer to the location in buf corresponding */
+ /* to the beginning of the projected mem space. */
/* Attempt to construct projected dataspace for memory dataspace */
- if(H5S_select_construct_projection(mem_space, &projected_mem_space,
- (unsigned)H5S_GET_EXTENT_NDIMS(file_space), buf, &adj_buf, type_info.src_type_size) < 0)
+ if (H5S_select_construct_projection(mem_space, &projected_mem_space,
+ (unsigned)H5S_GET_EXTENT_NDIMS(file_space), buf, &adj_buf,
+ type_info.src_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to construct projected memory dataspace")
HDassert(projected_mem_space);
HDassert(adj_buf);
/* Switch to using projected memory dataspace & adjusted buffer */
mem_space = projected_mem_space;
- buf = adj_buf;
+ buf = adj_buf;
} /* end if */
/* Retrieve dataset properties */
@@ -724,88 +716,88 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Set up I/O operation */
io_info.op_type = H5D_IO_OP_WRITE;
- io_info.u.wbuf = buf;
- if(H5D__ioinfo_init(dataset, &type_info, &store, &io_info) < 0)
+ io_info.u.wbuf = buf;
+ if (H5D__ioinfo_init(dataset, &type_info, &store, &io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up I/O operation")
/* Allocate dataspace and initialize it if it hasn't been. */
- if(nelmts > 0 && dataset->shared->dcpl_cache.efl.nused == 0 &&
- !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage)) {
- hssize_t file_nelmts; /* Number of elements in file dataset's dataspace */
- hbool_t full_overwrite; /* Whether we are over-writing all the elements */
+ if (nelmts > 0 && dataset->shared->dcpl_cache.efl.nused == 0 &&
+ !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage)) {
+ hssize_t file_nelmts; /* Number of elements in file dataset's dataspace */
+ hbool_t full_overwrite; /* Whether we are over-writing all the elements */
/* Get the number of elements in file dataset's dataspace */
- if((file_nelmts = H5S_GET_EXTENT_NPOINTS(file_space)) < 0)
+ if ((file_nelmts = H5S_GET_EXTENT_NPOINTS(file_space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "can't retrieve number of elements in file dataset")
/* Always allow fill values to be written if the dataset has a VL datatype */
- if(H5T_detect_class(dataset->shared->type, H5T_VLEN, FALSE))
+ if (H5T_detect_class(dataset->shared->type, H5T_VLEN, FALSE))
full_overwrite = FALSE;
else
full_overwrite = (hbool_t)((hsize_t)file_nelmts == nelmts ? TRUE : FALSE);
/* Allocate storage */
- if(H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, full_overwrite, NULL) < 0)
+ if (H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, full_overwrite, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
} /* end if */
/* Allocate the chunk map */
- if(NULL == (fm = H5FL_CALLOC(H5D_chunk_map_t)))
+ if (NULL == (fm = H5FL_CALLOC(H5D_chunk_map_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk map")
/* Call storage method's I/O initialization routine */
- if(io_info.layout_ops.io_init && (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0)
+ if (io_info.layout_ops.io_init &&
+ (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info")
io_op_init = TRUE;
#ifdef H5_HAVE_PARALLEL
/* Adjust I/O info for any parallel I/O */
- if(H5D__ioinfo_adjust(&io_info, dataset, file_space, mem_space, &type_info) < 0)
+ if (H5D__ioinfo_adjust(&io_info, dataset, file_space, mem_space, &type_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to adjust I/O info for parallel I/O")
#endif /*H5_HAVE_PARALLEL*/
/* Invoke correct "high level" I/O routine */
- if((*io_info.io_ops.multi_write)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0)
+ if ((*io_info.io_ops.multi_write)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
#ifdef OLD_WAY
-/*
- * This was taken out because it can be called in a parallel program with
- * independent access, causing the metadata cache to get corrupted. Its been
- * disabled for all types of access (serial as well as parallel) to make the
- * modification time consistent for all programs. -QAK
- *
- * We should set a value in the dataset's shared information instead and flush
- * it to the file when the dataset is being closed. -QAK
- */
+ /*
+ * This was taken out because it can be called in a parallel program with
+ * independent access, causing the metadata cache to get corrupted. Its been
+ * disabled for all types of access (serial as well as parallel) to make the
+ * modification time consistent for all programs. -QAK
+ *
+ * We should set a value in the dataset's shared information instead and flush
+ * it to the file when the dataset is being closed. -QAK
+ */
/*
* Update modification time. We have to do this explicitly because
* writing to a dataset doesn't necessarily change the object header.
*/
- if(H5O_touch(&(dataset->oloc), FALSE) < 0)
+ if (H5O_touch(&(dataset->oloc), FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time")
#endif /* OLD_WAY */
done:
/* Shut down the I/O op information */
- if(io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(fm) < 0)
+ if (io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(fm) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down I/O op info")
- if(fm)
+ if (fm)
fm = H5FL_FREE(H5D_chunk_map_t, fm);
/* Shut down datatype info for operation */
- if(type_info_init && H5D__typeinfo_term(&type_info) < 0)
+ if (type_info_init && H5D__typeinfo_term(&type_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down type info")
/* discard projected mem space if it was created */
- if(NULL != projected_mem_space)
- if(H5S_close(projected_mem_space) < 0)
+ if (NULL != projected_mem_space)
+ if (H5S_close(projected_mem_space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down projected memory dataspace")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__write() */
-
/*-------------------------------------------------------------------------
* Function: H5D__ioinfo_init
*
@@ -820,8 +812,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info,
- H5D_storage_t *store, H5D_io_info_t *io_info)
+H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info, H5D_storage_t *store, H5D_io_info_t *io_info)
{
FUNC_ENTER_STATIC_NOERR
@@ -833,31 +824,31 @@ H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info,
HDassert(io_info);
/* Set up "normal" I/O fields */
- io_info->dset = dset;
- io_info->f_sh = H5F_SHARED(dset->oloc.file);
+ io_info->dset = dset;
+ io_info->f_sh = H5F_SHARED(dset->oloc.file);
io_info->store = store;
/* Set I/O operations to initial values */
io_info->layout_ops = *dset->shared->layout.ops;
/* Set the "high-level" I/O operations for the dataset */
- io_info->io_ops.multi_read = dset->shared->layout.ops->ser_read;
+ io_info->io_ops.multi_read = dset->shared->layout.ops->ser_read;
io_info->io_ops.multi_write = dset->shared->layout.ops->ser_write;
/* Set the I/O operations for reading/writing single blocks on disk */
- if(type_info->is_xform_noop && type_info->is_conv_noop) {
+ if (type_info->is_xform_noop && type_info->is_conv_noop) {
/*
* If there is no data transform or type conversion then read directly into
* the application's buffer. This saves at least one mem-to-mem copy.
*/
- io_info->io_ops.single_read = H5D__select_read;
+ io_info->io_ops.single_read = H5D__select_read;
io_info->io_ops.single_write = H5D__select_write;
} /* end if */
else {
/*
* This is the general case (type conversion, usually).
*/
- io_info->io_ops.single_read = H5D__scatgath_read;
+ io_info->io_ops.single_read = H5D__scatgath_read;
io_info->io_ops.single_write = H5D__scatgath_write;
} /* end else */
@@ -869,7 +860,6 @@ H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info,
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__ioinfo_init() */
-
/*-------------------------------------------------------------------------
* Function: H5D__typeinfo_init
*
@@ -884,13 +874,12 @@ H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info,
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write,
- H5D_type_info_t *type_info)
+H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write, H5D_type_info_t *type_info)
{
- const H5T_t *src_type; /* Source datatype */
- const H5T_t *dst_type; /* Destination datatype */
- H5Z_data_xform_t *data_transform; /* Data transform info */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5T_t * src_type; /* Source datatype */
+ const H5T_t * dst_type; /* Destination datatype */
+ H5Z_data_xform_t *data_transform; /* Data transform info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -899,26 +888,26 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write,
HDassert(dset);
/* Patch the top level file pointer for dt->shared->u.vlen.f if needed */
- if(H5T_patch_vlen_file(dset->shared->type, H5F_VOL_OBJ(dset->oloc.file)) < 0 )
+ if (H5T_patch_vlen_file(dset->shared->type, H5F_VOL_OBJ(dset->oloc.file)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch VL datatype file pointer")
/* Initialize type info safely */
HDmemset(type_info, 0, sizeof(*type_info));
/* Get the memory & dataset datatypes */
- if(NULL == (type_info->mem_type = (const H5T_t *)H5I_object_verify(mem_type_id, H5I_DATATYPE)))
+ if (NULL == (type_info->mem_type = (const H5T_t *)H5I_object_verify(mem_type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
type_info->dset_type = dset->shared->type;
- if(do_write) {
- src_type = type_info->mem_type;
- dst_type = dset->shared->type;
+ if (do_write) {
+ src_type = type_info->mem_type;
+ dst_type = dset->shared->type;
type_info->src_type_id = mem_type_id;
type_info->dst_type_id = dset->shared->type_id;
} /* end if */
else {
- src_type = dset->shared->type;
- dst_type = type_info->mem_type;
+ src_type = dset->shared->type;
+ dst_type = type_info->mem_type;
type_info->src_type_id = dset->shared->type_id;
type_info->dst_type_id = mem_type_id;
} /* end else */
@@ -930,73 +919,72 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write,
* enough value in xfer_parms since turning off datatype conversion also
* turns off background preservation.
*/
- if(NULL == (type_info->tpath = H5T_path_find(src_type, dst_type)))
+ if (NULL == (type_info->tpath = H5T_path_find(src_type, dst_type)))
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype")
/* Retrieve info from API context */
- if(H5CX_get_data_transform(&data_transform) < 0)
+ if (H5CX_get_data_transform(&data_transform) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info")
/* Precompute some useful information */
type_info->src_type_size = H5T_get_size(src_type);
type_info->dst_type_size = H5T_get_size(dst_type);
type_info->max_type_size = MAX(type_info->src_type_size, type_info->dst_type_size);
- type_info->is_conv_noop = H5T_path_noop(type_info->tpath);
+ type_info->is_conv_noop = H5T_path_noop(type_info->tpath);
type_info->is_xform_noop = H5Z_xform_noop(data_transform);
- if(type_info->is_xform_noop && type_info->is_conv_noop) {
+ if (type_info->is_xform_noop && type_info->is_conv_noop) {
type_info->cmpd_subset = NULL;
- type_info->need_bkg = H5T_BKG_NO;
+ type_info->need_bkg = H5T_BKG_NO;
} /* end if */
else {
- void *tconv_buf; /* Temporary conversion buffer pointer */
- void *bkgr_buf; /* Background conversion buffer pointer */
- size_t max_temp_buf; /* Maximum temporary buffer size */
- H5T_bkg_t bkgr_buf_type; /* Background buffer type */
- size_t target_size; /* Desired buffer size */
+ void * tconv_buf; /* Temporary conversion buffer pointer */
+ void * bkgr_buf; /* Background conversion buffer pointer */
+ size_t max_temp_buf; /* Maximum temporary buffer size */
+ H5T_bkg_t bkgr_buf_type; /* Background buffer type */
+ size_t target_size; /* Desired buffer size */
/* Get info from API context */
- if(H5CX_get_max_temp_buf(&max_temp_buf) < 0)
+ if (H5CX_get_max_temp_buf(&max_temp_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve max. temp. buf size")
- if(H5CX_get_tconv_buf(&tconv_buf) < 0)
+ if (H5CX_get_tconv_buf(&tconv_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve temp. conversion buffer pointer")
- if(H5CX_get_bkgr_buf(&bkgr_buf) < 0)
+ if (H5CX_get_bkgr_buf(&bkgr_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve background conversion buffer pointer")
- if(H5CX_get_bkgr_buf_type(&bkgr_buf_type) < 0)
+ if (H5CX_get_bkgr_buf_type(&bkgr_buf_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve background buffer type")
/* Check if the datatypes are compound subsets of one another */
type_info->cmpd_subset = H5T_path_compound_subset(type_info->tpath);
/* Check if we need a background buffer */
- if(do_write && H5T_detect_class(dset->shared->type, H5T_VLEN, FALSE))
+ if (do_write && H5T_detect_class(dset->shared->type, H5T_VLEN, FALSE))
type_info->need_bkg = H5T_BKG_YES;
else {
- H5T_bkg_t path_bkg; /* Type conversion's background info */
+ H5T_bkg_t path_bkg; /* Type conversion's background info */
- if((path_bkg = H5T_path_bkg(type_info->tpath))) {
+ if ((path_bkg = H5T_path_bkg(type_info->tpath))) {
/* Retrieve the bkgr buffer property */
type_info->need_bkg = bkgr_buf_type;
type_info->need_bkg = MAX(path_bkg, type_info->need_bkg);
} /* end if */
else
type_info->need_bkg = H5T_BKG_NO; /*never needed even if app says yes*/
- } /* end else */
-
+ } /* end else */
/* Set up datatype conversion/background buffers */
target_size = max_temp_buf;
/* If the buffer is too small to hold even one element, try to make it bigger */
- if(target_size < type_info->max_type_size) {
- hbool_t default_buffer_info; /* Whether the buffer information are the defaults */
+ if (target_size < type_info->max_type_size) {
+ hbool_t default_buffer_info; /* Whether the buffer information are the defaults */
/* Detect if we have all default settings for buffers */
- default_buffer_info = (hbool_t)((H5D_TEMP_BUF_SIZE == max_temp_buf)
- && (NULL == tconv_buf) && (NULL == bkgr_buf));
+ default_buffer_info =
+ (hbool_t)((H5D_TEMP_BUF_SIZE == max_temp_buf) && (NULL == tconv_buf) && (NULL == bkgr_buf));
/* Check if we are using the default buffer info */
- if(default_buffer_info)
+ if (default_buffer_info)
/* OK to get bigger for library default settings */
target_size = type_info->max_type_size;
else
@@ -1008,42 +996,43 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write,
type_info->request_nelmts = target_size / type_info->max_type_size;
/* Sanity check elements in temporary buffer */
- if(type_info->request_nelmts == 0)
+ if (type_info->request_nelmts == 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
/* Get a temporary buffer for type conversion unless the app has already
* supplied one through the xfer properties. Instead of allocating a
* buffer which is the exact size, we allocate the target size.
*/
- if(NULL == (type_info->tconv_buf = (uint8_t *)tconv_buf)) {
+ if (NULL == (type_info->tconv_buf = (uint8_t *)tconv_buf)) {
/* Allocate temporary buffer */
- if(NULL == (type_info->tconv_buf = H5FL_BLK_CALLOC(type_conv, target_size)))
+ if (NULL == (type_info->tconv_buf = H5FL_BLK_CALLOC(type_conv, target_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
type_info->tconv_buf_allocated = TRUE;
} /* end if */
- if(type_info->need_bkg && NULL == (type_info->bkg_buf = (uint8_t *)bkgr_buf)) {
- size_t bkg_size; /* Desired background buffer size */
+ if (type_info->need_bkg && NULL == (type_info->bkg_buf = (uint8_t *)bkgr_buf)) {
+ size_t bkg_size; /* Desired background buffer size */
/* Compute the background buffer size */
/* (don't try to use buffers smaller than the default size) */
bkg_size = type_info->request_nelmts * type_info->dst_type_size;
- if(bkg_size < max_temp_buf)
+ if (bkg_size < max_temp_buf)
bkg_size = max_temp_buf;
/* Allocate background buffer */
/* (Need calloc()-like call since memory needs to be initialized) */
- if(NULL == (type_info->bkg_buf = H5FL_BLK_CALLOC(type_conv, bkg_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for background conversion")
+ if (NULL == (type_info->bkg_buf = H5FL_BLK_CALLOC(type_conv, bkg_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "memory allocation failed for background conversion")
type_info->bkg_buf_allocated = TRUE;
} /* end if */
- } /* end else */
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__typeinfo_init() */
#ifdef H5_HAVE_PARALLEL
-
+
/*-------------------------------------------------------------------------
* Function: H5D__ioinfo_adjust
*
@@ -1057,11 +1046,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
- const H5S_t *file_space, const H5S_t *mem_space,
- const H5D_type_info_t *type_info)
+H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_space, const H5S_t *mem_space,
+ const H5D_type_info_t *type_info)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1078,34 +1066,34 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
* the DXPL (if it's non-default) was previously used in a collective
* I/O operation.
*/
- if(!H5CX_is_def_dxpl()) {
+ if (!H5CX_is_def_dxpl()) {
H5CX_set_mpio_actual_chunk_opt(H5D_MPIO_NO_CHUNK_OPTIMIZATION);
H5CX_set_mpio_actual_io_mode(H5D_MPIO_NO_COLLECTIVE);
} /* end if */
/* Make any parallel I/O adjustments */
- if(io_info->using_mpi_vfd) {
+ if (io_info->using_mpi_vfd) {
H5FD_mpio_xfer_t xfer_mode; /* Parallel transfer for this request */
- htri_t opt; /* Flag whether a selection is optimizable */
+ htri_t opt; /* Flag whether a selection is optimizable */
/* Get the original state of parallel I/O transfer mode */
- if(H5CX_get_io_xfer_mode(&xfer_mode) < 0)
+ if (H5CX_get_io_xfer_mode(&xfer_mode) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode")
/* Get MPI communicator */
- if(MPI_COMM_NULL == (io_info->comm = H5F_mpi_get_comm(dset->oloc.file)))
+ if (MPI_COMM_NULL == (io_info->comm = H5F_mpi_get_comm(dset->oloc.file)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve MPI communicator")
/* Check if we can set direct MPI-IO read/write functions */
- if((opt = H5D__mpio_opt_possible(io_info, file_space, mem_space, type_info)) < 0)
+ if ((opt = H5D__mpio_opt_possible(io_info, file_space, mem_space, type_info)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "invalid check for direct IO dataspace ")
/* Check if we can use the optimized parallel I/O routines */
- if(opt == TRUE) {
+ if (opt == TRUE) {
/* Override the I/O op pointers to the MPI-specific routines */
- io_info->io_ops.multi_read = dset->shared->layout.ops->par_read;
- io_info->io_ops.multi_write = dset->shared->layout.ops->par_write;
- io_info->io_ops.single_read = H5D__mpio_select_read;
+ io_info->io_ops.multi_read = dset->shared->layout.ops->par_read;
+ io_info->io_ops.multi_write = dset->shared->layout.ops->par_write;
+ io_info->io_ops.single_read = H5D__mpio_select_read;
io_info->io_ops.single_write = H5D__mpio_select_write;
} /* end if */
else {
@@ -1114,41 +1102,46 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
* otherwise there will be metadata inconsistencies in the file.
*/
if (io_info->op_type == H5D_IO_OP_WRITE && io_info->dset->shared->dcpl_cache.pline.nused > 0) {
- H5D_mpio_no_collective_cause_t cause;
- uint32_t local_no_collective_cause;
- uint32_t global_no_collective_cause;
- hbool_t local_error_message_previously_written = FALSE;
- hbool_t global_error_message_previously_written = FALSE;
- size_t idx;
- size_t cause_strings_len;
- char local_no_collective_cause_string[512] = "";
- char global_no_collective_cause_string[512] = "";
- const char *cause_strings[] = { "independent I/O was requested",
- "datatype conversions were required",
- "data transforms needed to be applied",
- "optimized MPI types flag wasn't set",
- "one of the dataspaces was neither simple nor scalar",
- "dataset was not contiguous or chunked",
- "parallel writes to filtered datasets are disabled",
- "an error occurred while checking if collective I/O was possible" };
+ H5D_mpio_no_collective_cause_t cause;
+ uint32_t local_no_collective_cause;
+ uint32_t global_no_collective_cause;
+ hbool_t local_error_message_previously_written = FALSE;
+ hbool_t global_error_message_previously_written = FALSE;
+ size_t idx;
+ size_t cause_strings_len;
+ char local_no_collective_cause_string[512] = "";
+ char global_no_collective_cause_string[512] = "";
+ const char * cause_strings[] = {
+ "independent I/O was requested",
+ "datatype conversions were required",
+ "data transforms needed to be applied",
+ "optimized MPI types flag wasn't set",
+ "one of the dataspaces was neither simple nor scalar",
+ "dataset was not contiguous or chunked",
+ "parallel writes to filtered datasets are disabled",
+ "an error occurred while checking if collective I/O was possible"};
cause_strings_len = sizeof(cause_strings) / sizeof(cause_strings[0]);
- if(H5CX_get_mpio_local_no_coll_cause(&local_no_collective_cause) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get local no collective cause value")
- if(H5CX_get_mpio_global_no_coll_cause(&global_no_collective_cause) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get global no collective cause value")
+ if (H5CX_get_mpio_local_no_coll_cause(&local_no_collective_cause) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "unable to get local no collective cause value")
+ if (H5CX_get_mpio_global_no_coll_cause(&global_no_collective_cause) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "unable to get global no collective cause value")
/* Append each of the "reason for breaking collective I/O" error messages to the
* local and global no collective cause strings */
- for (cause = 1, idx = 0; (cause < H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE) && (idx < cause_strings_len); cause <<= 1, idx++) {
+ for (cause = 1, idx = 0;
+ (cause < H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE) && (idx < cause_strings_len);
+ cause <<= 1, idx++) {
size_t cause_strlen = HDstrlen(cause_strings[idx]);
if (cause & local_no_collective_cause) {
- /* Check if there were any previous error messages included. If so, prepend a semicolon
- * to separate the messages.
+ /* Check if there were any previous error messages included. If so, prepend a
+ * semicolon to separate the messages.
*/
- if(local_error_message_previously_written)
+ if (local_error_message_previously_written)
HDstrncat(local_no_collective_cause_string, "; ", 2);
HDstrncat(local_no_collective_cause_string, cause_strings[idx], cause_strlen);
@@ -1156,44 +1149,43 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
local_error_message_previously_written = TRUE;
} /* end if */
- if(cause & global_no_collective_cause) {
- /* Check if there were any previous error messages included. If so, prepend a semicolon
- * to separate the messages.
+ if (cause & global_no_collective_cause) {
+ /* Check if there were any previous error messages included. If so, prepend a
+ * semicolon to separate the messages.
*/
- if(global_error_message_previously_written)
+ if (global_error_message_previously_written)
HDstrncat(global_no_collective_cause_string, "; ", 2);
HDstrncat(global_no_collective_cause_string, cause_strings[idx], cause_strlen);
global_error_message_previously_written = TRUE;
} /* end if */
- } /* end for */
-
- HGOTO_ERROR(H5E_IO, H5E_NO_INDEPENDENT, FAIL, "Can't perform independent write with filters in pipeline.\n"
- " The following caused a break from collective I/O:\n"
- " Local causes: %s\n"
- " Global causes: %s",
- local_no_collective_cause_string,
- global_no_collective_cause_string);
+ } /* end for */
+
+ HGOTO_ERROR(H5E_IO, H5E_NO_INDEPENDENT, FAIL,
+ "Can't perform independent write with filters in pipeline.\n"
+ " The following caused a break from collective I/O:\n"
+ " Local causes: %s\n"
+ " Global causes: %s",
+ local_no_collective_cause_string, global_no_collective_cause_string);
} /* end if */
/* If we won't be doing collective I/O, but the user asked for
* collective I/O, change the request to use independent I/O
*/
- if(xfer_mode == H5FD_MPIO_COLLECTIVE) {
+ if (xfer_mode == H5FD_MPIO_COLLECTIVE) {
/* Change the xfer_mode to independent for handling the I/O */
- if(H5CX_set_io_xfer_mode(H5FD_MPIO_INDEPENDENT) < 0)
+ if (H5CX_set_io_xfer_mode(H5FD_MPIO_INDEPENDENT) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode")
} /* end if */
- } /* end else */
- } /* end if */
+ } /* end else */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__ioinfo_adjust() */
#endif /* H5_HAVE_PARALLEL */
-
/*-------------------------------------------------------------------------
* Function: H5D__typeinfo_term
*
@@ -1212,15 +1204,14 @@ H5D__typeinfo_term(const H5D_type_info_t *type_info)
FUNC_ENTER_STATIC_NOERR
/* Check for releasing datatype conversion & background buffers */
- if(type_info->tconv_buf_allocated) {
+ if (type_info->tconv_buf_allocated) {
HDassert(type_info->tconv_buf);
(void)H5FL_BLK_FREE(type_conv, type_info->tconv_buf);
} /* end if */
- if(type_info->bkg_buf_allocated) {
+ if (type_info->bkg_buf_allocated) {
HDassert(type_info->bkg_buf);
(void)H5FL_BLK_FREE(type_conv, type_info->bkg_buf);
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__typeinfo_term() */
-
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index 679a33b..160f9f5 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -15,58 +15,49 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5HLprivate.h" /* Local heaps */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5HLprivate.h" /* Local heaps */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
/* Format version bounds for layout */
const unsigned H5O_layout_ver_bounds[] = {
- H5O_LAYOUT_VERSION_1, /* H5F_LIBVER_EARLIEST */
- H5O_LAYOUT_VERSION_3, /* H5F_LIBVER_V18 */ /* H5O_LAYOUT_VERSION_DEFAULT */
- H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V110 */
- H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V112 */
- H5O_LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */
+ H5O_LAYOUT_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_LAYOUT_VERSION_3, /* H5F_LIBVER_V18 */ /* H5O_LAYOUT_VERSION_DEFAULT */
+ H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V110 */
+ H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V112 */
+ H5O_LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
-
/*-------------------------------------------------------------------------
* Function: H5D__layout_set_io_ops
*
@@ -83,7 +74,7 @@ const unsigned H5O_layout_ver_bounds[] = {
herr_t
H5D__layout_set_io_ops(const H5D_t *dataset)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -91,9 +82,9 @@ H5D__layout_set_io_ops(const H5D_t *dataset)
HDassert(dataset);
/* Set the I/O functions for each layout type */
- switch(dataset->shared->layout.type) {
+ switch (dataset->shared->layout.type) {
case H5D_CONTIGUOUS:
- if(dataset->shared->dcpl_cache.efl.nused > 0)
+ if (dataset->shared->dcpl_cache.efl.nused > 0)
dataset->shared->layout.ops = H5D_LOPS_EFL;
else
dataset->shared->layout.ops = H5D_LOPS_CONTIG;
@@ -103,7 +94,7 @@ H5D__layout_set_io_ops(const H5D_t *dataset)
dataset->shared->layout.ops = H5D_LOPS_CHUNK;
/* Set the chunk operations */
- switch(dataset->shared->layout.u.chunk.idx_type) {
+ switch (dataset->shared->layout.u.chunk.idx_type) {
case H5D_CHUNK_IDX_BTREE:
dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_BTREE;
break;
@@ -153,7 +144,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__layout_set_io_ops() */
-
/*-------------------------------------------------------------------------
* Function: H5D__layout_meta_size
*
@@ -172,7 +162,7 @@ done:
size_t
H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t include_compact_data)
{
- size_t ret_value = 0; /* Return value */
+ size_t ret_value = 0; /* Return value */
FUNC_ENTER_PACKAGE
@@ -180,32 +170,32 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ
HDassert(f);
HDassert(layout);
- ret_value = 1 + /* Version number */
- 1; /* layout class type */
+ ret_value = 1 + /* Version number */
+ 1; /* layout class type */
- switch(layout->type) {
+ switch (layout->type) {
case H5D_COMPACT:
/* This information only present in older versions of message */
/* Size of raw data */
ret_value += 2;
- if(include_compact_data)
+ if (include_compact_data)
ret_value += layout->storage.u.compact.size; /* data for compact dataset */
break;
case H5D_CONTIGUOUS:
/* This information only present in older versions of message */
- ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */
- ret_value += H5F_SIZEOF_SIZE(f); /* Length of data */
+ ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */
+ ret_value += H5F_SIZEOF_SIZE(f); /* Length of data */
break;
case H5D_CHUNKED:
- if(layout->version < H5O_LAYOUT_VERSION_4) {
+ if (layout->version < H5O_LAYOUT_VERSION_4) {
/* Number of dimensions (1 byte) */
HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
ret_value++;
/* B-tree address */
- ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */
+ ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */
/* Dimension sizes */
ret_value += layout->u.chunk.ndims * 4;
@@ -228,9 +218,10 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ
/* Type of chunk index */
ret_value++;
- switch(layout->u.chunk.idx_type) {
+ switch (layout->u.chunk.idx_type) {
case H5D_CHUNK_IDX_BTREE:
- HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, 0, "v1 B-tree index type found for layout message >v3")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, 0,
+ "v1 B-tree index type found for layout message >v3")
case H5D_CHUNK_IDX_NONE:
/* nothing */
@@ -238,10 +229,10 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ
case H5D_CHUNK_IDX_SINGLE:
/* Possible filter information */
- if(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) {
- ret_value += H5F_SIZEOF_SIZE(f); /* Size of chunk (in file) */
- ret_value += 4; /* Filter mask for chunk */
- } /* end if */
+ if (layout->u.chunk.flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) {
+ ret_value += H5F_SIZEOF_SIZE(f); /* Size of chunk (in file) */
+ ret_value += 4; /* Filter mask for chunk */
+ } /* end if */
break;
case H5D_CHUNK_IDX_FARRAY:
@@ -270,8 +261,8 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ
break;
case H5D_VIRTUAL:
- ret_value += H5F_SIZEOF_ADDR(f); /* Address of global heap */
- ret_value += 4; /* Global heap index */
+ ret_value += H5F_SIZEOF_ADDR(f); /* Address of global heap */
+ ret_value += 4; /* Global heap index */
break;
case H5D_LAYOUT_ERROR:
@@ -284,7 +275,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__layout_meta_size() */
-
/*-------------------------------------------------------------------------
* Function: H5D__layout_set_version
*
@@ -299,8 +289,8 @@ done:
herr_t
H5D__layout_set_version(H5F_t *f, H5O_layout_t *layout)
{
- unsigned version; /* Message version */
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned version; /* Message version */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -312,7 +302,7 @@ H5D__layout_set_version(H5F_t *f, H5O_layout_t *layout)
version = MAX(layout->version, H5O_layout_ver_bounds[H5F_LOW_BOUND(f)]);
/* Version bounds check */
- if(version > H5O_layout_ver_bounds[H5F_HIGH_BOUND(f)])
+ if (version > H5O_layout_ver_bounds[H5F_HIGH_BOUND(f)])
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "layout version out of bounds")
/* Set the message version */
@@ -322,7 +312,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__layout_set_version() */
-
/*-------------------------------------------------------------------------
* Function: H5D__layout_set_latest_indexing
*
@@ -336,10 +325,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space,
- const H5D_dcpl_cache_t *dcpl_cache)
+H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, const H5D_dcpl_cache_t *dcpl_cache)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -349,104 +337,104 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space,
HDassert(dcpl_cache);
/* The indexing methods only apply to chunked datasets (currently) */
- if(layout->type == H5D_CHUNKED) {
- int sndims; /* Rank of dataspace */
- unsigned ndims; /* Rank of dataspace */
+ if (layout->type == H5D_CHUNKED) {
+ int sndims; /* Rank of dataspace */
+ unsigned ndims; /* Rank of dataspace */
/* Query the dimensionality of the dataspace */
- if((sndims = H5S_GET_EXTENT_NDIMS(space)) < 0)
+ if ((sndims = H5S_GET_EXTENT_NDIMS(space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "invalid dataspace rank")
ndims = (unsigned)sndims;
/* Avoid scalar/null dataspace */
- if(ndims > 0) {
- hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Maximum dimension sizes */
- hsize_t cur_dims[H5O_LAYOUT_NDIMS]; /* Current dimension sizes */
- unsigned unlim_count = 0; /* Count of unlimited max. dimensions */
- hbool_t single = TRUE; /* Fulfill single chunk indexing */
- unsigned u; /* Local index variable */
+ if (ndims > 0) {
+ hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Maximum dimension sizes */
+ hsize_t cur_dims[H5O_LAYOUT_NDIMS]; /* Current dimension sizes */
+ unsigned unlim_count = 0; /* Count of unlimited max. dimensions */
+ hbool_t single = TRUE; /* Fulfill single chunk indexing */
+ unsigned u; /* Local index variable */
/* Query the dataspace's dimensions */
- if(H5S_get_simple_extent_dims(space, cur_dims, max_dims) < 0)
+ if (H5S_get_simple_extent_dims(space, cur_dims, max_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace max. dimensions")
/* Spin through the max. dimensions, looking for unlimited dimensions */
- for(u = 0; u < ndims; u++) {
- if(max_dims[u] == H5S_UNLIMITED)
+ for (u = 0; u < ndims; u++) {
+ if (max_dims[u] == H5S_UNLIMITED)
unlim_count++;
- if(cur_dims[u] != max_dims[u] || cur_dims[u] != layout->u.chunk.dim[u])
+ if (cur_dims[u] != max_dims[u] || cur_dims[u] != layout->u.chunk.dim[u])
single = FALSE;
} /* end for */
/* Chunked datasets with unlimited dimension(s) */
- if(unlim_count) { /* dataset with unlimited dimension(s) must be chunked */
- if(1 == unlim_count) { /* Chunked dataset with only 1 unlimited dimension */
+ if (unlim_count) { /* dataset with unlimited dimension(s) must be chunked */
+ if (1 == unlim_count) { /* Chunked dataset with only 1 unlimited dimension */
/* Set the chunk index type to an extensible array */
- layout->u.chunk.idx_type = H5D_CHUNK_IDX_EARRAY;
+ layout->u.chunk.idx_type = H5D_CHUNK_IDX_EARRAY;
layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_EARRAY;
- layout->storage.u.chunk.ops = H5D_COPS_EARRAY;
+ layout->storage.u.chunk.ops = H5D_COPS_EARRAY;
/* Set the extensible array creation parameters */
/* (use hard-coded defaults for now, until we give applications
* control over this with a property list - QAK)
*/
- layout->u.chunk.u.earray.cparam.max_nelmts_bits = H5D_EARRAY_MAX_NELMTS_BITS;
- layout->u.chunk.u.earray.cparam.idx_blk_elmts = H5D_EARRAY_IDX_BLK_ELMTS;
+ layout->u.chunk.u.earray.cparam.max_nelmts_bits = H5D_EARRAY_MAX_NELMTS_BITS;
+ layout->u.chunk.u.earray.cparam.idx_blk_elmts = H5D_EARRAY_IDX_BLK_ELMTS;
layout->u.chunk.u.earray.cparam.sup_blk_min_data_ptrs = H5D_EARRAY_SUP_BLK_MIN_DATA_PTRS;
- layout->u.chunk.u.earray.cparam.data_blk_min_elmts = H5D_EARRAY_DATA_BLK_MIN_ELMTS;
- layout->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits = H5D_EARRAY_MAX_DBLOCK_PAGE_NELMTS_BITS;
- } /* end if */
+ layout->u.chunk.u.earray.cparam.data_blk_min_elmts = H5D_EARRAY_DATA_BLK_MIN_ELMTS;
+ layout->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits =
+ H5D_EARRAY_MAX_DBLOCK_PAGE_NELMTS_BITS;
+ } /* end if */
else { /* Chunked dataset with > 1 unlimited dimensions */
/* Set the chunk index type to v2 B-tree */
- layout->u.chunk.idx_type = H5D_CHUNK_IDX_BT2;
+ layout->u.chunk.idx_type = H5D_CHUNK_IDX_BT2;
layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BT2;
- layout->storage.u.chunk.ops = H5D_COPS_BT2;
+ layout->storage.u.chunk.ops = H5D_COPS_BT2;
/* Set the v2 B-tree creation parameters */
/* (use hard-coded defaults for now, until we give applications
* control over this with a property list - QAK)
*/
- layout->u.chunk.u.btree2.cparam.node_size = H5D_BT2_NODE_SIZE;
+ layout->u.chunk.u.btree2.cparam.node_size = H5D_BT2_NODE_SIZE;
layout->u.chunk.u.btree2.cparam.split_percent = H5D_BT2_SPLIT_PERC;
- layout->u.chunk.u.btree2.cparam.merge_percent = H5D_BT2_MERGE_PERC;
- } /* end else */
- } /* end if */
- else { /* Chunked dataset with fixed dimensions */
+ layout->u.chunk.u.btree2.cparam.merge_percent = H5D_BT2_MERGE_PERC;
+ } /* end else */
+ } /* end if */
+ else { /* Chunked dataset with fixed dimensions */
/* Check for correct condition for using "single chunk" chunk index */
- if(single) {
- layout->u.chunk.idx_type = H5D_CHUNK_IDX_SINGLE;
+ if (single) {
+ layout->u.chunk.idx_type = H5D_CHUNK_IDX_SINGLE;
layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_SINGLE;
- layout->storage.u.chunk.ops = H5D_COPS_SINGLE;
+ layout->storage.u.chunk.ops = H5D_COPS_SINGLE;
} /* end if */
- else if(!dcpl_cache->pline.nused &&
- dcpl_cache->fill.alloc_time == H5D_ALLOC_TIME_EARLY) {
+ else if (!dcpl_cache->pline.nused && dcpl_cache->fill.alloc_time == H5D_ALLOC_TIME_EARLY) {
/* Set the chunk index type to "none" Index */
- layout->u.chunk.idx_type = H5D_CHUNK_IDX_NONE;
+ layout->u.chunk.idx_type = H5D_CHUNK_IDX_NONE;
layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_NONE;
- layout->storage.u.chunk.ops = H5D_COPS_NONE;
+ layout->storage.u.chunk.ops = H5D_COPS_NONE;
} /* end else-if */
else {
/* Set the chunk index type to Fixed Array */
- layout->u.chunk.idx_type = H5D_CHUNK_IDX_FARRAY;
+ layout->u.chunk.idx_type = H5D_CHUNK_IDX_FARRAY;
layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_FARRAY;
- layout->storage.u.chunk.ops = H5D_COPS_FARRAY;
+ layout->storage.u.chunk.ops = H5D_COPS_FARRAY;
/* Set the fixed array creation parameters */
/* (use hard-coded defaults for now, until we give applications
* control over this with a property list - QAK)
*/
- layout->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits = H5D_FARRAY_MAX_DBLK_PAGE_NELMTS_BITS;
+ layout->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits =
+ H5D_FARRAY_MAX_DBLK_PAGE_NELMTS_BITS;
} /* end else */
- } /* end else */
- } /* end if */
- } /* end if */
+ } /* end else */
+ } /* end if */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__layout_set_latest_indexing() */
-
/*-------------------------------------------------------------------------
* Function: H5D__layout_oh_create
*
@@ -463,11 +451,11 @@ done:
herr_t
H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
{
- H5O_layout_t *layout; /* Dataset's layout information */
- const H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
- unsigned layout_mesg_flags; /* Flags for inserting layout message */
- hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_layout_t * layout; /* Dataset's layout information */
+ const H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
+ unsigned layout_mesg_flags; /* Flags for inserting layout message */
+ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
@@ -477,20 +465,21 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
HDassert(dset);
/* Set some local variables, for convenience */
- layout = &dset->shared->layout;
+ layout = &dset->shared->layout;
fill_prop = &dset->shared->dcpl_cache.fill;
/* Update the filters message, if this is a chunked dataset */
- if(layout->type == H5D_CHUNKED) {
- H5O_pline_t *pline; /* Dataset's I/O pipeline information */
+ if (layout->type == H5D_CHUNKED) {
+ H5O_pline_t *pline; /* Dataset's I/O pipeline information */
pline = &dset->shared->dcpl_cache.pline;
- if(pline->nused > 0 && H5O_msg_append_oh(file, oh, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, pline) < 0)
+ if (pline->nused > 0 &&
+ H5O_msg_append_oh(file, oh, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, pline) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update filter header message")
} /* end if */
/* Initialize the layout information for the new dataset */
- if(dset->shared->layout.ops->init && (dset->shared->layout.ops->init)(file, dset, dapl_id) < 0)
+ if (dset->shared->layout.ops->init && (dset->shared->layout.ops->init)(file, dset, dapl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize layout information")
/* Indicate that the layout information was initialized */
@@ -500,46 +489,46 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
* Allocate storage if space allocate time is early; otherwise delay
* allocation until later.
*/
- if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY) {
+ if (fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY) {
H5D_io_info_t io_info;
io_info.dset = dset;
- if(H5D__alloc_storage(&io_info, H5D_ALLOC_CREATE, FALSE, NULL) < 0)
+ if (H5D__alloc_storage(&io_info, H5D_ALLOC_CREATE, FALSE, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
}
/* Update external storage message, if it's used */
- if(dset->shared->dcpl_cache.efl.nused > 0) {
+ if (dset->shared->dcpl_cache.efl.nused > 0) {
H5O_efl_t *efl = &dset->shared->dcpl_cache.efl; /* Dataset's external file list */
- H5HL_t *heap; /* Pointer to local heap for EFL file names */
- size_t heap_size = H5HL_ALIGN(1);
- size_t u;
+ H5HL_t * heap; /* Pointer to local heap for EFL file names */
+ size_t heap_size = H5HL_ALIGN(1);
+ size_t u;
/* Determine size of heap needed to stored the file names */
- for(u = 0; u < efl->nused; ++u)
+ for (u = 0; u < efl->nused; ++u)
heap_size += H5HL_ALIGN(HDstrlen(efl->slot[u].name) + 1);
/* Create the heap for the EFL file names */
- if(H5HL_create(file, heap_size, &efl->heap_addr/*out*/) < 0)
+ if (H5HL_create(file, heap_size, &efl->heap_addr /*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create EFL file name heap")
/* Pin the heap down in memory */
- if(NULL == (heap = H5HL_protect(file, efl->heap_addr, H5AC__NO_FLAGS_SET)))
+ if (NULL == (heap = H5HL_protect(file, efl->heap_addr, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect EFL file name heap")
/* Insert "empty" name first */
- if(UFAIL == H5HL_insert(file, heap, (size_t)1, "")) {
+ if (UFAIL == H5HL_insert(file, heap, (size_t)1, "")) {
H5HL_unprotect(heap);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap")
} /* end if */
- for(u = 0; u < efl->nused; ++u) {
- size_t offset; /* Offset of file name in heap */
+ for (u = 0; u < efl->nused; ++u) {
+ size_t offset; /* Offset of file name in heap */
/* Insert file name into heap */
- if(UFAIL == (offset = H5HL_insert(file, heap,
- HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name))) {
+ if (UFAIL ==
+ (offset = H5HL_insert(file, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name))) {
H5HL_unprotect(heap);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap")
} /* end if */
@@ -549,12 +538,12 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
} /* end for */
/* Release the heap */
- if(H5HL_unprotect(heap) < 0)
+ if (H5HL_unprotect(heap) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to unprotect EFL file name heap")
heap = NULL;
/* Insert EFL message into dataset object header */
- if(H5O_msg_append_oh(file, oh, H5O_EFL_ID, H5O_MSG_FLAG_CONSTANT, 0, efl) < 0)
+ if (H5O_msg_append_oh(file, oh, H5O_EFL_ID, H5O_MSG_FLAG_CONSTANT, 0, efl) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update external file list message")
} /* end if */
@@ -562,34 +551,32 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
/* (Don't make layout message constant unless allocation time is early and
* non-filtered and has >0 elements, since space may not be allocated -QAK) */
/* (Note: this is relying on H5D__alloc_storage not calling H5O_msg_write during dataset creation) */
- if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type
- && !dset->shared->dcpl_cache.pline.nused
- && (0 != H5S_GET_EXTENT_NPOINTS(dset->shared->space)))
+ if (fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type &&
+ !dset->shared->dcpl_cache.pline.nused && (0 != H5S_GET_EXTENT_NPOINTS(dset->shared->space)))
layout_mesg_flags = H5O_MSG_FLAG_CONSTANT;
else
- layout_mesg_flags = 0;
+ layout_mesg_flags = 0;
/* Store VDS info in global heap */
- if(H5D_VIRTUAL == layout->type)
- if(H5D__virtual_store_layout(file, layout) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to store VDS info")
+ if (H5D_VIRTUAL == layout->type)
+ if (H5D__virtual_store_layout(file, layout) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to store VDS info")
/* Create layout message */
- if(H5O_msg_append_oh(file, oh, H5O_LAYOUT_ID, layout_mesg_flags, 0, layout) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout")
+ if (H5O_msg_append_oh(file, oh, H5O_LAYOUT_ID, layout_mesg_flags, 0, layout) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout")
done:
/* Error cleanup */
- if(ret_value < 0)
- if(layout_init)
+ if (ret_value < 0)
+ if (layout_init)
/* Destroy any cached layout information for the dataset */
- if(dset->shared->layout.ops->dest && (dset->shared->layout.ops->dest)(dset) < 0)
+ if (dset->shared->layout.ops->dest && (dset->shared->layout.ops->dest)(dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info")
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__layout_oh_create() */
-
/*-------------------------------------------------------------------------
* Function: H5D__layout_oh_read
*
@@ -606,9 +593,9 @@ done:
herr_t
H5D__layout_oh_read(H5D_t *dataset, hid_t dapl_id, H5P_genplist_t *plist)
{
- htri_t msg_exists; /* Whether a particular type of message exists */
- hbool_t layout_copied = FALSE; /* Flag to indicate that layout message was copied */
- herr_t ret_value = SUCCEED; /* Return value */
+ htri_t msg_exists; /* Whether a particular type of message exists */
+ hbool_t layout_copied = FALSE; /* Flag to indicate that layout message was copied */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -617,15 +604,15 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dapl_id, H5P_genplist_t *plist)
HDassert(plist);
/* Get the optional filters message */
- if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_PLINE_ID)) < 0)
+ if ((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_PLINE_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists")
- if(msg_exists) {
+ if (msg_exists) {
/* Retrieve the I/O pipeline message */
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline))
+ if (NULL == H5O_msg_read(&(dataset->oloc), H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message")
/* Set the I/O pipeline info in the property list */
- if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &dataset->shared->dcpl_cache.pline) < 0)
+ if (H5P_set(plist, H5O_CRT_PIPELINE_NAME, &dataset->shared->dcpl_cache.pline) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set pipeline")
} /* end if */
@@ -635,20 +622,20 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dapl_id, H5P_genplist_t *plist)
* values are copied to the dataset create plist so the user can query
* them.
*/
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout)))
+ if (NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message")
layout_copied = TRUE;
/* Check for external file list message (which might not exist) */
- if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_EFL_ID)) < 0)
+ if ((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_EFL_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists")
- if(msg_exists) {
+ if (msg_exists) {
/* Retrieve the EFL message */
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_EFL_ID, &dataset->shared->dcpl_cache.efl))
+ if (NULL == H5O_msg_read(&(dataset->oloc), H5O_EFL_ID, &dataset->shared->dcpl_cache.efl))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message")
/* Set the EFL info in the property list */
- if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &dataset->shared->dcpl_cache.efl) < 0)
+ if (H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &dataset->shared->dcpl_cache.efl) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set external file list")
/* Set the dataset's I/O operations */
@@ -659,31 +646,31 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dapl_id, H5P_genplist_t *plist)
HDassert(dataset->shared->layout.ops);
/* Initialize the layout information for the dataset */
- if(dataset->shared->layout.ops->init && (dataset->shared->layout.ops->init)(dataset->oloc.file, dataset, dapl_id) < 0)
+ if (dataset->shared->layout.ops->init &&
+ (dataset->shared->layout.ops->init)(dataset->oloc.file, dataset, dapl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize layout information")
/* Adjust chunk dimensions to omit datatype size (in last dimension) for creation property */
- if(H5D_CHUNKED == dataset->shared->layout.type)
+ if (H5D_CHUNKED == dataset->shared->layout.type)
dataset->shared->layout.u.chunk.ndims--;
/* Copy layout to the DCPL */
- if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &dataset->shared->layout) < 0)
+ if (H5P_set(plist, H5D_CRT_LAYOUT_NAME, &dataset->shared->layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout")
/* Set chunk sizes */
- if(H5D_CHUNKED == dataset->shared->layout.type)
- if(H5D__chunk_set_sizes(dataset) < 0)
+ if (H5D_CHUNKED == dataset->shared->layout.type)
+ if (H5D__chunk_set_sizes(dataset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to set chunk sizes")
done:
- if(ret_value < 0 && layout_copied)
- if(H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0)
+ if (ret_value < 0 && layout_copied)
+ if (H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__layout_oh_read() */
-
/*-------------------------------------------------------------------------
* Function: H5D__layout_oh_write
*
@@ -700,8 +687,8 @@ done:
herr_t
H5D__layout_oh_write(const H5D_t *dataset, H5O_t *oh, unsigned update_flags)
{
- htri_t msg_exists; /* Whether the layout message exists */
- herr_t ret_value = SUCCEED; /* Return value */
+ htri_t msg_exists; /* Whether the layout message exists */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -710,15 +697,15 @@ H5D__layout_oh_write(const H5D_t *dataset, H5O_t *oh, unsigned update_flags)
HDassert(oh);
/* Check if the layout message has been added to the dataset's header */
- if((msg_exists = H5O_msg_exists_oh(oh, H5O_LAYOUT_ID)) < 0)
+ if ((msg_exists = H5O_msg_exists_oh(oh, H5O_LAYOUT_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to check if layout message exists")
- if(msg_exists) {
+ if (msg_exists) {
/* Write the layout message to the dataset's header */
- if(H5O_msg_write_oh(dataset->oloc.file, oh, H5O_LAYOUT_ID, 0, update_flags, &dataset->shared->layout) < 0)
+ if (H5O_msg_write_oh(dataset->oloc.file, oh, H5O_LAYOUT_ID, 0, update_flags,
+ &dataset->shared->layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout message")
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__layout_oh_write() */
-
diff --git a/src/H5Dmodule.h b/src/H5Dmodule.h
index 27ccf54..178e50f 100644
--- a/src/H5Dmodule.h
+++ b/src/H5Dmodule.h
@@ -25,9 +25,8 @@
* reporting macros.
*/
#define H5D_MODULE
-#define H5_MY_PKG H5D
-#define H5_MY_PKG_ERR H5E_DATASET
-#define H5_MY_PKG_INIT YES
+#define H5_MY_PKG H5D
+#define H5_MY_PKG_ERR H5E_DATASET
+#define H5_MY_PKG_INIT YES
#endif /* _H5Dmodule_H */
-
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index e6274d5..df7c829 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -25,24 +25,23 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5Sprivate.h" /* Dataspaces */
-#include "H5VMprivate.h" /* Vector */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Sprivate.h" /* Dataspaces */
+#include "H5VMprivate.h" /* Vector */
#ifdef H5_HAVE_PARALLEL
@@ -67,7 +66,7 @@
#define H5D_OBTAIN_ALL_CHUNK_ADDR_COL 2
/* Macros to define the default ratio of obtaining all chunk addresses for one linked-chunk IO case */
-#define H5D_ALL_CHUNK_ADDR_THRES_COL 30
+#define H5D_ALL_CHUNK_ADDR_THRES_COL 30
#define H5D_ALL_CHUNK_ADDR_THRES_COL_NUM 10000
/***** Macros for multi-chunk collective IO case. *****/
@@ -77,31 +76,29 @@
*/
/* Macros to represent different IO modes(NONE, Independent or collective)for multiple chunk IO case */
-#define H5D_CHUNK_IO_MODE_COL 1
+#define H5D_CHUNK_IO_MODE_COL 1
/* Macros to represent the regularity of the selection for multiple chunk IO case. */
-#define H5D_CHUNK_SELECT_REG 1
-
+#define H5D_CHUNK_SELECT_REG 1
/******************/
/* Local Typedefs */
/******************/
/* Combine chunk address and chunk info into a struct for better performance. */
typedef struct H5D_chunk_addr_info_t {
- haddr_t chunk_addr;
+ haddr_t chunk_addr;
H5D_chunk_info_t chunk_info;
} H5D_chunk_addr_info_t;
/* Rank 0 Bcast values */
typedef enum H5D_mpio_no_rank0_bcast_cause_t {
- H5D_MPIO_RANK0_BCAST = 0x00,
- H5D_MPIO_RANK0_NOT_H5S_ALL = 0x01,
- H5D_MPIO_RANK0_NOT_CONTIGUOUS = 0x02,
- H5D_MPIO_RANK0_NOT_FIXED_SIZE = 0x04,
+ H5D_MPIO_RANK0_BCAST = 0x00,
+ H5D_MPIO_RANK0_NOT_H5S_ALL = 0x01,
+ H5D_MPIO_RANK0_NOT_CONTIGUOUS = 0x02,
+ H5D_MPIO_RANK0_NOT_FIXED_SIZE = 0x04,
H5D_MPIO_RANK0_GREATER_THAN_2GB = 0x08
} H5D_mpio_no_rank0_bcast_cause_t;
-
/*
* Information about a single chunk when performing collective filtered I/O. All
* of the fields of one of these structs are initialized at the start of collective
@@ -186,91 +183,93 @@ typedef enum H5D_mpio_no_rank0_bcast_cause_t {
* receive_buffer_array fields.
*/
typedef struct H5D_filtered_collective_io_info_t {
- hsize_t index;
- hsize_t scaled[H5O_LAYOUT_NDIMS];
- hbool_t full_overwrite;
- size_t num_writers;
- size_t io_size;
- void *buf;
-
- struct {
- H5F_block_t chunk_current;
- H5F_block_t new_chunk;
- } chunk_states;
-
- struct {
- int original_owner;
- int new_owner;
- } owners;
-
- struct {
- MPI_Request *receive_requests_array;
- unsigned char **receive_buffer_array;
- int num_receive_requests;
- } async_info;
+ hsize_t index;
+ hsize_t scaled[H5O_LAYOUT_NDIMS];
+ hbool_t full_overwrite;
+ size_t num_writers;
+ size_t io_size;
+ void * buf;
+
+ struct {
+ H5F_block_t chunk_current;
+ H5F_block_t new_chunk;
+ } chunk_states;
+
+ struct {
+ int original_owner;
+ int new_owner;
+ } owners;
+
+ struct {
+ MPI_Request * receive_requests_array;
+ unsigned char **receive_buffer_array;
+ int num_receive_requests;
+ } async_info;
} H5D_filtered_collective_io_info_t;
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5D__chunk_collective_io(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, H5D_chunk_map_t *fm);
-static herr_t H5D__multi_chunk_collective_io(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, H5D_chunk_map_t *fm);
-static herr_t H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, H5D_chunk_map_t *fm);
-static herr_t H5D__link_chunk_collective_io(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, H5D_chunk_map_t *fm, int sum_chunk);
-static herr_t H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, H5D_chunk_map_t *fm);
-static herr_t H5D__inter_collective_io(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, const H5S_t *file_space,
- const H5S_t *mem_space);
-static herr_t H5D__final_collective_io(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, hsize_t nelmts, MPI_Datatype mpi_file_type,
- MPI_Datatype mpi_buf_type);
+static herr_t H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ H5D_chunk_map_t *fm);
+static herr_t H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ H5D_chunk_map_t *fm);
+static herr_t H5D__multi_chunk_filtered_collective_io(H5D_io_info_t * io_info,
+ const H5D_type_info_t *type_info, H5D_chunk_map_t *fm);
+static herr_t H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ H5D_chunk_map_t *fm, int sum_chunk);
+static herr_t H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ H5D_chunk_map_t *fm);
+static herr_t H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ const H5S_t *file_space, const H5S_t *mem_space);
+static herr_t H5D__final_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ hsize_t nelmts, MPI_Datatype mpi_file_type, MPI_Datatype mpi_buf_type);
static herr_t H5D__sort_chunk(H5D_io_info_t *io_info, const H5D_chunk_map_t *fm,
- H5D_chunk_addr_info_t chunk_addr_info_array[], int many_chunk_opt);
-static herr_t H5D__obtain_mpio_mode(H5D_io_info_t *io_info, H5D_chunk_map_t *fm,
- uint8_t assign_io_mode[], haddr_t chunk_addr[]);
-static herr_t H5D__mpio_get_sum_chunk(const H5D_io_info_t *io_info,
- const H5D_chunk_map_t *fm, int *sum_chunkf);
-static herr_t H5D__construct_filtered_io_info_list(const H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, const H5D_chunk_map_t *fm,
- H5D_filtered_collective_io_info_t **chunk_list, size_t *num_entries);
+ H5D_chunk_addr_info_t chunk_addr_info_array[], int many_chunk_opt);
+static herr_t H5D__obtain_mpio_mode(H5D_io_info_t *io_info, H5D_chunk_map_t *fm, uint8_t assign_io_mode[],
+ haddr_t chunk_addr[]);
+static herr_t H5D__mpio_get_sum_chunk(const H5D_io_info_t *io_info, const H5D_chunk_map_t *fm,
+ int *sum_chunkf);
+static herr_t H5D__construct_filtered_io_info_list(const H5D_io_info_t * io_info,
+ const H5D_type_info_t * type_info,
+ const H5D_chunk_map_t * fm,
+ H5D_filtered_collective_io_info_t **chunk_list,
+ size_t * num_entries);
#if MPI_VERSION >= 3
-static herr_t H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, const H5D_chunk_map_t *fm,
- H5D_filtered_collective_io_info_t *local_chunk_array, size_t *local_chunk_array_num_entries);
+static herr_t H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t * io_info,
+ const H5D_type_info_t * type_info,
+ const H5D_chunk_map_t * fm,
+ H5D_filtered_collective_io_info_t *local_chunk_array,
+ size_t *local_chunk_array_num_entries);
#endif
static herr_t H5D__mpio_array_gatherv(void *local_array, size_t local_array_num_entries,
- size_t array_entry_size, void **gathered_array, size_t *gathered_array_num_entries,
- hbool_t allgather, int root, MPI_Comm comm, int (*sort_func)(const void *, const void *));
-static herr_t H5D__mpio_filtered_collective_write_type(
- H5D_filtered_collective_io_info_t *chunk_list, size_t num_entries,
- MPI_Datatype *new_mem_type, hbool_t *mem_type_derived,
- MPI_Datatype *new_file_type, hbool_t *file_type_derived);
+ size_t array_entry_size, void **gathered_array,
+ size_t *gathered_array_num_entries, hbool_t allgather, int root,
+ MPI_Comm comm, int (*sort_func)(const void *, const void *));
+static herr_t H5D__mpio_filtered_collective_write_type(H5D_filtered_collective_io_info_t *chunk_list,
+ size_t num_entries, MPI_Datatype *new_mem_type,
+ hbool_t *mem_type_derived, MPI_Datatype *new_file_type,
+ hbool_t *file_type_derived);
static herr_t H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk_entry,
- const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, const H5D_chunk_map_t *fm);
-static int H5D__cmp_chunk_addr(const void *chunk_addr_info1, const void *chunk_addr_info2);
-static int H5D__cmp_filtered_collective_io_info_entry(const void *filtered_collective_io_info_entry1,
- const void *filtered_collective_io_info_entry2);
+ const H5D_io_info_t * io_info,
+ const H5D_type_info_t * type_info,
+ const H5D_chunk_map_t * fm);
+static int H5D__cmp_chunk_addr(const void *chunk_addr_info1, const void *chunk_addr_info2);
+static int H5D__cmp_filtered_collective_io_info_entry(const void *filtered_collective_io_info_entry1,
+ const void *filtered_collective_io_info_entry2);
#if MPI_VERSION >= 3
static int H5D__cmp_filtered_collective_io_info_entry_owner(const void *filtered_collective_io_info_entry1,
- const void *filtered_collective_io_info_entry2);
+ const void *filtered_collective_io_info_entry2);
#endif
-
/*********************/
/* Package Variables */
/*********************/
-
/*******************/
/* Local Variables */
/*******************/
-
/*-------------------------------------------------------------------------
* Function: H5D__mpio_opt_possible
*
@@ -286,15 +285,15 @@ static int H5D__cmp_filtered_collective_io_info_entry_owner(const void *filtered
*-------------------------------------------------------------------------
*/
htri_t
-H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space,
- const H5S_t *mem_space, const H5D_type_info_t *type_info)
+H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space, const H5S_t *mem_space,
+ const H5D_type_info_t *type_info)
{
- H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */
- unsigned local_cause[2] = {0,0}; /* [0] Local reason(s) for breaking collective mode */
- /* [1] Flag if dataset is both: H5S_ALL and small */
- unsigned global_cause[2] = {0,0}; /* Global reason(s) for breaking collective mode */
- htri_t is_vl_storage; /* Whether the dataset's datatype is stored in a variable-length form */
- htri_t ret_value = SUCCEED; /* Return value */
+ H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */
+ unsigned local_cause[2] = {0, 0}; /* [0] Local reason(s) for breaking collective mode */
+ /* [1] Flag if dataset is both: H5S_ALL and small */
+ unsigned global_cause[2] = {0, 0}; /* Global reason(s) for breaking collective mode */
+ htri_t is_vl_storage; /* Whether the dataset's datatype is stored in a variable-length form */
+ htri_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -304,47 +303,46 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space,
HDassert(file_space);
HDassert(type_info);
-
/* For independent I/O, get out quickly and don't try to form consensus */
- if(H5CX_get_io_xfer_mode(&io_xfer_mode) < 0)
+ if (H5CX_get_io_xfer_mode(&io_xfer_mode) < 0)
/* Set error flag, but keep going */
local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE;
- if(io_xfer_mode == H5FD_MPIO_INDEPENDENT)
+ if (io_xfer_mode == H5FD_MPIO_INDEPENDENT)
local_cause[0] |= H5D_MPIO_SET_INDEPENDENT;
/* Optimized MPI types flag must be set */
/* (based on 'HDF5_MPI_OPT_TYPES' environment variable) */
- if(!H5FD_mpi_opt_types_g)
+ if (!H5FD_mpi_opt_types_g)
local_cause[0] |= H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED;
/* Don't allow collective operations if datatype conversions need to happen */
- if(!type_info->is_conv_noop)
+ if (!type_info->is_conv_noop)
local_cause[0] |= H5D_MPIO_DATATYPE_CONVERSION;
/* Don't allow collective operations if data transform operations should occur */
- if(!type_info->is_xform_noop)
+ if (!type_info->is_xform_noop)
local_cause[0] |= H5D_MPIO_DATA_TRANSFORMS;
/* Check whether these are both simple or scalar dataspaces */
- if(!((H5S_SIMPLE == H5S_GET_EXTENT_TYPE(mem_space) || H5S_SCALAR == H5S_GET_EXTENT_TYPE(mem_space))
- && (H5S_SIMPLE == H5S_GET_EXTENT_TYPE(file_space) || H5S_SCALAR == H5S_GET_EXTENT_TYPE(file_space))))
+ if (!((H5S_SIMPLE == H5S_GET_EXTENT_TYPE(mem_space) || H5S_SCALAR == H5S_GET_EXTENT_TYPE(mem_space)) &&
+ (H5S_SIMPLE == H5S_GET_EXTENT_TYPE(file_space) || H5S_SCALAR == H5S_GET_EXTENT_TYPE(file_space))))
local_cause[0] |= H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES;
/* Dataset storage must be contiguous or chunked */
- if(!(io_info->dset->shared->layout.type == H5D_CONTIGUOUS ||
- io_info->dset->shared->layout.type == H5D_CHUNKED))
+ if (!(io_info->dset->shared->layout.type == H5D_CONTIGUOUS ||
+ io_info->dset->shared->layout.type == H5D_CHUNKED))
local_cause[0] |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET;
/* check if external-file storage is used */
- if(io_info->dset->shared->dcpl_cache.efl.nused > 0)
+ if (io_info->dset->shared->dcpl_cache.efl.nused > 0)
local_cause[0] |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET;
- /* The handling of memory space is different for chunking and contiguous
- * storage. For contiguous storage, mem_space and file_space won't change
- * when it it is doing disk IO. For chunking storage, mem_space will
- * change for different chunks. So for chunking storage, whether we can
- * use collective IO will defer until each chunk IO is reached.
- */
+ /* The handling of memory space is different for chunking and contiguous
+ * storage. For contiguous storage, mem_space and file_space won't change
+ * when it it is doing disk IO. For chunking storage, mem_space will
+ * change for different chunks. So for chunking storage, whether we can
+ * use collective IO will defer until each chunk IO is reached.
+ */
#if MPI_VERSION < 3
/*
@@ -352,9 +350,8 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space,
* is less than 3. The functions needed (MPI_Mprobe and MPI_Imrecv) will
* not be available.
*/
- if(io_info->op_type == H5D_IO_OP_WRITE &&
- io_info->dset->shared->layout.type == H5D_CHUNKED &&
- io_info->dset->shared->dcpl_cache.pline.nused > 0)
+ if (io_info->op_type == H5D_IO_OP_WRITE && io_info->dset->shared->layout.type == H5D_CHUNKED &&
+ io_info->dset->shared->dcpl_cache.pline.nused > 0)
local_cause[0] |= H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED;
#endif
@@ -363,29 +360,29 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space,
*/
/* Check to see if the process is reading the entire dataset */
- if(H5S_GET_SELECT_TYPE(file_space) != H5S_SEL_ALL)
+ if (H5S_GET_SELECT_TYPE(file_space) != H5S_SEL_ALL)
local_cause[1] |= H5D_MPIO_RANK0_NOT_H5S_ALL;
/* Only perform this optimization for contigous datasets, currently */
- else if(H5D_CONTIGUOUS != io_info->dset->shared->layout.type)
+ else if (H5D_CONTIGUOUS != io_info->dset->shared->layout.type)
/* Flag to do a MPI_Bcast of the data from one proc instead of
* having all the processes involved in the collective I/O.
*/
local_cause[1] |= H5D_MPIO_RANK0_NOT_CONTIGUOUS;
- else if((is_vl_storage = H5T_is_vl_storage(type_info->dset_type)) < 0)
+ else if ((is_vl_storage = H5T_is_vl_storage(type_info->dset_type)) < 0)
local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE;
- else if(is_vl_storage)
+ else if (is_vl_storage)
local_cause[1] |= H5D_MPIO_RANK0_NOT_FIXED_SIZE;
else {
- size_t type_size; /* Size of dataset's datatype */
+ size_t type_size; /* Size of dataset's datatype */
/* Retrieve the size of the dataset's datatype */
- if(0 == (type_size = H5T_GET_SIZE(type_info->dset_type)))
+ if (0 == (type_size = H5T_GET_SIZE(type_info->dset_type)))
local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE;
else {
- hssize_t snelmts; /* [Signed] # of elements in dataset's dataspace */
+ hssize_t snelmts; /* [Signed] # of elements in dataset's dataspace */
/* Retrieve the size of the dataset's datatype */
- if((snelmts = H5S_GET_EXTENT_NPOINTS(file_space)) < 0)
+ if ((snelmts = H5S_GET_EXTENT_NPOINTS(file_space)) < 0)
local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE;
else {
hsize_t dset_size;
@@ -393,26 +390,27 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space,
/* Determine dataset size */
dset_size = ((hsize_t)snelmts) * type_size;
- /* If the size of the dataset is less than 2GB then do an MPI_Bcast
- * of the data from one process instead of having all the processes
- * involved in the collective I/O.
- */
- if(dset_size > ((hsize_t)(2.0F * H5_GB) - 1))
+ /* If the size of the dataset is less than 2GB then do an MPI_Bcast
+ * of the data from one process instead of having all the processes
+ * involved in the collective I/O.
+ */
+ if (dset_size > ((hsize_t)(2.0F * H5_GB) - 1))
local_cause[1] |= H5D_MPIO_RANK0_GREATER_THAN_2GB;
} /* end else */
- } /* end else */
- } /* end else */
+ } /* end else */
+ } /* end else */
/* Check for independent I/O */
- if(local_cause[0] & H5D_MPIO_SET_INDEPENDENT)
+ if (local_cause[0] & H5D_MPIO_SET_INDEPENDENT)
global_cause[0] = local_cause[0];
else {
- int mpi_code; /* MPI error code */
+ int mpi_code; /* MPI error code */
/* Form consensus opinion among all processes about whether to perform
* collective I/O
*/
- if(MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_cause, &global_cause, 2, MPI_UNSIGNED, MPI_BOR, io_info->comm)))
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Allreduce(&local_cause, &global_cause, 2, MPI_UNSIGNED, MPI_BOR, io_info->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_code)
} /* end else */
@@ -421,12 +419,12 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space,
H5CX_set_mpio_global_no_coll_cause(global_cause[0]);
/* Set read-with-rank0-and-bcast flag if possible */
- if(global_cause[0] == 0 && global_cause[1] == 0) {
+ if (global_cause[0] == 0 && global_cause[1] == 0) {
H5CX_set_mpio_rank0_bcast(TRUE);
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
H5CX_test_set_mpio_coll_rank0_bcast(TRUE);
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
- } /* end if */
+ } /* end if */
/* Set the return value, based on the global cause */
ret_value = global_cause[0] > 0 ? FALSE : TRUE;
@@ -435,7 +433,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__mpio_opt_possible() */
-
/*-------------------------------------------------------------------------
* Function: H5D__mpio_select_read
*
@@ -449,22 +446,24 @@ done:
*/
herr_t
H5D__mpio_select_read(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info,
- hsize_t mpi_buf_count, const H5S_t H5_ATTR_UNUSED *file_space, const H5S_t H5_ATTR_UNUSED *mem_space)
+ hsize_t mpi_buf_count, const H5S_t H5_ATTR_UNUSED *file_space,
+ const H5S_t H5_ATTR_UNUSED *mem_space)
{
- const H5D_contig_storage_t *store_contig = &(io_info->store->contig); /* Contiguous storage info for this I/O operation */
+ const H5D_contig_storage_t *store_contig =
+ &(io_info->store->contig); /* Contiguous storage info for this I/O operation */
herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
H5_CHECK_OVERFLOW(mpi_buf_count, hsize_t, size_t);
- if(H5F_shared_block_read(io_info->f_sh, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->u.rbuf) < 0)
+ if (H5F_shared_block_read(io_info->f_sh, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count,
+ io_info->u.rbuf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "can't finish collective parallel read")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__mpio_select_read() */
-
/*-------------------------------------------------------------------------
* Function: H5D__mpio_select_write
*
@@ -478,23 +477,25 @@ done:
*/
herr_t
H5D__mpio_select_write(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info,
- hsize_t mpi_buf_count, const H5S_t H5_ATTR_UNUSED *file_space, const H5S_t H5_ATTR_UNUSED *mem_space)
+ hsize_t mpi_buf_count, const H5S_t H5_ATTR_UNUSED *file_space,
+ const H5S_t H5_ATTR_UNUSED *mem_space)
{
- const H5D_contig_storage_t *store_contig = &(io_info->store->contig); /* Contiguous storage info for this I/O operation */
+ const H5D_contig_storage_t *store_contig =
+ &(io_info->store->contig); /* Contiguous storage info for this I/O operation */
herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
/*OKAY: CAST DISCARDS CONST QUALIFIER*/
H5_CHECK_OVERFLOW(mpi_buf_count, hsize_t, size_t);
- if(H5F_shared_block_write(io_info->f_sh, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->u.wbuf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't finish collective parallel write")
+ if (H5F_shared_block_write(io_info->f_sh, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count,
+ io_info->u.wbuf) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't finish collective parallel write")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__mpio_select_write() */
-
/*-------------------------------------------------------------------------
* Function: H5D__mpio_array_gatherv
*
@@ -524,17 +525,18 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__mpio_array_gatherv(void *local_array, size_t local_array_num_entries,
- size_t array_entry_size, void **_gathered_array, size_t *_gathered_array_num_entries,
- hbool_t allgather, int root, MPI_Comm comm, int (*sort_func)(const void *, const void *))
+H5D__mpio_array_gatherv(void *local_array, size_t local_array_num_entries, size_t array_entry_size,
+ void **_gathered_array, size_t *_gathered_array_num_entries, hbool_t allgather,
+ int root, MPI_Comm comm, int (*sort_func)(const void *, const void *))
{
- size_t gathered_array_num_entries = 0; /* The size of the newly-constructed array */
- void *gathered_array = NULL; /* The newly-constructed array returned to the caller */
- int *receive_counts_array = NULL; /* Array containing number of entries each processor is contributing */
- int *displacements_array = NULL; /* Array of displacements where each processor places its data in the final array */
- int mpi_code, mpi_rank, mpi_size;
- int sendcount;
- herr_t ret_value = SUCCEED;
+ size_t gathered_array_num_entries = 0; /* The size of the newly-constructed array */
+ void * gathered_array = NULL; /* The newly-constructed array returned to the caller */
+ int *receive_counts_array = NULL; /* Array containing number of entries each processor is contributing */
+ int *displacements_array =
+ NULL; /* Array of displacements where each processor places its data in the final array */
+ int mpi_code, mpi_rank, mpi_size;
+ int sendcount;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -547,38 +549,43 @@ H5D__mpio_array_gatherv(void *local_array, size_t local_array_num_entries,
/* Determine the size of the end result array by collecting the number
* of entries contributed by each processor into a single total.
*/
- if (MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_array_num_entries, &gathered_array_num_entries, 1, MPI_INT, MPI_SUM, comm)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_array_num_entries, &gathered_array_num_entries, 1,
+ MPI_INT, MPI_SUM, comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_code)
- /* If 0 entries resulted from the collective operation, no processor is contributing anything and there is nothing to do */
+ /* If 0 entries resulted from the collective operation, no processor is contributing anything and there is
+ * nothing to do */
if (gathered_array_num_entries > 0) {
/*
- * If gathering to all processors, all processors need to allocate space for the resulting array, as well as
- * the receive counts and displacements arrays for the collective MPI_Allgatherv call. Otherwise, only the
- * root processor needs to allocate the space for an MPI_Gatherv call.
+ * If gathering to all processors, all processors need to allocate space for the resulting array, as
+ * well as the receive counts and displacements arrays for the collective MPI_Allgatherv call.
+ * Otherwise, only the root processor needs to allocate the space for an MPI_Gatherv call.
*/
if (allgather || (mpi_rank == root)) {
if (NULL == (gathered_array = H5MM_malloc(gathered_array_num_entries * array_entry_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate gathered array")
- if (NULL == (receive_counts_array = (int *) H5MM_malloc((size_t) mpi_size * sizeof(int))))
+ if (NULL == (receive_counts_array = (int *)H5MM_malloc((size_t)mpi_size * sizeof(int))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate receive counts array")
- if (NULL == (displacements_array = (int *) H5MM_malloc((size_t) mpi_size * sizeof(int))))
+ if (NULL == (displacements_array = (int *)H5MM_malloc((size_t)mpi_size * sizeof(int))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate receive displacements array")
} /* end if */
/*
* If gathering to all processors, inform each processor of how many entries each other processor is
* contributing to the resulting array by collecting the counts into each processor's "receive counts"
- * array. Otherwise, inform only the root processor of how many entries each other processor is contributing.
+ * array. Otherwise, inform only the root processor of how many entries each other processor is
+ * contributing.
*/
if (allgather) {
- if (MPI_SUCCESS != (mpi_code = MPI_Allgather(&local_array_num_entries, 1, MPI_INT, receive_counts_array, 1, MPI_INT, comm)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Allgather(&local_array_num_entries, 1, MPI_INT,
+ receive_counts_array, 1, MPI_INT, comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Allgather failed", mpi_code)
} /* end if */
else {
- if (MPI_SUCCESS != (mpi_code = MPI_Gather(&local_array_num_entries, 1, MPI_INT, receive_counts_array, 1, MPI_INT, root, comm)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Gather(&local_array_num_entries, 1, MPI_INT,
+ receive_counts_array, 1, MPI_INT, root, comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Gather failed", mpi_code)
} /* end else */
@@ -586,26 +593,29 @@ H5D__mpio_array_gatherv(void *local_array, size_t local_array_num_entries,
size_t i;
/* Multiply each receive count by the size of the array entry, since the data is sent as bytes. */
- for (i = 0; i < (size_t) mpi_size; i++)
- H5_CHECKED_ASSIGN(receive_counts_array[i], int, (size_t) receive_counts_array[i] * array_entry_size, size_t);
+ for (i = 0; i < (size_t)mpi_size; i++)
+ H5_CHECKED_ASSIGN(receive_counts_array[i], int,
+ (size_t)receive_counts_array[i] * array_entry_size, size_t);
/* Set receive buffer offsets for the collective MPI_Allgatherv/MPI_Gatherv call. */
displacements_array[0] = 0;
- for (i = 1; i < (size_t) mpi_size; i++)
+ for (i = 1; i < (size_t)mpi_size; i++)
displacements_array[i] = displacements_array[i - 1] + receive_counts_array[i - 1];
} /* end if */
/* As the data is sent as bytes, calculate the true sendcount for the data. */
- H5_CHECKED_ASSIGN(sendcount, int, local_array_num_entries * array_entry_size, size_t);
+ H5_CHECKED_ASSIGN(sendcount, int, local_array_num_entries *array_entry_size, size_t);
if (allgather) {
- if (MPI_SUCCESS != (mpi_code = MPI_Allgatherv(local_array, sendcount, MPI_BYTE,
- gathered_array, receive_counts_array, displacements_array, MPI_BYTE, comm)))
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Allgatherv(local_array, sendcount, MPI_BYTE, gathered_array,
+ receive_counts_array, displacements_array, MPI_BYTE, comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Allgatherv failed", mpi_code)
} /* end if */
else {
- if (MPI_SUCCESS != (mpi_code = MPI_Gatherv(local_array, sendcount, MPI_BYTE,
- gathered_array, receive_counts_array, displacements_array, MPI_BYTE, root, comm)))
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Gatherv(local_array, sendcount, MPI_BYTE, gathered_array,
+ receive_counts_array, displacements_array, MPI_BYTE, root, comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Gatherv failed", mpi_code)
} /* end else */
@@ -613,7 +623,7 @@ H5D__mpio_array_gatherv(void *local_array, size_t local_array_num_entries,
HDqsort(gathered_array, gathered_array_num_entries, array_entry_size, sort_func);
} /* end if */
- *_gathered_array = gathered_array;
+ *_gathered_array = gathered_array;
*_gathered_array_num_entries = gathered_array_num_entries;
done:
@@ -625,7 +635,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__mpio_array_gatherv() */
-
/*-------------------------------------------------------------------------
* Function: H5D__mpio_get_sum_chunk
*
@@ -640,30 +649,29 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__mpio_get_sum_chunk(const H5D_io_info_t *io_info, const H5D_chunk_map_t *fm,
- int *sum_chunkf)
+H5D__mpio_get_sum_chunk(const H5D_io_info_t *io_info, const H5D_chunk_map_t *fm, int *sum_chunkf)
{
- int num_chunkf; /* Number of chunks to iterate over */
+ int num_chunkf; /* Number of chunks to iterate over */
size_t ori_num_chunkf;
- int mpi_code; /* MPI return code */
+ int mpi_code; /* MPI return code */
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Get the number of chunks to perform I/O on */
- num_chunkf = 0;
+ num_chunkf = 0;
ori_num_chunkf = H5SL_count(fm->sel_chunks);
H5_CHECKED_ASSIGN(num_chunkf, int, ori_num_chunkf, size_t);
/* Determine the summation of number of chunks for all processes */
- if(MPI_SUCCESS != (mpi_code = MPI_Allreduce(&num_chunkf, sum_chunkf, 1, MPI_INT, MPI_SUM, io_info->comm)))
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Allreduce(&num_chunkf, sum_chunkf, 1, MPI_INT, MPI_SUM, io_info->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_code)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__mpio_get_sum_chunk() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_collective_read
*
@@ -679,11 +687,11 @@ done:
*/
herr_t
H5D__contig_collective_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t H5_ATTR_UNUSED nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t H5_ATTR_UNUSED *fm)
+ hsize_t H5_ATTR_UNUSED nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ H5D_chunk_map_t H5_ATTR_UNUSED *fm)
{
H5D_mpio_actual_io_mode_t actual_io_mode = H5D_MPIO_CONTIGUOUS_COLLECTIVE;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -691,7 +699,7 @@ H5D__contig_collective_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_
HDassert(H5FD_MPIO == H5F_DRIVER_ID(io_info->dset->oloc.file));
/* Call generic internal collective I/O routine */
- if(H5D__inter_collective_io(io_info, type_info, file_space, mem_space) < 0)
+ if (H5D__inter_collective_io(io_info, type_info, file_space, mem_space) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "couldn't finish shared collective MPI-IO")
/* Set the actual I/O mode property. internal_collective_io will not break to
@@ -703,7 +711,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__contig_collective_read() */
-
/*-------------------------------------------------------------------------
* Function: H5D__contig_collective_write
*
@@ -719,11 +726,11 @@ done:
*/
herr_t
H5D__contig_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t H5_ATTR_UNUSED nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t H5_ATTR_UNUSED *fm)
+ hsize_t H5_ATTR_UNUSED nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ H5D_chunk_map_t H5_ATTR_UNUSED *fm)
{
H5D_mpio_actual_io_mode_t actual_io_mode = H5D_MPIO_CONTIGUOUS_COLLECTIVE;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -731,7 +738,7 @@ H5D__contig_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type
HDassert(H5FD_MPIO == H5F_DRIVER_ID(io_info->dset->oloc.file));
/* Call generic internal collective I/O routine */
- if(H5D__inter_collective_io(io_info, type_info, file_space, mem_space) < 0)
+ if (H5D__inter_collective_io(io_info, type_info, file_space, mem_space) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "couldn't finish shared collective MPI-IO")
/* Set the actual I/O mode property. internal_collective_io will not break to
@@ -743,7 +750,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__contig_collective_write() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_collective_io
*
@@ -781,16 +787,15 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- H5D_chunk_map_t *fm)
+H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5D_chunk_map_t *fm)
{
H5FD_mpio_chunk_opt_t chunk_opt_mode;
- int io_option = H5D_MULTI_CHUNK_IO_MORE_OPT;
- int sum_chunk = -1;
+ int io_option = H5D_MULTI_CHUNK_IO_MORE_OPT;
+ int sum_chunk = -1;
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
- htri_t temp_not_link_io = FALSE;
+ htri_t temp_not_link_io = FALSE;
#endif
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -805,58 +810,61 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
H5CX_set_coll_metadata_read(FALSE);
/* Check the optional property list for the collective chunk IO optimization option */
- if(H5CX_get_mpio_chunk_opt_mode(&chunk_opt_mode) < 0)
+ if (H5CX_get_mpio_chunk_opt_mode(&chunk_opt_mode) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get chunk optimization option")
- if(H5FD_MPIO_CHUNK_ONE_IO == chunk_opt_mode)
- io_option = H5D_ONE_LINK_CHUNK_IO; /*no opt*/
+ if (H5FD_MPIO_CHUNK_ONE_IO == chunk_opt_mode)
+ io_option = H5D_ONE_LINK_CHUNK_IO; /*no opt*/
/* direct request to multi-chunk-io */
- else if(H5FD_MPIO_CHUNK_MULTI_IO == chunk_opt_mode)
+ else if (H5FD_MPIO_CHUNK_MULTI_IO == chunk_opt_mode)
io_option = H5D_MULTI_CHUNK_IO;
/* via default path. branch by num threshold */
else {
- unsigned one_link_chunk_io_threshold; /* Threshold to use single collective I/O for all chunks */
- int mpi_size; /* Number of processes in MPI job */
+ unsigned one_link_chunk_io_threshold; /* Threshold to use single collective I/O for all chunks */
+ int mpi_size; /* Number of processes in MPI job */
- if(H5D__mpio_get_sum_chunk(io_info, fm, &sum_chunk) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSWAP, FAIL, "unable to obtain the total chunk number of all processes");
- if((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0)
+ if (H5D__mpio_get_sum_chunk(io_info, fm, &sum_chunk) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSWAP, FAIL,
+ "unable to obtain the total chunk number of all processes");
+ if ((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0)
HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi size")
/* Get the chunk optimization option threshold */
- if(H5CX_get_mpio_chunk_opt_num(&one_link_chunk_io_threshold) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get chunk optimization option threshold value")
+ if (H5CX_get_mpio_chunk_opt_num(&one_link_chunk_io_threshold) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "couldn't get chunk optimization option threshold value")
/* step 1: choose an IO option */
- /* If the average number of chunk per process is greater than a threshold, we will do one link chunked IO. */
- if((unsigned)sum_chunk / (unsigned)mpi_size >= one_link_chunk_io_threshold)
+ /* If the average number of chunk per process is greater than a threshold, we will do one link chunked
+ * IO. */
+ if ((unsigned)sum_chunk / (unsigned)mpi_size >= one_link_chunk_io_threshold)
io_option = H5D_ONE_LINK_CHUNK_IO_MORE_OPT;
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
else
temp_not_link_io = TRUE;
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
- } /* end else */
+ } /* end else */
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
-{
- /*** Set collective chunk user-input optimization APIs. ***/
- if(H5D_ONE_LINK_CHUNK_IO == io_option) {
- if(H5CX_test_set_mpio_coll_chunk_link_hard(0) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value")
- } /* end if */
- else if(H5D_MULTI_CHUNK_IO == io_option) {
- if(H5CX_test_set_mpio_coll_chunk_multi_hard(0) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value")
- } /* end else-if */
- else if(H5D_ONE_LINK_CHUNK_IO_MORE_OPT == io_option) {
- if(H5CX_test_set_mpio_coll_chunk_link_num_true(0) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value")
- } /* end if */
- else if(temp_not_link_io) {
- if(H5CX_test_set_mpio_coll_chunk_link_num_false(0) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value")
- } /* end if */
-}
+ {
+ /*** Set collective chunk user-input optimization APIs. ***/
+ if (H5D_ONE_LINK_CHUNK_IO == io_option) {
+ if (H5CX_test_set_mpio_coll_chunk_link_hard(0) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value")
+ } /* end if */
+ else if (H5D_MULTI_CHUNK_IO == io_option) {
+ if (H5CX_test_set_mpio_coll_chunk_multi_hard(0) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value")
+ } /* end else-if */
+ else if (H5D_ONE_LINK_CHUNK_IO_MORE_OPT == io_option) {
+ if (H5CX_test_set_mpio_coll_chunk_link_num_true(0) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value")
+ } /* end if */
+ else if (temp_not_link_io) {
+ if (H5CX_test_set_mpio_coll_chunk_link_num_false(0) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value")
+ } /* end if */
+ }
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
/* step 2: Go ahead to do IO.*/
@@ -864,37 +872,38 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
case H5D_ONE_LINK_CHUNK_IO:
case H5D_ONE_LINK_CHUNK_IO_MORE_OPT:
/* Check if there are any filters in the pipeline */
- if(io_info->dset->shared->dcpl_cache.pline.nused > 0) {
+ if (io_info->dset->shared->dcpl_cache.pline.nused > 0) {
/* For now, Multi-chunk IO must be forced for parallel filtered read,
* so that data can be unfiltered as it is received. There is significant
* complexity in unfiltering the data when it is read all at once into a
* single buffer.
*/
- if(io_info->op_type == H5D_IO_OP_READ) {
- if(H5D__multi_chunk_filtered_collective_io(io_info, type_info, fm) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish optimized multiple filtered chunk MPI-IO")
+ if (io_info->op_type == H5D_IO_OP_READ) {
+ if (H5D__multi_chunk_filtered_collective_io(io_info, type_info, fm) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL,
+ "couldn't finish optimized multiple filtered chunk MPI-IO")
} /* end if */
- else
- if(H5D__link_chunk_filtered_collective_io(io_info, type_info, fm) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish filtered linked chunk MPI-IO")
+ else if (H5D__link_chunk_filtered_collective_io(io_info, type_info, fm) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish filtered linked chunk MPI-IO")
} /* end if */
else
/* Perform unfiltered link chunk collective IO */
- if(H5D__link_chunk_collective_io(io_info, type_info, fm, sum_chunk) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish linked chunk MPI-IO")
+ if (H5D__link_chunk_collective_io(io_info, type_info, fm, sum_chunk) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish linked chunk MPI-IO")
break;
case H5D_MULTI_CHUNK_IO: /* direct request to do multi-chunk IO */
default: /* multiple chunk IO via threshold */
/* Check if there are any filters in the pipeline */
- if(io_info->dset->shared->dcpl_cache.pline.nused > 0) {
- if(H5D__multi_chunk_filtered_collective_io(io_info, type_info, fm) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish optimized multiple filtered chunk MPI-IO")
+ if (io_info->dset->shared->dcpl_cache.pline.nused > 0) {
+ if (H5D__multi_chunk_filtered_collective_io(io_info, type_info, fm) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL,
+ "couldn't finish optimized multiple filtered chunk MPI-IO")
} /* end if */
else
/* Perform unfiltered multi chunk collective IO */
- if(H5D__multi_chunk_collective_io(io_info, type_info, fm) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish optimized multiple chunk MPI-IO")
+ if (H5D__multi_chunk_collective_io(io_info, type_info, fm) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish optimized multiple chunk MPI-IO")
break;
} /* end switch */
@@ -902,7 +911,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_collective_io */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_collective_read
*
@@ -918,22 +926,21 @@ done:
*/
herr_t
H5D__chunk_collective_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space, const H5S_t H5_ATTR_UNUSED *mem_space,
- H5D_chunk_map_t *fm)
+ hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space,
+ const H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t *fm)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Call generic selection operation */
- if(H5D__chunk_collective_io(io_info, type_info, fm) < 0)
+ if (H5D__chunk_collective_io(io_info, type_info, fm) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, FAIL, "read error")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_collective_read() */
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_collective_write
*
@@ -949,22 +956,21 @@ done:
*/
herr_t
H5D__chunk_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space, const H5S_t H5_ATTR_UNUSED *mem_space,
- H5D_chunk_map_t *fm)
+ hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space,
+ const H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t *fm)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Call generic selection operation */
- if(H5D__chunk_collective_io(io_info, type_info, fm) < 0)
+ if (H5D__chunk_collective_io(io_info, type_info, fm) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_collective_write() */
-
/*-------------------------------------------------------------------------
* Function: H5D__link_chunk_collective_io
*
@@ -983,26 +989,28 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- H5D_chunk_map_t *fm, int sum_chunk)
+H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5D_chunk_map_t *fm,
+ int sum_chunk)
{
H5D_chunk_addr_info_t *chunk_addr_info_array = NULL;
- MPI_Datatype chunk_final_mtype; /* Final memory MPI datatype for all chunks with seletion */
- hbool_t chunk_final_mtype_is_derived = FALSE;
- MPI_Datatype chunk_final_ftype; /* Final file MPI datatype for all chunks with seletion */
- hbool_t chunk_final_ftype_is_derived = FALSE;
- H5D_storage_t ctg_store; /* Storage info for "fake" contiguous dataset */
- size_t total_chunks;
- MPI_Datatype *chunk_mtype = NULL;
- MPI_Datatype *chunk_ftype = NULL;
- MPI_Aint *chunk_disp_array = NULL;
- MPI_Aint *chunk_mem_disp_array = NULL;
- hbool_t *chunk_mft_is_derived_array = NULL; /* Flags to indicate each chunk's MPI file datatype is derived */
- hbool_t *chunk_mbt_is_derived_array = NULL; /* Flags to indicate each chunk's MPI memory datatype is derived */
- int *chunk_mpi_file_counts = NULL; /* Count of MPI file datatype for each chunk */
- int *chunk_mpi_mem_counts = NULL; /* Count of MPI memory datatype for each chunk */
- int mpi_code; /* MPI return code */
- herr_t ret_value = SUCCEED;
+ MPI_Datatype chunk_final_mtype; /* Final memory MPI datatype for all chunks with seletion */
+ hbool_t chunk_final_mtype_is_derived = FALSE;
+ MPI_Datatype chunk_final_ftype; /* Final file MPI datatype for all chunks with seletion */
+ hbool_t chunk_final_ftype_is_derived = FALSE;
+ H5D_storage_t ctg_store; /* Storage info for "fake" contiguous dataset */
+ size_t total_chunks;
+ MPI_Datatype * chunk_mtype = NULL;
+ MPI_Datatype * chunk_ftype = NULL;
+ MPI_Aint * chunk_disp_array = NULL;
+ MPI_Aint * chunk_mem_disp_array = NULL;
+ hbool_t * chunk_mft_is_derived_array =
+ NULL; /* Flags to indicate each chunk's MPI file datatype is derived */
+ hbool_t *chunk_mbt_is_derived_array =
+ NULL; /* Flags to indicate each chunk's MPI memory datatype is derived */
+ int * chunk_mpi_file_counts = NULL; /* Count of MPI file datatype for each chunk */
+ int * chunk_mpi_mem_counts = NULL; /* Count of MPI memory datatype for each chunk */
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1014,9 +1022,10 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ
H5CX_set_mpio_actual_io_mode(H5D_MPIO_CHUNK_COLLECTIVE);
/* Get the sum # of chunks, if not already available */
- if(sum_chunk < 0) {
- if(H5D__mpio_get_sum_chunk(io_info, fm, &sum_chunk) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSWAP, FAIL, "unable to obtain the total chunk number of all processes");
+ if (sum_chunk < 0) {
+ if (H5D__mpio_get_sum_chunk(io_info, fm, &sum_chunk) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSWAP, FAIL,
+ "unable to obtain the total chunk number of all processes");
} /* end if */
/* Retrieve total # of chunks in dataset */
@@ -1026,15 +1035,15 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ
* the dataset. [This sometimes is used by developers who want the
* equivalent of compressed contiguous datasets - QAK]
*/
- if(total_chunks == 1) {
- H5SL_node_t *chunk_node; /* Pointer to chunk node for selection */
- H5S_t *fspace; /* Dataspace describing chunk & selection in it */
- H5S_t *mspace; /* Dataspace describing selection in memory corresponding to this chunk */
+ if (total_chunks == 1) {
+ H5SL_node_t *chunk_node; /* Pointer to chunk node for selection */
+ H5S_t * fspace; /* Dataspace describing chunk & selection in it */
+ H5S_t * mspace; /* Dataspace describing selection in memory corresponding to this chunk */
/* Check for this process having selection in this chunk */
chunk_node = H5SL_first(fm->sel_chunks);
- if(chunk_node == NULL) {
+ if (chunk_node == NULL) {
/* Set the dataspace info for I/O to NULL, this process doesn't have any I/O to perform */
fspace = mspace = NULL;
@@ -1042,11 +1051,11 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ
ctg_store.contig.dset_addr = 0;
} /* end if */
else {
- H5D_chunk_ud_t udata; /* User data for querying chunk info */
- H5D_chunk_info_t *chunk_info; /* Info for chunk in skiplist */
+ H5D_chunk_ud_t udata; /* User data for querying chunk info */
+ H5D_chunk_info_t *chunk_info; /* Info for chunk in skiplist */
/* Get the chunk info, for the selection in the chunk */
- if(NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_item(chunk_node)))
+ if (NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_item(chunk_node)))
HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk info from skip list")
/* Set the dataspace info for I/O */
@@ -1054,7 +1063,7 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ
mspace = chunk_info->mspace;
/* Look up address of chunk */
- if(H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0)
+ if (H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0)
HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk address")
ctg_store.contig.dset_addr = udata.chunk_block.offset;
} /* end else */
@@ -1063,66 +1072,72 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ
io_info->store = &ctg_store;
#ifdef H5D_DEBUG
-if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D),"before inter_collective_io for total chunk = 1 \n");
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "before inter_collective_io for total chunk = 1 \n");
#endif
/* Perform I/O */
- if(H5D__inter_collective_io(io_info, type_info, fspace, mspace) < 0)
+ if (H5D__inter_collective_io(io_info, type_info, fspace, mspace) < 0)
HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't finish shared collective MPI-IO")
} /* end if */
else {
- hsize_t mpi_buf_count; /* Number of MPI types */
- size_t num_chunk; /* Number of chunks for this process */
- size_t u; /* Local index variable */
+ hsize_t mpi_buf_count; /* Number of MPI types */
+ size_t num_chunk; /* Number of chunks for this process */
+ size_t u; /* Local index variable */
/* Get the number of chunks with a selection */
num_chunk = H5SL_count(fm->sel_chunks);
H5_CHECK_OVERFLOW(num_chunk, size_t, int);
#ifdef H5D_DEBUG
-if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D),"total_chunks = %zu, num_chunk = %zu\n", total_chunks, num_chunk);
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "total_chunks = %zu, num_chunk = %zu\n", total_chunks, num_chunk);
#endif
/* Set up MPI datatype for chunks selected */
- if(num_chunk) {
+ if (num_chunk) {
/* Allocate chunking information */
- if(NULL == (chunk_addr_info_array = (H5D_chunk_addr_info_t *)H5MM_malloc(num_chunk * sizeof(H5D_chunk_addr_info_t))))
+ if (NULL == (chunk_addr_info_array =
+ (H5D_chunk_addr_info_t *)H5MM_malloc(num_chunk * sizeof(H5D_chunk_addr_info_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk array buffer")
- if(NULL == (chunk_mtype = (MPI_Datatype *)H5MM_malloc(num_chunk * sizeof(MPI_Datatype))))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk memory datatype buffer")
- if(NULL == (chunk_ftype = (MPI_Datatype *)H5MM_malloc(num_chunk * sizeof(MPI_Datatype))))
+ if (NULL == (chunk_mtype = (MPI_Datatype *)H5MM_malloc(num_chunk * sizeof(MPI_Datatype))))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL,
+ "couldn't allocate chunk memory datatype buffer")
+ if (NULL == (chunk_ftype = (MPI_Datatype *)H5MM_malloc(num_chunk * sizeof(MPI_Datatype))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file datatype buffer")
- if(NULL == (chunk_disp_array = (MPI_Aint *)H5MM_malloc(num_chunk * sizeof(MPI_Aint))))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file displacement buffer")
- if(NULL == (chunk_mem_disp_array = (MPI_Aint *)H5MM_calloc(num_chunk * sizeof(MPI_Aint))))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk memory displacement buffer")
- if(NULL == (chunk_mpi_mem_counts = (int *)H5MM_calloc(num_chunk * sizeof(int))))
+ if (NULL == (chunk_disp_array = (MPI_Aint *)H5MM_malloc(num_chunk * sizeof(MPI_Aint))))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL,
+ "couldn't allocate chunk file displacement buffer")
+ if (NULL == (chunk_mem_disp_array = (MPI_Aint *)H5MM_calloc(num_chunk * sizeof(MPI_Aint))))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL,
+ "couldn't allocate chunk memory displacement buffer")
+ if (NULL == (chunk_mpi_mem_counts = (int *)H5MM_calloc(num_chunk * sizeof(int))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk memory counts buffer")
- if(NULL == (chunk_mpi_file_counts = (int *)H5MM_calloc(num_chunk * sizeof(int))))
+ if (NULL == (chunk_mpi_file_counts = (int *)H5MM_calloc(num_chunk * sizeof(int))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file counts buffer")
- if(NULL == (chunk_mbt_is_derived_array = (hbool_t *)H5MM_calloc(num_chunk * sizeof(hbool_t))))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk memory is derived datatype flags buffer")
- if(NULL == (chunk_mft_is_derived_array = (hbool_t *)H5MM_calloc(num_chunk * sizeof(hbool_t))))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file is derived datatype flags buffer")
+ if (NULL == (chunk_mbt_is_derived_array = (hbool_t *)H5MM_calloc(num_chunk * sizeof(hbool_t))))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL,
+ "couldn't allocate chunk memory is derived datatype flags buffer")
+ if (NULL == (chunk_mft_is_derived_array = (hbool_t *)H5MM_calloc(num_chunk * sizeof(hbool_t))))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL,
+ "couldn't allocate chunk file is derived datatype flags buffer")
#ifdef H5D_DEBUG
-if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D),"before sorting the chunk address \n");
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "before sorting the chunk address \n");
#endif
/* Sort the chunk address */
- if(H5D__sort_chunk(io_info, fm, chunk_addr_info_array, sum_chunk) < 0)
+ if (H5D__sort_chunk(io_info, fm, chunk_addr_info_array, sum_chunk) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSWAP, FAIL, "unable to sort chunk address")
ctg_store.contig.dset_addr = chunk_addr_info_array[0].chunk_addr;
#ifdef H5D_DEBUG
-if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D),"after sorting the chunk address \n");
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "after sorting the chunk address \n");
#endif
/* Obtain MPI derived datatype from all individual chunks */
- for(u = 0; u < num_chunk; u++) {
+ for (u = 0; u < num_chunk; u++) {
hsize_t *permute_map = NULL; /* array that holds the mapping from the old,
out-of-order displacements to the in-order
displacements of the MPI datatypes of the
@@ -1134,46 +1149,43 @@ if(H5DEBUG(D))
* and will be fed into the next call to H5S_mpio_space_type
* where it will be freed.
*/
- if(H5S_mpio_space_type(chunk_addr_info_array[u].chunk_info.fspace,
- type_info->src_type_size,
- &chunk_ftype[u], /* OUT: datatype created */
- &chunk_mpi_file_counts[u], /* OUT */
- &(chunk_mft_is_derived_array[u]), /* OUT */
- TRUE, /* this is a file space,
- so permute the
- datatype if the point
- selections are out of
- order */
- &permute_map,/* OUT: a map to indicate the
- permutation of points
- selected in case they
- are out of order */
- &is_permuted /* OUT */) < 0)
+ if (H5S_mpio_space_type(chunk_addr_info_array[u].chunk_info.fspace, type_info->src_type_size,
+ &chunk_ftype[u], /* OUT: datatype created */
+ &chunk_mpi_file_counts[u], /* OUT */
+ &(chunk_mft_is_derived_array[u]), /* OUT */
+ TRUE, /* this is a file space,
+ so permute the
+ datatype if the point
+ selections are out of
+ order */
+ &permute_map, /* OUT: a map to indicate the
+ permutation of points
+ selected in case they
+ are out of order */
+ &is_permuted /* OUT */) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create MPI file type")
/* Sanity check */
- if(is_permuted)
+ if (is_permuted)
HDassert(permute_map);
- if(H5S_mpio_space_type(chunk_addr_info_array[u].chunk_info.mspace,
- type_info->dst_type_size, &chunk_mtype[u],
- &chunk_mpi_mem_counts[u],
- &(chunk_mbt_is_derived_array[u]),
- FALSE, /* this is a memory
- space, so if the file
- space is not
- permuted, there is no
- need to permute the
- datatype if the point
- selections are out of
- order*/
- &permute_map, /* IN: the permutation map
- generated by the
- file_space selection
- and applied to the
- memory selection */
- &is_permuted /* IN */) < 0)
+ if (H5S_mpio_space_type(chunk_addr_info_array[u].chunk_info.mspace, type_info->dst_type_size,
+ &chunk_mtype[u], &chunk_mpi_mem_counts[u],
+ &(chunk_mbt_is_derived_array[u]), FALSE, /* this is a memory
+ space, so if the file
+ space is not
+ permuted, there is no
+ need to permute the
+ datatype if the point
+ selections are out of
+ order*/
+ &permute_map, /* IN: the permutation map
+ generated by the
+ file_space selection
+ and applied to the
+ memory selection */
+ &is_permuted /* IN */) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create MPI buf type")
/* Sanity check */
- if(is_permuted)
+ if (is_permuted)
HDassert(!permute_map);
/* Chunk address relative to the first chunk */
@@ -1185,34 +1197,38 @@ if(H5DEBUG(D))
} /* end for */
/* Create final MPI derived datatype for the file */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)num_chunk, chunk_mpi_file_counts, chunk_disp_array, chunk_ftype, &chunk_final_ftype)))
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Type_create_struct((int)num_chunk, chunk_mpi_file_counts, chunk_disp_array,
+ chunk_ftype, &chunk_final_ftype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&chunk_final_ftype)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&chunk_final_ftype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
chunk_final_ftype_is_derived = TRUE;
/* Create final MPI derived datatype for memory */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)num_chunk, chunk_mpi_mem_counts, chunk_mem_disp_array, chunk_mtype, &chunk_final_mtype)))
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Type_create_struct((int)num_chunk, chunk_mpi_mem_counts, chunk_mem_disp_array,
+ chunk_mtype, &chunk_final_mtype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&chunk_final_mtype)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&chunk_final_mtype)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
chunk_final_mtype_is_derived = TRUE;
/* Free the file & memory MPI datatypes for each chunk */
- for(u = 0; u < num_chunk; u++) {
- if(chunk_mbt_is_derived_array[u])
- if(MPI_SUCCESS != (mpi_code = MPI_Type_free(chunk_mtype + u)))
+ for (u = 0; u < num_chunk; u++) {
+ if (chunk_mbt_is_derived_array[u])
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_free(chunk_mtype + u)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
- if(chunk_mft_is_derived_array[u])
- if(MPI_SUCCESS != (mpi_code = MPI_Type_free(chunk_ftype + u)))
+ if (chunk_mft_is_derived_array[u])
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_free(chunk_ftype + u)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
} /* end for */
/* We have a single, complicated MPI datatype for both memory & file */
- mpi_buf_count = (hsize_t)1;
- } /* end if */
- else { /* no selection at all for this process */
+ mpi_buf_count = (hsize_t)1;
+ } /* end if */
+ else { /* no selection at all for this process */
ctg_store.contig.dset_addr = 0;
/* Set the MPI datatype */
@@ -1220,56 +1236,57 @@ if(H5DEBUG(D))
chunk_final_mtype = MPI_BYTE;
/* No chunks selected for this process */
- mpi_buf_count = (hsize_t)0;
+ mpi_buf_count = (hsize_t)0;
} /* end else */
#ifdef H5D_DEBUG
-if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D),"before coming to final collective IO\n");
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "before coming to final collective IO\n");
#endif
/* Set up the base storage address for this chunk */
io_info->store = &ctg_store;
/* Perform final collective I/O operation */
- if(H5D__final_collective_io(io_info, type_info, mpi_buf_count, chunk_final_ftype, chunk_final_mtype) < 0)
+ if (H5D__final_collective_io(io_info, type_info, mpi_buf_count, chunk_final_ftype,
+ chunk_final_mtype) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish MPI-IO")
} /* end else */
done:
#ifdef H5D_DEBUG
-if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D),"before freeing memory inside H5D_link_collective_io ret_value = %d\n", ret_value);
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "before freeing memory inside H5D_link_collective_io ret_value = %d\n",
+ ret_value);
#endif
/* Release resources */
- if(chunk_addr_info_array)
+ if (chunk_addr_info_array)
H5MM_xfree(chunk_addr_info_array);
- if(chunk_mtype)
+ if (chunk_mtype)
H5MM_xfree(chunk_mtype);
- if(chunk_ftype)
+ if (chunk_ftype)
H5MM_xfree(chunk_ftype);
- if(chunk_disp_array)
+ if (chunk_disp_array)
H5MM_xfree(chunk_disp_array);
- if(chunk_mem_disp_array)
+ if (chunk_mem_disp_array)
H5MM_xfree(chunk_mem_disp_array);
- if(chunk_mpi_mem_counts)
+ if (chunk_mpi_mem_counts)
H5MM_xfree(chunk_mpi_mem_counts);
- if(chunk_mpi_file_counts)
+ if (chunk_mpi_file_counts)
H5MM_xfree(chunk_mpi_file_counts);
- if(chunk_mbt_is_derived_array)
+ if (chunk_mbt_is_derived_array)
H5MM_xfree(chunk_mbt_is_derived_array);
- if(chunk_mft_is_derived_array)
+ if (chunk_mft_is_derived_array)
H5MM_xfree(chunk_mft_is_derived_array);
/* Free the MPI buf and file types, if they were derived */
- if(chunk_final_mtype_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&chunk_final_mtype)))
+ if (chunk_final_mtype_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&chunk_final_mtype)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
- if(chunk_final_ftype_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&chunk_final_ftype)))
+ if (chunk_final_ftype_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&chunk_final_ftype)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__link_chunk_collective_io */
-
/*-------------------------------------------------------------------------
* Function: H5D__link_chunk_filtered_collective_io
*
@@ -1319,21 +1336,22 @@ if(H5DEBUG(D))
*/
static herr_t
H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- H5D_chunk_map_t *fm)
+ H5D_chunk_map_t *fm)
{
H5D_filtered_collective_io_info_t *chunk_list = NULL; /* The list of chunks being read/written */
- H5D_filtered_collective_io_info_t *collective_chunk_list = NULL; /* The list of chunks used during collective operations */
- H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */
- MPI_Datatype mem_type = MPI_BYTE;
- MPI_Datatype file_type = MPI_BYTE;
- hbool_t mem_type_is_derived = FALSE;
- hbool_t file_type_is_derived = FALSE;
- size_t chunk_list_num_entries;
- size_t collective_chunk_list_num_entries;
- size_t *num_chunks_selected_array = NULL; /* Array of number of chunks selected on each process */
- size_t i; /* Local index variable */
- int mpi_rank, mpi_size, mpi_code;
- herr_t ret_value = SUCCEED;
+ H5D_filtered_collective_io_info_t *collective_chunk_list =
+ NULL; /* The list of chunks used during collective operations */
+ H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */
+ MPI_Datatype mem_type = MPI_BYTE;
+ MPI_Datatype file_type = MPI_BYTE;
+ hbool_t mem_type_is_derived = FALSE;
+ hbool_t file_type_is_derived = FALSE;
+ size_t chunk_list_num_entries;
+ size_t collective_chunk_list_num_entries;
+ size_t * num_chunks_selected_array = NULL; /* Array of number of chunks selected on each process */
+ size_t i; /* Local index variable */
+ int mpi_rank, mpi_size, mpi_code;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1342,9 +1360,9 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in
HDassert(fm);
/* Obtain the current rank of the process and the number of processes */
- if((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0)
+ if ((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0)
HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi rank")
- if((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0)
+ if ((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0)
HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi size")
/* Set the actual-chunk-opt-mode property. */
@@ -1356,39 +1374,42 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in
H5CX_set_mpio_actual_io_mode(H5D_MPIO_CHUNK_COLLECTIVE);
/* Build a list of selected chunks in the collective io operation */
- if(H5D__construct_filtered_io_info_list(io_info, type_info, fm, &chunk_list, &chunk_list_num_entries) < 0)
+ if (H5D__construct_filtered_io_info_list(io_info, type_info, fm, &chunk_list, &chunk_list_num_entries) <
+ 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't construct filtered I/O info list")
- if(io_info->op_type == H5D_IO_OP_WRITE) { /* Filtered collective write */
+ if (io_info->op_type == H5D_IO_OP_WRITE) { /* Filtered collective write */
H5D_chk_idx_info_t index_info;
H5D_chunk_ud_t udata;
hsize_t mpi_buf_count;
/* Construct chunked index info */
- index_info.f = io_info->dset->oloc.file;
- index_info.pline = &(io_info->dset->shared->dcpl_cache.pline);
- index_info.layout = &(io_info->dset->shared->layout.u.chunk);
+ index_info.f = io_info->dset->oloc.file;
+ index_info.pline = &(io_info->dset->shared->dcpl_cache.pline);
+ index_info.layout = &(io_info->dset->shared->layout.u.chunk);
index_info.storage = &(io_info->dset->shared->layout.storage.u.chunk);
/* Set up chunk information for insertion to chunk index */
- udata.common.layout = index_info.layout;
+ udata.common.layout = index_info.layout;
udata.common.storage = index_info.storage;
- udata.filter_mask = 0;
+ udata.filter_mask = 0;
/* Iterate through all the chunks in the collective write operation,
* updating each chunk with the data modifications from other processes,
* then re-filtering the chunk.
*/
- for(i = 0; i < chunk_list_num_entries; i++)
- if(mpi_rank == chunk_list[i].owners.new_owner)
- if(H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0)
+ for (i = 0; i < chunk_list_num_entries; i++)
+ if (mpi_rank == chunk_list[i].owners.new_owner)
+ if (H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't process chunk entry")
/* Gather the new chunk sizes to all processes for a collective reallocation
* of the chunks in the file.
*/
- if(H5D__mpio_array_gatherv(chunk_list, chunk_list_num_entries, sizeof(H5D_filtered_collective_io_info_t),
- (void **) &collective_chunk_list, &collective_chunk_list_num_entries, true, 0, io_info->comm, NULL) < 0)
+ if (H5D__mpio_array_gatherv(chunk_list, chunk_list_num_entries,
+ sizeof(H5D_filtered_collective_io_info_t),
+ (void **)&collective_chunk_list, &collective_chunk_list_num_entries, true,
+ 0, io_info->comm, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, "couldn't gather new chunk sizes")
/* Collectively re-allocate the modified chunks (from each process) in the file */
@@ -1396,15 +1417,17 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in
hbool_t insert;
if (H5D__chunk_file_alloc(&index_info, &collective_chunk_list[i].chunk_states.chunk_current,
- &collective_chunk_list[i].chunk_states.new_chunk, &insert, collective_chunk_list[i].scaled) < 0)
+ &collective_chunk_list[i].chunk_states.new_chunk, &insert,
+ collective_chunk_list[i].scaled) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk")
} /* end for */
- if (NULL == (num_chunks_selected_array = (size_t *) H5MM_malloc((size_t) mpi_size * sizeof(size_t))))
+ if (NULL == (num_chunks_selected_array = (size_t *)H5MM_malloc((size_t)mpi_size * sizeof(size_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate num chunks selected array")
- if (MPI_SUCCESS != (mpi_code = MPI_Allgather(&chunk_list_num_entries, 1, MPI_UNSIGNED_LONG_LONG, num_chunks_selected_array,
- 1, MPI_UNSIGNED_LONG_LONG, io_info->comm)))
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Allgather(&chunk_list_num_entries, 1, MPI_UNSIGNED_LONG_LONG,
+ num_chunks_selected_array, 1, MPI_UNSIGNED_LONG_LONG, io_info->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Allgather failed", mpi_code)
/* If this process has any chunks selected, create a MPI type for collectively
@@ -1424,14 +1447,16 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in
* of the local array. This works correctly because the array gather function guarantees
* that the chunk data in the collective array is ordered in blocks by rank.
*/
- for (i = 0, offset = 0; i < (size_t) mpi_rank; i++)
+ for (i = 0, offset = 0; i < (size_t)mpi_rank; i++)
offset += num_chunks_selected_array[i];
- H5MM_memcpy(chunk_list, &collective_chunk_list[offset], num_chunks_selected_array[mpi_rank] * sizeof(H5D_filtered_collective_io_info_t));
+ H5MM_memcpy(chunk_list, &collective_chunk_list[offset],
+ num_chunks_selected_array[mpi_rank] * sizeof(H5D_filtered_collective_io_info_t));
/* Create single MPI type encompassing each selection in the dataspace */
- if (H5D__mpio_filtered_collective_write_type(chunk_list, chunk_list_num_entries,
- &mem_type, &mem_type_is_derived, &file_type, &file_type_is_derived) < 0)
+ if (H5D__mpio_filtered_collective_write_type(chunk_list, chunk_list_num_entries, &mem_type,
+ &mem_type_is_derived, &file_type,
+ &file_type_is_derived) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "couldn't create MPI link chunk I/O type")
/* Override the write buffer to point to the address of the first
@@ -1441,11 +1466,11 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in
} /* end if */
/* We have a single, complicated MPI datatype for both memory & file */
- mpi_buf_count = (mem_type_is_derived && file_type_is_derived) ? (hsize_t) 1 : (hsize_t) 0;
+ mpi_buf_count = (mem_type_is_derived && file_type_is_derived) ? (hsize_t)1 : (hsize_t)0;
/* Set up the base storage address for this operation */
ctg_store.contig.dset_addr = 0; /* Write address must be set to address 0 */
- io_info->store = &ctg_store;
+ io_info->store = &ctg_store;
/* Perform I/O */
if (H5D__final_collective_io(io_info, type_info, mpi_buf_count, file_type, mem_type) < 0)
@@ -1455,14 +1480,14 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in
* in this iteration into the chunk index
*/
for (i = 0; i < collective_chunk_list_num_entries; i++) {
- udata.chunk_block = collective_chunk_list[i].chunk_states.new_chunk;
+ udata.chunk_block = collective_chunk_list[i].chunk_states.new_chunk;
udata.common.scaled = collective_chunk_list[i].scaled;
- udata.chunk_idx = collective_chunk_list[i].index;
+ udata.chunk_idx = collective_chunk_list[i].index;
if ((index_info.storage->ops->insert)(&index_info, &udata, io_info->dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk address into index")
} /* end for */
- } /* end if */
+ } /* end if */
done:
/* Free resources used by a process which had some selection */
@@ -1480,15 +1505,14 @@ done:
H5MM_free(collective_chunk_list);
/* Free the MPI buf and file types, if they were derived */
- if(mem_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type)))
+ if (mem_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
- if(file_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type)))
+ if (file_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__link_chunk_filtered_collective_io() */
-
/*-------------------------------------------------------------------------
* Function: H5D__multi_chunk_collective_io
*
@@ -1507,25 +1531,27 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- H5D_chunk_map_t *fm)
+H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5D_chunk_map_t *fm)
{
- H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */
- H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */
- H5D_io_info_t cpt_io_info; /* Compact I/O info object */
- H5D_storage_t cpt_store; /* Chunk storage information as compact dataset */
- hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */
- uint8_t *chunk_io_option = NULL;
- haddr_t *chunk_addr = NULL;
- H5D_storage_t store; /* union of EFL and chunk pointer in file space */
- H5FD_mpio_collective_opt_t last_coll_opt_mode = H5FD_MPIO_COLLECTIVE_IO; /* Last parallel transfer with independent IO or collective IO with this mode */
- size_t total_chunk; /* Total # of chunks in dataset */
+ H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */
+ H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */
+ H5D_io_info_t cpt_io_info; /* Compact I/O info object */
+ H5D_storage_t cpt_store; /* Chunk storage information as compact dataset */
+ hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */
+ uint8_t * chunk_io_option = NULL;
+ haddr_t * chunk_addr = NULL;
+ H5D_storage_t store; /* union of EFL and chunk pointer in file space */
+ H5FD_mpio_collective_opt_t last_coll_opt_mode =
+ H5FD_MPIO_COLLECTIVE_IO; /* Last parallel transfer with independent IO or collective IO with this mode
+ */
+ size_t total_chunk; /* Total # of chunks in dataset */
#ifdef H5Dmpio_DEBUG
int mpi_rank;
#endif
- size_t u; /* Local index variable */
- H5D_mpio_actual_io_mode_t actual_io_mode = H5D_MPIO_NO_COLLECTIVE; /* Local variable for tracking the I/O mode used. */
- herr_t ret_value = SUCCEED;
+ size_t u; /* Local index variable */
+ H5D_mpio_actual_io_mode_t actual_io_mode =
+ H5D_MPIO_NO_COLLECTIVE; /* Local variable for tracking the I/O mode used. */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1544,17 +1570,17 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty
chunk_io_option = (uint8_t *)H5MM_calloc(total_chunk);
chunk_addr = (haddr_t *)H5MM_calloc(total_chunk * sizeof(haddr_t));
#ifdef H5D_DEBUG
-if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D), "total_chunk %zu\n", total_chunk);
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "total_chunk %zu\n", total_chunk);
#endif
/* Obtain IO option for each chunk */
- if(H5D__obtain_mpio_mode(io_info, fm, chunk_io_option, chunk_addr) < 0)
+ if (H5D__obtain_mpio_mode(io_info, fm, chunk_io_option, chunk_addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTRECV, FAIL, "unable to obtain MPIO mode")
/* Set up contiguous I/O info object */
H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
- ctg_io_info.store = &ctg_store;
+ ctg_io_info.store = &ctg_store;
ctg_io_info.layout_ops = *H5D_LOPS_CONTIG;
/* Initialize temporary contiguous storage info */
@@ -1562,7 +1588,7 @@ if(H5DEBUG(D))
/* Set up compact I/O info object */
H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info));
- cpt_io_info.store = &cpt_store;
+ cpt_io_info.store = &cpt_store;
cpt_io_info.layout_ops = *H5D_LOPS_COMPACT;
/* Initialize temporary compact storage info */
@@ -1572,38 +1598,39 @@ if(H5DEBUG(D))
io_info->store = &store;
/* Loop over _all_ the chunks */
- for(u = 0; u < total_chunk; u++) {
- H5D_chunk_info_t *chunk_info; /* Chunk info for current chunk */
- H5S_t *fspace; /* Dataspace describing chunk & selection in it */
- H5S_t *mspace; /* Dataspace describing selection in memory corresponding to this chunk */
+ for (u = 0; u < total_chunk; u++) {
+ H5D_chunk_info_t *chunk_info; /* Chunk info for current chunk */
+ H5S_t * fspace; /* Dataspace describing chunk & selection in it */
+ H5S_t * mspace; /* Dataspace describing selection in memory corresponding to this chunk */
#ifdef H5D_DEBUG
-if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D),"mpi_rank = %d, chunk index = %zu\n", mpi_rank, u);
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "mpi_rank = %d, chunk index = %zu\n", mpi_rank, u);
#endif
/* Get the chunk info for this chunk, if there are elements selected */
chunk_info = fm->select_chunk[u];
/* Set the storage information for chunks with selections */
- if(chunk_info) {
+ if (chunk_info) {
HDassert(chunk_info->index == u);
/* Pass in chunk's coordinates in a union. */
- store.chunk.scaled = chunk_info->scaled;
+ store.chunk.scaled = chunk_info->scaled;
} /* end if */
/* Collective IO for this chunk,
* Note: even there is no selection for this process, the process still
* needs to contribute MPI NONE TYPE.
*/
- if(chunk_io_option[u] == H5D_CHUNK_IO_MODE_COL) {
+ if (chunk_io_option[u] == H5D_CHUNK_IO_MODE_COL) {
#ifdef H5D_DEBUG
-if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D),"inside collective chunk IO mpi_rank = %d, chunk index = %zu\n", mpi_rank, u);
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "inside collective chunk IO mpi_rank = %d, chunk index = %zu\n",
+ mpi_rank, u);
#endif
/* Set the file & memory dataspaces */
- if(chunk_info) {
+ if (chunk_info) {
fspace = chunk_info->fspace;
mspace = chunk_info->mspace;
@@ -1613,7 +1640,7 @@ if(H5DEBUG(D))
* to ease switching between to mixed I/O without checking the current
* value of the property. You can see the definition in H5Ppublic.h
*/
- actual_io_mode = (H5D_mpio_actual_io_mode_t) (actual_io_mode | H5D_MPIO_CHUNK_COLLECTIVE);
+ actual_io_mode = (H5D_mpio_actual_io_mode_t)(actual_io_mode | H5D_MPIO_CHUNK_COLLECTIVE);
} /* end if */
else {
@@ -1621,8 +1648,8 @@ if(H5DEBUG(D))
} /* end else */
/* Switch back to collective I/O */
- if(last_coll_opt_mode != H5FD_MPIO_COLLECTIVE_IO) {
- if(H5CX_set_mpio_coll_opt(H5FD_MPIO_COLLECTIVE_IO) < 0)
+ if (last_coll_opt_mode != H5FD_MPIO_COLLECTIVE_IO) {
+ if (H5CX_set_mpio_coll_opt(H5FD_MPIO_COLLECTIVE_IO) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't switch to collective I/O")
last_coll_opt_mode = H5FD_MPIO_COLLECTIVE_IO;
} /* end if */
@@ -1631,32 +1658,33 @@ if(H5DEBUG(D))
ctg_store.contig.dset_addr = chunk_addr[u];
/* Perform the I/O */
- if(H5D__inter_collective_io(&ctg_io_info, type_info, fspace, mspace) < 0)
+ if (H5D__inter_collective_io(&ctg_io_info, type_info, fspace, mspace) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish shared collective MPI-IO")
- } /* end if */
- else { /* possible independent IO for this chunk */
+ } /* end if */
+ else { /* possible independent IO for this chunk */
#ifdef H5D_DEBUG
-if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D),"inside independent IO mpi_rank = %d, chunk index = %zu\n", mpi_rank, u);
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "inside independent IO mpi_rank = %d, chunk index = %zu\n", mpi_rank,
+ u);
#endif
HDassert(chunk_io_option[u] == 0);
/* Set the file & memory dataspaces */
- if(chunk_info) {
+ if (chunk_info) {
fspace = chunk_info->fspace;
mspace = chunk_info->mspace;
/* Update the local variable tracking the actual io mode. */
- actual_io_mode = (H5D_mpio_actual_io_mode_t) (actual_io_mode | H5D_MPIO_CHUNK_INDEPENDENT);
+ actual_io_mode = (H5D_mpio_actual_io_mode_t)(actual_io_mode | H5D_MPIO_CHUNK_INDEPENDENT);
} /* end if */
else {
fspace = mspace = NULL;
} /* end else */
/* Using independent I/O with file setview.*/
- if(last_coll_opt_mode != H5FD_MPIO_INDIVIDUAL_IO) {
- if(H5CX_set_mpio_coll_opt(H5FD_MPIO_INDIVIDUAL_IO) < 0)
+ if (last_coll_opt_mode != H5FD_MPIO_INDIVIDUAL_IO) {
+ if (H5CX_set_mpio_coll_opt(H5FD_MPIO_INDIVIDUAL_IO) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't switch to individual I/O")
last_coll_opt_mode = H5FD_MPIO_INDIVIDUAL_IO;
} /* end if */
@@ -1665,28 +1693,27 @@ if(H5DEBUG(D))
ctg_store.contig.dset_addr = chunk_addr[u];
/* Perform the I/O */
- if(H5D__inter_collective_io(&ctg_io_info, type_info, fspace, mspace) < 0)
+ if (H5D__inter_collective_io(&ctg_io_info, type_info, fspace, mspace) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish shared collective MPI-IO")
#ifdef H5D_DEBUG
- if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D),"after inter collective IO\n");
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "after inter collective IO\n");
#endif
} /* end else */
- } /* end for */
+ } /* end for */
/* Write the local value of actual io mode to the API context. */
H5CX_set_mpio_actual_io_mode(actual_io_mode);
done:
- if(chunk_io_option)
+ if (chunk_io_option)
H5MM_xfree(chunk_io_option);
- if(chunk_addr)
+ if (chunk_addr)
H5MM_xfree(chunk_addr);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__multi_chunk_collective_io */
-
/*-------------------------------------------------------------------------
* Function: H5D__multi_chunk_filtered_collective_io
*
@@ -1745,23 +1772,25 @@ done:
*/
static herr_t
H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- H5D_chunk_map_t *fm)
+ H5D_chunk_map_t *fm)
{
H5D_filtered_collective_io_info_t *chunk_list = NULL; /* The list of chunks being read/written */
- H5D_filtered_collective_io_info_t *collective_chunk_list = NULL; /* The list of chunks used during collective operations */
- H5D_storage_t store; /* union of EFL and chunk pointer in file space */
- H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */
- H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */
- MPI_Datatype *file_type_array = NULL;
- MPI_Datatype *mem_type_array = NULL;
- hbool_t *file_type_is_derived_array = NULL;
- hbool_t *mem_type_is_derived_array = NULL;
- hbool_t *has_chunk_selected_array = NULL; /* Array of whether or not each process is contributing a chunk to each iteration */
- size_t chunk_list_num_entries;
- size_t collective_chunk_list_num_entries;
- size_t i, j; /* Local index variable */
- int mpi_rank, mpi_size, mpi_code;
- herr_t ret_value = SUCCEED;
+ H5D_filtered_collective_io_info_t *collective_chunk_list =
+ NULL; /* The list of chunks used during collective operations */
+ H5D_storage_t store; /* union of EFL and chunk pointer in file space */
+ H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */
+ H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */
+ MPI_Datatype *file_type_array = NULL;
+ MPI_Datatype *mem_type_array = NULL;
+ hbool_t * file_type_is_derived_array = NULL;
+ hbool_t * mem_type_is_derived_array = NULL;
+ hbool_t * has_chunk_selected_array =
+ NULL; /* Array of whether or not each process is contributing a chunk to each iteration */
+ size_t chunk_list_num_entries;
+ size_t collective_chunk_list_num_entries;
+ size_t i, j; /* Local index variable */
+ int mpi_rank, mpi_size, mpi_code;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1770,9 +1799,9 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i
HDassert(fm);
/* Obtain the current rank of the process and the number of processes */
- if((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0)
+ if ((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0)
HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi rank")
- if((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0)
+ if ((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0)
HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi size")
/* Set the actual chunk opt mode property */
@@ -1784,26 +1813,27 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i
H5CX_set_mpio_actual_io_mode(H5D_MPIO_CHUNK_COLLECTIVE);
/* Build a list of selected chunks in the collective IO operation */
- if(H5D__construct_filtered_io_info_list(io_info, type_info, fm, &chunk_list, &chunk_list_num_entries) < 0)
+ if (H5D__construct_filtered_io_info_list(io_info, type_info, fm, &chunk_list, &chunk_list_num_entries) <
+ 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't construct filtered I/O info list")
/* Set up contiguous I/O info object */
H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info));
- ctg_io_info.store = &ctg_store;
+ ctg_io_info.store = &ctg_store;
ctg_io_info.layout_ops = *H5D_LOPS_CONTIG;
/* Initialize temporary contiguous storage info */
- ctg_store.contig.dset_size = (hsize_t) io_info->dset->shared->layout.u.chunk.size;
+ ctg_store.contig.dset_size = (hsize_t)io_info->dset->shared->layout.u.chunk.size;
ctg_store.contig.dset_addr = 0;
/* Set dataset storage for I/O info */
io_info->store = &store;
- if(io_info->op_type == H5D_IO_OP_READ) { /* Filtered collective read */
- for(i = 0; i < chunk_list_num_entries; i++)
- if(H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0)
+ if (io_info->op_type == H5D_IO_OP_READ) { /* Filtered collective read */
+ for (i = 0; i < chunk_list_num_entries; i++)
+ if (H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't process chunk entry")
- } /* end if */
+ } /* end if */
else { /* Filtered collective write */
H5D_chk_idx_info_t index_info;
H5D_chunk_ud_t udata;
@@ -1811,37 +1841,38 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i
hsize_t mpi_buf_count;
/* Construct chunked index info */
- index_info.f = io_info->dset->oloc.file;
- index_info.pline = &(io_info->dset->shared->dcpl_cache.pline);
- index_info.layout = &(io_info->dset->shared->layout.u.chunk);
+ index_info.f = io_info->dset->oloc.file;
+ index_info.pline = &(io_info->dset->shared->dcpl_cache.pline);
+ index_info.layout = &(io_info->dset->shared->layout.u.chunk);
index_info.storage = &(io_info->dset->shared->layout.storage.u.chunk);
/* Set up chunk information for insertion to chunk index */
- udata.common.layout = index_info.layout;
+ udata.common.layout = index_info.layout;
udata.common.storage = index_info.storage;
- udata.filter_mask = 0;
+ udata.filter_mask = 0;
/* Retrieve the maximum number of chunks being written among all processes */
- if (MPI_SUCCESS != (mpi_code = MPI_Allreduce(&chunk_list_num_entries, &max_num_chunks,
- 1, MPI_UNSIGNED_LONG_LONG, MPI_MAX, io_info->comm)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Allreduce(&chunk_list_num_entries, &max_num_chunks, 1,
+ MPI_UNSIGNED_LONG_LONG, MPI_MAX, io_info->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_code)
/* If no one is writing anything at all, end the operation */
- if (!(max_num_chunks > 0)) HGOTO_DONE(SUCCEED);
+ if (!(max_num_chunks > 0))
+ HGOTO_DONE(SUCCEED);
/* Allocate arrays for storing MPI file and mem types and whether or not the
* types were derived.
*/
- if (NULL == (file_type_array = (MPI_Datatype *) H5MM_malloc(max_num_chunks * sizeof(MPI_Datatype))))
+ if (NULL == (file_type_array = (MPI_Datatype *)H5MM_malloc(max_num_chunks * sizeof(MPI_Datatype))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate file type array")
- if (NULL == (file_type_is_derived_array = (hbool_t *) H5MM_calloc(max_num_chunks * sizeof(hbool_t))))
+ if (NULL == (file_type_is_derived_array = (hbool_t *)H5MM_calloc(max_num_chunks * sizeof(hbool_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate file type is derived array")
- if (NULL == (mem_type_array = (MPI_Datatype *) H5MM_malloc(max_num_chunks * sizeof(MPI_Datatype))))
+ if (NULL == (mem_type_array = (MPI_Datatype *)H5MM_malloc(max_num_chunks * sizeof(MPI_Datatype))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate mem type array")
- if (NULL == (mem_type_is_derived_array = (hbool_t *) H5MM_calloc(max_num_chunks * sizeof(hbool_t))))
+ if (NULL == (mem_type_is_derived_array = (hbool_t *)H5MM_calloc(max_num_chunks * sizeof(hbool_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate mem type is derived array")
/* Iterate over the max number of chunks among all processes, as this process could
@@ -1850,17 +1881,20 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i
*/
for (i = 0; i < max_num_chunks; i++) {
/* Check if this process has a chunk to work on for this iteration */
- hbool_t have_chunk_to_process = (i < chunk_list_num_entries) && (mpi_rank == chunk_list[i].owners.new_owner);
+ hbool_t have_chunk_to_process =
+ (i < chunk_list_num_entries) && (mpi_rank == chunk_list[i].owners.new_owner);
- if(have_chunk_to_process)
- if(H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0)
+ if (have_chunk_to_process)
+ if (H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't process chunk entry")
/* Gather the new chunk sizes to all processes for a collective re-allocation
* of the chunks in the file
*/
- if(H5D__mpio_array_gatherv(&chunk_list[i], have_chunk_to_process ? 1 : 0, sizeof(H5D_filtered_collective_io_info_t),
- (void **) &collective_chunk_list, &collective_chunk_list_num_entries, true, 0, io_info->comm, NULL) < 0)
+ if (H5D__mpio_array_gatherv(&chunk_list[i], have_chunk_to_process ? 1 : 0,
+ sizeof(H5D_filtered_collective_io_info_t),
+ (void **)&collective_chunk_list, &collective_chunk_list_num_entries,
+ true, 0, io_info->comm, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, "couldn't gather new chunk sizes")
/* Participate in the collective re-allocation of all chunks modified
@@ -1870,15 +1904,18 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i
hbool_t insert = FALSE;
if (H5D__chunk_file_alloc(&index_info, &collective_chunk_list[j].chunk_states.chunk_current,
- &collective_chunk_list[j].chunk_states.new_chunk, &insert, chunk_list[j].scaled) < 0)
+ &collective_chunk_list[j].chunk_states.new_chunk, &insert,
+ chunk_list[j].scaled) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk")
} /* end for */
- if (NULL == (has_chunk_selected_array = (hbool_t *) H5MM_malloc((size_t) mpi_size * sizeof(hbool_t))))
+ if (NULL ==
+ (has_chunk_selected_array = (hbool_t *)H5MM_malloc((size_t)mpi_size * sizeof(hbool_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate num chunks selected array")
- if (MPI_SUCCESS != (mpi_code = MPI_Allgather(&have_chunk_to_process, 1, MPI_C_BOOL, has_chunk_selected_array,
- 1, MPI_C_BOOL, io_info->comm)))
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Allgather(&have_chunk_to_process, 1, MPI_C_BOOL, has_chunk_selected_array, 1,
+ MPI_C_BOOL, io_info->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Allgather failed", mpi_code)
/* If this process has a chunk to work on, create a MPI type for the
@@ -1888,26 +1925,30 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i
size_t offset;
int mpi_type_count;
- for (j = 0, offset = 0; j < (size_t) mpi_rank; j++)
+ for (j = 0, offset = 0; j < (size_t)mpi_rank; j++)
offset += has_chunk_selected_array[j];
/* Collect the new chunk info back to the local copy, since only the record in the
* collective array gets updated by the chunk re-allocation */
- H5MM_memcpy(&chunk_list[i].chunk_states.new_chunk, &collective_chunk_list[offset].chunk_states.new_chunk, sizeof(chunk_list[i].chunk_states.new_chunk));
+ H5MM_memcpy(&chunk_list[i].chunk_states.new_chunk,
+ &collective_chunk_list[offset].chunk_states.new_chunk,
+ sizeof(chunk_list[i].chunk_states.new_chunk));
H5_CHECKED_ASSIGN(mpi_type_count, int, chunk_list[i].chunk_states.new_chunk.length, hsize_t);
/* Create MPI memory type for writing to chunk */
- if (MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(mpi_type_count, MPI_BYTE, &mem_type_array[i])))
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Type_contiguous(mpi_type_count, MPI_BYTE, &mem_type_array[i])))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&mem_type_array[i])))
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&mem_type_array[i])))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
mem_type_is_derived_array[i] = TRUE;
/* Create MPI file type for writing to chunk */
- if (MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(mpi_type_count, MPI_BYTE, &file_type_array[i])))
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Type_contiguous(mpi_type_count, MPI_BYTE, &file_type_array[i])))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&file_type_array[i])))
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&file_type_array[i])))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
file_type_is_derived_array[i] = TRUE;
@@ -1923,34 +1964,36 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i
} /* end if */
else {
mem_type_array[i] = file_type_array[i] = MPI_BYTE;
- mpi_buf_count = 0;
+ mpi_buf_count = 0;
} /* end else */
/* Perform the I/O */
- if (H5D__final_collective_io(&ctg_io_info, type_info, mpi_buf_count, file_type_array[i], mem_type_array[i]) < 0)
+ if (H5D__final_collective_io(&ctg_io_info, type_info, mpi_buf_count, file_type_array[i],
+ mem_type_array[i]) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish MPI-IO")
/* Participate in the collective re-insertion of all chunks modified
* in this iteration into the chunk index
*/
for (j = 0; j < collective_chunk_list_num_entries; j++) {
- udata.chunk_block = collective_chunk_list[j].chunk_states.new_chunk;
+ udata.chunk_block = collective_chunk_list[j].chunk_states.new_chunk;
udata.common.scaled = collective_chunk_list[j].scaled;
- udata.chunk_idx = collective_chunk_list[j].index;
+ udata.chunk_idx = collective_chunk_list[j].index;
if ((index_info.storage->ops->insert)(&index_info, &udata, io_info->dset) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk address into index")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL,
+ "unable to insert chunk address into index")
} /* end for */
- if (collective_chunk_list){
+ if (collective_chunk_list) {
H5MM_free(collective_chunk_list);
collective_chunk_list = NULL;
} /* end if */
- if (has_chunk_selected_array){
+ if (has_chunk_selected_array) {
H5MM_free(has_chunk_selected_array);
has_chunk_selected_array = NULL;
} /* end if */
- } /* end for */
+ } /* end for */
/* Free the MPI file and memory types, if they were derived */
for (i = 0; i < max_num_chunks; i++) {
@@ -1962,7 +2005,7 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i
if (MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type_array[i])))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
} /* end for */
- } /* end else */
+ } /* end else */
done:
if (chunk_list) {
@@ -1987,7 +2030,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__multi_chunk_filtered_collective_io() */
-
/*-------------------------------------------------------------------------
* Function: H5D__inter_collective_io
*
@@ -2002,20 +2044,20 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- const H5S_t *file_space, const H5S_t *mem_space)
+H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, const H5S_t *file_space,
+ const H5S_t *mem_space)
{
- int mpi_buf_count; /* # of MPI types */
- hbool_t mbt_is_derived = FALSE;
- hbool_t mft_is_derived = FALSE;
- MPI_Datatype mpi_file_type, mpi_buf_type;
- int mpi_code; /* MPI return code */
- herr_t ret_value = SUCCEED; /* return value */
+ int mpi_buf_count; /* # of MPI types */
+ hbool_t mbt_is_derived = FALSE;
+ hbool_t mft_is_derived = FALSE;
+ MPI_Datatype mpi_file_type, mpi_buf_type;
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_STATIC
- if((file_space != NULL) && (mem_space != NULL)) {
- int mpi_file_count; /* Number of file "objects" to transfer */
+ if ((file_space != NULL) && (mem_space != NULL)) {
+ int mpi_file_count; /* Number of file "objects" to transfer */
hsize_t *permute_map = NULL; /* array that holds the mapping from the old,
out-of-order displacements to the in-order
displacements of the MPI datatypes of the
@@ -2027,39 +2069,40 @@ H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
* and will be fed into the next call to H5S_mpio_space_type
* where it will be freed.
*/
- if(H5S_mpio_space_type(file_space, type_info->src_type_size,
- &mpi_file_type, &mpi_file_count, &mft_is_derived, /* OUT: datatype created */
- TRUE, /* this is a file space, so
- permute the datatype if the
- point selection is out of
- order */
- &permute_map, /* OUT: a map to indicate
- the permutation of
- points selected in
- case they are out of
- order */
- &is_permuted /* OUT */) < 0)
+ if (H5S_mpio_space_type(file_space, type_info->src_type_size, &mpi_file_type, &mpi_file_count,
+ &mft_is_derived, /* OUT: datatype created */
+ TRUE, /* this is a file space, so
+ permute the datatype if the
+ point selection is out of
+ order */
+ &permute_map, /* OUT: a map to indicate
+ the permutation of
+ points selected in
+ case they are out of
+ order */
+ &is_permuted /* OUT */) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create MPI file type")
/* Sanity check */
- if(is_permuted)
+ if (is_permuted)
HDassert(permute_map);
- if(H5S_mpio_space_type(mem_space, type_info->src_type_size,
- &mpi_buf_type, &mpi_buf_count, &mbt_is_derived, /* OUT: datatype created */
- FALSE, /* this is a memory space, so if
- the file space is not
- permuted, there is no need to
- permute the datatype if the
- point selections are out of
- order*/
- &permute_map /* IN: the permutation map
- generated by the
- file_space selection
- and applied to the
- memory selection */,
- &is_permuted /* IN */) < 0)
+ if (H5S_mpio_space_type(mem_space, type_info->src_type_size, &mpi_buf_type, &mpi_buf_count,
+ &mbt_is_derived, /* OUT: datatype created */
+ FALSE, /* this is a memory space, so if
+ the file space is not
+ permuted, there is no need to
+ permute the datatype if the
+ point selections are out of
+ order*/
+ &permute_map /* IN: the permutation map
+ generated by the
+ file_space selection
+ and applied to the
+ memory selection */
+ ,
+ &is_permuted /* IN */) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create MPI buffer type")
/* Sanity check */
- if(is_permuted)
+ if (is_permuted)
HDassert(!permute_map);
} /* end if */
else {
@@ -2072,30 +2115,29 @@ H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
} /* end else */
#ifdef H5D_DEBUG
-if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D),"before final collective IO \n");
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "before final collective IO \n");
#endif
/* Perform final collective I/O operation */
- if(H5D__final_collective_io(io_info, type_info, (hsize_t)mpi_buf_count, mpi_file_type, mpi_buf_type) < 0)
+ if (H5D__final_collective_io(io_info, type_info, (hsize_t)mpi_buf_count, mpi_file_type, mpi_buf_type) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish collective MPI-IO")
done:
/* Free the MPI buf and file types, if they were derived */
- if(mbt_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&mpi_buf_type)))
+ if (mbt_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&mpi_buf_type)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
- if(mft_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&mpi_file_type)))
+ if (mft_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&mpi_file_type)))
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
#ifdef H5D_DEBUG
-if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D),"before leaving inter_collective_io ret_value = %d\n",ret_value);
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "before leaving inter_collective_io ret_value = %d\n", ret_value);
#endif
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__inter_collective_io() */
-
/*-------------------------------------------------------------------------
* Function: H5D__final_collective_io
*
@@ -2109,35 +2151,34 @@ if(H5DEBUG(D))
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__final_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t mpi_buf_count, MPI_Datatype mpi_file_type, MPI_Datatype mpi_buf_type)
+H5D__final_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t mpi_buf_count,
+ MPI_Datatype mpi_file_type, MPI_Datatype mpi_buf_type)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Pass buf type, file type to the file driver. */
- if(H5CX_set_mpi_coll_datatypes(mpi_buf_type, mpi_file_type) < 0)
+ if (H5CX_set_mpi_coll_datatypes(mpi_buf_type, mpi_file_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set MPI-I/O collective I/O datatypes")
- if(io_info->op_type == H5D_IO_OP_WRITE) {
- if((io_info->io_ops.single_write)(io_info, type_info, mpi_buf_count, NULL, NULL) < 0)
+ if (io_info->op_type == H5D_IO_OP_WRITE) {
+ if ((io_info->io_ops.single_write)(io_info, type_info, mpi_buf_count, NULL, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "optimized write failed")
} /* end if */
else {
- if((io_info->io_ops.single_read)(io_info, type_info, mpi_buf_count, NULL, NULL) < 0)
+ if ((io_info->io_ops.single_read)(io_info, type_info, mpi_buf_count, NULL, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "optimized read failed")
} /* end else */
done:
#ifdef H5D_DEBUG
-if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D),"ret_value before leaving final_collective_io=%d\n",ret_value);
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "ret_value before leaving final_collective_io=%d\n", ret_value);
#endif
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__final_collective_io */
-
/*-------------------------------------------------------------------------
* Function: H5D__cmp_chunk_addr
*
@@ -2155,17 +2196,16 @@ if(H5DEBUG(D))
static int
H5D__cmp_chunk_addr(const void *chunk_addr_info1, const void *chunk_addr_info2)
{
- haddr_t addr1 = HADDR_UNDEF, addr2 = HADDR_UNDEF;
+ haddr_t addr1 = HADDR_UNDEF, addr2 = HADDR_UNDEF;
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC_NOERR
- addr1 = ((const H5D_chunk_addr_info_t *)chunk_addr_info1)->chunk_addr;
- addr2 = ((const H5D_chunk_addr_info_t *)chunk_addr_info2)->chunk_addr;
+ addr1 = ((const H5D_chunk_addr_info_t *)chunk_addr_info1)->chunk_addr;
+ addr2 = ((const H5D_chunk_addr_info_t *)chunk_addr_info2)->chunk_addr;
- FUNC_LEAVE_NOAPI(H5F_addr_cmp(addr1, addr2))
+ FUNC_LEAVE_NOAPI(H5F_addr_cmp(addr1, addr2))
} /* end H5D__cmp_chunk_addr() */
-
/*-------------------------------------------------------------------------
* Function: H5D__cmp_filtered_collective_io_info_entry
*
@@ -2183,20 +2223,23 @@ H5D__cmp_chunk_addr(const void *chunk_addr_info1, const void *chunk_addr_info2)
*-------------------------------------------------------------------------
*/
static int
-H5D__cmp_filtered_collective_io_info_entry(const void *filtered_collective_io_info_entry1, const void *filtered_collective_io_info_entry2)
+H5D__cmp_filtered_collective_io_info_entry(const void *filtered_collective_io_info_entry1,
+ const void *filtered_collective_io_info_entry2)
{
haddr_t addr1 = HADDR_UNDEF, addr2 = HADDR_UNDEF;
FUNC_ENTER_STATIC_NOERR
- addr1 = ((const H5D_filtered_collective_io_info_t *) filtered_collective_io_info_entry1)->chunk_states.new_chunk.offset;
- addr2 = ((const H5D_filtered_collective_io_info_t *) filtered_collective_io_info_entry2)->chunk_states.new_chunk.offset;
+ addr1 = ((const H5D_filtered_collective_io_info_t *)filtered_collective_io_info_entry1)
+ ->chunk_states.new_chunk.offset;
+ addr2 = ((const H5D_filtered_collective_io_info_t *)filtered_collective_io_info_entry2)
+ ->chunk_states.new_chunk.offset;
FUNC_LEAVE_NOAPI(H5F_addr_cmp(addr1, addr2))
} /* end H5D__cmp_filtered_collective_io_info_entry() */
#if MPI_VERSION >= 3
-
+
/*-------------------------------------------------------------------------
* Function: H5D__cmp_filtered_collective_io_info_entry_owner
*
@@ -2215,20 +2258,22 @@ H5D__cmp_filtered_collective_io_info_entry(const void *filtered_collective_io_in
*-------------------------------------------------------------------------
*/
static int
-H5D__cmp_filtered_collective_io_info_entry_owner(const void *filtered_collective_io_info_entry1, const void *filtered_collective_io_info_entry2)
+H5D__cmp_filtered_collective_io_info_entry_owner(const void *filtered_collective_io_info_entry1,
+ const void *filtered_collective_io_info_entry2)
{
int owner1 = -1, owner2 = -1;
FUNC_ENTER_STATIC_NOERR
- owner1 = ((const H5D_filtered_collective_io_info_t *) filtered_collective_io_info_entry1)->owners.original_owner;
- owner2 = ((const H5D_filtered_collective_io_info_t *) filtered_collective_io_info_entry2)->owners.original_owner;
+ owner1 = ((const H5D_filtered_collective_io_info_t *)filtered_collective_io_info_entry1)
+ ->owners.original_owner;
+ owner2 = ((const H5D_filtered_collective_io_info_t *)filtered_collective_io_info_entry2)
+ ->owners.original_owner;
FUNC_LEAVE_NOAPI(owner1 - owner2)
} /* end H5D__cmp_filtered_collective_io_info_entry_owner() */
#endif
-
/*-------------------------------------------------------------------------
* Function: H5D__sort_chunk
*
@@ -2243,8 +2288,8 @@ H5D__cmp_filtered_collective_io_info_entry_owner(const void *filtered_collective
* Parameters:
* Input: H5D_io_info_t* io_info,
* H5D_chunk_map_t *fm(global chunk map struct)
- * Input/Output: H5D_chunk_addr_info_t chunk_addr_info_array[] : array to store chunk address and information
- * many_chunk_opt : flag to optimize the way to obtain chunk addresses
+ * Input/Output: H5D_chunk_addr_info_t chunk_addr_info_array[] : array to store chunk address
+ *and information many_chunk_opt : flag to optimize the way to obtain chunk addresses
* for many chunks
*
* Return: Non-negative on success/Negative on failure
@@ -2256,24 +2301,24 @@ H5D__cmp_filtered_collective_io_info_entry_owner(const void *filtered_collective
*/
static herr_t
H5D__sort_chunk(H5D_io_info_t *io_info, const H5D_chunk_map_t *fm,
- H5D_chunk_addr_info_t chunk_addr_info_array[], int sum_chunk)
+ H5D_chunk_addr_info_t chunk_addr_info_array[], int sum_chunk)
{
- H5SL_node_t *chunk_node; /* Current node in chunk skip list */
- H5D_chunk_info_t *chunk_info; /* Current chunking info. of this node. */
- haddr_t chunk_addr; /* Current chunking address of this node */
- haddr_t *total_chunk_addr_array = NULL; /* The array of chunk address for the total number of chunk */
- hbool_t do_sort = FALSE; /* Whether the addresses need to be sorted */
- int bsearch_coll_chunk_threshold;
- int many_chunk_opt = H5D_OBTAIN_ONE_CHUNK_ADDR_IND;
- int mpi_size; /* Number of MPI processes */
- int mpi_code; /* MPI return code */
- int i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5SL_node_t * chunk_node; /* Current node in chunk skip list */
+ H5D_chunk_info_t *chunk_info; /* Current chunking info. of this node. */
+ haddr_t chunk_addr; /* Current chunking address of this node */
+ haddr_t *total_chunk_addr_array = NULL; /* The array of chunk address for the total number of chunk */
+ hbool_t do_sort = FALSE; /* Whether the addresses need to be sorted */
+ int bsearch_coll_chunk_threshold;
+ int many_chunk_opt = H5D_OBTAIN_ONE_CHUNK_ADDR_IND;
+ int mpi_size; /* Number of MPI processes */
+ int mpi_code; /* MPI return code */
+ int i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Retrieve # of MPI processes */
- if((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0)
+ if ((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0)
HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi size")
/* Calculate the actual threshold to obtain all chunk addresses collectively
@@ -2285,56 +2330,59 @@ H5D__sort_chunk(H5D_io_info_t *io_info, const H5D_chunk_map_t *fm,
* for each process.
*/
bsearch_coll_chunk_threshold = (sum_chunk * 100) / ((int)fm->layout->u.chunk.nchunks * mpi_size);
- if((bsearch_coll_chunk_threshold > H5D_ALL_CHUNK_ADDR_THRES_COL)
- && ((sum_chunk / mpi_size) >= H5D_ALL_CHUNK_ADDR_THRES_COL_NUM))
+ if ((bsearch_coll_chunk_threshold > H5D_ALL_CHUNK_ADDR_THRES_COL) &&
+ ((sum_chunk / mpi_size) >= H5D_ALL_CHUNK_ADDR_THRES_COL_NUM))
many_chunk_opt = H5D_OBTAIN_ALL_CHUNK_ADDR_COL;
#ifdef H5D_DEBUG
-if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D), "many_chunk_opt= %d\n", many_chunk_opt);
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "many_chunk_opt= %d\n", many_chunk_opt);
#endif
/* If we need to optimize the way to obtain the chunk address */
- if(many_chunk_opt != H5D_OBTAIN_ONE_CHUNK_ADDR_IND) {
+ if (many_chunk_opt != H5D_OBTAIN_ONE_CHUNK_ADDR_IND) {
int mpi_rank;
#ifdef H5D_DEBUG
-if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D), "Coming inside H5D_OBTAIN_ALL_CHUNK_ADDR_COL\n");
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "Coming inside H5D_OBTAIN_ALL_CHUNK_ADDR_COL\n");
#endif
/* Allocate array for chunk addresses */
- if(NULL == (total_chunk_addr_array = (haddr_t *)H5MM_malloc(sizeof(haddr_t) * (size_t)fm->layout->u.chunk.nchunks)))
+ if (NULL == (total_chunk_addr_array =
+ (haddr_t *)H5MM_malloc(sizeof(haddr_t) * (size_t)fm->layout->u.chunk.nchunks)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory chunk address array")
/* Retrieve all the chunk addresses with process 0 */
- if((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0)
+ if ((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0)
HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi rank")
- if(mpi_rank == 0) {
- if(H5D__chunk_addrmap(io_info, total_chunk_addr_array) < 0)
+ if (mpi_rank == 0) {
+ if (H5D__chunk_addrmap(io_info, total_chunk_addr_array) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address")
} /* end if */
/* Broadcasting the MPI_IO option info. and chunk address info. */
- if(MPI_SUCCESS != (mpi_code = MPI_Bcast(total_chunk_addr_array, (int)(sizeof(haddr_t) * fm->layout->u.chunk.nchunks), MPI_BYTE, (int)0, io_info->comm)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Bcast(total_chunk_addr_array,
+ (int)(sizeof(haddr_t) * fm->layout->u.chunk.nchunks),
+ MPI_BYTE, (int)0, io_info->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_BCast failed", mpi_code)
} /* end if */
/* Start at first node in chunk skip list */
i = 0;
- if(NULL == (chunk_node = H5SL_first(fm->sel_chunks)))
- HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL,"couldn't get chunk node from skipped list")
+ if (NULL == (chunk_node = H5SL_first(fm->sel_chunks)))
+ HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk node from skipped list")
/* Iterate over all chunks for this process */
- while(chunk_node) {
- if(NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_item(chunk_node)))
- HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL,"couldn't get chunk info from skipped list")
+ while (chunk_node) {
+ if (NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_item(chunk_node)))
+ HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk info from skipped list")
- if(many_chunk_opt == H5D_OBTAIN_ONE_CHUNK_ADDR_IND) {
- H5D_chunk_ud_t udata; /* User data for querying chunk info */
+ if (many_chunk_opt == H5D_OBTAIN_ONE_CHUNK_ADDR_IND) {
+ H5D_chunk_ud_t udata; /* User data for querying chunk info */
/* Get address of chunk */
- if(H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0)
+ if (H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0)
HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk info from skipped list")
chunk_addr = udata.chunk_block.offset;
} /* end if */
@@ -2342,7 +2390,7 @@ if(H5DEBUG(D))
chunk_addr = total_chunk_addr_array[chunk_info->index];
/* Check if chunk addresses are not in increasing order in the file */
- if(i > 0 && chunk_addr < chunk_addr_info_array[i - 1].chunk_addr)
+ if (i > 0 && chunk_addr < chunk_addr_info_array[i - 1].chunk_addr)
do_sort = TRUE;
/* Set the address & info for this chunk */
@@ -2355,23 +2403,22 @@ if(H5DEBUG(D))
} /* end while */
#ifdef H5D_DEBUG
-if(H5DEBUG(D))
- HDfprintf(H5DEBUG(D), "before Qsort\n");
+ if (H5DEBUG(D))
+ HDfprintf(H5DEBUG(D), "before Qsort\n");
#endif
- if(do_sort) {
+ if (do_sort) {
size_t num_chunks = H5SL_count(fm->sel_chunks);
HDqsort(chunk_addr_info_array, num_chunks, sizeof(chunk_addr_info_array[0]), H5D__cmp_chunk_addr);
} /* end if */
done:
- if(total_chunk_addr_array)
+ if (total_chunk_addr_array)
H5MM_xfree(total_chunk_addr_array);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__sort_chunk() */
-
/*-------------------------------------------------------------------------
* Function: H5D__obtain_mpio_mode
*
@@ -2392,7 +2439,8 @@ done:
* c) Build MPI derived datatype to combine "chunk address" and "assign_io" information
* in order to do MPI Bcast only once
* d) MPI Bcast the IO mode and chunk address information for each chunk.
- * 4) Each process then retrieves IO mode and chunk address information to assign_io_mode and chunk_addr.
+ * 4) Each process then retrieves IO mode and chunk address information to assign_io_mode and
+ *chunk_addr.
*
* Parameters:
*
@@ -2409,17 +2457,17 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
- uint8_t assign_io_mode[], haddr_t chunk_addr[])
+H5D__obtain_mpio_mode(H5D_io_info_t *io_info, H5D_chunk_map_t *fm, uint8_t assign_io_mode[],
+ haddr_t chunk_addr[])
{
size_t total_chunks;
unsigned percent_nproc_per_chunk, threshold_nproc_per_chunk;
- uint8_t* io_mode_info = NULL;
- uint8_t* recv_io_mode_info = NULL;
- uint8_t* mergebuf = NULL;
- uint8_t* tempbuf;
- H5SL_node_t* chunk_node;
- H5D_chunk_info_t* chunk_info;
+ uint8_t * io_mode_info = NULL;
+ uint8_t * recv_io_mode_info = NULL;
+ uint8_t * mergebuf = NULL;
+ uint8_t * tempbuf;
+ H5SL_node_t * chunk_node;
+ H5D_chunk_info_t *chunk_info;
int mpi_size, mpi_rank;
MPI_Comm comm;
int root;
@@ -2430,91 +2478,90 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
FUNC_ENTER_STATIC
/* Assign the rank 0 to the root */
- root = 0;
- comm = io_info->comm;
+ root = 0;
+ comm = io_info->comm;
/* Obtain the number of process and the current rank of the process */
- if((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0)
+ if ((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0)
HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi rank")
- if((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0)
+ if ((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0)
HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi size")
/* Setup parameters */
H5_CHECKED_ASSIGN(total_chunks, size_t, fm->layout->u.chunk.nchunks, hsize_t);
- if(H5CX_get_mpio_chunk_opt_ratio(&percent_nproc_per_chunk) < 0)
+ if (H5CX_get_mpio_chunk_opt_ratio(&percent_nproc_per_chunk) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get percent nproc per chunk")
/* if ratio is 0, perform collective io */
- if(0 == percent_nproc_per_chunk) {
- if(H5D__chunk_addrmap(io_info, chunk_addr) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address");
- for(ic = 0; ic < total_chunks; ic++)
- assign_io_mode[ic] = H5D_CHUNK_IO_MODE_COL;
+ if (0 == percent_nproc_per_chunk) {
+ if (H5D__chunk_addrmap(io_info, chunk_addr) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address");
+ for (ic = 0; ic < total_chunks; ic++)
+ assign_io_mode[ic] = H5D_CHUNK_IO_MODE_COL;
HGOTO_DONE(SUCCEED)
} /* end if */
- threshold_nproc_per_chunk = (unsigned)mpi_size * percent_nproc_per_chunk/100;
+ threshold_nproc_per_chunk = (unsigned)mpi_size * percent_nproc_per_chunk / 100;
/* Allocate memory */
- if(NULL == (io_mode_info = (uint8_t *)H5MM_calloc(total_chunks)))
+ if (NULL == (io_mode_info = (uint8_t *)H5MM_calloc(total_chunks)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate I/O mode info buffer")
- if(NULL == (mergebuf = (uint8_t *)H5MM_malloc((sizeof(haddr_t) + 1) * total_chunks)))
+ if (NULL == (mergebuf = (uint8_t *)H5MM_malloc((sizeof(haddr_t) + 1) * total_chunks)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate mergebuf buffer")
- tempbuf = mergebuf + total_chunks;
- if(mpi_rank == root)
- if(NULL == (recv_io_mode_info = (uint8_t *)H5MM_malloc(total_chunks * (size_t)mpi_size)))
+ tempbuf = mergebuf + total_chunks;
+ if (mpi_rank == root)
+ if (NULL == (recv_io_mode_info = (uint8_t *)H5MM_malloc(total_chunks * (size_t)mpi_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate recv I/O mode info buffer")
/* Obtain the regularity and selection information for all chunks in this process. */
- chunk_node = H5SL_first(fm->sel_chunks);
- while(chunk_node) {
- chunk_info = (H5D_chunk_info_t *)H5SL_item(chunk_node);
+ chunk_node = H5SL_first(fm->sel_chunks);
+ while (chunk_node) {
+ chunk_info = (H5D_chunk_info_t *)H5SL_item(chunk_node);
io_mode_info[chunk_info->index] = H5D_CHUNK_SELECT_REG; /* this chunk is selected and is "regular" */
- chunk_node = H5SL_next(chunk_node);
+ chunk_node = H5SL_next(chunk_node);
} /* end while */
/* Gather all the information */
H5_CHECK_OVERFLOW(total_chunks, size_t, int)
- if(MPI_SUCCESS != (mpi_code = MPI_Gather(io_mode_info, (int)total_chunks, MPI_BYTE,
- recv_io_mode_info, (int)total_chunks, MPI_BYTE, root, comm)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Gather(io_mode_info, (int)total_chunks, MPI_BYTE, recv_io_mode_info,
+ (int)total_chunks, MPI_BYTE, root, comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Gather failed", mpi_code)
/* Calculate the mode for IO(collective, independent or none) at root process */
- if(mpi_rank == root) {
- size_t nproc;
- unsigned* nproc_per_chunk;
+ if (mpi_rank == root) {
+ size_t nproc;
+ unsigned *nproc_per_chunk;
/* pre-computing: calculate number of processes and
regularity of the selection occupied in each chunk */
- if(NULL == (nproc_per_chunk = (unsigned*)H5MM_calloc(total_chunks * sizeof(unsigned))))
+ if (NULL == (nproc_per_chunk = (unsigned *)H5MM_calloc(total_chunks * sizeof(unsigned))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate nproc_per_chunk buffer")
/* calculating the chunk address */
- if(H5D__chunk_addrmap(io_info, chunk_addr) < 0) {
+ if (H5D__chunk_addrmap(io_info, chunk_addr) < 0) {
H5MM_free(nproc_per_chunk);
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address")
} /* end if */
/* checking for number of process per chunk and regularity of the selection*/
- for(nproc = 0; nproc < (size_t)mpi_size; nproc++) {
+ for (nproc = 0; nproc < (size_t)mpi_size; nproc++) {
uint8_t *tmp_recv_io_mode_info = recv_io_mode_info + (nproc * total_chunks);
/* Calculate the number of process per chunk and adding irregular selection option */
- for(ic = 0; ic < total_chunks; ic++, tmp_recv_io_mode_info++) {
- if(*tmp_recv_io_mode_info != 0) {
+ for (ic = 0; ic < total_chunks; ic++, tmp_recv_io_mode_info++) {
+ if (*tmp_recv_io_mode_info != 0) {
nproc_per_chunk[ic]++;
} /* end if */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/* Calculating MPIO mode for each chunk (collective, independent, none) */
- for(ic = 0; ic < total_chunks; ic++) {
- if(nproc_per_chunk[ic] > MAX(1, threshold_nproc_per_chunk)) {
+ for (ic = 0; ic < total_chunks; ic++) {
+ if (nproc_per_chunk[ic] > MAX(1, threshold_nproc_per_chunk)) {
assign_io_mode[ic] = H5D_CHUNK_IO_MODE_COL;
} /* end if */
- } /* end for */
-
+ } /* end for */
/* merge buffer io_mode info and chunk addr into one */
H5MM_memcpy(mergebuf, assign_io_mode, total_chunks);
@@ -2524,38 +2571,39 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
} /* end if */
/* Broadcasting the MPI_IO option info. and chunk address info. */
- if((sizeof(haddr_t) + 1) * total_chunks > INT_MAX)
+ if ((sizeof(haddr_t) + 1) * total_chunks > INT_MAX)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "result overflow")
- if(MPI_SUCCESS != (mpi_code = MPI_Bcast(mergebuf, (int)((sizeof(haddr_t) + 1) * total_chunks), MPI_BYTE, root, comm)))
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Bcast(mergebuf, (int)((sizeof(haddr_t) + 1) * total_chunks), MPI_BYTE, root, comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_BCast failed", mpi_code)
H5MM_memcpy(assign_io_mode, mergebuf, total_chunks);
H5MM_memcpy(chunk_addr, tempbuf, sizeof(haddr_t) * total_chunks);
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
-{
- hbool_t coll_op = FALSE;
+ {
+ hbool_t coll_op = FALSE;
+
+ for (ic = 0; ic < total_chunks; ic++)
+ if (assign_io_mode[ic] == H5D_CHUNK_IO_MODE_COL) {
+ if (H5CX_test_set_mpio_coll_chunk_multi_ratio_coll(0) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value")
+ coll_op = TRUE;
+ break;
+ } /* end if */
- for(ic = 0; ic < total_chunks; ic++)
- if(assign_io_mode[ic] == H5D_CHUNK_IO_MODE_COL) {
- if(H5CX_test_set_mpio_coll_chunk_multi_ratio_coll(0) < 0)
+ if (!coll_op)
+ if (H5CX_test_set_mpio_coll_chunk_multi_ratio_ind(0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value")
- coll_op = TRUE;
- break;
- } /* end if */
-
- if(!coll_op)
- if(H5CX_test_set_mpio_coll_chunk_multi_ratio_ind(0) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value")
-}
+ }
#endif
done:
- if(io_mode_info)
+ if (io_mode_info)
H5MM_free(io_mode_info);
- if(mergebuf)
+ if (mergebuf)
H5MM_free(mergebuf);
- if(recv_io_mode_info) {
+ if (recv_io_mode_info) {
HDassert(mpi_rank == root);
H5MM_free(recv_io_mode_info);
} /* end if */
@@ -2563,7 +2611,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__obtain_mpio_mode() */
-
/*-------------------------------------------------------------------------
* Function: H5D__construct_filtered_io_info_list
*
@@ -2584,13 +2631,15 @@ done:
*/
static herr_t
H5D__construct_filtered_io_info_list(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- const H5D_chunk_map_t *fm, H5D_filtered_collective_io_info_t **chunk_list, size_t *num_entries)
+ const H5D_chunk_map_t * fm,
+ H5D_filtered_collective_io_info_t **chunk_list, size_t *num_entries)
{
- H5D_filtered_collective_io_info_t *local_info_array = NULL; /* The list of initially selected chunks for this process */
- size_t num_chunks_selected;
- size_t i;
- int mpi_rank;
- herr_t ret_value = SUCCEED;
+ H5D_filtered_collective_io_info_t *local_info_array =
+ NULL; /* The list of initially selected chunks for this process */
+ size_t num_chunks_selected;
+ size_t i;
+ int mpi_rank;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -2607,35 +2656,37 @@ H5D__construct_filtered_io_info_list(const H5D_io_info_t *io_info, const H5D_typ
if ((num_chunks_selected = H5SL_count(fm->sel_chunks))) {
H5D_chunk_info_t *chunk_info;
H5D_chunk_ud_t udata;
- H5SL_node_t *chunk_node;
+ H5SL_node_t * chunk_node;
hsize_t select_npoints;
hssize_t chunk_npoints;
- if(NULL == (local_info_array = (H5D_filtered_collective_io_info_t *) H5MM_malloc(num_chunks_selected * sizeof(H5D_filtered_collective_io_info_t))))
+ if (NULL == (local_info_array = (H5D_filtered_collective_io_info_t *)H5MM_malloc(
+ num_chunks_selected * sizeof(H5D_filtered_collective_io_info_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate local io info array buffer")
chunk_node = H5SL_first(fm->sel_chunks);
- for(i = 0; chunk_node; i++) {
- chunk_info = (H5D_chunk_info_t *) H5SL_item(chunk_node);
+ for (i = 0; chunk_node; i++) {
+ chunk_info = (H5D_chunk_info_t *)H5SL_item(chunk_node);
/* Obtain this chunk's address */
- if(H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0)
+ if (H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
- local_info_array[i].index = chunk_info->index;
- local_info_array[i].chunk_states.chunk_current = local_info_array[i].chunk_states.new_chunk = udata.chunk_block;
- local_info_array[i].num_writers = 0;
+ local_info_array[i].index = chunk_info->index;
+ local_info_array[i].chunk_states.chunk_current = local_info_array[i].chunk_states.new_chunk =
+ udata.chunk_block;
+ local_info_array[i].num_writers = 0;
local_info_array[i].owners.original_owner = local_info_array[i].owners.new_owner = mpi_rank;
- local_info_array[i].buf = NULL;
+ local_info_array[i].buf = NULL;
- local_info_array[i].async_info.num_receive_requests = 0;
- local_info_array[i].async_info.receive_buffer_array = NULL;
+ local_info_array[i].async_info.num_receive_requests = 0;
+ local_info_array[i].async_info.receive_buffer_array = NULL;
local_info_array[i].async_info.receive_requests_array = NULL;
H5MM_memcpy(local_info_array[i].scaled, chunk_info->scaled, sizeof(chunk_info->scaled));
- select_npoints = H5S_GET_SELECT_NPOINTS(chunk_info->mspace);
- local_info_array[i].io_size = (size_t) select_npoints * type_info->src_type_size;
+ select_npoints = H5S_GET_SELECT_NPOINTS(chunk_info->mspace);
+ local_info_array[i].io_size = (size_t)select_npoints * type_info->src_type_size;
/* Currently the full overwrite status of a chunk is only obtained on a per-process
* basis. This means that if the total selection in the chunk, as determined by the combination
@@ -2648,22 +2699,26 @@ H5D__construct_filtered_io_info_list(const H5D_io_info_t *io_info, const H5D_typ
if ((chunk_npoints = H5S_GET_EXTENT_NPOINTS(chunk_info->fspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
local_info_array[i].full_overwrite =
- (local_info_array[i].io_size >= (hsize_t) chunk_npoints * type_info->dst_type_size) ? TRUE : FALSE;
+ (local_info_array[i].io_size >= (hsize_t)chunk_npoints * type_info->dst_type_size) ? TRUE
+ : FALSE;
chunk_node = H5SL_next(chunk_node);
} /* end for */
- } /* end if */
+ } /* end if */
/* Redistribute shared chunks to new owners as necessary */
if (io_info->op_type == H5D_IO_OP_WRITE)
#if MPI_VERSION >= 3
- if (H5D__chunk_redistribute_shared_chunks(io_info, type_info, fm, local_info_array, &num_chunks_selected) < 0)
+ if (H5D__chunk_redistribute_shared_chunks(io_info, type_info, fm, local_info_array,
+ &num_chunks_selected) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to redistribute shared chunks")
#else
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to redistribute shared chunks - MPI version < 3 (MPI_Mprobe and MPI_Imrecv missing)")
+ HGOTO_ERROR(
+ H5E_DATASET, H5E_WRITEERROR, FAIL,
+ "unable to redistribute shared chunks - MPI version < 3 (MPI_Mprobe and MPI_Imrecv missing)")
#endif
- *chunk_list = local_info_array;
+ *chunk_list = local_info_array;
*num_entries = num_chunks_selected;
done:
@@ -2671,7 +2726,7 @@ done:
} /* end H5D__construct_filtered_io_info_list() */
#if MPI_VERSION >= 3
-
+
/*-------------------------------------------------------------------------
* Function: H5D__chunk_redistribute_shared_chunks
*
@@ -2713,23 +2768,27 @@ done:
*/
static herr_t
H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- const H5D_chunk_map_t *fm, H5D_filtered_collective_io_info_t *local_chunk_array, size_t *local_chunk_array_num_entries)
+ const H5D_chunk_map_t * fm,
+ H5D_filtered_collective_io_info_t *local_chunk_array,
+ size_t * local_chunk_array_num_entries)
{
- H5D_filtered_collective_io_info_t *shared_chunks_info_array = NULL; /* The list of all chunks selected in the operation by all processes */
- H5S_sel_iter_t *mem_iter = NULL; /* Memory iterator for H5D__gather_mem */
- unsigned char **mod_data = NULL; /* Array of chunk modification data buffers sent by a process to new chunk owners */
- MPI_Request *send_requests = NULL; /* Array of MPI_Isend chunk modification data send requests */
- MPI_Status *send_statuses = NULL; /* Array of MPI_Isend chunk modification send statuses */
- hbool_t mem_iter_init = FALSE;
- size_t shared_chunks_info_array_num_entries = 0;
- size_t num_send_requests = 0;
- size_t *num_assigned_chunks_array = NULL;
- size_t i, last_assigned_idx;
- int *send_counts = NULL;
- int *send_displacements = NULL;
- int scatter_recvcount_int;
- int mpi_rank, mpi_size, mpi_code;
- herr_t ret_value = SUCCEED;
+ H5D_filtered_collective_io_info_t *shared_chunks_info_array =
+ NULL; /* The list of all chunks selected in the operation by all processes */
+ H5S_sel_iter_t *mem_iter = NULL; /* Memory iterator for H5D__gather_mem */
+ unsigned char **mod_data =
+ NULL; /* Array of chunk modification data buffers sent by a process to new chunk owners */
+ MPI_Request *send_requests = NULL; /* Array of MPI_Isend chunk modification data send requests */
+ MPI_Status * send_statuses = NULL; /* Array of MPI_Isend chunk modification send statuses */
+ hbool_t mem_iter_init = FALSE;
+ size_t shared_chunks_info_array_num_entries = 0;
+ size_t num_send_requests = 0;
+ size_t * num_assigned_chunks_array = NULL;
+ size_t i, last_assigned_idx;
+ int * send_counts = NULL;
+ int * send_displacements = NULL;
+ int scatter_recvcount_int;
+ int mpi_rank, mpi_size, mpi_code;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -2747,58 +2806,63 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
H5CX_set_libver_bounds(NULL);
if (*local_chunk_array_num_entries)
- if (NULL == (send_requests = (MPI_Request *) H5MM_malloc(*local_chunk_array_num_entries * sizeof(MPI_Request))))
+ if (NULL == (send_requests =
+ (MPI_Request *)H5MM_malloc(*local_chunk_array_num_entries * sizeof(MPI_Request))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate send requests buffer")
- if (NULL == (mem_iter = (H5S_sel_iter_t *) H5MM_malloc(sizeof(H5S_sel_iter_t))))
+ if (NULL == (mem_iter = (H5S_sel_iter_t *)H5MM_malloc(sizeof(H5S_sel_iter_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate memory iterator")
- /* Gather every rank's list of chunks to rank 0 to allow it to perform the redistribution operation. After this
- * call, the gathered list will initially be sorted in increasing order of chunk offset in the file.
+ /* Gather every rank's list of chunks to rank 0 to allow it to perform the redistribution operation. After
+ * this call, the gathered list will initially be sorted in increasing order of chunk offset in the file.
*/
- if (H5D__mpio_array_gatherv(local_chunk_array, *local_chunk_array_num_entries, sizeof(H5D_filtered_collective_io_info_t),
- (void **) &shared_chunks_info_array, &shared_chunks_info_array_num_entries, false, 0,
- io_info->comm, H5D__cmp_filtered_collective_io_info_entry) < 0)
+ if (H5D__mpio_array_gatherv(local_chunk_array, *local_chunk_array_num_entries,
+ sizeof(H5D_filtered_collective_io_info_t), (void **)&shared_chunks_info_array,
+ &shared_chunks_info_array_num_entries, false, 0, io_info->comm,
+ H5D__cmp_filtered_collective_io_info_entry) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, "couldn't gather array")
/* Rank 0 redistributes any shared chunks to new owners as necessary */
if (mpi_rank == 0) {
- if (NULL == (send_counts = (int *) H5MM_calloc((size_t) mpi_size * sizeof(int))))
+ if (NULL == (send_counts = (int *)H5MM_calloc((size_t)mpi_size * sizeof(int))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate send counts buffer")
- if (NULL == (send_displacements = (int *) H5MM_malloc((size_t) mpi_size * sizeof(int))))
+ if (NULL == (send_displacements = (int *)H5MM_malloc((size_t)mpi_size * sizeof(int))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate send displacements buffer")
- if (NULL == (num_assigned_chunks_array = (size_t *) H5MM_calloc((size_t) mpi_size * sizeof(size_t))))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate number of assigned chunks array")
+ if (NULL == (num_assigned_chunks_array = (size_t *)H5MM_calloc((size_t)mpi_size * sizeof(size_t))))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL,
+ "unable to allocate number of assigned chunks array")
for (i = 0; i < shared_chunks_info_array_num_entries;) {
H5D_filtered_collective_io_info_t chunk_entry;
- haddr_t last_seen_addr = shared_chunks_info_array[i].chunk_states.chunk_current.offset;
- size_t set_begin_index = i;
- size_t num_writers = 0;
- int new_chunk_owner = shared_chunks_info_array[i].owners.original_owner;
+ haddr_t last_seen_addr = shared_chunks_info_array[i].chunk_states.chunk_current.offset;
+ size_t set_begin_index = i;
+ size_t num_writers = 0;
+ int new_chunk_owner = shared_chunks_info_array[i].owners.original_owner;
/* Process each set of duplicate entries caused by another process writing to the same chunk */
do {
chunk_entry = shared_chunks_info_array[i];
- send_counts[chunk_entry.owners.original_owner] += (int) sizeof(chunk_entry);
+ send_counts[chunk_entry.owners.original_owner] += (int)sizeof(chunk_entry);
/* The new owner of the chunk is determined by the process
* writing to the chunk which currently has the least amount
* of chunks assigned to it
*/
- if (num_assigned_chunks_array[chunk_entry.owners.original_owner] < num_assigned_chunks_array[new_chunk_owner])
+ if (num_assigned_chunks_array[chunk_entry.owners.original_owner] <
+ num_assigned_chunks_array[new_chunk_owner])
new_chunk_owner = chunk_entry.owners.original_owner;
num_writers++;
- } while (++i < shared_chunks_info_array_num_entries && shared_chunks_info_array[i].chunk_states.chunk_current.offset == last_seen_addr);
+ } while (++i < shared_chunks_info_array_num_entries &&
+ shared_chunks_info_array[i].chunk_states.chunk_current.offset == last_seen_addr);
/* Set all of the chunk entries' "new_owner" fields */
for (; set_begin_index < i; set_begin_index++) {
shared_chunks_info_array[set_begin_index].owners.new_owner = new_chunk_owner;
- shared_chunks_info_array[set_begin_index].num_writers = num_writers;
+ shared_chunks_info_array[set_begin_index].num_writers = num_writers;
} /* end for */
num_assigned_chunks_array[new_chunk_owner]++;
@@ -2807,19 +2871,22 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
/* Sort the new list in order of previous owner so that each original owner of a chunk
* entry gets that entry back, with the possibly newly-modified "new_owner" field
*/
- if(shared_chunks_info_array_num_entries > 1)
+ if (shared_chunks_info_array_num_entries > 1)
HDqsort(shared_chunks_info_array, shared_chunks_info_array_num_entries,
- sizeof(H5D_filtered_collective_io_info_t), H5D__cmp_filtered_collective_io_info_entry_owner);
+ sizeof(H5D_filtered_collective_io_info_t),
+ H5D__cmp_filtered_collective_io_info_entry_owner);
send_displacements[0] = 0;
- for (i = 1; i < (size_t) mpi_size; i++)
+ for (i = 1; i < (size_t)mpi_size; i++)
send_displacements[i] = send_displacements[i - 1] + send_counts[i - 1];
} /* end if */
/* Scatter the segments of the list back to each process */
- H5_CHECKED_ASSIGN(scatter_recvcount_int, int, *local_chunk_array_num_entries * sizeof(H5D_filtered_collective_io_info_t), size_t);
- if (MPI_SUCCESS != (mpi_code = MPI_Scatterv(shared_chunks_info_array, send_counts, send_displacements,
- MPI_BYTE, local_chunk_array, scatter_recvcount_int, MPI_BYTE, 0, io_info->comm)))
+ H5_CHECKED_ASSIGN(scatter_recvcount_int, int,
+ *local_chunk_array_num_entries * sizeof(H5D_filtered_collective_io_info_t), size_t);
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Scatterv(shared_chunks_info_array, send_counts, send_displacements, MPI_BYTE,
+ local_chunk_array, scatter_recvcount_int, MPI_BYTE, 0, io_info->comm)))
HMPI_GOTO_ERROR(FAIL, "unable to scatter shared chunks info buffer", mpi_code)
if (shared_chunks_info_array) {
@@ -2833,7 +2900,8 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
* chunks it is assigned, in order to avoid potential deadlocking issues.
*/
if (*local_chunk_array_num_entries)
- if (NULL == (mod_data = (unsigned char **) H5MM_malloc(*local_chunk_array_num_entries * sizeof(unsigned char *))))
+ if (NULL == (mod_data = (unsigned char **)H5MM_malloc(*local_chunk_array_num_entries *
+ sizeof(unsigned char *))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate modification data buffer array")
for (i = 0, last_assigned_idx = 0; i < *local_chunk_array_num_entries; i++) {
@@ -2841,50 +2909,54 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
if (mpi_rank != chunk_entry->owners.new_owner) {
H5D_chunk_info_t *chunk_info = NULL;
- unsigned char *mod_data_p = NULL;
+ unsigned char * mod_data_p = NULL;
hsize_t iter_nelmts;
size_t mod_data_size;
/* Look up the chunk and get its file and memory dataspaces */
- if(NULL == (chunk_info = (H5D_chunk_info_t *) H5SL_search(fm->sel_chunks, &chunk_entry->index)))
+ if (NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_search(fm->sel_chunks, &chunk_entry->index)))
HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, FAIL, "can't locate chunk in skip list")
/* Determine size of serialized chunk file dataspace, plus the size of
* the data being written
*/
- if(H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0)
+ if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to get encoded dataspace size")
iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace);
H5_CHECK_OVERFLOW(iter_nelmts, hsize_t, size_t);
- mod_data_size += (size_t) iter_nelmts * type_info->src_type_size;
+ mod_data_size += (size_t)iter_nelmts * type_info->src_type_size;
- if(NULL == (mod_data[num_send_requests] = (unsigned char *) H5MM_malloc(mod_data_size)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk modification send buffer")
+ if (NULL == (mod_data[num_send_requests] = (unsigned char *)H5MM_malloc(mod_data_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL,
+ "couldn't allocate chunk modification send buffer")
/* Serialize the chunk's file dataspace into the buffer */
mod_data_p = mod_data[num_send_requests];
- if(H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0)
+ if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to encode dataspace")
/* Initialize iterator for memory selection */
- if(H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size, 0) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
+ if (H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size, 0) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to initialize memory selection information")
mem_iter_init = TRUE;
/* Collect the modification data into the buffer */
- if(0 == H5D__gather_mem(io_info->u.wbuf, mem_iter, (size_t)iter_nelmts, mod_data_p))
+ if (0 == H5D__gather_mem(io_info->u.wbuf, mem_iter, (size_t)iter_nelmts, mod_data_p))
HGOTO_ERROR(H5E_IO, H5E_CANTGATHER, FAIL, "couldn't gather from write buffer")
/* Send modification data to new owner */
H5_CHECK_OVERFLOW(mod_data_size, size_t, int)
H5_CHECK_OVERFLOW(chunk_entry->index, hsize_t, int)
- if(MPI_SUCCESS != (mpi_code = MPI_Isend(mod_data[num_send_requests], (int) mod_data_size, MPI_BYTE,
- chunk_entry->owners.new_owner, (int) chunk_entry->index, io_info->comm, &send_requests[num_send_requests])))
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Isend(mod_data[num_send_requests], (int)mod_data_size, MPI_BYTE,
+ chunk_entry->owners.new_owner, (int)chunk_entry->index, io_info->comm,
+ &send_requests[num_send_requests])))
HMPI_GOTO_ERROR(FAIL, "MPI_Isend failed", mpi_code)
- if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release memory selection iterator")
mem_iter_init = FALSE;
@@ -2897,11 +2969,14 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
MPI_Status status;
size_t j;
- chunk_entry->async_info.num_receive_requests = (int) chunk_entry->num_writers - 1;
- if (NULL == (chunk_entry->async_info.receive_requests_array = (MPI_Request *) H5MM_malloc((size_t) chunk_entry->async_info.num_receive_requests * sizeof(MPI_Request))))
+ chunk_entry->async_info.num_receive_requests = (int)chunk_entry->num_writers - 1;
+ if (NULL == (chunk_entry->async_info.receive_requests_array = (MPI_Request *)H5MM_malloc(
+ (size_t)chunk_entry->async_info.num_receive_requests * sizeof(MPI_Request))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate async requests array")
- if (NULL == (chunk_entry->async_info.receive_buffer_array = (unsigned char **) H5MM_malloc((size_t) chunk_entry->async_info.num_receive_requests * sizeof(unsigned char *))))
+ if (NULL ==
+ (chunk_entry->async_info.receive_buffer_array = (unsigned char **)H5MM_malloc(
+ (size_t)chunk_entry->async_info.num_receive_requests * sizeof(unsigned char *))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate async receive buffers")
for (j = 0; j < chunk_entry->num_writers - 1; j++) {
@@ -2911,35 +2986,39 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty
* from the receive queue in the process and allocating that much memory
* for the asynchronous receive
*/
- if (MPI_SUCCESS != (mpi_code = MPI_Mprobe(MPI_ANY_SOURCE, (int) chunk_entry->index, io_info->comm, &message, &status)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Mprobe(MPI_ANY_SOURCE, (int)chunk_entry->index,
+ io_info->comm, &message, &status)))
HMPI_GOTO_ERROR(FAIL, "MPI_Mprobe failed", mpi_code)
if (MPI_SUCCESS != (mpi_code = MPI_Get_count(&status, MPI_BYTE, &count)))
HMPI_GOTO_ERROR(FAIL, "MPI_Get_count failed", mpi_code)
HDassert(count >= 0);
- if (NULL == (chunk_entry->async_info.receive_buffer_array[j] = (unsigned char *) H5MM_malloc((size_t) count * sizeof(char *))))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate modification data receive buffer")
-
- if (MPI_SUCCESS != (mpi_code = MPI_Imrecv(chunk_entry->async_info.receive_buffer_array[j], count, MPI_BYTE,
- &message, &chunk_entry->async_info.receive_requests_array[j])))
+ if (NULL == (chunk_entry->async_info.receive_buffer_array[j] =
+ (unsigned char *)H5MM_malloc((size_t)count * sizeof(char *))))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL,
+ "unable to allocate modification data receive buffer")
+
+ if (MPI_SUCCESS != (mpi_code = MPI_Imrecv(
+ chunk_entry->async_info.receive_buffer_array[j], count, MPI_BYTE,
+ &message, &chunk_entry->async_info.receive_requests_array[j])))
HMPI_GOTO_ERROR(FAIL, "MPI_Imrecv failed", mpi_code)
} /* end for */
- } /* end if */
+ } /* end if */
local_chunk_array[last_assigned_idx++] = local_chunk_array[i];
} /* end else */
- } /* end for */
+ } /* end for */
*local_chunk_array_num_entries = last_assigned_idx;
/* Wait for all async send requests to complete before returning */
if (num_send_requests) {
- if (NULL == (send_statuses = (MPI_Status *) H5MM_malloc(num_send_requests * sizeof(MPI_Status))))
+ if (NULL == (send_statuses = (MPI_Status *)H5MM_malloc(num_send_requests * sizeof(MPI_Status))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate send statuses buffer")
H5_CHECK_OVERFLOW(num_send_requests, size_t, int);
- if (MPI_SUCCESS != (mpi_code = MPI_Waitall((int) num_send_requests, send_requests, send_statuses)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Waitall((int)num_send_requests, send_requests, send_statuses)))
HMPI_GOTO_ERROR(FAIL, "MPI_Waitall failed", mpi_code)
} /* end if */
@@ -2975,7 +3054,6 @@ done:
} /* end H5D__chunk_redistribute_shared_chunks() */
#endif
-
/*-------------------------------------------------------------------------
* Function: H5D__mpio_filtered_collective_write_type
*
@@ -2992,14 +3070,14 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__mpio_filtered_collective_write_type(H5D_filtered_collective_io_info_t *chunk_list,
- size_t num_entries, MPI_Datatype *new_mem_type, hbool_t *mem_type_derived,
- MPI_Datatype *new_file_type, hbool_t *file_type_derived)
+H5D__mpio_filtered_collective_write_type(H5D_filtered_collective_io_info_t *chunk_list, size_t num_entries,
+ MPI_Datatype *new_mem_type, hbool_t *mem_type_derived,
+ MPI_Datatype *new_file_type, hbool_t *file_type_derived)
{
- MPI_Aint *write_buf_array = NULL; /* Relative displacements of filtered chunk data buffers */
+ MPI_Aint *write_buf_array = NULL; /* Relative displacements of filtered chunk data buffers */
MPI_Aint *file_offset_array = NULL; /* Chunk offsets in the file */
- int *length_array = NULL; /* Filtered Chunk lengths */
- herr_t ret_value = SUCCEED;
+ int * length_array = NULL; /* Filtered Chunk lengths */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -3012,40 +3090,46 @@ H5D__mpio_filtered_collective_write_type(H5D_filtered_collective_io_info_t *chun
if (num_entries > 0) {
size_t i;
int mpi_code;
- void *base_buf;
+ void * base_buf;
H5_CHECK_OVERFLOW(num_entries, size_t, int);
/* Allocate arrays */
- if (NULL == (length_array = (int *) H5MM_malloc((size_t) num_entries * sizeof(int))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for filtered collective write length array")
- if (NULL == (write_buf_array = (MPI_Aint *) H5MM_malloc((size_t) num_entries * sizeof(MPI_Aint))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for filtered collective write buf length array")
- if (NULL == (file_offset_array = (MPI_Aint *) H5MM_malloc((size_t) num_entries * sizeof(MPI_Aint))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for collective write offset array")
+ if (NULL == (length_array = (int *)H5MM_malloc((size_t)num_entries * sizeof(int))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for filtered collective write length array")
+ if (NULL == (write_buf_array = (MPI_Aint *)H5MM_malloc((size_t)num_entries * sizeof(MPI_Aint))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for filtered collective write buf length array")
+ if (NULL == (file_offset_array = (MPI_Aint *)H5MM_malloc((size_t)num_entries * sizeof(MPI_Aint))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for collective write offset array")
/* Ensure the list is sorted in ascending order of offset in the file */
- HDqsort(chunk_list, num_entries, sizeof(H5D_filtered_collective_io_info_t), H5D__cmp_filtered_collective_io_info_entry);
+ HDqsort(chunk_list, num_entries, sizeof(H5D_filtered_collective_io_info_t),
+ H5D__cmp_filtered_collective_io_info_entry);
base_buf = chunk_list[0].buf;
for (i = 0; i < num_entries; i++) {
/* Set up the offset in the file, the length of the chunk data, and the relative
* displacement of the chunk data write buffer
*/
- file_offset_array[i] = (MPI_Aint) chunk_list[i].chunk_states.new_chunk.offset;
- length_array[i] = (int) chunk_list[i].chunk_states.new_chunk.length;
- write_buf_array[i] = (MPI_Aint) chunk_list[i].buf - (MPI_Aint) base_buf;
+ file_offset_array[i] = (MPI_Aint)chunk_list[i].chunk_states.new_chunk.offset;
+ length_array[i] = (int)chunk_list[i].chunk_states.new_chunk.length;
+ write_buf_array[i] = (MPI_Aint)chunk_list[i].buf - (MPI_Aint)base_buf;
} /* end for */
/* Create memory MPI type */
- if (MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int) num_entries, length_array, write_buf_array, MPI_BYTE, new_mem_type)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)num_entries, length_array,
+ write_buf_array, MPI_BYTE, new_mem_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
*mem_type_derived = TRUE;
if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_mem_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
/* Create file MPI type */
- if (MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int) num_entries, length_array, file_offset_array, MPI_BYTE, new_file_type)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)num_entries, length_array,
+ file_offset_array, MPI_BYTE, new_file_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
*file_type_derived = TRUE;
if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_file_type)))
@@ -3053,17 +3137,16 @@ H5D__mpio_filtered_collective_write_type(H5D_filtered_collective_io_info_t *chun
} /* end if */
done:
- if(write_buf_array)
+ if (write_buf_array)
H5MM_free(write_buf_array);
- if(file_offset_array)
+ if (file_offset_array)
H5MM_free(file_offset_array);
- if(length_array)
+ if (length_array)
H5MM_free(length_array);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__mpio_filtered_collective_write_type() */
-
/*-------------------------------------------------------------------------
* Function: H5D__filtered_collective_chunk_entry_io
*
@@ -3081,27 +3164,28 @@ done:
*/
static herr_t
H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk_entry,
- const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, const H5D_chunk_map_t *fm)
+ const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ const H5D_chunk_map_t *fm)
{
H5D_chunk_info_t *chunk_info = NULL;
- H5S_sel_iter_t *mem_iter = NULL; /* Memory iterator for H5D__scatter_mem/H5D__gather_mem */
- H5S_sel_iter_t *file_iter = NULL;
- H5Z_EDC_t err_detect; /* Error detection info */
- H5Z_cb_t filter_cb; /* I/O filter callback function */
+ H5S_sel_iter_t * mem_iter = NULL; /* Memory iterator for H5D__scatter_mem/H5D__gather_mem */
+ H5S_sel_iter_t * file_iter = NULL;
+ H5Z_EDC_t err_detect; /* Error detection info */
+ H5Z_cb_t filter_cb; /* I/O filter callback function */
unsigned filter_mask = 0;
- hsize_t iter_nelmts; /* Number of points to iterate over for the chunk IO operation */
+ hsize_t iter_nelmts; /* Number of points to iterate over for the chunk IO operation */
hssize_t extent_npoints;
hsize_t true_chunk_size;
- hbool_t mem_iter_init = FALSE;
+ hbool_t mem_iter_init = FALSE;
hbool_t file_iter_init = FALSE;
size_t buf_size;
size_t i;
- H5S_t *dataspace = NULL; /* Other process' dataspace for the chunk */
- void *tmp_gath_buf = NULL; /* Temporary gather buffer to gather into from application buffer
+ H5S_t * dataspace = NULL; /* Other process' dataspace for the chunk */
+ void * tmp_gath_buf = NULL; /* Temporary gather buffer to gather into from application buffer
before scattering out to the chunk data buffer (when writing data),
or vice versa (when reading data) */
- int mpi_code;
- herr_t ret_value = SUCCEED;
+ int mpi_code;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -3111,18 +3195,18 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
HDassert(fm);
/* Retrieve filter settings from API context */
- if(H5CX_get_err_detect(&err_detect) < 0)
+ if (H5CX_get_err_detect(&err_detect) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get error detection info")
- if(H5CX_get_filter_cb(&filter_cb) < 0)
+ if (H5CX_get_filter_cb(&filter_cb) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O filter callback function")
/* Look up the chunk and get its file and memory dataspaces */
- if (NULL == (chunk_info = (H5D_chunk_info_t *) H5SL_search(fm->sel_chunks, &chunk_entry->index)))
+ if (NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_search(fm->sel_chunks, &chunk_entry->index)))
HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, FAIL, "can't locate chunk in skip list")
if ((extent_npoints = H5S_GET_EXTENT_NPOINTS(chunk_info->fspace)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
- true_chunk_size = (hsize_t) extent_npoints * type_info->src_type_size;
+ true_chunk_size = (hsize_t)extent_npoints * type_info->src_type_size;
/* If the size of the filtered chunk is larger than the number of points in the
* chunk file space extent times the datatype size, allocate enough space to hold the
@@ -3137,7 +3221,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
/* If this is not a full chunk overwrite or this is a read operation, the chunk must be
* read from the file and unfiltered.
*/
- if(!chunk_entry->full_overwrite || io_info->op_type == H5D_IO_OP_READ) {
+ if (!chunk_entry->full_overwrite || io_info->op_type == H5D_IO_OP_READ) {
H5FD_mpio_xfer_t xfer_mode; /* Parallel transfer for this request */
chunk_entry->chunk_states.new_chunk.length = chunk_entry->chunk_states.chunk_current.length;
@@ -3147,24 +3231,25 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
* this should be refactored to use collective chunk reads - JTH */
/* Get the original state of parallel I/O transfer mode */
- if(H5CX_get_io_xfer_mode(&xfer_mode) < 0)
+ if (H5CX_get_io_xfer_mode(&xfer_mode) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode")
/* Change the xfer_mode to independent for handling the I/O */
- if(H5CX_set_io_xfer_mode(H5FD_MPIO_INDEPENDENT) < 0)
+ if (H5CX_set_io_xfer_mode(H5FD_MPIO_INDEPENDENT) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode")
- if(H5F_shared_block_read(io_info->f_sh, H5FD_MEM_DRAW, chunk_entry->chunk_states.chunk_current.offset,
- chunk_entry->chunk_states.new_chunk.length, chunk_entry->buf) < 0)
+ if (H5F_shared_block_read(io_info->f_sh, H5FD_MEM_DRAW,
+ chunk_entry->chunk_states.chunk_current.offset,
+ chunk_entry->chunk_states.new_chunk.length, chunk_entry->buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read raw data chunk")
/* Return to the original I/O transfer mode setting */
- if(H5CX_set_io_xfer_mode(xfer_mode) < 0)
+ if (H5CX_set_io_xfer_mode(xfer_mode) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode")
- if(H5Z_pipeline(&io_info->dset->shared->dcpl_cache.pline, H5Z_FLAG_REVERSE,
- &filter_mask, err_detect, filter_cb, (size_t *)&chunk_entry->chunk_states.new_chunk.length,
- &buf_size, &chunk_entry->buf) < 0)
+ if (H5Z_pipeline(&io_info->dset->shared->dcpl_cache.pline, H5Z_FLAG_REVERSE, &filter_mask, err_detect,
+ filter_cb, (size_t *)&chunk_entry->chunk_states.new_chunk.length, &buf_size,
+ &chunk_entry->buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFILTER, FAIL, "couldn't unfilter chunk for modifying")
} /* end if */
else {
@@ -3172,10 +3257,10 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
} /* end else */
/* Initialize iterator for memory selection */
- if (NULL == (mem_iter = (H5S_sel_iter_t *) H5MM_malloc(sizeof(H5S_sel_iter_t))))
+ if (NULL == (mem_iter = (H5S_sel_iter_t *)H5MM_malloc(sizeof(H5S_sel_iter_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate memory iterator")
- if(H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size, 0) < 0)
+ if (H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE;
@@ -3185,26 +3270,27 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
* from the current process, then apply any modifications from other processes. Finally,
* filter the newly-updated chunk.
*/
- switch(io_info->op_type) {
+ switch (io_info->op_type) {
case H5D_IO_OP_READ:
- if(NULL == (file_iter = (H5S_sel_iter_t *) H5MM_malloc(sizeof(H5S_sel_iter_t))))
+ if (NULL == (file_iter = (H5S_sel_iter_t *)H5MM_malloc(sizeof(H5S_sel_iter_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate file iterator")
- if(H5S_select_iter_init(file_iter, chunk_info->fspace, type_info->src_type_size, 0) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
+ if (H5S_select_iter_init(file_iter, chunk_info->fspace, type_info->src_type_size, 0) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to initialize memory selection information")
file_iter_init = TRUE;
iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace);
- if(NULL == (tmp_gath_buf = H5MM_malloc(iter_nelmts * type_info->src_type_size)))
+ if (NULL == (tmp_gath_buf = H5MM_malloc(iter_nelmts * type_info->src_type_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer")
- if(!H5D__gather_mem(chunk_entry->buf, file_iter, (size_t) iter_nelmts, tmp_gath_buf))
+ if (!H5D__gather_mem(chunk_entry->buf, file_iter, (size_t)iter_nelmts, tmp_gath_buf))
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "couldn't gather from chunk buffer")
iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace);
- if(H5D__scatter_mem(tmp_gath_buf, mem_iter, (size_t) iter_nelmts, io_info->u.rbuf) < 0)
+ if (H5D__scatter_mem(tmp_gath_buf, mem_iter, (size_t)iter_nelmts, io_info->u.rbuf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to read buffer")
break;
@@ -3212,20 +3298,21 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
case H5D_IO_OP_WRITE:
iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace);
- if(NULL == (tmp_gath_buf = H5MM_malloc(iter_nelmts * type_info->src_type_size)))
+ if (NULL == (tmp_gath_buf = H5MM_malloc(iter_nelmts * type_info->src_type_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer")
/* Gather modification data from the application write buffer into a temporary buffer */
- if(0 == H5D__gather_mem(io_info->u.wbuf, mem_iter, (size_t) iter_nelmts, tmp_gath_buf))
+ if (0 == H5D__gather_mem(io_info->u.wbuf, mem_iter, (size_t)iter_nelmts, tmp_gath_buf))
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "couldn't gather from write buffer")
- if(H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator")
mem_iter_init = FALSE;
/* Initialize iterator for file selection */
- if(H5S_select_iter_init(mem_iter, chunk_info->fspace, type_info->dst_type_size, 0) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
+ if (H5S_select_iter_init(mem_iter, chunk_info->fspace, type_info->dst_type_size, 0) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to initialize file selection information")
mem_iter_init = TRUE;
iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace);
@@ -3233,43 +3320,45 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
/* Scatter the owner's modification data into the chunk data buffer according to
* the file space.
*/
- if(H5D__scatter_mem(tmp_gath_buf, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0)
+ if (H5D__scatter_mem(tmp_gath_buf, mem_iter, (size_t)iter_nelmts, chunk_entry->buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to chunk data buffer")
- if(H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator")
mem_iter_init = FALSE;
- if(MPI_SUCCESS != (mpi_code = MPI_Waitall(chunk_entry->async_info.num_receive_requests,
- chunk_entry->async_info.receive_requests_array, MPI_STATUSES_IGNORE)))
+ if (MPI_SUCCESS !=
+ (mpi_code = MPI_Waitall(chunk_entry->async_info.num_receive_requests,
+ chunk_entry->async_info.receive_requests_array, MPI_STATUSES_IGNORE)))
HMPI_GOTO_ERROR(FAIL, "MPI_Waitall failed", mpi_code)
/* For each asynchronous receive call previously posted, receive the chunk modification
* buffer from another rank and update the chunk data
*/
- for(i = 0; i < (size_t) chunk_entry->async_info.num_receive_requests; i++) {
+ for (i = 0; i < (size_t)chunk_entry->async_info.num_receive_requests; i++) {
const unsigned char *mod_data_p;
/* Decode the process' chunk file dataspace */
mod_data_p = chunk_entry->async_info.receive_buffer_array[i];
- if(NULL == (dataspace = H5S_decode(&mod_data_p)))
+ if (NULL == (dataspace = H5S_decode(&mod_data_p)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTDECODE, FAIL, "unable to decode dataspace")
- if(H5S_select_iter_init(mem_iter, dataspace, type_info->dst_type_size, 0) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
+ if (H5S_select_iter_init(mem_iter, dataspace, type_info->dst_type_size, 0) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to initialize memory selection information")
mem_iter_init = TRUE;
iter_nelmts = H5S_GET_SELECT_NPOINTS(dataspace);
/* Update the chunk data with the received modification data */
- if(H5D__scatter_mem(mod_data_p, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0)
+ if (H5D__scatter_mem(mod_data_p, mem_iter, (size_t)iter_nelmts, chunk_entry->buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't scatter to write buffer")
- if(H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator")
mem_iter_init = FALSE;
- if(dataspace) {
- if(H5S_close(dataspace) < 0)
+ if (dataspace) {
+ if (H5S_close(dataspace) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
dataspace = NULL;
}
@@ -3277,14 +3366,14 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
} /* end for */
/* Filter the chunk */
- if(H5Z_pipeline(&io_info->dset->shared->dcpl_cache.pline, 0, &filter_mask,
- err_detect, filter_cb, (size_t *)&chunk_entry->chunk_states.new_chunk.length,
- &buf_size, &chunk_entry->buf) < 0)
+ if (H5Z_pipeline(&io_info->dset->shared->dcpl_cache.pline, 0, &filter_mask, err_detect, filter_cb,
+ (size_t *)&chunk_entry->chunk_states.new_chunk.length, &buf_size,
+ &chunk_entry->buf) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "output pipeline failed")
#if H5_SIZEOF_SIZE_T > 4
/* Check for the chunk expanding too much to encode in a 32-bit value */
- if (chunk_entry->chunk_states.new_chunk.length > ((size_t) 0xffffffff))
+ if (chunk_entry->chunk_states.new_chunk.length > ((size_t)0xffffffff))
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length")
#endif
break;
@@ -3314,5 +3403,4 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__filtered_collective_chunk_entry_io() */
-#endif /* H5_HAVE_PARALLEL */
-
+#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Dnone.c b/src/H5Dnone.c
index 4622c84..82fbffb 100644
--- a/src/H5Dnone.c
+++ b/src/H5Dnone.c
@@ -28,51 +28,43 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5MFprivate.h" /* File space management */
-#include "H5VMprivate.h" /* Vector functions */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File space management */
+#include "H5VMprivate.h" /* Vector functions */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
/* Non Index chunking I/O ops */
-static herr_t H5D__none_idx_create(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__none_idx_create(const H5D_chk_idx_info_t *idx_info);
static hbool_t H5D__none_idx_is_space_alloc(const H5O_storage_chunk_t *storage);
-static herr_t H5D__none_idx_get_addr(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_ud_t *udata);
-static int H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_cb_func_t chunk_cb, void *chunk_udata);
-static herr_t H5D__none_idx_remove(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_common_ud_t *udata);
-static herr_t H5D__none_idx_delete(const H5D_chk_idx_info_t *idx_info);
-static herr_t H5D__none_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
- const H5D_chk_idx_info_t *idx_info_dst);
-static herr_t H5D__none_idx_size(const H5D_chk_idx_info_t *idx_info,
- hsize_t *size);
-static herr_t H5D__none_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
-static herr_t H5D__none_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream);
-
+static herr_t H5D__none_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata);
+static int H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb,
+ void *chunk_udata);
+static herr_t H5D__none_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata);
+static herr_t H5D__none_idx_delete(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__none_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+ const H5D_chk_idx_info_t *idx_info_dst);
+static herr_t H5D__none_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size);
+static herr_t H5D__none_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
+static herr_t H5D__none_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream);
/*********************/
/* Package Variables */
@@ -80,36 +72,32 @@ static herr_t H5D__none_idx_dump(const H5O_storage_chunk_t *storage, FILE *strea
/* Non Index chunk I/O ops */
const H5D_chunk_ops_t H5D_COPS_NONE[1] = {{
- FALSE, /* Non-indexed chunking don't current support SWMR access */
- NULL, /* init */
- H5D__none_idx_create, /* create */
- H5D__none_idx_is_space_alloc, /* is_space_alloc */
- NULL, /* insert */
- H5D__none_idx_get_addr, /* get_addr */
- NULL, /* resize */
- H5D__none_idx_iterate, /* iterate */
- H5D__none_idx_remove, /* remove */
- H5D__none_idx_delete, /* delete */
- H5D__none_idx_copy_setup, /* copy_setup */
- NULL, /* copy_shutdown */
- H5D__none_idx_size, /* size */
- H5D__none_idx_reset, /* reset */
- H5D__none_idx_dump, /* dump */
- NULL /* dest */
+ FALSE, /* Non-indexed chunking don't current support SWMR access */
+ NULL, /* init */
+ H5D__none_idx_create, /* create */
+ H5D__none_idx_is_space_alloc, /* is_space_alloc */
+ NULL, /* insert */
+ H5D__none_idx_get_addr, /* get_addr */
+ NULL, /* resize */
+ H5D__none_idx_iterate, /* iterate */
+ H5D__none_idx_remove, /* remove */
+ H5D__none_idx_delete, /* delete */
+ H5D__none_idx_copy_setup, /* copy_setup */
+ NULL, /* copy_shutdown */
+ H5D__none_idx_size, /* size */
+ H5D__none_idx_reset, /* reset */
+ H5D__none_idx_dump, /* dump */
+ NULL /* dest */
}};
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_create
*
@@ -125,9 +113,9 @@ const H5D_chunk_ops_t H5D_COPS_NONE[1] = {{
static herr_t
H5D__none_idx_create(const H5D_chk_idx_info_t *idx_info)
{
- hsize_t nbytes; /* Total size of dataset chunks */
- haddr_t addr; /* The address of dataset chunks */
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t nbytes; /* Total size of dataset chunks */
+ haddr_t addr; /* The address of dataset chunks */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -139,15 +127,15 @@ H5D__none_idx_create(const H5D_chk_idx_info_t *idx_info)
HDassert(idx_info->layout);
HDassert(idx_info->storage);
HDassert(idx_info->layout->max_nchunks);
- HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); /* address of data shouldn't be defined */
+ HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); /* address of data shouldn't be defined */
/* Calculate size of max dataset chunks */
nbytes = idx_info->layout->max_nchunks * idx_info->layout->size;
/* Allocate space for max dataset chunks */
addr = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, nbytes);
- if(!H5F_addr_defined(addr))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed")
+ if (!H5F_addr_defined(addr))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed")
/* This is the address of the dataset chunks */
idx_info->storage->idx_addr = addr;
@@ -156,7 +144,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__none_idx_create() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_is_space_alloc
*
@@ -179,7 +166,6 @@ H5D__none_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr))
} /* end H5D__none_idx_is_space_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_get_addr
*
@@ -208,19 +194,19 @@ H5D__none_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata
HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
/* Calculate the index of this chunk */
- udata->chunk_idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks, udata->common.scaled);
+ udata->chunk_idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks,
+ udata->common.scaled);
/* Calculate the address of the chunk */
udata->chunk_block.offset = idx_info->storage->idx_addr + udata->chunk_idx * idx_info->layout->size;
/* Update the other (constant) information for the chunk */
udata->chunk_block.length = idx_info->layout->size;
- udata->filter_mask = 0;
+ udata->filter_mask = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__none_idx_get_addr() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_iterate
*
@@ -234,15 +220,14 @@ H5D__none_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata
*-------------------------------------------------------------------------
*/
static int
-H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
+H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
{
- H5D_chunk_rec_t chunk_rec; /* generic chunk record */
- unsigned ndims; /* Rank of chunk */
- unsigned u; /* Local index variable */
- int curr_dim; /* Current rank */
- hsize_t idx; /* Array index of chunk */
- int ret_value = H5_ITER_CONT; /* Return value */
+ H5D_chunk_rec_t chunk_rec; /* generic chunk record */
+ unsigned ndims; /* Rank of chunk */
+ unsigned u; /* Local index variable */
+ int curr_dim; /* Current rank */
+ hsize_t idx; /* Array index of chunk */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -259,14 +244,14 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info,
/* Initialize generic chunk record */
HDmemset(&chunk_rec, 0, sizeof(chunk_rec));
- chunk_rec.nbytes = idx_info->layout->size;
+ chunk_rec.nbytes = idx_info->layout->size;
chunk_rec.filter_mask = 0;
ndims = idx_info->layout->ndims - 1;
HDassert(ndims > 0);
/* Iterate over all the chunks in the dataset's dataspace */
- for(u = 0; u < idx_info->layout->nchunks && ret_value == H5_ITER_CONT; u++) {
+ for (u = 0; u < idx_info->layout->nchunks && ret_value == H5_ITER_CONT; u++) {
/* Calculate the index of this chunk */
idx = H5VM_array_offset_pre(ndims, idx_info->layout->max_down_chunks, chunk_rec.scaled);
@@ -274,17 +259,18 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info,
chunk_rec.chunk_addr = idx_info->storage->idx_addr + idx * idx_info->layout->size;
/* Make "generic chunk" callback */
- if((ret_value = (*chunk_cb)(&chunk_rec, chunk_udata)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, H5_ITER_ERROR, "failure in generic chunk iterator callback")
+ if ((ret_value = (*chunk_cb)(&chunk_rec, chunk_udata)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, H5_ITER_ERROR,
+ "failure in generic chunk iterator callback")
/* Update coordinates of chunk in dataset */
curr_dim = (int)(ndims - 1);
- while(curr_dim >= 0) {
+ while (curr_dim >= 0) {
/* Increment coordinate in current dimension */
chunk_rec.scaled[curr_dim]++;
/* Check if we went off the end of the current dimension */
- if(chunk_rec.scaled[curr_dim] >= idx_info->layout->chunks[curr_dim]) {
+ if (chunk_rec.scaled[curr_dim] >= idx_info->layout->chunks[curr_dim]) {
/* Reset coordinate & move to next faster dimension */
chunk_rec.scaled[curr_dim] = 0;
curr_dim--;
@@ -292,13 +278,12 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info,
else
break;
} /* end while */
- } /* end for */
+ } /* end for */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__none_idx_iterate() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_remove
*
@@ -315,7 +300,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__none_idx_remove(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, H5D_chunk_common_ud_t H5_ATTR_UNUSED *udata)
+H5D__none_idx_remove(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info,
+ H5D_chunk_common_ud_t H5_ATTR_UNUSED *udata)
{
FUNC_ENTER_STATIC_NOERR
@@ -324,7 +310,6 @@ H5D__none_idx_remove(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, H5D_chun
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__none_idx_remove() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_delete
*
@@ -340,8 +325,8 @@ H5D__none_idx_remove(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, H5D_chun
static herr_t
H5D__none_idx_delete(const H5D_chk_idx_info_t *idx_info)
{
- hsize_t nbytes; /* Size of all chunks */
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t nbytes; /* Size of all chunks */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -352,11 +337,11 @@ H5D__none_idx_delete(const H5D_chk_idx_info_t *idx_info)
HDassert(!idx_info->pline->nused); /* Shouldn't have filter defined on entering here */
HDassert(idx_info->layout);
HDassert(idx_info->storage);
- HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); /* should be defined */
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); /* should be defined */
/* chunk size * max # of chunks */
nbytes = idx_info->layout->max_nchunks * idx_info->layout->size;
- if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->storage->idx_addr, nbytes) < 0)
+ if (H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->storage->idx_addr, nbytes) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free dataset chunks")
idx_info->storage->idx_addr = HADDR_UNDEF;
@@ -365,7 +350,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__none_idx_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_copy_setup
*
@@ -379,9 +363,9 @@ done:
*/
static herr_t
H5D__none_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_info_src,
- const H5D_chk_idx_info_t *idx_info_dst)
+ const H5D_chk_idx_info_t * idx_info_dst)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -405,7 +389,7 @@ H5D__none_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_inf
H5_BEGIN_TAG(H5AC__COPIED_TAG);
/* Allocate dataset chunks in the dest. file */
- if(H5D__none_idx_create(idx_info_dst) < 0)
+ if (H5D__none_idx_create(idx_info_dst) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
/* Reset metadata tag */
@@ -415,7 +399,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__none_idx_copy_setup() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_size
*
@@ -441,7 +424,6 @@ H5D__none_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t *i
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__none_idx_size() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_reset
*
@@ -462,13 +444,12 @@ H5D__none_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
HDassert(storage);
/* Reset index info */
- if(reset_addr)
- storage->idx_addr = HADDR_UNDEF;
+ if (reset_addr)
+ storage->idx_addr = HADDR_UNDEF;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__none_idx_reset() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_dump
*
@@ -493,4 +474,3 @@ H5D__none_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__none_idx_dump() */
-
diff --git a/src/H5Doh.c b/src/H5Doh.c
index 017bab7..2c72a64 100644
--- a/src/H5Doh.c
+++ b/src/H5Doh.c
@@ -15,79 +15,70 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-#define H5O_FRIEND /*suppress error about including H5Opkg */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Opkg.h" /* Object headers */
-#include "H5VLprivate.h" /* Virtual Object Layer */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Opkg.h" /* Object headers */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
-static void *H5O__dset_get_copy_file_udata(void);
-static void H5O__dset_free_copy_file_udata(void *);
-static htri_t H5O__dset_isa(const H5O_t *loc);
-static void *H5O__dset_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type);
-static void *H5O__dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc);
+static void * H5O__dset_get_copy_file_udata(void);
+static void H5O__dset_free_copy_file_udata(void *);
+static htri_t H5O__dset_isa(const H5O_t *loc);
+static void * H5O__dset_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type);
+static void * H5O__dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc);
static H5O_loc_t *H5O__dset_get_oloc(hid_t obj_id);
-static herr_t H5O__dset_bh_info(const H5O_loc_t *loc, H5O_t *oh,
- H5_ih_info_t *bh_info);
-static herr_t H5O__dset_flush(void *_obj_ptr);
-
+static herr_t H5O__dset_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5_ih_info_t *bh_info);
+static herr_t H5O__dset_flush(void *_obj_ptr);
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
/* This message derives from H5O object class */
const H5O_obj_class_t H5O_OBJ_DATASET[1] = {{
- H5O_TYPE_DATASET, /* object type */
- "dataset", /* object name, for debugging */
- H5O__dset_get_copy_file_udata, /* get 'copy file' user data */
+ H5O_TYPE_DATASET, /* object type */
+ "dataset", /* object name, for debugging */
+ H5O__dset_get_copy_file_udata, /* get 'copy file' user data */
H5O__dset_free_copy_file_udata, /* free 'copy file' user data */
- H5O__dset_isa, /* "isa" message */
- H5O__dset_open, /* open an object of this class */
- H5O__dset_create, /* create an object of this class */
- H5O__dset_get_oloc, /* get an object header location for an object */
- H5O__dset_bh_info, /* get the index & heap info for an object */
- H5O__dset_flush /* flush an opened object of this class */
+ H5O__dset_isa, /* "isa" message */
+ H5O__dset_open, /* open an object of this class */
+ H5O__dset_create, /* create an object of this class */
+ H5O__dset_get_oloc, /* get an object header location for an object */
+ H5O__dset_bh_info, /* get the index & heap info for an object */
+ H5O__dset_flush /* flush an opened object of this class */
}};
/* Declare a free list to manage the H5D_copy_file_ud_t struct */
H5FL_DEFINE(H5D_copy_file_ud_t);
-
/*-------------------------------------------------------------------------
* Function: H5O__dset_get_copy_file_udata
*
@@ -106,19 +97,18 @@ H5FL_DEFINE(H5D_copy_file_ud_t);
static void *
H5O__dset_get_copy_file_udata(void)
{
- void *ret_value = NULL; /* Return value */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
/* Allocate space for the 'copy file' user data for copying datasets */
- if(NULL == (ret_value = H5FL_CALLOC(H5D_copy_file_ud_t)))
+ if (NULL == (ret_value = H5FL_CALLOC(H5D_copy_file_ud_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__dset_get_copy_file_udata() */
-
/*-------------------------------------------------------------------------
* Function: H5O__dset_free_copy_file_udata
*
@@ -143,15 +133,15 @@ H5O__dset_free_copy_file_udata(void *_udata)
HDassert(udata);
/* Release copy of dataset's dataspace extent, if it was set */
- if(udata->src_space_extent)
+ if (udata->src_space_extent)
H5O_msg_free(H5O_SDSPACE_ID, udata->src_space_extent);
/* Release copy of dataset's datatype, if it was set */
- if(udata->src_dtype)
+ if (udata->src_dtype)
H5T_close_real(udata->src_dtype);
/* Release copy of dataset's filter pipeline, if it was set */
- if(udata->common.src_pline)
+ if (udata->common.src_pline)
H5O_msg_free(H5O_PLINE_ID, udata->common.src_pline);
/* Release space for 'copy file' user data */
@@ -160,7 +150,6 @@ H5O__dset_free_copy_file_udata(void *_udata)
FUNC_LEAVE_NOAPI_VOID
} /* end H5O__dset_free_copy_file_udata() */
-
/*-------------------------------------------------------------------------
* Function: H5O__dset_isa
*
@@ -181,30 +170,29 @@ H5O__dset_free_copy_file_udata(void *_udata)
static htri_t
H5O__dset_isa(const H5O_t *oh)
{
- htri_t exists; /* Flag if header message of interest exists */
- htri_t ret_value = TRUE; /* Return value */
+ htri_t exists; /* Flag if header message of interest exists */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_STATIC
HDassert(oh);
/* Datatype */
- if((exists = H5O_msg_exists_oh(oh, H5O_DTYPE_ID)) < 0)
+ if ((exists = H5O_msg_exists_oh(oh, H5O_DTYPE_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
- else if(!exists)
+ else if (!exists)
HGOTO_DONE(FALSE)
/* Layout */
- if((exists = H5O_msg_exists_oh(oh, H5O_SDSPACE_ID)) < 0)
+ if ((exists = H5O_msg_exists_oh(oh, H5O_SDSPACE_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
- else if(!exists)
+ else if (!exists)
HGOTO_DONE(FALSE)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__dset_isa() */
-
/*-------------------------------------------------------------------------
* Function: H5O__dset_open
*
@@ -221,9 +209,9 @@ done:
static void *
H5O__dset_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type)
{
- H5D_t *dset = NULL; /* Dataset opened */
- hid_t dapl_id; /* dapl to use to open this dataset */
- void *ret_value = NULL; /* Return value */
+ H5D_t *dset = NULL; /* Dataset opened */
+ hid_t dapl_id; /* dapl to use to open this dataset */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -238,37 +226,36 @@ H5O__dset_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type)
* additional properties that DAPLs have)
*/
dapl_id = H5CX_get_lapl();
- if(dapl_id == H5P_LINK_ACCESS_DEFAULT)
+ if (dapl_id == H5P_LINK_ACCESS_DEFAULT)
dapl_id = H5P_DATASET_ACCESS_DEFAULT;
else {
- htri_t is_lapl, is_dapl; /* Class of LAPL from API context */
+ htri_t is_lapl, is_dapl; /* Class of LAPL from API context */
/* Check class of LAPL from API context */
- if((is_lapl = H5P_isa_class(dapl_id, H5P_LINK_ACCESS)) < 0)
+ if ((is_lapl = H5P_isa_class(dapl_id, H5P_LINK_ACCESS)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get LAPL status")
- if((is_dapl = H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) < 0)
+ if ((is_dapl = H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get DAPL status")
/* Switch to default DAPL if not an actual DAPL in the API context */
- if(!is_dapl && is_lapl)
+ if (!is_dapl && is_lapl)
dapl_id = H5P_DATASET_ACCESS_DEFAULT;
} /* end else */
/* Open the dataset */
- if(NULL == (dset = H5D_open(obj_loc, dapl_id)))
+ if (NULL == (dset = H5D_open(obj_loc, dapl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open dataset")
ret_value = (void *)dset;
done:
- if(NULL == ret_value)
- if(dset && H5D_close(dset) < 0)
+ if (NULL == ret_value)
+ if (dset && H5D_close(dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataset")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__dset_open() */
-
/*-------------------------------------------------------------------------
* Function: H5O__dset_create
*
@@ -285,9 +272,9 @@ done:
static void *
H5O__dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc)
{
- H5D_obj_create_t *crt_info = (H5D_obj_create_t *)_crt_info; /* Dataset creation parameters */
- H5D_t *dset = NULL; /* New dataset created */
- void *ret_value = NULL; /* Return value */
+ H5D_obj_create_t *crt_info = (H5D_obj_create_t *)_crt_info; /* Dataset creation parameters */
+ H5D_t * dset = NULL; /* New dataset created */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -297,27 +284,27 @@ H5O__dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc)
HDassert(obj_loc);
/* Create the the dataset */
- if(NULL == (dset = H5D__create(f, crt_info->type_id, crt_info->space, crt_info->dcpl_id, crt_info->dapl_id)))
+ if (NULL ==
+ (dset = H5D__create(f, crt_info->type_id, crt_info->space, crt_info->dcpl_id, crt_info->dapl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset")
/* Set up the new dataset's location */
- if(NULL == (obj_loc->oloc = H5D_oloc(dset)))
+ if (NULL == (obj_loc->oloc = H5D_oloc(dset)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get object location of dataset")
- if(NULL == (obj_loc->path = H5D_nameof(dset)))
+ if (NULL == (obj_loc->path = H5D_nameof(dset)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get path of dataset")
/* Set the return value */
ret_value = dset;
done:
- if(ret_value == NULL)
- if(dset && H5D_close(dset) < 0)
+ if (ret_value == NULL)
+ if (dset && H5D_close(dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataset")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__dset_create() */
-
/*-------------------------------------------------------------------------
* Function: H5O__dset_get_oloc
*
@@ -334,24 +321,23 @@ done:
static H5O_loc_t *
H5O__dset_get_oloc(hid_t obj_id)
{
- H5D_t *dset; /* Dataset opened */
- H5O_loc_t *ret_value = NULL; /* Return value */
+ H5D_t * dset; /* Dataset opened */
+ H5O_loc_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
/* Get the dataset */
- if(NULL == (dset = (H5D_t *)H5VL_object(obj_id)))
+ if (NULL == (dset = (H5D_t *)H5VL_object(obj_id)))
HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID")
/* Get the dataset's object header location */
- if(NULL == (ret_value = H5D_oloc(dset)))
+ if (NULL == (ret_value = H5D_oloc(dset)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from object")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__dset_get_oloc() */
-
/*-------------------------------------------------------------------------
* Function: H5O__dset_bh_info
*
@@ -369,12 +355,12 @@ done:
static herr_t
H5O__dset_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5_ih_info_t *bh_info)
{
- H5O_layout_t layout; /* Data storage layout message */
- H5O_efl_t efl; /* External File List message */
- hbool_t layout_read = FALSE; /* Whether the layout message was read */
- hbool_t efl_read = FALSE; /* Whether the external file list message was read */
- htri_t exists; /* Flag if header message of interest exists */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_layout_t layout; /* Data storage layout message */
+ H5O_efl_t efl; /* External File List message */
+ hbool_t layout_read = FALSE; /* Whether the layout message was read */
+ hbool_t efl_read = FALSE; /* Whether the external file list message was read */
+ htri_t exists; /* Flag if header message of interest exists */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -386,57 +372,56 @@ H5O__dset_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5_ih_info_t *bh_info)
HDassert(bh_info);
/* Get the layout message from the object header */
- if(NULL == H5O_msg_read_oh(loc->file, oh, H5O_LAYOUT_ID, &layout))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find layout message")
+ if (NULL == H5O_msg_read_oh(loc->file, oh, H5O_LAYOUT_ID, &layout))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find layout message")
layout_read = TRUE;
/* Check for chunked dataset storage */
- if(layout.type == H5D_CHUNKED && H5D__chunk_is_space_alloc(&layout.storage)) {
+ if (layout.type == H5D_CHUNKED && H5D__chunk_is_space_alloc(&layout.storage)) {
/* Get size of chunk index */
- if(H5D__chunk_bh_info(loc, oh, &layout, &(bh_info->index_size)) < 0)
+ if (H5D__chunk_bh_info(loc, oh, &layout, &(bh_info->index_size)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine chunked dataset btree info")
} /* end if */
- else if(layout.type == H5D_VIRTUAL
- && (layout.storage.u.virt.serial_list_hobjid.addr != HADDR_UNDEF)) {
+ else if (layout.type == H5D_VIRTUAL && (layout.storage.u.virt.serial_list_hobjid.addr != HADDR_UNDEF)) {
size_t virtual_heap_size;
/* Get size of global heap object for virtual dataset */
- if(H5HG_get_obj_size(loc->file, &(layout.storage.u.virt.serial_list_hobjid), &virtual_heap_size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get global heap size for virtual dataset mapping")
+ if (H5HG_get_obj_size(loc->file, &(layout.storage.u.virt.serial_list_hobjid), &virtual_heap_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "can't get global heap size for virtual dataset mapping")
/* Return heap size */
bh_info->heap_size = (hsize_t)virtual_heap_size;
} /* end if */
/* Check for External File List message in the object header */
- if((exists = H5O_msg_exists_oh(oh, H5O_EFL_ID)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for EFL message")
+ if ((exists = H5O_msg_exists_oh(oh, H5O_EFL_ID)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for EFL message")
- if(exists && H5D__efl_is_space_alloc(&layout.storage)) {
+ if (exists && H5D__efl_is_space_alloc(&layout.storage)) {
/* Start with clean EFL info */
HDmemset(&efl, 0, sizeof(efl));
- /* Get External File List message from the object header */
- if(NULL == H5O_msg_read_oh(loc->file, oh, H5O_EFL_ID, &efl))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find EFL message")
+ /* Get External File List message from the object header */
+ if (NULL == H5O_msg_read_oh(loc->file, oh, H5O_EFL_ID, &efl))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find EFL message")
efl_read = TRUE;
- /* Get size of local heap for EFL message's file list */
- if(H5D__efl_bh_info(loc->file, &efl, &(bh_info->heap_size)) < 0)
+ /* Get size of local heap for EFL message's file list */
+ if (H5D__efl_bh_info(loc->file, &efl, &(bh_info->heap_size)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine EFL heap info")
} /* end if */
done:
/* Free messages, if they've been read in */
- if(layout_read && H5O_msg_reset(H5O_LAYOUT_ID, &layout) < 0)
+ if (layout_read && H5O_msg_reset(H5O_LAYOUT_ID, &layout) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset data storage layout message")
- if(efl_read && H5O_msg_reset(H5O_EFL_ID, &efl) < 0)
+ if (efl_read && H5O_msg_reset(H5O_EFL_ID, &efl) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset external file list message")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__dset_bh_info() */
-
/*-------------------------------------------------------------------------
* Function: H5O__dset_flush
*
@@ -453,9 +438,9 @@ done:
static herr_t
H5O__dset_flush(void *_obj_ptr)
{
- H5D_t *dset = (H5D_t *)_obj_ptr; /* Pointer to dataset object */
- H5O_type_t obj_type; /* Type of object at location */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t * dset = (H5D_t *)_obj_ptr; /* Pointer to dataset object */
+ H5O_type_t obj_type; /* Type of object at location */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -463,15 +448,14 @@ H5O__dset_flush(void *_obj_ptr)
HDassert(&dset->oloc);
/* Check that the object found is the correct type */
- if(H5O_obj_type(&dset->oloc, &obj_type) < 0)
+ if (H5O_obj_type(&dset->oloc, &obj_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object type")
- if(obj_type != H5O_TYPE_DATASET)
+ if (obj_type != H5O_TYPE_DATASET)
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset")
- if(H5D__flush_real(dset) < 0)
+ if (H5D__flush_real(dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__dset_flush() */
-
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 5efcc9b..fa83fda 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -30,12 +30,12 @@
#include "H5Dprivate.h"
/* Other private headers needed by this file */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5B2private.h" /* v2 B-trees */
-#include "H5Fprivate.h" /* File access */
-#include "H5Gprivate.h" /* Groups */
-#include "H5SLprivate.h" /* Skip lists */
-#include "H5Tprivate.h" /* Datatypes */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5B2private.h" /* v2 B-trees */
+#include "H5Fprivate.h" /* File access */
+#include "H5Gprivate.h" /* Groups */
+#include "H5SLprivate.h" /* Skip lists */
+#include "H5Tprivate.h" /* Datatypes */
/**************************/
/* Package Private Macros */
@@ -45,44 +45,43 @@
#define H5D_MINHDR_SIZE 256
/* [Simple] Macro to construct a H5D_io_info_t from it's components */
-#define H5D_BUILD_IO_INFO_WRT(io_info, ds, str, buf) \
- (io_info)->dset = ds; \
- (io_info)->f_sh = H5F_SHARED((ds)->oloc.file); \
- (io_info)->store = str; \
- (io_info)->op_type = H5D_IO_OP_WRITE; \
- (io_info)->u.wbuf = buf
-#define H5D_BUILD_IO_INFO_RD(io_info, ds, str, buf) \
- (io_info)->dset = ds; \
- (io_info)->f_sh = H5F_SHARED((ds)->oloc.file); \
- (io_info)->store = str; \
- (io_info)->op_type = H5D_IO_OP_READ; \
- (io_info)->u.rbuf = buf
+#define H5D_BUILD_IO_INFO_WRT(io_info, ds, str, buf) \
+ (io_info)->dset = ds; \
+ (io_info)->f_sh = H5F_SHARED((ds)->oloc.file); \
+ (io_info)->store = str; \
+ (io_info)->op_type = H5D_IO_OP_WRITE; \
+ (io_info)->u.wbuf = buf
+#define H5D_BUILD_IO_INFO_RD(io_info, ds, str, buf) \
+ (io_info)->dset = ds; \
+ (io_info)->f_sh = H5F_SHARED((ds)->oloc.file); \
+ (io_info)->store = str; \
+ (io_info)->op_type = H5D_IO_OP_READ; \
+ (io_info)->u.rbuf = buf
/* Flags for marking aspects of a dataset dirty */
#define H5D_MARK_SPACE 0x01
-#define H5D_MARK_LAYOUT 0x02
+#define H5D_MARK_LAYOUT 0x02
/* Default creation parameters for chunk index data structures */
/* See H5O_layout_chunk_t */
/* Fixed array creation values */
-#define H5D_FARRAY_CREATE_PARAM_SIZE 1 /* Size of the creation parameters in bytes */
-#define H5D_FARRAY_MAX_DBLK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */
+#define H5D_FARRAY_CREATE_PARAM_SIZE 1 /* Size of the creation parameters in bytes */
+#define H5D_FARRAY_MAX_DBLK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */
/* Extensible array creation values */
-#define H5D_EARRAY_CREATE_PARAM_SIZE 5 /* Size of the creation parameters in bytes */
-#define H5D_EARRAY_MAX_NELMTS_BITS 32 /* i.e. 4 giga-elements */
+#define H5D_EARRAY_CREATE_PARAM_SIZE 5 /* Size of the creation parameters in bytes */
+#define H5D_EARRAY_MAX_NELMTS_BITS 32 /* i.e. 4 giga-elements */
#define H5D_EARRAY_IDX_BLK_ELMTS 4
#define H5D_EARRAY_SUP_BLK_MIN_DATA_PTRS 4
#define H5D_EARRAY_DATA_BLK_MIN_ELMTS 16
-#define H5D_EARRAY_MAX_DBLOCK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */
+#define H5D_EARRAY_MAX_DBLOCK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */
/* v2 B-tree creation values for raw meta_size */
-#define H5D_BT2_CREATE_PARAM_SIZE 6 /* Size of the creation parameters in bytes */
-#define H5D_BT2_NODE_SIZE 2048
-#define H5D_BT2_SPLIT_PERC 100
-#define H5D_BT2_MERGE_PERC 40
-
+#define H5D_BT2_CREATE_PARAM_SIZE 6 /* Size of the creation parameters in bytes */
+#define H5D_BT2_NODE_SIZE 2048
+#define H5D_BT2_SPLIT_PERC 100
+#define H5D_BT2_MERGE_PERC 40
/****************************/
/* Package Private Typedefs */
@@ -91,25 +90,25 @@
/* Typedef for datatype information for raw data I/O operation */
typedef struct H5D_type_info_t {
/* Initial values */
- const H5T_t *mem_type; /* Pointer to memory datatype */
- const H5T_t *dset_type; /* Pointer to dataset datatype */
- H5T_path_t *tpath; /* Datatype conversion path */
- hid_t src_type_id; /* Source datatype ID */
- hid_t dst_type_id; /* Destination datatype ID */
+ const H5T_t *mem_type; /* Pointer to memory datatype */
+ const H5T_t *dset_type; /* Pointer to dataset datatype */
+ H5T_path_t * tpath; /* Datatype conversion path */
+ hid_t src_type_id; /* Source datatype ID */
+ hid_t dst_type_id; /* Destination datatype ID */
/* Computed/derived values */
- size_t src_type_size; /* Size of source type */
- size_t dst_type_size; /* Size of destination type */
- size_t max_type_size; /* Size of largest source/destination type */
- hbool_t is_conv_noop; /* Whether the type conversion is a NOOP */
- hbool_t is_xform_noop; /* Whether the data transform is a NOOP */
- const H5T_subset_info_t *cmpd_subset; /* Info related to the compound subset conversion functions */
- H5T_bkg_t need_bkg; /* Type of background buf needed */
- size_t request_nelmts; /* Requested strip mine */
- uint8_t *tconv_buf; /* Datatype conv buffer */
- hbool_t tconv_buf_allocated; /* Whether the type conversion buffer was allocated */
- uint8_t *bkg_buf; /* Background buffer */
- hbool_t bkg_buf_allocated; /* Whether the background buffer was allocated */
+ size_t src_type_size; /* Size of source type */
+ size_t dst_type_size; /* Size of destination type */
+ size_t max_type_size; /* Size of largest source/destination type */
+ hbool_t is_conv_noop; /* Whether the type conversion is a NOOP */
+ hbool_t is_xform_noop; /* Whether the data transform is a NOOP */
+ const H5T_subset_info_t *cmpd_subset; /* Info related to the compound subset conversion functions */
+ H5T_bkg_t need_bkg; /* Type of background buf needed */
+ size_t request_nelmts; /* Requested strip mine */
+ uint8_t * tconv_buf; /* Datatype conv buffer */
+ hbool_t tconv_buf_allocated; /* Whether the type conversion buffer was allocated */
+ uint8_t * bkg_buf; /* Background buffer */
+ hbool_t bkg_buf_allocated; /* Whether the background buffer was allocated */
} H5D_type_info_t;
/* Forward declaration of structs used below */
@@ -119,122 +118,126 @@ typedef struct H5D_shared_t H5D_shared_t;
/* Function pointers for I/O on particular types of dataset layouts */
typedef herr_t (*H5D_layout_construct_func_t)(H5F_t *f, H5D_t *dset);
-typedef herr_t (*H5D_layout_init_func_t)(H5F_t *f, const H5D_t *dset,
- hid_t dapl_id);
+typedef herr_t (*H5D_layout_init_func_t)(H5F_t *f, const H5D_t *dset, hid_t dapl_id);
typedef hbool_t (*H5D_layout_is_space_alloc_func_t)(const H5O_storage_t *storage);
typedef hbool_t (*H5D_layout_is_data_cached_func_t)(const H5D_shared_t *shared_dset);
typedef herr_t (*H5D_layout_io_init_func_t)(const struct H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- struct H5D_chunk_map_t *cm);
-typedef herr_t (*H5D_layout_read_func_t)(struct H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space,
- const H5S_t *mem_space, struct H5D_chunk_map_t *fm);
-typedef herr_t (*H5D_layout_write_func_t)(struct H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space,
- const H5S_t *mem_space, struct H5D_chunk_map_t *fm);
-typedef ssize_t (*H5D_layout_readvv_func_t)(const struct H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
-typedef ssize_t (*H5D_layout_writevv_func_t)(const struct H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
+ const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space,
+ struct H5D_chunk_map_t *cm);
+typedef herr_t (*H5D_layout_read_func_t)(struct H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ struct H5D_chunk_map_t *fm);
+typedef herr_t (*H5D_layout_write_func_t)(struct H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ struct H5D_chunk_map_t *fm);
+typedef ssize_t (*H5D_layout_readvv_func_t)(const struct H5D_io_info_t *io_info, size_t dset_max_nseq,
+ size_t *dset_curr_seq, size_t dset_len_arr[],
+ hsize_t dset_offset_arr[], size_t mem_max_nseq,
+ size_t *mem_curr_seq, size_t mem_len_arr[],
+ hsize_t mem_offset_arr[]);
+typedef ssize_t (*H5D_layout_writevv_func_t)(const struct H5D_io_info_t *io_info, size_t dset_max_nseq,
+ size_t *dset_curr_seq, size_t dset_len_arr[],
+ hsize_t dset_offset_arr[], size_t mem_max_nseq,
+ size_t *mem_curr_seq, size_t mem_len_arr[],
+ hsize_t mem_offset_arr[]);
typedef herr_t (*H5D_layout_flush_func_t)(H5D_t *dataset);
typedef herr_t (*H5D_layout_io_term_func_t)(const struct H5D_chunk_map_t *cm);
typedef herr_t (*H5D_layout_dest_func_t)(H5D_t *dataset);
/* Typedef for grouping layout I/O routines */
typedef struct H5D_layout_ops_t {
- H5D_layout_construct_func_t construct; /* Layout constructor for new datasets */
- H5D_layout_init_func_t init; /* Layout initializer for dataset */
- H5D_layout_is_space_alloc_func_t is_space_alloc; /* Query routine to determine if storage is allocated */
- H5D_layout_is_data_cached_func_t is_data_cached; /* Query routine to determine if any raw data is cached. If routine is not present then the layout type never caches raw data. */
- H5D_layout_io_init_func_t io_init; /* I/O initialization routine */
- H5D_layout_read_func_t ser_read; /* High-level I/O routine for reading data in serial */
- H5D_layout_write_func_t ser_write; /* High-level I/O routine for writing data in serial */
+ H5D_layout_construct_func_t construct; /* Layout constructor for new datasets */
+ H5D_layout_init_func_t init; /* Layout initializer for dataset */
+ H5D_layout_is_space_alloc_func_t is_space_alloc; /* Query routine to determine if storage is allocated */
+ H5D_layout_is_data_cached_func_t
+ is_data_cached; /* Query routine to determine if any raw data is cached. If routine is not present
+ then the layout type never caches raw data. */
+ H5D_layout_io_init_func_t io_init; /* I/O initialization routine */
+ H5D_layout_read_func_t ser_read; /* High-level I/O routine for reading data in serial */
+ H5D_layout_write_func_t ser_write; /* High-level I/O routine for writing data in serial */
#ifdef H5_HAVE_PARALLEL
- H5D_layout_read_func_t par_read; /* High-level I/O routine for reading data in parallel */
- H5D_layout_write_func_t par_write; /* High-level I/O routine for writing data in parallel */
-#endif /* H5_HAVE_PARALLEL */
- H5D_layout_readvv_func_t readvv; /* Low-level I/O routine for reading data */
- H5D_layout_writevv_func_t writevv; /* Low-level I/O routine for writing data */
- H5D_layout_flush_func_t flush; /* Low-level I/O routine for flushing raw data */
- H5D_layout_io_term_func_t io_term; /* I/O shutdown routine */
- H5D_layout_dest_func_t dest; /* Destroy layout info */
+ H5D_layout_read_func_t par_read; /* High-level I/O routine for reading data in parallel */
+ H5D_layout_write_func_t par_write; /* High-level I/O routine for writing data in parallel */
+#endif /* H5_HAVE_PARALLEL */
+ H5D_layout_readvv_func_t readvv; /* Low-level I/O routine for reading data */
+ H5D_layout_writevv_func_t writevv; /* Low-level I/O routine for writing data */
+ H5D_layout_flush_func_t flush; /* Low-level I/O routine for flushing raw data */
+ H5D_layout_io_term_func_t io_term; /* I/O shutdown routine */
+ H5D_layout_dest_func_t dest; /* Destroy layout info */
} H5D_layout_ops_t;
/* Function pointers for either multiple or single block I/O access */
typedef herr_t (*H5D_io_single_read_func_t)(const struct H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
+ const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space);
typedef herr_t (*H5D_io_single_write_func_t)(const struct H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
+ const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space);
/* Typedef for raw data I/O framework info */
typedef struct H5D_io_ops_t {
- H5D_layout_read_func_t multi_read; /* High-level I/O routine for reading data */
- H5D_layout_write_func_t multi_write; /* High-level I/O routine for writing data */
- H5D_io_single_read_func_t single_read; /* I/O routine for reading single block */
- H5D_io_single_write_func_t single_write; /* I/O routine for writing single block */
+ H5D_layout_read_func_t multi_read; /* High-level I/O routine for reading data */
+ H5D_layout_write_func_t multi_write; /* High-level I/O routine for writing data */
+ H5D_io_single_read_func_t single_read; /* I/O routine for reading single block */
+ H5D_io_single_write_func_t single_write; /* I/O routine for writing single block */
} H5D_io_ops_t;
/* Typedefs for dataset storage information */
typedef struct {
- haddr_t dset_addr; /* Address of dataset in file */
- hsize_t dset_size; /* Total size of dataset in file */
+ haddr_t dset_addr; /* Address of dataset in file */
+ hsize_t dset_size; /* Total size of dataset in file */
} H5D_contig_storage_t;
typedef struct {
- hsize_t *scaled; /* Scaled coordinates for a chunk */
+ hsize_t *scaled; /* Scaled coordinates for a chunk */
} H5D_chunk_storage_t;
typedef struct {
- void *buf; /* Buffer for compact dataset */
- hbool_t *dirty; /* Pointer to dirty flag to mark */
+ void * buf; /* Buffer for compact dataset */
+ hbool_t *dirty; /* Pointer to dirty flag to mark */
} H5D_compact_storage_t;
typedef union H5D_storage_t {
- H5D_contig_storage_t contig; /* Contiguous information for dataset */
- H5D_chunk_storage_t chunk; /* Chunk information for dataset */
+ H5D_contig_storage_t contig; /* Contiguous information for dataset */
+ H5D_chunk_storage_t chunk; /* Chunk information for dataset */
H5D_compact_storage_t compact; /* Compact information for dataset */
- H5O_efl_t efl; /* External file list information for dataset */
+ H5O_efl_t efl; /* External file list information for dataset */
} H5D_storage_t;
/* Typedef for raw data I/O operation info */
typedef enum H5D_io_op_type_t {
- H5D_IO_OP_READ, /* Read operation */
- H5D_IO_OP_WRITE /* Write operation */
+ H5D_IO_OP_READ, /* Read operation */
+ H5D_IO_OP_WRITE /* Write operation */
} H5D_io_op_type_t;
typedef struct H5D_io_info_t {
- const H5D_t *dset; /* Pointer to dataset being operated on */
-/* QAK: Delete the f_sh field when oloc has a shared file pointer? */
- H5F_shared_t *f_sh; /* Pointer to shared file struct that dataset is within */
+ const H5D_t *dset; /* Pointer to dataset being operated on */
+ /* QAK: Delete the f_sh field when oloc has a shared file pointer? */
+ H5F_shared_t *f_sh; /* Pointer to shared file struct that dataset is within */
#ifdef H5_HAVE_PARALLEL
- MPI_Comm comm; /* MPI communicator for file */
- hbool_t using_mpi_vfd; /* Whether the file is using an MPI-based VFD */
-#endif /* H5_HAVE_PARALLEL */
- H5D_storage_t *store; /* Dataset storage info */
- H5D_layout_ops_t layout_ops; /* Dataset layout I/O operation function pointers */
- H5D_io_ops_t io_ops; /* I/O operation function pointers */
+ MPI_Comm comm; /* MPI communicator for file */
+ hbool_t using_mpi_vfd; /* Whether the file is using an MPI-based VFD */
+#endif /* H5_HAVE_PARALLEL */
+ H5D_storage_t * store; /* Dataset storage info */
+ H5D_layout_ops_t layout_ops; /* Dataset layout I/O operation function pointers */
+ H5D_io_ops_t io_ops; /* I/O operation function pointers */
H5D_io_op_type_t op_type;
union {
- void *rbuf; /* Pointer to buffer for read */
- const void *wbuf; /* Pointer to buffer to write */
+ void * rbuf; /* Pointer to buffer for read */
+ const void *wbuf; /* Pointer to buffer to write */
} u;
} H5D_io_info_t;
-
/******************/
/* Chunk typedefs */
/******************/
/* Typedef for chunked dataset index operation info */
typedef struct H5D_chk_idx_info_t {
- H5F_t *f; /* File pointer for operation */
- const H5O_pline_t *pline; /* I/O pipeline info */
- H5O_layout_chunk_t *layout; /* Chunk layout description */
+ H5F_t * f; /* File pointer for operation */
+ const H5O_pline_t * pline; /* I/O pipeline info */
+ H5O_layout_chunk_t * layout; /* Chunk layout description */
H5O_storage_chunk_t *storage; /* Chunk storage description */
} H5D_chk_idx_info_t;
@@ -250,10 +253,10 @@ typedef struct H5D_chk_idx_info_t {
* The chunk's file address, filter mask and size on disk are not key values.
*/
typedef struct H5D_chunk_rec_t {
- hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Logical offset to start */
- uint32_t nbytes; /* Size of stored data */
- uint32_t filter_mask; /* Excluded filters */
- haddr_t chunk_addr; /* Address of chunk in file */
+ hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Logical offset to start */
+ uint32_t nbytes; /* Size of stored data */
+ uint32_t filter_mask; /* Excluded filters */
+ haddr_t chunk_addr; /* Address of chunk in file */
} H5D_chunk_rec_t;
/*
@@ -262,124 +265,121 @@ typedef struct H5D_chunk_rec_t {
* to which the index points.
*/
typedef struct H5D_chunk_common_ud_t {
- const H5O_layout_chunk_t *layout; /* Chunk layout description */
- const H5O_storage_chunk_t *storage; /* Chunk storage description */
- const hsize_t *scaled; /* Scaled coordinates for a chunk */
+ const H5O_layout_chunk_t * layout; /* Chunk layout description */
+ const H5O_storage_chunk_t *storage; /* Chunk storage description */
+ const hsize_t * scaled; /* Scaled coordinates for a chunk */
} H5D_chunk_common_ud_t;
/* B-tree callback info for various operations */
typedef struct H5D_chunk_ud_t {
/* Downward */
- H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */
+ H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */
/* Upward */
- unsigned idx_hint; /* Index of chunk in cache, if present */
- H5F_block_t chunk_block; /* Offset/length of chunk in file */
- unsigned filter_mask; /* Excluded filters */
- hbool_t new_unfilt_chunk; /* Whether the chunk just became unfiltered */
- hsize_t chunk_idx; /* Chunk index for EA, FA indexing */
+ unsigned idx_hint; /* Index of chunk in cache, if present */
+ H5F_block_t chunk_block; /* Offset/length of chunk in file */
+ unsigned filter_mask; /* Excluded filters */
+ hbool_t new_unfilt_chunk; /* Whether the chunk just became unfiltered */
+ hsize_t chunk_idx; /* Chunk index for EA, FA indexing */
} H5D_chunk_ud_t;
/* Typedef for "generic" chunk callbacks */
-typedef int (*H5D_chunk_cb_func_t)(const H5D_chunk_rec_t *chunk_rec,
- void *udata);
+typedef int (*H5D_chunk_cb_func_t)(const H5D_chunk_rec_t *chunk_rec, void *udata);
/* Typedefs for chunk operations */
-typedef herr_t (*H5D_chunk_init_func_t)(const H5D_chk_idx_info_t *idx_info,
- const H5S_t *space, haddr_t dset_ohdr_addr);
+typedef herr_t (*H5D_chunk_init_func_t)(const H5D_chk_idx_info_t *idx_info, const H5S_t *space,
+ haddr_t dset_ohdr_addr);
typedef herr_t (*H5D_chunk_create_func_t)(const H5D_chk_idx_info_t *idx_info);
typedef hbool_t (*H5D_chunk_is_space_alloc_func_t)(const H5O_storage_chunk_t *storage);
-typedef herr_t (*H5D_chunk_insert_func_t)(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_ud_t *udata, const H5D_t *dset);
-typedef herr_t (*H5D_chunk_get_addr_func_t)(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_ud_t *udata);
+typedef herr_t (*H5D_chunk_insert_func_t)(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
+ const H5D_t *dset);
+typedef herr_t (*H5D_chunk_get_addr_func_t)(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata);
typedef herr_t (*H5D_chunk_resize_func_t)(H5O_layout_chunk_t *layout);
-typedef int (*H5D_chunk_iterate_func_t)(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_cb_func_t chunk_cb, void *chunk_udata);
-typedef herr_t (*H5D_chunk_remove_func_t)(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_common_ud_t *udata);
+typedef int (*H5D_chunk_iterate_func_t)(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb,
+ void *chunk_udata);
+typedef herr_t (*H5D_chunk_remove_func_t)(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata);
typedef herr_t (*H5D_chunk_delete_func_t)(const H5D_chk_idx_info_t *idx_info);
typedef herr_t (*H5D_chunk_copy_setup_func_t)(const H5D_chk_idx_info_t *idx_info_src,
- const H5D_chk_idx_info_t *idx_info_dst);
+ const H5D_chk_idx_info_t *idx_info_dst);
typedef herr_t (*H5D_chunk_copy_shutdown_func_t)(H5O_storage_chunk_t *storage_src,
- H5O_storage_chunk_t *storage_dst);
-typedef herr_t (*H5D_chunk_size_func_t)(const H5D_chk_idx_info_t *idx_info,
- hsize_t *idx_size);
+ H5O_storage_chunk_t *storage_dst);
+typedef herr_t (*H5D_chunk_size_func_t)(const H5D_chk_idx_info_t *idx_info, hsize_t *idx_size);
typedef herr_t (*H5D_chunk_reset_func_t)(H5O_storage_chunk_t *storage, hbool_t reset_addr);
-typedef herr_t (*H5D_chunk_dump_func_t)(const H5O_storage_chunk_t *storage,
- FILE *stream);
+typedef herr_t (*H5D_chunk_dump_func_t)(const H5O_storage_chunk_t *storage, FILE *stream);
typedef herr_t (*H5D_chunk_dest_func_t)(const H5D_chk_idx_info_t *idx_info);
/* Typedef for grouping chunk I/O routines */
typedef struct H5D_chunk_ops_t {
- hbool_t can_swim; /* Flag to indicate that the index supports SWMR access */
- H5D_chunk_init_func_t init; /* Routine to initialize indexing information in memory */
- H5D_chunk_create_func_t create; /* Routine to create chunk index */
- H5D_chunk_is_space_alloc_func_t is_space_alloc; /* Query routine to determine if storage/index is allocated */
- H5D_chunk_insert_func_t insert; /* Routine to insert a chunk into an index */
- H5D_chunk_get_addr_func_t get_addr; /* Routine to retrieve address of chunk in file */
- H5D_chunk_resize_func_t resize; /* Routine to update chunk index info after resizing dataset */
- H5D_chunk_iterate_func_t iterate; /* Routine to iterate over chunks */
- H5D_chunk_remove_func_t remove; /* Routine to remove a chunk from an index */
- H5D_chunk_delete_func_t idx_delete; /* Routine to delete index & all chunks from file*/
+ hbool_t can_swim; /* Flag to indicate that the index supports SWMR access */
+ H5D_chunk_init_func_t init; /* Routine to initialize indexing information in memory */
+ H5D_chunk_create_func_t create; /* Routine to create chunk index */
+ H5D_chunk_is_space_alloc_func_t
+ is_space_alloc; /* Query routine to determine if storage/index is allocated */
+ H5D_chunk_insert_func_t insert; /* Routine to insert a chunk into an index */
+ H5D_chunk_get_addr_func_t get_addr; /* Routine to retrieve address of chunk in file */
+ H5D_chunk_resize_func_t resize; /* Routine to update chunk index info after resizing dataset */
+ H5D_chunk_iterate_func_t iterate; /* Routine to iterate over chunks */
+ H5D_chunk_remove_func_t remove; /* Routine to remove a chunk from an index */
+ H5D_chunk_delete_func_t idx_delete; /* Routine to delete index & all chunks from file*/
H5D_chunk_copy_setup_func_t copy_setup; /* Routine to perform any necessary setup for copying chunks */
- H5D_chunk_copy_shutdown_func_t copy_shutdown; /* Routine to perform any necessary shutdown for copying chunks */
- H5D_chunk_size_func_t size; /* Routine to get size of indexing information */
- H5D_chunk_reset_func_t reset; /* Routine to reset indexing information */
- H5D_chunk_dump_func_t dump; /* Routine to dump indexing information */
- H5D_chunk_dest_func_t dest; /* Routine to destroy indexing information in memory */
+ H5D_chunk_copy_shutdown_func_t
+ copy_shutdown; /* Routine to perform any necessary shutdown for copying chunks */
+ H5D_chunk_size_func_t size; /* Routine to get size of indexing information */
+ H5D_chunk_reset_func_t reset; /* Routine to reset indexing information */
+ H5D_chunk_dump_func_t dump; /* Routine to dump indexing information */
+ H5D_chunk_dest_func_t dest; /* Routine to destroy indexing information in memory */
} H5D_chunk_ops_t;
/* Structure holding information about a chunk's selection for mapping */
typedef struct H5D_chunk_info_t {
- hsize_t index; /* "Index" of chunk in dataset */
- uint32_t chunk_points; /* Number of elements selected in chunk */
- hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Scaled coordinates of chunk (in file dataset's dataspace) */
- H5S_t *fspace; /* Dataspace describing chunk & selection in it */
- hbool_t fspace_shared; /* Indicate that the file space for a chunk is shared and shouldn't be freed */
- H5S_t *mspace; /* Dataspace describing selection in memory corresponding to this chunk */
- hbool_t mspace_shared; /* Indicate that the memory space for a chunk is shared and shouldn't be freed */
+ hsize_t index; /* "Index" of chunk in dataset */
+ uint32_t chunk_points; /* Number of elements selected in chunk */
+ hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Scaled coordinates of chunk (in file dataset's dataspace) */
+ H5S_t * fspace; /* Dataspace describing chunk & selection in it */
+ hbool_t fspace_shared; /* Indicate that the file space for a chunk is shared and shouldn't be freed */
+ H5S_t * mspace; /* Dataspace describing selection in memory corresponding to this chunk */
+ hbool_t mspace_shared; /* Indicate that the memory space for a chunk is shared and shouldn't be freed */
} H5D_chunk_info_t;
/* Main structure holding the mapping between file chunks and memory */
typedef struct H5D_chunk_map_t {
- H5O_layout_t *layout; /* Dataset layout information*/
- hsize_t nelmts; /* Number of elements selected in file & memory dataspaces */
+ H5O_layout_t *layout; /* Dataset layout information*/
+ hsize_t nelmts; /* Number of elements selected in file & memory dataspaces */
- const H5S_t *file_space; /* Pointer to the file dataspace */
- unsigned f_ndims; /* Number of dimensions for file dataspace */
+ const H5S_t *file_space; /* Pointer to the file dataspace */
+ unsigned f_ndims; /* Number of dimensions for file dataspace */
- const H5S_t *mem_space; /* Pointer to the memory dataspace */
- H5S_t *mchunk_tmpl; /* Dataspace template for new memory chunks */
+ const H5S_t * mem_space; /* Pointer to the memory dataspace */
+ H5S_t * mchunk_tmpl; /* Dataspace template for new memory chunks */
H5S_sel_iter_t mem_iter; /* Iterator for elements in memory selection */
- unsigned m_ndims; /* Number of dimensions for memory dataspace */
- H5S_sel_type msel_type; /* Selection type in memory */
- H5S_sel_type fsel_type; /* Selection type in file */
+ unsigned m_ndims; /* Number of dimensions for memory dataspace */
+ H5S_sel_type msel_type; /* Selection type in memory */
+ H5S_sel_type fsel_type; /* Selection type in file */
- H5SL_t *sel_chunks; /* Skip list containing information for each chunk selected */
+ H5SL_t *sel_chunks; /* Skip list containing information for each chunk selected */
- H5S_t *single_space; /* Dataspace for single chunk */
- H5D_chunk_info_t *single_chunk_info; /* Pointer to single chunk's info */
- hbool_t use_single; /* Whether I/O is on a single element */
+ H5S_t * single_space; /* Dataspace for single chunk */
+ H5D_chunk_info_t *single_chunk_info; /* Pointer to single chunk's info */
+ hbool_t use_single; /* Whether I/O is on a single element */
- hsize_t last_index; /* Index of last chunk operated on */
- H5D_chunk_info_t *last_chunk_info; /* Pointer to last chunk's info */
+ hsize_t last_index; /* Index of last chunk operated on */
+ H5D_chunk_info_t *last_chunk_info; /* Pointer to last chunk's info */
- hsize_t chunk_dim[H5O_LAYOUT_NDIMS]; /* Size of chunk in each dimension */
+ hsize_t chunk_dim[H5O_LAYOUT_NDIMS]; /* Size of chunk in each dimension */
#ifdef H5_HAVE_PARALLEL
- H5D_chunk_info_t **select_chunk; /* Store the information about whether this chunk is selected or not */
-#endif /* H5_HAVE_PARALLEL */
+ H5D_chunk_info_t **select_chunk; /* Store the information about whether this chunk is selected or not */
+#endif /* H5_HAVE_PARALLEL */
} H5D_chunk_map_t;
/* Cached information about a particular chunk */
typedef struct H5D_chunk_cached_t {
- hbool_t valid; /*whether cache info is valid*/
- hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled offset of chunk*/
- haddr_t addr; /*file address of chunk */
- uint32_t nbytes; /*size of stored data */
- hsize_t chunk_idx; /*index of chunk in dataset */
- unsigned filter_mask; /*excluded filters */
+ hbool_t valid; /*whether cache info is valid*/
+ hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled offset of chunk*/
+ haddr_t addr; /*file address of chunk */
+ uint32_t nbytes; /*size of stored data */
+ hsize_t chunk_idx; /*index of chunk in dataset */
+ unsigned filter_mask; /*excluded filters */
} H5D_chunk_cached_t;
/****************************/
@@ -388,46 +388,48 @@ typedef struct H5D_chunk_cached_t {
/* List of files held open during refresh operations */
typedef struct H5D_virtual_held_file_t {
- H5F_t *file; /* Pointer to file held open */
- struct H5D_virtual_held_file_t *next; /* Pointer to next node in list */
+ H5F_t * file; /* Pointer to file held open */
+ struct H5D_virtual_held_file_t *next; /* Pointer to next node in list */
} H5D_virtual_held_file_t;
/* The raw data chunk cache */
-struct H5D_rdcc_ent_t; /* Forward declaration of struct used below */
+struct H5D_rdcc_ent_t; /* Forward declaration of struct used below */
typedef struct H5D_rdcc_t {
struct {
- unsigned ninits; /* Number of chunk creations */
- unsigned nhits; /* Number of cache hits */
- unsigned nmisses; /* Number of cache misses */
- unsigned nflushes; /* Number of cache flushes */
+ unsigned ninits; /* Number of chunk creations */
+ unsigned nhits; /* Number of cache hits */
+ unsigned nmisses; /* Number of cache misses */
+ unsigned nflushes; /* Number of cache flushes */
} stats;
- size_t nbytes_max; /* Maximum cached raw data in bytes */
- size_t nslots; /* Number of chunk slots allocated */
- double w0; /* Chunk preemption policy */
- struct H5D_rdcc_ent_t *head; /* Head of doubly linked list */
- struct H5D_rdcc_ent_t *tail; /* Tail of doubly linked list */
- struct H5D_rdcc_ent_t *tmp_head; /* Head of temporary doubly linked list. Chunks on this list are not in the hash table (slot). The head entry is a sentinel (does not refer to an actual chunk). */
- size_t nbytes_used; /* Current cached raw data in bytes */
- int nused; /* Number of chunk slots in use */
- H5D_chunk_cached_t last; /* Cached copy of last chunk information */
- struct H5D_rdcc_ent_t **slot; /* Chunk slots, each points to a chunk*/
- H5SL_t *sel_chunks; /* Skip list containing information for each chunk selected */
- H5S_t *single_space; /* Dataspace for single element I/O on chunks */
- H5D_chunk_info_t *single_chunk_info; /* Pointer to single chunk's info */
+ size_t nbytes_max; /* Maximum cached raw data in bytes */
+ size_t nslots; /* Number of chunk slots allocated */
+ double w0; /* Chunk preemption policy */
+ struct H5D_rdcc_ent_t *head; /* Head of doubly linked list */
+ struct H5D_rdcc_ent_t *tail; /* Tail of doubly linked list */
+ struct H5D_rdcc_ent_t
+ *tmp_head; /* Head of temporary doubly linked list. Chunks on this list are not in the hash table
+ (slot). The head entry is a sentinel (does not refer to an actual chunk). */
+ size_t nbytes_used; /* Current cached raw data in bytes */
+ int nused; /* Number of chunk slots in use */
+ H5D_chunk_cached_t last; /* Cached copy of last chunk information */
+ struct H5D_rdcc_ent_t **slot; /* Chunk slots, each points to a chunk*/
+ H5SL_t * sel_chunks; /* Skip list containing information for each chunk selected */
+ H5S_t * single_space; /* Dataspace for single element I/O on chunks */
+ H5D_chunk_info_t * single_chunk_info; /* Pointer to single chunk's info */
/* Cached information about scaled dataspace dimensions */
- hsize_t scaled_dims[H5S_MAX_RANK]; /* The scaled dim sizes */
- hsize_t scaled_power2up[H5S_MAX_RANK]; /* The scaled dim sizes, rounded up to next power of 2 */
- unsigned scaled_encode_bits[H5S_MAX_RANK]; /* The number of bits needed to encode the scaled dim sizes */
+ hsize_t scaled_dims[H5S_MAX_RANK]; /* The scaled dim sizes */
+ hsize_t scaled_power2up[H5S_MAX_RANK]; /* The scaled dim sizes, rounded up to next power of 2 */
+ unsigned scaled_encode_bits[H5S_MAX_RANK]; /* The number of bits needed to encode the scaled dim sizes */
} H5D_rdcc_t;
/* The raw data contiguous data cache */
typedef struct H5D_rdcdc_t {
- unsigned char *sieve_buf; /* Buffer to hold data sieve buffer */
- haddr_t sieve_loc; /* File location (offset) of the data sieve buffer */
- size_t sieve_size; /* Size of the data sieve buffer used (in bytes) */
- size_t sieve_buf_size; /* Size of the data sieve buffer allocated (in bytes) */
- hbool_t sieve_dirty; /* Flag to indicate that the data sieve buffer is dirty */
+ unsigned char *sieve_buf; /* Buffer to hold data sieve buffer */
+ haddr_t sieve_loc; /* File location (offset) of the data sieve buffer */
+ size_t sieve_size; /* Size of the data sieve buffer used (in bytes) */
+ size_t sieve_buf_size; /* Size of the data sieve buffer allocated (in bytes) */
+ hbool_t sieve_dirty; /* Flag to indicate that the data sieve buffer is dirty */
} H5D_rdcdc_t;
/*
@@ -437,86 +439,86 @@ typedef struct H5D_rdcdc_t {
* there will be two IDs and two H5D_t structs, both sharing one H5D_shared_t.
*/
struct H5D_shared_t {
- size_t fo_count; /* Reference count */
- hbool_t closing; /* Flag to indicate dataset is closing */
- hid_t type_id; /* ID for dataset's datatype */
- H5T_t *type; /* Datatype for this dataset */
- H5S_t *space; /* Dataspace of this dataset */
- hid_t dcpl_id; /* Dataset creation property id */
- hid_t dapl_id; /* Dataset access property id */
- H5D_dcpl_cache_t dcpl_cache; /* Cached DCPL values */
- H5O_layout_t layout; /* Data layout */
- hbool_t checked_filters;/* TRUE if dataset passes can_apply check */
+ size_t fo_count; /* Reference count */
+ hbool_t closing; /* Flag to indicate dataset is closing */
+ hid_t type_id; /* ID for dataset's datatype */
+ H5T_t * type; /* Datatype for this dataset */
+ H5S_t * space; /* Dataspace of this dataset */
+ hid_t dcpl_id; /* Dataset creation property id */
+ hid_t dapl_id; /* Dataset access property id */
+ H5D_dcpl_cache_t dcpl_cache; /* Cached DCPL values */
+ H5O_layout_t layout; /* Data layout */
+ hbool_t checked_filters; /* TRUE if dataset passes can_apply check */
/* Cached dataspace info */
- unsigned ndims; /* The dataset's dataspace rank */
- hsize_t curr_dims[H5S_MAX_RANK]; /* The curr. size of dataset dimensions */
- hsize_t curr_power2up[H5S_MAX_RANK]; /* The curr. dim sizes, rounded up to next power of 2 */
- hsize_t max_dims[H5S_MAX_RANK]; /* The max. size of dataset dimensions */
+ unsigned ndims; /* The dataset's dataspace rank */
+ hsize_t curr_dims[H5S_MAX_RANK]; /* The curr. size of dataset dimensions */
+ hsize_t curr_power2up[H5S_MAX_RANK]; /* The curr. dim sizes, rounded up to next power of 2 */
+ hsize_t max_dims[H5S_MAX_RANK]; /* The max. size of dataset dimensions */
/* Buffered/cached information for types of raw data storage*/
struct {
- H5D_rdcdc_t contig; /* Information about contiguous data */
- /* (Note that the "contig" cache
- * information can be used by a chunked
- * dataset in certain circumstances)
- */
- H5D_rdcc_t chunk; /* Information about chunked data */
+ H5D_rdcdc_t contig; /* Information about contiguous data */
+ /* (Note that the "contig" cache
+ * information can be used by a chunked
+ * dataset in certain circumstances)
+ */
+ H5D_rdcc_t chunk; /* Information about chunked data */
} cache;
- H5D_append_flush_t append_flush; /* Append flush property information */
- char *extfile_prefix; /* expanded external file prefix */
- char *vds_prefix; /* expanded vds prefix */
+ H5D_append_flush_t append_flush; /* Append flush property information */
+ char * extfile_prefix; /* expanded external file prefix */
+ char * vds_prefix; /* expanded vds prefix */
};
struct H5D_t {
- H5O_loc_t oloc; /* Object header location */
- H5G_name_t path; /* Group hierarchy path */
- H5D_shared_t *shared; /* cached information from file */
+ H5O_loc_t oloc; /* Object header location */
+ H5G_name_t path; /* Group hierarchy path */
+ H5D_shared_t *shared; /* cached information from file */
};
/* Enumerated type for allocating dataset's storage */
typedef enum {
- H5D_ALLOC_CREATE, /* Dataset is being created */
- H5D_ALLOC_OPEN, /* Dataset is being opened */
- H5D_ALLOC_EXTEND, /* Dataset's dataspace is being extended */
- H5D_ALLOC_WRITE /* Dataset is being extended */
+ H5D_ALLOC_CREATE, /* Dataset is being created */
+ H5D_ALLOC_OPEN, /* Dataset is being opened */
+ H5D_ALLOC_EXTEND, /* Dataset's dataspace is being extended */
+ H5D_ALLOC_WRITE /* Dataset is being extended */
} H5D_time_alloc_t;
-
/* Typedef for dataset creation operation */
typedef struct {
- hid_t type_id; /* Datatype for dataset */
- const H5S_t *space; /* Dataspace for dataset */
- hid_t dcpl_id; /* Dataset creation property list */
- hid_t dapl_id; /* Dataset access property list */
+ hid_t type_id; /* Datatype for dataset */
+ const H5S_t *space; /* Dataspace for dataset */
+ hid_t dcpl_id; /* Dataset creation property list */
+ hid_t dapl_id; /* Dataset access property list */
} H5D_obj_create_t;
/* Typedef for filling a buffer with a fill value */
typedef struct H5D_fill_buf_info_t {
- H5MM_allocate_t fill_alloc_func; /* Routine to call for allocating fill buffer */
- void *fill_alloc_info; /* Extra info for allocation routine */
- H5MM_free_t fill_free_func; /* Routine to call for freeing fill buffer */
- void *fill_free_info; /* Extra info for free routine */
- H5T_path_t *fill_to_mem_tpath; /* Datatype conversion path for converting the fill value to the memory buffer */
- H5T_path_t *mem_to_dset_tpath; /* Datatype conversion path for converting the memory buffer to the dataset elements */
- const H5O_fill_t *fill; /* Pointer to fill value */
- void *fill_buf; /* Fill buffer */
- size_t fill_buf_size; /* Size of fill buffer */
- hbool_t use_caller_fill_buf; /* Whether the caller provided the fill buffer */
- void *bkg_buf; /* Background conversion buffer */
- size_t bkg_buf_size; /* Size of background buffer */
- H5T_t *mem_type; /* Pointer to memory datatype */
- const H5T_t *file_type; /* Pointer to file datatype */
- hid_t mem_tid; /* ID for memory version of disk datatype */
- hid_t file_tid; /* ID for disk datatype */
- size_t mem_elmt_size, file_elmt_size; /* Size of element in memory and on disk */
- size_t max_elmt_size; /* Max. size of memory or file datatype */
- size_t elmts_per_buf; /* # of elements that fit into a buffer */
- hbool_t has_vlen_fill_type; /* Whether the datatype for the fill value has a variable-length component */
+ H5MM_allocate_t fill_alloc_func; /* Routine to call for allocating fill buffer */
+ void * fill_alloc_info; /* Extra info for allocation routine */
+ H5MM_free_t fill_free_func; /* Routine to call for freeing fill buffer */
+ void * fill_free_info; /* Extra info for free routine */
+ H5T_path_t
+ *fill_to_mem_tpath; /* Datatype conversion path for converting the fill value to the memory buffer */
+ H5T_path_t *mem_to_dset_tpath; /* Datatype conversion path for converting the memory buffer to the dataset
+ elements */
+ const H5O_fill_t *fill; /* Pointer to fill value */
+ void * fill_buf; /* Fill buffer */
+ size_t fill_buf_size; /* Size of fill buffer */
+ hbool_t use_caller_fill_buf; /* Whether the caller provided the fill buffer */
+ void * bkg_buf; /* Background conversion buffer */
+ size_t bkg_buf_size; /* Size of background buffer */
+ H5T_t * mem_type; /* Pointer to memory datatype */
+ const H5T_t * file_type; /* Pointer to file datatype */
+ hid_t mem_tid; /* ID for memory version of disk datatype */
+ hid_t file_tid; /* ID for disk datatype */
+ size_t mem_elmt_size, file_elmt_size; /* Size of element in memory and on disk */
+ size_t max_elmt_size; /* Max. size of memory or file datatype */
+ size_t elmts_per_buf; /* # of elements that fit into a buffer */
+ hbool_t has_vlen_fill_type; /* Whether the datatype for the fill value has a variable-length component */
} H5D_fill_buf_info_t;
-
/*****************************/
/* Package Private Variables */
/*****************************/
@@ -543,166 +545,149 @@ H5_DLLVAR const H5B2_class_t H5D_BT2_FILT[1];
/* Array of versions for Layout */
H5_DLLVAR const unsigned H5O_layout_ver_bounds[H5F_LIBVER_NBOUNDS];
-
/******************************/
/* Package Private Prototypes */
/******************************/
-H5_DLL H5D_t *H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space,
- hid_t dcpl_id, hid_t dapl_id);
-H5_DLL H5D_t *H5D__create_named(const H5G_loc_t *loc, const char *name,
- hid_t type_id, const H5S_t *space, hid_t lcpl_id, hid_t dcpl_id,
- hid_t dapl_id);
-H5_DLL H5D_t *H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id);
-H5_DLL hid_t H5D__get_space(const H5D_t *dset);
-H5_DLL hid_t H5D__get_type(const H5D_t *dset);
-H5_DLL herr_t H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation);
-H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hbool_t full_overwrite, hsize_t old_dim[]);
-H5_DLL herr_t H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size);
-H5_DLL herr_t H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage_size);
-H5_DLL herr_t H5D__get_num_chunks(const H5D_t *dset, const H5S_t *space, hsize_t *nchunks);
-H5_DLL herr_t H5D__get_chunk_info(const H5D_t *dset, const H5S_t *space, hsize_t chk_idx, hsize_t *coord, unsigned *filter_mask, haddr_t *offset, hsize_t *size);
-H5_DLL herr_t H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size);
+H5_DLL H5D_t *H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t dapl_id);
+H5_DLL H5D_t *H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, const H5S_t *space,
+ hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id);
+H5_DLL H5D_t * H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id);
+H5_DLL hid_t H5D__get_space(const H5D_t *dset);
+H5_DLL hid_t H5D__get_type(const H5D_t *dset);
+H5_DLL herr_t H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation);
+H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
+ hbool_t full_overwrite, hsize_t old_dim[]);
+H5_DLL herr_t H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size);
+H5_DLL herr_t H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage_size);
+H5_DLL herr_t H5D__get_num_chunks(const H5D_t *dset, const H5S_t *space, hsize_t *nchunks);
+H5_DLL herr_t H5D__get_chunk_info(const H5D_t *dset, const H5S_t *space, hsize_t chk_idx, hsize_t *coord,
+ unsigned *filter_mask, haddr_t *offset, hsize_t *size);
+H5_DLL herr_t H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *coord, unsigned *filter_mask,
+ haddr_t *addr, hsize_t *size);
H5_DLL haddr_t H5D__get_offset(const H5D_t *dset);
-H5_DLL herr_t H5D__vlen_get_buf_size(H5D_t *dset, hid_t type_id, hid_t space_id, hsize_t *size);
-H5_DLL herr_t H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id, hsize_t *size);
-H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size);
-H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset);
-H5_DLL herr_t H5D__flush_real(H5D_t *dataset);
-H5_DLL herr_t H5D__flush(H5D_t *dset, hid_t dset_id);
-H5_DLL herr_t H5D__mark(const H5D_t *dataset, unsigned flags);
-H5_DLL herr_t H5D__refresh(hid_t dset_id, H5D_t *dataset);
+H5_DLL herr_t H5D__vlen_get_buf_size(H5D_t *dset, hid_t type_id, hid_t space_id, hsize_t *size);
+H5_DLL herr_t H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id,
+ hsize_t *size);
+H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size);
+H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset);
+H5_DLL herr_t H5D__flush_real(H5D_t *dataset);
+H5_DLL herr_t H5D__flush(H5D_t *dset, hid_t dset_id);
+H5_DLL herr_t H5D__mark(const H5D_t *dataset, unsigned flags);
+H5_DLL herr_t H5D__refresh(hid_t dset_id, H5D_t *dataset);
/* To convert a dataset's chunk indexing type to v1 B-tree */
H5_DLL herr_t H5D__format_convert(H5D_t *dataset);
/* Internal I/O routines */
-H5_DLL herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id,
- const H5S_t *mem_space, const H5S_t *file_space, void *buf/*out*/);
-H5_DLL herr_t H5D__write(H5D_t *dataset, hid_t mem_type_id,
- const H5S_t *mem_space, const H5S_t *file_space, const void *buf);
+H5_DLL herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space,
+ void *buf /*out*/);
+H5_DLL herr_t H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space,
+ const void *buf);
/* Functions that perform direct serial I/O operations */
-H5_DLL herr_t H5D__select_read(const H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
-H5_DLL herr_t H5D__select_write(const H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
+H5_DLL herr_t H5D__select_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space);
+H5_DLL herr_t H5D__select_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
/* Functions that perform scatter-gather serial I/O operations */
-H5_DLL herr_t H5D__scatter_mem(const void *_tscat_buf, H5S_sel_iter_t *iter,
- size_t nelmts, void *_buf);
-H5_DLL size_t H5D__gather_mem(const void *_buf, H5S_sel_iter_t *iter,
- size_t nelmts, void *_tgath_buf/*out*/);
-H5_DLL herr_t H5D__scatgath_read(const H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
-H5_DLL herr_t H5D__scatgath_write(const H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
+H5_DLL herr_t H5D__scatter_mem(const void *_tscat_buf, H5S_sel_iter_t *iter, size_t nelmts, void *_buf);
+H5_DLL size_t H5D__gather_mem(const void *_buf, H5S_sel_iter_t *iter, size_t nelmts,
+ void *_tgath_buf /*out*/);
+H5_DLL herr_t H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
+H5_DLL herr_t H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
/* Functions that operate on dataset's layout information */
H5_DLL herr_t H5D__layout_set_io_ops(const H5D_t *dataset);
-H5_DLL size_t H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout,
- hbool_t include_compact_data);
+H5_DLL size_t H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t include_compact_data);
H5_DLL herr_t H5D__layout_set_version(H5F_t *f, H5O_layout_t *layout);
-H5_DLL herr_t H5D__layout_set_latest_indexing(H5O_layout_t *layout,
- const H5S_t *space, const H5D_dcpl_cache_t *dcpl_cache);
-H5_DLL herr_t H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset,
- hid_t dapl_id);
-H5_DLL herr_t H5D__layout_oh_read(H5D_t *dset, hid_t dapl_id,
- H5P_genplist_t *plist);
+H5_DLL herr_t H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space,
+ const H5D_dcpl_cache_t *dcpl_cache);
+H5_DLL herr_t H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id);
+H5_DLL herr_t H5D__layout_oh_read(H5D_t *dset, hid_t dapl_id, H5P_genplist_t *plist);
H5_DLL herr_t H5D__layout_oh_write(const H5D_t *dataset, H5O_t *oh, unsigned update_flags);
/* Functions that operate on contiguous storage */
-H5_DLL herr_t H5D__contig_alloc(H5F_t *f, H5O_storage_contig_t *storage);
+H5_DLL herr_t H5D__contig_alloc(H5F_t *f, H5O_storage_contig_t *storage);
H5_DLL hbool_t H5D__contig_is_space_alloc(const H5O_storage_t *storage);
H5_DLL hbool_t H5D__contig_is_data_cached(const H5D_shared_t *shared_dset);
-H5_DLL herr_t H5D__contig_fill(const H5D_io_info_t *io_info);
-H5_DLL herr_t H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t *fm);
-H5_DLL herr_t H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t *fm);
-H5_DLL herr_t H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
- H5F_t *f_dst, H5O_storage_contig_t *storage_dst, H5T_t *src_dtype,
- H5O_copy_t *cpy_info);
-H5_DLL herr_t H5D__contig_delete(H5F_t *f, const H5O_storage_t *store);
+H5_DLL herr_t H5D__contig_fill(const H5D_io_info_t *io_info);
+H5_DLL herr_t H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm);
+H5_DLL herr_t H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm);
+H5_DLL herr_t H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f_dst,
+ H5O_storage_contig_t *storage_dst, H5T_t *src_dtype, H5O_copy_t *cpy_info);
+H5_DLL herr_t H5D__contig_delete(H5F_t *f, const H5O_storage_t *store);
/* Functions that operate on chunked dataset storage */
-H5_DLL htri_t H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr,
- hbool_t write_op);
-H5_DLL herr_t H5D__chunk_create(const H5D_t *dset /*in,out*/);
-H5_DLL herr_t H5D__chunk_set_info(const H5D_t *dset);
+H5_DLL htri_t H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_op);
+H5_DLL herr_t H5D__chunk_create(const H5D_t *dset /*in,out*/);
+H5_DLL herr_t H5D__chunk_set_info(const H5D_t *dset);
H5_DLL hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage);
H5_DLL hbool_t H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset);
-H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled,
- H5D_chunk_ud_t *udata);
-H5_DLL herr_t H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes);
-H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]);
-H5_DLL herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk,
- H5F_block_t *new_chunk, hbool_t *need_insert, const hsize_t *scaled);
-H5_DLL herr_t H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]);
-H5_DLL herr_t H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim);
-H5_DLL herr_t H5D__chunk_set_sizes(H5D_t *dset);
+H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udata);
+H5_DLL herr_t H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes);
+H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]);
+H5_DLL herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk,
+ H5F_block_t *new_chunk, hbool_t *need_insert, const hsize_t *scaled);
+H5_DLL herr_t H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]);
+H5_DLL herr_t H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim);
+H5_DLL herr_t H5D__chunk_set_sizes(H5D_t *dset);
#ifdef H5_HAVE_PARALLEL
H5_DLL herr_t H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[]);
#endif /* H5_HAVE_PARALLEL */
H5_DLL herr_t H5D__chunk_update_cache(H5D_t *dset);
-H5_DLL herr_t H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src,
- H5O_layout_chunk_t *layout_src, H5F_t *f_dst, H5O_storage_chunk_t *storage_dst,
- const H5S_extent_t *ds_extent_src, const H5T_t *dt_src,
- const H5O_pline_t *pline_src, H5O_copy_t *cpy_info);
-H5_DLL herr_t H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh,
- H5O_layout_t *layout, hsize_t *btree_size);
+H5_DLL herr_t H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk_t *layout_src,
+ H5F_t *f_dst, H5O_storage_chunk_t *storage_dst,
+ const H5S_extent_t *ds_extent_src, const H5T_t *dt_src,
+ const H5O_pline_t *pline_src, H5O_copy_t *cpy_info);
+H5_DLL herr_t H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5O_layout_t *layout, hsize_t *btree_size);
H5_DLL herr_t H5D__chunk_dump_index(H5D_t *dset, FILE *stream);
H5_DLL herr_t H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *store);
H5_DLL herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy);
-H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters,
- hsize_t *offset, uint32_t data_size, const void *buf);
-H5_DLL herr_t H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset,
- uint32_t *filters, void *buf);
+H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset,
+ uint32_t data_size, const void *buf);
+H5_DLL herr_t H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t *filters, void *buf);
#ifdef H5D_CHUNK_DEBUG
H5_DLL herr_t H5D__chunk_stats(const H5D_t *dset, hbool_t headers);
#endif /* H5D_CHUNK_DEBUG */
/* format convert */
-H5_DLL herr_t H5D__chunk_format_convert(H5D_t *dset, H5D_chk_idx_info_t *idx_info, H5D_chk_idx_info_t *new_idx_info);
+H5_DLL herr_t H5D__chunk_format_convert(H5D_t *dset, H5D_chk_idx_info_t *idx_info,
+ H5D_chk_idx_info_t *new_idx_info);
/* Functions that operate on compact dataset storage */
H5_DLL herr_t H5D__compact_fill(const H5D_t *dset);
-H5_DLL herr_t H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *storage_src,
- H5F_t *f_dst, H5O_storage_compact_t *storage_dst, H5T_t *src_dtype,
- H5O_copy_t *cpy_info);
+H5_DLL herr_t H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *storage_src, H5F_t *f_dst,
+ H5O_storage_compact_t *storage_dst, H5T_t *src_dtype, H5O_copy_t *cpy_info);
/* Functions that operate on virtual dataset storage */
-H5_DLL herr_t H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout);
-H5_DLL herr_t H5D__virtual_copy_layout(H5O_layout_t *layout);
-H5_DLL herr_t H5D__virtual_set_extent_unlim(const H5D_t *dset);
-H5_DLL herr_t H5D__virtual_reset_layout(H5O_layout_t *layout);
-H5_DLL herr_t H5D__virtual_delete(H5F_t *f, H5O_storage_t *storage);
-H5_DLL herr_t H5D__virtual_copy(H5F_t *f_src, H5O_layout_t *layout_dst);
-H5_DLL herr_t H5D__virtual_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id);
+H5_DLL herr_t H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout);
+H5_DLL herr_t H5D__virtual_copy_layout(H5O_layout_t *layout);
+H5_DLL herr_t H5D__virtual_set_extent_unlim(const H5D_t *dset);
+H5_DLL herr_t H5D__virtual_reset_layout(H5O_layout_t *layout);
+H5_DLL herr_t H5D__virtual_delete(H5F_t *f, H5O_storage_t *storage);
+H5_DLL herr_t H5D__virtual_copy(H5F_t *f_src, H5O_layout_t *layout_dst);
+H5_DLL herr_t H5D__virtual_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id);
H5_DLL hbool_t H5D__virtual_is_space_alloc(const H5O_storage_t *storage);
-H5_DLL herr_t H5D__virtual_hold_source_dset_files(const H5D_t *dset,
- H5D_virtual_held_file_t **head);
-H5_DLL herr_t H5D__virtual_refresh_source_dsets(H5D_t *dset);
-H5_DLL herr_t H5D__virtual_release_source_dset_files(H5D_virtual_held_file_t *head);
+H5_DLL herr_t H5D__virtual_hold_source_dset_files(const H5D_t *dset, H5D_virtual_held_file_t **head);
+H5_DLL herr_t H5D__virtual_refresh_source_dsets(H5D_t *dset);
+H5_DLL herr_t H5D__virtual_release_source_dset_files(H5D_virtual_held_file_t *head);
/* Functions that operate on EFL (External File List)*/
H5_DLL hbool_t H5D__efl_is_space_alloc(const H5O_storage_t *storage);
-H5_DLL herr_t H5D__efl_bh_info(H5F_t *f, H5O_efl_t *efl, hsize_t *heap_size);
+H5_DLL herr_t H5D__efl_bh_info(H5F_t *f, H5O_efl_t *efl, hsize_t *heap_size);
/* Functions that perform fill value operations on datasets */
-H5_DLL herr_t H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
- const H5T_t *buf_type, const H5S_t *space);
-H5_DLL herr_t H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf,
- H5MM_allocate_t alloc_func, void *alloc_info,
- H5MM_free_t free_func, void *free_info,
- const H5O_fill_t *fill, const H5T_t *dset_type, hid_t dset_type_id,
- size_t nelmts, size_t min_buf_size);
+H5_DLL herr_t H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_type,
+ const H5S_t *space);
+H5_DLL herr_t H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocate_t alloc_func,
+ void *alloc_info, H5MM_free_t free_func, void *free_info, const H5O_fill_t *fill,
+ const H5T_t *dset_type, hid_t dset_type_id, size_t nelmts, size_t min_buf_size);
H5_DLL herr_t H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts);
H5_DLL herr_t H5D__fill_term(H5D_fill_buf_info_t *fb_info);
@@ -712,38 +697,35 @@ H5_DLL herr_t H5D__fill_term(H5D_fill_buf_info_t *fb_info);
#ifndef H5Dmpio_DEBUG
#define H5Dmpio_DEBUG
#endif /*H5Dmpio_DEBUG*/
-#endif/*H5S_DEBUG*/
+#endif /*H5S_DEBUG*/
/* MPI-IO function to read, it will select either regular or irregular read */
-H5_DLL herr_t H5D__mpio_select_read(const H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
+H5_DLL herr_t H5D__mpio_select_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
/* MPI-IO function to write, it will select either regular or irregular read */
-H5_DLL herr_t H5D__mpio_select_write(const H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
+H5_DLL herr_t H5D__mpio_select_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
/* MPI-IO functions to handle contiguous collective IO */
-H5_DLL herr_t H5D__contig_collective_read(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space,
- const H5S_t *mem_space, H5D_chunk_map_t *fm);
-H5_DLL herr_t H5D__contig_collective_write(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space,
- const H5S_t *mem_space, H5D_chunk_map_t *fm);
+H5_DLL herr_t H5D__contig_collective_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ H5D_chunk_map_t *fm);
+H5_DLL herr_t H5D__contig_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ H5D_chunk_map_t *fm);
/* MPI-IO functions to handle chunked collective IO */
-H5_DLL herr_t H5D__chunk_collective_read(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space,
- const H5S_t *mem_space, H5D_chunk_map_t *fm);
-H5_DLL herr_t H5D__chunk_collective_write(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space,
- const H5S_t *mem_space, H5D_chunk_map_t *fm);
+H5_DLL herr_t H5D__chunk_collective_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ H5D_chunk_map_t *fm);
+H5_DLL herr_t H5D__chunk_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ H5D_chunk_map_t *fm);
/* MPI-IO function to check if a direct I/O transfer is possible between
* memory and the file */
-H5_DLL htri_t H5D__mpio_opt_possible(const H5D_io_info_t *io_info,
- const H5S_t *file_space, const H5S_t *mem_space,
- const H5D_type_info_t *type_info);
+H5_DLL htri_t H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space,
+ const H5S_t *mem_space, const H5D_type_info_t *type_info);
#endif /* H5_HAVE_PARALLEL */
@@ -758,4 +740,3 @@ H5_DLL herr_t H5D__current_cache_size_test(hid_t did, size_t *nbytes_used, int *
#endif /* H5D_TESTING */
#endif /*_H5Dpkg_H*/
-
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index 9a5277f..6a130b6 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -21,11 +21,10 @@
#include "H5Dpublic.h"
/* Private headers needed by this file */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Sprivate.h" /* Dataspaces */
-#include "H5Zprivate.h" /* Data filters */
-
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Sprivate.h" /* Dataspaces */
+#include "H5Zprivate.h" /* Data filters */
/**************************/
/* Library Private Macros */
@@ -37,89 +36,90 @@
* to have any effect.
*/
#ifdef NDEBUG
-# undef H5D_DEBUG
+#undef H5D_DEBUG
#endif
/* ======== Dataset creation property names ======== */
-#define H5D_CRT_LAYOUT_NAME "layout" /* Storage layout */
-#define H5D_CRT_FILL_VALUE_NAME "fill_value" /* Fill value */
-#define H5D_CRT_ALLOC_TIME_STATE_NAME "alloc_time_state" /* Space allocation time state */
-#define H5D_CRT_EXT_FILE_LIST_NAME "efl" /* External file list */
-#define H5D_CRT_MIN_DSET_HDR_SIZE_NAME "dset_oh_minimize"/* Minimize object header */
+#define H5D_CRT_LAYOUT_NAME "layout" /* Storage layout */
+#define H5D_CRT_FILL_VALUE_NAME "fill_value" /* Fill value */
+#define H5D_CRT_ALLOC_TIME_STATE_NAME "alloc_time_state" /* Space allocation time state */
+#define H5D_CRT_EXT_FILE_LIST_NAME "efl" /* External file list */
+#define H5D_CRT_MIN_DSET_HDR_SIZE_NAME "dset_oh_minimize" /* Minimize object header */
/* ======== Dataset access property names ======== */
-#define H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots" /* Size of raw data chunk cache(slots) */
-#define H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes" /* Size of raw data chunk cache(bytes) */
-#define H5D_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */
-#define H5D_ACS_VDS_VIEW_NAME "vds_view" /* VDS view option */
-#define H5D_ACS_VDS_PRINTF_GAP_NAME "vds_printf_gap" /* VDS printf gap size */
-#define H5D_ACS_VDS_PREFIX_NAME "vds_prefix" /* VDS file prefix */
-#define H5D_ACS_APPEND_FLUSH_NAME "append_flush" /* Append flush actions */
-#define H5D_ACS_EFILE_PREFIX_NAME "external file prefix" /* External file prefix */
+#define H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots" /* Size of raw data chunk cache(slots) */
+#define H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes" /* Size of raw data chunk cache(bytes) */
+#define H5D_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */
+#define H5D_ACS_VDS_VIEW_NAME "vds_view" /* VDS view option */
+#define H5D_ACS_VDS_PRINTF_GAP_NAME "vds_printf_gap" /* VDS printf gap size */
+#define H5D_ACS_VDS_PREFIX_NAME "vds_prefix" /* VDS file prefix */
+#define H5D_ACS_APPEND_FLUSH_NAME "append_flush" /* Append flush actions */
+#define H5D_ACS_EFILE_PREFIX_NAME "external file prefix" /* External file prefix */
/* ======== Data transfer properties ======== */
-#define H5D_XFER_MAX_TEMP_BUF_NAME "max_temp_buf" /* Maximum temp buffer size */
-#define H5D_XFER_TCONV_BUF_NAME "tconv_buf" /* Type conversion buffer */
-#define H5D_XFER_BKGR_BUF_NAME "bkgr_buf" /* Background buffer */
-#define H5D_XFER_BKGR_BUF_TYPE_NAME "bkgr_buf_type" /* Background buffer type */
-#define H5D_XFER_BTREE_SPLIT_RATIO_NAME "btree_split_ratio" /* B-tree node splitting ratio */
-#define H5D_XFER_VLEN_ALLOC_NAME "vlen_alloc" /* Vlen allocation function */
-#define H5D_XFER_VLEN_ALLOC_INFO_NAME "vlen_alloc_info" /* Vlen allocation info */
-#define H5D_XFER_VLEN_FREE_NAME "vlen_free" /* Vlen free function */
-#define H5D_XFER_VLEN_FREE_INFO_NAME "vlen_free_info" /* Vlen free info */
-#define H5D_XFER_VFL_ID_NAME "vfl_id" /* File driver ID */
-#define H5D_XFER_VFL_INFO_NAME "vfl_info" /* File driver info */
-#define H5D_XFER_HYPER_VECTOR_SIZE_NAME "vec_size" /* Hyperslab vector size */
-#define H5D_XFER_IO_XFER_MODE_NAME "io_xfer_mode" /* I/O transfer mode */
-#define H5D_XFER_MPIO_COLLECTIVE_OPT_NAME "mpio_collective_opt" /* Optimization of MPI-IO transfer mode */
-#define H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME "mpio_chunk_opt_hard"
-#define H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME "mpio_chunk_opt_num"
-#define H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME "mpio_chunk_opt_ratio"
+#define H5D_XFER_MAX_TEMP_BUF_NAME "max_temp_buf" /* Maximum temp buffer size */
+#define H5D_XFER_TCONV_BUF_NAME "tconv_buf" /* Type conversion buffer */
+#define H5D_XFER_BKGR_BUF_NAME "bkgr_buf" /* Background buffer */
+#define H5D_XFER_BKGR_BUF_TYPE_NAME "bkgr_buf_type" /* Background buffer type */
+#define H5D_XFER_BTREE_SPLIT_RATIO_NAME "btree_split_ratio" /* B-tree node splitting ratio */
+#define H5D_XFER_VLEN_ALLOC_NAME "vlen_alloc" /* Vlen allocation function */
+#define H5D_XFER_VLEN_ALLOC_INFO_NAME "vlen_alloc_info" /* Vlen allocation info */
+#define H5D_XFER_VLEN_FREE_NAME "vlen_free" /* Vlen free function */
+#define H5D_XFER_VLEN_FREE_INFO_NAME "vlen_free_info" /* Vlen free info */
+#define H5D_XFER_VFL_ID_NAME "vfl_id" /* File driver ID */
+#define H5D_XFER_VFL_INFO_NAME "vfl_info" /* File driver info */
+#define H5D_XFER_HYPER_VECTOR_SIZE_NAME "vec_size" /* Hyperslab vector size */
+#define H5D_XFER_IO_XFER_MODE_NAME "io_xfer_mode" /* I/O transfer mode */
+#define H5D_XFER_MPIO_COLLECTIVE_OPT_NAME "mpio_collective_opt" /* Optimization of MPI-IO transfer mode */
+#define H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME "mpio_chunk_opt_hard"
+#define H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME "mpio_chunk_opt_num"
+#define H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME "mpio_chunk_opt_ratio"
#define H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME "actual_chunk_opt_mode"
-#define H5D_MPIO_ACTUAL_IO_MODE_NAME "actual_io_mode"
-#define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME "local_no_collective_cause" /* cause of broken collective I/O in each process */
-#define H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME "global_no_collective_cause" /* cause of broken collective I/O in all processes */
-#define H5D_XFER_EDC_NAME "err_detect" /* EDC */
-#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */
-#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */
-#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */
+#define H5D_MPIO_ACTUAL_IO_MODE_NAME "actual_io_mode"
+#define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME \
+ "local_no_collective_cause" /* cause of broken collective I/O in each process */
+#define H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME \
+ "global_no_collective_cause" /* cause of broken collective I/O in all processes */
+#define H5D_XFER_EDC_NAME "err_detect" /* EDC */
+#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */
+#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */
+#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
/* Collective chunk instrumentation properties */
-#define H5D_XFER_COLL_CHUNK_LINK_HARD_NAME "coll_chunk_link_hard"
-#define H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME "coll_chunk_multi_hard"
-#define H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME "coll_chunk_link_true"
-#define H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME "coll_chunk_link_false"
+#define H5D_XFER_COLL_CHUNK_LINK_HARD_NAME "coll_chunk_link_hard"
+#define H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME "coll_chunk_multi_hard"
+#define H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME "coll_chunk_link_true"
+#define H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME "coll_chunk_link_false"
#define H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME "coll_chunk_multi_coll"
-#define H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME "coll_chunk_multi_ind"
+#define H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME "coll_chunk_multi_ind"
/* Definitions for all collective chunk instrumentation properties */
-#define H5D_XFER_COLL_CHUNK_SIZE sizeof(unsigned)
-#define H5D_XFER_COLL_CHUNK_DEF 1
+#define H5D_XFER_COLL_CHUNK_SIZE sizeof(unsigned)
+#define H5D_XFER_COLL_CHUNK_DEF 1
/* General collective I/O instrumentation properties */
-#define H5D_XFER_COLL_RANK0_BCAST_NAME "coll_rank0_bcast"
+#define H5D_XFER_COLL_RANK0_BCAST_NAME "coll_rank0_bcast"
/* Definitions for general collective I/O instrumentation properties */
-#define H5D_XFER_COLL_RANK0_BCAST_SIZE sizeof(hbool_t)
-#define H5D_XFER_COLL_RANK0_BCAST_DEF FALSE
+#define H5D_XFER_COLL_RANK0_BCAST_SIZE sizeof(hbool_t)
+#define H5D_XFER_COLL_RANK0_BCAST_DEF FALSE
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
/* Default temporary buffer size */
-#define H5D_TEMP_BUF_SIZE (1024 * 1024)
+#define H5D_TEMP_BUF_SIZE (1024 * 1024)
/* Default I/O vector size */
-#define H5D_IO_VECTOR_SIZE 1024
+#define H5D_IO_VECTOR_SIZE 1024
/* Default VL allocation & free info */
-#define H5D_VLEN_ALLOC NULL
-#define H5D_VLEN_ALLOC_INFO NULL
-#define H5D_VLEN_FREE NULL
-#define H5D_VLEN_FREE_INFO NULL
+#define H5D_VLEN_ALLOC NULL
+#define H5D_VLEN_ALLOC_INFO NULL
+#define H5D_VLEN_FREE NULL
+#define H5D_VLEN_FREE_INFO NULL
/* Default virtual dataset list size */
#define H5D_VIRTUAL_DEF_LIST_SIZE 8
-
/****************************/
/* Library Private Typedefs */
/****************************/
@@ -129,32 +129,30 @@ typedef struct H5D_t H5D_t;
/* Typedef for cached dataset creation property list information */
typedef struct H5D_dcpl_cache_t {
- H5O_fill_t fill; /* Fill value info (H5D_CRT_FILL_VALUE_NAME) */
- H5O_pline_t pline; /* I/O pipeline info (H5O_CRT_PIPELINE_NAME) */
- H5O_efl_t efl; /* External file list info (H5D_CRT_EXT_FILE_LIST_NAME) */
+ H5O_fill_t fill; /* Fill value info (H5D_CRT_FILL_VALUE_NAME) */
+ H5O_pline_t pline; /* I/O pipeline info (H5O_CRT_PIPELINE_NAME) */
+ H5O_efl_t efl; /* External file list info (H5D_CRT_EXT_FILE_LIST_NAME) */
} H5D_dcpl_cache_t;
/* Callback information for copying datasets */
typedef struct H5D_copy_file_ud_t {
- H5O_copy_file_ud_common_t common; /* Shared information (must be first) */
- struct H5S_extent_t *src_space_extent; /* Copy of dataspace extent for dataset */
- H5T_t *src_dtype; /* Copy of datatype for dataset */
+ H5O_copy_file_ud_common_t common; /* Shared information (must be first) */
+ struct H5S_extent_t * src_space_extent; /* Copy of dataspace extent for dataset */
+ H5T_t * src_dtype; /* Copy of datatype for dataset */
} H5D_copy_file_ud_t;
/* Structure for dataset append flush property (H5Pset_append_flush) */
typedef struct H5D_append_flush_t {
- unsigned ndims; /* The # of dimensions for "boundary" */
- hsize_t boundary[H5S_MAX_RANK]; /* The dimension sizes for determining boundary */
- H5D_append_cb_t func; /* The callback function */
- void *udata; /* User data */
+ unsigned ndims; /* The # of dimensions for "boundary" */
+ hsize_t boundary[H5S_MAX_RANK]; /* The dimension sizes for determining boundary */
+ H5D_append_cb_t func; /* The callback function */
+ void * udata; /* User data */
} H5D_append_flush_t;
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/******************************/
/* Library Private Prototypes */
/******************************/
@@ -166,28 +164,26 @@ H5_DLL herr_t H5D_mult_refresh_close(hid_t dset_id);
H5_DLL herr_t H5D_mult_refresh_reopen(H5D_t *dataset);
H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset);
H5_DLL H5G_name_t *H5D_nameof(const H5D_t *dataset);
-H5_DLL herr_t H5D_flush_all(H5F_t *f);
-H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset);
-H5_DLL hid_t H5D_get_access_plist(const H5D_t *dset);
+H5_DLL herr_t H5D_flush_all(H5F_t *f);
+H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset);
+H5_DLL hid_t H5D_get_access_plist(const H5D_t *dset);
/* Functions that operate on chunked storage */
H5_DLL herr_t H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
/* Functions that operate on virtual storage */
-H5_DLL herr_t H5D_virtual_check_mapping_pre(const H5S_t *vspace,
- const H5S_t *src_space, H5O_virtual_space_status_t space_status);
-H5_DLL herr_t H5D_virtual_check_mapping_post(
- const H5O_storage_virtual_ent_t *ent);
+H5_DLL herr_t H5D_virtual_check_mapping_pre(const H5S_t *vspace, const H5S_t *src_space,
+ H5O_virtual_space_status_t space_status);
+H5_DLL herr_t H5D_virtual_check_mapping_post(const H5O_storage_virtual_ent_t *ent);
H5_DLL herr_t H5D_virtual_check_min_dims(const H5D_t *dset);
H5_DLL herr_t H5D_virtual_update_min_dims(H5O_layout_t *layout, size_t idx);
-H5_DLL herr_t H5D_virtual_parse_source_name(const char *source_name,
- H5O_storage_virtual_name_seg_t **parsed_name, size_t *static_strlen,
- size_t *nsubs);
+H5_DLL herr_t H5D_virtual_parse_source_name(const char * source_name,
+ H5O_storage_virtual_name_seg_t **parsed_name,
+ size_t *static_strlen, size_t *nsubs);
H5_DLL herr_t H5D_virtual_free_parsed_name(H5O_storage_virtual_name_seg_t *name_seg);
/* Functions that operate on indexed storage */
-H5_DLL herr_t H5D_btree_debug(H5F_t *f, haddr_t addr, FILE * stream,
- int indent, int fwidth, unsigned ndims, const uint32_t *dim);
+H5_DLL herr_t H5D_btree_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, unsigned ndims,
+ const uint32_t *dim);
#endif /* _H5Dprivate_H */
-
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index b6ec06d..6a85a95 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -28,12 +28,12 @@
/*****************/
/* Macros used to "unset" chunk cache configuration parameters */
-#define H5D_CHUNK_CACHE_NSLOTS_DEFAULT ((size_t) -1)
-#define H5D_CHUNK_CACHE_NBYTES_DEFAULT ((size_t) -1)
-#define H5D_CHUNK_CACHE_W0_DEFAULT (-1.0f)
+#define H5D_CHUNK_CACHE_NSLOTS_DEFAULT ((size_t)-1)
+#define H5D_CHUNK_CACHE_NBYTES_DEFAULT ((size_t)-1)
+#define H5D_CHUNK_CACHE_W0_DEFAULT (-1.0f)
/* Bit flags for the H5Pset_chunk_opts() and H5Pget_chunk_opts() */
-#define H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS (0x0002u)
+#define H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS (0x0002u)
/*******************/
/* Public Typedefs */
@@ -41,82 +41,80 @@
/* Values for the H5D_LAYOUT property */
typedef enum H5D_layout_t {
- H5D_LAYOUT_ERROR = -1,
+ H5D_LAYOUT_ERROR = -1,
- H5D_COMPACT = 0, /*raw data is very small */
- H5D_CONTIGUOUS = 1, /*the default */
- H5D_CHUNKED = 2, /*slow and fancy */
- H5D_VIRTUAL = 3, /*actual data is stored in other datasets */
- H5D_NLAYOUTS = 4 /*this one must be last! */
+ H5D_COMPACT = 0, /*raw data is very small */
+ H5D_CONTIGUOUS = 1, /*the default */
+ H5D_CHUNKED = 2, /*slow and fancy */
+ H5D_VIRTUAL = 3, /*actual data is stored in other datasets */
+ H5D_NLAYOUTS = 4 /*this one must be last! */
} H5D_layout_t;
/* Types of chunk index data structures */
typedef enum H5D_chunk_index_t {
- H5D_CHUNK_IDX_BTREE = 0, /* v1 B-tree index (default) */
- H5D_CHUNK_IDX_SINGLE = 1, /* Single Chunk index (cur dims[]=max dims[]=chunk dims[]; filtered & non-filtered) */
- H5D_CHUNK_IDX_NONE = 2, /* Implicit: No Index (H5D_ALLOC_TIME_EARLY, non-filtered, fixed dims) */
- H5D_CHUNK_IDX_FARRAY = 3, /* Fixed array (for 0 unlimited dims) */
- H5D_CHUNK_IDX_EARRAY = 4, /* Extensible array (for 1 unlimited dim) */
- H5D_CHUNK_IDX_BT2 = 5, /* v2 B-tree index (for >1 unlimited dims) */
- H5D_CHUNK_IDX_NTYPES /* This one must be last! */
+ H5D_CHUNK_IDX_BTREE = 0, /* v1 B-tree index (default) */
+ H5D_CHUNK_IDX_SINGLE =
+ 1, /* Single Chunk index (cur dims[]=max dims[]=chunk dims[]; filtered & non-filtered) */
+ H5D_CHUNK_IDX_NONE = 2, /* Implicit: No Index (H5D_ALLOC_TIME_EARLY, non-filtered, fixed dims) */
+ H5D_CHUNK_IDX_FARRAY = 3, /* Fixed array (for 0 unlimited dims) */
+ H5D_CHUNK_IDX_EARRAY = 4, /* Extensible array (for 1 unlimited dim) */
+ H5D_CHUNK_IDX_BT2 = 5, /* v2 B-tree index (for >1 unlimited dims) */
+ H5D_CHUNK_IDX_NTYPES /* This one must be last! */
} H5D_chunk_index_t;
/* Values for the space allocation time property */
typedef enum H5D_alloc_time_t {
- H5D_ALLOC_TIME_ERROR = -1,
- H5D_ALLOC_TIME_DEFAULT = 0,
- H5D_ALLOC_TIME_EARLY = 1,
- H5D_ALLOC_TIME_LATE = 2,
- H5D_ALLOC_TIME_INCR = 3
+ H5D_ALLOC_TIME_ERROR = -1,
+ H5D_ALLOC_TIME_DEFAULT = 0,
+ H5D_ALLOC_TIME_EARLY = 1,
+ H5D_ALLOC_TIME_LATE = 2,
+ H5D_ALLOC_TIME_INCR = 3
} H5D_alloc_time_t;
/* Values for the status of space allocation */
typedef enum H5D_space_status_t {
- H5D_SPACE_STATUS_ERROR = -1,
- H5D_SPACE_STATUS_NOT_ALLOCATED = 0,
- H5D_SPACE_STATUS_PART_ALLOCATED = 1,
- H5D_SPACE_STATUS_ALLOCATED = 2
+ H5D_SPACE_STATUS_ERROR = -1,
+ H5D_SPACE_STATUS_NOT_ALLOCATED = 0,
+ H5D_SPACE_STATUS_PART_ALLOCATED = 1,
+ H5D_SPACE_STATUS_ALLOCATED = 2
} H5D_space_status_t;
/* Values for time of writing fill value property */
typedef enum H5D_fill_time_t {
- H5D_FILL_TIME_ERROR = -1,
+ H5D_FILL_TIME_ERROR = -1,
H5D_FILL_TIME_ALLOC = 0,
- H5D_FILL_TIME_NEVER = 1,
- H5D_FILL_TIME_IFSET = 2
+ H5D_FILL_TIME_NEVER = 1,
+ H5D_FILL_TIME_IFSET = 2
} H5D_fill_time_t;
/* Values for fill value status */
typedef enum H5D_fill_value_t {
- H5D_FILL_VALUE_ERROR =-1,
- H5D_FILL_VALUE_UNDEFINED =0,
- H5D_FILL_VALUE_DEFAULT =1,
- H5D_FILL_VALUE_USER_DEFINED =2
+ H5D_FILL_VALUE_ERROR = -1,
+ H5D_FILL_VALUE_UNDEFINED = 0,
+ H5D_FILL_VALUE_DEFAULT = 1,
+ H5D_FILL_VALUE_USER_DEFINED = 2
} H5D_fill_value_t;
/* Values for VDS bounds option */
typedef enum H5D_vds_view_t {
- H5D_VDS_ERROR = -1,
- H5D_VDS_FIRST_MISSING = 0,
- H5D_VDS_LAST_AVAILABLE = 1
+ H5D_VDS_ERROR = -1,
+ H5D_VDS_FIRST_MISSING = 0,
+ H5D_VDS_LAST_AVAILABLE = 1
} H5D_vds_view_t;
/* Callback for H5Pset_append_flush() in a dataset access property list */
typedef herr_t (*H5D_append_cb_t)(hid_t dataset_id, hsize_t *cur_dims, void *op_data);
/* Define the operator function pointer for H5Diterate() */
-typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim,
- const hsize_t *point, void *operator_data);
+typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point,
+ void *operator_data);
/* Define the operator function pointer for H5Dscatter() */
-typedef herr_t (*H5D_scatter_func_t)(const void **src_buf/*out*/,
- size_t *src_buf_bytes_used/*out*/,
+typedef herr_t (*H5D_scatter_func_t)(const void **src_buf /*out*/, size_t *src_buf_bytes_used /*out*/,
void *op_data);
/* Define the operator function pointer for H5Dgather() */
-typedef herr_t (*H5D_gather_func_t)(const void *dst_buf,
- size_t dst_buf_bytes_used, void *op_data);
-
+typedef herr_t (*H5D_gather_func_t)(const void *dst_buf, size_t dst_buf_bytes_used, void *op_data);
/********************/
/* Public Variables */
@@ -129,44 +127,43 @@ typedef herr_t (*H5D_gather_func_t)(const void *dst_buf,
extern "C" {
#endif
-H5_DLL hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id,
- hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id);
-H5_DLL hid_t H5Dcreate_anon(hid_t file_id, hid_t type_id, hid_t space_id,
- hid_t plist_id, hid_t dapl_id);
-H5_DLL hid_t H5Dopen2(hid_t file_id, const char *name, hid_t dapl_id);
-H5_DLL herr_t H5Dclose(hid_t dset_id);
-H5_DLL hid_t H5Dget_space(hid_t dset_id);
-H5_DLL herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation);
-H5_DLL hid_t H5Dget_type(hid_t dset_id);
-H5_DLL hid_t H5Dget_create_plist(hid_t dset_id);
-H5_DLL hid_t H5Dget_access_plist(hid_t dset_id);
+H5_DLL hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t lcpl_id,
+ hid_t dcpl_id, hid_t dapl_id);
+H5_DLL hid_t H5Dcreate_anon(hid_t file_id, hid_t type_id, hid_t space_id, hid_t plist_id, hid_t dapl_id);
+H5_DLL hid_t H5Dopen2(hid_t file_id, const char *name, hid_t dapl_id);
+H5_DLL herr_t H5Dclose(hid_t dset_id);
+H5_DLL hid_t H5Dget_space(hid_t dset_id);
+H5_DLL herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation);
+H5_DLL hid_t H5Dget_type(hid_t dset_id);
+H5_DLL hid_t H5Dget_create_plist(hid_t dset_id);
+H5_DLL hid_t H5Dget_access_plist(hid_t dset_id);
H5_DLL hsize_t H5Dget_storage_size(hid_t dset_id);
-H5_DLL herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes);
-H5_DLL herr_t H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks);
-H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size);
-H5_DLL herr_t H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_idx, hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size);
+H5_DLL herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes);
+H5_DLL herr_t H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks);
+H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *coord, unsigned *filter_mask,
+ haddr_t *addr, hsize_t *size);
+H5_DLL herr_t H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_idx, hsize_t *coord,
+ unsigned *filter_mask, haddr_t *addr, hsize_t *size);
H5_DLL haddr_t H5Dget_offset(hid_t dset_id);
-H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
- hid_t file_space_id, hid_t plist_id, void *buf/*out*/);
-H5_DLL herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
- hid_t file_space_id, hid_t plist_id, const void *buf);
-H5_DLL herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters,
- const hsize_t *offset, size_t data_size, const void *buf);
-H5_DLL herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id,
- const hsize_t *offset, uint32_t *filters, void *buf);
-H5_DLL herr_t H5Diterate(void *buf, hid_t type_id, hid_t space_id,
- H5D_operator_t op, void *operator_data);
-H5_DLL herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size);
-H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type, void *buf,
- hid_t buf_type, hid_t space);
-H5_DLL herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]);
-H5_DLL herr_t H5Dflush(hid_t dset_id);
-H5_DLL herr_t H5Drefresh(hid_t dset_id);
-H5_DLL herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
- hid_t dst_space_id, void *dst_buf);
-H5_DLL herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
- size_t dst_buf_size, void *dst_buf, H5D_gather_func_t op, void *op_data);
-H5_DLL herr_t H5Ddebug(hid_t dset_id);
+H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
+ hid_t plist_id, void *buf /*out*/);
+H5_DLL herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
+ hid_t plist_id, const void *buf);
+H5_DLL herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset,
+ size_t data_size, const void *buf);
+H5_DLL herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters,
+ void *buf);
+H5_DLL herr_t H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op, void *operator_data);
+H5_DLL herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size);
+H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type, void *buf, hid_t buf_type, hid_t space);
+H5_DLL herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]);
+H5_DLL herr_t H5Dflush(hid_t dset_id);
+H5_DLL herr_t H5Drefresh(hid_t dset_id);
+H5_DLL herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_id,
+ void *dst_buf);
+H5_DLL herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, size_t dst_buf_size,
+ void *dst_buf, H5D_gather_func_t op, void *op_data);
+H5_DLL herr_t H5Ddebug(hid_t dset_id);
/* Internal API routines */
H5_DLL herr_t H5Dformat_convert(hid_t dset_id);
@@ -185,22 +182,20 @@ H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type);
* These symbols are no longer used in the library.
*/
/* Property names for H5DOwrite_chunk */
-#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME "direct_chunk_flag"
-#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME "direct_chunk_filters"
-#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME "direct_chunk_offset"
-#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME "direct_chunk_datasize"
+#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME "direct_chunk_flag"
+#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME "direct_chunk_filters"
+#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME "direct_chunk_offset"
+#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME "direct_chunk_datasize"
/* Property names for H5DOread_chunk */
-#define H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME "direct_chunk_read_flag"
-#define H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME "direct_chunk_read_offset"
-#define H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME "direct_chunk_read_filters"
+#define H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME "direct_chunk_read_flag"
+#define H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME "direct_chunk_read_offset"
+#define H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME "direct_chunk_read_filters"
/* Typedefs */
-
/* Function prototypes */
-H5_DLL hid_t H5Dcreate1(hid_t file_id, const char *name, hid_t type_id,
- hid_t space_id, hid_t dcpl_id);
-H5_DLL hid_t H5Dopen1(hid_t file_id, const char *name);
+H5_DLL hid_t H5Dcreate1(hid_t file_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id);
+H5_DLL hid_t H5Dopen1(hid_t file_id, const char *name);
H5_DLL herr_t H5Dextend(hid_t dset_id, const hsize_t size[]);
H5_DLL herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf);
@@ -210,4 +205,3 @@ H5_DLL herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, voi
}
#endif
#endif /* _H5Dpublic_H */
-
diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c
index cdf9da2..1a272d8 100644
--- a/src/H5Dscatgath.c
+++ b/src/H5Dscatgath.c
@@ -15,48 +15,42 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Dataset functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5D__scatter_file(const H5D_io_info_t *io_info,
- H5S_sel_iter_t *file_iter, size_t nelmts, const void *buf);
-static size_t H5D__gather_file(const H5D_io_info_t *io_info,
- H5S_sel_iter_t *file_iter, size_t nelmts, void *buf);
-static herr_t H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter,
- const H5D_type_info_t *type_info, void *user_buf/*out*/);
+static herr_t H5D__scatter_file(const H5D_io_info_t *io_info, H5S_sel_iter_t *file_iter, size_t nelmts,
+ const void *buf);
+static size_t H5D__gather_file(const H5D_io_info_t *io_info, H5S_sel_iter_t *file_iter, size_t nelmts,
+ void *buf);
+static herr_t H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter, const H5D_type_info_t *type_info,
+ void *user_buf /*out*/);
static herr_t H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info);
-
/*********************/
/* Package Variables */
/*********************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -70,8 +64,6 @@ H5FL_SEQ_EXTERN(size_t);
/* Declare extern free list to manage sequences of hsize_t */
H5FL_SEQ_EXTERN(hsize_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5D__scatter_file
*
@@ -89,21 +81,20 @@ H5FL_SEQ_EXTERN(hsize_t);
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__scatter_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter,
- size_t nelmts, const void *_buf)
+H5D__scatter_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter, size_t nelmts, const void *_buf)
{
- H5D_io_info_t tmp_io_info; /* Temporary I/O info object */
- hsize_t *off = NULL; /* Pointer to sequence offsets */
- hsize_t mem_off; /* Offset in memory */
- size_t mem_curr_seq; /* "Current sequence" in memory */
- size_t dset_curr_seq; /* "Current sequence" in dataset */
- size_t *len = NULL; /* Array to store sequence lengths */
- size_t orig_mem_len, mem_len; /* Length of sequence in memory */
- size_t nseq; /* Number of sequences generated */
- size_t nelem; /* Number of elements used in sequences */
- size_t dxpl_vec_size; /* Vector length from API context's DXPL */
- size_t vec_size; /* Vector length */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_io_info_t tmp_io_info; /* Temporary I/O info object */
+ hsize_t * off = NULL; /* Pointer to sequence offsets */
+ hsize_t mem_off; /* Offset in memory */
+ size_t mem_curr_seq; /* "Current sequence" in memory */
+ size_t dset_curr_seq; /* "Current sequence" in dataset */
+ size_t * len = NULL; /* Array to store sequence lengths */
+ size_t orig_mem_len, mem_len; /* Length of sequence in memory */
+ size_t nseq; /* Number of sequences generated */
+ size_t nelem; /* Number of elements used in sequences */
+ size_t dxpl_vec_size; /* Vector length from API context's DXPL */
+ size_t vec_size; /* Vector length */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -116,36 +107,36 @@ H5D__scatter_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter,
/* Set up temporary I/O info object */
H5MM_memcpy(&tmp_io_info, _io_info, sizeof(*_io_info));
tmp_io_info.op_type = H5D_IO_OP_WRITE;
- tmp_io_info.u.wbuf = _buf;
+ tmp_io_info.u.wbuf = _buf;
/* Get info from API context */
- if(H5CX_get_vec_size(&dxpl_vec_size) < 0)
+ if (H5CX_get_vec_size(&dxpl_vec_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve I/O vector size")
/* Allocate the vector I/O arrays */
- if(dxpl_vec_size > H5D_IO_VECTOR_SIZE)
+ if (dxpl_vec_size > H5D_IO_VECTOR_SIZE)
vec_size = dxpl_vec_size;
else
vec_size = H5D_IO_VECTOR_SIZE;
- if(NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ if (NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
- if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ if (NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
/* Loop until all elements are written */
- while(nelmts > 0) {
+ while (nelmts > 0) {
/* Get list of sequences for selection to write */
- if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
+ if (H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Reset the current sequence information */
mem_curr_seq = dset_curr_seq = 0;
orig_mem_len = mem_len = nelem * iter->elmt_size;
- mem_off = 0;
+ mem_off = 0;
/* Write sequence list out */
- if((*tmp_io_info.layout_ops.writevv)(&tmp_io_info, nseq, &dset_curr_seq,
- len, off, (size_t)1, &mem_curr_seq, &mem_len, &mem_off) < 0)
+ if ((*tmp_io_info.layout_ops.writevv)(&tmp_io_info, nseq, &dset_curr_seq, len, off, (size_t)1,
+ &mem_curr_seq, &mem_len, &mem_off) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error")
/* Update buffer */
@@ -157,15 +148,14 @@ H5D__scatter_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter,
done:
/* Release resources, if allocated */
- if(len)
+ if (len)
len = H5FL_SEQ_FREE(size_t, len);
- if(off)
+ if (off)
off = H5FL_SEQ_FREE(hsize_t, off);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__scatter_file() */
-
/*-------------------------------------------------------------------------
* Function: H5D__gather_file
*
@@ -188,21 +178,20 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5D__gather_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter,
- size_t nelmts, void *_buf/*out*/)
+H5D__gather_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter, size_t nelmts, void *_buf /*out*/)
{
- H5D_io_info_t tmp_io_info; /* Temporary I/O info object */
- hsize_t *off = NULL; /* Pointer to sequence offsets */
- hsize_t mem_off; /* Offset in memory */
- size_t mem_curr_seq; /* "Current sequence" in memory */
- size_t dset_curr_seq; /* "Current sequence" in dataset */
- size_t *len = NULL; /* Pointer to sequence lengths */
- size_t orig_mem_len, mem_len; /* Length of sequence in memory */
- size_t nseq; /* Number of sequences generated */
- size_t nelem; /* Number of elements used in sequences */
- size_t dxpl_vec_size; /* Vector length from API context's DXPL */
- size_t vec_size; /* Vector length */
- size_t ret_value = nelmts; /* Return value */
+ H5D_io_info_t tmp_io_info; /* Temporary I/O info object */
+ hsize_t * off = NULL; /* Pointer to sequence offsets */
+ hsize_t mem_off; /* Offset in memory */
+ size_t mem_curr_seq; /* "Current sequence" in memory */
+ size_t dset_curr_seq; /* "Current sequence" in dataset */
+ size_t * len = NULL; /* Pointer to sequence lengths */
+ size_t orig_mem_len, mem_len; /* Length of sequence in memory */
+ size_t nseq; /* Number of sequences generated */
+ size_t nelem; /* Number of elements used in sequences */
+ size_t dxpl_vec_size; /* Vector length from API context's DXPL */
+ size_t vec_size; /* Vector length */
+ size_t ret_value = nelmts; /* Return value */
FUNC_ENTER_STATIC
@@ -217,36 +206,36 @@ H5D__gather_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter,
/* Set up temporary I/O info object */
H5MM_memcpy(&tmp_io_info, _io_info, sizeof(*_io_info));
tmp_io_info.op_type = H5D_IO_OP_READ;
- tmp_io_info.u.rbuf = _buf;
+ tmp_io_info.u.rbuf = _buf;
/* Get info from API context */
- if(H5CX_get_vec_size(&dxpl_vec_size) < 0)
+ if (H5CX_get_vec_size(&dxpl_vec_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't retrieve I/O vector size")
/* Allocate the vector I/O arrays */
- if(dxpl_vec_size > H5D_IO_VECTOR_SIZE)
+ if (dxpl_vec_size > H5D_IO_VECTOR_SIZE)
vec_size = dxpl_vec_size;
else
vec_size = H5D_IO_VECTOR_SIZE;
- if(NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ if (NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O length vector array")
- if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ if (NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O offset vector array")
/* Loop until all elements are read */
- while(nelmts > 0) {
+ while (nelmts > 0) {
/* Get list of sequences for selection to read */
- if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
+ if (H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
/* Reset the current sequence information */
mem_curr_seq = dset_curr_seq = 0;
orig_mem_len = mem_len = nelem * iter->elmt_size;
- mem_off = 0;
+ mem_off = 0;
/* Read sequence list in */
- if((*tmp_io_info.layout_ops.readvv)(&tmp_io_info, nseq, &dset_curr_seq,
- len, off, (size_t)1, &mem_curr_seq, &mem_len, &mem_off) < 0)
+ if ((*tmp_io_info.layout_ops.readvv)(&tmp_io_info, nseq, &dset_curr_seq, len, off, (size_t)1,
+ &mem_curr_seq, &mem_len, &mem_off) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, 0, "read error")
/* Update buffer */
@@ -258,15 +247,14 @@ H5D__gather_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter,
done:
/* Release resources, if allocated */
- if(len)
+ if (len)
len = H5FL_SEQ_FREE(size_t, len);
- if(off)
+ if (off)
off = H5FL_SEQ_FREE(hsize_t, off);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__gather_file() */
-
/*-------------------------------------------------------------------------
* Function: H5D__scatter_mem
*
@@ -283,20 +271,19 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__scatter_mem(const void *_tscat_buf, H5S_sel_iter_t *iter, size_t nelmts,
- void *_buf/*out*/)
+H5D__scatter_mem(const void *_tscat_buf, H5S_sel_iter_t *iter, size_t nelmts, void *_buf /*out*/)
{
- uint8_t *buf = (uint8_t *)_buf; /* Get local copies for address arithmetic */
+ uint8_t * buf = (uint8_t *)_buf; /* Get local copies for address arithmetic */
const uint8_t *tscat_buf = (const uint8_t *)_tscat_buf;
- hsize_t *off = NULL; /* Pointer to sequence offsets */
- size_t *len = NULL; /* Pointer to sequence lengths */
- size_t curr_len; /* Length of bytes left to process in sequence */
- size_t nseq; /* Number of sequences generated */
- size_t curr_seq; /* Current sequence being processed */
- size_t nelem; /* Number of elements used in sequences */
- size_t dxpl_vec_size; /* Vector length from API context's DXPL */
- size_t vec_size; /* Vector length */
- herr_t ret_value = SUCCEED; /* Number of elements scattered */
+ hsize_t * off = NULL; /* Pointer to sequence offsets */
+ size_t * len = NULL; /* Pointer to sequence lengths */
+ size_t curr_len; /* Length of bytes left to process in sequence */
+ size_t nseq; /* Number of sequences generated */
+ size_t curr_seq; /* Current sequence being processed */
+ size_t nelem; /* Number of elements used in sequences */
+ size_t dxpl_vec_size; /* Vector length from API context's DXPL */
+ size_t vec_size; /* Vector length */
+ herr_t ret_value = SUCCEED; /* Number of elements scattered */
FUNC_ENTER_PACKAGE
@@ -307,27 +294,27 @@ H5D__scatter_mem(const void *_tscat_buf, H5S_sel_iter_t *iter, size_t nelmts,
HDassert(buf);
/* Get info from API context */
- if(H5CX_get_vec_size(&dxpl_vec_size) < 0)
+ if (H5CX_get_vec_size(&dxpl_vec_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve I/O vector size")
/* Allocate the vector I/O arrays */
- if(dxpl_vec_size > H5D_IO_VECTOR_SIZE)
+ if (dxpl_vec_size > H5D_IO_VECTOR_SIZE)
vec_size = dxpl_vec_size;
else
vec_size = H5D_IO_VECTOR_SIZE;
- if(NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ if (NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
- if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ if (NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
/* Loop until all elements are written */
- while(nelmts > 0) {
+ while (nelmts > 0) {
/* Get list of sequences for selection to write */
- if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
- HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
+ if (H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
/* Loop, while sequences left to process */
- for(curr_seq = 0; curr_seq < nseq; curr_seq++) {
+ for (curr_seq = 0; curr_seq < nseq; curr_seq++) {
/* Get the number of bytes in sequence */
curr_len = len[curr_seq];
@@ -343,15 +330,14 @@ H5D__scatter_mem(const void *_tscat_buf, H5S_sel_iter_t *iter, size_t nelmts,
done:
/* Release resources, if allocated */
- if(len)
+ if (len)
len = H5FL_SEQ_FREE(size_t, len);
- if(off)
+ if (off)
off = H5FL_SEQ_FREE(hsize_t, off);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5D__scatter_mem() */
+} /* H5D__scatter_mem() */
-
/*-------------------------------------------------------------------------
* Function: H5D__gather_mem
*
@@ -370,20 +356,19 @@ done:
*-------------------------------------------------------------------------
*/
size_t
-H5D__gather_mem(const void *_buf, H5S_sel_iter_t *iter, size_t nelmts,
- void *_tgath_buf/*out*/)
+H5D__gather_mem(const void *_buf, H5S_sel_iter_t *iter, size_t nelmts, void *_tgath_buf /*out*/)
{
- const uint8_t *buf = (const uint8_t *)_buf; /* Get local copies for address arithmetic */
- uint8_t *tgath_buf = (uint8_t *)_tgath_buf;
- hsize_t *off = NULL; /* Pointer to sequence offsets */
- size_t *len = NULL; /* Pointer to sequence lengths */
- size_t curr_len; /* Length of bytes left to process in sequence */
- size_t nseq; /* Number of sequences generated */
- size_t curr_seq; /* Current sequence being processed */
- size_t nelem; /* Number of elements used in sequences */
- size_t dxpl_vec_size; /* Vector length from API context's DXPL */
- size_t vec_size; /* Vector length */
- size_t ret_value = nelmts; /* Number of elements gathered */
+ const uint8_t *buf = (const uint8_t *)_buf; /* Get local copies for address arithmetic */
+ uint8_t * tgath_buf = (uint8_t *)_tgath_buf;
+ hsize_t * off = NULL; /* Pointer to sequence offsets */
+ size_t * len = NULL; /* Pointer to sequence lengths */
+ size_t curr_len; /* Length of bytes left to process in sequence */
+ size_t nseq; /* Number of sequences generated */
+ size_t curr_seq; /* Current sequence being processed */
+ size_t nelem; /* Number of elements used in sequences */
+ size_t dxpl_vec_size; /* Vector length from API context's DXPL */
+ size_t vec_size; /* Vector length */
+ size_t ret_value = nelmts; /* Number of elements gathered */
FUNC_ENTER_STATIC
@@ -394,27 +379,27 @@ H5D__gather_mem(const void *_buf, H5S_sel_iter_t *iter, size_t nelmts,
HDassert(tgath_buf);
/* Get info from API context */
- if(H5CX_get_vec_size(&dxpl_vec_size) < 0)
+ if (H5CX_get_vec_size(&dxpl_vec_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't retrieve I/O vector size")
/* Allocate the vector I/O arrays */
- if(dxpl_vec_size > H5D_IO_VECTOR_SIZE)
+ if (dxpl_vec_size > H5D_IO_VECTOR_SIZE)
vec_size = dxpl_vec_size;
else
vec_size = H5D_IO_VECTOR_SIZE;
- if(NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ if (NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O length vector array")
- if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ if (NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O offset vector array")
/* Loop until all elements are written */
- while(nelmts > 0) {
+ while (nelmts > 0) {
/* Get list of sequences for selection to write */
- if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
- HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
+ if (H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
/* Loop, while sequences left to process */
- for(curr_seq = 0; curr_seq < nseq; curr_seq++) {
+ for (curr_seq = 0; curr_seq < nseq; curr_seq++) {
/* Get the number of bytes in sequence */
curr_len = len[curr_seq];
@@ -430,15 +415,14 @@ H5D__gather_mem(const void *_buf, H5S_sel_iter_t *iter, size_t nelmts,
done:
/* Release resources, if allocated */
- if(len)
+ if (len)
len = H5FL_SEQ_FREE(size_t, len);
- if(off)
+ if (off)
off = H5FL_SEQ_FREE(hsize_t, off);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5D__gather_mem() */
+} /* H5D__gather_mem() */
-
/*-------------------------------------------------------------------------
* Function: H5D__scatgath_read
*
@@ -452,19 +436,19 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space)
+H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space)
{
- void *buf = io_info->u.rbuf; /* Local pointer to application buffer */
- H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info*/
- hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */
- H5S_sel_iter_t *bkg_iter = NULL; /* Background iteration info*/
- hbool_t bkg_iter_init = FALSE; /* Background iteration info has been initialized */
- H5S_sel_iter_t *file_iter = NULL; /* File selection iteration info*/
- hbool_t file_iter_init = FALSE; /* File selection iteration info has been initialized */
- hsize_t smine_start; /* Strip mine start loc */
- size_t smine_nelmts; /* Elements per strip */
- herr_t ret_value = SUCCEED; /* Return value */
+ void * buf = io_info->u.rbuf; /* Local pointer to application buffer */
+ H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info*/
+ hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */
+ H5S_sel_iter_t *bkg_iter = NULL; /* Background iteration info*/
+ hbool_t bkg_iter_init = FALSE; /* Background iteration info has been initialized */
+ H5S_sel_iter_t *file_iter = NULL; /* File selection iteration info*/
+ hbool_t file_iter_init = FALSE; /* File selection iteration info has been initialized */
+ hsize_t smine_start; /* Strip mine start loc */
+ size_t smine_nelmts; /* Elements per strip */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -476,31 +460,32 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
HDassert(buf);
/* Check for NOOP read */
- if(nelmts == 0)
+ if (nelmts == 0)
HGOTO_DONE(SUCCEED)
/* Allocate the iterators */
- if(NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator")
- if(NULL == (bkg_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ if (NULL == (bkg_iter = H5FL_MALLOC(H5S_sel_iter_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate background iterator")
- if(NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ if (NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator")
/* Figure out the strip mine size. */
- if(H5S_select_iter_init(file_iter, file_space, type_info->src_type_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0)
+ if (H5S_select_iter_init(file_iter, file_space, type_info->src_type_size,
+ H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
- file_iter_init = TRUE; /*file selection iteration info has been initialized */
- if(H5S_select_iter_init(mem_iter, mem_space, type_info->dst_type_size, 0) < 0)
+ file_iter_init = TRUE; /*file selection iteration info has been initialized */
+ if (H5S_select_iter_init(mem_iter, mem_space, type_info->dst_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
- mem_iter_init = TRUE; /*file selection iteration info has been initialized */
- if(H5S_select_iter_init(bkg_iter, mem_space, type_info->dst_type_size, 0) < 0)
+ mem_iter_init = TRUE; /*file selection iteration info has been initialized */
+ if (H5S_select_iter_init(bkg_iter, mem_space, type_info->dst_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
- bkg_iter_init = TRUE; /*file selection iteration info has been initialized */
+ bkg_iter_init = TRUE; /*file selection iteration info has been initialized */
/* Start strip mining... */
- for(smine_start = 0; smine_start < nelmts; smine_start += smine_nelmts) {
- size_t n; /* Elements operated on */
+ for (smine_start = 0; smine_start < nelmts; smine_start += smine_nelmts) {
+ size_t n; /* Elements operated on */
/* Go figure out how many elements to read from the file */
HDassert(H5S_SELECT_ITER_NELMTS(file_iter) == (nelmts - smine_start));
@@ -512,73 +497,72 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
* if necessary.
*/
- /*
+ /*
* Gather data
*/
- n = H5D__gather_file(io_info, file_iter, smine_nelmts, type_info->tconv_buf/*out*/);
- if(n != smine_nelmts)
+ n = H5D__gather_file(io_info, file_iter, smine_nelmts, type_info->tconv_buf /*out*/);
+ if (n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed")
/* If the source and destination are compound types and subset of each other
* and no conversion is needed, copy the data directly into user's buffer and
* bypass the rest of steps.
*/
- if(type_info->cmpd_subset && H5T_SUBSET_FALSE != type_info->cmpd_subset->subset) {
- if(H5D__compound_opt_read(smine_nelmts, mem_iter, type_info, buf /*out*/) < 0)
+ if (type_info->cmpd_subset && H5T_SUBSET_FALSE != type_info->cmpd_subset->subset) {
+ if (H5D__compound_opt_read(smine_nelmts, mem_iter, type_info, buf /*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "datatype conversion failed")
} /* end if */
else {
- if(H5T_BKG_YES == type_info->need_bkg) {
- n = H5D__gather_mem(buf, bkg_iter, smine_nelmts, type_info->bkg_buf/*out*/);
- if(n != smine_nelmts)
+ if (H5T_BKG_YES == type_info->need_bkg) {
+ n = H5D__gather_mem(buf, bkg_iter, smine_nelmts, type_info->bkg_buf /*out*/);
+ if (n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "mem gather failed")
} /* end if */
/*
* Perform datatype conversion.
*/
- if(H5T_convert(type_info->tpath, type_info->src_type_id, type_info->dst_type_id,
- smine_nelmts, (size_t)0, (size_t)0, type_info->tconv_buf,
- type_info->bkg_buf) < 0)
+ if (H5T_convert(type_info->tpath, type_info->src_type_id, type_info->dst_type_id, smine_nelmts,
+ (size_t)0, (size_t)0, type_info->tconv_buf, type_info->bkg_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed")
/* Do the data transform after the conversion (since we're using type mem_type) */
- if(!type_info->is_xform_noop) {
- H5Z_data_xform_t *data_transform; /* Data transform info */
+ if (!type_info->is_xform_noop) {
+ H5Z_data_xform_t *data_transform; /* Data transform info */
/* Retrieve info from API context */
- if(H5CX_get_data_transform(&data_transform) < 0)
+ if (H5CX_get_data_transform(&data_transform) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info")
- if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0)
+ if (H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) <
+ 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform")
}
/* Scatter the data into memory */
- if(H5D__scatter_mem(type_info->tconv_buf, mem_iter, smine_nelmts, buf/*out*/) < 0)
+ if (H5D__scatter_mem(type_info->tconv_buf, mem_iter, smine_nelmts, buf /*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
} /* end else */
- } /* end for */
+ } /* end for */
done:
/* Release selection iterators */
- if(file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0)
+ if (file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- if(file_iter)
+ if (file_iter)
file_iter = H5FL_FREE(H5S_sel_iter_t, file_iter);
- if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- if(mem_iter)
+ if (mem_iter)
mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter);
- if(bkg_iter_init && H5S_SELECT_ITER_RELEASE(bkg_iter) < 0)
+ if (bkg_iter_init && H5S_SELECT_ITER_RELEASE(bkg_iter) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- if(bkg_iter)
+ if (bkg_iter)
bkg_iter = H5FL_FREE(H5S_sel_iter_t, bkg_iter);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__scatgath_read() */
-
/*-------------------------------------------------------------------------
* Function: H5D__scatgath_write
*
@@ -592,19 +576,19 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space)
+H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space)
{
- const void *buf = io_info->u.wbuf; /* Local pointer to application buffer */
- H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info*/
- hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */
- H5S_sel_iter_t *bkg_iter = NULL; /* Background iteration info*/
- hbool_t bkg_iter_init = FALSE; /* Background iteration info has been initialized */
- H5S_sel_iter_t *file_iter = NULL; /* File selection iteration info*/
- hbool_t file_iter_init = FALSE; /* File selection iteration info has been initialized */
- hsize_t smine_start; /* Strip mine start loc */
- size_t smine_nelmts; /* Elements per strip */
- herr_t ret_value = SUCCEED; /* Return value */
+ const void * buf = io_info->u.wbuf; /* Local pointer to application buffer */
+ H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info*/
+ hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */
+ H5S_sel_iter_t *bkg_iter = NULL; /* Background iteration info*/
+ hbool_t bkg_iter_init = FALSE; /* Background iteration info has been initialized */
+ H5S_sel_iter_t *file_iter = NULL; /* File selection iteration info*/
+ hbool_t file_iter_init = FALSE; /* File selection iteration info has been initialized */
+ hsize_t smine_start; /* Strip mine start loc */
+ size_t smine_nelmts; /* Elements per strip */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -616,31 +600,33 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
HDassert(buf);
/* Check for NOOP write */
- if(nelmts == 0)
+ if (nelmts == 0)
HGOTO_DONE(SUCCEED)
/* Allocate the iterators */
- if(NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator")
- if(NULL == (bkg_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ if (NULL == (bkg_iter = H5FL_MALLOC(H5S_sel_iter_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate background iterator")
- if(NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ if (NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator")
/* Figure out the strip mine size. */
- if(H5S_select_iter_init(file_iter, file_space, type_info->dst_type_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0)
+ if (H5S_select_iter_init(file_iter, file_space, type_info->dst_type_size,
+ H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
- file_iter_init = TRUE; /*file selection iteration info has been initialized */
- if(H5S_select_iter_init(mem_iter, mem_space, type_info->src_type_size, 0) < 0)
+ file_iter_init = TRUE; /*file selection iteration info has been initialized */
+ if (H5S_select_iter_init(mem_iter, mem_space, type_info->src_type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
- mem_iter_init = TRUE; /*file selection iteration info has been initialized */
- if(H5S_select_iter_init(bkg_iter, file_space, type_info->dst_type_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0)
+ mem_iter_init = TRUE; /*file selection iteration info has been initialized */
+ if (H5S_select_iter_init(bkg_iter, file_space, type_info->dst_type_size,
+ H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
- bkg_iter_init = TRUE; /*file selection iteration info has been initialized */
+ bkg_iter_init = TRUE; /*file selection iteration info has been initialized */
/* Start strip mining... */
- for(smine_start = 0; smine_start < nelmts; smine_start += smine_nelmts) {
- size_t n; /* Elements operated on */
+ for (smine_start = 0; smine_start < nelmts; smine_start += smine_nelmts) {
+ size_t n; /* Elements operated on */
/* Go figure out how many elements to read from the file */
HDassert(H5S_SELECT_ITER_NELMTS(file_iter) == (nelmts - smine_start));
@@ -651,8 +637,8 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
* buffer. Also gather data from the file into the background buffer
* if necessary.
*/
- n = H5D__gather_mem(buf, mem_iter, smine_nelmts, type_info->tconv_buf/*out*/);
- if(n != smine_nelmts)
+ n = H5D__gather_mem(buf, mem_iter, smine_nelmts, type_info->tconv_buf /*out*/);
+ if (n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "mem gather failed")
/* If the source and destination are compound types and the destination is
@@ -661,66 +647,65 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
* is a subset of the destination, the optimization is done in conversion
* function H5T_conv_struct_opt to protect the background data.
*/
- if(type_info->cmpd_subset && H5T_SUBSET_DST == type_info->cmpd_subset->subset
- && type_info->dst_type_size == type_info->cmpd_subset->copy_size) {
- if(H5D__compound_opt_write(smine_nelmts, type_info) < 0)
+ if (type_info->cmpd_subset && H5T_SUBSET_DST == type_info->cmpd_subset->subset &&
+ type_info->dst_type_size == type_info->cmpd_subset->copy_size) {
+ if (H5D__compound_opt_write(smine_nelmts, type_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "datatype conversion failed")
} /* end if */
else {
- if(H5T_BKG_YES == type_info->need_bkg) {
- n = H5D__gather_file(io_info, bkg_iter, smine_nelmts, type_info->bkg_buf/*out*/);
- if(n != smine_nelmts)
+ if (H5T_BKG_YES == type_info->need_bkg) {
+ n = H5D__gather_file(io_info, bkg_iter, smine_nelmts, type_info->bkg_buf /*out*/);
+ if (n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed")
} /* end if */
/* Do the data transform before the type conversion (since
* transforms must be done in the memory type). */
- if(!type_info->is_xform_noop) {
- H5Z_data_xform_t *data_transform; /* Data transform info */
+ if (!type_info->is_xform_noop) {
+ H5Z_data_xform_t *data_transform; /* Data transform info */
/* Retrieve info from API context */
- if(H5CX_get_data_transform(&data_transform) < 0)
+ if (H5CX_get_data_transform(&data_transform) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info")
- if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0)
+ if (H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) <
+ 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform")
}
/*
* Perform datatype conversion.
*/
- if(H5T_convert(type_info->tpath, type_info->src_type_id, type_info->dst_type_id,
- smine_nelmts, (size_t)0, (size_t)0, type_info->tconv_buf,
- type_info->bkg_buf) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed")
+ if (H5T_convert(type_info->tpath, type_info->src_type_id, type_info->dst_type_id, smine_nelmts,
+ (size_t)0, (size_t)0, type_info->tconv_buf, type_info->bkg_buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed")
} /* end else */
/*
* Scatter the data out to the file.
*/
- if(H5D__scatter_file(io_info, file_iter, smine_nelmts, type_info->tconv_buf) < 0)
+ if (H5D__scatter_file(io_info, file_iter, smine_nelmts, type_info->tconv_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed")
} /* end for */
done:
/* Release selection iterators */
- if(file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0)
+ if (file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- if(file_iter)
+ if (file_iter)
file_iter = H5FL_FREE(H5S_sel_iter_t, file_iter);
- if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- if(mem_iter)
+ if (mem_iter)
mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter);
- if(bkg_iter_init && H5S_SELECT_ITER_RELEASE(bkg_iter) < 0)
+ if (bkg_iter_init && H5S_SELECT_ITER_RELEASE(bkg_iter) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- if(bkg_iter)
+ if (bkg_iter)
bkg_iter = H5FL_FREE(H5S_sel_iter_t, bkg_iter);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__scatgath_write() */
-
/*-------------------------------------------------------------------------
* Function: H5D__compound_opt_read
*
@@ -754,17 +739,17 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter,
- const H5D_type_info_t *type_info, void *user_buf/*out*/)
+H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter, const H5D_type_info_t *type_info,
+ void *user_buf /*out*/)
{
- uint8_t *ubuf = (uint8_t *)user_buf; /* Cast for pointer arithmetic */
- uint8_t *xdbuf; /* Pointer into dataset buffer */
- hsize_t *off = NULL; /* Pointer to sequence offsets */
- size_t *len = NULL; /* Pointer to sequence lengths */
- size_t src_stride, dst_stride, copy_size;
- size_t dxpl_vec_size; /* Vector length from API context's DXPL */
- size_t vec_size; /* Vector length */
- herr_t ret_value = SUCCEED; /* Return value */
+ uint8_t *ubuf = (uint8_t *)user_buf; /* Cast for pointer arithmetic */
+ uint8_t *xdbuf; /* Pointer into dataset buffer */
+ hsize_t *off = NULL; /* Pointer to sequence offsets */
+ size_t * len = NULL; /* Pointer to sequence lengths */
+ size_t src_stride, dst_stride, copy_size;
+ size_t dxpl_vec_size; /* Vector length from API context's DXPL */
+ size_t vec_size; /* Vector length */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -774,21 +759,21 @@ H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter,
HDassert(type_info);
HDassert(type_info->cmpd_subset);
HDassert(H5T_SUBSET_SRC == type_info->cmpd_subset->subset ||
- H5T_SUBSET_DST == type_info->cmpd_subset->subset);
+ H5T_SUBSET_DST == type_info->cmpd_subset->subset);
HDassert(user_buf);
/* Get info from API context */
- if(H5CX_get_vec_size(&dxpl_vec_size) < 0)
+ if (H5CX_get_vec_size(&dxpl_vec_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve I/O vector size")
/* Allocate the vector I/O arrays */
- if(dxpl_vec_size > H5D_IO_VECTOR_SIZE)
+ if (dxpl_vec_size > H5D_IO_VECTOR_SIZE)
vec_size = dxpl_vec_size;
else
vec_size = H5D_IO_VECTOR_SIZE;
- if(NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ if (NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
- if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ if (NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
/* Get source & destination strides */
@@ -800,22 +785,22 @@ H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter,
/* Loop until all elements are written */
xdbuf = type_info->tconv_buf;
- while(nelmts > 0) {
- size_t nseq; /* Number of sequences generated */
- size_t curr_seq; /* Current sequence being processed */
- size_t elmtno; /* Element counter */
+ while (nelmts > 0) {
+ size_t nseq; /* Number of sequences generated */
+ size_t curr_seq; /* Current sequence being processed */
+ size_t elmtno; /* Element counter */
/* Get list of sequences for selection to write */
- if(H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &elmtno, off, len) < 0)
+ if (H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &elmtno, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
/* Loop, while sequences left to process */
- for(curr_seq = 0; curr_seq < nseq; curr_seq++) {
- size_t curr_off; /* Offset of bytes left to process in sequence */
- size_t curr_len; /* Length of bytes left to process in sequence */
- size_t curr_nelmts; /* Number of elements to process in sequence */
- uint8_t *xubuf;
- size_t i; /* Local index variable */
+ for (curr_seq = 0; curr_seq < nseq; curr_seq++) {
+ size_t curr_off; /* Offset of bytes left to process in sequence */
+ size_t curr_len; /* Length of bytes left to process in sequence */
+ size_t curr_nelmts; /* Number of elements to process in sequence */
+ uint8_t *xubuf;
+ size_t i; /* Local index variable */
/* Get the number of bytes and offset in sequence */
curr_len = len[curr_seq];
@@ -824,17 +809,17 @@ H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter,
/* Decide the number of elements and position in the buffer. */
curr_nelmts = curr_len / dst_stride;
- xubuf = ubuf + curr_off;
+ xubuf = ubuf + curr_off;
/* Copy the data into the right place. */
- for(i = 0; i < curr_nelmts; i++) {
+ for (i = 0; i < curr_nelmts; i++) {
HDmemmove(xubuf, xdbuf, copy_size);
/* Update pointers */
xdbuf += src_stride;
xubuf += dst_stride;
} /* end for */
- } /* end for */
+ } /* end for */
/* Decrement number of elements left to process */
nelmts -= elmtno;
@@ -842,15 +827,14 @@ H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter,
done:
/* Release resources, if allocated */
- if(len)
+ if (len)
len = H5FL_SEQ_FREE(size_t, len);
- if(off)
+ if (off)
off = H5FL_SEQ_FREE(hsize_t, off);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__compound_opt_read() */
-
/*-------------------------------------------------------------------------
* Function: H5D__compound_opt_write
*
@@ -887,9 +871,9 @@ done:
static herr_t
H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info)
{
- uint8_t *xsbuf, *xdbuf; /* Source & destination pointers into dataset buffer */
- size_t src_stride, dst_stride; /* Strides through source & destination datatypes */
- size_t i; /* Local index variable */
+ uint8_t *xsbuf, *xdbuf; /* Source & destination pointers into dataset buffer */
+ size_t src_stride, dst_stride; /* Strides through source & destination datatypes */
+ size_t i; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
@@ -904,7 +888,7 @@ H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info)
/* Loop until all elements are written */
xsbuf = (uint8_t *)type_info->tconv_buf;
xdbuf = (uint8_t *)type_info->tconv_buf;
- for(i = 0; i < nelmts; i++) {
+ for (i = 0; i < nelmts; i++) {
HDmemmove(xdbuf, xsbuf, dst_stride);
/* Update pointers */
@@ -915,7 +899,6 @@ H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__compound_opt_write() */
-
/*-------------------------------------------------------------------------
* Function: H5Dscatter
*
@@ -933,71 +916,70 @@ H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info)
*-------------------------------------------------------------------------
*/
herr_t
-H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
- hid_t dst_space_id, void *dst_buf)
+H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_id, void *dst_buf)
{
- H5T_t *type; /* Datatype */
- H5S_t *dst_space; /* Dataspace */
- H5S_sel_iter_t *iter = NULL; /* Selection iteration info*/
- hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
- const void *src_buf = NULL; /* Source (contiguous) data buffer */
- size_t src_buf_nbytes = 0; /* Size of src_buf */
- size_t type_size; /* Datatype element size */
- hssize_t nelmts; /* Number of remaining elements in selection */
- size_t nelmts_scatter = 0; /* Number of elements to scatter to dst_buf */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5T_t * type; /* Datatype */
+ H5S_t * dst_space; /* Dataspace */
+ H5S_sel_iter_t *iter = NULL; /* Selection iteration info*/
+ hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
+ const void * src_buf = NULL; /* Source (contiguous) data buffer */
+ size_t src_buf_nbytes = 0; /* Size of src_buf */
+ size_t type_size; /* Datatype element size */
+ hssize_t nelmts; /* Number of remaining elements in selection */
+ size_t nelmts_scatter = 0; /* Number of elements to scatter to dst_buf */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "x*xii*x", op, op_data, type_id, dst_space_id, dst_buf);
/* Check args */
- if(op == NULL)
+ if (op == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid callback function pointer")
- if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
- if(NULL == (dst_space= (H5S_t *)H5I_object_verify(dst_space_id, H5I_DATASPACE)))
+ if (NULL == (dst_space = (H5S_t *)H5I_object_verify(dst_space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if(dst_buf == NULL)
+ if (dst_buf == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided")
/* Get datatype element size */
- if(0 == (type_size = H5T_GET_SIZE(type)))
+ if (0 == (type_size = H5T_GET_SIZE(type)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype size")
/* Get number of elements in dataspace */
- if((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(dst_space)) < 0)
+ if ((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(dst_space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection")
/* Allocate the selection iterator */
- if(NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ if (NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
/* Initialize selection iterator */
- if(H5S_select_iter_init(iter, dst_space, type_size, 0) < 0)
+ if (H5S_select_iter_init(iter, dst_space, type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information")
iter_init = TRUE;
/* Loop until all data has been scattered */
- while(nelmts > 0) {
+ while (nelmts > 0) {
/* Make callback to retrieve data */
- if(op(&src_buf, &src_buf_nbytes, op_data) < 0)
+ if (op(&src_buf, &src_buf_nbytes, op_data) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, FAIL, "callback operator returned failure")
/* Calculate number of elements */
nelmts_scatter = src_buf_nbytes / type_size;
/* Check callback results */
- if(!src_buf)
+ if (!src_buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback did not return a buffer")
- if(src_buf_nbytes == 0)
+ if (src_buf_nbytes == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned a buffer size of 0")
- if(src_buf_nbytes % type_size)
+ if (src_buf_nbytes % type_size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size is not a multiple of datatype size")
- if(nelmts_scatter > (size_t)nelmts)
+ if (nelmts_scatter > (size_t)nelmts)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned more elements than in selection")
/* Scatter data */
- if(H5D__scatter_mem(src_buf, iter, nelmts_scatter, dst_buf) < 0)
+ if (H5D__scatter_mem(src_buf, iter, nelmts_scatter, dst_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "scatter failed")
nelmts -= (hssize_t)nelmts_scatter;
@@ -1005,15 +987,14 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
done:
/* Release selection iterator */
- if(iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
+ if (iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- if(iter)
+ if (iter)
iter = H5FL_FREE(H5S_sel_iter_t, iter);
FUNC_LEAVE_API(ret_value)
-} /* H5Dscatter() */
+} /* H5Dscatter() */
-
/*-------------------------------------------------------------------------
* Function: H5Dgather
*
@@ -1031,71 +1012,72 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
- size_t dst_buf_size, void *dst_buf, H5D_gather_func_t op, void *op_data)
+H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, size_t dst_buf_size, void *dst_buf,
+ H5D_gather_func_t op, void *op_data)
{
- H5T_t *type; /* Datatype */
- H5S_t *src_space; /* Dataspace */
- H5S_sel_iter_t *iter = NULL; /* Selection iteration info*/
- hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
- size_t type_size; /* Datatype element size */
- hssize_t nelmts; /* Number of remaining elements in selection */
- size_t dst_buf_nelmts; /* Number of elements that can fit in dst_buf */
- size_t nelmts_gathered; /* Number of elements gathered from src_buf */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5T_t * type; /* Datatype */
+ H5S_t * src_space; /* Dataspace */
+ H5S_sel_iter_t *iter = NULL; /* Selection iteration info*/
+ hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
+ size_t type_size; /* Datatype element size */
+ hssize_t nelmts; /* Number of remaining elements in selection */
+ size_t dst_buf_nelmts; /* Number of elements that can fit in dst_buf */
+ size_t nelmts_gathered; /* Number of elements gathered from src_buf */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "i*xiz*xx*x", src_space_id, src_buf, type_id, dst_buf_size,
- dst_buf, op, op_data);
+ H5TRACE7("e", "i*xiz*xx*x", src_space_id, src_buf, type_id, dst_buf_size, dst_buf, op, op_data);
/* Check args */
- if(NULL == (src_space= (H5S_t *)H5I_object_verify(src_space_id, H5I_DATASPACE)))
+ if (NULL == (src_space = (H5S_t *)H5I_object_verify(src_space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if(src_buf == NULL)
+ if (src_buf == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no source buffer provided")
- if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
- if(dst_buf_size == 0)
+ if (dst_buf_size == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer size is 0")
- if(dst_buf == NULL)
+ if (dst_buf == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided")
/* Get datatype element size */
- if(0 == (type_size = H5T_GET_SIZE(type)))
+ if (0 == (type_size = H5T_GET_SIZE(type)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype size")
/* Get number of elements in dst_buf_size */
dst_buf_nelmts = dst_buf_size / type_size;
- if(dst_buf_nelmts == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer is not large enough to hold one element")
+ if (dst_buf_nelmts == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "destination buffer is not large enough to hold one element")
/* Get number of elements in dataspace */
- if((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(src_space)) < 0)
+ if ((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(src_space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection")
/* If dst_buf is not large enough to hold all the elements, make sure there
* is a callback */
- if(((size_t)nelmts > dst_buf_nelmts) && (op == NULL))
+ if (((size_t)nelmts > dst_buf_nelmts) && (op == NULL))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback supplied and destination buffer too small")
/* Allocate the selection iterator */
- if(NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ if (NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
/* Initialize selection iterator */
- if(H5S_select_iter_init(iter, src_space, type_size, 0) < 0)
+ if (H5S_select_iter_init(iter, src_space, type_size, 0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information")
iter_init = TRUE;
/* Loop until all data has been scattered */
- while(nelmts > 0) {
+ while (nelmts > 0) {
/* Gather data */
- if(0 == (nelmts_gathered = H5D__gather_mem(src_buf, iter, MIN(dst_buf_nelmts, (size_t)nelmts), dst_buf)))
+ if (0 ==
+ (nelmts_gathered = H5D__gather_mem(src_buf, iter, MIN(dst_buf_nelmts, (size_t)nelmts), dst_buf)))
HGOTO_ERROR(H5E_IO, H5E_CANTCOPY, FAIL, "gather failed")
HDassert(nelmts_gathered == MIN(dst_buf_nelmts, (size_t)nelmts));
/* Make callback to process dst_buf */
- if(op && op(dst_buf, nelmts_gathered * type_size, op_data) < 0)
+ if (op && op(dst_buf, nelmts_gathered * type_size, op_data) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, FAIL, "callback operator returned failure")
nelmts -= (hssize_t)nelmts_gathered;
@@ -1104,11 +1086,10 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
done:
/* Release selection iterator */
- if(iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
+ if (iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- if(iter)
+ if (iter)
iter = H5FL_FREE(H5S_sel_iter_t, iter);
FUNC_LEAVE_API(ret_value)
-} /* H5Dgather() */
-
+} /* H5Dgather() */
diff --git a/src/H5Dselect.c b/src/H5Dselect.c
index 5a5c491..6c4f4e6 100644
--- a/src/H5Dselect.c
+++ b/src/H5Dselect.c
@@ -21,42 +21,36 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
- size_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
-
+static herr_t H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space);
/*********************/
/* Package Variables */
/*********************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -70,8 +64,6 @@ H5FL_SEQ_DEFINE(hsize_t);
/* Declare extern free list to manage the H5S_sel_iter_t struct */
H5FL_EXTERN(H5S_sel_iter_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5D__select_io
*
@@ -85,25 +77,25 @@ H5FL_EXTERN(H5S_sel_iter_t);
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
- size_t nelmts, const H5S_t *file_space, const H5S_t *mem_space)
+H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, const H5S_t *file_space,
+ const H5S_t *mem_space)
{
- H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */
- hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */
- H5S_sel_iter_t *file_iter = NULL; /* File selection iteration info */
- hbool_t file_iter_init = FALSE; /* File selection iteration info has been initialized */
- hsize_t *mem_off = NULL; /* Pointer to sequence offsets in memory */
- hsize_t *file_off = NULL; /* Pointer to sequence offsets in the file */
- size_t *mem_len = NULL; /* Pointer to sequence lengths in memory */
- size_t *file_len = NULL; /* Pointer to sequence lengths in the file */
- size_t curr_mem_seq; /* Current memory sequence to operate on */
- size_t curr_file_seq; /* Current file sequence to operate on */
- size_t mem_nseq; /* Number of sequences generated in the file */
- size_t file_nseq; /* Number of sequences generated in memory */
- size_t dxpl_vec_size; /* Vector length from API context's DXPL */
- size_t vec_size; /* Vector length */
- ssize_t tmp_file_len; /* Temporary number of bytes in file sequence */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */
+ hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */
+ H5S_sel_iter_t *file_iter = NULL; /* File selection iteration info */
+ hbool_t file_iter_init = FALSE; /* File selection iteration info has been initialized */
+ hsize_t * mem_off = NULL; /* Pointer to sequence offsets in memory */
+ hsize_t * file_off = NULL; /* Pointer to sequence offsets in the file */
+ size_t * mem_len = NULL; /* Pointer to sequence lengths in memory */
+ size_t * file_len = NULL; /* Pointer to sequence lengths in the file */
+ size_t curr_mem_seq; /* Current memory sequence to operate on */
+ size_t curr_file_seq; /* Current file sequence to operate on */
+ size_t mem_nseq; /* Number of sequences generated in the file */
+ size_t file_nseq; /* Number of sequences generated in memory */
+ size_t dxpl_vec_size; /* Vector length from API context's DXPL */
+ size_t vec_size; /* Vector length */
+ ssize_t tmp_file_len; /* Temporary number of bytes in file sequence */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -114,16 +106,16 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
HDassert(io_info->u.rbuf);
/* Check for only one element in selection */
- if(nelmts == 1) {
- hsize_t single_mem_off; /* Offset in memory */
- hsize_t single_file_off; /* Offset in the file */
- size_t single_mem_len; /* Length in memory */
- size_t single_file_len; /* Length in the file */
+ if (nelmts == 1) {
+ hsize_t single_mem_off; /* Offset in memory */
+ hsize_t single_file_off; /* Offset in the file */
+ size_t single_mem_len; /* Length in memory */
+ size_t single_file_len; /* Length in the file */
/* Get offset of first element in selections */
- if(H5S_SELECT_OFFSET(file_space, &single_file_off) < 0)
+ if (H5S_SELECT_OFFSET(file_space, &single_file_off) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "can't retrieve file selection offset")
- if(H5S_SELECT_OFFSET(mem_space, &single_mem_off) < 0)
+ if (H5S_SELECT_OFFSET(mem_space, &single_mem_off) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "can't retrieve memory selection offset")
/* Set up necessary information for I/O operation */
@@ -134,17 +126,17 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
single_file_len = single_mem_len = elmt_size;
/* Perform I/O on memory and file sequences */
- if(io_info->op_type == H5D_IO_OP_READ) {
- if((tmp_file_len = (*io_info->layout_ops.readvv)(io_info,
- file_nseq, &curr_file_seq, &single_file_len, &single_file_off,
- mem_nseq, &curr_mem_seq, &single_mem_len, &single_mem_off)) < 0)
+ if (io_info->op_type == H5D_IO_OP_READ) {
+ if ((tmp_file_len = (*io_info->layout_ops.readvv)(
+ io_info, file_nseq, &curr_file_seq, &single_file_len, &single_file_off, mem_nseq,
+ &curr_mem_seq, &single_mem_len, &single_mem_off)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, FAIL, "read error")
} /* end if */
else {
HDassert(io_info->op_type == H5D_IO_OP_WRITE);
- if((tmp_file_len = (*io_info->layout_ops.writevv)(io_info,
- file_nseq, &curr_file_seq, &single_file_len, &single_file_off,
- mem_nseq, &curr_mem_seq, &single_mem_len, &single_mem_off)) < 0)
+ if ((tmp_file_len = (*io_info->layout_ops.writevv)(
+ io_info, file_nseq, &curr_file_seq, &single_file_len, &single_file_off, mem_nseq,
+ &curr_mem_seq, &single_mem_len, &single_mem_off)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error")
} /* end else */
@@ -152,53 +144,54 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
HDassert(((size_t)tmp_file_len % elmt_size) == 0);
} /* end if */
else {
- size_t mem_nelem; /* Number of elements used in memory sequences */
- size_t file_nelem; /* Number of elements used in file sequences */
+ size_t mem_nelem; /* Number of elements used in memory sequences */
+ size_t file_nelem; /* Number of elements used in file sequences */
/* Get info from API context */
- if(H5CX_get_vec_size(&dxpl_vec_size) < 0)
+ if (H5CX_get_vec_size(&dxpl_vec_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve I/O vector size")
/* Allocate the vector I/O arrays */
- if(dxpl_vec_size > H5D_IO_VECTOR_SIZE)
+ if (dxpl_vec_size > H5D_IO_VECTOR_SIZE)
vec_size = dxpl_vec_size;
else
vec_size = H5D_IO_VECTOR_SIZE;
- if(NULL == (mem_len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ if (NULL == (mem_len = H5FL_SEQ_MALLOC(size_t, vec_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
- if(NULL == (mem_off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ if (NULL == (mem_off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
- if(NULL == (file_len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ if (NULL == (file_len = H5FL_SEQ_MALLOC(size_t, vec_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
- if(NULL == (file_off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ if (NULL == (file_off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
/* Allocate the iterators */
- if(NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator")
- if(NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ if (NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator")
/* Initialize file iterator */
- if(H5S_select_iter_init(file_iter, file_space, elmt_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0)
+ if (H5S_select_iter_init(file_iter, file_space, elmt_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
- file_iter_init = 1; /* File selection iteration info has been initialized */
+ file_iter_init = 1; /* File selection iteration info has been initialized */
/* Initialize memory iterator */
- if(H5S_select_iter_init(mem_iter, mem_space, elmt_size, 0) < 0)
+ if (H5S_select_iter_init(mem_iter, mem_space, elmt_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
- mem_iter_init = 1; /* Memory selection iteration info has been initialized */
+ mem_iter_init = 1; /* Memory selection iteration info has been initialized */
/* Initialize sequence counts */
curr_mem_seq = curr_file_seq = 0;
mem_nseq = file_nseq = 0;
/* Loop, until all bytes are processed */
- while(nelmts > 0) {
+ while (nelmts > 0) {
/* Check if more file sequences are needed */
- if(curr_file_seq >= file_nseq) {
+ if (curr_file_seq >= file_nseq) {
/* Get sequences for file selection */
- if(H5S_SELECT_ITER_GET_SEQ_LIST(file_iter, vec_size, nelmts, &file_nseq, &file_nelem, file_off, file_len) < 0)
+ if (H5S_SELECT_ITER_GET_SEQ_LIST(file_iter, vec_size, nelmts, &file_nseq, &file_nelem,
+ file_off, file_len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Start at the beginning of the sequences again */
@@ -206,9 +199,10 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
} /* end if */
/* Check if more memory sequences are needed */
- if(curr_mem_seq >= mem_nseq) {
+ if (curr_mem_seq >= mem_nseq) {
/* Get sequences for memory selection */
- if(H5S_SELECT_ITER_GET_SEQ_LIST(mem_iter, vec_size, nelmts, &mem_nseq, &mem_nelem, mem_off, mem_len) < 0)
+ if (H5S_SELECT_ITER_GET_SEQ_LIST(mem_iter, vec_size, nelmts, &mem_nseq, &mem_nelem, mem_off,
+ mem_len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Start at the beginning of the sequences again */
@@ -216,53 +210,52 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
} /* end if */
/* Perform I/O on memory and file sequences */
- if(io_info->op_type == H5D_IO_OP_READ) {
- if((tmp_file_len = (*io_info->layout_ops.readvv)(io_info,
- file_nseq, &curr_file_seq, file_len, file_off,
- mem_nseq, &curr_mem_seq, mem_len, mem_off)) < 0)
+ if (io_info->op_type == H5D_IO_OP_READ) {
+ if ((tmp_file_len =
+ (*io_info->layout_ops.readvv)(io_info, file_nseq, &curr_file_seq, file_len, file_off,
+ mem_nseq, &curr_mem_seq, mem_len, mem_off)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, FAIL, "read error")
} /* end if */
else {
HDassert(io_info->op_type == H5D_IO_OP_WRITE);
- if((tmp_file_len = (*io_info->layout_ops.writevv)(io_info,
- file_nseq, &curr_file_seq, file_len, file_off,
- mem_nseq, &curr_mem_seq, mem_len, mem_off)) < 0)
+ if ((tmp_file_len = (*io_info->layout_ops.writevv)(io_info, file_nseq, &curr_file_seq,
+ file_len, file_off, mem_nseq,
+ &curr_mem_seq, mem_len, mem_off)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error")
} /* end else */
/* Decrement number of elements left to process */
HDassert(((size_t)tmp_file_len % elmt_size) == 0);
- if(elmt_size == 0)
+ if (elmt_size == 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "Resulted in division by zero")
nelmts -= ((size_t)tmp_file_len / elmt_size);
} /* end while */
- } /* end else */
+ } /* end else */
done:
/* Release selection iterators */
- if(file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0)
+ if (file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
- if(file_iter)
+ if (file_iter)
file_iter = H5FL_FREE(H5S_sel_iter_t, file_iter);
- if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
- if(mem_iter)
+ if (mem_iter)
mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter);
/* Release vector arrays, if allocated */
- if(file_len)
+ if (file_len)
file_len = H5FL_SEQ_FREE(size_t, file_len);
- if(file_off)
+ if (file_off)
file_off = H5FL_SEQ_FREE(hsize_t, file_off);
- if(mem_len)
+ if (mem_len)
mem_len = H5FL_SEQ_FREE(size_t, mem_len);
- if(mem_off)
+ if (mem_off)
mem_off = H5FL_SEQ_FREE(hsize_t, mem_off);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__select_io() */
-
/*-------------------------------------------------------------------------
* Function: H5D__select_read
*
@@ -276,8 +269,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__select_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space)
+H5D__select_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -285,15 +278,13 @@ H5D__select_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
/* Call generic selection operation */
H5_CHECK_OVERFLOW(nelmts, hsize_t, size_t);
- if(H5D__select_io(io_info, type_info->src_type_size, (size_t)nelmts,
- file_space, mem_space) < 0)
+ if (H5D__select_io(io_info, type_info->src_type_size, (size_t)nelmts, file_space, mem_space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, FAIL, "read error")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__select_read() */
-
/*-------------------------------------------------------------------------
* Function: H5D__select_write
*
@@ -307,8 +298,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__select_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space)
+H5D__select_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -316,11 +307,9 @@ H5D__select_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info
/* Call generic selection operation */
H5_CHECK_OVERFLOW(nelmts, hsize_t, size_t);
- if(H5D__select_io(io_info, type_info->dst_type_size, (size_t)nelmts,
- file_space, mem_space) < 0)
+ if (H5D__select_io(io_info, type_info->dst_type_size, (size_t)nelmts, file_space, mem_space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__select_write() */
-
diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c
index 5c505d6..2996ca5 100644
--- a/src/H5Dsingle.c
+++ b/src/H5Dsingle.c
@@ -26,55 +26,47 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5MFprivate.h" /* File space management */
-#include "H5VMprivate.h" /* Vector functions */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File space management */
+#include "H5VMprivate.h" /* Vector functions */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
/* Single Chunk Index chunking I/O ops */
-static herr_t H5D__single_idx_init(const H5D_chk_idx_info_t *idx_info,
- const H5S_t *space, haddr_t dset_ohdr_addr);
-static herr_t H5D__single_idx_create(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__single_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space,
+ haddr_t dset_ohdr_addr);
+static herr_t H5D__single_idx_create(const H5D_chk_idx_info_t *idx_info);
static hbool_t H5D__single_idx_is_space_alloc(const H5O_storage_chunk_t *storage);
-static herr_t H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_ud_t *udata, const H5D_t *dset);
-static herr_t H5D__single_idx_get_addr(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_ud_t *udata);
-static int H5D__single_idx_iterate(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_cb_func_t chunk_cb, void *chunk_udata);
-static herr_t H5D__single_idx_remove(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_common_ud_t *udata);
-static herr_t H5D__single_idx_delete(const H5D_chk_idx_info_t *idx_info);
-static herr_t H5D__single_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
- const H5D_chk_idx_info_t *idx_info_dst);
-static herr_t H5D__single_idx_size(const H5D_chk_idx_info_t *idx_info,
- hsize_t *size);
-static herr_t H5D__single_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
-static herr_t H5D__single_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream);
-
+static herr_t H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
+ const H5D_t *dset);
+static herr_t H5D__single_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata);
+static int H5D__single_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb,
+ void *chunk_udata);
+static herr_t H5D__single_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata);
+static herr_t H5D__single_idx_delete(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__single_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+ const H5D_chk_idx_info_t *idx_info_dst);
+static herr_t H5D__single_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size);
+static herr_t H5D__single_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
+static herr_t H5D__single_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream);
/*********************/
/* Package Variables */
@@ -82,36 +74,32 @@ static herr_t H5D__single_idx_dump(const H5O_storage_chunk_t *storage, FILE *str
/* Non Index chunk I/O ops */
const H5D_chunk_ops_t H5D_COPS_SINGLE[1] = {{
- FALSE, /* Single Chunk indexing doesn't current support SWMR access */
- H5D__single_idx_init, /* init */
- H5D__single_idx_create, /* create */
- H5D__single_idx_is_space_alloc, /* is_space_alloc */
- H5D__single_idx_insert, /* insert */
- H5D__single_idx_get_addr, /* get_addr */
- NULL, /* resize */
- H5D__single_idx_iterate, /* iterate */
- H5D__single_idx_remove, /* remove */
- H5D__single_idx_delete, /* delete */
- H5D__single_idx_copy_setup, /* copy_setup */
- NULL, /* copy_shutdown */
- H5D__single_idx_size, /* size */
- H5D__single_idx_reset, /* reset */
- H5D__single_idx_dump, /* dump */
- NULL /* destroy */
+ FALSE, /* Single Chunk indexing doesn't current support SWMR access */
+ H5D__single_idx_init, /* init */
+ H5D__single_idx_create, /* create */
+ H5D__single_idx_is_space_alloc, /* is_space_alloc */
+ H5D__single_idx_insert, /* insert */
+ H5D__single_idx_get_addr, /* get_addr */
+ NULL, /* resize */
+ H5D__single_idx_iterate, /* iterate */
+ H5D__single_idx_remove, /* remove */
+ H5D__single_idx_delete, /* delete */
+ H5D__single_idx_copy_setup, /* copy_setup */
+ NULL, /* copy_shutdown */
+ H5D__single_idx_size, /* size */
+ H5D__single_idx_reset, /* reset */
+ H5D__single_idx_dump, /* dump */
+ NULL /* destroy */
}};
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5D__single_idx_init
*
@@ -125,8 +113,8 @@ const H5D_chunk_ops_t H5D_COPS_SINGLE[1] = {{
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__single_idx_init(const H5D_chk_idx_info_t *idx_info,
- const H5S_t H5_ATTR_UNUSED *space, haddr_t H5_ATTR_UNUSED dset_ohdr_addr)
+H5D__single_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNUSED *space,
+ haddr_t H5_ATTR_UNUSED dset_ohdr_addr)
{
FUNC_ENTER_STATIC_NOERR
@@ -137,15 +125,14 @@ H5D__single_idx_init(const H5D_chk_idx_info_t *idx_info,
HDassert(idx_info->layout);
HDassert(idx_info->storage);
- if(idx_info->pline->nused)
- idx_info->layout->flags |= H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER;
+ if (idx_info->pline->nused)
+ idx_info->layout->flags |= H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER;
else
- idx_info->layout->flags = 0;
+ idx_info->layout->flags = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__single_idx_init() */
-
/*-------------------------------------------------------------------------
* Function: H5D__single_idx_create
*
@@ -173,15 +160,14 @@ H5D__single_idx_create(const H5D_chk_idx_info_t *idx_info)
HDassert(idx_info->layout->nchunks == 1);
HDassert(!H5F_addr_defined(idx_info->storage->idx_addr));
- if(idx_info->pline->nused)
- HDassert(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER);
+ if (idx_info->pline->nused)
+ HDassert(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER);
else
- HDassert(!(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER));
+ HDassert(!(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER));
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__single_idx_create() */
-
/*-------------------------------------------------------------------------
* Function: H5D__single_idx_is_space_alloc
*
@@ -204,7 +190,6 @@ H5D__single_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr))
} /* end H5D__single_idx_is_space_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5D__single_idx_insert
*
@@ -217,10 +202,9 @@ H5D__single_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
- const H5D_t *dset)
+H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, const H5D_t *dset)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -238,22 +222,21 @@ H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata
HDassert(H5F_addr_defined(udata->chunk_block.offset));
idx_info->storage->idx_addr = udata->chunk_block.offset;
- if(idx_info->pline->nused > 0) {
+ if (idx_info->pline->nused > 0) {
H5_CHECKED_ASSIGN(idx_info->storage->u.single.nbytes, uint32_t, udata->chunk_block.length, hsize_t);
- idx_info->storage->u.single.filter_mask = udata->filter_mask;
+ idx_info->storage->u.single.filter_mask = udata->filter_mask;
} /* end if */
- if(dset)
- if(dset->shared->dcpl_cache.fill.alloc_time != H5D_ALLOC_TIME_EARLY || idx_info->pline->nused > 0)
+ if (dset)
+ if (dset->shared->dcpl_cache.fill.alloc_time != H5D_ALLOC_TIME_EARLY || idx_info->pline->nused > 0)
/* Mark the layout dirty so that the address of the single chunk will be flushed later */
- if(H5D__mark(dset, H5D_MARK_LAYOUT) < 0)
+ if (H5D__mark(dset, H5D_MARK_LAYOUT) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark layout as dirty")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__single_idx_insert() */
-
/*-------------------------------------------------------------------------
* Function: H5D__single_idx_get_addr
*
@@ -282,21 +265,20 @@ H5D__single_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda
HDassert(udata);
udata->chunk_block.offset = idx_info->storage->idx_addr;
- if(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) {
- udata->chunk_block.length = idx_info->storage->u.single.nbytes;
- udata->filter_mask = idx_info->storage->u.single.filter_mask;
+ if (idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) {
+ udata->chunk_block.length = idx_info->storage->u.single.nbytes;
+ udata->filter_mask = idx_info->storage->u.single.filter_mask;
} /* end if */
else {
- udata->chunk_block.length = idx_info->layout->size;
- udata->filter_mask = 0;
+ udata->chunk_block.length = idx_info->layout->size;
+ udata->filter_mask = 0;
} /* end else */
- if(!H5F_addr_defined(udata->chunk_block.offset))
+ if (!H5F_addr_defined(udata->chunk_block.offset))
udata->chunk_block.length = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__single_idx_get_addr() */
-
/*-------------------------------------------------------------------------
* Function: H5D__single_idx_iterate
*
@@ -309,11 +291,10 @@ H5D__single_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda
*-------------------------------------------------------------------------
*/
static int
-H5D__single_idx_iterate(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
+H5D__single_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
{
- H5D_chunk_rec_t chunk_rec; /* generic chunk record */
- int ret_value = -1; /* Return value */
+ H5D_chunk_rec_t chunk_rec; /* generic chunk record */
+ int ret_value = -1; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -331,23 +312,22 @@ H5D__single_idx_iterate(const H5D_chk_idx_info_t *idx_info,
HDmemset(&chunk_rec, 0, sizeof(chunk_rec));
chunk_rec.chunk_addr = idx_info->storage->idx_addr;
- if(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) {
- chunk_rec.nbytes = idx_info->storage->u.single.nbytes;
- chunk_rec.filter_mask = idx_info->storage->u.single.filter_mask;
+ if (idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) {
+ chunk_rec.nbytes = idx_info->storage->u.single.nbytes;
+ chunk_rec.filter_mask = idx_info->storage->u.single.filter_mask;
} /* end if */
else {
- chunk_rec.nbytes = idx_info->layout->size;
- chunk_rec.filter_mask = 0;
+ chunk_rec.nbytes = idx_info->layout->size;
+ chunk_rec.filter_mask = 0;
} /* end else */
/* Make "generic chunk" callback */
- if((ret_value = (*chunk_cb)(&chunk_rec, chunk_udata)) < 0)
- HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback");
+ if ((ret_value = (*chunk_cb)(&chunk_rec, chunk_udata)) < 0)
+ HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback");
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__single_idx_iterate() */
-
/*-------------------------------------------------------------------------
* Function: H5D__single_idx_remove
*
@@ -362,8 +342,8 @@ H5D__single_idx_iterate(const H5D_chk_idx_info_t *idx_info,
static herr_t
H5D__single_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t H5_ATTR_UNUSED *udata)
{
- hsize_t nbytes; /* Size of all chunks */
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t nbytes; /* Size of all chunks */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -375,12 +355,12 @@ H5D__single_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t
HDassert(idx_info->storage);
HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
- if(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER)
- nbytes = idx_info->storage->u.single.nbytes;
+ if (idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER)
+ nbytes = idx_info->storage->u.single.nbytes;
else
- nbytes = idx_info->layout->size;
+ nbytes = idx_info->layout->size;
- if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->storage->idx_addr, nbytes) < 0)
+ if (H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->storage->idx_addr, nbytes) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free dataset chunks")
idx_info->storage->idx_addr = HADDR_UNDEF;
@@ -389,7 +369,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__single_idx_remove() */
-
/*-------------------------------------------------------------------------
* Function: H5D__single_idx_delete
*
@@ -405,7 +384,7 @@ done:
static herr_t
H5D__single_idx_delete(const H5D_chk_idx_info_t *idx_info)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -416,15 +395,14 @@ H5D__single_idx_delete(const H5D_chk_idx_info_t *idx_info)
HDassert(idx_info->layout);
HDassert(idx_info->storage);
- if(H5F_addr_defined(idx_info->storage->idx_addr))
- ret_value = H5D__single_idx_remove(idx_info, NULL);
+ if (H5F_addr_defined(idx_info->storage->idx_addr))
+ ret_value = H5D__single_idx_remove(idx_info, NULL);
else
- HDassert(!H5F_addr_defined(idx_info->storage->idx_addr));
+ HDassert(!H5F_addr_defined(idx_info->storage->idx_addr));
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__single_idx_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5D__single_idx_copy_setup
*
@@ -438,9 +416,9 @@ H5D__single_idx_delete(const H5D_chk_idx_info_t *idx_info)
*/
static herr_t
H5D__single_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_info_src,
- const H5D_chk_idx_info_t *idx_info_dst)
+ const H5D_chk_idx_info_t * idx_info_dst)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -462,7 +440,7 @@ H5D__single_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_i
H5_BEGIN_TAG(H5AC__COPIED_TAG);
/* Set up information at the destination file */
- if(H5D__single_idx_create(idx_info_dst) < 0)
+ if (H5D__single_idx_create(idx_info_dst) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
/* Reset metadata tag */
@@ -472,7 +450,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__single_idx_copy_setup() */
-
/*-------------------------------------------------------------------------
* Function: H5D__single_idx_size
*
@@ -498,7 +475,6 @@ H5D__single_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__single_idx_size() */
-
/*-------------------------------------------------------------------------
* Function: H5D__single_idx_reset
*
@@ -519,13 +495,12 @@ H5D__single_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
HDassert(storage);
/* Reset index info */
- if(reset_addr)
- storage->idx_addr = HADDR_UNDEF;
+ if (reset_addr)
+ storage->idx_addr = HADDR_UNDEF;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__single_idx_reset() */
-
/*-------------------------------------------------------------------------
* Function: H5D__single_idx_dump
*
@@ -550,4 +525,3 @@ H5D__single_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__single_idx_dump() */
-
diff --git a/src/H5Dtest.c b/src/H5Dtest.c
index 7c791d4..67b3a6c 100644
--- a/src/H5Dtest.c
+++ b/src/H5Dtest.c
@@ -21,46 +21,38 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-#define H5D_TESTING /*suppress warning about H5D testing funcs*/
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
+#define H5D_TESTING /*suppress warning about H5D testing funcs*/
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
-#include "H5VLprivate.h" /* Virtual Object Layer */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*--------------------------------------------------------------------------
NAME
H5D__layout_version_test
@@ -83,23 +75,22 @@
herr_t
H5D__layout_version_test(hid_t did, unsigned *version)
{
- H5D_t *dset; /* Pointer to dataset to query */
+ H5D_t *dset; /* Pointer to dataset to query */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_PACKAGE
/* Check args */
- if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
+ if (NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset")
- if(version)
+ if (version)
*version = dset->shared->layout.version;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5D__layout_version_test() */
+} /* H5D__layout_version_test() */
-
/*--------------------------------------------------------------------------
NAME
H5D__layout_contig_size_test
@@ -122,25 +113,24 @@ done:
herr_t
H5D__layout_contig_size_test(hid_t did, hsize_t *size)
{
- H5D_t *dset; /* Pointer to dataset to query */
+ H5D_t *dset; /* Pointer to dataset to query */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_PACKAGE
/* Check args */
- if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
+ if (NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset")
- if(size) {
+ if (size) {
HDassert(dset->shared->layout.type == H5D_CONTIGUOUS);
*size = dset->shared->layout.storage.u.contig.size;
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5D__layout_contig_size_test() */
+} /* H5D__layout_contig_size_test() */
-
/*--------------------------------------------------------------------------
NAME
H5D__layout_compact_dirty_test
@@ -169,19 +159,18 @@ H5D__layout_compact_dirty_test(hid_t did, hbool_t *dirty)
FUNC_ENTER_PACKAGE
/* Check args */
- if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
+ if (NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset")
- if(dirty) {
+ if (dirty) {
HDassert(dset->shared->layout.type == H5D_COMPACT);
*dirty = dset->shared->layout.storage.u.compact.dirty;
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5D__layout_compact_dirty_test() */
+} /* H5D__layout_compact_dirty_test() */
-
/*--------------------------------------------------------------------------
NAME
H5D__layout_type_test
@@ -204,25 +193,24 @@ done:
herr_t
H5D__layout_type_test(hid_t did, H5D_layout_t *layout_type)
{
- H5D_t *dset; /* Pointer to dataset to query */
- herr_t ret_value = SUCCEED; /* return value */
+ H5D_t *dset; /* Pointer to dataset to query */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_PACKAGE
HDassert(layout_type);
/* Check args */
- if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
+ if (NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
- if(layout_type)
+ if (layout_type)
*layout_type = dset->shared->layout.type;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5D__layout_type_test() */
+} /* H5D__layout_type_test() */
-
/*--------------------------------------------------------------------------
NAME
H5D__layout_idx_type_test
@@ -245,25 +233,24 @@ done:
herr_t
H5D__layout_idx_type_test(hid_t did, H5D_chunk_index_t *idx_type)
{
- H5D_t *dset; /* Pointer to dataset to query */
- herr_t ret_value = SUCCEED; /* return value */
+ H5D_t *dset; /* Pointer to dataset to query */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_PACKAGE
/* Check args */
- if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
+ if (NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
- if(dset->shared->layout.type != H5D_CHUNKED)
+ if (dset->shared->layout.type != H5D_CHUNKED)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not chunked")
- if(idx_type)
+ if (idx_type)
*idx_type = dset->shared->layout.u.chunk.idx_type;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5D__layout_idx_type_test() */
+} /* H5D__layout_idx_type_test() */
-
/*--------------------------------------------------------------------------
NAME
H5D__current_cache_size_test
@@ -286,26 +273,25 @@ done:
herr_t
H5D__current_cache_size_test(hid_t did, size_t *nbytes_used, int *nused)
{
- H5D_t *dset; /* Pointer to dataset to query */
- herr_t ret_value = SUCCEED; /* return value */
+ H5D_t *dset; /* Pointer to dataset to query */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_PACKAGE
/* Check args */
- if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
+ if (NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
- if(nbytes_used) {
+ if (nbytes_used) {
HDassert(dset->shared->layout.type == H5D_CHUNKED);
*nbytes_used = dset->shared->cache.chunk.nbytes_used;
} /* end if */
- if(nused) {
+ if (nused) {
HDassert(dset->shared->layout.type == H5D_CHUNKED);
*nused = dset->shared->cache.chunk.nused;
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5D__current_cache_size_test() */
-
+} /* H5D__current_cache_size_test() */
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index e997a33..2588d1c 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -46,26 +46,25 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Gprivate.h" /* Groups */
-#include "H5HGprivate.h" /* Global Heaps */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Pprivate.h" /* Property Lists */
-#include "H5Sprivate.h" /* Dataspaces */
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dpkg.h" /* Dataset functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Gprivate.h" /* Groups */
+#include "H5HGprivate.h" /* Global Heaps */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Pprivate.h" /* Property Lists */
+#include "H5Sprivate.h" /* Dataspaces */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
/* Local Macros */
@@ -74,76 +73,56 @@
/* Default size for sub_dset array */
#define H5D_VIRTUAL_DEF_SUB_DSET_SIZE 128
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
/* Layout operation callbacks */
static hbool_t H5D__virtual_is_data_cached(const H5D_shared_t *shared_dset);
-static herr_t H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t
- *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t *fm);
-static herr_t H5D__virtual_write(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space,
- const H5S_t *mem_space, H5D_chunk_map_t *fm);
-static herr_t H5D__virtual_flush(H5D_t *dset);
+static herr_t H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm);
+static herr_t H5D__virtual_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm);
+static herr_t H5D__virtual_flush(H5D_t *dset);
/* Other functions */
-static herr_t H5D__virtual_open_source_dset(const H5D_t *vdset,
- H5O_storage_virtual_ent_t *virtual_ent,
- H5O_storage_virtual_srcdset_t *source_dset);
-static herr_t H5D__virtual_reset_source_dset(H5O_storage_virtual_ent_t *virtual_ent,
- H5O_storage_virtual_srcdset_t *source_dset);
-static herr_t H5D__virtual_str_append(const char *src, size_t src_len, char **p,
- char **buf, size_t *buf_size);
-static herr_t H5D__virtual_copy_parsed_name(
- H5O_storage_virtual_name_seg_t **dst, H5O_storage_virtual_name_seg_t *src);
-static herr_t H5D__virtual_build_source_name(char *source_name,
- const H5O_storage_virtual_name_seg_t *parsed_name, size_t static_strlen,
- size_t nsubs, hsize_t blockno, char **built_name);
+static herr_t H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *virtual_ent,
+ H5O_storage_virtual_srcdset_t *source_dset);
+static herr_t H5D__virtual_reset_source_dset(H5O_storage_virtual_ent_t * virtual_ent,
+ H5O_storage_virtual_srcdset_t *source_dset);
+static herr_t H5D__virtual_str_append(const char *src, size_t src_len, char **p, char **buf,
+ size_t *buf_size);
+static herr_t H5D__virtual_copy_parsed_name(H5O_storage_virtual_name_seg_t **dst,
+ H5O_storage_virtual_name_seg_t * src);
+static herr_t H5D__virtual_build_source_name(char * source_name,
+ const H5O_storage_virtual_name_seg_t *parsed_name,
+ size_t static_strlen, size_t nsubs, hsize_t blockno,
+ char **built_name);
static herr_t H5D__virtual_init_all(const H5D_t *dset);
-static herr_t H5D__virtual_pre_io(H5D_io_info_t *io_info,
- H5O_storage_virtual_t *storage, const H5S_t *file_space,
- const H5S_t *mem_space, hsize_t *tot_nelmts);
+static herr_t H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage,
+ const H5S_t *file_space, const H5S_t *mem_space, hsize_t *tot_nelmts);
static herr_t H5D__virtual_post_io(H5O_storage_virtual_t *storage);
-static herr_t H5D__virtual_read_one(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, const H5S_t *file_space,
- H5O_storage_virtual_srcdset_t *source_dset);
-static herr_t H5D__virtual_write_one(H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, const H5S_t *file_space,
- H5O_storage_virtual_srcdset_t *source_dset);
-
+static herr_t H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ const H5S_t *file_space, H5O_storage_virtual_srcdset_t *source_dset);
+static herr_t H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
+ const H5S_t *file_space, H5O_storage_virtual_srcdset_t *source_dset);
/*********************/
/* Package Variables */
/*********************/
/* Contiguous storage layout I/O ops */
-const H5D_layout_ops_t H5D_LOPS_VIRTUAL[1] = {{
- NULL,
- H5D__virtual_init,
- H5D__virtual_is_space_alloc,
- H5D__virtual_is_data_cached,
- NULL,
- H5D__virtual_read,
- H5D__virtual_write,
+const H5D_layout_ops_t H5D_LOPS_VIRTUAL[1] = {{NULL, H5D__virtual_init, H5D__virtual_is_space_alloc,
+ H5D__virtual_is_data_cached, NULL, H5D__virtual_read,
+ H5D__virtual_write,
#ifdef H5_HAVE_PARALLEL
- NULL,
- NULL,
+ NULL, NULL,
#endif /* H5_HAVE_PARALLEL */
- NULL,
- NULL,
- H5D__virtual_flush,
- NULL,
- NULL
-}};
-
+ NULL, NULL, H5D__virtual_flush, NULL, NULL}};
/*******************/
/* Local Variables */
@@ -155,8 +134,6 @@ H5FL_DEFINE(H5O_storage_virtual_name_seg_t);
/* Declare a static free list to manage H5D_virtual_file_list_t structs */
H5FL_DEFINE_STATIC(H5D_virtual_held_file_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5D_virtual_check_mapping_pre
*
@@ -173,60 +150,66 @@ H5FL_DEFINE_STATIC(H5D_virtual_held_file_t);
*/
herr_t
H5D_virtual_check_mapping_pre(const H5S_t *vspace, const H5S_t *src_space,
- H5O_virtual_space_status_t space_status)
+ H5O_virtual_space_status_t space_status)
{
- H5S_sel_type select_type; /* Selection type */
- hsize_t nelmts_vs; /* Number of elements in virtual selection */
- hsize_t nelmts_ss; /* Number of elements in source selection */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5S_sel_type select_type; /* Selection type */
+ hsize_t nelmts_vs; /* Number of elements in virtual selection */
+ hsize_t nelmts_ss; /* Number of elements in source selection */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check for point selections (currently unsupported) */
- if(H5S_SEL_ERROR == (select_type = H5S_GET_SELECT_TYPE(vspace)))
+ if (H5S_SEL_ERROR == (select_type = H5S_GET_SELECT_TYPE(vspace)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get selection type")
- if(select_type == H5S_SEL_POINTS)
- HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "point selections not currently supported with virtual datasets")
- if(H5S_SEL_ERROR == (select_type = H5S_GET_SELECT_TYPE(src_space)))
+ if (select_type == H5S_SEL_POINTS)
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
+ "point selections not currently supported with virtual datasets")
+ if (H5S_SEL_ERROR == (select_type = H5S_GET_SELECT_TYPE(src_space)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get selection type")
- if(select_type == H5S_SEL_POINTS)
- HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "point selections not currently supported with virtual datasets")
+ if (select_type == H5S_SEL_POINTS)
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
+ "point selections not currently supported with virtual datasets")
/* Get number of elements in spaces */
nelmts_vs = (hsize_t)H5S_GET_SELECT_NPOINTS(vspace);
nelmts_ss = (hsize_t)H5S_GET_SELECT_NPOINTS(src_space);
/* Check for unlimited vspace */
- if(nelmts_vs == H5S_UNLIMITED) {
+ if (nelmts_vs == H5S_UNLIMITED) {
/* Check for unlimited src_space */
- if(nelmts_ss == H5S_UNLIMITED) {
- hsize_t nenu_vs; /* Number of elements in the non-unlimited dimensions of vspace */
- hsize_t nenu_ss; /* Number of elements in the non-unlimited dimensions of src_space */
+ if (nelmts_ss == H5S_UNLIMITED) {
+ hsize_t nenu_vs; /* Number of elements in the non-unlimited dimensions of vspace */
+ hsize_t nenu_ss; /* Number of elements in the non-unlimited dimensions of src_space */
/* Non-printf unlimited selection. Make sure both selections have
* the same number of elements in the non-unlimited dimension. Note
* we can always check this even if the space status is invalid
* because unlimited selections are never dependent on the extent.
*/
- if(H5S_get_select_num_elem_non_unlim(vspace, &nenu_vs) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "can't get number of elements in non-unlimited dimension")
- if(H5S_get_select_num_elem_non_unlim(src_space, &nenu_ss) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "can't get number of elements in non-unlimited dimension")
- if(nenu_vs != nenu_ss)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "numbers of elemnts in the non-unlimited dimensions is different for source and virtual spaces")
+ if (H5S_get_select_num_elem_non_unlim(vspace, &nenu_vs) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL,
+ "can't get number of elements in non-unlimited dimension")
+ if (H5S_get_select_num_elem_non_unlim(src_space, &nenu_ss) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL,
+ "can't get number of elements in non-unlimited dimension")
+ if (nenu_vs != nenu_ss)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "numbers of elemnts in the non-unlimited dimensions is different for source and "
+ "virtual spaces")
} /* end if */
/* We will handle the printf case after parsing the source names */
} /* end if */
- else if(space_status != H5O_VIRTUAL_STATUS_INVALID)
+ else if (space_status != H5O_VIRTUAL_STATUS_INVALID)
/* Limited selections. Check number of points is the same. */
- if(nelmts_vs != nelmts_ss)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "virtual and source space selections have different numbers of elements")
+ if (nelmts_vs != nelmts_ss)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "virtual and source space selections have different numbers of elements")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_virtual_check_mapping_pre() */
-
/*-------------------------------------------------------------------------
* Function: H5D_virtual_check_mapping_post
*
@@ -243,10 +226,10 @@ done:
herr_t
H5D_virtual_check_mapping_post(const H5O_storage_virtual_ent_t *ent)
{
- hsize_t nelmts_vs; /* Number of elements in virtual selection */
- hsize_t nelmts_ss; /* Number of elements in source selection */
- H5S_t *tmp_space = NULL; /* Temporary dataspace */
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t nelmts_vs; /* Number of elements in virtual selection */
+ hsize_t nelmts_ss; /* Number of elements in source selection */
+ H5S_t * tmp_space = NULL; /* Temporary dataspace */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -255,46 +238,52 @@ H5D_virtual_check_mapping_post(const H5O_storage_virtual_ent_t *ent)
nelmts_ss = (hsize_t)H5S_GET_SELECT_NPOINTS(ent->source_select);
/* Check for printf selection */
- if((nelmts_vs == H5S_UNLIMITED) && (nelmts_ss != H5S_UNLIMITED)) {
+ if ((nelmts_vs == H5S_UNLIMITED) && (nelmts_ss != H5S_UNLIMITED)) {
/* Make sure there at least one %b substitution in the source file or
* dataset name */
- if((ent->psfn_nsubs == 0) && (ent->psdn_nsubs == 0))
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unlimited virtual selection, limited source selection, and no printf specifiers in source names")
+ if ((ent->psfn_nsubs == 0) && (ent->psdn_nsubs == 0))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL,
+ "unlimited virtual selection, limited source selection, and no printf specifiers in "
+ "source names")
/* Make sure virtual space uses hyperslab selection */
- if(H5S_GET_SELECT_TYPE(ent->source_dset.virtual_select) != H5S_SEL_HYPERSLABS)
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "virtual selection with printf mapping must be hyperslab")
+ if (H5S_GET_SELECT_TYPE(ent->source_dset.virtual_select) != H5S_SEL_HYPERSLABS)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL,
+ "virtual selection with printf mapping must be hyperslab")
/* Check that the number of elements in one block in the virtual
* selection matches the total number of elements in the source
* selection, if the source space status is not invalid (virtual space
* status does not matter here because it is unlimited) */
- if(ent->source_space_status != H5O_VIRTUAL_STATUS_INVALID) {
+ if (ent->source_space_status != H5O_VIRTUAL_STATUS_INVALID) {
/* Get first block in virtual selection */
- if(NULL == (tmp_space = H5S_hyper_get_unlim_block(ent->source_dset.virtual_select, (hsize_t)0)))
+ if (NULL == (tmp_space = H5S_hyper_get_unlim_block(ent->source_dset.virtual_select, (hsize_t)0)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get first block in virtual selection")
/* Check number of points */
nelmts_vs = (hsize_t)H5S_GET_SELECT_NPOINTS(tmp_space);
- if(nelmts_vs != nelmts_ss)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "virtual (single block) and source space selections have different numbers of elements")
+ if (nelmts_vs != nelmts_ss)
+ HGOTO_ERROR(
+ H5E_ARGS, H5E_BADVALUE, FAIL,
+ "virtual (single block) and source space selections have different numbers of elements")
} /* end if */
- } /* end if */
+ } /* end if */
else
/* Make sure there are no printf substitutions */
- if((ent->psfn_nsubs > 0) || (ent->psdn_nsubs > 0))
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "printf specifier(s) in source name(s) without an unlimited virtual selection and limited source selection")
+ if ((ent->psfn_nsubs > 0) || (ent->psdn_nsubs > 0))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL,
+ "printf specifier(s) in source name(s) without an unlimited virtual selection and "
+ "limited source selection")
done:
/* Free temporary space */
- if(tmp_space)
- if(H5S_close(tmp_space) < 0)
+ if (tmp_space)
+ if (H5S_close(tmp_space) < 0)
HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "can't close dataspace")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_virtual_check_mapping_post() */
-
/*-------------------------------------------------------------------------
* Function: H5D_virtual_update_min_dims
*
@@ -313,14 +302,14 @@ done:
herr_t
H5D_virtual_update_min_dims(H5O_layout_t *layout, size_t idx)
{
- H5O_storage_virtual_t *virt = &layout->storage.u.virt;
- H5O_storage_virtual_ent_t *ent = &virt->list[idx];
- H5S_sel_type sel_type;
- int rank;
- hsize_t bounds_start[H5S_MAX_RANK];
- hsize_t bounds_end[H5S_MAX_RANK];
- int i;
- herr_t ret_value = SUCCEED;
+ H5O_storage_virtual_t * virt = &layout->storage.u.virt;
+ H5O_storage_virtual_ent_t *ent = &virt->list[idx];
+ H5S_sel_type sel_type;
+ int rank;
+ hsize_t bounds_start[H5S_MAX_RANK];
+ hsize_t bounds_end[H5S_MAX_RANK];
+ int i;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
@@ -329,33 +318,31 @@ H5D_virtual_update_min_dims(H5O_layout_t *layout, size_t idx)
HDassert(idx < virt->list_nalloc);
/* Get type of selection */
- if(H5S_SEL_ERROR == (sel_type = H5S_GET_SELECT_TYPE(ent->source_dset.virtual_select)))
+ if (H5S_SEL_ERROR == (sel_type = H5S_GET_SELECT_TYPE(ent->source_dset.virtual_select)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection type")
/* Do not update min_dims for "all" or "none" selections */
- if((sel_type == H5S_SEL_ALL) || (sel_type == H5S_SEL_NONE))
+ if ((sel_type == H5S_SEL_ALL) || (sel_type == H5S_SEL_NONE))
HGOTO_DONE(SUCCEED)
/* Get rank of vspace */
- if((rank = H5S_GET_EXTENT_NDIMS(ent->source_dset.virtual_select)) < 0)
+ if ((rank = H5S_GET_EXTENT_NDIMS(ent->source_dset.virtual_select)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get number of dimensions")
/* Get selection bounds */
- if(H5S_SELECT_BOUNDS(ent->source_dset.virtual_select, bounds_start, bounds_end) < 0)
+ if (H5S_SELECT_BOUNDS(ent->source_dset.virtual_select, bounds_start, bounds_end) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds")
/* Update min_dims */
- for(i = 0; i < rank; i++)
+ for (i = 0; i < rank; i++)
/* Don't check unlimited dimensions in the selection */
- if((i != ent->unlim_dim_virtual)
- && (bounds_end[i] >= virt->min_dims[i]))
+ if ((i != ent->unlim_dim_virtual) && (bounds_end[i] >= virt->min_dims[i]))
virt->min_dims[i] = bounds_end[i] + (hsize_t)1;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_virtual_update_min_dims() */
-
/*-------------------------------------------------------------------------
* Function: H5D_virtual_check_min_dims
*
@@ -372,10 +359,10 @@ done:
herr_t
H5D_virtual_check_min_dims(const H5D_t *dset)
{
- int rank;
- hsize_t dims[H5S_MAX_RANK];
- int i;
- herr_t ret_value = SUCCEED;
+ int rank;
+ hsize_t dims[H5S_MAX_RANK];
+ int i;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
@@ -384,23 +371,24 @@ H5D_virtual_check_min_dims(const H5D_t *dset)
HDassert(dset->shared->layout.type == H5D_VIRTUAL);
/* Get rank of dataspace */
- if((rank = H5S_GET_EXTENT_NDIMS(dset->shared->space)) < 0)
+ if ((rank = H5S_GET_EXTENT_NDIMS(dset->shared->space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get number of dimensions")
/* Get VDS dimensions */
- if(H5S_get_simple_extent_dims(dset->shared->space, dims, NULL) < 0)
+ if (H5S_get_simple_extent_dims(dset->shared->space, dims, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS dimensions")
/* Verify that dimensions are larger than min_dims */
- for(i = 0; i < rank; i++)
- if(dims[i] < dset->shared->layout.storage.u.virt.min_dims[i])
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "virtual dataset dimensions not large enough to contain all limited dimensions in all selections")
+ for (i = 0; i < rank; i++)
+ if (dims[i] < dset->shared->layout.storage.u.virt.min_dims[i])
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "virtual dataset dimensions not large enough to contain all limited dimensions in "
+ "all selections")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_virtual_check_min_dims() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_store_layout
*
@@ -421,15 +409,15 @@ done:
herr_t
H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
{
- H5O_storage_virtual_t *virt = &layout->storage.u.virt;
- uint8_t *heap_block = NULL; /* Block to add to heap */
- size_t *str_size = NULL; /* Array for VDS entry string lengths */
- uint8_t *heap_block_p; /* Pointer into the heap block, while encoding */
- size_t block_size; /* Total size of block needed */
- hsize_t tmp_nentries; /* Temp. variable for # of VDS entries */
- uint32_t chksum; /* Checksum for heap data */
- size_t i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_storage_virtual_t *virt = &layout->storage.u.virt;
+ uint8_t * heap_block = NULL; /* Block to add to heap */
+ size_t * str_size = NULL; /* Array for VDS entry string lengths */
+ uint8_t * heap_block_p; /* Pointer into the heap block, while encoding */
+ size_t block_size; /* Total size of block needed */
+ hsize_t tmp_nentries; /* Temp. variable for # of VDS entries */
+ uint32_t chksum; /* Checksum for heap data */
+ size_t i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -439,13 +427,13 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
HDassert(virt->serial_list_hobjid.addr == HADDR_UNDEF);
/* Create block if # of used entries > 0 */
- if(virt->list_nused > 0) {
+ if (virt->list_nused > 0) {
/* Set the low/high bounds according to 'f' for the API context */
H5CX_set_libver_bounds(f);
/* Allocate array for caching results of strlen */
- if(NULL == (str_size = (size_t *)H5MM_malloc(2 * virt->list_nused * sizeof(size_t))))
+ if (NULL == (str_size = (size_t *)H5MM_malloc(2 * virt->list_nused * sizeof(size_t))))
HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, FAIL, "unable to allocate string length array")
/*
@@ -456,9 +444,9 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
block_size = (size_t)1 + H5F_SIZEOF_SIZE(f);
/* Calculate size of each entry */
- for(i = 0; i < virt->list_nused; i++) {
+ for (i = 0; i < virt->list_nused; i++) {
H5O_storage_virtual_ent_t *ent = &virt->list[i];
- hssize_t select_serial_size; /* Size of serialized selection */
+ hssize_t select_serial_size; /* Size of serialized selection */
HDassert(ent->source_file_name);
HDassert(ent->source_dset_name);
@@ -474,12 +462,12 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
block_size += str_size[(2 * i) + 1];
/* Source selection */
- if((select_serial_size = H5S_SELECT_SERIAL_SIZE(ent->source_select)) < 0)
+ if ((select_serial_size = H5S_SELECT_SERIAL_SIZE(ent->source_select)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size")
block_size += (size_t)select_serial_size;
/* Virtual dataset selection */
- if((select_serial_size = H5S_SELECT_SERIAL_SIZE(ent->source_dset.virtual_select)) < 0)
+ if ((select_serial_size = H5S_SELECT_SERIAL_SIZE(ent->source_dset.virtual_select)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size")
block_size += (size_t)select_serial_size;
} /* end for */
@@ -487,12 +475,10 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
/* Checksum */
block_size += 4;
-
/* Allocate heap block */
- if(NULL == (heap_block = (uint8_t *)H5MM_malloc(block_size)))
+ if (NULL == (heap_block = (uint8_t *)H5MM_malloc(block_size)))
HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, FAIL, "unable to allocate heap block")
-
/*
* Encode heap block
*/
@@ -506,7 +492,7 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
H5F_ENCODE_LENGTH(f, heap_block_p, tmp_nentries)
/* Encode each entry */
- for(i = 0; i < virt->list_nused; i++) {
+ for (i = 0; i < virt->list_nused; i++) {
H5O_storage_virtual_ent_t *ent = &virt->list[i];
/* Source file name */
H5MM_memcpy((char *)heap_block_p, ent->source_file_name, str_size[2 * i]);
@@ -517,11 +503,11 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
heap_block_p += str_size[(2 * i) + 1];
/* Source selection */
- if(H5S_SELECT_SERIALIZE(ent->source_select, &heap_block_p) < 0)
+ if (H5S_SELECT_SERIALIZE(ent->source_select, &heap_block_p) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize source selection")
/* Virtual selection */
- if(H5S_SELECT_SERIALIZE(ent->source_dset.virtual_select, &heap_block_p) < 0)
+ if (H5S_SELECT_SERIALIZE(ent->source_dset.virtual_select, &heap_block_p) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize virtual selection")
} /* end for */
@@ -530,18 +516,18 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
UINT32ENCODE(heap_block_p, chksum)
/* Insert block into global heap */
- if(H5HG_insert(f, block_size, heap_block, &(virt->serial_list_hobjid)) < 0) /* Casting away const OK --NAF */
+ if (H5HG_insert(f, block_size, heap_block, &(virt->serial_list_hobjid)) <
+ 0) /* Casting away const OK --NAF */
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to insert virtual dataset heap block")
} /* end if */
done:
heap_block = (uint8_t *)H5MM_xfree(heap_block);
- str_size = (size_t *)H5MM_xfree(str_size);
+ str_size = (size_t *)H5MM_xfree(str_size);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_store_layout() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_copy_layout
*
@@ -561,12 +547,12 @@ herr_t
H5D__virtual_copy_layout(H5O_layout_t *layout)
{
H5O_storage_virtual_ent_t *orig_list = NULL;
- H5O_storage_virtual_t *virt = &layout->storage.u.virt;
- hid_t orig_source_fapl;
- hid_t orig_source_dapl;
- H5P_genplist_t *plist;
- size_t i;
- herr_t ret_value = SUCCEED;
+ H5O_storage_virtual_t * virt = &layout->storage.u.virt;
+ hid_t orig_source_fapl;
+ hid_t orig_source_dapl;
+ H5P_genplist_t * plist;
+ size_t i;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
@@ -575,124 +561,120 @@ H5D__virtual_copy_layout(H5O_layout_t *layout)
/* Save original entry list and top-level property lists and reset in layout
* so the originals aren't closed on error */
- orig_source_fapl = virt->source_fapl;
+ orig_source_fapl = virt->source_fapl;
virt->source_fapl = -1;
- orig_source_dapl = virt->source_dapl;
+ orig_source_dapl = virt->source_dapl;
virt->source_dapl = -1;
- orig_list = virt->list;
- virt->list = NULL;
+ orig_list = virt->list;
+ virt->list = NULL;
/* Copy entry list */
- if(virt->list_nused > 0) {
+ if (virt->list_nused > 0) {
HDassert(orig_list);
/* Allocate memory for the list */
- if(NULL == (virt->list = H5MM_calloc(virt->list_nused * sizeof(virt->list[0]))))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate memory for virtual dataset entry list")
+ if (NULL == (virt->list = H5MM_calloc(virt->list_nused * sizeof(virt->list[0]))))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL,
+ "unable to allocate memory for virtual dataset entry list")
virt->list_nalloc = virt->list_nused;
/* Copy the list entries, though set source_dset.dset and sub_dset to
* NULL */
- for(i = 0; i < virt->list_nused; i++) {
+ for (i = 0; i < virt->list_nused; i++) {
H5O_storage_virtual_ent_t *ent = &virt->list[i];
/* Copy virtual selection */
- if(NULL == (ent->source_dset.virtual_select
- = H5S_copy(orig_list[i].source_dset.virtual_select, FALSE, TRUE)))
+ if (NULL == (ent->source_dset.virtual_select =
+ H5S_copy(orig_list[i].source_dset.virtual_select, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy virtual selection")
/* Copy original source names */
- if(NULL == (ent->source_file_name
- = H5MM_strdup(orig_list[i].source_file_name)))
+ if (NULL == (ent->source_file_name = H5MM_strdup(orig_list[i].source_file_name)))
HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name")
- if(NULL == (ent->source_dset_name
- = H5MM_strdup(orig_list[i].source_dset_name)))
+ if (NULL == (ent->source_dset_name = H5MM_strdup(orig_list[i].source_dset_name)))
HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name")
/* Copy source selection */
- if(NULL == (ent->source_select
- = H5S_copy(orig_list[i].source_select, FALSE, TRUE)))
+ if (NULL == (ent->source_select = H5S_copy(orig_list[i].source_select, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy source selection")
/* Initialize clipped selections */
- if(orig_list[i].unlim_dim_virtual < 0) {
- ent->source_dset.clipped_source_select = ent->source_select;
+ if (orig_list[i].unlim_dim_virtual < 0) {
+ ent->source_dset.clipped_source_select = ent->source_select;
ent->source_dset.clipped_virtual_select = ent->source_dset.virtual_select;
} /* end if */
/* Copy parsed names */
- if(H5D__virtual_copy_parsed_name(&ent->parsed_source_file_name, orig_list[i].parsed_source_file_name) < 0)
+ if (H5D__virtual_copy_parsed_name(&ent->parsed_source_file_name,
+ orig_list[i].parsed_source_file_name) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy parsed source file name")
ent->psfn_static_strlen = orig_list[i].psfn_static_strlen;
- ent->psfn_nsubs = orig_list[i].psfn_nsubs;
- if(H5D__virtual_copy_parsed_name(&ent->parsed_source_dset_name, orig_list[i].parsed_source_dset_name) < 0)
+ ent->psfn_nsubs = orig_list[i].psfn_nsubs;
+ if (H5D__virtual_copy_parsed_name(&ent->parsed_source_dset_name,
+ orig_list[i].parsed_source_dset_name) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy parsed source dataset name")
ent->psdn_static_strlen = orig_list[i].psdn_static_strlen;
- ent->psdn_nsubs = orig_list[i].psdn_nsubs;
+ ent->psdn_nsubs = orig_list[i].psdn_nsubs;
/* Copy source names in source dset or add reference as appropriate
*/
- if(orig_list[i].source_dset.file_name) {
- if(orig_list[i].source_dset.file_name
- == orig_list[i].source_file_name)
+ if (orig_list[i].source_dset.file_name) {
+ if (orig_list[i].source_dset.file_name == orig_list[i].source_file_name)
ent->source_dset.file_name = ent->source_file_name;
- else if(orig_list[i].parsed_source_file_name
- && (orig_list[i].source_dset.file_name
- != orig_list[i].parsed_source_file_name->name_segment)) {
+ else if (orig_list[i].parsed_source_file_name &&
+ (orig_list[i].source_dset.file_name !=
+ orig_list[i].parsed_source_file_name->name_segment)) {
HDassert(ent->parsed_source_file_name);
HDassert(ent->parsed_source_file_name->name_segment);
ent->source_dset.file_name = ent->parsed_source_file_name->name_segment;
} /* end if */
- else
- if(NULL == (ent->source_dset.file_name
- = H5MM_strdup(orig_list[i].source_dset.file_name)))
- HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name")
+ else if (NULL ==
+ (ent->source_dset.file_name = H5MM_strdup(orig_list[i].source_dset.file_name)))
+ HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name")
} /* end if */
- if(orig_list[i].source_dset.dset_name) {
- if(orig_list[i].source_dset.dset_name
- == orig_list[i].source_dset_name)
+ if (orig_list[i].source_dset.dset_name) {
+ if (orig_list[i].source_dset.dset_name == orig_list[i].source_dset_name)
ent->source_dset.dset_name = ent->source_dset_name;
- else if(orig_list[i].parsed_source_dset_name
- && (orig_list[i].source_dset.dset_name
- != orig_list[i].parsed_source_dset_name->name_segment)) {
+ else if (orig_list[i].parsed_source_dset_name &&
+ (orig_list[i].source_dset.dset_name !=
+ orig_list[i].parsed_source_dset_name->name_segment)) {
HDassert(ent->parsed_source_dset_name);
HDassert(ent->parsed_source_dset_name->name_segment);
ent->source_dset.dset_name = ent->parsed_source_dset_name->name_segment;
} /* end if */
- else
- if(NULL == (ent->source_dset.dset_name
- = H5MM_strdup(orig_list[i].source_dset.dset_name)))
- HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name")
+ else if (NULL ==
+ (ent->source_dset.dset_name = H5MM_strdup(orig_list[i].source_dset.dset_name)))
+ HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name")
} /* end if */
/* Copy other fields in entry */
- ent->unlim_dim_source = orig_list[i].unlim_dim_source;
- ent->unlim_dim_virtual = orig_list[i].unlim_dim_virtual;
- ent->unlim_extent_source = orig_list[i].unlim_extent_source;
+ ent->unlim_dim_source = orig_list[i].unlim_dim_source;
+ ent->unlim_dim_virtual = orig_list[i].unlim_dim_virtual;
+ ent->unlim_extent_source = orig_list[i].unlim_extent_source;
ent->unlim_extent_virtual = orig_list[i].unlim_extent_virtual;
- ent->clip_size_source = orig_list[i].clip_size_source;
- ent->clip_size_virtual = orig_list[i].clip_size_virtual;
- ent->source_space_status = orig_list[i].source_space_status;
+ ent->clip_size_source = orig_list[i].clip_size_source;
+ ent->clip_size_virtual = orig_list[i].clip_size_virtual;
+ ent->source_space_status = orig_list[i].source_space_status;
ent->virtual_space_status = orig_list[i].virtual_space_status;
} /* end for */
- } /* end if */
+ } /* end if */
else {
/* Zero out other fields related to list, just to be sure */
- virt->list = NULL;
+ virt->list = NULL;
virt->list_nalloc = 0;
} /* end else */
/* Copy property lists */
- if(orig_source_fapl >= 0) {
- if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(orig_source_fapl, H5I_GENPROP_LST)))
+ if (orig_source_fapl >= 0) {
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(orig_source_fapl, H5I_GENPROP_LST)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
- if((virt->source_fapl = H5P_copy_plist(plist, FALSE)) < 0)
+ if ((virt->source_fapl = H5P_copy_plist(plist, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy fapl")
} /* end if */
- if(orig_source_dapl >= 0) {
- if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(orig_source_dapl, H5I_GENPROP_LST)))
+ if (orig_source_dapl >= 0) {
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(orig_source_dapl, H5I_GENPROP_LST)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
- if((virt->source_dapl = H5P_copy_plist(plist, FALSE)) < 0)
+ if ((virt->source_dapl = H5P_copy_plist(plist, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dapl")
} /* end if */
@@ -701,14 +683,13 @@ H5D__virtual_copy_layout(H5O_layout_t *layout)
done:
/* Release allocated resources on failure */
- if(ret_value < 0)
- if(H5D__virtual_reset_layout(layout) < 0)
+ if (ret_value < 0)
+ if (H5D__virtual_reset_layout(layout) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset virtual layout")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_copy_layout() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_reset_layout
*
@@ -728,9 +709,9 @@ done:
herr_t
H5D__virtual_reset_layout(H5O_layout_t *layout)
{
- size_t i, j;
- H5O_storage_virtual_t *virt = &layout->storage.u.virt;
- herr_t ret_value = SUCCEED;
+ size_t i, j;
+ H5O_storage_virtual_t *virt = &layout->storage.u.virt;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
@@ -740,10 +721,10 @@ H5D__virtual_reset_layout(H5O_layout_t *layout)
/* Free the list entries. Note we always attempt to free everything even in
* the case of a failure. Because of this, and because we free the list
* afterwards, we do not need to zero out the memory in the list. */
- for(i = 0; i < virt->list_nused; i++) {
+ for (i = 0; i < virt->list_nused; i++) {
H5O_storage_virtual_ent_t *ent = &virt->list[i];
/* Free source_dset */
- if(H5D__virtual_reset_source_dset(ent, &ent->source_dset) < 0)
+ if (H5D__virtual_reset_source_dset(ent, &ent->source_dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset source dataset")
/* Free original source names */
@@ -751,14 +732,14 @@ H5D__virtual_reset_layout(H5O_layout_t *layout)
(void)H5MM_xfree(ent->source_dset_name);
/* Free sub_dset */
- for(j = 0; j < ent->sub_dset_nalloc; j++)
- if(H5D__virtual_reset_source_dset(ent, &ent->sub_dset[j]) < 0)
+ for (j = 0; j < ent->sub_dset_nalloc; j++)
+ if (H5D__virtual_reset_source_dset(ent, &ent->sub_dset[j]) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset source dataset")
ent->sub_dset = H5MM_xfree(ent->sub_dset);
/* Free source_select */
- if(ent->source_select)
- if(H5S_close(ent->source_select) < 0)
+ if (ent->source_select)
+ if (H5S_close(ent->source_select) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection")
/* Free parsed_source_file_name */
@@ -769,19 +750,19 @@ H5D__virtual_reset_layout(H5O_layout_t *layout)
}
/* Free the list */
- virt->list = H5MM_xfree(virt->list);
+ virt->list = H5MM_xfree(virt->list);
virt->list_nalloc = (size_t)0;
- virt->list_nused = (size_t)0;
+ virt->list_nused = (size_t)0;
(void)HDmemset(virt->min_dims, 0, sizeof(virt->min_dims));
/* Close access property lists */
- if(virt->source_fapl >= 0) {
- if(H5I_dec_ref(virt->source_fapl) < 0)
+ if (virt->source_fapl >= 0) {
+ if (H5I_dec_ref(virt->source_fapl) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't close source fapl")
virt->source_fapl = -1;
}
- if(virt->source_dapl >= 0) {
- if(H5I_dec_ref(virt->source_dapl) < 0)
+ if (virt->source_dapl >= 0) {
+ if (H5I_dec_ref(virt->source_dapl) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't close source dapl")
virt->source_dapl = -1;
}
@@ -794,7 +775,6 @@ H5D__virtual_reset_layout(H5O_layout_t *layout)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_reset_layout() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_copy
*
@@ -810,15 +790,15 @@ H5D__virtual_reset_layout(H5O_layout_t *layout)
herr_t
H5D__virtual_copy(H5F_t *f_dst, H5O_layout_t *layout_dst)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
#ifdef NOT_YET
/* Check for copy to the same file */
- if(f_dst == f_src) {
+ if (f_dst == f_src) {
/* Increase reference count on global heap object */
- if((heap_rc = H5HG_link(f_dst, (H5HG_t *)&(layout_dst->u.virt.serial_list_hobjid), 1)) < 0)
+ if ((heap_rc = H5HG_link(f_dst, (H5HG_t *)&(layout_dst->u.virt.serial_list_hobjid), 1)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTMODIFY, FAIL, "unable to adjust global heap reference count")
} /* end if */
else
@@ -826,18 +806,17 @@ H5D__virtual_copy(H5F_t *f_dst, H5O_layout_t *layout_dst)
{
/* Reset global heap id */
layout_dst->storage.u.virt.serial_list_hobjid.addr = HADDR_UNDEF;
- layout_dst->storage.u.virt.serial_list_hobjid.idx = (size_t)0;
+ layout_dst->storage.u.virt.serial_list_hobjid.idx = (size_t)0;
/* Write the VDS data to destination file's heap */
- if(H5D__virtual_store_layout(f_dst, layout_dst) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to store VDS info")
+ if (H5D__virtual_store_layout(f_dst, layout_dst) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to store VDS info")
} /* end block/else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_copy() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_delete
*
@@ -855,7 +834,7 @@ H5D__virtual_delete(H5F_t *f, H5O_storage_t *storage)
{
#ifdef NOT_YET
int heap_rc; /* Reference count of global heap object */
-#endif /* NOT_YET */
+#endif /* NOT_YET */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -866,27 +845,26 @@ H5D__virtual_delete(H5F_t *f, H5O_storage_t *storage)
HDassert(storage->type == H5D_VIRTUAL);
/* Check for global heap block */
- if(storage->u.virt.serial_list_hobjid.addr != HADDR_UNDEF) {
+ if (storage->u.virt.serial_list_hobjid.addr != HADDR_UNDEF) {
#ifdef NOT_YET
/* Unlink the global heap block */
- if((heap_rc = H5HG_link(f, (H5HG_t *)&(storage->u.virt.serial_list_hobjid), -1)) < 0)
+ if ((heap_rc = H5HG_link(f, (H5HG_t *)&(storage->u.virt.serial_list_hobjid), -1)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTMODIFY, FAIL, "unable to adjust global heap reference count")
- if(heap_rc == 0)
+ if (heap_rc == 0)
#endif /* NOT_YET */
/* Delete the global heap block */
- if(H5HG_remove(f, (H5HG_t *)&(storage->u.virt.serial_list_hobjid)) < 0)
+ if (H5HG_remove(f, (H5HG_t *)&(storage->u.virt.serial_list_hobjid)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to remove heap object")
} /* end if */
/* Clear global heap ID in storage */
storage->u.virt.serial_list_hobjid.addr = HADDR_UNDEF;
- storage->u.virt.serial_list_hobjid.idx = 0;
+ storage->u.virt.serial_list_hobjid.idx = 0;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_delete */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_open_source_dset
*
@@ -900,13 +878,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__virtual_open_source_dset(const H5D_t *vdset,
- H5O_storage_virtual_ent_t *virtual_ent,
- H5O_storage_virtual_srcdset_t *source_dset)
+H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *virtual_ent,
+ H5O_storage_virtual_srcdset_t *source_dset)
{
- H5F_t *src_file = NULL; /* Source file */
- hbool_t src_file_open = FALSE; /* Whether we have opened and need to close src_file */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t * src_file = NULL; /* Source file */
+ hbool_t src_file_open = FALSE; /* Whether we have opened and need to close src_file */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -918,17 +895,19 @@ H5D__virtual_open_source_dset(const H5D_t *vdset,
HDassert(source_dset->dset_name);
/* Check if we need to open the source file */
- if(HDstrcmp(source_dset->file_name, ".")) {
- unsigned intent; /* File access permissions */
+ if (HDstrcmp(source_dset->file_name, ".")) {
+ unsigned intent; /* File access permissions */
/* Get the virtual dataset's file open flags ("intent") */
intent = H5F_INTENT(vdset->oloc.file);
/* Try opening the file */
- src_file = H5F_prefix_open_file(vdset->oloc.file, H5F_PREFIX_VDS, vdset->shared->vds_prefix, source_dset->file_name, intent, vdset->shared->layout.storage.u.virt.source_fapl);
+ src_file = H5F_prefix_open_file(vdset->oloc.file, H5F_PREFIX_VDS, vdset->shared->vds_prefix,
+ source_dset->file_name, intent,
+ vdset->shared->layout.storage.u.virt.source_fapl);
/* If we opened the source file here, we should close it when leaving */
- if(src_file)
+ if (src_file)
src_file_open = TRUE;
else
/* Reset the error stack */
@@ -938,20 +917,21 @@ H5D__virtual_open_source_dset(const H5D_t *vdset,
/* Source file is ".", use the virtual dataset's file */
src_file = vdset->oloc.file;
- if(src_file) {
- H5G_loc_t src_root_loc; /* Object location of source file root group */
+ if (src_file) {
+ H5G_loc_t src_root_loc; /* Object location of source file root group */
/* Set up the root group in the destination file */
- if(NULL == (src_root_loc.oloc = H5G_oloc(H5G_rootof(src_file))))
+ if (NULL == (src_root_loc.oloc = H5G_oloc(H5G_rootof(src_file))))
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to get object location for root group")
- if(NULL == (src_root_loc.path = H5G_nameof(H5G_rootof(src_file))))
+ if (NULL == (src_root_loc.path = H5G_nameof(H5G_rootof(src_file))))
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to get path for root group")
/* Try opening the source dataset */
- source_dset->dset = H5D__open_name(&src_root_loc, source_dset->dset_name, vdset->shared->layout.storage.u.virt.source_dapl);
+ source_dset->dset = H5D__open_name(&src_root_loc, source_dset->dset_name,
+ vdset->shared->layout.storage.u.virt.source_dapl);
/* Dataset does not exist */
- if(NULL == source_dset->dset) {
+ if (NULL == source_dset->dset) {
/* Reset the error stack */
H5E_clear_stack(NULL);
@@ -962,24 +942,23 @@ H5D__virtual_open_source_dset(const H5D_t *vdset,
source_dset->dset_exists = TRUE;
/* Patch the source selection if necessary */
- if(virtual_ent->source_space_status != H5O_VIRTUAL_STATUS_CORRECT) {
- if(H5S_extent_copy(virtual_ent->source_select, source_dset->dset->shared->space) < 0)
+ if (virtual_ent->source_space_status != H5O_VIRTUAL_STATUS_CORRECT) {
+ if (H5S_extent_copy(virtual_ent->source_select, source_dset->dset->shared->space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy source dataspace extent")
virtual_ent->source_space_status = H5O_VIRTUAL_STATUS_CORRECT;
} /* end if */
- } /* end else */
- } /* end if */
+ } /* end else */
+ } /* end if */
done:
/* Release resources */
- if(src_file_open)
- if(H5F_efc_close(vdset->oloc.file, src_file) < 0)
+ if (src_file_open)
+ if (H5F_efc_close(vdset->oloc.file, src_file) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEFILE, FAIL, "can't close source file")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_open_source_dset() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_reset_source_dset
*
@@ -993,10 +972,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__virtual_reset_source_dset(H5O_storage_virtual_ent_t *virtual_ent,
- H5O_storage_virtual_srcdset_t *source_dset)
+H5D__virtual_reset_source_dset(H5O_storage_virtual_ent_t * virtual_ent,
+ H5O_storage_virtual_srcdset_t *source_dset)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1004,55 +983,51 @@ H5D__virtual_reset_source_dset(H5O_storage_virtual_ent_t *virtual_ent,
HDassert(source_dset);
/* Free dataset */
- if(source_dset->dset) {
- if(H5D_close(source_dset->dset) < 0)
+ if (source_dset->dset) {
+ if (H5D_close(source_dset->dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close source dataset")
source_dset->dset = NULL;
} /* end if */
/* Free file name */
- if(virtual_ent->parsed_source_file_name
- && (source_dset->file_name
- != virtual_ent->parsed_source_file_name->name_segment))
+ if (virtual_ent->parsed_source_file_name &&
+ (source_dset->file_name != virtual_ent->parsed_source_file_name->name_segment))
source_dset->file_name = (char *)H5MM_xfree(source_dset->file_name);
else
- HDassert((source_dset->file_name == virtual_ent->source_file_name)
- || (virtual_ent->parsed_source_file_name
- && (source_dset->file_name
- == virtual_ent->parsed_source_file_name->name_segment))
- || !source_dset->file_name);
+ HDassert((source_dset->file_name == virtual_ent->source_file_name) ||
+ (virtual_ent->parsed_source_file_name &&
+ (source_dset->file_name == virtual_ent->parsed_source_file_name->name_segment)) ||
+ !source_dset->file_name);
/* Free dataset name */
- if(virtual_ent->parsed_source_dset_name
- && (source_dset->dset_name
- != virtual_ent->parsed_source_dset_name->name_segment))
+ if (virtual_ent->parsed_source_dset_name &&
+ (source_dset->dset_name != virtual_ent->parsed_source_dset_name->name_segment))
source_dset->dset_name = (char *)H5MM_xfree(source_dset->dset_name);
else
- HDassert((source_dset->dset_name == virtual_ent->source_dset_name)
- || (virtual_ent->parsed_source_dset_name
- && (source_dset->dset_name
- == virtual_ent->parsed_source_dset_name->name_segment))
- || !source_dset->dset_name);
+ HDassert((source_dset->dset_name == virtual_ent->source_dset_name) ||
+ (virtual_ent->parsed_source_dset_name &&
+ (source_dset->dset_name == virtual_ent->parsed_source_dset_name->name_segment)) ||
+ !source_dset->dset_name);
/* Free clipped virtual selection */
- if(source_dset->clipped_virtual_select) {
- if(source_dset->clipped_virtual_select != source_dset->virtual_select)
- if(H5S_close(source_dset->clipped_virtual_select) < 0)
+ if (source_dset->clipped_virtual_select) {
+ if (source_dset->clipped_virtual_select != source_dset->virtual_select)
+ if (H5S_close(source_dset->clipped_virtual_select) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release clipped virtual selection")
source_dset->clipped_virtual_select = NULL;
} /* end if */
/* Free virtual selection */
- if(source_dset->virtual_select) {
- if(H5S_close(source_dset->virtual_select) < 0)
+ if (source_dset->virtual_select) {
+ if (H5S_close(source_dset->virtual_select) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release virtual selection")
source_dset->virtual_select = NULL;
} /* end if */
/* Free clipped source selection */
- if(source_dset->clipped_source_select) {
- if(source_dset->clipped_source_select != virtual_ent->source_select)
- if(H5S_close(source_dset->clipped_source_select) < 0)
+ if (source_dset->clipped_source_select) {
+ if (source_dset->clipped_source_select != virtual_ent->source_select)
+ if (H5S_close(source_dset->clipped_source_select) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release clipped source selection")
source_dset->clipped_source_select = NULL;
} /* end if */
@@ -1066,7 +1041,6 @@ H5D__virtual_reset_source_dset(H5O_storage_virtual_ent_t *virtual_ent,
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_reset_source_dset() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_str_append
*
@@ -1081,10 +1055,9 @@ H5D__virtual_reset_source_dset(H5O_storage_virtual_ent_t *virtual_ent,
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__virtual_str_append(const char *src, size_t src_len, char **p, char **buf,
- size_t *buf_size)
+H5D__virtual_str_append(const char *src, size_t src_len, char **p, char **buf, size_t *buf_size)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1097,36 +1070,35 @@ H5D__virtual_str_append(const char *src, size_t src_len, char **p, char **buf,
HDassert(buf_size);
/* Allocate or extend buffer if necessary */
- if(!*buf) {
+ if (!*buf) {
HDassert(!*p);
HDassert(*buf_size == 0);
/* Allocate buffer */
- if(NULL == (*buf = (char *)H5MM_malloc(src_len + (size_t)1)))
+ if (NULL == (*buf = (char *)H5MM_malloc(src_len + (size_t)1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name segment struct")
*buf_size = src_len + (size_t)1;
- *p = *buf;
+ *p = *buf;
} /* end if */
else {
size_t p_offset = (size_t)(*p - *buf); /* Offset of p within buf */
/* Extend buffer if necessary */
- if((p_offset + src_len + (size_t)1) > *buf_size) {
- char *tmp_buf;
+ if ((p_offset + src_len + (size_t)1) > *buf_size) {
+ char * tmp_buf;
size_t tmp_buf_size;
/* Calculate new size of buffer */
- tmp_buf_size = MAX(p_offset + src_len + (size_t)1,
- *buf_size * (size_t)2);
+ tmp_buf_size = MAX(p_offset + src_len + (size_t)1, *buf_size * (size_t)2);
/* Reallocate buffer */
- if(NULL == (tmp_buf = (char *)H5MM_realloc(*buf, tmp_buf_size)))
+ if (NULL == (tmp_buf = (char *)H5MM_realloc(*buf, tmp_buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to reallocate name segment buffer")
- *buf = tmp_buf;
+ *buf = tmp_buf;
*buf_size = tmp_buf_size;
- *p = *buf + p_offset;
+ *p = *buf + p_offset;
} /* end if */
- } /* end else */
+ } /* end else */
/* Copy string to *p. Note that since src in not NULL terminated, we must
* use memcpy */
@@ -1142,7 +1114,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5D__virtual_str_append() */
-
/*-------------------------------------------------------------------------
* Function: H5D_virtual_parse_source_name
*
@@ -1156,20 +1127,19 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D_virtual_parse_source_name(const char *source_name,
- H5O_storage_virtual_name_seg_t **parsed_name, size_t *static_strlen,
- size_t *nsubs)
+H5D_virtual_parse_source_name(const char *source_name, H5O_storage_virtual_name_seg_t **parsed_name,
+ size_t *static_strlen, size_t *nsubs)
{
- H5O_storage_virtual_name_seg_t *tmp_parsed_name = NULL;
+ H5O_storage_virtual_name_seg_t * tmp_parsed_name = NULL;
H5O_storage_virtual_name_seg_t **tmp_parsed_name_p = &tmp_parsed_name;
- size_t tmp_static_strlen;
- size_t tmp_strlen;
- size_t tmp_nsubs = 0;
- const char *p;
- const char *pct;
- char *name_seg_p = NULL;
- size_t name_seg_size = 0;
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t tmp_static_strlen;
+ size_t tmp_strlen;
+ size_t tmp_nsubs = 0;
+ const char * p;
+ const char * pct;
+ char * name_seg_p = NULL;
+ size_t name_seg_size = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1180,38 +1150,40 @@ H5D_virtual_parse_source_name(const char *source_name,
HDassert(nsubs);
/* Initialize p and tmp_static_strlen */
- p = source_name;
+ p = source_name;
tmp_static_strlen = tmp_strlen = HDstrlen(source_name);
/* Iterate over name */
/* Note this will not work with UTF-8! We should support this eventually
* -NAF 5/18/2015 */
- while((pct = HDstrchr(p, '%'))) {
+ while ((pct = HDstrchr(p, '%'))) {
HDassert(pct >= p);
/* Allocate name segment struct if necessary */
- if(!*tmp_parsed_name_p)
- if(NULL == (*tmp_parsed_name_p = H5FL_CALLOC(H5O_storage_virtual_name_seg_t)))
+ if (!*tmp_parsed_name_p)
+ if (NULL == (*tmp_parsed_name_p = H5FL_CALLOC(H5O_storage_virtual_name_seg_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name segment struct")
/* Check for type of format specifier */
- if(pct[1] == 'b') {
+ if (pct[1] == 'b') {
/* Check for blank string before specifier */
- if(pct != p)
+ if (pct != p)
/* Append string to name segment */
- if(H5D__virtual_str_append(p, (size_t)(pct - p), &name_seg_p, &(*tmp_parsed_name_p)->name_segment, &name_seg_size) < 0)
+ if (H5D__virtual_str_append(p, (size_t)(pct - p), &name_seg_p,
+ &(*tmp_parsed_name_p)->name_segment, &name_seg_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to append name segment")
/* Update other variables */
tmp_parsed_name_p = &(*tmp_parsed_name_p)->next;
tmp_static_strlen -= 2;
tmp_nsubs++;
- name_seg_p = NULL;
+ name_seg_p = NULL;
name_seg_size = 0;
} /* end if */
- else if(pct[1] == '%') {
+ else if (pct[1] == '%') {
/* Append string to name segment (include first '%') */
- if(H5D__virtual_str_append(p, (size_t)(pct - p) + (size_t)1, &name_seg_p, &(*tmp_parsed_name_p)->name_segment, &name_seg_size) < 0)
+ if (H5D__virtual_str_append(p, (size_t)(pct - p) + (size_t)1, &name_seg_p,
+ &(*tmp_parsed_name_p)->name_segment, &name_seg_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to append name segment")
/* Update other variables */
@@ -1225,32 +1197,33 @@ H5D_virtual_parse_source_name(const char *source_name,
/* Copy last segment of name, if any, unless the parsed name was not
* allocated */
- if(tmp_parsed_name) {
+ if (tmp_parsed_name) {
HDassert(p >= source_name);
- if(*p == '\0')
+ if (*p == '\0')
HDassert((size_t)(p - source_name) == tmp_strlen);
else {
HDassert((size_t)(p - source_name) < tmp_strlen);
/* Allocate name segment struct if necessary */
- if(!*tmp_parsed_name_p)
- if(NULL == (*tmp_parsed_name_p = H5FL_CALLOC(H5O_storage_virtual_name_seg_t)))
+ if (!*tmp_parsed_name_p)
+ if (NULL == (*tmp_parsed_name_p = H5FL_CALLOC(H5O_storage_virtual_name_seg_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name segment struct")
/* Append string to name segment */
- if(H5D__virtual_str_append(p, tmp_strlen - (size_t)(p - source_name), &name_seg_p, &(*tmp_parsed_name_p)->name_segment, &name_seg_size) < 0)
+ if (H5D__virtual_str_append(p, tmp_strlen - (size_t)(p - source_name), &name_seg_p,
+ &(*tmp_parsed_name_p)->name_segment, &name_seg_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to append name segment")
} /* end else */
- } /* end if */
+ } /* end if */
/* Set return values */
- *parsed_name = tmp_parsed_name;
+ *parsed_name = tmp_parsed_name;
tmp_parsed_name = NULL;
- *static_strlen = tmp_static_strlen;
- *nsubs = tmp_nsubs;
+ *static_strlen = tmp_static_strlen;
+ *nsubs = tmp_nsubs;
done:
- if(tmp_parsed_name) {
+ if (tmp_parsed_name) {
HDassert(ret_value < 0);
H5D_virtual_free_parsed_name(tmp_parsed_name);
} /* end if */
@@ -1258,7 +1231,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_virtual_parse_source_name() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_copy_parsed_name
*
@@ -1272,13 +1244,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__virtual_copy_parsed_name(H5O_storage_virtual_name_seg_t **dst,
- H5O_storage_virtual_name_seg_t *src)
+H5D__virtual_copy_parsed_name(H5O_storage_virtual_name_seg_t **dst, H5O_storage_virtual_name_seg_t *src)
{
- H5O_storage_virtual_name_seg_t *tmp_dst = NULL;
- H5O_storage_virtual_name_seg_t *p_src = src;
- H5O_storage_virtual_name_seg_t **p_dst = &tmp_dst;
- herr_t ret_value = SUCCEED;
+ H5O_storage_virtual_name_seg_t * tmp_dst = NULL;
+ H5O_storage_virtual_name_seg_t * p_src = src;
+ H5O_storage_virtual_name_seg_t **p_dst = &tmp_dst;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -1286,14 +1257,14 @@ H5D__virtual_copy_parsed_name(H5O_storage_virtual_name_seg_t **dst,
HDassert(dst);
/* Walk over parsed name, duplicating it */
- while(p_src) {
+ while (p_src) {
/* Allocate name segment struct */
- if(NULL == (*p_dst = H5FL_CALLOC(H5O_storage_virtual_name_seg_t)))
+ if (NULL == (*p_dst = H5FL_CALLOC(H5O_storage_virtual_name_seg_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name segment struct")
/* Duplicate name segment */
- if(p_src->name_segment) {
- if(NULL == ((*p_dst)->name_segment = H5MM_strdup(p_src->name_segment)))
+ if (p_src->name_segment) {
+ if (NULL == ((*p_dst)->name_segment = H5MM_strdup(p_src->name_segment)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to duplicate name segment")
} /* end if */
@@ -1303,11 +1274,11 @@ H5D__virtual_copy_parsed_name(H5O_storage_virtual_name_seg_t **dst,
} /* end while */
/* Set dst */
- *dst = tmp_dst;
+ *dst = tmp_dst;
tmp_dst = NULL;
done:
- if(tmp_dst) {
+ if (tmp_dst) {
HDassert(ret_value < 0);
H5D_virtual_free_parsed_name(tmp_dst);
} /* end if */
@@ -1315,7 +1286,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_copy_parsed_name() */
-
/*-------------------------------------------------------------------------
* Function: H5D_virtual_free_parsed_name
*
@@ -1332,12 +1302,12 @@ herr_t
H5D_virtual_free_parsed_name(H5O_storage_virtual_name_seg_t *name_seg)
{
H5O_storage_virtual_name_seg_t *next_seg;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Walk name segments, freeing them */
- while(name_seg) {
+ while (name_seg) {
(void)H5MM_xfree(name_seg->name_segment);
next_seg = name_seg->next;
(void)H5FL_FREE(H5O_storage_virtual_name_seg_t, name_seg);
@@ -1348,7 +1318,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_virtual_free_parsed_name() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_build_source_name
*
@@ -1362,12 +1331,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__virtual_build_source_name(char *source_name,
- const H5O_storage_virtual_name_seg_t *parsed_name, size_t static_strlen,
- size_t nsubs, hsize_t blockno, char **built_name)
+H5D__virtual_build_source_name(char *source_name, const H5O_storage_virtual_name_seg_t *parsed_name,
+ size_t static_strlen, size_t nsubs, hsize_t blockno, char **built_name)
{
- char *tmp_name = NULL; /* Name buffer */
- herr_t ret_value = SUCCEED; /* Return value */
+ char * tmp_name = NULL; /* Name buffer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1376,44 +1344,44 @@ H5D__virtual_build_source_name(char *source_name,
HDassert(built_name);
/* Check for static name */
- if(nsubs == 0) {
- if(parsed_name)
+ if (nsubs == 0) {
+ if (parsed_name)
*built_name = parsed_name->name_segment;
else
*built_name = source_name;
} /* end if */
else {
const H5O_storage_virtual_name_seg_t *name_seg = parsed_name;
- char *p;
- hsize_t blockno_down = blockno;
- size_t blockno_len = 1;
- size_t name_len;
- size_t name_len_rem;
- size_t seg_len;
- size_t nsubs_rem = nsubs;
+ char * p;
+ hsize_t blockno_down = blockno;
+ size_t blockno_len = 1;
+ size_t name_len;
+ size_t name_len_rem;
+ size_t seg_len;
+ size_t nsubs_rem = nsubs;
HDassert(parsed_name);
/* Calculate length of printed block number */
do {
blockno_down /= (hsize_t)10;
- if(blockno_down == 0)
+ if (blockno_down == 0)
break;
blockno_len++;
- } while(1);
+ } while (1);
/* Calculate length of name buffer */
name_len_rem = name_len = static_strlen + (nsubs * blockno_len) + (size_t)1;
/* Allocate name buffer */
- if(NULL == (tmp_name = (char *)H5MM_malloc(name_len)))
+ if (NULL == (tmp_name = (char *)H5MM_malloc(name_len)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name buffer")
p = tmp_name;
/* Build name */
do {
/* Add name segment */
- if(name_seg->name_segment) {
+ if (name_seg->name_segment) {
seg_len = HDstrlen(name_seg->name_segment);
HDassert(seg_len > 0);
HDassert(seg_len < name_len_rem);
@@ -1423,9 +1391,9 @@ H5D__virtual_build_source_name(char *source_name,
} /* end if */
/* Add block number */
- if(nsubs_rem > 0) {
+ if (nsubs_rem > 0) {
HDassert(blockno_len < name_len_rem);
- if(HDsnprintf(p, name_len_rem, "%llu", (long long unsigned)blockno) < 0)
+ if (HDsnprintf(p, name_len_rem, "%llu", (long long unsigned)blockno) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write block number to string")
name_len_rem -= blockno_len;
p += blockno_len;
@@ -1434,15 +1402,15 @@ H5D__virtual_build_source_name(char *source_name,
/* Advance name_seg */
name_seg = name_seg->next;
- } while(name_seg);
+ } while (name_seg);
/* Assign built_name */
*built_name = tmp_name;
- tmp_name = NULL;
+ tmp_name = NULL;
} /* end else */
done:
- if(tmp_name) {
+ if (tmp_name) {
HDassert(ret_value < 0);
H5MM_free(tmp_name);
} /* end if */
@@ -1450,7 +1418,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_build_source_name() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_set_extent_unlim
*
@@ -1470,13 +1437,13 @@ herr_t
H5D__virtual_set_extent_unlim(const H5D_t *dset)
{
H5O_storage_virtual_t *storage;
- hsize_t new_dims[H5S_MAX_RANK];
- hsize_t curr_dims[H5S_MAX_RANK];
- hsize_t clip_size;
- int rank;
- hbool_t changed = FALSE; /* Whether the VDS extent changed */
- size_t i, j;
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t new_dims[H5S_MAX_RANK];
+ hsize_t curr_dims[H5S_MAX_RANK];
+ hsize_t clip_size;
+ int rank;
+ hbool_t changed = FALSE; /* Whether the VDS extent changed */
+ size_t i, j;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1487,48 +1454,52 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset)
HDassert((storage->view == H5D_VDS_FIRST_MISSING) || (storage->view == H5D_VDS_LAST_AVAILABLE));
/* Get rank of VDS */
- if((rank = H5S_GET_EXTENT_NDIMS(dset->shared->space)) < 0)
+ if ((rank = H5S_GET_EXTENT_NDIMS(dset->shared->space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get number of dimensions")
/* Initialize new_dims to HSIZE_UNDEF */
- for(i = 0; i < (size_t)rank; i++)
+ for (i = 0; i < (size_t)rank; i++)
new_dims[i] = HSIZE_UNDEF;
/* Iterate over mappings */
- for(i = 0; i < storage->list_nused; i++)
+ for (i = 0; i < storage->list_nused; i++)
/* Check for unlimited dimension */
- if(storage->list[i].unlim_dim_virtual >= 0) {
+ if (storage->list[i].unlim_dim_virtual >= 0) {
/* Check for "printf" source dataset resolution */
- if(storage->list[i].unlim_dim_source >= 0 ) {
+ if (storage->list[i].unlim_dim_source >= 0) {
/* Non-printf mapping */
/* Open source dataset */
- if(!storage->list[i].source_dset.dset)
- if(H5D__virtual_open_source_dset(dset, &storage->list[i], &storage->list[i].source_dset) < 0)
+ if (!storage->list[i].source_dset.dset)
+ if (H5D__virtual_open_source_dset(dset, &storage->list[i],
+ &storage->list[i].source_dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset")
/* Check if source dataset is open */
- if(storage->list[i].source_dset.dset) {
+ if (storage->list[i].source_dset.dset) {
/* Retrieve current source dataset extent and patch mapping
*/
- if(H5S_extent_copy(storage->list[i].source_select, storage->list[i].source_dset.dset->shared->space) < 0)
+ if (H5S_extent_copy(storage->list[i].source_select,
+ storage->list[i].source_dset.dset->shared->space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy source dataspace extent")
/* Get source space dimenstions */
- if(H5S_get_simple_extent_dims(storage->list[i].source_select, curr_dims, NULL) < 0)
+ if (H5S_get_simple_extent_dims(storage->list[i].source_select, curr_dims, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get source space dimensions")
/* Check if the source extent in the unlimited dimension
* changed since the last time the VDS extent/mapping
* was updated */
- if(curr_dims[storage->list[i].unlim_dim_source]
- == storage->list[i].unlim_extent_source)
+ if (curr_dims[storage->list[i].unlim_dim_source] == storage->list[i].unlim_extent_source)
/* Use cached result for clip size */
clip_size = storage->list[i].clip_size_virtual;
else {
/* Get size that virtual selection would be clipped to
* to match size of source selection within source
* extent */
- clip_size = H5S_hyper_get_clip_extent_match(storage->list[i].source_dset.virtual_select, storage->list[i].source_select, curr_dims[storage->list[i].unlim_dim_source], storage->view == H5D_VDS_FIRST_MISSING);
+ clip_size = H5S_hyper_get_clip_extent_match(
+ storage->list[i].source_dset.virtual_select, storage->list[i].source_select,
+ curr_dims[storage->list[i].unlim_dim_source],
+ storage->view == H5D_VDS_FIRST_MISSING);
/* If we are setting the extent by the last available
* data, clip virtual_select and source_select. Note
@@ -1537,144 +1508,183 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset)
* already be clipped to the correct size. Likewise,
* if we used the cached clip_size the source selection
* will already be correct. */
- if(storage->view == H5D_VDS_LAST_AVAILABLE) {
- if(clip_size != storage->list[i].clip_size_virtual) {
+ if (storage->view == H5D_VDS_LAST_AVAILABLE) {
+ if (clip_size != storage->list[i].clip_size_virtual) {
/* Close previous clipped virtual selection, if
* any */
- if(storage->list[i].source_dset.clipped_virtual_select) {
- HDassert(storage->list[i].source_dset.clipped_virtual_select
- != storage->list[i].source_dset.virtual_select);
- if(H5S_close(storage->list[i].source_dset.clipped_virtual_select) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release clipped virtual dataspace")
+ if (storage->list[i].source_dset.clipped_virtual_select) {
+ HDassert(storage->list[i].source_dset.clipped_virtual_select !=
+ storage->list[i].source_dset.virtual_select);
+ if (H5S_close(storage->list[i].source_dset.clipped_virtual_select) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL,
+ "unable to release clipped virtual dataspace")
} /* end if */
/* Copy virtual selection */
- if(NULL == (storage->list[i].source_dset.clipped_virtual_select = H5S_copy(storage->list[i].source_dset.virtual_select, FALSE, TRUE)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy virtual selection")
+ if (NULL == (storage->list[i].source_dset.clipped_virtual_select = H5S_copy(
+ storage->list[i].source_dset.virtual_select, FALSE, TRUE)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL,
+ "unable to copy virtual selection")
/* Clip virtual selection */
- if(H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_virtual_select, clip_size))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection")
+ if (H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_virtual_select,
+ clip_size))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL,
+ "failed to clip unlimited selection")
} /* end if */
/* Close previous clipped source selection, if any
*/
- if(storage->list[i].source_dset.clipped_source_select) {
- HDassert(storage->list[i].source_dset.clipped_source_select
- != storage->list[i].source_select);
- if(H5S_close(storage->list[i].source_dset.clipped_source_select) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release clipped source dataspace")
+ if (storage->list[i].source_dset.clipped_source_select) {
+ HDassert(storage->list[i].source_dset.clipped_source_select !=
+ storage->list[i].source_select);
+ if (H5S_close(storage->list[i].source_dset.clipped_source_select) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL,
+ "unable to release clipped source dataspace")
} /* end if */
/* Copy source selection */
- if(NULL == (storage->list[i].source_dset.clipped_source_select = H5S_copy(storage->list[i].source_select, FALSE, TRUE)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy source selection")
+ if (NULL == (storage->list[i].source_dset.clipped_source_select =
+ H5S_copy(storage->list[i].source_select, FALSE, TRUE)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL,
+ "unable to copy source selection")
/* Clip source selection */
- if(H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_source_select, curr_dims[storage->list[i].unlim_dim_source]))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection")
+ if (H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_source_select,
+ curr_dims[storage->list[i].unlim_dim_source]))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL,
+ "failed to clip unlimited selection")
} /* end if */
/* Update cached values unlim_extent_source and
* clip_size_virtual */
storage->list[i].unlim_extent_source = curr_dims[storage->list[i].unlim_dim_source];
- storage->list[i].clip_size_virtual = clip_size;
+ storage->list[i].clip_size_virtual = clip_size;
} /* end else */
- } /* end if */
+ } /* end if */
else
clip_size = 0;
} /* end if */
else {
/* printf mapping */
- hsize_t first_missing = 0; /* First missing dataset in the current block of missing datasets */
+ hsize_t first_missing =
+ 0; /* First missing dataset in the current block of missing datasets */
/* Search for source datasets */
HDassert(storage->printf_gap != HSIZE_UNDEF);
- for(j = 0; j <= (storage->printf_gap + first_missing); j++) {
+ for (j = 0; j <= (storage->printf_gap + first_missing); j++) {
/* Check for running out of space in sub_dset array */
- if(j >= (hsize_t)storage->list[i].sub_dset_nalloc) {
- if(storage->list[i].sub_dset_nalloc == 0) {
+ if (j >= (hsize_t)storage->list[i].sub_dset_nalloc) {
+ if (storage->list[i].sub_dset_nalloc == 0) {
/* Allocate sub_dset */
- if(NULL == (storage->list[i].sub_dset = (H5O_storage_virtual_srcdset_t *)H5MM_calloc(H5D_VIRTUAL_DEF_SUB_DSET_SIZE * sizeof(H5O_storage_virtual_srcdset_t))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate sub dataset array")
+ if (NULL ==
+ (storage->list[i].sub_dset = (H5O_storage_virtual_srcdset_t *)H5MM_calloc(
+ H5D_VIRTUAL_DEF_SUB_DSET_SIZE * sizeof(H5O_storage_virtual_srcdset_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
+ "unable to allocate sub dataset array")
storage->list[i].sub_dset_nalloc = H5D_VIRTUAL_DEF_SUB_DSET_SIZE;
} /* end if */
else {
H5O_storage_virtual_srcdset_t *tmp_sub_dset;
/* Extend sub_dset */
- if(NULL == (tmp_sub_dset = (H5O_storage_virtual_srcdset_t *)H5MM_realloc(storage->list[i].sub_dset, 2 * storage->list[i].sub_dset_nalloc * sizeof(H5O_storage_virtual_srcdset_t))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to extend sub dataset array")
+ if (NULL ==
+ (tmp_sub_dset = (H5O_storage_virtual_srcdset_t *)H5MM_realloc(
+ storage->list[i].sub_dset, 2 * storage->list[i].sub_dset_nalloc *
+ sizeof(H5O_storage_virtual_srcdset_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
+ "unable to extend sub dataset array")
storage->list[i].sub_dset = tmp_sub_dset;
/* Clear new space in sub_dset */
- (void)HDmemset(&storage->list[i].sub_dset[storage->list[i].sub_dset_nalloc], 0, storage->list[i].sub_dset_nalloc * sizeof(H5O_storage_virtual_srcdset_t));
+ (void)HDmemset(&storage->list[i].sub_dset[storage->list[i].sub_dset_nalloc], 0,
+ storage->list[i].sub_dset_nalloc *
+ sizeof(H5O_storage_virtual_srcdset_t));
/* Update sub_dset_nalloc */
storage->list[i].sub_dset_nalloc *= 2;
} /* end else */
- } /* end if */
+ } /* end if */
/* Check if the dataset was already opened */
- if(storage->list[i].sub_dset[j].dset_exists)
+ if (storage->list[i].sub_dset[j].dset_exists)
first_missing = j + 1;
else {
/* Resolve file name */
- if(!storage->list[i].sub_dset[j].file_name)
- if(H5D__virtual_build_source_name(storage->list[i].source_file_name, storage->list[i].parsed_source_file_name, storage->list[i].psfn_static_strlen, storage->list[i].psfn_nsubs, j, &storage->list[i].sub_dset[j].file_name) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to build source file name")
+ if (!storage->list[i].sub_dset[j].file_name)
+ if (H5D__virtual_build_source_name(storage->list[i].source_file_name,
+ storage->list[i].parsed_source_file_name,
+ storage->list[i].psfn_static_strlen,
+ storage->list[i].psfn_nsubs, j,
+ &storage->list[i].sub_dset[j].file_name) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "unable to build source file name")
/* Resolve dset name */
- if(!storage->list[i].sub_dset[j].dset_name)
- if(H5D__virtual_build_source_name(storage->list[i].source_dset_name, storage->list[i].parsed_source_dset_name, storage->list[i].psdn_static_strlen, storage->list[i].psdn_nsubs, j, &storage->list[i].sub_dset[j].dset_name) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to build source dataset name")
+ if (!storage->list[i].sub_dset[j].dset_name)
+ if (H5D__virtual_build_source_name(storage->list[i].source_dset_name,
+ storage->list[i].parsed_source_dset_name,
+ storage->list[i].psdn_static_strlen,
+ storage->list[i].psdn_nsubs, j,
+ &storage->list[i].sub_dset[j].dset_name) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "unable to build source dataset name")
/* Resolve virtual selection for block */
- if(!storage->list[i].sub_dset[j].virtual_select)
- if(NULL == (storage->list[i].sub_dset[j].virtual_select = H5S_hyper_get_unlim_block(storage->list[i].source_dset.virtual_select, j)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get block in unlimited selection")
+ if (!storage->list[i].sub_dset[j].virtual_select)
+ if (NULL ==
+ (storage->list[i].sub_dset[j].virtual_select = H5S_hyper_get_unlim_block(
+ storage->list[i].source_dset.virtual_select, j)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "unable to get block in unlimited selection")
/* Initialize clipped selections */
- if(!storage->list[i].sub_dset[j].clipped_source_select)
- storage->list[i].sub_dset[j].clipped_source_select = storage->list[i].source_select;
- if(!storage->list[i].sub_dset[j].clipped_virtual_select)
- storage->list[i].sub_dset[j].clipped_virtual_select = storage->list[i].sub_dset[j].virtual_select;
+ if (!storage->list[i].sub_dset[j].clipped_source_select)
+ storage->list[i].sub_dset[j].clipped_source_select =
+ storage->list[i].source_select;
+ if (!storage->list[i].sub_dset[j].clipped_virtual_select)
+ storage->list[i].sub_dset[j].clipped_virtual_select =
+ storage->list[i].sub_dset[j].virtual_select;
/* Open source dataset */
- if(H5D__virtual_open_source_dset(dset, &storage->list[i], &storage->list[i].sub_dset[j]) < 0)
+ if (H5D__virtual_open_source_dset(dset, &storage->list[i],
+ &storage->list[i].sub_dset[j]) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset")
- if(storage->list[i].sub_dset[j].dset) {
+ if (storage->list[i].sub_dset[j].dset) {
/* Update first_missing */
first_missing = j + 1;
/* Close source dataset so we don't have huge
* numbers of datasets open */
- if(H5D_close(storage->list[i].sub_dset[j].dset) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close source dataset")
+ if (H5D_close(storage->list[i].sub_dset[j].dset) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL,
+ "unable to close source dataset")
storage->list[i].sub_dset[j].dset = NULL;
} /* end if */
- } /* end else */
- } /* end for */
+ } /* end else */
+ } /* end for */
/* Check if the size changed */
- if((first_missing == (hsize_t)storage->list[i].sub_dset_nused)
- && (storage->list[i].clip_size_virtual != HSIZE_UNDEF))
+ if ((first_missing == (hsize_t)storage->list[i].sub_dset_nused) &&
+ (storage->list[i].clip_size_virtual != HSIZE_UNDEF))
/* Use cached clip_size */
clip_size = storage->list[i].clip_size_virtual;
else {
/* Check for no datasets */
- if(first_missing == 0)
+ if (first_missing == 0)
/* Set clip size to 0 */
clip_size = (hsize_t)0;
else {
- hsize_t bounds_start[H5S_MAX_RANK];
- hsize_t bounds_end[H5S_MAX_RANK];
+ hsize_t bounds_start[H5S_MAX_RANK];
+ hsize_t bounds_end[H5S_MAX_RANK];
/* Get clip size from selection */
- if(storage->view == H5D_VDS_LAST_AVAILABLE) {
+ if (storage->view == H5D_VDS_LAST_AVAILABLE) {
/* Get bounds from last valid virtual selection */
- if(H5S_SELECT_BOUNDS(storage->list[i].sub_dset[first_missing - (hsize_t)1].virtual_select, bounds_start, bounds_end) < 0)
+ if (H5S_SELECT_BOUNDS(
+ storage->list[i].sub_dset[first_missing - (hsize_t)1].virtual_select,
+ bounds_start, bounds_end) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds")
/* Set clip_size to bounds_end in unlimited
@@ -1684,113 +1694,121 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset)
else {
/* Get bounds from first missing virtual selection
*/
- if(H5S_SELECT_BOUNDS(storage->list[i].sub_dset[first_missing].virtual_select, bounds_start, bounds_end) < 0)
+ if (H5S_SELECT_BOUNDS(storage->list[i].sub_dset[first_missing].virtual_select,
+ bounds_start, bounds_end) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds")
/* Set clip_size to bounds_start in unlimited
* dimension */
clip_size = bounds_start[storage->list[i].unlim_dim_virtual];
} /* end else */
- } /* end else */
+ } /* end else */
/* Set sub_dset_nused and clip_size_virtual */
- storage->list[i].sub_dset_nused = (size_t)first_missing;
+ storage->list[i].sub_dset_nused = (size_t)first_missing;
storage->list[i].clip_size_virtual = clip_size;
} /* end else */
- } /* end else */
+ } /* end else */
/* Update new_dims */
- if((new_dims[storage->list[i].unlim_dim_virtual] == HSIZE_UNDEF)
- || (storage->view == H5D_VDS_FIRST_MISSING ? (clip_size < (hsize_t)new_dims[storage->list[i].unlim_dim_virtual])
- : (clip_size > (hsize_t)new_dims[storage->list[i].unlim_dim_virtual])))
+ if ((new_dims[storage->list[i].unlim_dim_virtual] == HSIZE_UNDEF) ||
+ (storage->view == H5D_VDS_FIRST_MISSING
+ ? (clip_size < (hsize_t)new_dims[storage->list[i].unlim_dim_virtual])
+ : (clip_size > (hsize_t)new_dims[storage->list[i].unlim_dim_virtual])))
new_dims[storage->list[i].unlim_dim_virtual] = clip_size;
} /* end if */
/* Get current VDS dimensions */
- if(H5S_get_simple_extent_dims(dset->shared->space, curr_dims, NULL) < 0)
+ if (H5S_get_simple_extent_dims(dset->shared->space, curr_dims, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS dimensions")
/* Calculate new extent */
- for(i = 0; i < (size_t)rank; i++) {
- if(new_dims[i] == HSIZE_UNDEF)
+ for (i = 0; i < (size_t)rank; i++) {
+ if (new_dims[i] == HSIZE_UNDEF)
new_dims[i] = curr_dims[i];
- else if(new_dims[i] < storage->min_dims[i])
+ else if (new_dims[i] < storage->min_dims[i])
new_dims[i] = storage->min_dims[i];
- if(new_dims[i] != curr_dims[i])
+ if (new_dims[i] != curr_dims[i])
changed = TRUE;
} /* end for */
/* Update extent if it changed */
- if(changed) {
+ if (changed) {
/* Update VDS extent */
- if(H5S_set_extent(dset->shared->space, new_dims) < 0)
+ if (H5S_set_extent(dset->shared->space, new_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace")
/* Mark the space as dirty, for later writing to the file */
- if(H5F_INTENT(dset->oloc.file) & H5F_ACC_RDWR)
- if(H5D__mark(dset, H5D_MARK_SPACE) < 0)
+ if (H5F_INTENT(dset->oloc.file) & H5F_ACC_RDWR)
+ if (H5D__mark(dset, H5D_MARK_SPACE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty")
} /* end if */
/* If we did not change the VDS dimensions, there is nothing more to update
*/
- if(changed || (!storage->init && (storage->view == H5D_VDS_FIRST_MISSING))) {
+ if (changed || (!storage->init && (storage->view == H5D_VDS_FIRST_MISSING))) {
/* Iterate over mappings again to update source selections and virtual
* mapping extents */
- for(i = 0; i < storage->list_nused; i++) {
+ for (i = 0; i < storage->list_nused; i++) {
/* If there is an unlimited dimension, we are setting extent by the
* minimum of mappings, and the virtual extent in the unlimited
* dimension has changed since the last time the VDS extent/mapping
* was updated, we must adjust the selections */
- if((storage->list[i].unlim_dim_virtual >= 0)
- && (storage->view == H5D_VDS_FIRST_MISSING)
- && (new_dims[storage->list[i].unlim_dim_virtual]
- != storage->list[i].unlim_extent_virtual)) {
+ if ((storage->list[i].unlim_dim_virtual >= 0) && (storage->view == H5D_VDS_FIRST_MISSING) &&
+ (new_dims[storage->list[i].unlim_dim_virtual] != storage->list[i].unlim_extent_virtual)) {
/* Check for "printf" style mapping */
- if(storage->list[i].unlim_dim_source >= 0) {
+ if (storage->list[i].unlim_dim_source >= 0) {
/* Non-printf mapping */
/* Close previous clipped virtual selection, if any */
- if(storage->list[i].source_dset.clipped_virtual_select) {
- HDassert(storage->list[i].source_dset.clipped_virtual_select
- != storage->list[i].source_dset.virtual_select);
- if(H5S_close(storage->list[i].source_dset.clipped_virtual_select) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release clipped virtual dataspace")
+ if (storage->list[i].source_dset.clipped_virtual_select) {
+ HDassert(storage->list[i].source_dset.clipped_virtual_select !=
+ storage->list[i].source_dset.virtual_select);
+ if (H5S_close(storage->list[i].source_dset.clipped_virtual_select) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL,
+ "unable to release clipped virtual dataspace")
} /* end if */
/* Copy virtual selection */
- if(NULL == (storage->list[i].source_dset.clipped_virtual_select = H5S_copy(storage->list[i].source_dset.virtual_select, FALSE, TRUE)))
+ if (NULL == (storage->list[i].source_dset.clipped_virtual_select =
+ H5S_copy(storage->list[i].source_dset.virtual_select, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy virtual selection")
/* Clip space to virtual extent */
- if(H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_virtual_select, new_dims[storage->list[i].unlim_dim_source]))
+ if (H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_virtual_select,
+ new_dims[storage->list[i].unlim_dim_source]))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection")
/* Get size that source selection will be clipped to to
* match size of virtual selection */
- clip_size = H5S_hyper_get_clip_extent(storage->list[i].source_select, storage->list[i].source_dset.clipped_virtual_select, FALSE);
+ clip_size =
+ H5S_hyper_get_clip_extent(storage->list[i].source_select,
+ storage->list[i].source_dset.clipped_virtual_select, FALSE);
/* Check if the clip size changed */
- if(clip_size != storage->list[i].clip_size_source) {
+ if (clip_size != storage->list[i].clip_size_source) {
/* Close previous clipped source selection, if any */
- if(storage->list[i].source_dset.clipped_source_select) {
- HDassert(storage->list[i].source_dset.clipped_source_select
- != storage->list[i].source_select);
- if(H5S_close(storage->list[i].source_dset.clipped_source_select) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release clipped source dataspace")
+ if (storage->list[i].source_dset.clipped_source_select) {
+ HDassert(storage->list[i].source_dset.clipped_source_select !=
+ storage->list[i].source_select);
+ if (H5S_close(storage->list[i].source_dset.clipped_source_select) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL,
+ "unable to release clipped source dataspace")
} /* end if */
/* Copy source selection */
- if(NULL == (storage->list[i].source_dset.clipped_source_select = H5S_copy(storage->list[i].source_select, FALSE, TRUE)))
+ if (NULL == (storage->list[i].source_dset.clipped_source_select =
+ H5S_copy(storage->list[i].source_select, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy source selection")
/* Clip source selection */
- if(H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_source_select, clip_size))
+ if (H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_source_select,
+ clip_size))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection")
/* Update cached value clip_size_source */
storage->list[i].clip_size_source = clip_size;
} /* end if */
- } /* end if */
+ } /* end if */
else {
/* printf mapping */
hsize_t first_inc_block;
@@ -1798,32 +1816,38 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset)
/* Get index of first incomplete block in virtual
* selection */
- first_inc_block = H5S_hyper_get_first_inc_block(storage->list[i].source_dset.virtual_select, new_dims[storage->list[i].unlim_dim_virtual], &partial_block);
+ first_inc_block = H5S_hyper_get_first_inc_block(
+ storage->list[i].source_dset.virtual_select,
+ new_dims[storage->list[i].unlim_dim_virtual], &partial_block);
/* Iterate over sub datasets */
- for(j = 0; j < storage->list[i].sub_dset_nalloc; j++) {
+ for (j = 0; j < storage->list[i].sub_dset_nalloc; j++) {
/* Close previous clipped source selection, if any */
- if(storage->list[i].sub_dset[j].clipped_source_select
- != storage->list[i].source_select) {
- if(storage->list[i].sub_dset[j].clipped_source_select)
- if(H5S_close(storage->list[i].sub_dset[j].clipped_source_select) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release clipped source dataspace")
+ if (storage->list[i].sub_dset[j].clipped_source_select !=
+ storage->list[i].source_select) {
+ if (storage->list[i].sub_dset[j].clipped_source_select)
+ if (H5S_close(storage->list[i].sub_dset[j].clipped_source_select) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL,
+ "unable to release clipped source dataspace")
/* Initialize clipped source selection to point to
* base source selection */
- storage->list[i].sub_dset[j].clipped_source_select = storage->list[i].source_select;
+ storage->list[i].sub_dset[j].clipped_source_select =
+ storage->list[i].source_select;
} /* end if */
/* Close previous clipped virtual selection, if any */
- if(storage->list[i].sub_dset[j].clipped_virtual_select
- != storage->list[i].sub_dset[j].virtual_select) {
- if(storage->list[i].sub_dset[j].clipped_virtual_select)
- if(H5S_close(storage->list[i].sub_dset[j].clipped_virtual_select) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release clipped virtual dataspace")
+ if (storage->list[i].sub_dset[j].clipped_virtual_select !=
+ storage->list[i].sub_dset[j].virtual_select) {
+ if (storage->list[i].sub_dset[j].clipped_virtual_select)
+ if (H5S_close(storage->list[i].sub_dset[j].clipped_virtual_select) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL,
+ "unable to release clipped virtual dataspace")
/* Initialize clipped virtual selection to point to
* unclipped virtual selection */
- storage->list[i].sub_dset[j].clipped_virtual_select = storage->list[i].sub_dset[j].virtual_select;
+ storage->list[i].sub_dset[j].clipped_virtual_select =
+ storage->list[i].sub_dset[j].virtual_select;
} /* end if */
/* Only initialize clipped selections if it is a
@@ -1832,13 +1856,13 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset)
* source extent here. For unused blocks we will never
* need clipped selections (until the extent is
* recalculated in this function). */
- if(j >= (size_t)first_inc_block) {
+ if (j >= (size_t)first_inc_block) {
/* Clear clipped source and virtual selections */
- storage->list[i].sub_dset[j].clipped_source_select = NULL;
+ storage->list[i].sub_dset[j].clipped_source_select = NULL;
storage->list[i].sub_dset[j].clipped_virtual_select = NULL;
} /* end if */
- } /* end for */
- } /* end else */
+ } /* end for */
+ } /* end else */
/* Update cached value unlim_extent_virtual */
storage->list[i].unlim_extent_virtual = new_dims[storage->list[i].unlim_dim_virtual];
@@ -1846,30 +1870,30 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset)
/* Update top level virtual_select and clipped_virtual_select
* extents */
- if(H5S_set_extent(storage->list[i].source_dset.virtual_select, new_dims) < 0)
+ if (H5S_set_extent(storage->list[i].source_dset.virtual_select, new_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace")
- if((storage->list[i].source_dset.clipped_virtual_select
- != storage->list[i].source_dset.virtual_select)
- && storage->list[i].source_dset.clipped_virtual_select)
- if(H5S_set_extent(storage->list[i].source_dset.clipped_virtual_select, new_dims) < 0)
+ if ((storage->list[i].source_dset.clipped_virtual_select !=
+ storage->list[i].source_dset.virtual_select) &&
+ storage->list[i].source_dset.clipped_virtual_select)
+ if (H5S_set_extent(storage->list[i].source_dset.clipped_virtual_select, new_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace")
/* Update sub dataset virtual_select and clipped_virtual_select
* extents */
- for(j = 0; j < storage->list[i].sub_dset_nalloc; j++)
- if(storage->list[i].sub_dset[j].virtual_select) {
- if(H5S_set_extent(storage->list[i].sub_dset[j].virtual_select, new_dims) < 0)
+ for (j = 0; j < storage->list[i].sub_dset_nalloc; j++)
+ if (storage->list[i].sub_dset[j].virtual_select) {
+ if (H5S_set_extent(storage->list[i].sub_dset[j].virtual_select, new_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace")
- if((storage->list[i].sub_dset[j].clipped_virtual_select
- != storage->list[i].sub_dset[j].virtual_select)
- && storage->list[i].sub_dset[j].clipped_virtual_select)
- if(H5S_set_extent(storage->list[i].sub_dset[j].clipped_virtual_select, new_dims) < 0)
+ if ((storage->list[i].sub_dset[j].clipped_virtual_select !=
+ storage->list[i].sub_dset[j].virtual_select) &&
+ storage->list[i].sub_dset[j].clipped_virtual_select)
+ if (H5S_set_extent(storage->list[i].sub_dset[j].clipped_virtual_select, new_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace")
} /* end if */
else
HDassert(!storage->list[i].sub_dset[j].clipped_virtual_select);
} /* end for */
- } /* end if */
+ } /* end if */
/* Mark layout as fully initialized */
storage->init = TRUE;
@@ -1878,7 +1902,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_set_extent_unlim() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_init_all
*
@@ -1898,11 +1921,11 @@ static herr_t
H5D__virtual_init_all(const H5D_t *dset)
{
H5O_storage_virtual_t *storage;
- hsize_t virtual_dims[H5S_MAX_RANK];
- hsize_t source_dims[H5S_MAX_RANK];
- hsize_t clip_size;
- size_t i, j;
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t virtual_dims[H5S_MAX_RANK];
+ hsize_t source_dims[H5S_MAX_RANK];
+ hsize_t clip_size;
+ size_t i, j;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1913,147 +1936,178 @@ H5D__virtual_init_all(const H5D_t *dset)
HDassert((storage->view == H5D_VDS_FIRST_MISSING) || (storage->view == H5D_VDS_LAST_AVAILABLE));
/* Get current VDS dimensions */
- if(H5S_get_simple_extent_dims(dset->shared->space, virtual_dims, NULL) < 0)
+ if (H5S_get_simple_extent_dims(dset->shared->space, virtual_dims, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS dimensions")
/* Iterate over mappings */
- for(i = 0; i < storage->list_nused; i++)
+ for (i = 0; i < storage->list_nused; i++)
/* Check for unlimited dimension */
- if(storage->list[i].unlim_dim_virtual >= 0) {
+ if (storage->list[i].unlim_dim_virtual >= 0) {
/* Check for "printf" source dataset resolution */
- if(storage->list[i].unlim_dim_source >= 0 ) {
+ if (storage->list[i].unlim_dim_source >= 0) {
/* Non-printf mapping */
/* Open source dataset */
- if(!storage->list[i].source_dset.dset)
- if(H5D__virtual_open_source_dset(dset, &storage->list[i], &storage->list[i].source_dset) < 0)
+ if (!storage->list[i].source_dset.dset)
+ if (H5D__virtual_open_source_dset(dset, &storage->list[i],
+ &storage->list[i].source_dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset")
/* Check if source dataset is open */
- if(storage->list[i].source_dset.dset) {
+ if (storage->list[i].source_dset.dset) {
/* Retrieve current source dataset extent and patch mapping
*/
- if(H5S_extent_copy(storage->list[i].source_select, storage->list[i].source_dset.dset->shared->space) < 0)
+ if (H5S_extent_copy(storage->list[i].source_select,
+ storage->list[i].source_dset.dset->shared->space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy source dataspace extent")
/* Get source space dimenstions */
- if(H5S_get_simple_extent_dims(storage->list[i].source_select, source_dims, NULL) < 0)
+ if (H5S_get_simple_extent_dims(storage->list[i].source_select, source_dims, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get source space dimensions")
/* Get size that source selection would be clipped to to
* match size of virtual selection */
- clip_size = H5S_hyper_get_clip_extent_match(storage->list[i].source_select, storage->list[i].source_dset.virtual_select, virtual_dims[storage->list[i].unlim_dim_virtual], FALSE);
+ clip_size = H5S_hyper_get_clip_extent_match(
+ storage->list[i].source_select, storage->list[i].source_dset.virtual_select,
+ virtual_dims[storage->list[i].unlim_dim_virtual], FALSE);
/* Close previous clipped virtual selection, if any */
- if(storage->list[i].source_dset.clipped_virtual_select) {
- HDassert(storage->list[i].source_dset.clipped_virtual_select
- != storage->list[i].source_dset.virtual_select);
- if(H5S_close(storage->list[i].source_dset.clipped_virtual_select) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release clipped virtual dataspace")
+ if (storage->list[i].source_dset.clipped_virtual_select) {
+ HDassert(storage->list[i].source_dset.clipped_virtual_select !=
+ storage->list[i].source_dset.virtual_select);
+ if (H5S_close(storage->list[i].source_dset.clipped_virtual_select) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL,
+ "unable to release clipped virtual dataspace")
} /* end if */
/* Copy virtual selection */
- if(NULL == (storage->list[i].source_dset.clipped_virtual_select = H5S_copy(storage->list[i].source_dset.virtual_select, FALSE, TRUE)))
+ if (NULL == (storage->list[i].source_dset.clipped_virtual_select =
+ H5S_copy(storage->list[i].source_dset.virtual_select, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy virtual selection")
/* Close previous clipped source selection, if any */
- if(storage->list[i].source_dset.clipped_source_select) {
- HDassert(storage->list[i].source_dset.clipped_source_select
- != storage->list[i].source_select);
- if(H5S_close(storage->list[i].source_dset.clipped_source_select) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release clipped source dataspace")
+ if (storage->list[i].source_dset.clipped_source_select) {
+ HDassert(storage->list[i].source_dset.clipped_source_select !=
+ storage->list[i].source_select);
+ if (H5S_close(storage->list[i].source_dset.clipped_source_select) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL,
+ "unable to release clipped source dataspace")
} /* end if */
/* Copy source selection */
- if(NULL == (storage->list[i].source_dset.clipped_source_select = H5S_copy(storage->list[i].source_select, FALSE, TRUE)))
+ if (NULL == (storage->list[i].source_dset.clipped_source_select =
+ H5S_copy(storage->list[i].source_select, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy source selection")
/* Check if the clip size is within the current extent of
* the source dataset */
- if(clip_size <= source_dims[storage->list[i].unlim_dim_source]) {
+ if (clip_size <= source_dims[storage->list[i].unlim_dim_source]) {
/* Clip virtual selection to extent */
- if(H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_virtual_select, virtual_dims[storage->list[i].unlim_dim_virtual]))
+ if (H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_virtual_select,
+ virtual_dims[storage->list[i].unlim_dim_virtual]))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection")
/* Clip source selection to clip_size */
- if(H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_source_select, clip_size))
+ if (H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_source_select,
+ clip_size))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection")
} /* end if */
else {
/* Get size that virtual selection will be clipped to to
* match size of source selection within source extent
*/
- clip_size = H5S_hyper_get_clip_extent_match(storage->list[i].source_dset.virtual_select, storage->list[i].source_select, source_dims[storage->list[i].unlim_dim_source], FALSE);
+ clip_size = H5S_hyper_get_clip_extent_match(
+ storage->list[i].source_dset.virtual_select, storage->list[i].source_select,
+ source_dims[storage->list[i].unlim_dim_source], FALSE);
/* Clip virtual selection to clip_size */
- if(H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_virtual_select, clip_size))
+ if (H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_virtual_select,
+ clip_size))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection")
/* Clip source selection to extent */
- if(H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_source_select, source_dims[storage->list[i].unlim_dim_source]))
+ if (H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_source_select,
+ source_dims[storage->list[i].unlim_dim_source]))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection")
} /* end else */
- } /* end if */
+ } /* end if */
else {
HDassert(!storage->list[i].source_dset.clipped_virtual_select);
HDassert(!storage->list[i].source_dset.clipped_source_select);
} /* end else */
- } /* end if */
+ } /* end if */
else {
/* printf mapping */
- size_t sub_dset_max;
+ size_t sub_dset_max;
hbool_t partial_block;
/* Get number of sub-source datasets in current extent */
- sub_dset_max = (size_t)H5S_hyper_get_first_inc_block(storage->list[i].source_dset.virtual_select, virtual_dims[storage->list[i].unlim_dim_virtual], &partial_block);
- if(partial_block)
+ sub_dset_max = (size_t)H5S_hyper_get_first_inc_block(
+ storage->list[i].source_dset.virtual_select,
+ virtual_dims[storage->list[i].unlim_dim_virtual], &partial_block);
+ if (partial_block)
sub_dset_max++;
/* Allocate or grow the sub_dset array if necessary */
- if(!storage->list[i].sub_dset) {
+ if (!storage->list[i].sub_dset) {
/* Allocate sub_dset array */
- if(NULL == (storage->list[i].sub_dset = (H5O_storage_virtual_srcdset_t *)H5MM_calloc(sub_dset_max * sizeof(H5O_storage_virtual_srcdset_t))))
+ if (NULL == (storage->list[i].sub_dset = (H5O_storage_virtual_srcdset_t *)H5MM_calloc(
+ sub_dset_max * sizeof(H5O_storage_virtual_srcdset_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate sub dataset array")
/* Update sub_dset_nalloc */
storage->list[i].sub_dset_nalloc = sub_dset_max;
} /* end if */
- else if(sub_dset_max > storage->list[i].sub_dset_nalloc) {
+ else if (sub_dset_max > storage->list[i].sub_dset_nalloc) {
H5O_storage_virtual_srcdset_t *tmp_sub_dset;
/* Extend sub_dset array */
- if(NULL == (tmp_sub_dset = (H5O_storage_virtual_srcdset_t *)H5MM_realloc(storage->list[i].sub_dset, sub_dset_max * sizeof(H5O_storage_virtual_srcdset_t))))
+ if (NULL == (tmp_sub_dset = (H5O_storage_virtual_srcdset_t *)H5MM_realloc(
+ storage->list[i].sub_dset,
+ sub_dset_max * sizeof(H5O_storage_virtual_srcdset_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to extend sub dataset array")
storage->list[i].sub_dset = tmp_sub_dset;
/* Clear new space in sub_dset */
- (void)HDmemset(&storage->list[i].sub_dset[storage->list[i].sub_dset_nalloc], 0, (sub_dset_max - storage->list[i].sub_dset_nalloc) * sizeof(H5O_storage_virtual_srcdset_t));
+ (void)HDmemset(&storage->list[i].sub_dset[storage->list[i].sub_dset_nalloc], 0,
+ (sub_dset_max - storage->list[i].sub_dset_nalloc) *
+ sizeof(H5O_storage_virtual_srcdset_t));
/* Update sub_dset_nalloc */
storage->list[i].sub_dset_nalloc = sub_dset_max;
} /* end if */
/* Iterate over sub dsets */
- for(j = 0; j < sub_dset_max; j++) {
+ for (j = 0; j < sub_dset_max; j++) {
/* Resolve file name */
- if(!storage->list[i].sub_dset[j].file_name)
- if(H5D__virtual_build_source_name(storage->list[i].source_file_name, storage->list[i].parsed_source_file_name, storage->list[i].psfn_static_strlen, storage->list[i].psfn_nsubs, j, &storage->list[i].sub_dset[j].file_name) < 0)
+ if (!storage->list[i].sub_dset[j].file_name)
+ if (H5D__virtual_build_source_name(
+ storage->list[i].source_file_name, storage->list[i].parsed_source_file_name,
+ storage->list[i].psfn_static_strlen, storage->list[i].psfn_nsubs, j,
+ &storage->list[i].sub_dset[j].file_name) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to build source file name")
/* Resolve dset name */
- if(!storage->list[i].sub_dset[j].dset_name)
- if(H5D__virtual_build_source_name(storage->list[i].source_dset_name, storage->list[i].parsed_source_dset_name, storage->list[i].psdn_static_strlen, storage->list[i].psdn_nsubs, j, &storage->list[i].sub_dset[j].dset_name) < 0)
+ if (!storage->list[i].sub_dset[j].dset_name)
+ if (H5D__virtual_build_source_name(
+ storage->list[i].source_dset_name, storage->list[i].parsed_source_dset_name,
+ storage->list[i].psdn_static_strlen, storage->list[i].psdn_nsubs, j,
+ &storage->list[i].sub_dset[j].dset_name) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to build source dataset name")
/* Resolve virtual selection for block */
- if(!storage->list[i].sub_dset[j].virtual_select)
- if(NULL == (storage->list[i].sub_dset[j].virtual_select = H5S_hyper_get_unlim_block(storage->list[i].source_dset.virtual_select, j)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get block in unlimited selection")
+ if (!storage->list[i].sub_dset[j].virtual_select)
+ if (NULL == (storage->list[i].sub_dset[j].virtual_select = H5S_hyper_get_unlim_block(
+ storage->list[i].source_dset.virtual_select, j)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
+ "unable to get block in unlimited selection")
/* Close previous clipped source selection, if any */
- if(storage->list[i].sub_dset[j].clipped_source_select != storage->list[i].source_select) {
- if(storage->list[i].sub_dset[j].clipped_source_select)
- if(H5S_close(storage->list[i].sub_dset[j].clipped_source_select) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release clipped source dataspace")
+ if (storage->list[i].sub_dset[j].clipped_source_select !=
+ storage->list[i].source_select) {
+ if (storage->list[i].sub_dset[j].clipped_source_select)
+ if (H5S_close(storage->list[i].sub_dset[j].clipped_source_select) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL,
+ "unable to release clipped source dataspace")
/* Initialize clipped source selection to point to base
* source selection */
@@ -2061,23 +2115,26 @@ H5D__virtual_init_all(const H5D_t *dset)
} /* end if */
/* Close previous clipped virtual selection, if any */
- if(storage->list[i].sub_dset[j].clipped_virtual_select != storage->list[i].sub_dset[j].virtual_select) {
- if(storage->list[i].sub_dset[j].clipped_virtual_select)
- if(H5S_close(storage->list[i].sub_dset[j].clipped_virtual_select) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release clipped virtual dataspace")
+ if (storage->list[i].sub_dset[j].clipped_virtual_select !=
+ storage->list[i].sub_dset[j].virtual_select) {
+ if (storage->list[i].sub_dset[j].clipped_virtual_select)
+ if (H5S_close(storage->list[i].sub_dset[j].clipped_virtual_select) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL,
+ "unable to release clipped virtual dataspace")
/* Initialize clipped virtual selection to point to
* unclipped virtual selection */
- storage->list[i].sub_dset[j].clipped_virtual_select = storage->list[i].sub_dset[j].virtual_select;
+ storage->list[i].sub_dset[j].clipped_virtual_select =
+ storage->list[i].sub_dset[j].virtual_select;
} /* end if */
/* Clear clipped selections if this is a partial block,
* defer calculation of real clipped selections to
* H5D__virtual_pre_io() as we may not have a valid source
* extent here */
- if((j == (sub_dset_max - 1)) && partial_block) {
+ if ((j == (sub_dset_max - 1)) && partial_block) {
/* Clear clipped source and virtual selections */
- storage->list[i].sub_dset[j].clipped_source_select = NULL;
+ storage->list[i].sub_dset[j].clipped_source_select = NULL;
storage->list[i].sub_dset[j].clipped_virtual_select = NULL;
} /* end else */
/* Note we do not need to open the source file, this will
@@ -2087,7 +2144,7 @@ H5D__virtual_init_all(const H5D_t *dset)
/* Update sub_dset_nused */
storage->list[i].sub_dset_nused = sub_dset_max;
} /* end else */
- } /* end if */
+ } /* end if */
else {
/* Limited mapping, just make sure the clipped selections were
* already set. Again, no need to open the source file. */
@@ -2102,7 +2159,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_init_all() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_init
*
@@ -2119,11 +2175,11 @@ done:
herr_t
H5D__virtual_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id)
{
- H5O_storage_virtual_t *storage; /* Convenience pointer */
- H5P_genplist_t *dapl; /* Data access property list object pointer */
- hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset (unused) */
- size_t i; /* Local index variables */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_storage_virtual_t *storage; /* Convenience pointer */
+ H5P_genplist_t * dapl; /* Data access property list object pointer */
+ hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset (unused) */
+ size_t i; /* Local index variables */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2133,8 +2189,10 @@ H5D__virtual_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id)
HDassert(storage->list || (storage->list_nused == 0));
/* Check that the dimensions of the VDS are large enough */
- if(H5D_virtual_check_min_dims(dset) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "virtual dataset dimensions not large enough to contain all limited dimensions in all selections")
+ if (H5D_virtual_check_min_dims(dset) < 0)
+ HGOTO_ERROR(
+ H5E_ARGS, H5E_BADVALUE, FAIL,
+ "virtual dataset dimensions not large enough to contain all limited dimensions in all selections")
/* Patch the virtual selection dataspaces. Note we always patch the space
* status because this layout could be from an old version held in the
@@ -2144,11 +2202,11 @@ H5D__virtual_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id)
* remove offset from selections. We only have to update
* source_space_status and virtual_space_status because others will be based
* on these and should therefore already have been normalized. */
- for(i = 0; i < storage->list_nused; i++) {
+ for (i = 0; i < storage->list_nused; i++) {
HDassert(storage->list[i].sub_dset_nalloc == 0);
/* Patch extent */
- if(H5S_extent_copy(storage->list[i].source_dset.virtual_select, dset->shared->space) < 0)
+ if (H5S_extent_copy(storage->list[i].source_dset.virtual_select, dset->shared->space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy virtual dataspace extent")
storage->list[i].virtual_space_status = H5O_VIRTUAL_STATUS_CORRECT;
@@ -2156,36 +2214,36 @@ H5D__virtual_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id)
storage->list[i].source_space_status = H5O_VIRTUAL_STATUS_INVALID;
/* Normalize offsets, toss out old offset values */
- if(H5S_hyper_normalize_offset(storage->list[i].source_dset.virtual_select, old_offset) < 0)
+ if (H5S_hyper_normalize_offset(storage->list[i].source_dset.virtual_select, old_offset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset")
- if(H5S_hyper_normalize_offset(storage->list[i].source_select, old_offset) < 0)
+ if (H5S_hyper_normalize_offset(storage->list[i].source_select, old_offset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset")
} /* end for */
/* Get dataset access property list */
- if(NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id)))
+ if (NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for dapl ID")
/* Get view option */
- if(H5P_get(dapl, H5D_ACS_VDS_VIEW_NAME, &storage->view) < 0)
+ if (H5P_get(dapl, H5D_ACS_VDS_VIEW_NAME, &storage->view) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get virtual view option")
/* Get printf gap if view is H5D_VDS_LAST_AVAILABLE, otherwise set to 0 */
- if(storage->view == H5D_VDS_LAST_AVAILABLE) {
- if(H5P_get(dapl, H5D_ACS_VDS_PRINTF_GAP_NAME, &storage->printf_gap) < 0)
+ if (storage->view == H5D_VDS_LAST_AVAILABLE) {
+ if (H5P_get(dapl, H5D_ACS_VDS_PRINTF_GAP_NAME, &storage->printf_gap) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get virtual printf gap")
} /* end if */
else
storage->printf_gap = (hsize_t)0;
/* Retrieve VDS file FAPL to layout */
- if(storage->source_fapl <= 0)
- if((storage->source_fapl = H5F_get_access_plist(f, FALSE)) < 0)
+ if (storage->source_fapl <= 0)
+ if ((storage->source_fapl = H5F_get_access_plist(f, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fapl")
/* Copy DAPL to layout */
- if(storage->source_dapl <= 0)
- if((storage->source_dapl = H5P_copy_plist(dapl, FALSE)) < 0)
+ if (storage->source_dapl <= 0)
+ if ((storage->source_dapl = H5P_copy_plist(dapl, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dapl")
/* Mark layout as not fully initialized (must be done prior to I/O for
@@ -2196,7 +2254,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_init() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_is_space_alloc
*
@@ -2214,7 +2271,7 @@ done:
hbool_t
H5D__virtual_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage)
{
- hbool_t ret_value; /* Return value */
+ hbool_t ret_value; /* Return value */
FUNC_ENTER_PACKAGE_NOERR
@@ -2228,7 +2285,6 @@ H5D__virtual_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_is_space_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_is_data_cached
*
@@ -2244,9 +2300,9 @@ H5D__virtual_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage)
static hbool_t
H5D__virtual_is_data_cached(const H5D_shared_t *shared_dset)
{
- const H5O_storage_virtual_t *storage; /* Convenience pointer */
- size_t i, j; /* Local index variables */
- hbool_t ret_value = FALSE; /* Return value */
+ const H5O_storage_virtual_t *storage; /* Convenience pointer */
+ size_t i, j; /* Local index variables */
+ hbool_t ret_value = FALSE; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -2255,28 +2311,28 @@ H5D__virtual_is_data_cached(const H5D_shared_t *shared_dset)
storage = &shared_dset->layout.storage.u.virt;
/* Iterate over mappings */
- for(i = 0; i < storage->list_nused; i++)
+ for (i = 0; i < storage->list_nused; i++)
/* Check for "printf" source dataset resolution */
- if(storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
+ if (storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
/* Iterate over sub-source dsets */
- for(j = storage->list[i].sub_dset_io_start; j < storage->list[i].sub_dset_io_end; j++)
+ for (j = storage->list[i].sub_dset_io_start; j < storage->list[i].sub_dset_io_end; j++)
/* Check for cahced data in source dset */
- if(storage->list[i].sub_dset[j].dset
- && storage->list[i].sub_dset[j].dset->shared->layout.ops->is_data_cached
- && storage->list[i].sub_dset[j].dset->shared->layout.ops->is_data_cached(storage->list[i].sub_dset[j].dset->shared))
+ if (storage->list[i].sub_dset[j].dset &&
+ storage->list[i].sub_dset[j].dset->shared->layout.ops->is_data_cached &&
+ storage->list[i].sub_dset[j].dset->shared->layout.ops->is_data_cached(
+ storage->list[i].sub_dset[j].dset->shared))
HGOTO_DONE(TRUE);
} /* end if */
- else
- if(storage->list[i].source_dset.dset
- && storage->list[i].source_dset.dset->shared->layout.ops->is_data_cached
- && storage->list[i].source_dset.dset->shared->layout.ops->is_data_cached(storage->list[i].source_dset.dset->shared))
- HGOTO_DONE(TRUE);
+ else if (storage->list[i].source_dset.dset &&
+ storage->list[i].source_dset.dset->shared->layout.ops->is_data_cached &&
+ storage->list[i].source_dset.dset->shared->layout.ops->is_data_cached(
+ storage->list[i].source_dset.dset->shared))
+ HGOTO_DONE(TRUE);
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_is_data_cached() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_pre_io
*
@@ -2293,17 +2349,16 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__virtual_pre_io(H5D_io_info_t *io_info,
- H5O_storage_virtual_t *storage, const H5S_t *file_space,
- const H5S_t *mem_space, hsize_t *tot_nelmts)
+H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, const H5S_t *file_space,
+ const H5S_t *mem_space, hsize_t *tot_nelmts)
{
- hssize_t select_nelmts; /* Number of elements in selection */
- hsize_t bounds_start[H5S_MAX_RANK]; /* Selection bounds start */
- hsize_t bounds_end[H5S_MAX_RANK]; /* Selection bounds end */
- int rank;
- hbool_t bounds_init = FALSE; /* Whether bounds_start, bounds_end, and rank are valid */
- size_t i, j, k; /* Local index variables */
- herr_t ret_value = SUCCEED; /* Return value */
+ hssize_t select_nelmts; /* Number of elements in selection */
+ hsize_t bounds_start[H5S_MAX_RANK]; /* Selection bounds start */
+ hsize_t bounds_end[H5S_MAX_RANK]; /* Selection bounds end */
+ int rank;
+ hbool_t bounds_init = FALSE; /* Whether bounds_start, bounds_end, and rank are valid */
+ size_t i, j, k; /* Local index variables */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2314,37 +2369,37 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
HDassert(tot_nelmts);
/* Initialize layout if necessary */
- if(!storage->init)
- if(H5D__virtual_init_all(io_info->dset) < 0)
+ if (!storage->init)
+ if (H5D__virtual_init_all(io_info->dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize virtual layout")
/* Initialize tot_nelmts */
*tot_nelmts = 0;
/* Iterate over mappings */
- for(i = 0; i < storage->list_nused; i++) {
+ for (i = 0; i < storage->list_nused; i++) {
/* Sanity check that the virtual space has been patched by now */
HDassert(storage->list[i].virtual_space_status == H5O_VIRTUAL_STATUS_CORRECT);
/* Check for "printf" source dataset resolution */
- if(storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
+ if (storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
hbool_t partial_block;
HDassert(storage->list[i].unlim_dim_virtual >= 0);
/* Get selection bounds if necessary */
- if(!bounds_init) {
+ if (!bounds_init) {
/* Get rank of VDS */
- if((rank = H5S_GET_EXTENT_NDIMS(io_info->dset->shared->space)) < 0)
+ if ((rank = H5S_GET_EXTENT_NDIMS(io_info->dset->shared->space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get number of dimensions")
/* Get selection bounds */
- if(H5S_SELECT_BOUNDS(file_space, bounds_start, bounds_end) < 0)
+ if (H5S_SELECT_BOUNDS(file_space, bounds_start, bounds_end) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds")
/* Adjust bounds_end to represent the extent just enclosing them
* (add 1) */
- for(j = 0; j < (size_t)rank; j++)
+ for (j = 0; j < (size_t)rank; j++)
bounds_end[j]++;
/* Bounds are now initialized */
@@ -2352,28 +2407,33 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
} /* end if */
/* Get index of first block in virtual selection */
- storage->list[i].sub_dset_io_start = (size_t)H5S_hyper_get_first_inc_block(storage->list[i].source_dset.virtual_select, bounds_start[storage->list[i].unlim_dim_virtual], NULL);
+ storage->list[i].sub_dset_io_start =
+ (size_t)H5S_hyper_get_first_inc_block(storage->list[i].source_dset.virtual_select,
+ bounds_start[storage->list[i].unlim_dim_virtual], NULL);
/* Get index of first block outside of virtual selection */
- storage->list[i].sub_dset_io_end = (size_t)H5S_hyper_get_first_inc_block(storage->list[i].source_dset.virtual_select, bounds_end[storage->list[i].unlim_dim_virtual], &partial_block);
- if(partial_block)
+ storage->list[i].sub_dset_io_end = (size_t)H5S_hyper_get_first_inc_block(
+ storage->list[i].source_dset.virtual_select, bounds_end[storage->list[i].unlim_dim_virtual],
+ &partial_block);
+ if (partial_block)
storage->list[i].sub_dset_io_end++;
- if(storage->list[i].sub_dset_io_end > storage->list[i].sub_dset_nused)
+ if (storage->list[i].sub_dset_io_end > storage->list[i].sub_dset_nused)
storage->list[i].sub_dset_io_end = storage->list[i].sub_dset_nused;
/* Iterate over sub-source dsets */
- for(j = storage->list[i].sub_dset_io_start; j < storage->list[i].sub_dset_io_end; j++) {
+ for (j = storage->list[i].sub_dset_io_start; j < storage->list[i].sub_dset_io_end; j++) {
/* Check for clipped virtual selection */
- if(!storage->list[i].sub_dset[j].clipped_virtual_select) {
+ if (!storage->list[i].sub_dset[j].clipped_virtual_select) {
hsize_t start[H5S_MAX_RANK];
/* This should only be NULL if this is a partial block */
HDassert((j == (storage->list[i].sub_dset_io_end - 1)) && partial_block);
/* If the source space status is not correct, we must try to
* open the source dataset to patch it */
- if(storage->list[i].source_space_status != H5O_VIRTUAL_STATUS_CORRECT) {
+ if (storage->list[i].source_space_status != H5O_VIRTUAL_STATUS_CORRECT) {
HDassert(!storage->list[i].sub_dset[j].dset);
- if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].sub_dset[j]) < 0)
+ if (H5D__virtual_open_source_dset(io_info->dset, &storage->list[i],
+ &storage->list[i].sub_dset[j]) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset")
} /* end if */
@@ -2382,119 +2442,140 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
* cannot do this and we will leave them NULL. This doesn't
* hurt anything because we can't do I/O because the dataset
* must not have been found. */
- if(storage->list[i].source_space_status == H5O_VIRTUAL_STATUS_CORRECT) {
+ if (storage->list[i].source_space_status == H5O_VIRTUAL_STATUS_CORRECT) {
hsize_t tmp_dims[H5S_MAX_RANK];
hsize_t vbounds_end[H5S_MAX_RANK];
/* Get bounds of virtual selection */
- if(H5S_SELECT_BOUNDS(storage->list[i].sub_dset[j].virtual_select, tmp_dims, vbounds_end) < 0)
+ if (H5S_SELECT_BOUNDS(storage->list[i].sub_dset[j].virtual_select, tmp_dims,
+ vbounds_end) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds")
HDassert(bounds_init);
/* Convert bounds to extent (add 1) */
- for(k = 0; k < (size_t)rank; k++)
+ for (k = 0; k < (size_t)rank; k++)
vbounds_end[k]++;
/* Temporarily set extent of virtual selection to bounds */
- if(H5S_set_extent(storage->list[i].sub_dset[j].virtual_select, vbounds_end) < 0)
+ if (H5S_set_extent(storage->list[i].sub_dset[j].virtual_select, vbounds_end) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace")
/* Get current VDS dimensions */
- if(H5S_get_simple_extent_dims(io_info->dset->shared->space, tmp_dims, NULL) < 0)
+ if (H5S_get_simple_extent_dims(io_info->dset->shared->space, tmp_dims, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS dimensions")
/* Copy virtual selection */
- if(NULL == (storage->list[i].sub_dset[j].clipped_virtual_select = H5S_copy(storage->list[i].sub_dset[j].virtual_select, FALSE, TRUE)))
+ if (NULL == (storage->list[i].sub_dset[j].clipped_virtual_select =
+ H5S_copy(storage->list[i].sub_dset[j].virtual_select, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy virtual selection")
/* Clip virtual selection to real virtual extent */
(void)HDmemset(start, 0, sizeof(start));
- if(H5S_select_hyperslab(storage->list[i].sub_dset[j].clipped_virtual_select, H5S_SELECT_AND, start, NULL, tmp_dims, NULL) < 0)
+ if (H5S_select_hyperslab(storage->list[i].sub_dset[j].clipped_virtual_select,
+ H5S_SELECT_AND, start, NULL, tmp_dims, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "unable to clip hyperslab")
/* Project intersection of virtual space and clipped
* virtual space onto source space (create
* clipped_source_select) */
- if(H5S_select_project_intersection(storage->list[i].sub_dset[j].virtual_select, storage->list[i].source_select, storage->list[i].sub_dset[j].clipped_virtual_select, &storage->list[i].sub_dset[j].clipped_source_select, TRUE) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto memory space")
+ if (H5S_select_project_intersection(
+ storage->list[i].sub_dset[j].virtual_select, storage->list[i].source_select,
+ storage->list[i].sub_dset[j].clipped_virtual_select,
+ &storage->list[i].sub_dset[j].clipped_source_select, TRUE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL,
+ "can't project virtual intersection onto memory space")
/* Set extents of virtual_select and
* clipped_virtual_select to virtual extent */
- if(H5S_set_extent(storage->list[i].sub_dset[j].virtual_select, tmp_dims) < 0)
+ if (H5S_set_extent(storage->list[i].sub_dset[j].virtual_select, tmp_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace")
- if(H5S_set_extent(storage->list[i].sub_dset[j].clipped_virtual_select, tmp_dims) < 0)
+ if (H5S_set_extent(storage->list[i].sub_dset[j].clipped_virtual_select, tmp_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace")
} /* end if */
- } /* end if */
+ } /* end if */
/* Only continue if we managed to obtain a
* clipped_virtual_select */
- if(storage->list[i].sub_dset[j].clipped_virtual_select) {
+ if (storage->list[i].sub_dset[j].clipped_virtual_select) {
/* Project intersection of file space and mapping virtual space
* onto memory space */
- if(H5S_select_project_intersection(file_space, mem_space, storage->list[i].sub_dset[j].clipped_virtual_select, &storage->list[i].sub_dset[j].projected_mem_space, TRUE) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto memory space")
+ if (H5S_select_project_intersection(
+ file_space, mem_space, storage->list[i].sub_dset[j].clipped_virtual_select,
+ &storage->list[i].sub_dset[j].projected_mem_space, TRUE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL,
+ "can't project virtual intersection onto memory space")
/* Check number of elements selected */
- if((select_nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(storage->list[i].sub_dset[j].projected_mem_space)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection")
+ if ((select_nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(
+ storage->list[i].sub_dset[j].projected_mem_space)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL,
+ "unable to get number of elements in selection")
/* Check if anything is selected */
- if(select_nelmts > (hssize_t)0) {
+ if (select_nelmts > (hssize_t)0) {
/* Open source dataset */
- if(!storage->list[i].sub_dset[j].dset)
+ if (!storage->list[i].sub_dset[j].dset)
/* Try to open dataset */
- if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].sub_dset[j]) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset")
+ if (H5D__virtual_open_source_dset(io_info->dset, &storage->list[i],
+ &storage->list[i].sub_dset[j]) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL,
+ "unable to open source dataset")
/* If the source dataset is not open, mark the selected
* elements as zero so projected_mem_space is freed */
- if(!storage->list[i].sub_dset[j].dset)
+ if (!storage->list[i].sub_dset[j].dset)
select_nelmts = (hssize_t)0;
} /* end if */
/* If there are not elements selected in this mapping, free
* projected_mem_space, otherwise update tot_nelmts */
- if(select_nelmts == (hssize_t)0) {
- if(H5S_close(storage->list[i].sub_dset[j].projected_mem_space) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected memory space")
+ if (select_nelmts == (hssize_t)0) {
+ if (H5S_close(storage->list[i].sub_dset[j].projected_mem_space) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL,
+ "can't close projected memory space")
storage->list[i].sub_dset[j].projected_mem_space = NULL;
} /* end if */
else
*tot_nelmts += (hsize_t)select_nelmts;
} /* end if */
- } /* end for */
- } /* end if */
+ } /* end for */
+ } /* end if */
else {
- if(storage->list[i].source_dset.clipped_virtual_select) {
+ if (storage->list[i].source_dset.clipped_virtual_select) {
/* Project intersection of file space and mapping virtual space onto
* memory space */
- if(H5S_select_project_intersection(file_space, mem_space, storage->list[i].source_dset.clipped_virtual_select, &storage->list[i].source_dset.projected_mem_space, TRUE) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto memory space")
+ if (H5S_select_project_intersection(
+ file_space, mem_space, storage->list[i].source_dset.clipped_virtual_select,
+ &storage->list[i].source_dset.projected_mem_space, TRUE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL,
+ "can't project virtual intersection onto memory space")
/* Check number of elements selected, add to tot_nelmts */
- if((select_nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(storage->list[i].source_dset.projected_mem_space)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection")
+ if ((select_nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(
+ storage->list[i].source_dset.projected_mem_space)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL,
+ "unable to get number of elements in selection")
/* Check if anything is selected */
- if(select_nelmts > (hssize_t)0) {
+ if (select_nelmts > (hssize_t)0) {
/* Open source dataset */
- if(!storage->list[i].source_dset.dset)
+ if (!storage->list[i].source_dset.dset)
/* Try to open dataset */
- if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].source_dset) < 0)
+ if (H5D__virtual_open_source_dset(io_info->dset, &storage->list[i],
+ &storage->list[i].source_dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset")
/* If the source dataset is not open, mark the selected elements
* as zero so projected_mem_space is freed */
- if(!storage->list[i].source_dset.dset)
+ if (!storage->list[i].source_dset.dset)
select_nelmts = (hssize_t)0;
} /* end if */
/* If there are not elements selected in this mapping, free
* projected_mem_space, otherwise update tot_nelmts */
- if(select_nelmts == (hssize_t)0) {
- if(H5S_close(storage->list[i].source_dset.projected_mem_space) < 0)
+ if (select_nelmts == (hssize_t)0) {
+ if (H5S_close(storage->list[i].source_dset.projected_mem_space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected memory space")
storage->list[i].source_dset.projected_mem_space = NULL;
} /* end if */
@@ -2510,14 +2591,13 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
HDassert(storage->list[i].unlim_dim_virtual >= 0);
HDassert(!storage->list[i].source_dset.dset);
} /* end else */
- } /* end else */
- } /* end for */
+ } /* end else */
+ } /* end for */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_pre_io() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_post_io
*
@@ -2533,8 +2613,8 @@ done:
static herr_t
H5D__virtual_post_io(H5O_storage_virtual_t *storage)
{
- size_t i, j; /* Local index variables */
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t i, j; /* Local index variables */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2542,32 +2622,31 @@ H5D__virtual_post_io(H5O_storage_virtual_t *storage)
HDassert(storage);
/* Iterate over mappings */
- for(i = 0; i < storage->list_nused; i++)
+ for (i = 0; i < storage->list_nused; i++)
/* Check for "printf" source dataset resolution */
- if(storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
+ if (storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
/* Iterate over sub-source dsets */
- for(j = storage->list[i].sub_dset_io_start; j < storage->list[i].sub_dset_io_end; j++)
+ for (j = storage->list[i].sub_dset_io_start; j < storage->list[i].sub_dset_io_end; j++)
/* Close projected memory space */
- if(storage->list[i].sub_dset[j].projected_mem_space) {
- if(H5S_close(storage->list[i].sub_dset[j].projected_mem_space) < 0)
+ if (storage->list[i].sub_dset[j].projected_mem_space) {
+ if (H5S_close(storage->list[i].sub_dset[j].projected_mem_space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close temporary space")
storage->list[i].sub_dset[j].projected_mem_space = NULL;
} /* end if */
- } /* end if */
+ } /* end if */
else
/* Close projected memory space */
- if(storage->list[i].source_dset.projected_mem_space) {
- if(H5S_close(storage->list[i].source_dset.projected_mem_space) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close temporary space")
- storage->list[i].source_dset.projected_mem_space = NULL;
- } /* end if */
+ if (storage->list[i].source_dset.projected_mem_space) {
+ if (H5S_close(storage->list[i].source_dset.projected_mem_space) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close temporary space")
+ storage->list[i].source_dset.projected_mem_space = NULL;
+ } /* end if */
/* Note the lack of a done: label. This is because there are no HGOTO_ERROR
* calls. If one is added, a done: label must also be added */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_post_io() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_read_one
*
@@ -2581,11 +2660,11 @@ H5D__virtual_post_io(H5O_storage_virtual_t *storage)
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- const H5S_t *file_space, H5O_storage_virtual_srcdset_t *source_dset)
+H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, const H5S_t *file_space,
+ H5O_storage_virtual_srcdset_t *source_dset)
{
- H5S_t *projected_src_space = NULL; /* File space for selection in a single source dataset */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5S_t *projected_src_space = NULL; /* File space for selection in a single source dataset */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2594,37 +2673,40 @@ H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
/* Only perform I/O if there is a projected memory space, otherwise there
* were no elements in the projection or the source dataset could not be
* opened */
- if(source_dset->projected_mem_space) {
+ if (source_dset->projected_mem_space) {
HDassert(source_dset->dset);
HDassert(source_dset->clipped_source_select);
/* Project intersection of file space and mapping virtual space onto
* mapping source space */
- if(H5S_select_project_intersection(source_dset->clipped_virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space, TRUE) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto source space")
+ if (H5S_select_project_intersection(source_dset->clipped_virtual_select,
+ source_dset->clipped_source_select, file_space,
+ &projected_src_space, TRUE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL,
+ "can't project virtual intersection onto source space")
/* Perform read on source dataset */
- if(H5D__read(source_dset->dset, type_info->dst_type_id, source_dset->projected_mem_space, projected_src_space, io_info->u.rbuf) < 0)
+ if (H5D__read(source_dset->dset, type_info->dst_type_id, source_dset->projected_mem_space,
+ projected_src_space, io_info->u.rbuf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read source dataset")
/* Close projected_src_space */
- if(H5S_close(projected_src_space) < 0)
+ if (H5S_close(projected_src_space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected source space")
projected_src_space = NULL;
} /* end if */
done:
/* Release allocated resources on failure */
- if(projected_src_space) {
+ if (projected_src_space) {
HDassert(ret_value < 0);
- if(H5S_close(projected_src_space) < 0)
+ if (H5S_close(projected_src_space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected source space")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_read_one() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_read
*
@@ -2638,15 +2720,14 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t H5_ATTR_UNUSED *fm)
+H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
{
- H5O_storage_virtual_t *storage; /* Convenient pointer into layout struct */
- hsize_t tot_nelmts; /* Total number of elements mapped to mem_space */
- H5S_t *fill_space = NULL; /* Space to fill with fill value */
- size_t i, j; /* Local index variables */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_storage_virtual_t *storage; /* Convenient pointer into layout struct */
+ hsize_t tot_nelmts; /* Total number of elements mapped to mem_space */
+ H5S_t * fill_space = NULL; /* Space to fill with fill value */
+ size_t i, j; /* Local index variables */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2662,101 +2743,100 @@ H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
#ifdef H5_HAVE_PARALLEL
/* Parallel reads are not supported (yet) */
- if(H5F_HAS_FEATURE(io_info->dset->oloc.file, H5FD_FEAT_HAS_MPI))
+ if (H5F_HAS_FEATURE(io_info->dset->oloc.file, H5FD_FEAT_HAS_MPI))
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "parallel reads not supported on virtual datasets")
#endif /* H5_HAVE_PARALLEL */
/* Prepare for I/O operation */
- if(H5D__virtual_pre_io(io_info, storage, file_space, mem_space, &tot_nelmts) < 0)
+ if (H5D__virtual_pre_io(io_info, storage, file_space, mem_space, &tot_nelmts) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to prepare for I/O operation")
/* Iterate over mappings */
- for(i = 0; i < storage->list_nused; i++) {
+ for (i = 0; i < storage->list_nused; i++) {
/* Sanity check that the virtual space has been patched by now */
HDassert(storage->list[i].virtual_space_status == H5O_VIRTUAL_STATUS_CORRECT);
/* Check for "printf" source dataset resolution */
- if(storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
+ if (storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
/* Iterate over sub-source dsets */
- for(j = storage->list[i].sub_dset_io_start;
- j < storage->list[i].sub_dset_io_end; j++)
- if(H5D__virtual_read_one(io_info, type_info, file_space, &storage->list[i].sub_dset[j]) < 0)
+ for (j = storage->list[i].sub_dset_io_start; j < storage->list[i].sub_dset_io_end; j++)
+ if (H5D__virtual_read_one(io_info, type_info, file_space, &storage->list[i].sub_dset[j]) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read source dataset")
} /* end if */
else
/* Read from source dataset */
- if(H5D__virtual_read_one(io_info, type_info, file_space, &storage->list[i].source_dset) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read source dataset")
+ if (H5D__virtual_read_one(io_info, type_info, file_space, &storage->list[i].source_dset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read source dataset")
} /* end for */
/* Fill unmapped part of buffer with fill value */
- if(tot_nelmts < nelmts) {
- H5D_fill_value_t fill_status; /* Fill value status */
+ if (tot_nelmts < nelmts) {
+ H5D_fill_value_t fill_status; /* Fill value status */
/* Check the fill value status */
- if(H5P_is_fill_value_defined(&io_info->dset->shared->dcpl_cache.fill, &fill_status) < 0)
+ if (H5P_is_fill_value_defined(&io_info->dset->shared->dcpl_cache.fill, &fill_status) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if fill value defined")
/* Always write fill value to memory buffer unless it is undefined */
- if(fill_status != H5D_FILL_VALUE_UNDEFINED) {
+ if (fill_status != H5D_FILL_VALUE_UNDEFINED) {
/* Start with fill space equal to memory space */
- if(NULL == (fill_space = H5S_copy(mem_space, FALSE, TRUE)))
+ if (NULL == (fill_space = H5S_copy(mem_space, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy memory selection")
/* Iterate over mappings */
- for(i = 0; i < storage->list_nused; i++)
+ for (i = 0; i < storage->list_nused; i++)
/* Check for "printf" source dataset resolution */
- if(storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
+ if (storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
/* Iterate over sub-source dsets */
- for(j = storage->list[i].sub_dset_io_start;
- j < storage->list[i].sub_dset_io_end; j++)
- if(storage->list[i].sub_dset[j].projected_mem_space)
- if(H5S_select_subtract(fill_space, storage->list[i].sub_dset[j].projected_mem_space) < 0)
+ for (j = storage->list[i].sub_dset_io_start; j < storage->list[i].sub_dset_io_end; j++)
+ if (storage->list[i].sub_dset[j].projected_mem_space)
+ if (H5S_select_subtract(fill_space,
+ storage->list[i].sub_dset[j].projected_mem_space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to clip fill selection")
} /* end if */
- else
- if(storage->list[i].source_dset.projected_mem_space)
- /* Subtract projected memory space from fill space */
- if(H5S_select_subtract(fill_space, storage->list[i].source_dset.projected_mem_space) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to clip fill selection")
+ else if (storage->list[i].source_dset.projected_mem_space)
+ /* Subtract projected memory space from fill space */
+ if (H5S_select_subtract(fill_space, storage->list[i].source_dset.projected_mem_space) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to clip fill selection")
/* Write fill values to memory buffer */
- if(H5D__fill(io_info->dset->shared->dcpl_cache.fill.buf, io_info->dset->shared->type, io_info->u.rbuf, type_info->mem_type, fill_space) < 0)
+ if (H5D__fill(io_info->dset->shared->dcpl_cache.fill.buf, io_info->dset->shared->type,
+ io_info->u.rbuf, type_info->mem_type, fill_space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "filling buf failed")
#ifndef NDEBUG
/* Make sure the total number of elements written (including fill
* values) >= nelmts */
{
- hssize_t select_nelmts; /* Number of elements in selection */
+ hssize_t select_nelmts; /* Number of elements in selection */
/* Get number of elements in fill dataspace */
- if((select_nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(fill_space)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection")
+ if ((select_nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(fill_space)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL,
+ "unable to get number of elements in selection")
/* Verify number of elements is correct. Note that since we
* don't check for overlap we can't assert that these are equal
*/
HDassert((tot_nelmts + (hsize_t)select_nelmts) >= nelmts);
} /* end block */
-#endif /* NDEBUG */
- } /* end if */
- } /* end if */
+#endif /* NDEBUG */
+ } /* end if */
+ } /* end if */
done:
/* Cleanup I/O operation */
- if(H5D__virtual_post_io(storage) < 0)
+ if (H5D__virtual_post_io(storage) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't cleanup I/O operation")
/* Close fill space */
- if(fill_space)
- if(H5S_close(fill_space) < 0)
+ if (fill_space)
+ if (H5S_close(fill_space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close fill space")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_read() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_write_one
*
@@ -2770,11 +2850,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- const H5S_t *file_space, H5O_storage_virtual_srcdset_t *source_dset)
+H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, const H5S_t *file_space,
+ H5O_storage_virtual_srcdset_t *source_dset)
{
- H5S_t *projected_src_space = NULL; /* File space for selection in a single source dataset */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5S_t *projected_src_space = NULL; /* File space for selection in a single source dataset */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2782,7 +2862,7 @@ H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
/* Only perform I/O if there is a projected memory space, otherwise there
* were no elements in the projection */
- if(source_dset->projected_mem_space) {
+ if (source_dset->projected_mem_space) {
HDassert(source_dset->dset);
HDassert(source_dset->clipped_source_select);
@@ -2791,31 +2871,34 @@ H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
* extent in the unlimited dimension. -NAF */
/* Project intersection of file space and mapping virtual space onto
* mapping source space */
- if(H5S_select_project_intersection(source_dset->clipped_virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space, TRUE) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto source space")
+ if (H5S_select_project_intersection(source_dset->clipped_virtual_select,
+ source_dset->clipped_source_select, file_space,
+ &projected_src_space, TRUE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL,
+ "can't project virtual intersection onto source space")
/* Perform write on source dataset */
- if(H5D__write(source_dset->dset, type_info->dst_type_id, source_dset->projected_mem_space, projected_src_space, io_info->u.wbuf) < 0)
+ if (H5D__write(source_dset->dset, type_info->dst_type_id, source_dset->projected_mem_space,
+ projected_src_space, io_info->u.wbuf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write to source dataset")
/* Close projected_src_space */
- if(H5S_close(projected_src_space) < 0)
+ if (H5S_close(projected_src_space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected source space")
projected_src_space = NULL;
} /* end if */
done:
/* Release allocated resources on failure */
- if(projected_src_space) {
+ if (projected_src_space) {
HDassert(ret_value < 0);
- if(H5S_close(projected_src_space) < 0)
+ if (H5S_close(projected_src_space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected source space")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_write_one() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_write
*
@@ -2829,14 +2912,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__virtual_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t H5_ATTR_UNUSED *fm)
+H5D__virtual_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
+ const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
{
- H5O_storage_virtual_t *storage; /* Convenient pointer into layout struct */
- hsize_t tot_nelmts; /* Total number of elements mapped to mem_space */
- size_t i, j; /* Local index variables */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_storage_virtual_t *storage; /* Convenient pointer into layout struct */
+ hsize_t tot_nelmts; /* Total number of elements mapped to mem_space */
+ size_t i, j; /* Local index variables */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2852,47 +2934,46 @@ H5D__virtual_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
#ifdef H5_HAVE_PARALLEL
/* Parallel writes are not supported (yet) */
- if(H5F_HAS_FEATURE(io_info->dset->oloc.file, H5FD_FEAT_HAS_MPI))
+ if (H5F_HAS_FEATURE(io_info->dset->oloc.file, H5FD_FEAT_HAS_MPI))
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "parallel writes not supported on virtual datasets")
#endif /* H5_HAVE_PARALLEL */
/* Prepare for I/O operation */
- if(H5D__virtual_pre_io(io_info, storage, file_space, mem_space, &tot_nelmts) < 0)
+ if (H5D__virtual_pre_io(io_info, storage, file_space, mem_space, &tot_nelmts) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to prepare for I/O operation")
/* Fail if there are unmapped parts of the selection as they would not be
* written */
- if(tot_nelmts != nelmts)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "write requested to unmapped portion of virtual dataset")
+ if (tot_nelmts != nelmts)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL,
+ "write requested to unmapped portion of virtual dataset")
/* Iterate over mappings */
- for(i = 0; i < storage->list_nused; i++) {
+ for (i = 0; i < storage->list_nused; i++) {
/* Sanity check that virtual space has been patched by now */
HDassert(storage->list[i].virtual_space_status == H5O_VIRTUAL_STATUS_CORRECT);
/* Check for "printf" source dataset resolution */
- if(storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
+ if (storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
/* Iterate over sub-source dsets */
- for(j = storage->list[i].sub_dset_io_start;
- j < storage->list[i].sub_dset_io_end; j++)
- if(H5D__virtual_write_one(io_info, type_info, file_space, &storage->list[i].sub_dset[j]) < 0)
+ for (j = storage->list[i].sub_dset_io_start; j < storage->list[i].sub_dset_io_end; j++)
+ if (H5D__virtual_write_one(io_info, type_info, file_space, &storage->list[i].sub_dset[j]) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write to source dataset")
} /* end if */
else
/* Write to source dataset */
- if(H5D__virtual_write_one(io_info, type_info, file_space, &storage->list[i].source_dset) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write to source dataset")
+ if (H5D__virtual_write_one(io_info, type_info, file_space, &storage->list[i].source_dset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write to source dataset")
} /* end for */
done:
/* Cleanup I/O operation */
- if(H5D__virtual_post_io(storage) < 0)
+ if (H5D__virtual_post_io(storage) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't cleanup I/O operation")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_write() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_flush
*
@@ -2908,9 +2989,9 @@ done:
static herr_t
H5D__virtual_flush(H5D_t *dset)
{
- H5O_storage_virtual_t *storage; /* Convenient pointer into layout struct */
- size_t i, j; /* Local index variables */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_storage_virtual_t *storage; /* Convenient pointer into layout struct */
+ size_t i, j; /* Local index variables */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2920,27 +3001,25 @@ H5D__virtual_flush(H5D_t *dset)
storage = &dset->shared->layout.storage.u.virt;
/* Flush only open datasets */
- for(i = 0; i < storage->list_nused; i++)
+ for (i = 0; i < storage->list_nused; i++)
/* Check for "printf" source dataset resolution */
- if(storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
+ if (storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
/* Iterate over sub-source dsets */
- for(j = 0; j < storage->list[i].sub_dset_nused; j++)
- if(storage->list[i].sub_dset[j].dset)
+ for (j = 0; j < storage->list[i].sub_dset_nused; j++)
+ if (storage->list[i].sub_dset[j].dset)
/* Flush source dataset */
- if(H5D__flush_real(storage->list[i].sub_dset[j].dset) < 0)
+ if (H5D__flush_real(storage->list[i].sub_dset[j].dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush source dataset")
} /* end if */
- else
- if(storage->list[i].source_dset.dset)
- /* Flush source dataset */
- if(H5D__flush_real(storage->list[i].source_dset.dset) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to flush source dataset")
+ else if (storage->list[i].source_dset.dset)
+ /* Flush source dataset */
+ if (H5D__flush_real(storage->list[i].source_dset.dset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to flush source dataset")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_flush() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_hold_source_dset_files
*
@@ -2956,10 +3035,10 @@ done:
herr_t
H5D__virtual_hold_source_dset_files(const H5D_t *dset, H5D_virtual_held_file_t **head)
{
- H5O_storage_virtual_t *storage; /* Convenient pointer into layout struct */
- H5D_virtual_held_file_t *tmp; /* Temporary held file node */
- size_t i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_storage_virtual_t * storage; /* Convenient pointer into layout struct */
+ H5D_virtual_held_file_t *tmp; /* Temporary held file node */
+ size_t i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2971,52 +3050,50 @@ H5D__virtual_hold_source_dset_files(const H5D_t *dset, H5D_virtual_held_file_t *
storage = &dset->shared->layout.storage.u.virt;
/* Hold only files for open datasets */
- for(i = 0; i < storage->list_nused; i++)
+ for (i = 0; i < storage->list_nused; i++)
/* Check for "printf" source dataset resolution */
- if(storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
- size_t j; /* Local index variable */
+ if (storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
+ size_t j; /* Local index variable */
/* Iterate over sub-source dsets */
- for(j = 0; j < storage->list[i].sub_dset_nused; j++)
- if(storage->list[i].sub_dset[j].dset) {
+ for (j = 0; j < storage->list[i].sub_dset_nused; j++)
+ if (storage->list[i].sub_dset[j].dset) {
/* Hold open the file */
H5F_INCR_NOPEN_OBJS(storage->list[i].sub_dset[j].dset->oloc.file);
/* Allocate a node for this file */
- if(NULL == (tmp = H5FL_MALLOC(H5D_virtual_held_file_t)))
+ if (NULL == (tmp = H5FL_MALLOC(H5D_virtual_held_file_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate held file node")
/* Set up node & connect to list */
tmp->file = storage->list[i].sub_dset[j].dset->oloc.file;
tmp->next = *head;
- *head = tmp;
+ *head = tmp;
} /* end if */
+ } /* end if */
+ else if (storage->list[i].source_dset.dset) {
+ /* Hold open the file */
+ H5F_INCR_NOPEN_OBJS(storage->list[i].source_dset.dset->oloc.file);
+
+ /* Allocate a node for this file */
+ if (NULL == (tmp = H5FL_MALLOC(H5D_virtual_held_file_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate held file node")
+
+ /* Set up node & connect to list */
+ tmp->file = storage->list[i].source_dset.dset->oloc.file;
+ tmp->next = *head;
+ *head = tmp;
} /* end if */
- else
- if(storage->list[i].source_dset.dset) {
- /* Hold open the file */
- H5F_INCR_NOPEN_OBJS(storage->list[i].source_dset.dset->oloc.file);
-
- /* Allocate a node for this file */
- if(NULL == (tmp = H5FL_MALLOC(H5D_virtual_held_file_t)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate held file node")
-
- /* Set up node & connect to list */
- tmp->file = storage->list[i].source_dset.dset->oloc.file;
- tmp->next = *head;
- *head = tmp;
- } /* end if */
done:
- if(ret_value < 0)
+ if (ret_value < 0)
/* Release hold on files and delete list on error */
- if(*head && H5D__virtual_release_source_dset_files(*head) < 0)
+ if (*head && H5D__virtual_release_source_dset_files(*head) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release source datasets' files held open")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_hold_source_dset_files() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_refresh_source_dset
*
@@ -3032,9 +3109,9 @@ done:
static herr_t
H5D__virtual_refresh_source_dset(H5D_t **dset)
{
- hid_t temp_id = H5I_INVALID_HID; /* Temporary dataset identifier */
- H5VL_object_t *vol_obj = NULL; /* VOL object stored with the ID */
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t temp_id = H5I_INVALID_HID; /* Temporary dataset identifier */
+ H5VL_object_t *vol_obj = NULL; /* VOL object stored with the ID */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -3042,28 +3119,27 @@ H5D__virtual_refresh_source_dset(H5D_t **dset)
HDassert(dset && *dset);
/* Get a temporary identifier for this source dataset */
- if((temp_id = H5VL_wrap_register(H5I_DATASET, *dset, FALSE)) < 0)
+ if ((temp_id = H5VL_wrap_register(H5I_DATASET, *dset, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID")
/* Refresh source dataset */
- if(H5D__refresh(temp_id, *dset) < 0)
+ if (H5D__refresh(temp_id, *dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset")
/* Discard the identifier & replace the dataset */
- if(NULL == (vol_obj = (H5VL_object_t *)H5I_remove(temp_id)))
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_remove(temp_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID")
- if(NULL == (*dset = (H5D_t *)H5VL_object_unwrap(vol_obj)))
+ if (NULL == (*dset = (H5D_t *)H5VL_object_unwrap(vol_obj)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve library object from VOL object")
vol_obj->data = NULL;
done:
- if(vol_obj && H5VL_free_object(vol_obj) < 0)
+ if (vol_obj && H5VL_free_object(vol_obj) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_refresh_source_dset() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_refresh_source_dsets
*
@@ -3079,9 +3155,9 @@ done:
herr_t
H5D__virtual_refresh_source_dsets(H5D_t *dset)
{
- H5O_storage_virtual_t *storage; /* Convenient pointer into layout struct */
- size_t i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_storage_virtual_t *storage; /* Convenient pointer into layout struct */
+ size_t i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -3092,31 +3168,30 @@ H5D__virtual_refresh_source_dsets(H5D_t *dset)
storage = &dset->shared->layout.storage.u.virt;
/* Refresh only open datasets */
- for(i = 0; i < storage->list_nused; i++)
+ for (i = 0; i < storage->list_nused; i++)
/* Check for "printf" source dataset resolution */
- if(storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
- size_t j; /* Local index variable */
+ if (storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) {
+ size_t j; /* Local index variable */
/* Iterate over sub-source datasets */
- for(j = 0; j < storage->list[i].sub_dset_nused; j++)
+ for (j = 0; j < storage->list[i].sub_dset_nused; j++)
/* Check if sub-source dataset is open */
- if(storage->list[i].sub_dset[j].dset)
+ if (storage->list[i].sub_dset[j].dset)
/* Refresh sub-source dataset */
- if(H5D__virtual_refresh_source_dset(&storage->list[i].sub_dset[j].dset) < 0)
+ if (H5D__virtual_refresh_source_dset(&storage->list[i].sub_dset[j].dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset")
} /* end if */
else
/* Check if source dataset is open */
- if(storage->list[i].source_dset.dset)
- /* Refresh source dataset */
- if(H5D__virtual_refresh_source_dset(&storage->list[i].source_dset.dset) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset")
+ if (storage->list[i].source_dset.dset)
+ /* Refresh source dataset */
+ if (H5D__virtual_refresh_source_dset(&storage->list[i].source_dset.dset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_refresh_source_dsets() */
-
/*-------------------------------------------------------------------------
* Function: H5D__virtual_release_source_dset_files
*
@@ -3132,13 +3207,13 @@ done:
herr_t
H5D__virtual_release_source_dset_files(H5D_virtual_held_file_t *head)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Release hold on files and delete list */
- while(head) {
- H5D_virtual_held_file_t *tmp = head->next; /* Temporary pointer to next node */
+ while (head) {
+ H5D_virtual_held_file_t *tmp = head->next; /* Temporary pointer to next node */
/* Release hold on file */
H5F_DECR_NOPEN_OBJS(head->file);
@@ -3148,7 +3223,7 @@ H5D__virtual_release_source_dset_files(H5D_virtual_held_file_t *head)
* essentially "private" to the virtual dataset, since it wasn't
* opened through an API routine -QAK)
*/
- if(H5F_try_close(head->file, NULL) < 0)
+ if (H5F_try_close(head->file, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEFILE, FAIL, "problem attempting file close")
/* Delete node */
@@ -3161,4 +3236,3 @@ H5D__virtual_release_source_dset_files(H5D_virtual_held_file_t *head)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_release_source_dset_files() */
-
diff --git a/src/H5E.c b/src/H5E.c
index 15cf5f4..731d263 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -43,53 +43,48 @@
/* Module Setup */
/****************/
-#include "H5Emodule.h" /* This source code file is part of the H5E module */
-
+#include "H5Emodule.h" /* This source code file is part of the H5E module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Epkg.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#include "H5Epkg.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
/****************/
/* Local Macros */
/****************/
/* HDF5 error class */
-#define H5E_CLS_NAME "HDF5"
-#define H5E_CLS_LIB_NAME "HDF5"
-
+#define H5E_CLS_NAME "HDF5"
+#define H5E_CLS_LIB_NAME "HDF5"
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
/* Static function declarations */
-static herr_t H5E__set_default_auto(H5E_t *stk);
+static herr_t H5E__set_default_auto(H5E_t *stk);
static H5E_cls_t *H5E__register_class(const char *cls_name, const char *lib_name, const char *version);
-static herr_t H5E__unregister_class(H5E_cls_t *cls);
-static ssize_t H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size);
-static int H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata);
-static herr_t H5E__close_msg(H5E_msg_t *err);
+static herr_t H5E__unregister_class(H5E_cls_t *cls);
+static ssize_t H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size);
+static int H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata);
+static herr_t H5E__close_msg(H5E_msg_t *err);
static H5E_msg_t *H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg);
-static H5E_t *H5E__get_current_stack(void);
-static herr_t H5E__set_current_stack(H5E_t *estack);
-static herr_t H5E__close_stack(H5E_t *err_stack);
-static ssize_t H5E__get_num(const H5E_t *err_stack);
-
+static H5E_t * H5E__get_current_stack(void);
+static herr_t H5E__set_current_stack(H5E_t *estack);
+static herr_t H5E__close_stack(H5E_t *err_stack);
+static ssize_t H5E__get_num(const H5E_t *err_stack);
/*********************/
/* Package Variables */
@@ -98,12 +93,10 @@ static ssize_t H5E__get_num(const H5E_t *err_stack);
/* Package initialization variable */
hbool_t H5_PKG_INIT_VAR = FALSE;
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -119,30 +112,28 @@ H5FL_DEFINE_STATIC(H5E_msg_t);
/* Error class ID class */
static const H5I_class_t H5I_ERRCLS_CLS[1] = {{
- H5I_ERROR_CLASS, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
+ H5I_ERROR_CLASS, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
(H5I_free_t)H5E__unregister_class /* Callback routine for closing objects of this class */
}};
/* Error message ID class */
static const H5I_class_t H5I_ERRMSG_CLS[1] = {{
- H5I_ERROR_MSG, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
- (H5I_free_t)H5E__close_msg /* Callback routine for closing objects of this class */
+ H5I_ERROR_MSG, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5E__close_msg /* Callback routine for closing objects of this class */
}};
/* Error stack ID class */
static const H5I_class_t H5I_ERRSTK_CLS[1] = {{
- H5I_ERROR_STACK, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
+ H5I_ERROR_STACK, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
(H5I_free_t)H5E__close_stack /* Callback routine for closing objects of this class */
}};
-
-
/*-------------------------------------------------------------------------
* Function: H5E_init
*
@@ -158,7 +149,7 @@ static const H5I_class_t H5I_ERRSTK_CLS[1] = {{
herr_t
H5E_init(void)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* FUNC_ENTER() does all the work */
@@ -167,7 +158,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_init() */
-
/*--------------------------------------------------------------------------
* Function: H5E__init_package
*
@@ -183,23 +173,23 @@ done:
herr_t
H5E__init_package(void)
{
- H5E_cls_t *cls; /* Pointer to error class */
- H5E_msg_t *msg; /* Pointer to new error message */
- char lib_vers[128]; /* Buffer to constructu library version within */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5E_cls_t *cls; /* Pointer to error class */
+ H5E_msg_t *msg; /* Pointer to new error message */
+ char lib_vers[128]; /* Buffer to constructu library version within */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Initialize the atom group for the error class IDs */
- if(H5I_register_type(H5I_ERRCLS_CLS) < 0)
+ if (H5I_register_type(H5I_ERRCLS_CLS) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
/* Initialize the atom group for the major error IDs */
- if(H5I_register_type(H5I_ERRMSG_CLS) < 0)
+ if (H5I_register_type(H5I_ERRMSG_CLS) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
/* Initialize the atom group for the error stacks */
- if(H5I_register_type(H5I_ERRSTK_CLS) < 0)
+ if (H5I_register_type(H5I_ERRSTK_CLS) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
#ifndef H5_HAVE_THREADSAFE
@@ -209,20 +199,20 @@ H5E__init_package(void)
/* Allocate the HDF5 error class */
HDassert(H5E_ERR_CLS_g == (-1));
- HDsnprintf(lib_vers, sizeof(lib_vers), "%u.%u.%u%s", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, (HDstrlen(H5_VERS_SUBRELEASE) > 0 ? "-"H5_VERS_SUBRELEASE : ""));
- if(NULL == (cls = H5E__register_class(H5E_CLS_NAME, H5E_CLS_LIB_NAME, lib_vers)))
+ HDsnprintf(lib_vers, sizeof(lib_vers), "%u.%u.%u%s", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
+ (HDstrlen(H5_VERS_SUBRELEASE) > 0 ? "-" H5_VERS_SUBRELEASE : ""));
+ if (NULL == (cls = H5E__register_class(H5E_CLS_NAME, H5E_CLS_LIB_NAME, lib_vers)))
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "class initialization failed")
- if((H5E_ERR_CLS_g = H5I_register(H5I_ERROR_CLASS, cls, FALSE)) < 0)
+ if ((H5E_ERR_CLS_g = H5I_register(H5I_ERROR_CLASS, cls, FALSE)) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error class")
- /* Include the automatically generated error code initialization */
- #include "H5Einit.h"
+/* Include the automatically generated error code initialization */
+#include "H5Einit.h"
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E__init_package() */
-
/*-------------------------------------------------------------------------
* Function: H5E_term_package
*
@@ -241,11 +231,11 @@ done:
int
H5E_term_package(void)
{
- int n = 0;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(H5_PKG_INIT_VAR) {
+ if (H5_PKG_INIT_VAR) {
int64_t ncls, nmsg, nstk;
/* Check if there are any open error stacks, classes or messages */
@@ -253,33 +243,33 @@ H5E_term_package(void)
nmsg = H5I_nmembers(H5I_ERROR_MSG);
nstk = H5I_nmembers(H5I_ERROR_STACK);
- if((ncls + nmsg + nstk) > 0) {
+ if ((ncls + nmsg + nstk) > 0) {
/* Clear any outstanding error stacks */
- if(nstk > 0)
- (void)H5I_clear_type(H5I_ERROR_STACK, FALSE, FALSE);
+ if (nstk > 0)
+ (void)H5I_clear_type(H5I_ERROR_STACK, FALSE, FALSE);
/* Clear all the error classes */
- if(ncls > 0) {
+ if (ncls > 0) {
(void)H5I_clear_type(H5I_ERROR_CLASS, FALSE, FALSE);
/* Reset the HDF5 error class, if its been closed */
- if(H5I_nmembers(H5I_ERROR_CLASS) == 0)
+ if (H5I_nmembers(H5I_ERROR_CLASS) == 0)
H5E_ERR_CLS_g = -1;
} /* end if */
/* Clear all the error messages */
- if(nmsg > 0) {
+ if (nmsg > 0) {
(void)H5I_clear_type(H5I_ERROR_MSG, FALSE, FALSE);
/* Reset the HDF5 error messages, if they've been closed */
- if(H5I_nmembers(H5I_ERROR_MSG) == 0) {
- /* Include the automatically generated error code termination */
- #include "H5Eterm.h"
+ if (H5I_nmembers(H5I_ERROR_MSG) == 0) {
+/* Include the automatically generated error code termination */
+#include "H5Eterm.h"
} /* end if */
- } /* end if */
+ } /* end if */
n++; /*H5I*/
- } /* end if */
+ } /* end if */
else {
/* Destroy the error class, message, and stack id groups */
n += (H5I_dec_type_ref(H5I_ERROR_STACK) > 0);
@@ -287,15 +277,14 @@ H5E_term_package(void)
n += (H5I_dec_type_ref(H5I_ERROR_MSG) > 0);
/* Mark closed */
- if(0 == n)
+ if (0 == n)
H5_PKG_INIT_VAR = FALSE;
} /* end else */
- } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI(n)
} /* end H5E_term_package() */
-
/*--------------------------------------------------------------------------
* Function: H5E__set_default_auto
*
@@ -317,14 +306,14 @@ H5E__set_default_auto(H5E_t *stk)
#ifndef H5_NO_DEPRECATED_SYMBOLS
#ifdef H5_USE_16_API_DEFAULT
stk->auto_op.vers = 1;
-#else /* H5_USE_16_API */
+#else /* H5_USE_16_API */
stk->auto_op.vers = 2;
#endif /* H5_USE_16_API_DEFAULT */
stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1;
stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5Eprint2;
- stk->auto_op.is_default = TRUE;
-#else /* H5_NO_DEPRECATED_SYMBOLS */
+ stk->auto_op.is_default = TRUE;
+#else /* H5_NO_DEPRECATED_SYMBOLS */
stk->auto_op.func2 = (H5E_auto2_t)H5Eprint2;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -333,7 +322,6 @@ H5E__set_default_auto(H5E_t *stk)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5E__set_default_auto() */
-
#ifdef H5_HAVE_THREADSAFE
/*-------------------------------------------------------------------------
* Function: H5E__get_stack
@@ -359,7 +347,7 @@ H5E__get_stack(void)
estack = (H5E_t *)H5TS_get_thread_local_value(H5TS_errstk_key_g);
- if(!estack) {
+ if (!estack) {
/* No associated value with current thread - create one */
#ifdef H5_HAVE_WIN_THREADS
/* Win32 has to use LocalAlloc to match the LocalFree in DllMain */
@@ -386,9 +374,8 @@ H5E__get_stack(void)
/* Set return value */
FUNC_LEAVE_NOAPI(estack)
} /* end H5E__get_stack() */
-#endif /* H5_HAVE_THREADSAFE */
+#endif /* H5_HAVE_THREADSAFE */
-
/*-------------------------------------------------------------------------
* Function: H5E__free_class
*
@@ -410,15 +397,14 @@ H5E__free_class(H5E_cls_t *cls)
HDassert(cls);
/* Free error class structure */
- cls->cls_name = (char *)H5MM_xfree((void*)cls->cls_name);
- cls->lib_name = (char *)H5MM_xfree((void*)cls->lib_name);
- cls->lib_vers = (char *)H5MM_xfree((void*)cls->lib_vers);
- cls = H5FL_FREE(H5E_cls_t, cls);
+ cls->cls_name = (char *)H5MM_xfree((void *)cls->cls_name);
+ cls->lib_name = (char *)H5MM_xfree((void *)cls->lib_name);
+ cls->lib_vers = (char *)H5MM_xfree((void *)cls->lib_vers);
+ cls = H5FL_FREE(H5E_cls_t, cls);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5E__free_class() */
-
/*-------------------------------------------------------------------------
* Function: H5Eregister_class
*
@@ -435,29 +421,28 @@ H5E__free_class(H5E_cls_t *cls)
hid_t
H5Eregister_class(const char *cls_name, const char *lib_name, const char *version)
{
- H5E_cls_t *cls; /* Pointer to error class */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5E_cls_t *cls; /* Pointer to error class */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "*s*s*s", cls_name, lib_name, version);
/* Check arguments */
- if(cls_name == NULL || lib_name == NULL || version == NULL)
+ if (cls_name == NULL || lib_name == NULL || version == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid string")
/* Create the new error class object */
- if(NULL == (cls = H5E__register_class(cls_name, lib_name, version)))
+ if (NULL == (cls = H5E__register_class(cls_name, lib_name, version)))
HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error class")
/* Register the new error class to get an ID for it */
- if((ret_value = H5I_register(H5I_ERROR_CLASS, cls, TRUE)) < 0)
+ if ((ret_value = H5I_register(H5I_ERROR_CLASS, cls, TRUE)) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register error class")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eregister_class() */
-
/*-------------------------------------------------------------------------
* Function: H5E__register_class
*
@@ -474,8 +459,8 @@ done:
static H5E_cls_t *
H5E__register_class(const char *cls_name, const char *lib_name, const char *version)
{
- H5E_cls_t *cls = NULL; /* Pointer to error class */
- H5E_cls_t *ret_value = NULL; /* Return value */
+ H5E_cls_t *cls = NULL; /* Pointer to error class */
+ H5E_cls_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -485,29 +470,28 @@ H5E__register_class(const char *cls_name, const char *lib_name, const char *vers
HDassert(version);
/* Allocate space for new error class */
- if(NULL == (cls = H5FL_CALLOC(H5E_cls_t)))
+ if (NULL == (cls = H5FL_CALLOC(H5E_cls_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Duplicate string information */
- if(NULL == (cls->cls_name = H5MM_xstrdup(cls_name)))
+ if (NULL == (cls->cls_name = H5MM_xstrdup(cls_name)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- if(NULL == (cls->lib_name = H5MM_xstrdup(lib_name)))
+ if (NULL == (cls->lib_name = H5MM_xstrdup(lib_name)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- if(NULL == (cls->lib_vers = H5MM_xstrdup(version)))
+ if (NULL == (cls->lib_vers = H5MM_xstrdup(version)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set the return value */
ret_value = cls;
done:
- if(!ret_value)
- if(cls && H5E__free_class(cls) < 0)
+ if (!ret_value)
+ if (cls && H5E__free_class(cls) < 0)
HDONE_ERROR(H5E_ERROR, H5E_CANTRELEASE, NULL, "unable to free error class")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E__register_class() */
-
/*-------------------------------------------------------------------------
* Function: H5Eunregister_class
*
@@ -523,27 +507,26 @@ done:
herr_t
H5Eunregister_class(hid_t class_id)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", class_id);
/* Check arguments */
- if(H5I_ERROR_CLASS != H5I_get_type(class_id))
+ if (H5I_ERROR_CLASS != H5I_get_type(class_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an error class")
/*
* Decrement the counter on the dataset. It will be freed if the count
* reaches zero.
*/
- if(H5I_dec_app_ref(class_id) < 0)
+ if (H5I_dec_app_ref(class_id) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error class")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eunregister_class() */
-
/*-------------------------------------------------------------------------
* Function: H5E__unregister_class
*
@@ -559,7 +542,7 @@ done:
static herr_t
H5E__unregister_class(H5E_cls_t *cls)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -567,18 +550,17 @@ H5E__unregister_class(H5E_cls_t *cls)
HDassert(cls);
/* Iterate over all the messages and delete those in this error class */
- if(H5I_iterate(H5I_ERROR_MSG, H5E__close_msg_cb, cls, FALSE) < 0)
+ if (H5I_iterate(H5I_ERROR_MSG, H5E__close_msg_cb, cls, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_BADITER, FAIL, "unable to free all messages in this error class")
/* Free error class structure */
- if(H5E__free_class(cls) < 0)
+ if (H5E__free_class(cls) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "unable to free error class")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E__unregister_class() */
-
/*-------------------------------------------------------------------------
* Function: H5Eget_class_name
*
@@ -595,25 +577,24 @@ done:
ssize_t
H5Eget_class_name(hid_t class_id, char *name, size_t size)
{
- H5E_cls_t *cls; /* Pointer to error class */
- ssize_t ret_value = -1; /* Return value */
+ H5E_cls_t *cls; /* Pointer to error class */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "i*sz", class_id, name, size);
/* Get the error class */
- if(NULL == (cls = (H5E_cls_t *)H5I_object_verify(class_id, H5I_ERROR_CLASS)))
+ if (NULL == (cls = (H5E_cls_t *)H5I_object_verify(class_id, H5I_ERROR_CLASS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a error class ID")
/* Retrieve the class name */
- if((ret_value = H5E__get_class_name(cls, name, size)) < 0)
+ if ((ret_value = H5E__get_class_name(cls, name, size)) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get error class name")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eget_class_name() */
-
/*-------------------------------------------------------------------------
* Function: H5E__get_class_name
*
@@ -630,7 +611,7 @@ done:
static ssize_t
H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size)
{
- ssize_t len = -1; /* Length of error class's name */
+ ssize_t len = -1; /* Length of error class's name */
FUNC_ENTER_STATIC_NOERR
@@ -641,17 +622,16 @@ H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size)
len = (ssize_t)HDstrlen(cls->cls_name);
/* Set the user's buffer, if provided */
- if(name) {
- HDstrncpy(name, cls->cls_name, MIN((size_t)(len + 1), size));
- if((size_t)len >= size)
- name[size - 1] = '\0';
+ if (name) {
+ HDstrncpy(name, cls->cls_name, MIN((size_t)(len + 1), size));
+ if ((size_t)len >= size)
+ name[size - 1] = '\0';
} /* end if */
/* Return the full length */
FUNC_LEAVE_NOAPI(len)
} /* end H5E__get_class_name() */
-
/*-------------------------------------------------------------------------
* Function: H5E__close_msg_cb
*
@@ -669,9 +649,9 @@ H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size)
static int
H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata)
{
- H5E_msg_t *err_msg = (H5E_msg_t*)obj_ptr;
- H5E_cls_t *cls = (H5E_cls_t*)udata;
- int ret_value = H5_ITER_CONT; /* Return value */
+ H5E_msg_t *err_msg = (H5E_msg_t *)obj_ptr;
+ H5E_cls_t *cls = (H5E_cls_t *)udata;
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -679,10 +659,10 @@ H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata)
HDassert(err_msg);
/* Close the message if it is in the class being closed */
- if(err_msg->cls == cls) {
- if(H5E__close_msg(err_msg) < 0)
+ if (err_msg->cls == cls) {
+ if (H5E__close_msg(err_msg) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, H5_ITER_ERROR, "unable to close error message")
- if(NULL == H5I_remove(obj_id))
+ if (NULL == H5I_remove(obj_id))
HGOTO_ERROR(H5E_ERROR, H5E_CANTREMOVE, H5_ITER_ERROR, "unable to remove error message")
} /* end if */
@@ -690,7 +670,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E__close_msg_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5Eclose_msg
*
@@ -706,24 +685,23 @@ done:
herr_t
H5Eclose_msg(hid_t err_id)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", err_id);
/* Check arguments */
- if(H5I_ERROR_MSG != H5I_get_type(err_id))
+ if (H5I_ERROR_MSG != H5I_get_type(err_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an error class")
/* Decrement the counter. It will be freed if the count reaches zero. */
- if(H5I_dec_app_ref(err_id) < 0)
+ if (H5I_dec_app_ref(err_id) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error message")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eclose_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5E__close_msg
*
@@ -752,7 +730,6 @@ H5E__close_msg(H5E_msg_t *err)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5E__close_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5Ecreate_msg
*
@@ -769,29 +746,29 @@ H5E__close_msg(H5E_msg_t *err)
hid_t
H5Ecreate_msg(hid_t class_id, H5E_type_t msg_type, const char *msg_str)
{
- H5E_cls_t *cls; /* Pointer to error class */
- H5E_msg_t *msg; /* Pointer to new error message */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5E_cls_t *cls; /* Pointer to error class */
+ H5E_msg_t *msg; /* Pointer to new error message */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "iEt*s", class_id, msg_type, msg_str);
/* Check arguments */
- if(msg_type != H5E_MAJOR && msg_type != H5E_MINOR)
+ if (msg_type != H5E_MAJOR && msg_type != H5E_MINOR)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "not a valid message type")
- if(msg_str == NULL)
+ if (msg_str == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "message is NULL")
/* Get the error class */
- if(NULL == (cls = (H5E_cls_t *)H5I_object_verify(class_id, H5I_ERROR_CLASS)))
+ if (NULL == (cls = (H5E_cls_t *)H5I_object_verify(class_id, H5I_ERROR_CLASS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an error class ID")
/* Create the new error message object */
- if(NULL == (msg = H5E__create_msg(cls, msg_type, msg_str)))
+ if (NULL == (msg = H5E__create_msg(cls, msg_type, msg_str)))
HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error message")
/* Register the new error class to get an ID for it */
- if((ret_value = H5I_register(H5I_ERROR_MSG, msg, TRUE)) < 0)
+ if ((ret_value = H5I_register(H5I_ERROR_MSG, msg, TRUE)) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register error message")
done:
@@ -814,8 +791,8 @@ done:
static H5E_msg_t *
H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str)
{
- H5E_msg_t *msg = NULL; /* Pointer to new error message */
- H5E_msg_t *ret_value = NULL; /* Return value */
+ H5E_msg_t *msg = NULL; /* Pointer to new error message */
+ H5E_msg_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -825,27 +802,26 @@ H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str)
HDassert(msg_str);
/* Allocate new message object */
- if(NULL == (msg = H5FL_MALLOC(H5E_msg_t)))
+ if (NULL == (msg = H5FL_MALLOC(H5E_msg_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Fill new message object */
- msg->cls = cls;
+ msg->cls = cls;
msg->type = msg_type;
- if(NULL == (msg->msg = H5MM_xstrdup(msg_str)))
+ if (NULL == (msg->msg = H5MM_xstrdup(msg_str)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set return value */
ret_value = msg;
done:
- if(!ret_value)
- if(msg && H5E__close_msg(msg) < 0)
+ if (!ret_value)
+ if (msg && H5E__close_msg(msg) < 0)
HDONE_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, NULL, "unable to close error message")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E__create_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5Eget_msg
*
@@ -862,25 +838,24 @@ done:
ssize_t
H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg_str, size_t size)
{
- H5E_msg_t *msg; /* Pointer to error message */
- ssize_t ret_value = -1; /* Return value */
+ H5E_msg_t *msg; /* Pointer to error message */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API_NOCLEAR((-1))
H5TRACE4("Zs", "i*Et*sz", msg_id, type, msg_str, size);
/* Get the message object */
- if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(msg_id, H5I_ERROR_MSG)))
+ if (NULL == (msg = (H5E_msg_t *)H5I_object_verify(msg_id, H5I_ERROR_MSG)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a error message ID")
/* Get the message's text */
- if((ret_value = H5E__get_msg(msg, type, msg_str, size)) < 0)
+ if ((ret_value = H5E__get_msg(msg, type, msg_str, size)) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get error message text")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eget_msg() */
-
/*-------------------------------------------------------------------------
* Function: H5Ecreate_stack
*
@@ -897,28 +872,27 @@ done:
hid_t
H5Ecreate_stack(void)
{
- H5E_t *stk; /* Error stack */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5E_t *stk; /* Error stack */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
- H5TRACE0("i","");
+ H5TRACE0("i", "");
/* Allocate a new error stack */
- if(NULL == (stk = H5FL_CALLOC(H5E_t)))
+ if (NULL == (stk = H5FL_CALLOC(H5E_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed")
/* Set the "automatic" error reporting info to the library default */
H5E__set_default_auto(stk);
/* Register the stack */
- if((ret_value = H5I_register(H5I_ERROR_STACK, stk, TRUE)) < 0)
+ if ((ret_value = H5I_register(H5I_ERROR_STACK, stk, TRUE)) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't create error stack")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Ecreate_stack() */
-
/*-------------------------------------------------------------------------
* Function: H5Eget_current_stack
*
@@ -936,26 +910,25 @@ done:
hid_t
H5Eget_current_stack(void)
{
- H5E_t *stk; /* Error stack */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5E_t *stk; /* Error stack */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
/* Don't clear the error stack! :-) */
FUNC_ENTER_API_NOCLEAR(H5I_INVALID_HID)
- H5TRACE0("i","");
+ H5TRACE0("i", "");
/* Get the current stack */
- if(NULL == (stk = H5E__get_current_stack()))
+ if (NULL == (stk = H5E__get_current_stack()))
HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error stack")
/* Register the stack */
- if((ret_value = H5I_register(H5I_ERROR_STACK, stk, TRUE)) < 0)
+ if ((ret_value = H5I_register(H5I_ERROR_STACK, stk, TRUE)) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't create error stack")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eget_current_stack() */
-
/*-------------------------------------------------------------------------
* Function: H5E__get_current_stack
*
@@ -972,51 +945,52 @@ done:
static H5E_t *
H5E__get_current_stack(void)
{
- H5E_t *current_stack; /* Pointer to the current error stack */
- H5E_t *estack_copy = NULL; /* Pointer to new error stack to return */
- unsigned u; /* Local index variable */
- H5E_t *ret_value = NULL; /* Return value */
+ H5E_t * current_stack; /* Pointer to the current error stack */
+ H5E_t * estack_copy = NULL; /* Pointer to new error stack to return */
+ unsigned u; /* Local index variable */
+ H5E_t * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
/* Get a pointer to the current error stack */
- if(NULL == (current_stack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
- HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get current error stack")
+ if (NULL == (current_stack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean'
+ in non-threaded case */
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get current error stack")
/* Allocate a new error stack */
- if(NULL == (estack_copy = H5FL_CALLOC(H5E_t)))
+ if (NULL == (estack_copy = H5FL_CALLOC(H5E_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Make a copy of current error stack */
estack_copy->nused = current_stack->nused;
- for(u = 0; u < current_stack->nused; u++) {
+ for (u = 0; u < current_stack->nused; u++) {
H5E_error2_t *current_error, *new_error; /* Pointers to errors on each stack */
/* Get pointers into the current error stack location */
current_error = &(current_stack->slot[u]);
- new_error = &(estack_copy->slot[u]);
+ new_error = &(estack_copy->slot[u]);
/* Increment the IDs to indicate that they are used in this stack */
- if(H5I_inc_ref(current_error->cls_id, FALSE) < 0)
+ if (H5I_inc_ref(current_error->cls_id, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, NULL, "unable to increment ref count on error class")
new_error->cls_id = current_error->cls_id;
- if(H5I_inc_ref(current_error->maj_num, FALSE) < 0)
+ if (H5I_inc_ref(current_error->maj_num, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, NULL, "unable to increment ref count on error message")
new_error->maj_num = current_error->maj_num;
- if(H5I_inc_ref(current_error->min_num, FALSE) < 0)
+ if (H5I_inc_ref(current_error->min_num, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, NULL, "unable to increment ref count on error message")
new_error->min_num = current_error->min_num;
- if(NULL == (new_error->func_name = H5MM_xstrdup(current_error->func_name)))
+ if (NULL == (new_error->func_name = H5MM_xstrdup(current_error->func_name)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- if(NULL == (new_error->file_name = H5MM_xstrdup(current_error->file_name)))
+ if (NULL == (new_error->file_name = H5MM_xstrdup(current_error->file_name)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
new_error->line = current_error->line;
- if(NULL == (new_error->desc = H5MM_xstrdup(current_error->desc)))
+ if (NULL == (new_error->desc = H5MM_xstrdup(current_error->desc)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
} /* end for */
/* Copy the "automatic" error reporting information */
- estack_copy->auto_op = current_stack->auto_op;
+ estack_copy->auto_op = current_stack->auto_op;
estack_copy->auto_data = current_stack->auto_data;
/* Empty current error stack */
@@ -1026,14 +1000,13 @@ H5E__get_current_stack(void)
ret_value = estack_copy;
done:
- if(ret_value == NULL)
- if(estack_copy)
+ if (ret_value == NULL)
+ if (estack_copy)
estack_copy = H5FL_FREE(H5E_t, estack_copy);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E__get_current_stack() */
-
/*-------------------------------------------------------------------------
* Function: H5Eset_current_stack
*
@@ -1051,24 +1024,24 @@ herr_t
H5Eset_current_stack(hid_t err_stack)
{
H5E_t *estack;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", err_stack);
- if(err_stack != H5E_DEFAULT) {
- if(NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK)))
+ if (err_stack != H5E_DEFAULT) {
+ if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
/* Set the current error stack */
- if(H5E__set_current_stack(estack) < 0)
+ if (H5E__set_current_stack(estack) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "unable to set error stack")
/*
* Decrement the counter on the error stack. It will be freed if the count
* reaches zero.
*/
- if(H5I_dec_app_ref(err_stack) < 0)
+ if (H5I_dec_app_ref(err_stack) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error stack")
} /* end if */
@@ -1076,7 +1049,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eset_current_stack() */
-
/*-------------------------------------------------------------------------
* Function: H5E__set_current_stack
*
@@ -1092,9 +1064,9 @@ done:
static herr_t
H5E__set_current_stack(H5E_t *estack)
{
- H5E_t *current_stack; /* Default error stack */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5E_t * current_stack; /* Default error stack */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1102,37 +1074,38 @@ H5E__set_current_stack(H5E_t *estack)
HDassert(estack);
/* Get a pointer to the current error stack */
- if(NULL == (current_stack = H5E__get_my_stack ())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
- HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
+ if (NULL == (current_stack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean'
+ in non-threaded case */
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
/* Empty current error stack */
H5E_clear_stack(current_stack);
/* Copy new stack to current error stack */
current_stack->nused = estack->nused;
- for(u = 0; u < current_stack->nused; u++) {
+ for (u = 0; u < current_stack->nused; u++) {
H5E_error2_t *current_error, *new_error; /* Pointers to errors on each stack */
/* Get pointers into the current error stack location */
current_error = &(current_stack->slot[u]);
- new_error = &(estack->slot[u]);
+ new_error = &(estack->slot[u]);
/* Increment the IDs to indicate that they are used in this stack */
- if(H5I_inc_ref(new_error->cls_id, FALSE) < 0)
+ if (H5I_inc_ref(new_error->cls_id, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error class")
current_error->cls_id = new_error->cls_id;
- if(H5I_inc_ref(new_error->maj_num, FALSE) < 0)
+ if (H5I_inc_ref(new_error->maj_num, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error class")
current_error->maj_num = new_error->maj_num;
- if(H5I_inc_ref(new_error->min_num, FALSE) < 0)
+ if (H5I_inc_ref(new_error->min_num, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error class")
current_error->min_num = new_error->min_num;
- if(NULL == (current_error->func_name = H5MM_xstrdup(new_error->func_name)))
+ if (NULL == (current_error->func_name = H5MM_xstrdup(new_error->func_name)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- if(NULL == (current_error->file_name = H5MM_xstrdup(new_error->file_name)))
+ if (NULL == (current_error->file_name = H5MM_xstrdup(new_error->file_name)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
current_error->line = new_error->line;
- if(NULL == (current_error->desc = H5MM_xstrdup(new_error->desc)))
+ if (NULL == (current_error->desc = H5MM_xstrdup(new_error->desc)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
} /* end for */
@@ -1140,7 +1113,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E__set_current_stack() */
-
/*-------------------------------------------------------------------------
* Function: H5Eclose_stack
*
@@ -1156,21 +1128,21 @@ done:
herr_t
H5Eclose_stack(hid_t stack_id)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", stack_id);
- if(H5E_DEFAULT != stack_id) {
+ if (H5E_DEFAULT != stack_id) {
/* Check arguments */
- if(H5I_ERROR_STACK != H5I_get_type(stack_id))
+ if (H5I_ERROR_STACK != H5I_get_type(stack_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
/*
* Decrement the counter on the error stack. It will be freed if the count
* reaches zero.
*/
- if(H5I_dec_app_ref(stack_id) < 0)
+ if (H5I_dec_app_ref(stack_id) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error stack")
} /* end if */
@@ -1178,7 +1150,6 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eclose_stack() */
-
/*-------------------------------------------------------------------------
* Function: H5E__close_stack
*
@@ -1208,7 +1179,6 @@ H5E__close_stack(H5E_t *estack)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5E__close_stack() */
-
/*-------------------------------------------------------------------------
* Function: H5Eget_num
*
@@ -1225,16 +1195,17 @@ H5E__close_stack(H5E_t *estack)
ssize_t
H5Eget_num(hid_t error_stack_id)
{
- H5E_t *estack; /* Error stack to operate on */
- ssize_t ret_value; /* Return value */
+ H5E_t * estack; /* Error stack to operate on */
+ ssize_t ret_value; /* Return value */
/* Don't clear the error stack! :-) */
FUNC_ENTER_API_NOCLEAR((-1))
H5TRACE1("Zs", "i", error_stack_id);
/* Need to check for errors */
- if(error_stack_id == H5E_DEFAULT) {
- if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if (error_stack_id == H5E_DEFAULT) {
+ if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
+ non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get current error stack")
} /* end if */
else {
@@ -1242,19 +1213,18 @@ H5Eget_num(hid_t error_stack_id)
H5E_clear_stack(NULL);
/* Get the error stack to operate on */
- if(NULL == (estack = (H5E_t *)H5I_object_verify(error_stack_id, H5I_ERROR_STACK)))
+ if (NULL == (estack = (H5E_t *)H5I_object_verify(error_stack_id, H5I_ERROR_STACK)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an error stack ID")
} /* end else */
/* Get the number of errors on stack */
- if((ret_value = H5E__get_num(estack)) < 0)
+ if ((ret_value = H5E__get_num(estack)) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get number of errors")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eget_num() */
-
/*-------------------------------------------------------------------------
* Function: H5E__get_num
*
@@ -1278,7 +1248,6 @@ H5E__get_num(const H5E_t *estack)
FUNC_LEAVE_NOAPI((ssize_t)estack->nused)
} /* end H5E__get_num() */
-
/*-------------------------------------------------------------------------
* Function: H5Epop
*
@@ -1295,15 +1264,16 @@ herr_t
H5Epop(hid_t err_stack, size_t count)
{
H5E_t *estack;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Don't clear the error stack! :-) */
FUNC_ENTER_API_NOCLEAR(FAIL)
H5TRACE2("e", "iz", err_stack, count);
/* Need to check for errors */
- if(err_stack == H5E_DEFAULT) {
- if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if (err_stack == H5E_DEFAULT) {
+ if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
+ non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
else {
@@ -1311,23 +1281,22 @@ H5Epop(hid_t err_stack, size_t count)
H5E_clear_stack(NULL);
/* Get the error stack to operate on */
- if(NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK)))
+ if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
} /* end else */
/* Range limit the number of errors to pop off stack */
- if(count > estack->nused)
+ if (count > estack->nused)
count = estack->nused;
/* Pop the errors off the stack */
- if(H5E__pop(estack, count) < 0)
+ if (H5E__pop(estack, count) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "can't pop errors from stack")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Epop() */
-
/*-------------------------------------------------------------------------
* Function: H5Epush2
*
@@ -1350,61 +1319,59 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line,
- hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...)
+H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id,
+ hid_t min_id, const char *fmt, ...)
{
- va_list ap; /* Varargs info */
- H5E_t *estack; /* Pointer to error stack to modify */
- char *tmp = NULL; /* Buffer to place formatted description in */
- hbool_t va_started = FALSE; /* Whether the variable argument list is open */
- herr_t ret_value=SUCCEED; /* Return value */
+ va_list ap; /* Varargs info */
+ H5E_t * estack; /* Pointer to error stack to modify */
+ char * tmp = NULL; /* Buffer to place formatted description in */
+ hbool_t va_started = FALSE; /* Whether the variable argument list is open */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Don't clear the error stack! :-) */
FUNC_ENTER_API_NOCLEAR(FAIL)
- H5TRACE8("e", "i*s*sIuiii*s", err_stack, file, func, line, cls_id, maj_id,
- min_id, fmt);
+ H5TRACE8("e", "i*s*sIuiii*s", err_stack, file, func, line, cls_id, maj_id, min_id, fmt);
- if(err_stack == H5E_DEFAULT)
- estack = NULL;
+ if (err_stack == H5E_DEFAULT)
+ estack = NULL;
else {
/* Only clear the error stack if it's not the default stack */
H5E_clear_stack(NULL);
/* Get the error stack to operate on */
- if(NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK)))
+ if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
} /* end else */
-/* Note that the variable-argument parsing for the format is identical in
- * the H5E_printf_stack() routine - correct errors and make changes in both
- * places. -QAK
- */
+ /* Note that the variable-argument parsing for the format is identical in
+ * the H5E_printf_stack() routine - correct errors and make changes in both
+ * places. -QAK
+ */
/* Format the description */
HDva_start(ap, fmt);
va_started = TRUE;
/* Use the vasprintf() routine, since it does what we're trying to do below */
- if(HDvasprintf(&tmp, fmt, ap) < 0)
+ if (HDvasprintf(&tmp, fmt, ap) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Push the error on the stack */
- if(H5E__push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0)
+ if (H5E__push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack")
done:
- if(va_started)
+ if (va_started)
HDva_end(ap);
/* Memory was allocated with HDvasprintf so it needs to be freed
* with HDfree
*/
- if(tmp)
+ if (tmp)
HDfree(tmp);
FUNC_LEAVE_API(ret_value)
} /* end H5Epush2() */
-
/*-------------------------------------------------------------------------
* Function: H5Eclear2
*
@@ -1420,33 +1387,32 @@ done:
herr_t
H5Eclear2(hid_t err_stack)
{
- H5E_t *estack; /* Error stack to operate on */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5E_t *estack; /* Error stack to operate on */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Don't clear the error stack! :-) */
FUNC_ENTER_API_NOCLEAR(FAIL)
H5TRACE1("e", "i", err_stack);
/* Need to check for errors */
- if(err_stack == H5E_DEFAULT)
- estack = NULL;
+ if (err_stack == H5E_DEFAULT)
+ estack = NULL;
else {
/* Only clear the error stack if it's not the default stack */
H5E_clear_stack(NULL);
- if(NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK)))
+ if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
} /* end else */
/* Clear the error stack */
- if(H5E_clear_stack(estack) < 0)
+ if (H5E_clear_stack(estack) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eclear2() */
-
/*-------------------------------------------------------------------------
* Function: H5Eprint2
*
@@ -1465,35 +1431,35 @@ done:
herr_t
H5Eprint2(hid_t err_stack, FILE *stream)
{
- H5E_t *estack; /* Error stack to operate on */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5E_t *estack; /* Error stack to operate on */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Don't clear the error stack! :-) */
FUNC_ENTER_API_NOCLEAR(FAIL)
/*NO TRACE*/
/* Need to check for errors */
- if(err_stack == H5E_DEFAULT) {
- if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if (err_stack == H5E_DEFAULT) {
+ if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
+ non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
else {
/* Only clear the error stack if it's not the default stack */
H5E_clear_stack(NULL);
- if(NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK)))
+ if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
} /* end else */
/* Print error stack */
- if(H5E__print(estack, stream, FALSE) < 0)
+ if (H5E__print(estack, stream, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eprint2() */
-
/*-------------------------------------------------------------------------
* Function: H5Ewalk2
*
@@ -1510,38 +1476,38 @@ done:
herr_t
H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, void *client_data)
{
- H5E_t *estack; /* Error stack to operate on */
- H5E_walk_op_t op; /* Operator for walking error stack */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5E_t * estack; /* Error stack to operate on */
+ H5E_walk_op_t op; /* Operator for walking error stack */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Don't clear the error stack! :-) */
FUNC_ENTER_API_NOCLEAR(FAIL)
/*NO TRACE*/
/* Need to check for errors */
- if(err_stack == H5E_DEFAULT) {
- if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if (err_stack == H5E_DEFAULT) {
+ if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
+ non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
else {
/* Only clear the error stack if it's not the default stack */
H5E_clear_stack(NULL);
- if(NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK)))
+ if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
} /* end else */
/* Walk the error stack */
- op.vers = 2;
+ op.vers = 2;
op.u.func2 = stack_func;
- if((ret_value = H5E__walk(estack, direction, &op, client_data)) < 0)
+ if ((ret_value = H5E__walk(estack, direction, &op, client_data)) < 0)
HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack");
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Ewalk2() */
-
/*-------------------------------------------------------------------------
* Function: H5Eget_auto2
*
@@ -1560,39 +1526,38 @@ done:
herr_t
H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data)
{
- H5E_t *estack; /* Error stack to operate on */
- H5E_auto_op_t op; /* Error stack function */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5E_t * estack; /* Error stack to operate on */
+ H5E_auto_op_t op; /* Error stack function */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*x**x", estack_id, func, client_data);
- if(estack_id == H5E_DEFAULT) {
- if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if (estack_id == H5E_DEFAULT) {
+ if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
+ non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
- else
- if(NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
+ else if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
/* Get the automatic error reporting information */
- if(H5E__get_auto(estack, &op, client_data) < 0)
+ if (H5E__get_auto(estack, &op, client_data) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info")
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Fail if the printing function isn't the default(user-set) and set through H5Eset_auto1 */
- if(!op.is_default && op.vers == 1)
+ if (!op.is_default && op.vers == 1)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "wrong API function, H5Eset_auto1 has been called")
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- if(func)
+ if (func)
*func = op.func2;
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eget_auto2() */
-
/*-------------------------------------------------------------------------
* Function: H5Eset_auto2
*
@@ -1618,29 +1583,29 @@ done:
herr_t
H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data)
{
- H5E_t *estack; /* Error stack to operate on */
- H5E_auto_op_t op; /* Error stack operator */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5E_t * estack; /* Error stack to operate on */
+ H5E_auto_op_t op; /* Error stack operator */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Don't clear the error stack! :-) */
FUNC_ENTER_API_NOCLEAR(FAIL)
H5TRACE3("e", "ix*x", estack_id, func, client_data);
- if(estack_id == H5E_DEFAULT) {
- if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if (estack_id == H5E_DEFAULT) {
+ if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
+ non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
- else
- if(NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
+ else if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Get the automatic error reporting information */
- if(H5E__get_auto(estack, &op, NULL) < 0)
+ if (H5E__get_auto(estack, &op, NULL) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info")
/* Set the automatic error reporting information */
- if(func != op.func2_default)
+ if (func != op.func2_default)
op.is_default = FALSE;
else
op.is_default = TRUE;
@@ -1651,14 +1616,13 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data)
/* Set the automatic error reporting function */
op.func2 = func;
- if(H5E__set_auto(estack, &op, client_data) < 0)
+ if (H5E__set_auto(estack, &op, client_data) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eset_auto2() */
-
/*-------------------------------------------------------------------------
* Function: H5Eauto_is_v2
*
@@ -1677,22 +1641,22 @@ done:
herr_t
H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack)
{
- H5E_t *estack; /* Error stack to operate on */
+ H5E_t *estack; /* Error stack to operate on */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*Iu", estack_id, is_stack);
- if(estack_id == H5E_DEFAULT) {
- if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */
+ if (estack_id == H5E_DEFAULT) {
+ if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
+ non-threaded case */
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack")
} /* end if */
- else
- if(NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
+ else if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID")
/* Check if the error stack reporting function is the "newer" stack type */
- if(is_stack)
+ if (is_stack)
#ifndef H5_NO_DEPRECATED_SYMBOLS
*is_stack = estack->auto_op.vers > 1;
#else
@@ -1702,4 +1666,3 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack)
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Eauto_is_v2() */
-
diff --git a/src/H5EA.c b/src/H5EA.c
index bf50452..f246686 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -31,30 +31,26 @@
/* Module Declaration */
/**********************/
-#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
-
+#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
/***********************/
/* Other Packages Used */
/***********************/
-
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5EApkg.h" /* Extensible Arrays */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5VMprivate.h" /* Vector functions */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5EApkg.h" /* Extensible Arrays */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VMprivate.h" /* Vector functions */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
@@ -62,23 +58,18 @@
/* Typedef for generically unprotecting an object */
typedef herr_t (*H5EA__unprotect_func_t)(void *thing, unsigned cache_flags);
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-static herr_t
-H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend,
- unsigned thing_acc, void **thing, uint8_t **thing_elmt_buf,
- hsize_t *thing_elmt_idx, H5EA__unprotect_func_t *thing_unprot_func);
-static H5EA_t *H5EA__new(H5F_t *f, haddr_t ea_addr, hbool_t from_open,
- void *ctx_udata);
-
+static herr_t H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned thing_acc,
+ void **thing, uint8_t **thing_elmt_buf, hsize_t *thing_elmt_idx,
+ H5EA__unprotect_func_t *thing_unprot_func);
+static H5EA_t *H5EA__new(H5F_t *f, haddr_t ea_addr, hbool_t from_open, void *ctx_udata);
/*********************/
/* Package Variables */
@@ -93,17 +84,15 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
* client class..
*/
const H5EA_class_t *const H5EA_client_class_g[] = {
- H5EA_CLS_CHUNK, /* 0 - H5EA_CLS_CHUNK_ID */
- H5EA_CLS_FILT_CHUNK, /* 1 - H5EA_CLS_FILT_CHUNK_ID */
- H5EA_CLS_TEST, /* ? - H5EA_CLS_TEST_ID */
+ H5EA_CLS_CHUNK, /* 0 - H5EA_CLS_CHUNK_ID */
+ H5EA_CLS_FILT_CHUNK, /* 1 - H5EA_CLS_FILT_CHUNK_ID */
+ H5EA_CLS_TEST, /* ? - H5EA_CLS_TEST_ID */
};
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -114,7 +103,6 @@ H5FL_DEFINE_STATIC(H5EA_t);
/* Declare a PQ free list to manage the element */
H5FL_BLK_DEFINE(ea_native_elmt);
-
/*-------------------------------------------------------------------------
* Function: H5EA__new
*
@@ -128,58 +116,56 @@ H5FL_BLK_DEFINE(ea_native_elmt);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-H5EA_t *, NULL, NULL,
-H5EA__new(H5F_t *f, haddr_t ea_addr, hbool_t from_open, void *ctx_udata))
+BEGIN_FUNC(STATIC, ERR, H5EA_t *, NULL, NULL,
+ H5EA__new(H5F_t *f, haddr_t ea_addr, hbool_t from_open, void *ctx_udata))
- /* Local variables */
- H5EA_t *ea = NULL; /* Pointer to new extensible array */
- H5EA_hdr_t *hdr = NULL; /* The extensible array header information */
+/* Local variables */
+H5EA_t * ea = NULL; /* Pointer to new extensible array */
+H5EA_hdr_t *hdr = NULL; /* The extensible array header information */
- /*
- * Check arguments.
- */
- HDassert(f);
- HDassert(H5F_addr_defined(ea_addr));
+/*
+ * Check arguments.
+ */
+HDassert(f);
+HDassert(H5F_addr_defined(ea_addr));
- /* Allocate extensible array wrapper */
- if(NULL == (ea = H5FL_CALLOC(H5EA_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array info")
+/* Allocate extensible array wrapper */
+if (NULL == (ea = H5FL_CALLOC(H5EA_t)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array info")
- /* Lock the array header into memory */
- if(NULL == (hdr = H5EA__hdr_protect(f, ea_addr, ctx_udata, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
+/* Lock the array header into memory */
+if (NULL == (hdr = H5EA__hdr_protect(f, ea_addr, ctx_udata, H5AC__READ_ONLY_FLAG)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
- /* Check for pending array deletion */
- if(from_open && hdr->pending_delete)
- H5E_THROW(H5E_CANTOPENOBJ, "can't open extensible array pending deletion")
+/* Check for pending array deletion */
+if (from_open && hdr->pending_delete)
+ H5E_THROW(H5E_CANTOPENOBJ, "can't open extensible array pending deletion")
- /* Point extensible array wrapper at header and bump it's ref count */
- ea->hdr = hdr;
- if(H5EA__hdr_incr(ea->hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+/* Point extensible array wrapper at header and bump it's ref count */
+ea->hdr = hdr;
+if (H5EA__hdr_incr(ea->hdr) < 0)
+ H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
- /* Increment # of files using this array header */
- if(H5EA__hdr_fuse_incr(ea->hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header")
+/* Increment # of files using this array header */
+if (H5EA__hdr_fuse_incr(ea->hdr) < 0)
+ H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header")
- /* Set file pointer for this array open context */
- ea->f = f;
+/* Set file pointer for this array open context */
+ea->f = f;
- /* Set the return value */
- ret_value = ea;
+/* Set the return value */
+ret_value = ea;
CATCH
- if(hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
- if(!ret_value)
- if(ea && H5EA_close(ea) < 0)
- H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array")
+if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+if (!ret_value)
+ if (ea && H5EA_close(ea) < 0)
+ H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array")
-END_FUNC(STATIC) /* end H5EA__new() */
+END_FUNC(STATIC) /* end H5EA__new() */
-
/*-------------------------------------------------------------------------
* Function: H5EA_create
*
@@ -193,43 +179,41 @@ END_FUNC(STATIC) /* end H5EA__new() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR,
-H5EA_t *, NULL, NULL,
-H5EA_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata))
+BEGIN_FUNC(PRIV, ERR, H5EA_t *, NULL, NULL,
+ H5EA_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata))
- /* Local variables */
- H5EA_t *ea = NULL; /* Pointer to new extensible array */
- haddr_t ea_addr; /* Array header address */
+/* Local variables */
+H5EA_t *ea = NULL; /* Pointer to new extensible array */
+haddr_t ea_addr; /* Array header address */
- /*
- * Check arguments.
- */
- HDassert(f);
- HDassert(cparam);
+/*
+ * Check arguments.
+ */
+HDassert(f);
+HDassert(cparam);
- /* H5EA interface sanity check */
- HDcompile_assert(H5EA_NUM_CLS_ID == NELMTS(H5EA_client_class_g));
+/* H5EA interface sanity check */
+HDcompile_assert(H5EA_NUM_CLS_ID == NELMTS(H5EA_client_class_g));
- /* Create extensible array header */
- if(HADDR_UNDEF == (ea_addr = H5EA__hdr_create(f, cparam, ctx_udata)))
- H5E_THROW(H5E_CANTINIT, "can't create extensible array header")
+/* Create extensible array header */
+if (HADDR_UNDEF == (ea_addr = H5EA__hdr_create(f, cparam, ctx_udata)))
+ H5E_THROW(H5E_CANTINIT, "can't create extensible array header")
- /* Allocate and initialize new extensible array wrapper */
- if(NULL == (ea = H5EA__new(f, ea_addr, FALSE, ctx_udata)))
- H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for extensible array wrapper")
+/* Allocate and initialize new extensible array wrapper */
+if (NULL == (ea = H5EA__new(f, ea_addr, FALSE, ctx_udata)))
+ H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for extensible array wrapper")
- /* Set the return value */
- ret_value = ea;
+/* Set the return value */
+ret_value = ea;
CATCH
- if(!ret_value)
- if(ea && H5EA_close(ea) < 0)
- H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array")
+if (!ret_value)
+ if (ea && H5EA_close(ea) < 0)
+ H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array")
-END_FUNC(PRIV) /* end H5EA_create() */
+END_FUNC(PRIV) /* end H5EA_create() */
-
/*-------------------------------------------------------------------------
* Function: H5EA_open
*
@@ -243,35 +227,32 @@ END_FUNC(PRIV) /* end H5EA_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR,
-H5EA_t *, NULL, NULL,
-H5EA_open(H5F_t *f, haddr_t ea_addr, void *ctx_udata))
+BEGIN_FUNC(PRIV, ERR, H5EA_t *, NULL, NULL, H5EA_open(H5F_t *f, haddr_t ea_addr, void *ctx_udata))
- /* Local variables */
- H5EA_t *ea = NULL; /* Pointer to new extensible array wrapper */
+/* Local variables */
+H5EA_t *ea = NULL; /* Pointer to new extensible array wrapper */
- /*
- * Check arguments.
- */
- HDassert(f);
- HDassert(H5F_addr_defined(ea_addr));
+/*
+ * Check arguments.
+ */
+HDassert(f);
+HDassert(H5F_addr_defined(ea_addr));
- /* Allocate and initialize new extensible array wrapper */
- if(NULL == (ea = H5EA__new(f, ea_addr, TRUE, ctx_udata)))
- H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for extensible array wrapper")
+/* Allocate and initialize new extensible array wrapper */
+if (NULL == (ea = H5EA__new(f, ea_addr, TRUE, ctx_udata)))
+ H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for extensible array wrapper")
- /* Set the return value */
- ret_value = ea;
+/* Set the return value */
+ret_value = ea;
CATCH
- if(!ret_value)
- if(ea && H5EA_close(ea) < 0)
- H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array")
+if (!ret_value)
+ if (ea && H5EA_close(ea) < 0)
+ H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array")
-END_FUNC(PRIV) /* end H5EA_open() */
+END_FUNC(PRIV) /* end H5EA_open() */
-
/*-------------------------------------------------------------------------
* Function: H5EA_get_nelmts
*
@@ -284,24 +265,21 @@ END_FUNC(PRIV) /* end H5EA_open() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR,
-herr_t, SUCCEED, -,
-H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts))
+BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts))
- /* Local variables */
+/* Local variables */
- /*
- * Check arguments.
- */
- HDassert(ea);
- HDassert(nelmts);
+/*
+ * Check arguments.
+ */
+HDassert(ea);
+HDassert(nelmts);
- /* Retrieve the max. index set */
- *nelmts = ea->hdr->stats.stored.max_idx_set;
+/* Retrieve the max. index set */
+*nelmts = ea->hdr->stats.stored.max_idx_set;
-END_FUNC(PRIV) /* end H5EA_get_nelmts() */
+END_FUNC(PRIV) /* end H5EA_get_nelmts() */
-
/*-------------------------------------------------------------------------
* Function: H5EA_get_addr
*
@@ -314,25 +292,22 @@ END_FUNC(PRIV) /* end H5EA_get_nelmts() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR,
-herr_t, SUCCEED, -,
-H5EA_get_addr(const H5EA_t *ea, haddr_t *addr))
+BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_addr(const H5EA_t *ea, haddr_t *addr))
- /* Local variables */
+/* Local variables */
- /*
- * Check arguments.
- */
- HDassert(ea);
- HDassert(ea->hdr);
- HDassert(addr);
+/*
+ * Check arguments.
+ */
+HDassert(ea);
+HDassert(ea->hdr);
+HDassert(addr);
- /* Retrieve the address of the extensible array's header */
- *addr = ea->hdr->addr;
+/* Retrieve the address of the extensible array's header */
+*addr = ea->hdr->addr;
-END_FUNC(PRIV) /* end H5EA_get_addr() */
+END_FUNC(PRIV) /* end H5EA_get_addr() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__lookup_elmt
*
@@ -346,302 +321,322 @@ END_FUNC(PRIV) /* end H5EA_get_addr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend,
- unsigned thing_acc, void **thing, uint8_t **thing_elmt_buf,
- hsize_t *thing_elmt_idx, H5EA__unprotect_func_t *thing_unprot_func))
-
- /* Local variables */
- H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
- H5EA_iblock_t *iblock = NULL; /* Pointer to index block for EA */
- H5EA_sblock_t *sblock = NULL; /* Pointer to super block for EA */
- H5EA_dblock_t *dblock = NULL; /* Pointer to data block for EA */
- H5EA_dblk_page_t *dblk_page = NULL; /* Pointer to data block page for EA */
- unsigned iblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting index block */
- unsigned sblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting super block */
- hbool_t stats_changed = FALSE; /* Whether array statistics changed */
- hbool_t hdr_dirty = FALSE; /* Whether the array header changed */
-
- /*
- * Check arguments.
- */
- HDassert(ea);
- HDassert(hdr);
- HDassert(thing);
- HDassert(thing_elmt_buf);
- HDassert(thing_unprot_func);
-
- /* only the H5AC__READ_ONLY_FLAG may be set in thing_acc */
- HDassert((thing_acc & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
-
- /* Set the shared array header's file context for this operation */
- hdr->f = ea->f;
-
- /* Reset the pointers to the 'thing' info */
- *thing = NULL;
- *thing_elmt_buf = NULL;
- *thing_elmt_idx = 0;
- *thing_unprot_func = (H5EA__unprotect_func_t)NULL;
+BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned thing_acc,
+ void **thing, uint8_t **thing_elmt_buf, hsize_t *thing_elmt_idx,
+ H5EA__unprotect_func_t *thing_unprot_func))
+
+/* Local variables */
+H5EA_hdr_t * hdr = ea->hdr; /* Header for EA */
+H5EA_iblock_t * iblock = NULL; /* Pointer to index block for EA */
+H5EA_sblock_t * sblock = NULL; /* Pointer to super block for EA */
+H5EA_dblock_t * dblock = NULL; /* Pointer to data block for EA */
+H5EA_dblk_page_t *dblk_page = NULL; /* Pointer to data block page for EA */
+unsigned iblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting index block */
+unsigned sblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting super block */
+hbool_t stats_changed = FALSE; /* Whether array statistics changed */
+hbool_t hdr_dirty = FALSE; /* Whether the array header changed */
+
+/*
+ * Check arguments.
+ */
+HDassert(ea);
+HDassert(hdr);
+HDassert(thing);
+HDassert(thing_elmt_buf);
+HDassert(thing_unprot_func);
+
+/* only the H5AC__READ_ONLY_FLAG may be set in thing_acc */
+HDassert((thing_acc & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
+
+/* Set the shared array header's file context for this operation */
+hdr->f = ea->f;
+
+/* Reset the pointers to the 'thing' info */
+*thing = NULL;
+*thing_elmt_buf = NULL;
+*thing_elmt_idx = 0;
+*thing_unprot_func = (H5EA__unprotect_func_t)NULL;
+
+/* Check if we should create the index block */
+if (!H5F_addr_defined(hdr->idx_blk_addr)) {
+ /* Check if we are allowed to create the thing */
+ if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */
+ /* Create the index block */
+ hdr->idx_blk_addr = H5EA__iblock_create(hdr, &stats_changed);
+ if (!H5F_addr_defined(hdr->idx_blk_addr))
+ H5E_THROW(H5E_CANTCREATE, "unable to create index block")
+ hdr_dirty = TRUE;
+ } /* end if */
+ else
+ H5_LEAVE(SUCCEED)
+} /* end if */
+
+/* Protect index block */
+if (NULL == (iblock = H5EA__iblock_protect(hdr, thing_acc)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu",
+ (unsigned long long)hdr->idx_blk_addr)
+
+/* Check if element is in index block */
+if (idx < hdr->cparam.idx_blk_elmts) {
+ /* Set 'thing' info to refer to the index block */
+ *thing = iblock;
+ *thing_elmt_buf = (uint8_t *)iblock->elmts;
+ *thing_elmt_idx = idx;
+ *thing_unprot_func = (H5EA__unprotect_func_t)H5EA__iblock_unprotect;
+} /* end if */
+else {
+ unsigned sblk_idx; /* Which superblock does this index fall in? */
+ size_t dblk_idx; /* Data block index */
+ hsize_t elmt_idx; /* Offset of element in super block */
+
+ /* Get super block index where element is located */
+ sblk_idx = H5EA__dblock_sblk_idx(hdr, idx);
+
+ /* Adjust index to offset in super block */
+ elmt_idx = idx - (hdr->cparam.idx_blk_elmts + hdr->sblk_info[sblk_idx].start_idx);
+
+ /* Check for data block containing element address in the index block */
+ if (sblk_idx < iblock->nsblks) {
+ /* Compute the data block index in index block */
+ dblk_idx =
+ (size_t)(hdr->sblk_info[sblk_idx].start_dblk + (elmt_idx / hdr->sblk_info[sblk_idx].dblk_nelmts));
+ HDassert(dblk_idx < iblock->ndblk_addrs);
+
+ /* Check if the data block has been allocated on disk yet */
+ if (!H5F_addr_defined(iblock->dblk_addrs[dblk_idx])) {
+ /* Check if we are allowed to create the thing */
+ if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */
+ haddr_t dblk_addr; /* Address of data block created */
+ hsize_t dblk_off; /* Offset of data block in array */
+
+ /* Create data block */
+ dblk_off =
+ hdr->sblk_info[sblk_idx].start_idx + (dblk_idx * hdr->sblk_info[sblk_idx].dblk_nelmts);
+ dblk_addr = H5EA__dblock_create(hdr, iblock, &stats_changed, dblk_off,
+ hdr->sblk_info[sblk_idx].dblk_nelmts);
+ if (!H5F_addr_defined(dblk_addr))
+ H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block")
+
+ /* Set data block address in index block */
+ iblock->dblk_addrs[dblk_idx] = dblk_addr;
+ iblock_cache_flags |= H5AC__DIRTIED_FLAG;
+ } /* end if */
+ else
+ H5_LEAVE(SUCCEED)
+ } /* end if */
- /* Check if we should create the index block */
- if(!H5F_addr_defined(hdr->idx_blk_addr)) {
- /* Check if we are allowed to create the thing */
- if(0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */
- /* Create the index block */
- hdr->idx_blk_addr = H5EA__iblock_create(hdr, &stats_changed);
- if(!H5F_addr_defined(hdr->idx_blk_addr))
- H5E_THROW(H5E_CANTCREATE, "unable to create index block")
- hdr_dirty = TRUE;
+ /* Protect data block */
+ if (NULL == (dblock = H5EA__dblock_protect(hdr, iblock, iblock->dblk_addrs[dblk_idx],
+ hdr->sblk_info[sblk_idx].dblk_nelmts, thing_acc)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu",
+ (unsigned long long)iblock->dblk_addrs[dblk_idx])
+
+ /* Adjust index to offset in data block */
+ elmt_idx %= hdr->sblk_info[sblk_idx].dblk_nelmts;
+
+ /* Check if there is already a dependency on the header */
+ if (will_extend && !dblock->has_hdr_depend) {
+ if (H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblock) < 0)
+ H5E_THROW(H5E_CANTDEPEND,
+ "unable to create flush dependency between data block and header, index = %llu",
+ (unsigned long long)idx)
+ dblock->has_hdr_depend = TRUE;
} /* end if */
- else
- H5_LEAVE(SUCCEED)
- } /* end if */
- /* Protect index block */
- if(NULL == (iblock = H5EA__iblock_protect(hdr, thing_acc)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", (unsigned long long)hdr->idx_blk_addr)
-
- /* Check if element is in index block */
- if(idx < hdr->cparam.idx_blk_elmts) {
- /* Set 'thing' info to refer to the index block */
- *thing = iblock;
- *thing_elmt_buf = (uint8_t *)iblock->elmts;
- *thing_elmt_idx = idx;
- *thing_unprot_func = (H5EA__unprotect_func_t)H5EA__iblock_unprotect;
+ /* Set 'thing' info to refer to the data block */
+ *thing = dblock;
+ *thing_elmt_buf = (uint8_t *)dblock->elmts;
+ *thing_elmt_idx = elmt_idx;
+ *thing_unprot_func = (H5EA__unprotect_func_t)H5EA__dblock_unprotect;
} /* end if */
else {
- unsigned sblk_idx; /* Which superblock does this index fall in? */
- size_t dblk_idx; /* Data block index */
- hsize_t elmt_idx; /* Offset of element in super block */
+ size_t sblk_off; /* Offset of super block in index block array of super blocks */
- /* Get super block index where element is located */
- sblk_idx = H5EA__dblock_sblk_idx(hdr, idx);
+ /* Calculate offset of super block in index block's array */
+ sblk_off = sblk_idx - iblock->nsblks;
- /* Adjust index to offset in super block */
- elmt_idx = idx - (hdr->cparam.idx_blk_elmts + hdr->sblk_info[sblk_idx].start_idx);
+ /* Check if the super block has been allocated on disk yet */
+ if (!H5F_addr_defined(iblock->sblk_addrs[sblk_off])) {
+ /* Check if we are allowed to create the thing */
+ if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */
+ haddr_t sblk_addr; /* Address of data block created */
- /* Check for data block containing element address in the index block */
- if(sblk_idx < iblock->nsblks) {
- /* Compute the data block index in index block */
- dblk_idx = (size_t)(hdr->sblk_info[sblk_idx].start_dblk + (elmt_idx / hdr->sblk_info[sblk_idx].dblk_nelmts));
- HDassert(dblk_idx < iblock->ndblk_addrs);
+ /* Create super block */
+ sblk_addr = H5EA__sblock_create(hdr, iblock, &stats_changed, sblk_idx);
+ if (!H5F_addr_defined(sblk_addr))
+ H5E_THROW(H5E_CANTCREATE, "unable to create extensible array super block")
- /* Check if the data block has been allocated on disk yet */
- if(!H5F_addr_defined(iblock->dblk_addrs[dblk_idx])) {
- /* Check if we are allowed to create the thing */
- if(0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */
- haddr_t dblk_addr; /* Address of data block created */
- hsize_t dblk_off; /* Offset of data block in array */
-
- /* Create data block */
- dblk_off = hdr->sblk_info[sblk_idx].start_idx + (dblk_idx * hdr->sblk_info[sblk_idx].dblk_nelmts);
- dblk_addr = H5EA__dblock_create(hdr, iblock, &stats_changed, dblk_off, hdr->sblk_info[sblk_idx].dblk_nelmts);
- if(!H5F_addr_defined(dblk_addr))
- H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block")
-
- /* Set data block address in index block */
- iblock->dblk_addrs[dblk_idx] = dblk_addr;
- iblock_cache_flags |= H5AC__DIRTIED_FLAG;
- } /* end if */
- else
- H5_LEAVE(SUCCEED)
- } /* end if */
-
- /* Protect data block */
- if(NULL == (dblock = H5EA__dblock_protect(hdr, iblock, iblock->dblk_addrs[dblk_idx], hdr->sblk_info[sblk_idx].dblk_nelmts, thing_acc)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)iblock->dblk_addrs[dblk_idx])
-
- /* Adjust index to offset in data block */
- elmt_idx %= hdr->sblk_info[sblk_idx].dblk_nelmts;
-
- /* Check if there is already a dependency on the header */
- if(will_extend && !dblock->has_hdr_depend) {
- if(H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between data block and header, index = %llu", (unsigned long long)idx)
- dblock->has_hdr_depend = TRUE;
+ /* Set super block address in index block */
+ iblock->sblk_addrs[sblk_off] = sblk_addr;
+ iblock_cache_flags |= H5AC__DIRTIED_FLAG;
} /* end if */
+ else
+ H5_LEAVE(SUCCEED)
+ } /* end if */
- /* Set 'thing' info to refer to the data block */
- *thing = dblock;
- *thing_elmt_buf = (uint8_t *)dblock->elmts;
- *thing_elmt_idx = elmt_idx;
- *thing_unprot_func = (H5EA__unprotect_func_t)H5EA__dblock_unprotect;
+ /* Protect super block */
+ if (NULL ==
+ (sblock = H5EA__sblock_protect(hdr, iblock, iblock->sblk_addrs[sblk_off], sblk_idx, thing_acc)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu",
+ (unsigned long long)iblock->sblk_addrs[sblk_off])
+
+ /* Compute the data block index in super block */
+ dblk_idx = (size_t)(elmt_idx / sblock->dblk_nelmts);
+ HDassert(dblk_idx < sblock->ndblks);
+
+ /* Check if the data block has been allocated on disk yet */
+ if (!H5F_addr_defined(sblock->dblk_addrs[dblk_idx])) {
+ /* Check if we are allowed to create the thing */
+ if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */
+ haddr_t dblk_addr; /* Address of data block created */
+ hsize_t dblk_off; /* Offset of data block in array */
+
+ /* Create data block */
+ dblk_off =
+ hdr->sblk_info[sblk_idx].start_idx + (dblk_idx * hdr->sblk_info[sblk_idx].dblk_nelmts);
+ dblk_addr = H5EA__dblock_create(hdr, sblock, &stats_changed, dblk_off, sblock->dblk_nelmts);
+ if (!H5F_addr_defined(dblk_addr))
+ H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block")
+
+ /* Set data block address in index block */
+ sblock->dblk_addrs[dblk_idx] = dblk_addr;
+ sblock_cache_flags |= H5AC__DIRTIED_FLAG;
+
+ /* Create flush dependency on header, if extending the array and one doesn't already exist */
+ if (will_extend && !sblock->has_hdr_depend) {
+ if (H5EA__create_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0)
+ H5E_THROW(H5E_CANTDEPEND,
+ "unable to create flush dependency between super block and header, address "
+ "= %llu",
+ (unsigned long long)sblock->addr)
+ sblock->has_hdr_depend = TRUE;
+ } /* end if */
+ } /* end if */
+ else
+ H5_LEAVE(SUCCEED)
} /* end if */
- else {
- size_t sblk_off; /* Offset of super block in index block array of super blocks */
- /* Calculate offset of super block in index block's array */
- sblk_off = sblk_idx - iblock->nsblks;
+ /* Adjust index to offset in data block */
+ elmt_idx %= sblock->dblk_nelmts;
- /* Check if the super block has been allocated on disk yet */
- if(!H5F_addr_defined(iblock->sblk_addrs[sblk_off])) {
- /* Check if we are allowed to create the thing */
- if(0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */
- haddr_t sblk_addr; /* Address of data block created */
+ /* Check if the data block is paged */
+ if (sblock->dblk_npages) {
+ haddr_t dblk_page_addr; /* Address of data block page */
+ size_t page_idx; /* Index of page within data block */
+ size_t page_init_idx; /* Index of 'page init' bit */
- /* Create super block */
- sblk_addr = H5EA__sblock_create(hdr, iblock, &stats_changed, sblk_idx);
- if(!H5F_addr_defined(sblk_addr))
- H5E_THROW(H5E_CANTCREATE, "unable to create extensible array super block")
+ /* Compute page index */
+ page_idx = (size_t)elmt_idx / hdr->dblk_page_nelmts;
- /* Set super block address in index block */
- iblock->sblk_addrs[sblk_off] = sblk_addr;
- iblock_cache_flags |= H5AC__DIRTIED_FLAG;
- } /* end if */
- else
- H5_LEAVE(SUCCEED)
- } /* end if */
+ /* Compute 'page init' index */
+ page_init_idx = (dblk_idx * sblock->dblk_npages) + page_idx;
- /* Protect super block */
- if(NULL == (sblock = H5EA__sblock_protect(hdr, iblock, iblock->sblk_addrs[sblk_off], sblk_idx, thing_acc)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long long)iblock->sblk_addrs[sblk_off])
+ /* Adjust index to offset in data block page */
+ elmt_idx %= hdr->dblk_page_nelmts;
- /* Compute the data block index in super block */
- dblk_idx = (size_t)(elmt_idx / sblock->dblk_nelmts);
- HDassert(dblk_idx < sblock->ndblks);
+ /* Compute data block page address */
+ dblk_page_addr = sblock->dblk_addrs[dblk_idx] + H5EA_DBLOCK_PREFIX_SIZE(sblock) +
+ (page_idx * sblock->dblk_page_size);
- /* Check if the data block has been allocated on disk yet */
- if(!H5F_addr_defined(sblock->dblk_addrs[dblk_idx])) {
+ /* Check if page has been initialized yet */
+ if (!H5VM_bit_get(sblock->page_init, page_init_idx)) {
/* Check if we are allowed to create the thing */
- if(0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */
- haddr_t dblk_addr; /* Address of data block created */
- hsize_t dblk_off; /* Offset of data block in array */
-
- /* Create data block */
- dblk_off = hdr->sblk_info[sblk_idx].start_idx + (dblk_idx * hdr->sblk_info[sblk_idx].dblk_nelmts);
- dblk_addr = H5EA__dblock_create(hdr, sblock, &stats_changed, dblk_off, sblock->dblk_nelmts);
- if(!H5F_addr_defined(dblk_addr))
- H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block")
-
- /* Set data block address in index block */
- sblock->dblk_addrs[dblk_idx] = dblk_addr;
- sblock_cache_flags |= H5AC__DIRTIED_FLAG;
+ if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */
+ /* Create the data block page */
+ if (H5EA__dblk_page_create(hdr, sblock, dblk_page_addr) < 0)
+ H5E_THROW(H5E_CANTCREATE, "unable to create data block page")
- /* Create flush dependency on header, if extending the array and one doesn't already exist */
- if(will_extend && !sblock->has_hdr_depend) {
- if(H5EA__create_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0)
- H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between super block and header, address = %llu", (unsigned long long)sblock->addr)
- sblock->has_hdr_depend = TRUE;
- } /* end if */
+ /* Mark data block page as initialized in super block */
+ H5VM_bit_set(sblock->page_init, page_init_idx, TRUE);
+ sblock_cache_flags |= H5AC__DIRTIED_FLAG;
} /* end if */
else
H5_LEAVE(SUCCEED)
} /* end if */
- /* Adjust index to offset in data block */
- elmt_idx %= sblock->dblk_nelmts;
-
- /* Check if the data block is paged */
- if(sblock->dblk_npages) {
- haddr_t dblk_page_addr; /* Address of data block page */
- size_t page_idx; /* Index of page within data block */
- size_t page_init_idx; /* Index of 'page init' bit */
-
- /* Compute page index */
- page_idx = (size_t)elmt_idx / hdr->dblk_page_nelmts;
-
- /* Compute 'page init' index */
- page_init_idx = (dblk_idx * sblock->dblk_npages) + page_idx;
-
- /* Adjust index to offset in data block page */
- elmt_idx %= hdr->dblk_page_nelmts;
-
- /* Compute data block page address */
- dblk_page_addr = sblock->dblk_addrs[dblk_idx] +
- H5EA_DBLOCK_PREFIX_SIZE(sblock) +
- (page_idx * sblock->dblk_page_size);
-
- /* Check if page has been initialized yet */
- if(!H5VM_bit_get(sblock->page_init, page_init_idx)) {
- /* Check if we are allowed to create the thing */
- if(0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */
- /* Create the data block page */
- if(H5EA__dblk_page_create(hdr, sblock, dblk_page_addr) < 0)
- H5E_THROW(H5E_CANTCREATE, "unable to create data block page")
-
- /* Mark data block page as initialized in super block */
- H5VM_bit_set(sblock->page_init, page_init_idx, TRUE);
- sblock_cache_flags |= H5AC__DIRTIED_FLAG;
- } /* end if */
- else
- H5_LEAVE(SUCCEED)
- } /* end if */
+ /* Protect data block page */
+ if (NULL == (dblk_page = H5EA__dblk_page_protect(hdr, sblock, dblk_page_addr, thing_acc)))
+ H5E_THROW(H5E_CANTPROTECT,
+ "unable to protect extensible array data block page, address = %llu",
+ (unsigned long long)dblk_page_addr)
- /* Protect data block page */
- if(NULL == (dblk_page = H5EA__dblk_page_protect(hdr, sblock, dblk_page_addr, thing_acc)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu", (unsigned long long)dblk_page_addr)
+ /* Check if there is already a dependency on the header */
+ if (will_extend && !dblk_page->has_hdr_depend) {
+ if (H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblk_page) < 0)
+ H5E_THROW(
+ H5E_CANTDEPEND,
+ "unable to create flush dependency between data block page and header, index = %llu",
+ (unsigned long long)idx)
+ dblk_page->has_hdr_depend = TRUE;
+ } /* end if */
- /* Check if there is already a dependency on the header */
- if(will_extend && !dblk_page->has_hdr_depend) {
- if(H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblk_page) < 0)
- H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between data block page and header, index = %llu", (unsigned long long)idx)
- dblk_page->has_hdr_depend = TRUE;
- } /* end if */
+ /* Set 'thing' info to refer to the data block page */
+ *thing = dblk_page;
+ *thing_elmt_buf = (uint8_t *)dblk_page->elmts;
+ *thing_elmt_idx = elmt_idx;
+ *thing_unprot_func = (H5EA__unprotect_func_t)H5EA__dblk_page_unprotect;
+ } /* end if */
+ else {
+ /* Protect data block */
+ if (NULL == (dblock = H5EA__dblock_protect(hdr, sblock, sblock->dblk_addrs[dblk_idx],
+ sblock->dblk_nelmts, thing_acc)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu",
+ (unsigned long long)sblock->dblk_addrs[dblk_idx])
- /* Set 'thing' info to refer to the data block page */
- *thing = dblk_page;
- *thing_elmt_buf = (uint8_t *)dblk_page->elmts;
- *thing_elmt_idx = elmt_idx;
- *thing_unprot_func = (H5EA__unprotect_func_t)H5EA__dblk_page_unprotect;
+ /* Check if there is already a dependency on the header */
+ if (will_extend && !dblock->has_hdr_depend) {
+ if (H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblock) < 0)
+ H5E_THROW(H5E_CANTDEPEND,
+ "unable to create flush dependency between data block and header, index = %llu",
+ (unsigned long long)idx)
+ dblock->has_hdr_depend = TRUE;
} /* end if */
- else {
- /* Protect data block */
- if(NULL == (dblock = H5EA__dblock_protect(hdr, sblock, sblock->dblk_addrs[dblk_idx], sblock->dblk_nelmts, thing_acc)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)sblock->dblk_addrs[dblk_idx])
-
- /* Check if there is already a dependency on the header */
- if(will_extend && !dblock->has_hdr_depend) {
- if(H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between data block and header, index = %llu", (unsigned long long)idx)
- dblock->has_hdr_depend = TRUE;
- } /* end if */
- /* Set 'thing' info to refer to the data block */
- *thing = dblock;
- *thing_elmt_buf = (uint8_t *)dblock->elmts;
- *thing_elmt_idx = elmt_idx;
- *thing_unprot_func = (H5EA__unprotect_func_t)H5EA__dblock_unprotect;
- } /* end else */
+ /* Set 'thing' info to refer to the data block */
+ *thing = dblock;
+ *thing_elmt_buf = (uint8_t *)dblock->elmts;
+ *thing_elmt_idx = elmt_idx;
+ *thing_unprot_func = (H5EA__unprotect_func_t)H5EA__dblock_unprotect;
} /* end else */
- } /* end else */
+ } /* end else */
+} /* end else */
- /* Sanity checks */
- HDassert(*thing != NULL);
- HDassert(*thing_unprot_func != NULL);
+/* Sanity checks */
+HDassert(*thing != NULL);
+HDassert(*thing_unprot_func != NULL);
CATCH
- /* Reset 'thing' info on error */
- if(ret_value < 0) {
- *thing = NULL;
- *thing_elmt_buf = NULL;
- *thing_elmt_idx = 0;
- *thing_unprot_func = (H5EA__unprotect_func_t)NULL;
- } /* end if */
-
- /* Check for updating array statistics */
- if(stats_changed)
- hdr_dirty = TRUE;
+/* Reset 'thing' info on error */
+if (ret_value < 0) {
+ *thing = NULL;
+ *thing_elmt_buf = NULL;
+ *thing_elmt_idx = 0;
+ *thing_unprot_func = (H5EA__unprotect_func_t)NULL;
+} /* end if */
+
+/* Check for updating array statistics */
+if (stats_changed)
+ hdr_dirty = TRUE;
+
+/* Check for header modified */
+if (hdr_dirty)
+ if (H5EA__hdr_modified(hdr) < 0)
+ H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as modified")
+
+/* Release resources */
+if (iblock && *thing != iblock && H5EA__iblock_unprotect(iblock, iblock_cache_flags) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block")
+/* (Note: super blocks don't contain elements, so don't have a '*thing != sblock' check) */
+if (sblock && H5EA__sblock_unprotect(sblock, sblock_cache_flags) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block")
+if (dblock && *thing != dblock && H5EA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block")
+if (dblk_page && *thing != dblk_page && H5EA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block page")
+
+END_FUNC(STATIC) /* end H5EA__lookup_elmt() */
- /* Check for header modified */
- if(hdr_dirty)
- if(H5EA__hdr_modified(hdr) < 0)
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as modified")
-
- /* Release resources */
- if(iblock && *thing != iblock && H5EA__iblock_unprotect(iblock, iblock_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block")
- /* (Note: super blocks don't contain elements, so don't have a '*thing != sblock' check) */
- if(sblock && H5EA__sblock_unprotect(sblock, sblock_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block")
- if(dblock && *thing != dblock && H5EA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block")
- if(dblk_page && *thing != dblk_page && H5EA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block page")
-
-END_FUNC(STATIC) /* end H5EA__lookup_elmt() */
-
-
/*-------------------------------------------------------------------------
* Function: H5EA_set
*
@@ -654,58 +649,57 @@ END_FUNC(STATIC) /* end H5EA__lookup_elmt() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt))
-
- /* Local variables */
- H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
- void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */
- uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */
- hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */
- H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */
- hbool_t will_extend; /* Flag indicating if setting the element will extend the array */
- unsigned thing_cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting array metadata */
-
- /*
- * Check arguments.
- */
- HDassert(ea);
- HDassert(hdr);
-
- /* Set the shared array header's file context for this operation */
- hdr->f = ea->f;
-
- /* Look up the array metadata containing the element we want to set */
- will_extend = (idx >= hdr->stats.stored.max_idx_set);
- if(H5EA__lookup_elmt(ea, idx, will_extend, H5AC__NO_FLAGS_SET, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0)
- H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata")
-
- /* Sanity check */
- HDassert(thing);
- HDassert(thing_elmt_buf);
- HDassert(thing_unprot_func);
-
- /* Set element in thing's element buffer */
- H5MM_memcpy(thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size);
- thing_cache_flags |= H5AC__DIRTIED_FLAG;
-
- /* Update max. element set in array, if appropriate */
- if(will_extend) {
- /* Update the max index for the array */
- hdr->stats.stored.max_idx_set = idx + 1;
- if(H5EA__hdr_modified(hdr) < 0)
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as modified")
- } /* end if */
+BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt))
+
+/* Local variables */
+H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
+void * thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */
+uint8_t * thing_elmt_buf; /* Pointer to the element buffer for the array metadata */
+hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */
+H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */
+hbool_t will_extend; /* Flag indicating if setting the element will extend the array */
+unsigned thing_cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting array metadata */
+
+/*
+ * Check arguments.
+ */
+HDassert(ea);
+HDassert(hdr);
+
+/* Set the shared array header's file context for this operation */
+hdr->f = ea->f;
+
+/* Look up the array metadata containing the element we want to set */
+will_extend = (idx >= hdr->stats.stored.max_idx_set);
+if (H5EA__lookup_elmt(ea, idx, will_extend, H5AC__NO_FLAGS_SET, &thing, &thing_elmt_buf, &thing_elmt_idx,
+ &thing_unprot_func) < 0)
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata")
+
+/* Sanity check */
+HDassert(thing);
+HDassert(thing_elmt_buf);
+HDassert(thing_unprot_func);
+
+/* Set element in thing's element buffer */
+H5MM_memcpy(thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), elmt,
+ hdr->cparam.cls->nat_elmt_size);
+thing_cache_flags |= H5AC__DIRTIED_FLAG;
+
+/* Update max. element set in array, if appropriate */
+if (will_extend) {
+ /* Update the max index for the array */
+ hdr->stats.stored.max_idx_set = idx + 1;
+ if (H5EA__hdr_modified(hdr) < 0)
+ H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as modified")
+} /* end if */
CATCH
- /* Release resources */
- if(thing && (thing_unprot_func)(thing, thing_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata")
+/* Release resources */
+if (thing && (thing_unprot_func)(thing, thing_cache_flags) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata")
-END_FUNC(PRIV) /* end H5EA_set() */
+END_FUNC(PRIV) /* end H5EA_set() */
-
/*-------------------------------------------------------------------------
* Function: H5EA_get
*
@@ -718,57 +712,56 @@ END_FUNC(PRIV) /* end H5EA_set() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt))
-
- /* Local variables */
- H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
- void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */
- H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */
-
- /*
- * Check arguments.
- */
- HDassert(ea);
- HDassert(hdr);
-
- /* Check for element beyond max. element in array */
- if(idx >= hdr->stats.stored.max_idx_set) {
- /* Call the class's 'fill' callback */
- if((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0)
- H5E_THROW(H5E_CANTSET, "can't set element to class's fill value")
- } /* end if */
- else {
- uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */
- hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */
+BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt))
- /* Set the shared array header's file context for this operation */
- hdr->f = ea->f;
+/* Local variables */
+H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
+void * thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */
+H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */
- /* Look up the array metadata containing the element we want to set */
- if(H5EA__lookup_elmt(ea, idx, FALSE, H5AC__READ_ONLY_FLAG, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0)
- H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata")
+/*
+ * Check arguments.
+ */
+HDassert(ea);
+HDassert(hdr);
+
+/* Check for element beyond max. element in array */
+if (idx >= hdr->stats.stored.max_idx_set) {
+ /* Call the class's 'fill' callback */
+ if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0)
+ H5E_THROW(H5E_CANTSET, "can't set element to class's fill value")
+} /* end if */
+else {
+ uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */
+ hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */
- /* Check if the thing holding the element has been created yet */
- if(NULL == thing) {
- /* Call the class's 'fill' callback */
- if((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0)
- H5E_THROW(H5E_CANTSET, "can't set element to class's fill value")
- } /* end if */
- else
- /* Get element from thing's element buffer */
- H5MM_memcpy(elmt, thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), hdr->cparam.cls->nat_elmt_size);
- } /* end else */
+ /* Set the shared array header's file context for this operation */
+ hdr->f = ea->f;
+
+ /* Look up the array metadata containing the element we want to set */
+ if (H5EA__lookup_elmt(ea, idx, FALSE, H5AC__READ_ONLY_FLAG, &thing, &thing_elmt_buf, &thing_elmt_idx,
+ &thing_unprot_func) < 0)
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata")
+
+ /* Check if the thing holding the element has been created yet */
+ if (NULL == thing) {
+ /* Call the class's 'fill' callback */
+ if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0)
+ H5E_THROW(H5E_CANTSET, "can't set element to class's fill value")
+ } /* end if */
+ else
+ /* Get element from thing's element buffer */
+ H5MM_memcpy(elmt, thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx),
+ hdr->cparam.cls->nat_elmt_size);
+} /* end else */
CATCH
- /* Release thing */
- if(thing && (thing_unprot_func)(thing, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata")
+/* Release thing */
+if (thing && (thing_unprot_func)(thing, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata")
-END_FUNC(PRIV) /* end H5EA_get() */
+END_FUNC(PRIV) /* end H5EA_get() */
-
/*-------------------------------------------------------------------------
* Function: H5EA_depend
*
@@ -782,43 +775,40 @@ END_FUNC(PRIV) /* end H5EA_get() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA_depend(H5EA_t *ea, H5AC_proxy_entry_t *parent))
-
- /* Local variables */
- H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
-
- /*
- * Check arguments.
- */
- HDassert(ea);
- HDassert(hdr);
- HDassert(parent);
-
- /*
- * Check to see if a flush dependency between the extensible array
- * and another data structure in the file has already been set up.
- * If it hasn't, do so now.
- */
- if(NULL == hdr->parent) {
- /* Sanity check */
- HDassert(hdr->top_proxy);
+BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_depend(H5EA_t *ea, H5AC_proxy_entry_t *parent))
- /* Set the shared array header's file context for this operation */
- hdr->f = ea->f;
+/* Local variables */
+H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
- /* Add the extensible array as a child of the parent (proxy) */
- if(H5AC_proxy_entry_add_child(parent, hdr->f, hdr->top_proxy) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array as child of proxy")
- hdr->parent = parent;
- } /* end if */
+/*
+ * Check arguments.
+ */
+HDassert(ea);
+HDassert(hdr);
+HDassert(parent);
+
+/*
+ * Check to see if a flush dependency between the extensible array
+ * and another data structure in the file has already been set up.
+ * If it hasn't, do so now.
+ */
+if (NULL == hdr->parent) {
+ /* Sanity check */
+ HDassert(hdr->top_proxy);
+
+ /* Set the shared array header's file context for this operation */
+ hdr->f = ea->f;
+
+ /* Add the extensible array as a child of the parent (proxy) */
+ if (H5AC_proxy_entry_add_child(parent, hdr->f, hdr->top_proxy) < 0)
+ H5E_THROW(H5E_CANTSET, "unable to add extensible array as child of proxy")
+ hdr->parent = parent;
+} /* end if */
CATCH
-END_FUNC(PRIV) /* end H5EA_depend() */
+END_FUNC(PRIV) /* end H5EA_depend() */
-
/*-------------------------------------------------------------------------
* Function: H5EA_close
*
@@ -831,94 +821,92 @@ END_FUNC(PRIV) /* end H5EA_depend() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA_close(H5EA_t *ea))
-
- /* Local variables */
- hbool_t pending_delete = FALSE; /* Whether the array is pending deletion */
- haddr_t ea_addr = HADDR_UNDEF; /* Address of array (for deletion) */
-
- /*
- * Check arguments.
- */
- HDassert(ea);
-
- /* Close the header, if it was set */
- if(ea->hdr) {
- /* Decrement file reference & check if this is the last open extensible array using the shared array header */
- if(0 == H5EA__hdr_fuse_decr(ea->hdr)) {
- /* Set the shared array header's file context for this operation */
- ea->hdr->f = ea->f;
-
- /* Shut down anything that can't be put in the header's 'flush' callback */
-
- /* Check for pending array deletion */
- if(ea->hdr->pending_delete) {
- /* Set local info, so array deletion can occur after decrementing the
- * header's ref count
- */
- pending_delete = TRUE;
- ea_addr = ea->hdr->addr;
- } /* end if */
- } /* end if */
+BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea))
+
+/* Local variables */
+hbool_t pending_delete = FALSE; /* Whether the array is pending deletion */
+haddr_t ea_addr = HADDR_UNDEF; /* Address of array (for deletion) */
+
+/*
+ * Check arguments.
+ */
+HDassert(ea);
+
+/* Close the header, if it was set */
+if (ea->hdr) {
+ /* Decrement file reference & check if this is the last open extensible array using the shared array
+ * header */
+ if (0 == H5EA__hdr_fuse_decr(ea->hdr)) {
+ /* Set the shared array header's file context for this operation */
+ ea->hdr->f = ea->f;
+
+ /* Shut down anything that can't be put in the header's 'flush' callback */
/* Check for pending array deletion */
- if(pending_delete) {
- H5EA_hdr_t *hdr; /* Another pointer to extensible array header */
+ if (ea->hdr->pending_delete) {
+ /* Set local info, so array deletion can occur after decrementing the
+ * header's ref count
+ */
+ pending_delete = TRUE;
+ ea_addr = ea->hdr->addr;
+ } /* end if */
+ } /* end if */
+
+ /* Check for pending array deletion */
+ if (pending_delete) {
+ H5EA_hdr_t *hdr; /* Another pointer to extensible array header */
#ifndef NDEBUG
-{
- unsigned hdr_status = 0; /* Header's status in the metadata cache */
-
- /* Check the header's status in the metadata cache */
- if(H5AC_get_entry_status(ea->f, ea_addr, &hdr_status) < 0)
- H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for extensible array header")
-
- /* Sanity checks on header */
- HDassert(hdr_status & H5AC_ES__IN_CACHE);
- HDassert(hdr_status & H5AC_ES__IS_PINNED);
- HDassert(!(hdr_status & H5AC_ES__IS_PROTECTED));
-}
+ {
+ unsigned hdr_status = 0; /* Header's status in the metadata cache */
+
+ /* Check the header's status in the metadata cache */
+ if (H5AC_get_entry_status(ea->f, ea_addr, &hdr_status) < 0)
+ H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for extensible array header")
+
+ /* Sanity checks on header */
+ HDassert(hdr_status & H5AC_ES__IN_CACHE);
+ HDassert(hdr_status & H5AC_ES__IS_PINNED);
+ HDassert(!(hdr_status & H5AC_ES__IS_PROTECTED));
+ }
#endif /* NDEBUG */
- /* Lock the array header into memory */
- /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */
- if(NULL == (hdr = H5EA__hdr_protect(ea->f, ea_addr, NULL, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTLOAD, "unable to load extensible array header")
+ /* Lock the array header into memory */
+ /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */
+ if (NULL == (hdr = H5EA__hdr_protect(ea->f, ea_addr, NULL, H5AC__NO_FLAGS_SET)))
+ H5E_THROW(H5E_CANTLOAD, "unable to load extensible array header")
- /* Set the shared array header's file context for this operation */
- hdr->f = ea->f;
+ /* Set the shared array header's file context for this operation */
+ hdr->f = ea->f;
- /* Decrement the reference count on the array header */
- /* (don't put in H5EA_hdr_fuse_decr() as the array header may be evicted
- * immediately -QAK)
- */
- if(H5EA__hdr_decr(ea->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ /* Decrement the reference count on the array header */
+ /* (don't put in H5EA_hdr_fuse_decr() as the array header may be evicted
+ * immediately -QAK)
+ */
+ if (H5EA__hdr_decr(ea->hdr) < 0)
+ H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
- /* Delete array, starting with header (unprotects header) */
- if(H5EA__hdr_delete(hdr) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array")
- } /* end if */
- else {
- /* Decrement the reference count on the array header */
- /* (don't put in H5EA_hdr_fuse_decr() as the array header may be evicted
- * immediately -QAK)
- */
- if(H5EA__hdr_decr(ea->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
- } /* end else */
+ /* Delete array, starting with header (unprotects header) */
+ if (H5EA__hdr_delete(hdr) < 0)
+ H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array")
} /* end if */
+ else {
+ /* Decrement the reference count on the array header */
+ /* (don't put in H5EA_hdr_fuse_decr() as the array header may be evicted
+ * immediately -QAK)
+ */
+ if (H5EA__hdr_decr(ea->hdr) < 0)
+ H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ } /* end else */
+} /* end if */
- /* Release the extensible array wrapper */
- ea = (H5EA_t *)H5FL_FREE(H5EA_t, ea);
+/* Release the extensible array wrapper */
+ea = (H5EA_t *)H5FL_FREE(H5EA_t, ea);
CATCH
-END_FUNC(PRIV) /* end H5EA_close() */
+END_FUNC(PRIV) /* end H5EA_close() */
-
/*-------------------------------------------------------------------------
* Function: H5EA_delete
*
@@ -931,45 +919,43 @@ END_FUNC(PRIV) /* end H5EA_close() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA_delete(H5F_t *f, haddr_t ea_addr, void *ctx_udata))
-
- /* Local variables */
- H5EA_hdr_t *hdr = NULL; /* The fractal heap header information */
-
- /*
- * Check arguments.
- */
- HDassert(f);
- HDassert(H5F_addr_defined(ea_addr));
-
- /* Lock the array header into memory */
- if(NULL == (hdr = H5EA__hdr_protect(f, ea_addr, ctx_udata, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr)
-
- /* Check for files using shared array header */
- if(hdr->file_rc)
- hdr->pending_delete = TRUE;
- else {
- /* Set the shared array header's file context for this operation */
- hdr->f = f;
+BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_delete(H5F_t *f, haddr_t ea_addr, void *ctx_udata))
- /* Delete array now, starting with header (unprotects header) */
- if(H5EA__hdr_delete(hdr) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array")
- hdr = NULL;
- } /* end if */
+/* Local variables */
+H5EA_hdr_t *hdr = NULL; /* The fractal heap header information */
+
+/*
+ * Check arguments.
+ */
+HDassert(f);
+HDassert(H5F_addr_defined(ea_addr));
+
+/* Lock the array header into memory */
+if (NULL == (hdr = H5EA__hdr_protect(f, ea_addr, ctx_udata, H5AC__NO_FLAGS_SET)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu",
+ (unsigned long long)ea_addr)
+
+/* Check for files using shared array header */
+if (hdr->file_rc)
+ hdr->pending_delete = TRUE;
+else {
+ /* Set the shared array header's file context for this operation */
+ hdr->f = f;
+
+ /* Delete array now, starting with header (unprotects header) */
+ if (H5EA__hdr_delete(hdr) < 0)
+ H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array")
+ hdr = NULL;
+} /* end if */
CATCH
- /* Unprotect the header, if an error occurred */
- if(hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+/* Unprotect the header, if an error occurred */
+if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
-END_FUNC(PRIV) /* end H5EA_delete() */
+END_FUNC(PRIV) /* end H5EA_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5EA_iterate
*
@@ -982,45 +968,43 @@ END_FUNC(PRIV) /* end H5EA_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR,
-int, H5_ITER_CONT, H5_ITER_ERROR,
-H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata))
-
- /* Local variables */
- uint8_t *elmt = NULL;
- hsize_t u;
- int cb_ret = H5_ITER_CONT; /* Return value from callback */
-
- /* Check arguments */
- HDassert(ea);
- HDassert(op);
- HDassert(udata);
-
- /* Allocate space for a native array element */
- if(NULL == (elmt = H5FL_BLK_MALLOC(ea_native_elmt, ea->hdr->cparam.cls->nat_elmt_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array element")
-
- /* Iterate over all elements in array */
- for(u = 0; u < ea->hdr->stats.stored.max_idx_set && cb_ret == H5_ITER_CONT; u++) {
- /* Get array element */
- if(H5EA_get(ea, u, elmt) < 0)
- H5E_THROW(H5E_CANTGET, "unable to delete fixed array")
-
- /* Make callback */
- if((cb_ret = (*op)(u, elmt, udata)) < 0) {
- H5E_PRINTF(H5E_BADITER, "iterator function failed");
- H5_LEAVE(cb_ret)
- } /* end if */
- } /* end for */
+BEGIN_FUNC(PRIV, ERR, int, H5_ITER_CONT, H5_ITER_ERROR,
+ H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata))
+
+/* Local variables */
+uint8_t *elmt = NULL;
+hsize_t u;
+int cb_ret = H5_ITER_CONT; /* Return value from callback */
+
+/* Check arguments */
+HDassert(ea);
+HDassert(op);
+HDassert(udata);
+
+/* Allocate space for a native array element */
+if (NULL == (elmt = H5FL_BLK_MALLOC(ea_native_elmt, ea->hdr->cparam.cls->nat_elmt_size)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array element")
+
+/* Iterate over all elements in array */
+for (u = 0; u < ea->hdr->stats.stored.max_idx_set && cb_ret == H5_ITER_CONT; u++) {
+ /* Get array element */
+ if (H5EA_get(ea, u, elmt) < 0)
+ H5E_THROW(H5E_CANTGET, "unable to delete fixed array")
+
+ /* Make callback */
+ if ((cb_ret = (*op)(u, elmt, udata)) < 0) {
+ H5E_PRINTF(H5E_BADITER, "iterator function failed");
+ H5_LEAVE(cb_ret)
+ } /* end if */
+} /* end for */
CATCH
- if(elmt)
- elmt = H5FL_BLK_FREE(ea_native_elmt, elmt);
+if (elmt)
+ elmt = H5FL_BLK_FREE(ea_native_elmt, elmt);
-END_FUNC(PRIV) /* end H5EA_iterate() */
+END_FUNC(PRIV) /* end H5EA_iterate() */
-
/*-------------------------------------------------------------------------
* Function: H5EA_patch_file
*
@@ -1033,20 +1017,17 @@ END_FUNC(PRIV) /* end H5EA_iterate() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR,
-herr_t, SUCCEED, -,
-H5EA_patch_file(H5EA_t *ea, H5F_t *f))
+BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_patch_file(H5EA_t *ea, H5F_t *f))
- /* Local variables */
+/* Local variables */
- /*
- * Check arguments.
- */
- HDassert(ea);
- HDassert(f);
-
- if(ea->f != f || ea->hdr->f != f)
- ea->f = ea->hdr->f = f;
+/*
+ * Check arguments.
+ */
+HDassert(ea);
+HDassert(f);
-END_FUNC(PRIV) /* end H5EA_patch_file() */
+if (ea->f != f || ea->hdr->f != f)
+ ea->f = ea->hdr->f = f;
+END_FUNC(PRIV) /* end H5EA_patch_file() */
diff --git a/src/H5EAcache.c b/src/H5EAcache.c
index f7534fb..d621483 100644
--- a/src/H5EAcache.c
+++ b/src/H5EAcache.c
@@ -26,47 +26,41 @@
/* Module Declaration */
/**********************/
-#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
-
+#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
/***********************/
/* Other Packages Used */
/***********************/
-
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5EApkg.h" /* Extensible Arrays */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5VMprivate.h" /* Vectors and arrays */
-#include "H5WBprivate.h" /* Wrapped Buffers */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5EApkg.h" /* Extensible Arrays */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5WBprivate.h" /* Wrapped Buffers */
/****************/
/* Local Macros */
/****************/
/* Fractal heap format version #'s */
-#define H5EA_HDR_VERSION 0 /* Header */
-#define H5EA_IBLOCK_VERSION 0 /* Index block */
-#define H5EA_SBLOCK_VERSION 0 /* Super block */
-#define H5EA_DBLOCK_VERSION 0 /* Data block */
-
+#define H5EA_HDR_VERSION 0 /* Header */
+#define H5EA_IBLOCK_VERSION 0 /* Index block */
+#define H5EA_SBLOCK_VERSION 0 /* Super block */
+#define H5EA_DBLOCK_VERSION 0 /* Data block */
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
@@ -74,163 +68,147 @@
/* Metadata cache (H5AC) callbacks */
static herr_t H5EA__cache_hdr_get_initial_load_size(void *udata, size_t *image_len);
static htri_t H5EA__cache_hdr_verify_chksum(const void *image_ptr, size_t len, void *udata_ptr);
-static void *H5EA__cache_hdr_deserialize(const void *image, size_t len,
- void *udata, hbool_t *dirty);
+static void * H5EA__cache_hdr_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty);
static herr_t H5EA__cache_hdr_image_len(const void *thing, size_t *image_len);
-static herr_t H5EA__cache_hdr_serialize(const H5F_t *f, void *image, size_t len,
- void *thing);
+static herr_t H5EA__cache_hdr_serialize(const H5F_t *f, void *image, size_t len, void *thing);
static herr_t H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *thing);
static herr_t H5EA__cache_hdr_free_icr(void *thing);
static herr_t H5EA__cache_iblock_get_initial_load_size(void *udata, size_t *image_len);
static htri_t H5EA__cache_iblock_verify_chksum(const void *image_ptr, size_t len, void *udata_ptr);
-static void *H5EA__cache_iblock_deserialize(const void *image, size_t len,
- void *udata, hbool_t *dirty);
+static void * H5EA__cache_iblock_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty);
static herr_t H5EA__cache_iblock_image_len(const void *thing, size_t *image_len);
-static herr_t H5EA__cache_iblock_serialize(const H5F_t *f, void *image, size_t len,
- void *thing);
+static herr_t H5EA__cache_iblock_serialize(const H5F_t *f, void *image, size_t len, void *thing);
static herr_t H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *thing);
static herr_t H5EA__cache_iblock_free_icr(void *thing);
static herr_t H5EA__cache_sblock_get_initial_load_size(void *udata, size_t *image_len);
static htri_t H5EA__cache_sblock_verify_chksum(const void *image_ptr, size_t len, void *udata_ptr);
-static void *H5EA__cache_sblock_deserialize(const void *image, size_t len,
- void *udata, hbool_t *dirty);
+static void * H5EA__cache_sblock_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty);
static herr_t H5EA__cache_sblock_image_len(const void *thing, size_t *image_len);
-static herr_t H5EA__cache_sblock_serialize(const H5F_t *f, void *image, size_t len,
- void *thing);
+static herr_t H5EA__cache_sblock_serialize(const H5F_t *f, void *image, size_t len, void *thing);
static herr_t H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *thing);
static herr_t H5EA__cache_sblock_free_icr(void *thing);
static herr_t H5EA__cache_dblock_get_initial_load_size(void *udata, size_t *image_len);
static htri_t H5EA__cache_dblock_verify_chksum(const void *image_ptr, size_t len, void *udata_ptr);
-static void *H5EA__cache_dblock_deserialize(const void *image, size_t len,
- void *udata, hbool_t *dirty);
+static void * H5EA__cache_dblock_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty);
static herr_t H5EA__cache_dblock_image_len(const void *thing, size_t *image_len);
-static herr_t H5EA__cache_dblock_serialize(const H5F_t *f, void *image, size_t len,
- void *thing);
+static herr_t H5EA__cache_dblock_serialize(const H5F_t *f, void *image, size_t len, void *thing);
static herr_t H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *thing);
static herr_t H5EA__cache_dblock_free_icr(void *thing);
static herr_t H5EA__cache_dblock_fsf_size(const void *thing, hsize_t *fsf_size);
static herr_t H5EA__cache_dblk_page_get_initial_load_size(void *udata, size_t *image_len);
static htri_t H5EA__cache_dblk_page_verify_chksum(const void *image_ptr, size_t len, void *udata_ptr);
-static void *H5EA__cache_dblk_page_deserialize(const void *image, size_t len,
- void *udata, hbool_t *dirty);
-static herr_t H5EA__cache_dblk_page_image_len(const void *thing,
- size_t *image_len);
-static herr_t H5EA__cache_dblk_page_serialize(const H5F_t *f, void *image, size_t len,
- void *thing);
+static void * H5EA__cache_dblk_page_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty);
+static herr_t H5EA__cache_dblk_page_image_len(const void *thing, size_t *image_len);
+static herr_t H5EA__cache_dblk_page_serialize(const H5F_t *f, void *image, size_t len, void *thing);
static herr_t H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *thing);
static herr_t H5EA__cache_dblk_page_free_icr(void *thing);
-
/*********************/
/* Package Variables */
/*********************/
/* H5EA header inherits cache-like properties from H5AC */
const H5AC_class_t H5AC_EARRAY_HDR[1] = {{
- H5AC_EARRAY_HDR_ID, /* Metadata client ID */
- "Extensible Array Header", /* Metadata client name (for debugging) */
- H5FD_MEM_EARRAY_HDR, /* File space memory type for client */
- H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
- H5EA__cache_hdr_get_initial_load_size, /* 'get_initial_load_size' callback */
- NULL, /* 'get_final_load_size' callback */
- H5EA__cache_hdr_verify_chksum, /* 'verify_chksum' callback */
- H5EA__cache_hdr_deserialize, /* 'deserialize' callback */
- H5EA__cache_hdr_image_len, /* 'image_len' callback */
- NULL, /* 'pre_serialize' callback */
- H5EA__cache_hdr_serialize, /* 'serialize' callback */
- H5EA__cache_hdr_notify, /* 'notify' callback */
- H5EA__cache_hdr_free_icr, /* 'free_icr' callback */
- NULL, /* 'fsf_size' callback */
+ H5AC_EARRAY_HDR_ID, /* Metadata client ID */
+ "Extensible Array Header", /* Metadata client name (for debugging) */
+ H5FD_MEM_EARRAY_HDR, /* File space memory type for client */
+ H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
+ H5EA__cache_hdr_get_initial_load_size, /* 'get_initial_load_size' callback */
+ NULL, /* 'get_final_load_size' callback */
+ H5EA__cache_hdr_verify_chksum, /* 'verify_chksum' callback */
+ H5EA__cache_hdr_deserialize, /* 'deserialize' callback */
+ H5EA__cache_hdr_image_len, /* 'image_len' callback */
+ NULL, /* 'pre_serialize' callback */
+ H5EA__cache_hdr_serialize, /* 'serialize' callback */
+ H5EA__cache_hdr_notify, /* 'notify' callback */
+ H5EA__cache_hdr_free_icr, /* 'free_icr' callback */
+ NULL, /* 'fsf_size' callback */
}};
/* H5EA index block inherits cache-like properties from H5AC */
const H5AC_class_t H5AC_EARRAY_IBLOCK[1] = {{
- H5AC_EARRAY_IBLOCK_ID, /* Metadata client ID */
- "Extensible Array Index Block", /* Metadata client name (for debugging) */
- H5FD_MEM_EARRAY_IBLOCK, /* File space memory type for client */
- H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
- H5EA__cache_iblock_get_initial_load_size, /* 'get_initial_load_size' callback */
- NULL, /* 'get_final_load_size' callback */
- H5EA__cache_iblock_verify_chksum, /* 'verify_chksum' callback */
- H5EA__cache_iblock_deserialize, /* 'deserialize' callback */
- H5EA__cache_iblock_image_len, /* 'image_len' callback */
- NULL, /* 'pre_serialize' callback */
- H5EA__cache_iblock_serialize, /* 'serialize' callback */
- H5EA__cache_iblock_notify, /* 'notify' callback */
- H5EA__cache_iblock_free_icr, /* 'free_icr' callback */
- NULL, /* 'fsf_size' callback */
+ H5AC_EARRAY_IBLOCK_ID, /* Metadata client ID */
+ "Extensible Array Index Block", /* Metadata client name (for debugging) */
+ H5FD_MEM_EARRAY_IBLOCK, /* File space memory type for client */
+ H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
+ H5EA__cache_iblock_get_initial_load_size, /* 'get_initial_load_size' callback */
+ NULL, /* 'get_final_load_size' callback */
+ H5EA__cache_iblock_verify_chksum, /* 'verify_chksum' callback */
+ H5EA__cache_iblock_deserialize, /* 'deserialize' callback */
+ H5EA__cache_iblock_image_len, /* 'image_len' callback */
+ NULL, /* 'pre_serialize' callback */
+ H5EA__cache_iblock_serialize, /* 'serialize' callback */
+ H5EA__cache_iblock_notify, /* 'notify' callback */
+ H5EA__cache_iblock_free_icr, /* 'free_icr' callback */
+ NULL, /* 'fsf_size' callback */
}};
/* H5EA super block inherits cache-like properties from H5AC */
const H5AC_class_t H5AC_EARRAY_SBLOCK[1] = {{
- H5AC_EARRAY_SBLOCK_ID, /* Metadata client ID */
- "Extensible Array Super Block", /* Metadata client name (for debugging) */
- H5FD_MEM_EARRAY_SBLOCK, /* File space memory type for client */
- H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
- H5EA__cache_sblock_get_initial_load_size, /* 'get_initial_load_size' callback */
- NULL, /* 'get_final_load_size' callback */
- H5EA__cache_sblock_verify_chksum, /* 'verify_chksum' callback */
- H5EA__cache_sblock_deserialize, /* 'deserialize' callback */
- H5EA__cache_sblock_image_len, /* 'image_len' callback */
- NULL, /* 'pre_serialize' callback */
- H5EA__cache_sblock_serialize, /* 'serialize' callback */
- H5EA__cache_sblock_notify, /* 'notify' callback */
- H5EA__cache_sblock_free_icr, /* 'free_icr' callback */
- NULL, /* 'fsf_size' callback */
+ H5AC_EARRAY_SBLOCK_ID, /* Metadata client ID */
+ "Extensible Array Super Block", /* Metadata client name (for debugging) */
+ H5FD_MEM_EARRAY_SBLOCK, /* File space memory type for client */
+ H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
+ H5EA__cache_sblock_get_initial_load_size, /* 'get_initial_load_size' callback */
+ NULL, /* 'get_final_load_size' callback */
+ H5EA__cache_sblock_verify_chksum, /* 'verify_chksum' callback */
+ H5EA__cache_sblock_deserialize, /* 'deserialize' callback */
+ H5EA__cache_sblock_image_len, /* 'image_len' callback */
+ NULL, /* 'pre_serialize' callback */
+ H5EA__cache_sblock_serialize, /* 'serialize' callback */
+ H5EA__cache_sblock_notify, /* 'notify' callback */
+ H5EA__cache_sblock_free_icr, /* 'free_icr' callback */
+ NULL, /* 'fsf_size' callback */
}};
/* H5EA data block inherits cache-like properties from H5AC */
const H5AC_class_t H5AC_EARRAY_DBLOCK[1] = {{
- H5AC_EARRAY_DBLOCK_ID, /* Metadata client ID */
- "Extensible Array Data Block", /* Metadata client name (for debugging) */
- H5FD_MEM_EARRAY_DBLOCK, /* File space memory type for client */
- H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
- H5EA__cache_dblock_get_initial_load_size, /* 'get_initial_load_size' callback */
- NULL, /* 'get_final_load_size' callback */
- H5EA__cache_dblock_verify_chksum, /* 'verify_chksum' callback */
- H5EA__cache_dblock_deserialize, /* 'deserialize' callback */
- H5EA__cache_dblock_image_len, /* 'image_len' callback */
- NULL, /* 'pre_serialize' callback */
- H5EA__cache_dblock_serialize, /* 'serialize' callback */
- H5EA__cache_dblock_notify, /* 'notify' callback */
- H5EA__cache_dblock_free_icr, /* 'free_icr' callback */
- H5EA__cache_dblock_fsf_size, /* 'fsf_size' callback */
+ H5AC_EARRAY_DBLOCK_ID, /* Metadata client ID */
+ "Extensible Array Data Block", /* Metadata client name (for debugging) */
+ H5FD_MEM_EARRAY_DBLOCK, /* File space memory type for client */
+ H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
+ H5EA__cache_dblock_get_initial_load_size, /* 'get_initial_load_size' callback */
+ NULL, /* 'get_final_load_size' callback */
+ H5EA__cache_dblock_verify_chksum, /* 'verify_chksum' callback */
+ H5EA__cache_dblock_deserialize, /* 'deserialize' callback */
+ H5EA__cache_dblock_image_len, /* 'image_len' callback */
+ NULL, /* 'pre_serialize' callback */
+ H5EA__cache_dblock_serialize, /* 'serialize' callback */
+ H5EA__cache_dblock_notify, /* 'notify' callback */
+ H5EA__cache_dblock_free_icr, /* 'free_icr' callback */
+ H5EA__cache_dblock_fsf_size, /* 'fsf_size' callback */
}};
/* H5EA data block page inherits cache-like properties from H5AC */
const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1] = {{
- H5AC_EARRAY_DBLK_PAGE_ID, /* Metadata client ID */
- "Extensible Array Data Block Page", /* Metadata client name (for debugging) */
- H5FD_MEM_EARRAY_DBLK_PAGE, /* File space memory type for client */
- H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
+ H5AC_EARRAY_DBLK_PAGE_ID, /* Metadata client ID */
+ "Extensible Array Data Block Page", /* Metadata client name (for debugging) */
+ H5FD_MEM_EARRAY_DBLK_PAGE, /* File space memory type for client */
+ H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */
H5EA__cache_dblk_page_get_initial_load_size, /* 'get_initial_load_size' callback */
- NULL, /* 'get_final_load_size' callback */
- H5EA__cache_dblk_page_verify_chksum, /* 'verify_chksum' callback */
- H5EA__cache_dblk_page_deserialize, /* 'deserialize' callback */
- H5EA__cache_dblk_page_image_len, /* 'image_len' callback */
- NULL, /* 'pre_serialize' callback */
- H5EA__cache_dblk_page_serialize, /* 'serialize' callback */
- H5EA__cache_dblk_page_notify, /* 'notify' callback */
- H5EA__cache_dblk_page_free_icr, /* 'free_icr' callback */
- NULL, /* 'fsf_size' callback */
+ NULL, /* 'get_final_load_size' callback */
+ H5EA__cache_dblk_page_verify_chksum, /* 'verify_chksum' callback */
+ H5EA__cache_dblk_page_deserialize, /* 'deserialize' callback */
+ H5EA__cache_dblk_page_image_len, /* 'image_len' callback */
+ NULL, /* 'pre_serialize' callback */
+ H5EA__cache_dblk_page_serialize, /* 'serialize' callback */
+ H5EA__cache_dblk_page_notify, /* 'notify' callback */
+ H5EA__cache_dblk_page_free_icr, /* 'free_icr' callback */
+ NULL, /* 'fsf_size' callback */
}};
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_get_initial_load_size
*
@@ -243,24 +221,22 @@ const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1] = {{
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-herr_t, SUCCEED, -,
-H5EA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len))
+BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
+ H5EA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len))
- /* Local variables */
- H5EA_hdr_cache_ud_t *udata = (H5EA_hdr_cache_ud_t *)_udata; /* User data for callback */
+/* Local variables */
+H5EA_hdr_cache_ud_t *udata = (H5EA_hdr_cache_ud_t *)_udata; /* User data for callback */
- /* Check arguments */
- HDassert(udata);
- HDassert(udata->f);
- HDassert(image_len);
+/* Check arguments */
+HDassert(udata);
+HDassert(udata->f);
+HDassert(image_len);
- /* Set the image length size */
- *image_len = (size_t)H5EA_HEADER_SIZE_FILE(udata->f);
+/* Set the image length size */
+*image_len = (size_t)H5EA_HEADER_SIZE_FILE(udata->f);
-END_FUNC(STATIC) /* end H5EA__cache_hdr_get_initial_load_size() */
+END_FUNC(STATIC) /* end H5EA__cache_hdr_get_initial_load_size() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_verify_chksum
*
@@ -274,27 +250,25 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-htri_t, TRUE, -,
-H5EA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
+BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
+ H5EA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
- /* Local variables */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t stored_chksum; /* Stored metadata checksum value */
- uint32_t computed_chksum; /* Computed metadata checksum value */
+/* Local variables */
+const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+uint32_t stored_chksum; /* Stored metadata checksum value */
+uint32_t computed_chksum; /* Computed metadata checksum value */
- /* Check arguments */
- HDassert(image);
+/* Check arguments */
+HDassert(image);
- /* Get stored and computed checksums */
- H5F_get_checksums(image, len, &stored_chksum, &computed_chksum);
+/* Get stored and computed checksums */
+H5F_get_checksums(image, len, &stored_chksum, &computed_chksum);
- if(stored_chksum != computed_chksum)
- ret_value = FALSE;
+if (stored_chksum != computed_chksum)
+ ret_value = FALSE;
-END_FUNC(STATIC) /* end H5EA__cache_hdr_verify_chksum() */
+END_FUNC(STATIC) /* end H5EA__cache_hdr_verify_chksum() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_deserialize
*
@@ -308,117 +282,118 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-void *, NULL, NULL,
-H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
- H5EA_cls_id_t id; /* ID of extensible array class, as found in file */
- H5EA_hdr_t *hdr = NULL; /* Extensible array info */
- H5EA_hdr_cache_ud_t *udata = (H5EA_hdr_cache_ud_t *)_udata;
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t stored_chksum; /* Stored metadata checksum value */
-
- /* Check arguments */
- HDassert(image);
- HDassert(udata);
- HDassert(udata->f);
- HDassert(H5F_addr_defined(udata->addr));
-
- /* Allocate space for the extensible array data structure */
- if(NULL == (hdr = H5EA__hdr_alloc(udata->f)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header")
-
- /* Set the extensible array header's address */
- hdr->addr = udata->addr;
-
- /* Magic number */
- if(HDmemcmp(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array header signature")
- image += H5_SIZEOF_MAGIC;
-
- /* Version */
- if(*image++ != H5EA_HDR_VERSION)
- H5E_THROW(H5E_VERSION, "wrong extensible array header version")
-
- /* Extensible array class */
- id = (H5EA_cls_id_t)*image++;
- if(id >= H5EA_NUM_CLS_ID)
- H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
- hdr->cparam.cls = H5EA_client_class_g[id];
-
- /* General array creation/configuration information */
- hdr->cparam.raw_elmt_size = *image++; /* Element size in file (in bytes) */
- hdr->cparam.max_nelmts_bits = *image++; /* Log2(Max. # of elements in array) - i.e. # of bits needed to store max. # of elements */
- hdr->cparam.idx_blk_elmts = *image++; /* # of elements to store in index block */
- hdr->cparam.data_blk_min_elmts = *image++; /* Min. # of elements per data block */
- hdr->cparam.sup_blk_min_data_ptrs = *image++; /* Min. # of data block pointers for a super block */
- hdr->cparam.max_dblk_page_nelmts_bits = *image++; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */
-
- /* Array statistics */
- hdr->stats.computed.hdr_size = len; /* Size of header in file */
- H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.nsuper_blks); /* Number of super blocks created */
- H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.super_blk_size); /* Size of super blocks created */
- H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.ndata_blks); /* Number of data blocks created */
- H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.data_blk_size); /* Size of data blocks created */
- H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.max_idx_set); /* Max. index set (+1) */
- H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.nelmts); /* Number of elements 'realized' */
-
- /* Internal information */
- H5F_addr_decode(udata->f, &image, &hdr->idx_blk_addr); /* Address of index block */
-
- /* Index block statistics */
- if(H5F_addr_defined(hdr->idx_blk_addr)) {
- H5EA_iblock_t iblock; /* Fake index block for computing size */
-
- /* Set index block count for file */
- hdr->stats.computed.nindex_blks = 1;
-
- /* Set up fake index block for computing size on disk */
- iblock.hdr = hdr;
- iblock.nsblks = H5EA_SBLK_FIRST_IDX(hdr->cparam.sup_blk_min_data_ptrs);
- iblock.ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1);
- iblock.nsblk_addrs = hdr->nsblks - iblock.nsblks;
-
- /* Compute size of index block in file */
- hdr->stats.computed.index_blk_size = H5EA_IBLOCK_SIZE(&iblock);
- } /* end if */
- else {
- hdr->stats.computed.nindex_blks = 0; /* Number of index blocks in file */
- hdr->stats.computed.index_blk_size = 0; /* Size of index blocks in file */
- } /* end else */
-
- /* Sanity check */
- /* (allow for checksum not decoded yet) */
- HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM));
-
- /* checksum verification already done in verify_chksum cb */
-
- /* Metadata checksum */
- UINT32DECODE(image, stored_chksum);
-
- /* Sanity check */
- HDassert((size_t)(image - (const uint8_t *)_image) == len);
-
- /* Finish initializing extensible array header */
- if(H5EA__hdr_init(hdr, udata->ctx_udata) < 0)
- H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header")
- HDassert(hdr->size == len);
-
- /* Set return value */
- ret_value = hdr;
+BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
+ H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata,
+ hbool_t H5_ATTR_UNUSED *dirty))
+
+/* Local variables */
+H5EA_cls_id_t id; /* ID of extensible array class, as found in file */
+H5EA_hdr_t * hdr = NULL; /* Extensible array info */
+H5EA_hdr_cache_ud_t *udata = (H5EA_hdr_cache_ud_t *)_udata;
+const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+uint32_t stored_chksum; /* Stored metadata checksum value */
+
+/* Check arguments */
+HDassert(image);
+HDassert(udata);
+HDassert(udata->f);
+HDassert(H5F_addr_defined(udata->addr));
+
+/* Allocate space for the extensible array data structure */
+if (NULL == (hdr = H5EA__hdr_alloc(udata->f)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header")
+
+/* Set the extensible array header's address */
+hdr->addr = udata->addr;
+
+/* Magic number */
+if (HDmemcmp(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ H5E_THROW(H5E_BADVALUE, "wrong extensible array header signature")
+image += H5_SIZEOF_MAGIC;
+
+/* Version */
+if (*image++ != H5EA_HDR_VERSION)
+ H5E_THROW(H5E_VERSION, "wrong extensible array header version")
+
+/* Extensible array class */
+id = (H5EA_cls_id_t)*image++;
+if (id >= H5EA_NUM_CLS_ID)
+ H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
+hdr->cparam.cls = H5EA_client_class_g[id];
+
+/* General array creation/configuration information */
+hdr->cparam.raw_elmt_size = *image++; /* Element size in file (in bytes) */
+hdr->cparam.max_nelmts_bits =
+ *image++; /* Log2(Max. # of elements in array) - i.e. # of bits needed to store max. # of elements */
+hdr->cparam.idx_blk_elmts = *image++; /* # of elements to store in index block */
+hdr->cparam.data_blk_min_elmts = *image++; /* Min. # of elements per data block */
+hdr->cparam.sup_blk_min_data_ptrs = *image++; /* Min. # of data block pointers for a super block */
+hdr->cparam.max_dblk_page_nelmts_bits =
+ *image++; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of
+ elements in data block page */
+
+/* Array statistics */
+hdr->stats.computed.hdr_size = len; /* Size of header in file */
+H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.nsuper_blks); /* Number of super blocks created */
+H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.super_blk_size); /* Size of super blocks created */
+H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.ndata_blks); /* Number of data blocks created */
+H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.data_blk_size); /* Size of data blocks created */
+H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.max_idx_set); /* Max. index set (+1) */
+H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.nelmts); /* Number of elements 'realized' */
+
+/* Internal information */
+H5F_addr_decode(udata->f, &image, &hdr->idx_blk_addr); /* Address of index block */
+
+/* Index block statistics */
+if (H5F_addr_defined(hdr->idx_blk_addr)) {
+ H5EA_iblock_t iblock; /* Fake index block for computing size */
+
+ /* Set index block count for file */
+ hdr->stats.computed.nindex_blks = 1;
+
+ /* Set up fake index block for computing size on disk */
+ iblock.hdr = hdr;
+ iblock.nsblks = H5EA_SBLK_FIRST_IDX(hdr->cparam.sup_blk_min_data_ptrs);
+ iblock.ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1);
+ iblock.nsblk_addrs = hdr->nsblks - iblock.nsblks;
+
+ /* Compute size of index block in file */
+ hdr->stats.computed.index_blk_size = H5EA_IBLOCK_SIZE(&iblock);
+} /* end if */
+else {
+ hdr->stats.computed.nindex_blks = 0; /* Number of index blocks in file */
+ hdr->stats.computed.index_blk_size = 0; /* Size of index blocks in file */
+} /* end else */
+
+/* Sanity check */
+/* (allow for checksum not decoded yet) */
+HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM));
+
+/* checksum verification already done in verify_chksum cb */
+
+/* Metadata checksum */
+UINT32DECODE(image, stored_chksum);
+
+/* Sanity check */
+HDassert((size_t)(image - (const uint8_t *)_image) == len);
+
+/* Finish initializing extensible array header */
+if (H5EA__hdr_init(hdr, udata->ctx_udata) < 0)
+ H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header")
+HDassert(hdr->size == len);
+
+/* Set return value */
+ret_value = hdr;
CATCH
- /* Release resources */
- if(!ret_value)
- if(hdr && H5EA__hdr_dest(hdr) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header")
+/* Release resources */
+if (!ret_value)
+ if (hdr && H5EA__hdr_dest(hdr) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header")
-END_FUNC(STATIC) /* end H5EA__cache_hdr_deserialize() */
+END_FUNC(STATIC) /* end H5EA__cache_hdr_deserialize() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_image_len
*
@@ -431,23 +406,21 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-herr_t, SUCCEED, -,
-H5EA__cache_hdr_image_len(const void *_thing, size_t *image_len))
+BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
+ H5EA__cache_hdr_image_len(const void *_thing, size_t *image_len))
- /* Local variables */
- const H5EA_hdr_t *hdr = (const H5EA_hdr_t *)_thing; /* Pointer to the object */
+/* Local variables */
+const H5EA_hdr_t *hdr = (const H5EA_hdr_t *)_thing; /* Pointer to the object */
- /* Check arguments */
- HDassert(hdr);
- HDassert(image_len);
+/* Check arguments */
+HDassert(hdr);
+HDassert(image_len);
- /* Set the image length size */
- *image_len = hdr->size;
+/* Set the image length size */
+*image_len = hdr->size;
-END_FUNC(STATIC) /* end H5EA__cache_hdr_image_len() */
+END_FUNC(STATIC) /* end H5EA__cache_hdr_image_len() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_serialize
*
@@ -460,63 +433,63 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-herr_t, SUCCEED, -,
-H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing))
-
- /* Local variables */
- H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the extensible array header */
- uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t metadata_chksum; /* Computed metadata checksum value */
-
- /* check arguments */
- HDassert(f);
- HDassert(image);
- HDassert(hdr);
-
- /* Magic number */
- H5MM_memcpy(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
- image += H5_SIZEOF_MAGIC;
-
- /* Version # */
- *image++ = H5EA_HDR_VERSION;
-
- /* Extensible array type */
- HDassert(hdr->cparam.cls->id <= 255);
- *image++ = (uint8_t)hdr->cparam.cls->id;
-
- /* General array creation/configuration information */
- *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */
- *image++ = hdr->cparam.max_nelmts_bits; /* Log2(Max. # of elements in array) - i.e. # of bits needed to store max. # of elements */
- *image++ = hdr->cparam.idx_blk_elmts; /* # of elements to store in index block */
- *image++ = hdr->cparam.data_blk_min_elmts; /* Min. # of elements per data block */
- *image++ = hdr->cparam.sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */
- *image++ = hdr->cparam.max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */
-
- /* Array statistics */
- H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.nsuper_blks); /* Number of super blocks created */
- H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.super_blk_size); /* Size of super blocks created */
- H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.ndata_blks); /* Number of data blocks created */
- H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.data_blk_size); /* Size of data blocks created */
- H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.max_idx_set); /* Max. index set (+1) */
- H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.nelmts); /* Number of elements 'realized' */
-
- /* Internal information */
- H5F_addr_encode(f, &image, hdr->idx_blk_addr); /* Address of index block */
-
- /* Compute metadata checksum */
- metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0);
-
- /* Metadata checksum */
- UINT32ENCODE(image, metadata_chksum);
-
- /* Sanity check */
- HDassert((size_t)(image - (uint8_t *)_image) == len);
-
-END_FUNC(STATIC) /* end H5EA__cache_hdr_serialize() */
-
-
+BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
+ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing))
+
+/* Local variables */
+H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the extensible array header */
+uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
+uint32_t metadata_chksum; /* Computed metadata checksum value */
+
+/* check arguments */
+HDassert(f);
+HDassert(image);
+HDassert(hdr);
+
+/* Magic number */
+H5MM_memcpy(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+image += H5_SIZEOF_MAGIC;
+
+/* Version # */
+*image++ = H5EA_HDR_VERSION;
+
+/* Extensible array type */
+HDassert(hdr->cparam.cls->id <= 255);
+*image++ = (uint8_t)hdr->cparam.cls->id;
+
+/* General array creation/configuration information */
+*image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */
+*image++ = hdr->cparam.max_nelmts_bits; /* Log2(Max. # of elements in array) - i.e. # of bits needed to store
+ max. # of elements */
+*image++ = hdr->cparam.idx_blk_elmts; /* # of elements to store in index block */
+*image++ = hdr->cparam.data_blk_min_elmts; /* Min. # of elements per data block */
+*image++ = hdr->cparam.sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */
+*image++ =
+ hdr->cparam.max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in data block page) - i.e. # of bits
+ needed to store max. # of elements in data block page */
+
+/* Array statistics */
+H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.nsuper_blks); /* Number of super blocks created */
+H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.super_blk_size); /* Size of super blocks created */
+H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.ndata_blks); /* Number of data blocks created */
+H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.data_blk_size); /* Size of data blocks created */
+H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.max_idx_set); /* Max. index set (+1) */
+H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.nelmts); /* Number of elements 'realized' */
+
+/* Internal information */
+H5F_addr_encode(f, &image, hdr->idx_blk_addr); /* Address of index block */
+
+/* Compute metadata checksum */
+metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0);
+
+/* Metadata checksum */
+UINT32ENCODE(image, metadata_chksum);
+
+/* Sanity check */
+HDassert((size_t)(image - (uint8_t *)_image) == len);
+
+END_FUNC(STATIC) /* end H5EA__cache_hdr_serialize() */
+
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_notify
*
@@ -529,70 +502,72 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing))
-
- /* Local variables */
- H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the object */
-
- /* Sanity check */
- HDassert(hdr);
-
- /* Check if the file was opened with SWMR-write access */
- if(hdr->swmr_write) {
- /* Determine which action to take */
- switch(action) {
- case H5AC_NOTIFY_ACTION_AFTER_INSERT:
- case H5AC_NOTIFY_ACTION_AFTER_LOAD:
- case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
- case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
- case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
- case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
- case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
- case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED:
- case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED:
- /* do nothing */
- break;
-
- case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
- /* If hdr->parent != NULL, hdr->parent is used to destroy
- * the flush dependency before the header is evicted.
- */
- if(hdr->parent) {
- /* Sanity check */
- HDassert(hdr->top_proxy);
-
- /* Destroy flush dependency on object header proxy */
- if(H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent, (void *)hdr->top_proxy) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between extensible array and proxy")
- hdr->parent = NULL;
- } /* end if */
-
- /* Detach from 'top' proxy for extensible array */
- if(hdr->top_proxy) {
- if(H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between header and extensible array 'top' proxy")
- /* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */
- } /* end if */
- break;
-
- default:
+BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing))
+
+/* Local variables */
+H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the object */
+
+/* Sanity check */
+HDassert(hdr);
+
+/* Check if the file was opened with SWMR-write access */
+if (hdr->swmr_write) {
+ /* Determine which action to take */
+ switch (action) {
+ case H5AC_NOTIFY_ACTION_AFTER_INSERT:
+ case H5AC_NOTIFY_ACTION_AFTER_LOAD:
+ case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
+ case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
+ case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
+ case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
+ case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
+ case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED:
+ case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED:
+ /* do nothing */
+ break;
+
+ case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
+ /* If hdr->parent != NULL, hdr->parent is used to destroy
+ * the flush dependency before the header is evicted.
+ */
+ if (hdr->parent) {
+ /* Sanity check */
+ HDassert(hdr->top_proxy);
+
+ /* Destroy flush dependency on object header proxy */
+ if (H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent, (void *)hdr->top_proxy) <
+ 0)
+ H5E_THROW(H5E_CANTUNDEPEND,
+ "unable to destroy flush dependency between extensible array and proxy")
+ hdr->parent = NULL;
+ } /* end if */
+
+ /* Detach from 'top' proxy for extensible array */
+ if (hdr->top_proxy) {
+ if (H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0)
+ H5E_THROW(
+ H5E_CANTUNDEPEND,
+ "unable to destroy flush dependency between header and extensible array 'top' proxy")
+ /* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */
+ } /* end if */
+ break;
+
+ default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
-#else /* NDEBUG */
- HDassert(0 && "Unknown action?!?");
+ H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+#else /* NDEBUG */
+ HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
- } /* end switch */
- } /* end if */
- else
- HDassert(NULL == hdr->parent);
+ } /* end switch */
+} /* end if */
+else
+ HDassert(NULL == hdr->parent);
CATCH
-END_FUNC(STATIC) /* end H5EA__cache_hdr_notify() */
+END_FUNC(STATIC) /* end H5EA__cache_hdr_notify() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_free_icr
*
@@ -606,22 +581,19 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__cache_hdr_free_icr(void *thing))
+BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_hdr_free_icr(void *thing))
- /* Check arguments */
- HDassert(thing);
+/* Check arguments */
+HDassert(thing);
- /* Release the extensible array header */
- if(H5EA__hdr_dest((H5EA_hdr_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free extensible array header")
+/* Release the extensible array header */
+if (H5EA__hdr_dest((H5EA_hdr_t *)thing) < 0)
+ H5E_THROW(H5E_CANTFREE, "can't free extensible array header")
CATCH
-END_FUNC(STATIC) /* end H5EA__cache_hdr_free_icr() */
+END_FUNC(STATIC) /* end H5EA__cache_hdr_free_icr() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_get_initial_load_size
*
@@ -634,31 +606,29 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_free_icr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-herr_t, SUCCEED, -,
-H5EA__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len))
+BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
+ H5EA__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len))
- /* Local variables */
- H5EA_hdr_t *hdr = (H5EA_hdr_t *)_udata; /* User data for callback */
- H5EA_iblock_t iblock; /* Fake index block for computing size */
+/* Local variables */
+H5EA_hdr_t * hdr = (H5EA_hdr_t *)_udata; /* User data for callback */
+H5EA_iblock_t iblock; /* Fake index block for computing size */
- /* Check arguments */
- HDassert(hdr);
- HDassert(image_len);
+/* Check arguments */
+HDassert(hdr);
+HDassert(image_len);
- /* Set up fake index block for computing size on disk */
- HDmemset(&iblock, 0, sizeof(iblock));
- iblock.hdr = (H5EA_hdr_t *)hdr; /* Casting away 'const' OK - QAK */
- iblock.nsblks = H5EA_SBLK_FIRST_IDX(hdr->cparam.sup_blk_min_data_ptrs);
- iblock.ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1);
- iblock.nsblk_addrs = hdr->nsblks - iblock.nsblks;
+/* Set up fake index block for computing size on disk */
+HDmemset(&iblock, 0, sizeof(iblock));
+iblock.hdr = (H5EA_hdr_t *)hdr; /* Casting away 'const' OK - QAK */
+iblock.nsblks = H5EA_SBLK_FIRST_IDX(hdr->cparam.sup_blk_min_data_ptrs);
+iblock.ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1);
+iblock.nsblk_addrs = hdr->nsblks - iblock.nsblks;
- /* Set the image length size */
- *image_len = (size_t)H5EA_IBLOCK_SIZE(&iblock);
+/* Set the image length size */
+*image_len = (size_t)H5EA_IBLOCK_SIZE(&iblock);
-END_FUNC(STATIC) /* end H5EA__cache_iblock_get_initial_load_size() */
+END_FUNC(STATIC) /* end H5EA__cache_iblock_get_initial_load_size() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_verify_chksum
*
@@ -672,27 +642,25 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-htri_t, TRUE, -,
-H5EA__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
+BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
+ H5EA__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
- /* Local variables */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t stored_chksum; /* Stored metadata checksum value */
- uint32_t computed_chksum; /* Computed metadata checksum value */
+/* Local variables */
+const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+uint32_t stored_chksum; /* Stored metadata checksum value */
+uint32_t computed_chksum; /* Computed metadata checksum value */
- /* Check arguments */
- HDassert(image);
+/* Check arguments */
+HDassert(image);
- /* Get stored and computed checksums */
- H5F_get_checksums(image, len, &stored_chksum, &computed_chksum);
+/* Get stored and computed checksums */
+H5F_get_checksums(image, len, &stored_chksum, &computed_chksum);
- if(stored_chksum != computed_chksum)
- ret_value = FALSE;
+if (stored_chksum != computed_chksum)
+ ret_value = FALSE;
-END_FUNC(STATIC) /* end H5EA__cache_iblock_verify_chksum() */
+END_FUNC(STATIC) /* end H5EA__cache_iblock_verify_chksum() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_deserialize
*
@@ -706,100 +674,98 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-void *, NULL, NULL,
-H5EA__cache_iblock_deserialize(const void *_image, size_t len,
- void *_udata, hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
- H5EA_iblock_t *iblock = NULL; /* Index block info */
- H5EA_hdr_t *hdr = (H5EA_hdr_t *)_udata; /* User data for callback */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t stored_chksum; /* Stored metadata checksum value */
- haddr_t arr_addr; /* Address of array header in the file */
- size_t u; /* Local index variable */
-
- /* Check arguments */
- HDassert(image);
- HDassert(hdr);
-
- /* Allocate the extensible array index block */
- if(NULL == (iblock = H5EA__iblock_alloc(hdr)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block")
-
- /* Set the extensible array index block's address */
- iblock->addr = hdr->idx_blk_addr;
-
- /* Magic number */
- if(HDmemcmp(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array index block signature")
- image += H5_SIZEOF_MAGIC;
-
- /* Version */
- if(*image++ != H5EA_IBLOCK_VERSION)
- H5E_THROW(H5E_VERSION, "wrong extensible array index block version")
-
- /* Extensible array type */
- if(*image++ != (uint8_t)hdr->cparam.cls->id)
- H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
-
- /* Address of header for array that owns this block (just for file integrity checks) */
- H5F_addr_decode(hdr->f, &image, &arr_addr);
- if(H5F_addr_ne(arr_addr, hdr->addr))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array header address")
-
- /* Internal information */
-
- /* Decode elements in index block */
- if(hdr->cparam.idx_blk_elmts > 0) {
- /* Convert from raw elements on disk into native elements in memory */
- if((hdr->cparam.cls->decode)(image, iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts, hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTDECODE, "can't decode extensible array index elements")
- image += (hdr->cparam.idx_blk_elmts * hdr->cparam.raw_elmt_size);
- } /* end if */
-
- /* Decode data block addresses in index block */
- if(iblock->ndblk_addrs > 0) {
- /* Decode addresses of data blocks in index block */
- for(u = 0; u < iblock->ndblk_addrs; u++)
- H5F_addr_decode(hdr->f, &image, &iblock->dblk_addrs[u]);
- } /* end if */
-
- /* Decode super block addresses in index block */
- if(iblock->nsblk_addrs > 0) {
- /* Decode addresses of super blocks in index block */
- for(u = 0; u < iblock->nsblk_addrs; u++)
- H5F_addr_decode(hdr->f, &image, &iblock->sblk_addrs[u]);
- } /* end if */
-
- /* Sanity check */
- /* (allow for checksum not decoded yet) */
- HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM));
-
- /* Save the index block's size */
- iblock->size = len;
-
- /* checksum verification already done in verify_chksum cb */
-
- /* Metadata checksum */
- UINT32DECODE(image, stored_chksum);
-
- /* Sanity check */
- HDassert((size_t)(image - (const uint8_t *)_image) == iblock->size);
-
- /* Set return value */
- ret_value = iblock;
+BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
+ H5EA__cache_iblock_deserialize(const void *_image, size_t len, void *_udata,
+ hbool_t H5_ATTR_UNUSED *dirty))
+
+/* Local variables */
+H5EA_iblock_t *iblock = NULL; /* Index block info */
+H5EA_hdr_t * hdr = (H5EA_hdr_t *)_udata; /* User data for callback */
+const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+uint32_t stored_chksum; /* Stored metadata checksum value */
+haddr_t arr_addr; /* Address of array header in the file */
+size_t u; /* Local index variable */
+
+/* Check arguments */
+HDassert(image);
+HDassert(hdr);
+
+/* Allocate the extensible array index block */
+if (NULL == (iblock = H5EA__iblock_alloc(hdr)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block")
+
+/* Set the extensible array index block's address */
+iblock->addr = hdr->idx_blk_addr;
+
+/* Magic number */
+if (HDmemcmp(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ H5E_THROW(H5E_BADVALUE, "wrong extensible array index block signature")
+image += H5_SIZEOF_MAGIC;
+
+/* Version */
+if (*image++ != H5EA_IBLOCK_VERSION)
+ H5E_THROW(H5E_VERSION, "wrong extensible array index block version")
+
+/* Extensible array type */
+if (*image++ != (uint8_t)hdr->cparam.cls->id)
+ H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
+
+/* Address of header for array that owns this block (just for file integrity checks) */
+H5F_addr_decode(hdr->f, &image, &arr_addr);
+if (H5F_addr_ne(arr_addr, hdr->addr))
+ H5E_THROW(H5E_BADVALUE, "wrong extensible array header address")
+
+/* Internal information */
+
+/* Decode elements in index block */
+if (hdr->cparam.idx_blk_elmts > 0) {
+ /* Convert from raw elements on disk into native elements in memory */
+ if ((hdr->cparam.cls->decode)(image, iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts, hdr->cb_ctx) < 0)
+ H5E_THROW(H5E_CANTDECODE, "can't decode extensible array index elements")
+ image += (hdr->cparam.idx_blk_elmts * hdr->cparam.raw_elmt_size);
+} /* end if */
+
+/* Decode data block addresses in index block */
+if (iblock->ndblk_addrs > 0) {
+ /* Decode addresses of data blocks in index block */
+ for (u = 0; u < iblock->ndblk_addrs; u++)
+ H5F_addr_decode(hdr->f, &image, &iblock->dblk_addrs[u]);
+} /* end if */
+
+/* Decode super block addresses in index block */
+if (iblock->nsblk_addrs > 0) {
+ /* Decode addresses of super blocks in index block */
+ for (u = 0; u < iblock->nsblk_addrs; u++)
+ H5F_addr_decode(hdr->f, &image, &iblock->sblk_addrs[u]);
+} /* end if */
+
+/* Sanity check */
+/* (allow for checksum not decoded yet) */
+HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM));
+
+/* Save the index block's size */
+iblock->size = len;
+
+/* checksum verification already done in verify_chksum cb */
+
+/* Metadata checksum */
+UINT32DECODE(image, stored_chksum);
+
+/* Sanity check */
+HDassert((size_t)(image - (const uint8_t *)_image) == iblock->size);
+
+/* Set return value */
+ret_value = iblock;
CATCH
- /* Release resources */
- if(!ret_value)
- if(iblock && H5EA__iblock_dest(iblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block")
+/* Release resources */
+if (!ret_value)
+ if (iblock && H5EA__iblock_dest(iblock) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block")
-END_FUNC(STATIC) /* end H5EA__cache_iblock_deserialize() */
+END_FUNC(STATIC) /* end H5EA__cache_iblock_deserialize() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_image_len
*
@@ -812,23 +778,21 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-herr_t, SUCCEED, -,
-H5EA__cache_iblock_image_len(const void *_thing, size_t *image_len))
+BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
+ H5EA__cache_iblock_image_len(const void *_thing, size_t *image_len))
- /* Local variables */
- const H5EA_iblock_t *iblock = (const H5EA_iblock_t *)_thing; /* Pointer to the object */
+/* Local variables */
+const H5EA_iblock_t *iblock = (const H5EA_iblock_t *)_thing; /* Pointer to the object */
- /* Check arguments */
- HDassert(iblock);
- HDassert(image_len);
+/* Check arguments */
+HDassert(iblock);
+HDassert(image_len);
- /* Set the image length size */
- *image_len = iblock->size;
+/* Set the image length size */
+*image_len = iblock->size;
-END_FUNC(STATIC) /* end H5EA__cache_iblock_image_len() */
+END_FUNC(STATIC) /* end H5EA__cache_iblock_image_len() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_serialize
*
@@ -841,80 +805,79 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing))
+BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
+ void *_thing))
- /* Local variables */
- H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object to serialize */
- uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t metadata_chksum; /* Computed metadata checksum value */
+/* Local variables */
+H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object to serialize */
+uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
+uint32_t metadata_chksum; /* Computed metadata checksum value */
- /* check arguments */
- HDassert(f);
- HDassert(image);
- HDassert(iblock);
- HDassert(iblock->hdr);
+/* check arguments */
+HDassert(f);
+HDassert(image);
+HDassert(iblock);
+HDassert(iblock->hdr);
- /* Get temporary pointer to serialized info */
+/* Get temporary pointer to serialized info */
- /* Magic number */
- H5MM_memcpy(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
- image += H5_SIZEOF_MAGIC;
+/* Magic number */
+H5MM_memcpy(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+image += H5_SIZEOF_MAGIC;
- /* Version # */
- *image++ = H5EA_IBLOCK_VERSION;
+/* Version # */
+*image++ = H5EA_IBLOCK_VERSION;
- /* Extensible array type */
- HDassert(iblock->hdr->cparam.cls->id <= 255);
- *image++ = (uint8_t)iblock->hdr->cparam.cls->id;
+/* Extensible array type */
+HDassert(iblock->hdr->cparam.cls->id <= 255);
+*image++ = (uint8_t)iblock->hdr->cparam.cls->id;
- /* Address of array header for array which owns this block */
- H5F_addr_encode(f, &image, iblock->hdr->addr);
+/* Address of array header for array which owns this block */
+H5F_addr_encode(f, &image, iblock->hdr->addr);
- /* Internal information */
+/* Internal information */
- /* Encode elements in index block */
- if(iblock->hdr->cparam.idx_blk_elmts > 0) {
- /* Convert from native elements in memory into raw elements on disk */
- if((iblock->hdr->cparam.cls->encode)(image, iblock->elmts, (size_t)iblock->hdr->cparam.idx_blk_elmts, iblock->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTENCODE, "can't encode extensible array index elements")
- image += (iblock->hdr->cparam.idx_blk_elmts * iblock->hdr->cparam.raw_elmt_size);
- } /* end if */
+/* Encode elements in index block */
+if (iblock->hdr->cparam.idx_blk_elmts > 0) {
+ /* Convert from native elements in memory into raw elements on disk */
+ if ((iblock->hdr->cparam.cls->encode)(image, iblock->elmts, (size_t)iblock->hdr->cparam.idx_blk_elmts,
+ iblock->hdr->cb_ctx) < 0)
+ H5E_THROW(H5E_CANTENCODE, "can't encode extensible array index elements")
+ image += (iblock->hdr->cparam.idx_blk_elmts * iblock->hdr->cparam.raw_elmt_size);
+} /* end if */
- /* Encode data block addresses in index block */
- if(iblock->ndblk_addrs > 0) {
- size_t u; /* Local index variable */
+/* Encode data block addresses in index block */
+if (iblock->ndblk_addrs > 0) {
+ size_t u; /* Local index variable */
- /* Encode addresses of data blocks in index block */
- for(u = 0; u < iblock->ndblk_addrs; u++)
- H5F_addr_encode(f, &image, iblock->dblk_addrs[u]);
- } /* end if */
+ /* Encode addresses of data blocks in index block */
+ for (u = 0; u < iblock->ndblk_addrs; u++)
+ H5F_addr_encode(f, &image, iblock->dblk_addrs[u]);
+} /* end if */
- /* Encode data block addresses in index block */
- if(iblock->nsblk_addrs > 0) {
- size_t u; /* Local index variable */
+/* Encode data block addresses in index block */
+if (iblock->nsblk_addrs > 0) {
+ size_t u; /* Local index variable */
- /* Encode addresses of super blocks in index block */
- for(u = 0; u < iblock->nsblk_addrs; u++)
- H5F_addr_encode(f, &image, iblock->sblk_addrs[u]);
- } /* end if */
+ /* Encode addresses of super blocks in index block */
+ for (u = 0; u < iblock->nsblk_addrs; u++)
+ H5F_addr_encode(f, &image, iblock->sblk_addrs[u]);
+} /* end if */
- /* Compute metadata checksum */
- metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0);
+/* Compute metadata checksum */
+metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0);
- /* Metadata checksum */
- UINT32ENCODE(image, metadata_chksum);
+/* Metadata checksum */
+UINT32ENCODE(image, metadata_chksum);
- /* Sanity check */
- HDassert((size_t)(image - (uint8_t *)_image) == len);
+/* Sanity check */
+HDassert((size_t)(image - (uint8_t *)_image) == len);
CATCH
-END_FUNC(STATIC) /* end H5EA__cache_iblock_serialize() */
+END_FUNC(STATIC) /* end H5EA__cache_iblock_serialize() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_notify
*
@@ -927,61 +890,65 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing))
-
- /* Local variables */
- H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object */
-
- /* Sanity check */
- HDassert(iblock);
-
- /* Determine which action to take */
- switch(action) {
- case H5AC_NOTIFY_ACTION_AFTER_INSERT:
- case H5AC_NOTIFY_ACTION_AFTER_LOAD:
- /* Create flush dependency on extensible array header */
- if(H5EA__create_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0)
- H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between index block and header, address = %llu", (unsigned long long)iblock->addr)
- break;
-
- case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
- case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
- case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
- case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
- case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
- case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED:
- case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED:
- /* do nothing */
- break;
-
- case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
- /* Destroy flush dependency on extensible array header */
- if(H5EA__destroy_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between index block and header, address = %llu", (unsigned long long)iblock->addr)
-
- /* Detach from 'top' proxy for extensible array */
- if(iblock->top_proxy) {
- if(H5AC_proxy_entry_remove_child(iblock->top_proxy, iblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between index block and extensible array 'top' proxy")
- iblock->top_proxy = NULL;
- } /* end if */
- break;
-
- default:
+BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing))
+
+/* Local variables */
+H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object */
+
+/* Sanity check */
+HDassert(iblock);
+
+/* Determine which action to take */
+switch (action) {
+ case H5AC_NOTIFY_ACTION_AFTER_INSERT:
+ case H5AC_NOTIFY_ACTION_AFTER_LOAD:
+ /* Create flush dependency on extensible array header */
+ if (H5EA__create_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0)
+ H5E_THROW(H5E_CANTDEPEND,
+ "unable to create flush dependency between index block and header, address = %llu",
+ (unsigned long long)iblock->addr)
+ break;
+
+ case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
+ case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
+ case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
+ case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
+ case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
+ case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED:
+ case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED:
+ /* do nothing */
+ break;
+
+ case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
+ /* Destroy flush dependency on extensible array header */
+ if (H5EA__destroy_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0)
+ H5E_THROW(H5E_CANTUNDEPEND,
+ "unable to destroy flush dependency between index block and header, address = %llu",
+ (unsigned long long)iblock->addr)
+
+ /* Detach from 'top' proxy for extensible array */
+ if (iblock->top_proxy) {
+ if (H5AC_proxy_entry_remove_child(iblock->top_proxy, iblock) < 0)
+ H5E_THROW(
+ H5E_CANTUNDEPEND,
+ "unable to destroy flush dependency between index block and extensible array 'top' proxy")
+ iblock->top_proxy = NULL;
+ } /* end if */
+ break;
+
+ default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
-#else /* NDEBUG */
- HDassert(0 && "Unknown action?!?");
+ H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+#else /* NDEBUG */
+ HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
- } /* end switch */
+} /* end switch */
CATCH
-END_FUNC(STATIC) /* end H5EA__cache_iblock_notify() */
+END_FUNC(STATIC) /* end H5EA__cache_iblock_notify() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_free_icr
*
@@ -995,22 +962,19 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__cache_iblock_free_icr(void *thing))
+BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_iblock_free_icr(void *thing))
- /* Check arguments */
- HDassert(thing);
+/* Check arguments */
+HDassert(thing);
- /* Release the extensible array index block */
- if(H5EA__iblock_dest((H5EA_iblock_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free extensible array index block")
+/* Release the extensible array index block */
+if (H5EA__iblock_dest((H5EA_iblock_t *)thing) < 0)
+ H5E_THROW(H5E_CANTFREE, "can't free extensible array index block")
CATCH
-END_FUNC(STATIC) /* end H5EA__cache_iblock_free_icr() */
+END_FUNC(STATIC) /* end H5EA__cache_iblock_free_icr() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_get_initial_load_size
*
@@ -1023,50 +987,48 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_free_icr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-herr_t, SUCCEED, -,
-H5EA__cache_sblock_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
- H5EA_sblock_cache_ud_t *udata = (H5EA_sblock_cache_ud_t *)_udata; /* User data */
- H5EA_sblock_t sblock; /* Fake super block for computing size */
-
- /* Check arguments */
- HDassert(udata);
- HDassert(udata->hdr);
- HDassert(udata->sblk_idx > 0);
- HDassert(H5F_addr_defined(udata->sblk_addr));
- HDassert(image_len);
-
- /* Set up fake super block for computing size on disk */
- /* (Note: extracted from H5EA__sblock_alloc) */
- HDmemset(&sblock, 0, sizeof(sblock));
- sblock.hdr = udata->hdr;
- sblock.ndblks = udata->hdr->sblk_info[udata->sblk_idx].ndblks;
- sblock.dblk_nelmts = udata->hdr->sblk_info[udata->sblk_idx].dblk_nelmts;
-
- /* Check if # of elements in data blocks requires paging */
- if(sblock.dblk_nelmts > udata->hdr->dblk_page_nelmts) {
- /* Compute # of pages in each data block from this super block */
- sblock.dblk_npages = sblock.dblk_nelmts / udata->hdr->dblk_page_nelmts;
-
- /* Sanity check that we have at least 2 pages in data block */
- HDassert(sblock.dblk_npages > 1);
-
- /* Sanity check for integer truncation */
- HDassert((sblock.dblk_npages * udata->hdr->dblk_page_nelmts) == sblock.dblk_nelmts);
-
- /* Compute size of buffer for each data block's 'page init' bitmask */
- sblock.dblk_page_init_size = ((sblock.dblk_npages) + 7) / 8;
- HDassert(sblock.dblk_page_init_size > 0);
- } /* end if */
-
- /* Set the image length size */
- *image_len = (size_t)H5EA_SBLOCK_SIZE(&sblock);
-
-END_FUNC(STATIC) /* end H5EA__cache_sblock_get_initial_load_size() */
-
-
+BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
+ H5EA__cache_sblock_get_initial_load_size(void *_udata, size_t *image_len))
+
+/* Local variables */
+H5EA_sblock_cache_ud_t *udata = (H5EA_sblock_cache_ud_t *)_udata; /* User data */
+H5EA_sblock_t sblock; /* Fake super block for computing size */
+
+/* Check arguments */
+HDassert(udata);
+HDassert(udata->hdr);
+HDassert(udata->sblk_idx > 0);
+HDassert(H5F_addr_defined(udata->sblk_addr));
+HDassert(image_len);
+
+/* Set up fake super block for computing size on disk */
+/* (Note: extracted from H5EA__sblock_alloc) */
+HDmemset(&sblock, 0, sizeof(sblock));
+sblock.hdr = udata->hdr;
+sblock.ndblks = udata->hdr->sblk_info[udata->sblk_idx].ndblks;
+sblock.dblk_nelmts = udata->hdr->sblk_info[udata->sblk_idx].dblk_nelmts;
+
+/* Check if # of elements in data blocks requires paging */
+if (sblock.dblk_nelmts > udata->hdr->dblk_page_nelmts) {
+ /* Compute # of pages in each data block from this super block */
+ sblock.dblk_npages = sblock.dblk_nelmts / udata->hdr->dblk_page_nelmts;
+
+ /* Sanity check that we have at least 2 pages in data block */
+ HDassert(sblock.dblk_npages > 1);
+
+ /* Sanity check for integer truncation */
+ HDassert((sblock.dblk_npages * udata->hdr->dblk_page_nelmts) == sblock.dblk_nelmts);
+
+ /* Compute size of buffer for each data block's 'page init' bitmask */
+ sblock.dblk_page_init_size = ((sblock.dblk_npages) + 7) / 8;
+ HDassert(sblock.dblk_page_init_size > 0);
+} /* end if */
+
+/* Set the image length size */
+*image_len = (size_t)H5EA_SBLOCK_SIZE(&sblock);
+
+END_FUNC(STATIC) /* end H5EA__cache_sblock_get_initial_load_size() */
+
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_verify_chksum
*
@@ -1080,27 +1042,25 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-htri_t, TRUE, -,
-H5EA__cache_sblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
+BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
+ H5EA__cache_sblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
- /* Local variables */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t stored_chksum; /* Stored metadata checksum value */
- uint32_t computed_chksum; /* Computed metadata checksum value */
+/* Local variables */
+const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+uint32_t stored_chksum; /* Stored metadata checksum value */
+uint32_t computed_chksum; /* Computed metadata checksum value */
- /* Check arguments */
- HDassert(image);
+/* Check arguments */
+HDassert(image);
- /* Get stored and computed checksums */
- H5F_get_checksums(image, len, &stored_chksum, &computed_chksum);
+/* Get stored and computed checksums */
+H5F_get_checksums(image, len, &stored_chksum, &computed_chksum);
- if(stored_chksum != computed_chksum)
- ret_value = FALSE;
+if (stored_chksum != computed_chksum)
+ ret_value = FALSE;
-END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
+END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_deserialize
*
@@ -1114,97 +1074,96 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-void *, NULL, NULL,
-H5EA__cache_sblock_deserialize(const void *_image, size_t len,
- void *_udata, hbool_t H5_ATTR_UNUSED *dirty))
+BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
+ H5EA__cache_sblock_deserialize(const void *_image, size_t len, void *_udata,
+ hbool_t H5_ATTR_UNUSED *dirty))
- /* Local variables */
- H5EA_sblock_t *sblock = NULL; /* Super block info */
- H5EA_sblock_cache_ud_t *udata = (H5EA_sblock_cache_ud_t *)_udata; /* User data */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t stored_chksum; /* Stored metadata checksum value */
- haddr_t arr_addr; /* Address of array header in the file */
- size_t u; /* Local index variable */
+/* Local variables */
+H5EA_sblock_t * sblock = NULL; /* Super block info */
+H5EA_sblock_cache_ud_t *udata = (H5EA_sblock_cache_ud_t *)_udata; /* User data */
+const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+uint32_t stored_chksum; /* Stored metadata checksum value */
+haddr_t arr_addr; /* Address of array header in the file */
+size_t u; /* Local index variable */
- /* Sanity check */
- HDassert(udata);
- HDassert(udata->hdr);
- HDassert(udata->parent);
- HDassert(udata->sblk_idx > 0);
- HDassert(H5F_addr_defined(udata->sblk_addr));
+/* Sanity check */
+HDassert(udata);
+HDassert(udata->hdr);
+HDassert(udata->parent);
+HDassert(udata->sblk_idx > 0);
+HDassert(H5F_addr_defined(udata->sblk_addr));
- /* Allocate the extensible array super block */
- if(NULL == (sblock = H5EA__sblock_alloc(udata->hdr, udata->parent, udata->sblk_idx)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block")
+/* Allocate the extensible array super block */
+if (NULL == (sblock = H5EA__sblock_alloc(udata->hdr, udata->parent, udata->sblk_idx)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block")
- /* Set the extensible array super block's address */
- sblock->addr = udata->sblk_addr;
+/* Set the extensible array super block's address */
+sblock->addr = udata->sblk_addr;
- /* Magic number */
- if(HDmemcmp(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array super block signature")
- image += H5_SIZEOF_MAGIC;
+/* Magic number */
+if (HDmemcmp(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ H5E_THROW(H5E_BADVALUE, "wrong extensible array super block signature")
+image += H5_SIZEOF_MAGIC;
- /* Version */
- if(*image++ != H5EA_SBLOCK_VERSION)
- H5E_THROW(H5E_VERSION, "wrong extensible array super block version")
+/* Version */
+if (*image++ != H5EA_SBLOCK_VERSION)
+ H5E_THROW(H5E_VERSION, "wrong extensible array super block version")
- /* Extensible array type */
- if(*image++ != (uint8_t)udata->hdr->cparam.cls->id)
- H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
+/* Extensible array type */
+if (*image++ != (uint8_t)udata->hdr->cparam.cls->id)
+ H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
- /* Address of header for array that owns this block (just for file integrity checks) */
- H5F_addr_decode(udata->hdr->f, &image, &arr_addr);
- if(H5F_addr_ne(arr_addr, udata->hdr->addr))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array header address")
+/* Address of header for array that owns this block (just for file integrity checks) */
+H5F_addr_decode(udata->hdr->f, &image, &arr_addr);
+if (H5F_addr_ne(arr_addr, udata->hdr->addr))
+ H5E_THROW(H5E_BADVALUE, "wrong extensible array header address")
- /* Offset of block within the array's address space */
- UINT64DECODE_VAR(image, sblock->block_off, udata->hdr->arr_off_size);
+/* Offset of block within the array's address space */
+UINT64DECODE_VAR(image, sblock->block_off, udata->hdr->arr_off_size);
- /* Internal information */
+/* Internal information */
- /* Check for 'page init' bitmasks for this super block */
- if(sblock->dblk_npages > 0) {
- size_t tot_page_init_size = sblock->ndblks * sblock->dblk_page_init_size; /* Compute total size of 'page init' buffer */
+/* Check for 'page init' bitmasks for this super block */
+if (sblock->dblk_npages > 0) {
+ size_t tot_page_init_size =
+ sblock->ndblks * sblock->dblk_page_init_size; /* Compute total size of 'page init' buffer */
- /* Retrieve the 'page init' bitmasks */
- H5MM_memcpy(sblock->page_init, image, tot_page_init_size);
- image += tot_page_init_size;
- } /* end if */
+ /* Retrieve the 'page init' bitmasks */
+ H5MM_memcpy(sblock->page_init, image, tot_page_init_size);
+ image += tot_page_init_size;
+} /* end if */
- /* Decode data block addresses */
- for(u = 0; u < sblock->ndblks; u++)
- H5F_addr_decode(udata->hdr->f, &image, &sblock->dblk_addrs[u]);
+/* Decode data block addresses */
+for (u = 0; u < sblock->ndblks; u++)
+ H5F_addr_decode(udata->hdr->f, &image, &sblock->dblk_addrs[u]);
- /* Sanity check */
- /* (allow for checksum not decoded yet) */
- HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM));
+/* Sanity check */
+/* (allow for checksum not decoded yet) */
+HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM));
- /* Save the super block's size */
- sblock->size = len;
+/* Save the super block's size */
+sblock->size = len;
- /* checksum verification already done in verify_chksum cb */
+/* checksum verification already done in verify_chksum cb */
- /* Metadata checksum */
- UINT32DECODE(image, stored_chksum);
+/* Metadata checksum */
+UINT32DECODE(image, stored_chksum);
- /* Sanity check */
- HDassert((size_t)(image - (const uint8_t *)_image) == sblock->size);
+/* Sanity check */
+HDassert((size_t)(image - (const uint8_t *)_image) == sblock->size);
- /* Set return value */
- ret_value = sblock;
+/* Set return value */
+ret_value = sblock;
CATCH
- /* Release resources */
- if(!ret_value)
- if(sblock && H5EA__sblock_dest(sblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block")
+/* Release resources */
+if (!ret_value)
+ if (sblock && H5EA__sblock_dest(sblock) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block")
-END_FUNC(STATIC) /* end H5EA__cache_sblock_deserialize() */
+END_FUNC(STATIC) /* end H5EA__cache_sblock_deserialize() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_image_len
*
@@ -1217,23 +1176,21 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-herr_t, SUCCEED, -,
-H5EA__cache_sblock_image_len(const void *_thing, size_t *image_len))
+BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
+ H5EA__cache_sblock_image_len(const void *_thing, size_t *image_len))
- /* Local variables */
- const H5EA_sblock_t *sblock = (const H5EA_sblock_t *)_thing; /* Pointer to the object */
+/* Local variables */
+const H5EA_sblock_t *sblock = (const H5EA_sblock_t *)_thing; /* Pointer to the object */
- /* Check arguments */
- HDassert(sblock);
- HDassert(image_len);
+/* Check arguments */
+HDassert(sblock);
+HDassert(image_len);
- /* Set the image length size */
- *image_len = sblock->size;
+/* Set the image length size */
+*image_len = sblock->size;
-END_FUNC(STATIC) /* end H5EA__cache_sblock_image_len() */
+END_FUNC(STATIC) /* end H5EA__cache_sblock_image_len() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_serialize
*
@@ -1246,67 +1203,66 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-herr_t, SUCCEED, -,
-H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing))
+BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
+ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
+ void *_thing))
- /* Local variables */
- H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object to serialize */
- uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t metadata_chksum; /* Computed metadata checksum value */
- size_t u; /* Local index variable */
+/* Local variables */
+H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object to serialize */
+uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
+uint32_t metadata_chksum; /* Computed metadata checksum value */
+size_t u; /* Local index variable */
- /* check arguments */
- HDassert(f);
- HDassert(image);
- HDassert(sblock);
- HDassert(sblock->hdr);
+/* check arguments */
+HDassert(f);
+HDassert(image);
+HDassert(sblock);
+HDassert(sblock->hdr);
- /* Magic number */
- H5MM_memcpy(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
- image += H5_SIZEOF_MAGIC;
+/* Magic number */
+H5MM_memcpy(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+image += H5_SIZEOF_MAGIC;
- /* Version # */
- *image++ = H5EA_SBLOCK_VERSION;
+/* Version # */
+*image++ = H5EA_SBLOCK_VERSION;
- /* Extensible array type */
- HDassert(sblock->hdr->cparam.cls->id <= 255);
- *image++ = (uint8_t)sblock->hdr->cparam.cls->id;
+/* Extensible array type */
+HDassert(sblock->hdr->cparam.cls->id <= 255);
+*image++ = (uint8_t)sblock->hdr->cparam.cls->id;
- /* Address of array header for array which owns this block */
- H5F_addr_encode(f, &image, sblock->hdr->addr);
+/* Address of array header for array which owns this block */
+H5F_addr_encode(f, &image, sblock->hdr->addr);
- /* Offset of block in array */
- UINT64ENCODE_VAR(image, sblock->block_off, sblock->hdr->arr_off_size);
+/* Offset of block in array */
+UINT64ENCODE_VAR(image, sblock->block_off, sblock->hdr->arr_off_size);
- /* Internal information */
+/* Internal information */
- /* Check for 'page init' bitmasks for this super block */
- if(sblock->dblk_npages > 0) {
- size_t tot_page_init_size = sblock->ndblks * sblock->dblk_page_init_size; /* Compute total size of 'page init' buffer */
+/* Check for 'page init' bitmasks for this super block */
+if (sblock->dblk_npages > 0) {
+ size_t tot_page_init_size =
+ sblock->ndblks * sblock->dblk_page_init_size; /* Compute total size of 'page init' buffer */
- /* Store the 'page init' bitmasks */
- H5MM_memcpy(image, sblock->page_init, tot_page_init_size);
- image += tot_page_init_size;
- } /* end if */
+ /* Store the 'page init' bitmasks */
+ H5MM_memcpy(image, sblock->page_init, tot_page_init_size);
+ image += tot_page_init_size;
+} /* end if */
- /* Encode addresses of data blocks in super block */
- for(u = 0; u < sblock->ndblks; u++)
- H5F_addr_encode(f, &image, sblock->dblk_addrs[u]);
+/* Encode addresses of data blocks in super block */
+for (u = 0; u < sblock->ndblks; u++)
+ H5F_addr_encode(f, &image, sblock->dblk_addrs[u]);
- /* Compute metadata checksum */
- metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0);
+/* Compute metadata checksum */
+metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0);
- /* Metadata checksum */
- UINT32ENCODE(image, metadata_chksum);
+/* Metadata checksum */
+UINT32ENCODE(image, metadata_chksum);
- /* Sanity check */
- HDassert((size_t)(image - (uint8_t *)_image) == len);
+/* Sanity check */
+HDassert((size_t)(image - (uint8_t *)_image) == len);
-END_FUNC(STATIC) /* end H5EA__cache_sblock_serialize() */
+END_FUNC(STATIC) /* end H5EA__cache_sblock_serialize() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_notify
*
@@ -1319,76 +1275,85 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing))
-
- /* Local variables */
- H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object */
-
- /* Sanity check */
- HDassert(sblock);
-
- /* Determine which action to take */
- switch(action) {
- case H5AC_NOTIFY_ACTION_AFTER_INSERT:
- case H5AC_NOTIFY_ACTION_AFTER_LOAD:
- /* Create flush dependency on index block */
- if(H5EA__create_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0)
- H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between super block and index block, address = %llu", (unsigned long long)sblock->addr)
- break;
-
- case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
- /* Destroy flush dependency on extensible array header, if set */
- if(sblock->has_hdr_depend) {
- if(H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between super block and header, address = %llu", (unsigned long long)sblock->addr)
- sblock->has_hdr_depend = FALSE;
- } /* end if */
- break;
-
- case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
- /* Destroy flush dependency on index block */
- if(H5EA__destroy_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between super block and index block, address = %llu", (unsigned long long)sblock->addr)
-
- /* Destroy flush dependency on extensible array header, if set */
- if(sblock->has_hdr_depend) {
- if(H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between super block and header, address = %llu", (unsigned long long)sblock->addr)
- sblock->has_hdr_depend = FALSE;
- } /* end if */
-
- /* Detach from 'top' proxy for extensible array */
- if(sblock->top_proxy) {
- if(H5AC_proxy_entry_remove_child(sblock->top_proxy, sblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between super block and extensible array 'top' proxy")
- sblock->top_proxy = NULL;
- } /* end if */
- break;
-
- case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
- case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
- case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
- case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
- case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED:
- case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED:
- /* do nothing */
- break;
-
- default:
+BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing))
+
+/* Local variables */
+H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object */
+
+/* Sanity check */
+HDassert(sblock);
+
+/* Determine which action to take */
+switch (action) {
+ case H5AC_NOTIFY_ACTION_AFTER_INSERT:
+ case H5AC_NOTIFY_ACTION_AFTER_LOAD:
+ /* Create flush dependency on index block */
+ if (H5EA__create_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0)
+ H5E_THROW(H5E_CANTDEPEND,
+ "unable to create flush dependency between super block and index block, address = %llu",
+ (unsigned long long)sblock->addr)
+ break;
+
+ case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
+ /* Destroy flush dependency on extensible array header, if set */
+ if (sblock->has_hdr_depend) {
+ if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0)
+ H5E_THROW(H5E_CANTUNDEPEND,
+ "unable to destroy flush dependency between super block and header, address = %llu",
+ (unsigned long long)sblock->addr)
+ sblock->has_hdr_depend = FALSE;
+ } /* end if */
+ break;
+
+ case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
+ /* Destroy flush dependency on index block */
+ if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0)
+ H5E_THROW(
+ H5E_CANTUNDEPEND,
+ "unable to destroy flush dependency between super block and index block, address = %llu",
+ (unsigned long long)sblock->addr)
+
+ /* Destroy flush dependency on extensible array header, if set */
+ if (sblock->has_hdr_depend) {
+ if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0)
+ H5E_THROW(H5E_CANTUNDEPEND,
+ "unable to destroy flush dependency between super block and header, address = %llu",
+ (unsigned long long)sblock->addr)
+ sblock->has_hdr_depend = FALSE;
+ } /* end if */
+
+ /* Detach from 'top' proxy for extensible array */
+ if (sblock->top_proxy) {
+ if (H5AC_proxy_entry_remove_child(sblock->top_proxy, sblock) < 0)
+ H5E_THROW(
+ H5E_CANTUNDEPEND,
+ "unable to destroy flush dependency between super block and extensible array 'top' proxy")
+ sblock->top_proxy = NULL;
+ } /* end if */
+ break;
+
+ case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
+ case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
+ case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
+ case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
+ case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED:
+ case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED:
+ /* do nothing */
+ break;
+
+ default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
-#else /* NDEBUG */
- HDassert(0 && "Unknown action?!?");
+ H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+#else /* NDEBUG */
+ HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
- } /* end switch */
+} /* end switch */
CATCH
-END_FUNC(STATIC) /* end H5EA__cache_sblock_notify() */
+END_FUNC(STATIC) /* end H5EA__cache_sblock_notify() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_free_icr
*
@@ -1402,22 +1367,19 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__cache_sblock_free_icr(void *thing))
+BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_sblock_free_icr(void *thing))
- /* Check arguments */
- HDassert(thing);
+/* Check arguments */
+HDassert(thing);
- /* Release the extensible array super block */
- if(H5EA__sblock_dest((H5EA_sblock_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free extensible array super block")
+/* Release the extensible array super block */
+if (H5EA__sblock_dest((H5EA_sblock_t *)thing) < 0)
+ H5E_THROW(H5E_CANTFREE, "can't free extensible array super block")
CATCH
-END_FUNC(STATIC) /* end H5EA__cache_sblock_free_icr() */
+END_FUNC(STATIC) /* end H5EA__cache_sblock_free_icr() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_get_initial_load_size
*
@@ -1430,51 +1392,49 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_free_icr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-herr_t, SUCCEED, -,
-H5EA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
- H5EA_dblock_cache_ud_t *udata = (H5EA_dblock_cache_ud_t *)_udata; /* User data */
- H5EA_dblock_t dblock; /* Fake data block for computing size */
-
- /* Check arguments */
- HDassert(udata);
- HDassert(udata->hdr);
- HDassert(udata->nelmts > 0);
- HDassert(image_len);
-
- /* Set up fake data block for computing size on disk */
- /* (Note: extracted from H5EA__dblock_alloc) */
- HDmemset(&dblock, 0, sizeof(dblock));
-
- /* need to set:
- *
- * dblock.hdr
- * dblock.npages
- * dblock.nelmts
- *
- * before we invoke either H5EA_DBLOCK_PREFIX_SIZE() or
- * H5EA_DBLOCK_SIZE().
- */
- dblock.hdr = udata->hdr;
- dblock.nelmts = udata->nelmts;
-
- if(udata->nelmts > udata->hdr->dblk_page_nelmts) {
- /* Set the # of pages in the direct block */
- dblock.npages = udata->nelmts / udata->hdr->dblk_page_nelmts;
- HDassert(udata->nelmts==(dblock.npages * udata->hdr->dblk_page_nelmts));
- } /* end if */
-
- /* Set the image length size */
- if(!dblock.npages)
- *image_len = H5EA_DBLOCK_SIZE(&dblock);
- else
- *image_len = H5EA_DBLOCK_PREFIX_SIZE(&dblock);
-
-END_FUNC(STATIC) /* end H5EA__cache_dblock_get_initial_load_size() */
-
-
+BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
+ H5EA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len))
+
+/* Local variables */
+H5EA_dblock_cache_ud_t *udata = (H5EA_dblock_cache_ud_t *)_udata; /* User data */
+H5EA_dblock_t dblock; /* Fake data block for computing size */
+
+/* Check arguments */
+HDassert(udata);
+HDassert(udata->hdr);
+HDassert(udata->nelmts > 0);
+HDassert(image_len);
+
+/* Set up fake data block for computing size on disk */
+/* (Note: extracted from H5EA__dblock_alloc) */
+HDmemset(&dblock, 0, sizeof(dblock));
+
+/* need to set:
+ *
+ * dblock.hdr
+ * dblock.npages
+ * dblock.nelmts
+ *
+ * before we invoke either H5EA_DBLOCK_PREFIX_SIZE() or
+ * H5EA_DBLOCK_SIZE().
+ */
+dblock.hdr = udata->hdr;
+dblock.nelmts = udata->nelmts;
+
+if (udata->nelmts > udata->hdr->dblk_page_nelmts) {
+ /* Set the # of pages in the direct block */
+ dblock.npages = udata->nelmts / udata->hdr->dblk_page_nelmts;
+ HDassert(udata->nelmts == (dblock.npages * udata->hdr->dblk_page_nelmts));
+} /* end if */
+
+/* Set the image length size */
+if (!dblock.npages)
+ *image_len = H5EA_DBLOCK_SIZE(&dblock);
+else
+ *image_len = H5EA_DBLOCK_PREFIX_SIZE(&dblock);
+
+END_FUNC(STATIC) /* end H5EA__cache_dblock_get_initial_load_size() */
+
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_verify_chksum
*
@@ -1488,27 +1448,25 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-htri_t, TRUE, -,
-H5EA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
+BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
+ H5EA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
- /* Local variables */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t stored_chksum; /* Stored metadata checksum value */
- uint32_t computed_chksum; /* Computed metadata checksum value */
+/* Local variables */
+const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+uint32_t stored_chksum; /* Stored metadata checksum value */
+uint32_t computed_chksum; /* Computed metadata checksum value */
- /* Check arguments */
- HDassert(image);
+/* Check arguments */
+HDassert(image);
- /* Get stored and computed checksums */
- H5F_get_checksums(image, len, &stored_chksum, &computed_chksum);
+/* Get stored and computed checksums */
+H5F_get_checksums(image, len, &stored_chksum, &computed_chksum);
- if(stored_chksum != computed_chksum)
- ret_value = FALSE;
+if (stored_chksum != computed_chksum)
+ ret_value = FALSE;
-END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
+END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_deserialize
*
@@ -1522,96 +1480,94 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-void *, NULL, NULL,
-H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
- void *_udata, hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
- H5EA_dblock_t *dblock = NULL; /* Data block info */
- H5EA_dblock_cache_ud_t *udata = (H5EA_dblock_cache_ud_t *)_udata; /* User data */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t stored_chksum; /* Stored metadata checksum value */
- haddr_t arr_addr; /* Address of array header in the file */
-
- /* Check arguments */
- HDassert(udata);
- HDassert(udata->hdr);
- HDassert(udata->parent);
- HDassert(udata->nelmts > 0);
- HDassert(H5F_addr_defined(udata->dblk_addr));
-
- /* Allocate the extensible array data block */
- if(NULL == (dblock = H5EA__dblock_alloc(udata->hdr, udata->parent, udata->nelmts)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block")
-
- HDassert(((!dblock->npages) && (len == H5EA_DBLOCK_SIZE(dblock))) ||
- (len == H5EA_DBLOCK_PREFIX_SIZE(dblock)));
-
- /* Set the extensible array data block's information */
- dblock->addr = udata->dblk_addr;
-
- /* Magic number */
- if(HDmemcmp(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array data block signature")
- image += H5_SIZEOF_MAGIC;
-
- /* Version */
- if(*image++ != H5EA_DBLOCK_VERSION)
- H5E_THROW(H5E_VERSION, "wrong extensible array data block version")
-
- /* Extensible array type */
- if(*image++ != (uint8_t)udata->hdr->cparam.cls->id)
- H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
-
- /* Address of header for array that owns this block (just for file integrity checks) */
- H5F_addr_decode(udata->hdr->f, &image, &arr_addr);
- if(H5F_addr_ne(arr_addr, udata->hdr->addr))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array header address")
-
- /* Offset of block within the array's address space */
- UINT64DECODE_VAR(image, dblock->block_off, udata->hdr->arr_off_size);
-
- /* Internal information */
-
- /* Only decode elements if the data block is not paged */
- if(!dblock->npages) {
- /* Decode elements in data block */
- /* Convert from raw elements on disk into native elements in memory */
- if((udata->hdr->cparam.cls->decode)(image, dblock->elmts, udata->nelmts, udata->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements")
- image += (udata->nelmts * udata->hdr->cparam.raw_elmt_size);
- } /* end if */
-
- /* Sanity check */
- /* (allow for checksum not decoded yet) */
- HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM));
-
- /* Set the data block's size */
- /* (Note: This is not the same as the image length, for paged data blocks) */
- dblock->size = H5EA_DBLOCK_SIZE(dblock);
-
- /* checksum verification already done in verify_chksum cb */
-
- /* Metadata checksum */
- UINT32DECODE(image, stored_chksum);
-
- /* Sanity check */
- HDassert((size_t)(image - (const uint8_t *)_image) == len);
-
- /* Set return value */
- ret_value = dblock;
+BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
+ H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
+ hbool_t H5_ATTR_UNUSED *dirty))
+
+/* Local variables */
+H5EA_dblock_t * dblock = NULL; /* Data block info */
+H5EA_dblock_cache_ud_t *udata = (H5EA_dblock_cache_ud_t *)_udata; /* User data */
+const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+uint32_t stored_chksum; /* Stored metadata checksum value */
+haddr_t arr_addr; /* Address of array header in the file */
+
+/* Check arguments */
+HDassert(udata);
+HDassert(udata->hdr);
+HDassert(udata->parent);
+HDassert(udata->nelmts > 0);
+HDassert(H5F_addr_defined(udata->dblk_addr));
+
+/* Allocate the extensible array data block */
+if (NULL == (dblock = H5EA__dblock_alloc(udata->hdr, udata->parent, udata->nelmts)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block")
+
+HDassert(((!dblock->npages) && (len == H5EA_DBLOCK_SIZE(dblock))) ||
+ (len == H5EA_DBLOCK_PREFIX_SIZE(dblock)));
+
+/* Set the extensible array data block's information */
+dblock->addr = udata->dblk_addr;
+
+/* Magic number */
+if (HDmemcmp(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ H5E_THROW(H5E_BADVALUE, "wrong extensible array data block signature")
+image += H5_SIZEOF_MAGIC;
+
+/* Version */
+if (*image++ != H5EA_DBLOCK_VERSION)
+ H5E_THROW(H5E_VERSION, "wrong extensible array data block version")
+
+/* Extensible array type */
+if (*image++ != (uint8_t)udata->hdr->cparam.cls->id)
+ H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
+
+/* Address of header for array that owns this block (just for file integrity checks) */
+H5F_addr_decode(udata->hdr->f, &image, &arr_addr);
+if (H5F_addr_ne(arr_addr, udata->hdr->addr))
+ H5E_THROW(H5E_BADVALUE, "wrong extensible array header address")
+
+/* Offset of block within the array's address space */
+UINT64DECODE_VAR(image, dblock->block_off, udata->hdr->arr_off_size);
+
+/* Internal information */
+
+/* Only decode elements if the data block is not paged */
+if (!dblock->npages) {
+ /* Decode elements in data block */
+ /* Convert from raw elements on disk into native elements in memory */
+ if ((udata->hdr->cparam.cls->decode)(image, dblock->elmts, udata->nelmts, udata->hdr->cb_ctx) < 0)
+ H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements")
+ image += (udata->nelmts * udata->hdr->cparam.raw_elmt_size);
+} /* end if */
+
+/* Sanity check */
+/* (allow for checksum not decoded yet) */
+HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM));
+
+/* Set the data block's size */
+/* (Note: This is not the same as the image length, for paged data blocks) */
+dblock->size = H5EA_DBLOCK_SIZE(dblock);
+
+/* checksum verification already done in verify_chksum cb */
+
+/* Metadata checksum */
+UINT32DECODE(image, stored_chksum);
+
+/* Sanity check */
+HDassert((size_t)(image - (const uint8_t *)_image) == len);
+
+/* Set return value */
+ret_value = dblock;
CATCH
- /* Release resources */
- if(!ret_value)
- if(dblock && H5EA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block")
+/* Release resources */
+if (!ret_value)
+ if (dblock && H5EA__dblock_dest(dblock) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block")
-END_FUNC(STATIC) /* end H5EA__cache_dblock_deserialize() */
+END_FUNC(STATIC) /* end H5EA__cache_dblock_deserialize() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_image_len
*
@@ -1624,26 +1580,24 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-herr_t, SUCCEED, -,
-H5EA__cache_dblock_image_len(const void *_thing, size_t *image_len))
+BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
+ H5EA__cache_dblock_image_len(const void *_thing, size_t *image_len))
- /* Local variables */
- const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */
+/* Local variables */
+const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */
- /* Check arguments */
- HDassert(dblock);
- HDassert(image_len);
+/* Check arguments */
+HDassert(dblock);
+HDassert(image_len);
- /* Set the image length size */
- if(!dblock->npages)
- *image_len = dblock->size;
- else
- *image_len = (size_t)H5EA_DBLOCK_PREFIX_SIZE(dblock);
+/* Set the image length size */
+if (!dblock->npages)
+ *image_len = dblock->size;
+else
+ *image_len = (size_t)H5EA_DBLOCK_PREFIX_SIZE(dblock);
-END_FUNC(STATIC) /* end H5EA__cache_dblock_image_len() */
+END_FUNC(STATIC) /* end H5EA__cache_dblock_image_len() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_serialize
*
@@ -1656,65 +1610,63 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing))
+BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
+ void *_thing))
- /* Local variables */
- H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object to serialize */
- uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t metadata_chksum; /* Computed metadata checksum value */
+/* Local variables */
+H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object to serialize */
+uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
+uint32_t metadata_chksum; /* Computed metadata checksum value */
- /* check arguments */
- HDassert(f);
- HDassert(image);
- HDassert(dblock);
- HDassert(dblock->hdr);
+/* check arguments */
+HDassert(f);
+HDassert(image);
+HDassert(dblock);
+HDassert(dblock->hdr);
- /* Magic number */
- H5MM_memcpy(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
- image += H5_SIZEOF_MAGIC;
+/* Magic number */
+H5MM_memcpy(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+image += H5_SIZEOF_MAGIC;
- /* Version # */
- *image++ = H5EA_DBLOCK_VERSION;
+/* Version # */
+*image++ = H5EA_DBLOCK_VERSION;
- /* Extensible array type */
- HDassert(dblock->hdr->cparam.cls->id <= 255);
- *image++ = (uint8_t)dblock->hdr->cparam.cls->id;
+/* Extensible array type */
+HDassert(dblock->hdr->cparam.cls->id <= 255);
+*image++ = (uint8_t)dblock->hdr->cparam.cls->id;
- /* Address of array header for array which owns this block */
- H5F_addr_encode(f, &image, dblock->hdr->addr);
+/* Address of array header for array which owns this block */
+H5F_addr_encode(f, &image, dblock->hdr->addr);
- /* Offset of block in array */
- UINT64ENCODE_VAR(image, dblock->block_off, dblock->hdr->arr_off_size);
+/* Offset of block in array */
+UINT64ENCODE_VAR(image, dblock->block_off, dblock->hdr->arr_off_size);
- /* Internal information */
+/* Internal information */
- /* Only encode elements if the data block is not paged */
- if(!dblock->npages) {
- /* Encode elements in data block */
+/* Only encode elements if the data block is not paged */
+if (!dblock->npages) {
+ /* Encode elements in data block */
- /* Convert from native elements in memory into raw elements on disk */
- if((dblock->hdr->cparam.cls->encode)(image, dblock->elmts, dblock->nelmts, dblock->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements")
- image += (dblock->nelmts * dblock->hdr->cparam.raw_elmt_size);
- } /* end if */
+ /* Convert from native elements in memory into raw elements on disk */
+ if ((dblock->hdr->cparam.cls->encode)(image, dblock->elmts, dblock->nelmts, dblock->hdr->cb_ctx) < 0)
+ H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements")
+ image += (dblock->nelmts * dblock->hdr->cparam.raw_elmt_size);
+} /* end if */
- /* Compute metadata checksum */
- metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0);
+/* Compute metadata checksum */
+metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0);
- /* Metadata checksum */
- UINT32ENCODE(image, metadata_chksum);
+/* Metadata checksum */
+UINT32ENCODE(image, metadata_chksum);
- /* Sanity check */
- HDassert((size_t)(image - (uint8_t *)_image) == len);
+/* Sanity check */
+HDassert((size_t)(image - (uint8_t *)_image) == len);
CATCH
-END_FUNC(STATIC) /* end H5EA__cache_dblock_serialize() */
+END_FUNC(STATIC) /* end H5EA__cache_dblock_serialize() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_notify
*
@@ -1727,76 +1679,85 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing))
-
- /* Local variables */
- H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object */
-
- /* Check arguments */
- HDassert(dblock);
-
- /* Determine which action to take */
- switch(action) {
- case H5AC_NOTIFY_ACTION_AFTER_INSERT:
- case H5AC_NOTIFY_ACTION_AFTER_LOAD:
- /* Create flush dependency on parent */
- if(H5EA__create_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between data block and parent, address = %llu", (unsigned long long)dblock->addr)
- break;
-
- case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
- /* Destroy flush dependency on extensible array header, if set */
- if(dblock->has_hdr_depend) {
- if(H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between direct block and header, address = %llu", (unsigned long long)dblock->addr)
- dblock->has_hdr_depend = FALSE;
- } /* end if */
- break;
-
- case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
- /* Destroy flush dependency on parent */
- if(H5EA__destroy_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block and parent, address = %llu", (unsigned long long)dblock->addr)
-
- /* Destroy flush dependency on extensible array header, if set */
- if(dblock->has_hdr_depend) {
- if(H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block and header, address = %llu", (unsigned long long)dblock->addr)
- dblock->has_hdr_depend = FALSE;
- } /* end if */
-
- /* Detach from 'top' proxy for extensible array */
- if(dblock->top_proxy) {
- if(H5AC_proxy_entry_remove_child(dblock->top_proxy, dblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block and extensible array 'top' proxy")
- dblock->top_proxy = NULL;
- } /* end if */
- break;
-
- case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
- case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
- case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
- case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
- case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED:
- case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED:
- /* do nothing */
- break;
-
- default:
+BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing))
+
+/* Local variables */
+H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object */
+
+/* Check arguments */
+HDassert(dblock);
+
+/* Determine which action to take */
+switch (action) {
+ case H5AC_NOTIFY_ACTION_AFTER_INSERT:
+ case H5AC_NOTIFY_ACTION_AFTER_LOAD:
+ /* Create flush dependency on parent */
+ if (H5EA__create_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0)
+ H5E_THROW(H5E_CANTDEPEND,
+ "unable to create flush dependency between data block and parent, address = %llu",
+ (unsigned long long)dblock->addr)
+ break;
+
+ case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
+ /* Destroy flush dependency on extensible array header, if set */
+ if (dblock->has_hdr_depend) {
+ if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0)
+ H5E_THROW(
+ H5E_CANTUNDEPEND,
+ "unable to destroy flush dependency between direct block and header, address = %llu",
+ (unsigned long long)dblock->addr)
+ dblock->has_hdr_depend = FALSE;
+ } /* end if */
+ break;
+
+ case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
+ /* Destroy flush dependency on parent */
+ if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0)
+ H5E_THROW(H5E_CANTUNDEPEND,
+ "unable to destroy flush dependency between data block and parent, address = %llu",
+ (unsigned long long)dblock->addr)
+
+ /* Destroy flush dependency on extensible array header, if set */
+ if (dblock->has_hdr_depend) {
+ if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0)
+ H5E_THROW(H5E_CANTUNDEPEND,
+ "unable to destroy flush dependency between data block and header, address = %llu",
+ (unsigned long long)dblock->addr)
+ dblock->has_hdr_depend = FALSE;
+ } /* end if */
+
+ /* Detach from 'top' proxy for extensible array */
+ if (dblock->top_proxy) {
+ if (H5AC_proxy_entry_remove_child(dblock->top_proxy, dblock) < 0)
+ H5E_THROW(
+ H5E_CANTUNDEPEND,
+ "unable to destroy flush dependency between data block and extensible array 'top' proxy")
+ dblock->top_proxy = NULL;
+ } /* end if */
+ break;
+
+ case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
+ case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
+ case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
+ case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
+ case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED:
+ case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED:
+ /* do nothing */
+ break;
+
+ default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
-#else /* NDEBUG */
- HDassert(0 && "Unknown action?!?");
+ H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+#else /* NDEBUG */
+ HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
- } /* end switch */
+} /* end switch */
CATCH
-END_FUNC(STATIC) /* end H5EA__cache_dblock_notify() */
+END_FUNC(STATIC) /* end H5EA__cache_dblock_notify() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_free_icr
*
@@ -1810,22 +1771,19 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__cache_dblock_free_icr(void *thing))
+BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_dblock_free_icr(void *thing))
- /* Check arguments */
- HDassert(thing);
+/* Check arguments */
+HDassert(thing);
- /* Release the extensible array data block */
- if(H5EA__dblock_dest((H5EA_dblock_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free extensible array data block")
+/* Release the extensible array data block */
+if (H5EA__dblock_dest((H5EA_dblock_t *)thing) < 0)
+ H5E_THROW(H5E_CANTFREE, "can't free extensible array data block")
CATCH
-END_FUNC(STATIC) /* end H5EA__cache_dblock_free_icr() */
+END_FUNC(STATIC) /* end H5EA__cache_dblock_free_icr() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_fsf_size
*
@@ -1855,24 +1813,22 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_free_icr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-herr_t, SUCCEED, -,
-H5EA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size))
+BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
+ H5EA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size))
- /* Local variables */
- const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */
+/* Local variables */
+const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */
- /* Check arguments */
- HDassert(dblock);
- HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(dblock->cache_info.type == H5AC_EARRAY_DBLOCK);
- HDassert(fsf_size);
+/* Check arguments */
+HDassert(dblock);
+HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+HDassert(dblock->cache_info.type == H5AC_EARRAY_DBLOCK);
+HDassert(fsf_size);
- *fsf_size = dblock->size;
+*fsf_size = dblock->size;
-END_FUNC(STATIC) /* end H5EA__cache_dblock_fsf_size() */
+END_FUNC(STATIC) /* end H5EA__cache_dblock_fsf_size() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_get_initial_load_size
*
@@ -1885,24 +1841,22 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_fsf_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-herr_t, SUCCEED, -,
-H5EA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len))
+BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
+ H5EA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len))
- /* Local variables */
- H5EA_dblk_page_cache_ud_t *udata = (H5EA_dblk_page_cache_ud_t *)_udata; /* User data */
+/* Local variables */
+H5EA_dblk_page_cache_ud_t *udata = (H5EA_dblk_page_cache_ud_t *)_udata; /* User data */
- /* Check arguments */
- HDassert(udata);
- HDassert(udata->hdr);
- HDassert(image_len);
+/* Check arguments */
+HDassert(udata);
+HDassert(udata->hdr);
+HDassert(image_len);
- /* Set the image length size */
- *image_len = (size_t)H5EA_DBLK_PAGE_SIZE(udata->hdr);
+/* Set the image length size */
+*image_len = (size_t)H5EA_DBLK_PAGE_SIZE(udata->hdr);
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_get_initial_load_size() */
+END_FUNC(STATIC) /* end H5EA__cache_dblk_page_get_initial_load_size() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_verify_chksum
*
@@ -1916,27 +1870,25 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-htri_t, TRUE, -,
-H5EA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
+BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
+ H5EA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
- /* Local variables */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t stored_chksum; /* Stored metadata checksum value */
- uint32_t computed_chksum; /* Computed metadata checksum value */
+/* Local variables */
+const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+uint32_t stored_chksum; /* Stored metadata checksum value */
+uint32_t computed_chksum; /* Computed metadata checksum value */
- /* Check arguments */
- HDassert(image);
+/* Check arguments */
+HDassert(image);
- /* Get stored and computed checksums */
- H5F_get_checksums(image, len, &stored_chksum, &computed_chksum);
+/* Get stored and computed checksums */
+H5F_get_checksums(image, len, &stored_chksum, &computed_chksum);
- if(stored_chksum != computed_chksum)
- ret_value = FALSE;
+if (stored_chksum != computed_chksum)
+ ret_value = FALSE;
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_verify_chksum() */
+END_FUNC(STATIC) /* end H5EA__cache_dblk_page_verify_chksum() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_deserialize
*
@@ -1950,66 +1902,66 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-void *, NULL, NULL,
-H5EA__cache_dblk_page_deserialize(const void *_image, size_t len,
- void *_udata, hbool_t H5_ATTR_UNUSED *dirty))
+BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
+ H5EA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata,
+ hbool_t H5_ATTR_UNUSED *dirty))
- /* Local variables */
- H5EA_dblk_page_t *dblk_page = NULL; /* Data block page info */
- H5EA_dblk_page_cache_ud_t *udata = (H5EA_dblk_page_cache_ud_t *)_udata; /* User data for loading data block page */
- const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t stored_chksum; /* Stored metadata checksum value */
+/* Local variables */
+H5EA_dblk_page_t * dblk_page = NULL; /* Data block page info */
+H5EA_dblk_page_cache_ud_t *udata =
+ (H5EA_dblk_page_cache_ud_t *)_udata; /* User data for loading data block page */
+const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
+uint32_t stored_chksum; /* Stored metadata checksum value */
- /* Sanity check */
- HDassert(udata);
- HDassert(udata->hdr);
- HDassert(udata->parent);
- HDassert(H5F_addr_defined(udata->dblk_page_addr));
+/* Sanity check */
+HDassert(udata);
+HDassert(udata->hdr);
+HDassert(udata->parent);
+HDassert(H5F_addr_defined(udata->dblk_page_addr));
- /* Allocate the extensible array data block page */
- if(NULL == (dblk_page = H5EA__dblk_page_alloc(udata->hdr, udata->parent)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page")
+/* Allocate the extensible array data block page */
+if (NULL == (dblk_page = H5EA__dblk_page_alloc(udata->hdr, udata->parent)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page")
- /* Set the extensible array data block page's information */
- dblk_page->addr = udata->dblk_page_addr;
+/* Set the extensible array data block page's information */
+dblk_page->addr = udata->dblk_page_addr;
- /* Internal information */
+/* Internal information */
- /* Decode elements in data block page */
- /* Convert from raw elements on disk into native elements in memory */
- if((udata->hdr->cparam.cls->decode)(image, dblk_page->elmts, udata->hdr->dblk_page_nelmts, udata->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements")
- image += (udata->hdr->dblk_page_nelmts * udata->hdr->cparam.raw_elmt_size);
+/* Decode elements in data block page */
+/* Convert from raw elements on disk into native elements in memory */
+if ((udata->hdr->cparam.cls->decode)(image, dblk_page->elmts, udata->hdr->dblk_page_nelmts,
+ udata->hdr->cb_ctx) < 0)
+ H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements")
+image += (udata->hdr->dblk_page_nelmts * udata->hdr->cparam.raw_elmt_size);
- /* Sanity check */
- /* (allow for checksum not decoded yet) */
- HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM));
+/* Sanity check */
+/* (allow for checksum not decoded yet) */
+HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM));
- /* Set the data block page's size */
- dblk_page->size = len;
+/* Set the data block page's size */
+dblk_page->size = len;
- /* checksum verification already done in verify_chksum cb */
+/* checksum verification already done in verify_chksum cb */
- /* Metadata checksum */
- UINT32DECODE(image, stored_chksum);
+/* Metadata checksum */
+UINT32DECODE(image, stored_chksum);
- /* Sanity check */
- HDassert((size_t)(image - (const uint8_t *)_image) == dblk_page->size);
+/* Sanity check */
+HDassert((size_t)(image - (const uint8_t *)_image) == dblk_page->size);
- /* Set return value */
- ret_value = dblk_page;
+/* Set return value */
+ret_value = dblk_page;
CATCH
- /* Release resources */
- if(!ret_value)
- if(dblk_page && H5EA__dblk_page_dest(dblk_page) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page")
+/* Release resources */
+if (!ret_value)
+ if (dblk_page && H5EA__dblk_page_dest(dblk_page) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page")
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_deserialize() */
+END_FUNC(STATIC) /* end H5EA__cache_dblk_page_deserialize() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_image_len
*
@@ -2022,23 +1974,21 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR,
-herr_t, SUCCEED, -,
-H5EA__cache_dblk_page_image_len(const void *_thing, size_t *image_len))
+BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
+ H5EA__cache_dblk_page_image_len(const void *_thing, size_t *image_len))
- /* Local variables */
- const H5EA_dblk_page_t *dblk_page = (const H5EA_dblk_page_t *)_thing; /* Pointer to the object */
+/* Local variables */
+const H5EA_dblk_page_t *dblk_page = (const H5EA_dblk_page_t *)_thing; /* Pointer to the object */
- /* Check arguments */
- HDassert(dblk_page);
- HDassert(image_len);
+/* Check arguments */
+HDassert(dblk_page);
+HDassert(image_len);
- /* Set the image length size */
- *image_len = dblk_page->size;
+/* Set the image length size */
+*image_len = dblk_page->size;
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */
+END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_serialize
*
@@ -2051,45 +2001,44 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing))
+BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image,
+ size_t H5_ATTR_UNUSED len, void *_thing))
- /* Local variables */
- H5EA_dblk_page_t *dblk_page = (H5EA_dblk_page_t *)_thing; /* Pointer to the object to serialize */
- uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */
- uint32_t metadata_chksum; /* Computed metadata checksum value */
+/* Local variables */
+H5EA_dblk_page_t *dblk_page = (H5EA_dblk_page_t *)_thing; /* Pointer to the object to serialize */
+uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
+uint32_t metadata_chksum; /* Computed metadata checksum value */
- /* Check arguments */
- HDassert(f);
- HDassert(image);
- HDassert(dblk_page);
- HDassert(dblk_page->hdr);
+/* Check arguments */
+HDassert(f);
+HDassert(image);
+HDassert(dblk_page);
+HDassert(dblk_page->hdr);
- /* Internal information */
+/* Internal information */
- /* Encode elements in data block page */
+/* Encode elements in data block page */
- /* Convert from native elements in memory into raw elements on disk */
- if((dblk_page->hdr->cparam.cls->encode)(image, dblk_page->elmts, dblk_page->hdr->dblk_page_nelmts, dblk_page->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements")
- image += (dblk_page->hdr->dblk_page_nelmts * dblk_page->hdr->cparam.raw_elmt_size);
+/* Convert from native elements in memory into raw elements on disk */
+if ((dblk_page->hdr->cparam.cls->encode)(image, dblk_page->elmts, dblk_page->hdr->dblk_page_nelmts,
+ dblk_page->hdr->cb_ctx) < 0)
+ H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements")
+image += (dblk_page->hdr->dblk_page_nelmts * dblk_page->hdr->cparam.raw_elmt_size);
- /* Compute metadata checksum */
- metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0);
+/* Compute metadata checksum */
+metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0);
- /* Metadata checksum */
- UINT32ENCODE(image, metadata_chksum);
+/* Metadata checksum */
+UINT32ENCODE(image, metadata_chksum);
- /* Sanity check */
- HDassert((size_t)(image - (uint8_t *)_image) == len);
+/* Sanity check */
+HDassert((size_t)(image - (uint8_t *)_image) == len);
CATCH
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_serialize() */
+END_FUNC(STATIC) /* end H5EA__cache_dblk_page_serialize() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_notify
*
@@ -2102,76 +2051,85 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing))
-
- /* Local variables */
- H5EA_dblk_page_t *dblk_page = (H5EA_dblk_page_t *)_thing; /* Pointer to the object */
-
- /* Sanity check */
- HDassert(dblk_page);
-
- /* Determine which action to take */
- switch(action) {
- case H5AC_NOTIFY_ACTION_AFTER_INSERT:
- case H5AC_NOTIFY_ACTION_AFTER_LOAD:
- /* Create flush dependency on parent */
- if(H5EA__create_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0)
- H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between data block page and parent, address = %llu", (unsigned long long)dblk_page->addr)
- break;
-
- case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
- /* Destroy flush dependency on extensible array header, if set */
- if(dblk_page->has_hdr_depend) {
- if(H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page and header, address = %llu", (unsigned long long)dblk_page->addr)
- dblk_page->has_hdr_depend = FALSE;
- } /* end if */
- break;
-
- case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
- /* Destroy flush dependency on parent */
- if(H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page and parent, address = %llu", (unsigned long long)dblk_page->addr)
-
- /* Destroy flush dependency on extensible array header, if set */
- if(dblk_page->has_hdr_depend) {
- if(H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page and header, address = %llu", (unsigned long long)dblk_page->addr)
- dblk_page->has_hdr_depend = FALSE;
- } /* end if */
-
- /* Detach from 'top' proxy for extensible array */
- if(dblk_page->top_proxy) {
- if(H5AC_proxy_entry_remove_child(dblk_page->top_proxy, dblk_page) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page and extensible array 'top' proxy")
- dblk_page->top_proxy = NULL;
- } /* end if */
- break;
-
- case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
- case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
- case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
- case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
- case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED:
- case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED:
- /* do nothing */
- break;
-
- default:
+BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing))
+
+/* Local variables */
+H5EA_dblk_page_t *dblk_page = (H5EA_dblk_page_t *)_thing; /* Pointer to the object */
+
+/* Sanity check */
+HDassert(dblk_page);
+
+/* Determine which action to take */
+switch (action) {
+ case H5AC_NOTIFY_ACTION_AFTER_INSERT:
+ case H5AC_NOTIFY_ACTION_AFTER_LOAD:
+ /* Create flush dependency on parent */
+ if (H5EA__create_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0)
+ H5E_THROW(H5E_CANTDEPEND,
+ "unable to create flush dependency between data block page and parent, address = %llu",
+ (unsigned long long)dblk_page->addr)
+ break;
+
+ case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
+ /* Destroy flush dependency on extensible array header, if set */
+ if (dblk_page->has_hdr_depend) {
+ if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0)
+ H5E_THROW(
+ H5E_CANTUNDEPEND,
+ "unable to destroy flush dependency between data block page and header, address = %llu",
+ (unsigned long long)dblk_page->addr)
+ dblk_page->has_hdr_depend = FALSE;
+ } /* end if */
+ break;
+
+ case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
+ /* Destroy flush dependency on parent */
+ if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0)
+ H5E_THROW(H5E_CANTUNDEPEND,
+ "unable to destroy flush dependency between data block page and parent, address = %llu",
+ (unsigned long long)dblk_page->addr)
+
+ /* Destroy flush dependency on extensible array header, if set */
+ if (dblk_page->has_hdr_depend) {
+ if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0)
+ H5E_THROW(
+ H5E_CANTUNDEPEND,
+ "unable to destroy flush dependency between data block page and header, address = %llu",
+ (unsigned long long)dblk_page->addr)
+ dblk_page->has_hdr_depend = FALSE;
+ } /* end if */
+
+ /* Detach from 'top' proxy for extensible array */
+ if (dblk_page->top_proxy) {
+ if (H5AC_proxy_entry_remove_child(dblk_page->top_proxy, dblk_page) < 0)
+ H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page and "
+ "extensible array 'top' proxy")
+ dblk_page->top_proxy = NULL;
+ } /* end if */
+ break;
+
+ case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
+ case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
+ case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
+ case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
+ case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED:
+ case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED:
+ /* do nothing */
+ break;
+
+ default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
-#else /* NDEBUG */
- HDassert(0 && "Unknown action?!?");
+ H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+#else /* NDEBUG */
+ HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
- } /* end switch */
+} /* end switch */
CATCH
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_notify() */
+END_FUNC(STATIC) /* end H5EA__cache_dblk_page_notify() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_free_icr
*
@@ -2185,18 +2143,15 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__cache_dblk_page_free_icr(void *thing))
+BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_dblk_page_free_icr(void *thing))
- /* Check arguments */
- HDassert(thing);
+/* Check arguments */
+HDassert(thing);
- /* Release the extensible array data block page */
- if(H5EA__dblk_page_dest((H5EA_dblk_page_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free extensible array data block page")
+/* Release the extensible array data block page */
+if (H5EA__dblk_page_dest((H5EA_dblk_page_t *)thing) < 0)
+ H5E_THROW(H5E_CANTFREE, "can't free extensible array data block page")
CATCH
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_free_icr() */
-
+END_FUNC(STATIC) /* end H5EA__cache_dblk_page_free_icr() */
diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c
index 2686579..3017f7b 100644
--- a/src/H5EAdbg.c
+++ b/src/H5EAdbg.c
@@ -26,58 +26,47 @@
/* Module Declaration */
/**********************/
-#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
-
+#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
/***********************/
/* Other Packages Used */
/***********************/
-
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5EApkg.h" /* Extensible Arrays */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5EApkg.h" /* Extensible Arrays */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_debug
*
@@ -90,89 +79,71 @@
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent,
- int fwidth, const H5EA_class_t *cls, haddr_t obj_addr))
-
- /* Local variables */
- H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
- void *dbg_ctx = NULL; /* Extensible array debugging context */
-
- /* Check arguments */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(H5F_addr_defined(obj_addr));
- HDassert(stream);
- HDassert(indent >= 0);
- HDassert(fwidth >= 0);
- HDassert(cls);
-
- /* Check for debugging context callback available */
- if(cls->crt_dbg_ctx)
- /* Create debugging context */
- if(NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
- H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context")
-
- /* Load the extensible array header */
- if(NULL == (hdr = H5EA__hdr_protect(f, addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
-
- /* Print opening message */
- HDfprintf(stream, "%*sExtensible Array Header...\n", indent, "");
-
- /* Print the values */
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Array class ID:", hdr->cparam.cls->name);
- HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
- "Header size:",
- hdr->size);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Raw Element Size:",
- (unsigned)hdr->cparam.raw_elmt_size);
- HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
- "Native Element Size (on this platform):",
- hdr->cparam.cls->nat_elmt_size);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Log2(Max. # of elements in array):",
- (unsigned)hdr->cparam.max_nelmts_bits);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "# of elements in index block:",
- (unsigned)hdr->cparam.idx_blk_elmts);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Min. # of elements per data block:",
- (unsigned)hdr->cparam.data_blk_min_elmts);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Min. # of data block pointers for a super block:",
- (unsigned)hdr->cparam.sup_blk_min_data_ptrs);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Log2(Max. # of elements in data block page):",
- (unsigned)hdr->cparam.max_dblk_page_nelmts_bits);
- HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
- "Highest element index stored (+1):",
- hdr->stats.stored.max_idx_set);
- HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
- "Number of super blocks created:",
- hdr->stats.stored.nsuper_blks);
- HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
- "Number of data blocks created:",
- hdr->stats.stored.ndata_blks);
- HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
- "Number of elements 'realized':",
- hdr->stats.stored.nelmts);
- HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
- "Index Block Address:",
- hdr->idx_blk_addr);
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
+ const H5EA_class_t *cls, haddr_t obj_addr))
+
+/* Local variables */
+H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
+void * dbg_ctx = NULL; /* Extensible array debugging context */
+
+/* Check arguments */
+HDassert(f);
+HDassert(H5F_addr_defined(addr));
+HDassert(H5F_addr_defined(obj_addr));
+HDassert(stream);
+HDassert(indent >= 0);
+HDassert(fwidth >= 0);
+HDassert(cls);
+
+/* Check for debugging context callback available */
+if (cls->crt_dbg_ctx)
+ /* Create debugging context */
+ if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
+ H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context")
+
+/* Load the extensible array header */
+if (NULL == (hdr = H5EA__hdr_protect(f, addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
+
+/* Print opening message */
+HDfprintf(stream, "%*sExtensible Array Header...\n", indent, "");
+
+/* Print the values */
+HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name);
+HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size:", hdr->size);
+HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Raw Element Size:", (unsigned)hdr->cparam.raw_elmt_size);
+HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
+ "Native Element Size (on this platform):", hdr->cparam.cls->nat_elmt_size);
+HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Log2(Max. # of elements in array):", (unsigned)hdr->cparam.max_nelmts_bits);
+HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "# of elements in index block:", (unsigned)hdr->cparam.idx_blk_elmts);
+HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Min. # of elements per data block:", (unsigned)hdr->cparam.data_blk_min_elmts);
+HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Min. # of data block pointers for a super block:", (unsigned)hdr->cparam.sup_blk_min_data_ptrs);
+HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Log2(Max. # of elements in data block page):", (unsigned)hdr->cparam.max_dblk_page_nelmts_bits);
+HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
+ "Highest element index stored (+1):", hdr->stats.stored.max_idx_set);
+HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
+ "Number of super blocks created:", hdr->stats.stored.nsuper_blks);
+HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
+ "Number of data blocks created:", hdr->stats.stored.ndata_blks);
+HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth,
+ "Number of elements 'realized':", hdr->stats.stored.nelmts);
+HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Index Block Address:", hdr->idx_blk_addr);
CATCH
- if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
- if(hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
+ H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
+if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
-END_FUNC(PKG) /* end H5EA__hdr_debug() */
+END_FUNC(PKG) /* end H5EA__hdr_debug() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_debug
*
@@ -185,117 +156,108 @@ END_FUNC(PKG) /* end H5EA__hdr_debug() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int indent,
- int fwidth, const H5EA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr))
-
- /* Local variables */
- H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
- H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
- void *dbg_ctx = NULL; /* Extensible array context */
-
- /* Check arguments */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(stream);
- HDassert(indent >= 0);
- HDassert(fwidth >= 0);
- HDassert(cls);
- HDassert(H5F_addr_defined(hdr_addr));
- HDassert(H5F_addr_defined(obj_addr));
-
- /* Check for debugging context callback available */
- if(cls->crt_dbg_ctx)
- /* Create debugging context */
- if(NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
- H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context")
-
- /* Load the extensible array header */
- if(NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
-
- /* Sanity check */
- HDassert(H5F_addr_eq(hdr->idx_blk_addr, addr));
-
- /* Protect index block */
- if(NULL == (iblock = H5EA__iblock_protect(hdr, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", (unsigned long long)hdr->idx_blk_addr)
-
- /* Print opening message */
- HDfprintf(stream, "%*sExtensible Array Index Block...\n", indent, "");
-
- /* Print the values */
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Array class ID:", hdr->cparam.cls->name);
- HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
- "Index Block size:",
- iblock->size);
- HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
- "# of data block addresses in index block:",
- iblock->ndblk_addrs);
- HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
- "# of super block addresses in index block:",
- iblock->nsblk_addrs);
-
- /* Check if there are any elements in index block */
- if(hdr->cparam.idx_blk_elmts > 0) {
- unsigned u; /* Local index variable */
-
- /* Print the elements in the index block */
- HDfprintf(stream, "%*sElements in Index Block:\n", indent, "");
- for(u = 0; u < hdr->cparam.idx_blk_elmts; u++) {
- /* Call the class's 'debug' callback */
- if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)),
- (hsize_t)u,
- ((uint8_t *)iblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0)
- H5E_THROW(H5E_CANTGET, "can't get element for debugging")
- } /* end for */
- } /* end if */
-
- /* Check if there are any data block addresses in index block */
- if(iblock->ndblk_addrs > 0) {
- char temp_str[128]; /* Temporary string, for formatting */
- unsigned u; /* Local index variable */
-
- /* Print the data block addresses in the index block */
- HDfprintf(stream, "%*sData Block Addresses in Index Block:\n", indent, "");
- for(u = 0; u < iblock->ndblk_addrs; u++) {
- /* Print address */
- HDsprintf(temp_str, "Address #%u:", u);
- HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)),
- temp_str,
- iblock->dblk_addrs[u]);
- } /* end for */
- } /* end if */
-
- /* Check if there are any super block addresses in index block */
- if(iblock->nsblk_addrs > 0) {
- char temp_str[128]; /* Temporary string, for formatting */
- unsigned u; /* Local index variable */
-
- /* Print the super block addresses in the index block */
- HDfprintf(stream, "%*sSuper Block Addresses in Index Block:\n", indent, "");
- for(u = 0; u < iblock->nsblk_addrs; u++) {
- /* Print address */
- HDsprintf(temp_str, "Address #%u:", u);
- HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)),
- temp_str,
- iblock->sblk_addrs[u]);
- } /* end for */
- } /* end if */
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int indent, int fwidth,
+ const H5EA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr))
+
+/* Local variables */
+H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */
+H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
+void * dbg_ctx = NULL; /* Extensible array context */
+
+/* Check arguments */
+HDassert(f);
+HDassert(H5F_addr_defined(addr));
+HDassert(stream);
+HDassert(indent >= 0);
+HDassert(fwidth >= 0);
+HDassert(cls);
+HDassert(H5F_addr_defined(hdr_addr));
+HDassert(H5F_addr_defined(obj_addr));
+
+/* Check for debugging context callback available */
+if (cls->crt_dbg_ctx)
+ /* Create debugging context */
+ if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
+ H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context")
+
+/* Load the extensible array header */
+if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
+
+/* Sanity check */
+HDassert(H5F_addr_eq(hdr->idx_blk_addr, addr));
+
+/* Protect index block */
+if (NULL == (iblock = H5EA__iblock_protect(hdr, H5AC__READ_ONLY_FLAG)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu",
+ (unsigned long long)hdr->idx_blk_addr)
+
+/* Print opening message */
+HDfprintf(stream, "%*sExtensible Array Index Block...\n", indent, "");
+
+/* Print the values */
+HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name);
+HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Index Block size:", iblock->size);
+HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
+ "# of data block addresses in index block:", iblock->ndblk_addrs);
+HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
+ "# of super block addresses in index block:", iblock->nsblk_addrs);
+
+/* Check if there are any elements in index block */
+if (hdr->cparam.idx_blk_elmts > 0) {
+ unsigned u; /* Local index variable */
+
+ /* Print the elements in the index block */
+ HDfprintf(stream, "%*sElements in Index Block:\n", indent, "");
+ for (u = 0; u < hdr->cparam.idx_blk_elmts; u++) {
+ /* Call the class's 'debug' callback */
+ if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u,
+ ((uint8_t *)iblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0)
+ H5E_THROW(H5E_CANTGET, "can't get element for debugging")
+ } /* end for */
+} /* end if */
+
+/* Check if there are any data block addresses in index block */
+if (iblock->ndblk_addrs > 0) {
+ char temp_str[128]; /* Temporary string, for formatting */
+ unsigned u; /* Local index variable */
+
+ /* Print the data block addresses in the index block */
+ HDfprintf(stream, "%*sData Block Addresses in Index Block:\n", indent, "");
+ for (u = 0; u < iblock->ndblk_addrs; u++) {
+ /* Print address */
+ HDsprintf(temp_str, "Address #%u:", u);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str,
+ iblock->dblk_addrs[u]);
+ } /* end for */
+} /* end if */
+
+/* Check if there are any super block addresses in index block */
+if (iblock->nsblk_addrs > 0) {
+ char temp_str[128]; /* Temporary string, for formatting */
+ unsigned u; /* Local index variable */
+
+ /* Print the super block addresses in the index block */
+ HDfprintf(stream, "%*sSuper Block Addresses in Index Block:\n", indent, "");
+ for (u = 0; u < iblock->nsblk_addrs; u++) {
+ /* Print address */
+ HDsprintf(temp_str, "Address #%u:", u);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str,
+ iblock->sblk_addrs[u]);
+ } /* end for */
+} /* end if */
CATCH
- if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
- if(iblock && H5EA__iblock_unprotect(iblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block")
- if(hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
+ H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
+if (iblock && H5EA__iblock_unprotect(iblock, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block")
+if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
-END_FUNC(PKG) /* end H5EA__iblock_debug() */
+END_FUNC(PKG) /* end H5EA__iblock_debug() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_debug
*
@@ -308,84 +270,77 @@ END_FUNC(PKG) /* end H5EA__iblock_debug() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent,
- int fwidth, const H5EA_class_t *cls, haddr_t hdr_addr, unsigned sblk_idx, haddr_t obj_addr))
-
- /* Local variables */
- H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
- H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
- void *dbg_ctx = NULL; /* Extensible array context */
-
- /* Check arguments */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(stream);
- HDassert(indent >= 0);
- HDassert(fwidth >= 0);
- HDassert(cls);
- HDassert(H5F_addr_defined(hdr_addr));
- HDassert(H5F_addr_defined(obj_addr));
-
- /* Check for debugging context callback available */
- if(cls->crt_dbg_ctx)
- /* Create debugging context */
- if(NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
- H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context")
-
- /* Load the extensible array header */
- if(NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
-
- /* Protect super block */
- /* (Note: setting parent of super block to 'hdr' for this operation should be OK -QAK) */
- if(NULL == (sblock = H5EA__sblock_protect(hdr, (H5EA_iblock_t *)hdr, addr, sblk_idx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long long)addr)
-
- /* Print opening message */
- HDfprintf(stream, "%*sExtensible Array Super Block...\n", indent, "");
-
- /* Print the values */
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Array class ID:", hdr->cparam.cls->name);
- HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
- "Super Block size:",
- sblock->size);
- HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
- "# of data block addresses in super block:",
- sblock->ndblks);
- HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
- "# of elements in data blocks from this super block:",
- sblock->dblk_nelmts);
-
- /* Check if there are any data block addresses in super block */
- if(sblock->ndblks > 0) {
- char temp_str[128]; /* Temporary string, for formatting */
- unsigned u; /* Local index variable */
-
- /* Print the data block addresses in the super block */
- HDfprintf(stream, "%*sData Block Addresses in Super Block:\n", indent, "");
- for(u = 0; u < sblock->ndblks; u++) {
- /* Print address */
- HDsprintf(temp_str, "Address #%u:", u);
- HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)),
- temp_str,
- sblock->dblk_addrs[u]);
- } /* end for */
- } /* end if */
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
+ const H5EA_class_t *cls, haddr_t hdr_addr, unsigned sblk_idx, haddr_t obj_addr))
+
+/* Local variables */
+H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */
+H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
+void * dbg_ctx = NULL; /* Extensible array context */
+
+/* Check arguments */
+HDassert(f);
+HDassert(H5F_addr_defined(addr));
+HDassert(stream);
+HDassert(indent >= 0);
+HDassert(fwidth >= 0);
+HDassert(cls);
+HDassert(H5F_addr_defined(hdr_addr));
+HDassert(H5F_addr_defined(obj_addr));
+
+/* Check for debugging context callback available */
+if (cls->crt_dbg_ctx)
+ /* Create debugging context */
+ if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
+ H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context")
+
+/* Load the extensible array header */
+if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
+
+/* Protect super block */
+/* (Note: setting parent of super block to 'hdr' for this operation should be OK -QAK) */
+if (NULL == (sblock = H5EA__sblock_protect(hdr, (H5EA_iblock_t *)hdr, addr, sblk_idx, H5AC__READ_ONLY_FLAG)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu",
+ (unsigned long long)addr)
+
+/* Print opening message */
+HDfprintf(stream, "%*sExtensible Array Super Block...\n", indent, "");
+
+/* Print the values */
+HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name);
+HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Super Block size:", sblock->size);
+HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
+ "# of data block addresses in super block:", sblock->ndblks);
+HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
+ "# of elements in data blocks from this super block:", sblock->dblk_nelmts);
+
+/* Check if there are any data block addresses in super block */
+if (sblock->ndblks > 0) {
+ char temp_str[128]; /* Temporary string, for formatting */
+ unsigned u; /* Local index variable */
+
+ /* Print the data block addresses in the super block */
+ HDfprintf(stream, "%*sData Block Addresses in Super Block:\n", indent, "");
+ for (u = 0; u < sblock->ndblks; u++) {
+ /* Print address */
+ HDsprintf(temp_str, "Address #%u:", u);
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str,
+ sblock->dblk_addrs[u]);
+ } /* end for */
+} /* end if */
CATCH
- if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
- if(sblock && H5EA__sblock_unprotect(sblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block")
- if(hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
+ H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
+if (sblock && H5EA__sblock_unprotect(sblock, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block")
+if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
-END_FUNC(PKG) /* end H5EA__sblock_debug() */
+END_FUNC(PKG) /* end H5EA__sblock_debug() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_debug
*
@@ -398,71 +353,65 @@ END_FUNC(PKG) /* end H5EA__sblock_debug() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent,
- int fwidth, const H5EA_class_t *cls, haddr_t hdr_addr, size_t dblk_nelmts, haddr_t obj_addr))
-
- /* Local variables */
- H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
- H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
- void *dbg_ctx = NULL; /* Extensible array context */
- size_t u; /* Local index variable */
-
- /* Check arguments */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(stream);
- HDassert(indent >= 0);
- HDassert(fwidth >= 0);
- HDassert(cls);
- HDassert(H5F_addr_defined(hdr_addr));
- HDassert(H5F_addr_defined(obj_addr));
- HDassert(dblk_nelmts > 0);
-
- /* Check for debugging context callback available */
- if(cls->crt_dbg_ctx)
- /* Create debugging context */
- if(NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
- H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context")
-
- /* Load the extensible array header */
- if(NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
-
- /* Protect data block */
- /* (Note: setting parent of data block to 'hdr' for this operation should be OK -QAK) */
- if(NULL == (dblock = H5EA__dblock_protect(hdr, hdr, addr, dblk_nelmts, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %" PRIuHADDR, addr)
-
- /* Print opening message */
- HDfprintf(stream, "%*sExtensible Array data Block...\n", indent, "");
-
- /* Print the values */
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Array class ID:", hdr->cparam.cls->name);
- HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth,
- "Data Block size:",
- dblock->size);
-
-
- /* Print the elements in the index block */
- HDfprintf(stream, "%*sElements:\n", indent, "");
- for(u = 0; u < dblk_nelmts; u++) {
- /* Call the class's 'debug' callback */
- if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)),
- (hsize_t)u,
- ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0)
- H5E_THROW(H5E_CANTGET, "can't get element for debugging")
- } /* end for */
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
+ const H5EA_class_t *cls, haddr_t hdr_addr, size_t dblk_nelmts,
+ haddr_t obj_addr))
+
+/* Local variables */
+H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */
+H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
+void * dbg_ctx = NULL; /* Extensible array context */
+size_t u; /* Local index variable */
+
+/* Check arguments */
+HDassert(f);
+HDassert(H5F_addr_defined(addr));
+HDassert(stream);
+HDassert(indent >= 0);
+HDassert(fwidth >= 0);
+HDassert(cls);
+HDassert(H5F_addr_defined(hdr_addr));
+HDassert(H5F_addr_defined(obj_addr));
+HDassert(dblk_nelmts > 0);
+
+/* Check for debugging context callback available */
+if (cls->crt_dbg_ctx)
+ /* Create debugging context */
+ if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
+ H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context")
+
+/* Load the extensible array header */
+if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
+
+/* Protect data block */
+/* (Note: setting parent of data block to 'hdr' for this operation should be OK -QAK) */
+if (NULL == (dblock = H5EA__dblock_protect(hdr, hdr, addr, dblk_nelmts, H5AC__READ_ONLY_FLAG)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %" PRIuHADDR, addr)
+
+/* Print opening message */
+HDfprintf(stream, "%*sExtensible Array data Block...\n", indent, "");
+
+/* Print the values */
+HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name);
+HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Data Block size:", dblock->size);
+
+/* Print the elements in the index block */
+HDfprintf(stream, "%*sElements:\n", indent, "");
+for (u = 0; u < dblk_nelmts; u++) {
+ /* Call the class's 'debug' callback */
+ if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u,
+ ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0)
+ H5E_THROW(H5E_CANTGET, "can't get element for debugging")
+} /* end for */
CATCH
- if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
- if(dblock && H5EA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block")
- if(hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
-
-END_FUNC(PKG) /* end H5EA__dblock_debug() */
-
+if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
+ H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
+if (dblock && H5EA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block")
+if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+
+END_FUNC(PKG) /* end H5EA__dblock_debug() */
diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c
index ee5c904..43b59d6 100644
--- a/src/H5EAdblkpage.c
+++ b/src/H5EAdblkpage.c
@@ -26,54 +26,45 @@
/* Module Declaration */
/**********************/
-#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
-
+#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
/***********************/
/* Other Packages Used */
/***********************/
-
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5EApkg.h" /* Extensible Arrays */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5VMprivate.h" /* Vectors and arrays */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5EApkg.h" /* Extensible Arrays */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5VMprivate.h" /* Vectors and arrays */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -81,8 +72,6 @@
/* Declare a free list to manage the H5EA_dblk_page_t struct */
H5FL_DEFINE_STATIC(H5EA_dblk_page_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5EA__dblk_page_alloc
*
@@ -95,43 +84,41 @@ H5FL_DEFINE_STATIC(H5EA_dblk_page_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-H5EA_dblk_page_t *, NULL, NULL,
-H5EA__dblk_page_alloc(H5EA_hdr_t *hdr, H5EA_sblock_t *parent))
+BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL,
+ H5EA__dblk_page_alloc(H5EA_hdr_t *hdr, H5EA_sblock_t *parent))
- /* Local variables */
- H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */
+/* Local variables */
+H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */
- /* Check arguments */
- HDassert(hdr);
+/* Check arguments */
+HDassert(hdr);
- /* Allocate memory for the data block */
- if(NULL == (dblk_page = H5FL_CALLOC(H5EA_dblk_page_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page")
+/* Allocate memory for the data block */
+if (NULL == (dblk_page = H5FL_CALLOC(H5EA_dblk_page_t)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page")
- /* Share common array information */
- if(H5EA__hdr_incr(hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
- dblk_page->hdr = hdr;
+/* Share common array information */
+if (H5EA__hdr_incr(hdr) < 0)
+ H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+dblk_page->hdr = hdr;
- /* Set non-zero internal fields */
- dblk_page->parent = parent;
+/* Set non-zero internal fields */
+dblk_page->parent = parent;
- /* Allocate buffer for elements in data block page */
- if(NULL == (dblk_page->elmts = H5EA__hdr_alloc_elmts(hdr, hdr->dblk_page_nelmts)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block page element buffer")
+/* Allocate buffer for elements in data block page */
+if (NULL == (dblk_page->elmts = H5EA__hdr_alloc_elmts(hdr, hdr->dblk_page_nelmts)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block page element buffer")
- /* Set the return value */
- ret_value = dblk_page;
+/* Set the return value */
+ret_value = dblk_page;
CATCH
- if(!ret_value)
- if(dblk_page && H5EA__dblk_page_dest(dblk_page) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page")
+if (!ret_value)
+ if (dblk_page && H5EA__dblk_page_dest(dblk_page) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page")
-END_FUNC(PKG) /* end H5EA__dblk_page_alloc() */
+END_FUNC(PKG) /* end H5EA__dblk_page_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__dblk_page_create
*
@@ -144,57 +131,55 @@ END_FUNC(PKG) /* end H5EA__dblk_page_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__dblk_page_create(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t addr))
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__dblk_page_create(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t addr))
- /* Local variables */
- H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+/* Local variables */
+H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */
+hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
- /* Sanity check */
- HDassert(hdr);
+/* Sanity check */
+HDassert(hdr);
- /* Allocate the data block page */
- if(NULL == (dblk_page = H5EA__dblk_page_alloc(hdr, parent)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page")
+/* Allocate the data block page */
+if (NULL == (dblk_page = H5EA__dblk_page_alloc(hdr, parent)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page")
- /* Set info about data block page on disk */
- dblk_page->addr = addr;
- dblk_page->size = H5EA_DBLK_PAGE_SIZE(hdr);
+/* Set info about data block page on disk */
+dblk_page->addr = addr;
+dblk_page->size = H5EA_DBLK_PAGE_SIZE(hdr);
- /* Clear any elements in data block page to fill value */
- if((hdr->cparam.cls->fill)(dblk_page->elmts, (size_t)hdr->dblk_page_nelmts) < 0)
- H5E_THROW(H5E_CANTSET, "can't set extensible array data block page elements to class's fill value")
+/* Clear any elements in data block page to fill value */
+if ((hdr->cparam.cls->fill)(dblk_page->elmts, (size_t)hdr->dblk_page_nelmts) < 0)
+ H5E_THROW(H5E_CANTSET, "can't set extensible array data block page elements to class's fill value")
- /* Cache the new extensible array data block page */
- if(H5AC_insert_entry(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block page to cache")
- inserted = TRUE;
+/* Cache the new extensible array data block page */
+if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block page to cache")
+inserted = TRUE;
- /* Add data block page as child of 'top' proxy */
- if(hdr->top_proxy) {
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
- dblk_page->top_proxy = hdr->top_proxy;
- } /* end if */
+/* Add data block page as child of 'top' proxy */
+if (hdr->top_proxy) {
+ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0)
+ H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ dblk_page->top_proxy = hdr->top_proxy;
+} /* end if */
CATCH
- if(ret_value < 0)
- if(dblk_page) {
- /* Remove from cache, if inserted */
- if(inserted)
- if(H5AC_remove_entry(dblk_page) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array data block page from cache")
-
- /* Destroy data block page */
- if(H5EA__dblk_page_dest(dblk_page) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page")
- } /* end if */
+if (ret_value < 0)
+ if (dblk_page) {
+ /* Remove from cache, if inserted */
+ if (inserted)
+ if (H5AC_remove_entry(dblk_page) < 0)
+ H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array data block page from cache")
+
+ /* Destroy data block page */
+ if (H5EA__dblk_page_dest(dblk_page) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page")
+ } /* end if */
-END_FUNC(PKG) /* end H5EA__dblk_page_create() */
+END_FUNC(PKG) /* end H5EA__dblk_page_create() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__dblk_page_protect
*
@@ -208,53 +193,55 @@ END_FUNC(PKG) /* end H5EA__dblk_page_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-H5EA_dblk_page_t *, NULL, NULL,
-H5EA__dblk_page_protect(H5EA_hdr_t *hdr, H5EA_sblock_t *parent,
- haddr_t dblk_page_addr, unsigned flags))
-
- /* Local variables */
- H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */
- H5EA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */
-
- /* Sanity check */
- HDassert(hdr);
- HDassert(H5F_addr_defined(dblk_page_addr));
-
- /* only the H5AC__READ_ONLY_FLAG may be set */
- HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
-
- /* Set up user data */
- udata.hdr = hdr;
- udata.parent = parent;
- udata.dblk_page_addr = dblk_page_addr;
-
- /* Protect the data block page */
- if(NULL == (dblk_page = (H5EA_dblk_page_t *)H5AC_protect(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, &udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu", (unsigned long long)dblk_page_addr)
-
- /* Create top proxy, if it doesn't exist */
- if(hdr->top_proxy && NULL == dblk_page->top_proxy) {
- /* Add data block page as child of 'top' proxy */
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
- dblk_page->top_proxy = hdr->top_proxy;
- } /* end if */
+BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL,
+ H5EA__dblk_page_protect(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t dblk_page_addr,
+ unsigned flags))
+
+/* Local variables */
+H5EA_dblk_page_t * dblk_page = NULL; /* Extensible array data block page */
+H5EA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */
+
+/* Sanity check */
+HDassert(hdr);
+HDassert(H5F_addr_defined(dblk_page_addr));
+
+/* only the H5AC__READ_ONLY_FLAG may be set */
+HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
+
+/* Set up user data */
+udata.hdr = hdr;
+udata.parent = parent;
+udata.dblk_page_addr = dblk_page_addr;
+
+/* Protect the data block page */
+if (NULL == (dblk_page = (H5EA_dblk_page_t *)H5AC_protect(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr,
+ &udata, flags)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu",
+ (unsigned long long)dblk_page_addr)
+
+/* Create top proxy, if it doesn't exist */
+if (hdr->top_proxy && NULL == dblk_page->top_proxy) {
+ /* Add data block page as child of 'top' proxy */
+ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0)
+ H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ dblk_page->top_proxy = hdr->top_proxy;
+} /* end if */
- /* Set return value */
- ret_value = dblk_page;
+/* Set return value */
+ret_value = dblk_page;
CATCH
- /* Clean up on error */
- if(!ret_value) {
- /* Release the data block page, if it was protected */
- if(dblk_page && H5AC_unprotect(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block page, address = %llu", (unsigned long long)dblk_page->addr)
- } /* end if */
+/* Clean up on error */
+if (!ret_value) {
+ /* Release the data block page, if it was protected */
+ if (dblk_page &&
+ H5AC_unprotect(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block page, address = %llu",
+ (unsigned long long)dblk_page->addr)
+} /* end if */
-END_FUNC(PKG) /* end H5EA__dblk_page_protect() */
+END_FUNC(PKG) /* end H5EA__dblk_page_protect() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__dblk_page_unprotect
*
@@ -268,24 +255,23 @@ END_FUNC(PKG) /* end H5EA__dblk_page_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__dblk_page_unprotect(H5EA_dblk_page_t *dblk_page, unsigned cache_flags))
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__dblk_page_unprotect(H5EA_dblk_page_t *dblk_page, unsigned cache_flags))
- /* Local variables */
+/* Local variables */
- /* Sanity check */
- HDassert(dblk_page);
+/* Sanity check */
+HDassert(dblk_page);
- /* Unprotect the data block page */
- if(H5AC_unprotect(dblk_page->hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block page, address = %llu", (unsigned long long)dblk_page->addr)
+/* Unprotect the data block page */
+if (H5AC_unprotect(dblk_page->hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, cache_flags) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block page, address = %llu",
+ (unsigned long long)dblk_page->addr)
CATCH
-END_FUNC(PKG) /* end H5EA__dblk_page_unprotect() */
+END_FUNC(PKG) /* end H5EA__dblk_page_unprotect() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__dblk_page_dest
*
@@ -298,37 +284,34 @@ END_FUNC(PKG) /* end H5EA__dblk_page_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page))
-
- /* Sanity check */
- HDassert(dblk_page);
- HDassert(!dblk_page->has_hdr_depend);
-
- /* Check if header field has been initialized */
- if(dblk_page->hdr) {
- /* Check if buffer for data block page elements has been initialized */
- if(dblk_page->elmts) {
- /* Free buffer for data block page elements */
- if(H5EA__hdr_free_elmts(dblk_page->hdr, dblk_page->hdr->dblk_page_nelmts, dblk_page->elmts) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to free extensible array data block element buffer")
- dblk_page->elmts = NULL;
- } /* end if */
-
- /* Decrement reference count on shared info */
- if(H5EA__hdr_decr(dblk_page->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
- dblk_page->hdr = NULL;
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page))
+
+/* Sanity check */
+HDassert(dblk_page);
+HDassert(!dblk_page->has_hdr_depend);
+
+/* Check if header field has been initialized */
+if (dblk_page->hdr) {
+ /* Check if buffer for data block page elements has been initialized */
+ if (dblk_page->elmts) {
+ /* Free buffer for data block page elements */
+ if (H5EA__hdr_free_elmts(dblk_page->hdr, dblk_page->hdr->dblk_page_nelmts, dblk_page->elmts) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to free extensible array data block element buffer")
+ dblk_page->elmts = NULL;
} /* end if */
- /* Sanity check */
- HDassert(NULL == dblk_page->top_proxy);
+ /* Decrement reference count on shared info */
+ if (H5EA__hdr_decr(dblk_page->hdr) < 0)
+ H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ dblk_page->hdr = NULL;
+} /* end if */
- /* Free the data block page itself */
- dblk_page = H5FL_FREE(H5EA_dblk_page_t, dblk_page);
+/* Sanity check */
+HDassert(NULL == dblk_page->top_proxy);
-CATCH
+/* Free the data block page itself */
+dblk_page = H5FL_FREE(H5EA_dblk_page_t, dblk_page);
-END_FUNC(PKG) /* end H5EA__dblk_page_dest() */
+CATCH
+END_FUNC(PKG) /* end H5EA__dblk_page_dest() */
diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c
index d540a3c..2897aba 100644
--- a/src/H5EAdblock.c
+++ b/src/H5EAdblock.c
@@ -26,55 +26,46 @@
/* Module Declaration */
/**********************/
-#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
-
+#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
/***********************/
/* Other Packages Used */
/***********************/
-
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5EApkg.h" /* Extensible Arrays */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5VMprivate.h" /* Vectors and arrays */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5EApkg.h" /* Extensible Arrays */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5VMprivate.h" /* Vectors and arrays */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -82,8 +73,6 @@
/* Declare a free list to manage the H5EA_dblock_t struct */
H5FL_DEFINE_STATIC(H5EA_dblock_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_alloc
*
@@ -96,54 +85,52 @@ H5FL_DEFINE_STATIC(H5EA_dblock_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-H5EA_dblock_t *, NULL, NULL,
-H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent, size_t nelmts))
-
- /* Local variables */
- H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
-
- /* Check arguments */
- HDassert(hdr);
- HDassert(parent);
- HDassert(nelmts > 0);
-
- /* Allocate memory for the data block */
- if(NULL == (dblock = H5FL_CALLOC(H5EA_dblock_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block")
-
- /* Share common array information */
- if(H5EA__hdr_incr(hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
- dblock->hdr = hdr;
-
- /* Set non-zero internal fields */
- dblock->parent = parent;
- dblock->nelmts = nelmts;
-
- /* Check if the data block is not going to be paged */
- if(nelmts > hdr->dblk_page_nelmts) {
- /* Set the # of pages in the direct block */
- dblock->npages = nelmts / hdr->dblk_page_nelmts;
- HDassert(nelmts == (dblock->npages * hdr->dblk_page_nelmts));
- } /* end if */
- else {
- /* Allocate buffer for elements in data block */
- if(NULL == (dblock->elmts = H5EA__hdr_alloc_elmts(hdr, nelmts)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block element buffer")
- } /* end else */
-
- /* Set the return value */
- ret_value = dblock;
+BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL,
+ H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent, size_t nelmts))
+
+/* Local variables */
+H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
+
+/* Check arguments */
+HDassert(hdr);
+HDassert(parent);
+HDassert(nelmts > 0);
+
+/* Allocate memory for the data block */
+if (NULL == (dblock = H5FL_CALLOC(H5EA_dblock_t)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block")
+
+/* Share common array information */
+if (H5EA__hdr_incr(hdr) < 0)
+ H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+dblock->hdr = hdr;
+
+/* Set non-zero internal fields */
+dblock->parent = parent;
+dblock->nelmts = nelmts;
+
+/* Check if the data block is not going to be paged */
+if (nelmts > hdr->dblk_page_nelmts) {
+ /* Set the # of pages in the direct block */
+ dblock->npages = nelmts / hdr->dblk_page_nelmts;
+ HDassert(nelmts == (dblock->npages * hdr->dblk_page_nelmts));
+} /* end if */
+else {
+ /* Allocate buffer for elements in data block */
+ if (NULL == (dblock->elmts = H5EA__hdr_alloc_elmts(hdr, nelmts)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block element buffer")
+} /* end else */
+
+/* Set the return value */
+ret_value = dblock;
CATCH
- if(!ret_value)
- if(dblock && H5EA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block")
+if (!ret_value)
+ if (dblock && H5EA__dblock_dest(dblock) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block")
-END_FUNC(PKG) /* end H5EA__dblock_alloc() */
+END_FUNC(PKG) /* end H5EA__dblock_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_create
*
@@ -156,87 +143,86 @@ END_FUNC(PKG) /* end H5EA__dblock_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-haddr_t, HADDR_UNDEF, HADDR_UNDEF,
-H5EA__dblock_create(H5EA_hdr_t *hdr, void *parent, hbool_t *stats_changed,
- hsize_t dblk_off, size_t nelmts))
-
- /* Local variables */
- H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
- haddr_t dblock_addr; /* Extensible array data block address */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
-
- /* Sanity check */
- HDassert(hdr);
- HDassert(stats_changed);
- HDassert(nelmts > 0);
-
- /* Allocate the data block */
- if(NULL == (dblock = H5EA__dblock_alloc(hdr, parent, nelmts)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block")
-
- /* Set size of data block on disk */
- dblock->size = H5EA_DBLOCK_SIZE(dblock);
-
- /* Set offset of block in array's address space */
- dblock->block_off = dblk_off;
-
- /* Allocate space for the data block on disk */
- if(HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_DBLOCK, (hsize_t)dblock->size)))
- H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array data block")
- dblock->addr = dblock_addr;
-
- /* Don't initialize elements if paged */
- if(!dblock->npages)
- /* Clear any elements in data block to fill value */
- if((hdr->cparam.cls->fill)(dblock->elmts, (size_t)dblock->nelmts) < 0)
- H5E_THROW(H5E_CANTSET, "can't set extensible array data block elements to class's fill value")
-
- /* Cache the new extensible array data block */
- if(H5AC_insert_entry(hdr->f, H5AC_EARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block to cache")
- inserted = TRUE;
-
- /* Add data block as child of 'top' proxy */
- if(hdr->top_proxy) {
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
- dblock->top_proxy = hdr->top_proxy;
- } /* end if */
-
- /* Update extensible array data block statistics */
- hdr->stats.stored.ndata_blks++;
- hdr->stats.stored.data_blk_size += dblock->size;
-
- /* Increment count of elements "realized" */
- hdr->stats.stored.nelmts += nelmts;
-
- /* Mark the statistics as changed */
- *stats_changed = TRUE;
-
- /* Set address of data block to return */
- ret_value = dblock_addr;
+BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
+ H5EA__dblock_create(H5EA_hdr_t *hdr, void *parent, hbool_t *stats_changed, hsize_t dblk_off,
+ size_t nelmts))
+
+/* Local variables */
+H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
+haddr_t dblock_addr; /* Extensible array data block address */
+hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+
+/* Sanity check */
+HDassert(hdr);
+HDassert(stats_changed);
+HDassert(nelmts > 0);
+
+/* Allocate the data block */
+if (NULL == (dblock = H5EA__dblock_alloc(hdr, parent, nelmts)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block")
+
+/* Set size of data block on disk */
+dblock->size = H5EA_DBLOCK_SIZE(dblock);
+
+/* Set offset of block in array's address space */
+dblock->block_off = dblk_off;
+
+/* Allocate space for the data block on disk */
+if (HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_DBLOCK, (hsize_t)dblock->size)))
+ H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array data block")
+dblock->addr = dblock_addr;
+
+/* Don't initialize elements if paged */
+if (!dblock->npages)
+ /* Clear any elements in data block to fill value */
+ if ((hdr->cparam.cls->fill)(dblock->elmts, (size_t)dblock->nelmts) < 0)
+ H5E_THROW(H5E_CANTSET, "can't set extensible array data block elements to class's fill value")
+
+/* Cache the new extensible array data block */
+if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block to cache")
+inserted = TRUE;
+
+/* Add data block as child of 'top' proxy */
+if (hdr->top_proxy) {
+ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0)
+ H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ dblock->top_proxy = hdr->top_proxy;
+} /* end if */
+
+/* Update extensible array data block statistics */
+hdr->stats.stored.ndata_blks++;
+hdr->stats.stored.data_blk_size += dblock->size;
+
+/* Increment count of elements "realized" */
+hdr->stats.stored.nelmts += nelmts;
+
+/* Mark the statistics as changed */
+*stats_changed = TRUE;
+
+/* Set address of data block to return */
+ret_value = dblock_addr;
CATCH
- if(!H5F_addr_defined(ret_value))
- if(dblock) {
- /* Remove from cache, if inserted */
- if(inserted)
- if(H5AC_remove_entry(dblock) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array data block from cache")
-
- /* Release data block's disk space */
- if(H5F_addr_defined(dblock->addr) && H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_DBLOCK, dblock->addr, (hsize_t)dblock->size) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to release extensible array data block")
-
- /* Destroy data block */
- if(H5EA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block")
- } /* end if */
+if (!H5F_addr_defined(ret_value))
+ if (dblock) {
+ /* Remove from cache, if inserted */
+ if (inserted)
+ if (H5AC_remove_entry(dblock) < 0)
+ H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array data block from cache")
+
+ /* Release data block's disk space */
+ if (H5F_addr_defined(dblock->addr) &&
+ H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_DBLOCK, dblock->addr, (hsize_t)dblock->size) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to release extensible array data block")
+
+ /* Destroy data block */
+ if (H5EA__dblock_dest(dblock) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block")
+ } /* end if */
-END_FUNC(PKG) /* end H5EA__dblock_create() */
+END_FUNC(PKG) /* end H5EA__dblock_create() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_sblk_idx
*
@@ -250,30 +236,27 @@ END_FUNC(PKG) /* end H5EA__dblock_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR,
-unsigned, 0, -,
-H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx))
+BEGIN_FUNC(PKG, NOERR, unsigned, 0, -, H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx))
- /* Local variables */
- unsigned sblk_idx; /* Which superblock does this index fall in? */
+/* Local variables */
+unsigned sblk_idx; /* Which superblock does this index fall in? */
- /* Sanity check */
- HDassert(hdr);
- HDassert(idx >= hdr->cparam.idx_blk_elmts);
+/* Sanity check */
+HDassert(hdr);
+HDassert(idx >= hdr->cparam.idx_blk_elmts);
- /* Adjust index for elements in index block */
- idx -= hdr->cparam.idx_blk_elmts;
+/* Adjust index for elements in index block */
+idx -= hdr->cparam.idx_blk_elmts;
- /* Determine the superblock information for the index */
- H5_CHECK_OVERFLOW(idx, /*From:*/hsize_t, /*To:*/uint64_t);
- sblk_idx = H5VM_log2_gen((uint64_t)((idx / hdr->cparam.data_blk_min_elmts) + 1));
+/* Determine the superblock information for the index */
+H5_CHECK_OVERFLOW(idx, /*From:*/ hsize_t, /*To:*/ uint64_t);
+sblk_idx = H5VM_log2_gen((uint64_t)((idx / hdr->cparam.data_blk_min_elmts) + 1));
- /* Set return value */
- ret_value = sblk_idx;
+/* Set return value */
+ret_value = sblk_idx;
-END_FUNC(PKG) /* end H5EA__dblock_sblk_idx() */
+END_FUNC(PKG) /* end H5EA__dblock_sblk_idx() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_protect
*
@@ -286,56 +269,56 @@ END_FUNC(PKG) /* end H5EA__dblock_sblk_idx() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-H5EA_dblock_t *, NULL, NULL,
-H5EA__dblock_protect(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr,
- size_t dblk_nelmts, unsigned flags))
-
- /* Local variables */
- H5EA_dblock_t *dblock; /* Extensible array data block */
- H5EA_dblock_cache_ud_t udata; /* Information needed for loading data block */
-
- /* Sanity check */
- HDassert(hdr);
- HDassert(H5F_addr_defined(dblk_addr));
- HDassert(dblk_nelmts);
-
- /* only the H5AC__READ_ONLY_FLAG may be set */
- HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
-
- /* Set up user data */
- udata.hdr = hdr;
- udata.parent = parent;
- udata.nelmts = dblk_nelmts;
- udata.dblk_addr = dblk_addr;
-
- /* Protect the data block */
- if(NULL == (dblock = (H5EA_dblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_DBLOCK, dblk_addr, &udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)dblk_addr)
-
- /* Create top proxy, if it doesn't exist */
- if(hdr->top_proxy && NULL == dblock->top_proxy) {
- /* Add data block as child of 'top' proxy */
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
- dblock->top_proxy = hdr->top_proxy;
- } /* end if */
+BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL,
+ H5EA__dblock_protect(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts,
+ unsigned flags))
+
+/* Local variables */
+H5EA_dblock_t * dblock; /* Extensible array data block */
+H5EA_dblock_cache_ud_t udata; /* Information needed for loading data block */
+
+/* Sanity check */
+HDassert(hdr);
+HDassert(H5F_addr_defined(dblk_addr));
+HDassert(dblk_nelmts);
+
+/* only the H5AC__READ_ONLY_FLAG may be set */
+HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
+
+/* Set up user data */
+udata.hdr = hdr;
+udata.parent = parent;
+udata.nelmts = dblk_nelmts;
+udata.dblk_addr = dblk_addr;
+
+/* Protect the data block */
+if (NULL == (dblock = (H5EA_dblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_DBLOCK, dblk_addr, &udata, flags)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu",
+ (unsigned long long)dblk_addr)
+
+/* Create top proxy, if it doesn't exist */
+if (hdr->top_proxy && NULL == dblock->top_proxy) {
+ /* Add data block as child of 'top' proxy */
+ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0)
+ H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ dblock->top_proxy = hdr->top_proxy;
+} /* end if */
- /* Set return value */
- ret_value = dblock;
+/* Set return value */
+ret_value = dblock;
CATCH
- /* Clean up on error */
- if(!ret_value) {
- /* Release the data block, if it was protected */
- if(dblock && H5AC_unprotect(hdr->f, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block, address = %llu", (unsigned long long)dblock->addr)
- } /* end if */
+/* Clean up on error */
+if (!ret_value) {
+ /* Release the data block, if it was protected */
+ if (dblock && H5AC_unprotect(hdr->f, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block, address = %llu",
+ (unsigned long long)dblock->addr)
+} /* end if */
-END_FUNC(PKG) /* end H5EA__dblock_protect() */
+END_FUNC(PKG) /* end H5EA__dblock_protect() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_unprotect
*
@@ -348,24 +331,23 @@ END_FUNC(PKG) /* end H5EA__dblock_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__dblock_unprotect(H5EA_dblock_t *dblock, unsigned cache_flags))
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__dblock_unprotect(H5EA_dblock_t *dblock, unsigned cache_flags))
- /* Local variables */
+/* Local variables */
- /* Sanity check */
- HDassert(dblock);
+/* Sanity check */
+HDassert(dblock);
- /* Unprotect the data block */
- if(H5AC_unprotect(dblock->hdr->f, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block, address = %llu", (unsigned long long)dblock->addr)
+/* Unprotect the data block */
+if (H5AC_unprotect(dblock->hdr->f, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, cache_flags) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block, address = %llu",
+ (unsigned long long)dblock->addr)
CATCH
-END_FUNC(PKG) /* end H5EA__dblock_unprotect() */
+END_FUNC(PKG) /* end H5EA__dblock_unprotect() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_delete
*
@@ -378,56 +360,54 @@ END_FUNC(PKG) /* end H5EA__dblock_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__dblock_delete(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr,
- size_t dblk_nelmts))
-
- /* Local variables */
- H5EA_dblock_t *dblock = NULL; /* Pointer to data block */
-
- /* Sanity check */
- HDassert(hdr);
- HDassert(parent);
- HDassert(H5F_addr_defined(dblk_addr));
- HDassert(dblk_nelmts > 0);
-
- /* Protect data block */
- if(NULL == (dblock = H5EA__dblock_protect(hdr, parent, dblk_addr, dblk_nelmts, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)dblk_addr)
-
- /* Check if this is a paged data block */
- if(dblk_nelmts > hdr->dblk_page_nelmts) {
- size_t npages = dblk_nelmts / hdr->dblk_page_nelmts; /* Number of pages in data block */
- haddr_t dblk_page_addr; /* Address of each data block page */
- size_t dblk_page_size; /* Size of each data block page */
- size_t u; /* Local index variable */
-
- /* Set up initial state */
- dblk_page_addr = dblk_addr + H5EA_DBLOCK_PREFIX_SIZE(dblock);
- dblk_page_size = (hdr->dblk_page_nelmts * hdr->cparam.raw_elmt_size)
- + H5EA_SIZEOF_CHKSUM;
-
- /* Iterate over pages in data block */
- for(u = 0; u < npages; u++) {
- /* Evict the data block page from the metadata cache */
- /* (OK to call if it doesn't exist in the cache) */
- if(H5AC_expunge_entry(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTEXPUNGE, "unable to remove array data block page from metadata cache")
-
- /* Advance to next page address */
- dblk_page_addr += dblk_page_size;
- } /* end for */
- } /* end if */
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__dblock_delete(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts))
+
+/* Local variables */
+H5EA_dblock_t *dblock = NULL; /* Pointer to data block */
+
+/* Sanity check */
+HDassert(hdr);
+HDassert(parent);
+HDassert(H5F_addr_defined(dblk_addr));
+HDassert(dblk_nelmts > 0);
+
+/* Protect data block */
+if (NULL == (dblock = H5EA__dblock_protect(hdr, parent, dblk_addr, dblk_nelmts, H5AC__NO_FLAGS_SET)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu",
+ (unsigned long long)dblk_addr)
+
+/* Check if this is a paged data block */
+if (dblk_nelmts > hdr->dblk_page_nelmts) {
+ size_t npages = dblk_nelmts / hdr->dblk_page_nelmts; /* Number of pages in data block */
+ haddr_t dblk_page_addr; /* Address of each data block page */
+ size_t dblk_page_size; /* Size of each data block page */
+ size_t u; /* Local index variable */
+
+ /* Set up initial state */
+ dblk_page_addr = dblk_addr + H5EA_DBLOCK_PREFIX_SIZE(dblock);
+ dblk_page_size = (hdr->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5EA_SIZEOF_CHKSUM;
+
+ /* Iterate over pages in data block */
+ for (u = 0; u < npages; u++) {
+ /* Evict the data block page from the metadata cache */
+ /* (OK to call if it doesn't exist in the cache) */
+ if (H5AC_expunge_entry(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTEXPUNGE, "unable to remove array data block page from metadata cache")
+
+ /* Advance to next page address */
+ dblk_page_addr += dblk_page_size;
+ } /* end for */
+} /* end if */
CATCH
- /* Finished deleting data block in metadata cache */
- if(dblock && H5EA__dblock_unprotect(dblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block")
+/* Finished deleting data block in metadata cache */
+if (dblock &&
+ H5EA__dblock_unprotect(dblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block")
-END_FUNC(PKG) /* end H5EA__dblock_delete() */
+END_FUNC(PKG) /* end H5EA__dblock_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_dest
*
@@ -440,39 +420,36 @@ END_FUNC(PKG) /* end H5EA__dblock_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__dblock_dest(H5EA_dblock_t *dblock))
-
- /* Sanity check */
- HDassert(dblock);
- HDassert(!dblock->has_hdr_depend);
-
- /* Check if shared header field has been initialized */
- if(dblock->hdr) {
- /* Check if we've got elements in the data block */
- if(dblock->elmts && !dblock->npages) {
- /* Free buffer for data block elements */
- HDassert(dblock->nelmts > 0);
- if(H5EA__hdr_free_elmts(dblock->hdr, dblock->nelmts, dblock->elmts) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to free extensible array data block element buffer")
- dblock->elmts = NULL;
- dblock->nelmts = 0;
- } /* end if */
-
- /* Decrement reference count on shared info */
- if(H5EA__hdr_decr(dblock->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
- dblock->hdr = NULL;
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblock_dest(H5EA_dblock_t *dblock))
+
+/* Sanity check */
+HDassert(dblock);
+HDassert(!dblock->has_hdr_depend);
+
+/* Check if shared header field has been initialized */
+if (dblock->hdr) {
+ /* Check if we've got elements in the data block */
+ if (dblock->elmts && !dblock->npages) {
+ /* Free buffer for data block elements */
+ HDassert(dblock->nelmts > 0);
+ if (H5EA__hdr_free_elmts(dblock->hdr, dblock->nelmts, dblock->elmts) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to free extensible array data block element buffer")
+ dblock->elmts = NULL;
+ dblock->nelmts = 0;
} /* end if */
- /* Sanity check */
- HDassert(NULL == dblock->top_proxy);
+ /* Decrement reference count on shared info */
+ if (H5EA__hdr_decr(dblock->hdr) < 0)
+ H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ dblock->hdr = NULL;
+} /* end if */
- /* Free the data block itself */
- dblock = H5FL_FREE(H5EA_dblock_t, dblock);
+/* Sanity check */
+HDassert(NULL == dblock->top_proxy);
-CATCH
+/* Free the data block itself */
+dblock = H5FL_FREE(H5EA_dblock_t, dblock);
-END_FUNC(PKG) /* end H5EA__dblock_dest() */
+CATCH
+END_FUNC(PKG) /* end H5EA__dblock_dest() */
diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c
index 8b4d5f7..1a7839f 100644
--- a/src/H5EAhdr.c
+++ b/src/H5EAhdr.c
@@ -26,24 +26,21 @@
/* Module Declaration */
/**********************/
-#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
-
+#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
/***********************/
/* Other Packages Used */
/***********************/
-
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5EApkg.h" /* Extensible Arrays */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5VMprivate.h" /* Vectors and arrays */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5EApkg.h" /* Extensible Arrays */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VMprivate.h" /* Vectors and arrays */
/****************/
/* Local Macros */
@@ -55,9 +52,7 @@
#endif /* NDEBUG */
/* # of elements in a data block for a particular super block */
-#define H5EA_SBLK_DBLK_NELMTS(s, m) \
- (size_t)H5_EXP2(((s) + 1) / 2) * (m)
-
+#define H5EA_SBLK_DBLK_NELMTS(s, m) (size_t) H5_EXP2(((s) + 1) / 2) * (m)
/******************/
/* Local Typedefs */
@@ -66,27 +61,22 @@
/* Alias for pointer to factory, for use when allocating sequences of them */
typedef H5FL_fac_head_t *H5FL_fac_head_ptr_t;
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -100,8 +90,6 @@ H5FL_SEQ_DEFINE_STATIC(H5FL_fac_head_ptr_t);
/* Declare a free list to manage the H5EA_sblk_info_t sequence information */
H5FL_SEQ_DEFINE_STATIC(H5EA_sblk_info_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_alloc
*
@@ -114,40 +102,37 @@ H5FL_SEQ_DEFINE_STATIC(H5EA_sblk_info_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-H5EA_hdr_t *, NULL, NULL,
-H5EA__hdr_alloc(H5F_t *f))
+BEGIN_FUNC(PKG, ERR, H5EA_hdr_t *, NULL, NULL, H5EA__hdr_alloc(H5F_t *f))
- /* Local variables */
- H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
+/* Local variables */
+H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
- /* Check arguments */
- HDassert(f);
+/* Check arguments */
+HDassert(f);
- /* Allocate space for the shared information */
- if(NULL == (hdr = H5FL_CALLOC(H5EA_hdr_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header")
+/* Allocate space for the shared information */
+if (NULL == (hdr = H5FL_CALLOC(H5EA_hdr_t)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header")
- /* Set non-zero internal fields */
- hdr->addr = HADDR_UNDEF;
+/* Set non-zero internal fields */
+hdr->addr = HADDR_UNDEF;
- /* Set the internal parameters for the array */
- hdr->f = f;
- hdr->swmr_write = (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) > 0;
- hdr->sizeof_addr = H5F_SIZEOF_ADDR(f);
- hdr->sizeof_size = H5F_SIZEOF_SIZE(f);
+/* Set the internal parameters for the array */
+hdr->f = f;
+hdr->swmr_write = (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) > 0;
+hdr->sizeof_addr = H5F_SIZEOF_ADDR(f);
+hdr->sizeof_size = H5F_SIZEOF_SIZE(f);
- /* Set the return value */
- ret_value = hdr;
+/* Set the return value */
+ret_value = hdr;
CATCH
- if(!ret_value)
- if(hdr && H5EA__hdr_dest(hdr) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header")
+if (!ret_value)
+ if (hdr && H5EA__hdr_dest(hdr) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header")
-END_FUNC(PKG) /* end H5EA__hdr_alloc() */
+END_FUNC(PKG) /* end H5EA__hdr_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_init
*
@@ -183,58 +168,55 @@ END_FUNC(PKG) /* end H5EA__hdr_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata))
-
- /* Local variables */
- hsize_t start_idx; /* First element index for each super block */
- hsize_t start_dblk; /* First data block index for each super block */
- size_t u; /* Local index variable */
-
- /* Sanity check */
- HDassert(hdr);
- HDassert(hdr->cparam.max_nelmts_bits);
- HDassert(hdr->cparam.data_blk_min_elmts);
- HDassert(hdr->cparam.sup_blk_min_data_ptrs);
-
- /* Compute general information */
- hdr->nsblks = 1 + (hdr->cparam.max_nelmts_bits - H5VM_log2_of2(hdr->cparam.data_blk_min_elmts));
- hdr->dblk_page_nelmts = (size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits;
- hdr->arr_off_size = (unsigned char)H5EA_SIZEOF_OFFSET_BITS(hdr->cparam.max_nelmts_bits);
-
- /* Allocate information for each super block */
- if(NULL == (hdr->sblk_info = H5FL_SEQ_MALLOC(H5EA_sblk_info_t, hdr->nsblks)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block info array")
-
- /* Compute information about each super block */
- start_idx = 0;
- start_dblk = 0;
- for(u = 0; u < hdr->nsblks; u++) {
- hdr->sblk_info[u].ndblks = (size_t)H5_EXP2(u / 2);
- hdr->sblk_info[u].dblk_nelmts = H5EA_SBLK_DBLK_NELMTS(u, hdr->cparam.data_blk_min_elmts);
- hdr->sblk_info[u].start_idx = start_idx;
- hdr->sblk_info[u].start_dblk = start_dblk;
-
- /* Advance starting indices for next super block */
- start_idx += (hsize_t)hdr->sblk_info[u].ndblks * (hsize_t)hdr->sblk_info[u].dblk_nelmts;
- start_dblk += (hsize_t)hdr->sblk_info[u].ndblks;
- } /* end for */
-
- /* Set size of header on disk (locally and in statistics) */
- hdr->stats.computed.hdr_size = hdr->size = H5EA_HEADER_SIZE_HDR(hdr);
-
- /* Create the callback context, if there's one */
- if(hdr->cparam.cls->crt_context) {
- if(NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata)))
- H5E_THROW(H5E_CANTCREATE, "unable to create extensible array client callback context")
- } /* end if */
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata))
+
+/* Local variables */
+hsize_t start_idx; /* First element index for each super block */
+hsize_t start_dblk; /* First data block index for each super block */
+size_t u; /* Local index variable */
+
+/* Sanity check */
+HDassert(hdr);
+HDassert(hdr->cparam.max_nelmts_bits);
+HDassert(hdr->cparam.data_blk_min_elmts);
+HDassert(hdr->cparam.sup_blk_min_data_ptrs);
+
+/* Compute general information */
+hdr->nsblks = 1 + (hdr->cparam.max_nelmts_bits - H5VM_log2_of2(hdr->cparam.data_blk_min_elmts));
+hdr->dblk_page_nelmts = (size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits;
+hdr->arr_off_size = (unsigned char)H5EA_SIZEOF_OFFSET_BITS(hdr->cparam.max_nelmts_bits);
+
+/* Allocate information for each super block */
+if (NULL == (hdr->sblk_info = H5FL_SEQ_MALLOC(H5EA_sblk_info_t, hdr->nsblks)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block info array")
+
+/* Compute information about each super block */
+start_idx = 0;
+start_dblk = 0;
+for (u = 0; u < hdr->nsblks; u++) {
+ hdr->sblk_info[u].ndblks = (size_t)H5_EXP2(u / 2);
+ hdr->sblk_info[u].dblk_nelmts = H5EA_SBLK_DBLK_NELMTS(u, hdr->cparam.data_blk_min_elmts);
+ hdr->sblk_info[u].start_idx = start_idx;
+ hdr->sblk_info[u].start_dblk = start_dblk;
+
+ /* Advance starting indices for next super block */
+ start_idx += (hsize_t)hdr->sblk_info[u].ndblks * (hsize_t)hdr->sblk_info[u].dblk_nelmts;
+ start_dblk += (hsize_t)hdr->sblk_info[u].ndblks;
+} /* end for */
+
+/* Set size of header on disk (locally and in statistics) */
+hdr->stats.computed.hdr_size = hdr->size = H5EA_HEADER_SIZE_HDR(hdr);
+
+/* Create the callback context, if there's one */
+if (hdr->cparam.cls->crt_context) {
+ if (NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata)))
+ H5E_THROW(H5E_CANTCREATE, "unable to create extensible array client callback context")
+} /* end if */
CATCH
-END_FUNC(PKG) /* end H5EA__hdr_init() */
+END_FUNC(PKG) /* end H5EA__hdr_init() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_alloc_elmts
*
@@ -247,60 +229,59 @@ END_FUNC(PKG) /* end H5EA__hdr_init() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-void *, NULL, NULL,
-H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts))
+BEGIN_FUNC(PKG, ERR, void *, NULL, NULL, H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts))
- /* Local variables */
- void *elmts = NULL; /* Element buffer allocated */
- unsigned idx; /* Index of element buffer factory in header */
+/* Local variables */
+void * elmts = NULL; /* Element buffer allocated */
+unsigned idx; /* Index of element buffer factory in header */
- /* Check arguments */
- HDassert(hdr);
- HDassert(nelmts > 0);
+/* Check arguments */
+HDassert(hdr);
+HDassert(nelmts > 0);
- /* Compute the index of the element buffer factory */
- H5_CHECK_OVERFLOW(nelmts, /*From:*/size_t, /*To:*/uint32_t);
- idx = H5VM_log2_of2((uint32_t)nelmts) - H5VM_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts);
+/* Compute the index of the element buffer factory */
+H5_CHECK_OVERFLOW(nelmts, /*From:*/ size_t, /*To:*/ uint32_t);
+idx = H5VM_log2_of2((uint32_t)nelmts) - H5VM_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts);
- /* Check for needing to increase size of array of factories */
- if(idx >= hdr->elmt_fac.nalloc) {
- H5FL_fac_head_t **new_fac; /* New array of element factories */
- size_t new_nalloc = MAX3(1, (idx + 1), (2 * hdr->elmt_fac.nalloc)); /* New number of factories allocated */
+/* Check for needing to increase size of array of factories */
+if (idx >= hdr->elmt_fac.nalloc) {
+ H5FL_fac_head_t **new_fac; /* New array of element factories */
+ size_t new_nalloc =
+ MAX3(1, (idx + 1), (2 * hdr->elmt_fac.nalloc)); /* New number of factories allocated */
- /* Re-allocate array of element factories */
- if(NULL == (new_fac = H5FL_SEQ_REALLOC(H5FL_fac_head_ptr_t, hdr->elmt_fac.fac, new_nalloc)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block data element buffer factory array")
+ /* Re-allocate array of element factories */
+ if (NULL == (new_fac = H5FL_SEQ_REALLOC(H5FL_fac_head_ptr_t, hdr->elmt_fac.fac, new_nalloc)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block data element buffer factory array")
- /* Zero out new elements allocated */
- HDmemset(new_fac + hdr->elmt_fac.nalloc, 0, (new_nalloc - hdr->elmt_fac.nalloc) * sizeof(H5FL_fac_head_ptr_t));
+ /* Zero out new elements allocated */
+ HDmemset(new_fac + hdr->elmt_fac.nalloc, 0,
+ (new_nalloc - hdr->elmt_fac.nalloc) * sizeof(H5FL_fac_head_ptr_t));
- /* Update information about element factories in header */
- hdr->elmt_fac.nalloc = new_nalloc;
- hdr->elmt_fac.fac = new_fac;
- } /* end if */
+ /* Update information about element factories in header */
+ hdr->elmt_fac.nalloc = new_nalloc;
+ hdr->elmt_fac.fac = new_fac;
+} /* end if */
- /* Check for un-initialized factory at index */
- if(NULL == hdr->elmt_fac.fac[idx]) {
- if(NULL == (hdr->elmt_fac.fac[idx] = H5FL_fac_init(nelmts * (size_t)hdr->cparam.cls->nat_elmt_size)))
- H5E_THROW(H5E_CANTINIT, "can't create data block data element buffer factory")
- } /* end if */
+/* Check for un-initialized factory at index */
+if (NULL == hdr->elmt_fac.fac[idx]) {
+ if (NULL == (hdr->elmt_fac.fac[idx] = H5FL_fac_init(nelmts * (size_t)hdr->cparam.cls->nat_elmt_size)))
+ H5E_THROW(H5E_CANTINIT, "can't create data block data element buffer factory")
+} /* end if */
- /* Allocate buffer for elements in index block */
- if(NULL == (elmts = H5FL_FAC_MALLOC(hdr->elmt_fac.fac[idx])))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block data element buffer")
+/* Allocate buffer for elements in index block */
+if (NULL == (elmts = H5FL_FAC_MALLOC(hdr->elmt_fac.fac[idx])))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block data element buffer")
- /* Set the return value */
- ret_value = elmts;
+/* Set the return value */
+ret_value = elmts;
CATCH
- if(!ret_value)
- if(elmts)
- elmts = H5FL_FAC_FREE(hdr->elmt_fac.fac[idx], elmts);
+if (!ret_value)
+ if (elmts)
+ elmts = H5FL_FAC_FREE(hdr->elmt_fac.fac[idx], elmts);
-END_FUNC(PKG) /* end H5EA__hdr_alloc_elmts() */
+END_FUNC(PKG) /* end H5EA__hdr_alloc_elmts() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_free_elmts
*
@@ -313,30 +294,27 @@ END_FUNC(PKG) /* end H5EA__hdr_alloc_elmts() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR,
-herr_t, SUCCEED, -,
-H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts))
+BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts))
- /* Local variables */
- unsigned idx; /* Index of element buffer factory in header */
+/* Local variables */
+unsigned idx; /* Index of element buffer factory in header */
- /* Check arguments */
- HDassert(hdr);
- HDassert(nelmts > 0);
- HDassert(elmts);
+/* Check arguments */
+HDassert(hdr);
+HDassert(nelmts > 0);
+HDassert(elmts);
- /* Compute the index of the element buffer factory */
- H5_CHECK_OVERFLOW(nelmts, /*From:*/size_t, /*To:*/uint32_t);
- idx = H5VM_log2_of2((uint32_t)nelmts) - H5VM_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts);
+/* Compute the index of the element buffer factory */
+H5_CHECK_OVERFLOW(nelmts, /*From:*/ size_t, /*To:*/ uint32_t);
+idx = H5VM_log2_of2((uint32_t)nelmts) - H5VM_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts);
- /* Free buffer for elements in index block */
- HDassert(idx < hdr->elmt_fac.nalloc);
- HDassert(hdr->elmt_fac.fac[idx]);
- elmts = H5FL_FAC_FREE(hdr->elmt_fac.fac[idx], elmts);
+/* Free buffer for elements in index block */
+HDassert(idx < hdr->elmt_fac.nalloc);
+HDassert(hdr->elmt_fac.fac[idx]);
+elmts = H5FL_FAC_FREE(hdr->elmt_fac.fac[idx], elmts);
-END_FUNC(PKG) /* end H5EA__hdr_free_elmts() */
+END_FUNC(PKG) /* end H5EA__hdr_free_elmts() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_create
*
@@ -349,108 +327,110 @@ END_FUNC(PKG) /* end H5EA__hdr_free_elmts() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-haddr_t, HADDR_UNDEF, HADDR_UNDEF,
-H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata))
+BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
+ H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata))
- /* Local variables */
- H5EA_hdr_t *hdr = NULL; /* Extensible array header */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+/* Local variables */
+H5EA_hdr_t *hdr = NULL; /* Extensible array header */
+hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
- /* Check arguments */
- HDassert(f);
- HDassert(cparam);
+/* Check arguments */
+HDassert(f);
+HDassert(cparam);
#ifndef NDEBUG
{
- unsigned sblk_idx; /* Super block index for first "actual" super block */
- size_t dblk_nelmts; /* Number of data block elements */
- size_t dblk_page_nelmts; /* Number of elements in a data block page */
+ unsigned sblk_idx; /* Super block index for first "actual" super block */
+ size_t dblk_nelmts; /* Number of data block elements */
+ size_t dblk_page_nelmts; /* Number of elements in a data block page */
/* Check for valid parameters */
- if(cparam->raw_elmt_size == 0)
+ if (cparam->raw_elmt_size == 0)
H5E_THROW(H5E_BADVALUE, "element size must be greater than zero")
- if(cparam->max_nelmts_bits == 0)
+ if (cparam->max_nelmts_bits == 0)
H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be greater than zero")
- if(cparam->max_nelmts_bits > H5EA_MAX_NELMTS_IDX_MAX)
+ if (cparam->max_nelmts_bits > H5EA_MAX_NELMTS_IDX_MAX)
H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be <= %u", (unsigned)H5EA_MAX_NELMTS_IDX_MAX)
- if(cparam->sup_blk_min_data_ptrs < 2)
+ if (cparam->sup_blk_min_data_ptrs < 2)
H5E_THROW(H5E_BADVALUE, "min # of data block pointers in super block must be >= two")
- if(!POWER_OF_TWO(cparam->sup_blk_min_data_ptrs))
+ if (!POWER_OF_TWO(cparam->sup_blk_min_data_ptrs))
H5E_THROW(H5E_BADVALUE, "min # of data block pointers in super block must be power of two")
- if(!POWER_OF_TWO(cparam->data_blk_min_elmts))
+ if (!POWER_OF_TWO(cparam->data_blk_min_elmts))
H5E_THROW(H5E_BADVALUE, "min # of elements per data block must be power of two")
dblk_page_nelmts = (size_t)1 << cparam->max_dblk_page_nelmts_bits;
- if(dblk_page_nelmts < cparam->idx_blk_elmts)
- H5E_THROW(H5E_BADVALUE, "# of elements per data block page must be greater than # of elements in index block")
+ if (dblk_page_nelmts < cparam->idx_blk_elmts)
+ H5E_THROW(H5E_BADVALUE,
+ "# of elements per data block page must be greater than # of elements in index block")
/* Compute the number of elements in data blocks for first actual super block */
- sblk_idx = H5EA_SBLK_FIRST_IDX(cparam->sup_blk_min_data_ptrs);
+ sblk_idx = H5EA_SBLK_FIRST_IDX(cparam->sup_blk_min_data_ptrs);
dblk_nelmts = H5EA_SBLK_DBLK_NELMTS(sblk_idx, cparam->data_blk_min_elmts);
- if(dblk_page_nelmts < dblk_nelmts)
- H5E_THROW(H5E_BADVALUE, "max. # of elements per data block page bits must be > # of elements in first data block from super block")
+ if (dblk_page_nelmts < dblk_nelmts)
+ H5E_THROW(H5E_BADVALUE, "max. # of elements per data block page bits must be > # of elements in "
+ "first data block from super block")
- if(cparam->max_dblk_page_nelmts_bits > cparam->max_nelmts_bits)
- H5E_THROW(H5E_BADVALUE, "max. # of elements per data block page bits must be <= max. # of elements bits")
+ if (cparam->max_dblk_page_nelmts_bits > cparam->max_nelmts_bits)
+ H5E_THROW(H5E_BADVALUE,
+ "max. # of elements per data block page bits must be <= max. # of elements bits")
}
#endif /* NDEBUG */
- /* Allocate space for the shared information */
- if(NULL == (hdr = H5EA__hdr_alloc(f)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header")
+/* Allocate space for the shared information */
+if (NULL == (hdr = H5EA__hdr_alloc(f)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header")
- /* Set the internal parameters for the array */
- hdr->idx_blk_addr = HADDR_UNDEF;
+/* Set the internal parameters for the array */
+hdr->idx_blk_addr = HADDR_UNDEF;
- /* Set the creation parameters for the array */
- H5MM_memcpy(&hdr->cparam, cparam, sizeof(hdr->cparam));
+/* Set the creation parameters for the array */
+H5MM_memcpy(&hdr->cparam, cparam, sizeof(hdr->cparam));
- /* Finish initializing extensible array header */
- if(H5EA__hdr_init(hdr, ctx_udata) < 0)
- H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header")
+/* Finish initializing extensible array header */
+if (H5EA__hdr_init(hdr, ctx_udata) < 0)
+ H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header")
- /* Allocate space for the header on disk */
- if(HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_EARRAY_HDR, (hsize_t)hdr->size)))
- H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array header")
+/* Allocate space for the header on disk */
+if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_EARRAY_HDR, (hsize_t)hdr->size)))
+ H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array header")
- /* Create 'top' proxy for extensible array entries */
- if(hdr->swmr_write)
- if(NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
- H5E_THROW(H5E_CANTCREATE, "can't create extensible array entry proxy")
+/* Create 'top' proxy for extensible array entries */
+if (hdr->swmr_write)
+ if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
+ H5E_THROW(H5E_CANTCREATE, "can't create extensible array entry proxy")
- /* Cache the new extensible array header */
- if(H5AC_insert_entry(f, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add extensible array header to cache")
- inserted = TRUE;
+/* Cache the new extensible array header */
+if (H5AC_insert_entry(f, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTINSERT, "can't add extensible array header to cache")
+inserted = TRUE;
- /* Add header as child of 'top' proxy */
- if(hdr->top_proxy)
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+/* Add header as child of 'top' proxy */
+if (hdr->top_proxy)
+ if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
+ H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
- /* Set address of array header to return */
- ret_value = hdr->addr;
+/* Set address of array header to return */
+ret_value = hdr->addr;
CATCH
- if(!H5F_addr_defined(ret_value))
- if(hdr) {
- /* Remove from cache, if inserted */
- if(inserted)
- if(H5AC_remove_entry(hdr) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array header from cache")
-
- /* Release header's disk space */
- if(H5F_addr_defined(hdr->addr) && H5MF_xfree(f, H5FD_MEM_EARRAY_HDR, hdr->addr, (hsize_t)hdr->size) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to free extensible array header")
-
- /* Destroy header */
- if(H5EA__hdr_dest(hdr) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header")
- } /* end if */
+if (!H5F_addr_defined(ret_value))
+ if (hdr) {
+ /* Remove from cache, if inserted */
+ if (inserted)
+ if (H5AC_remove_entry(hdr) < 0)
+ H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array header from cache")
+
+ /* Release header's disk space */
+ if (H5F_addr_defined(hdr->addr) &&
+ H5MF_xfree(f, H5FD_MEM_EARRAY_HDR, hdr->addr, (hsize_t)hdr->size) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to free extensible array header")
+
+ /* Destroy header */
+ if (H5EA__hdr_dest(hdr) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header")
+ } /* end if */
-END_FUNC(PKG) /* end H5EA__hdr_create() */
+END_FUNC(PKG) /* end H5EA__hdr_create() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_incr
*
@@ -463,26 +443,23 @@ END_FUNC(PKG) /* end H5EA__hdr_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__hdr_incr(H5EA_hdr_t *hdr))
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_incr(H5EA_hdr_t *hdr))
- /* Sanity check */
- HDassert(hdr);
+/* Sanity check */
+HDassert(hdr);
- /* Mark header as un-evictable when something is depending on it */
- if(hdr->rc == 0)
- if(H5AC_pin_protected_entry(hdr) < 0)
- H5E_THROW(H5E_CANTPIN, "unable to pin extensible array header")
+/* Mark header as un-evictable when something is depending on it */
+if (hdr->rc == 0)
+ if (H5AC_pin_protected_entry(hdr) < 0)
+ H5E_THROW(H5E_CANTPIN, "unable to pin extensible array header")
- /* Increment reference count on shared header */
- hdr->rc++;
+/* Increment reference count on shared header */
+hdr->rc++;
CATCH
-END_FUNC(PKG) /* end H5EA__hdr_incr() */
+END_FUNC(PKG) /* end H5EA__hdr_incr() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_decr
*
@@ -495,29 +472,26 @@ END_FUNC(PKG) /* end H5EA__hdr_incr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__hdr_decr(H5EA_hdr_t *hdr))
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_decr(H5EA_hdr_t *hdr))
- /* Sanity check */
- HDassert(hdr);
- HDassert(hdr->rc);
+/* Sanity check */
+HDassert(hdr);
+HDassert(hdr->rc);
- /* Decrement reference count on shared header */
- hdr->rc--;
+/* Decrement reference count on shared header */
+hdr->rc--;
- /* Mark header as evictable again when nothing depend on it */
- if(hdr->rc == 0) {
- HDassert(hdr->file_rc == 0);
- if(H5AC_unpin_entry(hdr) < 0)
- H5E_THROW(H5E_CANTUNPIN, "unable to unpin extensible array header")
- } /* end if */
+/* Mark header as evictable again when nothing depend on it */
+if (hdr->rc == 0) {
+ HDassert(hdr->file_rc == 0);
+ if (H5AC_unpin_entry(hdr) < 0)
+ H5E_THROW(H5E_CANTUNPIN, "unable to unpin extensible array header")
+} /* end if */
CATCH
-END_FUNC(PKG) /* end H5EA__hdr_decr() */
+END_FUNC(PKG) /* end H5EA__hdr_decr() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_fuse_incr
*
@@ -530,19 +504,16 @@ END_FUNC(PKG) /* end H5EA__hdr_decr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR,
-herr_t, SUCCEED, -,
-H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr))
+BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr))
- /* Sanity check */
- HDassert(hdr);
+/* Sanity check */
+HDassert(hdr);
- /* Increment file reference count on shared header */
- hdr->file_rc++;
+/* Increment file reference count on shared header */
+hdr->file_rc++;
-END_FUNC(PKG) /* end H5EA__hdr_fuse_incr() */
+END_FUNC(PKG) /* end H5EA__hdr_fuse_incr() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_fuse_decr
*
@@ -555,23 +526,20 @@ END_FUNC(PKG) /* end H5EA__hdr_fuse_incr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR,
-size_t, 0, -,
-H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr))
+BEGIN_FUNC(PKG, NOERR, size_t, 0, -, H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr))
- /* Sanity check */
- HDassert(hdr);
- HDassert(hdr->file_rc);
+/* Sanity check */
+HDassert(hdr);
+HDassert(hdr->file_rc);
- /* Decrement file reference count on shared header */
- hdr->file_rc--;
+/* Decrement file reference count on shared header */
+hdr->file_rc--;
- /* Set return value */
- ret_value = hdr->file_rc;
+/* Set return value */
+ret_value = hdr->file_rc;
-END_FUNC(PKG) /* end H5EA__hdr_fuse_decr() */
+END_FUNC(PKG) /* end H5EA__hdr_fuse_decr() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_modified
*
@@ -584,23 +552,20 @@ END_FUNC(PKG) /* end H5EA__hdr_fuse_decr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__hdr_modified(H5EA_hdr_t *hdr))
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_modified(H5EA_hdr_t *hdr))
- /* Sanity check */
- HDassert(hdr);
- HDassert(hdr->f);
+/* Sanity check */
+HDassert(hdr);
+HDassert(hdr->f);
- /* Mark header as dirty in cache */
- if(H5AC_mark_entry_dirty(hdr) < 0)
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as dirty")
+/* Mark header as dirty in cache */
+if (H5AC_mark_entry_dirty(hdr) < 0)
+ H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as dirty")
CATCH
-END_FUNC(PKG) /* end H5EA__hdr_modified() */
+END_FUNC(PKG) /* end H5EA__hdr_modified() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_protect
*
@@ -613,51 +578,49 @@ END_FUNC(PKG) /* end H5EA__hdr_modified() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-H5EA_hdr_t *, NULL, NULL,
-H5EA__hdr_protect(H5F_t *f, haddr_t ea_addr, void *ctx_udata,
- unsigned flags))
+BEGIN_FUNC(PKG, ERR, H5EA_hdr_t *, NULL, NULL,
+ H5EA__hdr_protect(H5F_t *f, haddr_t ea_addr, void *ctx_udata, unsigned flags))
- /* Local variables */
- H5EA_hdr_t *hdr; /* Extensible array header */
- H5EA_hdr_cache_ud_t udata; /* User data for cache callbacks */
+/* Local variables */
+H5EA_hdr_t * hdr; /* Extensible array header */
+H5EA_hdr_cache_ud_t udata; /* User data for cache callbacks */
- /* Sanity check */
- HDassert(f);
- HDassert(H5F_addr_defined(ea_addr));
-
- /* only the H5AC__READ_ONLY_FLAG may appear in flags */
- HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
-
- /* Set up user data for cache callbacks */
- udata.f = f;
- udata.addr = ea_addr;
- udata.ctx_udata = ctx_udata;
-
- /* Protect the header */
- if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, H5AC_EARRAY_HDR, ea_addr, &udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr)
- hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */
-
- /* Create top proxy, if it doesn't exist */
- if(hdr->swmr_write && NULL == hdr->top_proxy) {
- /* Create 'top' proxy for extensible array entries */
- if(NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
- H5E_THROW(H5E_CANTCREATE, "can't create extensible array entry proxy")
-
- /* Add header as child of 'top' proxy */
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
- } /* end if */
+/* Sanity check */
+HDassert(f);
+HDassert(H5F_addr_defined(ea_addr));
- /* Set return value */
- ret_value = hdr;
+/* only the H5AC__READ_ONLY_FLAG may appear in flags */
+HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
+
+/* Set up user data for cache callbacks */
+udata.f = f;
+udata.addr = ea_addr;
+udata.ctx_udata = ctx_udata;
+
+/* Protect the header */
+if (NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, H5AC_EARRAY_HDR, ea_addr, &udata, flags)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu",
+ (unsigned long long)ea_addr)
+hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */
+
+/* Create top proxy, if it doesn't exist */
+if (hdr->swmr_write && NULL == hdr->top_proxy) {
+ /* Create 'top' proxy for extensible array entries */
+ if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
+ H5E_THROW(H5E_CANTCREATE, "can't create extensible array entry proxy")
+
+ /* Add header as child of 'top' proxy */
+ if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
+ H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+} /* end if */
+
+/* Set return value */
+ret_value = hdr;
CATCH
-END_FUNC(PKG) /* end H5EA__hdr_protect() */
+END_FUNC(PKG) /* end H5EA__hdr_protect() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_unprotect
*
@@ -670,24 +633,22 @@ END_FUNC(PKG) /* end H5EA__hdr_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__hdr_unprotect(H5EA_hdr_t *hdr, unsigned cache_flags))
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_unprotect(H5EA_hdr_t *hdr, unsigned cache_flags))
- /* Local variables */
+/* Local variables */
- /* Sanity check */
- HDassert(hdr);
+/* Sanity check */
+HDassert(hdr);
- /* Unprotect the header */
- if(H5AC_unprotect(hdr->f, H5AC_EARRAY_HDR, hdr->addr, hdr, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array hdr, address = %llu", (unsigned long long)hdr->addr)
+/* Unprotect the header */
+if (H5AC_unprotect(hdr->f, H5AC_EARRAY_HDR, hdr->addr, hdr, cache_flags) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array hdr, address = %llu",
+ (unsigned long long)hdr->addr)
CATCH
-END_FUNC(PKG) /* end H5EA__hdr_unprotect() */
+END_FUNC(PKG) /* end H5EA__hdr_unprotect() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_delete
*
@@ -700,23 +661,21 @@ END_FUNC(PKG) /* end H5EA__hdr_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__hdr_delete(H5EA_hdr_t *hdr))
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_delete(H5EA_hdr_t *hdr))
- /* Local variables */
- unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting header */
+/* Local variables */
+unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting header */
- /* Sanity check */
- HDassert(hdr);
- HDassert(!hdr->file_rc);
+/* Sanity check */
+HDassert(hdr);
+HDassert(!hdr->file_rc);
#ifndef NDEBUG
{
- unsigned hdr_status = 0; /* Array header's status in the metadata cache */
+ unsigned hdr_status = 0; /* Array header's status in the metadata cache */
/* Check the array header's status in the metadata cache */
- if(H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0)
+ if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0)
H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for array header")
/* Sanity checks on array header */
@@ -725,25 +684,24 @@ H5EA__hdr_delete(H5EA_hdr_t *hdr))
} /* end block */
#endif /* NDEBUG */
- /* Check for index block */
- if(H5F_addr_defined(hdr->idx_blk_addr)) {
- /* Delete index block */
- if(H5EA__iblock_delete(hdr) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array index block")
- } /* end if */
+/* Check for index block */
+if (H5F_addr_defined(hdr->idx_blk_addr)) {
+ /* Delete index block */
+ if (H5EA__iblock_delete(hdr) < 0)
+ H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array index block")
+} /* end if */
- /* Set flags to finish deleting header on unprotect */
- cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
+/* Set flags to finish deleting header on unprotect */
+cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
CATCH
- /* Unprotect the header, deleting it if an error hasn't occurred */
- if(H5EA__hdr_unprotect(hdr, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+/* Unprotect the header, deleting it if an error hasn't occurred */
+if (H5EA__hdr_unprotect(hdr, cache_flags) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
-END_FUNC(PKG) /* end H5EA__hdr_delete() */
+END_FUNC(PKG) /* end H5EA__hdr_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_dest
*
@@ -756,57 +714,54 @@ END_FUNC(PKG) /* end H5EA__hdr_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__hdr_dest(H5EA_hdr_t *hdr))
-
- /* Check arguments */
- HDassert(hdr);
- HDassert(hdr->rc == 0);
-
- /* Destroy the callback context */
- if(hdr->cb_ctx) {
- if((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array client callback context")
- } /* end if */
- hdr->cb_ctx = NULL;
-
- /* Check for data block element buffer factory info to free */
- if(hdr->elmt_fac.fac) {
- unsigned u; /* Local index variable */
-
- /* Sanity check */
- HDassert(hdr->elmt_fac.nalloc > 0);
-
- /* Iterate over factories, shutting them down */
- for(u = 0; u < hdr->elmt_fac.nalloc; u++) {
- /* Check if this factory has been initialized */
- if(hdr->elmt_fac.fac[u]) {
- if(H5FL_fac_term(hdr->elmt_fac.fac[u]) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array header factory")
- hdr->elmt_fac.fac[u] = NULL;
- } /* end if */
- } /* end for */
-
- /* Free factory array */
- hdr->elmt_fac.fac = (H5FL_fac_head_t **)H5FL_SEQ_FREE(H5FL_fac_head_ptr_t, hdr->elmt_fac.fac);
- } /* end if */
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_dest(H5EA_hdr_t *hdr))
- /* Free the super block info array */
- if(hdr->sblk_info)
- hdr->sblk_info = (H5EA_sblk_info_t *)H5FL_SEQ_FREE(H5EA_sblk_info_t, hdr->sblk_info);
+/* Check arguments */
+HDassert(hdr);
+HDassert(hdr->rc == 0);
- /* Destroy the 'top' proxy */
- if(hdr->top_proxy) {
- if(H5AC_proxy_entry_dest(hdr->top_proxy) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array 'top' proxy")
- hdr->top_proxy = NULL;
- } /* end if */
+/* Destroy the callback context */
+if (hdr->cb_ctx) {
+ if ((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0)
+ H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array client callback context")
+} /* end if */
+hdr->cb_ctx = NULL;
- /* Free the shared info itself */
- hdr = H5FL_FREE(H5EA_hdr_t, hdr);
+/* Check for data block element buffer factory info to free */
+if (hdr->elmt_fac.fac) {
+ unsigned u; /* Local index variable */
-CATCH
+ /* Sanity check */
+ HDassert(hdr->elmt_fac.nalloc > 0);
+
+ /* Iterate over factories, shutting them down */
+ for (u = 0; u < hdr->elmt_fac.nalloc; u++) {
+ /* Check if this factory has been initialized */
+ if (hdr->elmt_fac.fac[u]) {
+ if (H5FL_fac_term(hdr->elmt_fac.fac[u]) < 0)
+ H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array header factory")
+ hdr->elmt_fac.fac[u] = NULL;
+ } /* end if */
+ } /* end for */
+
+ /* Free factory array */
+ hdr->elmt_fac.fac = (H5FL_fac_head_t **)H5FL_SEQ_FREE(H5FL_fac_head_ptr_t, hdr->elmt_fac.fac);
+} /* end if */
+
+/* Free the super block info array */
+if (hdr->sblk_info)
+ hdr->sblk_info = (H5EA_sblk_info_t *)H5FL_SEQ_FREE(H5EA_sblk_info_t, hdr->sblk_info);
-END_FUNC(PKG) /* end H5EA__hdr_dest() */
+/* Destroy the 'top' proxy */
+if (hdr->top_proxy) {
+ if (H5AC_proxy_entry_dest(hdr->top_proxy) < 0)
+ H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array 'top' proxy")
+ hdr->top_proxy = NULL;
+} /* end if */
+
+/* Free the shared info itself */
+hdr = H5FL_FREE(H5EA_hdr_t, hdr);
+
+CATCH
+END_FUNC(PKG) /* end H5EA__hdr_dest() */
diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c
index c45d15a..1e42716 100644
--- a/src/H5EAiblock.c
+++ b/src/H5EAiblock.c
@@ -26,55 +26,46 @@
/* Module Declaration */
/**********************/
-#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
-
+#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
/***********************/
/* Other Packages Used */
/***********************/
-
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5EApkg.h" /* Extensible Arrays */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5VMprivate.h" /* Vectors and arrays */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5EApkg.h" /* Extensible Arrays */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5VMprivate.h" /* Vectors and arrays */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -88,8 +79,6 @@ H5FL_BLK_DEFINE_STATIC(idx_blk_elmt_buf);
/* Declare a free list to manage the haddr_t sequence information */
H5FL_SEQ_DEFINE_STATIC(haddr_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_alloc
*
@@ -102,59 +91,57 @@ H5FL_SEQ_DEFINE_STATIC(haddr_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-H5EA_iblock_t *, NULL, NULL,
-H5EA__iblock_alloc(H5EA_hdr_t *hdr))
+BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_alloc(H5EA_hdr_t *hdr))
- /* Local variables */
- H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
+/* Local variables */
+H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
- /* Check arguments */
- HDassert(hdr);
+/* Check arguments */
+HDassert(hdr);
- /* Allocate memory for the index block */
- if(NULL == (iblock = H5FL_CALLOC(H5EA_iblock_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block")
+/* Allocate memory for the index block */
+if (NULL == (iblock = H5FL_CALLOC(H5EA_iblock_t)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block")
- /* Share common array information */
- if(H5EA__hdr_incr(hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
- iblock->hdr = hdr;
+/* Share common array information */
+if (H5EA__hdr_incr(hdr) < 0)
+ H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+iblock->hdr = hdr;
- /* Set non-zero internal fields */
- iblock->addr = HADDR_UNDEF;
+/* Set non-zero internal fields */
+iblock->addr = HADDR_UNDEF;
- /* Compute information */
- iblock->nsblks = H5EA_SBLK_FIRST_IDX(hdr->cparam.sup_blk_min_data_ptrs);
- iblock->ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1);
- iblock->nsblk_addrs = hdr->nsblks - iblock->nsblks;
+/* Compute information */
+iblock->nsblks = H5EA_SBLK_FIRST_IDX(hdr->cparam.sup_blk_min_data_ptrs);
+iblock->ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1);
+iblock->nsblk_addrs = hdr->nsblks - iblock->nsblks;
- /* Allocate buffer for elements in index block */
- if(hdr->cparam.idx_blk_elmts > 0)
- if(NULL == (iblock->elmts = H5FL_BLK_MALLOC(idx_blk_elmt_buf, (size_t)(hdr->cparam.idx_blk_elmts * hdr->cparam.cls->nat_elmt_size))))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block data element buffer")
+/* Allocate buffer for elements in index block */
+if (hdr->cparam.idx_blk_elmts > 0)
+ if (NULL == (iblock->elmts = H5FL_BLK_MALLOC(
+ idx_blk_elmt_buf, (size_t)(hdr->cparam.idx_blk_elmts * hdr->cparam.cls->nat_elmt_size))))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block data element buffer")
- /* Allocate buffer for data block addresses in index block */
- if(iblock->ndblk_addrs > 0)
- if(NULL == (iblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->ndblk_addrs)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block data block addresses")
+/* Allocate buffer for data block addresses in index block */
+if (iblock->ndblk_addrs > 0)
+ if (NULL == (iblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->ndblk_addrs)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block data block addresses")
- /* Allocate buffer for super block addresses in index block */
- if(iblock->nsblk_addrs > 0)
- if(NULL == (iblock->sblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->nsblk_addrs)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block super block addresses")
+/* Allocate buffer for super block addresses in index block */
+if (iblock->nsblk_addrs > 0)
+ if (NULL == (iblock->sblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->nsblk_addrs)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block super block addresses")
- /* Set the return value */
- ret_value = iblock;
+/* Set the return value */
+ret_value = iblock;
CATCH
- if(!ret_value)
- if(iblock && H5EA__iblock_dest(iblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block")
+if (!ret_value)
+ if (iblock && H5EA__iblock_dest(iblock) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block")
-END_FUNC(PKG) /* end H5EA__iblock_alloc() */
+END_FUNC(PKG) /* end H5EA__iblock_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_create
*
@@ -167,101 +154,100 @@ END_FUNC(PKG) /* end H5EA__iblock_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-haddr_t, HADDR_UNDEF, HADDR_UNDEF,
-H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed))
-
- /* Local variables */
- H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
- haddr_t iblock_addr; /* Extensible array index block address */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
-
- /* Sanity check */
- HDassert(hdr);
- HDassert(stats_changed);
-
- /* Allocate the index block */
- if(NULL == (iblock = H5EA__iblock_alloc(hdr)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block")
-
- /* Set size of index block on disk */
- iblock->size = H5EA_IBLOCK_SIZE(iblock);
-
- /* Allocate space for the index block on disk */
- if(HADDR_UNDEF == (iblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_IBLOCK, (hsize_t)iblock->size)))
- H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array index block")
- iblock->addr = iblock_addr;
-
- /* Clear any elements in index block to fill value */
- if(hdr->cparam.idx_blk_elmts > 0) {
- /* Call the class's 'fill' callback */
- if((hdr->cparam.cls->fill)(iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts) < 0)
- H5E_THROW(H5E_CANTSET, "can't set extensible array index block elements to class's fill value")
- } /* end if */
-
- /* Reset any data block addresses in the index block */
- if(iblock->ndblk_addrs > 0) {
- haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill data block addresses with */
-
- /* Set all the data block addresses to "undefined" address value */
- H5VM_array_fill(iblock->dblk_addrs, &tmp_addr, sizeof(haddr_t), iblock->ndblk_addrs);
- } /* end if */
-
- /* Reset any super block addresses in the index block */
- if(iblock->nsblk_addrs > 0) {
- haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill super block addresses with */
-
- /* Set all the super block addresses to "undefined" address value */
- H5VM_array_fill(iblock->sblk_addrs, &tmp_addr, sizeof(haddr_t), iblock->nsblk_addrs);
- } /* end if */
-
- /* Cache the new extensible array index block */
- if(H5AC_insert_entry(hdr->f, H5AC_EARRAY_IBLOCK, iblock_addr, iblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add extensible array index block to cache")
- inserted = TRUE;
-
- /* Add index block as child of 'top' proxy */
- if(hdr->top_proxy) {
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, iblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
- iblock->top_proxy = hdr->top_proxy;
- } /* end if */
-
- /* Update extensible array index block statistics */
- HDassert(0 == hdr->stats.computed.nindex_blks);
- HDassert(0 == hdr->stats.computed.index_blk_size);
- hdr->stats.computed.nindex_blks = 1;
- hdr->stats.computed.index_blk_size = iblock->size;
-
- /* Increment count of elements "realized" */
- hdr->stats.stored.nelmts += hdr->cparam.idx_blk_elmts;
-
- /* Mark the statistics as changed */
- *stats_changed = TRUE;
-
- /* Set address of index block to return */
- ret_value = iblock_addr;
+BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
+ H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed))
+
+/* Local variables */
+H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
+haddr_t iblock_addr; /* Extensible array index block address */
+hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+
+/* Sanity check */
+HDassert(hdr);
+HDassert(stats_changed);
+
+/* Allocate the index block */
+if (NULL == (iblock = H5EA__iblock_alloc(hdr)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block")
+
+/* Set size of index block on disk */
+iblock->size = H5EA_IBLOCK_SIZE(iblock);
+
+/* Allocate space for the index block on disk */
+if (HADDR_UNDEF == (iblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_IBLOCK, (hsize_t)iblock->size)))
+ H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array index block")
+iblock->addr = iblock_addr;
+
+/* Clear any elements in index block to fill value */
+if (hdr->cparam.idx_blk_elmts > 0) {
+ /* Call the class's 'fill' callback */
+ if ((hdr->cparam.cls->fill)(iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts) < 0)
+ H5E_THROW(H5E_CANTSET, "can't set extensible array index block elements to class's fill value")
+} /* end if */
+
+/* Reset any data block addresses in the index block */
+if (iblock->ndblk_addrs > 0) {
+ haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill data block addresses with */
+
+ /* Set all the data block addresses to "undefined" address value */
+ H5VM_array_fill(iblock->dblk_addrs, &tmp_addr, sizeof(haddr_t), iblock->ndblk_addrs);
+} /* end if */
+
+/* Reset any super block addresses in the index block */
+if (iblock->nsblk_addrs > 0) {
+ haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill super block addresses with */
+
+ /* Set all the super block addresses to "undefined" address value */
+ H5VM_array_fill(iblock->sblk_addrs, &tmp_addr, sizeof(haddr_t), iblock->nsblk_addrs);
+} /* end if */
+
+/* Cache the new extensible array index block */
+if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_IBLOCK, iblock_addr, iblock, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTINSERT, "can't add extensible array index block to cache")
+inserted = TRUE;
+
+/* Add index block as child of 'top' proxy */
+if (hdr->top_proxy) {
+ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, iblock) < 0)
+ H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ iblock->top_proxy = hdr->top_proxy;
+} /* end if */
+
+/* Update extensible array index block statistics */
+HDassert(0 == hdr->stats.computed.nindex_blks);
+HDassert(0 == hdr->stats.computed.index_blk_size);
+hdr->stats.computed.nindex_blks = 1;
+hdr->stats.computed.index_blk_size = iblock->size;
+
+/* Increment count of elements "realized" */
+hdr->stats.stored.nelmts += hdr->cparam.idx_blk_elmts;
+
+/* Mark the statistics as changed */
+*stats_changed = TRUE;
+
+/* Set address of index block to return */
+ret_value = iblock_addr;
CATCH
- if(!H5F_addr_defined(ret_value))
- if(iblock) {
- /* Remove from cache, if inserted */
- if(inserted)
- if(H5AC_remove_entry(iblock) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array index block from cache")
-
- /* Release index block's disk space */
- if(H5F_addr_defined(iblock->addr) && H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_IBLOCK, iblock->addr, (hsize_t)iblock->size) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to release file space for extensible array index block")
-
- /* Destroy index block */
- if(H5EA__iblock_dest(iblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block")
- } /* end if */
+if (!H5F_addr_defined(ret_value))
+ if (iblock) {
+ /* Remove from cache, if inserted */
+ if (inserted)
+ if (H5AC_remove_entry(iblock) < 0)
+ H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array index block from cache")
+
+ /* Release index block's disk space */
+ if (H5F_addr_defined(iblock->addr) &&
+ H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_IBLOCK, iblock->addr, (hsize_t)iblock->size) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to release file space for extensible array index block")
+
+ /* Destroy index block */
+ if (H5EA__iblock_dest(iblock) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block")
+ } /* end if */
-END_FUNC(PKG) /* end H5EA__iblock_create() */
+END_FUNC(PKG) /* end H5EA__iblock_create() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_protect
*
@@ -274,45 +260,45 @@ END_FUNC(PKG) /* end H5EA__iblock_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-H5EA_iblock_t *, NULL, NULL,
-H5EA__iblock_protect(H5EA_hdr_t *hdr, unsigned flags))
+BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_protect(H5EA_hdr_t *hdr, unsigned flags))
- /* Local variables */
- H5EA_iblock_t *iblock = NULL; /* Pointer to index block */
+/* Local variables */
+H5EA_iblock_t *iblock = NULL; /* Pointer to index block */
- /* Sanity check */
- HDassert(hdr);
+/* Sanity check */
+HDassert(hdr);
- /* only the H5AC__READ_ONLY_FLAG may be set */
- HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
+/* only the H5AC__READ_ONLY_FLAG may be set */
+HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
- /* Protect the index block */
- if(NULL == (iblock = (H5EA_iblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_IBLOCK, hdr->idx_blk_addr, hdr, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", (unsigned long long)hdr->idx_blk_addr)
+/* Protect the index block */
+if (NULL ==
+ (iblock = (H5EA_iblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_IBLOCK, hdr->idx_blk_addr, hdr, flags)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu",
+ (unsigned long long)hdr->idx_blk_addr)
- /* Create top proxy, if it doesn't exist */
- if(hdr->top_proxy && NULL == iblock->top_proxy) {
- /* Add index block as child of 'top' proxy */
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, iblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
- iblock->top_proxy = hdr->top_proxy;
- } /* end if */
+/* Create top proxy, if it doesn't exist */
+if (hdr->top_proxy && NULL == iblock->top_proxy) {
+ /* Add index block as child of 'top' proxy */
+ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, iblock) < 0)
+ H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ iblock->top_proxy = hdr->top_proxy;
+} /* end if */
- /* Set return value */
- ret_value = iblock;
+/* Set return value */
+ret_value = iblock;
CATCH
- /* Clean up on error */
- if(!ret_value) {
- /* Release the index block, if it was protected */
- if(iblock && H5AC_unprotect(hdr->f, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array index block, address = %llu", (unsigned long long)iblock->addr)
- } /* end if */
+/* Clean up on error */
+if (!ret_value) {
+ /* Release the index block, if it was protected */
+ if (iblock && H5AC_unprotect(hdr->f, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array index block, address = %llu",
+ (unsigned long long)iblock->addr)
+} /* end if */
-END_FUNC(PKG) /* end H5EA__iblock_protect() */
+END_FUNC(PKG) /* end H5EA__iblock_protect() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_unprotect
*
@@ -325,24 +311,23 @@ END_FUNC(PKG) /* end H5EA__iblock_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__iblock_unprotect(H5EA_iblock_t *iblock, unsigned cache_flags))
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__iblock_unprotect(H5EA_iblock_t *iblock, unsigned cache_flags))
- /* Local variables */
+/* Local variables */
- /* Sanity check */
- HDassert(iblock);
+/* Sanity check */
+HDassert(iblock);
- /* Unprotect the index block */
- if(H5AC_unprotect(iblock->hdr->f, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array index block, address = %llu", (unsigned long long)iblock->addr)
+/* Unprotect the index block */
+if (H5AC_unprotect(iblock->hdr->f, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, cache_flags) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array index block, address = %llu",
+ (unsigned long long)iblock->addr)
CATCH
-END_FUNC(PKG) /* end H5EA__iblock_unprotect() */
+END_FUNC(PKG) /* end H5EA__iblock_unprotect() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_delete
*
@@ -355,73 +340,73 @@ END_FUNC(PKG) /* end H5EA__iblock_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__iblock_delete(H5EA_hdr_t *hdr))
-
- /* Local variables */
- H5EA_iblock_t *iblock = NULL; /* Pointer to index block */
-
- /* Sanity check */
- HDassert(hdr);
- HDassert(H5F_addr_defined(hdr->idx_blk_addr));
-
- /* Protect index block */
- if(NULL == (iblock = H5EA__iblock_protect(hdr, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", (unsigned long long)hdr->idx_blk_addr)
-
- /* Check for index block having data block pointers */
- if(iblock->ndblk_addrs > 0) {
- unsigned sblk_idx; /* Current super block index */
- unsigned dblk_idx; /* Current data block index w/in super block */
- size_t u; /* Local index variable */
-
- /* Iterate over data blocks */
- sblk_idx = dblk_idx = 0;
- for(u = 0; u < iblock->ndblk_addrs; u++) {
- /* Check for data block existing */
- if(H5F_addr_defined(iblock->dblk_addrs[u])) {
- /* Delete data block */
- if(H5EA__dblock_delete(hdr, iblock, iblock->dblk_addrs[u], hdr->sblk_info[sblk_idx].dblk_nelmts) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array data block")
- iblock->dblk_addrs[u] = HADDR_UNDEF;
- } /* end if */
-
- /* Advance to next data block w/in super block */
- dblk_idx++;
-
- /* Check for moving to next super block */
- if(dblk_idx >= hdr->sblk_info[sblk_idx].ndblks) {
- sblk_idx++;
- dblk_idx = 0;
- } /* end if */
- } /* end for */
- } /* end if */
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_delete(H5EA_hdr_t *hdr))
+
+/* Local variables */
+H5EA_iblock_t *iblock = NULL; /* Pointer to index block */
+
+/* Sanity check */
+HDassert(hdr);
+HDassert(H5F_addr_defined(hdr->idx_blk_addr));
+
+/* Protect index block */
+if (NULL == (iblock = H5EA__iblock_protect(hdr, H5AC__NO_FLAGS_SET)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu",
+ (unsigned long long)hdr->idx_blk_addr)
+
+/* Check for index block having data block pointers */
+if (iblock->ndblk_addrs > 0) {
+ unsigned sblk_idx; /* Current super block index */
+ unsigned dblk_idx; /* Current data block index w/in super block */
+ size_t u; /* Local index variable */
+
+ /* Iterate over data blocks */
+ sblk_idx = dblk_idx = 0;
+ for (u = 0; u < iblock->ndblk_addrs; u++) {
+ /* Check for data block existing */
+ if (H5F_addr_defined(iblock->dblk_addrs[u])) {
+ /* Delete data block */
+ if (H5EA__dblock_delete(hdr, iblock, iblock->dblk_addrs[u],
+ hdr->sblk_info[sblk_idx].dblk_nelmts) < 0)
+ H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array data block")
+ iblock->dblk_addrs[u] = HADDR_UNDEF;
+ } /* end if */
- /* Check for index block having data block pointers (not yet) */
- if(iblock->nsblk_addrs > 0) {
- size_t u; /* Local index variable */
-
- /* Iterate over super blocks */
- for(u = 0; u < iblock->nsblk_addrs; u++) {
- /* Check for data block existing */
- if(H5F_addr_defined(iblock->sblk_addrs[u])) {
- /* Delete super block */
- if(H5EA__sblock_delete(hdr, iblock, iblock->sblk_addrs[u], (unsigned)(u + iblock->nsblks)) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array super block")
- iblock->sblk_addrs[u] = HADDR_UNDEF;
- } /* end if */
- } /* end for */
- } /* end if */
+ /* Advance to next data block w/in super block */
+ dblk_idx++;
+
+ /* Check for moving to next super block */
+ if (dblk_idx >= hdr->sblk_info[sblk_idx].ndblks) {
+ sblk_idx++;
+ dblk_idx = 0;
+ } /* end if */
+ } /* end for */
+} /* end if */
+
+/* Check for index block having data block pointers (not yet) */
+if (iblock->nsblk_addrs > 0) {
+ size_t u; /* Local index variable */
+
+ /* Iterate over super blocks */
+ for (u = 0; u < iblock->nsblk_addrs; u++) {
+ /* Check for data block existing */
+ if (H5F_addr_defined(iblock->sblk_addrs[u])) {
+ /* Delete super block */
+ if (H5EA__sblock_delete(hdr, iblock, iblock->sblk_addrs[u], (unsigned)(u + iblock->nsblks)) < 0)
+ H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array super block")
+ iblock->sblk_addrs[u] = HADDR_UNDEF;
+ } /* end if */
+ } /* end for */
+} /* end if */
CATCH
- /* Finished deleting index block in metadata cache */
- if(iblock && H5EA__iblock_unprotect(iblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block")
+/* Finished deleting index block in metadata cache */
+if (iblock &&
+ H5EA__iblock_unprotect(iblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block")
-END_FUNC(PKG) /* end H5EA__iblock_delete() */
+END_FUNC(PKG) /* end H5EA__iblock_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_dest
*
@@ -434,51 +419,48 @@ END_FUNC(PKG) /* end H5EA__iblock_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__iblock_dest(H5EA_iblock_t *iblock))
-
- /* Sanity check */
- HDassert(iblock);
-
- /* Check if shared header field has been initialized */
- if(iblock->hdr) {
- /* Check if we've got elements in the index block */
- if(iblock->elmts) {
- /* Free buffer for index block elements */
- HDassert(iblock->hdr->cparam.idx_blk_elmts > 0);
- iblock->elmts = H5FL_BLK_FREE(idx_blk_elmt_buf, iblock->elmts);
- } /* end if */
-
- /* Check if we've got data block addresses in the index block */
- if(iblock->dblk_addrs) {
- /* Free buffer for index block data block addresses */
- HDassert(iblock->ndblk_addrs > 0);
- iblock->dblk_addrs = H5FL_SEQ_FREE(haddr_t, iblock->dblk_addrs);
- iblock->ndblk_addrs = 0;
- } /* end if */
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_dest(H5EA_iblock_t *iblock))
+
+/* Sanity check */
+HDassert(iblock);
+
+/* Check if shared header field has been initialized */
+if (iblock->hdr) {
+ /* Check if we've got elements in the index block */
+ if (iblock->elmts) {
+ /* Free buffer for index block elements */
+ HDassert(iblock->hdr->cparam.idx_blk_elmts > 0);
+ iblock->elmts = H5FL_BLK_FREE(idx_blk_elmt_buf, iblock->elmts);
+ } /* end if */
- /* Check if we've got super block addresses in the index block */
- if(iblock->sblk_addrs) {
- /* Free buffer for index block super block addresses */
- HDassert(iblock->nsblk_addrs > 0);
- iblock->sblk_addrs = H5FL_SEQ_FREE(haddr_t, iblock->sblk_addrs);
- iblock->nsblk_addrs = 0;
- } /* end if */
+ /* Check if we've got data block addresses in the index block */
+ if (iblock->dblk_addrs) {
+ /* Free buffer for index block data block addresses */
+ HDassert(iblock->ndblk_addrs > 0);
+ iblock->dblk_addrs = H5FL_SEQ_FREE(haddr_t, iblock->dblk_addrs);
+ iblock->ndblk_addrs = 0;
+ } /* end if */
- /* Decrement reference count on shared info */
- if(H5EA__hdr_decr(iblock->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
- iblock->hdr = NULL;
+ /* Check if we've got super block addresses in the index block */
+ if (iblock->sblk_addrs) {
+ /* Free buffer for index block super block addresses */
+ HDassert(iblock->nsblk_addrs > 0);
+ iblock->sblk_addrs = H5FL_SEQ_FREE(haddr_t, iblock->sblk_addrs);
+ iblock->nsblk_addrs = 0;
} /* end if */
- /* Sanity check */
- HDassert(NULL == iblock->top_proxy);
+ /* Decrement reference count on shared info */
+ if (H5EA__hdr_decr(iblock->hdr) < 0)
+ H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ iblock->hdr = NULL;
+} /* end if */
- /* Free the index block itself */
- iblock = H5FL_FREE(H5EA_iblock_t, iblock);
+/* Sanity check */
+HDassert(NULL == iblock->top_proxy);
-CATCH
+/* Free the index block itself */
+iblock = H5FL_FREE(H5EA_iblock_t, iblock);
-END_FUNC(PKG) /* end H5EA__iblock_dest() */
+CATCH
+END_FUNC(PKG) /* end H5EA__iblock_dest() */
diff --git a/src/H5EAint.c b/src/H5EAint.c
index ef8cd7a..f1d988b 100644
--- a/src/H5EAint.c
+++ b/src/H5EAint.c
@@ -26,58 +26,47 @@
/* Module Declaration */
/**********************/
-#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
-
+#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
/***********************/
/* Other Packages Used */
/***********************/
-
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5EApkg.h" /* Extensible Arrays */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5EApkg.h" /* Extensible Arrays */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5EA__create_flush_depend
*
@@ -90,23 +79,21 @@
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry))
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry))
- /* Sanity check */
- HDassert(parent_entry);
- HDassert(child_entry);
+/* Sanity check */
+HDassert(parent_entry);
+HDassert(child_entry);
- /* Create a flush dependency between parent and child entry */
- if(H5AC_create_flush_dependency(parent_entry, child_entry) < 0)
- H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency")
+/* Create a flush dependency between parent and child entry */
+if (H5AC_create_flush_dependency(parent_entry, child_entry) < 0)
+ H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency")
CATCH
-END_FUNC(PKG) /* end H5EA__create_flush_depend() */
+END_FUNC(PKG) /* end H5EA__create_flush_depend() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__destroy_flush_depend
*
@@ -119,19 +106,17 @@ END_FUNC(PKG) /* end H5EA__create_flush_depend() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry))
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry))
- /* Sanity check */
- HDassert(parent_entry);
- HDassert(child_entry);
+/* Sanity check */
+HDassert(parent_entry);
+HDassert(child_entry);
- /* Destroy a flush dependency between parent and child entry */
- if(H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency")
+/* Destroy a flush dependency between parent and child entry */
+if (H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0)
+ H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency")
CATCH
-END_FUNC(PKG) /* end H5EA__destroy_flush_depend() */
-
+END_FUNC(PKG) /* end H5EA__destroy_flush_depend() */
diff --git a/src/H5EAmodule.h b/src/H5EAmodule.h
index c3a4c7c..d9d5cfa 100644
--- a/src/H5EAmodule.h
+++ b/src/H5EAmodule.h
@@ -25,9 +25,8 @@
* reporting macros.
*/
#define H5EA_MODULE
-#define H5_MY_PKG H5EA
-#define H5_MY_PKG_ERR H5E_EARRAY
-#define H5_MY_PKG_INIT NO
+#define H5_MY_PKG H5EA
+#define H5_MY_PKG_ERR H5E_EARRAY
+#define H5_MY_PKG_INIT NO
#endif /* _H5EAmodule_H */
-
diff --git a/src/H5EApkg.h b/src/H5EApkg.h
index b70231d..d21736a 100644
--- a/src/H5EApkg.h
+++ b/src/H5EApkg.h
@@ -30,8 +30,7 @@
#include "H5EAprivate.h"
/* Other private headers needed by this file */
-#include "H5FLprivate.h" /* Free Lists */
-
+#include "H5FLprivate.h" /* Free Lists */
/**************************/
/* Package Private Macros */
@@ -39,114 +38,114 @@
/* Fill value for extensible array test class */
#ifdef H5EA_TESTING
-#define H5EA_TEST_FILL ((uint64_t)ULLONG_MAX)
+#define H5EA_TEST_FILL ((uint64_t)ULLONG_MAX)
#endif /* H5EA_TESTING */
/* Size of checksum information (on disk) */
-#define H5EA_SIZEOF_CHKSUM 4
+#define H5EA_SIZEOF_CHKSUM 4
/* "Standard" size of prefix information for extensible array metadata */
-#define H5EA_METADATA_PREFIX_SIZE(c) ( \
- H5_SIZEOF_MAGIC /* Signature */ \
- + 1 /* Version */ \
- + 1 /* Array type */ \
- + ((c) ? H5EA_SIZEOF_CHKSUM : 0) /* Metadata checksum */ \
+#define H5EA_METADATA_PREFIX_SIZE(c) \
+ (H5_SIZEOF_MAGIC /* Signature */ \
+ + 1 /* Version */ \
+ + 1 /* Array type */ \
+ + ((c) ? H5EA_SIZEOF_CHKSUM : 0) /* Metadata checksum */ \
)
/* Size of the extensible array header on disk */
-#define H5EA_HEADER_SIZE(sizeof_addr, sizeof_size) ( \
- /* General metadata fields */ \
- H5EA_METADATA_PREFIX_SIZE(TRUE) \
- \
- /* General array information */ \
- + 1 /* Element Size */ \
- + 1 /* Max. # of elements bits */ \
- + 1 /* # of elements to store in index block */ \
- + 1 /* Min. # elements per data block */ \
- + 1 /* Min. # of data block pointers for a super block */ \
- + 1 /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ \
- \
- /* Extensible Array statistics fields */ \
- + (sizeof_size) /* Number of super blocks created */ \
- + (sizeof_size) /* Size of super blocks created */ \
- + (sizeof_size) /* Number of data blocks created */ \
- + (sizeof_size) /* Size of data blocks created */ \
- + (sizeof_size) /* Max. index set */ \
- + (sizeof_size) /* Number of elements 'realized' */ \
- \
- /* Extensible Array Header specific fields */ \
- + (sizeof_addr) /* File address of index block */ \
+#define H5EA_HEADER_SIZE(sizeof_addr, sizeof_size) \
+ (/* General metadata fields */ \
+ H5EA_METADATA_PREFIX_SIZE(TRUE) \
+ \
+ /* General array information */ \
+ + 1 /* Element Size */ \
+ + 1 /* Max. # of elements bits */ \
+ + 1 /* # of elements to store in index block */ \
+ + 1 /* Min. # elements per data block */ \
+ + 1 /* Min. # of data block pointers for a super block */ \
+ + 1 /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements \
+ in data block page */ \
+ \
+ /* Extensible Array statistics fields */ \
+ + (sizeof_size) /* Number of super blocks created */ \
+ + (sizeof_size) /* Size of super blocks created */ \
+ + (sizeof_size) /* Number of data blocks created */ \
+ + (sizeof_size) /* Size of data blocks created */ \
+ + (sizeof_size) /* Max. index set */ \
+ + (sizeof_size) /* Number of elements 'realized' */ \
+ \
+ /* Extensible Array Header specific fields */ \
+ + (sizeof_addr) /* File address of index block */ \
)
/* Size of the extensible array header on disk (via file pointer) */
-#define H5EA_HEADER_SIZE_FILE(f) ( \
- H5EA_HEADER_SIZE(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)) \
- )
+#define H5EA_HEADER_SIZE_FILE(f) (H5EA_HEADER_SIZE(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)))
/* Size of the extensible array header on disk (via extensible array header) */
-#define H5EA_HEADER_SIZE_HDR(h) ( \
- H5EA_HEADER_SIZE((h)->sizeof_addr, (h)->sizeof_size) \
- )
+#define H5EA_HEADER_SIZE_HDR(h) (H5EA_HEADER_SIZE((h)->sizeof_addr, (h)->sizeof_size))
/* Size of the extensible array index block on disk */
-#define H5EA_IBLOCK_SIZE(i) ( \
- /* General metadata fields */ \
- H5EA_METADATA_PREFIX_SIZE(TRUE) \
- \
- /* Sanity-checking fields */ \
- + (i)->hdr->sizeof_addr /* File address of array owning the block */ \
- \
- /* Extensible Array Index Block specific fields */ \
- + ((size_t)(i)->hdr->cparam.idx_blk_elmts * (size_t)(i)->hdr->cparam.raw_elmt_size) /* Elements in index block */ \
- + ((i)->ndblk_addrs * (i)->hdr->sizeof_addr) /* Data block addresses in index block */ \
- + ((i)->nsblk_addrs * (i)->hdr->sizeof_addr) /* Super block addresses in index block */ \
+#define H5EA_IBLOCK_SIZE(i) \
+ (/* General metadata fields */ \
+ H5EA_METADATA_PREFIX_SIZE(TRUE) \
+ \
+ /* Sanity-checking fields */ \
+ + (i)->hdr->sizeof_addr /* File address of array owning the block */ \
+ \
+ /* Extensible Array Index Block specific fields */ \
+ + ((size_t)(i)->hdr->cparam.idx_blk_elmts * \
+ (size_t)(i)->hdr->cparam.raw_elmt_size) /* Elements in index block */ \
+ + ((i)->ndblk_addrs * (i)->hdr->sizeof_addr) /* Data block addresses in index block */ \
+ + ((i)->nsblk_addrs * (i)->hdr->sizeof_addr) /* Super block addresses in index block */ \
)
/* Size of the extensible array super block on disk */
-#define H5EA_SBLOCK_SIZE(s) ( \
- /* General metadata fields */ \
- H5EA_METADATA_PREFIX_SIZE(TRUE) \
- \
- /* Sanity-checking fields */ \
- + (s)->hdr->sizeof_addr /* File address of array owning the block */ \
- + (s)->hdr->arr_off_size /* Offset of the block in the array */ \
- \
- /* Extensible Array Super Block specific fields */ \
- + ((s)->ndblks * (s)->dblk_page_init_size) /* Data block 'page init' bitmasks in super block (can be 0 if no pages) */ \
- + ((s)->ndblks * (s)->hdr->sizeof_addr) /* Data block addresses in super block */ \
+#define H5EA_SBLOCK_SIZE(s) \
+ (/* General metadata fields */ \
+ H5EA_METADATA_PREFIX_SIZE(TRUE) \
+ \
+ /* Sanity-checking fields */ \
+ + (s)->hdr->sizeof_addr /* File address of array owning the block */ \
+ + (s)->hdr->arr_off_size /* Offset of the block in the array */ \
+ \
+ /* Extensible Array Super Block specific fields */ \
+ + \
+ ((s)->ndblks * \
+ (s)->dblk_page_init_size) /* Data block 'page init' bitmasks in super block (can be 0 if no pages) */ \
+ + ((s)->ndblks * (s)->hdr->sizeof_addr) /* Data block addresses in super block */ \
)
/* Size of the extensible array data block prefix on disk */
-#define H5EA_DBLOCK_PREFIX_SIZE(d) ( \
- /* General metadata fields */ \
- H5EA_METADATA_PREFIX_SIZE(TRUE) \
- \
- /* Sanity-checking fields */ \
- + (d)->hdr->sizeof_addr /* File address of array owning the block */ \
- + (d)->hdr->arr_off_size /* Offset of the block in the array */ \
+#define H5EA_DBLOCK_PREFIX_SIZE(d) \
+ (/* General metadata fields */ \
+ H5EA_METADATA_PREFIX_SIZE(TRUE) \
+ \
+ /* Sanity-checking fields */ \
+ + (d)->hdr->sizeof_addr /* File address of array owning the block */ \
+ + (d)->hdr->arr_off_size /* Offset of the block in the array */ \
)
/* Size of the extensible array data block on disk */
-#define H5EA_DBLOCK_SIZE(d) ( \
- /* Data block prefix size */ \
- H5EA_DBLOCK_PREFIX_SIZE(d) \
- \
- /* Extensible Array Data Block specific fields */ \
- + ((d)->nelmts * (size_t)(d)->hdr->cparam.raw_elmt_size) /* Elements in data block */ \
- + ((d)->npages * H5EA_SIZEOF_CHKSUM) /* Checksum for each page */ \
+#define H5EA_DBLOCK_SIZE(d) \
+ (/* Data block prefix size */ \
+ H5EA_DBLOCK_PREFIX_SIZE(d) \
+ \
+ /* Extensible Array Data Block specific fields */ \
+ + ((d)->nelmts * (size_t)(d)->hdr->cparam.raw_elmt_size) /* Elements in data block */ \
+ + ((d)->npages * H5EA_SIZEOF_CHKSUM) /* Checksum for each page */ \
)
/* Size of the extensible array data block page on disk */
-#define H5EA_DBLK_PAGE_SIZE(h) ( \
- + ((h)->dblk_page_nelmts * (size_t)(h)->cparam.raw_elmt_size) /* Elements in data block page */ \
- + H5EA_SIZEOF_CHKSUM /* Checksum for each page */ \
+#define H5EA_DBLK_PAGE_SIZE(h) \
+ (+((h)->dblk_page_nelmts * (size_t)(h)->cparam.raw_elmt_size) /* Elements in data block page */ \
+ + H5EA_SIZEOF_CHKSUM /* Checksum for each page */ \
)
/* Compute the # of bytes required to store an offset into a given buffer size */
-#define H5EA_SIZEOF_OFFSET_BITS(b) (((b) + 7) / 8)
+#define H5EA_SIZEOF_OFFSET_BITS(b) (((b) + 7) / 8)
/* Compute the first super block index that will hold a certain # of data block pointers */
-#define H5EA_SBLK_FIRST_IDX(m) (2 * H5VM_log2_of2((uint32_t)m))
+#define H5EA_SBLK_FIRST_IDX(m) (2 * H5VM_log2_of2((uint32_t)m))
/****************************/
/* Package Private Typedefs */
@@ -154,10 +153,10 @@
/* Information for each super block in extensible array */
typedef struct H5EA_sblk_info_t {
- size_t ndblks; /* Number of data blocks for a super block */
- size_t dblk_nelmts; /* Number of elements in each data block for super block */
- hsize_t start_idx; /* Index of first element in super block */
- hsize_t start_dblk; /* Index of first data block in super block */
+ size_t ndblks; /* Number of data blocks for a super block */
+ size_t dblk_nelmts; /* Number of elements in each data block for super block */
+ hsize_t start_idx; /* Index of first element in super block */
+ hsize_t start_dblk; /* Index of first data block in super block */
} H5EA_sblk_info_t;
/* The extensible array header information */
@@ -169,63 +168,63 @@ typedef struct H5EA_hdr_t {
H5AC_info_t cache_info;
/* Extensible array configuration/creation parameters (stored in header) */
- H5EA_create_t cparam; /* Creation parameters for extensible array */
+ H5EA_create_t cparam; /* Creation parameters for extensible array */
/* Index block information (stored in header) */
- haddr_t idx_blk_addr; /* Address of index block in header */
+ haddr_t idx_blk_addr; /* Address of index block in header */
/* Statistics for array (stored in index block, actually) */
/* (header and index number/size fields not stored) */
- H5EA_stat_t stats; /* Statistics for extensible array */
+ H5EA_stat_t stats; /* Statistics for extensible array */
/* Data block element buffer factory info (not stored in header) */
struct {
- size_t nalloc; /* Number of factories allocated */
- H5FL_fac_head_t **fac; /* Array of factories for data block element buffers */
+ size_t nalloc; /* Number of factories allocated */
+ H5FL_fac_head_t **fac; /* Array of factories for data block element buffers */
} elmt_fac;
/* Computed/cached values (not stored in header) */
- size_t rc; /* Reference count of heap's components using heap header */
- haddr_t addr; /* Address of header in file */
- size_t size; /* Size of header in file */
- H5F_t *f; /* Pointer to file for extensible array */
- size_t file_rc; /* Reference count of files using array header */
- hbool_t pending_delete; /* Array is pending deletion */
- size_t sizeof_addr; /* Size of file addresses */
- size_t sizeof_size; /* Size of file sizes */
- unsigned char arr_off_size; /* Size of array offsets (in bytes) */
+ size_t rc; /* Reference count of heap's components using heap header */
+ haddr_t addr; /* Address of header in file */
+ size_t size; /* Size of header in file */
+ H5F_t * f; /* Pointer to file for extensible array */
+ size_t file_rc; /* Reference count of files using array header */
+ hbool_t pending_delete; /* Array is pending deletion */
+ size_t sizeof_addr; /* Size of file addresses */
+ size_t sizeof_size; /* Size of file sizes */
+ unsigned char arr_off_size; /* Size of array offsets (in bytes) */
/* Super block information (not stored) */
- size_t nsblks; /* Number of superblocks needed for array */
- H5EA_sblk_info_t *sblk_info; /* Array of information for each super block */
+ size_t nsblks; /* Number of superblocks needed for array */
+ H5EA_sblk_info_t *sblk_info; /* Array of information for each super block */
/* Data block information (not stored) */
- size_t dblk_page_nelmts; /* # of elements per data block page */
+ size_t dblk_page_nelmts; /* # of elements per data block page */
/* Client information (not stored) */
- void *cb_ctx; /* Callback context */
+ void *cb_ctx; /* Callback context */
/* SWMR / Flush dependency information (not stored) */
- hbool_t swmr_write; /* Flag indicating the file is opened with SWMR-write access */
- H5AC_proxy_entry_t *top_proxy; /* 'Top' proxy cache entry for all array entries */
- void *parent; /* Pointer to 'top' proxy flush dependency
- * parent, if it exists, otherwise NULL.
- * If the extensible array is being used
- * to index a chunked dataset and the
- * dataset metadata is modified by a
- * SWMR writer, this field will be set
- * equal to the object header proxy
- * that is the flush dependency parent
- * of the extensible array header.
- *
- * The field is used to avoid duplicate
- * setups of the flush dependency
- * relationship, and to allow the
- * extensible array header to destroy
- * the flush dependency on receipt of
- * an eviction notification from the
- * metadata cache.
- */
+ hbool_t swmr_write; /* Flag indicating the file is opened with SWMR-write access */
+ H5AC_proxy_entry_t *top_proxy; /* 'Top' proxy cache entry for all array entries */
+ void * parent; /* Pointer to 'top' proxy flush dependency
+ * parent, if it exists, otherwise NULL.
+ * If the extensible array is being used
+ * to index a chunked dataset and the
+ * dataset metadata is modified by a
+ * SWMR writer, this field will be set
+ * equal to the object header proxy
+ * that is the flush dependency parent
+ * of the extensible array header.
+ *
+ * The field is used to avoid duplicate
+ * setups of the flush dependency
+ * relationship, and to allow the
+ * extensible array header to destroy
+ * the flush dependency on receipt of
+ * an eviction notification from the
+ * metadata cache.
+ */
} H5EA_hdr_t;
/* The extensible array index block information */
@@ -234,22 +233,22 @@ typedef struct H5EA_iblock_t {
H5AC_info_t cache_info;
/* Extensible array information (stored) */
- void *elmts; /* Buffer for elements stored in index block */
- haddr_t *dblk_addrs; /* Buffer for addresses of data blocks in index block */
- haddr_t *sblk_addrs; /* Buffer for addresses of super blocks in index block */
+ void * elmts; /* Buffer for elements stored in index block */
+ haddr_t *dblk_addrs; /* Buffer for addresses of data blocks in index block */
+ haddr_t *sblk_addrs; /* Buffer for addresses of super blocks in index block */
/* Internal array information (not stored) */
- H5EA_hdr_t *hdr; /* Shared array header info */
- haddr_t addr; /* Address of this index block on disk */
- size_t size; /* Size of index block on disk */
+ H5EA_hdr_t *hdr; /* Shared array header info */
+ haddr_t addr; /* Address of this index block on disk */
+ size_t size; /* Size of index block on disk */
/* SWMR / Flush dependency information (not stored) */
- H5AC_proxy_entry_t *top_proxy; /* "Top" proxy cache entry for all array entries */
+ H5AC_proxy_entry_t *top_proxy; /* "Top" proxy cache entry for all array entries */
/* Computed/cached values (not stored) */
- size_t nsblks; /* # of super blocks whose data block addresses are in index block */
- size_t ndblk_addrs; /* Number of pointers to data blocks in index block */
- size_t nsblk_addrs; /* Number of pointers to super blocks in index block */
+ size_t nsblks; /* # of super blocks whose data block addresses are in index block */
+ size_t ndblk_addrs; /* Number of pointers to data blocks in index block */
+ size_t nsblk_addrs; /* Number of pointers to super blocks in index block */
} H5EA_iblock_t;
/* The extensible array super block information */
@@ -258,27 +257,27 @@ typedef struct H5EA_sblock_t {
H5AC_info_t cache_info;
/* Extensible array information (stored) */
- hsize_t block_off; /* Offset of the block within the array's address space */
- haddr_t *dblk_addrs; /* Addresses of data blocks in super block */
- uint8_t *page_init; /* Bitmap of whether a data block page is initialized */
+ hsize_t block_off; /* Offset of the block within the array's address space */
+ haddr_t *dblk_addrs; /* Addresses of data blocks in super block */
+ uint8_t *page_init; /* Bitmap of whether a data block page is initialized */
/* Internal array information (not stored) */
- H5EA_hdr_t *hdr; /* Shared array header info */
- haddr_t addr; /* Address of this index block on disk */
- size_t size; /* Size of index block on disk */
+ H5EA_hdr_t *hdr; /* Shared array header info */
+ haddr_t addr; /* Address of this index block on disk */
+ size_t size; /* Size of index block on disk */
/* SWMR / Flush dependency information (not stored) */
- hbool_t has_hdr_depend; /* Whether this object has a flush dependency on the header */
+ hbool_t has_hdr_depend; /* Whether this object has a flush dependency on the header */
H5AC_proxy_entry_t *top_proxy; /* "Top" proxy cache entry for all array entries */
- H5EA_iblock_t *parent; /* Parent object for super block (index block) */
+ H5EA_iblock_t * parent; /* Parent object for super block (index block) */
/* Computed/cached values (not stored) */
- unsigned idx; /* Super block index within the extensible array */
- size_t ndblks; /* # of data block addresses that are in super block */
- size_t dblk_nelmts; /* # of elements for data blocks reachable through this super block */
- size_t dblk_npages; /* # of pages in each data block */
- size_t dblk_page_init_size; /* Size of 'page init' bitmask for each data block */
- size_t dblk_page_size; /* Size of a data block page */
+ unsigned idx; /* Super block index within the extensible array */
+ size_t ndblks; /* # of data block addresses that are in super block */
+ size_t dblk_nelmts; /* # of elements for data blocks reachable through this super block */
+ size_t dblk_npages; /* # of pages in each data block */
+ size_t dblk_page_init_size; /* Size of 'page init' bitmask for each data block */
+ size_t dblk_page_size; /* Size of a data block page */
} H5EA_sblock_t;
/* The extensible array data block information */
@@ -287,22 +286,22 @@ typedef struct H5EA_dblock_t {
H5AC_info_t cache_info;
/* Extensible array information (stored) */
- hsize_t block_off; /* Offset of the block within the array's address space */
- void *elmts; /* Buffer for elements stored in data block */
+ hsize_t block_off; /* Offset of the block within the array's address space */
+ void * elmts; /* Buffer for elements stored in data block */
/* Internal array information (not stored) */
- H5EA_hdr_t *hdr; /* Shared array header info */
- haddr_t addr; /* Address of this data block on disk */
- size_t size; /* Size of data block on disk */
+ H5EA_hdr_t *hdr; /* Shared array header info */
+ haddr_t addr; /* Address of this data block on disk */
+ size_t size; /* Size of data block on disk */
/* SWMR / Flush dependency information (not stored) */
- hbool_t has_hdr_depend; /* Whether this object has a flush dependency on the header */
+ hbool_t has_hdr_depend; /* Whether this object has a flush dependency on the header */
H5AC_proxy_entry_t *top_proxy; /* 'Top' proxy cache entry for all array entries */
- void *parent; /* Parent object for data block (index or super block) */
+ void * parent; /* Parent object for data block (index or super block) */
/* Computed/cached values (not stored) */
- size_t nelmts; /* Number of elements in block */
- size_t npages; /* Nummber of pages in a block (zero if not paged) */
+ size_t nelmts; /* Number of elements in block */
+ size_t npages; /* Nummber of pages in a block (zero if not paged) */
} H5EA_dblock_t;
/* The extensible array data block page information */
@@ -311,17 +310,17 @@ typedef struct H5EA_dbk_page_t {
H5AC_info_t cache_info;
/* Extensible array information (stored) */
- void *elmts; /* Buffer for elements stored in data block page */
+ void *elmts; /* Buffer for elements stored in data block page */
/* Internal array information (not stored) */
- H5EA_hdr_t *hdr; /* Shared array header info */
- haddr_t addr; /* Address of this data block page on disk */
- size_t size; /* Size of data block page on disk */
+ H5EA_hdr_t *hdr; /* Shared array header info */
+ haddr_t addr; /* Address of this data block page on disk */
+ size_t size; /* Size of data block page on disk */
/* SWMR / Flush dependency information (not stored) */
- hbool_t has_hdr_depend; /* Whether this object has a flush dependency on the header */
+ hbool_t has_hdr_depend; /* Whether this object has a flush dependency on the header */
H5AC_proxy_entry_t *top_proxy; /* "Top" proxy cache entry for all array entries */
- H5EA_sblock_t *parent; /* Parent object for data block page (super block) */
+ H5EA_sblock_t * parent; /* Parent object for data block page (super block) */
/* Computed/cached values (not stored) */
/* <none> */
@@ -329,46 +328,46 @@ typedef struct H5EA_dbk_page_t {
/* Extensible array */
struct H5EA_t {
- H5EA_hdr_t *hdr; /* Pointer to internal extensible array header info */
- H5F_t *f; /* Pointer to file for extensible array */
+ H5EA_hdr_t *hdr; /* Pointer to internal extensible array header info */
+ H5F_t * f; /* Pointer to file for extensible array */
};
/* Metadata cache callback user data types */
/* Info needed for loading header */
typedef struct H5EA_hdr_cache_ud_t {
- H5F_t *f; /* Pointer to file for extensible array */
- haddr_t addr; /* Address of header on disk */
- void *ctx_udata; /* User context for class */
+ H5F_t * f; /* Pointer to file for extensible array */
+ haddr_t addr; /* Address of header on disk */
+ void * ctx_udata; /* User context for class */
} H5EA_hdr_cache_ud_t;
/* Info needed for loading super block */
typedef struct H5EA_sblock_cache_ud_t {
- H5EA_hdr_t *hdr; /* Shared extensible array information */
- H5EA_iblock_t *parent; /* Pointer to parent object for super block (index block) */
- unsigned sblk_idx; /* Index of super block */
- haddr_t sblk_addr; /* Address of super block */
+ H5EA_hdr_t * hdr; /* Shared extensible array information */
+ H5EA_iblock_t *parent; /* Pointer to parent object for super block (index block) */
+ unsigned sblk_idx; /* Index of super block */
+ haddr_t sblk_addr; /* Address of super block */
} H5EA_sblock_cache_ud_t;
/* Info needed for loading data block */
typedef struct H5EA_dblock_cache_ud_t {
- H5EA_hdr_t *hdr; /* Shared extensible array information */
- void *parent; /* Pointer to parent object for data block (index or super block) */
- size_t nelmts; /* Number of elements in data block */
- haddr_t dblk_addr; /* Address of data block */
+ H5EA_hdr_t *hdr; /* Shared extensible array information */
+ void * parent; /* Pointer to parent object for data block (index or super block) */
+ size_t nelmts; /* Number of elements in data block */
+ haddr_t dblk_addr; /* Address of data block */
} H5EA_dblock_cache_ud_t;
/* Info needed for loading data block page */
typedef struct H5EA_dblk_page_cache_ud_t {
- H5EA_hdr_t *hdr; /* Shared extensible array information */
- H5EA_sblock_t *parent; /* Pointer to parent object for data block page (super block) */
- haddr_t dblk_page_addr; /* Address of data block page */
+ H5EA_hdr_t * hdr; /* Shared extensible array information */
+ H5EA_sblock_t *parent; /* Pointer to parent object for data block page (super block) */
+ haddr_t dblk_page_addr; /* Address of data block page */
} H5EA_dblk_page_cache_ud_t;
#ifdef H5EA_TESTING
typedef struct H5EA__ctx_cb_t {
- herr_t (*encode)(const void *elmt, size_t nelmts, void *udata); /* Perform action during encode step */
- void *udata; /* User data for encode action */
+ herr_t (*encode)(const void *elmt, size_t nelmts, void *udata); /* Perform action during encode step */
+ void *udata; /* User data for encode action */
} H5EA__ctx_cb_t;
#endif /* H5EA_TESTING */
@@ -382,96 +381,84 @@ H5_DLLVAR const H5EA_class_t H5EA_CLS_TEST[1];
/* Array of extensible array client ID -> client class mappings */
H5_DLLVAR const H5EA_class_t *const H5EA_client_class_g[H5EA_NUM_CLS_ID];
-
/******************************/
/* Package Private Prototypes */
/******************************/
/* Generic routines */
-H5_DLL herr_t H5EA__create_flush_depend(H5AC_info_t *parent_entry,
- H5AC_info_t *child_entry);
-H5_DLL herr_t H5EA__destroy_flush_depend(H5AC_info_t *parent_entry,
- H5AC_info_t *child_entry);
+H5_DLL herr_t H5EA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry);
+H5_DLL herr_t H5EA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry);
/* Header routines */
H5_DLL H5EA_hdr_t *H5EA__hdr_alloc(H5F_t *f);
-H5_DLL herr_t H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata);
-H5_DLL haddr_t H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam,
- void *ctx_udata);
-H5_DLL void *H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts);
-H5_DLL herr_t H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts);
-H5_DLL herr_t H5EA__hdr_incr(H5EA_hdr_t *hdr);
-H5_DLL herr_t H5EA__hdr_decr(H5EA_hdr_t *hdr);
-H5_DLL herr_t H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr);
-H5_DLL size_t H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr);
-H5_DLL herr_t H5EA__hdr_modified(H5EA_hdr_t *hdr);
-H5_DLL H5EA_hdr_t *H5EA__hdr_protect(H5F_t *f, haddr_t ea_addr,
- void *ctx_udata, unsigned flags);
-H5_DLL herr_t H5EA__hdr_unprotect(H5EA_hdr_t *hdr, unsigned cache_flags);
-H5_DLL herr_t H5EA__hdr_delete(H5EA_hdr_t *hdr);
-H5_DLL herr_t H5EA__hdr_dest(H5EA_hdr_t *hdr);
+H5_DLL herr_t H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata);
+H5_DLL haddr_t H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata);
+H5_DLL void * H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts);
+H5_DLL herr_t H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts);
+H5_DLL herr_t H5EA__hdr_incr(H5EA_hdr_t *hdr);
+H5_DLL herr_t H5EA__hdr_decr(H5EA_hdr_t *hdr);
+H5_DLL herr_t H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr);
+H5_DLL size_t H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr);
+H5_DLL herr_t H5EA__hdr_modified(H5EA_hdr_t *hdr);
+H5_DLL H5EA_hdr_t *H5EA__hdr_protect(H5F_t *f, haddr_t ea_addr, void *ctx_udata, unsigned flags);
+H5_DLL herr_t H5EA__hdr_unprotect(H5EA_hdr_t *hdr, unsigned cache_flags);
+H5_DLL herr_t H5EA__hdr_delete(H5EA_hdr_t *hdr);
+H5_DLL herr_t H5EA__hdr_dest(H5EA_hdr_t *hdr);
/* Index block routines */
H5_DLL H5EA_iblock_t *H5EA__iblock_alloc(H5EA_hdr_t *hdr);
-H5_DLL haddr_t H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed);
+H5_DLL haddr_t H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed);
H5_DLL H5EA_iblock_t *H5EA__iblock_protect(H5EA_hdr_t *hdr, unsigned flags);
-H5_DLL herr_t H5EA__iblock_unprotect(H5EA_iblock_t *iblock, unsigned cache_flags);
-H5_DLL herr_t H5EA__iblock_delete(H5EA_hdr_t *hdr);
-H5_DLL herr_t H5EA__iblock_dest(H5EA_iblock_t *iblock);
+H5_DLL herr_t H5EA__iblock_unprotect(H5EA_iblock_t *iblock, unsigned cache_flags);
+H5_DLL herr_t H5EA__iblock_delete(H5EA_hdr_t *hdr);
+H5_DLL herr_t H5EA__iblock_dest(H5EA_iblock_t *iblock);
/* Super block routines */
-H5_DLL H5EA_sblock_t *H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent,
- unsigned sblk_idx);
-H5_DLL haddr_t H5EA__sblock_create(H5EA_hdr_t *hdr, H5EA_iblock_t *parent,
- hbool_t *stats_changed, unsigned sblk_idx);
-H5_DLL H5EA_sblock_t *H5EA__sblock_protect(H5EA_hdr_t *hdr, H5EA_iblock_t *parent,
- haddr_t sblk_addr, unsigned sblk_idx, unsigned flags);
-H5_DLL herr_t H5EA__sblock_unprotect(H5EA_sblock_t *sblock, unsigned cache_flags);
-H5_DLL herr_t H5EA__sblock_delete(H5EA_hdr_t *hdr, H5EA_iblock_t *parent,
- haddr_t sblk_addr, unsigned sblk_idx);
-H5_DLL herr_t H5EA__sblock_dest(H5EA_sblock_t *sblock);
+H5_DLL H5EA_sblock_t *H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx);
+H5_DLL haddr_t H5EA__sblock_create(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, hbool_t *stats_changed,
+ unsigned sblk_idx);
+H5_DLL H5EA_sblock_t *H5EA__sblock_protect(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr,
+ unsigned sblk_idx, unsigned flags);
+H5_DLL herr_t H5EA__sblock_unprotect(H5EA_sblock_t *sblock, unsigned cache_flags);
+H5_DLL herr_t H5EA__sblock_delete(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr,
+ unsigned sblk_idx);
+H5_DLL herr_t H5EA__sblock_dest(H5EA_sblock_t *sblock);
/* Data block routines */
-H5_DLL H5EA_dblock_t *H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent,
- size_t nelmts);
-H5_DLL haddr_t H5EA__dblock_create(H5EA_hdr_t *hdr, void *parent,
- hbool_t *stats_changed, hsize_t dblk_off, size_t nelmts);
+H5_DLL H5EA_dblock_t *H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent, size_t nelmts);
+H5_DLL haddr_t H5EA__dblock_create(H5EA_hdr_t *hdr, void *parent, hbool_t *stats_changed, hsize_t dblk_off,
+ size_t nelmts);
H5_DLL unsigned H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx);
-H5_DLL H5EA_dblock_t *H5EA__dblock_protect(H5EA_hdr_t *hdr, void *parent,
- haddr_t dblk_addr, size_t dblk_nelmts, unsigned flags);
-H5_DLL herr_t H5EA__dblock_unprotect(H5EA_dblock_t *dblock, unsigned cache_flags);
-H5_DLL herr_t H5EA__dblock_delete(H5EA_hdr_t *hdr, void *parent,
- haddr_t dblk_addr, size_t dblk_nelmts);
+H5_DLL H5EA_dblock_t *H5EA__dblock_protect(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr,
+ size_t dblk_nelmts, unsigned flags);
+H5_DLL herr_t H5EA__dblock_unprotect(H5EA_dblock_t *dblock, unsigned cache_flags);
+H5_DLL herr_t H5EA__dblock_delete(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts);
H5_DLL herr_t H5EA__dblock_dest(H5EA_dblock_t *dblock);
/* Data block page routines */
H5_DLL H5EA_dblk_page_t *H5EA__dblk_page_alloc(H5EA_hdr_t *hdr, H5EA_sblock_t *parent);
-H5_DLL herr_t H5EA__dblk_page_create(H5EA_hdr_t *hdr, H5EA_sblock_t *parent,
- haddr_t addr);
-H5_DLL H5EA_dblk_page_t *H5EA__dblk_page_protect(H5EA_hdr_t *hdr,
- H5EA_sblock_t *parent, haddr_t dblk_page_addr, unsigned flags);
-H5_DLL herr_t H5EA__dblk_page_unprotect(H5EA_dblk_page_t *dblk_page,
- unsigned cache_flags);
-H5_DLL herr_t H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page);
+H5_DLL herr_t H5EA__dblk_page_create(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t addr);
+H5_DLL H5EA_dblk_page_t *H5EA__dblk_page_protect(H5EA_hdr_t *hdr, H5EA_sblock_t *parent,
+ haddr_t dblk_page_addr, unsigned flags);
+H5_DLL herr_t H5EA__dblk_page_unprotect(H5EA_dblk_page_t *dblk_page, unsigned cache_flags);
+H5_DLL herr_t H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page);
/* Debugging routines for dumping file structures */
-H5_DLL herr_t H5EA__hdr_debug(H5F_t *f, haddr_t addr,
- FILE *stream, int indent, int fwidth, const H5EA_class_t *cls, haddr_t obj_addr);
-H5_DLL herr_t H5EA__iblock_debug(H5F_t *f, haddr_t addr,
- FILE *stream, int indent, int fwidth, const H5EA_class_t *cls,
- haddr_t hdr_addr, haddr_t obj_addr);
-H5_DLL herr_t H5EA__sblock_debug(H5F_t *f, haddr_t addr,
- FILE *stream, int indent, int fwidth, const H5EA_class_t *cls,
- haddr_t hdr_addr, unsigned sblk_idx, haddr_t obj_addr);
-H5_DLL herr_t H5EA__dblock_debug(H5F_t *f, haddr_t addr,
- FILE *stream, int indent, int fwidth, const H5EA_class_t *cls,
- haddr_t hdr_addr, size_t dblk_nelmts, haddr_t obj_addr);
+H5_DLL herr_t H5EA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
+ const H5EA_class_t *cls, haddr_t obj_addr);
+H5_DLL herr_t H5EA__iblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
+ const H5EA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr);
+H5_DLL herr_t H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
+ const H5EA_class_t *cls, haddr_t hdr_addr, unsigned sblk_idx,
+ haddr_t obj_addr);
+H5_DLL herr_t H5EA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
+ const H5EA_class_t *cls, haddr_t hdr_addr, size_t dblk_nelmts,
+ haddr_t obj_addr);
/* Testing routines */
#ifdef H5EA_TESTING
H5_DLL herr_t H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam);
-H5_DLL int H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2);
+H5_DLL int H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2);
#endif /* H5EA_TESTING */
#endif /* _H5EApkg_H */
-
diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h
index af0ef3a..5ead26c 100644
--- a/src/H5EAprivate.h
+++ b/src/H5EAprivate.h
@@ -32,28 +32,26 @@
#endif /* NOT_YET */
/* Private headers needed by this file */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Fprivate.h" /* File access */
-
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Fprivate.h" /* File access */
/**************************/
/* Library Private Macros */
/**************************/
-
/****************************/
/* Library Private Typedefs */
/****************************/
/* Extensible array class IDs */
typedef enum H5EA_cls_id_t {
- H5EA_CLS_CHUNK_ID = 0, /* Extensible array is for indexing dataset chunks w/o filters */
- H5EA_CLS_FILT_CHUNK_ID, /* Extensible array is for indexing dataset chunks w/filters */
+ H5EA_CLS_CHUNK_ID = 0, /* Extensible array is for indexing dataset chunks w/o filters */
+ H5EA_CLS_FILT_CHUNK_ID, /* Extensible array is for indexing dataset chunks w/filters */
/* Start real class IDs at 0 -QAK */
/* (keep these last) */
- H5EA_CLS_TEST_ID, /* Extensible array is for testing (do not use for actual data) */
- H5EA_NUM_CLS_ID /* Number of Extensible Array class IDs (must be last) */
+ H5EA_CLS_TEST_ID, /* Extensible array is for testing (do not use for actual data) */
+ H5EA_NUM_CLS_ID /* Number of Extensible Array class IDs (must be last) */
} H5EA_cls_id_t;
/*
@@ -61,30 +59,36 @@ typedef enum H5EA_cls_id_t {
* variable of this type that contains class variables and methods.
*/
typedef struct H5EA_class_t {
- H5EA_cls_id_t id; /* ID of Extensible Array class, as found in file */
- const char *name; /* Name of class (for debugging) */
- size_t nat_elmt_size; /* Size of native (memory) element */
+ H5EA_cls_id_t id; /* ID of Extensible Array class, as found in file */
+ const char * name; /* Name of class (for debugging) */
+ size_t nat_elmt_size; /* Size of native (memory) element */
/* Extensible array client callback methods */
- void *(*crt_context)(void *udata); /* Create context for other callbacks */
- herr_t (*dst_context)(void *ctx); /* Destroy context */
- herr_t (*fill)(void *nat_blk, size_t nelmts); /* Fill array of elements with encoded form of "missing element" value */
- herr_t (*encode)(void *raw, const void *elmt, size_t nelmts, void *ctx); /* Encode elements from native form to disk storage form */
- herr_t (*decode)(const void *raw, void *elmt, size_t nelmts, void *ctx); /* Decode elements from disk storage form to native form */
- herr_t (*debug)(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt); /* Print an element for debugging */
+ void *(*crt_context)(void *udata); /* Create context for other callbacks */
+ herr_t (*dst_context)(void *ctx); /* Destroy context */
+ herr_t (*fill)(void * nat_blk,
+ size_t nelmts); /* Fill array of elements with encoded form of "missing element" value */
+ herr_t (*encode)(void *raw, const void *elmt, size_t nelmts,
+ void *ctx); /* Encode elements from native form to disk storage form */
+ herr_t (*decode)(const void *raw, void *elmt, size_t nelmts,
+ void *ctx); /* Decode elements from disk storage form to native form */
+ herr_t (*debug)(FILE *stream, int indent, int fwidth, hsize_t idx,
+ const void *elmt); /* Print an element for debugging */
void *(*crt_dbg_ctx)(H5F_t *f, haddr_t obj_addr); /* Create debugging context */
- herr_t (*dst_dbg_ctx)(void *dbg_ctx); /* Destroy debugging context */
+ herr_t (*dst_dbg_ctx)(void *dbg_ctx); /* Destroy debugging context */
} H5EA_class_t;
/* Extensible array creation parameters */
typedef struct H5EA_create_t {
- const H5EA_class_t *cls; /* Class of extensible array to create */
- uint8_t raw_elmt_size; /* Element size in file (in bytes) */
- uint8_t max_nelmts_bits; /* Log2(Max. # of elements in array) - i.e. # of bits needed to store max. # of elements */
- uint8_t idx_blk_elmts; /* # of elements to store in index block */
- uint8_t data_blk_min_elmts; /* Min. # of elements per data block */
- uint8_t sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */
- uint8_t max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */
+ const H5EA_class_t *cls; /* Class of extensible array to create */
+ uint8_t raw_elmt_size; /* Element size in file (in bytes) */
+ uint8_t max_nelmts_bits; /* Log2(Max. # of elements in array) - i.e. # of bits needed to store max. # of
+ elements */
+ uint8_t idx_blk_elmts; /* # of elements to store in index block */
+ uint8_t data_blk_min_elmts; /* Min. # of elements per data block */
+ uint8_t sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */
+ uint8_t max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed
+ to store max. # of elements in data block page */
} H5EA_create_t;
/* Extensible array metadata statistics info */
@@ -94,19 +98,20 @@ typedef struct H5EA_create_t {
typedef struct H5EA_stat_t {
/* Non-stored (i.e. computed) fields */
struct {
- hsize_t hdr_size; /* Size of header */
- hsize_t nindex_blks; /* # of index blocks (should be 0 or 1) */
- hsize_t index_blk_size; /* Size of index blocks allocated */
+ hsize_t hdr_size; /* Size of header */
+ hsize_t nindex_blks; /* # of index blocks (should be 0 or 1) */
+ hsize_t index_blk_size; /* Size of index blocks allocated */
} computed;
/* Stored fields */
struct {
- hsize_t nsuper_blks; /* # of super blocks */
- hsize_t super_blk_size; /* Size of super blocks allocated */
- hsize_t ndata_blks; /* # of data blocks */
- hsize_t data_blk_size; /* Size of data blocks allocated */
- hsize_t max_idx_set; /* Highest element index stored (+1 - i.e. if element 0 has been set, this value with be '1', if no elements have been stored, this value will be '0') */
- hsize_t nelmts; /* # of elements "realized" */
+ hsize_t nsuper_blks; /* # of super blocks */
+ hsize_t super_blk_size; /* Size of super blocks allocated */
+ hsize_t ndata_blks; /* # of data blocks */
+ hsize_t data_blk_size; /* Size of data blocks allocated */
+ hsize_t max_idx_set; /* Highest element index stored (+1 - i.e. if element 0 has been set, this value
+ with be '1', if no elements have been stored, this value will be '0') */
+ hsize_t nelmts; /* # of elements "realized" */
} stored;
} H5EA_stat_t;
@@ -116,7 +121,6 @@ typedef struct H5EA_t H5EA_t;
/* Define the operator callback function pointer for H5EA_iterate() */
typedef int (*H5EA_operator_t)(hsize_t idx, const void *_elmt, void *_udata);
-
/*****************************/
/* Library-private Variables */
/*****************************/
@@ -127,24 +131,22 @@ H5_DLLVAR const H5EA_class_t H5EA_CLS_CHUNK[1];
/* The Extensible Array class for dataset chunks w/ filters*/
H5_DLLVAR const H5EA_class_t H5EA_CLS_FILT_CHUNK[1];
-
/***************************************/
/* Library-private Function Prototypes */
/***************************************/
/* General routines */
-H5_DLL H5EA_t *H5EA_create(H5F_t *f, const H5EA_create_t *cparam,
- void *ctx_udata);
+H5_DLL H5EA_t *H5EA_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata);
H5_DLL H5EA_t *H5EA_open(H5F_t *f, haddr_t ea_addr, void *ctx_udata);
-H5_DLL herr_t H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts);
-H5_DLL herr_t H5EA_get_addr(const H5EA_t *ea, haddr_t *addr);
-H5_DLL herr_t H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt);
-H5_DLL herr_t H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt);
-H5_DLL herr_t H5EA_depend(H5EA_t *ea, H5AC_proxy_entry_t *parent);
-H5_DLL herr_t H5EA_iterate(H5EA_t *fa, H5EA_operator_t op, void *udata);
-H5_DLL herr_t H5EA_close(H5EA_t *ea);
-H5_DLL herr_t H5EA_delete(H5F_t *f, haddr_t ea_addr, void *ctx_udata);
-H5_DLL herr_t H5EA_patch_file(H5EA_t *fa, H5F_t *f);
+H5_DLL herr_t H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts);
+H5_DLL herr_t H5EA_get_addr(const H5EA_t *ea, haddr_t *addr);
+H5_DLL herr_t H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt);
+H5_DLL herr_t H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt);
+H5_DLL herr_t H5EA_depend(H5EA_t *ea, H5AC_proxy_entry_t *parent);
+H5_DLL herr_t H5EA_iterate(H5EA_t *fa, H5EA_operator_t op, void *udata);
+H5_DLL herr_t H5EA_close(H5EA_t *ea);
+H5_DLL herr_t H5EA_delete(H5F_t *f, haddr_t ea_addr, void *ctx_udata);
+H5_DLL herr_t H5EA_patch_file(H5EA_t *fa, H5F_t *f);
/* Statistics routines */
H5_DLL herr_t H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats);
@@ -154,4 +156,3 @@ H5_DLL herr_t H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats);
#endif /* H5EA_DEBUGGING */
#endif /* _H5EAprivate_H */
-
diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c
index b5b9d94..f48525f 100644
--- a/src/H5EAsblock.c
+++ b/src/H5EAsblock.c
@@ -26,55 +26,46 @@
/* Module Declaration */
/**********************/
-#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
-
+#include "H5EAmodule.h" /* This source code file is part of the H5EA module */
/***********************/
/* Other Packages Used */
/***********************/
-
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5EApkg.h" /* Extensible Arrays */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5VMprivate.h" /* Vectors and arrays */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5EApkg.h" /* Extensible Arrays */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5VMprivate.h" /* Vectors and arrays */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -88,8 +79,6 @@ H5FL_SEQ_DEFINE_STATIC(haddr_t);
/* Declare a free list to manage blocks of 'page init' bitmasks */
H5FL_BLK_DEFINE(page_init);
-
-
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_alloc
*
@@ -102,74 +91,72 @@ H5FL_BLK_DEFINE(page_init);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-H5EA_sblock_t *, NULL, NULL,
-H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx))
+BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL,
+ H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx))
- /* Local variables */
- H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
+/* Local variables */
+H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
- /* Check arguments */
- HDassert(hdr);
+/* Check arguments */
+HDassert(hdr);
- /* Allocate memory for the index block */
- if(NULL == (sblock = H5FL_CALLOC(H5EA_sblock_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block")
+/* Allocate memory for the index block */
+if (NULL == (sblock = H5FL_CALLOC(H5EA_sblock_t)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block")
- /* Share common array information */
- if(H5EA__hdr_incr(hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
- sblock->hdr = hdr;
+/* Share common array information */
+if (H5EA__hdr_incr(hdr) < 0)
+ H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+sblock->hdr = hdr;
- /* Set non-zero internal fields */
- sblock->parent = parent;
- sblock->addr = HADDR_UNDEF;
+/* Set non-zero internal fields */
+sblock->parent = parent;
+sblock->addr = HADDR_UNDEF;
- /* Compute/cache information */
- sblock->idx = sblk_idx;
- sblock->ndblks = hdr->sblk_info[sblk_idx].ndblks;
- HDassert(sblock->ndblks);
- sblock->dblk_nelmts = hdr->sblk_info[sblk_idx].dblk_nelmts;
+/* Compute/cache information */
+sblock->idx = sblk_idx;
+sblock->ndblks = hdr->sblk_info[sblk_idx].ndblks;
+HDassert(sblock->ndblks);
+sblock->dblk_nelmts = hdr->sblk_info[sblk_idx].dblk_nelmts;
- /* Allocate buffer for data block addresses in super block */
- if(NULL == (sblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, sblock->ndblks)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block data block addresses")
+/* Allocate buffer for data block addresses in super block */
+if (NULL == (sblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, sblock->ndblks)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block data block addresses")
- /* Check if # of elements in data blocks requires paging */
- if(sblock->dblk_nelmts > hdr->dblk_page_nelmts) {
- /* Compute # of pages in each data block from this super block */
- sblock->dblk_npages = sblock->dblk_nelmts / hdr->dblk_page_nelmts;
+/* Check if # of elements in data blocks requires paging */
+if (sblock->dblk_nelmts > hdr->dblk_page_nelmts) {
+ /* Compute # of pages in each data block from this super block */
+ sblock->dblk_npages = sblock->dblk_nelmts / hdr->dblk_page_nelmts;
- /* Sanity check that we have at least 2 pages in data block */
- HDassert(sblock->dblk_npages > 1);
+ /* Sanity check that we have at least 2 pages in data block */
+ HDassert(sblock->dblk_npages > 1);
- /* Sanity check for integer truncation */
- HDassert((sblock->dblk_npages * hdr->dblk_page_nelmts) == sblock->dblk_nelmts);
+ /* Sanity check for integer truncation */
+ HDassert((sblock->dblk_npages * hdr->dblk_page_nelmts) == sblock->dblk_nelmts);
- /* Compute size of buffer for each data block's 'page init' bitmask */
- sblock->dblk_page_init_size = ((sblock->dblk_npages) + 7) / 8;
- HDassert(sblock->dblk_page_init_size > 0);
+ /* Compute size of buffer for each data block's 'page init' bitmask */
+ sblock->dblk_page_init_size = ((sblock->dblk_npages) + 7) / 8;
+ HDassert(sblock->dblk_page_init_size > 0);
- /* Allocate buffer for all 'page init' bitmasks in super block */
- if(NULL == (sblock->page_init = H5FL_BLK_CALLOC(page_init, sblock->ndblks * sblock->dblk_page_init_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block page init bitmask")
+ /* Allocate buffer for all 'page init' bitmasks in super block */
+ if (NULL ==
+ (sblock->page_init = H5FL_BLK_CALLOC(page_init, sblock->ndblks * sblock->dblk_page_init_size)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block page init bitmask")
- /* Compute data block page size */
- sblock->dblk_page_size = (hdr->dblk_page_nelmts * hdr->cparam.raw_elmt_size)
- + H5EA_SIZEOF_CHKSUM;
- } /* end if */
+ /* Compute data block page size */
+ sblock->dblk_page_size = (hdr->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5EA_SIZEOF_CHKSUM;
+} /* end if */
- /* Set the return value */
- ret_value = sblock;
+/* Set the return value */
+ret_value = sblock;
CATCH
- if(!ret_value)
- if(sblock && H5EA__sblock_dest(sblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block")
+if (!ret_value)
+ if (sblock && H5EA__sblock_dest(sblock) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block")
-END_FUNC(PKG) /* end H5EA__sblock_alloc() */
+END_FUNC(PKG) /* end H5EA__sblock_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_create
*
@@ -182,81 +169,80 @@ END_FUNC(PKG) /* end H5EA__sblock_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-haddr_t, HADDR_UNDEF, HADDR_UNDEF,
-H5EA__sblock_create(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, hbool_t *stats_changed,
- unsigned sblk_idx))
+BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
+ H5EA__sblock_create(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, hbool_t *stats_changed,
+ unsigned sblk_idx))
- /* Local variables */
- H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
- haddr_t sblock_addr; /* Extensible array super block address */
- haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill data block addresses with */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+/* Local variables */
+H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
+haddr_t sblock_addr; /* Extensible array super block address */
+haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill data block addresses with */
+hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
- /* Sanity check */
- HDassert(hdr);
- HDassert(stats_changed);
+/* Sanity check */
+HDassert(hdr);
+HDassert(stats_changed);
- /* Allocate the super block */
- if(NULL == (sblock = H5EA__sblock_alloc(hdr, parent, sblk_idx)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block")
+/* Allocate the super block */
+if (NULL == (sblock = H5EA__sblock_alloc(hdr, parent, sblk_idx)))
+ H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block")
- /* Set size of super block on disk */
- sblock->size = H5EA_SBLOCK_SIZE(sblock);
+/* Set size of super block on disk */
+sblock->size = H5EA_SBLOCK_SIZE(sblock);
- /* Set offset of block in array's address space */
- sblock->block_off = hdr->sblk_info[sblk_idx].start_idx;
+/* Set offset of block in array's address space */
+sblock->block_off = hdr->sblk_info[sblk_idx].start_idx;
- /* Allocate space for the super block on disk */
- if(HADDR_UNDEF == (sblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_SBLOCK, (hsize_t)sblock->size)))
- H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array super block")
- sblock->addr = sblock_addr;
+/* Allocate space for the super block on disk */
+if (HADDR_UNDEF == (sblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_SBLOCK, (hsize_t)sblock->size)))
+ H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array super block")
+sblock->addr = sblock_addr;
- /* Reset data block addresses to "undefined" address value */
- H5VM_array_fill(sblock->dblk_addrs, &tmp_addr, sizeof(haddr_t), sblock->ndblks);
+/* Reset data block addresses to "undefined" address value */
+H5VM_array_fill(sblock->dblk_addrs, &tmp_addr, sizeof(haddr_t), sblock->ndblks);
- /* Cache the new extensible array super block */
- if(H5AC_insert_entry(hdr->f, H5AC_EARRAY_SBLOCK, sblock_addr, sblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add extensible array super block to cache")
- inserted = TRUE;
+/* Cache the new extensible array super block */
+if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_SBLOCK, sblock_addr, sblock, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTINSERT, "can't add extensible array super block to cache")
+inserted = TRUE;
- /* Add super block as child of 'top' proxy */
- if(hdr->top_proxy) {
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, sblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
- sblock->top_proxy = hdr->top_proxy;
- } /* end if */
+/* Add super block as child of 'top' proxy */
+if (hdr->top_proxy) {
+ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, sblock) < 0)
+ H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ sblock->top_proxy = hdr->top_proxy;
+} /* end if */
- /* Update extensible array super block statistics */
- hdr->stats.stored.nsuper_blks++;
- hdr->stats.stored.super_blk_size += sblock->size;
+/* Update extensible array super block statistics */
+hdr->stats.stored.nsuper_blks++;
+hdr->stats.stored.super_blk_size += sblock->size;
- /* Mark the statistics as changed */
- *stats_changed = TRUE;
+/* Mark the statistics as changed */
+*stats_changed = TRUE;
- /* Set address of super block to return */
- ret_value = sblock_addr;
+/* Set address of super block to return */
+ret_value = sblock_addr;
CATCH
- if(!H5F_addr_defined(ret_value))
- if(sblock) {
- /* Remove from cache, if inserted */
- if(inserted)
- if(H5AC_remove_entry(sblock) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array super block from cache")
-
- /* Release super block's disk space */
- if(H5F_addr_defined(sblock->addr) && H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_SBLOCK, sblock->addr, (hsize_t)sblock->size) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to release extensible array super block")
-
- /* Destroy super block */
- if(H5EA__sblock_dest(sblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block")
- } /* end if */
+if (!H5F_addr_defined(ret_value))
+ if (sblock) {
+ /* Remove from cache, if inserted */
+ if (inserted)
+ if (H5AC_remove_entry(sblock) < 0)
+ H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array super block from cache")
+
+ /* Release super block's disk space */
+ if (H5F_addr_defined(sblock->addr) &&
+ H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_SBLOCK, sblock->addr, (hsize_t)sblock->size) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to release extensible array super block")
+
+ /* Destroy super block */
+ if (H5EA__sblock_dest(sblock) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block")
+ } /* end if */
-END_FUNC(PKG) /* end H5EA__sblock_create() */
+END_FUNC(PKG) /* end H5EA__sblock_create() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_protect
*
@@ -269,54 +255,54 @@ END_FUNC(PKG) /* end H5EA__sblock_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-H5EA_sblock_t *, NULL, NULL,
-H5EA__sblock_protect(H5EA_hdr_t *hdr, H5EA_iblock_t *parent,
- haddr_t sblk_addr, unsigned sblk_idx, unsigned flags))
-
- /* Local variables */
- H5EA_sblock_t *sblock = NULL; /* Pointer to super block */
- H5EA_sblock_cache_ud_t udata; /* Information needed for loading super block */
-
- /* Sanity check */
- HDassert(hdr);
- HDassert(H5F_addr_defined(sblk_addr));
-
- /* only the H5AC__READ_ONLY_FLAG may be set */
- HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
-
- /* Set up user data */
- udata.hdr = hdr;
- udata.parent = parent;
- udata.sblk_idx = sblk_idx;
- udata.sblk_addr = sblk_addr;
-
- /* Protect the super block */
- if(NULL == (sblock = (H5EA_sblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_SBLOCK, sblk_addr, &udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long long)sblk_addr)
-
- /* Create top proxy, if it doesn't exist */
- if(hdr->top_proxy && NULL == sblock->top_proxy) {
- /* Add super block as child of 'top' proxy */
- if(H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, sblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
- sblock->top_proxy = hdr->top_proxy;
- } /* end if */
+BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL,
+ H5EA__sblock_protect(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx,
+ unsigned flags))
+
+/* Local variables */
+H5EA_sblock_t * sblock = NULL; /* Pointer to super block */
+H5EA_sblock_cache_ud_t udata; /* Information needed for loading super block */
+
+/* Sanity check */
+HDassert(hdr);
+HDassert(H5F_addr_defined(sblk_addr));
+
+/* only the H5AC__READ_ONLY_FLAG may be set */
+HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
+
+/* Set up user data */
+udata.hdr = hdr;
+udata.parent = parent;
+udata.sblk_idx = sblk_idx;
+udata.sblk_addr = sblk_addr;
+
+/* Protect the super block */
+if (NULL == (sblock = (H5EA_sblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_SBLOCK, sblk_addr, &udata, flags)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu",
+ (unsigned long long)sblk_addr)
+
+/* Create top proxy, if it doesn't exist */
+if (hdr->top_proxy && NULL == sblock->top_proxy) {
+ /* Add super block as child of 'top' proxy */
+ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, sblock) < 0)
+ H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ sblock->top_proxy = hdr->top_proxy;
+} /* end if */
- /* Set return value */
- ret_value = sblock;
+/* Set return value */
+ret_value = sblock;
CATCH
- /* Clean up on error */
- if(!ret_value) {
- /* Release the super block, if it was protected */
- if(sblock && H5AC_unprotect(hdr->f, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array super block, address = %llu", (unsigned long long)sblock->addr)
- } /* end if */
+/* Clean up on error */
+if (!ret_value) {
+ /* Release the super block, if it was protected */
+ if (sblock && H5AC_unprotect(hdr->f, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, H5AC__NO_FLAGS_SET) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array super block, address = %llu",
+ (unsigned long long)sblock->addr)
+} /* end if */
-END_FUNC(PKG) /* end H5EA__sblock_protect() */
+END_FUNC(PKG) /* end H5EA__sblock_protect() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_unprotect
*
@@ -329,24 +315,23 @@ END_FUNC(PKG) /* end H5EA__sblock_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__sblock_unprotect(H5EA_sblock_t *sblock, unsigned cache_flags))
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__sblock_unprotect(H5EA_sblock_t *sblock, unsigned cache_flags))
- /* Local variables */
+/* Local variables */
- /* Sanity check */
- HDassert(sblock);
+/* Sanity check */
+HDassert(sblock);
- /* Unprotect the super block */
- if(H5AC_unprotect(sblock->hdr->f, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array super block, address = %llu", (unsigned long long)sblock->addr)
+/* Unprotect the super block */
+if (H5AC_unprotect(sblock->hdr->f, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, cache_flags) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array super block, address = %llu",
+ (unsigned long long)sblock->addr)
CATCH
-END_FUNC(PKG) /* end H5EA__sblock_unprotect() */
+END_FUNC(PKG) /* end H5EA__sblock_unprotect() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_delete
*
@@ -359,42 +344,41 @@ END_FUNC(PKG) /* end H5EA__sblock_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__sblock_delete(H5EA_hdr_t *hdr, H5EA_iblock_t *parent,
- haddr_t sblk_addr, unsigned sblk_idx))
-
- /* Local variables */
- H5EA_sblock_t *sblock = NULL; /* Pointer to super block */
- size_t u; /* Local index variable */
-
- /* Sanity check */
- HDassert(hdr);
- HDassert(H5F_addr_defined(sblk_addr));
-
- /* Protect super block */
- if(NULL == (sblock = H5EA__sblock_protect(hdr, parent, sblk_addr, sblk_idx, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long long)sblk_addr)
-
- /* Iterate over data blocks */
- for(u = 0; u < sblock->ndblks; u++) {
- /* Check for data block existing */
- if(H5F_addr_defined(sblock->dblk_addrs[u])) {
- /* Delete data block */
- if(H5EA__dblock_delete(hdr, sblock, sblock->dblk_addrs[u], sblock->dblk_nelmts) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array data block")
- sblock->dblk_addrs[u] = HADDR_UNDEF;
- } /* end if */
- } /* end for */
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
+ H5EA__sblock_delete(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx))
+
+/* Local variables */
+H5EA_sblock_t *sblock = NULL; /* Pointer to super block */
+size_t u; /* Local index variable */
+
+/* Sanity check */
+HDassert(hdr);
+HDassert(H5F_addr_defined(sblk_addr));
+
+/* Protect super block */
+if (NULL == (sblock = H5EA__sblock_protect(hdr, parent, sblk_addr, sblk_idx, H5AC__NO_FLAGS_SET)))
+ H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu",
+ (unsigned long long)sblk_addr)
+
+/* Iterate over data blocks */
+for (u = 0; u < sblock->ndblks; u++) {
+ /* Check for data block existing */
+ if (H5F_addr_defined(sblock->dblk_addrs[u])) {
+ /* Delete data block */
+ if (H5EA__dblock_delete(hdr, sblock, sblock->dblk_addrs[u], sblock->dblk_nelmts) < 0)
+ H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array data block")
+ sblock->dblk_addrs[u] = HADDR_UNDEF;
+ } /* end if */
+} /* end for */
CATCH
- /* Finished deleting super block in metadata cache */
- if(sblock && H5EA__sblock_unprotect(sblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block")
+/* Finished deleting super block in metadata cache */
+if (sblock &&
+ H5EA__sblock_unprotect(sblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
+ H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block")
-END_FUNC(PKG) /* end H5EA__sblock_delete() */
+END_FUNC(PKG) /* end H5EA__sblock_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_dest
*
@@ -407,39 +391,36 @@ END_FUNC(PKG) /* end H5EA__sblock_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR,
-herr_t, SUCCEED, FAIL,
-H5EA__sblock_dest(H5EA_sblock_t *sblock))
-
- /* Sanity check */
- HDassert(sblock);
- HDassert(!sblock->has_hdr_depend);
-
- /* Check if shared header field has been initialized */
- if(sblock->hdr) {
- /* Free buffer for super block data block addresses, if there are any */
- if(sblock->dblk_addrs)
- sblock->dblk_addrs = H5FL_SEQ_FREE(haddr_t, sblock->dblk_addrs);
-
- /* Free buffer for super block 'page init' bitmask, if there is one */
- if(sblock->page_init) {
- HDassert(sblock->dblk_npages > 0);
- sblock->page_init = H5FL_BLK_FREE(page_init, sblock->page_init);
- } /* end if */
-
- /* Decrement reference count on shared info */
- if(H5EA__hdr_decr(sblock->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
- sblock->hdr = NULL;
+BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__sblock_dest(H5EA_sblock_t *sblock))
+
+/* Sanity check */
+HDassert(sblock);
+HDassert(!sblock->has_hdr_depend);
+
+/* Check if shared header field has been initialized */
+if (sblock->hdr) {
+ /* Free buffer for super block data block addresses, if there are any */
+ if (sblock->dblk_addrs)
+ sblock->dblk_addrs = H5FL_SEQ_FREE(haddr_t, sblock->dblk_addrs);
+
+ /* Free buffer for super block 'page init' bitmask, if there is one */
+ if (sblock->page_init) {
+ HDassert(sblock->dblk_npages > 0);
+ sblock->page_init = H5FL_BLK_FREE(page_init, sblock->page_init);
} /* end if */
- /* Sanity check */
- HDassert(NULL == sblock->top_proxy);
+ /* Decrement reference count on shared info */
+ if (H5EA__hdr_decr(sblock->hdr) < 0)
+ H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ sblock->hdr = NULL;
+} /* end if */
- /* Free the super block itself */
- sblock = H5FL_FREE(H5EA_sblock_t, sblock);
+/* Sanity check */
+HDassert(NULL == sblock->top_proxy);
-CATCH
+/* Free the super block itself */
+sblock = H5FL_FREE(H5EA_sblock_t, sblock);
-END_FUNC(PKG) /* end H5EA__sblock_dest() */
+CATCH
+END_FUNC(PKG) /* end H5EA__sblock_dest() */
diff --git a/src/H5EAstat.c b/src/H5EAstat.c